From 806f5db174bc6780454c82f35b9fe29929c94d05 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Fri, 7 Sep 2018 13:43:55 +0800 Subject: [PATCH] sync with OpenWrt trunk --- Makefile | 4 +- config/Config-kernel.in | 56 +- feeds.conf.default | 4 - include/download.mk | 81 +- include/hardening.mk | 4 +- include/host-build.mk | 2 +- include/image-commands.mk | 42 + include/kernel-version.mk | 10 +- include/netfilter.mk | 1 + include/package.mk | 2 +- include/prereq-build.mk | 9 +- include/subdir.mk | 2 +- include/target.mk | 6 +- include/verbose.mk | 2 +- include/version.mk | 9 +- package/base-files/Makefile | 8 +- package/base-files/files/bin/config_generate | 42 +- package/base-files/files/etc/ethers | 6 + package/base-files/files/etc/profile | 6 +- .../base-files/files/lib/functions/system.sh | 35 +- .../files/lib/functions/uci-defaults.sh | 76 +- .../base-files/files/lib/upgrade/common.sh | 6 + .../base-files/files/lib/upgrade/fwtool.sh | 25 + package/base-files/files/lib/upgrade/stage2 | 1 + package/base-files/files/sbin/sysupgrade | 7 +- package/base-files/files/sbin/wifi | 5 +- package/base-files/files/usr/lib/os-release | 2 +- package/base-files/image-config.in | 8 +- package/boot/apex/Makefile | 3 +- .../boot/arm-trusted-firmware-sunxi/Makefile | 6 +- package/boot/fconfig/Makefile | 3 +- package/boot/grub2/Makefile | 2 +- ...ix-packed-not-aligned-error-on-GCC-8.patch | 71 + .../grub2/patches/300-CVE-2015-8370.patch | 40 + package/boot/uboot-envtools/files/ath79 | 27 + package/boot/uboot-envtools/files/ipq40xx | 3 + package/boot/uboot-envtools/files/kirkwood | 1 + package/boot/uboot-envtools/files/layerscape | 25 + package/boot/uboot-imx6/Makefile | 44 +- .../patches/002-use-static-inline.patch | 72 - .../patches/003-use-weak-in-board.patch | 80 - .../patches/004-use-weak-in-main.patch | 27 - .../patches/100-wandboard-enable-fit.patch | 27 +- .../patches/101-gcc-compiler-linux-3-16.patch | 480 -- ...er_gcc-prevent-redefining-attributes.patch | 69 - ...piler-gcc5.h-to-fix-builds-with-gcc5.patch | 87 - .../patches/104-gcc-compiler-linux-4-5.patch | 790 --- .../patches/110-mx6cuboxi-mmc-fallback.patch | 26 + .../patches/110-wandboard-owrt-env.patch | 89 - .../patches/007-nsa310-uboot-generic.patch | 6 +- .../patches/008-nsa325-uboot-generic.patch | 6 +- .../patches/010-pogoplug_v4.patch | 16 +- .../uboot-kirkwood/patches/110-dockstar.patch | 8 +- .../uboot-kirkwood/patches/120-iconnect.patch | 6 +- .../uboot-kirkwood/patches/130-ib62x0.patch | 4 +- .../patches/140-pogoplug_e02.patch | 8 +- .../patches/150-goflexhome.patch | 4 +- package/boot/uboot-omap/Makefile | 10 +- package/boot/uboot-sunxi/Makefile | 17 +- .../003-add-theobroma-a31-pangolin.patch | 4 +- .../patches/062-A20-improve-gmac-upload.patch | 2 +- ...1-sun6i-sync-PLL1-multdiv-with-Boot1.patch | 2 +- .../093-sun6i-fix-PLL-LDO-voltselect.patch | 4 +- .../100-sun6i-alternate-on-UART2.patch | 2 +- .../101-sun6i-support-console-on-UART2.patch | 2 +- ...2-sunxi-make_CONS_INDEX-configurable.patch | 2 +- ...-environment-for-dtc-binary-location.patch | 10 +- .../patches/210-sunxi-deactivate-binman.patch | 21 +- .../220-add-sunxi50i-nanopi-neo-plus2.patch | 165 - .../patches/221-compatible-old-dtc.patch | 4 +- ...Sync-OTG-and-HCI-nodes-from-Linux-DT.patch | 63 + ...0-sunxi-Add-support-for-Orange-Pi-R1.patch | 68 +- .../400-ARM-dts-orange-pi-zero-plus.patch | 258 +- package/boot/uboot-zynq/Makefile | 13 +- ...q-dts-add-spi-flash-node-to-zedboard.patch | 38 + ...nq-add-support-for-the-zybo-z7-board.patch | 499 ++ ...ad-mac-address-from-SPI-flash-memory.patch | 107 + .../patches/210-link-libcrypto-static.patch | 4 +- package/boot/yamonenv/Makefile | 3 +- package/devel/gdb/Makefile | 4 +- .../devel/gdb/patches/110-shared_libgcc.patch | 12 +- .../120-sigprocmask-invalid-call.patch | 2 +- package/devel/perf/Makefile | 6 - package/devel/perf/musl-compat.h | 43 - package/devel/perf/musl-include/asm/errno.h | 8 - package/devel/perf/musl-include/string.h | 18 - package/devel/strace/Makefile | 10 +- ...00-workaround--pt-reg-collisions-ppc.patch | 2 +- package/firmware/ath10k-firmware/Makefile | 34 +- package/firmware/brcmfmac-board-rpi/Makefile | 88 + package/firmware/linux-firmware/broadcom.mk | 9 + package/firmware/linux-firmware/qca.mk | 4 + package/firmware/linux-firmware/realtek.mk | 23 + package/kernel/ath10k-ct/Makefile | 6 +- .../ath10k-ct/patches/100-kernel_compat.patch | 19 +- package/kernel/brcm2708-gpu-fw/Makefile | 14 +- package/kernel/kmod-sched-cake/Makefile | 6 +- package/kernel/lantiq/ltq-atm/src/ltq_atm.c | 45 +- package/kernel/lantiq/ltq-vdsl-fw/Makefile | 42 + .../lantiq/ltq-vdsl-fw/src/LzmaDecode.c | 584 ++ .../lantiq/ltq-vdsl-fw/src/LzmaDecode.h | 113 + .../kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h | 45 + .../lantiq/ltq-vdsl-fw/src/LzmaWrapper.c | 206 + .../lantiq/ltq-vdsl-fw/src/LzmaWrapper.h | 36 + .../kernel/lantiq/ltq-vdsl-fw/src/Makefile | 13 + .../lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh | 48 + .../lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c | 165 + .../linux/files/sysctl-tcp-bbr-k4_9.conf | 5 + .../kernel/linux/files/sysctl-tcp-bbr.conf | 4 + package/kernel/linux/modules/crypto.mk | 52 +- package/kernel/linux/modules/hwmon.mk | 22 + package/kernel/linux/modules/iio.mk | 22 + package/kernel/linux/modules/netdevices.mk | 38 +- package/kernel/linux/modules/netfilter.mk | 21 + package/kernel/linux/modules/netsupport.mk | 31 + package/kernel/linux/modules/other.mk | 45 +- package/kernel/linux/modules/usb.mk | 33 + package/kernel/linux/modules/video.mk | 50 +- package/kernel/mac80211/Makefile | 29 +- .../mac80211/files/lib/wifi/mac80211.sh | 2 +- .../patches/080-ath10k_thermal_config.patch | 10 + ...00-use-TXOP_BACKOFF-for-probe-frames.patch | 14 +- ...tral-scan-support-under-a-separate-c.patch | 2 +- ...firmware-support-for-monitor-interfa.patch | 59 + ...firmware-support-for-radiotap-monito.patch | 51 + ...msgbuf-packets-marked-with-monitor-m.patch | 137 + ...more-bits-for-the-flags-of-struct-br.patch | 60 + ...mac-update-STA-info-struct-to-the-v5.patch | 75 + ...y-some-features-per-firmware-version.patch | 84 + ...-0000-ath10k-handle-tdls-peer-events.patch | 115 + ...odify-svc-bitmap-parsing-for-wcn3990.patch | 215 + ...-TDLS-wider-bandwidth-support-for-5G.patch | 64 + ...upport-to-get-final-TPC-stats-for-10.patch | 824 +++ ...l-panic-while-using-worker-ath10k_st.patch | 99 + ...kernel-panic-while-reading-tpc_stats.patch | 119 + ...port-to-configure-channel-dwell-time.patch | 92 + ...to-get-the-detected-radar-specificat.patch | 94 + ...80-0008-ath10k-DFS-Host-Confirmation.patch | 546 ++ ...-ath10k-fix-memory-leak-of-tpc_stats.patch | 43 + ...10-ath10k-support-use-of-channel-173.patch | 52 + ...ral-scan-for-QCA9984-and-QCA9888-chi.patch | 156 + ...fix-tx99-with-monitor-mode-interface.patch | 92 + .../kernel/mac80211/patches/552-ahb_of.patch | 330 + .../602-rt2x00-introduce-rt2x00eeprom.patch | 2 +- ...-register-wiphy-s-during-module_init.patch | 2 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- .../930-ath10k_add_tpt_led_trigger.patch | 4 +- .../936-ath10k-fix-otp-failure-result.patch | 2 +- ...-mwl8k-add-non-DFS-5G-upper-channels.patch | 37 + ...-of-peer_bw_rxnss_override-parameter.patch | 94 +- ...dling-for-VHT160-in-recent-firmwares.patch | 9 +- ...rolling-support-for-various-chipsets.patch | 122 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 53 + ...ilable-channels-via-DT-ieee80211-fre.patch | 44 + package/kernel/mt76/Makefile | 6 +- package/kernel/mwlwifi/Makefile | 6 +- package/libs/elfutils/Makefile | 29 +- .../patches/002-argp_standalone.patch | 14 - .../elfutils/patches/003-libint-stub.patch | 26 +- .../patches/005-build_only_libs.patch | 12 - .../elfutils/patches/006-libdw_LIBS.patch | 11 - .../elfutils/patches/100-musl-compat.patch | 344 +- .../libs/elfutils/patches/101-no-fts.patch | 64 +- package/libs/libbsd/Makefile | 38 +- .../libbsd/patches/001-aarch64_support.patch | 19 - ...1-handle-systems-missing-sys_cdefs.h.patch | 195 + ...ion_for_glibc_already_providing_them.patch | 65 + package/libs/libconfig/Makefile | 8 +- package/libs/libevent2/Makefile | 35 +- ...-ERR_remove_thread_state-do-not-link.patch | 49 + ...ile.am-omit-building-sample-and-test.patch | 13 + package/libs/libjson-c/Makefile | 8 +- package/libs/libnftnl/Makefile | 6 +- .../100-src-add-flowtable-support.patch | 1444 ----- ...101-expr-add-flow-offload-expression.patch | 259 - package/libs/libnl/Makefile | 8 +- ...ivate-field-in-libnl-pkg-config-file.patch | 5 - ...workaround-to-the-libc-compat.h-copy.patch | 10 +- ...ild-enable-building-cli-during-tests.patch | 23 +- package/libs/libpcap/Makefile | 4 +- ...te_t.ai-usage-when-INET6-is-not-defi.patch | 41 - ...d-missing-compiler_state_t-parameter.patch | 67 - .../patches/100-debian_shared_lib.patch | 81 +- .../102-makefile_disable_manpages.patch | 9 +- .../103-makefile_flex_workaround.patch | 8 +- .../patches/201-space_optimization.patch | 2 +- .../libpcap/patches/202-protocol_api.patch | 142 - .../libpcap/patches/204-usb-bus-path.patch | 2 +- package/libs/librpc/Makefile | 9 + package/libs/libubox/Makefile | 7 +- package/libs/mbedtls/Makefile | 2 +- package/libs/mbedtls/patches/200-config.patch | 54 - .../patches/300-soversion-compatibility.patch | 34 - package/libs/ncurses/Makefile | 2 + package/libs/nettle/Makefile | 4 +- package/libs/nghttp2/Makefile | 4 +- package/libs/popt/Makefile | 2 +- package/libs/sysfsutils/Makefile | 12 + package/libs/sysfsutils/files/local.conf | 1 + package/libs/sysfsutils/files/sysfs.conf | 22 + package/libs/sysfsutils/files/sysfsutils | 48 + package/libs/ustream-ssl/Makefile | 6 +- package/libs/wolfssl/Config.in | 18 +- package/libs/wolfssl/Makefile | 19 +- .../wolfssl/patches/001-CVE-2017-13099.patch | 144 - .../patches/100-disable-hardening-check.patch | 2 +- .../900-remove-broken-autoconf-macros.patch | 21 + package/network/config/firewall/Makefile | 6 +- .../config/ltq-vdsl-app/files/dsl_control | 4 +- package/network/config/netifd/Makefile | 11 +- .../files/etc/hotplug.d/iface/00-netstate | 1 - .../config/netifd/files/lib/network/config.sh | 3 - .../qos-scripts/files/usr/bin/qos-start | 2 +- .../config/qos-scripts/files/usr/bin/qos-stop | 1 + .../qos-scripts/files/usr/lib/qos/generate.sh | 32 +- package/network/config/swconfig/src/swlib.c | 5 +- package/network/config/swconfig/src/uci.c | 2 +- package/network/ipv6/odhcp6c/Makefile | 2 +- .../network/ipv6/odhcp6c/files/dhcpv6.script | 15 +- package/network/ipv6/thc-ipv6/Makefile | 4 +- package/network/services/dropbear/Makefile | 12 +- .../020-Wait-to-fail-invalid-usernames.patch | 221 + .../dropbear/patches/100-pubkey_path.patch | 4 +- .../dropbear/patches/160-lto-jobserver.patch | 33 + package/network/services/ead/src/ead.c | 4 +- package/network/services/hostapd/Config.in | 73 +- package/network/services/hostapd/Makefile | 348 +- .../hostapd/files/hostapd-full.config | 2 +- .../network/services/hostapd/files/hostapd.sh | 3 +- ...-mesh-factor-out-mesh-join-function.patch} | 24 +- ...-mesh-factor-out-rsn-initialization.patch} | 48 +- ...003-mesh-relocate-RSN-init-function.patch} | 10 +- ...mpletion-callback-to-complete-mesh-.patch} | 14 +- ...untry-setting-to-mesh-configuration.patch} | 17 +- ...nel-driver-DFS-handler-in-userspace.patch} | 10 +- ...nnel-attributes-before-running-Mesh.patch} | 10 +- ...e-type-to-mesh-before-setting-inter.patch} | 8 +- ... 009-mesh-set-mesh-center-frequency.patch} | 8 +- ...mesh-interface-on-dfs-event-handler.patch} | 116 +- ...annels-to-be-selected-if-dfs-is-ena.patch} | 16 +- ...mesh-to-send-channel-switch-request.patch} | 8 +- ...do-not-allow-pri-sec-channel-switch.patch} | 8 +- ...t-allow-scan-result-to-swap-pri-sec.patch} | 8 +- ...h-do-not-use-offchan-mgmt-tx-on-DFS.patch} | 29 +- ...-fix-channel-switch-error-during-CAC.patch | 64 + ...nterface-context-to-send-DFS-event-m.patch | 107 + ...8-mesh-make-forwarding-configurable.patch} | 54 +- ...20-mesh-properly-handle-sae_password.patch | 52 - ...x-crash-with-CONFIG_TAXONOMY-enabled.patch | 2 +- .../030-rsn_supp-fix-stub-pmksa_cache.patch | 21 - ...CHANWIDTH_USE_HT-to-max_oper_chwidth.patch | 4 +- ...ent-use-of-VHT20-config-in-mesh-mode.patch | 8 +- ...mesh-fix-parsing-of-max_oper_chwidth.patch | 2 +- .../hostapd/patches/110-no_eapol_fix.patch | 2 +- .../hostapd/patches/200-multicall.patch | 28 +- .../services/hostapd/patches/300-noscan.patch | 4 +- .../hostapd/patches/301-mesh-noscan.patch | 12 +- .../patches/310-rescan_immediately.patch | 2 +- .../patches/340-reload_freq_change.patch | 6 +- .../patches/350-nl80211_del_beacon_bss.patch | 6 +- .../patches/360-ctrl_iface_reload.patch | 4 +- .../hostapd/patches/370-ap_sta_support.patch | 14 +- .../patches/380-disable_ctrl_iface_mib.patch | 22 +- .../381-hostapd_cli_UNKNOWN-COMMAND.patch | 13 + .../patches/430-hostapd_cli_ifdef.patch | 32 +- ...dd-new-config-params-to-be-used-with.patch | 6 +- .../patches/463-add-mcast_rate-to-11s.patch | 6 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/500-lto-jobserver-support.patch | 50 + .../hostapd/patches/600-ubus_support.patch | 54 +- .../services/hostapd/src/src/ap/ubus.c | 100 +- .../services/hostapd/src/src/ap/ubus.h | 7 +- package/network/services/igmpproxy/Makefile | 2 +- .../services/igmpproxy/files/igmpproxy.config | 2 +- .../services/igmpproxy/files/igmpproxy.init | 19 +- package/network/services/odhcpd/Makefile | 8 +- .../services/openvpn-easy-rsa/Makefile | 15 +- .../patches/101-static_EASYRSA.patch | 22 + package/network/services/openvpn/Makefile | 2 +- .../services/openvpn/files/openvpn.init | 1 + package/network/services/samba36/Makefile | 4 +- .../network/services/samba36/files/samba.init | 1 + package/network/services/uhttpd/Makefile | 16 +- .../services/uhttpd/files/uhttpd.config | 11 +- .../network/services/uhttpd/files/uhttpd.init | 26 +- package/network/services/wireguard/Makefile | 6 +- .../network/utils/comgt/files/runcommand.gcom | 2 +- package/network/utils/curl/Makefile | 21 +- .../curl/patches/400-CVE-2018-0500.patch | 32 - package/network/utils/ebtables/Makefile | 6 +- .../utils/ebtables/patches/100-musl_fix.patch | 2 +- .../patches/200-fix-extension-init.patch | 11 + package/network/utils/ethtool/Makefile | 4 +- package/network/utils/iperf3/Makefile | 6 +- package/network/utils/iproute2/Makefile | 8 +- ...int-fix-hidden-64-bit-type-promotion.patch | 288 - .../{001-config.patch => 100-config.patch} | 0 ...win_fixes.patch => 110-darwin_fixes.patch} | 0 .../{007-no_arpd.patch => 120-no_arpd.patch} | 0 ...{008-no_netem.patch => 130-no_netem.patch} | 4 +- ..._fast.patch => 140-allow_pfifo_fast.patch} | 0 ...l.patch => 140-keep_libmnl_optional.patch} | 0 ...ra-ccopts.patch => 150-extra-ccopts.patch} | 2 +- ...ink-pic.patch => 160-libnetlink-pic.patch} | 2 +- .../{300-ip_tiny.patch => 170-ip_tiny.patch} | 8 +- ...ICY.patch => 180-drop_FAILED_POLICY.patch} | 0 ...e-to-tc.patch => 190-add-cake-to-tc.patch} | 104 +- package/network/utils/iptables/Makefile | 65 +- package/network/utils/iw/Makefile | 5 +- package/network/utils/iwinfo/Makefile | 6 +- package/network/utils/nftables/Makefile | 24 +- .../patches/100-disable-doc-generation.patch | 10 - ...00-src-support-for-flowtable-listing.patch | 515 -- ...01-src-add-support-to-add-flowtables.patch | 515 -- .../patches/202-src-delete-flowtable.patch | 122 - .../203-src-flow-offload-support.patch | 191 - .../204-tests-shell-add-flowtable-tests.patch | 110 - .../205-doc-nft-document-flowtable.patch | 128 - package/network/utils/tcpdump/Makefile | 1 + .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 4 +- package/system/ca-certificates/Makefile | 2 + package/system/fstools/Makefile | 22 +- package/system/procd/Makefile | 9 +- package/system/procd/files/procd.sh | 8 + package/system/ubus/Makefile | 3 +- package/system/ucert/Makefile | 72 + package/utils/adb/Makefile | 2 +- .../utils/adb/patches/010-openssl-1.1.patch | 28 + package/utils/admswconfig/Makefile | 3 +- package/utils/busybox/Config-defaults.in | 60 + package/utils/busybox/Makefile | 24 +- package/utils/busybox/config/Config.in | 10 +- .../utils/busybox/config/archival/Config.in | 9 + .../patches/001-resource_h_include.patch | 10 - .../patches/111-i386_no_arch_flags.patch | 10 - .../busybox/patches/120-lto-jobserver.patch | 27 + .../patches/130-mconf_missing_sigwinch.patch | 6 +- .../patches/200-udhcpc_reduce_msgs.patch | 4 +- .../patches/201-udhcpc_changed_ifindex.patch | 2 +- .../203-udhcpc_renew_no_deconfig.patch | 2 +- .../301-ip-link-fix-netlink-msg-size.patch | 2 +- ...de-which-requires-server-ID-to-be-on.patch | 117 - package/utils/bzip2/Makefile | 2 +- .../bzip2/patches/010-CVE-2016-3189.patch | 11 + package/utils/e2fsprogs/Makefile | 8 +- package/utils/f2fs-tools/Makefile | 4 +- package/utils/nvram/Makefile | 2 +- package/utils/px5g/Makefile | 2 +- package/utils/ugps/Makefile | 6 +- package/utils/ugps/files/gps.config | 1 + package/utils/ugps/files/ugps.init | 3 + package/utils/usbutils/Makefile | 10 +- package/utils/util-linux/Makefile | 22 +- rules.mk | 9 +- scripts/bundle-libraries.sh | 25 +- scripts/config/conf.c | 12 +- scripts/dl_github_archive.py | 427 ++ scripts/download.pl | 1 - scripts/fixup-makefile.pl | 2 +- scripts/slugimage.pl | 8 +- scripts/target-metadata.pl | 2 + scripts/time.pl | 65 + target/Config.in | 6 + target/imagebuilder/files/Makefile | 4 +- target/linux/adm5120/Makefile | 24 + .../adm5120/base-files/etc/board.d/01_leds | 17 + .../adm5120/base-files/etc/config/network | 39 + target/linux/adm5120/base-files/etc/diag.sh | 22 + target/linux/adm5120/base-files/etc/inittab | 5 + .../linux/adm5120/base-files/lib/adm5120.sh | 53 + .../lib/preinit/01_preinit_do_adm5120.sh | 7 + .../lib/preinit/05_set_preinit_iface_adm5120 | 9 + .../base-files/lib/upgrade/platform.sh | 35 + target/linux/adm5120/config-3.18 | 175 + .../files-3.18/arch/mips/adm5120/Kconfig | 197 + .../files-3.18/arch/mips/adm5120/Platform | 19 + .../arch/mips/adm5120/cellvision/Makefile | 4 + .../arch/mips/adm5120/cellvision/cas-771.c | 37 + .../arch/mips/adm5120/cellvision/cellvision.c | 147 + .../arch/mips/adm5120/cellvision/cellvision.h | 28 + .../arch/mips/adm5120/cellvision/nfs-101.c | 47 + .../arch/mips/adm5120/common/Makefile | 8 + .../arch/mips/adm5120/common/adm5120.c | 76 + .../arch/mips/adm5120/common/clock.c | 65 + .../arch/mips/adm5120/common/early-printk.c | 31 + .../arch/mips/adm5120/common/gpio.c | 328 + .../files-3.18/arch/mips/adm5120/common/irq.c | 171 + .../arch/mips/adm5120/common/memory.c | 149 + .../arch/mips/adm5120/common/platform.c | 375 ++ .../arch/mips/adm5120/common/prom.c | 264 + .../arch/mips/adm5120/common/setup.c | 129 + .../arch/mips/adm5120/compex/Makefile | 5 + .../arch/mips/adm5120/compex/compex.c | 60 + .../arch/mips/adm5120/compex/compex.h | 23 + .../arch/mips/adm5120/compex/np27g.c | 28 + .../arch/mips/adm5120/compex/np28g.c | 63 + .../arch/mips/adm5120/compex/wp54.c | 95 + .../arch/mips/adm5120/edimax/Makefile | 5 + .../arch/mips/adm5120/edimax/br-6104k.c | 36 + .../arch/mips/adm5120/edimax/br-6104kp.c | 39 + .../arch/mips/adm5120/edimax/br-61x4wg.c | 43 + .../arch/mips/adm5120/edimax/br-61xx.c | 84 + .../arch/mips/adm5120/edimax/br-61xx.h | 23 + .../arch/mips/adm5120/generic/Makefile | 1 + .../arch/mips/adm5120/generic/eb-214a.c | 120 + .../arch/mips/adm5120/infineon/Makefile | 6 + .../arch/mips/adm5120/infineon/easy5120-rt.c | 48 + .../mips/adm5120/infineon/easy5120-wvoip.c | 24 + .../mips/adm5120/infineon/easy5120p-ata.c | 22 + .../arch/mips/adm5120/infineon/easy83000.c | 23 + .../arch/mips/adm5120/infineon/infineon.c | 108 + .../arch/mips/adm5120/infineon/infineon.h | 25 + .../arch/mips/adm5120/mikrotik/Makefile | 8 + .../arch/mips/adm5120/mikrotik/rb-11x.c | 35 + .../arch/mips/adm5120/mikrotik/rb-133.c | 40 + .../arch/mips/adm5120/mikrotik/rb-133c.c | 36 + .../arch/mips/adm5120/mikrotik/rb-150.c | 131 + .../arch/mips/adm5120/mikrotik/rb-153.c | 70 + .../arch/mips/adm5120/mikrotik/rb-192.c | 27 + .../arch/mips/adm5120/mikrotik/rb-1xx.c | 149 + .../arch/mips/adm5120/mikrotik/rb-1xx.h | 33 + .../arch/mips/adm5120/motorola/Makefile | 1 + .../arch/mips/adm5120/motorola/pmugw.c | 96 + .../arch/mips/adm5120/osbridge/5gxi.c | 71 + .../arch/mips/adm5120/osbridge/Makefile | 1 + .../arch/mips/adm5120/prom/Makefile | 10 + .../arch/mips/adm5120/prom/admboot.c | 55 + .../arch/mips/adm5120/prom/bootbase.c | 119 + .../files-3.18/arch/mips/adm5120/prom/cfe.c | 69 + .../arch/mips/adm5120/prom/generic.c | 47 + .../arch/mips/adm5120/prom/myloader.c | 68 + .../arch/mips/adm5120/prom/prom_read.h | 50 + .../arch/mips/adm5120/prom/routerboot.c | 121 + .../arch/mips/adm5120/zyxel/Makefile | 4 + .../arch/mips/adm5120/zyxel/p-334wt.c | 34 + .../arch/mips/adm5120/zyxel/p-335.c | 21 + .../arch/mips/adm5120/zyxel/p-33x.c | 85 + .../arch/mips/adm5120/zyxel/p-33x.h | 22 + .../include/asm/mach-adm5120/adm5120_defs.h | 53 + .../include/asm/mach-adm5120/adm5120_info.h | 129 + .../include/asm/mach-adm5120/adm5120_intc.h | 63 + .../include/asm/mach-adm5120/adm5120_mpmc.h | 92 + .../include/asm/mach-adm5120/adm5120_nand.h | 89 + .../asm/mach-adm5120/adm5120_platform.h | 87 + .../include/asm/mach-adm5120/adm5120_switch.h | 300 + .../include/asm/mach-adm5120/adm5120_uart.h | 64 + .../mips/include/asm/mach-adm5120/asm/sizes.h | 56 + .../asm/mach-adm5120/cpu-feature-overrides.h | 71 + .../arch/mips/include/asm/mach-adm5120/gpio.h | 115 + .../arch/mips/include/asm/mach-adm5120/irq.h | 43 + .../include/asm/mach-adm5120/prom/admboot.h | 17 + .../mips/include/asm/mach-adm5120/prom/cfe.h | 18 + .../include/asm/mach-adm5120/prom/generic.h | 18 + .../include/asm/mach-adm5120/prom/myloader.h | 179 + .../asm/mach-adm5120/prom/routerboot.h | 36 + .../include/asm/mach-adm5120/prom/zynos.h | 86 + .../arch/mips/include/asm/mach-adm5120/war.h | 25 + .../files-3.18/arch/mips/pci/pci-adm5120.c | 277 + .../files-3.18/drivers/ata/pata_rb153_cf.c | 267 + .../drivers/leds/ledtrig-adm5120-switch.c | 149 + .../drivers/mtd/maps/adm5120-flash.c | 482 ++ .../adm5120/files-3.18/drivers/mtd/trxsplit.c | 216 + .../files-3.18/drivers/net/adm5120sw.c | 1219 ++++ .../files-3.18/drivers/net/adm5120sw.h | 23 + .../files-3.18/drivers/usb/host/adm5120-dbg.c | 836 +++ .../files-3.18/drivers/usb/host/adm5120-drv.c | 228 + .../files-3.18/drivers/usb/host/adm5120-hcd.c | 843 +++ .../files-3.18/drivers/usb/host/adm5120-hub.c | 430 ++ .../files-3.18/drivers/usb/host/adm5120-mem.c | 202 + .../files-3.18/drivers/usb/host/adm5120-pm.c | 449 ++ .../files-3.18/drivers/usb/host/adm5120-q.c | 964 +++ .../files-3.18/drivers/usb/host/adm5120.h | 755 +++ .../files-3.18/drivers/watchdog/adm5120_wdt.c | 202 + target/linux/adm5120/image/Makefile | 112 + .../linux/adm5120/image/lzma-loader/Makefile | 62 + .../image/lzma-loader/src/LzmaDecode.c | 584 ++ .../image/lzma-loader/src/LzmaDecode.h | 113 + .../adm5120/image/lzma-loader/src/LzmaTypes.h | 45 + .../adm5120/image/lzma-loader/src/Makefile | 99 + .../adm5120/image/lzma-loader/src/README | 55 + .../adm5120/image/lzma-loader/src/board.c | 185 + .../adm5120/image/lzma-loader/src/config.h | 143 + .../image/lzma-loader/src/decompress.c | 353 ++ .../adm5120/image/lzma-loader/src/head.S | 209 + .../adm5120/image/lzma-loader/src/loader.lds | 29 + .../image/lzma-loader/src/lzma-data.lds | 8 + .../adm5120/image/lzma-loader/src/printf.c | 350 ++ .../adm5120/image/lzma-loader/src/printf.h | 18 + target/linux/adm5120/image/rb1xx.mk | 24 + target/linux/adm5120/image/router_be.mk | 48 + target/linux/adm5120/image/router_le.mk | 401 ++ target/linux/adm5120/modules.mk | 56 + .../adm5120/patches-3.18/001-adm5120.patch | 44 + .../patches-3.18/002-adm5120_flash.patch | 21 + .../patches-3.18/003-adm5120_switch.patch | 23 + .../patches-3.18/005-adm5120_usb.patch | 33 + .../patches-3.18/007-adm5120_pci.patch | 22 + .../009-adm5120_leds_switch_trigger.patch | 22 + .../050-revert_rootfs_splits.patch | 354 ++ .../patches-3.18/100-rootfs_split.patch | 316 + .../101-cfi_fixup_macronix_bootloc.patch | 84 + .../102-jedec_pmc_39lvxxx_chips.patch | 68 + .../patches-3.18/103-mtd_trxsplit.patch | 23 + .../patches-3.18/120-rb153_cf_driver.patch | 28 + .../patches-3.18/200-amba_pl010_hacks.patch | 354 ++ .../203-gpio_leds_brightness.patch | 27 + .../patches-3.18/310-adm5120_wdt.patch | 31 + .../adm5120/rb1xx/base-files/sbin/wget2nand | 78 + target/linux/adm5120/rb1xx/config-default | 52 + target/linux/adm5120/rb1xx/profiles/RB1xx.mk | 18 + target/linux/adm5120/rb1xx/target.mk | 8 + target/linux/adm5120/router_be/config-default | 13 + .../adm5120/router_be/profiles/010-Generic.mk | 17 + .../adm5120/router_be/profiles/200-ZyXEL.mk | 27 + target/linux/adm5120/router_be/target.mk | 10 + target/linux/adm5120/router_le/config-3.8 | 0 .../adm5120/router_le/profiles/010-Generic.mk | 28 + .../adm5120/router_le/profiles/Cellvision.mk | 146 + .../adm5120/router_le/profiles/Compex.mk | 37 + .../adm5120/router_le/profiles/Edimax.mk | 47 + .../adm5120/router_le/profiles/Infineon.mk | 27 + .../adm5120/router_le/profiles/Motorola.mk | 16 + .../adm5120/router_le/profiles/Osbridge.mk | 16 + target/linux/adm5120/router_le/target.mk | 10 + target/linux/adm8668/Makefile | 24 + .../adm8668/base-files/etc/config/network | 24 + target/linux/adm8668/base-files/etc/diag.sh | 21 + .../preinit/03_init_hotplug_failsafe_adm8668 | 9 + .../lib/preinit/05_set_preinit_face_adm8668 | 9 + .../base-files/lib/upgrade/platform.sh | 15 + .../adm8668/base-files/sbin/hotplug.failsafe | 4 + target/linux/adm8668/config-3.18 | 104 + .../files-3.18/arch/mips/adm8668/Kconfig | 2 + .../files-3.18/arch/mips/adm8668/Makefile | 6 + .../files-3.18/arch/mips/adm8668/Platform | 6 + .../files-3.18/arch/mips/adm8668/clock.c | 76 + .../arch/mips/adm8668/early_printk.c | 16 + .../files-3.18/arch/mips/adm8668/gpio.c | 123 + .../files-3.18/arch/mips/adm8668/irq.c | 126 + .../files-3.18/arch/mips/adm8668/platform.c | 196 + .../files-3.18/arch/mips/adm8668/prom.c | 95 + .../files-3.18/arch/mips/adm8668/setup.c | 36 + .../files-3.18/arch/mips/adm8668/time.c | 20 + .../files-3.18/arch/mips/adm8668/u-boot.h | 52 + .../mips/include/asm/mach-adm8668/adm8668.h | 69 + .../mips/include/asm/mach-adm8668/asm/sizes.h | 56 + .../arch/mips/include/asm/mach-adm8668/gpio.h | 13 + .../arch/mips/include/asm/mach-adm8668/irq.h | 14 + .../arch/mips/include/asm/mach-adm8668/war.h | 25 + .../files-3.18/arch/mips/pci/pci-adm8668.c | 200 + .../files-3.18/drivers/mtd/maps/adm8668.c | 334 + target/linux/adm8668/image/Makefile | 60 + .../linux/adm8668/image/lzma-loader/Makefile | 41 + .../image/lzma-loader/src/LzmaDecode.c | 590 ++ .../image/lzma-loader/src/LzmaDecode.h | 131 + .../adm8668/image/lzma-loader/src/Makefile | 47 + .../image/lzma-loader/src/decompress.c | 118 + .../image/lzma-loader/src/include/_exports.h | 18 + .../lzma-loader/src/include/asm/global_data.h | 60 + .../lzma-loader/src/include/asm/u-boot.h | 42 + .../image/lzma-loader/src/include/common.h | 48 + .../image/lzma-loader/src/include/exports.h | 38 + .../image/lzma-loader/src/include/image.h | 157 + .../adm8668/image/lzma-loader/src/lzma.lds.in | 24 + .../adm8668/image/lzma-loader/src/stubs.c | 52 + target/linux/adm8668/image/my-mkimage | 32 + .../patches-3.18/001-adm8668_arch.patch | 48 + .../patches-3.18/002-adm8668_pci.patch | 22 + .../patches-3.18/003-adm8668_nor_map.patch | 22 + .../patches-3.18/004-tulip_pci_split.patch | 452 ++ .../patches-3.18/005-tulip_platform.patch | 490 ++ .../patches-3.18/200-amba_pl010_hacks.patch | 377 ++ .../patches-3.18/201-amba_bus_hacks.patch | 13 + .../linux/adm8668/profiles/100-WRTU54G-TM.mk | 17 + target/linux/apm821xx/base-files/etc/diag.sh | 6 +- target/linux/apm821xx/dts/apollo3g.dtsi | 189 - target/linux/apm821xx/dts/meraki-mr24.dts | 1 - target/linux/apm821xx/dts/meraki-mx60.dts | 1 - .../linux/apm821xx/dts/wd-mybooklive-duo.dts | 38 - target/linux/apm821xx/dts/wd-mybooklive.dts | 182 +- target/linux/apm821xx/image/Makefile | 33 +- target/linux/apm821xx/image/mbl_boot.scr | 8 +- .../linux/apm821xx/image/mbl_gen_hdd_img.sh | 8 +- target/linux/apm821xx/sata/config-default | 8 + target/linux/apm821xx/sata/target.mk | 4 +- target/linux/arc770/Makefile | 2 +- .../linux/arc770/{config-4.9 => config-4.14} | 47 +- target/linux/arc770/image/uEnv.txt | 6 +- ...c-Disable-frame-filtering-completely.patch | 2 +- target/linux/archs38/image/uEnv.txt | 6 +- target/linux/at91/config-4.9 | 4 - .../files/arch/arm/boot/dts/at91-q5xr5.dts | 6 +- .../at91/files/arch/arm/boot/dts/lmu5000.dts | 1 - .../at91/files/arch/arm/boot/dts/wb50n.dts | 47 +- target/linux/ath25/image/Makefile | 4 +- .../ath79/base-files/etc/board.d/02_network | 13 + .../ath79/base-files/lib/upgrade/platform.sh | 13 + target/linux/ath79/dts/ar7100.dtsi | 27 +- .../ath79/dts/ar7161_dlink_dir-825-b1.dts | 6 +- .../dts/ar7161_ubnt_routerstation-pro.dts | 31 + .../ath79/dts/ar7161_ubnt_routerstation.dts | 27 + .../ath79/dts/ar7161_ubnt_routerstation.dtsi | 106 + .../ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts | 1 - .../ath79/dts/ar7242_tplink_tl-wr2543-v1.dts | 1 - target/linux/ath79/dts/ar9132.dtsi | 1 + .../dts/ar9331_embeddedwireless_dorin.dts | 1 + .../linux/ath79/dts/ar9331_pisen_wmm003n.dts | 1 - target/linux/ath79/dts/ar9341_pcs_cr3000.dts | 1 - target/linux/ath79/dts/ar9344_pcs_cap324.dts | 1 - target/linux/ath79/dts/ar9344_pcs_cr5000.dts | 2 - .../dts/qca9558_tplink_tl-wdr4900-v2.dts | 1 - .../linux/ath79/dts/qca9561_avm_fritz4020.dts | 1 - .../net/ethernet/atheros/ag71xx/ag71xx.h | 2 + .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 68 + .../net/ethernet/atheros/ag71xx/ag71xx_mdio.c | 4 +- target/linux/ath79/generic/config-default | 1 + target/linux/ath79/image/generic-ubnt.mk | 30 + ...9-intc-add-irq-cascade-driver-for-QC.patch | 8 +- ...ip-irq-ath79-cpu-drop-OF-init-helper.patch | 4 +- ...-ath79-add-lots-of-missing-registers.patch | 25 +- ...d-support-for-QCA953x-QCA956x-TP9343.patch | 400 ++ ...-ath79-select-the-PINCTRL-subsystem.patch} | 8 +- ...Avoid-using-unitialized-reg-variable.patch | 42 - .../0013-MIPS-ath79-fix-system-restart.patch | 9 +- ...14-MIPS-ath79-finetune-cpu-overrides.patch | 8 +- ...ath79-enable-uart-during-early_prink.patch | 10 +- ...PS-ath79-add-support-for-QCA953x-SoC.patch | 331 - ...79-get-PCIe-controller-out-of-reset.patch} | 5 +- ...PS-ath79-add-support-for-qca956x-soc.patch | 410 -- ...ngs-PCI-qcom-ar7100-adds-binding-doc.patch | 57 + ... 0018-MIPS-pci-ar71xx-convert-to-OF.patch} | 37 +- ...ngs-PCI-qcom-ar7240-adds-binding-doc.patch | 61 + ... 0020-MIPS-pci-ar724x-convert-to-OF.patch} | 28 +- ...lpers-for-setting-clocks-and-expose.patch} | 27 +- ...egacy-wdt-and-uart-clock-aliases-ou.patch} | 22 +- ...ss-PLL-base-to-clock-init-functions.patch} | 48 +- ...pecifying-the-reference-clock-in-DT.patch} | 40 +- ...t-setting-up-clock-via-DT-on-all-So.patch} | 12 +- ...-export-switch-MDIO-reference-clock.patch} | 17 +- ...027-MIPS-ath79-drop-legacy-IRQ-code.patch} | 155 +- ...MIPS-ath79-drop-mips_machine-support.patch | 172 - ...h => 0028-MIPS-ath79-drop-machfiles.patch} | 310 +- ...029-MIPS-ath79-drop-legacy-pci-code.patch} | 71 +- ...p-platform-device-registration-code.patch} | 69 +- .../0031-MIPS-ath79-drop-OF-clock-code.patch | 95 + ...=> 0032-MIPS-ath79-sanitize-symbols.patch} | 44 +- .../0033-spi-ath79-drop-pdata-support.patch | 73 + .../0035-MIPS-ath79-fix-QCA956x-boot.patch | 17 - ...=> 0036-GPIO-add-named-gpio-exports.patch} | 0 ...-MIPS-ath79-remove-irq-code-from-pci.patch | 139 + .../patches-4.14/0037-missing-registers.patch | 21 + .../461-spi-ath79-add-fast-flash-read.patch | 14 +- ...ath79-swizzle-pci-address-for-ar71xx.patch | 4 +- .../910-unaligned_access_hacks.patch | 10 +- target/linux/au1000/Makefile | 32 + target/linux/au1000/au1500/config-default | 5 + .../linux/au1000/au1500/profiles/Atheros.mk | 13 + .../au1000/au1500/profiles/InternetBox.mk | 18 + .../linux/au1000/au1500/profiles/MeshCube.mk | 18 + target/linux/au1000/au1500/target.mk | 7 + target/linux/au1000/au1550/config-default | 4 + .../linux/au1000/au1550/profiles/DBAu1550.mk | 13 + target/linux/au1000/au1550/target.mk | 8 + target/linux/au1000/base-files/etc/diag.sh | 21 + .../au1000/base-files/lib/upgrade/platform.sh | 26 + target/linux/au1000/config-3.18 | 140 + target/linux/au1000/image/Makefile | 74 + target/linux/au1000/modules.mk | 17 + .../patches-3.18/002-openwrt_rootfs.patch | 11 + .../patches-3.18/003-au1000_eth_ioctl.patch | 17 + .../patches-3.18/004-watchdog_low_init.patch | 12 + .../linux/au1000/patches-3.18/006-codec.patch | 26 + target/linux/brcm2708/Makefile | 1 - .../lib/firmware/brcm/brcmfmac43430-sdio.txt | 66 - .../base-files/lib/upgrade/platform.sh | 2 +- target/linux/brcm2708/image/Makefile | 3 + ...able-USB-power-on-Netgear-WNDR3400v3.patch | 39 + target/linux/brcm63xx/Makefile | 2 +- .../base-files/etc/board.d/02_network | 6 + target/linux/brcm63xx/base-files/etc/diag.sh | 4 + .../linux/brcm63xx/base-files/lib/brcm63xx.sh | 3 + target/linux/brcm63xx/dts/a226g.dts | 2 - target/linux/brcm63xx/dts/a226m-fwb.dts | 2 - target/linux/brcm63xx/dts/a226m.dts | 2 - target/linux/brcm63xx/dts/a4001n.dts | 2 - target/linux/brcm63xx/dts/a4001n1.dts | 2 - target/linux/brcm63xx/dts/ad1018-nor.dts | 3 - target/linux/brcm63xx/dts/agpf-s0.dts | 2 - target/linux/brcm63xx/dts/ar-5315u.dts | 3 - target/linux/brcm63xx/dts/ar-5381u.dts | 2 - target/linux/brcm63xx/dts/ar-5387un.dts | 2 - target/linux/brcm63xx/dts/ar1004g.dts | 2 - target/linux/brcm63xx/dts/av4202n.dts | 2 - target/linux/brcm63xx/dts/bcm96318ref.dts | 4 +- .../linux/brcm63xx/dts/bcm96318ref_p300.dts | 4 +- .../linux/brcm63xx/dts/bcm963268bu_p300.dts | 4 +- target/linux/brcm63xx/dts/bcm963269bhr.dts | 4 +- target/linux/brcm63xx/dts/bcm963281TAN.dts | 2 - target/linux/brcm63xx/dts/bcm96328avng.dts | 2 - target/linux/brcm63xx/dts/bcm96338GW.dts | 2 - target/linux/brcm63xx/dts/bcm96338W.dts | 2 - target/linux/brcm63xx/dts/bcm96345GW2.dts | 2 - target/linux/brcm63xx/dts/bcm96348GW-10.dts | 2 - target/linux/brcm63xx/dts/bcm96348GW-11.dts | 2 - target/linux/brcm63xx/dts/bcm96348GW.dts | 2 - target/linux/brcm63xx/dts/bcm96348R.dts | 2 - target/linux/brcm63xx/dts/bcm96358VW.dts | 2 - target/linux/brcm63xx/dts/bcm96358VW2.dts | 2 - target/linux/brcm63xx/dts/bcm96368MVNgr.dts | 2 - target/linux/brcm63xx/dts/bcm96368MVWG.dts | 2 - target/linux/brcm63xx/dts/cpva502plus.dts | 2 - target/linux/brcm63xx/dts/cpva642.dts | 2 - target/linux/brcm63xx/dts/ct-5365.dts | 2 - target/linux/brcm63xx/dts/ct-6373.dts | 2 - target/linux/brcm63xx/dts/ct536plus.dts | 2 - target/linux/brcm63xx/dts/cvg834g.dts | 2 - target/linux/brcm63xx/dts/dg834g_v4.dts | 2 - target/linux/brcm63xx/dts/dg834gtpn.dts | 2 - target/linux/brcm63xx/dts/dgnd3700v1.dts | 4 +- target/linux/brcm63xx/dts/dsl-2640b-b.dts | 2 - target/linux/brcm63xx/dts/dsl-2640u.dts | 2 - target/linux/brcm63xx/dts/dsl-2650u.dts | 2 - target/linux/brcm63xx/dts/dsl-274xb-c.dts | 2 - target/linux/brcm63xx/dts/dsl-274xb-f.dts | 2 - target/linux/brcm63xx/dts/dsl-275xb-d.dts | 2 - target/linux/brcm63xx/dts/dv-201amr.dts | 2 - target/linux/brcm63xx/dts/dva-g3810bn_tl.dts | 2 - target/linux/brcm63xx/dts/evg2000.dts | 2 - target/linux/brcm63xx/dts/f5d7633.dts | 2 - target/linux/brcm63xx/dts/fast2404.dts | 2 - target/linux/brcm63xx/dts/fast2504n.dts | 2 - target/linux/brcm63xx/dts/fast2604.dts | 2 - target/linux/brcm63xx/dts/fast2704n.dts | 2 - target/linux/brcm63xx/dts/fast2704v2.dts | 2 - target/linux/brcm63xx/dts/gw6000.dts | 2 - target/linux/brcm63xx/dts/gw6200.dts | 2 - target/linux/brcm63xx/dts/hg520v.dts | 4 +- target/linux/brcm63xx/dts/hg553.dts | 2 - target/linux/brcm63xx/dts/hg556a-a.dts | 2 - target/linux/brcm63xx/dts/hg556a-b.dts | 2 - target/linux/brcm63xx/dts/hg556a-c.dts | 2 - target/linux/brcm63xx/dts/hg622.dts | 2 - target/linux/brcm63xx/dts/hg655b.dts | 2 - target/linux/brcm63xx/dts/homehub2a.dts | 2 - target/linux/brcm63xx/dts/livebox-blue-5g.dts | 4 +- target/linux/brcm63xx/dts/magic.dts | 2 - target/linux/brcm63xx/dts/nb4-fxc-r1.dts | 2 - target/linux/brcm63xx/dts/nb4-ser-r0.dts | 2 - target/linux/brcm63xx/dts/nb6-ser-r0.dts | 2 - target/linux/brcm63xx/dts/p870hw-51a-v2.dts | 2 - target/linux/brcm63xx/dts/r1000h.dts | 2 - target/linux/brcm63xx/dts/r5010unv2.dts | 12 +- target/linux/brcm63xx/dts/rg100a.dts | 2 - target/linux/brcm63xx/dts/rta1025w.dts | 2 - target/linux/brcm63xx/dts/rta1320.dts | 2 - target/linux/brcm63xx/dts/rta770bw.dts | 4 +- target/linux/brcm63xx/dts/rta770w.dts | 4 +- target/linux/brcm63xx/dts/spw303v.dts | 2 - target/linux/brcm63xx/dts/spw500v.dts | 2 - target/linux/brcm63xx/dts/sr102.dts | 118 + target/linux/brcm63xx/dts/td-w8900gb.dts | 2 - target/linux/brcm63xx/dts/usr9108.dts | 2 - target/linux/brcm63xx/dts/v2110.dts | 2 - target/linux/brcm63xx/dts/v2500v-bb.dts | 2 - target/linux/brcm63xx/dts/vg50.dts | 4 +- target/linux/brcm63xx/dts/vh4032n.dts | 2 - target/linux/brcm63xx/dts/vr-3025u.dts | 2 - target/linux/brcm63xx/dts/vr-3025un.dts | 2 - target/linux/brcm63xx/dts/vr-3026e.dts | 2 - target/linux/brcm63xx/dts/wap-5813n.dts | 2 - target/linux/brcm63xx/image/bcm63xx.mk | 14 +- ...tions-use-DT-info-for-parsing-partit.patch | 81 - ..._table-parsing-for-partition-parsers.patch | 79 - .../patches-4.14/598-board_sr102.patch | 68 + ...tions-use-DT-info-for-parsing-partit.patch | 81 - ..._table-parsing-for-partition-parsers.patch | 79 - .../patches-4.9/400-bcm963xx_flashmap.patch | 6 +- .../patches-4.9/598-board_sr102.patch | 68 + target/linux/brcm63xx/profiles/sky.mk | 16 + target/linux/cns3xxx/Makefile | 4 +- .../drivers/net/ethernet/cavium/cns3xxx_eth.c | 70 +- .../patches-4.14/020-watchdog_support.patch | 3 +- ...-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch | 2 +- target/linux/gemini/config-4.14 | 1 - target/linux/gemini/image/ImageInfo-sq201 | 18 + target/linux/gemini/image/Makefile | 34 +- ...-for-controlling-warnings-to-linux-c.patch | 140 + ...te-alias-warning-for-SYSCALL_DEFINEx.patch | 88 + ...port-for-host-mode-external-vbus-sup.patch | 109 + ...wc2_vbus_supply_init-fix-error-check.patch | 55 + ...ridge-add-support-for-port-isolation.patch | 145 + ...etfilter-flow-table-support-for-IPv6.patch | 2 +- ...les-add-single-table-list-for-all-fa.patch | 4 +- ...ipv6-make-ip6_dst_mtu_forward-inline.patch | 2 +- ...-for-controlling-warnings-to-linux-c.patch | 141 + ...te-alias-warning-for-SYSCALL_DEFINEx.patch | 88 + ...packed-not-aligned-warning-for-defau.patch | 45 + ...ove-tsq_flags-close-to-sk_wmem_alloc.patch | 2 +- ...90-net-generalize-napi_complete_done.patch | 2 +- target/linux/generic/config-3.18 | 4656 ++++++++++++++ target/linux/generic/config-4.14 | 7 +- target/linux/generic/config-4.9 | 4 +- .../generic/files/drivers/net/phy/ar8327.c | 42 +- .../generic/files/drivers/net/phy/ar8327.h | 21 - .../files/drivers/net/phy/rtl8366_smi.c | 176 +- .../files/drivers/net/phy/rtl8366_smi.h | 7 +- .../generic/files/drivers/net/phy/rtl8367b.c | 1 - .../generic/files/include/linux/rtl8366.h | 4 +- .../hack-4.14/259-regmap_dynamic.patch | 2 +- .../600-net-core-add-RPS-balancer.patch} | 13 +- .../640-bridge-only-accept-EAP-locally.patch | 7 +- .../hack-4.14/641-bridge_port_isolate.patch | 76 - .../hack-4.14/647-netfilter-flow-acct.patch | 70 + .../650-netfilter-add-xt_OFFLOAD-target.patch | 5 +- ...p-offload-hooks-on-netdev-unregister.patch | 4 +- .../hack-4.9/641-bridge_port_isolate.patch | 4 +- ...-linux-kernel-to-support-shortcut-fe.patch | 140 - ...ridge-APIs-needed-for-network-HW-acc.patch | 74 - ...k-events-support-multiple-registrant.patch | 345 -- .../pending-3.18/001-mtdsplit_backport.patch | 142 + .../002-phy_drivers_backport.patch | 552 ++ .../pending-3.18/003-myloader_backport.patch | 11 + .../generic/pending-3.18/020-ssb_update.patch | 134 + .../generic/pending-3.18/021-ssb_sprom.patch | 32 + .../pending-3.18/025-bcma_backport.patch | 286 + .../pending-3.18/026-bcma-from-3.20.patch | 527 ++ .../pending-3.18/027-bcma-from-4.1.patch | 680 ++ .../pending-3.18/028-bcma-from-4.2.patch | 86 + .../pending-3.18/029-bcma-from-4.4.patch | 26 + .../030-backport_bcm47xx_nvram.patch | 52 + ...11-Allow-set-network-namespace-by-fd.patch | 21 + .../pending-3.18/031-bcma-from-4.5.patch | 49 + .../pending-3.18/032-bcma-from-4.6.patch | 716 +++ ...-mtd-bcm47xxpart-backports-from-3.19.patch | 50 + ...-mtd-bcm47xxpart-backports-from-3.20.patch | 95 + ...GD25Q128B_support_backport_from_3.19.patch | 15 + .../044-backport-m25p80-jedec-probe.patch | 39 + .../050-backport_netfilter_rtcache.patch | 509 ++ ...ting-hash_max-multicast_router-if-in.patch | 99 + .../060-mips_decompressor_memmove.patch | 22 + ...gmac-register-napi-before-the-device.patch | 44 + ...rqs-only-if-there-is-nothing-to-poll.patch | 30 + .../073-bgmac-Clean-warning-messages.patch | 50 + ...ixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch | 76 + ...mac-allow-enabling-on-ARCH_BCM_5301X.patch | 28 + ...76-net-phy-export-fixed_phy_register.patch | 30 + ...scriptor-frame-start-end-definitions.patch | 24 + ...gmac-implement-GRO-and-use-build_skb.patch | 189 + ...mac-implement-scatter-gather-support.patch | 267 + ...gmac-simplify-tx-ring-index-handling.patch | 125 + ...rrupts-disabled-as-long-as-there-is-.patch | 87 + ...received-skb-headroom-to-NET_SKB_PAD.patch | 66 + ...bgmac-simplify-rx-DMA-error-handling.patch | 130 + ...gmac-add-check-for-oversized-packets.patch | 27 + ...ncrease-rx-ring-size-from-511-to-512.patch | 23 + ...7-10-bgmac-simplify-dma-init-cleanup.patch | 184 + .../077-11-bgmac-fix-DMA-rx-corruption.patch | 88 + .../077-12-bgmac-drop-ring-num_slots.patch | 132 + ...enable-Ethernet-core-before-using-it.patch | 31 + ...fix-MAC-soft-reset-bit-for-corerev-4.patch | 34 + ...c-net-fib_trie-when-CONFIG_IP_MULTIP.patch | 46 + ...e-balancing-issue-if-new-node-pushes.patch | 72 + ...usage-stats-to-be-percpu-instead-of-.patch | 200 + ...rie-Make-leaf-and-tnode-more-uniform.patch | 421 ++ ...node_free-and-leaf_free-into-node_fr.patch | 209 + ...80-05-fib_trie-Merge-leaf-into-tnode.patch | 928 +++ ...e-fib_table_lookup-to-avoid-wasting-.patch | 343 + ...0-07-fib_trie-Optimize-fib_find_node.patch | 64 + ...8-fib_trie-Optimize-fib_table_insert.patch | 276 + ...meaning-of-pos-to-represent-unchecke.patch | 346 ++ ...igned-long-for-anything-dealing-with.patch | 186 + ...Push-rcu_read_lock-unlock-to-callers.patch | 403 ++ ...e-Move-resize-to-after-inflate-halve.patch | 345 ++ ...ctions-should_inflate-and-should_hal.patch | 250 + ...signment-of-child-to-parent-down-int.patch | 336 + ...tnode-flushing-down-to-inflate-halve.patch | 237 + ...-halve-nodes-in-a-more-RCU-friendly-.patch | 345 ++ ...checks-for-index-tnode_child_length-.patch | 95 + ...Add-tracking-value-for-suffix-length.patch | 234 + ...ex-0ul-n-bits-instead-of-index-n-bit.patch | 52 + ...-bug-and-merge-similar-bits-of-infla.patch | 267 + ...ck-to-slen-update-on-inflate-halve-f.patch | 61 + ...llapse-and-should_collapse-to-resize.patch | 206 + ...ty_children-instead-of-counting-empt.patch | 34 + ...b_find_alias-to-file-where-it-is-use.patch | 79 + ...-Various-clean-ups-for-handling-slen.patch | 116 + ...eue-to-die-properly-when-a-PADT-is-r.patch | 89 + ...02-pppoe-Lacks-DST-MAC-address-check.patch | 25 + ...poe-device-in-pppoe_unbind_sock_work.patch | 28 + ..._state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch | 45 + ...ppp-remove-PPPOX_ZOMBIE-socket-state.patch | 51 + ...ry-corruption-in-padt-work-structure.patch | 82 + ...ment-fix-headroom-tests-and-skb-leak.patch | 101 + ...ncrease-headroom-on-received-packets.patch | 54 + .../087-regmap-make-LZO-cache-optional.patch | 67 + ...layfs-fallback-to-readonly-when-full.patch | 109 + ...i-nor-add-support-Spansion_S25FL164K.patch | 10 + ...-if-the-device-is-processing-a-messa.patch | 47 + ...rs-inside-calling-context-for-spi_sy.patch | 184 + ...e-message-pump-in-the-worker-kthread.patch | 83 + ...ility-of-linux-in.h-with-netinet-in..patch | 146 + ...ing_init-new-hook-for-archs-before-m.patch | 182 + .../pending-3.18/102-ehci_hcd_ignore_oc.patch | 82 + ...ame2-and-add-RENAME_WHITEOUT-support.patch | 86 + ...11-jffs2-add-RENAME_EXCHANGE-support.patch | 58 + ...ge_allow_receiption_on_disabled_port.patch | 54 + .../132-mips_inline_dma_ops.patch | 688 ++ ...-generic-parsing-of-linux-part-probe.patch | 175 + ...part-don-t-fail-because-of-bit-flips.patch | 92 + ...ci-make-USB_XHCI_PLATFORM-selectable.patch | 41 + ...t_for_moving_ndp_to_end_of_ncm_frame.patch | 228 + ...-support-for-Quectel-EC20-Mini-PCIe-.patch | 114 + ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 91 + .../pending-3.18/200-fix_localversion.patch | 11 + .../pending-3.18/201-extra_optimization.patch | 14 + .../pending-3.18/202-reduce_module_size.patch | 11 + .../203-kallsyms_uncompressed.patch | 108 + .../pending-3.18/204-module_strip.patch | 190 + .../205-backtrace_module_info.patch | 36 + .../210-darwin_scripts_include.patch | 3088 +++++++++ .../212-byteshift_portability.patch | 51 + .../213-x86_vdso_portability.patch | 13 + .../214-spidev_h_portability.patch | 11 + .../pending-3.18/220-gc_sections.patch | 531 ++ .../pending-3.18/221-module_exports.patch | 88 + .../230-openwrt_lzma_options.patch | 58 + .../pending-3.18/250-netfilter_depends.patch | 18 + .../pending-3.18/251-sound_kconfig.patch | 18 + .../pending-3.18/252-mv_cesa_depends.patch | 10 + .../pending-3.18/253-ssb_b43_default_on.patch | 29 + .../254-textsearch_kconfig_hacks.patch | 23 + .../255-lib80211_kconfig_hacks.patch | 31 + .../256-crypto_add_kconfig_prompts.patch | 47 + .../257-wireless_ext_kconfig_hack.patch | 22 + .../258-netfilter_netlink_kconfig_hack.patch | 11 + .../pending-3.18/259-regmap_dynamic.patch | 87 + .../260-crypto_test_dependencies.patch | 37 + ...t-add-fallback-for-unsupported-libcs.patch | 102 + ...prevent-redefinition-of-struct-ethhd.patch | 55 + .../300-mips_expose_boot_raw.patch | 39 + .../301-mips_image_cmdline_hack.patch | 28 + .../302-mips_no_branch_likely.patch | 11 + .../pending-3.18/304-mips_disable_fpu.patch | 105 + .../pending-3.18/305-mips_module_reloc.patch | 356 ++ .../306-mips_mem_functions_performance.patch | 83 + .../307-mips_highmem_offset.patch | 17 + .../310-arm_module_unresolved_weak_sym.patch | 13 + .../320-ppc4xx_optimization.patch | 31 + .../321-powerpc_crtsavres_prereq.patch | 10 + ...t-command-line-parameters-from-users.patch | 298 + .../400-mtd-add-rootfs-split-support.patch | 171 + ...for-different-partition-parser-types.patch | 113 + ...arsers-for-rootfs-and-firmware-split.patch | 72 + .../403-mtd-hook-mtdsplit-to-Kbuild.patch | 22 + .../404-mtd-add-more-helper-functions.patch | 101 + ...405-mtd-old-firmware-uimage-splitter.patch | 70 + ...406-mtd-old-rootfs-squashfs-splitter.patch | 76 + ...rward-declaration-of-struct-mtd_info.patch | 18 + .../411-mtd-partial_eraseblock_write.patch | 142 + .../412-mtd-partial_eraseblock_unlock.patch | 18 + .../pending-3.18/420-mtd-redboot_space.patch | 30 + ...30-mtd-add-myloader-partition-parser.patch | 35 + ...check-for-bad-blocks-when-calculatin.patch | 100 + ...bcm47xxpart-detect-T_Meter-partition.patch | 42 + .../pending-3.18/440-block2mtd_init.patch | 107 + .../pending-3.18/441-block2mtd_probe.patch | 110 + ...-to-use-platform-specific-chip-fixup.patch | 37 + ...n-code-of-nand_correct_data-function.patch | 11 + ...mtd-cfi_cmdset_0002-no-erase_suspend.patch | 11 + ...et_0002-add-buffer-write-cmd-timeout.patch | 18 + ...add-support-for-Winbond-W25X05-flash.patch | 20 + ...support-for-the-Macronix-MX25L512E-S.patch | 21 + ...support-for-the-ISSI-SI25CD512-SPI-f.patch | 22 + ...mtd-spi-nor-add-macronix-mx25u25635f.patch | 10 + .../476-mtd-spi-nor-add-eon-en25qh32.patch | 10 + .../480-mtd-set-rootfs-to-be-root-dev.patch | 26 + ...mtd-device-named-ubi-or-data-on-boot.patch | 76 + ...to-create-ubiblock-device-for-rootfs.patch | 69 + ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 54 + ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 37 + .../494-mtd-ubi-add-EOF-marker-support.patch | 51 + .../530-jffs2_make_lzma_available.patch | 5142 +++++++++++++++ .../pending-3.18/531-debloat_lzma.patch | 1024 +++ .../pending-3.18/532-jffs2_eofdetect.patch | 56 + .../550-ubifs-symlink-xattr-support.patch | 55 + ...fs-fix-default-compression-selection.patch | 29 + .../600-netfilter_conntrack_flush.patch | 86 + ...etfilter_match_bypass_default_checks.patch | 101 + ...netfilter_match_bypass_default_table.patch | 94 + ...netfilter_match_reduce_memory_access.patch | 16 + ...-netfilter_optional_tcp_window_check.patch | 36 + .../616-net_optimize_xfrm_calls.patch | 12 + .../pending-3.18/621-sched_act_connmark.patch | 161 + .../pending-3.18/630-packet_socket_type.patch | 134 + .../640-bridge_no_eap_forward.patch | 23 + .../641-bridge_always_accept_eap.patch | 17 + .../642-bridge_port_isolate.patch | 92 + .../645-bridge_multicast_to_unicast.patch | 390 ++ .../pending-3.18/650-pppoe_header_pad.patch | 0 .../651-wireless_mesh_header.patch | 11 + .../653-disable_netlink_trim.patch | 26 + .../pending-3.18/655-increase_skb_pad.patch | 11 + .../656-skb_reduce_truesize-helper.patch | 41 + .../657-qdisc_reduce_truesize.patch | 63 + .../pending-3.18/660-fq_codel_defaults.patch | 13 + .../661-fq_codel_keep_dropped_stats.patch | 10 + .../662-use_fq_codel_by_default.patch | 95 + .../pending-3.18/663-remove_pfifo_fast.patch | 143 + ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 481 ++ ...urce-specific-default-route-handling.patch | 96 + ...ng-with-source-address-failed-policy.patch | 249 + ...nes-for-_POLICY_FAILED-until-all-cod.patch | 53 + ...T-skip-GRO-for-foreign-MAC-addresses.patch | 160 + .../681-NET-add-of_get_mac_address_mtd.patch | 88 + .../generic/pending-3.18/700-swconfig.patch | 39 + .../pending-3.18/701-phy_extension.patch | 63 + .../702-phy_add_aneg_done_function.patch | 27 + ...detach-callback-to-struct-phy_driver.patch | 27 + ...710-phy-add-mdio_register_board_info.patch | 192 + .../pending-3.18/720-phy_adm6996.patch | 26 + .../pending-3.18/721-phy_packets.patch | 161 + .../pending-3.18/722-phy_mvswitch.patch | 23 + .../generic/pending-3.18/723-phy_ip175c.patch | 23 + .../generic/pending-3.18/724-phy_ar8216.patch | 24 + .../pending-3.18/725-phy_rtl8306.patch | 23 + .../pending-3.18/726-phy_rtl8366.patch | 45 + .../pending-3.18/727-phy-rtl8367.patch | 23 + .../pending-3.18/728-phy-rtl8367b.patch | 23 + .../generic/pending-3.18/729-phy-tantos.patch | 21 + .../generic/pending-3.18/730-phy_b53.patch | 21 + .../732-phy-ar8216-led-support.patch | 13 + .../pending-3.18/733-phy_mvsw61xx.patch | 23 + ...-at803x-allow-to-configure-via-pdata.patch | 180 + ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 96 + .../760-8139cp-fixes-from-4.3.patch | 365 ++ .../773-bgmac-add-srab-switch.patch | 72 + .../785-hso-support-0af0-9300.patch | 25 + .../810-pci_disable_common_quirks.patch | 51 + .../811-pci_disable_usb_common_quirks.patch | 101 + .../pending-3.18/821-usb-dwc2-dualrole.patch | 146 + .../pending-3.18/831-ledtrig_netdev.patch | 21 + .../pending-3.18/834-ledtrig-libata.patch | 153 + .../generic/pending-3.18/840-rtc7301.patch | 250 + .../pending-3.18/841-rtc_pt7c4338.patch | 247 + .../861-04_spi_gpio_implement_spi_delay.patch | 58 + .../pending-3.18/862-gpio_spi_driver.patch | 373 ++ .../pending-3.18/870-hifn795x_byteswap.patch | 17 + .../890-8250_optional_sysrq.patch | 24 + .../pending-3.18/901-debloat_sock_diag.patch | 65 + .../pending-3.18/902-debloat_proc.patch | 341 + .../pending-3.18/904-debloat_dma_buf.patch | 44 + .../pending-3.18/910-kobject_uevent.patch | 21 + .../911-kobject_add_broadcast_uevent.patch | 65 + .../921-use_preinit_as_init.patch | 12 + ...ays-create-console-node-in-initramfs.patch | 30 + .../generic/pending-3.18/930-crashlog.patch | 276 + ...e-filenames-from-deps_initramfs-list.patch | 29 + .../980-arm_openwrt_machtypes.patch | 32 + .../generic/pending-3.18/990-gpio_wdt.patch | 360 ++ .../pending-3.18/995-mangle_bootargs.patch | 58 + .../997-device_tree_cmdline.patch | 24 + ...able_wilink_platform_without_drivers.patch | 15 + .../pending-3.18/999-seccomp_log.patch | 34 + ...ge_allow_receiption_on_disabled_port.patch | 4 +- ...nefficient-copy-of-unaligned-buffers.patch | 50 + ...et-phy-at803x-add-support-for-AT8032.patch | 17 +- ...t-add-of_match_table-with-DT-binding.patch | 31 + .../479-mtd-spi-nor-add-eon-en25qh32.patch | 10 + ...mtd-device-named-ubi-or-data-on-boot.patch | 72 +- .../pending-4.14/630-packet_socket_type.patch | 6 +- .../681-NET-add-of_get_mac_address_mtd.patch | 12 +- ...-at803x-allow-to-configure-via-pdata.patch | 10 +- ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 2 +- ...phy-at803x-allow-to-configure-via-dt.patch | 47 + ...y-serial-exar-generalize-rs485-setup.patch | 76 + ...t-add-of_match_table-with-DT-binding.patch | 39 + .../pending-4.9/420-mtd-redboot_space.patch | 2 +- .../479-mtd-spi-nor-add-eon-en25qh32.patch | 10 + ...mtd-device-named-ubi-or-data-on-boot.patch | 72 +- .../pending-4.9/630-packet_socket_type.patch | 6 +- target/linux/imx6/Makefile | 4 +- .../imx6/base-files/etc/board.d/02_network | 1 + target/linux/imx6/base-files/lib/imx6.sh | 5 + target/linux/imx6/config-4.14 | 7 + target/linux/imx6/image/Makefile | 57 +- target/linux/imx6/image/bootscript-cubox | 31 + .../{100-generic.mk => 100-default.mk} | 8 +- .../ipq806x/base-files/etc/board.d/01_leds | 2 - target/linux/ipq806x/base-files/etc/diag.sh | 6 +- .../base-files/lib/upgrade/platform.sh | 6 - .../arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 2 - .../arch/arm/boot/dts/qcom-ipq8064-c2600.dts | 2 - .../arch/arm/boot/dts/qcom-ipq8064-d7800.dts | 2 - .../arch/arm/boot/dts/qcom-ipq8064-db149.dts | 4 - .../arch/arm/boot/dts/qcom-ipq8064-ea8500.dts | 3 - .../arch/arm/boot/dts/qcom-ipq8064-r7500.dts | 2 - .../arm/boot/dts/qcom-ipq8064-r7500v2.dts | 2 - .../arm/boot/dts/qcom-ipq8064-vr2600v.dts | 2 - .../arm/boot/dts/qcom-ipq8064-wg2600hp.dts | 2 - .../arch/arm/boot/dts/qcom-ipq8064-wpq864.dts | 6 +- .../arm/boot/dts/qcom-ipq8065-nbg6817.dts | 2 - .../arch/arm/boot/dts/qcom-ipq8065-r7800.dts | 2 - target/linux/ipq806x/image/Makefile | 6 +- .../0066-GPIO-add-named-gpio-exports.patch | 166 - ...ipq806x-usb-Control-USB-master-reset.patch | 2 +- .../105-mtd-nor-add-mx25l25635f.patch | 2 +- .../116-sidewinder_fis_location.patch | 8 +- .../kirkwood/base-files/etc/board.d/01_leds | 3 + .../base-files/etc/board.d/02_network | 1 + target/linux/kirkwood/base-files/etc/diag.sh | 3 + .../{nsa310_fancontrol => hwmon_fancontrol} | 13 +- target/linux/kirkwood/image/Makefile | 16 + .../patches-4.14/103-iomega-ix2-200.patch | 33 + .../patches-4.9/103-iomega-ix2-200.patch | 33 + target/linux/lantiq/Makefile | 2 +- target/linux/lantiq/ase/config-4.9 | 24 - .../lantiq/base-files/etc/board.d/01_leds | 4 + .../lantiq/base-files/etc/board.d/02_network | 10 +- target/linux/lantiq/base-files/etc/diag.sh | 9 + .../etc/hotplug.d/firmware/12-ath9k-eeprom | 24 +- .../lantiq/base-files/lib/upgrade/platform.sh | 8 +- target/linux/lantiq/config-4.14 | 2 - target/linux/lantiq/config-4.9 | 199 - target/linux/lantiq/falcon/config-4.9 | 10 - .../files-4.14/arch/mips/boot/dts/ACMP252.dts | 2 +- .../arch/mips/boot/dts/ALL0333CJ.dts | 2 +- .../arch/mips/boot/dts/ARV4510PW.dts | 1 + .../arch/mips/boot/dts/ARV4518PWR01.dtsi | 3 +- .../arch/mips/boot/dts/ARV4519PW.dts | 5 +- .../arch/mips/boot/dts/ARV4520PW.dts | 3 +- .../arch/mips/boot/dts/ARV452CQW.dts | 3 +- .../arch/mips/boot/dts/ARV7506PW11.dts | 1 + .../arch/mips/boot/dts/ARV7510PW22.dts | 3 +- .../arch/mips/boot/dts/ARV7518PW.dts | 3 +- .../arch/mips/boot/dts/ARV7519PW.dts | 1 + .../arch/mips/boot/dts/ARV7519RW22.dts | 5 +- .../arch/mips/boot/dts/ARV7525PW.dts | 1 + .../arch/mips/boot/dts/ARV752DPW.dts | 3 +- .../arch/mips/boot/dts/ARV752DPW22.dts | 3 +- .../arch/mips/boot/dts/ARV8539PW22.dts | 3 +- .../arch/mips/boot/dts/ASL56026.dts | 3 +- .../arch/mips/boot/dts/BTHOMEHUBV2B.dts | 1 + .../arch/mips/boot/dts/BTHOMEHUBV3A.dts | 3 +- .../arch/mips/boot/dts/BTHOMEHUBV5A.dts | 3 +- .../arch/mips/boot/dts/DGN1000B.dts | 1 + .../arch/mips/boot/dts/DGN3500.dtsi | 1 + .../files-4.14/arch/mips/boot/dts/DM200.dts | 1 + .../arch/mips/boot/dts/EASY80920.dtsi | 3 +- .../arch/mips/boot/dts/EASY88388.dts | 3 +- .../arch/mips/boot/dts/EASY88444.dts | 3 +- .../arch/mips/boot/dts/EASY98021.dts | 12 +- .../mips/boot/dts/FRITZ3370-REV2-HYNIX.dts | 38 + .../mips/boot/dts/FRITZ3370-REV2-MICRON.dts | 36 + .../{FRITZ3370.dts => FRITZ3370-REV2.dtsi} | 130 +- .../arch/mips/boot/dts/FRITZ7312.dts | 182 + .../arch/mips/boot/dts/FRITZ7320.dts | 1 + .../arch/mips/boot/dts/FRITZ7360SL.dts | 1 + .../arch/mips/boot/dts/GIGASX76X.dts | 2 +- .../files-4.14/arch/mips/boot/dts/H201L.dts | 3 +- .../arch/mips/boot/dts/P2601HNFX.dts | 3 +- .../arch/mips/boot/dts/P2812HNUFX.dtsi | 5 +- .../arch/mips/boot/dts/TDW89X0.dtsi | 4 +- .../files-4.14/arch/mips/boot/dts/VG3503J.dts | 1 + .../arch/mips/boot/dts/VGV7510KW22.dtsi | 3 +- .../arch/mips/boot/dts/VGV7519.dtsi | 5 +- .../files-4.14/arch/mips/boot/dts/VR200v.dts | 4 +- .../files-4.14/arch/mips/boot/dts/WBMR.dts | 3 +- .../files-4.14/arch/mips/boot/dts/WBMR300.dts | 5 +- .../files-4.9/arch/mips/boot/dts/ACMP252.dts | 102 - .../arch/mips/boot/dts/ALL0333CJ.dts | 120 - .../arch/mips/boot/dts/ARV4510PW.dts | 232 - .../arch/mips/boot/dts/ARV4518PWR01.dts | 8 - .../arch/mips/boot/dts/ARV4518PWR01.dtsi | 198 - .../arch/mips/boot/dts/ARV4518PWR01A.dts | 14 - .../arch/mips/boot/dts/ARV4519PW.dts | 195 - .../arch/mips/boot/dts/ARV4520PW.dts | 221 - .../arch/mips/boot/dts/ARV4525PW.dts | 169 - .../arch/mips/boot/dts/ARV452CQW.dts | 237 - .../arch/mips/boot/dts/ARV7506PW11.dts | 165 - .../arch/mips/boot/dts/ARV7510PW22.dts | 196 - .../arch/mips/boot/dts/ARV7518PW.dts | 232 - .../arch/mips/boot/dts/ARV7519PW.dts | 229 - .../arch/mips/boot/dts/ARV7519RW22.dts | 231 - .../arch/mips/boot/dts/ARV7525PW.dts | 155 - .../arch/mips/boot/dts/ARV752DPW.dts | 238 - .../arch/mips/boot/dts/ARV752DPW22.dts | 259 - .../arch/mips/boot/dts/ARV8539PW22.dts | 180 - .../files-4.9/arch/mips/boot/dts/ASL56026.dts | 171 - .../arch/mips/boot/dts/BTHOMEHUBV2B.dts | 262 - .../arch/mips/boot/dts/BTHOMEHUBV3A.dts | 208 - .../arch/mips/boot/dts/BTHOMEHUBV5A.dts | 282 - .../files-4.9/arch/mips/boot/dts/DGN1000B.dts | 171 - .../files-4.9/arch/mips/boot/dts/DGN3500.dts | 8 - .../files-4.9/arch/mips/boot/dts/DGN3500.dtsi | 213 - .../files-4.9/arch/mips/boot/dts/DGN3500B.dts | 8 - .../files-4.9/arch/mips/boot/dts/DM200.dts | 215 - .../arch/mips/boot/dts/EASY50712.dts | 83 - .../arch/mips/boot/dts/EASY50810.dts | 93 - .../arch/mips/boot/dts/EASY80920.dtsi | 298 - .../arch/mips/boot/dts/EASY80920NAND.dts | 68 - .../arch/mips/boot/dts/EASY80920NOR.dts | 43 - .../arch/mips/boot/dts/EASY88388.dts | 106 - .../arch/mips/boot/dts/EASY88444.dts | 80 - .../arch/mips/boot/dts/EASY98000-base.dtsi | 110 - .../arch/mips/boot/dts/EASY98000NAND.dts | 40 - .../arch/mips/boot/dts/EASY98000NOR.dts | 38 - .../arch/mips/boot/dts/EASY98000SFLASH.dts | 16 - .../arch/mips/boot/dts/EASY98020.dts | 95 - .../arch/mips/boot/dts/EASY98020V18.dts | 68 - .../arch/mips/boot/dts/EASY98021.dts | 81 - .../arch/mips/boot/dts/EASY98035SYNCE.dts | 76 - .../arch/mips/boot/dts/EASY98035SYNCE1588.dts | 76 - .../arch/mips/boot/dts/FALCON-MDU.dts | 53 - .../arch/mips/boot/dts/FALCON-SFP.dts | 76 - .../arch/mips/boot/dts/FRITZ3370.dts | 288 - .../arch/mips/boot/dts/FRITZ7320.dts | 161 - .../arch/mips/boot/dts/FRITZ7360SL.dts | 228 - .../arch/mips/boot/dts/GIGASX76X.dts | 122 - .../files-4.9/arch/mips/boot/dts/H201L.dts | 159 - .../arch/mips/boot/dts/P2601HNFX.dts | 190 - .../arch/mips/boot/dts/P2812HNUF1.dts | 72 - .../arch/mips/boot/dts/P2812HNUF3.dts | 66 - .../arch/mips/boot/dts/P2812HNUFX.dtsi | 280 - .../files-4.9/arch/mips/boot/dts/TDW8970.dts | 8 - .../files-4.9/arch/mips/boot/dts/TDW8980.dts | 35 - .../files-4.9/arch/mips/boot/dts/TDW89X0.dtsi | 274 - .../files-4.9/arch/mips/boot/dts/VG3503J.dts | 163 - .../arch/mips/boot/dts/VGV7510KW22.dtsi | 253 - .../arch/mips/boot/dts/VGV7510KW22BRN.dts | 67 - .../arch/mips/boot/dts/VGV7510KW22NOR.dts | 33 - .../files-4.9/arch/mips/boot/dts/VGV7519.dtsi | 298 - .../arch/mips/boot/dts/VGV7519BRN.dts | 73 - .../arch/mips/boot/dts/VGV7519NOR.dts | 32 - .../files-4.9/arch/mips/boot/dts/VR200v.dts | 283 - .../files-4.9/arch/mips/boot/dts/WBMR.dts | 185 - .../files-4.9/arch/mips/boot/dts/WBMR300.dts | 306 - .../arch/mips/boot/dts/amazonse.dtsi | 174 - .../files-4.9/arch/mips/boot/dts/ar9.dtsi | 216 - .../files-4.9/arch/mips/boot/dts/danube.dtsi | 212 - .../arch/mips/boot/dts/falcon-sflash-16M.dtsi | 37 - .../files-4.9/arch/mips/boot/dts/falcon.dtsi | 392 -- .../files-4.9/arch/mips/boot/dts/vr9.dtsi | 260 - target/linux/lantiq/image/Makefile | 39 +- .../0001-MIPS-lantiq-add-pcie-driver.patch | 2 +- .../0004-MIPS-lantiq-add-atm-hack.patch | 19 - .../0030-GPIO-add-named-gpio-exports.patch | 13 +- .../0701-NET-lantiq-etop-of-mido.patch | 37 + .../0001-MIPS-lantiq-add-pcie-driver.patch | 5520 ----------------- ...gpio-stp-xway-Implement-get-callback.patch | 47 - .../0004-MIPS-lantiq-add-atm-hack.patch | 500 -- ...-MIPS-lantiq-backport-old-timer-code.patch | 1034 --- .../0018-MTD-nand-lots-of-xrx200-fixes.patch | 122 - ...antiq-handle-NO_XIP-on-cfi0001-flash.patch | 25 - ...25p80-allow-loading-mtd-name-from-OF.patch | 44 - ...ET-PHY-adds-driver-for-lantiq-PHY11G.patch | 294 - ...ET-lantiq-adds-PHY11G-firmware-blobs.patch | 364 -- ...0025-NET-MIPS-lantiq-adds-xrx200-net.patch | 3394 ---------- .../0026-NET-multi-phy-support.patch | 53 - ...hy-intel-xway-add-VR9-version-number.patch | 62 - ...-phy-intel-xway-add-VR9-v1.1-phy-ids.patch | 71 - .../0028-NET-lantiq-various-etop-fixes.patch | 880 --- .../0030-GPIO-add-named-gpio-exports.patch | 170 - ...PS-lantiq-add-FALC-ON-i2c-bus-master.patch | 1034 --- ...iq-wifi-and-ethernet-eeprom-handling.patch | 219 - .../0040-USB-DWC2-enable-usb-power-gpio.patch | 35 - ...42-arch-mips-increase-io_space_limit.patch | 23 - ...-fix-copy-paste-error-in-xrx200_grps.patch | 11 - .../lantiq/patches-4.9/0047-poweroff.patch | 23 - ...0-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch | 87 - ...e-lantiq-settings-match-vendor-drive.patch | 130 - ...PS-lantiq-improve-USB-initialization.patch | 202 - ...dd-support-for-Lantiq-SSC-SPI-contro.patch | 1078 ---- ...ix-platform_no_drv_owner.cocci-warni.patch | 28 - ...antiq-ssc-add-LTQ_-prefix-to-defines.patch | 723 --- .../patches-4.9/0101-find_active_root.patch | 93 - .../0151-lantiq-ifxmips_pcie-use-of.patch | 166 - .../lantiq/patches-4.9/0152-lantiq-VPE.patch | 180 - .../0154-lantiq-pci-bar11mask-fix.patch | 22 - .../patches-4.9/0155-lantiq-VPE-nosmp.patch | 14 - .../0160-owrt-lantiq-multiple-flash.patch | 221 - ...q-lock-DMA-register-accesses-for-SMP.patch | 152 - ...-cmdset-0001-disable-buffered-writes.patch | 11 - ...add-gphy-clk-src-device-tree-binding.patch | 30 - .../0302-xrx200-add-sensors-driver.patch | 184 - target/linux/lantiq/xrx200/config-4.9 | 90 - target/linux/lantiq/xrx200/target.mk | 1 + target/linux/lantiq/xway/config-4.14 | 1 + target/linux/lantiq/xway/config-4.9 | 48 - target/linux/lantiq/xway_legacy/config-4.9 | 37 - target/linux/layerscape/Makefile | 1 - target/linux/layerscape/armv8_32b/config-4.9 | 4 - target/linux/layerscape/armv8_64b/config-4.9 | 5 +- .../layerscape/base-files/etc/board.d/01_led | 25 + .../base-files/etc/board.d/02_network | 21 + .../base-files/etc/board.d/03_gpio_switches | 28 + .../lib/preinit/05_layerscape_reorder_eth | 28 + .../base-files/lib/upgrade/platform.sh | 94 + .../boot/dts/freescale/traverse-ls1043s.dts | 332 + .../boot/dts/freescale/traverse-ls1043v.dts | 253 + target/linux/layerscape/image/Makefile | 37 + .../layerscape/image/mkits-multiple-config.sh | 596 ++ ...4-dts-layerscape-add-traverse-ls1043.patch | 89 + .../401-mtd-spi-nor-support-layerscape.patch | 24 +- .../702-pci-support-layerscape.patch | 2 +- .../808-guts-support-layerscape.patch | 2 +- .../817-usb-support-layerscape.patch | 2 +- .../patches-4.9/820-rgmii-fixed-link.patch | 62 + .../821-add-esdhc-vsel-to-ls1043.patch | 10 + target/linux/mcs814x/Makefile | 31 + .../mcs814x/base-files/etc/board.d/01_leds | 27 + .../mcs814x/base-files/etc/board.d/02_network | 12 + .../linux/mcs814x/base-files/lib/mcs814x.sh | 33 + .../lib/preinit/01_preinit_do_mcs814x.sh | 9 + target/linux/mcs814x/config-3.18 | 235 + .../arch/arm/boot/dts/dlan-usb-extender.dts | 68 + .../files-3.18/arch/arm/boot/dts/mcs8140.dtsi | 189 + .../files-3.18/arch/arm/boot/dts/rbt-832.dts | 89 + .../files-3.18/arch/arm/mach-mcs814x/Kconfig | 29 + .../files-3.18/arch/arm/mach-mcs814x/Makefile | 5 + .../arch/arm/mach-mcs814x/Makefile.boot | 4 + .../arch/arm/mach-mcs814x/board-mcs8140-dt.c | 45 + .../files-3.18/arch/arm/mach-mcs814x/clock.c | 271 + .../files-3.18/arch/arm/mach-mcs814x/common.c | 166 + .../files-3.18/arch/arm/mach-mcs814x/common.h | 16 + .../arch/arm/mach-mcs814x/include/mach/cpu.h | 16 + .../mach-mcs814x/include/mach/debug-macro.S | 11 + .../mach-mcs814x/include/mach/entry-macro.S | 6 + .../arch/arm/mach-mcs814x/include/mach/gpio.h | 21 + .../arm/mach-mcs814x/include/mach/hardware.h | 16 + .../arch/arm/mach-mcs814x/include/mach/io.h | 27 + .../arch/arm/mach-mcs814x/include/mach/irqs.h | 17 + .../arm/mach-mcs814x/include/mach/mcs814x.h | 53 + .../arm/mach-mcs814x/include/mach/param.h | 15 + .../arm/mach-mcs814x/include/mach/system.h | 18 + .../arm/mach-mcs814x/include/mach/timex.h | 18 + .../mach-mcs814x/include/mach/uncompress.h | 40 + .../files-3.18/arch/arm/mach-mcs814x/irq.c | 94 + .../files-3.18/arch/arm/mach-mcs814x/timer.c | 132 + .../drivers/char/hw_random/mcs814x-rng.c | 121 + .../files-3.18/drivers/gpio/gpio-mcs814x.c | 148 + .../drivers/net/ethernet/mcs8140/Kconfig | 4 + .../drivers/net/ethernet/mcs8140/Makefile | 3 + .../drivers/net/ethernet/mcs8140/nuport_mac.c | 1206 ++++ .../files-3.18/drivers/net/phy/mcs814x.c | 64 + .../drivers/usb/host/ehci-mcs814x.c | 163 + .../drivers/usb/host/ohci-mcs814x.c | 202 + .../files-3.18/drivers/watchdog/mcs814x_wdt.c | 207 + target/linux/mcs814x/image/Makefile | 60 + target/linux/mcs814x/modules.mk | 20 + .../mcs814x/patches-3.18/001-platform.patch | 64 + .../mcs814x/patches-3.18/003-ethernet.patch | 16 + .../linux/mcs814x/patches-3.18/004-usb.patch | 28 + .../patches-3.18/005-mcs814x_rng.patch | 31 + .../patches-3.18/006-mcs814x_wdt.patch | 25 + .../patches-3.18/008-mcs814x_gpio.patch | 25 + .../011-mcs814x_internal_phy.patch | 20 + ...mtd-cfi_cmdset_0002-force-word-write.patch | 14 + .../patches-3.18/013-ohci_workarounds.patch | 64 + .../mcs814x/patches-3.18/014-debuguart.patch | 41 + target/linux/mcs814x/profiles/000-Generic.mk | 16 + .../mcs814x/profiles/100-dLAN-USB-Extender.mk | 25 + .../base-files/etc/board.d/02_network | 19 +- .../base-files/lib/preinit/07_set_iface_mac | 47 + .../base-files/lib/preinit/79_move_config | 19 + .../base-files/lib/upgrade/platform.sh | 47 +- target/linux/mediatek/image/Makefile | 10 + .../mediatek/image/gen_mt7623_emmc_img.sh | 18 + target/linux/mediatek/image/mt7623.mk | 11 + target/linux/mediatek/mt7622/config-4.14 | 3 - target/linux/mediatek/mt7623/config-4.14 | 12 +- ...rm-dts-Add-missing-mt7623-pcie-nodes.patch | 123 + ...-phy-phy-mtk-tphy-Add-hifsys-support.patch | 66 + .../0227-arm-dts-Add-Unielec-U7623-DTS.patch | 413 ++ .../etc/hotplug.d/ieee80211/05-wifi-migrate | 63 + .../mvebu/base-files/etc/board.d/02_network | 9 + target/linux/mvebu/base-files/lib/mvebu.sh | 9 + target/linux/mvebu/config-4.14 | 1 + .../arm/boot/dts/armada-385-linksys-venom.dts | 18 +- .../mvebu/image/armada-3720-db.bootscript | 10 + target/linux/mvebu/image/cortex-a53.mk | 13 + target/linux/mvebu/image/cortex-a72.mk | 26 + ...a-3720-espressobin-wire-up-spi-flash.patch | 45 + ...sporessobin-dt-enable-spi-nor-on-i2c.patch | 29 - target/linux/octeon/Makefile | 2 +- target/linux/omap/Makefile | 4 +- .../base-files/lib/preinit/79_move_config | 20 + .../omap/base-files/lib/upgrade/platform.sh | 89 + target/linux/omap/config-4.14 | 7 + target/linux/omap/config-4.9 | 7 + target/linux/omap/image/Makefile | 18 +- target/linux/omap24xx/Makefile | 26 + .../omap24xx/base-files/etc/config/fstab | 13 + .../omap24xx/base-files/etc/config/network | 15 + .../omap24xx/base-files/etc/config/wireless | 20 + .../etc/hotplug.d/firmware/10-bme-pmm-image | 17 + .../etc/hotplug.d/firmware/20-p54spi-eeprom | 32 + .../omap24xx/base-files/etc/init.d/watchdog | 17 + target/linux/omap24xx/base-files/etc/inittab | 5 + .../linux/omap24xx/base-files/etc/pointercal | 1 + .../base-files/lib/firmware/bc4fw.bin | Bin 0 -> 2034 bytes target/linux/omap24xx/config-4.1 | 290 + target/linux/omap24xx/image/Makefile | 27 + target/linux/omap24xx/modules.mk | 83 + target/linux/omap24xx/profiles/100-n810.mk | 31 + .../linux/omap24xx/profiles/110-n810-gui.mk | 22 + target/linux/oxnas/config-4.14 | 1 - .../arm/boot/dts/ox820-mitrastar-stg212.dts | 1 - .../base-files/lib/upgrade/platform.sh | 5 - ...or-support-mtd-name-from-device-tree.patch | 4 +- target/linux/ppc40x/Makefile | 26 + .../ppc40x/base-files/lib/preinit/01_sysinfo | 12 + .../ppc40x/base-files/lib/upgrade/platform.sh | 35 + target/linux/ppc40x/config-3.18 | 235 + target/linux/ppc40x/image/Makefile | 72 + target/linux/ppc40x/modules.mk | 41 + .../003-powerpc-add-EBC_BXCR-defines.patch | 27 + .../ppc40x/patches-3.18/004-magicbox.patch | 446 ++ .../ppc40x/patches-3.18/005-openrb.patch | 447 ++ .../101-pata-magicbox-cf-driver.patch | 433 ++ .../110-kilauea_openwrt_flashmap.patch | 55 + .../120-usb-isp116x-hcd-add-of-binding.patch | 290 + ...b-isp116x-hcd-ppc405-register-access.patch | 110 + target/linux/ppc44x/Makefile | 26 + target/linux/ppc44x/base-files/etc/inittab | 4 + target/linux/ppc44x/config-3.18 | 250 + target/linux/ppc44x/image/Makefile | 46 + ...move-incorrect-__init-__exit-markups.patch | 46 + .../patches-3.18/100-openwrt_flashmap.patch | 55 + .../110-openwrt_dts_cmdline.patch | 9 + .../900-bootwrapper-parallel-make-fix.patch | 45 + .../ramips/base-files/etc/board.d/01_leds | 122 +- .../ramips/base-files/etc/board.d/02_network | 35 +- target/linux/ramips/base-files/etc/diag.sh | 345 +- .../etc/hotplug.d/firmware/10-rt2x00-eeprom | 1 + .../ramips/base-files/lib/upgrade/platform.sh | 22 +- target/linux/ramips/dts/11ACNAS.dts | 5 - target/linux/ramips/dts/3G-6200N.dts | 62 +- target/linux/ramips/dts/3G-6200NL.dts | 62 +- target/linux/ramips/dts/3G150B.dts | 54 +- target/linux/ramips/dts/3G300M.dts | 52 +- target/linux/ramips/dts/A5-V11.dts | 52 +- target/linux/ramips/dts/AC1200RM.dts | 79 +- target/linux/ramips/dts/AI-BR100.dts | 52 +- target/linux/ramips/dts/AIR3GII.dts | 46 +- target/linux/ramips/dts/ALL0239-3G.dts | 52 +- target/linux/ramips/dts/ALL0256N-4M.dts | 44 +- target/linux/ramips/dts/ALL0256N-8M.dts | 44 +- target/linux/ramips/dts/ALL0256N.dtsi | 2 - target/linux/ramips/dts/ALL5002.dts | 44 +- target/linux/ramips/dts/ALL5003.dts | 46 +- target/linux/ramips/dts/AP-MT7621A-V60.dts | 46 +- target/linux/ramips/dts/AR670W.dts | 42 +- target/linux/ramips/dts/AR725W.dts | 50 +- target/linux/ramips/dts/ASL26555-16M.dts | 74 +- target/linux/ramips/dts/ASL26555-8M.dts | 64 +- target/linux/ramips/dts/ASL26555.dtsi | 8 +- target/linux/ramips/dts/ATP-52B.dts | 48 +- target/linux/ramips/dts/AWAPN2403.dts | 53 +- target/linux/ramips/dts/AWM002-EVB-4M.dts | 44 +- target/linux/ramips/dts/AWM002-EVB-8M.dts | 44 +- target/linux/ramips/dts/AWM002-EVB.dtsi | 2 - target/linux/ramips/dts/AWUSFREE1.dts | 60 +- target/linux/ramips/dts/ArcherC2-v1.dts | 185 + target/linux/ramips/dts/ArcherC20i.dts | 70 +- target/linux/ramips/dts/ArcherC20v1.dts | 89 +- target/linux/ramips/dts/ArcherC20v4.dts | 27 +- target/linux/ramips/dts/ArcherC50.dts | 89 +- target/linux/ramips/dts/ArcherC50V3.dts | 25 +- target/linux/ramips/dts/ArcherMR200.dts | 74 +- target/linux/ramips/dts/BC2.dts | 46 +- target/linux/ramips/dts/BOCCO.dts | 46 +- target/linux/ramips/dts/BR-6475ND.dts | 97 +- target/linux/ramips/dts/BR-6478AC-V2.dts | 210 + target/linux/ramips/dts/BROADWAY.dts | 46 +- target/linux/ramips/dts/C108.dts | 52 +- target/linux/ramips/dts/CARAMBOLA.dts | 44 +- target/linux/ramips/dts/CF-WR800N.dts | 52 +- target/linux/ramips/dts/CS-QR10.dts | 52 +- target/linux/ramips/dts/CY-SWR1100.dts | 97 +- target/linux/ramips/dts/D105.dts | 54 +- target/linux/ramips/dts/D240.dts | 55 +- target/linux/ramips/dts/DAP-1350.dts | 62 +- target/linux/ramips/dts/DAP-1522-A1.dts | 42 +- target/linux/ramips/dts/DB-WRT01.dts | 52 +- target/linux/ramips/dts/DCH-M225.dts | 84 +- target/linux/ramips/dts/DCS-930.dts | 60 +- target/linux/ramips/dts/DCS-930L-B1.dts | 52 +- target/linux/ramips/dts/DIR-300-B1.dts | 52 +- target/linux/ramips/dts/DIR-300-B7.dts | 54 +- target/linux/ramips/dts/DIR-320-B1.dts | 54 +- target/linux/ramips/dts/DIR-600-B1.dts | 52 +- target/linux/ramips/dts/DIR-610-A1.dts | 52 +- target/linux/ramips/dts/DIR-615-D.dts | 54 +- target/linux/ramips/dts/DIR-615-H1.dts | 54 +- target/linux/ramips/dts/DIR-620-A1.dts | 52 +- target/linux/ramips/dts/DIR-620-D1.dts | 52 +- target/linux/ramips/dts/DIR-645.dts | 70 +- target/linux/ramips/dts/DIR-810L.dts | 94 +- target/linux/ramips/dts/DIR-860L-B1.dts | 98 +- target/linux/ramips/dts/DUZUN-DM06.dts | 46 +- target/linux/ramips/dts/DWR-116-A1.dts | 42 +- target/linux/ramips/dts/DWR-118-A2.dts | 177 + target/linux/ramips/dts/DWR-512-B.dts | 40 +- target/linux/ramips/dts/DWR-921-C1.dts | 44 +- target/linux/ramips/dts/E1700.dts | 53 +- target/linux/ramips/dts/ESR-9753.dts | 52 +- target/linux/ramips/dts/EW1200.dts | 78 +- target/linux/ramips/dts/EX2700.dts | 52 +- target/linux/ramips/dts/EX3700.dts | 85 +- target/linux/ramips/dts/F5D8235_V1.dts | 56 +- target/linux/ramips/dts/F5D8235_V2.dts | 46 +- target/linux/ramips/dts/F7C027.dts | 92 +- target/linux/ramips/dts/FIREWRT.dts | 78 +- target/linux/ramips/dts/FONERA20N.dts | 60 +- target/linux/ramips/dts/FREESTATION5.dts | 60 +- target/linux/ramips/dts/GB-PC1.dts | 52 +- target/linux/ramips/dts/GB-PC2.dts | 58 +- target/linux/ramips/dts/GL-MT300A.dts | 59 +- target/linux/ramips/dts/GL-MT300N-V2.dts | 55 +- target/linux/ramips/dts/GL-MT300N.dts | 57 +- target/linux/ramips/dts/GL-MT750.dts | 70 +- target/linux/ramips/dts/HC5661.dts | 6 +- target/linux/ramips/dts/HC5661A.dts | 86 +- target/linux/ramips/dts/HC5761.dts | 6 +- target/linux/ramips/dts/HC5861.dts | 6 +- target/linux/ramips/dts/HC5861B.dts | 141 + target/linux/ramips/dts/HC5962.dts | 146 +- target/linux/ramips/dts/HC5X61.dtsi | 68 +- target/linux/ramips/dts/HG255D.dts | 62 +- target/linux/ramips/dts/HLKRM04.dts | 46 +- target/linux/ramips/dts/HPM.dts | 54 +- target/linux/ramips/dts/HT-TM02.dts | 52 +- target/linux/ramips/dts/HW550-3G.dts | 52 +- target/linux/ramips/dts/IP2202.dts | 52 +- target/linux/ramips/dts/JHR-N805R.dts | 68 +- target/linux/ramips/dts/JHR-N825R.dts | 52 +- target/linux/ramips/dts/JHR-N926R.dts | 52 +- target/linux/ramips/dts/K2G.dts | 33 +- target/linux/ramips/dts/K2P.dts | 73 +- target/linux/ramips/dts/LINKIT7688.dts | 50 +- target/linux/ramips/dts/M2M.dts | 52 +- target/linux/ramips/dts/M3.dts | 52 +- target/linux/ramips/dts/M4-4M.dts | 44 +- target/linux/ramips/dts/M4-8M.dts | 44 +- target/linux/ramips/dts/M4.dtsi | 8 +- target/linux/ramips/dts/MAC1200RV2.dts | 78 +- target/linux/ramips/dts/MINIEMBPLUG.dts | 46 +- target/linux/ramips/dts/MINIEMBWIFI.dts | 52 +- target/linux/ramips/dts/MIR3G.dts | 189 +- target/linux/ramips/dts/MIWIFI-MINI.dts | 92 +- target/linux/ramips/dts/MIWIFI-NANO.dts | 52 +- target/linux/ramips/dts/MLW221.dts | 60 +- target/linux/ramips/dts/MLWG2.dts | 60 +- target/linux/ramips/dts/MOFI3500-3GN.dts | 52 +- target/linux/ramips/dts/MPRA1.dts | 54 +- target/linux/ramips/dts/MPRA2.dts | 54 +- target/linux/ramips/dts/MR-102N.dts | 68 +- target/linux/ramips/dts/MT7620a.dts | 46 +- target/linux/ramips/dts/MT7620a_MT7530.dts | 45 +- target/linux/ramips/dts/MT7620a_MT7610e.dts | 46 +- target/linux/ramips/dts/MT7620a_V22SG.dts | 46 +- target/linux/ramips/dts/MT7621.dts | 36 +- target/linux/ramips/dts/MT7628.dts | 44 +- target/linux/ramips/dts/MZK-750DHP.dts | 63 +- target/linux/ramips/dts/MZK-DP150N.dts | 52 +- target/linux/ramips/dts/MZK-EX300NP.dts | 60 +- target/linux/ramips/dts/MZK-EX750NP.dts | 71 +- target/linux/ramips/dts/MZK-W300NH2.dts | 62 +- target/linux/ramips/dts/MZK-WDPR.dts | 54 +- target/linux/ramips/dts/MicroWRT.dts | 46 +- target/linux/ramips/dts/NA930.dts | 52 +- target/linux/ramips/dts/NBG-419N.dts | 52 +- target/linux/ramips/dts/NBG-419N2.dts | 53 +- target/linux/ramips/dts/NCS601W.dts | 46 +- target/linux/ramips/dts/NIXCORE-16M.dts | 44 +- target/linux/ramips/dts/NIXCORE-8M.dts | 44 +- target/linux/ramips/dts/NIXCORE.dtsi | 10 +- target/linux/ramips/dts/NW718.dts | 52 +- target/linux/ramips/dts/Newifi-D1.dts | 82 +- target/linux/ramips/dts/Newifi-D2.dts | 76 +- target/linux/ramips/dts/OMEGA2.dtsi | 48 +- target/linux/ramips/dts/OY-0001.dts | 54 +- target/linux/ramips/dts/PBR-D1.dts | 50 +- target/linux/ramips/dts/PBR-M1.dts | 79 +- target/linux/ramips/dts/PSG1208.dts | 65 +- target/linux/ramips/dts/PSG1218.dtsi | 59 +- target/linux/ramips/dts/PSG1218A.dts | 11 +- target/linux/ramips/dts/PSG1218B.dts | 11 +- target/linux/ramips/dts/PSR-680W.dts | 52 +- target/linux/ramips/dts/PWH2004.dts | 52 +- target/linux/ramips/dts/PX-4885-4M.dts | 44 +- target/linux/ramips/dts/PX-4885-8M.dts | 44 +- target/linux/ramips/dts/PX-4885.dtsi | 10 +- target/linux/ramips/dts/R6120.dts | 145 + target/linux/ramips/dts/R6220.dts | 94 +- target/linux/ramips/dts/RB750Gr3.dts | 53 +- target/linux/ramips/dts/RBM11G.dts | 164 + target/linux/ramips/dts/RBM33G.dts | 85 +- target/linux/ramips/dts/RE350.dts | 84 +- target/linux/ramips/dts/RE6500.dts | 78 +- target/linux/ramips/dts/RP-N53.dts | 60 +- target/linux/ramips/dts/RT-AC51U.dts | 52 +- target/linux/ramips/dts/RT-G32-B1.dts | 46 +- target/linux/ramips/dts/RT-N10-PLUS.dts | 52 +- target/linux/ramips/dts/RT-N12-PLUS.dts | 52 +- target/linux/ramips/dts/RT-N13U.dts | 52 +- target/linux/ramips/dts/RT-N14U.dts | 52 +- target/linux/ramips/dts/RT-N15.dts | 52 +- target/linux/ramips/dts/RT-N56U.dts | 77 +- .../linux/ramips/dts/RT5350F-OLINUXINO.dtsi | 54 +- target/linux/ramips/dts/RUT5XX.dts | 52 +- target/linux/ramips/dts/SAP-G3200U3.dts | 88 +- target/linux/ramips/dts/SK-WB8.dts | 75 +- target/linux/ramips/dts/SL-R7205.dts | 52 +- target/linux/ramips/dts/TEW-638APB-V2.dts | 52 +- target/linux/ramips/dts/TEW-691GR.dts | 52 +- target/linux/ramips/dts/TEW-692GR.dts | 77 +- target/linux/ramips/dts/TEW-714TRU.dts | 66 +- target/linux/ramips/dts/TINY-AC.dts | 49 +- target/linux/ramips/dts/TL-MR3020V3.dts | 144 + target/linux/ramips/dts/TL-MR3420V5.dts | 8 +- target/linux/ramips/dts/TL-WA801NDV5.dts | 59 + target/linux/ramips/dts/TL-WR840NV4.dts | 8 +- target/linux/ramips/dts/TL-WR840NV5.dts | 42 +- target/linux/ramips/dts/TL-WR841NV13.dts | 8 +- target/linux/ramips/dts/TL-WR842NV5.dts | 8 +- target/linux/ramips/dts/TL-WR902ACV3.dts | 25 +- target/linux/ramips/dts/TPLINK-8M.dtsi | 44 +- target/linux/ramips/dts/Timecloud.dts | 56 +- target/linux/ramips/dts/U25AWF-H1.dts | 52 +- target/linux/ramips/dts/U35WF.dts | 112 + target/linux/ramips/dts/U7621-06-256M-16M.dts | 44 +- target/linux/ramips/dts/U7621-06.dtsi | 10 +- target/linux/ramips/dts/U7628-01-128M-16M.dts | 44 +- target/linux/ramips/dts/U7628-01.dtsi | 8 +- target/linux/ramips/dts/UBNT-ER-e50.dtsi | 84 +- target/linux/ramips/dts/UR-326N4G.dts | 52 +- target/linux/ramips/dts/UR-336UN.dts | 52 +- target/linux/ramips/dts/V11STFE.dts | 62 +- target/linux/ramips/dts/V22RW-2X2.dts | 52 +- target/linux/ramips/dts/VAR11N-300.dts | 52 +- target/linux/ramips/dts/VOCORE-16M.dts | 44 +- target/linux/ramips/dts/VOCORE-8M.dts | 44 +- target/linux/ramips/dts/VOCORE.dtsi | 6 +- target/linux/ramips/dts/VOCORE2.dts | 50 +- target/linux/ramips/dts/VOCORE2LITE.dts | 50 +- target/linux/ramips/dts/VR500.dts | 52 +- target/linux/ramips/dts/W06.dts | 56 +- target/linux/ramips/dts/W150M.dts | 52 +- target/linux/ramips/dts/W2914NSV2.dts | 5 - target/linux/ramips/dts/W2914NSV2.dtsi | 72 +- target/linux/ramips/dts/W306R_V20.dts | 52 +- target/linux/ramips/dts/W502U.dts | 52 +- target/linux/ramips/dts/WCR-1166DS.dts | 94 +- target/linux/ramips/dts/WCR150GN.dts | 52 +- target/linux/ramips/dts/WD03.dts | 52 +- target/linux/ramips/dts/WE1026-5G-16M.dts | 44 +- target/linux/ramips/dts/WE1026-5G.dtsi | 17 +- target/linux/ramips/dts/WF-2881.dts | 86 +- target/linux/ramips/dts/WHR-1166D.dts | 66 +- target/linux/ramips/dts/WHR-300HP2.dts | 52 +- target/linux/ramips/dts/WHR-600D.dts | 64 +- target/linux/ramips/dts/WHR-G300N.dts | 62 +- target/linux/ramips/dts/WIDORA-NEO-16M.dts | 42 +- target/linux/ramips/dts/WIDORA-NEO-32M.dts | 42 +- target/linux/ramips/dts/WIDORA-NEO.dtsi | 8 +- target/linux/ramips/dts/WITI.dtsi | 74 +- target/linux/ramips/dts/WIZARD8800.dts | 46 +- target/linux/ramips/dts/WIZFI630A.dts | 60 +- target/linux/ramips/dts/WL-330N.dts | 52 +- target/linux/ramips/dts/WL-330N3G.dts | 52 +- target/linux/ramips/dts/WL-341V3.dts | 46 +- target/linux/ramips/dts/WL-351.dts | 52 +- target/linux/ramips/dts/WL-WN575A3.dts | 60 +- target/linux/ramips/dts/WLI-TX4-AG300N.dts | 52 +- target/linux/ramips/dts/WLR-6000.dts | 107 +- target/linux/ramips/dts/WMDR-143N.dts | 44 +- target/linux/ramips/dts/WMR-300.dts | 52 +- target/linux/ramips/dts/WN-AX1167GR.dts | 169 + target/linux/ramips/dts/WN-GX300GR.dts | 103 +- target/linux/ramips/dts/WN3000RPV3.dts | 52 +- target/linux/ramips/dts/WNCE2001.dts | 80 +- target/linux/ramips/dts/WNDR3700V5.dts | 78 +- target/linux/ramips/dts/WR1200JS.dts | 82 +- target/linux/ramips/dts/WR512-3GN-4M.dts | 44 +- target/linux/ramips/dts/WR512-3GN-8M.dts | 44 +- target/linux/ramips/dts/WR512-3GN.dtsi | 8 +- target/linux/ramips/dts/WR6202.dts | 46 +- target/linux/ramips/dts/WRC-1167GHBK2-S.dts | 78 +- target/linux/ramips/dts/WRC-1900GST.dts | 9 + target/linux/ramips/dts/WRC-2533GST.dts | 9 + target/linux/ramips/dts/WRH-300CR.dts | 60 +- target/linux/ramips/dts/WRTNODE.dts | 50 +- target/linux/ramips/dts/WRTNODE2.dtsi | 46 +- target/linux/ramips/dts/WRTNODE2P.dts | 10 +- target/linux/ramips/dts/WRTNODE2R.dts | 8 +- target/linux/ramips/dts/WSR-1166.dts | 84 +- target/linux/ramips/dts/WSR-600.dts | 74 +- target/linux/ramips/dts/WT1520-4M.dts | 44 +- target/linux/ramips/dts/WT1520-8M.dts | 44 +- target/linux/ramips/dts/WT1520.dtsi | 2 - target/linux/ramips/dts/WT3020-4M.dts | 44 +- target/linux/ramips/dts/WT3020-8M.dts | 44 +- target/linux/ramips/dts/WT3020.dtsi | 8 +- target/linux/ramips/dts/WZR-AGL300NH.dts | 56 +- target/linux/ramips/dts/X5.dts | 52 +- target/linux/ramips/dts/X8.dts | 52 +- target/linux/ramips/dts/XDXRN502J.dts | 52 +- target/linux/ramips/dts/Y1.dts | 6 +- target/linux/ramips/dts/Y1.dtsi | 63 +- target/linux/ramips/dts/Y1S.dts | 12 +- target/linux/ramips/dts/YOUKU-YK1.dts | 52 +- target/linux/ramips/dts/ZBT-APE522II.dts | 57 +- target/linux/ramips/dts/ZBT-CPE102.dts | 53 +- target/linux/ramips/dts/ZBT-WA05.dts | 52 +- target/linux/ramips/dts/ZBT-WE1226.dts | 52 +- target/linux/ramips/dts/ZBT-WE1326.dts | 72 +- target/linux/ramips/dts/ZBT-WE2026.dts | 52 +- target/linux/ramips/dts/ZBT-WE3526.dts | 76 +- target/linux/ramips/dts/ZBT-WE826-16M.dts | 44 +- target/linux/ramips/dts/ZBT-WE826-32M.dts | 44 +- target/linux/ramips/dts/ZBT-WE826.dtsi | 8 +- target/linux/ramips/dts/ZBT-WG2626.dts | 78 +- target/linux/ramips/dts/ZBT-WG3526.dtsi | 76 +- target/linux/ramips/dts/ZBT-WR8305RT.dts | 52 +- target/linux/ramips/dts/ZL5900V2.dts | 52 +- target/linux/ramips/dts/ZTE-Q7.dts | 54 +- target/linux/ramips/dts/elecom_wrc-gst.dtsi | 176 + target/linux/ramips/dts/ki_rb.dts | 211 + target/linux/ramips/dts/kn.dts | 52 +- target/linux/ramips/dts/kn_rc.dts | 52 +- target/linux/ramips/dts/kn_rf.dts | 52 +- target/linux/ramips/dts/kng_rc.dts | 54 +- target/linux/ramips/dts/mt7620a.dtsi | 34 +- target/linux/ramips/dts/mt7620n.dtsi | 20 +- target/linux/ramips/dts/mt7621.dtsi | 62 +- target/linux/ramips/dts/mt7628an.dtsi | 12 +- target/linux/ramips/dts/rt2880.dtsi | 12 +- target/linux/ramips/dts/rt3050.dtsi | 12 +- target/linux/ramips/dts/rt3352.dtsi | 12 +- target/linux/ramips/dts/rt3883.dtsi | 47 +- target/linux/ramips/dts/rt5350.dtsi | 10 +- .../drivers/mmc/host/mtk-mmc/Kconfig | 4 - .../drivers/mmc/host/mtk-mmc/board.h | 82 +- .../files-4.14/drivers/mmc/host/mtk-mmc/dbg.c | 388 +- .../files-4.14/drivers/mmc/host/mtk-mmc/dbg.h | 93 +- .../drivers/mmc/host/mtk-mmc/mt6575_sd.h | 1070 ++-- .../files-4.14/drivers/mmc/host/mtk-mmc/sd.c | 4211 ++++++------- .../net/ethernet/{mtk => mediatek}/Kconfig | 0 .../net/ethernet/{mtk => mediatek}/Makefile | 0 .../ethernet/{mtk => mediatek}/esw_rt3050.c | 0 .../ethernet/{mtk => mediatek}/esw_rt3050.h | 0 .../net/ethernet/{mtk => mediatek}/ethtool.c | 0 .../net/ethernet/{mtk => mediatek}/ethtool.h | 0 .../ethernet/{mtk => mediatek}/gsw_mt7620.c | 43 +- .../ethernet/{mtk => mediatek}/gsw_mt7620.h | 0 .../ethernet/{mtk => mediatek}/gsw_mt7621.c | 0 .../net/ethernet/{mtk => mediatek}/mdio.c | 0 .../net/ethernet/{mtk => mediatek}/mdio.h | 0 .../ethernet/{mtk => mediatek}/mdio_mt7620.c | 0 .../ethernet/{mtk => mediatek}/mdio_rt2880.c | 0 .../ethernet/{mtk => mediatek}/mdio_rt2880.h | 0 .../net/ethernet/{mtk => mediatek}/mt7530.c | 0 .../net/ethernet/{mtk => mediatek}/mt7530.h | 0 .../ethernet/{mtk => mediatek}/mtk_debugfs.c | 0 .../ethernet/{mtk => mediatek}/mtk_eth_soc.c | 261 +- .../ethernet/{mtk => mediatek}/mtk_eth_soc.h | 11 +- .../ethernet/{mtk => mediatek}/mtk_offload.c | 0 .../ethernet/{mtk => mediatek}/mtk_offload.h | 0 .../ethernet/{mtk => mediatek}/soc_mt7620.c | 0 .../ethernet/{mtk => mediatek}/soc_mt7621.c | 3 +- .../ethernet/{mtk => mediatek}/soc_rt2880.c | 0 .../ethernet/{mtk => mediatek}/soc_rt3050.c | 0 .../ethernet/{mtk => mediatek}/soc_rt3883.c | 0 target/linux/ramips/image/Makefile | 11 +- target/linux/ramips/image/mt7620.mk | 49 +- target/linux/ramips/image/mt7621.mk | 80 +- target/linux/ramips/image/mt76x8.mk | 75 + target/linux/ramips/mt7620/config-4.14 | 3 +- target/linux/ramips/mt7621/config-4.14 | 2 + target/linux/ramips/mt76x8/config-4.14 | 2 - ...IPS-ralink-Add-rt3352-SPI_CS1-pinmux.patch | 45 + .../0024-GPIO-add-named-gpio-exports.patch | 13 +- ...25-pinctrl-ralink-add-pinctrl-driver.patch | 2 +- ...DT-Add-documentation-for-gpio-ralink.patch | 4 +- ...alink-add-gpio-driver-for-ralink-SoC.patch | 2 +- .../0032-USB-dwc2-add-device_reset.patch | 2 +- ...d-spi-nor-add-w25q256-3b-mode-switch.patch | 12 +- ...spi-nor-w25q256-respect-default-mode.patch | 73 + .../ramips/patches-4.14/0090-ethernet.patch | 41 - .../302-spi-nor-add-gd25q512.patch | 2 +- ...or-enable-4B-opcodes-for-mx66l51235l.patch | 2 +- target/linux/ramips/rt288x/config-4.14 | 2 - target/linux/ramips/rt288x/target.mk | 1 + target/linux/ramips/rt305x/config-4.14 | 2 - target/linux/ramips/rt305x/target.mk | 2 +- target/linux/ramips/rt3883/config-4.14 | 2 - target/linux/ramips/rt3883/target.mk | 2 +- target/linux/rb532/config-4.9 | 1 - target/linux/samsung/Makefile | 26 + target/linux/samsung/dts/TQ210.dts | 69 + .../files-4.14/drivers/mtd/nand/s5pxx_nand.c | 499 ++ target/linux/samsung/image/Makefile | 25 + .../patches-4.14/001-s5pv210-nand.patch | 44 + .../samsung/patches-4.14/002-dm9000-clk.patch | 37 + target/linux/samsung/s5pv210/config-4.14 | 414 ++ .../samsung/s5pv210/profiles/00-default.mk | 16 + target/linux/samsung/s5pv210/target.mk | 17 + target/linux/sunxi/config-4.14 | 1 + target/linux/sunxi/image/cortex-a53.mk | 10 + ...angepi_pc2_usb_otg_to_host_key_power.patch | 20 + .../patches-4.9/0050-stmmac-form-4-10.patch | 2 +- .../patches-4.9/0051-stmmac-form-4-11.patch | 2 +- .../patches-4.9/0053-stmmac-form-4-13.patch | 2 +- target/linux/xburst/Makefile | 25 + .../xburst/base-files/etc/board.d/01_system | 12 + .../linux/xburst/base-files/etc/config/fstab | 6 + .../xburst/base-files/etc/config/network | 13 + target/linux/xburst/config-3.18 | 346 ++ target/linux/xburst/image/Makefile | 46 + target/linux/xburst/image/ubinize.cfg | 14 + target/linux/xburst/modules.mk | 40 + ...e-vid-header-instead-of-the-whole-pa.patch | 20 + ...-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch | 43 + ...-for-subpage-reads-for-NAND_ECC_HW_O.patch | 104 + ...y-activation-of-the-DAC-to-work-arou.patch | 33 + ...it-the-regulator-register-on-startup.patch | 55 + .../006-Add-ili8960-lcd-driver.patch | 309 + ...e-3-wire-spi-mode-for-the-display-fo.patch | 21 + target/linux/xburst/qi_lb60/config-default | 33 + target/linux/xburst/qi_lb60/target.mk | 1 + target/linux/zynq/Makefile | 31 + .../zynq/base-files/etc/board.d/02_network | 22 + target/linux/zynq/base-files/etc/inittab | 3 + target/linux/zynq/config-4.14 | 722 +++ target/linux/zynq/image/Makefile | 60 + ...020-v4.17-add-digilent-zybo-z7-board.patch | 94 + ...25-v4.19-update-digilent-zybo-z7-dts.patch | 52 + toolchain/Config.in | 6 +- toolchain/Makefile | 2 +- toolchain/binutils/Config.in | 12 +- toolchain/binutils/Config.version | 10 +- toolchain/binutils/Makefile | 9 +- .../001-MIPS_BFD_Remove_EI_ABIVERSION_5.patch | 36 - ...ishandles-file-pointers-while-scanni.patch | 112 + .../300-001_ld_makefile_patch.patch | 2 +- .../300-012_check_ldrunpath_length.patch | 14 +- .../400-mips_no_dynamic_linking_sym.patch | 4 +- ...e-default-emulation-for-mips64-linux.patch | 6 +- toolchain/gcc/Config.in | 7 +- toolchain/gcc/Config.version | 11 +- toolchain/gcc/common.mk | 9 +- .../001-revert_register_mode_search.patch | 65 - .../280-musl-disable-ifunc-by-default.patch | 36 - .../300-mips_Os_cpu_rtx_cost_model.patch | 11 - .../6.3.0/830-arm_unbreak_armv4t.patch | 13 - .../patches/6.3.0/880-no_java_section.patch | 11 - .../6.3.0/940-no-clobber-stamp-bits.patch | 11 - .../6.3.0/950-cpp_file_path_translation.patch | 182 - .../patches/6.3.0/960-fix-ubsan-defref.patch | 11 - .../002-case_insensitive.patch | 10 + .../{6.3.0 => 8.2.0}/010-documentation.patch | 14 +- .../patches/8.2.0/110-Fix-MIPS-PR-84790.patch | 20 + .../{6.3.0 => 8.2.0}/230-musl_libssp.patch | 2 +- .../300-mips_Os_cpu_rtx_cost_model.patch | 21 + .../800-arm_v5te_no_ldrd_strd.patch | 2 +- .../810-arm-softfloat-libgcc.patch | 10 +- .../{6.3.0 => 8.2.0}/820-libgcc_pic.patch | 14 +- .../840-armv4_pass_fix-v4bx_to_ld.patch | 11 +- .../850-use_shared_libgcc.patch | 15 +- .../851-libgcc_no_compat.patch | 10 + .../870-ppc_no_crtsavres.patch | 2 +- .../{6.3.0 => 8.2.0}/881-no_tm_section.patch | 0 .../{6.3.0 => 8.2.0}/900-bad-mips16-crt.patch | 0 .../{6.3.0 => 8.2.0}/910-mbsd_multi.patch | 108 +- .../920-specs_nonfatal_getenv.patch | 9 +- .../930-fix-mips-noexecstack.patch | 6 +- ...ibffi-fix-MIPS-softfloat-build-issue.patch | 168 + ...mpilation-when-making-cross-compiler.patch | 67 + toolchain/gdb/Makefile | 6 +- toolchain/gdb/patches/110-no_testsuite.patch | 4 +- .../120-fix-compile-flag-mismatch.patch | 2 +- toolchain/glibc/common.mk | 4 +- .../glibc/patches/100-fix_cross_rpcgen.patch | 2 +- .../patches/200-add-dl-search-paths.patch | 2 +- toolchain/{yasm => nasm}/Makefile | 30 +- ...rt-upstream-GCC8-compatibility-fixes.patch | 15 + tools/Makefile | 3 +- tools/b43-tools/Makefile | 6 +- tools/ccache/Makefile | 4 +- tools/ccache/patches/100-honour-copts.patch | 6 +- tools/cmake/Makefile | 6 +- .../cmake/patches/100-disable_qt_tests.patch | 4 +- .../120-curl-fix-libressl-linking.patch | 2 +- .../130-bootstrap_parallel_make_flag.patch | 2 +- .../cmake/patches/140-curl-fix-libressl.patch | 68 - ...atch => 140-libarchive-fix-libressl.patch} | 0 tools/e2fsprogs/Makefile | 4 +- tools/firmware-utils/Makefile | 2 + tools/firmware-utils/src/mkrasimage.c | 459 ++ tools/firmware-utils/src/mksercommfw.c | 255 + tools/firmware-utils/src/mktplinkfw.c | 11 +- tools/firmware-utils/src/tplink-safeloader.c | 185 +- tools/kernel2minor/Makefile | 7 +- tools/sdimage/Makefile | 6 +- tools/sparse/Makefile | 11 +- 1906 files changed, 107475 insertions(+), 52062 deletions(-) delete mode 100644 feeds.conf.default create mode 100644 package/base-files/files/etc/ethers create mode 100644 package/boot/grub2/patches/0008-Fix-packed-not-aligned-error-on-GCC-8.patch create mode 100644 package/boot/grub2/patches/300-CVE-2015-8370.patch create mode 100644 package/boot/uboot-envtools/files/ath79 create mode 100644 package/boot/uboot-envtools/files/layerscape delete mode 100644 package/boot/uboot-imx6/patches/002-use-static-inline.patch delete mode 100644 package/boot/uboot-imx6/patches/003-use-weak-in-board.patch delete mode 100644 package/boot/uboot-imx6/patches/004-use-weak-in-main.patch delete mode 100644 package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch delete mode 100644 package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch delete mode 100644 package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch delete mode 100644 package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch create mode 100644 package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch delete mode 100644 package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch delete mode 100644 package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch create mode 100644 package/boot/uboot-sunxi/patches/310-sunxi-h3-Sync-OTG-and-HCI-nodes-from-Linux-DT.patch create mode 100644 package/boot/uboot-zynq/patches/020-v2018.09-arm-zynq-dts-add-spi-flash-node-to-zedboard.patch create mode 100644 package/boot/uboot-zynq/patches/025-v2018.09-arm-zynq-add-support-for-the-zybo-z7-board.patch create mode 100644 package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch delete mode 100644 package/devel/perf/musl-compat.h delete mode 100644 package/devel/perf/musl-include/asm/errno.h delete mode 100644 package/devel/perf/musl-include/string.h create mode 100644 package/firmware/brcmfmac-board-rpi/Makefile create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/Makefile create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/Makefile create mode 100755 package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh create mode 100644 package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c create mode 100644 package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf create mode 100644 package/kernel/linux/files/sysctl-tcp-bbr.conf create mode 100644 package/kernel/mac80211/patches/338-v4.19-0001-brcmfmac-detect-firmware-support-for-monitor-interfa.patch create mode 100644 package/kernel/mac80211/patches/338-v4.19-0002-brcmfmac-detect-firmware-support-for-radiotap-monito.patch create mode 100644 package/kernel/mac80211/patches/338-v4.19-0003-brcmfmac-handle-msgbuf-packets-marked-with-monitor-m.patch create mode 100644 package/kernel/mac80211/patches/339-v4.19-brcmfmac-define-more-bits-for-the-flags-of-struct-br.patch create mode 100644 package/kernel/mac80211/patches/340-v4.19-brcmfmac-update-STA-info-struct-to-the-v5.patch create mode 100644 package/kernel/mac80211/patches/341-v4.19-brcmfmac-specify-some-features-per-firmware-version.patch create mode 100644 package/kernel/mac80211/patches/380-0000-ath10k-handle-tdls-peer-events.patch create mode 100644 package/kernel/mac80211/patches/380-0001-ath10k-wmi-modify-svc-bitmap-parsing-for-wcn3990.patch create mode 100644 package/kernel/mac80211/patches/380-0002-ath10k-advertise-TDLS-wider-bandwidth-support-for-5G.patch create mode 100644 package/kernel/mac80211/patches/380-0003-ath10k-debugfs-support-to-get-final-TPC-stats-for-10.patch create mode 100644 package/kernel/mac80211/patches/380-0004-ath10k-Fix-kernel-panic-while-using-worker-ath10k_st.patch create mode 100644 package/kernel/mac80211/patches/380-0005-ath10k-fix-kernel-panic-while-reading-tpc_stats.patch create mode 100644 package/kernel/mac80211/patches/380-0006-ath10k-add-support-to-configure-channel-dwell-time.patch create mode 100644 package/kernel/mac80211/patches/380-0007-ath-add-support-to-get-the-detected-radar-specificat.patch create mode 100644 package/kernel/mac80211/patches/380-0008-ath10k-DFS-Host-Confirmation.patch create mode 100644 package/kernel/mac80211/patches/380-0009-ath10k-fix-memory-leak-of-tpc_stats.patch create mode 100644 package/kernel/mac80211/patches/380-0010-ath10k-support-use-of-channel-173.patch create mode 100644 package/kernel/mac80211/patches/380-0011-ath10k-fix-spectral-scan-for-QCA9984-and-QCA9888-chi.patch create mode 100644 package/kernel/mac80211/patches/381-ath9k-fix-tx99-with-monitor-mode-interface.patch create mode 100644 package/kernel/mac80211/patches/552-ahb_of.patch create mode 100644 package/kernel/mac80211/patches/941-mwl8k-add-non-DFS-5G-upper-channels.patch create mode 100644 package/kernel/mac80211/patches/975-ath10k-use-tpt-trigger-by-default.patch create mode 100644 package/kernel/mac80211/patches/976-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch delete mode 100644 package/libs/elfutils/patches/002-argp_standalone.patch delete mode 100644 package/libs/elfutils/patches/006-libdw_LIBS.patch delete mode 100644 package/libs/libbsd/patches/001-aarch64_support.patch create mode 100644 package/libs/libbsd/patches/001-handle-systems-missing-sys_cdefs.h.patch create mode 100644 package/libs/libbsd/patches/002-fix_function_declaration_protection_for_glibc_already_providing_them.patch create mode 100644 package/libs/libevent2/patches/0001-Do-not-check-for-ERR_remove_thread_state-do-not-link.patch create mode 100644 package/libs/libevent2/patches/0002-Makefile.am-omit-building-sample-and-test.patch delete mode 100644 package/libs/libnftnl/patches/100-src-add-flowtable-support.patch delete mode 100644 package/libs/libnftnl/patches/101-expr-add-flow-offload-expression.patch delete mode 100644 package/libs/libpcap/patches/001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch delete mode 100644 package/libs/libpcap/patches/002-Add-missing-compiler_state_t-parameter.patch delete mode 100644 package/libs/libpcap/patches/202-protocol_api.patch delete mode 100644 package/libs/mbedtls/patches/300-soversion-compatibility.patch create mode 100644 package/libs/sysfsutils/files/local.conf create mode 100644 package/libs/sysfsutils/files/sysfs.conf create mode 100644 package/libs/sysfsutils/files/sysfsutils delete mode 100644 package/libs/wolfssl/patches/001-CVE-2017-13099.patch create mode 100644 package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch create mode 100644 package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch create mode 100644 package/network/services/dropbear/patches/160-lto-jobserver.patch rename package/network/services/hostapd/patches/{0101-mesh-factor-out-mesh-join-function.patch => 001-mesh-factor-out-mesh-join-function.patch} (91%) rename package/network/services/hostapd/patches/{0102-mesh-factor-out-rsn-initialization.patch => 002-mesh-factor-out-rsn-initialization.patch} (69%) rename package/network/services/hostapd/patches/{0103-mesh-relocate-RSN-init-function.patch => 003-mesh-relocate-RSN-init-function.patch} (79%) rename package/network/services/hostapd/patches/{0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch => 004-mesh-use-setup-completion-callback-to-complete-mesh-.patch} (84%) rename package/network/services/hostapd/patches/{0105-mesh-reflect-country-setting-to-mesh-configuration.patch => 005-mesh-reflect-country-setting-to-mesh-configuration.patch} (58%) rename package/network/services/hostapd/patches/{0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch => 006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch} (80%) rename package/network/services/hostapd/patches/{0107-mesh-apply-channel-attributes-before-running-Mesh.patch => 007-mesh-apply-channel-attributes-before-running-Mesh.patch} (70%) rename package/network/services/hostapd/patches/{0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch => 008-mesh-set-interface-type-to-mesh-before-setting-inter.patch} (79%) rename package/network/services/hostapd/patches/{0109-mesh-set-mesh-center-frequency.patch => 009-mesh-set-mesh-center-frequency.patch} (69%) rename package/network/services/hostapd/patches/{0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch => 010-mesh-consider-mesh-interface-on-dfs-event-handler.patch} (54%) rename package/network/services/hostapd/patches/{0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch => 011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch} (80%) rename package/network/services/hostapd/patches/{0112-mesh-allow-mesh-to-send-channel-switch-request.patch => 012-mesh-allow-mesh-to-send-channel-switch-request.patch} (72%) rename package/network/services/hostapd/patches/{0113-mesh-do-not-allow-pri-sec-channel-switch.patch => 013-mesh-do-not-allow-pri-sec-channel-switch.patch} (75%) rename package/network/services/hostapd/patches/{0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch => 014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch} (72%) rename package/network/services/hostapd/patches/{0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch => 015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch} (51%) create mode 100644 package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch create mode 100644 package/network/services/hostapd/patches/017-mesh-use-right-interface-context-to-send-DFS-event-m.patch rename package/network/services/hostapd/patches/{021-mesh-make-forwarding-configurable.patch => 018-mesh-make-forwarding-configurable.patch} (84%) delete mode 100644 package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch delete mode 100644 package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch create mode 100644 package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch create mode 100644 package/network/services/hostapd/patches/500-lto-jobserver-support.patch create mode 100644 package/network/services/openvpn-easy-rsa/patches/101-static_EASYRSA.patch delete mode 100644 package/network/utils/curl/patches/400-CVE-2018-0500.patch delete mode 100644 package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch rename package/network/utils/iproute2/patches/{001-config.patch => 100-config.patch} (100%) rename package/network/utils/iproute2/patches/{004-darwin_fixes.patch => 110-darwin_fixes.patch} (100%) rename package/network/utils/iproute2/patches/{007-no_arpd.patch => 120-no_arpd.patch} (100%) rename package/network/utils/iproute2/patches/{008-no_netem.patch => 130-no_netem.patch} (72%) rename package/network/utils/iproute2/patches/{100-allow_pfifo_fast.patch => 140-allow_pfifo_fast.patch} (100%) rename package/network/utils/iproute2/patches/{009-keep_libmnl_optional.patch => 140-keep_libmnl_optional.patch} (100%) rename package/network/utils/iproute2/patches/{110-extra-ccopts.patch => 150-extra-ccopts.patch} (91%) rename package/network/utils/iproute2/patches/{120-libnetlink-pic.patch => 160-libnetlink-pic.patch} (74%) rename package/network/utils/iproute2/patches/{300-ip_tiny.patch => 170-ip_tiny.patch} (92%) rename package/network/utils/iproute2/patches/{900-drop_FAILED_POLICY.patch => 180-drop_FAILED_POLICY.patch} (100%) rename package/network/utils/iproute2/patches/{950-add-cake-to-tc.patch => 190-add-cake-to-tc.patch} (93%) delete mode 100644 package/network/utils/nftables/patches/100-disable-doc-generation.patch delete mode 100644 package/network/utils/nftables/patches/200-src-support-for-flowtable-listing.patch delete mode 100644 package/network/utils/nftables/patches/201-src-add-support-to-add-flowtables.patch delete mode 100644 package/network/utils/nftables/patches/202-src-delete-flowtable.patch delete mode 100644 package/network/utils/nftables/patches/203-src-flow-offload-support.patch delete mode 100644 package/network/utils/nftables/patches/204-tests-shell-add-flowtable-tests.patch delete mode 100644 package/network/utils/nftables/patches/205-doc-nft-document-flowtable.patch create mode 100644 package/system/ucert/Makefile create mode 100644 package/utils/adb/patches/010-openssl-1.1.patch delete mode 100644 package/utils/busybox/patches/001-resource_h_include.patch delete mode 100644 package/utils/busybox/patches/111-i386_no_arch_flags.patch create mode 100644 package/utils/busybox/patches/120-lto-jobserver.patch delete mode 100644 package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch create mode 100644 package/utils/bzip2/patches/010-CVE-2016-3189.patch create mode 100755 scripts/dl_github_archive.py create mode 100755 scripts/time.pl create mode 100644 target/linux/adm5120/Makefile create mode 100755 target/linux/adm5120/base-files/etc/board.d/01_leds create mode 100644 target/linux/adm5120/base-files/etc/config/network create mode 100644 target/linux/adm5120/base-files/etc/diag.sh create mode 100644 target/linux/adm5120/base-files/etc/inittab create mode 100755 target/linux/adm5120/base-files/lib/adm5120.sh create mode 100644 target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh create mode 100644 target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 create mode 100644 target/linux/adm5120/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/adm5120/config-3.18 create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c create mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h create mode 100644 target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c create mode 100644 target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c create mode 100644 target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c create mode 100644 target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c create mode 100644 target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c create mode 100644 target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c create mode 100644 target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c create mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h create mode 100644 target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c create mode 100644 target/linux/adm5120/image/Makefile create mode 100644 target/linux/adm5120/image/lzma-loader/Makefile create mode 100644 target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c create mode 100644 target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h create mode 100644 target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h create mode 100644 target/linux/adm5120/image/lzma-loader/src/Makefile create mode 100644 target/linux/adm5120/image/lzma-loader/src/README create mode 100644 target/linux/adm5120/image/lzma-loader/src/board.c create mode 100644 target/linux/adm5120/image/lzma-loader/src/config.h create mode 100644 target/linux/adm5120/image/lzma-loader/src/decompress.c create mode 100644 target/linux/adm5120/image/lzma-loader/src/head.S create mode 100644 target/linux/adm5120/image/lzma-loader/src/loader.lds create mode 100644 target/linux/adm5120/image/lzma-loader/src/lzma-data.lds create mode 100644 target/linux/adm5120/image/lzma-loader/src/printf.c create mode 100644 target/linux/adm5120/image/lzma-loader/src/printf.h create mode 100644 target/linux/adm5120/image/rb1xx.mk create mode 100644 target/linux/adm5120/image/router_be.mk create mode 100644 target/linux/adm5120/image/router_le.mk create mode 100644 target/linux/adm5120/modules.mk create mode 100644 target/linux/adm5120/patches-3.18/001-adm5120.patch create mode 100644 target/linux/adm5120/patches-3.18/002-adm5120_flash.patch create mode 100644 target/linux/adm5120/patches-3.18/003-adm5120_switch.patch create mode 100644 target/linux/adm5120/patches-3.18/005-adm5120_usb.patch create mode 100644 target/linux/adm5120/patches-3.18/007-adm5120_pci.patch create mode 100644 target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch create mode 100644 target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch create mode 100644 target/linux/adm5120/patches-3.18/100-rootfs_split.patch create mode 100644 target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch create mode 100644 target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch create mode 100644 target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch create mode 100644 target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch create mode 100644 target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch create mode 100644 target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch create mode 100644 target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch create mode 100755 target/linux/adm5120/rb1xx/base-files/sbin/wget2nand create mode 100644 target/linux/adm5120/rb1xx/config-default create mode 100644 target/linux/adm5120/rb1xx/profiles/RB1xx.mk create mode 100644 target/linux/adm5120/rb1xx/target.mk create mode 100644 target/linux/adm5120/router_be/config-default create mode 100644 target/linux/adm5120/router_be/profiles/010-Generic.mk create mode 100644 target/linux/adm5120/router_be/profiles/200-ZyXEL.mk create mode 100644 target/linux/adm5120/router_be/target.mk create mode 100644 target/linux/adm5120/router_le/config-3.8 create mode 100644 target/linux/adm5120/router_le/profiles/010-Generic.mk create mode 100644 target/linux/adm5120/router_le/profiles/Cellvision.mk create mode 100644 target/linux/adm5120/router_le/profiles/Compex.mk create mode 100644 target/linux/adm5120/router_le/profiles/Edimax.mk create mode 100644 target/linux/adm5120/router_le/profiles/Infineon.mk create mode 100644 target/linux/adm5120/router_le/profiles/Motorola.mk create mode 100644 target/linux/adm5120/router_le/profiles/Osbridge.mk create mode 100644 target/linux/adm5120/router_le/target.mk create mode 100644 target/linux/adm8668/Makefile create mode 100644 target/linux/adm8668/base-files/etc/config/network create mode 100644 target/linux/adm8668/base-files/etc/diag.sh create mode 100644 target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 create mode 100644 target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 create mode 100644 target/linux/adm8668/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/adm8668/base-files/sbin/hotplug.failsafe create mode 100644 target/linux/adm8668/config-3.18 create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c create mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h create mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h create mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h create mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h create mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h create mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h create mode 100644 target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c create mode 100644 target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c create mode 100644 target/linux/adm8668/image/Makefile create mode 100644 target/linux/adm8668/image/lzma-loader/Makefile create mode 100644 target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c create mode 100644 target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/Makefile create mode 100644 target/linux/adm8668/image/lzma-loader/src/decompress.c create mode 100644 target/linux/adm8668/image/lzma-loader/src/include/_exports.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/include/common.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/include/exports.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/include/image.h create mode 100644 target/linux/adm8668/image/lzma-loader/src/lzma.lds.in create mode 100644 target/linux/adm8668/image/lzma-loader/src/stubs.c create mode 100755 target/linux/adm8668/image/my-mkimage create mode 100644 target/linux/adm8668/patches-3.18/001-adm8668_arch.patch create mode 100644 target/linux/adm8668/patches-3.18/002-adm8668_pci.patch create mode 100644 target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch create mode 100644 target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch create mode 100644 target/linux/adm8668/patches-3.18/005-tulip_platform.patch create mode 100644 target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch create mode 100644 target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch create mode 100644 target/linux/adm8668/profiles/100-WRTU54G-TM.mk delete mode 100644 target/linux/apm821xx/dts/apollo3g.dtsi delete mode 100644 target/linux/apm821xx/dts/wd-mybooklive-duo.dts rename target/linux/arc770/{config-4.9 => config-4.14} (86%) rename target/linux/arc770/{patches-4.9 => patches-4.14}/700-stmmac-Disable-frame-filtering-completely.patch (98%) create mode 100644 target/linux/ath79/dts/ar7161_ubnt_routerstation-pro.dts create mode 100644 target/linux/ath79/dts/ar7161_ubnt_routerstation.dts create mode 100644 target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi create mode 100644 target/linux/ath79/patches-4.14/0010-MIPS-ath79-add-support-for-QCA953x-QCA956x-TP9343.patch rename target/linux/ath79/patches-4.14/{0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch => 0011-MIPS-ath79-select-the-PINCTRL-subsystem.patch} (60%) delete mode 100644 target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch delete mode 100644 target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch rename target/linux/ath79/patches-4.14/{0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch => 0016-MIPS-ath79-get-PCIe-controller-out-of-reset.patch} (94%) delete mode 100644 target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch create mode 100644 target/linux/ath79/patches-4.14/0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch rename target/linux/ath79/patches-4.14/{0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch => 0018-MIPS-pci-ar71xx-convert-to-OF.patch} (84%) create mode 100644 target/linux/ath79/patches-4.14/0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch rename target/linux/ath79/patches-4.14/{0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch => 0020-MIPS-pci-ar724x-convert-to-OF.patch} (84%) rename target/linux/ath79/patches-4.14/{0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch => 0021-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch} (88%) rename target/linux/ath79/patches-4.14/{0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch => 0022-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch} (76%) rename target/linux/ath79/patches-4.14/{0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch => 0023-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch} (82%) rename target/linux/ath79/patches-4.14/{0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch => 0024-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch} (80%) rename target/linux/ath79/patches-4.14/{0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch => 0025-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch} (84%) rename target/linux/ath79/patches-4.14/{0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch => 0026-MIPS-ath79-export-switch-MDIO-reference-clock.patch} (71%) rename target/linux/ath79/patches-4.14/{0025-MIPS-ath79-drop-irq.c.patch => 0027-MIPS-ath79-drop-legacy-IRQ-code.patch} (59%) delete mode 100644 target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch rename target/linux/ath79/patches-4.14/{0023-MIPS-ath79-drop-mach-files.patch => 0028-MIPS-ath79-drop-machfiles.patch} (70%) rename target/linux/ath79/patches-4.14/{0022-MIPS-ath79-drop-pci.c.patch => 0029-MIPS-ath79-drop-legacy-pci-code.patch} (82%) rename target/linux/ath79/patches-4.14/{0024-MIPS-ath79-drop-pdata-helpers.patch => 0030-MIPS-ath79-drop-platform-device-registration-code.patch} (94%) create mode 100644 target/linux/ath79/patches-4.14/0031-MIPS-ath79-drop-OF-clock-code.patch rename target/linux/ath79/patches-4.14/{0026-MIPS-ath79-sanitize-Kconfig-symbols.patch => 0032-MIPS-ath79-sanitize-symbols.patch} (62%) create mode 100644 target/linux/ath79/patches-4.14/0033-spi-ath79-drop-pdata-support.patch delete mode 100644 target/linux/ath79/patches-4.14/0035-MIPS-ath79-fix-QCA956x-boot.patch rename target/linux/ath79/patches-4.14/{0024-GPIO-add-named-gpio-exports.patch => 0036-GPIO-add-named-gpio-exports.patch} (100%) create mode 100644 target/linux/ath79/patches-4.14/0036-MIPS-ath79-remove-irq-code-from-pci.patch create mode 100644 target/linux/ath79/patches-4.14/0037-missing-registers.patch create mode 100644 target/linux/au1000/Makefile create mode 100644 target/linux/au1000/au1500/config-default create mode 100644 target/linux/au1000/au1500/profiles/Atheros.mk create mode 100644 target/linux/au1000/au1500/profiles/InternetBox.mk create mode 100644 target/linux/au1000/au1500/profiles/MeshCube.mk create mode 100644 target/linux/au1000/au1500/target.mk create mode 100644 target/linux/au1000/au1550/config-default create mode 100644 target/linux/au1000/au1550/profiles/DBAu1550.mk create mode 100644 target/linux/au1000/au1550/target.mk create mode 100644 target/linux/au1000/base-files/etc/diag.sh create mode 100644 target/linux/au1000/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/au1000/config-3.18 create mode 100644 target/linux/au1000/image/Makefile create mode 100644 target/linux/au1000/modules.mk create mode 100644 target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch create mode 100644 target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch create mode 100644 target/linux/au1000/patches-3.18/004-watchdog_low_init.patch create mode 100644 target/linux/au1000/patches-3.18/006-codec.patch delete mode 100644 target/linux/brcm2708/base-files/lib/firmware/brcm/brcmfmac43430-sdio.txt create mode 100644 target/linux/brcm47xx/patches-4.14/161-MIPS-BCM47XX-Enable-USB-power-on-Netgear-WNDR3400v3.patch create mode 100644 target/linux/brcm63xx/dts/sr102.dts delete mode 100644 target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch delete mode 100644 target/linux/brcm63xx/patches-4.14/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch create mode 100644 target/linux/brcm63xx/patches-4.14/598-board_sr102.patch delete mode 100644 target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch delete mode 100644 target/linux/brcm63xx/patches-4.9/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch create mode 100644 target/linux/brcm63xx/patches-4.9/598-board_sr102.patch create mode 100644 target/linux/brcm63xx/profiles/sky.mk create mode 100644 target/linux/gemini/image/ImageInfo-sq201 create mode 100644 target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch create mode 100644 target/linux/generic/backport-4.14/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch create mode 100644 target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch create mode 100644 target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch create mode 100644 target/linux/generic/backport-4.14/090-net-bridge-add-support-for-port-isolation.patch create mode 100644 target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch create mode 100644 target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch create mode 100644 target/linux/generic/backport-4.9/014-Kbuild-suppress-packed-not-aligned-warning-for-defau.patch create mode 100644 target/linux/generic/config-3.18 rename target/linux/{mediatek/patches-4.14/0048-net-core-add-RPS-balancer.patch => generic/hack-4.14/600-net-core-add-RPS-balancer.patch} (86%) delete mode 100644 target/linux/generic/hack-4.14/641-bridge_port_isolate.patch create mode 100644 target/linux/generic/hack-4.14/647-netfilter-flow-acct.patch delete mode 100644 target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch delete mode 100644 target/linux/generic/hack-4.9/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch delete mode 100644 target/linux/generic/hack-4.9/952-net-conntrack-events-support-multiple-registrant.patch create mode 100644 target/linux/generic/pending-3.18/001-mtdsplit_backport.patch create mode 100644 target/linux/generic/pending-3.18/002-phy_drivers_backport.patch create mode 100644 target/linux/generic/pending-3.18/003-myloader_backport.patch create mode 100644 target/linux/generic/pending-3.18/020-ssb_update.patch create mode 100644 target/linux/generic/pending-3.18/021-ssb_sprom.patch create mode 100644 target/linux/generic/pending-3.18/025-bcma_backport.patch create mode 100644 target/linux/generic/pending-3.18/026-bcma-from-3.20.patch create mode 100644 target/linux/generic/pending-3.18/027-bcma-from-4.1.patch create mode 100644 target/linux/generic/pending-3.18/028-bcma-from-4.2.patch create mode 100644 target/linux/generic/pending-3.18/029-bcma-from-4.4.patch create mode 100644 target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch create mode 100644 target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch create mode 100644 target/linux/generic/pending-3.18/031-bcma-from-4.5.patch create mode 100644 target/linux/generic/pending-3.18/032-bcma-from-4.6.patch create mode 100644 target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch create mode 100644 target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch create mode 100644 target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch create mode 100644 target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch create mode 100644 target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch create mode 100644 target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch create mode 100644 target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch create mode 100644 target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch create mode 100644 target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch create mode 100644 target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch create mode 100644 target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch create mode 100644 target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch create mode 100644 target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch create mode 100644 target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch create mode 100644 target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch create mode 100644 target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch create mode 100644 target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch create mode 100644 target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch create mode 100644 target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch create mode 100644 target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch create mode 100644 target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch create mode 100644 target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch create mode 100644 target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch create mode 100644 target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch create mode 100644 target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch create mode 100644 target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch create mode 100644 target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch create mode 100644 target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch create mode 100644 target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch create mode 100644 target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch create mode 100644 target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch create mode 100644 target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch create mode 100644 target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch create mode 100644 target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch create mode 100644 target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch create mode 100644 target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch create mode 100644 target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch create mode 100644 target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch create mode 100644 target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch create mode 100644 target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch create mode 100644 target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch create mode 100644 target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch create mode 100644 target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch create mode 100644 target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch create mode 100644 target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch create mode 100644 target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch create mode 100644 target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch create mode 100644 target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch create mode 100644 target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch create mode 100644 target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch create mode 100644 target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch create mode 100644 target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch create mode 100644 target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch create mode 100644 target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch create mode 100644 target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch create mode 100644 target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch create mode 100644 target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch create mode 100644 target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch create mode 100644 target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch create mode 100644 target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch create mode 100644 target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch create mode 100644 target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch create mode 100644 target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch create mode 100644 target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch create mode 100644 target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch create mode 100644 target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch create mode 100644 target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch create mode 100644 target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch create mode 100644 target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch create mode 100644 target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch create mode 100644 target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch create mode 100644 target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch create mode 100644 target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch create mode 100644 target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch create mode 100644 target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch create mode 100644 target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch create mode 100644 target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch create mode 100644 target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch create mode 100644 target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch create mode 100644 target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch create mode 100644 target/linux/generic/pending-3.18/200-fix_localversion.patch create mode 100644 target/linux/generic/pending-3.18/201-extra_optimization.patch create mode 100644 target/linux/generic/pending-3.18/202-reduce_module_size.patch create mode 100644 target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch create mode 100644 target/linux/generic/pending-3.18/204-module_strip.patch create mode 100644 target/linux/generic/pending-3.18/205-backtrace_module_info.patch create mode 100644 target/linux/generic/pending-3.18/210-darwin_scripts_include.patch create mode 100644 target/linux/generic/pending-3.18/212-byteshift_portability.patch create mode 100644 target/linux/generic/pending-3.18/213-x86_vdso_portability.patch create mode 100644 target/linux/generic/pending-3.18/214-spidev_h_portability.patch create mode 100644 target/linux/generic/pending-3.18/220-gc_sections.patch create mode 100644 target/linux/generic/pending-3.18/221-module_exports.patch create mode 100644 target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch create mode 100644 target/linux/generic/pending-3.18/250-netfilter_depends.patch create mode 100644 target/linux/generic/pending-3.18/251-sound_kconfig.patch create mode 100644 target/linux/generic/pending-3.18/252-mv_cesa_depends.patch create mode 100644 target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch create mode 100644 target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch create mode 100644 target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch create mode 100644 target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch create mode 100644 target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch create mode 100644 target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch create mode 100644 target/linux/generic/pending-3.18/259-regmap_dynamic.patch create mode 100644 target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch create mode 100644 target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch create mode 100644 target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch create mode 100644 target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch create mode 100644 target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch create mode 100644 target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch create mode 100644 target/linux/generic/pending-3.18/304-mips_disable_fpu.patch create mode 100644 target/linux/generic/pending-3.18/305-mips_module_reloc.patch create mode 100644 target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch create mode 100644 target/linux/generic/pending-3.18/307-mips_highmem_offset.patch create mode 100644 target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch create mode 100644 target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch create mode 100644 target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch create mode 100644 target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch create mode 100644 target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch create mode 100644 target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch create mode 100644 target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch create mode 100644 target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch create mode 100644 target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch create mode 100644 target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch create mode 100644 target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch create mode 100644 target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch create mode 100644 target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch create mode 100644 target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch create mode 100644 target/linux/generic/pending-3.18/420-mtd-redboot_space.patch create mode 100644 target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch create mode 100644 target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch create mode 100644 target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch create mode 100644 target/linux/generic/pending-3.18/440-block2mtd_init.patch create mode 100644 target/linux/generic/pending-3.18/441-block2mtd_probe.patch create mode 100644 target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch create mode 100644 target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch create mode 100644 target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch create mode 100644 target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch create mode 100644 target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch create mode 100644 target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch create mode 100644 target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch create mode 100644 target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch create mode 100644 target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch create mode 100644 target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch create mode 100644 target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch create mode 100644 target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch create mode 100644 target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch create mode 100644 target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch create mode 100644 target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch create mode 100644 target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch create mode 100644 target/linux/generic/pending-3.18/531-debloat_lzma.patch create mode 100644 target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch create mode 100644 target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch create mode 100644 target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch create mode 100644 target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch create mode 100644 target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch create mode 100644 target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch create mode 100644 target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch create mode 100644 target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch create mode 100644 target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch create mode 100644 target/linux/generic/pending-3.18/621-sched_act_connmark.patch create mode 100644 target/linux/generic/pending-3.18/630-packet_socket_type.patch create mode 100644 target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch create mode 100644 target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch create mode 100644 target/linux/generic/pending-3.18/642-bridge_port_isolate.patch create mode 100644 target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch create mode 100644 target/linux/generic/pending-3.18/650-pppoe_header_pad.patch create mode 100644 target/linux/generic/pending-3.18/651-wireless_mesh_header.patch create mode 100644 target/linux/generic/pending-3.18/653-disable_netlink_trim.patch create mode 100644 target/linux/generic/pending-3.18/655-increase_skb_pad.patch create mode 100644 target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch create mode 100644 target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch create mode 100644 target/linux/generic/pending-3.18/660-fq_codel_defaults.patch create mode 100644 target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch create mode 100644 target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch create mode 100644 target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch create mode 100644 target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch create mode 100644 target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch create mode 100644 target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch create mode 100644 target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch create mode 100644 target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch create mode 100644 target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch create mode 100644 target/linux/generic/pending-3.18/700-swconfig.patch create mode 100644 target/linux/generic/pending-3.18/701-phy_extension.patch create mode 100644 target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch create mode 100644 target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch create mode 100644 target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch create mode 100644 target/linux/generic/pending-3.18/720-phy_adm6996.patch create mode 100644 target/linux/generic/pending-3.18/721-phy_packets.patch create mode 100644 target/linux/generic/pending-3.18/722-phy_mvswitch.patch create mode 100644 target/linux/generic/pending-3.18/723-phy_ip175c.patch create mode 100644 target/linux/generic/pending-3.18/724-phy_ar8216.patch create mode 100644 target/linux/generic/pending-3.18/725-phy_rtl8306.patch create mode 100644 target/linux/generic/pending-3.18/726-phy_rtl8366.patch create mode 100644 target/linux/generic/pending-3.18/727-phy-rtl8367.patch create mode 100644 target/linux/generic/pending-3.18/728-phy-rtl8367b.patch create mode 100644 target/linux/generic/pending-3.18/729-phy-tantos.patch create mode 100644 target/linux/generic/pending-3.18/730-phy_b53.patch create mode 100644 target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch create mode 100644 target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch create mode 100644 target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch create mode 100644 target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch create mode 100644 target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch create mode 100644 target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch create mode 100644 target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch create mode 100644 target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch create mode 100644 target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch create mode 100644 target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch create mode 100644 target/linux/generic/pending-3.18/831-ledtrig_netdev.patch create mode 100644 target/linux/generic/pending-3.18/834-ledtrig-libata.patch create mode 100644 target/linux/generic/pending-3.18/840-rtc7301.patch create mode 100644 target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch create mode 100644 target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch create mode 100644 target/linux/generic/pending-3.18/862-gpio_spi_driver.patch create mode 100644 target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch create mode 100644 target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch create mode 100644 target/linux/generic/pending-3.18/901-debloat_sock_diag.patch create mode 100644 target/linux/generic/pending-3.18/902-debloat_proc.patch create mode 100644 target/linux/generic/pending-3.18/904-debloat_dma_buf.patch create mode 100644 target/linux/generic/pending-3.18/910-kobject_uevent.patch create mode 100644 target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch create mode 100644 target/linux/generic/pending-3.18/921-use_preinit_as_init.patch create mode 100644 target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch create mode 100644 target/linux/generic/pending-3.18/930-crashlog.patch create mode 100644 target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch create mode 100644 target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch create mode 100644 target/linux/generic/pending-3.18/990-gpio_wdt.patch create mode 100644 target/linux/generic/pending-3.18/995-mangle_bootargs.patch create mode 100644 target/linux/generic/pending-3.18/997-device_tree_cmdline.patch create mode 100644 target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch create mode 100644 target/linux/generic/pending-3.18/999-seccomp_log.patch create mode 100644 target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch create mode 100644 target/linux/generic/pending-4.14/419-mtd-redboot-add-of_match_table-with-DT-binding.patch create mode 100644 target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch create mode 100644 target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch create mode 100644 target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch create mode 100644 target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch create mode 100644 target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch create mode 100644 target/linux/imx6/image/bootscript-cubox rename target/linux/imx6/profiles/{100-generic.mk => 100-default.mk} (67%) delete mode 100644 target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch rename target/linux/kirkwood/base-files/etc/init.d/{nsa310_fancontrol => hwmon_fancontrol} (62%) create mode 100644 target/linux/kirkwood/patches-4.14/103-iomega-ix2-200.patch create mode 100644 target/linux/kirkwood/patches-4.9/103-iomega-ix2-200.patch delete mode 100644 target/linux/lantiq/ase/config-4.9 delete mode 100644 target/linux/lantiq/config-4.9 delete mode 100644 target/linux/lantiq/falcon/config-4.9 create mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts create mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts rename target/linux/lantiq/files-4.14/arch/mips/boot/dts/{FRITZ3370.dts => FRITZ3370-REV2.dtsi} (78%) create mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7312.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi delete mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi create mode 100644 target/linux/lantiq/patches-4.14/0701-NET-lantiq-etop-of-mido.patch delete mode 100644 target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch delete mode 100644 target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch delete mode 100644 target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch delete mode 100644 target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch delete mode 100644 target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch delete mode 100644 target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch delete mode 100644 target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch delete mode 100644 target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch delete mode 100644 target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch delete mode 100644 target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch delete mode 100644 target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch delete mode 100644 target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch delete mode 100644 target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch delete mode 100644 target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch delete mode 100644 target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch delete mode 100644 target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch delete mode 100644 target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch delete mode 100644 target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch delete mode 100644 target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch delete mode 100644 target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch delete mode 100644 target/linux/lantiq/patches-4.9/0047-poweroff.patch delete mode 100644 target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch delete mode 100644 target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch delete mode 100644 target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch delete mode 100644 target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch delete mode 100644 target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch delete mode 100644 target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch delete mode 100644 target/linux/lantiq/patches-4.9/0101-find_active_root.patch delete mode 100644 target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch delete mode 100644 target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch delete mode 100644 target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch delete mode 100644 target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch delete mode 100644 target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch delete mode 100644 target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch delete mode 100644 target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch delete mode 100644 target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch delete mode 100644 target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch delete mode 100644 target/linux/lantiq/xrx200/config-4.9 delete mode 100644 target/linux/lantiq/xway/config-4.9 delete mode 100644 target/linux/lantiq/xway_legacy/config-4.9 create mode 100755 target/linux/layerscape/base-files/etc/board.d/01_led create mode 100755 target/linux/layerscape/base-files/etc/board.d/02_network create mode 100755 target/linux/layerscape/base-files/etc/board.d/03_gpio_switches create mode 100644 target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth create mode 100644 target/linux/layerscape/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts create mode 100644 target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts create mode 100755 target/linux/layerscape/image/mkits-multiple-config.sh create mode 100644 target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch create mode 100644 target/linux/layerscape/patches-4.9/820-rgmii-fixed-link.patch create mode 100644 target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch create mode 100644 target/linux/mcs814x/Makefile create mode 100755 target/linux/mcs814x/base-files/etc/board.d/01_leds create mode 100755 target/linux/mcs814x/base-files/etc/board.d/02_network create mode 100644 target/linux/mcs814x/base-files/lib/mcs814x.sh create mode 100755 target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh create mode 100644 target/linux/mcs814x/config-3.18 create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c create mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig create mode 100644 target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile create mode 100644 target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c create mode 100644 target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c create mode 100644 target/linux/mcs814x/image/Makefile create mode 100644 target/linux/mcs814x/modules.mk create mode 100644 target/linux/mcs814x/patches-3.18/001-platform.patch create mode 100644 target/linux/mcs814x/patches-3.18/003-ethernet.patch create mode 100644 target/linux/mcs814x/patches-3.18/004-usb.patch create mode 100644 target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch create mode 100644 target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch create mode 100644 target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch create mode 100644 target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch create mode 100644 target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch create mode 100644 target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch create mode 100644 target/linux/mcs814x/patches-3.18/014-debuguart.patch create mode 100644 target/linux/mcs814x/profiles/000-Generic.mk create mode 100644 target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk create mode 100644 target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac create mode 100644 target/linux/mediatek/base-files/lib/preinit/79_move_config create mode 100755 target/linux/mediatek/image/gen_mt7623_emmc_img.sh create mode 100644 target/linux/mediatek/patches-4.14/0225-arm-dts-Add-missing-mt7623-pcie-nodes.patch create mode 100644 target/linux/mediatek/patches-4.14/0226-phy-phy-mtk-tphy-Add-hifsys-support.patch create mode 100644 target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch create mode 100644 target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate create mode 100644 target/linux/mvebu/image/armada-3720-db.bootscript create mode 100644 target/linux/mvebu/patches-4.14/521-arm64-dts-armada-3720-espressobin-wire-up-spi-flash.patch delete mode 100644 target/linux/mvebu/patches-4.14/521-esporessobin-dt-enable-spi-nor-on-i2c.patch create mode 100644 target/linux/omap/base-files/lib/preinit/79_move_config create mode 100644 target/linux/omap/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/omap24xx/Makefile create mode 100644 target/linux/omap24xx/base-files/etc/config/fstab create mode 100644 target/linux/omap24xx/base-files/etc/config/network create mode 100644 target/linux/omap24xx/base-files/etc/config/wireless create mode 100644 target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image create mode 100644 target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom create mode 100755 target/linux/omap24xx/base-files/etc/init.d/watchdog create mode 100644 target/linux/omap24xx/base-files/etc/inittab create mode 100644 target/linux/omap24xx/base-files/etc/pointercal create mode 100644 target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin create mode 100644 target/linux/omap24xx/config-4.1 create mode 100644 target/linux/omap24xx/image/Makefile create mode 100644 target/linux/omap24xx/modules.mk create mode 100644 target/linux/omap24xx/profiles/100-n810.mk create mode 100644 target/linux/omap24xx/profiles/110-n810-gui.mk create mode 100644 target/linux/ppc40x/Makefile create mode 100644 target/linux/ppc40x/base-files/lib/preinit/01_sysinfo create mode 100644 target/linux/ppc40x/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/ppc40x/config-3.18 create mode 100644 target/linux/ppc40x/image/Makefile create mode 100644 target/linux/ppc40x/modules.mk create mode 100644 target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch create mode 100644 target/linux/ppc40x/patches-3.18/004-magicbox.patch create mode 100644 target/linux/ppc40x/patches-3.18/005-openrb.patch create mode 100644 target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch create mode 100644 target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch create mode 100644 target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch create mode 100644 target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch create mode 100644 target/linux/ppc44x/Makefile create mode 100644 target/linux/ppc44x/base-files/etc/inittab create mode 100644 target/linux/ppc44x/config-3.18 create mode 100644 target/linux/ppc44x/image/Makefile create mode 100644 target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch create mode 100644 target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch create mode 100644 target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch create mode 100644 target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch create mode 100644 target/linux/ramips/dts/ArcherC2-v1.dts create mode 100644 target/linux/ramips/dts/BR-6478AC-V2.dts create mode 100644 target/linux/ramips/dts/DWR-118-A2.dts create mode 100644 target/linux/ramips/dts/HC5861B.dts create mode 100644 target/linux/ramips/dts/R6120.dts create mode 100644 target/linux/ramips/dts/RBM11G.dts create mode 100644 target/linux/ramips/dts/TL-MR3020V3.dts create mode 100644 target/linux/ramips/dts/TL-WA801NDV5.dts create mode 100644 target/linux/ramips/dts/U35WF.dts create mode 100644 target/linux/ramips/dts/WN-AX1167GR.dts create mode 100644 target/linux/ramips/dts/WRC-1900GST.dts create mode 100644 target/linux/ramips/dts/WRC-2533GST.dts create mode 100644 target/linux/ramips/dts/elecom_wrc-gst.dtsi create mode 100644 target/linux/ramips/dts/ki_rb.dts rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/Kconfig (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/Makefile (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/esw_rt3050.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/esw_rt3050.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/ethtool.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/ethtool.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/gsw_mt7620.c (88%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/gsw_mt7620.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/gsw_mt7621.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mdio.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mdio.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mdio_mt7620.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mdio_rt2880.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mdio_rt2880.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mt7530.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mt7530.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mtk_debugfs.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mtk_eth_soc.c (91%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mtk_eth_soc.h (98%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mtk_offload.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/mtk_offload.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/soc_mt7620.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/soc_mt7621.c (98%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/soc_rt2880.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/soc_rt3050.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mtk => mediatek}/soc_rt3883.c (100%) create mode 100644 target/linux/ramips/patches-4.14/0001-MIPS-ralink-Add-rt3352-SPI_CS1-pinmux.patch create mode 100644 target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch delete mode 100644 target/linux/ramips/patches-4.14/0090-ethernet.patch create mode 100644 target/linux/samsung/Makefile create mode 100644 target/linux/samsung/dts/TQ210.dts create mode 100644 target/linux/samsung/files-4.14/drivers/mtd/nand/s5pxx_nand.c create mode 100644 target/linux/samsung/image/Makefile create mode 100644 target/linux/samsung/patches-4.14/001-s5pv210-nand.patch create mode 100644 target/linux/samsung/patches-4.14/002-dm9000-clk.patch create mode 100644 target/linux/samsung/s5pv210/config-4.14 create mode 100644 target/linux/samsung/s5pv210/profiles/00-default.mk create mode 100644 target/linux/samsung/s5pv210/target.mk create mode 100644 target/linux/sunxi/patches-4.14/301-orangepi_pc2_usb_otg_to_host_key_power.patch create mode 100644 target/linux/xburst/Makefile create mode 100755 target/linux/xburst/base-files/etc/board.d/01_system create mode 100644 target/linux/xburst/base-files/etc/config/fstab create mode 100644 target/linux/xburst/base-files/etc/config/network create mode 100644 target/linux/xburst/config-3.18 create mode 100644 target/linux/xburst/image/Makefile create mode 100644 target/linux/xburst/image/ubinize.cfg create mode 100644 target/linux/xburst/modules.mk create mode 100644 target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch create mode 100644 target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch create mode 100644 target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch create mode 100644 target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch create mode 100644 target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch create mode 100644 target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch create mode 100644 target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch create mode 100644 target/linux/xburst/qi_lb60/config-default create mode 100644 target/linux/xburst/qi_lb60/target.mk create mode 100644 target/linux/zynq/Makefile create mode 100755 target/linux/zynq/base-files/etc/board.d/02_network create mode 100644 target/linux/zynq/base-files/etc/inittab create mode 100644 target/linux/zynq/config-4.14 create mode 100644 target/linux/zynq/image/Makefile create mode 100644 target/linux/zynq/patches-4.14/020-v4.17-add-digilent-zybo-z7-board.patch create mode 100644 target/linux/zynq/patches-4.14/025-v4.19-update-digilent-zybo-z7-dts.patch delete mode 100644 toolchain/binutils/patches/2.27/001-MIPS_BFD_Remove_EI_ABIVERSION_5.patch create mode 100644 toolchain/binutils/patches/2.30/100-PR23254-ld.bfd-mishandles-file-pointers-while-scanni.patch rename toolchain/binutils/patches/{2.27 => 2.31.1}/300-001_ld_makefile_patch.patch (92%) rename toolchain/binutils/patches/{2.27 => 2.31.1}/300-012_check_ldrunpath_length.patch (55%) rename toolchain/binutils/patches/{2.27 => 2.31.1}/400-mips_no_dynamic_linking_sym.patch (79%) rename toolchain/binutils/patches/{2.27 => 2.31.1}/500-Change-default-emulation-for-mips64-linux.patch (92%) delete mode 100644 toolchain/gcc/patches/6.3.0/001-revert_register_mode_search.patch delete mode 100644 toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch delete mode 100644 toolchain/gcc/patches/6.3.0/300-mips_Os_cpu_rtx_cost_model.patch delete mode 100644 toolchain/gcc/patches/6.3.0/830-arm_unbreak_armv4t.patch delete mode 100644 toolchain/gcc/patches/6.3.0/880-no_java_section.patch delete mode 100644 toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch delete mode 100644 toolchain/gcc/patches/6.3.0/950-cpp_file_path_translation.patch delete mode 100644 toolchain/gcc/patches/6.3.0/960-fix-ubsan-defref.patch rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/002-case_insensitive.patch (64%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/010-documentation.patch (65%) create mode 100644 toolchain/gcc/patches/8.2.0/110-Fix-MIPS-PR-84790.patch rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/230-musl_libssp.patch (85%) create mode 100644 toolchain/gcc/patches/8.2.0/300-mips_Os_cpu_rtx_cost_model.patch rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/800-arm_v5te_no_ldrd_strd.patch (85%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/810-arm-softfloat-libgcc.patch (80%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/820-libgcc_pic.patch (71%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/840-armv4_pass_fix-v4bx_to_ld.patch (78%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/850-use_shared_libgcc.patch (78%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/851-libgcc_no_compat.patch (63%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/870-ppc_no_crtsavres.patch (84%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/881-no_tm_section.patch (100%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/900-bad-mips16-crt.patch (100%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/910-mbsd_multi.patch (50%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/920-specs_nonfatal_getenv.patch (59%) rename toolchain/gcc/patches/{6.3.0 => 8.2.0}/930-fix-mips-noexecstack.patch (95%) create mode 100644 toolchain/gcc/patches/8.2.0/931-libffi-fix-MIPS-softfloat-build-issue.patch create mode 100644 toolchain/gcc/patches/8.2.0/960-gotools-fix-compilation-when-making-cross-compiler.patch rename toolchain/{yasm => nasm}/Makefile (59%) create mode 100644 toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch delete mode 100644 tools/cmake/patches/140-curl-fix-libressl.patch rename tools/cmake/patches/{150-libarchive-fix-libressl.patch => 140-libarchive-fix-libressl.patch} (100%) create mode 100644 tools/firmware-utils/src/mkrasimage.c create mode 100644 tools/firmware-utils/src/mksercommfw.c diff --git a/Makefile b/Makefile index 0a1f96a97..530188306 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,8 @@ ifneq ($(OPENWRT_BUILD),1) export OPENWRT_BUILD GREP_OPTIONS= export GREP_OPTIONS + CDPATH= + export CDPATH include $(TOPDIR)/include/debug.mk include $(TOPDIR)/include/depends.mk include $(TOPDIR)/include/toplevel.mk @@ -85,7 +87,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages fi checksum: FORCE - $(call sha256sums,$(BIN_DIR)) + $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT)) diffconfig: FORCE mkdir -p $(BIN_DIR) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 9b55f1c0d..f38cc792d 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -31,7 +31,7 @@ config KERNEL_CRASHLOG config KERNEL_SWAP bool "Support for paging of anonymous memory (swap)" - default y + default y if !SMALL_FLASH config KERNEL_DEBUG_FS bool "Compile the kernel with debug filesystem enabled" @@ -65,9 +65,30 @@ config KERNEL_PROFILING Enable the extended profiling support mechanisms used by profilers such as OProfile. +config KERNEL_TASKSTATS + bool "Compile the kernel with task resource/io statistics and accounting" + default n + help + Enable the collection and publishing of task/io statistics and + accounting. Enable this option to enable i/o monitoring in system + monitors. + +if KERNEL_TASKSTATS + + config KERNEL_TASK_DELAY_ACCT + def_bool y + + config KERNEL_TASK_IO_ACCOUNTING + def_bool y + + config KERNEL_TASK_XACCT + def_bool y + +endif + config KERNEL_KALLSYMS bool "Compile the kernel with symbol table information" - default n + default y if !SMALL_FLASH help This will give you more information in stack traces from kernel oopses. @@ -112,7 +133,7 @@ config KERNEL_DEBUG_KERNEL config KERNEL_DEBUG_INFO bool "Compile the kernel with debug information" - default y + default y if !SMALL_FLASH select KERNEL_DEBUG_KERNEL help This will compile your kernel and modules with debug information. @@ -205,7 +226,7 @@ config KERNEL_COREDUMP config KERNEL_ELF_CORE bool "Enable process core dump support" select KERNEL_COREDUMP - default y + default y if !SMALL_FLASH config KERNEL_PROVE_LOCKING bool "Enable kernel lock checking" @@ -785,3 +806,30 @@ config KERNEL_DEVKMEM Say Y here if you want to support the /dev/kmem device. The /dev/kmem device is rarely used, but can be used for certain kind of kernel debugging operations. + +config KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE + int "Number of squashfs fragments cached" + default 2 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) + default 3 + +# +# compile optimiziation setting +# +choice + prompt "Compiler optimization level" + default KERNEL_CC_OPTIMIZE_FOR_SIZE if SMALL_FLASH + +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE + bool "Optimize for performance" + help + This is the default optimization level for the kernel, building + with the "-O2" compiler flag for best performance and most + helpful compile-time warnings. + +config KERNEL_CC_OPTIMIZE_FOR_SIZE + bool "Optimize for size" + help + Enabling this option will pass "-Os" instead of "-O2" to + your compiler resulting in a smaller kernel. + +endchoice diff --git a/feeds.conf.default b/feeds.conf.default deleted file mode 100644 index 3e43e57d8..000000000 --- a/feeds.conf.default +++ /dev/null @@ -1,4 +0,0 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-18.06 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-18.06 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-18.06 -#src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06 diff --git a/include/download.mk b/include/download.mk index 2ba8a7bdf..33141910f 100644 --- a/include/download.mk +++ b/include/download.mk @@ -19,17 +19,23 @@ endif DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) +define dl_method_git +$(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git) +endef + # Try to guess the download method from the URL define dl_method $(strip \ - $(if $(2),$(2), \ - $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ - $(if $(filter git://%,$(1)),git, \ - $(if $(filter svn://%,$(1)),svn, \ - $(if $(filter cvs://%,$(1)),cvs, \ - $(if $(filter hg://%,$(1)),hg, \ - $(if $(filter sftp://%,$(1)),bzr, \ - unknown \ + $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)), + $(if $(2),$(2), \ + $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ + $(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \ + $(if $(filter svn://%,$(1)),svn, \ + $(if $(filter cvs://%,$(1)),cvs, \ + $(if $(filter hg://%,$(1)),hg, \ + $(if $(filter sftp://%,$(1)),bzr, \ + unknown \ + ) \ ) \ ) \ ) \ @@ -56,6 +62,10 @@ ifdef CHECK check_escape=$(subst ','\'',$(1)) #') +# $(1): suffix of the F_, C_ variables, e.g. hash_deprecated, hash_mismatch, etc. +# $(2): filename +# $(3): expected hash value +# $(4): var name of the the form: {PKG_,Download/:}{,MIRROR_}{HASH,MIRROR_HASH} check_warn_nofix = $(info $(shell printf "$(_R)WARNING: %s$(_N)" '$(call check_escape,$(call C_$(1),$(2),$(3),$(4)))')) ifndef FIXUP check_warn = $(check_warn_nofix) @@ -71,11 +81,17 @@ F_hash_mismatch = $(F_hash_deprecated) F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1)) endif +# $(1): filename +# $(2): expected hash value +# $(3): var name of the the form: {PKG_,Download/:}{,MIRROR_}{HASH,MIRROR_HASH} C_download_missing = $(1) is missing, please run make download before re-running this check C_hash_mismatch = $(3) does not match $(1) hash $(call gen_sha256sum,$(1)) C_hash_deprecated = $(3) uses deprecated hash, set to $(call gen_sha256sum,$(1)) C_hash_missing = $(3) is missing, set to $(call gen_sha256sum,$(1)) +# $(1): filename +# $(2): expected hash value +# $(3): var name of the the form: {PKG_,Download/:}{,MIRROR_}{HASH,MIRROR_HASH} check_hash = \ $(if $(wildcard $(DL_DIR)/$(1)), \ $(if $(filter-out x,$(2)), \ @@ -116,6 +132,9 @@ define DownloadMethod/default ) endef +# $(1): "check" +# $(2): "PKG_" if as in Download/ is "default", otherwise "Download/:" +# $(3): shell command sequence to do the download define wrap_mirror $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \ $(if $(filter check,$(1)), \ @@ -159,23 +178,41 @@ endef define DownloadMethod/git $(call wrap_mirror,$(1),$(2), \ - echo "Checking out files from the git repository..."; \ - mkdir -p $(TMP_DIR)/dl && \ - cd $(TMP_DIR)/dl && \ - rm -rf $(SUBDIR) && \ - [ \! -d $(SUBDIR) ] && \ - git clone $(OPTS) $(URL) $(SUBDIR) && \ - (cd $(SUBDIR) && git checkout $(VERSION) && \ - git submodule update --init --recursive) && \ - echo "Packing checkout..." && \ - export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \ - rm -rf $(SUBDIR)/.git && \ - $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ - mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ - rm -rf $(SUBDIR); \ + $(call DownloadMethod/rawgit) \ ) endef +define DownloadMethod/github_archive + $(call wrap_mirror,$(1),$(2), \ + $(SCRIPT_DIR)/dl_github_archive.py \ + --dl-dir="$(DL_DIR)" \ + --url="$(URL)" \ + --version="$(VERSION)" \ + --subdir="$(SUBDIR)" \ + --source="$(FILE)" \ + --hash="$(MIRROR_HASH)" \ + || ( $(call DownloadMethod/rawgit) ); \ + ) +endef + +# Only intends to be called as a submethod from other DownloadMethod +define DownloadMethod/rawgit + echo "Checking out files from the git repository..."; \ + mkdir -p $(TMP_DIR)/dl && \ + cd $(TMP_DIR)/dl && \ + rm -rf $(SUBDIR) && \ + [ \! -d $(SUBDIR) ] && \ + git clone $(OPTS) $(URL) $(SUBDIR) && \ + (cd $(SUBDIR) && git checkout $(VERSION) && \ + git submodule update --init --recursive) && \ + echo "Packing checkout..." && \ + export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \ + rm -rf $(SUBDIR)/.git && \ + $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ + rm -rf $(SUBDIR); +endef + define DownloadMethod/bzr $(call wrap_mirror,$(1),$(2), \ echo "Checking out files from the bzr repository..."; \ diff --git a/include/hardening.mk b/include/hardening.mk index 06a61789e..60f39428e 100644 --- a/include/hardening.mk +++ b/include/hardening.mk @@ -18,8 +18,8 @@ ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY endif ifdef CONFIG_PKG_ASLR_PIE ifeq ($(strip $(PKG_ASLR_PIE)),1) - TARGET_CFLAGS += -fPIC - TARGET_LDFLAGS += -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs + TARGET_CFLAGS += $(FPIC) + TARGET_LDFLAGS += $(FPIC) -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs endif endif ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR diff --git a/include/host-build.mk b/include/host-build.mk index a2a31ae04..827ea6bbf 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -132,7 +132,7 @@ define Host/Exports/Default $(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX) $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig $(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig - $(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache + $(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache) $(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE)) $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG)) endef diff --git a/include/image-commands.mk b/include/image-commands.mk index 4d3f025b1..ae01706b1 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -49,6 +49,27 @@ define Build/eva-image mv $@.new $@ endef +define Build/zyxel-ras-image + let \ + newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \ + $(STAGING_DIR_HOST)/bin/mkrasimage \ + -b $(RAS_BOARD) \ + -v $(RAS_VERSION) \ + -r $@ \ + -s $$newsize \ + -o $@.new \ + $(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \ + && mv $@.new $@ +endef + +define Build/mkbuffaloimg + $(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \ + -R $$(($(subst k, * 1024,$(ROOTFS_SIZE)))) \ + -K $$(($(subst k, * 1024,$(KERNEL_SIZE)))) \ + -i $@ -o $@.new + mv $@.new $@ +endef + define Build/netgear-chk $(STAGING_DIR_HOST)/bin/mkchkimg \ -o $@.new \ @@ -102,6 +123,16 @@ define Build/tplink-safeloader $(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@ endef +define Build/mksercommfw + -$(STAGING_DIR_HOST)/bin/mksercommfw \ + $@ \ + $(KERNEL_OFFSET) \ + $(HWID) \ + $(HWVER) \ + $(SWVER) +endef + + define Build/append-dtb cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@ endef @@ -243,6 +274,11 @@ define Build/openmesh-image "$(call param_get_default,rootfs,$(1),$@)" "rootfs" endef +define Build/senao-header + $(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new + mv $@.new $@ +endef + define Build/sysupgrade-tar sh $(TOPDIR)/scripts/sysupgrade-tar.sh \ --board $(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \ @@ -296,6 +332,12 @@ metadata_json = \ define Build/append-metadata $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) + [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" ] || { \ + cp "$(BUILD_KEY).ucert" "$@.ucert" ;\ + usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\ + ucert -A -c "$@.ucert" -x "$@.sig" ;\ + fwtool -S "$@.ucert" "$@" ;\ + } endef define Build/kernel2minor diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 89ba1bb05..98adc9e39 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -2,11 +2,13 @@ LINUX_RELEASE?=1 -LINUX_VERSION-4.9 = .123 -LINUX_VERSION-4.14 = .66 +LINUX_VERSION-3.18 = .119 +LINUX_VERSION-4.9 = .124 +LINUX_VERSION-4.14 = .67 -LINUX_KERNEL_HASH-4.9.123 = 8d12ceab9f8cbfd0555c881b35ed4384cf3ea8e223d894c030b04786005e5071 -LINUX_KERNEL_HASH-4.14.66 = a38061ca4c864d11a72beb3dc5918a99f13372fe9ee35508d004fdfabd460413 +LINUX_KERNEL_HASH-3.18.119 = 2bab623ed868b679eac224f62212cc285264061bedf1e32897f72e35aa26160d +LINUX_KERNEL_HASH-4.9.124 = 5ca6b0d48c8dd1265005169f1b97149a4e893668c0d8aa566a73c7663c8e4311 +LINUX_KERNEL_HASH-4.14.67 = 3f4b056dc27233a78f7a4a35ed6fdcfd0a9680ec40b611a898bb6c8b905070ba remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/include/netfilter.mk b/include/netfilter.mk index 5d532cea5..510aa183c 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -106,6 +106,7 @@ $(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_ph # filter $(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_STRING, $(P_XT)xt_string)) +$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf)) # ipopt diff --git a/include/package.mk b/include/package.mk index 2473eecb9..a03db1111 100644 --- a/include/package.mk +++ b/include/package.mk @@ -144,7 +144,7 @@ define Build/Exports/Default $(1) : export CONFIG_SITE:=$$(CONFIG_SITE) $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH) $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH) - $(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache + $(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache) endef Build/Exports=$(Build/Exports/Default) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index edd63e9ee..a416a2d23 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -27,7 +27,7 @@ $(eval $(call TestHostCommand,proper-umask, \ umask | grep -xE 00[012][012])) $(eval $(call SetupHostCommand,gcc, \ - Please install the GNU C Compiler (gcc) 4.8 or later \ + Please install the GNU C Compiler (gcc) 4.8 or later, \ $(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ gcc48 --version | grep gcc, \ @@ -46,7 +46,7 @@ $(eval $(call TestHostCommand,working-gcc, \ gcc -x c -o $(TMP_DIR)/a.out -)) $(eval $(call SetupHostCommand,g++, \ - Please install the GNU C++ Compiler (g++) 4.8 or later \ + Please install the GNU C++ Compiler (g++) 4.8 or later, \ $(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ g++48 --version | grep g++, \ @@ -138,11 +138,6 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ wget --version | grep GNU)) -$(eval $(call SetupHostCommand,time,Please install GNU 'time' or BusyBox 'time' that supports -f, \ - gtime --version 2>&1 | grep GNU, \ - time --version 2>&1 | grep GNU, \ - busybox time 2>&1 | grep -- '-f FMT')) - $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) diff --git a/include/subdir.mk b/include/subdir.mk index dde3e50b0..6512e24c2 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -43,7 +43,7 @@ log_make = \ $(if $(BUILD_LOG), \ set -o pipefail; \ mkdir -p $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4));) \ - env time -f "time: $(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2)\#%U\#%S\#%e" -- \ + $(SCRIPT_DIR)/time.pl "time: $(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2)" \ $$(SUBMAKE) $(subdir_make_opts) $(if $(3),$(3)-)$(2) \ $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2).txt) diff --git a/include/target.mk b/include/target.mk index 181d18926..011280f0b 100644 --- a/include/target.mk +++ b/include/target.mk @@ -22,7 +22,7 @@ luci-app-sfe luci-app-flowoffload luci-app-nlbwmon # For nas targets DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm # For router targets -DEFAULT_PACKAGES.router:=dnsmasq-full iptables ip6tables ppp ppp-mod-pppoe firewall kmod-ipt-offload +DEFAULT_PACKAGES.router:=dnsmasq-full iptables ip6tables ppp ppp-mod-pppoe firewall odhcpd-ipv6only odhcp6c kmod-ipt-offload DEFAULT_PACKAGES.bootloader:= ifneq ($(DUMP),) @@ -56,7 +56,7 @@ else endif endif -ifneq ($(filter 4.9,$(KERNEL_PATCHVER)),) +ifneq ($(filter 3.18 4.9,$(KERNEL_PATCHVER)),) DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router)) endif @@ -179,7 +179,7 @@ ifeq ($(DUMP),1) CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64 CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc - CPU_CFLAGS_octeon = -march=octeon -mabi=64 + CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64 endif ifeq ($(ARCH),i386) CPU_TYPE ?= pentium diff --git a/include/verbose.mk b/include/verbose.mk index b7e43f743..d26008019 100644 --- a/include/verbose.mk +++ b/include/verbose.mk @@ -54,7 +54,7 @@ ifeq ($(findstring s,$(OPENWRT_VERBOSE)),) else SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1) export QUIET:=1 - SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with -j1 V=s to see what's going on"; false; } } 8>&1 9>&2; cmd + SUBMAKE=cmd() { $(SILENT) $(MAKE) -s "$$@" < /dev/null || { echo "make $$*: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on"; false; } } 8>&1 9>&2; cmd endif .SILENT: $(MAKECMDGOALS) diff --git a/include/version.mk b/include/version.mk index 552283074..8ef0a7e65 100644 --- a/include/version.mk +++ b/include/version.mk @@ -11,6 +11,7 @@ # SOURCE_DATE_EPOCH:=x PKG_CONFIG_DEPENDS += \ + CONFIG_VERSION_HOME_URL \ CONFIG_VERSION_BUG_URL \ CONFIG_VERSION_NUMBER \ CONFIG_VERSION_CODE \ @@ -25,13 +26,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) @@ -46,6 +47,9 @@ VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURE VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL)) VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.openwrt.org/) +VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL)) +VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),http://openwrt.org/) + VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL)) VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/) @@ -100,6 +104,7 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \ -e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \ -e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \ -e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \ + -e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \ -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \ -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \ -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' diff --git a/package/base-files/Makefile b/package/base-files/Makefile index ca1cb47a6..52669444e 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,11 +12,11 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=192 +PKG_RELEASE:=195 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ -PKG_BUILD_DEPENDS:=usign/host +PKG_BUILD_DEPENDS:=usign/host ucert/host PKG_LICENSE:=GPL-2.0 # Extend depends from version.mk @@ -49,6 +49,7 @@ define Package/base-files/conffiles /etc/config/system /etc/crontabs/ /etc/dropbear/ +/etc/ethers /etc/group /etc/hosts /etc/inittab @@ -102,6 +103,9 @@ ifdef CONFIG_SIGNED_PACKAGES [ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \ $(STAGING_DIR_HOST)/bin/usign -G -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key" + [ -s $(BUILD_KEY).ucert ] || \ + $(STAGING_DIR_HOST)/bin/ucert -I -c $(BUILD_KEY).ucert -p $(BUILD_KEY).pub -s $(BUILD_KEY) + endef define Package/base-files/install-key diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index fa148685c..c8b253da5 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -15,10 +15,14 @@ generate_static_network() { set network.loopback.proto='static' set network.loopback.ipaddr='127.0.0.1' set network.loopback.netmask='255.0.0.0' - delete network.globals - set network.globals='globals' - set network.globals.ula_prefix='auto' EOF + [ -e /proc/sys/net/ipv6 ] && { + uci -q batch <<-EOF + delete network.globals + set network.globals='globals' + set network.globals.ula_prefix='auto' + EOF + } if json_is_a dsl object; then json_select dsl @@ -102,21 +106,23 @@ generate_network() { set network.$1.proto='static' set network.$1.ipaddr='$ipad' set network.$1.netmask='$netm' - set network.$1.ip6assign='60' EOF + [ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60' ;; dhcp) # fixup IPv6 slave interface if parent is a bridge [ "$type" = "bridge" ] && ifname="br-$1" - uci -q batch <<-EOF - set network.$1.proto='dhcp' - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='$ifname' - set network.${1}6.proto='dhcpv6' - EOF + uci set network.$1.proto='dhcp' + [ -e /proc/sys/net/ipv6 ] && { + uci -q batch <<-EOF + delete network.${1}6 + set network.${1}6='interface' + set network.${1}6.ifname='$ifname' + set network.${1}6.proto='dhcpv6' + EOF + } ;; pppoe) @@ -124,12 +130,16 @@ generate_network() { set network.$1.proto='pppoe' set network.$1.username='username' set network.$1.password='password' - set network.$1.ipv6='1' - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='@${1}' - set network.${1}6.proto='dhcpv6' EOF + [ -e /proc/sys/net/ipv6 ] && { + uci -q batch <<-EOF + set network.$1.ipv6='1' + delete network.${1}6 + set network.${1}6='interface' + set network.${1}6.ifname='@${1}' + set network.${1}6.proto='dhcpv6' + EOF + } ;; esac } diff --git a/package/base-files/files/etc/ethers b/package/base-files/files/etc/ethers new file mode 100644 index 000000000..b92c200a4 --- /dev/null +++ b/package/base-files/files/etc/ethers @@ -0,0 +1,6 @@ +# +# Lookup man 5 ethers for syntax documentation +# +# Examples : +# 02:00:11:22:33:44 OpenWrt.lan +# 02:00:11:22:33:44 192.168.1.1 diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index e9936fb36..9a3ac069a 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -14,7 +14,11 @@ export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) export HOME=${HOME:-/root} export PS1='\u@\h:\w\$ ' -[ "$TERM" = "xterm" ] && export PS1='\[\e]0;\u@\h: \w\a\]'$PS1 +case "$TERM" in + xterm*|rxvt*) + export PS1='\[\e]0;\u@\h: \w\a\]'$PS1 + ;; +esac [ -x /bin/more ] || alias more=less [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index d4402c3a1..7ed62804a 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -20,8 +20,7 @@ find_mtd_chardev() { echo "${INDEX:+$PREFIX$INDEX}" } -mtd_get_mac_ascii() -{ +mtd_get_mac_ascii() { local mtdname="$1" local key="$2" local part @@ -39,6 +38,29 @@ mtd_get_mac_ascii() [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" } +mtd_get_mac_text() { + local mtdname=$1 + local offset=$2 + local part + local mac_dirty + + part=$(find_mtd_part "$mtdname") + if [ -z "$part" ]; then + echo "mtd_get_mac_text: partition $mtdname not found!" >&2 + return + fi + + if [ -z "$offset" ]; then + echo "mtd_get_mac_text: offset missing!" >&2 + return + fi + + mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null) + + # "canonicalize" mac + [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" +} + mtd_get_mac_binary() { local mtdname="$1" local offset="$2" @@ -87,22 +109,19 @@ macaddr_add() { echo $oui:$nic } -macaddr_setbit_la() -{ +macaddr_setbit_la() { local mac=$1 printf "%02x:%s" $((0x${mac%%:*} | 0x02)) ${mac#*:} } -macaddr_2bin() -{ +macaddr_2bin() { local mac=$1 echo -ne \\x${mac//:/\\x} } -macaddr_canonicalize() -{ +macaddr_canonicalize() { local mac="$1" local canon="" diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 3126fe651..7fa328ac2 100755 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -27,30 +27,33 @@ json_select_object() { json_select "$1" } -_ucidef_set_interface() { - local name="$1" - local iface="$2" - local proto="$3" +ucidef_set_interface() { + local network=$1; shift - json_select_object "$name" - json_add_string ifname "$iface" + [ -z "$network" ] && return - if ! json_is_a protocol string || [ -n "$proto" ]; then - case "$proto" in - static|dhcp|none|pppoe) : ;; - *) - case "$name" in - lan) proto="static" ;; - wan) proto="dhcp" ;; - *) proto="none" ;; - esac - ;; + json_select_object network + json_select_object "$network" + + while [ -n "$1" ]; do + local opt=$1; shift + local val=$1; shift + + [ -n "$opt" -a -n "$val" ] || break + + json_add_string "$opt" "$val" + done + + if ! json_is_a protocol string; then + case "$network" in + lan) json_add_string protocol static ;; + wan) json_add_string protocol dhcp ;; + *) json_add_string protocol none ;; esac - - json_add_string protocol "$proto" fi json_select .. + json_select .. } ucidef_set_board_id() { @@ -66,31 +69,19 @@ ucidef_set_model_name() { } ucidef_set_interface_lan() { - json_select_object network - _ucidef_set_interface lan "$@" - json_select .. + ucidef_set_interface "lan" ifname "$1" protocol "${2:-static}" } ucidef_set_interface_wan() { - json_select_object network - _ucidef_set_interface wan "$@" - json_select .. + ucidef_set_interface "wan" ifname "$1" protocol "${2:-dhcp}" } ucidef_set_interfaces_lan_wan() { local lan_if="$1" local wan_if="$2" - json_select_object network - _ucidef_set_interface lan "$lan_if" - _ucidef_set_interface wan "$wan_if" - json_select .. -} - -ucidef_set_interface_raw() { - json_select_object network - _ucidef_set_interface "$@" - json_select .. + ucidef_set_interface_lan "$lan_if" + ucidef_set_interface_wan "$wan_if" } _ucidef_add_switch_port() { @@ -185,9 +176,9 @@ _ucidef_finish_switch_roles() { devices="${devices:+$devices }$device" fi json_select .. - - _ucidef_set_interface "$role" "$devices" json_select .. + + ucidef_set_interface "$role" ifname "$devices" done } @@ -300,18 +291,7 @@ ucidef_set_interface_macaddr() { local network="$1" local macaddr="$2" - json_select_object network - - json_select "$network" - [ $? -eq 0 ] || { - json_select .. - return - } - - json_add_string macaddr "$macaddr" - json_select .. - - json_select .. + ucidef_set_interface "$network" macaddr "$macaddr" } ucidef_add_atm_bridge() { diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 38056fd34..9e9144cba 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -211,6 +211,11 @@ jffs2_copy_config() { fi } +indicate_upgrade() { + . /etc/diag.sh + set_state upgrade +} + # Flash firmware to MTD partition # # $(1): path to image @@ -222,6 +227,7 @@ default_do_upgrade() { else get_image "$1" "$2" | mtd write - "${PART_NAME:-image}" fi + [ $? -ne 0 ] && exit 1 } do_upgrade_stage2() { diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh index aa2ac79d1..3f28fccd9 100644 --- a/package/base-files/files/lib/upgrade/fwtool.sh +++ b/package/base-files/files/lib/upgrade/fwtool.sh @@ -1,3 +1,28 @@ +fwtool_check_signature() { + [ $# -gt 1 ] && return 1 + + [ ! -x /usr/bin/ucert ] && { + if [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ]; then + return 1 + else + return 0 + fi + } + + if ! fwtool -q -t -s /tmp/sysupgrade.ucert "$1"; then + echo "Image signature not found" + [ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && { + echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" + } + [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ] && return 1 + return 0 + fi + + ucert -V -m "$1" -c "/tmp/sysupgrade.ucert" -P /etc/opkg/keys + + return $? +} + fwtool_check_image() { [ $# -gt 1 ] && return 1 diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index 3985d8fd7..bdc12c742 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -122,6 +122,7 @@ kill_remaining() { # [ [ ] ] echo } +indicate_upgrade killall -9 telnetd killall -9 dropbear diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index a378b0295..3cebfb68e 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -136,7 +136,7 @@ add_overlayfiles() { } # hooks -sysupgrade_image_check="fwtool_check_image platform_check_image" +sysupgrade_image_check="fwtool_check_signature fwtool_check_image platform_check_image" if [ $SAVE_OVERLAY = 1 ]; then [ ! -d /overlay/upper/etc ] && { @@ -165,6 +165,11 @@ do_save_conffiles() { v "Saving config files..." [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" tar c${TAR_V}zf "$conf_tar" -T "$CONFFILES" 2>/dev/null + if [ "$?" -ne 0 ]; then + echo "Failed to create the configuration backup." + rm -f "$conf_tar" + exit 1 + fi rm -f "$CONFFILES" } diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi index 83befc0d6..f7a10de21 100755 --- a/package/base-files/files/sbin/wifi +++ b/package/base-files/files/sbin/wifi @@ -6,7 +6,7 @@ usage() { cat < +Date: Mon, 26 Mar 2018 16:52:34 +0800 +Subject: Fix packed-not-aligned error on GCC 8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When building with GCC 8, there are several errors regarding packed-not-aligned. + +./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] + +This patch fixes the build error by cleaning up the ambiguity of placing +aligned structure in a packed one. In "struct grub_btrfs_time" and "struct +grub_gpt_part_type", the aligned attribute seems to be superfluous, and also +has to be packed, to ensure the structure is bit-to-bit mapped to the format +laid on disk. I think we could blame to copy and paste error here for the +mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as +the name suggests. :) + +Signed-off-by: Michael Chang +Tested-by: Michael Chang +Tested-by: Paul Menzel +Reviewed-by: Daniel Kiper +--- + grub-core/fs/btrfs.c | 2 +- + include/grub/efiemu/runtime.h | 2 +- + include/grub/gpt_partition.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 4849c1ceb..be195448d 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -175,7 +175,7 @@ struct grub_btrfs_time + { + grub_int64_t sec; + grub_uint32_t nanosec; +-} __attribute__ ((aligned (4))); ++} GRUB_PACKED; + + struct grub_btrfs_inode + { +diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h +index 9b6b729f4..36d2dedf4 100644 +--- a/include/grub/efiemu/runtime.h ++++ b/include/grub/efiemu/runtime.h +@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel + + struct efi_variable + { +- grub_efi_guid_t guid; ++ grub_efi_packed_guid_t guid; + grub_uint32_t namelen; + grub_uint32_t size; + grub_efi_uint32_t attributes; +diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h +index 1b32f6725..9668a68c3 100644 +--- a/include/grub/gpt_partition.h ++++ b/include/grub/gpt_partition.h +@@ -28,7 +28,7 @@ struct grub_gpt_part_type + grub_uint16_t data2; + grub_uint16_t data3; + grub_uint8_t data4[8]; +-} __attribute__ ((aligned(8))); ++} GRUB_PACKED; + typedef struct grub_gpt_part_type grub_gpt_part_type_t; + + #define GRUB_GPT_PARTITION_TYPE_EMPTY \ +-- +cgit v1.1-33-g03f6 diff --git a/package/boot/grub2/patches/300-CVE-2015-8370.patch b/package/boot/grub2/patches/300-CVE-2015-8370.patch new file mode 100644 index 000000000..eb7919639 --- /dev/null +++ b/package/boot/grub2/patches/300-CVE-2015-8370.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hector Marco-Gisbert +Date: Fri, 13 Nov 2015 16:21:09 +0100 +Subject: [PATCH] Fix security issue when reading username and password + + This patch fixes two integer underflows at: + * grub-core/lib/crypto.c + * grub-core/normal/auth.c + +Resolves: CVE-2015-8370 + +Signed-off-by: Hector Marco-Gisbert +Signed-off-by: Ismael Ripoll-Ripoll +--- + grub-core/lib/crypto.c | 2 +- + grub-core/normal/auth.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/grub-core/lib/crypto.c ++++ b/grub-core/lib/crypto.c +@@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned + break; + } + +- if (key == '\b') ++ if (key == '\b' && cur_len) + { + if (cur_len) + cur_len--; +--- a/grub-core/normal/auth.c ++++ b/grub-core/normal/auth.c +@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned + break; + } + +- if (key == '\b') ++ if (key == '\b' && cur_len) + { + if (cur_len) + { diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 new file mode 100644 index 000000000..aa0bf4514 --- /dev/null +++ b/package/boot/uboot-envtools/files/ath79 @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Copyright (C) 2011-2014 OpenWrt.org +# + +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +glinet,ar300m|\ +ocedo,koala|\ +ocedo,raccoon|\ +openmesh,om5p-ac-v2) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index d475e5662..8cd4799b2 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -35,6 +35,9 @@ openmesh,a42 |\ openmesh,a62) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000" ;; +zyxel,nbg6617) + ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood index 16123846c..b5f7ddccb 100644 --- a/package/boot/uboot-envtools/files/kirkwood +++ b/package/boot/uboot-envtools/files/kirkwood @@ -15,6 +15,7 @@ board=$(board_name) case "$board" in cloudengines,pogoe02|\ cloudengines,pogoplugv4|\ +iom,ix2-200|\ linksys,viper|\ raidsonic,ib-nas62x0|\ seagate,dockstar|\ diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape new file mode 100644 index 000000000..732f14845 --- /dev/null +++ b/package/boot/uboot-envtools/files/layerscape @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Copyright (C) 2016 LEDE +# + +[ -f /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in + traverse,ls1043v | \ + traverse,ls1043s) + ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-imx6/Makefile b/package/boot/uboot-imx6/Makefile index 8d422758d..3eba249bf 100644 --- a/package/boot/uboot-imx6/Makefile +++ b/package/boot/uboot-imx6/Makefile @@ -7,10 +7,10 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2014.04 +PKG_VERSION:=2018.03 PKG_RELEASE:=1 -PKG_HASH:=7b6444bd23eb61068c43bd1d44ec7e7bfdbce5cadeca20c833eee186b4d3fd31 +PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -20,7 +20,15 @@ define U-Boot/Default UBOOT_IMAGE:=u-boot.imx endef -define U-Boot/mx6qsabresd +define U-Boot/mx6cuboxi + NAME:=SolidRun Cubox-i boards + UBOOT_IMAGE:=SPL u-boot.img + UBOOT_MAKE_FLAGS:=SPL u-boot.img + BUILD_DEVICES:=cubox-i + HIDDEN:=1 +endef + +define U-Boot/mx6sabresd NAME:=SABRE i.MX6Quad board endef @@ -48,31 +56,29 @@ define U-Boot/nitrogen6s1g NAME:=Nitrogen6x i.MX6Solo 1GB board endef -define U-Boot/wandboard_dl - NAME:=Wandboard Dual Lite - BUILD_DEVICES:=wandboard -endef - -define U-Boot/wandboard_quad - NAME:=Wandboard Quad - BUILD_DEVICES:=wandboard -endef - -define U-Boot/wandboard_solo - NAME:=Wandboard Solo +define U-Boot/wandboard + NAME:=Wandboard Dual Lite/Quad/Solo BUILD_DEVICES:=wandboard endef UBOOT_TARGETS := \ - mx6qsabresd \ + mx6cuboxi \ + mx6sabresd \ nitrogen6dl \ nitrogen6dl2g \ nitrogen6q \ nitrogen6q2g \ nitrogen6s \ nitrogen6s1g \ - wandboard_dl \ - wandboard_quad \ - wandboard_solo + wandboard + +UBOOT_MAKE_FLAGS += u-boot.imx + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(foreach img,$(UBOOT_IMAGE), \ + $(CP) $(PKG_BUILD_DIR)/$(img) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(img); \ + ) +endef $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-imx6/patches/002-use-static-inline.patch b/package/boot/uboot-imx6/patches/002-use-static-inline.patch deleted file mode 100644 index ca7748291..000000000 --- a/package/boot/uboot-imx6/patches/002-use-static-inline.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Jeroen Hofstee -Date: Sun, 22 Jun 2014 21:10:39 +0000 (+0200) -Subject: ARM:asm:io.h use static inline -X-Git-Tag: v2014.10-rc2~47 -X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=8863aa5c984460ce1112d8db895cbf8b13a6ac9d - -ARM:asm:io.h use static inline - -When compiling u-boot with W=1 the extern inline void for -read* is likely causing the most noise. gcc / clang will -warn there is never a actual declaration for these functions. -Instead of declaring these extern make them static inline so -it is actually declared. - -cc: Albert ARIBAUD -Signed-off-by: Jeroen Hofstee ---- - ---- a/arch/arm/include/asm/io.h -+++ b/arch/arm/include/asm/io.h -@@ -75,7 +75,7 @@ static inline phys_addr_t virt_to_phys(v - #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) - #define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v)) - --extern inline void __raw_writesb(unsigned long addr, const void *data, -+static inline void __raw_writesb(unsigned long addr, const void *data, - int bytelen) - { - uint8_t *buf = (uint8_t *)data; -@@ -83,7 +83,7 @@ extern inline void __raw_writesb(unsigne - __arch_putb(*buf++, addr); - } - --extern inline void __raw_writesw(unsigned long addr, const void *data, -+static inline void __raw_writesw(unsigned long addr, const void *data, - int wordlen) - { - uint16_t *buf = (uint16_t *)data; -@@ -91,7 +91,7 @@ extern inline void __raw_writesw(unsigne - __arch_putw(*buf++, addr); - } - --extern inline void __raw_writesl(unsigned long addr, const void *data, -+static inline void __raw_writesl(unsigned long addr, const void *data, - int longlen) - { - uint32_t *buf = (uint32_t *)data; -@@ -99,21 +99,21 @@ extern inline void __raw_writesl(unsigne - __arch_putl(*buf++, addr); - } - --extern inline void __raw_readsb(unsigned long addr, void *data, int bytelen) -+static inline void __raw_readsb(unsigned long addr, void *data, int bytelen) - { - uint8_t *buf = (uint8_t *)data; - while(bytelen--) - *buf++ = __arch_getb(addr); - } - --extern inline void __raw_readsw(unsigned long addr, void *data, int wordlen) -+static inline void __raw_readsw(unsigned long addr, void *data, int wordlen) - { - uint16_t *buf = (uint16_t *)data; - while(wordlen--) - *buf++ = __arch_getw(addr); - } - --extern inline void __raw_readsl(unsigned long addr, void *data, int longlen) -+static inline void __raw_readsl(unsigned long addr, void *data, int longlen) - { - uint32_t *buf = (uint32_t *)data; - while(longlen--) diff --git a/package/boot/uboot-imx6/patches/003-use-weak-in-board.patch b/package/boot/uboot-imx6/patches/003-use-weak-in-board.patch deleted file mode 100644 index afb8c96e5..000000000 --- a/package/boot/uboot-imx6/patches/003-use-weak-in-board.patch +++ /dev/null @@ -1,80 +0,0 @@ -From: Jeroen Hofstee -Date: Wed, 8 Oct 2014 20:57:21 +0000 (+0200) -Subject: arm: board: use __weak -X-Git-Tag: v2015.01-rc1~176 -X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=8590c800ee60e46f15d6085e3c1fed0d6881fc62 - -arm: board: use __weak - -Signed-off-by: Jeroen Hofstee -Acked-by: Albert ARIBAUD ---- - ---- a/arch/arm/lib/board.c -+++ b/arch/arm/lib/board.c -@@ -63,25 +63,15 @@ extern void dataflash_print_info(void); - ************************************************************************ - * May be supplied by boards if desired - */ --inline void __coloured_LED_init(void) {} --void coloured_LED_init(void) -- __attribute__((weak, alias("__coloured_LED_init"))); --inline void __red_led_on(void) {} --void red_led_on(void) __attribute__((weak, alias("__red_led_on"))); --inline void __red_led_off(void) {} --void red_led_off(void) __attribute__((weak, alias("__red_led_off"))); --inline void __green_led_on(void) {} --void green_led_on(void) __attribute__((weak, alias("__green_led_on"))); --inline void __green_led_off(void) {} --void green_led_off(void) __attribute__((weak, alias("__green_led_off"))); --inline void __yellow_led_on(void) {} --void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on"))); --inline void __yellow_led_off(void) {} --void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off"))); --inline void __blue_led_on(void) {} --void blue_led_on(void) __attribute__((weak, alias("__blue_led_on"))); --inline void __blue_led_off(void) {} --void blue_led_off(void) __attribute__((weak, alias("__blue_led_off"))); -+__weak void coloured_LED_init(void) {} -+__weak void red_led_on(void) {} -+__weak void red_led_off(void) {} -+__weak void green_led_on(void) {} -+__weak void green_led_off(void) {} -+__weak void yellow_led_on(void) {} -+__weak void yellow_led_off(void) {} -+__weak void blue_led_on(void) {} -+__weak void blue_led_off(void) {} - - /* - ************************************************************************ -@@ -198,27 +188,21 @@ static int arm_pci_init(void) - */ - typedef int (init_fnc_t) (void); - --void __dram_init_banksize(void) -+__weak void dram_init_banksize(void) - { - gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_dram[0].size = gd->ram_size; - } --void dram_init_banksize(void) -- __attribute__((weak, alias("__dram_init_banksize"))); - --int __arch_cpu_init(void) -+__weak int arch_cpu_init(void) - { - return 0; - } --int arch_cpu_init(void) -- __attribute__((weak, alias("__arch_cpu_init"))); - --int __power_init_board(void) -+__weak int power_init_board(void) - { - return 0; - } --int power_init_board(void) -- __attribute__((weak, alias("__power_init_board"))); - - /* Record the board_init_f() bootstage (after arch_cpu_init()) */ - static int mark_bootstage(void) diff --git a/package/boot/uboot-imx6/patches/004-use-weak-in-main.patch b/package/boot/uboot-imx6/patches/004-use-weak-in-main.patch deleted file mode 100644 index 07c197fc1..000000000 --- a/package/boot/uboot-imx6/patches/004-use-weak-in-main.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Jeroen Hofstee -Date: Thu, 26 Jun 2014 18:18:31 +0000 (+0200) -Subject: common: main.c: make show_boot_progress __weak -X-Git-Tag: v2014.10-rc1~130 -X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=3422299dc28fa8257677d03cc1253e3c9bf17e9f - -common: main.c: make show_boot_progress __weak - -This not only looks a bit better it also prevents a -warning with W=1 (no previous prototype). - -Signed-off-by: Jeroen Hofstee -Acked-by: Simon Glass ---- - ---- a/common/main.c -+++ b/common/main.c -@@ -27,8 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; - /* - * Board-specific Platform code can reimplement show_boot_progress () if needed - */ --void inline __show_boot_progress (int val) {} --void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); -+__weak void show_boot_progress(int val) {} - - #define MAX_DELAY_STOP_STR 32 - diff --git a/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch b/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch index 894ccf008..6bfcc1ff7 100644 --- a/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch +++ b/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch @@ -1,10 +1,17 @@ ---- a/include/configs/wandboard.h -+++ b/include/configs/wandboard.h -@@ -238,4 +238,7 @@ - #define CONFIG_CMD_CACHE - #endif - -+#define CONFIG_FIT -+#define CONFIG_FIT_VERBOSE -+ - #endif /* __CONFIG_H * */ +--- a/configs/wandboard_defconfig ++++ b/configs/wandboard_defconfig +@@ -27,7 +27,7 @@ CONFIG_CMD_I2C=y + CONFIG_CMD_MMC=y + CONFIG_CMD_SATA=y + CONFIG_CMD_USB=y +-CONFIG_CMD_CACHE=y ++# CONFIG_CMD_CACHE is not set + CONFIG_CMD_EXT4_WRITE=y + CONFIG_ENV_IS_IN_MMC=y + CONFIG_DM=y +@@ -39,3 +39,5 @@ CONFIG_USB_STORAGE=y + CONFIG_VIDEO=y + # CONFIG_VIDEO_SW_CURSOR is not set + CONFIG_OF_LIBFDT=y ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y diff --git a/package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch b/package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch deleted file mode 100644 index 7bc65b47f..000000000 --- a/package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch +++ /dev/null @@ -1,480 +0,0 @@ -From fb8ffd7cfc68b3dc44e182356a207d784cb30b34 Mon Sep 17 00:00:00 2001 -From: Masahiro Yamada -Date: Thu, 4 Sep 2014 02:40:58 +0900 -Subject: compiler*.h: sync include/linux/compiler*.h with Linux 3.16 - -Copy them from Linux v3.16 tag. -My main motivation of this commit is to add compiler-clang.h. - -Signed-off-by: Masahiro Yamada -Cc: Jeroen Hofstee ---- - include/linux/compiler-clang.h | 12 ++++++ - include/linux/compiler-gcc.h | 57 ++++++++++++++++++-------- - include/linux/compiler-gcc3.h | 20 ++++----- - include/linux/compiler-gcc4.h | 59 +++++++++++++++++++-------- - include/linux/compiler-intel.h | 40 ++++++++++++++++++ - include/linux/compiler.h | 92 +++++++++++++++++++++++++++++++++++++++++- - 6 files changed, 236 insertions(+), 44 deletions(-) - create mode 100644 include/linux/compiler-clang.h - create mode 100644 include/linux/compiler-intel.h - ---- /dev/null -+++ b/include/linux/compiler-clang.h -@@ -0,0 +1,12 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+/* Some compiler specific definitions are overwritten here -+ * for Clang compiler -+ */ -+ -+#ifdef uninitialized_var -+#undef uninitialized_var -+#define uninitialized_var(x) x = *(&(x)) -+#endif ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -5,6 +5,9 @@ - /* - * Common definitions for all gcc versions go here. - */ -+#define GCC_VERSION (__GNUC__ * 10000 \ -+ + __GNUC_MINOR__ * 100 \ -+ + __GNUC_PATCHLEVEL__) - - - /* Optimization barrier */ -@@ -34,9 +37,15 @@ - __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ - (typeof(ptr)) (__ptr + (off)); }) - -+/* Make the optimizer believe the variable can be manipulated arbitrarily. */ -+#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) -+ -+#ifdef __CHECKER__ -+#define __must_be_array(arr) 0 -+#else - /* &a[0] degrades to a pointer: a different type from an array */ --#define __must_be_array(a) \ -- BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) -+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) -+#endif - - /* - * Force always-inline if the user requests it so via the .config, -@@ -44,15 +53,18 @@ - */ - #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) --# define inline inline __attribute__((always_inline)) --# define __inline__ __inline__ __attribute__((always_inline)) --# define __inline __inline __attribute__((always_inline)) -+# define inline inline __attribute__((always_inline)) notrace -+# define __inline__ __inline__ __attribute__((always_inline)) notrace -+# define __inline __inline __attribute__((always_inline)) notrace -+#else -+/* A lot of inline functions can cause havoc with function tracing */ -+# define inline inline notrace -+# define __inline__ __inline__ notrace -+# define __inline __inline notrace - #endif - - #define __deprecated __attribute__((deprecated)) --#ifndef __packed --# define __packed __attribute__((packed)) --#endif -+#define __packed __attribute__((packed)) - #define __weak __attribute__((weak)) - - /* -@@ -60,8 +72,12 @@ - * naked functions because then mcount is called without stack and frame pointer - * being set up and there is no chance to restore the lr register to the value - * before mcount was called. -+ * -+ * The asm() bodies of naked functions often depend on standard calling conventions, -+ * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce -+ * this, so we must do so ourselves. See GCC PR44290. - */ --#define __naked __attribute__((naked)) notrace -+#define __naked __attribute__((naked)) noinline __noclone notrace - - #define __noreturn __attribute__((noreturn)) - -@@ -75,13 +91,10 @@ - * would be. - * [...] - */ --#ifndef __pure --# define __pure __attribute__((pure)) --#endif --#ifndef __aligned --# define __aligned(x) __attribute__((aligned(x))) --#endif --#define __printf(a,b) __attribute__((format(printf,a,b))) -+#define __pure __attribute__((pure)) -+#define __aligned(x) __attribute__((aligned(x))) -+#define __printf(a, b) __attribute__((format(printf, a, b))) -+#define __scanf(a, b) __attribute__((format(scanf, a, b))) - #define noinline __attribute__((noinline)) - #define __attribute_const__ __attribute__((__const__)) - #define __maybe_unused __attribute__((unused)) -@@ -91,3 +104,15 @@ - #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) - #define gcc_header(x) _gcc_header(x) - #include gcc_header(__GNUC__) -+ -+#if !defined(__noclone) -+#define __noclone /* not needed */ -+#endif -+ -+/* -+ * A trick to suppress uninitialized variable warning without generating any -+ * code -+ */ -+#define uninitialized_var(x) x = x -+ -+#define __always_inline inline __attribute__((always_inline)) ---- a/include/linux/compiler-gcc3.h -+++ b/include/linux/compiler-gcc3.h -@@ -2,20 +2,22 @@ - #error "Please don't include directly, include instead." - #endif - --#if __GNUC_MINOR__ >= 3 -+#if GCC_VERSION < 30200 -+# error Sorry, your compiler is too old - please upgrade it. -+#endif -+ -+#if GCC_VERSION >= 30300 - # define __used __attribute__((__used__)) - #else - # define __used __attribute__((__unused__)) - #endif - --#if __GNUC_MINOR__ >= 4 -+#if GCC_VERSION >= 30400 - #define __must_check __attribute__((warn_unused_result)) - #endif - --/* -- * A trick to suppress uninitialized variable warning without generating any -- * code -- */ --#define uninitialized_var(x) x = x -- --#define __always_inline inline __attribute__((always_inline)) -+#ifdef CONFIG_GCOV_KERNEL -+# if GCC_VERSION < 30400 -+# error "GCOV profiling support for gcc versions below 3.4 not included" -+# endif /* __GNUC_MINOR__ */ -+#endif /* CONFIG_GCOV_KERNEL */ ---- a/include/linux/compiler-gcc4.h -+++ b/include/linux/compiler-gcc4.h -@@ -4,7 +4,7 @@ - - /* GCC 4.1.[01] miscompiles __weak */ - #ifdef __KERNEL__ --# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 -+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 - # error Your version of gcc miscompiles the __weak directive - # endif - #endif -@@ -12,17 +12,12 @@ - #define __used __attribute__((__used__)) - #define __must_check __attribute__((warn_unused_result)) - #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) --#ifndef __always_inline --# define __always_inline inline __attribute__((always_inline)) --#endif - --/* -- * A trick to suppress uninitialized variable warning without generating any -- * code -- */ --#define uninitialized_var(x) x = x -+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -+#endif - --#if __GNUC_MINOR__ >= 3 -+#if GCC_VERSION >= 40300 - /* Mark functions as cold. gcc will assume any path leading to a call - to them will be unlikely. This means a lot of manual unlikely()s - are unnecessary now for any paths leading to the usual suspects -@@ -38,8 +33,15 @@ - the kernel context */ - #define __cold __attribute__((__cold__)) - -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) - --#if __GNUC_MINOR__ >= 5 -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+#endif /* GCC_VERSION >= 40300 */ -+ -+#if GCC_VERSION >= 40500 - /* - * Mark a position in code as unreachable. This can be used to - * suppress control flow warnings after asm blocks that transfer -@@ -50,14 +52,37 @@ - * unreleased. Really, we need to have autoconf for the kernel. - */ - #define unreachable() __builtin_unreachable() --#endif - -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+#endif /* GCC_VERSION >= 40500 */ -+ -+#if GCC_VERSION >= 40600 -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) - #endif - --#if __GNUC_MINOR__ > 0 --#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * Fixed in GCC 4.8.2 and later versions. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#if GCC_VERSION >= 40400 -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ - #endif --#if __GNUC_MINOR__ >= 4 --#define __compiletime_warning(message) __attribute__((warning(message))) --#define __compiletime_error(message) __attribute__((error(message))) -+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -+#define __HAVE_BUILTIN_BSWAP16__ - #endif -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ---- /dev/null -+++ b/include/linux/compiler-intel.h -@@ -0,0 +1,40 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+#ifdef __ECC -+ -+/* Some compiler specific definitions are overwritten here -+ * for Intel ECC compiler -+ */ -+ -+#include -+ -+/* Intel ECC compiler doesn't support gcc specific asm stmts. -+ * It uses intrinsics to do the equivalent things. -+ */ -+#undef RELOC_HIDE -+#undef OPTIMIZER_HIDE_VAR -+ -+#define RELOC_HIDE(ptr, off) \ -+ ({ unsigned long __ptr; \ -+ __ptr = (unsigned long) (ptr); \ -+ (typeof(ptr)) (__ptr + (off)); }) -+ -+/* This should act as an optimization barrier on var. -+ * Given that this compiler does not have inline assembly, a compiler barrier -+ * is the best we can do. -+ */ -+#define OPTIMIZER_HIDE_VAR(var) barrier() -+ -+/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */ -+#define __must_be_array(a) 0 -+ -+#endif -+ -+#ifndef __HAVE_BUILTIN_BSWAP16__ -+/* icc has this, but it's called _bswap16 */ -+#define __HAVE_BUILTIN_BSWAP16__ -+#define __builtin_bswap16 _bswap16 -+#endif -+ ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -5,16 +5,23 @@ - - #ifdef __CHECKER__ - # define __user __attribute__((noderef, address_space(1))) --# define __kernel /* default address space */ -+# define __kernel __attribute__((address_space(0))) - # define __safe __attribute__((safe)) - # define __force __attribute__((force)) - # define __nocast __attribute__((nocast)) - # define __iomem __attribute__((noderef, address_space(2))) -+# define __must_hold(x) __attribute__((context(x,1,1))) - # define __acquires(x) __attribute__((context(x,0,1))) - # define __releases(x) __attribute__((context(x,1,0))) - # define __acquire(x) __context__(x,1) - # define __release(x) __context__(x,-1) - # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) -+# define __percpu __attribute__((noderef, address_space(3))) -+#ifdef CONFIG_SPARSE_RCU_POINTER -+# define __rcu __attribute__((noderef, address_space(4))) -+#else -+# define __rcu -+#endif - extern void __chk_user_ptr(const volatile void __user *); - extern void __chk_io_ptr(const volatile void __iomem *); - #else -@@ -27,13 +34,20 @@ extern void __chk_io_ptr(const volatile - # define __chk_user_ptr(x) (void)0 - # define __chk_io_ptr(x) (void)0 - # define __builtin_warning(x, y...) (1) -+# define __must_hold(x) - # define __acquires(x) - # define __releases(x) - # define __acquire(x) (void)0 - # define __release(x) (void)0 - # define __cond_lock(x,c) (c) -+# define __percpu -+# define __rcu - #endif - -+/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -+#define ___PASTE(a,b) a##b -+#define __PASTE(a,b) ___PASTE(a,b) -+ - #ifdef __KERNEL__ - - #ifdef __GNUC__ -@@ -49,6 +63,13 @@ extern void __chk_io_ptr(const volatile - # include - #endif - -+/* Clang compiler defines __GNUC__. So we will overwrite implementations -+ * coming from above header files here -+ */ -+#ifdef __clang__ -+#include -+#endif -+ - /* - * Generic compiler-dependent macros required for kernel - * build go below this comment. Actual compiler/compiler version -@@ -156,6 +177,15 @@ void ftrace_likely_update(struct ftrace_ - (typeof(ptr)) (__ptr + (off)); }) - #endif - -+#ifndef OPTIMIZER_HIDE_VAR -+#define OPTIMIZER_HIDE_VAR(var) barrier() -+#endif -+ -+/* Not-quite-unique ID. */ -+#ifndef __UNIQUE_ID -+# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) -+#endif -+ - #endif /* __KERNEL__ */ - - #endif /* __ASSEMBLY__ */ -@@ -228,7 +258,7 @@ void ftrace_likely_update(struct ftrace_ - - /* - * Rather then using noinline to prevent stack consumption, use -- * noinline_for_stack instead. For documentaiton reasons. -+ * noinline_for_stack instead. For documentation reasons. - */ - #define noinline_for_stack noinline - -@@ -270,11 +300,20 @@ void ftrace_likely_update(struct ftrace_ - # define __section(S) __attribute__ ((__section__(#S))) - #endif - -+#ifndef __visible -+#define __visible -+#endif -+ - /* Are two types/vars the same type (ignoring qualifiers)? */ - #ifndef __same_type - # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) - #endif - -+/* Is this type a native word size -- useful for atomic operations */ -+#ifndef __native_word -+# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -+#endif -+ - /* Compile time object size, -1 for unknown */ - #ifndef __compiletime_object_size - # define __compiletime_object_size(obj) -1 -@@ -284,7 +323,48 @@ void ftrace_likely_update(struct ftrace_ - #endif - #ifndef __compiletime_error - # define __compiletime_error(message) -+/* -+ * Sparse complains of variable sized arrays due to the temporary variable in -+ * __compiletime_assert. Unfortunately we can't just expand it out to make -+ * sparse see a constant array size without breaking compiletime_assert on old -+ * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. -+ */ -+# ifndef __CHECKER__ -+# define __compiletime_error_fallback(condition) \ -+ do { ((void)sizeof(char[1 - 2 * condition])); } while (0) -+# endif - #endif -+#ifndef __compiletime_error_fallback -+# define __compiletime_error_fallback(condition) do { } while (0) -+#endif -+ -+#define __compiletime_assert(condition, msg, prefix, suffix) \ -+ do { \ -+ bool __cond = !(condition); \ -+ extern void prefix ## suffix(void) __compiletime_error(msg); \ -+ if (__cond) \ -+ prefix ## suffix(); \ -+ __compiletime_error_fallback(__cond); \ -+ } while (0) -+ -+#define _compiletime_assert(condition, msg, prefix, suffix) \ -+ __compiletime_assert(condition, msg, prefix, suffix) -+ -+/** -+ * compiletime_assert - break build and emit msg if condition is false -+ * @condition: a compile-time constant condition to check -+ * @msg: a message to emit if condition is false -+ * -+ * In tradition of POSIX assert, this macro will break the build if the -+ * supplied condition is *false*, emitting the supplied error message if the -+ * compiler has support to do so. -+ */ -+#define compiletime_assert(condition, msg) \ -+ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) -+ -+#define compiletime_assert_atomic_type(t) \ -+ compiletime_assert(__native_word(t), \ -+ "Need native word sized stores/loads for atomicity.") - - /* - * Prevent the compiler from merging or refetching accesses. The compiler -@@ -300,4 +380,12 @@ void ftrace_likely_update(struct ftrace_ - */ - #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) - -+/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ -+#ifdef CONFIG_KPROBES -+# define __kprobes __attribute__((__section__(".kprobes.text"))) -+# define nokprobe_inline __always_inline -+#else -+# define __kprobes -+# define nokprobe_inline inline -+#endif - #endif /* __LINUX_COMPILER_H */ diff --git a/package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch b/package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch deleted file mode 100644 index 0a6219c2b..000000000 --- a/package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0a5051ce6ebd5f6fad58fd50d6922493d8447f14 Mon Sep 17 00:00:00 2001 -From: Jeroen Hofstee -Date: Thu, 18 Sep 2014 20:10:27 +0200 -Subject: compiler_gcc: prevent redefining attributes - -The libc headers on FreeBSD and likely related projects as well contain an -header file, cdefs.h which provides similiar functionality as linux/compiler.h. -It provides compiler independent defines like __weak __packed, to allow -compiling with multiple compilers which might have a different syntax for such -extension. - -Since that header file is included in multiple standard headers, like stddef.h -and stdarg.h, multiple definitions of those defines will be present if both are -included. When compiling u-boot the compiler will warn about it hundreds of -times since e.g. common.h will include both files indirectly. - -commit 7ea50d52849fe8ffa5b5b74c979b60b1045d6fc9 "compiler_gcc: do not redefine -__gnu_attributes" prevented such redefinitions, but this was undone by commit -fb8ffd7cfc68b3dc44e182356a207d784cb30b34 "compiler*.h: sync -include/linux/compiler*.h with Linux 3.16". - -Add the checks back where necessary to prevent such warnings. - -As the original patch this checkpatch warning is ignored: -"WARNING: Adding new packed members is to be done with care" - -Cc: Masahiro Yamada -Cc: Tom Rini -Signed-off-by: Jeroen Hofstee -Acked-by: Masahiro Yamada ---- - include/linux/compiler-gcc.h | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -64,8 +64,12 @@ - #endif - - #define __deprecated __attribute__((deprecated)) -+#ifndef __packed - #define __packed __attribute__((packed)) -+#endif -+#ifndef __weak - #define __weak __attribute__((weak)) -+#endif - - /* - * it doesn't make sense on ARM (currently the only user of __naked) to trace -@@ -91,8 +95,12 @@ - * would be. - * [...] - */ -+#ifndef __pure - #define __pure __attribute__((pure)) -+#endif -+#ifndef __aligned - #define __aligned(x) __attribute__((aligned(x))) -+#endif - #define __printf(a, b) __attribute__((format(printf, a, b))) - #define __scanf(a, b) __attribute__((format(scanf, a, b))) - #define noinline __attribute__((noinline)) -@@ -115,4 +123,6 @@ - */ - #define uninitialized_var(x) x = x - -+#ifndef __always_inline - #define __always_inline inline __attribute__((always_inline)) -+#endif diff --git a/package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch b/package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch deleted file mode 100644 index 686167406..000000000 --- a/package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 7 Feb 2015 22:52:40 +0100 -Subject: Add linux/compiler-gcc5.h to fix builds with gcc5 - -Add linux/compiler-gcc5/h from the kernel sources at: - -commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b -Author: Steven Noonan -Date: Sat Oct 25 15:09:42 2014 -0700 - - compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles - -Signed-off-by: Hans de Goede ---- - include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 65 insertions(+) - create mode 100644 include/linux/compiler-gcc5.h - ---- /dev/null -+++ b/include/linux/compiler-gcc5.h -@@ -0,0 +1,65 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __must_check __attribute__((warn_unused_result)) -+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -+ -+/* Mark functions as cold. gcc will assume any path leading to a call -+ to them will be unlikely. This means a lot of manual unlikely()s -+ are unnecessary now for any paths leading to the usual suspects -+ like BUG(), printk(), panic() etc. [but let's keep them for now for -+ older compilers] -+ -+ Early snapshots of gcc 4.3 don't support this and we can't detect this -+ in the preprocessor, but we can live with this because they're unreleased. -+ Maketime probing would be overkill here. -+ -+ gcc also has a __attribute__((__hot__)) to move hot functions into -+ a special section, but I don't see any sense in this right now in -+ the kernel context */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+ -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ diff --git a/package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch b/package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch deleted file mode 100644 index af4da8e69..000000000 --- a/package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch +++ /dev/null @@ -1,790 +0,0 @@ -From 9b2c282b348dfe966bbba967dc7a45ce817cce50 Mon Sep 17 00:00:00 2001 -From: Tom Rini -Date: Mon, 29 Feb 2016 11:34:15 -0500 -Subject: compiler*.h: sync include/linux/compiler*.h with Linux 4.5-rc6 - -Copy these from Linux v4.5-rc6 tag. - -This is needed so that we can keep up with newer gcc versions. Note -that we don't have the uapi/ hierarchy from the kernel so continue to -use - -Signed-off-by: Tom Rini ---- - include/linux/compiler-gcc.h | 259 ++++++++++++++++++++++++++++++++--------- - include/linux/compiler-gcc3.h | 23 ---- - include/linux/compiler-gcc4.h | 88 -------------- - include/linux/compiler-gcc5.h | 65 ----------- - include/linux/compiler-intel.h | 5 + - include/linux/compiler.h | 178 ++++++++++++++++++++++++++-- - 6 files changed, 383 insertions(+), 235 deletions(-) - delete mode 100644 include/linux/compiler-gcc3.h - delete mode 100644 include/linux/compiler-gcc4.h - delete mode 100644 include/linux/compiler-gcc5.h - ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -5,14 +5,28 @@ - /* - * Common definitions for all gcc versions go here. - */ --#define GCC_VERSION (__GNUC__ * 10000 \ -- + __GNUC_MINOR__ * 100 \ -- + __GNUC_PATCHLEVEL__) -- -+#define GCC_VERSION (__GNUC__ * 10000 \ -+ + __GNUC_MINOR__ * 100 \ -+ + __GNUC_PATCHLEVEL__) - - /* Optimization barrier */ -+ - /* The "volatile" is due to gcc bugs */ - #define barrier() __asm__ __volatile__("": : :"memory") -+/* -+ * This version is i.e. to prevent dead stores elimination on @ptr -+ * where gcc and llvm may behave differently when otherwise using -+ * normal barrier(): while gcc behavior gets along with a normal -+ * barrier(), llvm needs an explicit input variable to be assumed -+ * clobbered. The issue is as follows: while the inline asm might -+ * access any memory it wants, the compiler could have fit all of -+ * @ptr into memory registers instead, and since @ptr never escaped -+ * from that, it proofed that the inline asm wasn't touching any of -+ * it. This version works well with both compilers, i.e. we're telling -+ * the compiler that the inline asm absolutely may see the contents -+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 -+ */ -+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") - - /* - * This macro obfuscates arithmetic on a variable address so that gcc -@@ -32,58 +46,63 @@ - * the inline assembly constraint from =g to =r, in this particular - * case either is valid. - */ --#define RELOC_HIDE(ptr, off) \ -- ({ unsigned long __ptr; \ -- __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ -- (typeof(ptr)) (__ptr + (off)); }) -+#define RELOC_HIDE(ptr, off) \ -+({ \ -+ unsigned long __ptr; \ -+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ -+ (typeof(ptr)) (__ptr + (off)); \ -+}) - - /* Make the optimizer believe the variable can be manipulated arbitrarily. */ --#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) -+#define OPTIMIZER_HIDE_VAR(var) \ -+ __asm__ ("" : "=r" (var) : "0" (var)) - - #ifdef __CHECKER__ --#define __must_be_array(arr) 0 -+#define __must_be_array(a) 0 - #else - /* &a[0] degrades to a pointer: a different type from an array */ --#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) -+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) - #endif - - /* - * Force always-inline if the user requests it so via the .config, - * or if gcc is too old: - */ --#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ -+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) --# define inline inline __attribute__((always_inline)) notrace --# define __inline__ __inline__ __attribute__((always_inline)) notrace --# define __inline __inline __attribute__((always_inline)) notrace -+#define inline inline __attribute__((always_inline)) notrace -+#define __inline__ __inline__ __attribute__((always_inline)) notrace -+#define __inline __inline __attribute__((always_inline)) notrace - #else - /* A lot of inline functions can cause havoc with function tracing */ --# define inline inline notrace --# define __inline__ __inline__ notrace --# define __inline __inline notrace -+#define inline inline notrace -+#define __inline__ __inline__ notrace -+#define __inline __inline notrace - #endif - --#define __deprecated __attribute__((deprecated)) --#ifndef __packed --#define __packed __attribute__((packed)) --#endif --#ifndef __weak --#define __weak __attribute__((weak)) --#endif -+#define __always_inline inline __attribute__((always_inline)) -+#define noinline __attribute__((noinline)) -+ -+#define __deprecated __attribute__((deprecated)) -+#define __packed __attribute__((packed)) -+#define __weak __attribute__((weak)) -+#define __alias(symbol) __attribute__((alias(#symbol))) - - /* -- * it doesn't make sense on ARM (currently the only user of __naked) to trace -- * naked functions because then mcount is called without stack and frame pointer -- * being set up and there is no chance to restore the lr register to the value -- * before mcount was called. -+ * it doesn't make sense on ARM (currently the only user of __naked) -+ * to trace naked functions because then mcount is called without -+ * stack and frame pointer being set up and there is no chance to -+ * restore the lr register to the value before mcount was called. -+ * -+ * The asm() bodies of naked functions often depend on standard calling -+ * conventions, therefore they must be noinline and noclone. - * -- * The asm() bodies of naked functions often depend on standard calling conventions, -- * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce -- * this, so we must do so ourselves. See GCC PR44290. -+ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. -+ * See GCC PR44290. - */ --#define __naked __attribute__((naked)) noinline __noclone notrace -+#define __naked __attribute__((naked)) noinline __noclone notrace - --#define __noreturn __attribute__((noreturn)) -+#define __noreturn __attribute__((noreturn)) - - /* - * From the GCC manual: -@@ -95,34 +114,170 @@ - * would be. - * [...] - */ --#ifndef __pure --#define __pure __attribute__((pure)) -+#define __pure __attribute__((pure)) -+#define __aligned(x) __attribute__((aligned(x))) -+#define __printf(a, b) __attribute__((format(printf, a, b))) -+#define __scanf(a, b) __attribute__((format(scanf, a, b))) -+#define __attribute_const__ __attribute__((__const__)) -+#define __maybe_unused __attribute__((unused)) -+#define __always_unused __attribute__((unused)) -+ -+/* gcc version specific checks */ -+ -+#if GCC_VERSION < 30200 -+# error Sorry, your compiler is too old - please upgrade it. -+#endif -+ -+#if GCC_VERSION < 30300 -+# define __used __attribute__((__unused__)) -+#else -+# define __used __attribute__((__used__)) -+#endif -+ -+#ifdef CONFIG_GCOV_KERNEL -+# if GCC_VERSION < 30400 -+# error "GCOV profiling support for gcc versions below 3.4 not included" -+# endif /* __GNUC_MINOR__ */ -+#endif /* CONFIG_GCOV_KERNEL */ -+ -+#if GCC_VERSION >= 30400 -+#define __must_check __attribute__((warn_unused_result)) - #endif --#ifndef __aligned --#define __aligned(x) __attribute__((aligned(x))) -+ -+#if GCC_VERSION >= 40000 -+ -+/* GCC 4.1.[01] miscompiles __weak */ -+#ifdef __KERNEL__ -+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 -+# error Your version of gcc miscompiles the __weak directive -+# endif -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __compiler_offsetof(a, b) \ -+ __builtin_offsetof(a, b) -+ -+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) - #endif --#define __printf(a, b) __attribute__((format(printf, a, b))) --#define __scanf(a, b) __attribute__((format(scanf, a, b))) --#define noinline __attribute__((noinline)) --#define __attribute_const__ __attribute__((__const__)) --#define __maybe_unused __attribute__((unused)) --#define __always_unused __attribute__((unused)) -- --#define __gcc_header(x) #x --#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) --#define gcc_header(x) _gcc_header(x) --#include gcc_header(__GNUC__) -+ -+#if GCC_VERSION >= 40300 -+/* Mark functions as cold. gcc will assume any path leading to a call -+ * to them will be unlikely. This means a lot of manual unlikely()s -+ * are unnecessary now for any paths leading to the usual suspects -+ * like BUG(), printk(), panic() etc. [but let's keep them for now for -+ * older compilers] -+ * -+ * Early snapshots of gcc 4.3 don't support this and we can't detect this -+ * in the preprocessor, but we can live with this because they're unreleased. -+ * Maketime probing would be overkill here. -+ * -+ * gcc also has a __attribute__((__hot__)) to move hot functions into -+ * a special section, but I don't see any sense in this right now in -+ * the kernel context -+ */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+#endif /* GCC_VERSION >= 40300 */ -+ -+#if GCC_VERSION >= 40500 -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+#endif /* GCC_VERSION >= 40500 */ -+ -+#if GCC_VERSION >= 40600 -+/* -+ * When used with Link Time Optimization, gcc can optimize away C functions or -+ * variables which are referenced only from assembly code. __visible tells the -+ * optimizer that something else uses this function or variable, thus preventing -+ * this. -+ */ -+#define __visible __attribute__((externally_visible)) -+#endif -+ -+ -+#if GCC_VERSION >= 40900 && !defined(__CHECKER__) -+/* -+ * __assume_aligned(n, k): Tell the optimizer that the returned -+ * pointer can be assumed to be k modulo n. The second argument is -+ * optional (default 0), so we use a variadic macro to make the -+ * shorthand. -+ * -+ * Beware: Do not apply this to functions which may return -+ * ERR_PTRs. Also, it is probably unwise to apply it to functions -+ * returning extra information in the low bits (but in that case the -+ * compiler should see some alignment anyway, when the return value is -+ * massaged by 'flags = ptr & 3; ptr &= ~3;'). -+ */ -+#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) -+#endif -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#if GCC_VERSION >= 40400 -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#endif -+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -+ -+#if GCC_VERSION >= 50000 -+#define KASAN_ABI_VERSION 4 -+#elif GCC_VERSION >= 40902 -+#define KASAN_ABI_VERSION 3 -+#endif -+ -+#if GCC_VERSION >= 40902 -+/* -+ * Tell the compiler that address safety instrumentation (KASAN) -+ * should not be applied to that function. -+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 -+ */ -+#define __no_sanitize_address __attribute__((no_sanitize_address)) -+#endif -+ -+#endif /* gcc version >= 40000 specific checks */ - - #if !defined(__noclone) - #define __noclone /* not needed */ - #endif - -+#if !defined(__no_sanitize_address) -+#define __no_sanitize_address -+#endif -+ - /* - * A trick to suppress uninitialized variable warning without generating any - * code - */ - #define uninitialized_var(x) x = x -- --#ifndef __always_inline --#define __always_inline inline __attribute__((always_inline)) --#endif ---- a/include/linux/compiler-gcc3.h -+++ /dev/null -@@ -1,23 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --#if GCC_VERSION < 30200 --# error Sorry, your compiler is too old - please upgrade it. --#endif -- --#if GCC_VERSION >= 30300 --# define __used __attribute__((__used__)) --#else --# define __used __attribute__((__unused__)) --#endif -- --#if GCC_VERSION >= 30400 --#define __must_check __attribute__((warn_unused_result)) --#endif -- --#ifdef CONFIG_GCOV_KERNEL --# if GCC_VERSION < 30400 --# error "GCOV profiling support for gcc versions below 3.4 not included" --# endif /* __GNUC_MINOR__ */ --#endif /* CONFIG_GCOV_KERNEL */ ---- a/include/linux/compiler-gcc4.h -+++ /dev/null -@@ -1,88 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --/* GCC 4.1.[01] miscompiles __weak */ --#ifdef __KERNEL__ --# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 --# error Your version of gcc miscompiles the __weak directive --# endif --#endif -- --#define __used __attribute__((__used__)) --#define __must_check __attribute__((warn_unused_result)) --#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) -- --#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 --# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) --#endif -- --#if GCC_VERSION >= 40300 --/* Mark functions as cold. gcc will assume any path leading to a call -- to them will be unlikely. This means a lot of manual unlikely()s -- are unnecessary now for any paths leading to the usual suspects -- like BUG(), printk(), panic() etc. [but let's keep them for now for -- older compilers] -- -- Early snapshots of gcc 4.3 don't support this and we can't detect this -- in the preprocessor, but we can live with this because they're unreleased. -- Maketime probing would be overkill here. -- -- gcc also has a __attribute__((__hot__)) to move hot functions into -- a special section, but I don't see any sense in this right now in -- the kernel context */ --#define __cold __attribute__((__cold__)) -- --#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -- --#ifndef __CHECKER__ --# define __compiletime_warning(message) __attribute__((warning(message))) --# define __compiletime_error(message) __attribute__((error(message))) --#endif /* __CHECKER__ */ --#endif /* GCC_VERSION >= 40300 */ -- --#if GCC_VERSION >= 40500 --/* -- * Mark a position in code as unreachable. This can be used to -- * suppress control flow warnings after asm blocks that transfer -- * control elsewhere. -- * -- * Early snapshots of gcc 4.5 don't support this and we can't detect -- * this in the preprocessor, but we can live with this because they're -- * unreleased. Really, we need to have autoconf for the kernel. -- */ --#define unreachable() __builtin_unreachable() -- --/* Mark a function definition as prohibited from being cloned. */ --#define __noclone __attribute__((__noclone__)) -- --#endif /* GCC_VERSION >= 40500 */ -- --#if GCC_VERSION >= 40600 --/* -- * Tell the optimizer that something else uses this function or variable. -- */ --#define __visible __attribute__((externally_visible)) --#endif -- --/* -- * GCC 'asm goto' miscompiles certain code sequences: -- * -- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -- * -- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -- * Fixed in GCC 4.8.2 and later versions. -- * -- * (asm goto is automatically volatile - the naming reflects this.) -- */ --#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- --#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP --#if GCC_VERSION >= 40400 --#define __HAVE_BUILTIN_BSWAP32__ --#define __HAVE_BUILTIN_BSWAP64__ --#endif --#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) --#define __HAVE_BUILTIN_BSWAP16__ --#endif --#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ---- a/include/linux/compiler-gcc5.h -+++ /dev/null -@@ -1,65 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --#define __used __attribute__((__used__)) --#define __must_check __attribute__((warn_unused_result)) --#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -- --/* Mark functions as cold. gcc will assume any path leading to a call -- to them will be unlikely. This means a lot of manual unlikely()s -- are unnecessary now for any paths leading to the usual suspects -- like BUG(), printk(), panic() etc. [but let's keep them for now for -- older compilers] -- -- Early snapshots of gcc 4.3 don't support this and we can't detect this -- in the preprocessor, but we can live with this because they're unreleased. -- Maketime probing would be overkill here. -- -- gcc also has a __attribute__((__hot__)) to move hot functions into -- a special section, but I don't see any sense in this right now in -- the kernel context */ --#define __cold __attribute__((__cold__)) -- --#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -- --#ifndef __CHECKER__ --# define __compiletime_warning(message) __attribute__((warning(message))) --# define __compiletime_error(message) __attribute__((error(message))) --#endif /* __CHECKER__ */ -- --/* -- * Mark a position in code as unreachable. This can be used to -- * suppress control flow warnings after asm blocks that transfer -- * control elsewhere. -- * -- * Early snapshots of gcc 4.5 don't support this and we can't detect -- * this in the preprocessor, but we can live with this because they're -- * unreleased. Really, we need to have autoconf for the kernel. -- */ --#define unreachable() __builtin_unreachable() -- --/* Mark a function definition as prohibited from being cloned. */ --#define __noclone __attribute__((__noclone__)) -- --/* -- * Tell the optimizer that something else uses this function or variable. -- */ --#define __visible __attribute__((externally_visible)) -- --/* -- * GCC 'asm goto' miscompiles certain code sequences: -- * -- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -- * -- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -- * -- * (asm goto is automatically volatile - the naming reflects this.) -- */ --#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- --#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP --#define __HAVE_BUILTIN_BSWAP32__ --#define __HAVE_BUILTIN_BSWAP64__ --#define __HAVE_BUILTIN_BSWAP16__ --#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ---- a/include/linux/compiler-intel.h -+++ b/include/linux/compiler-intel.h -@@ -13,9 +13,14 @@ - /* Intel ECC compiler doesn't support gcc specific asm stmts. - * It uses intrinsics to do the equivalent things. - */ -+#undef barrier -+#undef barrier_data - #undef RELOC_HIDE - #undef OPTIMIZER_HIDE_VAR - -+#define barrier() __memory_barrier() -+#define barrier_data(ptr) barrier() -+ - #define RELOC_HIDE(ptr, off) \ - ({ unsigned long __ptr; \ - __ptr = (unsigned long) (ptr); \ ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -17,6 +17,7 @@ - # define __release(x) __context__(x,-1) - # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) - # define __percpu __attribute__((noderef, address_space(3))) -+# define __pmem __attribute__((noderef, address_space(5))) - #ifdef CONFIG_SPARSE_RCU_POINTER - # define __rcu __attribute__((noderef, address_space(4))) - #else -@@ -42,6 +43,7 @@ extern void __chk_io_ptr(const volatile - # define __cond_lock(x,c) (c) - # define __percpu - # define __rcu -+# define __pmem - #endif - - /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -@@ -54,7 +56,11 @@ extern void __chk_io_ptr(const volatile - #include - #endif - -+#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) -+#define notrace __attribute__((hotpatch(0,0))) -+#else - #define notrace __attribute__((no_instrument_function)) -+#endif - - /* Intel compiler defines __GNUC__. So we will overwrite implementations - * coming from above header files here -@@ -138,7 +144,7 @@ void ftrace_likely_update(struct ftrace_ - */ - #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) - #define __trace_if(cond) \ -- if (__builtin_constant_p((cond)) ? !!(cond) : \ -+ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ - ({ \ - int ______r; \ - static struct ftrace_branch_data \ -@@ -165,6 +171,10 @@ void ftrace_likely_update(struct ftrace_ - # define barrier() __memory_barrier() - #endif - -+#ifndef barrier_data -+# define barrier_data(ptr) barrier() -+#endif -+ - /* Unreachable code */ - #ifndef unreachable - # define unreachable() do { } while (1) -@@ -186,6 +196,126 @@ void ftrace_likely_update(struct ftrace_ - # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) - #endif - -+#include -+ -+#define __READ_ONCE_SIZE \ -+({ \ -+ switch (size) { \ -+ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ -+ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ -+ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ -+ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ -+ default: \ -+ barrier(); \ -+ __builtin_memcpy((void *)res, (const void *)p, size); \ -+ barrier(); \ -+ } \ -+}) -+ -+static __always_inline -+void __read_once_size(const volatile void *p, void *res, int size) -+{ -+ __READ_ONCE_SIZE; -+} -+ -+#ifdef CONFIG_KASAN -+/* -+ * This function is not 'inline' because __no_sanitize_address confilcts -+ * with inlining. Attempt to inline it may cause a build failure. -+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 -+ * '__maybe_unused' allows us to avoid defined-but-not-used warnings. -+ */ -+static __no_sanitize_address __maybe_unused -+void __read_once_size_nocheck(const volatile void *p, void *res, int size) -+{ -+ __READ_ONCE_SIZE; -+} -+#else -+static __always_inline -+void __read_once_size_nocheck(const volatile void *p, void *res, int size) -+{ -+ __READ_ONCE_SIZE; -+} -+#endif -+ -+static __always_inline void __write_once_size(volatile void *p, void *res, int size) -+{ -+ switch (size) { -+ case 1: *(volatile __u8 *)p = *(__u8 *)res; break; -+ case 2: *(volatile __u16 *)p = *(__u16 *)res; break; -+ case 4: *(volatile __u32 *)p = *(__u32 *)res; break; -+ case 8: *(volatile __u64 *)p = *(__u64 *)res; break; -+ default: -+ barrier(); -+ __builtin_memcpy((void *)p, (const void *)res, size); -+ barrier(); -+ } -+} -+ -+/* -+ * Prevent the compiler from merging or refetching reads or writes. The -+ * compiler is also forbidden from reordering successive instances of -+ * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the -+ * compiler is aware of some particular ordering. One way to make the -+ * compiler aware of ordering is to put the two invocations of READ_ONCE, -+ * WRITE_ONCE or ACCESS_ONCE() in different C statements. -+ * -+ * In contrast to ACCESS_ONCE these two macros will also work on aggregate -+ * data types like structs or unions. If the size of the accessed data -+ * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) -+ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a -+ * compile-time warning. -+ * -+ * Their two major use cases are: (1) Mediating communication between -+ * process-level code and irq/NMI handlers, all running on the same CPU, -+ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise -+ * mutilate accesses that either do not require ordering or that interact -+ * with an explicit memory barrier or atomic instruction that provides the -+ * required ordering. -+ */ -+ -+#define __READ_ONCE(x, check) \ -+({ \ -+ union { typeof(x) __val; char __c[1]; } __u; \ -+ if (check) \ -+ __read_once_size(&(x), __u.__c, sizeof(x)); \ -+ else \ -+ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ -+ __u.__val; \ -+}) -+#define READ_ONCE(x) __READ_ONCE(x, 1) -+ -+/* -+ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need -+ * to hide memory access from KASAN. -+ */ -+#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0) -+ -+#define WRITE_ONCE(x, val) \ -+({ \ -+ union { typeof(x) __val; char __c[1]; } __u = \ -+ { .__val = (__force typeof(x)) (val) }; \ -+ __write_once_size(&(x), __u.__c, sizeof(x)); \ -+ __u.__val; \ -+}) -+ -+/** -+ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering -+ * @cond: boolean expression to wait for -+ * -+ * Equivalent to using smp_load_acquire() on the condition variable but employs -+ * the control dependency of the wait to reduce the barrier on many platforms. -+ * -+ * The control dependency provides a LOAD->STORE order, the additional RMB -+ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order, -+ * aka. ACQUIRE. -+ */ -+#define smp_cond_acquire(cond) do { \ -+ while (!(cond)) \ -+ cpu_relax(); \ -+ smp_rmb(); /* ctrl + rmb := acquire */ \ -+} while (0) -+ - #endif /* __KERNEL__ */ - - #endif /* __ASSEMBLY__ */ -@@ -304,6 +434,14 @@ void ftrace_likely_update(struct ftrace_ - #define __visible - #endif - -+/* -+ * Assume alignment of return value. -+ */ -+#ifndef __assume_aligned -+#define __assume_aligned(a, ...) -+#endif -+ -+ - /* Are two types/vars the same type (ignoring qualifiers)? */ - #ifndef __same_type - # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) -@@ -311,7 +449,7 @@ void ftrace_likely_update(struct ftrace_ - - /* Is this type a native word size -- useful for atomic operations */ - #ifndef __native_word --# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -+# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) - #endif - - /* Compile time object size, -1 for unknown */ -@@ -373,12 +511,38 @@ void ftrace_likely_update(struct ftrace_ - * to make the compiler aware of ordering is to put the two invocations of - * ACCESS_ONCE() in different C statements. - * -- * This macro does absolutely -nothing- to prevent the CPU from reordering, -- * merging, or refetching absolutely anything at any time. Its main intended -- * use is to mediate communication between process-level code and irq/NMI -- * handlers, all running on the same CPU. -+ * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE -+ * on a union member will work as long as the size of the member matches the -+ * size of the union and the size is smaller than word size. -+ * -+ * The major use cases of ACCESS_ONCE used to be (1) Mediating communication -+ * between process-level code and irq/NMI handlers, all running on the same CPU, -+ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise -+ * mutilate accesses that either do not require ordering or that interact -+ * with an explicit memory barrier or atomic instruction that provides the -+ * required ordering. -+ * -+ * If possible use READ_ONCE()/WRITE_ONCE() instead. - */ --#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) -+#define __ACCESS_ONCE(x) ({ \ -+ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ -+ (volatile typeof(x) *)&(x); }) -+#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) -+ -+/** -+ * lockless_dereference() - safely load a pointer for later dereference -+ * @p: The pointer to load -+ * -+ * Similar to rcu_dereference(), but for situations where the pointed-to -+ * object's lifetime is managed by something other than RCU. That -+ * "something other" might be reference counting or simple immortality. -+ */ -+#define lockless_dereference(p) \ -+({ \ -+ typeof(p) _________p1 = READ_ONCE(p); \ -+ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ -+ (_________p1); \ -+}) - - /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ - #ifdef CONFIG_KPROBES diff --git a/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch b/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch new file mode 100644 index 000000000..0883eb7b2 --- /dev/null +++ b/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch @@ -0,0 +1,26 @@ +--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c ++++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c +@@ -334,6 +334,12 @@ int board_init(void) + return ret; + } + ++void board_boot_order(u32 *spl_boot_list) ++{ ++ spl_boot_list[0] = spl_boot_device(); ++ spl_boot_list[1] = BOOT_DEVICE_MMC1; ++} ++ + static bool is_hummingboard(void) + { + int val1, val2; +--- a/arch/arm/mach-imx/spl.c ++++ b/arch/arm/mach-imx/spl.c +@@ -136,7 +136,7 @@ int g_dnl_bind_fixup(struct usb_device_d + /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ + u32 spl_boot_mode(const u32 boot_device) + { +- switch (spl_boot_device()) { ++ switch (boot_device) { + /* for MMC return either RAW or FAT mode */ + case BOOT_DEVICE_MMC1: + case BOOT_DEVICE_MMC2: diff --git a/package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch b/package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch deleted file mode 100644 index 7bef453cb..000000000 --- a/package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- a/include/configs/wandboard.h -+++ b/include/configs/wandboard.h -@@ -49,7 +49,7 @@ - #define CONFIG_CMD_BMODE - #define CONFIG_CMD_SETEXPR - --#define CONFIG_BOOTDELAY 5 -+#define CONFIG_BOOTDELAY 3 - - #define CONFIG_SYS_MEMTEST_START 0x10000000 - #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) -@@ -102,13 +102,15 @@ - - #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) - #define CONFIG_DEFAULT_FDT_FILE "imx6dl-wandboard.dtb" -+#define CONFIG_OWRT_NAME "openwrt-imx6-imx6dl-wandboard-fit-uImage.itb" - #elif defined(CONFIG_MX6Q) - #define CONFIG_DEFAULT_FDT_FILE "imx6q-wandboard.dtb" -+#define CONFIG_OWRT_NAME "openwrt-imx6-imx6q-wandboard-fit-uImage.itb" - #endif - - #define CONFIG_EXTRA_ENV_SETTINGS \ - "script=boot.scr\0" \ -- "image=zImage\0" \ -+ "image=" CONFIG_OWRT_NAME "\0" \ - "console=ttymxc0\0" \ - "splashpos=m,m\0" \ - "fdt_high=0xffffffff\0" \ -@@ -137,11 +139,11 @@ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=${mmcroot}\0" \ - "loadbootscript=" \ -- "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source\0" \ -- "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ -- "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ -+ "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ -+ "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -@@ -155,31 +157,7 @@ - "fi; " \ - "fi; " \ - "else " \ -- "bootz; " \ -- "fi;\0" \ -- "netargs=setenv bootargs console=${console},${baudrate} " \ -- "root=/dev/nfs " \ -- "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ -- "netboot=echo Booting from net ...; " \ -- "run netargs; " \ -- "if test ${ip_dyn} = yes; then " \ -- "setenv get_cmd dhcp; " \ -- "else " \ -- "setenv get_cmd tftp; " \ -- "fi; " \ -- "${get_cmd} ${image}; " \ -- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -- "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -- "bootz ${loadaddr} - ${fdt_addr}; " \ -- "else " \ -- "if test ${boot_fdt} = try; then " \ -- "bootz; " \ -- "else " \ -- "echo WARN: Cannot load the DT; " \ -- "fi; " \ -- "fi; " \ -- "else " \ -- "bootz; " \ -+ "bootm; " \ - "fi;\0" - - #define CONFIG_BOOTCOMMAND \ -@@ -189,10 +167,10 @@ - "else " \ - "if run loadimage; then " \ - "run mmcboot; " \ -- "else run netboot; " \ -+ "else echo WARN: Can not boot the image; " \ - "fi; " \ - "fi; " \ -- "else run netboot; fi" -+ "fi" - - /* Miscellaneous configurable options */ - #define CONFIG_SYS_LONGHELP diff --git a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch index f90842cad..264c16074 100644 --- a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch @@ -28,20 +28,20 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in @@ -56,6 +56,9 @@ config TARGET_GOFLEXHOME config TARGET_NAS220 bool "BlackArmor NAS220" - + +config TARGET_NSA310 + bool "Zyxel NSA310 Board" + config TARGET_NSA310S bool "Zyxel NSA310S" - + @@ -80,6 +83,7 @@ source "board/raidsonic/ib62x0/Kconfig" source "board/Seagate/dockstar/Kconfig" source "board/Seagate/goflexhome/Kconfig" source "board/Seagate/nas220/Kconfig" +source "board/zyxel/nsa310/Kconfig" source "board/zyxel/nsa310s/Kconfig" - + endif --- /dev/null +++ b/board/zyxel/nsa310/Kconfig diff --git a/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch index 271442213..0ce3fe02e 100644 --- a/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch @@ -3,19 +3,19 @@ @@ -62,6 +62,9 @@ config TARGET_NSA310 config TARGET_NSA310S bool "Zyxel NSA310S" - + +config TARGET_NSA325 + bool "Zyxel NSA325 board" + endchoice - + config SYS_SOC @@ -85,5 +88,6 @@ source "board/Seagate/goflexhome/Kconfig source "board/Seagate/nas220/Kconfig" source "board/zyxel/nsa310/Kconfig" source "board/zyxel/nsa310s/Kconfig" +source "board/zyxel/nsa325/Kconfig" - + endif --- /dev/null +++ b/board/zyxel/nsa325/Kconfig diff --git a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch index 1508a98c1..568c8bf5f 100644 --- a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch +++ b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch @@ -3,13 +3,13 @@ @@ -25,6 +25,9 @@ config TARGET_LSXL config TARGET_POGO_E02 bool "pogo_e02 Board" - + +config TARGET_POGOPLUGV4 + bool "Pogoplug V4 Board" + config TARGET_DNS325 bool "dns325 Board" - + @@ -77,6 +80,7 @@ source "board/Marvell/guruplug/Kconfig" source "board/Marvell/sheevaplug/Kconfig" source "board/buffalo/lsxl/Kconfig" @@ -22,11 +22,11 @@ +++ b/arch/arm/mach-kirkwood/include/mach/kw88f6192.h @@ -16,6 +16,6 @@ #define KW_REGS_PHY_BASE KW88F6192_REGS_PHYS_BASE - + /* TCLK Core Clock defination */ -#define CONFIG_SYS_TCLK 166000000 /* 166MHz */ +#define CONFIG_SYS_TCLK 166666667 /* 166MHz */ - + #endif /* _CONFIG_KW88F6192_H */ --- a/arch/arm/mach-kirkwood/include/mach/mpp.h +++ b/arch/arm/mach-kirkwood/include/mach/mpp.h @@ -35,12 +35,12 @@ #define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1 ) #define MPP33_GE1_13 MPP( 33, 0x3, 0, 0, 0, 1, 1, 1 ) +#define MPP33_SATA1_ACTn MPP( 33, 0x5, 0, 1, 0, 1, 1, 1 ) - + #define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1 ) #define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1 ) #define MPP34_GE1_14 MPP( 34, 0x3, 0, 0, 0, 1, 1, 1 ) +#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 1, 0, 1, 1, 1 ) - + #define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1 ) #define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1 ) --- /dev/null @@ -619,7 +619,7 @@ obj-$(CONFIG_MMC_SDHCI_XENON) += xenon_sdhci.o obj-$(CONFIG_MMC_SDHCI_ZYNQ) += zynq_sdhci.o +obj-$(CONFIG_KIRKWOOD_MMC) += kirkwood_mmc.o - + obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o --- /dev/null @@ -1112,7 +1112,7 @@ @@ -117,4 +117,10 @@ #define CONFIG_MTD_PARTITIONS #endif - + +/* + * Kirkwood MMC + */ diff --git a/package/boot/uboot-kirkwood/patches/110-dockstar.patch b/package/boot/uboot-kirkwood/patches/110-dockstar.patch index e67a888a4..ff2c33877 100644 --- a/package/boot/uboot-kirkwood/patches/110-dockstar.patch +++ b/package/boot/uboot-kirkwood/patches/110-dockstar.patch @@ -5,7 +5,7 @@ #define CONFIG_KW88F6281 1 /* SOC Name */ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ +#define CONFIG_SYS_MVFS - + /* * mv-common.h should be defined after CMD configs since it used them @@ -36,27 +37,22 @@ @@ -15,7 +15,7 @@ -#define CONFIG_ENV_ADDR 0x80000 -#define CONFIG_ENV_OFFSET 0x80000 /* env starts here */ +#define CONFIG_ENV_OFFSET 0xe0000 /* env starts here */ - + /* * Default environment variables */ @@ -29,7 +29,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ - "console=console=ttyS0,115200\0" \ - "mtdids=nand0=orion_nand\0" \ @@ -41,7 +41,7 @@ + "mtdids=nand0=orion_nand\0" \ + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/dockstar_defconfig diff --git a/package/boot/uboot-kirkwood/patches/120-iconnect.patch b/package/boot/uboot-kirkwood/patches/120-iconnect.patch index 7ff721218..114aa1559 100644 --- a/package/boot/uboot-kirkwood/patches/120-iconnect.patch +++ b/package/boot/uboot-kirkwood/patches/120-iconnect.patch @@ -6,7 +6,7 @@ #define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_ENV_OFFSET 0x80000 +#define CONFIG_ENV_OFFSET 0xe0000 - + /* * Default environment variables */ @@ -18,7 +18,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -27,7 +27,7 @@ - "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet driver configuration --- a/configs/iconnect_defconfig diff --git a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch index fcb0a88a0..269cf7336 100644 --- a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch +++ b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch @@ -14,7 +14,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -24,7 +24,7 @@ - "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet driver configuration --- a/configs/ib62x0_defconfig diff --git a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch index 93adad6aa..26217fadd 100644 --- a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch +++ b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch @@ -2,11 +2,11 @@ +++ b/include/configs/pogo_e02.h @@ -44,23 +44,23 @@ #endif - + #define CONFIG_ENV_SIZE 0x20000 /* 128k */ -#define CONFIG_ENV_OFFSET 0x60000 /* env starts here */ +#define CONFIG_ENV_OFFSET 0xe0000 /* env starts here */ - + /* * Default environment variables */ @@ -19,7 +19,7 @@ + "ubifsmount ubi:rootfs; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ - "mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage)," \ - "32M(rootfs),-(data)\0"\ @@ -31,7 +31,7 @@ + "mtdids=nand0=orion_nand\0" \ + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/pogo_e02_defconfig diff --git a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch index 540c0f507..2104b67b5 100644 --- a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch +++ b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch @@ -10,7 +10,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -19,7 +19,7 @@ - "bootargs_root=ubi.mtd=root root=ubi0:root rootfstype=ubifs ro\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/goflexhome_defconfig diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile index 0d5260d12..69f234d18 100644 --- a/package/boot/uboot-omap/Makefile +++ b/package/boot/uboot-omap/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_VERSION:=2017.01 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_HASH:=6c425175f93a4bcf2ec9faf5658ef279633dbd7856a293d95bd1ff516528ecf2 @@ -24,17 +24,17 @@ endef define U-Boot/omap4_panda NAME:=Pandaboard - BUILD_DEVICES:=omap4-panda + BUILD_DEVICES:=ti_omap4-panda endef define U-Boot/am335x_boneblack NAME:=TI AM335x BeagleBone Black - BUILD_DEVICES:=am335x-boneblack + BUILD_DEVICES:=ti_am335x-bone-black endef define U-Boot/am335x_evm NAME:=AM335x EVM - BUILD_DEVICES:=am335x-evm + BUILD_DEVICES:=ti_am335x-evm endef define U-Boot/omap3_overo @@ -43,7 +43,7 @@ endef define U-Boot/omap3_beagle NAME:=BeagleBoard - BUILD_DEVICES:=omap3-beagle + BUILD_DEVICES:=ti_omap3-beagle endef UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle am335x_boneblack diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 5257a41ad..ce5edfc1b 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2017.11 +PKG_VERSION:=2018.05 -PKG_HASH:=6a018fd3caf58f3dcfa23ee989a82bd35df03af71872b9dca8c6d758a0d26c05 +PKG_HASH:=4da13c2a6139a78cc08608f21fd4741db27eda336cfad7ab8264fda923b9c048 PKG_MAINTAINER:=Zoltan HERPAI @@ -207,6 +207,14 @@ define U-Boot/orangepi_zero_plus UENV:=a64 endef +define U-Boot/orangepi_pc2 + BUILD_SUBTARGET:=cortexa53 + NAME:=Xunlong Orange Pi PC2 + BUILD_DEVICES:=sun50i-h5-orangepi-pc2 + DEPENDS:=+PACKAGE_u-boot-orangepi_pc2:arm-trusted-firmware-sunxi + UENV:=a64 +endef + UBOOT_TARGETS := \ A10-OLinuXino-Lime \ A13-OLinuXino \ @@ -233,6 +241,7 @@ UBOOT_TARGETS := \ orangepi_pc \ orangepi_plus \ orangepi_2 \ + orangepi_pc2 \ pangolin \ pine64_plus \ sopine_baseboard \ @@ -245,11 +254,7 @@ UBOOT_MAKE_FLAGS += \ define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) -ifeq ($(SUBTARGET),cortexa53) - cat $(PKG_BUILD_DIR)/spl/sunxi-spl.bin $(PKG_BUILD_DIR)/u-boot.itb > $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot-with-spl.bin -else $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot-with-spl.bin -endif mkimage -C none -A arm -T script -d uEnv-$(UENV).txt \ $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.scr endef diff --git a/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch b/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch index 4458d514c..6501cca6d 100644 --- a/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch +++ b/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch @@ -1,6 +1,6 @@ --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -261,6 +261,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \ +@@ -290,6 +290,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \ sun6i-a31-m9.dtb \ sun6i-a31-mele-a1000g-quad.dtb \ sun6i-a31-mixtile-loftq.dtb \ @@ -360,7 +360,7 @@ +CONFIG_SUNXI_SPI=y --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -752,6 +752,14 @@ config VIDEO_LCD_PANEL_I2C_SCL +@@ -836,6 +836,14 @@ config VIDEO_LCD_PANEL_I2C_SCL Set the SCL pin for the LCD i2c interface. This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. diff --git a/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch b/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch index 679649c3f..6dbcb1071 100644 --- a/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch +++ b/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch @@ -2,7 +2,7 @@ --- a/configs/A20-OLinuXino-Lime2_defconfig +++ b/configs/A20-OLinuXino-Lime2_defconfig -@@ -24,6 +24,7 @@ CONFIG_DFU_RAM=y +@@ -22,6 +22,7 @@ CONFIG_DFU_RAM=y CONFIG_ETH_DESIGNWARE=y CONFIG_RGMII=y CONFIG_SUN7I_GMAC=y diff --git a/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch b/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch index cf41c4f1f..bcf2faa18 100644 --- a/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch +++ b/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch @@ -14,7 +14,7 @@ More specifically, the following settings are now used: --- a/arch/arm/mach-sunxi/clock_sun6i.c +++ b/arch/arm/mach-sunxi/clock_sun6i.c -@@ -113,11 +113,12 @@ void clock_set_pll1(unsigned int clk) +@@ -112,11 +112,12 @@ void clock_set_pll1(unsigned int clk) struct sunxi_ccm_reg * const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; const int p = 0; diff --git a/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch b/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch index a8e03e2fb..b62209e1d 100644 --- a/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch +++ b/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch @@ -18,7 +18,7 @@ required setting for the PLL LDO is 1.37v as per the A31 manual. --- a/arch/arm/mach-sunxi/clock_sun6i.c +++ b/arch/arm/mach-sunxi/clock_sun6i.c -@@ -26,13 +26,26 @@ void clock_init_safe(void) +@@ -25,13 +25,26 @@ void clock_init_safe(void) struct sunxi_prcm_reg * const prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE; @@ -49,7 +49,7 @@ required setting for the PLL LDO is 1.37v as per the A31 manual. #if defined(CONFIG_MACH_SUN8I_R40) || defined(CONFIG_MACH_SUN50I) --- a/arch/arm/include/asm/arch-sunxi/prcm.h +++ b/arch/arm/include/asm/arch-sunxi/prcm.h -@@ -111,13 +111,13 @@ +@@ -110,13 +110,13 @@ #define PRCM_PLL_CTRL_LDO_OUT_MASK \ __PRCM_PLL_CTRL_LDO_OUT(0x7) /* When using the low voltage 20 mV steps, and high voltage 30 mV steps */ diff --git a/package/boot/uboot-sunxi/patches/100-sun6i-alternate-on-UART2.patch b/package/boot/uboot-sunxi/patches/100-sun6i-alternate-on-UART2.patch index 8bab22051..b3d9ba040 100644 --- a/package/boot/uboot-sunxi/patches/100-sun6i-alternate-on-UART2.patch +++ b/package/boot/uboot-sunxi/patches/100-sun6i-alternate-on-UART2.patch @@ -6,7 +6,7 @@ Subject: sun6i: define alternate-function for UART2 on GPG --- a/arch/arm/include/asm/arch-sunxi/gpio.h +++ b/arch/arm/include/asm/arch-sunxi/gpio.h -@@ -186,6 +186,7 @@ enum sunxi_gpio_number { +@@ -185,6 +185,7 @@ enum sunxi_gpio_number { #define SUN6I_GPG_SDC1 2 #define SUN8I_GPG_SDC1 2 #define SUN6I_GPG_TWI3 2 diff --git a/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch b/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch index c1ba07eec..e6ff8ce28 100644 --- a/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch +++ b/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch @@ -6,7 +6,7 @@ Subject: ARM: sun6i: Support console on UART2 (GPG6/GPG7) --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c -@@ -124,6 +124,10 @@ static int gpio_init(void) +@@ -123,6 +123,10 @@ static int gpio_init(void) sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1); sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1); sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP); diff --git a/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch b/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch index 7a0ff9744..083933e06 100644 --- a/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch +++ b/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch @@ -6,7 +6,7 @@ Subject: ARM: sunxi: Make CONS_INDEX configurable --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -416,6 +416,14 @@ config SYS_BOARD +@@ -500,6 +500,14 @@ config SYS_BOARD config SYS_SOC default "sunxi" diff --git a/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch b/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch index 249157958..2c63ad322 100644 --- a/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch +++ b/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch @@ -17,7 +17,7 @@ Cc: Simon Glass --- a/tools/fit_image.c +++ b/tools/fit_image.c -@@ -650,9 +650,14 @@ static int fit_handle_file(struct image_ +@@ -649,9 +649,14 @@ static int fit_handle_file(struct image_ } *cmd = '\0'; } else if (params->datafile) { @@ -26,10 +26,10 @@ Cc: Simon Glass + if (!dtc) + dtc = MKIMAGE_DTC; + - /* dtc -I dts -O dtb -p 500 datafile > tmpfile */ - snprintf(cmd, sizeof(cmd), "%s %s \"%s\" > \"%s\"", -- MKIMAGE_DTC, params->dtc, params->datafile, tmpfile); -+ dtc, params->dtc, params->datafile, tmpfile); + /* dtc -I dts -O dtb -p 500 -o tmpfile datafile */ + snprintf(cmd, sizeof(cmd), "%s %s -o \"%s\" \"%s\"", +- MKIMAGE_DTC, params->dtc, tmpfile, params->datafile); ++ dtc, params->dtc, tmpfile, params->datafile); debug("Trying to execute \"%s\"\n", cmd); } else { snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"", diff --git a/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch b/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch index b9cd9c7ac..24b863411 100644 --- a/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch +++ b/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch @@ -12,17 +12,26 @@ old way of generating images. --- a/Makefile +++ b/Makefile -@@ -1144,9 +1144,10 @@ u-boot-x86-16bit.bin: u-boot FORCE - endif +@@ -1215,8 +1215,10 @@ endif ifneq ($(CONFIG_ARCH_SUNXI),) --u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \ -- checkbinman FORCE + ifeq ($(CONFIG_ARM64),) +-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE - $(call if_changed,binman) +OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ + --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE + $(call if_changed,pad_cat) - endif + else + u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE + $(call if_changed,cat) +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -711,7 +711,6 @@ config ARCH_SOCFPGA - ifneq ($(CONFIG_TEGRA),) + config ARCH_SUNXI + bool "Support sunxi (Allwinner) SoCs" +- select BINMAN + select CMD_GPIO + select CMD_MMC if MMC + select CMD_USB if DISTRO_DEFAULTS diff --git a/package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch b/package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch deleted file mode 100644 index aeee5b497..000000000 --- a/package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 77f54e8698001d8a987f2aa4870f71b65dc089eb Mon Sep 17 00:00:00 2001 -In-Reply-To: <20170921152217.4011-1-antony@phenome.org> -References: <20170921152217.4011-1-antony@phenome.org> -From: Antony Antony -Date: Thu, 21 Sep 2017 13:34:07 +0200 -Subject: [PATCH v5 1/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support - -Add initial DT for NanoPi NEO Plus2 by FriendlyARM -- Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU -- 1 GB DDR3 RAM -- 8GB eMMC flash (Samsung KLM8G1WEPD-B031) -- micro SD card slot -- Gigabit Ethernet (external RTL8211E-VB-CG chip) -- 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module) -- 2x USB 2.0 host ports - -Signed-off-by: Antony Antony ---- - arch/arm/dts/Makefile | 1 + - arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 ++++++++++++++++++++++++++++ - configs/nanopi_neo_plus2_defconfig | 18 +++++ - 3 files changed, 125 insertions(+) - create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts - create mode 100644 configs/nanopi_neo_plus2_defconfig - ---- a/arch/arm/dts/Makefile -+++ b/arch/arm/dts/Makefile -@@ -337,6 +337,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \ - sun8i-v3s-licheepi-zero.dtb - dtb-$(CONFIG_MACH_SUN50I_H5) += \ - sun50i-h5-nanopi-neo2.dtb \ -+ sun50i-h5-nanopi-neo-plus2.dtb \ - sun50i-h5-orangepi-pc2.dtb \ - sun50i-h5-orangepi-prime.dtb \ - sun50i-h5-orangepi-zero-plus2.dtb ---- /dev/null -+++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts -@@ -0,0 +1,106 @@ -+/* -+ * Copyright (C) 2017 Antony Antony -+ * Copyright (c) 2016 ARM Ltd. -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+ -+#include "sun50i-h5.dtsi" -+ -+#include -+ -+/ { -+ model = "FriendlyARM NanoPi NEO Plus 2"; -+ compatible = "friendlyarm,nanopi-neo-plus2", "allwinner,sun50i-h5"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ reg_vcc3v3: vcc3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+}; -+ -+&ehci1 { -+ status = "okay"; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&mmc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc2_8bit_pins>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <8>; -+ non-removable; -+ cap-mmc-hw-reset; -+ status = "okay"; -+}; -+ -+&ohci1 { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; -+ -+&usbphy { -+ status = "okay"; -+}; ---- /dev/null -+++ b/configs/nanopi_neo_plus2_defconfig -@@ -0,0 +1,18 @@ -+CONFIG_ARM=y -+CONFIG_ARCH_SUNXI=y -+CONFIG_MACH_SUN50I_H5=y -+CONFIG_DRAM_CLK=408 -+CONFIG_DRAM_ZQ=3881977 -+CONFIG_MACPWR="PD6" -+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-nanopi-neo-plus2" -+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -+CONFIG_SPL=y -+# CONFIG_CMD_IMLS is not set -+# CONFIG_CMD_FLASH is not set -+# CONFIG_CMD_FPGA is not set -+# CONFIG_SPL_DOS_PARTITION is not set -+# CONFIG_SPL_ISO_PARTITION is not set -+# CONFIG_SPL_EFI_PARTITION is not set -+CONFIG_SUN8I_EMAC=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_MMC_SUNXI_SLOT_EXTRA=2 diff --git a/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch b/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch index 1b88de3e2..947a1ab05 100644 --- a/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch +++ b/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch @@ -21,7 +21,7 @@ dtc from kernel 4.9. ### --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn -@@ -58,8 +58,8 @@ endif +@@ -56,8 +56,8 @@ endif KBUILD_CFLAGS += $(warning) @@ -32,7 +32,7 @@ dtc from kernel 4.9. dtc-warning := $(dtc-warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) dtc-warning += $(dtc-warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -@@ -70,11 +70,11 @@ DTC_FLAGS += $(dtc-warning) +@@ -68,11 +68,11 @@ DTC_FLAGS += $(dtc-warning) else # Disable noisy checks by default diff --git a/package/boot/uboot-sunxi/patches/310-sunxi-h3-Sync-OTG-and-HCI-nodes-from-Linux-DT.patch b/package/boot/uboot-sunxi/patches/310-sunxi-h3-Sync-OTG-and-HCI-nodes-from-Linux-DT.patch new file mode 100644 index 000000000..97aad7879 --- /dev/null +++ b/package/boot/uboot-sunxi/patches/310-sunxi-h3-Sync-OTG-and-HCI-nodes-from-Linux-DT.patch @@ -0,0 +1,63 @@ +From 96c04aab58e351fa9ed7e95783018d6dbf60768f Mon Sep 17 00:00:00 2001 +From: Jun Nie +Date: Mon, 7 May 2018 13:03:40 +0530 +Subject: sunxi: h3: Sync OTG and HCI nodes from Linux DT + +Allwinner H3 have a dual-routed USB PHY0 -- routed to either OHCI/EHCI +or MUSB controller. + +Signed-off-by: Jun Nie +Reviewed-by: Jagan Teki +Acked-by: Jun Nie +--- + arch/arm/dts/sun8i-h3.dtsi | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +--- a/arch/arm/dts/sun8i-h3.dtsi ++++ b/arch/arm/dts/sun8i-h3.dtsi +@@ -219,6 +219,19 @@ + #size-cells = <0>; + }; + ++ usb_otg: usb@1c19000 { ++ compatible = "allwinner,sun8i-h3-musb"; ++ reg = <0x01c19000 0x400>; ++ clocks = <&ccu CLK_BUS_OTG>; ++ resets = <&ccu RST_BUS_OTG>; ++ interrupts = ; ++ interrupt-names = "mc"; ++ phys = <&usbphy 0>; ++ phy-names = "usb"; ++ extcon = <&usbphy 0>; ++ status = "disabled"; ++ }; ++ + usbphy: phy@01c19400 { + compatible = "allwinner,sun8i-h3-usb-phy"; + reg = <0x01c19400 0x2c>, +@@ -251,6 +264,25 @@ + #phy-cells = <1>; + }; + ++ ehci0: usb@1c1a000 { ++ compatible = "allwinner,sun8i-h3-ehci", "generic-ehci"; ++ reg = <0x01c1a000 0x100>; ++ interrupts = ; ++ clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>; ++ resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>; ++ status = "disabled"; ++ }; ++ ++ ohci0: usb@1c1a400 { ++ compatible = "allwinner,sun8i-h3-ohci", "generic-ohci"; ++ reg = <0x01c1a400 0x100>; ++ interrupts = ; ++ clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>, ++ <&ccu CLK_USB_OHCI0>; ++ resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>; ++ status = "disabled"; ++ }; ++ + ehci1: usb@01c1b000 { + compatible = "allwinner,sun8i-h3-ehci", "generic-ehci"; + reg = <0x01c1b000 0x100>; diff --git a/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch b/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch index 1181a44e8..97c476946 100644 --- a/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch +++ b/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch @@ -1,34 +1,48 @@ -From 068fb0d5728c5ec93cb961718d59e7c718886edd Mon Sep 17 00:00:00 2001 +From fd3736abbe57a819312c8df96d14ec396b074581 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 26 Sep 2017 22:16:59 +0200 -Subject: sunxi: Add support for Orange Pi R1 +Subject: sun8i: h2: Add initial Orange Pi R1 -The device tree files are also submitted for inclusion into the Linux -kernel. +Orange Pi R1 is an open-source single-board computer using the +Allwinner H2+ SOC. + +H2+ Orange Pi R1 has + - Quad-core Cortex-A7 + - 256MB DDR3 + - micrSD slot + - 128MBit SPI Nor flash + - Debug TTL UART + - 100MBit/s Ethernet (H2+) + - 100MBit/s Ethernet (RTL8152B) + - Wifi (RTL8189ETV) + - USB 2.0 OTG + power supply +This board is very similar to the Orange Pi Zero. + +The device tree file is copied from the Linux kernel 4.18. Signed-off-by: Hauke Mehrtens --- - arch/arm/dts/Makefile | 1 + - arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts | 77 ++++++++++++++++++++++++++++++ - board/sunxi/MAINTAINERS | 5 ++ - configs/orangepi_r1_defconfig | 26 ++++++++++ - 4 files changed, 109 insertions(+) + arch/arm/dts/Makefile | 1 + + arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts | 101 +++++++++++++++++++++++++++++ + board/sunxi/MAINTAINERS | 5 ++ + configs/orangepi_r1_defconfig | 16 +++++ + 4 files changed, 123 insertions(+) create mode 100644 arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts create mode 100644 configs/orangepi_r1_defconfig --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -318,6 +318,7 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \ - sun8i-a83t-bananapi-m3.dtb \ - sun8i-a83t-cubietruck-plus.dtb +@@ -350,6 +350,7 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \ + sun8i-a83t-cubietruck-plus.dtb \ + sun8i-a83t-tbs-a711.dts dtb-$(CONFIG_MACH_SUN8I_H3) += \ + sun8i-h2-plus-orangepi-r1.dtb \ sun8i-h2-plus-orangepi-zero.dtb \ sun8i-h3-bananapi-m2-plus.dtb \ - sun8i-h3-orangepi-2.dtb \ + sun8i-h3-libretech-all-h3-cc.dtb \ --- /dev/null +++ b/arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts -@@ -0,0 +1,91 @@ +@@ -0,0 +1,101 @@ +/* + * Copyright (C) 2017 Icenowy Zheng + * @@ -87,8 +101,8 @@ Signed-off-by: Hauke Mehrtens + */ + reg_vcc_usb_eth: reg-vcc-usb-ethernet { + compatible = "regulator-fixed"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + regulator-name = "vcc-usb-ethernet"; + enable-active-high; + gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>; @@ -99,6 +113,16 @@ Signed-off-by: Hauke Mehrtens + }; +}; + ++/* ++&spi0 { ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "mxicy,mx25l12805d", "jedec,spi-nor"; ++ }; ++}; ++*/ ++ +&ohci1 { + /* + * RTL8152B USB-Ethernet adapter is connected to USB1, @@ -122,7 +146,7 @@ Signed-off-by: Hauke Mehrtens +}; --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS -@@ -326,6 +326,11 @@ M: Jagan Teki S: Maintained --- /dev/null +++ b/configs/orangepi_r1_defconfig -@@ -0,0 +1,18 @@ +@@ -0,0 +1,16 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y -+CONFIG_SPL_SPI_FLASH_SUPPORT=y ++CONFIG_SPL=y +CONFIG_MACH_SUN8I_H3=y +CONFIG_DRAM_CLK=624 +CONFIG_DRAM_ZQ=3881979 +CONFIG_DRAM_ODT_EN=y +# CONFIG_VIDEO_DE2 is not set ++CONFIG_SPL_SPI_SUNXI=y +CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plus-orangepi-r1" +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_CONSOLE_MUX=y -+CONFIG_SPL=y -+# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set -+# CONFIG_CMD_FPGA is not set -+CONFIG_SPL_SPI_SUNXI=y +CONFIG_SUN8I_EMAC=y +CONFIG_USB_EHCI_HCD=y ++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y diff --git a/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch b/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch index 4363b5ee2..e1e16d6f3 100644 --- a/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch +++ b/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch @@ -1,6 +1,37 @@ +From fd576a3c594ee2356b50a0738403e5cef094935a Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sat, 9 Jun 2018 15:16:42 +0200 +Subject: sun50i: h5: Add initial Orange Pi Zero Plus support + +Orange Pi Zero Plus is an open-source single-board computer +using the Allwinner H5 SOC. + +H5 Orangepi Zero Plus has + - Quad-core Cortex-A53 + - 512MB DDR3 + - micrSD slot + - 16MBit SPI Nor flash + - Debug TTL UART + - 1GBit/s Ethernet (RTL8211E) + - Wifi (RTL8189FTV) + - USB 2.0 Host + - USB 2.0 OTG + power supply + +The device tree file is copied from the Linux kernel 4.18. + +Signed-off-by: Hauke Mehrtens +--- + arch/arm/dts/Makefile | 1 + + arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts | 145 ++++++++++++++++++++++++++ + board/sunxi/MAINTAINERS | 5 + + configs/orangepi_zero_plus_defconfig | 16 +++ + 4 files changed, 167 insertions(+) + create mode 100644 arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts + create mode 100644 configs/orangepi_zero_plus_defconfig + --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -339,6 +339,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \ +@@ -372,6 +372,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \ dtb-$(CONFIG_MACH_SUN50I_H5) += \ sun50i-h5-nanopi-neo2.dtb \ sun50i-h5-nanopi-neo-plus2.dtb \ @@ -9,94 +40,25 @@ sun50i-h5-orangepi-prime.dtb \ sun50i-h5-orangepi-zero-plus2.dtb --- /dev/null -+++ b/configs/orangepi_zero_plus_defconfig -@@ -0,0 +1,19 @@ -+CONFIG_ARM=y -+CONFIG_ARCH_SUNXI=y -+CONFIG_MACH_SUN50I_H5=y -+CONFIG_DRAM_CLK=624 -+CONFIG_DRAM_ZQ=3881977 -+CONFIG_MACPWR="PD6" -+CONFIG_MMC_SUNXI_SLOT_EXTRA=2 -+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-zero-plus" -+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -+CONFIG_SPL=y -+# CONFIG_CMD_IMLS is not set -+# CONFIG_CMD_FLASH is not set -+# CONFIG_CMD_FPGA is not set -+# CONFIG_SPL_DOS_PARTITION is not set -+# CONFIG_SPL_ISO_PARTITION is not set -+# CONFIG_SPL_EFI_PARTITION is not set -+CONFIG_SPL_SPI_SUNXI=y -+CONFIG_SUN8I_EMAC=y -+CONFIG_USB_EHCI_HCD=y ---- /dev/null +++ b/arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts -@@ -0,0 +1,113 @@ +@@ -0,0 +1,145 @@ +/* -+ * Copyright (C) 2017 Antony Antony -+ * Copyright (c) 2016 ARM Ltd. ++ * Copyright (C) 2016 ARM Ltd. ++ * Copyright (C) 2018 Hauke Mehrtens + * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. ++ * SPDX-License-Identifier: (GPL-2.0+ OR X11) + */ + +/dts-v1/; -+ +#include "sun50i-h5.dtsi" + +#include ++#include ++#include + +/ { + model = "Xunlong Orange Pi Zero Plus"; -+ compatible = "xunlong,orangepizero-zero-plus", "allwinner,sun50i-h5"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ memory { -+ reg = <0x40000000 0x40000000>; -+ }; ++ compatible = "xunlong,orangepi-zero-plus", "allwinner,sun50i-h5"; + + reg_vcc3v3: vcc3v3 { + compatible = "regulator-fixed"; @@ -104,32 +66,104 @@ + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; ++ ++ aliases { ++ ethernet0 = &emac; ++ ethernet1 = &rtl8189ftv; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ pwr { ++ label = "orangepi:green:pwr"; ++ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */ ++ default-state = "on"; ++ }; ++ ++ status { ++ label = "orangepi:red:status"; ++ gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>; /* PA17 */ ++ }; ++ }; ++ ++ reg_gmac_3v3: gmac-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "gmac-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ startup-delay-us = <100000>; ++ enable-active-high; ++ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */ ++ }; ++}; ++ ++&ehci0 { ++ status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + -+&mmc0 { -+ compatible = "allwinner,sun50i-h5-mmc", -+ "allwinner,sun50i-a64-mmc", -+ "allwinner,sun5i-a13-mmc"; ++&emac { + pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; -+ cd-inverted; ++ pinctrl-0 = <&emac_rgmii_pins>; ++ phy-supply = <®_gmac_3v3>; ++ phy-handle = <&ext_rgmii_phy>; ++ phy-mode = "rgmii"; + status = "okay"; +}; + -+&mmc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc2_8bit_pins>; ++&external_mdio { ++ ext_rgmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <1>; ++ }; ++}; ++ ++&mmc0 { + vmmc-supply = <®_vcc3v3>; -+ bus-width = <8>; ++ bus-width = <4>; ++ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ ++ status = "okay"; ++}; ++ ++&mmc1 { ++ vmmc-supply = <®_vcc3v3>; ++ bus-width = <4>; + non-removable; -+ cap-mmc-hw-reset; ++ status = "okay"; ++ ++ /* ++ * Explicitly define the sdio device, so that we can add an ethernet ++ * alias for it (which e.g. makes u-boot set a mac-address). ++ */ ++ rtl8189ftv: sdio_wifi@1 { ++ reg = <1>; ++ }; ++}; ++ ++/* ++&spi0 { ++ status = "okay"; ++ ++ flash@0 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "mxicy,mx25l1606e", "winbond,w25q128"; ++ reg = <0>; ++ spi-max-frequency = <40000000>; ++ }; ++}; ++*/ ++ ++&ohci0 { + status = "okay"; +}; + @@ -143,6 +177,46 @@ + status = "okay"; +}; + -+&usbphy { ++&usb_otg { ++ dr_mode = "peripheral"; + status = "okay"; +}; ++ ++&usbphy { ++ /* USB Type-A ports' VBUS is always on */ ++ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ ++ status = "okay"; ++}; +--- a/board/sunxi/MAINTAINERS ++++ b/board/sunxi/MAINTAINERS +@@ -327,6 +327,11 @@ M: Icenowy Zheng + S: Maintained + F: configs/orangepi_zero_defconfig + ++ORANGEPI ZERO PLUS BOARD ++M: Hauke Mehrtens ++S: Maintained ++F: configs/orangepi_zero_plus_defconfig ++ + ORANGEPI ZERO PLUS 2 BOARD + M: Jagan Teki + S: Maintained +--- /dev/null ++++ b/configs/orangepi_zero_plus_defconfig +@@ -0,0 +1,16 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_SPL=y ++CONFIG_MACH_SUN50I_H5=y ++CONFIG_DRAM_CLK=624 ++CONFIG_DRAM_ZQ=3881977 ++CONFIG_MMC0_CD_PIN="PH13" ++CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-zero-plus" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++# CONFIG_CMD_FLASH is not set ++# CONFIG_SPL_DOS_PARTITION is not set ++# CONFIG_SPL_EFI_PARTITION is not set ++CONFIG_SUN8I_EMAC=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index 736ebd26d..6d52e81be 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -7,9 +7,9 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2016.03 +PKG_VERSION:=2018.07 -PKG_HASH:=e49337262ecac44dbdeac140f2c6ebd1eba345e0162b0464172e7f05583ed7bb +PKG_HASH:=9f10df88bc91b35642e461217f73256bbaeeca9ae2db8db56197ba5e89e1f6d4 include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/u-boot.mk @@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/host-build.mk define U-Boot/Default BUILD_TARGET:=zynq - UBOOT_IMAGE:=u-boot u-boot-dtb.bin u-boot.dtb u-boot-dtb.img spl/boot.bin spl/u-boot-spl spl/u-boot-spl-dtb.bin + UBOOT_IMAGE:=spl/boot.bin u-boot.img UBOOT_CONFIG:=zynq_$(1) endef @@ -38,10 +38,15 @@ define U-Boot/zybo NAME:=Digilent Zybo Dev Board endef +define U-Boot/zybo_z7 + NAME:=Digilent Zybo Z7 board +endef + UBOOT_TARGETS := \ zc702 \ zed \ - zybo + zybo \ + zybo_z7 Build/Exports:=$(Host/Exports) diff --git a/package/boot/uboot-zynq/patches/020-v2018.09-arm-zynq-dts-add-spi-flash-node-to-zedboard.patch b/package/boot/uboot-zynq/patches/020-v2018.09-arm-zynq-dts-add-spi-flash-node-to-zedboard.patch new file mode 100644 index 000000000..195cdf632 --- /dev/null +++ b/package/boot/uboot-zynq/patches/020-v2018.09-arm-zynq-dts-add-spi-flash-node-to-zedboard.patch @@ -0,0 +1,38 @@ +From a492fdffa3c86f6b8420b6433a2ce07271597324 Mon Sep 17 00:00:00 2001 +From: Luis Araneda +Date: Fri, 27 Jul 2018 04:43:42 -0400 +Subject: [PATCH] arm: zynq: dts: add spi flash node to zedboard + +Add a flash node to fix the detection of the memory IC. +With the changes introduced with commit 8fee8845e754 +("enf_sf: reuse setup_flash_device instead of open coding it") +the SPI speed is now read from device-tree or a default value +is applied. This replaced the old behavior of setting the +SPI speed to CONFIG_ENV_SPI_MAX_HZ. + +As this board didn't have a flash node, the default value +was applied to the SPI speed, producing an error when probing +the flash memory (speed too slow). + +Signed-off-by: Luis Araneda +Signed-off-by: Michal Simek +--- + arch/arm/dts/zynq-zed.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/arm/dts/zynq-zed.dts ++++ b/arch/arm/dts/zynq-zed.dts +@@ -51,6 +51,13 @@ + &qspi { + u-boot,dm-pre-reloc; + status = "okay"; ++ num-cs = <1>; ++ flash@0 { ++ compatible = "spansion,s25fl256s", "spi-flash"; ++ reg = <0>; ++ spi-max-frequency = <30000000>; ++ m25p,fast-read; ++ }; + }; + + &sdhci0 { diff --git a/package/boot/uboot-zynq/patches/025-v2018.09-arm-zynq-add-support-for-the-zybo-z7-board.patch b/package/boot/uboot-zynq/patches/025-v2018.09-arm-zynq-add-support-for-the-zybo-z7-board.patch new file mode 100644 index 000000000..0e4504b85 --- /dev/null +++ b/package/boot/uboot-zynq/patches/025-v2018.09-arm-zynq-add-support-for-the-zybo-z7-board.patch @@ -0,0 +1,499 @@ +From 58f449676ac29938ea2970e240a2defe99240a8e Mon Sep 17 00:00:00 2001 +From: Luis Araneda +Date: Tue, 24 Jul 2018 11:31:19 -0400 +Subject: [PATCH] arm: zynq: add support for the zybo z7 board + +The board is manufactured by Digilent +Main features: +- Soc: XC7Z010 (Z7-10) or XC7Z020 (Z7-20) +- RAM: 1 GB DDR3L +- FLASH: 16 MB QSPI +- 1 Gbps Ethernet +- USB 2.0 +- microSD slot +- Pcam camera connector +- HDMI Tx and Rx +- Audio codec: stereo out, stereo in, mic +- 5 (Z7-10) or 6 (Z7-20) Pmod ports +- 6 push-buttons, 4 switches, 5 LEDs +- 1 (Z7-10) or 2 (Z7-20) RGB LEDs + +Signed-off-by: Luis Araneda +Signed-off-by: Michal Simek +--- + arch/arm/dts/Makefile | 3 +- + arch/arm/dts/zynq-zybo-z7.dts | 81 +++++ + board/xilinx/zynq/zynq-zybo-z7/ps7_init_gpl.c | 297 ++++++++++++++++++ + configs/zynq_zybo_z7_defconfig | 68 ++++ + 4 files changed, 448 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/dts/zynq-zybo-z7.dts + create mode 100644 board/xilinx/zynq/zynq-zybo-z7/ps7_init_gpl.c + create mode 100644 configs/zynq_zybo_z7_defconfig + +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -145,7 +145,8 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \ + zynq-zc770-xm013.dtb \ + zynq-zed.dtb \ + zynq-zturn.dtb \ +- zynq-zybo.dtb ++ zynq-zybo.dtb \ ++ zynq-zybo-z7.dtb + dtb-$(CONFIG_ARCH_ZYNQMP) += \ + zynqmp-mini-emmc0.dtb \ + zynqmp-mini-emmc1.dtb \ +--- /dev/null ++++ b/arch/arm/dts/zynq-zybo-z7.dts +@@ -0,0 +1,81 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2011 - 2015 Xilinx ++ * Copyright (C) 2012 National Instruments Corp. ++ */ ++/dts-v1/; ++#include "zynq-7000.dtsi" ++#include ++ ++/ { ++ model = "Digilent Zybo Z7 board"; ++ compatible = "digilent,zynq-zybo-z7", "xlnx,zynq-7000"; ++ ++ aliases { ++ ethernet0 = &gem0; ++ serial0 = &uart1; ++ spi0 = &qspi; ++ mmc0 = &sdhci0; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x40000000>; ++ }; ++ ++ chosen { ++ bootargs = ""; ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ ld4 { ++ label = "zynq-zybo-z7:green:ld4"; ++ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ usb_phy0: phy0 { ++ #phy-cells = <0>; ++ compatible = "usb-nop-xceiv"; ++ reset-gpios = <&gpio0 46 GPIO_ACTIVE_LOW>; ++ }; ++}; ++ ++&clkc { ++ ps-clk-frequency = <33333333>; ++}; ++ ++&gem0 { ++ status = "okay"; ++ phy-mode = "rgmii-id"; ++ phy-handle = <ðernet_phy>; ++ ++ ethernet_phy: ethernet-phy@0 { ++ reg = <0>; ++ device_type = "ethernet-phy"; ++ }; ++}; ++ ++&qspi { ++ u-boot,dm-pre-reloc; ++ status = "okay"; ++}; ++ ++&sdhci0 { ++ u-boot,dm-pre-reloc; ++ status = "okay"; ++}; ++ ++&uart1 { ++ u-boot,dm-pre-reloc; ++ status = "okay"; ++}; ++ ++&usb0 { ++ status = "okay"; ++ dr_mode = "host"; ++ usb-phy = <&usb_phy0>; ++}; +--- /dev/null ++++ b/board/xilinx/zynq/zynq-zybo-z7/ps7_init_gpl.c +@@ -0,0 +1,297 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * (c) Copyright 2010-2014 Xilinx, Inc. All rights reserved. ++ * ++ * Procedure to generate this file (using Vivado Webpack 2018.2): ++ * + Install board files from digilent/vivado-boards repository ++ * (commit 6a45981 from 2018-06-05) ++ * + Start Vivado and create a new RTL project with the Zybo-z7-20 board ++ * + Create a block design ++ * - Add "ZYNQ7 Processing System" IP ++ * - Run "Block Automation" (Check "Apply Board Preset") ++ * - Connect ports FCLK_CLK0 and M_AXI_GP0_ACLK ++ * - Save diagram changes ++ * - Go to sources view, select the block diagram, ++ * and select "Generate Output Products" ++ * + Copy the generated "ps7_init_gpl.c" file ++ * + Perform manual editions based on existing Zynq boards ++ * and the checkpatch.pl script ++ * ++ */ ++ ++#include ++ ++static unsigned long ps7_pll_init_data_3_0[] = { ++ EMIT_WRITE(0xF8000008, 0x0000DF0DU), ++ EMIT_MASKWRITE(0xF8000110, 0x003FFFF0U, 0x000FA220U), ++ EMIT_MASKWRITE(0xF8000100, 0x0007F000U, 0x00028000U), ++ EMIT_MASKWRITE(0xF8000100, 0x00000010U, 0x00000010U), ++ EMIT_MASKWRITE(0xF8000100, 0x00000001U, 0x00000001U), ++ EMIT_MASKWRITE(0xF8000100, 0x00000001U, 0x00000000U), ++ EMIT_MASKPOLL(0xF800010C, 0x00000001U), ++ EMIT_MASKWRITE(0xF8000100, 0x00000010U, 0x00000000U), ++ EMIT_MASKWRITE(0xF8000120, 0x1F003F30U, 0x1F000200U), ++ EMIT_MASKWRITE(0xF8000114, 0x003FFFF0U, 0x0012C220U), ++ EMIT_MASKWRITE(0xF8000104, 0x0007F000U, 0x00020000U), ++ EMIT_MASKWRITE(0xF8000104, 0x00000010U, 0x00000010U), ++ EMIT_MASKWRITE(0xF8000104, 0x00000001U, 0x00000001U), ++ EMIT_MASKWRITE(0xF8000104, 0x00000001U, 0x00000000U), ++ EMIT_MASKPOLL(0xF800010C, 0x00000002U), ++ EMIT_MASKWRITE(0xF8000104, 0x00000010U, 0x00000000U), ++ EMIT_MASKWRITE(0xF8000124, 0xFFF00003U, 0x0C200003U), ++ EMIT_MASKWRITE(0xF8000118, 0x003FFFF0U, 0x001452C0U), ++ EMIT_MASKWRITE(0xF8000108, 0x0007F000U, 0x0001E000U), ++ EMIT_MASKWRITE(0xF8000108, 0x00000010U, 0x00000010U), ++ EMIT_MASKWRITE(0xF8000108, 0x00000001U, 0x00000001U), ++ EMIT_MASKWRITE(0xF8000108, 0x00000001U, 0x00000000U), ++ EMIT_MASKPOLL(0xF800010C, 0x00000004U), ++ EMIT_MASKWRITE(0xF8000108, 0x00000010U, 0x00000000U), ++ EMIT_WRITE(0xF8000004, 0x0000767BU), ++ EMIT_EXIT(), ++}; ++ ++static unsigned long ps7_clock_init_data_3_0[] = { ++ EMIT_WRITE(0xF8000008, 0x0000DF0DU), ++ EMIT_MASKWRITE(0xF8000128, 0x03F03F01U, 0x00700F01U), ++ EMIT_MASKWRITE(0xF8000138, 0x00000011U, 0x00000001U), ++ EMIT_MASKWRITE(0xF8000140, 0x03F03F71U, 0x00100801U), ++ EMIT_MASKWRITE(0xF800014C, 0x00003F31U, 0x00000501U), ++ EMIT_MASKWRITE(0xF8000150, 0x00003F33U, 0x00001401U), ++ EMIT_MASKWRITE(0xF8000154, 0x00003F33U, 0x00000A02U), ++ EMIT_MASKWRITE(0xF8000168, 0x00003F31U, 0x00000501U), ++ EMIT_MASKWRITE(0xF8000170, 0x03F03F30U, 0x00400500U), ++ EMIT_MASKWRITE(0xF80001C4, 0x00000001U, 0x00000001U), ++ EMIT_MASKWRITE(0xF800012C, 0x01FFCCCDU, 0x01EC044DU), ++ EMIT_WRITE(0xF8000004, 0x0000767BU), ++ EMIT_EXIT(), ++}; ++ ++static unsigned long ps7_ddr_init_data_3_0[] = { ++ EMIT_MASKWRITE(0xF8006000, 0x0001FFFFU, 0x00000080U), ++ EMIT_MASKWRITE(0xF8006004, 0x0007FFFFU, 0x00001081U), ++ EMIT_MASKWRITE(0xF8006008, 0x03FFFFFFU, 0x03C0780FU), ++ EMIT_MASKWRITE(0xF800600C, 0x03FFFFFFU, 0x02001001U), ++ EMIT_MASKWRITE(0xF8006010, 0x03FFFFFFU, 0x00014001U), ++ EMIT_MASKWRITE(0xF8006014, 0x001FFFFFU, 0x0004281AU), ++ EMIT_MASKWRITE(0xF8006018, 0xF7FFFFFFU, 0x44E458D2U), ++ EMIT_MASKWRITE(0xF800601C, 0xFFFFFFFFU, 0x720238E5U), ++ EMIT_MASKWRITE(0xF8006020, 0x7FDFFFFCU, 0x270872D0U), ++ EMIT_MASKWRITE(0xF8006024, 0x0FFFFFC3U, 0x00000000U), ++ EMIT_MASKWRITE(0xF8006028, 0x00003FFFU, 0x00002007U), ++ EMIT_MASKWRITE(0xF800602C, 0xFFFFFFFFU, 0x00000008U), ++ EMIT_MASKWRITE(0xF8006030, 0xFFFFFFFFU, 0x00040930U), ++ EMIT_MASKWRITE(0xF8006034, 0x13FF3FFFU, 0x000116D4U), ++ EMIT_MASKWRITE(0xF8006038, 0x00000003U, 0x00000000U), ++ EMIT_MASKWRITE(0xF800603C, 0x000FFFFFU, 0x00000777U), ++ EMIT_MASKWRITE(0xF8006040, 0xFFFFFFFFU, 0xFFF00000U), ++ EMIT_MASKWRITE(0xF8006044, 0x0FFFFFFFU, 0x0F666666U), ++ EMIT_MASKWRITE(0xF8006048, 0x0003F03FU, 0x0003C008U), ++ EMIT_MASKWRITE(0xF8006050, 0xFF0F8FFFU, 0x77010800U), ++ EMIT_MASKWRITE(0xF8006058, 0x00010000U, 0x00000000U), ++ EMIT_MASKWRITE(0xF800605C, 0x0000FFFFU, 0x00005003U), ++ EMIT_MASKWRITE(0xF8006060, 0x000017FFU, 0x0000003EU), ++ EMIT_MASKWRITE(0xF8006064, 0x00021FE0U, 0x00020000U), ++ EMIT_MASKWRITE(0xF8006068, 0x03FFFFFFU, 0x00284141U), ++ EMIT_MASKWRITE(0xF800606C, 0x0000FFFFU, 0x00001610U), ++ EMIT_MASKWRITE(0xF8006078, 0x03FFFFFFU, 0x00466111U), ++ EMIT_MASKWRITE(0xF800607C, 0x000FFFFFU, 0x00032222U), ++ EMIT_MASKWRITE(0xF80060A4, 0xFFFFFFFFU, 0x10200802U), ++ EMIT_MASKWRITE(0xF80060A8, 0x0FFFFFFFU, 0x0690CB73U), ++ EMIT_MASKWRITE(0xF80060AC, 0x000001FFU, 0x000001FEU), ++ EMIT_MASKWRITE(0xF80060B0, 0x1FFFFFFFU, 0x1CFFFFFFU), ++ EMIT_MASKWRITE(0xF80060B4, 0x00000200U, 0x00000200U), ++ EMIT_MASKWRITE(0xF80060B8, 0x01FFFFFFU, 0x00200066U), ++ EMIT_MASKWRITE(0xF80060C4, 0x00000003U, 0x00000000U), ++ EMIT_MASKWRITE(0xF80060C8, 0x000000FFU, 0x00000000U), ++ EMIT_MASKWRITE(0xF80060DC, 0x00000001U, 0x00000000U), ++ EMIT_MASKWRITE(0xF80060F0, 0x0000FFFFU, 0x00000000U), ++ EMIT_MASKWRITE(0xF80060F4, 0x0000000FU, 0x00000008U), ++ EMIT_MASKWRITE(0xF8006114, 0x000000FFU, 0x00000000U), ++ EMIT_MASKWRITE(0xF8006118, 0x7FFFFFCFU, 0x40000001U), ++ EMIT_MASKWRITE(0xF800611C, 0x7FFFFFCFU, 0x40000001U), ++ EMIT_MASKWRITE(0xF8006120, 0x7FFFFFCFU, 0x40000001U), ++ EMIT_MASKWRITE(0xF8006124, 0x7FFFFFCFU, 0x40000001U), ++ EMIT_MASKWRITE(0xF800612C, 0x000FFFFFU, 0x00027000U), ++ EMIT_MASKWRITE(0xF8006130, 0x000FFFFFU, 0x00027000U), ++ EMIT_MASKWRITE(0xF8006134, 0x000FFFFFU, 0x00026C00U), ++ EMIT_MASKWRITE(0xF8006138, 0x000FFFFFU, 0x00028800U), ++ EMIT_MASKWRITE(0xF8006140, 0x000FFFFFU, 0x00000035U), ++ EMIT_MASKWRITE(0xF8006144, 0x000FFFFFU, 0x00000035U), ++ EMIT_MASKWRITE(0xF8006148, 0x000FFFFFU, 0x00000035U), ++ EMIT_MASKWRITE(0xF800614C, 0x000FFFFFU, 0x00000035U), ++ EMIT_MASKWRITE(0xF8006154, 0x000FFFFFU, 0x0000007AU), ++ EMIT_MASKWRITE(0xF8006158, 0x000FFFFFU, 0x0000007AU), ++ EMIT_MASKWRITE(0xF800615C, 0x000FFFFFU, 0x0000007CU), ++ EMIT_MASKWRITE(0xF8006160, 0x000FFFFFU, 0x00000073U), ++ EMIT_MASKWRITE(0xF8006168, 0x001FFFFFU, 0x000000F1U), ++ EMIT_MASKWRITE(0xF800616C, 0x001FFFFFU, 0x000000F1U), ++ EMIT_MASKWRITE(0xF8006170, 0x001FFFFFU, 0x000000F0U), ++ EMIT_MASKWRITE(0xF8006174, 0x001FFFFFU, 0x000000F7U), ++ EMIT_MASKWRITE(0xF800617C, 0x000FFFFFU, 0x000000BAU), ++ EMIT_MASKWRITE(0xF8006180, 0x000FFFFFU, 0x000000BAU), ++ EMIT_MASKWRITE(0xF8006184, 0x000FFFFFU, 0x000000BCU), ++ EMIT_MASKWRITE(0xF8006188, 0x000FFFFFU, 0x000000B3U), ++ EMIT_MASKWRITE(0xF8006190, 0x6FFFFEFEU, 0x00040080U), ++ EMIT_MASKWRITE(0xF8006194, 0x000FFFFFU, 0x0001FC82U), ++ EMIT_MASKWRITE(0xF8006204, 0xFFFFFFFFU, 0x00000000U), ++ EMIT_MASKWRITE(0xF8006208, 0x000703FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF800620C, 0x000703FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF8006210, 0x000703FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF8006214, 0x000703FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF8006218, 0x000F03FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF800621C, 0x000F03FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF8006220, 0x000F03FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF8006224, 0x000F03FFU, 0x000003FFU), ++ EMIT_MASKWRITE(0xF80062A8, 0x00000FF5U, 0x00000000U), ++ EMIT_MASKWRITE(0xF80062AC, 0xFFFFFFFFU, 0x00000000U), ++ EMIT_MASKWRITE(0xF80062B0, 0x003FFFFFU, 0x00005125U), ++ EMIT_MASKWRITE(0xF80062B4, 0x0003FFFFU, 0x000012A8U), ++ EMIT_MASKPOLL(0xF8000B74, 0x00002000U), ++ EMIT_MASKWRITE(0xF8006000, 0x0001FFFFU, 0x00000081U), ++ EMIT_MASKPOLL(0xF8006054, 0x00000007U), ++ EMIT_EXIT(), ++}; ++ ++static unsigned long ps7_mio_init_data_3_0[] = { ++ EMIT_WRITE(0xF8000008, 0x0000DF0DU), ++ EMIT_MASKWRITE(0xF8000B40, 0x00000FFFU, 0x00000600U), ++ EMIT_MASKWRITE(0xF8000B44, 0x00000FFFU, 0x00000600U), ++ EMIT_MASKWRITE(0xF8000B48, 0x00000FFFU, 0x00000672U), ++ EMIT_MASKWRITE(0xF8000B4C, 0x00000FFFU, 0x00000672U), ++ EMIT_MASKWRITE(0xF8000B50, 0x00000FFFU, 0x00000674U), ++ EMIT_MASKWRITE(0xF8000B54, 0x00000FFFU, 0x00000674U), ++ EMIT_MASKWRITE(0xF8000B58, 0x00000FFFU, 0x00000600U), ++ EMIT_MASKWRITE(0xF8000B5C, 0xFFFFFFFFU, 0x0018C068U), ++ EMIT_MASKWRITE(0xF8000B60, 0xFFFFFFFFU, 0x00F98068U), ++ EMIT_MASKWRITE(0xF8000B64, 0xFFFFFFFFU, 0x00F98068U), ++ EMIT_MASKWRITE(0xF8000B68, 0xFFFFFFFFU, 0x00F98068U), ++ EMIT_MASKWRITE(0xF8000B6C, 0x00007FFFU, 0x00000260U), ++ EMIT_MASKWRITE(0xF8000B70, 0x00000001U, 0x00000001U), ++ EMIT_MASKWRITE(0xF8000B70, 0x00000021U, 0x00000020U), ++ EMIT_MASKWRITE(0xF8000B70, 0x07FEFFFFU, 0x00000823U), ++ EMIT_MASKWRITE(0xF8000700, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF8000704, 0x00003FFFU, 0x00001602U), ++ EMIT_MASKWRITE(0xF8000708, 0x00003FFFU, 0x00000602U), ++ EMIT_MASKWRITE(0xF800070C, 0x00003FFFU, 0x00000602U), ++ EMIT_MASKWRITE(0xF8000710, 0x00003FFFU, 0x00000602U), ++ EMIT_MASKWRITE(0xF8000714, 0x00003FFFU, 0x00000602U), ++ EMIT_MASKWRITE(0xF8000718, 0x00003FFFU, 0x00000602U), ++ EMIT_MASKWRITE(0xF800071C, 0x00003FFFU, 0x00000600U), ++ EMIT_MASKWRITE(0xF8000720, 0x00003FFFU, 0x00000602U), ++ EMIT_MASKWRITE(0xF8000724, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF8000728, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF800072C, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF8000730, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF8000734, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF8000738, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF800073C, 0x00003FFFU, 0x00001600U), ++ EMIT_MASKWRITE(0xF8000740, 0x00003FFFU, 0x00001302U), ++ EMIT_MASKWRITE(0xF8000744, 0x00003FFFU, 0x00001302U), ++ EMIT_MASKWRITE(0xF8000748, 0x00003FFFU, 0x00001302U), ++ EMIT_MASKWRITE(0xF800074C, 0x00003FFFU, 0x00001302U), ++ EMIT_MASKWRITE(0xF8000750, 0x00003FFFU, 0x00001302U), ++ EMIT_MASKWRITE(0xF8000754, 0x00003FFFU, 0x00001302U), ++ EMIT_MASKWRITE(0xF8000758, 0x00003FFFU, 0x00001303U), ++ EMIT_MASKWRITE(0xF800075C, 0x00003FFFU, 0x00001303U), ++ EMIT_MASKWRITE(0xF8000760, 0x00003FFFU, 0x00001303U), ++ EMIT_MASKWRITE(0xF8000764, 0x00003FFFU, 0x00001303U), ++ EMIT_MASKWRITE(0xF8000768, 0x00003FFFU, 0x00001303U), ++ EMIT_MASKWRITE(0xF800076C, 0x00003FFFU, 0x00001303U), ++ EMIT_MASKWRITE(0xF8000770, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF8000774, 0x00003FFFU, 0x00001305U), ++ EMIT_MASKWRITE(0xF8000778, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF800077C, 0x00003FFFU, 0x00001305U), ++ EMIT_MASKWRITE(0xF8000780, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF8000784, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF8000788, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF800078C, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF8000790, 0x00003FFFU, 0x00001305U), ++ EMIT_MASKWRITE(0xF8000794, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF8000798, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF800079C, 0x00003FFFU, 0x00001304U), ++ EMIT_MASKWRITE(0xF80007A0, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007A4, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007A8, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007AC, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007B0, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007B4, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007B8, 0x00003FFFU, 0x00001200U), ++ EMIT_MASKWRITE(0xF80007BC, 0x00003F01U, 0x00001201U), ++ EMIT_MASKWRITE(0xF80007C0, 0x00003FFFU, 0x000012E0U), ++ EMIT_MASKWRITE(0xF80007C4, 0x00003FFFU, 0x000012E1U), ++ EMIT_MASKWRITE(0xF80007C8, 0x00003FFFU, 0x00001200U), ++ EMIT_MASKWRITE(0xF80007CC, 0x00003FFFU, 0x00001200U), ++ EMIT_MASKWRITE(0xF80007D0, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF80007D4, 0x00003FFFU, 0x00001280U), ++ EMIT_MASKWRITE(0xF8000830, 0x003F003FU, 0x002F0037U), ++ EMIT_WRITE(0xF8000004, 0x0000767BU), ++ EMIT_EXIT(), ++}; ++ ++static unsigned long ps7_peripherals_init_data_3_0[] = { ++ EMIT_WRITE(0xF8000008, 0x0000DF0DU), ++ EMIT_MASKWRITE(0xF8000B48, 0x00000180U, 0x00000180U), ++ EMIT_MASKWRITE(0xF8000B4C, 0x00000180U, 0x00000180U), ++ EMIT_MASKWRITE(0xF8000B50, 0x00000180U, 0x00000180U), ++ EMIT_MASKWRITE(0xF8000B54, 0x00000180U, 0x00000180U), ++ EMIT_WRITE(0xF8000004, 0x0000767BU), ++ EMIT_MASKWRITE(0xE0001034, 0x000000FFU, 0x00000006U), ++ EMIT_MASKWRITE(0xE0001018, 0x0000FFFFU, 0x0000007CU), ++ EMIT_MASKWRITE(0xE0001000, 0x000001FFU, 0x00000017U), ++ EMIT_MASKWRITE(0xE0001004, 0x000003FFU, 0x00000020U), ++ EMIT_MASKWRITE(0xE000D000, 0x00080000U, 0x00080000U), ++ EMIT_MASKWRITE(0xF8007000, 0x20000000U, 0x00000000U), ++ EMIT_MASKWRITE(0xE000A244, 0x003FFFFFU, 0x00004000U), ++ EMIT_MASKWRITE(0xE000A008, 0xFFFFFFFFU, 0xBFFF4000U), ++ EMIT_MASKWRITE(0xE000A248, 0x003FFFFFU, 0x00004000U), ++ EMIT_MASKWRITE(0xE000A008, 0xFFFFFFFFU, 0xBFFF0000U), ++ EMIT_MASKDELAY(0xF8F00200, 1), ++ EMIT_MASKWRITE(0xE000A008, 0xFFFFFFFFU, 0xBFFF4000U), ++ EMIT_EXIT(), ++}; ++ ++static unsigned long ps7_post_config_3_0[] = { ++ EMIT_WRITE(0xF8000008, 0x0000DF0DU), ++ EMIT_MASKWRITE(0xF8000900, 0x0000000FU, 0x0000000FU), ++ EMIT_MASKWRITE(0xF8000240, 0xFFFFFFFFU, 0x00000000U), ++ EMIT_WRITE(0xF8000004, 0x0000767BU), ++ EMIT_EXIT(), ++}; ++ ++int ps7_post_config(void) ++{ ++ int ret = -1; ++ ++ ret = ps7_config(ps7_post_config_3_0); ++ if (ret != PS7_INIT_SUCCESS) ++ return ret; ++ ++ return PS7_INIT_SUCCESS; ++} ++ ++int ps7_init(void) ++{ ++ int ret; ++ ++ ret = ps7_config(ps7_mio_init_data_3_0); ++ if (ret != PS7_INIT_SUCCESS) ++ return ret; ++ ++ ret = ps7_config(ps7_pll_init_data_3_0); ++ if (ret != PS7_INIT_SUCCESS) ++ return ret; ++ ++ ret = ps7_config(ps7_clock_init_data_3_0); ++ if (ret != PS7_INIT_SUCCESS) ++ return ret; ++ ++ ret = ps7_config(ps7_ddr_init_data_3_0); ++ if (ret != PS7_INIT_SUCCESS) ++ return ret; ++ ++ ret = ps7_config(ps7_peripherals_init_data_3_0); ++ if (ret != PS7_INIT_SUCCESS) ++ return ret; ++ ++ return PS7_INIT_SUCCESS; ++} +--- /dev/null ++++ b/configs/zynq_zybo_z7_defconfig +@@ -0,0 +1,68 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ZYNQ=y ++CONFIG_SYS_TEXT_BASE=0x4000000 ++CONFIG_SPL=y ++CONFIG_DEBUG_UART_BASE=0xe0001000 ++CONFIG_DEBUG_UART_CLOCK=50000000 ++CONFIG_SPL_STACK_R_ADDR=0x200000 ++CONFIG_DEFAULT_DEVICE_TREE="zynq-zybo-z7" ++CONFIG_DEBUG_UART=y ++CONFIG_DISTRO_DEFAULTS=y ++CONFIG_FIT=y ++CONFIG_FIT_SIGNATURE=y ++CONFIG_FIT_VERBOSE=y ++CONFIG_IMAGE_FORMAT_LEGACY=y ++CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd" ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_OS_BOOT=y ++CONFIG_SPL_SPI_LOAD=y ++CONFIG_SYS_PROMPT="Zynq> " ++CONFIG_CMD_THOR_DOWNLOAD=y ++CONFIG_CMD_DFU=y ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_FPGA_LOADBP=y ++CONFIG_CMD_FPGA_LOADFS=y ++CONFIG_CMD_FPGA_LOADMK=y ++CONFIG_CMD_FPGA_LOADP=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_I2C=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_SF=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TFTPPUT=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_EXT4_WRITE=y ++CONFIG_ENV_IS_IN_SPI_FLASH=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_SPL_DM_SEQ_ALIAS=y ++CONFIG_DFU_MMC=y ++CONFIG_DFU_RAM=y ++CONFIG_FPGA_XILINX=y ++CONFIG_FPGA_ZYNQPL=y ++CONFIG_DM_GPIO=y ++CONFIG_SYS_I2C_ZYNQ=y ++CONFIG_ZYNQ_I2C0=y ++CONFIG_ZYNQ_I2C1=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_ZYNQ=y ++CONFIG_SPI_FLASH=y ++CONFIG_SPI_FLASH_BAR=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_PHY_REALTEK=y ++CONFIG_ZYNQ_GEM=y ++CONFIG_DEBUG_UART_ZYNQ=y ++CONFIG_ZYNQ_SERIAL=y ++CONFIG_ZYNQ_QSPI=y ++CONFIG_USB=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_ULPI_VIEWPORT=y ++CONFIG_USB_ULPI=y ++CONFIG_USB_STORAGE=y ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_MANUFACTURER="Xilinx" ++CONFIG_USB_GADGET_VENDOR_NUM=0x03fd ++CONFIG_USB_GADGET_PRODUCT_NUM=0x0300 ++CONFIG_CI_UDC=y ++CONFIG_USB_GADGET_DOWNLOAD=y ++CONFIG_USB_FUNCTION_THOR=y diff --git a/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch b/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch new file mode 100644 index 000000000..f0ebc3323 --- /dev/null +++ b/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch @@ -0,0 +1,107 @@ +From ac8fcc92d87436715ce85f39a4fe4f07c3bfa15e Mon Sep 17 00:00:00 2001 +From: Luis Araneda +Date: Sun, 22 Jul 2018 02:52:41 -0400 +Subject: [U-Boot] [RFC PATCH] arm: zynq: read mac address from SPI flash memory + +Implement a method for reading the MAC address from an +SPI flash memory. +In particular, this method is used by the Zybo Z7 board +to read the MAC address from the OTP region in the SPI NOR +memory + +Signed-off-by: Luis Araneda +--- +As of 2018-08-23, this patch has been sent to U-Boot's mailing list +and is being reviewed. Some changes on the implementation are expected, +but the functionality should not change +--- + board/xilinx/zynq/board.c | 28 ++++++++++++++++++++++++++++ + configs/zynq_zybo_z7_defconfig | 3 +++ + drivers/misc/Kconfig | 17 +++++++++++++++++ + 3 files changed, 48 insertions(+) + +--- a/board/xilinx/zynq/board.c ++++ b/board/xilinx/zynq/board.c +@@ -6,9 +6,12 @@ + + #include + #include ++#include ++#include + #include + #include + #include ++#include + #include + #include + #include +@@ -83,6 +86,31 @@ int zynq_board_read_rom_ethaddr(unsigned + printf("I2C EEPROM MAC address read failed\n"); + #endif + ++#if defined(CONFIG_MAC_ADDR_IN_SPI_FLASH) ++ struct spi_flash *flash; ++ struct udevice *dev; ++ int ret; ++ ++ ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS, ++ CONFIG_SF_DEFAULT_CS, ++ 0, 0, &dev); ++ if (ret) { ++ printf("SPI(bus:%u cs:%u) probe failed\n", ++ CONFIG_SF_DEFAULT_BUS, ++ CONFIG_SF_DEFAULT_CS); ++ return 0; ++ } ++ ++ flash = dev_get_uclass_priv(dev); ++ flash->read_cmd = CONFIG_MAC_ADDR_SPI_FLASH_READ_CMD; ++ ++ if (spi_flash_read_dm(dev, ++ CONFIG_MAC_ADDR_SPI_FLASH_DATA_OFFSET, ++ 6, ethaddr)) ++ printf("SPI MAC address read failed\n"); ++ ++ device_remove(dev, DM_REMOVE_NORMAL); ++#endif + return 0; + } + +--- a/configs/zynq_zybo_z7_defconfig ++++ b/configs/zynq_zybo_z7_defconfig +@@ -44,6 +44,9 @@ CONFIG_DM_GPIO=y + CONFIG_SYS_I2C_ZYNQ=y + CONFIG_ZYNQ_I2C0=y + CONFIG_ZYNQ_I2C1=y ++CONFIG_MAC_ADDR_IN_SPI_FLASH=y ++CONFIG_MAC_ADDR_SPI_FLASH_READ_CMD=0x4b ++CONFIG_MAC_ADDR_SPI_FLASH_DATA_OFFSET=0x20 + CONFIG_MMC_SDHCI=y + CONFIG_MMC_SDHCI_ZYNQ=y + CONFIG_SPI_FLASH=y +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -272,6 +272,23 @@ config SYS_I2C_EEPROM_ADDR_OVERFLOW + + endif + ++config MAC_ADDR_IN_SPI_FLASH ++ bool "MAC address in SPI flash" ++ help ++ Read MAC address from an SPI flash memory ++ ++if MAC_ADDR_IN_SPI_FLASH ++ ++config MAC_ADDR_SPI_FLASH_READ_CMD ++ hex "Read command for the SPI flash memory" ++ default 0 ++ ++config MAC_ADDR_SPI_FLASH_DATA_OFFSET ++ hex "Offset of MAC data in SPI flash memory" ++ default 0 ++ ++endif ++ + config GDSYS_RXAUI_CTRL + bool "Enable gdsys RXAUI control driver" + depends on MISC diff --git a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch index a260e84e8..6fe253606 100644 --- a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch +++ b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch @@ -3,9 +3,9 @@ needed dependencies are added too. --- a/tools/Makefile +++ b/tools/Makefile -@@ -128,7 +128,7 @@ endif +@@ -146,7 +146,7 @@ endif # MXSImage needs LibSSL - ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),) + ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),) HOSTLOADLIBES_mkimage += \ - $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") + $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") diff --git a/package/boot/yamonenv/Makefile b/package/boot/yamonenv/Makefile index 011d39acd..ef1f36de6 100644 --- a/package/boot/yamonenv/Makefile +++ b/package/boot/yamonenv/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=20051022 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)_gruen.4g__$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/ +PKG_SOURCE_URL:=https://downloads.openwrt.org/sources PKG_HASH:=466eca9cdad2c15e957fb9ce7d0b6927ecd17d85c4cc2dff37e97a3e6b209c67 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -27,7 +27,6 @@ define Package/yamonenv SUBMENU:=Boot Loaders DEPENDS:=@TARGET_au1000 TITLE:=YAMON configuration utility - URL:=http://meshcube.org/nylon/stable/sources/ MAINTAINER:=Florian Fainelli endef diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index 4cf2aaa87..446ea9512 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb -PKG_VERSION:=8.0.1 +PKG_VERSION:=8.1.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=3dbd5f93e36ba2815ad0efab030dcd0c7b211d7b353a40a53f4c02d7d56295e3 +PKG_HASH:=97dcc3169bd430270fc29adb65145846a58c1b55cdbb73382a4a89307bdad03c PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 diff --git a/package/devel/gdb/patches/110-shared_libgcc.patch b/package/devel/gdb/patches/110-shared_libgcc.patch index 929a5ae97..84d1f60f2 100644 --- a/package/devel/gdb/patches/110-shared_libgcc.patch +++ b/package/devel/gdb/patches/110-shared_libgcc.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -1300,13 +1300,13 @@ if test -z "$LD"; then +@@ -1293,13 +1293,13 @@ if test -z "$LD"; then fi fi @@ -17,7 +17,7 @@ AC_LANG_PUSH(C++) AC_LINK_IFELSE([ #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) -@@ -1632,7 +1632,7 @@ AC_ARG_WITH(stage1-ldflags, +@@ -1625,7 +1625,7 @@ AC_ARG_WITH(stage1-ldflags, # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then @@ -26,7 +26,7 @@ fi]) AC_SUBST(stage1_ldflags) -@@ -1661,7 +1661,7 @@ AC_ARG_WITH(boot-ldflags, +@@ -1654,7 +1654,7 @@ AC_ARG_WITH(boot-ldflags, # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then @@ -37,7 +37,7 @@ --- a/configure +++ b/configure -@@ -5005,14 +5005,14 @@ if test -z "$LD"; then +@@ -4998,14 +4998,14 @@ if test -z "$LD"; then fi fi @@ -56,7 +56,7 @@ ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -5795,7 +5795,7 @@ else +@@ -5788,7 +5788,7 @@ else # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then @@ -65,7 +65,7 @@ fi fi -@@ -5831,7 +5831,7 @@ else +@@ -5824,7 +5824,7 @@ else # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then diff --git a/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch b/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch index 8afa8ccf8..7cb050c75 100644 --- a/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch +++ b/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch @@ -27,7 +27,7 @@ gdb/ChangeLog: --- a/gdb/common/signals-state-save-restore.c +++ b/gdb/common/signals-state-save-restore.c -@@ -41,7 +41,7 @@ save_original_signals_state (void) +@@ -41,7 +41,7 @@ save_original_signals_state (bool quiet) int i; int res; diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index 61388580d..4defdd8c4 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -61,12 +61,6 @@ MAKE_FLAGS = \ WERROR=0 \ prefix=/usr -ifdef CONFIG_LINUX_4_4 -ifdef CONFIG_USE_MUSL - MAKE_FLAGS += EXTRA_CFLAGS="-I$(CURDIR)/musl-include -include $(CURDIR)/musl-compat.h -D__UCLIBC__" -endif -endif - define Build/Compile +$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \ -C $(PKG_BUILD_DIR) \ diff --git a/package/devel/perf/musl-compat.h b/package/devel/perf/musl-compat.h deleted file mode 100644 index 83aa00a7c..000000000 --- a/package/devel/perf/musl-compat.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __PERF_MUSL_COMPAT_H -#define __PERF_MUSL_COMPAT_H - -#ifndef __ASSEMBLER__ - -#include -#include -#include -#include - -#undef _IOWR -#undef _IOR -#undef _IOW -#undef _IOC -#undef _IO - -#define _SC_LEVEL1_DCACHE_LINESIZE -1 - -static inline long sysconf_wrap(int name) -{ - FILE *f; - int val; - - switch (name) { - case _SC_LEVEL1_DCACHE_LINESIZE: - f = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r"); - if (!f) - return 0; - - if (fscanf(f, "%d", &val) != 1) - return 0; - - fclose(f); - return val; - default: - return sysconf(name); - } -} - -#define sysconf(_n) sysconf_wrap(_n) - -#endif -#endif diff --git a/package/devel/perf/musl-include/asm/errno.h b/package/devel/perf/musl-include/asm/errno.h deleted file mode 100644 index 8c4b1beb5..000000000 --- a/package/devel/perf/musl-include/asm/errno.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __MUSL_COMPAT_ASM_ERRNO_H -#define __MUSL_COMPAT_ASM_ERRNO_H - -/* Avoid including different versions of errno.h, the defines (incorrectly) - * cause a redefinition error on PowerPC */ -#include - -#endif diff --git a/package/devel/perf/musl-include/string.h b/package/devel/perf/musl-include/string.h deleted file mode 100644 index 65dc2f1e8..000000000 --- a/package/devel/perf/musl-include/string.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __MUSL_COMPAT_STRING_H -#define __MUSL_COMPAT_STRING_H - -#include_next - -/* Change XSI compliant version into GNU extension hackery */ -static inline char * -gnu_strerror_r(int err, char *buf, size_t buflen) -{ - if (strerror_r(err, buf, buflen)) - return NULL; - return buf; -} -#ifdef _GNU_SOURCE -#define strerror_r gnu_strerror_r -#endif - -#endif diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index 6209dc5a6..ded6d3bb8 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=4.20 +PKG_VERSION:=4.24 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@SF/$(PKG_NAME) -PKG_HASH:=5bf3148dd17306a42566f7da17368fdd781afa147db05ea63a4ca2b50f58c523 +PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) +PKG_HASH:=1f4e59fc1edfa2bfb4adf2a748623dc25b105ec79713dd84404199f91b0b0634 PKG_LICENSE:=BSD-3c PKG_LICENSE_FILES:=COPYRIGHT @@ -30,6 +30,10 @@ include $(INCLUDE_DIR)/package.mk HOST_CFLAGS += -I$(LINUX_DIR)/user_headers/include +ifeq ($(ARCH),aarch64) + CONFIGURE_ARGS += --enable-mpers=check +endif + CONFIGURE_VARS+= \ LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \ CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \ diff --git a/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch b/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch index 3f183065e..e1b809deb 100644 --- a/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch +++ b/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch @@ -1,6 +1,6 @@ --- a/ptrace.h +++ b/ptrace.h -@@ -48,7 +48,14 @@ +@@ -49,7 +49,14 @@ # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args #endif diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile index 6b81e1a00..c124f4bb9 100644 --- a/package/firmware/ath10k-firmware/Makefile +++ b/package/firmware/ath10k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-firmware -PKG_SOURCE_DATE:=2018-04-19 -PKG_SOURCE_VERSION:=71e50312b54cc972657a7b08c470088447cb9676 -PKG_MIRROR_HASH:=726e7bce9917532e3b39ced6a17ca2d4c39fdf4c9bec4a3f8f2ea3e5defa6a54 +PKG_SOURCE_DATE:=2018-05-12 +PKG_SOURCE_VERSION:=952afa4949cb34193040cd4e7441e1aee50ac731 +PKG_MIRROR_HASH:=dd300f3f28b8f8c07c93065fd9dc1c9785ebda8f15398b4d2d33f9418adcaf46 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -64,17 +64,17 @@ define Download/ct-firmware-htt URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT) endef -QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-21.bin.lede.001 +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-21.bin.lede.002 define Download/ath10k-firmware-qca988x-ct $(call Download/ct-firmware,QCA988X,) - HASH:=a3d029c46a77be265e33bb57f827a59f01969f157825d66ecf42a9d327127578 + HASH:=354b8a116a406ba6521a8bf6165ea2dce76996ab36e7905cd71e772ea240017d endef $(eval $(call Download,ath10k-firmware-qca988x-ct)) -QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-21.bin.lede.001 +QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-21.bin.lede.002 define Download/ath10k-firmware-qca988x-ct-htt $(call Download/ct-firmware-htt,QCA988X,) - HASH:=8666523a6271c4aa6409880d2efd52643258c21464d6bf5948507bcb72d3e350 + HASH:=7a8369b33f07200bf0bbf8c88617c25c7f3435a51f8ca0e330d220586338f991 endef $(eval $(call Download,ath10k-firmware-qca988x-ct-htt)) @@ -403,7 +403,7 @@ define Package/ath10k-firmware-qca4019/install $(PKG_BUILD_DIR)/QCA4019/hw1.0/board-2.bin \ $(1)/lib/firmware/ath10k/QCA4019/hw1.0/ $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA4019/hw1.0/3.4/firmware-5.bin_10.4-3.4-00104 \ + $(PKG_BUILD_DIR)/QCA4019/hw1.0/3.5.3/firmware-5.bin_10.4-3.5.3-00057 \ $(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin endef @@ -433,13 +433,25 @@ define Package/ath10k-firmware-qca988x/install $(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/ $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00033 \ + $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00037 \ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin endef define Package/ath10k-firmware-qca6174/install - $(INSTALL_DIR) $(1)/lib/firmware/ath10k - $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/ + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw2.1 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw2.1/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw2.1/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw2.1/firmware-5.bin_SW_RM.1.1.1-00157-QCARMSWPZ-1 \ + $(1)/lib/firmware/ath10k/QCA6174/hw2.1/firmware-5.bin + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw3.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw3.0/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw3.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw3.0/4.4.1.c1/firmware-6.bin_RM.4.4.1.c1-00042-QCARMSWP-1 \ + $(1)/lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin endef define Package/ath10k-firmware-qca99x0/install diff --git a/package/firmware/brcmfmac-board-rpi/Makefile b/package/firmware/brcmfmac-board-rpi/Makefile new file mode 100644 index 000000000..4268d9124 --- /dev/null +++ b/package/firmware/brcmfmac-board-rpi/Makefile @@ -0,0 +1,88 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=brcmfmac-board-rpi +PKG_VERSION:=2018-03-12 +PKG_RELEASE:=86e88fbf0345da49555d0ec34c80b4fbae7d0cd3 +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +BRCMFMAC434XX_SDIO_URL:=@GITHUB/RPi-Distro/firmware-nonfree/$(PKG_RELEASE)/brcm/ +BRCMFMAC43430_SDIO_FILE:=brcmfmac43430-sdio-$(PKG_RELEASE) +BRCMFMAC43455_SDIO_FILE:=brcmfmac43455-sdio-$(PKG_RELEASE) + +define Download/brcmfmac43430_sdio_txt + FILE:=$(BRCMFMAC43430_SDIO_FILE).txt + URL:=$(BRCMFMAC434XX_SDIO_URL) + URL_FILE:=brcmfmac43430-sdio.txt + HASH:=e4ce7ad5ce72406f958ed758539b65d958d1c0eb3e46e3f8e9f02b510d88e0b0 +endef +$(eval $(call Download,brcmfmac43430_sdio_txt)) + +define Download/brcmfmac43455_sdio_txt + FILE:=$(BRCMFMAC43455_SDIO_FILE).txt + URL:=$(BRCMFMAC434XX_SDIO_URL) + URL_FILE:=brcmfmac43455-sdio.txt + HASH:=15698c62457bcf25e60d063e6c666d6e1b7dacdf2b03e6d14ebbc619de6da6b7 +endef +$(eval $(call Download,brcmfmac43455_sdio_txt)) + +define Download/brcmfmac43455_sdio_clm_blob + FILE:=$(BRCMFMAC43455_SDIO_FILE).clm_blob + URL:=$(BRCMFMAC434XX_SDIO_URL) + URL_FILE:=brcmfmac43455-sdio.clm_blob + HASH:=8e2250518bc789e53109728c3c0a6124bc3801a75a1cb4966125753cf1f0252e +endef +$(eval $(call Download,brcmfmac43455_sdio_clm_blob)) + +define Package/brcmfmac-board-rpi/Default + SECTION:=firmware + CATEGORY:=Firmware + URL:=https://github.com/RPi-Distro/firmware-nonfree/ + DEPENDS:=@TARGET_brcm2708 + PKGARCH:=all +endef + +define Package/brcmfmac-board-rpi2 + $(call Package/brcmfmac-board-rpi/Default) + TITLE:=BCM43430 RPi SDIO NVRAM +endef + +define Package/brcmfmac-board-rpi2/description + NVRAM for the Broadcom BCM43430 on RPi boards. +endef + +define Package/brcmfmac-board-rpi3 + $(call Package/brcmfmac-board-rpi/Default) + TITLE:=BCM43455 RPi SDIO NVRAM +endef + +define Package/brcmfmac-board-rpi3/description + NVRAM and localisations blob for the Broadcom BCM43455 on RPi boards. +endef + +define Build/Prepare + rm -rf $(PKG_BUILD_DIR) + mkdir -p $(PKG_BUILD_DIR) + cp $(DL_DIR)/$(BRCMFMAC43430_SDIO_FILE).txt $(PKG_BUILD_DIR)/brcmfmac43430-sdio.txt + cp $(DL_DIR)/$(BRCMFMAC43455_SDIO_FILE).txt $(PKG_BUILD_DIR)/brcmfmac43455-sdio.txt + cp $(DL_DIR)/$(BRCMFMAC43455_SDIO_FILE).clm_blob $(PKG_BUILD_DIR)/brcmfmac43455-sdio.clm_blob +endef + +define Build/Compile + true +endef + +define Package/brcmfmac-board-rpi2/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/brcmfmac43430-sdio.txt $(1)/lib/firmware/brcm/ +endef + +define Package/brcmfmac-board-rpi3/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/brcmfmac43455-sdio.txt $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/brcmfmac43455-sdio.clm_blob $(1)/lib/firmware/brcm/ +endef + +$(eval $(call BuildPackage,brcmfmac-board-rpi2)) +$(eval $(call BuildPackage,brcmfmac-board-rpi3)) diff --git a/package/firmware/linux-firmware/broadcom.mk b/package/firmware/linux-firmware/broadcom.mk index c0ad19cd6..24acac776 100644 --- a/package/firmware/linux-firmware/broadcom.mk +++ b/package/firmware/linux-firmware/broadcom.mk @@ -43,6 +43,15 @@ define Package/brcmfmac-firmware-43430-sdio/install endef $(eval $(call BuildPackage,brcmfmac-firmware-43430-sdio)) +Package/brcmfmac-firmware-43455-sdio = $(call Package/firmware-default,Broadcom BCM43455 FullMac SDIO firmware) +define Package/brcmfmac-firmware-43455-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43455-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.bin +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43455-sdio)) + Package/brcmfmac-firmware-usb = $(call Package/firmware-default,Broadcom BCM43xx fullmac USB firmware) define Package/brcmfmac-firmware-usb/install $(INSTALL_DIR) $(1)/lib/firmware/brcm diff --git a/package/firmware/linux-firmware/qca.mk b/package/firmware/linux-firmware/qca.mk index 0a809d1a2..23fcc0905 100644 --- a/package/firmware/linux-firmware/qca.mk +++ b/package/firmware/linux-firmware/qca.mk @@ -4,6 +4,10 @@ define Package/ar3k-firmware/install $(CP) \ $(PKG_BUILD_DIR)/ar3k/*.dfu \ $(1)/lib/firmware/ar3k + $(INSTALL_DIR) $(1)/lib/firmware/qca + $(CP) \ + $(PKG_BUILD_DIR)/qca/*.bin \ + $(1)/lib/firmware/qca endef $(eval $(call BuildPackage,ar3k-firmware)) diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index fdd92c9a4..3c0476e03 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -42,6 +42,13 @@ define Package/rtl8192de-firmware/install endef $(eval $(call BuildPackage,rtl8192de-firmware)) +Package/rtl8192eu-firmware = $(call Package/firmware-default,RealTek RTL8192EU firmware) +define Package/rtl8192eu-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192eu_nic.bin $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8192eu-firmware)) + Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware) define Package/rtl8192se-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi @@ -56,6 +63,22 @@ define Package/rtl8192su-firmware/install endef $(eval $(call BuildPackage,rtl8192su-firmware)) +Package/rtl8723au-firmware = $(call Package/firmware-default,RealTek RTL8723AU firmware) +define Package/rtl8723au-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723aufw_A.bin $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723aufw_B.bin $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723aufw_B_NoBT.bin $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8723au-firmware)) + +Package/rtl8723bu-firmware = $(call Package/firmware-default,RealTek RTL8723BU firmware) +define Package/rtl8723bu-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723bu_nic.bin $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8723bu-firmware)) + Package/rtl8821ae-firmware = $(call Package/firmware-default,RealTek RTL8821AE firmware) define Package/rtl8821ae-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index 097500ebb..1a94582a6 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-03-16 -PKG_SOURCE_VERSION:=30827f7d5b9841905c4efe918da2d95fc518c921 -PKG_MIRROR_HASH:=aac023d7f9b09becf27058b1d09ae6d068b14bb6f10c5b5a248c7ee5ecff04dc +PKG_SOURCE_DATE:=2018-08-22 +PKG_SOURCE_VERSION:=34954f0f333fa43827b2af67313db2b1e830bb48 +PKG_MIRROR_HASH:=aa77f388727ff2201de615c3211ab5c0b2dc5e3c041bd1cde4d6eebde0ca437a # Build the 4.13 ath10k-ct driver version. Other options are "-4.9", or # leave un-defined for 4.7 kernel. Probably this should match as closely as diff --git a/package/kernel/ath10k-ct/patches/100-kernel_compat.patch b/package/kernel/ath10k-ct/patches/100-kernel_compat.patch index beb0abf6d..b2ec10bb6 100644 --- a/package/kernel/ath10k-ct/patches/100-kernel_compat.patch +++ b/package/kernel/ath10k-ct/patches/100-kernel_compat.patch @@ -46,7 +46,7 @@ ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "reg-notifier: dfs region 0x%x\n", request->dfs_region); result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, -@@ -8938,7 +8938,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -8939,7 +8939,7 @@ int ath10k_mac_register(struct ath10k *a if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) ar->hw->netdev_features = NETIF_F_HW_CSUM; @@ -55,7 +55,7 @@ /* Init ath dfs pattern detector */ ar->ath_common.debug_mask = ATH_DBG_DFS; ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, -@@ -8983,7 +8983,7 @@ err_unregister: +@@ -8984,7 +8984,7 @@ err_unregister: ieee80211_unregister_hw(ar->hw); err_dfs_detector_exit: @@ -64,7 +64,7 @@ ar->dfs_detector->exit(ar->dfs_detector); err_free: -@@ -8998,7 +8998,7 @@ void ath10k_mac_unregister(struct ath10k +@@ -8999,7 +8999,7 @@ void ath10k_mac_unregister(struct ath10k { ieee80211_unregister_hw(ar->hw); @@ -86,7 +86,7 @@ hwmon_dev = devm_hwmon_device_register_with_groups(ar->dev, --- a/ath10k/wmi.c +++ b/ath10k/wmi.c -@@ -3883,7 +3883,7 @@ void ath10k_wmi_event_dfs(struct ath10k +@@ -3903,7 +3903,7 @@ void ath10k_wmi_event_dfs(struct ath10k phyerr->tsf_timestamp, tsf, buf_len); /* Skip event if DFS disabled */ @@ -95,3 +95,14 @@ return; ATH10K_DFS_STAT_INC(ar, pulses_total); +--- a/ath10k-4.13/wmi.c ++++ b/ath10k-4.13/wmi.c +@@ -3990,7 +3990,7 @@ static void ath10k_dfs_radar_report(stru + + ATH10K_DFS_STAT_INC(ar, pulses_detected); + +- if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe)) { ++ if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe, NULL)) { + ath10k_dbg(ar, ATH10K_DBG_REGULATORY, + "dfs no pulse pattern detected, yet\n"); + return; diff --git a/package/kernel/brcm2708-gpu-fw/Makefile b/package/kernel/brcm2708-gpu-fw/Makefile index 9f3d7d309..73aebd7b5 100644 --- a/package/kernel/brcm2708-gpu-fw/Makefile +++ b/package/kernel/brcm2708-gpu-fw/Makefile @@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=brcm2708-gpu-fw -PKG_VERSION:=2017-08-08 -PKG_RELEASE:=e7ba7ab135f5a68b2c00a919ea9ac8d5528a5d5b +PKG_VERSION:=2018-05-16 +PKG_RELEASE:=0f5f899ccec1c2ef8bba02aa49700b4ec19b4199 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE) @@ -33,7 +33,7 @@ define Download/bootcode_bin FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin URL:=$(RPI_FIRMWARE_URL) URL_FILE:=bootcode.bin - HASH:=b5928ef5253774362014f9e7de856397a932514fe1bc5d7f7817a73c0e10e863 + HASH:=c9eb5258766fabf7127e790b257f106e2717f0ccaaed37544b970b0d113956fc endef $(eval $(call Download,bootcode_bin)) @@ -41,7 +41,7 @@ define Download/fixup_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup.dat - HASH:=d95fcac57de7ab71e863a115fd60444f6099cb2ea100f4a68b2c606f79e775ed + HASH:=8a6311e73d0f349be9b8424db0644fd8f48aaf721f3f2f487488c83d7316cbdf endef $(eval $(call Download,fixup_dat)) @@ -49,7 +49,7 @@ define Download/fixup_cd_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup_cd.dat - HASH:=28f3ec8388df4e0c47489f8370a29ca81dbc536fe7db9978342865b5d093ec36 + HASH:=973b008aae9711d57ddce4f058354fe5a0b4725dd825673f784a2e2754da1f28 endef $(eval $(call Download,fixup_cd_dat)) @@ -57,7 +57,7 @@ define Download/start_elf FILE:=$(RPI_FIRMWARE_FILE)-start.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start.elf - HASH:=8712fb4e241a22f7a33de0f1d420e0fdfff237952aa685c907b91e59c8d487fa + HASH:=8e77c4cce7e44ced609e5046dd55f19cb7656a8ce4694e733b7eb6ecab915fe1 endef $(eval $(call Download,start_elf)) @@ -65,7 +65,7 @@ define Download/start_cd_elf FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start_cd.elf - HASH:=c600ab34bea389da10aac541bf2f9c62e5f774093b7e1f2f72c4637f9cf3a83c + HASH:=25223b479b7aca1d74c6f7a1829aba69fd14906ca5b25ae12571fe71ea2c5a4a endef $(eval $(call Download,start_cd_elf)) diff --git a/package/kernel/kmod-sched-cake/Makefile b/package/kernel/kmod-sched-cake/Makefile index 6ec9c03bd..56e95896b 100644 --- a/package/kernel/kmod-sched-cake/Makefile +++ b/package/kernel/kmod-sched-cake/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git -PKG_SOURCE_DATE:=2018-07-16 -PKG_SOURCE_VERSION:=f39ab9a402ad51d7c17d4cde18ca15b2b7022030 -PKG_MIRROR_HASH:=fc22fc6eb7a24f4595c2777f33758ebcf9a2a404c16d00aa37ae389cd7f9c78f +PKG_SOURCE_DATE:=2018-08-25 +PKG_SOURCE_VERSION:=42175bfc76c5e7fbca5b50fd4c5cca7801f123f2 +PKG_MIRROR_HASH:=9b3748ee97e774f8ae63e808dd85de04d28b9b9a0abb0367d4e372129e5d8096 PKG_MAINTAINER:=Kevin Darbyshire-Bryant include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c index a8f787fdc..b7ac81ca8 100644 --- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c +++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c @@ -187,7 +187,6 @@ static inline void u64_add_u32(ppe_u64_t, unsigned int, ppe_u64_t *); */ static inline struct sk_buff* alloc_skb_rx(void); static inline struct sk_buff* alloc_skb_tx(unsigned int); -struct sk_buff* atm_alloc_tx(struct atm_vcc *, unsigned int); static inline void atm_free_tx_skb_vcc(struct sk_buff *, struct atm_vcc *); static inline struct sk_buff *get_skb_rx_pointer(unsigned int); static inline int get_tx_desc(unsigned int); @@ -261,8 +260,6 @@ EXPORT_SYMBOL(ifx_mei_atm_showtime_exit); #endif -static struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL; - static struct atm_priv_data g_atm_priv_data; static struct atmdev_ops g_ifx_atm_ops = { @@ -430,8 +427,6 @@ static int ppe_open(struct atm_vcc *vcc) /* enable irq */ if ( f_enable_irq ) { - ifx_atm_alloc_tx = atm_alloc_tx; - *MBOX_IGU1_ISRC = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM); *MBOX_IGU1_IER = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM); @@ -480,10 +475,8 @@ static void ppe_close(struct atm_vcc *vcc) clear_bit(conn, &g_atm_priv_data.conn_table); /* disable irq */ - if ( g_atm_priv_data.conn_table == 0 ) { + if ( g_atm_priv_data.conn_table == 0 ) disable_irq(PPE_MAILBOX_IGU1_INT); - ifx_atm_alloc_tx = NULL; - } /* release bandwidth */ switch ( vcc->qos.txtp.traffic_class ) @@ -785,42 +778,6 @@ static inline struct sk_buff* alloc_skb_tx(unsigned int size) return skb; } -struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size) -{ - int conn; - struct sk_buff *skb; - - /* oversize packet */ - if ( size > aal5s_max_packet_size ) { - pr_err("atm_alloc_tx: oversize packet\n"); - return NULL; - } - /* send buffer overflow */ - if ( sk_wmem_alloc_get(sk_atm(vcc)) && !atm_may_send(vcc, size) ) { - pr_err("atm_alloc_tx: send buffer overflow\n"); - return NULL; - } - conn = find_vcc(vcc); - if ( conn < 0 ) { - pr_err("atm_alloc_tx: unknown VCC\n"); - return NULL; - } - - skb = dev_alloc_skb(size); - if ( skb == NULL ) { - pr_err("atm_alloc_tx: sk buffer is used up\n"); - return NULL; - } - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0)) - refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); -#else - atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); -#endif - - return skb; -} - static inline void atm_free_tx_skb_vcc(struct sk_buff *skb, struct atm_vcc *vcc) { if ( vcc->pop != NULL ) diff --git a/package/kernel/lantiq/ltq-vdsl-fw/Makefile b/package/kernel/lantiq/ltq-vdsl-fw/Makefile new file mode 100644 index 000000000..8186e657e --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/Makefile @@ -0,0 +1,42 @@ +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ltq-vdsl-fw +PKG_VERSION:=6.8.6 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Daniel Golle + +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +define Package/ltq-vdsl-vr9-vectoring-fw-installer + TITLE:=VDSL2 Vectoring Firmware installer + SECTION:=net + CATEGORY:=Network + DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vdsl-vr9 +endef + +define Build/Prepare + $(INSTALL_DIR) $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR) +endef + +define Build/Compile + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + $(MAKE) -C $(PKG_BUILD_DIR) +endef + +define Package/ltq-vdsl-vr9-vectoring-fw-installer/install + $(INSTALL_DIR) $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/w921v_fw_cutter $(PKG_BUILD_DIR)/vdsl_fw_install.sh $(1)/sbin/ +endef + +$(eval $(call BuildPackage,ltq-vdsl-vr9-vectoring-fw-installer)) diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c new file mode 100644 index 000000000..cb8345377 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c @@ -0,0 +1,584 @@ +/* + LzmaDecode.c + LZMA Decoder (optimized for Speed version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaDecode.h" + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*Buffer++) + +#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ + { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} + +#ifdef _LZMA_IN_CB + +#define RC_TEST { if (Buffer == BufferLim) \ + { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ + BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} + +#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 + +#else + +#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } + +#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 + +#endif + +#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } + +#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) +#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; +#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; + +#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ + { UpdateBit0(p); mi <<= 1; A0; } else \ + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + +#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ + { int i = numLevels; res = 1; \ + do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ + res -= (1 << numLevels); } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + #ifdef _LZMA_OUT_READ + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + } + #endif + return LZMA_RESULT_OK; +} + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) +{ + CProb *p = vs->Probs; + SizeT nowPos = 0; + Byte previousByte = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + + #ifdef _LZMA_OUT_READ + + UInt32 Range = vs->Range; + UInt32 Code = vs->Code; + #ifdef _LZMA_IN_CB + const Byte *Buffer = vs->Buffer; + const Byte *BufferLim = vs->BufferLim; + #else + const Byte *Buffer = inStream; + const Byte *BufferLim = inStream + inSize; + #endif + int state = vs->State; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + Byte *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + Byte tempDictionary[4]; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + #else /* if !_LZMA_OUT_READ */ + + int state = 0; + UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; + int len = 0; + const Byte *Buffer; + const Byte *BufferLim; + UInt32 Range; + UInt32 Code; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + + { + UInt32 i; + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + } + + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + + #endif /* _LZMA_OUT_READ */ + + while(nowPos < outSize) + { + CProb *prob; + UInt32 bound; + int posState = (int)( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & posStateMask); + + prob = p + IsMatch + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + int symbol = 1; + UpdateBit0(prob) + prob = p + Literal + (LZMA_LIT_SIZE * + ((( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + int matchByte; + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + #else + matchByte = outStream[nowPos - rep0]; + #endif + do + { + int bit; + CProb *probLit; + matchByte <<= 1; + bit = (matchByte & 0x100); + probLit = prob + 0x100 + bit + symbol; + RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) + } + while (symbol < 0x100); + } + while (symbol < 0x100) + { + CProb *probLit = prob + symbol; + RC_GET_BIT(probLit, symbol) + } + previousByte = (Byte)symbol; + + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #endif + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + UpdateBit1(prob); + prob = p + IsRep + state; + IfBit0(prob) + { + UpdateBit0(prob); + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < kNumLitStates ? 0 : 3; + prob = p + LenCoder; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG0 + state; + IfBit0(prob) + { + UpdateBit0(prob); + prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + #ifdef _LZMA_OUT_READ + UInt32 pos; + #endif + UpdateBit0(prob); + + #ifdef _LZMA_OUT_READ + if (distanceLimit == 0) + #else + if (nowPos == 0) + #endif + return LZMA_RESULT_DATA_ERROR; + + state = state < kNumLitStates ? 9 : 11; + #ifdef _LZMA_OUT_READ + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + #endif + + continue; + } + else + { + UpdateBit1(prob); + } + } + else + { + UInt32 distance; + UpdateBit1(prob); + prob = p + IsRepG1 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep1; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG2 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep2; + } + else + { + UpdateBit1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = p + RepLenCoder; + } + { + int numBits, offset; + CProb *probLen = prob + LenChoice; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + numBits = kLenNumLowBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenChoice2; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + numBits = kLenNumMidBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + numBits = kLenNumHighBits; + } + } + RangeDecoderBitTreeDecode(probLen, numBits, len); + len += offset; + } + + if (state < 4) + { + int posSlot; + state += kNumLitStates; + prob = p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = (2 | ((UInt32)posSlot & 1)); + if (posSlot < kEndPosModelIndex) + { + rep0 <<= numDirectBits; + prob = p + SpecPos + rep0 - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + RC_NORMALIZE + Range >>= 1; + rep0 <<= 1; + if (Code >= Range) + { + Code -= Range; + rep0 |= 1; + } + } + while (--numDirectBits != 0); + prob = p + Align; + rep0 <<= kNumAlignBits; + numDirectBits = kNumAlignBits; + } + { + int i = 1; + int mi = 1; + do + { + CProb *prob3 = prob + mi; + RC_GET_BIT2(prob3, mi, ; , rep0 |= i); + i <<= 1; + } + while(--numDirectBits != 0); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + #ifdef _LZMA_OUT_READ + if (rep0 > distanceLimit) + #else + if (rep0 > nowPos) + #endif + return LZMA_RESULT_DATA_ERROR; + + #ifdef _LZMA_OUT_READ + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + #endif + + do + { + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + RC_NORMALIZE; + + #ifdef _LZMA_OUT_READ + vs->Range = Range; + vs->Code = Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = globalPos + (UInt32)nowPos; + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + #endif + + #ifdef _LZMA_IN_CB + vs->Buffer = Buffer; + vs->BufferLim = BufferLim; + #else + *inSizeProcessed = (SizeT)(Buffer - inStream); + #endif + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h new file mode 100644 index 000000000..2870eeb9c --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h @@ -0,0 +1,113 @@ +/* + LzmaDecode.h + LZMA Decoder interface + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#ifndef __LZMADECODE_H +#define __LZMADECODE_H + +#include "LzmaTypes.h" + +/* #define _LZMA_IN_CB */ +/* Use callback for input data */ + +/* #define _LZMA_OUT_READ */ +/* Use read function for output data */ + +/* #define _LZMA_PROB32 */ +/* It can increase speed on some 32-bit CPUs, + but memory usage will be doubled in that case */ + +/* #define _LZMA_LOC_OPT */ +/* Enable local speed optimizations inside code */ + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb UInt16 +#endif + +#define LZMA_RESULT_OK 0 +#define LZMA_RESULT_DATA_ERROR 1 + +#ifdef _LZMA_IN_CB +typedef struct _ILzmaInCallback +{ + int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); +} ILzmaInCallback; +#endif + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LZMA_PROPERTIES_SIZE 5 + +typedef struct _CLzmaProperties +{ + int lc; + int lp; + int pb; + #ifdef _LZMA_OUT_READ + UInt32 DictionarySize; + #endif +}CLzmaProperties; + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); + +#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) + +#define kLzmaNeedInitId (-2) + +typedef struct _CLzmaDecoderState +{ + CLzmaProperties Properties; + CProb *Probs; + + #ifdef _LZMA_IN_CB + const unsigned char *Buffer; + const unsigned char *BufferLim; + #endif + + #ifdef _LZMA_OUT_READ + unsigned char *Dictionary; + UInt32 Range; + UInt32 Code; + UInt32 DictionaryPos; + UInt32 GlobalPos; + UInt32 DistanceLimit; + UInt32 Reps[4]; + int State; + int RemainLen; + unsigned char TempDictionary[4]; + #endif +} CLzmaDecoderState; + +#ifdef _LZMA_OUT_READ +#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } +#endif + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *inCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); + +#endif diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h new file mode 100644 index 000000000..9c2729075 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h @@ -0,0 +1,45 @@ +/* +LzmaTypes.h + +Types for LZMA Decoder + +This file written and distributed to public domain by Igor Pavlov. +This file is part of LZMA SDK 4.40 (2006-05-01) +*/ + +#ifndef __LZMATYPES_H +#define __LZMATYPES_H + +#ifndef _7ZIP_BYTE_DEFINED +#define _7ZIP_BYTE_DEFINED +typedef unsigned char Byte; +#endif + +#ifndef _7ZIP_UINT16_DEFINED +#define _7ZIP_UINT16_DEFINED +typedef unsigned short UInt16; +#endif + +#ifndef _7ZIP_UINT32_DEFINED +#define _7ZIP_UINT32_DEFINED +#ifdef _LZMA_UINT32_IS_ULONG +typedef unsigned long UInt32; +#else +typedef unsigned int UInt32; +#endif +#endif + +/* #define _LZMA_NO_SYSTEM_SIZE_T */ +/* You can use it, if you don't want */ + +#ifndef _7ZIP_SIZET_DEFINED +#define _7ZIP_SIZET_DEFINED +#ifdef _LZMA_NO_SYSTEM_SIZE_T +typedef UInt32 SizeT; +#else +#include +typedef size_t SizeT; +#endif +#endif + +#endif diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c new file mode 100644 index 000000000..7dce05666 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c @@ -0,0 +1,206 @@ +/****************************************************************************** +** +** FILE NAME : LzmaWrapper.c +** PROJECT : bootloader +** MODULES : U-boot +** +** DATE : 2 Nov 2006 +** AUTHOR : Lin Mars +** DESCRIPTION : LZMA decoder support for U-boot 1.1.5 +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 2 Nov 2006 Lin Mars init version which derived from LzmaTest.c from +** LZMA v4.43 SDK +** 24 May 2007 Lin Mars Fix issue for multiple lzma_inflate involved +*******************************************************************************/ +#include +#include +#include + +#include "LzmaDecode.h" +#include "LzmaWrapper.h" + +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) +static const char *kCantReadMessage = "Can not read from source buffer"; +static const char *kCantAllocateMessage = "Not enough buffer for decompression"; +#endif + +static size_t rpos=0, dpos=0; + +static int MyReadFileAndCheck(unsigned char *src, void *dest, size_t size) +{ + if (size == 0) + return 0; + memcpy(dest, src + rpos, size); + rpos += size; + return 1; +} + +int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_len) +{ + /* We use two 32-bit integers to construct 64-bit integer for file size. + You can remove outSizeHigh, if you don't need >= 4GB supporting, + or you can use UInt64 outSize, if your compiler supports 64-bit integers*/ + UInt32 outSize = 0; + UInt32 outSizeHigh = 0; + SizeT outSizeFull; + unsigned char *outStream; + + int waitEOS = 1; + /* waitEOS = 1, if there is no uncompressed size in headers, + so decoder will wait EOS (End of Stream Marker) in compressed stream */ + + SizeT compressedSize; + unsigned char *inStream; + + CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */ + unsigned char properties[LZMA_PROPERTIES_SIZE]; + + int res; + + rpos=0; dpos=0; + + if (sizeof(UInt32) < 4) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("LZMA decoder needs correct UInt32\n"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + + { + long length=s_len; + if ((long)(SizeT)length != length) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Too big compressed stream\n"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + compressedSize = (SizeT)(length - (LZMA_PROPERTIES_SIZE + 8)); + } + + /* Read LZMA properties for compressed stream */ + + if (!MyReadFileAndCheck(source, properties, sizeof(properties))) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("%s\n", kCantReadMessage); +#endif + return LZMA_RESULT_DATA_ERROR; + } + + /* Read uncompressed size */ + { + int i; + for (i = 0; i < 8; i++) + { + unsigned char b; + if (!MyReadFileAndCheck(source, &b, 1)) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("%s\n", kCantReadMessage); +#endif + return LZMA_RESULT_DATA_ERROR; + } + if (b != 0xFF) + waitEOS = 0; + if (i < 4) + outSize += (UInt32)(b) << (i * 8); + else + outSizeHigh += (UInt32)(b) << ((i - 4) * 8); + } + + if (waitEOS) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Stream with EOS marker is not supported"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + outSizeFull = (SizeT)outSize; + if (sizeof(SizeT) >= 8) + outSizeFull |= (((SizeT)outSizeHigh << 16) << 16); + else if (outSizeHigh != 0 || (UInt32)(SizeT)outSize != outSize) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Too big uncompressed stream"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + } + + /* Decode LZMA properties and allocate memory */ + if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Incorrect stream properties"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); + + if (outSizeFull == 0) + outStream = 0; + else + { + if (outSizeFull > d_len) + outStream = 0; + else + outStream = dest; + } + + if (compressedSize == 0) + inStream = 0; + else + { + if ((compressedSize+rpos) > s_len ) + inStream = 0; + else + inStream = source + rpos; + } + + if (state.Probs == 0 + || (outStream == 0 && outSizeFull != 0) + || (inStream == 0 && compressedSize != 0) + ) + { + free(state.Probs); +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("%s\n", kCantAllocateMessage); +#endif + return LZMA_RESULT_DATA_ERROR; + } + + /* Decompress */ + { + SizeT inProcessed; + SizeT outProcessed; + res = LzmaDecode(&state, + inStream, compressedSize, &inProcessed, + outStream, outSizeFull, &outProcessed); + if (res != 0) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("\nDecoding error = %d\n", res); +#endif + res = 1; + } + else + { + *d_len = outProcessed; + } + } + + free(state.Probs); + return res; +} diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h new file mode 100644 index 000000000..2f9a3ffbb --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h @@ -0,0 +1,36 @@ +/****************************************************************************** +** +** FILE NAME : LzmaWrapper.h +** PROJECT : bootloader +** MODULES : U-boot +** +** DATE : 2 Nov 2006 +** AUTHOR : Lin Mars +** DESCRIPTION : LZMA decoder support for U-boot 1.1.5 +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 2 Nov 2006 Lin Mars init version which derived from LzmaTest.c from +** LZMA v4.43 SDK +*******************************************************************************/ +#ifndef __LZMA_WRAPPER_H__ +#define __LZMA_WRAPPER_H__ + +#ifndef LZMA_RESULT_OK +#define LZMA_RESULT_OK 0 +#endif +#ifndef LZMA_RESULT_DATA_ERROR +#define LZMA_RESULT_DATA_ERROR 1 +#endif + +extern int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_len); + +#endif /*__LZMA_WRAPPER_H__*/ diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/Makefile b/package/kernel/lantiq/ltq-vdsl-fw/src/Makefile new file mode 100644 index 000000000..2d50aaf02 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/Makefile @@ -0,0 +1,13 @@ +PROG=w921v_fw_cutter +OBJS=w921v_fw_cutter.c LzmaDecode.c LzmaWrapper.c + +all: $(PROG) + +$(PROG): $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ + +clean: + rm *.o $(PROG) + +%.o: %.c + $(CC) $(CFLAGS) -c $^ -o $@ diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh b/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh new file mode 100755 index 000000000..9242e175c --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh @@ -0,0 +1,48 @@ +#!/bin/sh +FW="/tmp/firmware-speedport-w921v-1.44.000.bin" +URL="https://www.telekom.de/hilfe/downloads/firmware-speedport-w921v-1.44.000.bin" +FW_TAPI="vr9_tapi_fw.bin" +FW_DSL="vr9_dsl_fw_annex_b.bin" +MD5_FW="cefbeb7073e02e0fa4ddb6b31ecb3d1e" +MD5_TAPI="57f2d07f59e11250ce1219bad99c1eda" +MD5_DSL="655442e31deaa42c9c68944869361ec0" + +[ -f /lib/firmware/vdsl.bin ] && exit 0 + +[ -z "$1" ] || URL=$1 + +[ -f "${FW}" ] || { + echo "${FW} does not exist. Try to Download it ? (y/N)" + read -n 1 R + echo "" + [ "$R" = "y" ] || { + echo "Please manually download the firmware from ${URL} and copy the file to ${FW}" + echo "See also https://xdarklight.github.io/lantiq-xdsl-firmware-info/ for alternatives" + exit 1 + } + echo "Download w921v Firmware" + wget "${URL}" -O "${FW}" + [ $? -eq 0 -a -f "${FW}" ] || exit 1 +} + +F=`md5sum -b ${FW} | cut -d" " -f1` +[ "$F" = "${MD5_FW}" ] || { + echo "Failed to verify Firmware MD5" + exit 1 +} + +cd /tmp +echo "Unpack and decompress w921v Firmware" + +w921v_fw_cutter +[ $? -eq 0 ] || exit 1 + +T=`md5sum -b ${FW_TAPI} | cut -d" " -f1` +D=`md5sum -b ${FW_DSL} | cut -d" " -f1` + +[ "$T" = "${MD5_TAPI}" -a "$D" = "${MD5_DSL}" ] || { + echo "Failed to verify MD5" + exit 1 +} + +cp ${FW_TAPI} ${FW_DSL} /lib/firmware/ diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c b/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c new file mode 100644 index 000000000..6082bdadb --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c @@ -0,0 +1,165 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (C) 2012 John Crispin + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "LzmaWrapper.h" + +#define FW_NAME "/tmp/firmware-speedport-w921v-1.44.000.bin" + +#define MAGIC 0x50 +#define MAGIC_SZ 0x3FFC00 +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define MAGIC_PART 0x12345678 +#define MAGIC_LZMA 0x8000005D +#define MAGIC_ANNEX_B 0x3C +#define MAGIC_TAPI 0x5A +#else +#define MAGIC_PART 0x78563412 +#define MAGIC_LZMA 0x5D000080 +#define MAGIC_ANNEX_B 0x3C000000 +#define MAGIC_TAPI 0x5A000000 +#endif + + +const char* part_type(unsigned int id) +{ + switch(id) { + case MAGIC_ANNEX_B: + return "/tmp/vr9_dsl_fw_annex_b.bin"; + case MAGIC_TAPI: + return "/tmp/vr9_tapi_fw.bin"; + } + printf("\tUnknown lzma type 0x%02X\n", id); + return "/tmp/unknown.lzma"; +} + +int main(int argc, char **argv) +{ + struct stat s; + unsigned char *buf_orig; + unsigned int *buf; + int buflen; + int fd; + int i; + int err; + int start = 0, end = 0; + + printf("Arcadyan Firmware cutter v0.1\n"); + printf("-----------------------------\n"); + printf("This tool extracts the different parts of an arcadyan firmware update file\n"); + printf("This tool is for private use only. The Firmware that gets extracted has a license that forbids redistribution\n"); + printf("Please only run this if you understand the risks\n\n"); + printf("I understand the risks ? (y/N)\n"); + + if (getchar() != 'y') + return -1; + + if (stat(FW_NAME, &s) != 0) { + printf("Failed to find %s\n", FW_NAME); + printf("Ask Google or try https://www.telekom.de/hilfe/downloads/firmware-speedport-w921v-1.44.000.bin\n"); + return -1; + } + + buf_orig = malloc(s.st_size); + buf = malloc(s.st_size); + if (!buf_orig || !buf) { + printf("Failed to alloc %d bytes\n", s.st_size); + return -1; + } + + fd = open(FW_NAME, O_RDONLY); + if (fd < 0) { + printf("Unable to open %s\n", FW_NAME); + return -1; + } + + + buflen = read(fd, buf_orig, s.st_size); + close(fd); + if (buflen != s.st_size) { + printf("Loaded %d instead of %d bytes inside %s\n", buflen, s.st_size, FW_NAME); + return -1; + } + + /* */ + buf_orig++; + buflen -= 1; + for (i = 0; i < MAGIC_SZ; i++) { + if ((i % 16) < 3) + buf_orig[i] = buf_orig[i + 16] ^ MAGIC; + else + buf_orig[i] = buf_orig[i] ^ MAGIC; + } + buflen -= 3; + memmove(&buf_orig[MAGIC_SZ], &buf_orig[MAGIC_SZ + 3], buflen - MAGIC_SZ); + memcpy(buf, buf_orig, s.st_size); + + /* */ + do { + if (buf[end] == MAGIC_PART) { + end += 2; + printf("Found partition at 0x%08X with size %d\n", + start * sizeof(unsigned int), + (end - start) * sizeof(unsigned int)); + if (buf[start] == MAGIC_LZMA) { + int dest_len = 1024 * 1024; + int len = buf[end - 3]; + unsigned int id = buf[end - 6]; + const char *type = part_type(id); + unsigned char *dest; + + dest = malloc(dest_len); + if (!dest) { + printf("Failed to alloc dest buffer\n"); + return -1; + } + + if (lzma_inflate((unsigned char*)&buf[start], len, dest, &dest_len)) { + printf("Failed to decompress data\n"); + return -1; + } + + fd = creat(type, S_IRUSR | S_IWUSR); + if (fd != -1) { + if (write(fd, dest, dest_len) != dest_len) + printf("\tFailed to write %d bytes\n", dest_len); + else + printf("\tWrote %d bytes to %s\n", dest_len, type); + close(fd); + } else { + printf("\tFailed to open %s\n", type); + } + free(dest); + } else { + printf("\tThis is not lzma\n"); + } + start = end; + } else { + end++; + } + } while(end < buflen / sizeof(unsigned int)); + + return 0; +} diff --git a/package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf b/package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf new file mode 100644 index 000000000..2f63b7288 --- /dev/null +++ b/package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf @@ -0,0 +1,5 @@ +# Do not edit, changes to this file will be lost on upgrades +# /etc/sysctl.conf can be used to customize sysctl settings + +net.ipv4.tcp_congestion_control=bbr +net.core.default_qdisc=fq diff --git a/package/kernel/linux/files/sysctl-tcp-bbr.conf b/package/kernel/linux/files/sysctl-tcp-bbr.conf new file mode 100644 index 000000000..3a7dba2f0 --- /dev/null +++ b/package/kernel/linux/files/sysctl-tcp-bbr.conf @@ -0,0 +1,4 @@ +# Do not edit, changes to this file will be lost on upgrades +# /etc/sysctl.conf can be used to customize sysctl settings + +net.ipv4.tcp_congestion_control=bbr diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 2ea2d2c0e..235e6dada 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -441,8 +441,21 @@ $(eval $(call KernelPackage,crypto-michael-mic)) define KernelPackage/crypto-misc TITLE:=Other CryptoAPI modules - DEPENDS:=+kmod-crypto-manager + DEPENDS:=+kmod-crypto-xts KCONFIG:= \ + CONFIG_CRYPTO_CAMELLIA_X86_64 \ + CONFIG_CRYPTO_BLOWFISH_X86_64 \ + CONFIG_CRYPTO_TWOFISH_X86_64 \ + CONFIG_CRYPTO_TWOFISH_X86_64_3WAY \ + CONFIG_CRYPTO_SERPENT_SSE2_X86_64 \ + CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 \ + CONFIG_CRYPTO_CAST5_AVX_X86_64 \ + CONFIG_CRYPTO_CAST6_AVX_X86_64 \ + CONFIG_CRYPTO_TWOFISH_AVX_X86_64 \ + CONFIG_CRYPTO_SERPENT_AVX_X86_64 \ + CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 \ + CONFIG_CRYPTO_SERPENT_AVX2_X86_64 \ + CONFIG_CRYPTO_SERPENT_SSE2_586 \ CONFIG_CRYPTO_ANUBIS \ CONFIG_CRYPTO_BLOWFISH \ CONFIG_CRYPTO_CAMELLIA \ @@ -472,15 +485,50 @@ define KernelPackage/crypto-misc $(LINUX_DIR)/crypto/blowfish_common.ko \ $(LINUX_DIR)/crypto/blowfish_generic.ko \ $(LINUX_DIR)/crypto/serpent_generic.ko + AUTOLOAD:=$(call AutoLoad,10,anubis camellia_generic cast_common \ + cast5_generic cast6_generic khazad tea tgr192 twofish_common \ + wp512 blowfish_common serpent_generic) + ifndef CONFIG_TARGET_x86 + AUTOLOAD+= $(call AutoLoad,10,twofish_generic blowfish_generic) + endif $(call AddDepends/crypto) endef ifndef CONFIG_TARGET_x86_64 define KernelPackage/crypto-misc/x86 - FILES+=$(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko + FILES+= \ + $(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-sse2-i586.ko \ + $(LINUX_DIR)/arch/x86/crypto/glue_helper.ko \ + $(LINUX_DIR)/crypto/ablk_helper.ko \ + $(LINUX_DIR)/crypto/cryptd.ko \ + $(LINUX_DIR)/crypto/lrw.ko + AUTOLOAD+= $(call AutoLoad,10,lrw cryptd ablk_helper glue_helper \ + serpent-sse2-i586 twofish-i586 blowfish_generic) endef endif +define KernelPackage/crypto-misc/x86/64 + FILES+= \ + $(LINUX_DIR)/arch/x86/crypto/camellia-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/blowfish-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/twofish-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/twofish-x86_64-3way.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-sse2-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/cast5-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/cast6-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/twofish-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx2.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-avx2.ko \ + $(LINUX_DIR)/crypto/ablk_helper.ko + AUTOLOAD+= $(call AutoLoad,10,ablk_helper camellia-x86_64 \ + camellia-aesni-avx-x86_64 camellia-aesni-avx2 cast5-avx-x86_64 \ + cast6-avx-x86_64 twofish-x86_64 twofish-x86_64-3way \ + twofish-avx-x86_64 blowfish-x86_64 serpent-avx-x86_64 serpent-avx2) +endef + $(eval $(call KernelPackage,crypto-misc)) diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index e6dfa73de..5cd849b86 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -427,3 +427,25 @@ endef $(eval $(call KernelPackage,hwmon-w83793)) +define KernelPackage/hwmon-adcxx + TITLE:=ADCxx monitoring support + KCONFIG:=CONFIG_SENSORS_ADCXX + FILES:=$(LINUX_DIR)/drivers/hwmon/adcxx.ko + AUTOLOAD:=$(call AutoLoad,60,adcxx) + $(call AddDepends/hwmon,) +endef + +define KernelPackage/hwmon-adcxx/description + Kernel module for the National Semiconductor + ADCS chip family, where + * bb is the resolution in number of bits (8, 10, 12) + * c is the number of channels (1, 2, 4, 8) + * sss is the maximum conversion speed (021 for 200 kSPS, 051 for 500 + kSPS and 101 for 1 MSPS) + + Examples : ADC081S101, ADC124S501, ... +endef + +$(eval $(call KernelPackage,hwmon-adcxx)) + + diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index c35ccca1b..a1410170d 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -133,3 +133,25 @@ define KernelPackage/iio-bmp280-spi/description endef $(eval $(call KernelPackage,iio-bmp280-spi)) + +define KernelPackage/iio-htu21 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=HTU21 humidity & temperature sensor + KCONFIG:= \ + CONFIG_HTU21 \ + CONFIG_IIO_MS_SENSORS_I2C + FILES:= \ + $(LINUX_DIR)/drivers/iio/humidity/htu21.ko \ + $(LINUX_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko + AUTOLOAD:=$(call AutoLoad,56,htu21) +endef + +define KernelPackage/iio-htu21/description + support for the Measurement Specialties HTU21 humidity and + temperature sensor. + This driver is also used for MS8607 temperature, pressure & humidity + sensor +endef + +$(eval $(call KernelPackage,iio-htu21)) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 0da8bcdf5..6d05d6fcd 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -110,6 +110,26 @@ endef $(eval $(call KernelPackage,mii)) +define KernelPackage/mdio-gpio + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:= Supports GPIO lib-based MDIO busses + DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armvirt||TARGET_brcm2708_bcm2708):kmod-of-mdio + KCONFIG:= \ + CONFIG_MDIO_BITBANG \ + CONFIG_MDIO_GPIO + FILES:= \ + $(LINUX_DIR)/drivers/net/phy/mdio-gpio.ko \ + $(LINUX_DIR)/drivers/net/phy/mdio-bitbang.ko + AUTOLOAD:=$(call AutoProbe,mdio-gpio) +endef + +define KernelPackage/mdio-gpio/description + Supports GPIO lib-based MDIO busses +endef + +$(eval $(call KernelPackage,mdio-gpio)) + + define KernelPackage/et131x SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Agere ET131x Gigabit Ethernet driver @@ -149,7 +169,7 @@ define KernelPackage/phy-broadcom KCONFIG:=CONFIG_BROADCOM_PHY DEPENDS:=+kmod-libphy +kmod-phylib-broadcom FILES:=$(LINUX_DIR)/drivers/net/phy/broadcom.ko - AUTOLOAD:=$(call AutoLoad,18,broadcom) + AUTOLOAD:=$(call AutoLoad,18,broadcom,1) endef define KernelPackage/phy-broadcom/description @@ -206,6 +226,22 @@ endef $(eval $(call KernelPackage,switch-ip17xx)) +define KernelPackage/switch-rtl8306 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Realtek RTL8306S switch support + DEPENDS:=+kmod-swconfig + KCONFIG:=CONFIG_RTL8306_PHY + FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8306.ko + AUTOLOAD:=$(call AutoLoad,43,rtl8306) +endef + +define KernelPackage/switch-rtl8306/description + Realtek RTL8306S switch support +endef + +$(eval $(call KernelPackage,switch-rtl8306)) + + define KernelPackage/switch-rtl8366-smi SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Realtek RTL8366 SMI switch interface support diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 51f3544ed..6d751cc65 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -237,6 +237,7 @@ define KernelPackage/ipt-filter/description Netfilter (IPv4) kernel modules for packet content inspection Includes: - string + - bpf endef $(eval $(call KernelPackage,ipt-filter)) @@ -1051,3 +1052,23 @@ define KernelPackage/nft-nat6 endef $(eval $(call KernelPackage,nft-nat6)) + +define KernelPackage/nft-netdev + SUBMENU:=$(NF_MENU) + TITLE:=Netfilter nf_tables netdev support + DEPENDS:=+kmod-nft-core + KCONFIG:= \ + CONFIG_NETFILTER_INGRESS=y \ + CONFIG_NF_TABLES_NETDEV \ + CONFIG_NF_DUP_NETDEV \ + CONFIG_NFT_DUP_NETDEV \ + CONFIG_NFT_FWD_NETDEV + FILES:= \ + $(LINUX_DIR)/net/netfilter/nf_tables_netdev.ko \ + $(LINUX_DIR)/net/netfilter/nf_dup_netdev.ko \ + $(LINUX_DIR)/net/netfilter/nft_dup_netdev.ko \ + $(LINUX_DIR)/net/netfilter/nft_fwd_netdev.ko + AUTOLOAD:=$(call AutoProbe,nf_tables_netdev nf_dup_netdev nft_dup_netdev nft_fwd_netdev) +endef + +$(eval $(call KernelPackage,nft-netdev)) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index ff7672063..050541488 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -777,6 +777,37 @@ endef $(eval $(call KernelPackage,sched)) +define KernelPackage/tcp-bbr + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=BBR TCP congestion control + DEPENDS:=@!LINUX_3_18 @!LINUX_4_1 @!LINUX_4_4 +LINUX_4_9:kmod-sched + KCONFIG:= \ + CONFIG_TCP_CONG_ADVANCED=y \ + CONFIG_TCP_CONG_BBR + FILES:=$(LINUX_DIR)/net/ipv4/tcp_bbr.ko + AUTOLOAD:=$(call AutoLoad,74,tcp_bbr) +endef + +define KernelPackage/tcp-bbr/description + Kernel module for BBR (Bottleneck Bandwidth and RTT) TCP congestion + control. It requires the fq ("Fair Queue") pacing packet scheduler. + For kernel 4.13+, TCP internal pacing is implemented as fallback. +endef + +ifdef CONFIG_LINUX_4_9 + TCP_BBR_SYSCTL_CONF:=sysctl-tcp-bbr-k4_9.conf +else + TCP_BBR_SYSCTL_CONF:=sysctl-tcp-bbr.conf +endif + +define KernelPackage/tcp-bbr/install + $(INSTALL_DIR) $(1)/etc/sysctl.d + $(INSTALL_DATA) ./files/$(TCP_BBR_SYSCTL_CONF) $(1)/etc/sysctl.d/12-tcp-bbr.conf +endef + +$(eval $(call KernelPackage,tcp-bbr)) + + define KernelPackage/ax25 SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=AX25 support diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index eb26a8ba0..7df93d3a0 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -227,10 +227,14 @@ $(eval $(call KernelPackage,gpio-dev)) define KernelPackage/gpio-mcp23s08 SUBMENU:=$(OTHER_MENU) TITLE:=Microchip MCP23xxx I/O expander - DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core - KCONFIG:=CONFIG_GPIO_MCP23S08 - FILES:=$(LINUX_DIR)/drivers/gpio/gpio-mcp23s08.ko - AUTOLOAD:=$(call AutoLoad,40,gpio-mcp23s08) + DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +LINUX_4_14:kmod-regmap + KCONFIG:= \ + CONFIG_GPIO_MCP23S08 \ + CONFIG_PINCTRL_MCP23S08 + FILES:= \ + $(LINUX_DIR)/drivers/gpio/gpio-mcp23s08.ko@lt4.13 \ + $(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko@ge4.13 + AUTOLOAD:=$(call AutoLoad,40,gpio-mcp23s08@lt4.13 pinctrl-mcp23s08@ge4.13) endef define KernelPackage/gpio-mcp23s08/description @@ -698,6 +702,22 @@ endef $(eval $(call KernelPackage,serial-8250)) +define KernelPackage/serial-8250-exar + SUBMENU:=$(OTHER_MENU) + TITLE:=Exar 8250 UARTs + KCONFIG:= CONFIG_SERIAL_8250_EXAR + FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/8250_exar.ko + AUTOLOAD:=$(call AutoProbe,8250 8250_base 8250_exar) + DEPENDS:=+kmod-serial-8250 +endef + +define KernelPackage/serial-8250-exar/description + Kernel module for Exar serial ports +endef + +$(eval $(call KernelPackage,serial-8250-exar)) + + define KernelPackage/regmap SUBMENU:=$(OTHER_MENU) TITLE:=Generic register map support @@ -883,6 +903,22 @@ endef $(eval $(call KernelPackage,random-omap)) +define KernelPackage/random-tpm + SUBMENU:=$(OTHER_MENU) + TITLE:=Hardware Random Number Generator TPM support + KCONFIG:=CONFIG_HW_RANDOM_TPM + FILES:=$(LINUX_DIR)/drivers/char/hw_random/tpm-rng.ko + DEPENDS:= +kmod-random-core +kmod-tpm + AUTOLOAD:=$(call AutoProbe,tpm-rng) +endef + +define KernelPackage/random-tpm/description + Kernel module for the Random Number Generator + in the Trusted Platform Module. +endef + +$(eval $(call KernelPackage,random-tpm)) + define KernelPackage/thermal SUBMENU:=$(OTHER_MENU) TITLE:=Generic Thermal sysfs driver @@ -895,6 +931,7 @@ define KernelPackage/thermal CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y \ CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE=n \ CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE=n \ + CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 \ CONFIG_THERMAL_GOV_FAIR_SHARE=n \ CONFIG_THERMAL_GOV_STEP_WISE=y \ CONFIG_THERMAL_GOV_USER_SPACE=n \ diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 0c5bb33f3..8a4915712 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -142,6 +142,23 @@ endef $(eval $(call KernelPackage,usb-lib-composite)) +define KernelPackage/usb-gadget-hid + TITLE:=USB HID Gadget Support + KCONFIG:=CONFIG_USB_G_HID + DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite + FILES:= \ + $(LINUX_DIR)/drivers/usb/gadget/legacy/g_hid.ko \ + $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_hid.ko + AUTOLOAD:=$(call AutoLoad,52,usb_f_hid) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-gadget-hid/description + Kernel support for USB HID Gadget. +endef + +$(eval $(call KernelPackage,usb-gadget-hid)) + define KernelPackage/usb-gadget-ehci-debug TITLE:=USB EHCI debug port Gadget support KCONFIG:=\ @@ -1622,3 +1639,19 @@ endef $(eval $(call KernelPackage,usb-net2280)) +define KernelPackage/chaoskey + SUBMENU:=$(USB_MENU) + TITLE:=Chaoskey hardware RNG support + DEPENDS:=+kmod-random-core + KCONFIG:=CONFIG_USB_CHAOSKEY + FILES:=$(LINUX_DIR)/drivers/usb/misc/chaoskey.ko + AUTOLOAD:=$(call AutoProbe,chaoskey) + $(call AddDepends/usb) +endef + +define KernelPackage/chaoskey/description + Kernel module for chaoskey, USB attached true random number generator +endef + +$(eval $(call KernelPackage,chaoskey)) + diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index f76618055..3f46860f5 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -56,34 +56,13 @@ $(eval $(call KernelPackage,backlight-pwm)) define KernelPackage/fb SUBMENU:=$(VIDEO_MENU) - TITLE:=Framebuffer support + TITLE:=Framebuffer and framebuffer console support DEPENDS:=@DISPLAY_SUPPORT KCONFIG:= \ CONFIG_FB \ CONFIG_FB_MXS=n \ - CONFIG_FB_SM750=n - FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb.ko - AUTOLOAD:=$(call AutoLoad,06,fb) -endef - -define KernelPackage/fb/description - Kernel support for framebuffers -endef - -define KernelPackage/fb/x86 - FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko - AUTOLOAD+=$(call AutoLoad,06,fbdev fb) -endef - -$(eval $(call KernelPackage,fb)) - - -define KernelPackage/fbcon - SUBMENU:=$(VIDEO_MENU) - TITLE:=Framebuffer Console support - DEPENDS:=+kmod-fb @!LINUX_4_14 - KCONFIG:= \ - CONFIG_FRAMEBUFFER_CONSOLE \ + CONFIG_FB_SM750=n \ + CONFIG_FRAMEBUFFER_CONSOLE=y \ CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y \ CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y \ CONFIG_FONTS=y \ @@ -102,23 +81,22 @@ define KernelPackage/fbcon CONFIG_CONSOLE_TRANSLATIONS=y \ CONFIG_VT_CONSOLE=y \ CONFIG_VT_HW_CONSOLE_BINDING=y - FILES:= \ - $(LINUX_DIR)/drivers/video/console/bitblit.ko \ - $(LINUX_DIR)/drivers/video/console/softcursor.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_rotate.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_cw.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_ud.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_ccw.ko \ + FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb.ko \ $(LINUX_DIR)/lib/fonts/font.ko - AUTOLOAD:=$(call AutoLoad,94,font softcursor tileblit fbcon_cw fbcon_ud fbcon_ccw fbcon_rotate bitblit fbcon) + AUTOLOAD:=$(call AutoLoad,06,fb font) endef -define KernelPackage/fbcon/description - Kernel support for framebuffer console +define KernelPackage/fb/description + Kernel support for framebuffers and framebuffer console. endef -$(eval $(call KernelPackage,fbcon)) +define KernelPackage/fb/x86 + FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko + AUTOLOAD:=$(call AutoLoad,06,fbdev fb font) +endef + +$(eval $(call KernelPackage,fb)) + define KernelPackage/fb-cfb-fillrect SUBMENU:=$(VIDEO_MENU) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 91c08fdb7..611d5a73d 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -75,6 +75,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_RTLWIFI_DEBUG \ CONFIG_ATH9K_SUPPORT_PCOEM \ CONFIG_ATH9K_TX99 \ + CONFIG_ATH10K_LEDS \ + CONFIG_ATH10K_THERMAL \ CONFIG_ATH_USER_REGD \ include $(INCLUDE_DIR)/package.mk @@ -215,7 +217,7 @@ endef define KernelPackage/ath $(call KernelPackage/mac80211/Default) TITLE:=Atheros common driver part - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211 + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79||TARGET_ath25 +kmod-mac80211 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko MENU:=1 endef @@ -280,7 +282,7 @@ define KernelPackage/ath9k-common TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k HIDDEN:=1 - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko @@ -290,7 +292,7 @@ define KernelPackage/ath9k $(call KernelPackage/mac80211/Default) TITLE:=Atheros 802.11n PCI wireless cards support URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath9k-common FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko AUTOLOAD:=$(call AutoProbe,ath9k) @@ -313,7 +315,7 @@ define KernelPackage/ath9k/config config ATH9K_UBNTHSR bool "Support for Ubiquiti UniFi Outdoor+ access point" - depends on PACKAGE_kmod-ath9k && TARGET_ar71xx_generic + depends on PACKAGE_kmod-ath9k && (TARGET_ar71xx_generic||TARGET_ath79) default y endef @@ -337,7 +339,8 @@ define KernelPackage/ath10k $(call KernelPackage/mac80211/Default) TITLE:=Atheros 802.11ac wireless cards support URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT \ + +ATH10K_THERMAL:kmod-hwmon-core +ATH10K_THERMAL:kmod-thermal FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko @@ -350,6 +353,19 @@ Atheros IEEE 802.11ac family of chipsets. For now only PCI is supported. endef +define KernelPackage/ath10k/config + + config ATH10K_LEDS + bool "Enable LED support" + default y + depends on PACKAGE_kmod-ath10k + + config ATH10K_THERMAL + bool "Enable thermal sensors and throttling support" + depends on PACKAGE_kmod-ath10k + +endef + #Broadcom firmware ifneq ($(CONFIG_B43_FW_6_30),) PKG_B43_FWV4_NAME:=broadcom-wl @@ -1630,12 +1646,15 @@ config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK config-$(call config_package,ath9k) += ATH9K config-$(call config_package,ath9k-common) += ATH9K_COMMON config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB +config-$(CONFIG_TARGET_ath79) += ATH9K_AHB config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB config-$(CONFIG_PCI) += ATH9K_PCI config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR +config-$(CONFIG_ATH10K_LEDS) += ATH10K_LEDS +config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL config-$(call config_package,ath9k-htc) += ATH9K_HTC config-$(call config_package,ath10k) += ATH10K ATH10K_PCI diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 6103b5d04..511a9188d 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -113,7 +113,7 @@ detect_mac80211() { set wireless.radio${devidx}.hwmode=11${mode_band} ${dev_id} ${ht_capab} - set wireless.radio${devidx}.disabled=0 + set wireless.radio${devidx}.disabled=1 set wireless.default_radio${devidx}=wifi-iface set wireless.default_radio${devidx}.device=radio${devidx} diff --git a/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch index 796615b03..adcd788bd 100644 --- a/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch @@ -35,3 +35,13 @@ int ath10k_thermal_register(struct ath10k *ar); void ath10k_thermal_unregister(struct ath10k *ar); void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); +--- a/local-symbols ++++ b/local-symbols +@@ -139,6 +139,7 @@ ATH10K_SDIO= + ATH10K_USB= + ATH10K_DEBUG= + ATH10K_DEBUGFS= ++ATH10K_THERMAL= + ATH10K_TRACING= + ATH10K_DFS_CERTIFIED= + WCN36XX= diff --git a/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch b/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch index 82a7cb6f4..95feffa0e 100644 --- a/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch +++ b/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch @@ -1,7 +1,13 @@ -From 52a192362932f333a7ebafd581c4d9b81da2fec8 Mon Sep 17 00:00:00 2001 +From patchwork Mon May 28 11:25:06 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: Revert "rt2800: use TXOP_BACKOFF for probe frames" From: Stanislaw Gruszka +X-Patchwork-Id: 10431861 +Message-Id: <1527506706-6488-1-git-send-email-sgruszka@redhat.com> +To: linux-wireless@vger.kernel.org Date: Mon, 28 May 2018 13:25:06 +0200 -Subject: [PATCH] Revert "rt2800: use TXOP_BACKOFF for probe frames" This reverts commit fb47ada8dc3c30c8e7b415da155742b49536c61e. @@ -11,7 +17,6 @@ of AMPDU and can degrade 11n performance to 11g rates. Cc: stable@vger.kernel.org Signed-off-by: Stanislaw Gruszka -Signed-off-by: Kalle Valo --- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) @@ -38,6 +43,3 @@ Signed-off-by: Kalle Valo txdesc->u.ht.txop = TXOP_BACKOFF; else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) txdesc->u.ht.txop = TXOP_SIFS; --- -2.17.1 - diff --git a/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch index 604a6f158..9eefdbce6 100644 --- a/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch +++ b/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch @@ -86,6 +86,6 @@ Signed-off-by: Kalle Valo ATH10K_DEBUG= ATH10K_DEBUGFS= +ATH10K_SPECTRAL= + ATH10K_THERMAL= ATH10K_TRACING= ATH10K_DFS_CERTIFIED= - WCN36XX= diff --git a/package/kernel/mac80211/patches/338-v4.19-0001-brcmfmac-detect-firmware-support-for-monitor-interfa.patch b/package/kernel/mac80211/patches/338-v4.19-0001-brcmfmac-detect-firmware-support-for-monitor-interfa.patch new file mode 100644 index 000000000..b0eec163f --- /dev/null +++ b/package/kernel/mac80211/patches/338-v4.19-0001-brcmfmac-detect-firmware-support-for-monitor-interfa.patch @@ -0,0 +1,59 @@ +From 01f69dfafdbe7deff58b58053bc3a4a75c6a570c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 24 Jun 2018 21:44:35 +0200 +Subject: [PATCH] brcmfmac: detect firmware support for monitor interface +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Many/most of firmwares support creating monitor interface but only the +most recent ones explicitly /announce/ it using a "monitor" entry in the +list of capabilities. + +Check for that entry and store internally info about monitor mode +support using a new feature flag. Once we sort out all details of +handling monitor interface it will be used when reporting available +interfaces to the cfg80211. + +Later some fallback detecion method may be added for older firmwares. +For now just stick to the "monitor" capability which should be 100% +reliable. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -48,6 +48,7 @@ static const struct brcmf_feat_fwcap brc + { BRCMF_FEAT_MBSS, "mbss" }, + { BRCMF_FEAT_MCHAN, "mchan" }, + { BRCMF_FEAT_P2P, "p2p" }, ++ { BRCMF_FEAT_MONITOR, "monitor" }, + }; + + #ifdef DEBUG +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -33,6 +33,7 @@ + * MFP: 802.11w Management Frame Protection. + * GSCAN: enhanced scan offload feature. + * FWSUP: Firmware supplicant. ++ * MONITOR: firmware can pass monitor packets to host. + */ + #define BRCMF_FEAT_LIST \ + BRCMF_FEAT_DEF(MBSS) \ +@@ -48,7 +49,8 @@ + BRCMF_FEAT_DEF(WOWL_ARP_ND) \ + BRCMF_FEAT_DEF(MFP) \ + BRCMF_FEAT_DEF(GSCAN) \ +- BRCMF_FEAT_DEF(FWSUP) ++ BRCMF_FEAT_DEF(FWSUP) \ ++ BRCMF_FEAT_DEF(MONITOR) + + /* + * Quirks: diff --git a/package/kernel/mac80211/patches/338-v4.19-0002-brcmfmac-detect-firmware-support-for-radiotap-monito.patch b/package/kernel/mac80211/patches/338-v4.19-0002-brcmfmac-detect-firmware-support-for-radiotap-monito.patch new file mode 100644 index 000000000..e733468bc --- /dev/null +++ b/package/kernel/mac80211/patches/338-v4.19-0002-brcmfmac-detect-firmware-support-for-radiotap-monito.patch @@ -0,0 +1,51 @@ +From e63410ac65e0ead2040bbd3927c116889edf87e4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 24 Jun 2018 21:44:36 +0200 +Subject: [PATCH] brcmfmac: detect firmware support for radiotap monitor frames +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Depending on used build-time options some firmwares may already include +radiotap header in passed monitor frames. Add a new feature flag to +store info about it. It's needed for proper handling of received frames +before passing them up. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -49,6 +49,7 @@ static const struct brcmf_feat_fwcap brc + { BRCMF_FEAT_MCHAN, "mchan" }, + { BRCMF_FEAT_P2P, "p2p" }, + { BRCMF_FEAT_MONITOR, "monitor" }, ++ { BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, + }; + + #ifdef DEBUG +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -34,6 +34,7 @@ + * GSCAN: enhanced scan offload feature. + * FWSUP: Firmware supplicant. + * MONITOR: firmware can pass monitor packets to host. ++ * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header + */ + #define BRCMF_FEAT_LIST \ + BRCMF_FEAT_DEF(MBSS) \ +@@ -50,7 +51,8 @@ + BRCMF_FEAT_DEF(MFP) \ + BRCMF_FEAT_DEF(GSCAN) \ + BRCMF_FEAT_DEF(FWSUP) \ +- BRCMF_FEAT_DEF(MONITOR) ++ BRCMF_FEAT_DEF(MONITOR) \ ++ BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) + + /* + * Quirks: diff --git a/package/kernel/mac80211/patches/338-v4.19-0003-brcmfmac-handle-msgbuf-packets-marked-with-monitor-m.patch b/package/kernel/mac80211/patches/338-v4.19-0003-brcmfmac-handle-msgbuf-packets-marked-with-monitor-m.patch new file mode 100644 index 000000000..d640bcfec --- /dev/null +++ b/package/kernel/mac80211/patches/338-v4.19-0003-brcmfmac-handle-msgbuf-packets-marked-with-monitor-m.patch @@ -0,0 +1,137 @@ +From a8d7631858aff156b72f807ee7cc062048e63836 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 24 Jun 2018 21:44:37 +0200 +Subject: [PATCH] brcmfmac: handle msgbuf packets marked with monitor mode flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +New Broadcom firmwares mark monitor mode packets using a newly defined +bit in the flags field. Use it to filter them out and pass to the +monitor interface. These defines were found in bcmmsgbuf.h from SDK. + +As not every firmware generates radiotap header this commit introduces +BRCMF_FEAT_MONITOR_FMT_RADIOTAP flag. It has to be has based on firmware +capabilities. If not present brcmf_netif_mon_rx() will assume packet is +a raw 802.11 frame and will prepend it with an empty radiotap header. + +This new code is limited to the msgbuf protocol at this point. Adding +support for SDIO/USB devices will require some extra work (possibly a +new firmware release). + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 25 ++++++++++++++++++++++ + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 ++ + .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 18 ++++++++++++++++ + 3 files changed, 45 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -404,6 +405,30 @@ void brcmf_netif_rx(struct brcmf_if *ifp + netif_rx_ni(skb); + } + ++void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb) ++{ ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) { ++ /* Do nothing */ ++ } else { ++ struct ieee80211_radiotap_header *radiotap; ++ ++ /* TODO: use RX status to fill some radiotap data */ ++ radiotap = skb_push(skb, sizeof(*radiotap)); ++ memset(radiotap, 0, sizeof(*radiotap)); ++ radiotap->it_len = cpu_to_le16(sizeof(*radiotap)); ++ ++ /* TODO: 4 bytes with receive status? */ ++ skb->len -= 4; ++ } ++ ++ skb->dev = ifp->ndev; ++ skb_reset_mac_header(skb); ++ skb->pkt_type = PACKET_OTHERHOST; ++ skb->protocol = htons(ETH_P_802_2); ++ ++ brcmf_netif_rx(ifp, skb); ++} ++ + static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb, + struct brcmf_if **ifp) + { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -121,6 +121,7 @@ struct brcmf_pub { + + struct brcmf_if *iflist[BRCMF_MAX_IFS]; + s32 if2bss[BRCMF_MAX_IFS]; ++ struct brcmf_if *mon_if; + + struct mutex proto_block; + unsigned char proto_buf[BRCMF_DCMD_MAXLEN]; +@@ -216,6 +217,7 @@ void brcmf_txflowblock_if(struct brcmf_i + enum brcmf_netif_stop_reason reason, bool state); + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success); + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb); ++void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb); + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on); + int __init brcmf_core_init(void); + void __exit brcmf_core_exit(void); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -69,6 +69,8 @@ + #define BRCMF_MSGBUF_MAX_EVENTBUF_POST 8 + + #define BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_3 0x01 ++#define BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_11 0x02 ++#define BRCMF_MSGBUF_PKT_FLAGS_FRAME_MASK 0x07 + #define BRCMF_MSGBUF_PKT_FLAGS_PRIO_SHIFT 5 + + #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32 +@@ -1128,6 +1130,7 @@ brcmf_msgbuf_process_rx_complete(struct + struct sk_buff *skb; + u16 data_offset; + u16 buflen; ++ u16 flags; + u32 idx; + struct brcmf_if *ifp; + +@@ -1137,6 +1140,7 @@ brcmf_msgbuf_process_rx_complete(struct + data_offset = le16_to_cpu(rx_complete->data_offset); + buflen = le16_to_cpu(rx_complete->data_len); + idx = le32_to_cpu(rx_complete->msg.request_id); ++ flags = le16_to_cpu(rx_complete->flags); + + skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, + msgbuf->rx_pktids, idx); +@@ -1150,6 +1154,20 @@ brcmf_msgbuf_process_rx_complete(struct + + skb_trim(skb, buflen); + ++ if ((flags & BRCMF_MSGBUF_PKT_FLAGS_FRAME_MASK) == ++ BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_11) { ++ ifp = msgbuf->drvr->mon_if; ++ ++ if (!ifp) { ++ brcmf_err("Received unexpected monitor pkt\n"); ++ brcmu_pkt_buf_free_skb(skb); ++ return; ++ } ++ ++ brcmf_netif_mon_rx(ifp, skb); ++ return; ++ } ++ + ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx); + if (!ifp || !ifp->ndev) { + brcmf_err("Received pkt for invalid ifidx %d\n", diff --git a/package/kernel/mac80211/patches/339-v4.19-brcmfmac-define-more-bits-for-the-flags-of-struct-br.patch b/package/kernel/mac80211/patches/339-v4.19-brcmfmac-define-more-bits-for-the-flags-of-struct-br.patch new file mode 100644 index 000000000..050370de4 --- /dev/null +++ b/package/kernel/mac80211/patches/339-v4.19-brcmfmac-define-more-bits-for-the-flags-of-struct-br.patch @@ -0,0 +1,60 @@ +From 4b4a8d808c58fc0defc32a26b2fea35d66692c45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 28 Jun 2018 08:16:13 +0200 +Subject: [PATCH] brcmfmac: define more bits for the flags of struct + brcmf_sta_info_le +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +That struct is passed by a firmware when querying for STA info. Flags +are used to indicate what info could be obtained. + +These new defines may allow passing more info to the cfg80211 in the +future. They had been obtained from Broadcom's SDK file wlioctl_defs.h +used by DD-WRT. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 29 ++++++++++++++++++---- + 1 file changed, 24 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -32,11 +32,30 @@ + #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ + #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002 + +-#define BRCMF_STA_WME 0x00000002 /* WMM association */ +-#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */ +-#define BRCMF_STA_ASSOC 0x00000010 /* Associated */ +-#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */ +-#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */ ++#define BRCMF_STA_BRCM 0x00000001 /* Running a Broadcom driver */ ++#define BRCMF_STA_WME 0x00000002 /* WMM association */ ++#define BRCMF_STA_NONERP 0x00000004 /* No ERP */ ++#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */ ++#define BRCMF_STA_ASSOC 0x00000010 /* Associated */ ++#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */ ++#define BRCMF_STA_WDS 0x00000040 /* Wireless Distribution System */ ++#define BRCMF_STA_WDS_LINKUP 0x00000080 /* WDS traffic/probes flowing properly */ ++#define BRCMF_STA_PS 0x00000100 /* STA is in power save mode from AP's viewpoint */ ++#define BRCMF_STA_APSD_BE 0x00000200 /* APSD delv/trigger for AC_BE is default enabled */ ++#define BRCMF_STA_APSD_BK 0x00000400 /* APSD delv/trigger for AC_BK is default enabled */ ++#define BRCMF_STA_APSD_VI 0x00000800 /* APSD delv/trigger for AC_VI is default enabled */ ++#define BRCMF_STA_APSD_VO 0x00001000 /* APSD delv/trigger for AC_VO is default enabled */ ++#define BRCMF_STA_N_CAP 0x00002000 /* STA 802.11n capable */ ++#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */ ++#define BRCMF_STA_AMPDU_CAP 0x00008000 /* STA AMPDU capable */ ++#define BRCMF_STA_AMSDU_CAP 0x00010000 /* STA AMSDU capable */ ++#define BRCMF_STA_MIMO_PS 0x00020000 /* mimo ps mode is enabled */ ++#define BRCMF_STA_MIMO_RTS 0x00040000 /* send rts in mimo ps mode */ ++#define BRCMF_STA_RIFS_CAP 0x00080000 /* rifs enabled */ ++#define BRCMF_STA_VHT_CAP 0x00100000 /* STA VHT(11ac) capable */ ++#define BRCMF_STA_WPS 0x00200000 /* WPS state */ ++#define BRCMF_STA_DWDS_CAP 0x01000000 /* DWDS CAP */ ++#define BRCMF_STA_DWDS 0x02000000 /* DWDS active */ + + /* size of brcmf_scan_params not including variable length array */ + #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 diff --git a/package/kernel/mac80211/patches/340-v4.19-brcmfmac-update-STA-info-struct-to-the-v5.patch b/package/kernel/mac80211/patches/340-v4.19-brcmfmac-update-STA-info-struct-to-the-v5.patch new file mode 100644 index 000000000..e0fd8d9ea --- /dev/null +++ b/package/kernel/mac80211/patches/340-v4.19-brcmfmac-update-STA-info-struct-to-the-v5.patch @@ -0,0 +1,75 @@ +From 07b1ae46874949252625c96f309f96ca0f337020 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 28 Jun 2018 12:36:23 +0200 +Subject: [PATCH] brcmfmac: update STA info struct to the v5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +That struct is used when querying firmware for the STA. It seem is has +been changing during the time. Luckily its format seems to be backward +compatible starting with v2 (the only breakage was v1 -> v2). + +The version that was supported by brcmfmac so far was v4. It was what +43602a1 and 4366b1 firmwares (7.35.177.56 and 10.10.69.3309 accordingly) +were using. It also seems to be used by early 4366c0 firmwares +(10.10.69.6908 and 10.10.69.69017). + +The problem appears when switching to the 10.10.122.20 firmware. It uses +v5 and instead of falling back to v4 when submitted buffer isn't big +enough it fallbacks to the v3. + +To receive all v4 specific info with the newest firmware we have to +submit a struct (buffer) that matches v5. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -174,6 +174,8 @@ + #define BRCMF_MFP_CAPABLE 1 + #define BRCMF_MFP_REQUIRED 2 + ++#define BRCMF_VHT_CAP_MCS_MAP_NSS_MAX 8 ++ + /* MAX_CHUNK_LEN is the maximum length for data passing to firmware in each + * ioctl. It is relatively small because firmware has small maximum size input + * playload restriction for ioctls. +@@ -550,6 +552,8 @@ struct brcmf_sta_info_le { + /* w/hi bit set if basic */ + __le32 in; /* seconds elapsed since associated */ + __le32 listen_interval_inms; /* Min Listen interval in ms for STA */ ++ ++ /* Fields valid for ver >= 3 */ + __le32 tx_pkts; /* # of packets transmitted */ + __le32 tx_failures; /* # of packets failed */ + __le32 rx_ucast_pkts; /* # of unicast packets received */ +@@ -558,6 +562,8 @@ struct brcmf_sta_info_le { + __le32 rx_rate; /* Rate of last successful rx frame */ + __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */ + __le32 rx_decrypt_failures; /* # of packet decrypted failed */ ++ ++ /* Fields valid for ver >= 4 */ + __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */ + __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */ + __le32 tx_mcast_pkts; /* # of mcast pkts txed */ +@@ -594,6 +600,14 @@ struct brcmf_sta_info_le { + */ + __le32 rx_pkts_retried; /* # rx with retry bit set */ + __le32 tx_rate_fallback; /* lowest fallback TX rate */ ++ ++ /* Fields valid for ver >= 5 */ ++ struct { ++ __le32 count; /* # rates in this set */ ++ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units w/hi bit set if basic */ ++ u8 mcs[BRCMF_MCSSET_LEN]; /* supported mcs index bit map */ ++ __le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */ ++ } rateset_adv; + }; + + struct brcmf_chanspec_list { diff --git a/package/kernel/mac80211/patches/341-v4.19-brcmfmac-specify-some-features-per-firmware-version.patch b/package/kernel/mac80211/patches/341-v4.19-brcmfmac-specify-some-features-per-firmware-version.patch new file mode 100644 index 000000000..6ebcdfdf2 --- /dev/null +++ b/package/kernel/mac80211/patches/341-v4.19-brcmfmac-specify-some-features-per-firmware-version.patch @@ -0,0 +1,84 @@ +From 1e591c56a65fbbcd5754a4210a0ef0402d5e5f33 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 9 Jul 2018 06:55:43 +0200 +Subject: [PATCH] brcmfmac: specify some features per firmware version +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some features supported by firmware aren't advertised and there is no +way for a driver to query them. This includes e.g. monitor mode details. + +Most firmwares support monitor interface but only the latest ones +/announce/ it with a "monitor" flag in the "cap" iovar. There isn't any +reliable detection method for older firmwares (BRCMF_C_MONITOR was tried +but "it only indicates the core part of the stack supports"). + +Similarly support for tagging monitor frames and building radiotap +headers can't be reliably detected for all firmwares. + +This commit adds table that allows mapping features to firmware version. +It adds mappings for 43602a1 and 4366b1 firmwares from +linux-firmware.git. Both were confirmed to be passing monitor frames. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 38 ++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -93,6 +93,42 @@ static int brcmf_feat_debugfs_read(struc + } + #endif /* DEBUG */ + ++struct brcmf_feat_fwfeat { ++ const char * const fwid; ++ u32 feat_flags; ++}; ++ ++static const struct brcmf_feat_fwfeat brcmf_feat_fwfeat_map[] = { ++ /* brcmfmac43602-pcie.ap.bin from linux-firmware.git commit ea1178515b88 */ ++ { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, ++ /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */ ++ { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) }, ++}; ++ ++static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) ++{ ++ const struct brcmf_feat_fwfeat *e; ++ u32 feat_flags = 0; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(brcmf_feat_fwfeat_map); i++) { ++ e = &brcmf_feat_fwfeat_map[i]; ++ if (!strcmp(e->fwid, drv->fwver)) { ++ feat_flags = e->feat_flags; ++ break; ++ } ++ } ++ ++ if (!feat_flags) ++ return; ++ ++ for (i = 0; i < BRCMF_FEAT_LAST; i++) ++ if (feat_flags & BIT(i)) ++ brcmf_dbg(INFO, "enabling firmware feature: %s\n", ++ brcmf_feat_names[i]); ++ drv->feat_flags |= feat_flags; ++} ++ + /** + * brcmf_feat_iovar_int_get() - determine feature through iovar query. + * +@@ -253,6 +289,8 @@ void brcmf_feat_attach(struct brcmf_pub + } + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_FWSUP, "sup_wpa"); + ++ brcmf_feat_firmware_overrides(drvr); ++ + /* set chip related quirks */ + switch (drvr->bus_if->chip) { + case BRCM_CC_43236_CHIP_ID: diff --git a/package/kernel/mac80211/patches/380-0000-ath10k-handle-tdls-peer-events.patch b/package/kernel/mac80211/patches/380-0000-ath10k-handle-tdls-peer-events.patch new file mode 100644 index 000000000..02c54600a --- /dev/null +++ b/package/kernel/mac80211/patches/380-0000-ath10k-handle-tdls-peer-events.patch @@ -0,0 +1,115 @@ +From 8ed05ed06fca0136cf4546e804318f57ef823348 Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Mon, 6 Nov 2017 13:39:32 +0530 +Subject: [PATCH] ath10k: handle tdls peer events + +Handle tdls peer events from the target. TDLS events for the peer +could be discover, teardown, etc. As of now, adding the logic to +handle tdls teardown events alone. + +Teardown due to peer traffic indication(PTR) timeout is one such +teardown event from the target. + +Tested this change on QCA9888 with 10.4-3.5.1-00018 fw version. + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/wmi.c | 72 +++++++++++++++++++++++++++++++++++ + 1 file changed, 72 insertions(+) + +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -29,6 +29,7 @@ + #include "p2p.h" + #include "hw.h" + #include "hif.h" ++#include "txrx.h" + + #define ATH10K_WMI_BARRIER_ECHO_ID 0xBA991E9 + #define ATH10K_WMI_BARRIER_TIMEOUT_HZ (3 * HZ) +@@ -4456,6 +4457,74 @@ void ath10k_wmi_event_pdev_tpc_config(st + __le32_to_cpu(ev->rate_max)); + } + ++static void ++ath10k_wmi_handle_tdls_peer_event(struct ath10k *ar, struct sk_buff *skb) ++{ ++ struct wmi_tdls_peer_event *ev; ++ struct ath10k_peer *peer; ++ struct ath10k_vif *arvif; ++ int vdev_id; ++ int peer_status; ++ int peer_reason; ++ u8 reason; ++ ++ if (skb->len < sizeof(*ev)) { ++ ath10k_err(ar, "received tdls peer event with invalid size (%d bytes)\n", ++ skb->len); ++ return; ++ } ++ ++ ev = (struct wmi_tdls_peer_event *)skb->data; ++ vdev_id = __le32_to_cpu(ev->vdev_id); ++ peer_status = __le32_to_cpu(ev->peer_status); ++ peer_reason = __le32_to_cpu(ev->peer_reason); ++ ++ spin_lock_bh(&ar->data_lock); ++ peer = ath10k_peer_find(ar, vdev_id, ev->peer_macaddr.addr); ++ spin_unlock_bh(&ar->data_lock); ++ ++ if (!peer) { ++ ath10k_warn(ar, "failed to find peer entry for %pM\n", ++ ev->peer_macaddr.addr); ++ return; ++ } ++ ++ switch (peer_status) { ++ case WMI_TDLS_SHOULD_TEARDOWN: ++ switch (peer_reason) { ++ case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: ++ case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: ++ case WMI_TDLS_TEARDOWN_REASON_RSSI: ++ reason = WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE; ++ break; ++ default: ++ reason = WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED; ++ break; ++ } ++ ++ arvif = ath10k_get_arvif(ar, vdev_id); ++ if (!arvif) { ++ ath10k_warn(ar, "received tdls peer event for invalid vdev id %u\n", ++ vdev_id); ++ return; ++ } ++ ++ ieee80211_tdls_oper_request(arvif->vif, ev->peer_macaddr.addr, ++ NL80211_TDLS_TEARDOWN, reason, ++ GFP_ATOMIC); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, ++ "received tdls teardown event for peer %pM reason %u\n", ++ ev->peer_macaddr.addr, peer_reason); ++ break; ++ default: ++ ath10k_dbg(ar, ATH10K_DBG_WMI, ++ "received unknown tdls peer event %u\n", ++ peer_status); ++ break; ++ } ++} ++ + void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, struct sk_buff *skb) + { + ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_FTM_INTG_EVENTID\n"); +@@ -5478,6 +5547,9 @@ static void ath10k_wmi_10_4_op_rx(struct + case WMI_10_4_PDEV_TPC_CONFIG_EVENTID: + ath10k_wmi_event_pdev_tpc_config(ar, skb); + break; ++ case WMI_10_4_TDLS_PEER_EVENTID: ++ ath10k_wmi_handle_tdls_peer_event(ar, skb); ++ break; + default: + ath10k_warn(ar, "Unknown eventid: %d\n", id); + break; diff --git a/package/kernel/mac80211/patches/380-0001-ath10k-wmi-modify-svc-bitmap-parsing-for-wcn3990.patch b/package/kernel/mac80211/patches/380-0001-ath10k-wmi-modify-svc-bitmap-parsing-for-wcn3990.patch new file mode 100644 index 000000000..678813627 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0001-ath10k-wmi-modify-svc-bitmap-parsing-for-wcn3990.patch @@ -0,0 +1,215 @@ +From 229329ff345f80c95202eaf2d7a0f2910c06144e Mon Sep 17 00:00:00 2001 +From: Rakesh Pillai +Date: Mon, 11 Dec 2017 19:52:52 +0530 +Subject: [PATCH] ath10k: wmi: modify svc bitmap parsing for wcn3990 + +Due to the limitation of wmi tlv parsing logic, if there are +two parameters in a wmi event with same tlv tag, we can get only +the last value, as it overwrites the prev value of the same tlv tag. + +The service ready event in wcn3990 contains two parameters of the +same tag UINT32, due to which the svc bitmap is overwritten with the +DBS support parameter. + +Refactor the service ready event parsing to allow parsing two tlv +of the same tag UINT32 for wcn3990. + +Signed-off-by: Rakesh Pillai +Signed-off-by: Govind Singh +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/mac.c | 4 +- + drivers/net/wireless/ath/ath10k/wmi-tlv.c | 61 ++++++++++++++++++++++++------- + drivers/net/wireless/ath/ath10k/wmi-tlv.h | 46 +++++++++++++++++++++++ + drivers/net/wireless/ath/ath10k/wmi.h | 1 + + 4 files changed, 97 insertions(+), 15 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -3574,7 +3574,9 @@ ath10k_mac_tx_h_get_txpath(struct ath10k + return ATH10K_MAC_TX_HTT; + case ATH10K_HW_TXRX_MGMT: + if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX, +- ar->running_fw->fw_file.fw_features)) ++ ar->running_fw->fw_file.fw_features) || ++ test_bit(WMI_SERVICE_MGMT_TX_WMI, ++ ar->wmi.svc_map)) + return ATH10K_MAC_TX_WMI_MGMT; + else if (ar->htt.target_version_major >= 3) + return ATH10K_MAC_TX_HTT; +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -917,33 +917,69 @@ ath10k_wmi_tlv_parse_mem_reqs(struct ath + return -ENOMEM; + } + ++struct wmi_tlv_svc_rdy_parse { ++ const struct hal_reg_capabilities *reg; ++ const struct wmi_tlv_svc_rdy_ev *ev; ++ const __le32 *svc_bmap; ++ const struct wlan_host_mem_req *mem_reqs; ++ bool svc_bmap_done; ++ bool dbs_hw_mode_done; ++}; ++ ++static int ath10k_wmi_tlv_svc_rdy_parse(struct ath10k *ar, u16 tag, u16 len, ++ const void *ptr, void *data) ++{ ++ struct wmi_tlv_svc_rdy_parse *svc_rdy = data; ++ ++ switch (tag) { ++ case WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT: ++ svc_rdy->ev = ptr; ++ break; ++ case WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES: ++ svc_rdy->reg = ptr; ++ break; ++ case WMI_TLV_TAG_ARRAY_STRUCT: ++ svc_rdy->mem_reqs = ptr; ++ break; ++ case WMI_TLV_TAG_ARRAY_UINT32: ++ if (!svc_rdy->svc_bmap_done) { ++ svc_rdy->svc_bmap_done = true; ++ svc_rdy->svc_bmap = ptr; ++ } else if (!svc_rdy->dbs_hw_mode_done) { ++ svc_rdy->dbs_hw_mode_done = true; ++ } ++ break; ++ default: ++ break; ++ } ++ return 0; ++} ++ + static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct ath10k *ar, + struct sk_buff *skb, + struct wmi_svc_rdy_ev_arg *arg) + { +- const void **tb; + const struct hal_reg_capabilities *reg; + const struct wmi_tlv_svc_rdy_ev *ev; + const __le32 *svc_bmap; + const struct wlan_host_mem_req *mem_reqs; ++ struct wmi_tlv_svc_rdy_parse svc_rdy = { }; + int ret; + +- tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); +- if (IS_ERR(tb)) { +- ret = PTR_ERR(tb); ++ ret = ath10k_wmi_tlv_iter(ar, skb->data, skb->len, ++ ath10k_wmi_tlv_svc_rdy_parse, &svc_rdy); ++ if (ret) { + ath10k_warn(ar, "failed to parse tlv: %d\n", ret); + return ret; + } + +- ev = tb[WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT]; +- reg = tb[WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES]; +- svc_bmap = tb[WMI_TLV_TAG_ARRAY_UINT32]; +- mem_reqs = tb[WMI_TLV_TAG_ARRAY_STRUCT]; ++ ev = svc_rdy.ev; ++ reg = svc_rdy.reg; ++ svc_bmap = svc_rdy.svc_bmap; ++ mem_reqs = svc_rdy.mem_reqs; + +- if (!ev || !reg || !svc_bmap || !mem_reqs) { +- kfree(tb); ++ if (!ev || !reg || !svc_bmap || !mem_reqs) + return -EPROTO; +- } + + /* This is an internal ABI compatibility check for WMI TLV so check it + * here instead of the generic WMI code. +@@ -961,7 +997,6 @@ static int ath10k_wmi_tlv_op_pull_svc_rd + __le32_to_cpu(ev->abi.abi_ver_ns1) != WMI_TLV_ABI_VER_NS1 || + __le32_to_cpu(ev->abi.abi_ver_ns2) != WMI_TLV_ABI_VER_NS2 || + __le32_to_cpu(ev->abi.abi_ver_ns3) != WMI_TLV_ABI_VER_NS3) { +- kfree(tb); + return -ENOTSUPP; + } + +@@ -982,12 +1017,10 @@ static int ath10k_wmi_tlv_op_pull_svc_rd + ret = ath10k_wmi_tlv_iter(ar, mem_reqs, ath10k_wmi_tlv_len(mem_reqs), + ath10k_wmi_tlv_parse_mem_reqs, arg); + if (ret) { +- kfree(tb); + ath10k_warn(ar, "failed to parse mem_reqs tlv: %d\n", ret); + return ret; + } + +- kfree(tb); + return 0; + } + +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h +@@ -965,6 +965,50 @@ enum wmi_tlv_service { + WMI_TLV_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT, + WMI_TLV_SERVICE_MDNS_OFFLOAD, + WMI_TLV_SERVICE_SAP_AUTH_OFFLOAD, ++ WMI_TLV_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT, ++ WMI_TLV_SERVICE_OCB, ++ WMI_TLV_SERVICE_AP_ARPNS_OFFLOAD, ++ WMI_TLV_SERVICE_PER_BAND_CHAINMASK_SUPPORT, ++ WMI_TLV_SERVICE_PACKET_FILTER_OFFLOAD, ++ WMI_TLV_SERVICE_MGMT_TX_HTT, ++ WMI_TLV_SERVICE_MGMT_TX_WMI, ++ WMI_TLV_SERVICE_EXT_MSG, ++ WMI_TLV_SERVICE_MAWC, ++ WMI_TLV_SERVICE_PEER_ASSOC_CONF, ++ WMI_TLV_SERVICE_EGAP, ++ WMI_TLV_SERVICE_STA_PMF_OFFLOAD, ++ WMI_TLV_SERVICE_UNIFIED_WOW_CAPABILITY, ++ WMI_TLV_SERVICE_ENHANCED_PROXY_STA, ++ WMI_TLV_SERVICE_ATF, ++ WMI_TLV_SERVICE_COEX_GPIO, ++ WMI_TLV_SERVICE_AUX_SPECTRAL_INTF, ++ WMI_TLV_SERVICE_AUX_CHAN_LOAD_INTF, ++ WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ++ WMI_TLV_SERVICE_ENTERPRISE_MESH, ++ WMI_TLV_SERVICE_RESTRT_CHNL_SUPPORT, ++ WMI_TLV_SERVICE_BPF_OFFLOAD, ++ WMI_TLV_SERVICE_SYNC_DELETE_CMDS, ++ WMI_TLV_SERVICE_SMART_ANTENNA_SW_SUPPORT, ++ WMI_TLV_SERVICE_SMART_ANTENNA_HW_SUPPORT, ++ WMI_TLV_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES, ++ WMI_TLV_SERVICE_NAN_DATA, ++ WMI_TLV_SERVICE_NAN_RTT, ++ WMI_TLV_SERVICE_11AX, ++ WMI_TLV_SERVICE_DEPRECATED_REPLACE, ++ WMI_TLV_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, ++ WMI_TLV_SERVICE_ENHANCED_MCAST_FILTER, ++ WMI_TLV_SERVICE_PERIODIC_CHAN_STAT_SUPPORT, ++ WMI_TLV_SERVICE_MESH_11S, ++ WMI_TLV_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT, ++ WMI_TLV_SERVICE_VDEV_RX_FILTER, ++ WMI_TLV_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT, ++ WMI_TLV_SERVICE_MARK_FIRST_WAKEUP_PACKET, ++ WMI_TLV_SERVICE_MULTIPLE_MCAST_FILTER_SET, ++ WMI_TLV_SERVICE_HOST_MANAGED_RX_REORDER, ++ WMI_TLV_SERVICE_FLASH_RDWR_SUPPORT, ++ WMI_TLV_SERVICE_WLAN_STATS_REPORT, ++ WMI_TLV_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT, ++ WMI_TLV_SERVICE_DFS_PHYERR_OFFLOAD, + }; + + #define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \ +@@ -1121,6 +1165,8 @@ wmi_tlv_svc_map(const __le32 *in, unsign + WMI_SERVICE_MDNS_OFFLOAD, len); + SVCMAP(WMI_TLV_SERVICE_SAP_AUTH_OFFLOAD, + WMI_SERVICE_SAP_AUTH_OFFLOAD, len); ++ SVCMAP(WMI_TLV_SERVICE_MGMT_TX_WMI, ++ WMI_SERVICE_MGMT_TX_WMI, len); + } + + #undef SVCMAP +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -195,6 +195,7 @@ enum wmi_service { + WMI_SERVICE_SMART_LOGGING_SUPPORT, + WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, + WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ++ WMI_SERVICE_MGMT_TX_WMI, + + /* keep last */ + WMI_SERVICE_MAX, diff --git a/package/kernel/mac80211/patches/380-0002-ath10k-advertise-TDLS-wider-bandwidth-support-for-5G.patch b/package/kernel/mac80211/patches/380-0002-ath10k-advertise-TDLS-wider-bandwidth-support-for-5G.patch new file mode 100644 index 000000000..b52451c92 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0002-ath10k-advertise-TDLS-wider-bandwidth-support-for-5G.patch @@ -0,0 +1,64 @@ +From 14d65775687cb3a6f76a52f48f4be27a522bb396 Mon Sep 17 00:00:00 2001 +From: Balaji Pothunoori +Date: Thu, 21 Dec 2017 20:00:42 +0530 +Subject: [PATCH] ath10k: advertise TDLS wider bandwidth support for 5GHz + +Enable TDLS wider bandwidth support for 5GHz based on firmware wmi capabilities. + +This patch is required for chipset QCA9888. Tested with firmware version +10.4-3.5.1-00018. + +Signed-off-by: Balaji Pothunoori +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/mac.c | 3 ++- + drivers/net/wireless/ath/ath10k/wmi.h | 5 +++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -8236,7 +8236,8 @@ int ath10k_mac_register(struct ath10k *a + if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) || + test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) { + ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; +- ieee80211_hw_set(ar->hw, TDLS_WIDER_BW); ++ if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map)) ++ ieee80211_hw_set(ar->hw, TDLS_WIDER_BW); + } + + ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -196,6 +196,7 @@ enum wmi_service { + WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, + WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, + WMI_SERVICE_MGMT_TX_WMI, ++ WMI_SERVICE_TDLS_WIDER_BANDWIDTH, + + /* keep last */ + WMI_SERVICE_MAX, +@@ -337,6 +338,7 @@ enum wmi_10_4_service { + WMI_10_4_SERVICE_TDLS_UAPSD_SLEEP_STA, + WMI_10_4_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, + WMI_10_4_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ++ WMI_10_4_SERVICE_TDLS_WIDER_BANDWIDTH, + }; + + static inline char *wmi_service_name(int service_id) +@@ -445,6 +447,7 @@ static inline char *wmi_service_name(int + SVCSTR(WMI_SERVICE_SMART_LOGGING_SUPPORT); + SVCSTR(WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE); + SVCSTR(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY); ++ SVCSTR(WMI_SERVICE_TDLS_WIDER_BANDWIDTH); + default: + return NULL; + } +@@ -741,6 +744,8 @@ static inline void wmi_10_4_svc_map(cons + WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, len); + SVCMAP(WMI_10_4_SERVICE_TDLS_EXPLICIT_MODE_ONLY, + WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, len); ++ SVCMAP(WMI_10_4_SERVICE_TDLS_WIDER_BANDWIDTH, ++ WMI_SERVICE_TDLS_WIDER_BANDWIDTH, len); + } + + #undef SVCMAP diff --git a/package/kernel/mac80211/patches/380-0003-ath10k-debugfs-support-to-get-final-TPC-stats-for-10.patch b/package/kernel/mac80211/patches/380-0003-ath10k-debugfs-support-to-get-final-TPC-stats-for-10.patch new file mode 100644 index 000000000..2e828c426 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0003-ath10k-debugfs-support-to-get-final-TPC-stats-for-10.patch @@ -0,0 +1,824 @@ +From bc64d05220f3e34cf432a166b83c8fff14cd7a3d Mon Sep 17 00:00:00 2001 +From: Maharaja Kennadyrajan +Date: Wed, 14 Mar 2018 12:14:08 +0200 +Subject: [PATCH] ath10k: debugfs support to get final TPC stats for 10.4 + variants + +Export the final Transmit Power Control (TPC) value, which is the +minimum of control power and existing TPC value to user space via +a new debugfs file "tpc_stats_final" to help with debugging. +It works with the new wmi cmd and event introduced in 10.4 firmware +branch. + +WMI command ID: WMI_PDEV_GET_TPC_TABLE_CMDID +WMI event ID: WMI_PDEV_TPC_TABLE_EVENTID + +cat /sys/kernel/debug/ieee80211/phyX/ath10k/tpc_stats_final + +$ cat /sys/kernel/debug/ieee80211/phyX/ath10k/tpc_stats_final + +TPC config for channel 5180 mode 10 + +CTL = 0x 0 Reg. Domain = 58 +Antenna Gain = 0 Reg. Max Antenna Gain = 0 +Power Limit = 60 Reg. Max Power = 60 +Num tx chains = 2 Num supported rates = 109 + +******************* CDD POWER TABLE **************** + +No. Preamble Rate_code tpc_value1 tpc_value2 tpc_value3 +0 CCK 0x40 0 0 +1 CCK 0x41 0 0 +[...] +107 HTCUP 0x 0 46 46 +108 HTCUP 0x 0 46 46 + +******************* STBC POWER TABLE **************** + +No. Preamble Rate_code tpc_value1 tpc_value2 tpc_value3 +0 CCK 0x40 0 0 +1 CCK 0x41 0 0 +[...] +107 HTCUP 0x 0 46 46 +108 HTCUP 0x 0 46 46 + +*********************************** +TXBF not supported +********************************** + +The existing tpc_stats debugfs file provides the dump +which is minimum of target power and regulatory domain. + +cat /sys/kernel/debug/ieee80211/phyX/ath10k/tpc_stats + +Hardware_used: QCA4019 +Firmware version: firmware-5.bin_10.4-3.0-00209 + +Signed-off-by: Maharaja Kennadyrajan +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/core.h | 22 +++ + drivers/net/wireless/ath/ath10k/debug.c | 107 +++++++++++ + drivers/net/wireless/ath/ath10k/debug.h | 10 + + drivers/net/wireless/ath/ath10k/wmi-ops.h | 20 ++ + drivers/net/wireless/ath/ath10k/wmi.c | 308 ++++++++++++++++++++++++++++-- + drivers/net/wireless/ath/ath10k/wmi.h | 66 +++++++ + 6 files changed, 518 insertions(+), 15 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -322,6 +322,27 @@ struct ath10k_tpc_stats { + struct ath10k_tpc_table tpc_table[WMI_TPC_FLAG]; + }; + ++struct ath10k_tpc_table_final { ++ u32 pream_idx[WMI_TPC_FINAL_RATE_MAX]; ++ u8 rate_code[WMI_TPC_FINAL_RATE_MAX]; ++ char tpc_value[WMI_TPC_FINAL_RATE_MAX][WMI_TPC_TX_N_CHAIN * WMI_TPC_BUF_SIZE]; ++}; ++ ++struct ath10k_tpc_stats_final { ++ u32 reg_domain; ++ u32 chan_freq; ++ u32 phy_mode; ++ u32 twice_antenna_reduction; ++ u32 twice_max_rd_power; ++ s32 twice_antenna_gain; ++ u32 power_limit; ++ u32 num_tx_chain; ++ u32 ctl; ++ u32 rate_max; ++ u8 flag[WMI_TPC_FLAG]; ++ struct ath10k_tpc_table_final tpc_table_final[WMI_TPC_FLAG]; ++}; ++ + struct ath10k_dfs_stats { + u32 phy_errors; + u32 pulses_total; +@@ -482,6 +503,7 @@ struct ath10k_debug { + + /* used for tpc-dump storage, protected by data-lock */ + struct ath10k_tpc_stats *tpc_stats; ++ struct ath10k_tpc_stats_final *tpc_stats_final; + + struct completion tpc_complete; + +--- a/drivers/net/wireless/ath/ath10k/debug.c ++++ b/drivers/net/wireless/ath/ath10k/debug.c +@@ -1737,6 +1737,19 @@ void ath10k_debug_tpc_stats_process(stru + spin_unlock_bh(&ar->data_lock); + } + ++void ++ath10k_debug_tpc_stats_final_process(struct ath10k *ar, ++ struct ath10k_tpc_stats_final *tpc_stats) ++{ ++ spin_lock_bh(&ar->data_lock); ++ ++ kfree(ar->debug.tpc_stats_final); ++ ar->debug.tpc_stats_final = tpc_stats; ++ complete(&ar->debug.tpc_complete); ++ ++ spin_unlock_bh(&ar->data_lock); ++} ++ + static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats, + unsigned int j, char *buf, size_t *len) + { +@@ -2400,6 +2413,95 @@ static const struct file_operations fops + .llseek = default_llseek, + }; + ++static int ath10k_debug_tpc_stats_final_request(struct ath10k *ar) ++{ ++ int ret; ++ unsigned long time_left; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ reinit_completion(&ar->debug.tpc_complete); ++ ++ ret = ath10k_wmi_pdev_get_tpc_table_cmdid(ar, WMI_TPC_CONFIG_PARAM); ++ if (ret) { ++ ath10k_warn(ar, "failed to request tpc table cmdid: %d\n", ret); ++ return ret; ++ } ++ ++ time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, ++ 1 * HZ); ++ if (time_left == 0) ++ return -ETIMEDOUT; ++ ++ return 0; ++} ++ ++static int ath10k_tpc_stats_final_open(struct inode *inode, struct file *file) ++{ ++ struct ath10k *ar = inode->i_private; ++ void *buf; ++ int ret; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ if (ar->state != ATH10K_STATE_ON) { ++ ret = -ENETDOWN; ++ goto err_unlock; ++ } ++ ++ buf = vmalloc(ATH10K_TPC_CONFIG_BUF_SIZE); ++ if (!buf) { ++ ret = -ENOMEM; ++ goto err_unlock; ++ } ++ ++ ret = ath10k_debug_tpc_stats_final_request(ar); ++ if (ret) { ++ ath10k_warn(ar, "failed to request tpc stats final: %d\n", ++ ret); ++ goto err_free; ++ } ++ ++ ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); ++ file->private_data = buf; ++ ++ mutex_unlock(&ar->conf_mutex); ++ return 0; ++ ++err_free: ++ vfree(buf); ++ ++err_unlock: ++ mutex_unlock(&ar->conf_mutex); ++ return ret; ++} ++ ++static int ath10k_tpc_stats_final_release(struct inode *inode, ++ struct file *file) ++{ ++ vfree(file->private_data); ++ ++ return 0; ++} ++ ++static ssize_t ath10k_tpc_stats_final_read(struct file *file, ++ char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ const char *buf = file->private_data; ++ unsigned int len = strlen(buf); ++ ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static const struct file_operations fops_tpc_stats_final = { ++ .open = ath10k_tpc_stats_final_open, ++ .release = ath10k_tpc_stats_final_release, ++ .read = ath10k_tpc_stats_final_read, ++ .owner = THIS_MODULE, ++ .llseek = default_llseek, ++}; ++ + int ath10k_debug_create(struct ath10k *ar) + { + ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data)); +@@ -2525,6 +2627,11 @@ int ath10k_debug_register(struct ath10k + debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar, + &fops_fw_checksums); + ++ if (test_bit(WMI_SERVICE_TPC_STATS_FINAL, ar->wmi.svc_map)) ++ debugfs_create_file("tpc_stats_final", 0400, ++ ar->debug.debugfs_phy, ar, ++ &fops_tpc_stats_final); ++ + return 0; + } + +--- a/drivers/net/wireless/ath/ath10k/debug.h ++++ b/drivers/net/wireless/ath/ath10k/debug.h +@@ -84,6 +84,9 @@ void ath10k_debug_unregister(struct ath1 + void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb); + void ath10k_debug_tpc_stats_process(struct ath10k *ar, + struct ath10k_tpc_stats *tpc_stats); ++void ++ath10k_debug_tpc_stats_final_process(struct ath10k *ar, ++ struct ath10k_tpc_stats_final *tpc_stats); + struct ath10k_fw_crash_data * + ath10k_debug_get_new_fw_crash_data(struct ath10k *ar); + +@@ -151,6 +154,13 @@ static inline void ath10k_debug_tpc_stat + { + kfree(tpc_stats); + } ++ ++static inline void ++ath10k_debug_tpc_stats_final_process(struct ath10k *ar, ++ struct ath10k_tpc_stats_final *tpc_stats) ++{ ++ kfree(tpc_stats); ++} + + static inline void ath10k_debug_dbglog_add(struct ath10k *ar, u8 *buffer, + int len) +--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h ++++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h +@@ -197,6 +197,9 @@ struct wmi_ops { + (struct ath10k *ar, + enum wmi_bss_survey_req_type type); + struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); ++ struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar, ++ u32 param); ++ + }; + + int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); +@@ -1418,4 +1421,21 @@ ath10k_wmi_echo(struct ath10k *ar, u32 v + return ath10k_wmi_cmd_send(ar, skb, wmi->cmd->echo_cmdid); + } + ++static inline int ++ath10k_wmi_pdev_get_tpc_table_cmdid(struct ath10k *ar, u32 param) ++{ ++ struct sk_buff *skb; ++ ++ if (!ar->wmi.ops->gen_pdev_get_tpc_table_cmdid) ++ return -EOPNOTSUPP; ++ ++ skb = ar->wmi.ops->gen_pdev_get_tpc_table_cmdid(ar, param); ++ ++ if (IS_ERR(skb)) ++ return PTR_ERR(skb); ++ ++ return ath10k_wmi_cmd_send(ar, skb, ++ ar->wmi.cmd->pdev_get_tpc_table_cmdid); ++} ++ + #endif +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -1,6 +1,7 @@ + /* + * Copyright (c) 2005-2011 Atheros Communications Inc. + * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. ++ * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -196,6 +197,7 @@ static struct wmi_cmd_map wmi_cmd_map = + .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED, + .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, ++ .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, + }; + + /* 10.X WMI cmd track */ +@@ -362,6 +364,7 @@ static struct wmi_cmd_map wmi_10x_cmd_ma + .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED, + .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, ++ .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, + }; + + /* 10.2.4 WMI cmd track */ +@@ -528,6 +531,7 @@ static struct wmi_cmd_map wmi_10_2_4_cmd + .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_bss_chan_info_request_cmdid = + WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID, ++ .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, + }; + + /* 10.4 WMI cmd track */ +@@ -1480,6 +1484,7 @@ static struct wmi_cmd_map wmi_10_2_cmd_m + .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED, ++ .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, + }; + + static struct wmi_pdev_param_map wmi_10_4_pdev_param_map = { +@@ -4313,19 +4318,11 @@ static void ath10k_tpc_config_disp_table + } + } + +-void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb) ++void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table, ++ u32 num_tx_chain) + { +- u32 i, j, pream_idx, num_tx_chain; +- u8 rate_code[WMI_TPC_RATE_MAX], rate_idx; +- u16 pream_table[WMI_TPC_PREAM_TABLE_MAX]; +- struct wmi_pdev_tpc_config_event *ev; +- struct ath10k_tpc_stats *tpc_stats; +- +- ev = (struct wmi_pdev_tpc_config_event *)skb->data; +- +- tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); +- if (!tpc_stats) +- return; ++ u32 i, j, pream_idx; ++ u8 rate_idx; + + /* Create the rate code table based on the chains supported */ + rate_idx = 0; +@@ -4349,8 +4346,6 @@ void ath10k_wmi_event_pdev_tpc_config(st + pream_table[pream_idx] = rate_idx; + pream_idx++; + +- num_tx_chain = __le32_to_cpu(ev->num_tx_chain); +- + /* Fill HT20 rate code */ + for (i = 0; i < num_tx_chain; i++) { + for (j = 0; j < 8; j++) { +@@ -4374,7 +4369,7 @@ void ath10k_wmi_event_pdev_tpc_config(st + pream_idx++; + + /* Fill VHT20 rate code */ +- for (i = 0; i < __le32_to_cpu(ev->num_tx_chain); i++) { ++ for (i = 0; i < num_tx_chain; i++) { + for (j = 0; j < 10; j++) { + rate_code[rate_idx] = + ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT); +@@ -4418,6 +4413,26 @@ void ath10k_wmi_event_pdev_tpc_config(st + ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM); + + pream_table[pream_idx] = ATH10K_TPC_PREAM_TABLE_END; ++} ++ ++void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb) ++{ ++ u32 num_tx_chain; ++ u8 rate_code[WMI_TPC_RATE_MAX]; ++ u16 pream_table[WMI_TPC_PREAM_TABLE_MAX]; ++ struct wmi_pdev_tpc_config_event *ev; ++ struct ath10k_tpc_stats *tpc_stats; ++ ++ ev = (struct wmi_pdev_tpc_config_event *)skb->data; ++ ++ tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); ++ if (!tpc_stats) ++ return; ++ ++ num_tx_chain = __le32_to_cpu(ev->num_tx_chain); ++ ++ ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table, ++ num_tx_chain); + + tpc_stats->chan_freq = __le32_to_cpu(ev->chan_freq); + tpc_stats->phy_mode = __le32_to_cpu(ev->phy_mode); +@@ -4457,6 +4472,246 @@ void ath10k_wmi_event_pdev_tpc_config(st + __le32_to_cpu(ev->rate_max)); + } + ++static u8 ++ath10k_wmi_tpc_final_get_rate(struct ath10k *ar, ++ struct wmi_pdev_tpc_final_table_event *ev, ++ u32 rate_idx, u32 num_chains, ++ u32 rate_code, u8 type, u32 pream_idx) ++{ ++ u8 tpc, num_streams, preamble, ch, stm_idx; ++ s8 pow_agcdd, pow_agstbc, pow_agtxbf; ++ int pream; ++ ++ num_streams = ATH10K_HW_NSS(rate_code); ++ preamble = ATH10K_HW_PREAMBLE(rate_code); ++ ch = num_chains - 1; ++ stm_idx = num_streams - 1; ++ pream = -1; ++ ++ if (__le32_to_cpu(ev->chan_freq) <= 2483) { ++ switch (pream_idx) { ++ case WMI_TPC_PREAM_2GHZ_CCK: ++ pream = 0; ++ break; ++ case WMI_TPC_PREAM_2GHZ_OFDM: ++ pream = 1; ++ break; ++ case WMI_TPC_PREAM_2GHZ_HT20: ++ case WMI_TPC_PREAM_2GHZ_VHT20: ++ pream = 2; ++ break; ++ case WMI_TPC_PREAM_2GHZ_HT40: ++ case WMI_TPC_PREAM_2GHZ_VHT40: ++ pream = 3; ++ break; ++ case WMI_TPC_PREAM_2GHZ_VHT80: ++ pream = 4; ++ break; ++ default: ++ pream = -1; ++ break; ++ } ++ } ++ ++ if (__le32_to_cpu(ev->chan_freq) >= 5180) { ++ switch (pream_idx) { ++ case WMI_TPC_PREAM_5GHZ_OFDM: ++ pream = 0; ++ break; ++ case WMI_TPC_PREAM_5GHZ_HT20: ++ case WMI_TPC_PREAM_5GHZ_VHT20: ++ pream = 1; ++ break; ++ case WMI_TPC_PREAM_5GHZ_HT40: ++ case WMI_TPC_PREAM_5GHZ_VHT40: ++ pream = 2; ++ break; ++ case WMI_TPC_PREAM_5GHZ_VHT80: ++ pream = 3; ++ break; ++ case WMI_TPC_PREAM_5GHZ_HTCUP: ++ pream = 4; ++ break; ++ default: ++ pream = -1; ++ break; ++ } ++ } ++ ++ if (pream == 4) ++ tpc = min_t(u8, ev->rates_array[rate_idx], ++ ev->max_reg_allow_pow[ch]); ++ else ++ tpc = min_t(u8, min_t(u8, ev->rates_array[rate_idx], ++ ev->max_reg_allow_pow[ch]), ++ ev->ctl_power_table[0][pream][stm_idx]); ++ ++ if (__le32_to_cpu(ev->num_tx_chain) <= 1) ++ goto out; ++ ++ if (preamble == WMI_RATE_PREAMBLE_CCK) ++ goto out; ++ ++ if (num_chains <= num_streams) ++ goto out; ++ ++ switch (type) { ++ case WMI_TPC_TABLE_TYPE_STBC: ++ pow_agstbc = ev->max_reg_allow_pow_agstbc[ch - 1][stm_idx]; ++ if (pream == 4) ++ tpc = min_t(u8, tpc, pow_agstbc); ++ else ++ tpc = min_t(u8, min_t(u8, tpc, pow_agstbc), ++ ev->ctl_power_table[0][pream][stm_idx]); ++ break; ++ case WMI_TPC_TABLE_TYPE_TXBF: ++ pow_agtxbf = ev->max_reg_allow_pow_agtxbf[ch - 1][stm_idx]; ++ if (pream == 4) ++ tpc = min_t(u8, tpc, pow_agtxbf); ++ else ++ tpc = min_t(u8, min_t(u8, tpc, pow_agtxbf), ++ ev->ctl_power_table[1][pream][stm_idx]); ++ break; ++ case WMI_TPC_TABLE_TYPE_CDD: ++ pow_agcdd = ev->max_reg_allow_pow_agcdd[ch - 1][stm_idx]; ++ if (pream == 4) ++ tpc = min_t(u8, tpc, pow_agcdd); ++ else ++ tpc = min_t(u8, min_t(u8, tpc, pow_agcdd), ++ ev->ctl_power_table[0][pream][stm_idx]); ++ break; ++ default: ++ ath10k_warn(ar, "unknown wmi tpc final table type: %d\n", type); ++ tpc = 0; ++ break; ++ } ++ ++out: ++ return tpc; ++} ++ ++static void ++ath10k_wmi_tpc_stats_final_disp_tables(struct ath10k *ar, ++ struct wmi_pdev_tpc_final_table_event *ev, ++ struct ath10k_tpc_stats_final *tpc_stats, ++ u8 *rate_code, u16 *pream_table, u8 type) ++{ ++ u32 i, j, pream_idx, flags; ++ u8 tpc[WMI_TPC_TX_N_CHAIN]; ++ char tpc_value[WMI_TPC_TX_N_CHAIN * WMI_TPC_BUF_SIZE]; ++ char buff[WMI_TPC_BUF_SIZE]; ++ ++ flags = __le32_to_cpu(ev->flags); ++ ++ switch (type) { ++ case WMI_TPC_TABLE_TYPE_CDD: ++ if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_CDD)) { ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "CDD not supported\n"); ++ tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG; ++ return; ++ } ++ break; ++ case WMI_TPC_TABLE_TYPE_STBC: ++ if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_STBC)) { ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "STBC not supported\n"); ++ tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG; ++ return; ++ } ++ break; ++ case WMI_TPC_TABLE_TYPE_TXBF: ++ if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_TXBF)) { ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "TXBF not supported\n"); ++ tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG; ++ return; ++ } ++ break; ++ default: ++ ath10k_dbg(ar, ATH10K_DBG_WMI, ++ "invalid table type in wmi tpc event: %d\n", type); ++ return; ++ } ++ ++ pream_idx = 0; ++ for (i = 0; i < __le32_to_cpu(ev->rate_max); i++) { ++ memset(tpc_value, 0, sizeof(tpc_value)); ++ memset(buff, 0, sizeof(buff)); ++ if (i == pream_table[pream_idx]) ++ pream_idx++; ++ ++ for (j = 0; j < WMI_TPC_TX_N_CHAIN; j++) { ++ if (j >= __le32_to_cpu(ev->num_tx_chain)) ++ break; ++ ++ tpc[j] = ath10k_wmi_tpc_final_get_rate(ar, ev, i, j + 1, ++ rate_code[i], ++ type, pream_idx); ++ snprintf(buff, sizeof(buff), "%8d ", tpc[j]); ++ strncat(tpc_value, buff, strlen(buff)); ++ } ++ tpc_stats->tpc_table_final[type].pream_idx[i] = pream_idx; ++ tpc_stats->tpc_table_final[type].rate_code[i] = rate_code[i]; ++ memcpy(tpc_stats->tpc_table_final[type].tpc_value[i], ++ tpc_value, sizeof(tpc_value)); ++ } ++} ++ ++void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb) ++{ ++ u32 num_tx_chain; ++ u8 rate_code[WMI_TPC_FINAL_RATE_MAX]; ++ u16 pream_table[WMI_TPC_PREAM_TABLE_MAX]; ++ struct wmi_pdev_tpc_final_table_event *ev; ++ struct ath10k_tpc_stats_final *tpc_stats; ++ ++ ev = (struct wmi_pdev_tpc_final_table_event *)skb->data; ++ ++ tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); ++ if (!tpc_stats) ++ return; ++ ++ num_tx_chain = __le32_to_cpu(ev->num_tx_chain); ++ ++ ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table, ++ num_tx_chain); ++ ++ tpc_stats->chan_freq = __le32_to_cpu(ev->chan_freq); ++ tpc_stats->phy_mode = __le32_to_cpu(ev->phy_mode); ++ tpc_stats->ctl = __le32_to_cpu(ev->ctl); ++ tpc_stats->reg_domain = __le32_to_cpu(ev->reg_domain); ++ tpc_stats->twice_antenna_gain = a_sle32_to_cpu(ev->twice_antenna_gain); ++ tpc_stats->twice_antenna_reduction = ++ __le32_to_cpu(ev->twice_antenna_reduction); ++ tpc_stats->power_limit = __le32_to_cpu(ev->power_limit); ++ tpc_stats->twice_max_rd_power = __le32_to_cpu(ev->twice_max_rd_power); ++ tpc_stats->num_tx_chain = __le32_to_cpu(ev->num_tx_chain); ++ tpc_stats->rate_max = __le32_to_cpu(ev->rate_max); ++ ++ ath10k_wmi_tpc_stats_final_disp_tables(ar, ev, tpc_stats, ++ rate_code, pream_table, ++ WMI_TPC_TABLE_TYPE_CDD); ++ ath10k_wmi_tpc_stats_final_disp_tables(ar, ev, tpc_stats, ++ rate_code, pream_table, ++ WMI_TPC_TABLE_TYPE_STBC); ++ ath10k_wmi_tpc_stats_final_disp_tables(ar, ev, tpc_stats, ++ rate_code, pream_table, ++ WMI_TPC_TABLE_TYPE_TXBF); ++ ++ ath10k_debug_tpc_stats_final_process(ar, tpc_stats); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, ++ "wmi event tpc final table channel %d mode %d ctl %d regd %d gain %d %d limit %d max_power %d tx_chanins %d rates %d\n", ++ __le32_to_cpu(ev->chan_freq), ++ __le32_to_cpu(ev->phy_mode), ++ __le32_to_cpu(ev->ctl), ++ __le32_to_cpu(ev->reg_domain), ++ a_sle32_to_cpu(ev->twice_antenna_gain), ++ __le32_to_cpu(ev->twice_antenna_reduction), ++ __le32_to_cpu(ev->power_limit), ++ __le32_to_cpu(ev->twice_max_rd_power) / 2, ++ __le32_to_cpu(ev->num_tx_chain), ++ __le32_to_cpu(ev->rate_max)); ++} ++ + static void + ath10k_wmi_handle_tdls_peer_event(struct ath10k *ar, struct sk_buff *skb) + { +@@ -5550,6 +5805,9 @@ static void ath10k_wmi_10_4_op_rx(struct + case WMI_10_4_TDLS_PEER_EVENTID: + ath10k_wmi_handle_tdls_peer_event(ar, skb); + break; ++ case WMI_10_4_PDEV_TPC_TABLE_EVENTID: ++ ath10k_wmi_event_tpc_final_table(ar, skb); ++ break; + default: + ath10k_warn(ar, "Unknown eventid: %d\n", id); + break; +@@ -7990,6 +8248,24 @@ static u32 ath10k_wmi_prepare_peer_qos(u + } + + static struct sk_buff * ++ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid(struct ath10k *ar, u32 param) ++{ ++ struct wmi_pdev_get_tpc_table_cmd *cmd; ++ struct sk_buff *skb; ++ ++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_pdev_get_tpc_table_cmd *)skb->data; ++ cmd->param = __cpu_to_le32(param); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, ++ "wmi pdev get tpc table param:%d\n", param); ++ return skb; ++} ++ ++static struct sk_buff * + ath10k_wmi_10_4_gen_tdls_peer_update(struct ath10k *ar, + const struct wmi_tdls_peer_update_cmd_arg *arg, + const struct wmi_tdls_peer_capab_arg *cap, +@@ -8430,6 +8706,8 @@ static const struct wmi_ops wmi_10_4_ops + .ext_resource_config = ath10k_wmi_10_4_ext_resource_config, + .gen_update_fw_tdls_state = ath10k_wmi_10_4_gen_update_fw_tdls_state, + .gen_tdls_peer_update = ath10k_wmi_10_4_gen_tdls_peer_update, ++ .gen_pdev_get_tpc_table_cmdid = ++ ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid, + + /* shared with 10.2 */ + .pull_echo_ev = ath10k_wmi_op_pull_echo_ev, +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -1,6 +1,7 @@ + /* + * Copyright (c) 2005-2011 Atheros Communications Inc. + * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. ++ * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -197,6 +198,9 @@ enum wmi_service { + WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, + WMI_SERVICE_MGMT_TX_WMI, + WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ++ WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ++ WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, ++ WMI_SERVICE_TPC_STATS_FINAL, + + /* keep last */ + WMI_SERVICE_MAX, +@@ -339,6 +343,9 @@ enum wmi_10_4_service { + WMI_10_4_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, + WMI_10_4_SERVICE_TDLS_EXPLICIT_MODE_ONLY, + WMI_10_4_SERVICE_TDLS_WIDER_BANDWIDTH, ++ WMI_10_4_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ++ WMI_10_4_SERVICE_HOST_DFS_CHECK_SUPPORT, ++ WMI_10_4_SERVICE_TPC_STATS_FINAL, + }; + + static inline char *wmi_service_name(int service_id) +@@ -448,6 +455,9 @@ static inline char *wmi_service_name(int + SVCSTR(WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE); + SVCSTR(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY); + SVCSTR(WMI_SERVICE_TDLS_WIDER_BANDWIDTH); ++ SVCSTR(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS); ++ SVCSTR(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT); ++ SVCSTR(WMI_SERVICE_TPC_STATS_FINAL); + default: + return NULL; + } +@@ -746,6 +756,12 @@ static inline void wmi_10_4_svc_map(cons + WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, len); + SVCMAP(WMI_10_4_SERVICE_TDLS_WIDER_BANDWIDTH, + WMI_SERVICE_TDLS_WIDER_BANDWIDTH, len); ++ SVCMAP(WMI_10_4_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ++ WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len); ++ SVCMAP(WMI_10_4_SERVICE_HOST_DFS_CHECK_SUPPORT, ++ WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, len); ++ SVCMAP(WMI_10_4_SERVICE_TPC_STATS_FINAL, ++ WMI_SERVICE_TPC_STATS_FINAL, len); + } + + #undef SVCMAP +@@ -3992,10 +4008,12 @@ struct wmi_pdev_get_tpc_config_cmd { + + #define WMI_TPC_CONFIG_PARAM 1 + #define WMI_TPC_RATE_MAX 160 ++#define WMI_TPC_FINAL_RATE_MAX 240 + #define WMI_TPC_TX_N_CHAIN 4 + #define WMI_TPC_PREAM_TABLE_MAX 10 + #define WMI_TPC_FLAG 3 + #define WMI_TPC_BUF_SIZE 10 ++#define WMI_TPC_BEAMFORMING 2 + + enum wmi_tpc_table_type { + WMI_TPC_TABLE_TYPE_CDD = 0, +@@ -4038,6 +4056,51 @@ enum wmi_tp_scale { + WMI_TP_SCALE_SIZE = 5, /* max num of enum */ + }; + ++struct wmi_pdev_tpc_final_table_event { ++ __le32 reg_domain; ++ __le32 chan_freq; ++ __le32 phy_mode; ++ __le32 twice_antenna_reduction; ++ __le32 twice_max_rd_power; ++ a_sle32 twice_antenna_gain; ++ __le32 power_limit; ++ __le32 rate_max; ++ __le32 num_tx_chain; ++ __le32 ctl; ++ __le32 flags; ++ s8 max_reg_allow_pow[WMI_TPC_TX_N_CHAIN]; ++ s8 max_reg_allow_pow_agcdd[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN]; ++ s8 max_reg_allow_pow_agstbc[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN]; ++ s8 max_reg_allow_pow_agtxbf[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN]; ++ u8 rates_array[WMI_TPC_FINAL_RATE_MAX]; ++ u8 ctl_power_table[WMI_TPC_BEAMFORMING][WMI_TPC_TX_N_CHAIN] ++ [WMI_TPC_TX_N_CHAIN]; ++} __packed; ++ ++struct wmi_pdev_get_tpc_table_cmd { ++ __le32 param; ++} __packed; ++ ++enum wmi_tpc_pream_2ghz { ++ WMI_TPC_PREAM_2GHZ_CCK = 0, ++ WMI_TPC_PREAM_2GHZ_OFDM, ++ WMI_TPC_PREAM_2GHZ_HT20, ++ WMI_TPC_PREAM_2GHZ_HT40, ++ WMI_TPC_PREAM_2GHZ_VHT20, ++ WMI_TPC_PREAM_2GHZ_VHT40, ++ WMI_TPC_PREAM_2GHZ_VHT80, ++}; ++ ++enum wmi_tpc_pream_5ghz { ++ WMI_TPC_PREAM_5GHZ_OFDM = 1, ++ WMI_TPC_PREAM_5GHZ_HT20, ++ WMI_TPC_PREAM_5GHZ_HT40, ++ WMI_TPC_PREAM_5GHZ_VHT20, ++ WMI_TPC_PREAM_5GHZ_VHT40, ++ WMI_TPC_PREAM_5GHZ_VHT80, ++ WMI_TPC_PREAM_5GHZ_HTCUP, ++}; ++ + struct wmi_pdev_chanlist_update_event { + /* number of channels */ + __le32 num_chan; +@@ -6977,5 +7040,8 @@ void ath10k_wmi_10_4_op_fw_stats_fill(st + int ath10k_wmi_op_get_vdev_subtype(struct ath10k *ar, + enum wmi_vdev_subtype subtype); + int ath10k_wmi_barrier(struct ath10k *ar); ++void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table, ++ u32 num_tx_chain); ++void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb); + + #endif /* _WMI_H_ */ diff --git a/package/kernel/mac80211/patches/380-0004-ath10k-Fix-kernel-panic-while-using-worker-ath10k_st.patch b/package/kernel/mac80211/patches/380-0004-ath10k-Fix-kernel-panic-while-using-worker-ath10k_st.patch new file mode 100644 index 000000000..888cedd8d --- /dev/null +++ b/package/kernel/mac80211/patches/380-0004-ath10k-Fix-kernel-panic-while-using-worker-ath10k_st.patch @@ -0,0 +1,99 @@ +From 8b2d93dd22615cb7f3046a5a2083a6f8bb8052ed Mon Sep 17 00:00:00 2001 +From: Karthikeyan Periyasamy +Date: Mon, 12 Mar 2018 17:09:40 +0530 +Subject: [PATCH] ath10k: Fix kernel panic while using worker + (ath10k_sta_rc_update_wk) + +When attempt to run worker (ath10k_sta_rc_update_wk) after the station object +(ieee80211_sta) delete will trigger the kernel panic. + +This problem arise in AP + Mesh configuration, Where the current node AP VAP +and neighbor node mesh VAP MAC address are same. When the current mesh node +try to establish the mesh link with neighbor node, driver peer creation for +the neighbor mesh node fails due to duplication MAC address. Already the AP +VAP created with same MAC address. + +It is caused by the following scenario steps. + +Steps: +1. In above condition, ath10k driver sta_state callback (ath10k_sta_state) + fails to do the state change for a station from IEEE80211_STA_NOTEXIST + to IEEE80211_STA_NONE due to peer creation fails. Sta_state callback is + called from ieee80211_add_station() to handle the new station + (neighbor mesh node) request from the wpa_supplicant. +2. Concurrently ath10k receive the sta_rc_update callback notification from + the mesh_neighbour_update() to handle the beacon frames of the above + neighbor mesh node. since its atomic callback, ath10k driver queue the + work (ath10k_sta_rc_update_wk) to handle rc update. +3. Due to driver sta_state callback fails (step 1), mac80211 free the station + object. +4. When the worker (ath10k_sta_rc_update_wk) scheduled to run, it will access + the station object which is already deleted. so it will trigger kernel + panic. + +Added the peer exist check in sta_rc_update callback before queue the work. + +Kernel Panic log: + +Unable to handle kernel NULL pointer dereference at virtual address 00000000 +pgd = c0204000 +[00000000] *pgd=00000000 +Internal error: Oops: 17 [#1] PREEMPT SMP ARM +CPU: 1 PID: 1833 Comm: kworker/u4:2 Not tainted 3.14.77 #1 +task: dcef0000 ti: d72b6000 task.ti: d72b6000 +PC is at pwq_activate_delayed_work+0x10/0x40 +LR is at pwq_activate_delayed_work+0xc/0x40 +pc : [] lr : [] psr: 40000193 +sp : d72b7f18 ip : 0000007a fp : d72b6000 +r10: 00000000 r9 : dd404414 r8 : d8c31998 +r7 : d72b6038 r6 : 00000004 r5 : d4907ec8 r4 : dcee1300 +r3 : ffffffe0 r2 : 00000000 r1 : 00000001 r0 : 00000000 +Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel +Control: 10c5787d Table: 595bc06a DAC: 00000015 +... +Process kworker/u4:2 (pid: 1833, stack limit = 0xd72b6238) +Stack: (0xd72b7f18 to 0xd72b8000) +7f00: 00000001 dcee1300 +7f20: 00000001 c02410dc d8c31980 dd404400 dd404400 c0242790 d8c31980 00000089 +7f40: 00000000 d93e1340 00000000 d8c31980 c0242568 00000000 00000000 00000000 +7f60: 00000000 c02474dc 00000000 00000000 000000f8 d8c31980 00000000 00000000 +7f80: d72b7f80 d72b7f80 00000000 00000000 d72b7f90 d72b7f90 d72b7fac d93e1340 +7fa0: c0247404 00000000 00000000 c0208d20 00000000 00000000 00000000 00000000 +7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 +[] (pwq_activate_delayed_work) from [] (pwq_dec_nr_in_flight+0x58/0xc4) +[] (pwq_dec_nr_in_flight) from [] (worker_thread+0x228/0x360) +[] (worker_thread) from [] (kthread+0xd8/0xec) +[] (kthread) from [] (ret_from_fork+0x14/0x34) +Code: e92d4038 e1a05000 ebffffbc[69210.619376] SMP: failed to stop secondary CPUs +Rebooting in 3 seconds.. + +Signed-off-by: Karthikeyan Periyasamy +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/mac.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -7065,10 +7065,20 @@ static void ath10k_sta_rc_update(struct + { + struct ath10k *ar = hw->priv; + struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; ++ struct ath10k_vif *arvif = (void *)vif->drv_priv; ++ struct ath10k_peer *peer; + u32 bw, smps; + + spin_lock_bh(&ar->data_lock); + ++ peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); ++ if (!peer) { ++ spin_unlock_bh(&ar->data_lock); ++ ath10k_warn(ar, "mac sta rc update failed to find peer %pM on vdev %i\n", ++ sta->addr, arvif->vdev_id); ++ return; ++ } ++ + ath10k_dbg(ar, ATH10K_DBG_MAC, + "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n", + sta->addr, changed, sta->bandwidth, sta->rx_nss, diff --git a/package/kernel/mac80211/patches/380-0005-ath10k-fix-kernel-panic-while-reading-tpc_stats.patch b/package/kernel/mac80211/patches/380-0005-ath10k-fix-kernel-panic-while-reading-tpc_stats.patch new file mode 100644 index 000000000..5cc97efaf --- /dev/null +++ b/package/kernel/mac80211/patches/380-0005-ath10k-fix-kernel-panic-while-reading-tpc_stats.patch @@ -0,0 +1,119 @@ +From 4b190675ad06f5a6ecbeef0b01890c5fb372e3eb Mon Sep 17 00:00:00 2001 +From: Tamizh Chelvam +Date: Wed, 25 Apr 2018 11:36:44 +0300 +Subject: [PATCH] ath10k: fix kernel panic while reading tpc_stats + +When attempt to read tpc_stats for the chipsets which support +more than 3 tx chain will trigger kernel panic(kernel stack is corrupted) +due to writing values on rate_code array out of range. +This patch changes the array size depends on the WMI_TPC_TX_N_CHAIN and +added check to avoid write values on the array if the num tx chain +get in tpc config event is greater than WMI_TPC_TX_N_CHAIN. + +Tested on QCA9984 with firmware-5.bin_10.4-3.5.3-00057 + +Kernel panic log : + +[ 323.510944] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: bf90c654 +[ 323.510944] +[ 323.524390] CPU: 0 PID: 1908 Comm: cat Not tainted 3.14.77 #31 +[ 323.530224] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) +[ 323.537941] [] (show_stack) from [] (dump_stack+0x80/0xa0) +[ 323.545146] [] (dump_stack) from [] (panic+0x84/0x1e4) +[ 323.552000] [] (panic) from [] (__stack_chk_fail+0x10/0x14) +[ 323.559350] [] (__stack_chk_fail) from [] (ath10k_wmi_event_pdev_tpc_config+0x424/0x438 [ath10k_core]) +[ 323.570471] [] (ath10k_wmi_event_pdev_tpc_config [ath10k_core]) from [] (ath10k_wmi_10_4_op_rx+0x2f0/0x39c [ath10k_core]) +[ 323.583047] [] (ath10k_wmi_10_4_op_rx [ath10k_core]) from [] (ath10k_htc_rx_completion_handler+0x170/0x1a0 [ath10k_core]) +[ 323.595702] [] (ath10k_htc_rx_completion_handler [ath10k_core]) from [] (ath10k_pci_hif_send_complete_check+0x1f0/0x220 [ath10k_pci]) +[ 323.609421] [] (ath10k_pci_hif_send_complete_check [ath10k_pci]) from [] (ath10k_ce_per_engine_service+0x74/0xc4 [ath10k_pci]) +[ 323.622490] [] (ath10k_ce_per_engine_service [ath10k_pci]) from [] (ath10k_ce_per_engine_service_any+0x74/0x80 [ath10k_pci]) +[ 323.635423] [] (ath10k_ce_per_engine_service_any [ath10k_pci]) from [] (ath10k_pci_napi_poll+0x44/0xe8 [ath10k_pci]) +[ 323.647665] [] (ath10k_pci_napi_poll [ath10k_pci]) from [] (net_rx_action+0xac/0x160) +[ 323.657208] [] (net_rx_action) from [] (__do_softirq+0x104/0x294) +[ 323.665017] [] (__do_softirq) from [] (irq_exit+0x9c/0x11c) +[ 323.672314] [] (irq_exit) from [] (handle_IRQ+0x6c/0x90) +[ 323.679341] [] (handle_IRQ) from [] (gic_handle_irq+0x3c/0x60) +[ 323.686893] [] (gic_handle_irq) from [] (__irq_svc+0x40/0x70) +[ 323.694349] Exception stack(0xdd489c58 to 0xdd489ca0) +[ 323.699384] 9c40: 00000000 a0000013 +[ 323.707547] 9c60: 00000000 dc4bce40 60000013 ddc1d800 dd488000 00000990 00000000 c085c800 +[ 323.715707] 9c80: 00000000 dd489d44 0000092d dd489ca0 c026e664 c026e668 60000013 ffffffff +[ 323.723877] [] (__irq_svc) from [] (rcu_note_context_switch+0x170/0x184) +[ 323.732298] [] (rcu_note_context_switch) from [] (__schedule+0x50/0x4d4) +[ 323.740716] [] (__schedule) from [] (schedule_timeout+0x148/0x178) +[ 323.748611] [] (schedule_timeout) from [] (wait_for_common+0x114/0x154) +[ 323.756972] [] (wait_for_common) from [] (ath10k_tpc_stats_open+0xc8/0x340 [ath10k_core]) +[ 323.766873] [] (ath10k_tpc_stats_open [ath10k_core]) from [] (do_dentry_open+0x1ac/0x274) +[ 323.776741] [] (do_dentry_open) from [] (do_last+0x8c0/0xb08) +[ 323.784201] [] (do_last) from [] (path_openat+0x210/0x598) +[ 323.791408] [] (path_openat) from [] (do_filp_open+0x2c/0x78) +[ 323.798873] [] (do_filp_open) from [] (do_sys_open+0x114/0x1b4) +[ 323.806509] [] (do_sys_open) from [] (ret_fast_syscall+0x0/0x44) +[ 323.814241] CPU1: stopping +[ 323.816927] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.14.77 #31 +[ 323.823008] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) +[ 323.830731] [] (show_stack) from [] (dump_stack+0x80/0xa0) +[ 323.837934] [] (dump_stack) from [] (handle_IPI+0xb8/0x140) +[ 323.845224] [] (handle_IPI) from [] (gic_handle_irq+0x58/0x60) +[ 323.852774] [] (gic_handle_irq) from [] (__irq_svc+0x40/0x70) +[ 323.860233] Exception stack(0xdd499fa0 to 0xdd499fe8) +[ 323.865273] 9fa0: ffffffed 00000000 1d3c9000 00000000 dd498000 dd498030 10c0387d c08b62c8 +[ 323.873432] 9fc0: 4220406a 512f04d0 00000000 00000000 00000001 dd499fe8 c021838c c0218390 +[ 323.881588] 9fe0: 60000013 ffffffff +[ 323.885070] [] (__irq_svc) from [] (arch_cpu_idle+0x30/0x50) +[ 323.892454] [] (arch_cpu_idle) from [] (cpu_startup_entry+0xa4/0x108) +[ 323.900690] [] (cpu_startup_entry) from [<422085a4>] (0x422085a4) + +Signed-off-by: Tamizh chelvam +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/debug.c | 8 +++++++- + drivers/net/wireless/ath/ath10k/wmi.c | 6 ++++++ + drivers/net/wireless/ath/ath10k/wmi.h | 2 +- + 3 files changed, 14 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/debug.c ++++ b/drivers/net/wireless/ath/ath10k/debug.c +@@ -1776,7 +1776,13 @@ static void ath10k_tpc_stats_print(struc + *len += scnprintf(buf + *len, buf_len - *len, + "********************************\n"); + *len += scnprintf(buf + *len, buf_len - *len, +- "No. Preamble Rate_code tpc_value1 tpc_value2 tpc_value3\n"); ++ "No. Preamble Rate_code "); ++ ++ for (i = 0; i < WMI_TPC_TX_N_CHAIN; i++) ++ *len += scnprintf(buf + *len, buf_len - *len, ++ "tpc_value%d ", i); ++ ++ *len += scnprintf(buf + *len, buf_len - *len, "\n"); + + for (i = 0; i < tpc_stats->rate_max; i++) { + *len += scnprintf(buf + *len, buf_len - *len, +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -4431,6 +4431,12 @@ void ath10k_wmi_event_pdev_tpc_config(st + + num_tx_chain = __le32_to_cpu(ev->num_tx_chain); + ++ if (num_tx_chain > WMI_TPC_TX_N_CHAIN) { ++ ath10k_warn(ar, "number of tx chain is %d greater than TPC configured tx chain %d\n", ++ num_tx_chain, WMI_TPC_TX_N_CHAIN); ++ return; ++ } ++ + ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table, + num_tx_chain); + +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -4007,9 +4007,9 @@ struct wmi_pdev_get_tpc_config_cmd { + } __packed; + + #define WMI_TPC_CONFIG_PARAM 1 +-#define WMI_TPC_RATE_MAX 160 + #define WMI_TPC_FINAL_RATE_MAX 240 + #define WMI_TPC_TX_N_CHAIN 4 ++#define WMI_TPC_RATE_MAX (WMI_TPC_TX_N_CHAIN * 65) + #define WMI_TPC_PREAM_TABLE_MAX 10 + #define WMI_TPC_FLAG 3 + #define WMI_TPC_BUF_SIZE 10 diff --git a/package/kernel/mac80211/patches/380-0006-ath10k-add-support-to-configure-channel-dwell-time.patch b/package/kernel/mac80211/patches/380-0006-ath10k-add-support-to-configure-channel-dwell-time.patch new file mode 100644 index 000000000..3451a9930 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0006-ath10k-add-support-to-configure-channel-dwell-time.patch @@ -0,0 +1,92 @@ +From be8cce96f14dc925ecfb702be0392a52cf78adb5 Mon Sep 17 00:00:00 2001 +From: Pradeep Kumar Chitrapu +Date: Wed, 23 May 2018 11:09:09 +0300 +Subject: [PATCH] ath10k: add support to configure channel dwell time + +Configure channel dwell time from duration of the scan request +received from mac80211 when the duration is non-zero. When the +scan request does not have duration value, use the default ones, +the current implementation. + +Corresponding flag NL80211_EXT_FEATURE_SET_SCAN_DWELL is +advertized. + +Supported Chipsets: + -QCA988X/QCA9887 PCI + -QCA99X0/QCA9984/QCA9888/QCA4019 PCI + -QCA6174/QCA9377 PCI/USB/SDIO + -WCN3990 SNOC + +Tested on QCA9984 with firmware ver 10.4-3.6-0010 + +Signed-off-by: Pradeep Kumar Chitrapu +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/core.h | 1 + + drivers/net/wireless/ath/ath10k/mac.c | 23 ++++++++++++++++++++--- + 2 files changed, 21 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -43,6 +43,7 @@ + #define WO(_f) ((_f##_OFFSET) >> 2) + + #define ATH10K_SCAN_ID 0 ++#define ATH10K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD 10 /* msec */ + #define WMI_READY_TIMEOUT (5 * HZ) + #define ATH10K_FLUSH_TIMEOUT_HZ (5 * HZ) + #define ATH10K_CONNECTION_LOSS_HZ (3 * HZ) +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -5597,6 +5597,7 @@ static int ath10k_hw_scan(struct ieee802 + struct wmi_start_scan_arg arg; + int ret = 0; + int i; ++ u32 scan_timeout; + + mutex_lock(&ar->conf_mutex); + +@@ -5647,6 +5648,22 @@ static int ath10k_hw_scan(struct ieee802 + arg.channels[i] = req->channels[i]->center_freq; + } + ++ /* if duration is set, default dwell times will be overwritten */ ++ if (req->duration) { ++ arg.dwell_time_active = req->duration; ++ arg.dwell_time_passive = req->duration; ++ arg.burst_duration_ms = req->duration; ++ ++ scan_timeout = min_t(u32, arg.max_rest_time * ++ (arg.n_channels - 1) + (req->duration + ++ ATH10K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * ++ arg.n_channels, arg.max_scan_time + 200); ++ ++ } else { ++ /* Add a 200ms margin to account for event/command processing */ ++ scan_timeout = arg.max_scan_time + 200; ++ } ++ + ret = ath10k_start_scan(ar, &arg); + if (ret) { + ath10k_warn(ar, "failed to start hw scan: %d\n", ret); +@@ -5655,10 +5672,8 @@ static int ath10k_hw_scan(struct ieee802 + spin_unlock_bh(&ar->data_lock); + } + +- /* Add a 200ms margin to account for event/command processing */ + ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, +- msecs_to_jiffies(arg.max_scan_time + +- 200)); ++ msecs_to_jiffies(scan_timeout)); + + exit: + mutex_unlock(&ar->conf_mutex); +@@ -8267,6 +8282,8 @@ int ath10k_mac_register(struct ath10k *a + } + + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); ++ wiphy_ext_feature_set(ar->hw->wiphy, ++ NL80211_EXT_FEATURE_SET_SCAN_DWELL); + + /* + * on LL hardware queues are managed entirely by the FW diff --git a/package/kernel/mac80211/patches/380-0007-ath-add-support-to-get-the-detected-radar-specificat.patch b/package/kernel/mac80211/patches/380-0007-ath-add-support-to-get-the-detected-radar-specificat.patch new file mode 100644 index 000000000..020dfbd3a --- /dev/null +++ b/package/kernel/mac80211/patches/380-0007-ath-add-support-to-get-the-detected-radar-specificat.patch @@ -0,0 +1,94 @@ +From f40105e6747892e8edab94020567c158c9bec0df Mon Sep 17 00:00:00 2001 +From: Sriram R +Date: Tue, 15 May 2018 14:39:48 +0530 +Subject: [PATCH] ath: add support to get the detected radar specifications + +This enables ath10k/ath9k drivers to collect the specifications of the +radar type once it is detected by the dfs pattern detector unit. +Usage of the collected info is specific to driver implementation. +For example, collected radar info could be used by the host driver +to send to co-processors for additional processing/validation. + +Note: 'radar_detector_specs' data containing the specifications of +different radar types which was private within dfs_pattern_detector/ +dfs_pri_detector is now shared with drivers as well for making use +of this information. + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/wmi.c | 2 +- + drivers/net/wireless/ath/ath9k/dfs.c | 2 +- + drivers/net/wireless/ath/dfs_pattern_detector.c | 5 ++++- + drivers/net/wireless/ath/dfs_pattern_detector.h | 3 ++- + drivers/net/wireless/ath/dfs_pri_detector.h | 3 ++- + 5 files changed, 10 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -3712,7 +3712,7 @@ static void ath10k_dfs_radar_report(stru + + ATH10K_DFS_STAT_INC(ar, pulses_detected); + +- if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe)) { ++ if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe, NULL)) { + ath10k_dbg(ar, ATH10K_DBG_REGULATORY, + "dfs no pulse pattern detected, yet\n"); + return; +--- a/drivers/net/wireless/ath/ath9k/dfs.c ++++ b/drivers/net/wireless/ath/ath9k/dfs.c +@@ -279,7 +279,7 @@ ath9k_dfs_process_radar_pulse(struct ath + DFS_STAT_INC(sc, pulses_processed); + if (pd == NULL) + return; +- if (!pd->add_pulse(pd, pe)) ++ if (!pd->add_pulse(pd, pe, NULL)) + return; + DFS_STAT_INC(sc, radar_detected); + ieee80211_radar_detected(sc->hw); +--- a/drivers/net/wireless/ath/dfs_pattern_detector.c ++++ b/drivers/net/wireless/ath/dfs_pattern_detector.c +@@ -268,7 +268,8 @@ static void dpd_exit(struct dfs_pattern_ + } + + static bool +-dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event) ++dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event, ++ struct radar_detector_specs *rs) + { + u32 i; + struct channel_detector *cd; +@@ -294,6 +295,8 @@ dpd_add_pulse(struct dfs_pattern_detecto + struct pri_detector *pd = cd->detectors[i]; + struct pri_sequence *ps = pd->add_pulse(pd, event); + if (ps != NULL) { ++ if (rs != NULL) ++ memcpy(rs, pd->rs, sizeof(*rs)); + ath_dbg(dpd->common, DFS, + "DFS: radar found on freq=%d: id=%d, pri=%d, " + "count=%d, count_false=%d\n", +--- a/drivers/net/wireless/ath/dfs_pattern_detector.h ++++ b/drivers/net/wireless/ath/dfs_pattern_detector.h +@@ -97,7 +97,8 @@ struct dfs_pattern_detector { + bool (*set_dfs_domain)(struct dfs_pattern_detector *dpd, + enum nl80211_dfs_regions region); + bool (*add_pulse)(struct dfs_pattern_detector *dpd, +- struct pulse_event *pe); ++ struct pulse_event *pe, ++ struct radar_detector_specs *rs); + + struct ath_dfs_pool_stats (*get_stats)(struct dfs_pattern_detector *dpd); + enum nl80211_dfs_regions region; +--- a/drivers/net/wireless/ath/dfs_pri_detector.h ++++ b/drivers/net/wireless/ath/dfs_pri_detector.h +@@ -62,8 +62,9 @@ struct pri_detector { + (*add_pulse)(struct pri_detector *de, struct pulse_event *e); + void (*reset) (struct pri_detector *de, u64 ts); + +-/* private: internal use only */ + const struct radar_detector_specs *rs; ++ ++/* private: internal use only */ + u64 last_ts; + struct list_head sequences; + struct list_head pulses; diff --git a/package/kernel/mac80211/patches/380-0008-ath10k-DFS-Host-Confirmation.patch b/package/kernel/mac80211/patches/380-0008-ath10k-DFS-Host-Confirmation.patch new file mode 100644 index 000000000..9e0c10085 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0008-ath10k-DFS-Host-Confirmation.patch @@ -0,0 +1,546 @@ +From 6f6eb1bcbeff48c875617b800f00f1c5d1b12290 Mon Sep 17 00:00:00 2001 +From: Sriram R +Date: Tue, 15 May 2018 14:39:49 +0530 +Subject: [PATCH] ath10k: DFS Host Confirmation + +In the 10.4-3.6 firmware branch there's a new DFS Host confirmation +feature which is advertised using WMI_SERVICE_HOST_DFS_CHECK_SUPPORT flag. + +This new features enables the ath10k host to send information to the +firmware on the specifications of detected radar type. This allows the +firmware to validate if the host's radar pattern detector unit is +operational and check if the radar information shared by host matches +the radar pulses sent as phy error events from firmware. If the check +fails the firmware won't allow use of DFS channels on AP mode when using +FCC regulatory region. + +Hence this patch is mandatory when using a firmware from 10.4-3.6 branch. +Else, DFS channels on FCC regions cannot be used. + +Supported Chipsets : QCA9984/QCA9888/QCA4019 +Firmware Version : 10.4-3.6-00104 + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/core.h | 21 ++++ + drivers/net/wireless/ath/ath10k/mac.c | 12 ++ + drivers/net/wireless/ath/ath10k/wmi-ops.h | 32 +++++ + drivers/net/wireless/ath/ath10k/wmi.c | 186 ++++++++++++++++++++++++++++-- + drivers/net/wireless/ath/ath10k/wmi.h | 32 +++++ + 5 files changed, 273 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -171,6 +171,7 @@ struct ath10k_wmi { + struct completion service_ready; + struct completion unified_ready; + struct completion barrier; ++ struct completion radar_confirm; + wait_queue_head_t tx_credits_wq; + DECLARE_BITMAP(svc_map, WMI_SERVICE_MAX); + struct wmi_cmd_map *cmd; +@@ -352,6 +353,21 @@ struct ath10k_dfs_stats { + u32 radar_detected; + }; + ++enum ath10k_radar_confirmation_state { ++ ATH10K_RADAR_CONFIRMATION_IDLE = 0, ++ ATH10K_RADAR_CONFIRMATION_INPROGRESS, ++ ATH10K_RADAR_CONFIRMATION_STOPPED, ++}; ++ ++struct ath10k_radar_found_info { ++ u32 pri_min; ++ u32 pri_max; ++ u32 width_min; ++ u32 width_max; ++ u32 sidx_min; ++ u32 sidx_max; ++}; ++ + #define ATH10K_MAX_NUM_PEER_IDS (1 << 11) /* htt rx_desc limit */ + + struct ath10k_peer { +@@ -1026,6 +1042,11 @@ struct ath10k { + + void *ce_priv; + ++ /* protected by data_lock */ ++ enum ath10k_radar_confirmation_state radar_conf_state; ++ struct ath10k_radar_found_info last_radar_info; ++ struct work_struct radar_confirmation_work; ++ + /* must be last */ + u8 drv_priv[0] __aligned(sizeof(void *)); + }; +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -3216,6 +3216,15 @@ static void ath10k_reg_notifier(struct w + ar->hw->wiphy->bands[NL80211_BAND_5GHZ]); + } + ++static void ath10k_stop_radar_confirmation(struct ath10k *ar) ++{ ++ spin_lock_bh(&ar->data_lock); ++ ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_STOPPED; ++ spin_unlock_bh(&ar->data_lock); ++ ++ cancel_work_sync(&ar->radar_confirmation_work); ++} ++ + /***************/ + /* TX handlers */ + /***************/ +@@ -4315,6 +4324,7 @@ void ath10k_halt(struct ath10k *ar) + + ath10k_scan_finish(ar); + ath10k_peer_cleanup_all(ar); ++ ath10k_stop_radar_confirmation(ar); + ath10k_core_stop(ar); + ath10k_hif_power_down(ar); + +@@ -4733,6 +4743,8 @@ static int ath10k_start(struct ieee80211 + ath10k_spectral_start(ar); + ath10k_thermal_set_throttling(ar); + ++ ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; ++ + mutex_unlock(&ar->conf_mutex); + return 0; + +--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h ++++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h +@@ -53,6 +53,8 @@ struct wmi_ops { + struct wmi_wow_ev_arg *arg); + int (*pull_echo_ev)(struct ath10k *ar, struct sk_buff *skb, + struct wmi_echo_ev_arg *arg); ++ int (*pull_dfs_status_ev)(struct ath10k *ar, struct sk_buff *skb, ++ struct wmi_dfs_status_ev_arg *arg); + enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar); + + struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt); +@@ -178,6 +180,9 @@ struct wmi_ops { + const struct wmi_tdls_peer_update_cmd_arg *arg, + const struct wmi_tdls_peer_capab_arg *cap, + const struct wmi_channel_arg *chan); ++ struct sk_buff *(*gen_radar_found) ++ (struct ath10k *ar, ++ const struct ath10k_radar_found_info *arg); + struct sk_buff *(*gen_adaptive_qcs)(struct ath10k *ar, bool enable); + struct sk_buff *(*gen_pdev_get_tpc_config)(struct ath10k *ar, + u32 param); +@@ -365,6 +370,16 @@ ath10k_wmi_pull_echo_ev(struct ath10k *a + return ar->wmi.ops->pull_echo_ev(ar, skb, arg); + } + ++static inline int ++ath10k_wmi_pull_dfs_status(struct ath10k *ar, struct sk_buff *skb, ++ struct wmi_dfs_status_ev_arg *arg) ++{ ++ if (!ar->wmi.ops->pull_dfs_status_ev) ++ return -EOPNOTSUPP; ++ ++ return ar->wmi.ops->pull_dfs_status_ev(ar, skb, arg); ++} ++ + static inline enum wmi_txbf_conf + ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar) + { +@@ -1438,4 +1453,21 @@ ath10k_wmi_pdev_get_tpc_table_cmdid(stru + ar->wmi.cmd->pdev_get_tpc_table_cmdid); + } + ++static inline int ++ath10k_wmi_report_radar_found(struct ath10k *ar, ++ const struct ath10k_radar_found_info *arg) ++{ ++ struct sk_buff *skb; ++ ++ if (!ar->wmi.ops->gen_radar_found) ++ return -EOPNOTSUPP; ++ ++ skb = ar->wmi.ops->gen_radar_found(ar, arg); ++ if (IS_ERR(skb)) ++ return PTR_ERR(skb); ++ ++ return ath10k_wmi_cmd_send(ar, skb, ++ ar->wmi.cmd->radar_found_cmdid); ++} ++ + #endif +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -34,6 +34,7 @@ + + #define ATH10K_WMI_BARRIER_ECHO_ID 0xBA991E9 + #define ATH10K_WMI_BARRIER_TIMEOUT_HZ (3 * HZ) ++#define ATH10K_WMI_DFS_CONF_TIMEOUT_HZ (HZ / 6) + + /* MAIN WMI cmd track */ + static struct wmi_cmd_map wmi_cmd_map = { +@@ -198,6 +199,7 @@ static struct wmi_cmd_map wmi_cmd_map = + .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, ++ .radar_found_cmdid = WMI_CMD_UNSUPPORTED, + }; + + /* 10.X WMI cmd track */ +@@ -365,6 +367,7 @@ static struct wmi_cmd_map wmi_10x_cmd_ma + .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, ++ .radar_found_cmdid = WMI_CMD_UNSUPPORTED, + }; + + /* 10.2.4 WMI cmd track */ +@@ -532,6 +535,7 @@ static struct wmi_cmd_map wmi_10_2_4_cmd + .pdev_bss_chan_info_request_cmdid = + WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID, + .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, ++ .radar_found_cmdid = WMI_CMD_UNSUPPORTED, + }; + + /* 10.4 WMI cmd track */ +@@ -741,6 +745,7 @@ static struct wmi_cmd_map wmi_10_4_cmd_m + .tdls_set_state_cmdid = WMI_10_4_TDLS_SET_STATE_CMDID, + .tdls_peer_update_cmdid = WMI_10_4_TDLS_PEER_UPDATE_CMDID, + .tdls_set_offchan_mode_cmdid = WMI_10_4_TDLS_SET_OFFCHAN_MODE_CMDID, ++ .radar_found_cmdid = WMI_10_4_RADAR_FOUND_CMDID, + }; + + /* MAIN WMI VDEV param map */ +@@ -1485,6 +1490,7 @@ static struct wmi_cmd_map wmi_10_2_cmd_m + .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED, + .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, ++ .radar_found_cmdid = WMI_CMD_UNSUPPORTED, + }; + + static struct wmi_pdev_param_map wmi_10_4_pdev_param_map = { +@@ -3638,6 +3644,68 @@ void ath10k_wmi_event_tbttoffset_update( + ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TBTTOFFSET_UPDATE_EVENTID\n"); + } + ++static void ath10k_radar_detected(struct ath10k *ar) ++{ ++ ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs radar detected\n"); ++ ATH10K_DFS_STAT_INC(ar, radar_detected); ++ ++ /* Control radar events reporting in debugfs file ++ * dfs_block_radar_events ++ */ ++ if (ar->dfs_block_radar_events) ++ ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); ++ else ++ ieee80211_radar_detected(ar->hw); ++} ++ ++static void ath10k_radar_confirmation_work(struct work_struct *work) ++{ ++ struct ath10k *ar = container_of(work, struct ath10k, ++ radar_confirmation_work); ++ struct ath10k_radar_found_info radar_info; ++ int ret, time_left; ++ ++ reinit_completion(&ar->wmi.radar_confirm); ++ ++ spin_lock_bh(&ar->data_lock); ++ memcpy(&radar_info, &ar->last_radar_info, sizeof(radar_info)); ++ spin_unlock_bh(&ar->data_lock); ++ ++ ret = ath10k_wmi_report_radar_found(ar, &radar_info); ++ if (ret) { ++ ath10k_warn(ar, "failed to send radar found %d\n", ret); ++ goto wait_complete; ++ } ++ ++ time_left = wait_for_completion_timeout(&ar->wmi.radar_confirm, ++ ATH10K_WMI_DFS_CONF_TIMEOUT_HZ); ++ if (time_left) { ++ /* DFS Confirmation status event received and ++ * necessary action completed. ++ */ ++ goto wait_complete; ++ } else { ++ /* DFS Confirmation event not received from FW.Considering this ++ * as real radar. ++ */ ++ ath10k_dbg(ar, ATH10K_DBG_REGULATORY, ++ "dfs confirmation not received from fw, considering as radar\n"); ++ goto radar_detected; ++ } ++ ++radar_detected: ++ ath10k_radar_detected(ar); ++ ++ /* Reset state to allow sending confirmation on consecutive radar ++ * detections, unless radar confirmation is disabled/stopped. ++ */ ++wait_complete: ++ spin_lock_bh(&ar->data_lock); ++ if (ar->radar_conf_state != ATH10K_RADAR_CONFIRMATION_STOPPED) ++ ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; ++ spin_unlock_bh(&ar->data_lock); ++} ++ + static void ath10k_dfs_radar_report(struct ath10k *ar, + struct wmi_phyerr_ev_arg *phyerr, + const struct phyerr_radar_report *rr, +@@ -3646,8 +3714,10 @@ static void ath10k_dfs_radar_report(stru + u32 reg0, reg1, tsf32l; + struct ieee80211_channel *ch; + struct pulse_event pe; ++ struct radar_detector_specs rs; + u64 tsf64; + u8 rssi, width; ++ struct ath10k_radar_found_info *radar_info; + + reg0 = __le32_to_cpu(rr->reg0); + reg1 = __le32_to_cpu(rr->reg1); +@@ -3712,25 +3782,46 @@ static void ath10k_dfs_radar_report(stru + + ATH10K_DFS_STAT_INC(ar, pulses_detected); + +- if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe, NULL)) { ++ if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe, &rs)) { + ath10k_dbg(ar, ATH10K_DBG_REGULATORY, + "dfs no pulse pattern detected, yet\n"); + return; + } + +-radar_detected: +- ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs radar detected\n"); +- ATH10K_DFS_STAT_INC(ar, radar_detected); ++ if ((test_bit(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, ar->wmi.svc_map)) && ++ ar->dfs_detector->region == NL80211_DFS_FCC) { ++ /* Consecutive radar indications need not be ++ * sent to the firmware until we get confirmation ++ * for the previous detected radar. ++ */ ++ spin_lock_bh(&ar->data_lock); ++ if (ar->radar_conf_state != ATH10K_RADAR_CONFIRMATION_IDLE) { ++ spin_unlock_bh(&ar->data_lock); ++ return; ++ } ++ ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_INPROGRESS; ++ radar_info = &ar->last_radar_info; + +- /* Control radar events reporting in debugfs file +- * dfs_block_radar_events +- */ +- if (ar->dfs_block_radar_events) { +- ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); ++ radar_info->pri_min = rs.pri_min; ++ radar_info->pri_max = rs.pri_max; ++ radar_info->width_min = rs.width_min; ++ radar_info->width_max = rs.width_max; ++ /*TODO Find sidx_min and sidx_max */ ++ radar_info->sidx_min = MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX); ++ radar_info->sidx_max = MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX); ++ ++ ath10k_dbg(ar, ATH10K_DBG_REGULATORY, ++ "sending wmi radar found cmd pri_min %d pri_max %d width_min %d width_max %d sidx_min %d sidx_max %d\n", ++ radar_info->pri_min, radar_info->pri_max, ++ radar_info->width_min, radar_info->width_max, ++ radar_info->sidx_min, radar_info->sidx_max); ++ ieee80211_queue_work(ar->hw, &ar->radar_confirmation_work); ++ spin_unlock_bh(&ar->data_lock); + return; + } + +- ieee80211_radar_detected(ar->hw); ++radar_detected: ++ ath10k_radar_detected(ar); + } + + static int ath10k_dfs_fft_report(struct ath10k *ar, +@@ -4080,6 +4171,47 @@ void ath10k_wmi_event_phyerr(struct ath1 + } + } + ++static int ++ath10k_wmi_10_4_op_pull_dfs_status_ev(struct ath10k *ar, struct sk_buff *skb, ++ struct wmi_dfs_status_ev_arg *arg) ++{ ++ struct wmi_dfs_status_ev_arg *ev = (void *)skb->data; ++ ++ if (skb->len < sizeof(*ev)) ++ return -EPROTO; ++ ++ arg->status = ev->status; ++ ++ return 0; ++} ++ ++static void ++ath10k_wmi_event_dfs_status_check(struct ath10k *ar, struct sk_buff *skb) ++{ ++ struct wmi_dfs_status_ev_arg status_arg = {}; ++ int ret; ++ ++ ret = ath10k_wmi_pull_dfs_status(ar, skb, &status_arg); ++ ++ if (ret) { ++ ath10k_warn(ar, "failed to parse dfs status event: %d\n", ret); ++ return; ++ } ++ ++ ath10k_dbg(ar, ATH10K_DBG_REGULATORY, ++ "dfs status event received from fw: %d\n", ++ status_arg.status); ++ ++ /* Even in case of radar detection failure we follow the same ++ * behaviour as if radar is detected i.e to switch to a different ++ * channel. ++ */ ++ if (status_arg.status == WMI_HW_RADAR_DETECTED || ++ status_arg.status == WMI_RADAR_DETECTION_FAIL) ++ ath10k_radar_detected(ar); ++ complete(&ar->wmi.radar_confirm); ++} ++ + void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb) + { + struct wmi_roam_ev_arg arg = {}; +@@ -5814,6 +5946,9 @@ static void ath10k_wmi_10_4_op_rx(struct + case WMI_10_4_PDEV_TPC_TABLE_EVENTID: + ath10k_wmi_event_tpc_final_table(ar, skb); + break; ++ case WMI_10_4_DFS_STATUS_CHECK_EVENTID: ++ ath10k_wmi_event_dfs_status_check(ar, skb); ++ break; + default: + ath10k_warn(ar, "Unknown eventid: %d\n", id); + break; +@@ -8332,6 +8467,32 @@ ath10k_wmi_10_4_gen_tdls_peer_update(str + } + + static struct sk_buff * ++ath10k_wmi_10_4_gen_radar_found(struct ath10k *ar, ++ const struct ath10k_radar_found_info *arg) ++{ ++ struct wmi_radar_found_info *cmd; ++ struct sk_buff *skb; ++ ++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_radar_found_info *)skb->data; ++ cmd->pri_min = __cpu_to_le32(arg->pri_min); ++ cmd->pri_max = __cpu_to_le32(arg->pri_max); ++ cmd->width_min = __cpu_to_le32(arg->width_min); ++ cmd->width_max = __cpu_to_le32(arg->width_max); ++ cmd->sidx_min = __cpu_to_le32(arg->sidx_min); ++ cmd->sidx_max = __cpu_to_le32(arg->sidx_max); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, ++ "wmi radar found pri_min %d pri_max %d width_min %d width_max %d sidx_min %d sidx_max %d\n", ++ arg->pri_min, arg->pri_max, arg->width_min, ++ arg->width_max, arg->sidx_min, arg->sidx_max); ++ return skb; ++} ++ ++static struct sk_buff * + ath10k_wmi_op_gen_echo(struct ath10k *ar, u32 value) + { + struct wmi_echo_cmd *cmd; +@@ -8668,6 +8829,7 @@ static const struct wmi_ops wmi_10_4_ops + .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev, + .pull_rdy = ath10k_wmi_op_pull_rdy_ev, + .pull_roam_ev = ath10k_wmi_op_pull_roam_ev, ++ .pull_dfs_status_ev = ath10k_wmi_10_4_op_pull_dfs_status_ev, + .get_txbf_conf_scheme = ath10k_wmi_10_4_txbf_conf_scheme, + + .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, +@@ -8714,6 +8876,7 @@ static const struct wmi_ops wmi_10_4_ops + .gen_tdls_peer_update = ath10k_wmi_10_4_gen_tdls_peer_update, + .gen_pdev_get_tpc_table_cmdid = + ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid, ++ .gen_radar_found = ath10k_wmi_10_4_gen_radar_found, + + /* shared with 10.2 */ + .pull_echo_ev = ath10k_wmi_op_pull_echo_ev, +@@ -8776,8 +8939,11 @@ int ath10k_wmi_attach(struct ath10k *ar) + init_completion(&ar->wmi.service_ready); + init_completion(&ar->wmi.unified_ready); + init_completion(&ar->wmi.barrier); ++ init_completion(&ar->wmi.radar_confirm); + + INIT_WORK(&ar->svc_rdy_work, ath10k_wmi_event_service_ready_work); ++ INIT_WORK(&ar->radar_confirmation_work, ++ ath10k_radar_confirmation_work); + + return 0; + } +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -959,6 +959,7 @@ struct wmi_cmd_map { + u32 vdev_sifs_trigger_time_cmdid; + u32 pdev_wds_entry_list_cmdid; + u32 tdls_set_offchan_mode_cmdid; ++ u32 radar_found_cmdid; + }; + + /* +@@ -1792,6 +1793,11 @@ enum wmi_10_4_cmd_id { + WMI_10_4_TDLS_SET_STATE_CMDID, + WMI_10_4_TDLS_PEER_UPDATE_CMDID, + WMI_10_4_TDLS_SET_OFFCHAN_MODE_CMDID, ++ WMI_10_4_PDEV_SEND_FD_CMDID, ++ WMI_10_4_ENABLE_FILS_CMDID, ++ WMI_10_4_PDEV_SET_BRIDGE_MACADDR_CMDID, ++ WMI_10_4_ATF_GROUP_WMM_AC_CONFIG_REQUEST_CMDID, ++ WMI_10_4_RADAR_FOUND_CMDID, + WMI_10_4_PDEV_UTF_CMDID = WMI_10_4_END_CMDID - 1, + }; + +@@ -1867,6 +1873,9 @@ enum wmi_10_4_event_id { + WMI_10_4_PDEV_TPC_TABLE_EVENTID, + WMI_10_4_PDEV_WDS_ENTRY_LIST_EVENTID, + WMI_10_4_TDLS_PEER_EVENTID, ++ WMI_10_4_HOST_SWFDA_EVENTID, ++ WMI_10_4_ESP_ESTIMATE_EVENTID, ++ WMI_10_4_DFS_STATUS_CHECK_EVENTID, + WMI_10_4_PDEV_UTF_EVENTID = WMI_10_4_END_EVENTID - 1, + }; + +@@ -3379,6 +3388,25 @@ struct wmi_10_4_phyerr_event { + u8 buf[0]; + } __packed; + ++struct wmi_radar_found_info { ++ __le32 pri_min; ++ __le32 pri_max; ++ __le32 width_min; ++ __le32 width_max; ++ __le32 sidx_min; ++ __le32 sidx_max; ++} __packed; ++ ++enum wmi_radar_confirmation_status { ++ /* Detected radar was due to SW pulses */ ++ WMI_SW_RADAR_DETECTED = 0, ++ ++ WMI_RADAR_DETECTION_FAIL = 1, ++ ++ /* Real radar detected */ ++ WMI_HW_RADAR_DETECTED = 2, ++}; ++ + #define PHYERR_TLV_SIG 0xBB + #define PHYERR_TLV_TAG_SEARCH_FFT_REPORT 0xFB + #define PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY 0xF8 +@@ -6586,6 +6614,10 @@ struct wmi_phyerr_hdr_arg { + const void *phyerrs; + }; + ++struct wmi_dfs_status_ev_arg { ++ u32 status; ++}; ++ + struct wmi_svc_rdy_ev_arg { + __le32 min_tx_power; + __le32 max_tx_power; diff --git a/package/kernel/mac80211/patches/380-0009-ath10k-fix-memory-leak-of-tpc_stats.patch b/package/kernel/mac80211/patches/380-0009-ath10k-fix-memory-leak-of-tpc_stats.patch new file mode 100644 index 000000000..196a2bc86 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0009-ath10k-fix-memory-leak-of-tpc_stats.patch @@ -0,0 +1,43 @@ +From 260e629bbf441585860e21d5e10d2e88437f47c8 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Sun, 27 May 2018 22:17:02 +0100 +Subject: [PATCH] ath10k: fix memory leak of tpc_stats + +Currently tpc_stats is allocated and is leaked on the return +path if num_tx_chain is greater than WMI_TPC_TX_N_CHAIN. Avoid +this leak by performing the check on num_tx_chain before the +allocation of tpc_stats. + +Detected by CoverityScan, CID#1469422 ("Resource Leak") +Fixes: 4b190675ad06 ("ath10k: fix kernel panic while reading tpc_stats") + +Signed-off-by: Colin Ian King +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/wmi.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -4557,10 +4557,6 @@ void ath10k_wmi_event_pdev_tpc_config(st + + ev = (struct wmi_pdev_tpc_config_event *)skb->data; + +- tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); +- if (!tpc_stats) +- return; +- + num_tx_chain = __le32_to_cpu(ev->num_tx_chain); + + if (num_tx_chain > WMI_TPC_TX_N_CHAIN) { +@@ -4569,6 +4565,10 @@ void ath10k_wmi_event_pdev_tpc_config(st + return; + } + ++ tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); ++ if (!tpc_stats) ++ return; ++ + ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table, + num_tx_chain); + diff --git a/package/kernel/mac80211/patches/380-0010-ath10k-support-use-of-channel-173.patch b/package/kernel/mac80211/patches/380-0010-ath10k-support-use-of-channel-173.patch new file mode 100644 index 000000000..06b68b280 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0010-ath10k-support-use-of-channel-173.patch @@ -0,0 +1,52 @@ +From 38441fb6fcbb97817dff5c012609860a2b39c3e9 Mon Sep 17 00:00:00 2001 +From: Ben Greear +Date: Tue, 2 Jan 2018 16:51:01 -0800 +Subject: [PATCH] ath10k: support use of channel 173 + +The India regulatory domain allows CH 173, so add that to the +available channel list. I verified basic connectivity between +a 9880 and 9984 NIC. + +Signed-off-by: Ben Greear +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/core.h | 3 ++- + drivers/net/wireless/ath/ath10k/mac.c | 3 +++ + drivers/net/wireless/ath/ath10k/wmi.c | 2 +- + 3 files changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -47,7 +47,8 @@ + #define WMI_READY_TIMEOUT (5 * HZ) + #define ATH10K_FLUSH_TIMEOUT_HZ (5 * HZ) + #define ATH10K_CONNECTION_LOSS_HZ (3 * HZ) +-#define ATH10K_NUM_CHANS 40 ++#define ATH10K_NUM_CHANS 41 ++#define ATH10K_MAX_5G_CHAN 173 + + /* Antenna noise floor */ + #define ATH10K_DEFAULT_NOISE_FLOOR -95 +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -7766,6 +7766,9 @@ static const struct ieee80211_channel at + CHAN5G(161, 5805, 0), + CHAN5G(165, 5825, 0), + CHAN5G(169, 5845, 0), ++ CHAN5G(173, 5865, 0), ++ /* If you add more, you may need to change ATH10K_MAX_5G_CHAN */ ++ /* And you will definitely need to change ATH10K_NUM_CHANS in core.h */ + }; + + struct ath10k *ath10k_mac_create(size_t priv_size) +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -2363,7 +2363,7 @@ int ath10k_wmi_event_mgmt_rx(struct ath1 + */ + if (channel >= 1 && channel <= 14) { + status->band = NL80211_BAND_2GHZ; +- } else if (channel >= 36 && channel <= 169) { ++ } else if (channel >= 36 && channel <= ATH10K_MAX_5G_CHAN) { + status->band = NL80211_BAND_5GHZ; + } else { + /* Shouldn't happen unless list of advertised channels to diff --git a/package/kernel/mac80211/patches/380-0011-ath10k-fix-spectral-scan-for-QCA9984-and-QCA9888-chi.patch b/package/kernel/mac80211/patches/380-0011-ath10k-fix-spectral-scan-for-QCA9984-and-QCA9888-chi.patch new file mode 100644 index 000000000..b974113b5 --- /dev/null +++ b/package/kernel/mac80211/patches/380-0011-ath10k-fix-spectral-scan-for-QCA9984-and-QCA9888-chi.patch @@ -0,0 +1,156 @@ +From 2e9bcd0d73243f5e49daf92508d64cc33c30da01 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Periyasamy +Date: Tue, 29 May 2018 17:01:13 +0530 +Subject: [PATCH] ath10k: fix spectral scan for QCA9984 and QCA9888 chipsets + +The spectral scan has been always broken on QCA9984 and QCA9888. + +Introduce a hardware parameter 'spectral_bin_offset' to resolve this issue for +QCA9984 and QCA9888 chipsets. For other chipsets, the hardware parameter +'spectral_bin_offset' is zero so that existing behaviour is retained as it is. + +In QCA9984 and QCA9888 chipsets, hardware param value 'spectral_bin_discard' +is 12 bytes. This 12 bytes is derived as the sum of segment index (4 bytes), +extra bins before the actual data (4 bytes) and extra bins after the actual +data (4 bytes). Always discarding (12 bytes) happens at end of the samples and +incorrect samples got dumped, so that user can find incorrect arrangement +samples in spectral scan dump. + +To fix this issue, we have to discard first 8 bytes and last 4 bytes in every +samples, so totally 12 bytes are discarded. In every sample we need to consider +the offset while taking the actual spectral data. For QCA9984, QCA9888 the +offset is 8 bytes (segment index + extra bins before actual data). + +Hardware tested: QCA9984 and QCA9888 +Firmware tested: 10.4-3.5.3-00053 + +Signed-off-by: Karthikeyan Periyasamy +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/core.c | 13 +++++++++++++ + drivers/net/wireless/ath/ath10k/hw.h | 3 +++ + drivers/net/wireless/ath/ath10k/spectral.c | 2 +- + 3 files changed, 17 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -72,6 +72,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca988x_ops, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -96,6 +97,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca988x_ops, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -119,6 +121,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca988x_ops, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -142,6 +145,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca988x_ops, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -165,6 +169,8 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca988x_ops, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -191,6 +197,7 @@ static const struct ath10k_hw_params ath + .target_cpu_freq = 176000000, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -220,6 +227,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca99x0_ops, + .decap_align_bytes = 1, + .spectral_bin_discard = 4, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 11, +@@ -250,6 +258,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca99x0_ops, + .decap_align_bytes = 1, + .spectral_bin_discard = 12, ++ .spectral_bin_offset = 8, + + /* Can do only 2x2 VHT160 or 80+80. 1560Mbps is 4x4 80Mhz + * or 2x2 160Mhz, long-guard-interval. +@@ -283,6 +292,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca99x0_ops, + .decap_align_bytes = 1, + .spectral_bin_discard = 12, ++ .spectral_bin_offset = 8, + + /* Can do only 1x1 VHT160 or 80+80. 780Mbps is 2x2 80Mhz or + * 1x1 160Mhz, long-guard-interval. +@@ -310,6 +320,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca988x_ops, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -335,6 +346,7 @@ static const struct ath10k_hw_params ath + .target_cpu_freq = 176000000, + .decap_align_bytes = 4, + .spectral_bin_discard = 0, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, +@@ -365,6 +377,7 @@ static const struct ath10k_hw_params ath + .hw_ops = &qca99x0_ops, + .decap_align_bytes = 1, + .spectral_bin_discard = 4, ++ .spectral_bin_offset = 0, + .vht160_mcs_rx_highest = 0, + .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 11, +--- a/drivers/net/wireless/ath/ath10k/hw.h ++++ b/drivers/net/wireless/ath/ath10k/hw.h +@@ -553,6 +553,9 @@ struct ath10k_hw_params { + + /* Number of ciphers supported (i.e First N) in cipher_suites array */ + int n_cipher_suites; ++ ++ /* Number of bytes to be the offset for each FFT sample */ ++ int spectral_bin_offset; + }; + + struct htt_rx_desc; +--- a/drivers/net/wireless/ath/ath10k/spectral.c ++++ b/drivers/net/wireless/ath/ath10k/spectral.c +@@ -145,7 +145,7 @@ int ath10k_spectral_process_fft(struct a + fft_sample->noise = __cpu_to_be16(phyerr->nf_chains[chain_idx]); + + bins = (u8 *)fftr; +- bins += sizeof(*fftr); ++ bins += sizeof(*fftr) + ar->hw_params.spectral_bin_offset; + + fft_sample->tsf = __cpu_to_be64(tsf); + diff --git a/package/kernel/mac80211/patches/381-ath9k-fix-tx99-with-monitor-mode-interface.patch b/package/kernel/mac80211/patches/381-ath9k-fix-tx99-with-monitor-mode-interface.patch new file mode 100644 index 000000000..777b73417 --- /dev/null +++ b/package/kernel/mac80211/patches/381-ath9k-fix-tx99-with-monitor-mode-interface.patch @@ -0,0 +1,92 @@ +From: Felix Fietkau +Date: Mon, 20 Aug 2018 11:35:05 +0200 +Subject: [PATCH] ath9k: fix tx99 with monitor mode interface + +Tx99 is typically configured via a monitor mode interface, which does +not get added to the driver as a vif. Since the code currently expects +a configured virtual interface for tx99, enabling tx99 via debugfs fails. +Since the vif is not needed anyway, remove all checks for it. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -1074,7 +1074,6 @@ struct ath_softc { + + struct ath_spec_scan_priv spec_priv; + +- struct ieee80211_vif *tx99_vif; + struct sk_buff *tx99_skb; + bool tx99_state; + s16 tx99_power; +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1251,15 +1251,10 @@ static int ath9k_add_interface(struct ie + struct ath_vif *avp = (void *)vif->drv_priv; + struct ath_node *an = &avp->mcast_node; + +- mutex_lock(&sc->mutex); ++ if (IS_ENABLED(CPTCFG_ATH9K_TX99)) ++ return -EOPNOTSUPP; + +- if (IS_ENABLED(CPTCFG_ATH9K_TX99)) { +- if (sc->cur_chan->nvifs >= 1) { +- mutex_unlock(&sc->mutex); +- return -EOPNOTSUPP; +- } +- sc->tx99_vif = vif; +- } ++ mutex_lock(&sc->mutex); + + ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); + sc->cur_chan->nvifs++; +@@ -1342,7 +1337,6 @@ static void ath9k_remove_interface(struc + ath9k_p2p_remove_vif(sc, vif); + + sc->cur_chan->nvifs--; +- sc->tx99_vif = NULL; + if (!ath9k_is_chanctx_enabled()) + list_del(&avp->list); + +--- a/drivers/net/wireless/ath/ath9k/tx99.c ++++ b/drivers/net/wireless/ath/ath9k/tx99.c +@@ -54,12 +54,6 @@ static struct sk_buff *ath9k_build_tx99_ + struct ieee80211_hdr *hdr; + struct ieee80211_tx_info *tx_info; + struct sk_buff *skb; +- struct ath_vif *avp; +- +- if (!sc->tx99_vif) +- return NULL; +- +- avp = (struct ath_vif *)sc->tx99_vif->drv_priv; + + skb = alloc_skb(len, GFP_KERNEL); + if (!skb) +@@ -77,14 +71,11 @@ static struct sk_buff *ath9k_build_tx99_ + memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); + memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); + +- hdr->seq_ctrl |= cpu_to_le16(avp->seq_no); +- + tx_info = IEEE80211_SKB_CB(skb); + memset(tx_info, 0, sizeof(*tx_info)); + rate = &tx_info->control.rates[0]; + tx_info->band = sc->cur_chan->chandef.chan->band; + tx_info->flags = IEEE80211_TX_CTL_NO_ACK; +- tx_info->control.vif = sc->tx99_vif; + rate->count = 1; + if (ah->curchan && IS_CHAN_HT(ah->curchan)) { + rate->flags |= IEEE80211_TX_RC_MCS; +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -2973,7 +2973,7 @@ int ath9k_tx99_send(struct ath_softc *sc + return -EINVAL; + } + +- ath_set_rates(sc->tx99_vif, NULL, bf); ++ ath_set_rates(NULL, NULL, bf); + + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr); + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum); diff --git a/package/kernel/mac80211/patches/552-ahb_of.patch b/package/kernel/mac80211/patches/552-ahb_of.patch new file mode 100644 index 000000000..8c20b00dd --- /dev/null +++ b/package/kernel/mac80211/patches/552-ahb_of.patch @@ -0,0 +1,330 @@ +--- a/drivers/net/wireless/ath/ath9k/ahb.c ++++ b/drivers/net/wireless/ath/ath9k/ahb.c +@@ -19,7 +19,15 @@ + #include + #include + #include ++#include + #include "ath9k.h" ++#include ++ ++#ifdef CONFIG_OF ++#include ++#include ++#include ++#endif + + static const struct platform_device_id ath9k_platform_id_table[] = { + { +@@ -68,6 +76,235 @@ static const struct ath_bus_ops ath_ahb_ + .eeprom_read = ath_ahb_eeprom_read, + }; + ++#ifdef CONFIG_OF ++ ++#define QCA955X_DDR_CTL_CONFIG 0x108 ++#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23) ++ ++static int of_get_wifi_cal(struct device_node *np, struct ath9k_platform_data *pdata) ++{ ++#ifdef CONFIG_MTD ++ struct device_node *mtd_np = NULL; ++ size_t retlen; ++ int size, ret; ++ struct mtd_info *mtd; ++ const char *part; ++ const __be32 *list; ++ phandle phandle; ++ ++ list = of_get_property(np, "mtd-cal-data", &size); ++ if (!list) ++ return 0; ++ ++ if (size != (2 * sizeof(*list))) ++ return 1; ++ ++ phandle = be32_to_cpup(list++); ++ if (phandle) ++ mtd_np = of_find_node_by_phandle(phandle); ++ ++ if (!mtd_np) ++ return 1; ++ ++ part = of_get_property(mtd_np, "label", NULL); ++ if (!part) ++ part = mtd_np->name; ++ ++ mtd = get_mtd_device_nm(part); ++ if (IS_ERR(mtd)) ++ return 1; ++ ++ ret = mtd_read(mtd, be32_to_cpup(list), sizeof(pdata->eeprom_data), ++ &retlen, (u8*)pdata->eeprom_data); ++ put_mtd_device(mtd); ++ ++#endif ++ return 0; ++} ++ ++static int ar913x_wmac_reset(void) ++{ ++ ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); ++ mdelay(10); ++ ++ ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); ++ mdelay(10); ++ ++ return 0; ++} ++ ++static int ar933x_wmac_reset(void) ++{ ++ int retries = 20; ++ ++ ath79_device_reset_set(AR933X_RESET_WMAC); ++ ath79_device_reset_clear(AR933X_RESET_WMAC); ++ ++ while (1) { ++ u32 bootstrap; ++ ++ bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); ++ if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0) ++ return 0; ++ ++ if (retries-- == 0) ++ break; ++ ++ udelay(10000); ++ } ++ ++ pr_err("ar933x: WMAC reset timed out"); ++ return -ETIMEDOUT; ++} ++ ++static int qca955x_wmac_reset(void) ++{ ++ int i; ++ ++ /* Try to wait for WMAC DDR activity to stop */ ++ for (i = 0; i < 10; i++) { ++ if (!(__raw_readl(ath79_ddr_base + QCA955X_DDR_CTL_CONFIG) & ++ QCA955X_DDR_CTL_CONFIG_ACT_WMAC)) ++ break; ++ ++ udelay(10); ++ } ++ ++ ath79_device_reset_set(QCA955X_RESET_RTC); ++ udelay(10); ++ ath79_device_reset_clear(QCA955X_RESET_RTC); ++ udelay(10); ++ ++ return 0; ++} ++ ++enum { ++ AR913X_WMAC = 0, ++ AR933X_WMAC, ++ AR934X_WMAC, ++ QCA953X_WMAC, ++ QCA955X_WMAC, ++ QCA956X_WMAC, ++}; ++ ++static int ar9330_get_soc_revision(void) ++{ ++ if (ath79_soc_rev == 1) ++ return ath79_soc_rev; ++ ++ return 0; ++} ++ ++static int ath79_get_soc_revision(void) ++{ ++ return ath79_soc_rev; ++} ++ ++static const struct of_ath_ahb_data { ++ u16 dev_id; ++ u32 bootstrap_reg; ++ u32 bootstrap_ref; ++ ++ int (*soc_revision)(void); ++ int (*wmac_reset)(void); ++} of_ath_ahb_data[] = { ++ [AR913X_WMAC] = { ++ .dev_id = AR5416_AR9100_DEVID, ++ .wmac_reset = ar913x_wmac_reset, ++ ++ }, ++ [AR933X_WMAC] = { ++ .dev_id = AR9300_DEVID_AR9330, ++ .bootstrap_reg = AR933X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = AR933X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ar9330_get_soc_revision, ++ .wmac_reset = ar933x_wmac_reset, ++ }, ++ [AR934X_WMAC] = { ++ .dev_id = AR9300_DEVID_AR9340, ++ .bootstrap_reg = AR934X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = AR934X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ath79_get_soc_revision, ++ }, ++ [QCA953X_WMAC] = { ++ .dev_id = AR9300_DEVID_AR953X, ++ .bootstrap_reg = QCA953X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = QCA953X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ath79_get_soc_revision, ++ }, ++ [QCA955X_WMAC] = { ++ .dev_id = AR9300_DEVID_QCA955X, ++ .bootstrap_reg = QCA955X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = QCA955X_BOOTSTRAP_REF_CLK_40, ++ .wmac_reset = qca955x_wmac_reset, ++ }, ++ [QCA956X_WMAC] = { ++ .dev_id = AR9300_DEVID_QCA956X, ++ .bootstrap_reg = QCA956X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = QCA956X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ath79_get_soc_revision, ++ }, ++}; ++ ++const struct of_device_id of_ath_ahb_match[] = { ++ { .compatible = "qca,ar9130-wmac", .data = &of_ath_ahb_data[AR913X_WMAC] }, ++ { .compatible = "qca,ar9330-wmac", .data = &of_ath_ahb_data[AR933X_WMAC] }, ++ { .compatible = "qca,ar9340-wmac", .data = &of_ath_ahb_data[AR934X_WMAC] }, ++ { .compatible = "qca,qca9530-wmac", .data = &of_ath_ahb_data[QCA953X_WMAC] }, ++ { .compatible = "qca,qca9550-wmac", .data = &of_ath_ahb_data[QCA955X_WMAC] }, ++ { .compatible = "qca,qca9560-wmac", .data = &of_ath_ahb_data[QCA956X_WMAC] }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, of_ath_ahb_match); ++ ++static int of_ath_ahb_probe(struct platform_device *pdev) ++{ ++ struct ath9k_platform_data *pdata; ++ const struct of_device_id *match; ++ const struct of_ath_ahb_data *data; ++ u8 led_pin; ++ ++ match = of_match_device(of_ath_ahb_match, &pdev->dev); ++ data = (const struct of_ath_ahb_data *)match->data; ++ ++ pdata = dev_get_platdata(&pdev->dev); ++ ++ if (!of_property_read_u8(pdev->dev.of_node, "qca,led-pin", &led_pin)) ++ pdata->led_pin = led_pin; ++ else ++ pdata->led_pin = -1; ++ ++ if (of_property_read_bool(pdev->dev.of_node, "qca,disable-2ghz")) ++ pdata->disable_2ghz = true; ++ ++ if (of_property_read_bool(pdev->dev.of_node, "qca,disable-5ghz")) ++ pdata->disable_5ghz = true; ++ ++ if (of_property_read_bool(pdev->dev.of_node, "qca,tx-gain-buffalo")) ++ pdata->tx_gain_buffalo = true; ++ ++ if (data->wmac_reset) { ++ data->wmac_reset(); ++ pdata->external_reset = data->wmac_reset; ++ } ++ ++ if (data->bootstrap_reg && data->bootstrap_ref) { ++ u32 t = ath79_reset_rr(data->bootstrap_reg); ++ if (t & data->bootstrap_ref) ++ pdata->is_clk_25mhz = false; ++ else ++ pdata->is_clk_25mhz = true; ++ } ++ ++ pdata->get_mac_revision = data->soc_revision; ++ ++ if (of_get_wifi_cal(pdev->dev.of_node, pdata)) ++ dev_err(&pdev->dev, "failed to load calibration data from mtd device\n"); ++ ++ return data->dev_id; ++} ++#endif ++ + static int ath_ahb_probe(struct platform_device *pdev) + { + void __iomem *mem; +@@ -79,6 +316,17 @@ static int ath_ahb_probe(struct platform + int ret = 0; + struct ath_hw *ah; + char hw_name[64]; ++ u16 dev_id; ++ ++ if (id) ++ dev_id = id->driver_data; ++ ++#ifdef CONFIG_OF ++ if (pdev->dev.of_node) ++ pdev->dev.platform_data = devm_kzalloc(&pdev->dev, ++ sizeof(struct ath9k_platform_data), ++ GFP_KERNEL); ++#endif + + if (!dev_get_platdata(&pdev->dev)) { + dev_err(&pdev->dev, "no platform data specified\n"); +@@ -121,13 +369,16 @@ static int ath_ahb_probe(struct platform + sc->mem = mem; + sc->irq = irq; + ++#ifdef CONFIG_OF ++ dev_id = of_ath_ahb_probe(pdev); ++#endif + ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); + if (ret) { + dev_err(&pdev->dev, "request_irq failed\n"); + goto err_free_hw; + } + +- ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); ++ ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops); + if (ret) { + dev_err(&pdev->dev, "failed to initialize device\n"); + goto err_irq; +@@ -158,6 +409,9 @@ static int ath_ahb_remove(struct platfor + free_irq(sc->irq, sc); + ieee80211_free_hw(sc->hw); + } ++#ifdef CONFIG_OF ++ pdev->dev.platform_data = NULL; ++#endif + + return 0; + } +@@ -167,6 +421,9 @@ static struct platform_driver ath_ahb_dr + .remove = ath_ahb_remove, + .driver = { + .name = "ath9k", ++#ifdef CONFIG_OF ++ .of_match_table = of_ath_ahb_match, ++#endif + }, + .id_table = ath9k_platform_id_table, + }; +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "common.h" + #include "debug.h" +@@ -1023,6 +1024,9 @@ struct ath_softc { + struct ath_hw *sc_ah; + void __iomem *mem; + int irq; ++#ifdef CONFIG_OF ++ struct reset_control *reset; ++#endif + spinlock_t sc_serial_rw; + spinlock_t sc_pm_lock; + spinlock_t sc_pcu_lock; diff --git a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch index b0c5d5ba3..86a95a09f 100644 --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -296,6 +296,7 @@ RT2X00_LIB_FIRMWARE= +@@ -299,6 +299,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch index 65782906a..e70738322 100644 --- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1322,6 +1322,7 @@ int __init brcmf_core_init(void) +@@ -1347,6 +1347,7 @@ int __init brcmf_core_init(void) { if (!schedule_work(&brcmf_driver_work)) return -EBUSY; diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch index 2c466a300..fbf33a213 100644 --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -2494,6 +2494,16 @@ int ath10k_core_register(struct ath10k * +@@ -2507,6 +2507,16 @@ int ath10k_core_register(struct ath10k * ar->chip_id = chip_id; queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch index 21e7359bc..9df469691 100644 --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8080,6 +8080,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -8122,6 +8122,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -8352,6 +8367,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -8397,6 +8412,12 @@ int ath10k_mac_register(struct ath10k *a wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); diff --git a/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch b/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch index ea30a9dfd..e1aaefd03 100644 --- a/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch +++ b/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -770,7 +770,7 @@ static int ath10k_core_get_board_id_from +@@ -783,7 +783,7 @@ static int ath10k_core_get_board_id_from if (ret) { ath10k_err(ar, "could not execute otp for board id check: %d\n", ret); diff --git a/package/kernel/mac80211/patches/941-mwl8k-add-non-DFS-5G-upper-channels.patch b/package/kernel/mac80211/patches/941-mwl8k-add-non-DFS-5G-upper-channels.patch new file mode 100644 index 000000000..e82db4d67 --- /dev/null +++ b/package/kernel/mac80211/patches/941-mwl8k-add-non-DFS-5G-upper-channels.patch @@ -0,0 +1,37 @@ +From 4628257bf3006c18e0037459922624f02a138aed Mon Sep 17 00:00:00 2001 +From: Weixiao Zhang +Date: Thu, 16 Nov 2017 01:59:55 -0600 +Subject: [PATCH] mwl8k: Expand non-DFS 5G channels + +Add non-DFS 5G upper channels (149-165) besides existed 4 lower channels +(36, 40, 44, 48). + +Signed-off-by: Weixiao Zhang +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/marvell/mwl8k.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/marvell/mwl8k.c ++++ b/drivers/net/wireless/marvell/mwl8k.c +@@ -199,7 +199,7 @@ struct mwl8k_priv { + struct ieee80211_channel channels_24[14]; + struct ieee80211_rate rates_24[13]; + struct ieee80211_supported_band band_50; +- struct ieee80211_channel channels_50[4]; ++ struct ieee80211_channel channels_50[9]; + struct ieee80211_rate rates_50[8]; + u32 ap_macids_supported; + u32 sta_macids_supported; +@@ -383,6 +383,11 @@ static const struct ieee80211_channel mw + { .band = NL80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, }, + { .band = NL80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, }, + { .band = NL80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, }, ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, }, ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, }, ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, }, ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, }, ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5825, .hw_value = 165, }, + }; + + static const struct ieee80211_rate mwl8k_rates_50[] = { diff --git a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch index 9dceea8f4..a7eb0a0d8 100644 --- a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch +++ b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -1,31 +1,26 @@ -From: Sebastian Gottschall +From: Sebastian Gottschall -current handling of peer_bw_rxnss_override parameter is based on guessing the -VHT160/8080 capability by rx rate. this is wrong and may lead -to a non initialized peer_bw_rxnss_override parameter which is required since -VHT160 operation mode only supports 2x2 chainmasks in addition the original code +current handling of peer_bw_rxnss_override parameter is based on guessing the VHT160/8080 capability by rx rate. this is wrong and may lead +to a non initialized peer_bw_rxnss_override parameter which is required since VHT160 operation mode only supports 2x2 chainmasks in addition the original code initialized the parameter with wrong masked values. -This patch uses the peer phymode and peer nss information for correct -initialisation of the peer_bw_rxnss_override parameter. -if this peer information is not available, we initialize the parameter by -minimum nss which is suggested by QCA as temporary workaround according +This patch uses the peer phymode and peer nss information for correct initialisation of the peer_bw_rxnss_override parameter. +if this peer information is not available, we initialize the parameter by minimum nss which is suggested by QCA as temporary workaround according to the QCA sourcecodes. -Signed-off-by: Sebastian Gottschall +Signed-off-by: Sebastian Gottschall v2: remove debug messages v3: apply some cosmetics, update documentation -v4: fix compile warning and truncate nss to maximum of 2x2 since current -chipsets only support 2x2 at vht160 +v4: fix compile warning and truncate nss to maximum of 2x2 since current chipsets only support 2x2 at vht160 v5: handle maximum nss for chipsets supportig vht160 with 1x1 only -v7: use more simple code variant and take care about hw/sw chainmask -configuration +v7: use more simple code variant and take care about hw/sw chainmask configuration +v8: fix some code style issues +v9: use SM/MS macros from code.h to simplify shift/mask handling --- - drivers/net/wireless/ath/ath10k/mac.c | 40 +++++++++++++++------------ - drivers/net/wireless/ath/ath10k/wmi.c | 7 +---- - drivers/net/wireless/ath/ath10k/wmi.h | 14 +++++++++- - 3 files changed, 36 insertions(+), 25 deletions(-) - + drivers/net/wireless/ath/ath10k/mac.c | 54 +++++++++++++++++++-------- + drivers/net/wireless/ath/ath10k/wmi.c | 7 +--- + drivers/net/wireless/ath/ath10k/wmi.h | 14 ++++++- + 3 files changed, 52 insertions(+), 23 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2466,7 +2466,7 @@ static void ath10k_peer_assoc_h_vht(stru @@ -37,7 +32,7 @@ configuration if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; -@@ -2526,23 +2526,27 @@ static void ath10k_peer_assoc_h_vht(stru +@@ -2526,23 +2526,45 @@ static void ath10k_peer_assoc_h_vht(stru __le16_to_cpu(vht_cap->vht_mcs.tx_highest); arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); @@ -46,7 +41,10 @@ configuration - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", - sta->addr, arg->peer_max_mpdu, arg->peer_flags); -- ++ /* only local 4x4 configuration do support 2x2 for VHT160, ++ * everything else must use 1x1 ++ */ + - if (arg->peer_vht_rates.rx_max_rate && - (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { - switch (arg->peer_vht_rates.rx_max_rate) { @@ -59,28 +57,42 @@ configuration - arg->peer_bw_rxnss_override = 1; - break; - } -+ /* only 4x4 configuration do support 2x2 for VHT160, everything else must use 1x1 */ + if (ar->cfg_rx_chainmask == 15) -+ nss160 = arg->peer_num_spatial_streams <= 2 ? arg->peer_num_spatial_streams : 2; ++ nss160 = arg->peer_num_spatial_streams <= 2 ? 1 : 2; + -+ /* in case if peer is connected with vht160 or vht80+80, we need to properly adjust rxnss parameters otherwise firmware will raise a assert */ -+ switch(arg->peer_phymode) { ++ /* if peer provides 1x1 nss160 information using max rate ++ * vht information, we reduce local nss160 to 1x1. ++ * consider that it has been observed that some client ++ * devices provide zero here, no matter which transmission ++ * rate is possible. in that case the local nss configuration ++ * will be used at maxmimum configuration possible. (see above) ++ */ ++ ++ if (arg->peer_vht_rates.rx_max_rate == 780) ++ nss160 = 1; ++ ++ /* in case if peer is connected with vht160 or vht80+80, ++ * we need to properly adjust rxnss parameters otherwise ++ * firmware will raise a assert ++ */ ++ switch (arg->peer_phymode) { + case MODE_11AC_VHT80_80: + arg->peer_bw_rxnss_override = BW_NSS_FWCONF_80_80(nss160); + /* fall through */ + case MODE_11AC_VHT160: + arg->peer_bw_rxnss_override |= BW_NSS_FWCONF_160(nss160); -+ break; ++ break; + default: -+ break; ++ break; } + + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x peer_bw_rxnss_override 0x%x\n", -+ sta->addr, arg->peer_max_mpdu, arg->peer_flags, arg->peer_bw_rxnss_override); ++ sta->addr, arg->peer_max_mpdu, arg->peer_flags, ++ arg->peer_bw_rxnss_override); } static void ath10k_peer_assoc_h_qos(struct ath10k *ar, -@@ -2694,9 +2698,9 @@ static int ath10k_peer_assoc_prepare(str +@@ -2694,9 +2716,9 @@ static int ath10k_peer_assoc_prepare(str ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); ath10k_peer_assoc_h_rates(ar, vif, sta, arg); ath10k_peer_assoc_h_ht(ar, vif, sta, arg); @@ -93,7 +105,7 @@ configuration } --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -6760,12 +6760,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a +@@ -7231,12 +7231,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); @@ -109,24 +121,24 @@ configuration static int --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -6209,7 +6209,19 @@ struct wmi_10_2_peer_assoc_complete_cmd +@@ -6306,7 +6306,19 @@ struct wmi_10_2_peer_assoc_complete_cmd __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ } __packed; -#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 -+#define BW_NSS_FWCONF_MAP_ENABLE (1 << 31) -+#define BW_NSS_FWCONF_MAP_160MHZ_S (0) -+#define BW_NSS_FWCONF_MAP_160MHZ_M (0x00000007) -+#define BW_NSS_FWCONF_MAP_80_80MHZ_S (3) -+#define BW_NSS_FWCONF_MAP_80_80MHZ_M (0x00000038) -+#define BW_NSS_FWCONF_MAP_M (0x0000003F) ++#define BW_NSS_FWCONF_MAP_ENABLE BIT(31) ++#define BW_NSS_FWCONF_MAP_160MHZ_LSB (0) ++#define BW_NSS_FWCONF_MAP_160MHZ_MASK (0x00000007) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_LSB (3) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_MASK (0x00000038) ++#define BW_NSS_FWCONF_MAP_MASK (0x0000003F) + -+#define GET_BW_NSS_FWCONF_160(x) ((((x) & BW_NSS_FWCONF_MAP_160MHZ_M) >> BW_NSS_FWCONF_MAP_160MHZ_S) + 1) -+#define GET_BW_NSS_FWCONF_80_80(x) ((((x) & BW_NSS_FWCONF_MAP_80_80MHZ_M) >> BW_NSS_FWCONF_MAP_80_80MHZ_S) + 1) ++#define GET_BW_NSS_FWCONF_160(x) (MS(x, BW_NSS_FWCONF_MAP_160MHZ) + 1) ++#define GET_BW_NSS_FWCONF_80_80(x) (MS(x, BW_NSS_FWCONF_MAP_80_80MHZ) + 1) + +/* Values defined to set 160 MHz Bandwidth NSS Mapping into FW*/ -+#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_160MHZ_S) & BW_NSS_FWCONF_MAP_160MHZ_M)) -+#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_80_80MHZ_S) & BW_NSS_FWCONF_MAP_80_80MHZ_M)) ++#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | SM(x - 1, BW_NSS_FWCONF_MAP_160MHZ)) ++#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | SM(x - 1, BW_NSS_FWCONF_MAP_80_80MHZ)) struct wmi_10_4_peer_assoc_complete_cmd { struct wmi_10_2_peer_assoc_complete_cmd cmd; diff --git a/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch b/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch index 657b31f5a..c5c8b1063 100644 --- a/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch +++ b/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch @@ -4,13 +4,16 @@ starting with firmware 10.4.3.4.x series QCA changed the handling of the channel likelly for backward compatiblity with vht80 only capable clients. this patch adjusts the handling to get vht160 to work again with official qca firmwares newer than 3.3 consider that this patch will not work with older firmwares anymore. to avoid undefined behaviour this we disable vht160 capability for outdated firmwares +Signed-off-by: Sebastian Gottschall + +v2: fix trailing whitespace issue and fix some typos within the commit note --- drivers/net/wireless/ath/ath10k/mac.c | 7 ------- drivers/net/wireless/ath/ath10k/wmi.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -4415,13 +4415,6 @@ static struct ieee80211_sta_vht_cap ath1 +@@ -4445,13 +4445,6 @@ static struct ieee80211_sta_vht_cap ath1 vht_cap.cap |= val; } @@ -26,7 +29,7 @@ consider that this patch will not work with older firmwares anymore. to avoid un if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -1660,13 +1660,18 @@ void ath10k_wmi_put_wmi_channel(struct w +@@ -1672,13 +1672,18 @@ void ath10k_wmi_put_wmi_channel(struct w flags |= WMI_CHAN_FLAG_HT40_PLUS; if (arg->chan_radar) flags |= WMI_CHAN_FLAG_DFS; @@ -42,7 +45,7 @@ consider that this patch will not work with older firmwares anymore. to avoid un + if (arg->freq < arg->band_center_freq1) + ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 - 40); + else -+ ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 + 40); ++ ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 + 40); + ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq1); + } ch->min_power = arg->min_power; diff --git a/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index ee216529f..009cbfa88 100644 --- a/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -83,10 +83,8 @@ v13: 12 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/ath/ath10k/leds.c create mode 100644 drivers/net/wireless/ath/ath10k/leds.h -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/Kconfig -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig +--- a/drivers/net/wireless/ath/ath10k/Kconfig ++++ b/drivers/net/wireless/ath/ath10k/Kconfig @@ -56,6 +56,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -104,10 +102,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/Makefile -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile +--- a/drivers/net/wireless/ath/ath10k/Makefile ++++ b/drivers/net/wireless/ath/ath10k/Makefile @@ -18,6 +18,7 @@ ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o @@ -116,22 +112,18 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o -Index: backports-2017-11-01/local-symbols -=================================================================== ---- backports-2017-11-01.orig/local-symbols -+++ backports-2017-11-01/local-symbols -@@ -143,6 +143,7 @@ ATH10K_USB= - ATH10K_DEBUG= +--- a/local-symbols ++++ b/local-symbols +@@ -144,6 +144,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= + ATH10K_THERMAL= +ATH10K_LEDS= ATH10K_TRACING= ATH10K_DFS_CERTIFIED= WCN36XX= -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/core.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c @@ -32,6 +32,7 @@ #include "htt.h" #include "testmode.h" @@ -148,7 +140,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -80,6 +82,7 @@ static const struct ath10k_hw_params ath +@@ -81,6 +83,7 @@ static const struct ath10k_hw_params ath .id = QCA9887_HW_1_0_VERSION, .dev_id = QCA9887_1_0_DEVICE_ID, .name = "qca9887 hw1.0", @@ -156,7 +148,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -199,6 +202,7 @@ static const struct ath10k_hw_params ath +@@ -206,6 +209,7 @@ static const struct ath10k_hw_params ath .id = QCA99X0_HW_2_0_DEV_VERSION, .dev_id = QCA99X0_2_0_DEVICE_ID, .name = "qca99x0 hw2.0", @@ -164,7 +156,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -228,6 +232,7 @@ static const struct ath10k_hw_params ath +@@ -236,6 +240,7 @@ static const struct ath10k_hw_params ath .id = QCA9984_HW_1_0_DEV_VERSION, .dev_id = QCA9984_1_0_DEVICE_ID, .name = "qca9984/qca9994 hw1.0", @@ -172,7 +164,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -262,6 +267,7 @@ static const struct ath10k_hw_params ath +@@ -271,6 +276,7 @@ static const struct ath10k_hw_params ath .id = QCA9888_HW_2_0_DEV_VERSION, .dev_id = QCA9888_2_0_DEVICE_ID, .name = "qca9888 hw2.0", @@ -180,7 +172,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -2254,6 +2260,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -2267,6 +2273,10 @@ int ath10k_core_start(struct ath10k *ar, if (status) goto err_hif_stop; @@ -191,7 +183,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c return 0; err_hif_stop: -@@ -2471,9 +2481,18 @@ static void ath10k_core_register_work(st +@@ -2484,9 +2494,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -210,7 +202,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -2515,6 +2534,8 @@ void ath10k_core_unregister(struct ath10 +@@ -2528,6 +2547,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -219,10 +211,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/core.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h @@ -24,6 +24,7 @@ #include #include @@ -231,7 +221,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h #include "htt.h" #include "htc.h" -@@ -789,7 +790,6 @@ struct ath10k { +@@ -829,7 +830,6 @@ struct ath10k { u32 low_5ghz_chan; u32 high_5ghz_chan; bool ani_enabled; @@ -239,7 +229,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h bool p2p; struct { -@@ -972,6 +972,13 @@ struct ath10k { +@@ -1012,6 +1012,13 @@ struct ath10k { } testmode; struct { @@ -253,10 +243,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h /* protected by data_lock */ u32 fw_crash_counter; u32 fw_warm_reset_counter; -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/hw.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h +--- a/drivers/net/wireless/ath/ath10k/hw.h ++++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -490,6 +490,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; @@ -265,10 +253,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h u32 otp_exe_param; /* Type of hw cycle counter wraparound logic, for more info -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c -=================================================================== --- /dev/null -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c ++++ b/drivers/net/wireless/ath/ath10k/leds.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2005-2011 Atheros Communications Inc. @@ -373,10 +359,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c + led_classdev_unregister(&ar->leds.cdev); +} + -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h -=================================================================== --- /dev/null -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h ++++ b/drivers/net/wireless/ath/ath10k/leds.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. @@ -419,10 +403,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h + +#endif +#endif /* _LEDS_H_ */ -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/mac.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -32,6 +32,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" @@ -431,22 +413,20 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c /*********/ /* Rates */ -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi-ops.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h -@@ -197,6 +197,10 @@ struct wmi_ops { - (struct ath10k *ar, - enum wmi_bss_survey_req_type type); +--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h ++++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h +@@ -204,7 +204,10 @@ struct wmi_ops { struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); + struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar, + u32 param); + struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, + u32 input, u32 pull_type, u32 intr_mode); -+ + + struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); }; int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); -@@ -951,6 +955,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * +@@ -969,6 +972,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); } @@ -482,11 +462,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi-tlv.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -3619,6 +3619,8 @@ static const struct wmi_ops wmi_tlv_ops +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -3652,6 +3652,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -495,11 +473,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c -@@ -6580,6 +6580,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -7051,6 +7051,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -549,7 +525,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -8081,6 +8124,9 @@ static const struct wmi_ops wmi_ops = { +@@ -8596,6 +8639,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -559,7 +535,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -8151,6 +8197,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -8666,6 +8712,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -568,7 +544,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -8222,6 +8270,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -8737,6 +8785,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -577,7 +553,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -8292,6 +8342,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -8807,6 +8857,8 @@ static const struct wmi_ops wmi_10_2_4_o .gen_pdev_enable_adaptive_cca = ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, @@ -586,7 +562,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -8367,6 +8419,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -8886,6 +8938,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, @@ -595,11 +571,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c }; int ath10k_wmi_attach(struct ath10k *ar) -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.h -@@ -2899,6 +2899,41 @@ enum wmi_10_4_feature_mask { +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -2930,6 +2930,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/mac80211/patches/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/975-ath10k-use-tpt-trigger-by-default.patch new file mode 100644 index 000000000..80db9ec43 --- /dev/null +++ b/package/kernel/mac80211/patches/975-ath10k-use-tpt-trigger-by-default.patch @@ -0,0 +1,53 @@ +From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Fri, 22 Jun 2018 18:59:44 +0200 +Subject: [PATCH] ath10k: use tpt LED trigger by default + +Use the tpt LED trigger for each created phy led. Ths way LEDs attached +to the ath10k GPIO pins are indicating the phy status and blink on +traffic. + +Signed-off-by: Mathias Kresin +--- + drivers/net/wireless/ath/ath10k/core.h | 4 ++++ + drivers/net/wireless/ath/ath10k/leds.c | 4 +--- + drivers/net/wireless/ath/ath10k/mac.c | 2 +- + 3 files changed, 6 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -1055,6 +1055,10 @@ struct ath10k { + struct ath10k_radar_found_info last_radar_info; + struct work_struct radar_confirmation_work; + ++#ifdef CPTCFG_MAC80211_LEDS ++ const char *led_default_trigger; ++#endif ++ + /* must be last */ + u8 drv_priv[0] __aligned(sizeof(void *)); + }; +--- a/drivers/net/wireless/ath/ath10k/leds.c ++++ b/drivers/net/wireless/ath/ath10k/leds.c +@@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * + + ar->leds.cdev.name = ar->leds.label; + ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; +- +- /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ +- ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; ++ ar->leds.cdev.default_trigger = ar->led_default_trigger; + + ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); + if (ret) +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -8429,7 +8429,7 @@ int ath10k_mac_register(struct ath10k *a + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); + + #ifdef CPTCFG_MAC80211_LEDS +- ieee80211_create_tpt_led_trigger(ar->hw, ++ ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw, + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink, + ARRAY_SIZE(ath10k_tpt_blink)); + #endif diff --git a/package/kernel/mac80211/patches/976-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch b/package/kernel/mac80211/patches/976-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch new file mode 100644 index 000000000..4d45ed8e3 --- /dev/null +++ b/package/kernel/mac80211/patches/976-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch @@ -0,0 +1,44 @@ +From bbf0a8af2261bc7ae39b227ff6a1e9f45a008c27 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +Date: Mon, 30 Jul 2018 17:31:41 +0200 +Subject: [PATCH] ath10k: Limit available channels via DT ieee80211-freq-limit + +Tri-band devices (1x 2.4GHz + 2x 5GHz) often incorporate special filters in +the RX and TX path. These filtered channel can in theory still be used by +the hardware but the signal strength is reduced so much that it makes no +sense. + +There is already a DT property to limit the available channels but ath10k +has to manually call this functionality to limit the currrently set wiphy +channels further. + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.kernel.org/patch/10549245/ +--- + drivers/net/wireless/ath/ath10k/mac.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c +index 95243b48a179..8ed37ffd320f 100644 +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -18,6 +18,7 @@ + + #include "mac.h" + ++#include + #include + #include + #include +@@ -8306,6 +8307,7 @@ int ath10k_mac_register(struct ath10k *ar) + ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; + } + ++ wiphy_read_of_freq_limits(ar->hw->wiphy); + ath10k_mac_setup_ht_vht_cap(ar); + + ar->hw->wiphy->interface_modes = +-- +2.11.0 + diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 2906849cf..1e00aa788 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-07-13 -PKG_SOURCE_VERSION:=67803752363db5e81c7a74a9491a3041aa776284 -PKG_MIRROR_HASH:=733030674a782d96c5ea2fcbcbc2de5486f645d9fb4a84cfb74246a78b459569 +PKG_SOURCE_DATE:=2018-08-24 +PKG_SOURCE_VERSION:=30b8371ad7233c04fa825f318954791d3796c2bf +PKG_MIRROR_HASH:=388c95dbc7e6a971b3372654825c5641d9f92c8c2144768a87b00c02086ac7c8 PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 9e9824afe..20451f286 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -15,9 +15,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-06-15 -PKG_SOURCE_VERSION:=8683de8e97a31fe01cfd4e63ef6e9867b50aadae -PKG_MIRROR_HASH:=69cd9f7c79564e444edf423133b13dcfbba9f66c051516606049087fa1973a20 +PKG_SOURCE_DATE:=2018-08-10 +PKG_SOURCE_VERSION:=75374802d9ccf431a497bf494ca6a984a7ec2470 +PKG_MIRROR_HASH:=528132e554d99e30e011b7ddbfc615f11319668d6f45b0a4ecae14ae935c3914 PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index 07e1eb815..e03388dfe 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -8,16 +8,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.169 +PKG_VERSION:=0.173 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=9412fac7b30872b738bc1ed1ebcaed54493c26ef9a67887913498c17b10f3bc2 +PKG_HASH:=b76d8c133f68dad46250f5c223482c8299d454a69430d9aa5c19123345a000ff PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-3.0+ PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3 PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 PKG_USE_MIPS16:=0 @@ -56,17 +57,9 @@ ifeq ($(CONFIG_BUILD_NLS),y) TARGET_LDFLAGS += "-lintl" endif -ifdef CONFIG_USE_UCLIBC -CONFIGURE_VARS += \ - LIBS="-largp" -endif - -ifdef CONFIG_USE_MUSL -CONFIGURE_VARS += \ - LIBS="-largp" -endif - CONFIGURE_ARGS += \ + --program-prefix=eu- \ + --disable-nls \ --without-lzma TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral @@ -75,24 +68,24 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libasm/libasm.{a,so*} $(1)/usr/lib/ - $(CP) $(PKG_BUILD_DIR)/libdw/libdw.{a,so*} $(1)/usr/lib/ - $(CP) $(PKG_BUILD_DIR)/libelf/libelf.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libasm*.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdw*.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libelf*.{a,so*} $(1)/usr/lib/ endef define Package/libasm/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libasm/libasm.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libasm*.so* $(1)/usr/lib/ endef define Package/libdw/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libdw/libdw.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdw*.so* $(1)/usr/lib/ endef define Package/libelf1/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libelf/libelf.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libelf*.so* $(1)/usr/lib/ endef $(eval $(call BuildPackage,libasm)) diff --git a/package/libs/elfutils/patches/002-argp_standalone.patch b/package/libs/elfutils/patches/002-argp_standalone.patch deleted file mode 100644 index 8e2ca1bc0..000000000 --- a/package/libs/elfutils/patches/002-argp_standalone.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/lib/color.c -+++ b/lib/color.c -@@ -131,8 +131,10 @@ valid arguments are:\n\ - - 'never', 'no', 'none'\n\ - - 'auto', 'tty', 'if-tty'\n"), - program_invocation_short_name, arg); -+ char program_invocation_short_name_nonconst[sizeof(program_invocation_short_name)]; -+ strcpy(program_invocation_short_name_nonconst, program_invocation_short_name); - argp_help (&color_argp, stderr, ARGP_HELP_SEE, -- program_invocation_short_name); -+ program_invocation_short_name_nonconst); - exit (EXIT_FAILURE); - } - } diff --git a/package/libs/elfutils/patches/003-libint-stub.patch b/package/libs/elfutils/patches/003-libint-stub.patch index 2050bee64..24cad7432 100644 --- a/package/libs/elfutils/patches/003-libint-stub.patch +++ b/package/libs/elfutils/patches/003-libint-stub.patch @@ -1,7 +1,5 @@ -Index: elfutils-0.169/libelf/libelfP.h -=================================================================== ---- elfutils-0.169.orig/libelf/libelfP.h -+++ elfutils-0.169/libelf/libelfP.h +--- a/libelf/libelfP.h ++++ b/libelf/libelfP.h @@ -39,6 +39,9 @@ #include #include @@ -12,11 +10,9 @@ Index: elfutils-0.169/libelf/libelfP.h /* gettext helper macros. */ #define _(Str) dgettext ("elfutils", Str) -Index: elfutils-0.169/libdw/libdwP.h -=================================================================== ---- elfutils-0.169.orig/libdw/libdwP.h -+++ elfutils-0.169/libdw/libdwP.h -@@ -36,7 +36,9 @@ +--- a/libdw/libdwP.h ++++ b/libdw/libdwP.h +@@ -35,7 +35,9 @@ #include #include @@ -27,10 +23,8 @@ Index: elfutils-0.169/libdw/libdwP.h /* gettext helper macros. */ #define _(Str) dgettext ("elfutils", Str) -Index: elfutils-0.169/libdwfl/libdwflP.h -=================================================================== ---- elfutils-0.169.orig/libdwfl/libdwflP.h -+++ elfutils-0.169/libdwfl/libdwflP.h +--- a/libdwfl/libdwflP.h ++++ b/libdwfl/libdwflP.h @@ -43,6 +43,9 @@ typedef struct Dwfl_Process Dwfl_Process; @@ -41,10 +35,8 @@ Index: elfutils-0.169/libdwfl/libdwflP.h /* gettext helper macros. */ #define _(Str) dgettext ("elfutils", Str) -Index: elfutils-0.169/libasm/libasmP.h -=================================================================== ---- elfutils-0.169.orig/libasm/libasmP.h -+++ elfutils-0.169/libasm/libasmP.h +--- a/libasm/libasmP.h ++++ b/libasm/libasmP.h @@ -35,6 +35,9 @@ #include "libdwelf.h" diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch index 7c30efc9f..93d593a0f 100644 --- a/package/libs/elfutils/patches/005-build_only_libs.patch +++ b/package/libs/elfutils/patches/005-build_only_libs.patch @@ -1,15 +1,3 @@ ---- a/Makefile.in -+++ b/Makefile.in -@@ -377,8 +377,7 @@ AM_MAKEFLAGS = --no-print-directory - pkginclude_HEADERS = version.h - - # Add doc back when we have some real content. --SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \ -- backends src po tests -+SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libasm - - EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \ - COPYING COPYING-GPLV2 COPYING-LGPLV3 --- a/Makefile.am +++ b/Makefile.am @@ -27,8 +27,7 @@ AM_MAKEFLAGS = --no-print-directory diff --git a/package/libs/elfutils/patches/006-libdw_LIBS.patch b/package/libs/elfutils/patches/006-libdw_LIBS.patch deleted file mode 100644 index 59967e148..000000000 --- a/package/libs/elfutils/patches/006-libdw_LIBS.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libdw/Makefile.in -+++ b/libdw/Makefile.in -@@ -1005,7 +1005,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l - -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ - -Wl,--version-script,$<,--no-undefined \ - -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ -- -ldl -lz $(argp_LDADD) $(zip_LIBS) -+ -ldl -lz $(argp_LDADD) $(zip_LIBS) $(LIBS) - @$(textrel_check) - $(AM_V_at)ln -fs $@ $@.$(VERSION) - diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch index cbced1101..249f25198 100644 --- a/package/libs/elfutils/patches/100-musl-compat.patch +++ b/package/libs/elfutils/patches/100-musl-compat.patch @@ -1,9 +1,7 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002 -Index: elfutils-0.169/lib/system.h -=================================================================== ---- elfutils-0.169.orig/lib/system.h -+++ elfutils-0.169/lib/system.h +--- a/lib/system.h ++++ b/lib/system.h @@ -29,7 +29,18 @@ #ifndef LIB_SYSTEM_H #define LIB_SYSTEM_H 1 @@ -34,10 +32,8 @@ Index: elfutils-0.169/lib/system.h #if __BYTE_ORDER == __LITTLE_ENDIAN # define LE32(n) (n) # define LE64(n) (n) -Index: elfutils-0.169/lib/color.c -=================================================================== ---- elfutils-0.169.orig/lib/color.c -+++ elfutils-0.169/lib/color.c +--- a/lib/color.c ++++ b/lib/color.c @@ -32,13 +32,13 @@ #endif @@ -53,10 +49,8 @@ Index: elfutils-0.169/lib/color.c /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); -Index: elfutils-0.169/lib/xmalloc.c -=================================================================== ---- elfutils-0.169.orig/lib/xmalloc.c -+++ elfutils-0.169/lib/xmalloc.c +--- a/lib/xmalloc.c ++++ b/lib/xmalloc.c @@ -30,7 +30,6 @@ # include #endif @@ -65,10 +59,8 @@ Index: elfutils-0.169/lib/xmalloc.c #include #include #include -Index: elfutils-0.169/src/addr2line.c -=================================================================== ---- elfutils-0.169.orig/src/addr2line.c -+++ elfutils-0.169/src/addr2line.c +--- a/src/addr2line.c ++++ b/src/addr2line.c @@ -23,7 +23,6 @@ #include #include @@ -77,10 +69,8 @@ Index: elfutils-0.169/src/addr2line.c #include #include #include -Index: elfutils-0.169/src/ar.c -=================================================================== ---- elfutils-0.169.orig/src/ar.c -+++ elfutils-0.169/src/ar.c +--- a/src/ar.c ++++ b/src/ar.c @@ -22,7 +22,6 @@ #include @@ -89,10 +79,8 @@ Index: elfutils-0.169/src/ar.c #include #include #include -Index: elfutils-0.169/src/arlib2.c -=================================================================== ---- elfutils-0.169.orig/src/arlib2.c -+++ elfutils-0.169/src/arlib2.c +--- a/src/arlib2.c ++++ b/src/arlib2.c @@ -20,7 +20,6 @@ # include #endif @@ -101,10 +89,8 @@ Index: elfutils-0.169/src/arlib2.c #include #include #include -Index: elfutils-0.169/src/arlib.c -=================================================================== ---- elfutils-0.169.orig/src/arlib.c -+++ elfutils-0.169/src/arlib.c +--- a/src/arlib.c ++++ b/src/arlib.c @@ -21,7 +21,6 @@ #endif @@ -113,10 +99,8 @@ Index: elfutils-0.169/src/arlib.c #include #include #include -Index: elfutils-0.169/src/elfcmp.c -=================================================================== ---- elfutils-0.169.orig/src/elfcmp.c -+++ elfutils-0.169/src/elfcmp.c +--- a/src/elfcmp.c ++++ b/src/elfcmp.c @@ -23,7 +23,6 @@ #include #include @@ -125,10 +109,8 @@ Index: elfutils-0.169/src/elfcmp.c #include #include #include -Index: elfutils-0.169/src/elflint.c -=================================================================== ---- elfutils-0.169.orig/src/elflint.c -+++ elfutils-0.169/src/elflint.c +--- a/src/elflint.c ++++ b/src/elflint.c @@ -24,7 +24,6 @@ #include #include @@ -137,10 +119,8 @@ Index: elfutils-0.169/src/elflint.c #include #include #include -Index: elfutils-0.169/src/findtextrel.c -=================================================================== ---- elfutils-0.169.orig/src/findtextrel.c -+++ elfutils-0.169/src/findtextrel.c +--- a/src/findtextrel.c ++++ b/src/findtextrel.c @@ -23,7 +23,6 @@ #include #include @@ -149,10 +129,8 @@ Index: elfutils-0.169/src/findtextrel.c #include #include #include -Index: elfutils-0.169/src/nm.c -=================================================================== ---- elfutils-0.169.orig/src/nm.c -+++ elfutils-0.169/src/nm.c +--- a/src/nm.c ++++ b/src/nm.c @@ -26,7 +26,6 @@ #include #include @@ -161,10 +139,8 @@ Index: elfutils-0.169/src/nm.c #include #include #include -Index: elfutils-0.169/src/objdump.c -=================================================================== ---- elfutils-0.169.orig/src/objdump.c -+++ elfutils-0.169/src/objdump.c +--- a/src/objdump.c ++++ b/src/objdump.c @@ -21,7 +21,6 @@ #endif @@ -173,10 +149,8 @@ Index: elfutils-0.169/src/objdump.c #include #include #include -Index: elfutils-0.169/src/ranlib.c -=================================================================== ---- elfutils-0.169.orig/src/ranlib.c -+++ elfutils-0.169/src/ranlib.c +--- a/src/ranlib.c ++++ b/src/ranlib.c @@ -24,7 +24,6 @@ #include #include @@ -185,11 +159,9 @@ Index: elfutils-0.169/src/ranlib.c #include #include #include -Index: elfutils-0.169/src/readelf.c -=================================================================== ---- elfutils-0.169.orig/src/readelf.c -+++ elfutils-0.169/src/readelf.c -@@ -25,7 +25,6 @@ +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -24,7 +24,6 @@ #include #include #include @@ -197,10 +169,8 @@ Index: elfutils-0.169/src/readelf.c #include #include #include -Index: elfutils-0.169/src/size.c -=================================================================== ---- elfutils-0.169.orig/src/size.c -+++ elfutils-0.169/src/size.c +--- a/src/size.c ++++ b/src/size.c @@ -21,7 +21,6 @@ #endif @@ -209,10 +179,8 @@ Index: elfutils-0.169/src/size.c #include #include #include -Index: elfutils-0.169/src/stack.c -=================================================================== ---- elfutils-0.169.orig/src/stack.c -+++ elfutils-0.169/src/stack.c +--- a/src/stack.c ++++ b/src/stack.c @@ -18,7 +18,6 @@ #include #include @@ -221,10 +189,8 @@ Index: elfutils-0.169/src/stack.c #include #include #include -Index: elfutils-0.169/src/strings.c -=================================================================== ---- elfutils-0.169.orig/src/strings.c -+++ elfutils-0.169/src/strings.c +--- a/src/strings.c ++++ b/src/strings.c @@ -25,7 +25,6 @@ #include #include @@ -233,22 +199,18 @@ Index: elfutils-0.169/src/strings.c #include #include #include -Index: elfutils-0.169/src/strip.c -=================================================================== ---- elfutils-0.169.orig/src/strip.c -+++ elfutils-0.169/src/strip.c +--- a/src/strip.c ++++ b/src/strip.c @@ -24,7 +24,6 @@ #include #include #include -#include #include + #include #include - #include -Index: elfutils-0.169/src/unstrip.c -=================================================================== ---- elfutils-0.169.orig/src/unstrip.c -+++ elfutils-0.169/src/unstrip.c +--- a/src/unstrip.c ++++ b/src/unstrip.c @@ -31,7 +31,6 @@ #include #include @@ -257,10 +219,8 @@ Index: elfutils-0.169/src/unstrip.c #include #include #include -Index: elfutils-0.169/tests/addrscopes.c -=================================================================== ---- elfutils-0.169.orig/tests/addrscopes.c -+++ elfutils-0.169/tests/addrscopes.c +--- a/tests/addrscopes.c ++++ b/tests/addrscopes.c @@ -25,7 +25,6 @@ #include #include @@ -269,10 +229,8 @@ Index: elfutils-0.169/tests/addrscopes.c #include -Index: elfutils-0.169/tests/allregs.c -=================================================================== ---- elfutils-0.169.orig/tests/allregs.c -+++ elfutils-0.169/tests/allregs.c +--- a/tests/allregs.c ++++ b/tests/allregs.c @@ -21,7 +21,6 @@ #include #include @@ -281,10 +239,8 @@ Index: elfutils-0.169/tests/allregs.c #include #include #include -Index: elfutils-0.169/tests/backtrace.c -=================================================================== ---- elfutils-0.169.orig/tests/backtrace.c -+++ elfutils-0.169/tests/backtrace.c +--- a/tests/backtrace.c ++++ b/tests/backtrace.c @@ -24,7 +24,6 @@ #include #include @@ -293,10 +249,8 @@ Index: elfutils-0.169/tests/backtrace.c #include #include #ifdef __linux__ -Index: elfutils-0.169/tests/backtrace-data.c -=================================================================== ---- elfutils-0.169.orig/tests/backtrace-data.c -+++ elfutils-0.169/tests/backtrace-data.c +--- a/tests/backtrace-data.c ++++ b/tests/backtrace-data.c @@ -27,7 +27,6 @@ #include #include @@ -305,10 +259,8 @@ Index: elfutils-0.169/tests/backtrace-data.c #include #include #if defined(__x86_64__) && defined(__linux__) -Index: elfutils-0.169/tests/buildid.c -=================================================================== ---- elfutils-0.169.orig/tests/buildid.c -+++ elfutils-0.169/tests/buildid.c +--- a/tests/buildid.c ++++ b/tests/buildid.c @@ -23,7 +23,6 @@ #include ELFUTILS_HEADER(elf) #include ELFUTILS_HEADER(dwelf) @@ -317,10 +269,8 @@ Index: elfutils-0.169/tests/buildid.c #include #include #include -Index: elfutils-0.169/tests/debugaltlink.c -=================================================================== ---- elfutils-0.169.orig/tests/debugaltlink.c -+++ elfutils-0.169/tests/debugaltlink.c +--- a/tests/debugaltlink.c ++++ b/tests/debugaltlink.c @@ -23,7 +23,6 @@ #include ELFUTILS_HEADER(dw) #include ELFUTILS_HEADER(dwelf) @@ -329,10 +279,8 @@ Index: elfutils-0.169/tests/debugaltlink.c #include #include #include -Index: elfutils-0.169/tests/debuglink.c -=================================================================== ---- elfutils-0.169.orig/tests/debuglink.c -+++ elfutils-0.169/tests/debuglink.c +--- a/tests/debuglink.c ++++ b/tests/debuglink.c @@ -21,7 +21,6 @@ #include #include ELFUTILS_HEADER(dwelf) @@ -341,10 +289,8 @@ Index: elfutils-0.169/tests/debuglink.c #include #include #include -Index: elfutils-0.169/tests/dwfl-addr-sect.c -=================================================================== ---- elfutils-0.169.orig/tests/dwfl-addr-sect.c -+++ elfutils-0.169/tests/dwfl-addr-sect.c +--- a/tests/dwfl-addr-sect.c ++++ b/tests/dwfl-addr-sect.c @@ -23,7 +23,6 @@ #include #include @@ -353,10 +299,8 @@ Index: elfutils-0.169/tests/dwfl-addr-sect.c #include #include #include ELFUTILS_HEADER(dwfl) -Index: elfutils-0.169/tests/dwfl-bug-addr-overflow.c -=================================================================== ---- elfutils-0.169.orig/tests/dwfl-bug-addr-overflow.c -+++ elfutils-0.169/tests/dwfl-bug-addr-overflow.c +--- a/tests/dwfl-bug-addr-overflow.c ++++ b/tests/dwfl-bug-addr-overflow.c @@ -20,7 +20,6 @@ #include #include @@ -365,10 +309,8 @@ Index: elfutils-0.169/tests/dwfl-bug-addr-overflow.c #include #include ELFUTILS_HEADER(dwfl) -Index: elfutils-0.169/tests/dwfl-bug-fd-leak.c -=================================================================== ---- elfutils-0.169.orig/tests/dwfl-bug-fd-leak.c -+++ elfutils-0.169/tests/dwfl-bug-fd-leak.c +--- a/tests/dwfl-bug-fd-leak.c ++++ b/tests/dwfl-bug-fd-leak.c @@ -24,7 +24,6 @@ #include #include @@ -377,10 +319,8 @@ Index: elfutils-0.169/tests/dwfl-bug-fd-leak.c #include #include -Index: elfutils-0.169/tests/dwfl-bug-getmodules.c -=================================================================== ---- elfutils-0.169.orig/tests/dwfl-bug-getmodules.c -+++ elfutils-0.169/tests/dwfl-bug-getmodules.c +--- a/tests/dwfl-bug-getmodules.c ++++ b/tests/dwfl-bug-getmodules.c @@ -18,7 +18,6 @@ #include #include ELFUTILS_HEADER(dwfl) @@ -389,10 +329,8 @@ Index: elfutils-0.169/tests/dwfl-bug-getmodules.c static const Dwfl_Callbacks callbacks = { -Index: elfutils-0.169/tests/dwfllines.c -=================================================================== ---- elfutils-0.169.orig/tests/dwfllines.c -+++ elfutils-0.169/tests/dwfllines.c +--- a/tests/dwfllines.c ++++ b/tests/dwfllines.c @@ -27,7 +27,6 @@ #include #include @@ -401,10 +339,8 @@ Index: elfutils-0.169/tests/dwfllines.c int main (int argc, char *argv[]) -Index: elfutils-0.169/tests/dwflmodtest.c -=================================================================== ---- elfutils-0.169.orig/tests/dwflmodtest.c -+++ elfutils-0.169/tests/dwflmodtest.c +--- a/tests/dwflmodtest.c ++++ b/tests/dwflmodtest.c @@ -23,7 +23,6 @@ #include #include @@ -413,10 +349,8 @@ Index: elfutils-0.169/tests/dwflmodtest.c #include #include #include ELFUTILS_HEADER(dwfl) -Index: elfutils-0.169/tests/dwfl-report-elf-align.c -=================================================================== ---- elfutils-0.169.orig/tests/dwfl-report-elf-align.c -+++ elfutils-0.169/tests/dwfl-report-elf-align.c +--- a/tests/dwfl-report-elf-align.c ++++ b/tests/dwfl-report-elf-align.c @@ -20,7 +20,6 @@ #include #include @@ -425,10 +359,8 @@ Index: elfutils-0.169/tests/dwfl-report-elf-align.c #include #include #include -Index: elfutils-0.169/tests/dwflsyms.c -=================================================================== ---- elfutils-0.169.orig/tests/dwflsyms.c -+++ elfutils-0.169/tests/dwflsyms.c +--- a/tests/dwflsyms.c ++++ b/tests/dwflsyms.c @@ -25,7 +25,6 @@ #include #include @@ -437,10 +369,8 @@ Index: elfutils-0.169/tests/dwflsyms.c #include static const char * -Index: elfutils-0.169/tests/early-offscn.c -=================================================================== ---- elfutils-0.169.orig/tests/early-offscn.c -+++ elfutils-0.169/tests/early-offscn.c +--- a/tests/early-offscn.c ++++ b/tests/early-offscn.c @@ -19,7 +19,6 @@ #endif @@ -449,10 +379,8 @@ Index: elfutils-0.169/tests/early-offscn.c #include #include #include -Index: elfutils-0.169/tests/ecp.c -=================================================================== ---- elfutils-0.169.orig/tests/ecp.c -+++ elfutils-0.169/tests/ecp.c +--- a/tests/ecp.c ++++ b/tests/ecp.c @@ -20,7 +20,6 @@ #endif @@ -461,10 +389,8 @@ Index: elfutils-0.169/tests/ecp.c #include #include #include -Index: elfutils-0.169/tests/find-prologues.c -=================================================================== ---- elfutils-0.169.orig/tests/find-prologues.c -+++ elfutils-0.169/tests/find-prologues.c +--- a/tests/find-prologues.c ++++ b/tests/find-prologues.c @@ -25,7 +25,6 @@ #include #include @@ -473,10 +399,8 @@ Index: elfutils-0.169/tests/find-prologues.c #include #include -Index: elfutils-0.169/tests/funcretval.c -=================================================================== ---- elfutils-0.169.orig/tests/funcretval.c -+++ elfutils-0.169/tests/funcretval.c +--- a/tests/funcretval.c ++++ b/tests/funcretval.c @@ -25,7 +25,6 @@ #include #include @@ -485,10 +409,8 @@ Index: elfutils-0.169/tests/funcretval.c #include #include -Index: elfutils-0.169/tests/funcscopes.c -=================================================================== ---- elfutils-0.169.orig/tests/funcscopes.c -+++ elfutils-0.169/tests/funcscopes.c +--- a/tests/funcscopes.c ++++ b/tests/funcscopes.c @@ -25,7 +25,6 @@ #include #include @@ -497,10 +419,8 @@ Index: elfutils-0.169/tests/funcscopes.c #include #include -Index: elfutils-0.169/tests/line2addr.c -=================================================================== ---- elfutils-0.169.orig/tests/line2addr.c -+++ elfutils-0.169/tests/line2addr.c +--- a/tests/line2addr.c ++++ b/tests/line2addr.c @@ -26,7 +26,6 @@ #include #include @@ -509,10 +429,8 @@ Index: elfutils-0.169/tests/line2addr.c static void -Index: elfutils-0.169/tests/low_high_pc.c -=================================================================== ---- elfutils-0.169.orig/tests/low_high_pc.c -+++ elfutils-0.169/tests/low_high_pc.c +--- a/tests/low_high_pc.c ++++ b/tests/low_high_pc.c @@ -25,7 +25,6 @@ #include #include @@ -521,22 +439,8 @@ Index: elfutils-0.169/tests/low_high_pc.c #include #include -Index: elfutils-0.169/tests/md5-sha1-test.c -=================================================================== ---- elfutils-0.169.orig/tests/md5-sha1-test.c -+++ elfutils-0.169/tests/md5-sha1-test.c -@@ -19,7 +19,6 @@ - #endif - - #include --#include - - #include "md5.h" - #include "sha1.h" -Index: elfutils-0.169/tests/rdwrmmap.c -=================================================================== ---- elfutils-0.169.orig/tests/rdwrmmap.c -+++ elfutils-0.169/tests/rdwrmmap.c +--- a/tests/rdwrmmap.c ++++ b/tests/rdwrmmap.c @@ -19,7 +19,6 @@ #endif @@ -545,10 +449,8 @@ Index: elfutils-0.169/tests/rdwrmmap.c #include #include #include -Index: elfutils-0.169/tests/saridx.c -=================================================================== ---- elfutils-0.169.orig/tests/saridx.c -+++ elfutils-0.169/tests/saridx.c +--- a/tests/saridx.c ++++ b/tests/saridx.c @@ -17,7 +17,6 @@ #include @@ -557,10 +459,8 @@ Index: elfutils-0.169/tests/saridx.c #include #include #include -Index: elfutils-0.169/tests/sectiondump.c -=================================================================== ---- elfutils-0.169.orig/tests/sectiondump.c -+++ elfutils-0.169/tests/sectiondump.c +--- a/tests/sectiondump.c ++++ b/tests/sectiondump.c @@ -18,7 +18,6 @@ #include @@ -569,10 +469,8 @@ Index: elfutils-0.169/tests/sectiondump.c #include #include #include -Index: elfutils-0.169/tests/varlocs.c -=================================================================== ---- elfutils-0.169.orig/tests/varlocs.c -+++ elfutils-0.169/tests/varlocs.c +--- a/tests/varlocs.c ++++ b/tests/varlocs.c @@ -25,7 +25,6 @@ #include #include @@ -581,10 +479,8 @@ Index: elfutils-0.169/tests/varlocs.c #include #include #include -Index: elfutils-0.169/libasm/asm_end.c -=================================================================== ---- elfutils-0.169.orig/libasm/asm_end.c -+++ elfutils-0.169/libasm/asm_end.c +--- a/libasm/asm_end.c ++++ b/libasm/asm_end.c @@ -32,7 +32,6 @@ #endif @@ -593,10 +489,8 @@ Index: elfutils-0.169/libasm/asm_end.c #include #include #include -Index: elfutils-0.169/libasm/asm_newscn.c -=================================================================== ---- elfutils-0.169.orig/libasm/asm_newscn.c -+++ elfutils-0.169/libasm/asm_newscn.c +--- a/libasm/asm_newscn.c ++++ b/libasm/asm_newscn.c @@ -32,7 +32,6 @@ #endif @@ -605,10 +499,8 @@ Index: elfutils-0.169/libasm/asm_newscn.c #include #include #include -Index: elfutils-0.169/libcpu/i386_gendis.c -=================================================================== ---- elfutils-0.169.orig/libcpu/i386_gendis.c -+++ elfutils-0.169/libcpu/i386_gendis.c +--- a/libcpu/i386_gendis.c ++++ b/libcpu/i386_gendis.c @@ -31,7 +31,6 @@ # include #endif @@ -617,11 +509,9 @@ Index: elfutils-0.169/libcpu/i386_gendis.c #include #include #include -Index: elfutils-0.169/libcpu/i386_lex.c -=================================================================== ---- elfutils-0.169.orig/libcpu/i386_lex.c -+++ elfutils-0.169/libcpu/i386_lex.c -@@ -592,7 +592,6 @@ char *i386_text; +--- a/libcpu/i386_lex.c ++++ b/libcpu/i386_lex.c +@@ -808,7 +808,6 @@ char *yytext; #endif #include @@ -629,10 +519,8 @@ Index: elfutils-0.169/libcpu/i386_lex.c #include #include -Index: elfutils-0.169/libcpu/i386_lex.l -=================================================================== ---- elfutils-0.169.orig/libcpu/i386_lex.l -+++ elfutils-0.169/libcpu/i386_lex.l +--- a/libcpu/i386_lex.l ++++ b/libcpu/i386_lex.l @@ -31,7 +31,6 @@ #endif @@ -641,10 +529,8 @@ Index: elfutils-0.169/libcpu/i386_lex.l #include #include -Index: elfutils-0.169/libcpu/i386_parse.c -=================================================================== ---- elfutils-0.169.orig/libcpu/i386_parse.c -+++ elfutils-0.169/libcpu/i386_parse.c +--- a/libcpu/i386_parse.c ++++ b/libcpu/i386_parse.c @@ -107,7 +107,6 @@ #include #include @@ -653,10 +539,8 @@ Index: elfutils-0.169/libcpu/i386_parse.c #include #include #include -Index: elfutils-0.169/libdw/libdw_alloc.c -=================================================================== ---- elfutils-0.169.orig/libdw/libdw_alloc.c -+++ elfutils-0.169/libdw/libdw_alloc.c +--- a/libdw/libdw_alloc.c ++++ b/libdw/libdw_alloc.c @@ -31,7 +31,6 @@ # include #endif @@ -665,17 +549,15 @@ Index: elfutils-0.169/libdw/libdw_alloc.c #include #include #include "libdwP.h" -@@ -74,5 +73,5 @@ __attribute ((noreturn, visibility ("hid +@@ -74,5 +73,5 @@ __attribute ((noreturn)) attribute_hidde __libdw_oom (void) { while (1) - error (EXIT_FAILURE, ENOMEM, "libdw"); + error (EXIT_FAILURE, errno, gettext ("cannot allocate memory")); } -Index: elfutils-0.169/libebl/eblopenbackend.c -=================================================================== ---- elfutils-0.169.orig/libebl/eblopenbackend.c -+++ elfutils-0.169/libebl/eblopenbackend.c +--- a/libebl/eblopenbackend.c ++++ b/libebl/eblopenbackend.c @@ -32,7 +32,6 @@ #include @@ -684,10 +566,8 @@ Index: elfutils-0.169/libebl/eblopenbackend.c #include #include #include -Index: elfutils-0.169/libdwfl/dwfl_error.c -=================================================================== ---- elfutils-0.169.orig/libdwfl/dwfl_error.c -+++ elfutils-0.169/libdwfl/dwfl_error.c +--- a/libdwfl/dwfl_error.c ++++ b/libdwfl/dwfl_error.c @@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error) const char * dwfl_errmsg (int error) diff --git a/package/libs/elfutils/patches/101-no-fts.patch b/package/libs/elfutils/patches/101-no-fts.patch index 63699fea2..a6e192f8f 100644 --- a/package/libs/elfutils/patches/101-no-fts.patch +++ b/package/libs/elfutils/patches/101-no-fts.patch @@ -1,7 +1,5 @@ -Index: elfutils-0.169/libdwfl/argp-std.c -=================================================================== ---- elfutils-0.169.orig/libdwfl/argp-std.c -+++ elfutils-0.169/libdwfl/argp-std.c +--- a/libdwfl/argp-std.c ++++ b/libdwfl/argp-std.c @@ -56,9 +56,6 @@ static const struct argp_option options[ { "linux-process-map", 'M', "FILE", 0, N_("Find addresses in files mapped as read from FILE" @@ -28,7 +26,7 @@ Index: elfutils-0.169/libdwfl/argp-std.c /* Structure held at state->HOOK. */ struct parse_opt { -@@ -223,43 +211,6 @@ parse_opt (int key, char *arg, struct ar +@@ -226,43 +214,6 @@ parse_opt (int key, char *arg, struct ar } break; @@ -40,11 +38,11 @@ Index: elfutils-0.169/libdwfl/argp-std.c - Dwfl *dwfl = INTUSE(dwfl_begin) (&kernel_callbacks); - int result = INTUSE(dwfl_linux_kernel_report_kernel) (dwfl); - if (result != 0) -- return fail (dwfl, result, _("cannot load kernel symbols")); +- return fail (dwfl, result, _("cannot load kernel symbols"), state); - result = INTUSE(dwfl_linux_kernel_report_modules) (dwfl); - if (result != 0) - /* Non-fatal to have no modules since we do have the kernel. */ -- failure (dwfl, result, _("cannot find kernel modules")); +- argp_failure (state, 0, result, _("cannot find kernel modules")); - opt->dwfl = dwfl; - } - else @@ -61,7 +59,7 @@ Index: elfutils-0.169/libdwfl/argp-std.c - int result = INTUSE(dwfl_linux_kernel_report_offline) (dwfl, arg, - NULL); - if (result != 0) -- return fail (dwfl, result, _("cannot find kernel or modules")); +- return fail (dwfl, result, _("cannot find kernel or modules"), state); - opt->dwfl = dwfl; - } - else @@ -72,42 +70,14 @@ Index: elfutils-0.169/libdwfl/argp-std.c case ARGP_KEY_SUCCESS: { struct parse_opt *opt = state->hook; -Index: elfutils-0.169/libdwfl/Makefile.in -=================================================================== ---- elfutils-0.169.orig/libdwfl/Makefile.in -+++ elfutils-0.169/libdwfl/Makefile.in -@@ -120,7 +120,7 @@ am__libdwfl_a_SOURCES_DIST = dwfl_begin. - dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \ - dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \ - find-debuginfo.c dwfl_build_id_find_elf.c \ -- dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \ -+ dwfl_build_id_find_debuginfo.c \ - linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \ - dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ - dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \ -@@ -148,7 +148,7 @@ am_libdwfl_a_OBJECTS = dwfl_begin.$(OBJE - dwfl_validate_address.$(OBJEXT) argp-std.$(OBJEXT) \ - find-debuginfo.$(OBJEXT) dwfl_build_id_find_elf.$(OBJEXT) \ - dwfl_build_id_find_debuginfo.$(OBJEXT) \ -- linux-kernel-modules.$(OBJEXT) linux-proc-maps.$(OBJEXT) \ -+ linux-proc-maps.$(OBJEXT) \ - dwfl_addrmodule.$(OBJEXT) dwfl_addrdwarf.$(OBJEXT) \ - cu.$(OBJEXT) dwfl_module_nextcu.$(OBJEXT) \ - dwfl_nextcu.$(OBJEXT) dwfl_cumodule.$(OBJEXT) \ -@@ -434,7 +434,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en - dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \ - dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \ - find-debuginfo.c dwfl_build_id_find_elf.c \ -- dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \ -+ dwfl_build_id_find_debuginfo.c \ - linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \ - dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ - dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \ -@@ -571,7 +571,6 @@ distclean-compile: - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link_map.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-core-attach.Po@am__quote@ --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-kernel-modules.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-pid-attach.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-proc-maps.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzma.Po@am__quote@ +--- a/libdwfl/Makefile.am ++++ b/libdwfl/Makefile.am +@@ -49,7 +49,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en + argp-std.c find-debuginfo.c \ + dwfl_build_id_find_elf.c \ + dwfl_build_id_find_debuginfo.c \ +- linux-kernel-modules.c linux-proc-maps.c \ ++ linux-proc-maps.c \ + dwfl_addrmodule.c dwfl_addrdwarf.c \ + cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ + dwfl_module_addrdie.c dwfl_addrdie.c \ diff --git a/package/libs/libbsd/Makefile b/package/libs/libbsd/Makefile index 11232c741..a425b8339 100644 --- a/package/libs/libbsd/Makefile +++ b/package/libs/libbsd/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libbsd -PKG_VERSION:=0.3.0 +PKG_VERSION:=0.8.7 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=fbf36ed40443e1d0d795adbae8d461952509e610c3ccf0866ae160b723f7fe38 -PKG_SOURCE_URL:=http://libbsd.freedesktop.org/releases +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_HASH:=f548f10e5af5a08b1e22889ce84315b1ebe41505b015c9596bad03fd13a12b31 +PKG_SOURCE_URL:=https://libbsd.freedesktop.org/releases PKG_LICENSE:=BSD-4-Clause PKG_LICENSE_FILES:=COPYING @@ -18,7 +18,6 @@ PKG_INSTALL:=1 define Package/libbsd SECTION:=libs CATEGORY:=Libraries - DEPENDS:=@USE_GLIBC TITLE:=common BSD library endef @@ -27,30 +26,17 @@ define Package/libbsd/description endef define Build/InstallDev - $(INSTALL_DIR) \ - $(1)/lib \ - $(1)/usr/include - - $(CP) \ - $(PKG_INSTALL_DIR)/lib/libbsd.so* \ - $(1)/lib/ - - $(CP) \ - $(PKG_INSTALL_DIR)/usr/include/* \ - $(1)/usr/include/ - - ( cd $(1)/lib ; $(LN) libbsd.so.$(PKG_VERSION) libbsd.so ) + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbsd.{la,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libbsd*.pc $(1)/usr/lib/pkgconfig/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ endef define Package/libbsd/install - $(INSTALL_DIR) \ - $(1)/lib - - $(CP) \ - $(PKG_INSTALL_DIR)/lib/libbsd.so* \ - $(1)/lib/ - - ( cd $(1)/lib ; $(LN) libbsd.so.$(PKG_VERSION) libbsd.so ) + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbsd.so* $(1)/usr/lib/ endef $(eval $(call BuildPackage,libbsd)) diff --git a/package/libs/libbsd/patches/001-aarch64_support.patch b/package/libs/libbsd/patches/001-aarch64_support.patch deleted file mode 100644 index 62291482c..000000000 --- a/package/libs/libbsd/patches/001-aarch64_support.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/src/local-elf.h -+++ b/src/local-elf.h -@@ -165,6 +165,16 @@ - #endif - #define ELF_TARG_DATA ELFDATA2MSB - -+#elif defined(__aarch64__) -+ -+#define ELF_TARG_MACH EM_AARCH64 -+#define ELF_TARG_CLASS ELFCLASS64 -+#ifdef __AARCH64EB__ -+#define ELF_TARG_DATA ELFDATA2MSB -+#else -+#define ELF_TARG_DATA ELFDATA2LSB -+#endif -+ - #else - - #error Unknown ELF machine type diff --git a/package/libs/libbsd/patches/001-handle-systems-missing-sys_cdefs.h.patch b/package/libs/libbsd/patches/001-handle-systems-missing-sys_cdefs.h.patch new file mode 100644 index 000000000..108e96772 --- /dev/null +++ b/package/libs/libbsd/patches/001-handle-systems-missing-sys_cdefs.h.patch @@ -0,0 +1,195 @@ +From 11ec8f1e5dfa1c10e0c9fb94879b6f5b96ba52dd Mon Sep 17 00:00:00 2001 +From: Guillem Jover +Date: Tue, 6 Mar 2018 01:41:35 +0100 +Subject: Handle systems missing + +This is a non-portable header, and we cannot expect it to be provided by +the system libc (e.g. musl). We just need and rely on declaration that +we have defined ourselves in our own . So we switch to +only ever assume that. + +Fixes: https://bugs.freedesktop.org/105281 +--- + include/bsd/libutil.h | 4 ++++ + include/bsd/md5.h | 4 ++++ + include/bsd/nlist.h | 4 ++++ + include/bsd/readpassphrase.h | 4 ++++ + include/bsd/stdlib.h | 4 ++++ + include/bsd/string.h | 4 ++++ + include/bsd/stringlist.h | 5 +++++ + include/bsd/sys/queue.h | 4 ++++ + include/bsd/sys/tree.h | 4 ++++ + include/bsd/timeconv.h | 4 ++++ + include/bsd/vis.h | 4 ++++ + include/bsd/wchar.h | 4 ++++ + 12 files changed, 49 insertions(+) + +--- a/include/bsd/libutil.h ++++ b/include/bsd/libutil.h +@@ -40,7 +40,11 @@ + #define LIBBSD_LIBUTIL_H + + #include ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + #include + #include +--- a/include/bsd/md5.h ++++ b/include/bsd/md5.h +@@ -27,7 +27,11 @@ typedef struct MD5Context { + uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */ + } MD5_CTX; + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + + __BEGIN_DECLS +--- a/include/bsd/nlist.h ++++ b/include/bsd/nlist.h +@@ -27,7 +27,11 @@ + #ifndef LIBBSD_NLIST_H + #define LIBBSD_NLIST_H + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + + struct nlist { + union { +--- a/include/bsd/readpassphrase.h ++++ b/include/bsd/readpassphrase.h +@@ -31,7 +31,11 @@ + #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */ + #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */ + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + + __BEGIN_DECLS +--- a/include/bsd/stdlib.h ++++ b/include/bsd/stdlib.h +@@ -42,7 +42,11 @@ + #ifndef LIBBSD_STDLIB_H + #define LIBBSD_STDLIB_H + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + #include + +--- a/include/bsd/string.h ++++ b/include/bsd/string.h +@@ -33,7 +33,11 @@ + #ifndef LIBBSD_STRING_H + #define LIBBSD_STRING_H + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + + __BEGIN_DECLS +--- a/include/bsd/stringlist.h ++++ b/include/bsd/stringlist.h +@@ -31,7 +31,12 @@ + + #ifndef LIBBSD_STRINGLIST_H + #define LIBBSD_STRINGLIST_H ++ ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + + /* +--- a/include/bsd/sys/queue.h ++++ b/include/bsd/sys/queue.h +@@ -33,7 +33,11 @@ + #ifndef LIBBSD_SYS_QUEUE_H + #define LIBBSD_SYS_QUEUE_H + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + + /* + * This file defines four types of data structures: singly-linked lists, +--- a/include/bsd/sys/tree.h ++++ b/include/bsd/sys/tree.h +@@ -30,7 +30,11 @@ + #ifndef LIBBSD_SYS_TREE_H + #define LIBBSD_SYS_TREE_H + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + + /* + * This file defines data structures for different types of trees: +--- a/include/bsd/timeconv.h ++++ b/include/bsd/timeconv.h +@@ -41,7 +41,11 @@ + #ifndef LIBBSD_TIMECONV_H + #define LIBBSD_TIMECONV_H + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + #include + +--- a/include/bsd/vis.h ++++ b/include/bsd/vis.h +@@ -72,7 +72,11 @@ + */ + #define UNVIS_END 1 /* no more characters */ + ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + + __BEGIN_DECLS + char *vis(char *, int, int, int); +--- a/include/bsd/wchar.h ++++ b/include/bsd/wchar.h +@@ -40,7 +40,11 @@ + #define LIBBSD_WCHAR_H + + #include ++#ifdef LIBBSD_OVERLAY + #include ++#else ++#include ++#endif + #include + + __BEGIN_DECLS diff --git a/package/libs/libbsd/patches/002-fix_function_declaration_protection_for_glibc_already_providing_them.patch b/package/libs/libbsd/patches/002-fix_function_declaration_protection_for_glibc_already_providing_them.patch new file mode 100644 index 000000000..3ce1d654c --- /dev/null +++ b/package/libs/libbsd/patches/002-fix_function_declaration_protection_for_glibc_already_providing_them.patch @@ -0,0 +1,65 @@ +From 1f8a3f7bccfc84b195218ad0086ebd57049c3490 Mon Sep 17 00:00:00 2001 +From: Guillem Jover +Date: Tue, 6 Mar 2018 01:39:45 +0100 +Subject: Fix function declaration protection for glibc already providing them +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On non-glibc based systems we cannot unconditionally use the +__GLIBC_PREREQ macro as it gets expanded before evaluation. Instead, +if it is undefined, define it to 0. + +We should also always declare these functions on non-glibc based +systems. And on systems with a new enough glibc, which provides these +functions, we should still provide the declarations if _GNU_SOURCE +is *not* defined. + +Reported-by: Jörg Krause +--- + include/bsd/stdlib.h | 3 ++- + include/bsd/string.h | 3 ++- + include/bsd/sys/cdefs.h | 8 ++++++++ + 3 files changed, 12 insertions(+), 2 deletions(-) + +--- a/include/bsd/stdlib.h ++++ b/include/bsd/stdlib.h +@@ -71,7 +71,8 @@ int sradixsort(const unsigned char **bas + const unsigned char *table, unsigned endbyte); + + void *reallocf(void *ptr, size_t size); +-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26) ++#if !defined(__GLIBC__) || \ ++ (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 26) || !defined(_GNU_SOURCE))) + void *reallocarray(void *ptr, size_t nmemb, size_t size); + #endif + +--- a/include/bsd/string.h ++++ b/include/bsd/string.h +@@ -46,7 +46,8 @@ size_t strlcat(char *dst, const char *sr + char *strnstr(const char *str, const char *find, size_t str_len); + void strmode(mode_t mode, char *str); + +-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25) ++#if !defined(__GLIBC__) || \ ++ (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE))) + void explicit_bzero(void *buf, size_t len); + #endif + __END_DECLS +--- a/include/bsd/sys/cdefs.h ++++ b/include/bsd/sys/cdefs.h +@@ -59,6 +59,14 @@ + #endif + + /* ++ * On non-glibc based systems, we cannot unconditionally use the ++ * __GLIBC_PREREQ macro as it gets expanded before evaluation. ++ */ ++#ifndef __GLIBC_PREREQ ++#define __GLIBC_PREREQ(maj, min) 0 ++#endif ++ ++/* + * Some kFreeBSD headers expect those macros to be set for sanity checks. + */ + #ifndef _SYS_CDEFS_H_ diff --git a/package/libs/libconfig/Makefile b/package/libs/libconfig/Makefile index fea00e2ef..84ded2172 100644 --- a/package/libs/libconfig/Makefile +++ b/package/libs/libconfig/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libconfig -PKG_VERSION:=1.5 +PKG_VERSION:=1.7.2 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://www.hyperrealm.com/libconfig -PKG_HASH:=e31daa390d8e4461c8830512fe2e13ba1a3d6a02a2305a02429eec61e68703f6 +PKG_SOURCE:=v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/hyperrealm/libconfig/archive/ +PKG_HASH:=f67ac44099916ae260a6c9e290a90809e7d782d96cdd462cac656ebc5b685726 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 5d56f37c5..26100d84b 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -8,13 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libevent2 -PKG_VERSION:=2.0.22 -PKG_RELEASE:=1 +PKG_VERSION:=2.1.8 +PKG_RELEASE:=2 -PKG_BUILD_DIR:=$(BUILD_DIR)/libevent-$(PKG_VERSION)-stable PKG_SOURCE:=libevent-$(PKG_VERSION)-stable.tar.gz -PKG_SOURCE_URL:=@SF/levent -PKG_HASH:=71c2c49f0adadacfdbe6332a372c38cf9c8b7895bb73dabeaa53cdcc1d4e1fa3 +PKG_SOURCE_URL:=https://github.com/libevent/libevent/releases/download/release-$(PKG_VERSION)-stable +PKG_HASH:=965cc5a8bb46ce4199a47e9b2c9e1cae3b137e8356ffdad6d94d3b9069b71dc2 +PKG_BUILD_DIR:=$(BUILD_DIR)/libevent-$(PKG_VERSION)-stable + PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=BSD-3-Clause PKG_CPE_ID:=cpe:/a:libevent_project:libevent @@ -29,7 +30,7 @@ define Package/libevent2/Default SECTION:=libs CATEGORY:=Libraries TITLE:=Event notification - URL:=http://www.monkey.org/~provos/libevent/ + URL:=http://libevent.org endef define Package/libevent2/Default/description @@ -46,7 +47,7 @@ endef define Package/libevent2 $(call Package/libevent2/Default) - TITLE+= library (version 2.0) + TITLE+= library (version 2.1) endef define Package/libevent2/description @@ -58,7 +59,7 @@ endef define Package/libevent2-core $(call Package/libevent2/Default) - TITLE+= core library (version 2.0) + TITLE+= core library (version 2.1) endef define Package/libevent2-core/description @@ -70,7 +71,7 @@ endef define Package/libevent2-extra $(call Package/libevent2/Default) - TITLE+= extra library (version 2.0) + TITLE+= extra library (version 2.1) endef define Package/libevent2-extra/description @@ -82,7 +83,7 @@ endef define Package/libevent2-openssl $(call Package/libevent2/Default) - TITLE+= OpenSSL library (version 2.0) + TITLE+= OpenSSL library (version 2.1) DEPENDS+=+libopenssl endef @@ -95,7 +96,7 @@ endef define Package/libevent2-pthreads $(call Package/libevent2/Default) - TITLE+= Pthreads library (version 2.0) + TITLE+= Pthreads library (version 2.1) DEPENDS+=+libpthread endef @@ -121,34 +122,34 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*.{la,a,so} $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*-2.0.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*-2.1.so* $(1)/usr/lib/ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libevent*.pc $(1)/usr/lib/pkgconfig/ endef define Package/libevent2/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent-2.0.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent-2.1.so.* $(1)/usr/lib/ endef define Package/libevent2-core/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_core-2.0.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_core-2.1.so.* $(1)/usr/lib/ endef define Package/libevent2-extra/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_extra-2.0.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_extra-2.1.so.* $(1)/usr/lib/ endef define Package/libevent2-openssl/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_openssl-2.0.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_openssl-2.1.so.* $(1)/usr/lib/ endef define Package/libevent2-pthreads/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_pthreads-2.0.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_pthreads-2.1.so.* $(1)/usr/lib/ endef $(eval $(call BuildPackage,libevent2)) diff --git a/package/libs/libevent2/patches/0001-Do-not-check-for-ERR_remove_thread_state-do-not-link.patch b/package/libs/libevent2/patches/0001-Do-not-check-for-ERR_remove_thread_state-do-not-link.patch new file mode 100644 index 000000000..d2677a1f6 --- /dev/null +++ b/package/libs/libevent2/patches/0001-Do-not-check-for-ERR_remove_thread_state-do-not-link.patch @@ -0,0 +1,49 @@ +From f519e0f30a00393b949c4e20868952726a9c6d2e Mon Sep 17 00:00:00 2001 +From: Pierce Lopez +Date: Thu, 2 Mar 2017 21:09:32 -0500 +Subject: [PATCH] Do not check for ERR_remove_thread_state() (do not link ssl + into every library) + +This reverts commit c4e9d9bd662de7f575f2172c160795d452ebe709 +("sample/https-client: check for ERR_remove_thread_state() existence"). + +Calling AC_SEARCH_LIBS() modifies LIBS - -lcrypto incorrectly +ends up in LIBS, and thus linked to by libevent_core.so. + +Checking for ERR_remove_thread_state should no longer be needed +because it was introduced in openssl 1.0.0, and the previous line +0.9.8 had support discontinued at the end of 2015. + +Fixes: #473 +--- + configure.ac | 4 ---- + sample/https-client.c | 4 ---- + 2 files changed, 8 deletions(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -791,10 +791,6 @@ fi + + # check if we have and should use openssl + AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"]) +-if test "x$enable_openssl" = "xyes"; then +- AC_SEARCH_LIBS([ERR_remove_thread_state], [crypto eay32], +- [AC_DEFINE(HAVE_ERR_REMOVE_THREAD_STATE, 1, [Define to 1 if you have ERR_remove_thread_stat().])]) +-fi + + # Add some more warnings which we use in development but not in the + # released versions. (Some relevant gcc versions can't handle these.) +--- a/sample/https-client.c ++++ b/sample/https-client.c +@@ -484,11 +484,7 @@ cleanup: + EVP_cleanup(); + ERR_free_strings(); + +-#ifdef EVENT__HAVE_ERR_REMOVE_THREAD_STATE + ERR_remove_thread_state(NULL); +-#else +- ERR_remove_state(0); +-#endif + CRYPTO_cleanup_all_ex_data(); + + sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); diff --git a/package/libs/libevent2/patches/0002-Makefile.am-omit-building-sample-and-test.patch b/package/libs/libevent2/patches/0002-Makefile.am-omit-building-sample-and-test.patch new file mode 100644 index 000000000..506137d55 --- /dev/null +++ b/package/libs/libevent2/patches/0002-Makefile.am-omit-building-sample-and-test.patch @@ -0,0 +1,13 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -143,8 +143,8 @@ CLEANFILES= + DISTCLEANFILES= + BUILT_SOURCES = + include include/include.am +-include sample/include.am +-include test/include.am ++#include sample/include.am ++#include test/include.am + + if BUILD_WIN32 + diff --git a/package/libs/libjson-c/Makefile b/package/libs/libjson-c/Makefile index eeb7870f0..118d618a6 100644 --- a/package/libs/libjson-c/Makefile +++ b/package/libs/libjson-c/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=json-c PKG_VERSION:=0.12.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/ @@ -27,14 +27,17 @@ PKG_INSTALL:=1 PKG_MAINTAINER:=Felix Fietkau include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk TARGET_CFLAGS += $(FPIC) -Wno-implicit-fallthrough +HOST_CFLAGS += -Wno-implicit-fallthrough +HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST) define Package/libjson-c SECTION:=libs CATEGORY:=Libraries TITLE:=javascript object notation - URL:=http://oss.metaparadigm.com/json-c/ + URL:=https://json-c.github.io/json-c/ endef define Package/libjson-c/description @@ -56,3 +59,4 @@ define Package/libjson-c/install endef $(eval $(call BuildPackage,libjson-c)) +$(eval $(call HostBuild)) diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index 149fad908..0fafcb785 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnftnl -PKG_VERSION:=1.0.9 -PKG_RELEASE:=2 +PKG_VERSION:=1.1.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=fec1d824aee301e59a11aeaae2a2d429cb99ead81e6bafab791a4dd6569b3635 +PKG_HASH:=5d6a65413f27ec635eedf6aba033f7cf671d462a2afeacc562ba96b19893aff2 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnftnl/patches/100-src-add-flowtable-support.patch b/package/libs/libnftnl/patches/100-src-add-flowtable-support.patch deleted file mode 100644 index 0d15f9235..000000000 --- a/package/libs/libnftnl/patches/100-src-add-flowtable-support.patch +++ /dev/null @@ -1,1444 +0,0 @@ -From: Pablo Neira Ayuso -Date: Wed, 29 Nov 2017 13:07:02 +0100 -Subject: [PATCH] src: add flowtable support - -This patch allows you to add, delete and list flowtable through the -existing netlink interface. - -Signed-off-by: Pablo Neira Ayuso ---- - create mode 100644 examples/nft-flowtable-add.c - create mode 100644 examples/nft-flowtable-del.c - create mode 100644 examples/nft-flowtable-get.c - create mode 100644 include/libnftnl/flowtable.h - create mode 100644 src/flowtable.c - ---- a/examples/Makefile.am -+++ b/examples/Makefile.am -@@ -25,6 +25,9 @@ check_PROGRAMS = nft-table-add \ - nft-obj-add \ - nft-obj-get \ - nft-obj-del \ -+ nft-flowtable-add \ -+ nft-flowtable-del \ -+ nft-flowtable-get \ - nft-ruleset-get \ - nft-ruleset-parse-file \ - nft-compat-get -@@ -104,6 +107,15 @@ nft_obj_del_LDADD = ../src/libnftnl.la $ - nft_obj_get_SOURCES = nft-obj-get.c - nft_obj_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} - -+nft_flowtable_add_SOURCES = nft-flowtable-add.c -+nft_flowtable_add_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} -+ -+nft_flowtable_del_SOURCES = nft-flowtable-del.c -+nft_flowtable_del_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} -+ -+nft_flowtable_get_SOURCES = nft-flowtable-get.c -+nft_flowtable_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} -+ - nft_ruleset_get_SOURCES = nft-ruleset-get.c - nft_ruleset_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} - ---- /dev/null -+++ b/examples/nft-flowtable-add.c -@@ -0,0 +1,136 @@ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+static struct nftnl_flowtable *flowtable_add_parse(int argc, char *argv[]) -+{ -+ const char *dev_array[] = { "eth0", "tap0", NULL }; -+ struct nftnl_flowtable *t; -+ int hooknum = 0; -+ -+ if (strcmp(argv[4], "ingress") == 0) -+ hooknum = NF_NETDEV_INGRESS; -+ else { -+ fprintf(stderr, "Unknown hook: %s\n", argv[4]); -+ return NULL; -+ } -+ -+ t = nftnl_flowtable_alloc(); -+ if (t == NULL) { -+ perror("OOM"); -+ return NULL; -+ } -+ nftnl_flowtable_set(t, NFTNL_FLOWTABLE_TABLE, argv[2]); -+ nftnl_flowtable_set(t, NFTNL_FLOWTABLE_NAME, argv[3]); -+ if (argc == 6) { -+ nftnl_flowtable_set_u32(t, NFTNL_FLOWTABLE_HOOKNUM, hooknum); -+ nftnl_flowtable_set_u32(t, NFTNL_FLOWTABLE_PRIO, atoi(argv[5])); -+ } -+ nftnl_flowtable_set_array(t, NFTNL_FLOWTABLE_DEVICES, dev_array); -+ -+ return t; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ struct mnl_socket *nl; -+ char buf[MNL_SOCKET_BUFFER_SIZE]; -+ struct nlmsghdr *nlh; -+ uint32_t portid, seq, flowtable_seq; -+ int ret, family; -+ struct nftnl_flowtable *t; -+ struct mnl_nlmsg_batch *batch; -+ int batching; -+ -+ if (argc != 6) { -+ fprintf(stderr, "Usage: %s \n", -+ argv[0]); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (strcmp(argv[1], "ip") == 0) -+ family = NFPROTO_IPV4; -+ else if (strcmp(argv[1], "ip6") == 0) -+ family = NFPROTO_IPV6; -+ else if (strcmp(argv[1], "bridge") == 0) -+ family = NFPROTO_BRIDGE; -+ else if (strcmp(argv[1], "arp") == 0) -+ family = NFPROTO_ARP; -+ else { -+ fprintf(stderr, "Unknown family: ip, ip6, bridge, arp\n"); -+ exit(EXIT_FAILURE); -+ } -+ -+ t = flowtable_add_parse(argc, argv); -+ if (t == NULL) -+ exit(EXIT_FAILURE); -+ -+ batching = nftnl_batch_is_supported(); -+ if (batching < 0) { -+ perror("cannot talk to nfnetlink"); -+ exit(EXIT_FAILURE); -+ } -+ -+ seq = time(NULL); -+ batch = mnl_nlmsg_batch_start(buf, sizeof(buf)); -+ -+ if (batching) { -+ nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++); -+ mnl_nlmsg_batch_next(batch); -+ } -+ -+ flowtable_seq = seq; -+ nlh = nftnl_flowtable_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch), -+ NFT_MSG_NEWFLOWTABLE, family, -+ NLM_F_CREATE|NLM_F_ACK, seq++); -+ nftnl_flowtable_nlmsg_build_payload(nlh, t); -+ nftnl_flowtable_free(t); -+ mnl_nlmsg_batch_next(batch); -+ -+ if (batching) { -+ nftnl_batch_end(mnl_nlmsg_batch_current(batch), seq++); -+ mnl_nlmsg_batch_next(batch); -+ } -+ -+ nl = mnl_socket_open(NETLINK_NETFILTER); -+ if (nl == NULL) { -+ perror("mnl_socket_open"); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { -+ perror("mnl_socket_bind"); -+ exit(EXIT_FAILURE); -+ } -+ portid = mnl_socket_get_portid(nl); -+ -+ if (mnl_socket_sendto(nl, mnl_nlmsg_batch_head(batch), -+ mnl_nlmsg_batch_size(batch)) < 0) { -+ perror("mnl_socket_send"); -+ exit(EXIT_FAILURE); -+ } -+ -+ mnl_nlmsg_batch_stop(batch); -+ -+ ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -+ while (ret > 0) { -+ ret = mnl_cb_run(buf, ret, flowtable_seq, portid, NULL, NULL); -+ if (ret <= 0) -+ break; -+ ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -+ } -+ if (ret == -1) { -+ perror("error"); -+ exit(EXIT_FAILURE); -+ } -+ mnl_socket_close(nl); -+ -+ return EXIT_SUCCESS; -+} ---- /dev/null -+++ b/examples/nft-flowtable-del.c -@@ -0,0 +1,122 @@ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+static struct nftnl_flowtable *flowtable_del_parse(int argc, char *argv[]) -+{ -+ struct nftnl_flowtable *t; -+ -+ t = nftnl_flowtable_alloc(); -+ if (t == NULL) { -+ perror("OOM"); -+ return NULL; -+ } -+ -+ nftnl_flowtable_set(t, NFTNL_FLOWTABLE_TABLE, argv[2]); -+ nftnl_flowtable_set(t, NFTNL_FLOWTABLE_NAME, argv[3]); -+ -+ return t; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ struct mnl_socket *nl; -+ struct mnl_nlmsg_batch *batch; -+ char buf[MNL_SOCKET_BUFFER_SIZE]; -+ struct nlmsghdr *nlh; -+ uint32_t portid, seq, flowtable_seq; -+ struct nftnl_flowtable *t; -+ int ret, family, batching; -+ -+ if (argc != 4) { -+ fprintf(stderr, "Usage: %s
\n", -+ argv[0]); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (strcmp(argv[1], "ip") == 0) -+ family = NFPROTO_IPV4; -+ else if (strcmp(argv[1], "ip6") == 0) -+ family = NFPROTO_IPV6; -+ else if (strcmp(argv[1], "bridge") == 0) -+ family = NFPROTO_BRIDGE; -+ else if (strcmp(argv[1], "arp") == 0) -+ family = NFPROTO_ARP; -+ else { -+ fprintf(stderr, "Unknown family: ip, ip6, bridge, arp\n"); -+ exit(EXIT_FAILURE); -+ } -+ -+ t = flowtable_del_parse(argc, argv); -+ if (t == NULL) -+ exit(EXIT_FAILURE); -+ -+ batching = nftnl_batch_is_supported(); -+ if (batching < 0) { -+ perror("cannot talk to nfnetlink"); -+ exit(EXIT_FAILURE); -+ } -+ -+ seq = time(NULL); -+ batch = mnl_nlmsg_batch_start(buf, sizeof(buf)); -+ -+ if (batching) { -+ nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++); -+ mnl_nlmsg_batch_next(batch); -+ } -+ -+ flowtable_seq = seq; -+ nlh = nftnl_flowtable_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch), -+ NFT_MSG_DELFLOWTABLE, family, -+ NLM_F_ACK, seq++); -+ nftnl_flowtable_nlmsg_build_payload(nlh, t); -+ nftnl_flowtable_free(t); -+ mnl_nlmsg_batch_next(batch); -+ -+ if (batching) { -+ nftnl_batch_end(mnl_nlmsg_batch_current(batch), seq++); -+ mnl_nlmsg_batch_next(batch); -+ } -+ -+ nl = mnl_socket_open(NETLINK_NETFILTER); -+ if (nl == NULL) { -+ perror("mnl_socket_open"); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { -+ perror("mnl_socket_bind"); -+ exit(EXIT_FAILURE); -+ } -+ portid = mnl_socket_get_portid(nl); -+ -+ if (mnl_socket_sendto(nl, mnl_nlmsg_batch_head(batch), -+ mnl_nlmsg_batch_size(batch)) < 0) { -+ perror("mnl_socket_send"); -+ exit(EXIT_FAILURE); -+ } -+ -+ mnl_nlmsg_batch_stop(batch); -+ -+ ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -+ while (ret > 0) { -+ ret = mnl_cb_run(buf, ret, flowtable_seq, portid, NULL, NULL); -+ if (ret <= 0) -+ break; -+ ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -+ } -+ if (ret == -1) { -+ perror("error"); -+ exit(EXIT_FAILURE); -+ } -+ mnl_socket_close(nl); -+ -+ return EXIT_SUCCESS; -+} ---- /dev/null -+++ b/examples/nft-flowtable-get.c -@@ -0,0 +1,121 @@ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+static int table_cb(const struct nlmsghdr *nlh, void *data) -+{ -+ struct nftnl_flowtable *t; -+ char buf[4096]; -+ uint32_t *type = data; -+ -+ t = nftnl_flowtable_alloc(); -+ if (t == NULL) { -+ perror("OOM"); -+ goto err; -+ } -+ -+ if (nftnl_flowtable_nlmsg_parse(nlh, t) < 0) { -+ perror("nftnl_flowtable_nlmsg_parse"); -+ goto err_free; -+ } -+ -+ nftnl_flowtable_snprintf(buf, sizeof(buf), t, *type, 0); -+ printf("%s\n", buf); -+ -+err_free: -+ nftnl_flowtable_free(t); -+err: -+ return MNL_CB_OK; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ struct mnl_socket *nl; -+ char buf[MNL_SOCKET_BUFFER_SIZE]; -+ struct nlmsghdr *nlh; -+ uint32_t portid, seq, type = NFTNL_OUTPUT_DEFAULT; -+ struct nftnl_flowtable *t = NULL; -+ int ret, family; -+ -+ seq = time(NULL); -+ -+ if (argc < 2 || argc > 5) { -+ fprintf(stderr, "Usage: %s [
] [json]\n", -+ argv[0]); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (strcmp(argv[1], "ip") == 0) -+ family = NFPROTO_IPV4; -+ else if (strcmp(argv[1], "ip6") == 0) -+ family = NFPROTO_IPV6; -+ else if (strcmp(argv[1], "bridge") == 0) -+ family = NFPROTO_BRIDGE; -+ else if (strcmp(argv[1], "arp") == 0) -+ family = NFPROTO_ARP; -+ else if (strcmp(argv[1], "unspec") == 0) -+ family = NFPROTO_UNSPEC; -+ else { -+ fprintf(stderr, "Unknown family: ip, ip6, bridge, arp, unspec\n"); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (argc >= 4) { -+ t = nftnl_flowtable_alloc(); -+ if (t == NULL) { -+ perror("OOM"); -+ exit(EXIT_FAILURE); -+ } -+ nlh = nftnl_flowtable_nlmsg_build_hdr(buf, NFT_MSG_GETFLOWTABLE, family, -+ NLM_F_ACK, seq); -+ nftnl_flowtable_set(t, NFTNL_FLOWTABLE_TABLE, argv[2]); -+ nftnl_flowtable_set(t, NFTNL_FLOWTABLE_NAME, argv[3]); -+ nftnl_flowtable_nlmsg_build_payload(nlh, t); -+ nftnl_flowtable_free(t); -+ } else if (argc >= 2) { -+ nlh = nftnl_flowtable_nlmsg_build_hdr(buf, NFT_MSG_GETFLOWTABLE, family, -+ NLM_F_DUMP, seq); -+ } -+ -+ if (strcmp(argv[argc-1], "json") == 0) -+ type = NFTNL_OUTPUT_JSON; -+ -+ nl = mnl_socket_open(NETLINK_NETFILTER); -+ if (nl == NULL) { -+ perror("mnl_socket_open"); -+ exit(EXIT_FAILURE); -+ } -+ -+ if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { -+ perror("mnl_socket_bind"); -+ exit(EXIT_FAILURE); -+ } -+ portid = mnl_socket_get_portid(nl); -+ -+ if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { -+ perror("mnl_socket_send"); -+ exit(EXIT_FAILURE); -+ } -+ -+ ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -+ while (ret > 0) { -+ ret = mnl_cb_run(buf, ret, seq, portid, table_cb, &type); -+ if (ret <= 0) -+ break; -+ ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -+ } -+ if (ret == -1) { -+ perror("error"); -+ exit(EXIT_FAILURE); -+ } -+ mnl_socket_close(nl); -+ -+ return EXIT_SUCCESS; -+} ---- a/include/libnftnl/Makefile.am -+++ b/include/libnftnl/Makefile.am -@@ -6,6 +6,7 @@ pkginclude_HEADERS = batch.h \ - rule.h \ - expr.h \ - set.h \ -+ flowtable.h \ - ruleset.h \ - common.h \ - udata.h \ ---- /dev/null -+++ b/include/libnftnl/flowtable.h -@@ -0,0 +1,81 @@ -+#ifndef _LIBNFTNL_FLOWTABLE_H_ -+#define _LIBNFTNL_FLOWTABLE_H_ -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+struct nftnl_flowtable; -+ -+struct nftnl_flowtable *nftnl_flowtable_alloc(void); -+void nftnl_flowtable_free(const struct nftnl_flowtable *); -+ -+enum nftnl_flowtable_attr { -+ NFTNL_FLOWTABLE_NAME = 0, -+ NFTNL_FLOWTABLE_FAMILY, -+ NFTNL_FLOWTABLE_TABLE, -+ NFTNL_FLOWTABLE_HOOKNUM, -+ NFTNL_FLOWTABLE_PRIO = 4, -+ NFTNL_FLOWTABLE_USE, -+ NFTNL_FLOWTABLE_DEVICES, -+ __NFTNL_FLOWTABLE_MAX -+}; -+#define NFTNL_FLOWTABLE_MAX (__NFTNL_FLOWTABLE_MAX - 1) -+ -+bool nftnl_flowtable_is_set(const struct nftnl_flowtable *c, uint16_t attr); -+void nftnl_flowtable_unset(struct nftnl_flowtable *c, uint16_t attr); -+void nftnl_flowtable_set(struct nftnl_flowtable *t, uint16_t attr, const void *data); -+int nftnl_flowtable_set_data(struct nftnl_flowtable *t, uint16_t attr, -+ const void *data, uint32_t data_len); -+void nftnl_flowtable_set_u32(struct nftnl_flowtable *t, uint16_t attr, uint32_t data); -+void nftnl_flowtable_set_s32(struct nftnl_flowtable *t, uint16_t attr, int32_t data); -+int nftnl_flowtable_set_str(struct nftnl_flowtable *t, uint16_t attr, const char *str); -+void nftnl_flowtable_set_array(struct nftnl_flowtable *t, uint16_t attr, const char **data); -+ -+const void *nftnl_flowtable_get(const struct nftnl_flowtable *c, uint16_t attr); -+const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, uint16_t attr, -+ uint32_t *data_len); -+const char *nftnl_flowtable_get_str(const struct nftnl_flowtable *c, uint16_t attr); -+uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr); -+int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr); -+const char **nftnl_flowtable_get_array(const struct nftnl_flowtable *t, uint16_t attr); -+ -+struct nlmsghdr; -+ -+void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_flowtable *t); -+ -+int nftnl_flowtable_parse(struct nftnl_flowtable *c, enum nftnl_parse_type type, -+ const char *data, struct nftnl_parse_err *err); -+int nftnl_flowtable_parse_file(struct nftnl_flowtable *c, enum nftnl_parse_type type, -+ FILE *fp, struct nftnl_parse_err *err); -+int nftnl_flowtable_snprintf(char *buf, size_t size, const struct nftnl_flowtable *t, uint32_t type, uint32_t flags); -+int nftnl_flowtable_fprintf(FILE *fp, const struct nftnl_flowtable *c, uint32_t type, uint32_t flags); -+ -+#define nftnl_flowtable_nlmsg_build_hdr nftnl_nlmsg_build_hdr -+int nftnl_flowtable_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_flowtable *t); -+ -+struct nftnl_flowtable_list; -+ -+struct nftnl_flowtable_list *nftnl_flowtable_list_alloc(void); -+void nftnl_flowtable_list_free(struct nftnl_flowtable_list *list); -+int nftnl_flowtable_list_is_empty(const struct nftnl_flowtable_list *list); -+void nftnl_flowtable_list_add(struct nftnl_flowtable *s, -+ struct nftnl_flowtable_list *list); -+void nftnl_flowtable_list_add_tail(struct nftnl_flowtable *s, -+ struct nftnl_flowtable_list *list); -+void nftnl_flowtable_list_del(struct nftnl_flowtable *s); -+int nftnl_flowtable_list_foreach(struct nftnl_flowtable_list *flowtable_list, -+ int (*cb)(struct nftnl_flowtable *t, void *data), void *data); -+ -+#ifdef __cplusplus -+} /* extern "C" */ -+#endif -+ -+#endif /* _LIBNFTNL_FLOWTABLE_H_ */ ---- a/include/linux/netfilter/nf_tables.h -+++ b/include/linux/netfilter/nf_tables.h -@@ -90,6 +90,9 @@ enum nft_verdicts { - * @NFT_MSG_GETOBJ: get a stateful object (enum nft_obj_attributes) - * @NFT_MSG_DELOBJ: delete a stateful object (enum nft_obj_attributes) - * @NFT_MSG_GETOBJ_RESET: get and reset a stateful object (enum nft_obj_attributes) -+ * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes) -+ * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) -+ * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) - */ - enum nf_tables_msg_types { - NFT_MSG_NEWTABLE, -@@ -114,6 +117,9 @@ enum nf_tables_msg_types { - NFT_MSG_GETOBJ, - NFT_MSG_DELOBJ, - NFT_MSG_GETOBJ_RESET, -+ NFT_MSG_NEWFLOWTABLE, -+ NFT_MSG_GETFLOWTABLE, -+ NFT_MSG_DELFLOWTABLE, - NFT_MSG_MAX, - }; - -@@ -1303,6 +1309,53 @@ enum nft_object_attributes { - #define NFTA_OBJ_MAX (__NFTA_OBJ_MAX - 1) - - /** -+ * enum nft_flowtable_attributes - nf_tables flow table netlink attributes -+ * -+ * @NFTA_FLOWTABLE_TABLE: name of the table containing the expression (NLA_STRING) -+ * @NFTA_FLOWTABLE_NAME: name of this flow table (NLA_STRING) -+ * @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32) -+ * @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32) -+ */ -+enum nft_flowtable_attributes { -+ NFTA_FLOWTABLE_UNSPEC, -+ NFTA_FLOWTABLE_TABLE, -+ NFTA_FLOWTABLE_NAME, -+ NFTA_FLOWTABLE_HOOK, -+ NFTA_FLOWTABLE_USE, -+ __NFTA_FLOWTABLE_MAX -+}; -+#define NFTA_FLOWTABLE_MAX (__NFTA_FLOWTABLE_MAX - 1) -+ -+/** -+ * enum nft_flowtable_hook_attributes - nf_tables flow table hook netlink attributes -+ * -+ * @NFTA_FLOWTABLE_HOOK_NUM: netfilter hook number (NLA_U32) -+ * @NFTA_FLOWTABLE_HOOK_PRIORITY: netfilter hook priority (NLA_U32) -+ * @NFTA_FLOWTABLE_HOOK_DEVS: input devices this flow table is bound to (NLA_NESTED) -+ */ -+enum nft_flowtable_hook_attributes { -+ NFTA_FLOWTABLE_HOOK_UNSPEC, -+ NFTA_FLOWTABLE_HOOK_NUM, -+ NFTA_FLOWTABLE_HOOK_PRIORITY, -+ NFTA_FLOWTABLE_HOOK_DEVS, -+ __NFTA_FLOWTABLE_HOOK_MAX -+}; -+#define NFTA_FLOWTABLE_HOOK_MAX (__NFTA_FLOWTABLE_HOOK_MAX - 1) -+ -+/** -+ * enum nft_device_attributes - nf_tables device netlink attributes -+ * -+ * @NFTA_DEVICE_NAME: name of this device (NLA_STRING) -+ */ -+enum nft_devices_attributes { -+ NFTA_DEVICE_UNSPEC, -+ NFTA_DEVICE_NAME, -+ __NFTA_DEVICE_MAX -+}; -+#define NFTA_DEVICE_MAX (__NFTA_DEVICE_MAX - 1) -+ -+ -+/** - * enum nft_trace_attributes - nf_tables trace netlink attributes - * - * @NFTA_TRACE_TABLE: name of the table (NLA_STRING) ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -8,6 +8,7 @@ libnftnl_la_LDFLAGS = -Wl,--version-scri - libnftnl_la_SOURCES = utils.c \ - batch.c \ - buffer.c \ -+ flowtable.c \ - common.c \ - gen.c \ - table.c \ ---- /dev/null -+++ b/src/flowtable.c -@@ -0,0 +1,793 @@ -+#include "internal.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+struct nftnl_flowtable { -+ struct list_head head; -+ const char *name; -+ const char *table; -+ int family; -+ uint32_t hooknum; -+ int32_t prio; -+ const char **dev_array; -+ uint32_t dev_array_len; -+ uint32_t use; -+ uint32_t flags; -+}; -+ -+struct nftnl_flowtable *nftnl_flowtable_alloc(void) -+{ -+ return calloc(1, sizeof(struct nftnl_flowtable)); -+} -+EXPORT_SYMBOL(nftnl_flowtable_alloc); -+ -+void nftnl_flowtable_free(const struct nftnl_flowtable *c) -+{ -+ int i; -+ -+ if (c->flags & (1 << NFTNL_FLOWTABLE_NAME)) -+ xfree(c->name); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_TABLE)) -+ xfree(c->table); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_DEVICES)) { -+ for (i = 0; i < c->dev_array_len; i++) -+ xfree(c->dev_array[i]); -+ -+ xfree(c->dev_array); -+ } -+ xfree(c); -+} -+EXPORT_SYMBOL(nftnl_flowtable_free); -+ -+bool nftnl_flowtable_is_set(const struct nftnl_flowtable *c, uint16_t attr) -+{ -+ return c->flags & (1 << attr); -+} -+EXPORT_SYMBOL(nftnl_flowtable_is_set); -+ -+void nftnl_flowtable_unset(struct nftnl_flowtable *c, uint16_t attr) -+{ -+ int i; -+ -+ if (!(c->flags & (1 << attr))) -+ return; -+ -+ switch (attr) { -+ case NFTNL_FLOWTABLE_NAME: -+ xfree(c->name); -+ break; -+ case NFTNL_FLOWTABLE_TABLE: -+ xfree(c->table); -+ break; -+ case NFTNL_FLOWTABLE_HOOKNUM: -+ case NFTNL_FLOWTABLE_PRIO: -+ case NFTNL_FLOWTABLE_USE: -+ case NFTNL_FLOWTABLE_FAMILY: -+ break; -+ case NFTNL_FLOWTABLE_DEVICES: -+ for (i = 0; i < c->dev_array_len; i++) { -+ xfree(c->dev_array[i]); -+ xfree(c->dev_array); -+ } -+ break; -+ default: -+ return; -+ } -+ -+ c->flags &= ~(1 << attr); -+} -+EXPORT_SYMBOL(nftnl_flowtable_unset); -+ -+static uint32_t nftnl_flowtable_validate[NFTNL_FLOWTABLE_MAX + 1] = { -+ [NFTNL_FLOWTABLE_HOOKNUM] = sizeof(uint32_t), -+ [NFTNL_FLOWTABLE_PRIO] = sizeof(int32_t), -+ [NFTNL_FLOWTABLE_FAMILY] = sizeof(uint32_t), -+}; -+ -+int nftnl_flowtable_set_data(struct nftnl_flowtable *c, uint16_t attr, -+ const void *data, uint32_t data_len) -+{ -+ const char **dev_array; -+ int len = 0, i; -+ -+ nftnl_assert_attr_exists(attr, NFTNL_FLOWTABLE_MAX); -+ nftnl_assert_validate(data, nftnl_flowtable_validate, attr, data_len); -+ -+ switch(attr) { -+ case NFTNL_FLOWTABLE_NAME: -+ if (c->flags & (1 << NFTNL_FLOWTABLE_NAME)) -+ xfree(c->name); -+ -+ c->name = strdup(data); -+ if (!c->name) -+ return -1; -+ break; -+ case NFTNL_FLOWTABLE_TABLE: -+ if (c->flags & (1 << NFTNL_FLOWTABLE_TABLE)) -+ xfree(c->table); -+ -+ c->table = strdup(data); -+ if (!c->table) -+ return -1; -+ break; -+ case NFTNL_FLOWTABLE_HOOKNUM: -+ memcpy(&c->hooknum, data, sizeof(c->hooknum)); -+ break; -+ case NFTNL_FLOWTABLE_PRIO: -+ memcpy(&c->prio, data, sizeof(c->prio)); -+ break; -+ case NFTNL_FLOWTABLE_FAMILY: -+ memcpy(&c->family, data, sizeof(c->family)); -+ break; -+ case NFTNL_FLOWTABLE_DEVICES: -+ dev_array = (const char **)data; -+ while (dev_array[len] != NULL) -+ len++; -+ -+ if (c->flags & (1 << NFTNL_FLOWTABLE_DEVICES)) { -+ for (i = 0; i < c->dev_array_len; i++) { -+ xfree(c->dev_array[i]); -+ xfree(c->dev_array); -+ } -+ } -+ -+ c->dev_array = calloc(len + 1, sizeof(char *)); -+ if (!c->dev_array) -+ return -1; -+ -+ for (i = 0; i < len; i++) -+ c->dev_array[i] = strdup(dev_array[i]); -+ -+ c->dev_array_len = len; -+ break; -+ } -+ c->flags |= (1 << attr); -+ return 0; -+} -+EXPORT_SYMBOL(nftnl_flowtable_set_data); -+ -+void nftnl_flowtable_set(struct nftnl_flowtable *c, uint16_t attr, const void *data) -+{ -+ nftnl_flowtable_set_data(c, attr, data, nftnl_flowtable_validate[attr]); -+} -+EXPORT_SYMBOL(nftnl_flowtable_set); -+ -+void nftnl_flowtable_set_array(struct nftnl_flowtable *c, uint16_t attr, const char **data) -+{ -+ nftnl_flowtable_set_data(c, attr, &data[0], nftnl_flowtable_validate[attr]); -+} -+EXPORT_SYMBOL(nftnl_flowtable_set_array); -+ -+void nftnl_flowtable_set_u32(struct nftnl_flowtable *c, uint16_t attr, uint32_t data) -+{ -+ nftnl_flowtable_set_data(c, attr, &data, sizeof(uint32_t)); -+} -+EXPORT_SYMBOL(nftnl_flowtable_set_u32); -+ -+void nftnl_flowtable_set_s32(struct nftnl_flowtable *c, uint16_t attr, int32_t data) -+{ -+ nftnl_flowtable_set_data(c, attr, &data, sizeof(int32_t)); -+} -+EXPORT_SYMBOL(nftnl_flowtable_set_s32); -+ -+int nftnl_flowtable_set_str(struct nftnl_flowtable *c, uint16_t attr, const char *str) -+{ -+ return nftnl_flowtable_set_data(c, attr, str, strlen(str) + 1); -+} -+EXPORT_SYMBOL(nftnl_flowtable_set_str); -+ -+const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, -+ uint16_t attr, uint32_t *data_len) -+{ -+ if (!(c->flags & (1 << attr))) -+ return NULL; -+ -+ switch(attr) { -+ case NFTNL_FLOWTABLE_NAME: -+ *data_len = strlen(c->name) + 1; -+ return c->name; -+ case NFTNL_FLOWTABLE_TABLE: -+ *data_len = strlen(c->table) + 1; -+ return c->table; -+ case NFTNL_FLOWTABLE_HOOKNUM: -+ *data_len = sizeof(uint32_t); -+ return &c->hooknum; -+ case NFTNL_FLOWTABLE_PRIO: -+ *data_len = sizeof(int32_t); -+ return &c->prio; -+ case NFTNL_FLOWTABLE_FAMILY: -+ *data_len = sizeof(int32_t); -+ return &c->family; -+ case NFTNL_FLOWTABLE_DEVICES: -+ return &c->dev_array[0]; -+ } -+ return NULL; -+} -+EXPORT_SYMBOL(nftnl_flowtable_get_data); -+ -+const void *nftnl_flowtable_get(const struct nftnl_flowtable *c, uint16_t attr) -+{ -+ uint32_t data_len; -+ return nftnl_flowtable_get_data(c, attr, &data_len); -+} -+EXPORT_SYMBOL(nftnl_flowtable_get); -+ -+const char *nftnl_flowtable_get_str(const struct nftnl_flowtable *c, uint16_t attr) -+{ -+ return nftnl_flowtable_get(c, attr); -+} -+EXPORT_SYMBOL(nftnl_flowtable_get_str); -+ -+uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr) -+{ -+ uint32_t data_len; -+ const uint32_t *val = nftnl_flowtable_get_data(c, attr, &data_len); -+ -+ nftnl_assert(val, attr, data_len == sizeof(uint32_t)); -+ -+ return val ? *val : 0; -+} -+EXPORT_SYMBOL(nftnl_flowtable_get_u32); -+ -+int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr) -+{ -+ uint32_t data_len; -+ const int32_t *val = nftnl_flowtable_get_data(c, attr, &data_len); -+ -+ nftnl_assert(val, attr, data_len == sizeof(int32_t)); -+ -+ return val ? *val : 0; -+} -+EXPORT_SYMBOL(nftnl_flowtable_get_s32); -+ -+const char **nftnl_flowtable_get_array(const struct nftnl_flowtable *c, uint16_t attr) -+{ -+ return (const char **)nftnl_flowtable_get(c, attr); -+} -+EXPORT_SYMBOL(nftnl_flowtable_get_array); -+ -+void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh, -+ const struct nftnl_flowtable *c) -+{ -+ int i; -+ -+ if (c->flags & (1 << NFTNL_FLOWTABLE_TABLE)) -+ mnl_attr_put_strz(nlh, NFTA_FLOWTABLE_TABLE, c->table); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_NAME)) -+ mnl_attr_put_strz(nlh, NFTA_FLOWTABLE_NAME, c->name); -+ if ((c->flags & (1 << NFTNL_FLOWTABLE_HOOKNUM)) && -+ (c->flags & (1 << NFTNL_FLOWTABLE_PRIO))) { -+ struct nlattr *nest; -+ -+ nest = mnl_attr_nest_start(nlh, NFTA_FLOWTABLE_HOOK); -+ mnl_attr_put_u32(nlh, NFTA_FLOWTABLE_HOOK_NUM, htonl(c->hooknum)); -+ mnl_attr_put_u32(nlh, NFTA_FLOWTABLE_HOOK_PRIORITY, htonl(c->prio)); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_DEVICES)) { -+ struct nlattr *nest_dev; -+ -+ nest_dev = mnl_attr_nest_start(nlh, -+ NFTA_FLOWTABLE_HOOK_DEVS); -+ for (i = 0; i < c->dev_array_len; i++) -+ mnl_attr_put_strz(nlh, NFTA_DEVICE_NAME, -+ c->dev_array[i]); -+ mnl_attr_nest_end(nlh, nest_dev); -+ } -+ mnl_attr_nest_end(nlh, nest); -+ } -+ if (c->flags & (1 << NFTNL_FLOWTABLE_USE)) -+ mnl_attr_put_u32(nlh, NFTA_FLOWTABLE_USE, htonl(c->use)); -+} -+EXPORT_SYMBOL(nftnl_flowtable_nlmsg_build_payload); -+ -+static int nftnl_flowtable_parse_attr_cb(const struct nlattr *attr, void *data) -+{ -+ const struct nlattr **tb = data; -+ int type = mnl_attr_get_type(attr); -+ -+ if (mnl_attr_type_valid(attr, NFTA_FLOWTABLE_MAX) < 0) -+ return MNL_CB_OK; -+ -+ switch(type) { -+ case NFTA_FLOWTABLE_NAME: -+ case NFTA_FLOWTABLE_TABLE: -+ if (mnl_attr_validate(attr, MNL_TYPE_STRING) < 0) -+ abi_breakage(); -+ break; -+ case NFTA_FLOWTABLE_HOOK: -+ if (mnl_attr_validate(attr, MNL_TYPE_NESTED) < 0) -+ abi_breakage(); -+ break; -+ case NFTA_FLOWTABLE_USE: -+ if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) -+ abi_breakage(); -+ break; -+ } -+ -+ tb[type] = attr; -+ return MNL_CB_OK; -+} -+ -+static int nftnl_flowtable_parse_hook_cb(const struct nlattr *attr, void *data) -+{ -+ const struct nlattr **tb = data; -+ int type = mnl_attr_get_type(attr); -+ -+ if (mnl_attr_type_valid(attr, NFTA_FLOWTABLE_HOOK_MAX) < 0) -+ return MNL_CB_OK; -+ -+ switch(type) { -+ case NFTA_FLOWTABLE_HOOK_NUM: -+ case NFTA_FLOWTABLE_HOOK_PRIORITY: -+ if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) -+ abi_breakage(); -+ break; -+ case NFTA_FLOWTABLE_HOOK_DEVS: -+ if (mnl_attr_validate(attr, MNL_TYPE_NESTED) < 0) -+ abi_breakage(); -+ break; -+ } -+ -+ tb[type] = attr; -+ return MNL_CB_OK; -+} -+ -+static int nftnl_flowtable_parse_devs(struct nlattr *nest, -+ struct nftnl_flowtable *c) -+{ -+ struct nlattr *attr; -+ char *dev_array[8]; -+ int len = 0, i; -+ -+ mnl_attr_for_each_nested(attr, nest) { -+ if (mnl_attr_get_type(attr) != NFTA_DEVICE_NAME) -+ return -1; -+ dev_array[len++] = strdup(mnl_attr_get_str(attr)); -+ if (len >= 8) -+ break; -+ } -+ -+ if (!len) -+ return -1; -+ -+ c->dev_array = calloc(len + 1, sizeof(char *)); -+ if (!c->dev_array) -+ return -1; -+ -+ c->dev_array_len = len; -+ -+ for (i = 0; i < len; i++) -+ c->dev_array[i] = strdup(dev_array[i]); -+ -+ return 0; -+} -+ -+static int nftnl_flowtable_parse_hook(struct nlattr *attr, struct nftnl_flowtable *c) -+{ -+ struct nlattr *tb[NFTA_FLOWTABLE_HOOK_MAX + 1] = {}; -+ int ret; -+ -+ if (mnl_attr_parse_nested(attr, nftnl_flowtable_parse_hook_cb, tb) < 0) -+ return -1; -+ -+ if (tb[NFTA_FLOWTABLE_HOOK_NUM]) { -+ c->hooknum = ntohl(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_HOOK_NUM])); -+ c->flags |= (1 << NFTNL_FLOWTABLE_HOOKNUM); -+ } -+ if (tb[NFTA_FLOWTABLE_HOOK_PRIORITY]) { -+ c->prio = ntohl(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_HOOK_PRIORITY])); -+ c->flags |= (1 << NFTNL_FLOWTABLE_PRIO); -+ } -+ if (tb[NFTA_FLOWTABLE_HOOK_DEVS]) { -+ ret = nftnl_flowtable_parse_devs(tb[NFTA_FLOWTABLE_HOOK_DEVS], c); -+ if (ret < 0) -+ return -1; -+ c->flags |= (1 << NFTNL_FLOWTABLE_DEVICES); -+ } -+ -+ return 0; -+} -+ -+int nftnl_flowtable_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_flowtable *c) -+{ -+ struct nlattr *tb[NFTA_FLOWTABLE_MAX + 1] = {}; -+ struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); -+ int ret = 0; -+ -+ if (mnl_attr_parse(nlh, sizeof(*nfg), nftnl_flowtable_parse_attr_cb, tb) < 0) -+ return -1; -+ -+ if (tb[NFTA_FLOWTABLE_NAME]) { -+ if (c->flags & (1 << NFTNL_FLOWTABLE_NAME)) -+ xfree(c->name); -+ c->name = strdup(mnl_attr_get_str(tb[NFTA_FLOWTABLE_NAME])); -+ if (!c->name) -+ return -1; -+ c->flags |= (1 << NFTNL_FLOWTABLE_NAME); -+ } -+ if (tb[NFTA_FLOWTABLE_TABLE]) { -+ if (c->flags & (1 << NFTNL_FLOWTABLE_TABLE)) -+ xfree(c->table); -+ c->table = strdup(mnl_attr_get_str(tb[NFTA_FLOWTABLE_TABLE])); -+ if (!c->table) -+ return -1; -+ c->flags |= (1 << NFTNL_FLOWTABLE_TABLE); -+ } -+ if (tb[NFTA_FLOWTABLE_HOOK]) { -+ ret = nftnl_flowtable_parse_hook(tb[NFTA_FLOWTABLE_HOOK], c); -+ if (ret < 0) -+ return ret; -+ } -+ if (tb[NFTA_FLOWTABLE_USE]) { -+ c->use = ntohl(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_USE])); -+ c->flags |= (1 << NFTNL_FLOWTABLE_USE); -+ } -+ -+ c->family = nfg->nfgen_family; -+ c->flags |= (1 << NFTNL_FLOWTABLE_FAMILY); -+ -+ return ret; -+} -+EXPORT_SYMBOL(nftnl_flowtable_nlmsg_parse); -+ -+static const char *nftnl_hooknum2str(int family, int hooknum) -+{ -+ switch (family) { -+ case NFPROTO_IPV4: -+ case NFPROTO_IPV6: -+ case NFPROTO_INET: -+ case NFPROTO_BRIDGE: -+ switch (hooknum) { -+ case NF_INET_PRE_ROUTING: -+ return "prerouting"; -+ case NF_INET_LOCAL_IN: -+ return "input"; -+ case NF_INET_FORWARD: -+ return "forward"; -+ case NF_INET_LOCAL_OUT: -+ return "output"; -+ case NF_INET_POST_ROUTING: -+ return "postrouting"; -+ } -+ break; -+ case NFPROTO_ARP: -+ switch (hooknum) { -+ case NF_ARP_IN: -+ return "input"; -+ case NF_ARP_OUT: -+ return "output"; -+ case NF_ARP_FORWARD: -+ return "forward"; -+ } -+ break; -+ case NFPROTO_NETDEV: -+ switch (hooknum) { -+ case NF_NETDEV_INGRESS: -+ return "ingress"; -+ } -+ break; -+ } -+ return "unknown"; -+} -+ -+static inline int nftnl_str2hooknum(int family, const char *hook) -+{ -+ int hooknum; -+ -+ for (hooknum = 0; hooknum < NF_INET_NUMHOOKS; hooknum++) { -+ if (strcmp(hook, nftnl_hooknum2str(family, hooknum)) == 0) -+ return hooknum; -+ } -+ return -1; -+} -+ -+#ifdef JSON_PARSING -+static int nftnl_jansson_parse_flowtable(struct nftnl_flowtable *c, -+ json_t *tree, -+ struct nftnl_parse_err *err) -+{ -+ const char *name, *table, *hooknum_str; -+ int32_t family, prio, hooknum; -+ json_t *root; -+ -+ root = nftnl_jansson_get_node(tree, "flowtable", err); -+ if (root == NULL) -+ return -1; -+ -+ name = nftnl_jansson_parse_str(root, "name", err); -+ if (name != NULL) -+ nftnl_flowtable_set_str(c, NFTNL_FLOWTABLE_NAME, name); -+ -+ if (nftnl_jansson_parse_family(root, &family, err) == 0) -+ nftnl_flowtable_set_u32(c, NFTNL_FLOWTABLE_FAMILY, family); -+ -+ table = nftnl_jansson_parse_str(root, "table", err); -+ -+ if (table != NULL) -+ nftnl_flowtable_set_str(c, NFTNL_FLOWTABLE_TABLE, table); -+ -+ if (nftnl_jansson_node_exist(root, "hooknum")) { -+ if (nftnl_jansson_parse_val(root, "prio", NFTNL_TYPE_S32, -+ &prio, err) == 0) -+ nftnl_flowtable_set_s32(c, NFTNL_FLOWTABLE_PRIO, prio); -+ -+ hooknum_str = nftnl_jansson_parse_str(root, "hooknum", err); -+ if (hooknum_str != NULL) { -+ hooknum = nftnl_str2hooknum(c->family, hooknum_str); -+ if (hooknum == -1) -+ return -1; -+ nftnl_flowtable_set_u32(c, NFTNL_FLOWTABLE_HOOKNUM, -+ hooknum); -+ } -+ } -+ -+ return 0; -+} -+#endif -+ -+static int nftnl_flowtable_json_parse(struct nftnl_flowtable *c, -+ const void *json, -+ struct nftnl_parse_err *err, -+ enum nftnl_parse_input input) -+{ -+#ifdef JSON_PARSING -+ json_t *tree; -+ json_error_t error; -+ int ret; -+ -+ tree = nftnl_jansson_create_root(json, &error, err, input); -+ if (tree == NULL) -+ return -1; -+ -+ ret = nftnl_jansson_parse_flowtable(c, tree, err); -+ -+ nftnl_jansson_free_root(tree); -+ -+ return ret; -+#else -+ errno = EOPNOTSUPP; -+ return -1; -+#endif -+} -+ -+static int nftnl_flowtable_do_parse(struct nftnl_flowtable *c, -+ enum nftnl_parse_type type, -+ const void *data, -+ struct nftnl_parse_err *err, -+ enum nftnl_parse_input input) -+{ -+ int ret; -+ struct nftnl_parse_err perr = {}; -+ -+ switch (type) { -+ case NFTNL_PARSE_JSON: -+ ret = nftnl_flowtable_json_parse(c, data, &perr, input); -+ break; -+ case NFTNL_PARSE_XML: -+ default: -+ ret = -1; -+ errno = EOPNOTSUPP; -+ break; -+ } -+ -+ if (err != NULL) -+ *err = perr; -+ -+ return ret; -+} -+ -+int nftnl_flowtable_parse(struct nftnl_flowtable *c, enum nftnl_parse_type type, -+ const char *data, struct nftnl_parse_err *err) -+{ -+ return nftnl_flowtable_do_parse(c, type, data, err, NFTNL_PARSE_BUFFER); -+} -+EXPORT_SYMBOL(nftnl_flowtable_parse); -+ -+int nftnl_flowtable_parse_file(struct nftnl_flowtable *c, -+ enum nftnl_parse_type type, -+ FILE *fp, struct nftnl_parse_err *err) -+{ -+ return nftnl_flowtable_do_parse(c, type, fp, err, NFTNL_PARSE_FILE); -+} -+EXPORT_SYMBOL(nftnl_flowtable_parse_file); -+ -+static int nftnl_flowtable_export(char *buf, size_t size, -+ const struct nftnl_flowtable *c, int type) -+{ -+ NFTNL_BUF_INIT(b, buf, size); -+ -+ nftnl_buf_open(&b, type, CHAIN); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_NAME)) -+ nftnl_buf_str(&b, type, c->name, NAME); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_TABLE)) -+ nftnl_buf_str(&b, type, c->table, TABLE); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_FAMILY)) -+ nftnl_buf_str(&b, type, nftnl_family2str(c->family), FAMILY); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_USE)) -+ nftnl_buf_u32(&b, type, c->use, USE); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_HOOKNUM)) { -+ if (c->flags & (1 << NFTNL_FLOWTABLE_HOOKNUM)) -+ nftnl_buf_str(&b, type, nftnl_hooknum2str(c->family, -+ c->hooknum), HOOKNUM); -+ if (c->flags & (1 << NFTNL_FLOWTABLE_PRIO)) -+ nftnl_buf_s32(&b, type, c->prio, PRIO); -+ } -+ -+ nftnl_buf_close(&b, type, CHAIN); -+ -+ return nftnl_buf_done(&b); -+} -+ -+static int nftnl_flowtable_snprintf_default(char *buf, size_t size, -+ const struct nftnl_flowtable *c) -+{ -+ int ret, remain = size, offset = 0, i; -+ -+ ret = snprintf(buf, remain, "flow table %s %s use %u", -+ c->table, c->name, c->use); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ if (c->flags & (1 << NFTNL_FLOWTABLE_HOOKNUM)) { -+ ret = snprintf(buf + offset, remain, " hook %s prio %d", -+ nftnl_hooknum2str(c->family, c->hooknum), -+ c->prio); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ if (c->flags & (1 << NFTNL_FLOWTABLE_DEVICES)) { -+ ret = snprintf(buf + offset, remain, " dev { "); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ for (i = 0; i < c->dev_array_len; i++) { -+ ret = snprintf(buf + offset, remain, " %s ", -+ c->dev_array[i]); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ } -+ ret = snprintf(buf + offset, remain, " } "); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ } -+ } -+ -+ return offset; -+} -+ -+static int nftnl_flowtable_cmd_snprintf(char *buf, size_t size, -+ const struct nftnl_flowtable *c, -+ uint32_t cmd, uint32_t type, -+ uint32_t flags) -+{ -+ int ret, remain = size, offset = 0; -+ -+ ret = nftnl_cmd_header_snprintf(buf + offset, remain, cmd, type, flags); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ switch (type) { -+ case NFTNL_OUTPUT_DEFAULT: -+ ret = nftnl_flowtable_snprintf_default(buf + offset, remain, c); -+ break; -+ case NFTNL_OUTPUT_XML: -+ case NFTNL_OUTPUT_JSON: -+ ret = nftnl_flowtable_export(buf + offset, remain, c, type); -+ break; -+ default: -+ return -1; -+ } -+ -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ ret = nftnl_cmd_footer_snprintf(buf + offset, remain, cmd, type, flags); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ return offset; -+} -+ -+int nftnl_flowtable_snprintf(char *buf, size_t size, const struct nftnl_flowtable *c, -+ uint32_t type, uint32_t flags) -+{ -+ if (size) -+ buf[0] = '\0'; -+ -+ return nftnl_flowtable_cmd_snprintf(buf, size, c, nftnl_flag2cmd(flags), -+ type, flags); -+} -+EXPORT_SYMBOL(nftnl_flowtable_snprintf); -+ -+static int nftnl_flowtable_do_snprintf(char *buf, size_t size, const void *c, -+ uint32_t cmd, uint32_t type, uint32_t flags) -+{ -+ return nftnl_flowtable_snprintf(buf, size, c, type, flags); -+} -+ -+int nftnl_flowtable_fprintf(FILE *fp, const struct nftnl_flowtable *c, -+ uint32_t type, uint32_t flags) -+{ -+ return nftnl_fprintf(fp, c, NFTNL_CMD_UNSPEC, type, flags, -+ nftnl_flowtable_do_snprintf); -+} -+EXPORT_SYMBOL(nftnl_flowtable_fprintf); -+ -+struct nftnl_flowtable_list { -+ struct list_head list; -+}; -+ -+struct nftnl_flowtable_list *nftnl_flowtable_list_alloc(void) -+{ -+ struct nftnl_flowtable_list *list; -+ -+ list = calloc(1, sizeof(struct nftnl_flowtable_list)); -+ if (list == NULL) -+ return NULL; -+ -+ INIT_LIST_HEAD(&list->list); -+ -+ return list; -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_alloc); -+ -+void nftnl_flowtable_list_free(struct nftnl_flowtable_list *list) -+{ -+ struct nftnl_flowtable *s, *tmp; -+ -+ list_for_each_entry_safe(s, tmp, &list->list, head) { -+ list_del(&s->head); -+ nftnl_flowtable_free(s); -+ } -+ xfree(list); -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_free); -+ -+int nftnl_flowtable_list_is_empty(const struct nftnl_flowtable_list *list) -+{ -+ return list_empty(&list->list); -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_is_empty); -+ -+void nftnl_flowtable_list_add(struct nftnl_flowtable *s, -+ struct nftnl_flowtable_list *list) -+{ -+ list_add(&s->head, &list->list); -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_add); -+ -+void nftnl_flowtable_list_add_tail(struct nftnl_flowtable *s, -+ struct nftnl_flowtable_list *list) -+{ -+ list_add_tail(&s->head, &list->list); -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_add_tail); -+ -+void nftnl_flowtable_list_del(struct nftnl_flowtable *s) -+{ -+ list_del(&s->head); -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_del); -+ -+int nftnl_flowtable_list_foreach(struct nftnl_flowtable_list *flowtable_list, -+ int (*cb)(struct nftnl_flowtable *t, void *data), void *data) -+{ -+ struct nftnl_flowtable *cur, *tmp; -+ int ret; -+ -+ list_for_each_entry_safe(cur, tmp, &flowtable_list->list, head) { -+ ret = cb(cur, data); -+ if (ret < 0) -+ return ret; -+ } -+ return 0; -+} -+EXPORT_SYMBOL(nftnl_flowtable_list_foreach); ---- a/src/libnftnl.map -+++ b/src/libnftnl.map -@@ -311,3 +311,34 @@ local: *; - LIBNFTNL_6 { - nftnl_expr_fprintf; - } LIBNFTNL_5; -+ -+LIBNFTNL_7 { -+ nftnl_flowtable_alloc; -+ nftnl_flowtable_free; -+ nftnl_flowtable_is_set; -+ nftnl_flowtable_unset; -+ nftnl_flowtable_set; -+ nftnl_flowtable_set_u32; -+ nftnl_flowtable_set_s32; -+ nftnl_flowtable_set_array; -+ nftnl_flowtable_set_str; -+ nftnl_flowtable_get; -+ nftnl_flowtable_get_u32; -+ nftnl_flowtable_get_s32; -+ nftnl_flowtable_get_array; -+ nftnl_flowtable_get_str; -+ nftnl_flowtable_parse; -+ nftnl_flowtable_parse_file; -+ nftnl_flowtable_snprintf; -+ nftnl_flowtable_fprintf; -+ nftnl_flowtable_nlmsg_build_payload; -+ nftnl_flowtable_nlmsg_parse; -+ nftnl_flowtable_list_alloc; -+ nftnl_flowtable_list_free; -+ nftnl_flowtable_list_is_empty; -+ nftnl_flowtable_list_add; -+ nftnl_flowtable_list_add_tail; -+ nftnl_flowtable_list_del; -+ nftnl_flowtable_list_foreach; -+ -+} LIBNFTNL_6; diff --git a/package/libs/libnftnl/patches/101-expr-add-flow-offload-expression.patch b/package/libs/libnftnl/patches/101-expr-add-flow-offload-expression.patch deleted file mode 100644 index c7d3676ac..000000000 --- a/package/libs/libnftnl/patches/101-expr-add-flow-offload-expression.patch +++ /dev/null @@ -1,259 +0,0 @@ -From: Pablo Neira Ayuso -Date: Sun, 3 Dec 2017 21:05:54 +0100 -Subject: [PATCH] expr: add flow offload expression - -This patch adds the new "flow_offload" expression to select what flows -are offloaded to an existing flowtable. - -Signed-off-by: Pablo Neira Ayuso ---- - create mode 100644 src/expr/flow_offload.c - ---- a/include/libnftnl/expr.h -+++ b/include/libnftnl/expr.h -@@ -221,6 +221,10 @@ enum { - }; - - enum { -+ NFTNL_EXPR_FLOW_TABLE_NAME = NFTNL_EXPR_BASE, -+}; -+ -+enum { - NFTNL_EXPR_FWD_SREG_DEV = NFTNL_EXPR_BASE, - }; - ---- a/include/linux/netfilter/nf_tables.h -+++ b/include/linux/netfilter/nf_tables.h -@@ -952,6 +952,17 @@ enum nft_ct_attributes { - }; - #define NFTA_CT_MAX (__NFTA_CT_MAX - 1) - -+/** -+ * enum nft_flow_attributes - ct offload expression attributes -+ * @NFTA_FLOW_TABLE_NAME: flow table name (NLA_STRING) -+ */ -+enum nft_offload_attributes { -+ NFTA_FLOW_UNSPEC, -+ NFTA_FLOW_TABLE_NAME, -+ __NFTA_FLOW_MAX, -+}; -+#define NFTA_FLOW_MAX (__NFTA_FLOW_MAX - 1) -+ - enum nft_limit_type { - NFT_LIMIT_PKTS, - NFT_LIMIT_PKT_BYTES ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -32,6 +32,7 @@ libnftnl_la_SOURCES = utils.c \ - expr/data_reg.c \ - expr/dup.c \ - expr/exthdr.c \ -+ expr/flow_offload.c \ - expr/fib.c \ - expr/fwd.c \ - expr/limit.c \ ---- /dev/null -+++ b/src/expr/flow_offload.c -@@ -0,0 +1,184 @@ -+#include "internal.h" -+ -+#include -+#include -+#include /* for memcpy */ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct nftnl_expr_flow { -+ char *table_name; -+}; -+ -+static int nftnl_expr_flow_set(struct nftnl_expr *e, uint16_t type, -+ const void *data, uint32_t data_len) -+{ -+ struct nftnl_expr_flow *flow = nftnl_expr_data(e); -+ -+ switch (type) { -+ case NFTNL_EXPR_FLOW_TABLE_NAME: -+ flow->table_name = strdup((const char *)data); -+ if (!flow->table_name) -+ return -1; -+ break; -+ default: -+ return -1; -+ } -+ return 0; -+} -+ -+static const void *nftnl_expr_flow_get(const struct nftnl_expr *e, -+ uint16_t type, uint32_t *data_len) -+{ -+ struct nftnl_expr_flow *flow = nftnl_expr_data(e); -+ -+ switch(type) { -+ case NFTNL_EXPR_FLOW_TABLE_NAME: -+ *data_len = strlen(flow->table_name) + 1; -+ return flow->table_name; -+ } -+ return NULL; -+} -+ -+static int nftnl_expr_flow_cb(const struct nlattr *attr, void *data) -+{ -+ const struct nlattr **tb = data; -+ int type = mnl_attr_get_type(attr); -+ -+ if (mnl_attr_type_valid(attr, NFTA_FLOW_MAX) < 0) -+ return MNL_CB_OK; -+ -+ switch(type) { -+ case NFTA_FLOW_TABLE_NAME: -+ if (mnl_attr_validate(attr, MNL_TYPE_STRING) < 0) -+ abi_breakage(); -+ break; -+ } -+ -+ tb[type] = attr; -+ return MNL_CB_OK; -+} -+ -+static void nftnl_expr_flow_build(struct nlmsghdr *nlh, -+ const struct nftnl_expr *e) -+{ -+ struct nftnl_expr_flow *flow = nftnl_expr_data(e); -+ -+ if (e->flags & (1 << NFTNL_EXPR_FLOW_TABLE_NAME)) -+ mnl_attr_put_strz(nlh, NFTA_FLOW_TABLE_NAME, flow->table_name); -+} -+ -+static int nftnl_expr_flow_parse(struct nftnl_expr *e, struct nlattr *attr) -+{ -+ struct nftnl_expr_flow *flow = nftnl_expr_data(e); -+ struct nlattr *tb[NFTA_FLOW_MAX+1] = {}; -+ int ret = 0; -+ -+ if (mnl_attr_parse_nested(attr, nftnl_expr_flow_cb, tb) < 0) -+ return -1; -+ -+ if (tb[NFTA_FLOW_TABLE_NAME]) { -+ flow->table_name = -+ strdup(mnl_attr_get_str(tb[NFTA_FLOW_TABLE_NAME])); -+ if (!flow->table_name) -+ return -1; -+ e->flags |= (1 << NFTNL_EXPR_FLOW_TABLE_NAME); -+ } -+ -+ return ret; -+} -+ -+static int -+nftnl_expr_flow_json_parse(struct nftnl_expr *e, json_t *root, -+ struct nftnl_parse_err *err) -+{ -+#ifdef JSON_PARSING -+ const char *table_name; -+ -+ table_name = nftnl_jansson_parse_str(root, "flowtable", err); -+ if (table_name != NULL) -+ nftnl_expr_set_str(e, NFTNL_EXPR_FLOW_TABLE_NAME, table_name); -+ -+ return 0; -+#else -+ errno = EOPNOTSUPP; -+ return -1; -+#endif -+} -+ -+static int nftnl_expr_flow_export(char *buf, size_t size, -+ const struct nftnl_expr *e, int type) -+{ -+ struct nftnl_expr_flow *l = nftnl_expr_data(e); -+ NFTNL_BUF_INIT(b, buf, size); -+ -+ if (e->flags & (1 << NFTNL_EXPR_FLOW_TABLE_NAME)) -+ nftnl_buf_str(&b, type, l->table_name, SET); -+ -+ return nftnl_buf_done(&b); -+} -+ -+static int nftnl_expr_flow_snprintf_default(char *buf, size_t size, -+ const struct nftnl_expr *e) -+{ -+ int remain = size, offset = 0, ret; -+ struct nftnl_expr_flow *l = nftnl_expr_data(e); -+ -+ ret = snprintf(buf, remain, "flowtable %s ", l->table_name); -+ SNPRINTF_BUFFER_SIZE(ret, remain, offset); -+ -+ return offset; -+} -+ -+static int nftnl_expr_flow_snprintf(char *buf, size_t size, uint32_t type, -+ uint32_t flags, const struct nftnl_expr *e) -+{ -+ switch(type) { -+ case NFTNL_OUTPUT_DEFAULT: -+ return nftnl_expr_flow_snprintf_default(buf, size, e); -+ case NFTNL_OUTPUT_XML: -+ case NFTNL_OUTPUT_JSON: -+ return nftnl_expr_flow_export(buf, size, e, type); -+ default: -+ break; -+ } -+ return -1; -+} -+ -+static void nftnl_expr_flow_free(const struct nftnl_expr *e) -+{ -+ struct nftnl_expr_flow *flow = nftnl_expr_data(e); -+ -+ xfree(flow->table_name); -+} -+ -+static bool nftnl_expr_flow_cmp(const struct nftnl_expr *e1, -+ const struct nftnl_expr *e2) -+{ -+ struct nftnl_expr_flow *l1 = nftnl_expr_data(e1); -+ struct nftnl_expr_flow *l2 = nftnl_expr_data(e2); -+ bool eq = true; -+ -+ if (e1->flags & (1 << NFTNL_EXPR_FLOW_TABLE_NAME)) -+ eq &= !strcmp(l1->table_name, l2->table_name); -+ -+ return eq; -+} -+ -+struct expr_ops expr_ops_flow = { -+ .name = "flow_offload", -+ .alloc_len = sizeof(struct nftnl_expr_flow), -+ .max_attr = NFTA_FLOW_MAX, -+ .free = nftnl_expr_flow_free, -+ .cmp = nftnl_expr_flow_cmp, -+ .set = nftnl_expr_flow_set, -+ .get = nftnl_expr_flow_get, -+ .parse = nftnl_expr_flow_parse, -+ .build = nftnl_expr_flow_build, -+ .snprintf = nftnl_expr_flow_snprintf, -+ .json_parse = nftnl_expr_flow_json_parse, -+}; ---- a/src/expr_ops.c -+++ b/src/expr_ops.c -@@ -33,6 +33,7 @@ extern struct expr_ops expr_ops_target; - extern struct expr_ops expr_ops_dynset; - extern struct expr_ops expr_ops_hash; - extern struct expr_ops expr_ops_fib; -+extern struct expr_ops expr_ops_flow; - - static struct expr_ops expr_ops_notrack = { - .name = "notrack", -@@ -69,6 +70,7 @@ static struct expr_ops *expr_ops[] = { - &expr_ops_hash, - &expr_ops_fib, - &expr_ops_objref, -+ &expr_ops_flow, - NULL, - }; - diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 2339a9565..5ac228049 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnl -PKG_VERSION:=3.3.0 +PKG_VERSION:=3.4.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl3_3_0 -PKG_HASH:=705468b5ae4cd1eb099d2d1c476d6a3abe519bc2810becf12fb1e32de1e074e4 +PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl3_4_0 +PKG_HASH:=b7287637ae71c6db6f89e1422c995f0407ff2fe50cecd61a312b6a9b0921f5bf PKG_LICENSE:=LGPL-2.1 PKG_INSTALL:=1 @@ -78,7 +78,7 @@ define Package/libnl/description message construction and parsing, object caching system, etc. endef -TARGET_CFLAGS += -ffunction-sections $(FPIC) +TARGET_CFLAGS += -ffunction-sections -fdata-sections $(FPIC) CONFIGURE_ARGS += \ --disable-debug diff --git a/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch b/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch index 845a59376..cec720b8e 100644 --- a/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch +++ b/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch @@ -15,8 +15,6 @@ Signed-off-by: Thomas Petazzoni libnl-3.0.pc.in | 1 + 1 file changed, 1 insertion(+) -diff --git a/libnl-3.0.pc.in b/libnl-3.0.pc.in -index b87e3dc..ddbc999 100644 --- a/libnl-3.0.pc.in +++ b/libnl-3.0.pc.in @@ -7,4 +7,5 @@ Name: libnl @@ -25,6 +23,3 @@ index b87e3dc..ddbc999 100644 Libs: -L${libdir} -lnl-@MAJ_VERSION@ +Libs.private: @LIBS@ Cflags: -I${includedir}/libnl@MAJ_VERSION@ --- -2.1.0 - diff --git a/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch b/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch index 11dc75b89..1768dc2d5 100644 --- a/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch +++ b/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch @@ -1,6 +1,5 @@ -diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/if_ether.h libnl-3.3.0_rc1/include/linux-private/linux/if_ether.h ---- /include/linux-private/linux/if_ether.h 2017-03-08 19:56:31.824516933 -0800 -+++ /include/linux-private/linux/if_ether.h 2017-03-08 20:07:01.938237767 -0800 +--- a/include/linux-private/linux/if_ether.h ++++ b/include/linux-private/linux/if_ether.h @@ -22,6 +22,7 @@ #define _LINUX_IF_ETHER_H @@ -22,9 +21,8 @@ diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/if_ether.h libnl-3.3 +#endif #endif /* _LINUX_IF_ETHER_H */ -diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/libc-compat.h libnl-3.3.0_rc1/include/linux-private/linux/libc-compat.h ---- /include/linux-private/linux/libc-compat.h 2017-03-08 19:56:31.823516923 -0800 -+++ /include/linux-private/linux/libc-compat.h 2017-03-08 20:12:30.376843489 -0800 +--- a/include/linux-private/linux/libc-compat.h ++++ b/include/linux-private/linux/libc-compat.h @@ -48,10 +48,18 @@ #ifndef _LIBC_COMPAT_H #define _LIBC_COMPAT_H diff --git a/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch b/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch index f715bb83f..11d9f9bdb 100644 --- a/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch +++ b/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch @@ -26,8 +26,6 @@ Upstream status: https://github.com/thom311/libnl/pull/141 Makefile.am | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) -diff --git a/Makefile.am b/Makefile.am -index 1b95a559304f..279548394650 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,6 @@ @@ -39,7 +37,7 @@ index 1b95a559304f..279548394650 100644 check_PROGRAMS = check_programs = -@@ -500,6 +498,8 @@ EXTRA_lib_libnl_xfrm_3_la_DEPENDENCIES = \ +@@ -511,6 +509,8 @@ EXTRA_lib_libnl_xfrm_3_la_DEPENDENCIES = lib_libnl_xfrm_3_la_LIBADD = \ lib/libnl-3.la @@ -48,7 +46,7 @@ index 1b95a559304f..279548394650 100644 lib_cli_ltlibraries_cls = \ lib/cli/cls/basic.la \ lib/cli/cls/cgroup.la -@@ -513,15 +513,11 @@ lib_cli_ltlibraries_qdisc = \ +@@ -524,15 +524,11 @@ lib_cli_ltlibraries_qdisc = \ lib/cli/qdisc/pfifo.la \ lib/cli/qdisc/plug.la @@ -58,19 +56,15 @@ index 1b95a559304f..279548394650 100644 pkglib_cls_LTLIBRARIES = $(lib_cli_ltlibraries_cls) pkglib_qdisc_LTLIBRARIES = $(lib_cli_ltlibraries_qdisc) -else --noinst_LTLIBRARIES += \ +-check_LTLIBRARIES += \ - $(lib_cli_ltlibraries_cls) \ - $(lib_cli_ltlibraries_qdisc) + endif lib_cli_ldflags = \ -@@ -550,13 +546,8 @@ lib_cli_qdisc_plug_la_LDFLAGS = $(lib_cli_ldflags) +@@ -565,9 +561,6 @@ src_lib_ldflags = - ############################################################################### - --src_lib_ldflags = -- if ENABLE_CLI lib_LTLIBRARIES += src/lib/libnl-cli-3.la -src_lib_ldflags += -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @@ -79,7 +73,7 @@ index 1b95a559304f..279548394650 100644 endif src_lib_libnl_cli_3_la_SOURCES = \ -@@ -583,7 +574,7 @@ src_lib_libnl_cli_3_la_CPPFLAGS = \ +@@ -594,7 +587,7 @@ src_lib_libnl_cli_3_la_CPPFLAGS = \ -I$(srcdir)/include \ -I$(builddir)/include src_lib_libnl_cli_3_la_LDFLAGS = \ @@ -88,7 +82,7 @@ index 1b95a559304f..279548394650 100644 -Wl,--version-script=$(srcdir)/libnl-cli-3.sym src_lib_libnl_cli_3_la_LIBADD = \ lib/libnl-3.la \ -@@ -668,8 +659,6 @@ else +@@ -679,8 +672,6 @@ else noinst_PROGRAMS += $(cli_programs) endif endif @@ -97,7 +91,7 @@ index 1b95a559304f..279548394650 100644 endif src_genl_ctrl_list_CPPFLAGS = $(src_cppflags) -@@ -847,10 +836,12 @@ tests_test_complex_HTB_with_hash_filters_LDADD = $(tests_ldadd) +@@ -858,10 +849,12 @@ tests_test_complex_HTB_with_hash_filters tests_test_u32_filter_with_actions_CPPFLAGS = $(tests_cppflags) tests_test_u32_filter_with_actions_LDADD = $(tests_ldadd) @@ -110,6 +104,3 @@ index 1b95a559304f..279548394650 100644 tests_cli_ldadd = \ $(tests_ldadd) \ --- -2.11.0 - diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index e702d5c05..1c0fb8e69 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=1.8.1 +PKG_VERSION:=1.9.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \ http://www.tcpdump.org/release/ -PKG_HASH:=673dbc69fdc3f5a86fb5759ab19899039a8e5e6c631749e48dcd9c6f0c83541e +PKG_HASH:=2edb88808e5913fdaa8e9c1fcaf272e19b2485338742b5074b9fe44d68f37019 PKG_FIXUP:=patch-libtool PKG_MAINTAINER:=Felix Fietkau diff --git a/package/libs/libpcap/patches/001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch b/package/libs/libpcap/patches/001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch deleted file mode 100644 index edb6ae566..000000000 --- a/package/libs/libpcap/patches/001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 64aa033a061c43fc15c711f2490ae41d23b868c3 Mon Sep 17 00:00:00 2001 -From: Fabio Berton -Date: Thu, 17 Nov 2016 09:44:42 -0200 -Subject: [PATCH 1/2] Fix compiler_state_t.ai usage when INET6 is not defined -Organization: O.S. Systems Software LTDA. - -Fix error: - -/ -| ../libpcap-1.8.1/gencode.c: In function 'pcap_compile': -| ../libpcap-1.8.1/gencode.c:693:8: error: 'compiler_state_t -| {aka struct _compiler_state}' has no member named 'ai' -| cstate.ai = NULL; -\ - -Upstream-Status: Submitted [1] - -[1] https://github.com/the-tcpdump-group/libpcap/pull/541 - -Signed-off-by: Fabio Berton ---- - gencode.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/gencode.c b/gencode.c -index a887f27..e103c70 100644 ---- a/gencode.c -+++ b/gencode.c -@@ -690,7 +690,9 @@ pcap_compile(pcap_t *p, struct bpf_program *program, - } - initchunks(&cstate); - cstate.no_optimize = 0; -+#ifdef INET6 - cstate.ai = NULL; -+#endif - cstate.ic.root = NULL; - cstate.ic.cur_mark = 0; - cstate.bpf_pcap = p; --- -2.1.4 - diff --git a/package/libs/libpcap/patches/002-Add-missing-compiler_state_t-parameter.patch b/package/libs/libpcap/patches/002-Add-missing-compiler_state_t-parameter.patch deleted file mode 100644 index 032b265f0..000000000 --- a/package/libs/libpcap/patches/002-Add-missing-compiler_state_t-parameter.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 50ec0a088d5924a8305b2d70dcba71b0942dee1a Mon Sep 17 00:00:00 2001 -From: Fabio Berton -Date: Thu, 17 Nov 2016 09:47:29 -0200 -Subject: [PATCH 2/2] Add missing compiler_state_t parameter -Organization: O.S. Systems Software LTDA. - -Fix error: - -/ -|../libpcap-1.8.1/gencode.c: In function 'gen_gateway': -|../libpcap-1.8.1/gencode.c:4914:13: error: 'cstate' undeclared -| (first use in this function) -| bpf_error(cstate, "direction applied to 'gateway'"); -\ - -Upstream-Status: Submitted [1] - -[1] https://github.com/the-tcpdump-group/libpcap/pull/541 - -Signed-off-by: Fabio Berton ---- - gencode.c | 15 ++++++++------- - 1 file changed, 8 insertions(+), 7 deletions(-) - -diff --git a/gencode.c b/gencode.c -index e103c70..f07c0be 100644 ---- a/gencode.c -+++ b/gencode.c -@@ -523,7 +523,7 @@ static struct block *gen_host6(compiler_state_t *, struct in6_addr *, - struct in6_addr *, int, int, int); - #endif - #ifndef INET6 --static struct block *gen_gateway(const u_char *, bpf_u_int32 **, int, int); -+static struct block *gen_gateway(compiler_state_t *, const u_char *, bpf_u_int32 **, int, int); - #endif - static struct block *gen_ipfrag(compiler_state_t *); - static struct block *gen_portatom(compiler_state_t *, int, bpf_int32); -@@ -4904,11 +4904,12 @@ gen_host6(compiler_state_t *cstate, struct in6_addr *addr, - - #ifndef INET6 - static struct block * --gen_gateway(eaddr, alist, proto, dir) -- const u_char *eaddr; -- bpf_u_int32 **alist; -- int proto; -- int dir; -+gen_gateway(cstate, eaddr, alist, proto, dir) -+ compiler_state_t *cstate; -+ const u_char *eaddr; -+ bpf_u_int32 **alist; -+ int proto; -+ int dir; - { - struct block *b0, *b1, *tmp; - -@@ -6472,7 +6473,7 @@ gen_scode(compiler_state_t *cstate, const char *name, struct qual q) - alist = pcap_nametoaddr(name); - if (alist == NULL || *alist == NULL) - bpf_error(cstate, "unknown host '%s'", name); -- b = gen_gateway(eaddr, alist, proto, dir); -+ b = gen_gateway(cstate, eaddr, alist, proto, dir); - free(eaddr); - return b; - #else --- -2.1.4 - diff --git a/package/libs/libpcap/patches/100-debian_shared_lib.patch b/package/libs/libpcap/patches/100-debian_shared_lib.patch index 59d15e660..9eb38dde7 100644 --- a/package/libs/libpcap/patches/100-debian_shared_lib.patch +++ b/package/libs/libpcap/patches/100-debian_shared_lib.patch @@ -3,7 +3,7 @@ build a shared library. --- a/Makefile.in +++ b/Makefile.in -@@ -38,6 +38,13 @@ mandir = @mandir@ +@@ -40,6 +40,13 @@ mandir = @mandir@ srcdir = @srcdir@ VPATH = @srcdir@ @@ -17,17 +17,17 @@ build a shared library. # # You shouldn't need to edit anything below. # -@@ -62,7 +69,8 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ - PROG=libpcap +@@ -69,7 +76,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@ + EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@ - # Standard CFLAGS --FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) -+FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS) + # Standard CFLAGS for building members of a shared library +-FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) ++FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS) +CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -77,7 +85,11 @@ YACC = @YACC@ +@@ -84,7 +92,11 @@ YACC = @YACC@ # problem if you don't own the file but can write to the directory. .c.o: @rm -f $@ @@ -38,9 +38,9 @@ build a shared library. + @rm -f $@ + $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c - PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ + PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@ FSRC = @V_FINDALLDEVS@ -@@ -93,6 +105,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( +@@ -101,6 +113,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot # hack the extra indirection OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) @@ -48,16 +48,16 @@ build a shared library. PUBHDR = \ pcap.h \ pcap-bpf.h \ -@@ -157,7 +170,7 @@ TAGFILES = \ +@@ -154,7 +167,7 @@ TAGFILES = \ - CLEANFILES = $(OBJ) libpcap.* $(TESTS) \ + CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \ $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \ -- lex.yy.c pcap-config -+ lex.yy.c pcap-config $(OBJ_PIC) +- lex.yy.c pcap-config libpcap.pc ++ lex.yy.c pcap-config libpcap.pc $(OBJ_PIC) MAN1 = pcap-config.1 -@@ -365,7 +378,7 @@ libpcap.a: $(OBJ) +@@ -386,7 +399,7 @@ libpcap.a: $(OBJ) $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS) $(RANLIB) $@ @@ -66,7 +66,7 @@ build a shared library. libpcap.so: $(OBJ) @rm -f $@ -@@ -443,6 +456,12 @@ libpcap.shareda: $(OBJ) +@@ -462,6 +475,12 @@ libpcap.shareda: $(OBJ) # libpcap.none: @@ -79,44 +79,37 @@ build a shared library. scanner.c: $(srcdir)/scanner.l $(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $< scanner.h: scanner.c -@@ -455,6 +474,9 @@ scanner.h: scanner.c +@@ -474,6 +493,9 @@ scanner.h: scanner.c scanner.o: scanner.c grammar.h $(CC) $(FULL_CFLAGS) -c scanner.c +scanner_pic.o: scanner.c grammar.h + $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c + - pcap.o: pcap_version.h - grammar.c: $(srcdir)/grammar.y -@@ -472,9 +494,16 @@ grammar.o: grammar.c + $(YACC) -p pcap_ -o grammar.c -d $< + grammar.h: grammar.c +@@ -486,6 +508,9 @@ grammar.h: grammar.c + grammar.o: grammar.c scanner.h + $(CC) $(FULL_CFLAGS) -c grammar.c + ++grammar_pic.o: grammar.c scanner.h ++ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c grammar.c ++ gencode.o: $(srcdir)/gencode.c grammar.h scanner.h $(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c -+grammar_pic.o: grammar.c -+ @rm -f $@ -+ $(CC) -fPIC $(FULL_CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c -+ - version.o: version.c - $(CC) $(FULL_CFLAGS) -c version.c - -+version_pic.o: version.c -+ $(CC) -fPIC $(FULL_CFLAGS) -c version.c -o $@ -+ - snprintf.o: $(srcdir)/missing/snprintf.c - $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c - -@@ -501,6 +530,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt - bpf_filter.o: bpf_filter.c - $(CC) $(FULL_CFLAGS) -c bpf_filter.c +@@ -524,6 +549,9 @@ pcap-config: $(srcdir)/pcap-config.in ./ + mv $@.tmp $@ + chmod a+x $@ +bpf_filter_pic.o: bpf_filter.c + $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@ + # - # Generate the pcap-config script. + # Remote pcap daemon. # -@@ -623,14 +655,11 @@ install: install-shared install-archive +@@ -614,14 +642,11 @@ install: install-shared install-archive $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done install-shared: install-shared-$(DYEXT) @@ -136,27 +129,27 @@ build a shared library. (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -470,7 +470,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, +@@ -507,7 +507,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, esac ;; esac -- V_CCOPT="$V_CCOPT $PIC_OPT" -+ V_CCOPT="$V_CCOPT" +- V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT" ++ V_SHLIB_CCOPT="$V_SHLIB_CCOPT" V_SONAME_OPT="-Wl,-soname," V_RPATH_OPT="-Wl,-rpath," ;; -@@ -533,7 +533,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, +@@ -570,7 +570,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, # # "cc" is GCC. # -- V_CCOPT="$V_CCOPT -fpic" -+ V_CCOPT="$V_CCOPT" +- V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic" ++ V_SHLIB_CCOPT="$V_SHLIB_CCOPT" V_SHLIB_CMD="\$(CC)" V_SHLIB_OPT="-shared" V_SONAME_OPT="-Wl,-soname," --- a/pcap-config.in +++ b/pcap-config.in -@@ -36,16 +36,6 @@ do +@@ -41,16 +41,6 @@ do esac shift done diff --git a/package/libs/libpcap/patches/102-makefile_disable_manpages.patch b/package/libs/libpcap/patches/102-makefile_disable_manpages.patch index c2326b95b..60850df80 100644 --- a/package/libs/libpcap/patches/102-makefile_disable_manpages.patch +++ b/package/libs/libpcap/patches/102-makefile_disable_manpages.patch @@ -1,6 +1,6 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -589,70 +589,12 @@ install: install-shared install-archive +@@ -573,14 +573,6 @@ install: install-shared install-archive (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) [ -d $(DESTDIR)$(includedir)/pcap ] || \ (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap) @@ -15,9 +15,10 @@ for i in $(PUBHDR); do \ $(INSTALL_DATA) $(srcdir)/$$i \ $(DESTDIR)$(includedir)/$$i; done - [ -d $(DESTDIR)$(bindir) ] || \ - (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir)) - $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config +@@ -590,56 +582,6 @@ install: install-shared install-archive + [ -d $(DESTDIR)$(libdir)/pkgconfig ] || \ + (mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig) + $(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc - for i in $(MAN1); do \ - $(INSTALL_DATA) $(srcdir)/$$i \ - $(DESTDIR)$(mandir)/man1/$$i; done diff --git a/package/libs/libpcap/patches/103-makefile_flex_workaround.patch b/package/libs/libpcap/patches/103-makefile_flex_workaround.patch index 5eb6d3fd4..93e07c69c 100644 --- a/package/libs/libpcap/patches/103-makefile_flex_workaround.patch +++ b/package/libs/libpcap/patches/103-makefile_flex_workaround.patch @@ -3,12 +3,12 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -56,7 +56,7 @@ LN_S = @LN_S@ - MKDEP = @MKDEP@ +@@ -59,7 +59,7 @@ MKDEP = @MKDEP@ CCOPT = @V_CCOPT@ + SHLIB_CCOPT = @V_SHLIB_CCOPT@ INCLS = -I. @V_INCLS@ --DEFS = -DBUILDING_PCAP @DEFS@ @V_DEFS@ -+DEFS = -DBUILDING_PCAP -D_BSD_SOURCE @DEFS@ @V_DEFS@ +-DEFS = -DBUILDING_PCAP -Dpcap_EXPORTS @DEFS@ @V_DEFS@ ++DEFS = -DBUILDING_PCAP -D_BSD_SOURCE -Dpcap_EXPORTS @DEFS@ @V_DEFS@ ADDLOBJS = @ADDLOBJS@ ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@ LIBS = @LIBS@ diff --git a/package/libs/libpcap/patches/201-space_optimization.patch b/package/libs/libpcap/patches/201-space_optimization.patch index b0a91bb0e..4bec6148f 100644 --- a/package/libs/libpcap/patches/201-space_optimization.patch +++ b/package/libs/libpcap/patches/201-space_optimization.patch @@ -1,6 +1,6 @@ --- a/pcap-common.c +++ b/pcap-common.c -@@ -1447,14 +1447,23 @@ swap_pseudo_headers(int linktype, struct +@@ -1524,14 +1524,23 @@ swap_pseudo_headers(int linktype, struct break; case DLT_USB_LINUX: diff --git a/package/libs/libpcap/patches/202-protocol_api.patch b/package/libs/libpcap/patches/202-protocol_api.patch deleted file mode 100644 index 711dc5ce9..000000000 --- a/package/libs/libpcap/patches/202-protocol_api.patch +++ /dev/null @@ -1,142 +0,0 @@ -This API extension is used by ead (Emergency Access Daemon) - ---- a/pcap-linux.c -+++ b/pcap-linux.c -@@ -425,7 +425,7 @@ static int iface_get_id(int fd, const ch - static int iface_get_mtu(int fd, const char *device, char *ebuf); - static int iface_get_arptype(int fd, const char *device, char *ebuf); - #ifdef HAVE_PF_PACKET_SOCKETS --static int iface_bind(int fd, int ifindex, char *ebuf); -+static int iface_bind(int fd, int ifindex, char *ebuf, unsigned short proto); - #ifdef IW_MODE_MONITOR - static int has_wext(int sock_fd, const char *device, char *ebuf); - #endif /* IW_MODE_MONITOR */ -@@ -1059,7 +1059,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle) - * (We assume that if we have Wireless Extensions support - * we also have PF_PACKET support.) - */ -- sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); -+ sock_fd = socket(PF_PACKET, SOCK_RAW, p->opt.proto); - if (sock_fd == -1) { - (void)pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "socket: %s", pcap_strerror(errno)); -@@ -1456,6 +1456,9 @@ pcap_activate_linux(pcap_t *handle) - handle->read_op = pcap_read_linux; - handle->stats_op = pcap_stats_linux; - -+ if (handle->opt.proto < 0) -+ handle->opt.proto = (int) htons(ETH_P_ALL); -+ - /* - * The "any" device is a special device which causes us not - * to bind to a particular device and thus to look at all -@@ -3335,8 +3338,8 @@ activate_new(pcap_t *handle) - * try a SOCK_RAW socket for the raw interface. - */ - sock_fd = is_any_device ? -- socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) : -- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); -+ socket(PF_PACKET, SOCK_DGRAM, handle->opt.proto) : -+ socket(PF_PACKET, SOCK_RAW, handle->opt.proto); - - if (sock_fd == -1) { - if (errno == EINVAL || errno == EAFNOSUPPORT) { -@@ -3454,7 +3457,7 @@ activate_new(pcap_t *handle) - return PCAP_ERROR; - } - sock_fd = socket(PF_PACKET, SOCK_DGRAM, -- htons(ETH_P_ALL)); -+ handle->opt.proto); - if (sock_fd == -1) { - pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "socket: %s", pcap_strerror(errno)); -@@ -3518,7 +3521,7 @@ activate_new(pcap_t *handle) - } - - if ((err = iface_bind(sock_fd, handlep->ifindex, -- handle->errbuf)) != 1) { -+ handle->errbuf, handle->opt.proto)) != 1) { - close(sock_fd); - if (err < 0) - return err; -@@ -5271,7 +5274,7 @@ iface_get_id(int fd, const char *device, - * or a PCAP_ERROR_ value on a hard error. - */ - static int --iface_bind(int fd, int ifindex, char *ebuf) -+iface_bind(int fd, int ifindex, char *ebuf, unsigned short proto) - { - struct sockaddr_ll sll; - int err; -@@ -5280,7 +5283,7 @@ iface_bind(int fd, int ifindex, char *eb - memset(&sll, 0, sizeof(sll)); - sll.sll_family = AF_PACKET; - sll.sll_ifindex = ifindex; -- sll.sll_protocol = htons(ETH_P_ALL); -+ sll.sll_protocol = proto; - - if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) { - if (errno == ENETDOWN) { -@@ -6325,7 +6328,7 @@ activate_old(pcap_t *handle) - - /* Open the socket */ - -- handle->fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL)); -+ handle->fd = socket(PF_INET, SOCK_PACKET, handle->opt.proto); - if (handle->fd == -1) { - pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "socket: %s", pcap_strerror(errno)); ---- a/pcap.c -+++ b/pcap.c -@@ -578,6 +578,7 @@ pcap_create_common(char *ebuf, size_t si - p->opt.promisc = 0; - p->opt.rfmon = 0; - p->opt.immediate = 0; -+ p->opt.proto = -1; - p->opt.tstamp_type = -1; /* default to not setting time stamp type */ - p->opt.tstamp_precision = PCAP_TSTAMP_PRECISION_MICRO; - -@@ -771,6 +772,15 @@ pcap_get_tstamp_precision(pcap_t *p) - } - - int -+pcap_set_protocol(pcap_t *p, unsigned short proto) -+{ -+ if (pcap_check_activated(p)) -+ return PCAP_ERROR_ACTIVATED; -+ p->opt.proto = proto; -+ return 0; -+} -+ -+int - pcap_activate(pcap_t *p) - { - int status; ---- a/pcap/pcap.h -+++ b/pcap/pcap.h -@@ -68,6 +68,7 @@ extern "C" { - #define PCAP_VERSION_MINOR 4 - - #define PCAP_ERRBUF_SIZE 256 -+#define HAS_PROTO_EXTENSION - - /* - * Compatibility for systems that have a bpf.h that -@@ -287,6 +288,7 @@ PCAP_API int pcap_set_timeout(pcap_t *, - PCAP_API int pcap_set_tstamp_type(pcap_t *, int); - PCAP_API int pcap_set_immediate_mode(pcap_t *, int); - PCAP_API int pcap_set_buffer_size(pcap_t *, int); -+PCAP_API int pcap_set_protocol(pcap_t *, unsigned short); - PCAP_API int pcap_set_tstamp_precision(pcap_t *, int); - PCAP_API int pcap_get_tstamp_precision(pcap_t *); - PCAP_API int pcap_activate(pcap_t *); ---- a/pcap-int.h -+++ b/pcap-int.h -@@ -111,6 +111,7 @@ struct pcap_opt { - char *device; - int timeout; /* timeout for buffering */ - u_int buffer_size; -+ int proto; /* protocol for packet socket (linux) */ - int promisc; - int rfmon; /* monitor mode */ - int immediate; /* immediate mode - deliver packets as soon as they arrive */ diff --git a/package/libs/libpcap/patches/204-usb-bus-path.patch b/package/libs/libpcap/patches/204-usb-bus-path.patch index d29734f0b..48a807e1f 100644 --- a/package/libs/libpcap/patches/204-usb-bus-path.patch +++ b/package/libs/libpcap/patches/204-usb-bus-path.patch @@ -2,7 +2,7 @@ Fix USB bus path; /proc/bus/usb is deprecated. --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c -@@ -71,7 +71,7 @@ +@@ -72,7 +72,7 @@ #define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon" #define USB_TEXT_DIR "/sys/kernel/debug/usb/usbmon" #define SYS_USB_BUS_DIR "/sys/bus/usb/devices" diff --git a/package/libs/librpc/Makefile b/package/libs/librpc/Makefile index e8f51a23f..d894dd3bd 100644 --- a/package/libs/librpc/Makefile +++ b/package/libs/librpc/Makefile @@ -10,6 +10,7 @@ PKG_SOURCE_VERSION:=a921e3ded051746f9f7cd5e5a312fb6771716aac PKG_MIRROR_HASH:=22c8dc55e1c4e8e31635a37708a3ce622a6ca33ebd918a4321b0be6ffce89b21 CMAKE_INSTALL:=1 PKG_USE_MIPS16:=0 +PKG_BUILD_DEPENDS:=librpc/host PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= @@ -17,6 +18,7 @@ PKG_LICENSE_FILES:= PKG_MAINTAINER:=Felix Fietkau include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk define Package/librpc @@ -30,4 +32,11 @@ define Package/librpc/install $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/librpc.so $(1)/lib/ endef +define Host/Install + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/include/rpc + $(INSTALL_DATA) $(HOST_BUILD_DIR)/rpc/types.h $(STAGING_DIR_HOSTPKG)/include/rpc + $(INSTALL_DATA) $(HOST_BUILD_DIR)/rpc/compat.h $(STAGING_DIR_HOSTPKG)/include/rpc +endef + +$(eval $(call HostBuild)) $(eval $(call BuildPackage,librpc)) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 5a8102a61..a0e75f936 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libubox -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git @@ -16,6 +16,8 @@ PKG_LICENSE_FILES:= PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_DEPENDS:=lua +HOST_BUILD_DEPENDS:=libjson-c/host +HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST) include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk @@ -95,6 +97,9 @@ endef CMAKE_HOST_OPTIONS += \ -DBUILD_LUA=OFF \ -DBUILD_EXAMPLES=OFF \ + -DCMAKE_SKIP_RPATH=FALSE \ + -DCMAKE_MACOSX_RPATH=1 \ + -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \ $(eval $(call BuildPackage,libubox)) $(eval $(call BuildPackage,libblobmsg-json)) diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 4556ad80b..659bf59d8 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -64,9 +64,9 @@ endef PKG_INSTALL:=1 TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) CMAKE_OPTIONS += \ - -DCMAKE_BUILD_TYPE:String="Release" \ -DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \ -DENABLE_TESTING:Bool=OFF \ -DENABLE_PROGRAMS:Bool=ON diff --git a/package/libs/mbedtls/patches/200-config.patch b/package/libs/mbedtls/patches/200-config.patch index ab16d4726..bfadb8d3d 100644 --- a/package/libs/mbedtls/patches/200-config.patch +++ b/package/libs/mbedtls/patches/200-config.patch @@ -46,15 +46,6 @@ /** * \def MBEDTLS_ECP_NIST_OPTIM -@@ -682,7 +682,7 @@ - * - * Comment this macro to disable deterministic ECDSA. - */ --#define MBEDTLS_ECDSA_DETERMINISTIC -+//#define MBEDTLS_ECDSA_DETERMINISTIC - - /** - * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED @@ -735,7 +735,7 @@ * See dhm.h for more details. * @@ -126,15 +117,6 @@ /** * \def MBEDTLS_SHA256_SMALLER -@@ -1160,7 +1160,7 @@ - * - * Uncomment to enable the smaller implementation of SHA256. - */ --//#define MBEDTLS_SHA256_SMALLER -+#define MBEDTLS_SHA256_SMALLER - - /** - * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES @@ -1298,7 +1298,7 @@ * configuration of this extension). * @@ -198,24 +180,6 @@ /** * \def MBEDTLS_CHACHA20_C -@@ -1979,7 +1979,7 @@ - * - * Module: library/chacha20.c - */ --#define MBEDTLS_CHACHA20_C -+//#define MBEDTLS_CHACHA20_C - - /** - * \def MBEDTLS_CHACHAPOLY_C -@@ -1990,7 +1990,7 @@ - * - * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C - */ --#define MBEDTLS_CHACHAPOLY_C -+//#define MBEDTLS_CHACHAPOLY_C - - /** - * \def MBEDTLS_CIPHER_C @@ -2043,7 +2043,7 @@ * * This module provides debugging functions. @@ -243,15 +207,6 @@ /** * \def MBEDTLS_HMAC_DRBG_C -@@ -2249,7 +2249,7 @@ - * - * Uncomment to enable the HMAC_DRBG random number geerator. - */ --#define MBEDTLS_HMAC_DRBG_C -+//#define MBEDTLS_HMAC_DRBG_C - - /** - * \def MBEDTLS_NIST_KW_C @@ -2545,7 +2545,7 @@ * * This module enables abstraction of common (libc) functions. @@ -261,15 +216,6 @@ /** * \def MBEDTLS_POLY1305_C -@@ -2555,7 +2555,7 @@ - * Module: library/poly1305.c - * Caller: library/chachapoly.c - */ --#define MBEDTLS_POLY1305_C -+//#define MBEDTLS_POLY1305_C - - /** - * \def MBEDTLS_RIPEMD160_C @@ -2566,7 +2566,7 @@ * Caller: library/md.c * diff --git a/package/libs/mbedtls/patches/300-soversion-compatibility.patch b/package/libs/mbedtls/patches/300-soversion-compatibility.patch deleted file mode 100644 index a352b449f..000000000 --- a/package/libs/mbedtls/patches/300-soversion-compatibility.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -159,7 +159,7 @@ endif(USE_STATIC_MBEDTLS_LIBRARY) - - if(USE_SHARED_MBEDTLS_LIBRARY) - add_library(mbedcrypto SHARED ${src_crypto}) -- set_target_properties(mbedcrypto PROPERTIES VERSION 2.12.0 SOVERSION 3) -+ set_target_properties(mbedcrypto PROPERTIES VERSION 2.12.0 SOVERSION 1) - target_link_libraries(mbedcrypto ${libs}) - - add_library(mbedx509 SHARED ${src_x509}) -@@ -167,7 +167,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY) - target_link_libraries(mbedx509 ${libs} mbedcrypto) - - add_library(mbedtls SHARED ${src_tls}) -- set_target_properties(mbedtls PROPERTIES VERSION 2.12.0 SOVERSION 11) -+ set_target_properties(mbedtls PROPERTIES VERSION 2.12.0 SOVERSION 10) - target_link_libraries(mbedtls ${libs} mbedx509) - - install(TARGETS mbedtls mbedx509 mbedcrypto ---- a/library/Makefile -+++ b/library/Makefile -@@ -35,9 +35,9 @@ LOCAL_CFLAGS += -fPIC -fpic - endif - endif - --SOEXT_TLS=so.11 -+SOEXT_TLS=so.10 - SOEXT_X509=so.0 --SOEXT_CRYPTO=so.3 -+SOEXT_CRYPTO=so.1 - - # Set AR_DASH= (empty string) to use an ar implentation that does not accept - # the - prefix for command line options (e.g. llvm-ar) diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index 95f05fa71..94c968816 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -164,6 +164,8 @@ endef define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/progs/tic $(STAGING_DIR_HOST)/bin/tic + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/ + $(INSTALL_DATA) $(HOST_BUILD_DIR)/lib/libncurses.a $(STAGING_DIR_HOSTPKG)/lib/ endef $(eval $(call HostBuild)) diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile index 172b5b256..67889d079 100644 --- a/package/libs/nettle/Makefile +++ b/package/libs/nettle/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nettle -PKG_VERSION:=3.3 +PKG_VERSION:=3.4 PKG_RELEASE:=1 PKG_USE_MIPS16:=0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/nettle -PKG_HASH:=46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e +PKG_HASH:=ae7a42df026550b85daca8389b6a60ba6313b0567f374392e54918588a411e94 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/nghttp2/Makefile b/package/libs/nghttp2/Makefile index 8201e59f2..f72b29888 100644 --- a/package/libs/nghttp2/Makefile +++ b/package/libs/nghttp2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nghttp2 -PKG_VERSION:=1.32.0 +PKG_VERSION:=1.33.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/nghttp2/nghttp2/releases/download/v$(PKG_VERSION) -PKG_HASH:=700a89d59fcc55acc2b18184001bfb3220fa6a6e543486aca35f40801cba6f7d +PKG_HASH:=4879ce9ff3320f5344b910ee1c46ed5e366edc2272620cf17d8e762724d7df1e PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/popt/Makefile b/package/libs/popt/Makefile index 7bd765f7d..8e05e5cff 100644 --- a/package/libs/popt/Makefile +++ b/package/libs/popt/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=1.16 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://rpm5.org/files/popt/ +PKG_SOURCE_URL:=http://distfiles.gentoo.org/distfiles/ http://distcache.freebsd.org/ports-distfiles/ PKG_HASH:=e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8 PKG_LICENSE:=MIT diff --git a/package/libs/sysfsutils/Makefile b/package/libs/sysfsutils/Makefile index 6265442ea..60275ec34 100644 --- a/package/libs/sysfsutils/Makefile +++ b/package/libs/sysfsutils/Makefile @@ -65,9 +65,21 @@ define Package/libsysfs/install endef define Package/sysfsutils/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sysfsutils $(1)/etc/init.d/ + + $(INSTALL_DATA) ./files/sysfs.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/sysfs.d + $(INSTALL_DATA) ./files/local.conf $(1)/etc/sysfs.d/ + $(INSTALL_DIR) $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/bin/systool $(1)/usr/bin/ endef +define Package/sysfsutils/conffiles +/etc/sysfs.conf +/etc/sysfs.d/local.conf +endef + $(eval $(call BuildPackage,libsysfs)) $(eval $(call BuildPackage,sysfsutils)) diff --git a/package/libs/sysfsutils/files/local.conf b/package/libs/sysfsutils/files/local.conf new file mode 100644 index 000000000..891da73df --- /dev/null +++ b/package/libs/sysfsutils/files/local.conf @@ -0,0 +1 @@ +# local sysctl settings can be stored in this directory diff --git a/package/libs/sysfsutils/files/sysfs.conf b/package/libs/sysfsutils/files/sysfs.conf new file mode 100644 index 000000000..f03246284 --- /dev/null +++ b/package/libs/sysfsutils/files/sysfs.conf @@ -0,0 +1,22 @@ +# +# /etc/sysfs.conf - Configuration file for setting sysfs attributes. +# +# The sysfs mount directory is automatically prepended to the attribute paths. +# +# Syntax: +# attribute = value +# mode attribute = 0600 # (any valid argument for chmod) +# owner attribute = root:wheel # (any valid argument for chown) +# +# Examples: +# +# Always use the powersave CPU frequency governor +# devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave +# +# Use userspace CPU frequency governor and set initial speed +# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace +# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000 +# +# Set permissions of suspend control file +# mode power/state = 0660 +# owner power/state = root:power diff --git a/package/libs/sysfsutils/files/sysfsutils b/package/libs/sysfsutils/files/sysfsutils new file mode 100644 index 000000000..0305ca82a --- /dev/null +++ b/package/libs/sysfsutils/files/sysfsutils @@ -0,0 +1,48 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2017 Rodolfo Giometti +# +# Based on Debian's script /etc/init.d/sysfsutils by +# Martin Pitt + +load_conffile() { + FILE="$1" + sed 's/#.*$//; /^[[:space:]]*$/d; + s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/' \ + $FILE | { + while read f1 f2 f3; do + if [ "$f1" = "mode" -a -n "$f2" -a -n "$f3" ]; then + if [ -f "/sys/$f2" ] || [ -d "/sys/$f2" ]; then + chmod "$f3" "/sys/$f2" + else + echo "unknown attribute $f2" + fi + elif [ "$f1" = "owner" -a -n "$f2" -a -n "$f3" ]; then + if [ -f "/sys/$f2" ]; then + chown "$f3" "/sys/$f2" + else + echo "unknown attribute $f2" + fi + elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then + if [ -f "/sys/$f1" ]; then + # Some fields need a terminating newline, others + # need the terminating newline to be absent :-( + echo -n "$f2" > "/sys/$f1" 2>/dev/null || + echo "$f2" > "/sys/$f1" + else + echo "unknown attribute $f1" + fi + else + echo "syntax error in $CONFFILE: '$f1' '$f2' '$f3'" + exit 1 + fi + done + } +} + +START=11 +start() { + for file in /etc/sysfs.conf /etc/sysfs.d/*.conf; do + [ -r "$file" ] || continue + load_conffile "$file" + done +} diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index 055a7c969..2ea5bf0bd 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git -PKG_SOURCE_DATE:=2018-05-22 -PKG_SOURCE_VERSION:=5322f9db23b69fdc2b4760a6cfd67848a11818a4 -PKG_MIRROR_HASH:=c943f6e603b1309b33fd276acddffb33a171b6370455b6c21200897012e42d05 +PKG_SOURCE_DATE:=2018-07-30 +PKG_SOURCE_VERSION:=23a3f2830341acd1db149175baf7315a33bd0edb +PKG_MIRROR_HASH:=289bef5dac684015b6a40cfd72cf1c8c297bb77cf2efd54e562b628ba3afd83d CMAKE_INSTALL:=1 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) diff --git a/package/libs/wolfssl/Config.in b/package/libs/wolfssl/Config.in index 9b8891451..50b0bb9cd 100644 --- a/package/libs/wolfssl/Config.in +++ b/package/libs/wolfssl/Config.in @@ -2,11 +2,11 @@ if PACKAGE_libwolfssl config WOLFSSL_HAS_AES_CCM bool "Include AES-CCM support" - default n + default y config WOLFSSL_HAS_AES_GCM bool "Include AES-GCM support" - default n + default y config WOLFSSL_HAS_CHACHA bool "Include ChaCha cipher suite support" @@ -18,23 +18,23 @@ config WOLFSSL_HAS_ECC config WOLFSSL_HAS_DH bool "Include DH (Diffie-Hellman) support" - default n + default y config WOLFSSL_HAS_ARC4 bool "Include ARC4 support" - default n + default y config WOLFSSL_HAS_DES3 bool "Include DES3 (Tripple-DES) support" - default n + default y config WOLFSSL_HAS_PSK bool "Include PKS (Pre Share Key) support" - default n + default y config WOLFSSL_HAS_SESSION_TICKET bool "Include session ticket support" - default n + default y config WOLFSSL_HAS_DTLS bool "Include DTLS support" @@ -42,11 +42,11 @@ config WOLFSSL_HAS_DTLS config WOLFSSL_HAS_OCSP bool "Include OSCP support" - default n + default y config WOLFSSL_HAS_WPAS bool "Include wpa_supplicant support" - default n + default y config WOLFSSL_HAS_ECC25519 bool "Include ECC Curve 22519 support" diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index d0bd3b5a3..87ce9328e 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=3.12.2 -PKG_RELEASE:=2 +PKG_VERSION:=3.14.4 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip -PKG_SOURCE_URL:=https://www.wolfssl.com/ -PKG_HASH:=4993844c4b7919007c4511ec3f987fb06543536c3fc933cb53491bffe9150e49 +# PKG_SOURCE_URL:=https://www.wolfssl.com/ +PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) +PKG_HASH:=1da1b45dec4a455716c8547074ad883c737865225f69443bb173c0dc21683fd1 PKG_FIXUP:=libtool PKG_INSTALL:=1 @@ -22,6 +23,15 @@ PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0+ PKG_CPE_ID:=cpe:/a:yassl:cyassl +PKG_CONFIG_DEPENDS:=\ + CONFIG_WOLFSSL_HAS_AES_CCM CONFIG_WOLFSSL_HAS_AES_GCM \ + CONFIG_WOLFSSL_HAS_ARC4 CONFIG_WOLFSSL_HAS_CHACHA \ + CONFIG_WOLFSSL_HAS_DES3 CONFIG_WOLFSSL_HAS_DH CONFIG_WOLFSSL_HAS_DTLS \ + CONFIG_WOLFSSL_HAS_ECC CONFIG_WOLFSSL_HAS_ECC25519 \ + CONFIG_WOLFSSL_HAS_OCSP CONFIG_WOLFSSL_HAS_POLY_1305 \ + CONFIG_WOLFSSL_HAS_PSK CONFIG_WOLFSSL_HAS_SESSION_TICKET \ + CONFIG_WOLFSSL_HAS_WPAS + include $(INCLUDE_DIR)/package.mk define Package/libwolfssl @@ -30,7 +40,6 @@ define Package/libwolfssl CATEGORY:=Libraries TITLE:=wolfSSL library URL:=http://www.wolfssl.com/ - MAINTAINER:=Alexandru Ardelean MENU:=1 PROVIDES:=libcyassl endef diff --git a/package/libs/wolfssl/patches/001-CVE-2017-13099.patch b/package/libs/wolfssl/patches/001-CVE-2017-13099.patch deleted file mode 100644 index e7b63cb8d..000000000 --- a/package/libs/wolfssl/patches/001-CVE-2017-13099.patch +++ /dev/null @@ -1,144 +0,0 @@ -From fd455d5a5e9fef24c208e7ac7d3a4bc58834cbf1 Mon Sep 17 00:00:00 2001 -From: David Garske -Date: Tue, 14 Nov 2017 14:05:50 -0800 -Subject: [PATCH] Fix for handling of static RSA PKCS formatting failures so - they are indistinguishable from from correctly formatted RSA blocks (per - RFC5246 section 7.4.7.1). Adjusted the static RSA preMasterSecret RNG - creation for consistency in client case. Removed obsolete - `PMS_VERSION_ERROR`. - ---- - src/internal.c | 70 +++++++++++++++++++++++++++++++++++++++++++++-------- - wolfssl/error-ssl.h | 2 +- - 2 files changed, 61 insertions(+), 11 deletions(-) - ---- a/src/internal.c -+++ b/src/internal.c -@@ -14190,9 +14190,6 @@ const char* wolfSSL_ERR_reason_error_str - case NOT_READY_ERROR : - return "handshake layer not ready yet, complete first"; - -- case PMS_VERSION_ERROR : -- return "premaster secret version mismatch error"; -- - case VERSION_ERROR : - return "record layer version error"; - -@@ -18758,8 +18755,10 @@ int SendClientKeyExchange(WOLFSSL* ssl) - #ifndef NO_RSA - case rsa_kea: - { -+ /* build PreMasterSecret with RNG data */ - ret = wc_RNG_GenerateBlock(ssl->rng, -- ssl->arrays->preMasterSecret, SECRET_LEN); -+ &ssl->arrays->preMasterSecret[VERSION_SZ], -+ SECRET_LEN - VERSION_SZ); - if (ret != 0) { - goto exit_scke; - } -@@ -23545,6 +23544,9 @@ static int DoSessionTicket(WOLFSSL* ssl, - word32 idx; - word32 begin; - word32 sigSz; -+ #ifndef NO_RSA -+ int lastErr; -+ #endif - } DckeArgs; - - static void FreeDckeArgs(WOLFSSL* ssl, void* pArgs) -@@ -23770,6 +23772,14 @@ static int DoSessionTicket(WOLFSSL* ssl, - ERROR_OUT(BUFFER_ERROR, exit_dcke); - } - -+ /* pre-load PreMasterSecret with RNG data */ -+ ret = wc_RNG_GenerateBlock(ssl->rng, -+ &ssl->arrays->preMasterSecret[VERSION_SZ], -+ SECRET_LEN - VERSION_SZ); -+ if (ret != 0) { -+ goto exit_dcke; -+ } -+ - args->output = NULL; - break; - } /* rsa_kea */ -@@ -24234,6 +24244,20 @@ static int DoSessionTicket(WOLFSSL* ssl, - NULL, 0, NULL - #endif - ); -+ -+ /* Errors that can occur here that should be -+ * indistinguishable: -+ * RSA_BUFFER_E, RSA_PAD_E and RSA_PRIVATE_ERROR -+ */ -+ if (ret < 0 && ret != BAD_FUNC_ARG) { -+ #ifdef WOLFSSL_ASYNC_CRYPT -+ if (ret == WC_PENDING_E) -+ goto exit_dcke; -+ #endif -+ /* store error code for handling below */ -+ args->lastErr = ret; -+ ret = 0; -+ } - break; - } /* rsa_kea */ - #endif /* !NO_RSA */ -@@ -24380,16 +24404,42 @@ static int DoSessionTicket(WOLFSSL* ssl, - /* Add the signature length to idx */ - args->idx += args->length; - -- if (args->sigSz == SECRET_LEN && args->output != NULL) { -- XMEMCPY(ssl->arrays->preMasterSecret, args->output, SECRET_LEN); -- if (ssl->arrays->preMasterSecret[0] != ssl->chVersion.major || -- ssl->arrays->preMasterSecret[1] != ssl->chVersion.minor) { -- ERROR_OUT(PMS_VERSION_ERROR, exit_dcke); -+ #ifdef DEBUG_WOLFSSL -+ /* check version (debug warning message only) */ -+ if (args->output != NULL) { -+ if (args->output[0] != ssl->chVersion.major || -+ args->output[1] != ssl->chVersion.minor) { -+ WOLFSSL_MSG("preMasterSecret version mismatch"); - } - } -+ #endif -+ -+ /* RFC5246 7.4.7.1: -+ * Treat incorrectly formatted message blocks and/or -+ * mismatched version numbers in a manner -+ * indistinguishable from correctly formatted RSA blocks -+ */ -+ -+ ret = args->lastErr; -+ args->lastErr = 0; /* reset */ -+ -+ /* build PreMasterSecret */ -+ ssl->arrays->preMasterSecret[0] = ssl->chVersion.major; -+ ssl->arrays->preMasterSecret[1] = ssl->chVersion.minor; -+ if (ret == 0 && args->sigSz == SECRET_LEN && -+ args->output != NULL) { -+ XMEMCPY(&ssl->arrays->preMasterSecret[VERSION_SZ], -+ &args->output[VERSION_SZ], -+ SECRET_LEN - VERSION_SZ); -+ } - else { -- ERROR_OUT(RSA_PRIVATE_ERROR, exit_dcke); -+ /* preMasterSecret has RNG and version set */ -+ /* return proper length and ignore error */ -+ /* error will be caught as decryption error */ -+ args->sigSz = SECRET_LEN; -+ ret = 0; - } -+ - break; - } /* rsa_kea */ - #endif /* !NO_RSA */ ---- a/wolfssl/error-ssl.h -+++ b/wolfssl/error-ssl.h -@@ -57,7 +57,7 @@ enum wolfSSL_ErrorCodes { - DOMAIN_NAME_MISMATCH = -322, /* peer subject name mismatch */ - WANT_READ = -323, /* want read, call again */ - NOT_READY_ERROR = -324, /* handshake layer not ready */ -- PMS_VERSION_ERROR = -325, /* pre m secret version error */ -+ - VERSION_ERROR = -326, /* record layer version error */ - WANT_WRITE = -327, /* want write, call again */ - BUFFER_ERROR = -328, /* malformed buffer input */ diff --git a/package/libs/wolfssl/patches/100-disable-hardening-check.patch b/package/libs/wolfssl/patches/100-disable-hardening-check.patch index 83d51b1d5..d913b5fde 100644 --- a/package/libs/wolfssl/patches/100-disable-hardening-check.patch +++ b/package/libs/wolfssl/patches/100-disable-hardening-check.patch @@ -1,6 +1,6 @@ --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h -@@ -1553,7 +1553,7 @@ extern void uITRON4_free(void *p) ; +@@ -1624,7 +1624,7 @@ extern void uITRON4_free(void *p) ; #endif /* warning for not using harden build options (default with ./configure) */ diff --git a/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch b/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch new file mode 100644 index 000000000..f7756b11c --- /dev/null +++ b/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch @@ -0,0 +1,21 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -4140,7 +4140,6 @@ AC_CONFIG_FILES([support/wolfssl.pc]) + AC_CONFIG_FILES([rpm/spec]) + + AX_CREATE_GENERIC_CONFIG +-AX_AM_JOBSERVER([yes]) + + AC_OUTPUT + +--- a/Makefile.am ++++ b/Makefile.am +@@ -20,8 +20,6 @@ dist_noinst_SCRIPTS = + noinst_SCRIPTS = + check_SCRIPTS = + +-#includes additional rules from aminclude.am +-@INC_AMINCLUDE@ + DISTCLEANFILES+= aminclude.am + + CLEANFILES+= cert.der \ diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 010c5aa34..830a1b268 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git -PKG_SOURCE_DATE:=2018-07-26 -PKG_SOURCE_VERSION:=aa8846bb101054392b81f09bade120c021695892 -PKG_MIRROR_HASH:=cc2ff632744bdefbc64ad11dc18944b44af006c986367a28d6483ade6012effa +PKG_SOURCE_DATE:=2018-08-13 +PKG_SOURCE_VERSION:=1c4d5bcd1137e61e91dca858fe33d76d7a1dc821 +PKG_MIRROR_HASH:=49f939877a734056455556c90b959c407fd2c4988dc5d86f62a8122ebd7b8899 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control b/package/network/config/ltq-vdsl-app/files/dsl_control index a00d2bcdb..e62a5e558 100644 --- a/package/network/config/ltq-vdsl-app/files/dsl_control +++ b/package/network/config/ltq-vdsl-app/files/dsl_control @@ -252,7 +252,9 @@ start_service() { fi ;; b*|j*) - if [ -f "/lib/firmware/lantiq-vrx200-b.bin" ]; then + if [ -f "/lib/firmware/vr9_dsl_fw_annex_b.bin" ]; then + firmware="/lib/firmware/vr9_dsl_fw_annex_b.bin" + elif [ -f "/lib/firmware/lantiq-vrx200-b.bin" ]; then firmware="/lib/firmware/lantiq-vrx200-b.bin" elif [ -f "/tmp/lantiq-vrx200-b.bin" ]; then firmware="/tmp/lantiq-vrx200-b.bin" diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 33276a90d..a089f0c6e 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2018-07-30 -PKG_SOURCE_VERSION:=a0a1e52eb300b574098ae18fc7e6849ff50c2e5e -PKG_MIRROR_HASH:=f2a556e0de1e04d4e7b6ca30d3e7c65710659201fc81efb10420cd895d72a307 +PKG_SOURCE_DATE:=2018-08-20 +PKG_SOURCE_VERSION:=7454d121090f60428777c01f431031059acc96eb +PKG_MIRROR_HASH:=434f39ebc328bd172307e84dd532a8239f48fcae7e32ea4d456b4e24ddd739f3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 @@ -27,7 +27,10 @@ endef TARGET_CFLAGS += \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ - -I$(STAGING_DIR)/usr/include + -I$(STAGING_DIR)/usr/include \ + -flto + +TARGET_LDFLAGS += -flto -fuse-linker-plugin CMAKE_OPTIONS += \ -DLIBNL_LIBS=-lnl-tiny \ diff --git a/package/network/config/netifd/files/etc/hotplug.d/iface/00-netstate b/package/network/config/netifd/files/etc/hotplug.d/iface/00-netstate index 023025cd1..71ccb0191 100644 --- a/package/network/config/netifd/files/etc/hotplug.d/iface/00-netstate +++ b/package/network/config/netifd/files/etc/hotplug.d/iface/00-netstate @@ -1,7 +1,6 @@ [ ifup = "$ACTION" ] && { uci_toggle_state network "$INTERFACE" up 1 [ -n "$DEVICE" ] && { - uci_toggle_state network "$INTERFACE" device "$(uci -q get network.$INTERFACE.ifname)" uci_toggle_state network "$INTERFACE" ifname "$DEVICE" } } diff --git a/package/network/config/netifd/files/lib/network/config.sh b/package/network/config/netifd/files/lib/network/config.sh index 9128971da..0ded45edc 100755 --- a/package/network/config/netifd/files/lib/network/config.sh +++ b/package/network/config/netifd/files/lib/network/config.sh @@ -41,15 +41,12 @@ fixup_interface() { config_get type "$config" type config_get ifname "$config" ifname - config_get device "$config" device "$ifname" [ "bridge" = "$type" ] && ifname="br-$config" - config_set "$config" device "$ifname" ubus_call "network.interface.$config" status || return 0 json_get_var l3dev l3_device [ -n "$l3dev" ] && ifname="$l3dev" json_init config_set "$config" ifname "$ifname" - config_set "$config" device "$device" } scan_interfaces() { diff --git a/package/network/config/qos-scripts/files/usr/bin/qos-start b/package/network/config/qos-scripts/files/usr/bin/qos-start index 261ffb42b..68dae7063 100755 --- a/package/network/config/qos-scripts/files/usr/bin/qos-start +++ b/package/network/config/qos-scripts/files/usr/bin/qos-start @@ -1,4 +1,4 @@ #!/bin/sh + qos-stop /usr/lib/qos/generate.sh all | sh - diff --git a/package/network/config/qos-scripts/files/usr/bin/qos-stop b/package/network/config/qos-scripts/files/usr/bin/qos-stop index 7f654d858..ea3bba3ab 100755 --- a/package/network/config/qos-scripts/files/usr/bin/qos-stop +++ b/package/network/config/qos-scripts/files/usr/bin/qos-stop @@ -1,4 +1,5 @@ #!/bin/sh + for iface in $(tc qdisc show | grep -E '(hfsc|ingress)' | awk '{print $5}'); do tc qdisc del dev "$iface" ingress 2>&- >&- tc qdisc del dev "$iface" root 2>&- >&- diff --git a/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh b/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh index 48c9f4a9d..3ec7f80e5 100755 --- a/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh +++ b/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh @@ -118,21 +118,21 @@ parse_matching_rule() { append "$var" "-m comment --comment '$value'" ;; *:tos) - add_insmod xt_dscp - case "$value" in - !*) append "$var" "-m tos ! --tos $value";; - *) append "$var" "-m tos --tos $value" - esac - ;; - *:dscp) - add_insmod xt_dscp - dscp_option="--dscp" - [ -z "${value%%[EBCA]*}" ] && dscp_option="--dscp-class" + add_insmod xt_dscp case "$value" in - !*) append "$var" "-m dscp ! $dscp_option $value";; - *) append "$var" "-m dscp $dscp_option $value" - esac - ;; + !*) append "$var" "-m tos ! --tos $value";; + *) append "$var" "-m tos --tos $value" + esac + ;; + *:dscp) + add_insmod xt_dscp + dscp_option="--dscp" + [ -z "${value%%[EBCA]*}" ] && dscp_option="--dscp-class" + case "$value" in + !*) append "$var" "-m dscp ! $dscp_option $value";; + *) append "$var" "-m dscp $dscp_option $value" + esac + ;; *:direction) value="$(echo "$value" | sed -e 's,-,:,g')" if [ "$value" = "out" ]; then @@ -428,7 +428,7 @@ start_cg() { cat <alias) == 0); } -static int +static void swlib_map_settings(struct switch_dev *dev, int type, int port_vlan, struct uci_section *s) { struct swlib_setting *setting; diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile index 7f5f745fb..451f0962b 100644 --- a/package/network/ipv6/odhcp6c/Makefile +++ b/package/network/ipv6/odhcp6c/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcp6c -PKG_RELEASE:=14 +PKG_RELEASE:=15 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script index dcb7a95d9..28955a358 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.script +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script @@ -7,6 +7,14 @@ setup_interface () { local device="$1" local prefsig="" local addrsig="" + + # Apply IPv6 / ND configuration + HOPLIMIT=$(cat /proc/sys/net/ipv6/conf/$device/hop_limit) + [ -n "$RA_HOPLIMIT" -a -n "$HOPLIMIT" ] && [ "$RA_HOPLIMIT" -gt "$HOPLIMIT" ] && echo "$RA_HOPLIMIT" > /proc/sys/net/ipv6/conf/$device/hop_limit + [ -n "$RA_MTU" ] && [ "$RA_MTU" -ge 1280 ] && echo "$RA_MTU" > /proc/sys/net/ipv6/conf/$device/mtu 2>/dev/null + [ -n "$RA_REACHABLE" ] && [ "$RA_REACHABLE" -gt 0 ] && echo "$RA_REACHABLE" > /proc/sys/net/ipv6/neigh/$device/base_reachable_time_ms + [ -n "$RA_RETRANSMIT" ] && [ "$RA_RETRANSMIT" -gt 0 ] && echo "$RA_RETRANSMIT" > /proc/sys/net/ipv6/neigh/$device/retrans_time_ms + proto_init_update "*" 1 # Merge RA-DNS @@ -203,13 +211,6 @@ setup_interface () { ubus call network add_dynamic "$(json_dump)" fi - # Apply IPv6 / ND configuration - HOPLIMIT=$(cat /proc/sys/net/ipv6/conf/$device/hop_limit) - [ -n "$RA_HOPLIMIT" -a -n "$HOPLIMIT" ] && [ "$RA_HOPLIMIT" -gt "$HOPLIMIT" ] && echo "$RA_HOPLIMIT" > /proc/sys/net/ipv6/conf/$device/hop_limit - [ -n "$RA_MTU" ] && [ "$RA_MTU" -ge 1280 ] && echo "$RA_MTU" > /proc/sys/net/ipv6/conf/$device/mtu 2>/dev/null - [ -n "$RA_REACHABLE" ] && [ "$RA_REACHABLE" -gt 0 ] && echo "$RA_REACHABLE" > /proc/sys/net/ipv6/neigh/$device/base_reachable_time_ms - [ -n "$RA_RETRANSMIT" ] && [ "$RA_RETRANSMIT" -gt 0 ] && echo "$RA_RETRANSMIT" > /proc/sys/net/ipv6/neigh/$device/retrans_time_ms - # TODO: $SNTP_IP $SIP_IP $SNTP_FQDN $SIP_DOMAIN } diff --git a/package/network/ipv6/thc-ipv6/Makefile b/package/network/ipv6/thc-ipv6/Makefile index df3a67c23..91bacf625 100644 --- a/package/network/ipv6/thc-ipv6/Makefile +++ b/package/network/ipv6/thc-ipv6/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://freeworld.thc.org/releases/ +PKG_SOURCE_URL:=@GITHUB/vanhauser-thc/THC-Archive/master/Tools PKG_HASH:=440a3ae98b57100c397ec4f8634468dbbb0c3b48788c6b74af2a597a90544a96 PKG_MAINTAINER:=Jo-Philipp Wich @@ -42,7 +42,7 @@ define BuildTool SECTION:=net CATEGORY:=Network DEPENDS:=+libpcap $(THC_DEPENDS_$(1)) - URL:=http://freeworld.thc.org/ + URL:=https://github.com/vanhauser-thc/thc-ipv6 SUBMENU:=THC-IPv6 attack and analyzing toolkit endef diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 21ac09f72..61136606a 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear PKG_VERSION:=2017.75 -PKG_RELEASE:=5 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ @@ -49,6 +49,10 @@ define Package/dropbear CATEGORY:=Base system TITLE:=Small SSH2 client/server DEPENDS:= +DROPBEAR_ZLIB:zlib + ALTERNATIVES:=\ + 100:/usr/bin/ssh:/usr/sbin/dropbear \ + 100:/usr/bin/scp:/usr/sbin/dropbear \ + endef define Package/dropbear/description @@ -82,8 +86,8 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_DROPBEAR_ZLIB),,--disable-zlib) \ --enable-bundled-libtom -TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections +TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver define Build/Configure $(Build/Configure/Default) @@ -131,8 +135,6 @@ define Package/dropbear/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear $(INSTALL_DIR) $(1)/usr/bin - $(LN) ../sbin/dropbear $(1)/usr/bin/scp - $(LN) ../sbin/dropbear $(1)/usr/bin/ssh $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey $(INSTALL_DIR) $(1)/etc/config diff --git a/package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch b/package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch new file mode 100644 index 000000000..593dca930 --- /dev/null +++ b/package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch @@ -0,0 +1,221 @@ +From 52adbb34c32d3e2e1bcdb941e20a6f81138b8248 Mon Sep 17 00:00:00 2001 +From: Matt Johnston +Date: Thu, 23 Aug 2018 23:43:12 +0800 +Subject: [PATCH 2/2] Wait to fail invalid usernames + +--- + auth.h | 6 +++--- + svr-auth.c | 19 +++++-------------- + svr-authpam.c | 26 ++++++++++++++++++++++---- + svr-authpasswd.c | 27 ++++++++++++++------------- + svr-authpubkey.c | 11 ++++++++++- + 5 files changed, 54 insertions(+), 35 deletions(-) + +--- a/auth.h ++++ b/auth.h +@@ -37,9 +37,9 @@ void recv_msg_userauth_request(void); + void send_msg_userauth_failure(int partial, int incrfail); + void send_msg_userauth_success(void); + void send_msg_userauth_banner(buffer *msg); +-void svr_auth_password(void); +-void svr_auth_pubkey(void); +-void svr_auth_pam(void); ++void svr_auth_password(int valid_user); ++void svr_auth_pubkey(int valid_user); ++void svr_auth_pam(int valid_user); + + #ifdef ENABLE_SVR_PUBKEY_OPTIONS + int svr_pubkey_allows_agentfwd(void); +--- a/svr-auth.c ++++ b/svr-auth.c +@@ -176,10 +176,8 @@ void recv_msg_userauth_request() { + if (methodlen == AUTH_METHOD_PASSWORD_LEN && + strncmp(methodname, AUTH_METHOD_PASSWORD, + AUTH_METHOD_PASSWORD_LEN) == 0) { +- if (valid_user) { +- svr_auth_password(); +- goto out; +- } ++ svr_auth_password(valid_user); ++ goto out; + } + } + #endif +@@ -191,10 +189,8 @@ void recv_msg_userauth_request() { + if (methodlen == AUTH_METHOD_PASSWORD_LEN && + strncmp(methodname, AUTH_METHOD_PASSWORD, + AUTH_METHOD_PASSWORD_LEN) == 0) { +- if (valid_user) { +- svr_auth_pam(); +- goto out; +- } ++ svr_auth_pam(valid_user); ++ goto out; + } + } + #endif +@@ -204,12 +200,7 @@ void recv_msg_userauth_request() { + if (methodlen == AUTH_METHOD_PUBKEY_LEN && + strncmp(methodname, AUTH_METHOD_PUBKEY, + AUTH_METHOD_PUBKEY_LEN) == 0) { +- if (valid_user) { +- svr_auth_pubkey(); +- } else { +- /* pubkey has no failure delay */ +- send_msg_userauth_failure(0, 0); +- } ++ svr_auth_pubkey(valid_user); + goto out; + } + #endif +--- a/svr-authpam.c ++++ b/svr-authpam.c +@@ -178,13 +178,14 @@ pamConvFunc(int num_msg, + * Keyboard interactive would be a lot nicer, but since PAM is synchronous, it + * gets very messy trying to send the interactive challenges, and read the + * interactive responses, over the network. */ +-void svr_auth_pam() { ++void svr_auth_pam(int valid_user) { + + struct UserDataS userData = {NULL, NULL}; + struct pam_conv pamConv = { + pamConvFunc, + &userData /* submitted to pamvConvFunc as appdata_ptr */ + }; ++ const char* printable_user = NULL; + + pam_handle_t* pamHandlep = NULL; + +@@ -204,12 +205,23 @@ void svr_auth_pam() { + + password = buf_getstring(ses.payload, &passwordlen); + ++ /* We run the PAM conversation regardless of whether the username is valid ++ in case the conversation function has an inherent delay. ++ Use ses.authstate.username rather than ses.authstate.pw_name. ++ After PAM succeeds we then check the valid_user flag too */ ++ + /* used to pass data to the PAM conversation function - don't bother with + * strdup() etc since these are touched only by our own conversation + * function (above) which takes care of it */ +- userData.user = ses.authstate.pw_name; ++ userData.user = ses.authstate.username; + userData.passwd = password; + ++ if (ses.authstate.pw_name) { ++ printable_user = ses.authstate.pw_name; ++ } else { ++ printable_user = ""; ++ } ++ + /* Init pam */ + if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) { + dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s", +@@ -236,7 +248,7 @@ void svr_auth_pam() { + rc, pam_strerror(pamHandlep, rc)); + dropbear_log(LOG_WARNING, + "Bad PAM password attempt for '%s' from %s", +- ses.authstate.pw_name, ++ printable_user, + svr_ses.addrstring); + send_msg_userauth_failure(0, 1); + goto cleanup; +@@ -247,12 +259,18 @@ void svr_auth_pam() { + rc, pam_strerror(pamHandlep, rc)); + dropbear_log(LOG_WARNING, + "Bad PAM password attempt for '%s' from %s", +- ses.authstate.pw_name, ++ printable_user, + svr_ses.addrstring); + send_msg_userauth_failure(0, 1); + goto cleanup; + } + ++ if (!valid_user) { ++ /* PAM auth succeeded but the username isn't allowed in for another reason ++ (checkusername() failed) */ ++ send_msg_userauth_failure(0, 1); ++ } ++ + /* successful authentication */ + dropbear_log(LOG_NOTICE, "PAM password auth succeeded for '%s' from %s", + ses.authstate.pw_name, +--- a/svr-authpasswd.c ++++ b/svr-authpasswd.c +@@ -48,22 +48,14 @@ static int constant_time_strcmp(const ch + + /* Process a password auth request, sending success or failure messages as + * appropriate */ +-void svr_auth_password() { ++void svr_auth_password(int valid_user) { + + char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */ + char * testcrypt = NULL; /* crypt generated from the user's password sent */ +- char * password; ++ char * password = NULL; + unsigned int passwordlen; +- + unsigned int changepw; + +- passwdcrypt = ses.authstate.pw_passwd; +- +-#ifdef DEBUG_HACKCRYPT +- /* debugging crypt for non-root testing with shadows */ +- passwdcrypt = DEBUG_HACKCRYPT; +-#endif +- + /* check if client wants to change password */ + changepw = buf_getbool(ses.payload); + if (changepw) { +@@ -73,12 +65,21 @@ void svr_auth_password() { + } + + password = buf_getstring(ses.payload, &passwordlen); +- +- /* the first bytes of passwdcrypt are the salt */ +- testcrypt = crypt(password, passwdcrypt); ++ if (valid_user) { ++ /* the first bytes of passwdcrypt are the salt */ ++ passwdcrypt = ses.authstate.pw_passwd; ++ testcrypt = crypt(password, passwdcrypt); ++ } + m_burn(password, passwordlen); + m_free(password); + ++ /* After we have got the payload contents we can exit if the username ++ is invalid. Invalid users have already been logged. */ ++ if (!valid_user) { ++ send_msg_userauth_failure(0, 1); ++ return; ++ } ++ + if (testcrypt == NULL) { + /* crypt() with an invalid salt like "!!" */ + dropbear_log(LOG_WARNING, "User account '%s' is locked", +--- a/svr-authpubkey.c ++++ b/svr-authpubkey.c +@@ -79,7 +79,7 @@ static int checkfileperm(char * filename + + /* process a pubkey auth request, sending success or failure message as + * appropriate */ +-void svr_auth_pubkey() { ++void svr_auth_pubkey(int valid_user) { + + unsigned char testkey; /* whether we're just checking if a key is usable */ + char* algo = NULL; /* pubkey algo */ +@@ -102,6 +102,15 @@ void svr_auth_pubkey() { + keybloblen = buf_getint(ses.payload); + keyblob = buf_getptr(ses.payload, keybloblen); + ++ if (!valid_user) { ++ /* Return failure once we have read the contents of the packet ++ required to validate a public key. ++ Avoids blind user enumeration though it isn't possible to prevent ++ testing for user existence if the public key is known */ ++ send_msg_userauth_failure(0, 0); ++ goto out; ++ } ++ + /* check if the key is valid */ + if (checkpubkey(algo, algolen, keyblob, keybloblen) == DROPBEAR_FAILURE) { + send_msg_userauth_failure(0, 0); diff --git a/package/network/services/dropbear/patches/100-pubkey_path.patch b/package/network/services/dropbear/patches/100-pubkey_path.patch index 401c7e1ba..274d3af46 100644 --- a/package/network/services/dropbear/patches/100-pubkey_path.patch +++ b/package/network/services/dropbear/patches/100-pubkey_path.patch @@ -1,6 +1,6 @@ --- a/svr-authpubkey.c +++ b/svr-authpubkey.c -@@ -220,14 +220,20 @@ static int checkpubkey(char* algo, unsig +@@ -229,14 +229,20 @@ static int checkpubkey(char* algo, unsig goto out; } @@ -29,7 +29,7 @@ /* open the file as the authenticating user. */ origuid = getuid(); -@@ -396,26 +402,35 @@ static int checkpubkeyperms() { +@@ -405,26 +411,35 @@ static int checkpubkeyperms() { goto out; } diff --git a/package/network/services/dropbear/patches/160-lto-jobserver.patch b/package/network/services/dropbear/patches/160-lto-jobserver.patch new file mode 100644 index 000000000..bb9449283 --- /dev/null +++ b/package/network/services/dropbear/patches/160-lto-jobserver.patch @@ -0,0 +1,33 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -163,17 +163,17 @@ dropbearkey: $(dropbearkeyobjs) + dropbearconvert: $(dropbearconvertobjs) + + dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ + + dbclient: $(HEADERS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) + + dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) + + # scp doesn't use the libs so is special. + scp: $(SCPOBJS) $(HEADERS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS) + + + # multi-binary compilation. +@@ -184,7 +184,7 @@ ifeq ($(MULTI),1) + endif + + dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@ $(MULTIOBJS) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ ++ +$(CC) $(LDFLAGS) -o $@ $(MULTIOBJS) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ + + multibinary: dropbearmulti$(EXEEXT) + diff --git a/package/network/services/ead/src/ead.c b/package/network/services/ead/src/ead.c index 46a4625b6..ad97c543c 100644 --- a/package/network/services/ead/src/ead.c +++ b/package/network/services/ead/src/ead.c @@ -145,9 +145,7 @@ ead_open_pcap(const char *ifname, char *errbuf, bool rx) pcap_set_snaplen(p, PCAP_MRU); pcap_set_promisc(p, rx); pcap_set_timeout(p, PCAP_TIMEOUT); -#ifdef HAS_PROTO_EXTENSION - pcap_set_protocol(p, (rx ? htons(ETH_P_IP) : 0)); -#endif + pcap_set_protocol_linux(p, (rx ? htons(ETH_P_IP) : 0)); pcap_set_buffer_size(p, (rx ? 10 : 1) * PCAP_MRU); pcap_activate(p); set_recv_type(p, rx); diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index fea5ed3ba..222cfb7f1 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -1,33 +1,56 @@ # wpa_supplicant config config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK bool "Disable timestamp check" - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini || PACAKGE_wpad-mesh + depends on PACKAGE_wpa-supplicant || \ + PACKAGE_wpa-supplicant-openssl || \ + PACKAGE_wpa-supplicant-wolfssl || \ + PACKAGE_wpa-supplicant-mesh-openssl || \ + PACKAGE_wpa-supplicant-mesh-wolfssl || \ + PACKAGE_wpa-supplicant-mini || \ + PACKAGE_wpa-supplicant-p2p || \ + PACKAGE_wpad || \ + PACKAGE_wpad-openssl || \ + PACKAGE_wpad-wolfssl || \ + PACKAGE_wpad-mini || \ + PACKAGE_wpad-mesh-openssl || \ + PACKAGE_wpad-mesh-wolfssl default n help This disables the timestamp check for certificates in wpa_supplicant Useful for devices without RTC that cannot reliably get the real date/time -choice - prompt "Choose TLS provider" - default WPA_SUPPLICANT_INTERNAL - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad - -config WPA_SUPPLICANT_INTERNAL - bool "internal" - -config WPA_SUPPLICANT_OPENSSL - bool "openssl" - select PACKAGE_libopenssl - -endchoice - config WPA_RFKILL_SUPPORT bool "Add rfkill support" - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini || PACKAGE_wpad-mesh + depends on PACKAGE_wpa-supplicant || \ + PACKAGE_wpa-supplicant-openssl || \ + PACKAGE_wpa-supplicant-wolfssl || \ + PACKAGE_wpa-supplicant-mesh-openssl || \ + PACKAGE_wpa-supplicant-mesh-wolfssl || \ + PACKAGE_wpa-supplicant-mini || \ + PACKAGE_wpa-supplicant-p2p || \ + PACKAGE_wpad || \ + PACKAGE_wpad-openssl || \ + PACKAGE_wpad-wolfssl || \ + PACKAGE_wpad-mini || \ + PACKAGE_wpad-mesh-openssl || \ + PACKAGE_wpad-mesh-wolfssl default n config WPA_MSG_MIN_PRIORITY int "Minimum debug message priority" + depends on PACKAGE_wpa-supplicant || \ + PACKAGE_wpa-supplicant-openssl || \ + PACKAGE_wpa-supplicant-wolfssl || \ + PACKAGE_wpa-supplicant-mesh-openssl || \ + PACKAGE_wpa-supplicant-mesh-wolfssl || \ + PACKAGE_wpa-supplicant-mini || \ + PACKAGE_wpa-supplicant-p2p || \ + PACKAGE_wpad || \ + PACKAGE_wpad-openssl || \ + PACKAGE_wpad-wolfssl || \ + PACKAGE_wpad-mini || \ + PACKAGE_wpad-mesh-openssl || \ + PACKAGE_wpad-mesh-wolfssl default 3 help Useful values are: @@ -38,6 +61,24 @@ config WPA_MSG_MIN_PRIORITY 4 = warnings 5 = errors +config WPA_WOLFSSL + bool + default PACKAGE_wpa-supplicant-wolfssl ||\ + PACKAGE_wpad-wolfssl ||\ + PACKAGE_wpad-mesh-wolfssl ||\ + PACKAGE_eapol-test-wolfssl + select PACKAGE_libwolfssl + select WOLFSSL_HAS_AES_CCM + select WOLFSSL_HAS_AES_GCM + select WOLFSSL_HAS_ARC4 + select WOLFSSL_HAS_DES3 + select WOLFSSL_HAS_DH + select WOLFSSL_HAS_ECC + select WOLFSSL_HAS_OCSP + select WOLFSSL_HAS_PSK + select WOLFSSL_HAS_SESSION_TICKET + select WOLFSSL_HAS_WPAS + config DRIVER_WEXT_SUPPORT bool default n diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index ed9bcfc3d..a5c537973 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=5 +PKG_RELEASE:=4 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-04-09 -PKG_SOURCE_VERSION:=fa617ee6a0b2d39e6372c93ef9437caa3bd9065a -PKG_MIRROR_HASH:=5e6f20153c3405ac905f89fea8a614a57e9ba19583b2de2777179381a74aa7b1 +PKG_SOURCE_DATE:=2018-05-21 +PKG_SOURCE_VERSION:=62566bc23d041e88f8e35933d5fd8c2fd0f7cf2a +PKG_MIRROR_HASH:=f234b24f9471ae9cb34460feec6d6614641691544101535673595272c91448eb PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -30,33 +30,49 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_WPA_RFKILL_SUPPORT \ CONFIG_DRIVER_WEXT_SUPPORT \ CONFIG_DRIVER_11N_SUPPORT \ - CONFIG_DRIVER_11AC_SUPPORT + CONFIG_DRIVER_11AC_SUPPORT \ + +EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl + +SUPPLICANT_PROVIDERS:= +HOSTAPD_PROVIDERS:= LOCAL_TYPE=$(strip \ $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \ $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \ hostapd \ - ))) -LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT))) + ))) + +LOCAL_AND_LIB_VARIANT=$(patsubst hostapd-%,%,\ + $(patsubst wpad-%,%,\ + $(patsubst supplicant-%,%,\ + $(BUILD_VARIANT)\ + ))) + +LOCAL_VARIANT=$(patsubst %-internal,%,\ + $(patsubst %-openssl,%,\ + $(patsubst %-wolfssl,%,\ + $(LOCAL_AND_LIB_VARIANT)\ + ))) + +SSL_VARIANT=$(strip \ + $(if $(findstring openssl,$(LOCAL_AND_LIB_VARIANT)),openssl,\ + $(if $(findstring wolfssl,$(LOCAL_AND_LIB_VARIANT)),wolfssl,\ + internal\ + ))) + CONFIG_VARIANT:=$(LOCAL_VARIANT) ifeq ($(LOCAL_VARIANT),mesh) CONFIG_VARIANT:=full endif -ifneq ($(LOCAL_TYPE),hostapd) - ifeq ($(LOCAL_VARIANT),full) - PKG_CONFIG_DEPENDS += \ - CONFIG_WPA_SUPPLICANT_INTERNAL \ - CONFIG_WPA_SUPPLICANT_OPENSSL - endif -endif - PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY) + ifneq ($(CONFIG_DRIVER_11N_SUPPORT),) HOSTAPD_IEEE80211N:=y endif @@ -72,21 +88,36 @@ DRIVER_MAKEOPTS= \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \ +space := +space += + ifeq ($(LOCAL_VARIANT),full) DRIVER_MAKEOPTS += CONFIG_IEEE80211W=$(CONFIG_DRIVER_11W_SUPPORT) endif -ifneq ($(LOCAL_TYPE),hostapd) - ifdef CONFIG_WPA_SUPPLICANT_OPENSSL - ifeq ($(LOCAL_VARIANT),full) - DRIVER_MAKEOPTS += CONFIG_TLS=openssl - TARGET_LDFLAGS += -lcrypto -lssl - endif - endif - ifeq ($(LOCAL_VARIANT),mesh) - DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y +ifeq ($(LOCAL_VARIANT),full) + ifeq ($(SSL_VARIANT),openssl) + DRIVER_MAKEOPTS += CONFIG_TLS=openssl TARGET_LDFLAGS += -lcrypto -lssl endif + ifeq ($(SSL_VARIANT),wolfssl) + DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 + TARGET_LDFLAGS += -lwolfssl + endif +endif + +ifneq ($(LOCAL_TYPE),hostapd) + ifeq ($(LOCAL_VARIANT),mesh) + ifeq ($(SSL_VARIANT),openssl) + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y + TARGET_LDFLAGS += -lcrypto -lssl + endif + ifeq ($(SSL_VARIANT),wolfssl) + DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y + TARGET_LDFLAGS += -lwolfssl + endif + endif + ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK endif @@ -104,19 +135,22 @@ endif DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny + define Package/hostapd/Default SECTION:=net CATEGORY:=Network TITLE:=IEEE 802.1x Authenticator URL:=http://hostap.epitest.fi/ DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + PROVIDES:=hostapd + CONFLICTS:=$(HOSTAPD_PROVIDERS) + HOSTAPD_PROVIDERS+=$(1) endef define Package/hostapd -$(call Package/hostapd/Default) +$(call Package/hostapd/Default,$(1)) TITLE+= (full) - VARIANT:=full - CONFLICTS:=wpad wpad-mini wpad-mesh + VARIANT:=full-internal endef define Package/hostapd/description @@ -124,27 +158,34 @@ define Package/hostapd/description Authenticator. endef +define Package/hostapd-openssl +$(call Package/hostapd/Default,$(1)) + TITLE+= (full) + VARIANT:=full-openssl + DEPENDS+=+libopenssl +endef + +Package/hostapd-openssl/description = $(Package/hostapd/description) + +define Package/hostapd-wolfssl +$(call Package/hostapd/Default,$(1)) + TITLE+= (full) + VARIANT:=full-wolfssl + DEPENDS+=+libwolfssl +endef + +Package/hostapd-wolfssl/description = $(Package/hostapd/description) + define Package/hostapd-mini -$(call Package/hostapd/Default) +$(call Package/hostapd/Default,$(1)) TITLE+= (WPA-PSK only) VARIANT:=mini - CONFLICTS:=wpad wpad-mini wpad-mesh endef define Package/hostapd-mini/description This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only). endef -define Package/hostapd-utils - $(call Package/hostapd/Default) - TITLE+= (utils) - DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mesh||PACKAGE_wpad-mini -endef - -define Package/hostapd-utils/description - This package contains a command line utility to control the - IEEE 802.1x/WPA/EAP/RADIUS Authenticator. -endef define Package/wpad/Default SECTION:=net @@ -152,13 +193,16 @@ define Package/wpad/Default TITLE:=IEEE 802.1x Authenticator/Supplicant DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus URL:=http://hostap.epitest.fi/ + PROVIDES:=hostapd wpa-supplicant + CONFLICTS:=$(HOSTAPD_PROVIDERS) $(SUPPLICANT_PROVIDERS) + HOSTAPD_PROVIDERS+=$(1) + SUPPLICANT_PROVIDERS+=$(1) endef define Package/wpad -$(call Package/wpad/Default) +$(call Package/wpad/Default,$(1)) TITLE+= (full) - DEPENDS+=+WPA_SUPPLICANT_OPENSSL:libopenssl - VARIANT:=wpad-full + VARIANT:=wpad-full-internal endef define Package/wpad/description @@ -166,8 +210,26 @@ define Package/wpad/description Authenticator and Supplicant endef +define Package/wpad-openssl +$(call Package/wpad/Default,$(1)) + TITLE+= (full) + VARIANT:=wpad-full-openssl + DEPENDS+=+libopenssl +endef + +Package/wpad-openssl/description = $(Package/wpad/description) + +define Package/wpad-wolfssl +$(call Package/wpad/Default,$(1)) + TITLE+= (full) + VARIANT:=wpad-full-wolfssl + DEPENDS+=+libwolfssl +endef + +Package/wpad-wolfssl/description = $(Package/wpad/description) + define Package/wpad-mini -$(call Package/wpad/Default) +$(call Package/wpad/Default,$(1)) TITLE+= (WPA-PSK only) VARIANT:=wpad-mini endef @@ -177,24 +239,59 @@ define Package/wpad-mini/description endef define Package/wpad-mesh -$(call Package/wpad/Default) +$(call Package/wpad/Default,$(1)) TITLE+= (with 802.11s mesh and SAE support) - DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) - VARIANT:=wpad-mesh + DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) + PROVIDES+=wpa-supplicant-mesh wpad-mesh endef define Package/wpad-mesh/description This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (with 802.11s mesh and SAE support). endef -define Package/wpa-supplicant +define Package/wpad-mesh-openssl +$(call Package/wpad-mesh,$(1)) + DEPENDS+=+libopenssl + VARIANT:=wpad-mesh-openssl +endef + +Package/wpad-mesh-openssl/description = $(Package/wpad-mesh/description) + +define Package/wpad-mesh-wolfssl +$(call Package/wpad-mesh,$(1)) + DEPENDS+=+libwolfssl + VARIANT:=wpad-mesh-wolfssl +endef + +Package/wpad-mesh-wolfssl/description = $(Package/wpad-mesh/description) + + +define Package/wpa-supplicant/Default SECTION:=net CATEGORY:=Network TITLE:=WPA Supplicant URL:=http://hostap.epitest.fi/wpa_supplicant/ - DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl - CONFLICTS:=wpad wpad-mini wpad-mesh - VARIANT:=supplicant-full + DEPENDS:=$(DRV_DEPENDS) + PROVIDES:=wpa-supplicant + CONFLICTS:=$(SUPPLICANT_PROVIDERS) + SUPPLICANT_PROVIDERS+=$(1) +endef + +define Package/wpa-supplicant +$(call Package/wpa-supplicant/Default,$(1)) + VARIANT:=supplicant-full-internal +endef + +define Package/wpa-supplicant-openssl +$(call Package/wpa-supplicant/Default,$(1)) + VARIANT:=supplicant-full-openssl + DEPENDS+=+libopenssl +endef + +define Package/wpa-supplicant-wolfssl +$(call Package/wpa-supplicant/Default,$(1)) + VARIANT:=supplicant-full-wolfssl + DEPENDS+=+libwolfssl endef define Package/wpa-supplicant/config @@ -202,35 +299,37 @@ define Package/wpa-supplicant/config endef define Package/wpa-supplicant-p2p - $(Package/wpa-supplicant) - TITLE:=WPA Supplicant (with Wi-Fi P2P support) - DEPENDS:=$(DRV_DEPENDS) @PACKAGE_kmod-cfg80211 - CONFLICTS:=wpad wpad-mini wpad-mesh - VARIANT:=supplicant-p2p +$(call Package/wpa-supplicant/Default,$(1)) + TITLE+= (with Wi-Fi P2P support) + DEPENDS+=@PACKAGE_kmod-cfg80211 + VARIANT:=supplicant-p2p-internal endef -define Package/wpa-supplicant-mesh - $(Package/wpa-supplicant) - TITLE:=WPA Supplicant (with 802.11s and SAE) - DEPENDS:=$(DRV_DEPENDS) +PACKAGE_wpa-supplicant-mesh:libopenssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) - CONFLICTS:=wpad wpad-mesh wpad-mesh - VARIANT:=supplicant-mesh +define Package/wpa-supplicant-mesh/Default +$(call Package/wpa-supplicant/Default,$(1)) + TITLE+= (with 802.11s and SAE) + DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) + PROVIDES+=wpa-supplicant-mesh +endef + +define Package/wpa-supplicant-mesh-openssl +$(call Package/wpa-supplicant-mesh/Default,$(1)) + VARIANT:=supplicant-mesh-openssl + DEPENDS+=+libopenssl +endef + +define Package/wpa-supplicant-mesh-wolfssl +$(call Package/wpa-supplicant-mesh/Default,$(1)) + VARIANT:=supplicant-mesh-wolfssl + DEPENDS+=+libwolfssl endef define Package/wpa-supplicant-mini - $(Package/wpa-supplicant) - TITLE:=WPA Supplicant (minimal version) - DEPENDS:=$(DRV_DEPENDS) - CONFLICTS:=wpad wpad-mini wpad-mesh +$(call Package/wpa-supplicant/Default,$(1)) + TITLE+= (minimal version) VARIANT:=supplicant-mini endef -define Package/wpa-cli - SECTION:=net - CATEGORY:=Network - DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad||PACKAGE_wpad-mesh - TITLE:=WPA Supplicant command line control utility -endef define Package/hostapd-common TITLE:=hostapd/wpa_supplicant common support files @@ -238,12 +337,52 @@ define Package/hostapd-common CATEGORY:=Network endef +define Package/hostapd-utils + SECTION:=net + CATEGORY:=Network + TITLE:=IEEE 802.1x Authenticator (utils) + URL:=http://hostap.epitest.fi/ + DEPENDS:=@$(subst $(space),||,$(foreach pkg,$(HOSTAPD_PROVIDERS),PACKAGE_$(pkg))) +endef + +define Package/hostapd-utils/description + This package contains a command line utility to control the + IEEE 802.1x/WPA/EAP/RADIUS Authenticator. +endef + +define Package/wpa-cli + SECTION:=net + CATEGORY:=Network + DEPENDS:=@$(subst $(space),||,$(foreach pkg,$(SUPPLICANT_PROVIDERS),PACKAGE_$(pkg))) + TITLE:=WPA Supplicant command line control utility +endef + define Package/eapol-test TITLE:=802.1x authentication test utility SECTION:=net CATEGORY:=Network - VARIANT:=supplicant-full - DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl + VARIANT:=supplicant-full-internal + DEPENDS:=$(DRV_DEPENDS) +endef + +define Package/eapol-test-openssl + TITLE:=802.1x authentication test utility + SECTION:=net + CATEGORY:=Network + VARIANT:=supplicant-full-openssl + CONFLICTS:=$(filter-out eapol-test-openssl ,$(EAPOL_TEST_PROVIDERS)) + DEPENDS:=$(DRV_DEPENDS) +libopenssl + PROVIDES:=eapol-test +endef + +define Package/eapol-test-wolfssl + TITLE:=802.1x authentication test utility + SECTION:=net + CATEGORY:=Network + VARIANT:=supplicant-full-wolfssl + CONFLICTS:=$(filter-out eapol-test-openssl ,$(filter-out eapol-test-wolfssl ,$(EAPOL_TEST_PROVIDERS))) + DEPENDS:=$(DRV_DEPENDS) +libwolfssl + PROVIDES:=eapol-test endef @@ -273,8 +412,8 @@ TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY)) -TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver -fuse-linker-plugin ifeq ($(findstring supplicant,$(BUILD_VARIANT)),) TARGET_LDFLAGS += -lubox -lubus endif @@ -290,6 +429,7 @@ define Build/RunMake $(DRIVER_MAKEOPTS) \ LIBS="$(TARGET_LDFLAGS)" \ LIBS_c="$(TARGET_LDFLAGS_C)" \ + AR="$(TARGET_CROSS)gcc-ar" \ BCHECK= \ $(2) endef @@ -311,7 +451,7 @@ define Build/Compile/wpad MULTICALL=1 \ wpa_cli wpa_supplicant_multi.a \ ) - $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \ + +export MAKEFLAGS="$(MAKE_JOBSERVER)"; $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \ $(TARGET_CFLAGS) \ ./files/multicall.c \ $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \ @@ -331,7 +471,19 @@ define Build/Compile/supplicant ) endef -define Build/Compile/supplicant-full +define Build/Compile/supplicant-full-internal + +$(call Build/RunMake,wpa_supplicant, \ + eapol_test \ + ) +endef + +define Build/Compile/supplicant-full-openssl + +$(call Build/RunMake,wpa_supplicant, \ + eapol_test \ + ) +endef + +define Build/Compile/supplicant-full-wolfssl +$(call Build/RunMake,wpa_supplicant, \ eapol_test \ ) @@ -360,6 +512,8 @@ define Package/hostapd/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/ endef Package/hostapd-mini/install = $(Package/hostapd/install) +Package/hostapd-openssl/install = $(Package/hostapd/install) +Package/hostapd-wolfssl/install = $(Package/hostapd/install) ifneq ($(LOCAL_TYPE),supplicant) define Package/hostapd-utils/install @@ -377,7 +531,10 @@ define Package/wpad/install $(LN) wpad $(1)/usr/sbin/wpa_supplicant endef Package/wpad-mini/install = $(Package/wpad/install) -Package/wpad-mesh/install = $(Package/wpad/install) +Package/wpad-openssl/install = $(Package/wpad/install) +Package/wpad-wolfssl/install = $(Package/wpad/install) +Package/wpad-mesh-openssl/install = $(Package/wpad/install) +Package/wpad-mesh-wolfssl/install = $(Package/wpad/install) define Package/wpa-supplicant/install $(call Install/supplicant,$(1)) @@ -385,7 +542,10 @@ define Package/wpa-supplicant/install endef Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install) Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install) -Package/wpa-supplicant-mesh/install = $(Package/wpa-supplicant/install) +Package/wpa-supplicant-openssl/install = $(Package/wpa-supplicant/install) +Package/wpa-supplicant-wolfssl/install = $(Package/wpa-supplicant/install) +Package/wpa-supplicant-mesh-openssl/install = $(Package/wpa-supplicant/install) +Package/wpa-supplicant-mesh-wolfssl/install = $(Package/wpa-supplicant/install) ifneq ($(LOCAL_TYPE),hostapd) define Package/wpa-cli/install @@ -394,23 +554,47 @@ ifneq ($(LOCAL_TYPE),hostapd) endef endif -ifeq ($(BUILD_VARIANT),supplicant-full) +ifeq ($(BUILD_VARIANT),supplicant-full-internal) define Package/eapol-test/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/ endef endif +ifeq ($(BUILD_VARIANT),supplicant-full-openssl) + define Package/eapol-test-openssl/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/ + endef +endif + +ifeq ($(BUILD_VARIANT),supplicant-full-wolfssl) + define Package/eapol-test-wolfssl/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/ + endef +endif + $(eval $(call BuildPackage,hostapd)) $(eval $(call BuildPackage,hostapd-mini)) +$(eval $(call BuildPackage,hostapd-openssl)) +$(eval $(call BuildPackage,hostapd-wolfssl)) $(eval $(call BuildPackage,wpad)) -$(eval $(call BuildPackage,wpad-mesh)) +$(eval $(call BuildPackage,wpad-mesh-openssl)) +$(eval $(call BuildPackage,wpad-mesh-wolfssl)) $(eval $(call BuildPackage,wpad-mini)) +$(eval $(call BuildPackage,wpad-openssl)) +$(eval $(call BuildPackage,wpad-wolfssl)) $(eval $(call BuildPackage,wpa-supplicant)) -$(eval $(call BuildPackage,wpa-supplicant-mesh)) +$(eval $(call BuildPackage,wpa-supplicant-mesh-openssl)) +$(eval $(call BuildPackage,wpa-supplicant-mesh-wolfssl)) $(eval $(call BuildPackage,wpa-supplicant-mini)) $(eval $(call BuildPackage,wpa-supplicant-p2p)) +$(eval $(call BuildPackage,wpa-supplicant-openssl)) +$(eval $(call BuildPackage,wpa-supplicant-wolfssl)) $(eval $(call BuildPackage,wpa-cli)) $(eval $(call BuildPackage,hostapd-utils)) $(eval $(call BuildPackage,hostapd-common)) $(eval $(call BuildPackage,eapol-test)) +$(eval $(call BuildPackage,eapol-test-openssl)) +$(eval $(call BuildPackage,eapol-test-wolfssl)) diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 786afad2b..355a70b9e 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -357,7 +357,7 @@ CONFIG_INTERNAL_LIBTOMMATH=y # Has the AP retain the Probe Request and (Re)Association Request frames from # a client, from which a signature can be produced which can identify the model # of client device like "Nexus 6P" or "iPhone 5s". -#CONFIG_TAXONOMY=y +CONFIG_TAXONOMY=y # Fast Initial Link Setup (FILS) (IEEE 802.11ai) # Note: This is an experimental and not yet complete implementation. This diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 4deb0b97a..7ffff4e7e 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -688,11 +688,12 @@ wpa_supplicant_add_network() { } [[ "$_w_mode" = "mesh" ]] && { - json_get_vars mesh_id mesh_fwding + json_get_vars mesh_id mesh_fwding mesh_rssi_threshold [ -n "$mesh_id" ] && ssid="${mesh_id}" append network_data "mode=5" "$N$T" [ -n "$mesh_fwding" ] && append network_data "mesh_fwding=${mesh_fwding}" "$N$T" + [ -n "$mesh_rssi_threshold" ] && append network_data "mesh_rssi_threshold=${mesh_rssi_threshold}" "$N$T" [ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode" [ "$noscan" = "1" ] && append network_data "noscan=1" "$N$T" append wpa_key_mgmt "SAE" diff --git a/package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch b/package/network/services/hostapd/patches/001-mesh-factor-out-mesh-join-function.patch similarity index 91% rename from package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch rename to package/network/services/hostapd/patches/001-mesh-factor-out-mesh-join-function.patch index 7671d1e96..a1d668b28 100644 --- a/package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch +++ b/package/network/services/hostapd/patches/001-mesh-factor-out-mesh-join-function.patch @@ -1,7 +1,7 @@ -From 91c0f3f6a9ecae3c9106bef8a8606fab0792dd28 Mon Sep 17 00:00:00 2001 +From 02ae4382f45f772e3630460459eb4e5af64e71b4 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:48:58 -0700 -Subject: [PATCH 01/15] mesh: factor out mesh join function +Date: Tue, 29 May 2018 14:39:05 -0700 +Subject: [PATCH 01/18] mesh: factor out mesh join function mesh join function consitss of 2 parts which are preparing configurations and sending join event to driver. @@ -12,22 +12,14 @@ into 2 parts to reduce redundant calls. Signed-off-by: Peter Oh --- - wpa_supplicant/mesh.c | 120 ++++++++++++++++-------------- + wpa_supplicant/mesh.c | 119 ++++++++++++++++-------------- wpa_supplicant/mesh.h | 1 + wpa_supplicant/wpa_supplicant_i.h | 1 + - 3 files changed, 68 insertions(+), 54 deletions(-) + 3 files changed, 67 insertions(+), 54 deletions(-) --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -25,6 +25,7 @@ - #include "mesh_mpm.h" - #include "mesh_rsn.h" - #include "mesh.h" -+#include "drivers/driver_nl80211.h" - - - static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) -@@ -359,13 +360,48 @@ void wpa_supplicant_mesh_add_scan_ie(str +@@ -364,13 +364,48 @@ void wpa_supplicant_mesh_add_scan_ie(str } @@ -78,7 +70,7 @@ Signed-off-by: Peter Oh ret = -ENOENT; goto out; } -@@ -376,22 +412,22 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -381,22 +416,22 @@ int wpa_supplicant_join_mesh(struct wpa_ wpa_s->group_cipher = WPA_CIPHER_NONE; wpa_s->mgmt_group_cipher = 0; @@ -112,7 +104,7 @@ Signed-off-by: Peter Oh } else { ssid->max_oper_chwidth = VHT_CHANWIDTH_80MHZ; } -@@ -405,67 +441,43 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -410,67 +445,43 @@ int wpa_supplicant_join_mesh(struct wpa_ } } if (ssid->beacon_int > 0) diff --git a/package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch b/package/network/services/hostapd/patches/002-mesh-factor-out-rsn-initialization.patch similarity index 69% rename from package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch rename to package/network/services/hostapd/patches/002-mesh-factor-out-rsn-initialization.patch index 75717a50e..26e872d76 100644 --- a/package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch +++ b/package/network/services/hostapd/patches/002-mesh-factor-out-rsn-initialization.patch @@ -1,7 +1,7 @@ -From 04ebcadc059a6cfd45cd8ec06e6321b69bdb68b8 Mon Sep 17 00:00:00 2001 +From 89db76eeff6502dfa39b011962ec9d560ed4c2ee Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:48:59 -0700 -Subject: [PATCH 02/15] mesh: factor out rsn initialization +Date: Tue, 29 May 2018 14:39:06 -0700 +Subject: [PATCH 02/18] mesh: factor out rsn initialization RSN initialization can be used in different phases if mesh initialization and mesh join don't happen @@ -10,16 +10,16 @@ hence factor it out to help convering the case. Signed-off-by: Peter Oh --- - wpa_supplicant/mesh.c | 73 ++++++++++++++++++++++++++----------------- + wpa_supplicant/mesh.c | 84 +++++++++++++++++++++++++------------------ wpa_supplicant/mesh.h | 1 + - 2 files changed, 45 insertions(+), 29 deletions(-) + 2 files changed, 50 insertions(+), 35 deletions(-) --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -147,6 +147,48 @@ static void wpas_mesh_copy_groups(struct - groups_size); +@@ -147,6 +147,53 @@ static void wpas_mesh_copy_groups(struct } + +int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) +{ + struct hostapd_iface *ifmsh = wpa_s->ifmsh; @@ -27,10 +27,14 @@ Signed-off-by: Peter Oh + struct wpa_ssid *ssid = wpa_s->current_ssid; + struct hostapd_data *bss = ifmsh->bss[0]; + static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; ++ const char *password; + size_t len; + + if (mconf->security != MESH_CONF_SEC_NONE) { -+ if (ssid->passphrase == NULL) { ++ password = ssid->sae_password; ++ if (!password) ++ password = ssid->passphrase; ++ if (!password) { + wpa_printf(MSG_ERROR, + "mesh: Passphrase for SAE not configured"); + return -1; @@ -50,9 +54,9 @@ Signed-off-by: Peter Oh + return -1; + } + -+ len = os_strlen(ssid->passphrase); ++ len = os_strlen(password); + bss->conf->ssid.wpa_passphrase = -+ dup_binstr(ssid->passphrase, len); ++ dup_binstr(password, len); + + wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); + if (!wpa_s->mesh_rsn) @@ -62,15 +66,29 @@ Signed-off-by: Peter Oh + return 0; +} + - ++ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, -@@ -291,35 +333,8 @@ static int wpa_supplicant_mesh_init(stru + struct hostapd_freq_params *freq) +@@ -156,9 +203,6 @@ static int wpa_supplicant_mesh_init(stru + struct hostapd_config *conf; + struct mesh_conf *mconf; + int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; +- static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; +- const char *password; +- size_t len; + int rate_len; + int frequency; + +@@ -292,38 +336,8 @@ static int wpa_supplicant_mesh_init(stru return -1; } - if (mconf->security != MESH_CONF_SEC_NONE) { -- if (ssid->passphrase == NULL) { +- password = ssid->sae_password; +- if (!password) +- password = ssid->passphrase; +- if (!password) { - wpa_printf(MSG_ERROR, - "mesh: Passphrase for SAE not configured"); - goto out_free; @@ -90,9 +108,9 @@ Signed-off-by: Peter Oh - goto out_free; - } - -- len = os_strlen(ssid->passphrase); +- len = os_strlen(password); - bss->conf->ssid.wpa_passphrase = -- dup_binstr(ssid->passphrase, len); +- dup_binstr(password, len); - - wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); - if (!wpa_s->mesh_rsn) diff --git a/package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch b/package/network/services/hostapd/patches/003-mesh-relocate-RSN-init-function.patch similarity index 79% rename from package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch rename to package/network/services/hostapd/patches/003-mesh-relocate-RSN-init-function.patch index 153e9b2c6..c96e81076 100644 --- a/package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch +++ b/package/network/services/hostapd/patches/003-mesh-relocate-RSN-init-function.patch @@ -1,7 +1,7 @@ -From cbe8b9901f9cc254cbaa1ec1cee1c52af8f828bf Mon Sep 17 00:00:00 2001 +From 07bad5f256cbe8a4b45d32c5b43b870ee815fb42 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:00 -0700 -Subject: [PATCH 03/15] mesh: relocate RSN init function +Date: Tue, 29 May 2018 14:39:07 -0700 +Subject: [PATCH 03/18] mesh: relocate RSN init function RSN init function should work together with mesh join when it's used. Since mesh join could be called at different stage @@ -16,7 +16,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -333,9 +333,6 @@ static int wpa_supplicant_mesh_init(stru +@@ -336,9 +336,6 @@ static int wpa_supplicant_mesh_init(stru return -1; } @@ -26,7 +26,7 @@ Signed-off-by: Peter Oh wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); return 0; -@@ -381,6 +378,12 @@ void wpas_join_mesh(struct wpa_supplican +@@ -384,6 +381,12 @@ void wpas_join_mesh(struct wpa_supplican struct wpa_ssid *ssid = wpa_s->current_ssid; int ret = 0; diff --git a/package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch similarity index 84% rename from package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch rename to package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch index 8927d5ca8..3ce2848d0 100644 --- a/package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch +++ b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch @@ -1,7 +1,7 @@ -From 8a4ebbb6bbbc1460c1d584d1a710bf1361797ffd Mon Sep 17 00:00:00 2001 +From bd05de484bfa61def530d717c7234381f6b33cf7 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:01 -0700 -Subject: [PATCH 04/15] mesh: use setup completion callback to complete mesh +Date: Tue, 29 May 2018 14:39:08 -0700 +Subject: [PATCH 04/18] mesh: use setup completion callback to complete mesh join mesh join function is the last function to be called during @@ -24,7 +24,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -215,6 +215,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -217,6 +217,7 @@ static int wpa_supplicant_mesh_init(stru if (!ifmsh) return -ENOMEM; @@ -32,7 +32,7 @@ Signed-off-by: Peter Oh ifmsh->drv_flags = wpa_s->drv_flags; ifmsh->num_bss = 1; ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, -@@ -231,6 +232,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -234,6 +235,8 @@ static int wpa_supplicant_mesh_init(stru bss->drv_priv = wpa_s->drv_priv; bss->iface = ifmsh; bss->mesh_sta_free_cb = mesh_mpm_free_sta; @@ -41,7 +41,7 @@ Signed-off-by: Peter Oh frequency = ssid->frequency; if (frequency != freq->freq && frequency == freq->freq + freq->sec_channel_offset * 20) { -@@ -372,8 +375,9 @@ void wpa_supplicant_mesh_add_scan_ie(str +@@ -375,8 +378,9 @@ void wpa_supplicant_mesh_add_scan_ie(str } @@ -52,7 +52,7 @@ Signed-off-by: Peter Oh struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; struct wpa_ssid *ssid = wpa_s->current_ssid; int ret = 0; -@@ -495,7 +499,6 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -498,7 +502,6 @@ int wpa_supplicant_join_mesh(struct wpa_ goto out; } diff --git a/package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch b/package/network/services/hostapd/patches/005-mesh-reflect-country-setting-to-mesh-configuration.patch similarity index 58% rename from package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch rename to package/network/services/hostapd/patches/005-mesh-reflect-country-setting-to-mesh-configuration.patch index ba6947883..a372230d0 100644 --- a/package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch +++ b/package/network/services/hostapd/patches/005-mesh-reflect-country-setting-to-mesh-configuration.patch @@ -1,7 +1,7 @@ -From e223e851cbe776029a2768b56e7aa1a9f2873d09 Mon Sep 17 00:00:00 2001 +From dbe9afab3b2dceb35d478ac43dfcf8fdc5e23a22 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:02 -0700 -Subject: [PATCH 05/15] mesh: reflect country setting to mesh configuration +Date: Tue, 29 May 2018 14:39:09 -0700 +Subject: [PATCH 05/18] mesh: reflect country setting to mesh configuration wpa_supplicant configuration has country parameter that is supposed to be used in AP mode to indicate supporting 802.11h @@ -9,18 +9,21 @@ and 802.11d. Reflect this configuration to Mesh also since Mesh is required to support 802.11h and 802.11d to use DFS channels. Signed-off-by: Peter Oh +Signed-off-by: Daniel Golle +[daniel@makrotopia.org: adapted to changed ieee80211_is_dfs prototype] --- - wpa_supplicant/mesh.c | 8 ++++++++ - 1 file changed, 8 insertions(+) + wpa_supplicant/mesh.c | 9 +++++++++ + 1 file changed, 9 insertions(+) --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -252,6 +252,14 @@ static int wpa_supplicant_mesh_init(stru +@@ -255,6 +255,15 @@ static int wpa_supplicant_mesh_init(stru bss->conf->start_disabled = 1; bss->conf->mesh = MESH_ENABLED; bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; + -+ if (ieee80211_is_dfs(ssid->frequency) && wpa_s->conf->country[0]) { ++ if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, ++ wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { + conf->ieee80211h = 1; + conf->ieee80211d = 1; + conf->country[0] = wpa_s->conf->country[0]; diff --git a/package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch similarity index 80% rename from package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch rename to package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch index 66b956fec..fe2353cd8 100644 --- a/package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch +++ b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch @@ -1,7 +1,7 @@ -From c7f107e52205dd5fdb20f7ae13413b3673b0547e Mon Sep 17 00:00:00 2001 +From 51e759da5026b3e64f801135b5d53f2198bbd2f0 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:03 -0700 -Subject: [PATCH 06/15] mesh: inform kernel driver DFS handler in userspace +Date: Tue, 29 May 2018 14:39:10 -0700 +Subject: [PATCH 06/18] mesh: inform kernel driver DFS handler in userspace NL80211_ATTR_HANDLE_DFS is required by kerenel space to enable DFS channels that indicates DFS handler @@ -26,7 +26,7 @@ Signed-off-by: Peter Oh /** --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9244,6 +9244,9 @@ static int nl80211_join_mesh(struct i802 +@@ -9270,6 +9270,9 @@ static int nl80211_join_mesh(struct i802 wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); @@ -38,7 +38,7 @@ Signed-off-by: Peter Oh goto fail; --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -258,6 +258,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -262,6 +262,7 @@ static int wpa_supplicant_mesh_init(stru conf->ieee80211d = 1; conf->country[0] = wpa_s->conf->country[0]; conf->country[1] = wpa_s->conf->country[1]; diff --git a/package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch similarity index 70% rename from package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch rename to package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch index 9c8b2b948..de1149538 100644 --- a/package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch +++ b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch @@ -1,7 +1,7 @@ -From a0c5eea22d5d1181dbe0861b24e4b9bb598f4e50 Mon Sep 17 00:00:00 2001 +From bdc77efe681d5b88f3256e2bb6e706d4eaf09518 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:04 -0700 -Subject: [PATCH 07/15] mesh: apply channel attributes before running Mesh +Date: Tue, 29 May 2018 14:39:11 -0700 +Subject: [PATCH 07/18] mesh: apply channel attributes before running Mesh This helps mesh interface initializes with correct channel parameters. @@ -13,7 +13,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -334,6 +334,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -338,6 +338,8 @@ static int wpa_supplicant_mesh_init(stru conf->basic_rates[rate_len] = -1; } @@ -22,7 +22,7 @@ Signed-off-by: Peter Oh if (hostapd_setup_interface(ifmsh)) { wpa_printf(MSG_ERROR, "Failed to initialize hostapd interface for mesh"); -@@ -345,8 +347,6 @@ static int wpa_supplicant_mesh_init(stru +@@ -349,8 +351,6 @@ static int wpa_supplicant_mesh_init(stru return -1; } diff --git a/package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch b/package/network/services/hostapd/patches/008-mesh-set-interface-type-to-mesh-before-setting-inter.patch similarity index 79% rename from package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch rename to package/network/services/hostapd/patches/008-mesh-set-interface-type-to-mesh-before-setting-inter.patch index da47aa8d2..5b97691eb 100644 --- a/package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch +++ b/package/network/services/hostapd/patches/008-mesh-set-interface-type-to-mesh-before-setting-inter.patch @@ -1,7 +1,7 @@ -From 143809f1e60f749a5a5c72735ffa8eb99d602cc1 Mon Sep 17 00:00:00 2001 +From eb9888ba41faaeb8fd07392ad46808b7d894cc14 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:05 -0700 -Subject: [PATCH 08/15] mesh: set interface type to mesh before setting +Date: Tue, 29 May 2018 14:39:12 -0700 +Subject: [PATCH 08/18] mesh: set interface type to mesh before setting interface Correct interface type is required to start DFS CAC that can be @@ -14,7 +14,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -336,14 +336,14 @@ static int wpa_supplicant_mesh_init(stru +@@ -340,14 +340,14 @@ static int wpa_supplicant_mesh_init(stru wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); diff --git a/package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch b/package/network/services/hostapd/patches/009-mesh-set-mesh-center-frequency.patch similarity index 69% rename from package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch rename to package/network/services/hostapd/patches/009-mesh-set-mesh-center-frequency.patch index ac5e7d389..1fca7452b 100644 --- a/package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch +++ b/package/network/services/hostapd/patches/009-mesh-set-mesh-center-frequency.patch @@ -1,7 +1,7 @@ -From 4347c97600f4484be8df804dfb5ed85b867d3c43 Mon Sep 17 00:00:00 2001 +From fa3af966032267e618b19bbf06a536ddb81ddbdf Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:06 -0700 -Subject: [PATCH 09/15] mesh: set mesh center frequency +Date: Tue, 29 May 2018 14:39:13 -0700 +Subject: [PATCH 09/18] mesh: set mesh center frequency vht center frequency value is required to compose the correct channel info. @@ -12,7 +12,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -453,6 +453,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -457,6 +457,7 @@ int wpa_supplicant_join_mesh(struct wpa_ if (wpa_s->mesh_vht_enabled) { ssid->vht = 1; diff --git a/package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch b/package/network/services/hostapd/patches/010-mesh-consider-mesh-interface-on-dfs-event-handler.patch similarity index 54% rename from package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch rename to package/network/services/hostapd/patches/010-mesh-consider-mesh-interface-on-dfs-event-handler.patch index 0c78dd432..3f5178a74 100644 --- a/package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch +++ b/package/network/services/hostapd/patches/010-mesh-consider-mesh-interface-on-dfs-event-handler.patch @@ -1,32 +1,34 @@ -From d0a0e1030005834b99225feb64ec3794d31beab0 Mon Sep 17 00:00:00 2001 +From 9a8ca54a264a2820af614043e7af853166b320b0 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:07 -0700 -Subject: [PATCH 10/15] mesh: consider mesh interface on dfs event handler +Date: Tue, 29 May 2018 14:39:14 -0700 +Subject: [PATCH 10/18] mesh: consider mesh interface on dfs event handler Once mesh starts supporting DFS channels, it has to handle DFS related events from drivers, hence add mesh interface to the check list. Signed-off-by: Peter Oh +Signed-off-by: Masashi Honma --- - wpa_supplicant/ap.c | 55 ++++++++++++++++++++++++++++++++--------- - wpa_supplicant/events.c | 1 + - 2 files changed, 44 insertions(+), 12 deletions(-) + wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++----------- + wpa_supplicant/events.c | 7 ++-- + 2 files changed, 57 insertions(+), 21 deletions(-) --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1328,13 +1328,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_ +@@ -1337,13 +1337,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_ void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht, int offset, int width, int cf1, int cf2) { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface) +- if (!wpa_s->ap_iface) - return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; + ++ if (!wpa_s->ap_iface) { + if (!wpa_s->ifmsh) + return; + else + iface = wpa_s->ifmsh; - ++ } wpa_s->assoc_freq = freq; if (wpa_s->current_ssid) wpa_s->current_ssid->frequency = freq; @@ -35,91 +37,100 @@ Signed-off-by: Peter Oh offset, width, cf1, cf2); } -@@ -1531,10 +1536,15 @@ int wpas_ap_pmksa_cache_add_external(str - void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) +@@ -1540,10 +1545,16 @@ int wpas_ap_pmksa_cache_add_external(str + void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; + struct hostapd_iface *iface = wpa_s->ap_iface; + - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) + return; + else + iface = wpa_s->ifmsh; ++ } wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq); - hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq, + hostapd_dfs_radar_detected(iface, radar->freq, radar->ht_enabled, radar->chan_offset, radar->chan_width, radar->cf1, radar->cf2); -@@ -1544,10 +1554,15 @@ void wpas_event_dfs_radar_detected(struc - void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) +@@ -1553,10 +1564,16 @@ void wpas_ap_event_dfs_radar_detected(st + void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; + struct hostapd_iface *iface = wpa_s->ap_iface; + - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) + return; + else + iface = wpa_s->ifmsh; ++ } wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq); - hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq, + hostapd_dfs_start_cac(iface, radar->freq, radar->ht_enabled, radar->chan_offset, radar->chan_width, radar->cf1, radar->cf2); } -@@ -1556,10 +1571,16 @@ void wpas_event_dfs_cac_started(struct w - void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) +@@ -1565,10 +1582,16 @@ void wpas_ap_event_dfs_cac_started(struc + void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; + struct hostapd_iface *iface = wpa_s->ap_iface; + - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) + return; + else + iface = wpa_s->ifmsh; -+ ++ } wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq); - hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq, + hostapd_dfs_complete_cac(iface, 1, radar->freq, radar->ht_enabled, radar->chan_offset, radar->chan_width, radar->cf1, radar->cf2); } -@@ -1568,10 +1589,15 @@ void wpas_event_dfs_cac_finished(struct - void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) +@@ -1577,10 +1600,16 @@ void wpas_ap_event_dfs_cac_finished(stru + void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; + struct hostapd_iface *iface = wpa_s->ap_iface; + - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) + return; + else + iface = wpa_s->ifmsh; ++ } wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq); - hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq, + hostapd_dfs_complete_cac(iface, 0, radar->freq, radar->ht_enabled, radar->chan_offset, radar->chan_width, radar->cf1, radar->cf2); } -@@ -1580,10 +1606,15 @@ void wpas_event_dfs_cac_aborted(struct w - void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) +@@ -1589,10 +1618,16 @@ void wpas_ap_event_dfs_cac_aborted(struc + void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; + struct hostapd_iface *iface = wpa_s->ap_iface; + - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) + return; + else + iface = wpa_s->ifmsh; ++ } wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq); - hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq, + hostapd_dfs_nop_finished(iface, radar->freq, @@ -128,8 +139,35 @@ Signed-off-by: Peter Oh } --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4168,6 +4168,7 @@ void wpa_supplicant_event(void *ctx, enu - +@@ -3802,7 +3802,7 @@ static void wpas_event_dfs_cac_started(s + struct dfs_event *radar) + { + #if defined(NEED_AP_MLME) && defined(CONFIG_AP) +- if (wpa_s->ap_iface) { ++ if (wpa_s->ap_iface || wpa_s->ifmsh) { + wpas_ap_event_dfs_cac_started(wpa_s, radar); + } else + #endif /* NEED_AP_MLME && CONFIG_AP */ +@@ -3823,7 +3823,7 @@ static void wpas_event_dfs_cac_finished( + struct dfs_event *radar) + { + #if defined(NEED_AP_MLME) && defined(CONFIG_AP) +- if (wpa_s->ap_iface) { ++ if (wpa_s->ap_iface || wpa_s->ifmsh) { + wpas_ap_event_dfs_cac_finished(wpa_s, radar); + } else + #endif /* NEED_AP_MLME && CONFIG_AP */ +@@ -3839,7 +3839,7 @@ static void wpas_event_dfs_cac_aborted(s + struct dfs_event *radar) + { + #if defined(NEED_AP_MLME) && defined(CONFIG_AP) +- if (wpa_s->ap_iface) { ++ if (wpa_s->ap_iface || wpa_s->ifmsh) { + wpas_ap_event_dfs_cac_aborted(wpa_s, radar); + } else + #endif /* NEED_AP_MLME && CONFIG_AP */ +@@ -4278,6 +4278,7 @@ void wpa_supplicant_event(void *ctx, enu + #ifdef CONFIG_AP if (wpa_s->current_ssid->mode == WPAS_MODE_AP || wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO || + wpa_s->current_ssid->mode == WPAS_MODE_MESH || diff --git a/package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch similarity index 80% rename from package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch rename to package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch index 928ba8eb9..8f2f6a78e 100644 --- a/package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -1,7 +1,7 @@ -From e7fc5d2e6b34102282ff94a6e5255af4b6e9ccb5 Mon Sep 17 00:00:00 2001 +From bbaa6142eadf229334436fdbf51aa65bb819f771 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:08 -0700 -Subject: [PATCH 11/15] mesh: Allow DFS channels to be selected if dfs is +Date: Tue, 29 May 2018 14:39:15 -0700 +Subject: [PATCH 11/18] mesh: Allow DFS channels to be selected if dfs is enabled Note: DFS is assumed to be usable if a country code has been set @@ -14,7 +14,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2033,6 +2033,8 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2060,6 +2060,8 @@ void ibss_mesh_setup_freq(struct wpa_sup struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; u32 vht_caps = 0; @@ -23,7 +23,7 @@ Signed-off-by: Peter Oh freq->freq = ssid->frequency; -@@ -2109,8 +2111,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2136,8 +2138,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Check primary channel flags */ @@ -36,7 +36,7 @@ Signed-off-by: Peter Oh #ifdef CONFIG_HT_OVERRIDES if (ssid->disable_ht40) -@@ -2136,8 +2141,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2163,8 +2168,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Check secondary channel flags */ @@ -49,7 +49,7 @@ Signed-off-by: Peter Oh freq->channel = pri_chan->chan; -@@ -2227,8 +2235,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2254,8 +2262,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Back to HT configuration if channel not usable */ @@ -62,7 +62,7 @@ Signed-off-by: Peter Oh } chwidth = VHT_CHANWIDTH_80MHZ; -@@ -2248,10 +2259,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2275,10 +2286,11 @@ void ibss_mesh_setup_freq(struct wpa_sup if (!chan) continue; diff --git a/package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch b/package/network/services/hostapd/patches/012-mesh-allow-mesh-to-send-channel-switch-request.patch similarity index 72% rename from package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch rename to package/network/services/hostapd/patches/012-mesh-allow-mesh-to-send-channel-switch-request.patch index b011a3c35..793f4f5db 100644 --- a/package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch +++ b/package/network/services/hostapd/patches/012-mesh-allow-mesh-to-send-channel-switch-request.patch @@ -1,7 +1,7 @@ -From 851f67301a8b9bc96c3d8cce08e355a64d30350d Mon Sep 17 00:00:00 2001 +From 4a8245ec2e9d48e464488477a3e7ed234009c216 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:09 -0700 -Subject: [PATCH 12/15] mesh: allow mesh to send channel switch request +Date: Tue, 29 May 2018 14:39:16 -0700 +Subject: [PATCH 12/18] mesh: allow mesh to send channel switch request add mesh type to nl80211 channel switch request, so mesh is able to send the request to kernel drivers. @@ -13,7 +13,7 @@ Signed-off-by: Peter Oh --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -8659,7 +8659,8 @@ static int nl80211_switch_channel(void * +@@ -8685,7 +8685,8 @@ static int nl80211_switch_channel(void * } if ((drv->nlmode != NL80211_IFTYPE_AP) && diff --git a/package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch similarity index 75% rename from package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch rename to package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch index 988ccdbeb..2d818b083 100644 --- a/package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch +++ b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch @@ -1,7 +1,7 @@ -From 5fe4fa1c1f426d81496458d2127bfbd7623fe5d5 Mon Sep 17 00:00:00 2001 +From 267395271c1a36b54ef21070acff2cadce241035 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:10 -0700 -Subject: [PATCH 13/15] mesh: do not allow pri/sec channel switch +Date: Tue, 29 May 2018 14:39:17 -0700 +Subject: [PATCH 13/18] mesh: do not allow pri/sec channel switch We don't want mesh to switch the channel from primary to secondary, since mesh points are not able to join each other in that case. @@ -13,7 +13,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -333,7 +333,10 @@ static int wpa_supplicant_mesh_init(stru +@@ -337,7 +337,10 @@ static int wpa_supplicant_mesh_init(stru rate_len * sizeof(int)); conf->basic_rates[rate_len] = -1; } diff --git a/package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch b/package/network/services/hostapd/patches/014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch similarity index 72% rename from package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch rename to package/network/services/hostapd/patches/014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch index 2545cb4a1..b16e762bb 100644 --- a/package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch +++ b/package/network/services/hostapd/patches/014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch @@ -1,7 +1,7 @@ -From fcc5fe675d1155d65df0471aa06f746c28b66b6c Mon Sep 17 00:00:00 2001 +From f95897cef614fff710c31d9e478eacc85d6312d5 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:11 -0700 -Subject: [PATCH 14/15] mesh: do not allow scan result to swap pri/sec +Date: Tue, 29 May 2018 14:39:18 -0700 +Subject: [PATCH 14/18] mesh: do not allow scan result to swap pri/sec Swapping between primary and secondary channel will break mesh from joining, hence don't allow it. @@ -13,7 +13,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2158,7 +2158,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2185,7 +2185,7 @@ void ibss_mesh_setup_freq(struct wpa_sup } freq->sec_channel_offset = ht40; diff --git a/package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch similarity index 51% rename from package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch rename to package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch index 76b4fe64c..148e90d85 100644 --- a/package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch +++ b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch @@ -1,35 +1,44 @@ -From ab2ba9fd9ac73c83dc15a6d76d93df4434d539d6 Mon Sep 17 00:00:00 2001 +From 9423e8be0393e82c8622806a0529e47fd5583c0b Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:12 -0700 -Subject: [PATCH 15/15] mesh: do not use offchan mgmt tx on DFS +Date: Tue, 29 May 2018 14:39:19 -0700 +Subject: [PATCH 15/18] mesh: do not use offchan mgmt tx on DFS Drivers don't allow mesh to use offchannel on management Tx. Signed-off-by: Peter Oh +Signed-off-by: Daniel Golle +[daniel@makrotopia.org: adapted to changed ieee80211_is_dfs prototype] --- - src/drivers/driver_nl80211.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) + src/drivers/driver_nl80211.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -7148,6 +7148,7 @@ static int wpa_driver_nl80211_send_actio +@@ -7165,6 +7165,10 @@ static int wpa_driver_nl80211_send_actio struct wpa_driver_nl80211_data *drv = bss->drv; int ret = -1; u8 *buf; + int offchanok = 1; ++ u16 num_modes, flags; ++ struct hostapd_hw_modes *modes; ++ u8 dfs_domain; struct ieee80211_hdr *hdr; wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, " -@@ -7173,6 +7174,8 @@ static int wpa_driver_nl80211_send_actio +@@ -7189,7 +7193,11 @@ static int wpa_driver_nl80211_send_actio + } else { os_memset(bss->rand_addr, 0, ETH_ALEN); } - -+ if (is_mesh_interface(drv->nlmode) && ieee80211_is_dfs(freq)) +- ++ if (is_mesh_interface(drv->nlmode) && ++ (modes = nl80211_get_hw_feature_data(bss, &num_modes, &flags, ++ &dfs_domain)) && ++ ieee80211_is_dfs(freq, modes, num_modes)) + offchanok = 0; if (is_ap_interface(drv->nlmode) && (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || (int) freq == bss->freq || drv->device_ap_sme || -@@ -7184,7 +7187,7 @@ static int wpa_driver_nl80211_send_actio +@@ -7201,7 +7209,7 @@ static int wpa_driver_nl80211_send_actio ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, 24 + data_len, &drv->send_action_cookie, diff --git a/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch b/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch new file mode 100644 index 000000000..5071ae515 --- /dev/null +++ b/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch @@ -0,0 +1,64 @@ +From fa9d565fe8841b288f29137c23a7ab2584dd9510 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 29 May 2018 14:39:20 -0700 +Subject: [PATCH 16/18] mesh: fix channel switch error during CAC + +Mesh interface has used its channel parameters that configured +during its initialization even after channel switched due to +DFS radar detection during CAC which caused channel switch error. +This change fixes the error by updating its channel parameters +when channel's been changed from initial one. + +Signed-off-by: Peter Oh +Signed-off-by: Daniel Golle +[daniel@makrotopia.org: added hw_features_common.h include] +--- + wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -11,6 +11,7 @@ + #include "utils/common.h" + #include "utils/eloop.h" + #include "utils/uuid.h" ++#include "common/hw_features_common.h" + #include "common/ieee802_11_defs.h" + #include "common/wpa_ctrl.h" + #include "ap/sta_info.h" +@@ -394,10 +395,35 @@ void wpa_supplicant_mesh_add_scan_ie(str + void wpas_mesh_complete_cb(void *ctx) + { + struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx; ++ struct hostapd_iface *ifmsh = wpa_s->ifmsh; + struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; + struct wpa_ssid *ssid = wpa_s->current_ssid; + int ret = 0; + ++ /* ++ * inspect if channel's been changed since initialized. ++ * i.e. DFS radar detection ++ */ ++ if (ifmsh->freq != params->freq.freq) { ++ wpa_s->assoc_freq = ifmsh->freq; ++ ssid->frequency = ifmsh->freq; ++ if (hostapd_set_freq_params(¶ms->freq, ++ ifmsh->conf->hw_mode, ++ ifmsh->freq, ++ ifmsh->conf->channel, ++ ifmsh->conf->ieee80211n, ++ ifmsh->conf->ieee80211ac, ++ ifmsh->conf->secondary_channel, ++ ifmsh->conf->vht_oper_chwidth, ++ ifmsh->conf->vht_oper_centr_freq_seg0_idx, ++ ifmsh->conf->vht_oper_centr_freq_seg1_idx, ++ ifmsh->conf->vht_capab)) { ++ wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); ++ wpa_supplicant_mesh_deinit(wpa_s); ++ return; ++ } ++ } ++ + if (wpas_mesh_init_rsn(wpa_s)) { + wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh..."); + wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/017-mesh-use-right-interface-context-to-send-DFS-event-m.patch b/package/network/services/hostapd/patches/017-mesh-use-right-interface-context-to-send-DFS-event-m.patch new file mode 100644 index 000000000..a4073bb9f --- /dev/null +++ b/package/network/services/hostapd/patches/017-mesh-use-right-interface-context-to-send-DFS-event-m.patch @@ -0,0 +1,107 @@ +From d3201adfe7d2219217a07ef16ef365ad59c1a89b Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 29 May 2018 14:39:21 -0700 +Subject: [PATCH 17/18] mesh: use right interface context to send DFS event + messages + +use mesh interface context to send DFS event messages when +DFS events are on mesh interface. + +Signed-off-by: Peter Oh +Signed-off-by: Masashi Honma +--- + src/ap/dfs.c | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -637,6 +637,17 @@ static unsigned int dfs_get_cac_time(str + } + + ++static void *get_message_ctx(struct hostapd_iface *iface) ++{ ++#ifdef CONFIG_MESH ++ if (iface->mconf) ++ return iface->owner; ++#endif /* CONFIG_MESH */ ++ ++ return iface->bss[0]->msg_ctx; ++} ++ ++ + /* + * Main DFS handler + * 1 - continue channel/ap setup +@@ -719,7 +730,7 @@ int hostapd_handle_dfs(struct hostapd_if + /* Finally start CAC */ + hostapd_set_state(iface, HAPD_IFACE_DFS); + wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq); +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START + "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds", + iface->freq, + iface->conf->channel, iface->conf->secondary_channel, +@@ -768,7 +779,7 @@ int hostapd_dfs_complete_cac(struct host + int ht_enabled, int chan_offset, int chan_width, + int cf1, int cf2) + { +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_COMPLETED + "success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + +@@ -810,7 +821,7 @@ int hostapd_dfs_pre_cac_expired(struct h + int ht_enabled, int chan_offset, int chan_width, + int cf1, int cf2) + { +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED + "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + +@@ -848,7 +859,7 @@ static int hostapd_dfs_start_channel_swi + + wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d", + channel->chan); +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL + "freq=%d chan=%d sec_chan=%d", channel->freq, + channel->chan, secondary_channel); + +@@ -935,7 +946,7 @@ static int hostapd_dfs_start_channel_swi + + wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d", + channel->chan); +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL + "freq=%d chan=%d sec_chan=%d", channel->freq, + channel->chan, secondary_channel); + +@@ -997,7 +1008,7 @@ int hostapd_dfs_radar_detected(struct ho + { + int res; + +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_RADAR_DETECTED + "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + +@@ -1028,7 +1039,7 @@ int hostapd_dfs_nop_finished(struct host + int ht_enabled, int chan_offset, int chan_width, + int cf1, int cf2) + { +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NOP_FINISHED + "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + +@@ -1078,7 +1089,7 @@ int hostapd_dfs_start_cac(struct hostapd + int ht_enabled, int chan_offset, int chan_width, + int cf1, int cf2) + { +- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START ++ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START + "freq=%d chan=%d chan_offset=%d width=%d seg0=%d " + "seg1=%d cac_time=%ds", + freq, (freq - 5000) / 5, chan_offset, chan_width, cf1, cf2, 60); diff --git a/package/network/services/hostapd/patches/021-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch similarity index 84% rename from package/network/services/hostapd/patches/021-mesh-make-forwarding-configurable.patch rename to package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch index 13f0deaaf..e54bc5e15 100644 --- a/package/network/services/hostapd/patches/021-mesh-make-forwarding-configurable.patch +++ b/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch @@ -1,10 +1,7 @@ -From d11881c1ad0d6a102962d1a040a398f597256ae0 Mon Sep 17 00:00:00 2001 +From 90fe6429624fc48bc0e5d2d7eeecb7498708b5e3 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 18 Apr 2018 19:24:31 +0200 -Subject: [PATCH] mesh: make forwarding configurable -To: hostap@lists.infradead.org -Cc: Jouni Malinen , - Johannes Berg +Subject: [PATCH 18/18] mesh: make forwarding configurable Allow mesh_fwding to be specified in a mesh bss config, pass that to the driver (only nl80211 implemented for now) and announce @@ -16,13 +13,13 @@ Signed-off-by: Daniel Golle src/drivers/driver.h | 2 ++ src/drivers/driver_nl80211.c | 3 +++ wpa_supplicant/config.c | 4 ++++ - wpa_supplicant/config.h | 3 +++ + wpa_supplicant/config.h | 9 +++++++++ wpa_supplicant/config_file.c | 4 ++++ wpa_supplicant/config_ssid.h | 5 +++++ wpa_supplicant/mesh.c | 6 ++++++ wpa_supplicant/mesh_mpm.c | 4 ++-- - wpa_supplicant/wpa_supplicant.conf | 6 ++++++ - 10 files changed, 37 insertions(+), 2 deletions(-) + wpa_supplicant/wpa_supplicant.conf | 3 +++ + 10 files changed, 40 insertions(+), 2 deletions(-) --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -34,7 +31,7 @@ Signed-off-by: Daniel Golle }; #define MAX_STA_COUNT 2007 -@@ -612,6 +613,7 @@ struct hostapd_bss_config { +@@ -624,6 +625,7 @@ struct hostapd_bss_config { #define MESH_ENABLED BIT(0) int mesh; @@ -62,7 +59,7 @@ Signed-off-by: Daniel Golle --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9197,6 +9197,9 @@ static int nl80211_put_mesh_config(struc +@@ -9228,6 +9228,9 @@ static int nl80211_put_mesh_config(struc if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, params->auto_plinks)) || @@ -74,7 +71,7 @@ Signed-off-by: Daniel Golle params->max_peer_links)) || --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2211,6 +2211,7 @@ static const struct parse_data ssid_fiel +@@ -2212,6 +2212,7 @@ static const struct parse_data ssid_fiel #ifdef CONFIG_MESH { INT_RANGE(mode, 0, 5) }, { INT_RANGE(no_auto_peer, 0, 1) }, @@ -82,7 +79,7 @@ Signed-off-by: Daniel Golle { INT_RANGE(mesh_rssi_threshold, -255, 1) }, #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, -@@ -2757,6 +2758,7 @@ void wpa_config_set_network_defaults(str +@@ -2763,6 +2764,7 @@ void wpa_config_set_network_defaults(str ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; @@ -90,7 +87,7 @@ Signed-off-by: Daniel Golle ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; #endif /* CONFIG_MESH */ #ifdef CONFIG_HT_OVERRIDES -@@ -3886,6 +3888,7 @@ struct wpa_config * wpa_config_alloc_emp +@@ -3978,6 +3980,7 @@ struct wpa_config * wpa_config_alloc_emp config->user_mpm = DEFAULT_USER_MPM; config->max_peer_links = DEFAULT_MAX_PEER_LINKS; config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; @@ -98,7 +95,7 @@ Signed-off-by: Daniel Golle config->dot11RSNASAERetransPeriod = DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; config->fast_reauth = DEFAULT_FAST_REAUTH; -@@ -4508,6 +4511,7 @@ static const struct global_parse_data gl +@@ -4600,6 +4603,7 @@ static const struct global_parse_data gl { INT(user_mpm), 0 }, { INT_RANGE(max_peer_links, 0, 255), 0 }, { INT(mesh_max_inactivity), 0 }, @@ -116,18 +113,24 @@ Signed-off-by: Daniel Golle /* * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, * but use 1000 ms in practice to avoid issues on low power CPUs. -@@ -1269,6 +1270,8 @@ struct wpa_config { - */ +@@ -1306,6 +1307,14 @@ struct wpa_config { int mesh_max_inactivity; + /** ++ * mesh_fwding - Mesh network layer-2 forwarding ++ * ++ * This controls whether to enable layer-2 forwarding. ++ * By default: 1: enabled ++ */ + int mesh_fwding; + - /** ++ /** * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame * + * This timeout value is used in mesh STA to retransmit --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -816,6 +816,7 @@ static void wpa_config_write_network(FIL +@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); @@ -135,7 +138,7 @@ Signed-off-by: Daniel Golle INT(frequency); INT(fixed_freq); #ifdef CONFIG_ACS -@@ -1433,6 +1434,9 @@ static void wpa_config_write_global(FILE +@@ -1450,6 +1451,9 @@ static void wpa_config_write_global(FILE fprintf(f, "mesh_max_inactivity=%d\n", config->mesh_max_inactivity); @@ -147,7 +150,7 @@ Signed-off-by: Daniel Golle fprintf(f, "dot11RSNASAERetransPeriod=%d\n", --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -492,6 +492,11 @@ struct wpa_ssid { +@@ -500,6 +500,11 @@ struct wpa_ssid { int dot11MeshConfirmTimeout; /* msec */ int dot11MeshHoldingTimeout; /* msec */ @@ -175,9 +178,9 @@ Signed-off-by: Daniel Golle bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; + bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; - if (ieee80211_is_dfs(ssid->frequency) && wpa_s->conf->country[0]) { - conf->ieee80211h = 1; -@@ -508,6 +510,10 @@ int wpa_supplicant_join_mesh(struct wpa_ + if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, + wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { +@@ -534,6 +536,10 @@ int wpa_supplicant_join_mesh(struct wpa_ } params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; @@ -204,15 +207,12 @@ Signed-off-by: Daniel Golle wpabuf_put_u8(buf, WLAN_EID_MESH_ID); --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf -@@ -153,6 +153,12 @@ ap_scan=1 +@@ -153,6 +153,9 @@ ap_scan=1 # This timeout value is used in mesh STA to clean up inactive stations. #mesh_max_inactivity=300 +# Enable 802.11s layer-2 routing and forwarding +#mesh_fwding=1 -+ -+# Accept additional peer links -+#mesh_auto_open_plinks=1 + # cert_in_cb - Whether to include a peer certificate dump in events # This controls whether peer certificates for authentication server and diff --git a/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch b/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch deleted file mode 100644 index 775774bf6..000000000 --- a/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 30c1693f42326d4f927e76120492bc9593b8f739 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Fri, 13 Apr 2018 00:42:10 +0200 -Subject: [PATCH] mesh: properly handle sae_password - -The recently introduced sae_password parameter is only handled properly -in wpa_supplicant/sme.c while wpa_supplicant/mesh.c assumed that -ssid->passphrase exclusively holds the secret. -Import the logic from sme.c to mesh.c to allow having only sae_password -set which otherwise throws this error: -AP-ENABLED -mesh: Passphrase for SAE not configured -Init RSN failed. Deinit mesh... -wlan1: interface state ENABLED->DISABLED -AP-DISABLED -Segmentation fault - -Signed-off-by: Daniel Golle ---- - wpa_supplicant/mesh.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -154,10 +154,14 @@ int wpas_mesh_init_rsn(struct wpa_suppli - struct wpa_ssid *ssid = wpa_s->current_ssid; - struct hostapd_data *bss = ifmsh->bss[0]; - static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; -+ const char *password; - size_t len; - - if (mconf->security != MESH_CONF_SEC_NONE) { -- if (ssid->passphrase == NULL) { -+ password = ssid->sae_password; -+ if (!password) -+ password = ssid->passphrase; -+ if (!password) { - wpa_printf(MSG_ERROR, - "mesh: Passphrase for SAE not configured"); - return -1; -@@ -177,9 +181,9 @@ int wpas_mesh_init_rsn(struct wpa_suppli - return -1; - } - -- len = os_strlen(ssid->passphrase); -+ len = os_strlen(password); - bss->conf->ssid.wpa_passphrase = -- dup_binstr(ssid->passphrase, len); -+ dup_binstr(password, len); - - wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); - if (!wpa_s->mesh_rsn) diff --git a/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch b/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch index bbc4672f9..56554ef02 100644 --- a/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch +++ b/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -216,7 +216,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -215,7 +215,7 @@ static int wpa_supplicant_mesh_init(stru return 0; } diff --git a/package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch b/package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch deleted file mode 100644 index db6ec04b3..000000000 --- a/package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/src/rsn_supp/pmksa_cache.h -+++ b/src/rsn_supp/pmksa_cache.h -@@ -101,7 +101,7 @@ static inline void pmksa_cache_deinit(st - - static inline struct rsn_pmksa_cache_entry * - pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid, -- const void *network_ctx) -+ const void *network_ctx, int akmp) - { - return NULL; - } -@@ -148,7 +148,8 @@ static inline int pmksa_cache_set_curren - const u8 *bssid, - void *network_ctx, - int try_opportunistic, -- const u8 *fils_cache_id) -+ const u8 *fils_cache_id, -+ int akmp) - { - return -1; - } diff --git a/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch b/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch index 8ff11f319..925a53818 100644 --- a/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch +++ b/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2796,6 +2796,7 @@ void wpa_config_set_network_defaults(str +@@ -2802,6 +2802,7 @@ void wpa_config_set_network_defaults(str ssid->mka_priority = DEFAULT_PRIO_NOT_KEY_SERVER; #endif /* CONFIG_MACSEC */ ssid->mac_addr = -1; @@ -37,7 +37,7 @@ Signed-off-by: Peter Oh struct dl_list list; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2285,6 +2285,9 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2312,6 +2312,9 @@ void ibss_mesh_setup_freq(struct wpa_sup vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; seg0 = 114; } diff --git a/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch b/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch index bd28fb8de..083bdfe1d 100644 --- a/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch +++ b/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch @@ -33,7 +33,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2117,9 +2117,15 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2144,9 +2144,15 @@ void ibss_mesh_setup_freq(struct wpa_sup if (!dfs_enabled) return; @@ -51,7 +51,7 @@ Signed-off-by: Peter Oh #endif /* CONFIG_HT_OVERRIDES */ /* Check/setup HT40+/HT40- */ -@@ -2147,8 +2153,6 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2174,8 +2180,6 @@ void ibss_mesh_setup_freq(struct wpa_sup if (!dfs_enabled) return; @@ -60,7 +60,7 @@ Signed-off-by: Peter Oh if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) return; -@@ -2192,6 +2196,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2219,6 +2223,7 @@ void ibss_mesh_setup_freq(struct wpa_sup wpa_scan_results_free(scan_res); } @@ -68,7 +68,7 @@ Signed-off-by: Peter Oh wpa_printf(MSG_DEBUG, "IBSS/mesh: setup freq channel %d, sec_channel_offset %d", freq->channel, freq->sec_channel_offset); -@@ -2287,7 +2292,10 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2314,7 +2319,10 @@ void ibss_mesh_setup_freq(struct wpa_sup } } else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) { chwidth = VHT_CHANWIDTH_USE_HT; diff --git a/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch b/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch index 6c9f6a724..cb922ba1e 100644 --- a/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch +++ b/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch @@ -34,7 +34,7 @@ Forwarded: https://patchwork.ozlabs.org/patch/909751/ --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -503,7 +503,7 @@ struct wpa_ssid { +@@ -511,7 +511,7 @@ struct wpa_ssid { int vht; diff --git a/package/network/services/hostapd/patches/110-no_eapol_fix.patch b/package/network/services/hostapd/patches/110-no_eapol_fix.patch index b8e057e2f..ac53cbc92 100644 --- a/package/network/services/hostapd/patches/110-no_eapol_fix.patch +++ b/package/network/services/hostapd/patches/110-no_eapol_fix.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -272,9 +272,10 @@ void wpa_supplicant_cancel_auth_timeout( +@@ -292,9 +292,10 @@ void wpa_supplicant_cancel_auth_timeout( */ void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s) { diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 9f476210f..273af644c 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1270,6 +1276,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1274,6 +1280,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) BCHECK=../src/drivers/build.hostapd @@ -49,7 +49,7 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1315,6 +1327,12 @@ ifeq ($(CONFIG_TLS), linux) +@@ -1316,6 +1328,12 @@ ifeq ($(CONFIG_TLS), linux) HOBJS += ../src/crypto/crypto_linux.o endif @@ -128,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1887,6 +1904,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1888,6 +1905,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -141,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1989,6 +2012,12 @@ endif +@@ -1990,6 +2013,12 @@ endif -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@ @$(E) " sed" $< @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5430,8 +5430,8 @@ union wpa_event_data { +@@ -5449,8 +5449,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -5443,7 +5443,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5462,7 +5462,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,8 +178,8 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1473,8 +1473,8 @@ static void hostapd_event_dfs_cac_starte - #endif /* NEED_AP_MLME */ +@@ -1515,8 +1515,8 @@ static void hostapd_event_wds_sta_interf + } -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -1694,7 +1694,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1742,7 +1742,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -3812,8 +3812,8 @@ static void wpa_supplicant_event_assoc_a +@@ -3976,8 +3976,8 @@ static void wpas_event_assoc_reject(stru } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -4632,7 +4632,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -4745,7 +4745,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5736,7 +5736,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -5797,7 +5797,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -5773,6 +5772,11 @@ static int wpa_supplicant_match_existing +@@ -5834,6 +5833,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -6029,6 +6033,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -6090,6 +6094,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index d5cf84fb3..4463c75c9 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3131,6 +3131,10 @@ static int hostapd_config_fill(struct ho +@@ -3214,6 +3214,10 @@ static int hostapd_config_fill(struct ho } #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -763,6 +763,8 @@ struct hostapd_config { +@@ -775,6 +775,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index b2c59bc5b..0c42d2b11 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2216,6 +2216,7 @@ static const struct parse_data ssid_fiel +@@ -2217,6 +2217,7 @@ static const struct parse_data ssid_fiel #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -10,7 +10,7 @@ { STR(id_str) }, --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -816,6 +816,7 @@ static void wpa_config_write_network(FIL +@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); @@ -20,7 +20,7 @@ INT(fixed_freq); --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -287,6 +287,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -288,6 +288,8 @@ static int wpa_supplicant_mesh_init(stru frequency); goto out_free; } @@ -31,7 +31,7 @@ if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2024,12 +2024,12 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2051,12 +2051,12 @@ void ibss_mesh_setup_freq(struct wpa_sup { enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; @@ -46,7 +46,7 @@ unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2099,7 +2099,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2126,7 +2126,7 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Setup higher BW only for 5 GHz */ @@ -57,7 +57,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -835,6 +835,8 @@ struct wpa_ssid { +@@ -856,6 +856,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index f504ba805..1fb05401f 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4187,7 +4187,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -4248,7 +4248,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index 87c30976d..d46f5144d 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -90,6 +90,25 @@ static void hostapd_reload_bss(struct ho +@@ -93,6 +93,25 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; @@ -26,7 +26,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -168,6 +187,7 @@ int hostapd_reload_config(struct hostapd +@@ -171,6 +190,7 @@ int hostapd_reload_config(struct hostapd struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -34,7 +34,7 @@ if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -189,21 +209,20 @@ int hostapd_reload_config(struct hostapd +@@ -192,21 +212,20 @@ int hostapd_reload_config(struct hostapd oldconf = hapd->iconf; iface->conf = newconf; diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index 2cf92c8a1..9d7a2a443 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -27,7 +27,7 @@ } -@@ -7040,8 +7045,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -7057,8 +7062,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -7415,7 +7418,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -7437,7 +7440,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -7435,7 +7437,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -7457,7 +7459,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index e7fc814d6..07faead2c 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -78,7 +78,7 @@ #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -3026,6 +3083,8 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3031,6 +3088,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -89,7 +89,7 @@ #ifdef RADIUS_SERVER --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -857,7 +857,13 @@ int hostapd_parse_csa_settings(const cha +@@ -864,7 +864,13 @@ int hostapd_parse_csa_settings(const cha int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index 2f0c31848..58a004484 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -30,7 +30,7 @@ #include "drivers/driver.h" #include "eap_peer/eap.h" #include "wpa_supplicant_i.h" -@@ -290,6 +291,10 @@ void calculate_update_time(const struct +@@ -292,6 +293,10 @@ void calculate_update_time(const struct static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, struct os_reltime *fetch_time) { @@ -41,7 +41,7 @@ dst->flags = src->flags; os_memcpy(dst->bssid, src->bssid, ETH_ALEN); dst->freq = src->freq; -@@ -302,6 +307,15 @@ static void wpa_bss_copy_res(struct wpa_ +@@ -304,6 +309,15 @@ static void wpa_bss_copy_res(struct wpa_ dst->est_throughput = src->est_throughput; dst->snr = src->snr; @@ -59,7 +59,7 @@ --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -80,6 +80,10 @@ struct wpa_bss { +@@ -81,6 +81,10 @@ struct wpa_bss { u8 ssid[SSID_MAX_LEN]; /** Length of SSID */ size_t ssid_len; @@ -166,7 +166,7 @@ /* Configure default/group WEP keys for static WEP */ int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { -@@ -893,12 +942,16 @@ void wpa_supplicant_set_state(struct wpa +@@ -913,12 +962,16 @@ void wpa_supplicant_set_state(struct wpa sme_sched_obss_scan(wpa_s, 1); @@ -183,7 +183,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -1920,6 +1973,8 @@ void wpa_supplicant_associate(struct wpa +@@ -1947,6 +2000,8 @@ void wpa_supplicant_associate(struct wpa wpa_ssid_txt(ssid->ssid, ssid->ssid_len), ssid->id); wpas_notify_mesh_group_started(wpa_s, ssid); @@ -192,7 +192,7 @@ #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -5362,6 +5417,16 @@ static int wpa_supplicant_init_iface(str +@@ -5423,6 +5478,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -209,7 +209,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -5683,6 +5748,11 @@ static void wpa_supplicant_deinit_iface( +@@ -5744,6 +5809,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 93ac40e9b..12689eab5 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2852,6 +2852,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2857,6 +2857,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -2893,6 +2894,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2898,6 +2899,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -9809,6 +9809,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9825,6 +9825,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -9816,6 +9817,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9832,6 +9833,7 @@ char * wpa_supplicant_ctrl_iface_process reply + reply_len, reply_size - reply_len); } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -10297,6 +10299,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10313,6 +10315,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -10305,12 +10308,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10321,12 +10324,15 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); @@ -101,7 +101,7 @@ static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen, size_t curr_len, const u8 *mcs_set) -@@ -408,6 +409,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -415,6 +416,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -109,7 +109,7 @@ #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -746,12 +748,12 @@ int hostapd_ctrl_iface_status(struct hos +@@ -753,12 +755,12 @@ int hostapd_ctrl_iface_status(struct hos return len; len += ret; } @@ -126,7 +126,7 @@ if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2504,6 +2504,7 @@ static const char * bool_txt(Boolean val +@@ -2555,6 +2555,7 @@ static const char * bool_txt(Boolean val return val ? "TRUE" : "FALSE"; } @@ -134,7 +134,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2679,6 +2680,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2730,6 +2731,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -182,7 +182,7 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1170,7 +1170,7 @@ int wpas_ap_wps_nfc_report_handover(stru +@@ -1179,7 +1179,7 @@ int wpas_ap_wps_nfc_report_handover(stru #endif /* CONFIG_WPS */ diff --git a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch new file mode 100644 index 000000000..81e6588e7 --- /dev/null +++ b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch @@ -0,0 +1,13 @@ +--- a/hostapd/hostapd_cli.c ++++ b/hostapd/hostapd_cli.c +@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd, + } + + buf[len] = '\0'; +- if (memcmp(buf, "FAIL", 4) == 0) ++ if (memcmp(buf, "FAIL", 4) == 0 || memcmp(buf, "UNKNOWN COMMAND", 15) == 0) + return -1; + if (print) + printf("%s", buf); +-- +2.11.0 diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch index c1882d84a..29dc0832e 100644 --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch @@ -1,6 +1,22 @@ --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -417,7 +417,6 @@ static int hostapd_cli_cmd_sa_query(stru +@@ -385,7 +385,6 @@ static int hostapd_cli_cmd_disassociate( + } + + +-#ifdef CONFIG_TAXONOMY + static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, + char *argv[]) + { +@@ -398,7 +397,6 @@ static int hostapd_cli_cmd_signature(str + os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); + return wpa_ctrl_command(ctrl, buf); + } +-#endif /* CONFIG_TAXONOMY */ + + + #ifdef CONFIG_IEEE80211W +@@ -417,7 +415,6 @@ static int hostapd_cli_cmd_sa_query(stru #endif /* CONFIG_IEEE80211W */ @@ -8,7 +24,7 @@ static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -643,7 +642,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -643,7 +640,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -16,7 +32,15 @@ static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1518,7 +1516,6 @@ static const struct hostapd_cli_cmd host +@@ -1510,15 +1506,12 @@ static const struct hostapd_cli_cmd host + { "disassociate", hostapd_cli_cmd_disassociate, + hostapd_complete_stations, + " = disassociate a station" }, +-#ifdef CONFIG_TAXONOMY + { "signature", hostapd_cli_cmd_signature, hostapd_complete_stations, + " = get taxonomy signature for a station" }, +-#endif /* CONFIG_TAXONOMY */ + #ifdef CONFIG_IEEE80211W { "sa_query", hostapd_cli_cmd_sa_query, hostapd_complete_stations, " = send SA Query to a station" }, #endif /* CONFIG_IEEE80211W */ @@ -24,7 +48,7 @@ { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1543,7 +1540,6 @@ static const struct hostapd_cli_cmd host +@@ -1543,7 +1536,6 @@ static const struct hostapd_cli_cmd host " = configure AP" }, { "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL, "= show current WPS status" }, diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index a8ae70196..81ad81c39 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2281,6 +2373,8 @@ static const struct parse_data ssid_fiel +@@ -2282,6 +2374,8 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -749,6 +751,9 @@ struct wpa_ssid { +@@ -757,6 +759,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3000,6 +3000,12 @@ static void wpas_start_assoc_cb(struct w +@@ -3061,6 +3061,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index 6216bf500..12cbd993a 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich /** --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9217,6 +9217,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -9248,6 +9248,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -9278,6 +9290,7 @@ static int nl80211_join_mesh(struct i802 +@@ -9309,6 +9321,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || @@ -58,7 +58,7 @@ Tested-by: Simon Wunderlich --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -456,6 +456,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -482,6 +482,7 @@ int wpa_supplicant_join_mesh(struct wpa_ params->meshid = ssid->ssid; params->meshid_len = ssid->ssid_len; diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index df056f207..f630894c9 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2097,11 +2097,13 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2124,11 +2124,13 @@ void ibss_mesh_setup_freq(struct wpa_sup for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch new file mode 100644 index 000000000..a65ad9c7f --- /dev/null +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -0,0 +1,50 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -1290,14 +1290,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) + @$(AR) cr $@ hostapd_multi.o $(OBJS) + + hostapd: $(BCHECK) $(OBJS) +- $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) ++ +$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + @$(E) " LD " $@ + + ifdef CONFIG_WPA_TRACE + OBJS_c += ../src/utils/trace.o + endif + hostapd_cli: $(OBJS_c) +- $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) ++ +$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) + @$(E) " LD " $@ + + NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1921,23 +1921,23 @@ wpa_supplicant_multi.a: .config $(BCHECK + @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) + + wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) +- $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) ++ +$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) + @$(E) " LD " $@ + + eapol_test: $(OBJS_t) +- $(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS) ++ +$(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS) + @$(E) " LD " $@ + + preauth_test: $(OBJS_t2) +- $(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS) ++ +$(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS) + @$(E) " LD " $@ + + wpa_passphrase: $(OBJS_p) +- $(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS) ++ +$(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS) + @$(E) " LD " $@ + + wpa_cli: $(OBJS_c) +- $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) ++ +$(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) + @$(E) " LD " $@ + + LIBCTRL += ../src/common/wpa_ctrl.o diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 91c5c411d..cb2c54d57 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -30,16 +30,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -392,6 +394,8 @@ struct hostapd_iface { - struct hostapd_config *conf; - char phy[16]; /* Name of the PHY (radio) */ - -+ struct hostapd_ubus_iface ubus; -+ - enum hostapd_iface_state { - HAPD_IFACE_UNINITIALIZED, - HAPD_IFACE_DISABLED, -@@ -544,6 +548,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -544,6 +546,7 @@ hostapd_alloc_bss_data(struct hostapd_if struct hostapd_bss_config *bss); int hostapd_setup_interface(struct hostapd_iface *iface); int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); @@ -49,7 +40,7 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -312,6 +312,7 @@ static void hostapd_free_hapd_data(struc +@@ -315,6 +315,7 @@ static void hostapd_free_hapd_data(struc hapd->started = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -57,7 +48,7 @@ iapp_deinit(hapd->iapp); hapd->iapp = NULL; accounting_deinit(hapd); -@@ -1189,6 +1190,8 @@ static int hostapd_setup_bss(struct host +@@ -1237,6 +1238,8 @@ static int hostapd_setup_bss(struct host if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -66,7 +57,7 @@ return 0; } -@@ -1603,7 +1606,7 @@ static enum nr_chan_width hostapd_get_nr +@@ -1651,7 +1654,7 @@ static enum nr_chan_width hostapd_get_nr #endif /* NEED_AP_MLME */ @@ -75,7 +66,7 @@ { #ifdef NEED_AP_MLME u16 capab = hostapd_own_capab_info(hapd); -@@ -1810,6 +1813,7 @@ static int hostapd_setup_interface_compl +@@ -1872,6 +1875,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -83,7 +74,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->conf->channel) { #ifdef NEED_AP_MLME -@@ -1990,6 +1994,7 @@ dfs_offload: +@@ -2052,6 +2056,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -91,7 +82,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); #ifdef CONFIG_FST -@@ -2444,6 +2449,7 @@ void hostapd_interface_deinit_free(struc +@@ -2517,6 +2522,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -101,7 +92,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -1682,12 +1682,13 @@ ieee802_11_set_radius_info(struct hostap +@@ -1712,12 +1712,13 @@ ieee802_11_set_radius_info(struct hostap static void handle_auth(struct hostapd_data *hapd, @@ -117,7 +108,7 @@ u16 fc; const u8 *challenge = NULL; u32 session_timeout, acct_interim_interval; -@@ -1698,6 +1699,11 @@ static void handle_auth(struct hostapd_d +@@ -1728,6 +1729,11 @@ static void handle_auth(struct hostapd_d char *identity = NULL; char *radius_cui = NULL; u16 seq_ctrl; @@ -129,7 +120,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -1858,6 +1864,13 @@ static void handle_auth(struct hostapd_d +@@ -1888,6 +1894,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -143,7 +134,7 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -3129,12 +3142,12 @@ void fils_hlp_timeout(void *eloop_ctx, v +@@ -3167,12 +3180,12 @@ void fils_hlp_timeout(void *eloop_ctx, v static void handle_assoc(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -158,7 +149,7 @@ struct sta_info *sta; u8 *tmp = NULL; struct hostapd_sta_wpa_psk_short *psk = NULL; -@@ -3143,6 +3156,11 @@ static void handle_assoc(struct hostapd_ +@@ -3181,6 +3194,11 @@ static void handle_assoc(struct hostapd_ #ifdef CONFIG_FILS int delay_assoc = 0; #endif /* CONFIG_FILS */ @@ -170,7 +161,7 @@ if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : sizeof(mgmt->u.assoc_req))) { -@@ -3314,6 +3332,14 @@ static void handle_assoc(struct hostapd_ +@@ -3352,6 +3370,14 @@ static void handle_assoc(struct hostapd_ } #endif /* CONFIG_MBO */ @@ -185,7 +176,7 @@ /* * sta->capability is used in check_assoc_ies() for RRM enabled * capability element. -@@ -3527,6 +3553,7 @@ static void handle_disassoc(struct hosta +@@ -3565,6 +3591,7 @@ static void handle_disassoc(struct hosta wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.disassoc.reason_code)); @@ -193,7 +184,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { -@@ -3592,6 +3619,8 @@ static void handle_deauth(struct hostapd +@@ -3630,6 +3657,8 @@ static void handle_deauth(struct hostapd " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); @@ -202,7 +193,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " -@@ -3911,7 +3940,7 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -3949,7 +3978,7 @@ int ieee802_11_mgmt(struct hostapd_data if (stype == WLAN_FC_STYPE_PROBE_REQ) { @@ -211,7 +202,7 @@ return 1; } -@@ -3931,17 +3960,17 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -3969,17 +3998,17 @@ int ieee802_11_mgmt(struct hostapd_data switch (stype) { case WLAN_FC_STYPE_AUTH: wpa_printf(MSG_DEBUG, "mgmt::auth"); @@ -251,7 +242,7 @@ int ret; u16 csa_offs[2]; size_t csa_offs_len; -@@ -737,6 +738,11 @@ void handle_probe_req(struct hostapd_dat +@@ -737,6 +738,12 @@ void handle_probe_req(struct hostapd_dat struct hostapd_sta_wpa_psk_short *psk = NULL; char *identity = NULL; char *radius_cui = NULL; @@ -259,11 +250,12 @@ + .type = HOSTAPD_UBUS_PROBE_REQ, + .mgmt_frame = mgmt, + .frame_info = fi, ++ .elems = &elems, + }; if (len < IEEE80211_HDRLEN) return; -@@ -914,6 +920,12 @@ void handle_probe_req(struct hostapd_dat +@@ -914,6 +921,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -315,7 +307,7 @@ wpabuf_free(sta->p2p_ie); --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -412,6 +412,7 @@ void ap_handle_timer(void *eloop_ctx, vo +@@ -415,6 +415,7 @@ void ap_handle_timer(void *eloop_ctx, vo HOSTAPD_LEVEL_INFO, "deauthenticated due to " "local deauth request"); ap_free_sta(hapd, sta); @@ -323,7 +315,7 @@ return; } -@@ -559,6 +560,7 @@ skip_poll: +@@ -562,6 +563,7 @@ skip_poll: hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); ap_free_sta(hapd, sta); @@ -331,7 +323,7 @@ break; } } -@@ -1220,6 +1222,7 @@ void ap_sta_set_authorized(struct hostap +@@ -1223,6 +1225,7 @@ void ap_sta_set_authorized(struct hostap buf, ip_addr); } else { wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf); diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 2c310adae..3375ac49f 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -20,6 +20,7 @@ #include "beacon.h" #include "rrm.h" #include "wnm_ap.h" +#include "taxonomy.h" static struct ubus_context *ctx; static struct blob_buf b; @@ -184,6 +185,11 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]); blobmsg_close_array(&b, r); blobmsg_add_u32(&b, "aid", sta->aid); +#ifdef CONFIG_TAXONOMY + r = blobmsg_alloc_string_buffer(&b, "signature", 1024); + if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) + blobmsg_add_string_buffer(&b); +#endif blobmsg_close_table(&b, c); } blobmsg_close_array(&b, list); @@ -192,6 +198,21 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +static int +hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + blob_buf_init(&b, 0); + blobmsg_add_u8(&b, "ht_supported", ht_supported(hapd->iface->hw_features)); + blobmsg_add_u8(&b, "vht_supported", vht_supported(hapd->iface->hw_features)); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + enum { NOTIFY_RESPONSE, __NOTIFY_MAX @@ -361,16 +382,26 @@ hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, enum { CSA_FREQ, CSA_BCN_COUNT, + CSA_CENTER_FREQ1, + CSA_CENTER_FREQ2, + CSA_BANDWIDTH, + CSA_SEC_CHANNEL_OFFSET, + CSA_HT, + CSA_VHT, + CSA_BLOCK_TX, __CSA_MAX }; static const struct blobmsg_policy csa_policy[__CSA_MAX] = { - /* - * for now, frequency and beacon count are enough, add more - * parameters on demand - */ [CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 }, [CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 }, + [CSA_CENTER_FREQ1] = { "center_freq1", BLOBMSG_TYPE_INT32 }, + [CSA_CENTER_FREQ2] = { "center_freq2", BLOBMSG_TYPE_INT32 }, + [CSA_BANDWIDTH] = { "bandwidth", BLOBMSG_TYPE_INT32 }, + [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, + [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, + [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, + [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, }; #ifdef NEED_AP_MLME @@ -390,12 +421,27 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, memset(&css, 0, sizeof(css)); css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); - if (tb[CSA_BCN_COUNT]) - css.cs_count = blobmsg_get_u32(tb[CSA_BCN_COUNT]); + +#define SET_CSA_SETTING(name, field, type) \ + do { \ + if (tb[name]) \ + css.field = blobmsg_get_ ## type(tb[name]); \ + } while(0) + + SET_CSA_SETTING(CSA_BCN_COUNT, cs_count, u32); + SET_CSA_SETTING(CSA_CENTER_FREQ1, freq_params.center_freq1, u32); + SET_CSA_SETTING(CSA_CENTER_FREQ2, freq_params.center_freq2, u32); + SET_CSA_SETTING(CSA_BANDWIDTH, freq_params.bandwidth, u32); + SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); + SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); + SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); + SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + if (hostapd_switch_channel(hapd, &css) != 0) return UBUS_STATUS_NOT_SUPPORTED; return UBUS_STATUS_OK; +#undef SET_CSA_SETTING } #endif @@ -909,6 +955,7 @@ static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), + UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), #ifdef NEED_AP_MLME UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), #endif @@ -1022,6 +1069,47 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req blobmsg_add_u32(&b, "signal", req->frame_info->ssi_signal); blobmsg_add_u32(&b, "freq", hapd->iface->freq); + if (req->elems) { + if(req->elems->ht_capabilities) + { + struct ieee80211_ht_capabilities *ht_capabilities; + void *ht_cap, *ht_cap_mcs_set, *mcs_set; + + + ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities; + ht_cap = blobmsg_open_table(&b, "ht_capabilities"); + blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info); + ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); + blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params); + blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities); + blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info); + blobmsg_add_u16(&b, "asel_capabilities", ht_capabilities->asel_capabilities); + mcs_set = blobmsg_open_array(&b, "supported_mcs_set"); + for (int i = 0; i < 16; i++) { + blobmsg_add_u16(&b, NULL, (u16) ht_capabilities->supported_mcs_set[i]); + } + blobmsg_close_array(&b, mcs_set); + blobmsg_close_table(&b, ht_cap_mcs_set); + blobmsg_close_table(&b, ht_cap); + } + if(req->elems->vht_capabilities) + { + struct ieee80211_vht_capabilities *vht_capabilities; + void *vht_cap, *vht_cap_mcs_set; + + vht_capabilities = (struct ieee80211_vht_capabilities*) req->elems->vht_capabilities; + vht_cap = blobmsg_open_table(&b, "vht_capabilities"); + blobmsg_add_u32(&b, "vht_capabilities_info", vht_capabilities->vht_capabilities_info); + vht_cap_mcs_set = blobmsg_open_table(&b, "vht_supported_mcs_set"); + blobmsg_add_u16(&b, "rx_map", vht_capabilities->vht_supported_mcs_set.rx_map); + blobmsg_add_u16(&b, "rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest); + blobmsg_add_u16(&b, "tx_map", vht_capabilities->vht_supported_mcs_set.tx_map); + blobmsg_add_u16(&b, "tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest); + blobmsg_close_table(&b, vht_cap_mcs_set); + blobmsg_close_table(&b, vht_cap); + } + } + if (!hapd->ubus.notify_response) { ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); return WLAN_STATUS_SUCCESS; diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h index e3ff981c7..185af5a7f 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.h +++ b/package/network/services/hostapd/src/src/ap/ubus.h @@ -18,6 +18,7 @@ enum hostapd_ubus_event_type { struct hostapd_ubus_request { enum hostapd_ubus_event_type type; const struct ieee80211_mgmt *mgmt_frame; + const struct ieee802_11_elems *elems; const struct hostapd_frame_info *frame_info; const u8 *addr; }; @@ -30,10 +31,6 @@ struct hostapd_data; #include #include -struct hostapd_ubus_iface { - struct ubus_object obj; -}; - struct hostapd_ubus_bss { struct ubus_object obj; struct avl_tree banned; @@ -50,8 +47,6 @@ void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 * #else -struct hostapd_ubus_iface {}; - struct hostapd_ubus_bss {}; static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface) diff --git a/package/network/services/igmpproxy/Makefile b/package/network/services/igmpproxy/Makefile index 6ac4172c8..488de6630 100644 --- a/package/network/services/igmpproxy/Makefile +++ b/package/network/services/igmpproxy/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=igmpproxy PKG_VERSION:=0.2.1 -PKG_RELEASE:=2 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/pali/igmpproxy/releases/download/${PKG_VERSION}/ diff --git a/package/network/services/igmpproxy/files/igmpproxy.config b/package/network/services/igmpproxy/files/igmpproxy.config index 6230f8aa1..c85ffa3f5 100644 --- a/package/network/services/igmpproxy/files/igmpproxy.config +++ b/package/network/services/igmpproxy/files/igmpproxy.config @@ -1,6 +1,6 @@ config igmpproxy option quickleave 1 -# option verbose [0-2] +# option verbose [0-3](none, minimal[default], more, maximum) config phyint option network wan diff --git a/package/network/services/igmpproxy/files/igmpproxy.init b/package/network/services/igmpproxy/files/igmpproxy.init index 0c30895ad..c4af43068 100644 --- a/package/network/services/igmpproxy/files/igmpproxy.init +++ b/package/network/services/igmpproxy/files/igmpproxy.init @@ -9,10 +9,11 @@ CONFIGFILE=/var/etc/igmpproxy.conf igmp_header() { local quickleave verbose config_get_bool quickleave "$1" quickleave 0 - config_get verbose "$1" verbose 0 + config_get verbose "$1" verbose 1 - [ $verbose = "1" ] && logopts="-v" - [ $verbose = "2" ] && logopts="-v -v" + [ $verbose = "0" ] && logopts="-d" + [ $verbose = "2" ] && logopts="-v" + [ $verbose = "3" ] && logopts="-v -v" mkdir -p /var/etc rm -f /var/etc/igmpproxy.conf @@ -67,6 +68,18 @@ igmp_add_firewall_routing() { [[ "$direction" = "downstream" && ! -z "$zone" ]] || return 0 +# First drop SSDP packets then accept all other multicast + + json_add_object "" + json_add_string type rule + json_add_string src "$upstream" + json_add_string dest "$zone" + json_add_string family ipv4 + json_add_string proto udp + json_add_string dest_ip "239.255.255.250" + json_add_string target DROP + json_close_object + json_add_object "" json_add_string type rule json_add_string src "$upstream" diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index fa8731491..25a3cf564 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd PKG_RELEASE:=1 -PKG_VERSION:=1.10 +PKG_VERSION:=1.11 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_SOURCE_DATE:=2018-07-26 -PKG_SOURCE_VERSION:=44cce3169a961727b1f046b786e7995ffb26a957 -PKG_MIRROR_HASH:=f068ddad6e4c630a5baf7369a6deaebd1ec3f7e5c0aa4826496451da425e40dc +PKG_SOURCE_DATE:=2018-09-05 +PKG_SOURCE_VERSION:=881f66b0c2526bff6a2a51b30d314c512df813b4 +PKG_MIRROR_HASH:=b339004f83974ea6fa7ef04f3a815644f832c2d24d186faddbeb5ea20c908a1e PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/openvpn-easy-rsa/Makefile b/package/network/services/openvpn-easy-rsa/Makefile index f4b479986..0cf73950a 100644 --- a/package/network/services/openvpn-easy-rsa/Makefile +++ b/package/network/services/openvpn-easy-rsa/Makefile @@ -9,13 +9,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvpn-easy-rsa -PKG_VERSION:=3.0.1 +PKG_VERSION:=3.0.4 PKG_RELEASE:=1 -PKG_SOURCE_URL:=https://github.com/OpenVPN/easy-rsa/releases/download/$(PKG_VERSION)/ +PKG_SOURCE_URL:=https://github.com/OpenVPN/easy-rsa/releases/download/v$(PKG_VERSION)/ PKG_SOURCE:=EasyRSA-$(PKG_VERSION).tgz -PKG_HASH:=dbdaf5b9444b99e0c5221fd4bcf15384c62380c1b63cea23d42239414d7b2d4e +PKG_HASH:=472167f976c6cb7c860cec6150a5616e163ae20365c81f179811d6ee0779ec5a PKG_LICENSE:=GPL-2.0 PKG_BUILD_DIR:=$(BUILD_DIR)/EasyRSA-$(PKG_VERSION) +PKGARCH:=all include $(INCLUDE_DIR)/package.mk @@ -31,6 +32,7 @@ endef define Package/openvpn-easy-rsa/conffiles /etc/easy-rsa/vars /etc/easy-rsa/openssl-1.0.cnf +/etc/easy-rsa/openssl-easyrsa.cnf endef define Build/Configure @@ -42,11 +44,12 @@ define Build/Compile endef define Package/openvpn-easy-rsa/install - $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/easyrsa $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/easyrsa $(1)/usr/bin/ $(INSTALL_DIR) $(1)/etc/easy-rsa - $(INSTALL_DATA) $(PKG_BUILD_DIR)/openssl-1.0.cnf $(1)/etc/easy-rsa/openssl-1.0.cnf + $(INSTALL_DATA) $(PKG_BUILD_DIR)/openssl-easyrsa.cnf $(1)/etc/easy-rsa/openssl-1.0.cnf + $(LN) /etc/easy-rsa/openssl-1.0.cnf $(1)/etc/easy-rsa/openssl-easyrsa.cnf $(INSTALL_DATA) $(PKG_BUILD_DIR)/vars.example $(1)/etc/easy-rsa/vars $(INSTALL_DIR) $(1)/etc/easy-rsa/pki diff --git a/package/network/services/openvpn-easy-rsa/patches/101-static_EASYRSA.patch b/package/network/services/openvpn-easy-rsa/patches/101-static_EASYRSA.patch new file mode 100644 index 000000000..b81366c60 --- /dev/null +++ b/package/network/services/openvpn-easy-rsa/patches/101-static_EASYRSA.patch @@ -0,0 +1,22 @@ +Index: EasyRSA-3.0.4/easyrsa +=================================================================== +--- EasyRSA-3.0.4.orig/easyrsa ++++ EasyRSA-3.0.4/easyrsa +@@ -1033,7 +1033,7 @@ vars_setup() { + vars= + + # set up program path +- prog_vars="${0%/*}/vars" ++ prog_vars="/etc/easy-rsa/vars" + # set up PKI path + pki_vars="${EASYRSA_PKI:-$PWD/pki}/vars" + +@@ -1060,7 +1060,7 @@ Note: using Easy-RSA configuration from: + fi + + # Set defaults, preferring existing env-vars if present +- set_var EASYRSA "${0%/*}" ++ set_var EASYRSA "/etc/easy-rsa" + set_var EASYRSA_OPENSSL openssl + set_var EASYRSA_PKI "$PWD/pki" + set_var EASYRSA_DN cn_only diff --git a/package/network/services/openvpn/Makefile b/package/network/services/openvpn/Makefile index 374e14f7b..e0c9d4b3c 100644 --- a/package/network/services/openvpn/Makefile +++ b/package/network/services/openvpn/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvpn PKG_VERSION:=2.4.5 -PKG_RELEASE:=4 +PKG_RELEASE:=7 PKG_SOURCE_URL:=\ https://build.openvpn.net/downloads/releases/ \ diff --git a/package/network/services/openvpn/files/openvpn.init b/package/network/services/openvpn/files/openvpn.init index ab4f7dba0..7e6cfd9c3 100644 --- a/package/network/services/openvpn/files/openvpn.init +++ b/package/network/services/openvpn/files/openvpn.init @@ -67,6 +67,7 @@ openvpn_add_instance() { --cd "$dir" \ --config "$conf" procd_set_param file "$dir/$conf" + procd_set_param term_timeout 15 procd_set_param respawn procd_append_param respawn 3600 procd_append_param respawn 5 diff --git a/package/network/services/samba36/Makefile b/package/network/services/samba36/Makefile index 39bfcc6c4..b4322f04f 100644 --- a/package/network/services/samba36/Makefile +++ b/package/network/services/samba36/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=samba PKG_VERSION:=3.6.25 -PKG_RELEASE:=10 +PKG_RELEASE:=12 PKG_SOURCE_URL:=https://download.samba.org/pub/samba \ https://download.samba.org/pub/samba/stable @@ -108,6 +108,8 @@ CONFIGURE_ARGS += \ --disable-avahi \ --disable-cups \ --disable-external-libtalloc \ + --disable-external-libtdb \ + --disable-external-libtevent \ --disable-pie \ --disable-relro \ --disable-static \ diff --git a/package/network/services/samba36/files/samba.init b/package/network/services/samba36/files/samba.init index ae0e0e230..1c5bb3b3c 100755 --- a/package/network/services/samba36/files/samba.init +++ b/package/network/services/samba36/files/samba.init @@ -101,6 +101,7 @@ start_service() { init_config procd_open_instance + procd_add_mdns "smb" "tcp" "445" procd_set_param command /usr/sbin/smbd -F procd_set_param respawn procd_set_param file /var/etc/smb.conf diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 0872b22aa..af322b53b 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2018-06-26 -PKG_SOURCE_VERSION:=796d42bceed2015bb00309a3bf0f49279b070c19 -PKG_MIRROR_HASH:=b9c79a74a112a5a2551012aa30a072121198f44d308f12948faeb792f0c6410a +PKG_SOURCE_DATE:=2018-08-23 +PKG_SOURCE_VERSION:=b741dec35698a80266fb8206970638e666774a33 +PKG_MIRROR_HASH:=2f7c88ba1b36dd6776a7d954b4c5e96aff288992acf19152a38641c665e261e4 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC @@ -107,16 +107,6 @@ define Package/uhttpd-mod-ubus/install $(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus endef -define Package/uhttpd-mod-lua/postinst - $(if $(CONFIG_uhttpd_lua), - #!/bin/sh - if [ -f $${IPKG_INSTROOT}/www/index.html ] - then - sed -e 's:/cgi-bin::g' -i $${IPKG_INSTROOT}/www/index.html - fi - ,) -endef - $(eval $(call BuildPackage,uhttpd)) $(eval $(call BuildPackage,uhttpd-mod-lua)) diff --git a/package/network/services/uhttpd/files/uhttpd.config b/package/network/services/uhttpd/files/uhttpd.config index a7d769e18..a3deb9cf0 100644 --- a/package/network/services/uhttpd/files/uhttpd.config +++ b/package/network/services/uhttpd/files/uhttpd.config @@ -49,10 +49,13 @@ config uhttpd main # list interpreter ".php=/usr/bin/php-cgi" # list interpreter ".cgi=/usr/bin/perl" - # Lua url prefix and handler script. - # Lua support is disabled if no prefix given. - option lua_prefix /luci - option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua + # List of prefix->Lua handler mappings. + # Any request to an URL beneath the prefix + # will be dispatched to the associated Lua + # handler script. Lua support is disabled when + # no handler mappings are specified. Lua prefix + # matches have precedence over the CGI prefix. + list lua_prefix "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua" # Specify the ubus-rpc prefix and socket path. # option ubus_prefix /ubus diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init index 47270bcc1..dc496b3e2 100755 --- a/package/network/services/uhttpd/files/uhttpd.init +++ b/package/network/services/uhttpd/files/uhttpd.init @@ -74,6 +74,18 @@ create_httpauth() { haveauth=1 } +append_lua_prefix() { + local v="$1" + local prefix="${v%%=*}" + local handler="${v#*=}" + + if [ "$prefix" != "$handler" ] && [ -n "$prefix" ] && [ -f "$handler" ]; then + procd_append_param command -l "$prefix" -L "$handler" + else + echo "Skipping invalid Lua prefix \"$v\"" >&2 + fi +} + start_instance() { UHTTPD_CERT="" @@ -105,10 +117,16 @@ start_instance() append_arg "$cfg" config "-c" append_arg "$cfg" cgi_prefix "-x" [ -f /usr/lib/uhttpd_lua.so ] && { - config_get handler "$cfg" lua_handler - [ -f "$handler" ] && append_arg "$cfg" lua_prefix "-l" && { - procd_append_param command "-L" "$handler" - } + local len + config_get len "$cfg" lua_prefix_LENGTH + + if [ -n "$len" ]; then + config_list_foreach "$cfg" lua_prefix append_lua_prefix + else + config_get prefix "$cfg" lua_prefix + config_get handler "$cfg" lua_handler + append_lua_prefix "$prefix=$handler" + fi } [ -f /usr/lib/uhttpd_ubus.so ] && { append_arg "$cfg" ubus_prefix "-u" diff --git a/package/network/services/wireguard/Makefile b/package/network/services/wireguard/Makefile index a88dca1e7..c9608ec61 100644 --- a/package/network/services/wireguard/Makefile +++ b/package/network/services/wireguard/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard -PKG_VERSION:=0.0.20180718 -PKG_RELEASE:=2 +PKG_VERSION:=0.0.20180904 +PKG_RELEASE:=1 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/ -PKG_HASH:=083c093a6948c8d38f92e7ea5533f9ff926019f24dc2612ea974851ed3e24705 +PKG_HASH:=a38ead72994a7db7cda2d0085f410df1111b4728db050a519883eda8f3fe38f1 PKG_LICENSE:=GPL-2.0 Apache-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/comgt/files/runcommand.gcom b/package/network/utils/comgt/files/runcommand.gcom index e99b6f922..88a9d29dc 100644 --- a/package/network/utils/comgt/files/runcommand.gcom +++ b/package/network/utils/comgt/files/runcommand.gcom @@ -10,7 +10,7 @@ opengt send $env("COMMAND") send "^m" - waitfor 15 "OK","ERR","ERROR","COMMAND NOT SUPPORT" + waitfor 25 "OK","ERR","ERROR","COMMAND NOT SUPPORT" if % = 0 goto continue if % = 1 goto error if % = 2 goto error diff --git a/package/network/utils/curl/Makefile b/package/network/utils/curl/Makefile index db726407b..66bf4f3db 100644 --- a/package/network/utils/curl/Makefile +++ b/package/network/utils/curl/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=curl -PKG_VERSION:=7.60.0 +PKG_VERSION:=7.61.0 PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \ - http://curl.mirror.anstey.ca/ \ - http://curl.askapache.com/download/ \ + https://curl.mirror.anstey.ca/ \ + https://curl.askapache.com/download/ \ https://curl.haxx.se/download/ -PKG_HASH:=8736ff8ded89ddf7e926eec7b16f82597d029fc1469f3a551f1fafaac164e6a0 +PKG_HASH:=ef6e55192d04713673b4409ccbcb4cb6cd723137d6e10ca45b0c593a454e1720 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING @@ -88,7 +88,7 @@ define Package/libcurl CATEGORY:=Libraries DEPENDS:= +LIBCURL_WOLFSSL:libwolfssl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN2:libidn2 - DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 + DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle TITLE:=A client-side URL transfer library MENU:=1 endef @@ -112,13 +112,16 @@ CONFIGURE_ARGS += \ --without-libmetalink \ --without-librtmp \ --without-libidn \ + --without-ca-path \ + --without-libpsl \ + --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \ \ $(call autoconf_bool,CONFIG_IPV6,ipv6) \ \ - $(if $(CONFIG_LIBCURL_WOLFSSL),--with-cyassl="$(STAGING_DIR)/usr" --without-ca-path --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt,--without-cyassl) \ - $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr" --without-ca-bundle --with-ca-path=/etc/ssl/certs,--without-gnutls) \ - $(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr" --without-ca-bundle --with-ca-path=/etc/ssl/certs,--without-ssl) \ - $(if $(CONFIG_LIBCURL_MBEDTLS),--with-mbedtls="$(STAGING_DIR)/usr" --without-ca-path --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt,--without-mbedtls) \ + $(if $(CONFIG_LIBCURL_WOLFSSL),--with-cyassl="$(STAGING_DIR)/usr",--without-cyassl) \ + $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr",--without-gnutls) \ + $(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr",--without-ssl) \ + $(if $(CONFIG_LIBCURL_MBEDTLS),--with-mbedtls="$(STAGING_DIR)/usr",--without-mbedtls) \ \ $(if $(CONFIG_LIBCURL_LIBIDN2),--with-libidn2="$(STAGING_DIR)/usr",--without-libidn2) \ $(if $(CONFIG_LIBCURL_SSH2),--with-libssh2="$(STAGING_DIR)/usr",--without-libssh2) \ diff --git a/package/network/utils/curl/patches/400-CVE-2018-0500.patch b/package/network/utils/curl/patches/400-CVE-2018-0500.patch deleted file mode 100644 index 9ef4111ae..000000000 --- a/package/network/utils/curl/patches/400-CVE-2018-0500.patch +++ /dev/null @@ -1,32 +0,0 @@ -From ba1dbd78e5f1ed67c1b8d37ac89d90e5e330b628 Mon Sep 17 00:00:00 2001 -From: Daniel Stenberg -Date: Wed, 13 Jun 2018 12:24:40 +0200 -Subject: [PATCH] smtp: use the upload buffer size for scratch buffer malloc - -... not the read buffer size, as that can be set smaller and thus cause -a buffer overflow! CVE-2018-0500 - -Reported-by: Peter Wu -Bug: https://curl.haxx.se/docs/adv_2018-70a2.html ---- - lib/smtp.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/lib/smtp.c -+++ b/lib/smtp.c -@@ -1563,13 +1563,14 @@ CURLcode Curl_smtp_escape_eob(struct con - if(!scratch || data->set.crlf) { - oldscratch = scratch; - -- scratch = newscratch = malloc(2 * data->set.buffer_size); -+ scratch = newscratch = malloc(2 * UPLOAD_BUFSIZE); - if(!newscratch) { - failf(data, "Failed to alloc scratch buffer!"); - - return CURLE_OUT_OF_MEMORY; - } - } -+ DEBUGASSERT(UPLOAD_BUFSIZE >= nread); - - /* Have we already sent part of the EOB? */ - eob_sent = smtp->eob; diff --git a/package/network/utils/ebtables/Makefile b/package/network/utils/ebtables/Makefile index baa8f2efe..732e9bf2b 100644 --- a/package/network/utils/ebtables/Makefile +++ b/package/network/utils/ebtables/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ebtables -PKG_SOURCE_DATE:=2018-04-11 +PKG_SOURCE_DATE:=2018-06-27 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://git.netfilter.org/ebtables PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=2e783b2277665c467138e7685309622456c41db4 -PKG_MIRROR_HASH:=601a41f579f76c8121bb6076ebcf5eb5efddf634ebb5949ec9e983a17e66e689 +PKG_SOURCE_VERSION:=48cff25dfea5b37e16ba5dc6601e98ab140f5f99 +PKG_MIRROR_HASH:=1327cdc3402e5e3056819e4e9b6f9d4a5bfd401f2c4f58447afb2c3c73fc8aac PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/ebtables/patches/100-musl_fix.patch b/package/network/utils/ebtables/patches/100-musl_fix.patch index 3fe584589..f393ea7d9 100644 --- a/package/network/utils/ebtables/patches/100-musl_fix.patch +++ b/package/network/utils/ebtables/patches/100-musl_fix.patch @@ -6,5 +6,5 @@ #define EBTABLES_U_H +#define _NETINET_IF_ETHER_H #include + #include #include - #include diff --git a/package/network/utils/ebtables/patches/200-fix-extension-init.patch b/package/network/utils/ebtables/patches/200-fix-extension-init.patch index 52ab175ec..60e2afd33 100644 --- a/package/network/utils/ebtables/patches/200-fix-extension-init.patch +++ b/package/network/utils/ebtables/patches/200-fix-extension-init.patch @@ -247,3 +247,14 @@ { ebt_register_table(&table); } +--- a/extensions/ebt_string.c ++++ b/extensions/ebt_string.c +@@ -312,7 +312,7 @@ static struct ebt_u_match string_match = + .extra_ops = opts, + }; + +-void _init(void) ++__attribute__((constructor)) static void extension_init(void) + { + ebt_register_match(&string_match); + } diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index b378ce2af..fc83c23f4 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=4.15 +PKG_VERSION:=4.18 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=71f7fd32483ffdc7c6c4d882e230714eb101df0a46cbe396dbeb8ac78f1ef91a +PKG_HASH:=90948555d4c017561d0d8795f2dc61893a4932c0f3b85e6d422afd7031b7c110 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/iperf3/Makefile b/package/network/utils/iperf3/Makefile index 2635d5959..55be8169e 100644 --- a/package/network/utils/iperf3/Makefile +++ b/package/network/utils/iperf3/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iperf -PKG_VERSION:=3.5 +PKG_VERSION:=3.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://downloads.es.net/pub/iperf -PKG_HASH:=539bd9ecdca1b8c1157ff85b70ed09b3c75242e69886fc16b54883b399f72cd5 +PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf +PKG_HASH:=de5d51e46dc460cc590fb4d44f95e7cad54b74fea1eba7d6ebd6f8887d75946e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 54e0fdede..ac3131078 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=4.16.0 -PKG_RELEASE:=4 +PKG_VERSION:=4.18.0 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=0c5c24020fd7349fe25728c5edee9fb6a1bc8a38f08e23be5c57a6301e55ee0a +PKG_HASH:=a9e6c70c95f513871c5e1f4e452c04fcb3c4d8a05be651bd794cd994a52daa45 PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 @@ -132,7 +132,7 @@ endef define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/ + $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/ endef diff --git a/package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch b/package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch deleted file mode 100644 index ad9397321..000000000 --- a/package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch +++ /dev/null @@ -1,288 +0,0 @@ -From 8de9593bb9dc05cb1be593a237682e8707e41aa9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Wed, 25 Apr 2018 16:19:35 +0200 -Subject: [PATCH] json_print: Fix hidden 64-bit type promotion -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -print_uint() will silently promote its variable type to uint64_t, but there -is nothing that ensures that the format string specifier passed along with -it fits (and the function name suggest to pass "%u"). - -Fix this by changing print_uint() to use a native 'unsigned int' type, and -introduce a separate print_u64() function for printing 64-bit values. All -call sites that were actually printing 64-bit values using print_uint() are -converted to use print_u64() instead. - -Since print_int() was already using native int types, just add a -print_s64() to match, but don't convert any call sites. - -Signed-off-by: Toke Høiland-Jørgensen -Signed-off-by: Kevin Darbyshire-Bryant ---- - include/json_print.h | 4 +++- - include/json_writer.h | 12 ++++++---- - ip/ipaddress.c | 62 +++++++++++++++++++++++++-------------------------- - ip/ipmacsec.c | 8 +++---- - ip/ipmroute.c | 6 ++--- - lib/json_print.c | 4 +++- - lib/json_writer.c | 30 +++++++++++++++++++++---- - 7 files changed, 78 insertions(+), 48 deletions(-) - ---- a/include/json_print.h -+++ b/include/json_print.h -@@ -56,10 +56,12 @@ void close_json_array(enum output_type t - print_color_##type_name(t, COLOR_NONE, key, fmt, value); \ - } - _PRINT_FUNC(int, int); -+_PRINT_FUNC(s64, int64_t); - _PRINT_FUNC(bool, bool); - _PRINT_FUNC(null, const char*); - _PRINT_FUNC(string, const char*); --_PRINT_FUNC(uint, uint64_t); -+_PRINT_FUNC(uint, unsigned int); -+_PRINT_FUNC(u64, uint64_t); - _PRINT_FUNC(hu, unsigned short); - _PRINT_FUNC(hex, unsigned int); - _PRINT_FUNC(0xhex, unsigned int); ---- a/include/json_writer.h -+++ b/include/json_writer.h -@@ -34,9 +34,11 @@ void jsonw_string(json_writer_t *self, c - void jsonw_bool(json_writer_t *self, bool value); - void jsonw_float(json_writer_t *self, double number); - void jsonw_float_fmt(json_writer_t *self, const char *fmt, double num); --void jsonw_uint(json_writer_t *self, uint64_t number); -+void jsonw_uint(json_writer_t *self, unsigned int number); -+void jsonw_u64(json_writer_t *self, uint64_t number); - void jsonw_hu(json_writer_t *self, unsigned short number); --void jsonw_int(json_writer_t *self, int64_t number); -+void jsonw_int(json_writer_t *self, int number); -+void jsonw_s64(json_writer_t *self, int64_t number); - void jsonw_null(json_writer_t *self); - void jsonw_lluint(json_writer_t *self, unsigned long long int num); - -@@ -44,9 +46,11 @@ void jsonw_lluint(json_writer_t *self, u - void jsonw_string_field(json_writer_t *self, const char *prop, const char *val); - void jsonw_bool_field(json_writer_t *self, const char *prop, bool value); - void jsonw_float_field(json_writer_t *self, const char *prop, double num); --void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num); -+void jsonw_uint_field(json_writer_t *self, const char *prop, unsigned int num); -+void jsonw_u64_field(json_writer_t *self, const char *prop, uint64_t num); - void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num); --void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num); -+void jsonw_int_field(json_writer_t *self, const char *prop, int num); -+void jsonw_s64_field(json_writer_t *self, const char *prop, int64_t num); - void jsonw_null_field(json_writer_t *self, const char *prop); - void jsonw_lluint_field(json_writer_t *self, const char *prop, - unsigned long long int num); ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -555,21 +555,21 @@ static void print_vf_stats64(FILE *fp, s - - /* RX stats */ - open_json_object("rx"); -- print_uint(PRINT_JSON, "bytes", NULL, -+ print_u64(PRINT_JSON, "bytes", NULL, - rta_getattr_u64(vf[IFLA_VF_STATS_RX_BYTES])); -- print_uint(PRINT_JSON, "packets", NULL, -+ print_u64(PRINT_JSON, "packets", NULL, - rta_getattr_u64(vf[IFLA_VF_STATS_RX_PACKETS])); -- print_uint(PRINT_JSON, "multicast", NULL, -+ print_u64(PRINT_JSON, "multicast", NULL, - rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST])); -- print_uint(PRINT_JSON, "broadcast", NULL, -+ print_u64(PRINT_JSON, "broadcast", NULL, - rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST])); - close_json_object(); - - /* TX stats */ - open_json_object("tx"); -- print_uint(PRINT_JSON, "tx_bytes", NULL, -+ print_u64(PRINT_JSON, "tx_bytes", NULL, - rta_getattr_u64(vf[IFLA_VF_STATS_TX_BYTES])); -- print_uint(PRINT_JSON, "tx_packets", NULL, -+ print_u64(PRINT_JSON, "tx_packets", NULL, - rta_getattr_u64(vf[IFLA_VF_STATS_TX_PACKETS])); - close_json_object(); - close_json_object(); -@@ -602,50 +602,50 @@ static void print_link_stats64(FILE *fp, - - /* RX stats */ - open_json_object("rx"); -- print_uint(PRINT_JSON, "bytes", NULL, s->rx_bytes); -- print_uint(PRINT_JSON, "packets", NULL, s->rx_packets); -- print_uint(PRINT_JSON, "errors", NULL, s->rx_errors); -- print_uint(PRINT_JSON, "dropped", NULL, s->rx_dropped); -- print_uint(PRINT_JSON, "over_errors", NULL, s->rx_over_errors); -- print_uint(PRINT_JSON, "multicast", NULL, s->multicast); -+ print_u64(PRINT_JSON, "bytes", NULL, s->rx_bytes); -+ print_u64(PRINT_JSON, "packets", NULL, s->rx_packets); -+ print_u64(PRINT_JSON, "errors", NULL, s->rx_errors); -+ print_u64(PRINT_JSON, "dropped", NULL, s->rx_dropped); -+ print_u64(PRINT_JSON, "over_errors", NULL, s->rx_over_errors); -+ print_u64(PRINT_JSON, "multicast", NULL, s->multicast); - if (s->rx_compressed) -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "compressed", - NULL, s->rx_compressed); - - /* RX error stats */ - if (show_stats > 1) { -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "length_errors", - NULL, s->rx_length_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "crc_errors", - NULL, s->rx_crc_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "frame_errors", - NULL, s->rx_frame_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "fifo_errors", - NULL, s->rx_fifo_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "missed_errors", - NULL, s->rx_missed_errors); - if (s->rx_nohandler) -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "nohandler", NULL, s->rx_nohandler); - } - close_json_object(); - - /* TX stats */ - open_json_object("tx"); -- print_uint(PRINT_JSON, "bytes", NULL, s->tx_bytes); -- print_uint(PRINT_JSON, "packets", NULL, s->tx_packets); -- print_uint(PRINT_JSON, "errors", NULL, s->tx_errors); -- print_uint(PRINT_JSON, "dropped", NULL, s->tx_dropped); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, "bytes", NULL, s->tx_bytes); -+ print_u64(PRINT_JSON, "packets", NULL, s->tx_packets); -+ print_u64(PRINT_JSON, "errors", NULL, s->tx_errors); -+ print_u64(PRINT_JSON, "dropped", NULL, s->tx_dropped); -+ print_u64(PRINT_JSON, - "carrier_errors", - NULL, s->tx_carrier_errors); -- print_uint(PRINT_JSON, "collisions", NULL, s->collisions); -+ print_u64(PRINT_JSON, "collisions", NULL, s->collisions); - if (s->tx_compressed) - print_uint(PRINT_JSON, - "compressed", -@@ -653,20 +653,20 @@ static void print_link_stats64(FILE *fp, - - /* TX error stats */ - if (show_stats > 1) { -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "aborted_errors", - NULL, s->tx_aborted_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "fifo_errors", - NULL, s->tx_fifo_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "window_errors", - NULL, s->tx_window_errors); -- print_uint(PRINT_JSON, -+ print_u64(PRINT_JSON, - "heartbeat_errors", - NULL, s->tx_heartbeat_errors); - if (carrier_changes) -- print_uint(PRINT_JSON, "carrier_changes", NULL, -+ print_u64(PRINT_JSON, "carrier_changes", NULL, - rta_getattr_u32(carrier_changes)); - } - close_json_object(); ---- a/lib/json_print.c -+++ b/lib/json_print.c -@@ -117,8 +117,10 @@ void close_json_array(enum output_type t - } \ - } - _PRINT_FUNC(int, int); -+_PRINT_FUNC(s64, int64_t); - _PRINT_FUNC(hu, unsigned short); --_PRINT_FUNC(uint, uint64_t); -+_PRINT_FUNC(uint, unsigned int); -+_PRINT_FUNC(u64, uint64_t); - _PRINT_FUNC(lluint, unsigned long long int); - _PRINT_FUNC(float, double); - #undef _PRINT_FUNC ---- a/lib/json_writer.c -+++ b/lib/json_writer.c -@@ -215,7 +215,12 @@ void jsonw_hu(json_writer_t *self, unsig - jsonw_printf(self, "%hu", num); - } - --void jsonw_uint(json_writer_t *self, uint64_t num) -+void jsonw_uint(json_writer_t *self, unsigned int num) -+{ -+ jsonw_printf(self, "%u", num); -+} -+ -+void jsonw_u64(json_writer_t *self, uint64_t num) - { - jsonw_printf(self, "%"PRIu64, num); - } -@@ -225,7 +230,12 @@ void jsonw_lluint(json_writer_t *self, u - jsonw_printf(self, "%llu", num); - } - --void jsonw_int(json_writer_t *self, int64_t num) -+void jsonw_int(json_writer_t *self, int num) -+{ -+ jsonw_printf(self, "%d", num); -+} -+ -+void jsonw_s64(json_writer_t *self, int64_t num) - { - jsonw_printf(self, "%"PRId64, num); - } -@@ -258,12 +268,18 @@ void jsonw_float_field_fmt(json_writer_t - jsonw_float_fmt(self, fmt, val); - } - --void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num) -+void jsonw_uint_field(json_writer_t *self, const char *prop, unsigned int num) - { - jsonw_name(self, prop); - jsonw_uint(self, num); - } - -+void jsonw_u64_field(json_writer_t *self, const char *prop, uint64_t num) -+{ -+ jsonw_name(self, prop); -+ jsonw_u64(self, num); -+} -+ - void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num) - { - jsonw_name(self, prop); -@@ -278,12 +294,18 @@ void jsonw_lluint_field(json_writer_t *s - jsonw_lluint(self, num); - } - --void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num) -+void jsonw_int_field(json_writer_t *self, const char *prop, int num) - { - jsonw_name(self, prop); - jsonw_int(self, num); - } - -+void jsonw_s64_field(json_writer_t *self, const char *prop, int64_t num) -+{ -+ jsonw_name(self, prop); -+ jsonw_s64(self, num); -+} -+ - void jsonw_null_field(json_writer_t *self, const char *prop) - { - jsonw_name(self, prop); diff --git a/package/network/utils/iproute2/patches/001-config.patch b/package/network/utils/iproute2/patches/100-config.patch similarity index 100% rename from package/network/utils/iproute2/patches/001-config.patch rename to package/network/utils/iproute2/patches/100-config.patch diff --git a/package/network/utils/iproute2/patches/004-darwin_fixes.patch b/package/network/utils/iproute2/patches/110-darwin_fixes.patch similarity index 100% rename from package/network/utils/iproute2/patches/004-darwin_fixes.patch rename to package/network/utils/iproute2/patches/110-darwin_fixes.patch diff --git a/package/network/utils/iproute2/patches/007-no_arpd.patch b/package/network/utils/iproute2/patches/120-no_arpd.patch similarity index 100% rename from package/network/utils/iproute2/patches/007-no_arpd.patch rename to package/network/utils/iproute2/patches/120-no_arpd.patch diff --git a/package/network/utils/iproute2/patches/008-no_netem.patch b/package/network/utils/iproute2/patches/130-no_netem.patch similarity index 72% rename from package/network/utils/iproute2/patches/008-no_netem.patch rename to package/network/utils/iproute2/patches/130-no_netem.patch index 15a60e794..58062655c 100644 --- a/package/network/utils/iproute2/patches/008-no_netem.patch +++ b/package/network/utils/iproute2/patches/130-no_netem.patch @@ -1,11 +1,11 @@ --- a/Makefile +++ b/Makefile -@@ -57,7 +57,7 @@ WFLAGS += -Wmissing-declarations -Wold-s +@@ -61,7 +61,7 @@ WFLAGS += -Wmissing-declarations -Wold-s CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) YACCFLAGS = -d -t -v -SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man +SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma man - LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a + LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a LDLIBS += $(LIBNETLINK) diff --git a/package/network/utils/iproute2/patches/100-allow_pfifo_fast.patch b/package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch similarity index 100% rename from package/network/utils/iproute2/patches/100-allow_pfifo_fast.patch rename to package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch diff --git a/package/network/utils/iproute2/patches/009-keep_libmnl_optional.patch b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch similarity index 100% rename from package/network/utils/iproute2/patches/009-keep_libmnl_optional.patch rename to package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch diff --git a/package/network/utils/iproute2/patches/110-extra-ccopts.patch b/package/network/utils/iproute2/patches/150-extra-ccopts.patch similarity index 91% rename from package/network/utils/iproute2/patches/110-extra-ccopts.patch rename to package/network/utils/iproute2/patches/150-extra-ccopts.patch index a083b7c04..d036ba703 100644 --- a/package/network/utils/iproute2/patches/110-extra-ccopts.patch +++ b/package/network/utils/iproute2/patches/150-extra-ccopts.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -50,7 +50,7 @@ HOSTCC ?= $(CC) +@@ -54,7 +54,7 @@ HOSTCC ?= $(CC) DEFINES += -D_GNU_SOURCE # Turn on transparent support for LFS DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE diff --git a/package/network/utils/iproute2/patches/120-libnetlink-pic.patch b/package/network/utils/iproute2/patches/160-libnetlink-pic.patch similarity index 74% rename from package/network/utils/iproute2/patches/120-libnetlink-pic.patch rename to package/network/utils/iproute2/patches/160-libnetlink-pic.patch index 889bca28b..aad87a1e4 100644 --- a/package/network/utils/iproute2/patches/120-libnetlink-pic.patch +++ b/package/network/utils/iproute2/patches/160-libnetlink-pic.patch @@ -7,5 +7,5 @@ -CFLAGS += -fPIC +CFLAGS += $(FPIC) - UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \ + UTILOBJ = utils.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \ inet_proto.o namespace.o json_writer.o json_print.o \ diff --git a/package/network/utils/iproute2/patches/300-ip_tiny.patch b/package/network/utils/iproute2/patches/170-ip_tiny.patch similarity index 92% rename from package/network/utils/iproute2/patches/300-ip_tiny.patch rename to package/network/utils/iproute2/patches/170-ip_tiny.patch index d8f39d391..5c8af0b0f 100644 --- a/package/network/utils/iproute2/patches/300-ip_tiny.patch +++ b/package/network/utils/iproute2/patches/170-ip_tiny.patch @@ -40,7 +40,7 @@ +" vrf | sr }\n" +#endif " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" - " -h[uman-readable] | -iec |\n" + " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" " -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |\n" @@ -73,32 +79,44 @@ static const struct cmd { int (*func)(int argc, char **argv); @@ -89,7 +89,7 @@ { "help", do_help }, --- a/lib/utils.c +++ b/lib/utils.c -@@ -983,6 +983,7 @@ const char *rt_addr_n2a_r(int af, int le +@@ -1010,6 +1010,7 @@ const char *rt_addr_n2a_r(int af, int le return inet_ntop(af, addr, buf, buflen); case AF_MPLS: return mpls_ntop(af, addr, buf, buflen); @@ -97,7 +97,7 @@ case AF_IPX: return ipx_ntop(af, addr, buf, buflen); case AF_DECnet: -@@ -992,6 +993,7 @@ const char *rt_addr_n2a_r(int af, int le +@@ -1019,6 +1020,7 @@ const char *rt_addr_n2a_r(int af, int le memcpy(dna.a_addr, addr, 2); return dnet_ntop(af, &dna, buf, buflen); } @@ -115,6 +115,6 @@ + CFLAGS += -DIPROUTE2_TINY +endif + - UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \ + UTILOBJ = utils.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \ inet_proto.o namespace.o json_writer.o json_print.o \ names.o color.o bpf.o exec.o fs.o diff --git a/package/network/utils/iproute2/patches/900-drop_FAILED_POLICY.patch b/package/network/utils/iproute2/patches/180-drop_FAILED_POLICY.patch similarity index 100% rename from package/network/utils/iproute2/patches/900-drop_FAILED_POLICY.patch rename to package/network/utils/iproute2/patches/180-drop_FAILED_POLICY.patch diff --git a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch b/package/network/utils/iproute2/patches/190-add-cake-to-tc.patch similarity index 93% rename from package/network/utils/iproute2/patches/950-add-cake-to-tc.patch rename to package/network/utils/iproute2/patches/190-add-cake-to-tc.patch index 05142fa95..fa09b4d86 100644 --- a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch +++ b/package/network/utils/iproute2/patches/190-add-cake-to-tc.patch @@ -121,7 +121,7 @@ #endif --- /dev/null +++ b/man/man8/tc-cake.8 -@@ -0,0 +1,632 @@ +@@ -0,0 +1,710 @@ +.TH CAKE 8 "19 July 2018" "iproute2" "Linux" +.SH NAME +CAKE \- Common Applications Kept Enhanced (CAKE) @@ -197,6 +197,12 @@ +] +.br +[ ++.BR split-gso* ++| ++.BR no-split-gso ++] ++.br ++[ +.BR ack-filter +| +.BR ack-filter-aggressive @@ -670,6 +676,78 @@ +case for Comcast Cable, among others), it is best to use a single queue +"besteffort" mode with wash. + ++.PP ++.B split-gso ++ ++.br ++ This option controls whether CAKE will split General Segmentation ++Offload (GSO) super-packets into their on-the-wire components and ++dequeue them individually. ++ ++.br ++Super-packets are created by the networking stack to improve efficiency. ++However, because they are larger they take longer to dequeue, which ++translates to higher latency for competing flows, especially at lower ++bandwidths. CAKE defaults to splitting GSO packets to achieve the lowest ++possible latency. At link speeds higher than 10 Gbps, setting the ++no-split-gso parameter can increase the maximum achievable throughput by ++retaining the full GSO packets. ++ ++.SH OVERRIDING CLASSIFICATION WITH TC FILTERS ++ ++CAKE supports overriding of its internal classification of packets through the ++tc filter mechanism. Packets can be assigned to different priority tins by ++setting the ++.B priority ++field on the skb, and the flow hashing can be overridden by setting the ++.B classid ++parameter. ++ ++.PP ++.B Tin override ++ ++.br ++ To assign a priority tin, the major number of the priority field needs ++to match the qdisc handle of the cake instance; if it does, the minor number ++will be interpreted as the tin index. For example, to classify all ICMP packets ++as 'bulk', the following filter can be used: ++ ++.br ++ # tc qdisc replace dev eth0 handle 1: root cake diffserv3 ++ # tc filter add dev eth0 parent 1: protocol ip prio 1 \\ ++ u32 match icmp type 0 0 action skbedit priority 1:1 ++ ++.PP ++.B Flow hash override ++ ++.br ++ To override flow hashing, the classid can be set. CAKE will interpret ++the major number of the classid as the host hash used in host isolation mode, ++and the minor number as the flow hash used for flow-based queueing. One or both ++of those can be set, and will be used if the relevant flow isolation parameter ++is set (i.e., the major number will be ignored if CAKE is not configured in ++hosts mode, and the minor number will be ignored if CAKE is not configured in ++flows mode). ++ ++.br ++This example will assign all ICMP packets to the first queue: ++ ++.br ++ # tc qdisc replace dev eth0 handle 1: root cake ++ # tc filter add dev eth0 parent 1: protocol ip prio 1 \\ ++ u32 match icmp type 0 0 classid 0:1 ++ ++.br ++If only one of the host and flow overrides is set, CAKE will compute the other ++hash from the packet as normal. Note, however, that the host isolation mode ++works by assigning a host ID to the flow queue; so if overriding both host and ++flow, the same flow cannot have more than one host assigned. In addition, it is ++not possible to assign different source and destination host IDs through the ++override mechanism; if a host ID is assigned, it will be used as both source and ++destination host. ++ ++ ++ +.SH EXAMPLES +# tc qdisc delete root dev eth0 +.br @@ -756,7 +834,7 @@ +to the Linux Networking mailing list . --- a/man/man8/tc.8 +++ b/man/man8/tc.8 -@@ -776,6 +776,7 @@ was written by Alexey N. Kuznetsov and a +@@ -795,6 +795,7 @@ was written by Alexey N. Kuznetsov and a .BR tc-basic (8), .BR tc-bfifo (8), .BR tc-bpf (8), @@ -776,7 +854,7 @@ TCMODULES += e_bpf.o --- /dev/null +++ b/tc/q_cake.c -@@ -0,0 +1,790 @@ +@@ -0,0 +1,799 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause + +/* @@ -858,6 +936,7 @@ +" dual-srchost | dual-dsthost | triple-isolate* ]\n" +" [ nat | nonat* ]\n" +" [ wash | nowash* ]\n" ++" [ split-gso* | no-split-gso ]\n" +" [ ack-filter | ack-filter-aggressive | no-ack-filter* ]\n" +" [ memlimit LIMIT ]\n" +" [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n" @@ -878,6 +957,7 @@ + __u64 bandwidth = 0; + int ack_filter = -1; + struct rtattr *tail; ++ int split_gso = -1; + int unlimited = 0; + int flowmode = -1; + int autorate = -1; @@ -934,6 +1014,10 @@ + wash = 0; + } else if (strcmp(*argv, "wash") == 0) { + wash = 1; ++ } else if (strcmp(*argv, "split-gso") == 0) { ++ split_gso = 1; ++ } else if (strcmp(*argv, "no-split-gso") == 0) { ++ split_gso = 0; + } else if (strcmp(*argv, "flowblind") == 0) { + flowmode = CAKE_FLOW_NONE; + } else if (strcmp(*argv, "srchost") == 0) { @@ -1153,6 +1237,9 @@ + addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat)); + if (wash != -1) + addattr_l(n, 1024, TCA_CAKE_WASH, &wash, sizeof(wash)); ++ if (split_gso != -1) ++ addattr_l(n, 1024, TCA_CAKE_SPLIT_GSO, &split_gso, ++ sizeof(split_gso)); + if (ingress != -1) + addattr_l(n, 1024, TCA_CAKE_INGRESS, &ingress, sizeof(ingress)); + if (ack_filter != -1) @@ -1567,14 +1654,3 @@ + .print_qopt = cake_print_opt, + .print_xstats = cake_print_xstats, +}; ---- a/tc/q_ingress.c -+++ b/tc/q_ingress.c -@@ -40,7 +40,7 @@ static int ingress_parse_opt(struct qdis - static int ingress_print_opt(struct qdisc_util *qu, FILE *f, - struct rtattr *opt) - { -- fprintf(f, "---------------- "); -+ print_string(PRINT_FP, NULL, "---------------- ", NULL); - return 0; - } - diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 1d758ed07..4c5a58126 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.6.2 -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://git.netfilter.org/iptables @@ -89,6 +89,7 @@ IP firewall administration tool. - DNAT - DROP - REJECT + - FLOWOFFLOAD - LOG - MARK - MASQUERADE @@ -105,8 +106,23 @@ IP firewall administration tool. endef +define Package/iptables-compat +$(call Package/iptables/Default) + TITLE:=IP firewall administration tool compat + DEPENDS:=iptables @IPTABLES_NFTABLES +libxtables-compat +endef + +define Package/iptables-compat/description +Extra iptables nftables compat binaries. + iptables-compat + iptables-compat-restore + iptables-compat-save + iptables-translate + iptables-restore-translate +endef + define Package/iptables-mod-conntrack-extra -$(call Package/iptables/Module, +kmod-ipt-conntrack-extra) +$(call Package/iptables/Module, +kmod-ipt-conntrack-extra +kmod-ipt-raw) TITLE:=Extra connection tracking extensions endef @@ -150,6 +166,7 @@ Includes support for: Matches: - string + - bpf endef @@ -436,6 +453,20 @@ $(call Package/iptables/Default) MENU:=1 endef +define Package/ip6tables-compat +$(call Package/iptables/Default) + DEPENDS:=ip6tables @IPTABLES_NFTABLES +libxtables-compat + TITLE:=IP firewall administration tool compat +endef + +define Package/ip6tables-compat/description +Extra ip6tables nftables compat binaries. + iptables-compat + iptables-compat-restore + iptables-compat-save + iptables-translate + iptables-restore-translate +endef define Package/ip6tables-extra $(call Package/iptables/Default) @@ -495,6 +526,15 @@ define Package/libxtables +IPTABLES_NFTABLES:libnftnl endef +define Package/libxtables-compat + $(call Package/iptables/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=IPv4/IPv6 firewall - shared xtables compat library + ABI_VERSION:=$(PKG_VERSION) + DEPENDS:=libxtables +endef + TARGET_CPPFLAGS := \ -I$(PKG_BUILD_DIR)/include \ -I$(LINUX_DIR)/user_headers/include \ @@ -572,11 +612,24 @@ define Package/iptables/install $(INSTALL_DIR) $(1)/usr/lib/iptables endef +define Package/iptables-compat/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-compat-multi $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-compat{,-restore,-save} $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore}-translate $(1)/usr/sbin/ +endef + define Package/ip6tables/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore,-save} $(1)/usr/sbin/ endef +define Package/ip6tables-compat/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-compat{,-restore,-save} $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore}-translate $(1)/usr/sbin/ +endef + define Package/libiptc/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/ @@ -600,6 +653,11 @@ define Package/libxtables/install $(CP) $(PKG_BUILD_DIR)/extensions/libiptext.so $(1)/usr/lib/ endef +define Package/libxtables-compat/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/extensions/libiptext_*.so $(1)/usr/lib/ +endef + define BuildPlugin define Package/$(1)/install $(INSTALL_DIR) $$(1)/usr/lib/iptables @@ -615,6 +673,7 @@ define BuildPlugin endef $(eval $(call BuildPackage,iptables)) +$(eval $(call BuildPackage,iptables-compat)) $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m))) $(eval $(call BuildPlugin,iptables-mod-conntrack-label,$(IPT_CONNTRACK_LABEL-m))) $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m))) @@ -638,9 +697,11 @@ $(eval $(call BuildPlugin,iptables-mod-trace,$(IPT_DEBUG-m))) $(eval $(call BuildPlugin,iptables-mod-nfqueue,$(IPT_NFQUEUE-m))) $(eval $(call BuildPlugin,iptables-mod-checksum,$(IPT_CHECKSUM-m))) $(eval $(call BuildPackage,ip6tables)) +$(eval $(call BuildPackage,ip6tables-compat)) $(eval $(call BuildPlugin,ip6tables-extra,$(IPT_IPV6_EXTRA-m))) $(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m))) $(eval $(call BuildPackage,libiptc)) $(eval $(call BuildPackage,libip4tc)) $(eval $(call BuildPackage,libip6tc)) $(eval $(call BuildPackage,libxtables)) +$(eval $(call BuildPackage,libxtables-compat)) diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index 912fc3e28..22f110651 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -38,11 +38,12 @@ TARGET_CPPFLAGS:= \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ $(TARGET_CPPFLAGS) \ -DCONFIG_LIBNL20 \ - -D_GNU_SOURCE + -D_GNU_SOURCE \ + -flto MAKE_FLAGS += \ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \ - LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \ + LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections -flto" \ NL1FOUND="" NL2FOUND=Y \ NLLIBNAME="libnl-tiny" \ LIBS="-lm -lnl-tiny" \ diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 2448f43bd..287cc0b97 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2018-07-24 -PKG_SOURCE_VERSION:=94b1366de313c4d1c0c1ea8f0b859bc44d0b231a -PKG_MIRROR_HASH:=6fe4b76b24b9df0ced458d821df1f84818ca1647ae4d3c4439f486b5d35c986e +PKG_SOURCE_DATE:=2018-07-31 +PKG_SOURCE_VERSION:=65b8333f5b66f8812c1ed21a4d5b28a576e6ba63 +PKG_MIRROR_HASH:=78574c9f3da286ce2d896855e67193e88a5829fff8616ab093987ea3761c33c3 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 182fcace3..d1e995116 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -7,22 +7,25 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables -PKG_VERSION:=0.8.2 +PKG_VERSION:=0.9.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=675f0aaf88f11e7eacef63dc89cb65d207d9e09c3ea6d518f0ebbb013f0767ec +PKG_HASH:=ad8181b5fcb9ca572f444bed54018749588522ee97e4c21922648bb78d7e7e91 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0 PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk DISABLE_NLS:= CONFIGURE_ARGS += \ + --disable-debug \ + --disable-man-doc \ --with-mini-gmp \ --without-cli \ @@ -31,13 +34,26 @@ define Package/nftables CATEGORY:=Network SUBMENU:=Firewall TITLE:=nftables packet filtering userspace utility - DEPENDS:=+kmod-nft-core +libnftnl + DEPENDS:=+kmod-nft-core +libnftnl +PACKAGE_NFT_WITH_JSON:jansson URL:=http://netfilter.org/projects/nftables/ endef +define Package/nftables/config + config PACKAGE_NFT_WITH_JSON + bool "Build nftables with json support" + depends on PACKAGE_nftables + default n +endef + +ifeq ($(CONFIG_PACKAGE_NFT_WITH_JSON),y) +CONFIGURE_ARGS += --with-json +endif + define Package/nftables/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_BUILD_DIR)/src/nft $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ endef $(eval $(call BuildPackage,nftables)) diff --git a/package/network/utils/nftables/patches/100-disable-doc-generation.patch b/package/network/utils/nftables/patches/100-disable-doc-generation.patch deleted file mode 100644 index 2aa4409ef..000000000 --- a/package/network/utils/nftables/patches/100-disable-doc-generation.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/Makefile.am -+++ b/Makefile.am -@@ -2,7 +2,6 @@ ACLOCAL_AMFLAGS = -I m4 - - SUBDIRS = src \ - include \ -- doc \ - files - - EXTRA_DIST = tests diff --git a/package/network/utils/nftables/patches/200-src-support-for-flowtable-listing.patch b/package/network/utils/nftables/patches/200-src-support-for-flowtable-listing.patch deleted file mode 100644 index 259513de8..000000000 --- a/package/network/utils/nftables/patches/200-src-support-for-flowtable-listing.patch +++ /dev/null @@ -1,515 +0,0 @@ -From: Pablo Neira Ayuso -Date: Mon, 4 Dec 2017 13:28:25 +0100 -Subject: [PATCH] src: support for flowtable listing - -This patch allows you to dump existing flowtable. - - # nft list ruleset - table ip x { - flowtable x { - hook ingress priority 10 - devices = { eth0, tap0 } - } - } - -You can also list existing flowtables via: - - # nft list flowtables - table ip x { - flowtable x { - hook ingress priority 10 - devices = { eth0, tap0 } - } - } - - You need a Linux kernel >= 4.16-rc to test this new feature. - -Signed-off-by: Pablo Neira Ayuso ---- - ---- a/include/linux/netfilter/nf_tables.h -+++ b/include/linux/netfilter/nf_tables.h -@@ -92,6 +92,9 @@ enum nft_verdicts { - * @NFT_MSG_GETOBJ: get a stateful object (enum nft_obj_attributes) - * @NFT_MSG_DELOBJ: delete a stateful object (enum nft_obj_attributes) - * @NFT_MSG_GETOBJ_RESET: get and reset a stateful object (enum nft_obj_attributes) -+ * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes) -+ * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) -+ * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) - */ - enum nf_tables_msg_types { - NFT_MSG_NEWTABLE, -@@ -116,6 +119,9 @@ enum nf_tables_msg_types { - NFT_MSG_GETOBJ, - NFT_MSG_DELOBJ, - NFT_MSG_GETOBJ_RESET, -+ NFT_MSG_NEWFLOWTABLE, -+ NFT_MSG_GETFLOWTABLE, -+ NFT_MSG_DELFLOWTABLE, - NFT_MSG_MAX, - }; - ---- a/include/mnl.h -+++ b/include/mnl.h -@@ -89,6 +89,9 @@ int mnl_nft_obj_batch_add(struct nftnl_o - int mnl_nft_obj_batch_del(struct nftnl_obj *nln, struct nftnl_batch *batch, - unsigned int flags, uint32_t seqnum); - -+struct nftnl_flowtable_list * -+mnl_nft_flowtable_dump(struct netlink_ctx *ctx, int family, const char *table); -+ - struct nftnl_ruleset *mnl_nft_ruleset_dump(struct netlink_ctx *ctx, - uint32_t family); - int mnl_nft_event_listener(struct mnl_socket *nf_sock, unsigned int debug_mask, ---- a/include/netlink.h -+++ b/include/netlink.h -@@ -179,6 +179,10 @@ extern int netlink_add_obj(struct netlin - extern int netlink_delete_obj(struct netlink_ctx *ctx, const struct handle *h, - struct location *loc, uint32_t type); - -+extern int netlink_list_flowtables(struct netlink_ctx *ctx, -+ const struct handle *h, -+ const struct location *loc); -+ - extern void netlink_dump_chain(const struct nftnl_chain *nlc, - struct netlink_ctx *ctx); - extern void netlink_dump_rule(const struct nftnl_rule *nlr, ---- a/include/rule.h -+++ b/include/rule.h -@@ -35,6 +35,7 @@ struct position_spec { - * @chain: chain name (chains and rules only) - * @set: set name (sets only) - * @obj: stateful object name (stateful object only) -+ * @flowtable: flow table name (flow table only) - * @handle: rule handle (rules only) - * @position: rule position (rules only) - * @set_id: set ID (sets only) -@@ -45,6 +46,7 @@ struct handle { - const char *chain; - const char *set; - const char *obj; -+ const char *flowtable; - struct handle_spec handle; - struct position_spec position; - uint32_t set_id; -@@ -98,6 +100,7 @@ enum table_flags { - * @chains: chains contained in the table - * @sets: sets contained in the table - * @objs: stateful objects contained in the table -+ * @flowtables: flow tables contained in the table - * @flags: table flags - * @refcnt: table reference counter - */ -@@ -109,6 +112,7 @@ struct table { - struct list_head chains; - struct list_head sets; - struct list_head objs; -+ struct list_head flowtables; - enum table_flags flags; - unsigned int refcnt; - }; -@@ -315,6 +319,24 @@ void obj_print_plain(const struct obj *o - const char *obj_type_name(uint32_t type); - uint32_t obj_type_to_cmd(uint32_t type); - -+struct flowtable { -+ struct list_head list; -+ struct handle handle; -+ struct location location; -+ unsigned int hooknum; -+ int priority; -+ const char **dev_array; -+ int dev_array_len; -+ unsigned int refcnt; -+}; -+ -+extern struct flowtable *flowtable_alloc(const struct location *loc); -+extern struct flowtable *flowtable_get(struct flowtable *flowtable); -+extern void flowtable_free(struct flowtable *flowtable); -+extern void flowtable_add_hash(struct flowtable *flowtable, struct table *table); -+ -+void flowtable_print(const struct flowtable *n, struct output_ctx *octx); -+ - /** - * enum cmd_ops - command operations - * -@@ -373,6 +395,7 @@ enum cmd_ops { - * @CMD_OBJ_QUOTAS: multiple quotas - * @CMD_OBJ_LIMIT: limit - * @CMD_OBJ_LIMITS: multiple limits -+ * @CMD_OBJ_FLOWTABLES: flow tables - */ - enum cmd_obj { - CMD_OBJ_INVALID, -@@ -399,6 +422,7 @@ enum cmd_obj { - CMD_OBJ_CT_HELPERS, - CMD_OBJ_LIMIT, - CMD_OBJ_LIMITS, -+ CMD_OBJ_FLOWTABLES, - }; - - struct markup { ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -3196,6 +3196,7 @@ static int cmd_evaluate_list(struct eval - case CMD_OBJ_CT_HELPERS: - case CMD_OBJ_LIMITS: - case CMD_OBJ_SETS: -+ case CMD_OBJ_FLOWTABLES: - if (cmd->handle.table == NULL) - return 0; - if (table_lookup(&cmd->handle, ctx->cache) == NULL) ---- a/src/mnl.c -+++ b/src/mnl.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - - #include -@@ -953,6 +954,63 @@ int mnl_nft_setelem_get(struct netlink_c - return nft_mnl_talk(ctx, nlh, nlh->nlmsg_len, set_elem_cb, nls); - } - -+static int flowtable_cb(const struct nlmsghdr *nlh, void *data) -+{ -+ struct nftnl_flowtable_list *nln_list = data; -+ struct nftnl_flowtable *n; -+ -+ if (check_genid(nlh) < 0) -+ return MNL_CB_ERROR; -+ -+ n = nftnl_flowtable_alloc(); -+ if (n == NULL) -+ memory_allocation_error(); -+ -+ if (nftnl_flowtable_nlmsg_parse(nlh, n) < 0) -+ goto err_free; -+ -+ nftnl_flowtable_list_add_tail(n, nln_list); -+ return MNL_CB_OK; -+ -+err_free: -+ nftnl_flowtable_free(n); -+ return MNL_CB_OK; -+} -+ -+struct nftnl_flowtable_list * -+mnl_nft_flowtable_dump(struct netlink_ctx *ctx, int family, const char *table) -+{ -+ struct nftnl_flowtable_list *nln_list; -+ char buf[MNL_SOCKET_BUFFER_SIZE]; -+ struct nftnl_flowtable *n; -+ struct nlmsghdr *nlh; -+ int ret; -+ -+ n = nftnl_flowtable_alloc(); -+ if (n == NULL) -+ memory_allocation_error(); -+ -+ nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_GETFLOWTABLE, family, -+ NLM_F_DUMP | NLM_F_ACK, ctx->seqnum); -+ if (table != NULL) -+ nftnl_flowtable_set_str(n, NFTNL_FLOWTABLE_TABLE, table); -+ nftnl_flowtable_nlmsg_build_payload(nlh, n); -+ nftnl_flowtable_free(n); -+ -+ nln_list = nftnl_flowtable_list_alloc(); -+ if (nln_list == NULL) -+ memory_allocation_error(); -+ -+ ret = nft_mnl_talk(ctx, nlh, nlh->nlmsg_len, flowtable_cb, nln_list); -+ if (ret < 0) -+ goto err; -+ -+ return nln_list; -+err: -+ nftnl_flowtable_list_free(nln_list); -+ return NULL; -+} -+ - /* - * ruleset - */ ---- a/src/netlink.c -+++ b/src/netlink.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1826,6 +1827,70 @@ int netlink_reset_objs(struct netlink_ct - return err; - } - -+static struct flowtable * -+netlink_delinearize_flowtable(struct netlink_ctx *ctx, -+ struct nftnl_flowtable *nlo) -+{ -+ struct flowtable *flowtable; -+ const char **dev_array; -+ int len = 0, i; -+ -+ flowtable = flowtable_alloc(&netlink_location); -+ flowtable->handle.family = -+ nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_FAMILY); -+ flowtable->handle.table = -+ xstrdup(nftnl_flowtable_get_str(nlo, NFTNL_FLOWTABLE_TABLE)); -+ flowtable->handle.flowtable = -+ xstrdup(nftnl_flowtable_get_str(nlo, NFTNL_FLOWTABLE_NAME)); -+ dev_array = nftnl_flowtable_get_array(nlo, NFTNL_FLOWTABLE_DEVICES); -+ while (dev_array[len] != '\0') -+ len++; -+ -+ flowtable->dev_array = calloc(1, len * sizeof(char *)); -+ for (i = 0; i < len; i++) -+ flowtable->dev_array[i] = xstrdup(dev_array[i]); -+ -+ flowtable->dev_array_len = len; -+ -+ flowtable->priority = -+ nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_PRIO); -+ flowtable->hooknum = -+ nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_HOOKNUM); -+ -+ return flowtable; -+} -+ -+static int list_flowtable_cb(struct nftnl_flowtable *nls, void *arg) -+{ -+ struct netlink_ctx *ctx = arg; -+ struct flowtable *flowtable; -+ -+ flowtable = netlink_delinearize_flowtable(ctx, nls); -+ if (flowtable == NULL) -+ return -1; -+ list_add_tail(&flowtable->list, &ctx->list); -+ return 0; -+} -+ -+int netlink_list_flowtables(struct netlink_ctx *ctx, const struct handle *h, -+ const struct location *loc) -+{ -+ struct nftnl_flowtable_list *flowtable_cache; -+ int err; -+ -+ flowtable_cache = mnl_nft_flowtable_dump(ctx, h->family, h->table); -+ if (flowtable_cache == NULL) { -+ if (errno == EINTR) -+ return -1; -+ -+ return 0; -+ } -+ -+ err = nftnl_flowtable_list_foreach(flowtable_cache, list_flowtable_cb, ctx); -+ nftnl_flowtable_list_free(flowtable_cache); -+ return err; -+} -+ - int netlink_batch_send(struct netlink_ctx *ctx, struct list_head *err_list) - { - return mnl_batch_talk(ctx, err_list); ---- a/src/parser_bison.y -+++ b/src/parser_bison.y -@@ -248,6 +248,8 @@ int nft_lex(void *, void *, void *); - %token METER "meter" - %token METERS "meters" - -+%token FLOWTABLES "flowtables" -+ - %token NUM "number" - %token STRING "string" - %token QUOTED_STRING "quoted string" -@@ -1104,6 +1106,10 @@ list_cmd : TABLE table_spec - { - $$ = cmd_alloc(CMD_LIST, CMD_OBJ_METER, &$2, &@$, NULL); - } -+ | FLOWTABLES ruleset_spec -+ { -+ $$ = cmd_alloc(CMD_LIST, CMD_OBJ_FLOWTABLES, &$2, &@$, NULL); -+ } - | MAPS ruleset_spec - { - $$ = cmd_alloc(CMD_LIST, CMD_OBJ_MAPS, &$2, &@$, NULL); ---- a/src/rule.c -+++ b/src/rule.c -@@ -95,6 +95,11 @@ static int cache_init_objects(struct net - return -1; - list_splice_tail_init(&ctx->list, &table->chains); - -+ ret = netlink_list_flowtables(ctx, &table->handle, &internal_location); -+ if (ret < 0) -+ return -1; -+ list_splice_tail_init(&ctx->list, &table->flowtables); -+ - if (cmd != CMD_RESET) { - ret = netlink_list_objs(ctx, &table->handle, &internal_location); - if (ret < 0) -@@ -722,6 +727,7 @@ struct table *table_alloc(void) - init_list_head(&table->chains); - init_list_head(&table->sets); - init_list_head(&table->objs); -+ init_list_head(&table->flowtables); - init_list_head(&table->scope.symbols); - table->refcnt = 1; - -@@ -797,6 +803,7 @@ static void table_print_options(const st - - static void table_print(const struct table *table, struct output_ctx *octx) - { -+ struct flowtable *flowtable; - struct chain *chain; - struct obj *obj; - struct set *set; -@@ -818,6 +825,11 @@ static void table_print(const struct tab - set_print(set, octx); - delim = "\n"; - } -+ list_for_each_entry(flowtable, &table->flowtables, list) { -+ nft_print(octx, "%s", delim); -+ flowtable_print(flowtable, octx); -+ delim = "\n"; -+ } - list_for_each_entry(chain, &table->chains, list) { - nft_print(octx, "%s", delim); - chain_print(chain, octx); -@@ -1481,6 +1493,114 @@ static int do_list_obj(struct netlink_ct - return 0; - } - -+struct flowtable *flowtable_alloc(const struct location *loc) -+{ -+ struct flowtable *flowtable; -+ -+ flowtable = xzalloc(sizeof(*flowtable)); -+ if (loc != NULL) -+ flowtable->location = *loc; -+ -+ flowtable->refcnt = 1; -+ return flowtable; -+} -+ -+struct flowtable *flowtable_get(struct flowtable *flowtable) -+{ -+ flowtable->refcnt++; -+ return flowtable; -+} -+ -+void flowtable_free(struct flowtable *flowtable) -+{ -+ if (--flowtable->refcnt > 0) -+ return; -+ handle_free(&flowtable->handle); -+ xfree(flowtable); -+} -+ -+void flowtable_add_hash(struct flowtable *flowtable, struct table *table) -+{ -+ list_add_tail(&flowtable->list, &table->flowtables); -+} -+ -+static void flowtable_print_declaration(const struct flowtable *flowtable, -+ struct print_fmt_options *opts, -+ struct output_ctx *octx) -+{ -+ int i; -+ -+ nft_print(octx, "%sflowtable", opts->tab); -+ -+ if (opts->family != NULL) -+ nft_print(octx, " %s", opts->family); -+ -+ if (opts->table != NULL) -+ nft_print(octx, " %s", opts->table); -+ -+ nft_print(octx, " %s {%s", flowtable->handle.flowtable, opts->nl); -+ -+ nft_print(octx, "%s%shook %s priority %d%s", -+ opts->tab, opts->tab, "ingress", -+ flowtable->priority, opts->stmt_separator); -+ -+ nft_print(octx, "%s%sdevices = { ", opts->tab, opts->tab); -+ for (i = 0; i < flowtable->dev_array_len; i++) { -+ nft_print(octx, "%s", flowtable->dev_array[i]); -+ if (i + 1 != flowtable->dev_array_len) -+ nft_print(octx, ", "); -+ } -+ nft_print(octx, " }%s", opts->stmt_separator); -+} -+ -+static void do_flowtable_print(const struct flowtable *flowtable, -+ struct print_fmt_options *opts, -+ struct output_ctx *octx) -+{ -+ flowtable_print_declaration(flowtable, opts, octx); -+ nft_print(octx, "%s}%s", opts->tab, opts->nl); -+} -+ -+void flowtable_print(const struct flowtable *s, struct output_ctx *octx) -+{ -+ struct print_fmt_options opts = { -+ .tab = "\t", -+ .nl = "\n", -+ .stmt_separator = "\n", -+ }; -+ -+ do_flowtable_print(s, &opts, octx); -+} -+ -+static int do_list_flowtables(struct netlink_ctx *ctx, struct cmd *cmd) -+{ -+ struct print_fmt_options opts = { -+ .tab = "\t", -+ .nl = "\n", -+ .stmt_separator = "\n", -+ }; -+ struct flowtable *flowtable; -+ struct table *table; -+ -+ list_for_each_entry(table, &ctx->cache->list, list) { -+ if (cmd->handle.family != NFPROTO_UNSPEC && -+ cmd->handle.family != table->handle.family) -+ continue; -+ -+ nft_print(ctx->octx, "table %s %s {\n", -+ family2str(table->handle.family), -+ table->handle.table); -+ -+ list_for_each_entry(flowtable, &table->flowtables, list) { -+ flowtable_print_declaration(flowtable, &opts, ctx->octx); -+ nft_print(ctx->octx, "%s}%s", opts.tab, opts.nl); -+ } -+ -+ nft_print(ctx->octx, "}\n"); -+ } -+ return 0; -+} -+ - static int do_list_ruleset(struct netlink_ctx *ctx, struct cmd *cmd) - { - unsigned int family = cmd->handle.family; -@@ -1628,6 +1748,8 @@ static int do_command_list(struct netlin - case CMD_OBJ_LIMIT: - case CMD_OBJ_LIMITS: - return do_list_obj(ctx, cmd, NFT_OBJECT_LIMIT); -+ case CMD_OBJ_FLOWTABLES: -+ return do_list_flowtables(ctx, cmd); - default: - BUG("invalid command object type %u\n", cmd->obj); - } ---- a/src/scanner.l -+++ b/src/scanner.l -@@ -297,6 +297,8 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr - "meter" { return METER; } - "meters" { return METERS; } - -+"flowtables" { return FLOWTABLES; } -+ - "counter" { return COUNTER; } - "name" { return NAME; } - "packets" { return PACKETS; } diff --git a/package/network/utils/nftables/patches/201-src-add-support-to-add-flowtables.patch b/package/network/utils/nftables/patches/201-src-add-support-to-add-flowtables.patch deleted file mode 100644 index 888a76716..000000000 --- a/package/network/utils/nftables/patches/201-src-add-support-to-add-flowtables.patch +++ /dev/null @@ -1,515 +0,0 @@ -From: Pablo Neira Ayuso -Date: Thu, 18 Jan 2018 08:43:23 +0100 -Subject: [PATCH] src: add support to add flowtables - -This patch allows you to create flowtable: - - # nft add table x - # nft add flowtable x m { hook ingress priority 10\; devices = { eth0, wlan0 }\; } - -You have to specify hook and priority. So far, only the ingress hook is -supported. The priority represents where this flowtable is placed in the -ingress hook, which is registered to the devices that the user -specifies. - -You can also use the 'create' command instead to bail out in case that -there is an existing flowtable with this name. - -Signed-off-by: Pablo Neira Ayuso ---- - ---- a/include/expression.h -+++ b/include/expression.h -@@ -407,6 +407,8 @@ extern struct expr *prefix_expr_alloc(co - extern struct expr *range_expr_alloc(const struct location *loc, - struct expr *low, struct expr *high); - -+extern struct expr *compound_expr_alloc(const struct location *loc, -+ const struct expr_ops *ops); - extern void compound_expr_add(struct expr *compound, struct expr *expr); - extern void compound_expr_remove(struct expr *compound, struct expr *expr); - extern void list_expr_sort(struct list_head *head); ---- a/include/mnl.h -+++ b/include/mnl.h -@@ -92,6 +92,10 @@ int mnl_nft_obj_batch_del(struct nftnl_o - struct nftnl_flowtable_list * - mnl_nft_flowtable_dump(struct netlink_ctx *ctx, int family, const char *table); - -+int mnl_nft_flowtable_batch_add(struct nftnl_flowtable *flo, -+ struct nftnl_batch *batch, unsigned int flags, -+ uint32_t seqnum); -+ - struct nftnl_ruleset *mnl_nft_ruleset_dump(struct netlink_ctx *ctx, - uint32_t family); - int mnl_nft_event_listener(struct mnl_socket *nf_sock, unsigned int debug_mask, ---- a/include/netlink.h -+++ b/include/netlink.h -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -182,6 +183,9 @@ extern int netlink_delete_obj(struct net - extern int netlink_list_flowtables(struct netlink_ctx *ctx, - const struct handle *h, - const struct location *loc); -+extern int netlink_add_flowtable(struct netlink_ctx *ctx, -+ const struct handle *h, struct flowtable *ft, -+ uint32_t flags); - - extern void netlink_dump_chain(const struct nftnl_chain *nlc, - struct netlink_ctx *ctx); ---- a/include/rule.h -+++ b/include/rule.h -@@ -322,10 +322,13 @@ uint32_t obj_type_to_cmd(uint32_t type); - struct flowtable { - struct list_head list; - struct handle handle; -+ struct scope scope; - struct location location; -+ const char * hookstr; - unsigned int hooknum; - int priority; - const char **dev_array; -+ struct expr *dev_expr; - int dev_array_len; - unsigned int refcnt; - }; -@@ -383,6 +386,8 @@ enum cmd_ops { - * @CMD_OBJ_CHAIN: chain - * @CMD_OBJ_CHAINS: multiple chains - * @CMD_OBJ_TABLE: table -+ * @CMD_OBJ_FLOWTABLE: flowtable -+ * @CMD_OBJ_FLOWTABLES: flowtables - * @CMD_OBJ_RULESET: ruleset - * @CMD_OBJ_EXPR: expression - * @CMD_OBJ_MONITOR: monitor -@@ -422,6 +427,7 @@ enum cmd_obj { - CMD_OBJ_CT_HELPERS, - CMD_OBJ_LIMIT, - CMD_OBJ_LIMITS, -+ CMD_OBJ_FLOWTABLE, - CMD_OBJ_FLOWTABLES, - }; - -@@ -481,6 +487,7 @@ struct cmd { - struct rule *rule; - struct chain *chain; - struct table *table; -+ struct flowtable *flowtable; - struct monitor *monitor; - struct markup *markup; - struct obj *object; ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -2897,6 +2897,24 @@ static int set_evaluate(struct eval_ctx - return 0; - } - -+static uint32_t str2hooknum(uint32_t family, const char *hook); -+ -+static int flowtable_evaluate(struct eval_ctx *ctx, struct flowtable *ft) -+{ -+ struct table *table; -+ -+ table = table_lookup_global(ctx); -+ if (table == NULL) -+ return cmd_error(ctx, "Could not process rule: Table '%s' does not exist", -+ ctx->cmd->handle.table); -+ -+ ft->hooknum = str2hooknum(NFPROTO_NETDEV, ft->hookstr); -+ if (ft->hooknum == NF_INET_NUMHOOKS) -+ return chain_error(ctx, ft, "invalid hook %s", ft->hookstr); -+ -+ return 0; -+} -+ - static int rule_evaluate(struct eval_ctx *ctx, struct rule *rule) - { - struct stmt *stmt, *tstmt = NULL; -@@ -3069,6 +3087,14 @@ static int cmd_evaluate_add(struct eval_ - return chain_evaluate(ctx, cmd->chain); - case CMD_OBJ_TABLE: - return table_evaluate(ctx, cmd->table); -+ case CMD_OBJ_FLOWTABLE: -+ ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, -+ ctx->msgs, ctx->debug_mask & NFT_DEBUG_NETLINK, ctx->octx); -+ if (ret < 0) -+ return ret; -+ -+ handle_merge(&cmd->flowtable->handle, &cmd->handle); -+ return flowtable_evaluate(ctx, cmd->flowtable); - case CMD_OBJ_COUNTER: - case CMD_OBJ_QUOTA: - case CMD_OBJ_CT_HELPER: ---- a/src/expression.c -+++ b/src/expression.c -@@ -663,8 +663,8 @@ struct expr *range_expr_alloc(const stru - return expr; - } - --static struct expr *compound_expr_alloc(const struct location *loc, -- const struct expr_ops *ops) -+struct expr *compound_expr_alloc(const struct location *loc, -+ const struct expr_ops *ops) - { - struct expr *expr; - ---- a/src/mnl.c -+++ b/src/mnl.c -@@ -1011,6 +1011,22 @@ err: - return NULL; - } - -+int mnl_nft_flowtable_batch_add(struct nftnl_flowtable *flo, -+ struct nftnl_batch *batch, unsigned int flags, -+ uint32_t seqnum) -+{ -+ struct nlmsghdr *nlh; -+ -+ nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(batch), -+ NFT_MSG_NEWFLOWTABLE, -+ nftnl_flowtable_get_u32(flo, NFTNL_FLOWTABLE_FAMILY), -+ NLM_F_CREATE | flags, seqnum); -+ nftnl_flowtable_nlmsg_build_payload(nlh, flo); -+ mnl_nft_batch_continue(batch); -+ -+ return 0; -+} -+ - /* - * ruleset - */ ---- a/src/netlink.c -+++ b/src/netlink.c -@@ -1773,6 +1773,64 @@ static struct obj *netlink_delinearize_o - return obj; - } - -+static struct nftnl_flowtable *alloc_nftnl_flowtable(const struct handle *h, -+ const struct flowtable *ft) -+{ -+ struct nftnl_flowtable *flo; -+ -+ flo = nftnl_flowtable_alloc(); -+ if (flo == NULL) -+ memory_allocation_error(); -+ -+ nftnl_flowtable_set_u32(flo, NFTNL_FLOWTABLE_FAMILY, h->family); -+ nftnl_flowtable_set_str(flo, NFTNL_FLOWTABLE_TABLE, h->table); -+ if (h->flowtable != NULL) -+ nftnl_flowtable_set_str(flo, NFTNL_FLOWTABLE_NAME, h->flowtable); -+ -+ return flo; -+} -+ -+static void netlink_dump_flowtable(struct nftnl_flowtable *flo, -+ struct netlink_ctx *ctx) -+{ -+ FILE *fp = ctx->octx->output_fp; -+ -+ if (!(ctx->debug_mask & NFT_DEBUG_NETLINK) || !fp) -+ return; -+ -+ nftnl_flowtable_fprintf(fp, flo, 0, 0); -+ fprintf(fp, "\n"); -+} -+ -+int netlink_add_flowtable(struct netlink_ctx *ctx, const struct handle *h, -+ struct flowtable *ft, uint32_t flags) -+{ -+ struct nftnl_flowtable *flo; -+ const char *dev_array[8]; -+ struct expr *expr; -+ int i = 0, err; -+ -+ flo = alloc_nftnl_flowtable(h, ft); -+ nftnl_flowtable_set_u32(flo, NFTNL_FLOWTABLE_HOOKNUM, ft->hooknum); -+ nftnl_flowtable_set_u32(flo, NFTNL_FLOWTABLE_PRIO, ft->priority); -+ -+ list_for_each_entry(expr, &ft->dev_expr->expressions, list) -+ dev_array[i++] = expr->identifier; -+ -+ dev_array[i] = NULL; -+ nftnl_flowtable_set_array(flo, NFTNL_FLOWTABLE_DEVICES, dev_array); -+ -+ netlink_dump_flowtable(flo, ctx); -+ -+ err = mnl_nft_flowtable_batch_add(flo, ctx->batch, flags, ctx->seqnum); -+ if (err < 0) -+ netlink_io_error(ctx, &ft->location, "Could not add flowtable: %s", -+ strerror(errno)); -+ nftnl_flowtable_free(flo); -+ -+ return err; -+} -+ - static int list_obj_cb(struct nftnl_obj *nls, void *arg) - { - struct netlink_ctx *ctx = arg; ---- a/src/parser_bison.y -+++ b/src/parser_bison.y -@@ -145,6 +145,7 @@ int nft_lex(void *, void *, void *); - struct expr *expr; - struct set *set; - struct obj *obj; -+ struct flowtable *flowtable; - struct counter *counter; - struct quota *quota; - struct ct *ct; -@@ -189,6 +190,7 @@ int nft_lex(void *, void *, void *); - - %token HOOK "hook" - %token DEVICE "device" -+%token DEVICES "devices" - %token TABLE "table" - %token TABLES "tables" - %token CHAIN "chain" -@@ -200,6 +202,7 @@ int nft_lex(void *, void *, void *); - %token ELEMENT "element" - %token MAP "map" - %token MAPS "maps" -+%token FLOWTABLE "flowtable" - %token HANDLE "handle" - %token RULESET "ruleset" - %token TRACE "trace" -@@ -500,9 +503,9 @@ int nft_lex(void *, void *, void *); - %type base_cmd add_cmd replace_cmd create_cmd insert_cmd delete_cmd list_cmd reset_cmd flush_cmd rename_cmd export_cmd monitor_cmd describe_cmd import_cmd - %destructor { cmd_free($$); } base_cmd add_cmd replace_cmd create_cmd insert_cmd delete_cmd list_cmd reset_cmd flush_cmd rename_cmd export_cmd monitor_cmd describe_cmd import_cmd - --%type table_spec chain_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec --%destructor { handle_free(&$$); } table_spec chain_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec --%type set_spec set_identifier obj_spec obj_identifier -+%type table_spec chain_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec -+%destructor { handle_free(&$$); } table_spec chain_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec -+%type set_spec set_identifier flowtable_identifier obj_spec obj_identifier - %destructor { handle_free(&$$); } set_spec set_identifier obj_spec obj_identifier - %type family_spec family_spec_explicit chain_policy prio_spec - -@@ -526,6 +529,9 @@ int nft_lex(void *, void *, void *); - %type map_block_alloc map_block - %destructor { set_free($$); } map_block_alloc - -+%type flowtable_block_alloc flowtable_block -+%destructor { flowtable_free($$); } flowtable_block_alloc -+ - %type obj_block_alloc counter_block quota_block ct_helper_block limit_block - %destructor { obj_free($$); } obj_block_alloc - -@@ -606,8 +612,8 @@ int nft_lex(void *, void *, void *); - %type verdict_map_expr verdict_map_list_expr verdict_map_list_member_expr - %destructor { expr_free($$); } verdict_map_expr verdict_map_list_expr verdict_map_list_member_expr - --%type set_expr set_block_expr set_list_expr set_list_member_expr --%destructor { expr_free($$); } set_expr set_block_expr set_list_expr set_list_member_expr -+%type set_expr set_block_expr set_list_expr set_list_member_expr flowtable_expr flowtable_list_expr flowtable_expr_member -+%destructor { expr_free($$); } set_expr set_block_expr set_list_expr set_list_member_expr flowtable_expr flowtable_list_expr flowtable_expr_member - %type set_elem_expr set_elem_expr_alloc set_lhs_expr set_rhs_expr - %destructor { expr_free($$); } set_elem_expr set_elem_expr_alloc set_lhs_expr set_rhs_expr - %type set_elem_expr_stmt set_elem_expr_stmt_alloc -@@ -872,6 +878,13 @@ add_cmd : TABLE table_spec - { - $$ = cmd_alloc(CMD_ADD, CMD_OBJ_SETELEM, &$2, &@$, $3); - } -+ | FLOWTABLE flowtable_spec flowtable_block_alloc -+ '{' flowtable_block '}' -+ { -+ $5->location = @5; -+ handle_merge(&$3->handle, &$2); -+ $$ = cmd_alloc(CMD_ADD, CMD_OBJ_FLOWTABLE, &$2, &@$, $5); -+ } - | COUNTER obj_spec - { - struct obj *obj; -@@ -947,6 +960,13 @@ create_cmd : TABLE table_spec - { - $$ = cmd_alloc(CMD_CREATE, CMD_OBJ_SETELEM, &$2, &@$, $3); - } -+ | FLOWTABLE flowtable_spec flowtable_block_alloc -+ '{' flowtable_block '}' -+ { -+ $5->location = @5; -+ handle_merge(&$3->handle, &$2); -+ $$ = cmd_alloc(CMD_CREATE, CMD_OBJ_FLOWTABLE, &$2, &@$, $5); -+ } - | COUNTER obj_spec - { - struct obj *obj; -@@ -1317,6 +1337,17 @@ table_block : /* empty */ { $$ = $list, &$1->sets); - $$ = $1; - } -+ -+ | table_block FLOWTABLE flowtable_identifier -+ flowtable_block_alloc '{' flowtable_block '}' -+ stmt_separator -+ { -+ $4->location = @3; -+ handle_merge(&$4->handle, &$3); -+ handle_free(&$3); -+ list_add_tail(&$4->list, &$1->flowtables); -+ $$ = $1; -+ } - | table_block COUNTER obj_identifier - obj_block_alloc '{' counter_block '}' - stmt_separator -@@ -1512,6 +1543,62 @@ set_policy_spec : PERFORMANCE { $$ = NF - | MEMORY { $$ = NFT_SET_POL_MEMORY; } - ; - -+flowtable_block_alloc : /* empty */ -+ { -+ $$ = flowtable_alloc(NULL); -+ } -+ ; -+ -+flowtable_block : /* empty */ { $$ = $-1; } -+ | flowtable_block common_block -+ | flowtable_block stmt_separator -+ | flowtable_block HOOK STRING PRIORITY prio_spec stmt_separator -+ { -+ $$->hookstr = chain_hookname_lookup($3); -+ if ($$->hookstr == NULL) { -+ erec_queue(error(&@3, "unknown chain hook %s", $3), -+ state->msgs); -+ xfree($3); -+ YYERROR; -+ } -+ xfree($3); -+ -+ $$->priority = $5; -+ } -+ | flowtable_block DEVICES '=' flowtable_expr stmt_separator -+ { -+ $$->dev_expr = $4; -+ } -+ ; -+ -+flowtable_expr : '{' flowtable_list_expr '}' -+ { -+ $2->location = @$; -+ $$ = $2; -+ } -+ ; -+ -+flowtable_list_expr : flowtable_expr_member -+ { -+ $$ = compound_expr_alloc(&@$, NULL); -+ compound_expr_add($$, $1); -+ } -+ | flowtable_list_expr COMMA flowtable_expr_member -+ { -+ compound_expr_add($1, $3); -+ $$ = $1; -+ } -+ | flowtable_list_expr COMMA opt_newline -+ ; -+ -+flowtable_expr_member : STRING -+ { -+ $$ = symbol_expr_alloc(&@$, SYMBOL_VALUE, -+ current_scope(state), -+ $1); -+ } -+ ; -+ - data_type_atom_expr : type_identifier - { - const struct datatype *dtype = datatype_lookup_byname($1); -@@ -1720,6 +1807,21 @@ set_identifier : identifier - } - ; - -+ -+flowtable_spec : table_spec identifier -+ { -+ $$ = $1; -+ $$.flowtable = $2; -+ } -+ ; -+ -+flowtable_identifier : identifier -+ { -+ memset(&$$, 0, sizeof($$)); -+ $$.flowtable = $1; -+ } -+ ; -+ - obj_spec : table_spec identifier - { - $$ = $1; ---- a/src/rule.c -+++ b/src/rule.c -@@ -45,6 +45,8 @@ void handle_merge(struct handle *dst, co - dst->chain = xstrdup(src->chain); - if (dst->set == NULL && src->set != NULL) - dst->set = xstrdup(src->set); -+ if (dst->flowtable == NULL && src->flowtable != NULL) -+ dst->flowtable = xstrdup(src->flowtable); - if (dst->obj == NULL && src->obj != NULL) - dst->obj = xstrdup(src->obj); - if (dst->handle.id == 0) -@@ -857,6 +859,7 @@ struct cmd *cmd_alloc(enum cmd_ops op, e - void nft_cmd_expand(struct cmd *cmd) - { - struct list_head new_cmds; -+ struct flowtable *ft; - struct table *table; - struct chain *chain; - struct rule *rule; -@@ -896,6 +899,14 @@ void nft_cmd_expand(struct cmd *cmd) - &set->location, set_get(set)); - list_add_tail(&new->list, &new_cmds); - } -+ list_for_each_entry(ft, &table->flowtables, list) { -+ handle_merge(&ft->handle, &table->handle); -+ memset(&h, 0, sizeof(h)); -+ handle_merge(&h, &ft->handle); -+ new = cmd_alloc(CMD_ADD, CMD_OBJ_FLOWTABLE, &h, -+ &ft->location, flowtable_get(ft)); -+ list_add_tail(&new->list, &new_cmds); -+ } - list_for_each_entry(chain, &table->chains, list) { - list_for_each_entry(rule, &chain->rules, list) { - memset(&h, 0, sizeof(h)); -@@ -982,6 +993,9 @@ void cmd_free(struct cmd *cmd) - case CMD_OBJ_LIMIT: - obj_free(cmd->object); - break; -+ case CMD_OBJ_FLOWTABLE: -+ flowtable_free(cmd->flowtable); -+ break; - default: - BUG("invalid command object type %u\n", cmd->obj); - } -@@ -1071,6 +1085,9 @@ static int do_command_add(struct netlink - case CMD_OBJ_CT_HELPER: - case CMD_OBJ_LIMIT: - return netlink_add_obj(ctx, &cmd->handle, cmd->object, flags); -+ case CMD_OBJ_FLOWTABLE: -+ return netlink_add_flowtable(ctx, &cmd->handle, cmd->flowtable, -+ flags); - default: - BUG("invalid command object type %u\n", cmd->obj); - } ---- a/src/scanner.l -+++ b/src/scanner.l -@@ -238,6 +238,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr - - "hook" { return HOOK; } - "device" { return DEVICE; } -+"devices" { return DEVICES; } - "table" { return TABLE; } - "tables" { return TABLES; } - "chain" { return CHAIN; } -@@ -249,6 +250,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr - "element" { return ELEMENT; } - "map" { return MAP; } - "maps" { return MAPS; } -+"flowtable" { return FLOWTABLE; } - "handle" { return HANDLE; } - "ruleset" { return RULESET; } - "trace" { return TRACE; } diff --git a/package/network/utils/nftables/patches/202-src-delete-flowtable.patch b/package/network/utils/nftables/patches/202-src-delete-flowtable.patch deleted file mode 100644 index 32b7f96bc..000000000 --- a/package/network/utils/nftables/patches/202-src-delete-flowtable.patch +++ /dev/null @@ -1,122 +0,0 @@ -From: Pablo Neira Ayuso -Date: Fri, 19 Jan 2018 01:41:38 +0100 -Subject: [PATCH] src: delete flowtable - -This patch allows you to delete an existing flowtable: - - # nft delete flowtable x m - -Signed-off-by: Pablo Neira Ayuso ---- - ---- a/include/mnl.h -+++ b/include/mnl.h -@@ -95,6 +95,9 @@ mnl_nft_flowtable_dump(struct netlink_ct - int mnl_nft_flowtable_batch_add(struct nftnl_flowtable *flo, - struct nftnl_batch *batch, unsigned int flags, - uint32_t seqnum); -+int mnl_nft_flowtable_batch_del(struct nftnl_flowtable *flow, -+ struct nftnl_batch *batch, unsigned int flags, -+ uint32_t seqnum); - - struct nftnl_ruleset *mnl_nft_ruleset_dump(struct netlink_ctx *ctx, - uint32_t family); ---- a/include/netlink.h -+++ b/include/netlink.h -@@ -186,6 +186,9 @@ extern int netlink_list_flowtables(struc - extern int netlink_add_flowtable(struct netlink_ctx *ctx, - const struct handle *h, struct flowtable *ft, - uint32_t flags); -+extern int netlink_delete_flowtable(struct netlink_ctx *ctx, -+ const struct handle *h, -+ struct location *loc); - - extern void netlink_dump_chain(const struct nftnl_chain *nlc, - struct netlink_ctx *ctx); ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -3121,6 +3121,7 @@ static int cmd_evaluate_delete(struct ev - case CMD_OBJ_RULE: - case CMD_OBJ_CHAIN: - case CMD_OBJ_TABLE: -+ case CMD_OBJ_FLOWTABLE: - case CMD_OBJ_COUNTER: - case CMD_OBJ_QUOTA: - case CMD_OBJ_CT_HELPER: ---- a/src/mnl.c -+++ b/src/mnl.c -@@ -1027,6 +1027,22 @@ int mnl_nft_flowtable_batch_add(struct n - return 0; - } - -+int mnl_nft_flowtable_batch_del(struct nftnl_flowtable *flo, -+ struct nftnl_batch *batch, unsigned int flags, -+ uint32_t seqnum) -+{ -+ struct nlmsghdr *nlh; -+ -+ nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(batch), -+ NFT_MSG_DELFLOWTABLE, -+ nftnl_flowtable_get_u32(flo, NFTNL_FLOWTABLE_FAMILY), -+ flags, seqnum); -+ nftnl_flowtable_nlmsg_build_payload(nlh, flo); -+ mnl_nft_batch_continue(batch); -+ -+ return 0; -+} -+ - /* - * ruleset - */ ---- a/src/netlink.c -+++ b/src/netlink.c -@@ -1831,6 +1831,24 @@ int netlink_add_flowtable(struct netlink - return err; - } - -+int netlink_delete_flowtable(struct netlink_ctx *ctx, const struct handle *h, -+ struct location *loc) -+{ -+ struct nftnl_flowtable *flo; -+ int err; -+ -+ flo = alloc_nftnl_flowtable(h, NULL); -+ netlink_dump_flowtable(flo, ctx); -+ -+ err = mnl_nft_flowtable_batch_del(flo, ctx->batch, 0, ctx->seqnum); -+ if (err < 0) -+ netlink_io_error(ctx, loc, "Could not delete flowtable: %s", -+ strerror(errno)); -+ nftnl_flowtable_free(flo); -+ -+ return err; -+} -+ - static int list_obj_cb(struct nftnl_obj *nls, void *arg) - { - struct netlink_ctx *ctx = arg; ---- a/src/parser_bison.y -+++ b/src/parser_bison.y -@@ -1024,6 +1024,10 @@ delete_cmd : TABLE table_spec - { - $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_SETELEM, &$2, &@$, $3); - } -+ | FLOWTABLE flowtable_spec -+ { -+ $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_FLOWTABLE, &$2, &@$, NULL); -+ } - | COUNTER obj_spec - { - $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_COUNTER, &$2, &@$, NULL); ---- a/src/rule.c -+++ b/src/rule.c -@@ -1177,6 +1177,9 @@ static int do_command_delete(struct netl - case CMD_OBJ_LIMIT: - return netlink_delete_obj(ctx, &cmd->handle, &cmd->location, - NFT_OBJECT_LIMIT); -+ case CMD_OBJ_FLOWTABLE: -+ return netlink_delete_flowtable(ctx, &cmd->handle, -+ &cmd->location); - default: - BUG("invalid command object type %u\n", cmd->obj); - } diff --git a/package/network/utils/nftables/patches/203-src-flow-offload-support.patch b/package/network/utils/nftables/patches/203-src-flow-offload-support.patch deleted file mode 100644 index 86dfb1d94..000000000 --- a/package/network/utils/nftables/patches/203-src-flow-offload-support.patch +++ /dev/null @@ -1,191 +0,0 @@ -From: Pablo Neira Ayuso -Date: Sun, 3 Dec 2017 21:27:03 +0100 -Subject: [PATCH] src: flow offload support - -This patch allows us to refer to existing flowtables: - - # nft add rule x x flow offload @m - -Packets matching this rule create an entry in the flow table 'm', hence, -follow up packets that get to the flowtable at ingress bypass the -classic forwarding path. - -Signed-off-by: Pablo Neira Ayuso ---- - ---- a/include/ct.h -+++ b/include/ct.h -@@ -29,6 +29,8 @@ extern struct expr *ct_expr_alloc(const - extern void ct_expr_update_type(struct proto_ctx *ctx, struct expr *expr); - - extern struct stmt *notrack_stmt_alloc(const struct location *loc); -+extern struct stmt *flow_offload_stmt_alloc(const struct location *loc, -+ const char *table_name); - - extern const struct datatype ct_dir_type; - extern const struct datatype ct_state_type; ---- a/include/statement.h -+++ b/include/statement.h -@@ -10,6 +10,12 @@ extern struct stmt *expr_stmt_alloc(cons - extern struct stmt *verdict_stmt_alloc(const struct location *loc, - struct expr *expr); - -+struct flow_stmt { -+ const char *table_name; -+}; -+ -+struct stmt *flow_stmt_alloc(const struct location *loc, const char *name); -+ - struct objref_stmt { - uint32_t type; - struct expr *expr; -@@ -231,6 +237,7 @@ extern struct stmt *xt_stmt_alloc(const - * @STMT_NOTRACK: notrack statement - * @STMT_OBJREF: stateful object reference statement - * @STMT_EXTHDR: extension header statement -+ * @STMT_FLOW_OFFLOAD: flow offload statement - */ - enum stmt_types { - STMT_INVALID, -@@ -256,6 +263,7 @@ enum stmt_types { - STMT_NOTRACK, - STMT_OBJREF, - STMT_EXTHDR, -+ STMT_FLOW_OFFLOAD, - }; - - /** -@@ -316,6 +324,7 @@ struct stmt { - struct fwd_stmt fwd; - struct xt_stmt xt; - struct objref_stmt objref; -+ struct flow_stmt flow; - }; - }; - ---- a/src/ct.c -+++ b/src/ct.c -@@ -456,3 +456,26 @@ struct stmt *notrack_stmt_alloc(const st - { - return stmt_alloc(loc, ¬rack_stmt_ops); - } -+ -+static void flow_offload_stmt_print(const struct stmt *stmt, -+ struct output_ctx *octx) -+{ -+ printf("flow offload @%s", stmt->flow.table_name); -+} -+ -+static const struct stmt_ops flow_offload_stmt_ops = { -+ .type = STMT_FLOW_OFFLOAD, -+ .name = "flow_offload", -+ .print = flow_offload_stmt_print, -+}; -+ -+struct stmt *flow_offload_stmt_alloc(const struct location *loc, -+ const char *table_name) -+{ -+ struct stmt *stmt; -+ -+ stmt = stmt_alloc(loc, &flow_offload_stmt_ops); -+ stmt->flow.table_name = table_name; -+ -+ return stmt; -+} ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -2773,6 +2773,7 @@ int stmt_evaluate(struct eval_ctx *ctx, - case STMT_LIMIT: - case STMT_QUOTA: - case STMT_NOTRACK: -+ case STMT_FLOW_OFFLOAD: - return 0; - case STMT_EXPRESSION: - return stmt_evaluate_expr(ctx, stmt); ---- a/src/netlink_delinearize.c -+++ b/src/netlink_delinearize.c -@@ -680,6 +680,16 @@ static void netlink_parse_notrack(struct - ctx->stmt = notrack_stmt_alloc(loc); - } - -+static void netlink_parse_flow_offload(struct netlink_parse_ctx *ctx, -+ const struct location *loc, -+ const struct nftnl_expr *nle) -+{ -+ const char *table_name; -+ -+ table_name = xstrdup(nftnl_expr_get_str(nle, NFTNL_EXPR_FLOW_TABLE_NAME)); -+ ctx->stmt = flow_offload_stmt_alloc(loc, table_name); -+} -+ - static void netlink_parse_ct_stmt(struct netlink_parse_ctx *ctx, - const struct location *loc, - const struct nftnl_expr *nle) -@@ -1255,6 +1265,7 @@ static const struct { - { .name = "hash", .parse = netlink_parse_hash }, - { .name = "fib", .parse = netlink_parse_fib }, - { .name = "tcpopt", .parse = netlink_parse_exthdr }, -+ { .name = "flow_offload", .parse = netlink_parse_flow_offload }, - }; - - static int netlink_parse_expr(const struct nftnl_expr *nle, ---- a/src/netlink_linearize.c -+++ b/src/netlink_linearize.c -@@ -1201,6 +1201,17 @@ static void netlink_gen_notrack_stmt(str - nftnl_rule_add_expr(ctx->nlr, nle); - } - -+static void netlink_gen_flow_offload_stmt(struct netlink_linearize_ctx *ctx, -+ const struct stmt *stmt) -+{ -+ struct nftnl_expr *nle; -+ -+ nle = alloc_nft_expr("flow_offload"); -+ nftnl_expr_set_str(nle, NFTNL_EXPR_FLOW_TABLE_NAME, -+ stmt->flow.table_name); -+ nftnl_rule_add_expr(ctx->nlr, nle); -+} -+ - static void netlink_gen_set_stmt(struct netlink_linearize_ctx *ctx, - const struct stmt *stmt) - { -@@ -1300,6 +1311,8 @@ static void netlink_gen_stmt(struct netl - break; - case STMT_NOTRACK: - return netlink_gen_notrack_stmt(ctx, stmt); -+ case STMT_FLOW_OFFLOAD: -+ return netlink_gen_flow_offload_stmt(ctx, stmt); - case STMT_OBJREF: - return netlink_gen_objref_stmt(ctx, stmt); - default: ---- a/src/parser_bison.y -+++ b/src/parser_bison.y -@@ -248,6 +248,7 @@ int nft_lex(void *, void *, void *); - %token SIZE "size" - - %token FLOW "flow" -+%token OFFLOAD "offload" - %token METER "meter" - %token METERS "meters" - -@@ -3384,6 +3385,10 @@ meta_stmt : META meta_key SET stmt_expr - { - $$ = notrack_stmt_alloc(&@$); - } -+ | FLOW OFFLOAD AT string -+ { -+ $$ = flow_offload_stmt_alloc(&@$, $4); -+ } - ; - - offset_opt : /* empty */ { $$ = 0; } ---- a/src/scanner.l -+++ b/src/scanner.l -@@ -296,6 +296,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr - "memory" { return MEMORY; } - - "flow" { return FLOW; } -+"offload" { return OFFLOAD; } - "meter" { return METER; } - "meters" { return METERS; } - diff --git a/package/network/utils/nftables/patches/204-tests-shell-add-flowtable-tests.patch b/package/network/utils/nftables/patches/204-tests-shell-add-flowtable-tests.patch deleted file mode 100644 index e6dbf8fbe..000000000 --- a/package/network/utils/nftables/patches/204-tests-shell-add-flowtable-tests.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Pablo Neira Ayuso -Date: Mon, 22 Jan 2018 19:54:36 +0100 -Subject: [PATCH] tests: shell: add flowtable tests - -Add basic flowtable tests. - -Signed-off-by: Pablo Neira Ayuso ---- - create mode 100755 tests/shell/testcases/flowtable/0001flowtable_0 - create mode 100755 tests/shell/testcases/flowtable/0002create_flowtable_0 - create mode 100755 tests/shell/testcases/flowtable/0003add_after_flush_0 - create mode 100755 tests/shell/testcases/flowtable/0004delete_after_add0 - create mode 100755 tests/shell/testcases/flowtable/0005delete_in_use_1 - ---- a/tests/shell/run-tests.sh -+++ b/tests/shell/run-tests.sh -@@ -68,7 +68,9 @@ kernel_cleanup() { - nft_set_hash nft_set_rbtree nft_set_bitmap \ - nft_chain_nat_ipv4 nft_chain_nat_ipv6 \ - nf_tables_inet nf_tables_bridge nf_tables_arp \ -- nf_tables_ipv4 nf_tables_ipv6 nf_tables -+ nf_tables_ipv4 nf_tables_ipv6 nf_tables \ -+ nf_flow_table nf_flow_table_ipv4 nf_flow_tables_ipv6 \ -+ nf_flow_table_inet nft_flow_offload - } - - find_tests() { ---- /dev/null -+++ b/tests/shell/testcases/flowtable/0001flowtable_0 -@@ -0,0 +1,33 @@ -+#!/bin/bash -+ -+tmpfile=$(mktemp) -+if [ ! -w $tmpfile ] ; then -+ echo "Failed to create tmp file" >&2 -+ exit 0 -+fi -+ -+trap "rm -rf $tmpfile" EXIT # cleanup if aborted -+ -+ -+EXPECTED='table inet t { -+ flowtable f { -+ hook ingress priority 10 -+ devices = { eth0, wlan0 } -+ } -+ -+ chain c { -+ flow offload @f -+ } -+}' -+ -+echo "$EXPECTED" > $tmpfile -+set -e -+$NFT -f $tmpfile -+ -+GET="$($NFT list ruleset)" -+ -+if [ "$EXPECTED" != "$GET" ] ; then -+ DIFF="$(which diff)" -+ [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") -+ exit 1 -+fi ---- /dev/null -+++ b/tests/shell/testcases/flowtable/0002create_flowtable_0 -@@ -0,0 +1,12 @@ -+#!/bin/bash -+ -+set -e -+$NFT add table t -+$NFT add flowtable t f { hook ingress priority 10 \; devices = { eth0, wlan0 }\; } -+if $NFT create flowtable t f { hook ingress priority 10 \; devices = { eth0, wlan0 }\; } 2>/dev/null ; then -+ echo "E: flowtable creation not failing on existing set" >&2 -+ exit 1 -+fi -+$NFT add flowtable t f { hook ingress priority 10 \; devices = { eth0, wlan0 }\; } -+ -+exit 0 ---- /dev/null -+++ b/tests/shell/testcases/flowtable/0003add_after_flush_0 -@@ -0,0 +1,8 @@ -+#!/bin/bash -+ -+set -e -+$NFT add table x -+$NFT add flowtable x y { hook ingress priority 0\; devices = { eth0, wlan0 }\;} -+$NFT flush ruleset -+$NFT add table x -+$NFT add flowtable x y { hook ingress priority 0\; devices = { eth0, wlan0 }\;} ---- /dev/null -+++ b/tests/shell/testcases/flowtable/0004delete_after_add0 -@@ -0,0 +1,6 @@ -+#!/bin/bash -+ -+set -e -+$NFT add table x -+$NFT add flowtable x y { hook ingress priority 0\; devices = { eth0, wlan0 }\;} -+$NFT delete flowtable x y ---- /dev/null -+++ b/tests/shell/testcases/flowtable/0005delete_in_use_1 -@@ -0,0 +1,9 @@ -+#!/bin/bash -+ -+set -e -+$NFT add table x -+$NFT add chain x x -+$NFT add flowtable x y { hook ingress priority 0\; devices = { eth0, wlan0 }\;} -+$NFT add rule x x flow offload @y -+$NFT delete flowtable x y -+echo "E: delete flowtable in use" diff --git a/package/network/utils/nftables/patches/205-doc-nft-document-flowtable.patch b/package/network/utils/nftables/patches/205-doc-nft-document-flowtable.patch deleted file mode 100644 index dd6faa574..000000000 --- a/package/network/utils/nftables/patches/205-doc-nft-document-flowtable.patch +++ /dev/null @@ -1,128 +0,0 @@ -From: Pablo Neira Ayuso -Date: Tue, 23 Jan 2018 12:58:30 +0100 -Subject: [PATCH] doc: nft: document flowtable - -Document the new flowtable objects available since Linux kernel 4.16-rc. - -Signed-off-by: Pablo Neira Ayuso ---- - ---- a/doc/nft.xml -+++ b/doc/nft.xml -@@ -1166,6 +1166,91 @@ filter input iif $int_ifs accept - - - -+ Flowtables -+ -+ -+ -+ add -+ create -+ -+ flowtable -+ family -+ table -+ flowtable -+ -+ hook hook -+ priority priority ; -+ devices = { device[,...] } ; -+ -+ -+ -+ -+ delete -+ list -+ -+ flowtable -+ family -+ table -+ flowtable -+ -+ -+ -+ -+ Flowtables allow you to accelerate packet forwarding in software. -+ Flowtables entries are represented through a tuple that is composed of the -+ input interface, source and destination address, source and destination -+ port; and layer 3/4 protocols. Each entry also caches the destination -+ interface and the gateway address - to update the destination link-layer -+ address - to forward packets. The ttl and hoplimit fields are also -+ decremented. Hence, flowtables provides an alternative path that allow -+ packets to bypass the classic forwarding path. Flowtables reside in the -+ ingress hook, that is located before the prerouting hook. You can select -+ what flows you want to offload through the flow offload -+ expression from the forward chain. Flowtables are -+ identified by their address family and their name. The address family -+ must be one of -+ -+ -+ ip -+ ip6 -+ inet -+ . -+ -+ The inet address family is a dummy family which is used to create -+ hybrid IPv4/IPv6 tables. -+ -+ When no address family is specified, ip is used by default. -+ -+ -+ -+ -+ -+ -+ -+ Add a new flowtable for the given family with the given name. -+ -+ -+ -+ -+ -+ -+ -+ Delete the specified flowtable. -+ -+ -+ -+ -+ -+ -+ -+ List all flowtables. -+ -+ -+ -+ -+ -+ -+ - Stateful objects - - -@@ -4923,6 +5008,24 @@ add rule nat prerouting tcp dport 22 red - - - -+ -+ -+ Flow offload statement -+ -+ A flow offload statement allows us to select what flows -+ you want to accelerate forwarding through layer 3 network -+ stack bypass. You have to specify the flowtable name where -+ you want to offload this flow. -+ -+ -+ -+ flow offload -+ @flowtable -+ -+ -+ -+ -+ - - Queue statement - diff --git a/package/network/utils/tcpdump/Makefile b/package/network/utils/tcpdump/Makefile index 50919819b..712617fd2 100644 --- a/package/network/utils/tcpdump/Makefile +++ b/package/network/utils/tcpdump/Makefile @@ -47,6 +47,7 @@ define Package/tcpdump-mini endef CONFIGURE_ARGS += \ + --without-cap-ng \ --without-crypto ifeq ($(CONFIG_IPV6),y) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 38d83ace5..05055b148 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -44,6 +44,8 @@ proto_qmi_setup() { return 1 } + [ -n "$delay" ] && sleep "$delay" + device="$(readlink -f $device)" [ -c "$device" ] || { echo "The specified control device does not exist" @@ -62,8 +64,6 @@ proto_qmi_setup() { return 1 } - [ -n "$delay" ] && sleep "$delay" - while uqmi -s -d "$device" --get-pin-status | grep '"UIM uninitialized"' > /dev/null; do [ -e "$device" ] || return 1 sleep 1; diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index 5ee7a3528..e1c6d41ba 100644 --- a/package/system/ca-certificates/Makefile +++ b/package/system/ca-certificates/Makefile @@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ca-certificates PKG_VERSION:=20180409 +PKG_RELEASE:=3 PKG_MAINTAINER:= PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz @@ -57,6 +58,7 @@ endef define Package/ca-bundle/install $(INSTALL_DIR) $(1)/etc/ssl/certs cat $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.crt >$(1)/etc/ssl/certs/ca-certificates.crt + $(LN) /etc/ssl/certs/ca-certificates.crt $(1)/etc/ssl/cert.pem endef $(eval $(call BuildPackage,ca-certificates)) $(eval $(call BuildPackage,ca-bundle)) diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 494f90d2e..440f18739 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_SOURCE_DATE:=2018-04-16 -PKG_SOURCE_VERSION:=e24368361db166cf369a19cea773bd54f9d854b1 -PKG_MIRROR_HASH:=8b483e752578683224245a6d77b3d7172b7cf7a8c3b959e21c47ff18aefc2464 +PKG_SOURCE_DATE:=2018-05-23 +PKG_SOURCE_VERSION:=dd02dad332958575cc52e60c78ef10ef2b5aaced +PKG_MIRROR_HASH:=31051da29a0fff0b60ab3fc7fe27be281ed298346ff0ac65e3a2976671d2deed CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -33,6 +33,8 @@ include $(INCLUDE_DIR)/cmake.mk TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt) CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_UBIFS_EXTROOT),-DCMAKE_UBIFS_EXTROOT=y) +CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_FULL_ACCESS_TIME),-DCMAKE_OVL_MOUNT_FULL_ACCESS_TIME=y) +CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB),-DCMAKE_OVL_MOUNT_COMPRESS_ZLIB=y) define Package/fstools SECTION:=base @@ -50,6 +52,20 @@ define Package/fstools/config default y help This option makes it possible to use extroot functionality if the root filesystem resides on an UBIFS partition + + config FSTOOLS_OVL_MOUNT_FULL_ACCESS_TIME + depends on PACKAGE_fstools + bool "Full access time accounting" + default n + help + This option enables the full access time accounting (warning: it will increase the flash writes). + + config FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB + depends on PACKAGE_fstools + bool "Compress using zlib" + default n + help + This option enables the compression using zlib on the storage device. endef define Package/snapshot-tool diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 5971e0293..33cd6b446 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2018-03-28 -PKG_SOURCE_VERSION:=dfb68f8556df63878add145ad9c656381bc20656 -PKG_MIRROR_HASH:=8d2c70fb0264a6548e39acc5ab1c44cec50fc550c4f931760b0796f8893c9b7f +PKG_SOURCE_DATE:=2018-08-06 +PKG_SOURCE_VERSION:=e29966f04cdf549a01f721f93634672055da8af4 +PKG_MIRROR_HASH:=f02b74df25025b0299181f9ed03aa04092c00a047f5976d91305a0e98c132829 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -37,6 +37,9 @@ endif CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)" TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt) +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -flto + define Package/procd SECTION:=base CATEGORY:=Base system diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 7e370c722..6f16b746f 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -42,6 +42,14 @@ procd_lock() { local basescript=$(readlink "$initscript") local service_name="$(basename ${basescript:-$initscript})" + flock -n 1000 &> /dev/null + if [ "$?" != "0" ]; then + exec 1000>"$IPKG_INSTROOT/var/lock/procd_${service_name}.lock" + flock 1000 + if [ "$?" != "0" ]; then + logger "warning: procd flock for $service_name failed" + fi + fi } _procd_call() { diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 09ddd8de9..fb2d03d88 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -47,7 +47,8 @@ define Package/libubus-lua TITLE:=Lua binding for the OpenWrt RPC client endef -TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto +TARGET_LDFLAGS += -flto CMAKE_OPTIONS = \ -DLUAPATH=/usr/lib/lua diff --git a/package/system/ucert/Makefile b/package/system/ucert/Makefile new file mode 100644 index 000000000..0aff38319 --- /dev/null +++ b/package/system/ucert/Makefile @@ -0,0 +1,72 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=ucert +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=$(PROJECT_GIT)/project/ucert.git +PKG_SOURCE_DATE:=2018-08-08 +PKG_SOURCE_VERSION:=1056e730f56adbc6bc77872e2bbd2bbe01512ec9 +PKG_MIRROR_HASH:=59fc4ab5b5cb10c6e9e0899e3ed5de2f57926e980d31c13ddd1662f36cf40cef + +CMAKE_INSTALL:=1 +PKG_CHECK_FORMAT_SECURITY:=1 + +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Daniel Golle + +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_HOST_OPTIONS += \ + -DUCERT_FULL=1 \ + -DUCERT_HOST_BUILD=1 \ + -DCMAKE_SKIP_RPATH=FALSE \ + -DUSE_RPATH="${STAGING_DIR_HOST}/lib" + +HOST_BUILD_DEPENDS:=libubox/host libjson-c/host usign/host +HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST) +PKG_BUILD_DEPENDS:=ucert/host + +define Package/ucert-full + SECTION:=base + CATEGORY:=Base system + DEPENDS:=+usign +libubox +libjson-c +libblobmsg-json + TITLE:=OpenWrt certificate generation and verification utility + PROVIDES:=ucert + VARIANT:=full +endef + +define Package/ucert + SECTION:=base + CATEGORY:=Base system + DEPENDS:=+usign +libubox + TITLE:=OpenWrt certificate verification utility + CONFLICTS:=ucert-full + VARIANT:=tiny +endef + +ifeq ($(BUILD_VARIANT),full) + CMAKE_OPTIONS += -DUCERT_FULL=1 +endif + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(call Build/Prepare/Default) +endef + +define Package/ucert/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ucert $(1)/usr/bin +endef + +Package/ucert-full/install = $(Package/ucert/install) + +$(eval $(call BuildPackage,ucert)) +$(eval $(call BuildPackage,ucert-full)) +$(eval $(call HostBuild)) diff --git a/package/utils/adb/Makefile b/package/utils/adb/Makefile index c42c94d3a..55f9c1a59 100644 --- a/package/utils/adb/Makefile +++ b/package/utils/adb/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adb PKG_VERSION:=android.5.0.2_r1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://android.googlesource.com/platform/system/core diff --git a/package/utils/adb/patches/010-openssl-1.1.patch b/package/utils/adb/patches/010-openssl-1.1.patch new file mode 100644 index 000000000..e4df372a3 --- /dev/null +++ b/package/utils/adb/patches/010-openssl-1.1.patch @@ -0,0 +1,28 @@ +--- a/adb/adb_auth_host.c ++++ b/adb/adb_auth_host.c +@@ -83,7 +83,13 @@ static int RSA_to_RSAPublicKey(RSA *rsa, + } + + BN_set_bit(r32, 32); ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L ++ const BIGNUM *rsa_n, *rsa_e; ++ RSA_get0_key(rsa, &rsa_n, &rsa_e, NULL); ++ BN_copy(n, rsa_n); ++#else + BN_copy(n, rsa->n); ++#endif + BN_set_bit(r, RSANUMWORDS * 32); + BN_mod_sqr(rr, r, n, ctx); + BN_div(NULL, rem, n, r32, ctx); +@@ -97,7 +103,11 @@ static int RSA_to_RSAPublicKey(RSA *rsa, + BN_div(n, rem, n, r32, ctx); + pkey->n[i] = BN_get_word(rem); + } ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L ++ pkey->exponent = BN_get_word(rsa_e); ++#else + pkey->exponent = BN_get_word(rsa->e); ++#endif + + out: + BN_free(n0inv); diff --git a/package/utils/admswconfig/Makefile b/package/utils/admswconfig/Makefile index 0524949dd..b2a163248 100644 --- a/package/utils/admswconfig/Makefile +++ b/package/utils/admswconfig/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=0.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://downloads.openwrt.org/sources +PKG_SOURCE_URL:=https://downloads.openwrt.org/sources PKG_HASH:=37b4409ea2105520b4a7327e53c3210251000ddf58f81a8e4c19e6ff9d615afe PKG_FLAGS:=nonshared @@ -24,7 +24,6 @@ define Package/admswconfig CATEGORY:=Utilities TITLE:=ADM5120 Switch configuration tool DEPENDS:=@TARGET_adm5120 - URL:=http://sharon.esrac.ele.tue.nl/users/pe1rxq/linux-adm/admswconfig/ MAINTAINER:=Florian Fainelli endef diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index daba431d2..d6c182145 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -121,6 +121,9 @@ config BUSYBOX_DEFAULT_EXTRA_LDLIBS config BUSYBOX_DEFAULT_USE_PORTABLE_CODE bool default n +config BUSYBOX_DEFAULT_STACK_OPTIMIZATION_386 + bool + default n config BUSYBOX_DEFAULT_INSTALL_APPLET_SYMLINKS bool default y @@ -199,6 +202,9 @@ config BUSYBOX_DEFAULT_FEATURE_FAST_TOP config BUSYBOX_DEFAULT_FEATURE_ETC_NETWORKS bool default n +config BUSYBOX_DEFAULT_FEATURE_ETC_SERVICES + bool + default n config BUSYBOX_DEFAULT_FEATURE_EDITING bool default y @@ -229,6 +235,9 @@ config BUSYBOX_DEFAULT_FEATURE_USERNAME_COMPLETION config BUSYBOX_DEFAULT_FEATURE_EDITING_FANCY_PROMPT bool default y +config BUSYBOX_DEFAULT_FEATURE_EDITING_WINCH + bool + default n config BUSYBOX_DEFAULT_FEATURE_EDITING_ASK_TERMINAL bool default n @@ -352,6 +361,9 @@ config BUSYBOX_DEFAULT_XZ config BUSYBOX_DEFAULT_BZIP2 bool default n +config BUSYBOX_DEFAULT_BZIP2_SMALL + int + default 0 config BUSYBOX_DEFAULT_FEATURE_BZIP2_DECOMPRESS bool default y @@ -739,6 +751,9 @@ config BUSYBOX_DEFAULT_SORT config BUSYBOX_DEFAULT_FEATURE_SORT_BIG bool default n +config BUSYBOX_DEFAULT_FEATURE_SORT_OPTIMIZE_MEMORY + bool + default n config BUSYBOX_DEFAULT_SPLIT bool default n @@ -1192,6 +1207,9 @@ config BUSYBOX_DEFAULT_POWEROFF config BUSYBOX_DEFAULT_REBOOT bool default y +config BUSYBOX_DEFAULT_FEATURE_WAIT_FOR_INIT + bool + default n config BUSYBOX_DEFAULT_FEATURE_CALL_TELINIT bool default n @@ -1789,6 +1807,9 @@ config BUSYBOX_DEFAULT_FEATURE_VOLUMEID_ISO9660 config BUSYBOX_DEFAULT_FEATURE_VOLUMEID_JFS bool default n +config BUSYBOX_DEFAULT_FEATURE_VOLUMEID_LFS + bool + default n config BUSYBOX_DEFAULT_FEATURE_VOLUMEID_LINUXRAID bool default n @@ -2005,6 +2026,12 @@ config BUSYBOX_DEFAULT_FEATURE_LESS_DASHCMD config BUSYBOX_DEFAULT_FEATURE_LESS_LINENUMS bool default n +config BUSYBOX_DEFAULT_FEATURE_LESS_RAW + bool + default n +config BUSYBOX_DEFAULT_FEATURE_LESS_ENV + bool + default n config BUSYBOX_DEFAULT_LOCK bool default y @@ -2356,6 +2383,12 @@ config BUSYBOX_DEFAULT_FEATURE_NETSTAT_PRG config BUSYBOX_DEFAULT_NSLOOKUP bool default n +config BUSYBOX_DEFAULT_FEATURE_NSLOOKUP_BIG + bool + default n +config BUSYBOX_DEFAULT_FEATURE_NSLOOKUP_LONG_OPTIONS + bool + default n config BUSYBOX_DEFAULT_NSLOOKUP_OPENWRT bool default y @@ -2392,6 +2425,12 @@ config BUSYBOX_DEFAULT_SLATTACH config BUSYBOX_DEFAULT_SSL_CLIENT bool default n +config BUSYBOX_DEFAULT_TC + bool + default n +config BUSYBOX_DEFAULT_FEATURE_TC_INGRESS + bool + default n config BUSYBOX_DEFAULT_TCPSVD bool default n @@ -2533,6 +2572,9 @@ config BUSYBOX_DEFAULT_FEATURE_UDHCPC6_RFC4704 config BUSYBOX_DEFAULT_FEATURE_UDHCPC6_RFC4833 bool default n +config BUSYBOX_DEFAULT_FEATURE_UDHCPC6_RFC5970 + bool + default n config BUSYBOX_DEFAULT_FEATURE_UDHCP_PORT bool default n @@ -2731,6 +2773,9 @@ config BUSYBOX_DEFAULT_SV_DEFAULT_SERVICE_DIR config BUSYBOX_DEFAULT_SVC bool default n +config BUSYBOX_DEFAULT_SVOK + bool + default n config BUSYBOX_DEFAULT_SVLOGD bool default n @@ -2803,6 +2848,12 @@ config BUSYBOX_DEFAULT_ASH_INTERNAL_GLOB config BUSYBOX_DEFAULT_ASH_BASH_COMPAT bool default y +config BUSYBOX_DEFAULT_ASH_BASH_SOURCE_CURDIR + bool + default n +config BUSYBOX_DEFAULT_ASH_BASH_NOT_FOUND_HOOK + bool + default n config BUSYBOX_DEFAULT_ASH_JOB_CONTROL bool default y @@ -2851,6 +2902,12 @@ config BUSYBOX_DEFAULT_HUSH_BASH_COMPAT config BUSYBOX_DEFAULT_HUSH_BRACE_EXPANSION bool default n +config BUSYBOX_DEFAULT_HUSH_LINENO_VAR + bool + default n +config BUSYBOX_DEFAULT_HUSH_BASH_SOURCE_CURDIR + bool + default n config BUSYBOX_DEFAULT_HUSH_INTERACTIVE bool default n @@ -2911,6 +2968,9 @@ config BUSYBOX_DEFAULT_HUSH_KILL config BUSYBOX_DEFAULT_HUSH_WAIT bool default n +config BUSYBOX_DEFAULT_HUSH_COMMAND + bool + default n config BUSYBOX_DEFAULT_HUSH_TRAP bool default n diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 28375b87c..1578b63c2 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -8,19 +8,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.28.3 -PKG_RELEASE:=4 +PKG_VERSION:=1.29.2 +PKG_RELEASE:=1 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=ad0d22033f23e696f9a71a4c2f9210194dda39b024a79151f4ac278995332a6e +PKG_HASH:=67d2fa6e147a45875fe972de62d907ef866fe784c495c363bf34756c444a5d61 PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 PKG_CHECK_FORMAT_SECURITY:=0 -PKG_INSTALL:=1 #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc. PKG_ASLR_PIE:=0 @@ -75,7 +74,10 @@ endef export KCONFIG_NOTIMESTAMP=1 +ifndef CONFIG_USE_MUSL LDLIBS:=m crypt +endif + LDLIBS += $(call BUSYBOX_IF_ENABLED,PAM,pam pam_misc pthread) ifdef CONFIG_BUSYBOX_USE_LIBRPC LDLIBS += rpc @@ -84,24 +86,32 @@ ifeq ($(CONFIG_USE_GLIBC),y) LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP_OPENWRT,resolv) endif +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin + MAKE_VARS := MAKE_FLAGS += \ EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \ LDLIBS="$(LDLIBS)" \ + LD="$(TARGET_CC)" \ SKIP_STRIP=y ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) MAKE_FLAGS += V=1 endif -MAKE_INSTALL_FLAGS += CONFIG_PREFIX="$(PKG_INSTALL_DIR)" - - define Build/Configure grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig endef +define Build/Compile + $(call Build/Compile/Default, \ + CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \ + all install \ + ) +endef + define Package/busybox/install $(INSTALL_DIR) $(1)/etc/init.d $(CP) $(PKG_INSTALL_DIR)/* $(1)/ diff --git a/package/utils/busybox/config/Config.in b/package/utils/busybox/config/Config.in index 68f140a9c..7c9226978 100644 --- a/package/utils/busybox/config/Config.in +++ b/package/utils/busybox/config/Config.in @@ -1,6 +1,6 @@ # # For a description of the syntax of this configuration file, -# see scripts/kbuild/config-language.txt. +# see docs/Kconfig-language.txt. # @@ -517,6 +517,14 @@ config BUSYBOX_CONFIG_USE_PORTABLE_CODE compiler other than gcc. If you do use gcc, this option may needlessly increase code size. +config BUSYBOX_CONFIG_STACK_OPTIMIZATION_386 + bool "Use -mpreferred-stack-boundary=2 on i386 arch" + default BUSYBOX_DEFAULT_STACK_OPTIMIZATION_386 + help + This option makes for smaller code, but some libc versions + do not work with it (they use SSE instructions without + ensuring stack alignment). + comment 'Installation Options ("make install" behavior)' choice diff --git a/package/utils/busybox/config/archival/Config.in b/package/utils/busybox/config/archival/Config.in index ccfb828a8..3ea8353de 100644 --- a/package/utils/busybox/config/archival/Config.in +++ b/package/utils/busybox/config/archival/Config.in @@ -170,6 +170,15 @@ config BUSYBOX_CONFIG_BZIP2 Unless you have a specific application which requires bzip2, you should probably say N here. +config BUSYBOX_CONFIG_BZIP2_SMALL + int "Trade size for speed (0:fast 9:slow)" + default BUSYBOX_DEFAULT_BZIP2_SMALL + range 0 9 + depends on BUSYBOX_CONFIG_BZIP2 + help + 0 is faster but larger + 9 is smaller but slower + config BUSYBOX_CONFIG_FEATURE_BZIP2_DECOMPRESS bool "Enable decompression" default BUSYBOX_DEFAULT_FEATURE_BZIP2_DECOMPRESS diff --git a/package/utils/busybox/patches/001-resource_h_include.patch b/package/utils/busybox/patches/001-resource_h_include.patch deleted file mode 100644 index 33e12c8bd..000000000 --- a/package/utils/busybox/patches/001-resource_h_include.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/include/libbb.h -+++ b/include/libbb.h -@@ -41,6 +41,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/package/utils/busybox/patches/111-i386_no_arch_flags.patch b/package/utils/busybox/patches/111-i386_no_arch_flags.patch deleted file mode 100644 index 456013687..000000000 --- a/package/utils/busybox/patches/111-i386_no_arch_flags.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/i386/Makefile -+++ /dev/null -@@ -1,7 +0,0 @@ --# ========================================================================== --# Build system --# ========================================================================== -- --# -mpreferred-stack-boundary=2 is essential in preventing gcc 4.2.x --# from aligning stack to 16 bytes. (Which is gcc's way of supporting SSE). --CFLAGS += $(call cc-option,-march=i386 -mpreferred-stack-boundary=2,) diff --git a/package/utils/busybox/patches/120-lto-jobserver.patch b/package/utils/busybox/patches/120-lto-jobserver.patch new file mode 100644 index 000000000..99c5b5120 --- /dev/null +++ b/package/utils/busybox/patches/120-lto-jobserver.patch @@ -0,0 +1,27 @@ +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -130,7 +130,7 @@ make-cmd = $(subst \#,\\\#,$(subst $$,$$ + # + if_changed = $(if $(strip $(filter-out $(PHONY),$?) \ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ +- @set -e; \ ++ +@set -e; \ + $(echo-cmd) $(cmd_$(1)); \ + echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd) + +@@ -139,7 +139,7 @@ if_changed = $(if $(strip $(filter-out $ + if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \ + $(filter-out FORCE $(wildcard $^),$^) \ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ +- @set -e; \ ++ +@set -e; \ + $(echo-cmd) $(cmd_$(1)); \ + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \ + rm -f $(depfile); \ +@@ -150,5 +150,5 @@ if_changed_dep = $(if $(strip $(filter-o + # and if so will execute $(rule_foo) + if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ +- @set -e; \ ++ +@set -e; \ + $(rule_$(1))) diff --git a/package/utils/busybox/patches/130-mconf_missing_sigwinch.patch b/package/utils/busybox/patches/130-mconf_missing_sigwinch.patch index 54f878a6c..b8ca2122b 100644 --- a/package/utils/busybox/patches/130-mconf_missing_sigwinch.patch +++ b/package/utils/busybox/patches/130-mconf_missing_sigwinch.patch @@ -1,8 +1,8 @@ --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c -@@ -27,6 +27,10 @@ - #include - #include +@@ -31,6 +31,10 @@ + #define SIGWINCH 28 + #endif +#ifndef SIGWINCH +#define SIGWINCH 28 diff --git a/package/utils/busybox/patches/200-udhcpc_reduce_msgs.patch b/package/utils/busybox/patches/200-udhcpc_reduce_msgs.patch index a47c4fcc1..4e498b807 100644 --- a/package/utils/busybox/patches/200-udhcpc_reduce_msgs.patch +++ b/package/utils/busybox/patches/200-udhcpc_reduce_msgs.patch @@ -1,6 +1,6 @@ --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c -@@ -711,6 +711,7 @@ static int bcast_or_ucast(struct dhcp_pa +@@ -705,6 +705,7 @@ static int bcast_or_ucast(struct dhcp_pa static NOINLINE int send_discover(uint32_t xid, uint32_t requested) { struct dhcp_packet packet; @@ -8,7 +8,7 @@ /* Fill in: op, htype, hlen, cookie, chaddr fields, * random xid field (we override it below), -@@ -728,6 +729,7 @@ static NOINLINE int send_discover(uint32 +@@ -722,6 +723,7 @@ static NOINLINE int send_discover(uint32 */ add_client_options(&packet); diff --git a/package/utils/busybox/patches/201-udhcpc_changed_ifindex.patch b/package/utils/busybox/patches/201-udhcpc_changed_ifindex.patch index 51b15a73c..ad6fb9b02 100644 --- a/package/utils/busybox/patches/201-udhcpc_changed_ifindex.patch +++ b/package/utils/busybox/patches/201-udhcpc_changed_ifindex.patch @@ -1,6 +1,6 @@ --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c -@@ -1417,6 +1417,12 @@ int udhcpc_main(int argc UNUSED_PARAM, c +@@ -1407,6 +1407,12 @@ int udhcpc_main(int argc UNUSED_PARAM, c /* silence "uninitialized!" warning */ unsigned timestamp_before_wait = timestamp_before_wait; diff --git a/package/utils/busybox/patches/203-udhcpc_renew_no_deconfig.patch b/package/utils/busybox/patches/203-udhcpc_renew_no_deconfig.patch index f8e664038..301f65863 100644 --- a/package/utils/busybox/patches/203-udhcpc_renew_no_deconfig.patch +++ b/package/utils/busybox/patches/203-udhcpc_renew_no_deconfig.patch @@ -1,6 +1,6 @@ --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c -@@ -1124,7 +1124,6 @@ static void perform_renew(void) +@@ -1118,7 +1118,6 @@ static void perform_renew(void) state = RENEW_REQUESTED; break; case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ diff --git a/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch b/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch index ca76c44cc..f7cd2322c 100644 --- a/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch +++ b/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch @@ -1,6 +1,6 @@ --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c -@@ -598,7 +598,7 @@ static int do_add_or_delete(char **argv, +@@ -652,7 +652,7 @@ static int do_add_or_delete(char **argv, } xrtnl_open(&rth); ll_init_map(&rth); diff --git a/package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch b/package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch deleted file mode 100644 index 6770391cf..000000000 --- a/package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 148788eb0ee96026105755cf3fd1ad3d94f49cd2 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Thu, 21 Jun 2018 17:36:22 +0200 -Subject: [PATCH] udhcpc: remove code which requires server ID to be on local - network - -This reverts "udhcpc: paranoia when using kernel UDP mode -for sending renew: server ID may be bogus". - -Users complain that they do have servers behind routers -(with DHCP relays). - -function old new delta -send_packet 168 166 -2 -bcast_or_ucast 25 23 -2 -udhcp_send_kernel_packet 301 295 -6 ------------------------------------------------------------------------------- -(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-10) Total: -10 bytes - -Signed-off-by: Denys Vlasenko ---- - networking/udhcp/common.h | 4 +--- - networking/udhcp/d6_dhcpc.c | 4 +--- - networking/udhcp/dhcpc.c | 10 ++-------- - networking/udhcp/dhcpd.c | 4 +--- - networking/udhcp/packet.c | 7 +++---- - 5 files changed, 8 insertions(+), 21 deletions(-) - ---- a/networking/udhcp/common.h -+++ b/networking/udhcp/common.h -@@ -308,9 +308,7 @@ int udhcp_send_raw_packet(struct dhcp_pa - - int udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, - uint32_t source_nip, int source_port, -- uint32_t dest_nip, int dest_port, -- int send_flags --) FAST_FUNC; -+ uint32_t dest_nip, int dest_port) FAST_FUNC; - - void udhcp_sp_setup(void) FAST_FUNC; - void udhcp_sp_fd_set(struct pollfd *pfds, int extra_fd) FAST_FUNC; ---- a/networking/udhcp/d6_dhcpc.c -+++ b/networking/udhcp/d6_dhcpc.c -@@ -702,15 +702,13 @@ static NOINLINE int send_d6_renew(uint32 - opt_ptr = add_d6_client_options(opt_ptr); - - bb_error_msg("sending %s", "renew"); -- if (server_ipv6) { -+ if (server_ipv6) - return d6_send_kernel_packet( - &packet, (opt_ptr - (uint8_t*) &packet), - our_cur_ipv6, CLIENT_PORT6, - server_ipv6, SERVER_PORT6, - client_config.ifindex -- /* TODO? send_flags: MSG_DONTROUTE (see IPv4 code for reason why) */ - ); -- } - return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); - } - ---- a/networking/udhcp/dhcpc.c -+++ b/networking/udhcp/dhcpc.c -@@ -693,16 +693,10 @@ static int raw_bcast_from_client_config_ - - static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t server) - { -- if (server) { -- /* Without MSG_DONTROUTE, the packet was seen routed over -- * _other interface_ if server ID is bogus (example: 1.1.1.1). -- */ -+ if (server) - return udhcp_send_kernel_packet(packet, - ciaddr, CLIENT_PORT, -- server, SERVER_PORT, -- /*send_flags: "to hosts only on directly connected networks" */ MSG_DONTROUTE -- ); -- } -+ server, SERVER_PORT); - return raw_bcast_from_client_config_ifindex(packet, ciaddr); - } - ---- a/networking/udhcp/dhcpd.c -+++ b/networking/udhcp/dhcpd.c -@@ -588,9 +588,7 @@ static void send_packet_to_relay(struct - - udhcp_send_kernel_packet(dhcp_pkt, - server_config.server_nip, SERVER_PORT, -- dhcp_pkt->gateway_nip, SERVER_PORT, -- /*send_flags:*/ 0 -- ); -+ dhcp_pkt->gateway_nip, SERVER_PORT); - } - - static void send_packet(struct dhcp_packet *dhcp_pkt, int force_broadcast) ---- a/networking/udhcp/packet.c -+++ b/networking/udhcp/packet.c -@@ -189,8 +189,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru - /* Let the kernel do all the work for packet generation */ - int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, - uint32_t source_nip, int source_port, -- uint32_t dest_nip, int dest_port, -- int send_flags) -+ uint32_t dest_nip, int dest_port) - { - struct sockaddr_in sa; - unsigned padding; -@@ -227,8 +226,8 @@ int FAST_FUNC udhcp_send_kernel_packet(s - padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); - if (padding > DHCP_SIZE - 300) - padding = DHCP_SIZE - 300; -- result = send(fd, dhcp_pkt, DHCP_SIZE - padding, send_flags); -- msg = "send"; -+ result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); -+ msg = "write"; - ret_close: - close(fd); - if (result < 0) { diff --git a/package/utils/bzip2/Makefile b/package/utils/bzip2/Makefile index 4c8b360de..ea2fc7683 100644 --- a/package/utils/bzip2/Makefile +++ b/package/utils/bzip2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bzip2 PKG_VERSION:=1.0.6 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.bzip.org/$(PKG_VERSION) diff --git a/package/utils/bzip2/patches/010-CVE-2016-3189.patch b/package/utils/bzip2/patches/010-CVE-2016-3189.patch new file mode 100644 index 000000000..064f982c4 --- /dev/null +++ b/package/utils/bzip2/patches/010-CVE-2016-3189.patch @@ -0,0 +1,11 @@ +diff -up ./bzip2recover.c.old ./bzip2recover.c +--- ./bzip2recover.c.old 2016-03-22 08:49:38.855620000 +0100 ++++ ./bzip2recover.c 2016-03-30 10:22:27.341430099 +0200 +@@ -457,6 +457,7 @@ Int32 main ( Int32 argc, Char** argv ) + bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); + bsPutUInt32 ( bsWr, blockCRC ); + bsClose ( bsWr ); ++ outFile = NULL; + } + if (wrBlock >= rbCtr) break; + wrBlock++; diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index 3411bea74..13a408718 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs -PKG_VERSION:=1.44.1 -PKG_HASH:=0ca164c1c87724df904c918b2d7051ef989b51de725db66c67514dbe6dd2b9ef +PKG_VERSION:=1.44.3 +PKG_HASH:=5d899f7d30f481cc0c6a049ebe26ebe145f1b524182ea1ecde4086162d4e4bb6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz @@ -131,7 +131,8 @@ $(call Package/e2fsprogs) DEPENDS:= +e2fsprogs endef -TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections +TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -flto CONFIGURE_ARGS += \ --disable-testio-debug \ @@ -142,7 +143,6 @@ CONFIGURE_ARGS += \ --disable-tls \ --disable-nls \ --disable-rpath \ - --disable-threads \ --disable-fuse2fs define Build/Prepare diff --git a/package/utils/f2fs-tools/Makefile b/package/utils/f2fs-tools/Makefile index 391eb61b8..659b3d244 100644 --- a/package/utils/f2fs-tools/Makefile +++ b/package/utils/f2fs-tools/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=f2fs-tools -PKG_VERSION:=1.10.0 +PKG_VERSION:=1.11.0 PKG_RELEASE:=1 PKG_LICENSE:=GPLv2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/ -PKG_HASH:=e841b086dbe02e3553b2c2ecb8c11a7990cfa9ca835c3d7aea6d600c6a543316 +PKG_HASH:=b916ac7cda902502cf18de98da94921f71edbab40fb0437d757f0716191c79e3 PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/nvram/Makefile b/package/utils/nvram/Makefile index acefe8aec..99897e6f7 100644 --- a/package/utils/nvram/Makefile +++ b/package/utils/nvram/Makefile @@ -21,7 +21,7 @@ define Package/nvram CATEGORY:=Base system TITLE:=Userspace port of the Broadcom NVRAM manipulation tool MAINTAINER:=Jo-Philipp Wich - DEPENDS:=@TARGET_brcm47xx||@TARGET_bcm53xx||@TARGET_ar71xx + DEPENDS:=@TARGET_brcm47xx||@TARGET_bcm53xx||@TARGET_ar71xx||@TARGET_ath79 endef define Package/nvram/description diff --git a/package/utils/px5g/Makefile b/package/utils/px5g/Makefile index da8d56dcc..7b5748425 100644 --- a/package/utils/px5g/Makefile +++ b/package/utils/px5g/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g -PKG_RELEASE:=6 +PKG_RELEASE:=8 PKG_LICENSE:=LGPL-2.1 PKG_BUILD_DIR:=$(BUILD_DIR)/px5g-$(BUILD_VARIANT) diff --git a/package/utils/ugps/Makefile b/package/utils/ugps/Makefile index 3a972f54d..937789fd8 100644 --- a/package/utils/ugps/Makefile +++ b/package/utils/ugps/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=3 PKG_SOURCE_URL=$(PROJECT_GIT)/project/ugps.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2017-02-11 -PKG_SOURCE_VERSION:=c30055a685bca1e81ccc8f4bd3bb08d780a7d762 -PKG_MIRROR_HASH:=a618f9a15d3a585453550190eed2bb0a308ddba0ab37f2f6b76dd3c87fd80e8b +PKG_SOURCE_DATE:=2018-02-12 +PKG_SOURCE_VERSION:=928cb537aa6a1951ff503b4d13f3c78cead7b581 +PKG_MIRROR_HASH:=21f2c9a1656b2115d2d26ef714390422b885d88ecd21eb9d16d6548444654deb PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0+ diff --git a/package/utils/ugps/files/gps.config b/package/utils/ugps/files/gps.config index d4bd69aff..01559f7a9 100644 --- a/package/utils/ugps/files/gps.config +++ b/package/utils/ugps/files/gps.config @@ -1,3 +1,4 @@ config gps option 'tty' 'ttyACM0' option 'adjust_time' '1' + option 'disabled' '1' diff --git a/package/utils/ugps/files/ugps.init b/package/utils/ugps/files/ugps.init index 157043cc2..3cd1ca1b8 100644 --- a/package/utils/ugps/files/ugps.init +++ b/package/utils/ugps/files/ugps.init @@ -13,6 +13,9 @@ service_triggers() { start_service() { local tty="$(uci get gps.@gps[-1].tty)" local atime="$(uci get gps.@gps[-1].adjust_time)" + local disabled="$(uci get gps.@gps[-1].disabled || echo 0)" + + [ "$disabled" == "0" ] || return [ -c "$tty" ] || { tty="/dev/$tty" diff --git a/package/utils/usbutils/Makefile b/package/utils/usbutils/Makefile index 7f798954a..c5f625eb3 100644 --- a/package/utils/usbutils/Makefile +++ b/package/utils/usbutils/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=usbutils PKG_VERSION:=007 -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/usb/usbutils @@ -20,7 +20,7 @@ PKG_LICENSE_FILES:=COPYING PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 -PKG_MAINTAINER := Felix Fietkau +PKG_MAINTAINER:=Felix Fietkau include $(INCLUDE_DIR)/package.mk @@ -32,13 +32,13 @@ define Package/usbutils URL:=http://www.linux-usb.org/ endef -USB_IDS_REV:=0a6be488b4c1485d30c9efee1cc895af5d4a1383 +USB_IDS_REV:=016be785fd4f5f895c6482ec484507d5a08839fa USB_IDS_FILE:=usb.ids.$(USB_IDS_REV) define Download/usb_ids FILE:=$(USB_IDS_FILE) URL_FILE:=usb.ids - URL:=@GITHUB/gentoo/hwids/$(USB_IDS_REV) - HASH:=2d0403ffccc0ff7150e32c0bf8e2878816b76ba08d2c3bb1059f33627a3da30f + URL:=@GITHUB/vcrhonek/hwdata/$(USB_IDS_REV) + HASH:=b1877a9fd30c2f9dedec1657963775e7f261c892eb7d6f4281c453bd73492489 endef $(eval $(call Download,usb_ids)) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 5d31e6d99..4cb9e14a2 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.32 -PKG_RELEASE:=2 +PKG_VERSION:=2.32.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.32 -PKG_HASH:=6c7397abc764e32e8159c2e96042874a190303e77adceb4ac5bd502a272a4734 +PKG_HASH:=86e6707a379c7ff5489c218cfaf1e3464b0b95acf7817db0bc5f179e356a67b2 PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0 @@ -141,6 +141,16 @@ define Package/blkid/description library. endef +define Package/blockdev +$(call Package/util-linux/Default) + TITLE:=call block device ioctls from the command line + SUBMENU=Disc +endef + +define Package/blockdev/description + The blockdev program is the command-line interface to call block device ioctls. +endef + define Package/cal $(call Package/util-linux/Default) TITLE:=display a calendar @@ -565,6 +575,11 @@ define Package/blkid/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blkid $(1)/usr/sbin/ endef +define Package/blockdev/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blockdev $(1)/usr/sbin/ +endef + define Package/cal/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cal $(1)/usr/bin/ @@ -734,6 +749,7 @@ $(eval $(call BuildPackage,libuuid)) $(eval $(call BuildPackage,agetty)) $(eval $(call BuildPackage,blkdiscard)) $(eval $(call BuildPackage,blkid)) +$(eval $(call BuildPackage,blockdev)) $(eval $(call BuildPackage,cal)) $(eval $(call BuildPackage,cfdisk)) $(eval $(call BuildPackage,dmesg)) diff --git a/rules.mk b/rules.mk index a97b2d215..2af635201 100644 --- a/rules.mk +++ b/rules.mk @@ -140,7 +140,11 @@ else endif ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_GCC_VERSION_4_8),$(CONFIG_TARGET_uml)),) - iremap = -iremap$(1):$(2) + ifeq ($(CONFIG_GCC_USE_EMBEDDED_PATH_REMAP),y) + iremap = -fmacro-prefix-map=$(1)=$(2) + else + iremap = -iremap$(1):$(2) + endif endif PACKAGE_DIR:=$(BIN_DIR)/packages @@ -390,8 +394,9 @@ endef # Calculate sha256sum of any plain file within a given directory # $(1) => Input directory +# $(2) => If set, recurse into subdirectories define sha256sums - (cd $(1); find . -maxdepth 1 -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ + (cd $(1); find . $(if $(2),,-maxdepth 1) -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ xargs -r $(STAGING_DIR_HOST)/bin/mkhash -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums) endef diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh index 620ee01bd..d3c7206a4 100755 --- a/scripts/bundle-libraries.sh +++ b/scripts/bundle-libraries.sh @@ -113,6 +113,18 @@ _patch_ldso() { fi } +_patch_glibc() { + _cp "$1" "$1.patched" + sed -i -e 's,/usr/\(\(lib\|share\)/locale\),/###/\1,g' "$1.patched" + + if "$1.patched" 2>&1 | grep -q -- GNU; then + _mv "$1.patched" "$1" + else + echo "binary patched ${1##*/} not executable, using original" >&2 + rm -f "$1.patched" + fi +} + for LDD in ${PATH//://ldd }/ldd; do "$LDD" --version >/dev/null 2>/dev/null && break LDD="" @@ -141,17 +153,20 @@ for BIN in "$@"; do [ -n "$LDD" ] && [ -x "$BIN" ] && file "$BIN" | grep -sqE "ELF.*(executable|interpreter)" && { for token in $("$LDD" "$BIN" 2>/dev/null); do case "$token" in */*.so*) - case "$token" in - *ld-*.so*) LDSO="${token##*/}" ;; - esac - dest="$DIR/lib/${token##*/}" ddir="${dest%/*}" + case "$token" in + */ld-*.so*) LDSO="${token##*/}" ;; + esac + [ -f "$token" -a ! -f "$dest" ] && { _md "$ddir" _cp "$token" "$dest" - [ -n "$LDSO" ] && _patch_ldso "$dest" + case "$token" in + */ld-*.so*) _patch_ldso "$dest" ;; + */libc.so.6) _patch_glibc "$dest" ;; + esac } ;; esac done diff --git a/scripts/config/conf.c b/scripts/config/conf.c index 6d35957af..cf20e0a21 100644 --- a/scripts/config/conf.c +++ b/scripts/config/conf.c @@ -75,9 +75,9 @@ static void strip(char *str) static void check_stdin(void) { if (!valid_stdin) { - printf(_("aborted!\n\n")); - printf(_("Console input/output is redirected. ")); - printf(_("Run 'make oldconfig' to update configuration.\n\n")); + printf("%s",_("aborted!\n\n")); + printf("%s",_("Console input/output is redirected. ")); + printf("%s",_("Run 'make oldconfig' to update configuration.\n\n")); exit(1); } } @@ -87,7 +87,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) enum symbol_type type = sym_get_type(sym); if (!sym_has_value(sym)) - printf(_("(NEW) ")); + printf("%s",_("(NEW) ")); line[0] = '\n'; line[1] = 0; @@ -288,7 +288,7 @@ static int conf_choice(struct menu *menu) if (child->sym->name) printf(" (%s)", child->sym->name); if (!sym_has_value(child->sym)) - printf(_(" (NEW)")); + printf("%s",_(" (NEW)")); printf("\n"); } printf(_("%*schoice"), indent - 1, ""); @@ -436,7 +436,7 @@ static void check_conf(struct menu *menu) } } else if (input_mode != olddefconfig) { if (!conf_cnt++) - printf(_("*\n* Restart config...\n*\n")); + printf("%s",_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); conf(rootEntry); } diff --git a/scripts/dl_github_archive.py b/scripts/dl_github_archive.py new file mode 100755 index 000000000..4bb7d131b --- /dev/null +++ b/scripts/dl_github_archive.py @@ -0,0 +1,427 @@ +#!/usr/bin/env python +# +# Copyright (c) 2018 Yousong Zhou +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +import argparse +import calendar +import datetime +import errno +import fcntl +import hashlib +import json +import os +import os.path +import re +import shutil +import ssl +import subprocess +import sys +import time +import urllib2 + +TMPDIR = os.environ.get('TMP_DIR') or '/tmp' +TMPDIR_DL = os.path.join(TMPDIR, 'dl') + + +class PathException(Exception): pass +class DownloadGitHubError(Exception): pass + + +class Path(object): + """Context class for preparing and cleaning up directories. + + If ```preclean` is ``False``, ``path`` will NOT be removed on context enter + + If ``path`` ``isdir``, then it will be created on context enter. + + If ``keep`` is True, then ``path`` will NOT be removed on context exit + """ + + def __init__(self, path, isdir=True, preclean=False, keep=False): + self.path = path + self.isdir = isdir + self.preclean = preclean + self.keep = keep + + def __enter__(self): + if self.preclean: + self.rm_all(self.path) + if self.isdir: + self.mkdir_all(self.path) + return self + + def __exit__(self, exc_type, exc_value, traceback): + if not self.keep: + self.rm_all(self.path) + + @staticmethod + def mkdir_all(path): + """Same as mkdir -p.""" + names = os.path.split(path) + p = '' + for name in names: + p = os.path.join(p, name) + Path._mkdir(p) + + @staticmethod + def _rmdir_dir(dir_): + names = Path._listdir(dir_) + for name in names: + p = os.path.join(dir_, name) + Path.rm_all(p) + Path._rmdir(dir_) + + @staticmethod + def _mkdir(path): + Path._os_func(os.mkdir, path, errno.EEXIST) + + @staticmethod + def _rmdir(path): + Path._os_func(os.rmdir, path, errno.ENOENT) + + @staticmethod + def _remove(path): + Path._os_func(os.remove, path, errno.ENOENT) + + @staticmethod + def _listdir(path): + return Path._os_func(os.listdir, path, errno.ENOENT, default=[]) + + @staticmethod + def _os_func(func, path, errno, default=None): + """Call func(path) in an idempotent way. + + On exception ``ex``, if the type is OSError and ``ex.errno == errno``, + return ``default``, otherwise, re-raise + """ + try: + return func(path) + except OSError as e: + if e.errno == errno: + return default + else: + raise + + @staticmethod + def rm_all(path): + """Same as rm -r.""" + if os.path.islink(path): + Path._remove(path) + elif os.path.isdir(path): + Path._rmdir_dir(path) + else: + Path._remove(path) + + @staticmethod + def untar(path, into=None): + """Extract tarball at ``path`` into subdir ``into``. + + return subdir name if and only if there exists one, otherwise raise PathException + """ + args = ('tar', '-C', into, '-xzf', path, '--no-same-permissions') + subprocess.check_call(args, preexec_fn=lambda: os.umask(0o22)) + dirs = os.listdir(into) + if len(dirs) == 1: + return dirs[0] + else: + raise PathException('untar %s: expecting a single subdir, got %s' % (path, dirs)) + + @staticmethod + def tar(path, subdir, into=None, ts=None): + """Pack ``path`` into tarball ``into``.""" + # --sort=name requires a recent build of GNU tar + args = ['tar', '--numeric-owner', '--owner=0', '--group=0', '--sort=name'] + args += ['-C', path, '-cf', into, subdir] + envs = os.environ.copy() + if ts is not None: + args.append('--mtime=@%d' % ts) + if into.endswith('.xz'): + envs['XZ_OPT'] = '-7e' + args.append('-J') + elif into.endswith('.bz2'): + args.append('-j') + elif into.endswith('.gz'): + args.append('-z') + envs['GZIP'] = '-n' + else: + raise PathException('unknown compression type %s' % into) + subprocess.check_call(args, env=envs) + + +class GitHubCommitTsCache(object): + __cachef = 'github.commit.ts.cache' + __cachen = 2048 + + def __init__(self): + Path.mkdir_all(TMPDIR_DL) + self.cachef = os.path.join(TMPDIR_DL, self.__cachef) + self.cache = {} + + def get(self, k): + """Get timestamp with key ``k``.""" + fileno = os.open(self.cachef, os.O_RDONLY | os.O_CREAT) + with os.fdopen(fileno) as fin: + try: + fcntl.lockf(fileno, fcntl.LOCK_SH) + self._cache_init(fin) + if k in self.cache: + ts = self.cache[k][0] + return ts + finally: + fcntl.lockf(fileno, fcntl.LOCK_UN) + return None + + def set(self, k, v): + """Update timestamp with ``k``.""" + fileno = os.open(self.cachef, os.O_RDWR | os.O_CREAT) + with os.fdopen(fileno, 'wb+') as f: + try: + fcntl.lockf(fileno, fcntl.LOCK_EX) + self._cache_init(f) + self.cache[k] = (v, int(time.time())) + self._cache_flush(f) + finally: + fcntl.lockf(fileno, fcntl.LOCK_UN) + + def _cache_init(self, fin): + for line in fin: + k, ts, updated = line.split() + ts = int(ts) + updated = int(updated) + self.cache[k] = (ts, updated) + + def _cache_flush(self, fout): + cache = sorted(self.cache.iteritems(), cmp=lambda a, b: b[1][1] - a[1][1]) + cache = cache[:self.__cachen] + self.cache = {} + os.ftruncate(fout.fileno(), 0) + fout.seek(0, os.SEEK_SET) + for k, ent in cache: + ts = ent[0] + updated = ent[1] + line = '{0} {1} {2}\n'.format(k, ts, updated) + fout.write(line) + + +class DownloadGitHubTarball(object): + """Download and repack archive tarabll from GitHub. + + Compared with the method of packing after cloning the whole repo, this + method is more friendly to users with fragile internet connection. + + However, there are limitations with this method + + - GitHub imposes a 60 reqs/hour limit for unauthenticated API access. + This affects fetching commit date for reproducible tarballs. Download + through the archive link is not affected. + + - GitHub archives do not contain source codes for submodules. + + - GitHub archives seem to respect .gitattributes and ignore pathes with + export-ignore attributes. + + For the first two issues, the method will fail loudly to allow fallback to + clone-then-pack method. + + As for the 3rd issue, to make sure that this method only produces identical + tarballs as the fallback method, we require the expected hash value to be + supplied. That means the first tarball will need to be prepared by the + clone-then-pack method + """ + + __repo_url_regex = re.compile(r'^(?:https|git)://github.com/(?P[^/]+)/(?P[^/]+)') + + def __init__(self, args): + self.dl_dir = args.dl_dir + self.version = args.version + self.subdir = args.subdir + self.source = args.source + self.url = args.url + self._init_owner_repo() + self.xhash = args.hash + self._init_hasher() + self.commit_ts = None # lazy load commit timestamp + self.commit_ts_cache = GitHubCommitTsCache() + self.name = 'github-tarball' + + def download(self): + """Download and repack GitHub archive tarball.""" + self._init_commit_ts() + with Path(TMPDIR_DL, keep=True) as dir_dl: + # fetch tarball from GitHub + tarball_path = os.path.join(dir_dl.path, self.subdir + '.tar.gz.dl') + with Path(tarball_path, isdir=False): + self._fetch(tarball_path) + # unpack + d = os.path.join(dir_dl.path, self.subdir + '.untar') + with Path(d, preclean=True) as dir_untar: + tarball_prefix = Path.untar(tarball_path, into=dir_untar.path) + dir0 = os.path.join(dir_untar.path, tarball_prefix) + dir1 = os.path.join(dir_untar.path, self.subdir) + # submodules check + if self._has_submodule(dir0): + raise self._error('Fetching submodules is not yet supported') + # rename subdir + os.rename(dir0, dir1) + # repack + into=os.path.join(TMPDIR_DL, self.source) + Path.tar(dir_untar.path, self.subdir, into=into, ts=self.commit_ts) + try: + self._hash_check(into) + except Exception: + Path.rm_all(into) + raise + # move to target location + file1 = os.path.join(self.dl_dir, self.source) + if into != file1: + shutil.move(into, file1) + + def _has_submodule(self, dir_): + m = os.path.join(dir_, '.gitmodules') + try: + st = os.stat(m) + return st.st_size > 0 + except OSError as e: + return e.errno != errno.ENOENT + + def _init_owner_repo(self): + m = self.__repo_url_regex.search(self.url) + if m is None: + raise self._error('Invalid github url: {}'.format(self.url)) + owner = m.group('owner') + repo = m.group('repo') + if repo.endswith('.git'): + repo = repo[:-4] + self.owner = owner + self.repo = repo + + def _init_hasher(self): + xhash = self.xhash + if len(xhash) == 64: + self.hasher = hashlib.sha256() + elif len(xhash) == 32: + self.hasher = hashlib.md5() + else: + raise self._error('Requires sha256sum for verification') + self.xhash = xhash + + def _hash_check(self, f): + with open(f, 'rb') as fin: + while True: + d = fin.read(4096) + if not d: + break + self.hasher.update(d) + xhash = self.hasher.hexdigest() + if xhash != self.xhash: + raise self._error('Wrong hash (probably caused by .gitattributes), expecting {}, got {}'.format(self.xhash, xhash)) + + def _init_commit_ts(self): + if self.commit_ts is not None: + return + # GitHub provides 2 APIs[1,2] for fetching commit data. API[1] is more + # terse while API[2] provides more verbose info such as commit diff + # etc. That's the main reason why API[1] is preferred: the response + # size is predictable. + # + # However, API[1] only accepts complete commit sha1sum as the parameter + # while API[2] is more liberal accepting also partial commit id and + # tags, etc. + # + # [1] Get a single commit, Repositories, https://developer.github.com/v3/repos/commits/#get-a-single-commit + # [2] Git Commits, Git Data, https://developer.github.com/v3/git/commits/#get-a-commit + apis = [ + { + 'url': self._make_repo_url_path('git', 'commits', self.version), + 'attr_path': ('committer', 'date'), + }, { + 'url': self._make_repo_url_path('commits', self.version), + 'attr_path': ('commit', 'committer', 'date'), + }, + ] + version_is_sha1sum = len(self.version) == 40 + if not version_is_sha1sum: + apis.insert(0, apis.pop()) + for api in apis: + url = api['url'] + attr_path = api['attr_path'] + try: + ct = self.commit_ts_cache.get(url) + if ct is not None: + self.commit_ts = ct + return + ct = self._init_commit_ts_remote_get(url, attr_path) + self.commit_ts = ct + self.commit_ts_cache.set(url, ct) + return + except Exception: + pass + raise self._error('Cannot fetch commit ts: {}'.format(url)) + + def _init_commit_ts_remote_get(self, url, attrpath): + resp = self._make_request(url) + data = resp.read() + date = json.loads(data) + for attr in attrpath: + date = date[attr] + date = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ') + date = date.timetuple() + ct = calendar.timegm(date) + return ct + + def _fetch(self, path): + """Fetch tarball of the specified version ref.""" + ref = self.version + url = self._make_repo_url_path('tarball', ref) + resp = self._make_request(url) + with open(path, 'wb') as fout: + while True: + d = resp.read(4096) + if not d: + break + fout.write(d) + + def _make_repo_url_path(self, *args): + url = '/repos/{0}/{1}'.format(self.owner, self.repo) + if args: + url += '/' + '/'.join(args) + return url + + def _make_request(self, path): + """Request GitHub API endpoint on ``path``.""" + url = 'https://api.github.com' + path + headers = { + 'Accept': 'application/vnd.github.v3+json', + 'User-Agent': 'OpenWrt', + } + req = urllib2.Request(url, headers=headers) + sslcontext = ssl._create_unverified_context() + fileobj = urllib2.urlopen(req, context=sslcontext) + return fileobj + + def _error(self, msg): + return DownloadGitHubError('{}: {}'.format(self.source, msg)) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--dl-dir', default=os.getcwd(), help='Download dir') + parser.add_argument('--url', help='Download URL') + parser.add_argument('--subdir', help='Source code subdir name') + parser.add_argument('--version', help='Source code version') + parser.add_argument('--source', help='Source tarball filename') + parser.add_argument('--hash', help='Source tarball\'s expected sha256sum') + args = parser.parse_args() + try: + method = DownloadGitHubTarball(args) + method.download() + except Exception as ex: + sys.stderr.write('{}: Download from {} failed\n'.format(args.source, args.url)) + sys.stderr.write('{}\n'.format(ex)) + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/scripts/download.pl b/scripts/download.pl index 2591d0fc4..34fd6a6f0 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -233,7 +233,6 @@ foreach my $mirror (@ARGV) { push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - push @mirrors, "http://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://mirror.rackspace.com/kernel.org/$dir"; push @mirrors, "http://download.xs4all.nl/ftp.kernel.org/pub/$dir"; diff --git a/scripts/fixup-makefile.pl b/scripts/fixup-makefile.pl index 9026ddcce..b6f1c7473 100755 --- a/scripts/fixup-makefile.pl +++ b/scripts/fixup-makefile.pl @@ -26,7 +26,7 @@ sub set_var($) { $state{related_var} = "URL"; } else { $state{context} = 1; - $state{related_var} = "PKG_SOURCE"; + $state{related_var} = "PKG_SOURCE_URL"; } } diff --git a/scripts/slugimage.pl b/scripts/slugimage.pl index deac6ac6d..8c0654d4f 100755 --- a/scripts/slugimage.pl +++ b/scripts/slugimage.pl @@ -40,7 +40,7 @@ use strict; use warnings; use Getopt::Long qw(:config no_ignore_case); -use POSIX qw(tmpnam); +use File::Temp qw(tempfile); my($debug) = 0; my($quiet) = 0; @@ -993,7 +993,7 @@ if ($pack) { # don't touch RedBoot and SysConf anyway. If no Trailer is specified, # put in one. if (not defined $redboot and not -e "RedBoot") { - $redboot = tmpnam(); + $redboot = tempfile(); open TMP, ">$redboot" or die "Cannot open file $redboot: $!"; push @cleanup, $redboot; # The RedBoot partition is 256 * 1024 = 262144; the trailer we add @@ -1006,7 +1006,7 @@ if ($pack) { close TMP; } if (not defined $sysconf and not -e "SysConf") { - $sysconf = tmpnam(); + $sysconf = tempfile(); open TMP, ">$sysconf" or die "Cannot open file $sysconf: $!"; push @cleanup, $sysconf; # The SysConf partition is 128 * 1024 = 131072 @@ -1014,7 +1014,7 @@ if ($pack) { close TMP; } if (not defined $trailer and not -e "Trailer") { - $trailer = tmpnam(); + $trailer = tempfile(); open TMP, ">$trailer" or die "Cannot open file $trailer: $!"; push @cleanup, $trailer; for my $i (@sercomm_flash_trailer) { diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index cbc3403a0..ef0a34eb4 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -40,6 +40,8 @@ sub target_config_features(@) { /^small_flash$/ and $ret .= "\tselect SMALL_FLASH\n"; /^nand$/ and $ret .= "\tselect NAND_SUPPORT\n"; /^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n"; + /^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n"; + /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n"; } return $ret; } diff --git a/scripts/time.pl b/scripts/time.pl new file mode 100755 index 000000000..a23b57c89 --- /dev/null +++ b/scripts/time.pl @@ -0,0 +1,65 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Config; + +if (@ARGV < 2) { + die "Usage: $0 \n"; +} + +sub gettime { + my ($sec, $usec); + + eval { + require Time::HiRes; + ($sec, $usec) = Time::HiRes::gettimeofday(); + }; + + unless (defined($sec) && defined($usec)) { + my $tv_t = ($Config{'longsize'} == 8) ? 'qq' : 'll'; + my $tv = pack $tv_t, 0, 0; + + eval { + require 'syscall.ph'; + syscall(SYS_gettimeofday(), $tv, 0); + }; + + ($sec, $usec) = unpack $tv_t, $tv; + } + + return ($sec, $usec); +} + +my ($prefix, @cmd) = @ARGV; +my ($sec, $usec) = gettime(); +my $pid = fork(); + +if (!defined($pid)) { + die "$0: Failure to fork(): $!\n"; +} +elsif ($pid == 0) { + exec(@cmd); + die "$0: Failure to exec(): $!\n"; +} +else { + $SIG{'INT'} = 'IGNORE'; + $SIG{'QUIT'} = 'IGNORE'; + + if (waitpid($pid, 0) == -1) { + die "$0: Failure to waitpid(): $!\n"; + } + + my $exitcode = $? >> 8; + my ($sec2, $usec2) = gettime(); + my (undef, undef, $cuser, $csystem) = times(); + + printf STDERR "%s#%.2f#%.2f#%.2f\n", + $prefix, $cuser, $csystem, + ($sec2 - $sec) + ($usec2 - $usec) / 1000000; + + $SIG{'INT'} = 'DEFAULT'; + $SIG{'QUIT'} = 'DEFAULT'; + + exit $exitcode; +} diff --git a/target/Config.in b/target/Config.in index 3aef76890..3cf4231f2 100644 --- a/target/Config.in +++ b/target/Config.in @@ -96,6 +96,12 @@ config ARCH_64BIT config VIRTIO_SUPPORT bool +config USES_ROOTFS_PART + bool + +config USES_BOOT_PART + bool + # Architecture selection config aarch64 diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index e0c0132b8..76ea19028 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -119,8 +119,8 @@ _call_image: staging_dir/host/.prereq-build _call_manifest: FORCE rm -rf $(TARGET_DIR) mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(DL_DIR) - $(MAKE) package_reload >/dev/null 2>/dev/null - $(MAKE) package_install >/dev/null 2>/dev/null + $(MAKE) package_reload >/dev/null + $(MAKE) package_install >/dev/null $(OPKG) list-installed package_index: FORCE diff --git a/target/linux/adm5120/Makefile b/target/linux/adm5120/Makefile new file mode 100644 index 000000000..fbfaf6d23 --- /dev/null +++ b/target/linux/adm5120/Makefile @@ -0,0 +1,24 @@ +# +# Copyright (C) 2007-2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +BOARD:=adm5120 +BOARDNAME:=Infineon/ADMtek ADM5120 +FEATURES:=low_mem small_flash source-only +SUBTARGETS:=router_le router_be rb1xx +INITRAMFS_EXTRA_FILES:= + +KERNEL_PATCHVER:=3.18 + +include $(INCLUDE_DIR)/target.mk + +DEFAULT_PACKAGES += admswconfig wpad-mini kmod-input-core \ + kmod-input-polldev kmod-input-gpio-keys-polled kmod-button-hotplug \ + kmod-leds-gpio kmod-ledtrig-adm5120-switch + +$(eval $(call BuildTarget)) diff --git a/target/linux/adm5120/base-files/etc/board.d/01_leds b/target/linux/adm5120/base-files/etc/board.d/01_leds new file mode 100755 index 000000000..f5cd778ed --- /dev/null +++ b/target/linux/adm5120/base-files/etc/board.d/01_leds @@ -0,0 +1,17 @@ +#!/bin/sh + +. /lib/functions/uci-defaults.sh + +board_config_update + +ucidef_set_led_portstate "lan1" "LAN1" "lan1" "link_act" +ucidef_set_led_portstate "lan2" "LAN2" "lan2" "link_act" +ucidef_set_led_portstate "lan3" "LAN3" "lan3" "link_act" +ucidef_set_led_portstate "lan4" "LAN4" "lan4" "link_act" +ucidef_set_led_portstate "wan" "WAN" "wan" "link_act" + +ucidef_set_led_netdev "wlan" "WLAN" "wlan" "wlan0" + +board_config_flush + +exit 0 diff --git a/target/linux/adm5120/base-files/etc/config/network b/target/linux/adm5120/base-files/etc/config/network new file mode 100644 index 000000000..87782f478 --- /dev/null +++ b/target/linux/adm5120/base-files/etc/config/network @@ -0,0 +1,39 @@ +#### VLAN configuration +config switch + option eth0 "0 1 2 3" + option eth1 "4" + + +#### Loopback configuration +config interface loopback + option ifname "lo" + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + + +#### LAN configuration +config interface lan + option type bridge + option ifname "eth0" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + option ip6assign 60 + + +#### WAN configuration +config interface wan + option ifname "eth1" + option proto dhcp + + +#### WAN6 configuration +config interface wan6 + option ifname "eth1" + option proto dhcpv6 + + +#### Network global configuration +config globals globals + option ula_prefix auto diff --git a/target/linux/adm5120/base-files/etc/diag.sh b/target/linux/adm5120/base-files/etc/diag.sh new file mode 100644 index 000000000..08952bdaa --- /dev/null +++ b/target/linux/adm5120/base-files/etc/diag.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Copyright (C) 2007-2013 OpenWrt.org + +. /lib/functions/leds.sh +. /lib/adm5120.sh + +set_state() { + case "$1" in + preinit) + status_led_blink_preinit + ;; + failsafe) + status_led_blink_failsafe + ;; + preinit_regular) + status_led_blink_preinit_regular + ;; + done) + status_led_on + ;; + esac +} diff --git a/target/linux/adm5120/base-files/etc/inittab b/target/linux/adm5120/base-files/etc/inittab new file mode 100644 index 000000000..d81d5d943 --- /dev/null +++ b/target/linux/adm5120/base-files/etc/inittab @@ -0,0 +1,5 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +tts/0::askfirst:/usr/libexec/login.sh +ttyAM0::askfirst:/usr/libexec/login.sh +tty1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/adm5120/base-files/lib/adm5120.sh b/target/linux/adm5120/base-files/lib/adm5120.sh new file mode 100755 index 000000000..496fc06f3 --- /dev/null +++ b/target/linux/adm5120/base-files/lib/adm5120.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Copyright (C) 2007 OpenWrt.org +# +# + +board_name="" +status_led="" +sys_mtd_part="" + +adm5120_detect() { + board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo) + + case "$board_name" in + "Cellvision"*) + status_led="status" + sys_mtd_part="firmware" + ;; + "Compex"*) + status_led="diag" + case "$board_name" in + *-WRT) + sys_mtd_part="trx" + ;; + *) + sys_mtd_part="partition1" + ;; + esac + ;; + "Edimax"*) + status_led="power" + sys_mtd_part="firmware" + ;; + "Infineon"*) + sys_mtd_part="firmware" + ;; + "Mikrotik"*) + status_led="power" + ;; + "ZyXEL"*) + status_led="power" + sys_mtd_part="trx" + ;; + "EB-214A"*) + status_led="power" + sys_mtd_part="firmware" + ;; + *) + ;; + esac +} + +adm5120_detect diff --git a/target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh b/target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh new file mode 100644 index 000000000..4fca1e71b --- /dev/null +++ b/target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +do_adm5120() { + . /lib/adm5120.sh +} + +boot_hook_add preinit_main do_adm5120 diff --git a/target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 b/target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 new file mode 100644 index 000000000..ac2a7cbb6 --- /dev/null +++ b/target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 @@ -0,0 +1,9 @@ +#!/bin/sh + +set_preinit_ifname() { + ifname=eth0 +} + +boot_hook_add preinit_main set_preinit_ifname + + diff --git a/target/linux/adm5120/base-files/lib/upgrade/platform.sh b/target/linux/adm5120/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..b874a5e99 --- /dev/null +++ b/target/linux/adm5120/base-files/lib/upgrade/platform.sh @@ -0,0 +1,35 @@ +# +# Copyright (C) 2009-2010 OpenWrt.org +# + +. /lib/adm5120.sh + +PART_NAME="firmware" +RAMFS_COPY_DATA=/lib/adm5120.sh + +platform_check_image() { + local magic="$(get_magic_word "$1")" + + [ "$#" -gt 1 ] && return 1 + + case "$board_name" in + "ZyXEL"*|"Compex WP54 family") + # .trx files + [ "$magic" != "4844" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + *) + ;; + esac + + echo "Sysupgrade is not yet supported on $board_name." + return 1 +} + +platform_do_upgrade() { + PART_NAME="$sys_mtd_part" + default_do_upgrade "$ARGV" +} diff --git a/target/linux/adm5120/config-3.18 b/target/linux/adm5120/config-3.18 new file mode 100644 index 000000000..231877e6a --- /dev/null +++ b/target/linux/adm5120/config-3.18 @@ -0,0 +1,175 @@ +CONFIG_ADM5120=y +CONFIG_ADM5120_ENET=y +CONFIG_ADM5120_MACH_5GXI=y +CONFIG_ADM5120_MACH_BR_6104K=y +CONFIG_ADM5120_MACH_BR_6104KP=y +CONFIG_ADM5120_MACH_BR_61X4WG=y +CONFIG_ADM5120_MACH_CAS_771=y +CONFIG_ADM5120_MACH_EASY5120P_ATA=y +CONFIG_ADM5120_MACH_EASY5120_RT=y +CONFIG_ADM5120_MACH_EASY5120_WVOIP=y +CONFIG_ADM5120_MACH_EASY83000=y +CONFIG_ADM5120_MACH_EB_214A=y +CONFIG_ADM5120_MACH_NFS_101=y +CONFIG_ADM5120_MACH_NP27G=y +CONFIG_ADM5120_MACH_NP28G=y +CONFIG_ADM5120_MACH_PMUGW=y +# CONFIG_ADM5120_MACH_RB_11X is not set +# CONFIG_ADM5120_MACH_RB_133 is not set +# CONFIG_ADM5120_MACH_RB_133C is not set +# CONFIG_ADM5120_MACH_RB_150 is not set +# CONFIG_ADM5120_MACH_RB_153 is not set +# CONFIG_ADM5120_MACH_RB_192 is not set +CONFIG_ADM5120_MACH_WP54=y +CONFIG_ADM5120_OEM_CELLVISION=y +CONFIG_ADM5120_OEM_COMPEX=y +CONFIG_ADM5120_OEM_EDIMAX=y +CONFIG_ADM5120_OEM_GENERIC=y +CONFIG_ADM5120_OEM_INFINEON=y +# CONFIG_ADM5120_OEM_MIKROTIK is not set +CONFIG_ADM5120_OEM_MOTOROLA=y +CONFIG_ADM5120_OEM_OSBRIDGE=y +# CONFIG_ADM5120_OEM_ZYXEL is not set +CONFIG_ADM5120_SOC_BGA=y +CONFIG_ADM5120_WDT=y +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_ARCH_HAS_SG_CHAIN is not set +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARM_AMBA=y +CONFIG_BUILD_BIN2C=y +CONFIG_CEVT_R4K=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +CONFIG_CPU_MIPSR1=y +CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_R4K_FPU=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CSRC_R4K=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_EARLY_PRINTK=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_SYSFS=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HW_HAS_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set +CONFIG_IRQ_CPU=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_LEDS_TRIGGER_ADM5120_SWITCH is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_MIPS=y +# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +CONFIG_MIPS_MACHINE=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_ADM5120=y +CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_MYLOADER_PARTS=y +CONFIG_MTD_TRXSPLIT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NO_EXCEPT_FILL=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_IOPORT_MAP is not set +CONFIG_PAGEFLAGS_EXTENDED=y +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_PCI=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y +# CONFIG_PREEMPT_RCU is not set +# CONFIG_RCU_STALL_COMMON is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_AMBA_PL010=y +CONFIG_SERIAL_AMBA_PL010_CONSOLE=y +CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 +# CONFIG_SERIAL_AMBA_PL011 is not set +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SWAP is not set +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB_SUPPORT=y +CONFIG_WATCHDOG_CORE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig b/target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig new file mode 100644 index 000000000..be35a8f72 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig @@ -0,0 +1,197 @@ +if ADM5120 + +menu "ADM5120 Board selection" + +config ADM5120_MACH_CAS_771 + bool "Cellvision CAS-771/771W support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_CELLVISION + default y + +config ADM5120_MACH_NFS_101 + bool "Cellvision NFS-101U/101WU support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_CELLVISION + default y + +config ADM5120_MACH_NP27G + bool "Compex NP27G support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_COMPEX + default y + +config ADM5120_MACH_NP28G + bool "Compex NP28G support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_COMPEX + default y + +config ADM5120_MACH_WP54 + bool "Compex WP54 family support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_COMPEX + default y + +config ADM5120_MACH_EB_214A + bool "EB-214A support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_GENERIC + default y + +config ADM5120_MACH_BR_6104K + bool "Edimax BR-6104K support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_OEM_EDIMAX + default y + +config ADM5120_MACH_BR_6104KP + bool "Edimax BR-6104KP support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_OEM_EDIMAX + default y + +config ADM5120_MACH_BR_61X4WG + bool "Edimax BR-6104WG/6114WG support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_EDIMAX + default y + +config ADM5120_MACH_EASY5120_RT + bool "Infineon EASY 5120-RT Reference Board support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_INFINEON + default y + +config ADM5120_MACH_EASY5120_WVOIP + bool "Infineon EASY 5120-WVoIP Reference Board support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_INFINEON + default y + +config ADM5120_MACH_EASY5120P_ATA + bool "Infineon EASY 5120P-ATA Reference Board support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_OEM_INFINEON + default y + +config ADM5120_MACH_EASY83000 + bool "Infineon EASY 83000 Reference Board support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_OEM_INFINEON + default y + +config ADM5120_MACH_RB_11X + bool "MikroTik RouterBOARD 111/112 support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_MIKROTIK + default y + +config ADM5120_MACH_RB_133 + bool "MikroTik RouterBOARD 133 support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_MIKROTIK + default y + +config ADM5120_MACH_RB_133C + bool "MikroTik RouterBOARD 133C support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_MIKROTIK + default y + +config ADM5120_MACH_RB_150 + bool "MikroTik RouterBOARD 150 support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_OEM_MIKROTIK + default y + +config ADM5120_MACH_RB_153 + bool "MikroTik RouterBOARD 153 support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_MIKROTIK + default y + +config ADM5120_MACH_RB_192 + bool "MikroTik RouterBOARD 192 support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_MIKROTIK + default y + +config ADM5120_MACH_PMUGW + bool "Motorola Powerline MU Gateway" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_MOTOROLA + default y + +config ADM5120_MACH_5GXI + bool "OSBRiDGE 5GXi/5XLi support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_OSBRIDGE + default y + +config ADM5120_MACH_P_334WT + bool "ZyXEL Prestige 334WT" + depends on CPU_BIG_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_ZYXEL + default y + +config ADM5120_MACH_P_335 + bool "ZyXEL Prestige 335/335WT" + depends on CPU_BIG_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_ZYXEL + default y + +endmenu + +config ADM5120_SOC_BGA + select HW_HAS_PCI + def_bool n + +config ADM5120_OEM_CELLVISION + def_bool n + +config ADM5120_OEM_COMPEX + def_bool n + +config ADM5120_OEM_EDIMAX + def_bool n + +config ADM5120_OEM_GENERIC + def_bool n + +config ADM5120_OEM_INFINEON + def_bool n + +config ADM5120_OEM_MIKROTIK + def_bool n + +config ADM5120_OEM_MOTOROLA + def_bool n + +config ADM5120_OEM_OSBRIDGE + def_bool n + +config ADM5120_OEM_ZYXEL + def_bool n + +config ARM_AMBA + def_bool y + +endif diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform b/target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform new file mode 100644 index 000000000..0c9edf218 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform @@ -0,0 +1,19 @@ +# +# Infineon/ADMtek ADM5120 +# + +platform-$(CONFIG_ADM5120) += adm5120/common/ + +platform-$(CONFIG_ADM5120_OEM_CELLVISION) += adm5120/cellvision/ +platform-$(CONFIG_ADM5120_OEM_COMPEX) += adm5120/compex/ +platform-$(CONFIG_ADM5120_OEM_EDIMAX) += adm5120/edimax/ +platform-$(CONFIG_ADM5120_OEM_GENERIC) += adm5120/generic/ +platform-$(CONFIG_ADM5120_OEM_INFINEON) += adm5120/infineon/ +platform-$(CONFIG_ADM5120_OEM_MIKROTIK) += adm5120/mikrotik/ +platform-$(CONFIG_ADM5120_OEM_MOTOROLA) += adm5120/motorola/ +platform-$(CONFIG_ADM5120_OEM_OSBRIDGE) += adm5120/osbridge/ +platform-$(CONFIG_ADM5120_OEM_ZYXEL) += adm5120/zyxel/ + +cflags-$(CONFIG_ADM5120) += -I$(srctree)/arch/mips/include/asm/mach-adm5120 +libs-$(CONFIG_ADM5120) += arch/mips/adm5120/prom/ +load-$(CONFIG_ADM5120) += 0xffffffff80001000 diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile new file mode 100644 index 000000000..a949fc9f6 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile @@ -0,0 +1,4 @@ +obj-y += cellvision.o + +obj-$(CONFIG_ADM5120_MACH_CAS_771) += cas-771.o +obj-$(CONFIG_ADM5120_MACH_NFS_101) += nfs-101.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c new file mode 100644 index 000000000..5033e0246 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c @@ -0,0 +1,37 @@ +/* + * Cellvision/SparkLAN CAS-771/771W support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "cellvision.h" + +static struct adm5120_pci_irq cas771_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), + PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1), + PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2) +}; + +static struct gpio_led cas771_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN0, "cam_flash", NULL), + /* GPIO PIN3 is the reset */ + GPIO_LED_STD(ADM5120_GPIO_PIN6, "access", NULL), + GPIO_LED_STD(ADM5120_GPIO_P0L1, "status", NULL), + GPIO_LED_STD(ADM5120_GPIO_P0L2, "diag", NULL), +}; + +static void __init cas771_setup(void) +{ + cas7xx_setup(); + adm5120_add_device_gpio_leds(ARRAY_SIZE(cas771_gpio_leds), + cas771_gpio_leds); + adm5120_pci_set_irq_map(ARRAY_SIZE(cas771_pci_irqs), cas771_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_CAS771, "CAS-771", "Cellvision CAS-771/771W", + cas771_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c new file mode 100644 index 000000000..a7cedf03b --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c @@ -0,0 +1,147 @@ +/* + * Cellvision/SparkLAN boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "cellvision.h" + +#include + +#define CELLVISION_GPIO_FLASH_A20 ADM5120_GPIO_PIN5 +#define CELLVISION_GPIO_DEV_MASK (1 << CELLVISION_GPIO_FLASH_A20) + +#define CELLVISION_CONFIG_OFFSET 0x8000 +#define CELLVISION_CONFIG_SIZE 0x1000 + +static struct mtd_partition cas6xx_partitions[] = { + { + .name = "admboot", + .offset = 0, + .size = 32*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "config", + .offset = MTDPART_OFS_APPEND, + .size = 32*1024, + } , { + .name = "nvfs1", + .offset = MTDPART_OFS_APPEND, + .size = 64*1024, + } , { + .name = "nvfs2", + .offset = MTDPART_OFS_APPEND, + .size = 64*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct mtd_partition cas7xx_partitions[] = { + { + .name = "admboot", + .offset = 0, + .size = 32*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "config", + .offset = MTDPART_OFS_APPEND, + .size = 32*1024, + } , { + .name = "nvfs", + .offset = MTDPART_OFS_APPEND, + .size = 128*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static void switch_bank_gpio5(unsigned bank) +{ + switch (bank) { + case 0: + gpio_set_value(CELLVISION_GPIO_FLASH_A20, 0); + break; + case 1: + gpio_set_value(CELLVISION_GPIO_FLASH_A20, 1); + break; + } +} + +static void __init cellvision_flash_setup(void) +{ + /* setup flash A20 line */ + gpio_request(CELLVISION_GPIO_FLASH_A20, NULL); + gpio_direction_output(CELLVISION_GPIO_FLASH_A20, 0); + + adm5120_flash0_data.switch_bank = switch_bank_gpio5; + adm5120_add_device_flash(0); +} + +void __init cellvision_mac_setup(void) +{ + u8 mac_base[6]; + int err; + + err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET, + CELLVISION_CONFIG_SIZE, mac_base); + + if ((err) || !is_valid_ether_addr(mac_base)) + random_ether_addr(mac_base); + + adm5120_setup_eth_macs(mac_base); +} + +void __init cas6xx_flash_setup(void) +{ + adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions); + adm5120_flash0_data.parts = cas6xx_partitions; + + cellvision_flash_setup(); +} + +void __init cas7xx_flash_setup(void) +{ + adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions); + adm5120_flash0_data.parts = cas7xx_partitions; + + cellvision_flash_setup(); +} + +void __init cas6xx_setup(void) +{ + cas6xx_flash_setup(); + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + adm5120_add_device_switch(1, NULL); +} + +MIPS_MACHINE(MACH_ADM5120_CAS630, "CAS-630", "Cellvision CAS-630/630W", + cas6xx_setup); +MIPS_MACHINE(MACH_ADM5120_CAS670, "CAS-670", "Cellvision CAS-670/670W", + cas6xx_setup); + +void __init cas7xx_setup(void) +{ + cas7xx_flash_setup(); + cellvision_mac_setup(); + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + adm5120_add_device_switch(1, NULL); +} + +MIPS_MACHINE(MACH_ADM5120_CAS700, "CAS-700", "Cellvision CAS-700/700W", + cas7xx_setup); +MIPS_MACHINE(MACH_ADM5120_CAS790, "CAS-790", "Cellvision CAS-790", + cas7xx_setup); +MIPS_MACHINE(MACH_ADM5120_CAS861, "CAS-861", "Cellvision CAS-861/861W", + cas7xx_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h new file mode 100644 index 000000000..2b55ebf76 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h @@ -0,0 +1,28 @@ +/* + * Cellvision/SparkLAN boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + +extern void cellvision_mac_setup(void) __init; + +extern void cas6xx_flash_setup(void) __init; +extern void cas7xx_flash_setup(void) __init; +extern void cas6xx_setup(void) __init; +extern void cas7xx_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c new file mode 100644 index 000000000..7d214c090 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c @@ -0,0 +1,47 @@ +/* + * Cellvision/SparkLAN NFS-101U/WU support + * + * Copyright (C) 2007-2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "cellvision.h" + +static struct adm5120_pci_irq nfs101_pci_irqs[] __initdata = { + /* miniPCI slot */ + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), + + /* ALi USB controller */ + PCIIRQ(3, 0, 2, ADM5120_IRQ_PCI2), + PCIIRQ(3, 3, 1, ADM5120_IRQ_PCI1), + + /* NEC USB controller */ + PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1), + PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI2), + PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2), +}; + +static u8 nfs101_vlans[6] __initdata = { + /* FIXME: not tested */ + 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init nfs101_setup(void) +{ + cas6xx_flash_setup(); + cellvision_mac_setup(); + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + adm5120_add_device_switch(1, nfs101_vlans); + + adm5120_pci_set_irq_map(ARRAY_SIZE(nfs101_pci_irqs), + nfs101_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_NFS101U, "NFS-101U", "Cellvision NFS-101U/101WU", + nfs101_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile new file mode 100644 index 000000000..8d302c593 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile @@ -0,0 +1,8 @@ +# +# Makefile for the Infineon/ADMtek ADM5120 SoC specific parts of the kernel +# + +obj-y := adm5120.o setup.o prom.o irq.o memory.o clock.o \ + gpio.o platform.o + +obj-$(CONFIG_EARLY_PRINTK) += early-printk.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c new file mode 100644 index 000000000..28388342c --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include + +#include +#include +#include + +unsigned int adm5120_product_code; +unsigned int adm5120_revision; +unsigned int adm5120_package; +unsigned int adm5120_nand_boot; +unsigned long adm5120_speed; + +/* + * CPU settings detection + */ +#define CODE_GET_PC(c) ((c) & CODE_PC_MASK) +#define CODE_GET_REV(c) (((c) >> CODE_REV_SHIFT) & CODE_REV_MASK) +#define CODE_GET_PK(c) (((c) >> CODE_PK_SHIFT) & CODE_PK_MASK) +#define CODE_GET_CLKS(c) (((c) >> CODE_CLKS_SHIFT) & CODE_CLKS_MASK) +#define CODE_GET_NAB(c) (((c) & CODE_NAB) != 0) + +void adm5120_ndelay(u32 ns) +{ + u32 t; + + SW_WRITE_REG(SWITCH_REG_TIMER, TIMER_PERIOD_DEFAULT); + SW_WRITE_REG(SWITCH_REG_TIMER_INT, (TIMER_INT_TOS | TIMER_INT_TOM)); + + t = (ns+640) / 640; + t &= TIMER_PERIOD_MASK; + SW_WRITE_REG(SWITCH_REG_TIMER, t | TIMER_TE); + + /* wait until the timer expires */ + do { + t = SW_READ_REG(SWITCH_REG_TIMER_INT); + } while ((t & TIMER_INT_TOS) == 0); + + /* leave the timer disabled */ + SW_WRITE_REG(SWITCH_REG_TIMER, TIMER_PERIOD_DEFAULT); + SW_WRITE_REG(SWITCH_REG_TIMER_INT, (TIMER_INT_TOS | TIMER_INT_TOM)); +} + +void __init adm5120_soc_init(void) +{ + u32 code; + u32 clks; + + code = SW_READ_REG(SWITCH_REG_CODE); + + adm5120_product_code = CODE_GET_PC(code); + adm5120_revision = CODE_GET_REV(code); + adm5120_package = (CODE_GET_PK(code) == CODE_PK_BGA) ? + ADM5120_PACKAGE_BGA : ADM5120_PACKAGE_PQFP; + adm5120_nand_boot = CODE_GET_NAB(code); + + clks = CODE_GET_CLKS(code); + adm5120_speed = ADM5120_SPEED_175; + if (clks & 1) + adm5120_speed += 25000000; + if (clks & 2) + adm5120_speed += 50000000; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c new file mode 100644 index 000000000..52ae64c41 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c @@ -0,0 +1,65 @@ +/* + * ADM5120 minimal CLK API implementation + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was based on the CLK API implementation in: + * arch/mips/tx4938/toshiba_rbtx4938/setup.c + * Copyright (C) 2000-2001 Toshiba Corporation + * 2003-2005 (c) MontaVista Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +struct clk { + unsigned long rate; +}; + +static struct clk uart_clk = { + .rate = ADM5120_UART_CLOCK +}; + +struct clk *clk_get(struct device *dev, const char *id) +{ + const char *name = dev_name(dev); + + if (!strcmp(name, "apb:uart0") || !strcmp(name, "apb:uart1")) + return &uart_clk; + + return ERR_PTR(-ENOENT); +} +EXPORT_SYMBOL(clk_get); + +int clk_enable(struct clk *clk) +{ + return 0; +} +EXPORT_SYMBOL(clk_enable); + +void clk_disable(struct clk *clk) +{ +} +EXPORT_SYMBOL(clk_disable); + +unsigned long clk_get_rate(struct clk *clk) +{ + return clk->rate; +} +EXPORT_SYMBOL(clk_get_rate); + +void clk_put(struct clk *clk) +{ +} +EXPORT_SYMBOL(clk_put); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c new file mode 100644 index 000000000..d90071263 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c @@ -0,0 +1,31 @@ +/* + * ADM5120 specific early printk support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include + +#include +#include +#include + +#define UART_READ(r) \ + __raw_readl((void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) +#define UART_WRITE(r, v) \ + __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) + +void __init prom_putchar(char ch) +{ + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0) + ; + UART_WRITE(UART_REG_DATA, ch); + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0) + ; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c new file mode 100644 index 000000000..461ea15e8 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c @@ -0,0 +1,328 @@ +/* + * ADM5120 generic GPIO API support via GPIOLIB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#define GPIO_REG(r) (void __iomem *)(KSEG1ADDR(ADM5120_SWITCH_BASE) + r) + +struct gpio1_desc { + void __iomem *reg; /* register address */ + u8 iv_shift; /* shift amount for input bit */ + u8 mode_shift; /* shift amount for mode bits */ +}; + +#define GPIO1_DESC(p, l) { \ + .reg = GPIO_REG(SWITCH_REG_PORT0_LED + ((p) * 4)), \ + .iv_shift = LED0_IV_SHIFT + (l), \ + .mode_shift = (l) * 4 \ + } + +static struct gpio1_desc gpio1_table[15] = { + GPIO1_DESC(0, 0), GPIO1_DESC(0, 1), GPIO1_DESC(0, 2), + GPIO1_DESC(1, 0), GPIO1_DESC(1, 1), GPIO1_DESC(1, 2), + GPIO1_DESC(2, 0), GPIO1_DESC(2, 1), GPIO1_DESC(2, 2), + GPIO1_DESC(3, 0), GPIO1_DESC(3, 1), GPIO1_DESC(3, 2), + GPIO1_DESC(4, 0), GPIO1_DESC(4, 1), GPIO1_DESC(4, 2) +}; + +static u32 gpio_conf2; + +int adm5120_gpio_to_irq(unsigned gpio) +{ + int ret; + + switch (gpio) { + case ADM5120_GPIO_PIN2: + ret = ADM5120_IRQ_GPIO2; + break; + case ADM5120_GPIO_PIN4: + ret = ADM5120_IRQ_GPIO4; + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} +EXPORT_SYMBOL(adm5120_gpio_to_irq); + +int adm5120_irq_to_gpio(unsigned irq) +{ + int ret; + + switch (irq) { + case ADM5120_IRQ_GPIO2: + ret = ADM5120_GPIO_PIN2; + break; + case ADM5120_IRQ_GPIO4: + ret = ADM5120_GPIO_PIN4; + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} +EXPORT_SYMBOL(adm5120_irq_to_gpio); + +/* + * Helpers for GPIO lines in GPIO_CONF0 register + */ +#define PIN_IM(p) ((1 << GPIO_CONF0_IM_SHIFT) << p) +#define PIN_IV(p) ((1 << GPIO_CONF0_IV_SHIFT) << p) +#define PIN_OE(p) ((1 << GPIO_CONF0_OE_SHIFT) << p) +#define PIN_OV(p) ((1 << GPIO_CONF0_OV_SHIFT) << p) + +int __adm5120_gpio0_get_value(unsigned offset) +{ + void __iomem **reg; + u32 t; + + reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); + + t = __raw_readl(reg); + if ((t & PIN_IM(offset)) != 0) + t &= PIN_IV(offset); + else + t &= PIN_OV(offset); + + return (t) ? 1 : 0; +} +EXPORT_SYMBOL(__adm5120_gpio0_get_value); + +void __adm5120_gpio0_set_value(unsigned offset, int value) +{ + void __iomem **reg; + u32 t; + + reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); + + t = __raw_readl(reg); + if (value == 0) + t &= ~(PIN_OV(offset)); + else + t |= PIN_OV(offset); + + __raw_writel(t, reg); +} +EXPORT_SYMBOL(__adm5120_gpio0_set_value); + +static int adm5120_gpio0_get_value(struct gpio_chip *chip, unsigned offset) +{ + return __adm5120_gpio0_get_value(offset); +} + +static void adm5120_gpio0_set_value(struct gpio_chip *chip, + unsigned offset, int value) +{ + __adm5120_gpio0_set_value(offset, value); +} + +static int adm5120_gpio0_direction_input(struct gpio_chip *chip, + unsigned offset) +{ + void __iomem **reg; + u32 t; + + reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); + + t = __raw_readl(reg); + t &= ~(PIN_OE(offset)); + t |= PIN_IM(offset); + __raw_writel(t, reg); + + return 0; +} + +static int adm5120_gpio0_direction_output(struct gpio_chip *chip, + unsigned offset, int value) +{ + void __iomem **reg; + u32 t; + + reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); + + t = __raw_readl(reg); + t &= ~(PIN_IM(offset) | PIN_OV(offset)); + t |= PIN_OE(offset); + + if (value) + t |= PIN_OV(offset); + + __raw_writel(t, reg); + + return 0; +} + +static struct gpio_chip adm5120_gpio0_chip = { + .label = "adm5120 gpio0", + .get = adm5120_gpio0_get_value, + .set = adm5120_gpio0_set_value, + .direction_input = adm5120_gpio0_direction_input, + .direction_output = adm5120_gpio0_direction_output, + .base = ADM5120_GPIO_PIN0, + .ngpio = ADM5120_GPIO_PIN7 - ADM5120_GPIO_PIN0 + 1, +}; + +int __adm5120_gpio1_get_value(unsigned offset) +{ + void __iomem **reg; + u32 t, m; + + reg = gpio1_table[offset].reg; + + t = __raw_readl(reg); + m = (t >> gpio1_table[offset].mode_shift) & LED_MODE_MASK; + if (m == LED_MODE_INPUT) + return (t >> gpio1_table[offset].iv_shift) & 1; + + if (m == LED_MODE_OUT_LOW) + return 0; + + return 1; +} +EXPORT_SYMBOL(__adm5120_gpio1_get_value); + +void __adm5120_gpio1_set_value(unsigned offset, int value) +{ + void __iomem **reg; + u32 t, s; + + reg = gpio1_table[offset].reg; + s = gpio1_table[offset].mode_shift; + + t = __raw_readl(reg); + t &= ~(LED_MODE_MASK << s); + + switch (value) { + case ADM5120_GPIO_LOW: + t |= (LED_MODE_OUT_LOW << s); + break; + case ADM5120_GPIO_FLASH: + case ADM5120_GPIO_LINK: + case ADM5120_GPIO_SPEED: + case ADM5120_GPIO_DUPLEX: + case ADM5120_GPIO_ACT: + case ADM5120_GPIO_COLL: + case ADM5120_GPIO_LINK_ACT: + case ADM5120_GPIO_DUPLEX_COLL: + case ADM5120_GPIO_10M_ACT: + case ADM5120_GPIO_100M_ACT: + t |= ((value & LED_MODE_MASK) << s); + break; + default: + t |= (LED_MODE_OUT_HIGH << s); + break; + } + + __raw_writel(t, reg); +} +EXPORT_SYMBOL(__adm5120_gpio1_set_value); + +static int adm5120_gpio1_get_value(struct gpio_chip *chip, unsigned offset) +{ + return __adm5120_gpio1_get_value(offset); +} + +static void adm5120_gpio1_set_value(struct gpio_chip *chip, + unsigned offset, int value) +{ + __adm5120_gpio1_set_value(offset, value); +} + +static int adm5120_gpio1_direction_input(struct gpio_chip *chip, + unsigned offset) +{ + void __iomem **reg; + u32 t; + + reg = gpio1_table[offset].reg; + t = __raw_readl(reg); + t &= ~(LED_MODE_MASK << gpio1_table[offset].mode_shift); + __raw_writel(t, reg); + + return 0; +} + +static int adm5120_gpio1_direction_output(struct gpio_chip *chip, + unsigned offset, int value) +{ + __adm5120_gpio1_set_value(offset, value); + return 0; +} + +static struct gpio_chip adm5120_gpio1_chip = { + .label = "adm5120 gpio1", + .get = adm5120_gpio1_get_value, + .set = adm5120_gpio1_set_value, + .direction_input = adm5120_gpio1_direction_input, + .direction_output = adm5120_gpio1_direction_output, + .base = ADM5120_GPIO_P0L0, + .ngpio = ADM5120_GPIO_P4L2 - ADM5120_GPIO_P0L0 + 1, +}; + +void __init adm5120_gpio_csx0_enable(void) +{ + gpio_conf2 |= GPIO_CONF2_CSX0; + SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); + + gpio_request(ADM5120_GPIO_PIN1, "CSX0"); +} + +void __init adm5120_gpio_csx1_enable(void) +{ + gpio_conf2 |= GPIO_CONF2_CSX1; + SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); + + gpio_request(ADM5120_GPIO_PIN3, "CSX1"); +} + +void __init adm5120_gpio_ew_enable(void) +{ + gpio_conf2 |= GPIO_CONF2_EW; + SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); + + gpio_request(ADM5120_GPIO_PIN0, "EW"); +} + +void __init adm5120_gpio_init(void) +{ + int err; + + SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); + + if (adm5120_package_pqfp()) + adm5120_gpio0_chip.ngpio = 4; + + err = gpiochip_add(&adm5120_gpio0_chip); + if (err) + panic("cannot add ADM5120 GPIO0 chip, error=%d", err); + + err = gpiochip_add(&adm5120_gpio1_chip); + if (err) + panic("cannot add ADM5120 GPIO1 chip, error=%d", err); + +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c new file mode 100644 index 000000000..a26e65176 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c @@ -0,0 +1,171 @@ +/* + * ADM5120 specific interrupt handlers + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +static void adm5120_intc_irq_unmask(struct irq_data *d); +static void adm5120_intc_irq_mask(struct irq_data *d); +static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type); + +static inline void intc_write_reg(unsigned int reg, u32 val) +{ + void __iomem *base = (void __iomem *)KSEG1ADDR(ADM5120_INTC_BASE); + + __raw_writel(val, base + reg); +} + +static inline u32 intc_read_reg(unsigned int reg) +{ + void __iomem *base = (void __iomem *)KSEG1ADDR(ADM5120_INTC_BASE); + + return __raw_readl(base + reg); +} + +static struct irq_chip adm5120_intc_irq_chip = { + .name = "INTC", + .irq_unmask = adm5120_intc_irq_unmask, + .irq_mask = adm5120_intc_irq_mask, + .irq_mask_ack = adm5120_intc_irq_mask, + .irq_set_type = adm5120_intc_irq_set_type +}; + +static struct irqaction adm5120_intc_irq_action = { + .handler = no_action, + .name = "cascade [INTC]" +}; + +static void adm5120_intc_irq_unmask(struct irq_data *d) +{ + intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE)); +} + +static void adm5120_intc_irq_mask(struct irq_data *d) +{ + intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE)); +} + +static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type) +{ + unsigned int irq = d->irq; + unsigned int sense; + unsigned long mode; + int err = 0; + + sense = flow_type & (IRQ_TYPE_SENSE_MASK); + switch (sense) { + case IRQ_TYPE_NONE: + case IRQ_TYPE_LEVEL_HIGH: + break; + case IRQ_TYPE_LEVEL_LOW: + switch (irq) { + case ADM5120_IRQ_GPIO2: + case ADM5120_IRQ_GPIO4: + break; + default: + err = -EINVAL; + break; + } + break; + default: + err = -EINVAL; + break; + } + + if (err) + return err; + + switch (irq) { + case ADM5120_IRQ_GPIO2: + case ADM5120_IRQ_GPIO4: + mode = intc_read_reg(INTC_REG_INT_MODE); + if (sense == IRQ_TYPE_LEVEL_LOW) + mode |= (1 << (irq - ADM5120_INTC_IRQ_BASE)); + else + mode &= ~(1 << (irq - ADM5120_INTC_IRQ_BASE)); + + intc_write_reg(INTC_REG_INT_MODE, mode); + break; + } + + return 0; +} + +static void adm5120_intc_irq_dispatch(void) +{ + unsigned long status; + int irq; + + status = intc_read_reg(INTC_REG_IRQ_STATUS) & INTC_INT_ALL; + if (status) { + irq = ADM5120_INTC_IRQ_BASE + fls(status) - 1; + do_IRQ(irq); + } else + spurious_interrupt(); +} + +asmlinkage void plat_irq_dispatch(void) +{ + unsigned long pending; + + pending = read_c0_status() & read_c0_cause() & ST0_IM; + + if (pending & STATUSF_IP7) + do_IRQ(ADM5120_IRQ_COUNTER); + else if (pending & STATUSF_IP2) + adm5120_intc_irq_dispatch(); + else + spurious_interrupt(); +} + +#define INTC_IRQ_STATUS (IRQ_LEVEL | IRQ_TYPE_LEVEL_HIGH | IRQ_DISABLED) +static void __init adm5120_intc_irq_init(void) +{ + int i; + + /* disable all interrupts */ + intc_write_reg(INTC_REG_IRQ_DISABLE, INTC_INT_ALL); + + /* setup all interrupts to generate IRQ instead of FIQ */ + intc_write_reg(INTC_REG_INT_MODE, 0); + + /* set active level for all external interrupts to HIGH */ + intc_write_reg(INTC_REG_INT_LEVEL, 0); + + /* disable usage of the TEST_SOURCE register */ + intc_write_reg(INTC_REG_IRQ_SOURCE_SELECT, 0); + + for (i = ADM5120_INTC_IRQ_BASE; + i <= ADM5120_INTC_IRQ_BASE + INTC_IRQ_LAST; + i++) { + irq_set_chip_and_handler(i, &adm5120_intc_irq_chip, + handle_level_irq); + } + + setup_irq(ADM5120_IRQ_INTC, &adm5120_intc_irq_action); +} + +void __init arch_init_irq(void) +{ + mips_cpu_irq_init(); + adm5120_intc_irq_init(); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c new file mode 100644 index 000000000..d07266fa3 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#ifdef DEBUG +# define mem_dbg(f, a...) printk(KERN_INFO "mem_detect: " f, ## a) +#else +# define mem_dbg(f, a...) +#endif + +unsigned long adm5120_memsize; + +#define MEM_READL(a) __raw_readl((void __iomem *)(a)) +#define MEM_WRITEL(a, v) __raw_writel((v), (void __iomem *)(a)) + +static int __init mem_check_pattern(u8 *addr, unsigned long offs) +{ + u32 *p1 = (u32 *)addr; + u32 *p2 = (u32 *)(addr+offs); + u32 t, u, v; + + /* save original value */ + t = MEM_READL(p1); + + u = MEM_READL(p2); + if (t != u) + return 0; + + v = 0x55555555; + if (u == v) + v = 0xAAAAAAAA; + + mem_dbg("write 0x%08X to 0x%08lX\n", v, (unsigned long)p1); + + MEM_WRITEL(p1, v); + adm5120_ndelay(1000); + u = MEM_READL(p2); + + mem_dbg("pattern at 0x%08lX is 0x%08X\n", (unsigned long)p2, u); + + /* restore original value */ + MEM_WRITEL(p1, t); + + return (v == u); +} + +static void __init adm5120_detect_memsize(void) +{ + u32 memctrl; + u32 size, maxsize; + u8 *p; + + memctrl = SW_READ_REG(SWITCH_REG_MEMCTRL); + switch (memctrl & MEMCTRL_SDRS_MASK) { + case MEMCTRL_SDRS_4M: + maxsize = 4 << 20; + break; + case MEMCTRL_SDRS_8M: + maxsize = 8 << 20; + break; + case MEMCTRL_SDRS_16M: + maxsize = 16 << 20; + break; + default: + maxsize = 64 << 20; + break; + } + + mem_dbg("checking for %uMB chip in 1st bank\n", maxsize >> 20); + + /* detect size of the 1st SDRAM bank */ + p = (u8 *)KSEG1ADDR(0); + for (size = 2<<20; size <= (maxsize >> 1); size <<= 1) { + if (mem_check_pattern(p, size)) { + /* mirrored address */ + mem_dbg("mirrored data found at offset 0x%08X\n", size); + break; + } + } + + mem_dbg("chip size in 1st bank is %uMB\n", size >> 20); + adm5120_memsize = size; + + if (size != maxsize) + /* 2nd bank is not supported */ + goto out; + + if ((memctrl & MEMCTRL_SDR1_ENABLE) == 0) + /* 2nd bank is disabled */ + goto out; + + /* + * some bootloaders enable 2nd bank, even if the 2nd SDRAM chip + * are missing. + */ + mem_dbg("check presence of 2nd bank\n"); + + p = (u8 *)KSEG1ADDR(maxsize+size-4); + if (mem_check_pattern(p, 0)) + adm5120_memsize += size; + + if (maxsize != size) { + /* adjusting MECTRL register */ + memctrl &= ~(MEMCTRL_SDRS_MASK); + switch (size>>20) { + case 4: + memctrl |= MEMCTRL_SDRS_4M; + break; + case 8: + memctrl |= MEMCTRL_SDRS_8M; + break; + case 16: + memctrl |= MEMCTRL_SDRS_16M; + break; + default: + memctrl |= MEMCTRL_SDRS_64M; + break; + } + SW_WRITE_REG(SWITCH_REG_MEMCTRL, memctrl); + } + +out: + mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 , + size>>20); +} + +void __init adm5120_mem_init(void) +{ + adm5120_detect_memsize(); + add_memory_region(0, adm5120_memsize, BOOT_MEM_RAM); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c new file mode 100644 index 000000000..bdbfbcbae --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c @@ -0,0 +1,375 @@ +/* + * ADM5120 generic platform devices + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#if 1 +/* + * TODO:remove global adm5120_eth* variables when the switch driver will be + * converted into a real platform driver + */ +unsigned int adm5120_eth_num_ports = 6; +EXPORT_SYMBOL_GPL(adm5120_eth_num_ports); + +unsigned char adm5120_eth_macs[6][6] = { + {'\00', 'A', 'D', 'M', '\x51', '\x20' }, + {'\00', 'A', 'D', 'M', '\x51', '\x21' }, + {'\00', 'A', 'D', 'M', '\x51', '\x22' }, + {'\00', 'A', 'D', 'M', '\x51', '\x23' }, + {'\00', 'A', 'D', 'M', '\x51', '\x24' }, + {'\00', 'A', 'D', 'M', '\x51', '\x25' } +}; +EXPORT_SYMBOL_GPL(adm5120_eth_macs); + +unsigned char adm5120_eth_vlans[6] = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x60 +}; +EXPORT_SYMBOL_GPL(adm5120_eth_vlans); +#endif + +void __init adm5120_setup_eth_macs(u8 *mac_base) +{ + u32 t; + int i, j; + + t = ((u32) mac_base[3] << 16) | ((u32) mac_base[4] << 8) + | ((u32) mac_base[5]); + + for (i = 0; i < ARRAY_SIZE(adm5120_eth_macs); i++) { + for (j = 0; j < 3; j++) + adm5120_eth_macs[i][j] = mac_base[j]; + + adm5120_eth_macs[i][3] = (t >> 16) & 0xff; + adm5120_eth_macs[i][4] = (t >> 8) & 0xff; + adm5120_eth_macs[i][5] = t & 0xff; + + t++; + } +} + +/* + * Built-in ethernet switch + */ +struct resource adm5120_switch_resources[] = { + [0] = { + .start = ADM5120_SWITCH_BASE, + .end = ADM5120_SWITCH_BASE+ADM5120_SWITCH_SIZE-1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = ADM5120_IRQ_SWITCH, + .end = ADM5120_IRQ_SWITCH, + .flags = IORESOURCE_IRQ, + }, +}; + +struct adm5120_switch_platform_data adm5120_switch_data; +struct platform_device adm5120_switch_device = { + .name = "adm5120-switch", + .id = -1, + .num_resources = ARRAY_SIZE(adm5120_switch_resources), + .resource = adm5120_switch_resources, + .dev.platform_data = &adm5120_switch_data, +}; + +void __init adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) +{ + if (num_ports > 0) + adm5120_eth_num_ports = num_ports; + + if (vlan_map) + memcpy(adm5120_eth_vlans, vlan_map, sizeof(adm5120_eth_vlans)); + + platform_device_register(&adm5120_switch_device); +} + +/* + * USB Host Controller + */ +struct resource adm5120_hcd_resources[] = { + [0] = { + .start = ADM5120_USBC_BASE, + .end = ADM5120_USBC_BASE+ADM5120_USBC_SIZE-1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = ADM5120_IRQ_USBC, + .end = ADM5120_IRQ_USBC, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 adm5120_hcd_dma_mask = DMA_BIT_MASK(24); +struct platform_device adm5120_hcd_device = { + .name = "adm5120-hcd", + .id = -1, + .num_resources = ARRAY_SIZE(adm5120_hcd_resources), + .resource = adm5120_hcd_resources, + .dev = { + .dma_mask = &adm5120_hcd_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(24), + } +}; + +void __init adm5120_add_device_usb(void) +{ + platform_device_register(&adm5120_hcd_device); +} + +/* + * NOR flash devices + */ +struct adm5120_flash_platform_data adm5120_flash0_data; +struct platform_device adm5120_flash0_device = { + .name = "adm5120-flash", + .id = 0, + .dev.platform_data = &adm5120_flash0_data, +}; + +struct adm5120_flash_platform_data adm5120_flash1_data; +struct platform_device adm5120_flash1_device = { + .name = "adm5120-flash", + .id = 1, + .dev.platform_data = &adm5120_flash1_data, +}; + +void __init adm5120_add_device_flash(unsigned id) +{ + struct platform_device *pdev; + + switch (id) { + case 0: + pdev = &adm5120_flash0_device; + break; + case 1: + pdev = &adm5120_flash1_device; + break; + default: + pdev = NULL; + break; + } + + if (pdev) + platform_device_register(pdev); +} + +/* + * built-in UARTs + */ +static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base, + unsigned int mctrl) +{ +} + +struct amba_pl010_data adm5120_uart0_data = { + .set_mctrl = adm5120_uart_set_mctrl +}; + +struct amba_device adm5120_uart0_device = { + .dev = { + .init_name = "apb:uart0", + .platform_data = &adm5120_uart0_data, + }, + .res = { + .start = ADM5120_UART0_BASE, + .end = ADM5120_UART0_BASE + ADM5120_UART_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + .irq = { ADM5120_IRQ_UART0, 0 }, + .periphid = 0x0041010, +}; + +struct amba_pl010_data adm5120_uart1_data = { + .set_mctrl = adm5120_uart_set_mctrl +}; + +struct amba_device adm5120_uart1_device = { + .dev = { + .init_name = "apb:uart1", + .platform_data = &adm5120_uart1_data, + }, + .res = { + .start = ADM5120_UART1_BASE, + .end = ADM5120_UART1_BASE + ADM5120_UART_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + .irq = { ADM5120_IRQ_UART1, 0 }, + .periphid = 0x0041010, +}; + +void __init adm5120_add_device_uart(unsigned id) +{ + struct amba_device *dev; + + switch (id) { + case 0: + dev = &adm5120_uart0_device; + break; + case 1: + dev = &adm5120_uart1_device; + break; + default: + dev = NULL; + break; + } + + if (dev) + amba_device_register(dev, &iomem_resource); +} + +/* + * GPIO buttons + */ +void __init adm5120_register_gpio_buttons(int id, + unsigned poll_interval, + unsigned nbuttons, + struct gpio_keys_button *buttons) +{ + struct platform_device *pdev; + struct gpio_keys_platform_data pdata; + struct gpio_keys_button *p; + int err; + + p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL); + if (!p) + return; + + pdev = platform_device_alloc("gpio-keys-polled", id); + if (!pdev) + goto err_free_buttons; + + memset(&pdata, 0, sizeof(pdata)); + pdata.poll_interval = poll_interval; + pdata.nbuttons = nbuttons; + pdata.buttons = p; + + err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); + if (err) + goto err_put_pdev; + + err = platform_device_add(pdev); + if (err) + goto err_put_pdev; + + return; + +err_put_pdev: + platform_device_put(pdev); + +err_free_buttons: + kfree(p); +} + +/* + * GPIO LEDS + */ +struct gpio_led_platform_data adm5120_gpio_leds_data; +struct platform_device adm5120_gpio_leds_device = { + .name = "leds-gpio", + .id = -1, + .dev.platform_data = &adm5120_gpio_leds_data, +}; + +void __init adm5120_add_device_gpio_leds(unsigned num_leds, + struct gpio_led *leds) +{ + struct gpio_led *p; + + p = kmalloc(num_leds * sizeof(*p), GFP_KERNEL); + if (!p) + return; + + memcpy(p, leds, num_leds * sizeof(*p)); + adm5120_gpio_leds_data.num_leds = num_leds; + adm5120_gpio_leds_data.leds = p; + + platform_device_register(&adm5120_gpio_leds_device); +} + +/* + * NAND flash + */ +struct resource adm5120_nand_resources[] = { + [0] = { + .start = ADM5120_NAND_BASE, + .end = ADM5120_NAND_BASE + ADM5120_NAND_SIZE-1, + .flags = IORESOURCE_MEM, + }, +}; + +static int adm5120_nand_ready(struct mtd_info *mtd) +{ + return ((adm5120_nand_get_status() & ADM5120_NAND_STATUS_READY) != 0); +} + +static void adm5120_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, + unsigned int ctrl) +{ + if (ctrl & NAND_CTRL_CHANGE) { + adm5120_nand_set_cle(ctrl & NAND_CLE); + adm5120_nand_set_ale(ctrl & NAND_ALE); + adm5120_nand_set_cen(ctrl & NAND_NCE); + } + + if (cmd != NAND_CMD_NONE) + NAND_WRITE_REG(NAND_REG_DATA, cmd); +} + +void __init adm5120_add_device_nand(struct platform_nand_data *pdata) +{ + struct platform_device *pdev; + int err; + + pdev = platform_device_alloc("gen_nand", -1); + if (!pdev) + goto err_out; + + err = platform_device_add_resources(pdev, adm5120_nand_resources, + ARRAY_SIZE(adm5120_nand_resources)); + if (err) + goto err_put; + + err = platform_device_add_data(pdev, pdata, sizeof(*pdata)); + if (err) + goto err_put; + + pdata = pdev->dev.platform_data; + pdata->ctrl.dev_ready = adm5120_nand_ready; + pdata->ctrl.cmd_ctrl = adm5120_nand_cmd_ctrl; + + err = platform_device_add(pdev); + if (err) + goto err_put; + + return; + +err_put: + platform_device_put(pdev); +err_out: + return; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c new file mode 100644 index 000000000..5c52ea27e --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c @@ -0,0 +1,264 @@ +/* + * ADM5120 specific prom routines + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +unsigned int adm5120_prom_type = ADM5120_PROM_GENERIC; + +struct board_desc { + unsigned long mach_type; + char *name; +}; + +#define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)} +static struct board_desc common_boards[] __initdata = { + /* Cellvision/SparkLAN boards */ + DEFBOARD("CAS-630", MACH_ADM5120_CAS630), + DEFBOARD("CAS-670", MACH_ADM5120_CAS670), + DEFBOARD("CAS-700", MACH_ADM5120_CAS700), + DEFBOARD("CAS-771", MACH_ADM5120_CAS771), + DEFBOARD("CAS-790", MACH_ADM5120_CAS790), + DEFBOARD("CAS-861", MACH_ADM5120_CAS861), + DEFBOARD("NFS-101U", MACH_ADM5120_NFS101U), + /* Compex boards */ + DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT), + /* Edimax boards */ + DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K), + DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104KP), + DEFBOARD("BR-6104WG", MACH_ADM5120_BR61X4WG), + DEFBOARD("BR-6114WG", MACH_ADM5120_BR61X4WG), + /* Infineon boards */ + DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA), + DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT), + DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP), + DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000), + /* Mikrotik RouterBOARDs */ + DEFBOARD("111", MACH_ADM5120_RB_11X), + DEFBOARD("112", MACH_ADM5120_RB_11X), + DEFBOARD("133", MACH_ADM5120_RB_133), + DEFBOARD("133C", MACH_ADM5120_RB_133C), + DEFBOARD("133C3", MACH_ADM5120_RB_133C), + DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */ + DEFBOARD("153", MACH_ADM5120_RB_153), + DEFBOARD("192", MACH_ADM5120_RB_192), + DEFBOARD("miniROUTER", MACH_ADM5120_RB_150), + /* OSBRiDGE boards */ + DEFBOARD("OSBRiDGE 5GXi", MACH_ADM5120_5GXI), + /* Motorola boards */ + DEFBOARD("Powerline MU Gateway", MACH_ADM5120_PMUGW), + /* Generic EB-214A */ + DEFBOARD("ADM5120", MACH_ADM5120_EB_214A), +}; + +static unsigned long __init find_machtype_byname(char *name) +{ + unsigned long ret; + int i; + + ret = MACH_ADM5120_GENERIC; + if (name == NULL) + goto out; + + if (*name == '\0') + goto out; + + for (i = 0; i < ARRAY_SIZE(common_boards); i++) { + if (strcmp(common_boards[i].name, name) == 0) { + ret = common_boards[i].mach_type; + break; + } + } + +out: + return ret; +} + +static unsigned long __init detect_machtype_routerboot(void) +{ + char *name; + + name = routerboot_get_boardname(); + return find_machtype_byname(name); +} + +static unsigned long __init detect_machtype_generic(void) +{ + char *name; + + name = generic_prom_getenv("board_name"); + return find_machtype_byname(name); +} + +unsigned long __init detect_machtype_cfe(void) +{ + char *name; + + name = cfe_getenv("BOARD_NAME"); + return find_machtype_byname(name); +} + +static struct { + unsigned long mach_type; + u16 vendor_id; + u16 board_id; +} zynos_boards[] __initdata = { +#define ZYNOS_BOARD(vi, bi, mt) \ + {.vendor_id = (vi), .board_id = (bi), .mach_type = (mt)} + +#define ZYXEL_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_ZYXEL, bi, mt) +#define DLINK_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_DLINK, bi, mt) +#define LUCENT_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_LUCENT, bi, mt) + ZYXEL_BOARD(ZYNOS_BOARD_HS100, MACH_ADM5120_HS100), + ZYXEL_BOARD(ZYNOS_BOARD_P334U, MACH_ADM5120_P334U), + ZYXEL_BOARD(ZYNOS_BOARD_P334W, MACH_ADM5120_P334W), + ZYXEL_BOARD(ZYNOS_BOARD_P334WH, MACH_ADM5120_P334WH), + ZYXEL_BOARD(ZYNOS_BOARD_P334WHD, MACH_ADM5120_P334WHD), + ZYXEL_BOARD(ZYNOS_BOARD_P334WT, MACH_ADM5120_P334WT), + ZYXEL_BOARD(ZYNOS_BOARD_P334WT_ALT, MACH_ADM5120_P334WT), + ZYXEL_BOARD(ZYNOS_BOARD_P335, MACH_ADM5120_P335), + ZYXEL_BOARD(ZYNOS_BOARD_P335PLUS, MACH_ADM5120_P335PLUS), + ZYXEL_BOARD(ZYNOS_BOARD_P335U, MACH_ADM5120_P335U) +}; + +static unsigned long __init detect_machtype_bootbase(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(zynos_boards); i++) { + if (zynos_boards[i].vendor_id == bootbase_info.vendor_id && + zynos_boards[i].board_id == bootbase_info.board_id) { + return zynos_boards[i].mach_type; + break; + } + } + + printk(KERN_WARNING "Unknown ZyXEL model (%u)\n", + bootbase_info.board_id); + return MACH_ADM5120_GENERIC; +} + +static struct { + unsigned long mach_type; + u16 vid; + u16 did; + u16 svid; + u16 sdid; +} mylo_boards[] __initdata = { +#define MYLO_BOARD(v, d, sv, sd, mt) \ + {.vid = (v), .did = (d), .svid = (sv), .sdid = (sd), .mach_type = (mt)} +#define COMPEX_BOARD(d, mt) \ + MYLO_BOARD(VENID_COMPEX, (d), VENID_COMPEX, (d), (mt)) + + COMPEX_BOARD(DEVID_COMPEX_NP27G, MACH_ADM5120_NP27G), + COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G), + COMPEX_BOARD(DEVID_COMPEX_NP28GHS, MACH_ADM5120_NP28GHS), + COMPEX_BOARD(DEVID_COMPEX_WP54G, MACH_ADM5120_WP54), + COMPEX_BOARD(DEVID_COMPEX_WP54Gv1C, MACH_ADM5120_WP54Gv1C), + COMPEX_BOARD(DEVID_COMPEX_WP54AG, MACH_ADM5120_WP54), + COMPEX_BOARD(DEVID_COMPEX_WPP54G, MACH_ADM5120_WP54), + COMPEX_BOARD(DEVID_COMPEX_WPP54AG, MACH_ADM5120_WP54), +}; + +static unsigned long __init detect_machtype_myloader(void) +{ + unsigned long ret; + int i; + + ret = MACH_ADM5120_GENERIC; + for (i = 0; i < ARRAY_SIZE(mylo_boards); i++) { + if (mylo_boards[i].vid == myloader_info.vid && + mylo_boards[i].did == myloader_info.did && + mylo_boards[i].svid == myloader_info.svid && + mylo_boards[i].sdid == myloader_info.sdid) { + ret = mylo_boards[i].mach_type; + break; + } + } + + return ret; +} + +static void __init prom_detect_machtype(void) +{ + if (bootbase_present()) { + adm5120_prom_type = ADM5120_PROM_BOOTBASE; + mips_machtype = detect_machtype_bootbase(); + return; + } + + if (cfe_present()) { + adm5120_prom_type = ADM5120_PROM_CFE; + mips_machtype = detect_machtype_cfe(); + return; + } + + if (myloader_present()) { + adm5120_prom_type = ADM5120_PROM_MYLOADER; + mips_machtype = detect_machtype_myloader(); + return; + } + + if (routerboot_present()) { + adm5120_prom_type = ADM5120_PROM_ROUTERBOOT; + mips_machtype = detect_machtype_routerboot(); + return; + } + + if (generic_prom_present()) { + adm5120_prom_type = ADM5120_PROM_GENERIC; + mips_machtype = detect_machtype_generic(); + return; + } + + mips_machtype = MACH_ADM5120_GENERIC; +} + +#ifdef CONFIG_IMAGE_CMDLINE_HACK +extern char __image_cmdline[]; + +static void __init prom_init_cmdline(void) +{ + char *cmd; + + /* init command line, register a default kernel command line */ + cmd = __image_cmdline; + if (strlen(cmd) > 0) + strlcpy(arcs_cmdline, cmd, sizeof(arcs_cmdline)); + +} +#else +static inline void prom_init_cmdline(void) {} +#endif /* CONFIG_IMAGE_CMDLINE_HACK */ + +void __init prom_init(void) +{ + prom_detect_machtype(); + prom_init_cmdline(); +} + +void __init prom_free_prom_memory(void) +{ + /* We do not have to prom memory to free */ +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c new file mode 100644 index 000000000..c0410afdf --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c @@ -0,0 +1,129 @@ +/* + * ADM5120 specific setup + * + * Copyright (C) 2007-2009 Gabor Juhos + * + * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel + * done by Jeroen Vreeken + * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org) + * + * Jeroen's code was based on the Linux 2.4.xx source codes found in various + * tarballs released by Edimax for it's ADM5120 based devices + * Copyright (C) ADMtek Incorporated + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define ADM5120_SYS_TYPE_LEN 64 + +unsigned char adm5120_sys_type[ADM5120_SYS_TYPE_LEN]; +void (*adm5120_board_reset)(void); + +static char *prom_names[ADM5120_PROM_LAST+1] __initdata = { + [ADM5120_PROM_GENERIC] = "Generic", + [ADM5120_PROM_CFE] = "CFE", + [ADM5120_PROM_UBOOT] = "U-Boot", + [ADM5120_PROM_MYLOADER] = "MyLoader", + [ADM5120_PROM_ROUTERBOOT] = "RouterBOOT", + [ADM5120_PROM_BOOTBASE] = "Bootbase" +}; + +static void __init adm5120_report(void) +{ + printk(KERN_INFO "SoC : %s\n", adm5120_sys_type); + printk(KERN_INFO "Bootdev : %s flash\n", + adm5120_nand_boot ? "NAND" : "NOR"); + printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]); +} + +const char *get_system_type(void) +{ + return adm5120_sys_type; +} + +static void adm5120_restart(char *command) +{ + /* TODO: stop switch before reset */ + + if (adm5120_board_reset) + adm5120_board_reset(); + + SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1); +} + +static void adm5120_halt(void) +{ + local_irq_disable(); + + while (1) { + if (cpu_wait) + cpu_wait(); + } +} + +void __init plat_time_init(void) +{ + mips_hpt_frequency = adm5120_speed / 2; +} + +void __init plat_mem_setup(void) +{ + adm5120_soc_init(); + adm5120_mem_init(); + + sprintf(adm5120_sys_type, "ADM%04X%s rev %u, running at %lu.%03lu MHz", + adm5120_product_code, + adm5120_package_bga() ? "" : "P", + adm5120_revision, + (adm5120_speed / 1000000), (adm5120_speed / 1000) % 1000); + + adm5120_report(); + + _machine_restart = adm5120_restart; + _machine_halt = adm5120_halt; + pm_power_off = adm5120_halt; + + set_io_port_base(KSEG1); +} + +static int __init adm5120_board_setup(void) +{ + adm5120_gpio_init(); + + mips_machine_setup(); + + return 0; +} +arch_initcall(adm5120_board_setup); + +static void __init adm5120_generic_board_setup(void) +{ + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_add_device_flash(0); + adm5120_add_device_switch(6, NULL); +} + +MIPS_MACHINE(MACH_ADM5120_GENERIC, "Generic", "Generic ADM5120 board", + adm5120_generic_board_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile new file mode 100644 index 000000000..8c66c171e --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile @@ -0,0 +1,5 @@ +obj-y += compex.o + +obj-$(CONFIG_ADM5120_MACH_NP27G) += np27g.o +obj-$(CONFIG_ADM5120_MACH_NP28G) += np28g.o +obj-$(CONFIG_ADM5120_MACH_WP54) += wp54.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c new file mode 100644 index 000000000..814acfb0c --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c @@ -0,0 +1,60 @@ +/* + * Compex boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "compex.h" + +#include + +static void switch_bank_gpio5(unsigned bank) +{ + switch (bank) { + case 0: + gpio_set_value(ADM5120_GPIO_PIN5, 0); + break; + case 1: + gpio_set_value(ADM5120_GPIO_PIN5, 1); + break; + } +} + +void __init compex_mac_setup(void) +{ + if (myloader_present()) { + int i; + + for (i = 0; i < 6; i++) { + if (is_valid_ether_addr(myloader_info.macs[i])) + memcpy(adm5120_eth_macs[i], + myloader_info.macs[i], ETH_ALEN); + else + random_ether_addr(adm5120_eth_macs[i]); + } + } else { + u8 mac[ETH_ALEN]; + + random_ether_addr(mac); + adm5120_setup_eth_macs(mac); + } +} + +void __init compex_generic_setup(void) +{ + gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */ + gpio_direction_output(ADM5120_GPIO_PIN5, 0); + + adm5120_flash0_data.switch_bank = switch_bank_gpio5; + adm5120_add_device_flash(0); + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + compex_mac_setup(); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h new file mode 100644 index 000000000..124e67697 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h @@ -0,0 +1,23 @@ +/* + * Compex boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + +extern void compex_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c new file mode 100644 index 000000000..82da46d1c --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c @@ -0,0 +1,28 @@ +/* + * Compex NP27G board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "compex.h" + +static u8 np27g_vlans[6] __initdata = { + /* FIXME: untested */ + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + +static void __init np27g_setup(void) +{ + compex_generic_setup(); + adm5120_add_device_switch(5, np27g_vlans); + adm5120_add_device_usb(); + + /* TODO: add PCI IRQ map */ +} + +MIPS_MACHINE(MACH_ADM5120_NP27G, "NP27G", "Compex NetPassage 27G", np27g_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c new file mode 100644 index 000000000..a54143999 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c @@ -0,0 +1,63 @@ +/* + * Compex NP28G board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "compex.h" + +static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), + PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0), + PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1), + PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2) +}; + +static struct gpio_led np28g_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN3, "power", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN6, "wan_cond", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN7, "wifi", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L2, "usb1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L2, "usb2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L2, "usb3", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L2, "usb4", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), +}; + +static u8 np28g_vlans[6] __initdata = { + 0x50, 0x42, 0x44, 0x48, 0x00, 0x00 +}; + +static void np28g_reset(void) +{ + gpio_set_value(ADM5120_GPIO_PIN4, 0); +} + +static void __init np28g_setup(void) +{ + compex_generic_setup(); + + /* setup reset line */ + gpio_request(ADM5120_GPIO_PIN4, NULL); + gpio_direction_output(ADM5120_GPIO_PIN4, 1); + adm5120_board_reset = np28g_reset; + + adm5120_add_device_switch(4, np28g_vlans); + adm5120_add_device_usb(); + + adm5120_add_device_gpio_leds(ARRAY_SIZE(np28g_gpio_leds), + np28g_gpio_leds); + + adm5120_pci_set_irq_map(ARRAY_SIZE(np28g_pci_irqs), np28g_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_NP28G, "NP28G", "Compex NetPassage 28G", np28g_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c new file mode 100644 index 000000000..8aa35c555 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c @@ -0,0 +1,95 @@ +/* + * Compex WP54 board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "compex.h" + +#define WP54_KEYS_POLL_INTERVAL 20 +#define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL) + +static struct mtd_partition wp54g_wrt_partitions[] = { + { + .name = "cfe", + .offset = 0, + .size = 0x050000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "trx", + .offset = MTDPART_OFS_APPEND, + .size = 0x3A0000, + } , { + .name = "nvram", + .offset = MTDPART_OFS_APPEND, + .size = 0x010000, + } +}; + +static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), +}; + +static struct gpio_keys_button wp54_gpio_buttons[] __initdata = { + { + .desc = "reset_button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL, + .gpio = ADM5120_GPIO_PIN4, + } +}; + +static struct gpio_led wp54_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN7, "wan", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL), +}; + +static u8 wp54_vlans[6] __initdata = { + 0x41, 0x42, 0x00, 0x00, 0x00, 0x00 +}; + +static void wp54_reset(void) +{ + gpio_set_value(ADM5120_GPIO_PIN3, 0); +} + +static void __init wp54_setup(void) +{ + compex_generic_setup(); + + /* setup reset line */ + gpio_request(ADM5120_GPIO_PIN3, NULL); + gpio_direction_output(ADM5120_GPIO_PIN3, 1); + adm5120_board_reset = wp54_reset; + + adm5120_add_device_switch(2, wp54_vlans); + adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wp54_gpio_buttons), + wp54_gpio_buttons); + adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds), + wp54_gpio_leds); + + adm5120_pci_set_irq_map(ARRAY_SIZE(wp54_pci_irqs), wp54_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_WP54, "WP54", "Compex WP54 family", wp54_setup); + +static void __init wp54_wrt_setup(void) +{ + adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions); + adm5120_flash0_data.parts = wp54g_wrt_partitions; + + wp54_setup(); +} + +MIPS_MACHINE(MACH_ADM5120_WP54G_WRT, "WP54G-WRT", "Compex WP54G-WRT", + wp54_wrt_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile new file mode 100644 index 000000000..1286ed4c1 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile @@ -0,0 +1,5 @@ +obj-y := br-61xx.o + +obj-$(CONFIG_ADM5120_MACH_BR_6104K) += br-6104k.o +obj-$(CONFIG_ADM5120_MACH_BR_6104KP) += br-6104kp.o +obj-$(CONFIG_ADM5120_MACH_BR_61X4WG) += br-61x4wg.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c new file mode 100644 index 000000000..8b2b44550 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c @@ -0,0 +1,36 @@ +/* + * Edimax BR-6104K board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "br-61xx.h" + +static struct gpio_led br6104k_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), +}; + +static void __init br6104k_setup(void) +{ + br61xx_generic_setup(); + adm5120_add_device_gpio_leds(ARRAY_SIZE(br6104k_gpio_leds), + br6104k_gpio_leds); +} + +MIPS_MACHINE(MACH_ADM5120_BR6104K, "BR-6104K", "Edimax BR-6104K", + br6104k_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c new file mode 100644 index 000000000..034575d6b --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c @@ -0,0 +1,39 @@ +/* + * Edimax BR-6104KP board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "br-61xx.h" + +static struct gpio_led br6104kp_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN3, "usb1", NULL), + GPIO_LED_INV(ADM5120_GPIO_PIN1, "usb2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), +}; + +static void __init br6104kp_setup(void) +{ + br61xx_generic_setup(); + adm5120_add_device_gpio_leds(ARRAY_SIZE(br6104kp_gpio_leds), + br6104kp_gpio_leds); + adm5120_add_device_usb(); +} + +MIPS_MACHINE(MACH_ADM5120_BR6104KP, "BR-6104KP", "Edimax BR-6104KP", + br6104kp_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c new file mode 100644 index 000000000..5d5750710 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c @@ -0,0 +1,43 @@ +/* + * Edimax BR-6104Wg/6114WG board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "br-61xx.h" + +static struct adm5120_pci_irq br61x4wg_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), +}; + +static struct gpio_led br61x4wg_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL), + GPIO_LED_STD(ADM5120_GPIO_PIN5, "wlan", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), +}; + +static void __init br61x4wg_setup(void) +{ + br61xx_generic_setup(); + adm5120_add_device_gpio_leds(ARRAY_SIZE(br61x4wg_gpio_leds), + br61x4wg_gpio_leds); + adm5120_pci_set_irq_map(ARRAY_SIZE(br61x4wg_pci_irqs), + br61x4wg_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_BR61X4WG, "BR-6104WG", "Edimax BR-6104WG/6114WG", + br61x4wg_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c new file mode 100644 index 000000000..62a1cee38 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c @@ -0,0 +1,84 @@ +/* + * Edimax BR-61xx support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "br-61xx.h" + +#include + +#define BR61XX_CONFIG_OFFSET 0x8000 +#define BR61XX_CONFIG_SIZE 0x1000 + +#define BR61XX_KEYS_POLL_INTERVAL 20 +#define BR61XX_KEYS_DEBOUNCE_INTERVAL (3 * BR61XX_KEYS_POLL_INTERVAL) + +static struct mtd_partition br61xx_partitions[] = { + { + .name = "admboot", + .offset = 0, + .size = 32*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "config", + .offset = MTDPART_OFS_APPEND, + .size = 32*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct gpio_keys_button br61xx_gpio_buttons[] __initdata = { + { + .desc = "reset_button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = BR61XX_KEYS_DEBOUNCE_INTERVAL, + .gpio = ADM5120_GPIO_PIN2, + } +}; + +static u8 br61xx_vlans[6] __initdata = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + +static void __init br61xx_mac_setup(void) +{ + u8 mac_base[6]; + int err; + + err = admboot_get_mac_base(BR61XX_CONFIG_OFFSET, + BR61XX_CONFIG_SIZE, mac_base); + + if ((err) || !is_valid_ether_addr(mac_base)) + random_ether_addr(mac_base); + + adm5120_setup_eth_macs(mac_base); +} + +void __init br61xx_generic_setup(void) +{ + + adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions); + adm5120_flash0_data.parts = br61xx_partitions; + adm5120_add_device_flash(0); + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_add_device_switch(5, br61xx_vlans); + + adm5120_register_gpio_buttons(-1, BR61XX_KEYS_POLL_INTERVAL, + ARRAY_SIZE(br61xx_gpio_buttons), + br61xx_gpio_buttons); + + br61xx_mac_setup(); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h new file mode 100644 index 000000000..c4a9eced5 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h @@ -0,0 +1,23 @@ +/* + * Edimax BR-61xx board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + +extern void __init br61xx_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile new file mode 100644 index 000000000..0c032e3a5 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ADM5120_MACH_EB_214A) += eb-214a.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c new file mode 100644 index 000000000..cf491a1ef --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c @@ -0,0 +1,120 @@ +/* + * EB-214A board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * Copyright (C) 2010 Cezary Jackiewicz + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +#define EB214A_CONFIG_OFFSET 0x4000 + +#define EB214A_KEYS_POLL_INTERVAL 20 +#define EB214A_KEYS_DEBOUNCE_INTERVAL (3 * EB214A_KEYS_POLL_INTERVAL) + +static struct mtd_partition eb214a_partitions[] = { + { + .name = "bootloader", + .offset = 0, + .size = 32*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "config", + .offset = MTDPART_OFS_APPEND, + .size = 32*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct adm5120_pci_irq eb214a_pci_irqs[] __initdata = { + PCIIRQ(4, 0, 1, ADM5120_IRQ_PCI0), + PCIIRQ(4, 1, 2, ADM5120_IRQ_PCI0), + PCIIRQ(4, 2, 3, ADM5120_IRQ_PCI0), +}; + +static struct gpio_led eb214a_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN7, "power", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "usb1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "usb2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L2, "usb3", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "usb4", NULL), +}; + +static struct gpio_keys_button eb214a_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = EB214A_KEYS_DEBOUNCE_INTERVAL, + .gpio = ADM5120_GPIO_PIN1, + } +}; + +static u8 eb214a_vlans[6] __initdata = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + +static void __init eb214a_mac_setup(void) +{ + u8 mac_base[6]; + u8 *cfg; + int i; + + cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + EB214A_CONFIG_OFFSET); + for (i = 0; i < 6; i++) + mac_base[i] = cfg[i]; + + if (!is_valid_ether_addr(mac_base)) + random_ether_addr(mac_base); + + adm5120_setup_eth_macs(mac_base); +} + +static void __init eb214a_setup(void) +{ + adm5120_flash0_data.nr_parts = ARRAY_SIZE(eb214a_partitions); + adm5120_flash0_data.parts = eb214a_partitions; + adm5120_add_device_flash(0); + + adm5120_add_device_uart(0); + /* adm5120_add_device_uart(1); */ + + adm5120_add_device_switch(5, eb214a_vlans); + + eb214a_mac_setup(); + + adm5120_register_gpio_buttons(-1, EB214A_KEYS_POLL_INTERVAL, + ARRAY_SIZE(eb214a_gpio_buttons), + eb214a_gpio_buttons); + + adm5120_add_device_gpio_leds(ARRAY_SIZE(eb214a_gpio_leds), + eb214a_gpio_leds); + + adm5120_pci_set_irq_map(ARRAY_SIZE(eb214a_pci_irqs), + eb214a_pci_irqs); + /* adm5120_add_device_usb(); */ +} + +MIPS_MACHINE(MACH_ADM5120_EB_214A, "EB-214A", "Generic EB-214A", eb214a_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile new file mode 100644 index 000000000..49453cba9 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile @@ -0,0 +1,6 @@ +obj-y += infineon.o + +obj-$(CONFIG_ADM5120_MACH_EASY5120_RT) += easy5120-rt.o +obj-$(CONFIG_ADM5120_MACH_EASY5120_WVOIP) += easy5120-wvoip.o +obj-$(CONFIG_ADM5120_MACH_EASY5120P_ATA) += easy5120p-ata.o +obj-$(CONFIG_ADM5120_MACH_EASY83000) += easy83000.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c new file mode 100644 index 000000000..31eaee772 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c @@ -0,0 +1,48 @@ +/* + * Infineon EASY 5120-RT Reference Board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "infineon.h" + +static struct gpio_led easy5120_rt_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN6, "user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan0_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan0_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), +}; + +static struct adm5120_pci_irq easy5120_rt_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), +}; + +static u8 easy5120_rt_vlans[6] __initdata = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + +static void __init easy5120_rt_setup(void) +{ + easy_setup_bga(); + + adm5120_add_device_switch(5, easy5120_rt_vlans); + adm5120_add_device_usb(); + adm5120_add_device_gpio_leds(ARRAY_SIZE(easy5120_rt_gpio_leds), + easy5120_rt_gpio_leds); + adm5120_pci_set_irq_map(ARRAY_SIZE(easy5120_rt_pci_irqs), + easy5120_rt_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_EASY5120RT, "EASY5120-RT", + "Infineon EASY 5120-RT Reference Board", easy5120_rt_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c new file mode 100644 index 000000000..0bf404cc2 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c @@ -0,0 +1,24 @@ +/* + * Infineon EASY 5120-WVoIP Reference Board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "infineon.h" + +static void __init easy5120wvoip_setup(void) +{ + easy_setup_bga(); + adm5120_add_device_switch(6, NULL); + + /* TODO: add VINETIC2 device */ + /* TODO: setup PCI IRQ map */ +} + +MIPS_MACHINE(MACH_ADM5120_EASY5120WVOIP, "EASY5120WVoIP", + "Infineon EASY 5120-WVoIP Reference Board", easy5120wvoip_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c new file mode 100644 index 000000000..fafe0238b --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c @@ -0,0 +1,22 @@ +/* + * Infineon EASY 5120P-ATA Reference Board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "infineon.h" + +static void __init easy5120pata_setup(void) +{ + easy_setup_pqfp(); + + adm5120_add_device_switch(6, NULL); +} + +MIPS_MACHINE(MACH_ADM5120_EASY5120PATA, "EASY5120P-ATA", + "Infineon EASY 5120P-ATA Reference Board", easy5120pata_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c new file mode 100644 index 000000000..051b85274 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c @@ -0,0 +1,23 @@ +/* + * Infineon EASY 83000 Reference Board support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "infineon.h" + +static void __init easy83000_setup(void) +{ + easy_setup_pqfp(); + adm5120_add_device_switch(6, NULL); + + /* TODO: add VINAX device */ +} + +MIPS_MACHINE(MACH_ADM5120_EASY83000, "EASY8300", + "Infineon EASY 83000 Reference Board", easy83000_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c new file mode 100644 index 000000000..5c441da90 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c @@ -0,0 +1,108 @@ +/* + * Infineon Reference Boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "infineon.h" + +#include + +#define EASY_CONFIG_OFFSET 0x10000 +#define EASY_CONFIG_SIZE 0x1000 + +static struct mtd_partition easy_partitions[] = { + { + .name = "admboot", + .offset = 0, + .size = 64*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "boardcfg", + .offset = MTDPART_OFS_APPEND, + .size = 64*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static __init void easy_setup_mac(void) +{ + u8 mac_base[6]; + int err; + + err = admboot_get_mac_base(EASY_CONFIG_OFFSET, + EASY_CONFIG_SIZE, mac_base); + + if ((err) || !is_valid_ether_addr(mac_base)) + random_ether_addr(mac_base); + + adm5120_setup_eth_macs(mac_base); +} + +static void switch_bank_gpio3(unsigned bank) +{ + switch (bank) { + case 0: + gpio_set_value(ADM5120_GPIO_PIN3, 0); + break; + case 1: + gpio_set_value(ADM5120_GPIO_PIN3, 1); + break; + } +} + +void __init easy_setup_pqfp(void) +{ + /* setup flash A20 line */ + gpio_request(ADM5120_GPIO_PIN3, NULL); + gpio_direction_output(ADM5120_GPIO_PIN3, 0); + adm5120_flash0_data.switch_bank = switch_bank_gpio3; + + adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions); + adm5120_flash0_data.parts = easy_partitions; + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_add_device_flash(0); + + easy_setup_mac(); +} + +static void switch_bank_gpio5(unsigned bank) +{ + switch (bank) { + case 0: + gpio_set_value(ADM5120_GPIO_PIN5, 0); + break; + case 1: + gpio_set_value(ADM5120_GPIO_PIN5, 1); + break; + } +} + +void __init easy_setup_bga(void) +{ + /* setup flash A20 line */ + gpio_request(ADM5120_GPIO_PIN5, NULL); + gpio_direction_output(ADM5120_GPIO_PIN5, 0); + adm5120_flash0_data.switch_bank = switch_bank_gpio5; + + adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions); + adm5120_flash0_data.parts = easy_partitions; + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_add_device_flash(0); + + easy_setup_mac(); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h new file mode 100644 index 000000000..a5f28b4fe --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h @@ -0,0 +1,25 @@ +/* + * Infineon Reference Boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +extern void easy_setup_pqfp(void) __init; +extern void easy_setup_bga(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile new file mode 100644 index 000000000..34ea0a3d8 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile @@ -0,0 +1,8 @@ +obj-y += rb-1xx.o + +obj-${CONFIG_ADM5120_MACH_RB_11X} += rb-11x.o +obj-${CONFIG_ADM5120_MACH_RB_133} += rb-133.o +obj-${CONFIG_ADM5120_MACH_RB_133C} += rb-133c.o +obj-${CONFIG_ADM5120_MACH_RB_150} += rb-150.o +obj-${CONFIG_ADM5120_MACH_RB_153} += rb-153.o +obj-${CONFIG_ADM5120_MACH_RB_192} += rb-192.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c new file mode 100644 index 000000000..fd768d8ef --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c @@ -0,0 +1,35 @@ +/* + * Mikrotik RouterBOARD 111/112 support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +static struct gpio_led rb11x_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN3, "user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan_lnkact", NULL), +}; + +static u8 rb11x_vlans[6] __initdata = { + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init rb11x_setup(void) +{ + rb1xx_generic_setup(); + rb1xx_add_device_nand(); + + adm5120_add_device_switch(1, rb11x_vlans); + adm5120_add_device_gpio_leds(ARRAY_SIZE(rb11x_gpio_leds), + rb11x_gpio_leds); +} + +MIPS_MACHINE(MACH_ADM5120_RB_11X, "11x", "Mikrotik RouterBOARD 111/112", + rb11x_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c new file mode 100644 index 000000000..23c57820c --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c @@ -0,0 +1,40 @@ +/* + * Mikrotik RouterBOARD 133 support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +static struct gpio_led rb133_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN6, "power", NULL), + GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan1_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan1_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan2_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan3_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan3_lnkact", NULL), +}; + +static u8 rb133_vlans[6] __initdata = { + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init rb133_setup(void) +{ + rb1xx_generic_setup(); + rb1xx_add_device_nand(); + + adm5120_add_device_switch(3, rb133_vlans); + adm5120_add_device_gpio_leds(ARRAY_SIZE(rb133_gpio_leds), + rb133_gpio_leds); +} + +MIPS_MACHINE(MACH_ADM5120_RB_133, "133", "Mikrotik RouterBOARD 133", + rb133_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c new file mode 100644 index 000000000..25bab70c0 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c @@ -0,0 +1,36 @@ +/* + * Mikrotik RouterBOARD 133C support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +static struct gpio_led rb133c_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN6, "power", NULL), + GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan1_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan1_lnkact", NULL), +}; + +static u8 rb133c_vlans[6] __initdata = { + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init rb133c_setup(void) +{ + rb1xx_generic_setup(); + rb1xx_add_device_nand(); + + adm5120_add_device_switch(1, rb133c_vlans); + adm5120_add_device_gpio_leds(ARRAY_SIZE(rb133c_gpio_leds), + rb133c_gpio_leds); +} + +MIPS_MACHINE(MACH_ADM5120_RB_133C, "133C", "Mikrotik RouterBOARD 133C", + rb133c_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c new file mode 100644 index 000000000..96a8c1b87 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c @@ -0,0 +1,131 @@ +/* + * Mikrotik RouterBOARD 150 support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +#define RB150_NAND_BASE 0x1FC80000 +#define RB150_NAND_SIZE 1 + +#define RB150_GPIO_NAND_READY ADM5120_GPIO_PIN0 +#define RB150_GPIO_NAND_NCE ADM5120_GPIO_PIN1 +#define RB150_GPIO_NAND_CLE ADM5120_GPIO_P2L2 +#define RB150_GPIO_NAND_ALE ADM5120_GPIO_P3L2 +#define RB150_GPIO_RESET_BUTTON ADM5120_GPIO_PIN1 /* FIXME */ + +#define RB150_NAND_DELAY 100 + +#define RB150_NAND_WRITE(v) \ + writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE)) + +static struct resource rb150_nand_resources[] __initdata = { + [0] = { + .start = RB150_NAND_BASE, + .end = RB150_NAND_BASE + RB150_NAND_SIZE-1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct gpio_led rb150_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_P0L2, "user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan1_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan5_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan5_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan4_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan4_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_led2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan2_led1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan2_led2", NULL), +}; + +static u8 rb150_vlans[6] __initdata = { + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static int rb150_nand_dev_ready(struct mtd_info *mtd) +{ + return gpio_get_value(RB150_GPIO_NAND_READY); +} + +static void rb150_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, + unsigned int ctrl) +{ + if (ctrl & NAND_CTRL_CHANGE) { + gpio_set_value(RB150_GPIO_NAND_CLE, (ctrl & NAND_CLE) ? 1 : 0); + gpio_set_value(RB150_GPIO_NAND_ALE, (ctrl & NAND_ALE) ? 1 : 0); + gpio_set_value(RB150_GPIO_NAND_NCE, (ctrl & NAND_NCE) ? 0 : 1); + } + + udelay(RB150_NAND_DELAY); + + if (cmd != NAND_CMD_NONE) + RB150_NAND_WRITE(cmd); +} + +static void __init rb150_add_device_nand(void) +{ + struct platform_device *pdev; + int err; + + /* setup GPIO pins for NAND flash chip */ + gpio_request(RB150_GPIO_NAND_READY, "nand-ready"); + gpio_direction_input(RB150_GPIO_NAND_READY); + gpio_request(RB150_GPIO_NAND_NCE, "nand-nce"); + gpio_direction_output(RB150_GPIO_NAND_NCE, 1); + gpio_request(RB150_GPIO_NAND_CLE, "nand-cle"); + gpio_direction_output(RB150_GPIO_NAND_CLE, 0); + gpio_request(RB150_GPIO_NAND_ALE, "nand-ale"); + gpio_direction_output(RB150_GPIO_NAND_ALE, 0); + + pdev = platform_device_alloc("gen_nand", -1); + if (!pdev) + goto err_out; + + err = platform_device_add_resources(pdev, rb150_nand_resources, + ARRAY_SIZE(rb150_nand_resources)); + if (err) + goto err_put; + + + rb1xx_nand_data.ctrl.cmd_ctrl = rb150_nand_cmd_ctrl; + rb1xx_nand_data.ctrl.dev_ready = rb150_nand_dev_ready; + + err = platform_device_add_data(pdev, &rb1xx_nand_data, + sizeof(rb1xx_nand_data)); + if (err) + goto err_put; + + err = platform_device_add(pdev); + if (err) + goto err_put; + + return; + +err_put: + platform_device_put(pdev); +err_out: + return; +} + +static void __init rb150_setup(void) +{ + rb1xx_gpio_buttons[0].gpio = RB150_GPIO_RESET_BUTTON; + rb1xx_generic_setup(); + rb150_add_device_nand(); + + adm5120_add_device_gpio_leds(ARRAY_SIZE(rb150_gpio_leds), + rb150_gpio_leds); + adm5120_add_device_switch(5, rb150_vlans); +} + +MIPS_MACHINE(MACH_ADM5120_RB_150, "miniROUTER", "Mikrotik RouterBOARD 150", + rb150_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c new file mode 100644 index 000000000..845668495 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c @@ -0,0 +1,70 @@ +/* + * Mikrotik RouterBOARD 153 support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +static struct resource rb153_cf_resources[] __initdata = { + { + .name = "cf_membase", + .start = ADM5120_EXTIO1_BASE, + .end = ADM5120_EXTIO1_BASE + ADM5120_EXTIO1_SIZE-1 , + .flags = IORESOURCE_MEM + }, { + .name = "cf_irq", + .start = ADM5120_IRQ_GPIO4, + .end = ADM5120_IRQ_GPIO4, + .flags = IORESOURCE_IRQ + } +}; + +static struct gpio_led rb153_gpio_leds[] __initdata = { + GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan1_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan5_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan5_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan4_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan4_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan2_speed", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan2_lnkact", NULL), +}; + +static u8 rb153_vlans[6] __initdata = { + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init rb153_add_device_cf(void) +{ + /* enable CSX1:INTX1 on GPIO[3:4] for the CF slot */ + adm5120_gpio_csx1_enable(); + + /* enable the wait state pin GPIO[0] for external I/O control */ + adm5120_gpio_ew_enable(); + + platform_device_register_simple("pata-rb153-cf", -1, + rb153_cf_resources, ARRAY_SIZE(rb153_cf_resources)); +} + +static void __init rb153_setup(void) +{ + rb1xx_generic_setup(); + rb1xx_add_device_nand(); + rb153_add_device_cf(); + + adm5120_add_device_gpio_leds(ARRAY_SIZE(rb153_gpio_leds), + rb153_gpio_leds); + adm5120_add_device_switch(5, rb153_vlans); +} + +MIPS_MACHINE(MACH_ADM5120_RB_153, "150", "Mikrotik RouterBOARD 153", + rb153_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c new file mode 100644 index 000000000..904942139 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c @@ -0,0 +1,27 @@ +/* + * Mikrotik RouterBOARD 192 support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +static u8 rb192_vlans[6] __initdata = { + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init rb192_setup(void) +{ + rb1xx_generic_setup(); + rb1xx_add_device_nand(); + + adm5120_add_device_switch(6, rb192_vlans); +} + +MIPS_MACHINE(MACH_ADM5120_RB_192, "192", "Mikrotik RouterBOARD 192", + rb192_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c new file mode 100644 index 000000000..8961115c7 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c @@ -0,0 +1,149 @@ +/* + * Mikrotik RouterBOARD 1xx series support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * NAND initialization code was based on a driver for Linux 2.6.19+ which + * was derived from the driver for Linux 2.4.xx published by Mikrotik for + * their RouterBoard 1xx and 5xx series boards. + * Copyright (C) 2007 David Goodenough + * Copyright (C) 2007 Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "rb-1xx.h" + +#define RB1XX_NAND_CHIP_DELAY 25 + +#define RB1XX_KEYS_POLL_INTERVAL 20 +#define RB1XX_KEYS_DEBOUNCE_INTERVAL (3 * RB1XX_KEYS_POLL_INTERVAL) + +static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = { + PCIIRQ(1, 0, 1, ADM5120_IRQ_PCI0), + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI1), + PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2) +}; + +static struct mtd_partition rb1xx_nor_parts[] = { + { + .name = "booter", + .offset = 0, + .size = 64*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct mtd_partition rb1xx_nand_parts[] = { + { + .name = "kernel", + .offset = 0, + .size = 4 * 1024 * 1024, + } , { + .name = "rootfs", + .offset = MTDPART_OFS_NXTBLK, + .size = MTDPART_SIZ_FULL + } +}; + +/* + * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader + * will not be able to find the kernel that we load. So set the oobinfo + * when creating the partitions + */ +static struct nand_ecclayout rb1xx_nand_ecclayout = { + .eccbytes = 6, + .eccpos = { 8, 9, 10, 13, 14, 15 }, + .oobavail = 9, + .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } +}; + +/*--------------------------------------------------------------------------*/ + +static int rb1xx_nand_fixup(struct mtd_info *mtd) +{ + struct nand_chip *chip = mtd->priv; + + if (mtd->writesize == 512) + chip->ecc.layout = &rb1xx_nand_ecclayout; + + return 0; +} + +struct platform_nand_data rb1xx_nand_data __initdata = { + .chip = { + .nr_chips = 1, + .nr_partitions = ARRAY_SIZE(rb1xx_nand_parts), + .partitions = rb1xx_nand_parts, + .chip_delay = RB1XX_NAND_CHIP_DELAY, + .chip_fixup = rb1xx_nand_fixup, + }, +}; + +struct gpio_keys_button rb1xx_gpio_buttons[] __initdata = { + { + .desc = "reset_button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = RB1XX_KEYS_DEBOUNCE_INTERVAL, + .gpio = ADM5120_GPIO_PIN7, + } +}; + +static void __init rb1xx_mac_setup(void) +{ + if (rb_hs.mac_base != NULL && is_valid_ether_addr(rb_hs.mac_base)) { + adm5120_setup_eth_macs(rb_hs.mac_base); + } else { + u8 mac[ETH_ALEN]; + + random_ether_addr(mac); + adm5120_setup_eth_macs(mac); + } +} + +void __init rb1xx_add_device_flash(void) +{ + /* setup data for flash0 device */ + adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts); + adm5120_flash0_data.parts = rb1xx_nor_parts; + adm5120_flash0_data.window_size = 128*1024; + + adm5120_add_device_flash(0); +} + +void __init rb1xx_add_device_nand(void) +{ + /* enable NAND flash interface */ + adm5120_nand_enable(); + + /* initialize NAND chip */ + adm5120_nand_set_spn(1); + adm5120_nand_set_wpn(0); + + adm5120_add_device_nand(&rb1xx_nand_data); +} + +void __init rb1xx_generic_setup(void) +{ + if (adm5120_package_bga()) + adm5120_pci_set_irq_map(ARRAY_SIZE(rb1xx_pci_irqs), + rb1xx_pci_irqs); + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_register_gpio_buttons(-1, RB1XX_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rb1xx_gpio_buttons), + rb1xx_gpio_buttons); + + rb1xx_add_device_flash(); + rb1xx_mac_setup(); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h new file mode 100644 index 000000000..05e68bd0a --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h @@ -0,0 +1,33 @@ +/* + * Mikrotik RouterBOARD 1xx series support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +extern struct platform_nand_data rb1xx_nand_data __initdata; +extern struct gpio_keys_button rb1xx_gpio_buttons[] __initdata; + +extern void rb1xx_add_device_flash(void) __init; +extern void rb1xx_add_device_nand(void) __init; +extern void rb1xx_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile new file mode 100644 index 000000000..239d5a088 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ADM5120_MACH_PMUGW) += pmugw.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c new file mode 100644 index 000000000..369892fd1 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c @@ -0,0 +1,96 @@ +/* + * Motorola Powerline MU Gateway board + * + * Copyright (C) 2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#define PMUGW_CONFIG_OFFSET 0x10000 +#define PMUGW_CONFIG_SIZE 0x1000 + +static struct mtd_partition pmugw_partitions[] = { + { + .name = "admboot", + .offset = 0, + .size = 64*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "boardcfg", + .offset = MTDPART_OFS_APPEND, + .size = 64*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static u8 pmugw_vlans[6] __initdata = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + +static __init void pmugw_setup_mac(void) +{ + u8 mac_base[6]; + int err; + + err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET, + PMUGW_CONFIG_SIZE, mac_base); + + if ((err) || !is_valid_ether_addr(mac_base)) + random_ether_addr(mac_base); + + adm5120_setup_eth_macs(mac_base); +} + +static void switch_bank_gpio5(unsigned bank) +{ + switch (bank) { + case 0: + gpio_set_value(ADM5120_GPIO_PIN5, 0); + break; + case 1: + gpio_set_value(ADM5120_GPIO_PIN5, 1); + break; + } +} + +void __init pmugw_setup(void) +{ + /* setup flash A20 line */ + gpio_request(ADM5120_GPIO_PIN5, NULL); + gpio_direction_output(ADM5120_GPIO_PIN5, 0); + adm5120_flash0_data.switch_bank = switch_bank_gpio5; + + adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions); + adm5120_flash0_data.parts = pmugw_partitions; + + adm5120_add_device_uart(1); /* ttyAM0 */ + adm5120_add_device_uart(0); /* ttyAM1 */ + + adm5120_add_device_flash(0); + + pmugw_setup_mac(); + adm5120_add_device_switch(5, pmugw_vlans); +} + +MIPS_MACHINE(MACH_ADM5120_PMUGW, "PMUGW", "Motorola Powerline MU Gateway", + pmugw_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c new file mode 100644 index 000000000..a5c2c3653 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c @@ -0,0 +1,71 @@ +/* + * OSBRiDGE 5GXi/5XLi board support + * + * Copyright (C) 2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +static struct mtd_partition osbridge_5gxi_partitions[] = { + { + .name = "bootloader", + .offset = 0, + .size = 64*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "boardcfg", + .offset = 64*1024, + .size = 64*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "5gxi:yellow:lan", NULL), +}; + +static struct adm5120_pci_irq osbridge_5gxi_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), +}; + +static u8 osbridge_5gxi_vlans[6] __initdata = { + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static void __init osbridge_5gxi_setup(void) +{ + adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions); + adm5120_flash0_data.parts = osbridge_5gxi_partitions; + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_add_device_flash(0); + + adm5120_add_device_switch(1, osbridge_5gxi_vlans); + adm5120_add_device_gpio_leds(ARRAY_SIZE(osbridge_5gxi_gpio_leds), + osbridge_5gxi_gpio_leds); + adm5120_pci_set_irq_map(ARRAY_SIZE(osbridge_5gxi_pci_irqs), + osbridge_5gxi_pci_irqs); +} + +MIPS_MACHINE(MACH_ADM5120_5GXI, "5GXi", "OSBRiDGE 5GXi/5XLi board", + osbridge_5gxi_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile new file mode 100644 index 000000000..34946c5e5 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ADM5120_MACH_5GXI) += 5gxi.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile new file mode 100644 index 000000000..650be4077 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for the ADMtek ADM5120 SoC specific parts of the kernel +# + +lib-y += admboot.o +lib-y += bootbase.o +lib-y += cfe.o +lib-y += generic.o +lib-y += myloader.o +lib-y += routerboot.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c new file mode 100644 index 000000000..b655390c1 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c @@ -0,0 +1,55 @@ +/* + * ADMBoot specific prom routines + * + * Copyright (C) 2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include "prom_read.h" + +#define ADMBOOT_MAGIC_MAC_BASE 0x636D676D /* 'mgmc' */ +#define ADMBOOT_MAGIC_MAC_BASE_BR6104XX 0x31305348 /* 'HS01' */ + +int __init admboot_get_mac_base(u32 offset, u32 len, u8 *mac) +{ + u8 *cfg; + int i; + + cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + offset); + for (i = 0; i < len; i += 4) { + u32 magic; + + magic = prom_read_le32(cfg + i); + if (magic == ADMBOOT_MAGIC_MAC_BASE) { + int j; + + for (j = 0; j < 6; j++) + mac[j] = cfg[i + 4 + j]; + + return 0; + } + if (magic == ADMBOOT_MAGIC_MAC_BASE_BR6104XX) { + int j; + + for (j = 0; j < 6; j++) + mac[j] = cfg[i + 7 + j]; + + return 0; + } + } + + return -ENXIO; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c new file mode 100644 index 000000000..063281e3f --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c @@ -0,0 +1,119 @@ +/* + * ZyXEL's Bootbase specific prom routines + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include "prom_read.h" + +#define ZYNOS_INFO_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x3F90) +#define ZYNOS_HDBG_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x4000) +#define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE) +#define BOOTEXT_ADDR_MAX (BOOTEXT_ADDR_MIN + (2*1024*1024)) + +static int bootbase_found; +static struct zynos_board_info *board_info; + +struct bootbase_info bootbase_info; + +static inline int bootbase_dbgarea_present(u8 *data) +{ + u32 t; + + t = prom_read_be32(data+5); + if (t != ZYNOS_MAGIC_DBGAREA1) + return 0; + + t = prom_read_be32(data+9); + if (t != ZYNOS_MAGIC_DBGAREA2) + return 0; + + return 1; +} + +static inline u32 bootbase_get_bootext_addr(void) +{ + return prom_read_be32(&board_info->bootext_addr); +} + +static inline void bootbase_get_mac(u8 *mac) +{ + int i; + + for (i = 0; i < 6; i++) + mac[i] = board_info->mac[i]; +} + +static inline u16 bootbase_get_vendor_id(void) +{ +#define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0) + unsigned char vendor[ZYNOS_NAME_LEN]; + int i; + + for (i = 0; i < ZYNOS_NAME_LEN; i++) + vendor[i] = board_info->vendor[i]; + + if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL) + return ZYNOS_VENDOR_ID_ZYXEL; + + if CHECK_VENDOR(ZYNOS_VENDOR_DLINK) + return ZYNOS_VENDOR_ID_DLINK; + + if CHECK_VENDOR(ZYNOS_VENDOR_LUCENT) + return ZYNOS_VENDOR_ID_LUCENT; + + if CHECK_VENDOR(ZYNOS_VENDOR_NETGEAR) + return ZYNOS_VENDOR_ID_NETGEAR; + + return ZYNOS_VENDOR_ID_OTHER; +} + +static inline u16 bootbase_get_board_id(void) +{ + return prom_read_be16(&board_info->board_id); +} + +int __init bootbase_present(void) +{ + u32 t; + + if (bootbase_found) + goto out; + + /* check presence of the dbgarea */ + if (bootbase_dbgarea_present((u8 *)ZYNOS_HDBG_ADDR) == 0) + goto out; + + board_info = (struct zynos_board_info *)(ZYNOS_INFO_ADDR); + + /* check for a valid BootExt address */ + t = bootbase_get_bootext_addr(); + if ((t < BOOTEXT_ADDR_MIN) || (t > BOOTEXT_ADDR_MAX)) + goto out; + + bootbase_info.vendor_id = bootbase_get_vendor_id(); + bootbase_info.board_id = bootbase_get_board_id(); + bootbase_get_mac(bootbase_info.mac); + + bootbase_found = 1; + +out: + return bootbase_found; +} + diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c new file mode 100644 index 000000000..5a343cd7e --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c @@ -0,0 +1,69 @@ +/* + * Broadcom's CFE specific prom routines + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include + +#include +#include + +#include +#include "prom_read.h" + +/* + * CFE based boards + */ +#define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE +from other bootloaders */ + +static int cfe_found; + +static u32 cfe_handle; +static u32 cfe_entry; +static u32 cfe_seal; + +int __init cfe_present(void) +{ + /* + * This method only works, when we are booted directly from the CFE. + */ + u32 a1 = (u32) fw_arg1; + + if (cfe_found) + return 1; + + cfe_handle = (u32) fw_arg0; + cfe_entry = (u32) fw_arg2; + cfe_seal = (u32) fw_arg3; + + /* Check for CFE by finding the CFE magic number */ + if (cfe_seal != CFE_EPTSEAL) + return 0; + + /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */ + if (a1 != 0) + return 0; + + /* The cfe_handle, and the cfe_entry must be kernel mode addresses */ + if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0)) + return 0; + + cfe_found = 1; + return 1; +} + +char *cfe_getenv(char *envname) +{ + if (cfe_found == 0) + return NULL; + + return NULL; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c new file mode 100644 index 000000000..4d4caa847 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c @@ -0,0 +1,47 @@ +/* + * Generic PROM routines + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include + +#include + +#include + +static int *_prom_argc; +static char **_prom_argv; +static char **_prom_envp; + +char *generic_prom_getenv(char *envname) +{ + char **env; + char *ret; + + ret = NULL; + for (env = _prom_envp; *env != NULL; env++) { + if (strcmp(envname, *env++) == 0) { + ret = *env; + break; + } + } + + return ret; +} + +int generic_prom_present(void) +{ + _prom_argc = (int *)fw_arg0; + _prom_argv = (char **)fw_arg1; + _prom_envp = (char **)fw_arg2; + + return 1; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c new file mode 100644 index 000000000..5357db511 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c @@ -0,0 +1,68 @@ +/* + * Compex's MyLoader specific prom routines + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include "prom_read.h" + +#define SYS_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F000) +#define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800) +#define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000) + +static int myloader_found; + +struct myloader_info myloader_info; + +int __init myloader_present(void) +{ + struct mylo_system_params *sysp; + struct mylo_board_params *boardp; + struct mylo_partition_table *parts; + int i; + + if (myloader_found) + goto out; + + sysp = (struct mylo_system_params *)(SYS_PARAMS_ADDR); + boardp = (struct mylo_board_params *)(BOARD_PARAMS_ADDR); + parts = (struct mylo_partition_table *)(PART_TABLE_ADDR); + + /* Check for some magic numbers */ + if ((le32_to_cpu(sysp->magic) != MYLO_MAGIC_SYS_PARAMS) || + (le32_to_cpu(boardp->magic) != MYLO_MAGIC_BOARD_PARAMS) || + (le32_to_cpu(parts->magic) != MYLO_MAGIC_PARTITIONS)) + goto out; + + myloader_info.vid = le32_to_cpu(sysp->vid); + myloader_info.did = le32_to_cpu(sysp->did); + myloader_info.svid = le32_to_cpu(sysp->svid); + myloader_info.sdid = le32_to_cpu(sysp->sdid); + + for (i = 0; i < MYLO_ETHADDR_COUNT; i++) { + int j; + for (j = 0; j < 6; j++) + myloader_info.macs[i][j] = boardp->addr[i].mac[j]; + } + + myloader_found = 1; + +out: + return myloader_found; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h new file mode 100644 index 000000000..1a6ea110c --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h @@ -0,0 +1,50 @@ +/* + * Generic prom definitions + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _ADM5120_PROM_H_ +#define _ADM5120_PROM_H_ + +/* + * Helper routines + */ +static inline u16 prom_read_le16(void *buf) +{ + u8 *p = buf; + + return ((u16)p[0] + ((u16)p[1] << 8)); +} + +static inline u32 prom_read_le32(void *buf) +{ + u8 *p = buf; + + return ((u32)p[0] + ((u32)p[1] << 8) + ((u32)p[2] << 16) + + ((u32)p[3] << 24)); +} + +static inline u16 prom_read_be16(void *buf) +{ + u8 *p = buf; + + return (((u16)p[0] << 8) + (u16)p[1]); +} + +static inline u32 prom_read_be32(void *buf) +{ + u8 *p = buf; + + return (((u32)p[0] << 24) + ((u32)p[1] << 16) + ((u32)p[2] << 8) + + ((u32)p[3])); +} + +#endif /* _ADM5120_PROM_H_ */ + + diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c new file mode 100644 index 000000000..d9a06d968 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c @@ -0,0 +1,121 @@ +/* + * Mikrotik's RouterBOOT specific prom routines + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "prom_read.h" + +struct rb_hard_settings rb_hs; +static int rb_found; + +static int __init routerboot_load_hs(u8 *buf, u16 buflen) +{ + u16 id, len; + + memset(&rb_hs, 0, sizeof(rb_hs)); + + if (buflen < 4) + return -1; + + if (prom_read_le32(buf) != RB_MAGIC_HARD) + return -1; + + /* skip magic value */ + buf += 4; + buflen -= 4; + + while (buflen > 2) { + id = prom_read_le16(buf); + buf += 2; + buflen -= 2; + if (id == RB_ID_TERMINATOR || buflen < 2) + break; + + len = prom_read_le16(buf); + buf += 2; + buflen -= 2; + + if (buflen < len) + break; + + switch (id) { + case RB_ID_BIOS_VERSION: + rb_hs.bios_ver = (char *)buf; + break; + case RB_ID_BOARD_NAME: + rb_hs.name = (char *)buf; + break; + case RB_ID_MEMORY_SIZE: + rb_hs.mem_size = prom_read_le32(buf); + break; + case RB_ID_MAC_ADDRESS_COUNT: + rb_hs.mac_count = prom_read_le32(buf); + break; + case RB_ID_MAC_ADDRESS_PACK: + if ((len / RB_MAC_SIZE) > 0) + rb_hs.mac_base = buf; + break; + } + + buf += len; + buflen -= len; + + } + + return 0; +} + +#define RB_BS_OFFS 0x14 +#define RB_OFFS_MAX (128*1024) + +int __init routerboot_present(void) +{ + struct rb_bios_settings *bs; + u8 *base; + u32 off, len; + + if (rb_found) + goto out; + + base = (u8 *)KSEG1ADDR(ADM5120_SRAM0_BASE); + bs = (struct rb_bios_settings *)(base + RB_BS_OFFS); + + off = prom_read_le32(&bs->hs_offs); + len = prom_read_le32(&bs->hs_size); + if (off > RB_OFFS_MAX) + goto out; + + if (routerboot_load_hs(base+off, len) != 0) + goto out; + + rb_found = 1; + +out: + return rb_found; +} + +char *routerboot_get_boardname(void) +{ + if (rb_found == 0) + return NULL; + + return rb_hs.name; +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile new file mode 100644 index 000000000..e8325a1b1 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile @@ -0,0 +1,4 @@ +obj-y += p-33x.o + +obj-${CONFIG_ADM5120_MACH_P_334WT} += p-334wt.o +obj-${CONFIG_ADM5120_MACH_P_335} += p-335.o \ No newline at end of file diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c new file mode 100644 index 000000000..6cc9aee85 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c @@ -0,0 +1,34 @@ +/* + * ZyXEL Prestige P-334WT support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "p-33x.h" + +static struct gpio_led p334wt_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN2, "power", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL), + GPIO_LED_INV(ADM5120_GPIO_P2L2, "otist", NULL), + GPIO_LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL), +}; + +static void __init p334wt_setup(void) +{ + p33x_generic_setup(); + adm5120_add_device_gpio_leds(ARRAY_SIZE(p334wt_gpio_leds), + p334wt_gpio_leds); +} + +MIPS_MACHINE(MACH_ADM5120_P334WT, "P-334WT", "ZyXEL Prestige 334WT", + p334wt_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c new file mode 100644 index 000000000..6ac2b0915 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c @@ -0,0 +1,21 @@ +/* + * ZyXEL Prestige P-335/335WT support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "p-33x.h" + +static void __init p335_setup(void) +{ + p33x_generic_setup(); + adm5120_add_device_usb(); +} + +MIPS_MACHINE(MACH_ADM5120_P335, "P-335", "ZyXEL Prestige 335/335WT", + p335_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c new file mode 100644 index 000000000..2626cf9ee --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c @@ -0,0 +1,85 @@ +/* + * ZyXEL Prestige P-33x boards support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include "p-33x.h" + +#include + +#define P33X_GPIO_FLASH_A20 ADM5120_GPIO_PIN5 +static struct mtd_partition p33x_partitions[] = { + { + .name = "bootbase", + .offset = 0, + .size = 16*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "rom", + .offset = MTDPART_OFS_APPEND, + .size = 16*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "bootext1", + .offset = MTDPART_OFS_APPEND, + .size = 32*1024, + } , { + .name = "bootext2", + .offset = MTDPART_OFS_APPEND, + .size = 64*1024, + } , { + .name = "trx", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } , { + .name = "firmware", + .offset = 32*1024, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = { + PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), +}; + +static u8 p33x_vlans[6] __initdata = { + /* FIXME: untested */ + 0x50, 0x48, 0x44, 0x42, 0x41, 0x00 +}; + +static void switch_bank_gpio5(unsigned bank) +{ + switch (bank) { + case 0: + gpio_set_value(P33X_GPIO_FLASH_A20, 0); + break; + case 1: + gpio_set_value(P33X_GPIO_FLASH_A20, 1); + break; + } +} + +void __init p33x_generic_setup(void) +{ + /* setup data for flash0 device */ + gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */ + gpio_direction_output(P33X_GPIO_FLASH_A20, 0); + adm5120_flash0_data.switch_bank = switch_bank_gpio5; + adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions); + adm5120_flash0_data.parts = p33x_partitions; + adm5120_add_device_flash(0); + + adm5120_add_device_uart(0); + adm5120_add_device_uart(1); + + adm5120_setup_eth_macs(bootbase_info.mac); + adm5120_add_device_switch(6, p33x_vlans); + + adm5120_pci_set_irq_map(ARRAY_SIZE(p33x_pci_irqs), p33x_pci_irqs); +} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h new file mode 100644 index 000000000..8a7340cb5 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h @@ -0,0 +1,22 @@ +/* + * ZyXEL Prestige P-33x boards support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include + +#include +#include + +extern void p33x_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h new file mode 100644 index 000000000..bf220ff4d --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h @@ -0,0 +1,53 @@ +/* + * ADM5120 SoC definitions + * + * This file defines some constants specific to the ADM5120 SoC + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ +#ifndef _ASM_MIPS_MACH_ADM5120_DEFS_H +#define _ASM_MIPS_MACH_ADM5120_DEFS_H + +#define ADM5120_SDRAM0_BASE 0x00000000 +#define ADM5120_SDRAM1_BASE 0x01000000 +#define ADM5120_SRAM1_BASE 0x10000000 +#define ADM5120_EXTIO0_BASE 0x10C00000 +#define ADM5120_EXTIO0_SIZE 0x00200000 +#define ADM5120_EXTIO1_BASE 0x10E00000 +#define ADM5120_EXTIO1_SIZE 0x00200000 +#define ADM5120_MPMC_BASE 0x11000000 +#define ADM5120_MPMC_SIZE 0x00200000 +#define ADM5120_USBC_BASE 0x11200000 +#define ADM5120_USBC_SIZE 0x00200000 +#define ADM5120_PCIMEM_BASE 0x11400000 +#define ADM5120_PCIMEM_SIZE 0x00100000 +#define ADM5120_PCIIO_BASE 0x11500000 +#define ADM5120_PCIIO_SIZE 0x000FFFF0 +#define ADM5120_PCICFG_ADDR 0x115FFFF0 +#define ADM5120_PCICFG_DATA 0x115FFFF8 +#define ADM5120_PCICFG_SIZE 0x00000010 +#define ADM5120_SWITCH_BASE 0x12000000 +#define ADM5120_SWITCH_SIZE 0x00200000 +#define ADM5120_INTC_BASE 0x12200000 +#define ADM5120_INTC_SIZE 0x00200000 +#define ADM5120_UART0_BASE 0x12600000 +#define ADM5120_UART1_BASE 0x12800000 +#define ADM5120_UART_SIZE 0x00200000 +#define ADM5120_SRAM0_BASE 0x1FC00000 + +#define ADM5120_NAND_BASE ADM5120_SRAM1_BASE +#define ADM5120_NAND_SIZE 0xB + +#define ADM5120_CLK_175 175000000 +#define ADM5120_CLK_200 200000000 +#define ADM5120_CLK_225 225000000 +#define ADM5120_CLK_250 250000000 + +#define ADM5120_UART_CLOCK 62500000 + +#endif /* _ASM_MIPS_MACH_ADM5120_DEFS_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h new file mode 100644 index 000000000..1d34d80ee --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2007-2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MACH_ADM5120_INFO_H +#define _MACH_ADM5120_INFO_H + +#include + +extern unsigned int adm5120_prom_type; +#define ADM5120_PROM_GENERIC 0 +#define ADM5120_PROM_CFE 1 +#define ADM5120_PROM_MYLOADER 2 +#define ADM5120_PROM_ROUTERBOOT 3 +#define ADM5120_PROM_BOOTBASE 4 +#define ADM5120_PROM_UBOOT 5 +#define ADM5120_PROM_LAST 5 + +extern unsigned int adm5120_product_code; +extern unsigned int adm5120_revision; +extern unsigned int adm5120_nand_boot; + +extern unsigned long adm5120_speed; +#define ADM5120_SPEED_175 175000000 +#define ADM5120_SPEED_200 200000000 +#define ADM5120_SPEED_225 225000000 +#define ADM5120_SPEED_250 250000000 + +extern unsigned int adm5120_package; +#define ADM5120_PACKAGE_PQFP 0 +#define ADM5120_PACKAGE_BGA 1 + +extern unsigned long adm5120_memsize; + +enum { + MACH_ADM5120_GENERIC = 0, /* Generic board */ + MACH_ADM5120_5GXI, /* OSBRiDGE 5GXi/5XLi */ + MACH_ADM5120_BR6104K, /* Edimax BR-6104K */ + MACH_ADM5120_BR6104KP, /* Edimax BR-6104KP */ + MACH_ADM5120_BR61X4WG, /* Edimax BR-6104Wg/BR-6114WG */ + MACH_ADM5120_CAS630, /* Cellvision CAS-630/630W */ + MACH_ADM5120_CAS670, /* Cellvision CAS-670/670W */ + MACH_ADM5120_CAS700, /* Cellvision CAS-700/700W */ + MACH_ADM5120_CAS771, /* Cellvision CAS-771/771W */ + MACH_ADM5120_CAS790, /* Cellvision CAS-790 */ + MACH_ADM5120_CAS861, /* Cellvision CAS-861/861W */ + MACH_ADM5120_EASY5120PATA, /* Infineon EASY 5120P-ATA */ + MACH_ADM5120_EASY5120RT, /* Infineon EASY 5120-RT */ + MACH_ADM5120_EASY5120WVOIP, /* Infineon EASY 5120-WVoIP */ + MACH_ADM5120_EASY83000, /* Infineon EASY-83000 */ + MACH_ADM5120_ES2108, /* ZyXEL Ethernet Switch 2108 */ + MACH_ADM5120_ES2108F, /* ZyXEL Ethernet Switch 2108-F */ + MACH_ADM5120_ES2108G, /* ZyXEL Ethernet Switch 2108-G */ + MACH_ADM5120_ES2108LC, /* ZyXEL Ethernet Switch 2108-LC */ + MACH_ADM5120_ES2108PWR, /* ZyXEL Ethernet Switch 2108-PWR */ + MACH_ADM5120_ES2024A, /* ZyXEL Ethernet Switch 2024A */ + MACH_ADM5120_ES2024PWR, /* ZyXEL Ethernet Switch 2024PWR */ + MACH_ADM5120_HS100, /* ZyXEL HomeSafe 100/100W */ + MACH_ADM5120_NFS101U, /* Cellvision NFS-101U/101WU */ + MACH_ADM5120_NFS202U, /* Cellvision NFS-202U/202WU */ + MACH_ADM5120_NP28G, /* Compex NP28G */ + MACH_ADM5120_NP28GHS, /* Compex NP28G HotSpot */ + MACH_ADM5120_NP27G, /* Compex NP27G */ + MACH_ADM5120_RB_11X, /* Mikrotik RouterBOARD 111/112 */ + MACH_ADM5120_RB_133, /* Mikrotik RouterBOARD 133 */ + MACH_ADM5120_RB_133C, /* Mikrotik RouterBOARD 133c */ + MACH_ADM5120_RB_150, /* Mikrotik RouterBOARD 150 */ + MACH_ADM5120_RB_153, /* Mikrotik RouterBOARD 153 */ + MACH_ADM5120_RB_192, /* Mikrotik RouterBOARD 192 */ + MACH_ADM5120_P334U, /* ZyXEL Prestige 334U */ + MACH_ADM5120_P334W, /* ZyXEL Prestige 334W */ + MACH_ADM5120_P334WH, /* ZyXEL Prestige 334WH */ + MACH_ADM5120_P334WHD, /* ZyXEL Prestige 334WHD */ + MACH_ADM5120_P334WT, /* ZyXEL Prestige 334WT */ + MACH_ADM5120_P335, /* ZyXEL Prestige 335/335WT */ + MACH_ADM5120_P335PLUS, /* ZyXEL Prestige 335Plus */ + MACH_ADM5120_P335U, /* ZyXEL Prestige 335U */ + MACH_ADM5120_PMUGW, /* Motorola Powerline MU Gateway */ + MACH_ADM5120_WP54, /* Compex WP54G/WP54AG/WPP54G/WPP54AG */ + MACH_ADM5120_WP54G_WRT, /* Compex WP54G-WRT */ + MACH_ADM5120_WP54Gv1C, /* Compex WP54G version 1C */ + MACH_ADM5120_EB_214A, /* Generic EB-214A */ +}; + +/* + * TODO:remove adm5120_eth* variables when the switch driver will be + * converted into a real platform driver + */ +extern unsigned int adm5120_eth_num_ports; +extern unsigned char adm5120_eth_macs[6][6]; +extern unsigned char adm5120_eth_vlans[6]; + +extern void adm5120_soc_init(void) __init; +extern void adm5120_mem_init(void) __init; +extern void adm5120_ndelay(u32 ns); + +extern void (*adm5120_board_reset)(void); + +extern void adm5120_gpio_init(void) __init; +extern void adm5120_gpio_csx0_enable(void) __init; +extern void adm5120_gpio_csx1_enable(void) __init; +extern void adm5120_gpio_ew_enable(void) __init; + +static inline int adm5120_package_pqfp(void) +{ + return (adm5120_package == ADM5120_PACKAGE_PQFP); +} + +static inline int adm5120_package_bga(void) +{ + return (adm5120_package == ADM5120_PACKAGE_BGA); +} + +static inline int adm5120_has_pci(void) +{ + return (adm5120_package == ADM5120_PACKAGE_BGA); +} + +static inline int adm5120_has_gmii(void) +{ + return (adm5120_package == ADM5120_PACKAGE_BGA); +} + +#endif /* _MACH_ADM5120_INFO_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h new file mode 100644 index 000000000..70dd6bbe8 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h @@ -0,0 +1,63 @@ +/* + * ADM5120 interrupt controller definitions + * + * This header file defines the hardware registers of the ADM5120 SoC + * built-in interrupt controller. + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MACH_ADM5120_INTC_H +#define _MACH_ADM5120_INTC_H + +/* + * INTC register offsets + */ +#define INTC_REG_IRQ_STATUS 0x00 /* Interrupt status after masking */ +#define INTC_REG_IRQ_RAW_STATUS 0x04 /* Interrupt status before masking */ +#define INTC_REG_IRQ_ENABLE 0x08 /* Used to enable the interrupt sources */ +#define INTC_REG_IRQ_ENABLE_CLEAR 0x0C /* Used to disable the interrupt sources */ +#define INTC_REG_IRQ_DISABLE INTC_REG_IRQ_ENABLE_CLEAR +#define INTC_REG_INT_MODE 0x14 /* The interrupt mode of the sources */ +#define INTC_REG_FIQ_STATUS 0x18 /* FIQ status */ +#define INTC_REG_IRQ_TEST_SOURCE 0x1C +#define INTC_REG_IRQ_SOURCE_SELECT 0x20 +#define INTC_REG_INT_LEVEL 0x24 + +/* + * INTC IRQ numbers + */ +#define INTC_IRQ_TIMER 0 /* built in timer */ +#define INTC_IRQ_UART0 1 /* built-in UART0 */ +#define INTC_IRQ_UART1 2 /* built-in UART1 */ +#define INTC_IRQ_USBC 3 /* USB Host Controller */ +#define INTC_IRQ_GPIO2 4 /* GPIO line 2 */ +#define INTC_IRQ_GPIO4 5 /* GPIO line 4 */ +#define INTC_IRQ_PCI0 6 /* PCI slot 2 */ +#define INTC_IRQ_PCI1 7 /* PCI slot 3 */ +#define INTC_IRQ_PCI2 8 /* PCI slot 4 */ +#define INTC_IRQ_SWITCH 9 /* built-in ethernet switch */ +#define INTC_IRQ_LAST INTC_IRQ_SWITCH +#define INTC_IRQ_COUNT 10 + +/* + * INTC register bits + */ +#define INTC_INT_TIMER (1 << INTC_IRQ_TIMER) +#define INTC_INT_UART0 (1 << INTC_IRQ_UART0) +#define INTC_INT_UART1 (1 << INTC_IRQ_UART1) +#define INTC_INT_USBC (1 << INTC_IRQ_USBC) +#define INTC_INT_INTX0 (1 << INTC_IRQ_INTX0) +#define INTC_INT_INTX1 (1 << INTC_IRQ_INTX1) +#define INTC_INT_PCI0 (1 << INTC_IRQ_PCI0) +#define INTC_INT_PCI1 (1 << INTC_IRQ_PCI1) +#define INTC_INT_PCI2 (1 << INTC_IRQ_PCI2) +#define INTC_INT_SWITCH (1 << INTC_IRQ_SWITCH) +#define INTC_INT_ALL ((1 << INTC_IRQ_COUNT) - 1) + +#endif /* _MACH_ADM5120_INTC_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h new file mode 100644 index 000000000..c4e9591fb --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h @@ -0,0 +1,92 @@ +/* + * ADM5120 MPMC (Multiport Memory Controller) register definitions + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MACH_ADM5120_MPMC_H +#define _MACH_ADM5120_MPMC_H + +#define MPMC_READ_REG(r) __raw_readl( \ + (void __iomem *)KSEG1ADDR(ADM5120_MPMC_BASE) + MPMC_REG_ ## r) +#define MPMC_WRITE_REG(r, v) __raw_writel((v), \ + (void __iomem *)KSEG1ADDR(ADM5120_MPMC_BASE) + MPMC_REG_ ## r) + +#define MPMC_REG_CTRL 0x0000 +#define MPMC_REG_STATUS 0x0004 +#define MPMC_REG_CONF 0x0008 +#define MPMC_REG_DC 0x0020 +#define MPMC_REG_DR 0x0024 +#define MPMC_REG_DRP 0x0030 + +#define MPMC_REG_DC0 0x0100 +#define MPMC_REG_DRC0 0x0104 +#define MPMC_REG_DC1 0x0120 +#define MPMC_REG_DRC1 0x0124 +#define MPMC_REG_DC2 0x0140 +#define MPMC_REG_DRC2 0x0144 +#define MPMC_REG_DC3 0x0160 +#define MPMC_REG_DRC3 0x0164 +#define MPMC_REG_SC0 0x0200 /* for F_CS1_N */ +#define MPMC_REG_SC1 0x0220 /* for F_CS0_N */ +#define MPMC_REG_SC2 0x0240 +#define MPMC_REG_WEN2 0x0244 +#define MPMC_REG_OEN2 0x0248 +#define MPMC_REG_RD2 0x024C +#define MPMC_REG_PG2 0x0250 +#define MPMC_REG_WR2 0x0254 +#define MPMC_REG_TN2 0x0258 +#define MPMC_REG_SC3 0x0260 + +/* Control register bits */ +#define MPMC_CTRL_AM (1 << 1) /* Address Mirror */ +#define MPMC_CTRL_LPM (1 << 2) /* Low Power Mode */ +#define MPMC_CTRL_DWB (1 << 3) /* Drain Write Buffers */ + +/* Status register bits */ +#define MPMC_STATUS_BUSY (1 << 0) /* Busy */ +#define MPMC_STATUS_WBS (1 << 1) /* Write Buffer Status */ +#define MPMC_STATUS_SRA (1 << 2) /* Self-Refresh Acknowledge*/ + +/* Dynamic Control register bits */ +#define MPMC_DC_CE (1 << 0) +#define MPMC_DC_DMC (1 << 1) +#define MPMC_DC_SRR (1 << 2) +#define MPMC_DC_SI_SHIFT 7 +#define MPMC_DC_SI_MASK (3 << 7) +#define MPMC_DC_SI_NORMAL (0 << 7) +#define MPMC_DC_SI_MODE (1 << 7) +#define MPMC_DC_SI_PALL (2 << 7) +#define MPMC_DC_SI_NOP (3 << 7) + +#define SRAM_REG_CONF 0x00 +#define SRAM_REG_WWE 0x04 +#define SRAM_REG_WOE 0x08 +#define SRAM_REG_WRD 0x0C +#define SRAM_REG_WPG 0x10 +#define SRAM_REG_WWR 0x14 +#define SRAM_REG_WTR 0x18 + +/* Dynamic Configuration register bits */ +#define DC_BE (1 << 19) /* buffer enable */ +#define DC_RW_SHIFT 28 /* shift for number of rows */ +#define DC_RW_MASK 0x03 +#define DC_NB_SHIFT 26 /* shift for number of banks */ +#define DC_NB_MASK 0x01 +#define DC_CW_SHIFT 22 /* shift for number of columns */ +#define DC_CW_MASK 0x07 +#define DC_DW_SHIFT 7 /* shift for device width */ +#define DC_DW_MASK 0x03 + +/* Static Configuration register bits */ +#define SC_MW_MASK 0x03 /* memory width mask */ +#define SC_MW_8 0x00 /* 8 bit memory width */ +#define SC_MW_16 0x01 /* 16 bit memory width */ +#define SC_MW_32 0x02 /* 32 bit memory width */ + +#endif /* _MACH_ADM5120_MPMC_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h new file mode 100644 index 000000000..1e2f3bd15 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h @@ -0,0 +1,89 @@ +/* + * ADM5120 NAND interface definitions + * + * This header file defines the hardware registers of the ADM5120 SoC + * built-in NAND interface. + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * NAND interface routines was based on a driver for Linux 2.6.19+ which + * was derived from the driver for Linux 2.4.xx published by Mikrotik for + * their RouterBoard 1xx and 5xx series boards. + * Copyright (C) 2007 David Goodenough + * Copyright (C) 2007 Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MACH_ADM5120_NAND_H +#define _MACH_ADM5120_NAND_H + +#include +#include + +#include +#include + +/* NAND control registers */ +#define NAND_REG_DATA 0x0 /* data register */ +#define NAND_REG_SET_CEn 0x1 /* CE# low */ +#define NAND_REG_CLR_CEn 0x2 /* CE# high */ +#define NAND_REG_CLR_CLE 0x3 /* CLE low */ +#define NAND_REG_SET_CLE 0x4 /* CLE high */ +#define NAND_REG_CLR_ALE 0x5 /* ALE low */ +#define NAND_REG_SET_ALE 0x6 /* ALE high */ +#define NAND_REG_SET_SPn 0x7 /* SP# low (use spare area) */ +#define NAND_REG_CLR_SPn 0x8 /* SP# high (do not use spare area) */ +#define NAND_REG_SET_WPn 0x9 /* WP# low */ +#define NAND_REG_CLR_WPn 0xA /* WP# high */ +#define NAND_REG_STATUS 0xB /* Status register */ + +#define ADM5120_NAND_STATUS_READY 0x80 + +#define NAND_READ_REG(r) \ + readb((void __iomem *)KSEG1ADDR(ADM5120_NAND_BASE) + (r)) +#define NAND_WRITE_REG(r, v) \ + writeb((v), (void __iomem *)KSEG1ADDR(ADM5120_NAND_BASE) + (r)) + +/*-------------------------------------------------------------------------*/ + +static inline void adm5120_nand_enable(void) +{ + SW_WRITE_REG(SWITCH_REG_BW_CNTL1, BW_CNTL1_NAND_ENABLE); + SW_WRITE_REG(SWITCH_REG_BOOT_DONE, 1); +} + +static inline void adm5120_nand_set_wpn(unsigned int set) +{ + NAND_WRITE_REG((set) ? NAND_REG_SET_WPn : NAND_REG_CLR_WPn, 1); +} + +static inline void adm5120_nand_set_spn(unsigned int set) +{ + NAND_WRITE_REG((set) ? NAND_REG_SET_SPn : NAND_REG_CLR_SPn, 1); +} + +static inline void adm5120_nand_set_cle(unsigned int set) +{ + NAND_WRITE_REG((set) ? NAND_REG_SET_CLE : NAND_REG_CLR_CLE, 1); +} + +static inline void adm5120_nand_set_ale(unsigned int set) +{ + NAND_WRITE_REG((set) ? NAND_REG_SET_ALE : NAND_REG_CLR_ALE, 1); +} + +static inline void adm5120_nand_set_cen(unsigned int set) +{ + NAND_WRITE_REG((set) ? NAND_REG_SET_CEn : NAND_REG_CLR_CEn, 1); +} + +static inline u8 adm5120_nand_get_status(void) +{ + return NAND_READ_REG(NAND_REG_STATUS); +} + +#endif /* _MACH_ADM5120_NAND_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h new file mode 100644 index 000000000..ed73b5329 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h @@ -0,0 +1,87 @@ +/* + * ADM5120 specific platform definitions + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _ASM_MIPS_MACH_ADM5120_PLATFORM_H +#define _ASM_MIPS_MACH_ADM5120_PLATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct adm5120_flash_platform_data { + void (*set_vpp)(struct map_info *, int); + void (*switch_bank)(unsigned); + u32 window_size; + unsigned int nr_parts; + struct mtd_partition *parts; +}; + +struct adm5120_switch_platform_data { + /* TODO: not yet implemented */ +}; + +struct adm5120_pci_irq { + u8 slot; + u8 func; + u8 pin; + unsigned irq; +}; + +#define PCIIRQ(s, f, p, i) {.slot = (s), .func = (f), .pin = (p), .irq = (i)} + +#ifdef CONFIG_PCI +extern void adm5120_pci_set_irq_map(unsigned int nr_irqs, + struct adm5120_pci_irq *map) __init; +#else +static inline void adm5120_pci_set_irq_map(unsigned int nr_irqs, + struct adm5120_pci_irq *map) +{ +} +#endif + +extern void adm5120_setup_eth_macs(u8 *mac_base) __init; + +extern struct adm5120_flash_platform_data adm5120_flash0_data; +extern struct adm5120_flash_platform_data adm5120_flash1_data; + +extern void adm5120_add_device_flash(unsigned id) __init; +extern void adm5120_add_device_usb(void) __init; +extern void adm5120_add_device_uart(unsigned id) __init; +extern void adm5120_add_device_nand(struct platform_nand_data *pdata) __init; +extern void adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) __init; +extern void adm5120_register_gpio_buttons(int id, + unsigned poll_interval, + unsigned nbuttons, + struct gpio_keys_button *buttons); + +#define GPIO_LED_DEF(g, n, t, a) { \ + .name = (n), \ + .default_trigger = (t), \ + .gpio = (g), \ + .active_low = (a) \ +} + +#define GPIO_LED_STD(g, n, t) GPIO_LED_DEF((g), (n), (t), 0) +#define GPIO_LED_INV(g, n, t) GPIO_LED_DEF((g), (n), (t), 1) + +extern void adm5120_add_device_gpio_leds(unsigned num_leds, + struct gpio_led *leds) __init; + +#endif /* _ASM_MIPS_MACH_ADM5120_PLATFORM_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h new file mode 100644 index 000000000..91adc5bae --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h @@ -0,0 +1,300 @@ +/* + * ADM5120 ethernet switch definitions + * + * This header file defines the hardware registers of the ADM5120 SoC + * built-in Ethernet switch. + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MACH_ADM5120_SWITCH_H +#define _MACH_ADM5120_SWITCH_H + +#ifndef BIT +# define BIT(at) (1 << (at)) +#endif +#define BITMASK(len) (BIT(len)-1) + +#define SW_READ_REG(r) __raw_readl( \ + (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE) + r) +#define SW_WRITE_REG(r, v) __raw_writel((v), \ + (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE) + r) + +/* Switch register offsets */ +#define SWITCH_REG_CODE 0x0000 +#define SWITCH_REG_SOFT_RESET 0x0004 /* Soft Reset */ +#define SWITCH_REG_BOOT_DONE 0x0008 /* Boot Done */ +#define SWITCH_REG_SW_RESET 0x000C /* Switch Reset */ +#define SWITCH_REG_PHY_STATUS 0x0014 /* PHY Status */ +#define SWITCH_REG_MEMCTRL 0x001C /* Memory Control */ +#define SWITCH_REG_CPUP_CONF 0x0024 /* CPU Port Configuration */ +#define SWITCH_REG_PORT_CONF0 0x0028 /* Port Configuration 0 */ +#define SWITCH_REG_PORT_CONF1 0x002C /* Port Configuration 1 */ +#define SWITCH_REG_PORT_CONF2 0x0030 /* Port Configuration 2 */ +#define SWITCH_REG_VLAN_G1 0x0040 /* VLAN group 1 */ +#define SWITCH_REG_VLAN_G2 0x0044 /* VLAN group 2 */ +#define SWITCH_REG_SEND_TRIG 0x0048 /* Send Trigger */ +#define SWITCH_REG_MAC_WT0 0x0058 /* MAC Write Address 0 */ +#define SWITCH_REG_MAC_WT1 0x005C /* MAC Write Address 1 */ +#define SWITCH_REG_BW_CNTL0 0x0060 /* Bandwidth Control 0 */ +#define SWITCH_REG_BW_CNTL1 0x0064 /* Bandwidth Control 1 */ +#define SWITCH_REG_PHY_CNTL0 0x0068 /* PHY Control 0 */ +#define SWITCH_REG_PHY_CNTL1 0x006C /* PHY Control 1 */ +#define SWITCH_REG_PORT_TH 0x0078 /* Port Threshold */ +#define SWITCH_REG_PHY_CNTL2 0x007C /* PHY Control 2 */ +#define SWITCH_REG_PHY_CNTL3 0x0080 /* PHY Control 3 */ +#define SWITCH_REG_PRI_CNTL 0x0084 /* Priority Control */ +#define SWITCH_REG_PHY_CNTL4 0x00A0 /* PHY Control 4 */ +#define SWITCH_REG_EMPTY_CNT 0x00A4 /* Empty Count */ +#define SWITCH_REG_PORT_CNTLS 0x00A8 /* Port Control Select */ +#define SWITCH_REG_PORT_CNTL 0x00AC /* Port Control */ +#define SWITCH_REG_INT_STATUS 0x00B0 /* Interrupt Status */ +#define SWITCH_REG_INT_MASK 0x00B4 /* Interrupt Mask */ +#define SWITCH_REG_GPIO_CONF0 0x00B8 /* GPIO Configuration 0 */ +#define SWITCH_REG_GPIO_CONF2 0x00BC /* GPIO Configuration 1 */ +#define SWITCH_REG_WDOG0 0x00C0 /* Watchdog 0 */ +#define SWITCH_REG_WDOG1 0x00C4 /* Watchdog 1 */ + +#define SWITCH_REG_SHDA 0x00D0 /* Send High Descriptors Address */ +#define SWITCH_REG_SLDA 0x00D4 /* Send Low Descriptors Address */ +#define SWITCH_REG_RHDA 0x00D8 /* Receive High Descriptor Address */ +#define SWITCH_REG_RLDA 0x00DC /* Receive Low Descriptor Address */ +#define SWITCH_REG_SHWA 0x00E0 /* Send High Working Address */ +#define SWITCH_REG_SLWA 0x00E4 /* Send Low Working Address */ +#define SWITCH_REG_RHWA 0x00E8 /* Receive High Working Address */ +#define SWITCH_REG_RLWA 0x00EC /* Receive Low Working Address */ + +#define SWITCH_REG_TIMER_INT 0x00F0 /* Timer */ +#define SWITCH_REG_TIMER 0x00F4 /* Timer Interrupt */ + +#define SWITCH_REG_PORT0_LED 0x0100 +#define SWITCH_REG_PORT1_LED 0x0104 +#define SWITCH_REG_PORT2_LED 0x0108 +#define SWITCH_REG_PORT3_LED 0x010C +#define SWITCH_REG_PORT4_LED 0x0110 + +/* CODE register bits */ +#define CODE_PC_MASK BITMASK(16) /* Product Code */ +#define CODE_REV_SHIFT 16 +#define CODE_REV_MASK BITMASK(4) /* Product Revision */ +#define CODE_CLKS_SHIFT 20 +#define CODE_CLKS_MASK BITMASK(2) /* Clock Speed */ +#define CODE_CLKS_175 0 /* 175 MHz */ +#define CODE_CLKS_200 1 /* 200 MHz */ +#define CODE_CLKS_225 2 /* 225 MHz */ +#define CODE_CLKS_250 3 /* 250 MHz */ +#define CODE_NAB BIT(24) /* NAND boot */ +#define CODE_PK_MASK BITMASK(1) /* Package type */ +#define CODE_PK_SHIFT 29 +#define CODE_PK_BGA 0 /* BGA package */ +#define CODE_PK_PQFP 1 /* PQFP package */ + +/* MEMCTRL register bits */ +#define MEMCTRL_SDRS_MASK BITMASK(3) /* SDRAM bank size */ +#define MEMCTRL_SDRS_4M 0x01 +#define MEMCTRL_SDRS_8M 0x02 +#define MEMCTRL_SDRS_16M 0x03 +#define MEMCTRL_SDRS_64M 0x04 +#define MEMCTRL_SDRS_128M 0x05 +#define MEMCTRL_SDR1_ENABLE BIT(5) /* enable SDRAM bank 1 */ + +#define MEMCTRL_SRS0_SHIFT 8 /* shift for SRAM0 size */ +#define MEMCTRL_SRS1_SHIFT 16 /* shift for SRAM1 size */ +#define MEMCTRL_SRS_MASK BITMASK(3) /* SRAM size mask */ +#define MEMCTRL_SRS_DISABLED 0x00 /* Disabled */ +#define MEMCTRL_SRS_512K 0x01 /* 512KB*/ +#define MEMCTRL_SRS_1M 0x02 /* 1MB */ +#define MEMCTRL_SRS_2M 0x03 /* 2MB */ +#define MEMCTRL_SRS_4M 0x04 /* 4MB */ + +/* Port bits used in various registers */ +#define SWITCH_PORT_PHY0 BIT(0) +#define SWITCH_PORT_PHY1 BIT(1) +#define SWITCH_PORT_PHY2 BIT(2) +#define SWITCH_PORT_PHY3 BIT(3) +#define SWITCH_PORT_PHY4 BIT(4) +#define SWITCH_PORT_MII BIT(5) +#define SWITCH_PORT_CPU BIT(6) + +/* Port bit shorthands */ +#define SWITCH_PORTS_PHY 0x1F /* phy ports */ +#define SWITCH_PORTS_NOCPU 0x3F /* physical ports */ +#define SWITCH_PORTS_ALL 0x7F /* all ports */ + +/* CPUP_CONF register bits */ +#define CPUP_CONF_DCPUP BIT(0) /* Disable CPU port */ +#define CPUP_CONF_CRCP BIT(1) /* CRC padding from CPU */ +#define CPUP_CONF_BTM BIT(2) /* Bridge Testing Mode */ +#define CPUP_CONF_DUNP_SHIFT 9 /* Disable Unknown Packets for portX */ +#define CPUP_CONF_DMCP_SHIFT 16 /* Disable Mcast Packets form portX */ +#define CPUP_CONF_DBCP_SHIFT 24 /* Disable Bcast Packets form portX */ + +/* PORT_CONF0 register bits */ +#define PORT_CONF0_DP_SHIFT 0 /* Disable Port */ +#define PORT_CONF0_EMCP_SHIFT 8 /* Enable All MC Packets */ +#define PORT_CONF0_BP_SHIFT 16 /* Enable Back Pressure */ + +/* PORT_CONF1 register bits */ +#define PORT_CONF1_DISL_SHIFT 0 /* Disable Learning */ +#define PORT_CONF1_BS_SHIFT 6 /* Blocking State */ +#define PORT_CONF1_BM_SHIFT 12 /* Blocking Mode */ + +/* SEND_TRIG register bits */ +#define SEND_TRIG_STL BIT(0) /* Send Trigger Low */ +#define SEND_TRIG_STH BIT(1) /* Send Trigger High */ + +/* MAC_WT0 register bits */ +#define MAC_WT0_MAWC BIT(0) /* MAC address write command */ +#define MAC_WT0_MWD_SHIFT 1 +#define MAC_WT0_MWD BIT(1) /* MAC write done */ +#define MAC_WT0_WFB BIT(2) /* Write Filter Bit */ +#define MAC_WT0_WVN_SHIFT 3 /* Write Vlan Number shift */ +#define MAC_WT0_WVE BIT(6) /* Write VLAN enable */ +#define MAC_WT0_WPMN_SHIFT 7 +#define MAC_WT0_WAF_SHIFT 13 /* Write Age Field shift */ +#define MAC_WT0_WAF_EMPTY 0 +#define MAC_WT0_WAF_STATIC 7 /* age: static */ +#define MAC_WT0_MAC0_SHIFT 16 +#define MAC_WT0_MAC1_SHIFT 24 + +/* MAC_WT1 register bits */ +#define MAC_WT1_MAC2_SHIFT 0 +#define MAC_WT1_MAC3_SHIFT 8 +#define MAC_WT1_MAC4_SHIFT 16 +#define MAC_WT1_MAC5_SHIFT 24 + +/* BW_CNTL0/BW_CNTL1 register bits */ +#define BW_CNTL_DISABLE 0x00 +#define BW_CNTL_64K 0x01 +#define BW_CNTL_128K 0x02 +#define BW_CNTL_256K 0x03 +#define BW_CNTL_512K 0x04 +#define BW_CNTL_1M 0x05 +#define BW_CNTL_4M 0x06 +#define BW_CNTL_10M 0x07 + +#define P4TBC_SHIFT 0 +#define P4RBC_SHIFT 4 +#define P5TBC_SHIFT 8 +#define P5RBC_SHIFT 12 + +#define BW_CNTL1_NAND_ENABLE 0x100 + +/* PHY_CNTL0 register bits */ +#define PHY_CNTL0_PHYA_MASK BITMASK(5) +#define PHY_CNTL0_PHYR_MASK BITMASK(5) +#define PHY_CNTL0_PHYR_SHIFT 8 +#define PHY_CNTL0_WC BIT(13) /* Write Command */ +#define PHY_CNTL0_RC BIT(14) /* Read Command */ +#define PHY_CNTL0_WTD_MASK BIT(16) /* Read Command */ +#define PHY_CNTL0_WTD_SHIFT 16 + +/* PHY_CNTL1 register bits */ +#define PHY_CNTL1_WOD BIT(0) /* Write Operation Done */ +#define PHY_CNTL1_ROD BIT(1) /* Read Operation Done */ +#define PHY_CNTL1_RD_MASK BITMASK(16) +#define PHY_CNTL1_RD_SHIFT 16 + +/* PHY_CNTL2 register bits */ +#define PHY_CNTL2_ANE_SHIFT 0 /* Auto Negotiation Enable */ +#define PHY_CNTL2_SC_SHIFT 5 /* Speed Control */ +#define PHY_CNTL2_DC_SHIFT 10 /* Duplex Control */ +#define PHY_CNTL2_FNCV_SHIFT 15 /* Recommended FC Value */ +#define PHY_CNTL2_PHYR_SHIFT 20 /* PHY reset */ +#define PHY_CNTL2_AMDIX_SHIFT 25 /* Auto MDIX enable */ +/* PHY_CNTL2_RMAE is bad in datasheet */ +#define PHY_CNTL2_RMAE BIT(31) /* Recommended MCC Average enable */ + +/* PHY_CNTL3 register bits */ +#define PHY_CNTL3_RNT BIT(10) /* Recommend Normal Threshold */ + +/* PORT_TH register bits */ +#define PORT_TH_PPT_MASK BITMASK(8) /* Per Port Threshold */ +#define PORT_TH_CPUT_SHIFT 8 /* CPU Port Buffer Threshold */ +#define PORT_TH_CPUT_MASK BITMASK(8) +#define PORT_TH_CPUHT_SHIFT 16 /* CPU Hold Threshold */ +#define PORT_TH_CPUHT_MASK BITMASK(8) +#define PORT_TH_CPURT_SHIFT 24 /* CPU Release Threshold */ +#define PORT_TH_CPURT_MASK BITMASK(8) + +/* EMPTY_CNT register bits */ +#define EMPTY_CNT_EBGB_MASK BITMASK(9) /* Empty Blocks in the Global Buffer */ + +/* GPIO_CONF0 register bits */ +#define GPIO_CONF0_MASK BITMASK(8) +#define GPIO_CONF0_IM_SHIFT 0 +#define GPIO_CONF0_IV_SHIFT 8 +#define GPIO_CONF0_OE_SHIFT 16 +#define GPIO_CONF0_OV_SHIFT 24 +#define GPIO_CONF0_IM_MASK (0xFF << GPIO_CONF0_IM_SHIFT) +#define GPIO_CONF0_IV_MASK (0xFF << GPIO_CONF0_IV_SHIFT) +#define GPIO_CONF0_OE_MASK (0xFF << GPIO_CONF0_OE_SHIFT) +#define GPIO_CONF0_OV_MASK (0xFF << GPIO_CONF0_OV_SHIFT) + +/* GPIO_CONF2 register bits */ +#define GPIO_CONF2_CSX0 BIT(4) /* enable CSX0:INTX0 on GPIO 1:2 */ +#define GPIO_CONF2_CSX1 BIT(5) /* enable CSX1:INTX1 on GPIO 3:4 */ +#define GPIO_CONF2_EW BIT(6) /* enable wait state pin for CSX0/1 */ + +/* INT_STATUS/INT_MASK register bits */ +#define SWITCH_INT_SHD BIT(0) /* Send High Done */ +#define SWITCH_INT_SLD BIT(1) /* Send Low Done */ +#define SWITCH_INT_RHD BIT(2) /* Receive High Done */ +#define SWITCH_INT_RLD BIT(3) /* Receive Low Done */ +#define SWITCH_INT_HDF BIT(4) /* High Descriptor Full */ +#define SWITCH_INT_LDF BIT(5) /* Low Descriptor Full */ +#define SWITCH_INT_P0QF BIT(6) /* Port0 Queue Full */ +#define SWITCH_INT_P1QF BIT(7) /* Port1 Queue Full */ +#define SWITCH_INT_P2QF BIT(8) /* Port2 Queue Full */ +#define SWITCH_INT_P3QF BIT(9) /* Port3 Queue Full */ +#define SWITCH_INT_P4QF BIT(10) /* Port4 Queue Full */ +#define SWITCH_INT_P5QF BIT(11) /* Port5 Queue Full */ +#define SWITCH_INT_CPQF BIT(13) /* CPU Queue Full */ +#define SWITCH_INT_GQF BIT(14) /* Global Queue Full */ +#define SWITCH_INT_MD BIT(15) /* Must Drop */ +#define SWITCH_INT_BCS BIT(16) /* BC Storm */ +#define SWITCH_INT_PSC BIT(18) /* Port Status Change */ +#define SWITCH_INT_ID BIT(19) /* Intruder Detected */ +#define SWITCH_INT_W0TE BIT(20) /* Watchdog 0 Timer Expired */ +#define SWITCH_INT_W1TE BIT(21) /* Watchdog 1 Timer Expired */ +#define SWITCH_INT_RDE BIT(22) /* Receive Descriptor Error */ +#define SWITCH_INT_SDE BIT(23) /* Send Descriptor Error */ +#define SWITCH_INT_CPUH BIT(24) /* CPU Hold */ + +/* TIMER_INT register bits */ +#define TIMER_INT_TOS BIT(0) /* time-out status */ +#define TIMER_INT_TOM BIT(16) /* mask time-out interrupt */ + +/* TIMER register bits */ +#define TIMER_PERIOD_MASK BITMASK(16) /* mask for timer period */ +#define TIMER_PERIOD_DEFAULT 0xFFFF /* default timer period */ +#define TIMER_TE BIT(16) /* timer enable bit */ + +/* PORTx_LED register bits */ +#define LED_MODE_MASK BITMASK(4) +#define LED_MODE_INPUT 0 +#define LED_MODE_FLASH 1 +#define LED_MODE_OUT_HIGH 2 +#define LED_MODE_OUT_LOW 3 +#define LED_MODE_LINK 4 +#define LED_MODE_SPEED 5 +#define LED_MODE_DUPLEX 6 +#define LED_MODE_ACT 7 +#define LED_MODE_COLL 8 +#define LED_MODE_LINK_ACT 9 +#define LED_MODE_DUPLEX_COLL 10 +#define LED_MODE_10M_ACT 11 +#define LED_MODE_100M_ACT 12 +#define LED0_MODE_SHIFT 0 /* LED0 mode shift */ +#define LED1_MODE_SHIFT 4 /* LED1 mode shift */ +#define LED2_MODE_SHIFT 8 /* LED2 mode shift */ +#define LED0_IV_SHIFT 12 /* LED0 input value shift */ +#define LED1_IV_SHIFT 13 /* LED1 input value shift */ +#define LED2_IV_SHIFT 14 /* LED2 input value shift */ + +#endif /* _MACH_ADM5120_SWITCH_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h new file mode 100644 index 000000000..81d3067da --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h @@ -0,0 +1,64 @@ +/* + * ADM5120 UART definitions + * + * This header file defines the hardware registers of the ADM5120 SoC + * built-in UARTs. + * + * Copyright (C) 2007 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MACH_ADM5120_UART_H +#define _MACH_ADM5120_UART_H + +#define UART_BAUDDIV(clk, baud) ((clk/(16 * (baud)))-1) + +#define UART_REG_DATA 0x00 +#define UART_REG_RSR 0x04 +#define UART_REG_ECR UART_REG_RSR +#define UART_REG_LCRH 0x08 +#define UART_REG_LCRM 0x0C +#define UART_REG_LCRL 0x10 +#define UART_REG_CTRL 0x14 +#define UART_REG_FLAG 0x18 + +/* Receive Status Register bits */ +#define UART_RSR_FE (1 << 0) +#define UART_RSR_PE (1 << 1) +#define UART_RSR_BE (1 << 2) +#define UART_RSR_OE (1 << 3) +#define UART_RSR_ERR (UART_RSR_FE | UART_RSR_PE | UART_RSR_BE) + +#define UART_ECR_ALL 0xFF + +/* Line Control High register bits */ +#define UART_LCRH_BRK (1 << 0) /* send break */ +#define UART_LCRH_PEN (1 << 1) /* parity enable */ +#define UART_LCRH_EPS (1 << 2) /* even parity select */ +#define UART_LCRH_STP1 (0 << 3) /* one stop bits select */ +#define UART_LCRH_STP2 (1 << 3) /* two stop bits select */ +#define UART_LCRH_FEN (1 << 4) /* FIFO enable */ + +#define UART_LCRH_WLEN5 (0 << 5) +#define UART_LCRH_WLEN6 (1 << 5) +#define UART_LCRH_WLEN7 (2 << 5) +#define UART_LCRH_WLEN8 (3 << 5) + +/* Control register bits */ +#define UART_CTRL_EN (1 << 0) + +/* Flag register bits */ +#define UART_FLAG_CTS (1 << 0) +#define UART_FLAG_DSR (1 << 1) +#define UART_FLAG_DCD (1 << 2) +#define UART_FLAG_BUSY (1 << 3) +#define UART_FLAG_RXFE (1 << 4) +#define UART_FLAG_TXFF (1 << 5) +#define UART_FLAG_RXFF (1 << 6) +#define UART_FLAG_TXFE (1 << 7) + +#endif /* _MACH_ADM5120_UART_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h new file mode 100644 index 000000000..503843db1 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* DO NOT EDIT!! - this file automatically generated + * from .s file by awk -f s2h.awk + */ +/* Size definitions + * Copyright (C) ARM Limited 1998. All rights reserved. + */ + +#ifndef __sizes_h +#define __sizes_h 1 + +/* handy sizes */ +#define SZ_16 0x00000010 +#define SZ_256 0x00000100 +#define SZ_512 0x00000200 + +#define SZ_1K 0x00000400 +#define SZ_4K 0x00001000 +#define SZ_8K 0x00002000 +#define SZ_16K 0x00004000 +#define SZ_64K 0x00010000 +#define SZ_128K 0x00020000 +#define SZ_256K 0x00040000 +#define SZ_512K 0x00080000 + +#define SZ_1M 0x00100000 +#define SZ_2M 0x00200000 +#define SZ_4M 0x00400000 +#define SZ_8M 0x00800000 +#define SZ_16M 0x01000000 +#define SZ_32M 0x02000000 +#define SZ_64M 0x04000000 +#define SZ_128M 0x08000000 +#define SZ_256M 0x10000000 +#define SZ_512M 0x20000000 + +#define SZ_1G 0x40000000 +#define SZ_2G 0x80000000 + +#endif + +/* END */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h new file mode 100644 index 000000000..c6310cc6e --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h @@ -0,0 +1,71 @@ +/* + * ADM5120 specific CPU feature overrides + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: include/asm-mips/cpu-features.h + * Copyright (C) 2003, 2004 Ralf Baechle + * Copyright (C) 2004 Maciej W. Rozycki + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ +#ifndef __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H +#define __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H + +/* + * The ADM5120 SOC has a built-in MIPS 4Kc core. + */ +#define cpu_has_tlb 1 +#define cpu_has_4kex 1 +#define cpu_has_3k_cache 0 +#define cpu_has_4k_cache 1 +#define cpu_has_tx39_cache 0 +#define cpu_has_sb1_cache 0 +#define cpu_has_fpu 0 +#define cpu_has_32fpr 0 +#define cpu_has_counter 1 +#define cpu_has_watch 1 +#define cpu_has_divec 1 +/* #define cpu_has_vce ? */ +/* #define cpu_has_cache_cdex_p ? */ +/* #define cpu_has_cache_cdex_s ? */ +#define cpu_has_prefetch 1 +/* #define cpu_has_mcheck ? */ +#define cpu_has_ejtag 1 +#define cpu_has_llsc 1 + +#define cpu_has_mips16 0 +#define cpu_has_mdmx 0 +#define cpu_has_mips3d 0 +#define cpu_has_smartmips 0 + +/* #define cpu_has_vtag_icache ? */ +/* #define cpu_has_dc_aliases ? */ +/* #define cpu_has_ic_fills_f_dc ? */ +/* #define cpu_has_pindexed_dcache ? */ + +/* #define cpu_icache_snoops_remote_store ? */ + +#define cpu_has_mips32r1 1 +#define cpu_has_mips32r2 0 +#define cpu_has_mips64r1 0 +#define cpu_has_mips64r2 0 + +#define cpu_has_dsp 0 +#define cpu_has_mipsmt 0 + +/* #define cpu_has_nofpuex ? */ +#define cpu_has_64bits 0 +#define cpu_has_64bit_zero_reg 0 +#define cpu_has_64bit_gp_regs 0 +#define cpu_has_64bit_addresses 0 + +/* #define cpu_has_inclusive_pcaches ? */ + +#define cpu_dcache_line_size() 16 +#define cpu_icache_line_size() 16 + +#endif /* __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h new file mode 100644 index 000000000..7ba7efca1 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h @@ -0,0 +1,115 @@ +/* + * ADM5120 GPIO wrappers for arch-neutral GPIO calls + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _ASM_MIPS_MACH_ADM5120_GPIO_H +#define _ASM_MIPS_MACH_ADM5120_GPIO_H + +#define ARCH_NR_GPIOS 64 + +#include + +#include + +#define ADM5120_GPIO_PIN0 0 +#define ADM5120_GPIO_PIN1 1 +#define ADM5120_GPIO_PIN2 2 +#define ADM5120_GPIO_PIN3 3 +#define ADM5120_GPIO_PIN4 4 +#define ADM5120_GPIO_PIN5 5 +#define ADM5120_GPIO_PIN6 6 +#define ADM5120_GPIO_PIN7 7 +#define ADM5120_GPIO_P0L0 8 +#define ADM5120_GPIO_P0L1 9 +#define ADM5120_GPIO_P0L2 10 +#define ADM5120_GPIO_P1L0 11 +#define ADM5120_GPIO_P1L1 12 +#define ADM5120_GPIO_P1L2 13 +#define ADM5120_GPIO_P2L0 14 +#define ADM5120_GPIO_P2L1 15 +#define ADM5120_GPIO_P2L2 16 +#define ADM5120_GPIO_P3L0 17 +#define ADM5120_GPIO_P3L1 18 +#define ADM5120_GPIO_P3L2 19 +#define ADM5120_GPIO_P4L0 20 +#define ADM5120_GPIO_P4L1 21 +#define ADM5120_GPIO_P4L2 22 +#define ADM5120_GPIO_MAX 22 +#define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1 + +#define ADM5120_GPIO_LOW 0 +#define ADM5120_GPIO_HIGH 1 + +#define ADM5120_GPIO_SWITCH 0x10 +#define ADM5120_GPIO_FLASH (ADM5120_GPIO_SWITCH | LED_MODE_FLASH) +#define ADM5120_GPIO_LINK (ADM5120_GPIO_SWITCH | LED_MODE_LINK) +#define ADM5120_GPIO_SPEED (ADM5120_GPIO_SWITCH | LED_MODE_SPEED) +#define ADM5120_GPIO_DUPLEX (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX) +#define ADM5120_GPIO_ACT (ADM5120_GPIO_SWITCH | LED_MODE_ACT) +#define ADM5120_GPIO_COLL (ADM5120_GPIO_SWITCH | LED_MODE_COLL) +#define ADM5120_GPIO_LINK_ACT (ADM5120_GPIO_SWITCH | LED_MODE_LINK_ACT) +#define ADM5120_GPIO_DUPLEX_COLL (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX_COLL) +#define ADM5120_GPIO_10M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_10M_ACT) +#define ADM5120_GPIO_100M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_100M_ACT) + +extern int __adm5120_gpio0_get_value(unsigned gpio); +extern void __adm5120_gpio0_set_value(unsigned gpio, int value); +extern int __adm5120_gpio1_get_value(unsigned gpio); +extern void __adm5120_gpio1_set_value(unsigned gpio, int value); +extern int adm5120_gpio_to_irq(unsigned gpio); +extern int adm5120_irq_to_gpio(unsigned irq); + +static inline int gpio_get_value(unsigned gpio) +{ + int ret; + + switch (gpio) { + case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7: + ret = __adm5120_gpio0_get_value(gpio); + break; + case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2: + ret = __adm5120_gpio1_get_value(gpio - ADM5120_GPIO_P0L0); + break; + default: + ret = __gpio_get_value(gpio); + break; + } + + return ret; +} + +static inline void gpio_set_value(unsigned gpio, int value) +{ + switch (gpio) { + case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7: + __adm5120_gpio0_set_value(gpio, value); + break; + case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2: + __adm5120_gpio1_set_value(gpio - ADM5120_GPIO_P0L0, value); + break; + default: + __gpio_set_value(gpio, value); + break; + } +} + +static inline int gpio_to_irq(unsigned gpio) +{ + return adm5120_gpio_to_irq(gpio); +} + +static inline int irq_to_gpio(unsigned irq) +{ + return adm5120_irq_to_gpio(irq); +} + +#define gpio_cansleep __gpio_cansleep + +#endif /* _ASM_MIPS_MACH_ADM5120_GPIO_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h new file mode 100644 index 000000000..b0350c8b8 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h @@ -0,0 +1,43 @@ +/* + * ADM5120 specific IRQ numbers + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ +#ifndef _ASM_MIPS_MACH_ADM5120_IRQ_H +#define _ASM_MIPS_MACH_ADM5120_IRQ_H + +#define MIPS_CPU_IRQ_BASE 0 +#define NR_IRQS 24 + +#include_next + +#include + +#define NO_IRQ (-1) + +#define MIPS_CPU_IRQ_COUNT 8 +#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) + +#define ADM5120_INTC_IRQ_BASE (MIPS_CPU_IRQ_BASE + MIPS_CPU_IRQ_COUNT) +#define ADM5120_INTC_IRQ(x) (ADM5120_INTC_IRQ_BASE + (x)) + +#define ADM5120_IRQ_INTC MIPS_CPU_IRQ(2) +#define ADM5120_IRQ_COUNTER MIPS_CPU_IRQ(7) + +#define ADM5120_IRQ_TIMER ADM5120_INTC_IRQ(INTC_IRQ_TIMER) +#define ADM5120_IRQ_UART0 ADM5120_INTC_IRQ(INTC_IRQ_UART0) +#define ADM5120_IRQ_UART1 ADM5120_INTC_IRQ(INTC_IRQ_UART1) +#define ADM5120_IRQ_USBC ADM5120_INTC_IRQ(INTC_IRQ_USBC) +#define ADM5120_IRQ_GPIO2 ADM5120_INTC_IRQ(INTC_IRQ_GPIO2) +#define ADM5120_IRQ_GPIO4 ADM5120_INTC_IRQ(INTC_IRQ_GPIO4) +#define ADM5120_IRQ_PCI0 ADM5120_INTC_IRQ(INTC_IRQ_PCI0) +#define ADM5120_IRQ_PCI1 ADM5120_INTC_IRQ(INTC_IRQ_PCI1) +#define ADM5120_IRQ_PCI2 ADM5120_INTC_IRQ(INTC_IRQ_PCI2) +#define ADM5120_IRQ_SWITCH ADM5120_INTC_IRQ(INTC_IRQ_SWITCH) + +#endif /* _ASM_MIPS_MACH_ADM5120_IRQ_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h new file mode 100644 index 000000000..fa42bf714 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h @@ -0,0 +1,17 @@ +/* + * ADMBoot specific definitions + * + * Copyright (C) 2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _ADMBOOT_H +#define _ADMBOOT_H + +extern int admboot_get_mac_base(u32 offset, u32 len, u8 *mac) __init; + +#endif /* _ADMBOOT_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h new file mode 100644 index 000000000..0cb3eee70 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h @@ -0,0 +1,18 @@ +/* + * Broadcom's CFE definitions + * + * Copyright (C) 2006-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _PROM_CFE_H_ +#define _PROM_CFE_H_ + +extern int cfe_present(void) __init; +extern char *cfe_getenv(char *); + +#endif /*_PROM_CFE_H_*/ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h new file mode 100644 index 000000000..778df2467 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h @@ -0,0 +1,18 @@ +/* + * Generic prom definitions + * + * Copyright (C) 2006-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _PROM_GENERIC_H_ +#define _PROM_GENERIC_H_ + +extern int generic_prom_present(void) __init; +extern char *generic_prom_getenv(char *); + +#endif /*_PROM_GENERIC_H_*/ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h new file mode 100644 index 000000000..ea8db81ed --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h @@ -0,0 +1,179 @@ +/* + * Compex's MyLoader specific definitions + * + * Copyright (C) 2006-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _MYLOADER_H_ +#define _MYLOADER_H_ + +/* + * Firmware file format: + * + *
+ * [] + * ... + * [] + * + * [] + * ... + * [] + * + * + */ + +/* Myloader specific magic numbers */ +#define MYLO_MAGIC_FIRMWARE 0x4C594D00 +#define MYLO_MAGIC_20021103 0x20021103 +#define MYLO_MAGIC_20021107 0x20021107 + +#define MYLO_MAGIC_SYS_PARAMS MYLO_MAGIC_20021107 +#define MYLO_MAGIC_PARTITIONS MYLO_MAGIC_20021103 +#define MYLO_MAGIC_BOARD_PARAMS MYLO_MAGIC_20021103 + +/* + * Addresses of the data structures provided by MyLoader + */ +#define MYLO_MIPS_SYS_PARAMS 0x80000800 /* System Parameters */ +#define MYLO_MIPS_BOARD_PARAMS 0x80000A00 /* Board Parameters */ +#define MYLO_MIPS_PARTITIONS 0x80000C00 /* Partition Table */ +#define MYLO_MIPS_BOOT_PARAMS 0x80000E00 /* Boot Parameters */ + +/* Vendor ID's (seems to be same as the PCI vendor ID's) */ +#define VENID_COMPEX 0x11F6 + +/* Devices based on the ADM5120 */ +#define DEVID_COMPEX_NP27G 0x0078 +#define DEVID_COMPEX_NP28G 0x044C +#define DEVID_COMPEX_NP28GHS 0x044E +#define DEVID_COMPEX_WP54Gv1C 0x0514 +#define DEVID_COMPEX_WP54G 0x0515 +#define DEVID_COMPEX_WP54AG 0x0546 +#define DEVID_COMPEX_WPP54AG 0x0550 +#define DEVID_COMPEX_WPP54G 0x0555 + +/* Devices based on the IXP422 */ +#define DEVID_COMPEX_WP18 0x047E +#define DEVID_COMPEX_NP18A 0x0489 + +/* Other devices */ +#define DEVID_COMPEX_NP26G8M 0x03E8 +#define DEVID_COMPEX_NP26G16M 0x03E9 + +struct mylo_fw_header { + uint32_t magic; /* must be MYLO_MAGIC_FIRMWARE */ + uint32_t crc; /* CRC of the whole firmware */ + uint32_t res0; /* unknown/unused */ + uint32_t res1; /* unknown/unused */ + uint16_t vid; /* vendor ID */ + uint16_t did; /* device ID */ + uint16_t svid; /* sub vendor ID */ + uint16_t sdid; /* sub device ID */ + uint32_t rev; /* device revision */ + uint32_t fwhi; /* FIXME: firmware version high? */ + uint32_t fwlo; /* FIXME: firmware version low? */ + uint32_t flags; /* firmware flags */ +}; + +#define FW_FLAG_BOARD_PARAMS_WP 0x01 /* board parameters are write protected */ +#define FW_FLAG_BOOT_SECTOR_WE 0x02 /* enable of write boot sectors (below 64K) */ + +struct mylo_fw_blockdesc { + uint32_t type; /* block type */ + uint32_t addr; /* relative address to flash start */ + uint32_t dlen; /* size of block data in bytes */ + uint32_t blen; /* total size of block in bytes */ +}; + +#define FW_DESC_TYPE_UNUSED 0 +#define FW_DESC_TYPE_USED 1 + +struct mylo_partition { + uint16_t flags; /* partition flags */ + uint16_t type; /* type of the partition */ + uint32_t addr; /* relative address of the partition from the + flash start */ + uint32_t size; /* size of the partition in bytes */ + uint32_t param; /* if this is the active partition, the + MyLoader load code to this address */ +}; + +#define PARTITION_FLAG_ACTIVE 0x8000 /* this is the active partition, + * MyLoader loads firmware from here */ +#define PARTITION_FLAG_ISRAM 0x2000 /* FIXME: this is a RAM partition? */ +#define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */ +#define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM + * before decompression */ +#define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */ + +#define PARTITION_TYPE_FREE 0 +#define PARTITION_TYPE_USED 1 + +#define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the + partition table */ + +struct mylo_partition_table { + uint32_t magic; /* must be MYLO_MAGIC_PARTITIONS */ + uint32_t res0; /* unknown/unused */ + uint32_t res1; /* unknown/unused */ + uint32_t res2; /* unknown/unused */ + struct mylo_partition partitions[MYLO_MAX_PARTITIONS]; +}; + +struct mylo_partition_header { + uint32_t len; /* length of the partition data */ + uint32_t crc; /* CRC value of the partition data */ +}; + +struct mylo_system_params { + uint32_t magic; /* must be MYLO_MAGIC_SYS_PARAMS */ + uint32_t res0; + uint32_t res1; + uint32_t mylo_ver; + uint16_t vid; /* Vendor ID */ + uint16_t did; /* Device ID */ + uint16_t svid; /* Sub Vendor ID */ + uint16_t sdid; /* Sub Device ID */ + uint32_t rev; /* device revision */ + uint32_t fwhi; + uint32_t fwlo; + uint32_t tftp_addr; + uint32_t prog_start; + uint32_t flash_size; /* Size of boot FLASH in bytes */ + uint32_t dram_size; /* Size of onboard RAM in bytes */ +}; + + +struct mylo_eth_addr { + uint8_t mac[6]; + uint8_t csum[2]; +}; + +#define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address + in the board parameters */ + +struct mylo_board_params { + uint32_t magic; /* must be MYLO_MAGIC_BOARD_PARAMS */ + uint32_t res0; + uint32_t res1; + uint32_t res2; + struct mylo_eth_addr addr[MYLO_ETHADDR_COUNT]; +}; + +struct myloader_info { + u32 vid; + u32 did; + u32 svid; + u32 sdid; + uint8_t macs[MYLO_ETHADDR_COUNT][6]; +}; + +extern struct myloader_info myloader_info; +extern int myloader_present(void) __init; + +#endif /* _MYLOADER_H_*/ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h new file mode 100644 index 000000000..91ac05a63 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h @@ -0,0 +1,36 @@ +/* + * Mikrotik's RouterBOOT definitions + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _PROM_ROUTERBOOT_H_ +#define _PROM_ROUTERBOOT_H_ + +struct rb_bios_settings { + u32 hs_offs; /* hard settings offset */ + u32 hs_size; /* hard settings size */ + u32 fw_offs; /* firmware offset */ + u32 ss_offs; /* soft settings offset */ + u32 ss_size; /* soft settings size */ +}; + +struct rb_hard_settings { + char *name; /* board name */ + char *bios_ver; /* BIOS version */ + u32 mem_size; /* memory size in bytes */ + u32 mac_count; /* number of mac addresses */ + u8 *mac_base; /* mac address base */ +}; + +extern int routerboot_present(void) __init; +extern char *routerboot_get_boardname(void); + +extern struct rb_hard_settings rb_hs; + +#endif /* _PROM_ROUTERBOOT_H_ */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h new file mode 100644 index 000000000..d1e3e5b94 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h @@ -0,0 +1,86 @@ +/* + * ZyNOS (ZyXEL's Networking OS) definitions + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#ifndef _ZYNOS_H +#define _ZYNOS_H + +#define ZYNOS_NAME_LEN 32 +#define ZYNOS_FEAT_BYTES 22 +#define ZYNOS_MAC_LEN 6 + +struct zynos_board_info { + unsigned char vendor[ZYNOS_NAME_LEN]; + unsigned char product[ZYNOS_NAME_LEN]; + u32 bootext_addr; + u32 res0; + u16 board_id; + u8 res1[6]; + u8 feat_other[ZYNOS_FEAT_BYTES]; + u8 feat_main; + u8 res2; + u8 mac[ZYNOS_MAC_LEN]; + u8 country; + u8 dbgflag; +} __attribute__ ((packed)); + +/* + * Vendor IDs + */ +#define ZYNOS_VENDOR_ID_ZYXEL 0 +#define ZYNOS_VENDOR_ID_NETGEAR 1 +#define ZYNOS_VENDOR_ID_DLINK 2 +#define ZYNOS_VENDOR_ID_OTHER 3 +#define ZYNOS_VENDOR_ID_LUCENT 4 + +/* + * Vendor names + */ +#define ZYNOS_VENDOR_DLINK "D-Link" +#define ZYNOS_VENDOR_LUCENT "LUCENT" +#define ZYNOS_VENDOR_NETGEAR "NetGear" +#define ZYNOS_VENDOR_ZYXEL "ZyXEL" + +/* + * Board IDs (big-endian) + */ +#define ZYNOS_BOARD_ES2108 0x00F2 /* Ethernet Switch 2108 */ +#define ZYNOS_BOARD_ES2108F 0x01AF /* Ethernet Switch 2108-F */ +#define ZYNOS_BOARD_ES2108G 0x00F3 /* Ethernet Switch 2108-G */ +#define ZYNOS_BOARD_ES2108LC 0x00FC /* Ethernet Switch 2108-LC */ +#define ZYNOS_BOARD_ES2108PWR 0x00F4 /* Ethernet Switch 2108PWR */ +#define ZYNOS_BOARD_HS100 0x9FF1 /* HomeSafe 100/100W */ +#define ZYNOS_BOARD_P334 0x9FF5 /* Prestige 334 */ +#define ZYNOS_BOARD_P334U 0x9FDD /* Prestige 334U */ +#define ZYNOS_BOARD_P334W 0x9FF3 /* Prestige 334W */ +#define ZYNOS_BOARD_P334WH 0x00E0 /* Prestige 334WH */ +#define ZYNOS_BOARD_P334WHD 0x00E1 /* Prestige 334WHD */ +#define ZYNOS_BOARD_P334WT 0x9FEF /* Prestige 334WT */ +#define ZYNOS_BOARD_P334WT_ALT 0x9F02 /* Prestige 334WT alternative*/ +#define ZYNOS_BOARD_P335 0x9FED /* Prestige 335/335WT */ +#define ZYNOS_BOARD_P335PLUS 0x0025 /* Prestige 335Plus */ +#define ZYNOS_BOARD_P335U 0x9FDC /* Prestige 335U */ + +/* + * Some magic numbers (big-endian) + */ +#define ZYNOS_MAGIC_DBGAREA1 0x48646267 /* "Hdbg" */ +#define ZYNOS_MAGIC_DBGAREA2 0x61726561 /* "area" */ + +struct bootbase_info { + u16 vendor_id; + u16 board_id; + u8 mac[6]; +}; + +extern struct bootbase_info bootbase_info; +extern int bootbase_present(void) __init; + +#endif /* _ZYNOS_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h new file mode 100644 index 000000000..87c35f375 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h @@ -0,0 +1,25 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2002, 2004, 2007 by Ralf Baechle + */ +#ifndef __ASM_MIPS_MACH_ADM5120_WAR_H +#define __ASM_MIPS_MACH_ADM5120_WAR_H + +#define R4600_V1_INDEX_ICACHEOP_WAR 0 +#define R4600_V1_HIT_CACHEOP_WAR 0 +#define R4600_V2_HIT_CACHEOP_WAR 0 +#define R5432_CP0_INTERRUPT_WAR 0 +#define BCM1250_M3_WAR 0 +#define SIBYTE_1956_WAR 0 +#define MIPS4K_ICACHE_REFILL_WAR 0 +#define MIPS_CACHE_SYNC_WAR 0 +#define TX49XX_ICACHE_INDEX_INV_WAR 0 +#define RM9000_CDEX_SMP_WAR 0 +#define ICACHE_REFILLS_WORKAROUND_WAR 0 +#define R10000_LLSC_WAR 0 +#define MIPS34K_MISSED_ITLB_WAR 0 + +#endif /* __ASM_MIPS_MACH_ADM5120_WAR_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c b/target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c new file mode 100644 index 000000000..f8d359806 --- /dev/null +++ b/target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c @@ -0,0 +1,277 @@ +/* + * ADM5120 PCI Host Controller driver + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel + * done by Jeroen Vreeken + * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org) + * + * Jeroen's code was based on the Linux 2.4.xx source codes found in various + * tarballs released by Edimax for it's ADM5120 based devices + * Copyright (C) ADMtek Incorporated + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#undef DEBUG + +#ifdef DEBUG +#define DBG(f, a...) printk(KERN_DEBUG f, ## a) +#else +#define DBG(f, a...) do {} while (0) +#endif + +#define PCI_ENABLE 0x80000000 + +/* -------------------------------------------------------------------------*/ + +static unsigned int adm5120_pci_nr_irqs __initdata; +static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata; + +static DEFINE_SPINLOCK(pci_lock); + +/* -------------------------------------------------------------------------*/ + +static inline void write_cfgaddr(u32 addr) +{ + __raw_writel((addr | PCI_ENABLE), + (void __iomem *)(KSEG1ADDR(ADM5120_PCICFG_ADDR))); +} + +static inline void write_cfgdata(u32 data) +{ + __raw_writel(data, (void __iomem *)KSEG1ADDR(ADM5120_PCICFG_DATA)); +} + +static inline u32 read_cfgdata(void) +{ + return __raw_readl((void __iomem *)KSEG1ADDR(ADM5120_PCICFG_DATA)); +} + +static inline u32 mkaddr(struct pci_bus *bus, unsigned int devfn, int where) +{ + return ((bus->number & 0xFF) << 16) | ((devfn & 0xFF) << 8) | \ + (where & 0xFC); +} + +/* -------------------------------------------------------------------------*/ + +static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, + int size, u32 *val) +{ + unsigned long flags; + u32 data; + + spin_lock_irqsave(&pci_lock, flags); + + write_cfgaddr(mkaddr(bus, devfn, where)); + data = read_cfgdata(); + + DBG("PCI: cfg_read %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", + bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), + where, size, data); + + switch (size) { + case 1: + if (where & 1) + data >>= 8; + if (where & 2) + data >>= 16; + data &= 0xFF; + break; + case 2: + if (where & 2) + data >>= 16; + data &= 0xFFFF; + break; + } + + *val = data; + DBG(", 0x%08X returned\n", data); + + spin_unlock_irqrestore(&pci_lock, flags); + + return PCIBIOS_SUCCESSFUL; +} + +static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, + int size, u32 val) +{ + unsigned long flags; + u32 data; + int s; + + spin_lock_irqsave(&pci_lock, flags); + + write_cfgaddr(mkaddr(bus, devfn, where)); + data = read_cfgdata(); + + DBG("PCI: cfg_write %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", + bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), + where, size, data); + + switch (size) { + case 1: + s = ((where & 3) << 3); + data &= ~(0xFF << s); + data |= ((val & 0xFF) << s); + break; + case 2: + s = ((where & 2) << 4); + data &= ~(0xFFFF << s); + data |= ((val & 0xFFFF) << s); + break; + case 4: + data = val; + break; + } + + write_cfgdata(data); + DBG(", 0x%08X written\n", data); + + spin_unlock_irqrestore(&pci_lock, flags); + + return PCIBIOS_SUCCESSFUL; +} + +struct pci_ops adm5120_pci_ops = { + .read = pci_config_read, + .write = pci_config_write, +}; + +/* -------------------------------------------------------------------------*/ + +static void adm5120_pci_fixup(struct pci_dev *dev) +{ + if (dev->devfn != 0) + return; + + /* setup COMMAND register */ + pci_write_config_word(dev, PCI_COMMAND, + (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)); + + /* setup CACHE_LINE_SIZE register */ + pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4); + + /* setup BARS */ + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0); + pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0); +} + +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_ADM5120, + adm5120_pci_fixup); + +/* -------------------------------------------------------------------------*/ + +void __init adm5120_pci_set_irq_map(unsigned int nr_irqs, + struct adm5120_pci_irq *map) +{ + adm5120_pci_nr_irqs = nr_irqs; + adm5120_pci_irq_map = map; +} + +int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ + int irq = -1; + int i; + + if ((!adm5120_pci_nr_irqs) || (!adm5120_pci_irq_map)) { + printk(KERN_ALERT "PCI: pci_irq_map is not initialized\n"); + goto out; + } + + if (slot < 1 || slot > 4) { + printk(KERN_ALERT "PCI: slot number %u is not supported\n", + slot); + goto out; + } + + for (i = 0; i < adm5120_pci_nr_irqs; i++) { + if ((adm5120_pci_irq_map[i].slot == slot) + && (adm5120_pci_irq_map[i].func == PCI_FUNC(dev->devfn)) + && (adm5120_pci_irq_map[i].pin == pin)) { + irq = adm5120_pci_irq_map[i].irq; + break; + } + } + + if (irq < 0) { + printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n", + pci_name((struct pci_dev *)dev), pin); + } else { + printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n", + pci_name((struct pci_dev *)dev), pin, irq); + } + +out: + return irq; +} + +int pcibios_plat_dev_init(struct pci_dev *dev) +{ + return 0; +} + +/* -------------------------------------------------------------------------*/ + +static struct resource pci_io_resource = { + .name = "ADM5120 PCI I/O", + .start = ADM5120_PCIIO_BASE, + .end = ADM5120_PCICFG_ADDR-1, + .flags = IORESOURCE_IO +}; + +static struct resource pci_mem_resource = { + .name = "ADM5120 PCI MEM", + .start = ADM5120_PCIMEM_BASE, + .end = ADM5120_PCIIO_BASE-1, + .flags = IORESOURCE_MEM +}; + +static struct pci_controller adm5120_controller = { + .pci_ops = &adm5120_pci_ops, + .io_resource = &pci_io_resource, + .mem_resource = &pci_mem_resource, +}; + +static int __init adm5120_pci_setup(void) +{ + if (adm5120_package_pqfp()) { + printk(KERN_INFO "PCI: not available on ADM5120P\n"); + return -1; + } + + /* Avoid ISA compat ranges. */ + PCIBIOS_MIN_IO = 0x00000000; + PCIBIOS_MIN_MEM = 0x00000000; + + /* Set I/O resource limits. */ + ioport_resource.end = 0x1fffffff; + iomem_resource.end = 0xffffffff; + + register_pci_controller(&adm5120_controller); + return 0; +} + +arch_initcall(adm5120_pci_setup); diff --git a/target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c b/target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c new file mode 100644 index 000000000..92a4d1390 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c @@ -0,0 +1,267 @@ +/* + * A low-level PATA driver to handle a Compact Flash connected on the + * Mikrotik's RouterBoard 153 board. + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was based on: drivers/ata/pata_ixp4xx_cf.c + * Copyright (C) 2006-07 Tower Technologies + * Author: Alessandro Zummo + * + * Also was based on the driver for Linux 2.4.xx published by Mikrotik for + * their RouterBoard 1xx and 5xx series devices. The original Mikrotik code + * seems not to have a license. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define DRV_NAME "pata-rb153-cf" +#define DRV_VERSION "0.5.0" +#define DRV_DESC "PATA driver for RouterBOARD 153 Compact Flash" + +#define RB153_CF_MAXPORTS 1 +#define RB153_CF_IO_DELAY 100 + +#define RB153_CF_REG_CMD 0x0800 +#define RB153_CF_REG_CTRL 0x080E +#define RB153_CF_REG_DATA 0x0C00 + +struct rb153_cf_info { + void __iomem *iobase; + unsigned int gpio_line; + int frozen; + unsigned int irq; +}; + +static inline void rb153_pata_finish_io(struct ata_port *ap) +{ + struct rb153_cf_info *info = ap->host->private_data; + + /* FIXME: Keep previous delay. If this is merely a fence then + * ata_sff_sync might be sufficient. */ + ata_sff_dma_pause(ap); + ndelay(RB153_CF_IO_DELAY); + + irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); +} + +static void rb153_pata_exec_command(struct ata_port *ap, + const struct ata_taskfile *tf) +{ + writeb(tf->command, ap->ioaddr.command_addr); + rb153_pata_finish_io(ap); +} + +static unsigned int rb153_pata_data_xfer(struct ata_device *adev, + unsigned char *buf, + unsigned int buflen, + int write_data) +{ + void __iomem *ioaddr = adev->link->ap->ioaddr.data_addr; + unsigned int t; + + t = buflen; + if (write_data) { + for (; t > 0; t--, buf++) + writeb(*buf, ioaddr); + } else { + for (; t > 0; t--, buf++) + *buf = readb(ioaddr); + } + + rb153_pata_finish_io(adev->link->ap); + return buflen; +} + +static void rb153_pata_freeze(struct ata_port *ap) +{ + struct rb153_cf_info *info = ap->host->private_data; + + info->frozen = 1; +} + +static void rb153_pata_thaw(struct ata_port *ap) +{ + struct rb153_cf_info *info = ap->host->private_data; + + info->frozen = 0; +} + +static irqreturn_t rb153_pata_irq_handler(int irq, void *dev_instance) +{ + struct ata_host *ah = dev_instance; + struct rb153_cf_info *info = ah->private_data; + + if (gpio_get_value(info->gpio_line)) { + irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); + if (!info->frozen) + ata_sff_interrupt(irq, dev_instance); + } else { + irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); + } + + return IRQ_HANDLED; +} + +static struct ata_port_operations rb153_pata_port_ops = { + .inherits = &ata_sff_port_ops, + .sff_exec_command = rb153_pata_exec_command, + .sff_data_xfer = rb153_pata_data_xfer, + .freeze = rb153_pata_freeze, + .thaw = rb153_pata_thaw, +}; + +static struct scsi_host_template rb153_pata_sht = { + ATA_PIO_SHT(DRV_NAME), +}; + +static void rb153_pata_setup_port(struct ata_host *ah) +{ + struct rb153_cf_info *info = ah->private_data; + struct ata_port *ap; + + ap = ah->ports[0]; + + ap->ops = &rb153_pata_port_ops; + ap->pio_mask = 0x1f; /* PIO4 */ + + ap->ioaddr.cmd_addr = info->iobase + RB153_CF_REG_CMD; + ap->ioaddr.ctl_addr = info->iobase + RB153_CF_REG_CTRL; + ap->ioaddr.altstatus_addr = info->iobase + RB153_CF_REG_CTRL; + + ata_sff_std_ports(&ap->ioaddr); + + ap->ioaddr.data_addr = info->iobase + RB153_CF_REG_DATA; +} + +static int rb153_pata_driver_probe(struct platform_device *pdev) +{ + unsigned int irq; + int gpio; + struct resource *res; + struct ata_host *ah; + struct rb153_cf_info *info; + int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "no IOMEM resource found\n"); + return -EINVAL; + } + + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { + dev_err(&pdev->dev, "no IRQ resource found\n"); + return -ENOENT; + } + + gpio = irq_to_gpio(irq); + if (gpio < 0) { + dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq); + return -ENOENT; + } + + ret = gpio_request(gpio, DRV_NAME); + if (ret) { + dev_err(&pdev->dev, "GPIO request failed\n"); + return ret; + } + + ah = ata_host_alloc(&pdev->dev, RB153_CF_MAXPORTS); + if (!ah) + return -ENOMEM; + + platform_set_drvdata(pdev, ah); + + info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + ah->private_data = info; + info->gpio_line = gpio; + info->irq = irq; + + info->iobase = devm_ioremap_nocache(&pdev->dev, res->start, + res->end - res->start + 1); + if (!info->iobase) + return -ENOMEM; + + ret = gpio_direction_input(gpio); + if (ret) { + dev_err(&pdev->dev, "unable to set GPIO direction, err=%d\n", + ret); + goto err_free_gpio; + } + + rb153_pata_setup_port(ah); + + ret = ata_host_activate(ah, irq, rb153_pata_irq_handler, + IRQF_TRIGGER_LOW, &rb153_pata_sht); + if (ret) + goto err_free_gpio; + + return 0; + +err_free_gpio: + gpio_free(gpio); + + return ret; +} + +static int rb153_pata_driver_remove(struct platform_device *pdev) +{ + struct ata_host *ah = platform_get_drvdata(pdev); + struct rb153_cf_info *info = ah->private_data; + + ata_host_detach(ah); + gpio_free(info->gpio_line); + + return 0; +} + +static struct platform_driver rb153_pata_platform_driver = { + .probe = rb153_pata_driver_probe, + .remove = rb153_pata_driver_remove, + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, +}; + +/* ------------------------------------------------------------------------ */ + +#define DRV_INFO DRV_DESC " version " DRV_VERSION + +static int __init rb153_pata_module_init(void) +{ + printk(KERN_INFO DRV_INFO "\n"); + + return platform_driver_register(&rb153_pata_platform_driver); +} + +static void __exit rb153_pata_module_exit(void) +{ + platform_driver_unregister(&rb153_pata_platform_driver); +} + +MODULE_AUTHOR("Gabor Juhos "); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_VERSION(DRV_VERSION); +MODULE_LICENSE("GPL v2"); + +module_init(rb153_pata_module_init); +module_exit(rb153_pata_module_exit); diff --git a/target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c b/target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c new file mode 100644 index 000000000..23a54a0b9 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c @@ -0,0 +1,149 @@ +/* + * LED ADM5120 Switch Port State Trigger + * + * Copyright (C) 2007 Bernhard Held + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was based on: drivers/leds/ledtrig-timer.c + * Copyright 2005-2006 Openedhand Ltd. + * Author: Richard Purdie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +#include + +#include "leds.h" + +#define DRV_NAME "port_state" +#define DRV_DESC "LED ADM5120 Switch Port State Trigger" + +struct port_state { + char *name; + unsigned int value; +}; + +#define PORT_STATE(n, v) {.name = (n), .value = (v)} + +static struct port_state port_states[] = { + PORT_STATE("off", LED_OFF), + PORT_STATE("on", LED_FULL), + PORT_STATE("flash", ADM5120_GPIO_FLASH), + PORT_STATE("link", ADM5120_GPIO_LINK), + PORT_STATE("speed", ADM5120_GPIO_SPEED), + PORT_STATE("duplex", ADM5120_GPIO_DUPLEX), + PORT_STATE("act", ADM5120_GPIO_ACT), + PORT_STATE("coll", ADM5120_GPIO_COLL), + PORT_STATE("link_act", ADM5120_GPIO_LINK_ACT), + PORT_STATE("duplex_coll", ADM5120_GPIO_DUPLEX_COLL), + PORT_STATE("10M_act", ADM5120_GPIO_10M_ACT), + PORT_STATE("100M_act", ADM5120_GPIO_100M_ACT), +}; + +static ssize_t led_port_state_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct port_state *state = led_cdev->trigger_data; + int len = 0; + int i; + + *buf = '\0'; + for (i = 0; i < ARRAY_SIZE(port_states); i++) { + if (&port_states[i] == state) + len += sprintf(buf+len, "[%s] ", port_states[i].name); + else + len += sprintf(buf+len, "%s ", port_states[i].name); + } + len += sprintf(buf+len, "\n"); + + return len; +} + +static ssize_t led_port_state_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + size_t len; + int i; + + for (i = 0; i < ARRAY_SIZE(port_states); i++) { + len = strlen(port_states[i].name); + if (strncmp(port_states[i].name, buf, len) != 0) + continue; + + if (buf[len] != '\0' && buf[len] != '\n') + continue; + + led_cdev->trigger_data = &port_states[i]; + led_set_brightness(led_cdev, port_states[i].value); + return size; + } + + return -EINVAL; +} + +static DEVICE_ATTR(port_state, 0644, led_port_state_show, + led_port_state_store); + +static void adm5120_switch_trig_activate(struct led_classdev *led_cdev) +{ + struct port_state *state = port_states; + int rc; + + led_cdev->trigger_data = state; + + rc = device_create_file(led_cdev->dev, &dev_attr_port_state); + if (rc) + goto err; + + led_set_brightness(led_cdev, state->value); + + return; +err: + led_cdev->trigger_data = NULL; +} + +static void adm5120_switch_trig_deactivate(struct led_classdev *led_cdev) +{ + struct port_state *state = led_cdev->trigger_data; + + if (!state) + return; + + device_remove_file(led_cdev->dev, &dev_attr_port_state); + +} + +static struct led_trigger adm5120_switch_led_trigger = { + .name = DRV_NAME, + .activate = adm5120_switch_trig_activate, + .deactivate = adm5120_switch_trig_deactivate, +}; + +static int __init adm5120_switch_trig_init(void) +{ + led_trigger_register(&adm5120_switch_led_trigger); + return 0; +} + +static void __exit adm5120_switch_trig_exit(void) +{ + led_trigger_unregister(&adm5120_switch_led_trigger); +} + +module_init(adm5120_switch_trig_init); +module_exit(adm5120_switch_trig_exit); + +MODULE_AUTHOR("Bernhard Held , " + "Gabor Juhos "); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_LICENSE("GPL v2"); diff --git a/target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c b/target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c new file mode 100644 index 000000000..f6a86f489 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c @@ -0,0 +1,482 @@ +/* + * Platform driver for NOR flash devices on ADM5120 based boards + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/mtd/map/physmap.c + * Copyright (C) 2003 MontaVista Software Inc. + * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#define DRV_NAME "adm5120-flash" +#define DRV_DESC "ADM5120 flash MAP driver" +#define MAX_PARSED_PARTS 8 + +#ifdef ADM5120_FLASH_DEBUG +#define MAP_DBG(m, f, a...) printk(KERN_INFO "%s: " f, (m->name) , ## a) +#else +#define MAP_DBG(m, f, a...) do {} while (0) +#endif +#define MAP_ERR(m, f, a...) printk(KERN_ERR "%s: " f, (m->name) , ## a) +#define MAP_INFO(m, f, a...) printk(KERN_INFO "%s: " f, (m->name) , ## a) + +struct adm5120_map_info { + struct map_info map; + void (*switch_bank)(unsigned); + unsigned long window_size; +}; + +struct adm5120_flash_info { + struct mtd_info *mtd; + struct resource *res; + struct platform_device *dev; + struct adm5120_map_info amap; +}; + +struct flash_desc { + u32 phys; + u32 srs_shift; +}; + +/* + * Globals + */ +static DEFINE_SPINLOCK(adm5120_flash_spin); +#define FLASH_LOCK() spin_lock(&adm5120_flash_spin) +#define FLASH_UNLOCK() spin_unlock(&adm5120_flash_spin) + +static u32 flash_bankwidths[4] = { 1, 2, 4, 0 }; + +static u32 flash_sizes[8] = { + 0, 512*1024, 1024*1024, 2*1024*1024, + 4*1024*1024, 0, 0, 0 +}; + +static struct flash_desc flash_descs[2] = { + { + .phys = ADM5120_SRAM0_BASE, + .srs_shift = MEMCTRL_SRS0_SHIFT, + }, { + .phys = ADM5120_SRAM1_BASE, + .srs_shift = MEMCTRL_SRS1_SHIFT, + } +}; + +static const char const *probe_types[] = { + "cfi_probe", + "jedec_probe", + "map_rom", + NULL +}; + +static const char const *parse_types[] = { + "cmdlinepart", +#ifdef CONFIG_MTD_REDBOOT_PARTS + "RedBoot", +#endif +#ifdef CONFIG_MTD_MYLOADER_PARTS + "MyLoader", +#endif + NULL, +}; + +#define BANK_SIZE (2<<20) +#define BANK_SIZE_MAX (4<<20) +#define BANK_OFFS_MASK (BANK_SIZE-1) +#define BANK_START_MASK (~BANK_OFFS_MASK) + +static inline struct adm5120_map_info *map_to_amap(struct map_info *map) +{ + return (struct adm5120_map_info *)map; +} + +static void adm5120_flash_switchbank(struct map_info *map, + unsigned long ofs) +{ + struct adm5120_map_info *amap = map_to_amap(map); + unsigned bank; + + if (amap->switch_bank == NULL) + return; + + bank = (ofs & BANK_START_MASK) >> 21; + if (bank > 1) + BUG(); + + MAP_DBG(map, "switching to bank %u, ofs=%lX\n", bank, ofs); + amap->switch_bank(bank); +} + +static map_word adm5120_flash_read(struct map_info *map, unsigned long ofs) +{ + struct adm5120_map_info *amap = map_to_amap(map); + map_word ret; + + MAP_DBG(map, "reading from ofs %lX\n", ofs); + + if (ofs >= amap->window_size) + return map_word_ff(map); + + FLASH_LOCK(); + adm5120_flash_switchbank(map, ofs); + ret = inline_map_read(map, (ofs & (amap->window_size-1))); + FLASH_UNLOCK(); + + return ret; +} + +static void adm5120_flash_write(struct map_info *map, const map_word datum, + unsigned long ofs) +{ + struct adm5120_map_info *amap = map_to_amap(map); + + MAP_DBG(map, "writing to ofs %lX\n", ofs); + + if (ofs > amap->window_size) + return; + + FLASH_LOCK(); + adm5120_flash_switchbank(map, ofs); + inline_map_write(map, datum, (ofs & (amap->window_size-1))); + FLASH_UNLOCK(); +} + +static void adm5120_flash_copy_from(struct map_info *map, void *to, + unsigned long from, ssize_t len) +{ + struct adm5120_map_info *amap = map_to_amap(map); + char *p; + ssize_t t; + + MAP_DBG(map, "copy_from, to=%lX, from=%lX, len=%lX\n", + (unsigned long)to, from, (unsigned long)len); + + if (from > amap->window_size) + return; + + p = (char *)to; + while (len > 0) { + t = len; + if ((from < BANK_SIZE) && ((from+len) > BANK_SIZE)) + t = BANK_SIZE-from; + + FLASH_LOCK(); + MAP_DBG(map, "copying %lu byte(s) from %lX to %lX\n", + (unsigned long)t, (from & (amap->window_size-1)), + (unsigned long)p); + adm5120_flash_switchbank(map, from); + inline_map_copy_from(map, p, (from & (amap->window_size-1)), t); + FLASH_UNLOCK(); + p += t; + from += t; + len -= t; + } +} + +static int adm5120_flash_initres(struct adm5120_flash_info *info) +{ + struct map_info *map = &info->amap.map; + int err = 0; + + info->res = request_mem_region(map->phys, info->amap.window_size, + map->name); + if (info->res == NULL) { + MAP_ERR(map, "could not reserve memory region\n"); + err = -ENOMEM; + goto out; + } + + map->virt = ioremap_nocache(map->phys, info->amap.window_size); + if (map->virt == NULL) { + MAP_ERR(map, "failed to ioremap flash region\n"); + err = -ENOMEM; + goto out; + } + +out: + return err; +} + +static int adm5120_flash_initinfo(struct adm5120_flash_info *info, + struct platform_device *dev) +{ + struct map_info *map = &info->amap.map; + struct adm5120_flash_platform_data *pdata = dev->dev.platform_data; + struct flash_desc *fdesc; + u32 t = 0; + + map->name = dev_name(&dev->dev); + + if (dev->id > 1) { + MAP_ERR(map, "invalid flash id\n"); + goto err_out; + } + + fdesc = &flash_descs[dev->id]; + + if (pdata) + info->amap.window_size = pdata->window_size; + + if (info->amap.window_size == 0) { + /* get memory window size */ + t = SW_READ_REG(SWITCH_REG_MEMCTRL) >> fdesc->srs_shift; + t &= MEMCTRL_SRS_MASK; + info->amap.window_size = flash_sizes[t]; + } + + if (info->amap.window_size == 0) { + MAP_ERR(map, "unable to determine window size\n"); + goto err_out; + } + + /* get flash bus width */ + switch (dev->id) { + case 0: + t = MPMC_READ_REG(SC1) & SC_MW_MASK; + break; + case 1: + t = MPMC_READ_REG(SC0) & SC_MW_MASK; + break; + } + map->bankwidth = flash_bankwidths[t]; + if (map->bankwidth == 0) { + MAP_ERR(map, "invalid bus width detected\n"); + goto err_out; + } + + map->phys = fdesc->phys; + map->size = BANK_SIZE_MAX; + + simple_map_init(map); + map->read = adm5120_flash_read; + map->write = adm5120_flash_write; + map->copy_from = adm5120_flash_copy_from; + + if (pdata) { + map->set_vpp = pdata->set_vpp; + info->amap.switch_bank = pdata->switch_bank; + } + + info->dev = dev; + + MAP_INFO(map, "probing at 0x%lX, size:%ldKiB, width:%d bits\n", + (unsigned long)map->phys, + (unsigned long)info->amap.window_size >> 10, + map->bankwidth*8); + + return 0; + +err_out: + return -ENODEV; +} + +static void adm5120_flash_initbanks(struct adm5120_flash_info *info) +{ + struct map_info *map = &info->amap.map; + + if (info->mtd->size <= BANK_SIZE) + /* no bank switching needed */ + return; + + if (info->amap.switch_bank) { + info->amap.window_size = info->mtd->size; + return; + } + + MAP_ERR(map, "reduce visibility from %ldKiB to %ldKiB\n", + (unsigned long)map->size >> 10, + (unsigned long)info->mtd->size >> 10); + + info->mtd->size = info->amap.window_size; +} + +static int adm5120_flash_remove(struct platform_device *dev) +{ + struct adm5120_flash_info *info; + + info = platform_get_drvdata(dev); + if (info == NULL) + return 0; + + platform_set_drvdata(dev, NULL); + + if (info->mtd != NULL) { + mtd_device_unregister(info->mtd); + map_destroy(info->mtd); + } + + if (info->amap.map.virt != NULL) + iounmap(info->amap.map.virt); + + if (info->res != NULL) { + release_resource(info->res); + kfree(info->res); + } + + return 0; +} + +static int adm5120_flash_probe(struct platform_device *dev) +{ + struct adm5120_flash_platform_data *pdata; + struct adm5120_flash_info *info; + struct map_info *map; + const char **probe_type; + int err; + + pdata = dev->dev.platform_data; + if (!pdata) { + dev_err(&dev->dev, "no platform data\n"); + return -EINVAL; + } + + info = kzalloc(sizeof(*info), GFP_KERNEL); + if (info == NULL) { + err = -ENOMEM; + goto err_out; + } + + platform_set_drvdata(dev, info); + + err = adm5120_flash_initinfo(info, dev); + if (err) + goto err_out; + + err = adm5120_flash_initres(info); + if (err) + goto err_out; + + map = &info->amap.map; + for (probe_type = probe_types; info->mtd == NULL && *probe_type != NULL; + probe_type++) + info->mtd = do_map_probe(*probe_type, map); + + if (info->mtd == NULL) { + MAP_ERR(map, "map_probe failed\n"); + err = -ENXIO; + goto err_out; + } + + adm5120_flash_initbanks(info); + + if (info->mtd->size < info->amap.window_size) { + /* readjust resources */ + iounmap(map->virt); + release_resource(info->res); + kfree(info->res); + + info->amap.window_size = info->mtd->size; + map->size = info->mtd->size; + MAP_INFO(map, "reducing map size to %ldKiB\n", + (unsigned long)map->size >> 10); + err = adm5120_flash_initres(info); + if (err) + goto err_out; + } + + MAP_INFO(map, "found at 0x%lX, size:%ldKiB, width:%d bits\n", + (unsigned long)map->phys, (unsigned long)info->mtd->size >> 10, + map->bankwidth*8); + + info->mtd->owner = THIS_MODULE; + + err = mtd_device_parse_register(info->mtd, parse_types, 0, + pdata->parts, pdata->nr_parts); + if (err) + goto err_out; + + return 0; + +err_out: + adm5120_flash_remove(dev); + return err; +} + +#ifdef CONFIG_PM +static int adm5120_flash_suspend(struct platform_device *dev, + pm_message_t state) +{ + struct adm5120_flash_info *info = platform_get_drvdata(dev); + int ret = 0; + + if (info) + ret = info->mtd->suspend(info->mtd); + + return ret; +} + +static int adm5120_flash_resume(struct platform_device *dev) +{ + struct adm5120_flash_info *info = platform_get_drvdata(dev); + + if (info) + info->mtd->resume(info->mtd); + + return 0; +} + +static void adm5120_flash_shutdown(struct platform_device *dev) +{ + struct adm5120_flash_info *info = platform_get_drvdata(dev); + + if (info && info->mtd->suspend(info->mtd) == 0) + info->mtd->resume(info->mtd); +} +#endif + +static struct platform_driver adm5120_flash_driver = { + .probe = adm5120_flash_probe, + .remove = adm5120_flash_remove, +#ifdef CONFIG_PM + .suspend = adm5120_flash_suspend, + .resume = adm5120_flash_resume, + .shutdown = adm5120_flash_shutdown, +#endif + .driver = { + .name = DRV_NAME, + }, +}; + +static int __init adm5120_flash_init(void) +{ + int err; + + err = platform_driver_register(&adm5120_flash_driver); + + return err; +} + +static void __exit adm5120_flash_exit(void) +{ + platform_driver_unregister(&adm5120_flash_driver); +} + +module_init(adm5120_flash_init); +module_exit(adm5120_flash_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gabor Juhos "); +MODULE_DESCRIPTION(DRV_DESC); diff --git a/target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c b/target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c new file mode 100644 index 000000000..76cbdc749 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c @@ -0,0 +1,216 @@ +/* + * Copyright (C) Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define PFX "trxsplit: " + +#define TRX_MAGIC 0x30524448 /* "HDR0" */ +#define TRX_VERSION 1 +#define TRX_MAX_LEN 0x3A0000 +#define TRX_NO_HEADER 0x1 /* do not write TRX header */ +#define TRX_GZ_FILES 0x2 /* contains individual gzip files */ +#define TRX_MAX_OFFSET 3 +#define TRX_MIN_KERNEL_SIZE (256 * 1024) + +struct trx_header { + u32 magic; /* "HDR0" */ + u32 len; /* Length of file including header */ + u32 crc32; /* 32-bit CRC from flag_version to end of file */ + u32 flag_version; /* 0:15 flags, 16:31 version */ + u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */ +}; + +#define TRX_ALIGN 0x1000 + +static int trx_nr_parts; +static unsigned long trx_offset; +static struct mtd_info *trx_mtd; +static struct mtd_partition trx_parts[TRX_MAX_OFFSET]; +static struct trx_header trx_hdr; + +static int trxsplit_refresh_partitions(struct mtd_info *mtd); + +static int trxsplit_checktrx(struct mtd_info *mtd, unsigned long offset) +{ + size_t retlen; + int err; + + err = mtd_read(mtd, offset, sizeof(trx_hdr), &retlen, (void *)&trx_hdr); + if (err) { + printk(KERN_ALERT PFX "unable to read from '%s'\n", mtd->name); + goto err_out; + } + + if (retlen != sizeof(trx_hdr)) { + printk(KERN_ALERT PFX "reading failed on '%s'\n", mtd->name); + goto err_out; + } + + trx_hdr.magic = le32_to_cpu(trx_hdr.magic); + trx_hdr.len = le32_to_cpu(trx_hdr.len); + trx_hdr.crc32 = le32_to_cpu(trx_hdr.crc32); + trx_hdr.flag_version = le32_to_cpu(trx_hdr.flag_version); + trx_hdr.offsets[0] = le32_to_cpu(trx_hdr.offsets[0]); + trx_hdr.offsets[1] = le32_to_cpu(trx_hdr.offsets[1]); + trx_hdr.offsets[2] = le32_to_cpu(trx_hdr.offsets[2]); + + /* sanity checks */ + if (trx_hdr.magic != TRX_MAGIC) + goto err_out; + + if (trx_hdr.len > mtd->size - offset) + goto err_out; + + /* TODO: add crc32 checking too? */ + + return 0; + +err_out: + return -1; +} + +static void trxsplit_findtrx(struct mtd_info *mtd) +{ + unsigned long offset; + int err; + + printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name); + + err = 0; + for (offset = 0; offset < mtd->size; offset += TRX_ALIGN) { + err = trxsplit_checktrx(mtd, offset); + if (err == 0) + break; + } + + if (err) + return; + + printk(KERN_INFO PFX "TRX header found at 0x%lX\n", offset); + + trx_mtd = mtd; + trx_offset = offset; +} + +static void trxsplit_create_partitions(struct mtd_info *mtd) +{ + struct mtd_partition *part = trx_parts; + int err; + int i; + + for (i = 0; i < TRX_MAX_OFFSET; i++) { + part = &trx_parts[i]; + if (trx_hdr.offsets[i] == 0) + continue; + part->offset = trx_offset + trx_hdr.offsets[i]; + trx_nr_parts++; + } + + for (i = 0; i < trx_nr_parts-1; i++) + trx_parts[i].size = trx_parts[i+1].offset - trx_parts[i].offset; + + trx_parts[i].size = mtd->size - trx_parts[i].offset; + + i = 0; + part = &trx_parts[i]; + if (part->size < TRX_MIN_KERNEL_SIZE) { + part->name = "loader"; + i++; + } + + part = &trx_parts[i]; + part->name = "kernel"; + i++; + + part = &trx_parts[i]; + part->name = "rootfs"; + + err = mtd_device_register(mtd, trx_parts, trx_nr_parts); + if (err) { + printk(KERN_ALERT PFX "adding TRX partitions failed\n"); + return; + } + + mtd->refresh_device = trxsplit_refresh_partitions; +} + +static int trxsplit_refresh_partitions(struct mtd_info *mtd) +{ + printk(KERN_INFO PFX "refreshing TRX partitions in '%s' (%d,%d)\n", + mtd->name, MTD_BLOCK_MAJOR, mtd->index); + + /* remove old partitions */ + mtd_device_unregister(mtd); + + trxsplit_findtrx(mtd); + if (!trx_mtd) + goto err; + + trxsplit_create_partitions(trx_mtd); + return 1; + +err: + return 0; +} + +static void __init trxsplit_add_mtd(struct mtd_info *mtd) +{ + if (mtd->type != MTD_NORFLASH) { + printk(KERN_INFO PFX "'%s' is not a NOR flash, skipped\n", + mtd->name); + return; + } + + if (!trx_mtd) + trxsplit_findtrx(mtd); +} + +static void __init trxsplit_remove_mtd(struct mtd_info *mtd) +{ + /* nothing to do */ +} + +static struct mtd_notifier trxsplit_notifier __initdata = { + .add = trxsplit_add_mtd, + .remove = trxsplit_remove_mtd, +}; + +static void __init trxsplit_scan(void) +{ + register_mtd_user(&trxsplit_notifier); + unregister_mtd_user(&trxsplit_notifier); +} + +static int __init trxsplit_init(void) +{ + trxsplit_scan(); + + if (trx_mtd) { + printk(KERN_INFO PFX "creating TRX partitions in '%s' " + "(%d,%d)\n", trx_mtd->name, MTD_BLOCK_MAJOR, + trx_mtd->index); + trxsplit_create_partitions(trx_mtd); + } + + return 0; +} + +late_initcall(trxsplit_init); diff --git a/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c b/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c new file mode 100644 index 000000000..7fbabb00e --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c @@ -0,0 +1,1219 @@ +/* + * ADM5120 built-in ethernet switch driver + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This code was based on a driver for Linux 2.6.xx by Jeroen Vreeken. + * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005 + * NAPI extension for the Jeroen's driver + * Copyright Thomas Langer (Thomas.Langer@infineon.com), 2007 + * Copyright Friedrich Beckmann (Friedrich.Beckmann@infineon.com), 2007 + * Inspiration for the Jeroen's driver came from the ADMtek 2.4 driver. + * Copyright ADMtek Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include "adm5120sw.h" +#include + +#define DRV_NAME "adm5120-switch" +#define DRV_DESC "ADM5120 built-in ethernet switch driver" +#define DRV_VERSION "0.1.1" + +#define CONFIG_ADM5120_SWITCH_NAPI 1 +#undef CONFIG_ADM5120_SWITCH_DEBUG + +/* ------------------------------------------------------------------------ */ + +#ifdef CONFIG_ADM5120_SWITCH_DEBUG +#define SW_DBG(f, a...) printk(KERN_DEBUG "%s: " f, DRV_NAME , ## a) +#else +#define SW_DBG(f, a...) do {} while (0) +#endif +#define SW_ERR(f, a...) printk(KERN_ERR "%s: " f, DRV_NAME , ## a) +#define SW_INFO(f, a...) printk(KERN_INFO "%s: " f, DRV_NAME , ## a) + +#define SWITCH_NUM_PORTS 6 +#define ETH_CSUM_LEN 4 + +#define RX_MAX_PKTLEN 1550 +#define RX_RING_SIZE 64 + +#define TX_RING_SIZE 32 +#define TX_QUEUE_LEN 28 /* Limit ring entries actually used. */ +#define TX_TIMEOUT (HZ * 400) + +#define RX_DESCS_SIZE (RX_RING_SIZE * sizeof(struct dma_desc *)) +#define RX_SKBS_SIZE (RX_RING_SIZE * sizeof(struct sk_buff *)) +#define TX_DESCS_SIZE (TX_RING_SIZE * sizeof(struct dma_desc *)) +#define TX_SKBS_SIZE (TX_RING_SIZE * sizeof(struct sk_buff *)) + +#define SKB_ALLOC_LEN (RX_MAX_PKTLEN + 32) +#define SKB_RESERVE_LEN (NET_IP_ALIGN + NET_SKB_PAD) + +#define SWITCH_INTS_HIGH (SWITCH_INT_SHD | SWITCH_INT_RHD | SWITCH_INT_HDF) +#define SWITCH_INTS_LOW (SWITCH_INT_SLD | SWITCH_INT_RLD | SWITCH_INT_LDF) +#define SWITCH_INTS_ERR (SWITCH_INT_RDE | SWITCH_INT_SDE | SWITCH_INT_CPUH) +#define SWITCH_INTS_Q (SWITCH_INT_P0QF | SWITCH_INT_P1QF | SWITCH_INT_P2QF | \ + SWITCH_INT_P3QF | SWITCH_INT_P4QF | SWITCH_INT_P5QF | \ + SWITCH_INT_CPQF | SWITCH_INT_GQF) + +#define SWITCH_INTS_ALL (SWITCH_INTS_HIGH | SWITCH_INTS_LOW | \ + SWITCH_INTS_ERR | SWITCH_INTS_Q | \ + SWITCH_INT_MD | SWITCH_INT_PSC) + +#define SWITCH_INTS_USED (SWITCH_INTS_LOW | SWITCH_INT_PSC) +#define SWITCH_INTS_POLL (SWITCH_INT_RLD | SWITCH_INT_LDF | SWITCH_INT_SLD) + +/* ------------------------------------------------------------------------ */ + +struct adm5120_if_priv { + struct net_device *dev; + + unsigned int vlan_no; + unsigned int port_mask; + +#ifdef CONFIG_ADM5120_SWITCH_NAPI + struct napi_struct napi; +#endif +}; + +struct dma_desc { + __u32 buf1; +#define DESC_OWN (1UL << 31) /* Owned by the switch */ +#define DESC_EOR (1UL << 28) /* End of Ring */ +#define DESC_ADDR_MASK 0x1FFFFFF +#define DESC_ADDR(x) ((__u32)(x) & DESC_ADDR_MASK) + __u32 buf2; +#define DESC_BUF2_EN (1UL << 31) /* Buffer 2 enable */ + __u32 buflen; + __u32 misc; +/* definitions for tx/rx descriptors */ +#define DESC_PKTLEN_SHIFT 16 +#define DESC_PKTLEN_MASK 0x7FF +/* tx descriptor specific part */ +#define DESC_CSUM (1UL << 31) /* Append checksum */ +#define DESC_DSTPORT_SHIFT 8 +#define DESC_DSTPORT_MASK 0x3F +#define DESC_VLAN_MASK 0x3F +/* rx descriptor specific part */ +#define DESC_SRCPORT_SHIFT 12 +#define DESC_SRCPORT_MASK 0x7 +#define DESC_DA_MASK 0x3 +#define DESC_DA_SHIFT 4 +#define DESC_IPCSUM_FAIL (1UL << 3) /* IP checksum fail */ +#define DESC_VLAN_TAG (1UL << 2) /* VLAN tag present */ +#define DESC_TYPE_MASK 0x3 /* mask for Packet type */ +#define DESC_TYPE_IP 0x0 /* IP packet */ +#define DESC_TYPE_PPPoE 0x1 /* PPPoE packet */ +} __attribute__ ((aligned(16))); + +/* ------------------------------------------------------------------------ */ + +static int adm5120_nrdevs; + +static struct net_device *adm5120_devs[SWITCH_NUM_PORTS]; +/* Lookup table port -> device */ +static struct net_device *adm5120_port[SWITCH_NUM_PORTS]; + +static struct dma_desc *txl_descs; +static struct dma_desc *rxl_descs; + +static dma_addr_t txl_descs_dma; +static dma_addr_t rxl_descs_dma; + +static struct sk_buff **txl_skbuff; +static struct sk_buff **rxl_skbuff; + +static unsigned int cur_rxl, dirty_rxl; /* producer/consumer ring indices */ +static unsigned int cur_txl, dirty_txl; + +static unsigned int sw_used; + +static DEFINE_SPINLOCK(tx_lock); + +/* ------------------------------------------------------------------------ */ + +static inline u32 sw_read_reg(u32 reg) +{ + return __raw_readl((void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE)+reg); +} + +static inline void sw_write_reg(u32 reg, u32 val) +{ + __raw_writel(val, (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE)+reg); +} + +static inline void sw_int_mask(u32 mask) +{ + u32 t; + + t = sw_read_reg(SWITCH_REG_INT_MASK); + t |= mask; + sw_write_reg(SWITCH_REG_INT_MASK, t); +} + +static inline void sw_int_unmask(u32 mask) +{ + u32 t; + + t = sw_read_reg(SWITCH_REG_INT_MASK); + t &= ~mask; + sw_write_reg(SWITCH_REG_INT_MASK, t); +} + +static inline void sw_int_ack(u32 mask) +{ + sw_write_reg(SWITCH_REG_INT_STATUS, mask); +} + +static inline u32 sw_int_status(void) +{ + u32 t; + + t = sw_read_reg(SWITCH_REG_INT_STATUS); + t &= ~sw_read_reg(SWITCH_REG_INT_MASK); + return t; +} + +static inline u32 desc_get_srcport(struct dma_desc *desc) +{ + return (desc->misc >> DESC_SRCPORT_SHIFT) & DESC_SRCPORT_MASK; +} + +static inline u32 desc_get_pktlen(struct dma_desc *desc) +{ + return (desc->misc >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK; +} + +static inline int desc_ipcsum_fail(struct dma_desc *desc) +{ + return ((desc->misc & DESC_IPCSUM_FAIL) != 0); +} + +/* ------------------------------------------------------------------------ */ + +#ifdef CONFIG_ADM5120_SWITCH_DEBUG +static void sw_dump_desc(char *label, struct dma_desc *desc, int tx) +{ + u32 t; + + SW_DBG("%s %s desc/%p\n", label, tx ? "tx" : "rx", desc); + + t = desc->buf1; + SW_DBG(" buf1 %08X addr=%08X; len=%08X %s%s\n", t, + t & DESC_ADDR_MASK, + desc->buflen, + (t & DESC_OWN) ? "SWITCH" : "CPU", + (t & DESC_EOR) ? " RE" : ""); + + t = desc->buf2; + SW_DBG(" buf2 %08X addr=%08X%s\n", desc->buf2, + t & DESC_ADDR_MASK, + (t & DESC_BUF2_EN) ? " EN" : ""); + + t = desc->misc; + if (tx) + SW_DBG(" misc %08X%s pktlen=%04X ports=%02X vlan=%02X\n", t, + (t & DESC_CSUM) ? " CSUM" : "", + (t >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK, + (t >> DESC_DSTPORT_SHIFT) & DESC_DSTPORT_MASK, + t & DESC_VLAN_MASK); + else + SW_DBG(" misc %08X pktlen=%04X port=%d DA=%d%s%s type=%d\n", + t, + (t >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK, + (t >> DESC_SRCPORT_SHIFT) & DESC_SRCPORT_MASK, + (t >> DESC_DA_SHIFT) & DESC_DA_MASK, + (t & DESC_IPCSUM_FAIL) ? " IPCF" : "", + (t & DESC_VLAN_TAG) ? " VLAN" : "", + (t & DESC_TYPE_MASK)); +} + +static void sw_dump_intr_mask(char *label, u32 mask) +{ + SW_DBG("%s %08X%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + label, mask, + (mask & SWITCH_INT_SHD) ? " SHD" : "", + (mask & SWITCH_INT_SLD) ? " SLD" : "", + (mask & SWITCH_INT_RHD) ? " RHD" : "", + (mask & SWITCH_INT_RLD) ? " RLD" : "", + (mask & SWITCH_INT_HDF) ? " HDF" : "", + (mask & SWITCH_INT_LDF) ? " LDF" : "", + (mask & SWITCH_INT_P0QF) ? " P0QF" : "", + (mask & SWITCH_INT_P1QF) ? " P1QF" : "", + (mask & SWITCH_INT_P2QF) ? " P2QF" : "", + (mask & SWITCH_INT_P3QF) ? " P3QF" : "", + (mask & SWITCH_INT_P4QF) ? " P4QF" : "", + (mask & SWITCH_INT_CPQF) ? " CPQF" : "", + (mask & SWITCH_INT_GQF) ? " GQF" : "", + (mask & SWITCH_INT_MD) ? " MD" : "", + (mask & SWITCH_INT_BCS) ? " BCS" : "", + (mask & SWITCH_INT_PSC) ? " PSC" : "", + (mask & SWITCH_INT_ID) ? " ID" : "", + (mask & SWITCH_INT_W0TE) ? " W0TE" : "", + (mask & SWITCH_INT_W1TE) ? " W1TE" : "", + (mask & SWITCH_INT_RDE) ? " RDE" : "", + (mask & SWITCH_INT_SDE) ? " SDE" : "", + (mask & SWITCH_INT_CPUH) ? " CPUH" : ""); +} + +static void sw_dump_regs(void) +{ + u32 t; + + t = sw_read_reg(SWITCH_REG_PHY_STATUS); + SW_DBG("phy_status: %08X\n", t); + + t = sw_read_reg(SWITCH_REG_CPUP_CONF); + SW_DBG("cpup_conf: %08X%s%s%s\n", t, + (t & CPUP_CONF_DCPUP) ? " DCPUP" : "", + (t & CPUP_CONF_CRCP) ? " CRCP" : "", + (t & CPUP_CONF_BTM) ? " BTM" : ""); + + t = sw_read_reg(SWITCH_REG_PORT_CONF0); + SW_DBG("port_conf0: %08X\n", t); + t = sw_read_reg(SWITCH_REG_PORT_CONF1); + SW_DBG("port_conf1: %08X\n", t); + t = sw_read_reg(SWITCH_REG_PORT_CONF2); + SW_DBG("port_conf2: %08X\n", t); + + t = sw_read_reg(SWITCH_REG_VLAN_G1); + SW_DBG("vlan g1: %08X\n", t); + t = sw_read_reg(SWITCH_REG_VLAN_G2); + SW_DBG("vlan g2: %08X\n", t); + + t = sw_read_reg(SWITCH_REG_BW_CNTL0); + SW_DBG("bw_cntl0: %08X\n", t); + t = sw_read_reg(SWITCH_REG_BW_CNTL1); + SW_DBG("bw_cntl1: %08X\n", t); + + t = sw_read_reg(SWITCH_REG_PHY_CNTL0); + SW_DBG("phy_cntl0: %08X\n", t); + t = sw_read_reg(SWITCH_REG_PHY_CNTL1); + SW_DBG("phy_cntl1: %08X\n", t); + t = sw_read_reg(SWITCH_REG_PHY_CNTL2); + SW_DBG("phy_cntl2: %08X\n", t); + t = sw_read_reg(SWITCH_REG_PHY_CNTL3); + SW_DBG("phy_cntl3: %08X\n", t); + t = sw_read_reg(SWITCH_REG_PHY_CNTL4); + SW_DBG("phy_cntl4: %08X\n", t); + + t = sw_read_reg(SWITCH_REG_INT_STATUS); + sw_dump_intr_mask("int_status: ", t); + + t = sw_read_reg(SWITCH_REG_INT_MASK); + sw_dump_intr_mask("int_mask: ", t); + + t = sw_read_reg(SWITCH_REG_SHDA); + SW_DBG("shda: %08X\n", t); + t = sw_read_reg(SWITCH_REG_SLDA); + SW_DBG("slda: %08X\n", t); + t = sw_read_reg(SWITCH_REG_RHDA); + SW_DBG("rhda: %08X\n", t); + t = sw_read_reg(SWITCH_REG_RLDA); + SW_DBG("rlda: %08X\n", t); +} +#else +static inline void sw_dump_desc(char *label, struct dma_desc *desc, int tx) {} +static void sw_dump_intr_mask(char *label, u32 mask) {} +static inline void sw_dump_regs(void) {} +#endif /* CONFIG_ADM5120_SWITCH_DEBUG */ + +/* ------------------------------------------------------------------------ */ + +static inline void adm5120_rx_dma_update(struct dma_desc *desc, + struct sk_buff *skb, int end) +{ + desc->misc = 0; + desc->buf2 = 0; + desc->buflen = RX_MAX_PKTLEN; + desc->buf1 = DESC_ADDR(skb->data) | + DESC_OWN | (end ? DESC_EOR : 0); +} + +static void adm5120_switch_rx_refill(void) +{ + unsigned int entry; + + for (; cur_rxl - dirty_rxl > 0; dirty_rxl++) { + struct dma_desc *desc; + struct sk_buff *skb; + + entry = dirty_rxl % RX_RING_SIZE; + desc = &rxl_descs[entry]; + + skb = rxl_skbuff[entry]; + if (skb == NULL) { + skb = alloc_skb(SKB_ALLOC_LEN, GFP_ATOMIC); + if (skb) { + skb_reserve(skb, SKB_RESERVE_LEN); + rxl_skbuff[entry] = skb; + } else { + SW_ERR("no memory for skb\n"); + desc->buflen = 0; + desc->buf2 = 0; + desc->misc = 0; + desc->buf1 = (desc->buf1 & DESC_EOR) | DESC_OWN; + break; + } + } + + desc->buf2 = 0; + desc->buflen = RX_MAX_PKTLEN; + desc->misc = 0; + desc->buf1 = (desc->buf1 & DESC_EOR) | DESC_OWN | + DESC_ADDR(skb->data); + } +} + +static int adm5120_switch_rx(int limit) +{ + unsigned int done = 0; + + SW_DBG("rx start, limit=%d, cur_rxl=%u, dirty_rxl=%u\n", + limit, cur_rxl, dirty_rxl); + + while (done < limit) { + int entry = cur_rxl % RX_RING_SIZE; + struct dma_desc *desc = &rxl_descs[entry]; + struct net_device *rdev; + unsigned int port; + + if (desc->buf1 & DESC_OWN) + break; + + if (dirty_rxl + RX_RING_SIZE == cur_rxl) + break; + + port = desc_get_srcport(desc); + rdev = adm5120_port[port]; + + SW_DBG("rx descriptor %u, desc=%p, skb=%p\n", entry, desc, + rxl_skbuff[entry]); + + if ((rdev) && netif_running(rdev)) { + struct sk_buff *skb = rxl_skbuff[entry]; + int pktlen; + + pktlen = desc_get_pktlen(desc); + pktlen -= ETH_CSUM_LEN; + + if ((pktlen == 0) || desc_ipcsum_fail(desc)) { + rdev->stats.rx_errors++; + if (pktlen == 0) + rdev->stats.rx_length_errors++; + if (desc_ipcsum_fail(desc)) + rdev->stats.rx_crc_errors++; + SW_DBG("rx error, recycling skb %u\n", entry); + } else { + skb_put(skb, pktlen); + + skb->dev = rdev; + skb->protocol = eth_type_trans(skb, rdev); + skb->ip_summed = CHECKSUM_UNNECESSARY; + + dma_cache_wback_inv((unsigned long)skb->data, + skb->len); + +#ifdef CONFIG_ADM5120_SWITCH_NAPI + netif_receive_skb(skb); +#else + netif_rx(skb); +#endif + + rdev->last_rx = jiffies; + rdev->stats.rx_packets++; + rdev->stats.rx_bytes += pktlen; + + rxl_skbuff[entry] = NULL; + done++; + } + } else { + SW_DBG("no rx device, recycling skb %u\n", entry); + } + + cur_rxl++; + if (cur_rxl - dirty_rxl > RX_RING_SIZE / 4) + adm5120_switch_rx_refill(); + } + + adm5120_switch_rx_refill(); + + SW_DBG("rx finished, cur_rxl=%u, dirty_rxl=%u, processed %d\n", + cur_rxl, dirty_rxl, done); + + return done; +} + +static void adm5120_switch_tx(void) +{ + unsigned int entry; + + spin_lock(&tx_lock); + entry = dirty_txl % TX_RING_SIZE; + while (dirty_txl != cur_txl) { + struct dma_desc *desc = &txl_descs[entry]; + struct sk_buff *skb = txl_skbuff[entry]; + + if (desc->buf1 & DESC_OWN) + break; + + if (netif_running(skb->dev)) { + skb->dev->stats.tx_bytes += skb->len; + skb->dev->stats.tx_packets++; + } + + dev_kfree_skb_irq(skb); + txl_skbuff[entry] = NULL; + entry = (++dirty_txl) % TX_RING_SIZE; + } + + if ((cur_txl - dirty_txl) < TX_QUEUE_LEN - 4) { + int i; + for (i = 0; i < SWITCH_NUM_PORTS; i++) { + if (!adm5120_devs[i]) + continue; + netif_wake_queue(adm5120_devs[i]); + } + } + spin_unlock(&tx_lock); +} + +#ifdef CONFIG_ADM5120_SWITCH_NAPI +static int adm5120_if_poll(struct napi_struct *napi, int limit) +{ + struct adm5120_if_priv *priv = container_of(napi, + struct adm5120_if_priv, napi); + struct net_device *dev __maybe_unused = priv->dev; + int done; + u32 status; + + sw_int_ack(SWITCH_INTS_POLL); + + SW_DBG("%s: processing TX ring\n", dev->name); + adm5120_switch_tx(); + + SW_DBG("%s: processing RX ring\n", dev->name); + done = adm5120_switch_rx(limit); + + status = sw_int_status() & SWITCH_INTS_POLL; + if ((done < limit) && (!status)) { + SW_DBG("disable polling mode for %s\n", dev->name); + napi_complete(napi); + sw_int_unmask(SWITCH_INTS_POLL); + return 0; + } + + SW_DBG("%s still in polling mode, done=%d, status=%x\n", + dev->name, done, status); + return 1; +} +#endif /* CONFIG_ADM5120_SWITCH_NAPI */ + + +static irqreturn_t adm5120_switch_irq(int irq, void *dev_id) +{ + u32 status; + + status = sw_int_status(); + status &= SWITCH_INTS_ALL; + if (!status) + return IRQ_NONE; + +#ifdef CONFIG_ADM5120_SWITCH_NAPI + sw_int_ack(status & ~SWITCH_INTS_POLL); + + if (status & SWITCH_INTS_POLL) { + struct net_device *dev = dev_id; + struct adm5120_if_priv *priv = netdev_priv(dev); + + sw_dump_intr_mask("poll ints", status); + SW_DBG("enable polling mode for %s\n", dev->name); + sw_int_mask(SWITCH_INTS_POLL); + napi_schedule(&priv->napi); + } +#else + sw_int_ack(status); + + if (status & (SWITCH_INT_RLD | SWITCH_INT_LDF)) + adm5120_switch_rx(RX_RING_SIZE); + + if (status & SWITCH_INT_SLD) + adm5120_switch_tx(); +#endif + + return IRQ_HANDLED; +} + +static void adm5120_set_bw(char *matrix) +{ + unsigned long val; + + /* Port 0 to 3 are set using the bandwidth control 0 register */ + val = matrix[0] + (matrix[1]<<8) + (matrix[2]<<16) + (matrix[3]<<24); + sw_write_reg(SWITCH_REG_BW_CNTL0, val); + + /* Port 4 and 5 are set using the bandwidth control 1 register */ + val = matrix[4]; + if (matrix[5] == 1) + sw_write_reg(SWITCH_REG_BW_CNTL1, val | 0x80000000); + else + sw_write_reg(SWITCH_REG_BW_CNTL1, val & ~0x8000000); + + SW_DBG("D: ctl0 0x%ux, ctl1 0x%ux\n", sw_read_reg(SWITCH_REG_BW_CNTL0), + sw_read_reg(SWITCH_REG_BW_CNTL1)); +} + +static void adm5120_switch_tx_ring_reset(struct dma_desc *desc, + struct sk_buff **skbl, int num) +{ + memset(desc, 0, num * sizeof(*desc)); + desc[num-1].buf1 |= DESC_EOR; + memset(skbl, 0, sizeof(struct skb *) * num); + + cur_txl = 0; + dirty_txl = 0; +} + +static void adm5120_switch_rx_ring_reset(struct dma_desc *desc, + struct sk_buff **skbl, int num) +{ + int i; + + memset(desc, 0, num * sizeof(*desc)); + for (i = 0; i < num; i++) { + skbl[i] = dev_alloc_skb(SKB_ALLOC_LEN); + if (!skbl[i]) { + i = num; + break; + } + skb_reserve(skbl[i], SKB_RESERVE_LEN); + adm5120_rx_dma_update(&desc[i], skbl[i], (num - 1 == i)); + } + + cur_rxl = 0; + dirty_rxl = 0; +} + +static int adm5120_switch_tx_ring_alloc(void) +{ + int err; + + txl_descs = dma_alloc_coherent(NULL, TX_DESCS_SIZE, &txl_descs_dma, + GFP_ATOMIC); + if (!txl_descs) { + err = -ENOMEM; + goto err; + } + + txl_skbuff = kzalloc(TX_SKBS_SIZE, GFP_KERNEL); + if (!txl_skbuff) { + err = -ENOMEM; + goto err; + } + + return 0; + +err: + return err; +} + +static void adm5120_switch_tx_ring_free(void) +{ + int i; + + if (txl_skbuff) { + for (i = 0; i < TX_RING_SIZE; i++) + if (txl_skbuff[i]) + kfree_skb(txl_skbuff[i]); + kfree(txl_skbuff); + } + + if (txl_descs) + dma_free_coherent(NULL, TX_DESCS_SIZE, txl_descs, + txl_descs_dma); +} + +static int adm5120_switch_rx_ring_alloc(void) +{ + int err; + int i; + + /* init RX ring */ + rxl_descs = dma_alloc_coherent(NULL, RX_DESCS_SIZE, &rxl_descs_dma, + GFP_ATOMIC); + if (!rxl_descs) { + err = -ENOMEM; + goto err; + } + + rxl_skbuff = kzalloc(RX_SKBS_SIZE, GFP_KERNEL); + if (!rxl_skbuff) { + err = -ENOMEM; + goto err; + } + + for (i = 0; i < RX_RING_SIZE; i++) { + struct sk_buff *skb; + skb = alloc_skb(SKB_ALLOC_LEN, GFP_ATOMIC); + if (!skb) { + err = -ENOMEM; + goto err; + } + rxl_skbuff[i] = skb; + skb_reserve(skb, SKB_RESERVE_LEN); + } + + return 0; + +err: + return err; +} + +static void adm5120_switch_rx_ring_free(void) +{ + int i; + + if (rxl_skbuff) { + for (i = 0; i < RX_RING_SIZE; i++) + if (rxl_skbuff[i]) + kfree_skb(rxl_skbuff[i]); + kfree(rxl_skbuff); + } + + if (rxl_descs) + dma_free_coherent(NULL, RX_DESCS_SIZE, rxl_descs, + rxl_descs_dma); +} + +static void adm5120_write_mac(struct net_device *dev) +{ + struct adm5120_if_priv *priv = netdev_priv(dev); + unsigned char *mac = dev->dev_addr; + u32 t; + + t = mac[2] | (mac[3] << MAC_WT1_MAC3_SHIFT) | + (mac[4] << MAC_WT1_MAC4_SHIFT) | (mac[5] << MAC_WT1_MAC5_SHIFT); + sw_write_reg(SWITCH_REG_MAC_WT1, t); + + t = (mac[0] << MAC_WT0_MAC0_SHIFT) | (mac[1] << MAC_WT0_MAC1_SHIFT) | + MAC_WT0_MAWC | MAC_WT0_WVE | (priv->vlan_no<<3); + + sw_write_reg(SWITCH_REG_MAC_WT0, t); + + while (!(sw_read_reg(SWITCH_REG_MAC_WT0) & MAC_WT0_MWD)) + ; +} + +static void adm5120_set_vlan(char *matrix) +{ + unsigned long val; + int vlan_port, port; + + val = matrix[0] + (matrix[1]<<8) + (matrix[2]<<16) + (matrix[3]<<24); + sw_write_reg(SWITCH_REG_VLAN_G1, val); + val = matrix[4] + (matrix[5]<<8); + sw_write_reg(SWITCH_REG_VLAN_G2, val); + + /* Now set/update the port vs. device lookup table */ + for (port = 0; port < SWITCH_NUM_PORTS; port++) { + for (vlan_port = 0; vlan_port < SWITCH_NUM_PORTS && !(matrix[vlan_port] & (0x00000001 << port)); vlan_port++) + ; + if (vlan_port < SWITCH_NUM_PORTS) + adm5120_port[port] = adm5120_devs[vlan_port]; + else + adm5120_port[port] = NULL; + } +} + +static void adm5120_switch_set_vlan_mac(unsigned int vlan, unsigned char *mac) +{ + u32 t; + + t = mac[2] | (mac[3] << MAC_WT1_MAC3_SHIFT) + | (mac[4] << MAC_WT1_MAC4_SHIFT) + | (mac[5] << MAC_WT1_MAC5_SHIFT); + sw_write_reg(SWITCH_REG_MAC_WT1, t); + + t = (mac[0] << MAC_WT0_MAC0_SHIFT) | (mac[1] << MAC_WT0_MAC1_SHIFT) | + MAC_WT0_MAWC | MAC_WT0_WVE | (vlan << MAC_WT0_WVN_SHIFT) | + (MAC_WT0_WAF_STATIC << MAC_WT0_WAF_SHIFT); + sw_write_reg(SWITCH_REG_MAC_WT0, t); + + do { + t = sw_read_reg(SWITCH_REG_MAC_WT0); + } while ((t & MAC_WT0_MWD) == 0); +} + +static void adm5120_switch_set_vlan_ports(unsigned int vlan, u32 ports) +{ + unsigned int reg; + u32 t; + + if (vlan < 4) + reg = SWITCH_REG_VLAN_G1; + else { + vlan -= 4; + reg = SWITCH_REG_VLAN_G2; + } + + t = sw_read_reg(reg); + t &= ~(0xFF << (vlan*8)); + t |= (ports << (vlan*8)); + sw_write_reg(reg, t); +} + +/* ------------------------------------------------------------------------ */ + +#ifdef CONFIG_ADM5120_SWITCH_NAPI +static inline void adm5120_if_napi_enable(struct net_device *dev) +{ + struct adm5120_if_priv *priv = netdev_priv(dev); + napi_enable(&priv->napi); +} + +static inline void adm5120_if_napi_disable(struct net_device *dev) +{ + struct adm5120_if_priv *priv = netdev_priv(dev); + napi_disable(&priv->napi); +} +#else +static inline void adm5120_if_napi_enable(struct net_device *dev) {} +static inline void adm5120_if_napi_disable(struct net_device *dev) {} +#endif /* CONFIG_ADM5120_SWITCH_NAPI */ + +static int adm5120_if_open(struct net_device *dev) +{ + u32 t; + int err; + int i; + + adm5120_if_napi_enable(dev); + + err = request_irq(dev->irq, adm5120_switch_irq, IRQF_SHARED, + dev->name, dev); + if (err) { + SW_ERR("unable to get irq for %s\n", dev->name); + goto err; + } + + if (!sw_used++) + /* enable interrupts on first open */ + sw_int_unmask(SWITCH_INTS_USED); + + /* enable (additional) port */ + t = sw_read_reg(SWITCH_REG_PORT_CONF0); + for (i = 0; i < SWITCH_NUM_PORTS; i++) { + if (dev == adm5120_devs[i]) + t &= ~adm5120_eth_vlans[i]; + } + sw_write_reg(SWITCH_REG_PORT_CONF0, t); + + netif_start_queue(dev); + + return 0; + +err: + adm5120_if_napi_disable(dev); + return err; +} + +static int adm5120_if_stop(struct net_device *dev) +{ + u32 t; + int i; + + netif_stop_queue(dev); + adm5120_if_napi_disable(dev); + + /* disable port if not assigned to other devices */ + t = sw_read_reg(SWITCH_REG_PORT_CONF0); + t |= SWITCH_PORTS_NOCPU; + for (i = 0; i < SWITCH_NUM_PORTS; i++) { + if ((dev != adm5120_devs[i]) && netif_running(adm5120_devs[i])) + t &= ~adm5120_eth_vlans[i]; + } + sw_write_reg(SWITCH_REG_PORT_CONF0, t); + + if (!--sw_used) + sw_int_mask(SWITCH_INTS_USED); + + free_irq(dev->irq, dev); + + return 0; +} + +static int adm5120_if_hard_start_xmit(struct sk_buff *skb, + struct net_device *dev) +{ + struct dma_desc *desc; + struct adm5120_if_priv *priv = netdev_priv(dev); + unsigned int entry; + unsigned long data; + int i; + + /* lock switch irq */ + spin_lock_irq(&tx_lock); + + /* calculate the next TX descriptor entry. */ + entry = cur_txl % TX_RING_SIZE; + + desc = &txl_descs[entry]; + if (desc->buf1 & DESC_OWN) { + /* We want to write a packet but the TX queue is still + * occupied by the DMA. We are faster than the DMA... */ + SW_DBG("%s unable to transmit, packet dopped\n", dev->name); + dev_kfree_skb(skb); + dev->stats.tx_dropped++; + return 0; + } + + txl_skbuff[entry] = skb; + data = (desc->buf1 & DESC_EOR); + data |= DESC_ADDR(skb->data); + + desc->misc = + ((skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len) << DESC_PKTLEN_SHIFT) | + (0x1 << priv->vlan_no); + + desc->buflen = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; + + desc->buf1 = data | DESC_OWN; + sw_write_reg(SWITCH_REG_SEND_TRIG, SEND_TRIG_STL); + + cur_txl++; + if (cur_txl == dirty_txl + TX_QUEUE_LEN) { + for (i = 0; i < SWITCH_NUM_PORTS; i++) { + if (!adm5120_devs[i]) + continue; + netif_stop_queue(adm5120_devs[i]); + } + } + + dev->trans_start = jiffies; + + spin_unlock_irq(&tx_lock); + + return 0; +} + +static void adm5120_if_tx_timeout(struct net_device *dev) +{ + SW_INFO("TX timeout on %s\n", dev->name); +} + +static void adm5120_if_set_rx_mode(struct net_device *dev) +{ + struct adm5120_if_priv *priv = netdev_priv(dev); + u32 ports; + u32 t; + + ports = adm5120_eth_vlans[priv->vlan_no] & SWITCH_PORTS_NOCPU; + + t = sw_read_reg(SWITCH_REG_CPUP_CONF); + if (dev->flags & IFF_PROMISC) + /* enable unknown packets */ + t &= ~(ports << CPUP_CONF_DUNP_SHIFT); + else + /* disable unknown packets */ + t |= (ports << CPUP_CONF_DUNP_SHIFT); + + if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI || + netdev_mc_count(dev)) + /* enable multicast packets */ + t &= ~(ports << CPUP_CONF_DMCP_SHIFT); + else + /* disable multicast packets */ + t |= (ports << CPUP_CONF_DMCP_SHIFT); + + /* If there is any port configured to be in promiscuous mode, then the */ + /* Bridge Test Mode has to be activated. This will result in */ + /* transporting also packets learned in another VLAN to be forwarded */ + /* to the CPU. */ + /* The difficult scenario is when we want to build a bridge on the CPU.*/ + /* Assume we have port0 and the CPU port in VLAN0 and port1 and the */ + /* CPU port in VLAN1. Now we build a bridge on the CPU between */ + /* VLAN0 and VLAN1. Both ports of the VLANs are set in promisc mode. */ + /* Now assume a packet with ethernet source address 99 enters port 0 */ + /* It will be forwarded to the CPU because it is unknown. Then the */ + /* bridge in the CPU will send it to VLAN1 and it goes out at port 1. */ + /* When now a packet with ethernet destination address 99 comes in at */ + /* port 1 in VLAN1, then the switch has learned that this address is */ + /* located at port 0 in VLAN0. Therefore the switch will drop */ + /* this packet. In order to avoid this and to send the packet still */ + /* to the CPU, the Bridge Test Mode has to be activated. */ + + /* Check if there is any vlan in promisc mode. */ + if (~t & (SWITCH_PORTS_NOCPU << CPUP_CONF_DUNP_SHIFT)) + t |= CPUP_CONF_BTM; /* Enable Bridge Testing Mode */ + else + t &= ~CPUP_CONF_BTM; /* Disable Bridge Testing Mode */ + + sw_write_reg(SWITCH_REG_CPUP_CONF, t); + +} + +static int adm5120_if_set_mac_address(struct net_device *dev, void *p) +{ + int ret; + + ret = eth_mac_addr(dev, p); + if (ret) + return ret; + + adm5120_write_mac(dev); + return 0; +} + +static int adm5120_if_do_ioctl(struct net_device *dev, struct ifreq *rq, + int cmd) +{ + int err; + struct adm5120_sw_info info; + struct adm5120_if_priv *priv = netdev_priv(dev); + + switch (cmd) { + case SIOCGADMINFO: + info.magic = 0x5120; + info.ports = adm5120_nrdevs; + info.vlan = priv->vlan_no; + err = copy_to_user(rq->ifr_data, &info, sizeof(info)); + if (err) + return -EFAULT; + break; + case SIOCSMATRIX: + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + err = copy_from_user(adm5120_eth_vlans, rq->ifr_data, + sizeof(adm5120_eth_vlans)); + if (err) + return -EFAULT; + adm5120_set_vlan(adm5120_eth_vlans); + break; + case SIOCGMATRIX: + err = copy_to_user(rq->ifr_data, adm5120_eth_vlans, + sizeof(adm5120_eth_vlans)); + if (err) + return -EFAULT; + break; + default: + return -EOPNOTSUPP; + } + return 0; +} + +static const struct net_device_ops adm5120sw_netdev_ops = { + .ndo_open = adm5120_if_open, + .ndo_stop = adm5120_if_stop, + .ndo_start_xmit = adm5120_if_hard_start_xmit, + .ndo_set_rx_mode = adm5120_if_set_rx_mode, + .ndo_do_ioctl = adm5120_if_do_ioctl, + .ndo_tx_timeout = adm5120_if_tx_timeout, + .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = adm5120_if_set_mac_address, +}; + +static struct net_device *adm5120_if_alloc(void) +{ + struct net_device *dev; + struct adm5120_if_priv *priv; + + dev = alloc_etherdev(sizeof(*priv)); + if (!dev) + return NULL; + + priv = netdev_priv(dev); + priv->dev = dev; + + dev->irq = ADM5120_IRQ_SWITCH; + dev->netdev_ops = &adm5120sw_netdev_ops; + dev->watchdog_timeo = TX_TIMEOUT; + +#ifdef CONFIG_ADM5120_SWITCH_NAPI + netif_napi_add(dev, &priv->napi, adm5120_if_poll, 64); +#endif + + return dev; +} + +/* ------------------------------------------------------------------------ */ + +static void adm5120_switch_cleanup(void) +{ + int i; + + /* disable interrupts */ + sw_int_mask(SWITCH_INTS_ALL); + + for (i = 0; i < SWITCH_NUM_PORTS; i++) { + struct net_device *dev = adm5120_devs[i]; + if (dev) { + unregister_netdev(dev); + free_netdev(dev); + } + } + + adm5120_switch_tx_ring_free(); + adm5120_switch_rx_ring_free(); +} + +static int adm5120_switch_probe(struct platform_device *pdev) +{ + u32 t; + int i, err; + + adm5120_nrdevs = adm5120_eth_num_ports; + + t = CPUP_CONF_DCPUP | CPUP_CONF_CRCP | + SWITCH_PORTS_NOCPU << CPUP_CONF_DUNP_SHIFT | + SWITCH_PORTS_NOCPU << CPUP_CONF_DMCP_SHIFT ; + sw_write_reg(SWITCH_REG_CPUP_CONF, t); + + t = (SWITCH_PORTS_NOCPU << PORT_CONF0_EMCP_SHIFT) | + (SWITCH_PORTS_NOCPU << PORT_CONF0_BP_SHIFT) | + (SWITCH_PORTS_NOCPU); + sw_write_reg(SWITCH_REG_PORT_CONF0, t); + + /* setup ports to Autoneg/100M/Full duplex/Auto MDIX */ + t = SWITCH_PORTS_PHY | + (SWITCH_PORTS_PHY << PHY_CNTL2_SC_SHIFT) | + (SWITCH_PORTS_PHY << PHY_CNTL2_DC_SHIFT) | + (SWITCH_PORTS_PHY << PHY_CNTL2_PHYR_SHIFT) | + (SWITCH_PORTS_PHY << PHY_CNTL2_AMDIX_SHIFT) | + PHY_CNTL2_RMAE; + sw_write_reg(SWITCH_REG_PHY_CNTL2, t); + + t = sw_read_reg(SWITCH_REG_PHY_CNTL3); + t |= PHY_CNTL3_RNT; + sw_write_reg(SWITCH_REG_PHY_CNTL3, t); + + /* Force all the packets from all ports are low priority */ + sw_write_reg(SWITCH_REG_PRI_CNTL, 0); + + sw_int_mask(SWITCH_INTS_ALL); + sw_int_ack(SWITCH_INTS_ALL); + + err = adm5120_switch_rx_ring_alloc(); + if (err) + goto err; + + err = adm5120_switch_tx_ring_alloc(); + if (err) + goto err; + + adm5120_switch_tx_ring_reset(txl_descs, txl_skbuff, TX_RING_SIZE); + adm5120_switch_rx_ring_reset(rxl_descs, rxl_skbuff, RX_RING_SIZE); + + sw_write_reg(SWITCH_REG_SHDA, 0); + sw_write_reg(SWITCH_REG_SLDA, KSEG1ADDR(txl_descs)); + sw_write_reg(SWITCH_REG_RHDA, 0); + sw_write_reg(SWITCH_REG_RLDA, KSEG1ADDR(rxl_descs)); + + for (i = 0; i < SWITCH_NUM_PORTS; i++) { + struct net_device *dev; + struct adm5120_if_priv *priv; + + dev = adm5120_if_alloc(); + if (!dev) { + err = -ENOMEM; + goto err; + } + + adm5120_devs[i] = dev; + priv = netdev_priv(dev); + + priv->vlan_no = i; + priv->port_mask = adm5120_eth_vlans[i]; + + memcpy(dev->dev_addr, adm5120_eth_macs[i], 6); + adm5120_write_mac(dev); + + err = register_netdev(dev); + if (err) { + SW_INFO("%s register failed, error=%d\n", + dev->name, err); + goto err; + } + } + + /* setup vlan/port mapping after devs are filled up */ + adm5120_set_vlan(adm5120_eth_vlans); + + /* enable CPU port */ + t = sw_read_reg(SWITCH_REG_CPUP_CONF); + t &= ~CPUP_CONF_DCPUP; + sw_write_reg(SWITCH_REG_CPUP_CONF, t); + + return 0; + +err: + adm5120_switch_cleanup(); + + SW_ERR("init failed\n"); + return err; +} + +static int adm5120_switch_remove(struct platform_device *pdev) +{ + adm5120_switch_cleanup(); + return 0; +} + +static struct platform_driver adm5120_switch_driver = { + .probe = adm5120_switch_probe, + .remove = adm5120_switch_remove, + .driver = { + .name = DRV_NAME, + }, +}; + +/* -------------------------------------------------------------------------- */ + +static int __init adm5120_switch_mod_init(void) +{ + int err; + + pr_info(DRV_DESC " version " DRV_VERSION "\n"); + err = platform_driver_register(&adm5120_switch_driver); + + return err; +} + +static void __exit adm5120_switch_mod_exit(void) +{ + platform_driver_unregister(&adm5120_switch_driver); +} + +module_init(adm5120_switch_mod_init); +module_exit(adm5120_switch_mod_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gabor Juhos "); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_VERSION(DRV_VERSION); diff --git a/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h b/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h new file mode 100644 index 000000000..fa9e50335 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h @@ -0,0 +1,23 @@ +/* + * Defines for ADM5120 built in ethernet switch driver + * + * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005 + * + * Values come from ADM5120 datasheet and original ADMtek 2.4 driver, + * Copyright ADMtek Inc. + */ + +#ifndef _INCLUDE_ADM5120SW_H_ +#define _INCLUDE_ADM5120SW_H_ + +#define SIOCSMATRIX SIOCDEVPRIVATE +#define SIOCGMATRIX (SIOCDEVPRIVATE + 1) +#define SIOCGADMINFO (SIOCDEVPRIVATE + 2) + +struct adm5120_sw_info { + u16 magic; + u16 ports; + u16 vlan; +}; + +#endif /* _INCLUDE_ADM5120SW_H_ */ diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c new file mode 100644 index 000000000..2d5dc2a5a --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c @@ -0,0 +1,836 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci-dbg.c + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2002 David Brownell + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +/*-------------------------------------------------------------------------*/ + +static inline char *ed_typestring(int ed_type) +{ + switch (ed_type) { + case PIPE_CONTROL: + return "ctrl"; + case PIPE_BULK: + return "bulk"; + case PIPE_INTERRUPT: + return "intr"; + case PIPE_ISOCHRONOUS: + return "isoc"; + } + return "(bad ed_type)"; +} + +static inline char *ed_statestring(int state) +{ + switch (state) { + case ED_IDLE: + return "IDLE"; + case ED_UNLINK: + return "UNLINK"; + case ED_OPER: + return "OPER"; + } + return "?STATE"; +} + +static inline char *pipestring(int pipe) +{ + return ed_typestring(usb_pipetype(pipe)); +} + +static inline char *td_pidstring(u32 info) +{ + switch (info & TD_DP) { + case TD_DP_SETUP: + return "SETUP"; + case TD_DP_IN: + return "IN"; + case TD_DP_OUT: + return "OUT"; + } + return "?PID"; +} + +static inline char *td_togglestring(u32 info) +{ + switch (info & TD_T) { + case TD_T_DATA0: + return "DATA0"; + case TD_T_DATA1: + return "DATA1"; + case TD_T_CARRY: + return "CARRY"; + } + return "?TOGGLE"; +} + +/*-------------------------------------------------------------------------*/ + +#ifdef DEBUG + +/* debug| print the main components of an URB + * small: 0) header + data packets 1) just header + */ +static void __attribute__((unused)) +urb_print(struct admhcd *ahcd, struct urb *urb, char *str, int small, int status) +{ + unsigned int pipe = urb->pipe; + + if (!urb->dev || !urb->dev->bus) { + admhc_dbg(ahcd, "%s URB: no dev", str); + return; + } + +#ifndef ADMHC_VERBOSE_DEBUG + if (status != 0) +#endif + admhc_dbg(ahcd, "URB-%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d " + "stat=%d\n", + str, + urb, + usb_pipedevice(pipe), + usb_pipeendpoint(pipe), + usb_pipeout(pipe) ? "out" : "in", + pipestring(pipe), + urb->transfer_flags, + urb->actual_length, + urb->transfer_buffer_length, + status); + +#ifdef ADMHC_VERBOSE_DEBUG + if (!small) { + int i, len; + + if (usb_pipecontrol(pipe)) { + admhc_dbg(ahcd, "setup(8):"); + for (i = 0; i < 8 ; i++) + printk(KERN_INFO" %02x", ((__u8 *)urb->setup_packet)[i]); + printk(KERN_INFO "\n"); + } + if (urb->transfer_buffer_length > 0 && urb->transfer_buffer) { + admhc_dbg(ahcd, "data(%d/%d):", + urb->actual_length, + urb->transfer_buffer_length); + len = usb_pipeout(pipe) ? + urb->transfer_buffer_length : urb->actual_length; + for (i = 0; i < 16 && i < len; i++) + printk(KERN_INFO " %02x", ((__u8 *)urb->transfer_buffer)[i]); + printk(KERN_INFO "%s stat:%d\n", i < len ? "..." : "", status); + } + } +#endif /* ADMHC_VERBOSE_DEBUG */ +} + +#define admhc_dbg_sw(ahcd, next, size, format, arg...) \ + do { \ + if (next) { \ + unsigned s_len; \ + s_len = scnprintf(*next, *size, format, ## arg); \ + *size -= s_len; *next += s_len; \ + } else \ + admhc_dbg(ahcd, format, ## arg); \ + } while (0); + + +static void admhc_dump_intr_mask(struct admhcd *ahcd, char *label, u32 mask, + char **next, unsigned *size) +{ + admhc_dbg_sw(ahcd, next, size, "%s 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", + label, + mask, + (mask & ADMHC_INTR_INTA) ? " INTA" : "", + (mask & ADMHC_INTR_FATI) ? " FATI" : "", + (mask & ADMHC_INTR_SWI) ? " SWI" : "", + (mask & ADMHC_INTR_TDC) ? " TDC" : "", + (mask & ADMHC_INTR_FNO) ? " FNO" : "", + (mask & ADMHC_INTR_SO) ? " SO" : "", + (mask & ADMHC_INTR_INSM) ? " INSM" : "", + (mask & ADMHC_INTR_BABI) ? " BABI" : "", + (mask & ADMHC_INTR_7) ? " !7!" : "", + (mask & ADMHC_INTR_6) ? " !6!" : "", + (mask & ADMHC_INTR_RESI) ? " RESI" : "", + (mask & ADMHC_INTR_SOFI) ? " SOFI" : "" + ); +} + +static void maybe_print_eds(struct admhcd *ahcd, char *label, u32 value, + char **next, unsigned *size) +{ + if (value) + admhc_dbg_sw(ahcd, next, size, "%s %08x\n", label, value); +} + +static char *buss2string(int state) +{ + switch (state) { + case ADMHC_BUSS_RESET: + return "reset"; + case ADMHC_BUSS_RESUME: + return "resume"; + case ADMHC_BUSS_OPER: + return "operational"; + case ADMHC_BUSS_SUSPEND: + return "suspend"; + } + return "?state"; +} + +static void +admhc_dump_status(struct admhcd *ahcd, char **next, unsigned *size) +{ + struct admhcd_regs __iomem *regs = ahcd->regs; + u32 temp; + + temp = admhc_readl(ahcd, ®s->gencontrol); + admhc_dbg_sw(ahcd, next, size, + "gencontrol 0x%08x%s%s%s%s\n", + temp, + (temp & ADMHC_CTRL_UHFE) ? " UHFE" : "", + (temp & ADMHC_CTRL_SIR) ? " SIR" : "", + (temp & ADMHC_CTRL_DMAA) ? " DMAA" : "", + (temp & ADMHC_CTRL_SR) ? " SR" : "" + ); + + temp = admhc_readl(ahcd, ®s->host_control); + admhc_dbg_sw(ahcd, next, size, + "host_control 0x%08x BUSS=%s%s\n", + temp, + buss2string(temp & ADMHC_HC_BUSS), + (temp & ADMHC_HC_DMAE) ? " DMAE" : "" + ); + + admhc_dump_intr_mask(ahcd, "int_status", + admhc_readl(ahcd, ®s->int_status), + next, size); + admhc_dump_intr_mask(ahcd, "int_enable", + admhc_readl(ahcd, ®s->int_enable), + next, size); + + maybe_print_eds(ahcd, "hosthead", + admhc_readl(ahcd, ®s->hosthead), next, size); +} + +#define dbg_port_sw(hc, num, value, next, size) \ + admhc_dbg_sw(hc, next, size, \ + "portstatus [%d] " \ + "0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ + num, temp, \ + (temp & ADMHC_PS_PRSC) ? " PRSC" : "", \ + (temp & ADMHC_PS_OCIC) ? " OCIC" : "", \ + (temp & ADMHC_PS_PSSC) ? " PSSC" : "", \ + (temp & ADMHC_PS_PESC) ? " PESC" : "", \ + (temp & ADMHC_PS_CSC) ? " CSC" : "", \ + \ + (temp & ADMHC_PS_LSDA) ? " LSDA" : "", \ + (temp & ADMHC_PS_PPS) ? " PPS" : "", \ + (temp & ADMHC_PS_PRS) ? " PRS" : "", \ + (temp & ADMHC_PS_POCI) ? " POCI" : "", \ + (temp & ADMHC_PS_PSS) ? " PSS" : "", \ + \ + (temp & ADMHC_PS_PES) ? " PES" : "", \ + (temp & ADMHC_PS_CCS) ? " CCS" : "" \ + ); + + +static void +admhc_dump_roothub( + struct admhcd *ahcd, + int verbose, + char **next, + unsigned *size) +{ + u32 temp, i; + + temp = admhc_read_rhdesc(ahcd); + if (temp == ~(u32)0) + return; + + if (verbose) { + admhc_dbg_sw(ahcd, next, size, + "rhdesc %08x%s%s%s%s%s%s PPCM=%02x%s%s%s%s NUMP=%d(%d)\n", + temp, + (temp & ADMHC_RH_CRWE) ? " CRWE" : "", + (temp & ADMHC_RH_OCIC) ? " OCIC" : "", + (temp & ADMHC_RH_LPSC) ? " LPSC" : "", + (temp & ADMHC_RH_LPSC) ? " DRWE" : "", + (temp & ADMHC_RH_LPSC) ? " OCI" : "", + (temp & ADMHC_RH_LPSC) ? " LPS" : "", + ((temp & ADMHC_RH_PPCM) >> 16), + (temp & ADMHC_RH_NOCP) ? " NOCP" : "", + (temp & ADMHC_RH_OCPM) ? " OCPM" : "", + (temp & ADMHC_RH_NPS) ? " NPS" : "", + (temp & ADMHC_RH_PSM) ? " PSM" : "", + (temp & ADMHC_RH_NUMP), ahcd->num_ports + ); + } + + for (i = 0; i < ahcd->num_ports; i++) { + temp = admhc_read_portstatus(ahcd, i); + dbg_port_sw(ahcd, i, temp, next, size); + } +} + +static void admhc_dump(struct admhcd *ahcd, int verbose) +{ + admhc_dbg(ahcd, "ADMHC ahcd state\n"); + + /* dumps some of the state we know about */ + admhc_dump_status(ahcd, NULL, NULL); + admhc_dbg(ahcd, "current frame #%04x\n", + admhc_frame_no(ahcd)); + + admhc_dump_roothub(ahcd, verbose, NULL, NULL); +} + +static const char data0[] = "DATA0"; +static const char data1[] = "DATA1"; + +static void admhc_dump_td(const struct admhcd *ahcd, const char *label, + const struct td *td) +{ + u32 tmp; + + admhc_dbg(ahcd, "%s td %p; urb %p index %d; hwNextTD %08x\n", + label, td, + td->urb, td->index, + hc32_to_cpup(ahcd, &td->hwNextTD)); + + tmp = hc32_to_cpup(ahcd, &td->hwINFO); + admhc_dbg(ahcd, " status %08x%s CC=%x EC=%d %s %s ISI=%x FN=%x\n", + tmp, + (tmp & TD_OWN) ? " OWN" : "", + TD_CC_GET(tmp), + TD_EC_GET(tmp), + td_togglestring(tmp), + td_pidstring(tmp), + TD_ISI_GET(tmp), + TD_FN_GET(tmp)); + + tmp = hc32_to_cpup(ahcd, &td->hwCBL); + admhc_dbg(ahcd, " dbp %08x; cbl %08x; LEN=%d%s\n", + hc32_to_cpup(ahcd, &td->hwDBP), + tmp, + TD_BL_GET(tmp), + (tmp & TD_IE) ? " IE" : ""); +} + +/* caller MUST own hcd spinlock if verbose is set! */ +static void __attribute__((unused)) +admhc_dump_ed(const struct admhcd *ahcd, const char *label, + const struct ed *ed, int verbose) +{ + u32 tmp = hc32_to_cpu(ahcd, ed->hwINFO); + + admhc_dbg(ahcd, "%s ed %p %s type %s; next ed %08x\n", + label, + ed, ed_statestring(ed->state), ed_typestring(ed->type), + hc32_to_cpup(ahcd, &ed->hwNextED)); + + admhc_dbg(ahcd, " info %08x MAX=%d%s%s%s%s EP=%d DEV=%d\n", tmp, + ED_MPS_GET(tmp), + (tmp & ED_ISO) ? " ISO" : "", + (tmp & ED_SKIP) ? " SKIP" : "", + (tmp & ED_SPEED_FULL) ? " FULL" : " LOW", + (tmp & ED_INT) ? " INT" : "", + ED_EN_GET(tmp), + ED_FA_GET(tmp)); + + tmp = hc32_to_cpup(ahcd, &ed->hwHeadP); + admhc_dbg(ahcd, " tds: head %08x tail %08x %s%s%s\n", + tmp & TD_MASK, + hc32_to_cpup(ahcd, &ed->hwTailP), + (tmp & ED_C) ? data1 : data0, + (tmp & ED_H) ? " HALT" : "", + verbose ? " td list follows" : " (not listing)"); + + if (verbose) { + struct list_head *tmp; + + /* use ed->td_list because HC concurrently modifies + * hwNextTD as it accumulates ed_donelist. + */ + list_for_each(tmp, &ed->td_list) { + struct td *td; + td = list_entry(tmp, struct td, td_list); + admhc_dump_td(ahcd, " ->", td); + } + } +} + +#else /* ifdef DEBUG */ + +static inline void urb_print(struct admhcd *ahcd, struct urb * urb, char * str, + int small, int status) {} +static inline void admhc_dump_ed(const struct admhcd *ahcd, const char *label, + const struct ed *ed, int verbose) {} +static inline void admhc_dump_td(const struct admhcd *ahcd, const char *label, + const struct td *td) {} +static inline void admhc_dump(struct admhcd *ahcd, int verbose) {} + +#undef ADMHC_VERBOSE_DEBUG + +#endif /* DEBUG */ + +/*-------------------------------------------------------------------------*/ + +#ifdef STUB_DEBUG_FILES + +static inline void create_debug_files(struct admhcd *bus) { } +static inline void remove_debug_files(struct admhcd *bus) { } + +#else + +static int debug_async_open(struct inode *, struct file *); +static int debug_periodic_open(struct inode *, struct file *); +static int debug_registers_open(struct inode *, struct file *); +static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*); +static int debug_close(struct inode *, struct file *); + +static const struct file_operations debug_async_fops = { + .owner = THIS_MODULE, + .open = debug_async_open, + .read = debug_output, + .release = debug_close, + .llseek = default_llseek, +}; +static const struct file_operations debug_periodic_fops = { + .owner = THIS_MODULE, + .open = debug_periodic_open, + .read = debug_output, + .release = debug_close, + .llseek = default_llseek, +}; +static const struct file_operations debug_registers_fops = { + .owner = THIS_MODULE, + .open = debug_registers_open, + .read = debug_output, + .release = debug_close, + .llseek = default_llseek, +}; + +static struct dentry *admhc_debug_root; + +struct debug_buffer { + ssize_t (*fill_func)(struct debug_buffer *); /* fill method */ + struct admhcd *ahcd; + struct mutex mutex; /* protect filling of buffer */ + size_t count; /* number of characters filled into buffer */ + char *page; +}; + +static ssize_t +show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed) +{ + unsigned temp; + unsigned size = count; + + if (!ed) + return 0; + + /* dump a snapshot of the bulk or control schedule */ + while (ed) { + u32 info = hc32_to_cpu(ahcd, ed->hwINFO); + u32 headp = hc32_to_cpu(ahcd, ed->hwHeadP); + u32 tailp = hc32_to_cpu(ahcd, ed->hwTailP); + struct list_head *entry; + struct td *td; + + temp = scnprintf(buf, size, + "ed/%p %s %s %cs dev%d ep%d %s%smax %d %08x%s%s %s" + " h:%08x t:%08x", + ed, + ed_statestring(ed->state), + ed_typestring(ed->type), + (info & ED_SPEED_FULL) ? 'f' : 'l', + info & ED_FA_MASK, + (info >> ED_EN_SHIFT) & ED_EN_MASK, + (info & ED_INT) ? "INT " : "", + (info & ED_ISO) ? "ISO " : "", + (info >> ED_MPS_SHIFT) & ED_MPS_MASK , + info, + (info & ED_SKIP) ? " S" : "", + (headp & ED_H) ? " H" : "", + (headp & ED_C) ? data1 : data0, + headp & ED_MASK, tailp); + size -= temp; + buf += temp; + + list_for_each(entry, &ed->td_list) { + u32 dbp, cbl; + + td = list_entry(entry, struct td, td_list); + info = hc32_to_cpup(ahcd, &td->hwINFO); + dbp = hc32_to_cpup(ahcd, &td->hwDBP); + cbl = hc32_to_cpup(ahcd, &td->hwCBL); + + temp = scnprintf(buf, size, + "\n\ttd/%p %s %d %s%scc=%x urb %p (%08x,%08x)", + td, + td_pidstring(info), + TD_BL_GET(cbl), + (info & TD_OWN) ? "" : "DONE ", + (cbl & TD_IE) ? "IE " : "", + TD_CC_GET(info), td->urb, info, cbl); + size -= temp; + buf += temp; + } + + temp = scnprintf(buf, size, "\n"); + size -= temp; + buf += temp; + + ed = ed->ed_next; + } + + return count - size; +} + +static ssize_t fill_async_buffer(struct debug_buffer *buf) +{ + struct admhcd *ahcd; + size_t temp; + unsigned long flags; + + ahcd = buf->ahcd; + + spin_lock_irqsave(&ahcd->lock, flags); + temp = show_list(ahcd, buf->page, PAGE_SIZE, ahcd->ed_head); + spin_unlock_irqrestore(&ahcd->lock, flags); + + return temp; +} + + +#define DBG_SCHED_LIMIT 64 + +static ssize_t fill_periodic_buffer(struct debug_buffer *buf) +{ + struct admhcd *ahcd; + struct ed **seen, *ed; + unsigned long flags; + unsigned temp, size, seen_count; + char *next; + unsigned i; + + seen = kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC); + if (!seen) + return 0; + seen_count = 0; + + ahcd = buf->ahcd; + next = buf->page; + size = PAGE_SIZE; + + temp = scnprintf(next, size, "size = %d\n", NUM_INTS); + size -= temp; + next += temp; + + /* dump a snapshot of the periodic schedule (and load) */ + spin_lock_irqsave(&ahcd->lock, flags); + for (i = 0; i < NUM_INTS; i++) { + ed = ahcd->periodic[i]; + if (!ed) + continue; + + temp = scnprintf(next, size, "%2d [%3d]:", i, ahcd->load[i]); + size -= temp; + next += temp; + + do { + temp = scnprintf(next, size, " ed%d/%p", + ed->interval, ed); + size -= temp; + next += temp; + for (temp = 0; temp < seen_count; temp++) { + if (seen[temp] == ed) + break; + } + + /* show more info the first time around */ + if (temp == seen_count) { + u32 info = hc32_to_cpu(ahcd, ed->hwINFO); + struct list_head *entry; + unsigned qlen = 0; + + /* qlen measured here in TDs, not urbs */ + list_for_each(entry, &ed->td_list) + qlen++; + temp = scnprintf(next, size, + " (%cs dev%d ep%d%s qlen %u" + " max %d %08x%s%s)", + (info & ED_SPEED_FULL) ? 'f' : 'l', + ED_FA_GET(info), + ED_EN_GET(info), + (info & ED_ISO) ? "iso" : "int", + qlen, + ED_MPS_GET(info), + info, + (info & ED_SKIP) ? " K" : "", + (ed->hwHeadP & + cpu_to_hc32(ahcd, ED_H)) ? + " H" : ""); + size -= temp; + next += temp; + + if (seen_count < DBG_SCHED_LIMIT) + seen[seen_count++] = ed; + + ed = ed->ed_next; + + } else { + /* we've seen it and what's after */ + temp = 0; + ed = NULL; + } + + } while (ed); + + temp = scnprintf(next, size, "\n"); + size -= temp; + next += temp; + } + spin_unlock_irqrestore(&ahcd->lock, flags); + kfree(seen); + + return PAGE_SIZE - size; +} + + +#undef DBG_SCHED_LIMIT + +static ssize_t fill_registers_buffer(struct debug_buffer *buf) +{ + struct usb_hcd *hcd; + struct admhcd *ahcd; + struct admhcd_regs __iomem *regs; + unsigned long flags; + unsigned temp, size; + char *next; + u32 rdata; + + ahcd = buf->ahcd; + hcd = admhc_to_hcd(ahcd); + regs = ahcd->regs; + next = buf->page; + size = PAGE_SIZE; + + spin_lock_irqsave(&ahcd->lock, flags); + + /* dump driver info, then registers in spec order */ + + admhc_dbg_sw(ahcd, &next, &size, + "bus %s, device %s\n" + "%s\n" + "%s\n", + hcd->self.controller->bus->name, + dev_name(hcd->self.controller), + hcd->product_desc, + hcd_name); + + if (!HCD_HW_ACCESSIBLE(hcd)) { + size -= scnprintf(next, size, + "SUSPENDED (no register access)\n"); + goto done; + } + + admhc_dump_status(ahcd, &next, &size); + + /* other registers mostly affect frame timings */ + rdata = admhc_readl(ahcd, ®s->fminterval); + temp = scnprintf(next, size, + "fmintvl 0x%08x %sFSLDP=0x%04x FI=0x%04x\n", + rdata, (rdata & ADMHC_SFI_FIT) ? "FIT " : "", + (rdata >> ADMHC_SFI_FSLDP_SHIFT) & ADMHC_SFI_FSLDP_MASK, + rdata & ADMHC_SFI_FI_MASK); + size -= temp; + next += temp; + + rdata = admhc_readl(ahcd, ®s->fmnumber); + temp = scnprintf(next, size, "fmnumber 0x%08x %sFR=0x%04x FN=%04x\n", + rdata, (rdata & ADMHC_SFN_FRT) ? "FRT " : "", + (rdata >> ADMHC_SFN_FR_SHIFT) & ADMHC_SFN_FR_MASK, + rdata & ADMHC_SFN_FN_MASK); + size -= temp; + next += temp; + + /* TODO: use predefined bitmask */ + rdata = admhc_readl(ahcd, ®s->lsthresh); + temp = scnprintf(next, size, "lsthresh 0x%04x\n", + rdata & 0x3fff); + size -= temp; + next += temp; + + temp = scnprintf(next, size, "hub poll timer: %s\n", + admhcd_to_hcd(ahcd)->poll_rh ? "ON" : "OFF"); + size -= temp; + next += temp; + + /* roothub */ + admhc_dump_roothub(ahcd, 1, &next, &size); + +done: + spin_unlock_irqrestore(&ahcd->lock, flags); + return PAGE_SIZE - size; +} + + +static struct debug_buffer *alloc_buffer(struct admhcd *ahcd, + ssize_t (*fill_func)(struct debug_buffer *)) +{ + struct debug_buffer *buf; + + buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL); + + if (buf) { + buf->ahcd = ahcd; + buf->fill_func = fill_func; + mutex_init(&buf->mutex); + } + + return buf; +} + +static int fill_buffer(struct debug_buffer *buf) +{ + int ret = 0; + + if (!buf->page) + buf->page = (char *)get_zeroed_page(GFP_KERNEL); + + if (!buf->page) { + ret = -ENOMEM; + goto out; + } + + ret = buf->fill_func(buf); + + if (ret >= 0) { + buf->count = ret; + ret = 0; + } + +out: + return ret; +} + +static ssize_t debug_output(struct file *file, char __user *user_buf, + size_t len, loff_t *offset) +{ + struct debug_buffer *buf = file->private_data; + int ret = 0; + + mutex_lock(&buf->mutex); + if (buf->count == 0) { + ret = fill_buffer(buf); + if (ret != 0) { + mutex_unlock(&buf->mutex); + goto out; + } + } + mutex_unlock(&buf->mutex); + + ret = simple_read_from_buffer(user_buf, len, offset, + buf->page, buf->count); + +out: + return ret; +} + +static int debug_close(struct inode *inode, struct file *file) +{ + struct debug_buffer *buf = file->private_data; + + if (buf) { + if (buf->page) + free_page((unsigned long)buf->page); + kfree(buf); + } + + return 0; +} + +static int debug_async_open(struct inode *inode, struct file *file) +{ + file->private_data = alloc_buffer(inode->i_private, fill_async_buffer); + + return file->private_data ? 0 : -ENOMEM; +} + +static int debug_periodic_open(struct inode *inode, struct file *file) +{ + file->private_data = alloc_buffer(inode->i_private, + fill_periodic_buffer); + + return file->private_data ? 0 : -ENOMEM; +} + +static int debug_registers_open(struct inode *inode, struct file *file) +{ + file->private_data = alloc_buffer(inode->i_private, + fill_registers_buffer); + + return file->private_data ? 0 : -ENOMEM; +} + +static inline void create_debug_files(struct admhcd *ahcd) +{ + struct usb_bus *bus = &admhcd_to_hcd(ahcd)->self; + + ahcd->debug_dir = debugfs_create_dir(bus->bus_name, admhc_debug_root); + if (!ahcd->debug_dir) + goto dir_error; + + ahcd->debug_async = debugfs_create_file("async", S_IRUGO, + ahcd->debug_dir, ahcd, + &debug_async_fops); + if (!ahcd->debug_async) + goto async_error; + + ahcd->debug_periodic = debugfs_create_file("periodic", S_IRUGO, + ahcd->debug_dir, ahcd, + &debug_periodic_fops); + if (!ahcd->debug_periodic) + goto periodic_error; + + ahcd->debug_registers = debugfs_create_file("registers", S_IRUGO, + ahcd->debug_dir, ahcd, + &debug_registers_fops); + if (!ahcd->debug_registers) + goto registers_error; + + admhc_dbg(ahcd, "created debug files\n"); + return; + +registers_error: + debugfs_remove(ahcd->debug_periodic); +periodic_error: + debugfs_remove(ahcd->debug_async); +async_error: + debugfs_remove(ahcd->debug_dir); +dir_error: + ahcd->debug_periodic = NULL; + ahcd->debug_async = NULL; + ahcd->debug_dir = NULL; +} + +static inline void remove_debug_files(struct admhcd *ahcd) +{ + debugfs_remove(ahcd->debug_registers); + debugfs_remove(ahcd->debug_periodic); + debugfs_remove(ahcd->debug_async); + debugfs_remove(ahcd->debug_dir); +} + +#endif + +/*-------------------------------------------------------------------------*/ diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c new file mode 100644 index 000000000..798fd2208 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c @@ -0,0 +1,228 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci-au1xxx.c + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2002 David Brownell + * (C) Copyright 2002 Hewlett-Packard Company + * + * Written by Christopher Hoover + * Based on fragments of previous driver by Russell King et al. + * + * Modified for LH7A404 from ahcd-sa1111.c + * by Durgesh Pattamatta + * Modified for AMD Alchemy Au1xxx + * by Matt Porter + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include + +#include +#include + +#ifdef DEBUG +#define HCD_DBG(f, a...) printk(KERN_DEBUG "%s: " f, hcd_name, ## a) +#else +#define HCD_DBG(f, a...) do {} while (0) +#endif +#define HCD_ERR(f, a...) printk(KERN_ERR "%s: " f, hcd_name, ## a) +#define HCD_INFO(f, a...) printk(KERN_INFO "%s: " f, hcd_name, ## a) + +/*-------------------------------------------------------------------------*/ + +static int admhc_adm5120_probe(const struct hc_driver *driver, + struct platform_device *dev) +{ + int retval; + struct usb_hcd *hcd; + int irq; + struct resource *regs; + + /* sanity checks */ + regs = platform_get_resource(dev, IORESOURCE_MEM, 0); + if (!regs) { + HCD_DBG("no IOMEM resource found\n"); + return -ENODEV; + } + + irq = platform_get_irq(dev, 0); + if (irq < 0) { + HCD_DBG("no IRQ resource found\n"); + return -ENODEV; + } + + hcd = usb_create_hcd(driver, &dev->dev, "ADM5120"); + if (!hcd) + return -ENOMEM; + + hcd->rsrc_start = regs->start; + hcd->rsrc_len = regs->end - regs->start + 1; + + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { + HCD_DBG("request_mem_region failed\n"); + retval = -EBUSY; + goto err_dev; + } + + hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); + if (!hcd->regs) { + HCD_DBG("ioremap failed\n"); + retval = -ENOMEM; + goto err_mem; + } + + admhc_hcd_init(hcd_to_admhcd(hcd)); + + retval = usb_add_hcd(hcd, irq, 0); + if (retval) + goto err_io; + + return 0; + +err_io: + iounmap(hcd->regs); +err_mem: + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); +err_dev: + usb_put_hcd(hcd); + return retval; +} + + +/* may be called without controller electrically present */ +/* may be called with controller, bus, and devices active */ + +static void admhc_adm5120_remove(struct usb_hcd *hcd, + struct platform_device *dev) +{ + usb_remove_hcd(hcd); + iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + usb_put_hcd(hcd); +} + +static int admhc_adm5120_start(struct usb_hcd *hcd) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + int ret; + + ret = admhc_init(ahcd); + if (ret < 0) { + HCD_ERR("unable to init %s\n", hcd->self.bus_name); + goto err; + } + + ret = admhc_run(ahcd); + if (ret < 0) { + HCD_ERR("unable to run %s\n", hcd->self.bus_name); + goto err_stop; + } + + return 0; + +err_stop: + admhc_stop(hcd); +err: + return ret; +} + +static const struct hc_driver adm5120_hc_driver = { + .description = hcd_name, + .product_desc = "ADM5120 built-in USB 1.1 Host Controller", + .hcd_priv_size = sizeof(struct admhcd), + + /* + * generic hardware linkage + */ + .irq = admhc_irq, + .flags = HCD_USB11 | HCD_MEMORY, + + /* + * basic lifecycle operations + */ + .start = admhc_adm5120_start, + .stop = admhc_stop, + .shutdown = admhc_shutdown, + + /* + * managing i/o requests and associated device resources + */ + .urb_enqueue = admhc_urb_enqueue, + .urb_dequeue = admhc_urb_dequeue, + .endpoint_disable = admhc_endpoint_disable, + + /* + * scheduling support + */ + .get_frame_number = admhc_get_frame_number, + + /* + * root hub support + */ + .hub_status_data = admhc_hub_status_data, + .hub_control = admhc_hub_control, +#ifdef CONFIG_PM + .bus_suspend = admhc_bus_suspend, + .bus_resume = admhc_bus_resume, +#endif + .start_port_reset = admhc_start_port_reset, +}; + +static int usb_hcd_adm5120_probe(struct platform_device *pdev) +{ + int ret; + + ret = admhc_adm5120_probe(&adm5120_hc_driver, pdev); + + return ret; +} + +static int usb_hcd_adm5120_remove(struct platform_device *pdev) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + + admhc_adm5120_remove(hcd, pdev); + + return 0; +} + +#ifdef CONFIG_PM +/* TODO */ +static int usb_hcd_adm5120_suspend(struct platform_device *dev) +{ + struct usb_hcd *hcd = platform_get_drvdata(dev); + + return 0; +} + +static int usb_hcd_adm5120_resume(struct platform_device *dev) +{ + struct usb_hcd *hcd = platform_get_drvdata(dev); + + return 0; +} +#else +#define usb_hcd_adm5120_suspend NULL +#define usb_hcd_adm5120_resume NULL +#endif /* CONFIG_PM */ + +static struct platform_driver usb_hcd_adm5120_driver = { + .probe = usb_hcd_adm5120_probe, + .remove = usb_hcd_adm5120_remove, + .shutdown = usb_hcd_platform_shutdown, + .suspend = usb_hcd_adm5120_suspend, + .resume = usb_hcd_adm5120_resume, + .driver = { + .name = "adm5120-hcd", + .owner = THIS_MODULE, + }, +}; + diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c new file mode 100644 index 000000000..f721ec1ff --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c @@ -0,0 +1,843 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci-hcd.c + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2004 David Brownell + * + * [ Initialisation is based on Linus' ] + * [ uhci code and gregs ahcd fragments ] + * [ (C) Copyright 1999 Linus Torvalds ] + * [ (C) Copyright 1999 Gregory P. Smith] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DRIVER_VERSION "0.27.0" +#define DRIVER_AUTHOR "Gabor Juhos " +#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver" + +/*-------------------------------------------------------------------------*/ + +#undef ADMHC_VERBOSE_DEBUG /* not always helpful */ + +/* For initializing controller (mask in an HCFS mode too) */ +#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR + +#define ADMHC_INTR_INIT \ + (ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \ + | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI) + +/*-------------------------------------------------------------------------*/ + +static const char hcd_name[] = "admhc-hcd"; + +#define STATECHANGE_DELAY msecs_to_jiffies(300) + +#include "adm5120.h" + +static void admhc_dump(struct admhcd *ahcd, int verbose); +static int admhc_init(struct admhcd *ahcd); +static void admhc_stop(struct usb_hcd *hcd); + +#include "adm5120-dbg.c" +#include "adm5120-mem.c" +#include "adm5120-pm.c" +#include "adm5120-hub.c" +#include "adm5120-q.c" + +/*-------------------------------------------------------------------------*/ + +/* + * queue up an urb for anything except the root hub + */ +static int admhc_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, + gfp_t mem_flags) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + struct ed *ed; + struct urb_priv *urb_priv; + unsigned int pipe = urb->pipe; + int td_cnt = 0; + unsigned long flags; + int ret = 0; + +#ifdef ADMHC_VERBOSE_DEBUG + spin_lock_irqsave(&ahcd->lock, flags); + urb_print(ahcd, urb, "ENQEUE", usb_pipein(pipe), -EINPROGRESS); + spin_unlock_irqrestore(&ahcd->lock, flags); +#endif + + /* every endpoint has an ed, locate and maybe (re)initialize it */ + ed = ed_get(ahcd, urb->ep, urb->dev, pipe, urb->interval); + if (!ed) + return -ENOMEM; + + /* for the private part of the URB we need the number of TDs */ + switch (ed->type) { + case PIPE_CONTROL: + if (urb->transfer_buffer_length > TD_DATALEN_MAX) + /* td_submit_urb() doesn't yet handle these */ + return -EMSGSIZE; + + /* 1 TD for setup, 1 for ACK, plus ... */ + td_cnt = 2; + /* FALLTHROUGH */ + case PIPE_BULK: + /* one TD for every 4096 Bytes (can be up to 8K) */ + td_cnt += urb->transfer_buffer_length / TD_DATALEN_MAX; + /* ... and for any remaining bytes ... */ + if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0) + td_cnt++; + /* ... and maybe a zero length packet to wrap it up */ + if (td_cnt == 0) + td_cnt++; + else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0 + && (urb->transfer_buffer_length + % usb_maxpacket(urb->dev, pipe, + usb_pipeout(pipe))) == 0) + td_cnt++; + break; + case PIPE_INTERRUPT: + /* + * for Interrupt IN/OUT transactions, each ED contains + * only 1 TD. + * TODO: check transfer_buffer_length? + */ + td_cnt = 1; + break; + case PIPE_ISOCHRONOUS: + /* number of packets from URB */ + td_cnt = urb->number_of_packets; + break; + } + + urb_priv = urb_priv_alloc(ahcd, td_cnt, mem_flags); + if (!urb_priv) + return -ENOMEM; + + urb_priv->ed = ed; + + spin_lock_irqsave(&ahcd->lock, flags); + /* don't submit to a dead HC */ + if (!HCD_HW_ACCESSIBLE(hcd)) { + ret = -ENODEV; + goto fail; + } + if (!HC_IS_RUNNING(hcd->state)) { + ret = -ENODEV; + goto fail; + } + + ret = usb_hcd_link_urb_to_ep(hcd, urb); + if (ret) + goto fail; + + /* schedule the ed if needed */ + if (ed->state == ED_IDLE) { + ret = ed_schedule(ahcd, ed); + if (ret < 0) { + usb_hcd_unlink_urb_from_ep(hcd, urb); + goto fail; + } + if (ed->type == PIPE_ISOCHRONOUS) { + u16 frame = admhc_frame_no(ahcd); + + /* delay a few frames before the first TD */ + frame += max_t (u16, 8, ed->interval); + frame &= ~(ed->interval - 1); + frame |= ed->branch; + urb->start_frame = frame; + + /* yes, only URB_ISO_ASAP is supported, and + * urb->start_frame is never used as input. + */ + } + } else if (ed->type == PIPE_ISOCHRONOUS) + urb->start_frame = ed->last_iso + ed->interval; + + /* fill the TDs and link them to the ed; and + * enable that part of the schedule, if needed + * and update count of queued periodic urbs + */ + urb->hcpriv = urb_priv; + td_submit_urb(ahcd, urb); + +#ifdef ADMHC_VERBOSE_DEBUG + admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1); +#endif + +fail: + if (ret) + urb_priv_free(ahcd, urb_priv); + + spin_unlock_irqrestore(&ahcd->lock, flags); + return ret; +} + +/* + * decouple the URB from the HC queues (TDs, urb_priv); + * reporting is always done + * asynchronously, and we might be dealing with an urb that's + * partially transferred, or an ED with other urbs being unlinked. + */ +static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, + int status) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + unsigned long flags; + int ret; + + spin_lock_irqsave(&ahcd->lock, flags); + +#ifdef ADMHC_VERBOSE_DEBUG + urb_print(ahcd, urb, "DEQUEUE", 1, status); +#endif + ret = usb_hcd_check_unlink_urb(hcd, urb, status); + if (ret) { + /* Do nothing */ + ; + } else if (HC_IS_RUNNING(hcd->state)) { + struct urb_priv *urb_priv; + + /* Unless an IRQ completed the unlink while it was being + * handed to us, flag it for unlink and giveback, and force + * some upcoming INTR_SF to call finish_unlinks() + */ + urb_priv = urb->hcpriv; + if (urb_priv) { + if (urb_priv->ed->state == ED_OPER) + start_ed_unlink(ahcd, urb_priv->ed); + } + } else { + /* + * with HC dead, we won't respect hc queue pointers + * any more ... just clean up every urb's memory. + */ + if (urb->hcpriv) + finish_urb(ahcd, urb, status); + } + spin_unlock_irqrestore(&ahcd->lock, flags); + + return ret; +} + +/*-------------------------------------------------------------------------*/ + +/* frees config/altsetting state for endpoints, + * including ED memory, dummy TD, and bulk/intr data toggle + */ + +static void admhc_endpoint_disable(struct usb_hcd *hcd, + struct usb_host_endpoint *ep) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + unsigned long flags; + struct ed *ed = ep->hcpriv; + unsigned limit = 1000; + + /* ASSERT: any requests/urbs are being unlinked */ + /* ASSERT: nobody can be submitting urbs for this any more */ + + if (!ed) + return; + +#ifdef ADMHC_VERBOSE_DEBUG + spin_lock_irqsave(&ahcd->lock, flags); + admhc_dump_ed(ahcd, "EP-DISABLE", ed, 1); + spin_unlock_irqrestore(&ahcd->lock, flags); +#endif + +rescan: + spin_lock_irqsave(&ahcd->lock, flags); + + if (!HC_IS_RUNNING(hcd->state)) { +sanitize: + ed->state = ED_IDLE; + finish_unlinks(ahcd, 0); + } + + switch (ed->state) { + case ED_UNLINK: /* wait for hw to finish? */ + /* major IRQ delivery trouble loses INTR_SOFI too... */ + if (limit-- == 0) { + admhc_warn(ahcd, "IRQ INTR_SOFI lossage\n"); + goto sanitize; + } + spin_unlock_irqrestore(&ahcd->lock, flags); + schedule_timeout_uninterruptible(1); + goto rescan; + case ED_IDLE: /* fully unlinked */ + if (list_empty(&ed->td_list)) { + td_free(ahcd, ed->dummy); + ed_free(ahcd, ed); + break; + } + /* else FALL THROUGH */ + default: + /* caller was supposed to have unlinked any requests; + * that's not our job. can't recover; must leak ed. + */ + admhc_err(ahcd, "leak ed %p (#%02x) state %d%s\n", + ed, ep->desc.bEndpointAddress, ed->state, + list_empty(&ed->td_list) ? "" : " (has tds)"); + td_free(ahcd, ed->dummy); + break; + } + + ep->hcpriv = NULL; + + spin_unlock_irqrestore(&ahcd->lock, flags); +} + +static int admhc_get_frame_number(struct usb_hcd *hcd) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + + return admhc_frame_no(ahcd); +} + +static void admhc_usb_reset(struct admhcd *ahcd) +{ +#if 0 + ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); + ahcd->hc_control &= OHCI_CTRL_RWC; + admhc_writel(ahcd, ahcd->hc_control, &ahcd->regs->control); +#else + /* FIXME */ + ahcd->host_control = ADMHC_BUSS_RESET; + admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); +#endif +} + +/* admhc_shutdown forcibly disables IRQs and DMA, helping kexec and + * other cases where the next software may expect clean state from the + * "firmware". this is bus-neutral, unlike shutdown() methods. + */ +static void +admhc_shutdown(struct usb_hcd *hcd) +{ + struct admhcd *ahcd; + + ahcd = hcd_to_admhcd(hcd); + admhc_intr_disable(ahcd, ADMHC_INTR_MIE); + admhc_dma_disable(ahcd); + admhc_usb_reset(ahcd); + /* flush the writes */ + admhc_writel_flush(ahcd); +} + +/*-------------------------------------------------------------------------* + * HC functions + *-------------------------------------------------------------------------*/ + +static void admhc_eds_cleanup(struct admhcd *ahcd) +{ + if (ahcd->ed_tails[PIPE_INTERRUPT]) { + ed_free(ahcd, ahcd->ed_tails[PIPE_INTERRUPT]); + ahcd->ed_tails[PIPE_INTERRUPT] = NULL; + } + + if (ahcd->ed_tails[PIPE_ISOCHRONOUS]) { + ed_free(ahcd, ahcd->ed_tails[PIPE_ISOCHRONOUS]); + ahcd->ed_tails[PIPE_ISOCHRONOUS] = NULL; + } + + if (ahcd->ed_tails[PIPE_CONTROL]) { + ed_free(ahcd, ahcd->ed_tails[PIPE_CONTROL]); + ahcd->ed_tails[PIPE_CONTROL] = NULL; + } + + if (ahcd->ed_tails[PIPE_BULK]) { + ed_free(ahcd, ahcd->ed_tails[PIPE_BULK]); + ahcd->ed_tails[PIPE_BULK] = NULL; + } + + ahcd->ed_head = NULL; +} + +#define ED_DUMMY_INFO (ED_SPEED_FULL | ED_SKIP) + +static int admhc_eds_init(struct admhcd *ahcd) +{ + struct ed *ed; + + ed = ed_create(ahcd, PIPE_INTERRUPT, ED_DUMMY_INFO); + if (!ed) + goto err; + + ahcd->ed_tails[PIPE_INTERRUPT] = ed; + + ed = ed_create(ahcd, PIPE_ISOCHRONOUS, ED_DUMMY_INFO); + if (!ed) + goto err; + + ahcd->ed_tails[PIPE_ISOCHRONOUS] = ed; + ed->ed_prev = ahcd->ed_tails[PIPE_INTERRUPT]; + ahcd->ed_tails[PIPE_INTERRUPT]->ed_next = ed; + ahcd->ed_tails[PIPE_INTERRUPT]->hwNextED = cpu_to_hc32(ahcd, ed->dma); + + ed = ed_create(ahcd, PIPE_CONTROL, ED_DUMMY_INFO); + if (!ed) + goto err; + + ahcd->ed_tails[PIPE_CONTROL] = ed; + ed->ed_prev = ahcd->ed_tails[PIPE_ISOCHRONOUS]; + ahcd->ed_tails[PIPE_ISOCHRONOUS]->ed_next = ed; + ahcd->ed_tails[PIPE_ISOCHRONOUS]->hwNextED = cpu_to_hc32(ahcd, ed->dma); + + ed = ed_create(ahcd, PIPE_BULK, ED_DUMMY_INFO); + if (!ed) + goto err; + + ahcd->ed_tails[PIPE_BULK] = ed; + ed->ed_prev = ahcd->ed_tails[PIPE_CONTROL]; + ahcd->ed_tails[PIPE_CONTROL]->ed_next = ed; + ahcd->ed_tails[PIPE_CONTROL]->hwNextED = cpu_to_hc32(ahcd, ed->dma); + + ahcd->ed_head = ahcd->ed_tails[PIPE_INTERRUPT]; + +#ifdef ADMHC_VERBOSE_DEBUG + admhc_dump_ed(ahcd, "ed intr", ahcd->ed_tails[PIPE_INTERRUPT], 1); + admhc_dump_ed(ahcd, "ed isoc", ahcd->ed_tails[PIPE_ISOCHRONOUS], 1); + admhc_dump_ed(ahcd, "ed ctrl", ahcd->ed_tails[PIPE_CONTROL], 1); + admhc_dump_ed(ahcd, "ed bulk", ahcd->ed_tails[PIPE_BULK], 1); +#endif + + return 0; + +err: + admhc_eds_cleanup(ahcd); + return -ENOMEM; +} + +/* init memory, and kick BIOS/SMM off */ + +static int admhc_init(struct admhcd *ahcd) +{ + struct usb_hcd *hcd = admhcd_to_hcd(ahcd); + int ret; + + admhc_disable(ahcd); + ahcd->regs = hcd->regs; + + /* Disable HC interrupts */ + admhc_intr_disable(ahcd, ADMHC_INTR_MIE); + + /* Read the number of ports unless overridden */ + if (ahcd->num_ports == 0) + ahcd->num_ports = admhc_read_rhdesc(ahcd) & ADMHC_RH_NUMP; + + ret = admhc_mem_init(ahcd); + if (ret) + goto err; + + /* init dummy endpoints */ + ret = admhc_eds_init(ahcd); + if (ret) + goto err; + + create_debug_files(ahcd); + + return 0; + +err: + admhc_stop(hcd); + return ret; +} + +/*-------------------------------------------------------------------------*/ + +/* Start an OHCI controller, set the BUS operational + * resets USB and controller + * enable interrupts + */ +static int admhc_run(struct admhcd *ahcd) +{ + u32 val; + int first = ahcd->fminterval == 0; + struct usb_hcd *hcd = admhcd_to_hcd(ahcd); + + admhc_disable(ahcd); + + /* boot firmware should have set this up (5.1.1.3.1) */ + if (first) { + val = admhc_readl(ahcd, &ahcd->regs->fminterval); + ahcd->fminterval = val & ADMHC_SFI_FI_MASK; + if (ahcd->fminterval != FI) + admhc_dbg(ahcd, "fminterval delta %d\n", + ahcd->fminterval - FI); + ahcd->fminterval |= + (FSLDP(ahcd->fminterval) << ADMHC_SFI_FSLDP_SHIFT); + /* also: power/overcurrent flags in rhdesc */ + } + +#if 0 /* TODO: not applicable */ + /* Reset USB nearly "by the book". RemoteWakeupConnected has + * to be checked in case boot firmware (BIOS/SMM/...) has set up + * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM). + * If the bus glue detected wakeup capability then it should + * already be enabled; if so we'll just enable it again. + */ + if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0) + device_set_wakeup_capable(hcd->self.controller, 1); +#endif + + switch (ahcd->host_control & ADMHC_HC_BUSS) { + case ADMHC_BUSS_OPER: + val = 0; + break; + case ADMHC_BUSS_SUSPEND: + /* FALLTHROUGH ? */ + case ADMHC_BUSS_RESUME: + ahcd->host_control = ADMHC_BUSS_RESUME; + val = 10 /* msec wait */; + break; + /* case ADMHC_BUSS_RESET: */ + default: + ahcd->host_control = ADMHC_BUSS_RESET; + val = 50 /* msec wait */; + break; + } + admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); + + /* flush the writes */ + admhc_writel_flush(ahcd); + + msleep(val); + val = admhc_read_rhdesc(ahcd); + if (!(val & ADMHC_RH_NPS)) { + /* power down each port */ + for (val = 0; val < ahcd->num_ports; val++) + admhc_write_portstatus(ahcd, val, ADMHC_PS_CPP); + } + /* flush those writes */ + admhc_writel_flush(ahcd); + + /* 2msec timelimit here means no irqs/preempt */ + spin_lock_irq(&ahcd->lock); + + admhc_writel(ahcd, ADMHC_CTRL_SR, &ahcd->regs->gencontrol); + val = 30; /* ... allow extra time */ + while ((admhc_readl(ahcd, &ahcd->regs->gencontrol) & ADMHC_CTRL_SR) != 0) { + if (--val == 0) { + spin_unlock_irq(&ahcd->lock); + admhc_err(ahcd, "USB HC reset timed out!\n"); + return -1; + } + udelay(1); + } + + /* enable HOST mode, before access any host specific register */ + admhc_writel(ahcd, ADMHC_CTRL_UHFE, &ahcd->regs->gencontrol); + + /* Tell the controller where the descriptor list is */ + admhc_writel(ahcd, (u32)ahcd->ed_head->dma, &ahcd->regs->hosthead); + + periodic_reinit(ahcd); + + /* use rhsc irqs after khubd is fully initialized */ + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); + hcd->uses_new_polling = 1; + +#if 0 + /* wake on ConnectStatusChange, matching external hubs */ + admhc_writel(ahcd, RH_HS_DRWE, &ahcd->regs->roothub.status); +#else + /* FIXME roothub_write_status (ahcd, ADMHC_RH_DRWE); */ +#endif + + /* Choose the interrupts we care about now, others later on demand */ + admhc_intr_ack(ahcd, ~0); + admhc_intr_enable(ahcd, ADMHC_INTR_INIT); + + admhc_writel(ahcd, ADMHC_RH_NPS | ADMHC_RH_LPSC, &ahcd->regs->rhdesc); + + /* flush those writes */ + admhc_writel_flush(ahcd); + + /* start controller operations */ + ahcd->host_control = ADMHC_BUSS_OPER; + admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); + + val = 20; + while ((admhc_readl(ahcd, &ahcd->regs->host_control) + & ADMHC_HC_BUSS) != ADMHC_BUSS_OPER) { + if (--val == 0) { + spin_unlock_irq(&ahcd->lock); + admhc_err(ahcd, "unable to setup operational mode!\n"); + return -1; + } + mdelay(1); + } + + hcd->state = HC_STATE_RUNNING; + + ahcd->next_statechange = jiffies + STATECHANGE_DELAY; + +#if 0 + /* FIXME: enabling DMA is always failed here for an unknown reason */ + admhc_dma_enable(ahcd); + + val = 200; + while ((admhc_readl(ahcd, &ahcd->regs->host_control) + & ADMHC_HC_DMAE) != ADMHC_HC_DMAE) { + if (--val == 0) { + spin_unlock_irq(&ahcd->lock); + admhc_err(ahcd, "unable to enable DMA!\n"); + admhc_dump(ahcd, 1); + return -1; + } + mdelay(1); + } + +#endif + + spin_unlock_irq(&ahcd->lock); + + mdelay(ADMHC_POTPGT); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +/* an interrupt happens */ + +static irqreturn_t admhc_irq(struct usb_hcd *hcd) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + struct admhcd_regs __iomem *regs = ahcd->regs; + u32 ints; + + ints = admhc_readl(ahcd, ®s->int_status); + if ((ints & ADMHC_INTR_INTA) == 0) { + /* no unmasked interrupt status is set */ + return IRQ_NONE; + } + + ints &= admhc_readl(ahcd, ®s->int_enable); + + if (ints & ADMHC_INTR_FATI) { + /* e.g. due to PCI Master/Target Abort */ + admhc_disable(ahcd); + admhc_err(ahcd, "Fatal Error, controller disabled\n"); + admhc_dump(ahcd, 1); + admhc_usb_reset(ahcd); + } + + if (ints & ADMHC_INTR_BABI) { + admhc_intr_disable(ahcd, ADMHC_INTR_BABI); + admhc_intr_ack(ahcd, ADMHC_INTR_BABI); + admhc_err(ahcd, "Babble Detected\n"); + } + + if (ints & ADMHC_INTR_INSM) { + admhc_vdbg(ahcd, "Root Hub Status Change\n"); + ahcd->next_statechange = jiffies + STATECHANGE_DELAY; + admhc_intr_ack(ahcd, ADMHC_INTR_RESI | ADMHC_INTR_INSM); + + /* NOTE: Vendors didn't always make the same implementation + * choices for RHSC. Many followed the spec; RHSC triggers + * on an edge, like setting and maybe clearing a port status + * change bit. With others it's level-triggered, active + * until khubd clears all the port status change bits. We'll + * always disable it here and rely on polling until khubd + * re-enables it. + */ + admhc_intr_disable(ahcd, ADMHC_INTR_INSM); + usb_hcd_poll_rh_status(hcd); + } else if (ints & ADMHC_INTR_RESI) { + /* For connect and disconnect events, we expect the controller + * to turn on RHSC along with RD. But for remote wakeup events + * this might not happen. + */ + admhc_vdbg(ahcd, "Resume Detect\n"); + admhc_intr_ack(ahcd, ADMHC_INTR_RESI); + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); + if (ahcd->autostop) { + spin_lock(&ahcd->lock); + admhc_rh_resume(ahcd); + spin_unlock(&ahcd->lock); + } else + usb_hcd_resume_root_hub(hcd); + } + + if (ints & ADMHC_INTR_TDC) { + admhc_vdbg(ahcd, "Transfer Descriptor Complete\n"); + admhc_intr_ack(ahcd, ADMHC_INTR_TDC); + if (HC_IS_RUNNING(hcd->state)) + admhc_intr_disable(ahcd, ADMHC_INTR_TDC); + spin_lock(&ahcd->lock); + admhc_td_complete(ahcd); + spin_unlock(&ahcd->lock); + if (HC_IS_RUNNING(hcd->state)) + admhc_intr_enable(ahcd, ADMHC_INTR_TDC); + } + + if (ints & ADMHC_INTR_SO) { + /* could track INTR_SO to reduce available PCI/... bandwidth */ + admhc_vdbg(ahcd, "Schedule Overrun\n"); + } + +#if 1 + spin_lock(&ahcd->lock); + if (ahcd->ed_rm_list) + finish_unlinks(ahcd, admhc_frame_no(ahcd)); + + if ((ints & ADMHC_INTR_SOFI) != 0 && !ahcd->ed_rm_list + && HC_IS_RUNNING(hcd->state)) + admhc_intr_disable(ahcd, ADMHC_INTR_SOFI); + spin_unlock(&ahcd->lock); +#else + if (ints & ADMHC_INTR_SOFI) { + admhc_vdbg(ahcd, "Start Of Frame\n"); + spin_lock(&ahcd->lock); + + /* handle any pending ED removes */ + finish_unlinks(ahcd, admhc_frameno(ahcd)); + + /* leaving INTR_SOFI enabled when there's still unlinking + * to be done in the (next frame). + */ + if ((ahcd->ed_rm_list == NULL) || + HC_IS_RUNNING(hcd->state) == 0) + /* + * disable INTR_SOFI if there are no unlinking to be + * done (in the next frame) + */ + admhc_intr_disable(ahcd, ADMHC_INTR_SOFI); + + spin_unlock(&ahcd->lock); + } +#endif + + if (HC_IS_RUNNING(hcd->state)) { + admhc_intr_ack(ahcd, ints); + admhc_intr_enable(ahcd, ADMHC_INTR_MIE); + admhc_writel_flush(ahcd); + } + + return IRQ_HANDLED; +} + +/*-------------------------------------------------------------------------*/ + +static void admhc_stop(struct usb_hcd *hcd) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + + admhc_dump(ahcd, 1); + + flush_scheduled_work(); + + admhc_usb_reset(ahcd); + admhc_intr_disable(ahcd, ADMHC_INTR_MIE); + + free_irq(hcd->irq, hcd); + hcd->irq = -1; + + remove_debug_files(ahcd); + admhc_eds_cleanup(ahcd); + admhc_mem_cleanup(ahcd); +} + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_ADM5120 +#include "adm5120-drv.c" +#define PLATFORM_DRIVER usb_hcd_adm5120_driver +#endif + +#if !defined(PLATFORM_DRIVER) +#error "missing bus glue for admhc-hcd" +#endif + +#define DRIVER_INFO DRIVER_DESC " version " DRIVER_VERSION + +static int __init admhc_hcd_mod_init(void) +{ + int ret = 0; + + if (usb_disabled()) + return -ENODEV; + + pr_info("%s: " DRIVER_INFO "\n", hcd_name); + pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name, + sizeof(struct ed), sizeof(struct td)); + set_bit(USB_OHCI_LOADED, &usb_hcds_loaded); + +#ifdef DEBUG + admhc_debug_root = debugfs_create_dir("admhc", usb_debug_root); + if (!admhc_debug_root) { + ret = -ENOENT; + goto error_debug; + } +#endif + +#ifdef PLATFORM_DRIVER + ret = platform_driver_register(&PLATFORM_DRIVER); + if (ret < 0) + goto error_platform; +#endif + + return ret; + +#ifdef PLATFORM_DRIVER + platform_driver_unregister(&PLATFORM_DRIVER); +error_platform: +#endif + +#ifdef DEBUG + debugfs_remove(admhc_debug_root); + admhc_debug_root = NULL; +error_debug: +#endif + clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); + return ret; +} +module_init(admhc_hcd_mod_init); + +static void __exit admhc_hcd_mod_exit(void) +{ + platform_driver_unregister(&PLATFORM_DRIVER); +#ifdef DEBUG + debugfs_remove(admhc_debug_root); +#endif + clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); +} +module_exit(admhc_hcd_mod_exit); + +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_INFO); +MODULE_VERSION(DRIVER_VERSION); +MODULE_LICENSE("GPL v2"); diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c new file mode 100644 index 000000000..8cabaf902 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c @@ -0,0 +1,430 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci-hub.c + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2004 David Brownell + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +/*-------------------------------------------------------------------------*/ + +/* + * ADM5120 Root Hub ... the nonsharable stuff + */ + +#define dbg_port(hc, label, num, value) \ + admhc_dbg(hc, \ + "%s port%d " \ + "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ + label, num, value, \ + (value & ADMHC_PS_PRSC) ? " PRSC" : "", \ + (value & ADMHC_PS_OCIC) ? " OCIC" : "", \ + (value & ADMHC_PS_PSSC) ? " PSSC" : "", \ + (value & ADMHC_PS_PESC) ? " PESC" : "", \ + (value & ADMHC_PS_CSC) ? " CSC" : "", \ + \ + (value & ADMHC_PS_LSDA) ? " LSDA" : "", \ + (value & ADMHC_PS_PPS) ? " PPS" : "", \ + (value & ADMHC_PS_PRS) ? " PRS" : "", \ + (value & ADMHC_PS_POCI) ? " POCI" : "", \ + (value & ADMHC_PS_PSS) ? " PSS" : "", \ + \ + (value & ADMHC_PS_PES) ? " PES" : "", \ + (value & ADMHC_PS_CCS) ? " CCS" : "" \ + ); + +#define dbg_port_write(hc, label, num, value) \ + admhc_dbg(hc, \ + "%s port%d " \ + "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ + label, num, value, \ + (value & ADMHC_PS_PRSC) ? " PRSC" : "", \ + (value & ADMHC_PS_OCIC) ? " OCIC" : "", \ + (value & ADMHC_PS_PSSC) ? " PSSC" : "", \ + (value & ADMHC_PS_PESC) ? " PESC" : "", \ + (value & ADMHC_PS_CSC) ? " CSC" : "", \ + \ + (value & ADMHC_PS_CPP) ? " CPP" : "", \ + (value & ADMHC_PS_SPP) ? " SPP" : "", \ + (value & ADMHC_PS_SPR) ? " SPR" : "", \ + (value & ADMHC_PS_CPS) ? " CPS" : "", \ + (value & ADMHC_PS_SPS) ? " SPS" : "", \ + \ + (value & ADMHC_PS_SPE) ? " SPE" : "", \ + (value & ADMHC_PS_CPE) ? " CPE" : "" \ + ); + +/*-------------------------------------------------------------------------*/ + +/* build "status change" packet (one or two bytes) from HC registers */ + +static int +admhc_hub_status_data(struct usb_hcd *hcd, char *buf) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + int i, changed = 0, length = 1; + int any_connected = 0; + unsigned long flags; + u32 status; + + spin_lock_irqsave(&ahcd->lock, flags); + if (!HCD_HW_ACCESSIBLE(hcd)) + goto done; + + /* init status */ + status = admhc_read_rhdesc(ahcd); + if (status & (ADMHC_RH_LPSC | ADMHC_RH_OCIC)) + buf[0] = changed = 1; + else + buf[0] = 0; + if (ahcd->num_ports > 7) { + buf[1] = 0; + length++; + } + + /* look at each port */ + for (i = 0; i < ahcd->num_ports; i++) { + status = admhc_read_portstatus(ahcd, i); + + /* can't autostop if ports are connected */ + any_connected |= (status & ADMHC_PS_CCS); + + if (status & (ADMHC_PS_CSC | ADMHC_PS_PESC | ADMHC_PS_PSSC + | ADMHC_PS_OCIC | ADMHC_PS_PRSC)) { + changed = 1; + if (i < 7) + buf[0] |= 1 << (i + 1); + else + buf[1] |= 1 << (i - 7); + } + } + + if (admhc_root_hub_state_changes(ahcd, changed, + any_connected)) + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); + else + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); + +done: + spin_unlock_irqrestore(&ahcd->lock, flags); + + return changed ? length : 0; +} + +/*-------------------------------------------------------------------------*/ + +static int admhc_get_hub_descriptor(struct admhcd *ahcd, char *buf) +{ + struct usb_hub_descriptor *desc = (struct usb_hub_descriptor *)buf; + u32 rh = admhc_read_rhdesc(ahcd); + u16 temp; + + desc->bDescriptorType = USB_DT_HUB; /* Hub-descriptor */ + desc->bPwrOn2PwrGood = ADMHC_POTPGT/2; /* use default value */ + desc->bHubContrCurrent = 0x00; /* 0mA */ + + desc->bNbrPorts = ahcd->num_ports; + temp = 1 + (ahcd->num_ports / 8); + desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp; + + /* FIXME */ + temp = 0; + if (rh & ADMHC_RH_NPS) /* no power switching? */ + temp |= 0x0002; + if (rh & ADMHC_RH_PSM) /* per-port power switching? */ + temp |= 0x0001; + if (rh & ADMHC_RH_NOCP) /* no overcurrent reporting? */ + temp |= 0x0010; + else if (rh & ADMHC_RH_OCPM) /* per-port overcurrent reporting? */ + temp |= 0x0008; + desc->wHubCharacteristics = (__force __u16)cpu_to_hc16(ahcd, temp); + + /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */ + desc->u.hs.DeviceRemovable[0] = 0; + desc->u.hs.DeviceRemovable[0] = ~0; + + return 0; +} + +static int admhc_get_hub_status(struct admhcd *ahcd, char *buf) +{ + struct usb_hub_status *hs = (struct usb_hub_status *)buf; + u32 t = admhc_read_rhdesc(ahcd); + u16 status, change; + + status = 0; + status |= (t & ADMHC_RH_LPS) ? HUB_STATUS_LOCAL_POWER : 0; + status |= (t & ADMHC_RH_OCI) ? HUB_STATUS_OVERCURRENT : 0; + + change = 0; + change |= (t & ADMHC_RH_LPSC) ? HUB_CHANGE_LOCAL_POWER : 0; + change |= (t & ADMHC_RH_OCIC) ? HUB_CHANGE_OVERCURRENT : 0; + + hs->wHubStatus = (__force __u16)cpu_to_hc16(ahcd, status); + hs->wHubChange = (__force __u16)cpu_to_hc16(ahcd, change); + + return 0; +} + +static int admhc_get_port_status(struct admhcd *ahcd, unsigned port, char *buf) +{ + struct usb_port_status *ps = (struct usb_port_status *)buf; + u32 t = admhc_read_portstatus(ahcd, port); + u16 status, change; + + status = 0; + status |= (t & ADMHC_PS_CCS) ? USB_PORT_STAT_CONNECTION : 0; + status |= (t & ADMHC_PS_PES) ? USB_PORT_STAT_ENABLE : 0; + status |= (t & ADMHC_PS_PSS) ? USB_PORT_STAT_SUSPEND : 0; + status |= (t & ADMHC_PS_POCI) ? USB_PORT_STAT_OVERCURRENT : 0; + status |= (t & ADMHC_PS_PRS) ? USB_PORT_STAT_RESET : 0; + status |= (t & ADMHC_PS_PPS) ? USB_PORT_STAT_POWER : 0; + status |= (t & ADMHC_PS_LSDA) ? USB_PORT_STAT_LOW_SPEED : 0; + + change = 0; + change |= (t & ADMHC_PS_CSC) ? USB_PORT_STAT_C_CONNECTION : 0; + change |= (t & ADMHC_PS_PESC) ? USB_PORT_STAT_C_ENABLE : 0; + change |= (t & ADMHC_PS_PSSC) ? USB_PORT_STAT_C_SUSPEND : 0; + change |= (t & ADMHC_PS_OCIC) ? USB_PORT_STAT_C_OVERCURRENT : 0; + change |= (t & ADMHC_PS_PRSC) ? USB_PORT_STAT_C_RESET : 0; + + ps->wPortStatus = (__force __u16)cpu_to_hc16(ahcd, status); + ps->wPortChange = (__force __u16)cpu_to_hc16(ahcd, change); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_USB_OTG + +static int admhc_start_port_reset(struct usb_hcd *hcd, unsigned port) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + u32 status; + + if (!port) + return -EINVAL; + port--; + + /* start port reset before HNP protocol times out */ + status = admhc_read_portstatus(ahcd, port); + if (!(status & ADMHC_PS_CCS)) + return -ENODEV; + + /* khubd will finish the reset later */ + admhc_write_portstatus(ahcd, port, ADMHC_PS_PRS); + return 0; +} + +static void start_hnp(struct admhcd *ahcd); + +#else + +#define admhc_start_port_reset NULL + +#endif + +/*-------------------------------------------------------------------------*/ + + +/* See usb 7.1.7.5: root hubs must issue at least 50 msec reset signaling, + * not necessarily continuous ... to guard against resume signaling. + * The short timeout is safe for non-root hubs, and is backward-compatible + * with earlier Linux hosts. + */ +#ifdef CONFIG_USB_SUSPEND +#define PORT_RESET_MSEC 50 +#else +#define PORT_RESET_MSEC 10 +#endif + +/* this timer value might be vendor-specific ... */ +#define PORT_RESET_HW_MSEC 10 + +/* wrap-aware logic morphed from */ +#define tick_before(t1, t2) ((s16)(((s16)(t1)) - ((s16)(t2))) < 0) + +/* called from some task, normally khubd */ +static inline int admhc_port_reset(struct admhcd *ahcd, unsigned port) +{ + u32 t; + + admhc_vdbg(ahcd, "reset port%d\n", port); + t = admhc_read_portstatus(ahcd, port); + if (!(t & ADMHC_PS_CCS)) + return -ENODEV; + + admhc_write_portstatus(ahcd, port, ADMHC_PS_SPR); + mdelay(10); + admhc_write_portstatus(ahcd, port, (ADMHC_PS_SPE | ADMHC_PS_CSC)); + mdelay(100); + + return 0; +} + +static inline int admhc_port_enable(struct admhcd *ahcd, unsigned port) +{ + u32 t; + + admhc_vdbg(ahcd, "enable port%d\n", port); + t = admhc_read_portstatus(ahcd, port); + if (!(t & ADMHC_PS_CCS)) + return -ENODEV; + + admhc_write_portstatus(ahcd, port, ADMHC_PS_SPE); + + return 0; +} + +static inline int admhc_port_disable(struct admhcd *ahcd, unsigned port) +{ + u32 t; + + admhc_vdbg(ahcd, "disable port%d\n", port); + t = admhc_read_portstatus(ahcd, port); + if (!(t & ADMHC_PS_CCS)) + return -ENODEV; + + admhc_write_portstatus(ahcd, port, ADMHC_PS_CPE); + + return 0; +} + +static inline int admhc_port_write(struct admhcd *ahcd, unsigned port, + u32 val) +{ +#ifdef ADMHC_VERBOSE_DEBUG + dbg_port_write(ahcd, "write", port, val); +#endif + admhc_write_portstatus(ahcd, port, val); + + return 0; +} + +static int admhc_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + u16 wIndex, char *buf, u16 wLength) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + int ports = ahcd->num_ports; + int ret = 0; + + if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) + return -ESHUTDOWN; + + switch (typeReq) { + case ClearHubFeature: + switch (wValue) { + case C_HUB_OVER_CURRENT: +#if 0 /* FIXME */ + admhc_writel(ahcd, ADMHC_RH_OCIC, + &ahcd->regs->roothub.status); +#endif + case C_HUB_LOCAL_POWER: + break; + default: + goto error; + } + break; + case ClearPortFeature: + if (!wIndex || wIndex > ports) + goto error; + wIndex--; + + switch (wValue) { + case USB_PORT_FEAT_ENABLE: + ret = admhc_port_disable(ahcd, wIndex); + break; + case USB_PORT_FEAT_SUSPEND: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CPS); + break; + case USB_PORT_FEAT_POWER: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CPP); + break; + case USB_PORT_FEAT_C_CONNECTION: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CSC); + break; + case USB_PORT_FEAT_C_ENABLE: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PESC); + break; + case USB_PORT_FEAT_C_SUSPEND: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PSSC); + break; + case USB_PORT_FEAT_C_OVER_CURRENT: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_OCIC); + break; + case USB_PORT_FEAT_C_RESET: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PRSC); + break; + default: + goto error; + } + break; + case GetHubDescriptor: + ret = admhc_get_hub_descriptor(ahcd, buf); + break; + case GetHubStatus: + ret = admhc_get_hub_status(ahcd, buf); + break; + case GetPortStatus: + if (!wIndex || wIndex > ports) + goto error; + wIndex--; + + ret = admhc_get_port_status(ahcd, wIndex, buf); + break; + case SetHubFeature: + switch (wValue) { + case C_HUB_OVER_CURRENT: + /* FIXME: this can be cleared, yes? */ + case C_HUB_LOCAL_POWER: + break; + default: + goto error; + } + break; + case SetPortFeature: + if (!wIndex || wIndex > ports) + goto error; + wIndex--; + + switch (wValue) { + case USB_PORT_FEAT_ENABLE: + ret = admhc_port_enable(ahcd, wIndex); + break; + case USB_PORT_FEAT_RESET: + ret = admhc_port_reset(ahcd, wIndex); + break; + case USB_PORT_FEAT_SUSPEND: +#ifdef CONFIG_USB_OTG + if (hcd->self.otg_port == (wIndex + 1) + && hcd->self.b_hnp_enable) + start_hnp(ahcd); + else +#endif + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_SPS); + break; + case USB_PORT_FEAT_POWER: + ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_SPP); + break; + default: + goto error; + } + break; + + default: +error: + /* "protocol stall" on error */ + ret = -EPIPE; + } + + return ret; +} + diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c new file mode 100644 index 000000000..79fff70e2 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c @@ -0,0 +1,202 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci-mem.c + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2002 David Brownell + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +/*-------------------------------------------------------------------------*/ + +/* + * OHCI deals with three types of memory: + * - data used only by the HCD ... kmalloc is fine + * - async and periodic schedules, shared by HC and HCD ... these + * need to use dma_pool or dma_alloc_coherent + * - driver buffers, read/written by HC ... the hcd glue or the + * device driver provides us with dma addresses + * + * There's also "register" data, which is memory mapped. + * No memory seen by this driver (or any HCD) may be paged out. + */ + +/*-------------------------------------------------------------------------*/ + +static void admhc_hcd_init(struct admhcd *ahcd) +{ + ahcd->next_statechange = jiffies; + spin_lock_init(&ahcd->lock); + INIT_LIST_HEAD(&ahcd->pending); +} + +/*-------------------------------------------------------------------------*/ + +static int admhc_mem_init(struct admhcd *ahcd) +{ + ahcd->td_cache = dma_pool_create("admhc_td", + admhcd_to_hcd(ahcd)->self.controller, + sizeof(struct td), + TD_ALIGN, /* byte alignment */ + 0 /* no page-crossing issues */ + ); + if (!ahcd->td_cache) + goto err; + + ahcd->ed_cache = dma_pool_create("admhc_ed", + admhcd_to_hcd(ahcd)->self.controller, + sizeof(struct ed), + ED_ALIGN, /* byte alignment */ + 0 /* no page-crossing issues */ + ); + if (!ahcd->ed_cache) + goto err_td_cache; + + return 0; + +err_td_cache: + dma_pool_destroy(ahcd->td_cache); + ahcd->td_cache = NULL; +err: + return -ENOMEM; +} + +static void admhc_mem_cleanup(struct admhcd *ahcd) +{ + if (ahcd->td_cache) { + dma_pool_destroy(ahcd->td_cache); + ahcd->td_cache = NULL; + } + + if (ahcd->ed_cache) { + dma_pool_destroy(ahcd->ed_cache); + ahcd->ed_cache = NULL; + } +} + +/*-------------------------------------------------------------------------*/ + +/* ahcd "done list" processing needs this mapping */ +static inline struct td *dma_to_td(struct admhcd *ahcd, dma_addr_t td_dma) +{ + struct td *td; + + td_dma &= TD_MASK; + td = ahcd->td_hash[TD_HASH_FUNC(td_dma)]; + while (td && td->td_dma != td_dma) + td = td->td_hash; + + return td; +} + +/* TDs ... */ +static struct td *td_alloc(struct admhcd *ahcd, gfp_t mem_flags) +{ + dma_addr_t dma; + struct td *td; + + td = dma_pool_alloc(ahcd->td_cache, mem_flags, &dma); + if (!td) + return NULL; + + /* in case ahcd fetches it, make it look dead */ + memset(td, 0, sizeof *td); + td->hwNextTD = cpu_to_hc32(ahcd, dma); + td->td_dma = dma; + /* hashed in td_fill */ + + return td; +} + +static void td_free(struct admhcd *ahcd, struct td *td) +{ + struct td **prev = &ahcd->td_hash[TD_HASH_FUNC(td->td_dma)]; + + while (*prev && *prev != td) + prev = &(*prev)->td_hash; + if (*prev) + *prev = td->td_hash; +#if 0 + /* TODO: remove */ + else if ((td->hwINFO & cpu_to_hc32(ahcd, TD_DONE)) != 0) + admhc_dbg(ahcd, "no hash for td %p\n", td); +#else + else if ((td->flags & TD_FLAG_DONE) != 0) + admhc_dbg(ahcd, "no hash for td %p\n", td); +#endif + dma_pool_free(ahcd->td_cache, td, td->td_dma); +} + +/*-------------------------------------------------------------------------*/ + +/* EDs ... */ +static struct ed *ed_alloc(struct admhcd *ahcd, gfp_t mem_flags) +{ + dma_addr_t dma; + struct ed *ed; + + ed = dma_pool_alloc(ahcd->ed_cache, mem_flags, &dma); + if (!ed) + return NULL; + + memset(ed, 0, sizeof(*ed)); + ed->dma = dma; + + INIT_LIST_HEAD(&ed->td_list); + INIT_LIST_HEAD(&ed->urb_list); + + return ed; +} + +static void ed_free(struct admhcd *ahcd, struct ed *ed) +{ + dma_pool_free(ahcd->ed_cache, ed, ed->dma); +} + +/*-------------------------------------------------------------------------*/ + +/* URB priv ... */ +static void urb_priv_free(struct admhcd *ahcd, struct urb_priv *urb_priv) +{ + int i; + + for (i = 0; i < urb_priv->td_cnt; i++) + if (urb_priv->td[i]) + td_free(ahcd, urb_priv->td[i]); + + list_del(&urb_priv->pending); + kfree(urb_priv); +} + +static struct urb_priv *urb_priv_alloc(struct admhcd *ahcd, int num_tds, + gfp_t mem_flags) +{ + struct urb_priv *priv; + + /* allocate the private part of the URB */ + priv = kzalloc(sizeof(*priv) + sizeof(struct td) * num_tds, mem_flags); + if (!priv) + goto err; + + /* allocate the TDs (deferring hash chain updates) */ + for (priv->td_cnt = 0; priv->td_cnt < num_tds; priv->td_cnt++) { + priv->td[priv->td_cnt] = td_alloc(ahcd, mem_flags); + if (priv->td[priv->td_cnt] == NULL) + goto err_free; + } + + INIT_LIST_HEAD(&priv->pending); + + return priv; + +err_free: + urb_priv_free(ahcd, priv); +err: + return NULL; +} diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c new file mode 100644 index 000000000..7d7fc2438 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c @@ -0,0 +1,449 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from fragments of the OHCI driver. + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2004 David Brownell + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#define OHCI_SCHED_ENABLES \ + (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) + +#ifdef CONFIG_PM +static int admhc_restart(struct admhcd *ahcd); + +static int admhc_rh_suspend(struct admhcd *ahcd, int autostop) +__releases(ahcd->lock) +__acquires(ahcd->lock) +{ + int status = 0; + + ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); + switch (ahcd->hc_control & OHCI_CTRL_HCFS) { + case OHCI_USB_RESUME: + admhc_dbg(ahcd, "resume/suspend?\n"); + ahcd->hc_control &= ~OHCI_CTRL_HCFS; + ahcd->hc_control |= OHCI_USB_RESET; + admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); + (void) admhc_readl(ahcd, &ahcd->regs->control); + /* FALL THROUGH */ + case OHCI_USB_RESET: + status = -EBUSY; + admhc_dbg(ahcd, "needs reinit!\n"); + goto done; + case OHCI_USB_SUSPEND: + if (!ahcd->autostop) { + admhc_dbg(ahcd, "already suspended\n"); + goto done; + } + } + admhc_dbg(ahcd, "%s root hub\n", + autostop ? "auto-stop" : "suspend"); + + /* First stop any processing */ + if (!autostop && (ahcd->hc_control & OHCI_SCHED_ENABLES)) { + ahcd->hc_control &= ~OHCI_SCHED_ENABLES; + admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); + ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); + admhc_writel(ahcd, OHCI_INTR_SF, &ahcd->regs->intrstatus); + + /* sched disables take effect on the next frame, + * then the last WDH could take 6+ msec + */ + admhc_dbg(ahcd, "stopping schedules ...\n"); + ahcd->autostop = 0; + spin_unlock_irq (&ahcd->lock); + msleep (8); + spin_lock_irq(&ahcd->lock); + } + dl_done_list (ahcd); + finish_unlinks (ahcd, admhc_frame_no(ahcd)); + + /* maybe resume can wake root hub */ + if (device_may_wakeup(&admhcd_to_hcd(ahcd)->self.root_hub->dev) || + autostop) + ahcd->hc_control |= OHCI_CTRL_RWE; + else { + admhc_writel(ahcd, OHCI_INTR_RHSC, &ahcd->regs->intrdisable); + ahcd->hc_control &= ~OHCI_CTRL_RWE; + } + + /* Suspend hub ... this is the "global (to this bus) suspend" mode, + * which doesn't imply ports will first be individually suspended. + */ + ahcd->hc_control &= ~OHCI_CTRL_HCFS; + ahcd->hc_control |= OHCI_USB_SUSPEND; + admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); + (void) admhc_readl(ahcd, &ahcd->regs->control); + + /* no resumes until devices finish suspending */ + if (!autostop) { + ahcd->next_statechange = jiffies + msecs_to_jiffies (5); + ahcd->autostop = 0; + } + +done: + return status; +} + +static inline struct ed *find_head(struct ed *ed) +{ + /* for bulk and control lists */ + while (ed->ed_prev) + ed = ed->ed_prev; + return ed; +} + +/* caller has locked the root hub */ +static int admhc_rh_resume(struct admhcd *ahcd) +__releases(ahcd->lock) +__acquires(ahcd->lock) +{ + struct usb_hcd *hcd = admhcd_to_hcd (ahcd); + u32 temp, enables; + int status = -EINPROGRESS; + int autostopped = ahcd->autostop; + + ahcd->autostop = 0; + ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); + + if (ahcd->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { + /* this can happen after resuming a swsusp snapshot */ + if (hcd->state == HC_STATE_RESUMING) { + admhc_dbg(ahcd, "BIOS/SMM active, control %03x\n", + ahcd->hc_control); + status = -EBUSY; + /* this happens when pmcore resumes HC then root */ + } else { + admhc_dbg(ahcd, "duplicate resume\n"); + status = 0; + } + } else switch (ahcd->hc_control & OHCI_CTRL_HCFS) { + case OHCI_USB_SUSPEND: + ahcd->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES); + ahcd->hc_control |= OHCI_USB_RESUME; + admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); + (void) admhc_readl(ahcd, &ahcd->regs->control); + admhc_dbg(ahcd, "%s root hub\n", + autostopped ? "auto-start" : "resume"); + break; + case OHCI_USB_RESUME: + /* HCFS changes sometime after INTR_RD */ + admhc_dbg(ahcd, "%swakeup root hub\n", + autostopped ? "auto-" : ""); + break; + case OHCI_USB_OPER: + /* this can happen after resuming a swsusp snapshot */ + admhc_dbg(ahcd, "snapshot resume? reinit\n"); + status = -EBUSY; + break; + default: /* RESET, we lost power */ + admhc_dbg(ahcd, "lost power\n"); + status = -EBUSY; + } + if (status == -EBUSY) { + if (!autostopped) { + spin_unlock_irq (&ahcd->lock); + (void) ahcd_init (ahcd); + status = admhc_restart (ahcd); + spin_lock_irq(&ahcd->lock); + } + return status; + } + if (status != -EINPROGRESS) + return status; + if (autostopped) + goto skip_resume; + spin_unlock_irq (&ahcd->lock); + + /* Some controllers (lucent erratum) need extra-long delays */ + msleep (20 /* usb 11.5.1.10 */ + 12 /* 32 msec counter */ + 1); + + temp = admhc_readl(ahcd, &ahcd->regs->control); + temp &= OHCI_CTRL_HCFS; + if (temp != OHCI_USB_RESUME) { + admhc_err (ahcd, "controller won't resume\n"); + spin_lock_irq(&ahcd->lock); + return -EBUSY; + } + + /* disable old schedule state, reinit from scratch */ + admhc_writel(ahcd, 0, &ahcd->regs->ed_controlhead); + admhc_writel(ahcd, 0, &ahcd->regs->ed_controlcurrent); + admhc_writel(ahcd, 0, &ahcd->regs->ed_bulkhead); + admhc_writel(ahcd, 0, &ahcd->regs->ed_bulkcurrent); + admhc_writel(ahcd, 0, &ahcd->regs->ed_periodcurrent); + admhc_writel(ahcd, (u32) ahcd->hcca_dma, &ahcd->ahcd->regs->hcca); + + /* Sometimes PCI D3 suspend trashes frame timings ... */ + periodic_reinit(ahcd); + + /* the following code is executed with ahcd->lock held and + * irqs disabled if and only if autostopped is true + */ + +skip_resume: + /* interrupts might have been disabled */ + admhc_writel(ahcd, OHCI_INTR_INIT, &ahcd->regs->int_enable); + if (ahcd->ed_rm_list) + admhc_writel(ahcd, OHCI_INTR_SF, &ahcd->regs->int_enable); + + /* Then re-enable operations */ + admhc_writel(ahcd, OHCI_USB_OPER, &ahcd->regs->control); + (void) admhc_readl(ahcd, &ahcd->regs->control); + if (!autostopped) + msleep (3); + + temp = ahcd->hc_control; + temp &= OHCI_CTRL_RWC; + temp |= OHCI_CONTROL_INIT | OHCI_USB_OPER; + ahcd->hc_control = temp; + admhc_writel(ahcd, temp, &ahcd->regs->control); + (void) admhc_readl(ahcd, &ahcd->regs->control); + + /* TRSMRCY */ + if (!autostopped) { + msleep (10); + spin_lock_irq(&ahcd->lock); + } + /* now ahcd->lock is always held and irqs are always disabled */ + + /* keep it alive for more than ~5x suspend + resume costs */ + ahcd->next_statechange = jiffies + STATECHANGE_DELAY; + + /* maybe turn schedules back on */ + enables = 0; + temp = 0; + if (!ahcd->ed_rm_list) { + if (ahcd->ed_controltail) { + admhc_writel(ahcd, + find_head (ahcd->ed_controltail)->dma, + &ahcd->regs->ed_controlhead); + enables |= OHCI_CTRL_CLE; + temp |= OHCI_CLF; + } + if (ahcd->ed_bulktail) { + admhc_writel(ahcd, find_head (ahcd->ed_bulktail)->dma, + &ahcd->regs->ed_bulkhead); + enables |= OHCI_CTRL_BLE; + temp |= OHCI_BLF; + } + } + if (hcd->self.bandwidth_isoc_reqs || hcd->self.bandwidth_int_reqs) + enables |= OHCI_CTRL_PLE|OHCI_CTRL_IE; + if (enables) { + admhc_dbg(ahcd, "restarting schedules ... %08x\n", enables); + ahcd->hc_control |= enables; + admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); + if (temp) + admhc_writel(ahcd, temp, &ahcd->regs->cmdstatus); + (void) admhc_readl(ahcd, &ahcd->regs->control); + } + + return 0; +} + +static int admhc_bus_suspend(struct usb_hcd *hcd) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + int rc; + + spin_lock_irq(&ahcd->lock); + + if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) + rc = -ESHUTDOWN; + else + rc = admhc_rh_suspend(ahcd, 0); + spin_unlock_irq(&ahcd->lock); + return rc; +} + +static int admhc_bus_resume(struct usb_hcd *hcd) +{ + struct admhcd *ahcd = hcd_to_admhcd(hcd); + int rc; + + if (time_before(jiffies, ahcd->next_statechange)) + msleep(5); + + spin_lock_irq(&ahcd->lock); + + if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) + rc = -ESHUTDOWN; + else + rc = admhc_rh_resume(ahcd); + spin_unlock_irq(&ahcd->lock); + + /* poll until we know a device is connected or we autostop */ + if (rc == 0) + usb_hcd_poll_rh_status(hcd); + return rc; +} + +/* Carry out polling-, autostop-, and autoresume-related state changes */ +static int admhc_root_hub_state_changes(struct admhcd *ahcd, int changed, + int any_connected) +{ + int poll_rh = 1; + + switch (ahcd->hc_control & OHCI_CTRL_HCFS) { + + case OHCI_USB_OPER: + /* keep on polling until we know a device is connected + * and RHSC is enabled */ + if (!ahcd->autostop) { + if (any_connected || + !device_may_wakeup(&admhcd_to_hcd(ahcd) + ->self.root_hub->dev)) { + if (admhc_readl(ahcd, &ahcd->regs->int_enable) & + OHCI_INTR_RHSC) + poll_rh = 0; + } else { + ahcd->autostop = 1; + ahcd->next_statechange = jiffies + HZ; + } + + /* if no devices have been attached for one second, autostop */ + } else { + if (changed || any_connected) { + ahcd->autostop = 0; + ahcd->next_statechange = jiffies + + STATECHANGE_DELAY; + } else if (time_after_eq(jiffies, + ahcd->next_statechange) + && !ahcd->ed_rm_list + && !(ahcd->hc_control & + OHCI_SCHED_ENABLES)) { + ahcd_rh_suspend(ahcd, 1); + } + } + break; + + /* if there is a port change, autostart or ask to be resumed */ + case OHCI_USB_SUSPEND: + case OHCI_USB_RESUME: + if (changed) { + if (ahcd->autostop) + admhc_rh_resume(ahcd); + else + usb_hcd_resume_root_hub(admhcd_to_hcd(ahcd)); + } else { + /* everything is idle, no need for polling */ + poll_rh = 0; + } + break; + } + return poll_rh; +} + +/*-------------------------------------------------------------------------*/ + +/* must not be called from interrupt context */ +static int admhc_restart(struct admhcd *ahcd) +{ + int temp; + int i; + struct urb_priv *priv; + + /* mark any devices gone, so they do nothing till khubd disconnects. + * recycle any "live" eds/tds (and urbs) right away. + * later, khubd disconnect processing will recycle the other state, + * (either as disconnect/reconnect, or maybe someday as a reset). + */ + spin_lock_irq(&ahcd->lock); + admhc_disable(ahcd); + usb_root_hub_lost_power(admhcd_to_hcd(ahcd)->self.root_hub); + if (!list_empty(&ahcd->pending)) + admhc_dbg(ahcd, "abort schedule...\n"); + list_for_each_entry(priv, &ahcd->pending, pending) { + struct urb *urb = priv->td[0]->urb; + struct ed *ed = priv->ed; + + switch (ed->state) { + case ED_OPER: + ed->state = ED_UNLINK; + ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE); + ed_deschedule (ahcd, ed); + + ed->ed_next = ahcd->ed_rm_list; + ed->ed_prev = NULL; + ahcd->ed_rm_list = ed; + /* FALLTHROUGH */ + case ED_UNLINK: + break; + default: + admhc_dbg(ahcd, "bogus ed %p state %d\n", + ed, ed->state); + } + + if (!urb->unlinked) + urb->unlinked = -ESHUTDOWN; + } + finish_unlinks(ahcd, 0); + spin_unlock_irq(&ahcd->lock); + + /* paranoia, in case that didn't work: */ + + /* empty the interrupt branches */ + for (i = 0; i < NUM_INTS; i++) ahcd->load[i] = 0; + for (i = 0; i < NUM_INTS; i++) ahcd->hcca->int_table[i] = 0; + + /* no EDs to remove */ + ahcd->ed_rm_list = NULL; + + /* empty control and bulk lists */ + ahcd->ed_controltail = NULL; + ahcd->ed_bulktail = NULL; + + if ((temp = admhc_run(ahcd)) < 0) { + admhc_err(ahcd, "can't restart, %d\n", temp); + return temp; + } else { + /* here we "know" root ports should always stay powered, + * and that if we try to turn them back on the root hub + * will respond to CSC processing. + */ + i = ahcd->num_ports; + while (i--) + admhc_writel(ahcd, RH_PS_PSS, + &ahcd->regs->portstatus[i]); + admhc_dbg(ahcd, "restart complete\n"); + } + return 0; +} + +#else /* CONFIG_PM */ + +static inline int admhc_rh_resume(struct admhcd *ahcd) +{ + return 0; +} + +/* Carry out polling-related state changes. + * autostop isn't used when CONFIG_PM is turned off. + */ +static int admhc_root_hub_state_changes(struct admhcd *ahcd, int changed, + int any_connected) +{ + /* If INSM is enabled, don't poll */ + if (admhc_readl(ahcd, &ahcd->regs->int_enable) & ADMHC_INTR_INSM) + return 0; + + /* If no status changes are pending, enable status-change interrupts */ + if (!changed) { + admhc_intr_enable(ahcd, ADMHC_INTR_INSM); + return 0; + } + + return 1; +} + +#endif /* CONFIG_PM */ + diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c new file mode 100644 index 000000000..cd9c8920a --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c @@ -0,0 +1,964 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci-q.c + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2002 David Brownell + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include + +/*-------------------------------------------------------------------------*/ + +/* + * URB goes back to driver, and isn't reissued. + * It's completely gone from HC data structures. + * PRECONDITION: ahcd lock held, irqs blocked. + */ +static void +finish_urb(struct admhcd *ahcd, struct urb *urb, int status) +__releases(ahcd->lock) +__acquires(ahcd->lock) +{ + urb_priv_free(ahcd, urb->hcpriv); + + if (likely(status == -EINPROGRESS)) + status = 0; + + switch (usb_pipetype(urb->pipe)) { + case PIPE_ISOCHRONOUS: + admhcd_to_hcd(ahcd)->self.bandwidth_isoc_reqs--; + break; + case PIPE_INTERRUPT: + admhcd_to_hcd(ahcd)->self.bandwidth_int_reqs--; + break; + } + +#ifdef ADMHC_VERBOSE_DEBUG + urb_print(ahcd, urb, "RET", usb_pipeout(urb->pipe), status); +#endif + + /* urb->complete() can reenter this HCD */ + usb_hcd_unlink_urb_from_ep(admhcd_to_hcd(ahcd), urb); + spin_unlock(&ahcd->lock); + usb_hcd_giveback_urb(admhcd_to_hcd(ahcd), urb, status); + spin_lock(&ahcd->lock); +} + + +/*-------------------------------------------------------------------------* + * ED handling functions + *-------------------------------------------------------------------------*/ + +#if 0 /* FIXME */ +/* search for the right schedule branch to use for a periodic ed. + * does some load balancing; returns the branch, or negative errno. + */ +static int balance(struct admhcd *ahcd, int interval, int load) +{ + int i, branch = -ENOSPC; + + /* iso periods can be huge; iso tds specify frame numbers */ + if (interval > NUM_INTS) + interval = NUM_INTS; + + /* search for the least loaded schedule branch of that period + * that has enough bandwidth left unreserved. + */ + for (i = 0; i < interval ; i++) { + if (branch < 0 || ahcd->load[branch] > ahcd->load[i]) { + int j; + + /* usb 1.1 says 90% of one frame */ + for (j = i; j < NUM_INTS; j += interval) { + if ((ahcd->load[j] + load) > 900) + break; + } + if (j < NUM_INTS) + continue; + branch = i; + } + } + return branch; +} +#endif + +/*-------------------------------------------------------------------------*/ + +#if 0 /* FIXME */ +/* both iso and interrupt requests have periods; this routine puts them + * into the schedule tree in the apppropriate place. most iso devices use + * 1msec periods, but that's not required. + */ +static void periodic_link(struct admhcd *ahcd, struct ed *ed) +{ + unsigned i; + + admhc_vdbg(ahcd, "link %sed %p branch %d [%dus.], interval %d\n", + (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "", + ed, ed->branch, ed->load, ed->interval); + + for (i = ed->branch; i < NUM_INTS; i += ed->interval) { + struct ed **prev = &ahcd->periodic[i]; + __hc32 *prev_p = &ahcd->hcca->int_table[i]; + struct ed *here = *prev; + + /* sorting each branch by period (slow before fast) + * lets us share the faster parts of the tree. + * (plus maybe: put interrupt eds before iso) + */ + while (here && ed != here) { + if (ed->interval > here->interval) + break; + prev = &here->ed_next; + prev_p = &here->hwNextED; + here = *prev; + } + if (ed != here) { + ed->ed_next = here; + if (here) + ed->hwNextED = *prev_p; + wmb(); + *prev = ed; + *prev_p = cpu_to_hc32(ahcd, ed->dma); + wmb(); + } + ahcd->load[i] += ed->load; + } + admhcd_to_hcd(ahcd)->self.bandwidth_allocated += ed->load / ed->interval; +} +#endif + +/* link an ed into the HC chain */ + +static int ed_schedule(struct admhcd *ahcd, struct ed *ed) +{ + struct ed *old_tail; + + if (admhcd_to_hcd(ahcd)->state == HC_STATE_QUIESCING) + return -EAGAIN; + + ed->state = ED_OPER; + + old_tail = ahcd->ed_tails[ed->type]; + + ed->ed_next = old_tail->ed_next; + if (ed->ed_next) { + ed->ed_next->ed_prev = ed; + ed->hwNextED = cpu_to_hc32(ahcd, ed->ed_next->dma); + } + ed->ed_prev = old_tail; + + old_tail->ed_next = ed; + old_tail->hwNextED = cpu_to_hc32(ahcd, ed->dma); + + ahcd->ed_tails[ed->type] = ed; + + admhc_dma_enable(ahcd); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +#if 0 /* FIXME */ +/* scan the periodic table to find and unlink this ED */ +static void periodic_unlink(struct admhcd *ahcd, struct ed *ed) +{ + int i; + + for (i = ed->branch; i < NUM_INTS; i += ed->interval) { + struct ed *temp; + struct ed **prev = &ahcd->periodic[i]; + __hc32 *prev_p = &ahcd->hcca->int_table[i]; + + while (*prev && (temp = *prev) != ed) { + prev_p = &temp->hwNextED; + prev = &temp->ed_next; + } + if (*prev) { + *prev_p = ed->hwNextED; + *prev = ed->ed_next; + } + ahcd->load[i] -= ed->load; + } + + admhcd_to_hcd(ahcd)->self.bandwidth_allocated -= ed->load / ed->interval; + admhc_vdbg(ahcd, "unlink %sed %p branch %d [%dus.], interval %d\n", + (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "", + ed, ed->branch, ed->load, ed->interval); +} +#endif + +/* unlink an ed from the HC chain. + * just the link to the ed is unlinked. + * the link from the ed still points to another operational ed or 0 + * so the HC can eventually finish the processing of the unlinked ed + * (assuming it already started that, which needn't be true). + * + * ED_UNLINK is a transient state: the HC may still see this ED, but soon + * it won't. ED_SKIP means the HC will finish its current transaction, + * but won't start anything new. The TD queue may still grow; device + * drivers don't know about this HCD-internal state. + * + * When the HC can't see the ED, something changes ED_UNLINK to one of: + * + * - ED_OPER: when there's any request queued, the ED gets rescheduled + * immediately. HC should be working on them. + * + * - ED_IDLE: when there's no TD queue. there's no reason for the HC + * to care about this ED; safe to disable the endpoint. + * + * When finish_unlinks() runs later, after SOF interrupt, it will often + * complete one or more URB unlinks before making that state change. + */ +static void ed_deschedule(struct admhcd *ahcd, struct ed *ed) +{ + +#ifdef ADMHC_VERBOSE_DEBUG + admhc_dump_ed(ahcd, "ED-DESCHED", ed, 1); +#endif + + ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP); + wmb(); + ed->state = ED_UNLINK; + + /* remove this ED from the HC list */ + ed->ed_prev->hwNextED = ed->hwNextED; + + /* and remove it from our list also */ + ed->ed_prev->ed_next = ed->ed_next; + + if (ed->ed_next) + ed->ed_next->ed_prev = ed->ed_prev; + + if (ahcd->ed_tails[ed->type] == ed) + ahcd->ed_tails[ed->type] = ed->ed_prev; +} + +/*-------------------------------------------------------------------------*/ + +static struct ed *ed_create(struct admhcd *ahcd, unsigned int type, u32 info) +{ + struct ed *ed; + struct td *td; + + ed = ed_alloc(ahcd, GFP_ATOMIC); + if (!ed) + goto err; + + /* dummy td; end of td list for this ed */ + td = td_alloc(ahcd, GFP_ATOMIC); + if (!td) + goto err_free_ed; + + switch (type) { + case PIPE_INTERRUPT: + info |= ED_INT; + break; + case PIPE_ISOCHRONOUS: + info |= ED_ISO; + break; + } + + ed->dummy = td; + ed->state = ED_IDLE; + ed->type = type; + + ed->hwINFO = cpu_to_hc32(ahcd, info); + ed->hwTailP = cpu_to_hc32(ahcd, td->td_dma); + ed->hwHeadP = ed->hwTailP; /* ED_C, ED_H zeroed */ + + return ed; + +err_free_ed: + ed_free(ahcd, ed); +err: + return NULL; +} + +/* get and maybe (re)init an endpoint. init _should_ be done only as part + * of enumeration, usb_set_configuration() or usb_set_interface(). + */ +static struct ed *ed_get(struct admhcd *ahcd, struct usb_host_endpoint *ep, + struct usb_device *udev, unsigned int pipe, int interval) +{ + struct ed *ed; + unsigned long flags; + + spin_lock_irqsave(&ahcd->lock, flags); + + ed = ep->hcpriv; + if (!ed) { + u32 info; + + /* FIXME: usbcore changes dev->devnum before SET_ADDRESS + * succeeds ... otherwise we wouldn't need "pipe". + */ + info = usb_pipedevice(pipe); + info |= (ep->desc.bEndpointAddress & ~USB_DIR_IN) << ED_EN_SHIFT; + info |= le16_to_cpu(ep->desc.wMaxPacketSize) << ED_MPS_SHIFT; + if (udev->speed == USB_SPEED_FULL) + info |= ED_SPEED_FULL; + + ed = ed_create(ahcd, usb_pipetype(pipe), info); + if (ed) + ep->hcpriv = ed; + } + + spin_unlock_irqrestore(&ahcd->lock, flags); + + return ed; +} + +/*-------------------------------------------------------------------------*/ + +/* request unlinking of an endpoint from an operational HC. + * put the ep on the rm_list + * real work is done at the next start frame (SOFI) hardware interrupt + * caller guarantees HCD is running, so hardware access is safe, + * and that ed->state is ED_OPER + */ +static void start_ed_unlink(struct admhcd *ahcd, struct ed *ed) +{ + +#ifdef ADMHC_VERBOSE_DEBUG + admhc_dump_ed(ahcd, "ED-UNLINK", ed, 1); +#endif + + ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE); + ed_deschedule(ahcd, ed); + + /* add this ED into the remove list */ + ed->ed_rm_next = ahcd->ed_rm_list; + ahcd->ed_rm_list = ed; + + /* enable SOF interrupt */ + admhc_intr_ack(ahcd, ADMHC_INTR_SOFI); + admhc_intr_enable(ahcd, ADMHC_INTR_SOFI); + /* flush those writes */ + admhc_writel_flush(ahcd); + + /* SOF interrupt might get delayed; record the frame counter value that + * indicates when the HC isn't looking at it, so concurrent unlinks + * behave. frame_no wraps every 2^16 msec, and changes right before + * SOF is triggered. + */ + ed->tick = admhc_frame_no(ahcd) + 1; +} + +/*-------------------------------------------------------------------------* + * TD handling functions + *-------------------------------------------------------------------------*/ + +/* enqueue next TD for this URB (OHCI spec 5.2.8.2) */ + +static void +td_fill(struct admhcd *ahcd, u32 info, dma_addr_t data, int len, + struct urb *urb, int index) +{ + struct td *td, *td_pt; + struct urb_priv *urb_priv = urb->hcpriv; + int hash; + u32 cbl = 0; + +#if 1 + if (index == (urb_priv->td_cnt - 1) && + ((urb->transfer_flags & URB_NO_INTERRUPT) == 0)) + cbl |= TD_IE; +#else + if (index == (urb_priv->td_cnt - 1)) + cbl |= TD_IE; +#endif + + /* use this td as the next dummy */ + td_pt = urb_priv->td[index]; + + /* fill the old dummy TD */ + td = urb_priv->td[index] = urb_priv->ed->dummy; + urb_priv->ed->dummy = td_pt; + + td->ed = urb_priv->ed; + td->next_dl_td = NULL; + td->index = index; + td->urb = urb; + td->data_dma = data; + if (!len) + data = 0; + + if (data) + cbl |= (len & TD_BL_MASK); + + info |= TD_OWN; + + /* setup hardware specific fields */ + td->hwINFO = cpu_to_hc32(ahcd, info); + td->hwDBP = cpu_to_hc32(ahcd, data); + td->hwCBL = cpu_to_hc32(ahcd, cbl); + td->hwNextTD = cpu_to_hc32(ahcd, td_pt->td_dma); + + /* append to queue */ + list_add_tail(&td->td_list, &td->ed->td_list); + + /* hash it for later reverse mapping */ + hash = TD_HASH_FUNC(td->td_dma); + td->td_hash = ahcd->td_hash[hash]; + ahcd->td_hash[hash] = td; + + /* HC might read the TD (or cachelines) right away ... */ + wmb(); + td->ed->hwTailP = td->hwNextTD; +} + +/*-------------------------------------------------------------------------*/ + +/* Prepare all TDs of a transfer, and queue them onto the ED. + * Caller guarantees HC is active. + * Usually the ED is already on the schedule, so TDs might be + * processed as soon as they're queued. + */ +static void td_submit_urb(struct admhcd *ahcd, struct urb *urb) +{ + struct urb_priv *urb_priv = urb->hcpriv; + dma_addr_t data; + int data_len = urb->transfer_buffer_length; + int cnt = 0; + u32 info = 0; + int is_out = usb_pipeout(urb->pipe); + u32 toggle = 0; + + /* OHCI handles the bulk/interrupt data toggles itself. We just + * use the device toggle bits for resetting, and rely on the fact + * that resetting toggle is meaningless if the endpoint is active. + */ + + if (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), is_out)) { + toggle = TD_T_CARRY; + } else { + toggle = TD_T_DATA0; + usb_settoggle(urb->dev, usb_pipeendpoint (urb->pipe), + is_out, 1); + } + + urb_priv->td_idx = 0; + list_add(&urb_priv->pending, &ahcd->pending); + + if (data_len) + data = urb->transfer_dma; + else + data = 0; + + /* NOTE: TD_CC is set so we can tell which TDs the HC processed by + * using TD_CC_GET, as well as by seeing them on the done list. + * (CC = NotAccessed ... 0x0F, or 0x0E in PSWs for ISO.) + */ + switch (urb_priv->ed->type) { + case PIPE_INTERRUPT: + info = is_out + ? TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_OUT + : TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_IN; + + /* setup service interval and starting frame number */ + info |= (urb->start_frame & TD_FN_MASK); + info |= (urb->interval & TD_ISI_MASK) << TD_ISI_SHIFT; + + td_fill(ahcd, info, data, data_len, urb, cnt); + cnt++; + + admhcd_to_hcd(ahcd)->self.bandwidth_int_reqs++; + break; + + case PIPE_BULK: + info = is_out + ? TD_SCC_NOTACCESSED | TD_DP_OUT + : TD_SCC_NOTACCESSED | TD_DP_IN; + + /* TDs _could_ transfer up to 8K each */ + while (data_len > TD_DATALEN_MAX) { + td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), + data, TD_DATALEN_MAX, urb, cnt); + data += TD_DATALEN_MAX; + data_len -= TD_DATALEN_MAX; + cnt++; + } + + td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), data, + data_len, urb, cnt); + cnt++; + + if ((urb->transfer_flags & URB_ZERO_PACKET) + && (cnt < urb_priv->td_cnt)) { + td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), + 0, 0, urb, cnt); + cnt++; + } + break; + + /* control manages DATA0/DATA1 toggle per-request; SETUP resets it, + * any DATA phase works normally, and the STATUS ack is special. + */ + case PIPE_CONTROL: + /* fill a TD for the setup */ + info = TD_SCC_NOTACCESSED | TD_DP_SETUP | TD_T_DATA0; + td_fill(ahcd, info, urb->setup_dma, 8, urb, cnt++); + + if (data_len > 0) { + /* fill a TD for the data */ + info = TD_SCC_NOTACCESSED | TD_T_DATA1; + info |= is_out ? TD_DP_OUT : TD_DP_IN; + /* NOTE: mishandles transfers >8K, some >4K */ + td_fill(ahcd, info, data, data_len, urb, cnt++); + } + + /* fill a TD for the ACK */ + info = (is_out || data_len == 0) + ? TD_SCC_NOTACCESSED | TD_DP_IN | TD_T_DATA1 + : TD_SCC_NOTACCESSED | TD_DP_OUT | TD_T_DATA1; + td_fill(ahcd, info, data, 0, urb, cnt++); + + break; + + /* ISO has no retransmit, so no toggle; + * Each TD could handle multiple consecutive frames (interval 1); + * we could often reduce the number of TDs here. + */ + case PIPE_ISOCHRONOUS: + info = is_out + ? TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_OUT + : TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_IN; + + for (cnt = 0; cnt < urb->number_of_packets; cnt++) { + int frame = urb->start_frame; + + frame += cnt * urb->interval; + frame &= TD_FN_MASK; + td_fill(ahcd, info | frame, + data + urb->iso_frame_desc[cnt].offset, + urb->iso_frame_desc[cnt].length, urb, cnt); + } + admhcd_to_hcd(ahcd)->self.bandwidth_isoc_reqs++; + break; + } + + if (urb_priv->td_cnt != cnt) + admhc_err(ahcd, "bad number of tds created for urb %p\n", urb); +} + +/*-------------------------------------------------------------------------* + * Done List handling functions + *-------------------------------------------------------------------------*/ + +/* calculate transfer length/status and update the urb */ +static int td_done(struct admhcd *ahcd, struct urb *urb, struct td *td) +{ + struct urb_priv *urb_priv = urb->hcpriv; + u32 info; + u32 bl; + u32 tdDBP; + int type = usb_pipetype(urb->pipe); + int cc; + int status = -EINPROGRESS; + + info = hc32_to_cpup(ahcd, &td->hwINFO); + tdDBP = hc32_to_cpup(ahcd, &td->hwDBP); + bl = TD_BL_GET(hc32_to_cpup(ahcd, &td->hwCBL)); + cc = TD_CC_GET(info); + + /* ISO ... drivers see per-TD length/status */ + if (type == PIPE_ISOCHRONOUS) { + /* TODO */ + int dlen = 0; + + /* NOTE: assumes FC in tdINFO == 0, and that + * only the first of 0..MAXPSW psws is used. + */ + if (info & TD_CC) /* hc didn't touch? */ + return status; + + if (usb_pipeout(urb->pipe)) + dlen = urb->iso_frame_desc[td->index].length; + else { + /* short reads are always OK for ISO */ + if (cc == TD_CC_DATAUNDERRUN) + cc = TD_CC_NOERROR; + dlen = tdDBP - td->data_dma + bl; + } + + urb->actual_length += dlen; + urb->iso_frame_desc[td->index].actual_length = dlen; + urb->iso_frame_desc[td->index].status = cc_to_error[cc]; + + if (cc != TD_CC_NOERROR) + admhc_vdbg(ahcd, + "urb %p iso td %p (%d) len %d cc %d\n", + urb, td, 1 + td->index, dlen, cc); + + /* BULK, INT, CONTROL ... drivers see aggregate length/status, + * except that "setup" bytes aren't counted and "short" transfers + * might not be reported as errors. + */ + } else { + /* update packet status if needed (short is normally ok) */ + if (cc == TD_CC_DATAUNDERRUN + && !(urb->transfer_flags & URB_SHORT_NOT_OK)) + cc = TD_CC_NOERROR; + + if (cc != TD_CC_NOERROR && cc < TD_CC_HCD0) + status = cc_to_error[cc]; + + + /* count all non-empty packets except control SETUP packet */ + if ((type != PIPE_CONTROL || td->index != 0) && tdDBP != 0) + urb->actual_length += tdDBP - td->data_dma + bl; + + if (cc != TD_CC_NOERROR && cc < TD_CC_HCD0) + admhc_vdbg(ahcd, + "urb %p td %p (%d) cc %d, len=%d/%d\n", + urb, td, td->index, cc, + urb->actual_length, + urb->transfer_buffer_length); + } + + list_del(&td->td_list); + urb_priv->td_idx++; + + return status; +} + +/*-------------------------------------------------------------------------*/ + +static void ed_halted(struct admhcd *ahcd, struct td *td, int cc) +{ + struct urb *urb = td->urb; + struct urb_priv *urb_priv = urb->hcpriv; + struct ed *ed = td->ed; + struct list_head *tmp = td->td_list.next; + __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C); + + admhc_dump_ed(ahcd, "ed halted", td->ed, 1); + /* clear ed halt; this is the td that caused it, but keep it inactive + * until its urb->complete() has a chance to clean up. + */ + ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP); + wmb(); + ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H); + + /* Get rid of all later tds from this urb. We don't have + * to be careful: no errors and nothing was transferred. + * Also patch the ed so it looks as if those tds completed normally. + */ + while (tmp != &ed->td_list) { + struct td *next; + + next = list_entry(tmp, struct td, td_list); + tmp = next->td_list.next; + + if (next->urb != urb) + break; + + /* NOTE: if multi-td control DATA segments get supported, + * this urb had one of them, this td wasn't the last td + * in that segment (TD_R clear), this ed halted because + * of a short read, _and_ URB_SHORT_NOT_OK is clear ... + * then we need to leave the control STATUS packet queued + * and clear ED_SKIP. + */ + list_del(&next->td_list); + urb_priv->td_cnt++; + ed->hwHeadP = next->hwNextTD | toggle; + } + + /* help for troubleshooting: report anything that + * looks odd ... that doesn't include protocol stalls + * (or maybe some other things) + */ + switch (cc) { + case TD_CC_DATAUNDERRUN: + if ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0) + break; + /* fallthrough */ + case TD_CC_STALL: + if (usb_pipecontrol(urb->pipe)) + break; + /* fallthrough */ + default: + admhc_dbg(ahcd, + "urb %p path %s ep%d%s %08x cc %d --> status %d\n", + urb, urb->dev->devpath, + usb_pipeendpoint (urb->pipe), + usb_pipein(urb->pipe) ? "in" : "out", + hc32_to_cpu(ahcd, td->hwINFO), + cc, cc_to_error[cc]); + } +} + +/*-------------------------------------------------------------------------*/ + +/* there are some urbs/eds to unlink; called in_irq(), with HCD locked */ +static void +finish_unlinks(struct admhcd *ahcd, u16 tick) +{ + struct ed *ed, **last; + +rescan_all: + for (last = &ahcd->ed_rm_list, ed = *last; ed != NULL; ed = *last) { + struct list_head *entry, *tmp; + int completed, modified; + __hc32 *prev; + + /* only take off EDs that the HC isn't using, accounting for + * frame counter wraps and EDs with partially retired TDs + */ + if (likely(HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state))) { + if (tick_before(tick, ed->tick)) { +skip_ed: + last = &ed->ed_rm_next; + continue; + } +#if 0 + if (!list_empty(&ed->td_list)) { + struct td *td; + u32 head; + + td = list_entry(ed->td_list.next, struct td, + td_list); + head = hc32_to_cpu(ahcd, ed->hwHeadP) & + TD_MASK; + + /* INTR_WDH may need to clean up first */ + if (td->td_dma != head) + goto skip_ed; + } +#endif + } + + /* reentrancy: if we drop the schedule lock, someone might + * have modified this list. normally it's just prepending + * entries (which we'd ignore), but paranoia won't hurt. + */ + *last = ed->ed_rm_next; + ed->ed_rm_next = NULL; + modified = 0; + + /* unlink urbs as requested, but rescan the list after + * we call a completion since it might have unlinked + * another (earlier) urb + * + * When we get here, the HC doesn't see this ed. But it + * must not be rescheduled until all completed URBs have + * been given back to the driver. + */ +rescan_this: + completed = 0; + prev = &ed->hwHeadP; + list_for_each_safe(entry, tmp, &ed->td_list) { + struct td *td; + struct urb *urb; + struct urb_priv *urb_priv; + __hc32 savebits; + u32 tdINFO; + int status; + + td = list_entry(entry, struct td, td_list); + urb = td->urb; + urb_priv = td->urb->hcpriv; + + if (!urb->unlinked) { + prev = &td->hwNextTD; + continue; + } + + if ((urb_priv) == NULL) + continue; + + /* patch pointer hc uses */ + savebits = *prev & ~cpu_to_hc32(ahcd, TD_MASK); + *prev = td->hwNextTD | savebits; + /* If this was unlinked, the TD may not have been + * retired ... so manually save dhe data toggle. + * The controller ignores the value we save for + * control and ISO endpoints. + */ + tdINFO = hc32_to_cpup(ahcd, &td->hwINFO); + if ((tdINFO & TD_T) == TD_T_DATA0) + ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_C); + else if ((tdINFO & TD_T) == TD_T_DATA1) + ed->hwHeadP |= cpu_to_hc32(ahcd, ED_C); + + /* HC may have partly processed this TD */ +#ifdef ADMHC_VERBOSE_DEBUG + urb_print(ahcd, urb, "PARTIAL", 0); +#endif + status = td_done(ahcd, urb, td); + + /* if URB is done, clean up */ + if (urb_priv->td_idx == urb_priv->td_cnt) { + modified = completed = 1; + finish_urb(ahcd, urb, status); + } + } + if (completed && !list_empty(&ed->td_list)) + goto rescan_this; + + /* ED's now officially unlinked, hc doesn't see */ + ed->state = ED_IDLE; + ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H); + ed->hwNextED = 0; + wmb(); + ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP | ED_DEQUEUE); + + /* but if there's work queued, reschedule */ + if (!list_empty(&ed->td_list)) { + if (HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state)) + ed_schedule(ahcd, ed); + } + + if (modified) + goto rescan_all; + } +} + +/*-------------------------------------------------------------------------*/ +/* + * Process normal completions (error or success) and clean the schedules. + * + * This is the main path for handing urbs back to drivers. The only other + * normal path is finish_unlinks(), which unlinks URBs using ed_rm_list, + * instead of scanning the (re-reversed) donelist as this does. + */ + +static void ed_unhalt(struct admhcd *ahcd, struct ed *ed, struct urb *urb) +{ + struct list_head *entry, *tmp; + __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C); + +#ifdef ADMHC_VERBOSE_DEBUG + admhc_dump_ed(ahcd, "UNHALT", ed, 0); +#endif + /* clear ed halt; this is the td that caused it, but keep it inactive + * until its urb->complete() has a chance to clean up. + */ + ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP); + wmb(); + ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H); + + list_for_each_safe(entry, tmp, &ed->td_list) { + struct td *td = list_entry(entry, struct td, td_list); + __hc32 info; + + if (td->urb != urb) + break; + + info = td->hwINFO; + info &= ~cpu_to_hc32(ahcd, TD_CC | TD_OWN); + td->hwINFO = info; + + ed->hwHeadP = td->hwNextTD | toggle; + wmb(); + } + +} + +static void ed_intr_refill(struct admhcd *ahcd, struct ed *ed) +{ + __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C); + + ed->hwHeadP = ed->hwTailP | toggle; +} + + +static inline int is_ed_halted(struct admhcd *ahcd, struct ed *ed) +{ + return ((hc32_to_cpup(ahcd, &ed->hwHeadP) & ED_H) == ED_H); +} + +static inline int is_td_halted(struct admhcd *ahcd, struct ed *ed, + struct td *td) +{ + return ((hc32_to_cpup(ahcd, &ed->hwHeadP) & TD_MASK) == + (hc32_to_cpup(ahcd, &td->hwNextTD) & TD_MASK)); +} + +static void ed_update(struct admhcd *ahcd, struct ed *ed) +{ + struct list_head *entry, *tmp; + +#ifdef ADMHC_VERBOSE_DEBUG + admhc_dump_ed(ahcd, "UPDATE", ed, 1); +#endif + + list_for_each_safe(entry, tmp, &ed->td_list) { + struct td *td = list_entry(entry, struct td, td_list); + struct urb *urb = td->urb; + struct urb_priv *urb_priv = urb->hcpriv; + int status; + + if (hc32_to_cpup(ahcd, &td->hwINFO) & TD_OWN) + break; + + /* update URB's length and status from TD */ + status = td_done(ahcd, urb, td); + if (is_ed_halted(ahcd, ed) && is_td_halted(ahcd, ed, td)) + ed_unhalt(ahcd, ed, urb); + + if (ed->type == PIPE_INTERRUPT) + ed_intr_refill(ahcd, ed); + + /* If all this urb's TDs are done, call complete() */ + if (urb_priv->td_idx == urb_priv->td_cnt) + finish_urb(ahcd, urb, status); + + /* clean schedule: unlink EDs that are no longer busy */ + if (list_empty(&ed->td_list)) { + if (ed->state == ED_OPER) + start_ed_unlink(ahcd, ed); + + /* ... reenabling halted EDs only after fault cleanup */ + } else if ((ed->hwINFO & cpu_to_hc32(ahcd, + ED_SKIP | ED_DEQUEUE)) + == cpu_to_hc32(ahcd, ED_SKIP)) { + td = list_entry(ed->td_list.next, struct td, td_list); +#if 0 + if (!(td->hwINFO & cpu_to_hc32(ahcd, TD_DONE))) { + ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP); + /* ... hc may need waking-up */ + switch (ed->type) { + case PIPE_CONTROL: + admhc_writel(ahcd, OHCI_CLF, + &ahcd->regs->cmdstatus); + break; + case PIPE_BULK: + admhc_writel(ahcd, OHCI_BLF, + &ahcd->regs->cmdstatus); + break; + } + } +#else + if ((td->hwINFO & cpu_to_hc32(ahcd, TD_OWN))) + ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP); +#endif + } + + } +} + +/* there are some tds completed; called in_irq(), with HCD locked */ +static void admhc_td_complete(struct admhcd *ahcd) +{ + struct ed *ed; + + for (ed = ahcd->ed_head; ed; ed = ed->ed_next) { + if (ed->state != ED_OPER) + continue; + + ed_update(ahcd, ed); + } +} diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h new file mode 100644 index 000000000..e47aac8e7 --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h @@ -0,0 +1,755 @@ +/* + * ADM5120 HCD (Host Controller Driver) for USB + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This file was derived from: drivers/usb/host/ohci.h + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2002 David Brownell + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +/* + * __hc32 and __hc16 are "Host Controller" types, they may be equivalent to + * __leXX (normally) or __beXX (given OHCI_BIG_ENDIAN), depending on the + * host controller implementation. + */ +typedef __u32 __bitwise __hc32; +typedef __u16 __bitwise __hc16; + +/* + * OHCI Endpoint Descriptor (ED) ... holds TD queue + * See OHCI spec, section 4.2 + * + * This is a "Queue Head" for those transfers, which is why + * both EHCI and UHCI call similar structures a "QH". + */ + +#define TD_DATALEN_MAX 4096 + +#define ED_ALIGN 16 +#define ED_MASK ((u32)~(ED_ALIGN-1)) /* strip hw status in low addr bits */ + +struct ed { + /* first fields are hardware-specified */ + __hc32 hwINFO; /* endpoint config bitmap */ + /* info bits defined by hcd */ +#define ED_DEQUEUE (1 << 27) + /* info bits defined by the hardware */ +#define ED_MPS_SHIFT 16 +#define ED_MPS_MASK ((1 << 11)-1) +#define ED_MPS_GET(x) (((x) >> ED_MPS_SHIFT) & ED_MPS_MASK) +#define ED_ISO (1 << 15) /* isochronous endpoint */ +#define ED_SKIP (1 << 14) +#define ED_SPEED_FULL (1 << 13) /* fullspeed device */ +#define ED_INT (1 << 11) /* interrupt endpoint */ +#define ED_EN_SHIFT 7 /* endpoint shift */ +#define ED_EN_MASK ((1 << 4)-1) /* endpoint mask */ +#define ED_EN_GET(x) (((x) >> ED_EN_SHIFT) & ED_EN_MASK) +#define ED_FA_MASK ((1 << 7)-1) /* function address mask */ +#define ED_FA_GET(x) ((x) & ED_FA_MASK) + __hc32 hwTailP; /* tail of TD list */ + __hc32 hwHeadP; /* head of TD list (hc r/w) */ +#define ED_C (0x02) /* toggle carry */ +#define ED_H (0x01) /* halted */ + __hc32 hwNextED; /* next ED in list */ + + /* rest are purely for the driver's use */ + dma_addr_t dma; /* addr of ED */ + struct td *dummy; /* next TD to activate */ + + struct list_head urb_list; /* list of our URBs */ + + /* host's view of schedule */ + struct ed *ed_next; /* on schedule list */ + struct ed *ed_prev; /* for non-interrupt EDs */ + struct ed *ed_rm_next; /* on rm list */ + struct list_head td_list; /* "shadow list" of our TDs */ + + /* create --> IDLE --> OPER --> ... --> IDLE --> destroy + * usually: OPER --> UNLINK --> (IDLE | OPER) --> ... + */ + u8 state; /* ED_{IDLE,UNLINK,OPER} */ +#define ED_IDLE 0x00 /* NOT linked to HC */ +#define ED_UNLINK 0x01 /* being unlinked from hc */ +#define ED_OPER 0x02 /* IS linked to hc */ + + u8 type; /* PIPE_{BULK,...} */ + + /* periodic scheduling params (for intr and iso) */ + u8 branch; + u16 interval; + u16 load; + u16 last_iso; /* iso only */ + + /* HC may see EDs on rm_list until next frame (frame_no == tick) */ + u16 tick; +} __attribute__ ((aligned(ED_ALIGN))); + +/* + * OHCI Transfer Descriptor (TD) ... one per transfer segment + * See OHCI spec, sections 4.3.1 (general = control/bulk/interrupt) + * and 4.3.2 (iso) + */ + +#define TD_ALIGN 32 +#define TD_MASK ((u32)~(TD_ALIGN-1)) /* strip hw status in low addr bits */ + +struct td { + /* first fields are hardware-specified */ + __hc32 hwINFO; /* transfer info bitmask */ + + /* hwINFO bits */ +#define TD_OWN (1 << 31) /* owner of the descriptor */ +#define TD_CC_SHIFT 27 /* condition code */ +#define TD_CC_MASK 0xf +#define TD_CC (TD_CC_MASK << TD_CC_SHIFT) +#define TD_CC_GET(x) (((x) >> TD_CC_SHIFT) & TD_CC_MASK) + +#define TD_EC_SHIFT 25 /* error count */ +#define TD_EC_MASK 0x3 +#define TD_EC (TD_EC_MASK << TD_EC_SHIFT) +#define TD_EC_GET(x) ((x >> TD_EC_SHIFT) & TD_EC_MASK) +#define TD_T_SHIFT 23 /* data toggle state */ +#define TD_T_MASK 0x3 +#define TD_T (TD_T_MASK << TD_T_SHIFT) +#define TD_T_DATA0 (0x2 << TD_T_SHIFT) /* DATA0 */ +#define TD_T_DATA1 (0x3 << TD_T_SHIFT) /* DATA1 */ +#define TD_T_CARRY (0x0 << TD_T_SHIFT) /* uses ED_C */ +#define TD_T_GET(x) (((x) >> TD_T_SHIFT) & TD_T_MASK) +#define TD_DP_SHIFT 21 /* direction/pid */ +#define TD_DP_MASK 0x3 +#define TD_DP (TD_DP_MASK << TD_DP_SHIFT) +#define TD_DP_GET (((x) >> TD_DP_SHIFT) & TD_DP_MASK) +#define TD_DP_SETUP (0x0 << TD_DP_SHIFT) /* SETUP pid */ +#define TD_DP_OUT (0x1 << TD_DP_SHIFT) /* OUT pid */ +#define TD_DP_IN (0x2 << TD_DP_SHIFT) /* IN pid */ +#define TD_ISI_SHIFT 8 /* Interrupt Service Interval */ +#define TD_ISI_MASK 0x3f +#define TD_ISI_GET(x) (((x) >> TD_ISI_SHIFT) & TD_ISI_MASK) +#define TD_FN_MASK 0x3f /* frame number */ +#define TD_FN_GET(x) ((x) & TD_FN_MASK) + + __hc32 hwDBP; /* Data Buffer Pointer (or 0) */ + __hc32 hwCBL; /* Controller/Buffer Length */ + + /* hwCBL bits */ +#define TD_BL_MASK 0xffff /* buffer length */ +#define TD_BL_GET(x) ((x) & TD_BL_MASK) +#define TD_IE (1 << 16) /* interrupt enable */ + __hc32 hwNextTD; /* Next TD Pointer */ + + /* rest are purely for the driver's use */ + __u8 index; + struct ed *ed; + struct td *td_hash; /* dma-->td hashtable */ + struct td *next_dl_td; + struct urb *urb; + + dma_addr_t td_dma; /* addr of this TD */ + dma_addr_t data_dma; /* addr of data it points to */ + + struct list_head td_list; /* "shadow list", TDs on same ED */ + + u32 flags; +#define TD_FLAG_DONE (1 << 17) /* retired to done list */ +#define TD_FLAG_ISO (1 << 16) /* copy of ED_ISO */ +} __attribute__ ((aligned(TD_ALIGN))); /* c/b/i need 16; only iso needs 32 */ + +/* + * Hardware transfer status codes -- CC from td->hwINFO + */ +#define TD_CC_NOERROR 0x00 +#define TD_CC_CRC 0x01 +#define TD_CC_BITSTUFFING 0x02 +#define TD_CC_DATATOGGLEM 0x03 +#define TD_CC_STALL 0x04 +#define TD_CC_DEVNOTRESP 0x05 +#define TD_CC_PIDCHECKFAIL 0x06 +#define TD_CC_UNEXPECTEDPID 0x07 +#define TD_CC_DATAOVERRUN 0x08 +#define TD_CC_DATAUNDERRUN 0x09 + /* 0x0A, 0x0B reserved for hardware */ +#define TD_CC_BUFFEROVERRUN 0x0C +#define TD_CC_BUFFERUNDERRUN 0x0D + /* 0x0E, 0x0F reserved for HCD */ +#define TD_CC_HCD0 0x0E +#define TD_CC_NOTACCESSED 0x0F + +/* + * preshifted status codes + */ +#define TD_SCC_NOTACCESSED (TD_CC_NOTACCESSED << TD_CC_SHIFT) + + +/* map OHCI TD status codes (CC) to errno values */ +static const int cc_to_error[16] = { + /* No Error */ 0, + /* CRC Error */ -EILSEQ, + /* Bit Stuff */ -EPROTO, + /* Data Togg */ -EILSEQ, + /* Stall */ -EPIPE, + /* DevNotResp */ -ETIME, + /* PIDCheck */ -EPROTO, + /* UnExpPID */ -EPROTO, + /* DataOver */ -EOVERFLOW, + /* DataUnder */ -EREMOTEIO, + /* (for hw) */ -EIO, + /* (for hw) */ -EIO, + /* BufferOver */ -ECOMM, + /* BuffUnder */ -ENOSR, + /* (for HCD) */ -EALREADY, + /* (for HCD) */ -EALREADY +}; + +#define NUM_INTS 32 + +/* + * This is the structure of the OHCI controller's memory mapped I/O region. + * You must use readl() and writel() (in ) to access these fields!! + * Layout is in section 7 (and appendix B) of the spec. + */ +struct admhcd_regs { + __hc32 gencontrol; /* General Control */ + __hc32 int_status; /* Interrupt Status */ + __hc32 int_enable; /* Interrupt Enable */ + __hc32 reserved00; + __hc32 host_control; /* Host General Control */ + __hc32 reserved01; + __hc32 fminterval; /* Frame Interval */ + __hc32 fmnumber; /* Frame Number */ + __hc32 reserved02; + __hc32 reserved03; + __hc32 reserved04; + __hc32 reserved05; + __hc32 reserved06; + __hc32 reserved07; + __hc32 reserved08; + __hc32 reserved09; + __hc32 reserved10; + __hc32 reserved11; + __hc32 reserved12; + __hc32 reserved13; + __hc32 reserved14; + __hc32 reserved15; + __hc32 reserved16; + __hc32 reserved17; + __hc32 reserved18; + __hc32 reserved19; + __hc32 reserved20; + __hc32 reserved21; + __hc32 lsthresh; /* Low Speed Threshold */ + __hc32 rhdesc; /* Root Hub Descriptor */ +#define MAX_ROOT_PORTS 2 + __hc32 portstatus[MAX_ROOT_PORTS]; /* Port Status */ + __hc32 hosthead; /* Host Descriptor Head */ +} __attribute__ ((aligned(32))); + +/* + * General Control register bits + */ +#define ADMHC_CTRL_UHFE (1 << 0) /* USB Host Function Enable */ +#define ADMHC_CTRL_SIR (1 << 1) /* Software Interrupt request */ +#define ADMHC_CTRL_DMAA (1 << 2) /* DMA Arbitration Control */ +#define ADMHC_CTRL_SR (1 << 3) /* Software Reset */ + +/* + * Host General Control register bits + */ +#define ADMHC_HC_BUSS 0x3 /* USB bus state */ +#define ADMHC_BUSS_RESET 0x0 +#define ADMHC_BUSS_RESUME 0x1 +#define ADMHC_BUSS_OPER 0x2 +#define ADMHC_BUSS_SUSPEND 0x3 +#define ADMHC_HC_DMAE (1 << 2) /* DMA enable */ + +/* + * Interrupt Status/Enable register bits + */ +#define ADMHC_INTR_SOFI (1 << 4) /* start of frame */ +#define ADMHC_INTR_RESI (1 << 5) /* resume detected */ +#define ADMHC_INTR_6 (1 << 6) /* unknown */ +#define ADMHC_INTR_7 (1 << 7) /* unknown */ +#define ADMHC_INTR_BABI (1 << 8) /* babble detected */ +#define ADMHC_INTR_INSM (1 << 9) /* root hub status change */ +#define ADMHC_INTR_SO (1 << 10) /* scheduling overrun */ +#define ADMHC_INTR_FNO (1 << 11) /* frame number overflow */ +#define ADMHC_INTR_TDC (1 << 20) /* transfer descriptor completed */ +#define ADMHC_INTR_SWI (1 << 29) /* software interrupt */ +#define ADMHC_INTR_FATI (1 << 30) /* fatal error */ +#define ADMHC_INTR_INTA (1 << 31) /* interrupt active */ + +#define ADMHC_INTR_MIE (1 << 31) /* master interrupt enable */ + +/* + * SOF Frame Interval register bits + */ +#define ADMHC_SFI_FI_MASK ((1 << 14)-1) /* Frame Interval value */ +#define ADMHC_SFI_FSLDP_SHIFT 16 +#define ADMHC_SFI_FSLDP_MASK ((1 << 15)-1) +#define ADMHC_SFI_FIT (1 << 31) /* Frame Interval Toggle */ + +/* + * SOF Frame Number register bits + */ +#define ADMHC_SFN_FN_MASK ((1 << 16)-1) /* Frame Number Mask */ +#define ADMHC_SFN_FR_SHIFT 16 /* Frame Remaining Shift */ +#define ADMHC_SFN_FR_MASK ((1 << 14)-1) /* Frame Remaining Mask */ +#define ADMHC_SFN_FRT (1 << 31) /* Frame Remaining Toggle */ + +/* + * Root Hub Descriptor register bits + */ +#define ADMHC_RH_NUMP 0xff /* number of ports */ +#define ADMHC_RH_PSM (1 << 8) /* power switching mode */ +#define ADMHC_RH_NPS (1 << 9) /* no power switching */ +#define ADMHC_RH_OCPM (1 << 10) /* over current protection mode */ +#define ADMHC_RH_NOCP (1 << 11) /* no over current protection */ +#define ADMHC_RH_PPCM (0xff << 16) /* port power control */ + +#define ADMHC_RH_LPS (1 << 24) /* local power switch */ +#define ADMHC_RH_OCI (1 << 25) /* over current indicator */ + +/* status change bits */ +#define ADMHC_RH_LPSC (1 << 26) /* local power switch change */ +#define ADMHC_RH_OCIC (1 << 27) /* over current indicator change */ + +#define ADMHC_RH_DRWE (1 << 28) /* device remote wakeup enable */ +#define ADMHC_RH_CRWE (1 << 29) /* clear remote wakeup enable */ + +#define ADMHC_RH_CGP (1 << 24) /* clear global power */ +#define ADMHC_RH_SGP (1 << 26) /* set global power */ + +/* + * Port Status register bits + */ +#define ADMHC_PS_CCS (1 << 0) /* current connect status */ +#define ADMHC_PS_PES (1 << 1) /* port enable status */ +#define ADMHC_PS_PSS (1 << 2) /* port suspend status */ +#define ADMHC_PS_POCI (1 << 3) /* port over current indicator */ +#define ADMHC_PS_PRS (1 << 4) /* port reset status */ +#define ADMHC_PS_PPS (1 << 8) /* port power status */ +#define ADMHC_PS_LSDA (1 << 9) /* low speed device attached */ + +/* status change bits */ +#define ADMHC_PS_CSC (1 << 16) /* connect status change */ +#define ADMHC_PS_PESC (1 << 17) /* port enable status change */ +#define ADMHC_PS_PSSC (1 << 18) /* port suspend status change */ +#define ADMHC_PS_OCIC (1 << 19) /* over current indicator change */ +#define ADMHC_PS_PRSC (1 << 20) /* port reset status change */ + +/* port feature bits */ +#define ADMHC_PS_CPE (1 << 0) /* clear port enable */ +#define ADMHC_PS_SPE (1 << 1) /* set port enable */ +#define ADMHC_PS_SPS (1 << 2) /* set port suspend */ +#define ADMHC_PS_CPS (1 << 3) /* clear suspend status */ +#define ADMHC_PS_SPR (1 << 4) /* set port reset */ +#define ADMHC_PS_SPP (1 << 8) /* set port power */ +#define ADMHC_PS_CPP (1 << 9) /* clear port power */ + +/* + * the POTPGT value is not defined in the ADMHC, so define a dummy value + */ +#define ADMHC_POTPGT 2 /* in ms */ + +/* hcd-private per-urb state */ +struct urb_priv { + struct ed *ed; + struct list_head pending; /* URBs on the same ED */ + + u32 td_cnt; /* # tds in this request */ + u32 td_idx; /* index of the current td */ + struct td *td[0]; /* all TDs in this request */ +}; + +#define TD_HASH_SIZE 64 /* power'o'two */ +/* sizeof (struct td) ~= 64 == 2^6 ... */ +#define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 6)) % TD_HASH_SIZE) + +/* + * This is the full ADMHCD controller description + * + * Note how the "proper" USB information is just + * a subset of what the full implementation needs. (Linus) + */ + +struct admhcd { + spinlock_t lock; + + /* + * I/O memory used to communicate with the HC (dma-consistent) + */ + struct admhcd_regs __iomem *regs; + + /* + * hcd adds to schedule for a live hc any time, but removals finish + * only at the start of the next frame. + */ + + struct ed *ed_head; + struct ed *ed_tails[4]; + + struct ed *ed_rm_list; /* to be removed */ + + struct ed *periodic[NUM_INTS]; /* shadow int_table */ + +#if 0 /* TODO: remove? */ + /* + * OTG controllers and transceivers need software interaction; + * other external transceivers should be software-transparent + */ + struct otg_transceiver *transceiver; + void (*start_hnp)(struct admhcd *ahcd); +#endif + + /* + * memory management for queue data structures + */ + struct dma_pool *td_cache; + struct dma_pool *ed_cache; + struct td *td_hash[TD_HASH_SIZE]; + struct list_head pending; + + /* + * driver state + */ + int num_ports; + int load[NUM_INTS]; + u32 host_control; /* copy of the host_control reg */ + unsigned long next_statechange; /* suspend/resume */ + u32 fminterval; /* saved register */ + unsigned autostop:1; /* rh auto stopping/stopped */ + + unsigned long flags; /* for HC bugs */ +#define OHCI_QUIRK_AMD756 0x01 /* erratum #4 */ +#define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ +#define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */ +#define OHCI_QUIRK_BE_DESC 0x08 /* BE descriptors */ +#define OHCI_QUIRK_BE_MMIO 0x10 /* BE registers */ +#define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/ + /* there are also chip quirks/bugs in init logic */ + +#ifdef DEBUG + struct dentry *debug_dir; + struct dentry *debug_async; + struct dentry *debug_periodic; + struct dentry *debug_registers; +#endif +}; + +/* convert between an hcd pointer and the corresponding ahcd_hcd */ +static inline struct admhcd *hcd_to_admhcd(struct usb_hcd *hcd) +{ + return (struct admhcd *)(hcd->hcd_priv); +} +static inline struct usb_hcd *admhcd_to_hcd(const struct admhcd *ahcd) +{ + return container_of((void *)ahcd, struct usb_hcd, hcd_priv); +} + +/*-------------------------------------------------------------------------*/ + +#ifndef DEBUG +#define STUB_DEBUG_FILES +#endif /* DEBUG */ + +#ifdef DEBUG +# define admhc_dbg(ahcd, fmt, args...) \ + printk(KERN_DEBUG "adm5120-hcd: " fmt, ## args) +#else +# define admhc_dbg(ahcd, fmt, args...) do { } while (0) +#endif + +#define admhc_err(ahcd, fmt, args...) \ + printk(KERN_ERR "adm5120-hcd: " fmt, ## args) +#define admhc_info(ahcd, fmt, args...) \ + printk(KERN_INFO "adm5120-hcd: " fmt, ## args) +#define admhc_warn(ahcd, fmt, args...) \ + printk(KERN_WARNING "adm5120-hcd: " fmt, ## args) + +#ifdef ADMHC_VERBOSE_DEBUG +# define admhc_vdbg admhc_dbg +#else +# define admhc_vdbg(ahcd, fmt, args...) do { } while (0) +#endif + +/*-------------------------------------------------------------------------*/ + +/* + * While most USB host controllers implement their registers and + * in-memory communication descriptors in little-endian format, + * a minority (notably the IBM STB04XXX and the Motorola MPC5200 + * processors) implement them in big endian format. + * + * In addition some more exotic implementations like the Toshiba + * Spider (aka SCC) cell southbridge are "mixed" endian, that is, + * they have a different endianness for registers vs. in-memory + * descriptors. + * + * This attempts to support either format at compile time without a + * runtime penalty, or both formats with the additional overhead + * of checking a flag bit. + * + * That leads to some tricky Kconfig rules howevber. There are + * different defaults based on some arch/ppc platforms, though + * the basic rules are: + * + * Controller type Kconfig options needed + * --------------- ---------------------- + * little endian CONFIG_USB_ADMHC_LITTLE_ENDIAN + * + * fully big endian CONFIG_USB_ADMHC_BIG_ENDIAN_DESC _and_ + * CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO + * + * mixed endian CONFIG_USB_ADMHC_LITTLE_ENDIAN _and_ + * CONFIG_USB_OHCI_BIG_ENDIAN_{MMIO,DESC} + * + * (If you have a mixed endian controller, you -must- also define + * CONFIG_USB_ADMHC_LITTLE_ENDIAN or things will not work when building + * both your mixed endian and a fully big endian controller support in + * the same kernel image). + */ + +#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_DESC +#ifdef CONFIG_USB_ADMHC_LITTLE_ENDIAN +#define big_endian_desc(ahcd) (ahcd->flags & OHCI_QUIRK_BE_DESC) +#else +#define big_endian_desc(ahcd) 1 /* only big endian */ +#endif +#else +#define big_endian_desc(ahcd) 0 /* only little endian */ +#endif + +#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO +#ifdef CONFIG_USB_ADMHC_LITTLE_ENDIAN +#define big_endian_mmio(ahcd) (ahcd->flags & OHCI_QUIRK_BE_MMIO) +#else +#define big_endian_mmio(ahcd) 1 /* only big endian */ +#endif +#else +#define big_endian_mmio(ahcd) 0 /* only little endian */ +#endif + +/* + * Big-endian read/write functions are arch-specific. + * Other arches can be added if/when they're needed. + * + */ +static inline unsigned int admhc_readl(const struct admhcd *ahcd, + __hc32 __iomem *regs) +{ +#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO + return big_endian_mmio(ahcd) ? + readl_be(regs) : + readl(regs); +#else + return readl(regs); +#endif +} + +static inline void admhc_writel(const struct admhcd *ahcd, + const unsigned int val, __hc32 __iomem *regs) +{ +#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO + big_endian_mmio(ahcd) ? + writel_be(val, regs) : + writel(val, regs); +#else + writel(val, regs); +#endif +} + +static inline void admhc_writel_flush(const struct admhcd *ahcd) +{ +#if 0 + /* TODO: remove? */ + (void) admhc_readl(ahcd, &ahcd->regs->gencontrol); +#endif +} + + +/*-------------------------------------------------------------------------*/ + +/* cpu to ahcd */ +static inline __hc16 cpu_to_hc16(const struct admhcd *ahcd, const u16 x) +{ + return big_endian_desc(ahcd) ? + (__force __hc16)cpu_to_be16(x) : + (__force __hc16)cpu_to_le16(x); +} + +static inline __hc16 cpu_to_hc16p(const struct admhcd *ahcd, const u16 *x) +{ + return big_endian_desc(ahcd) ? + cpu_to_be16p(x) : + cpu_to_le16p(x); +} + +static inline __hc32 cpu_to_hc32(const struct admhcd *ahcd, const u32 x) +{ + return big_endian_desc(ahcd) ? + (__force __hc32)cpu_to_be32(x) : + (__force __hc32)cpu_to_le32(x); +} + +static inline __hc32 cpu_to_hc32p(const struct admhcd *ahcd, const u32 *x) +{ + return big_endian_desc(ahcd) ? + cpu_to_be32p(x) : + cpu_to_le32p(x); +} + +/* ahcd to cpu */ +static inline u16 hc16_to_cpu(const struct admhcd *ahcd, const __hc16 x) +{ + return big_endian_desc(ahcd) ? + be16_to_cpu((__force __be16)x) : + le16_to_cpu((__force __le16)x); +} + +static inline u16 hc16_to_cpup(const struct admhcd *ahcd, const __hc16 *x) +{ + return big_endian_desc(ahcd) ? + be16_to_cpup((__force __be16 *)x) : + le16_to_cpup((__force __le16 *)x); +} + +static inline u32 hc32_to_cpu(const struct admhcd *ahcd, const __hc32 x) +{ + return big_endian_desc(ahcd) ? + be32_to_cpu((__force __be32)x) : + le32_to_cpu((__force __le32)x); +} + +static inline u32 hc32_to_cpup(const struct admhcd *ahcd, const __hc32 *x) +{ + return big_endian_desc(ahcd) ? + be32_to_cpup((__force __be32 *)x) : + le32_to_cpup((__force __le32 *)x); +} + +/*-------------------------------------------------------------------------*/ + +static inline u16 admhc_frame_no(const struct admhcd *ahcd) +{ + u32 t; + + t = admhc_readl(ahcd, &ahcd->regs->fmnumber) & ADMHC_SFN_FN_MASK; + return (u16)t; +} + +static inline u16 admhc_frame_remain(const struct admhcd *ahcd) +{ + u32 t; + + t = admhc_readl(ahcd, &ahcd->regs->fmnumber) >> ADMHC_SFN_FR_SHIFT; + t &= ADMHC_SFN_FR_MASK; + return (u16)t; +} + +/*-------------------------------------------------------------------------*/ + +static inline void admhc_disable(struct admhcd *ahcd) +{ + admhcd_to_hcd(ahcd)->state = HC_STATE_HALT; +} + +#define FI 0x2edf /* 12000 bits per frame (-1) */ +#define FSLDP(fi) (0x7fff & ((6 * ((fi) - 1200)) / 7)) +#define FIT ADMHC_SFI_FIT +#define LSTHRESH 0x628 /* lowspeed bit threshold */ + +static inline void periodic_reinit(struct admhcd *ahcd) +{ +#if 0 + u32 fi = ahcd->fminterval & ADMHC_SFI_FI_MASK; + u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT; + + /* TODO: adjust FSLargestDataPacket value too? */ + admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval, + &ahcd->regs->fminterval); +#else + u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT; + + /* TODO: adjust FSLargestDataPacket value too? */ + admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval, + &ahcd->regs->fminterval); +#endif +} + +static inline u32 admhc_read_rhdesc(struct admhcd *ahcd) +{ + return admhc_readl(ahcd, &ahcd->regs->rhdesc); +} + +static inline u32 admhc_read_portstatus(struct admhcd *ahcd, int port) +{ + return admhc_readl(ahcd, &ahcd->regs->portstatus[port]); +} + +static inline void admhc_write_portstatus(struct admhcd *ahcd, int port, + u32 value) +{ + admhc_writel(ahcd, value, &ahcd->regs->portstatus[port]); +} + +static inline void roothub_write_status(struct admhcd *ahcd, u32 value) +{ + /* FIXME: read-only bits must be masked out */ + admhc_writel(ahcd, value, &ahcd->regs->rhdesc); +} + +static inline void admhc_intr_disable(struct admhcd *ahcd, u32 ints) +{ + u32 t; + + t = admhc_readl(ahcd, &ahcd->regs->int_enable); + t &= ~(ints); + admhc_writel(ahcd, t, &ahcd->regs->int_enable); + /* TODO: flush writes ?*/ +} + +static inline void admhc_intr_enable(struct admhcd *ahcd, u32 ints) +{ + u32 t; + + t = admhc_readl(ahcd, &ahcd->regs->int_enable); + t |= ints; + admhc_writel(ahcd, t, &ahcd->regs->int_enable); + /* TODO: flush writes ?*/ +} + +static inline void admhc_intr_ack(struct admhcd *ahcd, u32 ints) +{ + admhc_writel(ahcd, ints, &ahcd->regs->int_status); +} + +static inline void admhc_dma_enable(struct admhcd *ahcd) +{ + u32 t; + + t = admhc_readl(ahcd, &ahcd->regs->host_control); + if (t & ADMHC_HC_DMAE) + return; + + t |= ADMHC_HC_DMAE; + admhc_writel(ahcd, t, &ahcd->regs->host_control); + admhc_vdbg(ahcd, "DMA enabled\n"); +} + +static inline void admhc_dma_disable(struct admhcd *ahcd) +{ + u32 t; + + t = admhc_readl(ahcd, &ahcd->regs->host_control); + if (!(t & ADMHC_HC_DMAE)) + return; + + t &= ~ADMHC_HC_DMAE; + admhc_writel(ahcd, t, &ahcd->regs->host_control); + admhc_vdbg(ahcd, "DMA disabled\n"); +} diff --git a/target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c b/target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c new file mode 100644 index 000000000..d5d63b27a --- /dev/null +++ b/target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c @@ -0,0 +1,202 @@ +/* + * ADM5120_WDT 0.01: Infineon ADM5120 SoC watchdog driver + * Copyright (c) Ondrej Zajicek , 2007 + * + * based on + * + * RC32434_WDT 0.01: IDT Interprise 79RC32434 watchdog driver + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#define DEFAULT_TIMEOUT 15 /* (secs) Default is 15 seconds */ +#define MAX_TIMEOUT 327 +/* Max is 327 seconds, counter is 15-bit integer, step is 10 ms */ + +#define NAME "adm5120_wdt" +#define VERSION "0.1" + +static int expect_close; +static int access; +static unsigned int timeout = DEFAULT_TIMEOUT; + +static int nowayout = WATCHDOG_NOWAYOUT; +module_param(nowayout, int, 0); +MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); +MODULE_LICENSE("GPL"); + + +static inline void wdt_set_timeout(void) +{ + u32 val = (1 << 31) | (((timeout * 100) & 0x7FFF) << 16); + SW_WRITE_REG(SWITCH_REG_WDOG0, val); +} + +/* + It looks like WDOG0-register-write don't modify counter, + but WDOG0-register-read resets counter. +*/ + +static inline void wdt_reset_counter(void) +{ + SW_READ_REG(SWITCH_REG_WDOG0); +} + +static inline void wdt_disable(void) +{ + SW_WRITE_REG(SWITCH_REG_WDOG0, 0x7FFF0000); +} + + + +static int wdt_open(struct inode *inode, struct file *file) +{ + /* Allow only one person to hold it open */ + if (access) + return -EBUSY; + + if (nowayout) + __module_get(THIS_MODULE); + + /* Activate timer */ + wdt_reset_counter(); + wdt_set_timeout(); + printk(KERN_INFO NAME ": enabling watchdog timer\n"); + access = 1; + return 0; +} + +static int wdt_release(struct inode *inode, struct file *file) +{ + /* + * Shut off the timer. + * Lock it in if it's a module and we set nowayout + */ + if (expect_close && (nowayout == 0)) { + wdt_disable(); + printk(KERN_INFO NAME ": disabling watchdog timer\n"); + module_put(THIS_MODULE); + } else + printk(KERN_CRIT NAME ": device closed unexpectedly. WDT will not stop!\n"); + + access = 0; + return 0; +} + +static ssize_t wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) +{ + /* Refresh the timer. */ + if (len) { + if (!nowayout) { + size_t i; + + /* In case it was set long ago */ + expect_close = 0; + + for (i = 0; i != len; i++) { + char c; + if (get_user(c, data + i)) + return -EFAULT; + if (c == 'V') + expect_close = 1; + } + } + wdt_reset_counter(); + return len; + } + return 0; +} + +static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + int new_timeout; + static struct watchdog_info ident = { + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE, + .firmware_version = 0, + .identity = "ADM5120_WDT Watchdog", + }; + switch (cmd) { + default: + return -ENOTTY; + case WDIOC_GETSUPPORT: + if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) + return -EFAULT; + return 0; + case WDIOC_GETSTATUS: + case WDIOC_GETBOOTSTATUS: + return put_user(0, (int *)arg); + case WDIOC_KEEPALIVE: + wdt_reset_counter(); + return 0; + case WDIOC_SETTIMEOUT: + if (get_user(new_timeout, (int *)arg)) + return -EFAULT; + if (new_timeout < 1) + return -EINVAL; + if (new_timeout > MAX_TIMEOUT) + return -EINVAL; + timeout = new_timeout; + wdt_set_timeout(); + /* Fall */ + case WDIOC_GETTIMEOUT: + return put_user(timeout, (int *)arg); + } +} + +static const struct file_operations wdt_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .write = wdt_write, + .unlocked_ioctl = wdt_ioctl, + .open = wdt_open, + .release = wdt_release, +}; + +static struct miscdevice wdt_miscdev = { + .minor = WATCHDOG_MINOR, + .name = "watchdog", + .fops = &wdt_fops, +}; + +static char banner[] __initdata = KERN_INFO NAME ": Watchdog Timer version " VERSION "\n"; + +static int __init watchdog_init(void) +{ + int ret; + + ret = misc_register(&wdt_miscdev); + + if (ret) + return ret; + + wdt_disable(); + printk(banner); + + return 0; +} + +static void __exit watchdog_exit(void) +{ + misc_deregister(&wdt_miscdev); +} + +module_init(watchdog_init); +module_exit(watchdog_exit); diff --git a/target/linux/adm5120/image/Makefile b/target/linux/adm5120/image/Makefile new file mode 100644 index 000000000..4ca4d4856 --- /dev/null +++ b/target/linux/adm5120/image/Makefile @@ -0,0 +1,112 @@ +# +# Copyright (C) 2006-2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR) +JFFS2BLOCK := $(KDIR)/jffs2.block +JFFS2MARK := $(KDIR)/jffs2.mark + +define imgname +$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(1)) +endef + +VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux +fs_squash:=squashfs-only +fs_all:=all +fs_4k:=4k +fs_64k:=64k +fs_128k:=128k + +define Build/Clean + $(LOADER_MAKE) clean +endef + +define Image/Prepare + cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma + rm -f $(JFFS2BLOCK) + touch $(JFFS2BLOCK) + $(call prepare_generic_squashfs,$(JFFS2BLOCK)) + rm -f $(JFFS2MARK) + touch $(JFFS2MARK) + $(call add_jffs2_mark,$(JFFS2MARK)) +endef + +define Image/Build/Loader + $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \ + LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \ + CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \ + compile loader.$(2) +endef + +define Image/Build/LZMAKernel + $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \ + LOADER=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ramfs.$(2) \ + LOADER_DATA=$(KDIR)/vmlinux.lzma \ + LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \ + CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \ + compile loader.$(2) +endef + +define Image/Build/LZMAKernel/Generic + $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0) +endef + +define Image/Build/LZMAKernel/Admboot + $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1)) +endef + +define Image/Build/LZMAKernel/Cellvision + $(call Image/Build/LZMAKernel,$(1),$(3),0x80500000,0x6D8,y,$(2)) +endef + +define Image/Build/LZMAKernel/KArgs + $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1)) +endef + +define trxalign/jffs2-128k +-a 0x20000 -f $(KDIR)/root.jffs2-128k +endef + +define trxalign/jffs2-64k +-a 0x10000 -f $(KDIR)/root.jffs2-64k +endef + +define trxalign/squashfs +-a 1024 -f $(KDIR)/root.squashfs -a 0x10000 -A $(JFFS2BLOCK) +endef + +define Image/Build/TRX + $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \ + $(call trxalign/$(2)) +endef + +define Image/Build/TRXNoloader + $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \ + $(call trxalign/$(2)) +endef + +include $(SUBTARGET).mk + +define Image/Build + $(call Image/Build/Profile/$(PROFILE),$(1)) +endef + +define Image/Build/Initramfs + $(call Image/Build/Profile/$(PROFILE),Initramfs) +endef + +define Image/BuildKernel + cp $(KDIR)/vmlinux.elf $(VMLINUX).elf + cp $(KDIR)/vmlinux $(VMLINUX).bin +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf + cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin +endif +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/adm5120/image/lzma-loader/Makefile b/target/linux/adm5120/image/lzma-loader/Makefile new file mode 100644 index 000000000..36dfd09ea --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +LOADER := loader.bin +LOADER_NAME := $(basename $(notdir $(LOADER))) +LOADER_DATA := +TARGET_DIR := + +ifeq ($(TARGET_DIR),) +TARGET_DIR := $(KDIR) +endif + +LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin +LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz +LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf + +LZMA_STARTUP_ORG:= 0 +LZMA_TEXT_START := 0x80300000 + +PKG_NAME := lzma-loader +PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME) + +.PHONY : loader-compile loader.bin loader.elf loader.gz + +$(PKG_BUILD_DIR)/.prepared: + mkdir $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ + touch $@ + +loader-compile: $(PKG_BUILD_DIR)/.prepared + $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \ + LZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG) \ + LZMA_TEXT_START=$(LZMA_TEXT_START) \ + LOADER_DATA=$(LOADER_DATA) \ + CONFIG_BOARD=$(CONFIG_BOARD) \ + CONFIG_PASS_KARGS=$(CONFIG_PASS_KARGS) \ + clean all + +loader.gz: $(PKG_BUILD_DIR)/loader.bin + gzip -nc9 $< > $(LOADER_GZ) + +loader.elf: $(PKG_BUILD_DIR)/loader.elf + $(CP) $< $(LOADER_ELF) + +loader.bin: $(PKG_BUILD_DIR)/loader.bin + $(CP) $< $(LOADER_BIN) + +download: +prepare: $(PKG_BUILD_DIR)/.prepared +compile: loader-compile + +install: + +clean: + rm -rf $(PKG_BUILD_DIR) + diff --git a/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c b/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c new file mode 100644 index 000000000..cb8345377 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c @@ -0,0 +1,584 @@ +/* + LzmaDecode.c + LZMA Decoder (optimized for Speed version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaDecode.h" + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*Buffer++) + +#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ + { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} + +#ifdef _LZMA_IN_CB + +#define RC_TEST { if (Buffer == BufferLim) \ + { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ + BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} + +#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 + +#else + +#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } + +#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 + +#endif + +#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } + +#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) +#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; +#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; + +#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ + { UpdateBit0(p); mi <<= 1; A0; } else \ + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + +#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ + { int i = numLevels; res = 1; \ + do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ + res -= (1 << numLevels); } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + #ifdef _LZMA_OUT_READ + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + } + #endif + return LZMA_RESULT_OK; +} + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) +{ + CProb *p = vs->Probs; + SizeT nowPos = 0; + Byte previousByte = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + + #ifdef _LZMA_OUT_READ + + UInt32 Range = vs->Range; + UInt32 Code = vs->Code; + #ifdef _LZMA_IN_CB + const Byte *Buffer = vs->Buffer; + const Byte *BufferLim = vs->BufferLim; + #else + const Byte *Buffer = inStream; + const Byte *BufferLim = inStream + inSize; + #endif + int state = vs->State; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + Byte *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + Byte tempDictionary[4]; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + #else /* if !_LZMA_OUT_READ */ + + int state = 0; + UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; + int len = 0; + const Byte *Buffer; + const Byte *BufferLim; + UInt32 Range; + UInt32 Code; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + + { + UInt32 i; + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + } + + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + + #endif /* _LZMA_OUT_READ */ + + while(nowPos < outSize) + { + CProb *prob; + UInt32 bound; + int posState = (int)( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & posStateMask); + + prob = p + IsMatch + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + int symbol = 1; + UpdateBit0(prob) + prob = p + Literal + (LZMA_LIT_SIZE * + ((( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + int matchByte; + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + #else + matchByte = outStream[nowPos - rep0]; + #endif + do + { + int bit; + CProb *probLit; + matchByte <<= 1; + bit = (matchByte & 0x100); + probLit = prob + 0x100 + bit + symbol; + RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) + } + while (symbol < 0x100); + } + while (symbol < 0x100) + { + CProb *probLit = prob + symbol; + RC_GET_BIT(probLit, symbol) + } + previousByte = (Byte)symbol; + + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #endif + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + UpdateBit1(prob); + prob = p + IsRep + state; + IfBit0(prob) + { + UpdateBit0(prob); + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < kNumLitStates ? 0 : 3; + prob = p + LenCoder; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG0 + state; + IfBit0(prob) + { + UpdateBit0(prob); + prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + #ifdef _LZMA_OUT_READ + UInt32 pos; + #endif + UpdateBit0(prob); + + #ifdef _LZMA_OUT_READ + if (distanceLimit == 0) + #else + if (nowPos == 0) + #endif + return LZMA_RESULT_DATA_ERROR; + + state = state < kNumLitStates ? 9 : 11; + #ifdef _LZMA_OUT_READ + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + #endif + + continue; + } + else + { + UpdateBit1(prob); + } + } + else + { + UInt32 distance; + UpdateBit1(prob); + prob = p + IsRepG1 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep1; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG2 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep2; + } + else + { + UpdateBit1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = p + RepLenCoder; + } + { + int numBits, offset; + CProb *probLen = prob + LenChoice; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + numBits = kLenNumLowBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenChoice2; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + numBits = kLenNumMidBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + numBits = kLenNumHighBits; + } + } + RangeDecoderBitTreeDecode(probLen, numBits, len); + len += offset; + } + + if (state < 4) + { + int posSlot; + state += kNumLitStates; + prob = p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = (2 | ((UInt32)posSlot & 1)); + if (posSlot < kEndPosModelIndex) + { + rep0 <<= numDirectBits; + prob = p + SpecPos + rep0 - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + RC_NORMALIZE + Range >>= 1; + rep0 <<= 1; + if (Code >= Range) + { + Code -= Range; + rep0 |= 1; + } + } + while (--numDirectBits != 0); + prob = p + Align; + rep0 <<= kNumAlignBits; + numDirectBits = kNumAlignBits; + } + { + int i = 1; + int mi = 1; + do + { + CProb *prob3 = prob + mi; + RC_GET_BIT2(prob3, mi, ; , rep0 |= i); + i <<= 1; + } + while(--numDirectBits != 0); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + #ifdef _LZMA_OUT_READ + if (rep0 > distanceLimit) + #else + if (rep0 > nowPos) + #endif + return LZMA_RESULT_DATA_ERROR; + + #ifdef _LZMA_OUT_READ + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + #endif + + do + { + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + RC_NORMALIZE; + + #ifdef _LZMA_OUT_READ + vs->Range = Range; + vs->Code = Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = globalPos + (UInt32)nowPos; + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + #endif + + #ifdef _LZMA_IN_CB + vs->Buffer = Buffer; + vs->BufferLim = BufferLim; + #else + *inSizeProcessed = (SizeT)(Buffer - inStream); + #endif + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} diff --git a/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h b/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h new file mode 100644 index 000000000..2870eeb9c --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h @@ -0,0 +1,113 @@ +/* + LzmaDecode.h + LZMA Decoder interface + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#ifndef __LZMADECODE_H +#define __LZMADECODE_H + +#include "LzmaTypes.h" + +/* #define _LZMA_IN_CB */ +/* Use callback for input data */ + +/* #define _LZMA_OUT_READ */ +/* Use read function for output data */ + +/* #define _LZMA_PROB32 */ +/* It can increase speed on some 32-bit CPUs, + but memory usage will be doubled in that case */ + +/* #define _LZMA_LOC_OPT */ +/* Enable local speed optimizations inside code */ + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb UInt16 +#endif + +#define LZMA_RESULT_OK 0 +#define LZMA_RESULT_DATA_ERROR 1 + +#ifdef _LZMA_IN_CB +typedef struct _ILzmaInCallback +{ + int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); +} ILzmaInCallback; +#endif + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LZMA_PROPERTIES_SIZE 5 + +typedef struct _CLzmaProperties +{ + int lc; + int lp; + int pb; + #ifdef _LZMA_OUT_READ + UInt32 DictionarySize; + #endif +}CLzmaProperties; + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); + +#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) + +#define kLzmaNeedInitId (-2) + +typedef struct _CLzmaDecoderState +{ + CLzmaProperties Properties; + CProb *Probs; + + #ifdef _LZMA_IN_CB + const unsigned char *Buffer; + const unsigned char *BufferLim; + #endif + + #ifdef _LZMA_OUT_READ + unsigned char *Dictionary; + UInt32 Range; + UInt32 Code; + UInt32 DictionaryPos; + UInt32 GlobalPos; + UInt32 DistanceLimit; + UInt32 Reps[4]; + int State; + int RemainLen; + unsigned char TempDictionary[4]; + #endif +} CLzmaDecoderState; + +#ifdef _LZMA_OUT_READ +#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } +#endif + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *inCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); + +#endif diff --git a/target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h b/target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h new file mode 100644 index 000000000..9c2729075 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h @@ -0,0 +1,45 @@ +/* +LzmaTypes.h + +Types for LZMA Decoder + +This file written and distributed to public domain by Igor Pavlov. +This file is part of LZMA SDK 4.40 (2006-05-01) +*/ + +#ifndef __LZMATYPES_H +#define __LZMATYPES_H + +#ifndef _7ZIP_BYTE_DEFINED +#define _7ZIP_BYTE_DEFINED +typedef unsigned char Byte; +#endif + +#ifndef _7ZIP_UINT16_DEFINED +#define _7ZIP_UINT16_DEFINED +typedef unsigned short UInt16; +#endif + +#ifndef _7ZIP_UINT32_DEFINED +#define _7ZIP_UINT32_DEFINED +#ifdef _LZMA_UINT32_IS_ULONG +typedef unsigned long UInt32; +#else +typedef unsigned int UInt32; +#endif +#endif + +/* #define _LZMA_NO_SYSTEM_SIZE_T */ +/* You can use it, if you don't want */ + +#ifndef _7ZIP_SIZET_DEFINED +#define _7ZIP_SIZET_DEFINED +#ifdef _LZMA_NO_SYSTEM_SIZE_T +typedef UInt32 SizeT; +#else +#include +typedef size_t SizeT; +#endif +#endif + +#endif diff --git a/target/linux/adm5120/image/lzma-loader/src/Makefile b/target/linux/adm5120/image/lzma-loader/src/Makefile new file mode 100644 index 000000000..f23d040cd --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/Makefile @@ -0,0 +1,99 @@ +# +# Makefile for Broadcom BCM947XX boards +# +# Copyright 2001-2003, Broadcom Corporation +# All Rights Reserved. +# +# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY +# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM +# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. +# +# Copyright 2004 Manuel Novoa III +# Modified to support bzip'd kernels. +# Of course, it would be better to integrate bunzip capability into CFE. +# +# Copyright 2005 Oleg I. Vdovikin +# Cleaned up, modified for lzma support, removed from kernel +# +# Copyright 2007 Gabor Juhos +# Modified to support user defined entry point address. +# Added support for make targets with different names +# + +LOADADDR := 0x80001000 +LZMA_TEXT_START := 0x80500000 +LZMA_STARTUP_ORG:= 0 +LOADER_DATA := +CONFIG_PASS_KARGS := +CONFIG_BOARD := + +CC := $(CROSS_COMPILE)gcc +LD := $(CROSS_COMPILE)ld +OBJCOPY := $(CROSS_COMPILE)objcopy +OBJDUMP := $(CROSS_COMPILE)objdump + +BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug -S + +CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ + -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \ + -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding \ + -fhonour-copts \ + -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap +CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_PROB32 + +ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG) + +LDFLAGS = -static --gc-sections -no-warn-mismatch +LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START) + +O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32) + +OBJECTS := head.o decompress.o board.o printf.o LzmaDecode.o + +ifneq ($(strip $(LOADER_DATA)),) +OBJECTS += data.o +CFLAGS += -DLZMA_WRAPPER=1 +else +CFLAGS += -D_LZMA_IN_CB +endif + +ifneq ($(strip $(CONFIG_PASS_KARGS)),) +CFLAGS += -DCONFIG_PASS_KARGS +endif + +BOARD_DEF := $(strip $(CONFIG_BOARD)) +BOARD_DEF := $(shell echo $(BOARD_DEF) | tr a-z A-Z | tr -d -) +ifneq ($(BOARD_DEF),) +CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF) +endif + +all: loader.bin + +# Don't build dependencies, this may die if $(CC) isn't gcc +dep: + +install: + +%.o : %.c + $(CC) $(CFLAGS) -c -o $@ $< + +%.o : %.S + $(CC) $(ASFLAGS) -c -o $@ $< + +data.o: $(LOADER_DATA) + $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $< + +loader.bin: loader.elf + $(OBJCOPY) $(BIN_FLAGS) $< $@ + +loader.elf: $(OBJECTS) + $(LD) $(LDFLAGS) -o $@ $(OBJECTS) + +mrproper: clean + +clean: + rm -f *.elf *.bin *.o + + + diff --git a/target/linux/adm5120/image/lzma-loader/src/README b/target/linux/adm5120/image/lzma-loader/src/README new file mode 100644 index 000000000..16649e950 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/README @@ -0,0 +1,55 @@ +/* + * LZMA compressed kernel decompressor for bcm947xx boards + * + * Copyright (C) 2005 by Oleg I. Vdovikin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +The code is intended to decompress kernel, being compressed using lzma utility +build using 7zip LZMA SDK. This utility is located in the LZMA_Alone directory + +decompressor code expects that your .trx file consist of three partitions: + +1) decompressor itself (this is gziped code which pmon/cfe will extract and run +on boot-up instead of real kernel) +2) LZMA compressed kernel (both streamed and regular modes are supported now) +3) Root filesystem + +Please be sure to apply the following patch for use this new trx layout (it will +allow using both new and old trx files for root filesystem lookup code) + +--- linuz/arch/mips/brcm-boards/bcm947xx/setup.c 2005-01-23 19:24:27.503322896 +0300 ++++ linux/arch/mips/brcm-boards/bcm947xx/setup.c 2005-01-23 19:29:05.237100944 +0300 +@@ -221,7 +221,9 @@ + /* Try looking at TRX header for rootfs offset */ + if (le32_to_cpu(trx->magic) == TRX_MAGIC) { + bcm947xx_parts[1].offset = off; +- if (le32_to_cpu(trx->offsets[1]) > off) ++ if (le32_to_cpu(trx->offsets[2]) > off) ++ off = le32_to_cpu(trx->offsets[2]); ++ else if (le32_to_cpu(trx->offsets[1]) > off) + off = le32_to_cpu(trx->offsets[1]); + continue; + } + + +Revision history: + 0.02 Initial release + 0.03 Added Mineharu Takahara patch to pass actual + output size to decoder (stream mode compressed input is not + a requirement anymore) + 0.04 Reordered functions using lds script diff --git a/target/linux/adm5120/image/lzma-loader/src/board.c b/target/linux/adm5120/image/lzma-loader/src/board.c new file mode 100644 index 000000000..5ebdbc3b1 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/board.c @@ -0,0 +1,185 @@ +/* + * ADM5120 specific board support for LZMA decompressor + * + * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include + +#define READREG(r) *(volatile unsigned int *)(r) +#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v + +/* + * INTC definitions + */ +#define INTC_BASE 0xB2200000 + +/* INTC registers */ +#define INTC_REG_IRQ_DISABLE 0x0C + +/* + * UART definitions + */ +#define UART0_BASE 0xB2600000 +#define UART1_BASE 0xB2800000 +/* UART registers */ +#define UART_REG_DATA 0x00 /* Data register */ +#define UART_REG_ECR 0x04 /* Error Clear register */ +#define UART_REG_LCRH 0x08 /* Line Control High register */ +#define UART_REG_LCRM 0x0C /* Line Control Middle register */ +#define UART_REG_LCRL 0x10 /* Line Control Low register */ +#define UART_REG_CTRL 0x14 /* Control register */ +#define UART_REG_FLAG 0x18 /* Flag register */ + +/* Control register bits */ +#define UART_CTRL_EN ( 1 << 0 ) /* UART enable */ + +/* Line Control High register bits */ +#define UART_LCRH_FEN ( 1 << 4 ) /* FIFO enable */ + +/* Flag register bits */ +#define UART_FLAG_CTS ( 1 << 0 ) +#define UART_FLAG_DSR ( 1 << 1 ) +#define UART_FLAG_DCD ( 1 << 2 ) +#define UART_FLAG_BUSY ( 1 << 3 ) +#define UART_FLAG_RXFE ( 1 << 4 ) /* RX FIFO empty */ +#define UART_FLAG_TXFF ( 1 << 5 ) /* TX FIFO full */ +#define UART_FLAG_RXFF ( 1 << 6 ) /* RX FIFO full */ +#define UART_FLAG_TXFE ( 1 << 7 ) /* TX FIFO empty */ + +/* + * SWITCH definitions + */ +#define SWITCH_BASE 0xB2000000 + +#define SWITCH_REG_CPUP_CONF 0x0024 +#define SWITCH_REG_PORT_CONF0 0x0028 + +#define SWITCH_REG_GPIO_CONF0 0x00B8 +#define SWITCH_REG_GPIO_CONF2 0x00BC + +#define SWITCH_REG_PORT0_LED 0x0100 +#define SWITCH_REG_PORT1_LED 0x0104 +#define SWITCH_REG_PORT2_LED 0x0108 +#define SWITCH_REG_PORT3_LED 0x010C +#define SWITCH_REG_PORT4_LED 0x0110 + +#define SWITCH_PORTS_HW 0x3F /* Hardware Ports */ + +/* CPUP_CONF register bits */ +#define CPUP_CONF_DCPUP ( 1 << 0 ) /* Disable CPU port */ + +/* PORT_CONF0 register bits */ +#define PORT_CONF0_DP_SHIFT 0 /* disable port shift*/ + + +/* + * UART routines + */ + +#if defined(CONFIG_USE_UART0) +# define UART_READ(r) READREG(UART0_BASE+(r)) +# define UART_WRITE(r,v) WRITEREG(UART0_BASE+(r),(v)) +#else +# define UART_READ(r) READREG(UART1_BASE+(r)) +# define UART_WRITE(r,v) WRITEREG(UART1_BASE+(r),(v)) +#endif + +static void uart_init(void) +{ +#if 0 + unsigned int t; + + /* disable uart */ + UART_WRITE(UART_REG_CTRL, 0); + + /* keep current baud rate */ + t = UART_READ(UART_REG_LCRM); + UART_WRITE(UART_REG_LCRM, t); + t = UART_READ(UART_REG_LCRL); + UART_WRITE(UART_REG_LCRL, t); + + /* keep data, stop, and parity bits, but disable FIFO */ + t = UART_READ(UART_REG_LCRH); + t &= ~(UART_LCRH_FEN); + UART_WRITE(UART_REG_LCRH, t ); + + /* clear error bits */ + UART_WRITE(UART_REG_ECR, 0xFF); + + /* enable uart, and disable interrupts */ + UART_WRITE(UART_REG_CTRL, UART_CTRL_EN); +#endif +} + +/* + * INTC routines + */ + +#define INTC_READ(r) READREG(INTC_BASE+(r)) +#define INTC_WRITE(r,v) WRITEREG(INTC_BASE+(r),v) + +static void intc_init(void) +{ + INTC_WRITE(INTC_REG_IRQ_DISABLE, 0xFFFFFFFF); +} + +/* + * SWITCH routines + */ + +#define SWITCH_READ(r) READREG(SWITCH_BASE+(r)) +#define SWITCH_WRITE(r,v) WRITEREG(SWITCH_BASE+(r),v) + +static void switch_init(void) +{ + /* disable PHYS ports */ + SWITCH_WRITE(SWITCH_REG_PORT_CONF0, + (SWITCH_PORTS_HW << PORT_CONF0_DP_SHIFT)); + + /* disable CPU port */ + SWITCH_WRITE(SWITCH_REG_CPUP_CONF, CPUP_CONF_DCPUP); + + /* disable GPIO lines */ + SWITCH_WRITE(SWITCH_REG_GPIO_CONF0, 0); + SWITCH_WRITE(SWITCH_REG_GPIO_CONF2, 0); + + /* disable LED lines */ + SWITCH_WRITE(SWITCH_REG_PORT0_LED, 0); + SWITCH_WRITE(SWITCH_REG_PORT1_LED, 0); + SWITCH_WRITE(SWITCH_REG_PORT2_LED, 0); + SWITCH_WRITE(SWITCH_REG_PORT3_LED, 0); + SWITCH_WRITE(SWITCH_REG_PORT4_LED, 0); +} + +void board_putc(int ch) +{ + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); + + UART_WRITE(UART_REG_DATA, ch); + + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); +} + +void board_init(void) +{ + intc_init(); + switch_init(); + uart_init(); +} diff --git a/target/linux/adm5120/image/lzma-loader/src/config.h b/target/linux/adm5120/image/lzma-loader/src/config.h new file mode 100644 index 000000000..e5511d16f --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/config.h @@ -0,0 +1,143 @@ +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + +#define FLASH_2M (2<<20) +#define FLASH_4M (4<<20) + +/* + * Cellvision/SparkLAN boards + */ + +#if defined(CONFIG_BOARD_CAS630) +# define CONFIG_BOARD_NAME "CAS-630" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_CAS670) +# define CONFIG_BOARD_NAME "CAS-670" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_CAS700) +# define CONFIG_BOARD_NAME "CAS-700" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_CAS790) +# define CONFIG_BOARD_NAME "CAS-790" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_CAS771) +# define CONFIG_BOARD_NAME "CAS-771" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_CAS861) +# define CONFIG_BOARD_NAME "CAS-861" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_NFS101U) +# define CONFIG_BOARD_NAME "NFS-101U" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_NFS202U) +# define CONFIG_BOARD_NAME "NFS-202U" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +/* + * Compex boards + */ +#if defined(CONFIG_BOARD_WP54GWRT) +# define CONFIG_BOARD_NAME "WP54G-WRT" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +/* + * Edimax boards + */ +#if defined(CONFIG_BOARD_BR6104K) +# define CONFIG_BOARD_NAME "BR-6104K" +# define CONFIG_FLASH_SIZE FLASH_2M +#endif + +#if defined(CONFIG_BOARD_BR6104KP) +# define CONFIG_BOARD_NAME "BR-6104KP" +# define CONFIG_FLASH_SIZE FLASH_2M +#endif + +#if defined(CONFIG_BOARD_BR6104WG) +# define CONFIG_BOARD_NAME "BR-6104WG" +# define CONFIG_FLASH_SIZE FLASH_2M +#endif + +/* + * Infineon boards + */ +#if defined(CONFIG_BOARD_EASY5120PATA) +# define CONFIG_BOARD_NAME "EASY 5120P-ATA" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_EASY5120RT) +# define CONFIG_BOARD_NAME "EASY 5120-RT" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_EASY5120WVOIP) +# define CONFIG_BOARD_NAME "EASY 5120-WVOIP" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_EASY83000) +# define CONFIG_BOARD_NAME "EASY 83000" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +/* + * Motorola boards + */ +#if defined(CONFIG_BOARD_POWERLINEMUGW) +# define CONFIG_BOARD_NAME "Powerline MU Gateway" +# define CONFIG_USE_UART1 1 +#endif + +/* + * OSBRiDGE boards + */ +#if defined(CONFIG_BOARD_5GXI) +# define CONFIG_BOARD_NAME "OSBRiDGE 5GXi" +#endif + +/* + * ZyXEL boards + */ +#if defined(CONFIG_BOARD_P334WT) +# define CONFIG_BOARD_NAME "P-334WT" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +#if defined(CONFIG_BOARD_P335) +# define CONFIG_BOARD_NAME "P-335" +# define CONFIG_FLASH_SIZE FLASH_4M +#endif + +/* + * Default values + */ +#ifndef CONFIG_BOARD_NAME +# define CONFIG_BOARD_NAME "ADM5120" +#endif + +#ifndef CONFIG_FLASH_SIZE +# define CONFIG_FLASH_SIZE FLASH_2M +#endif + +#if !defined(CONFIG_USE_UART0) && !defined(CONFIG_USE_UART1) +# define CONFIG_USE_UART0 +#endif + +#endif /* _CONFIG_H_ */ diff --git a/target/linux/adm5120/image/lzma-loader/src/decompress.c b/target/linux/adm5120/image/lzma-loader/src/decompress.c new file mode 100644 index 000000000..cd4b8fa60 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/decompress.c @@ -0,0 +1,353 @@ +/* + * + * LZMA compressed kernel decompressor for ADM5120 boards + * + * Copyright (C) 2005 by Oleg I. Vdovikin + * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * Please note, this was code based on the bunzip2 decompressor code + * by Manuel Novoa III (mjn3@codepoet.org), although the only thing left + * is an idea and part of original vendor code + * + * + * 12-Mar-2005 Mineharu Takahara + * pass actual output size to decoder (stream mode + * compressed input is not a requirement anymore) + * + * 24-Apr-2005 Oleg I. Vdovikin + * reordered functions using lds script, removed forward decl + * + * 24-Mar-2007 Gabor Juhos + * pass original values of the a0,a1,a2,a3 registers to the kernel + * + * 19-May-2007 Gabor Juhos + * endiannes related cleanups + * add support for decompressing an embedded kernel + * + */ + +#include + +#include "config.h" +#include "printf.h" +#include "LzmaDecode.h" + +#define ADM5120_FLASH_START 0x1fc00000 /* Flash start */ +#define ADM5120_FLASH_END 0x1fe00000 /* Flash end */ + +#define KSEG0 0x80000000 +#define KSEG1 0xa0000000 + +#define KSEG1ADDR(a) ((((unsigned)(a)) & 0x1fffffffU) | KSEG1) + +#define Index_Invalidate_I 0x00 +#define Index_Writeback_Inv_D 0x01 + +#define cache_unroll(base,op) \ + __asm__ __volatile__( \ + ".set noreorder;\n" \ + ".set mips3;\n" \ + "cache %1, (%0);\n" \ + ".set mips0;\n" \ + ".set reorder\n" \ + : \ + : "r" (base), \ + "i" (op)); + +#ifdef LZMA_DEBUG +# define DBG(f, a...) printf(f, ## a) +#else +# define DBG(f, a...) do {} while (0) +#endif + +static __inline__ void blast_icache(unsigned long size, unsigned long lsize) +{ + unsigned long start = KSEG0; + unsigned long end = (start + size); + + while(start < end) { + cache_unroll(start,Index_Invalidate_I); + start += lsize; + } +} + +static __inline__ void blast_dcache(unsigned long size, unsigned long lsize) +{ + unsigned long start = KSEG0; + unsigned long end = (start + size); + + while(start < end) { + cache_unroll(start,Index_Writeback_Inv_D); + start += lsize; + } +} + +#define TRX_MAGIC 0x30524448 /* "HDR0" */ +#define TRX_ALIGN 0x1000 + +struct trx_header { + unsigned int magic; /* "HDR0" */ + unsigned int len; /* Length of file including header */ + unsigned int crc32; /* 32-bit CRC from flag_version to end of file */ + unsigned int flag_version; /* 0:15 flags, 16:31 version */ + unsigned int offsets[3]; /* Offsets of partitions from start of header */ +}; + +struct env_var { + char *name; + char *value; +}; + +/* beyound the image end, size not known in advance */ +extern unsigned char workspace[]; +extern void board_init(void); + +static CLzmaDecoderState lzma_state; + +typedef void (*kernel_entry)(unsigned long reg_a0, unsigned long reg_a1, + unsigned long reg_a2, unsigned long reg_a3); + +static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream, + UInt32 outSize); + +#ifdef CONFIG_PASS_KARGS +#define ENVV(n,v) {.name = (n), .value = (v)} +struct env_var env_vars[] = { + ENVV("board_name", CONFIG_BOARD_NAME), + ENVV(NULL, NULL) +}; +#endif + +static void halt(void) +{ + printf("\nSystem halted!\n"); + for(;;); +} + +#if (LZMA_WRAPPER) +extern unsigned char _lzma_data_start[]; +extern unsigned char _lzma_data_end[]; + +unsigned char *data; +unsigned long datalen; + +static __inline__ unsigned char get_byte(void) +{ + datalen--; + return *data++; +} + +static void decompress_init(void) +{ + data = _lzma_data_start; + datalen = _lzma_data_end - _lzma_data_start; +} + +static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream, + SizeT outSize) +{ + SizeT ip, op; + + return LzmaDecode(vs, data, datalen, &ip, outStream, outSize, &op); +} +#endif /* LZMA_WRAPPER */ + +#if !(LZMA_WRAPPER) + +#define FLASH_BANK_SIZE (2<<20) + +static unsigned char *flash_base = (unsigned char *) KSEG1ADDR(ADM5120_FLASH_START); +static unsigned long flash_ofs = 0; +static unsigned long flash_max = 0; +static unsigned long flash_ofs_mask = (FLASH_BANK_SIZE-1); + +static __inline__ unsigned char get_byte(void) +{ + return *(flash_base+flash_ofs++); +} + +static int lzma_read_byte(void *object, const unsigned char **buffer, + SizeT *bufferSize) +{ + unsigned long len; + + if (flash_ofs >= flash_max) + return LZMA_RESULT_DATA_ERROR; + + len = flash_max-flash_ofs; + +#if (CONFIG_FLASH_SIZE > FLASH_BANK_SIZE) + if (flash_ofs < FLASH_BANK_SIZE) { + /* switch to bank 0 */ + DBG("lzma_read_byte: switch to bank 0\n"); + + if (len > FLASH_BANK_SIZE-flash_ofs) + len = FLASH_BANK_SIZE-flash_ofs; + } else { + /* switch to bank 1 */ + DBG("lzma_read_byte: switch to bank 1\n"); + } +#endif + DBG("lzma_read_byte: ofs=%08X, len=%08X\n", flash_ofs, len); + + *buffer = flash_base+(flash_ofs & flash_ofs_mask); + *bufferSize = len; + flash_ofs += len; + + return LZMA_RESULT_OK; +} + +static ILzmaInCallback lzma_callback = { + .Read = lzma_read_byte, +}; + +static __inline__ unsigned int read_le32(void *buf) +{ + unsigned char *p = buf; + + return ((unsigned int)p[0] + ((unsigned int)p[1] << 8) + + ((unsigned int)p[2] << 16) +((unsigned int)p[3] << 24)); +} + +static void decompress_init(void) +{ + struct trx_header *hdr = NULL; + unsigned long kofs,klen; + + printf("Looking for TRX header... "); + /* look for trx header, 32-bit data access */ + for (flash_ofs = 0; flash_ofs < FLASH_BANK_SIZE; flash_ofs += TRX_ALIGN) { + if (read_le32(&flash_base[flash_ofs]) == TRX_MAGIC) { + hdr = (struct trx_header *)&flash_base[flash_ofs]; + break; + } + } + + if (hdr == NULL) { + printf("not found!\n"); + /* no compressed kernel found, halting */ + halt(); + } + + /* compressed kernel is in the partition 0 or 1 */ + kofs = read_le32(&hdr->offsets[1]); + if (kofs == 0 || kofs > 65536) { + klen = kofs-read_le32(&hdr->offsets[0]); + kofs = read_le32(&hdr->offsets[0]); + } else { + klen = read_le32(&hdr->offsets[2]); + if (klen > kofs) + klen -= kofs; + else + klen = read_le32(&hdr->len)-kofs; + } + + printf("found at %08X, kernel:%08X len:%08X\n", flash_ofs, + kofs, klen); + + flash_ofs += kofs; + flash_max = flash_ofs+klen; +} + +static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream, + SizeT outSize) +{ + SizeT op; + +#if 0 + vs->Buffer = data; + vs->BufferLim = datalen; +#endif + + return LzmaDecode(vs, &lzma_callback, outStream, outSize, &op); +} +#endif /* !(LZMA_WRAPPER) */ + +/* should be the first function */ +void decompress_entry(unsigned long reg_a0, unsigned long reg_a1, + unsigned long reg_a2, unsigned long reg_a3, + unsigned long icache_size, unsigned long icache_lsize, + unsigned long dcache_size, unsigned long dcache_lsize) +{ + unsigned char props[LZMA_PROPERTIES_SIZE]; + unsigned int i; /* temp value */ + SizeT osize; /* uncompressed size */ + int res; + + board_init(); + + printf("\n\nLZMA loader for " CONFIG_BOARD_NAME + ", Copyright (C) 2007-2008 OpenWrt.org\n\n"); + + decompress_init(); + + /* lzma args */ + for (i = 0; i < LZMA_PROPERTIES_SIZE; i++) + props[i] = get_byte(); + + /* skip rest of the LZMA coder property */ + /* read the lower half of uncompressed size in the header */ + osize = ((SizeT)get_byte()) + + ((SizeT)get_byte() << 8) + + ((SizeT)get_byte() << 16) + + ((SizeT)get_byte() << 24); + + /* skip rest of the header (upper half of uncompressed size) */ + for (i = 0; i < 4; i++) + get_byte(); + + res = LzmaDecodeProperties(&lzma_state.Properties, props, + LZMA_PROPERTIES_SIZE); + if (res != LZMA_RESULT_OK) { + printf("Incorrect LZMA stream properties!\n"); + halt(); + } + + printf("decompressing kernel... "); + + lzma_state.Probs = (CProb *)workspace; + res = decompress_data(&lzma_state, (unsigned char *)LOADADDR, osize); + + if (res != LZMA_RESULT_OK) { + printf("failed, "); + switch (res) { + case LZMA_RESULT_DATA_ERROR: + printf("data error!\n"); + break; + default: + printf("unknown error %d!\n", res); + } + halt(); + } else + printf("done!\n"); + + blast_dcache(dcache_size, dcache_lsize); + blast_icache(icache_size, icache_lsize); + + printf("launching kernel...\n\n"); + +#ifdef CONFIG_PASS_KARGS + reg_a0 = 0; + reg_a1 = 0; + reg_a2 = (unsigned long)env_vars; + reg_a3 = 0; +#endif + /* Jump to load address */ + ((kernel_entry) LOADADDR)(reg_a0, reg_a1, reg_a2, reg_a3); +} diff --git a/target/linux/adm5120/image/lzma-loader/src/head.S b/target/linux/adm5120/image/lzma-loader/src/head.S new file mode 100644 index 000000000..9f82fabdc --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/head.S @@ -0,0 +1,209 @@ +/* Copyright 2007 Gabor Juhos */ +/* keep original values of the a0,a1,a2,a3 registers */ +/* modifed to support user defined entry point address */ +/* Copyright 2005 Oleg I. Vdovikin (oleg@cs.msu.su) */ +/* cache manipulation adapted from Broadcom code */ +/* idea taken from original bunzip2 decompressor code */ +/* Copyright 2004 Manuel Novoa III (mjn3@codepoet.org) */ +/* Licensed under the linux kernel's version of the GPL.*/ + +#include +#include + +#define KSEG0 0x80000000 + +#define C0_STATUS $12 +#define C0_CAUSE $13 +#define C0_CONFIG $16 +#define C0_WATCHLO $18 +#define C0_WATCHHI $19 +#define C0_TAGLO $28 +#define C0_TAGHI $29 + +#define CONF1_DA_SHIFT 7 /* D$ associativity */ +#define CONF1_DA_MASK 0x00000380 +#define CONF1_DA_BASE 1 +#define CONF1_DL_SHIFT 10 /* D$ line size */ +#define CONF1_DL_MASK 0x00001c00 +#define CONF1_DL_BASE 2 +#define CONF1_DS_SHIFT 13 /* D$ sets/way */ +#define CONF1_DS_MASK 0x0000e000 +#define CONF1_DS_BASE 64 +#define CONF1_IA_SHIFT 16 /* I$ associativity */ +#define CONF1_IA_MASK 0x00070000 +#define CONF1_IA_BASE 1 +#define CONF1_IL_SHIFT 19 /* I$ line size */ +#define CONF1_IL_MASK 0x00380000 +#define CONF1_IL_BASE 2 +#define CONF1_IS_SHIFT 22 /* Instruction cache sets/way */ +#define CONF1_IS_MASK 0x01c00000 +#define CONF1_IS_BASE 64 + +#define Index_Invalidate_I 0x00 +#define Index_Writeback_Inv_D 0x01 + + .text + +#if (LZMA_STARTUP_ORG) + .set noreorder + + b startup + nop + + .org LZMA_STARTUP_ORG +#endif + +LEAF(startup) + .set noreorder + .set mips32 + + mtc0 zero, C0_WATCHLO # clear watch registers + mtc0 zero, C0_WATCHHI + + mtc0 zero, C0_CAUSE # clear before writing status register + + mfc0 t0, C0_STATUS # get status register + li t1, ~(0xFF01) + and t0, t1 # mask interrupts + mtc0 t0, C0_STATUS # set up status register + + move t1, ra # save return address + la t0, __reloc_label # get linked address of label + bal __reloc_label # branch and link to label to + nop # get actual address +__reloc_label: + subu t0, ra, t0 # get reloc_delta + move ra, t1 # restore return address + + beqz t0, __reloc_end # if delta is 0 we are in the right place + nop + + /* Copy our code to the right place */ + la t1, _code_start # get linked address of _code_start + la t2, _code_end # get linked address of _code_end + addu t0, t0, t1 # calculate actual address of _code_start + +__reloc_copy: + lw t3, 0(t0) + sw t3, 0(t1) + add t1, 4 + blt t1, t2, __reloc_copy + add t0, 4 + +__reloc_end: + + /* At this point we need to invalidate dcache and */ + /* icache before jumping to new code */ + +1: /* Get cache sizes */ + .set mips32 + mfc0 s0,C0_CONFIG,1 + .set mips0 + + li s1,CONF1_DL_MASK + and s1,s0 + beq s1,zero,nodc + nop + + srl s1,CONF1_DL_SHIFT + li t0,CONF1_DL_BASE + sll s1,t0,s1 /* s1 has D$ cache line size */ + + li s2,CONF1_DA_MASK + and s2,s0 + srl s2,CONF1_DA_SHIFT + addiu s2,CONF1_DA_BASE /* s2 now has D$ associativity */ + + li t0,CONF1_DS_MASK + and t0,s0 + srl t0,CONF1_DS_SHIFT + li s3,CONF1_DS_BASE + sll s3,s3,t0 /* s3 has D$ sets per way */ + + multu s2,s3 /* sets/way * associativity */ + mflo t0 /* total cache lines */ + + multu s1,t0 /* D$ linesize * lines */ + mflo s2 /* s2 is now D$ size in bytes */ + + /* Initilize the D$: */ + mtc0 zero,C0_TAGLO + mtc0 zero,C0_TAGHI + + li t0,KSEG0 /* Just an address for the first $ line */ + addu t1,t0,s2 /* + size of cache == end */ + + .set mips3 +1: cache Index_Writeback_Inv_D,0(t0) + .set mips0 + bne t0,t1,1b + addu t0,s1 + +nodc: + /* Now we get to do it all again for the I$ */ + + move s3,zero /* just in case there is no icache */ + move s4,zero + + li t0,CONF1_IL_MASK + and t0,s0 + beq t0,zero,noic + nop + + srl t0,CONF1_IL_SHIFT + li s3,CONF1_IL_BASE + sll s3,t0 /* s3 has I$ cache line size */ + + li t0,CONF1_IA_MASK + and t0,s0 + srl t0,CONF1_IA_SHIFT + addiu s4,t0,CONF1_IA_BASE /* s4 now has I$ associativity */ + + li t0,CONF1_IS_MASK + and t0,s0 + srl t0,CONF1_IS_SHIFT + li s5,CONF1_IS_BASE + sll s5,t0 /* s5 has I$ sets per way */ + + multu s4,s5 /* sets/way * associativity */ + mflo t0 /* s4 is now total cache lines */ + + multu s3,t0 /* I$ linesize * lines */ + mflo s4 /* s4 is cache size in bytes */ + + /* Initilize the I$: */ + mtc0 zero,C0_TAGLO + mtc0 zero,C0_TAGHI + + li t0,KSEG0 /* Just an address for the first $ line */ + addu t1,t0,s4 /* + size of cache == end */ + + .set mips3 +1: cache Index_Invalidate_I,0(t0) + .set mips0 + bne t0,t1,1b + addu t0,s3 + +noic: + /* Setup new "C" stack */ + la sp, _stack + + addiu sp, -32 /* reserve stack for parameters */ +#if 0 + sw a0, 0(sp) + sw a1, 4(sp) + sw a2, 8(sp) + sw a3, 12(sp) +#endif + sw s4, 16(sp) /* icache size */ + sw s3, 20(sp) /* icache line size */ + sw s2, 24(sp) /* dcache size */ + sw s1, 28(sp) /* dcache line size */ + + /* jump to the decompressor routine */ + la t0, decompress_entry + jr t0 + nop + + .set reorder +END(startup) diff --git a/target/linux/adm5120/image/lzma-loader/src/loader.lds b/target/linux/adm5120/image/lzma-loader/src/loader.lds new file mode 100644 index 000000000..bae70fb6e --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/loader.lds @@ -0,0 +1,29 @@ +OUTPUT_ARCH(mips) +SECTIONS { + .text : { + _code_start = .; + *(.text) + *(.text.*) + *(.rodata) + *(.rodata.*) + . = ALIGN(16); + *(.data.lzma) + } + + .data : { + *(.data) + *(.data.*) + } + _code_end = .; + + .bss : { + *(.bss) + *(.bss.*) + } + + . = ALIGN(16); + . = . + 8192; + _stack = .; + + workspace = .; +} diff --git a/target/linux/adm5120/image/lzma-loader/src/lzma-data.lds b/target/linux/adm5120/image/lzma-loader/src/lzma-data.lds new file mode 100644 index 000000000..abf756ba1 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/lzma-data.lds @@ -0,0 +1,8 @@ +OUTPUT_ARCH(mips) +SECTIONS { + .data.lzma : { + _lzma_data_start = .; + *(.data) + _lzma_data_end = .; + } +} diff --git a/target/linux/adm5120/image/lzma-loader/src/printf.c b/target/linux/adm5120/image/lzma-loader/src/printf.c new file mode 100644 index 000000000..7bb5a86e1 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/printf.c @@ -0,0 +1,350 @@ +/* + * Copyright (C) 2001 MontaVista Software Inc. + * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#include "printf.h" + +extern void board_putc(int ch); + +/* this is the maximum width for a variable */ +#define LP_MAX_BUF 256 + +/* macros */ +#define IsDigit(x) ( ((x) >= '0') && ((x) <= '9') ) +#define Ctod(x) ( (x) - '0') + +/* forward declaration */ +static int PrintChar(char *, char, int, int); +static int PrintString(char *, char *, int, int); +static int PrintNum(char *, unsigned long, int, int, int, int, char, int); + +/* private variable */ +static const char theFatalMsg[] = "fatal error in lp_Print!"; + +/* -*- + * A low level printf() function. + */ +static void +lp_Print(void (*output)(void *, char *, int), + void * arg, + char *fmt, + va_list ap) +{ + +#define OUTPUT(arg, s, l) \ + { if (((l) < 0) || ((l) > LP_MAX_BUF)) { \ + (*output)(arg, (char*)theFatalMsg, sizeof(theFatalMsg)-1); for(;;); \ + } else { \ + (*output)(arg, s, l); \ + } \ + } + + char buf[LP_MAX_BUF]; + + char c; + char *s; + long int num; + + int longFlag; + int negFlag; + int width; + int prec; + int ladjust; + char padc; + + int length; + + for(;;) { + { + /* scan for the next '%' */ + char *fmtStart = fmt; + while ( (*fmt != '\0') && (*fmt != '%')) { + fmt ++; + } + + /* flush the string found so far */ + OUTPUT(arg, fmtStart, fmt-fmtStart); + + /* are we hitting the end? */ + if (*fmt == '\0') break; + } + + /* we found a '%' */ + fmt ++; + + /* check for long */ + if (*fmt == 'l') { + longFlag = 1; + fmt ++; + } else { + longFlag = 0; + } + + /* check for other prefixes */ + width = 0; + prec = -1; + ladjust = 0; + padc = ' '; + + if (*fmt == '-') { + ladjust = 1; + fmt ++; + } + + if (*fmt == '0') { + padc = '0'; + fmt++; + } + + if (IsDigit(*fmt)) { + while (IsDigit(*fmt)) { + width = 10 * width + Ctod(*fmt++); + } + } + + if (*fmt == '.') { + fmt ++; + if (IsDigit(*fmt)) { + prec = 0; + while (IsDigit(*fmt)) { + prec = prec*10 + Ctod(*fmt++); + } + } + } + + + /* check format flag */ + negFlag = 0; + switch (*fmt) { + case 'b': + if (longFlag) { + num = va_arg(ap, long int); + } else { + num = va_arg(ap, int); + } + length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0); + OUTPUT(arg, buf, length); + break; + + case 'd': + case 'D': + if (longFlag) { + num = va_arg(ap, long int); + } else { + num = va_arg(ap, int); + } + if (num < 0) { + num = - num; + negFlag = 1; + } + length = PrintNum(buf, num, 10, negFlag, width, ladjust, padc, 0); + OUTPUT(arg, buf, length); + break; + + case 'o': + case 'O': + if (longFlag) { + num = va_arg(ap, long int); + } else { + num = va_arg(ap, int); + } + length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0); + OUTPUT(arg, buf, length); + break; + + case 'u': + case 'U': + if (longFlag) { + num = va_arg(ap, long int); + } else { + num = va_arg(ap, int); + } + length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0); + OUTPUT(arg, buf, length); + break; + + case 'x': + if (longFlag) { + num = va_arg(ap, long int); + } else { + num = va_arg(ap, int); + } + length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0); + OUTPUT(arg, buf, length); + break; + + case 'X': + if (longFlag) { + num = va_arg(ap, long int); + } else { + num = va_arg(ap, int); + } + length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1); + OUTPUT(arg, buf, length); + break; + + case 'c': + c = (char)va_arg(ap, int); + length = PrintChar(buf, c, width, ladjust); + OUTPUT(arg, buf, length); + break; + + case 's': + s = (char*)va_arg(ap, char *); + length = PrintString(buf, s, width, ladjust); + OUTPUT(arg, buf, length); + break; + + case '\0': + fmt --; + break; + + default: + /* output this char as it is */ + OUTPUT(arg, fmt, 1); + } /* switch (*fmt) */ + + fmt ++; + } /* for(;;) */ + + /* special termination call */ + OUTPUT(arg, "\0", 1); +} + + +/* --------------- local help functions --------------------- */ +static int +PrintChar(char * buf, char c, int length, int ladjust) +{ + int i; + + if (length < 1) length = 1; + if (ladjust) { + *buf = c; + for (i=1; i< length; i++) buf[i] = ' '; + } else { + for (i=0; i< length-1; i++) buf[i] = ' '; + buf[length - 1] = c; + } + return length; +} + +static int +PrintString(char * buf, char* s, int length, int ladjust) +{ + int i; + int len=0; + char* s1 = s; + while (*s1++) len++; + if (length < len) length = len; + + if (ladjust) { + for (i=0; i< len; i++) buf[i] = s[i]; + for (i=len; i< length; i++) buf[i] = ' '; + } else { + for (i=0; i< length-len; i++) buf[i] = ' '; + for (i=length-len; i < length; i++) buf[i] = s[i-length+len]; + } + return length; +} + +static int +PrintNum(char * buf, unsigned long u, int base, int negFlag, + int length, int ladjust, char padc, int upcase) +{ + /* algorithm : + * 1. prints the number from left to right in reverse form. + * 2. fill the remaining spaces with padc if length is longer than + * the actual length + * TRICKY : if left adjusted, no "0" padding. + * if negtive, insert "0" padding between "0" and number. + * 3. if (!ladjust) we reverse the whole string including paddings + * 4. otherwise we only reverse the actual string representing the num. + */ + + int actualLength =0; + char *p = buf; + int i; + + do { + int tmp = u %base; + if (tmp <= 9) { + *p++ = '0' + tmp; + } else if (upcase) { + *p++ = 'A' + tmp - 10; + } else { + *p++ = 'a' + tmp - 10; + } + u /= base; + } while (u != 0); + + if (negFlag) { + *p++ = '-'; + } + + /* figure out actual length and adjust the maximum length */ + actualLength = p - buf; + if (length < actualLength) length = actualLength; + + /* add padding */ + if (ladjust) { + padc = ' '; + } + if (negFlag && !ladjust && (padc == '0')) { + for (i = actualLength-1; i< length-1; i++) buf[i] = padc; + buf[length -1] = '-'; + } else { + for (i = actualLength; i< length; i++) buf[i] = padc; + } + + + /* prepare to reverse the string */ + { + int begin = 0; + int end; + if (ladjust) { + end = actualLength - 1; + } else { + end = length -1; + } + + while (end > begin) { + char tmp = buf[begin]; + buf[begin] = buf[end]; + buf[end] = tmp; + begin ++; + end --; + } + } + + /* adjust the string pointer */ + return length; +} + +static void printf_output(void *arg, char *s, int l) +{ + int i; + + // special termination call + if ((l==1) && (s[0] == '\0')) return; + + for (i=0; i< l; i++) { + board_putc(s[i]); + if (s[i] == '\n') board_putc('\r'); + } +} + +void printf(char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + lp_Print(printf_output, 0, fmt, ap); + va_end(ap); +} diff --git a/target/linux/adm5120/image/lzma-loader/src/printf.h b/target/linux/adm5120/image/lzma-loader/src/printf.h new file mode 100644 index 000000000..9b1c1df23 --- /dev/null +++ b/target/linux/adm5120/image/lzma-loader/src/printf.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2001 MontaVista Software Inc. + * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef _printf_h_ +#define _printf_h_ + +#include +void printf(char *fmt, ...); + +#endif /* _printf_h_ */ diff --git a/target/linux/adm5120/image/rb1xx.mk b/target/linux/adm5120/image/rb1xx.mk new file mode 100644 index 000000000..35529585a --- /dev/null +++ b/target/linux/adm5120/image/rb1xx.mk @@ -0,0 +1,24 @@ +# +# Copyright (C) 2007,2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + + +define Image/cmdline/yaffs2 + root=/dev/mtdblock3 rootfstype=yaffs2 +endef + +define Image/BuildKernel/RouterBoard + $(CP) $(KDIR)/vmlinux-initramfs.elf $(call imgname,kernel-initramfs,rb1xx) + $(STAGING_DIR_HOST)/bin/patch-cmdline $(call imgname,kernel-initramfs,rb1xx) \ + '$(strip $(call Image/cmdline/yaffs2))' +endef + +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + define Image/BuildKernel + $(call Image/BuildKernel/RouterBoard) + endef +endif + diff --git a/target/linux/adm5120/image/router_be.mk b/target/linux/adm5120/image/router_be.mk new file mode 100644 index 000000000..5a166722f --- /dev/null +++ b/target/linux/adm5120/image/router_be.mk @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007,2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Image/Build/ZyXEL + $(call Image/Build/Loader,$(2),bin,0x80500000,0,y,$(2)) + $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) + $(STAGING_DIR_HOST)/bin/mkzynfw -B $(2) \ + -b $(KDIR)/loader-$(2).bin \ + -r $(call imgname,$(1),$(2)).trx:0x10000 \ + -o $(call imgname,$(1),$(2))-webui.bin +endef + +define Image/Build/Template/ZyXEL + $(call Image/Build/ZyXEL,$(1),$(2)) +endef + +define Image/Build/Template/ZyXEL/squashfs + $(call Image/Build/Template/ZyXEL,squashfs,$(1)) +endef + +define Image/Build/Template/ZyXEL/jffs2 + $(call Image/Build/Template/ZyXEL,jffs2,$(1)) +endef + +define Image/Build/Template/ZyXEL/Initramfs + $(call Image/Build/LZMAKernel/KArgs,$(1),bin) +endef + +# +# Profiles +# +define Image/Build/Profile/P334WT + $(call Image/Build/Template/ZyXEL/$(1),p-334wt) +endef + +define Image/Build/Profile/P335WT + $(call Image/Build/Template/ZyXEL/$(1),p-335wt) +endef + +define Image/Build/Profile/Generic + $(call Image/Build/Profile/P334WT,$(1)) + $(call Image/Build/Profile/P335WT,$(1)) +endef + diff --git a/target/linux/adm5120/image/router_le.mk b/target/linux/adm5120/image/router_le.mk new file mode 100644 index 000000000..1e3d7f722 --- /dev/null +++ b/target/linux/adm5120/image/router_le.mk @@ -0,0 +1,401 @@ +# +# Copyright (C) 2007-2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define trxedimax/jffs2-128k +-a 0x20000 -f $(KDIR)/root.jffs2-128k +endef + +define trxedimax/jffs2-64k +-a 0x10000 -f $(KDIR)/root.jffs2-64k +endef + +define trxedimax/squashfs +-a 1024 -f $(KDIR)/root.squashfs +endef + +define Image/Build/TRXEdimax + $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \ + $(call trxedimax/$(2)) +endef + +define Image/Build/Compex + $(call Image/Build/Loader,$(2),gz,0x80500000,0,y,$(2)) + $(call Image/Build/TRX,$(call imgname,$(1),$(2)).trx,$(1),$(KDIR)/loader-$(2).gz) +endef + +define Image/Build/Edimax + $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2)) + $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1)) + $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d -w \ + -r $(KDIR)/loader-$(2).gz::0x1000 \ + -x $(call imgname,$(1),$(2)).trx:0x10000 \ + -x $(JFFS2MARK):0x10000 \ + $(call imgname,$(1),$(2))-webui.bin + $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \ + -r $(KDIR)/loader-$(2).gz::0x1000 \ + -x $(call imgname,$(1),$(2)).trx:0x10000 \ + -x $(JFFS2MARK):0x10000 \ + $(call imgname,$(1),$(2))-xmodem.bin + rm -f $(call imgname,$(1),$(2)).trx +endef + +define Image/Build/Osbridge + $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2)) + $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1)) + $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \ + -r $(KDIR)/loader-$(2).gz::0x1000 \ + -x $(call imgname,$(1),$(2)).trx:0x10000 \ + -x $(JFFS2MARK):0x10000 \ + $(call imgname,$(1),$(2))-firmware.bin + $(STAGING_DIR_HOST)/bin/osbridge-crc \ + -i $(call imgname,$(1),$(2))-firmware.bin \ + -o $(call imgname,$(1),$(2))-temp.bin + $(STAGING_DIR_HOST)/bin/pc1crypt \ + -i $(call imgname,$(1),$(2))-temp.bin \ + -o $(call imgname,$(1),$(2))-webui.bin + rm -f $(call imgname,$(1),$(2))-temp.bin + rm -f $(call imgname,$(1),$(2)).trx +endef + +define Image/Build/Infineon + $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2)) + $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) + dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).img bs=64k conv=sync + cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).img +endef + +define Image/Build/Cellvision + $(call Image/Build/Loader,$(2),bin,0x80500000,0x6D8,y,$(3)) + mkdir -p $(BIN_DIR)/tmp + cp $(KDIR)/loader-$(2).bin $(BIN_DIR)/tmp/vmlinux.bin + gzip -9n $(BIN_DIR)/tmp/vmlinux.bin + dd if=$(BIN_DIR)/tmp/vmlinux.bin.gz of=$(call imgname,$(1),$(2))-xmodem.bin bs=64k conv=sync + rm -rf $(BIN_DIR)/tmp + $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) + cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2))-xmodem.bin + $(STAGING_DIR_HOST)/bin/mkcasfw -B $(2) -d \ + -K $(call imgname,$(1),$(2))-xmodem.bin \ + $(call imgname,$(1),$(2))-webui.bin +endef + +define Image/Build/Cellvision2 + # only for CAS-700/771/790/861 + $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(3)) + $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) + dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).bin bs=64k conv=sync + cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).bin + echo -ne '\x14\x07\x24\x06$(2)' | dd bs=14 count=1 conv=sync >> $(call imgname,$(1),$(2)).bin + echo -ne 'OpenWrt\x00\x00\x00' >> $(call imgname,$(1),$(2)).bin +endef + +define Image/Build/MyLoader + $(call Image/Build/Loader,$(2),gz,0x80500000,0) + $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) + $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) \ + -p0x20000:0x10000:ahp:0x80001000 \ + -p0x30000:0 \ + -b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \ + -b0x30000:0::$(call imgname,$(1),$(2)).trx \ + $(call imgname,$(1),$(2)).bin +endef + +# +# Cellvision CAS-630/630W, CAS-670/670W, NFS-101U/101WU, NFS-202U/202WU +# +define Image/Build/Template/Cellvision + $(call Image/Build/Cellvision,$(1),$(2),$(3)) +endef + +define Image/Build/Template/Cellvision/squashfs + $(call Image/Build/Template/Cellvision,squashfs,$(1),$(2)) +endef + +define Image/Build/Template/Cellvision/jffs2-64k + $(call Image/Build/Template/Cellvision,jffs2-64k,$(1),$(2)) +endef + +# +# Cellvision CAS-700/700W, CAS-771/771W, CAS-790, CAS-861/861W +# +define Image/Build/Template/Cellvision2 + $(call Image/Build/Cellvision2,$(1),$(2),$(3)) +endef + +define Image/Build/Template/Cellvision2/squashfs + $(call Image/Build/Template/Cellvision2,squashfs,$(1),$(2)) +endef + +define Image/Build/Template/Cellvision2/jffs2-64k + $(call Image/Build/Template/Cellvision2,jffs2-64k,$(1),$(2)) +endef + +define Image/Build/Template/Cellvision2/Initramfs + $(call Image/Build/LZMAKernel/Cellvision,$(1),$(2),gz) +endef + +# +# Compex NP27G, NP28G, WP54G, WP54AG, WPP54G, WPP54AG +# +define Image/Build/Template/Compex + $(call Image/Build/MyLoader,$(1),$(2)) +endef + +define Image/Build/Template/Compex/squashfs + $(call Image/Build/Template/Compex,squashfs,$(1)) +endef + +define Image/Build/Template/Compex/jffs2-64k + $(call Image/Build/Template/Compex,jffs2-64k,$(1)) +endef + +define Image/Build/Template/Compex/Initramfs + $(call Image/Build/LZMAKernel/Generic,$(1),bin) +endef + +# +# Compex WP54G-WRT +# +define Image/Build/Template/WP54GWRT + $(call Image/Build/Compex,$(1),wp54g-wrt) +endef + +define Image/Build/Template/WP54GWRT/squashfs + $(call Image/Build/Template/WP54GWRT,squashfs) +endef + +define Image/Build/Template/WP54GWRT/jffs2-64k + $(call Image/Build/Template/WP54GWRT,jffs2-64k) +endef + +define Image/Build/Template/WP54GWRT/Initramfs + $(call Image/Build/LZMAKernel/KArgs,wp54g-wrt,bin) +endef + +# +# Edimax BR-6104K, BR-6104KP, BR-6104Wg, BR-6114WG +# +define Image/Build/Template/Edimax + $(call Image/Build/Edimax,$(1),$(2)) +endef + +define Image/Build/Template/Edimax/squashfs + $(call Image/Build/Template/Edimax,squashfs,$(1)) +endef + +define Image/Build/Template/Edimax/Initramfs + $(call Image/Build/LZMAKernel/Admboot,$(1),gz) +endef + +# +# Infineon EASY 5120, EASY 83000 +# +define Image/Build/Template/Infineon + $(call Image/Build/Infineon,$(1),$(2)) +endef + +define Image/Build/Template/Infineon/squashfs + $(call Image/Build/Template/Infineon,squashfs,$(1)) +endef + +define Image/Build/Template/Infineon/jffs2-64k + $(call Image/Build/Template/Infineon,jffs2-64k,$(1)) +endef + +define Image/Build/Template/Infineon/Initramfs + $(call Image/Build/LZMAKernel/Admboot,$(1),gz) +endef + +# +# Generic EB-214A +# +define Image/Build/Template/Edimax/Initramfs + $(call Image/Build/LZMAKernel/Admboot,eb-214a,bin) +endef + + +# +# Mikrotik RouterBOARD 1xx +# +define Image/Build/Template/Mikrotik/Initramfs + $(CP) $(KDIR)/vmlinux.elf $(call imgname,netboot,rb1xx) +endef + +# +# OSBRiDGE 5GXi/5XLi +# +define Image/Build/Template/Osbridge + $(call Image/Build/Osbridge,$(1),$(2)) +endef + +define Image/Build/Template/Osbridge/squashfs + $(call Image/Build/Template/Osbridge,squashfs,$(1)) +endef + +define Image/Build/Template/Osbridge/Initramfs + $(call Image/Build/LZMAKernel/Admboot,$(1),gz) +endef + +# +# Profiles +# +define Image/Build/Profile/CAS630 + $(call Image/Build/Template/Cellvision/$(1),cas-630,cas-630) +endef + +define Image/Build/Profile/CAS630W + $(call Image/Build/Template/Cellvision/$(1),cas-630w,cas-630) +endef + +define Image/Build/Profile/CAS670 + $(call Image/Build/Template/Cellvision/$(1),cas-670,cas-670) +endef + +define Image/Build/Profile/CAS670W + $(call Image/Build/Template/Cellvision/$(1),cas-670w,cas-670) +endef + +define Image/Build/Profile/NFS101U + $(call Image/Build/Template/Cellvision/$(1),nfs-101u,nfs-101u) + $(call Image/Build/Template/Cellvision/$(1),dn-7013,nfs-101u) + $(call Image/Build/Template/Cellvision/$(1),dns-120,nfs-101u) + $(call Image/Build/Template/Cellvision/$(1),mu-5000fs,nfs-101u) + $(call Image/Build/Template/Cellvision/$(1),tn-u100,nfs-101u) + $(call Image/Build/Template/Cellvision/$(1),cg-nsadp,nfs-101u) +endef + +define Image/Build/Profile/NFS101WU + $(call Image/Build/Template/Cellvision/$(1),nfs-101wu,nfs-101u) + $(call Image/Build/Template/Cellvision/$(1),dns-g120,nfs-101u) +endef + +define Image/Build/Profile/CAS700 + $(call Image/Build/Template/Cellvision2/$(1),cas-700,cas-700) +endef + +define Image/Build/Profile/CAS700W + $(call Image/Build/Template/Cellvision2/$(1),cas-700w,cas-700) +endef + +define Image/Build/Profile/CAS771 + $(call Image/Build/Template/Cellvision2/$(1),cas-771,cas-771) +endef + +define Image/Build/Profile/CAS771W + $(call Image/Build/Template/Cellvision2/$(1),cas-771w,cas-771) +endef + +define Image/Build/Profile/CAS790 + $(call Image/Build/Template/Cellvision2/$(1),cas-790,cas-790) +endef + +define Image/Build/Profile/CAS861 + $(call Image/Build/Template/Cellvision2/$(1),cas-861,cas-861) +endef + +define Image/Build/Profile/CAS861W + $(call Image/Build/Template/Cellvision2/$(1),cas-861w,cas-861) +endef + +define Image/Build/Profile/NP27G + $(call Image/Build/Template/Compex/$(1),np27g) +endef + +define Image/Build/Profile/NP28G + $(call Image/Build/Template/Compex/$(1),np28g) +endef + +define Image/Build/Profile/WP54 + $(call Image/Build/Template/Compex/$(1),wp54g) + $(call Image/Build/Template/Compex/$(1),wp54ag) + $(call Image/Build/Template/Compex/$(1),wpp54g) + $(call Image/Build/Template/Compex/$(1),wpp54ag) + $(call Image/Build/Template/WP54GWRT/$(1)) +endef + +define Image/Build/Profile/BR6104K + $(call Image/Build/Template/Edimax/$(1),br-6104k) +endef + +define Image/Build/Profile/BR6104KP + $(call Image/Build/Template/Edimax/$(1),br-6104kp) +endef + +define Image/Build/Profile/BR6104WG + $(call Image/Build/Template/Edimax/$(1),br-6104wg) +endef + +define Image/Build/Profile/BR6114WG + $(call Image/Build/Template/Edimax/$(1),br-6114wg) +endef + +define Image/Build/Profile/EASY83000 + $(call Image/Build/Template/Infineon/$(1),easy-83000) +endef + +define Image/Build/Profile/EASY5120RT + $(call Image/Build/Template/Infineon/$(1),easy-5120-rt) +endef + +define Image/Build/Profile/EASY5120PATA + $(call Image/Build/Template/Infineon/$(1),easy-5120p-ata) +endef + +define Image/Build/Profile/PMUGW + $(call Image/Build/Template/Infineon/$(1),powerline-mugw) +endef + +define Image/Build/Profile/5GXI + $(call Image/Build/Template/Osbridge/$(1),5gxi) +endef + +define Image/Build/Profile/RouterBoard + $(call Image/Build/Template/Mikrotik/$(1)) +endef + +ifeq ($(CONFIG_BROKEN),y) + define Image/Build/Experimental + # Cellvison + $(call Image/Build/Profile/CAS630,$(1)) + $(call Image/Build/Profile/CAS630W,$(1)) + $(call Image/Build/Profile/CAS670,$(1)) + $(call Image/Build/Profile/CAS670W,$(1)) + $(call Image/Build/Profile/CAS700,$(1)) + $(call Image/Build/Profile/CAS700W,$(1)) + $(call Image/Build/Profile/CAS771,$(1)) + $(call Image/Build/Profile/CAS771W,$(1)) + $(call Image/Build/Profile/CAS861,$(1)) + $(call Image/Build/Profile/CAS861W,$(1)) + # Motorola + $(call Image/Build/Profile/PMUGW,$(1)) + # OSBRiDGE + $(call Image/Build/Profile/5GXI,$(1)) + endef +endif + +define Image/Build/Profile/Generic + # Cellvision + $(call Image/Build/Profile/NFS101U,$(1)) + $(call Image/Build/Profile/NFS101WU,$(1)) + # Compex + $(call Image/Build/Profile/WP54,$(1)) + $(call Image/Build/Profile/NP27G,$(1)) + $(call Image/Build/Profile/NP28G,$(1)) + # Edimax + $(call Image/Build/Profile/BR6104K,$(1)) + $(call Image/Build/Profile/BR6104KP,$(1)) + $(call Image/Build/Profile/BR6104WG,$(1)) + $(call Image/Build/Profile/BR6114WG,$(1)) + $(call Image/Build/Profile/EB214A,$(1)) + # Infineon + $(call Image/Build/Profile/EASY83000,$(1)) + $(call Image/Build/Profile/EASY5120RT,$(1)) + $(call Image/Build/Profile/EASY5120PATA,$(1)) + # Mikrotik + $(call Image/Build/Profile/RB1xx/$(1)) + + $(call Image/Build/Experimental,$(1)) +endef diff --git a/target/linux/adm5120/modules.mk b/target/linux/adm5120/modules.mk new file mode 100644 index 000000000..3ad454073 --- /dev/null +++ b/target/linux/adm5120/modules.mk @@ -0,0 +1,56 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define KernelPackage/ledtrig-adm5120-switch + SUBMENU:=$(OTHER_MENU) + TITLE:=LED ADM5120 Switch Port Status Trigger + DEPENDS:=@TARGET_adm5120 + KCONFIG:=CONFIG_LEDS_TRIGGER_ADM5120_SWITCH + FILES:=$(LINUX_DIR)/drivers/leds/ledtrig-adm5120-switch.ko + AUTOLOAD:=$(call AutoLoad,50,ledtrig-adm5120-switch) +endef + +define KernelPackage/ledtrig-adm5120-switch/description + Kernel module to allow LEDs to be controlled by the port states + of the ADM5120 built-in ethernet switch. +endef + +$(eval $(call KernelPackage,ledtrig-adm5120-switch)) + + +define KernelPackage/pata-rb153-cf + SUBMENU:=$(BLOCK_MENU) + TITLE:=RouterBOARD 153 CF Slot support + DEPENDS:=@TARGET_adm5120_rb1xx + KCONFIG:=CONFIG_PATA_RB153_CF + FILES:=$(LINUX_DIR)/drivers/ata/pata_rb153_cf.ko + AUTOLOAD:=$(call AutoLoad,30,pata_rb153_cf,1) + $(call AddDepends/ata) +endef + +define KernelPackage/pata-rb153-cf/description + Kernel support for the RouterBoard 153 CF slot. +endef + +$(eval $(call KernelPackage,pata-rb153-cf,1)) + + +define KernelPackage/usb-adm5120 + SUBMENU:=$(USB_MENU) + TITLE:=Support for the ADM5120 HCD controller + DEPENDS:=@TARGET_adm5120 + KCONFIG:=CONFIG_USB_ADM5120_HCD + FILES:=$(LINUX_DIR)/drivers/usb/host/adm5120-hcd.ko + AUTOLOAD:=$(call AutoLoad,50,adm5120-hcd,1) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-adm5120/description + Kernel support for the ADM5120 HCD USB controller +endef + +$(eval $(call KernelPackage,usb-adm5120)) diff --git a/target/linux/adm5120/patches-3.18/001-adm5120.patch b/target/linux/adm5120/patches-3.18/001-adm5120.patch new file mode 100644 index 000000000..3e0e3ff8a --- /dev/null +++ b/target/linux/adm5120/patches-3.18/001-adm5120.patch @@ -0,0 +1,44 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -60,6 +60,24 @@ choice + prompt "System type" + default SGI_IP22 + ++config ADM5120 ++ bool "Infineon/ADMtek ADM5120 SoC based machines" ++ select BOOT_RAW ++ select NO_EXCEPT_FILL ++ select CEVT_R4K ++ select CSRC_R4K ++ select SYS_HAS_CPU_MIPS32_R1 ++ select SYS_HAS_EARLY_PRINTK ++ select DMA_NONCOHERENT ++ select IRQ_CPU ++ select SYS_SUPPORTS_LITTLE_ENDIAN ++ select SYS_SUPPORTS_BIG_ENDIAN ++ select SYS_SUPPORTS_32BIT_KERNEL ++ select ARCH_REQUIRE_GPIOLIB ++ select SWAP_IO_SPACE if CPU_BIG_ENDIAN ++ select MIPS_MACHINE ++ select HAVE_CLK ++ + config MIPS_ALCHEMY + bool "Alchemy processor based machines" + select 64BIT_PHYS_ADDR +@@ -834,6 +852,7 @@ config MIPS_PARAVIRT + + endchoice + ++source "arch/mips/adm5120/Kconfig" + source "arch/mips/alchemy/Kconfig" + source "arch/mips/ath79/Kconfig" + source "arch/mips/bcm47xx/Kconfig" +--- a/arch/mips/Kbuild.platforms ++++ b/arch/mips/Kbuild.platforms +@@ -1,5 +1,6 @@ + # All platforms listed in alphabetic order + ++platforms += adm5120 + platforms += alchemy + platforms += ar7 + platforms += ath79 diff --git a/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch b/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch new file mode 100644 index 000000000..8936af13e --- /dev/null +++ b/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch @@ -0,0 +1,21 @@ +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -399,4 +399,8 @@ config MTD_LATCH_ADDR + + If compiled as a module, it will be called latch-addr-flash. + ++config MTD_ADM5120 ++ tristate "Map driver for ADM5120 based boards" ++ depends on ADM5120 ++ + endmenu +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -30,6 +30,7 @@ obj-$(CONFIG_MTD_SUN_UFLASH) += sun_ufla + obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o + obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o + obj-$(CONFIG_MTD_PCI) += pci.o ++obj-$(CONFIG_MTD_ADM5120) += adm5120-flash.o + obj-$(CONFIG_MTD_IMPA7) += impa7.o + obj-$(CONFIG_MTD_UCLINUX) += uclinux.o + obj-$(CONFIG_MTD_NETtel) += nettel.o diff --git a/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch b/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch new file mode 100644 index 000000000..416488c0e --- /dev/null +++ b/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -263,6 +263,10 @@ source "drivers/net/dsa/Kconfig" + + source "drivers/net/ethernet/Kconfig" + ++config ADM5120_ENET ++ tristate "ADM5120 Ethernet switch support" ++ depends on ADM5120 ++ + source "drivers/net/fddi/Kconfig" + + source "drivers/net/hippi/Kconfig" +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile +@@ -34,6 +34,7 @@ obj-$(CONFIG_CAN) += can/ + obj-$(CONFIG_ETRAX_ETHERNET) += cris/ + obj-$(CONFIG_NET_DSA) += dsa/ + obj-$(CONFIG_ETHERNET) += ethernet/ ++obj-$(CONFIG_ADM5120_ENET) += adm5120sw.o + obj-$(CONFIG_FDDI) += fddi/ + obj-$(CONFIG_HIPPI) += hippi/ + obj-$(CONFIG_HAMRADIO) += hamradio/ diff --git a/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch b/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch new file mode 100644 index 000000000..139e223c0 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch @@ -0,0 +1,33 @@ +--- a/drivers/usb/Makefile ++++ b/drivers/usb/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_DWC2) += dwc2/ + obj-$(CONFIG_USB_MON) += mon/ + + obj-$(CONFIG_PCI) += host/ ++obj-$(CONFIG_USB_ADM5120_HCD) += host/ + obj-$(CONFIG_USB_EHCI_HCD) += host/ + obj-$(CONFIG_USB_ISP116X_HCD) += host/ + obj-$(CONFIG_USB_OHCI_HCD) += host/ +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -3,6 +3,10 @@ + # + comment "USB Host Controller Drivers" + ++config USB_ADM5120_HCD ++ tristate "ADM5120 HCD support (EXPERIMENTAL)" ++ depends on USB && ADM5120 && EXPERIMENTAL ++ + config USB_C67X00_HCD + tristate "Cypress C67x00 HCD support" + help +--- a/drivers/usb/host/Makefile ++++ b/drivers/usb/host/Makefile +@@ -31,6 +31,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o + obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o + obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o + ++obj-$(CONFIG_USB_ADM5120_HCD) += adm5120-hcd.o + obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o + obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o + obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o diff --git a/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch b/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch new file mode 100644 index 000000000..7a84217be --- /dev/null +++ b/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o + obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o + obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ + ops-bcm63xx.o ++obj-$(CONFIG_ADM5120) += pci-adm5120.o + obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o + obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o + obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -1821,6 +1821,9 @@ + + #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */ + ++#define PCI_VENDOR_ID_ADMTEK 0x1317 ++#define PCI_DEVICE_ID_ADMTEK_ADM5120 0x5120 ++ + #define PCI_VENDOR_ID_SIIG 0x131f + #define PCI_SUBVENDOR_ID_SIIG 0x131f + #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 diff --git a/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch b/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch new file mode 100644 index 000000000..f6dbdfc87 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch @@ -0,0 +1,22 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -508,4 +508,12 @@ config LEDS_VERSATILE + comment "LED Triggers" + source "drivers/leds/trigger/Kconfig" + ++config LEDS_TRIGGER_ADM5120_SWITCH ++ tristate "LED ADM5120 Switch Port Status Trigger" ++ depends on LEDS_TRIGGERS && ADM5120 ++ help ++ This allows LEDs to be controlled by the port states of ++ the ADM5120 built-in Ethernet Switch ++ If unsure, say N. ++ + endif # NEW_LEDS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -63,3 +63,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d + # LED Triggers + obj-$(CONFIG_LEDS_TRIGGERS) += trigger/ + obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o ++obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o diff --git a/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch b/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch new file mode 100644 index 000000000..606225936 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch @@ -0,0 +1,354 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -30,11 +30,9 @@ + #include + #include + #include +-#include + #include + + #include "mtdcore.h" +-#include "mtdsplit/mtdsplit.h" + + #define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ + +@@ -50,14 +48,13 @@ struct mtd_part { + struct list_head list; + }; + +-static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); +- + /* + * Given a pointer to the MTD object in the mtd_part structure, we can retrieve + * the pointer to that structure with this macro. + */ + #define PART(x) ((struct mtd_part *)(x)) + ++ + /* + * MTD methods which simply translate the effective address and pass through + * to the _real_ device. +@@ -521,12 +518,14 @@ static struct mtd_part *allocate_partiti + if (slave->offset == MTDPART_OFS_APPEND) + slave->offset = cur_offset; + if (slave->offset == MTDPART_OFS_NXTBLK) { +- /* Round up to next erasesize */ +- slave->offset = mtd_roundup_to_eb(cur_offset, master); +- if (slave->offset != cur_offset) ++ slave->offset = cur_offset; ++ if (mtd_mod_by_eb(cur_offset, master) != 0) { ++ /* Round up to next erasesize */ ++ slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; + printk(KERN_NOTICE "Moving partition %d: " + "0x%012llx -> 0x%012llx\n", partno, + (unsigned long long)cur_offset, (unsigned long long)slave->offset); ++ } + } + if (slave->offset == MTDPART_OFS_RETAIN) { + slave->offset = cur_offset; +@@ -627,10 +626,8 @@ out_register: + return slave; + } + +- +-static int +-__mtd_add_partition(struct mtd_info *master, const char *name, +- long long offset, long long length, bool dup_check) ++int mtd_add_partition(struct mtd_info *master, const char *name, ++ long long offset, long long length) + { + struct mtd_partition part; + struct mtd_part *p, *new; +@@ -662,24 +659,21 @@ __mtd_add_partition(struct mtd_info *mas + end = offset + length; + + mutex_lock(&mtd_partitions_mutex); +- if (dup_check) { +- list_for_each_entry(p, &mtd_partitions, list) +- if (p->master == master) { +- if ((start >= p->offset) && +- (start < (p->offset + p->mtd.size))) +- goto err_inv; +- +- if ((end >= p->offset) && +- (end < (p->offset + p->mtd.size))) +- goto err_inv; +- } +- } ++ list_for_each_entry(p, &mtd_partitions, list) ++ if (p->master == master) { ++ if ((start >= p->offset) && ++ (start < (p->offset + p->mtd.size))) ++ goto err_inv; ++ ++ if ((end >= p->offset) && ++ (end < (p->offset + p->mtd.size))) ++ goto err_inv; ++ } + + list_add(&new->list, &mtd_partitions); + mutex_unlock(&mtd_partitions_mutex); + + add_mtd_device(&new->mtd); +- mtd_partition_split(master, new); + + return ret; + err_inv: +@@ -689,12 +683,6 @@ err_inv: + } + EXPORT_SYMBOL_GPL(mtd_add_partition); + +-int mtd_add_partition(struct mtd_info *master, const char *name, +- long long offset, long long length) +-{ +- return __mtd_add_partition(master, name, offset, length, true); +-} +- + int mtd_del_partition(struct mtd_info *master, int partno) + { + struct mtd_part *slave, *next; +@@ -718,166 +706,6 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + +-static int +-run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) +-{ +- struct mtd_partition *parts; +- int nr_parts; +- int i; +- +- nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts, +- NULL); +- if (nr_parts <= 0) +- return nr_parts; +- +- if (WARN_ON(!parts)) +- return 0; +- +- for (i = 0; i < nr_parts; i++) { +- /* adjust partition offsets */ +- parts[i].offset += slave->offset; +- +- __mtd_add_partition(slave->master, +- parts[i].name, +- parts[i].offset, +- parts[i].size, +- false); +- } +- +- kfree(parts); +- +- return nr_parts; +-} +- +-static inline unsigned long +-mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) +-{ +- unsigned long mask = mtd->erasesize - 1; +- +- len += offset & mask; +- len = (len + mask) & ~mask; +- len -= offset & mask; +- return len; +-} +- +-static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) +-{ +- size_t squashfs_len; +- int len, ret; +- +- ret = mtd_get_squashfs_len(master, offset, &squashfs_len); +- if (ret) +- return ret; +- +- len = mtd_pad_erasesize(master, offset, squashfs_len); +- *split_offset = offset + len; +- +- return 0; +-} +- +-static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part) +-{ +- unsigned int split_offset = 0; +- unsigned int split_size; +- int ret; +- +- ret = split_squashfs(master, part->offset, &split_offset); +- if (ret) +- return; +- +- if (split_offset <= 0) +- return; +- +- if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT)) +- pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n"); +- else +- pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n"); +- +- split_size = part->mtd.size - (split_offset - part->offset); +- printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", +- ROOTFS_SPLIT_NAME, split_offset, split_size); +- +- __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset, +- split_size, false); +-} +- +-#define UBOOT_MAGIC 0x27051956 +- +-static void split_uimage(struct mtd_info *master, struct mtd_part *part) +-{ +- struct { +- __be32 magic; +- __be32 pad[2]; +- __be32 size; +- } hdr; +- size_t len; +- +- if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) +- return; +- +- if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) +- return; +- +- len = be32_to_cpu(hdr.size) + 0x40; +- len = mtd_pad_erasesize(master, part->offset, len); +- if (len + master->erasesize > part->mtd.size) +- return; +- +- if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW)) +- pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n"); +- else +- pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n"); +- +- __mtd_add_partition(master, "rootfs", part->offset + len, +- part->mtd.size - len, false); +-} +- +-#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME +-#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME +-#else +-#define SPLIT_FIRMWARE_NAME "unused" +-#endif +- +-static void split_firmware(struct mtd_info *master, struct mtd_part *part) +-{ +- int ret; +- +- ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); +- if (ret > 0) +- return; +- +- if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) +- split_uimage(master, part); +-} +- +-void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, +- int offset, int size) +-{ +-} +- +-static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) +-{ +- static int rootfs_found = 0; +- +- if (rootfs_found) +- return; +- +- if (!strcmp(part->mtd.name, "rootfs")) { +- int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); +- +- if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) +- split_rootfs_data(master, part); +- +- rootfs_found = 1; +- } +- +- if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && +- config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) +- split_firmware(master, part); +- +- arch_split_mtd_part(master, part->mtd.name, part->offset, +- part->mtd.size); +-} + /* + * This function, given a master MTD object and a partition table, creates + * and registers slave MTD objects which are bound to the master according to +@@ -907,7 +735,6 @@ int add_mtd_partitions(struct mtd_info * + mutex_unlock(&mtd_partitions_mutex); + + add_mtd_device(&slave->mtd); +- mtd_partition_split(master, slave); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -937,30 +764,6 @@ static struct mtd_part_parser *get_parti + + #define put_partition_parser(p) do { module_put((p)->owner); } while (0) + +-static struct mtd_part_parser * +-get_partition_parser_by_type(enum mtd_parser_type type, +- struct mtd_part_parser *start) +-{ +- struct mtd_part_parser *p, *ret = NULL; +- +- spin_lock(&part_parser_lock); +- +- p = list_prepare_entry(start, &part_parsers, list); +- if (start) +- put_partition_parser(start); +- +- list_for_each_entry_continue(p, &part_parsers, list) { +- if (p->type == type && try_module_get(p->owner)) { +- ret = p; +- break; +- } +- } +- +- spin_unlock(&part_parser_lock); +- +- return ret; +-} +- + void register_mtd_parser(struct mtd_part_parser *p) + { + spin_lock(&part_parser_lock); +@@ -1076,38 +879,6 @@ int parse_mtd_partitions(struct mtd_info + return ret; + } + +-int parse_mtd_partitions_by_type(struct mtd_info *master, +- enum mtd_parser_type type, +- struct mtd_partition **pparts, +- struct mtd_part_parser_data *data) +-{ +- struct mtd_part_parser *prev = NULL; +- int ret = 0; +- +- while (1) { +- struct mtd_part_parser *parser; +- +- parser = get_partition_parser_by_type(type, prev); +- if (!parser) +- break; +- +- ret = (*parser->parse_fn)(master, pparts, data); +- +- if (ret > 0) { +- put_partition_parser(parser); +- printk(KERN_NOTICE +- "%d %s partitions found on MTD device %s\n", +- ret, parser->name, master->name); +- break; +- } +- +- prev = parser; +- } +- +- return ret; +-} +-EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); +- + int mtd_is_partition(const struct mtd_info *mtd) + { + struct mtd_part *part; diff --git a/target/linux/adm5120/patches-3.18/100-rootfs_split.patch b/target/linux/adm5120/patches-3.18/100-rootfs_split.patch new file mode 100644 index 000000000..dfc0e83a0 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/100-rootfs_split.patch @@ -0,0 +1,316 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -52,6 +52,14 @@ config MTD_TESTS + WARNING: some of the tests will ERASE entire MTD device which they + test. Do not use these tests unless you really know what you do. + ++config MTD_ROOTFS_ROOT_DEV ++ bool "Automatically set 'rootfs' partition to be root filesystem" ++ default y ++ ++config MTD_ROOTFS_SPLIT ++ bool "Automatically split 'rootfs' partition for squashfs" ++ default y ++ + config MTD_REDBOOT_PARTS + tristate "RedBoot partition table parsing" + ---help--- +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -30,6 +30,8 @@ + #include + #include + #include ++#include ++#include + #include + + #include "mtdcore.h" +@@ -53,7 +55,7 @@ struct mtd_part { + * the pointer to that structure with this macro. + */ + #define PART(x) ((struct mtd_part *)(x)) +- ++#define IS_PART(mtd) (mtd->_read == part_read) + + /* + * MTD methods which simply translate the effective address and pass through +@@ -706,6 +708,144 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++#define ROOTFS_SPLIT_NAME "rootfs_data" ++#define ROOTFS_REMOVED_NAME "" ++ ++struct squashfs_super_block { ++ __le32 s_magic; ++ __le32 pad0[9]; ++ __le64 bytes_used; ++}; ++ ++ ++static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) ++{ ++ struct squashfs_super_block sb; ++ int len, ret; ++ ++ ret = mtd_read(master, offset, sizeof(sb), &len, (void *) &sb); ++ if (ret || (len != sizeof(sb))) { ++ printk(KERN_ALERT "split_squashfs: error occured while reading " ++ "from \"%s\"\n", master->name); ++ return -EINVAL; ++ } ++ ++ if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) { ++ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n", ++ master->name); ++ *split_offset = 0; ++ return 0; ++ } ++ ++ if (le64_to_cpu((sb.bytes_used)) <= 0) { ++ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", ++ master->name); ++ *split_offset = 0; ++ return 0; ++ } ++ ++ len = (u32) le64_to_cpu(sb.bytes_used); ++ len += (offset & 0x000fffff); ++ len += (master->erasesize - 1); ++ len &= ~(master->erasesize - 1); ++ len -= (offset & 0x000fffff); ++ *split_offset = offset + len; ++ ++ return 0; ++} ++ ++static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part) ++{ ++ struct mtd_partition dpart; ++ struct mtd_part *slave = NULL; ++ struct mtd_part *spart; ++ int ret, split_offset = 0; ++ ++ spart = PART(rpart); ++ ret = split_squashfs(master, spart->offset, &split_offset); ++ if (ret) ++ return ret; ++ ++ if (split_offset <= 0) ++ return 0; ++ ++ memcpy(&dpart, part, sizeof(dpart)); ++ dpart.name = ROOTFS_SPLIT_NAME; ++ ++ dpart.size = rpart->size - (split_offset - spart->offset); ++ dpart.offset = split_offset; ++ ++ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n", ++ ROOTFS_SPLIT_NAME, dpart.offset, dpart.size); ++ ++ slave = allocate_partition(master, &dpart, 0, split_offset); ++ if (IS_ERR(slave)) ++ return PTR_ERR(slave); ++ mutex_lock(&mtd_partitions_mutex); ++ list_add(&slave->list, &mtd_partitions); ++ mutex_unlock(&mtd_partitions_mutex); ++ ++ add_mtd_device(&slave->mtd); ++ ++ rpart->split = &slave->mtd; ++ ++ return 0; ++} ++ ++static int refresh_rootfs_split(struct mtd_info *mtd) ++{ ++ struct mtd_partition tpart; ++ struct mtd_part *part; ++ char *name; ++ //int index = 0; ++ int offset, size; ++ int ret; ++ ++ part = PART(mtd); ++ ++ /* check for the new squashfs offset first */ ++ ret = split_squashfs(part->master, part->offset, &offset); ++ if (ret) ++ return ret; ++ ++ if ((offset > 0) && !mtd->split) { ++ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name); ++ /* if we don't have a rootfs split partition, create a new one */ ++ tpart.name = (char *) mtd->name; ++ tpart.size = mtd->size; ++ tpart.offset = part->offset; ++ ++ return split_rootfs_data(part->master, &part->mtd, &tpart); ++ } else if ((offset > 0) && mtd->split) { ++ /* update the offsets of the existing partition */ ++ size = mtd->size + part->offset - offset; ++ ++ part = PART(mtd->split); ++ part->offset = offset; ++ part->mtd.size = size; ++ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n", ++ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"), ++ (u32) part->offset, (u32) part->mtd.size); ++ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); ++ strcpy(name, ROOTFS_SPLIT_NAME); ++ part->mtd.name = name; ++ } else if ((offset <= 0) && mtd->split) { ++ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name); ++ ++ /* mark existing partition as removed */ ++ part = PART(mtd->split); ++ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); ++ strcpy(name, ROOTFS_REMOVED_NAME); ++ part->mtd.name = name; ++ part->offset = 0; ++ part->mtd.size = 0; ++ } ++ ++ return 0; ++} ++#endif /* CONFIG_MTD_ROOTFS_SPLIT */ ++ + /* + * This function, given a master MTD object and a partition table, creates + * and registers slave MTD objects which are bound to the master according to +@@ -722,6 +862,9 @@ int add_mtd_partitions(struct mtd_info * + struct mtd_part *slave; + uint64_t cur_offset = 0; + int i; ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ int ret; ++#endif + + printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); + +@@ -736,12 +879,53 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + ++ if (!strcmp(parts[i].name, "rootfs")) { ++#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++ if (ROOT_DEV == 0) { ++ printk(KERN_NOTICE "mtd: partition \"rootfs\" " ++ "set to be root filesystem\n"); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); ++ } ++#endif ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ ret = split_rootfs_data(master, &slave->mtd, &parts[i]); ++ /* if (ret == 0) ++ * j++; */ ++#endif ++ } ++ + cur_offset = slave->offset + slave->mtd.size; + } + + return 0; + } + ++int mtd_device_refresh(struct mtd_info *mtd) ++{ ++ int ret = 0; ++ ++ if (IS_PART(mtd)) { ++ struct mtd_part *part; ++ struct mtd_info *master; ++ ++ part = PART(mtd); ++ master = part->master; ++ if (master->refresh_device) ++ ret = master->refresh_device(master); ++ } ++ ++ if (!ret && mtd->refresh_device) ++ ret = mtd->refresh_device(mtd); ++ ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs")) ++ refresh_rootfs_split(mtd); ++#endif ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(mtd_device_refresh); ++ + static DEFINE_SPINLOCK(part_parser_lock); + static LIST_HEAD(part_parsers); + +--- a/drivers/mtd/mtdchar.c ++++ b/drivers/mtd/mtdchar.c +@@ -1008,6 +1008,12 @@ static int mtdchar_ioctl(struct file *fi + break; + } + ++ case MTDREFRESH: ++ { ++ ret = mtd_device_refresh(mtd); ++ break; ++ } ++ + default: + ret = -ENOTTY; + } +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -115,6 +115,7 @@ struct nand_ecclayout { + + struct module; /* only needed for owner field in mtd_info */ + ++struct mtd_info; + struct mtd_info { + u_char type; + uint32_t flags; +@@ -231,6 +232,9 @@ struct mtd_info { + int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); + int (*_suspend) (struct mtd_info *mtd); + void (*_resume) (struct mtd_info *mtd); ++ int (*refresh_device)(struct mtd_info *mtd); ++ struct mtd_info *split; ++ + /* + * If the driver is something smart, like UBI, it may need to maintain + * its own reference counting. The below functions are only for driver. +@@ -397,6 +401,7 @@ extern int mtd_device_parse_register(str + int defnr_parts); + #define mtd_device_register(master, parts, nr_parts) \ + mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) ++extern int mtd_device_refresh(struct mtd_info *master); + extern int mtd_device_unregister(struct mtd_info *master); + extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); + extern int __get_mtd_device(struct mtd_info *mtd); +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -37,12 +37,14 @@ + */ + struct mtd_info; + ++struct mtd_partition; + struct mtd_partition { + const char *name; /* identifier string */ + uint64_t size; /* partition size */ + uint64_t offset; /* offset within the master MTD space */ + uint32_t mask_flags; /* master MTD flags to mask out for this partition */ + struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */ ++ int (*refresh_partition)(struct mtd_info *); + }; + + #define MTDPART_OFS_RETAIN (-3) +--- a/include/uapi/mtd/mtd-abi.h ++++ b/include/uapi/mtd/mtd-abi.h +@@ -203,6 +203,7 @@ struct otp_info { + * without OOB, e.g., NOR flash. + */ + #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) ++#define MTDREFRESH _IO('M', 50) + + /* + * Obsolete legacy interface. Keep it in order not to break userspace diff --git a/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch b/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch new file mode 100644 index 000000000..92937fce1 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch @@ -0,0 +1,84 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -49,6 +49,12 @@ + #define SST49LF008A 0x005a + #define AT49BV6416 0x00d6 + ++/* Macronix */ ++#define MX29LV160B 0x2249 /* MX29LV160 Bottom-boot chip */ ++#define MX29LV160T 0x22C4 /* MX29LV160 Top-boot chip */ ++#define MX29LV320B 0x22A8 /* MX29LV320 Bottom-boot chip */ ++#define MX29LV320T 0x22A7 /* MX29LV320 Top-boot chip */ ++ + static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); + static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); + static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); +@@ -374,6 +380,41 @@ static struct cfi_fixup cfi_nopri_fixup_ + { 0, 0, NULL } + }; + ++#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC ++/* ++ * Some Macronix chips has no/bad bootblock information in the CFI table ++ */ ++static void fixup_macronix_bootloc(struct mtd_info *mtd) ++{ ++ struct map_info *map = mtd->priv; ++ struct cfi_private *cfi = map->fldrv_priv; ++ struct cfi_pri_amdstd *extp = cfi->cmdset_priv; ++ __u8 t; ++ ++ switch (cfi->id) { ++ /* TODO: put affected chip ids here */ ++ case MX29LV160B: ++ case MX29LV320B: ++ t = 2; /* Bottom boot */ ++ break; ++ case MX29LV160T: ++ case MX29LV320T: ++ t = 3; /* Top boot */ ++ break; ++ default: ++ return; ++ } ++ ++ if (extp->TopBottom == t) ++ /* boot location detected by the CFI layer is correct */ ++ return; ++ ++ extp->TopBottom = t; ++ printk("%s: Macronix chip detected, id:0x%04X, boot location forced " ++ "to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top"); ++} ++#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */ ++ + static struct cfi_fixup cfi_fixup_table[] = { + { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri }, + #ifdef AMD_BOOTLOC_BUG +@@ -416,6 +457,9 @@ static struct cfi_fixup fixup_table[] = + */ + { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_erase_chip }, + { CFI_MFR_ATMEL, AT49BV6416, fixup_use_atmel_lock }, ++#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC ++ { CFI_MFR_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc }, ++#endif + { 0, 0, NULL } + }; + +--- a/drivers/mtd/chips/Kconfig ++++ b/drivers/mtd/chips/Kconfig +@@ -189,6 +189,14 @@ config MTD_CFI_AMDSTD + provides support for command set 0002, used on chips including + the AMD Am29LV320. + ++config MTD_CFI_FIXUP_MACRONIX_BOOTLOC ++ bool "Fix boot-block location for Macronix flash chips" ++ depends on MTD_CFI_AMDSTD ++ help ++ Some Macronix flash chips have no/wrong boot-block location in the ++ CFI table, and the driver may detect the type incorrectly. Select ++ this if your board has such chip. ++ + config MTD_CFI_STAA + tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)" + depends on MTD_GEN_PROBE diff --git a/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch b/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch new file mode 100644 index 000000000..00148fa60 --- /dev/null +++ b/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch @@ -0,0 +1,68 @@ +--- a/drivers/mtd/chips/jedec_probe.c ++++ b/drivers/mtd/chips/jedec_probe.c +@@ -115,6 +115,10 @@ + #define UPD29F064115 0x221C + + /* PMC */ ++#define PM39LV512 0x001B ++#define PM39LV010 0x001C ++#define PM39LV020 0x003D ++#define PM39LV040 0x003E + #define PM49FL002 0x006D + #define PM49FL004 0x006E + #define PM49FL008 0x006A +@@ -1259,6 +1263,54 @@ static const struct amd_flash_info jedec + ERASEINFO(0x02000,2), + ERASEINFO(0x04000,1), + } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV512, ++ .name = "PMC Pm39LV512", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_64KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,16), ++ } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV010, ++ .name = "PMC Pm39LV010", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_128KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,32), ++ } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV020, ++ .name = "PMC Pm39LV020", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_256KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,64), ++ } ++ }, { ++ .mfr_id = CFI_MFR_PMC, ++ .dev_id = PM39LV040, ++ .name = "PMC Pm39LV040", ++ .devtypes = CFI_DEVICETYPE_X8, ++ .uaddr = MTD_UADDR_0x0555_0x02AA, ++ .dev_size = SIZE_512KiB, ++ .cmd_set = P_ID_AMD_STD, ++ .nr_regions = 1, ++ .regions = { ++ ERASEINFO(0x01000,128), ++ } + }, { + .mfr_id = CFI_MFR_PMC, + .dev_id = PM49FL002, diff --git a/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch b/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch new file mode 100644 index 000000000..62667769c --- /dev/null +++ b/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch @@ -0,0 +1,23 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -60,6 +60,10 @@ config MTD_ROOTFS_SPLIT + bool "Automatically split 'rootfs' partition for squashfs" + default y + ++config MTD_TRXSPLIT ++ bool "Automatically find and split TRX partitions" ++ default n ++ + config MTD_REDBOOT_PARTS + tristate "RedBoot partition table parsing" + ---help--- +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o + obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o + obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ++obj-$(CONFIG_MTD_TRXSPLIT) += trxsplit.o + + # 'Users' - code which presents functionality to userspace. + obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch b/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch new file mode 100644 index 000000000..5390bd95b --- /dev/null +++ b/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch @@ -0,0 +1,28 @@ +--- a/drivers/ata/Makefile ++++ b/drivers/ata/Makefile +@@ -98,6 +98,7 @@ obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia + obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o + obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o + obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o ++obj-$(CONFIG_PATA_RB153_CF) += pata_rb153_cf.o + obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o + obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o + obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -958,6 +958,15 @@ config PATA_QDI + help + Support for QDI 6500 and 6580 PATA controllers on VESA local bus. + ++config PATA_RB153_CF ++ tristate "RouterBOARD 153 Compact Flash support" ++ depends on ADM5120_MACH_RB_153 ++ help ++ This option enables support for a Compact Flash connected on ++ the RouterBOARD 153. ++ ++ If unsure, say N. ++ + config PATA_RB532 + tristate "RouterBoard 532 PATA CompactFlash support" + depends on MIKROTIK_RB532 diff --git a/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch b/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch new file mode 100644 index 000000000..8eee7a10f --- /dev/null +++ b/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch @@ -0,0 +1,354 @@ +--- a/drivers/tty/serial/amba-pl010.c ++++ b/drivers/tty/serial/amba-pl010.c +@@ -48,11 +48,9 @@ + #include + #include + +-#define UART_NR 8 +- + #define SERIAL_AMBA_MAJOR 204 + #define SERIAL_AMBA_MINOR 16 +-#define SERIAL_AMBA_NR UART_NR ++#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS + + #define AMBA_ISR_PASS_LIMIT 256 + +@@ -78,9 +76,9 @@ static void pl010_stop_tx(struct uart_po + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr &= ~UART010_CR_TIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_start_tx(struct uart_port *port) +@@ -88,9 +86,9 @@ static void pl010_start_tx(struct uart_p + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr |= UART010_CR_TIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_stop_rx(struct uart_port *port) +@@ -98,9 +96,9 @@ static void pl010_stop_rx(struct uart_po + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_enable_ms(struct uart_port *port) +@@ -108,18 +106,18 @@ static void pl010_enable_ms(struct uart_ + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr |= UART010_CR_MSIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_rx_chars(struct uart_amba_port *uap) + { + unsigned int status, ch, flag, rsr, max_count = 256; + +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + while (UART_RX_DATA(status) && max_count--) { +- ch = readb(uap->port.membase + UART01x_DR); ++ ch = __raw_readl(uap->port.membase + UART01x_DR); + flag = TTY_NORMAL; + + uap->port.icount.rx++; +@@ -128,9 +126,9 @@ static void pl010_rx_chars(struct uart_a + * Note that the error handling code is + * out of the main execution path + */ +- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; ++ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; + if (unlikely(rsr & UART01x_RSR_ANY)) { +- writel(0, uap->port.membase + UART01x_ECR); ++ __raw_writel(0, uap->port.membase + UART01x_ECR); + + if (rsr & UART01x_RSR_BE) { + rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); +@@ -160,7 +158,7 @@ static void pl010_rx_chars(struct uart_a + uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); + + ignore_char: +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + } + spin_unlock(&uap->port.lock); + tty_flip_buffer_push(&uap->port.state->port); +@@ -173,7 +171,7 @@ static void pl010_tx_chars(struct uart_a + int count; + + if (uap->port.x_char) { +- writel(uap->port.x_char, uap->port.membase + UART01x_DR); ++ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR); + uap->port.icount.tx++; + uap->port.x_char = 0; + return; +@@ -185,7 +183,7 @@ static void pl010_tx_chars(struct uart_a + + count = uap->port.fifosize >> 1; + do { +- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); ++ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); + uap->port.icount.tx++; + if (uart_circ_empty(xmit)) +@@ -203,9 +201,9 @@ static void pl010_modem_status(struct ua + { + unsigned int status, delta; + +- writel(0, uap->port.membase + UART010_ICR); ++ __raw_writel(0, uap->port.membase + UART010_ICR); + +- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; ++ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + + delta = status ^ uap->old_status; + uap->old_status = status; +@@ -233,7 +231,7 @@ static irqreturn_t pl010_int(int irq, vo + + spin_lock(&uap->port.lock); + +- status = readb(uap->port.membase + UART010_IIR); ++ status = __raw_readl(uap->port.membase + UART010_IIR); + if (status) { + do { + if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) +@@ -246,7 +244,7 @@ static irqreturn_t pl010_int(int irq, vo + if (pass_counter-- == 0) + break; + +- status = readb(uap->port.membase + UART010_IIR); ++ status = __raw_readl(uap->port.membase + UART010_IIR); + } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | + UART010_IIR_TIS)); + handled = 1; +@@ -260,7 +258,7 @@ static irqreturn_t pl010_int(int irq, vo + static unsigned int pl010_tx_empty(struct uart_port *port) + { + struct uart_amba_port *uap = (struct uart_amba_port *)port; +- unsigned int status = readb(uap->port.membase + UART01x_FR); ++ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR); + return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; + } + +@@ -270,7 +268,7 @@ static unsigned int pl010_get_mctrl(stru + unsigned int result = 0; + unsigned int status; + +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + if (status & UART01x_FR_DCD) + result |= TIOCM_CAR; + if (status & UART01x_FR_DSR) +@@ -296,12 +294,12 @@ static void pl010_break_ctl(struct uart_ + unsigned int lcr_h; + + spin_lock_irqsave(&uap->port.lock, flags); +- lcr_h = readb(uap->port.membase + UART010_LCRH); ++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); + if (break_state == -1) + lcr_h |= UART01x_LCRH_BRK; + else + lcr_h &= ~UART01x_LCRH_BRK; +- writel(lcr_h, uap->port.membase + UART010_LCRH); ++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); + spin_unlock_irqrestore(&uap->port.lock, flags); + } + +@@ -329,12 +327,12 @@ static int pl010_startup(struct uart_por + /* + * initialise the old status of the modem signals + */ +- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; ++ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + + /* + * Finally, enable interrupts + */ +- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, ++ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, + uap->port.membase + UART010_CR); + + return 0; +@@ -357,10 +355,10 @@ static void pl010_shutdown(struct uart_p + /* + * disable all interrupts, disable the port + */ +- writel(0, uap->port.membase + UART010_CR); ++ __raw_writel(0, uap->port.membase + UART010_CR); + + /* disable break condition and fifos */ +- writel(readb(uap->port.membase + UART010_LCRH) & ++ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) & + ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), + uap->port.membase + UART010_LCRH); + +@@ -382,7 +380,7 @@ pl010_set_termios(struct uart_port *port + /* + * Ask the core to calculate the divisor for us. + */ +- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); ++ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); + quot = uart_get_divisor(port, baud); + + switch (termios->c_cflag & CSIZE) { +@@ -445,25 +443,25 @@ pl010_set_termios(struct uart_port *port + uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; + + /* first, disable everything */ +- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; ++ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; + + if (UART_ENABLE_MS(port, termios->c_cflag)) + old_cr |= UART010_CR_MSIE; + +- writel(0, uap->port.membase + UART010_CR); ++ __raw_writel(0, uap->port.membase + UART010_CR); + + /* Set baud rate */ + quot -= 1; +- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); +- writel(quot & 0xff, uap->port.membase + UART010_LCRL); ++ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); ++ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL); + + /* + * ----------v----------v----------v----------v----- + * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L + * ----------^----------^----------^----------^----- + */ +- writel(lcr_h, uap->port.membase + UART010_LCRH); +- writel(old_cr, uap->port.membase + UART010_CR); ++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); ++ __raw_writel(old_cr, uap->port.membase + UART010_CR); + + spin_unlock_irqrestore(&uap->port.lock, flags); + } +@@ -545,7 +543,7 @@ static struct uart_ops amba_pl010_pops = + .verify_port = pl010_verify_port, + }; + +-static struct uart_amba_port *amba_ports[UART_NR]; ++static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR]; + + #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE + +@@ -555,10 +553,10 @@ static void pl010_console_putchar(struct + unsigned int status; + + do { +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + barrier(); + } while (!UART_TX_READY(status)); +- writel(ch, uap->port.membase + UART01x_DR); ++ __raw_writel(ch, uap->port.membase + UART01x_DR); + } + + static void +@@ -572,8 +570,8 @@ pl010_console_write(struct console *co, + /* + * First save the CR then disable the interrupts + */ +- old_cr = readb(uap->port.membase + UART010_CR); +- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); ++ old_cr = __raw_readl(uap->port.membase + UART010_CR); ++ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); + + uart_console_write(&uap->port, s, count, pl010_console_putchar); + +@@ -582,10 +580,10 @@ pl010_console_write(struct console *co, + * and restore the TCR + */ + do { +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + barrier(); + } while (status & UART01x_FR_BUSY); +- writel(old_cr, uap->port.membase + UART010_CR); ++ __raw_writel(old_cr, uap->port.membase + UART010_CR); + + clk_disable(uap->clk); + } +@@ -594,9 +592,9 @@ static void __init + pl010_console_get_options(struct uart_amba_port *uap, int *baud, + int *parity, int *bits) + { +- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { ++ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { + unsigned int lcr_h, quot; +- lcr_h = readb(uap->port.membase + UART010_LCRH); ++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); + + *parity = 'n'; + if (lcr_h & UART01x_LCRH_PEN) { +@@ -611,8 +609,8 @@ pl010_console_get_options(struct uart_am + else + *bits = 8; + +- quot = readb(uap->port.membase + UART010_LCRL) | +- readb(uap->port.membase + UART010_LCRM) << 8; ++ quot = __raw_readl(uap->port.membase + UART010_LCRL) | ++ __raw_readl(uap->port.membase + UART010_LCRM) << 8; + *baud = uap->port.uartclk / (16 * (quot + 1)); + } + } +@@ -631,7 +629,7 @@ static int __init pl010_console_setup(st + * if so, search for the first available port that does have + * console support. + */ +- if (co->index >= UART_NR) ++ if (co->index >= SERIAL_AMBA_NR) + co->index = 0; + uap = amba_ports[co->index]; + if (!uap) +@@ -673,7 +671,7 @@ static struct uart_driver amba_reg = { + .dev_name = "ttyAM", + .major = SERIAL_AMBA_MAJOR, + .minor = SERIAL_AMBA_MINOR, +- .nr = UART_NR, ++ .nr = SERIAL_AMBA_NR, + .cons = AMBA_CONSOLE, + }; + +--- a/drivers/tty/serial/Kconfig ++++ b/drivers/tty/serial/Kconfig +@@ -25,10 +25,18 @@ config SERIAL_AMBA_PL010 + help + This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have + an Integrator/AP or Integrator/PP2 platform, or if you have a +- Cirrus Logic EP93xx CPU, say Y or M here. ++ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here. + + If unsure, say N. + ++config SERIAL_AMBA_PL010_NUMPORTS ++ int "Maximum number of AMBA PL010 serial ports" ++ depends on SERIAL_AMBA_PL010 ++ default "8" ++ ---help--- ++ Set this to the number of serial ports you want the AMBA PL010 driver ++ to support. ++ + config SERIAL_AMBA_PL010_CONSOLE + bool "Support for console on AMBA serial port" + depends on SERIAL_AMBA_PL010=y diff --git a/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch b/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch new file mode 100644 index 000000000..5345022da --- /dev/null +++ b/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch @@ -0,0 +1,27 @@ +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -55,13 +55,17 @@ static void gpio_led_set(struct led_clas + container_of(led_cdev, struct gpio_led_data, cdev); + int level; + +- if (value == LED_OFF) +- level = 0; +- else +- level = 1; +- +- if (led_dat->active_low) +- level = !level; ++ switch (value) { ++ case LED_OFF: ++ level = led_dat->active_low ? 1 : 0; ++ break; ++ case LED_FULL: ++ level = led_dat->active_low ? 0 : 1; ++ break; ++ default: ++ level = value; ++ break; ++ } + + /* Setting GPIOs with I2C/etc requires a task context, and we don't + * seem to have a reliable way to know if we're already in one; so diff --git a/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch b/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch new file mode 100644 index 000000000..4b6db8b8d --- /dev/null +++ b/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch @@ -0,0 +1,31 @@ +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1116,6 +1116,18 @@ config RC32434_WDT + To compile this driver as a module, choose M here: the + module will be called rc32434_wdt. + ++config ADM5120_WDT ++ tristate "Infineon ADM5120 SoC hardware watchdog" ++ depends on WATCHDOG && ADM5120 ++ help ++ This is a driver for hardware watchdog integrated in Infineon ++ ADM5120 SoC. This watchdog simply watches your kernel to make sure ++ it doesn't freeze, and if it does, it reboots your computer after a ++ certain amount of time. ++ ++ To compile this driver as a module, choose M here: the module will be ++ called adm5120_wdt. ++ + config INDYDOG + tristate "Indy/I2 Hardware Watchdog" + depends on SGI_HAS_INDYDOG +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -131,6 +131,7 @@ obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o + obj-$(CONFIG_BCM47XX_WDT) += bcm47xx_wdt.o + obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o + obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o ++obj-$(CONFIG_ADM5120_WDT) += adm5120_wdt.o + obj-$(CONFIG_INDYDOG) += indydog.o + obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o + obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o diff --git a/target/linux/adm5120/rb1xx/base-files/sbin/wget2nand b/target/linux/adm5120/rb1xx/base-files/sbin/wget2nand new file mode 100755 index 000000000..f7e0a092c --- /dev/null +++ b/target/linux/adm5120/rb1xx/base-files/sbin/wget2nand @@ -0,0 +1,78 @@ +#!/bin/sh +# wget2nand +# This script can be used to download a TGZ file from your build system which +# contains the files to be installed on the NAND flash on your RB1xx card. +# The one parameter is the URL of the TGZ file to be downloaded. +# Licence GPL V2 +# Author david.goodenough@linkchoose.co.uk +# Based on cf2nand from RB532 support +. /lib/functions.sh + +[ -d /tmp/wget2nand-rootfs ] && { + echo "/tmp/wget2nand-rootfs already exists" + exit 1 +} + +[ -d /tmp/wget2nand-kernel ] && { + echo "/tmp/wget2nand-kernel already exists" + exit 1 +} + +# need to find the wget server from the command line +url=$1 +[ -z "$url" ] && { + echo "No URL specified for image TGZ" + echo "Usage : $0 URL" + exit 1 +} + +# first get an address for br-lan using udhcpc +killall udhcpc +/sbin/udhcpc -i br-lan + +mtd_kernel="$(find_mtd_part 'kernel')" +mtd_rootfs="$(find_mtd_part 'rootfs')" +[ -z "$mtd_kernel" -o -z "$mtd_rootfs" ] && { + echo "Cannot find NAND Flash partitions" + exit 1 +} + +echo "Erasing filesystem..." +mtd erase kernel 2>/dev/null >/dev/null +mtd erase rootfs 2>/dev/null >/dev/null + +echo "Mounting $mtd_rootfs as new root and $mtd_kernel as kernel partition" + +mkdir /tmp/wget2nand-rootfs +mkdir /tmp/wget2nand-kernel +mount -t yaffs2 "$mtd_rootfs" /tmp/wget2nand-rootfs +mount -t yaffs2 "$mtd_kernel" /tmp/wget2nand-kernel + +echo "Erasing existing files..." +rm -rf /tmp/wget2nand-rootfs/* + +echo "Copying filesystem..." +( wget -O - $url/openwrt-adm5120-rb1xx-rootfs.tar.gz) | ( cd /tmp/wget2nand-rootfs/; tar xvz ) +# RouterBOOT is looking for a kernel named "kernel" +wget -O /tmp/wget2nand-kernel/kernel $url/openwrt-adm5120-rb1xx-vmlinux.elf + +chmod +x /tmp/wget2nand-kernel/kernel + +# make sure everything is written before we unmount the partitions +echo "chmod ugo+x /" > /tmp/wget2nand-rootfs/etc/uci-defaults/set_root_permission +sync +ls /tmp/wget2nand-kernel/ +ls /tmp/wget2nand-rootfs/ +# use kexec if present +[ -x /usr/sbin/kexec ] && { + kexec -l /tmp/wget2nand-kernel/kernel --command-line="$(cat /proc/cmdline) rootfstype=yaffs2 root=$mtd_kernel" + kexec -e +} +# unmount the partitions and remove the directories into which they were mounted +umount /tmp/wget2nand-kernel +umount /tmp/wget2nand-rootfs +rmdir /tmp/wget2nand-kernel +rmdir /tmp/wget2nand-rootfs + +# all done +echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand" diff --git a/target/linux/adm5120/rb1xx/config-default b/target/linux/adm5120/rb1xx/config-default new file mode 100644 index 000000000..37db0b32a --- /dev/null +++ b/target/linux/adm5120/rb1xx/config-default @@ -0,0 +1,52 @@ +# CONFIG_ADM5120_MACH_5GXI is not set +# CONFIG_ADM5120_MACH_BR_6104K is not set +# CONFIG_ADM5120_MACH_BR_6104KP is not set +# CONFIG_ADM5120_MACH_BR_61X4WG is not set +# CONFIG_ADM5120_MACH_CAS_771 is not set +# CONFIG_ADM5120_MACH_EASY5120P_ATA is not set +# CONFIG_ADM5120_MACH_EASY5120_RT is not set +# CONFIG_ADM5120_MACH_EASY5120_WVOIP is not set +# CONFIG_ADM5120_MACH_EASY83000 is not set +# CONFIG_ADM5120_MACH_EB_214A is not set +# CONFIG_ADM5120_MACH_NFS_101 is not set +# CONFIG_ADM5120_MACH_NP27G is not set +# CONFIG_ADM5120_MACH_NP28G is not set +# CONFIG_ADM5120_MACH_PMUGW is not set +CONFIG_ADM5120_MACH_RB_11X=y +CONFIG_ADM5120_MACH_RB_133=y +CONFIG_ADM5120_MACH_RB_133C=y +CONFIG_ADM5120_MACH_RB_150=y +CONFIG_ADM5120_MACH_RB_153=y +CONFIG_ADM5120_MACH_RB_192=y +# CONFIG_ADM5120_MACH_WP54 is not set +# CONFIG_ADM5120_OEM_CELLVISION is not set +# CONFIG_ADM5120_OEM_COMPEX is not set +# CONFIG_ADM5120_OEM_EDIMAX is not set +# CONFIG_ADM5120_OEM_GENERIC is not set +# CONFIG_ADM5120_OEM_INFINEON is not set +CONFIG_ADM5120_OEM_MIKROTIK=y +# CONFIG_ADM5120_OEM_MOTOROLA is not set +# CONFIG_ADM5120_OEM_OSBRIDGE is not set +CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=yaffs2" +# CONFIG_JFFS2_FS is not set +# CONFIG_MTD_MYLOADER_PARTS is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_PLATFORM=y +# CONFIG_MTD_ROOTFS_SPLIT is not set +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_TRXSPLIT is not set +# CONFIG_OVERLAYFS_FS is not set +# CONFIG_PATA_RB153_CF is not set +# CONFIG_SQUASHFS is not set +CONFIG_YAFFS_9BYTE_TAGS=y +# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set +CONFIG_YAFFS_AUTO_YAFFS2=y +# CONFIG_YAFFS_DISABLE_BACKGROUND is not set +# CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING is not set +CONFIG_YAFFS_DISABLE_TAGS_ECC=y +# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set +CONFIG_YAFFS_FS=y +CONFIG_YAFFS_XATTR=y +CONFIG_YAFFS_YAFFS1=y +CONFIG_YAFFS_YAFFS2=y diff --git a/target/linux/adm5120/rb1xx/profiles/RB1xx.mk b/target/linux/adm5120/rb1xx/profiles/RB1xx.mk new file mode 100644 index 000000000..b9da1640d --- /dev/null +++ b/target/linux/adm5120/rb1xx/profiles/RB1xx.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/RouterBoard + NAME:=Mikrotik RouterBoard 1xx family + PACKAGES:=kmod-ath5k kmod-pata-rb153-cf +endef + +define Profile/RouterBoard/Description + Package set compatible with the RouterBoard RB1xx devices. Contains RouterOS to OpenWrt\\\ + installation scripts. +endef + +$(eval $(call Profile,RouterBoard)) diff --git a/target/linux/adm5120/rb1xx/target.mk b/target/linux/adm5120/rb1xx/target.mk new file mode 100644 index 000000000..9aa64bc22 --- /dev/null +++ b/target/linux/adm5120/rb1xx/target.mk @@ -0,0 +1,8 @@ +ARCH:=mipsel +SUBTARGET:=rb1xx +BOARDNAME:=MikroTik RB-1xx boards +FEATURES+=tgz broken + +define Target/Description + Build firmware images for Mikrotik RB-1xx series. +endef diff --git a/target/linux/adm5120/router_be/config-default b/target/linux/adm5120/router_be/config-default new file mode 100644 index 000000000..c3b9e369d --- /dev/null +++ b/target/linux/adm5120/router_be/config-default @@ -0,0 +1,13 @@ +CONFIG_ADM5120_MACH_P_334WT=y +CONFIG_ADM5120_MACH_P_335=y +# CONFIG_ADM5120_OEM_CELLVISION is not set +# CONFIG_ADM5120_OEM_COMPEX is not set +# CONFIG_ADM5120_OEM_EDIMAX is not set +# CONFIG_ADM5120_OEM_GENERIC is not set +# CONFIG_ADM5120_OEM_INFINEON is not set +# CONFIG_ADM5120_OEM_MOTOROLA is not set +# CONFIG_ADM5120_OEM_OSBRIDGE is not set +CONFIG_ADM5120_OEM_ZYXEL=y +CONFIG_CPU_BIG_ENDIAN=y +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_SWAP_IO_SPACE=y diff --git a/target/linux/adm5120/router_be/profiles/010-Generic.mk b/target/linux/adm5120/router_be/profiles/010-Generic.mk new file mode 100644 index 000000000..1d477319d --- /dev/null +++ b/target/linux/adm5120/router_be/profiles/010-Generic.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Generic + NAME:=Generic (default) + PACKAGES:= +endef + +define Profile/Generic/Description + Generic package set compatible with most boards. +endef +$(eval $(call Profile,Generic)) + diff --git a/target/linux/adm5120/router_be/profiles/200-ZyXEL.mk b/target/linux/adm5120/router_be/profiles/200-ZyXEL.mk new file mode 100644 index 000000000..19ac9f5e9 --- /dev/null +++ b/target/linux/adm5120/router_be/profiles/200-ZyXEL.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/P334WT + NAME:=ZyXEL Prestige 334WT + PACKAGES:=kmod-acx-mac80211 +endef + +define Profile/P334WT/Description + Package set optimized for the ZyXEL Prestige 334WT board. +endef + +define Profile/P335WT + NAME:=ZyXEL Prestige 335WT + PACKAGES:=kmod-acx-mac80211 kmod-usb-core kmod-usb-adm5120 +endef + +define Profile/P335WT/Description + Package set optimized for the ZyXEL Prestige 335WT board. +endef + +$(eval $(call Profile,P334WT)) +$(eval $(call Profile,P335WT)) diff --git a/target/linux/adm5120/router_be/target.mk b/target/linux/adm5120/router_be/target.mk new file mode 100644 index 000000000..f9119c51c --- /dev/null +++ b/target/linux/adm5120/router_be/target.mk @@ -0,0 +1,10 @@ +ARCH:=mips +SUBTARGET:=router_be +BOARDNAME:=Big Endian +FEATURES+=squashfs + +define Target/Description + Build firmware images for Infineon/ADMTek ADM5120 based boards + running in big-endian mode (e.g : ZyXEL Prestige 335WT ...) +endef + diff --git a/target/linux/adm5120/router_le/config-3.8 b/target/linux/adm5120/router_le/config-3.8 new file mode 100644 index 000000000..e69de29bb diff --git a/target/linux/adm5120/router_le/profiles/010-Generic.mk b/target/linux/adm5120/router_le/profiles/010-Generic.mk new file mode 100644 index 000000000..6c3e5f30e --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/010-Generic.mk @@ -0,0 +1,28 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Generic + NAME:=Generic (default) + PACKAGES:= +endef + +define Profile/Generic/Description + Generic package set compatible with most boards. +endef + +define Profile/EB-214A + NAME:=Generic EB-214A + PACKAGES:=-wpad-mini -admswconfig -kmod-usb-adm5120 -kmod-ledtrig-adm5120-switch -dnsmasq kmod-usb-uhci kmod-usb2 +endef + +define Profile/EB-214A/Description + Package set optimized for generic EB-214A boards. +endef + +$(eval $(call Profile,Generic)) +$(eval $(call Profile,EB-214A)) + diff --git a/target/linux/adm5120/router_le/profiles/Cellvision.mk b/target/linux/adm5120/router_le/profiles/Cellvision.mk new file mode 100644 index 000000000..4093b4f49 --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Cellvision.mk @@ -0,0 +1,146 @@ +# +# Copyright (C) 2007-2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/CAS630 + NAME:=Cellvision CAS-630 IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS630/Description + Package set optimized for the Cellvision CAS-630 device. +endef + +define Profile/CAS630W + NAME:=Cellvision CAS-630W IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS630W/Description + Package set optimized for the Cellvision CAS-630W device. +endef + +define Profile/CAS670 + NAME:=Cellvision CAS-670 IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS670/Description + Package set optimized for the Cellvision CAS-670 device. +endef + +define Profile/CAS670W + NAME:=Cellvision CAS-670W IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS670W/Description + Package set optimized for the Cellvision CAS-670 device. +endef + +define Profile/CAS700 + NAME:=Cellvision CAS-700 IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS700/Description + Package set optimized for the Cellvision CAS-700 device. +endef + +define Profile/CAS700W + NAME:=Cellvision CAS-700W IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS700W/Description + Package set optimized for the Cellvision CAS-700W device. +endef + +define Profile/CAS771 + NAME:=Cellvision CAS-771 IP camera (Experimental) + PACKAGES:=-wpad-mini kmod-video-cpia2 kmod-usb-ohci kmod-usb2 kmod-usb-audio +endef + +define Profile/CAS771/Description + Package set optimized for the Cellvision CAS-771 device. +endef + +define Profile/CAS771W + NAME:=Cellvision CAS-771W IP camera (Experimental) + PACKAGES:=-wpad-mini kmod-video-cpia2 kmod-usb-ohci kmod-usb2 kmod-usb-audio kmod-rt2500-pci +endef + +define Profile/CAS771W/Description + Package set optimized for the Cellvision CAS-771W device. +endef + +define Profile/CAS790 + NAME:=Cellvision CAS-790 IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS790/Description + Package set optimized for the Cellvision CAS-790 device. +endef + +define Profile/CAS861 + NAME:=Cellvision CAS-861 IP camera (Experimental) + # TODO: add default packages + PACKAGES:=-wpad-mini +endef + +define Profile/CAS861/Description + Package set optimized for the Cellvision CAS-861 device. +endef + +define Profile/CAS861W + NAME:=Cellvision CAS-861W IP camera (Experimental) + PACKAGES:=kmod-rt2500-pci +endef + +define Profile/CAS861W/Description + Package set optimized for the Cellvision CAS-861W device. +endef + +define Profile/NFS101U + NAME:=Cellvision NFS-101U Network File Server (Experimental) + PACKAGES:=-wpad-mini kmod-usb-ohci kmod-usb2 +endef + +define Profile/NFS101U/Description + Package set optimized for the Cellvision NFS-101U device. +endef + +define Profile/NFS101WU + NAME:=Cellvision NFS-101WU Network File Server (Experimental) + PACKAGES:=-wpad-mini kmod-usb-ohci kmod-usb2 +endef + +define Profile/NFS101WU/Description + Package set optimized for the Cellvision NFS-101WU device. +endef + +$(eval $(call Profile,CAS630)) +$(eval $(call Profile,CAS630W)) +$(eval $(call Profile,CAS670)) +$(eval $(call Profile,CAS670W)) +$(eval $(call Profile,CAS700)) +$(eval $(call Profile,CAS700W)) +$(eval $(call Profile,CAS771)) +$(eval $(call Profile,CAS771W)) +$(eval $(call Profile,CAS790)) +$(eval $(call Profile,CAS861)) +$(eval $(call Profile,CAS861W)) +$(eval $(call Profile,NFS101U)) +$(eval $(call Profile,NFS101WU)) + diff --git a/target/linux/adm5120/router_le/profiles/Compex.mk b/target/linux/adm5120/router_le/profiles/Compex.mk new file mode 100644 index 000000000..79d1f3f91 --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Compex.mk @@ -0,0 +1,37 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/NP27G + NAME:=Compex NP27G + PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-adm5120 +endef + +define Profile/NP27G/Description + Package set optimized for the Compex NP27G. +endef + +define Profile/NP28G + NAME:=Compex NP28G + PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-uhci kmod-usb2 +endef + +define Profile/NP28G/Description + Package set optimized for the Compex NP28G. +endef + +define Profile/WP54 + NAME:=Compex WP54 family + PACKAGES:=kmod-ath5k +endef + +define Profile/WP54/Description + Package set optimized for the Compex WP54 family. +endef + +$(eval $(call Profile,NP27G)) +$(eval $(call Profile,NP28G)) +$(eval $(call Profile,WP54)) diff --git a/target/linux/adm5120/router_le/profiles/Edimax.mk b/target/linux/adm5120/router_le/profiles/Edimax.mk new file mode 100644 index 000000000..55c295875 --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Edimax.mk @@ -0,0 +1,47 @@ +# +# Copyright (C) 2007,2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/BR6104K + NAME:=Edimax BR-6104K (Unofficial) + PACKAGES:=-wpad-mini +endef + +define Profile/BR6104K/Description + Package set optimized for the Edimax BR-6104K +endef + +define Profile/BR6104KP + NAME:=Edimax BR-6104KP (Unofficial) + PACKAGES:=-wpad-mini kmod-usb-core kmod-usb-adm5120 +endef + +define Profile/BR6104KP/Description + Package set optimized for the Edimax BR-6104KP +endef + +define Profile/BR6104WG + NAME:=Edimax BR-6104Wg (Unofficial, No WiFi) + PACKAGES:=-wpad-mini +endef + +define Profile/BR6104WG/Description + Package set optimized for the Edimax BR-6104Wg +endef + +define Profile/BR6114WG + NAME:=Edimax BR-6114WG (Unofficial, No WiFi) + PACKAGES:=-wpad-mini +endef + +define Profile/BR6114WG/Description + Package set optimized for the Edimax BR-6114WG +endef + +$(eval $(call Profile,BR6104K)) +$(eval $(call Profile,BR6104KP)) +$(eval $(call Profile,BR6104WG)) +$(eval $(call Profile,BR6114WG)) diff --git a/target/linux/adm5120/router_le/profiles/Infineon.mk b/target/linux/adm5120/router_le/profiles/Infineon.mk new file mode 100644 index 000000000..d650406b7 --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Infineon.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/EASY5120RT + NAME:=Infineon EASY 5120-RT Reference Board + PACKAGES:=kmod-usb-core kmod-usb-adm5120 +endef + +define Profile/EASY5120RT/Description + Package set optimized for the Infineon EASY 5120-RT Reference Board +endef + +$(eval $(call Profile,EASY5120RT)) + +define Profile/EASY5120PATA + NAME:=Infineon EASY 5120P-ATA Reference Board +endef + +define Profile/EASY5120RT/Description + Package set optimized for the Infineon EASY 5120P-ATA Reference Board +endef + +$(eval $(call Profile,EASY5120PATA)) diff --git a/target/linux/adm5120/router_le/profiles/Motorola.mk b/target/linux/adm5120/router_le/profiles/Motorola.mk new file mode 100644 index 000000000..e640b81a1 --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Motorola.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/PMUGW + NAME:=Motorola Powerline MU Gateway (EXPERIMENTAL) +endef + +define Profile/PMUGW/Description + Package set optimized for the Motorola Powerline MU Gateway board +endef + +$(eval $(call Profile,PMUGW)) diff --git a/target/linux/adm5120/router_le/profiles/Osbridge.mk b/target/linux/adm5120/router_le/profiles/Osbridge.mk new file mode 100644 index 000000000..459d524ba --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Osbridge.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2007-2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/5GXI + NAME:=Osbridge 5GXi/5XLi (Unofficial) +endef + +define Profile/5GXI/Description + Package set optimized for the OSBRiDGE 5GXi/5XLi boards. +endef + +$(eval $(call Profile,5GXI)) diff --git a/target/linux/adm5120/router_le/target.mk b/target/linux/adm5120/router_le/target.mk new file mode 100644 index 000000000..ea2a66c5f --- /dev/null +++ b/target/linux/adm5120/router_le/target.mk @@ -0,0 +1,10 @@ +ARCH:=mipsel +SUBTARGET:=router_le +BOARDNAME:=Little Endian +FEATURES+=squashfs tgz + +define Target/Description + Build firmware images for Infineon/ADMtek ADM5120 based boards + running in little-endian mode (e.g: RouterBoard RB1xx, Compex WP54x ...) +endef + diff --git a/target/linux/adm8668/Makefile b/target/linux/adm8668/Makefile new file mode 100644 index 000000000..cc82ec160 --- /dev/null +++ b/target/linux/adm8668/Makefile @@ -0,0 +1,24 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=mipsel +BOARD:=adm8668 +BOARDNAME:=Infineon WildPass ADM8668 +FEATURES:=squashfs usb pci source-only +MAINTAINER:=Florian Fainelli + +KERNEL_PATCHVER:=3.18 + +define Target/Description + Build firmware images for Infineon WildPass (ADM8668) based routers + (e.g. T-Mobile branded Linksys WRTU54G-TM) +endef + +include $(INCLUDE_DIR)/target.mk + +$(eval $(call BuildTarget)) diff --git a/target/linux/adm8668/base-files/etc/config/network b/target/linux/adm8668/base-files/etc/config/network new file mode 100644 index 000000000..5967cdd06 --- /dev/null +++ b/target/linux/adm8668/base-files/etc/config/network @@ -0,0 +1,24 @@ +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option type bridge + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + option ip6assign 60 + +config interface wan + option ifname eth1 + option proto dhcp + +config interface wan6 + option ifname eth1 + option proto dhcpv6 + +config globals globals + option ula_prefix auto diff --git a/target/linux/adm8668/base-files/etc/diag.sh b/target/linux/adm8668/base-files/etc/diag.sh new file mode 100644 index 000000000..edcc7536a --- /dev/null +++ b/target/linux/adm8668/base-files/etc/diag.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright (C) 2010 OpenWrt.org + +set_led() { + local state="$1" + [ -f "/proc/adm8668/sesled" ] && echo "$state" > "/proc/adm8668/sesled" +} + +set_state() { + case "$1" in + preinit) + set_led 1 + ;; + failsafe) + set_led 2 + ;; + done) + set_led 0 + ;; + esac +} diff --git a/target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 b/target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 new file mode 100644 index 000000000..b0f4a4efa --- /dev/null +++ b/target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 @@ -0,0 +1,9 @@ +#!/bin/sh + +init_hotplug_failsafe() { + echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug +} + +boot_hook_add preinit_main init_hotplug_failsafe + + diff --git a/target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 b/target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 new file mode 100644 index 000000000..ac2a7cbb6 --- /dev/null +++ b/target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 @@ -0,0 +1,9 @@ +#!/bin/sh + +set_preinit_ifname() { + ifname=eth0 +} + +boot_hook_add preinit_main set_preinit_ifname + + diff --git a/target/linux/adm8668/base-files/lib/upgrade/platform.sh b/target/linux/adm8668/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..98e47ade3 --- /dev/null +++ b/target/linux/adm8668/base-files/lib/upgrade/platform.sh @@ -0,0 +1,15 @@ +PART_NAME=linux +platform_check_image() { + [ "$#" -gt 1 ] && return 1 + + case "$(get_magic_word "$1")" in + # u-boot + 2705) return 0;; + *) + echo "Invalid image type. Please use only u-boot files" + return 1 + ;; + esac +} + +# use default for platform_do_upgrade() diff --git a/target/linux/adm8668/base-files/sbin/hotplug.failsafe b/target/linux/adm8668/base-files/sbin/hotplug.failsafe new file mode 100644 index 000000000..0544339de --- /dev/null +++ b/target/linux/adm8668/base-files/sbin/hotplug.failsafe @@ -0,0 +1,4 @@ +#!/bin/sh +case "$1" in + button) kill -USR1 1;; +esac diff --git a/target/linux/adm8668/config-3.18 b/target/linux/adm8668/config-3.18 new file mode 100644 index 000000000..0c24c1786 --- /dev/null +++ b/target/linux/adm8668/config-3.18 @@ -0,0 +1,104 @@ +CONFIG_ADM8668=y +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM_AMBA=y +# CONFIG_ARM_SP805_WATCHDOG is not set +CONFIG_CEVT_R4K=y +CONFIG_CEVT_R4K_LIB=y +CONFIG_CMDLINE="console=ttyS0 earlyprintk" +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE_OVERRIDE=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +CONFIG_CPU_MIPSR1=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CSRC_R4K=y +CONFIG_CSRC_R4K_LIB=y +# CONFIG_DE2104X is not set +# CONFIG_DE4X5 is not set +CONFIG_DECOMPRESS_LZMA=y +# CONFIG_DM9102 is not set +CONFIG_DMA_NONCOHERENT=y +CONFIG_EARLY_PRINTK=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SYSFS=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_GENERIC_HARDIRQS=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IRQ_WORK=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HW_HAS_PCI=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQ_CPU=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_MIPS=y +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_MACHINE is not set +CONFIG_MIPS_MT_DISABLED=y +CONFIG_MTD_ADM8668_NOR=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_TULIP=y +CONFIG_NO_EXCEPT_FILL=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y +# CONFIG_PREEMPT_RCU is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_AMBA_PL010=y +CONFIG_SERIAL_AMBA_PL010_CONSOLE=y +CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 +CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +# CONFIG_SERIAL_AMBA_PL011 is not set +CONFIG_SWAP_IO_SPACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_TULIP=y +CONFIG_TULIP_NAPI=y +# CONFIG_TULIP_NAPI_HW_MITIGATION is not set +# CONFIG_TULIP_PCI is not set +CONFIG_TULIP_PLATFORM=y +# CONFIG_ULI526X is not set +CONFIG_USB_ARCH_HAS_XHCI=y +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +CONFIG_USB_SUPPORT=y +# CONFIG_WINBOND_840 is not set +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig new file mode 100644 index 000000000..2e7281ff0 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig @@ -0,0 +1,2 @@ +config ARM_AMBA + def_bool y diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile new file mode 100644 index 000000000..515c3a499 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile @@ -0,0 +1,6 @@ +# +# something witty --neutronscott +# + +obj-y := irq.o prom.o platform.o gpio.o \ + setup.o clock.o time.o early_printk.o \ diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform new file mode 100644 index 000000000..c70cd270b --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform @@ -0,0 +1,6 @@ +# +# Infineon ADM8668 WildPass +# +platform-$(CONFIG_ADM8668) += adm8668/ +cflags-$(CONFIG_ADM8668) += -I$(srctree)/arch/mips/include/asm/mach-adm8668 +load-$(CONFIG_ADM8668) += 0xffffffff80002000 diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c new file mode 100644 index 000000000..1e010fcc8 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c @@ -0,0 +1,76 @@ +/* + * ADM8668 minimal clock support + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under the terms of the GPLv2 + */ + +#include +#include +#include +#include +#include + +#include + +struct clk { + unsigned long rate; +}; + +static struct clk uart_clk = { + .rate = 62500000, +}; + +static struct clk sys_clk; + +struct clk *clk_get(struct device *dev, const char *id) +{ + const char *lookup = id; + + if (dev) + lookup = dev_name(dev); + + if (!strcmp(lookup, "apb:uart0")) + return &uart_clk; + if (!strcmp(lookup, "sys")) + return &sys_clk; + + return ERR_PTR(-ENOENT); +} +EXPORT_SYMBOL(clk_get); + +int clk_enable(struct clk *clk) +{ + return 0; +} +EXPORT_SYMBOL(clk_enable); + +void clk_disable(struct clk *clk) +{ +} +EXPORT_SYMBOL(clk_disable); + +unsigned long clk_get_rate(struct clk *clk) +{ + return clk->rate; +} +EXPORT_SYMBOL(clk_get_rate); + +void clk_put(struct clk *clk) +{ +} +EXPORT_SYMBOL(clk_put); + +void __init adm8668_init_clocks(void) +{ + u32 adj; + + /* adjustable clock selection + * CR3 bit 14~11, 0000 -> 175MHz, 0001 -> 180MHz, etc... + */ + adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf; + sys_clk.rate = 175000000 + (adj * 5000000); + + pr_info("ADM8668 CPU clock: %lu MHz\n", sys_clk.rate / 1000000); +} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c new file mode 100644 index 000000000..03dd72aa8 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c @@ -0,0 +1,16 @@ +#include +#include +#include + +#define UART_READ(r) \ + __raw_readl((void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r))) + +#define UART_WRITE(v, r) \ + __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r))) + +void prom_putchar(char c) +{ + UART_WRITE(c, UART01x_DR); + while ((UART_READ(UART01x_FR) & UART01x_FR_TXFF) != 0) + ; +} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c new file mode 100644 index 000000000..fb39f7f58 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c @@ -0,0 +1,123 @@ +/* + * Infineon/ADMTek ADM8668 WildPass GPIO support + * + * Copyright (C) 2012 Florian Fainelli + * + * Licensed under the terms of GPLv2. + * + */ +#include +#include +#include + +#include + +#define GPIO_MASK 0x3f + +#define GPIO_IN_OFS 0 +#define GPIO_OUT_OFS 6 +#define GPIO_OE_OFS 12 + +struct adm8668_gpio_chip { + void __iomem *base; + struct gpio_chip chip; +}; + +static int adm8668_gpio_dir_out(struct gpio_chip *chip, + unsigned offset, int value) +{ + struct adm8668_gpio_chip *c = + container_of(chip, struct adm8668_gpio_chip, chip); + u32 mask; + + /* clear input, set output enable and output value */ + mask = __raw_readl(c->base); + mask &= ~(1 << offset); + mask |= (1 << (offset + GPIO_OE_OFS)); + if (value) + mask |= (1 << (offset + GPIO_OUT_OFS)); + else + mask &= ~(1 << (offset + GPIO_OUT_OFS)); + __raw_writel(mask, c->base); + + return 0; +} + +static int adm8668_gpio_dir_in(struct gpio_chip *chip, + unsigned offset) +{ + struct adm8668_gpio_chip *c = + container_of(chip, struct adm8668_gpio_chip, chip); + u32 mask; + + mask = __raw_readl(c->base); + mask &= ~(((1 << (offset + GPIO_OE_OFS)) | (1 << (offset + GPIO_OUT_OFS)))); + mask |= (1 << offset); + __raw_writel(mask, c->base); + + return 0; +} + +static void adm8668_gpio_set(struct gpio_chip *chip, + unsigned offset, int value) +{ + struct adm8668_gpio_chip *c = + container_of(chip, struct adm8668_gpio_chip, chip); + u32 mask; + + mask = __raw_readl(c->base); + if (value) + mask |= (1 << (offset + GPIO_OUT_OFS)); + else + mask &= ~(1 << (offset + GPIO_OUT_OFS)); + __raw_writel(mask, c->base); +} + +static int adm8668_gpio_get(struct gpio_chip *chip, + unsigned offset) +{ + struct adm8668_gpio_chip *c = + container_of(chip, struct adm8668_gpio_chip, chip); + u32 value; + + value = __raw_readl(c->base) & GPIO_MASK; + + return value & (1 << offset); +} + +static struct adm8668_gpio_chip adm8668_gpio_cpu = { + .base = (void __iomem *)KSEG1ADDR(ADM8668_CONFIG_BASE + CRGPIO_REG), + .chip = { + .label = "adm8668-cpu-gpio", + .direction_output = adm8668_gpio_dir_out, + .direction_input = adm8668_gpio_dir_in, + .set = adm8668_gpio_set, + .get = adm8668_gpio_get, + .ngpio = 6, + }, +}; + +static struct adm8668_gpio_chip adm8668_gpio_wlan = { + .base = (void __iomem *)KSEG1ADDR(ADM8668_WLAN_BASE + GPIO_REG), + .chip = { + .label = "adm8668-wlan-gpio", + .direction_output = adm8668_gpio_dir_out, + .direction_input = adm8668_gpio_dir_in, + .set = adm8668_gpio_set, + .get = adm8668_gpio_get, + .ngpio = 6, + .base = 6, + }, +}; + +static int __init adm8668_gpio_init(void) +{ + int ret; + + ret = gpiochip_add(&adm8668_gpio_cpu.chip); + if (ret) + return ret; + + return gpiochip_add(&adm8668_gpio_wlan.chip); +} +arch_initcall(adm8668_gpio_init); diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c new file mode 100644 index 000000000..9d3b2b9b8 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2010 Scott Nicholas + * Copyright (C) 2012 Florian Fainelli + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* interrupt controller */ +#define IRQ_STATUS_REG 0x00 /* Read */ +#define IRQ_ENABLE_REG 0x08 /* Read/Write */ +#define IRQ_DISABLE_REG 0x0C /* Write */ + +#define IRQ_MASK 0xffff + +static inline void intc_write_reg(u32 val, unsigned int reg) +{ + void __iomem *base = (void __iomem *)KSEG1ADDR(ADM8668_INTC_BASE); + + __raw_writel(val, base + reg); +} + +static inline u32 intc_read_reg(unsigned int reg) +{ + void __iomem *base = (void __iomem *)KSEG1ADDR(ADM8668_INTC_BASE); + + return __raw_readl(base + reg); +} + +static void adm8668_irq_cascade(void) +{ + int irq; + u32 intsrc; + + intsrc = intc_read_reg(IRQ_STATUS_REG) & IRQ_MASK; + if (intsrc) { + irq = fls(intsrc) - 1; + do_IRQ(irq); + } else + spurious_interrupt(); +} + +/* + * System irq dispatch + */ +void plat_irq_dispatch(void) +{ + unsigned int pending; + + pending = read_c0_cause() & read_c0_status() & ST0_IM; + + /* timer interrupt, that we renumbered */ + if (pending & STATUSF_IP7) + do_IRQ(MIPS_CPU_IRQ_BASE + 7); + else if (pending & STATUSF_IP2) + adm8668_irq_cascade(); + else + spurious_interrupt(); +} + +/* + * enable 8668 irq + */ +static void enable_adm8668_irq(struct irq_data *d) +{ + intc_write_reg((1 << d->irq), IRQ_ENABLE_REG); +} + + +static void ack_adm8668_irq(struct irq_data *d) +{ + intc_write_reg((1 << d->irq), IRQ_DISABLE_REG); +} + +/* + * system irq type + */ + +static struct irq_chip adm8668_irq_type = { + .name = "adm8668", + .irq_ack = ack_adm8668_irq, + .irq_mask = ack_adm8668_irq, + .irq_unmask = enable_adm8668_irq +}; + +/* + * irq init + */ +static void __init init_adm8668_irqs(void) +{ + int i; + + /* disable all interrupts for the moment */ + intc_write_reg(IRQ_MASK, IRQ_DISABLE_REG); + + for (i = 0; i <= ADM8668_IRQ_MAX; i++) + irq_set_chip_and_handler(i, &adm8668_irq_type, + handle_level_irq); + + /* hw0 is where our interrupts are uh.. interrupted at. */ + set_c0_status(IE_IRQ0); +} + +/* + * system init + */ +void __init arch_init_irq(void) +{ + mips_cpu_irq_init(); + init_adm8668_irqs(); +} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c new file mode 100644 index 000000000..9e40691f9 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2010 Scott Nicholas + * Copyright (C) 2012 Florian Fainelli + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define ADM8868_UBOOT_ENV 0x20000 +#define ADM8868_UBOOT_WAN_MAC 0x5ac +#define ADM8868_UBOOT_LAN_MAC 0x404 + +static void adm8668_uart_set_mctrl(struct amba_device *dev, + void __iomem *base, + unsigned int mcrtl) +{ +} + +static struct amba_pl010_data adm8668_uart0_data = { + .set_mctrl = adm8668_uart_set_mctrl, +}; + +static struct amba_device adm8668_uart0_device = { + .dev = { + .init_name = "apb:uart0", + .platform_data = &adm8668_uart0_data, + }, + .res = { + .start = ADM8668_UART0_BASE, + .end = ADM8668_UART0_BASE + 0xF, + .flags = IORESOURCE_MEM, + }, + .irq = { + ADM8668_UART0_IRQ, + -1 + }, + .periphid = 0x0041010, +}; + +static struct resource eth0_resources[] = { + { + .start = ADM8668_LAN_BASE, + .end = ADM8668_LAN_BASE + 256, + .flags = IORESOURCE_MEM, + }, + { + .start = ADM8668_LAN_IRQ, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct tulip_platform_data eth0_pdata = { + .chip_id = ADM8668, +}; + +static struct platform_device adm8668_eth0_device = { + .name = "tulip", + .id = 0, + .resource = eth0_resources, + .num_resources = ARRAY_SIZE(eth0_resources), + .dev.platform_data = ð0_pdata, +}; + +static struct resource eth1_resources[] = { + { + .start = ADM8668_WAN_BASE, + .end = ADM8668_WAN_BASE + 256, + .flags = IORESOURCE_MEM, + }, + { + .start = ADM8668_WAN_IRQ, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct tulip_platform_data eth1_pdata = { + .chip_id = ADM8668, +}; + +static struct platform_device adm8668_eth1_device = { + .name = "tulip", + .id = 1, + .resource = eth1_resources, + .num_resources = ARRAY_SIZE(eth1_resources), + .dev.platform_data = ð1_pdata, +}; + +static struct resource usb_resources[] = { + { + .start = ADM8668_USB_BASE, + .end = ADM8668_USB_BASE + 0x1FFFFF, + .flags = IORESOURCE_MEM, + }, + { + .start = ADM8668_USB_IRQ, + .end = ADM8668_USB_IRQ, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct usb_ehci_pdata usb_pdata = { + .caps_offset = 0x100, + .has_tt = 1, +}; + +static struct platform_device adm8668_usb_device = { + .name = "ehci-platform", + .id = -1, + .resource = usb_resources, + .num_resources = ARRAY_SIZE(usb_resources), + .dev.platform_data = &usb_pdata, +}; + +static struct platform_device *adm8668_devs[] = { + &adm8668_eth0_device, + &adm8668_eth1_device, + &adm8668_usb_device, +}; + +static void adm8668_fetch_mac(int unit) +{ + u8 *mac; + u32 offset; + struct tulip_platform_data *pdata; + + switch (unit) { + case -1: + case 0: + offset = ADM8868_UBOOT_LAN_MAC; + pdata = ð0_pdata; + break; + case 1: + offset = ADM8868_UBOOT_WAN_MAC; + pdata = ð1_pdata; + break; + default: + pr_err("unsupported ethernet unit: %d\n", unit); + return; + } + + mac = (u8 *)(KSEG1ADDR(ADM8668_SMEM1_BASE) + ADM8868_UBOOT_ENV + offset); + + memcpy(pdata->mac, mac, sizeof(pdata->mac)); +} + +static void adm8668_ehci_workaround(void) +{ + u32 chipid; + + chipid = ADM8668_CONFIG_REG(ADM8668_CR0); + ADM8668_CONFIG_REG(ADM8668_CR66) = 0x0C1600D9; + + if (chipid == 0x86880001) + return; + + ADM8668_CONFIG_REG(ADM8668_CR66) &= ~(3 << 20); + ADM8668_CONFIG_REG(ADM8668_CR66) |= (1 << 20); + pr_info("ADM8668: applied USB workaround\n"); +} + + +int __init adm8668_devs_register(void) +{ + int ret; + + ret = amba_device_register(&adm8668_uart0_device, &iomem_resource); + if (ret) + panic("failed to register AMBA UART"); + + adm8668_fetch_mac(0); + adm8668_fetch_mac(1); + adm8668_ehci_workaround(); + + return platform_add_devices(adm8668_devs, ARRAY_SIZE(adm8668_devs)); +} +arch_initcall(adm8668_devs_register); diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c new file mode 100644 index 000000000..cb97bb30a --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2010 Scott Nicholas + * + * based on work of rb532 prom.c + * Copyright (C) 2003, Peter Sadik + * Copyright (C) 2005-2006, P.Christeas + * Copyright (C) 2007, Gabor Juhos + * Felix Fietkau + * Florian Fainelli + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "u-boot.h" + +register volatile struct global_data *gd asm ("k0"); + +void __init prom_free_prom_memory(void) +{ + /* No prom memory to free */ +} + +static inline int match_tag(char *arg, const char *tag) +{ + return strncmp(arg, tag, strlen(tag)) == 0; +} + +static inline unsigned long tag2ul(char *arg, const char *tag) +{ + char *num; + + num = arg + strlen(tag); + return simple_strtoul(num, 0, 10); +} + +void __init prom_setup_cmdline(void) +{ + char *cp; + int prom_argc; + char **prom_argv; + int i; + + prom_argc = fw_arg0; + prom_argv = (char **)KSEG0ADDR(fw_arg1); + + cp = &(arcs_cmdline[0]); + for (i = 1; i < prom_argc; i++) { + prom_argv[i] = (char *)KSEG0ADDR(prom_argv[i]); + + /* default bootargs has "console=/dev/ttyS0" yet console won't + * show up at all if you include the '/dev/' nowadays ... */ + if (match_tag(prom_argv[i], "console=/dev/")) { + char *ptr = prom_argv[i] + strlen("console=/dev/"); + + strcpy(cp, "console="); + cp += strlen("console="); + strcpy(cp, ptr); + cp += strlen(ptr); + *cp++ = ' '; + continue; + } + strcpy(cp, prom_argv[i]); + cp += strlen(prom_argv[i]); + *cp++ = ' '; + } + if (prom_argc > 1) + --cp; /* trailing space */ + + *cp = '\0'; +} + +void __init prom_init(void) +{ + bd_t *bd = gd->bd; + int memsize; + + memsize = bd->bi_memsize; + printk("Board info:\n"); + printk(" RAM size: %d MB\n", (int)memsize/(1024*1024)); + printk(" NOR start: %#lx\n", bd->bi_flashstart); + printk(" NOR size: %#lx\n", bd->bi_flashsize); + + prom_setup_cmdline(); + add_memory_region(0, memsize, BOOT_MEM_RAM); +} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c new file mode 100644 index 000000000..b33c483d2 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c @@ -0,0 +1,36 @@ +#include +#include + +#include +#include + +static void adm8668_restart(char *cmd) +{ + int i; + + /* the real deal */ + for (i = 0; i < 1000; i++) + ; + ADM8668_CONFIG_REG(ADM8668_CR1) = 1; +} + +void __init plat_mem_setup(void) +{ + _machine_restart = adm8668_restart; +} + +const char *get_system_type(void) +{ + unsigned long chipid = ADM8668_CONFIG_REG(ADM8668_CR0); + int product, revision; + static char ret[32]; + + product = chipid >> 16; + revision = chipid & 0xffff; + + /* i getting fancy :\ */ + snprintf(ret, sizeof(ret), "ADM%xr%x", product, revision); + + return ret; +} + diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c new file mode 100644 index 000000000..87bdd6696 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c @@ -0,0 +1,20 @@ +#include +#include +#include + +#include +#include + +void __init plat_time_init(void) +{ + struct clk *sys_clk; + + adm8668_init_clocks(); + + sys_clk = clk_get(NULL, "sys"); + if (IS_ERR(sys_clk)) + panic("unable to get system clock\n"); + + mips_hpt_frequency = clk_get_rate(sys_clk) / 2; +} + diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h b/target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h new file mode 100644 index 000000000..d9d226889 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h @@ -0,0 +1,52 @@ +/* + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _U_BOOT_H_ +#define _U_BOOT_H_ 1 + +typedef struct bd_info { + int bi_baudrate; /* serial console baudrate */ + unsigned long bi_ip_addr; /* IP Address */ + unsigned char bi_enetaddr[6]; /* Ethernet adress */ + unsigned long bi_arch_number; /* unique id for this board */ + unsigned long bi_boot_params; /* where this board expects params */ + unsigned long bi_memstart; /* start of DRAM memory */ + unsigned long bi_memsize; /* size of DRAM memory in bytes */ + unsigned long bi_flashstart; /* start of FLASH memory */ + unsigned long bi_flashsize; /* size of FLASH memory */ + unsigned long bi_flashoffset; /* reserved area for startup monitor */ +} bd_t; + +struct global_data { + bd_t *bd; /* board data... */ + unsigned long flags; + unsigned long baudrate; + unsigned long have_console; /* serial_init() was called */ + unsigned long ram_size; /* RAM size */ + unsigned long reloc_off; /* Relocation Offset */ + unsigned long env_addr; /* Address of Environment struct */ + unsigned long env_valid; /* Checksum of Environment valid? */ + void **jt; /* jump table */ +}; + +#endif /* _U_BOOT_H_ */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h new file mode 100644 index 000000000..8a16863c0 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h @@ -0,0 +1,69 @@ +/************************************************************************ + * + * Copyright (c) 2005 + * Infineon Technologies AG + * St. Martin Strasse 53; 81669 Muenchen; Germany + * + ************************************************************************/ + +#ifndef __ADM8668_H__ +#define __ADM8668_H__ + +/*======================= Physical Memory Map ============================*/ +#define ADM8668_SDRAM_BASE 0 +#define ADM8668_SMEM1_BASE 0x10000000 +#define ADM8668_MPMC_BASE 0x11000000 +#define ADM8668_USB_BASE 0x11200000 +#define ADM8668_CONFIG_BASE 0x11400000 +#define ADM8668_WAN_BASE 0x11600000 +#define ADM8668_WLAN_BASE 0x11800000 +#define ADM8668_LAN_BASE 0x11A00000 +#define ADM8668_INTC_BASE 0x1E000000 +#define ADM8668_TMR_BASE 0x1E200000 +#define ADM8668_UART0_BASE 0x1E400000 +#define ADM8668_SMEM0_BASE 0x1FC00000 +#define ADM8668_NAND_BASE 0x1FFFFF00 + +#define ADM8668_PCICFG_BASE 0x12200000 +#define ADM8668_PCIDAT_BASE 0x12400000 + +/* interrupt levels */ +#define ADM8668_SWI_IRQ 1 +#define ADM8668_COMMS_RX_IRQ 2 +#define ADM8668_COMMS_TX_IRQ 3 +#define ADM8668_TIMER0_IRQ 4 +#define ADM8668_TIMER1_IRQ 5 +#define ADM8668_UART0_IRQ 6 +#define ADM8668_LAN_IRQ 7 +#define ADM8668_WAN_IRQ 8 +#define ADM8668_WLAN_IRQ 9 +#define ADM8668_GPIO_IRQ 10 +#define ADM8668_IDE_IRQ 11 +#define ADM8668_PCI2_IRQ 12 +#define ADM8668_PCI1_IRQ 13 +#define ADM8668_PCI0_IRQ 14 +#define ADM8668_USB_IRQ 15 +#define ADM8668_IRQ_MAX ADM8668_USB_IRQ + +/* register access macros */ +#define ADM8668_CONFIG_REG(_reg) \ + (*((volatile unsigned int *)(KSEG1ADDR(ADM8668_CONFIG_BASE + (_reg))))) + +/* lan registers */ +#define NETCSR6 0x30 +#define NETCSR7 0x38 +#define NETCSR37 0xF8 + +/* known/used CPU configuration registers */ +#define ADM8668_CR0 0x00 +#define ADM8668_CR1 0x04 +#define ADM8668_CR3 0x0C +#define ADM8668_CR66 0x108 + +/** For GPIO control **/ +#define GPIO_REG 0x5C /* on WLAN */ +#define CRGPIO_REG 0x20 /* on CPU */ + +void adm8668_init_clocks(void); + +#endif /* __ADM8668_H__ */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h new file mode 100644 index 000000000..503843db1 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* DO NOT EDIT!! - this file automatically generated + * from .s file by awk -f s2h.awk + */ +/* Size definitions + * Copyright (C) ARM Limited 1998. All rights reserved. + */ + +#ifndef __sizes_h +#define __sizes_h 1 + +/* handy sizes */ +#define SZ_16 0x00000010 +#define SZ_256 0x00000100 +#define SZ_512 0x00000200 + +#define SZ_1K 0x00000400 +#define SZ_4K 0x00001000 +#define SZ_8K 0x00002000 +#define SZ_16K 0x00004000 +#define SZ_64K 0x00010000 +#define SZ_128K 0x00020000 +#define SZ_256K 0x00040000 +#define SZ_512K 0x00080000 + +#define SZ_1M 0x00100000 +#define SZ_2M 0x00200000 +#define SZ_4M 0x00400000 +#define SZ_8M 0x00800000 +#define SZ_16M 0x01000000 +#define SZ_32M 0x02000000 +#define SZ_64M 0x04000000 +#define SZ_128M 0x08000000 +#define SZ_256M 0x10000000 +#define SZ_512M 0x20000000 + +#define SZ_1G 0x40000000 +#define SZ_2G 0x80000000 + +#endif + +/* END */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h new file mode 100644 index 000000000..b0473fc4b --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h @@ -0,0 +1,13 @@ +#ifndef __ADM8668_GPIO_H__ +#define __ADM8668_GPIO_H__ + +#define gpio_to_irq(gpio) -1 + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value + +#define gpio_cansleep __gpio_cansleep + +#include + +#endif diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h new file mode 100644 index 000000000..ea859f03a --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h @@ -0,0 +1,14 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2003 by Ralf Baechle + */ +#ifndef __ASM_MACH_ADM8668_IRQ_H +#define __ASM_MACH_ADM8668_IRQ_H + +#define NR_IRQS 32 +#define MIPS_CPU_IRQ_BASE 16 + +#endif /* __ASM_MACH_ADM8668_IRQ_H */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h new file mode 100644 index 000000000..7180043d3 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h @@ -0,0 +1,25 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2002, 2004, 2007 by Ralf Baechle + */ +#ifndef __ASM_MIPS_MACH_ADM8668_WAR_H +#define __ASM_MIPS_MACH_ADM8668_WAR_H + +#define R4600_V1_INDEX_ICACHEOP_WAR 0 +#define R4600_V1_HIT_CACHEOP_WAR 0 +#define R4600_V2_HIT_CACHEOP_WAR 0 +#define R5432_CP0_INTERRUPT_WAR 0 +#define BCM1250_M3_WAR 0 +#define SIBYTE_1956_WAR 0 +#define MIPS4K_ICACHE_REFILL_WAR 0 +#define MIPS_CACHE_SYNC_WAR 0 +#define TX49XX_ICACHE_INDEX_INV_WAR 0 +#define RM9000_CDEX_SMP_WAR 0 +#define ICACHE_REFILLS_WORKAROUND_WAR 0 +#define R10000_LLSC_WAR 0 +#define MIPS34K_MISSED_ITLB_WAR 0 + +#endif /* __ASM_MIPS_MACH_ADM8668_WAR_H */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c b/target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c new file mode 100644 index 000000000..5cfa54604 --- /dev/null +++ b/target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2010 Scott Nicholas + * Copyright (C) 2012 Florian Fainelli + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Note that this controller is identical to the ADM5120 one + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +static DEFINE_SPINLOCK(pci_lock); + +#define PCI_ENABLE 0x80000000 +#define ADMPCI_IO_BASE 0x12600000 +#define ADMPCI_IO_SIZE 0x1fffff +#define ADMPCI_MEM_BASE 0x16000000 +#define ADMPCI_MEM_SIZE 0x7ffffff + +static inline void write_cfgaddr(u32 addr) +{ + __raw_writel((addr | PCI_ENABLE), + (void __iomem *)KSEG1ADDR(ADM8668_PCICFG_BASE)); +} + +static inline void write_cfgdata(u32 data) +{ + __raw_writel(data, (void __iomem *)KSEG1ADDR(ADM8668_PCIDAT_BASE)); +} + +static inline u32 read_cfgdata(void) +{ + return __raw_readl((void __iomem *)KSEG1ADDR(ADM8668_PCIDAT_BASE)); +} + +static inline u32 mkaddr(struct pci_bus *bus, unsigned int devfn, int where) +{ + return ((bus->number & 0xff) << 16) | ((devfn & 0xff) << 8) | + (where & 0xfc); +} + +static int pci_read_config(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 *val) +{ + unsigned long flags; + u32 data; + + spin_lock_irqsave(&pci_lock, flags); + write_cfgaddr(mkaddr(bus, devfn, where)); + data = read_cfgdata(); + + switch (size) { + case 1: + if (where & 1) + data >>= 8; + if (where & 2) + data >>= 16; + data &= 0xff; + break; + case 2: + if (where & 2) + data >>= 16; + data &= 0xffff; + break; + } + + *val = data; + + spin_unlock_irqrestore(&pci_lock, flags); + + return PCIBIOS_SUCCESSFUL; +} + +static int pci_write_config(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 val) +{ + unsigned long flags; + u32 data; + int s; + + spin_lock_irqsave(&pci_lock, flags); + + write_cfgaddr(mkaddr(bus, devfn, where)); + data = read_cfgdata(); + + switch (size) { + case 1: + s = ((where & 3) << 3); + data &= ~(0xff << s); + data |= ((val & 0xff) << s); + break; + case 2: + s = ((where & 2) << 4); + data &= ~(0xffff << s); + data |= ((val & 0xffff) << s); + break; + case 4: + data = val; + break; + } + + write_cfgdata(data); + + spin_unlock_irqrestore(&pci_lock, flags); + + return PCIBIOS_SUCCESSFUL; +} + +struct pci_ops adm8668_pci_ops = { + .read = pci_read_config, + .write = pci_write_config +}; + + +struct resource pciioport_resource = { + .name = "adm8668_pci", + .start = ADMPCI_IO_BASE, + .end = ADMPCI_IO_BASE + ADMPCI_IO_SIZE, + .flags = IORESOURCE_IO +}; + +struct resource pciiomem_resource = { + .name = "adm8668_pci", + .start = ADMPCI_MEM_BASE, + .end = ADMPCI_MEM_BASE + ADMPCI_MEM_SIZE, + .flags = IORESOURCE_MEM +}; + +struct pci_controller adm8668_pci_controller = { + .pci_ops = &adm8668_pci_ops, + .io_resource = &pciioport_resource, + .mem_resource = &pciiomem_resource, +}; + +int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ + switch (slot) { + case 1: + return 14; + case 2: + return 13; + case 3: + return 12; + default: + return dev->irq; + } +} + +int pcibios_plat_dev_init(struct pci_dev *dev) +{ + return 0; +} + +static void adm8668_pci_fixup(struct pci_dev *dev) +{ + if (dev->devfn != 0) + return; + + pr_info("PCI: fixing up ADM8668 controller\n"); + + /* setup COMMAND register */ + pci_write_config_word(dev, PCI_COMMAND, + (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)); + + /* setup CACHE_LINE_SIZE register */ + pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4); + + /* setup BARS */ + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0); + pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0); +} +DECLARE_PCI_FIXUP_HEADER(0x1317, 0x8688, adm8668_pci_fixup); + +static int __init adm8668_pci_init(void) +{ + void __iomem *io_map_base; + + ioport_resource.start = ADMPCI_IO_BASE; + ioport_resource.end = ADMPCI_IO_BASE + ADMPCI_IO_SIZE; + + io_map_base = ioremap(ADMPCI_IO_BASE, ADMPCI_IO_SIZE); + if (!io_map_base) + printk("io_map_base didn't work.\n"); + + adm8668_pci_controller.io_map_base = (unsigned long)io_map_base; + register_pci_controller(&adm8668_pci_controller); + + return 0; +} +arch_initcall(adm8668_pci_init); diff --git a/target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c b/target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c new file mode 100644 index 000000000..7e51d5828 --- /dev/null +++ b/target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c @@ -0,0 +1,334 @@ +/* + * Copyright (C) 2010 Scott Nicholas + * Copyright (C) 2006 Felix Fietkau + * Copyright (C) 2005 Waldemar Brodkorb + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) + * + * original functions for finding root filesystem from Mike Baker + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Flash mapping for adm8668 boards + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define WINDOW_ADDR 0x10000000 +#define WINDOW_SIZE 0x800000 +#define BANKWIDTH 2 + +/* first a little bit about the headers i need.. */ + +/* just interested in part of the full struct */ +struct squashfs_super_block { + __le32 s_magic; + __le32 pad0[9]; /* it's not really padding */ + __le64 bytes_used; +}; + +#define IH_MAGIC 0x56190527 /* Image Magic Number */ +struct uboot_header { + uint32_t ih_magic; /* Image Header Magic Number */ + uint32_t ih_hcrc; /* Image Header CRC Checksum */ + uint32_t ih_time; /* Image Creation Timestamp */ + uint32_t ih_size; /* Image Data Size */ + uint32_t ih_load; /* Data Load Address */ + uint32_t ih_ep; /* Entry Point Address */ + uint32_t ih_dcrc; /* Image Data CRC Checksum */ + uint8_t ih_os; /* Operating System */ + uint8_t ih_arch; /* CPU architecture */ + uint8_t ih_type; /* Image Type */ + uint8_t ih_comp; /* Compression Type */ + char ih_name[32]; /* image name */ +}; + +/************************************************/ + +static struct mtd_info *adm8668_mtd; + +struct map_info adm8668_map = { + name: "adm8668-nor", + size: WINDOW_SIZE, + phys: WINDOW_ADDR, + bankwidth: BANKWIDTH, +}; + +/* + * Copied from mtdblock.c + * + * Cache stuff... + * + * Since typical flash erasable sectors are much larger than what Linux's + * buffer cache can handle, we must implement read-modify-write on flash + * sectors for each block write requests. To avoid over-erasing flash sectors + * and to speed things up, we locally cache a whole flash sector while it is + * being written to until a different sector is required. + */ + +static void erase_callback(struct erase_info *done) +{ + wait_queue_head_t *wait_q = (wait_queue_head_t *)done->priv; + wake_up(wait_q); +} + +static int erase_write (struct mtd_info *mtd, unsigned long pos, + int len, const char *buf) +{ + struct erase_info erase; + DECLARE_WAITQUEUE(wait, current); + wait_queue_head_t wait_q; + size_t retlen; + int ret; + + /* + * First, let's erase the flash block. + */ + + init_waitqueue_head(&wait_q); + erase.mtd = mtd; + erase.callback = erase_callback; + erase.addr = pos; + erase.len = len; + erase.priv = (u_long)&wait_q; + + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&wait_q, &wait); + + ret = mtd->_erase(mtd, &erase); + if (ret) { + set_current_state(TASK_RUNNING); + remove_wait_queue(&wait_q, &wait); + printk (KERN_WARNING "erase of region [0x%lx, 0x%x] " + "on \"%s\" failed\n", + pos, len, mtd->name); + return ret; + } + + schedule(); /* Wait for erase to finish. */ + remove_wait_queue(&wait_q, &wait); + + /* + * Next, write data to flash. + */ + + ret = mtd->_write (mtd, pos, len, &retlen, buf); + if (ret) + return ret; + if (retlen != len) + return -EIO; + return 0; +} + +/* decent defaults in case... shrug */ +static struct mtd_partition adm8668_parts[] = { + { name: "linux", offset: 0x40000, size: WINDOW_SIZE-0x40000, }, + { name: "rootfs", offset: 0xe0000, size: 0x140000, }, + { name: "uboot_env", offset: 0x20000, size: 0x20000, }, + { name: NULL, }, +}; + +/* in case i wanna change stuff later, and to clarify the math section... */ +#define PART_LINUX 0 +#define PART_ROOTFS 1 +#define NR_PARTS 3 + +static int __init +init_mtd_partitions(struct mtd_info *mtd, size_t size) +{ + struct uboot_header uhdr; + int off, blocksize; + size_t len, linux_len; + struct squashfs_super_block shdr; + + blocksize = mtd->erasesize; + if (blocksize < 0x10000) + blocksize = 0x10000; + + /* now find squashfs */ + memset(&shdr, 0xe5, sizeof(shdr)); + for (off = adm8668_parts[PART_LINUX].offset; off < size; off += blocksize) { + /* + * Read into buffer + */ + if (mtd->_read(mtd, off, sizeof(shdr), &len, (char *)&shdr) || + len != sizeof(shdr)) + continue; + + if (shdr.s_magic == SQUASHFS_MAGIC) { + uint32_t fs_size = (uint32_t)shdr.bytes_used; + + printk(KERN_INFO "%s: Filesystem type: squashfs, size=%dkB\n", + mtd->name, fs_size>>10); + + /* Update rootfs based on the superblock info, and + * stretch to end of MTD. rootfs_split will split it */ + adm8668_parts[PART_ROOTFS].offset = off; + adm8668_parts[PART_ROOTFS].size = mtd->size - + adm8668_parts[PART_ROOTFS].offset; + + /* kernel ends where rootfs starts + * but we'll keep it full-length for upgrades */ + linux_len = adm8668_parts[PART_LINUX+1].offset - + adm8668_parts[PART_LINUX].offset; +#if 1 + adm8668_parts[PART_LINUX].size = mtd->size - + adm8668_parts[PART_LINUX].offset; +#else + adm8668_parts[PART_LINUX].size = linux_len; +#endif + goto found; + } + } + + printk(KERN_NOTICE + "%s: Couldn't find root filesystem\n", + mtd->name); + return NR_PARTS; + + found: + if (mtd->_read(mtd, adm8668_parts[PART_LINUX].offset, sizeof(uhdr), &len, (char *)&uhdr) || + len != sizeof(uhdr)) + return NR_PARTS; + + /* that's odd. how'd ya boot it then */ + if (uhdr.ih_magic != IH_MAGIC) + return NR_PARTS; + + if (be32_to_cpu(uhdr.ih_size) != (linux_len - sizeof(uhdr))) { + unsigned char *block, *data; + unsigned int offset; + + offset = adm8668_parts[PART_LINUX].offset + + sizeof(struct uboot_header); + data = (unsigned char *)(WINDOW_ADDR | 0xA0000000 | offset); + + printk(KERN_NOTICE "Updating U-boot image:\n"); + printk(KERN_NOTICE " old: [size: %8d crc32: 0x%08x]\n", + be32_to_cpu(uhdr.ih_size), be32_to_cpu(uhdr.ih_dcrc)); + + /* Update the data length & crc32 */ + uhdr.ih_size = cpu_to_be32(linux_len - sizeof(uhdr)); + uhdr.ih_dcrc = crc32_le(~0, data, linux_len - sizeof(uhdr)) ^ (~0); + uhdr.ih_dcrc = cpu_to_be32(uhdr.ih_dcrc); + + printk(KERN_NOTICE " new: [size: %8d crc32: 0x%08x]\n", + be32_to_cpu(uhdr.ih_size), be32_to_cpu(uhdr.ih_dcrc)); + + /* update header's crc... */ + uhdr.ih_hcrc = 0; + uhdr.ih_hcrc = crc32_le(~0, (unsigned char *)&uhdr, + sizeof(uhdr)) ^ (~0); + uhdr.ih_hcrc = cpu_to_be32(uhdr.ih_hcrc); + + /* read first eraseblock from the image */ + block = kmalloc(mtd->erasesize, GFP_KERNEL); + if (mtd->_read(mtd, adm8668_parts[PART_LINUX].offset, mtd->erasesize, &len, block) || len != mtd->erasesize) { + printk("Error copying first eraseblock\n"); + return 0; + } + + /* Write updated header to the flash */ + memcpy(block, &uhdr, sizeof(uhdr)); + if (mtd->_unlock) + mtd->_unlock(mtd, off, mtd->erasesize); + erase_write(mtd, adm8668_parts[PART_LINUX].offset, mtd->erasesize, block); + if (mtd->_sync) + mtd->_sync(mtd); + kfree(block); + printk(KERN_NOTICE "Done\n"); + } + + return NR_PARTS; +} + +int __init init_adm8668_map(void) +{ + int nr_parts, ret; + + adm8668_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); + + if (!adm8668_map.virt) { + printk(KERN_ERR "Failed to ioremap\n"); + return -EIO; + } + + simple_map_init(&adm8668_map); + if (!(adm8668_mtd = do_map_probe("cfi_probe", &adm8668_map))) { + printk(KERN_ERR "cfi_probe failed\n"); + iounmap((void *)adm8668_map.virt); + return -ENXIO; + } + + adm8668_mtd->owner = THIS_MODULE; + + nr_parts = init_mtd_partitions(adm8668_mtd, adm8668_mtd->size); + ret = mtd_device_register(adm8668_mtd, adm8668_parts, nr_parts); + if (ret) { + printk(KERN_ERR "Flash: mtd_device_register failed\n"); + goto fail; + } + + return 0; + + fail: + if (adm8668_mtd) + map_destroy(adm8668_mtd); + if (adm8668_map.virt) + iounmap((void *) adm8668_map.virt); + adm8668_map.virt = 0; + return ret; +} + +void __exit cleanup_adm8668_map(void) +{ + mtd_device_unregister(adm8668_mtd); + map_destroy(adm8668_mtd); + iounmap((void *) adm8668_map.virt); + adm8668_map.virt = 0; +} + +module_init(init_adm8668_map); +module_exit(cleanup_adm8668_map); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Scott Nicholas "); +MODULE_DESCRIPTION("MTD map driver for ADM8668 NOR Flash"); diff --git a/target/linux/adm8668/image/Makefile b/target/linux/adm8668/image/Makefile new file mode 100644 index 000000000..597b8f74a --- /dev/null +++ b/target/linux/adm8668/image/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux +UIMAGE:=$(IMG_PREFIX)-uImage + +define kernel_entry +-a 0x80002000 -e 0x80002000 +endef + + +define CompressGzip + gzip -9n -c $(1) > $(2) +endef + +define MkImage + mkimage -A mips -O linux -T kernel $(call kernel_entry) -C $(1) $(2) \ + -n "ADM8668 Linux Kernel(2.4.31)" \ + -d $(3) $(4) +endef + +define Build/Clean + $(MAKE) -C lzma-loader clean +endef + +define Image/Prepare + cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma + $(MAKE) -C lzma-loader \ + KDIR="$(KDIR)" \ + clean compile + rm -f $(KDIR)/fs_mark + touch $(KDIR)/fs_mark + $(call prepare_generic_squashfs,$(KDIR)/fs_mark) +endef + +define Image/Build + ./my-mkimage $(KDIR)/loader.bin $(KDIR)/root.squashfs \ + $(KDIR)/fs_mark $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin +endef + +define Image/BuildKernel + cp $(KDIR)/vmlinux.elf $(VMLINUX).elf + cp $(KDIR)/vmlinux $(VMLINUX).bin + $(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz) + $(call MkImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(BIN_DIR)/$(UIMAGE)-gzip.bin) +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf + cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin + $(call CompressGzip,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.gz) + $(call MkImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(BIN_DIR)/$(UIMAGE)-initramfs-gzip.bin) +endif +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/adm8668/image/lzma-loader/Makefile b/target/linux/adm8668/image/lzma-loader/Makefile new file mode 100644 index 000000000..f6bc7cef3 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME := loader +PKG_VERSION := 0.05 + +PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)-$(PKG_VERSION)$(LOADER_TYPE) + +$(PKG_BUILD_DIR)/.prepared: + mkdir $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ + touch $@ + +$(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma + PATH="$(TARGET_PATH)" $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" CROSS_COMPILE="$(TARGET_CROSS)" + +$(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma + $(CP) $< $@ + +$(KDIR)/loader$(LOADER_TYPE).elf: $(PKG_BUILD_DIR)/lzma.elf + $(CP) $< $@ + +$(KDIR)/loader$(LOADER_TYPE).bin: $(PKG_BUILD_DIR)/lzma.bin + $(CP) $< $@ + +download: +prepare: $(PKG_BUILD_DIR)/.prepared +compile: $(KDIR)/loader$(LOADER_TYPE).elf $(KDIR)/loader$(LOADER_TYPE).bin +install: + +clean: + rm -rf $(PKG_BUILD_DIR) + rm -f $(KDIR)/loader.elf + rm -f $(KDIR)/loader.bin diff --git a/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c b/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c new file mode 100644 index 000000000..8c863efe5 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c @@ -0,0 +1,590 @@ +/* + LzmaDecode.c + LZMA Decoder (optimized for Speed version) + + LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaDecode.h" + +#ifndef Byte +#define Byte unsigned char +#endif + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*Buffer++) + +#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ + { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} + +#ifdef _LZMA_IN_CB + +#define RC_TEST { if (Buffer == BufferLim) \ + { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ + BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} + +#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 + +#else + +#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } + +#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 + +#endif + +#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } + +#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) +#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; +#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; + +#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ + { UpdateBit0(p); mi <<= 1; A0; } else \ + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + +#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ + { int i = numLevels; res = 1; \ + do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ + res -= (1 << numLevels); } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +#if 0 +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + #ifdef _LZMA_OUT_READ + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + } + #endif + return LZMA_RESULT_OK; +} +#endif + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) +{ + CProb *p = vs->Probs; + SizeT nowPos = 0; + Byte previousByte = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + + #ifdef _LZMA_OUT_READ + + UInt32 Range = vs->Range; + UInt32 Code = vs->Code; + #ifdef _LZMA_IN_CB + const Byte *Buffer = vs->Buffer; + const Byte *BufferLim = vs->BufferLim; + #else + const Byte *Buffer = inStream; + const Byte *BufferLim = inStream + inSize; + #endif + int state = vs->State; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + Byte *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + Byte tempDictionary[4]; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + #else /* if !_LZMA_OUT_READ */ + + int state = 0; + UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; + int len = 0; + const Byte *Buffer; + const Byte *BufferLim; + UInt32 Range; + UInt32 Code; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + + { + UInt32 i; + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + } + + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + + #endif /* _LZMA_OUT_READ */ + + while(nowPos < outSize) + { + CProb *prob; + UInt32 bound; + int posState = (int)( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & posStateMask); + + prob = p + IsMatch + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + int symbol = 1; + UpdateBit0(prob) + prob = p + Literal + (LZMA_LIT_SIZE * + ((( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + int matchByte; + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + #else + matchByte = outStream[nowPos - rep0]; + #endif + do + { + int bit; + CProb *probLit; + matchByte <<= 1; + bit = (matchByte & 0x100); + probLit = prob + 0x100 + bit + symbol; + RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) + } + while (symbol < 0x100); + } + while (symbol < 0x100) + { + CProb *probLit = prob + symbol; + RC_GET_BIT(probLit, symbol) + } + previousByte = (Byte)symbol; + + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #endif + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + UpdateBit1(prob); + prob = p + IsRep + state; + IfBit0(prob) + { + UpdateBit0(prob); + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < kNumLitStates ? 0 : 3; + prob = p + LenCoder; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG0 + state; + IfBit0(prob) + { + UpdateBit0(prob); + prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + #ifdef _LZMA_OUT_READ + UInt32 pos; + #endif + UpdateBit0(prob); + + #ifdef _LZMA_OUT_READ + if (distanceLimit == 0) + #else + if (nowPos == 0) + #endif + return LZMA_RESULT_DATA_ERROR; + + state = state < kNumLitStates ? 9 : 11; + #ifdef _LZMA_OUT_READ + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + #endif + + continue; + } + else + { + UpdateBit1(prob); + } + } + else + { + UInt32 distance; + UpdateBit1(prob); + prob = p + IsRepG1 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep1; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG2 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep2; + } + else + { + UpdateBit1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = p + RepLenCoder; + } + { + int numBits, offset; + CProb *probLen = prob + LenChoice; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + numBits = kLenNumLowBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenChoice2; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + numBits = kLenNumMidBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + numBits = kLenNumHighBits; + } + } + RangeDecoderBitTreeDecode(probLen, numBits, len); + len += offset; + } + + if (state < 4) + { + int posSlot; + state += kNumLitStates; + prob = p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = (2 | ((UInt32)posSlot & 1)); + if (posSlot < kEndPosModelIndex) + { + rep0 <<= numDirectBits; + prob = p + SpecPos + rep0 - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + RC_NORMALIZE + Range >>= 1; + rep0 <<= 1; + if (Code >= Range) + { + Code -= Range; + rep0 |= 1; + } + } + while (--numDirectBits != 0); + prob = p + Align; + rep0 <<= kNumAlignBits; + numDirectBits = kNumAlignBits; + } + { + int i = 1; + int mi = 1; + do + { + CProb *prob3 = prob + mi; + RC_GET_BIT2(prob3, mi, ; , rep0 |= i); + i <<= 1; + } + while(--numDirectBits != 0); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + #ifdef _LZMA_OUT_READ + if (rep0 > distanceLimit) + #else + if (rep0 > nowPos) + #endif + return LZMA_RESULT_DATA_ERROR; + + #ifdef _LZMA_OUT_READ + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + #endif + + do + { + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + RC_NORMALIZE; + + #ifdef _LZMA_OUT_READ + vs->Range = Range; + vs->Code = Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = globalPos + (UInt32)nowPos; + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + #endif + + #ifdef _LZMA_IN_CB + vs->Buffer = Buffer; + vs->BufferLim = BufferLim; + #else + *inSizeProcessed = (SizeT)(Buffer - inStream); + #endif + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} diff --git a/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h b/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h new file mode 100644 index 000000000..abc02d7ed --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h @@ -0,0 +1,131 @@ +/* + LzmaDecode.h + LZMA Decoder interface + + LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#ifndef __LZMADECODE_H +#define __LZMADECODE_H + +/* #define _LZMA_IN_CB */ +/* Use callback for input data */ + +/* #define _LZMA_OUT_READ */ +/* Use read function for output data */ + +/* #define _LZMA_PROB32 */ +/* It can increase speed on some 32-bit CPUs, + but memory usage will be doubled in that case */ + +/* #define _LZMA_LOC_OPT */ +/* Enable local speed optimizations inside code */ + +/* #define _LZMA_SYSTEM_SIZE_T */ +/* Use system's size_t. You can use it to enable 64-bit sizes supporting*/ + +#ifndef UInt32 +#ifdef _LZMA_UINT32_IS_ULONG +#define UInt32 unsigned long +#else +#define UInt32 unsigned int +#endif +#endif + +#ifndef SizeT +#ifdef _LZMA_SYSTEM_SIZE_T +#include +#define SizeT size_t +#else +#define SizeT UInt32 +#endif +#endif + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb unsigned short +#endif + +#define LZMA_RESULT_OK 0 +#define LZMA_RESULT_DATA_ERROR 1 + +#ifdef _LZMA_IN_CB +typedef struct _ILzmaInCallback +{ + int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); +} ILzmaInCallback; +#endif + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LZMA_PROPERTIES_SIZE 5 + +typedef struct _CLzmaProperties +{ + int lc; + int lp; + int pb; + #ifdef _LZMA_OUT_READ + UInt32 DictionarySize; + #endif +}CLzmaProperties; + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); + +#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) + +#define kLzmaNeedInitId (-2) + +typedef struct _CLzmaDecoderState +{ + CLzmaProperties Properties; + CProb *Probs; + + #ifdef _LZMA_IN_CB + const unsigned char *Buffer; + const unsigned char *BufferLim; + #endif + + #ifdef _LZMA_OUT_READ + unsigned char *Dictionary; + UInt32 Range; + UInt32 Code; + UInt32 DictionaryPos; + UInt32 GlobalPos; + UInt32 DistanceLimit; + UInt32 Reps[4]; + int State; + int RemainLen; + unsigned char TempDictionary[4]; + #endif +} CLzmaDecoderState; + +#ifdef _LZMA_OUT_READ +#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } +#endif + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *inCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); + +#endif diff --git a/target/linux/adm8668/image/lzma-loader/src/Makefile b/target/linux/adm8668/image/lzma-loader/src/Makefile new file mode 100644 index 000000000..998e39081 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +RAMSTART = 0x80000000 +RAMSIZE = 0x00800000 # 8MB +LOADADDR = 0x80400000 # RAM start + 4M +KERNEL_ENTRY = 0x80002000 + +CROSS_COMPILE = mipsel-openwrt-linux- + +OBJCOPY:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S +CFLAGS := -I./include -fno-builtin -Os -G 0 -ffunction-sections -mno-abicalls -fno-pic -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -Wall -DRAMSTART=${RAMSTART} -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} + +.c.o: + $(CC) $(CFLAGS) -c $< -o $*.o + +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJDUMP = $(CROSS_COMPILE)objdump + +O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32) + +# Drop some uninteresting sections in the kernel. +# This is only relevant for ELF kernels but doesn't hurt a.out +drop-sections = .reginfo .mdebug .comment +strip-flags = $(addprefix --remove-section=,$(drop-sections)) + +all : lzma.elf lzma.bin + +lzma.lds: lzma.lds.in + sed -e 's,@LOADADDR@,$(LOADADDR),g' $< >$@ + +kernel.o: vmlinux.lzma lzma.lds + $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $< + +lzma.bin: lzma.elf + $(OBJCOPY) $< $@ + +lzma.elf: decompress.o stubs.o LzmaDecode.o kernel.o lzma.lds + $(LD) -T lzma.lds -o $@ $^ +#-s ^ + +clean: + rm -f *.o lzma.elf lzma.bin *.tmp *.lds diff --git a/target/linux/adm8668/image/lzma-loader/src/decompress.c b/target/linux/adm8668/image/lzma-loader/src/decompress.c new file mode 100644 index 000000000..f328058a1 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/decompress.c @@ -0,0 +1,118 @@ +/* + * LZMA compressed kernel decompressor for bcm947xx boards + * + * Copyright (C) 2005 by Oleg I. Vdovikin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * Please note, this was code based on the bunzip2 decompressor code + * by Manuel Novoa III (mjn3@codepoet.org), although the only thing left + * is an idea and part of original vendor code + * + * + * 12-Mar-2005 Mineharu Takahara + * pass actual output size to decoder (stream mode + * compressed input is not a requirement anymore) + * + * 24-Apr-2005 Oleg I. Vdovikin + * reordered functions using lds script, removed forward decl + * + * ??-Nov-2005 Mike Baker + * reorder the script as an lzma wrapper; do not depend on flash access + */ + +#include "LzmaDecode.h" +#include + +#define KSEG0ADDR(addr) (0x80000000|addr) + +register volatile gd_t *gd asm ("k0"); +unsigned char *data; + +static __inline__ unsigned char get_byte() +{ + unsigned char *buffer; + + buffer = data; + data++; + + return *buffer; +} + +/* This puts lzma workspace 128k below RAM end. + * That should be enough for both lzma and stack + */ +static char *buffer = (char *)(RAMSTART + RAMSIZE - 0x00020000); +extern char _binary_vmlinux_lzma_start[]; +extern char _binary_vmlinux_lzma_end[]; +extern char lzma_start[]; +extern char lzma_end[]; + +/* should be the first function */ +void entry(unsigned int arg0, unsigned int arg1, + unsigned int arg2, unsigned int arg3) +{ + unsigned int i; /* temp value */ + unsigned int isize; /* compressed size */ + unsigned int osize; /* uncompressed size */ + int argc = arg0; + char **argv = (char **)arg1; + char **envp = (char **)arg2; + + CLzmaDecoderState vs; + + data = (unsigned char *)_binary_vmlinux_lzma_start; + isize = _binary_vmlinux_lzma_end - _binary_vmlinux_lzma_start + 1; + + puts("\nLZMA kernel loader\n"); + + printf("lzma data @ %#x - %#x\n", _binary_vmlinux_lzma_start, _binary_vmlinux_lzma_end); + printf("load addr @ %#x\n\n", KERNEL_ENTRY); + printf("jump table @ %#x\n", gd->jt[3]); + + /* lzma args */ + i = get_byte(); + vs.Properties.lc = i % 9, i = i / 9; + vs.Properties.lp = i % 5, vs.Properties.pb = i / 5; + + vs.Probs = (CProb *)buffer; + + /* skip rest of the LZMA coder property */ + data += 4; + + /* read the lower half of uncompressed size in the header */ + osize = ((unsigned int)get_byte()) + + ((unsigned int)get_byte() << 8) + + ((unsigned int)get_byte() << 16) + + ((unsigned int)get_byte() << 24); + + /* skip rest of the header (upper half of uncompressed size) */ + data += 4; + + /* decompress kernel */ + puts("\nDecompressing kernel..."); + if ((i = LzmaDecode(&vs, + (unsigned char*)data, isize, &isize, + (unsigned char*)KERNEL_ENTRY, osize, &osize)) == LZMA_RESULT_OK) + { + puts("success!\n"); + + /* Jump to load address */ +// ((void (*)(int a0, int a1, int a2, int a3))KERNEL_ENTRY)(0,0,0,0); + ((void (*)(int a0, int a1, int a2, int a3))KERNEL_ENTRY)(arg0, arg1, arg2, arg3); + } + puts("failure!\n"); +} diff --git a/target/linux/adm8668/image/lzma-loader/src/include/_exports.h b/target/linux/adm8668/image/lzma-loader/src/include/_exports.h new file mode 100644 index 000000000..61dcaaf33 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/include/_exports.h @@ -0,0 +1,18 @@ +EXPORT_FUNC(get_version) +EXPORT_FUNC(getc) +EXPORT_FUNC(tstc) +EXPORT_FUNC(putc) +EXPORT_FUNC(puts) +EXPORT_FUNC(printf) +EXPORT_FUNC(install_hdlr) +EXPORT_FUNC(free_hdlr) +EXPORT_FUNC(malloc) +EXPORT_FUNC(free) +EXPORT_FUNC(udelay) +EXPORT_FUNC(get_timer) +EXPORT_FUNC(vprintf) +EXPORT_FUNC(do_reset) +#if (CONFIG_COMMANDS & CFG_CMD_I2C) +EXPORT_FUNC(i2c_write) +EXPORT_FUNC(i2c_read) +#endif /* CFG_CMD_I2C */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h b/target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h new file mode 100644 index 000000000..a024194ba --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h @@ -0,0 +1,60 @@ +/* + * (C) Copyright 2002-2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __ASM_GBL_DATA_H +#define __ASM_GBL_DATA_H + +#include + +/* + * The following data structure is placed in some memory wich is + * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or + * some locked parts of the data cache) to allow for a minimum set of + * global variables during system initialization (until we have set + * up the memory controller so that we can use RAM). + * + * Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t) + */ + +typedef struct global_data { + bd_t *bd; + unsigned long flags; + unsigned long baudrate; + unsigned long have_console; /* serial_init() was called */ + unsigned long ram_size; /* RAM size */ + unsigned long reloc_off; /* Relocation Offset */ + unsigned long env_addr; /* Address of Environment struct */ + unsigned long env_valid; /* Checksum of Environment valid? */ + void **jt; /* jump table */ +} gd_t; + +/* + * Global Data Flags + */ +#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ +#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ + +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0") + +#endif /* __ASM_GBL_DATA_H */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h b/target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h new file mode 100644 index 000000000..0de0b4da8 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h @@ -0,0 +1,42 @@ +/* + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _U_BOOT_H_ +#define _U_BOOT_H_ 1 + +typedef struct bd_info { + int bi_baudrate; /* serial console baudrate */ + unsigned long bi_ip_addr; /* IP Address */ + unsigned char bi_enetaddr[6]; /* Ethernet adress */ + unsigned long bi_arch_number; /* unique id for this board */ + unsigned long bi_boot_params; /* where this board expects params */ + unsigned long bi_memstart; /* start of DRAM memory */ + unsigned long bi_memsize; /* size of DRAM memory in bytes */ + unsigned long bi_flashstart; /* start of FLASH memory */ + unsigned long bi_flashsize; /* size of FLASH memory */ + unsigned long bi_flashoffset; /* reserved area for startup monitor */ +} bd_t; +#define bi_env_data bi_env->data +#define bi_env_crc bi_env->crc + +#endif /* _U_BOOT_H_ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/common.h b/target/linux/adm8668/image/lzma-loader/src/include/common.h new file mode 100644 index 000000000..5d957af6a --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/include/common.h @@ -0,0 +1,48 @@ +/* + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __COMMON_H_ +#define __COMMON_H_ 1 + +#undef _LINUX_CONFIG_H +#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */ + +typedef unsigned char uchar; +typedef volatile unsigned long vu_long; +typedef volatile unsigned short vu_short; +typedef volatile unsigned char vu_char; + +#include +#include +#include +#include +#include +#include + +typedef void (interrupt_handler_t)(void *); + +#include /* boot information for Linux kernel */ +#include /* global data used for startup functions */ + + +#endif /* __COMMON_H_ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/exports.h b/target/linux/adm8668/image/lzma-loader/src/include/exports.h new file mode 100644 index 000000000..4cdc36e37 --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/include/exports.h @@ -0,0 +1,38 @@ +#ifndef __EXPORTS_H__ +#define __EXPORTS_H__ +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#ifndef __ASSEMBLY__ + +#include + +/* These are declarations of exported functions available in C code */ +unsigned long get_version(void); +int getc(void); +int tstc(void); +void putc(const char); +void puts(const char*); +void printf(const char* fmt, ...); +void install_hdlr(int, interrupt_handler_t*, void*); +void free_hdlr(int); +void *malloc(size_t); +void free(void*); +void udelay(unsigned long); +unsigned long get_timer(unsigned long); +void vprintf(const char *, va_list); +void do_reset (void); + +void app_startup(char **); + +#endif /* ifndef __ASSEMBLY__ */ + +enum { +#define EXPORT_FUNC(x) XF_ ## x , +#include <_exports.h> +#undef EXPORT_FUNC + + XF_MAX +}; + +#define XF_VERSION 2 + +#endif /* __EXPORTS_H__ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/image.h b/target/linux/adm8668/image/lzma-loader/src/include/image.h new file mode 100644 index 000000000..69c73b71d --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/include/image.h @@ -0,0 +1,157 @@ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __IMAGE_H__ +#define __IMAGE_H__ + +/* + * Operating System Codes + */ +#define IH_OS_INVALID 0 /* Invalid OS */ +#define IH_OS_OPENBSD 1 /* OpenBSD */ +#define IH_OS_NETBSD 2 /* NetBSD */ +#define IH_OS_FREEBSD 3 /* FreeBSD */ +#define IH_OS_4_4BSD 4 /* 4.4BSD */ +#define IH_OS_LINUX 5 /* Linux */ +#define IH_OS_SVR4 6 /* SVR4 */ +#define IH_OS_ESIX 7 /* Esix */ +#define IH_OS_SOLARIS 8 /* Solaris */ +#define IH_OS_IRIX 9 /* Irix */ +#define IH_OS_SCO 10 /* SCO */ +#define IH_OS_DELL 11 /* Dell */ +#define IH_OS_NCR 12 /* NCR */ +#define IH_OS_LYNXOS 13 /* LynxOS */ +#define IH_OS_VXWORKS 14 /* VxWorks */ +#define IH_OS_PSOS 15 /* pSOS */ +#define IH_OS_QNX 16 /* QNX */ +#define IH_OS_U_BOOT 17 /* Firmware */ +#define IH_OS_RTEMS 18 /* RTEMS */ +#define IH_OS_ARTOS 19 /* ARTOS */ +#define IH_OS_UNITY 20 /* Unity OS */ + +/* + * CPU Architecture Codes (supported by Linux) + */ +#define IH_CPU_INVALID 0 /* Invalid CPU */ +#define IH_CPU_ALPHA 1 /* Alpha */ +#define IH_CPU_ARM 2 /* ARM */ +#define IH_CPU_I386 3 /* Intel x86 */ +#define IH_CPU_IA64 4 /* IA64 */ +#define IH_CPU_MIPS 5 /* MIPS */ +#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */ +#define IH_CPU_PPC 7 /* PowerPC */ +#define IH_CPU_S390 8 /* IBM S390 */ +#define IH_CPU_SH 9 /* SuperH */ +#define IH_CPU_SPARC 10 /* Sparc */ +#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */ +#define IH_CPU_M68K 12 /* M68K */ +#define IH_CPU_NIOS 13 /* Nios-32 */ +#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ +#define IH_CPU_NIOS2 15 /* Nios-II */ + +/* + * Image Types + * + * "Standalone Programs" are directly runnable in the environment + * provided by U-Boot; it is expected that (if they behave + * well) you can continue to work in U-Boot after return from + * the Standalone Program. + * "OS Kernel Images" are usually images of some Embedded OS which + * will take over control completely. Usually these programs + * will install their own set of exception handlers, device + * drivers, set up the MMU, etc. - this means, that you cannot + * expect to re-enter U-Boot except by resetting the CPU. + * "RAMDisk Images" are more or less just data blocks, and their + * parameters (address, size) are passed to an OS kernel that is + * being started. + * "Multi-File Images" contain several images, typically an OS + * (Linux) kernel image and one or more data images like + * RAMDisks. This construct is useful for instance when you want + * to boot over the network using BOOTP etc., where the boot + * server provides just a single image file, but you want to get + * for instance an OS kernel and a RAMDisk image. + * + * "Multi-File Images" start with a list of image sizes, each + * image size (in bytes) specified by an "uint32_t" in network + * byte order. This list is terminated by an "(uint32_t)0". + * Immediately after the terminating 0 follow the images, one by + * one, all aligned on "uint32_t" boundaries (size rounded up to + * a multiple of 4 bytes - except for the last file). + * + * "Firmware Images" are binary images containing firmware (like + * U-Boot or FPGA images) which usually will be programmed to + * flash memory. + * + * "Script files" are command sequences that will be executed by + * U-Boot's command interpreter; this feature is especially + * useful when you configure U-Boot to use a real shell (hush) + * as command interpreter (=> Shell Scripts). + */ + +#define IH_TYPE_INVALID 0 /* Invalid Image */ +#define IH_TYPE_STANDALONE 1 /* Standalone Program */ +#define IH_TYPE_KERNEL 2 /* OS Kernel Image */ +#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ +#define IH_TYPE_MULTI 4 /* Multi-File Image */ +#define IH_TYPE_FIRMWARE 5 /* Firmware Image */ +#define IH_TYPE_SCRIPT 6 /* Script file */ +#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ + +/* + * Compression Types + */ +#define IH_COMP_NONE 0 /* No Compression Used */ +#define IH_COMP_GZIP 1 /* gzip Compression Used */ +#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ + +#define IH_MAGIC 0x27051956 /* Image Magic Number */ +#define IH_NMLEN 32 /* Image Name Length */ + +#define IH_NAMEMAGIC 0x86680001 /* Name Magic Number */ +#define IH_SIZEMAX 5800000 /* Max image size */ +/* + * all data in network byte order (aka natural aka bigendian) + */ + +typedef struct image_header { + uint32_t ih_magic; /* Image Header Magic Number */ + uint32_t ih_hcrc; /* Image Header CRC Checksum */ + uint32_t ih_time; /* Image Creation Timestamp */ + uint32_t ih_size; /* Image Data Size */ + uint32_t ih_load; /* Data Load Address */ + uint32_t ih_ep; /* Entry Point Address */ + uint32_t ih_dcrc; /* Image Data CRC Checksum */ + uint8_t ih_os; /* Operating System */ + uint8_t ih_arch; /* CPU architecture */ + uint8_t ih_type; /* Image Type */ + uint8_t ih_comp; /* Compression Type */ +#ifdef NEW_IMAGE_HEADER + uint32_t ih_namemagic; /* image name CRC */ + uint8_t ih_name[IH_NMLEN-4]; /* image name */ +#else + uint8_t ih_name[IH_NMLEN]; /* Image Name */ +#endif +} image_header_t; + + +#endif /* __IMAGE_H__ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/lzma.lds.in b/target/linux/adm8668/image/lzma-loader/src/lzma.lds.in new file mode 100644 index 000000000..d6c60ca0d --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/lzma.lds.in @@ -0,0 +1,24 @@ +OUTPUT_ARCH(mips) +ENTRY(entry) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = @LOADADDR@; + .text : + { + _ftext = . ; + *(.text.entry) + *(.text) + lzma_start = .; + kernel.o + lzma_end = .; + *(.rodata) + } =0 + + .reginfo : { *(.reginfo) } + + .bss : + { + *(.bss) + } +} diff --git a/target/linux/adm8668/image/lzma-loader/src/stubs.c b/target/linux/adm8668/image/lzma-loader/src/stubs.c new file mode 100644 index 000000000..468e5a1fd --- /dev/null +++ b/target/linux/adm8668/image/lzma-loader/src/stubs.c @@ -0,0 +1,52 @@ +#include + +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#endif /* GCC_VERSION */ + +/* + * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call- + * clobbered register that is also used to set gp ($26). Note that the + * jr instruction also executes the instruction immediately following + * it; however, GCC/mips generates an additional `nop' after each asm + * statement + */ +#define EXPORT_FUNC(x) \ + asm volatile ( \ +" .globl " #x "\n" \ +#x ":\n" \ +" lw $25, %0($26)\n" \ +" lw $25, %1($25)\n" \ +" jr $25\n" \ + : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9"); + +/* This function is necessary to prevent the compiler from + * generating prologue/epilogue, preparing stack frame etc. + * The stub functions are special, they do not use the stack + * frame passed to them, but pass it intact to the actual + * implementation. On the other hand, asm() statements with + * arguments can be used only inside the functions (gcc limitation) + */ +#if GCC_VERSION < 3004 +static +#endif /* GCC_VERSION */ +void __attribute__((unused)) dummy(void) +{ +#include <_exports.h> +} + +#if 0 +extern unsigned long __bss_start, _end; + +void app_startup(char **argv) +{ + unsigned long * cp = &__bss_start; + + /* Zero out BSS */ + while (cp < &_end) { + *cp++ = 0; + } +} +#endif + +#undef EXPORT_FUNC diff --git a/target/linux/adm8668/image/my-mkimage b/target/linux/adm8668/image/my-mkimage new file mode 100755 index 000000000..7ed6666e7 --- /dev/null +++ b/target/linux/adm8668/image/my-mkimage @@ -0,0 +1,32 @@ +#!/bin/sh +# my-mkimage +# This will pad given files to 64k boundaries to make a single u-boot image. +# we have to be fancy because u-boot mkimage is going to add 64 byte header, ... +# and i only know basic arithmetic.. ;) +# +# Copyright (C) 2010 Scott Nicholas +[ $# -lt 2 ] && { + echo usage: $0 loader.bin [rootfs.squashfs [fs_mark [...]]] output.bin +} + +OLDSIZE=$(stat -c%s $1) +NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64)) + +dd if=$1 of=vmlinuz.tmp bs=$NEWSIZE conv=sync >/dev/null 2>&1 +shift +appends=$(($# - 1)) +echo +while [ $appends -gt 0 ]; do + dd if=$1 of=temp bs=64k conv=sync >/dev/null 2>&1 + printf "### '%s' starts at 0x%x\n" "`basename $1`" "$((NEWSIZE+64))" + cat temp >>vmlinuz.tmp + shift + appends=$((appends-1)) + NEWSIZE=$(stat -c%s vmlinuz.tmp) +done +echo +../../../../staging_dir/host/bin/mkimage -A mips -O linux -T kernel \ +-C none -a 0x80400000 -e 0x80400000 -n "ADM8668 Linux Kernel(2.4.31)" \ +-d vmlinuz.tmp $1 + +rm temp vmlinuz.tmp diff --git a/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch b/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch new file mode 100644 index 000000000..80e9ed1bb --- /dev/null +++ b/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch @@ -0,0 +1,48 @@ +--- a/arch/mips/Kbuild.platforms ++++ b/arch/mips/Kbuild.platforms +@@ -30,6 +30,7 @@ platforms += sibyte + platforms += sni + platforms += txx9 + platforms += vr41xx ++platforms += adm8668 + + # include the platform specific files + include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms)) +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -136,6 +136,27 @@ config BCM47XX + help + Support for BCM47XX based boards + ++config ADM8668 ++ bool "WildPass ADM8668" ++ select SYS_HAS_CPU_MIPS32_R1 ++ select BOOT_RAW ++ select NO_EXCEPT_FILL ++ select IRQ_CPU ++ select CEVT_R4K ++ select CSRC_R4K ++ select HW_HAS_PCI ++ select PCI ++ select SYS_SUPPORTS_LITTLE_ENDIAN ++ select SYS_SUPPORTS_32BIT_KERNEL ++ select DMA_NONCOHERENT ++ select SWAP_IO_SPACE ++ select SYS_HAS_EARLY_PRINTK ++ select ARCH_REQUIRE_GPIOLIB ++ select HAVE_CLK ++ help ++ ADM8668 board support by neutronscott ++ Scott Nicholas ++ + config BCM63XX + bool "Broadcom BCM63XX based boards" + select BOOT_RAW +@@ -834,6 +855,7 @@ config MIPS_PARAVIRT + + endchoice + ++source "arch/mips/adm8668/Kconfig" + source "arch/mips/alchemy/Kconfig" + source "arch/mips/ath79/Kconfig" + source "arch/mips/bcm47xx/Kconfig" diff --git a/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch b/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch new file mode 100644 index 000000000..d013d08b5 --- /dev/null +++ b/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -58,6 +58,7 @@ obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32 + obj-$(CONFIG_CAVIUM_OCTEON_SOC) += pci-octeon.o pcie-octeon.o + obj-$(CONFIG_CPU_XLR) += pci-xlr.o + obj-$(CONFIG_CPU_XLP) += pci-xlp.o ++obj-$(CONFIG_ADM8668) += pci-adm8668.o + + ifdef CONFIG_PCI_MSI + obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -1821,6 +1821,9 @@ + + #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */ + ++#define PCI_VENDOR_ADMTEK 0x1317 ++#define PCI_DEVICE_ID_ADM8668 0x8688 ++ + #define PCI_VENDOR_ID_SIIG 0x131f + #define PCI_SUBVENDOR_ID_SIIG 0x131f + #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 diff --git a/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch b/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch new file mode 100644 index 000000000..f7883cdb2 --- /dev/null +++ b/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch @@ -0,0 +1,22 @@ +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -97,6 +97,12 @@ config MSP_FLASH_MAP_LIMIT + default "0x02000000" + depends on MSP_FLASH_MAP_LIMIT_32M + ++config MTD_ADM8668_NOR ++ tristate "ADM8668 NOR mapping" ++ depends on ADM8668 && MTD_CFI ++ help ++ mapping driver for ADM8668 NOR ++ + config MTD_SUN_UFLASH + tristate "Sun Microsystems userflash support" + depends on SPARC && MTD_CFI && PCI +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -43,3 +43,4 @@ obj-$(CONFIG_MTD_VMU) += vmu-flash.o + obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o + obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o + obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o ++obj-$(CONFIG_MTD_ADM8668_NOR) += adm8668.o diff --git a/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch b/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch new file mode 100644 index 000000000..e39a1686c --- /dev/null +++ b/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch @@ -0,0 +1,452 @@ +--- a/drivers/net/ethernet/dec/tulip/tulip_core.c ++++ b/drivers/net/ethernet/dec/tulip/tulip_core.c +@@ -206,6 +206,7 @@ struct tulip_chip_table tulip_tbl[] = { + }; + + ++#ifdef CONFIG_TULIP_PCI + static const struct pci_device_id tulip_pci_tbl[] = { + { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 }, + { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 }, +@@ -249,7 +250,7 @@ static const struct pci_device_id tulip_ + { } /* terminate list */ + }; + MODULE_DEVICE_TABLE(pci, tulip_pci_tbl); +- ++#endif + + /* A full-duplex map for media types. */ + const char tulip_media_cap[32] = +@@ -267,11 +268,14 @@ static void tulip_down(struct net_device + static struct net_device_stats *tulip_get_stats(struct net_device *dev); + static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); + static void set_rx_mode(struct net_device *dev); ++#ifdef CONFIG_TULIP_PCI + static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts); ++#endif + #ifdef CONFIG_NET_POLL_CONTROLLER + static void poll_tulip(struct net_device *dev); + #endif + ++#ifdef CONFIG_TULIP_PCI + static void tulip_set_power_state (struct tulip_private *tp, + int sleep, int snooze) + { +@@ -288,7 +292,7 @@ static void tulip_set_power_state (struc + } + + } +- ++#endif + + static void tulip_up(struct net_device *dev) + { +@@ -302,6 +306,7 @@ static void tulip_up(struct net_device * + napi_enable(&tp->napi); + #endif + ++#ifdef CONFIG_TULIP_PCI + /* Wake the chip from sleep/snooze mode. */ + tulip_set_power_state (tp, 0, 0); + +@@ -309,6 +314,7 @@ static void tulip_up(struct net_device * + pci_enable_wake(tp->pdev, PCI_D3hot, 0); + pci_enable_wake(tp->pdev, PCI_D3cold, 0); + tulip_set_wolopts(tp->pdev, 0); ++#endif + + /* On some chip revs we must set the MII/SYM port before the reset!? */ + if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) +@@ -316,18 +322,22 @@ static void tulip_up(struct net_device * + + /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */ + iowrite32(0x00000001, ioaddr + CSR0); ++#ifdef CONFIG_TULIP_PCI + pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */ ++#endif + udelay(100); + + /* Deassert reset. + Wait the specified 50 PCI cycles after a reset by initializing + Tx and Rx queues and the address filter list. */ + iowrite32(tp->csr0, ioaddr + CSR0); ++#ifdef CONFIG_TULIP_PCI + pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */ ++#endif + udelay(100); + + if (tulip_debug > 1) +- netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->pdev->irq); ++ netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->irq); + + iowrite32(tp->rx_ring_dma, ioaddr + CSR3); + iowrite32(tp->tx_ring_dma, ioaddr + CSR4); +@@ -361,9 +371,11 @@ static void tulip_up(struct net_device * + *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; + *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; + ++#ifdef CONFIG_TULIP_PCI + mapping = pci_map_single(tp->pdev, tp->setup_frame, + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); ++#endif + tp->tx_buffers[tp->cur_tx].skb = NULL; + tp->tx_buffers[tp->cur_tx].mapping = mapping; + +@@ -519,7 +531,7 @@ tulip_open(struct net_device *dev) + + tulip_init_ring (dev); + +- retval = request_irq(tp->pdev->irq, tulip_interrupt, IRQF_SHARED, ++ retval = request_irq(tp->irq, tulip_interrupt, IRQF_SHARED, + dev->name, dev); + if (retval) + goto free_ring; +@@ -643,8 +655,10 @@ static void tulip_init_ring(struct net_d + tp->rx_buffers[i].skb = skb; + if (skb == NULL) + break; ++#ifdef CONFIG_TULIP_PCI + mapping = pci_map_single(tp->pdev, skb->data, + PKT_BUF_SZ, PCI_DMA_FROMDEVICE); ++#endif + tp->rx_buffers[i].mapping = mapping; + tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */ + tp->rx_ring[i].buffer1 = cpu_to_le32(mapping); +@@ -677,8 +691,10 @@ tulip_start_xmit(struct sk_buff *skb, st + entry = tp->cur_tx % TX_RING_SIZE; + + tp->tx_buffers[entry].skb = skb; ++#ifdef CONFIG_TULIP_PCI + mapping = pci_map_single(tp->pdev, skb->data, + skb->len, PCI_DMA_TODEVICE); ++#endif + tp->tx_buffers[entry].mapping = mapping; + tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping); + +@@ -729,16 +745,19 @@ static void tulip_clean_tx_ring(struct t + if (tp->tx_buffers[entry].skb == NULL) { + /* test because dummy frames not mapped */ + if (tp->tx_buffers[entry].mapping) ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, + tp->tx_buffers[entry].mapping, + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); ++#endif + continue; + } +- ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, + tp->tx_buffers[entry].skb->len, + PCI_DMA_TODEVICE); ++#endif + + /* Free the original skb. */ + dev_kfree_skb_irq(tp->tx_buffers[entry].skb); +@@ -789,7 +808,9 @@ static void tulip_down (struct net_devic + dev->if_port = tp->saved_if_port; + + /* Leave the driver in snooze, not sleep, mode. */ ++#ifdef CONFIG_TULIP_PCI + tulip_set_power_state (tp, 0, 1); ++#endif + } + + static void tulip_free_ring (struct net_device *dev) +@@ -810,8 +831,10 @@ static void tulip_free_ring (struct net_ + /* An invalid address. */ + tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0); + if (skb) { ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, + PCI_DMA_FROMDEVICE); ++#endif + dev_kfree_skb (skb); + } + } +@@ -820,8 +843,10 @@ static void tulip_free_ring (struct net_ + struct sk_buff *skb = tp->tx_buffers[i].skb; + + if (skb != NULL) { ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping, + skb->len, PCI_DMA_TODEVICE); ++#endif + dev_kfree_skb (skb); + } + tp->tx_buffers[i].skb = NULL; +@@ -842,7 +867,7 @@ static int tulip_close (struct net_devic + netdev_dbg(dev, "Shutting down ethercard, status was %02x\n", + ioread32 (ioaddr + CSR5)); + +- free_irq (tp->pdev->irq, dev); ++ free_irq (tp->irq, dev); + + tulip_free_ring (dev); + +@@ -873,7 +898,9 @@ static void tulip_get_drvinfo(struct net + struct tulip_private *np = netdev_priv(dev); + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); ++#ifdef CONFIG_TULIP_PCI + strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); ++#endif + } + + +@@ -886,7 +913,9 @@ static int tulip_ethtool_set_wol(struct + return -EOPNOTSUPP; + + tp->wolinfo.wolopts = wolinfo->wolopts; +- device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts); ++#ifdef CONFIG_TULIP_PCI ++ device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts); ++#endif + return 0; + } + +@@ -1164,9 +1193,11 @@ static void set_rx_mode(struct net_devic + + tp->tx_buffers[entry].skb = NULL; + tp->tx_buffers[entry].mapping = ++#ifdef CONFIG_TULIP_PCI + pci_map_single(tp->pdev, tp->setup_frame, + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); ++#endif + /* Put the setup frame on the Tx list. */ + if (entry == TX_RING_SIZE-1) + tx_flags |= DESC_RING_WRAP; /* Wrap ring. */ +@@ -1263,19 +1294,22 @@ out: + netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n", + cache, csr0); + } +-#endif + + /* + * Chips that have the MRM/reserved bit quirk and the burst quirk. That + * is the DM910X and the on chip ULi devices + */ ++#endif + ++#ifdef CONFIG_TULIP_PCI + static int tulip_uli_dm_quirk(struct pci_dev *pdev) + { + if (pdev->vendor == 0x1282 && pdev->device == 0x9102) + return 1; + return 0; + } ++#endif ++ + + static const struct net_device_ops tulip_netdev_ops = { + .ndo_open = tulip_open, +@@ -1293,6 +1327,7 @@ static const struct net_device_ops tulip + #endif + }; + ++#ifdef CONFIG_TULIP_PCI + const struct pci_device_id early_486_chipsets[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) }, + { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) }, +@@ -1470,6 +1505,8 @@ static int tulip_init_one(struct pci_dev + } + } + tp->pdev = pdev; ++ tp->kdev = &pdev->dev; ++ tp->irq = irq; + tp->base_addr = ioaddr; + tp->revision = pdev->revision; + tp->csr0 = csr0; +@@ -1800,6 +1837,7 @@ err_out_free_netdev: + } + + ++#ifdef CONFIG_TULIP_PCI + /* set the registers according to the given wolopts */ + static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts) + { +@@ -1828,6 +1866,7 @@ static void tulip_set_wolopts (struct pc + iowrite32(tmp, ioaddr + CSR13); + } + } ++#endif + + #ifdef CONFIG_PM + +@@ -1942,6 +1981,7 @@ static void tulip_remove_one(struct pci_ + + /* pci_power_off (pdev, -1); */ + } ++#endif /* CONFIG_TULIP_PCI */ + + #ifdef CONFIG_NET_POLL_CONTROLLER + /* +@@ -1963,7 +2003,8 @@ static void poll_tulip (struct net_devic + } + #endif + +-static struct pci_driver tulip_driver = { ++#ifdef CONFIG_TULIP_PCI ++static struct pci_driver tulip_pci_driver = { + .name = DRV_NAME, + .id_table = tulip_pci_tbl, + .probe = tulip_init_one, +@@ -1973,10 +2014,12 @@ static struct pci_driver tulip_driver = + .resume = tulip_resume, + #endif /* CONFIG_PM */ + }; ++#endif + + + static int __init tulip_init (void) + { ++ int ret = 0; + #ifdef MODULE + pr_info("%s", version); + #endif +@@ -1992,13 +2035,18 @@ static int __init tulip_init (void) + tulip_max_interrupt_work = max_interrupt_work; + + /* probe for and init boards */ +- return pci_register_driver(&tulip_driver); ++#ifdef CONFIG_TULIP_PCI ++ ret = pci_register_driver(&tulip_pci_driver); ++#endif ++ return ret; + } + + + static void __exit tulip_cleanup (void) + { +- pci_unregister_driver (&tulip_driver); ++#ifdef CONFIG_TULIP_PCI ++ pci_unregister_driver (&tulip_pci_driver); ++#endif + } + + +--- a/drivers/net/ethernet/dec/tulip/interrupt.c ++++ b/drivers/net/ethernet/dec/tulip/interrupt.c +@@ -73,10 +73,11 @@ int tulip_refill_rx(struct net_device *d + netdev_alloc_skb(dev, PKT_BUF_SZ); + if (skb == NULL) + break; +- ++#ifdef CONFIG_TULIP_PCI + mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, + PCI_DMA_FROMDEVICE); +- if (dma_mapping_error(&tp->pdev->dev, mapping)) { ++#endif ++ if (dma_mapping_error(tp->kdev, mapping)) { + dev_kfree_skb(skb); + tp->rx_buffers[entry].skb = NULL; + break; +@@ -210,9 +211,11 @@ int tulip_poll(struct napi_struct *napi, + if (pkt_len < tulip_rx_copybreak && + (skb = netdev_alloc_skb(dev, pkt_len + 2)) != NULL) { + skb_reserve(skb, 2); /* 16 byte align the IP header */ ++#ifdef CONFIG_TULIP_PCI + pci_dma_sync_single_for_cpu(tp->pdev, + tp->rx_buffers[entry].mapping, + pkt_len, PCI_DMA_FROMDEVICE); ++#endif + #if ! defined(__alpha__) + skb_copy_to_linear_data(skb, tp->rx_buffers[entry].skb->data, + pkt_len); +@@ -222,9 +225,11 @@ int tulip_poll(struct napi_struct *napi, + tp->rx_buffers[entry].skb->data, + pkt_len); + #endif ++#ifdef CONFIG_TULIP_PCI + pci_dma_sync_single_for_device(tp->pdev, + tp->rx_buffers[entry].mapping, + pkt_len, PCI_DMA_FROMDEVICE); ++#endif + } else { /* Pass up the skb already on the Rx ring. */ + char *temp = skb_put(skb = tp->rx_buffers[entry].skb, + pkt_len); +@@ -239,9 +244,10 @@ int tulip_poll(struct napi_struct *napi, + skb->head, temp); + } + #endif +- ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping, + PKT_BUF_SZ, PCI_DMA_FROMDEVICE); ++#endif + + tp->rx_buffers[entry].skb = NULL; + tp->rx_buffers[entry].mapping = 0; +@@ -597,10 +603,12 @@ irqreturn_t tulip_interrupt(int irq, voi + if (tp->tx_buffers[entry].skb == NULL) { + /* test because dummy frames not mapped */ + if (tp->tx_buffers[entry].mapping) ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, + tp->tx_buffers[entry].mapping, + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); ++#endif + continue; + } + +@@ -628,10 +636,11 @@ irqreturn_t tulip_interrupt(int irq, voi + dev->stats.collisions += (status >> 3) & 15; + dev->stats.tx_packets++; + } +- ++#ifdef CONFIG_TULIP_PCI + pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, + tp->tx_buffers[entry].skb->len, + PCI_DMA_TODEVICE); ++#endif + + /* Free the original skb. */ + dev_kfree_skb_irq(tp->tx_buffers[entry].skb); +--- a/drivers/net/ethernet/dec/tulip/Kconfig ++++ b/drivers/net/ethernet/dec/tulip/Kconfig +@@ -40,8 +40,12 @@ config DE2104X_DSL + Default is 0, and range is 0 to 31. + + config TULIP ++ tristate ++ ++config TULIP_PCI + tristate "DECchip Tulip (dc2114x) PCI support" + depends on PCI ++ select TULIP + select CRC32 + ---help--- + This driver is developed for the SMC EtherPower series Ethernet +@@ -58,7 +62,7 @@ config TULIP + + config TULIP_MWI + bool "New bus configuration" +- depends on TULIP ++ depends on TULIP_PCI + ---help--- + This configures your Tulip card specifically for the card and + system cache line size type you are using. +@@ -69,7 +73,7 @@ config TULIP_MWI + + config TULIP_MMIO + bool "Use PCI shared mem for NIC registers" +- depends on TULIP ++ depends on TULIP_PCI + ---help--- + Use PCI shared memory for the NIC registers, rather than going through + the Tulip's PIO (programmed I/O ports). Faster, but could produce +--- a/drivers/net/ethernet/dec/tulip/tulip.h ++++ b/drivers/net/ethernet/dec/tulip/tulip.h +@@ -447,6 +447,8 @@ struct tulip_private { + int cur_index; /* Current media index. */ + int saved_if_port; + struct pci_dev *pdev; ++ struct device *kdev; ++ int irq; + int ttimer; + int susp_rx; + unsigned long nir; diff --git a/target/linux/adm8668/patches-3.18/005-tulip_platform.patch b/target/linux/adm8668/patches-3.18/005-tulip_platform.patch new file mode 100644 index 000000000..184a5d0a7 --- /dev/null +++ b/target/linux/adm8668/patches-3.18/005-tulip_platform.patch @@ -0,0 +1,490 @@ +--- a/drivers/net/ethernet/dec/tulip/Kconfig ++++ b/drivers/net/ethernet/dec/tulip/Kconfig +@@ -60,6 +60,14 @@ config TULIP_PCI + To compile this driver as a module, choose M here. The module will + be called tulip. + ++config TULIP_PLATFORM ++ tristate "DECchip Tulip (dc2114x) Platform support" ++ depends on HAS_IOMEM ++ select TULIP ++ select CRC32 ++ ---help--- ++ This driver is for the platform variant. ++ + config TULIP_MWI + bool "New bus configuration" + depends on TULIP_PCI +--- a/drivers/net/ethernet/dec/tulip/tulip_core.c ++++ b/drivers/net/ethernet/dec/tulip/tulip_core.c +@@ -27,6 +27,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -203,6 +205,9 @@ struct tulip_chip_table tulip_tbl[] = { + { "Conexant LANfinity", 256, 0x0001ebef, + HAS_MII | HAS_ACPI, tulip_timer, tulip_media_task }, + ++ { "Infineon ADM8668", 256, 0x0001a451, ++ MC_HASH_ONLY | COMET_MAC_ADDR, tulip_timer, tulip_media_task, }, ++ + }; + + +@@ -376,6 +381,11 @@ static void tulip_up(struct net_device * + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ mapping = dma_map_single(&tp->pldev->dev, tp->setup_frame, ++ sizeof(tp->setup_frame), ++ DMA_TO_DEVICE); ++#endif + tp->tx_buffers[tp->cur_tx].skb = NULL; + tp->tx_buffers[tp->cur_tx].mapping = mapping; + +@@ -395,6 +405,7 @@ static void tulip_up(struct net_device * + i = 0; + if (tp->mtable == NULL) + goto media_picked; ++ + if (dev->if_port) { + int looking_for = tulip_media_cap[dev->if_port] & MediaIsMII ? 11 : + (dev->if_port == 12 ? 0 : dev->if_port); +@@ -488,6 +499,10 @@ media_picked: + iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88); + dev->if_port = tp->mii_cnt ? 11 : 0; + tp->csr6 = 0x00040000; ++ } else if (tp->chip_id == ADM8668) { ++ /* Enable automatic Tx underrun recovery. */ ++ iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88); ++ tp->csr6 = 0x00040000; + } else if (tp->chip_id == AX88140) { + tp->csr6 = tp->mii_cnt ? 0x00040100 : 0x00000100; + } else +@@ -659,6 +674,10 @@ static void tulip_init_ring(struct net_d + mapping = pci_map_single(tp->pdev, skb->data, + PKT_BUF_SZ, PCI_DMA_FROMDEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ mapping = dma_map_single(&tp->pldev->dev, skb->data, ++ PKT_BUF_SZ, DMA_FROM_DEVICE); ++#endif + tp->rx_buffers[i].mapping = mapping; + tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */ + tp->rx_ring[i].buffer1 = cpu_to_le32(mapping); +@@ -695,6 +714,11 @@ tulip_start_xmit(struct sk_buff *skb, st + mapping = pci_map_single(tp->pdev, skb->data, + skb->len, PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ mapping = dma_map_single(&tp->pldev->dev, skb->data, ++ skb->len, ++ DMA_TO_DEVICE); ++#endif + tp->tx_buffers[entry].mapping = mapping; + tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping); + +@@ -751,6 +775,13 @@ static void tulip_clean_tx_ring(struct t + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ dma_unmap_single(&tp->pldev->dev, ++ tp->tx_buffers[entry].mapping, ++ sizeof(tp->setup_frame), ++ DMA_TO_DEVICE); ++#endif ++ + continue; + } + #ifdef CONFIG_TULIP_PCI +@@ -758,6 +789,11 @@ static void tulip_clean_tx_ring(struct t + tp->tx_buffers[entry].skb->len, + PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping, ++ tp->tx_buffers[entry].skb->len, ++ DMA_TO_DEVICE); ++#endif + + /* Free the original skb. */ + dev_kfree_skb_irq(tp->tx_buffers[entry].skb); +@@ -835,6 +871,10 @@ static void tulip_free_ring (struct net_ + pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, + PCI_DMA_FROMDEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ dma_unmap_single(&tp->pldev->dev, mapping, PKT_BUF_SZ, ++ DMA_FROM_DEVICE); ++#endif + dev_kfree_skb (skb); + } + } +@@ -847,6 +887,10 @@ static void tulip_free_ring (struct net_ + pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping, + skb->len, PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[i].mapping, ++ skb->len, DMA_TO_DEVICE); ++#endif + dev_kfree_skb (skb); + } + tp->tx_buffers[i].skb = NULL; +@@ -901,6 +945,9 @@ static void tulip_get_drvinfo(struct net + #ifdef CONFIG_TULIP_PCI + strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ strlcpy(info->bus_info, "platform", sizeof(info->bus_info)); ++#endif + } + + +@@ -916,6 +963,9 @@ static int tulip_ethtool_set_wol(struct + #ifdef CONFIG_TULIP_PCI + device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ device_set_wakeup_enable(&tp->pldev->dev, tp->wolinfo.wolopts); ++#endif + return 0; + } + +@@ -1191,13 +1241,20 @@ static void set_rx_mode(struct net_devic + + } + ++#ifdef CONFIG_TULIP_PCI + tp->tx_buffers[entry].skb = NULL; + tp->tx_buffers[entry].mapping = +-#ifdef CONFIG_TULIP_PCI + pci_map_single(tp->pdev, tp->setup_frame, + sizeof(tp->setup_frame), + PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ tp->tx_buffers[entry].skb = NULL; ++ tp->tx_buffers[entry].mapping = ++ dma_map_single(&tp->pldev->dev, tp->setup_frame, ++ sizeof(tp->setup_frame), ++ DMA_TO_DEVICE); ++#endif + /* Put the setup frame on the Tx list. */ + if (entry == TX_RING_SIZE-1) + tx_flags |= DESC_RING_WRAP; /* Wrap ring. */ +@@ -1217,6 +1274,9 @@ static void set_rx_mode(struct net_devic + spin_unlock_irqrestore(&tp->lock, flags); + } + ++ if (tp->chip_id == ADM8668) ++ csr6 |= (1 << 9); /* force 100Mbps full duplex */ ++ + iowrite32(csr6, ioaddr + CSR6); + } + +@@ -1983,6 +2043,126 @@ static void tulip_remove_one(struct pci_ + } + #endif /* CONFIG_TULIP_PCI */ + ++#ifdef CONFIG_TULIP_PLATFORM ++static int tulip_probe(struct platform_device *pdev) ++{ ++ struct tulip_private *tp; ++ struct tulip_platform_data *pdata; ++ struct net_device *dev; ++ struct resource *res; ++ void __iomem *ioaddr; ++ int irq; ++ ++ if (pdev->id < 0 || pdev->id >= MAX_UNITS) ++ return -EINVAL; ++ ++ if (!(res = platform_get_resource(pdev, IORESOURCE_IRQ, 0))) ++ return -ENODEV; ++ irq = res->start; ++ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0))) ++ return -ENODEV; ++ if (!(ioaddr = ioremap(res->start, res->end - res->start))) ++ return -ENODEV; ++ ++ pdata = pdev->dev.platform_data; ++ if (!pdata) ++ return -ENODEV; ++ ++ if (!(dev = alloc_etherdev(sizeof (*tp)))) ++ return -ENOMEM; ++ ++ /* setup net dev */ ++ dev->base_addr = (unsigned long)res->start; ++ dev->irq = irq; ++ SET_NETDEV_DEV(dev, &pdev->dev); ++ ++ /* tulip private struct */ ++ tp = netdev_priv(dev); ++ tp->dev = dev; ++ tp->base_addr = ioaddr; ++ tp->csr0 = 0; ++ tp->pldev = pdev; ++ tp->kdev = &pdev->dev; ++ tp->irq = irq; ++ tp->rx_ring = dma_alloc_coherent(&pdev->dev, ++ sizeof(struct tulip_rx_desc) * RX_RING_SIZE + ++ sizeof(struct tulip_tx_desc) * TX_RING_SIZE, ++ &tp->rx_ring_dma, GFP_KERNEL); ++ if (!tp->rx_ring) ++ return -ENODEV; ++ tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE); ++ tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE; ++ ++ tp->chip_id = pdata->chip_id; ++ tp->flags = tulip_tbl[tp->chip_id].flags; ++ ++ spin_lock_init(&tp->lock); ++ spin_lock_init(&tp->mii_lock); ++ ++ init_timer(&tp->timer); ++ tp->timer.data = (unsigned long)dev; ++ tp->timer.function = tulip_tbl[tp->chip_id].media_timer; ++ ++ INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task); ++ ++ /* Stop the chip's Tx and Rx processes. */ ++ tulip_stop_rxtx(tp); ++ ++ /* Clear the missed-packet counter. */ ++ ioread32(ioaddr + CSR8); ++ ++ if (!is_valid_ether_addr(pdata->mac)) { ++ dev_info(&pdev->dev, "generating random ethernet MAC\n"); ++ random_ether_addr(dev->dev_addr); ++ } else ++ memcpy(dev->dev_addr, pdata->mac, ETH_ALEN); ++ ++ /* The Tulip-specific entries in the device structure. */ ++ dev->netdev_ops = &tulip_netdev_ops; ++ dev->watchdog_timeo = TX_TIMEOUT; ++ netif_napi_add(dev, &tp->napi, tulip_poll, 16); ++ dev->ethtool_ops = &ops; ++ ++ if (register_netdev(dev)) ++ goto err_out_free_ring; ++ ++ dev_info(&dev->dev, ++ "tulip_platform (%s) at MMIO %#lx %pM, IRQ %d\n", ++ tulip_tbl[tp->chip_id].chip_name, ++ (unsigned long)dev->base_addr, dev->dev_addr, irq); ++ ++ platform_set_drvdata(pdev, dev); ++ return 0; ++ ++err_out_free_ring: ++ dma_free_coherent(&pdev->dev, ++ sizeof (struct tulip_rx_desc) * RX_RING_SIZE + ++ sizeof (struct tulip_tx_desc) * TX_RING_SIZE, ++ tp->rx_ring, tp->rx_ring_dma); ++ return -ENODEV; ++} ++ ++static int tulip_remove(struct platform_device *pdev) ++{ ++ struct net_device *dev = platform_get_drvdata (pdev); ++ struct tulip_private *tp; ++ ++ if (!dev) ++ return -ENODEV; ++ ++ tp = netdev_priv(dev); ++ unregister_netdev(dev); ++ dma_free_coherent(&pdev->dev, ++ sizeof (struct tulip_rx_desc) * RX_RING_SIZE + ++ sizeof (struct tulip_tx_desc) * TX_RING_SIZE, ++ tp->rx_ring, tp->rx_ring_dma); ++ iounmap(tp->base_addr); ++ free_netdev(dev); ++ platform_set_drvdata(pdev, NULL); ++ return 0; ++} ++#endif ++ + #ifdef CONFIG_NET_POLL_CONTROLLER + /* + * Polling 'interrupt' - used by things like netconsole to send skbs +@@ -2016,6 +2196,17 @@ static struct pci_driver tulip_pci_drive + }; + #endif + ++#ifdef CONFIG_TULIP_PLATFORM ++static struct platform_driver tulip_platform_driver = { ++ .probe = tulip_probe, ++ .remove = tulip_remove, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = DRV_NAME, ++ }, ++}; ++#endif ++ + + static int __init tulip_init (void) + { +@@ -2038,6 +2229,9 @@ static int __init tulip_init (void) + #ifdef CONFIG_TULIP_PCI + ret = pci_register_driver(&tulip_pci_driver); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ ret = platform_driver_register(&tulip_platform_driver); ++#endif + return ret; + } + +@@ -2047,6 +2241,9 @@ static void __exit tulip_cleanup (void) + #ifdef CONFIG_TULIP_PCI + pci_unregister_driver (&tulip_pci_driver); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ platform_driver_unregister (&tulip_platform_driver); ++#endif + } + + +--- a/drivers/net/ethernet/dec/tulip/tulip.h ++++ b/drivers/net/ethernet/dec/tulip/tulip.h +@@ -21,6 +21,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -69,28 +71,6 @@ enum tbl_flag { + }; + + +-/* chip types. careful! order is VERY IMPORTANT here, as these +- * are used throughout the driver as indices into arrays */ +-/* Note 21142 == 21143. */ +-enum chips { +- DC21040 = 0, +- DC21041 = 1, +- DC21140 = 2, +- DC21142 = 3, DC21143 = 3, +- LC82C168, +- MX98713, +- MX98715, +- MX98725, +- AX88140, +- PNIC2, +- COMET, +- COMPEX9881, +- I21145, +- DM910X, +- CONEXANT, +-}; +- +- + enum MediaIs { + MediaIsFD = 1, + MediaAlwaysFD = 2, +@@ -446,7 +426,12 @@ struct tulip_private { + struct mediatable *mtable; + int cur_index; /* Current media index. */ + int saved_if_port; ++#ifdef CONFIG_TULIP_PCI + struct pci_dev *pdev; ++#endif ++#ifdef CONFIG_TULIP_PLATFORM ++ struct platform_device *pldev; ++#endif + struct device *kdev; + int irq; + int ttimer; +--- a/drivers/net/ethernet/dec/tulip/interrupt.c ++++ b/drivers/net/ethernet/dec/tulip/interrupt.c +@@ -77,6 +77,10 @@ int tulip_refill_rx(struct net_device *d + mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, + PCI_DMA_FROMDEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ mapping = dma_map_single(&tp->pldev->dev, skb->data, PKT_BUF_SZ, ++ DMA_FROM_DEVICE); ++#endif + if (dma_mapping_error(tp->kdev, mapping)) { + dev_kfree_skb(skb); + tp->rx_buffers[entry].skb = NULL; +@@ -204,8 +208,7 @@ int tulip_poll(struct napi_struct *napi, + dev->stats.rx_fifo_errors++; + } + } else { +- struct sk_buff *skb; +- ++ struct sk_buff *skb; + /* Check if the packet is long enough to accept without copying + to a minimally-sized skbuff. */ + if (pkt_len < tulip_rx_copybreak && +@@ -248,6 +251,10 @@ int tulip_poll(struct napi_struct *napi, + pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping, + PKT_BUF_SZ, PCI_DMA_FROMDEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ dma_unmap_single(&tp->pldev->dev, tp->rx_buffers[entry].mapping, ++ PKT_BUF_SZ, DMA_FROM_DEVICE); ++#endif + + tp->rx_buffers[entry].skb = NULL; + tp->rx_buffers[entry].mapping = 0; +@@ -641,6 +648,11 @@ irqreturn_t tulip_interrupt(int irq, voi + tp->tx_buffers[entry].skb->len, + PCI_DMA_TODEVICE); + #endif ++#ifdef CONFIG_TULIP_PLATFORM ++ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping, ++ tp->tx_buffers[entry].skb->len, ++ DMA_TO_DEVICE); ++#endif + + /* Free the original skb. */ + dev_kfree_skb_irq(tp->tx_buffers[entry].skb); +--- /dev/null ++++ b/include/linux/platform_data/tulip.h +@@ -0,0 +1,31 @@ ++#ifndef _LINUX_TULIP_PDATA_H ++#define _LINUX_TULIP_PDATA_H ++ ++/* chip types. careful! order is VERY IMPORTANT here, as these ++ * are used throughout the driver as indices into arrays */ ++/* Note 21142 == 21143. */ ++enum chips { ++ DC21040 = 0, ++ DC21041 = 1, ++ DC21140 = 2, ++ DC21142 = 3, DC21143 = 3, ++ LC82C168, ++ MX98713, ++ MX98715, ++ MX98725, ++ AX88140, ++ PNIC2, ++ COMET, ++ COMPEX9881, ++ I21145, ++ DM910X, ++ CONEXANT, ++ ADM8668, ++}; ++ ++struct tulip_platform_data { ++ u8 mac[6]; ++ enum chips chip_id; ++}; ++ ++#endif diff --git a/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch b/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch new file mode 100644 index 000000000..66f4f2590 --- /dev/null +++ b/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch @@ -0,0 +1,377 @@ +--- a/drivers/tty/serial/amba-pl010.c ++++ b/drivers/tty/serial/amba-pl010.c +@@ -48,11 +48,10 @@ + #include + #include + +-#define UART_NR 8 +- + #define SERIAL_AMBA_MAJOR 204 + #define SERIAL_AMBA_MINOR 16 +-#define SERIAL_AMBA_NR UART_NR ++#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS ++#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME + + #define AMBA_ISR_PASS_LIMIT 256 + +@@ -78,9 +77,9 @@ static void pl010_stop_tx(struct uart_po + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr &= ~UART010_CR_TIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_start_tx(struct uart_port *port) +@@ -88,9 +87,9 @@ static void pl010_start_tx(struct uart_p + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr |= UART010_CR_TIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_stop_rx(struct uart_port *port) +@@ -98,9 +97,9 @@ static void pl010_stop_rx(struct uart_po + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_enable_ms(struct uart_port *port) +@@ -108,18 +107,18 @@ static void pl010_enable_ms(struct uart_ + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int cr; + +- cr = readb(uap->port.membase + UART010_CR); ++ cr = __raw_readl(uap->port.membase + UART010_CR); + cr |= UART010_CR_MSIE; +- writel(cr, uap->port.membase + UART010_CR); ++ __raw_writel(cr, uap->port.membase + UART010_CR); + } + + static void pl010_rx_chars(struct uart_amba_port *uap) + { + unsigned int status, ch, flag, rsr, max_count = 256; + +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + while (UART_RX_DATA(status) && max_count--) { +- ch = readb(uap->port.membase + UART01x_DR); ++ ch = __raw_readl(uap->port.membase + UART01x_DR); + flag = TTY_NORMAL; + + uap->port.icount.rx++; +@@ -128,9 +127,9 @@ static void pl010_rx_chars(struct uart_a + * Note that the error handling code is + * out of the main execution path + */ +- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; ++ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; + if (unlikely(rsr & UART01x_RSR_ANY)) { +- writel(0, uap->port.membase + UART01x_ECR); ++ __raw_writel(0, uap->port.membase + UART01x_ECR); + + if (rsr & UART01x_RSR_BE) { + rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); +@@ -160,7 +159,7 @@ static void pl010_rx_chars(struct uart_a + uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); + + ignore_char: +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + } + spin_unlock(&uap->port.lock); + tty_flip_buffer_push(&uap->port.state->port); +@@ -173,7 +172,7 @@ static void pl010_tx_chars(struct uart_a + int count; + + if (uap->port.x_char) { +- writel(uap->port.x_char, uap->port.membase + UART01x_DR); ++ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR); + uap->port.icount.tx++; + uap->port.x_char = 0; + return; +@@ -185,7 +184,7 @@ static void pl010_tx_chars(struct uart_a + + count = uap->port.fifosize >> 1; + do { +- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); ++ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); + uap->port.icount.tx++; + if (uart_circ_empty(xmit)) +@@ -203,9 +202,9 @@ static void pl010_modem_status(struct ua + { + unsigned int status, delta; + +- writel(0, uap->port.membase + UART010_ICR); ++ __raw_writel(0, uap->port.membase + UART010_ICR); + +- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; ++ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + + delta = status ^ uap->old_status; + uap->old_status = status; +@@ -233,7 +232,7 @@ static irqreturn_t pl010_int(int irq, vo + + spin_lock(&uap->port.lock); + +- status = readb(uap->port.membase + UART010_IIR); ++ status = __raw_readl(uap->port.membase + UART010_IIR); + if (status) { + do { + if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) +@@ -246,7 +245,7 @@ static irqreturn_t pl010_int(int irq, vo + if (pass_counter-- == 0) + break; + +- status = readb(uap->port.membase + UART010_IIR); ++ status = __raw_readl(uap->port.membase + UART010_IIR); + } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | + UART010_IIR_TIS)); + handled = 1; +@@ -260,7 +259,7 @@ static irqreturn_t pl010_int(int irq, vo + static unsigned int pl010_tx_empty(struct uart_port *port) + { + struct uart_amba_port *uap = (struct uart_amba_port *)port; +- unsigned int status = readb(uap->port.membase + UART01x_FR); ++ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR); + return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; + } + +@@ -270,7 +269,7 @@ static unsigned int pl010_get_mctrl(stru + unsigned int result = 0; + unsigned int status; + +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + if (status & UART01x_FR_DCD) + result |= TIOCM_CAR; + if (status & UART01x_FR_DSR) +@@ -296,12 +295,12 @@ static void pl010_break_ctl(struct uart_ + unsigned int lcr_h; + + spin_lock_irqsave(&uap->port.lock, flags); +- lcr_h = readb(uap->port.membase + UART010_LCRH); ++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); + if (break_state == -1) + lcr_h |= UART01x_LCRH_BRK; + else + lcr_h &= ~UART01x_LCRH_BRK; +- writel(lcr_h, uap->port.membase + UART010_LCRH); ++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); + spin_unlock_irqrestore(&uap->port.lock, flags); + } + +@@ -329,12 +328,12 @@ static int pl010_startup(struct uart_por + /* + * initialise the old status of the modem signals + */ +- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; ++ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + + /* + * Finally, enable interrupts + */ +- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, ++ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, + uap->port.membase + UART010_CR); + + return 0; +@@ -357,10 +356,10 @@ static void pl010_shutdown(struct uart_p + /* + * disable all interrupts, disable the port + */ +- writel(0, uap->port.membase + UART010_CR); ++ __raw_writel(0, uap->port.membase + UART010_CR); + + /* disable break condition and fifos */ +- writel(readb(uap->port.membase + UART010_LCRH) & ++ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) & + ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), + uap->port.membase + UART010_LCRH); + +@@ -382,7 +381,7 @@ pl010_set_termios(struct uart_port *port + /* + * Ask the core to calculate the divisor for us. + */ +- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); ++ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); + quot = uart_get_divisor(port, baud); + + switch (termios->c_cflag & CSIZE) { +@@ -445,25 +444,25 @@ pl010_set_termios(struct uart_port *port + uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; + + /* first, disable everything */ +- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; ++ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; + + if (UART_ENABLE_MS(port, termios->c_cflag)) + old_cr |= UART010_CR_MSIE; + +- writel(0, uap->port.membase + UART010_CR); ++ __raw_writel(0, uap->port.membase + UART010_CR); + + /* Set baud rate */ + quot -= 1; +- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); +- writel(quot & 0xff, uap->port.membase + UART010_LCRL); ++ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); ++ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL); + + /* + * ----------v----------v----------v----------v----- + * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L + * ----------^----------^----------^----------^----- + */ +- writel(lcr_h, uap->port.membase + UART010_LCRH); +- writel(old_cr, uap->port.membase + UART010_CR); ++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); ++ __raw_writel(old_cr, uap->port.membase + UART010_CR); + + spin_unlock_irqrestore(&uap->port.lock, flags); + } +@@ -545,7 +544,7 @@ static struct uart_ops amba_pl010_pops = + .verify_port = pl010_verify_port, + }; + +-static struct uart_amba_port *amba_ports[UART_NR]; ++static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR]; + + #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE + +@@ -555,10 +554,10 @@ static void pl010_console_putchar(struct + unsigned int status; + + do { +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + barrier(); + } while (!UART_TX_READY(status)); +- writel(ch, uap->port.membase + UART01x_DR); ++ __raw_writel(ch, uap->port.membase + UART01x_DR); + } + + static void +@@ -572,8 +571,8 @@ pl010_console_write(struct console *co, + /* + * First save the CR then disable the interrupts + */ +- old_cr = readb(uap->port.membase + UART010_CR); +- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); ++ old_cr = __raw_readl(uap->port.membase + UART010_CR); ++ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); + + uart_console_write(&uap->port, s, count, pl010_console_putchar); + +@@ -582,10 +581,10 @@ pl010_console_write(struct console *co, + * and restore the TCR + */ + do { +- status = readb(uap->port.membase + UART01x_FR); ++ status = __raw_readl(uap->port.membase + UART01x_FR); + barrier(); + } while (status & UART01x_FR_BUSY); +- writel(old_cr, uap->port.membase + UART010_CR); ++ __raw_writel(old_cr, uap->port.membase + UART010_CR); + + clk_disable(uap->clk); + } +@@ -594,9 +593,9 @@ static void __init + pl010_console_get_options(struct uart_amba_port *uap, int *baud, + int *parity, int *bits) + { +- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { ++ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { + unsigned int lcr_h, quot; +- lcr_h = readb(uap->port.membase + UART010_LCRH); ++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); + + *parity = 'n'; + if (lcr_h & UART01x_LCRH_PEN) { +@@ -611,8 +610,8 @@ pl010_console_get_options(struct uart_am + else + *bits = 8; + +- quot = readb(uap->port.membase + UART010_LCRL) | +- readb(uap->port.membase + UART010_LCRM) << 8; ++ quot = __raw_readl(uap->port.membase + UART010_LCRL) | ++ __raw_readl(uap->port.membase + UART010_LCRM) << 8; + *baud = uap->port.uartclk / (16 * (quot + 1)); + } + } +@@ -631,7 +630,7 @@ static int __init pl010_console_setup(st + * if so, search for the first available port that does have + * console support. + */ +- if (co->index >= UART_NR) ++ if (co->index >= SERIAL_AMBA_NR) + co->index = 0; + uap = amba_ports[co->index]; + if (!uap) +@@ -653,7 +652,7 @@ static int __init pl010_console_setup(st + + static struct uart_driver amba_reg; + static struct console amba_console = { +- .name = "ttyAM", ++ .name = SERIAL_AMBA_NAME, + .write = pl010_console_write, + .device = uart_console_device, + .setup = pl010_console_setup, +@@ -669,11 +668,11 @@ static struct console amba_console = { + + static struct uart_driver amba_reg = { + .owner = THIS_MODULE, +- .driver_name = "ttyAM", +- .dev_name = "ttyAM", ++ .driver_name = SERIAL_AMBA_NAME, ++ .dev_name = SERIAL_AMBA_NAME, + .major = SERIAL_AMBA_MAJOR, + .minor = SERIAL_AMBA_MINOR, +- .nr = UART_NR, ++ .nr = SERIAL_AMBA_NR, + .cons = AMBA_CONSOLE, + }; + +--- a/drivers/tty/serial/Kconfig ++++ b/drivers/tty/serial/Kconfig +@@ -25,10 +25,25 @@ config SERIAL_AMBA_PL010 + help + This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have + an Integrator/AP or Integrator/PP2 platform, or if you have a +- Cirrus Logic EP93xx CPU, say Y or M here. ++ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here. + + If unsure, say N. + ++config SERIAL_AMBA_PL010_NUMPORTS ++ int "Maximum number of AMBA PL010 serial ports" ++ depends on SERIAL_AMBA_PL010 ++ default "8" ++ ---help--- ++ Set this to the number of serial ports you want the AMBA PL010 driver ++ to support. ++ ++config SERIAL_AMBA_PL010_PORTNAME ++ string "Name of the AMBA PL010 serial ports" ++ depends on SERIAL_AMBA_PL010 ++ default "ttyAM" ++ ---help--- ++ ::: To be written ::: ++ + config SERIAL_AMBA_PL010_CONSOLE + bool "Support for console on AMBA serial port" + depends on SERIAL_AMBA_PL010=y diff --git a/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch b/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch new file mode 100644 index 000000000..c79721aa9 --- /dev/null +++ b/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch @@ -0,0 +1,13 @@ +--- a/drivers/amba/bus.c ++++ b/drivers/amba/bus.c +@@ -21,6 +21,10 @@ + + #include + ++#ifndef NO_IRQ ++#define NO_IRQ (-1) ++#endif ++ + #define to_amba_driver(d) container_of(d, struct amba_driver, drv) + + static const struct amba_id * diff --git a/target/linux/adm8668/profiles/100-WRTU54G-TM.mk b/target/linux/adm8668/profiles/100-WRTU54G-TM.mk new file mode 100644 index 000000000..3ff030706 --- /dev/null +++ b/target/linux/adm8668/profiles/100-WRTU54G-TM.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/WRTU54G-TM + NAME:=Linksys WRTU54G T-Mobile (Default) + PACKAGES:=kmod-rt61-pci kmod-usb2 wpad-mini +endef + +define Profile/WRTU54G-TM/Description + Package set compatible with the Linksys WRTU54G T-Mobile +endef +$(eval $(call Profile,WRTU54G-TM)) + diff --git a/target/linux/apm821xx/base-files/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh index 26c035c6f..96d42a489 100755 --- a/target/linux/apm821xx/base-files/etc/diag.sh +++ b/target/linux/apm821xx/base-files/etc/diag.sh @@ -29,9 +29,11 @@ set_state() { ;; upgrade) [ -n "$running" ] && { - status_led="$upgrade" - status_led_blink_preinit_regular + status_led="$running" + status_led_off } + status_led="$upgrade" + status_led_blink_preinit_regular ;; done) status_led_off diff --git a/target/linux/apm821xx/dts/apollo3g.dtsi b/target/linux/apm821xx/dts/apollo3g.dtsi deleted file mode 100644 index e88973f8d..000000000 --- a/target/linux/apm821xx/dts/apollo3g.dtsi +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2008 DENX Software Engineering, Stefan Roese - * (c) Copyright 2010 Western Digital Technologies, Inc. All Rights Reserved. - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without - * any warranty of any kind, whether express or implied. - */ - -#include "apm82181.dtsi" - -/ { - compatible = "amcc,apollo3g"; - - aliases { - serial0 = &UART0; - led-boot = &status; - led-failsafe = &status; - led-running = &status; - led-upgrade = &status; - }; -}; - -&POB0 { - ebc { - nor_flash@0,0 { - status = "okay"; - compatible = "amd,s29gl512n", "jedec-probe", "cfi-flash", "mtd-rom"; - bank-width = <1>; - reg = <0x00000000 0x00000000 0x00080000>; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - /* Part of bootrom - Don't use it without a jump */ - label = "free"; - reg = <0x00000000 0x0001e000>; - }; - - partition@1 { - label = "env"; - reg = <0x0001e000 0x00002000>; - }; - - partition@2 { - label = "uboot"; - reg = <0x00020000 0x00050000>; - }; - }; - }; - - GPIO1: gpio1@e0000000 { - compatible = "wd,mbl-gpio", "ti,74273"; - reg-names = "dat"; - reg = <0xe0000000 0x1>; - #gpio-cells = <2>; - gpio-controller; - - enable-phy { - /* toggle to reset EMAC PHY */ - gpio-hog; - line-name = "enable EMAC PHY"; - gpios = <0 GPIO_ACTIVE_LOW>; - output-low; - }; - - enable-button { - /* Defined in u-boot as: NOT_NOR - * "enables features other than NOR - * specifically, the buffer at CS2" - * (button). - * - * Note: This option is disabled as - * it prevents the system from being - * rebooted successfully. - */ - - gpio-hog; - line-name = "Enable Reset Button, disable NOR"; - gpios = <1 GPIO_ACTIVE_HIGH>; - output-low; - }; - - enable-usb { - gpio-hog; - line-name = "Power USB Core"; - gpios = <2 GPIO_ACTIVE_LOW>; - output-low; - status = "disabled"; - }; - - enable-port1 { - gpio-hog; - line-name = "Power Drive Port 1"; - gpios = <3 GPIO_ACTIVE_LOW>; - output-low; - }; - - enable-port0 { - gpio-hog; - line-name = "Power Drive Port 0"; - gpios = <7 GPIO_ACTIVE_LOW>; - output-low; - status = "disabled"; - }; - }; - - GPIO2: gpio2@e0100000 { - compatible = "wd,mbl-gpio", "ti,74244"; - reg-names = "dat"; - reg = <0xe0100000 0x1>; - #gpio-cells = <2>; - gpio-controller; - no-output; - }; - - gpio-leds { - compatible = "gpio-leds"; - - failsafe: power-red { - label = "mbl:red:power"; - gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "panic"; - }; - - status: power-green { - label = "mbl:green:power"; - gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>; - }; - - power-blue { - label = "mbl:blue:power"; - gpios = <&GPIO1 6 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio_keys_polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <60>; /* 3 * 20 = 60ms */ - autorepeat; - - button@1 { - label = "Reset button"; - linux,code = ; - gpios = <&GPIO2 2 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&CRYPTO { - status = "okay"; -}; - -&PKA { - status = "okay"; -}; - -&TRNG { - status = "okay"; -}; - -&SATA1 { - status = "okay"; -}; - -&UART0 { - status = "okay"; -}; - -&EMAC0 { - status = "okay"; - - phy-map = <0x2>; - phy-address = <0x1>; - phy-handle = <&phy>; - - mdio { - phy: phy@1 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; - }; - }; -}; - -&SATA1 { - status = "okay"; -}; diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts index e06d37cbb..7152c0296 100644 --- a/target/linux/apm821xx/dts/meraki-mr24.dts +++ b/target/linux/apm821xx/dts/meraki-mr24.dts @@ -29,7 +29,6 @@ chosen { linux,stdout-path = "/plb/opb/serial@ef600400"; }; - }; diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts index cf20e2e9e..042c1c430 100644 --- a/target/linux/apm821xx/dts/meraki-mx60.dts +++ b/target/linux/apm821xx/dts/meraki-mx60.dts @@ -29,7 +29,6 @@ chosen { linux,stdout-path = "/plb/opb/serial@ef600400"; }; - }; &CRYPTO { diff --git a/target/linux/apm821xx/dts/wd-mybooklive-duo.dts b/target/linux/apm821xx/dts/wd-mybooklive-duo.dts deleted file mode 100644 index 4f6cc506f..000000000 --- a/target/linux/apm821xx/dts/wd-mybooklive-duo.dts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Device Tree Source for AMCC Canyonlands (460EX) - * - * Copyright 2008 DENX Software Engineering, Stefan Roese - * (c) Copyright 2010 Western Digital Technologies, Inc. All Rights Reserved. - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without - * any warranty of any kind, whether express or implied. - */ - -/dts-v1/; - -#include "apollo3g.dtsi" - -/ { - compatible = "wd,mybooklive-duo", "amcc,apollo3g"; - model = "MyBook Live Duo"; -}; - -&SATA0 { - status = "okay"; -}; - -&USBOTG0 { - status = "okay"; - dr_mode = "host"; -}; - -&GPIO1 { - enable-usb { - status = "okay"; - }; - - enable-port0 { - status = "okay"; - }; -}; diff --git a/target/linux/apm821xx/dts/wd-mybooklive.dts b/target/linux/apm821xx/dts/wd-mybooklive.dts index d84135229..4c6198711 100644 --- a/target/linux/apm821xx/dts/wd-mybooklive.dts +++ b/target/linux/apm821xx/dts/wd-mybooklive.dts @@ -9,9 +9,189 @@ /dts-v1/; -#include "apollo3g.dtsi" +#include "apm82181.dtsi" / { compatible = "wd,mybooklive", "amcc,apollo3g"; model = "MyBook Live"; + + aliases { + serial0 = &UART0; + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; + }; +}; + +&POB0 { + ebc { + nor_flash@0,0 { + status = "okay"; + compatible = "amd,s29gl512n", "jedec-probe", "cfi-flash", "mtd-rom"; + bank-width = <1>; + reg = <0x00000000 0x00000000 0x00080000>; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + /* Part of bootrom - Don't use it without a jump */ + label = "free"; + reg = <0x00000000 0x0001e000>; + }; + + partition@1 { + label = "env"; + reg = <0x0001e000 0x00002000>; + }; + + partition@2 { + label = "uboot"; + reg = <0x00020000 0x00050000>; + }; + }; + }; + + GPIO1: gpio1@e0000000 { + compatible = "wd,mbl-gpio", "ti,74273"; + reg-names = "dat"; + reg = <0xe0000000 0x1>; + #gpio-cells = <2>; + gpio-controller; + + enable-button { + /* Defined in u-boot as: NOT_NOR + * "enables features other than NOR + * specifically, the buffer at CS2" + * (button). + * + * Note: This option is disabled as + * it prevents the system from being + * rebooted successfully. + */ + + gpio-hog; + line-name = "Enable Reset Button, disable NOR"; + gpios = <1 GPIO_ACTIVE_HIGH>; + output-low; + }; + }; + + GPIO2: gpio2@e0100000 { + compatible = "wd,mbl-gpio", "ti,74244"; + reg-names = "dat"; + reg = <0xe0100000 0x1>; + #gpio-cells = <2>; + gpio-controller; + no-output; + }; + + gpio-leds { + compatible = "gpio-leds"; + + failsafe: power-red { + label = "mbl:red:power"; + gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "panic"; + }; + + status: power-green { + label = "mbl:green:power"; + gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>; + }; + + power-blue { + label = "mbl:blue:power"; + gpios = <&GPIO1 6 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <60>; /* 3 * 20 = 60ms */ + autorepeat; + + reset-button { + label = "Reset button"; + linux,code = ; + gpios = <&GPIO2 2 GPIO_ACTIVE_LOW>; + }; + }; + + usbpwr: usb-regulator { + compatible = "regulator-fixed"; + regulator-name = "Power USB Core"; + gpios = <&GPIO1 2 GPIO_ACTIVE_LOW>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + sata1pwr: sata1-regulator { + compatible = "regulator-fixed"; + regulator-name = "Power Drive Port 1"; + gpios = <&GPIO1 3 GPIO_ACTIVE_LOW>; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; /* needed to read OS from HDD */ + }; + + sata0pwr: sata0-regulator { + compatible = "regulator-fixed"; + regulator-name = "Power Drive Port 0"; + gpios = <&GPIO1 7 GPIO_ACTIVE_LOW>; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; /* needed to read OS from HDD */ + }; +}; + +&EMAC0 { + status = "okay"; + + phy-map = <0x2>; + phy-address = <0x1>; + phy-handle = <&phy>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + reset-gpios = <&GPIO1 0 GPIO_ACTIVE_LOW>; + + phy: phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + }; +}; + +&CRYPTO { + status = "okay"; +}; + +&PKA { + status = "okay"; +}; + +&TRNG { + status = "okay"; +}; + +&SATA0 { + status = "okay"; +}; + +&SATA1 { + status = "okay"; +}; + +&UART0 { + status = "okay"; +}; + +&USBOTG0 { + status = "okay"; + dr_mode = "host"; + vbus-supply = <&usbpwr>; }; diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 1e94a4091..00ab19602 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -211,42 +211,29 @@ define Build/boot-img endef define Build/hdd-img - ./mbl_gen_hdd_img.sh $@ $@.boot $(IMAGE_ROOTFS) + ./mbl_gen_hdd_img.sh $@ $@.boot $(IMAGE_ROOTFS) $(BOOT_SIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE) endef -define Device/MyBookLiveDefault - IMAGE_SIZE := 48m +define Device/wd_mybooklive + DEVICE_TITLE := Western Digital My Book Live Series (Single + Duo) + DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-mini + DEVICE_DTS := wd-mybooklive + SUPPORTED_DEVICES += mbl wd_mybooklive-duo BLOCKSIZE := 1k DTB_SIZE := 16384 KERNEL := kernel-bin | dtb | gzip | uImage gzip KERNEL_INITRAMFS := kernel-bin | dtb | gzip | uImage gzip BOOT_SIZE := 8 - IMAGES := rootfs.img.gz kernel.dtb + IMAGES := factory.img.gz kernel.dtb sysupgrade.img.gz DEVICE_DTB := apollo3g.dtb - FILESYSTEMS := ext4 + FILESYSTEMS := ext4 squashfs + IMAGE/factory.img.gz := boot-script | boot-img | hdd-img | gzip IMAGE/kernel.dtb := export-dtb - IMAGE/rootfs.img.gz := boot-script | boot-img | hdd-img | gzip | append-metadata -endef - -define Device/wd_mybooklive -$(Device/MyBookLiveDefault) - DEVICE_TITLE := Western Digital My Book Live - DEVICE_DTS := wd-mybooklive - SUPPORTED_DEVICES += mbl + IMAGE/sysupgrade.img.gz := boot-script | boot-img | hdd-img | gzip | append-metadata endef TARGET_DEVICES += wd_mybooklive -define Device/wd_mybooklive-duo -$(Device/MyBookLiveDefault) - DEVICE_TITLE := Western Digital My Book Live Duo - DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-mini - DEVICE_DTS := wd-mybooklive-duo - SUPPORTED_DEVICES += mbl -endef - -TARGET_DEVICES += wd_mybooklive-duo - endif $(eval $(call BuildImage)) diff --git a/target/linux/apm821xx/image/mbl_boot.scr b/target/linux/apm821xx/image/mbl_boot.scr index 062dc2725..394659a5b 100644 --- a/target/linux/apm821xx/image/mbl_boot.scr +++ b/target/linux/apm821xx/image/mbl_boot.scr @@ -1,6 +1,6 @@ -setenv boot_args 'setenv bootargs root=/dev/sda2 rw rootfstype=ext4' -setenv load_part1 'sata init; ext2load sata 1:1 ${kernel_addr_r} /boot/uImage; ext2load sata 1:1 ${fdt_addr_r} /boot/apollo3g.dtb' -setenv load_part2 'sata init; ext2load sata 0:1 ${kernel_addr_r} /boot/uImage; ext2load sata 0:1 ${fdt_addr_r} /boot/apollo3g.dtb' -setenv load_sata 'if run load_part1; then echo Loaded part 1; elif run load_part2; then echo Loaded part 2; fi' +setenv boot_args 'setenv bootargs root=/dev/sda2 rw rootfstype=squashfs,ext4' +setenv load_part1 'ext2load sata 0:1 ${kernel_addr_r} /boot/uImage; ext2load sata 0:1 ${fdt_addr_r} /boot/apollo3g.dtb' +setenv load_part2 'ext2load sata 1:1 ${kernel_addr_r} /boot/uImage; ext2load sata 1:1 ${fdt_addr_r} /boot/apollo3g.dtb' +setenv load_sata 'sata init; if run load_part1; then echo Loaded part 1; elif run load_part2; then echo Loaded part 2; fi' setenv boot_sata 'run load_sata; run boot_args addtty; bootm ${kernel_addr_r} - ${fdt_addr_r}' run boot_sata diff --git a/target/linux/apm821xx/image/mbl_gen_hdd_img.sh b/target/linux/apm821xx/image/mbl_gen_hdd_img.sh index 589dcf915..6536ce987 100755 --- a/target/linux/apm821xx/image/mbl_gen_hdd_img.sh +++ b/target/linux/apm821xx/image/mbl_gen_hdd_img.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash set -x -[ $# -eq 3 ] || { - echo "SYNTAX: $0 " +[ $# -eq 5 ] || { + echo "SYNTAX: $0 " exit 1 } OUTPUT="$1" BOOTFS="$2" ROOTFS="$3" -let "BOOTFSSIZE=(`stat -c%s "$2"` + 1048575) / 1048576" -let "ROOTFSSIZE=(`stat -c%s "$3"` + 1048575) / 1048576" +BOOTFSSIZE="$4" +ROOTFSSIZE="$5" head=4 sect=63 diff --git a/target/linux/apm821xx/sata/config-default b/target/linux/apm821xx/sata/config-default index 7ca6bd4d3..5af8c338f 100644 --- a/target/linux/apm821xx/sata/config-default +++ b/target/linux/apm821xx/sata/config-default @@ -16,6 +16,11 @@ CONFIG_GENERIC_PHY=y CONFIG_SATA_DWC=y # CONFIG_SATA_DWC_DEBUG is not set CONFIG_EXT4_FS=y +# CONFIG_F2FS_CHECK_FS is not set +CONFIG_F2FS_FS=y +# CONFIG_F2FS_FS_SECURITY is not set +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_STAT_FS=y CONFIG_SCSI=y CONFIG_BLK_DEV_SD=y CONFIG_GPIOLIB=y @@ -23,6 +28,7 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y CONFIG_GPIO_74XX_MMIO=y CONFIG_LEDS_TRIGGER_DISK=y +CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_DM=y CONFIG_BLK_DEV_DM_BUILTIN=y CONFIG_BLK_DEV_MD=y @@ -39,3 +45,5 @@ CONFIG_PPC_EARLY_DEBUG_44x=y # CONFIG_PPC_EARLY_DEBUG_MEMCONS is not set CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x4 CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW=0xef600300 +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y diff --git a/target/linux/apm821xx/sata/target.mk b/target/linux/apm821xx/sata/target.mk index 1c7856828..a5107f106 100644 --- a/target/linux/apm821xx/sata/target.mk +++ b/target/linux/apm821xx/sata/target.mk @@ -1,7 +1,7 @@ BOARDNAME := Devices which boot from SATA (NAS) -FEATURES += ext4 usb ramdisk +FEATURES += ext4 usb ramdisk squashfs DEFAULT_PACKAGES += badblocks block-mount e2fsprogs \ - kmod-dm kmod-md-mod partx-utils + kmod-dm kmod-md-mod partx-utils mkf2fs f2fsck define Target/Description Build firmware images for APM82181 boards that boot from SATA. diff --git a/target/linux/arc770/Makefile b/target/linux/arc770/Makefile index 8b164f4cc..b5e2d5406 100644 --- a/target/linux/arc770/Makefile +++ b/target/linux/arc770/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=Synopsys DesignWare ARC 770D MAINTAINER:=Alexey Brodkin SUBTARGETS:=generic -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 DEVICE_TYPE:=developerboard diff --git a/target/linux/arc770/config-4.9 b/target/linux/arc770/config-4.14 similarity index 86% rename from target/linux/arc770/config-4.9 rename to target/linux/arc770/config-4.14 index fb5cd439e..525075f1b 100644 --- a/target/linux/arc770/config-4.9 +++ b/target/linux/arc770/config-4.14 @@ -2,8 +2,13 @@ CONFIG_ARC=y # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set # CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set -# CONFIG_ARCH_HAS_SG_CHAIN is not set +CONFIG_ARCH_HAS_SG_CHAIN=y +# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set +# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set +# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set +# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARC_BUILTIN_DTB_NAME="" CONFIG_ARC_CACHE=y CONFIG_ARC_CACHE_LINE_SHIFT=5 @@ -35,13 +40,12 @@ CONFIG_ARC_MMU_V3=y CONFIG_ARC_PAGE_SIZE_8K=y CONFIG_ARC_PLAT_AXS10X=y # CONFIG_ARC_PLAT_EZNPS is not set -CONFIG_ARC_PLAT_SIM=y # CONFIG_ARC_PLAT_TB10X is not set +# CONFIG_ARC_SOC_HSDK is not set +CONFIG_ARC_TIMERS=y CONFIG_ARC_UBOOT_SUPPORT=y CONFIG_AXS101=y CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y # CONFIG_CPU_BIG_ENDIAN is not set @@ -52,13 +56,20 @@ CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_DMA_NOOP_OPS is not set +# CONFIG_DMA_VIRT_OPS is not set +# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y +CONFIG_DWMAC_ANARION=y +# CONFIG_DWMAC_DWC_QOS_ETH is not set CONFIG_DWMAC_GENERIC=y CONFIG_DW_APB_ICTL=y +CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y # CONFIG_EZNPS_GIC is not set CONFIG_FIXED_PHY=y CONFIG_FS_MBCACHE=y +CONFIG_FUTEX_PI=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CSUM=y @@ -71,6 +82,7 @@ CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GPIOLIB=y CONFIG_GPIO_DWAPB=y CONFIG_GPIO_GENERIC=y +# CONFIG_GRO_CELLS is not set CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y @@ -100,13 +112,11 @@ CONFIG_ISA_ARCOMPACT=y CONFIG_JBD2=y CONFIG_KALLSYMS=y CONFIG_KERNEL_GZIP=y -# CONFIG_LEDS_TRIGGER_MTD is not set CONFIG_LIBFDT=y CONFIG_LINUX_LINK_BASE=0x80000000 -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MDIO_BOARDINFO=y -# CONFIG_MDIO_HISI_FEMAC is not set +CONFIG_LINUX_RAM_BASE=0x80000000 +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y CONFIG_MFD_SYSCON=y CONFIG_MIGHT_HAVE_PCI=y CONFIG_MMC=y @@ -118,7 +128,6 @@ CONFIG_MMC_DW_PLTFM=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MODULES_USE_ELF_RELA=y -# CONFIG_MTD_PHYSMAP_OF_VERSATILE is not set CONFIG_NATIONAL_PHY=y CONFIG_NEED_PER_CPU_KM=y # CONFIG_NET_CADENCE is not set @@ -146,7 +155,6 @@ CONFIG_OF_IRQ=y CONFIG_OF_MDIO=y CONFIG_OF_NET=y CONFIG_OF_RESERVED_MEM=y -# CONFIG_PCI is not set # CONFIG_PCI_SYSCALL is not set CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 @@ -157,23 +165,13 @@ CONFIG_PREEMPT_COUNT=y # CONFIG_PREEMPT_NONE is not set CONFIG_PREEMPT_RCU=y CONFIG_PTP_1588_CLOCK=y -CONFIG_PWRSEQ_EMMC=y -CONFIG_PWRSEQ_SIMPLE=y CONFIG_RATIONAL=y # CONFIG_RCU_BOOST is not set +CONFIG_RCU_NEED_SEGCBLIST=y CONFIG_RCU_STALL_COMMON=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y -# CONFIG_RESET_ATH79 is not set -# CONFIG_RESET_BERLIN is not set CONFIG_RESET_CONTROLLER=y -# CONFIG_RESET_LPC18XX is not set -# CONFIG_RESET_MESON is not set -# CONFIG_RESET_PISTACHIO is not set -# CONFIG_RESET_SOCFPGA is not set -# CONFIG_RESET_STM32 is not set -# CONFIG_RESET_SUNXI is not set -# CONFIG_RESET_ZYNQ is not set # CONFIG_SCHED_INFO is not set # CONFIG_SCSI_DMA is not set CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y @@ -192,6 +190,11 @@ CONFIG_STMMAC_PLATFORM=y CONFIG_SWPHY=y CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW=y CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN=y +CONFIG_TASKS_RCU=y +CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TREE_SRCU=y CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/arc770/image/uEnv.txt b/target/linux/arc770/image/uEnv.txt index 35549cb1c..53632e8bb 100644 --- a/target/linux/arc770/image/uEnv.txt +++ b/target/linux/arc770/image/uEnv.txt @@ -1,7 +1,7 @@ setenv kernel_addr_r 0x82000000 setenv fdt_addr_r 0x83000000 -setenv loadkernel fatload mmc 0 \$(kernel_addr_r) uImage -setenv loaddtb fatload mmc 0 \$(fdt_addr_r) \$(dts) +setenv loadkernel fatload mmc 0 \${kernel_addr_r} uImage +setenv loaddtb fatload mmc 0 \${fdt_addr_r} \${dts} setenv bootargs earlycon=uart8250,mmio32,0xe0022000,115200n8 console=ttyS3,115200n8 root=/dev/mmcblk0p2 rootwait print-fatal-signals=1 -setenv uenvcmd run loadkernel\; run loaddtb\; bootm \$(kernel_addr_r) - \$(fdt_addr_r) +setenv uenvcmd run loadkernel\; run loaddtb\; bootm \${kernel_addr_r} - \${fdt_addr_r} run uenvcmd diff --git a/target/linux/arc770/patches-4.9/700-stmmac-Disable-frame-filtering-completely.patch b/target/linux/arc770/patches-4.14/700-stmmac-Disable-frame-filtering-completely.patch similarity index 98% rename from target/linux/arc770/patches-4.9/700-stmmac-Disable-frame-filtering-completely.patch rename to target/linux/arc770/patches-4.14/700-stmmac-Disable-frame-filtering-completely.patch index 58094ae96..e63c2e934 100644 --- a/target/linux/arc770/patches-4.9/700-stmmac-Disable-frame-filtering-completely.patch +++ b/target/linux/arc770/patches-4.14/700-stmmac-Disable-frame-filtering-completely.patch @@ -20,7 +20,7 @@ Signed-off-by: Alexey Brodkin --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h -@@ -49,7 +49,7 @@ +@@ -46,7 +46,7 @@ #define STMMAC_GET_ENTRY(x, size) ((x + 1) & (size - 1)) #undef FRAME_FILTER_DEBUG diff --git a/target/linux/archs38/image/uEnv.txt b/target/linux/archs38/image/uEnv.txt index 35549cb1c..53632e8bb 100644 --- a/target/linux/archs38/image/uEnv.txt +++ b/target/linux/archs38/image/uEnv.txt @@ -1,7 +1,7 @@ setenv kernel_addr_r 0x82000000 setenv fdt_addr_r 0x83000000 -setenv loadkernel fatload mmc 0 \$(kernel_addr_r) uImage -setenv loaddtb fatload mmc 0 \$(fdt_addr_r) \$(dts) +setenv loadkernel fatload mmc 0 \${kernel_addr_r} uImage +setenv loaddtb fatload mmc 0 \${fdt_addr_r} \${dts} setenv bootargs earlycon=uart8250,mmio32,0xe0022000,115200n8 console=ttyS3,115200n8 root=/dev/mmcblk0p2 rootwait print-fatal-signals=1 -setenv uenvcmd run loadkernel\; run loaddtb\; bootm \$(kernel_addr_r) - \$(fdt_addr_r) +setenv uenvcmd run loadkernel\; run loaddtb\; bootm \${kernel_addr_r} - \${fdt_addr_r} run uenvcmd diff --git a/target/linux/at91/config-4.9 b/target/linux/at91/config-4.9 index e483d0f76..a44d3ac52 100644 --- a/target/linux/at91/config-4.9 +++ b/target/linux/at91/config-4.9 @@ -58,8 +58,6 @@ CONFIG_BLK_DEV_SD=y # CONFIG_BPF_SYSCALL is not set # CONFIG_BRIDGE is not set CONFIG_CACHE_L2X0=y -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_OF=y CONFIG_CLKSRC_PROBE=y @@ -131,8 +129,6 @@ CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" CONFIG_DEBUG_USER=y CONFIG_DEFAULT_IOSCHED="noop" CONFIG_DEFAULT_NOOP=y -CONFIG_DEVKMEM=y -CONFIG_DEVMEM=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_DMADEVICES=y diff --git a/target/linux/at91/files/arch/arm/boot/dts/at91-q5xr5.dts b/target/linux/at91/files/arch/arm/boot/dts/at91-q5xr5.dts index 728553bce..e6451202a 100644 --- a/target/linux/at91/files/arch/arm/boot/dts/at91-q5xr5.dts +++ b/target/linux/at91/files/arch/arm/boot/dts/at91-q5xr5.dts @@ -106,7 +106,7 @@ watchdog@fffffd40 { status = "okay"; }; - + spi0: spi@fffc8000 { #address-cells = <1>; #size-cells = <0>; @@ -124,7 +124,7 @@ reg = <0>; #address-cells = <1>; #size-cells = <1>; - + at91boot@0 { label = "at91boot"; reg = <0x0 0x4000>; @@ -167,7 +167,7 @@ }; }; }; - + usb0: ohci@500000 { num-ports = <2>; status = "okay"; diff --git a/target/linux/at91/files/arch/arm/boot/dts/lmu5000.dts b/target/linux/at91/files/arch/arm/boot/dts/lmu5000.dts index fb3dd565a..4651fdf24 100644 --- a/target/linux/at91/files/arch/arm/boot/dts/lmu5000.dts +++ b/target/linux/at91/files/arch/arm/boot/dts/lmu5000.dts @@ -39,7 +39,6 @@ atmel,pins = <2 1 0x2 0x0>; /* PC1 periph B */ }; - }; }; diff --git a/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts b/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts index 9c28a2197..1252192e4 100644 --- a/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts +++ b/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts @@ -48,11 +48,11 @@ spi1: spi@f8008000 { status = "okay"; - spidev@0 { - compatible = "spidev"; - reg = <0>; - spi-max-frequency = <8000000>; - }; + spidev@0 { + compatible = "spidev"; + reg = <0>; + spi-max-frequency = <8000000>; + }; }; watchdog@fffffe40 { @@ -71,7 +71,6 @@ usb2: ehci@00700000 { status = "okay"; }; - }; gpio_keys { @@ -93,25 +92,25 @@ }; }; - leds { - compatible = "gpio-leds"; + leds { + compatible = "gpio-leds"; - led0 { - label = "wb50n:blue:led0"; - gpios = <&pioA 12 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; + led0 { + label = "wb50n:blue:led0"; + gpios = <&pioA 12 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; - led1 { - label = "wb50n:green:led1"; - gpios = <&pioA 24 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; + led1 { + label = "wb50n:green:led1"; + gpios = <&pioA 24 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; - led2 { - label = "wb50n:red:led2"; - gpios = <&pioA 26 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; + led2 { + label = "wb50n:red:led2"; + gpios = <&pioA 26 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + }; }; diff --git a/target/linux/ath25/image/Makefile b/target/linux/ath25/image/Makefile index ee5e74e69..5a20bdb64 100644 --- a/target/linux/ath25/image/Makefile +++ b/target/linux/ath25/image/Makefile @@ -82,13 +82,13 @@ define Device/ubnt2 DEVICE_TITLE := Ubiquiti XS2 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2 -v XS2.ar2316 endef -#TARGET_DEVICES += ubnt2 +TARGET_DEVICES += ubnt2 define Device/ubnt5 DEVICE_TITLE := Ubiquiti XS5 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS5 -v XS5.ar2313 endef -#TARGET_DEVICES += ubnt5 +TARGET_DEVICES += ubnt5 define Device/np25g DEVICE_TITLE := np25g diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index 1a83d56cc..14f6c5982 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -141,6 +141,14 @@ ath79_setup_interfaces() tplink,tl-wr941-v2) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; + ubnt,routerstation) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; + ubnt,routerstation-pro) + ucidef_set_interface_wan "eth0" + ucidef_add_switch "switch0" \ + "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1" + ;; ubnt,unifiac-mesh-pro|\ ubnt,unifiac-pro) ucidef_add_switch "switch0" \ @@ -194,6 +202,11 @@ ath79_setup_macs() base_mac=$(mtd_get_mac_binary u-boot 130048) wan_mac=$(macaddr_add "$base_mac" 1) ;; + ubnt,routerstation|\ + ubnt,routerstation-pro) + wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa) + lan_mac=$(macaddr_add "$wan_mac" 1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/base-files/lib/upgrade/platform.sh index 08039e005..806b3f078 100644 --- a/target/linux/ath79/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/base-files/lib/upgrade/platform.sh @@ -5,6 +5,15 @@ PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 +routerstation_do_upgrade() { + local append + local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null) + + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" + dd if="$1" bs=64k skip=1 2>/dev/null | \ + mtd -r $append -Fkernel:$kern_length:0x80060000,rootfs write - kernel:rootfs +} + platform_check_image() { return 0 } @@ -17,6 +26,10 @@ platform_do_upgrade() { PART_NAME="rootfs:kernel" default_do_upgrade "$ARGV" ;; + ubnt,routerstation|\ + ubnt,routerstation-pro) + routerstation_do_upgrade "$ARGV" + ;; *) default_do_upgrade "$ARGV" ;; diff --git a/target/linux/ath79/dts/ar7100.dtsi b/target/linux/ath79/dts/ar7100.dtsi index 8994a7d68..982ad9648 100644 --- a/target/linux/ath79/dts/ar7100.dtsi +++ b/target/linux/ath79/dts/ar7100.dtsi @@ -88,6 +88,14 @@ clock-names = "wdt"; }; + pci_intc: interrupt-controller@18060018 { + compatible = "qca,ar7100-misc-intc"; + reg = <0x18060018 0x4>; + interrupt-parent = <&cpuintc>; + interrupts = <2>; + interrupt-controller; + #interrupt-cells = <1>; + }; rst: reset-controller@18060024 { compatible = "qca,ar7100-reset"; @@ -105,14 +113,17 @@ reg-names = "cfg_base"; ranges = <0x2000000 0 0x10000000 0x10000000 0 0x07000000 /* pci memory */ 0x1000000 0 0x00000000 0x0000000 0 0x000001>; /* io space */ - interrupt-parent = <&cpuintc>; - interrupts = <2>; - interrupt-controller; + interrupt-parent = <&pci_intc>; + interrupts = <4>; + #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 1>; - interrupt-map = <0 0 0 0 &pcie0 0>; + interrupt-map-mask = <0xf800 0 0 0>; + interrupt-map = <0x8800 0 0 0 &pci_intc 0 + 0x9000 0 0 0 &pci_intc 1 + 0x9800 0 0 0 &pci_intc 2>; + status = "disabled"; }; }; @@ -171,7 +182,7 @@ }; ð0 { - compatible = "qca,ar7100-eth"; + compatible = "qca,ar7100-eth", "syscon"; reg = <0x19000000 0x200 0x18070000 0x4>; @@ -182,6 +193,7 @@ resets = <&rst 9>; reset-names = "mac"; + qca,mac-idx = <0>; }; &mdio1 { @@ -189,7 +201,7 @@ }; ð1 { - compatible = "qca,ar7100-eth"; + compatible = "qca,ar7100-eth", "syscon"; reg = <0x1a000000 0x200 0x18070004 0x4>; @@ -201,4 +213,5 @@ resets = <&rst 13>; reset-names = "mac"; + qca,mac-idx = <1>; }; diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts index 5a3de683e..a28ff4444 100644 --- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts +++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts @@ -85,7 +85,6 @@ default-state = "off"; linux,default-trigger = "phy1tpt"; }; - }; keys { @@ -125,7 +124,6 @@ phy-mode = "rgmii"; }; }; - }; }; @@ -181,7 +179,7 @@ }; &pll { - clocks = <&extosc>; + clocks = <&extosc>; }; &spi { @@ -239,7 +237,6 @@ speed = <1000>; full-duplex; }; - }; ð1 { @@ -247,5 +244,4 @@ pll-data = <0x11110000 0x00001099 0x00991099>; phy-handle = <&phy4>; - }; diff --git a/target/linux/ath79/dts/ar7161_ubnt_routerstation-pro.dts b/target/linux/ath79/dts/ar7161_ubnt_routerstation-pro.dts new file mode 100644 index 000000000..1ffb1239b --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ubnt_routerstation-pro.dts @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "ar7161_ubnt_routerstation.dtsi" + +/ { + compatible = "ubnt,routerstation-pro", "qca,ar7161"; + model = "Ubiquiti RouterStation Pro"; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +ð0 { + phy-mode = "rgmii"; + phy-handle = <&phy4>; +}; + +ð1 { + phy-mode = "rgmii"; + phy-handle = <&phy0>; +}; diff --git a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dts b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dts new file mode 100644 index 000000000..63b46b9c7 --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "ar7161_ubnt_routerstation.dtsi" + +/ { + compatible = "ubnt,routerstation", "qca,ar7161"; + model = "Ubiquiti Networks RouterStation"; +}; + +ð0 { + phy-mode = "mii"; + + fixed-link { + speed = <100>; + full-duplex; + }; +}; + +ð1 { + phy-mode = "rmii"; + + fixed-link { + speed = <100>; + full-duplex; + }; +}; diff --git a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi new file mode 100644 index 000000000..143a4b7e8 --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar7100.dtsi" + +/ { + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + led-boot = &rf; + led-failsafe = &rf; + led-running = &rf; + led-upgrade = &rf; + }; + + extosc: ref { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-output-names = "ref"; + clock-frequency = <40000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + rf: rf_green { + label = "ubnt:green:rf"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + debounce-interval = <60>; + + wps { + label = "sw4"; + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + status = "okay"; +}; + +ð1 { + status = "okay"; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "ecoscentric,redboot-fis-partitions"; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&usb1 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + usb_ochi_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&usb2 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + usb_echi_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts index a0a439b0b..8ff2c7195 100644 --- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts +++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts @@ -43,7 +43,6 @@ gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; debounce-interval = <60>; }; - }; leds { diff --git a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts index e899e02fe..e4bd7c209 100644 --- a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts +++ b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts @@ -80,7 +80,6 @@ default-state = "off"; linux,default-trigger = "phy0tpt"; }; - }; rtl8367 { diff --git a/target/linux/ath79/dts/ar9132.dtsi b/target/linux/ath79/dts/ar9132.dtsi index 9d8ddcf9b..226499427 100644 --- a/target/linux/ath79/dts/ar9132.dtsi +++ b/target/linux/ath79/dts/ar9132.dtsi @@ -193,4 +193,5 @@ pll-handle = <&pll>; resets = <&rst 9>; reset-names = "mac"; + qca,mac-idx = <0>; }; diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts index dcd7f33f9..13333d7ca 100644 --- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts +++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts @@ -106,6 +106,7 @@ status = "okay"; mtd-mac-address = <&art 0x1002>; + mtd-mac-address-increment-byte = <3>; mtd-mac-address-increment = <0x40>; }; diff --git a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts index d44ce6702..5e763df51 100644 --- a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts +++ b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts @@ -47,7 +47,6 @@ gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; enable-active-high; }; - }; &spi { diff --git a/target/linux/ath79/dts/ar9341_pcs_cr3000.dts b/target/linux/ath79/dts/ar9341_pcs_cr3000.dts index 3a7903eed..5dcfd89ae 100644 --- a/target/linux/ath79/dts/ar9341_pcs_cr3000.dts +++ b/target/linux/ath79/dts/ar9341_pcs_cr3000.dts @@ -154,7 +154,6 @@ phy-handle = <&swphy0>; mtd-mac-address = <&art 0x0>; mtd-mac-address-increment = <1>; - }; ð1 { diff --git a/target/linux/ath79/dts/ar9344_pcs_cap324.dts b/target/linux/ath79/dts/ar9344_pcs_cap324.dts index bc146bb67..bd7c2a60d 100644 --- a/target/linux/ath79/dts/ar9344_pcs_cap324.dts +++ b/target/linux/ath79/dts/ar9344_pcs_cap324.dts @@ -74,7 +74,6 @@ default-state = "off"; }; }; - }; &ref { diff --git a/target/linux/ath79/dts/ar9344_pcs_cr5000.dts b/target/linux/ath79/dts/ar9344_pcs_cr5000.dts index 869322ac4..826230314 100644 --- a/target/linux/ath79/dts/ar9344_pcs_cr5000.dts +++ b/target/linux/ath79/dts/ar9344_pcs_cr5000.dts @@ -63,7 +63,6 @@ default-state = "off"; }; }; - }; &ref { @@ -218,7 +217,6 @@ swconfig,segment = "wan"; swconfig,portmap = <5 5>; }; - }; &wmac { diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts index 4a3cda535..d1cb6d8d1 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts @@ -96,7 +96,6 @@ gpio-export,output = <1>; gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; }; - }; }; diff --git a/target/linux/ath79/dts/qca9561_avm_fritz4020.dts b/target/linux/ath79/dts/qca9561_avm_fritz4020.dts index 6b2a35c35..6b30c036e 100644 --- a/target/linux/ath79/dts/qca9561_avm_fritz4020.dts +++ b/target/linux/ath79/dts/qca9561_avm_fritz4020.dts @@ -45,7 +45,6 @@ output-high; line-name = "gpio-latch-bit"; }; - }; }; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index 377b9f8fe..9aac1998a 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h @@ -154,6 +154,8 @@ struct ag71xx { struct ag71xx_ring rx_ring ____cacheline_aligned; struct ag71xx_ring tx_ring ____cacheline_aligned; + int mac_idx; + u16 desc_pktlen_mask; u16 rx_buf_size; u8 rx_buf_offset; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 1e0bb6937..d029197d4 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -529,6 +529,60 @@ static void ath79_set_pll(struct ag71xx *ag) udelay(100); } +static void ath79_mii_ctrl_set_if(struct ag71xx *ag, unsigned int mii_if) +{ + u32 t; + + t = __raw_readl(ag->mii_base); + t &= ~(AR71XX_MII_CTRL_IF_MASK); + t |= (mii_if & AR71XX_MII_CTRL_IF_MASK); + __raw_writel(t, ag->mii_base); +} + +static void ath79_mii0_ctrl_set_if(struct ag71xx *ag) +{ + unsigned int mii_if; + + switch (ag->phy_if_mode) { + case PHY_INTERFACE_MODE_MII: + mii_if = AR71XX_MII0_CTRL_IF_MII; + break; + case PHY_INTERFACE_MODE_GMII: + mii_if = AR71XX_MII0_CTRL_IF_GMII; + break; + case PHY_INTERFACE_MODE_RGMII: + mii_if = AR71XX_MII0_CTRL_IF_RGMII; + break; + case PHY_INTERFACE_MODE_RMII: + mii_if = AR71XX_MII0_CTRL_IF_RMII; + break; + default: + WARN(1, "Impossible PHY mode defined.\n"); + return; + } + + ath79_mii_ctrl_set_if(ag, mii_if); +} + +static void ath79_mii1_ctrl_set_if(struct ag71xx *ag) +{ + unsigned int mii_if; + + switch (ag->phy_if_mode) { + case PHY_INTERFACE_MODE_RMII: + mii_if = AR71XX_MII1_CTRL_IF_RMII; + break; + case PHY_INTERFACE_MODE_RGMII: + mii_if = AR71XX_MII1_CTRL_IF_RGMII; + break; + default: + WARN(1, "Impossible PHY mode defined.\n"); + return; + } + + ath79_mii_ctrl_set_if(ag, mii_if); +} + static void ath79_mii_ctrl_set_speed(struct ag71xx *ag) { unsigned int mii_speed; @@ -1427,6 +1481,20 @@ static int ag71xx_probe(struct platform_device *pdev) goto err_free; } + if (of_property_read_u32(np, "qca,mac-idx", &ag->mac_idx)) + ag->mac_idx = -1; + if (ag->mii_base) + switch (ag->mac_idx) { + case 0: + ath79_mii0_ctrl_set_if(ag); + break; + case 1: + ath79_mii1_ctrl_set_if(ag); + break; + default: + break; + } + netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c index 0bfc1546c..58aef7487 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c @@ -183,8 +183,8 @@ static int ag71xx_mdio_probe(struct platform_device *pdev) return -ENOMEM; am->mii_regmap = syscon_regmap_lookup_by_phandle(np, "regmap"); - if (!am->mii_regmap) - return -ENOENT; + if (IS_ERR(am->mii_regmap)) + return PTR_ERR(am->mii_regmap); mii_bus = devm_mdiobus_alloc(amdev); if (!mii_bus) diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index a7d0d89aa..b2194a413 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -5,6 +5,7 @@ CONFIG_IP17XX_PHY=y CONFIG_LEDS_RESET=y CONFIG_MARVELL_PHY=y CONFIG_MICREL_PHY=y +CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_OF_ADDRESS_PCI=y CONFIG_OF_PCI=y diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 4681996a7..49f5fcc4f 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -117,3 +117,33 @@ define Device/ubnt_unifiac-pro SUPPORTED_DEVICES += ubnt-unifiac-pro endef TARGET_DEVICES += ubnt_unifiac-pro + +define Device/ubnt_routerstation_common + DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig + ATH_SOC := ar7161 + IMAGE_SIZE := 16128k + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) | append-metadata + KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + KERNEL_INITRAMFS := kernel-bin | append-dtb +endef + +define Device/ubnt_routerstation + $(Device/ubnt_routerstation_common) + DEVICE_TITLE := Ubiquiti RouterStation + UBNT_BOARD := RS + UBNT_TYPE := RSx + UBNT_CHIP := ar7100 + DEVICE_PACKAGES += -swconfig +endef +TARGET_DEVICES += ubnt_routerstation + +define Device/ubnt_routerstation-pro + $(Device/ubnt_routerstation_common) + DEVICE_TITLE := Ubiquiti RouterStation Pro + UBNT_BOARD := RSPRO + UBNT_TYPE := RSPRO + UBNT_CHIP := ar7100pro +endef +TARGET_DEVICES += ubnt_routerstation-pro diff --git a/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch b/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch index ae3e6c068..bd26107af 100644 --- a/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch +++ b/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch @@ -1,14 +1,14 @@ -From cb376159800b9b44be76949c3aee89eb06d29faa Mon Sep 17 00:00:00 2001 +From f3eacff2310a60348a755c50a8da6fc251fc8587 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 6 Mar 2018 09:55:13 +0100 -Subject: [PATCH 07/27] irqchip/irq-ath79-intc: add irq cascade driver for +Subject: [PATCH 07/33] irqchip/irq-ath79-intc: add irq cascade driver for QCA9556 SoCs Signed-off-by: John Crispin --- drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-ath79-intc.c | 104 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 105 insertions(+) + drivers/irqchip/irq-ath79-intc.c | 142 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 143 insertions(+) create mode 100644 drivers/irqchip/irq-ath79-intc.c --- a/drivers/irqchip/Makefile diff --git a/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch b/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch index 84e066e2a..b5ad731d0 100644 --- a/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch +++ b/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch @@ -1,7 +1,7 @@ -From f711421eb5f6f790f1ebc09a13ae4aed8ba5f67b Mon Sep 17 00:00:00 2001 +From e029f998594f151008ecbfa024e2957edd2a5189 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 6 Mar 2018 09:58:19 +0100 -Subject: [PATCH 08/27] irqchip/irq-ath79-cpu: drop !OF init helper +Subject: [PATCH 08/33] irqchip/irq-ath79-cpu: drop !OF init helper Signed-off-by: John Crispin --- diff --git a/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch b/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch index ce6124f6e..a8092177b 100644 --- a/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch +++ b/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch @@ -1,12 +1,21 @@ -From 3ea2bff4ed3ce74dc4303aa20f5e906e78352f6b Mon Sep 17 00:00:00 2001 -From: John Crispin +From e93fe20529aeb8738b87533f66c46e2c21524530 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos Date: Tue, 6 Mar 2018 10:06:10 +0100 -Subject: [PATCH 09/27] MIPS: ath79: add lots of missing registers +Subject: [PATCH 09/33] MIPS: ath79: add lots of missing registers +This patch adds many new registers for various QCA MIPS SoCs. The patch is +an aggragate of many contributions made to OpenWrt. + +Signed-off-by: Gabor Juhos +Signed-off-by: Henryk Heisig +Signed-off-by: Matthias Schiffer +Signed-off-by: Weijie Gao +Signed-off-by: Felix Fietkau +Signed-off-by: Julien Dusser Signed-off-by: John Crispin --- - arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 773 ++++++++++++++++++++++++- - 1 file changed, 771 insertions(+), 2 deletions(-) + arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 771 ++++++++++++++++++++++++- + 1 file changed, 770 insertions(+), 1 deletion(-) --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h @@ -650,7 +659,7 @@ Signed-off-by: John Crispin /* * SRIF block -@@ -552,4 +1007,322 @@ +@@ -552,4 +1007,318 @@ #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 @@ -876,10 +885,6 @@ Signed-off-by: John Crispin +#define AR934X_ETH_CFG_RDV_DELAY BIT(16) +#define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 +#define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 -+#define AR934X_ETH_CFG_TXD_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_TXD_DELAY_SHIFT 18 -+#define AR934X_ETH_CFG_TXE_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_TXE_DELAY_SHIFT 20 + +/* + * QCA953X GMAC Interface diff --git a/target/linux/ath79/patches-4.14/0010-MIPS-ath79-add-support-for-QCA953x-QCA956x-TP9343.patch b/target/linux/ath79/patches-4.14/0010-MIPS-ath79-add-support-for-QCA953x-QCA956x-TP9343.patch new file mode 100644 index 000000000..fcf4fe47f --- /dev/null +++ b/target/linux/ath79/patches-4.14/0010-MIPS-ath79-add-support-for-QCA953x-QCA956x-TP9343.patch @@ -0,0 +1,400 @@ +From 2741304648dbdab7697d7758166a582b5291c53d Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Sat, 23 Jun 2018 15:08:56 +0200 +Subject: [PATCH 10/33] MIPS: ath79: add support for QCA953x QCA956x TP9343 + +This patch adds support for 2 new types of QCA silicon. TP9343 is +essentially the same as the QCA956X but is licensed by TPLink. + +Signed-off-by: Weijie Gao +Signed-off-by: Matthias Schiffer +Signed-off-by: John Crispin +--- + arch/mips/ath79/clock.c | 193 +++++++++++++++++++++++++++++++ + arch/mips/ath79/common.c | 8 ++ + arch/mips/ath79/early_printk.c | 4 + + arch/mips/ath79/setup.c | 34 +++++- + arch/mips/include/asm/mach-ath79/ath79.h | 33 ++++++ + 5 files changed, 269 insertions(+), 3 deletions(-) + +--- a/arch/mips/ath79/clock.c ++++ b/arch/mips/ath79/clock.c +@@ -355,6 +355,91 @@ static void __init ar934x_clocks_init(vo + iounmap(dpll_base); + } + ++static void __init qca953x_clocks_init(void) ++{ ++ unsigned long ref_rate; ++ unsigned long cpu_rate; ++ unsigned long ddr_rate; ++ unsigned long ahb_rate; ++ u32 pll, out_div, ref_div, nint, frac, clk_ctrl, postdiv; ++ u32 cpu_pll, ddr_pll; ++ u32 bootstrap; ++ ++ bootstrap = ath79_reset_rr(QCA953X_RESET_REG_BOOTSTRAP); ++ if (bootstrap & QCA953X_BOOTSTRAP_REF_CLK_40) ++ ref_rate = 40 * 1000 * 1000; ++ else ++ ref_rate = 25 * 1000 * 1000; ++ ++ pll = ath79_pll_rr(QCA953X_PLL_CPU_CONFIG_REG); ++ out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & ++ QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; ++ ref_div = (pll >> QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT) & ++ QCA953X_PLL_CPU_CONFIG_REFDIV_MASK; ++ nint = (pll >> QCA953X_PLL_CPU_CONFIG_NINT_SHIFT) & ++ QCA953X_PLL_CPU_CONFIG_NINT_MASK; ++ frac = (pll >> QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT) & ++ QCA953X_PLL_CPU_CONFIG_NFRAC_MASK; ++ ++ cpu_pll = nint * ref_rate / ref_div; ++ cpu_pll += frac * (ref_rate >> 6) / ref_div; ++ cpu_pll /= (1 << out_div); ++ ++ pll = ath79_pll_rr(QCA953X_PLL_DDR_CONFIG_REG); ++ out_div = (pll >> QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & ++ QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK; ++ ref_div = (pll >> QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT) & ++ QCA953X_PLL_DDR_CONFIG_REFDIV_MASK; ++ nint = (pll >> QCA953X_PLL_DDR_CONFIG_NINT_SHIFT) & ++ QCA953X_PLL_DDR_CONFIG_NINT_MASK; ++ frac = (pll >> QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT) & ++ QCA953X_PLL_DDR_CONFIG_NFRAC_MASK; ++ ++ ddr_pll = nint * ref_rate / ref_div; ++ ddr_pll += frac * (ref_rate >> 6) / (ref_div << 4); ++ ddr_pll /= (1 << out_div); ++ ++ clk_ctrl = ath79_pll_rr(QCA953X_PLL_CLK_CTRL_REG); ++ ++ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & ++ QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS) ++ cpu_rate = ref_rate; ++ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL) ++ cpu_rate = cpu_pll / (postdiv + 1); ++ else ++ cpu_rate = ddr_pll / (postdiv + 1); ++ ++ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & ++ QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS) ++ ddr_rate = ref_rate; ++ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL) ++ ddr_rate = ddr_pll / (postdiv + 1); ++ else ++ ddr_rate = cpu_pll / (postdiv + 1); ++ ++ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & ++ QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS) ++ ahb_rate = ref_rate; ++ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) ++ ahb_rate = ddr_pll / (postdiv + 1); ++ else ++ ahb_rate = cpu_pll / (postdiv + 1); ++ ++ ath79_add_sys_clkdev("ref", ref_rate); ++ ath79_add_sys_clkdev("cpu", cpu_rate); ++ ath79_add_sys_clkdev("ddr", ddr_rate); ++ ath79_add_sys_clkdev("ahb", ahb_rate); ++ ++ clk_add_alias("wdt", NULL, "ref", NULL); ++ clk_add_alias("uart", NULL, "ref", NULL); ++} ++ + static void __init qca955x_clocks_init(void) + { + unsigned long ref_rate; +@@ -440,6 +525,110 @@ static void __init qca955x_clocks_init(v + clk_add_alias("uart", NULL, "ref", NULL); + } + ++static void __init qca956x_clocks_init(void) ++{ ++ unsigned long ref_rate; ++ unsigned long cpu_rate; ++ unsigned long ddr_rate; ++ unsigned long ahb_rate; ++ u32 pll, out_div, ref_div, nint, hfrac, lfrac, clk_ctrl, postdiv; ++ u32 cpu_pll, ddr_pll; ++ u32 bootstrap; ++ ++ /* ++ * QCA956x timer init workaround has to be applied right before setting ++ * up the clock. Else, there will be no jiffies ++ */ ++ u32 misc; ++ ++ misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); ++ misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; ++ ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); ++ ++ bootstrap = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); ++ if (bootstrap & QCA956X_BOOTSTRAP_REF_CLK_40) ++ ref_rate = 40 * 1000 * 1000; ++ else ++ ref_rate = 25 * 1000 * 1000; ++ ++ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG_REG); ++ out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; ++ ref_div = (pll >> QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG_REFDIV_MASK; ++ ++ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG1_REG); ++ nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG1_NINT_MASK; ++ hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK; ++ lfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK; ++ ++ cpu_pll = nint * ref_rate / ref_div; ++ cpu_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); ++ cpu_pll += (hfrac >> 13) * ref_rate / ref_div; ++ cpu_pll /= (1 << out_div); ++ ++ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG_REG); ++ out_div = (pll >> QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK; ++ ref_div = (pll >> QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG_REFDIV_MASK; ++ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG1_REG); ++ nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG1_NINT_MASK; ++ hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK; ++ lfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK; ++ ++ ddr_pll = nint * ref_rate / ref_div; ++ ddr_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); ++ ddr_pll += (hfrac >> 13) * ref_rate / ref_div; ++ ddr_pll /= (1 << out_div); ++ ++ clk_ctrl = ath79_pll_rr(QCA956X_PLL_CLK_CTRL_REG); ++ ++ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & ++ QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS) ++ cpu_rate = ref_rate; ++ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL) ++ cpu_rate = ddr_pll / (postdiv + 1); ++ else ++ cpu_rate = cpu_pll / (postdiv + 1); ++ ++ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & ++ QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS) ++ ddr_rate = ref_rate; ++ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL) ++ ddr_rate = cpu_pll / (postdiv + 1); ++ else ++ ddr_rate = ddr_pll / (postdiv + 1); ++ ++ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & ++ QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS) ++ ahb_rate = ref_rate; ++ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) ++ ahb_rate = ddr_pll / (postdiv + 1); ++ else ++ ahb_rate = cpu_pll / (postdiv + 1); ++ ++ ath79_add_sys_clkdev("ref", ref_rate); ++ ath79_add_sys_clkdev("cpu", cpu_rate); ++ ath79_add_sys_clkdev("ddr", ddr_rate); ++ ath79_add_sys_clkdev("ahb", ahb_rate); ++ ++ clk_add_alias("wdt", NULL, "ref", NULL); ++ clk_add_alias("uart", NULL, "ref", NULL); ++} ++ + void __init ath79_clocks_init(void) + { + if (soc_is_ar71xx()) +@@ -450,8 +639,12 @@ void __init ath79_clocks_init(void) + ar933x_clocks_init(); + else if (soc_is_ar934x()) + ar934x_clocks_init(); ++ else if (soc_is_qca953x()) ++ qca953x_clocks_init(); + else if (soc_is_qca955x()) + qca955x_clocks_init(); ++ else if (soc_is_qca956x() || soc_is_tp9343()) ++ qca956x_clocks_init(); + else + BUG(); + } +--- a/arch/mips/ath79/common.c ++++ b/arch/mips/ath79/common.c +@@ -103,8 +103,12 @@ void ath79_device_reset_set(u32 mask) + reg = AR933X_RESET_REG_RESET_MODULE; + else if (soc_is_ar934x()) + reg = AR934X_RESET_REG_RESET_MODULE; ++ else if (soc_is_qca953x()) ++ reg = QCA953X_RESET_REG_RESET_MODULE; + else if (soc_is_qca955x()) + reg = QCA955X_RESET_REG_RESET_MODULE; ++ else if (soc_is_qca956x() || soc_is_tp9343()) ++ reg = QCA956X_RESET_REG_RESET_MODULE; + else + BUG(); + +@@ -131,8 +135,12 @@ void ath79_device_reset_clear(u32 mask) + reg = AR933X_RESET_REG_RESET_MODULE; + else if (soc_is_ar934x()) + reg = AR934X_RESET_REG_RESET_MODULE; ++ else if (soc_is_qca953x()) ++ reg = QCA953X_RESET_REG_RESET_MODULE; + else if (soc_is_qca955x()) + reg = QCA955X_RESET_REG_RESET_MODULE; ++ else if (soc_is_qca956x() || soc_is_tp9343()) ++ reg = QCA956X_RESET_REG_RESET_MODULE; + else + BUG(); + +--- a/arch/mips/ath79/early_printk.c ++++ b/arch/mips/ath79/early_printk.c +@@ -76,8 +76,12 @@ static void prom_putchar_init(void) + case REV_ID_MAJOR_AR9341: + case REV_ID_MAJOR_AR9342: + case REV_ID_MAJOR_AR9344: ++ case REV_ID_MAJOR_QCA9533: ++ case REV_ID_MAJOR_QCA9533_V2: + case REV_ID_MAJOR_QCA9556: + case REV_ID_MAJOR_QCA9558: ++ case REV_ID_MAJOR_TP9343: ++ case REV_ID_MAJOR_QCA956X: + _prom_putchar = prom_putchar_ar71xx; + break; + +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -59,6 +59,7 @@ static void __init ath79_detect_sys_type + u32 major; + u32 minor; + u32 rev = 0; ++ u32 ver = 1; + + id = ath79_reset_rr(AR71XX_RESET_REG_REV_ID); + major = id & REV_ID_MAJOR_MASK; +@@ -151,6 +152,17 @@ static void __init ath79_detect_sys_type + rev = id & AR934X_REV_ID_REVISION_MASK; + break; + ++ case REV_ID_MAJOR_QCA9533_V2: ++ ver = 2; ++ ath79_soc_rev = 2; ++ /* drop through */ ++ ++ case REV_ID_MAJOR_QCA9533: ++ ath79_soc = ATH79_SOC_QCA9533; ++ chip = "9533"; ++ rev = id & QCA953X_REV_ID_REVISION_MASK; ++ break; ++ + case REV_ID_MAJOR_QCA9556: + ath79_soc = ATH79_SOC_QCA9556; + chip = "9556"; +@@ -163,14 +175,30 @@ static void __init ath79_detect_sys_type + rev = id & QCA955X_REV_ID_REVISION_MASK; + break; + ++ case REV_ID_MAJOR_QCA956X: ++ ath79_soc = ATH79_SOC_QCA956X; ++ chip = "956X"; ++ rev = id & QCA956X_REV_ID_REVISION_MASK; ++ break; ++ ++ case REV_ID_MAJOR_TP9343: ++ ath79_soc = ATH79_SOC_TP9343; ++ chip = "9343"; ++ rev = id & QCA956X_REV_ID_REVISION_MASK; ++ break; ++ + default: + panic("ath79: unknown SoC, id:0x%08x", id); + } + +- ath79_soc_rev = rev; ++ if (ver == 1) ++ ath79_soc_rev = rev; + +- if (soc_is_qca955x()) +- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u", ++ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x()) ++ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", ++ chip, ver, rev); ++ else if (soc_is_tp9343()) ++ sprintf(ath79_sys_type, "Qualcomm Atheros TP%s rev %u", + chip, rev); + else + sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); +--- a/arch/mips/include/asm/mach-ath79/ath79.h ++++ b/arch/mips/include/asm/mach-ath79/ath79.h +@@ -32,8 +32,11 @@ enum ath79_soc_type { + ATH79_SOC_AR9341, + ATH79_SOC_AR9342, + ATH79_SOC_AR9344, ++ ATH79_SOC_QCA9533, + ATH79_SOC_QCA9556, + ATH79_SOC_QCA9558, ++ ATH79_SOC_TP9343, ++ ATH79_SOC_QCA956X, + }; + + extern enum ath79_soc_type ath79_soc; +@@ -100,6 +103,16 @@ static inline int soc_is_ar934x(void) + return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344(); + } + ++static inline int soc_is_qca9533(void) ++{ ++ return ath79_soc == ATH79_SOC_QCA9533; ++} ++ ++static inline int soc_is_qca953x(void) ++{ ++ return soc_is_qca9533(); ++} ++ + static inline int soc_is_qca9556(void) + { + return ath79_soc == ATH79_SOC_QCA9556; +@@ -115,6 +128,26 @@ static inline int soc_is_qca955x(void) + return soc_is_qca9556() || soc_is_qca9558(); + } + ++static inline int soc_is_tp9343(void) ++{ ++ return ath79_soc == ATH79_SOC_TP9343; ++} ++ ++static inline int soc_is_qca9561(void) ++{ ++ return ath79_soc == ATH79_SOC_QCA956X; ++} ++ ++static inline int soc_is_qca9563(void) ++{ ++ return ath79_soc == ATH79_SOC_QCA956X; ++} ++ ++static inline int soc_is_qca956x(void) ++{ ++ return soc_is_qca9561() || soc_is_qca9563(); ++} ++ + void ath79_ddr_wb_flush(unsigned int reg); + void ath79_ddr_set_pci_windows(void); + diff --git a/target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch b/target/linux/ath79/patches-4.14/0011-MIPS-ath79-select-the-PINCTRL-subsystem.patch similarity index 60% rename from target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch rename to target/linux/ath79/patches-4.14/0011-MIPS-ath79-select-the-PINCTRL-subsystem.patch index cd3f96c3f..28782e6c4 100644 --- a/target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch +++ b/target/linux/ath79/patches-4.14/0011-MIPS-ath79-select-the-PINCTRL-subsystem.patch @@ -1,7 +1,11 @@ -From f3d5027255ef0752ed12b65c3bf7eb363fc3c096 Mon Sep 17 00:00:00 2001 +From 0c8856211d26f84277f7fcb0b9595e5c646bc464 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 6 Mar 2018 10:00:55 +0100 -Subject: [PATCH 10/27] MIPS: ath79: select the PINCTRL subsystem +Subject: [PATCH 11/33] MIPS: ath79: select the PINCTRL subsystem + +The pinmux on QCA SoCs is controlled by a single register. The +"pinctrl-single" driver can be used but requires the target +to select PINCTRL. Signed-off-by: John Crispin --- diff --git a/target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch b/target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch deleted file mode 100644 index 2b744ee94..000000000 --- a/target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ac3a5ee699f3baa7654c93a3ffda46be82443344 Mon Sep 17 00:00:00 2001 -From: Markos Chandras -Date: Wed, 21 Aug 2013 11:47:22 +0100 -Subject: [PATCH 12/27] MIPS: ath79: Avoid using unitialized 'reg' variable - -Fixes the following build error: -arch/mips/include/asm/mach-ath79/ath79.h:139:20: error: 'reg' may be used -uninitialized in this function [-Werror=maybe-uninitialized] -arch/mips/ath79/common.c:62:6: note: 'reg' was declared here -In file included from arch/mips/ath79/common.c:20:0: -arch/mips/ath79/common.c: In function 'ath79_device_reset_clear': -arch/mips/include/asm/mach-ath79/ath79.h:139:20: -error: 'reg' may be used uninitialized in this function -[-Werror=maybe-uninitialized] -arch/mips/ath79/common.c:90:6: note: 'reg' was declared here - -Signed-off-by: Markos Chandras -Acked-by: Gabor Juhos ---- - arch/mips/ath79/common.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -106,7 +106,7 @@ void ath79_device_reset_set(u32 mask) - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -- BUG(); -+ panic("Reset register not defined for this SOC"); - - spin_lock_irqsave(&ath79_device_reset_lock, flags); - t = ath79_reset_rr(reg); -@@ -134,7 +134,7 @@ void ath79_device_reset_clear(u32 mask) - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -- BUG(); -+ panic("Reset register not defined for this SOC"); - - spin_lock_irqsave(&ath79_device_reset_lock, flags); - t = ath79_reset_rr(reg); diff --git a/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch b/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch index 969636128..a23304930 100644 --- a/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch +++ b/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch @@ -1,7 +1,10 @@ -From 11562939754b8f877562d9a137854022eb521716 Mon Sep 17 00:00:00 2001 +From 59c7470bc5c4b29ed77d46fc4982f1d85b5cbec1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 Mar 2018 11:33:54 +0100 -Subject: [PATCH 13/27] MIPS: ath79: fix system restart +Subject: [PATCH 13/33] MIPS: ath79: fix system restart + +This patch disables irq on reboot to fix hang issues that were observed +due to pending interrupts. Signed-off-by: Felix Fietkau Signed-off-by: John Crispin @@ -22,7 +25,7 @@ Signed-off-by: John Crispin if (cpu_wait) --- a/arch/mips/include/asm/mach-ath79/ath79.h +++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -134,6 +134,7 @@ static inline u32 ath79_pll_rr(unsigned +@@ -167,6 +167,7 @@ static inline u32 ath79_pll_rr(unsigned static inline void ath79_reset_wr(unsigned reg, u32 val) { __raw_writel(val, ath79_reset_base + reg); diff --git a/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch b/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch index e390e584f..534111c2b 100644 --- a/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch +++ b/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch @@ -1,9 +1,13 @@ -From 5a8496923bafc4350f51b26964fdc3252a09fd79 Mon Sep 17 00:00:00 2001 +From 30dc99e95ac4410072850ae466f696cb56097bb4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 Mar 2018 11:35:29 +0100 -Subject: [PATCH 14/27] MIPS: ath79: finetune cpu-overrides +Subject: [PATCH 14/33] MIPS: ath79: finetune cpu-overrides + +This patch adds a few additional cpu feature overrides so that they do not +need to be probed at runtime. Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch b/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch index 5826d0176..eaa960a6e 100644 --- a/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch +++ b/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch @@ -1,9 +1,13 @@ -From b14f8260724abec6c82970085dece6a143d3a0db Mon Sep 17 00:00:00 2001 +From f55a400f4a691f3750eaf7bfcd6ecbf7ed1622f0 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 5 Mar 2018 11:38:21 +0100 -Subject: [PATCH 15/27] MIPS: ath79: enable uart during early_prink +Subject: [PATCH 15/33] MIPS: ath79: enable uart during early_prink + +This patch ensures, that the poinmux register is properly setup for the +boot console uart when early_printk is enabled. Signed-off-by: Gabor Juhos +Signed-off-by: John Crispin --- arch/mips/ath79/early_printk.c | 44 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) @@ -57,7 +61,7 @@ Signed-off-by: Gabor Juhos static void prom_putchar_init(void) { void __iomem *base; -@@ -88,8 +128,10 @@ static void prom_putchar_init(void) +@@ -92,8 +132,10 @@ static void prom_putchar_init(void) default: _prom_putchar = prom_putchar_dummy; diff --git a/target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch b/target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch deleted file mode 100644 index 0432a23d1..000000000 --- a/target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch +++ /dev/null @@ -1,331 +0,0 @@ -From cff23ba486e3c5d17c4d7e446f5eddead855c101 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 08:45:55 +0100 -Subject: [PATCH 16/27] MIPS: ath79: add support for QCA953x SoC - -Note that the clock calculation looks very similar to the QCA955x, but the -meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. - -Signed-off-by: Matthias Schiffer ---- - arch/mips/ath79/Kconfig | 6 ++- - arch/mips/ath79/clock.c | 87 ++++++++++++++++++++++++++++++++ - arch/mips/ath79/common.c | 4 ++ - arch/mips/ath79/dev-common.c | 4 ++ - arch/mips/ath79/early_printk.c | 2 + - arch/mips/ath79/irq.c | 33 +++++++++++- - arch/mips/ath79/setup.c | 21 ++++++-- - arch/mips/include/asm/mach-ath79/ath79.h | 11 ++++ - 8 files changed, 162 insertions(+), 6 deletions(-) - ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -94,6 +94,10 @@ config SOC_AR934X - select PCI_AR724X if PCI - def_bool n - -+config SOC_QCA953X -+ select USB_ARCH_HAS_EHCI -+ def_bool n -+ - config SOC_QCA955X - select HW_HAS_PCI - select PCI_AR724X if PCI -@@ -115,7 +119,7 @@ config ATH79_DEV_USB - def_bool n - - config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X) - def_bool n - - endif ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -355,6 +355,91 @@ static void __init ar934x_clocks_init(vo - iounmap(dpll_base); - } - -+static void __init qca953x_clocks_init(void) -+{ -+ unsigned long ref_rate; -+ unsigned long cpu_rate; -+ unsigned long ddr_rate; -+ unsigned long ahb_rate; -+ u32 pll, out_div, ref_div, nint, frac, clk_ctrl, postdiv; -+ u32 cpu_pll, ddr_pll; -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(QCA953X_RESET_REG_BOOTSTRAP); -+ if (bootstrap & QCA953X_BOOTSTRAP_REF_CLK_40) -+ ref_rate = 40 * 1000 * 1000; -+ else -+ ref_rate = 25 * 1000 * 1000; -+ -+ pll = ath79_pll_rr(QCA953X_PLL_CPU_CONFIG_REG); -+ out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_REFDIV_MASK; -+ nint = (pll >> QCA953X_PLL_CPU_CONFIG_NINT_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_NINT_MASK; -+ frac = (pll >> QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_NFRAC_MASK; -+ -+ cpu_pll = nint * ref_rate / ref_div; -+ cpu_pll += frac * (ref_rate >> 6) / ref_div; -+ cpu_pll /= (1 << out_div); -+ -+ pll = ath79_pll_rr(QCA953X_PLL_DDR_CONFIG_REG); -+ out_div = (pll >> QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_REFDIV_MASK; -+ nint = (pll >> QCA953X_PLL_DDR_CONFIG_NINT_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_NINT_MASK; -+ frac = (pll >> QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_NFRAC_MASK; -+ -+ ddr_pll = nint * ref_rate / ref_div; -+ ddr_pll += frac * (ref_rate >> 6) / (ref_div << 4); -+ ddr_pll /= (1 << out_div); -+ -+ clk_ctrl = ath79_pll_rr(QCA953X_PLL_CLK_CTRL_REG); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS) -+ cpu_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL) -+ cpu_rate = cpu_pll / (postdiv + 1); -+ else -+ cpu_rate = ddr_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS) -+ ddr_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL) -+ ddr_rate = ddr_pll / (postdiv + 1); -+ else -+ ddr_rate = cpu_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS) -+ ahb_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) -+ ahb_rate = ddr_pll / (postdiv + 1); -+ else -+ ahb_rate = cpu_pll / (postdiv + 1); -+ -+ ath79_add_sys_clkdev("ref", ref_rate); -+ ath79_add_sys_clkdev("cpu", cpu_rate); -+ ath79_add_sys_clkdev("ddr", ddr_rate); -+ ath79_add_sys_clkdev("ahb", ahb_rate); -+ -+ clk_add_alias("wdt", NULL, "ref", NULL); -+ clk_add_alias("uart", NULL, "ref", NULL); -+} -+ - static void __init qca955x_clocks_init(void) - { - unsigned long ref_rate; -@@ -450,6 +535,8 @@ void __init ath79_clocks_init(void) - ar933x_clocks_init(); - else if (soc_is_ar934x()) - ar934x_clocks_init(); -+ else if (soc_is_qca953x()) -+ qca953x_clocks_init(); - else if (soc_is_qca955x()) - qca955x_clocks_init(); - else ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -103,6 +103,8 @@ void ath79_device_reset_set(u32 mask) - reg = AR933X_RESET_REG_RESET_MODULE; - else if (soc_is_ar934x()) - reg = AR934X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca953x()) -+ reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -@@ -131,6 +133,8 @@ void ath79_device_reset_clear(u32 mask) - reg = AR933X_RESET_REG_RESET_MODULE; - else if (soc_is_ar934x()) - reg = AR934X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca953x()) -+ reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -85,6 +85,7 @@ void __init ath79_register_uart(void) - soc_is_ar724x() || - soc_is_ar913x() || - soc_is_ar934x() || -+ soc_is_qca953x() || - soc_is_qca955x()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); -@@ -148,6 +149,9 @@ void __init ath79_gpio_init(void) - } else if (soc_is_ar934x()) { - ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -+ } else if (soc_is_qca953x()) { -+ ath79_gpio_pdata.ngpios = QCA953X_GPIO_COUNT; -+ ath79_gpio_pdata.oe_inverted = 1; - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -116,6 +116,8 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_AR9341: - case REV_ID_MAJOR_AR9342: - case REV_ID_MAJOR_AR9344: -+ case REV_ID_MAJOR_QCA9533: -+ case REV_ID_MAJOR_QCA9533_V2: - case REV_ID_MAJOR_QCA9556: - case REV_ID_MAJOR_QCA9558: - _prom_putchar = prom_putchar_ar71xx; ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -56,6 +56,34 @@ static void ar934x_ip2_irq_init(void) - irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch); - } - -+static void qca953x_ip2_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS); -+ -+ if (status & QCA953X_PCIE_WMAC_INT_PCIE_ALL) { -+ ath79_ddr_wb_flush(3); -+ generic_handle_irq(ATH79_IP2_IRQ(0)); -+ } else if (status & QCA953X_PCIE_WMAC_INT_WMAC_ALL) { -+ ath79_ddr_wb_flush(4); -+ generic_handle_irq(ATH79_IP2_IRQ(1)); -+ } else { -+ spurious_interrupt(); -+ } -+} -+ -+static void qca953x_irq_init(void) -+{ -+ int i; -+ -+ for (i = ATH79_IP2_IRQ_BASE; -+ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch); -+} -+ - static void qca955x_ip2_irq_dispatch(struct irq_desc *desc) - { - u32 status; -@@ -143,7 +171,7 @@ void __init arch_init_irq(void) - soc_is_ar913x() || soc_is_ar933x()) { - irq_wb_chan2 = 3; - irq_wb_chan3 = 2; -- } else if (soc_is_ar934x()) { -+ } else if (soc_is_ar934x() || soc_is_qca953x()) { - irq_wb_chan3 = 2; - } - -@@ -154,6 +182,7 @@ void __init arch_init_irq(void) - else if (soc_is_ar724x() || - soc_is_ar933x() || - soc_is_ar934x() || -+ soc_is_qca953x() || - soc_is_qca955x()) - misc_is_ar71xx = false; - else -@@ -164,6 +193,8 @@ void __init arch_init_irq(void) - - if (soc_is_ar934x()) - ar934x_ip2_irq_init(); -+ else if (soc_is_qca953x()) -+ qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); - } ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -60,6 +60,7 @@ static void __init ath79_detect_sys_type - u32 major; - u32 minor; - u32 rev = 0; -+ u32 ver = 1; - - id = ath79_reset_rr(AR71XX_RESET_REG_REV_ID); - major = id & REV_ID_MAJOR_MASK; -@@ -152,6 +153,17 @@ static void __init ath79_detect_sys_type - rev = id & AR934X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCA9533_V2: -+ ver = 2; -+ ath79_soc_rev = 2; -+ /* drop through */ -+ -+ case REV_ID_MAJOR_QCA9533: -+ ath79_soc = ATH79_SOC_QCA9533; -+ chip = "9533"; -+ rev = id & QCA953X_REV_ID_REVISION_MASK; -+ break; -+ - case REV_ID_MAJOR_QCA9556: - ath79_soc = ATH79_SOC_QCA9556; - chip = "9556"; -@@ -168,11 +180,12 @@ static void __init ath79_detect_sys_type - panic("ath79: unknown SoC, id:0x%08x", id); - } - -- ath79_soc_rev = rev; -+ if (ver == 1) -+ ath79_soc_rev = rev; - -- if (soc_is_qca955x()) -- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u", -- chip, rev); -+ if (soc_is_qca953x() || soc_is_qca955x()) -+ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", -+ chip, ver, rev); - else - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); - pr_info("SoC: %s\n", ath79_sys_type); ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -32,6 +32,7 @@ enum ath79_soc_type { - ATH79_SOC_AR9341, - ATH79_SOC_AR9342, - ATH79_SOC_AR9344, -+ ATH79_SOC_QCA9533, - ATH79_SOC_QCA9556, - ATH79_SOC_QCA9558, - }; -@@ -100,6 +101,16 @@ static inline int soc_is_ar934x(void) - return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344(); - } - -+static inline int soc_is_qca9533(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA9533; -+} -+ -+static inline int soc_is_qca953x(void) -+{ -+ return soc_is_qca9533(); -+} -+ - static inline int soc_is_qca9556(void) - { - return ath79_soc == ATH79_SOC_QCA9556; diff --git a/target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch b/target/linux/ath79/patches-4.14/0016-MIPS-ath79-get-PCIe-controller-out-of-reset.patch similarity index 94% rename from target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch rename to target/linux/ath79/patches-4.14/0016-MIPS-ath79-get-PCIe-controller-out-of-reset.patch index f435e9bc1..05f15b1df 100644 --- a/target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch +++ b/target/linux/ath79/patches-4.14/0016-MIPS-ath79-get-PCIe-controller-out-of-reset.patch @@ -1,7 +1,7 @@ -From 308c2ef9c4f1be2e1cee699042671eb973b51803 Mon Sep 17 00:00:00 2001 +From d3fa9694bc71338161ae2b9c7ee08b57b8140f93 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Tue, 6 Mar 2018 08:37:43 +0100 -Subject: [PATCH 19/27] MIPS: ath79: get PCIe controller out of reset +Subject: [PATCH 16/33] MIPS: ath79: get PCIe controller out of reset The ar724x pci driver expects the PCIe controller to be brought out of reset by the bootloader. @@ -21,6 +21,7 @@ took up to 20ms till the link was up. Giving the link up to 100ms should work for all cases. Signed-off-by: Mathias Kresin +Signed-off-by: John Crispin --- arch/mips/pci/pci-ar724x.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch b/target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch deleted file mode 100644 index 294fb32a1..000000000 --- a/target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch +++ /dev/null @@ -1,410 +0,0 @@ -From 6aeb24b9508bbe91f89cd4eb21d0d7582d971146 Mon Sep 17 00:00:00 2001 -From: Weijie Gao -Date: Tue, 6 Mar 2018 08:48:31 +0100 -Subject: [PATCH 17/27] MIPS: ath79: add support for qca956x soc - -This patch adds soc support for QCA9561 and TP9343. -TP9343 is a reduced version of QCA9561, which can be found in TP-LINK routers in China. -The qca956x_wmac has not yet been supported by ath9k. - -tested on TL-WDR6500 and TL-WR882N v1 (Chinese version) - -Signed-off-by: Weijie Gao ---- - arch/mips/ath79/Kconfig | 2 +- - arch/mips/ath79/clock.c | 96 ++++++++++++++++++++++++++++++++ - arch/mips/ath79/common.c | 4 ++ - arch/mips/ath79/dev-common.c | 7 ++- - arch/mips/ath79/early_printk.c | 2 + - arch/mips/ath79/irq.c | 87 ++++++++++++++++++++++++++++- - arch/mips/ath79/pci.c | 12 ++++ - arch/mips/ath79/setup.c | 17 +++++- - arch/mips/include/asm/mach-ath79/ath79.h | 22 ++++++++ - 9 files changed, 245 insertions(+), 4 deletions(-) - ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -119,7 +119,7 @@ config ATH79_DEV_USB - def_bool n - - config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X) -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X) - def_bool n - - endif ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -525,6 +525,100 @@ static void __init qca955x_clocks_init(v - clk_add_alias("uart", NULL, "ref", NULL); - } - -+static void __init qca956x_clocks_init(void) -+{ -+ unsigned long ref_rate; -+ unsigned long cpu_rate; -+ unsigned long ddr_rate; -+ unsigned long ahb_rate; -+ u32 pll, out_div, ref_div, nint, hfrac, lfrac, clk_ctrl, postdiv; -+ u32 cpu_pll, ddr_pll; -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); -+ if (bootstrap & QCA956X_BOOTSTRAP_REF_CLK_40) -+ ref_rate = 40 * 1000 * 1000; -+ else -+ ref_rate = 25 * 1000 * 1000; -+ -+ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG_REG); -+ out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG_REFDIV_MASK; -+ -+ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG1_REG); -+ nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NINT_MASK; -+ hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK; -+ lfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK; -+ -+ cpu_pll = nint * ref_rate / ref_div; -+ cpu_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); -+ cpu_pll += (hfrac >> 13) * ref_rate / ref_div; -+ cpu_pll /= (1 << out_div); -+ -+ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG_REG); -+ out_div = (pll >> QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG_REFDIV_MASK; -+ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG1_REG); -+ nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NINT_MASK; -+ hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK; -+ lfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK; -+ -+ ddr_pll = nint * ref_rate / ref_div; -+ ddr_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); -+ ddr_pll += (hfrac >> 13) * ref_rate / ref_div; -+ ddr_pll /= (1 << out_div); -+ -+ clk_ctrl = ath79_pll_rr(QCA956X_PLL_CLK_CTRL_REG); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS) -+ cpu_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL) -+ cpu_rate = ddr_pll / (postdiv + 1); -+ else -+ cpu_rate = cpu_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS) -+ ddr_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL) -+ ddr_rate = cpu_pll / (postdiv + 1); -+ else -+ ddr_rate = ddr_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS) -+ ahb_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) -+ ahb_rate = ddr_pll / (postdiv + 1); -+ else -+ ahb_rate = cpu_pll / (postdiv + 1); -+ -+ ath79_add_sys_clkdev("ref", ref_rate); -+ ath79_add_sys_clkdev("cpu", cpu_rate); -+ ath79_add_sys_clkdev("ddr", ddr_rate); -+ ath79_add_sys_clkdev("ahb", ahb_rate); -+ -+ clk_add_alias("wdt", NULL, "ref", NULL); -+ clk_add_alias("uart", NULL, "ref", NULL); -+} -+ - void __init ath79_clocks_init(void) - { - if (soc_is_ar71xx()) -@@ -539,6 +633,8 @@ void __init ath79_clocks_init(void) - qca953x_clocks_init(); - else if (soc_is_qca955x()) - qca955x_clocks_init(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_clocks_init(); - else - BUG(); - } ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -107,6 +107,8 @@ void ath79_device_reset_set(u32 mask) - reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - panic("Reset register not defined for this SOC"); - -@@ -137,6 +139,8 @@ void ath79_device_reset_clear(u32 mask) - reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - panic("Reset register not defined for this SOC"); - ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -86,7 +86,9 @@ void __init ath79_register_uart(void) - soc_is_ar913x() || - soc_is_ar934x() || - soc_is_qca953x() || -- soc_is_qca955x()) { -+ soc_is_qca955x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); - } else if (soc_is_ar933x()) { -@@ -155,6 +157,9 @@ void __init ath79_gpio_init(void) - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -+ } else if (soc_is_qca956x() || soc_is_tp9343()) { -+ ath79_gpio_pdata.ngpios = QCA956X_GPIO_COUNT; -+ ath79_gpio_pdata.oe_inverted = 1; - } else { - BUG(); - } ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -120,6 +120,8 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_QCA9533_V2: - case REV_ID_MAJOR_QCA9556: - case REV_ID_MAJOR_QCA9558: -+ case REV_ID_MAJOR_TP9343: -+ case REV_ID_MAJOR_QCA956X: - _prom_putchar = prom_putchar_ar71xx; - break; - ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -156,6 +156,87 @@ static void qca955x_irq_init(void) - irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); - } - -+static void qca956x_ip2_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -+ status &= QCA956X_EXT_INT_PCIE_RC1_ALL | QCA956X_EXT_INT_WMAC_ALL; -+ -+ if (status == 0) { -+ spurious_interrupt(); -+ return; -+ } -+ -+ if (status & QCA956X_EXT_INT_PCIE_RC1_ALL) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP2_IRQ(0)); -+ } -+ -+ if (status & QCA956X_EXT_INT_WMAC_ALL) { -+ /* TODO: flsuh DDR? */ -+ generic_handle_irq(ATH79_IP2_IRQ(1)); -+ } -+} -+ -+static void qca956x_ip3_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -+ status &= QCA956X_EXT_INT_PCIE_RC2_ALL | -+ QCA956X_EXT_INT_USB1 | QCA956X_EXT_INT_USB2; -+ -+ if (status == 0) { -+ spurious_interrupt(); -+ return; -+ } -+ -+ if (status & QCA956X_EXT_INT_USB1) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(0)); -+ } -+ -+ if (status & QCA956X_EXT_INT_USB2) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(1)); -+ } -+ -+ if (status & QCA956X_EXT_INT_PCIE_RC2_ALL) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(2)); -+ } -+} -+ -+static void qca956x_enable_timer_cb(void) { -+ u32 misc; -+ -+ misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); -+ misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; -+ ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); -+} -+ -+static void qca956x_irq_init(void) -+{ -+ int i; -+ -+ for (i = ATH79_IP2_IRQ_BASE; -+ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch); -+ -+ for (i = ATH79_IP3_IRQ_BASE; -+ i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch); -+ -+ /* QCA956x timer init workaround has to be applied right before setting -+ * up the clock. Else, there will be no jiffies */ -+ late_time_init = &qca956x_enable_timer_cb; -+} -+ - void __init arch_init_irq(void) - { - unsigned irq_wb_chan2 = -1; -@@ -183,7 +264,9 @@ void __init arch_init_irq(void) - soc_is_ar933x() || - soc_is_ar934x() || - soc_is_qca953x() || -- soc_is_qca955x()) -+ soc_is_qca955x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) - misc_is_ar71xx = false; - else - BUG(); -@@ -197,4 +280,6 @@ void __init arch_init_irq(void) - qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_irq_init(); - } ---- a/arch/mips/ath79/pci.c -+++ b/arch/mips/ath79/pci.c -@@ -82,6 +82,9 @@ int pcibios_map_irq(const struct pci_dev - } else if (soc_is_qca955x()) { - ath79_pci_irq_map = qca955x_pci_irq_map; - ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); -+ } else if (soc_is_qca956x()) { -+ ath79_pci_irq_map = qca956x_pci_irq_map; -+ ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); - } else { - pr_crit("pci %s: invalid irq map\n", - pci_name((struct pci_dev *) dev)); -@@ -261,6 +264,15 @@ int __init ath79_register_pci(void) - QCA955X_PCI_MEM_SIZE, - 1, - ATH79_IP3_IRQ(2)); -+ } else if (soc_is_qca956x()) { -+ pdev = ath79_register_pci_ar724x(0, -+ QCA956X_PCI_CFG_BASE1, -+ QCA956X_PCI_CTRL_BASE1, -+ QCA956X_PCI_CRP_BASE1, -+ QCA956X_PCI_MEM_BASE1, -+ QCA956X_PCI_MEM_SIZE, -+ 1, -+ ATH79_IP3_IRQ(2)); - } else { - /* No PCI support */ - return -ENODEV; ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -176,6 +176,18 @@ static void __init ath79_detect_sys_type - rev = id & QCA955X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCA956X: -+ ath79_soc = ATH79_SOC_QCA956X; -+ chip = "956X"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ -+ case REV_ID_MAJOR_TP9343: -+ ath79_soc = ATH79_SOC_TP9343; -+ chip = "9343"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ - default: - panic("ath79: unknown SoC, id:0x%08x", id); - } -@@ -183,9 +195,12 @@ static void __init ath79_detect_sys_type - if (ver == 1) - ath79_soc_rev = rev; - -- if (soc_is_qca953x() || soc_is_qca955x()) -+ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x()) - sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", - chip, ver, rev); -+ else if (soc_is_tp9343()) -+ sprintf(ath79_sys_type, "Qualcomm Atheros TP%s rev %u", -+ chip, rev); - else - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); - pr_info("SoC: %s\n", ath79_sys_type); ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -35,6 +35,8 @@ enum ath79_soc_type { - ATH79_SOC_QCA9533, - ATH79_SOC_QCA9556, - ATH79_SOC_QCA9558, -+ ATH79_SOC_TP9343, -+ ATH79_SOC_QCA956X, - }; - - extern enum ath79_soc_type ath79_soc; -@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void) - return soc_is_qca9556() || soc_is_qca9558(); - } - -+static inline int soc_is_tp9343(void) -+{ -+ return ath79_soc == ATH79_SOC_TP9343; -+} -+ -+static inline int soc_is_qca9561(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA956X; -+} -+ -+static inline int soc_is_qca9563(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA956X; -+} -+ -+static inline int soc_is_qca956x(void) -+{ -+ return soc_is_qca9561() || soc_is_qca9563(); -+} -+ - void ath79_ddr_wb_flush(unsigned int reg); - void ath79_ddr_set_pci_windows(void); - diff --git a/target/linux/ath79/patches-4.14/0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch b/target/linux/ath79/patches-4.14/0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch new file mode 100644 index 000000000..bf7eb691a --- /dev/null +++ b/target/linux/ath79/patches-4.14/0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch @@ -0,0 +1,57 @@ +From 4a4f869ec58ed8910b9b2e68d0eee50957e9bb20 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 25 Jun 2018 15:52:10 +0200 +Subject: [PATCH 17/33] dt-bindings: PCI: qcom,ar7100: adds binding doc + +With the driver being converted from platform_data to pure OF, we need to +also add some docs. + +Cc: Rob Herring +Cc: devicetree@vger.kernel.org +Signed-off-by: John Crispin +--- + .../devicetree/bindings/pci/qcom,ar7100-pci.txt | 38 ++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pci/qcom,ar7100-pci.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pci/qcom,ar7100-pci.txt +@@ -0,0 +1,38 @@ ++* Qualcomm Atheros AR7100 PCI express root complex ++ ++Required properties: ++- compatible: should contain "qcom,ar7100-pci" to identify the core. ++- reg: Should contain the register ranges as listed in the reg-names property. ++- reg-names: Definition: Must include the following entries ++ - "cfg_base" IO Memory ++- #address-cells: set to <3> ++- #size-cells: set to <2> ++- ranges: ranges for the PCI memory and I/O regions ++- interrupt-map-mask and interrupt-map: standard PCI ++ properties to define the mapping of the PCIe interface to interrupt ++ numbers. ++- #interrupt-cells: set to <1> ++- interrupt-controller: define to enable the builtin IRQ cascade. ++ ++Optional properties: ++- interrupt-parent: phandle to the MIPS IRQ controller ++ ++* Example for ar7100 ++ pcie-controller@180c0000 { ++ compatible = "qca,ar7100-pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ bus-range = <0x0 0x0>; ++ reg = <0x17010000 0x100>; ++ reg-names = "cfg_base"; ++ ranges = <0x2000000 0 0x10000000 0x10000000 0 0x07000000 ++ 0x1000000 0 0x00000000 0x00000000 0 0x00000001>; ++ interrupt-parent = <&cpuintc>; ++ interrupts = <2>; ++ ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ ++ interrupt-map-mask = <0 0 0 1>; ++ interrupt-map = <0 0 0 0 &pcie0 0>; ++ }; diff --git a/target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch b/target/linux/ath79/patches-4.14/0018-MIPS-pci-ar71xx-convert-to-OF.patch similarity index 84% rename from target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch rename to target/linux/ath79/patches-4.14/0018-MIPS-pci-ar71xx-convert-to-OF.patch index ea3514a52..91796a12f 100644 --- a/target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch +++ b/target/linux/ath79/patches-4.14/0018-MIPS-pci-ar71xx-convert-to-OF.patch @@ -1,13 +1,17 @@ -From cc5a306038b7956b5736a70696dddaaf3792df76 Mon Sep 17 00:00:00 2001 +From 1855ab6b1d27f5b38a648baf57ff6a534afec26d Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:22:49 +0100 -Subject: [PATCH 20/27] MIPS: ath79: turn pci-ar71xx driver into a pure OF - driver +Date: Sat, 23 Jun 2018 15:07:23 +0200 +Subject: [PATCH 18/33] MIPS: pci-ar71xx: convert to OF + +With the ath79 target getting converted to pure OF, we can drop all the +platform data code and add the missing OF bits to the driver. We also add +a irq domain for the PCI/e controllers cascade, thus making it usable from +dts files. Signed-off-by: John Crispin --- - arch/mips/pci/pci-ar71xx.c | 81 +++++++++++++++++++++++----------------------- - 1 file changed, 40 insertions(+), 41 deletions(-) + arch/mips/pci/pci-ar71xx.c | 82 +++++++++++++++++++++++----------------------- + 1 file changed, 41 insertions(+), 41 deletions(-) --- a/arch/mips/pci/pci-ar71xx.c +++ b/arch/mips/pci/pci-ar71xx.c @@ -94,11 +98,12 @@ Signed-off-by: John Crispin t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -@@ -294,24 +299,30 @@ static struct irq_chip ar71xx_pci_irq_ch +@@ -294,24 +299,31 @@ static struct irq_chip ar71xx_pci_irq_ch .irq_mask_ack = ar71xx_pci_irq_mask, }; -+static int ar71xx_pci_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) ++static int ar71xx_pci_irq_map(struct irq_domain *d, ++ unsigned int irq, irq_hw_number_t hw) +{ + struct ar71xx_pci_controller *apc = d->host_data; + @@ -136,7 +141,7 @@ Signed-off-by: John Crispin irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, apc); } -@@ -328,6 +339,11 @@ static void ar71xx_pci_reset(void) +@@ -328,6 +340,11 @@ static void ar71xx_pci_reset(void) mdelay(100); } @@ -148,7 +153,7 @@ Signed-off-by: John Crispin static int ar71xx_pci_probe(struct platform_device *pdev) { struct ar71xx_pci_controller *apc; -@@ -348,26 +364,6 @@ static int ar71xx_pci_probe(struct platf +@@ -348,26 +365,6 @@ static int ar71xx_pci_probe(struct platf if (apc->irq < 0) return -EINVAL; @@ -175,23 +180,19 @@ Signed-off-by: John Crispin ar71xx_pci_reset(); /* setup COMMAND register */ -@@ -378,11 +374,13 @@ static int ar71xx_pci_probe(struct platf - /* clear bus errors */ - ar71xx_pci_check_error(apc, 1); +@@ -380,9 +377,11 @@ static int ar71xx_pci_probe(struct platf + + ar71xx_pci_irq_init(apc); -- ar71xx_pci_irq_init(apc); -- + apc->np = pdev->dev.of_node; apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; apc->pci_ctrl.mem_resource = &apc->mem_res; apc->pci_ctrl.io_resource = &apc->io_res; + pci_load_of_ranges(&apc->pci_ctrl, pdev->dev.of_node); -+ -+ ar71xx_pci_irq_init(apc); register_pci_controller(&apc->pci_ctrl); -@@ -393,6 +391,7 @@ static struct platform_driver ar71xx_pci +@@ -393,6 +392,7 @@ static struct platform_driver ar71xx_pci .probe = ar71xx_pci_probe, .driver = { .name = "ar71xx-pci", diff --git a/target/linux/ath79/patches-4.14/0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch b/target/linux/ath79/patches-4.14/0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch new file mode 100644 index 000000000..a0af79cb4 --- /dev/null +++ b/target/linux/ath79/patches-4.14/0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch @@ -0,0 +1,61 @@ +From ea27764bc3ef2a05decf3ae05edffc289cd0d93c Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 25 Jun 2018 15:52:02 +0200 +Subject: [PATCH 19/33] dt-bindings: PCI: qcom,ar7240: adds binding doc + +With the driver being converted from platform_data to pure OF, we need to +also add some docs. + +Cc: Rob Herring +Cc: devicetree@vger.kernel.org +Signed-off-by: John Crispin +--- + .../devicetree/bindings/pci/qcom,ar7240-pci.txt | 42 ++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pci/qcom,ar7240-pci.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pci/qcom,ar7240-pci.txt +@@ -0,0 +1,42 @@ ++* Qualcomm Atheros AR724X PCI express root complex ++ ++Required properties: ++- compatible: should contain "qcom,ar7240-pci" to identify the core. ++- reg: Should contain the register ranges as listed in the reg-names property. ++- reg-names: Definition: Must include the following entries ++ - "crp_base" Configuration registers ++ - "ctrl_base" Control registers ++ - "cfg_base" IO Memory ++- #address-cells: set to <3> ++- #size-cells: set to <2> ++- ranges: ranges for the PCI memory and I/O regions ++- interrupt-map-mask and interrupt-map: standard PCI ++ properties to define the mapping of the PCIe interface to interrupt ++ numbers. ++- #interrupt-cells: set to <1> ++- interrupt-parent: phandle to the MIPS IRQ controller ++ ++Optional properties: ++- interrupt-controller: define to enable the builtin IRQ cascade. ++ ++* Example for qca9557 ++ pcie-controller@180c0000 { ++ compatible = "qcom,ar7240-pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ bus-range = <0x0 0x0>; ++ reg = <0x180c0000 0x1000>, ++ <0x180f0000 0x100>, ++ <0x14000000 0x1000>; ++ reg-names = "crp_base", "ctrl_base", "cfg_base"; ++ ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 ++ 0x1000000 0 0x00000000 0x00000000 0 0x00000001>; ++ interrupt-parent = <&intc2>; ++ interrupts = <1>; ++ ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ ++ interrupt-map-mask = <0 0 0 1>; ++ interrupt-map = <0 0 0 0 &pcie0 0>; ++ }; diff --git a/target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch b/target/linux/ath79/patches-4.14/0020-MIPS-pci-ar724x-convert-to-OF.patch similarity index 84% rename from target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch rename to target/linux/ath79/patches-4.14/0020-MIPS-pci-ar724x-convert-to-OF.patch index d5ebeb87a..936bfd481 100644 --- a/target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch +++ b/target/linux/ath79/patches-4.14/0020-MIPS-pci-ar724x-convert-to-OF.patch @@ -1,13 +1,17 @@ -From 0e7f36bfd68401e8c42933e7f770f270497bb9a8 Mon Sep 17 00:00:00 2001 +From a522ee0199d5d3ea114ca2e211f6ac398d3e8e0b Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:23:25 +0100 -Subject: [PATCH 21/27] MIPS: ath79: turn pci-ar724x driver into a pure OF - driver +Date: Sat, 23 Jun 2018 15:07:37 +0200 +Subject: [PATCH 20/33] MIPS: pci-ar724x: convert to OF + +With the ath79 target getting converted to pure OF, we can drop all the +platform data code and add the missing OF bits to the driver. We also add +a irq domain for the PCI/e controllers cascade, thus making it usable from +dts files. Signed-off-by: John Crispin --- - arch/mips/pci/pci-ar724x.c | 86 +++++++++++++++++++++------------------------- - 1 file changed, 40 insertions(+), 46 deletions(-) + arch/mips/pci/pci-ar724x.c | 88 ++++++++++++++++++++++------------------------ + 1 file changed, 42 insertions(+), 46 deletions(-) --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c @@ -105,11 +109,12 @@ Signed-off-by: John Crispin case 0: t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); __raw_writel(t & ~AR724X_PCI_INT_DEV0, -@@ -305,26 +305,32 @@ static struct irq_chip ar724x_pci_irq_ch +@@ -305,26 +305,34 @@ static struct irq_chip ar724x_pci_irq_ch .irq_mask_ack = ar724x_pci_irq_mask, }; -+static int ar724x_pci_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) ++static int ar724x_pci_irq_map(struct irq_domain *d, ++ unsigned int irq, irq_hw_number_t hw) +{ + struct ar724x_pci_controller *apc = d->host_data; + @@ -144,11 +149,12 @@ Signed-off-by: John Crispin - irq_set_chip_data(i, apc); - } - -+ apc->domain = irq_domain_add_linear(apc->np, 2, &ar724x_pci_domain_ops, apc); ++ apc->domain = irq_domain_add_linear(apc->np, 2, ++ &ar724x_pci_domain_ops, apc); irq_set_chained_handler_and_data(apc->irq, ar724x_pci_irq_handler, apc); } -@@ -394,29 +400,11 @@ static int ar724x_pci_probe(struct platf +@@ -394,29 +402,11 @@ static int ar724x_pci_probe(struct platf if (apc->irq < 0) return -EINVAL; @@ -180,7 +186,7 @@ Signed-off-by: John Crispin /* * Do the full PCIE Root Complex Initialization Sequence if the PCIe -@@ -438,10 +426,16 @@ static int ar724x_pci_probe(struct platf +@@ -438,10 +428,16 @@ static int ar724x_pci_probe(struct platf return 0; } diff --git a/target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch b/target/linux/ath79/patches-4.14/0021-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch similarity index 88% rename from target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch rename to target/linux/ath79/patches-4.14/0021-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch index 15f6b1f8c..c273140df 100644 --- a/target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch +++ b/target/linux/ath79/patches-4.14/0021-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch @@ -1,17 +1,22 @@ +From 288a8eb0d41f09fda242e05f8a7bd1f5b3489477 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Mar 2018 13:19:26 +0100 -Subject: [PATCH] MIPS: ath79: add helpers for setting clocks and expose +Subject: [PATCH 21/33] MIPS: ath79: add helpers for setting clocks and expose the ref clock -Preparation for transitioning legacy the legacy clock setup code over +Preparation for transitioning the legacy clock setup code over to OF. Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- + arch/mips/ath79/clock.c | 128 ++++++++++++++++++---------------- + include/dt-bindings/clock/ath79-clk.h | 3 +- + 2 files changed, 68 insertions(+), 63 deletions(-) --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c -@@ -36,20 +36,46 @@ static struct clk_onecell_data clk_data +@@ -37,20 +37,46 @@ static struct clk_onecell_data clk_data .clk_num = ARRAY_SIZE(clks), }; @@ -67,7 +72,7 @@ Signed-off-by: Felix Fietkau return clk; } -@@ -79,27 +105,15 @@ static void __init ar71xx_clocks_init(vo +@@ -80,27 +106,15 @@ static void __init ar71xx_clocks_init(vo div = (((pll >> AR71XX_AHB_DIV_SHIFT) & AR71XX_AHB_DIV_MASK) + 1) * 2; ahb_rate = cpu_rate / div; @@ -99,7 +104,7 @@ Signed-off-by: Felix Fietkau static void __init ar724x_clk_init(struct clk *ref_clk, void __iomem *pll_base) { u32 pll; -@@ -113,24 +127,19 @@ static void __init ar724x_clk_init(struc +@@ -114,24 +128,19 @@ static void __init ar724x_clk_init(struc ddr_div = ((pll >> AR724X_DDR_DIV_SHIFT) & AR724X_DDR_DIV_MASK) + 1; ahb_div = (((pll >> AR724X_AHB_DIV_SHIFT) & AR724X_AHB_DIV_MASK) + 1) * 2; @@ -128,7 +133,7 @@ Signed-off-by: Felix Fietkau clk_add_alias("wdt", NULL, "ahb", NULL); clk_add_alias("uart", NULL, "ahb", NULL); } -@@ -185,12 +194,12 @@ static void __init ar9330_clk_init(struc +@@ -186,12 +195,12 @@ static void __init ar9330_clk_init(struc AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK) + 1; } @@ -147,7 +152,7 @@ Signed-off-by: Felix Fietkau } static void __init ar933x_clocks_init(void) -@@ -205,15 +214,10 @@ static void __init ar933x_clocks_init(vo +@@ -206,15 +215,10 @@ static void __init ar933x_clocks_init(vo else ref_rate = (25 * 1000 * 1000); @@ -164,7 +169,7 @@ Signed-off-by: Felix Fietkau clk_add_alias("wdt", NULL, "ahb", NULL); clk_add_alias("uart", NULL, "ref", NULL); } -@@ -343,10 +347,10 @@ static void __init ar934x_clocks_init(vo +@@ -344,10 +348,10 @@ static void __init ar934x_clocks_init(vo else ahb_rate = cpu_pll / (postdiv + 1); @@ -179,7 +184,7 @@ Signed-off-by: Felix Fietkau clk_add_alias("wdt", NULL, "ref", NULL); clk_add_alias("uart", NULL, "ref", NULL); -@@ -430,10 +434,10 @@ static void __init qca953x_clocks_init(v +@@ -431,10 +435,10 @@ static void __init qca953x_clocks_init(v else ahb_rate = cpu_pll / (postdiv + 1); @@ -194,7 +199,7 @@ Signed-off-by: Felix Fietkau clk_add_alias("wdt", NULL, "ref", NULL); clk_add_alias("uart", NULL, "ref", NULL); -@@ -515,10 +519,10 @@ static void __init qca955x_clocks_init(v +@@ -516,10 +520,10 @@ static void __init qca955x_clocks_init(v else ahb_rate = cpu_pll / (postdiv + 1); @@ -209,7 +214,7 @@ Signed-off-by: Felix Fietkau clk_add_alias("wdt", NULL, "ref", NULL); clk_add_alias("uart", NULL, "ref", NULL); -@@ -609,10 +613,10 @@ static void __init qca956x_clocks_init(v +@@ -620,10 +624,10 @@ static void __init qca956x_clocks_init(v else ahb_rate = cpu_pll / (postdiv + 1); diff --git a/target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch b/target/linux/ath79/patches-4.14/0022-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch similarity index 76% rename from target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch rename to target/linux/ath79/patches-4.14/0022-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch index 07e750a96..389edc45a 100644 --- a/target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch +++ b/target/linux/ath79/patches-4.14/0022-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch @@ -1,16 +1,20 @@ +From 339c191a95e978353c9ba3aafab0261e14de109b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Mar 2018 13:22:43 +0100 -Subject: [PATCH] MIPS: ath79: move legacy "wdt" and "uart" clock aliases +Subject: [PATCH 22/33] MIPS: ath79: move legacy "wdt" and "uart" clock aliases out of soc init Preparation for reusing functions for DT Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- + arch/mips/ath79/clock.c | 38 +++++++++++++++++--------------------- + 1 file changed, 17 insertions(+), 21 deletions(-) --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c -@@ -109,9 +109,6 @@ static void __init ar71xx_clocks_init(vo +@@ -110,9 +110,6 @@ static void __init ar71xx_clocks_init(vo ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); @@ -20,7 +24,7 @@ Signed-off-by: Felix Fietkau } static void __init ar724x_clk_init(struct clk *ref_clk, void __iomem *pll_base) -@@ -139,9 +136,6 @@ static void __init ar724x_clocks_init(vo +@@ -140,9 +137,6 @@ static void __init ar724x_clocks_init(vo ref_clk = ath79_set_clk(ATH79_CLK_REF, AR724X_BASE_FREQ); ar724x_clk_init(ref_clk, ath79_pll_base); @@ -30,7 +34,7 @@ Signed-off-by: Felix Fietkau } static void __init ar9330_clk_init(struct clk *ref_clk, void __iomem *pll_base) -@@ -217,9 +211,6 @@ static void __init ar933x_clocks_init(vo +@@ -218,9 +212,6 @@ static void __init ar933x_clocks_init(vo ref_clk = ath79_set_clk(ATH79_CLK_REF, ref_rate); ar9330_clk_init(ref_clk, ath79_pll_base); @@ -40,7 +44,7 @@ Signed-off-by: Felix Fietkau } static u32 __init ar934x_get_pll_freq(u32 ref, u32 ref_div, u32 nint, u32 nfrac, -@@ -352,9 +343,6 @@ static void __init ar934x_clocks_init(vo +@@ -353,9 +344,6 @@ static void __init ar934x_clocks_init(vo ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); @@ -50,7 +54,7 @@ Signed-off-by: Felix Fietkau iounmap(dpll_base); } -@@ -438,9 +426,6 @@ static void __init qca953x_clocks_init(v +@@ -439,9 +427,6 @@ static void __init qca953x_clocks_init(v ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); @@ -60,7 +64,7 @@ Signed-off-by: Felix Fietkau } static void __init qca955x_clocks_init(void) -@@ -523,9 +508,6 @@ static void __init qca955x_clocks_init(v +@@ -524,9 +509,6 @@ static void __init qca955x_clocks_init(v ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); @@ -70,7 +74,7 @@ Signed-off-by: Felix Fietkau } static void __init qca956x_clocks_init(void) -@@ -617,13 +599,13 @@ static void __init qca956x_clocks_init(v +@@ -628,13 +610,13 @@ static void __init qca956x_clocks_init(v ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); @@ -87,7 +91,7 @@ Signed-off-by: Felix Fietkau if (soc_is_ar71xx()) ar71xx_clocks_init(); else if (soc_is_ar724x() || soc_is_ar913x()) -@@ -640,6 +622,20 @@ void __init ath79_clocks_init(void) +@@ -651,6 +633,20 @@ void __init ath79_clocks_init(void) qca956x_clocks_init(); else BUG(); diff --git a/target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch b/target/linux/ath79/patches-4.14/0023-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch similarity index 82% rename from target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch rename to target/linux/ath79/patches-4.14/0023-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch index d326880d8..6c0f2ad54 100644 --- a/target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch +++ b/target/linux/ath79/patches-4.14/0023-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch @@ -1,15 +1,19 @@ +From 6350b2c36c522fecbc91a80b63f49319dafd2a72 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Mar 2018 13:23:20 +0100 -Subject: [PATCH] MIPS: ath79: pass PLL base to clock init functions +Subject: [PATCH 23/33] MIPS: ath79: pass PLL base to clock init functions Preparation for passing the mapped base via DT Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- + arch/mips/ath79/clock.c | 60 ++++++++++++++++++++++++------------------------- + 1 file changed, 30 insertions(+), 30 deletions(-) --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c -@@ -79,7 +79,7 @@ static struct clk * __init ath79_set_ff_ +@@ -80,7 +80,7 @@ static struct clk * __init ath79_set_ff_ return clk; } @@ -18,7 +22,7 @@ Signed-off-by: Felix Fietkau { unsigned long ref_rate; unsigned long cpu_rate; -@@ -91,7 +91,7 @@ static void __init ar71xx_clocks_init(vo +@@ -92,7 +92,7 @@ static void __init ar71xx_clocks_init(vo ref_rate = AR71XX_BASE_FREQ; @@ -27,7 +31,7 @@ Signed-off-by: Felix Fietkau div = ((pll >> AR71XX_PLL_FB_SHIFT) & AR71XX_PLL_FB_MASK) + 1; freq = div * ref_rate; -@@ -129,13 +129,13 @@ static void __init ar724x_clk_init(struc +@@ -130,13 +130,13 @@ static void __init ar724x_clk_init(struc ath79_set_ff_clk(ATH79_CLK_AHB, "ref", mult, div * ahb_div); } @@ -43,7 +47,7 @@ Signed-off-by: Felix Fietkau } static void __init ar9330_clk_init(struct clk *ref_clk, void __iomem *pll_base) -@@ -196,7 +196,7 @@ static void __init ar9330_clk_init(struc +@@ -197,7 +197,7 @@ static void __init ar9330_clk_init(struc ref_div * out_div * ahb_div); } @@ -52,7 +56,7 @@ Signed-off-by: Felix Fietkau { struct clk *ref_clk; unsigned long ref_rate; -@@ -233,7 +233,7 @@ static u32 __init ar934x_get_pll_freq(u3 +@@ -234,7 +234,7 @@ static u32 __init ar934x_get_pll_freq(u3 return ret; } @@ -61,7 +65,7 @@ Signed-off-by: Felix Fietkau { unsigned long ref_rate; unsigned long cpu_rate; -@@ -264,7 +264,7 @@ static void __init ar934x_clocks_init(vo +@@ -265,7 +265,7 @@ static void __init ar934x_clocks_init(vo AR934X_SRIF_DPLL1_REFDIV_MASK; frac = 1 << 18; } else { @@ -70,7 +74,7 @@ Signed-off-by: Felix Fietkau out_div = (pll >> AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & AR934X_PLL_CPU_CONFIG_OUTDIV_MASK; ref_div = (pll >> AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -@@ -291,7 +291,7 @@ static void __init ar934x_clocks_init(vo +@@ -292,7 +292,7 @@ static void __init ar934x_clocks_init(vo AR934X_SRIF_DPLL1_REFDIV_MASK; frac = 1 << 18; } else { @@ -79,7 +83,7 @@ Signed-off-by: Felix Fietkau out_div = (pll >> AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & AR934X_PLL_DDR_CONFIG_OUTDIV_MASK; ref_div = (pll >> AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -@@ -306,7 +306,7 @@ static void __init ar934x_clocks_init(vo +@@ -307,7 +307,7 @@ static void __init ar934x_clocks_init(vo ddr_pll = ar934x_get_pll_freq(ref_rate, ref_div, nint, nfrac, frac, out_div); @@ -88,7 +92,7 @@ Signed-off-by: Felix Fietkau postdiv = (clk_ctrl >> AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT) & AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -346,7 +346,7 @@ static void __init ar934x_clocks_init(vo +@@ -347,7 +347,7 @@ static void __init ar934x_clocks_init(vo iounmap(dpll_base); } @@ -97,7 +101,7 @@ Signed-off-by: Felix Fietkau { unsigned long ref_rate; unsigned long cpu_rate; -@@ -362,7 +362,7 @@ static void __init qca953x_clocks_init(v +@@ -363,7 +363,7 @@ static void __init qca953x_clocks_init(v else ref_rate = 25 * 1000 * 1000; @@ -106,7 +110,7 @@ Signed-off-by: Felix Fietkau out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; ref_div = (pll >> QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -@@ -376,7 +376,7 @@ static void __init qca953x_clocks_init(v +@@ -377,7 +377,7 @@ static void __init qca953x_clocks_init(v cpu_pll += frac * (ref_rate >> 6) / ref_div; cpu_pll /= (1 << out_div); @@ -115,7 +119,7 @@ Signed-off-by: Felix Fietkau out_div = (pll >> QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK; ref_div = (pll >> QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -@@ -390,7 +390,7 @@ static void __init qca953x_clocks_init(v +@@ -391,7 +391,7 @@ static void __init qca953x_clocks_init(v ddr_pll += frac * (ref_rate >> 6) / (ref_div << 4); ddr_pll /= (1 << out_div); @@ -124,7 +128,7 @@ Signed-off-by: Felix Fietkau postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -428,7 +428,7 @@ static void __init qca953x_clocks_init(v +@@ -429,7 +429,7 @@ static void __init qca953x_clocks_init(v ath79_set_clk(ATH79_CLK_AHB, ahb_rate); } @@ -133,7 +137,7 @@ Signed-off-by: Felix Fietkau { unsigned long ref_rate; unsigned long cpu_rate; -@@ -444,7 +444,7 @@ static void __init qca955x_clocks_init(v +@@ -445,7 +445,7 @@ static void __init qca955x_clocks_init(v else ref_rate = 25 * 1000 * 1000; @@ -142,7 +146,7 @@ Signed-off-by: Felix Fietkau out_div = (pll >> QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK; ref_div = (pll >> QCA955X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -@@ -458,7 +458,7 @@ static void __init qca955x_clocks_init(v +@@ -459,7 +459,7 @@ static void __init qca955x_clocks_init(v cpu_pll += frac * ref_rate / (ref_div * (1 << 6)); cpu_pll /= (1 << out_div); @@ -151,7 +155,7 @@ Signed-off-by: Felix Fietkau out_div = (pll >> QCA955X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & QCA955X_PLL_DDR_CONFIG_OUTDIV_MASK; ref_div = (pll >> QCA955X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -@@ -472,7 +472,7 @@ static void __init qca955x_clocks_init(v +@@ -473,7 +473,7 @@ static void __init qca955x_clocks_init(v ddr_pll += frac * ref_rate / (ref_div * (1 << 10)); ddr_pll /= (1 << out_div); @@ -160,7 +164,7 @@ Signed-off-by: Felix Fietkau postdiv = (clk_ctrl >> QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -510,7 +510,7 @@ static void __init qca955x_clocks_init(v +@@ -511,7 +511,7 @@ static void __init qca955x_clocks_init(v ath79_set_clk(ATH79_CLK_AHB, ahb_rate); } @@ -169,7 +173,7 @@ Signed-off-by: Felix Fietkau { unsigned long ref_rate; unsigned long cpu_rate; -@@ -526,13 +526,13 @@ static void __init qca956x_clocks_init(v +@@ -537,13 +537,13 @@ static void __init qca956x_clocks_init(v else ref_rate = 25 * 1000 * 1000; @@ -185,7 +189,7 @@ Signed-off-by: Felix Fietkau nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & QCA956X_PLL_CPU_CONFIG1_NINT_MASK; hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & -@@ -545,12 +545,12 @@ static void __init qca956x_clocks_init(v +@@ -556,12 +556,12 @@ static void __init qca956x_clocks_init(v cpu_pll += (hfrac >> 13) * ref_rate / ref_div; cpu_pll /= (1 << out_div); @@ -200,7 +204,7 @@ Signed-off-by: Felix Fietkau nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & QCA956X_PLL_DDR_CONFIG1_NINT_MASK; hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & -@@ -563,7 +563,7 @@ static void __init qca956x_clocks_init(v +@@ -574,7 +574,7 @@ static void __init qca956x_clocks_init(v ddr_pll += (hfrac >> 13) * ref_rate / ref_div; ddr_pll /= (1 << out_div); @@ -209,7 +213,7 @@ Signed-off-by: Felix Fietkau postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -607,19 +607,19 @@ void __init ath79_clocks_init(void) +@@ -618,19 +618,19 @@ void __init ath79_clocks_init(void) const char *uart; if (soc_is_ar71xx()) diff --git a/target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch b/target/linux/ath79/patches-4.14/0024-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch similarity index 80% rename from target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch rename to target/linux/ath79/patches-4.14/0024-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch index 9cadc02d3..9ceb64380 100644 --- a/target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch +++ b/target/linux/ath79/patches-4.14/0024-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch @@ -1,17 +1,21 @@ +From 5fadb2544ed0bb72ddddd846aa303bb9ed2d211c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Mar 2018 13:24:07 +0100 -Subject: [PATCH] MIPS: ath79: make specifying the reference clock in DT +Subject: [PATCH 24/33] MIPS: ath79: make specifying the reference clock in DT optional It can be autodetected for many SoCs using the strapping options. If the clock is specified in DT, the autodetected value is ignored Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- + arch/mips/ath79/clock.c | 84 +++++++++++++++++++++++-------------------------- + 1 file changed, 40 insertions(+), 44 deletions(-) --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c -@@ -79,6 +79,18 @@ static struct clk * __init ath79_set_ff_ +@@ -80,6 +80,18 @@ static struct clk * __init ath79_set_ff_ return clk; } @@ -30,7 +34,7 @@ Signed-off-by: Felix Fietkau static void __init ar71xx_clocks_init(void __iomem *pll_base) { unsigned long ref_rate; -@@ -89,7 +101,7 @@ static void __init ar71xx_clocks_init(vo +@@ -90,7 +102,7 @@ static void __init ar71xx_clocks_init(vo u32 freq; u32 div; @@ -39,7 +43,7 @@ Signed-off-by: Felix Fietkau pll = __raw_readl(pll_base + AR71XX_PLL_REG_CPU_CONFIG); -@@ -105,16 +117,17 @@ static void __init ar71xx_clocks_init(vo +@@ -106,16 +118,17 @@ static void __init ar71xx_clocks_init(vo div = (((pll >> AR71XX_AHB_DIV_SHIFT) & AR71XX_AHB_DIV_MASK) + 1) * 2; ahb_rate = cpu_rate / div; @@ -60,7 +64,7 @@ Signed-off-by: Felix Fietkau pll = __raw_readl(pll_base + AR724X_PLL_REG_CPU_CONFIG); -@@ -129,17 +142,9 @@ static void __init ar724x_clk_init(struc +@@ -130,17 +143,9 @@ static void __init ar724x_clk_init(struc ath79_set_ff_clk(ATH79_CLK_AHB, "ref", mult, div * ahb_div); } @@ -80,7 +84,7 @@ Signed-off-by: Felix Fietkau u32 clock_ctrl; u32 ref_div; u32 ninit_mul; -@@ -148,6 +153,15 @@ static void __init ar9330_clk_init(struc +@@ -149,6 +154,15 @@ static void __init ar9330_clk_init(struc u32 cpu_div; u32 ddr_div; u32 ahb_div; @@ -96,7 +100,7 @@ Signed-off-by: Felix Fietkau clock_ctrl = __raw_readl(pll_base + AR933X_PLL_CLOCK_CTRL_REG); if (clock_ctrl & AR933X_PLL_CLOCK_CTRL_BYPASS) { -@@ -196,23 +210,6 @@ static void __init ar9330_clk_init(struc +@@ -197,23 +211,6 @@ static void __init ar9330_clk_init(struc ref_div * out_div * ahb_div); } @@ -120,7 +124,7 @@ Signed-off-by: Felix Fietkau static u32 __init ar934x_get_pll_freq(u32 ref, u32 ref_div, u32 nint, u32 nfrac, u32 frac, u32 out_div) { -@@ -252,6 +249,8 @@ static void __init ar934x_clocks_init(vo +@@ -253,6 +250,8 @@ static void __init ar934x_clocks_init(vo else ref_rate = 25 * 1000 * 1000; @@ -129,7 +133,7 @@ Signed-off-by: Felix Fietkau pll = __raw_readl(dpll_base + AR934X_SRIF_CPU_DPLL2_REG); if (pll & AR934X_SRIF_DPLL2_LOCAL_PLL) { out_div = (pll >> AR934X_SRIF_DPLL2_OUTDIV_SHIFT) & -@@ -338,7 +337,6 @@ static void __init ar934x_clocks_init(vo +@@ -339,7 +338,6 @@ static void __init ar934x_clocks_init(vo else ahb_rate = cpu_pll / (postdiv + 1); @@ -137,7 +141,7 @@ Signed-off-by: Felix Fietkau ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -362,6 +360,8 @@ static void __init qca953x_clocks_init(v +@@ -363,6 +361,8 @@ static void __init qca953x_clocks_init(v else ref_rate = 25 * 1000 * 1000; @@ -146,7 +150,7 @@ Signed-off-by: Felix Fietkau pll = __raw_readl(pll_base + QCA953X_PLL_CPU_CONFIG_REG); out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; -@@ -422,7 +422,6 @@ static void __init qca953x_clocks_init(v +@@ -423,7 +423,6 @@ static void __init qca953x_clocks_init(v else ahb_rate = cpu_pll / (postdiv + 1); @@ -154,7 +158,7 @@ Signed-off-by: Felix Fietkau ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -444,6 +443,8 @@ static void __init qca955x_clocks_init(v +@@ -445,6 +444,8 @@ static void __init qca955x_clocks_init(v else ref_rate = 25 * 1000 * 1000; @@ -163,7 +167,7 @@ Signed-off-by: Felix Fietkau pll = __raw_readl(pll_base + QCA955X_PLL_CPU_CONFIG_REG); out_div = (pll >> QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK; -@@ -504,7 +505,6 @@ static void __init qca955x_clocks_init(v +@@ -505,7 +506,6 @@ static void __init qca955x_clocks_init(v else ahb_rate = cpu_pll / (postdiv + 1); @@ -171,7 +175,7 @@ Signed-off-by: Felix Fietkau ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -526,6 +526,8 @@ static void __init qca956x_clocks_init(v +@@ -537,6 +537,8 @@ static void __init qca956x_clocks_init(v else ref_rate = 25 * 1000 * 1000; @@ -180,7 +184,7 @@ Signed-off-by: Felix Fietkau pll = __raw_readl(pll_base + QCA956X_PLL_CPU_CONFIG_REG); out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; -@@ -595,7 +597,6 @@ static void __init qca956x_clocks_init(v +@@ -606,7 +608,6 @@ static void __init qca956x_clocks_init(v else ahb_rate = cpu_pll / (postdiv + 1); @@ -188,7 +192,7 @@ Signed-off-by: Felix Fietkau ath79_set_clk(ATH79_CLK_CPU, cpu_rate); ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -671,10 +672,8 @@ static void __init ath79_clocks_init_dt_ +@@ -682,10 +683,8 @@ static void __init ath79_clocks_init_dt_ void __iomem *pll_base; ref_clk = of_clk_get(np, 0); @@ -201,7 +205,7 @@ Signed-off-by: Felix Fietkau pll_base = of_iomap(np, 0); if (!pll_base) { -@@ -683,9 +682,9 @@ static void __init ath79_clocks_init_dt_ +@@ -694,9 +693,9 @@ static void __init ath79_clocks_init_dt_ } if (of_device_is_compatible(np, "qca,ar9130-pll")) @@ -213,7 +217,7 @@ Signed-off-by: Felix Fietkau else { pr_err("%pOF: could not find any appropriate clk_init()\n", np); goto err_iounmap; -@@ -703,9 +702,6 @@ err_iounmap: +@@ -714,9 +713,6 @@ err_iounmap: err_clk: clk_put(ref_clk); diff --git a/target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch b/target/linux/ath79/patches-4.14/0025-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch similarity index 84% rename from target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch rename to target/linux/ath79/patches-4.14/0025-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch index 35c6ea7db..13f46a914 100644 --- a/target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch +++ b/target/linux/ath79/patches-4.14/0025-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch @@ -1,16 +1,20 @@ +From 6325626de001df98aebe51f3008b1aca05798d19 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Mar 2018 13:26:27 +0100 -Subject: [PATCH] MIPS: ath79: support setting up clock via DT on all SoC +Subject: [PATCH 25/33] MIPS: ath79: support setting up clock via DT on all SoC types Use the same functions as the legacy code Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- + arch/mips/ath79/clock.c | 39 ++++++++++++++++++++++----------------- + 1 file changed, 22 insertions(+), 17 deletions(-) --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c -@@ -658,16 +658,6 @@ ath79_get_sys_clk_rate(const char *id) +@@ -669,16 +669,6 @@ ath79_get_sys_clk_rate(const char *id) #ifdef CONFIG_OF static void __init ath79_clocks_init_dt(struct device_node *np) { @@ -27,7 +31,7 @@ Signed-off-by: Felix Fietkau struct clk *ref_clk; void __iomem *pll_base; -@@ -681,14 +671,21 @@ static void __init ath79_clocks_init_dt_ +@@ -692,14 +682,21 @@ static void __init ath79_clocks_init_dt_ goto err_clk; } @@ -54,7 +58,7 @@ Signed-off-by: Felix Fietkau if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) { pr_err("%pOF: could not register clk provider\n", np); -@@ -703,6 +700,14 @@ err_iounmap: +@@ -714,6 +711,14 @@ err_iounmap: err_clk: clk_put(ref_clk); } diff --git a/target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch b/target/linux/ath79/patches-4.14/0026-MIPS-ath79-export-switch-MDIO-reference-clock.patch similarity index 71% rename from target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch rename to target/linux/ath79/patches-4.14/0026-MIPS-ath79-export-switch-MDIO-reference-clock.patch index 6530344ce..27adb56f5 100644 --- a/target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch +++ b/target/linux/ath79/patches-4.14/0026-MIPS-ath79-export-switch-MDIO-reference-clock.patch @@ -1,17 +1,22 @@ +From 78538d673801902108797f2c813e70cfbce280c9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Mar 2018 13:27:28 +0100 -Subject: [PATCH] MIPS: ath79: export switch MDIO reference clock +Subject: [PATCH 26/33] MIPS: ath79: export switch MDIO reference clock On AR934x, the MDIO reference clock can be configured to a fixed 100 MHz -clock. If that feature is not used, it defaults to the main reference clock, -like on all other SoC. +clock. If that feature is not used, it defaults to the main reference +clock, like on all other SoC. Signed-off-by: Felix Fietkau +Signed-off-by: John Crispin --- + arch/mips/ath79/clock.c | 8 ++++++++ + include/dt-bindings/clock/ath79-clk.h | 3 ++- + 2 files changed, 10 insertions(+), 1 deletion(-) --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c -@@ -41,6 +41,7 @@ static const char * const clk_names[ATH7 +@@ -42,6 +42,7 @@ static const char * const clk_names[ATH7 [ATH79_CLK_DDR] = "ddr", [ATH79_CLK_AHB] = "ahb", [ATH79_CLK_REF] = "ref", @@ -19,7 +24,7 @@ Signed-off-by: Felix Fietkau }; static const char * __init ath79_clk_name(int type) -@@ -341,6 +342,10 @@ static void __init ar934x_clocks_init(vo +@@ -342,6 +343,10 @@ static void __init ar934x_clocks_init(vo ath79_set_clk(ATH79_CLK_DDR, ddr_rate); ath79_set_clk(ATH79_CLK_AHB, ahb_rate); @@ -30,7 +35,7 @@ Signed-off-by: Felix Fietkau iounmap(dpll_base); } -@@ -687,6 +692,9 @@ static void __init ath79_clocks_init_dt( +@@ -698,6 +703,9 @@ static void __init ath79_clocks_init_dt( else if (of_device_is_compatible(np, "qca,qca9560-pll")) qca956x_clocks_init(pll_base); diff --git a/target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch b/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch similarity index 59% rename from target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch rename to target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch index 95b29455f..79f003d2e 100644 --- a/target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch +++ b/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch @@ -1,16 +1,18 @@ -From 08b9cad7da5d981d595fe6d76e9675f85e23e688 Mon Sep 17 00:00:00 2001 +From 3765b1f79593a0a9098ed15e48074c95403a53ee Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:57:15 +0100 -Subject: [PATCH 25/27] MIPS: ath79: drop irq.c +Date: Sat, 23 Jun 2018 15:05:08 +0200 +Subject: [PATCH 27/33] MIPS: ath79: drop legacy IRQ code -all IRQ init code will flow via OF based irq chips. +With the target now being fully OF based, we can drop the legacy IRQ code. +All IRQs are now handled via the new irqchip drivers. Signed-off-by: John Crispin --- - arch/mips/ath79/Makefile | 2 +- - arch/mips/ath79/irq.c | 285 ----------------------------------------------- - arch/mips/ath79/setup.c | 6 + - 3 files changed, 7 insertions(+), 286 deletions(-) + arch/mips/ath79/Makefile | 2 +- + arch/mips/ath79/irq.c | 169 ------------------------------- + arch/mips/ath79/setup.c | 6 ++ + arch/mips/include/asm/mach-ath79/ath79.h | 4 - + 4 files changed, 7 insertions(+), 174 deletions(-) delete mode 100644 arch/mips/ath79/irq.c --- a/arch/mips/ath79/Makefile @@ -23,10 +25,10 @@ Signed-off-by: John Crispin +obj-y := prom.o setup.o common.o clock.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - + obj-$(CONFIG_PCI) += pci.o --- a/arch/mips/ath79/irq.c +++ /dev/null -@@ -1,285 +0,0 @@ +@@ -1,169 +0,0 @@ -/* - * Atheros AR71xx/AR724x/AR913x specific interrupt handling - * @@ -85,34 +87,6 @@ Signed-off-by: John Crispin - irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch); -} - --static void qca953x_ip2_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS); -- -- if (status & QCA953X_PCIE_WMAC_INT_PCIE_ALL) { -- ath79_ddr_wb_flush(3); -- generic_handle_irq(ATH79_IP2_IRQ(0)); -- } else if (status & QCA953X_PCIE_WMAC_INT_WMAC_ALL) { -- ath79_ddr_wb_flush(4); -- generic_handle_irq(ATH79_IP2_IRQ(1)); -- } else { -- spurious_interrupt(); -- } --} -- --static void qca953x_irq_init(void) --{ -- int i; -- -- for (i = ATH79_IP2_IRQ_BASE; -- i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch); --} -- -static void qca955x_ip2_irq_dispatch(struct irq_desc *desc) -{ - u32 status; @@ -185,87 +159,6 @@ Signed-off-by: John Crispin - irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); -} - --static void qca956x_ip2_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -- status &= QCA956X_EXT_INT_PCIE_RC1_ALL | QCA956X_EXT_INT_WMAC_ALL; -- -- if (status == 0) { -- spurious_interrupt(); -- return; -- } -- -- if (status & QCA956X_EXT_INT_PCIE_RC1_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP2_IRQ(0)); -- } -- -- if (status & QCA956X_EXT_INT_WMAC_ALL) { -- /* TODO: flsuh DDR? */ -- generic_handle_irq(ATH79_IP2_IRQ(1)); -- } --} -- --static void qca956x_ip3_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -- status &= QCA956X_EXT_INT_PCIE_RC2_ALL | -- QCA956X_EXT_INT_USB1 | QCA956X_EXT_INT_USB2; -- -- if (status == 0) { -- spurious_interrupt(); -- return; -- } -- -- if (status & QCA956X_EXT_INT_USB1) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(0)); -- } -- -- if (status & QCA956X_EXT_INT_USB2) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(1)); -- } -- -- if (status & QCA956X_EXT_INT_PCIE_RC2_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(2)); -- } --} -- --static void qca956x_enable_timer_cb(void) { -- u32 misc; -- -- misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); -- misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; -- ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); --} -- --static void qca956x_irq_init(void) --{ -- int i; -- -- for (i = ATH79_IP2_IRQ_BASE; -- i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch); -- -- for (i = ATH79_IP3_IRQ_BASE; -- i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch); -- -- /* QCA956x timer init workaround has to be applied right before setting -- * up the clock. Else, there will be no jiffies */ -- late_time_init = &qca956x_enable_timer_cb; --} -- -void __init arch_init_irq(void) -{ - unsigned irq_wb_chan2 = -1; @@ -281,7 +174,7 @@ Signed-off-by: John Crispin - soc_is_ar913x() || soc_is_ar933x()) { - irq_wb_chan2 = 3; - irq_wb_chan3 = 2; -- } else if (soc_is_ar934x() || soc_is_qca953x()) { +- } else if (soc_is_ar934x()) { - irq_wb_chan3 = 2; - } - @@ -292,10 +185,7 @@ Signed-off-by: John Crispin - else if (soc_is_ar724x() || - soc_is_ar933x() || - soc_is_ar934x() || -- soc_is_qca953x() || -- soc_is_qca955x() || -- soc_is_qca956x() || -- soc_is_tp9343()) +- soc_is_qca955x()) - misc_is_ar71xx = false; - else - BUG(); @@ -305,12 +195,8 @@ Signed-off-by: John Crispin - - if (soc_is_ar934x()) - ar934x_ip2_irq_init(); -- else if (soc_is_qca953x()) -- qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); -- else if (soc_is_qca956x() || soc_is_tp9343()) -- qca956x_irq_init(); -} --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c @@ -322,7 +208,7 @@ Signed-off-by: John Crispin #include #include -@@ -310,6 +311,11 @@ void __init plat_time_init(void) +@@ -311,6 +312,11 @@ void __init plat_time_init(void) mips_hpt_frequency = cpu_clk_rate / 2; } @@ -334,3 +220,14 @@ Signed-off-by: John Crispin static int __init ath79_setup(void) { if (mips_machtype == ATH79_MACH_GENERIC_OF) +--- a/arch/mips/include/asm/mach-ath79/ath79.h ++++ b/arch/mips/include/asm/mach-ath79/ath79.h +@@ -178,8 +178,4 @@ static inline u32 ath79_reset_rr(unsigne + void ath79_device_reset_set(u32 mask); + void ath79_device_reset_clear(u32 mask); + +-void ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3); +-void ath79_misc_irq_init(void __iomem *regs, int irq, +- int irq_base, bool is_ar71xx); +- + #endif /* __ASM_MACH_ATH79_H */ diff --git a/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch b/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch deleted file mode 100644 index cde3bae67..000000000 --- a/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch +++ /dev/null @@ -1,172 +0,0 @@ -From e03edbc8e68063b3fca7457fa048d8abe0045f1f Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:15:54 +0100 -Subject: [PATCH 27/27] MIPS: ath79: drop mips_machine support - -Signed-off-by: John Crispin ---- - arch/mips/Kconfig | 1 - - arch/mips/ath79/machtypes.h | 28 ----------------- - arch/mips/ath79/setup.c | 74 ++++++--------------------------------------- - 3 files changed, 10 insertions(+), 93 deletions(-) - delete mode 100644 arch/mips/ath79/machtypes.h - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -196,7 +196,6 @@ config ATH79 - select COMMON_CLK - select CLKDEV_LOOKUP - select IRQ_MIPS_CPU -- select MIPS_MACHINE - select SYS_HAS_CPU_MIPS32_R2 - select SYS_HAS_EARLY_PRINTK - select SYS_SUPPORTS_32BIT_KERNEL ---- a/arch/mips/ath79/machtypes.h -+++ /dev/null -@@ -1,28 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X machine type definitions -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_MACHTYPE_H --#define _ATH79_MACHTYPE_H -- --#include -- --enum ath79_mach_type { -- ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ -- ATH79_MACH_GENERIC = 0, -- ATH79_MACH_AP121, /* Atheros AP121 reference board */ -- ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ -- ATH79_MACH_AP81, /* Atheros AP81 reference board */ -- ATH79_MACH_DB120, /* Atheros DB120 reference board */ -- ATH79_MACH_PB44, /* Atheros PB44 reference board */ -- ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ --}; -- --#endif /* _ATH79_MACHTYPE_H */ ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -32,7 +32,6 @@ - #include - #include - #include "common.h" --#include "machtypes.h" - - #define ATH79_SYS_TYPE_LEN 64 - -@@ -235,25 +234,21 @@ void __init plat_mem_setup(void) - else if (fw_passed_dtb) - __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb)); - -- if (mips_machtype != ATH79_MACH_GENERIC_OF) { -- ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, -- AR71XX_RESET_SIZE); -- ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, -- AR71XX_PLL_SIZE); -- ath79_detect_sys_type(); -- ath79_ddr_ctrl_init(); -+ ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, -+ AR71XX_RESET_SIZE); -+ ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, -+ AR71XX_PLL_SIZE); -+ ath79_detect_sys_type(); -+ ath79_ddr_ctrl_init(); - -- detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); -- -- /* OF machines should use the reset driver */ -- _machine_restart = ath79_restart; -- } -+ detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); - -+ _machine_restart = ath79_restart; - _machine_halt = ath79_halt; - pm_power_off = ath79_halt; - } - --static void __init ath79_of_plat_time_init(void) -+void __init plat_time_init(void) - { - struct device_node *np; - struct clk *clk; -@@ -283,62 +278,12 @@ static void __init ath79_of_plat_time_in - clk_put(clk); - } - --void __init plat_time_init(void) --{ -- unsigned long cpu_clk_rate; -- unsigned long ahb_clk_rate; -- unsigned long ddr_clk_rate; -- unsigned long ref_clk_rate; -- -- if (IS_ENABLED(CONFIG_OF) && mips_machtype == ATH79_MACH_GENERIC_OF) { -- ath79_of_plat_time_init(); -- return; -- } -- -- ath79_clocks_init(); -- -- cpu_clk_rate = ath79_get_sys_clk_rate("cpu"); -- ahb_clk_rate = ath79_get_sys_clk_rate("ahb"); -- ddr_clk_rate = ath79_get_sys_clk_rate("ddr"); -- ref_clk_rate = ath79_get_sys_clk_rate("ref"); -- -- pr_info("Clocks: CPU:%lu.%03luMHz, DDR:%lu.%03luMHz, AHB:%lu.%03luMHz, Ref:%lu.%03luMHz\n", -- cpu_clk_rate / 1000000, (cpu_clk_rate / 1000) % 1000, -- ddr_clk_rate / 1000000, (ddr_clk_rate / 1000) % 1000, -- ahb_clk_rate / 1000000, (ahb_clk_rate / 1000) % 1000, -- ref_clk_rate / 1000000, (ref_clk_rate / 1000) % 1000); -- -- mips_hpt_frequency = cpu_clk_rate / 2; --} -- - void __init arch_init_irq(void) - { - irqchip_init(); - } - --static int __init ath79_setup(void) --{ -- if (mips_machtype == ATH79_MACH_GENERIC_OF) -- return 0; -- -- mips_machine_setup(); -- -- return 0; --} -- --arch_initcall(ath79_setup); -- - void __init device_tree_init(void) - { - unflatten_and_copy_device_tree(); - } -- --MIPS_MACHINE(ATH79_MACH_GENERIC, -- "Generic", -- "Generic AR71XX/AR724X/AR913X based board", -- NULL); -- --MIPS_MACHINE(ATH79_MACH_GENERIC_OF, -- "DTB", -- "Generic AR71XX/AR724X/AR913X based board (DT)", -- NULL); ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -26,7 +26,6 @@ - #include - #include - #include "common.h" --#include "machtypes.h" - - #define AR71XX_BASE_FREQ 40000000 - #define AR724X_BASE_FREQ 40000000 diff --git a/target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch b/target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch similarity index 70% rename from target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch rename to target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch index 2d9a9bc97..840967f54 100644 --- a/target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch +++ b/target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch @@ -1,26 +1,44 @@ -From 6e38a86d50dba5cc1da9bfd07969d76dd3ac2dda Mon Sep 17 00:00:00 2001 +From badf28957b6dc400dff27bd23ba2ae75d9514be5 Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:28:13 +0100 -Subject: [PATCH 23/27] MIPS: ath79: drop mach files +Date: Sat, 23 Jun 2018 15:04:09 +0200 +Subject: [PATCH 28/33] MIPS: ath79: drop machfiles + +With the target now being fully OF based, we can drop the legacy mach +files. Boards can now boot fully of devicetree files. Signed-off-by: John Crispin --- + arch/mips/Kconfig | 1 - arch/mips/ath79/Kconfig | 73 ------------------- arch/mips/ath79/Makefile | 10 --- + arch/mips/ath79/clock.c | 1 - arch/mips/ath79/mach-ap121.c | 92 ------------------------ arch/mips/ath79/mach-ap136.c | 156 ----------------------------------------- arch/mips/ath79/mach-ap81.c | 100 -------------------------- arch/mips/ath79/mach-db120.c | 136 ----------------------------------- arch/mips/ath79/mach-pb44.c | 128 --------------------------------- arch/mips/ath79/mach-ubnt-xm.c | 126 --------------------------------- - 8 files changed, 821 deletions(-) + arch/mips/ath79/machtypes.h | 28 -------- + arch/mips/ath79/setup.c | 77 +++----------------- + 12 files changed, 9 insertions(+), 919 deletions(-) delete mode 100644 arch/mips/ath79/mach-ap121.c delete mode 100644 arch/mips/ath79/mach-ap136.c delete mode 100644 arch/mips/ath79/mach-ap81.c delete mode 100644 arch/mips/ath79/mach-db120.c delete mode 100644 arch/mips/ath79/mach-pb44.c delete mode 100644 arch/mips/ath79/mach-ubnt-xm.c + delete mode 100644 arch/mips/ath79/machtypes.h +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -196,7 +196,6 @@ config ATH79 + select COMMON_CLK + select CLKDEV_LOOKUP + select IRQ_MIPS_CPU +- select MIPS_MACHINE + select SYS_HAS_CPU_MIPS32_R2 + select SYS_HAS_EARLY_PRINTK + select SYS_SUPPORTS_32BIT_KERNEL --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig @@ -1,79 +1,6 @@ @@ -105,7 +123,7 @@ Signed-off-by: John Crispin def_bool n --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -21,13 +21,3 @@ obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev +@@ -22,13 +22,3 @@ obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o @@ -119,6 +137,16 @@ Signed-off-by: John Crispin -obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o -obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o -obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o +--- a/arch/mips/ath79/clock.c ++++ b/arch/mips/ath79/clock.c +@@ -26,7 +26,6 @@ + #include + #include + #include "common.h" +-#include "machtypes.h" + + #define AR71XX_BASE_FREQ 40000000 + #define AR724X_BASE_FREQ 40000000 --- a/arch/mips/ath79/mach-ap121.c +++ /dev/null @@ -1,92 +0,0 @@ @@ -740,3 +768,275 @@ Signed-off-by: John Crispin - -MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board", - pb44_init); +--- a/arch/mips/ath79/mach-ubnt-xm.c ++++ /dev/null +@@ -1,126 +0,0 @@ +-/* +- * Ubiquiti Networks XM (rev 1.0) board support +- * +- * Copyright (C) 2011 René Bolldorf +- * +- * Derived from: mach-pb44.c +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 as published +- * by the Free Software Foundation. +- */ +- +-#include +-#include +-#include +- +-#include +- +-#include "machtypes.h" +-#include "dev-gpio-buttons.h" +-#include "dev-leds-gpio.h" +-#include "dev-spi.h" +-#include "pci.h" +- +-#define UBNT_XM_GPIO_LED_L1 0 +-#define UBNT_XM_GPIO_LED_L2 1 +-#define UBNT_XM_GPIO_LED_L3 11 +-#define UBNT_XM_GPIO_LED_L4 7 +- +-#define UBNT_XM_GPIO_BTN_RESET 12 +- +-#define UBNT_XM_KEYS_POLL_INTERVAL 20 +-#define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) +- +-#define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000) +- +-static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { +- { +- .name = "ubnt-xm:red:link1", +- .gpio = UBNT_XM_GPIO_LED_L1, +- .active_low = 0, +- }, { +- .name = "ubnt-xm:orange:link2", +- .gpio = UBNT_XM_GPIO_LED_L2, +- .active_low = 0, +- }, { +- .name = "ubnt-xm:green:link3", +- .gpio = UBNT_XM_GPIO_LED_L3, +- .active_low = 0, +- }, { +- .name = "ubnt-xm:green:link4", +- .gpio = UBNT_XM_GPIO_LED_L4, +- .active_low = 0, +- }, +-}; +- +-static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = { +- { +- .desc = "reset", +- .type = EV_KEY, +- .code = KEY_RESTART, +- .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, +- .gpio = UBNT_XM_GPIO_BTN_RESET, +- .active_low = 1, +- } +-}; +- +-static struct spi_board_info ubnt_xm_spi_info[] = { +- { +- .bus_num = 0, +- .chip_select = 0, +- .max_speed_hz = 25000000, +- .modalias = "mx25l6405d", +- } +-}; +- +-static struct ath79_spi_platform_data ubnt_xm_spi_data = { +- .bus_num = 0, +- .num_chipselect = 1, +-}; +- +-#ifdef CONFIG_PCI +-static struct ath9k_platform_data ubnt_xm_eeprom_data; +- +-static int ubnt_xm_pci_plat_dev_init(struct pci_dev *dev) +-{ +- switch (PCI_SLOT(dev->devfn)) { +- case 0: +- dev->dev.platform_data = &ubnt_xm_eeprom_data; +- break; +- } +- +- return 0; +-} +- +-static void __init ubnt_xm_pci_init(void) +-{ +- memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, +- sizeof(ubnt_xm_eeprom_data.eeprom_data)); +- +- ath79_pci_set_plat_dev_init(ubnt_xm_pci_plat_dev_init); +- ath79_register_pci(); +-} +-#else +-static inline void ubnt_xm_pci_init(void) {} +-#endif /* CONFIG_PCI */ +- +-static void __init ubnt_xm_init(void) +-{ +- ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio), +- ubnt_xm_leds_gpio); +- +- ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, +- ARRAY_SIZE(ubnt_xm_gpio_keys), +- ubnt_xm_gpio_keys); +- +- ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info, +- ARRAY_SIZE(ubnt_xm_spi_info)); +- +- ubnt_xm_pci_init(); +-} +- +-MIPS_MACHINE(ATH79_MACH_UBNT_XM, +- "UBNT-XM", +- "Ubiquiti Networks XM (rev 1.0) board", +- ubnt_xm_init); +--- a/arch/mips/ath79/machtypes.h ++++ /dev/null +@@ -1,28 +0,0 @@ +-/* +- * Atheros AR71XX/AR724X/AR913X machine type definitions +- * +- * Copyright (C) 2008-2010 Gabor Juhos +- * Copyright (C) 2008 Imre Kaloz +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 as published +- * by the Free Software Foundation. +- */ +- +-#ifndef _ATH79_MACHTYPE_H +-#define _ATH79_MACHTYPE_H +- +-#include +- +-enum ath79_mach_type { +- ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ +- ATH79_MACH_GENERIC = 0, +- ATH79_MACH_AP121, /* Atheros AP121 reference board */ +- ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ +- ATH79_MACH_AP81, /* Atheros AP81 reference board */ +- ATH79_MACH_DB120, /* Atheros DB120 reference board */ +- ATH79_MACH_PB44, /* Atheros PB44 reference board */ +- ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +-}; +- +-#endif /* _ATH79_MACHTYPE_H */ +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -33,7 +33,6 @@ + #include + #include "common.h" + #include "dev-common.h" +-#include "machtypes.h" + + #define ATH79_SYS_TYPE_LEN 64 + +@@ -236,25 +235,21 @@ void __init plat_mem_setup(void) + else if (fw_passed_dtb) + __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb)); + +- if (mips_machtype != ATH79_MACH_GENERIC_OF) { +- ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, +- AR71XX_RESET_SIZE); +- ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, +- AR71XX_PLL_SIZE); +- ath79_detect_sys_type(); +- ath79_ddr_ctrl_init(); ++ ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, ++ AR71XX_RESET_SIZE); ++ ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, ++ AR71XX_PLL_SIZE); ++ ath79_detect_sys_type(); ++ ath79_ddr_ctrl_init(); + +- detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); +- +- /* OF machines should use the reset driver */ +- _machine_restart = ath79_restart; +- } ++ detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); + ++ _machine_restart = ath79_restart; + _machine_halt = ath79_halt; + pm_power_off = ath79_halt; + } + +-static void __init ath79_of_plat_time_init(void) ++void __init plat_time_init(void) + { + struct device_node *np; + struct clk *clk; +@@ -284,66 +279,12 @@ static void __init ath79_of_plat_time_in + clk_put(clk); + } + +-void __init plat_time_init(void) +-{ +- unsigned long cpu_clk_rate; +- unsigned long ahb_clk_rate; +- unsigned long ddr_clk_rate; +- unsigned long ref_clk_rate; +- +- if (IS_ENABLED(CONFIG_OF) && mips_machtype == ATH79_MACH_GENERIC_OF) { +- ath79_of_plat_time_init(); +- return; +- } +- +- ath79_clocks_init(); +- +- cpu_clk_rate = ath79_get_sys_clk_rate("cpu"); +- ahb_clk_rate = ath79_get_sys_clk_rate("ahb"); +- ddr_clk_rate = ath79_get_sys_clk_rate("ddr"); +- ref_clk_rate = ath79_get_sys_clk_rate("ref"); +- +- pr_info("Clocks: CPU:%lu.%03luMHz, DDR:%lu.%03luMHz, AHB:%lu.%03luMHz, Ref:%lu.%03luMHz\n", +- cpu_clk_rate / 1000000, (cpu_clk_rate / 1000) % 1000, +- ddr_clk_rate / 1000000, (ddr_clk_rate / 1000) % 1000, +- ahb_clk_rate / 1000000, (ahb_clk_rate / 1000) % 1000, +- ref_clk_rate / 1000000, (ref_clk_rate / 1000) % 1000); +- +- mips_hpt_frequency = cpu_clk_rate / 2; +-} +- + void __init arch_init_irq(void) + { + irqchip_init(); + } + +-static int __init ath79_setup(void) +-{ +- if (mips_machtype == ATH79_MACH_GENERIC_OF) +- return 0; +- +- ath79_gpio_init(); +- ath79_register_uart(); +- ath79_register_wdt(); +- +- mips_machine_setup(); +- +- return 0; +-} +- +-arch_initcall(ath79_setup); +- + void __init device_tree_init(void) + { + unflatten_and_copy_device_tree(); + } +- +-MIPS_MACHINE(ATH79_MACH_GENERIC, +- "Generic", +- "Generic AR71XX/AR724X/AR913X based board", +- NULL); +- +-MIPS_MACHINE(ATH79_MACH_GENERIC_OF, +- "DTB", +- "Generic AR71XX/AR724X/AR913X based board (DT)", +- NULL); diff --git a/target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch b/target/linux/ath79/patches-4.14/0029-MIPS-ath79-drop-legacy-pci-code.patch similarity index 82% rename from target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch rename to target/linux/ath79/patches-4.14/0029-MIPS-ath79-drop-legacy-pci-code.patch index 58ed122c6..254f2f925 100644 --- a/target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch +++ b/target/linux/ath79/patches-4.14/0029-MIPS-ath79-drop-legacy-pci-code.patch @@ -1,25 +1,28 @@ -From f4128f3224df2309262ef8d1275d928717ebefd0 Mon Sep 17 00:00:00 2001 +From d0f1420702ed47a82572aaf39e7407055518d14e Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:21:46 +0100 -Subject: [PATCH 22/27] MIPS: ath79: drop pci.c +Date: Sat, 23 Jun 2018 15:05:19 +0200 +Subject: [PATCH 29/33] MIPS: ath79: drop legacy pci code -This patch drops pci.c fromt he ath79 folder and moves the the pcibios -callbacks to a new fixup file. +With the target now being fully OF based, we can drop the legacy pci +platform code. The only bits that we need to keep is the fixup code +which we move to its own code file. Signed-off-by: John Crispin --- arch/mips/ath79/Makefile | 1 - - arch/mips/ath79/pci.c | 285 -------------------------------------------- + arch/mips/ath79/pci.c | 273 -------------------------------------------- + arch/mips/ath79/pci.h | 35 ------ arch/mips/pci/Makefile | 1 + arch/mips/pci/fixup-ath79.c | 21 ++++ - 4 files changed, 22 insertions(+), 286 deletions(-) + 5 files changed, 22 insertions(+), 309 deletions(-) delete mode 100644 arch/mips/ath79/pci.c + delete mode 100644 arch/mips/ath79/pci.h create mode 100644 arch/mips/pci/fixup-ath79.c --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile @@ -11,7 +11,6 @@ - obj-y := prom.o setup.o irq.o common.o clock.o + obj-y := prom.o setup.o common.o clock.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -obj-$(CONFIG_PCI) += pci.o @@ -28,7 +31,7 @@ Signed-off-by: John Crispin # Devices --- a/arch/mips/ath79/pci.c +++ /dev/null -@@ -1,285 +0,0 @@ +@@ -1,273 +0,0 @@ -/* - * Atheros AR71XX/AR724X specific PCI setup code - * @@ -113,9 +116,6 @@ Signed-off-by: John Crispin - } else if (soc_is_qca955x()) { - ath79_pci_irq_map = qca955x_pci_irq_map; - ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); -- } else if (soc_is_qca956x()) { -- ath79_pci_irq_map = qca956x_pci_irq_map; -- ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); - } else { - pr_crit("pci %s: invalid irq map\n", - pci_name((struct pci_dev *) dev)); @@ -295,15 +295,6 @@ Signed-off-by: John Crispin - QCA955X_PCI_MEM_SIZE, - 1, - ATH79_IP3_IRQ(2)); -- } else if (soc_is_qca956x()) { -- pdev = ath79_register_pci_ar724x(0, -- QCA956X_PCI_CFG_BASE1, -- QCA956X_PCI_CTRL_BASE1, -- QCA956X_PCI_CRP_BASE1, -- QCA956X_PCI_MEM_BASE1, -- QCA956X_PCI_MEM_SIZE, -- 1, -- ATH79_IP3_IRQ(2)); - } else { - /* No PCI support */ - return -ENODEV; @@ -314,6 +305,44 @@ Signed-off-by: John Crispin - - return pdev ? 0 : -ENODEV; -} +--- a/arch/mips/ath79/pci.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/* +- * Atheros AR71XX/AR724X PCI support +- * +- * Copyright (C) 2011 René Bolldorf +- * Copyright (C) 2008-2011 Gabor Juhos +- * Copyright (C) 2008 Imre Kaloz +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 as published +- * by the Free Software Foundation. +- */ +- +-#ifndef _ATH79_PCI_H +-#define _ATH79_PCI_H +- +-struct ath79_pci_irq { +- int bus; +- u8 slot; +- u8 pin; +- int irq; +-}; +- +-#ifdef CONFIG_PCI +-void ath79_pci_set_irq_map(unsigned nr_irqs, const struct ath79_pci_irq *map); +-void ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *dev)); +-int ath79_register_pci(void); +-#else +-static inline void +-ath79_pci_set_irq_map(unsigned nr_irqs, const struct ath79_pci_irq *map) {} +-static inline void +-ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *)) {} +-static inline int ath79_register_pci(void) { return 0; } +-#endif +- +-#endif /* _ATH79_PCI_H */ --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_MIPS_PCI_VIRTIO) += pci-vir diff --git a/target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch b/target/linux/ath79/patches-4.14/0030-MIPS-ath79-drop-platform-device-registration-code.patch similarity index 94% rename from target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch rename to target/linux/ath79/patches-4.14/0030-MIPS-ath79-drop-platform-device-registration-code.patch index 8c4956ec3..93a133c1d 100644 --- a/target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch +++ b/target/linux/ath79/patches-4.14/0030-MIPS-ath79-drop-platform-device-registration-code.patch @@ -1,11 +1,17 @@ -From c038250c16cdefd6d74ad61309ba84973eceb630 Mon Sep 17 00:00:00 2001 +From dce930fba8ad3a90ccd164f199e57c2d61937ccd Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:29:46 +0100 -Subject: [PATCH 24/27] MIPS: ath79: drop pdata helpers +Date: Sat, 23 Jun 2018 15:12:38 +0200 +Subject: [PATCH 30/33] MIPS: ath79: drop platform device registration code + +With the target now being fully OF based, we can drop the legacy platform +device registration code. All devices and their drivers are now probed +via OF. Signed-off-by: John Crispin --- - arch/mips/ath79/dev-common.c | 168 ------------------------- + arch/mips/ath79/Makefile | 10 -- + arch/mips/ath79/common.h | 2 - + arch/mips/ath79/dev-common.c | 159 ------------------------ arch/mips/ath79/dev-common.h | 18 --- arch/mips/ath79/dev-gpio-buttons.c | 56 --------- arch/mips/ath79/dev-gpio-buttons.h | 23 ---- @@ -17,8 +23,8 @@ Signed-off-by: John Crispin arch/mips/ath79/dev-usb.h | 17 --- arch/mips/ath79/dev-wmac.c | 155 ------------------------ arch/mips/ath79/dev-wmac.h | 17 --- - arch/mips/ath79/setup.c | 5 - - 13 files changed, 836 deletions(-) + arch/mips/ath79/setup.c | 1 - + 15 files changed, 835 deletions(-) delete mode 100644 arch/mips/ath79/dev-common.c delete mode 100644 arch/mips/ath79/dev-common.h delete mode 100644 arch/mips/ath79/dev-gpio-buttons.c @@ -32,9 +38,34 @@ Signed-off-by: John Crispin delete mode 100644 arch/mips/ath79/dev-wmac.c delete mode 100644 arch/mips/ath79/dev-wmac.h +--- a/arch/mips/ath79/Makefile ++++ b/arch/mips/ath79/Makefile +@@ -11,13 +11,3 @@ + obj-y := prom.o setup.o common.o clock.o + + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +- +-# +-# Devices +-# +-obj-y += dev-common.o +-obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o +-obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o +-obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o +-obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o +-obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o +--- a/arch/mips/ath79/common.h ++++ b/arch/mips/ath79/common.h +@@ -24,6 +24,4 @@ unsigned long ath79_get_sys_clk_rate(con + + void ath79_ddr_ctrl_init(void); + +-void ath79_gpio_init(void); +- + #endif /* __ATH79_COMMON_H */ --- a/arch/mips/ath79/dev-common.c +++ /dev/null -@@ -1,168 +0,0 @@ +@@ -1,159 +0,0 @@ -/* - * Atheros AR71XX/AR724X/AR913X common devices - * @@ -122,10 +153,7 @@ Signed-off-by: John Crispin - soc_is_ar724x() || - soc_is_ar913x() || - soc_is_ar934x() || -- soc_is_qca953x() || -- soc_is_qca955x() || -- soc_is_qca956x() || -- soc_is_tp9343()) { +- soc_is_qca955x()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); - } else if (soc_is_ar933x()) { @@ -188,15 +216,9 @@ Signed-off-by: John Crispin - } else if (soc_is_ar934x()) { - ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -- } else if (soc_is_qca953x()) { -- ath79_gpio_pdata.ngpios = QCA953X_GPIO_COUNT; -- ath79_gpio_pdata.oe_inverted = 1; - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -- } else if (soc_is_qca956x() || soc_is_tp9343()) { -- ath79_gpio_pdata.ngpios = QCA956X_GPIO_COUNT; -- ath79_gpio_pdata.oe_inverted = 1; - } else { - BUG(); - } @@ -901,22 +923,11 @@ Signed-off-by: John Crispin -#endif /* _ATH79_DEV_WMAC_H */ --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c -@@ -31,7 +31,6 @@ +@@ -32,7 +32,6 @@ #include #include #include "common.h" -#include "dev-common.h" - #include "machtypes.h" #define ATH79_SYS_TYPE_LEN 64 -@@ -316,10 +315,6 @@ static int __init ath79_setup(void) - if (mips_machtype == ATH79_MACH_GENERIC_OF) - return 0; -- ath79_gpio_init(); -- ath79_register_uart(); -- ath79_register_wdt(); -- - mips_machine_setup(); - - return 0; diff --git a/target/linux/ath79/patches-4.14/0031-MIPS-ath79-drop-OF-clock-code.patch b/target/linux/ath79/patches-4.14/0031-MIPS-ath79-drop-OF-clock-code.patch new file mode 100644 index 000000000..a11be73d7 --- /dev/null +++ b/target/linux/ath79/patches-4.14/0031-MIPS-ath79-drop-OF-clock-code.patch @@ -0,0 +1,95 @@ +From 00e4313da4609074fff134e61dd9ffe3fd37474d Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 24 Jun 2018 09:39:41 +0200 +Subject: [PATCH 31/33] MIPS: ath79: drop !OF clock code + +With the target now being fully OF based, we can drop the legacy clock +registration code. All clocks are now probed via devicetree. + +Signed-off-by: John Crispin +--- + arch/mips/ath79/clock.c | 56 ------------------------------------------------ + arch/mips/ath79/common.h | 3 --- + 2 files changed, 59 deletions(-) + +--- a/arch/mips/ath79/clock.c ++++ b/arch/mips/ath79/clock.c +@@ -617,60 +617,6 @@ static void __init qca956x_clocks_init(v + ath79_set_clk(ATH79_CLK_AHB, ahb_rate); + } + +-void __init ath79_clocks_init(void) +-{ +- const char *wdt; +- const char *uart; +- +- if (soc_is_ar71xx()) +- ar71xx_clocks_init(ath79_pll_base); +- else if (soc_is_ar724x() || soc_is_ar913x()) +- ar724x_clocks_init(ath79_pll_base); +- else if (soc_is_ar933x()) +- ar933x_clocks_init(ath79_pll_base); +- else if (soc_is_ar934x()) +- ar934x_clocks_init(ath79_pll_base); +- else if (soc_is_qca953x()) +- qca953x_clocks_init(ath79_pll_base); +- else if (soc_is_qca955x()) +- qca955x_clocks_init(ath79_pll_base); +- else if (soc_is_qca956x() || soc_is_tp9343()) +- qca956x_clocks_init(ath79_pll_base); +- else +- BUG(); +- +- if (soc_is_ar71xx() || soc_is_ar724x() || soc_is_ar913x()) { +- wdt = "ahb"; +- uart = "ahb"; +- } else if (soc_is_ar933x()) { +- wdt = "ahb"; +- uart = "ref"; +- } else { +- wdt = "ref"; +- uart = "ref"; +- } +- +- clk_add_alias("wdt", NULL, wdt, NULL); +- clk_add_alias("uart", NULL, uart, NULL); +-} +- +-unsigned long __init +-ath79_get_sys_clk_rate(const char *id) +-{ +- struct clk *clk; +- unsigned long rate; +- +- clk = clk_get(NULL, id); +- if (IS_ERR(clk)) +- panic("unable to get %s clock, err=%d", id, (int) PTR_ERR(clk)); +- +- rate = clk_get_rate(clk); +- clk_put(clk); +- +- return rate; +-} +- +-#ifdef CONFIG_OF + static void __init ath79_clocks_init_dt(struct device_node *np) + { + struct clk *ref_clk; +@@ -727,5 +673,3 @@ CLK_OF_DECLARE(ar9340_clk, "qca,ar9340-p + CLK_OF_DECLARE(ar9530_clk, "qca,qca9530-pll", ath79_clocks_init_dt); + CLK_OF_DECLARE(ar9550_clk, "qca,qca9550-pll", ath79_clocks_init_dt); + CLK_OF_DECLARE(ar9560_clk, "qca,qca9560-pll", ath79_clocks_init_dt); +- +-#endif +--- a/arch/mips/ath79/common.h ++++ b/arch/mips/ath79/common.h +@@ -19,9 +19,6 @@ + #define ATH79_MEM_SIZE_MIN (2 * 1024 * 1024) + #define ATH79_MEM_SIZE_MAX (256 * 1024 * 1024) + +-void ath79_clocks_init(void); +-unsigned long ath79_get_sys_clk_rate(const char *id); +- + void ath79_ddr_ctrl_init(void); + + #endif /* __ATH79_COMMON_H */ diff --git a/target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch b/target/linux/ath79/patches-4.14/0032-MIPS-ath79-sanitize-symbols.patch similarity index 62% rename from target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch rename to target/linux/ath79/patches-4.14/0032-MIPS-ath79-sanitize-symbols.patch index f9906516d..73c3800f4 100644 --- a/target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch +++ b/target/linux/ath79/patches-4.14/0032-MIPS-ath79-sanitize-symbols.patch @@ -1,19 +1,21 @@ -From deda44895d289a72a235359fc21f8a62ea44dc1c Mon Sep 17 00:00:00 2001 +From 3fc8585cf76022dba7496627074d42af88c30718 Mon Sep 17 00:00:00 2001 From: John Crispin -Date: Tue, 6 Mar 2018 09:33:26 +0100 -Subject: [PATCH 26/27] MIPS: ath79: sanitize Kconfig symbols +Date: Sat, 23 Jun 2018 15:16:55 +0200 +Subject: [PATCH 32/33] MIPS: ath79: sanitize symbols + +We no longer need to select which SoCs are supported as the whole arch +code is always built. So lets drop all the SoC symbols Signed-off-by: John Crispin --- - arch/mips/Kconfig | 2 ++ - arch/mips/ath79/Kconfig | 48 +++++------------------------------------------- - arch/mips/ath79/Makefile | 10 ---------- - arch/mips/pci/Makefile | 2 +- - 4 files changed, 8 insertions(+), 54 deletions(-) + arch/mips/Kconfig | 2 ++ + arch/mips/ath79/Kconfig | 44 +++++--------------------------------------- + arch/mips/pci/Makefile | 2 +- + 3 files changed, 8 insertions(+), 40 deletions(-) --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -203,6 +203,8 @@ config ATH79 +@@ -202,6 +202,8 @@ config ATH79 select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_MIPS16 select SYS_SUPPORTS_ZBOOT_UART_PROM @@ -24,7 +26,7 @@ Signed-off-by: John Crispin Support for the Atheros AR71XX/AR724X/AR913X SoCs. --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -1,52 +1,14 @@ +@@ -1,48 +1,14 @@ # SPDX-License-Identifier: GPL-2.0 if ATH79 @@ -48,10 +50,6 @@ Signed-off-by: John Crispin - select PCI_AR724X if PCI - def_bool n - --config SOC_QCA953X -- select USB_ARCH_HAS_EHCI -- def_bool n -- -config SOC_QCA955X - select HW_HAS_PCI - select PCI_AR724X if PCI @@ -76,28 +74,12 @@ Signed-off-by: John Crispin - def_bool n - -config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X) +- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) + bool "PCI support for AR724x type SoCs" + depends on PCI def_bool n endif ---- a/arch/mips/ath79/Makefile -+++ b/arch/mips/ath79/Makefile -@@ -11,13 +11,3 @@ - obj-y := prom.o setup.o common.o clock.o - - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -- --# --# Devices --# --obj-y += dev-common.o --obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o --obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o --obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o --obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o --obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile @@ -23,7 +23,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o diff --git a/target/linux/ath79/patches-4.14/0033-spi-ath79-drop-pdata-support.patch b/target/linux/ath79/patches-4.14/0033-spi-ath79-drop-pdata-support.patch new file mode 100644 index 000000000..aeb50c9b1 --- /dev/null +++ b/target/linux/ath79/patches-4.14/0033-spi-ath79-drop-pdata-support.patch @@ -0,0 +1,73 @@ +From c4e197bbcecc7233aa9e553e7047fa50e4e1fe77 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 25 Jun 2018 15:52:34 +0200 +Subject: [PATCH 33/33] spi: ath79: drop pdata support + +The target is being converted to pure OF. We can therefore drop all of the +platform data code from the driver. + +Cc: linux-spi@vger.kernel.org +Acked-by: Mark Brown +Signed-off-by: John Crispin +--- + arch/mips/include/asm/mach-ath79/ath79_spi_platform.h | 19 ------------------- + drivers/spi/spi-ath79.c | 8 -------- + 2 files changed, 27 deletions(-) + delete mode 100644 arch/mips/include/asm/mach-ath79/ath79_spi_platform.h + +--- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h ++++ /dev/null +@@ -1,19 +0,0 @@ +-/* +- * Platform data definition for Atheros AR71XX/AR724X/AR913X SPI controller +- * +- * Copyright (C) 2008-2010 Gabor Juhos +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 as published +- * by the Free Software Foundation. +- */ +- +-#ifndef _ATH79_SPI_PLATFORM_H +-#define _ATH79_SPI_PLATFORM_H +- +-struct ath79_spi_platform_data { +- unsigned bus_num; +- unsigned num_chipselect; +-}; +- +-#endif /* _ATH79_SPI_PLATFORM_H */ +--- a/drivers/spi/spi-ath79.c ++++ b/drivers/spi/spi-ath79.c +@@ -26,7 +26,6 @@ + #include + + #include +-#include + + #define DRV_NAME "ath79-spi" + +@@ -208,7 +207,6 @@ static int ath79_spi_probe(struct platfo + { + struct spi_master *master; + struct ath79_spi *sp; +- struct ath79_spi_platform_data *pdata; + struct resource *r; + unsigned long rate; + int ret; +@@ -223,15 +221,9 @@ static int ath79_spi_probe(struct platfo + master->dev.of_node = pdev->dev.of_node; + platform_set_drvdata(pdev, sp); + +- pdata = dev_get_platdata(&pdev->dev); +- + master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); + master->setup = ath79_spi_setup; + master->cleanup = ath79_spi_cleanup; +- if (pdata) { +- master->bus_num = pdata->bus_num; +- master->num_chipselect = pdata->num_chipselect; +- } + + sp->bitbang.master = master; + sp->bitbang.chipselect = ath79_spi_chipselect; diff --git a/target/linux/ath79/patches-4.14/0035-MIPS-ath79-fix-QCA956x-boot.patch b/target/linux/ath79/patches-4.14/0035-MIPS-ath79-fix-QCA956x-boot.patch deleted file mode 100644 index c3dd676d4..000000000 --- a/target/linux/ath79/patches-4.14/0035-MIPS-ath79-fix-QCA956x-boot.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -525,6 +525,14 @@ static void __init qca956x_clocks_init(v - u32 cpu_pll, ddr_pll; - u32 bootstrap; - -+ /* QCA956x timer init workaround has to be applied right before setting -+ * up the clock. Else, there will be no jiffies */ -+ u32 misc; -+ -+ misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); -+ misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; -+ ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); -+ - bootstrap = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); - if (bootstrap & QCA956X_BOOTSTRAP_REF_CLK_40) - ref_rate = 40 * 1000 * 1000; diff --git a/target/linux/ath79/patches-4.14/0024-GPIO-add-named-gpio-exports.patch b/target/linux/ath79/patches-4.14/0036-GPIO-add-named-gpio-exports.patch similarity index 100% rename from target/linux/ath79/patches-4.14/0024-GPIO-add-named-gpio-exports.patch rename to target/linux/ath79/patches-4.14/0036-GPIO-add-named-gpio-exports.patch diff --git a/target/linux/ath79/patches-4.14/0036-MIPS-ath79-remove-irq-code-from-pci.patch b/target/linux/ath79/patches-4.14/0036-MIPS-ath79-remove-irq-code-from-pci.patch new file mode 100644 index 000000000..460c4580e --- /dev/null +++ b/target/linux/ath79/patches-4.14/0036-MIPS-ath79-remove-irq-code-from-pci.patch @@ -0,0 +1,139 @@ +--- a/arch/mips/pci/pci-ar71xx.c ++++ b/arch/mips/pci/pci-ar71xx.c +@@ -54,11 +54,9 @@ + struct ar71xx_pci_controller { + struct device_node *np; + void __iomem *cfg_base; +- int irq; + struct pci_controller pci_ctrl; + struct resource io_res; + struct resource mem_res; +- struct irq_domain *domain; + }; + + /* Byte lane enable bits */ +@@ -230,104 +228,6 @@ static struct pci_ops ar71xx_pci_ops = { + .write = ar71xx_pci_write_config, + }; + +-static void ar71xx_pci_irq_handler(struct irq_desc *desc) +-{ +- void __iomem *base = ath79_reset_base; +- struct irq_chip *chip = irq_desc_get_chip(desc); +- struct ar71xx_pci_controller *apc = irq_desc_get_handler_data(desc); +- u32 pending; +- +- chained_irq_enter(chip, desc); +- pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & +- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- +- if (pending & AR71XX_PCI_INT_DEV0) +- generic_handle_irq(irq_linear_revmap(apc->domain, 1)); +- +- else if (pending & AR71XX_PCI_INT_DEV1) +- generic_handle_irq(irq_linear_revmap(apc->domain, 2)); +- +- else if (pending & AR71XX_PCI_INT_DEV2) +- generic_handle_irq(irq_linear_revmap(apc->domain, 3)); +- +- else if (pending & AR71XX_PCI_INT_CORE) +- generic_handle_irq(irq_linear_revmap(apc->domain, 4)); +- +- else +- spurious_interrupt(); +- chained_irq_exit(chip, desc); +-} +- +-static void ar71xx_pci_irq_unmask(struct irq_data *d) +-{ +- struct ar71xx_pci_controller *apc; +- unsigned int irq; +- void __iomem *base = ath79_reset_base; +- u32 t; +- +- apc = irq_data_get_irq_chip_data(d); +- irq = irq_linear_revmap(apc->domain, d->irq); +- +- t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- +- /* flush write */ +- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +-} +- +-static void ar71xx_pci_irq_mask(struct irq_data *d) +-{ +- struct ar71xx_pci_controller *apc; +- unsigned int irq; +- void __iomem *base = ath79_reset_base; +- u32 t; +- +- apc = irq_data_get_irq_chip_data(d); +- irq = irq_linear_revmap(apc->domain, d->irq); +- +- t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- +- /* flush write */ +- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +-} +- +-static struct irq_chip ar71xx_pci_irq_chip = { +- .name = "AR71XX PCI", +- .irq_mask = ar71xx_pci_irq_mask, +- .irq_unmask = ar71xx_pci_irq_unmask, +- .irq_mask_ack = ar71xx_pci_irq_mask, +-}; +- +-static int ar71xx_pci_irq_map(struct irq_domain *d, +- unsigned int irq, irq_hw_number_t hw) +-{ +- struct ar71xx_pci_controller *apc = d->host_data; +- +- irq_set_chip_and_handler(irq, &ar71xx_pci_irq_chip, handle_level_irq); +- irq_set_chip_data(irq, apc); +- +- return 0; +-} +- +-static const struct irq_domain_ops ar71xx_pci_domain_ops = { +- .xlate = irq_domain_xlate_onecell, +- .map = ar71xx_pci_irq_map, +-}; +- +-static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) +-{ +- void __iomem *base = ath79_reset_base; +- +- __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); +- +- apc->domain = irq_domain_add_linear(apc->np, AR71XX_PCI_IRQ_COUNT, +- &ar71xx_pci_domain_ops, apc); +- irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, +- apc); +-} +- + static void ar71xx_pci_reset(void) + { + ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); +@@ -361,10 +261,6 @@ static int ar71xx_pci_probe(struct platf + if (IS_ERR(apc->cfg_base)) + return PTR_ERR(apc->cfg_base); + +- apc->irq = platform_get_irq(pdev, 0); +- if (apc->irq < 0) +- return -EINVAL; +- + ar71xx_pci_reset(); + + /* setup COMMAND register */ +@@ -375,8 +271,6 @@ static int ar71xx_pci_probe(struct platf + /* clear bus errors */ + ar71xx_pci_check_error(apc, 1); + +- ar71xx_pci_irq_init(apc); +- + apc->np = pdev->dev.of_node; + apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; + apc->pci_ctrl.mem_resource = &apc->mem_res; diff --git a/target/linux/ath79/patches-4.14/0037-missing-registers.patch b/target/linux/ath79/patches-4.14/0037-missing-registers.patch new file mode 100644 index 000000000..9fde3d39d --- /dev/null +++ b/target/linux/ath79/patches-4.14/0037-missing-registers.patch @@ -0,0 +1,21 @@ +commit f3ffac90bc7266b7d917616f3233f58e8c08a196 +Author: Christian Lamparter +Date: Fri Aug 10 23:24:47 2018 +0200 + + ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for AR9344 + + Signed-off-by: Christian Lamparter + +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -1229,6 +1229,10 @@ + #define AR934X_ETH_CFG_RDV_DELAY BIT(16) + #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 + #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 ++#define AR934X_ETH_CFG_TXD_DELAY_MASK 0x3 ++#define AR934X_ETH_CFG_TXD_DELAY_SHIFT 18 ++#define AR934X_ETH_CFG_TXE_DELAY_MASK 0x3 ++#define AR934X_ETH_CFG_TXE_DELAY_SHIFT 20 + + /* + * QCA953X GMAC Interface diff --git a/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch b/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch index 06da2b34e..7c24fc5e1 100644 --- a/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch +++ b/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch @@ -1,6 +1,6 @@ --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c -@@ -102,9 +102,6 @@ static void ath79_spi_enable(struct ath7 +@@ -101,9 +101,6 @@ static void ath79_spi_enable(struct ath7 /* save CTRL register */ sp->reg_ctrl = ath79_spi_rr(sp, AR71XX_SPI_REG_CTRL); sp->ioc_base = ath79_spi_rr(sp, AR71XX_SPI_REG_IOC); @@ -10,7 +10,7 @@ } static void ath79_spi_disable(struct ath79_spi *sp) -@@ -204,6 +201,38 @@ static u32 ath79_spi_txrx_mode0(struct s +@@ -203,6 +200,38 @@ static u32 ath79_spi_txrx_mode0(struct s return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); } @@ -49,12 +49,12 @@ static int ath79_spi_probe(struct platform_device *pdev) { struct spi_master *master; -@@ -232,6 +261,8 @@ static int ath79_spi_probe(struct platfo - master->bus_num = pdata->bus_num; - master->num_chipselect = pdata->num_chipselect; +@@ -237,6 +266,8 @@ static int ath79_spi_probe(struct platfo + ret = PTR_ERR(sp->base); + goto err_put_master; } + master->spi_flash_read = ath79_spi_read_flash_data; + master->flash_read_supported = ath79_spi_flash_read_supported; - sp->bitbang.master = master; - sp->bitbang.chipselect = ath79_spi_chipselect; + sp->clk = devm_clk_get(&pdev->dev, "ahb"); + if (IS_ERR(sp->clk)) { diff --git a/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch b/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch index ad8b7b47d..634ce5635 100644 --- a/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch +++ b/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch @@ -40,7 +40,7 @@ +#endif /* __ASM_MACH_ATH79_MANGLE_PORT_H */ --- a/arch/mips/pci/pci-ar71xx.c +++ b/arch/mips/pci/pci-ar71xx.c -@@ -73,6 +73,45 @@ static const u32 ar71xx_pci_read_mask[8] +@@ -71,6 +71,45 @@ static const u32 ar71xx_pci_read_mask[8] 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 }; @@ -86,7 +86,7 @@ static inline u32 ar71xx_pci_get_ble(int where, int size, int local) { u32 t; -@@ -384,6 +423,9 @@ static int ar71xx_pci_probe(struct platf +@@ -279,6 +318,9 @@ static int ar71xx_pci_probe(struct platf register_pci_controller(&apc->pci_ctrl); diff --git a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch index 0954c8789..41e58ce8c 100644 --- a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch @@ -610,7 +610,7 @@ #define IP6_MF 0x0001 #define IP6_OFFSET 0xFFF8 -@@ -451,8 +451,8 @@ static inline void __ipv6_addr_set_half( +@@ -444,8 +444,8 @@ static inline void __ipv6_addr_set_half( } #endif #endif @@ -621,7 +621,7 @@ } static inline void ipv6_addr_set(struct in6_addr *addr, -@@ -511,6 +511,8 @@ static inline bool ipv6_prefix_equal(con +@@ -504,6 +504,8 @@ static inline bool ipv6_prefix_equal(con const __be32 *a1 = addr1->s6_addr32; const __be32 *a2 = addr2->s6_addr32; unsigned int pdw, pbi; @@ -630,7 +630,7 @@ /* check complete u32 in prefix */ pdw = prefixlen >> 5; -@@ -519,7 +521,9 @@ static inline bool ipv6_prefix_equal(con +@@ -512,7 +514,9 @@ static inline bool ipv6_prefix_equal(con /* check incomplete u32 in prefix */ pbi = prefixlen & 0x1f; @@ -641,7 +641,7 @@ return false; return true; -@@ -663,13 +667,13 @@ static inline void ipv6_addr_set_v4mappe +@@ -656,13 +660,13 @@ static inline void ipv6_addr_set_v4mappe */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { @@ -657,7 +657,7 @@ if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } -@@ -838,17 +842,18 @@ static inline int ip6_default_np_autolab +@@ -831,17 +835,18 @@ static inline int ip6_default_np_autolab static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { diff --git a/target/linux/au1000/Makefile b/target/linux/au1000/Makefile new file mode 100644 index 000000000..3a79b4c31 --- /dev/null +++ b/target/linux/au1000/Makefile @@ -0,0 +1,32 @@ +# +# Copyright (C) 2006-2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=mipsel +BOARD:=au1000 +BOARDNAME:=RMI/AMD AU1x00 +FEATURES:=squashfs usb pci small_flash source-only +SUBTARGETS:=au1500 au1550 +MAINTAINER:=Florian Fainelli + +KERNEL_PATCHVER:=3.18 + +define Target/Description + Build firmware for RMI/AMD Alchemy 1500,1550 boards + (e.g. 4G-Systems Mesh/Access Cube, DBAu1550 ...) +endef + +include $(INCLUDE_DIR)/target.mk +DEFAULT_PACKAGES += wpad-mini yamonenv + +define Kernel/BuildImage + $(call Kernel/BuildImage/Default) + $(CP) $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec $(LINUX_DIR)/zImage.flash.srec + $(CP) $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.srec $(LINUX_DIR)/zImage.srec +endef + +$(eval $(call BuildTarget)) diff --git a/target/linux/au1000/au1500/config-default b/target/linux/au1000/au1500/config-default new file mode 100644 index 000000000..0289d967b --- /dev/null +++ b/target/linux/au1000/au1500/config-default @@ -0,0 +1,5 @@ +CONFIG_DMA_NONCOHERENT=y +# CONFIG_MIPS_DB1550 is not set +CONFIG_MIPS_MTX1=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_WDT_MTX1=y diff --git a/target/linux/au1000/au1500/profiles/Atheros.mk b/target/linux/au1000/au1500/profiles/Atheros.mk new file mode 100644 index 000000000..75e8e108f --- /dev/null +++ b/target/linux/au1000/au1500/profiles/Atheros.mk @@ -0,0 +1,13 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Atheros + NAME:=Atheros WiFi (default) + PACKAGES:=kmod-ath5k +endef +$(eval $(call Profile,Atheros)) + diff --git a/target/linux/au1000/au1500/profiles/InternetBox.mk b/target/linux/au1000/au1500/profiles/InternetBox.mk new file mode 100644 index 000000000..a73f0ce9a --- /dev/null +++ b/target/linux/au1000/au1500/profiles/InternetBox.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2007-2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/InternetBox + NAME:=T-Mobile "InternetBox" + PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-ohci kmod-usb-serial kmod-usb-serial-option \ + comgt +endef + +define Profile/InternetBox/Description + Package set for the T-Mobile "InternetBox" (TMD SB1-S) +endef + +$(eval $(call Profile,InternetBox)) diff --git a/target/linux/au1000/au1500/profiles/MeshCube.mk b/target/linux/au1000/au1500/profiles/MeshCube.mk new file mode 100644 index 000000000..969a3bbff --- /dev/null +++ b/target/linux/au1000/au1500/profiles/MeshCube.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2007-2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/MeshCube + NAME:=MeshCube MTX-1 + PACKAGES:=kmod-ath5k kmod-net-prism54 \ + kmod-usb-core kmod-usb-ohci kmod-usb-storage kmod-fs-ext4 kmod-fs-vfat +endef + +define Profile/MeshCube/Description + Package set for the 4G MeshCube (MTX-1) +endef + +$(eval $(call Profile,MeshCube)) diff --git a/target/linux/au1000/au1500/target.mk b/target/linux/au1000/au1500/target.mk new file mode 100644 index 000000000..240914ff7 --- /dev/null +++ b/target/linux/au1000/au1500/target.mk @@ -0,0 +1,7 @@ +BOARDNAME:=Au1500 + +DEFAULT_PACKAGES+= wpad-mini + +define Target/Description + Build firmware images for Au1500 based boards +endef diff --git a/target/linux/au1000/au1550/config-default b/target/linux/au1000/au1550/config-default new file mode 100644 index 000000000..2c641b8ca --- /dev/null +++ b/target/linux/au1000/au1550/config-default @@ -0,0 +1,4 @@ +CONFIG_DMA_COHERENT=y +CONFIG_MIPS_DB1550=y +CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y +# CONFIG_MIPS_MTX1 is not set diff --git a/target/linux/au1000/au1550/profiles/DBAu1550.mk b/target/linux/au1000/au1550/profiles/DBAu1550.mk new file mode 100644 index 000000000..3535be623 --- /dev/null +++ b/target/linux/au1000/au1550/profiles/DBAu1550.mk @@ -0,0 +1,13 @@ +# +# Copyright (C) 2009-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/DBAu1550 + NAME:=AMD DBAu1550 Development Kit + PACKAGES:=kmod-pcmcia-au1000 kmod-usb-ohci kmod-usb2-pci +endef + +$(eval $(call Profile,DBAu1550)) diff --git a/target/linux/au1000/au1550/target.mk b/target/linux/au1000/au1550/target.mk new file mode 100644 index 000000000..1429cb403 --- /dev/null +++ b/target/linux/au1000/au1550/target.mk @@ -0,0 +1,8 @@ +BOARDNAME:=Au1550 +FEATURES += pcmcia + +DEFAULT_PACKAGES+= wpad-mini + +define Target/Description + Build firmware images for Au1550 based boards +endef diff --git a/target/linux/au1000/base-files/etc/diag.sh b/target/linux/au1000/base-files/etc/diag.sh new file mode 100644 index 000000000..65e3011be --- /dev/null +++ b/target/linux/au1000/base-files/etc/diag.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright (C) 2007-2013 OpenWrt.org + +. /lib/functions/leds.sh + +set_state() { + case "$1" in + preinit) + led_off "mtx1:green" + led_on "mtx1:red" + ;; + failsafe) + led_on "mtx1:green" + led_on "mtx1:red" + ;; + done) + led_on "mtx1:green" + led_off "mtx1:red" + ;; + esac +} diff --git a/target/linux/au1000/base-files/lib/upgrade/platform.sh b/target/linux/au1000/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..7beb4a0d0 --- /dev/null +++ b/target/linux/au1000/base-files/lib/upgrade/platform.sh @@ -0,0 +1,26 @@ +KERNEL_IMG="openwrt-au1000-au1500-vmlinux.bin" +ROOTFS_IMG="openwrt-au1000-au1500-root.fs" + +platform_check_image() { + [ "$#" -gt 1 ] && return 1 + case "$(get_magic_word "$1")" in + 6f70) + ( get_image "$1" | tar -tf - $KERNEL_IMG >/dev/null && \ + get_image "$1" | tar -tf - $ROOTFS_IMG >/dev/null) || { + echo "Invalid image contents" + return 1 + } + return 0;; + *) + echo "Invalid image type" + return 1;; + esac +} + +platform_do_upgrade() { + sync + local conf="" + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && conf="-j $CONF_TAR" + get_image "$1" | tar -Oxvf - $KERNEL_IMG | mtd write - "kernel" + get_image "$1" | tar -Oxvf - $ROOTFS_IMG | mtd $conf write - "rootfs" +} diff --git a/target/linux/au1000/config-3.18 b/target/linux/au1000/config-3.18 new file mode 100644 index 000000000..abce20a6a --- /dev/null +++ b/target/linux/au1000/config-3.18 @@ -0,0 +1,140 @@ +CONFIG_64BIT_PHYS_ADDR=y +CONFIG_ALCHEMY_GPIOINT_AU1000=y +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_CEVT_R4K=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock0 rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +CONFIG_CPU_MIPSR1=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_R4K_FPU=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CRC16=y +CONFIG_CSRC_R4K=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_EARLY_PRINTK=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HW_HAS_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_HZ_PERIODIC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQ_CPU=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_KEXEC=y +CONFIG_LEDS_GPIO=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MDIO_BOARDINFO=y +CONFIG_MIPS=y +CONFIG_MIPS_ALCHEMY=y +CONFIG_MIPS_AU1X00_ENET=y +CONFIG_MIPS_DB1000=y +# CONFIG_MIPS_DB1XXX is not set +# CONFIG_MIPS_DB1235 is not set +# CONFIG_MIPS_GPR is not set +# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_MACHINE is not set +# CONFIG_MIPS_MTX1 is not set +CONFIG_MIPS_MT_DISABLED=y +# CONFIG_MIPS_XXS1500 is not set +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_PHYSMAP=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PHYLIB=y +CONFIG_PHYS_ADDR_T_64BIT=y +# CONFIG_PREEMPT_RCU is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_RCU_STALL_COMMON is not set +# CONFIG_SCSI_DMA is not set +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_STANDALONE is not set +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_ZBOOT=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB_SUPPORT=y +CONFIG_WATCHDOG_CORE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/au1000/image/Makefile b/target/linux/au1000/image/Makefile new file mode 100644 index 000000000..744e5c64e --- /dev/null +++ b/target/linux/au1000/image/Makefile @@ -0,0 +1,74 @@ +# +# Copyright (C) 2006-2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +JFFS2_BLOCKSIZE = 128k + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +LOADADDR = 0x81000000 # RAM start + 16M +KERNEL_ENTRY = 0x80100000 +RAMSIZE = 0x00100000 # 1MB + +FLASH_KERNEL := 0xBFD00000 +FLASH_FS := 0xBE000000 + +LOADER_MAKEOPTS= \ + KDIR=$(KDIR) \ + LOADADDR=$(LOADADDR) \ + KERNEL_ENTRY=$(KERNEL_ENTRY) \ + RAMSIZE=$(RAMSIZE) + +define Build/Clean + $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean +endef + +DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options +OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS)) +OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS)) + +define Image/Prepare + cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma + + # Build RAM image + $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \ + $(LOADER_MAKEOPTS) \ + clean compile + $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/kernel.ram.srec + + # Build Flash image + $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \ + $(LOADER_MAKEOPTS) \ + IMAGE_COPY=1 \ + LOADER_ENTRY=$(FLASH_KERNEL) \ + LOADER_TYPE=_flash \ + clean compile + $(OBJCOPY_SREC) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.srec + $(OBJCOPY_BIN) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.bin +endef + +define Image/Build/Initramfs + $(OBJCOPY_SREC) $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.srec +endef + +define Image/Build + $(SCRIPT_DIR)/srecimage.pl $(KDIR)/root.$(1) $(KDIR)/root.$(1).srec $(FLASH_FS) + grep -v S7 $(KDIR)/root.$(1).srec > $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec + grep -v S0 $(KDIR)/kernel.flash.srec >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec + $(INSTALL_BIN) $(KDIR)/kernel.flash.bin $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.bin + $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs + $(CP) $(KDIR)/kernel.flash.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-flash.srec + $(CP) $(KDIR)/kernel.ram.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-ram.srec + $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs $(TMP_DIR)/$(IMG_PREFIX)-root.fs + tar -C $(BIN_DIR) -cvzf $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \ + $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR) $(IMG_PREFIX)-root.fs +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + $(call Image/Build/Initramfs) +endif +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/au1000/modules.mk b/target/linux/au1000/modules.mk new file mode 100644 index 000000000..6b110531a --- /dev/null +++ b/target/linux/au1000/modules.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define KernelPackage/pcmcia-au1000 + SUBMENU:=$(PCMCIA_MENU) + TITLE:=RMI/AMD Au1000 PCMCIA support + DEPENDS:=@TARGET_au1000 +kmod-pcmcia-core +kmod-pcmcia-rsrc + FILES:=$(LINUX_DIR)/drivers/pcmcia/db1xxx_ss.ko + KCONFIG:=CONFIG_PCMCIA_ALCHEMY_DEVBOARD + AUTOLOAD:=$(call AutoLoad,41,db1xxx_ss) +endef + +$(eval $(call KernelPackage,pcmcia-au1000)) diff --git a/target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch b/target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch new file mode 100644 index 000000000..1de823654 --- /dev/null +++ b/target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch @@ -0,0 +1,11 @@ +--- a/arch/mips/alchemy/board-mtx1.c ++++ b/arch/mips/alchemy/board-mtx1.c +@@ -169,7 +169,7 @@ static struct platform_device mtx1_gpio_ + + static struct mtd_partition mtx1_mtd_partitions[] = { + { +- .name = "filesystem", ++ .name = "rootfs", + .size = 0x01C00000, + .offset = 0, + }, diff --git a/target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch b/target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch new file mode 100644 index 000000000..58927f590 --- /dev/null +++ b/target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch @@ -0,0 +1,17 @@ +--- a/drivers/net/ethernet/amd/au1000_eth.c ++++ b/drivers/net/ethernet/amd/au1000_eth.c +@@ -1113,10 +1113,14 @@ static void au1000_multicast_list(struct + writel(reg, &aup->mac->control); + } + ++#define AU1000_KNOWN_PHY_IOCTLS (SIOCGMIIPHY & 0xfff0) + static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) + { + struct au1000_private *aup = netdev_priv(dev); + ++ if((cmd & AU1000_KNOWN_PHY_IOCTLS) != AU1000_KNOWN_PHY_IOCTLS) ++ return -EINVAL; ++ + if (!netif_running(dev)) + return -EINVAL; + diff --git a/target/linux/au1000/patches-3.18/004-watchdog_low_init.patch b/target/linux/au1000/patches-3.18/004-watchdog_low_init.patch new file mode 100644 index 000000000..09110408e --- /dev/null +++ b/target/linux/au1000/patches-3.18/004-watchdog_low_init.patch @@ -0,0 +1,12 @@ +--- a/arch/mips/alchemy/board-mtx1.c ++++ b/arch/mips/alchemy/board-mtx1.c +@@ -98,6 +98,9 @@ void __init board_setup(void) + alchemy_gpio_direction_output(211, 1); /* green on */ + alchemy_gpio_direction_output(212, 0); /* red off */ + ++ /* Set watchdog pin low */ ++ alchemy_gpio_direction_output(215, 0); ++ + pm_power_off = mtx1_power_off; + _machine_halt = mtx1_power_off; + _machine_restart = mtx1_reset; diff --git a/target/linux/au1000/patches-3.18/006-codec.patch b/target/linux/au1000/patches-3.18/006-codec.patch new file mode 100644 index 000000000..d80cf56ac --- /dev/null +++ b/target/linux/au1000/patches-3.18/006-codec.patch @@ -0,0 +1,26 @@ +--- a/arch/mips/alchemy/devboards/db1300.c ++++ b/arch/mips/alchemy/devboards/db1300.c +@@ -712,6 +712,7 @@ static struct platform_device db1300_lcd + + /**********************************************************************/ + ++#ifdef CONFIG_TOUCHSCREEN_WM97XX + static void db1300_wm97xx_irqen(struct wm97xx *wm, int enable) + { + if (enable) +@@ -744,6 +745,15 @@ static int db1300_wm97xx_probe(struct pl + return wm97xx_register_mach_ops(wm, &db1300_wm97xx_ops); + } + ++#else ++ ++static int db1300_wm97xx_probe(struct platform_device *pdev) ++{ ++ return -1; ++} ++ ++#endif ++ + static struct platform_driver db1300_wm97xx_driver = { + .driver.name = "wm97xx-touch", + .driver.owner = THIS_MODULE, diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile index 870029c4c..3032b9ffd 100644 --- a/target/linux/brcm2708/Makefile +++ b/target/linux/brcm2708/Makefile @@ -27,7 +27,6 @@ DEFAULT_PACKAGES += \ kmod-usb-hid \ kmod-sound-core kmod-sound-arm-bcm2835 \ kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \ - brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini \ partx-utils mkf2fs e2fsprogs KERNELNAME:=Image dtbs diff --git a/target/linux/brcm2708/base-files/lib/firmware/brcm/brcmfmac43430-sdio.txt b/target/linux/brcm2708/base-files/lib/firmware/brcm/brcmfmac43430-sdio.txt deleted file mode 100644 index ea4f648a1..000000000 --- a/target/linux/brcm2708/base-files/lib/firmware/brcm/brcmfmac43430-sdio.txt +++ /dev/null @@ -1,66 +0,0 @@ -# NVRAM file for BCM943430WLPTH -# 2.4 GHz, 20 MHz BW mode - -# The following parameter values are just placeholders, need to be updated. -manfid=0x2d0 -prodid=0x0727 -vendid=0x14e4 -devid=0x43e2 -boardtype=0x0727 -boardrev=0x1101 -boardnum=22 -macaddr=00:90:4c:c5:12:38 -sromrev=11 -boardflags=0x00404201 -boardflags3=0x08000000 -xtalfreq=37400 -nocrc=1 -ag0=255 -aa2g=1 -ccode=ALL - -pa0itssit=0x20 -extpagain2g=0 -#PA parameters for 2.4GHz, measured at CHIP OUTPUT -pa2ga0=-168,7161,-820 -AvVmid_c0=0x0,0xc8 -cckpwroffset0=5 - -# PPR params -maxp2ga0=84 -txpwrbckof=6 -cckbw202gpo=0 -legofdmbw202gpo=0x66111111 -mcsbw202gpo=0x77711111 -propbw202gpo=0xdd - -# OFDM IIR : -ofdmdigfilttype=18 -ofdmdigfilttypebe=18 -# PAPD mode: -papdmode=1 -papdvalidtest=1 -pacalidx2g=42 -papdepsoffset=-22 -papdendidx=58 - -# LTECX flags -ltecxmux=0 -ltecxpadnum=0x0102 -ltecxfnsel=0x44 -ltecxgcigpio=0x01 - -il0macaddr=00:90:4c:c5:12:38 -wl0id=0x431b - -deadman_to=0xffffffff -# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG -muxenab=0x1 -# CLDO PWM voltage settings - 0x4 - 1.1 volt -#cldo_pwm=0x4 - -#VCO freq 326.4MHz -spurconfig=0x3 - -edonthd20l=-75 -edoffthd20ul=-80 diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh index b9cd8d282..f01df3b02 100644 --- a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh +++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh @@ -97,7 +97,7 @@ platform_copy_config() { mkdir -p /boot [ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot cp -af "$CONF_TAR" /boot/ - tar --directory / -xvf "$CONF_TAR" boot/config.txt + tar -C / -xvf "$CONF_TAR" boot/config.txt sync unmount /boot fi diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile index 8ace69bdf..aedea9445 100644 --- a/target/linux/brcm2708/image/Makefile +++ b/target/linux/brcm2708/image/Makefile @@ -58,6 +58,7 @@ define Device/rpi DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,compute-module-1 raspberrypi,model-b-rev2 raspberrypi,model-zero raspberrypi,model-zero-w + DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 kmod-brcmfmac wpad-mini endef ifeq ($(SUBTARGET),bcm2708) TARGET_DEVICES += rpi @@ -67,6 +68,7 @@ define Device/rpi-2 DEVICE_TITLE := Raspberry Pi 2B/3B/3B+/3CM DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3 SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,3-model-b-plus raspberrypi,compute-module-3 + DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-firmware-43455-sdio brcmfmac-board-rpi2 brcmfmac-board-rpi3 kmod-brcmfmac wpad-mini endef ifeq ($(SUBTARGET),bcm2709) TARGET_DEVICES += rpi-2 @@ -77,6 +79,7 @@ define Device/rpi-3 DEVICE_TITLE := Raspberry Pi 3B/3B+ DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus SUPPORTED_DEVICES := rpi-3-b rpi-3-b-plus raspberrypi,3-model-b raspberrypi,3-model-b-plus + DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 brcmfmac-firmware-43455-sdio brcmfmac-board-rpi3 kmod-brcmfmac wpad-mini endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3 diff --git a/target/linux/brcm47xx/patches-4.14/161-MIPS-BCM47XX-Enable-USB-power-on-Netgear-WNDR3400v3.patch b/target/linux/brcm47xx/patches-4.14/161-MIPS-BCM47XX-Enable-USB-power-on-Netgear-WNDR3400v3.patch new file mode 100644 index 000000000..4a1a4d532 --- /dev/null +++ b/target/linux/brcm47xx/patches-4.14/161-MIPS-BCM47XX-Enable-USB-power-on-Netgear-WNDR3400v3.patch @@ -0,0 +1,39 @@ +From 17cb62255ef8f6b6ac270024204a8fa65537b333 Mon Sep 17 00:00:00 2001 +From: Tuomas Tynkkynen +Date: Sun, 19 Aug 2018 21:23:14 +0300 +Subject: [PATCH] MIPS: BCM47XX: Enable USB power on Netgear WNDR3400v3 + +Setting GPIO 21 high seems to be required to enable power to USB ports +on the WNDR3400v3. As there is already similar code for WNR3500L, +make the existing USB power GPIO code generic and use that. + +Signed-off-by: Tuomas Tynkkynen +--- + arch/mips/bcm47xx/workarounds.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/arch/mips/bcm47xx/workarounds.c ++++ b/arch/mips/bcm47xx/workarounds.c +@@ -5,9 +5,8 @@ + #include + #include + +-static void __init bcm47xx_workarounds_netgear_wnr3500l(void) ++static void __init bcm47xx_workarounds_enable_usb_power(int usb_power) + { +- const int usb_power = 12; + int err; + + err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power"); +@@ -23,7 +22,10 @@ void __init bcm47xx_workarounds(void) + + switch (board) { + case BCM47XX_BOARD_NETGEAR_WNR3500L: +- bcm47xx_workarounds_netgear_wnr3500l(); ++ bcm47xx_workarounds_enable_usb_power(12); ++ break; ++ case BCM47XX_BOARD_NETGEAR_WNDR3400_V3: ++ bcm47xx_workarounds_enable_usb_power(21); + break; + default: + /* No workaround(s) needed */ diff --git a/target/linux/brcm63xx/Makefile b/target/linux/brcm63xx/Makefile index 1aed6b20e..3d42e767f 100644 --- a/target/linux/brcm63xx/Makefile +++ b/target/linux/brcm63xx/Makefile @@ -12,7 +12,7 @@ BOARD:=brcm63xx BOARDNAME:=Broadcom BCM63xx SUBTARGETS:=generic smp FEATURES:=squashfs usb atm pci pcmcia usbgadget -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 MAINTAINER:=Jonas Gorski define Target/Description diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network b/target/linux/brcm63xx/base-files/etc/board.d/02_network index a7fd6f5d3..a2ca5a37b 100755 --- a/target/linux/brcm63xx/base-files/etc/board.d/02_network +++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network @@ -130,6 +130,12 @@ neufbox6) "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9t@eth0" ;; +sr102) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:wan" "8t@eth0" + ;; + vg50) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8t@eth0" diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh index acb179521..afb347818 100644 --- a/target/linux/brcm63xx/base-files/etc/diag.sh +++ b/target/linux/brcm63xx/base-files/etc/diag.sh @@ -132,6 +132,10 @@ set_state() { rta770w) status_led="RTA770W:green:diag" ;; + sr102) + status_led="SR102:white:power" + status_led2="SR102:red:power" + ;; spw500v) status_led="SPW500V:green:power" ;; diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh index 82abd737c..1676ae0ab 100755 --- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh +++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh @@ -237,6 +237,9 @@ brcm63xx_dt_detect() { "SFR neufbox 6 (Sercomm)") board_name="neufbox6" ;; + "SKY SR102") + board_name="sr102" + ;; "T-Com Speedport W303 V") board_name="spw303v" ;; diff --git a/target/linux/brcm63xx/dts/a226g.dts b/target/linux/brcm63xx/dts/a226g.dts index 0023c296b..5269fab2b 100644 --- a/target/linux/brcm63xx/dts/a226g.dts +++ b/target/linux/brcm63xx/dts/a226g.dts @@ -94,8 +94,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/a226m-fwb.dts b/target/linux/brcm63xx/dts/a226m-fwb.dts index 5ae97d76b..0695e839e 100644 --- a/target/linux/brcm63xx/dts/a226m-fwb.dts +++ b/target/linux/brcm63xx/dts/a226m-fwb.dts @@ -94,8 +94,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/a226m.dts b/target/linux/brcm63xx/dts/a226m.dts index 26ea47c8a..aea54c3d8 100644 --- a/target/linux/brcm63xx/dts/a226m.dts +++ b/target/linux/brcm63xx/dts/a226m.dts @@ -94,8 +94,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/a4001n.dts b/target/linux/brcm63xx/dts/a4001n.dts index 8662c71c6..fcd921fa4 100644 --- a/target/linux/brcm63xx/dts/a4001n.dts +++ b/target/linux/brcm63xx/dts/a4001n.dts @@ -69,8 +69,6 @@ spi-rx-bus-width = <2>; reg = <0>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/a4001n1.dts b/target/linux/brcm63xx/dts/a4001n1.dts index dece3c1de..3cb95e8f2 100644 --- a/target/linux/brcm63xx/dts/a4001n1.dts +++ b/target/linux/brcm63xx/dts/a4001n1.dts @@ -100,8 +100,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ad1018-nor.dts b/target/linux/brcm63xx/dts/ad1018-nor.dts index 93862c2fc..4794d45d7 100644 --- a/target/linux/brcm63xx/dts/ad1018-nor.dts +++ b/target/linux/brcm63xx/dts/ad1018-nor.dts @@ -36,7 +36,6 @@ linux,code = ; }; }; - }; &pinctrl { @@ -132,8 +131,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/agpf-s0.dts b/target/linux/brcm63xx/dts/agpf-s0.dts index 9678a7a47..46aa399bd 100644 --- a/target/linux/brcm63xx/dts/agpf-s0.dts +++ b/target/linux/brcm63xx/dts/agpf-s0.dts @@ -98,8 +98,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ar-5315u.dts b/target/linux/brcm63xx/dts/ar-5315u.dts index 9457bb319..5f38f3ed1 100644 --- a/target/linux/brcm63xx/dts/ar-5315u.dts +++ b/target/linux/brcm63xx/dts/ar-5315u.dts @@ -80,9 +80,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ar-5381u.dts b/target/linux/brcm63xx/dts/ar-5381u.dts index 849c7b27d..7a5477802 100644 --- a/target/linux/brcm63xx/dts/ar-5381u.dts +++ b/target/linux/brcm63xx/dts/ar-5381u.dts @@ -59,8 +59,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ar-5387un.dts b/target/linux/brcm63xx/dts/ar-5387un.dts index 3f2f54011..3a83834bd 100644 --- a/target/linux/brcm63xx/dts/ar-5387un.dts +++ b/target/linux/brcm63xx/dts/ar-5387un.dts @@ -67,8 +67,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ar1004g.dts b/target/linux/brcm63xx/dts/ar1004g.dts index 9357726af..c7f8c5068 100644 --- a/target/linux/brcm63xx/dts/ar1004g.dts +++ b/target/linux/brcm63xx/dts/ar1004g.dts @@ -49,8 +49,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/av4202n.dts b/target/linux/brcm63xx/dts/av4202n.dts index 2b0a15376..e61baf94a 100644 --- a/target/linux/brcm63xx/dts/av4202n.dts +++ b/target/linux/brcm63xx/dts/av4202n.dts @@ -71,8 +71,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/bcm96318ref.dts b/target/linux/brcm63xx/dts/bcm96318ref.dts index 26dda1cba..835b1c2f3 100644 --- a/target/linux/brcm63xx/dts/bcm96318ref.dts +++ b/target/linux/brcm63xx/dts/bcm96318ref.dts @@ -31,7 +31,7 @@ gpios = <&pinctrl 34 1>; linux,code = ; }; - }; + }; gpio-leds { compatible = "gpio-leds"; @@ -66,8 +66,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96318ref_p300.dts b/target/linux/brcm63xx/dts/bcm96318ref_p300.dts index a26b3b3db..5cd5b78c3 100644 --- a/target/linux/brcm63xx/dts/bcm96318ref_p300.dts +++ b/target/linux/brcm63xx/dts/bcm96318ref_p300.dts @@ -31,7 +31,7 @@ gpios = <&pinctrl 34 1>; linux,code = ; }; - }; + }; gpio-leds { compatible = "gpio-leds"; @@ -72,8 +72,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm963268bu_p300.dts b/target/linux/brcm63xx/dts/bcm963268bu_p300.dts index 19d713c03..6122d7306 100644 --- a/target/linux/brcm63xx/dts/bcm963268bu_p300.dts +++ b/target/linux/brcm63xx/dts/bcm963268bu_p300.dts @@ -31,7 +31,7 @@ gpios = <&pinctrl 33 0>; linux,code = ; }; - }; + }; }; &hsspi { @@ -47,8 +47,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm963269bhr.dts b/target/linux/brcm63xx/dts/bcm963269bhr.dts index 4caca94f7..2e3211083 100644 --- a/target/linux/brcm63xx/dts/bcm963269bhr.dts +++ b/target/linux/brcm63xx/dts/bcm963269bhr.dts @@ -25,7 +25,7 @@ gpios = <&pinctrl 32 0>; linux,code = ; }; - }; + }; gpio-leds { compatible = "gpio-leds"; @@ -55,8 +55,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm963281TAN.dts b/target/linux/brcm63xx/dts/bcm963281TAN.dts index 48f4c2c71..46a79979c 100644 --- a/target/linux/brcm63xx/dts/bcm963281TAN.dts +++ b/target/linux/brcm63xx/dts/bcm963281TAN.dts @@ -57,8 +57,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96328avng.dts b/target/linux/brcm63xx/dts/bcm96328avng.dts index e9bee3464..e27183852 100644 --- a/target/linux/brcm63xx/dts/bcm96328avng.dts +++ b/target/linux/brcm63xx/dts/bcm96328avng.dts @@ -57,8 +57,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96338GW.dts b/target/linux/brcm63xx/dts/bcm96338GW.dts index 42e51f4d3..a31c4f564 100644 --- a/target/linux/brcm63xx/dts/bcm96338GW.dts +++ b/target/linux/brcm63xx/dts/bcm96338GW.dts @@ -43,8 +43,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96338W.dts b/target/linux/brcm63xx/dts/bcm96338W.dts index f5953e443..d7ab476b6 100644 --- a/target/linux/brcm63xx/dts/bcm96338W.dts +++ b/target/linux/brcm63xx/dts/bcm96338W.dts @@ -43,8 +43,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96345GW2.dts b/target/linux/brcm63xx/dts/bcm96345GW2.dts index a2a8203d1..5aea2ddc8 100644 --- a/target/linux/brcm63xx/dts/bcm96345GW2.dts +++ b/target/linux/brcm63xx/dts/bcm96345GW2.dts @@ -17,8 +17,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96348GW-10.dts b/target/linux/brcm63xx/dts/bcm96348GW-10.dts index c751fcff4..6f54664ff 100644 --- a/target/linux/brcm63xx/dts/bcm96348GW-10.dts +++ b/target/linux/brcm63xx/dts/bcm96348GW-10.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96348GW-11.dts b/target/linux/brcm63xx/dts/bcm96348GW-11.dts index fca961251..c1dfaf6b0 100644 --- a/target/linux/brcm63xx/dts/bcm96348GW-11.dts +++ b/target/linux/brcm63xx/dts/bcm96348GW-11.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96348GW.dts b/target/linux/brcm63xx/dts/bcm96348GW.dts index e7662aa83..cc0ebd262 100644 --- a/target/linux/brcm63xx/dts/bcm96348GW.dts +++ b/target/linux/brcm63xx/dts/bcm96348GW.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96348R.dts b/target/linux/brcm63xx/dts/bcm96348R.dts index 946fcf340..2f0778467 100644 --- a/target/linux/brcm63xx/dts/bcm96348R.dts +++ b/target/linux/brcm63xx/dts/bcm96348R.dts @@ -43,8 +43,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96358VW.dts b/target/linux/brcm63xx/dts/bcm96358VW.dts index cc5d9f8e2..346e24dc1 100644 --- a/target/linux/brcm63xx/dts/bcm96358VW.dts +++ b/target/linux/brcm63xx/dts/bcm96358VW.dts @@ -43,8 +43,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96358VW2.dts b/target/linux/brcm63xx/dts/bcm96358VW2.dts index 9e26aa7a3..02f1ea9ed 100644 --- a/target/linux/brcm63xx/dts/bcm96358VW2.dts +++ b/target/linux/brcm63xx/dts/bcm96358VW2.dts @@ -39,8 +39,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96368MVNgr.dts b/target/linux/brcm63xx/dts/bcm96368MVNgr.dts index b18aa2c6e..ac658b137 100644 --- a/target/linux/brcm63xx/dts/bcm96368MVNgr.dts +++ b/target/linux/brcm63xx/dts/bcm96368MVNgr.dts @@ -43,8 +43,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/bcm96368MVWG.dts b/target/linux/brcm63xx/dts/bcm96368MVWG.dts index 29f7decbc..fdc32d0c9 100644 --- a/target/linux/brcm63xx/dts/bcm96368MVWG.dts +++ b/target/linux/brcm63xx/dts/bcm96368MVWG.dts @@ -43,8 +43,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/cpva502plus.dts b/target/linux/brcm63xx/dts/cpva502plus.dts index 9a7bf6707..ee5472eef 100644 --- a/target/linux/brcm63xx/dts/cpva502plus.dts +++ b/target/linux/brcm63xx/dts/cpva502plus.dts @@ -45,8 +45,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/cpva642.dts b/target/linux/brcm63xx/dts/cpva642.dts index ef66c38f5..649aae2d7 100644 --- a/target/linux/brcm63xx/dts/cpva642.dts +++ b/target/linux/brcm63xx/dts/cpva642.dts @@ -82,8 +82,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ct-5365.dts b/target/linux/brcm63xx/dts/ct-5365.dts index 0bcff5f05..691479af7 100644 --- a/target/linux/brcm63xx/dts/ct-5365.dts +++ b/target/linux/brcm63xx/dts/ct-5365.dts @@ -59,8 +59,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ct-6373.dts b/target/linux/brcm63xx/dts/ct-6373.dts index a1be08b17..9b450dc6b 100644 --- a/target/linux/brcm63xx/dts/ct-6373.dts +++ b/target/linux/brcm63xx/dts/ct-6373.dts @@ -80,8 +80,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/ct536plus.dts b/target/linux/brcm63xx/dts/ct536plus.dts index 2c023f5d3..04d8033ec 100644 --- a/target/linux/brcm63xx/dts/ct536plus.dts +++ b/target/linux/brcm63xx/dts/ct536plus.dts @@ -45,8 +45,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/cvg834g.dts b/target/linux/brcm63xx/dts/cvg834g.dts index ca635bb26..9bdc8c242 100644 --- a/target/linux/brcm63xx/dts/cvg834g.dts +++ b/target/linux/brcm63xx/dts/cvg834g.dts @@ -27,8 +27,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dg834g_v4.dts b/target/linux/brcm63xx/dts/dg834g_v4.dts index 55f57dc56..77b7323cf 100644 --- a/target/linux/brcm63xx/dts/dg834g_v4.dts +++ b/target/linux/brcm63xx/dts/dg834g_v4.dts @@ -53,8 +53,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dg834gtpn.dts b/target/linux/brcm63xx/dts/dg834gtpn.dts index 389532482..ff9c85381 100644 --- a/target/linux/brcm63xx/dts/dg834gtpn.dts +++ b/target/linux/brcm63xx/dts/dg834gtpn.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dgnd3700v1.dts b/target/linux/brcm63xx/dts/dgnd3700v1.dts index cafa098f6..a98664822 100644 --- a/target/linux/brcm63xx/dts/dgnd3700v1.dts +++ b/target/linux/brcm63xx/dts/dgnd3700v1.dts @@ -91,8 +91,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -121,7 +119,7 @@ reg = <0x1fe0000 0x20000>; }; }; -}; +}; &pinctrl { pinctrl-names = "default"; diff --git a/target/linux/brcm63xx/dts/dsl-2640b-b.dts b/target/linux/brcm63xx/dts/dsl-2640b-b.dts index 3c3ea07e8..1ce0d65d6 100644 --- a/target/linux/brcm63xx/dts/dsl-2640b-b.dts +++ b/target/linux/brcm63xx/dts/dsl-2640b-b.dts @@ -53,8 +53,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dsl-2640u.dts b/target/linux/brcm63xx/dts/dsl-2640u.dts index dec25a7bc..170a722d4 100644 --- a/target/linux/brcm63xx/dts/dsl-2640u.dts +++ b/target/linux/brcm63xx/dts/dsl-2640u.dts @@ -37,8 +37,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dsl-2650u.dts b/target/linux/brcm63xx/dts/dsl-2650u.dts index f784f3364..0ee0ff354 100644 --- a/target/linux/brcm63xx/dts/dsl-2650u.dts +++ b/target/linux/brcm63xx/dts/dsl-2650u.dts @@ -39,8 +39,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dsl-274xb-c.dts b/target/linux/brcm63xx/dts/dsl-274xb-c.dts index e8cebb337..f6042cd97 100644 --- a/target/linux/brcm63xx/dts/dsl-274xb-c.dts +++ b/target/linux/brcm63xx/dts/dsl-274xb-c.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dsl-274xb-f.dts b/target/linux/brcm63xx/dts/dsl-274xb-f.dts index 8b9acaa77..052584b7e 100644 --- a/target/linux/brcm63xx/dts/dsl-274xb-f.dts +++ b/target/linux/brcm63xx/dts/dsl-274xb-f.dts @@ -81,8 +81,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dsl-275xb-d.dts b/target/linux/brcm63xx/dts/dsl-275xb-d.dts index a8022ddb2..ae773fe19 100644 --- a/target/linux/brcm63xx/dts/dsl-275xb-d.dts +++ b/target/linux/brcm63xx/dts/dsl-275xb-d.dts @@ -94,8 +94,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dv-201amr.dts b/target/linux/brcm63xx/dts/dv-201amr.dts index ae68de479..6cafc891a 100644 --- a/target/linux/brcm63xx/dts/dv-201amr.dts +++ b/target/linux/brcm63xx/dts/dv-201amr.dts @@ -17,8 +17,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/dva-g3810bn_tl.dts b/target/linux/brcm63xx/dts/dva-g3810bn_tl.dts index e9e042285..bc8750577 100644 --- a/target/linux/brcm63xx/dts/dva-g3810bn_tl.dts +++ b/target/linux/brcm63xx/dts/dva-g3810bn_tl.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/evg2000.dts b/target/linux/brcm63xx/dts/evg2000.dts index 8468393a4..122fa50f3 100644 --- a/target/linux/brcm63xx/dts/evg2000.dts +++ b/target/linux/brcm63xx/dts/evg2000.dts @@ -82,8 +82,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/f5d7633.dts b/target/linux/brcm63xx/dts/f5d7633.dts index 57ab97aa8..81f14ec3c 100644 --- a/target/linux/brcm63xx/dts/f5d7633.dts +++ b/target/linux/brcm63xx/dts/f5d7633.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/fast2404.dts b/target/linux/brcm63xx/dts/fast2404.dts index 9035b9d15..c9f75f389 100644 --- a/target/linux/brcm63xx/dts/fast2404.dts +++ b/target/linux/brcm63xx/dts/fast2404.dts @@ -17,8 +17,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/fast2504n.dts b/target/linux/brcm63xx/dts/fast2504n.dts index 86ac4b768..22349d9f9 100644 --- a/target/linux/brcm63xx/dts/fast2504n.dts +++ b/target/linux/brcm63xx/dts/fast2504n.dts @@ -76,8 +76,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/fast2604.dts b/target/linux/brcm63xx/dts/fast2604.dts index 4ac9d30c3..ad8093c6a 100644 --- a/target/linux/brcm63xx/dts/fast2604.dts +++ b/target/linux/brcm63xx/dts/fast2604.dts @@ -53,8 +53,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/fast2704n.dts b/target/linux/brcm63xx/dts/fast2704n.dts index 1d75b6cf5..b29367913 100644 --- a/target/linux/brcm63xx/dts/fast2704n.dts +++ b/target/linux/brcm63xx/dts/fast2704n.dts @@ -101,8 +101,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/fast2704v2.dts b/target/linux/brcm63xx/dts/fast2704v2.dts index dfab31f4a..47a998f29 100644 --- a/target/linux/brcm63xx/dts/fast2704v2.dts +++ b/target/linux/brcm63xx/dts/fast2704v2.dts @@ -85,8 +85,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/gw6000.dts b/target/linux/brcm63xx/dts/gw6000.dts index ab7932e78..063bc6b24 100644 --- a/target/linux/brcm63xx/dts/gw6000.dts +++ b/target/linux/brcm63xx/dts/gw6000.dts @@ -31,8 +31,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/gw6200.dts b/target/linux/brcm63xx/dts/gw6200.dts index a7d5d476c..51f294726 100644 --- a/target/linux/brcm63xx/dts/gw6200.dts +++ b/target/linux/brcm63xx/dts/gw6200.dts @@ -52,8 +52,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg520v.dts b/target/linux/brcm63xx/dts/hg520v.dts index d79b73d4c..0a809c163 100644 --- a/target/linux/brcm63xx/dts/hg520v.dts +++ b/target/linux/brcm63xx/dts/hg520v.dts @@ -40,9 +40,7 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - - partitions { + partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg553.dts b/target/linux/brcm63xx/dts/hg553.dts index 8d5c3db25..36e6d8c33 100644 --- a/target/linux/brcm63xx/dts/hg553.dts +++ b/target/linux/brcm63xx/dts/hg553.dts @@ -79,8 +79,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg556a-a.dts b/target/linux/brcm63xx/dts/hg556a-a.dts index 3abfc4b57..71ae3deaf 100644 --- a/target/linux/brcm63xx/dts/hg556a-a.dts +++ b/target/linux/brcm63xx/dts/hg556a-a.dts @@ -105,8 +105,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg556a-b.dts b/target/linux/brcm63xx/dts/hg556a-b.dts index c88825f9e..203ca995a 100644 --- a/target/linux/brcm63xx/dts/hg556a-b.dts +++ b/target/linux/brcm63xx/dts/hg556a-b.dts @@ -105,8 +105,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg556a-c.dts b/target/linux/brcm63xx/dts/hg556a-c.dts index 896ddf1c8..90cc8a507 100644 --- a/target/linux/brcm63xx/dts/hg556a-c.dts +++ b/target/linux/brcm63xx/dts/hg556a-c.dts @@ -100,8 +100,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg622.dts b/target/linux/brcm63xx/dts/hg622.dts index dc44dd36c..f34009a28 100644 --- a/target/linux/brcm63xx/dts/hg622.dts +++ b/target/linux/brcm63xx/dts/hg622.dts @@ -54,8 +54,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/hg655b.dts b/target/linux/brcm63xx/dts/hg655b.dts index edaeb951f..df6742923 100644 --- a/target/linux/brcm63xx/dts/hg655b.dts +++ b/target/linux/brcm63xx/dts/hg655b.dts @@ -72,8 +72,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/homehub2a.dts b/target/linux/brcm63xx/dts/homehub2a.dts index a16441af0..dfc3f1380 100644 --- a/target/linux/brcm63xx/dts/homehub2a.dts +++ b/target/linux/brcm63xx/dts/homehub2a.dts @@ -139,8 +139,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/livebox-blue-5g.dts b/target/linux/brcm63xx/dts/livebox-blue-5g.dts index 0bc503c94..f8d5dfce5 100644 --- a/target/linux/brcm63xx/dts/livebox-blue-5g.dts +++ b/target/linux/brcm63xx/dts/livebox-blue-5g.dts @@ -69,7 +69,9 @@ reg = <0x1e400000 0x800000>; status = "ok"; - linux,part-probe = "RedBoot"; + partitions { + compatible = "ecoscentric,redboot-fis-partitions"; + }; }; &pinctrl { diff --git a/target/linux/brcm63xx/dts/magic.dts b/target/linux/brcm63xx/dts/magic.dts index f9331d453..2c187b799 100644 --- a/target/linux/brcm63xx/dts/magic.dts +++ b/target/linux/brcm63xx/dts/magic.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/nb4-fxc-r1.dts b/target/linux/brcm63xx/dts/nb4-fxc-r1.dts index 4874bc152..76c55b4fd 100644 --- a/target/linux/brcm63xx/dts/nb4-fxc-r1.dts +++ b/target/linux/brcm63xx/dts/nb4-fxc-r1.dts @@ -102,8 +102,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/nb4-ser-r0.dts b/target/linux/brcm63xx/dts/nb4-ser-r0.dts index a6dc102c0..09b34cc9d 100644 --- a/target/linux/brcm63xx/dts/nb4-ser-r0.dts +++ b/target/linux/brcm63xx/dts/nb4-ser-r0.dts @@ -102,8 +102,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/nb6-ser-r0.dts b/target/linux/brcm63xx/dts/nb6-ser-r0.dts index 2866afd2d..5ebfca6fb 100644 --- a/target/linux/brcm63xx/dts/nb6-ser-r0.dts +++ b/target/linux/brcm63xx/dts/nb6-ser-r0.dts @@ -64,8 +64,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/p870hw-51a-v2.dts b/target/linux/brcm63xx/dts/p870hw-51a-v2.dts index 02749ce6e..20d820bd1 100644 --- a/target/linux/brcm63xx/dts/p870hw-51a-v2.dts +++ b/target/linux/brcm63xx/dts/p870hw-51a-v2.dts @@ -62,8 +62,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/r1000h.dts b/target/linux/brcm63xx/dts/r1000h.dts index 3b3ac5792..9434060da 100644 --- a/target/linux/brcm63xx/dts/r1000h.dts +++ b/target/linux/brcm63xx/dts/r1000h.dts @@ -77,8 +77,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/r5010unv2.dts b/target/linux/brcm63xx/dts/r5010unv2.dts index fd87bef70..af9633c8b 100644 --- a/target/linux/brcm63xx/dts/r5010unv2.dts +++ b/target/linux/brcm63xx/dts/r5010unv2.dts @@ -13,7 +13,7 @@ stdout-path = "serial0:115200n8"; }; - + gpio-keys-polled { compatible = "gpio-keys-polled"; #address-cells = <1>; @@ -81,12 +81,10 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; cfe@0 { reg = <0x000000 0x010000>; diff --git a/target/linux/brcm63xx/dts/rg100a.dts b/target/linux/brcm63xx/dts/rg100a.dts index 9ae128eb7..7b0e4b276 100644 --- a/target/linux/brcm63xx/dts/rg100a.dts +++ b/target/linux/brcm63xx/dts/rg100a.dts @@ -39,8 +39,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/rta1025w.dts b/target/linux/brcm63xx/dts/rta1025w.dts index f6f8a0892..122e049b3 100644 --- a/target/linux/brcm63xx/dts/rta1025w.dts +++ b/target/linux/brcm63xx/dts/rta1025w.dts @@ -17,8 +17,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/rta1320.dts b/target/linux/brcm63xx/dts/rta1320.dts index 3783c8db0..b249fbd08 100644 --- a/target/linux/brcm63xx/dts/rta1320.dts +++ b/target/linux/brcm63xx/dts/rta1320.dts @@ -39,8 +39,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/rta770bw.dts b/target/linux/brcm63xx/dts/rta770bw.dts index d40cfd28d..fd99780f8 100644 --- a/target/linux/brcm63xx/dts/rta770bw.dts +++ b/target/linux/brcm63xx/dts/rta770bw.dts @@ -25,7 +25,7 @@ gpios = <&gpio0 13 1>; linux,code = ; }; - }; + }; gpio-leds { compatible = "gpio-leds"; @@ -55,8 +55,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/rta770w.dts b/target/linux/brcm63xx/dts/rta770w.dts index 034faaf39..e057a70ed 100644 --- a/target/linux/brcm63xx/dts/rta770w.dts +++ b/target/linux/brcm63xx/dts/rta770w.dts @@ -25,7 +25,7 @@ gpios = <&gpio0 13 1>; linux,code = ; }; - }; + }; gpio-leds { compatible = "gpio-leds"; @@ -55,8 +55,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/spw303v.dts b/target/linux/brcm63xx/dts/spw303v.dts index 3df982092..3317fc85e 100644 --- a/target/linux/brcm63xx/dts/spw303v.dts +++ b/target/linux/brcm63xx/dts/spw303v.dts @@ -66,8 +66,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/spw500v.dts b/target/linux/brcm63xx/dts/spw500v.dts index ceaa569b9..c55fdf840 100644 --- a/target/linux/brcm63xx/dts/spw500v.dts +++ b/target/linux/brcm63xx/dts/spw500v.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/sr102.dts b/target/linux/brcm63xx/dts/sr102.dts new file mode 100644 index 000000000..e34a68169 --- /dev/null +++ b/target/linux/brcm63xx/dts/sr102.dts @@ -0,0 +1,118 @@ +/dts-v1/; + +#include "bcm63268.dtsi" + +#include + +/ { + model = "SKY SR102"; + compatible = "sky,sr102", "brcm,bcm63268"; + + chosen { + bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + debounce-interval = <60>; + + wps { + label = "wps"; + gpios = <&pinctrl 33 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan1_green { + label = "SR102:green:lan1"; + gpios = <&pinctrl 1 1>; + }; + power_red { + label = "SR102:red:power"; + gpios = <&pinctrl 2 1>; + }; + wifi_red { + label = "SR102:red:wifi"; + gpios = <&pinctrl 3 1>; + }; + inet_red { + label = "SR102:red:inet"; + gpios = <&pinctrl 4 1>; + }; + inet_white { + label = "SR102:white:inet"; + gpios = <&pinctrl 5 0>; + }; + power_white { + label = "SR102:white:power"; + gpios = <&pinctrl 6 0>; + default-state = "on"; + }; + wifi_white { + label = "SR102:white:wifi"; + gpios = <&pinctrl 8 0>; + }; + lan2_red { + label = "SR102:red:lan2"; + gpios = <&pinctrl 9 1>; + }; + lan3_red { + label = "SR102:red:lan3"; + gpios = <&pinctrl 10 1>; + }; + lan4_red { + label = "SR102:red:lan4"; + gpios = <&pinctrl 11 1>; + }; + lan1_red { + label = "SR102:red:lan1"; + gpios = <&pinctrl 12 1>; + }; + lan2_green { + label = "SR102:green:lan2"; + gpios = <&pinctrl 13 0>; + }; + lan3_green { + label = "SR102:green:lan3"; + gpios = <&pinctrl 14 1>; + }; + lan4_green { + label = "SR102:green:lan4"; + gpios = <&pinctrl 15 1>; + }; + hd_white { + label = "SR102:white:hd"; + gpios = <&pinctrl 18 0>; + }; + }; +}; + +&hsspi { + status = "ok"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <16666667>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + reg = <0>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "brcm,bcm963xx-cfe-nor-partitions"; + }; + }; +}; + +&uart0 { + status = "ok"; +}; diff --git a/target/linux/brcm63xx/dts/td-w8900gb.dts b/target/linux/brcm63xx/dts/td-w8900gb.dts index 6b7eecec3..513c40ac6 100644 --- a/target/linux/brcm63xx/dts/td-w8900gb.dts +++ b/target/linux/brcm63xx/dts/td-w8900gb.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/usr9108.dts b/target/linux/brcm63xx/dts/usr9108.dts index 5c9309334..987fc5942 100644 --- a/target/linux/brcm63xx/dts/usr9108.dts +++ b/target/linux/brcm63xx/dts/usr9108.dts @@ -30,8 +30,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/v2110.dts b/target/linux/brcm63xx/dts/v2110.dts index 3ae37453b..a400d5ab9 100644 --- a/target/linux/brcm63xx/dts/v2110.dts +++ b/target/linux/brcm63xx/dts/v2110.dts @@ -56,8 +56,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/v2500v-bb.dts b/target/linux/brcm63xx/dts/v2500v-bb.dts index 243cffa77..7d47683ba 100644 --- a/target/linux/brcm63xx/dts/v2500v-bb.dts +++ b/target/linux/brcm63xx/dts/v2500v-bb.dts @@ -56,8 +56,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/vg50.dts b/target/linux/brcm63xx/dts/vg50.dts index e7b5dbdbb..140213b58 100644 --- a/target/linux/brcm63xx/dts/vg50.dts +++ b/target/linux/brcm63xx/dts/vg50.dts @@ -31,7 +31,7 @@ gpios = <&pinctrl 34 0>; linux,code = ; }; - }; + }; }; &hsspi { @@ -47,8 +47,6 @@ #address-cells = <1>; #size-cells = <1>; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "brcm,bcm963xx-cfe-nor-partitions"; }; diff --git a/target/linux/brcm63xx/dts/vh4032n.dts b/target/linux/brcm63xx/dts/vh4032n.dts index 6dee87501..1296fbf14 100644 --- a/target/linux/brcm63xx/dts/vh4032n.dts +++ b/target/linux/brcm63xx/dts/vh4032n.dts @@ -83,8 +83,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/vr-3025u.dts b/target/linux/brcm63xx/dts/vr-3025u.dts index 6201718d7..126ca94fa 100644 --- a/target/linux/brcm63xx/dts/vr-3025u.dts +++ b/target/linux/brcm63xx/dts/vr-3025u.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/vr-3025un.dts b/target/linux/brcm63xx/dts/vr-3025un.dts index a3d12a707..5e57036d0 100644 --- a/target/linux/brcm63xx/dts/vr-3025un.dts +++ b/target/linux/brcm63xx/dts/vr-3025un.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/vr-3026e.dts b/target/linux/brcm63xx/dts/vr-3026e.dts index 0ffbb7d82..7439a2e62 100644 --- a/target/linux/brcm63xx/dts/vr-3026e.dts +++ b/target/linux/brcm63xx/dts/vr-3026e.dts @@ -57,8 +57,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/dts/wap-5813n.dts b/target/linux/brcm63xx/dts/wap-5813n.dts index b50ff237e..9a66895bd 100644 --- a/target/linux/brcm63xx/dts/wap-5813n.dts +++ b/target/linux/brcm63xx/dts/wap-5813n.dts @@ -67,8 +67,6 @@ &pflash { status = "ok"; - linux,part-probe = "bcm63xxpart"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/brcm63xx/image/bcm63xx.mk b/target/linux/brcm63xx/image/bcm63xx.mk index b9ecd5406..0f213bb15 100644 --- a/target/linux/brcm63xx/image/bcm63xx.mk +++ b/target/linux/brcm63xx/image/bcm63xx.mk @@ -1016,10 +1016,22 @@ define Device/NEUFBOX6 CFE_CHIP_ID := 6362 CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" DEVICE_PACKAGES := \ - $(B43_PACKAGES) $(USB2_PACKAGES) + $(USB2_PACKAGES) endef TARGET_DEVICES += NEUFBOX6 +define Device/SR102 + $(Device/bcm63xx) + DEVICE_TITLE := SKY-SR102 + DEVICE_DTS := sr102 + CFE_BOARD_ID := BSKYB_63168 + CFE_CHIP_ID := 63268 + CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" + DEVICE_PACKAGES := \ + $(USB2_PACKAGES) +endef +TARGET_DEVICES += SR102 + ### T-Com ### define Device/SPW303V $(Device/bcm63xx) diff --git a/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch b/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch deleted file mode 100644 index 073a8a45f..000000000 --- a/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch +++ /dev/null @@ -1,81 +0,0 @@ -From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 27 Jul 2018 21:37:48 +0200 -Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions - with "compatible" prop" - -This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee. ---- - drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++------------- - 1 file changed, 20 insertions(+), 13 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -453,6 +453,22 @@ static inline void free_partition(struct - kfree(p); - } - -+/** -+ * mtd_parse_part - parse MTD partition looking for subpartitions -+ * -+ * @slave: part that is supposed to be a container and should be parsed -+ * @types: NULL-terminated array with names of partition parsers to try -+ * -+ * Some partitions are kind of containers with extra subpartitions (volumes). -+ * There can be various formats of such containers. This function tries to use -+ * specified parsers to analyze given partition and registers found -+ * subpartitions on success. -+ */ -+static int mtd_parse_part(struct mtd_part *slave, const char *const *types) -+{ -+ return parse_mtd_partitions(&slave->mtd, types, NULL); -+} -+ - static struct mtd_part *allocate_partition(struct mtd_info *parent, - const struct mtd_partition *part, int partno, - uint64_t cur_offset) -@@ -932,8 +948,8 @@ int add_mtd_partitions(struct mtd_info * - add_mtd_device(&slave->mtd); - mtd_partition_split(master, slave); - mtd_add_partition_attrs(slave); -- /* Look for subpartitions */ -- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); -+ if (parts[i].types) -+ mtd_parse_part(slave, parts[i].types); - - cur_offset = slave->offset + slave->mtd.size; - } -@@ -1035,12 +1051,6 @@ static const char * const default_mtd_pa - NULL - }; - --/* Check DT only when looking for subpartitions. */ --static const char * const default_subpartition_types[] = { -- "ofpart", -- NULL --}; -- - static int mtd_part_do_parse(struct mtd_part_parser *parser, - struct mtd_info *master, - struct mtd_partitions *pparts, -@@ -1111,9 +1121,7 @@ static int mtd_part_of_parse(struct mtd_ - const char *fixed = "fixed-partitions"; - int ret, err = 0; - -- np = mtd_get_of_node(master); -- if (!mtd_is_partition(master)) -- np = of_get_child_by_name(np, "partitions"); -+ np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); - of_property_for_each_string(np, "compatible", prop, compat) { - parser = mtd_part_get_compatible_parser(compat); - if (!parser) -@@ -1183,8 +1191,7 @@ int parse_mtd_partitions(struct mtd_info - } - - if (!types) -- types = mtd_is_partition(master) ? default_subpartition_types : -- default_mtd_part_types; -+ types = default_mtd_part_types; - - for ( ; *types; types++) { - /* diff --git a/target/linux/brcm63xx/patches-4.14/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch b/target/linux/brcm63xx/patches-4.14/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch deleted file mode 100644 index b9009bbee..000000000 --- a/target/linux/brcm63xx/patches-4.14/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 53980645bb12bd8723ac226805ee171780b24196 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 26 Jun 2017 13:37:11 +0200 -Subject: [PATCH 1/4] mtd: add of_match_table parsing for partition parsers - -Allow partition parsers to be matched by attaching compatible strings to -partitions. - -This allows specifying the expected format of flash partitions for -matching partition parsers. - -Example: - -flash@foo { - ... - partitions { - compatible = "fixed-partitions"; - - cfe@0 { - reg = <0x0 0x10000>; - label = "cfe"; - read-only; - }; - - firmware@10000 { - reg = <0x10000 0x3e0000>; - label = "firmware"; - compatible = "brcm,bcm63xx-imagetag"; - }; - - nvram@3f0000 { - reg = <0x3e0000 0x10000>; - label = "nvram"; - }; - }; -}; - -Signed-off-by: Jonas Gorski ---- - drivers/mtd/mtdpart.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -948,8 +948,7 @@ int add_mtd_partitions(struct mtd_info * - add_mtd_device(&slave->mtd); - mtd_partition_split(master, slave); - mtd_add_partition_attrs(slave); -- if (parts[i].types) -- mtd_parse_part(slave, parts[i].types); -+ mtd_parse_part(slave, parts[i].types); - - cur_offset = slave->offset + slave->mtd.size; - } -@@ -1121,7 +1120,9 @@ static int mtd_part_of_parse(struct mtd_ - const char *fixed = "fixed-partitions"; - int ret, err = 0; - -- np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); -+ np = mtd_get_of_node(master); -+ if (!mtd_is_partition(master)) -+ np = of_get_child_by_name(np, "partitions"); - of_property_for_each_string(np, "compatible", prop, compat) { - parser = mtd_part_get_compatible_parser(compat); - if (!parser) -@@ -1190,8 +1191,12 @@ int parse_mtd_partitions(struct mtd_info - types = types_of; - } - -- if (!types) -+ if (!types) { -+ if (mtd_is_partition(master)) -+ return -ENOENT; -+ - types = default_mtd_part_types; -+ } - - for ( ; *types; types++) { - /* diff --git a/target/linux/brcm63xx/patches-4.14/598-board_sr102.patch b/target/linux/brcm63xx/patches-4.14/598-board_sr102.patch new file mode 100644 index 000000000..9383e55f7 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.14/598-board_sr102.patch @@ -0,0 +1,68 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -2642,6 +2642,49 @@ static struct board_info __initdata boar + }, + }, + }; ++ ++static struct board_info __initdata board_BSKYB_63168 = { ++ .name = "BSKYB_63168", ++ .expected_cpu_id = 0x63268, ++ ++ .has_pci = 1, ++ .use_fallback_sprom = 0, ++ ++ .has_ehci0 = 1, ++ .has_ohci0 = 1, ++ .num_usbh_ports = 2, ++ ++ .has_enetsw = 1, ++ ++ .enetsw = { ++ .used_ports = { ++ [0] = { ++ .used = 1, ++ .phy_id = 1, ++ .name = "Port 1", ++ }, ++ ++ [1] = { ++ .used = 1, ++ .phy_id = 2, ++ .name = "Port 2", ++ }, ++ ++ [2] = { ++ .used = 1, ++ .phy_id = 3, ++ .name = "Port 3", ++ }, ++ ++ [3] = { ++ .used = 1, ++ .phy_id = 4, ++ .name = "Port 4", ++ }, ++ ++ }, ++ }, ++}; + #endif /* CONFIG_BCM63XX_CPU_63268 */ + + /* +@@ -2750,6 +2793,7 @@ static const struct board_info __initcon + &board_963268bu_p300, + &board_963269bhr, + &board_vw6339gu, ++ &board_BSKYB_63168, + #endif + }; + +@@ -2862,6 +2906,7 @@ static struct of_device_id const bcm963x + { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, }, + { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, + { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, ++ { .compatible = "sky,sr102", .data = &board_BSKYB_63168, }, + #endif + #endif /* CONFIG_OF */ + { }, diff --git a/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch b/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch deleted file mode 100644 index a3e9ce86a..000000000 --- a/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch +++ /dev/null @@ -1,81 +0,0 @@ -From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 27 Jul 2018 21:37:48 +0200 -Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions - with "compatible" prop" - -This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee. ---- - drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++------------- - 1 file changed, 20 insertions(+), 13 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -453,6 +453,22 @@ static inline void free_partition(struct - kfree(p); - } - -+/** -+ * mtd_parse_part - parse MTD partition looking for subpartitions -+ * -+ * @slave: part that is supposed to be a container and should be parsed -+ * @types: NULL-terminated array with names of partition parsers to try -+ * -+ * Some partitions are kind of containers with extra subpartitions (volumes). -+ * There can be various formats of such containers. This function tries to use -+ * specified parsers to analyze given partition and registers found -+ * subpartitions on success. -+ */ -+static int mtd_parse_part(struct mtd_part *slave, const char *const *types) -+{ -+ return parse_mtd_partitions(&slave->mtd, types, NULL); -+} -+ - static struct mtd_part *allocate_partition(struct mtd_info *parent, - const struct mtd_partition *part, int partno, - uint64_t cur_offset) -@@ -924,8 +940,8 @@ int add_mtd_partitions(struct mtd_info * - add_mtd_device(&slave->mtd); - mtd_partition_split(master, slave); - mtd_add_partition_attrs(slave); -- /* Look for subpartitions */ -- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); -+ if (parts[i].types) -+ mtd_parse_part(slave, parts[i].types); - - cur_offset = slave->offset + slave->mtd.size; - } -@@ -1037,12 +1053,6 @@ static const char * const default_mtd_pa - NULL - }; - --/* Check DT only when looking for subpartitions. */ --static const char * const default_subpartition_types[] = { -- "ofpart", -- NULL --}; -- - static int mtd_part_do_parse(struct mtd_part_parser *parser, - struct mtd_info *master, - struct mtd_partitions *pparts, -@@ -1113,9 +1123,7 @@ static int mtd_part_of_parse(struct mtd_ - const char *fixed = "fixed-partitions"; - int ret, err = 0; - -- np = mtd_get_of_node(master); -- if (!mtd_is_partition(master)) -- np = of_get_child_by_name(np, "partitions"); -+ np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); - of_property_for_each_string(np, "compatible", prop, compat) { - parser = mtd_part_get_compatible_parser(compat); - if (!parser) -@@ -1185,8 +1193,7 @@ int parse_mtd_partitions(struct mtd_info - } - - if (!types) -- types = mtd_is_partition(master) ? default_subpartition_types : -- default_mtd_part_types; -+ types = default_mtd_part_types; - - for ( ; *types; types++) { - /* diff --git a/target/linux/brcm63xx/patches-4.9/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch b/target/linux/brcm63xx/patches-4.9/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch deleted file mode 100644 index 5ae903b93..000000000 --- a/target/linux/brcm63xx/patches-4.9/120-mtd-add-of_match_table-parsing-for-partition-parsers.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 53980645bb12bd8723ac226805ee171780b24196 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 26 Jun 2017 13:37:11 +0200 -Subject: [PATCH 1/4] mtd: add of_match_table parsing for partition parsers - -Allow partition parsers to be matched by attaching compatible strings to -partitions. - -This allows specifying the expected format of flash partitions for -matching partition parsers. - -Example: - -flash@foo { - ... - partitions { - compatible = "fixed-partitions"; - - cfe@0 { - reg = <0x0 0x10000>; - label = "cfe"; - read-only; - }; - - firmware@10000 { - reg = <0x10000 0x3e0000>; - label = "firmware"; - compatible = "brcm,bcm63xx-imagetag"; - }; - - nvram@3f0000 { - reg = <0x3e0000 0x10000>; - label = "nvram"; - }; - }; -}; - -Signed-off-by: Jonas Gorski ---- - drivers/mtd/mtdpart.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -940,8 +940,7 @@ int add_mtd_partitions(struct mtd_info * - add_mtd_device(&slave->mtd); - mtd_partition_split(master, slave); - mtd_add_partition_attrs(slave); -- if (parts[i].types) -- mtd_parse_part(slave, parts[i].types); -+ mtd_parse_part(slave, parts[i].types); - - cur_offset = slave->offset + slave->mtd.size; - } -@@ -1123,7 +1122,9 @@ static int mtd_part_of_parse(struct mtd_ - const char *fixed = "fixed-partitions"; - int ret, err = 0; - -- np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); -+ np = mtd_get_of_node(master); -+ if (!mtd_is_partition(master)) -+ np = of_get_child_by_name(np, "partitions"); - of_property_for_each_string(np, "compatible", prop, compat) { - parser = mtd_part_get_compatible_parser(compat); - if (!parser) -@@ -1192,8 +1193,12 @@ int parse_mtd_partitions(struct mtd_info - types = types_of; - } - -- if (!types) -+ if (!types) { -+ if (mtd_is_partition(master)) -+ return -ENOENT; -+ - types = default_mtd_part_types; -+ } - - for ( ; *types; types++) { - /* diff --git a/target/linux/brcm63xx/patches-4.9/400-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-4.9/400-bcm963xx_flashmap.patch index c693ace36..6b4f0f138 100644 --- a/target/linux/brcm63xx/patches-4.9/400-bcm963xx_flashmap.patch +++ b/target/linux/brcm63xx/patches-4.9/400-bcm963xx_flashmap.patch @@ -23,7 +23,7 @@ Signed-off-by: Axel Gembe .width = 2, --- a/drivers/mtd/redboot.c +++ b/drivers/mtd/redboot.c -@@ -72,6 +72,7 @@ static int parse_redboot_partitions(stru +@@ -73,6 +73,7 @@ static int parse_redboot_partitions(stru int nulllen = 0; int numslots; unsigned long offset; @@ -31,7 +31,7 @@ Signed-off-by: Axel Gembe #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED static char nullstring[] = "unallocated"; #endif -@@ -176,6 +177,16 @@ static int parse_redboot_partitions(stru +@@ -177,6 +178,16 @@ static int parse_redboot_partitions(stru goto out; } @@ -48,7 +48,7 @@ Signed-off-by: Axel Gembe for (i = 0; i < numslots; i++) { struct fis_list *new_fl, **prev; -@@ -196,10 +207,10 @@ static int parse_redboot_partitions(stru +@@ -197,10 +208,10 @@ static int parse_redboot_partitions(stru goto out; } new_fl->img = &buf[i]; diff --git a/target/linux/brcm63xx/patches-4.9/598-board_sr102.patch b/target/linux/brcm63xx/patches-4.9/598-board_sr102.patch new file mode 100644 index 000000000..9383e55f7 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.9/598-board_sr102.patch @@ -0,0 +1,68 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -2642,6 +2642,49 @@ static struct board_info __initdata boar + }, + }, + }; ++ ++static struct board_info __initdata board_BSKYB_63168 = { ++ .name = "BSKYB_63168", ++ .expected_cpu_id = 0x63268, ++ ++ .has_pci = 1, ++ .use_fallback_sprom = 0, ++ ++ .has_ehci0 = 1, ++ .has_ohci0 = 1, ++ .num_usbh_ports = 2, ++ ++ .has_enetsw = 1, ++ ++ .enetsw = { ++ .used_ports = { ++ [0] = { ++ .used = 1, ++ .phy_id = 1, ++ .name = "Port 1", ++ }, ++ ++ [1] = { ++ .used = 1, ++ .phy_id = 2, ++ .name = "Port 2", ++ }, ++ ++ [2] = { ++ .used = 1, ++ .phy_id = 3, ++ .name = "Port 3", ++ }, ++ ++ [3] = { ++ .used = 1, ++ .phy_id = 4, ++ .name = "Port 4", ++ }, ++ ++ }, ++ }, ++}; + #endif /* CONFIG_BCM63XX_CPU_63268 */ + + /* +@@ -2750,6 +2793,7 @@ static const struct board_info __initcon + &board_963268bu_p300, + &board_963269bhr, + &board_vw6339gu, ++ &board_BSKYB_63168, + #endif + }; + +@@ -2862,6 +2906,7 @@ static struct of_device_id const bcm963x + { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, }, + { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, + { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, ++ { .compatible = "sky,sr102", .data = &board_BSKYB_63168, }, + #endif + #endif /* CONFIG_OF */ + { }, diff --git a/target/linux/brcm63xx/profiles/sky.mk b/target/linux/brcm63xx/profiles/sky.mk new file mode 100644 index 000000000..f20979480 --- /dev/null +++ b/target/linux/brcm63xx/profiles/sky.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/SR102 + NAME:=SKY SR102 + PACKAGES:=kmod-b43 wpad-mini \ + kmod-usb2 kmod-usb-ohci +endef +define Profile/SR102/Description + Package set optimized for SKY SR102. +endef +$(eval $(call Profile,SR102)) diff --git a/target/linux/cns3xxx/Makefile b/target/linux/cns3xxx/Makefile index 93b8d7da4..2a09ece67 100644 --- a/target/linux/cns3xxx/Makefile +++ b/target/linux/cns3xxx/Makefile @@ -12,8 +12,8 @@ BOARDNAME:=Cavium Networks Econa CNS3xxx FEATURES:=squashfs fpu gpio pcie usb usbgadget CPU_TYPE:=mpcore CPU_SUBTYPE:=vfp -MAINTAINER:=Felix Fietkau - +MAINTAINER:=Felix Fietkau , \ + Koen Vandeputte KERNEL_PATCHVER:=4.14 define Target/Description diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c index 4fbc34f35..455649942 100644 --- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c +++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c @@ -325,6 +325,7 @@ static int cns3xxx_mdio_cmd(struct mii_bus *bus, int phy_id, int location, } else { temp = MDIO_READ_COMMAND; } + temp |= ((location & 0x1f) << MDIO_REG_OFFSET); temp |= (phy_id & 0x1f); @@ -337,8 +338,7 @@ static int cns3xxx_mdio_cmd(struct mii_bus *bus, int phy_id, int location, } if (cycles == 5000) { - printk(KERN_ERR "%s #%i: MII transaction failed\n", bus->name, - phy_id); + printk(KERN_ERR "%s #%i: MII transaction failed\n", bus->name, phy_id); return -1; } @@ -363,8 +363,7 @@ static int cns3xxx_mdio_read(struct mii_bus *bus, int phy_id, int location) return ret; } -static int cns3xxx_mdio_write(struct mii_bus *bus, int phy_id, int location, - u16 val) +static int cns3xxx_mdio_write(struct mii_bus *bus, int phy_id, int location, u16 val) { unsigned long flags; int ret; @@ -392,6 +391,7 @@ static int cns3xxx_mdio_register(void __iomem *base) if ((err = mdiobus_register(mdio_bus))) mdiobus_free(mdio_bus); + return err; } @@ -537,14 +537,13 @@ static void cns3xxx_alloc_rx_buf(struct sw *sw, int received) /* put the new buffer on RX-free queue */ rx_ring->buff_tab[i] = buf; rx_ring->phys_tab[i] = phys; + if (i == RX_DESCS - 1) { + desc->config0 = FIRST_SEGMENT | LAST_SEGMENT | RX_SEGMENT_MRU | END_OF_RING; i = 0; - desc->config0 = END_OF_RING | FIRST_SEGMENT | - LAST_SEGMENT | RX_SEGMENT_MRU; desc = &(rx_ring)->desc[i]; } else { - desc->config0 = FIRST_SEGMENT | LAST_SEGMENT | - RX_SEGMENT_MRU; + desc->config0 = FIRST_SEGMENT | LAST_SEGMENT | RX_SEGMENT_MRU; i++; desc++; } @@ -566,6 +565,7 @@ static void eth_check_num_used(struct _tx_ring *tx_ring) return; tx_ring->stopped = stop; + for (i = 0; i < 4; i++) { struct port *port = switch_port_tab[i]; struct net_device *dev; @@ -574,6 +574,7 @@ static void eth_check_num_used(struct _tx_ring *tx_ring) continue; dev = port->netdev; + if (stop) netif_stop_queue(dev); else @@ -592,24 +593,28 @@ static void eth_complete_tx(struct sw *sw) index = tx_ring->free_index; desc = &(tx_ring)->desc[index]; + for (i = 0; i < num_used; i++) { - if (desc->cown) { - skb = tx_ring->buff_tab[index]; - tx_ring->buff_tab[index] = 0; - if (skb) - dev_kfree_skb_any(skb); - dma_unmap_single(sw->dev, tx_ring->phys_tab[index], - desc->sdl, DMA_TO_DEVICE); - if (++index == TX_DESCS) { - index = 0; - desc = &(tx_ring)->desc[index]; - } else { - desc++; - } - } else { + if (!desc->cown) break; + + skb = tx_ring->buff_tab[index]; + tx_ring->buff_tab[index] = 0; + + if (skb) + dev_kfree_skb_any(skb); + + dma_unmap_single(sw->dev, tx_ring->phys_tab[index], desc->sdl, DMA_TO_DEVICE); + + if (index == TX_DESCS - 1) { + index = 0; + desc = &(tx_ring)->desc[index]; + } else { + index++; + desc++; } } + tx_ring->free_index = index; tx_ring->num_used -= i; eth_check_num_used(tx_ring); @@ -633,8 +638,7 @@ static int eth_poll(struct napi_struct *napi, int budget) break; /* process received frame */ - dma_unmap_single(sw->dev, rx_ring->phys_tab[i], - RX_SEGMENT_MRU, DMA_FROM_DEVICE); + dma_unmap_single(sw->dev, rx_ring->phys_tab[i], RX_SEGMENT_MRU, DMA_FROM_DEVICE); skb = build_skb(rx_ring->buff_tab[i], RX_SEGMENT_ALLOC_SIZE); if (!skb) @@ -703,10 +707,11 @@ static int eth_poll(struct napi_struct *napi, int budget) } received++; - if (++i == RX_DESCS) { + if (i == RX_DESCS - 1) { i = 0; desc = &(rx_ring)->desc[i]; } else { + i++; desc++; } } @@ -741,8 +746,10 @@ static void eth_set_desc(struct sw *sw, struct _tx_ring *tx_ring, int index, tx_ring->phys_tab[index] = phys; config0 |= len; + if (index == TX_DESCS - 1) config0 |= END_OF_RING; + if (index == index_last) config0 |= LAST_SEGMENT; @@ -761,7 +768,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) int nr_desc = nr_frags; int index0, index, index_last; int len0; - unsigned int i; + int i; u32 config0; if (pmap == 8) @@ -772,6 +779,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) eth_schedule_poll(sw); spin_lock_bh(&tx_lock); + if ((tx_ring->num_used + nr_desc + 1) >= TX_DESCS) { spin_unlock_bh(&tx_lock); return NETDEV_TX_BUSY; @@ -875,7 +883,6 @@ static int init_rings(struct sw *sw) __raw_writel(TS_SUSPEND | FS_SUSPEND, &sw->regs->dma_auto_poll_cfg); __raw_writel(QUEUE_THRESHOLD, &sw->regs->dma_ring_ctrl); __raw_writel(CLR_FS_STATE | QUEUE_THRESHOLD, &sw->regs->dma_ring_ctrl); - __raw_writel(QUEUE_THRESHOLD, &sw->regs->dma_ring_ctrl); rx_ring->desc = dmam_alloc_coherent(sw->dev, RX_POOL_ALLOC_SIZE, @@ -885,6 +892,7 @@ static int init_rings(struct sw *sw) /* Setup RX buffers */ memset(rx_ring->desc, 0, RX_POOL_ALLOC_SIZE); + for (i = 0; i < RX_DESCS; i++) { struct rx_desc *desc = &(rx_ring)->desc[i]; void *buf; @@ -894,13 +902,16 @@ static int init_rings(struct sw *sw) return -ENOMEM; desc->sdl = RX_SEGMENT_MRU; + if (i == (RX_DESCS - 1)) desc->eor = 1; + desc->fsd = 1; desc->lsd = 1; desc->sdp = dma_map_single(sw->dev, buf + SKB_HEAD_ALIGN, RX_SEGMENT_MRU, DMA_FROM_DEVICE); + if (dma_mapping_error(sw->dev, desc->sdp)) return -EIO; @@ -918,12 +929,14 @@ static int init_rings(struct sw *sw) /* Setup TX buffers */ memset(tx_ring->desc, 0, TX_POOL_ALLOC_SIZE); + for (i = 0; i < TX_DESCS; i++) { struct tx_desc *desc = &(tx_ring)->desc[i]; tx_ring->buff_tab[i] = 0; if (i == (TX_DESCS - 1)) desc->eor = 1; + desc->cown = 1; } __raw_writel(tx_ring->phys_addr, &sw->regs->ts_desc_ptr0); @@ -944,8 +957,7 @@ static void destroy_rings(struct sw *sw) if (!buf) continue; - dma_unmap_single(sw->dev, desc->sdp, RX_SEGMENT_MRU, - DMA_FROM_DEVICE); + dma_unmap_single(sw->dev, desc->sdp, RX_SEGMENT_MRU, DMA_FROM_DEVICE); skb_free_frag(buf); } diff --git a/target/linux/cns3xxx/patches-4.14/020-watchdog_support.patch b/target/linux/cns3xxx/patches-4.14/020-watchdog_support.patch index 6dd0ef0fe..df413c904 100644 --- a/target/linux/cns3xxx/patches-4.14/020-watchdog_support.patch +++ b/target/linux/cns3xxx/patches-4.14/020-watchdog_support.patch @@ -1,7 +1,6 @@ Add a watchdog driver for ARM MPcore processors. Signed-off-by: Felix Fietkau ---- --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -355,6 +355,13 @@ config KS8695_WATCHDOG @@ -118,7 +117,7 @@ Signed-off-by: Felix Fietkau + struct resource *res; + unsigned long rate = twd_timer_get_rate(); + -+ pr_info("MPCore WD init. clockrate: %u prescaler: %u countrate: %u timeout: %us\n", rate, 256, rate / 256, wdt_timeout); ++ pr_info("MPCore WD init. clockrate: %lu prescaler: %u countrate: %lu timeout: %us\n", rate, 256, rate / 256, wdt_timeout); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) diff --git a/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch index 45946e3d6..c0161e7a3 100644 --- a/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch +++ b/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch @@ -1,6 +1,6 @@ --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c -@@ -2305,7 +2305,8 @@ static void pcie_write_mrrs(struct pci_d +@@ -2309,7 +2309,8 @@ static void pcie_write_mrrs(struct pci_d /* In the "safe" case, do not configure the MRRS. There appear to be * issues with setting MRRS to 0 on a number of devices. */ diff --git a/target/linux/gemini/config-4.14 b/target/linux/gemini/config-4.14 index 7f093ae97..95e6b0c2c 100644 --- a/target/linux/gemini/config-4.14 +++ b/target/linux/gemini/config-4.14 @@ -130,7 +130,6 @@ CONFIG_DECOMPRESS_XZ=y CONFIG_DEFAULT_CFQ=y # CONFIG_DEFAULT_DEADLINE is not set CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_DEVMEM=y CONFIG_DMADEVICES=y CONFIG_DMATEST=y CONFIG_DMA_ENGINE=y diff --git a/target/linux/gemini/image/ImageInfo-sq201 b/target/linux/gemini/image/ImageInfo-sq201 new file mode 100644 index 000000000..86040ab47 --- /dev/null +++ b/target/linux/gemini/image/ImageInfo-sq201 @@ -0,0 +1,18 @@ +UpgradeImages="zImage rd.gz hddapp.tgz" +Procduction="SL3516" +BOOT_VER="1.0.5" +FIRMWARE_VER="firmware-openwrt-DATESTR" +INTERNAL_FIRMWARE_VER="firmware-openwrt-DATESTR" +CONFIGURATION_VER="firmware-openwrt" +DESCRIPTION="Square One Router/Nas" +TSS="enabled" +DIRECT_MODE="disabled" +DEFAULT_LAN_IPADDR="192.168.1.1" +DEFAULT_LAN_NETMASK="255.255.255.0" +DEFAULT_LAN_BOOTPROTO="none" +DEFAULT_WAN_BOOTPROTO="dhcp" +DEFAULT_WAN_ENABLED="yes" +DEFAULT_WLAN_DEVICENAME="eth0" +VER_zImage="DATESTR" +VER_Ramdisk="DATESTR" +VER_hddapp="DATESTR" diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile index 3e122fc45..a05b7111b 100644 --- a/target/linux/gemini/image/Makefile +++ b/target/linux/gemini/image/Makefile @@ -7,9 +7,17 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -# Just copy the zImage for D-Link DIR-685 +# Cook a "WRGG" image, this board is apparently one in the D-Link +# WRGG family and uses the exact same firmware format as other +# D-Link devices. define Build/dir685-images - cp $(IMAGE_KERNEL) $(BIN_DIR)/$(IMG_PREFIX)-dir685-zImage + mkwrggimg -i $(IMAGE_KERNEL) \ + -o $(BIN_DIR)/$(IMG_PREFIX)-dir685-fwupdate.bin \ + -d /dev/mtdblock/1 \ + -s wrgns01_dlwbr_dir685RBWW \ + -v 'N/A' \ + -m dir685 \ + -B 96bb endef # Build D-Link DNS-313 images using the special header tool. @@ -46,6 +54,21 @@ define Build/nas4220b-images rm -f $(BIN_DIR)/ImageInfo endef +# The Itian Square One SQ201 uses the same method. +define Build/sq201-images + dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync + dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1 + cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage + cp ./ImageInfo-sq201 $(BIN_DIR)/ImageInfo + sed -i -e "s/DATESTR/`date +%Y%m%d`/g" $(BIN_DIR)/ImageInfo + (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-sq201.tar.gz ImageInfo zImage rd.gz hddapp.tgz) + mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-sq201-rd.gz + mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-sq201-hddapp.tgz + mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-sq201-zImage + rm -f $(BIN_DIR)/ImageInfo +endef + + # WBD-111 and WBD-222: # work around the bootloader's bug with extra nops # FIXME: is this really needed now that we no longer append the code @@ -81,7 +104,8 @@ GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \ define Device/dlink-dir-685 DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \ - kmod-switch-rtl8366rb swconfig + kmod-switch-rtl8366rb swconfig \ + rt2800-pci IMAGES += dir685-image IMAGE/dir685-image := dir685-images endef @@ -111,7 +135,9 @@ TARGET_DEVICES += rut1xx define Device/sq201 DEVICE_TITLE := ITian Square One SQ201 - DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci-firmware + IMAGES += sq201-image + IMAGE/sq201-image := sq201-images + DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci endef TARGET_DEVICES += sq201 diff --git a/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch b/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch new file mode 100644 index 000000000..892b65fbc --- /dev/null +++ b/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch @@ -0,0 +1,140 @@ +From: Arnd Bergmann +Date: Tue, 19 Jun 2018 13:14:56 -0700 +Subject: [PATCH] kbuild: add macro for controlling warnings to + linux/compiler.h + +I have occasionally run into a situation where it would make sense to +control a compiler warning from a source file rather than doing so from +a Makefile using the $(cc-disable-warning, ...) or $(cc-option, ...) +helpers. + +The approach here is similar to what glibc uses, using __diag() and +related macros to encapsulate a _Pragma("GCC diagnostic ...") statement +that gets turned into the respective "#pragma GCC diagnostic ..." by +the preprocessor when the macro gets expanded. + +Like glibc, I also have an argument to pass the affected compiler +version, but decided to actually evaluate that one. For now, this +supports GCC_4_6, GCC_4_7, GCC_4_8, GCC_4_9, GCC_5, GCC_6, GCC_7, +GCC_8 and GCC_9. Adding support for CLANG_5 and other interesting +versions is straightforward here. GNU compilers starting with gcc-4.2 +could support it in principle, but "#pragma GCC diagnostic push" +was only added in gcc-4.6, so it seems simpler to not deal with those +at all. The same versions show a large number of warnings already, +so it seems easier to just leave it at that and not do a more +fine-grained control for them. + +The use cases I found so far include: + +- turning off the gcc-8 -Wattribute-alias warning inside of the + SYSCALL_DEFINEx() macro without having to do it globally. + +- Reducing the build time for a simple re-make after a change, + once we move the warnings from ./Makefile and + ./scripts/Makefile.extrawarn into linux/compiler.h + +- More control over the warnings based on other configurations, + using preprocessor syntax instead of Makefile syntax. This should make + it easier for the average developer to understand and change things. + +- Adding an easy way to turn the W=1 option on unconditionally + for a subdirectory or a specific file. This has been requested + by several developers in the past that want to have their subsystems + W=1 clean. + +- Integrating clang better into the build systems. Clang supports + more warnings than GCC, and we probably want to classify them + as default, W=1, W=2 etc, but there are cases in which the + warnings should be classified differently due to excessive false + positives from one or the other compiler. + +- Adding a way to turn the default warnings into errors (e.g. using + a new "make E=0" tag) while not also turning the W=1 warnings into + errors. + +This patch for now just adds the minimal infrastructure in order to +do the first of the list above. As the #pragma GCC diagnostic +takes precedence over command line options, the next step would be +to convert a lot of the individual Makefiles that set nonstandard +options to use __diag() instead. + +[paul.burton@mips.com: + - Rebase atop current master. + - Add __diag_GCC, or more generally __diag_, abstraction to + avoid code outside of linux/compiler-gcc.h needing to duplicate + knowledge about different GCC versions. + - Add a comment argument to __diag_{ignore,warn,error} which isn't + used in the expansion of the macros but serves to push people to + document the reason for using them - per feedback from Kees Cook. + - Translate severity to GCC-specific pragmas in linux/compiler-gcc.h + rather than using GCC-specific in linux/compiler_types.h. + - Drop all but GCC 8 macros, since we only need to define macros for + versions that we need to introduce pragmas for, and as of this + series that's just GCC 8. + - Capitalize comments in linux/compiler-gcc.h to match the style of + the rest of the file. + - Line up macro definitions with tabs in linux/compiler-gcc.h.] + +Signed-off-by: Arnd Bergmann +Signed-off-by: Paul Burton +Tested-by: Christophe Leroy +Tested-by: Stafford Horne +Signed-off-by: Masahiro Yamada +--- + +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -358,3 +358,28 @@ + * code + */ + #define uninitialized_var(x) x = x ++ ++/* ++ * Turn individual warnings and errors on and off locally, depending ++ * on version. ++ */ ++#define __diag_GCC(version, severity, s) \ ++ __diag_GCC_ ## version(__diag_GCC_ ## severity s) ++ ++/* Severity used in pragma directives */ ++#define __diag_GCC_ignore ignored ++#define __diag_GCC_warn warning ++#define __diag_GCC_error error ++ ++/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ ++#if GCC_VERSION >= 40600 ++#define __diag_str1(s) #s ++#define __diag_str(s) __diag_str1(s) ++#define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) ++#endif ++ ++#if GCC_VERSION >= 80000 ++#define __diag_GCC_8(s) __diag(s) ++#else ++#define __diag_GCC_8(s) ++#endif +--- a/include/linux/compiler_types.h ++++ b/include/linux/compiler_types.h +@@ -271,4 +271,22 @@ struct ftrace_likely_data { + # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) + #endif + ++#ifndef __diag ++#define __diag(string) ++#endif ++ ++#ifndef __diag_GCC ++#define __diag_GCC(version, severity, string) ++#endif ++ ++#define __diag_push() __diag(push) ++#define __diag_pop() __diag(pop) ++ ++#define __diag_ignore(compiler, version, option, comment) \ ++ __diag_ ## compiler(version, ignore, option) ++#define __diag_warn(compiler, version, option, comment) \ ++ __diag_ ## compiler(version, warn, option) ++#define __diag_error(compiler, version, option, comment) \ ++ __diag_ ## compiler(version, error, option) ++ + #endif /* __LINUX_COMPILER_TYPES_H */ diff --git a/target/linux/generic/backport-4.14/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch b/target/linux/generic/backport-4.14/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch new file mode 100644 index 000000000..2440ed8c0 --- /dev/null +++ b/target/linux/generic/backport-4.14/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch @@ -0,0 +1,88 @@ +From: Arnd Bergmann +Date: Tue, 19 Jun 2018 13:14:57 -0700 +Subject: [PATCH] disable -Wattribute-alias warning for SYSCALL_DEFINEx() + +gcc-8 warns for every single definition of a system call entry +point, e.g.: + +include/linux/compat.h:56:18: error: 'compat_sys_rt_sigprocmask' alias between functions of incompatible types 'long int(int, compat_sigset_t *, compat_sigset_t *, compat_size_t)' {aka 'long int(int, struct *, struct *, unsigned int)'} and 'long int(long int, long int, long int, long int)' [-Werror=attribute-alias] + asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ + ^~~~~~~~~~ +include/linux/compat.h:45:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx' + COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__) + ^~~~~~~~~~~~~~~~~~~~~~ +kernel/signal.c:2601:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4' + COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset, + ^~~~~~~~~~~~~~~~~~~~~~ +include/linux/compat.h:60:18: note: aliased declaration here + asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ + ^~~~~~~~~~ + +The new warning seems reasonable in principle, but it doesn't +help us here, since we rely on the type mismatch to sanitize the +system call arguments. After I reported this as GCC PR82435, a new +-Wno-attribute-alias option was added that could be used to turn the +warning off globally on the command line, but I'd prefer to do it a +little more fine-grained. + +Interestingly, turning a warning off and on again inside of +a single macro doesn't always work, in this case I had to add +an extra statement inbetween and decided to copy the __SC_TEST +one from the native syscall to the compat syscall macro. See +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83256 for more details +about this. + +[paul.burton@mips.com: + - Rebase atop current master. + - Split GCC & version arguments to __diag_ignore() in order to match + changes to the preceding patch. + - Add the comment argument to match the preceding patch.] + +Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435 +Signed-off-by: Arnd Bergmann +Signed-off-by: Paul Burton +Tested-by: Christophe Leroy +Tested-by: Stafford Horne +Signed-off-by: Masahiro Yamada +--- + +--- a/include/linux/compat.h ++++ b/include/linux/compat.h +@@ -48,6 +48,9 @@ + COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) + + #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ ++ __diag_push(); \ ++ __diag_ignore(GCC, 8, "-Wattribute-alias", \ ++ "Type aliasing is used to sanitize syscall arguments");\ + asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ + __attribute__((alias(__stringify(compat_SyS##name)))); \ + static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ +@@ -56,6 +59,7 @@ + { \ + return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ + } \ ++ __diag_pop(); \ + static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) + + #ifndef compat_user_stack_pointer +--- a/include/linux/syscalls.h ++++ b/include/linux/syscalls.h +@@ -208,6 +208,9 @@ static inline int is_syscall_trace_event + + #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) + #define __SYSCALL_DEFINEx(x, name, ...) \ ++ __diag_push(); \ ++ __diag_ignore(GCC, 8, "-Wattribute-alias", \ ++ "Type aliasing is used to sanitize syscall arguments");\ + asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ + __attribute__((alias(__stringify(SyS##name)))); \ + static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ +@@ -219,6 +222,7 @@ static inline int is_syscall_trace_event + __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ + return ret; \ + } \ ++ __diag_pop(); \ + static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) + + /* diff --git a/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch b/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch new file mode 100644 index 000000000..a17844f5e --- /dev/null +++ b/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch @@ -0,0 +1,109 @@ +From 531ef5ebea96394ddb7f554d4d88e017dde30a59 Mon Sep 17 00:00:00 2001 +From: Amelie Delaunay +Date: Tue, 13 Feb 2018 09:28:12 +0100 +Subject: [PATCH] usb: dwc2: add support for host mode external vbus supply + +This patch adds a way to enable an external vbus supply in host mode, +when dwc2 drvvbus signal is not used. + +This patch is very similar to the one done in U-Boot dwc2 driver [1]. It +also adds dynamic vbus supply management depending on the role and state +of the core. + +[1] https://lists.denx.de/pipermail/u-boot/2017-March/283434.html + +Signed-off-by: Amelie Delaunay +Signed-off-by: Felipe Balbi +--- + drivers/usb/dwc2/core.h | 2 ++ + drivers/usb/dwc2/hcd.c | 26 ++++++++++++++++++++++++++ + 2 files changed, 28 insertions(+) + +--- a/drivers/usb/dwc2/core.h ++++ b/drivers/usb/dwc2/core.h +@@ -777,6 +777,7 @@ struct dwc2_hregs_backup { + * @plat: The platform specific configuration data. This can be + * removed once all SoCs support usb transceiver. + * @supplies: Definition of USB power supplies ++ * @vbus_supply: Regulator supplying vbus. + * @phyif: PHY interface width + * @lock: Spinlock that protects all the driver data structures + * @priv: Stores a pointer to the struct usb_hcd +@@ -914,6 +915,7 @@ struct dwc2_hsotg { + struct usb_phy *uphy; + struct dwc2_hsotg_plat *plat; + struct regulator_bulk_data supplies[DWC2_NUM_SUPPLIES]; ++ struct regulator *vbus_supply; + u32 phyif; + + spinlock_t lock; +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -359,6 +359,23 @@ static void dwc2_gusbcfg_init(struct dwc + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); + } + ++static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) ++{ ++ hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); ++ if (IS_ERR(hsotg->vbus_supply)) ++ return 0; ++ ++ return regulator_enable(hsotg->vbus_supply); ++} ++ ++static int dwc2_vbus_supply_exit(struct dwc2_hsotg *hsotg) ++{ ++ if (hsotg->vbus_supply) ++ return regulator_disable(hsotg->vbus_supply); ++ ++ return 0; ++} ++ + /** + * dwc2_enable_host_interrupts() - Enables the Host mode interrupts + * +@@ -3342,6 +3359,7 @@ static void dwc2_conn_id_status_change(s + + /* B-Device connector (Device Mode) */ + if (gotgctl & GOTGCTL_CONID_B) { ++ dwc2_vbus_supply_exit(hsotg); + /* Wait for switch to device mode */ + dev_dbg(hsotg->dev, "connId B\n"); + if (hsotg->bus_suspended) { +@@ -4448,6 +4466,9 @@ static int _dwc2_hcd_start(struct usb_hc + } + + spin_unlock_irqrestore(&hsotg->lock, flags); ++ ++ dwc2_vbus_supply_init(hsotg); ++ + return 0; + } + +@@ -4475,6 +4496,8 @@ static void _dwc2_hcd_stop(struct usb_hc + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + spin_unlock_irqrestore(&hsotg->lock, flags); + ++ dwc2_vbus_supply_exit(hsotg); ++ + usleep_range(1000, 3000); + } + +@@ -4511,6 +4534,7 @@ static int _dwc2_hcd_suspend(struct usb_ + hprt0 |= HPRT0_SUSP; + hprt0 &= ~HPRT0_PWR; + dwc2_writel(hprt0, hsotg->regs + HPRT0); ++ dwc2_vbus_supply_exit(hsotg); + } + + /* Enter hibernation */ +@@ -4591,6 +4615,8 @@ static int _dwc2_hcd_resume(struct usb_h + spin_unlock_irqrestore(&hsotg->lock, flags); + dwc2_port_resume(hsotg); + } else { ++ dwc2_vbus_supply_init(hsotg); ++ + /* Wait for controller to correctly update D+/D- level */ + usleep_range(3000, 5000); + diff --git a/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch b/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch new file mode 100644 index 000000000..59ab805cf --- /dev/null +++ b/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch @@ -0,0 +1,55 @@ +From 438fea2a6325933868aebc20279e2669c9a21207 Mon Sep 17 00:00:00 2001 +From: Tomeu Vizoso +Date: Mon, 26 Mar 2018 11:00:01 +0200 +Subject: [PATCH] usb: dwc2: dwc2_vbus_supply_init: fix error check + +devm_regulator_get_optional returns -ENODEV if the regulator isn't +there, so if that's the case we have to make sure not to leave -ENODEV +in the regulator pointer. + +Also, make sure we return 0 in that case, but correctly propagate any +other errors. Also propagate the error from _dwc2_hcd_start. + +Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") +Cc: Amelie Delaunay +Reviewed-by: Amelie Delaunay +Reviewed-by: Heiko Stuebner +Reviewed-by: Grigor Tovmasyan +Tested-by: Heiko Stuebner +Acked-by: Minas Harutyunyan +Signed-off-by: Tomeu Vizoso +Signed-off-by: Felipe Balbi +--- + drivers/usb/dwc2/hcd.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -361,9 +361,14 @@ static void dwc2_gusbcfg_init(struct dwc + + static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) + { ++ int ret; ++ + hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); +- if (IS_ERR(hsotg->vbus_supply)) +- return 0; ++ if (IS_ERR(hsotg->vbus_supply)) { ++ ret = PTR_ERR(hsotg->vbus_supply); ++ hsotg->vbus_supply = NULL; ++ return ret == -ENODEV ? 0 : ret; ++ } + + return regulator_enable(hsotg->vbus_supply); + } +@@ -4467,9 +4472,7 @@ static int _dwc2_hcd_start(struct usb_hc + + spin_unlock_irqrestore(&hsotg->lock, flags); + +- dwc2_vbus_supply_init(hsotg); +- +- return 0; ++ return dwc2_vbus_supply_init(hsotg); + } + + /* diff --git a/target/linux/generic/backport-4.14/090-net-bridge-add-support-for-port-isolation.patch b/target/linux/generic/backport-4.14/090-net-bridge-add-support-for-port-isolation.patch new file mode 100644 index 000000000..6237177a4 --- /dev/null +++ b/target/linux/generic/backport-4.14/090-net-bridge-add-support-for-port-isolation.patch @@ -0,0 +1,145 @@ +From: Nikolay Aleksandrov +Date: Thu, 24 May 2018 11:56:48 +0300 +Subject: [PATCH] net: bridge: add support for port isolation + +This patch adds support for a new port flag - BR_ISOLATED. If it is set +then isolated ports cannot communicate between each other, but they can +still communicate with non-isolated ports. The same can be achieved via +ACLs but they can't scale with large number of ports and also the +complexity of the rules grows. This feature can be used to achieve +isolated vlan functionality (similar to pvlan) as well, though currently +it will be port-wide (for all vlans on the port). The new test in +should_deliver uses data that is already cache hot and the new boolean +is used to avoid an additional source port test in should_deliver. + +Signed-off-by: Nikolay Aleksandrov +Reviewed-by: Toshiaki Makita +Signed-off-by: David S. Miller +--- + +--- a/include/uapi/linux/if_link.h ++++ b/include/uapi/linux/if_link.h +@@ -326,6 +326,8 @@ enum { + IFLA_BRPORT_MCAST_TO_UCAST, + IFLA_BRPORT_VLAN_TUNNEL, + IFLA_BRPORT_BCAST_FLOOD, ++ IFLA_BRPORT_NEIGH_SUPPRESS, ++ IFLA_BRPORT_ISOLATED, + __IFLA_BRPORT_MAX + }; + #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) +--- a/net/bridge/br_forward.c ++++ b/net/bridge/br_forward.c +@@ -30,7 +30,8 @@ static inline int should_deliver(const s + vg = nbp_vlan_group_rcu(p); + return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) && + br_allowed_egress(vg, skb) && p->state == BR_STATE_FORWARDING && +- nbp_switchdev_allowed_egress(p, skb); ++ nbp_switchdev_allowed_egress(p, skb) && ++ !br_skb_isolated(p, skb); + } + + int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -170,6 +170,7 @@ int br_handle_frame_finish(struct net *n + goto drop; + + BR_INPUT_SKB_CB(skb)->brdev = br->dev; ++ BR_INPUT_SKB_CB(skb)->src_port_isolated = !!(p->flags & BR_ISOLATED); + + if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) + br_do_proxy_arp(skb, br, vid, p); +--- a/net/bridge/br_netlink.c ++++ b/net/bridge/br_netlink.c +@@ -138,6 +138,7 @@ static inline size_t br_port_info_size(v + + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */ + + nla_total_size(1) /* IFLA_BRPORT_PROXYARP_WIFI */ + + nla_total_size(1) /* IFLA_BRPORT_VLAN_TUNNEL */ ++ + nla_total_size(1) /* IFLA_BRPORT_ISOLATED */ + + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_ROOT_ID */ + + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_BRIDGE_ID */ + + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_PORT */ +@@ -208,7 +209,8 @@ static int br_port_fill_attrs(struct sk_ + p->topology_change_ack) || + nla_put_u8(skb, IFLA_BRPORT_CONFIG_PENDING, p->config_pending) || + nla_put_u8(skb, IFLA_BRPORT_VLAN_TUNNEL, !!(p->flags & +- BR_VLAN_TUNNEL))) ++ BR_VLAN_TUNNEL)) || ++ nla_put_u8(skb, IFLA_BRPORT_ISOLATED, !!(p->flags & BR_ISOLATED))) + return -EMSGSIZE; + + timerval = br_timer_value(&p->message_age_timer); +@@ -637,6 +639,7 @@ static const struct nla_policy br_port_p + [IFLA_BRPORT_MCAST_TO_UCAST] = { .type = NLA_U8 }, + [IFLA_BRPORT_MCAST_FLOOD] = { .type = NLA_U8 }, + [IFLA_BRPORT_BCAST_FLOOD] = { .type = NLA_U8 }, ++ [IFLA_BRPORT_ISOLATED] = { .type = NLA_U8 }, + }; + + /* Change the state of the port and notify spanning tree */ +@@ -773,6 +776,11 @@ static int br_setport(struct net_bridge_ + return err; + } + #endif ++ ++ err = br_set_port_flag(p, tb, IFLA_BRPORT_ISOLATED, BR_ISOLATED); ++ if (err) ++ return err; ++ + br_port_flags_change(p, old_flags ^ p->flags); + return 0; + } +--- a/net/bridge/br_private.h ++++ b/net/bridge/br_private.h +@@ -407,6 +407,7 @@ struct br_input_skb_cb { + #endif + + bool proxyarp_replied; ++ bool src_port_isolated; + + #ifdef CONFIG_BRIDGE_VLAN_FILTERING + bool vlan_filtered; +@@ -554,6 +555,14 @@ int br_forward_finish(struct net *net, s + void br_flood(struct net_bridge *br, struct sk_buff *skb, + enum br_pkt_type pkt_type, bool local_rcv, bool local_orig); + ++/* return true if both source port and dest port are isolated */ ++static inline bool br_skb_isolated(const struct net_bridge_port *to, ++ const struct sk_buff *skb) ++{ ++ return BR_INPUT_SKB_CB(skb)->src_port_isolated && ++ (to->flags & BR_ISOLATED); ++} ++ + /* br_if.c */ + void br_port_carrier_check(struct net_bridge_port *p); + int br_add_bridge(struct net *net, const char *name); +--- a/net/bridge/br_sysfs_if.c ++++ b/net/bridge/br_sysfs_if.c +@@ -174,6 +174,7 @@ BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); + BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); + BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); + BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD); ++BRPORT_ATTR_FLAG(isolated, BR_ISOLATED); + + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING + static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) +@@ -223,6 +224,7 @@ static const struct brport_attribute *br + &brport_attr_proxyarp_wifi, + &brport_attr_multicast_flood, + &brport_attr_broadcast_flood, ++ &brport_attr_isolated, + NULL + }; + +--- a/include/linux/if_bridge.h ++++ b/include/linux/if_bridge.h +@@ -49,6 +49,7 @@ struct br_ip_list { + #define BR_MULTICAST_TO_UNICAST BIT(12) + #define BR_VLAN_TUNNEL BIT(13) + #define BR_BCAST_FLOOD BIT(14) ++#define BR_ISOLATED BIT(16) + + #define BR_DEFAULT_AGEING_TIME (300 * HZ) + diff --git a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch index 874195558..2e8cb2016 100644 --- a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch +++ b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch @@ -15,7 +15,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -918,6 +918,8 @@ static inline struct sk_buff *ip6_finish +@@ -911,6 +911,8 @@ static inline struct sk_buff *ip6_finish &inet6_sk(sk)->cork); } diff --git a/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch b/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch index 320a90c11..47ba98c19 100644 --- a/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch +++ b/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch @@ -1280,8 +1280,8 @@ Signed-off-by: Pablo Neira Ayuso - family = ctx->afi->family; + family = ctx->family; - /* Re-use the existing target if it's already loaded. */ - list_for_each_entry(nft_target, &nft_target_list, head) { + if (strcmp(tg_name, XT_ERROR_TARGET) == 0 || + strcmp(tg_name, XT_STANDARD_TARGET) == 0 || --- a/net/netfilter/nft_ct.c +++ b/net/netfilter/nft_ct.c @@ -405,7 +405,7 @@ static int nft_ct_get_init(const struct diff --git a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch index 9ed9ca558..f90f41523 100644 --- a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch +++ b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau #endif --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -918,8 +918,6 @@ static inline struct sk_buff *ip6_finish +@@ -911,8 +911,6 @@ static inline struct sk_buff *ip6_finish &inet6_sk(sk)->cork); } diff --git a/target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch b/target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch new file mode 100644 index 000000000..ccc723275 --- /dev/null +++ b/target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch @@ -0,0 +1,141 @@ +From: Arnd Bergmann +Date: Tue, 19 Jun 2018 13:14:56 -0700 +Subject: [PATCH] kbuild: add macro for controlling warnings to + linux/compiler.h + +I have occasionally run into a situation where it would make sense to +control a compiler warning from a source file rather than doing so from +a Makefile using the $(cc-disable-warning, ...) or $(cc-option, ...) +helpers. + +The approach here is similar to what glibc uses, using __diag() and +related macros to encapsulate a _Pragma("GCC diagnostic ...") statement +that gets turned into the respective "#pragma GCC diagnostic ..." by +the preprocessor when the macro gets expanded. + +Like glibc, I also have an argument to pass the affected compiler +version, but decided to actually evaluate that one. For now, this +supports GCC_4_6, GCC_4_7, GCC_4_8, GCC_4_9, GCC_5, GCC_6, GCC_7, +GCC_8 and GCC_9. Adding support for CLANG_5 and other interesting +versions is straightforward here. GNU compilers starting with gcc-4.2 +could support it in principle, but "#pragma GCC diagnostic push" +was only added in gcc-4.6, so it seems simpler to not deal with those +at all. The same versions show a large number of warnings already, +so it seems easier to just leave it at that and not do a more +fine-grained control for them. + +The use cases I found so far include: + +- turning off the gcc-8 -Wattribute-alias warning inside of the + SYSCALL_DEFINEx() macro without having to do it globally. + +- Reducing the build time for a simple re-make after a change, + once we move the warnings from ./Makefile and + ./scripts/Makefile.extrawarn into linux/compiler.h + +- More control over the warnings based on other configurations, + using preprocessor syntax instead of Makefile syntax. This should make + it easier for the average developer to understand and change things. + +- Adding an easy way to turn the W=1 option on unconditionally + for a subdirectory or a specific file. This has been requested + by several developers in the past that want to have their subsystems + W=1 clean. + +- Integrating clang better into the build systems. Clang supports + more warnings than GCC, and we probably want to classify them + as default, W=1, W=2 etc, but there are cases in which the + warnings should be classified differently due to excessive false + positives from one or the other compiler. + +- Adding a way to turn the default warnings into errors (e.g. using + a new "make E=0" tag) while not also turning the W=1 warnings into + errors. + +This patch for now just adds the minimal infrastructure in order to +do the first of the list above. As the #pragma GCC diagnostic +takes precedence over command line options, the next step would be +to convert a lot of the individual Makefiles that set nonstandard +options to use __diag() instead. + +[paul.burton@mips.com: + - Rebase atop current master. + - Add __diag_GCC, or more generally __diag_, abstraction to + avoid code outside of linux/compiler-gcc.h needing to duplicate + knowledge about different GCC versions. + - Add a comment argument to __diag_{ignore,warn,error} which isn't + used in the expansion of the macros but serves to push people to + document the reason for using them - per feedback from Kees Cook. + - Translate severity to GCC-specific pragmas in linux/compiler-gcc.h + rather than using GCC-specific in linux/compiler_types.h. + - Drop all but GCC 8 macros, since we only need to define macros for + versions that we need to introduce pragmas for, and as of this + series that's just GCC 8. + - Capitalize comments in linux/compiler-gcc.h to match the style of + the rest of the file. + - Line up macro definitions with tabs in linux/compiler-gcc.h.] + +Signed-off-by: Arnd Bergmann +Signed-off-by: Paul Burton +Tested-by: Christophe Leroy +Tested-by: Stafford Horne +Signed-off-by: Masahiro Yamada +--- + +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -334,3 +334,28 @@ + * code + */ + #define uninitialized_var(x) x = x ++ ++/* ++ * Turn individual warnings and errors on and off locally, depending ++ * on version. ++ */ ++#define __diag_GCC(version, severity, s) \ ++ __diag_GCC_ ## version(__diag_GCC_ ## severity s) ++ ++/* Severity used in pragma directives */ ++#define __diag_GCC_ignore ignored ++#define __diag_GCC_warn warning ++#define __diag_GCC_error error ++ ++/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ ++#if GCC_VERSION >= 40600 ++#define __diag_str1(s) #s ++#define __diag_str(s) __diag_str1(s) ++#define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) ++#endif ++ ++#if GCC_VERSION >= 80000 ++#define __diag_GCC_8(s) __diag(s) ++#else ++#define __diag_GCC_8(s) ++#endif +--- a/include/linux/compiler.h ++++ b/include/linux/compiler.h +@@ -578,4 +578,23 @@ static __always_inline void __write_once + # define __kprobes + # define nokprobe_inline inline + #endif ++ ++#ifndef __diag ++#define __diag(string) ++#endif ++ ++#ifndef __diag_GCC ++#define __diag_GCC(version, severity, string) ++#endif ++ ++#define __diag_push() __diag(push) ++#define __diag_pop() __diag(pop) ++ ++#define __diag_ignore(compiler, version, option, comment) \ ++ __diag_ ## compiler(version, ignore, option) ++#define __diag_warn(compiler, version, option, comment) \ ++ __diag_ ## compiler(version, warn, option) ++#define __diag_error(compiler, version, option, comment) \ ++ __diag_ ## compiler(version, error, option) ++ + #endif /* __LINUX_COMPILER_H */ diff --git a/target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch b/target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch new file mode 100644 index 000000000..fc2a26d7c --- /dev/null +++ b/target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch @@ -0,0 +1,88 @@ +From: Arnd Bergmann +Date: Tue, 19 Jun 2018 13:14:57 -0700 +Subject: [PATCH] disable -Wattribute-alias warning for SYSCALL_DEFINEx() + +gcc-8 warns for every single definition of a system call entry +point, e.g.: + +include/linux/compat.h:56:18: error: 'compat_sys_rt_sigprocmask' alias between functions of incompatible types 'long int(int, compat_sigset_t *, compat_sigset_t *, compat_size_t)' {aka 'long int(int, struct *, struct *, unsigned int)'} and 'long int(long int, long int, long int, long int)' [-Werror=attribute-alias] + asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ + ^~~~~~~~~~ +include/linux/compat.h:45:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx' + COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__) + ^~~~~~~~~~~~~~~~~~~~~~ +kernel/signal.c:2601:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4' + COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset, + ^~~~~~~~~~~~~~~~~~~~~~ +include/linux/compat.h:60:18: note: aliased declaration here + asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ + ^~~~~~~~~~ + +The new warning seems reasonable in principle, but it doesn't +help us here, since we rely on the type mismatch to sanitize the +system call arguments. After I reported this as GCC PR82435, a new +-Wno-attribute-alias option was added that could be used to turn the +warning off globally on the command line, but I'd prefer to do it a +little more fine-grained. + +Interestingly, turning a warning off and on again inside of +a single macro doesn't always work, in this case I had to add +an extra statement inbetween and decided to copy the __SC_TEST +one from the native syscall to the compat syscall macro. See +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83256 for more details +about this. + +[paul.burton@mips.com: + - Rebase atop current master. + - Split GCC & version arguments to __diag_ignore() in order to match + changes to the preceding patch. + - Add the comment argument to match the preceding patch.] + +Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435 +Signed-off-by: Arnd Bergmann +Signed-off-by: Paul Burton +Tested-by: Christophe Leroy +Tested-by: Stafford Horne +Signed-off-by: Masahiro Yamada +--- + +--- a/include/linux/compat.h ++++ b/include/linux/compat.h +@@ -47,6 +47,9 @@ + COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) + + #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ ++ __diag_push(); \ ++ __diag_ignore(GCC, 8, "-Wattribute-alias", \ ++ "Type aliasing is used to sanitize syscall arguments");\ + asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ + __attribute__((alias(__stringify(compat_SyS##name)))); \ + static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ +@@ -55,6 +58,7 @@ + { \ + return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ + } \ ++ __diag_pop(); \ + static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) + + #ifndef compat_user_stack_pointer +--- a/include/linux/syscalls.h ++++ b/include/linux/syscalls.h +@@ -192,6 +192,9 @@ extern struct trace_event_functions exit + + #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) + #define __SYSCALL_DEFINEx(x, name, ...) \ ++ __diag_push(); \ ++ __diag_ignore(GCC, 8, "-Wattribute-alias", \ ++ "Type aliasing is used to sanitize syscall arguments");\ + asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ + __attribute__((alias(__stringify(SyS##name)))); \ + static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ +@@ -203,6 +206,7 @@ extern struct trace_event_functions exit + __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ + return ret; \ + } \ ++ __diag_pop(); \ + static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) + + asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special, diff --git a/target/linux/generic/backport-4.9/014-Kbuild-suppress-packed-not-aligned-warning-for-defau.patch b/target/linux/generic/backport-4.9/014-Kbuild-suppress-packed-not-aligned-warning-for-defau.patch new file mode 100644 index 000000000..a6e312a09 --- /dev/null +++ b/target/linux/generic/backport-4.9/014-Kbuild-suppress-packed-not-aligned-warning-for-defau.patch @@ -0,0 +1,45 @@ +From: Xiongfeng Wang +Date: Thu, 11 Jan 2018 17:22:29 +0800 +Subject: [PATCH] Kbuild: suppress packed-not-aligned warning for default + setting only + +gcc-8 reports many -Wpacked-not-aligned warnings. The below are some +examples. + +./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct +ceph_entity_addr' is less than 8 [-Wpacked-not-aligned] + } __attribute__ ((packed)); + +./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct +ceph_entity_addr' is less than 8 [-Wpacked-not-aligned] + } __attribute__ ((packed)); + +./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct +ceph_entity_addr' is less than 8 [-Wpacked-not-aligned] + } __attribute__ ((packed)); + +This patch suppresses this kind of warnings for default setting. + +Signed-off-by: Xiongfeng Wang +Signed-off-by: Masahiro Yamada +--- + +--- a/scripts/Makefile.extrawarn ++++ b/scripts/Makefile.extrawarn +@@ -10,6 +10,8 @@ + # are not supported by all versions of the compiler + # ========================================================================== + ++KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) ++ + ifeq ("$(origin W)", "command line") + export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) + endif +@@ -25,6 +27,7 @@ warning-1 += -Wold-style-definition + warning-1 += $(call cc-option, -Wmissing-include-dirs) + warning-1 += $(call cc-option, -Wunused-but-set-variable) + warning-1 += $(call cc-option, -Wunused-const-variable) ++warning-1 += $(call cc-option, -Wpacked-not-aligned) + warning-1 += $(call cc-disable-warning, missing-field-initializers) + warning-1 += $(call cc-disable-warning, sign-compare) + diff --git a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch index 0a5b9ead9..4a3f355b4 100644 --- a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch +++ b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch @@ -134,7 +134,7 @@ Signed-off-by: David S. Miller if (tcp_small_queue_check(sk, skb, 0)) break; -@@ -3546,8 +3546,6 @@ void __tcp_send_ack(struct sock *sk, u32 +@@ -3542,8 +3542,6 @@ void __tcp_send_ack(struct sock *sk, u32 /* We do not want pure acks influencing TCP Small Queues or fq/pacing * too much. * SKB_TRUESIZE(max(1 .. 66, MAX_TCP_HEADER)) is unfortunately ~784 diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch index 4a5a89013..127707827 100644 --- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch +++ b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch @@ -388,7 +388,7 @@ Signed-off-by: David S. Miller BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -@@ -3230,7 +3230,7 @@ static int bnx2x_poll(struct napi_struct +@@ -3236,7 +3236,7 @@ static int bnx2x_poll(struct napi_struct * has been updated when NAPI was scheduled. */ if (IS_FCOE_FP(fp)) { diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 new file mode 100644 index 000000000..4a4495272 --- /dev/null +++ b/target/linux/generic/config-3.18 @@ -0,0 +1,4656 @@ +CONFIG_32BIT=y +# CONFIG_6LOWPAN is not set +# CONFIG_6PACK is not set +# CONFIG_8139CP is not set +# CONFIG_8139TOO is not set +# CONFIG_9P_FS is not set +# CONFIG_AB3100_CORE is not set +# CONFIG_AB8500_CORE is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_ACENIC is not set +# CONFIG_ACERHDF is not set +# CONFIG_ACORN_PARTITION is not set +# CONFIG_ACPI_APEI is not set +# CONFIG_ACPI_BUTTON is not set +# CONFIG_ACPI_CUSTOM_METHOD is not set +# CONFIG_ACPI_EXTLOG is not set +# CONFIG_ACPI_HED is not set +# CONFIG_ACPI_INT3403_THERMAL is not set +# CONFIG_ACPI_POWER_METER is not set +# CONFIG_ACPI_QUICKSTART is not set +# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set +# CONFIG_AD2S90 is not set +# CONFIG_AD5064 is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD5930 is not set +# CONFIG_AD5933 is not set +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7266 is not set +# CONFIG_AD7280 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7303 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7606 is not set +# CONFIG_AD7746 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_AD8366 is not set +# CONFIG_AD9523 is not set +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set +# CONFIG_AD9850 is not set +# CONFIG_AD9852 is not set +# CONFIG_AD9910 is not set +# CONFIG_AD9951 is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set +# CONFIG_ADF4350 is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADIS16060 is not set +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16204 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16220 is not set +# CONFIG_ADIS16240 is not set +# CONFIG_ADIS16255 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_ADJD_S311 is not set +# CONFIG_ADM6996_PHY is not set +# CONFIG_ADM8211 is not set +# CONFIG_ADT7316 is not set +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_ADXRS450 is not set +CONFIG_AEABI=y +# CONFIG_AFFS_FS is not set +# CONFIG_AFS_FS is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AGP is not set +# CONFIG_AHCI_MVEBU is not set +CONFIG_AIO=y +# CONFIG_AIRO is not set +# CONFIG_AIRO_CS is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_AK09911 is not set +# CONFIG_AK8975 is not set +# CONFIG_AL3320A is not set +# CONFIG_ALCHEMY_GPIO_INDIRECT is not set +# CONFIG_ALIM7101_WDT is not set +CONFIG_ALLOW_DEV_COREDUMP=y +# CONFIG_ALTERA_STAPL is not set +# CONFIG_ALTERA_TSE is not set +# CONFIG_ALX is not set +# CONFIG_AM335X_PHY_USB is not set +# CONFIG_AMD8111_ETH is not set +# CONFIG_AMD_PHY is not set +# CONFIG_AMD_XGBE is not set +# CONFIG_AMD_XGBE_PHY is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_AMILO_RFKILL is not set +# CONFIG_ANDROID is not set +CONFIG_ANON_INODES=y +# CONFIG_APDS9300 is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_APM8018X is not set +# CONFIG_APPLICOM is not set +# CONFIG_AR5523 is not set +# CONFIG_AR7 is not set +# CONFIG_AR8216_PHY is not set +# CONFIG_AR8216_PHY_LEDS is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BCM2835 is not set +# CONFIG_ARCH_BCMRING is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_CNS3XXX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_EXYNOS is not set +CONFIG_ARCH_FLATMEM_ENABLE=y +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_H720X is not set +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +# CONFIG_ARCH_HI3xxx is not set +# CONFIG_ARCH_HIGHBANK is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP2000 is not set +# CONFIG_ARCH_IXP23XX is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_KEYSTONE is not set +# CONFIG_ARCH_KIRKWOOD is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_MEDIATEK is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_MSM is not set +# CONFIG_ARCH_MSM_DT is not set +# CONFIG_ARCH_MSM_NODT is not set +# CONFIG_ARCH_MULTIPLATFORM is not set +# CONFIG_ARCH_MULTI_V6 is not set +# CONFIG_ARCH_MULTI_V7 is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_MXS is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_NOMADIK is not set +# CONFIG_ARCH_NSPIRE is not set +# CONFIG_ARCH_NUC93X is not set +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_OMAP1 is not set +# CONFIG_ARCH_OMAP2PLUS is not set +# CONFIG_ARCH_OMAP3 is not set +# CONFIG_ARCH_OMAP4 is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +# CONFIG_ARCH_PICOXCELL is not set +# CONFIG_ARCH_PNX4008 is not set +# CONFIG_ARCH_PRIMA2 is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_QCOM is not set +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_ROCKCHIP is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_S5P64X0 is not set +# CONFIG_ARCH_S5PC100 is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_SHARK is not set +# CONFIG_ARCH_SHMOBILE is not set +# CONFIG_ARCH_SHMOBILE_LEGACY is not set +# CONFIG_ARCH_SHMOBILE_MULTI is not set +# CONFIG_ARCH_SIRF is not set +# CONFIG_ARCH_SOCFPGA is not set +# CONFIG_ARCH_STI is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +# CONFIG_ARCH_TCC_926 is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_U300 is not set +# CONFIG_ARCH_U8500 is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_VIRT is not set +# CONFIG_ARCH_VT8500 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_WM8505 is not set +# CONFIG_ARCH_WM8850 is not set +# CONFIG_ARCH_ZYNQ is not set +# CONFIG_ARCNET is not set +# CONFIG_ARC_EMAC is not set +# CONFIG_ARM_APPENDED_DTB is not set +# CONFIG_ARM_ARCH_TIMER is not set +# CONFIG_ARM_AT91_ETHER is not set +# CONFIG_ARM_CCI is not set +# CONFIG_ARM_CCN is not set +CONFIG_ARM_CPU_TOPOLOGY=y +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +# CONFIG_ARM_ERRATA_326103 is not set +# CONFIG_ARM_ERRATA_364296 is not set +# CONFIG_ARM_ERRATA_411920 is not set +# CONFIG_ARM_ERRATA_430973 is not set +# CONFIG_ARM_ERRATA_458693 is not set +# CONFIG_ARM_ERRATA_460075 is not set +# CONFIG_ARM_ERRATA_643719 is not set +# CONFIG_ARM_ERRATA_720789 is not set +# CONFIG_ARM_ERRATA_742230 is not set +# CONFIG_ARM_ERRATA_742231 is not set +# CONFIG_ARM_ERRATA_743622 is not set +# CONFIG_ARM_ERRATA_751472 is not set +# CONFIG_ARM_ERRATA_754322 is not set +# CONFIG_ARM_ERRATA_754327 is not set +# CONFIG_ARM_ERRATA_764369 is not set +# CONFIG_ARM_ERRATA_773022 is not set +# CONFIG_ARM_ERRATA_775420 is not set +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_KPROBES_TEST is not set +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +# CONFIG_ARM_PSCI is not set +# CONFIG_ARM_PTDUMP is not set +# CONFIG_ARM_UNWIND is not set +# CONFIG_ARM_VIRT_EXT is not set +CONFIG_ARPD=y +# CONFIG_ARTHUR is not set +# CONFIG_AS3935 is not set +# CONFIG_ASUS_OLED is not set +# CONFIG_ASYMMETRIC_KEY_TYPE is not set +# CONFIG_ASYNC_RAID6_TEST is not set +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_AT76C50X_USB is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_ATA is not set +# CONFIG_ATAGS is not set +CONFIG_ATAGS_PROC=y +# CONFIG_ATALK is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_ATA_ACPI is not set +CONFIG_ATA_BMDMA=y +# CONFIG_ATA_GENERIC is not set +# CONFIG_ATA_NONSTANDARD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_ATA_PIIX is not set +CONFIG_ATA_SFF=y +# CONFIG_ATA_VERBOSE_ERROR is not set +# CONFIG_ATH10K is not set +# CONFIG_ATH5K is not set +# CONFIG_ATH6KL is not set +# CONFIG_ATH6K_LEGACY is not set +# CONFIG_ATH79 is not set +# CONFIG_ATH9K is not set +# CONFIG_ATH9K_HTC is not set +# CONFIG_ATH_CARDS is not set +# CONFIG_ATH_DEBUG is not set +# CONFIG_ATL1 is not set +# CONFIG_ATL1C is not set +# CONFIG_ATL1E is not set +# CONFIG_ATL2 is not set +# CONFIG_ATM is not set +# CONFIG_ATMEL is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_ATMEL_PWM is not set +# CONFIG_ATMEL_SSC is not set +# CONFIG_ATM_AMBASSADOR is not set +# CONFIG_ATM_BR2684 is not set +CONFIG_ATM_BR2684_IPFILTER=y +# CONFIG_ATM_CLIP is not set +CONFIG_ATM_CLIP_NO_ICMP=y +# CONFIG_ATM_DRIVERS is not set +# CONFIG_ATM_DUMMY is not set +# CONFIG_ATM_ENI is not set +# CONFIG_ATM_FIRESTREAM is not set +# CONFIG_ATM_FORE200E is not set +# CONFIG_ATM_HE is not set +# CONFIG_ATM_HORIZON is not set +# CONFIG_ATM_IA is not set +# CONFIG_ATM_IDT77252 is not set +# CONFIG_ATM_LANAI is not set +# CONFIG_ATM_LANE is not set +# CONFIG_ATM_MPOA is not set +# CONFIG_ATM_NICSTAR is not set +# CONFIG_ATM_SOLOS is not set +# CONFIG_ATM_TCP is not set +# CONFIG_ATM_ZATM is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_ATP is not set +# CONFIG_AUDIT is not set +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_AUDIT_LOGINUID_IMMUTABLE is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_AUTO_ZRELADDR is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_AVERAGE is not set +# CONFIG_AX25 is not set +# CONFIG_AX25_DAMA_SLAVE is not set +# CONFIG_AX88796 is not set +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +# CONFIG_B44 is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +# CONFIG_BACKLIGHT_LM3630 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_PANDORA is not set +# CONFIG_BACKLIGHT_SAHARA is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 +# CONFIG_BATMAN_ADV is not set +# CONFIG_BATTERY_BQ27x00 is not set +# CONFIG_BATTERY_DS2760 is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_GOLDFISH is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BAYCOM_EPP is not set +# CONFIG_BAYCOM_PAR is not set +# CONFIG_BAYCOM_SER_FDX is not set +# CONFIG_BAYCOM_SER_HDX is not set +# CONFIG_BCACHE is not set +# CONFIG_BCM47XX is not set +# CONFIG_BCM63XX is not set +# CONFIG_BCM63XX_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_BCMA is not set +# CONFIG_BCMA_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y +# CONFIG_BCMGENET is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_BCM_WIMAX is not set +# CONFIG_BDI_SWITCH is not set +# CONFIG_BE2ISCSI is not set +# CONFIG_BE2NET is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_BGMAC is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_BIG_LITTLE is not set +# CONFIG_BINARY_PRINTF is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set +CONFIG_BINFMT_SCRIPT=y +CONFIG_BITREVERSE=y +# CONFIG_BLK_CMDLINE_PARSER is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_CPQ_DA is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_BLK_DEV_4DRIVES is not set +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_BLK_DEV_ALI14XX is not set +# CONFIG_BLK_DEV_ALI15X3 is not set +# CONFIG_BLK_DEV_AMD74XX is not set +# CONFIG_BLK_DEV_ATIIXP is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_BSGLIB is not set +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_CMD64X is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_CS5520 is not set +# CONFIG_BLK_DEV_CS5530 is not set +# CONFIG_BLK_DEV_CS5535 is not set +# CONFIG_BLK_DEV_CS5536 is not set +# CONFIG_BLK_DEV_CY82C693 is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_DELKIN is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_DTC2278 is not set +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_GENERIC is not set +# CONFIG_BLK_DEV_HD is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_HT6560B is not set +# CONFIG_BLK_DEV_IDEACPI is not set +# CONFIG_BLK_DEV_IDECD is not set +# CONFIG_BLK_DEV_IDECS is not set +# CONFIG_BLK_DEV_IDEPCI is not set +# CONFIG_BLK_DEV_IDEPNP is not set +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDE_AU1XXX is not set +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_INITRD=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_BLK_DEV_IT8172 is not set +# CONFIG_BLK_DEV_IT8213 is not set +# CONFIG_BLK_DEV_IT821X is not set +# CONFIG_BLK_DEV_JMICRON is not set +# CONFIG_BLK_DEV_LOOP is not set +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_NS87415 is not set +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_NVME is not set +# CONFIG_BLK_DEV_OFFBOARD is not set +# CONFIG_BLK_DEV_OPTI621 is not set +# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set +# CONFIG_BLK_DEV_PDC202XX_NEW is not set +# CONFIG_BLK_DEV_PDC202XX_OLD is not set +# CONFIG_BLK_DEV_PIIX is not set +# CONFIG_BLK_DEV_PLATFORM is not set +# CONFIG_BLK_DEV_QD65XX is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_BLK_DEV_RBD is not set +# CONFIG_BLK_DEV_RSXX is not set +# CONFIG_BLK_DEV_RZ1000 is not set +# CONFIG_BLK_DEV_SC1200 is not set +# CONFIG_BLK_DEV_SD is not set +# CONFIG_BLK_DEV_SIIMAGE is not set +# CONFIG_BLK_DEV_SIS5513 is not set +# CONFIG_BLK_DEV_SKD is not set +# CONFIG_BLK_DEV_SL82C105 is not set +# CONFIG_BLK_DEV_SLC90E66 is not set +# CONFIG_BLK_DEV_SR is not set +# CONFIG_BLK_DEV_SVWKS is not set +# CONFIG_BLK_DEV_SX8 is not set +# CONFIG_BLK_DEV_TC86C001 is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_DEV_TRIFLEX is not set +# CONFIG_BLK_DEV_TRM290 is not set +# CONFIG_BLK_DEV_UB is not set +# CONFIG_BLK_DEV_UMC8672 is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_BLK_DEV_XIP is not set +CONFIG_BLOCK=y +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_BMG160 is not set +# CONFIG_BMP085 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_BNA is not set +# CONFIG_BNX2 is not set +# CONFIG_BNX2X is not set +# CONFIG_BONDING is not set +# CONFIG_BOOKE_WDT is not set +CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT=3 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_BOOT_RAW=y +# CONFIG_BPCTL is not set +CONFIG_BPF=y +# CONFIG_BPF_JIT is not set +CONFIG_BPF_SYSCALL=y +# CONFIG_BPQETHER is not set +CONFIG_BQL=y +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_BRCMFMAC is not set +# CONFIG_BRCMSMAC is not set +# CONFIG_BRCMSTB_GISB_ARB is not set +CONFIG_BRIDGE=y +# CONFIG_BRIDGE_EBT_802_3 is not set +# CONFIG_BRIDGE_EBT_AMONG is not set +# CONFIG_BRIDGE_EBT_ARP is not set +# CONFIG_BRIDGE_EBT_ARPREPLY is not set +# CONFIG_BRIDGE_EBT_BROUTE is not set +# CONFIG_BRIDGE_EBT_DNAT is not set +# CONFIG_BRIDGE_EBT_IP is not set +# CONFIG_BRIDGE_EBT_IP6 is not set +# CONFIG_BRIDGE_EBT_LIMIT is not set +# CONFIG_BRIDGE_EBT_LOG is not set +# CONFIG_BRIDGE_EBT_MARK is not set +# CONFIG_BRIDGE_EBT_MARK_T is not set +# CONFIG_BRIDGE_EBT_NFLOG is not set +# CONFIG_BRIDGE_EBT_PKTTYPE is not set +# CONFIG_BRIDGE_EBT_REDIRECT is not set +# CONFIG_BRIDGE_EBT_SNAT is not set +# CONFIG_BRIDGE_EBT_STP is not set +# CONFIG_BRIDGE_EBT_T_FILTER is not set +# CONFIG_BRIDGE_EBT_T_NAT is not set +# CONFIG_BRIDGE_EBT_ULOG is not set +# CONFIG_BRIDGE_EBT_VLAN is not set +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_NETFILTER is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_BRIDGE_VLAN_FILTERING is not set +# CONFIG_BROADCOM_PHY is not set +CONFIG_BROKEN_ON_SMP=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +# CONFIG_BT is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_FS is not set +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BT_ATH3K is not set +# CONFIG_BT_BNEP is not set +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +# CONFIG_BT_CMTP is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBFUSB is not set +# CONFIG_BT_HCIBLUECARD is not set +# CONFIG_BT_HCIBPA10X is not set +# CONFIG_BT_HCIBT3C is not set +# CONFIG_BT_HCIBTSDIO is not set +# CONFIG_BT_HCIBTUART is not set +# CONFIG_BT_HCIBTUSB is not set +# CONFIG_BT_HCIDTL1 is not set +# CONFIG_BT_HCIUART is not set +# CONFIG_BT_HCIUART_3WIRE is not set +# CONFIG_BT_HCIUART_ATH3K is not set +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_LL is not set +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_HIDP is not set +CONFIG_BT_L2CAP=y +# CONFIG_BT_MRVL is not set +# CONFIG_BT_RFCOMM is not set +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_SCO=y +CONFIG_BUG=y +CONFIG_BUILDTIME_EXTABLE_SORT=y +# CONFIG_BUILD_BIN2C is not set +# CONFIG_C2PORT is not set +# CONFIG_CADENCE_WATCHDOG is not set +# CONFIG_CAIF is not set +# CONFIG_CAN is not set +# CONFIG_CAN_GS_USB is not set +# CONFIG_CAN_M_CAN is not set +# CONFIG_CAN_RCAR is not set +# CONFIG_CAPI_AVM is not set +# CONFIG_CAPI_EICON is not set +# CONFIG_CAPI_TRACE is not set +CONFIG_CARDBUS=y +# CONFIG_CARDMAN_4000 is not set +# CONFIG_CARDMAN_4040 is not set +# CONFIG_CARL9170 is not set +# CONFIG_CARMA_FPGA is not set +# CONFIG_CARMA_FPGA_PROGRAM is not set +# CONFIG_CASSINI is not set +CONFIG_CAVIUM_OCTEON_HELPER=y +# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set +# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set +# CONFIG_CAVIUM_OCTEON_SOC is not set +# CONFIG_CB710_CORE is not set +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_CED1401 is not set +# CONFIG_CEPH_FS is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_CFG80211 is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +# CONFIG_CFG80211_DEBUGFS is not set +# CONFIG_CFG80211_DEFAULT_PS is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_INTERNAL_REGDB is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_WEXT is not set +# CONFIG_CGROUPS is not set +# CONFIG_CGROUP_DEBUG is not set +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_CHARGER_TWL4030 is not set +# CONFIG_CHECKPOINT_RESTORE is not set +# CONFIG_CHELSIO_T1 is not set +# CONFIG_CHELSIO_T3 is not set +# CONFIG_CHELSIO_T4 is not set +# CONFIG_CHELSIO_T4VF is not set +# CONFIG_CHROME_PLATFORMS is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_CIFS is not set +# CONFIG_CIFS_ACL is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DEBUG2 is not set +# CONFIG_CIFS_FSCACHE is not set +# CONFIG_CIFS_NFSD_EXPORT is not set +CONFIG_CIFS_POSIX=y +# CONFIG_CIFS_SMB2 is not set +CONFIG_CIFS_STATS=y +# CONFIG_CIFS_STATS2 is not set +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CLEANCACHE is not set +# CONFIG_CLKSRC_VERSATILE is not set +CONFIG_CLS_U32_MARK=y +# CONFIG_CLS_U32_PERF is not set +# CONFIG_CM32181 is not set +# CONFIG_CM36651 is not set +# CONFIG_CMA is not set +CONFIG_CMDLINE="" +# CONFIG_CMDLINE_BOOL is not set +# CONFIG_CMDLINE_EXTEND is not set +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +# CONFIG_CMDLINE_PARTITION is not set +# CONFIG_CNIC is not set +# CONFIG_CODA_FS is not set +# CONFIG_CODE_PATCHING_SELFTEST is not set +# CONFIG_COMEDI is not set +# CONFIG_COMMON_CLK_DEBUG is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_QCOM is not set +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMPACTION is not set +# CONFIG_COMPAL_LAPTOP is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_COMPILE_TEST is not set +# CONFIG_CONFIGFS_FS is not set +# CONFIG_CONNECTOR is not set +CONFIG_CONSTRUCTORS=y +# CONFIG_CONTEXT_SWITCH_TRACER is not set +# CONFIG_COPS is not set +# CONFIG_CORDIC is not set +# CONFIG_COREDUMP is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_CPA_DEBUG is not set +# CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_IDLE is not set +# CONFIG_CPU_IDLE_GOV_MENU is not set +# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set +# CONFIG_CRAMFS is not set +CONFIG_CRASHLOG=y +# CONFIG_CRASH_DUMP is not set +# CONFIG_CRC16 is not set +CONFIG_CRC32=y +# CONFIG_CRC32_BIT is not set +CONFIG_CRC32_SARWATE=y +# CONFIG_CRC32_SELFTEST is not set +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SLICEBY8 is not set +# CONFIG_CRC7 is not set +# CONFIG_CRC8 is not set +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC_ITU_T is not set +# CONFIG_CRC_T10DIF is not set +CONFIG_CROSS_COMPILE="" +# CONFIG_CROSS_MEMORY_ATTACH is not set +CONFIG_CRYPTO=y +# CONFIG_CRYPTO_AEAD is not set +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_AES_586 is not set +# CONFIG_CRYPTO_AES_ARM is not set +# CONFIG_CRYPTO_AES_ARM_BS is not set +# CONFIG_CRYPTO_AES_NI_INTEL is not set +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +# CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_AUTHENC is not set +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_CMAC is not set +# CONFIG_CRYPTO_CRC32 is not set +# CONFIG_CRYPTO_CRC32C is not set +# CONFIG_CRYPTO_CRC32C_INTEL is not set +# CONFIG_CRYPTO_CRCT10DIF is not set +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_DEV_ATMEL_AES is not set +# CONFIG_CRYPTO_DEV_ATMEL_SHA is not set +# CONFIG_CRYPTO_DEV_ATMEL_TDES is not set +# CONFIG_CRYPTO_DEV_CCP is not set +# CONFIG_CRYPTO_DEV_FSL_CAAM is not set +# CONFIG_CRYPTO_DEV_HIFN_795X is not set +# CONFIG_CRYPTO_DEV_MV_CESA is not set +# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set +# CONFIG_CRYPTO_DEV_QCE is not set +# CONFIG_CRYPTO_DEV_SAHARA is not set +# CONFIG_CRYPTO_DEV_TALITOS is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +# CONFIG_CRYPTO_DRBG_MENU is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_FIPS is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_GF128MUL is not set +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set +# CONFIG_CRYPTO_HASH is not set +# CONFIG_CRYPTO_HMAC is not set +# CONFIG_CRYPTO_HW is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_MANAGER is not set +# CONFIG_CRYPTO_MANAGER2 is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_PCOMP is not set +# CONFIG_CRYPTO_PCOMP2 is not set +CONFIG_CRYPTO_PCRYPT=y +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +# CONFIG_CRYPTO_RNG is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SALSA20_586 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SEQIV is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SHA1 is not set +# CONFIG_CRYPTO_SHA1_ARM is not set +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TEST is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_TWOFISH is not set +# CONFIG_CRYPTO_TWOFISH_586 is not set +# CONFIG_CRYPTO_TWOFISH_COMMON is not set +# CONFIG_CRYPTO_USER is not set +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_VMAC is not set +# CONFIG_CRYPTO_WP512 is not set +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_ZLIB is not set +# CONFIG_CRYSTALHD is not set +# CONFIG_CS5535_MFGPT is not set +# CONFIG_CS89x0 is not set +# CONFIG_CUSE is not set +# CONFIG_CW1200 is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXT1E1 is not set +# CONFIG_CYPRESS_FIRMWARE is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_DCB is not set +# CONFIG_DDR is not set +# CONFIG_DE600 is not set +# CONFIG_DE620 is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_CREDENTIALS is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_DEBUG_FS=y +# CONFIG_DEBUG_GPIO is not set +# CONFIG_DEBUG_HIGHMEM is not set +# CONFIG_DEBUG_ICEDCC is not set +# CONFIG_DEBUG_INFO is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +CONFIG_DEBUG_INFO_REDUCED=y +# CONFIG_DEBUG_INFO_SPLIT is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_KOBJECT_RELEASE is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_LL is not set +# CONFIG_DEBUG_LL_UART_8250 is not set +# CONFIG_DEBUG_LL_UART_PL01X is not set +# CONFIG_DEBUG_LOCKDEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_NX_TEST is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_PREEMPT is not set +# CONFIG_DEBUG_RODATA is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +# CONFIG_DEBUG_SEMIHOSTING is not set +# CONFIG_DEBUG_SET_MODULE_RONX is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_SHIRQ is not set +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set +# CONFIG_DEBUG_UART_BCM63XX is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_WRITECOUNT is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_ZBOOT is not set +# CONFIG_DECNET is not set +CONFIG_DEFAULT_CUBIC=y +CONFIG_DEFAULT_DEADLINE=y +CONFIG_DEFAULT_HOSTNAME="(none)" +CONFIG_DEFAULT_IOSCHED="deadline" +CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +# CONFIG_DEFAULT_NOOP is not set +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_SECURITY="" +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +# CONFIG_DELL_SMO8800 is not set +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_DEVKMEM is not set +CONFIG_DEVPORT=y +# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +# CONFIG_DEVTMPFS is not set +# CONFIG_DEVTMPFS_MOUNT is not set +# CONFIG_DGAP is not set +# CONFIG_DGNC is not set +# CONFIG_DGRP is not set +# CONFIG_DHT11 is not set +CONFIG_DISABLE_DEV_COREDUMP=y +# CONFIG_DISCONTIGMEM_MANUAL is not set +# CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set +# CONFIG_DISPLAY_CONNECTOR_DVI is not set +# CONFIG_DISPLAY_CONNECTOR_HDMI is not set +# CONFIG_DISPLAY_ENCODER_TFP410 is not set +# CONFIG_DISPLAY_ENCODER_TPD12S015 is not set +# CONFIG_DISPLAY_PANEL_DPI is not set +# CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02 is not set +# CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1 is not set +# CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1 is not set +# CONFIG_DISPLAY_SUPPORT is not set +# CONFIG_DL2K is not set +# CONFIG_DLM is not set +# CONFIG_DM9000 is not set +# CONFIG_DMADEVICES is not set +# CONFIG_DMADEVICES_DEBUG is not set +# CONFIG_DMASCC is not set +# CONFIG_DMATEST is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMA_ENGINE is not set +# CONFIG_DMA_SHARED_BUFFER is not set +# CONFIG_DM_CACHE is not set +# CONFIG_DM_DEBUG is not set +# CONFIG_DM_DELAY is not set +# CONFIG_DM_ERA is not set +# CONFIG_DM_FLAKEY is not set +# CONFIG_DM_LOG_USERSPACE is not set +# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_RAID is not set +# CONFIG_DM_SWITCH is not set +# CONFIG_DM_THIN_PROVISIONING is not set +# CONFIG_DM_UEVENT is not set +# CONFIG_DM_VERITY is not set +# CONFIG_DM_ZERO is not set +# CONFIG_DNET is not set +# CONFIG_DNOTIFY is not set +# CONFIG_DNS_RESOLVER is not set +CONFIG_DOUBLEFAULT=y +CONFIG_DQL=y +# CONFIG_DRAGONRISE_FF is not set +# CONFIG_DRM is not set +# CONFIG_DS1682 is not set +# CONFIG_DTLK is not set +# CONFIG_DUMMY is not set +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +# CONFIG_DUMMY_IRQ is not set +# CONFIG_DVB_AU8522_V4L is not set +# CONFIG_DVB_CORE is not set +# CONFIG_DVB_DUMMY_FE is not set +# CONFIG_DVB_TUNER_DIB0070 is not set +# CONFIG_DVB_TUNER_DIB0090 is not set +# CONFIG_DWC3_HOST_USB3_LPM_ENABLE is not set +# CONFIG_DW_DMAC is not set +# CONFIG_DW_WATCHDOG is not set +# CONFIG_DX_SEP is not set +# CONFIG_DYNAMIC_DEBUG is not set +# CONFIG_E100 is not set +# CONFIG_E1000 is not set +# CONFIG_E1000E is not set +# CONFIG_E2100 is not set +# CONFIG_EARLY_PRINTK_8250 is not set +# CONFIG_EASYCAP is not set +# CONFIG_ECHO is not set +# CONFIG_ECONET is not set +# CONFIG_ECRYPT_FS is not set +# CONFIG_EDAC is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_DIGSY_MTC_CFG is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EEXPRESS is not set +# CONFIG_EEXPRESS_PRO is not set +CONFIG_EFI_PARTITION=y +# CONFIG_EFS_FS is not set +# CONFIG_ELF_CORE is not set +# CONFIG_EMAC_ROCKCHIP is not set +CONFIG_EMBEDDED=y +# CONFIG_EM_TIMER_STI is not set +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +# CONFIG_ENC28J60 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_ENIC is not set +# CONFIG_EPAPR_PARAVIRT is not set +# CONFIG_EPIC100 is not set +CONFIG_EPOLL=y +# CONFIG_EQUALIZER is not set +# CONFIG_ET131X is not set +# CONFIG_ETH16I is not set +CONFIG_ETHERNET=y +# CONFIG_ETHOC is not set +CONFIG_EVENTFD=y +# CONFIG_EVENT_POWER_TRACING_DEPRECATED is not set +# CONFIG_EWRK3 is not set +CONFIG_EXPERIMENTAL=y +CONFIG_EXPERT=y +# CONFIG_EXPORTFS is not set +# CONFIG_EXT2_FS is not set +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT2_FS_XIP is not set +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT3_FS_XATTR is not set +# CONFIG_EXT4_DEBUG is not set +# CONFIG_EXT4_FS is not set +# CONFIG_EXT4_FS_POSIX_ACL is not set +# CONFIG_EXT4_FS_SECURITY is not set +CONFIG_EXT4_FS_XATTR=y +CONFIG_EXT4_USE_FOR_EXT23=y +# CONFIG_EXTCON is not set +CONFIG_EXTRA_FIRMWARE="" +CONFIG_EXTRA_TARGETS="" +# CONFIG_EXYNOS_ADC is not set +# CONFIG_EXYNOS_VIDEO is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_F2FS_FS is not set +# CONFIG_F2FS_FS_POSIX_ACL is not set +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_FANOTIFY is not set +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_FAT_FS is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_FB is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_ARC is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_CFB_COPYAREA is not set +# CONFIG_FB_CFB_FILLRECT is not set +# CONFIG_FB_CFB_IMAGEBLIT is not set +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_DA8XX is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_GEODE is not set +# CONFIG_FB_GOLDFISH is not set +# CONFIG_FB_HGA is not set +# CONFIG_FB_I740 is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB_IMX is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_LE80578 is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_MXS is not set +# CONFIG_FB_N411 is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_OF is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_PS3 is not set +# CONFIG_FB_PXA is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_SM7XX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_TILEBLITTING is not set +# CONFIG_FB_TMIO is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_VGA16 is not set +# CONFIG_FB_VIA is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FB_XGI is not set +# CONFIG_FCOE is not set +# CONFIG_FCOE_FNIC is not set +# CONFIG_FDDI is not set +# CONFIG_FEALNX is not set +# CONFIG_FENCE_TRACE is not set +# CONFIG_FHANDLE is not set +CONFIG_FIB_RULES=y +CONFIG_FILE_LOCKING=y +# CONFIG_FIREWIRE is not set +# CONFIG_FIREWIRE_NOSY is not set +# CONFIG_FIREWIRE_SERIAL is not set +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FIRMWARE_IN_KERNEL is not set +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_FIXED_PHY is not set +CONFIG_FLATMEM=y +CONFIG_FLATMEM_MANUAL=y +CONFIG_FLAT_NODE_MEM_MAP=y +# CONFIG_FM10K is not set +# CONFIG_FMC is not set +# CONFIG_FORCEDETH is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +# CONFIG_FRAMEBUFFER_CONSOLE is not set +# CONFIG_FRAME_POINTER is not set +CONFIG_FRAME_WARN=1024 +# CONFIG_FREEZER is not set +# CONFIG_FRONTSWAP is not set +# CONFIG_FSCACHE is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_FSL_XGMAC_MDIO is not set +CONFIG_FSNOTIFY=y +# CONFIG_FS_POSIX_ACL is not set +# CONFIG_FT1000 is not set +# CONFIG_FTGMAC100 is not set +# CONFIG_FTL is not set +# CONFIG_FTMAC100 is not set +# CONFIG_FTRACE is not set +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_FTR_FIXUP_SELFTEST is not set +# CONFIG_FUJITSU_TABLET is not set +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_FUSE_FS is not set +# CONFIG_FUSION is not set +# CONFIG_FUSION_FC is not set +# CONFIG_FUSION_SAS is not set +# CONFIG_FUSION_SPI is not set +CONFIG_FUTEX=y +CONFIG_FW_LOADER=y +CONFIG_FW_LOADER_USER_HELPER=y +CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y +CONFIG_GACT_PROB=y +# CONFIG_GADGET_UAC1 is not set +# CONFIG_GAMEPORT is not set +# CONFIG_GATEWORKS_GW16083 is not set +# CONFIG_GCOV is not set +# CONFIG_GCOV_KERNEL is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +CONFIG_GENERIC_CALIBRATE_DELAY=y +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_GENERIC_HARDIRQS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_NET_UTILS=y +# CONFIG_GENERIC_PHY is not set +CONFIG_GENERIC_TIME=y +# CONFIG_GENEVE is not set +# CONFIG_GENWQE is not set +# CONFIG_GFS2_FS is not set +# CONFIG_GIGASET_CAPI is not set +# CONFIG_GIGASET_DEBUG is not set +# CONFIG_GLOB_SELFTEST is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_GPIOLIB is not set +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_AMD8111 is not set +# CONFIG_GPIO_BCM_KONA is not set +# CONFIG_GPIO_BT8XX is not set +# CONFIG_GPIO_CS5535 is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_ICH is not set +# CONFIG_GPIO_IT8761E is not set +# CONFIG_GPIO_LANGWELL is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_MCP23S08 is not set +# CONFIG_GPIO_ML_IOH is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_PCH is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_RCAR is not set +# CONFIG_GPIO_RDC321X is not set +# CONFIG_GPIO_SCH is not set +# CONFIG_GPIO_SCH311X is not set +# CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_SYSFS is not set +# CONFIG_GPIO_TS5500 is not set +# CONFIG_GPIO_VX855 is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_GPIO_WDT is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GREENASIA_FF is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_HAMACHI is not set +# CONFIG_HAMRADIO is not set +# CONFIG_HAPPYMEAL is not set +# CONFIG_HARDLOCKUP_DETECTOR is not set +# CONFIG_HAVE_AOUT is not set +# CONFIG_HAVE_ARM_ARCH_TIMER is not set +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +# CONFIG_HCALL_STATS is not set +# CONFIG_HDLC is not set +# CONFIG_HDLC_CISCO is not set +# CONFIG_HDLC_FR is not set +# CONFIG_HDLC_PPP is not set +# CONFIG_HDLC_RAW is not set +# CONFIG_HDLC_RAW_ETH is not set +# CONFIG_HDQ_MASTER_OMAP is not set +# CONFIG_HEADERS_CHECK is not set +# CONFIG_HERMES is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFS_FS_POSIX_ACL is not set +# CONFIG_HIBERNATION is not set +# CONFIG_HID is not set +# CONFIG_HIDRAW is not set +# CONFIG_HID_A4TECH is not set +# CONFIG_HID_ACRUX is not set +# CONFIG_HID_ACRUX_FF is not set +# CONFIG_HID_APPLE is not set +# CONFIG_HID_APPLEIR is not set +# CONFIG_HID_AUREAL is not set +# CONFIG_HID_BELKIN is not set +# CONFIG_HID_CHERRY is not set +# CONFIG_HID_CHICONY is not set +# CONFIG_HID_CP2112 is not set +# CONFIG_HID_CYPRESS is not set +# CONFIG_HID_DRAGONRISE is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_EZKEY is not set +# CONFIG_HID_GENERIC is not set +# CONFIG_HID_GREENASIA is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_GYRATION is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_HUION is not set +# CONFIG_HID_ICADE is not set +# CONFIG_HID_KENSINGTON is not set +# CONFIG_HID_KEYTOUCH is not set +# CONFIG_HID_KYE is not set +# CONFIG_HID_LCPOWER is not set +# CONFIG_HID_LENOVO is not set +# CONFIG_HID_LENOVO_TPKBD is not set +# CONFIG_HID_LOGITECH is not set +# CONFIG_HID_LOGITECH_DJ is not set +# CONFIG_HID_LOGITECH_HIDPP is not set +# CONFIG_HID_MAGICMOUSE is not set +# CONFIG_HID_MICROSOFT is not set +# CONFIG_HID_MONTEREY is not set +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTRIG is not set +# CONFIG_HID_ORTEK is not set +# CONFIG_HID_PANTHERLORD is not set +# CONFIG_HID_PENMOUNT is not set +# CONFIG_HID_PETALYNX is not set +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PID is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_PS3REMOTE is not set +# CONFIG_HID_QUANTA is not set +# CONFIG_HID_RMI is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_ROCCAT_ARVO is not set +# CONFIG_HID_ROCCAT_KONE is not set +# CONFIG_HID_ROCCAT_KONEPLUS is not set +# CONFIG_HID_ROCCAT_KOVAPLUS is not set +# CONFIG_HID_ROCCAT_PYRA is not set +# CONFIG_HID_SAITEK is not set +# CONFIG_HID_SAMSUNG is not set +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_SMARTJOYPLUS is not set +# CONFIG_HID_SONY is not set +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +# CONFIG_HID_SUNPLUS is not set +# CONFIG_HID_SUPPORT is not set +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_TIVO is not set +# CONFIG_HID_TOPSEED is not set +# CONFIG_HID_TWINHAN is not set +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WACOM is not set +# CONFIG_HID_WALTOP is not set +# CONFIG_HID_WIIMOTE is not set +# CONFIG_HID_XINMO is not set +# CONFIG_HID_ZEROPLUS is not set +# CONFIG_HID_ZYDACRON is not set +# CONFIG_HIGHMEM is not set +CONFIG_HIGH_RES_TIMERS=y +# CONFIG_HIPPI is not set +# CONFIG_HIX5HD2_GMAC is not set +# CONFIG_HMC6352 is not set +# CONFIG_HOSTAP is not set +# CONFIG_HOSTAP_CS is not set +# CONFIG_HOSTAP_PCI is not set +# CONFIG_HOSTAP_PLX is not set +CONFIG_HOTPLUG=y +# CONFIG_HOTPLUG_CPU is not set +# CONFIG_HOTPLUG_PCI is not set +# CONFIG_HP100 is not set +CONFIG_HPET_MMAP_DEFAULT=y +# CONFIG_HPFS_FS is not set +# CONFIG_HPLAN is not set +# CONFIG_HPLAN_PLUS is not set +# CONFIG_HP_ILO is not set +# CONFIG_HP_WIRELESS is not set +# CONFIG_HSI is not set +# CONFIG_HSR is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_HVC_DCC is not set +# CONFIG_HVC_UDBG is not set +# CONFIG_HWMON is not set +# CONFIG_HWMON_DEBUG_CHIP is not set +# CONFIG_HWMON_VID is not set +# CONFIG_HWSPINLOCK_OMAP is not set +CONFIG_HW_PERF_EVENTS=y +# CONFIG_HW_RANDOM is not set +# CONFIG_HW_RANDOM_AMD is not set +# CONFIG_HW_RANDOM_ATMEL is not set +# CONFIG_HW_RANDOM_EXYNOS is not set +# CONFIG_HW_RANDOM_GEODE is not set +# CONFIG_HW_RANDOM_INTEL is not set +# CONFIG_HW_RANDOM_OMAP3_ROM is not set +# CONFIG_HW_RANDOM_PPC4XX is not set +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_TPM is not set +# CONFIG_HW_RANDOM_VIA is not set +# CONFIG_HYPERV is not set +# CONFIG_HYSDN is not set +CONFIG_HZ=100 +CONFIG_HZ_100=y +# CONFIG_HZ_1000 is not set +# CONFIG_HZ_1024 is not set +# CONFIG_HZ_128 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +# CONFIG_HZ_256 is not set +# CONFIG_HZ_300 is not set +# CONFIG_HZ_48 is not set +# CONFIG_HZ_500 is not set +# CONFIG_HZ_PERIODIC is not set +# CONFIG_I2C is not set +# CONFIG_I2C_ALGOBIT is not set +# CONFIG_I2C_ALGOPCA is not set +# CONFIG_I2C_ALGOPCF is not set +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_AU1550 is not set +# CONFIG_I2C_BCM2835 is not set +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_CHARDEV is not set +# CONFIG_I2C_COMPAT is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DESIGNWARE is not set +# CONFIG_I2C_DESIGNWARE_PCI is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_EG20T is not set +# CONFIG_I2C_ELEKTOR is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_HELPER_AUTO is not set +# CONFIG_I2C_HID is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_IBM_IIC is not set +# CONFIG_I2C_INTEL_MID is not set +# CONFIG_I2C_ISCH is not set +# CONFIG_I2C_ISMT is not set +# CONFIG_I2C_MPC is not set +# CONFIG_I2C_MUX is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MV64XXX is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_OCTEON is not set +# CONFIG_I2C_PARPORT is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_PCA_ISA is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_RCAR is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_SCMI is not set +# CONFIG_I2C_SH_MOBILE is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_SMBUS is not set +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set +# CONFIG_I2C_VERSATILE is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set +# CONFIG_I2C_XILINX is not set +# CONFIG_I2O is not set +# CONFIG_I40E is not set +# CONFIG_I40EVF is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_I82092 is not set +# CONFIG_I82365 is not set +# CONFIG_IBM_ASM is not set +# CONFIG_IBM_EMAC_DEBUG is not set +# CONFIG_IBM_EMAC_EMAC4 is not set +# CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT is not set +# CONFIG_IBM_EMAC_MAL_COMMON_ERR is not set +# CONFIG_IBM_EMAC_NO_FLOW_CTRL is not set +# CONFIG_IBM_EMAC_RGMII is not set +# CONFIG_IBM_EMAC_TAH is not set +# CONFIG_IBM_EMAC_ZMII is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_ICS932S401 is not set +# CONFIG_IDE is not set +# CONFIG_IDEAPAD_LAPTOP is not set +# CONFIG_IDE_GD is not set +# CONFIG_IDE_PHISON is not set +# CONFIG_IDE_PROC_FS is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IEEE802154 is not set +# CONFIG_IEEE802154_FAKEHARD is not set +# CONFIG_IFB is not set +# CONFIG_IGB is not set +# CONFIG_IGBVF is not set +# CONFIG_IIO is not set +# CONFIG_IIO_BUFFER_CB is not set +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 +# CONFIG_IIO_GPIO_TRIGGER is not set +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set +# CONFIG_IIO_SIMPLE_DUMMY is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_IIO_SYSFS_TRIGGER is not set +# CONFIG_IKCONFIG is not set +# CONFIG_IKCONFIG_PROC is not set +# CONFIG_IMAGE_CMDLINE_HACK is not set +# CONFIG_IMX_IPUV3_CORE is not set +CONFIG_INET=y +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_DIAG is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_TCP_DIAG is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_UDP_DIAG is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INFINIBAND is not set +# CONFIG_INFTL is not set +# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set +# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set +# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set +CONFIG_INITRAMFS_COMPRESSION_NONE=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_INLINE_READ_LOCK is not set +# CONFIG_INLINE_READ_LOCK_BH is not set +# CONFIG_INLINE_READ_LOCK_IRQ is not set +# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set +# CONFIG_INLINE_READ_TRYLOCK is not set +CONFIG_INLINE_READ_UNLOCK=y +# CONFIG_INLINE_READ_UNLOCK_BH is not set +CONFIG_INLINE_READ_UNLOCK_IRQ=y +# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_SPIN_LOCK is not set +# CONFIG_INLINE_SPIN_LOCK_BH is not set +# CONFIG_INLINE_SPIN_LOCK_IRQ is not set +# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set +# CONFIG_INLINE_SPIN_TRYLOCK is not set +# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK=y +# CONFIG_INLINE_SPIN_UNLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_WRITE_LOCK is not set +# CONFIG_INLINE_WRITE_LOCK_BH is not set +# CONFIG_INLINE_WRITE_LOCK_IRQ is not set +# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set +# CONFIG_INLINE_WRITE_TRYLOCK is not set +CONFIG_INLINE_WRITE_UNLOCK=y +# CONFIG_INLINE_WRITE_UNLOCK_BH is not set +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set +CONFIG_INOTIFY_USER=y +# CONFIG_INPUT is not set +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_APANEL is not set +# CONFIG_INPUT_ATI_REMOTE is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_ATLAS_BTNS is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_MATRIXKMAP is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PCSPKR is not set +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_UINPUT is not set +# CONFIG_INPUT_WISTRON_BTNS is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INT340X_THERMAL is not set +# CONFIG_INTEL_IDLE is not set +# CONFIG_INTEL_MEI is not set +# CONFIG_INTEL_MEI_ME is not set +# CONFIG_INTEL_MEI_TXE is not set +# CONFIG_INTEL_MIC_CARD is not set +# CONFIG_INTEL_MIC_HOST is not set +# CONFIG_INTEL_MID_PTI is not set +# CONFIG_INTEL_OAKTRAIL is not set +# CONFIG_INTEL_RST is not set +# CONFIG_INTEL_SMARTCONNECT is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_INV_MPU6050_IIO is not set +# CONFIG_IOMMU_SUPPORT is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_NOOP=y +# CONFIG_IP1000 is not set +# CONFIG_IP17XX_PHY is not set +# CONFIG_IP6_NF_FILTER is not set +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_IP6_NF_MANGLE is not set +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_NAT is not set +# CONFIG_IP6_NF_QUEUE is not set +# CONFIG_IP6_NF_RAW is not set +# CONFIG_IP6_NF_TARGET_HL is not set +# CONFIG_IP6_NF_TARGET_LOG is not set +# CONFIG_IP6_NF_TARGET_REJECT is not set +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +# CONFIG_IPACK_BUS is not set +# CONFIG_IPC_NS is not set +# CONFIG_IPMI_HANDLER is not set +# CONFIG_IPV6 is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_IPV6_PRIVACY is not set +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_ROUTE_INFO is not set +# CONFIG_IPV6_SIT is not set +# CONFIG_IPV6_SIT_6RD is not set +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_VTI is not set +# CONFIG_IPW2100 is not set +# CONFIG_IPW2100_DEBUG is not set +CONFIG_IPW2100_MONITOR=y +# CONFIG_IPW2200 is not set +# CONFIG_IPW2200_DEBUG is not set +CONFIG_IPW2200_MONITOR=y +# CONFIG_IPW2200_PROMISCUOUS is not set +# CONFIG_IPW2200_QOS is not set +# CONFIG_IPW2200_RADIOTAP is not set +# CONFIG_IPWIRELESS is not set +# CONFIG_IPX is not set +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_DCCP is not set +# CONFIG_IP_FIB_TRIE_STATS is not set +# CONFIG_IP_MROUTE is not set +CONFIG_IP_MROUTE_MULTIPLE_TABLES=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_NF_ARPFILTER is not set +# CONFIG_IP_NF_ARPTABLES is not set +# CONFIG_IP_NF_ARP_MANGLE is not set +# CONFIG_IP_NF_FILTER is not set +# CONFIG_IP_NF_IPTABLES is not set +# CONFIG_IP_NF_MANGLE is not set +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +# CONFIG_IP_NF_QUEUE is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_SECURITY is not set +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_LOG is not set +# CONFIG_IP_NF_TARGET_MASQUERADE is not set +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +# CONFIG_IP_NF_TARGET_REJECT is not set +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_TARGET_ULOG is not set +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_IP_PNP is not set +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +# CONFIG_IP_SCTP is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set +# CONFIG_IRDA is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_IRQ_ALL_CPUS is not set +# CONFIG_IRQ_DOMAIN_DEBUG is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_IR_GPIO_CIR is not set +# CONFIG_IR_HIX5HD2 is not set +# CONFIG_IR_IGUANA is not set +# CONFIG_IR_IMG is not set +# CONFIG_IR_IMON is not set +# CONFIG_IR_JVC_DECODER is not set +# CONFIG_IR_LIRC_CODEC is not set +# CONFIG_IR_MCEUSB is not set +# CONFIG_IR_NEC_DECODER is not set +# CONFIG_IR_RC5_DECODER is not set +# CONFIG_IR_RC5_SZ_DECODER is not set +# CONFIG_IR_RC6_DECODER is not set +# CONFIG_IR_REDRAT3 is not set +# CONFIG_IR_SONY_DECODER is not set +# CONFIG_IR_STREAMZAP is not set +# CONFIG_IR_TTUSBIR is not set +# CONFIG_ISCSI_BOOT_SYSFS is not set +# CONFIG_ISCSI_TCP is not set +CONFIG_ISDN=y +# CONFIG_ISDN_AUDIO is not set +# CONFIG_ISDN_CAPI is not set +# CONFIG_ISDN_CAPI_CAPIDRV is not set +# CONFIG_ISDN_DIVERSION is not set +# CONFIG_ISDN_DRV_ACT2000 is not set +# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set +# CONFIG_ISDN_DRV_GIGASET is not set +# CONFIG_ISDN_DRV_HISAX is not set +# CONFIG_ISDN_DRV_ICN is not set +# CONFIG_ISDN_DRV_LOOP is not set +# CONFIG_ISDN_DRV_PCBIT is not set +# CONFIG_ISDN_DRV_SC is not set +# CONFIG_ISDN_I4L is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_ISL29125 is not set +# CONFIG_ISO9660_FS is not set +# CONFIG_ISS4xx is not set +# CONFIG_ITG3200 is not set +# CONFIG_IWL3945 is not set +# CONFIG_IWLAGN is not set +# CONFIG_IWLWIFI is not set +# CONFIG_IWMC3200TOP is not set +# CONFIG_IXGB is not set +# CONFIG_IXGBE is not set +# CONFIG_IXGBEVF is not set +# CONFIG_JBD is not set +# CONFIG_JBD2_DEBUG is not set +# CONFIG_JBD_DEBUG is not set +# CONFIG_JFFS2_CMODE_FAVOURLZO is not set +# CONFIG_JFFS2_CMODE_NONE is not set +CONFIG_JFFS2_CMODE_PRIORITY=y +# CONFIG_JFFS2_CMODE_SIZE is not set +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_POSIX_ACL is not set +# CONFIG_JFFS2_FS_SECURITY is not set +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +CONFIG_JFFS2_FS_WRITEBUFFER=y +CONFIG_JFFS2_FS_XATTR=y +CONFIG_JFFS2_LZMA=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +CONFIG_JFFS2_SUMMARY=y +# CONFIG_JFFS2_ZLIB is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_FS is not set +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_STATISTICS is not set +# CONFIG_JME is not set +CONFIG_JOLIET=y +# CONFIG_JUMP_LABEL is not set +# CONFIG_KALLSYMS is not set +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_UNCOMPRESSED is not set +# CONFIG_KARMA_PARTITION is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_GZIP is not set +# CONFIG_KERNEL_LZ4 is not set +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_LZO is not set +CONFIG_KERNEL_MODE_NEON=y +CONFIG_KERNEL_XZ=y +CONFIG_KERNFS=y +# CONFIG_KEXEC is not set +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_CAP1106 is not set +# CONFIG_KEYBOARD_GPIO_POLLED is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_PXA27x is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_SH_KEYSC is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYS is not set +# CONFIG_KEYS_DEBUG_PROC_KEYS is not set +# CONFIG_KGDB is not set +# CONFIG_KMEMCHECK is not set +# CONFIG_KPROBES is not set +# CONFIG_KPROBES_SANITY_TEST is not set +# CONFIG_KS8842 is not set +# CONFIG_KS8851 is not set +# CONFIG_KS8851_MLL is not set +# CONFIG_KSM is not set +# CONFIG_KSZ884X_PCI is not set +CONFIG_KUSER_HELPERS=y +# CONFIG_KVM_GUEST is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_KXSD9 is not set +# CONFIG_L2TP is not set +# CONFIG_L2TP_ETH is not set +# CONFIG_L2TP_IP is not set +# CONFIG_L2TP_V3 is not set +# CONFIG_LANMEDIA is not set +# CONFIG_LANTIQ is not set +# CONFIG_LAPB is not set +# CONFIG_LASAT is not set +# CONFIG_LATENCYTOP is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +CONFIG_LBDAF=y +# CONFIG_LCD_HX8357 is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_LEDS_ATMEL_PWM is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_BLINKM is not set +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_GPIO is not set +CONFIG_LEDS_GPIO_OF=y +CONFIG_LEDS_GPIO_PLATFORM=y +# CONFIG_LEDS_INTEL_SS4200 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3556 is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_NET5501 is not set +# CONFIG_LEDS_OT200 is not set +# CONFIG_LEDS_PCA9532 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA9633 is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_PCA9685 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_RENESAS_TPU is not set +# CONFIG_LEDS_SYSCON is not set +# CONFIG_LEDS_TCA6507 is not set +CONFIG_LEDS_TRIGGERS=y +# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_LEDS_TRIGGER_CPU is not set +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +# CONFIG_LEDS_TRIGGER_GPIO is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_IDE_DISK is not set +CONFIG_LEDS_TRIGGER_NETDEV=y +# CONFIG_LEDS_TRIGGER_ONESHOT is not set +CONFIG_LEDS_TRIGGER_TIMER=y +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_LIB80211 is not set +# CONFIG_LIB80211_CRYPT_CCMP is not set +# CONFIG_LIB80211_CRYPT_TKIP is not set +# CONFIG_LIB80211_CRYPT_WEP is not set +# CONFIG_LIB80211_DEBUG is not set +# CONFIG_LIBCRC32C is not set +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_LIBERTAS_USB is not set +# CONFIG_LIBFC is not set +# CONFIG_LIBFCOE is not set +# CONFIG_LIBIPW_DEBUG is not set +# CONFIG_LINE6_USB is not set +# CONFIG_LIRC_STAGING is not set +# CONFIG_LIS3L02DQ is not set +# CONFIG_LKDTM is not set +CONFIG_LLC=y +# CONFIG_LLC2 is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +# CONFIG_LOCKD is not set +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_LOCKD_V4=y +# CONFIG_LOCKUP_DETECTOR is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_LOGFS is not set +# CONFIG_LOGIG940_FF is not set +# CONFIG_LOGIRUMBLEPAD2_FF is not set +# CONFIG_LOGITECH_FF is not set +# CONFIG_LOGIWHEELS_FF is not set +# CONFIG_LOGO is not set +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +# CONFIG_LOONGSON_MC146818 is not set +# CONFIG_LP486E is not set +# CONFIG_LPC_ICH is not set +# CONFIG_LPC_SCH is not set +# CONFIG_LP_CONSOLE is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LTPC is not set +# CONFIG_LTR501 is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_LXT_PHY is not set +# CONFIG_LZ4HC_COMPRESS is not set +# CONFIG_LZ4_COMPRESS is not set +# CONFIG_LZ4_DECOMPRESS is not set +CONFIG_LZMA_COMPRESS=y +CONFIG_LZMA_DECOMPRESS=y +# CONFIG_LZO_COMPRESS is not set +# CONFIG_LZO_DECOMPRESS is not set +# CONFIG_M25PXX_PREFER_SMALL_SECTOR_ERASE is not set +# CONFIG_MAC80211 is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MACB is not set +# CONFIG_MACH_DECSTATION is not set +# CONFIG_MACH_JAZZ is not set +# CONFIG_MACH_JZ4740 is not set +# CONFIG_MACH_LOONGSON is not set +# CONFIG_MACH_LOONGSON1 is not set +# CONFIG_MACH_NO_WESTBRIDGE is not set +# CONFIG_MACH_TX39XX is not set +# CONFIG_MACH_TX49XX is not set +# CONFIG_MACH_VR41XX is not set +# CONFIG_MACINTOSH_DRIVERS is not set +# CONFIG_MACVLAN is not set +# CONFIG_MACVTAP is not set +# CONFIG_MAC_EMUMOUSEBTN is not set +# CONFIG_MAC_PARTITION is not set +# CONFIG_MAG3110 is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +# CONFIG_MAILBOX is not set +# CONFIG_MANGLE_BOOTARGS is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MAX63XX_WATCHDOG is not set +# CONFIG_MCB is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set +# CONFIG_MCPM is not set +# CONFIG_MD is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MD_FAULTY is not set +# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set +# CONFIG_MEDIA_ATTACH is not set +# CONFIG_MEDIA_CAMERA_SUPPORT is not set +# CONFIG_MEDIA_CONTROLLER is not set +# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set +# CONFIG_MEDIA_PARPORT_SUPPORT is not set +# CONFIG_MEDIA_PCI_SUPPORT is not set +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_RC_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set +# CONFIG_MEDIA_SUPPORT is not set +# CONFIG_MEDIA_TUNER_CUSTOMISE is not set +# CONFIG_MEDIA_USB_SUPPORT is not set +# CONFIG_MEGARAID_LEGACY is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_SAS is not set +# CONFIG_MEMORY is not set +# CONFIG_MEMORY_FAILURE is not set +# CONFIG_MEMSTICK is not set +# CONFIG_MEN_A21_WDT is not set +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_MFD_AXP20X is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_CS5535 is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_MFD_JANZ_CMODIO is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MC13783 is not set +# CONFIG_MFD_MC13XXX is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_MFD_OMAP_USB_HOST is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RDC321X is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_RTSX_PCI is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_S5M_CORE is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SUPPORT=y +# CONFIG_MFD_SYSCON is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_MFD_TIMBERDALE is not set +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_VX855 is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_WM831X is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_MG_DISK is not set +# CONFIG_MICREL_KS8995MA is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_MIGRATION is not set +CONFIG_MII=y +# CONFIG_MIKROTIK_RB532 is not set +# CONFIG_MINIX_FS is not set +# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_ALCHEMY is not set +# CONFIG_MIPS_COBALT is not set +# CONFIG_MIPS_FPU_EMULATOR is not set +# CONFIG_MIPS_MALTA is not set +# CONFIG_MIPS_O32_FP64_SUPPORT is not set +# CONFIG_MIPS_PARAVIRT is not set +# CONFIG_MIPS_SEAD3 is not set +# CONFIG_MIPS_SIM is not set +CONFIG_MISC_DEVICES=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_MISDN is not set +# CONFIG_MISDN_AVMFRITZ is not set +# CONFIG_MISDN_HFCPCI is not set +# CONFIG_MISDN_HFCUSB is not set +# CONFIG_MISDN_INFINEON is not set +# CONFIG_MISDN_NETJET is not set +# CONFIG_MISDN_SPEEDFAX is not set +# CONFIG_MISDN_W6692 is not set +# CONFIG_MKISS is not set +# CONFIG_MLX4_CORE is not set +# CONFIG_MLX4_EN is not set +# CONFIG_MLX5_CORE is not set +# CONFIG_MLX90614 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMC is not set +# CONFIG_MMC_ARMMMCI is not set +# CONFIG_MMC_AU1X is not set +# CONFIG_MMC_BLOCK is not set +CONFIG_MMC_BLOCK_BOUNCE=y +CONFIG_MMC_BLOCK_MINORS=8 +# CONFIG_MMC_CB710 is not set +# CONFIG_MMC_CLKGATE is not set +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_DW is not set +# CONFIG_MMC_MVSDIO is not set +# CONFIG_MMC_S3C is not set +# CONFIG_MMC_SDHCI is not set +# CONFIG_MMC_SDHCI_ACPI is not set +# CONFIG_MMC_SDHCI_BCM_KONA is not set +# CONFIG_MMC_SDHCI_MSM is not set +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_ESDHC is not set +# CONFIG_MMC_SDHCI_OF_HLWD is not set +# CONFIG_MMC_SDHCI_PXAV2 is not set +# CONFIG_MMC_SDHCI_PXAV3 is not set +# CONFIG_MMC_SDRICOH_CS is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_TEST is not set +# CONFIG_MMC_UNSAFE_RESUME is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_VIA_SDMMC is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMIOTRACE is not set +CONFIG_MMU=y +CONFIG_MODULES=y +# CONFIG_MODULE_COMPRESS is not set +# CONFIG_MODULE_FORCE_LOAD is not set +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +CONFIG_MODULE_STRIPPED=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_INPORT is not set +# CONFIG_MOUSE_LOGIBM is not set +# CONFIG_MOUSE_PC110PAD is not set +# CONFIG_MOUSE_PS2_SENTELIC is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MSDOS_FS is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_MSI_BITMAP_SELFTEST is not set +# CONFIG_MSI_LAPTOP is not set +CONFIG_MTD=y +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_AFS_PARTS is not set +# CONFIG_MTD_ALAUDA is not set +# CONFIG_MTD_AR7_PARTS is not set +# CONFIG_MTD_ARM_INTEGRATOR is not set +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_MTD_BLOCK2MTD is not set +CONFIG_MTD_CFI=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +CONFIG_MTD_CFI_AMDSTD=y +# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CFI_INTELEXT=y +# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set +CONFIG_MTD_CFI_NOSWAP=y +# CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_CFI_UTIL=y +CONFIG_MTD_CHAR=y +# CONFIG_MTD_CMDLINE_PARTS is not set +CONFIG_MTD_COMPLEX_MAPPINGS=y +# CONFIG_MTD_DATAFLASH is not set +# CONFIG_MTD_DEBUG is not set +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set +# CONFIG_MTD_DOCG3 is not set +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_GPIO_ADDR is not set +# CONFIG_MTD_INTEL_VR_NOR is not set +# CONFIG_MTD_JEDECPROBE is not set +# CONFIG_MTD_LATCH_ADDR is not set +# CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_LPDDR2_NVM is not set +# CONFIG_MTD_M25P80 is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +CONFIG_MTD_MAP_BANK_WIDTH_2=y +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_MYLOADER_PARTS is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_NAND_AMS_DELTA is not set +# CONFIG_MTD_NAND_AR934X is not set +# CONFIG_MTD_NAND_AR934X_HW_ECC is not set +# CONFIG_MTD_NAND_ATMEL is not set +# CONFIG_MTD_NAND_AU1550 is not set +# CONFIG_MTD_NAND_AUTCPU12 is not set +# CONFIG_MTD_NAND_BCH is not set +# CONFIG_MTD_NAND_BCM_UMI is not set +# CONFIG_MTD_NAND_BF5XX is not set +# CONFIG_MTD_NAND_CAFE is not set +# CONFIG_MTD_NAND_CM_X270 is not set +# CONFIG_MTD_NAND_CS553X is not set +# CONFIG_MTD_NAND_DAVINCI is not set +# CONFIG_MTD_NAND_DENALI is not set +CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR=0xff108018 +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_DOCG4 is not set +# CONFIG_MTD_NAND_ECC is not set +# CONFIG_MTD_NAND_ECC_BCH is not set +# CONFIG_MTD_NAND_ECC_SMC is not set +# CONFIG_MTD_NAND_FSL_ELBC is not set +# CONFIG_MTD_NAND_FSL_IFC is not set +# CONFIG_MTD_NAND_FSL_UPM is not set +# CONFIG_MTD_NAND_FSMC is not set +# CONFIG_MTD_NAND_GPIO is not set +# CONFIG_MTD_NAND_GPMI_NAND is not set +# CONFIG_MTD_NAND_H1900 is not set +CONFIG_MTD_NAND_IDS=y +# CONFIG_MTD_NAND_JZ4740 is not set +# CONFIG_MTD_NAND_MPC5121_NFC is not set +# CONFIG_MTD_NAND_MUSEUM_IDS is not set +# CONFIG_MTD_NAND_MXC is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_NDFC is not set +# CONFIG_MTD_NAND_NOMADIK is not set +# CONFIG_MTD_NAND_NUC900 is not set +# CONFIG_MTD_NAND_OMAP2 is not set +# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set +# CONFIG_MTD_NAND_ORION is not set +# CONFIG_MTD_NAND_PASEMI is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_NAND_PPCHAMELEONEVB is not set +# CONFIG_MTD_NAND_PXA3xx is not set +# CONFIG_MTD_NAND_RB4XX is not set +# CONFIG_MTD_NAND_RB750 is not set +# CONFIG_MTD_NAND_RICOH is not set +# CONFIG_MTD_NAND_RTC_FROM4 is not set +# CONFIG_MTD_NAND_S3C2410 is not set +# CONFIG_MTD_NAND_SHARPSL is not set +# CONFIG_MTD_NAND_SH_FLCTL is not set +# CONFIG_MTD_NAND_SOCRATES is not set +# CONFIG_MTD_NAND_SPIA is not set +# CONFIG_MTD_NAND_TMIO is not set +# CONFIG_MTD_NAND_TXX9NDFMC is not set +# CONFIG_MTD_NAND_VERIFY_WRITE is not set +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_ONENAND is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_OTP is not set +# CONFIG_MTD_PCI is not set +# CONFIG_MTD_PCMCIA is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_PHYSMAP is not set +# CONFIG_MTD_PHYSMAP_COMPAT is not set +CONFIG_MTD_PHYSMAP_OF=y +# CONFIG_MTD_PLATRAM is not set +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_RAM is not set +CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 +# CONFIG_MTD_REDBOOT_PARTS is not set +# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set +# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +# CONFIG_MTD_ROM is not set +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_ROOTFS_SPLIT=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_SPINAND_MT29F is not set +# CONFIG_MTD_SPI_NOR is not set +# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set +CONFIG_MTD_SPLIT=y +# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set +# CONFIG_MTD_SPLIT_EVA_FW is not set +# CONFIG_MTD_SPLIT_FIRMWARE is not set +CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" +# CONFIG_MTD_SPLIT_FIT_FW is not set +# CONFIG_MTD_SPLIT_JIMAGE_FW is not set +# CONFIG_MTD_SPLIT_LZMA_FW is not set +# CONFIG_MTD_SPLIT_MINOR_FW is not set +# CONFIG_MTD_SPLIT_SEAMA_FW is not set +CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y +CONFIG_MTD_SPLIT_SUPPORT=y +# CONFIG_MTD_SPLIT_TPLINK_FW is not set +# CONFIG_MTD_SPLIT_TRX_FW is not set +# CONFIG_MTD_SPLIT_UIMAGE_FW is not set +# CONFIG_MTD_SPLIT_WRGG_FW is not set +# CONFIG_MTD_SST25L is not set +# CONFIG_MTD_SWAP is not set +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_UBI is not set +# CONFIG_MTD_UIMAGE_SPLIT is not set +# CONFIG_MUTEX_SPIN_ON_OWNER is not set +# CONFIG_MV643XX_ETH is not set +# CONFIG_MVMDIO is not set +# CONFIG_MVSW6171_PHY is not set +# CONFIG_MVSW61XX_PHY is not set +# CONFIG_MVSWITCH_PHY is not set +# CONFIG_MWAVE is not set +# CONFIG_MWIFIEX is not set +# CONFIG_MWL8K is not set +# CONFIG_MYRI10GE is not set +# CONFIG_NAMESPACES is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_NATSEMI is not set +# CONFIG_NAU7802 is not set +# CONFIG_NBPFAXI_DMA is not set +# CONFIG_NCP_FS is not set +# CONFIG_NE2000 is not set +# CONFIG_NE2K_PCI is not set +# CONFIG_NEC_MARKEINS is not set +CONFIG_NET=y +# CONFIG_NETCONSOLE is not set +CONFIG_NETDEVICES=y +CONFIG_NETDEV_1000=y +# CONFIG_NETDEV_10000 is not set +# CONFIG_NETFILTER is not set +# CONFIG_NETFILTER_ADVANCED is not set +# CONFIG_NETFILTER_DEBUG is not set +# CONFIG_NETFILTER_NETLINK is not set +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_LOG is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +# CONFIG_NETFILTER_NETLINK_QUEUE_CT is not set +# CONFIG_NETFILTER_TPROXY is not set +# CONFIG_NETFILTER_XTABLES is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LAYER7 is not set +# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +# CONFIG_NETFILTER_XT_MATCH_OWNER is not set +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_POLICY is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +# CONFIG_NETFILTER_XT_MATCH_STATE is not set +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_CT is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TRACE is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_NETLINK_MMAP is not set +# CONFIG_NETPOLL is not set +# CONFIG_NETROM is not set +CONFIG_NETWORK_FILESYSTEMS=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETXEN_NIC is not set +# CONFIG_NET_9P is not set +# CONFIG_NET_ACT_CSUM is not set +# CONFIG_NET_ACT_GACT is not set +# CONFIG_NET_ACT_IPT is not set +# CONFIG_NET_ACT_MIRRED is not set +# CONFIG_NET_ACT_NAT is not set +# CONFIG_NET_ACT_PEDIT is not set +# CONFIG_NET_ACT_POLICE is not set +# CONFIG_NET_ACT_SIMP is not set +# CONFIG_NET_ACT_SKBEDIT is not set +CONFIG_NET_CADENCE=y +# CONFIG_NET_CALXEDA_XGMAC is not set +CONFIG_NET_CLS=y +# CONFIG_NET_CLS_ACT is not set +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_BPF is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_FW is not set +CONFIG_NET_CLS_IND=y +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_U32 is not set +CONFIG_NET_CORE=y +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_NET_DSA is not set +# CONFIG_NET_DSA_BCM_SF2 is not set +# CONFIG_NET_DSA_MV88E6060 is not set +# CONFIG_NET_DSA_MV88E6123_61_65 is not set +# CONFIG_NET_DSA_MV88E6131 is not set +# CONFIG_NET_DSA_MV88E6171 is not set +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +# CONFIG_NET_DSA_TAG_DSA is not set +# CONFIG_NET_DSA_TAG_EDSA is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_EMATCH_CMP is not set +# CONFIG_NET_EMATCH_META is not set +# CONFIG_NET_EMATCH_NBYTE is not set +CONFIG_NET_EMATCH_STACK=32 +# CONFIG_NET_EMATCH_TEXT is not set +# CONFIG_NET_EMATCH_U32 is not set +CONFIG_NET_ETHERNET=y +# CONFIG_NET_FC is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_IPGRE is not set +CONFIG_NET_IPGRE_BROADCAST=y +# CONFIG_NET_IPGRE_DEMUX is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPVTI is not set +# CONFIG_NET_IP_TUNNEL is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_KEY is not set +# CONFIG_NET_KEY_MIGRATE is not set +# CONFIG_NET_MPLS_GSO is not set +# CONFIG_NET_PACKET_ENGINE is not set +CONFIG_NET_PCI=y +# CONFIG_NET_PCMCIA is not set +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_POCKET is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_NET_PTP_CLASSIFY is not set +CONFIG_NET_RX_BUSY_POLL=y +# CONFIG_NET_SB1000 is not set +CONFIG_NET_SCHED=y +# CONFIG_NET_SCH_ATM is not set +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_CODEL is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_DSMARK is not set +CONFIG_NET_SCH_FIFO=y +# CONFIG_NET_SCH_FQ is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_HHF is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_INGRESS is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_PIE is not set +# CONFIG_NET_SCH_PLUG is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCTPPROBE is not set +# CONFIG_NET_TCPPROBE is not set +# CONFIG_NET_TEAM is not set +# CONFIG_NET_TULIP is not set +# CONFIG_NET_UDP_TUNNEL is not set +CONFIG_NET_VENDOR_3COM=y +CONFIG_NET_VENDOR_8390=y +CONFIG_NET_VENDOR_ADAPTEC=y +CONFIG_NET_VENDOR_AGERE=y +CONFIG_NET_VENDOR_ALTEON=y +CONFIG_NET_VENDOR_AMD=y +CONFIG_NET_VENDOR_ARC=y +CONFIG_NET_VENDOR_ATHEROS=y +CONFIG_NET_VENDOR_BROADCOM=y +CONFIG_NET_VENDOR_BROCADE=y +CONFIG_NET_VENDOR_CHELSIO=y +CONFIG_NET_VENDOR_CIRRUS=y +CONFIG_NET_VENDOR_CISCO=y +CONFIG_NET_VENDOR_DEC=y +CONFIG_NET_VENDOR_DLINK=y +CONFIG_NET_VENDOR_EMULEX=y +CONFIG_NET_VENDOR_EXAR=y +CONFIG_NET_VENDOR_FARADAY=y +CONFIG_NET_VENDOR_FREESCALE=y +CONFIG_NET_VENDOR_FUJITSU=y +CONFIG_NET_VENDOR_HISILICON=y +CONFIG_NET_VENDOR_HP=y +CONFIG_NET_VENDOR_I825XX=y +CONFIG_NET_VENDOR_IBM=y +CONFIG_NET_VENDOR_INTEL=y +CONFIG_NET_VENDOR_MARVELL=y +CONFIG_NET_VENDOR_MELLANOX=y +CONFIG_NET_VENDOR_MICREL=y +CONFIG_NET_VENDOR_MICROCHIP=y +CONFIG_NET_VENDOR_MYRI=y +CONFIG_NET_VENDOR_NATSEMI=y +CONFIG_NET_VENDOR_NVIDIA=y +CONFIG_NET_VENDOR_OKI=y +CONFIG_NET_VENDOR_QLOGIC=y +CONFIG_NET_VENDOR_QUALCOMM=y +CONFIG_NET_VENDOR_RDC=y +CONFIG_NET_VENDOR_REALTEK=y +CONFIG_NET_VENDOR_SAMSUNG=y +CONFIG_NET_VENDOR_SEEQ=y +CONFIG_NET_VENDOR_SILAN=y +CONFIG_NET_VENDOR_SILICOM=y +CONFIG_NET_VENDOR_SIS=y +CONFIG_NET_VENDOR_SMSC=y +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_NET_VENDOR_SUN=y +CONFIG_NET_VENDOR_TEHUTI=y +CONFIG_NET_VENDOR_TI=y +CONFIG_NET_VENDOR_TOSHIBA=y +CONFIG_NET_VENDOR_VIA=y +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_NET_VENDOR_XILINX=y +CONFIG_NET_VENDOR_XIRCOM=y +# CONFIG_NET_XGENE is not set +CONFIG_NEW_LEDS=y +# CONFIG_NFC is not set +# CONFIG_NFC_DEVICES is not set +# CONFIG_NFSD is not set +# CONFIG_NFSD_DEPRECATED is not set +# CONFIG_NFSD_V2_ACL is not set +CONFIG_NFSD_V3=y +# CONFIG_NFSD_V3_ACL is not set +# CONFIG_NFSD_V4 is not set +# CONFIG_NFS_ACL_SUPPORT is not set +CONFIG_NFS_COMMON=y +# CONFIG_NFS_FS is not set +# CONFIG_NFS_FSCACHE is not set +# CONFIG_NFS_SWAP is not set +# CONFIG_NFS_V2 is not set +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_V4_1 is not set +# CONFIG_NFTL is not set +# CONFIG_NF_CONNTRACK is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_FTP is not set +# CONFIG_NF_CONNTRACK_H323 is not set +# CONFIG_NF_CONNTRACK_IPV4 is not set +# CONFIG_NF_CONNTRACK_IPV6 is not set +# CONFIG_NF_CONNTRACK_IRC is not set +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +CONFIG_NF_CONNTRACK_PROCFS=y +# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set +# CONFIG_NF_CONNTRACK_RTSP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CONNTRACK_ZONES is not set +# CONFIG_NF_CT_NETLINK is not set +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_GRE is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_DEFRAG_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +# CONFIG_NF_NAT is not set +# CONFIG_NF_NAT_AMANDA is not set +# CONFIG_NF_NAT_FTP is not set +# CONFIG_NF_NAT_H323 is not set +# CONFIG_NF_NAT_IPV6 is not set +# CONFIG_NF_NAT_IRC is not set +# CONFIG_NF_NAT_MASQUERADE_IPV4 is not set +# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set +# CONFIG_NF_NAT_NEEDED is not set +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_PROTO_GRE is not set +# CONFIG_NF_NAT_RTSP is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_SNMP_BASIC is not set +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_REJECT_IPV4 is not set +# CONFIG_NF_REJECT_IPV6 is not set +# CONFIG_NF_TABLES is not set +# CONFIG_NI52 is not set +# CONFIG_NI65 is not set +# CONFIG_NILFS2_FS is not set +# CONFIG_NIU is not set +# CONFIG_NL80211_TESTMODE is not set +CONFIG_NLATTR=y +# CONFIG_NLMON is not set +# CONFIG_NLM_XLP_BOARD is not set +# CONFIG_NLM_XLR_BOARD is not set +# CONFIG_NLS is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +# CONFIG_NLS_UTF8 is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_NORTEL_HERMES is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_NOZOMI is not set +# CONFIG_NO_BOOTMEM is not set +# CONFIG_NO_HZ is not set +# CONFIG_NO_HZ_FULL is not set +# CONFIG_NO_HZ_IDLE is not set +# CONFIG_NO_IOPORT is not set +# CONFIG_NS83820 is not set +# CONFIG_NTFS_DEBUG is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +# CONFIG_NTP_PPS is not set +# CONFIG_NVRAM is not set +# CONFIG_NV_TCO is not set +# CONFIG_NXP_STB220 is not set +# CONFIG_NXP_STB225 is not set +# CONFIG_N_GSM is not set +# CONFIG_OABI_COMPAT is not set +# CONFIG_OBS600 is not set +# CONFIG_OCFS2_FS is not set +# CONFIG_OC_ETM is not set +# CONFIG_OF_SELFTEST is not set +# CONFIG_OMAP2_DSS_DEBUG is not set +# CONFIG_OMAP2_DSS_DEBUGFS is not set +# CONFIG_OMAP2_DSS_SDI is not set +# CONFIG_OMAP_CONTROL_USB is not set +# CONFIG_OMAP_OCP2SCP is not set +# CONFIG_OMAP_USB2 is not set +# CONFIG_OMAP_USB3 is not set +# CONFIG_OMFS_FS is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_OPROFILE is not set +# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set +# CONFIG_ORION_WATCHDOG is not set +# CONFIG_OSF_PARTITION is not set +CONFIG_OVERLAY_FS=y +# CONFIG_P54_COMMON is not set +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_PAGE_SIZE_16KB is not set +# CONFIG_PAGE_SIZE_32KB is not set +CONFIG_PAGE_SIZE_4KB=y +# CONFIG_PAGE_SIZE_64KB is not set +# CONFIG_PAGE_SIZE_8KB is not set +# CONFIG_PANEL is not set +CONFIG_PANIC_ON_OOPS=y +CONFIG_PANIC_ON_OOPS_VALUE=1 +CONFIG_PANIC_TIMEOUT=1 +# CONFIG_PANTHERLORD_FF is not set +# CONFIG_PARPORT is not set +# CONFIG_PARPORT_1284 is not set +# CONFIG_PARPORT_AX88796 is not set +# CONFIG_PARPORT_PC is not set +CONFIG_PARTITION_ADVANCED=y +# CONFIG_PATA_ALI is not set +# CONFIG_PATA_AMD is not set +# CONFIG_PATA_ARASAN_CF is not set +# CONFIG_PATA_ARTOP is not set +# CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_ATP867X is not set +# CONFIG_PATA_CMD640_PCI is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CS5520 is not set +# CONFIG_PATA_CS5530 is not set +# CONFIG_PATA_CS5535 is not set +# CONFIG_PATA_CS5536 is not set +# CONFIG_PATA_CYPRESS is not set +# CONFIG_PATA_EFAR is not set +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +# CONFIG_PATA_ISAPNP is not set +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_IT821X is not set +# CONFIG_PATA_JMICRON is not set +# CONFIG_PATA_LEGACY is not set +# CONFIG_PATA_MARVELL is not set +# CONFIG_PATA_MPIIX is not set +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NINJA32 is not set +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_NS87415 is not set +# CONFIG_PATA_OCTEON_CF is not set +# CONFIG_PATA_OF_PLATFORM is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_OPTIDMA is not set +# CONFIG_PATA_PCMCIA is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_PDC_OLD is not set +# CONFIG_PATA_PLATFORM is not set +# CONFIG_PATA_QDI is not set +# CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RDC is not set +# CONFIG_PATA_RZ1000 is not set +# CONFIG_PATA_SC1200 is not set +# CONFIG_PATA_SCH is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_SIL680 is not set +# CONFIG_PATA_SIS is not set +# CONFIG_PATA_TOSHIBA is not set +# CONFIG_PATA_TRIFLEX is not set +# CONFIG_PATA_VIA is not set +# CONFIG_PATA_WINBOND is not set +# CONFIG_PATA_WINBOND_VLB is not set +# CONFIG_PC300TOO is not set +# CONFIG_PCCARD is not set +# CONFIG_PCH_GBE is not set +# CONFIG_PCH_PHUB is not set +# CONFIG_PCI200SYN is not set +# CONFIG_PCIEAER_INJECT is not set +# CONFIG_PCIEASPM is not set +# CONFIG_PCIEPORTBUS is not set +# CONFIG_PCIE_ECRC is not set +# CONFIG_PCIPCWATCHDOG is not set +# CONFIG_PCI_ATMEL is not set +# CONFIG_PCI_CNB20LE_QUIRK is not set +# CONFIG_PCI_DEBUG is not set +# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set +# CONFIG_PCI_HERMES is not set +# CONFIG_PCI_HOST_GENERIC is not set +# CONFIG_PCI_IOV is not set +# CONFIG_PCI_MSI is not set +# CONFIG_PCI_PASID is not set +# CONFIG_PCI_PRI is not set +CONFIG_PCI_QUIRKS=y +# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set +# CONFIG_PCI_STUB is not set +CONFIG_PCI_SYSCALL=y +# CONFIG_PCMCIA is not set +# CONFIG_PCMCIA_3C574 is not set +# CONFIG_PCMCIA_3C589 is not set +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_ATMEL is not set +# CONFIG_PCMCIA_AXNET is not set +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_FMVJ18X is not set +# CONFIG_PCMCIA_HERMES is not set +# CONFIG_PCMCIA_LOAD_CIS is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_NMCLAN is not set +# CONFIG_PCMCIA_PCNET is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_RAYCS is not set +# CONFIG_PCMCIA_SMC91C92 is not set +# CONFIG_PCMCIA_SPECTRUM is not set +# CONFIG_PCMCIA_SYM53C500 is not set +# CONFIG_PCMCIA_WL3501 is not set +# CONFIG_PCMCIA_XIRC2PS is not set +# CONFIG_PCMCIA_XIRCOM is not set +# CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set +# CONFIG_PD6729 is not set +# CONFIG_PDA_POWER is not set +# CONFIG_PDC_ADMA is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_PERF_COUNTERS is not set +# CONFIG_PERF_EVENTS is not set +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_PHANTOM is not set +# CONFIG_PHONE is not set +# CONFIG_PHONET is not set +# CONFIG_PHYLIB is not set +# CONFIG_PHYS_ADDR_T_64BIT is not set +# CONFIG_PHY_EXYNOS_DP_VIDEO is not set +# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set +# CONFIG_PHY_QCOM_DWC3 is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_PID_NS is not set +CONFIG_PINCONF=y +# CONFIG_PINCTRL is not set +# CONFIG_PINCTRL_CAPRI is not set +# CONFIG_PINCTRL_EXYNOS is not set +# CONFIG_PINCTRL_EXYNOS5440 is not set +# CONFIG_PINCTRL_MSM8X74 is not set +CONFIG_PINCTRL_SINGLE=y +CONFIG_PINMUX=y +# CONFIG_PLAT_SPEAR is not set +# CONFIG_PLIP is not set +# CONFIG_PLX_HERMES is not set +# CONFIG_PM is not set +# CONFIG_PMBUS is not set +# CONFIG_PMC_MSP is not set +# CONFIG_PMC_YOSEMITE is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_DEVFREQ is not set +# CONFIG_PM_RUNTIME is not set +# CONFIG_PM_WAKELOCKS is not set +# CONFIG_PNX8550_JBS is not set +# CONFIG_PNX8550_STB810 is not set +# CONFIG_POHMELFS is not set +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_POWERCAP is not set +# CONFIG_POWERTV is not set +# CONFIG_POWER_AVS is not set +# CONFIG_POWER_RESET is not set +# CONFIG_POWER_RESET_RESTART is not set +# CONFIG_POWER_RESET_VERSATILE is not set +# CONFIG_POWER_SUPPLY is not set +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PPC4xx_GPIO is not set +# CONFIG_PPC_16K_PAGES is not set +# CONFIG_PPC_256K_PAGES is not set +CONFIG_PPC_4K_PAGES=y +# CONFIG_PPC_64K_PAGES is not set +# CONFIG_PPC_DISABLE_WERROR is not set +# CONFIG_PPC_EMULATED_STATS is not set +# CONFIG_PPC_EPAPR_HV_BYTECHAN is not set +# CONFIG_PPP is not set +# CONFIG_PPPOATM is not set +# CONFIG_PPPOE is not set +# CONFIG_PPPOL2TP is not set +# CONFIG_PPP_ASYNC is not set +# CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPP_DEFLATE is not set +CONFIG_PPP_FILTER=y +# CONFIG_PPP_MPPE is not set +CONFIG_PPP_MULTILINK=y +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_PPS is not set +# CONFIG_PPS_CLIENT_GPIO is not set +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_PARPORT is not set +# CONFIG_PPS_DEBUG is not set +# CONFIG_PPTP is not set +# CONFIG_PREEMPT is not set +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_TRACER is not set +# CONFIG_PREEMPT_VOLUNTARY is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_PRINTK=y +# CONFIG_PRINTK_TIME is not set +CONFIG_PRINT_STACK_DEPTH=64 +# CONFIG_PRISM2_USB is not set +# CONFIG_PRISM54 is not set +# CONFIG_PROBE_INITRD_HEADER is not set +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +# CONFIG_PROC_PAGE_MONITOR is not set +CONFIG_PROC_STRIPPED=y +CONFIG_PROC_SYSCTL=y +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILING is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_PROVE_RCU is not set +# CONFIG_PROVE_RCU_DELAY is not set +# CONFIG_PSB6970_PHY is not set +# CONFIG_PSTORE is not set +# CONFIG_PTP_1588_CLOCK is not set +# CONFIG_PTP_1588_CLOCK_IXP46X is not set +# CONFIG_PTP_1588_CLOCK_PCH is not set +# CONFIG_PWM is not set +# CONFIG_PWM_PCA9685 is not set +# CONFIG_QCA7000 is not set +# CONFIG_QLA3XXX is not set +# CONFIG_QLCNIC is not set +# CONFIG_QLGE is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +# CONFIG_QUOTA_DEBUG is not set +# CONFIG_R3964 is not set +# CONFIG_R6040 is not set +# CONFIG_R8169 is not set +# CONFIG_R8187SE is not set +# CONFIG_R8188EU is not set +# CONFIG_R8712U is not set +# CONFIG_R8723AU is not set +# CONFIG_RADIO_ADAPTERS is not set +# CONFIG_RADIO_AZTECH is not set +# CONFIG_RADIO_CADET is not set +# CONFIG_RADIO_GEMTEK is not set +# CONFIG_RADIO_MAXIRADIO is not set +# CONFIG_RADIO_RTRACK is not set +# CONFIG_RADIO_RTRACK2 is not set +# CONFIG_RADIO_SF16FMI is not set +# CONFIG_RADIO_SF16FMR2 is not set +# CONFIG_RADIO_TERRATEC is not set +# CONFIG_RADIO_TRUST is not set +# CONFIG_RADIO_TYPHOON is not set +# CONFIG_RADIO_ZOLTRIX is not set +# CONFIG_RAID_ATTRS is not set +# CONFIG_RALINK is not set +# CONFIG_RAMOOPS is not set +# CONFIG_RANDOM32_SELFTEST is not set +# CONFIG_RAPIDIO is not set +# CONFIG_RAR_REGISTER is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_RCU_CPU_STALL_INFO is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +CONFIG_RCU_FANOUT=32 +# CONFIG_RCU_FANOUT_EXACT is not set +CONFIG_RCU_FANOUT_LEAF=16 +# CONFIG_RCU_FAST_NO_HZ is not set +# CONFIG_RCU_NOCB_CPU is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_USER_QS is not set +# CONFIG_RC_ATI_REMOTE is not set +# CONFIG_RC_CORE is not set +# CONFIG_RC_DECODERS is not set +# CONFIG_RC_LOOPBACK is not set +# CONFIG_RC_MAP is not set +# CONFIG_RDS is not set +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_GZIP is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_XZ is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_REDWOOD is not set +# CONFIG_REGMAP is not set +# CONFIG_REGMAP_I2C is not set +# CONFIG_REGMAP_MMIO is not set +# CONFIG_REGMAP_SPI is not set +# CONFIG_REGULATOR is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_BQ24022 is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_FIXED_VOLTAGE is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_TI_ABB is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_REISERFS_FS_POSIX_ACL is not set +# CONFIG_REISERFS_FS_SECURITY is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_RELAY is not set +# CONFIG_RESET_CONTROLLER is not set +# CONFIG_RFD_FTL is not set +# CONFIG_RFKILL is not set +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL_REGULATOR is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_ROSE is not set +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RT2X00 is not set +# CONFIG_RTC_CLASS is not set +# CONFIG_RTC_DEBUG is not set +# CONFIG_RTC_DRV_AU1XXX is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_BQ4802 is not set +CONFIG_RTC_DRV_CMOS=y +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_EP93XX is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_GENERIC is not set +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_MCP795 is not set +# CONFIG_RTC_DRV_MOXART is not set +# CONFIG_RTC_DRV_MPC5121 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_OMAP is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_PS3 is not set +# CONFIG_RTC_DRV_PT7C4338 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_RTC7301 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_SNVS is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_SUN6I is not set +# CONFIG_RTC_DRV_TEST is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_XGENE is not set +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_LIB=y +CONFIG_RTC_SYSTOHC=y +# CONFIG_RTL8180 is not set +# CONFIG_RTL8187 is not set +# CONFIG_RTL8192E is not set +# CONFIG_RTL8192U is not set +# CONFIG_RTL8306_PHY is not set +# CONFIG_RTL8366RB_PHY is not set +# CONFIG_RTL8366S_PHY is not set +# CONFIG_RTL8366_SMI is not set +# CONFIG_RTL8366_SMI_DEBUG_FS is not set +# CONFIG_RTL8367B_PHY is not set +# CONFIG_RTL8367_PHY is not set +# CONFIG_RTLLIB is not set +# CONFIG_RTL_CARDS is not set +# CONFIG_RTS5139 is not set +# CONFIG_RTS5208 is not set +# CONFIG_RTS_PSTOR is not set +CONFIG_RT_MUTEXES=y +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_RUNTIME_DEBUG is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_S2IO is not set +# CONFIG_SAMPLES is not set +# CONFIG_SAMSUNG_LAPTOP is not set +# CONFIG_SAMSUNG_USB2PHY is not set +# CONFIG_SAMSUNG_USB3PHY is not set +# CONFIG_SATA_ACARD_AHCI is not set +# CONFIG_SATA_AHCI is not set +# CONFIG_SATA_AHCI_PLATFORM is not set +# CONFIG_SATA_DWC is not set +# CONFIG_SATA_FSL is not set +# CONFIG_SATA_HIGHBANK is not set +# CONFIG_SATA_INIC162X is not set +# CONFIG_SATA_MV is not set +# CONFIG_SATA_NV is not set +# CONFIG_SATA_PMP is not set +# CONFIG_SATA_PROMISE is not set +# CONFIG_SATA_QSTOR is not set +# CONFIG_SATA_RCAR is not set +# CONFIG_SATA_SIL is not set +# CONFIG_SATA_SIL24 is not set +# CONFIG_SATA_SIS is not set +# CONFIG_SATA_SVW is not set +# CONFIG_SATA_SX4 is not set +# CONFIG_SATA_ULI is not set +# CONFIG_SATA_VIA is not set +# CONFIG_SATA_VITESSE is not set +# CONFIG_SBC_FITPC2_WATCHDOG is not set +# CONFIG_SBE_2T3E3 is not set +# CONFIG_SBYPASS is not set +# CONFIG_SC92031 is not set +# CONFIG_SCA3000 is not set +# CONFIG_SCC is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHED_MC is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCHED_SMT is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_SCSI is not set +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_3W_SAS is not set +# CONFIG_SCSI_7000FASST is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_AHA152X is not set +# CONFIG_SCSI_AHA1542 is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_AIC94XX is not set +# CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_BFA_FC is not set +# CONFIG_SCSI_BNX2X_FCOE is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_SCSI_CHELSIO_FCOE is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_CXGB4_ISCSI is not set +# CONFIG_SCSI_DC390T is not set +# CONFIG_SCSI_DC395x is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_DPT_I2O is not set +# CONFIG_SCSI_DTC3280 is not set +# CONFIG_SCSI_EATA is not set +# CONFIG_SCSI_ESAS2R is not set +# CONFIG_SCSI_FC_ATTRS is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_GENERIC_NCR5380 is not set +# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set +# CONFIG_SCSI_HPSA is not set +# CONFIG_SCSI_HPTIOP is not set +# CONFIG_SCSI_IN2000 is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_IPR is not set +# CONFIG_SCSI_IPS is not set +# CONFIG_SCSI_ISCI is not set +# CONFIG_SCSI_ISCSI_ATTRS is not set +# CONFIG_SCSI_LOGGING is not set +CONFIG_SCSI_LOWLEVEL=y +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +# CONFIG_SCSI_LPFC is not set +CONFIG_SCSI_MOD=y +# CONFIG_SCSI_MPT2SAS is not set +# CONFIG_SCSI_MPT3SAS is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_MVSAS is not set +# CONFIG_SCSI_MVSAS_DEBUG is not set +# CONFIG_SCSI_MVUMI is not set +# CONFIG_SCSI_NCR53C406A is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_NSP32 is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_SCSI_PAS16 is not set +# CONFIG_SCSI_PM8001 is not set +# CONFIG_SCSI_PMCRAID is not set +CONFIG_SCSI_PROC_FS=y +# CONFIG_SCSI_QLA_FC is not set +# CONFIG_SCSI_QLA_ISCSI is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_QLOGIC_FAS is not set +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SCAN_ASYNC is not set +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_SRP is not set +# CONFIG_SCSI_SRP_ATTRS is not set +# CONFIG_SCSI_STEX is not set +# CONFIG_SCSI_SYM53C416 is not set +# CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_T128 is not set +# CONFIG_SCSI_TGT is not set +# CONFIG_SCSI_U14_34F is not set +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_ULTRASTOR is not set +# CONFIG_SCSI_VIRTIO is not set +# CONFIG_SCx200_ACB is not set +# CONFIG_SDIO_UART is not set +# CONFIG_SECCOMP is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_SECURITY_DMESG_RESTRICT=y +# CONFIG_SEEQ8005 is not set +CONFIG_SELECT_MEMORY_MODEL=y +# CONFIG_SENSORS_ABITUGURU is not set +# CONFIG_SENSORS_ABITUGURU3 is not set +# CONFIG_SENSORS_ACPI_POWER is not set +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_SENSORS_APPLESMC is not set +# CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATK0110 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_CORETEMP is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_FAM15H_POWER is not set +# CONFIG_SENSORS_FSCHMD is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_GSC is not set +# CONFIG_SENSORS_HDAPS is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_HMC5843 is not set +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_I5500 is not set +# CONFIG_SENSORS_I5K_AMB is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_ISL29018 is not set +# CONFIG_SENSORS_ISL29028 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_JZ4740 is not set +# CONFIG_SENSORS_K10TEMP is not set +# CONFIG_SENSORS_K8TEMP is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_SENSORS_LIS3_I2C is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_TSL2563 is not set +# CONFIG_SENSORS_VEXPRESS is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VIA_CPUTEMP is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_ACCENT is not set +# CONFIG_SERIAL_8250_BOCA is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_CS is not set +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +CONFIG_SERIAL_8250_DMA=y +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SERIAL_8250_FINTEK is not set +# CONFIG_SERIAL_8250_FOURPORT is not set +# CONFIG_SERIAL_8250_HUB6 is not set +# CONFIG_SERIAL_8250_MANY_PORTS is not set +CONFIG_SERIAL_8250_NR_UARTS=2 +# CONFIG_SERIAL_8250_PCI is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_RUNTIME_UARTS=2 +# CONFIG_SERIAL_8250_SYSRQ is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_ARC is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_EARLYCON=y +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_JSM is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX3107 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_MFD_HSU is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_SERIAL_OF_PLATFORM is not set +# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set +# CONFIG_SERIAL_PCH_UART is not set +# CONFIG_SERIAL_RP2 is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SH_SCI is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_TIMBERDALE is not set +# CONFIG_SERIAL_UARTLITE is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIO is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_AMBAKMI is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_I8042 is not set +# CONFIG_SERIO_LIBPS2 is not set +# CONFIG_SERIO_PARKBD is not set +# CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_SERPORT is not set +# CONFIG_SFC is not set +# CONFIG_SFI is not set +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SGI_IOC4 is not set +# CONFIG_SGI_IP22 is not set +# CONFIG_SGI_IP27 is not set +# CONFIG_SGI_IP28 is not set +# CONFIG_SGI_IP32 is not set +# CONFIG_SGI_PARTITION is not set +CONFIG_SHMEM=y +# CONFIG_SH_ETH is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_SI7005 is not set +# CONFIG_SIBYTE_BIGSUR is not set +# CONFIG_SIBYTE_CARMEL is not set +# CONFIG_SIBYTE_CRHINE is not set +# CONFIG_SIBYTE_CRHONE is not set +# CONFIG_SIBYTE_LITTLESUR is not set +# CONFIG_SIBYTE_RHONE is not set +# CONFIG_SIBYTE_SENTOSA is not set +# CONFIG_SIBYTE_SWARM is not set +# CONFIG_SIGMA is not set +CONFIG_SIGNALFD=y +# CONFIG_SIMPLE_GPIO is not set +# CONFIG_SIS190 is not set +# CONFIG_SIS900 is not set +# CONFIG_SKGE is not set +# CONFIG_SKY2 is not set +# CONFIG_SKY2_DEBUG is not set +CONFIG_SLAB=y +CONFIG_SLABINFO=y +# CONFIG_SLHC is not set +# CONFIG_SLICOSS is not set +# CONFIG_SLIP is not set +# CONFIG_SLOB is not set +# CONFIG_SLUB is not set +# CONFIG_SLUB_DEBUG is not set +# CONFIG_SLUB_STATS is not set +# CONFIG_SMARTJOYPLUS_FF is not set +# CONFIG_SMC911X is not set +# CONFIG_SMC9194 is not set +# CONFIG_SMC91X is not set +# CONFIG_SMP is not set +# CONFIG_SMSC911X is not set +# CONFIG_SMSC9420 is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_SM_FTL is not set +# CONFIG_SND is not set +# CONFIG_SND_AC97_POWER_SAVE is not set +# CONFIG_SND_AD1816A is not set +# CONFIG_SND_AD1848 is not set +# CONFIG_SND_AD1889 is not set +# CONFIG_SND_ADLIB is not set +# CONFIG_SND_ALI5451 is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_ALS100 is not set +# CONFIG_SND_ALS300 is not set +# CONFIG_SND_ALS4000 is not set +# CONFIG_SND_ARM is not set +# CONFIG_SND_ASIHPI is not set +# CONFIG_SND_ATIIXP is not set +# CONFIG_SND_ATIIXP_MODEM is not set +# CONFIG_SND_ATMEL_AC97C is not set +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_AU8810 is not set +# CONFIG_SND_AU8820 is not set +# CONFIG_SND_AU8830 is not set +# CONFIG_SND_AW2 is not set +# CONFIG_SND_AZT2320 is not set +# CONFIG_SND_AZT3328 is not set +# CONFIG_SND_BCD2000 is not set +# CONFIG_SND_BT87X is not set +# CONFIG_SND_CA0106 is not set +# CONFIG_SND_CMI8330 is not set +# CONFIG_SND_CMIPCI is not set +# CONFIG_SND_CS4231 is not set +# CONFIG_SND_CS4236 is not set +# CONFIG_SND_CS4281 is not set +# CONFIG_SND_CS46XX is not set +# CONFIG_SND_CS5530 is not set +# CONFIG_SND_CS5535AUDIO is not set +# CONFIG_SND_CTXFI is not set +# CONFIG_SND_DARLA20 is not set +# CONFIG_SND_DARLA24 is not set +# CONFIG_SND_DEBUG is not set +# CONFIG_SND_DESIGNWARE_I2S is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_DYNAMIC_MINORS is not set +# CONFIG_SND_ECHO3G is not set +# CONFIG_SND_EMU10K1 is not set +# CONFIG_SND_EMU10K1X is not set +# CONFIG_SND_ENS1370 is not set +# CONFIG_SND_ENS1371 is not set +# CONFIG_SND_ES1688 is not set +# CONFIG_SND_ES18XX is not set +# CONFIG_SND_ES1938 is not set +# CONFIG_SND_ES1968 is not set +# CONFIG_SND_FIREWIRE is not set +# CONFIG_SND_FM801 is not set +# CONFIG_SND_GINA20 is not set +# CONFIG_SND_GINA24 is not set +# CONFIG_SND_GUSCLASSIC is not set +# CONFIG_SND_GUSEXTREME is not set +# CONFIG_SND_GUSMAX is not set +# CONFIG_SND_HDA_INPUT_JACK is not set +# CONFIG_SND_HDA_INTEL is not set +CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 +CONFIG_SND_HDA_PREALLOC_SIZE=64 +# CONFIG_SND_HDSP is not set +# CONFIG_SND_HDSPM is not set +# CONFIG_SND_HRTIMER is not set +# CONFIG_SND_HWDEP is not set +# CONFIG_SND_ICE1712 is not set +# CONFIG_SND_ICE1724 is not set +# CONFIG_SND_INDIGO is not set +# CONFIG_SND_INDIGODJ is not set +# CONFIG_SND_INDIGODJX is not set +# CONFIG_SND_INDIGOIO is not set +# CONFIG_SND_INDIGOIOX is not set +# CONFIG_SND_INTEL8X0 is not set +# CONFIG_SND_INTEL8X0M is not set +# CONFIG_SND_INTERWAVE is not set +# CONFIG_SND_INTERWAVE_STB is not set +# CONFIG_SND_ISA is not set +# CONFIG_SND_KIRKWOOD_SOC is not set +# CONFIG_SND_KORG1212 is not set +# CONFIG_SND_LAYLA20 is not set +# CONFIG_SND_LAYLA24 is not set +# CONFIG_SND_LOLA is not set +# CONFIG_SND_LX6464ES is not set +# CONFIG_SND_MAESTRO3 is not set +# CONFIG_SND_MIA is not set +# CONFIG_SND_MIPS is not set +# CONFIG_SND_MIRO is not set +# CONFIG_SND_MIXART is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_MONA is not set +# CONFIG_SND_MPC52xx_SOC_EFIKA is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_MTS64 is not set +# CONFIG_SND_MXS_SOC is not set +# CONFIG_SND_NM256 is not set +# CONFIG_SND_OPL3SA2 is not set +# CONFIG_SND_OPTI92X_AD1848 is not set +# CONFIG_SND_OPTI92X_CS4231 is not set +# CONFIG_SND_OPTI93X is not set +CONFIG_SND_OSSEMUL=y +# CONFIG_SND_OXYGEN is not set +CONFIG_SND_PCI=y +# CONFIG_SND_PCM is not set +# CONFIG_SND_PCMCIA is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_OSS_PLUGINS=y +# CONFIG_SND_PCXHR is not set +# CONFIG_SND_PDAUDIOCF is not set +# CONFIG_SND_PORTMAN2X4 is not set +# CONFIG_SND_POWERPC_SOC is not set +# CONFIG_SND_PPC is not set +# CONFIG_SND_RAWMIDI is not set +# CONFIG_SND_RIPTIDE is not set +# CONFIG_SND_RME32 is not set +# CONFIG_SND_RME96 is not set +# CONFIG_SND_RME9652 is not set +# CONFIG_SND_RTCTIMER is not set +# CONFIG_SND_SB16 is not set +# CONFIG_SND_SB8 is not set +# CONFIG_SND_SBAWE is not set +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SND_SIS7019 is not set +# CONFIG_SND_SOC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_AU1XAUDIO is not set +# CONFIG_SND_SOC_AU1XPSC is not set +# CONFIG_SND_SOC_CACHE_LZO is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271 is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_EUKREA_TLV320 is not set +# CONFIG_SND_SOC_FSL_ASOC_CARD is not set +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_HDMI_CODEC is not set +# CONFIG_SND_SOC_IMX_ES8328 is not set +# CONFIG_SND_SOC_IMX_SPDIF is not set +# CONFIG_SND_SOC_IMX_WM8962 is not set +# CONFIG_SND_SOC_INTEL_SST is not set +# CONFIG_SND_SOC_MPC5200_AC97 is not set +# CONFIG_SND_SOC_MPC5200_I2S is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +# CONFIG_SND_SOC_SPDIF is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804 is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SONICVIBES is not set +# CONFIG_SND_SPI is not set +# CONFIG_SND_SSCAPE is not set +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_TIMER is not set +# CONFIG_SND_TRIDENT is not set +CONFIG_SND_USB=y +# CONFIG_SND_USB_6FIRE is not set +# CONFIG_SND_USB_AUDIO is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_HIFACE is not set +# CONFIG_SND_USB_UA101 is not set +# CONFIG_SND_USB_US122L is not set +# CONFIG_SND_USB_USX2Y is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VIA82XX is not set +# CONFIG_SND_VIA82XX_MODEM is not set +# CONFIG_SND_VIRTUOSO is not set +# CONFIG_SND_VX222 is not set +# CONFIG_SND_VXPOCKET is not set +# CONFIG_SND_WAVEFRONT is not set +# CONFIG_SND_YMFPCI is not set +# CONFIG_SNI_RM is not set +# CONFIG_SOC_AM33XX is not set +# CONFIG_SOC_AM43XX is not set +# CONFIG_SOC_CAMERA is not set +# CONFIG_SOC_DRA7XX is not set +# CONFIG_SOC_HAS_OMAP2_SDRC is not set +# CONFIG_SOC_OMAP5 is not set +# CONFIG_SOC_TI is not set +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_SOLO6X10 is not set +# CONFIG_SONYPI is not set +# CONFIG_SONY_LAPTOP is not set +# CONFIG_SOUND is not set +# CONFIG_SOUND_PRIME is not set +# CONFIG_SP5100_TCO is not set +# CONFIG_SPARSEMEM_MANUAL is not set +# CONFIG_SPARSEMEM_STATIC is not set +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set +# CONFIG_SPARSE_IRQ is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_SPEAKUP is not set +# CONFIG_SPI is not set +# CONFIG_SPINLOCK_TEST is not set +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AU1550 is not set +# CONFIG_SPI_BCM2835 is not set +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_BUTTERFLY is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DEBUG is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_FSL_DSPI is not set +# CONFIG_SPI_FSL_ESPI is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_GPIO_OLD is not set +# CONFIG_SPI_LM70_LLP is not set +# CONFIG_SPI_MASTER is not set +# CONFIG_SPI_MPC52xx is not set +# CONFIG_SPI_MPC52xx_PSC is not set +# CONFIG_SPI_OCTEON is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_ORION is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PPC4xx is not set +# CONFIG_SPI_PXA2XX is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_RAMIPS is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_SPIDEV is not set +# CONFIG_SPI_TI_QSPI is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPI_TOPCLIFF_PCH is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_XWAY is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_SPMI is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +CONFIG_SQUASHFS_EMBEDDED=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_SQUASHFS_LZO is not set +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_XZ=y +# CONFIG_SQUASHFS_ZLIB is not set +# CONFIG_SRAM is not set +# CONFIG_SSB is not set +# CONFIG_SSBI is not set +# CONFIG_SSB_DEBUG is not set +# CONFIG_SSB_DRIVER_GPIO is not set +# CONFIG_SSB_PCMCIAHOST is not set +CONFIG_SSB_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_SILENT is not set +# CONFIG_SSFDC is not set +# CONFIG_STACKTRACE is not set +CONFIG_STACKTRACE_SUPPORT=y +# CONFIG_STACK_TRACER is not set +CONFIG_STAGING=y +# CONFIG_STAGING_MEDIA is not set +CONFIG_STANDALONE=y +CONFIG_STDBINUTILS=y +# CONFIG_STE10XP is not set +# CONFIG_STE_MODEM_RPROC is not set +# CONFIG_STMMAC_ETH is not set +# CONFIG_STMMAC_PCI is not set +# CONFIG_STMMAC_PLATFORM is not set +CONFIG_STP=y +# CONFIG_STRICT_DEVMEM is not set +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_STUB_POULSBO is not set +# CONFIG_SUNDANCE is not set +# CONFIG_SUNGEM is not set +# CONFIG_SUNRPC is not set +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_SUNRPC_GSS is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_SUSPEND is not set +CONFIG_SWAP=y +# CONFIG_SWCONFIG is not set +# CONFIG_SWCONFIG_B53 is not set +# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set +# CONFIG_SWCONFIG_LEDS is not set +# CONFIG_SXGBE_ETH is not set +# CONFIG_SYNCLINK_CS is not set +CONFIG_SYN_COOKIES=y +CONFIG_SYSCTL=y +# CONFIG_SYSCTL_SYSCALL is not set +# CONFIG_SYSCTL_SYSCALL_CHECK is not set +CONFIG_SYSFS=y +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_SYSFS_DEPRECATED_V2 is not set +# CONFIG_SYSFS_SYSCALL is not set +# CONFIG_SYSTEMPORT is not set +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +# CONFIG_SYSV68_PARTITION is not set +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +# CONFIG_SYSV_FS is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_T5403 is not set +# CONFIG_TARGET_CORE is not set +# CONFIG_TASKSTATS is not set +# CONFIG_TASKS_RCU is not set +# CONFIG_TC35815 is not set +# CONFIG_TCG_ATMEL is not set +# CONFIG_TCG_INFINEON is not set +# CONFIG_TCG_ST33_I2C is not set +# CONFIG_TCG_TIS is not set +# CONFIG_TCG_TIS_I2C_ATMEL is not set +# CONFIG_TCG_TIS_I2C_INFINEON is not set +# CONFIG_TCG_TIS_I2C_NUVOTON is not set +# CONFIG_TCG_TIS_ST33ZP24 is not set +# CONFIG_TCG_TPM is not set +# CONFIG_TCG_XEN is not set +# CONFIG_TCIC is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_DCTCP is not set +# CONFIG_TCP_CONG_HSTCP is not set +# CONFIG_TCP_CONG_HTCP is not set +# CONFIG_TCP_CONG_HYBLA is not set +# CONFIG_TCP_CONG_ILLINOIS is not set +# CONFIG_TCP_CONG_LP is not set +# CONFIG_TCP_CONG_SCALABLE is not set +# CONFIG_TCP_CONG_VEGAS is not set +# CONFIG_TCP_CONG_VENO is not set +# CONFIG_TCP_CONG_WESTWOOD is not set +# CONFIG_TCP_CONG_YEAH is not set +# CONFIG_TCP_MD5SIG is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +# CONFIG_TEGRA_HOST1X is not set +# CONFIG_TEHUTI is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_MODULE is not set +# CONFIG_TEST_POWER is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_TEST_USER_COPY is not set +CONFIG_TEXTSEARCH=y +# CONFIG_TEXTSEARCH_BM is not set +# CONFIG_TEXTSEARCH_FSM is not set +# CONFIG_TEXTSEARCH_KMP is not set +# CONFIG_THERMAL is not set +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_HWMON is not set +# CONFIG_THRUSTMASTER_FF is not set +# CONFIG_THUNDERBOLT is not set +# CONFIG_TICK_CPU_ACCOUNTING is not set +CONFIG_TICK_ONESHOT=y +# CONFIG_TIFM_CORE is not set +# CONFIG_TIGON3 is not set +# CONFIG_TIMB_DMA is not set +CONFIG_TIMERFD=y +# CONFIG_TIMER_STATS is not set +CONFIG_TINY_RCU=y +# CONFIG_TIPC is not set +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_TI_AM335X_ADC is not set +# CONFIG_TI_CPSW is not set +# CONFIG_TI_CPTS is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_TI_DAVINCI_CPDMA is not set +# CONFIG_TI_DAVINCI_MDIO is not set +# CONFIG_TI_ST is not set +# CONFIG_TLAN is not set +# CONFIG_TMD_HERMES is not set +# CONFIG_TMP006 is not set +CONFIG_TMPFS=y +# CONFIG_TMPFS_POSIX_ACL is not set +CONFIG_TMPFS_XATTR=y +# CONFIG_TORTURE_TEST is not set +# CONFIG_TOSHIBA_HAPS is not set +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AD7879_I2C is not set +# CONFIG_TOUCHSCREEN_AD7879_SPI is not set +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_S3C2410 is not set +# CONFIG_TOUCHSCREEN_ST1232 is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set +# CONFIG_TOUCHSCREEN_W90X900 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_TR is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_TRACER_SNAPSHOT is not set +# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set +# CONFIG_TRACE_BRANCH_PROFILING is not set +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +# CONFIG_TRACE_SINK is not set +CONFIG_TRACING_SUPPORT=y +CONFIG_TRAD_SIGNALS=y +# CONFIG_TRANSPARENT_HUGEPAGE is not set +# CONFIG_TRANZPORT is not set +# CONFIG_TREE_PREEMPT_RCU is not set +# CONFIG_TREE_RCU is not set +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_TRUSTED_KEYS is not set +# CONFIG_TSL2583 is not set +# CONFIG_TSL2x7x is not set +# CONFIG_TSL4531 is not set +CONFIG_TTY=y +# CONFIG_TTY_PRINTK is not set +# CONFIG_TUN is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL4030_MADC is not set +# CONFIG_TWL6030_GPADC is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_TYPHOON is not set +# CONFIG_UACCESS_WITH_MEMCPY is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_UDF_FS is not set +CONFIG_UDF_NLS=y +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +# CONFIG_UFS_FS is not set +# CONFIG_UHID is not set +CONFIG_UIDGID_STRICT_TYPE_CHECKS=y +# CONFIG_UIO is not set +# CONFIG_ULTRA is not set +# CONFIG_ULTRIX_PARTITION is not set +CONFIG_UNIX=y +CONFIG_UNIX98_PTYS=y +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_UNIX_DIAG is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_UPROBES is not set +# CONFIG_UPROBE_EVENT is not set +# CONFIG_USB is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USBPCWATCHDOG is not set +# CONFIG_USB_ACM is not set +# CONFIG_USB_ADUTUX is not set +CONFIG_USB_ALI_M5632=y +# CONFIG_USB_AMD5536UDC is not set +CONFIG_USB_AN2720=y +# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set +# CONFIG_USB_APPLEDISPLAY is not set +CONFIG_USB_ARCH_HAS_EHCI=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARMLINUX=y +# CONFIG_USB_ATM is not set +CONFIG_USB_BELKIN=y +# CONFIG_USB_BTMTK is not set +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_CATC is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_CONFIGFS is not set +# CONFIG_USB_CXACRU is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_DEBUG is not set +CONFIG_USB_DEFAULT_PERSIST=y +CONFIG_USB_DEVICEFS=y +# CONFIG_USB_DEVICE_CLASS is not set +# CONFIG_USB_DSBR is not set +# CONFIG_USB_DUMMY_HCD is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_DWC2_DUAL_ROLE is not set +# CONFIG_USB_DWC2_HOST is not set +# CONFIG_USB_DWC2_PERIPHERAL is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC3_EXYNOS is not set +# CONFIG_USB_DWC3_KEYSTONE is not set +# CONFIG_USB_DWC3_PCI is not set +# CONFIG_USB_DWC3_QCOM is not set +# CONFIG_USB_DWC_OTG_LPM is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_EG20T is not set +# CONFIG_USB_EHCI_HCD_AT91 is not set +# CONFIG_USB_EHCI_HCD_PPC_OF is not set +# CONFIG_USB_EHCI_MSM is not set +# CONFIG_USB_EHCI_MV is not set +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_ENESTORAGE is not set +# CONFIG_USB_EPSON2888 is not set +# CONFIG_USB_ET61X251 is not set +CONFIG_USB_EZUSB=y +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_FILE_STORAGE is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_FSL_USB2 is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_FUSB300 is not set +# CONFIG_USB_FUSBH200_HCD is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_GADGET_DEBUG is not set +# CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 +CONFIG_USB_GADGET_VBUS_DRAW=2 +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_GL860 is not set +# CONFIG_USB_GOKU is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_GSPCA_BENQ is not set +# CONFIG_USB_GSPCA_CONEX is not set +# CONFIG_USB_GSPCA_CPIA1 is not set +# CONFIG_USB_GSPCA_DTCS033 is not set +# CONFIG_USB_GSPCA_ETOMS is not set +# CONFIG_USB_GSPCA_FINEPIX is not set +# CONFIG_USB_GSPCA_JEILINJ is not set +# CONFIG_USB_GSPCA_JL2005BCD is not set +# CONFIG_USB_GSPCA_KINECT is not set +# CONFIG_USB_GSPCA_KONICA is not set +# CONFIG_USB_GSPCA_MARS is not set +# CONFIG_USB_GSPCA_MR97310A is not set +# CONFIG_USB_GSPCA_NW80X is not set +# CONFIG_USB_GSPCA_OV519 is not set +# CONFIG_USB_GSPCA_OV534 is not set +# CONFIG_USB_GSPCA_OV534_9 is not set +# CONFIG_USB_GSPCA_PAC207 is not set +# CONFIG_USB_GSPCA_PAC7302 is not set +# CONFIG_USB_GSPCA_PAC7311 is not set +# CONFIG_USB_GSPCA_SE401 is not set +# CONFIG_USB_GSPCA_SN9C2028 is not set +# CONFIG_USB_GSPCA_SN9C20X is not set +# CONFIG_USB_GSPCA_SONIXB is not set +# CONFIG_USB_GSPCA_SONIXJ is not set +# CONFIG_USB_GSPCA_SPCA1528 is not set +# CONFIG_USB_GSPCA_SPCA500 is not set +# CONFIG_USB_GSPCA_SPCA501 is not set +# CONFIG_USB_GSPCA_SPCA505 is not set +# CONFIG_USB_GSPCA_SPCA506 is not set +# CONFIG_USB_GSPCA_SPCA508 is not set +# CONFIG_USB_GSPCA_SPCA561 is not set +# CONFIG_USB_GSPCA_SQ905 is not set +# CONFIG_USB_GSPCA_SQ905C is not set +# CONFIG_USB_GSPCA_SQ930X is not set +# CONFIG_USB_GSPCA_STK014 is not set +# CONFIG_USB_GSPCA_STK1135 is not set +# CONFIG_USB_GSPCA_STV0680 is not set +# CONFIG_USB_GSPCA_SUNPLUS is not set +# CONFIG_USB_GSPCA_T613 is not set +# CONFIG_USB_GSPCA_TOPRO is not set +# CONFIG_USB_GSPCA_TV8532 is not set +# CONFIG_USB_GSPCA_VC032X is not set +# CONFIG_USB_GSPCA_VICAM is not set +# CONFIG_USB_GSPCA_XIRLINK_CIT is not set +# CONFIG_USB_GSPCA_ZC3XX is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_G_NOKIA is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_G_WEBCAM is not set +# CONFIG_USB_HCD_TEST_MODE is not set +# CONFIG_USB_HID is not set +# CONFIG_USB_HIDDEV is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_HWA_HCD is not set +# CONFIG_USB_IBMCAM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_INPUT_IMS_PCU is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_USB_IP_COMMON is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_ISP1760_HCD is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_KBD is not set +# CONFIG_USB_KC2190 is not set +# CONFIG_USB_KONICAWC is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LIBUSUAL is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_M5602 is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_MOUSE is not set +# CONFIG_USB_MSM_OTG is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MXS_PHY is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_NET2280 is not set +# CONFIG_USB_NET_AX88179_178A is not set +# CONFIG_USB_NET_AX8817X is not set +# CONFIG_USB_NET_CDCETHER is not set +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_DRIVERS is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_MCS7830 is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_NET_RNDIS_HOST is not set +# CONFIG_USB_NET_RNDIS_WLAN is not set +# CONFIG_USB_NET_SMSC75XX is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_OHCI_HCD_PCI is not set +# CONFIG_USB_OHCI_HCD_PPC_OF is not set +# CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set +# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set +# CONFIG_USB_OHCI_HCD_PPC_SOC is not set +# CONFIG_USB_OHCI_HCD_SSB is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_PHY is not set +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_PWC_INPUT_EVDEV is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_RCAR_PHY is not set +# CONFIG_USB_RENESAS_USBHS is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_RTL8152 is not set +# CONFIG_USB_S2255 is not set +# CONFIG_USB_S3C_HSOTG is not set +# CONFIG_USB_SE401 is not set +# CONFIG_USB_SERIAL is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_CP210X is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_DEBUG is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_EMPEG is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_FTDI_SIO is not set +# CONFIG_USB_SERIAL_FUNSOFT is not set +# CONFIG_USB_SERIAL_GARMIN is not set +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_HP4X is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +CONFIG_USB_SERIAL_KEYSPAN_MPR=y +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +CONFIG_USB_SERIAL_KEYSPAN_USA18X=y +CONFIG_USB_SERIAL_KEYSPAN_USA19=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y +CONFIG_USB_SERIAL_KEYSPAN_USA19W=y +CONFIG_USB_SERIAL_KEYSPAN_USA28=y +CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y +CONFIG_USB_SERIAL_KEYSPAN_USA49W=y +CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7715_PARPORT is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MOTOROLA is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_PL2303 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_QUATECH2 is not set +# CONFIG_USB_SERIAL_QUATECH_USB2 is not set +# CONFIG_USB_SERIAL_SAFE is not set +CONFIG_USB_SERIAL_SAFE_PADDED=y +# CONFIG_USB_SERIAL_SIEMENS_MPI is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_ZIO is not set +# CONFIG_USB_SERIAL_ZTE is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_SN9C102 is not set +# CONFIG_USB_SPEEDTOUCH is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_STORAGE is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STV06XX is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_TMC is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_UAS is not set +# CONFIG_USB_UEAGLEATM is not set +# CONFIG_USB_ULPI is not set +# CONFIG_USB_USBNET is not set +# CONFIG_USB_USS720 is not set +# CONFIG_USB_VIDEO_CLASS is not set +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y +# CONFIG_USB_VL600 is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_WHCI_HCD is not set +# CONFIG_USB_WPAN_HCD is not set +# CONFIG_USB_WUSB is not set +# CONFIG_USB_WUSB_CBAF is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_XUSBATM is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_ZD1201 is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USELIB is not set +# CONFIG_USE_GENERIC_SMP_HELPERS is not set +# CONFIG_USE_OF is not set +# CONFIG_UTS_NS is not set +# CONFIG_UWB is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VETH is not set +# CONFIG_VEXPRESS_CONFIG is not set +# CONFIG_VF610_ADC is not set +# CONFIG_VFAT_FS is not set +# CONFIG_VGASTATE is not set +# CONFIG_VGA_ARB is not set +# CONFIG_VGA_SWITCHEROO is not set +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set +# CONFIG_VIDEO_ADV7170 is not set +# CONFIG_VIDEO_ADV7175 is not set +# CONFIG_VIDEO_ADV7180 is not set +# CONFIG_VIDEO_ADV7183 is not set +# CONFIG_VIDEO_ADV7343 is not set +# CONFIG_VIDEO_ADV7393 is not set +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_AK881X is not set +# CONFIG_VIDEO_BT819 is not set +# CONFIG_VIDEO_BT848 is not set +# CONFIG_VIDEO_BT856 is not set +# CONFIG_VIDEO_BT866 is not set +# CONFIG_VIDEO_BWQCAM is not set +# CONFIG_VIDEO_CAFE_CCIC is not set +# CONFIG_VIDEO_CAPTURE_DRIVERS is not set +# CONFIG_VIDEO_CPIA is not set +# CONFIG_VIDEO_CQCAM is not set +# CONFIG_VIDEO_CS5345 is not set +# CONFIG_VIDEO_CS53L32A is not set +# CONFIG_VIDEO_CX231XX is not set +# CONFIG_VIDEO_CX2341X is not set +# CONFIG_VIDEO_CX25840 is not set +# CONFIG_VIDEO_CX88 is not set +# CONFIG_VIDEO_DEV is not set +# CONFIG_VIDEO_DM6446_CCDC is not set +# CONFIG_VIDEO_DT3155 is not set +# CONFIG_VIDEO_EM28XX is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +# CONFIG_VIDEO_GO7007 is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set +# CONFIG_VIDEO_HEXIUM_GEMINI is not set +# CONFIG_VIDEO_HEXIUM_ORION is not set +# CONFIG_VIDEO_IR_I2C is not set +# CONFIG_VIDEO_IVTV is not set +# CONFIG_VIDEO_KS0127 is not set +# CONFIG_VIDEO_M52790 is not set +# CONFIG_VIDEO_MEDIA is not set +# CONFIG_VIDEO_MEM2MEM_TESTDEV is not set +# CONFIG_VIDEO_ML86V7667 is not set +# CONFIG_VIDEO_MSP3400 is not set +# CONFIG_VIDEO_MT9V011 is not set +# CONFIG_VIDEO_MXB is not set +# CONFIG_VIDEO_NOON010PC30 is not set +# CONFIG_VIDEO_OMAP2_VOUT is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +# CONFIG_VIDEO_OV7640 is not set +# CONFIG_VIDEO_OV7670 is not set +# CONFIG_VIDEO_PMS is not set +# CONFIG_VIDEO_PVRUSB2 is not set +# CONFIG_VIDEO_SAA6588 is not set +# CONFIG_VIDEO_SAA6752HS is not set +# CONFIG_VIDEO_SAA7110 is not set +# CONFIG_VIDEO_SAA711X is not set +# CONFIG_VIDEO_SAA7127 is not set +# CONFIG_VIDEO_SAA7134 is not set +# CONFIG_VIDEO_SAA717X is not set +# CONFIG_VIDEO_SAA7185 is not set +# CONFIG_VIDEO_SAA7191 is not set +# CONFIG_VIDEO_SH_MOBILE_CEU is not set +# CONFIG_VIDEO_SONY_BTF_MPX is not set +# CONFIG_VIDEO_SR030PC30 is not set +# CONFIG_VIDEO_TCM825X is not set +# CONFIG_VIDEO_TDA7432 is not set +# CONFIG_VIDEO_TDA9840 is not set +# CONFIG_VIDEO_TEA6415C is not set +# CONFIG_VIDEO_TEA6420 is not set +# CONFIG_VIDEO_THS7303 is not set +# CONFIG_VIDEO_THS8200 is not set +# CONFIG_VIDEO_TIMBERDALE is not set +# CONFIG_VIDEO_TLV320AIC23B is not set +# CONFIG_VIDEO_TM6000 is not set +# CONFIG_VIDEO_TVAUDIO is not set +# CONFIG_VIDEO_TVP514X is not set +# CONFIG_VIDEO_TVP5150 is not set +# CONFIG_VIDEO_TVP7002 is not set +# CONFIG_VIDEO_TW2804 is not set +# CONFIG_VIDEO_TW9903 is not set +# CONFIG_VIDEO_TW9906 is not set +# CONFIG_VIDEO_UDA1342 is not set +# CONFIG_VIDEO_UPD64031A is not set +# CONFIG_VIDEO_UPD64083 is not set +# CONFIG_VIDEO_USBTV is not set +# CONFIG_VIDEO_USBVISION is not set +# CONFIG_VIDEO_V4L2 is not set +# CONFIG_VIDEO_V4L2_COMMON is not set +# CONFIG_VIDEO_V4L2_INT_DEVICE is not set +# CONFIG_VIDEO_VIVI is not set +# CONFIG_VIDEO_VP27SMPX is not set +# CONFIG_VIDEO_VPX3220 is not set +# CONFIG_VIDEO_VS6624 is not set +# CONFIG_VIDEO_WM8739 is not set +# CONFIG_VIDEO_WM8775 is not set +# CONFIG_VIDEO_ZORAN is not set +# CONFIG_VIRQ_DEBUG is not set +# CONFIG_VIRTIO_BALLOON is not set +# CONFIG_VIRTIO_MMIO is not set +# CONFIG_VIRTIO_PCI is not set +# CONFIG_VIRTUALIZATION is not set +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRT_TO_BUS=y +# CONFIG_VITESSE_PHY is not set +CONFIG_VLAN_8021Q=y +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_VME_BUS is not set +# CONFIG_VMSPLIT_1G is not set +# CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_2G_OPT is not set +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_VMWARE_PVSCSI is not set +# CONFIG_VMXNET3 is not set +# CONFIG_VM_EVENT_COUNTERS is not set +# CONFIG_VORTEX is not set +# CONFIG_VSOCKETS is not set +# CONFIG_VT is not set +# CONFIG_VT6655 is not set +# CONFIG_VT6656 is not set +# CONFIG_VXFS_FS is not set +# CONFIG_VXGE is not set +# CONFIG_VXLAN is not set +# CONFIG_W1 is not set +# CONFIG_W1_CON is not set +# CONFIG_W1_MASTER_DS1WM is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS2490 is not set +# CONFIG_W1_MASTER_GPIO is not set +# CONFIG_W1_MASTER_MATROX is not set +# CONFIG_W1_SLAVE_BQ27000 is not set +# CONFIG_W1_SLAVE_DS2406 is not set +# CONFIG_W1_SLAVE_DS2408 is not set +# CONFIG_W1_SLAVE_DS2413 is not set +# CONFIG_W1_SLAVE_DS2423 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2760 is not set +# CONFIG_W1_SLAVE_DS2780 is not set +# CONFIG_W1_SLAVE_DS2781 is not set +# CONFIG_W1_SLAVE_DS28E04 is not set +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_THERM is not set +# CONFIG_W35UND is not set +# CONFIG_W83627HF_WDT is not set +# CONFIG_W83697HF_WDT is not set +# CONFIG_W83877F_WDT is not set +# CONFIG_W83977F_WDT is not set +# CONFIG_WAN is not set +# CONFIG_WANXL is not set +# CONFIG_WAN_ROUTER is not set +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_CORE is not set +# CONFIG_WATCHDOG_NOWAYOUT is not set +# CONFIG_WD80x3 is not set +# CONFIG_WDTPCI is not set +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PRIV=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_SPY=y +CONFIG_WILINK_PLATFORM_DATA=y +# CONFIG_WIMAX is not set +# CONFIG_WIMAX_GDM72XX is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +# CONFIG_WIRELESS_EXT_SYSFS is not set +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLAGS49_H2 is not set +# CONFIG_WLAGS49_H25 is not set +CONFIG_WLAN=y +# CONFIG_WLCORE is not set +CONFIG_WL_TI=y +CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y +# CONFIG_WR_PPMC is not set +# CONFIG_X25 is not set +# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set +# CONFIG_X86_PKG_TEMP_THERMAL is not set +CONFIG_X86_SYSFB=y +# CONFIG_XEN is not set +CONFIG_XFRM=y +# CONFIG_XFRM_IPCOMP is not set +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_STATISTICS is not set +# CONFIG_XFRM_SUB_POLICY is not set +# CONFIG_XFRM_USER is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_XFS_FS is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XILINX_AXI_EMAC is not set +# CONFIG_XILINX_EMACLITE is not set +# CONFIG_XILINX_LL_TEMAC is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_XILLYBUS is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_XMON is not set +# CONFIG_XVMALLOC is not set +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_BCJ is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_TEST is not set +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_YAM is not set +# CONFIG_YELLOWFIN is not set +# CONFIG_YENTA is not set +# CONFIG_YENTA_O2 is not set +# CONFIG_YENTA_RICOH is not set +# CONFIG_YENTA_TI is not set +# CONFIG_YENTA_TOSHIBA is not set +# CONFIG_ZBUD is not set +# CONFIG_ZD1211RW is not set +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_ZEROPLUS_FF is not set +# CONFIG_ZISOFS is not set +# CONFIG_ZLIB_DEFLATE is not set +# CONFIG_ZLIB_INFLATE is not set +# CONFIG_ZNET is not set +CONFIG_ZONE_DMA=y +CONFIG_ZONE_DMA_FLAG=1 +# CONFIG_ZPOOL is not set +# CONFIG_ZRAM is not set +# CONFIG_ZRAM_LZ4_COMPRESS is not set +# CONFIG_ZSMALLOC is not set diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index aa227ec6b..a15b87041 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -717,8 +717,6 @@ CONFIG_CARDBUS=y # CONFIG_CB710_CORE is not set # CONFIG_CC10001_ADC is not set # CONFIG_CCS811 is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CC_STACKPROTECTOR_NONE=y # CONFIG_CC_STACKPROTECTOR_REGULAR is not set @@ -1182,12 +1180,14 @@ CONFIG_DQL=y # CONFIG_DRM_OMAP is not set # CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set # CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_LVDS is not set # CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set # CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set # CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set # CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set # CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set # CONFIG_DRM_PARADE_PS8622 is not set # CONFIG_DRM_PL111 is not set # CONFIG_DRM_QXL is not set @@ -4683,7 +4683,7 @@ CONFIG_SQUASHFS=y # CONFIG_SQUASHFS_DECOMP_MULTI is not set CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y # CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_EMBEDDED=y # CONFIG_SQUASHFS_FILE_CACHE is not set CONFIG_SQUASHFS_FILE_DIRECT=y CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 @@ -5199,6 +5199,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=2 # CONFIG_USB_MON is not set # CONFIG_USB_MOUSE is not set # CONFIG_USB_MSM_OTG is not set +# CONFIG_USB_MTU3 is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_MV_U3D is not set # CONFIG_USB_MV_UDC is not set diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9 index 83abfdc8f..77cf3b5dc 100644 --- a/target/linux/generic/config-4.9 +++ b/target/linux/generic/config-4.9 @@ -680,8 +680,6 @@ CONFIG_CARDBUS=y # CONFIG_CAVIUM_OCTEON_SOC is not set # CONFIG_CB710_CORE is not set # CONFIG_CC10001_ADC is not set -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CC_STACKPROTECTOR_NONE=y # CONFIG_CC_STACKPROTECTOR_REGULAR is not set @@ -4403,7 +4401,7 @@ CONFIG_SQUASHFS=y # CONFIG_SQUASHFS_DECOMP_MULTI is not set CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y # CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_EMBEDDED=y # CONFIG_SQUASHFS_FILE_CACHE is not set CONFIG_SQUASHFS_FILE_DIRECT=y CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c b/target/linux/generic/files/drivers/net/phy/ar8327.c index 7bfc18750..74f0a08d7 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8327.c +++ b/target/linux/generic/files/drivers/net/phy/ar8327.c @@ -506,14 +506,6 @@ ar8327_hw_config_pdata(struct ar8xxx_priv *priv, ar8xxx_write(priv, AR8327_REG_PAD0_MODE, t); t = ar8327_get_pad_cfg(pdata->pad5_cfg); - if (chip_is_ar8337(priv)) { - /* - * Workaround: RGMII RX delay setting needs to be - * always specified for AR8337 to avoid port 5 - * RX hang on high traffic / flood conditions - */ - t |= AR8327_PAD_RGMII_RXCLK_DELAY_EN; - } ar8xxx_write(priv, AR8327_REG_PAD5_MODE, t); t = ar8327_get_pad_cfg(pdata->pad6_cfg); ar8xxx_write(priv, AR8327_REG_PAD6_MODE, t); @@ -678,39 +670,6 @@ ar8327_init_globals(struct ar8xxx_priv *priv) /* Disable EEE on all phy's due to stability issues */ for (i = 0; i < AR8XXX_NUM_PHYS; i++) data->eee[i] = false; - - if (chip_is_ar8337(priv)) { - /* Update HOL registers with values suggested by QCA switch team */ - for (i = 0; i < AR8327_NUM_PORTS; i++) { - if (i == AR8216_PORT_CPU || i == 5 || i == 6) { - t = 0x3 << AR8327_PORT_HOL_CTRL0_EG_PRI0_BUF_S; - t |= 0x4 << AR8327_PORT_HOL_CTRL0_EG_PRI1_BUF_S; - t |= 0x4 << AR8327_PORT_HOL_CTRL0_EG_PRI2_BUF_S; - t |= 0x4 << AR8327_PORT_HOL_CTRL0_EG_PRI3_BUF_S; - t |= 0x6 << AR8327_PORT_HOL_CTRL0_EG_PRI4_BUF_S; - t |= 0x8 << AR8327_PORT_HOL_CTRL0_EG_PRI5_BUF_S; - t |= 0x1e << AR8327_PORT_HOL_CTRL0_EG_PORT_BUF_S; - } else { - t = 0x3 << AR8327_PORT_HOL_CTRL0_EG_PRI0_BUF_S; - t |= 0x4 << AR8327_PORT_HOL_CTRL0_EG_PRI1_BUF_S; - t |= 0x6 << AR8327_PORT_HOL_CTRL0_EG_PRI2_BUF_S; - t |= 0x8 << AR8327_PORT_HOL_CTRL0_EG_PRI3_BUF_S; - t |= 0x19 << AR8327_PORT_HOL_CTRL0_EG_PORT_BUF_S; - } - ar8xxx_write(priv, AR8327_REG_PORT_HOL_CTRL0(i), t); - - t = 0x6 << AR8327_PORT_HOL_CTRL1_ING_BUF_S; - t |= AR8327_PORT_HOL_CTRL1_EG_PRI_BUF_EN; - t |= AR8327_PORT_HOL_CTRL1_EG_PORT_BUF_EN; - t |= AR8327_PORT_HOL_CTRL1_WRED_EN; - ar8xxx_rmw(priv, AR8327_REG_PORT_HOL_CTRL1(i), - AR8327_PORT_HOL_CTRL1_ING_BUF | - AR8327_PORT_HOL_CTRL1_EG_PRI_BUF_EN | - AR8327_PORT_HOL_CTRL1_EG_PORT_BUF_EN | - AR8327_PORT_HOL_CTRL1_WRED_EN, - t); - } - } } static void @@ -1498,6 +1457,7 @@ const struct ar8xxx_chip ar8327_chip = { .atu_flush_port = ar8327_atu_flush_port, .vtu_flush = ar8327_vtu_flush, .vtu_load_vlan = ar8327_vtu_load_vlan, + .phy_fixup = ar8327_phy_fixup, .set_mirror_regs = ar8327_set_mirror_regs, .get_arl_entry = ar8327_get_arl_entry, .sw_hw_apply = ar8327_sw_hw_apply, diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.h b/target/linux/generic/files/drivers/net/phy/ar8327.h index 2309e5289..d53ef885b 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8327.h +++ b/target/linux/generic/files/drivers/net/phy/ar8327.h @@ -278,28 +278,7 @@ #define AR8327_REG_PORT_PRIO(_i) (0x664 + (_i) * 0xc) -#define AR8327_REG_PORT_HOL_CTRL0(_i) (0x970 + (_i) * 0x8) -#define AR8327_PORT_HOL_CTRL0_EG_PRI0_BUF BITS(0, 4) -#define AR8327_PORT_HOL_CTRL0_EG_PRI0_BUF_S 0 -#define AR8327_PORT_HOL_CTRL0_EG_PRI1_BUF BITS(4, 4) -#define AR8327_PORT_HOL_CTRL0_EG_PRI1_BUF_S 4 -#define AR8327_PORT_HOL_CTRL0_EG_PRI2_BUF BITS(8, 4) -#define AR8327_PORT_HOL_CTRL0_EG_PRI2_BUF_S 8 -#define AR8327_PORT_HOL_CTRL0_EG_PRI3_BUF BITS(12, 4) -#define AR8327_PORT_HOL_CTRL0_EG_PRI3_BUF_S 12 -#define AR8327_PORT_HOL_CTRL0_EG_PRI4_BUF BITS(16, 4) -#define AR8327_PORT_HOL_CTRL0_EG_PRI4_BUF_S 16 -#define AR8327_PORT_HOL_CTRL0_EG_PRI5_BUF BITS(20, 4) -#define AR8327_PORT_HOL_CTRL0_EG_PRI5_BUF_S 20 -#define AR8327_PORT_HOL_CTRL0_EG_PORT_BUF BITS(24, 6) -#define AR8327_PORT_HOL_CTRL0_EG_PORT_BUF_S 24 - #define AR8327_REG_PORT_HOL_CTRL1(_i) (0x974 + (_i) * 0x8) -#define AR8327_PORT_HOL_CTRL1_ING_BUF BITS(0, 4) -#define AR8327_PORT_HOL_CTRL1_ING_BUF_S 0 -#define AR8327_PORT_HOL_CTRL1_EG_PRI_BUF_EN BIT(6) -#define AR8327_PORT_HOL_CTRL1_EG_PORT_BUF_EN BIT(7) -#define AR8327_PORT_HOL_CTRL1_WRED_EN BIT(8) #define AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN BIT(16) #define AR8337_PAD_MAC06_EXCHANGE_EN BIT(31) diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c index c21ad9425..c0cb680e2 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c @@ -199,7 +199,7 @@ static int rtl8366_smi_read_byte1(struct rtl8366_smi *smi, u8 *data) return 0; } -int rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data) +static int __rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data) { unsigned long flags; u8 lo = 0; @@ -240,6 +240,101 @@ int rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data) return ret; } +/* Read/write via mdiobus */ +#define MDC_MDIO_CTRL0_REG 31 +#define MDC_MDIO_START_REG 29 +#define MDC_MDIO_CTRL1_REG 21 +#define MDC_MDIO_ADDRESS_REG 23 +#define MDC_MDIO_DATA_WRITE_REG 24 +#define MDC_MDIO_DATA_READ_REG 25 + +#define MDC_MDIO_START_OP 0xFFFF +#define MDC_MDIO_ADDR_OP 0x000E +#define MDC_MDIO_READ_OP 0x0001 +#define MDC_MDIO_WRITE_OP 0x0003 +#define MDC_REALTEK_PHY_ADDR 0x0 + +int __rtl8366_mdio_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data) +{ + u32 phy_id = MDC_REALTEK_PHY_ADDR; + struct mii_bus *mbus = smi->ext_mbus; + + BUG_ON(in_interrupt()); + + mutex_lock(&mbus->mdio_lock); + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write address control code to register 31 */ + mbus->write(mbus, phy_id, MDC_MDIO_CTRL0_REG, MDC_MDIO_ADDR_OP); + + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write address to register 23 */ + mbus->write(mbus, phy_id, MDC_MDIO_ADDRESS_REG, addr); + + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write read control code to register 21 */ + mbus->write(mbus, phy_id, MDC_MDIO_CTRL1_REG, MDC_MDIO_READ_OP); + + /* Write Start command to register 29 */ + mbus->write(smi->ext_mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Read data from register 25 */ + *data = mbus->read(mbus, phy_id, MDC_MDIO_DATA_READ_REG); + + mutex_unlock(&mbus->mdio_lock); + + return 0; +} + +static int __rtl8366_mdio_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data) +{ + u32 phy_id = MDC_REALTEK_PHY_ADDR; + struct mii_bus *mbus = smi->ext_mbus; + + BUG_ON(in_interrupt()); + + mutex_lock(&mbus->mdio_lock); + + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write address control code to register 31 */ + mbus->write(mbus, phy_id, MDC_MDIO_CTRL0_REG, MDC_MDIO_ADDR_OP); + + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write address to register 23 */ + mbus->write(mbus, phy_id, MDC_MDIO_ADDRESS_REG, addr); + + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write data to register 24 */ + mbus->write(mbus, phy_id, MDC_MDIO_DATA_WRITE_REG, data); + + /* Write Start command to register 29 */ + mbus->write(mbus, phy_id, MDC_MDIO_START_REG, MDC_MDIO_START_OP); + + /* Write data control code to register 21 */ + mbus->write(mbus, phy_id, MDC_MDIO_CTRL1_REG, MDC_MDIO_WRITE_OP); + + mutex_unlock(&mbus->mdio_lock); + return 0; +} + +int rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data) +{ + if (smi->ext_mbus) + return __rtl8366_mdio_read_reg(smi, addr, data); + else + return __rtl8366_smi_read_reg(smi, addr, data); +} EXPORT_SYMBOL_GPL(rtl8366_smi_read_reg); static int __rtl8366_smi_write_reg(struct rtl8366_smi *smi, @@ -291,7 +386,10 @@ static int __rtl8366_smi_write_reg(struct rtl8366_smi *smi, int rtl8366_smi_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data) { - return __rtl8366_smi_write_reg(smi, addr, data, true); + if (smi->ext_mbus) + return __rtl8366_mdio_write_reg(smi, addr, data); + else + return __rtl8366_smi_write_reg(smi, addr, data, true); } EXPORT_SYMBOL_GPL(rtl8366_smi_write_reg); @@ -319,9 +417,9 @@ EXPORT_SYMBOL_GPL(rtl8366_smi_rmwr); static int rtl8366_reset(struct rtl8366_smi *smi) { if (smi->hw_reset) { - smi->hw_reset(true); + smi->hw_reset(smi, true); msleep(RTL8366_SMI_HW_STOP_DELAY); - smi->hw_reset(false); + smi->hw_reset(smi, false); msleep(RTL8366_SMI_HW_START_DELAY); return 0; } @@ -1282,25 +1380,27 @@ static int __rtl8366_smi_init(struct rtl8366_smi *smi, const char *name) { int err; - err = gpio_request(smi->gpio_sda, name); - if (err) { - printk(KERN_ERR "rtl8366_smi: gpio_request failed for %u, err=%d\n", - smi->gpio_sda, err); - goto err_out; - } + if (!smi->ext_mbus) { + err = gpio_request(smi->gpio_sda, name); + if (err) { + printk(KERN_ERR "rtl8366_smi: gpio_request failed for %u, err=%d\n", + smi->gpio_sda, err); + goto err_out; + } - err = gpio_request(smi->gpio_sck, name); - if (err) { - printk(KERN_ERR "rtl8366_smi: gpio_request failed for %u, err=%d\n", - smi->gpio_sck, err); - goto err_free_sda; + err = gpio_request(smi->gpio_sck, name); + if (err) { + printk(KERN_ERR "rtl8366_smi: gpio_request failed for %u, err=%d\n", + smi->gpio_sck, err); + goto err_free_sda; + } } spin_lock_init(&smi->lock); /* start the switch */ if (smi->hw_reset) { - smi->hw_reset(false); + smi->hw_reset(smi, false); msleep(RTL8366_SMI_HW_START_DELAY); } @@ -1315,10 +1415,12 @@ static int __rtl8366_smi_init(struct rtl8366_smi *smi, const char *name) static void __rtl8366_smi_cleanup(struct rtl8366_smi *smi) { if (smi->hw_reset) - smi->hw_reset(true); + smi->hw_reset(smi, true); - gpio_free(smi->gpio_sck); - gpio_free(smi->gpio_sda); + if (!smi->ext_mbus) { + gpio_free(smi->gpio_sck); + gpio_free(smi->gpio_sda); + } } enum rtl8366_type rtl8366_smi_detect(struct rtl8366_platform_data *pdata) @@ -1371,8 +1473,11 @@ int rtl8366_smi_init(struct rtl8366_smi *smi) if (err) goto err_out; - dev_info(smi->parent, "using GPIO pins %u (SDA) and %u (SCK)\n", - smi->gpio_sda, smi->gpio_sck); + if (!smi->ext_mbus) + dev_info(smi->parent, "using GPIO pins %u (SDA) and %u (SCK)\n", + smi->gpio_sda, smi->gpio_sck); + else + dev_info(smi->parent, "using MDIO bus '%s'\n", smi->ext_mbus->name); err = smi->ops->detect(smi); if (err) { @@ -1425,11 +1530,37 @@ void rtl8366_smi_cleanup(struct rtl8366_smi *smi) EXPORT_SYMBOL_GPL(rtl8366_smi_cleanup); #ifdef CONFIG_OF +static void rtl8366_smi_reset(struct rtl8366_smi *smi, bool active) +{ + if (active) + reset_control_assert(smi->reset); + else + reset_control_deassert(smi->reset); +} + int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi *smi) { int sck = of_get_named_gpio(pdev->dev.of_node, "gpio-sck", 0); int sda = of_get_named_gpio(pdev->dev.of_node, "gpio-sda", 0); + struct device_node *np = pdev->dev.of_node; + struct device_node *mdio_node; + mdio_node = of_parse_phandle(np, "mii-bus", 0); + if (!mdio_node) { + dev_err(&pdev->dev, "cannot find mdio node phandle"); + goto try_gpio; + } + + smi->ext_mbus = of_mdio_find_bus(mdio_node); + if (!smi->ext_mbus) { + dev_err(&pdev->dev, + "cannot find mdio bus from bus handle"); + goto try_gpio; + } + + return 0; + +try_gpio: if (!gpio_is_valid(sck) || !gpio_is_valid(sda)) { dev_err(&pdev->dev, "gpios missing in devictree\n"); return -EINVAL; @@ -1437,6 +1568,9 @@ int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi *smi) smi->gpio_sda = sda; smi->gpio_sck = sck; + smi->reset = devm_reset_control_get(&pdev->dev, "switch"); + if (!IS_ERR(smi->reset)) + smi->hw_reset = rtl8366_smi_reset; return 0; } diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h index 4bb9e9a66..d1d988a37 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h +++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h @@ -14,6 +14,7 @@ #include #include #include +#include struct rtl8366_smi_ops; struct rtl8366_vlan_ops; @@ -33,7 +34,7 @@ struct rtl8366_smi { struct device *parent; unsigned int gpio_sda; unsigned int gpio_sck; - void (*hw_reset)(bool active); + void (*hw_reset)(struct rtl8366_smi *smi, bool active); unsigned int clk_delay; /* ns */ u8 cmd_read; u8 cmd_write; @@ -54,11 +55,15 @@ struct rtl8366_smi { int vlan4k_enabled; char buf[4096]; + + struct reset_control *reset; + #ifdef CONFIG_RTL8366_SMI_DEBUG_FS struct dentry *debugfs_root; u16 dbg_reg; u8 dbg_vlan_4k_page; #endif + struct mii_bus *ext_mbus; }; struct rtl8366_vlan_mc { diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c index dbf440a00..e6ea6509a 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c @@ -1585,7 +1585,6 @@ static void rtl8367b_shutdown(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id rtl8367b_match[] = { { .compatible = "realtek,rtl8367b" }, - { .compatible = "rtl8367b" }, {}, }; MODULE_DEVICE_TABLE(of, rtl8367b_match); diff --git a/target/linux/generic/files/include/linux/rtl8366.h b/target/linux/generic/files/include/linux/rtl8366.h index 78daed220..e3ce8f536 100644 --- a/target/linux/generic/files/include/linux/rtl8366.h +++ b/target/linux/generic/files/include/linux/rtl8366.h @@ -15,6 +15,8 @@ #define RTL8366S_DRIVER_NAME "rtl8366s" #define RTL8366RB_DRIVER_NAME "rtl8366rb" +struct rtl8366_smi; + enum rtl8366_type { RTL8366_TYPE_UNKNOWN, RTL8366_TYPE_S, @@ -29,7 +31,7 @@ struct rtl8366_initval { struct rtl8366_platform_data { unsigned gpio_sda; unsigned gpio_sck; - void (*hw_reset)(bool active); + void (*hw_reset)(struct rtl8366_smi *smi, bool active); unsigned num_initvals; struct rtl8366_initval *initvals; diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch index 1c6e78df3..458b7c35a 100644 --- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch @@ -103,7 +103,7 @@ Signed-off-by: Felix Fietkau }) -#ifdef CONFIG_REGMAP -+#if IS_ENABLED(CONFIG_REGMAP) ++#if IS_REACHABLE(CONFIG_REGMAP) enum regmap_endian { /* Unspecified -> 0 -> Backwards compatible default */ diff --git a/target/linux/mediatek/patches-4.14/0048-net-core-add-RPS-balancer.patch b/target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch similarity index 86% rename from target/linux/mediatek/patches-4.14/0048-net-core-add-RPS-balancer.patch rename to target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch index 6cb5fa749..6fc52ee25 100644 --- a/target/linux/mediatek/patches-4.14/0048-net-core-add-RPS-balancer.patch +++ b/target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch @@ -1,7 +1,9 @@ From 3e969c9695b45e1a052d43b367096ec99f2f0aac Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 10 Aug 2017 15:58:29 +0200 -Subject: [PATCH 48/57] net: core: add RPS balancer +Subject: [PATCH] net: core: add RPS balancer + +This patch adds a hash bucket based rps hash balancer. Signed-off-by: John Crispin --- @@ -10,7 +12,7 @@ Signed-off-by: John Crispin --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3636,6 +3636,58 @@ set_rps_cpu(struct net_device *dev, stru +@@ -3626,6 +3626,58 @@ set_rps_cpu(struct net_device *dev, stru return rflow; } @@ -69,7 +71,7 @@ Signed-off-by: John Crispin /* * get_rps_cpu is called from netif_receive_skb and returns the target * CPU from the RPS map of the receiving queue for a given skb. -@@ -3725,7 +3777,7 @@ static int get_rps_cpu(struct net_device +@@ -3715,7 +3767,7 @@ static int get_rps_cpu(struct net_device try_rps: if (map) { @@ -78,12 +80,13 @@ Signed-off-by: John Crispin if (cpu_online(tcpu)) { cpu = tcpu; goto done; -@@ -8810,6 +8862,9 @@ static int __init net_dev_init(void) +@@ -8800,6 +8852,10 @@ static int __init net_dev_init(void) sd->backlog.weight = weight_p; } -+ if (IS_ENABLED(CONFIG_RPS)) ++#ifdef CONFIG_RPS + rps_table_init(); ++#endif + dev_boot_phase = 0; diff --git a/target/linux/generic/hack-4.14/640-bridge-only-accept-EAP-locally.patch b/target/linux/generic/hack-4.14/640-bridge-only-accept-EAP-locally.patch index 83c9cf739..0dbb8ee3c 100644 --- a/target/linux/generic/hack-4.14/640-bridge-only-accept-EAP-locally.patch +++ b/target/linux/generic/hack-4.14/640-bridge-only-accept-EAP-locally.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c -@@ -166,11 +166,14 @@ int br_handle_frame_finish(struct net *n +@@ -166,10 +166,14 @@ int br_handle_frame_finish(struct net *n } } @@ -26,7 +26,6 @@ Signed-off-by: Felix Fietkau goto drop; - BR_INPUT_SKB_CB(skb)->brdev = br->dev; -- - if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) - br_do_proxy_arp(skb, br, vid, p); + BR_INPUT_SKB_CB(skb)->src_port_isolated = !!(p->flags & BR_ISOLATED); + if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) diff --git a/target/linux/generic/hack-4.14/641-bridge_port_isolate.patch b/target/linux/generic/hack-4.14/641-bridge_port_isolate.patch deleted file mode 100644 index 538dbd16b..000000000 --- a/target/linux/generic/hack-4.14/641-bridge_port_isolate.patch +++ /dev/null @@ -1,76 +0,0 @@ -From e988390850731aa1697ed09d47b0932fac1af175 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:20:03 +0200 -Subject: bridge: port isolate - -Isolating individual bridge ports - -Signed-off-by: Felix Fietkau ---- - include/linux/if_bridge.h | 1 + - net/bridge/br_forward.c | 5 +++++ - net/bridge/br_input.c | 3 +++ - net/bridge/br_sysfs_if.c | 2 ++ - 4 files changed, 11 insertions(+) - ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -49,6 +49,7 @@ struct br_ip_list { - #define BR_MULTICAST_TO_UNICAST BIT(12) - #define BR_VLAN_TUNNEL BIT(13) - #define BR_BCAST_FLOOD BIT(14) -+#define BR_ISOLATE_MODE BIT(15) - - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -141,6 +141,9 @@ static int deliver_clone(const struct ne - void br_forward(const struct net_bridge_port *to, - struct sk_buff *skb, bool local_rcv, bool local_orig) - { -+ if (to->flags & BR_ISOLATE_MODE && !local_orig) -+ to = NULL; -+ - if (to && should_deliver(to, skb)) { - if (local_rcv) - deliver_clone(to, skb, local_orig); -@@ -183,6 +186,8 @@ void br_flood(struct net_bridge *br, str - struct net_bridge_port *p; - - list_for_each_entry_rcu(p, &br->port_list, list) { -+ if (!local_orig && (p->flags & BR_ISOLATE_MODE)) -+ continue; - /* Do not flood unicast traffic to ports that turn it off, nor - * other traffic if flood off, except for traffic we originate - */ ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -177,6 +177,9 @@ int br_handle_frame_finish(struct net *n - if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) - br_do_proxy_arp(skb, br, vid, p); - -+ if (p->flags & BR_ISOLATE_MODE) -+ return br_pass_frame_up(skb); -+ - switch (pkt_type) { - case BR_PKT_MULTICAST: - mdst = br_mdb_get(br, skb, vid); ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -174,6 +174,7 @@ BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); - BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); - BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); - BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD); -+BRPORT_ATTR_FLAG(isolate_mode, BR_ISOLATE_MODE); - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) -@@ -223,6 +224,7 @@ static const struct brport_attribute *br - &brport_attr_proxyarp_wifi, - &brport_attr_multicast_flood, - &brport_attr_broadcast_flood, -+ &brport_attr_isolate_mode, - NULL - }; - diff --git a/target/linux/generic/hack-4.14/647-netfilter-flow-acct.patch b/target/linux/generic/hack-4.14/647-netfilter-flow-acct.patch new file mode 100644 index 000000000..290570fe9 --- /dev/null +++ b/target/linux/generic/hack-4.14/647-netfilter-flow-acct.patch @@ -0,0 +1,70 @@ +--- a/include/net/netfilter/nf_flow_table.h ++++ b/include/net/netfilter/nf_flow_table.h +@@ -164,6 +164,8 @@ struct nf_flow_table_hw { + int nf_flow_table_hw_register(const struct nf_flow_table_hw *offload); + void nf_flow_table_hw_unregister(const struct nf_flow_table_hw *offload); + ++void nf_flow_table_acct(struct flow_offload *flow, struct sk_buff *skb, int dir); ++ + extern struct work_struct nf_flow_offload_hw_work; + + #define MODULE_ALIAS_NF_FLOWTABLE(family) \ +--- a/net/netfilter/nf_flow_table_core.c ++++ b/net/netfilter/nf_flow_table_core.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + struct flow_offload_entry { + struct flow_offload flow; +@@ -151,6 +152,22 @@ void flow_offload_free(struct flow_offlo + } + EXPORT_SYMBOL_GPL(flow_offload_free); + ++void nf_flow_table_acct(struct flow_offload *flow, struct sk_buff *skb, int dir) ++{ ++ struct flow_offload_entry *entry; ++ struct nf_conn_acct *acct; ++ ++ entry = container_of(flow, struct flow_offload_entry, flow); ++ acct = nf_conn_acct_find(entry->ct); ++ if (acct) { ++ struct nf_conn_counter *counter = acct->counter; ++ ++ atomic64_inc(&counter[dir].packets); ++ atomic64_add(skb->len, &counter[dir].bytes); ++ } ++} ++EXPORT_SYMBOL_GPL(nf_flow_table_acct); ++ + static u32 flow_offload_hash(const void *data, u32 len, u32 seed) + { + const struct flow_offload_tuple *tuple = data; +--- a/net/netfilter/nf_flow_table_ip.c ++++ b/net/netfilter/nf_flow_table_ip.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++ + /* For layer 4 checksum field offset. */ + #include + #include +@@ -265,6 +266,7 @@ nf_flow_offload_ip_hook(void *priv, stru + skb->dev = outdev; + nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr); + skb_dst_set_noref(skb, &rt->dst); ++ nf_flow_table_acct(flow, skb, dir); + neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb); + + return NF_STOLEN; +@@ -482,6 +484,7 @@ nf_flow_offload_ipv6_hook(void *priv, st + skb->dev = outdev; + nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6); + skb_dst_set_noref(skb, &rt->dst); ++ nf_flow_table_acct(flow, skb, dir); + neigh_xmit(NEIGH_ND_TABLE, outdev, nexthop, skb); + + return NF_STOLEN; diff --git a/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch b/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch index 84ae4affe..308fe0974 100644 --- a/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch +++ b/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch @@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o --- /dev/null +++ b/net/netfilter/xt_FLOWOFFLOAD.c -@@ -0,0 +1,365 @@ +@@ -0,0 +1,368 @@ +/* + * Copyright (C) 2018 Felix Fietkau + * @@ -326,6 +326,9 @@ Signed-off-by: Felix Fietkau + if (!this_dst || !other_dst) + return -ENOENT; + ++ if (dst_xfrm(this_dst) || dst_xfrm(other_dst)) ++ return -EINVAL; ++ + route->tuple[dir].dst = this_dst; + route->tuple[dir].ifindex = xt_in(par)->ifindex; + route->tuple[!dir].dst = other_dst; diff --git a/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch b/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch index 833d9f991..6638a5e94 100644 --- a/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch +++ b/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch @@ -39,7 +39,7 @@ Signed-off-by: Chen Minqiang --- a/net/netfilter/xt_FLOWOFFLOAD.c +++ b/net/netfilter/xt_FLOWOFFLOAD.c -@@ -337,10 +337,41 @@ static void xt_flowoffload_table_cleanup +@@ -340,10 +340,41 @@ static void xt_flowoffload_table_cleanup nf_flow_table_free(table); } @@ -81,7 +81,7 @@ Signed-off-by: Chen Minqiang INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work); ret = xt_flowoffload_table_init(&nf_flowtable); -@@ -358,6 +389,7 @@ static void __exit xt_flowoffload_tg_exi +@@ -361,6 +392,7 @@ static void __exit xt_flowoffload_tg_exi { xt_unregister_target(&offload_tg_reg); xt_flowoffload_table_cleanup(&nf_flowtable); diff --git a/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch b/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch index 0d0b2c73f..c545fa17e 100644 --- a/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch +++ b/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch @@ -62,7 +62,7 @@ Signed-off-by: Felix Fietkau BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); -+BRPORT_ATTR_FLAG(isolate_mode, BR_ISOLATE_MODE); ++BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE); #ifdef CONFIG_BRIDGE_IGMP_SNOOPING static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) @@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau &brport_attr_proxyarp, &brport_attr_proxyarp_wifi, &brport_attr_multicast_flood, -+ &brport_attr_isolate_mode, ++ &brport_attr_isolated, NULL }; diff --git a/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch b/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch deleted file mode 100644 index e7844effd..000000000 --- a/target/linux/generic/hack-4.9/950-net-patch-linux-kernel-to-support-shortcut-fe.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 5c43b9811dd88dd2d18d88a253212474bb665896 Mon Sep 17 00:00:00 2001 -From: Xiaoping Fan -Date: Fri, 26 Feb 2016 15:01:53 -0800 -Subject: [PATCH 1/3] net: patch linux kernel to support shortcut-fe - -1, add a new flag 'fast_forwarded' in skb structure. -2, put a hook in '__netif_receive_skb_core' to - deliver packet to shortcut-fe. - -Change-Id: Icaa7c172a06df1c3bc89ff89814d1136772fe217 -Signed-off-by: Xiaoping Fan - -msm: ipq806x: exporting TCP sequence check parameters - -This is for use in NSS connection manager. - -Change-Id: I01d30c0ab552308c439353c0d51d3d0ab3aa7699 -Signed-off-by: Pamidipati, Vijay -Signed-off-by: Murat Sezgin ---- - include/linux/skbuff.h | 3 +++ - net/Kconfig | 3 +++ - net/core/dev.c | 25 +++++++++++++++++++++++++ - net/netfilter/nf_conntrack_proto_tcp.c | 10 ++++++++++ - 4 files changed, 41 insertions(+) - -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index 9a0c945..56f4007 100644 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -738,6 +738,9 @@ struct sk_buff { - #endif - __u8 ipvs_property:1; - __u8 inner_protocol_type:1; -+#ifdef CONFIG_SHORTCUT_FE -+ __u8 fast_forwarded:1; -+#endif - __u8 remcsum_offload:1; - #ifdef CONFIG_NET_SWITCHDEV - __u8 offload_fwd_mark:1; -diff --git a/net/Kconfig b/net/Kconfig -index b4621e1..6ba72cf 100644 ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -444,3 +444,6 @@ config HAVE_CBPF_JIT - # Extended BPF JIT (eBPF) - config HAVE_EBPF_JIT - bool -+ -+config SHORTCUT_FE -+ bool "Enables kernel network stack path for Shortcut Forwarding Engine" -diff --git a/net/core/dev.c b/net/core/dev.c -index ca39cd2..74cd937 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -2929,8 +2929,17 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, - unsigned int len; - int rc; - -+#ifdef CONFIG_SHORTCUT_FE -+ /* If this skb has been fast forwarded then we don't want it to -+ * go to any taps (by definition we're trying to bypass them). -+ */ -+ if (!skb->fast_forwarded) { -+#endif - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) - dev_queue_xmit_nit(skb, dev); -+#ifdef CONFIG_SHORTCUT_FE -+ } -+#endif - - #ifdef CONFIG_ETHERNET_PACKET_MANGLE - if (!dev->eth_mangle_tx || -@@ -4061,6 +4070,11 @@ void netdev_rx_handler_unregister(struct net_device *dev) - } - EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); - -+#ifdef CONFIG_SHORTCUT_FE -+int (*fast_nat_recv)(struct sk_buff *skb) __rcu __read_mostly; -+EXPORT_SYMBOL_GPL(fast_nat_recv); -+#endif -+ - /* - * Limit the use of PFMEMALLOC reserves to those protocols that implement - * the special handling of PFMEMALLOC skbs. -@@ -4108,6 +4122,9 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) - bool deliver_exact = false; - int ret = NET_RX_DROP; - __be16 type; -+#ifdef CONFIG_SHORTCUT_FE -+ int (*fast_recv)(struct sk_buff *skb); -+#endif - - net_timestamp_check(!netdev_tstamp_prequeue, skb); - -@@ -4134,6 +4151,14 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) - goto out; - } - -+#ifdef CONFIG_SHORTCUT_FE -+ fast_recv = rcu_dereference(fast_nat_recv); -+ if (fast_recv && fast_recv(skb)) { -+ ret = NET_RX_SUCCESS; -+ goto out; -+ } -+#endif -+ - #ifdef CONFIG_NET_CLS_ACT - if (skb->tc_verd & TC_NCLS) { - skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); -diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c -index f24b626..4581481 100644 ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -34,12 +34,22 @@ - #include - - /* Do not check the TCP window for incoming packets */ -+#ifdef CONFIG_SHORTCUT_FE -+int nf_ct_tcp_no_window_check __read_mostly = 0; -+EXPORT_SYMBOL_GPL(nf_ct_tcp_no_window_check); -+#else - static int nf_ct_tcp_no_window_check __read_mostly = 1; -+#endif - - /* "Be conservative in what you do, - be liberal in what you accept from others." - If it's non-zero, we mark only out of window RST segments as INVALID. */ -+#ifdef CONFIG_SHORTCUT_FE -+int nf_ct_tcp_be_liberal __read_mostly = 0; -+EXPORT_SYMBOL_GPL(nf_ct_tcp_be_liberal); -+#else - static int nf_ct_tcp_be_liberal __read_mostly = 0; -+#endif - - /* If it is set to zero, we disable picking up already established - connections. */ --- -2.7.4 - diff --git a/target/linux/generic/hack-4.9/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch b/target/linux/generic/hack-4.9/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch deleted file mode 100644 index 5cc7dabad..000000000 --- a/target/linux/generic/hack-4.9/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch +++ /dev/null @@ -1,74 +0,0 @@ -From cdabe46cd62d22266aed7fdae36f72a36e3558e7 Mon Sep 17 00:00:00 2001 -From: Murat Sezgin -Date: Tue, 25 Nov 2014 17:22:24 -0800 -Subject: [PATCH 2/3] bridge: Add new bridge APIs needed for network HW - acceleration - -Bridge acceleration hardware needs to perform certain operations, - currently unsupported by the existing bridge code: - - ** cut ** - - *update bridge interface statistics from outside the bridge code: - once acceleration is enabled on a connection, packets will not flow - through the host CPU, so we need the hardware accelerator driver to - maintain the statistics on the host and update them and add whatever - flows through the hardware. - These change adds the corresponding functions, and make it available - to other through EXPORT_SYMBOLS(). - -Change-Id: I67afb325796004053897d9916e2df91827b65139 -Signed-off-by: Murat Sezgin ---- - include/linux/if_bridge.h | 1 + - net/bridge/br_if.c | 25 +++++++++++++++++++++++++ - 2 files changed, 26 insertions(+) - -diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h -index 0911c8c..4473f62 100644 ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -52,6 +52,7 @@ struct br_ip_list { - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - - extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); -+extern void br_dev_update_stats(struct net_device *dev, struct rtnl_link_stats64 *nlstats); - - typedef int br_should_route_hook_t(struct sk_buff *skb); - extern br_should_route_hook_t __rcu *br_should_route_hook; -diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c -index ed0dd33..342b2d9 100644 ---- a/net/bridge/br_if.c -+++ b/net/bridge/br_if.c -@@ -655,3 +655,28 @@ void br_port_flags_change(struct net_bridge_port *p, unsigned long mask) - if (mask & BR_AUTO_MASK) - nbp_update_port_count(br); - } -+ -+/* Update bridge statistics for bridge packets processed by offload engines */ -+void br_dev_update_stats(struct net_device *dev, struct rtnl_link_stats64 *nlstats) -+{ -+ struct net_bridge *br; -+ struct pcpu_sw_netstats *stats; -+ -+ /* -+ * Is this a bridge? -+ */ -+ if (!(dev->priv_flags & IFF_EBRIDGE)) { -+ return; -+ } -+ -+ br = netdev_priv(dev); -+ stats = this_cpu_ptr(br->stats); -+ -+ u64_stats_update_begin(&stats->syncp); -+ stats->rx_packets += nlstats->rx_packets; -+ stats->rx_bytes += nlstats->rx_bytes; -+ stats->tx_packets += nlstats->tx_packets; -+ stats->tx_bytes += nlstats->tx_bytes; -+ u64_stats_update_end(&stats->syncp); -+} -+EXPORT_SYMBOL_GPL(br_dev_update_stats); --- -2.7.4 - diff --git a/target/linux/generic/hack-4.9/952-net-conntrack-events-support-multiple-registrant.patch b/target/linux/generic/hack-4.9/952-net-conntrack-events-support-multiple-registrant.patch deleted file mode 100644 index a898c4a69..000000000 --- a/target/linux/generic/hack-4.9/952-net-conntrack-events-support-multiple-registrant.patch +++ /dev/null @@ -1,345 +0,0 @@ -From 56294a39f14712f868a495f28be6b2e92f0a48c6 Mon Sep 17 00:00:00 2001 -From: Zhi Chen -Date: Tue, 13 Jan 2015 14:28:18 -0800 -Subject: [PATCH 3/3] net: conntrack events, support multiple registrant - -Merging this patch from kernel 3.4: -This was supported by old (.28) kernel versions but removed -because of it's overhead. -But we need this feature for NA connection manager. Both ipv4 -and ipv6 modules needs to register themselves to ct events. - -Change-Id: Iebfb254590fb594f5baf232f849d1b7ae45ef757 -Signed-off-by: Zhi Chen ---- - include/net/netfilter/nf_conntrack_ecache.h | 13 +++- - include/net/netns/conntrack.h | 4 ++ - net/netfilter/Kconfig | 8 +++ - net/netfilter/nf_conntrack_core.c | 4 ++ - net/netfilter/nf_conntrack_ecache.c | 92 +++++++++++++++++++++++++++++ - net/netfilter/nf_conntrack_netlink.c | 19 ++++++ - 6 files changed, 139 insertions(+), 1 deletion(-) - -diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h -index 12d967b..c2b98b6 100644 ---- a/include/net/netfilter/nf_conntrack_ecache.h -+++ b/include/net/netfilter/nf_conntrack_ecache.h -@@ -70,6 +70,10 @@ struct nf_ct_event { - int report; - }; - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+extern int nf_conntrack_register_notifier(struct net *net, struct notifier_block *nb); -+extern int nf_conntrack_unregister_notifier(struct net *net, struct notifier_block *nb); -+#else - struct nf_ct_event_notifier { - int (*fcn)(unsigned int events, struct nf_ct_event *item); - }; -@@ -78,6 +82,7 @@ int nf_conntrack_register_notifier(struct net *net, - struct nf_ct_event_notifier *nb); - void nf_conntrack_unregister_notifier(struct net *net, - struct nf_ct_event_notifier *nb); -+#endif - - void nf_ct_deliver_cached_events(struct nf_conn *ct); - int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct, -@@ -86,11 +91,13 @@ int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct, - static inline void - nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) - { -- struct net *net = nf_ct_net(ct); - struct nf_conntrack_ecache *e; -+#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ struct net *net = nf_ct_net(ct); - - if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) - return; -+#endif - - e = nf_ct_ecache_find(ct); - if (e == NULL) -@@ -103,10 +110,12 @@ static inline int - nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, - u32 portid, int report) - { -+#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS - const struct net *net = nf_ct_net(ct); - - if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) - return 0; -+#endif - - return nf_conntrack_eventmask_report(1 << event, ct, portid, report); - } -@@ -114,10 +123,12 @@ nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, - static inline int - nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) - { -+#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS - const struct net *net = nf_ct_net(ct); - - if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) - return 0; -+#endif - - return nf_conntrack_eventmask_report(1 << event, ct, 0, 0); - } -diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h -index e469e85..1d31db8 100644 ---- a/include/net/netns/conntrack.h -+++ b/include/net/netns/conntrack.h -@@ -86,7 +86,11 @@ struct netns_ct { - - struct ct_pcpu __percpu *pcpu_lists; - struct ip_conntrack_stat __percpu *stat; -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ struct atomic_notifier_head nf_conntrack_chain; -+#else - struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; -+#endif - struct nf_exp_event_notifier __rcu *nf_expect_event_cb; - struct nf_ip_net nf_ct_proto; - #if defined(CONFIG_NF_CONNTRACK_LABELS) -diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig -index 63073be..08d7aab 100644 ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -136,6 +136,14 @@ config NF_CONNTRACK_TIMEOUT - - If unsure, say `N'. - -+config NF_CONNTRACK_CHAIN_EVENTS -+ bool "Register multiple callbacks to ct events" -+ depends on NF_CONNTRACK_EVENTS -+ help -+ Support multiple registrations. -+ -+ If unsure, say `N'. -+ - config NF_CONNTRACK_TIMESTAMP - bool 'Connection tracking timestamping' - depends on NETFILTER_ADVANCED -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index 6bd1508..9b81c7c 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -1998,6 +1998,10 @@ int nf_conntrack_init_net(struct net *net) - ret = nf_conntrack_proto_pernet_init(net); - if (ret < 0) - goto err_proto; -+ -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ ATOMIC_INIT_NOTIFIER_HEAD(&net->ct.nf_conntrack_chain); -+#endif - return 0; - - err_proto: -diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c -index da9df2d..e0e2a8f 100644 ---- a/net/netfilter/nf_conntrack_ecache.c -+++ b/net/netfilter/nf_conntrack_ecache.c -@@ -18,6 +18,9 @@ - #include - #include - #include -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+#include -+#endif - #include - #include - #include -@@ -117,6 +120,38 @@ static void ecache_work(struct work_struct *work) - schedule_delayed_work(&ctnet->ecache_dwork, delay); - } - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+int -+nf_conntrack_eventmask_report(unsigned int eventmask, -+ struct nf_conn *ct, -+ u32 portid, -+ int report) -+{ -+ struct nf_conntrack_ecache *e; -+ struct net *net = nf_ct_net(ct); -+ -+ e = nf_ct_ecache_find(ct); -+ if (e == NULL) -+ return 0; -+ -+ if (nf_ct_is_confirmed(ct)) { -+ struct nf_ct_event item = { -+ .ct = ct, -+ .portid = e->portid ? e->portid : portid, -+ .report = report -+ }; -+ /* This is a resent of a destroy event? If so, skip missed */ -+ unsigned long missed = e->portid ? 0 : e->missed; -+ -+ if (!((eventmask | missed) & e->ctmask)) -+ return 0; -+ -+ atomic_notifier_call_chain(&net->ct.nf_conntrack_chain, eventmask | missed, &item); -+ } -+ -+ return 0; -+} -+#else - int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct, - u32 portid, int report) - { -@@ -171,10 +206,52 @@ int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct, - rcu_read_unlock(); - return ret; - } -+#endif - EXPORT_SYMBOL_GPL(nf_conntrack_eventmask_report); - - /* deliver cached events and clear cache entry - must be called with locally - * disabled softirqs */ -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+void nf_ct_deliver_cached_events(struct nf_conn *ct) -+{ -+ unsigned long events, missed; -+ struct nf_conntrack_ecache *e; -+ struct nf_ct_event item; -+ struct net *net = nf_ct_net(ct); -+ -+ e = nf_ct_ecache_find(ct); -+ if (e == NULL) -+ return; -+ -+ events = xchg(&e->cache, 0); -+ -+ if (!nf_ct_is_confirmed(ct) || nf_ct_is_dying(ct) || !events) -+ return; -+ -+ /* We make a copy of the missed event cache without taking -+ * the lock, thus we may send missed events twice. However, -+ * this does not harm and it happens very rarely. */ -+ missed = e->missed; -+ -+ if (!((events | missed) & e->ctmask)) -+ return; -+ -+ item.ct = ct; -+ item.portid = 0; -+ item.report = 0; -+ -+ atomic_notifier_call_chain(&net->ct.nf_conntrack_chain, -+ events | missed, -+ &item); -+ -+ if (likely(!missed)) -+ return; -+ -+ spin_lock_bh(&ct->lock); -+ e->missed &= ~missed; -+ spin_unlock_bh(&ct->lock); -+} -+#else - void nf_ct_deliver_cached_events(struct nf_conn *ct) - { - struct net *net = nf_ct_net(ct); -@@ -225,6 +302,7 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct) - out_unlock: - rcu_read_unlock(); - } -+#endif - EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); - - void nf_ct_expect_event_report(enum ip_conntrack_expect_events event, -@@ -257,6 +335,12 @@ void nf_ct_expect_event_report(enum ip_conntrack_expect_events event, - rcu_read_unlock(); - } - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+int nf_conntrack_register_notifier(struct net *net, struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_register(&net->ct.nf_conntrack_chain, nb); -+} -+#else - int nf_conntrack_register_notifier(struct net *net, - struct nf_ct_event_notifier *new) - { -@@ -277,8 +361,15 @@ int nf_conntrack_register_notifier(struct net *net, - mutex_unlock(&nf_ct_ecache_mutex); - return ret; - } -+#endif - EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+int nf_conntrack_unregister_notifier(struct net *net, struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_unregister(&net->ct.nf_conntrack_chain, nb); -+} -+#else - void nf_conntrack_unregister_notifier(struct net *net, - struct nf_ct_event_notifier *new) - { -@@ -291,6 +382,7 @@ void nf_conntrack_unregister_notifier(struct net *net, - RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL); - mutex_unlock(&nf_ct_ecache_mutex); - } -+#endif - EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); - - int nf_ct_expect_register_notifier(struct net *net, -diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c -index 04111c1..8c741f7 100644 ---- a/net/netfilter/nf_conntrack_netlink.c -+++ b/net/netfilter/nf_conntrack_netlink.c -@@ -28,6 +28,11 @@ - #include - #include - #include -+ -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+#include -+#endif -+ - #include - - #include -@@ -615,14 +620,22 @@ static size_t ctnetlink_nlmsg_size(const struct nf_conn *ct) - ; - } - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+static int ctnetlink_conntrack_event(struct notifier_block *this, -+ unsigned long events, void *ptr) -+#else - static int - ctnetlink_conntrack_event(unsigned int events, struct nf_ct_event *item) -+#endif - { - const struct nf_conntrack_zone *zone; - struct net *net; - struct nlmsghdr *nlh; - struct nfgenmsg *nfmsg; - struct nlattr *nest_parms; -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ struct nf_ct_event *item = (struct nf_ct_event *)ptr; -+#endif - struct nf_conn *ct = item->ct; - struct sk_buff *skb; - unsigned int type; -@@ -3260,9 +3273,15 @@ static int ctnetlink_stat_exp_cpu(struct net *net, struct sock *ctnl, - } - - #ifdef CONFIG_NF_CONNTRACK_EVENTS -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+static struct notifier_block ctnl_notifier = { -+ .notifier_call = ctnetlink_conntrack_event, -+}; -+#else - static struct nf_ct_event_notifier ctnl_notifier = { - .fcn = ctnetlink_conntrack_event, - }; -+#endif - - static struct nf_exp_event_notifier ctnl_notifier_exp = { - .fcn = ctnetlink_expect_event, --- -2.7.4 - diff --git a/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch b/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch new file mode 100644 index 000000000..f0f2effbe --- /dev/null +++ b/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch @@ -0,0 +1,142 @@ +--- a/drivers/mtd/mtdsplit/mtdsplit_brnimage.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_brnimage.c +@@ -27,7 +27,7 @@ + #define BRNIMAGE_MAX_OVERHEAD (BRNIMAGE_ALIGN_BYTES + BRNIMAGE_FOOTER_SIZE) + + static int mtdsplit_parse_brnimage(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct mtd_partition *parts; +--- a/drivers/mtd/mtdsplit/mtdsplit_eva.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_eva.c +@@ -29,7 +29,7 @@ struct eva_image_header { + }; + + static int mtdsplit_parse_eva(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct mtd_partition *parts; +--- a/drivers/mtd/mtdsplit/mtdsplit_fit.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_fit.c +@@ -45,8 +45,7 @@ struct fdt_header { + }; + + static int +-mtdsplit_fit_parse(struct mtd_info *mtd, +- const struct mtd_partition **pparts, ++mtdsplit_fit_parse(struct mtd_info *mtd, struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct fdt_header hdr; +--- a/drivers/mtd/mtdsplit/mtdsplit_lzma.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_lzma.c +@@ -28,7 +28,7 @@ struct lzma_header { + }; + + static int mtdsplit_parse_lzma(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct lzma_header hdr; +--- a/drivers/mtd/mtdsplit/mtdsplit_seama.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_seama.c +@@ -30,7 +30,7 @@ struct seama_header { + }; + + static int mtdsplit_parse_seama(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct seama_header hdr; +--- a/drivers/mtd/mtdsplit/mtdsplit_squashfs.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_squashfs.c +@@ -23,7 +23,7 @@ + + static int + mtdsplit_parse_squashfs(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct mtd_partition *part; +--- a/drivers/mtd/mtdsplit/mtdsplit_tplink.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_tplink.c +@@ -83,8 +83,8 @@ struct tplink_fw_header { + }; + + static int mtdsplit_parse_tplink(struct mtd_info *master, +- const struct mtd_partition **pparts, +- struct mtd_part_parser_data *data) ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) + { + struct tplink_fw_header hdr; + size_t hdr_len, retlen, kernel_size; +--- a/drivers/mtd/mtdsplit/mtdsplit_trx.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_trx.c +@@ -56,7 +56,7 @@ read_trx_header(struct mtd_info *mtd, si + + static int + mtdsplit_parse_trx(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct mtd_partition *parts; +--- a/drivers/mtd/mtdsplit/mtdsplit_uimage.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_uimage.c +@@ -81,7 +81,7 @@ read_uimage_header(struct mtd_info *mtd, + * of a valid uImage header if found + */ + static int __mtdsplit_parse_uimage(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data, + ssize_t (*find_header)(u_char *buf, size_t len)) + { +@@ -232,7 +232,7 @@ static ssize_t uimage_verify_default(u_c + + static int + mtdsplit_uimage_parse_generic(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + return __mtdsplit_parse_uimage(master, pparts, data, +@@ -289,7 +289,7 @@ static ssize_t uimage_verify_wndr3700(u_ + + static int + mtdsplit_uimage_parse_netgear(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + return __mtdsplit_parse_uimage(master, pparts, data, +@@ -331,7 +331,7 @@ static ssize_t uimage_find_edimax(u_char + + static int + mtdsplit_uimage_parse_edimax(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + return __mtdsplit_parse_uimage(master, pparts, data, +--- a/drivers/mtd/mtdsplit/mtdsplit_wrgg.c ++++ b/drivers/mtd/mtdsplit/mtdsplit_wrgg.c +@@ -51,8 +51,8 @@ struct wrg_header { + + + static int mtdsplit_parse_wrgg(struct mtd_info *master, +- const struct mtd_partition **pparts, +- struct mtd_part_parser_data *data) ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) + { + struct wrgg03_header hdr; + size_t hdr_len, retlen, kernel_ent_size; diff --git a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch b/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch new file mode 100644 index 000000000..c50013830 --- /dev/null +++ b/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch @@ -0,0 +1,552 @@ +--- a/drivers/net/phy/adm6996.c ++++ b/drivers/net/phy/adm6996.c +@@ -289,7 +289,7 @@ static u16 + adm6996_read_mii_reg(struct adm6996_priv *priv, enum admreg reg) + { + struct phy_device *phydev = priv->priv; +- struct mii_bus *bus = phydev->mdio.bus; ++ struct mii_bus *bus = phydev->bus; + + return bus->read(bus, PHYADDR(reg)); + } +@@ -298,7 +298,7 @@ static void + adm6996_write_mii_reg(struct adm6996_priv *priv, enum admreg reg, u16 val) + { + struct phy_device *phydev = priv->priv; +- struct mii_bus *bus = phydev->mdio.bus; ++ struct mii_bus *bus = phydev->bus; + + bus->write(bus, PHYADDR(reg), val); + } +@@ -1050,13 +1050,13 @@ static int adm6996_config_init(struct ph + pdev->supported = ADVERTISED_100baseT_Full; + pdev->advertising = ADVERTISED_100baseT_Full; + +- if (pdev->mdio.addr != 0) { ++ if (pdev->addr != 0) { + pr_info ("%s: PHY overlaps ADM6996, providing fixed PHY 0x%x.\n" +- , pdev->attached_dev->name, pdev->mdio.addr); ++ , pdev->attached_dev->name, pdev->addr); + return 0; + } + +- priv = devm_kzalloc(&pdev->mdio.dev, sizeof(struct adm6996_priv), GFP_KERNEL); ++ priv = devm_kzalloc(&pdev->dev, sizeof(struct adm6996_priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +@@ -1076,7 +1076,7 @@ static int adm6996_config_init(struct ph + } + + /* +- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 ++ * Warning: phydev->priv is NULL if phydev->addr != 0 + */ + static int adm6996_read_status(struct phy_device *phydev) + { +@@ -1092,7 +1092,7 @@ static int adm6996_read_status(struct ph + } + + /* +- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 ++ * Warning: phydev->priv is NULL if phydev->addr != 0 + */ + static int adm6996_config_aneg(struct phy_device *phydev) + { +@@ -1101,11 +1101,11 @@ static int adm6996_config_aneg(struct ph + + static int adm6996_fixup(struct phy_device *dev) + { +- struct mii_bus *bus = dev->mdio.bus; ++ struct mii_bus *bus = dev->bus; + u16 reg; + + /* Our custom registers are at PHY addresses 0-10. Claim those. */ +- if (dev->mdio.addr > 10) ++ if (dev->addr > 10) + return 0; + + /* look for the switch on the bus */ +@@ -1152,6 +1152,7 @@ static struct phy_driver adm6996_phy_dri + .config_aneg = &adm6996_config_aneg, + .read_status = &adm6996_read_status, + .soft_reset = adm6996_soft_reset, ++ .driver = { .owner = THIS_MODULE,}, + }; + + static int adm6996_gpio_probe(struct platform_device *pdev) +@@ -1220,7 +1221,7 @@ static int __init adm6996_init(void) + int err; + + phy_register_fixup_for_id(PHY_ANY_ID, adm6996_fixup); +- err = phy_driver_register(&adm6996_phy_driver, THIS_MODULE); ++ err = phy_driver_register(&adm6996_phy_driver); + if (err) + return err; + +--- a/drivers/net/phy/ar8216.c ++++ b/drivers/net/phy/ar8216.c +@@ -177,7 +177,7 @@ ar8xxx_phy_check_aneg(struct phy_device + if (ret & BMCR_ANENABLE) + return 0; + +- dev_info(&phydev->mdio.dev, "ANEG disabled, re-enabling ...\n"); ++ dev_info(&phydev->dev, "ANEG disabled, re-enabling ...\n"); + ret |= BMCR_ANENABLE | BMCR_ANRESTART; + return phy_write(phydev, MII_BMCR, ret); + } +@@ -2012,7 +2012,7 @@ ar8xxx_phy_config_init(struct phy_device + + priv->phy = phydev; + +- if (phydev->mdio.addr != 0) { ++ if (phydev->addr != 0) { + if (chip_is_ar8316(priv)) { + /* switch device has been initialized, reinit */ + priv->dev.ports = (AR8216_NUM_PORTS - 1); +@@ -2060,7 +2060,7 @@ ar8xxx_check_link_states(struct ar8xxx_p + /* flush ARL entries for this port if it went down*/ + if (!link_new) + priv->chip->atu_flush_port(priv, i); +- dev_info(&priv->phy->mdio.dev, "Port %d is %s\n", ++ dev_info(&priv->phy->dev, "Port %d is %s\n", + i, link_new ? "up" : "down"); + } + +@@ -2079,10 +2079,10 @@ ar8xxx_phy_read_status(struct phy_device + if (phydev->state == PHY_CHANGELINK) + ar8xxx_check_link_states(priv); + +- if (phydev->mdio.addr != 0) ++ if (phydev->addr != 0) + return genphy_read_status(phydev); + +- ar8216_read_port_link(priv, phydev->mdio.addr, &link); ++ ar8216_read_port_link(priv, phydev->addr, &link); + phydev->link = !!link.link; + if (!phydev->link) + return 0; +@@ -2112,7 +2112,7 @@ ar8xxx_phy_read_status(struct phy_device + static int + ar8xxx_phy_config_aneg(struct phy_device *phydev) + { +- if (phydev->mdio.addr == 0) ++ if (phydev->addr == 0) + return 0; + + return genphy_config_aneg(phydev); +@@ -2167,15 +2167,15 @@ ar8xxx_phy_probe(struct phy_device *phyd + int ret; + + /* skip PHYs at unused adresses */ +- if (phydev->mdio.addr != 0 && phydev->mdio.addr != 4) ++ if (phydev->addr != 0 && phydev->addr != 4) + return -ENODEV; + +- if (!ar8xxx_is_possible(phydev->mdio.bus)) ++ if (!ar8xxx_is_possible(phydev->bus)) + return -ENODEV; + + mutex_lock(&ar8xxx_dev_list_lock); + list_for_each_entry(priv, &ar8xxx_dev_list, list) +- if (priv->mii_bus == phydev->mdio.bus) ++ if (priv->mii_bus == phydev->bus) + goto found; + + priv = ar8xxx_create(); +@@ -2184,7 +2184,7 @@ ar8xxx_phy_probe(struct phy_device *phyd + goto unlock; + } + +- priv->mii_bus = phydev->mdio.bus; ++ priv->mii_bus = phydev->bus; + + ret = ar8xxx_probe_switch(priv); + if (ret) +@@ -2205,7 +2205,7 @@ ar8xxx_phy_probe(struct phy_device *phyd + found: + priv->use_count++; + +- if (phydev->mdio.addr == 0) { ++ if (phydev->addr == 0) { + if (ar8xxx_has_gige(priv)) { + phydev->supported = SUPPORTED_1000baseT_Full; + phydev->advertising = ADVERTISED_1000baseT_Full; +@@ -2293,21 +2293,33 @@ ar8xxx_phy_soft_reset(struct phy_device + return 0; + } + +-static struct phy_driver ar8xxx_phy_driver[] = { +- { +- .phy_id = 0x004d0000, +- .name = "Atheros AR8216/AR8236/AR8316", +- .phy_id_mask = 0xffff0000, +- .features = PHY_BASIC_FEATURES, +- .probe = ar8xxx_phy_probe, +- .remove = ar8xxx_phy_remove, +- .detach = ar8xxx_phy_detach, +- .config_init = ar8xxx_phy_config_init, +- .config_aneg = ar8xxx_phy_config_aneg, +- .read_status = ar8xxx_phy_read_status, +- .soft_reset = ar8xxx_phy_soft_reset, +- } ++static struct phy_driver ar8xxx_phy_driver = { ++ .phy_id = 0x004d0000, ++ .name = "Atheros AR8216/AR8236/AR8316", ++ .phy_id_mask = 0xffff0000, ++ .features = PHY_BASIC_FEATURES, ++ .probe = ar8xxx_phy_probe, ++ .remove = ar8xxx_phy_remove, ++ .detach = ar8xxx_phy_detach, ++ .config_init = ar8xxx_phy_config_init, ++ .config_aneg = ar8xxx_phy_config_aneg, ++ .read_status = ar8xxx_phy_read_status, ++ .soft_reset = ar8xxx_phy_soft_reset, ++ .driver = { .owner = THIS_MODULE }, + }; + +-module_phy_driver(ar8xxx_phy_driver); ++int __init ++ar8xxx_init(void) ++{ ++ return phy_driver_register(&ar8xxx_phy_driver); ++} ++ ++void __exit ++ar8xxx_exit(void) ++{ ++ phy_driver_unregister(&ar8xxx_phy_driver); ++} ++ ++module_init(ar8xxx_init); ++module_exit(ar8xxx_exit); + MODULE_LICENSE("GPL"); +--- a/drivers/net/phy/ar8327.c ++++ b/drivers/net/phy/ar8327.c +@@ -627,11 +627,11 @@ ar8327_hw_init(struct ar8xxx_priv *priv) + if (!priv->chip_data) + return -ENOMEM; + +- if (priv->phy->mdio.dev.of_node) +- ret = ar8327_hw_config_of(priv, priv->phy->mdio.dev.of_node); ++ if (priv->phy->dev.of_node) ++ ret = ar8327_hw_config_of(priv, priv->phy->dev.of_node); + else + ret = ar8327_hw_config_pdata(priv, +- priv->phy->mdio.dev.platform_data); ++ priv->phy->dev.platform_data); + + if (ret) + return ret; +--- a/drivers/net/phy/ip17xx.c ++++ b/drivers/net/phy/ip17xx.c +@@ -1273,7 +1273,7 @@ static int ip17xx_probe(struct phy_devic + int err; + + /* We only attach to PHY 0, but use all available PHYs */ +- if (pdev->mdio.addr != 0) ++ if (pdev->addr != 0) + return -ENODEV; + + state = kzalloc(sizeof(*state), GFP_KERNEL); +@@ -1283,7 +1283,7 @@ static int ip17xx_probe(struct phy_devic + dev = &state->dev; + + pdev->priv = state; +- state->mii_bus = pdev->mdio.bus; ++ state->mii_bus = pdev->bus; + + err = get_model(state); + if (err < 0) +@@ -1295,7 +1295,7 @@ static int ip17xx_probe(struct phy_devic + dev->name = state->regs->NAME; + dev->ops = &ip17xx_ops; + +- pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->mdio.dev)); ++ pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->dev)); + return 0; + + error: +@@ -1353,25 +1353,58 @@ static int ip17xx_read_status(struct phy + return 0; + } + +-static struct phy_driver ip17xx_driver[] = { +- { +- .name = "IC+ IP17xx", +- .phy_id = 0x02430c00, +- .phy_id_mask = 0x0ffffc00, +- .features = PHY_BASIC_FEATURES, +- .probe = ip17xx_probe, +- .remove = ip17xx_remove, +- .config_init = ip17xx_config_init, +- .config_aneg = ip17xx_config_aneg, +- .aneg_done = ip17xx_aneg_done, +- .update_link = ip17xx_update_link, +- .read_status = ip17xx_read_status, +- } ++static struct phy_driver ip17xx_driver = { ++ .name = "IC+ IP17xx", ++ .phy_id = 0x02430c00, ++ .phy_id_mask = 0x0ffffc00, ++ .features = PHY_BASIC_FEATURES, ++ .probe = ip17xx_probe, ++ .remove = ip17xx_remove, ++ .config_init = ip17xx_config_init, ++ .config_aneg = ip17xx_config_aneg, ++ .aneg_done = ip17xx_aneg_done, ++ .update_link = ip17xx_update_link, ++ .read_status = ip17xx_read_status, ++ .driver = { .owner = THIS_MODULE }, + }; + +-module_phy_driver(ip17xx_driver); ++static struct phy_driver ip175a_driver = { ++ .name = "IC+ IP175A", ++ .phy_id = 0x02430c50, ++ .phy_id_mask = 0x0ffffff0, ++ .features = PHY_BASIC_FEATURES, ++ .probe = ip17xx_probe, ++ .remove = ip17xx_remove, ++ .config_init = ip17xx_config_init, ++ .config_aneg = ip17xx_config_aneg, ++ .aneg_done = ip17xx_aneg_done, ++ .update_link = ip17xx_update_link, ++ .read_status = ip17xx_read_status, ++ .driver = { .owner = THIS_MODULE }, ++}; ++ ++ ++int __init ip17xx_init(void) ++{ ++ int ret; ++ ++ ret = phy_driver_register(&ip175a_driver); ++ if (ret < 0) ++ return ret; ++ ++ return phy_driver_register(&ip17xx_driver); ++} ++ ++void __exit ip17xx_exit(void) ++{ ++ phy_driver_unregister(&ip17xx_driver); ++ phy_driver_unregister(&ip175a_driver); ++} + + MODULE_AUTHOR("Patrick Horn "); + MODULE_AUTHOR("Felix Fietkau "); + MODULE_AUTHOR("Martin Mares "); + MODULE_LICENSE("GPL"); ++ ++module_init(ip17xx_init); ++module_exit(ip17xx_exit); +--- a/drivers/net/phy/mvswitch.c ++++ b/drivers/net/phy/mvswitch.c +@@ -50,17 +50,13 @@ struct mvswitch_priv { + static inline u16 + r16(struct phy_device *phydev, int addr, int reg) + { +- struct mii_bus *bus = phydev->mdio.bus; +- +- return bus->read(bus, addr, reg); ++ return phydev->bus->read(phydev->bus, addr, reg); + } + + static inline void + w16(struct phy_device *phydev, int addr, int reg, u16 val) + { +- struct mii_bus *bus = phydev->mdio.bus; +- +- bus->write(bus, addr, reg, val); ++ phydev->bus->write(phydev->bus, addr, reg, val); + } + + +@@ -398,13 +394,12 @@ mvswitch_probe(struct phy_device *pdev) + static int + mvswitch_fixup(struct phy_device *dev) + { +- struct mii_bus *bus = dev->mdio.bus; + u16 reg; + +- if (dev->mdio.addr != 0x10) ++ if (dev->addr != 0x10) + return 0; + +- reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; ++ reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; + if (reg != MV_IDENT_VALUE) + return 0; + +@@ -425,13 +420,14 @@ static struct phy_driver mvswitch_driver + .config_aneg = &mvswitch_config_aneg, + .aneg_done = &mvswitch_aneg_done, + .read_status = &mvswitch_read_status, ++ .driver = { .owner = THIS_MODULE,}, + }; + + static int __init + mvswitch_init(void) + { + phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup); +- return phy_driver_register(&mvswitch_driver, THIS_MODULE); ++ return phy_driver_register(&mvswitch_driver); + } + + static void __exit +--- a/drivers/net/phy/psb6970.c ++++ b/drivers/net/phy/psb6970.c +@@ -70,16 +70,12 @@ struct psb6970_priv { + + static u16 psb6970_mii_read(struct phy_device *phydev, int reg) + { +- struct mii_bus *bus = phydev->mdio.bus; +- +- return bus->read(bus, PHYADDR(reg)); ++ return phydev->bus->read(phydev->bus, PHYADDR(reg)); + } + + static void psb6970_mii_write(struct phy_device *phydev, int reg, u16 val) + { +- struct mii_bus *bus = phydev->mdio.bus; +- +- bus->write(bus, PHYADDR(reg), val); ++ phydev->bus->write(phydev->bus, PHYADDR(reg), val); + } + + static int +@@ -316,11 +312,11 @@ static int psb6970_config_init(struct ph + + priv->phy = pdev; + +- if (pdev->mdio.addr == 0) ++ if (pdev->addr == 0) + printk(KERN_INFO "%s: psb6970 switch driver attached.\n", + pdev->attached_dev->name); + +- if (pdev->mdio.addr != 0) { ++ if (pdev->addr != 0) { + kfree(priv); + return 0; + } +@@ -388,14 +384,14 @@ static void psb6970_remove(struct phy_de + if (!priv) + return; + +- if (pdev->mdio.addr == 0) ++ if (pdev->addr == 0) + unregister_switch(&priv->dev); + kfree(priv); + } + + static int psb6970_fixup(struct phy_device *dev) + { +- struct mii_bus *bus = dev->mdio.bus; ++ struct mii_bus *bus = dev->bus; + u16 reg; + + /* look for the switch on the bus */ +@@ -419,12 +415,13 @@ static struct phy_driver psb6970_driver + .config_init = &psb6970_config_init, + .config_aneg = &psb6970_config_aneg, + .read_status = &psb6970_read_status, ++ .driver = {.owner = THIS_MODULE}, + }; + + int __init psb6970_init(void) + { + phy_register_fixup_for_id(PHY_ANY_ID, psb6970_fixup); +- return phy_driver_register(&psb6970_driver, THIS_MODULE); ++ return phy_driver_register(&psb6970_driver); + } + + module_init(psb6970_init); +--- a/drivers/net/phy/rtl8306.c ++++ b/drivers/net/phy/rtl8306.c +@@ -877,7 +877,7 @@ rtl8306_config_init(struct phy_device *p + int err; + + /* Only init the switch for the primary PHY */ +- if (pdev->mdio.addr != 0) ++ if (pdev->addr != 0) + return 0; + + val.value.i = 1; +@@ -887,7 +887,7 @@ rtl8306_config_init(struct phy_device *p + priv->dev.ops = &rtl8306_ops; + priv->do_cpu = 0; + priv->page = -1; +- priv->bus = pdev->mdio.bus; ++ priv->bus = pdev->bus; + + chipid = rtl_get(dev, RTL_REG_CHIPID); + chipver = rtl_get(dev, RTL_REG_CHIPVER); +@@ -933,13 +933,13 @@ rtl8306_fixup(struct phy_device *pdev) + u16 chipid; + + /* Attach to primary LAN port and WAN port */ +- if (pdev->mdio.addr != 0 && pdev->mdio.addr != 4) ++ if (pdev->addr != 0 && pdev->addr != 4) + return 0; + + memset(&priv, 0, sizeof(priv)); + priv.fixup = true; + priv.page = -1; +- priv.bus = pdev->mdio.bus; ++ priv.bus = pdev->bus; + chipid = rtl_get(&priv.dev, RTL_REG_CHIPID); + if (chipid == 0x5988) + pdev->phy_id = RTL8306_MAGIC; +@@ -957,14 +957,14 @@ rtl8306_probe(struct phy_device *pdev) + * share one rtl_priv instance between virtual phy + * devices on the same bus + */ +- if (priv->bus == pdev->mdio.bus) ++ if (priv->bus == pdev->bus) + goto found; + } + priv = kzalloc(sizeof(struct rtl_priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- priv->bus = pdev->mdio.bus; ++ priv->bus = pdev->bus; + + found: + pdev->priv = priv; +@@ -985,7 +985,7 @@ rtl8306_config_aneg(struct phy_device *p + struct rtl_priv *priv = pdev->priv; + + /* Only for WAN */ +- if (pdev->mdio.addr == 0) ++ if (pdev->addr == 0) + return 0; + + /* Restart autonegotiation */ +@@ -1001,7 +1001,7 @@ rtl8306_read_status(struct phy_device *p + struct rtl_priv *priv = pdev->priv; + struct switch_dev *dev = &priv->dev; + +- if (pdev->mdio.addr == 4) { ++ if (pdev->addr == 4) { + /* WAN */ + pdev->speed = rtl_get(dev, RTL_PORT_REG(4, SPEED)) ? SPEED_100 : SPEED_10; + pdev->duplex = rtl_get(dev, RTL_PORT_REG(4, DUPLEX)) ? DUPLEX_FULL : DUPLEX_HALF; +@@ -1044,6 +1044,7 @@ static struct phy_driver rtl8306_driver + .config_init = &rtl8306_config_init, + .config_aneg = &rtl8306_config_aneg, + .read_status = &rtl8306_read_status, ++ .driver = { .owner = THIS_MODULE,}, + }; + + +@@ -1051,7 +1052,7 @@ static int __init + rtl_init(void) + { + phy_register_fixup_for_id(PHY_ANY_ID, rtl8306_fixup); +- return phy_driver_register(&rtl8306_driver, THIS_MODULE); ++ return phy_driver_register(&rtl8306_driver); + } + + static void __exit diff --git a/target/linux/generic/pending-3.18/003-myloader_backport.patch b/target/linux/generic/pending-3.18/003-myloader_backport.patch new file mode 100644 index 000000000..846b25dc0 --- /dev/null +++ b/target/linux/generic/pending-3.18/003-myloader_backport.patch @@ -0,0 +1,11 @@ +--- a/drivers/mtd/myloader.c ++++ b/drivers/mtd/myloader.c +@@ -33,7 +33,7 @@ struct part_data { + }; + + static int myloader_parse_partitions(struct mtd_info *master, +- const struct mtd_partition **pparts, ++ struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { + struct part_data *buf; diff --git a/target/linux/generic/pending-3.18/020-ssb_update.patch b/target/linux/generic/pending-3.18/020-ssb_update.patch new file mode 100644 index 000000000..f94d160fc --- /dev/null +++ b/target/linux/generic/pending-3.18/020-ssb_update.patch @@ -0,0 +1,134 @@ +--- a/drivers/ssb/pcihost_wrapper.c ++++ b/drivers/ssb/pcihost_wrapper.c +@@ -11,15 +11,17 @@ + * Licensed under the GNU/GPL. See COPYING for details. + */ + ++#include + #include + #include + #include + #include + + +-#ifdef CONFIG_PM +-static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state) ++#ifdef CONFIG_PM_SLEEP ++static int ssb_pcihost_suspend(struct device *d) + { ++ struct pci_dev *dev = to_pci_dev(d); + struct ssb_bus *ssb = pci_get_drvdata(dev); + int err; + +@@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pc + return err; + pci_save_state(dev); + pci_disable_device(dev); +- pci_set_power_state(dev, pci_choose_state(dev, state)); ++ ++ /* if there is a wakeup enabled child device on ssb bus, ++ enable pci wakeup posibility. */ ++ device_set_wakeup_enable(d, d->power.wakeup_path); ++ ++ pci_prepare_to_sleep(dev); + + return 0; + } + +-static int ssb_pcihost_resume(struct pci_dev *dev) ++static int ssb_pcihost_resume(struct device *d) + { ++ struct pci_dev *dev = to_pci_dev(d); + struct ssb_bus *ssb = pci_get_drvdata(dev); + int err; + +- pci_set_power_state(dev, PCI_D0); ++ pci_back_from_sleep(dev); + err = pci_enable_device(dev); + if (err) + return err; +@@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci + + return 0; + } +-#else /* CONFIG_PM */ +-# define ssb_pcihost_suspend NULL +-# define ssb_pcihost_resume NULL +-#endif /* CONFIG_PM */ ++ ++static const struct dev_pm_ops ssb_pcihost_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume) ++}; ++ ++#endif /* CONFIG_PM_SLEEP */ + + static int ssb_pcihost_probe(struct pci_dev *dev, + const struct pci_device_id *id) +@@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driv + { + driver->probe = ssb_pcihost_probe; + driver->remove = ssb_pcihost_remove; +- driver->suspend = ssb_pcihost_suspend; +- driver->resume = ssb_pcihost_resume; ++#ifdef CONFIG_PM_SLEEP ++ driver->driver.pm = &ssb_pcihost_pm_ops; ++#endif + + return pci_register_driver(driver); + } +--- a/drivers/ssb/driver_pcicore.c ++++ b/drivers/ssb/driver_pcicore.c +@@ -357,6 +357,16 @@ static void ssb_pcicore_init_hostmode(st + pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, + SSB_PCICORE_SBTOPCI_MEM | SSB_PCI_DMA); + ++ /* ++ * Accessing PCI config without a proper delay after devices reset (not ++ * GPIO reset) was causing reboots on WRT300N v1.0 (BCM4704). ++ * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it ++ * completely. Flushing all writes was also tested but with no luck. ++ * The same problem was reported for WRT350N v1 (BCM4705), so we just ++ * sleep here unconditionally. ++ */ ++ usleep_range(1000, 2000); ++ + /* Enable PCI bridge BAR0 prefetch and burst */ + val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; + ssb_extpci_write_config(pc, 0, 0, 0, PCI_COMMAND, &val, 2); +--- a/drivers/ssb/main.c ++++ b/drivers/ssb/main.c +@@ -90,25 +90,6 @@ found: + } + #endif /* CONFIG_SSB_PCMCIAHOST */ + +-#ifdef CONFIG_SSB_SDIOHOST +-struct ssb_bus *ssb_sdio_func_to_bus(struct sdio_func *func) +-{ +- struct ssb_bus *bus; +- +- ssb_buses_lock(); +- list_for_each_entry(bus, &buses, list) { +- if (bus->bustype == SSB_BUSTYPE_SDIO && +- bus->host_sdio == func) +- goto found; +- } +- bus = NULL; +-found: +- ssb_buses_unlock(); +- +- return bus; +-} +-#endif /* CONFIG_SSB_SDIOHOST */ +- + int ssb_for_each_bus_call(unsigned long data, + int (*func)(struct ssb_bus *bus, unsigned long data)) + { +@@ -1154,6 +1135,8 @@ static u32 ssb_tmslow_reject_bitmask(str + case SSB_IDLOW_SSBREV_25: /* TODO - find the proper REJECT bit */ + case SSB_IDLOW_SSBREV_27: /* same here */ + return SSB_TMSLOW_REJECT; /* this is a guess */ ++ case SSB_IDLOW_SSBREV: ++ break; + default: + WARN(1, KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev); + } diff --git a/target/linux/generic/pending-3.18/021-ssb_sprom.patch b/target/linux/generic/pending-3.18/021-ssb_sprom.patch new file mode 100644 index 000000000..52d8080df --- /dev/null +++ b/target/linux/generic/pending-3.18/021-ssb_sprom.patch @@ -0,0 +1,32 @@ +--- a/include/linux/ssb/ssb.h ++++ b/include/linux/ssb/ssb.h +@@ -29,10 +29,13 @@ struct ssb_sprom { + u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ + u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ + u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */ ++ u8 et2mac[6] __aligned(sizeof(u16)); /* MAC address for extra Ethernet */ + u8 et0phyaddr; /* MII address for enet0 */ + u8 et1phyaddr; /* MII address for enet1 */ ++ u8 et2phyaddr; /* MII address for enet2 */ + u8 et0mdcport; /* MDIO for enet0 */ + u8 et1mdcport; /* MDIO for enet1 */ ++ u8 et2mdcport; /* MDIO for enet2 */ + u16 dev_id; /* Device ID overriding e.g. PCI ID */ + u16 board_rev; /* Board revision number from SPROM. */ + u16 board_num; /* Board number from SPROM. */ +@@ -88,11 +91,14 @@ struct ssb_sprom { + u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ + u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ + u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ ++ u32 boardflags; ++ u32 boardflags2; ++ u32 boardflags3; ++ /* TODO: Switch all drivers to new u32 fields and drop below ones */ + u16 boardflags_lo; /* Board flags (bits 0-15) */ + u16 boardflags_hi; /* Board flags (bits 16-31) */ + u16 boardflags2_lo; /* Board flags (bits 32-47) */ + u16 boardflags2_hi; /* Board flags (bits 48-63) */ +- /* TODO store board flags in a single u64 */ + + struct ssb_sprom_core_pwr_info core_pwr_info[4]; + diff --git a/target/linux/generic/pending-3.18/025-bcma_backport.patch b/target/linux/generic/pending-3.18/025-bcma_backport.patch new file mode 100644 index 000000000..ec1cb004b --- /dev/null +++ b/target/linux/generic/pending-3.18/025-bcma_backport.patch @@ -0,0 +1,286 @@ +--- a/drivers/bcma/bcma_private.h ++++ b/drivers/bcma/bcma_private.h +@@ -22,6 +22,7 @@ struct bcma_bus; + /* main.c */ + bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, + int timeout); ++void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); + int bcma_bus_register(struct bcma_bus *bus); + void bcma_bus_unregister(struct bcma_bus *bus); + int __init bcma_bus_early_register(struct bcma_bus *bus, +--- a/drivers/bcma/driver_chipcommon.c ++++ b/drivers/bcma/driver_chipcommon.c +@@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma + return; + } + +- irq = bcma_core_irq(cc->core); ++ irq = bcma_core_irq(cc->core, 0); + + /* Determine the registers of the UARTs */ + cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART); +--- a/drivers/bcma/driver_gpio.c ++++ b/drivers/bcma/driver_gpio.c +@@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(str + handle_simple_irq); + } + +- hwirq = bcma_core_irq(cc->core); ++ hwirq = bcma_core_irq(cc->core, 0); + err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio", + cc); + if (err) +@@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(st + return; + + bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO); +- free_irq(bcma_core_irq(cc->core), cc); ++ free_irq(bcma_core_irq(cc->core, 0), cc); + for (gpio = 0; gpio < chip->ngpio; gpio++) { + int irq = irq_find_mapping(cc->irq_domain, gpio); + +--- a/drivers/bcma/driver_mips.c ++++ b/drivers/bcma/driver_mips.c +@@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct + * If disabled, 5 is returned. + * If not supported, 6 is returned. + */ +-static unsigned int bcma_core_mips_irq(struct bcma_device *dev) ++unsigned int bcma_core_mips_irq(struct bcma_device *dev) + { + struct bcma_device *mdev = dev->bus->drv_mips.core; + u32 irqflag; +@@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(s + return 5; + } + +-unsigned int bcma_core_irq(struct bcma_device *dev) +-{ +- unsigned int mips_irq = bcma_core_mips_irq(dev); +- return mips_irq <= 4 ? mips_irq + 2 : 0; +-} +-EXPORT_SYMBOL(bcma_core_irq); +- + static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) + { + unsigned int oldirq = bcma_core_mips_irq(dev); +@@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv + break; + default: + list_for_each_entry(core, &bus->cores, list) { +- core->irq = bcma_core_irq(core); ++ core->irq = bcma_core_irq(core, 0); + } + bcma_err(bus, + "Unknown device (0x%x) found, can not configure IRQs\n", +--- a/drivers/bcma/driver_pci_host.c ++++ b/drivers/bcma/driver_pci_host.c +@@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct p + pr_info("PCI: Fixing up device %s\n", pci_name(dev)); + + /* Fix up interrupt lines */ +- dev->irq = bcma_core_irq(pc_host->pdev->core); ++ dev->irq = bcma_core_irq(pc_host->pdev->core, 0); + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); + + readrq = pcie_get_readrq(dev); +@@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const + + pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host, + pci_ops); +- return bcma_core_irq(pc_host->pdev->core); ++ return bcma_core_irq(pc_host->pdev->core, 0); + } + EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq); +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); + MODULE_LICENSE("GPL"); +@@ -153,6 +154,46 @@ static struct device_node *bcma_of_find_ + return NULL; + } + ++static int bcma_of_irq_parse(struct platform_device *parent, ++ struct bcma_device *core, ++ struct of_phandle_args *out_irq, int num) ++{ ++ __be32 laddr[1]; ++ int rc; ++ ++ if (core->dev.of_node) { ++ rc = of_irq_parse_one(core->dev.of_node, num, out_irq); ++ if (!rc) ++ return rc; ++ } ++ ++ out_irq->np = parent->dev.of_node; ++ out_irq->args_count = 1; ++ out_irq->args[0] = num; ++ ++ laddr[0] = cpu_to_be32(core->addr); ++ return of_irq_parse_raw(laddr, out_irq); ++} ++ ++static unsigned int bcma_of_get_irq(struct platform_device *parent, ++ struct bcma_device *core, int num) ++{ ++ struct of_phandle_args out_irq; ++ int ret; ++ ++ if (!parent || !parent->dev.of_node) ++ return 0; ++ ++ ret = bcma_of_irq_parse(parent, core, &out_irq, num); ++ if (ret) { ++ bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n", ++ ret); ++ return 0; ++ } ++ ++ return irq_create_of_mapping(&out_irq); ++} ++ + static void bcma_of_fill_device(struct platform_device *parent, + struct bcma_device *core) + { +@@ -161,18 +202,47 @@ static void bcma_of_fill_device(struct p + node = bcma_of_find_child_device(parent, core); + if (node) + core->dev.of_node = node; ++ ++ core->irq = bcma_of_get_irq(parent, core, 0); + } + #else + static void bcma_of_fill_device(struct platform_device *parent, + struct bcma_device *core) + { + } ++static inline unsigned int bcma_of_get_irq(struct platform_device *parent, ++ struct bcma_device *core, int num) ++{ ++ return 0; ++} + #endif /* CONFIG_OF */ + +-static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) ++unsigned int bcma_core_irq(struct bcma_device *core, int num) + { +- int err; ++ struct bcma_bus *bus = core->bus; ++ unsigned int mips_irq; ++ ++ switch (bus->hosttype) { ++ case BCMA_HOSTTYPE_PCI: ++ return bus->host_pci->irq; ++ case BCMA_HOSTTYPE_SOC: ++ if (bus->drv_mips.core && num == 0) { ++ mips_irq = bcma_core_mips_irq(core); ++ return mips_irq <= 4 ? mips_irq + 2 : 0; ++ } ++ if (bus->host_pdev) ++ return bcma_of_get_irq(bus->host_pdev, core, num); ++ return 0; ++ case BCMA_HOSTTYPE_SDIO: ++ return 0; ++ } + ++ return 0; ++} ++EXPORT_SYMBOL(bcma_core_irq); ++ ++void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) ++{ + core->dev.release = bcma_release_core_dev; + core->dev.bus = &bcma_bus_type; + dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); +@@ -196,6 +266,11 @@ static void bcma_register_core(struct bc + case BCMA_HOSTTYPE_SDIO: + break; + } ++} ++ ++static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) ++{ ++ int err; + + err = device_register(&core->dev); + if (err) { +--- a/drivers/bcma/scan.c ++++ b/drivers/bcma/scan.c +@@ -505,6 +505,7 @@ int bcma_bus_scan(struct bcma_bus *bus) + bus->nr_cores++; + other_core = bcma_find_core_reverse(bus, core->id.id); + core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1; ++ bcma_prepare_core(bus, core); + + bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", + core->core_index, bcma_device_name(&core->id), +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -448,4 +448,6 @@ extern u32 bcma_chipco_pll_read(struct b + #define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ + extern u32 bcma_core_dma_translation(struct bcma_device *core); + ++extern unsigned int bcma_core_irq(struct bcma_device *core, int num); ++ + #endif /* LINUX_BCMA_H_ */ +--- a/include/linux/bcma/bcma_driver_mips.h ++++ b/include/linux/bcma/bcma_driver_mips.h +@@ -43,12 +43,12 @@ struct bcma_drv_mips { + extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); + extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); + +-extern unsigned int bcma_core_irq(struct bcma_device *core); ++extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); + #else + static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } + static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } + +-static inline unsigned int bcma_core_irq(struct bcma_device *core) ++static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) + { + return 0; + } +--- a/Documentation/devicetree/bindings/bus/bcma.txt ++++ b/Documentation/devicetree/bindings/bus/bcma.txt +@@ -8,6 +8,11 @@ Required properties: + + The cores on the AXI bus are automatically detected by bcma with the + memory ranges they are using and they get registered afterwards. ++Automatic detection of the IRQ number is not working on ++BCM47xx/BCM53xx ARM SoCs. To assign IRQ numbers to the cores, provide ++them manually through device tree. Use an interrupt-map to specify the ++IRQ used by the devices on the bus. The first address is just an index, ++because we do not have any special register. + + The top-level axi bus may contain children representing attached cores + (devices). This is needed since some hardware details can't be auto +@@ -22,6 +27,22 @@ Example: + ranges = <0x00000000 0x18000000 0x00100000>; + #address-cells = <1>; + #size-cells = <1>; ++ #interrupt-cells = <1>; ++ interrupt-map-mask = <0x000fffff 0xffff>; ++ interrupt-map = ++ /* Ethernet Controller 0 */ ++ <0x00024000 0 &gic GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* Ethernet Controller 1 */ ++ <0x00025000 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; ++ ++ /* PCIe Controller 0 */ ++ <0x00012000 0 &gic GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 1 &gic GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 2 &gic GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 3 &gic GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 4 &gic GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 5 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; + + chipcommon { + reg = <0x00000000 0x1000>; diff --git a/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch b/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch new file mode 100644 index 000000000..628b0bd38 --- /dev/null +++ b/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch @@ -0,0 +1,527 @@ +--- a/drivers/bcma/bcma_private.h ++++ b/drivers/bcma/bcma_private.h +@@ -23,22 +23,18 @@ struct bcma_bus; + bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, + int timeout); + void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); ++void bcma_init_bus(struct bcma_bus *bus); + int bcma_bus_register(struct bcma_bus *bus); + void bcma_bus_unregister(struct bcma_bus *bus); +-int __init bcma_bus_early_register(struct bcma_bus *bus, +- struct bcma_device *core_cc, +- struct bcma_device *core_mips); ++int __init bcma_bus_early_register(struct bcma_bus *bus); + #ifdef CONFIG_PM + int bcma_bus_suspend(struct bcma_bus *bus); + int bcma_bus_resume(struct bcma_bus *bus); + #endif + + /* scan.c */ ++void bcma_detect_chip(struct bcma_bus *bus); + int bcma_bus_scan(struct bcma_bus *bus); +-int __init bcma_bus_scan_early(struct bcma_bus *bus, +- struct bcma_device_id *match, +- struct bcma_device *core); +-void bcma_init_bus(struct bcma_bus *bus); + + /* sprom.c */ + int bcma_sprom_get(struct bcma_bus *bus); +@@ -109,6 +105,14 @@ extern int bcma_chipco_watchdog_register + #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE + bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); + void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); ++#else ++static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) ++{ ++ return false; ++} ++static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) ++{ ++} + #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ + + #ifdef CONFIG_BCMA_DRIVER_GPIO +--- a/drivers/bcma/driver_chipcommon.c ++++ b/drivers/bcma/driver_chipcommon.c +@@ -79,7 +79,9 @@ static int bcma_chipco_watchdog_ticks_pe + + if (cc->capabilities & BCMA_CC_CAP_PMU) { + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) +- /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ ++ /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP ++ * clock ++ */ + return bcma_chipco_get_alp_clock(cc) / 4000; + else + /* based on 32KHz ILP clock */ +@@ -97,7 +99,8 @@ int bcma_chipco_watchdog_register(struct + wdt.driver_data = cc; + wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; + wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; +- wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; ++ wdt.max_timer_ms = ++ bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; + + pdev = platform_device_register_data(NULL, "bcm47xx-wdt", + cc->core->bus->num, &wdt, +@@ -175,7 +178,6 @@ void bcma_core_chipcommon_init(struct bc + u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) + { + u32 maxt; +- enum bcma_clkmode clkmode; + + maxt = bcma_chipco_watchdog_get_max_timer(cc); + if (cc->capabilities & BCMA_CC_CAP_PMU) { +@@ -185,8 +187,13 @@ u32 bcma_chipco_watchdog_timer_set(struc + ticks = maxt; + bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); + } else { +- clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; +- bcma_core_set_clockmode(cc->core, clkmode); ++ struct bcma_bus *bus = cc->core->bus; ++ ++ if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 && ++ bus->chipinfo.id != BCMA_CHIP_ID_BCM53018) ++ bcma_core_set_clockmode(cc->core, ++ ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC); ++ + if (ticks > maxt) + ticks = maxt; + /* instant NMI */ +@@ -335,7 +342,8 @@ void bcma_chipco_serial_init(struct bcma + | BCMA_CC_CORECTL_UARTCLKEN); + } + } else { +- bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", ccrev); ++ bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", ++ ccrev); + return; + } + +--- a/drivers/bcma/driver_pci.c ++++ b/drivers/bcma/driver_pci.c +@@ -145,6 +145,47 @@ static u16 bcma_pcie_mdio_writeread(stru + } + + /************************************************** ++ * Early init. ++ **************************************************/ ++ ++static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) ++{ ++ struct bcma_device *core = pc->core; ++ u16 val16, core_index; ++ uint regoff; ++ ++ regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); ++ core_index = (u16)core->core_index; ++ ++ val16 = pcicore_read16(pc, regoff); ++ if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) ++ != core_index) { ++ val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | ++ (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); ++ pcicore_write16(pc, regoff, val16); ++ } ++} ++ ++/* ++ * Apply some early fixes required before accessing SPROM. ++ * See also si_pci_fixcfg. ++ */ ++void bcma_core_pci_early_init(struct bcma_drv_pci *pc) ++{ ++ if (pc->early_setup_done) ++ return; ++ ++ pc->hostmode = bcma_core_pci_is_in_hostmode(pc); ++ if (pc->hostmode) ++ goto out; ++ ++ bcma_core_pci_fixcfg(pc); ++ ++out: ++ pc->early_setup_done = true; ++} ++ ++/************************************************** + * Workarounds. + **************************************************/ + +@@ -175,24 +216,6 @@ static void bcma_pcicore_serdes_workarou + tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); + } + +-static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) +-{ +- struct bcma_device *core = pc->core; +- u16 val16, core_index; +- uint regoff; +- +- regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); +- core_index = (u16)core->core_index; +- +- val16 = pcicore_read16(pc, regoff); +- if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) +- != core_index) { +- val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | +- (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); +- pcicore_write16(pc, regoff, val16); +- } +-} +- + /* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */ + /* Needs to happen when coming out of 'standby'/'hibernate' */ + static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) +@@ -216,7 +239,6 @@ static void bcma_core_pci_config_fixup(s + + static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) + { +- bcma_core_pci_fixcfg(pc); + bcma_pcicore_serdes_workaround(pc); + bcma_core_pci_config_fixup(pc); + } +@@ -226,13 +248,11 @@ void bcma_core_pci_init(struct bcma_drv_ + if (pc->setup_done) + return; + +-#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE +- pc->hostmode = bcma_core_pci_is_in_hostmode(pc); ++ bcma_core_pci_early_init(pc); ++ + if (pc->hostmode) + bcma_core_pci_hostmode_init(pc); +-#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ +- +- if (!pc->hostmode) ++ else + bcma_core_pci_clientmode_init(pc); + } + +--- a/drivers/bcma/host_pci.c ++++ b/drivers/bcma/host_pci.c +@@ -13,10 +13,12 @@ + + static void bcma_host_pci_switch_core(struct bcma_device *core) + { ++ int win2 = core->bus->host_is_pcie2 ? ++ BCMA_PCIE2_BAR0_WIN2 : BCMA_PCI_BAR0_WIN2; ++ + pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN, + core->addr); +- pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN2, +- core->wrap); ++ pci_write_config_dword(core->bus->host_pci, win2, core->wrap); + core->bus->mapped_core = core; + bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id); + } +--- a/drivers/bcma/host_soc.c ++++ b/drivers/bcma/host_soc.c +@@ -193,7 +193,7 @@ int __init bcma_host_soc_init(struct bcm + int err; + + /* Scan bus and initialize it */ +- err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips); ++ err = bcma_bus_early_register(bus); + if (err) + iounmap(bus->mmio); + +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus * + } + } + ++void bcma_init_bus(struct bcma_bus *bus) ++{ ++ mutex_lock(&bcma_buses_mutex); ++ bus->num = bcma_bus_next_num++; ++ mutex_unlock(&bcma_buses_mutex); ++ ++ INIT_LIST_HEAD(&bus->cores); ++ bus->nr_cores = 0; ++ ++ bcma_detect_chip(bus); ++} ++ + static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) + { + int err; +@@ -356,12 +368,19 @@ static void bcma_unregister_cores(struct + struct bcma_device *core, *tmp; + + list_for_each_entry_safe(core, tmp, &bus->cores, list) { ++ if (!core->dev_registered) ++ continue; + list_del(&core->list); +- if (core->dev_registered) +- device_unregister(&core->dev); ++ device_unregister(&core->dev); + } + if (bus->hosttype == BCMA_HOSTTYPE_SOC) + platform_device_unregister(bus->drv_cc.watchdog); ++ ++ /* Now noone uses internally-handled cores, we can free them */ ++ list_for_each_entry_safe(core, tmp, &bus->cores, list) { ++ list_del(&core->list); ++ kfree(core); ++ } + } + + int bcma_bus_register(struct bcma_bus *bus) +@@ -369,10 +388,6 @@ int bcma_bus_register(struct bcma_bus *b + int err; + struct bcma_device *core; + +- mutex_lock(&bcma_buses_mutex); +- bus->num = bcma_bus_next_num++; +- mutex_unlock(&bcma_buses_mutex); +- + /* Scan for devices (cores) */ + err = bcma_bus_scan(bus); + if (err) { +@@ -387,6 +402,13 @@ int bcma_bus_register(struct bcma_bus *b + bcma_core_chipcommon_early_init(&bus->drv_cc); + } + ++ /* Early init PCIE core */ ++ core = bcma_find_core(bus, BCMA_CORE_PCIE); ++ if (core) { ++ bus->drv_pci[0].core = core; ++ bcma_core_pci_early_init(&bus->drv_pci[0]); ++ } ++ + /* Cores providing flash access go before SPROM init */ + list_for_each_entry(core, &bus->cores, list) { + if (bcma_is_core_needed_early(core->id.id)) +@@ -459,7 +481,6 @@ int bcma_bus_register(struct bcma_bus *b + + void bcma_bus_unregister(struct bcma_bus *bus) + { +- struct bcma_device *cores[3]; + int err; + + err = bcma_gpio_unregister(&bus->drv_cc); +@@ -470,46 +491,23 @@ void bcma_bus_unregister(struct bcma_bus + + bcma_core_chipcommon_b_free(&bus->drv_cc_b); + +- cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); +- cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); +- cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); +- + bcma_unregister_cores(bus); +- +- kfree(cores[2]); +- kfree(cores[1]); +- kfree(cores[0]); + } + +-int __init bcma_bus_early_register(struct bcma_bus *bus, +- struct bcma_device *core_cc, +- struct bcma_device *core_mips) ++/* ++ * This is a special version of bus registration function designed for SoCs. ++ * It scans bus and performs basic initialization of main cores only. ++ * Please note it requires memory allocation, however it won't try to sleep. ++ */ ++int __init bcma_bus_early_register(struct bcma_bus *bus) + { + int err; + struct bcma_device *core; +- struct bcma_device_id match; +- +- match.manuf = BCMA_MANUF_BCM; +- match.id = bcma_cc_core_id(bus); +- match.class = BCMA_CL_SIM; +- match.rev = BCMA_ANY_REV; + +- /* Scan for chip common core */ +- err = bcma_bus_scan_early(bus, &match, core_cc); +- if (err) { +- bcma_err(bus, "Failed to scan for common core: %d\n", err); +- return -1; +- } +- +- match.manuf = BCMA_MANUF_MIPS; +- match.id = BCMA_CORE_MIPS_74K; +- match.class = BCMA_CL_SIM; +- match.rev = BCMA_ANY_REV; +- +- /* Scan for mips core */ +- err = bcma_bus_scan_early(bus, &match, core_mips); ++ /* Scan for devices (cores) */ ++ err = bcma_bus_scan(bus); + if (err) { +- bcma_err(bus, "Failed to scan for mips core: %d\n", err); ++ bcma_err(bus, "Failed to scan bus: %d\n", err); + return -1; + } + +--- a/drivers/bcma/scan.c ++++ b/drivers/bcma/scan.c +@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcm + return 0; + } + +-void bcma_init_bus(struct bcma_bus *bus) ++void bcma_detect_chip(struct bcma_bus *bus) + { + s32 tmp; + struct bcma_chipinfo *chipinfo = &(bus->chipinfo); + char chip_id[8]; + +- INIT_LIST_HEAD(&bus->cores); +- bus->nr_cores = 0; +- + bcma_scan_switch_core(bus, BCMA_ADDR_BASE); + + tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); +@@ -464,6 +461,10 @@ int bcma_bus_scan(struct bcma_bus *bus) + + int err, core_num = 0; + ++ /* Skip if bus was already scanned (e.g. during early register) */ ++ if (bus->nr_cores) ++ return 0; ++ + erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); + if (bus->hosttype == BCMA_HOSTTYPE_SOC) { + eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); +@@ -519,64 +520,6 @@ int bcma_bus_scan(struct bcma_bus *bus) + out: + if (bus->hosttype == BCMA_HOSTTYPE_SOC) + iounmap(eromptr); +- +- return err; +-} +- +-int __init bcma_bus_scan_early(struct bcma_bus *bus, +- struct bcma_device_id *match, +- struct bcma_device *core) +-{ +- u32 erombase; +- u32 __iomem *eromptr, *eromend; +- +- int err = -ENODEV; +- int core_num = 0; +- +- erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); +- if (bus->hosttype == BCMA_HOSTTYPE_SOC) { +- eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); +- if (!eromptr) +- return -ENOMEM; +- } else { +- eromptr = bus->mmio; +- } +- +- eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); +- +- bcma_scan_switch_core(bus, erombase); +- +- while (eromptr < eromend) { +- memset(core, 0, sizeof(*core)); +- INIT_LIST_HEAD(&core->list); +- core->bus = bus; +- +- err = bcma_get_next_core(bus, &eromptr, match, core_num, core); +- if (err == -ENODEV) { +- core_num++; +- continue; +- } else if (err == -ENXIO) +- continue; +- else if (err == -ESPIPE) +- break; +- else if (err < 0) +- goto out; +- +- core->core_index = core_num++; +- bus->nr_cores++; +- bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", +- core->core_index, bcma_device_name(&core->id), +- core->id.manuf, core->id.id, core->id.rev, +- core->id.class); +- +- list_add_tail(&core->list, &bus->cores); +- err = 0; +- break; +- } +- +-out: +- if (bus->hosttype == BCMA_HOSTTYPE_SOC) +- iounmap(eromptr); + + return err; + } +--- a/drivers/bcma/sprom.c ++++ b/drivers/bcma/sprom.c +@@ -579,7 +579,8 @@ int bcma_sprom_get(struct bcma_bus *bus) + u16 offset = BCMA_CC_SPROM; + u16 *sprom; + size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4, +- SSB_SPROMSIZE_WORDS_R10, }; ++ SSB_SPROMSIZE_WORDS_R10, ++ SSB_SPROMSIZE_WORDS_R11, }; + int i, err = 0; + + if (!bus->drv_cc.core) +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -319,6 +319,7 @@ struct bcma_bus { + const struct bcma_host_ops *ops; + + enum bcma_hosttype hosttype; ++ bool host_is_pcie2; /* Used for BCMA_HOSTTYPE_PCI only */ + union { + /* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */ + struct pci_dev *host_pci; +--- a/include/linux/bcma/bcma_driver_pci.h ++++ b/include/linux/bcma/bcma_driver_pci.h +@@ -223,6 +223,7 @@ struct bcma_drv_pci_host { + + struct bcma_drv_pci { + struct bcma_device *core; ++ u8 early_setup_done:1; + u8 setup_done:1; + u8 hostmode:1; + +@@ -237,6 +238,7 @@ struct bcma_drv_pci { + #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) + #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) + ++extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); + extern void bcma_core_pci_init(struct bcma_drv_pci *pc); + extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, + struct bcma_device *core, bool enable); +--- a/include/linux/bcma/bcma_regs.h ++++ b/include/linux/bcma/bcma_regs.h +@@ -64,6 +64,8 @@ + #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ + #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ + ++#define BCMA_PCIE2_BAR0_WIN2 0x70 ++ + /* SiliconBackplane Address Map. + * All regions may not exist on all chips. + */ +--- a/include/linux/bcma/bcma_soc.h ++++ b/include/linux/bcma/bcma_soc.h +@@ -5,8 +5,6 @@ + + struct bcma_soc { + struct bcma_bus bus; +- struct bcma_device core_cc; +- struct bcma_device core_mips; + }; + + int __init bcma_host_soc_register(struct bcma_soc *soc); +--- a/include/linux/ssb/ssb_regs.h ++++ b/include/linux/ssb/ssb_regs.h +@@ -173,6 +173,7 @@ + #define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) + #define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) + #define SSB_SPROMSIZE_WORDS_R10 230 ++#define SSB_SPROMSIZE_WORDS_R11 234 + #define SSB_SPROM_BASE1 0x1000 + #define SSB_SPROM_BASE31 0x0800 + #define SSB_SPROM_REVISION 0x007E diff --git a/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch b/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch new file mode 100644 index 000000000..c88a816fe --- /dev/null +++ b/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch @@ -0,0 +1,680 @@ +--- a/drivers/bcma/bcma_private.h ++++ b/drivers/bcma/bcma_private.h +@@ -24,6 +24,7 @@ bool bcma_wait_value(struct bcma_device + int timeout); + void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); + void bcma_init_bus(struct bcma_bus *bus); ++void bcma_unregister_cores(struct bcma_bus *bus); + int bcma_bus_register(struct bcma_bus *bus); + void bcma_bus_unregister(struct bcma_bus *bus); + int __init bcma_bus_early_register(struct bcma_bus *bus); +@@ -40,6 +41,9 @@ int bcma_bus_scan(struct bcma_bus *bus); + int bcma_sprom_get(struct bcma_bus *bus); + + /* driver_chipcommon.c */ ++void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); ++void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); ++void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); + #ifdef CONFIG_BCMA_DRIVER_MIPS + void bcma_chipco_serial_init(struct bcma_drv_cc *cc); + extern struct platform_device bcma_pflash_dev; +@@ -50,6 +54,8 @@ int bcma_core_chipcommon_b_init(struct b + void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb); + + /* driver_chipcommon_pmu.c */ ++void bcma_pmu_early_init(struct bcma_drv_cc *cc); ++void bcma_pmu_init(struct bcma_drv_cc *cc); + u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); + u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); + +@@ -98,7 +104,35 @@ static inline void __exit bcma_host_soc_ + #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */ + + /* driver_pci.c */ ++#ifdef CONFIG_BCMA_DRIVER_PCI + u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); ++void bcma_core_pci_early_init(struct bcma_drv_pci *pc); ++void bcma_core_pci_init(struct bcma_drv_pci *pc); ++void bcma_core_pci_up(struct bcma_drv_pci *pc); ++void bcma_core_pci_down(struct bcma_drv_pci *pc); ++#else ++static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc) ++{ ++ WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); ++} ++static inline void bcma_core_pci_init(struct bcma_drv_pci *pc) ++{ ++ /* Initialization is required for PCI hosted bus */ ++ WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); ++} ++#endif ++ ++/* driver_pcie2.c */ ++#ifdef CONFIG_BCMA_DRIVER_PCI ++void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); ++void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2); ++#else ++static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) ++{ ++ /* Initialization is required for PCI hosted bus */ ++ WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI); ++} ++#endif + + extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); + +@@ -115,6 +149,39 @@ static inline void bcma_core_pci_hostmod + } + #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ + ++/************************************************** ++ * driver_mips.c ++ **************************************************/ ++ ++#ifdef CONFIG_BCMA_DRIVER_MIPS ++unsigned int bcma_core_mips_irq(struct bcma_device *dev); ++void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); ++void bcma_core_mips_init(struct bcma_drv_mips *mcore); ++#else ++static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) ++{ ++ return 0; ++} ++static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) ++{ ++} ++static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) ++{ ++} ++#endif ++ ++/************************************************** ++ * driver_gmac_cmn.c ++ **************************************************/ ++ ++#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN ++void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); ++#else ++static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) ++{ ++} ++#endif ++ + #ifdef CONFIG_BCMA_DRIVER_GPIO + /* driver_gpio.c */ + int bcma_gpio_init(struct bcma_drv_cc *cc); +--- a/drivers/bcma/driver_gpio.c ++++ b/drivers/bcma/driver_gpio.c +@@ -17,6 +17,8 @@ + + #include "bcma_private.h" + ++#define BCMA_GPIO_MAX_PINS 32 ++ + static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip) + { + return container_of(chip, struct bcma_drv_cc, gpio); +@@ -76,7 +78,7 @@ static void bcma_gpio_free(struct gpio_c + bcma_chipco_gpio_pullup(cc, 1 << gpio, 0); + } + +-#if IS_BUILTIN(CONFIG_BCM47XX) ++#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) + static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) + { + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); +@@ -204,6 +206,7 @@ static void bcma_gpio_irq_domain_exit(st + + int bcma_gpio_init(struct bcma_drv_cc *cc) + { ++ struct bcma_bus *bus = cc->core->bus; + struct gpio_chip *chip = &cc->gpio; + int err; + +@@ -215,14 +218,14 @@ int bcma_gpio_init(struct bcma_drv_cc *c + chip->set = bcma_gpio_set_value; + chip->direction_input = bcma_gpio_direction_input; + chip->direction_output = bcma_gpio_direction_output; +-#if IS_BUILTIN(CONFIG_BCM47XX) ++#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) + chip->to_irq = bcma_gpio_to_irq; + #endif + #if IS_BUILTIN(CONFIG_OF) + if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) + chip->of_node = cc->core->dev.of_node; + #endif +- switch (cc->core->bus->chipinfo.id) { ++ switch (bus->chipinfo.id) { + case BCMA_CHIP_ID_BCM5357: + case BCMA_CHIP_ID_BCM53572: + chip->ngpio = 32; +@@ -231,13 +234,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c + chip->ngpio = 16; + } + +- /* There is just one SoC in one device and its GPIO addresses should be +- * deterministic to address them more easily. The other buses could get +- * a random base number. */ +- if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) +- chip->base = 0; +- else +- chip->base = -1; ++ /* ++ * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO ++ * pin numbers. We don't have Device Tree there and we can't really use ++ * relative (per chip) numbers. ++ * So let's use predictable base for BCM47XX and "random" for all other. ++ */ ++#if IS_BUILTIN(CONFIG_BCM47XX) ++ chip->base = bus->num * BCMA_GPIO_MAX_PINS; ++#else ++ chip->base = -1; ++#endif + + err = bcma_gpio_irq_domain_init(cc); + if (err) +--- a/drivers/bcma/driver_pci.c ++++ b/drivers/bcma/driver_pci.c +@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm + } + EXPORT_SYMBOL_GPL(bcma_core_pci_power_save); + +-int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, +- bool enable) +-{ +- struct pci_dev *pdev; +- u32 coremask, tmp; +- int err = 0; +- +- if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) { +- /* This bcma device is not on a PCI host-bus. So the IRQs are +- * not routed through the PCI core. +- * So we must not enable routing through the PCI core. */ +- goto out; +- } +- +- pdev = pc->core->bus->host_pci; +- +- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); +- if (err) +- goto out; +- +- coremask = BIT(core->core_index) << 8; +- if (enable) +- tmp |= coremask; +- else +- tmp &= ~coremask; +- +- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); +- +-out: +- return err; +-} +-EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); +- + static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) + { + u32 w; +@@ -328,28 +295,12 @@ static void bcma_core_pci_extend_L1timer + bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); + } + +-void bcma_core_pci_up(struct bcma_bus *bus) ++void bcma_core_pci_up(struct bcma_drv_pci *pc) + { +- struct bcma_drv_pci *pc; +- +- if (bus->hosttype != BCMA_HOSTTYPE_PCI) +- return; +- +- pc = &bus->drv_pci[0]; +- + bcma_core_pci_extend_L1timer(pc, true); + } +-EXPORT_SYMBOL_GPL(bcma_core_pci_up); + +-void bcma_core_pci_down(struct bcma_bus *bus) ++void bcma_core_pci_down(struct bcma_drv_pci *pc) + { +- struct bcma_drv_pci *pc; +- +- if (bus->hosttype != BCMA_HOSTTYPE_PCI) +- return; +- +- pc = &bus->drv_pci[0]; +- + bcma_core_pci_extend_L1timer(pc, false); + } +-EXPORT_SYMBOL_GPL(bcma_core_pci_down); +--- a/drivers/bcma/driver_pci_host.c ++++ b/drivers/bcma/driver_pci_host.c +@@ -11,6 +11,7 @@ + + #include "bcma_private.h" + #include ++#include + #include + #include + #include +--- a/drivers/bcma/driver_pcie2.c ++++ b/drivers/bcma/driver_pcie2.c +@@ -10,6 +10,7 @@ + + #include "bcma_private.h" + #include ++#include + + /************************************************** + * R/W ops. +@@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st + + void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) + { +- struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo; ++ struct bcma_bus *bus = pcie2->core->bus; ++ struct bcma_chipinfo *ci = &bus->chipinfo; + u32 tmp; + + tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54)); + if ((tmp & 0xe) >> 1 == 2) + bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17); + +- /* TODO: Do we need pcie_reqsize? */ ++ switch (bus->chipinfo.id) { ++ case BCMA_CHIP_ID_BCM4360: ++ case BCMA_CHIP_ID_BCM4352: ++ pcie2->reqsize = 1024; ++ break; ++ default: ++ pcie2->reqsize = 128; ++ break; ++ } + + if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3) + bcma_core_pcie2_war_delay_perst_enab(pcie2, true); +@@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr + pciedev_crwlpciegen2_180(pcie2); + pciedev_crwlpciegen2_182(pcie2); + } ++ ++/************************************************** ++ * Runtime ops. ++ **************************************************/ ++ ++void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2) ++{ ++ struct bcma_bus *bus = pcie2->core->bus; ++ struct pci_dev *dev = bus->host_pci; ++ int err; ++ ++ err = pcie_set_readrq(dev, pcie2->reqsize); ++ if (err) ++ bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err); ++} +--- a/drivers/bcma/host_pci.c ++++ b/drivers/bcma/host_pci.c +@@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pc + /* Initialize struct, detect chip */ + bcma_init_bus(bus); + ++ /* Scan bus to find out generation of PCIe core */ ++ err = bcma_bus_scan(bus); ++ if (err) ++ goto err_pci_unmap_mmio; ++ ++ if (bcma_find_core(bus, BCMA_CORE_PCIE2)) ++ bus->host_is_pcie2 = true; ++ + /* Register */ + err = bcma_bus_register(bus); + if (err) +- goto err_pci_unmap_mmio; ++ goto err_unregister_cores; + + pci_set_drvdata(dev, bus); + + out: + return err; + ++err_unregister_cores: ++ bcma_unregister_cores(bus); + err_pci_unmap_mmio: + pci_iounmap(dev, bus->mmio); + err_pci_release_regions: +@@ -283,9 +293,12 @@ static const struct pci_device_id bcma_p + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, ++ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) }, ++ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, ++ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */ + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */ +@@ -310,3 +323,65 @@ void __exit bcma_host_pci_exit(void) + { + pci_unregister_driver(&bcma_pci_bridge_driver); + } ++ ++/************************************************** ++ * Runtime ops for drivers. ++ **************************************************/ ++ ++/* See also pcicore_up */ ++void bcma_host_pci_up(struct bcma_bus *bus) ++{ ++ if (bus->hosttype != BCMA_HOSTTYPE_PCI) ++ return; ++ ++ if (bus->host_is_pcie2) ++ bcma_core_pcie2_up(&bus->drv_pcie2); ++ else ++ bcma_core_pci_up(&bus->drv_pci[0]); ++} ++EXPORT_SYMBOL_GPL(bcma_host_pci_up); ++ ++/* See also pcicore_down */ ++void bcma_host_pci_down(struct bcma_bus *bus) ++{ ++ if (bus->hosttype != BCMA_HOSTTYPE_PCI) ++ return; ++ ++ if (!bus->host_is_pcie2) ++ bcma_core_pci_down(&bus->drv_pci[0]); ++} ++EXPORT_SYMBOL_GPL(bcma_host_pci_down); ++ ++/* See also si_pci_setup */ ++int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, ++ bool enable) ++{ ++ struct pci_dev *pdev; ++ u32 coremask, tmp; ++ int err = 0; ++ ++ if (bus->hosttype != BCMA_HOSTTYPE_PCI) { ++ /* This bcma device is not on a PCI host-bus. So the IRQs are ++ * not routed through the PCI core. ++ * So we must not enable routing through the PCI core. */ ++ goto out; ++ } ++ ++ pdev = bus->host_pci; ++ ++ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); ++ if (err) ++ goto out; ++ ++ coremask = BIT(core->core_index) << 8; ++ if (enable) ++ tmp |= coremask; ++ else ++ tmp &= ~coremask; ++ ++ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); ++ ++out: ++ return err; ++} ++EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl); +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -363,7 +363,7 @@ static int bcma_register_devices(struct + return 0; + } + +-static void bcma_unregister_cores(struct bcma_bus *bus) ++void bcma_unregister_cores(struct bcma_bus *bus) + { + struct bcma_device *core, *tmp; + +--- a/drivers/net/wireless/b43/main.c ++++ b/drivers/net/wireless/b43/main.c +@@ -4770,7 +4770,7 @@ static void b43_wireless_core_exit(struc + switch (dev->dev->bus_type) { + #ifdef CONFIG_B43_BCMA + case B43_BUS_BCMA: +- bcma_core_pci_down(dev->dev->bdev->bus); ++ bcma_host_pci_down(dev->dev->bdev->bus); + break; + #endif + #ifdef CONFIG_B43_SSB +@@ -4817,9 +4817,9 @@ static int b43_wireless_core_init(struct + switch (dev->dev->bus_type) { + #ifdef CONFIG_B43_BCMA + case B43_BUS_BCMA: +- bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], ++ bcma_host_pci_irq_ctl(dev->dev->bdev->bus, + dev->dev->bdev, true); +- bcma_core_pci_up(dev->dev->bdev->bus); ++ bcma_host_pci_up(dev->dev->bdev->bus); + break; + #endif + #ifdef CONFIG_B43_SSB +--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c +@@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c + brcms_c_coredisable(wlc_hw); + + /* Match driver "down" state */ +- bcma_core_pci_down(wlc_hw->d11core->bus); ++ bcma_host_pci_down(wlc_hw->d11core->bus); + + /* turn off pll and xtal to match driver "down" state */ + brcms_b_xtal(wlc_hw, OFF); +@@ -4960,7 +4960,7 @@ static int brcms_b_up_prep(struct brcms_ + * Configure pci/pcmcia here instead of in brcms_c_attach() + * to allow mfg hotswap: down, hotswap (chip power cycle), up. + */ +- bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core, ++ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, + true); + + /* +@@ -4970,12 +4970,12 @@ static int brcms_b_up_prep(struct brcms_ + */ + if (brcms_b_radio_read_hwdisabled(wlc_hw)) { + /* put SB PCI in down state again */ +- bcma_core_pci_down(wlc_hw->d11core->bus); ++ bcma_host_pci_down(wlc_hw->d11core->bus); + brcms_b_xtal(wlc_hw, OFF); + return -ENOMEDIUM; + } + +- bcma_core_pci_up(wlc_hw->d11core->bus); ++ bcma_host_pci_up(wlc_hw->d11core->bus); + + /* reset the d11 core */ + brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); +@@ -5172,7 +5172,7 @@ static int brcms_b_down_finish(struct br + + /* turn off primary xtal and pll */ + if (!wlc_hw->noreset) { +- bcma_core_pci_down(wlc_hw->d11core->bus); ++ bcma_host_pci_down(wlc_hw->d11core->bus); + brcms_b_xtal(wlc_hw, OFF); + } + } +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -435,6 +435,27 @@ static inline struct bcma_device *bcma_f + return bcma_find_core_unit(bus, coreid, 0); + } + ++#ifdef CONFIG_BCMA_HOST_PCI ++extern void bcma_host_pci_up(struct bcma_bus *bus); ++extern void bcma_host_pci_down(struct bcma_bus *bus); ++extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus, ++ struct bcma_device *core, bool enable); ++#else ++static inline void bcma_host_pci_up(struct bcma_bus *bus) ++{ ++} ++static inline void bcma_host_pci_down(struct bcma_bus *bus) ++{ ++} ++static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus, ++ struct bcma_device *core, bool enable) ++{ ++ if (bus->hosttype == BCMA_HOSTTYPE_PCI) ++ return -ENOTSUPP; ++ return 0; ++} ++#endif ++ + extern bool bcma_core_is_enabled(struct bcma_device *core); + extern void bcma_core_disable(struct bcma_device *core, u32 flags); + extern int bcma_core_enable(struct bcma_device *core, u32 flags); +--- a/include/linux/bcma/bcma_driver_pci.h ++++ b/include/linux/bcma/bcma_driver_pci.h +@@ -238,13 +238,13 @@ struct bcma_drv_pci { + #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) + #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) + +-extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); +-extern void bcma_core_pci_init(struct bcma_drv_pci *pc); +-extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, +- struct bcma_device *core, bool enable); +-extern void bcma_core_pci_up(struct bcma_bus *bus); +-extern void bcma_core_pci_down(struct bcma_bus *bus); ++#ifdef CONFIG_BCMA_DRIVER_PCI + extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); ++#else ++static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up) ++{ ++} ++#endif + + extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); + extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); +--- a/include/linux/bcma/bcma_driver_pcie2.h ++++ b/include/linux/bcma/bcma_driver_pcie2.h +@@ -143,6 +143,8 @@ + + struct bcma_drv_pcie2 { + struct bcma_device *core; ++ ++ u16 reqsize; + }; + + #define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) +@@ -153,6 +155,4 @@ struct bcma_drv_pcie2 { + #define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) + #define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) + +-void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); +- + #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ +--- a/drivers/bcma/Kconfig ++++ b/drivers/bcma/Kconfig +@@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE + config BCMA_HOST_PCI + bool "Support for BCMA on PCI-host bus" + depends on BCMA_HOST_PCI_POSSIBLE ++ select BCMA_DRIVER_PCI + default y + + config BCMA_DRIVER_PCI_HOSTMODE +@@ -44,6 +45,22 @@ config BCMA_HOST_SOC + + If unsure, say N + ++config BCMA_DRIVER_PCI ++ bool "BCMA Broadcom PCI core driver" ++ depends on BCMA && PCI ++ default y ++ help ++ BCMA bus may have many versions of PCIe core. This driver ++ supports: ++ 1) PCIe core working in clientmode ++ 2) PCIe Gen 2 clientmode core ++ ++ In general PCIe (Gen 2) clientmode core is required on PCIe ++ hosted buses. It's responsible for initialization and basic ++ hardware management. ++ This driver is also prerequisite for a hostmode PCIe core ++ support. ++ + config BCMA_DRIVER_MIPS + bool "BCMA Broadcom MIPS core driver" + depends on BCMA && MIPS +--- a/drivers/bcma/Makefile ++++ b/drivers/bcma/Makefile +@@ -3,8 +3,8 @@ bcma-y += driver_chipcommon.o driver + bcma-y += driver_chipcommon_b.o + bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o + bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o +-bcma-y += driver_pci.o +-bcma-y += driver_pcie2.o ++bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o ++bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pcie2.o + bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o + bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o + bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o +--- a/include/linux/bcma/bcma_driver_chipcommon.h ++++ b/include/linux/bcma/bcma_driver_chipcommon.h +@@ -663,14 +663,6 @@ struct bcma_drv_cc_b { + #define bcma_cc_maskset32(cc, offset, mask, set) \ + bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) + +-extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); +-extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); +- +-extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); +-extern void bcma_chipco_resume(struct bcma_drv_cc *cc); +- +-void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); +- + extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); + + extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); +@@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_ + u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value); + + /* PMU support */ +-extern void bcma_pmu_init(struct bcma_drv_cc *cc); +-extern void bcma_pmu_early_init(struct bcma_drv_cc *cc); +- + extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, + u32 value); + extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, +--- a/include/linux/bcma/bcma_driver_gmac_cmn.h ++++ b/include/linux/bcma/bcma_driver_gmac_cmn.h +@@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn { + #define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val) + #define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) + +-#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN +-extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); +-#else +-static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { } +-#endif +- + #endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */ +--- a/include/linux/bcma/bcma_driver_mips.h ++++ b/include/linux/bcma/bcma_driver_mips.h +@@ -39,21 +39,6 @@ struct bcma_drv_mips { + u8 early_setup_done:1; + }; + +-#ifdef CONFIG_BCMA_DRIVER_MIPS +-extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); +-extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); +- +-extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); +-#else +-static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } +-static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } +- +-static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) +-{ +- return 0; +-} +-#endif +- + extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); + + #endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ diff --git a/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch b/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch new file mode 100644 index 000000000..ba3df18bd --- /dev/null +++ b/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch @@ -0,0 +1,86 @@ +--- a/drivers/bcma/driver_gpio.c ++++ b/drivers/bcma/driver_gpio.c +@@ -226,6 +226,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c + chip->of_node = cc->core->dev.of_node; + #endif + switch (bus->chipinfo.id) { ++ case BCMA_CHIP_ID_BCM4707: + case BCMA_CHIP_ID_BCM5357: + case BCMA_CHIP_ID_BCM53572: + chip->ngpio = 32; +@@ -235,16 +236,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c + } + + /* +- * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO +- * pin numbers. We don't have Device Tree there and we can't really use +- * relative (per chip) numbers. +- * So let's use predictable base for BCM47XX and "random" for all other. ++ * Register SoC GPIO devices with absolute GPIO pin base. ++ * On MIPS, we don't have Device Tree and we can't use relative (per chip) ++ * GPIO numbers. ++ * On some ARM devices, user space may want to access some system GPIO ++ * pins directly, which is easier to do with a predictable GPIO base. + */ +-#if IS_BUILTIN(CONFIG_BCM47XX) +- chip->base = bus->num * BCMA_GPIO_MAX_PINS; +-#else +- chip->base = -1; +-#endif ++ if (IS_BUILTIN(CONFIG_BCM47XX) || ++ cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) ++ chip->base = bus->num * BCMA_GPIO_MAX_PINS; ++ else ++ chip->base = -1; + + err = bcma_gpio_irq_domain_init(cc); + if (err) +--- a/drivers/bcma/Kconfig ++++ b/drivers/bcma/Kconfig +@@ -29,12 +29,6 @@ config BCMA_HOST_PCI + select BCMA_DRIVER_PCI + default y + +-config BCMA_DRIVER_PCI_HOSTMODE +- bool "Driver for PCI core working in hostmode" +- depends on BCMA && MIPS && BCMA_HOST_PCI +- help +- PCI core hostmode operation (external PCI bus). +- + config BCMA_HOST_SOC + bool "Support for BCMA in a SoC" + depends on BCMA +@@ -61,6 +55,12 @@ config BCMA_DRIVER_PCI + This driver is also prerequisite for a hostmode PCIe core + support. + ++config BCMA_DRIVER_PCI_HOSTMODE ++ bool "Driver for PCI core working in hostmode" ++ depends on BCMA && MIPS && BCMA_DRIVER_PCI ++ help ++ PCI core hostmode operation (external PCI bus). ++ + config BCMA_DRIVER_MIPS + bool "BCMA Broadcom MIPS core driver" + depends on BCMA && MIPS +--- a/include/linux/bcma/bcma_driver_pci.h ++++ b/include/linux/bcma/bcma_driver_pci.h +@@ -246,7 +246,18 @@ static inline void bcma_core_pci_power_s + } + #endif + ++#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE + extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); + extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); ++#else ++static inline int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev) ++{ ++ return -ENOTSUPP; ++} ++static inline int bcma_core_pci_plat_dev_init(struct pci_dev *dev) ++{ ++ return -ENOTSUPP; ++} ++#endif + + #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ diff --git a/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch b/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch new file mode 100644 index 000000000..5704081ee --- /dev/null +++ b/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch @@ -0,0 +1,26 @@ +commit 55acca90da52b85299c033354e51ddaa7b73e019 +Author: Hante Meuleman +Date: Fri Sep 18 22:08:17 2015 +0200 + + brcmfmac: Add support for the BCM4365 and BCM4366 PCIE devices. + + This patch adds support for the BCM4365 and BCM4366 11ac Wave2 + PCIE devices. + + Reviewed-by: Arend Van Spriel + Reviewed-by: Pieter-Paul Giesberts + Signed-off-by: Hante Meuleman + Signed-off-by: Arend van Spriel + Signed-off-by: Kalle Valo + +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -151,6 +151,8 @@ struct bcma_host_ops { + #define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */ + #define BCMA_CORE_USB30_DEV 0x83D + #define BCMA_CORE_ARM_CR4 0x83E ++#define BCMA_CORE_ARM_CA7 0x847 ++#define BCMA_CORE_SYS_MEM 0x849 + #define BCMA_CORE_DEFAULT 0xFFF + + #define BCMA_MAX_NR_CORES 16 diff --git a/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch b/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch new file mode 100644 index 000000000..7ae8b1db6 --- /dev/null +++ b/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch @@ -0,0 +1,52 @@ +--- /dev/null ++++ b/include/linux/bcm47xx_nvram.h +@@ -0,0 +1,49 @@ ++/* ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ */ ++ ++#ifndef __BCM47XX_NVRAM_H ++#define __BCM47XX_NVRAM_H ++ ++#include ++#include ++#include ++ ++#ifdef CONFIG_BCM47XX_NVRAM ++int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); ++int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); ++int bcm47xx_nvram_gpio_pin(const char *name); ++char *bcm47xx_nvram_get_contents(size_t *val_len); ++static inline void bcm47xx_nvram_release_contents(char *nvram) ++{ ++ vfree(nvram); ++}; ++#else ++static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) ++{ ++ return -ENOTSUPP; ++}; ++static inline int bcm47xx_nvram_getenv(const char *name, char *val, ++ size_t val_len) ++{ ++ return -ENOTSUPP; ++}; ++static inline int bcm47xx_nvram_gpio_pin(const char *name) ++{ ++ return -ENOTSUPP; ++}; ++ ++static inline char *bcm47xx_nvram_get_contents(size_t *val_len) ++{ ++ return NULL; ++}; ++ ++static inline void bcm47xx_nvram_release_contents(char *nvram) ++{ ++}; ++#endif ++ ++#endif /* __BCM47XX_NVRAM_H */ diff --git a/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch b/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch new file mode 100644 index 000000000..80f970830 --- /dev/null +++ b/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch @@ -0,0 +1,21 @@ +From: Vadim Kochan +Date: Mon, 12 Jan 2015 16:34:05 +0200 +Subject: [PATCH] nl80211: Allow set network namespace by fd + +Added new NL80211_ATTR_NETNS_FD which allows to +set namespace via nl80211 by fd. + +Signed-off-by: Vadim Kochan +Signed-off-by: Johannes Berg +--- + +--- a/net/core/net_namespace.c ++++ b/net/core/net_namespace.c +@@ -380,6 +380,7 @@ struct net *get_net_ns_by_fd(int fd) + return ERR_PTR(-EINVAL); + } + #endif ++EXPORT_SYMBOL_GPL(get_net_ns_by_fd); + + struct net *get_net_ns_by_pid(pid_t pid) + { diff --git a/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch b/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch new file mode 100644 index 000000000..171395dce --- /dev/null +++ b/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch @@ -0,0 +1,49 @@ +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -637,11 +637,36 @@ static int bcma_device_uevent(struct dev + core->id.rev, core->id.class); + } + +-static int __init bcma_modinit(void) ++static unsigned int bcma_bus_registered; ++ ++/* ++ * If built-in, bus has to be registered early, before any driver calls ++ * bcma_driver_register. ++ * Otherwise registering driver would trigger BUG in driver_register. ++ */ ++static int __init bcma_init_bus_register(void) + { + int err; + ++ if (bcma_bus_registered) ++ return 0; ++ + err = bus_register(&bcma_bus_type); ++ if (!err) ++ bcma_bus_registered = 1; ++ ++ return err; ++} ++#ifndef MODULE ++fs_initcall(bcma_init_bus_register); ++#endif ++ ++/* Main initialization has to be done with SPI/mtd/NAND/SPROM available */ ++static int __init bcma_modinit(void) ++{ ++ int err; ++ ++ err = bcma_init_bus_register(); + if (err) + return err; + +@@ -660,7 +685,7 @@ static int __init bcma_modinit(void) + + return err; + } +-fs_initcall(bcma_modinit); ++module_init(bcma_modinit); + + static void __exit bcma_modexit(void) + { diff --git a/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch b/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch new file mode 100644 index 000000000..85eeaad4d --- /dev/null +++ b/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch @@ -0,0 +1,716 @@ +--- a/drivers/bcma/driver_chipcommon.c ++++ b/drivers/bcma/driver_chipcommon.c +@@ -15,6 +15,8 @@ + #include + #include + ++static void bcma_chipco_serial_init(struct bcma_drv_cc *cc); ++ + static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, + u32 mask, u32 value) + { +@@ -113,8 +115,37 @@ int bcma_chipco_watchdog_register(struct + return 0; + } + ++static void bcma_core_chipcommon_flash_detect(struct bcma_drv_cc *cc) ++{ ++ struct bcma_bus *bus = cc->core->bus; ++ ++ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { ++ case BCMA_CC_FLASHT_STSER: ++ case BCMA_CC_FLASHT_ATSER: ++ bcma_debug(bus, "Found serial flash\n"); ++ bcma_sflash_init(cc); ++ break; ++ case BCMA_CC_FLASHT_PARA: ++ bcma_debug(bus, "Found parallel flash\n"); ++ bcma_pflash_init(cc); ++ break; ++ default: ++ bcma_err(bus, "Flash type not supported\n"); ++ } ++ ++ if (cc->core->id.rev == 38 || ++ bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { ++ if (cc->capabilities & BCMA_CC_CAP_NFLASH) { ++ bcma_debug(bus, "Found NAND flash\n"); ++ bcma_nflash_init(cc); ++ } ++ } ++} ++ + void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) + { ++ struct bcma_bus *bus = cc->core->bus; ++ + if (cc->early_setup_done) + return; + +@@ -129,6 +160,12 @@ void bcma_core_chipcommon_early_init(str + if (cc->capabilities & BCMA_CC_CAP_PMU) + bcma_pmu_early_init(cc); + ++ if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC) ++ bcma_chipco_serial_init(cc); ++ ++ if (bus->hosttype == BCMA_HOSTTYPE_SOC) ++ bcma_core_chipcommon_flash_detect(cc); ++ + cc->early_setup_done = true; + } + +@@ -185,11 +222,12 @@ u32 bcma_chipco_watchdog_timer_set(struc + ticks = 2; + else if (ticks > maxt) + ticks = maxt; +- bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); + } else { + struct bcma_bus *bus = cc->core->bus; + + if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 && ++ bus->chipinfo.id != BCMA_CHIP_ID_BCM47094 && + bus->chipinfo.id != BCMA_CHIP_ID_BCM53018) + bcma_core_set_clockmode(cc->core, + ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC); +@@ -314,9 +352,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcm + return res; + } + +-#ifdef CONFIG_BCMA_DRIVER_MIPS +-void bcma_chipco_serial_init(struct bcma_drv_cc *cc) ++static void bcma_chipco_serial_init(struct bcma_drv_cc *cc) + { ++#if IS_BUILTIN(CONFIG_BCM47XX) + unsigned int irq; + u32 baud_base; + u32 i; +@@ -358,5 +396,5 @@ void bcma_chipco_serial_init(struct bcma + ports[i].baud_base = baud_base; + ports[i].reg_shift = 0; + } ++#endif /* CONFIG_BCM47XX */ + } +-#endif /* CONFIG_BCMA_DRIVER_MIPS */ +--- a/drivers/bcma/driver_chipcommon_pmu.c ++++ b/drivers/bcma/driver_chipcommon_pmu.c +@@ -15,44 +15,44 @@ + + u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset) + { +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR); +- return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); ++ return bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); + } + EXPORT_SYMBOL_GPL(bcma_chipco_pll_read); + + void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value) + { +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR); +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value); + } + EXPORT_SYMBOL_GPL(bcma_chipco_pll_write); + + void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, + u32 set) + { +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR); +- bcma_cc_maskset32(cc, BCMA_CC_PLLCTL_DATA, mask, set); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_PLLCTL_DATA, mask, set); + } + EXPORT_SYMBOL_GPL(bcma_chipco_pll_maskset); + + void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc, + u32 offset, u32 mask, u32 set) + { +- bcma_cc_write32(cc, BCMA_CC_CHIPCTL_ADDR, offset); +- bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR); +- bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL_DATA, mask, set); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_CHIPCTL_ADDR, offset); ++ bcma_pmu_read32(cc, BCMA_CC_PMU_CHIPCTL_ADDR); ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_CHIPCTL_DATA, mask, set); + } + EXPORT_SYMBOL_GPL(bcma_chipco_chipctl_maskset); + + void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, + u32 set) + { +- bcma_cc_write32(cc, BCMA_CC_REGCTL_ADDR, offset); +- bcma_cc_read32(cc, BCMA_CC_REGCTL_ADDR); +- bcma_cc_maskset32(cc, BCMA_CC_REGCTL_DATA, mask, set); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_REGCTL_ADDR, offset); ++ bcma_pmu_read32(cc, BCMA_CC_PMU_REGCTL_ADDR); ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_REGCTL_DATA, mask, set); + } + EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset); + +@@ -60,18 +60,18 @@ static u32 bcma_pmu_xtalfreq(struct bcma + { + u32 ilp_ctl, alp_hz; + +- if (!(bcma_cc_read32(cc, BCMA_CC_PMU_STAT) & ++ if (!(bcma_pmu_read32(cc, BCMA_CC_PMU_STAT) & + BCMA_CC_PMU_STAT_EXT_LPO_AVAIL)) + return 0; + +- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, +- BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT)); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, ++ BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT)); + usleep_range(1000, 2000); + +- ilp_ctl = bcma_cc_read32(cc, BCMA_CC_PMU_XTAL_FREQ); ++ ilp_ctl = bcma_pmu_read32(cc, BCMA_CC_PMU_XTAL_FREQ); + ilp_ctl &= BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK; + +- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0); + + alp_hz = ilp_ctl * 32768 / 4; + return (alp_hz + 50000) / 100000 * 100; +@@ -127,8 +127,8 @@ static void bcma_pmu2_pll_init0(struct b + mask = (u32)~(BCMA_RES_4314_HT_AVAIL | + BCMA_RES_4314_MACPHY_CLK_AVAIL); + +- bcma_cc_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask); +- bcma_cc_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask); ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask); ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask); + bcma_wait_value(cc->core, BCMA_CLKCTLST, + BCMA_CLKCTLST_HAVEHT, 0, 20000); + break; +@@ -140,7 +140,7 @@ static void bcma_pmu2_pll_init0(struct b + + /* Flush */ + if (cc->pmu.rev >= 2) +- bcma_cc_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD); ++ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD); + + /* TODO: Do we need to update OTP? */ + } +@@ -195,9 +195,9 @@ static void bcma_pmu_resources_init(stru + + /* Set the resource masks. */ + if (min_msk) +- bcma_cc_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk); + if (max_msk) +- bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk); + + /* + * Add some delay; allow resources to come up and settle. +@@ -269,23 +269,33 @@ static void bcma_pmu_workarounds(struct + + void bcma_pmu_early_init(struct bcma_drv_cc *cc) + { ++ struct bcma_bus *bus = cc->core->bus; + u32 pmucap; + +- pmucap = bcma_cc_read32(cc, BCMA_CC_PMU_CAP); ++ if (cc->core->id.rev >= 35 && ++ cc->capabilities_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { ++ cc->pmu.core = bcma_find_core(bus, BCMA_CORE_PMU); ++ if (!cc->pmu.core) ++ bcma_warn(bus, "Couldn't find expected PMU core"); ++ } ++ if (!cc->pmu.core) ++ cc->pmu.core = cc->core; ++ ++ pmucap = bcma_pmu_read32(cc, BCMA_CC_PMU_CAP); + cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION); + +- bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n", +- cc->pmu.rev, pmucap); ++ bcma_debug(bus, "Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev, ++ pmucap); + } + + void bcma_pmu_init(struct bcma_drv_cc *cc) + { + if (cc->pmu.rev == 1) +- bcma_cc_mask32(cc, BCMA_CC_PMU_CTL, +- ~BCMA_CC_PMU_CTL_NOILPONW); ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_CTL, ++ ~BCMA_CC_PMU_CTL_NOILPONW); + else +- bcma_cc_set32(cc, BCMA_CC_PMU_CTL, +- BCMA_CC_PMU_CTL_NOILPONW); ++ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, ++ BCMA_CC_PMU_CTL_NOILPONW); + + bcma_pmu_pll_init(cc); + bcma_pmu_resources_init(cc); +@@ -472,8 +482,8 @@ u32 bcma_pmu_get_cpu_clock(struct bcma_d + static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset, + u32 value) + { +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value); + } + + void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid) +@@ -497,20 +507,20 @@ void bcma_pmu_spuravoid_pllupdate(struct + bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0; + + /* RMW only the P1 divider */ +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, + BCMA_CC_PMU_PLL_CTL0 + phypll_offset); +- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA); ++ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); + tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK)); + tmp |= (bcm5357_bcm43236_p1div[spuravoid] << BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT); +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp); + + /* RMW only the int feedback divider */ +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, + BCMA_CC_PMU_PLL_CTL2 + phypll_offset); +- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA); ++ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); + tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK); + tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT; +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp); + + tmp = BCMA_CC_PMU_CTL_PLL_UPD; + break; +@@ -646,7 +656,7 @@ void bcma_pmu_spuravoid_pllupdate(struct + break; + } + +- tmp |= bcma_cc_read32(cc, BCMA_CC_PMU_CTL); +- bcma_cc_write32(cc, BCMA_CC_PMU_CTL, tmp); ++ tmp |= bcma_pmu_read32(cc, BCMA_CC_PMU_CTL); ++ bcma_pmu_write32(cc, BCMA_CC_PMU_CTL, tmp); + } + EXPORT_SYMBOL_GPL(bcma_pmu_spuravoid_pllupdate); +--- a/drivers/bcma/driver_chipcommon_sflash.c ++++ b/drivers/bcma/driver_chipcommon_sflash.c +@@ -38,6 +38,7 @@ static const struct bcma_sflash_tbl_e bc + { "M25P32", 0x15, 0x10000, 64, }, + { "M25P64", 0x16, 0x10000, 128, }, + { "M25FL128", 0x17, 0x10000, 256, }, ++ { "MX25L25635F", 0x18, 0x10000, 512, }, + { NULL }, + }; + +--- a/drivers/bcma/scan.c ++++ b/drivers/bcma/scan.c +@@ -98,6 +98,9 @@ static const struct bcma_device_id_name + { BCMA_CORE_SHIM, "SHIM" }, + { BCMA_CORE_PCIE2, "PCIe Gen2" }, + { BCMA_CORE_ARM_CR4, "ARM CR4" }, ++ { BCMA_CORE_GCI, "GCI" }, ++ { BCMA_CORE_CMEM, "CNDS DDR2/3 memory controller" }, ++ { BCMA_CORE_ARM_CA7, "ARM CA7" }, + { BCMA_CORE_DEFAULT, "Default" }, + }; + +@@ -315,6 +318,8 @@ static int bcma_get_next_core(struct bcm + switch (core->id.id) { + case BCMA_CORE_4706_MAC_GBIT_COMMON: + case BCMA_CORE_NS_CHIPCOMMON_B: ++ case BCMA_CORE_PMU: ++ case BCMA_CORE_GCI: + /* Not used yet: case BCMA_CORE_OOB_ROUTER: */ + break; + default: +--- a/drivers/net/wireless/b43/main.c ++++ b/drivers/net/wireless/b43/main.c +@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str + case B43_BUS_BCMA: + bcma_cc = &dev->dev->bdev->bus->drv_cc; + +- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0); +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4); +- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4); +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4); ++ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0); ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4); ++ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4); ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4); + break; + #endif + #ifdef CONFIG_B43_SSB +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -151,6 +151,8 @@ struct bcma_host_ops { + #define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */ + #define BCMA_CORE_USB30_DEV 0x83D + #define BCMA_CORE_ARM_CR4 0x83E ++#define BCMA_CORE_GCI 0x840 ++#define BCMA_CORE_CMEM 0x846 /* CNDS DDR2/3 memory controller */ + #define BCMA_CORE_ARM_CA7 0x847 + #define BCMA_CORE_SYS_MEM 0x849 + #define BCMA_CORE_DEFAULT 0xFFF +@@ -200,6 +202,7 @@ struct bcma_host_ops { + #define BCMA_PKG_ID_BCM4707 1 + #define BCMA_PKG_ID_BCM4708 2 + #define BCMA_PKG_ID_BCM4709 0 ++#define BCMA_CHIP_ID_BCM47094 53030 + #define BCMA_CHIP_ID_BCM53018 53018 + + /* Board types (on PCI usually equals to the subsystem dev id) */ +--- a/include/linux/bcma/bcma_driver_chipcommon.h ++++ b/include/linux/bcma/bcma_driver_chipcommon.h +@@ -217,6 +217,11 @@ + #define BCMA_CC_CLKDIV_JTAG_SHIFT 8 + #define BCMA_CC_CLKDIV_UART 0x000000FF + #define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */ ++#define BCMA_CC_CAP_EXT_SECI_PRESENT 0x00000001 ++#define BCMA_CC_CAP_EXT_GSIO_PRESENT 0x00000002 ++#define BCMA_CC_CAP_EXT_GCI_PRESENT 0x00000004 ++#define BCMA_CC_CAP_EXT_SECI_PUART_PRESENT 0x00000008 /* UART present */ ++#define BCMA_CC_CAP_EXT_AOB_PRESENT 0x00000040 + #define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */ + #define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */ + #define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */ +@@ -351,12 +356,12 @@ + #define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ + #define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */ + #define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */ +-#define BCMA_CC_CHIPCTL_ADDR 0x0650 +-#define BCMA_CC_CHIPCTL_DATA 0x0654 +-#define BCMA_CC_REGCTL_ADDR 0x0658 +-#define BCMA_CC_REGCTL_DATA 0x065C +-#define BCMA_CC_PLLCTL_ADDR 0x0660 +-#define BCMA_CC_PLLCTL_DATA 0x0664 ++#define BCMA_CC_PMU_CHIPCTL_ADDR 0x0650 ++#define BCMA_CC_PMU_CHIPCTL_DATA 0x0654 ++#define BCMA_CC_PMU_REGCTL_ADDR 0x0658 ++#define BCMA_CC_PMU_REGCTL_DATA 0x065C ++#define BCMA_CC_PMU_PLLCTL_ADDR 0x0660 ++#define BCMA_CC_PMU_PLLCTL_DATA 0x0664 + #define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */ + #define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */ + #define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF +@@ -566,17 +571,16 @@ + * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) + */ + struct bcma_chipcommon_pmu { ++ struct bcma_device *core; /* Can be separated core or just ChipCommon one */ + u8 rev; /* PMU revision */ + u32 crystalfreq; /* The active crystal frequency (in kHz) */ + }; + +-#ifdef CONFIG_BCMA_DRIVER_MIPS ++#ifdef CONFIG_BCMA_PFLASH + struct bcma_pflash { + bool present; +- u8 buswidth; +- u32 window; +- u32 window_size; + }; ++#endif + + #ifdef CONFIG_BCMA_SFLASH + struct bcma_sflash { +@@ -602,6 +606,7 @@ struct bcma_nflash { + }; + #endif + ++#ifdef CONFIG_BCMA_DRIVER_MIPS + struct bcma_serial_port { + void *regs; + unsigned long clockspeed; +@@ -621,8 +626,9 @@ struct bcma_drv_cc { + /* Fast Powerup Delay constant */ + u16 fast_pwrup_delay; + struct bcma_chipcommon_pmu pmu; +-#ifdef CONFIG_BCMA_DRIVER_MIPS ++#ifdef CONFIG_BCMA_PFLASH + struct bcma_pflash pflash; ++#endif + #ifdef CONFIG_BCMA_SFLASH + struct bcma_sflash sflash; + #endif +@@ -630,6 +636,7 @@ struct bcma_drv_cc { + struct bcma_nflash nflash; + #endif + ++#ifdef CONFIG_BCMA_DRIVER_MIPS + int nr_serial_ports; + struct bcma_serial_port serial_ports[4]; + #endif /* CONFIG_BCMA_DRIVER_MIPS */ +@@ -663,6 +670,19 @@ struct bcma_drv_cc_b { + #define bcma_cc_maskset32(cc, offset, mask, set) \ + bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) + ++/* PMU registers access */ ++#define bcma_pmu_read32(cc, offset) \ ++ bcma_read32((cc)->pmu.core, offset) ++#define bcma_pmu_write32(cc, offset, val) \ ++ bcma_write32((cc)->pmu.core, offset, val) ++ ++#define bcma_pmu_mask32(cc, offset, mask) \ ++ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) & (mask)) ++#define bcma_pmu_set32(cc, offset, set) \ ++ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) | (set)) ++#define bcma_pmu_maskset32(cc, offset, mask, set) \ ++ bcma_pmu_write32(cc, offset, (bcma_pmu_read32(cc, offset) & (mask)) | (set)) ++ + extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); + + extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); +--- a/drivers/bcma/bcma_private.h ++++ b/drivers/bcma/bcma_private.h +@@ -44,10 +44,6 @@ int bcma_sprom_get(struct bcma_bus *bus) + void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); + void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); + void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); +-#ifdef CONFIG_BCMA_DRIVER_MIPS +-void bcma_chipco_serial_init(struct bcma_drv_cc *cc); +-extern struct platform_device bcma_pflash_dev; +-#endif /* CONFIG_BCMA_DRIVER_MIPS */ + + /* driver_chipcommon_b.c */ + int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb); +@@ -59,6 +55,21 @@ void bcma_pmu_init(struct bcma_drv_cc *c + u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); + u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); + ++/************************************************** ++ * driver_chipcommon_sflash.c ++ **************************************************/ ++ ++#ifdef CONFIG_BCMA_PFLASH ++extern struct platform_device bcma_pflash_dev; ++int bcma_pflash_init(struct bcma_drv_cc *cc); ++#else ++static inline int bcma_pflash_init(struct bcma_drv_cc *cc) ++{ ++ bcma_err(cc->core->bus, "Parallel flash not supported\n"); ++ return 0; ++} ++#endif /* CONFIG_BCMA_PFLASH */ ++ + #ifdef CONFIG_BCMA_SFLASH + /* driver_chipcommon_sflash.c */ + int bcma_sflash_init(struct bcma_drv_cc *cc); +--- a/drivers/bcma/driver_gpio.c ++++ b/drivers/bcma/driver_gpio.c +@@ -229,6 +229,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c + case BCMA_CHIP_ID_BCM4707: + case BCMA_CHIP_ID_BCM5357: + case BCMA_CHIP_ID_BCM53572: ++ case BCMA_CHIP_ID_BCM47094: + chip->ngpio = 32; + break; + default: +--- a/drivers/bcma/driver_mips.c ++++ b/drivers/bcma/driver_mips.c +@@ -14,8 +14,6 @@ + + #include + +-#include +-#include + #include + #include + #include +@@ -29,26 +27,6 @@ enum bcma_boot_dev { + BCMA_BOOT_DEV_NAND, + }; + +-static const char * const part_probes[] = { "bcm47xxpart", NULL }; +- +-static struct physmap_flash_data bcma_pflash_data = { +- .part_probe_types = part_probes, +-}; +- +-static struct resource bcma_pflash_resource = { +- .name = "bcma_pflash", +- .flags = IORESOURCE_MEM, +-}; +- +-struct platform_device bcma_pflash_dev = { +- .name = "physmap-flash", +- .dev = { +- .platform_data = &bcma_pflash_data, +- }, +- .resource = &bcma_pflash_resource, +- .num_resources = 1, +-}; +- + /* The 47162a0 hangs when reading MIPS DMP registers registers */ + static inline bool bcma_core_mips_bcm47162a0_quirk(struct bcma_device *dev) + { +@@ -269,48 +247,11 @@ static enum bcma_boot_dev bcma_boot_dev( + return BCMA_BOOT_DEV_SERIAL; + } + +-static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) ++static void bcma_core_mips_nvram_init(struct bcma_drv_mips *mcore) + { + struct bcma_bus *bus = mcore->core->bus; +- struct bcma_drv_cc *cc = &bus->drv_cc; +- struct bcma_pflash *pflash = &cc->pflash; + enum bcma_boot_dev boot_dev; + +- switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { +- case BCMA_CC_FLASHT_STSER: +- case BCMA_CC_FLASHT_ATSER: +- bcma_debug(bus, "Found serial flash\n"); +- bcma_sflash_init(cc); +- break; +- case BCMA_CC_FLASHT_PARA: +- bcma_debug(bus, "Found parallel flash\n"); +- pflash->present = true; +- pflash->window = BCMA_SOC_FLASH2; +- pflash->window_size = BCMA_SOC_FLASH2_SZ; +- +- if ((bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & +- BCMA_CC_FLASH_CFG_DS) == 0) +- pflash->buswidth = 1; +- else +- pflash->buswidth = 2; +- +- bcma_pflash_data.width = pflash->buswidth; +- bcma_pflash_resource.start = pflash->window; +- bcma_pflash_resource.end = pflash->window + pflash->window_size; +- +- break; +- default: +- bcma_err(bus, "Flash type not supported\n"); +- } +- +- if (cc->core->id.rev == 38 || +- bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { +- if (cc->capabilities & BCMA_CC_CAP_NFLASH) { +- bcma_debug(bus, "Found NAND flash\n"); +- bcma_nflash_init(cc); +- } +- } +- + /* Determine flash type this SoC boots from */ + boot_dev = bcma_boot_dev(bus); + switch (boot_dev) { +@@ -328,13 +269,10 @@ static void bcma_core_mips_flash_detect( + + void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) + { +- struct bcma_bus *bus = mcore->core->bus; +- + if (mcore->early_setup_done) + return; + +- bcma_chipco_serial_init(&bus->drv_cc); +- bcma_core_mips_flash_detect(mcore); ++ bcma_core_mips_nvram_init(mcore); + + mcore->early_setup_done = true; + } +--- a/drivers/bcma/host_pci.c ++++ b/drivers/bcma/host_pci.c +@@ -294,7 +294,7 @@ static const struct pci_device_id bcma_p + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, +- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) }, ++ { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, +--- a/drivers/bcma/Kconfig ++++ b/drivers/bcma/Kconfig +@@ -70,6 +70,11 @@ config BCMA_DRIVER_MIPS + + If unsure, say N + ++config BCMA_PFLASH ++ bool ++ depends on BCMA_DRIVER_MIPS ++ default y ++ + config BCMA_SFLASH + bool + depends on BCMA_DRIVER_MIPS +--- a/drivers/bcma/Makefile ++++ b/drivers/bcma/Makefile +@@ -1,6 +1,7 @@ + bcma-y += main.o scan.o core.o sprom.o + bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o + bcma-y += driver_chipcommon_b.o ++bcma-$(CONFIG_BCMA_PFLASH) += driver_chipcommon_pflash.o + bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o + bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o + bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o +--- /dev/null ++++ b/drivers/bcma/driver_chipcommon_pflash.c +@@ -0,0 +1,49 @@ ++/* ++ * Broadcom specific AMBA ++ * ChipCommon parallel flash ++ * ++ * Licensed under the GNU/GPL. See COPYING for details. ++ */ ++ ++#include "bcma_private.h" ++ ++#include ++#include ++#include ++ ++static const char * const part_probes[] = { "bcm47xxpart", NULL }; ++ ++static struct physmap_flash_data bcma_pflash_data = { ++ .part_probe_types = part_probes, ++}; ++ ++static struct resource bcma_pflash_resource = { ++ .name = "bcma_pflash", ++ .flags = IORESOURCE_MEM, ++}; ++ ++struct platform_device bcma_pflash_dev = { ++ .name = "physmap-flash", ++ .dev = { ++ .platform_data = &bcma_pflash_data, ++ }, ++ .resource = &bcma_pflash_resource, ++ .num_resources = 1, ++}; ++ ++int bcma_pflash_init(struct bcma_drv_cc *cc) ++{ ++ struct bcma_pflash *pflash = &cc->pflash; ++ ++ pflash->present = true; ++ ++ if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS)) ++ bcma_pflash_data.width = 1; ++ else ++ bcma_pflash_data.width = 2; ++ ++ bcma_pflash_resource.start = BCMA_SOC_FLASH2; ++ bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ; ++ ++ return 0; ++} +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -325,7 +325,7 @@ static int bcma_register_devices(struct + bcma_register_core(bus, core); + } + +-#ifdef CONFIG_BCMA_DRIVER_MIPS ++#ifdef CONFIG_BCMA_PFLASH + if (bus->drv_cc.pflash.present) { + err = platform_device_register(&bcma_pflash_dev); + if (err) diff --git a/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch b/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch new file mode 100644 index 000000000..b2d53f9f8 --- /dev/null +++ b/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch @@ -0,0 +1,50 @@ +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -15,8 +15,12 @@ + #include + #include + +-/* 10 parts were found on sflash on Netgear WNDR4500 */ +-#define BCM47XXPART_MAX_PARTS 12 ++/* ++ * NAND flash on Netgear R6250 was verified to contain 15 partitions. ++ * This will result in allocating too big array for some old devices, but the ++ * memory will be freed soon anyway (see mtd_device_parse_register). ++ */ ++#define BCM47XXPART_MAX_PARTS 20 + + /* + * Amount of bytes we read when analyzing each block of flash memory. +@@ -168,18 +172,26 @@ static int bcm47xxpart_parse(struct mtd_ + i++; + } + +- bcm47xxpart_add_part(&parts[curr_part++], "linux", +- offset + trx->offset[i], 0); +- i++; ++ if (trx->offset[i]) { ++ bcm47xxpart_add_part(&parts[curr_part++], ++ "linux", ++ offset + trx->offset[i], ++ 0); ++ i++; ++ } + + /* + * Pure rootfs size is known and can be calculated as: + * trx->length - trx->offset[i]. We don't fill it as + * we want to have jffs2 (overlay) in the same mtd. + */ +- bcm47xxpart_add_part(&parts[curr_part++], "rootfs", +- offset + trx->offset[i], 0); +- i++; ++ if (trx->offset[i]) { ++ bcm47xxpart_add_part(&parts[curr_part++], ++ "rootfs", ++ offset + trx->offset[i], ++ 0); ++ i++; ++ } + + last_trx_part = curr_part - 1; + diff --git a/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch b/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch new file mode 100644 index 000000000..f3dfa901f --- /dev/null +++ b/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch @@ -0,0 +1,95 @@ +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -15,6 +15,8 @@ + #include + #include + ++#include ++ + /* + * NAND flash on Netgear R6250 was verified to contain 15 partitions. + * This will result in allocating too big array for some old devices, but the +@@ -39,7 +41,8 @@ + #define ML_MAGIC1 0x39685a42 + #define ML_MAGIC2 0x26594131 + #define TRX_MAGIC 0x30524448 +-#define SQSH_MAGIC 0x71736873 /* shsq */ ++#define SHSQ_MAGIC 0x71736873 /* shsq (weird ZTE H218N endianness) */ ++#define UBI_EC_MAGIC 0x23494255 /* UBI# */ + + struct trx_header { + uint32_t magic; +@@ -50,7 +53,7 @@ struct trx_header { + uint32_t offset[3]; + } __packed; + +-static void bcm47xxpart_add_part(struct mtd_partition *part, char *name, ++static void bcm47xxpart_add_part(struct mtd_partition *part, const char *name, + u64 offset, uint32_t mask_flags) + { + part->name = name; +@@ -58,6 +61,26 @@ static void bcm47xxpart_add_part(struct + part->mask_flags = mask_flags; + } + ++static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, ++ size_t offset) ++{ ++ uint32_t buf; ++ size_t bytes_read; ++ ++ if (mtd_read(master, offset, sizeof(buf), &bytes_read, ++ (uint8_t *)&buf) < 0) { ++ pr_err("mtd_read error while parsing (offset: 0x%X)!\n", ++ offset); ++ goto out_default; ++ } ++ ++ if (buf == UBI_EC_MAGIC) ++ return "ubi"; ++ ++out_default: ++ return "rootfs"; ++} ++ + static int bcm47xxpart_parse(struct mtd_info *master, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +@@ -73,8 +96,12 @@ static int bcm47xxpart_parse(struct mtd_ + int last_trx_part = -1; + int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; + +- if (blocksize <= 0x10000) +- blocksize = 0x10000; ++ /* ++ * Some really old flashes (like AT45DB*) had smaller erasesize-s, but ++ * partitions were aligned to at least 0x1000 anyway. ++ */ ++ if (blocksize < 0x1000) ++ blocksize = 0x1000; + + /* Alloc */ + parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, +@@ -186,8 +213,11 @@ static int bcm47xxpart_parse(struct mtd_ + * we want to have jffs2 (overlay) in the same mtd. + */ + if (trx->offset[i]) { ++ const char *name; ++ ++ name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); + bcm47xxpart_add_part(&parts[curr_part++], +- "rootfs", ++ name, + offset + trx->offset[i], + 0); + i++; +@@ -203,7 +233,8 @@ static int bcm47xxpart_parse(struct mtd_ + } + + /* Squashfs on devices not using TRX */ +- if (buf[0x000 / 4] == SQSH_MAGIC) { ++ if (le32_to_cpu(buf[0x000 / 4]) == SQUASHFS_MAGIC || ++ buf[0x000 / 4] == SHSQ_MAGIC) { + bcm47xxpart_add_part(&parts[curr_part++], "rootfs", + offset, 0); + continue; diff --git a/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch b/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch new file mode 100644 index 000000000..b7bae34aa --- /dev/null +++ b/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch @@ -0,0 +1,15 @@ +mtd: spi-nor: support for (GigaDevice) GD25Q128B + +Signed-off-by: Rafał Miłecki +Signed-off-by: Brian Norris + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -510,6 +510,7 @@ static const struct spi_device_id spi_no + /* GigaDevice */ + { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, + { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, + + /* Intel/Numonyx -- xxxs33b */ + { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, diff --git a/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch b/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch new file mode 100644 index 000000000..24c264ba9 --- /dev/null +++ b/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch @@ -0,0 +1,39 @@ +--- a/drivers/mtd/devices/m25p80.c ++++ b/drivers/mtd/devices/m25p80.c +@@ -310,11 +310,21 @@ static const struct spi_device_id m25p_i + }; + MODULE_DEVICE_TABLE(spi, m25p_ids); + ++static const struct of_device_id m25p_of_table[] = { ++ /* ++ * Generic compatibility for SPI NOR that can be identified by the ++ * JEDEC READ ID opcode (0x9F). Use this, if possible. ++ */ ++ { .compatible = "jedec,spi-nor" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, m25p_of_table); + + static struct spi_driver m25p80_driver = { + .driver = { + .name = "m25p80", + .owner = THIS_MODULE, ++ .of_match_table = m25p_of_table, + }, + .id_table = m25p_ids, + .probe = m25p_probe, +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -934,8 +934,11 @@ int spi_nor_scan(struct spi_nor *nor, co + if (ret) + return ret; + +- id = spi_nor_match_id(name); ++ if (name) ++ id = spi_nor_match_id(name); + if (!id) ++ id = nor->read_id(nor); ++ if (IS_ERR_OR_NULL(id)) + return -ENOENT; + + info = (void *)id->driver_data; diff --git a/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch b/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch new file mode 100644 index 000000000..9f23db6a7 --- /dev/null +++ b/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch @@ -0,0 +1,509 @@ +Subject: netfilter: conntrack: cache route for forwarded connections + +... to avoid per-packet FIB lookup if possible. + +The cached dst is re-used provided the input interface +is the same as that of the previous packet in the same direction. + +If not, the cached dst is invalidated. + +For ipv6 we also need to store sernum, else dst_check doesn't work, +pointed out by Eric Dumazet. + +This should speed up forwarding when conntrack is already in use +anyway, especially when using reverse path filtering -- active RPF +enforces two FIB lookups for each packet. + +Before the routing cache removal this didn't matter since RPF was performed +only when route cache didn't yield a result; but without route cache it +comes at higher price. + +Julian Anastasov suggested to add NETDEV_UNREGISTER handler to +avoid holding on to dsts of 'frozen' conntracks. + +Signed-off-by: Florian Westphal + +--- a/include/net/netfilter/nf_conntrack_extend.h ++++ b/include/net/netfilter/nf_conntrack_extend.h +@@ -30,6 +30,9 @@ enum nf_ct_ext_id { + #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY) + NF_CT_EXT_SYNPROXY, + #endif ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) ++ NF_CT_EXT_RTCACHE, ++#endif + NF_CT_EXT_NUM, + }; + +@@ -43,6 +46,7 @@ enum nf_ct_ext_id { + #define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout + #define NF_CT_EXT_LABELS_TYPE struct nf_conn_labels + #define NF_CT_EXT_SYNPROXY_TYPE struct nf_conn_synproxy ++#define NF_CT_EXT_RTCACHE_TYPE struct nf_conn_rtcache + + /* Extensions: optional stuff which isn't permanently in struct. */ + struct nf_ct_ext { +--- /dev/null ++++ b/include/net/netfilter/nf_conntrack_rtcache.h +@@ -0,0 +1,34 @@ ++#include ++#include ++#include ++ ++struct dst_entry; ++ ++struct nf_conn_dst_cache { ++ struct dst_entry *dst; ++ int iif; ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) ++ u32 cookie; ++#endif ++ ++}; ++ ++struct nf_conn_rtcache { ++ struct nf_conn_dst_cache cached_dst[IP_CT_DIR_MAX]; ++}; ++ ++static inline ++struct nf_conn_rtcache *nf_ct_rtcache_find(const struct nf_conn *ct) ++{ ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) ++ return nf_ct_ext_find(ct, NF_CT_EXT_RTCACHE); ++#else ++ return NULL; ++#endif ++} ++ ++static inline int nf_conn_rtcache_iif_get(const struct nf_conn_rtcache *rtc, ++ enum ip_conntrack_dir dir) ++{ ++ return rtc->cached_dst[dir].iif; ++} +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -106,6 +106,18 @@ config NF_CONNTRACK_EVENTS + + If unsure, say `N'. + ++config NF_CONNTRACK_RTCACHE ++ tristate "Cache route entries in conntrack objects" ++ depends on NETFILTER_ADVANCED ++ depends on NF_CONNTRACK ++ help ++ If this option is enabled, the connection tracking code will ++ cache routing information for each connection that is being ++ forwarded, at a cost of 32 bytes per conntrack object. ++ ++ To compile it as a module, choose M here. If unsure, say N. ++ The module will be called nf_conntrack_rtcache. ++ + config NF_CONNTRACK_TIMEOUT + bool 'Connection tracking timeout' + depends on NETFILTER_ADVANCED +--- a/net/netfilter/Makefile ++++ b/net/netfilter/Makefile +@@ -18,6 +18,9 @@ obj-$(CONFIG_NETFILTER_NETLINK_LOG) += n + # connection tracking + obj-$(CONFIG_NF_CONNTRACK) += nf_conntrack.o + ++# optional conntrack route cache extension ++obj-$(CONFIG_NF_CONNTRACK_RTCACHE) += nf_conntrack_rtcache.o ++ + # SCTP protocol connection tracking + obj-$(CONFIG_NF_CT_PROTO_DCCP) += nf_conntrack_proto_dccp.o + obj-$(CONFIG_NF_CT_PROTO_GRE) += nf_conntrack_proto_gre.o +--- /dev/null ++++ b/net/netfilter/nf_conntrack_rtcache.c +@@ -0,0 +1,391 @@ ++/* route cache for netfilter. ++ * ++ * (C) 2014 Red Hat GmbH ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) ++#include ++#endif ++ ++static void __nf_conn_rtcache_destroy(struct nf_conn_rtcache *rtc, ++ enum ip_conntrack_dir dir) ++{ ++ struct dst_entry *dst = rtc->cached_dst[dir].dst; ++ ++ dst_release(dst); ++} ++ ++static void nf_conn_rtcache_destroy(struct nf_conn *ct) ++{ ++ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); ++ ++ if (!rtc) ++ return; ++ ++ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_ORIGINAL); ++ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_REPLY); ++} ++ ++static void nf_ct_rtcache_ext_add(struct nf_conn *ct) ++{ ++ struct nf_conn_rtcache *rtc; ++ ++ rtc = nf_ct_ext_add(ct, NF_CT_EXT_RTCACHE, GFP_ATOMIC); ++ if (rtc) { ++ rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif = -1; ++ rtc->cached_dst[IP_CT_DIR_ORIGINAL].dst = NULL; ++ rtc->cached_dst[IP_CT_DIR_REPLY].iif = -1; ++ rtc->cached_dst[IP_CT_DIR_REPLY].dst = NULL; ++ } ++} ++ ++static struct nf_conn_rtcache *nf_ct_rtcache_find_usable(struct nf_conn *ct) ++{ ++ if (nf_ct_is_untracked(ct)) ++ return NULL; ++ return nf_ct_rtcache_find(ct); ++} ++ ++static struct dst_entry * ++nf_conn_rtcache_dst_get(const struct nf_conn_rtcache *rtc, ++ enum ip_conntrack_dir dir) ++{ ++ return rtc->cached_dst[dir].dst; ++} ++ ++static u32 nf_rtcache_get_cookie(int pf, const struct dst_entry *dst) ++{ ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) ++ if (pf == NFPROTO_IPV6) { ++ const struct rt6_info *rt = (const struct rt6_info *)dst; ++ ++ if (rt->rt6i_node) ++ return (u32)rt->rt6i_node->fn_sernum; ++ } ++#endif ++ return 0; ++} ++ ++static void nf_conn_rtcache_dst_set(int pf, ++ struct nf_conn_rtcache *rtc, ++ struct dst_entry *dst, ++ enum ip_conntrack_dir dir, int iif) ++{ ++ if (rtc->cached_dst[dir].iif != iif) ++ rtc->cached_dst[dir].iif = iif; ++ ++ if (rtc->cached_dst[dir].dst != dst) { ++ struct dst_entry *old; ++ ++ dst_hold(dst); ++ ++ old = xchg(&rtc->cached_dst[dir].dst, dst); ++ dst_release(old); ++ ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) ++ if (pf == NFPROTO_IPV6) ++ rtc->cached_dst[dir].cookie = ++ nf_rtcache_get_cookie(pf, dst); ++#endif ++ } ++} ++ ++static void nf_conn_rtcache_dst_obsolete(struct nf_conn_rtcache *rtc, ++ enum ip_conntrack_dir dir) ++{ ++ struct dst_entry *old; ++ ++ pr_debug("Invalidate iif %d for dir %d on cache %p\n", ++ rtc->cached_dst[dir].iif, dir, rtc); ++ ++ old = xchg(&rtc->cached_dst[dir].dst, NULL); ++ dst_release(old); ++ rtc->cached_dst[dir].iif = -1; ++} ++ ++static unsigned int nf_rtcache_in(const struct nf_hook_ops *ops, ++ struct sk_buff *skb, ++ const struct net_device *in, ++ const struct net_device *out, ++ int (*okfn)(struct sk_buff *)) ++{ ++ struct nf_conn_rtcache *rtc; ++ enum ip_conntrack_info ctinfo; ++ enum ip_conntrack_dir dir; ++ struct dst_entry *dst; ++ struct nf_conn *ct; ++ int iif; ++ u32 cookie; ++ ++ if (skb_dst(skb) || skb->sk) ++ return NF_ACCEPT; ++ ++ ct = nf_ct_get(skb, &ctinfo); ++ if (!ct) ++ return NF_ACCEPT; ++ ++ rtc = nf_ct_rtcache_find_usable(ct); ++ if (!rtc) ++ return NF_ACCEPT; ++ ++ /* if iif changes, don't use cache and let ip stack ++ * do route lookup. ++ * ++ * If rp_filter is enabled it might toss skb, so ++ * we don't want to avoid these checks. ++ */ ++ dir = CTINFO2DIR(ctinfo); ++ iif = nf_conn_rtcache_iif_get(rtc, dir); ++ if (in->ifindex != iif) { ++ pr_debug("ct %p, iif %d, cached iif %d, skip cached entry\n", ++ ct, iif, in->ifindex); ++ return NF_ACCEPT; ++ } ++ dst = nf_conn_rtcache_dst_get(rtc, dir); ++ if (dst == NULL) ++ return NF_ACCEPT; ++ ++ cookie = nf_rtcache_get_cookie(ops->pf, dst); ++ ++ dst = dst_check(dst, cookie); ++ pr_debug("obtained dst %p for skb %p, cookie %d\n", dst, skb, cookie); ++ if (likely(dst)) ++ skb_dst_set_noref_force(skb, dst); ++ else ++ nf_conn_rtcache_dst_obsolete(rtc, dir); ++ ++ return NF_ACCEPT; ++} ++ ++static unsigned int nf_rtcache_forward(const struct nf_hook_ops *ops, ++ struct sk_buff *skb, ++ const struct net_device *in, ++ const struct net_device *out, ++ int (*okfn)(struct sk_buff *)) ++{ ++ struct nf_conn_rtcache *rtc; ++ enum ip_conntrack_info ctinfo; ++ enum ip_conntrack_dir dir; ++ struct nf_conn *ct; ++ struct dst_entry *dst = skb_dst(skb); ++ int iif; ++ ++ ct = nf_ct_get(skb, &ctinfo); ++ if (!ct) ++ return NF_ACCEPT; ++ ++ if (dst && dst_xfrm(dst)) ++ return NF_ACCEPT; ++ ++ if (!nf_ct_is_confirmed(ct)) { ++ if (WARN_ON(nf_ct_rtcache_find(ct))) ++ return NF_ACCEPT; ++ nf_ct_rtcache_ext_add(ct); ++ return NF_ACCEPT; ++ } ++ ++ rtc = nf_ct_rtcache_find_usable(ct); ++ if (!rtc) ++ return NF_ACCEPT; ++ ++ dir = CTINFO2DIR(ctinfo); ++ iif = nf_conn_rtcache_iif_get(rtc, dir); ++ pr_debug("ct %p, skb %p, dir %d, iif %d, cached iif %d\n", ++ ct, skb, dir, iif, in->ifindex); ++ if (likely(in->ifindex == iif)) ++ return NF_ACCEPT; ++ ++ nf_conn_rtcache_dst_set(ops->pf, rtc, skb_dst(skb), dir, in->ifindex); ++ return NF_ACCEPT; ++} ++ ++static int nf_rtcache_dst_remove(struct nf_conn *ct, void *data) ++{ ++ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); ++ struct net_device *dev = data; ++ ++ if (!rtc) ++ return 0; ++ ++ if (dev->ifindex == rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif || ++ dev->ifindex == rtc->cached_dst[IP_CT_DIR_REPLY].iif) { ++ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_ORIGINAL); ++ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_REPLY); ++ } ++ ++ return 0; ++} ++ ++static int nf_rtcache_netdev_event(struct notifier_block *this, ++ unsigned long event, void *ptr) ++{ ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr); ++ struct net *net = dev_net(dev); ++ ++ if (event == NETDEV_DOWN) ++ nf_ct_iterate_cleanup(net, nf_rtcache_dst_remove, dev, 0, 0); ++ ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block nf_rtcache_notifier = { ++ .notifier_call = nf_rtcache_netdev_event, ++}; ++ ++static struct nf_hook_ops rtcache_ops[] = { ++ { ++ .hook = nf_rtcache_in, ++ .owner = THIS_MODULE, ++ .pf = NFPROTO_IPV4, ++ .hooknum = NF_INET_PRE_ROUTING, ++ .priority = NF_IP_PRI_LAST, ++ }, ++ { ++ .hook = nf_rtcache_forward, ++ .owner = THIS_MODULE, ++ .pf = NFPROTO_IPV4, ++ .hooknum = NF_INET_FORWARD, ++ .priority = NF_IP_PRI_LAST, ++ }, ++#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) ++ { ++ .hook = nf_rtcache_in, ++ .owner = THIS_MODULE, ++ .pf = NFPROTO_IPV6, ++ .hooknum = NF_INET_PRE_ROUTING, ++ .priority = NF_IP_PRI_LAST, ++ }, ++ { ++ .hook = nf_rtcache_forward, ++ .owner = THIS_MODULE, ++ .pf = NFPROTO_IPV6, ++ .hooknum = NF_INET_FORWARD, ++ .priority = NF_IP_PRI_LAST, ++ }, ++#endif ++}; ++ ++static struct nf_ct_ext_type rtcache_extend __read_mostly = { ++ .len = sizeof(struct nf_conn_rtcache), ++ .align = __alignof__(struct nf_conn_rtcache), ++ .id = NF_CT_EXT_RTCACHE, ++ .destroy = nf_conn_rtcache_destroy, ++}; ++ ++static int __init nf_conntrack_rtcache_init(void) ++{ ++ int ret = nf_ct_extend_register(&rtcache_extend); ++ ++ if (ret < 0) { ++ pr_err("nf_conntrack_rtcache: Unable to register extension\n"); ++ return ret; ++ } ++ ++ ret = nf_register_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); ++ if (ret < 0) { ++ nf_ct_extend_unregister(&rtcache_extend); ++ return ret; ++ } ++ ++ ret = register_netdevice_notifier(&nf_rtcache_notifier); ++ if (ret) { ++ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); ++ nf_ct_extend_unregister(&rtcache_extend); ++ } ++ ++ return ret; ++} ++ ++static int nf_rtcache_ext_remove(struct nf_conn *ct, void *data) ++{ ++ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); ++ ++ return rtc != NULL; ++} ++ ++static bool __exit nf_conntrack_rtcache_wait_for_dying(struct net *net) ++{ ++ bool wait = false; ++ int cpu; ++ ++ for_each_possible_cpu(cpu) { ++ struct nf_conntrack_tuple_hash *h; ++ struct hlist_nulls_node *n; ++ struct nf_conn *ct; ++ struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); ++ ++ rcu_read_lock(); ++ spin_lock_bh(&pcpu->lock); ++ ++ hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { ++ ct = nf_ct_tuplehash_to_ctrack(h); ++ if (nf_ct_rtcache_find(ct) != NULL) { ++ wait = true; ++ break; ++ } ++ } ++ spin_unlock_bh(&pcpu->lock); ++ rcu_read_unlock(); ++ } ++ ++ return wait; ++} ++ ++static void __exit nf_conntrack_rtcache_fini(void) ++{ ++ struct net *net; ++ int count = 0; ++ ++ /* remove hooks so no new connections get rtcache extension */ ++ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); ++ ++ synchronize_net(); ++ ++ unregister_netdevice_notifier(&nf_rtcache_notifier); ++ ++ rtnl_lock(); ++ ++ /* zap all conntracks with rtcache extension */ ++ for_each_net(net) ++ nf_ct_iterate_cleanup(net, nf_rtcache_ext_remove, NULL, 0, 0); ++ ++ for_each_net(net) { ++ /* .. and make sure they're gone from dying list, too */ ++ while (nf_conntrack_rtcache_wait_for_dying(net)) { ++ msleep(200); ++ WARN_ONCE(++count > 25, "Waiting for all rtcache conntracks to go away\n"); ++ } ++ } ++ ++ rtnl_unlock(); ++ synchronize_net(); ++ nf_ct_extend_unregister(&rtcache_extend); ++} ++module_init(nf_conntrack_rtcache_init); ++module_exit(nf_conntrack_rtcache_fini); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Florian Westphal "); ++MODULE_DESCRIPTION("Conntrack route cache extension"); diff --git a/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch b/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch new file mode 100644 index 000000000..f7f88f813 --- /dev/null +++ b/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch @@ -0,0 +1,99 @@ +From 6ae4ae8e512bd229f806c22f8a2cd751e4f987c2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Linus=20L=C3=BCssing?= +Date: Sat, 23 May 2015 03:12:34 +0200 +Subject: [PATCH] bridge: allow setting hash_max + multicast_router if + interface is down +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Network managers like netifd (used in OpenWRT for instance) try to +configure interface options after creation but before setting the +interface up. + +Unfortunately the sysfs / bridge currently only allows to configure the +hash_max and multicast_router options when the bridge interface is up. +But since br_multicast_init() doesn't start any timers and only sets +default values and initializes timers it should be save to reconfigure +the default values after that, before things actually get active after +the bridge is set up. + +Signed-off-by: Linus Lüssing +Signed-off-by: David S. Miller +--- + net/bridge/br_multicast.c | 24 +++--------------------- + 1 file changed, 3 insertions(+), 21 deletions(-) + +--- a/net/bridge/br_multicast.c ++++ b/net/bridge/br_multicast.c +@@ -1948,11 +1948,9 @@ out: + + int br_multicast_set_router(struct net_bridge *br, unsigned long val) + { +- int err = -ENOENT; ++ int err = -EINVAL; + + spin_lock_bh(&br->multicast_lock); +- if (!netif_running(br->dev)) +- goto unlock; + + switch (val) { + case 0: +@@ -1963,13 +1961,8 @@ int br_multicast_set_router(struct net_b + br->multicast_router = val; + err = 0; + break; +- +- default: +- err = -EINVAL; +- break; + } + +-unlock: + spin_unlock_bh(&br->multicast_lock); + + return err; +@@ -1978,11 +1971,9 @@ unlock: + int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val) + { + struct net_bridge *br = p->br; +- int err = -ENOENT; ++ int err = -EINVAL; + + spin_lock(&br->multicast_lock); +- if (!netif_running(br->dev) || p->state == BR_STATE_DISABLED) +- goto unlock; + + switch (val) { + case 0: +@@ -2004,13 +1995,8 @@ int br_multicast_set_port_router(struct + + br_multicast_add_router(br, p); + break; +- +- default: +- err = -EINVAL; +- break; + } + +-unlock: + spin_unlock(&br->multicast_lock); + + return err; +@@ -2115,15 +2101,11 @@ unlock: + + int br_multicast_set_hash_max(struct net_bridge *br, unsigned long val) + { +- int err = -ENOENT; ++ int err = -EINVAL; + u32 old; + struct net_bridge_mdb_htable *mdb; + + spin_lock_bh(&br->multicast_lock); +- if (!netif_running(br->dev)) +- goto unlock; +- +- err = -EINVAL; + if (!is_power_of_2(val)) + goto unlock; + diff --git a/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch b/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch new file mode 100644 index 000000000..d215b80ab --- /dev/null +++ b/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/boot/compressed/string.c ++++ b/arch/mips/boot/compressed/string.c +@@ -26,3 +26,19 @@ void *memset(void *s, int c, size_t n) + ss[i] = c; + return s; + } ++ ++void *memmove(void *__dest, __const void *__src, size_t count) ++{ ++ unsigned char *d = __dest; ++ const unsigned char *s = __src; ++ ++ if (__dest == __src) ++ return __dest; ++ ++ if (__dest < __src) ++ return memcpy(__dest, __src, count); ++ ++ while (count--) ++ d[count] = s[count]; ++ return __dest; ++} diff --git a/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch b/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch new file mode 100644 index 000000000..0e7e4f8b1 --- /dev/null +++ b/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch @@ -0,0 +1,44 @@ +From 6216642f200258708e47170ff14ba8ecb486f4f0 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 18 Jan 2015 19:49:58 +0100 +Subject: [PATCH] bgmac: register napi before the device + +napi should get registered before the netdev and not after. + +Signed-off-by: Hauke Mehrtens +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bgmac.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1521,6 +1521,8 @@ static int bgmac_probe(struct bcma_devic + if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) + bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n"); + ++ netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); ++ + err = bgmac_mii_register(bgmac); + if (err) { + bgmac_err(bgmac, "Cannot register MDIO\n"); +@@ -1535,8 +1537,6 @@ static int bgmac_probe(struct bcma_devic + + netif_carrier_off(net_dev); + +- netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); +- + return 0; + + err_mii_unregister: +@@ -1555,9 +1555,9 @@ static void bgmac_remove(struct bcma_dev + { + struct bgmac *bgmac = bcma_get_drvdata(core); + +- netif_napi_del(&bgmac->napi); + unregister_netdev(bgmac->net_dev); + bgmac_mii_unregister(bgmac); ++ netif_napi_del(&bgmac->napi); + bgmac_dma_free(bgmac); + bcma_set_drvdata(core, NULL); + free_netdev(bgmac->net_dev); diff --git a/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch b/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch new file mode 100644 index 000000000..cc43d367c --- /dev/null +++ b/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch @@ -0,0 +1,30 @@ +From 43f159c60a99318b1ef7d1d7c16c4dfdd06bfd90 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 18 Jan 2015 19:49:59 +0100 +Subject: [PATCH] bgmac: activate irqs only if there is nothing to poll + +IRQs should only get activated when there is nothing to poll in the +queue any more and to after every poll. + +Signed-off-by: Hauke Mehrtens +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bgmac.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1167,10 +1167,10 @@ static int bgmac_poll(struct napi_struct + bgmac->int_status = 0; + } + +- if (handled < weight) ++ if (handled < weight) { + napi_complete(napi); +- +- bgmac_chip_intrs_on(bgmac); ++ bgmac_chip_intrs_on(bgmac); ++ } + + return handled; + } diff --git a/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch b/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch new file mode 100644 index 000000000..17fe5dff5 --- /dev/null +++ b/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch @@ -0,0 +1,50 @@ +From 8edfe3b6fad28da191c8fa15e4e0d8f7335a0091 Mon Sep 17 00:00:00 2001 +From: Peter Senna Tschudin +Date: Sat, 7 Mar 2015 12:10:26 +0100 +Subject: [PATCH] bgmac: Clean warning messages +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On my test environment the throughput of a file transfer drops +from 4.4MBps to 116KBps due the number of repeated warning +messages. This patch removes the warning messages as DMA works +correctly with addresses using 0xC0000000 bits. + +Signed-off-by: Peter Senna Tschudin +Acked-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bgmac.c | 7 ------- + 1 file changed, 7 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -302,9 +302,6 @@ static int bgmac_dma_rx_skb_for_slot(str + slot->skb = skb; + slot->dma_addr = dma_addr; + +- if (slot->dma_addr & 0xC0000000) +- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); +- + return 0; + } + +@@ -505,8 +502,6 @@ static int bgmac_dma_alloc(struct bgmac + ring->mmio_base); + goto err_dma_free; + } +- if (ring->dma_base & 0xC0000000) +- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); + + ring->unaligned = bgmac_dma_unaligned(bgmac, ring, + BGMAC_DMA_RING_TX); +@@ -536,8 +531,6 @@ static int bgmac_dma_alloc(struct bgmac + err = -ENOMEM; + goto err_dma_free; + } +- if (ring->dma_base & 0xC0000000) +- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); + + ring->unaligned = bgmac_dma_unaligned(bgmac, ring, + BGMAC_DMA_RING_RX); diff --git a/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch b/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch new file mode 100644 index 000000000..9f0baff0e --- /dev/null +++ b/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch @@ -0,0 +1,76 @@ +From c25b23b8a387e7d31f7a74af8e37b61e9e6ebb21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 20 Mar 2015 23:14:31 +0100 +Subject: [PATCH] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On ARM SoCs with bgmac Ethernet hardware we don't have any normal PHY. +There is always a switch attached but it's not even controlled over MDIO +like in case of MIPS devices. +We need a fixed PHY to be able to send/receive packets from the switch. + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bgmac.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1330,13 +1331,46 @@ static void bgmac_adjust_link(struct net + } + } + ++static int bgmac_fixed_phy_register(struct bgmac *bgmac) ++{ ++ struct fixed_phy_status fphy_status = { ++ .link = 1, ++ .speed = SPEED_1000, ++ .duplex = DUPLEX_FULL, ++ }; ++ struct phy_device *phy_dev; ++ int err; ++ ++ phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL); ++ if (!phy_dev || IS_ERR(phy_dev)) { ++ bgmac_err(bgmac, "Failed to register fixed PHY device\n"); ++ return -ENODEV; ++ } ++ ++ err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link, ++ PHY_INTERFACE_MODE_MII); ++ if (err) { ++ bgmac_err(bgmac, "Connecting PHY failed\n"); ++ return err; ++ } ++ ++ bgmac->phy_dev = phy_dev; ++ ++ return err; ++} ++ + static int bgmac_mii_register(struct bgmac *bgmac) + { ++ struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo; + struct mii_bus *mii_bus; + struct phy_device *phy_dev; + char bus_id[MII_BUS_ID_SIZE + 3]; + int i, err = 0; + ++ if (ci->id == BCMA_CHIP_ID_BCM4707 || ++ ci->id == BCMA_CHIP_ID_BCM53018) ++ return bgmac_fixed_phy_register(bgmac); ++ + mii_bus = mdiobus_alloc(); + if (!mii_bus) + return -ENOMEM; diff --git a/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch b/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch new file mode 100644 index 000000000..4513667e3 --- /dev/null +++ b/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch @@ -0,0 +1,28 @@ +From fc300dc3733fdc328e6e10c7b8379b60c26cd648 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 20 Mar 2015 23:14:32 +0100 +Subject: [PATCH] bgmac: allow enabling on ARCH_BCM_5301X +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Home routers based on ARM SoCs like BCM4708 also have bcma bus with core +supported by bgmac. + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/Kconfig ++++ b/drivers/net/ethernet/broadcom/Kconfig +@@ -143,7 +143,7 @@ config BNX2X_SRIOV + + config BGMAC + tristate "BCMA bus GBit core support" +- depends on BCMA_HOST_SOC && HAS_DMA && BCM47XX ++ depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X) + select PHYLIB + ---help--- + This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. diff --git a/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch b/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch new file mode 100644 index 000000000..939016c2e --- /dev/null +++ b/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch @@ -0,0 +1,30 @@ +From 37e9a6904520b525b542ecd67201164d06fdb95a Mon Sep 17 00:00:00 2001 +From: Mark Salter +Date: Thu, 11 Dec 2014 23:03:26 -0500 +Subject: [PATCH] net: phy: export fixed_phy_register() + +When building the bcmgenet driver as module, I get: + +ERROR: "fixed_phy_register" [drivers/net/ethernet/broadcom/genet/genet.ko] undefined! + +commit b0ba512e225d72 ("net: bcmgenet: enable driver to work without device +tree") which added a call to fixed_phy_register. But fixed_phy_register +needs to be exported if used from a module. + +Signed-off-by: Mark Salter +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/fixed.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/phy/fixed.c ++++ b/drivers/net/phy/fixed.c +@@ -274,6 +274,7 @@ struct phy_device *fixed_phy_register(un + + return phy; + } ++EXPORT_SYMBOL_GPL(fixed_phy_register); + + static int __init fixed_mdio_bus_init(void) + { diff --git a/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch b/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch new file mode 100644 index 000000000..fe8a60216 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch @@ -0,0 +1,24 @@ +From: Felix Fietkau +Date: Mon, 23 Mar 2015 02:40:06 +0100 +Subject: [PATCH] bgmac: fix descriptor frame start/end definitions + +The start-of-frame and end-of-frame bits were accidentally swapped. +In the current code it does not make any difference, since they are +always used together. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -345,8 +345,8 @@ + + #define BGMAC_DESC_CTL0_EOT 0x10000000 /* End of ring */ + #define BGMAC_DESC_CTL0_IOC 0x20000000 /* IRQ on complete */ +-#define BGMAC_DESC_CTL0_SOF 0x40000000 /* Start of frame */ +-#define BGMAC_DESC_CTL0_EOF 0x80000000 /* End of frame */ ++#define BGMAC_DESC_CTL0_EOF 0x40000000 /* End of frame */ ++#define BGMAC_DESC_CTL0_SOF 0x80000000 /* Start of frame */ + #define BGMAC_DESC_CTL1_LEN 0x00001FFF + + #define BGMAC_PHY_NOREGS 0x1E diff --git a/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch b/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch new file mode 100644 index 000000000..8dc5242b5 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch @@ -0,0 +1,189 @@ +From: Felix Fietkau +Date: Mon, 23 Mar 2015 02:41:25 +0100 +Subject: [PATCH] bgmac: implement GRO and use build_skb + +This improves performance for routing and local rx + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -276,31 +276,31 @@ static int bgmac_dma_rx_skb_for_slot(str + struct bgmac_slot_info *slot) + { + struct device *dma_dev = bgmac->core->dma_dev; +- struct sk_buff *skb; + dma_addr_t dma_addr; + struct bgmac_rx_header *rx; ++ void *buf; + + /* Alloc skb */ +- skb = netdev_alloc_skb(bgmac->net_dev, BGMAC_RX_BUF_SIZE); +- if (!skb) ++ buf = netdev_alloc_frag(BGMAC_RX_ALLOC_SIZE); ++ if (!buf) + return -ENOMEM; + + /* Poison - if everything goes fine, hardware will overwrite it */ +- rx = (struct bgmac_rx_header *)skb->data; ++ rx = buf; + rx->len = cpu_to_le16(0xdead); + rx->flags = cpu_to_le16(0xbeef); + + /* Map skb for the DMA */ +- dma_addr = dma_map_single(dma_dev, skb->data, +- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); ++ dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); + if (dma_mapping_error(dma_dev, dma_addr)) { + bgmac_err(bgmac, "DMA mapping error\n"); +- dev_kfree_skb(skb); ++ put_page(virt_to_head_page(buf)); + return -ENOMEM; + } + + /* Update the slot */ +- slot->skb = skb; ++ slot->buf = buf; + slot->dma_addr = dma_addr; + + return 0; +@@ -343,8 +343,9 @@ static int bgmac_dma_rx_read(struct bgma + while (ring->start != ring->end) { + struct device *dma_dev = bgmac->core->dma_dev; + struct bgmac_slot_info *slot = &ring->slots[ring->start]; +- struct sk_buff *skb = slot->skb; +- struct bgmac_rx_header *rx; ++ struct bgmac_rx_header *rx = slot->buf; ++ struct sk_buff *skb; ++ void *buf = slot->buf; + u16 len, flags; + + /* Unmap buffer to make it accessible to the CPU */ +@@ -352,7 +353,6 @@ static int bgmac_dma_rx_read(struct bgma + BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); + + /* Get info from the header */ +- rx = (struct bgmac_rx_header *)skb->data; + len = le16_to_cpu(rx->len); + flags = le16_to_cpu(rx->flags); + +@@ -393,12 +393,13 @@ static int bgmac_dma_rx_read(struct bgma + dma_unmap_single(dma_dev, old_dma_addr, + BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); + ++ skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); + skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); + skb_pull(skb, BGMAC_RX_FRAME_OFFSET); + + skb_checksum_none_assert(skb); + skb->protocol = eth_type_trans(skb, bgmac->net_dev); +- netif_receive_skb(skb); ++ napi_gro_receive(&bgmac->napi, skb); + handled++; + } while (0); + +@@ -434,12 +435,11 @@ static bool bgmac_dma_unaligned(struct b + return false; + } + +-static void bgmac_dma_ring_free(struct bgmac *bgmac, +- struct bgmac_dma_ring *ring) ++static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, ++ struct bgmac_dma_ring *ring) + { + struct device *dma_dev = bgmac->core->dma_dev; + struct bgmac_slot_info *slot; +- int size; + int i; + + for (i = 0; i < ring->num_slots; i++) { +@@ -451,23 +451,55 @@ static void bgmac_dma_ring_free(struct b + dev_kfree_skb(slot->skb); + } + } ++} ++ ++static void bgmac_dma_rx_ring_free(struct bgmac *bgmac, ++ struct bgmac_dma_ring *ring) ++{ ++ struct device *dma_dev = bgmac->core->dma_dev; ++ struct bgmac_slot_info *slot; ++ int i; ++ ++ for (i = 0; i < ring->num_slots; i++) { ++ slot = &ring->slots[i]; ++ if (!slot->buf) ++ continue; + +- if (ring->cpu_base) { +- /* Free ring of descriptors */ +- size = ring->num_slots * sizeof(struct bgmac_dma_desc); +- dma_free_coherent(dma_dev, size, ring->cpu_base, +- ring->dma_base); ++ if (slot->dma_addr) ++ dma_unmap_single(dma_dev, slot->dma_addr, ++ BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); ++ put_page(virt_to_head_page(slot->buf)); + } + } + ++static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, ++ struct bgmac_dma_ring *ring) ++{ ++ struct device *dma_dev = bgmac->core->dma_dev; ++ int size; ++ ++ if (!ring->cpu_base) ++ return; ++ ++ /* Free ring of descriptors */ ++ size = ring->num_slots * sizeof(struct bgmac_dma_desc); ++ dma_free_coherent(dma_dev, size, ring->cpu_base, ++ ring->dma_base); ++} ++ + static void bgmac_dma_free(struct bgmac *bgmac) + { + int i; + +- for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) +- bgmac_dma_ring_free(bgmac, &bgmac->tx_ring[i]); +- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) +- bgmac_dma_ring_free(bgmac, &bgmac->rx_ring[i]); ++ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { ++ bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]); ++ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); ++ } ++ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { ++ bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]); ++ bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); ++ } + } + + static int bgmac_dma_alloc(struct bgmac *bgmac) +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -362,6 +362,8 @@ + #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ + #define BGMAC_RX_MAX_FRAME_SIZE 1536 /* Copied from b44/tg3 */ + #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) ++#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE) + \ ++ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) + + #define BGMAC_BFL_ENETROBO 0x0010 /* has ephy roboswitch spi */ + #define BGMAC_BFL_ENETADM 0x0080 /* has ADMtek switch */ +@@ -383,7 +385,10 @@ + #define ETHER_MAX_LEN 1518 + + struct bgmac_slot_info { +- struct sk_buff *skb; ++ union { ++ struct sk_buff *skb; ++ void *buf; ++ }; + dma_addr_t dma_addr; + }; + diff --git a/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch b/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch new file mode 100644 index 000000000..642dd2ad7 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch @@ -0,0 +1,267 @@ +From: Felix Fietkau +Date: Mon, 23 Mar 2015 02:42:26 +0100 +Subject: [PATCH] bgmac: implement scatter/gather support + +Always use software checksumming, since the hardware does not have any +checksum offload support. +This significantly improves local TCP tx performance. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -115,53 +115,91 @@ static void bgmac_dma_tx_enable(struct b + bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, ctl); + } + ++static void ++bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring, ++ int i, int len, u32 ctl0) ++{ ++ struct bgmac_slot_info *slot; ++ struct bgmac_dma_desc *dma_desc; ++ u32 ctl1; ++ ++ if (i == ring->num_slots - 1) ++ ctl0 |= BGMAC_DESC_CTL0_EOT; ++ ++ ctl1 = len & BGMAC_DESC_CTL1_LEN; ++ ++ slot = &ring->slots[i]; ++ dma_desc = &ring->cpu_base[i]; ++ dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr)); ++ dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr)); ++ dma_desc->ctl0 = cpu_to_le32(ctl0); ++ dma_desc->ctl1 = cpu_to_le32(ctl1); ++} ++ + static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, + struct bgmac_dma_ring *ring, + struct sk_buff *skb) + { + struct device *dma_dev = bgmac->core->dma_dev; + struct net_device *net_dev = bgmac->net_dev; +- struct bgmac_dma_desc *dma_desc; +- struct bgmac_slot_info *slot; +- u32 ctl0, ctl1; ++ struct bgmac_slot_info *slot = &ring->slots[ring->end]; + int free_slots; ++ int nr_frags; ++ u32 flags; ++ int index = ring->end; ++ int i; + + if (skb->len > BGMAC_DESC_CTL1_LEN) { + bgmac_err(bgmac, "Too long skb (%d)\n", skb->len); +- goto err_stop_drop; ++ goto err_drop; + } + ++ if (skb->ip_summed == CHECKSUM_PARTIAL) ++ skb_checksum_help(skb); ++ ++ nr_frags = skb_shinfo(skb)->nr_frags; ++ + if (ring->start <= ring->end) + free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; + else + free_slots = ring->start - ring->end; +- if (free_slots == 1) { ++ ++ if (free_slots <= nr_frags + 1) { + bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); + netif_stop_queue(net_dev); + return NETDEV_TX_BUSY; + } + +- slot = &ring->slots[ring->end]; +- slot->skb = skb; +- slot->dma_addr = dma_map_single(dma_dev, skb->data, skb->len, ++ slot->dma_addr = dma_map_single(dma_dev, skb->data, skb_headlen(skb), + DMA_TO_DEVICE); +- if (dma_mapping_error(dma_dev, slot->dma_addr)) { +- bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", +- ring->mmio_base); +- goto err_stop_drop; +- } ++ if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr))) ++ goto err_dma_head; + +- ctl0 = BGMAC_DESC_CTL0_IOC | BGMAC_DESC_CTL0_SOF | BGMAC_DESC_CTL0_EOF; +- if (ring->end == ring->num_slots - 1) +- ctl0 |= BGMAC_DESC_CTL0_EOT; +- ctl1 = skb->len & BGMAC_DESC_CTL1_LEN; ++ flags = BGMAC_DESC_CTL0_SOF; ++ if (!nr_frags) ++ flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC; ++ ++ bgmac_dma_tx_add_buf(bgmac, ring, index, skb_headlen(skb), flags); ++ flags = 0; ++ ++ for (i = 0; i < nr_frags; i++) { ++ struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; ++ int len = skb_frag_size(frag); ++ ++ index = (index + 1) % BGMAC_TX_RING_SLOTS; ++ slot = &ring->slots[index]; ++ slot->dma_addr = skb_frag_dma_map(dma_dev, frag, 0, ++ len, DMA_TO_DEVICE); ++ if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr))) ++ goto err_dma; + +- dma_desc = ring->cpu_base; +- dma_desc += ring->end; +- dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr)); +- dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr)); +- dma_desc->ctl0 = cpu_to_le32(ctl0); +- dma_desc->ctl1 = cpu_to_le32(ctl1); ++ if (i == nr_frags - 1) ++ flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC; ++ ++ bgmac_dma_tx_add_buf(bgmac, ring, index, len, flags); ++ } ++ ++ slot->skb = skb; + + netdev_sent_queue(net_dev, skb->len); + +@@ -170,20 +208,35 @@ static netdev_tx_t bgmac_dma_tx_add(stru + /* Increase ring->end to point empty slot. We tell hardware the first + * slot it should *not* read. + */ +- if (++ring->end >= BGMAC_TX_RING_SLOTS) +- ring->end = 0; ++ ring->end = (index + 1) % BGMAC_TX_RING_SLOTS; + bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, + ring->index_base + + ring->end * sizeof(struct bgmac_dma_desc)); + +- /* Always keep one slot free to allow detecting bugged calls. */ +- if (--free_slots == 1) ++ free_slots -= nr_frags + 1; ++ if (free_slots < 8) + netif_stop_queue(net_dev); + + return NETDEV_TX_OK; + +-err_stop_drop: +- netif_stop_queue(net_dev); ++err_dma: ++ dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb), ++ DMA_TO_DEVICE); ++ ++ while (i > 0) { ++ int index = (ring->end + i) % BGMAC_TX_RING_SLOTS; ++ struct bgmac_slot_info *slot = &ring->slots[index]; ++ u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1); ++ int len = ctl1 & BGMAC_DESC_CTL1_LEN; ++ ++ dma_unmap_page(dma_dev, slot->dma_addr, len, DMA_TO_DEVICE); ++ } ++ ++err_dma_head: ++ bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", ++ ring->mmio_base); ++ ++err_drop: + dev_kfree_skb(skb); + return NETDEV_TX_OK; + } +@@ -205,32 +258,45 @@ static void bgmac_dma_tx_free(struct bgm + + while (ring->start != empty_slot) { + struct bgmac_slot_info *slot = &ring->slots[ring->start]; ++ u32 ctl1 = le32_to_cpu(ring->cpu_base[ring->start].ctl1); ++ int len = ctl1 & BGMAC_DESC_CTL1_LEN; + +- if (slot->skb) { ++ if (!slot->dma_addr) { ++ bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", ++ ring->start, ring->end); ++ goto next; ++ } ++ ++ if (ctl1 & BGMAC_DESC_CTL0_SOF) + /* Unmap no longer used buffer */ +- dma_unmap_single(dma_dev, slot->dma_addr, +- slot->skb->len, DMA_TO_DEVICE); +- slot->dma_addr = 0; ++ dma_unmap_single(dma_dev, slot->dma_addr, len, ++ DMA_TO_DEVICE); ++ else ++ dma_unmap_page(dma_dev, slot->dma_addr, len, ++ DMA_TO_DEVICE); + ++ if (slot->skb) { + bytes_compl += slot->skb->len; + pkts_compl++; + + /* Free memory! :) */ + dev_kfree_skb(slot->skb); + slot->skb = NULL; +- } else { +- bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", +- ring->start, ring->end); + } + ++next: ++ slot->dma_addr = 0; + if (++ring->start >= BGMAC_TX_RING_SLOTS) + ring->start = 0; + freed = true; + } + ++ if (!pkts_compl) ++ return; ++ + netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl); + +- if (freed && netif_queue_stopped(bgmac->net_dev)) ++ if (netif_queue_stopped(bgmac->net_dev)) + netif_wake_queue(bgmac->net_dev); + } + +@@ -439,17 +505,25 @@ static void bgmac_dma_tx_ring_free(struc + struct bgmac_dma_ring *ring) + { + struct device *dma_dev = bgmac->core->dma_dev; ++ struct bgmac_dma_desc *dma_desc = ring->cpu_base; + struct bgmac_slot_info *slot; + int i; + + for (i = 0; i < ring->num_slots; i++) { ++ int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; ++ + slot = &ring->slots[i]; +- if (slot->skb) { +- if (slot->dma_addr) +- dma_unmap_single(dma_dev, slot->dma_addr, +- slot->skb->len, DMA_TO_DEVICE); +- dev_kfree_skb(slot->skb); +- } ++ dev_kfree_skb(slot->skb); ++ ++ if (!slot->dma_addr) ++ continue; ++ ++ if (slot->skb) ++ dma_unmap_single(dma_dev, slot->dma_addr, ++ len, DMA_TO_DEVICE); ++ else ++ dma_unmap_page(dma_dev, slot->dma_addr, ++ len, DMA_TO_DEVICE); + } + } + +@@ -1588,6 +1662,10 @@ static int bgmac_probe(struct bcma_devic + goto err_dma_free; + } + ++ net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; ++ net_dev->hw_features = net_dev->features; ++ net_dev->vlan_features = net_dev->features; ++ + err = register_netdev(bgmac->net_dev); + if (err) { + bgmac_err(bgmac, "Cannot register net device\n"); diff --git a/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch b/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch new file mode 100644 index 000000000..bf4a22dbe --- /dev/null +++ b/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch @@ -0,0 +1,125 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 09:58:56 +0200 +Subject: [PATCH] bgmac: simplify tx ring index handling + +Keep incrementing ring->start and ring->end instead of pointing it to +the actual ring slot entry. This simplifies the calculation of the +number of free slots. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -142,11 +142,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru + { + struct device *dma_dev = bgmac->core->dma_dev; + struct net_device *net_dev = bgmac->net_dev; +- struct bgmac_slot_info *slot = &ring->slots[ring->end]; +- int free_slots; ++ int index = ring->end % BGMAC_TX_RING_SLOTS; ++ struct bgmac_slot_info *slot = &ring->slots[index]; + int nr_frags; + u32 flags; +- int index = ring->end; + int i; + + if (skb->len > BGMAC_DESC_CTL1_LEN) { +@@ -159,12 +158,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru + + nr_frags = skb_shinfo(skb)->nr_frags; + +- if (ring->start <= ring->end) +- free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; +- else +- free_slots = ring->start - ring->end; +- +- if (free_slots <= nr_frags + 1) { ++ /* ring->end - ring->start will return the number of valid slots, ++ * even when ring->end overflows ++ */ ++ if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) { + bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); + netif_stop_queue(net_dev); + return NETDEV_TX_BUSY; +@@ -200,7 +197,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru + } + + slot->skb = skb; +- ++ ring->end += nr_frags + 1; + netdev_sent_queue(net_dev, skb->len); + + wmb(); +@@ -208,13 +205,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru + /* Increase ring->end to point empty slot. We tell hardware the first + * slot it should *not* read. + */ +- ring->end = (index + 1) % BGMAC_TX_RING_SLOTS; + bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, + ring->index_base + +- ring->end * sizeof(struct bgmac_dma_desc)); ++ (ring->end % BGMAC_TX_RING_SLOTS) * ++ sizeof(struct bgmac_dma_desc)); + +- free_slots -= nr_frags + 1; +- if (free_slots < 8) ++ if (ring->end - ring->start >= BGMAC_TX_RING_SLOTS - 8) + netif_stop_queue(net_dev); + + return NETDEV_TX_OK; +@@ -256,17 +252,17 @@ static void bgmac_dma_tx_free(struct bgm + empty_slot &= BGMAC_DMA_TX_STATDPTR; + empty_slot /= sizeof(struct bgmac_dma_desc); + +- while (ring->start != empty_slot) { +- struct bgmac_slot_info *slot = &ring->slots[ring->start]; +- u32 ctl1 = le32_to_cpu(ring->cpu_base[ring->start].ctl1); +- int len = ctl1 & BGMAC_DESC_CTL1_LEN; ++ while (ring->start != ring->end) { ++ int slot_idx = ring->start % BGMAC_TX_RING_SLOTS; ++ struct bgmac_slot_info *slot = &ring->slots[slot_idx]; ++ u32 ctl1; ++ int len; + +- if (!slot->dma_addr) { +- bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", +- ring->start, ring->end); +- goto next; +- } ++ if (slot_idx == empty_slot) ++ break; + ++ ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1); ++ len = ctl1 & BGMAC_DESC_CTL1_LEN; + if (ctl1 & BGMAC_DESC_CTL0_SOF) + /* Unmap no longer used buffer */ + dma_unmap_single(dma_dev, slot->dma_addr, len, +@@ -284,10 +280,8 @@ static void bgmac_dma_tx_free(struct bgm + slot->skb = NULL; + } + +-next: + slot->dma_addr = 0; +- if (++ring->start >= BGMAC_TX_RING_SLOTS) +- ring->start = 0; ++ ring->start++; + freed = true; + } + +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -414,10 +414,10 @@ enum bgmac_dma_ring_type { + * empty. + */ + struct bgmac_dma_ring { +- u16 num_slots; +- u16 start; +- u16 end; ++ u32 start; ++ u32 end; + ++ u16 num_slots; + u16 mmio_base; + struct bgmac_dma_desc *cpu_base; + dma_addr_t dma_base; diff --git a/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch b/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch new file mode 100644 index 000000000..4e5e2e720 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch @@ -0,0 +1,87 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 10:08:04 +0200 +Subject: [PATCH] bgmac: leave interrupts disabled as long as there is work + to do + +Always poll rx and tx during NAPI poll instead of relying on the status +of the first interrupt. This prevents bgmac_poll from leaving unfinished +work around until the next IRQ. +In my tests this makes bridging/routing throughput under heavy load more +stable and ensures that no new IRQs arrive as long as bgmac_poll uses up +the entire budget. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1109,8 +1109,6 @@ static void bgmac_chip_reset(struct bgma + bgmac_phy_init(bgmac); + + netdev_reset_queue(bgmac->net_dev); +- +- bgmac->int_status = 0; + } + + static void bgmac_chip_intrs_on(struct bgmac *bgmac) +@@ -1225,14 +1223,13 @@ static irqreturn_t bgmac_interrupt(int i + if (!int_status) + return IRQ_NONE; + +- /* Ack */ +- bgmac_write(bgmac, BGMAC_INT_STATUS, int_status); ++ int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX); ++ if (int_status) ++ bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status); + + /* Disable new interrupts until handling existing ones */ + bgmac_chip_intrs_off(bgmac); + +- bgmac->int_status = int_status; +- + napi_schedule(&bgmac->napi); + + return IRQ_HANDLED; +@@ -1241,25 +1238,17 @@ static irqreturn_t bgmac_interrupt(int i + static int bgmac_poll(struct napi_struct *napi, int weight) + { + struct bgmac *bgmac = container_of(napi, struct bgmac, napi); +- struct bgmac_dma_ring *ring; + int handled = 0; + +- if (bgmac->int_status & BGMAC_IS_TX0) { +- ring = &bgmac->tx_ring[0]; +- bgmac_dma_tx_free(bgmac, ring); +- bgmac->int_status &= ~BGMAC_IS_TX0; +- } ++ /* Ack */ ++ bgmac_write(bgmac, BGMAC_INT_STATUS, ~0); + +- if (bgmac->int_status & BGMAC_IS_RX) { +- ring = &bgmac->rx_ring[0]; +- handled += bgmac_dma_rx_read(bgmac, ring, weight); +- bgmac->int_status &= ~BGMAC_IS_RX; +- } ++ bgmac_dma_tx_free(bgmac, &bgmac->tx_ring[0]); ++ handled += bgmac_dma_rx_read(bgmac, &bgmac->rx_ring[0], weight); + +- if (bgmac->int_status) { +- bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", bgmac->int_status); +- bgmac->int_status = 0; +- } ++ /* Poll again if more events arrived in the meantime */ ++ if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX)) ++ return handled; + + if (handled < weight) { + napi_complete(napi); +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -452,7 +452,6 @@ struct bgmac { + + /* Int */ + u32 int_mask; +- u32 int_status; + + /* Current MAC state */ + int mac_speed; diff --git a/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch b/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch new file mode 100644 index 000000000..1b0742cd3 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch @@ -0,0 +1,66 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 10:13:28 +0200 +Subject: [PATCH] bgmac: set received skb headroom to NET_SKB_PAD + +A packet buffer offset of 30 bytes is inefficient, because the first 2 +bytes end up in a different cacheline. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -346,13 +346,13 @@ static int bgmac_dma_rx_skb_for_slot(str + return -ENOMEM; + + /* Poison - if everything goes fine, hardware will overwrite it */ +- rx = buf; ++ rx = buf + BGMAC_RX_BUF_OFFSET; + rx->len = cpu_to_le16(0xdead); + rx->flags = cpu_to_le16(0xbeef); + + /* Map skb for the DMA */ +- dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, +- DMA_FROM_DEVICE); ++ dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET, ++ BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); + if (dma_mapping_error(dma_dev, dma_addr)) { + bgmac_err(bgmac, "DMA mapping error\n"); + put_page(virt_to_head_page(buf)); +@@ -403,7 +403,7 @@ static int bgmac_dma_rx_read(struct bgma + while (ring->start != ring->end) { + struct device *dma_dev = bgmac->core->dma_dev; + struct bgmac_slot_info *slot = &ring->slots[ring->start]; +- struct bgmac_rx_header *rx = slot->buf; ++ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; + struct sk_buff *skb; + void *buf = slot->buf; + u16 len, flags; +@@ -454,8 +454,10 @@ static int bgmac_dma_rx_read(struct bgma + BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); + + skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); +- skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); +- skb_pull(skb, BGMAC_RX_FRAME_OFFSET); ++ skb_put(skb, BGMAC_RX_FRAME_OFFSET + ++ BGMAC_RX_BUF_OFFSET + len); ++ skb_pull(skb, BGMAC_RX_FRAME_OFFSET + ++ BGMAC_RX_BUF_OFFSET); + + skb_checksum_none_assert(skb); + skb->protocol = eth_type_trans(skb, bgmac->net_dev); +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -360,9 +360,11 @@ + + #define BGMAC_RX_HEADER_LEN 28 /* Last 24 bytes are unused. Well... */ + #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ ++#define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ ++ BGMAC_RX_FRAME_OFFSET) + #define BGMAC_RX_MAX_FRAME_SIZE 1536 /* Copied from b44/tg3 */ + #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) +-#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE) + \ ++#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) + + #define BGMAC_BFL_ENETROBO 0x0010 /* has ephy roboswitch spi */ diff --git a/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch b/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch new file mode 100644 index 000000000..2be65b454 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch @@ -0,0 +1,130 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 22:23:07 +0200 +Subject: [PATCH] bgmac: simplify/optimize rx DMA error handling + +Allocate a new buffer before processing the completed one. If allocation +fails, reuse the old buffer. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -386,6 +386,19 @@ static void bgmac_dma_rx_setup_desc(stru + dma_desc->ctl1 = cpu_to_le32(ctl1); + } + ++static void bgmac_dma_rx_poison_buf(struct device *dma_dev, ++ struct bgmac_slot_info *slot) ++{ ++ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; ++ ++ dma_sync_single_for_cpu(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); ++ rx->len = cpu_to_le16(0xdead); ++ rx->flags = cpu_to_le16(0xbeef); ++ dma_sync_single_for_device(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); ++} ++ + static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, + int weight) + { +@@ -406,53 +419,35 @@ static int bgmac_dma_rx_read(struct bgma + struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; + struct sk_buff *skb; + void *buf = slot->buf; ++ dma_addr_t dma_addr = slot->dma_addr; + u16 len, flags; + +- /* Unmap buffer to make it accessible to the CPU */ +- dma_sync_single_for_cpu(dma_dev, slot->dma_addr, +- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); +- +- /* Get info from the header */ +- len = le16_to_cpu(rx->len); +- flags = le16_to_cpu(rx->flags); +- + do { +- dma_addr_t old_dma_addr = slot->dma_addr; +- int err; ++ /* Prepare new skb as replacement */ ++ if (bgmac_dma_rx_skb_for_slot(bgmac, slot)) { ++ bgmac_dma_rx_poison_buf(dma_dev, slot); ++ break; ++ } ++ ++ /* Unmap buffer to make it accessible to the CPU */ ++ dma_unmap_single(dma_dev, dma_addr, ++ BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); ++ ++ /* Get info from the header */ ++ len = le16_to_cpu(rx->len); ++ flags = le16_to_cpu(rx->flags); + + /* Check for poison and drop or pass the packet */ + if (len == 0xdead && flags == 0xbeef) { + bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", + ring->start); +- dma_sync_single_for_device(dma_dev, +- slot->dma_addr, +- BGMAC_RX_BUF_SIZE, +- DMA_FROM_DEVICE); ++ put_page(virt_to_head_page(buf)); + break; + } + + /* Omit CRC. */ + len -= ETH_FCS_LEN; + +- /* Prepare new skb as replacement */ +- err = bgmac_dma_rx_skb_for_slot(bgmac, slot); +- if (err) { +- /* Poison the old skb */ +- rx->len = cpu_to_le16(0xdead); +- rx->flags = cpu_to_le16(0xbeef); +- +- dma_sync_single_for_device(dma_dev, +- slot->dma_addr, +- BGMAC_RX_BUF_SIZE, +- DMA_FROM_DEVICE); +- break; +- } +- bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); +- +- /* Unmap old skb, we'll pass it to the netfif */ +- dma_unmap_single(dma_dev, old_dma_addr, +- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); +- + skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); + skb_put(skb, BGMAC_RX_FRAME_OFFSET + + BGMAC_RX_BUF_OFFSET + len); +@@ -465,6 +460,8 @@ static int bgmac_dma_rx_read(struct bgma + handled++; + } while (0); + ++ bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); ++ + if (++ring->start >= BGMAC_RX_RING_SLOTS) + ring->start = 0; + +@@ -532,14 +529,14 @@ static void bgmac_dma_rx_ring_free(struc + + for (i = 0; i < ring->num_slots; i++) { + slot = &ring->slots[i]; +- if (!slot->buf) ++ if (!slot->dma_addr) + continue; + +- if (slot->dma_addr) +- dma_unmap_single(dma_dev, slot->dma_addr, +- BGMAC_RX_BUF_SIZE, +- DMA_FROM_DEVICE); ++ dma_unmap_single(dma_dev, slot->dma_addr, ++ BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); + put_page(virt_to_head_page(slot->buf)); ++ slot->dma_addr = 0; + } + } + diff --git a/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch b/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch new file mode 100644 index 000000000..6bb474768 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch @@ -0,0 +1,27 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 22:28:20 +0200 +Subject: [PATCH] bgmac: add check for oversized packets + +In very rare cases, the MAC can catch an internal buffer that is bigger +than it's supposed to be. Instead of crashing the kernel, simply pass +the buffer back to the hardware + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -445,6 +445,13 @@ static int bgmac_dma_rx_read(struct bgma + break; + } + ++ if (len > BGMAC_RX_ALLOC_SIZE) { ++ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", ++ ring->start); ++ put_page(virt_to_head_page(buf)); ++ break; ++ } ++ + /* Omit CRC. */ + len -= ETH_FCS_LEN; + diff --git a/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch b/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch new file mode 100644 index 000000000..1fc4ed03f --- /dev/null +++ b/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch @@ -0,0 +1,23 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 22:36:16 +0200 +Subject: [PATCH] bgmac: increase rx ring size from 511 to 512 + +Limiting it to 511 looks like a failed attempt at leaving one descriptor +empty to allow the hardware to stop processing a buffer that has not +been prepared yet. However, this doesn't work because this affects the +total ring size as well + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -356,7 +356,7 @@ + #define BGMAC_MAX_RX_RINGS 1 + + #define BGMAC_TX_RING_SLOTS 128 +-#define BGMAC_RX_RING_SLOTS 512 - 1 /* Why -1? Well, Broadcom does that... */ ++#define BGMAC_RX_RING_SLOTS 512 + + #define BGMAC_RX_HEADER_LEN 28 /* Last 24 bytes are unused. Well... */ + #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ diff --git a/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch b/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch new file mode 100644 index 000000000..a49bd5f5e --- /dev/null +++ b/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch @@ -0,0 +1,184 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 23:19:32 +0200 +Subject: [PATCH] bgmac: simplify dma init/cleanup + +Instead of allocating buffers at device init time and initializing +descriptors at device open, do both at the same time (during open). +Free all buffers when closing the device. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -562,18 +562,26 @@ static void bgmac_dma_ring_desc_free(str + ring->dma_base); + } + +-static void bgmac_dma_free(struct bgmac *bgmac) ++static void bgmac_dma_cleanup(struct bgmac *bgmac) + { + int i; + +- for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { ++ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) + bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]); +- bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); +- } +- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { ++ ++ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) + bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]); ++} ++ ++static void bgmac_dma_free(struct bgmac *bgmac) ++{ ++ int i; ++ ++ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) ++ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); ++ ++ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) + bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); +- } + } + + static int bgmac_dma_alloc(struct bgmac *bgmac) +@@ -621,8 +629,6 @@ static int bgmac_dma_alloc(struct bgmac + } + + for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { +- int j; +- + ring = &bgmac->rx_ring[i]; + ring->num_slots = BGMAC_RX_RING_SLOTS; + ring->mmio_base = ring_base[i]; +@@ -645,15 +651,6 @@ static int bgmac_dma_alloc(struct bgmac + ring->index_base = lower_32_bits(ring->dma_base); + else + ring->index_base = 0; +- +- /* Alloc RX slots */ +- for (j = 0; j < ring->num_slots; j++) { +- err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); +- if (err) { +- bgmac_err(bgmac, "Can't allocate skb for slot in RX ring\n"); +- goto err_dma_free; +- } +- } + } + + return 0; +@@ -663,10 +660,10 @@ err_dma_free: + return -ENOMEM; + } + +-static void bgmac_dma_init(struct bgmac *bgmac) ++static int bgmac_dma_init(struct bgmac *bgmac) + { + struct bgmac_dma_ring *ring; +- int i; ++ int i, err; + + for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { + ring = &bgmac->tx_ring[i]; +@@ -698,8 +695,13 @@ static void bgmac_dma_init(struct bgmac + if (ring->unaligned) + bgmac_dma_rx_enable(bgmac, ring); + +- for (j = 0; j < ring->num_slots; j++) ++ for (j = 0; j < ring->num_slots; j++) { ++ err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); ++ if (err) ++ goto error; ++ + bgmac_dma_rx_setup_desc(bgmac, ring, j); ++ } + + bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, + ring->index_base + +@@ -708,6 +710,12 @@ static void bgmac_dma_init(struct bgmac + ring->start = 0; + ring->end = 0; + } ++ ++ return 0; ++ ++error: ++ bgmac_dma_cleanup(bgmac); ++ return err; + } + + /************************************************** +@@ -1183,11 +1191,8 @@ static void bgmac_enable(struct bgmac *b + } + + /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */ +-static void bgmac_chip_init(struct bgmac *bgmac, bool full_init) ++static void bgmac_chip_init(struct bgmac *bgmac) + { +- struct bgmac_dma_ring *ring; +- int i; +- + /* 1 interrupt per received frame */ + bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT); + +@@ -1205,16 +1210,7 @@ static void bgmac_chip_init(struct bgmac + + bgmac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + ETHER_MAX_LEN); + +- if (full_init) { +- bgmac_dma_init(bgmac); +- if (1) /* FIXME: is there any case we don't want IRQs? */ +- bgmac_chip_intrs_on(bgmac); +- } else { +- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { +- ring = &bgmac->rx_ring[i]; +- bgmac_dma_rx_enable(bgmac, ring); +- } +- } ++ bgmac_chip_intrs_on(bgmac); + + bgmac_enable(bgmac); + } +@@ -1274,23 +1270,27 @@ static int bgmac_open(struct net_device + int err = 0; + + bgmac_chip_reset(bgmac); ++ ++ err = bgmac_dma_init(bgmac); ++ if (err) ++ return err; ++ + /* Specs say about reclaiming rings here, but we do that in DMA init */ +- bgmac_chip_init(bgmac, true); ++ bgmac_chip_init(bgmac); + + err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED, + KBUILD_MODNAME, net_dev); + if (err < 0) { + bgmac_err(bgmac, "IRQ request error: %d!\n", err); +- goto err_out; ++ bgmac_dma_cleanup(bgmac); ++ return err; + } + napi_enable(&bgmac->napi); + + phy_start(bgmac->phy_dev); + + netif_carrier_on(net_dev); +- +-err_out: +- return err; ++ return 0; + } + + static int bgmac_stop(struct net_device *net_dev) +@@ -1306,6 +1306,7 @@ static int bgmac_stop(struct net_device + free_irq(bgmac->core->irq, net_dev); + + bgmac_chip_reset(bgmac); ++ bgmac_dma_cleanup(bgmac); + + return 0; + } diff --git a/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch b/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch new file mode 100644 index 000000000..e7a7987f4 --- /dev/null +++ b/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch @@ -0,0 +1,88 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 11:59:47 +0200 +Subject: [PATCH] bgmac: fix DMA rx corruption + +The driver needs to inform the hardware about the first invalid (not yet +filled) rx slot, by writing its DMA descriptor pointer offset to the +BGMAC_DMA_RX_INDEX register. + +This register was set to a value exceeding the rx ring size, effectively +allowing the hardware constant access to the full ring, regardless of +which slots are initialized. + +To fix this issue, always mark the last filled rx slot as invalid. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -366,6 +366,16 @@ static int bgmac_dma_rx_skb_for_slot(str + return 0; + } + ++static void bgmac_dma_rx_update_index(struct bgmac *bgmac, ++ struct bgmac_dma_ring *ring) ++{ ++ wmb(); ++ ++ bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, ++ ring->index_base + ++ ring->end * sizeof(struct bgmac_dma_desc)); ++} ++ + static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac, + struct bgmac_dma_ring *ring, int desc_idx) + { +@@ -384,6 +394,8 @@ static void bgmac_dma_rx_setup_desc(stru + dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr)); + dma_desc->ctl0 = cpu_to_le32(ctl0); + dma_desc->ctl1 = cpu_to_le32(ctl1); ++ ++ ring->end = desc_idx; + } + + static void bgmac_dma_rx_poison_buf(struct device *dma_dev, +@@ -411,9 +423,7 @@ static int bgmac_dma_rx_read(struct bgma + end_slot &= BGMAC_DMA_RX_STATDPTR; + end_slot /= sizeof(struct bgmac_dma_desc); + +- ring->end = end_slot; +- +- while (ring->start != ring->end) { ++ while (ring->start != end_slot) { + struct device *dma_dev = bgmac->core->dma_dev; + struct bgmac_slot_info *slot = &ring->slots[ring->start]; + struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; +@@ -476,6 +486,8 @@ static int bgmac_dma_rx_read(struct bgma + break; + } + ++ bgmac_dma_rx_update_index(bgmac, ring); ++ + return handled; + } + +@@ -695,6 +707,8 @@ static int bgmac_dma_init(struct bgmac * + if (ring->unaligned) + bgmac_dma_rx_enable(bgmac, ring); + ++ ring->start = 0; ++ ring->end = 0; + for (j = 0; j < ring->num_slots; j++) { + err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); + if (err) +@@ -703,12 +717,7 @@ static int bgmac_dma_init(struct bgmac * + bgmac_dma_rx_setup_desc(bgmac, ring, j); + } + +- bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, +- ring->index_base + +- ring->num_slots * sizeof(struct bgmac_dma_desc)); +- +- ring->start = 0; +- ring->end = 0; ++ bgmac_dma_rx_update_index(bgmac, ring); + } + + return 0; diff --git a/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch b/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch new file mode 100644 index 000000000..4dbb6f48d --- /dev/null +++ b/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch @@ -0,0 +1,132 @@ +From: Felix Fietkau +Date: Sun, 12 Apr 2015 23:28:38 +0200 +Subject: [PATCH] bgmac: drop ring->num_slots + +The ring size is always known at compile time, so make the code a bit +more efficient + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -123,7 +123,7 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac + struct bgmac_dma_desc *dma_desc; + u32 ctl1; + +- if (i == ring->num_slots - 1) ++ if (i == BGMAC_TX_RING_SLOTS - 1) + ctl0 |= BGMAC_DESC_CTL0_EOT; + + ctl1 = len & BGMAC_DESC_CTL1_LEN; +@@ -382,7 +382,7 @@ static void bgmac_dma_rx_setup_desc(stru + struct bgmac_dma_desc *dma_desc = ring->cpu_base + desc_idx; + u32 ctl0 = 0, ctl1 = 0; + +- if (desc_idx == ring->num_slots - 1) ++ if (desc_idx == BGMAC_RX_RING_SLOTS - 1) + ctl0 |= BGMAC_DESC_CTL0_EOT; + ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN; + /* Is there any BGMAC device that requires extension? */ +@@ -521,7 +521,7 @@ static void bgmac_dma_tx_ring_free(struc + struct bgmac_slot_info *slot; + int i; + +- for (i = 0; i < ring->num_slots; i++) { ++ for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) { + int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; + + slot = &ring->slots[i]; +@@ -546,7 +546,7 @@ static void bgmac_dma_rx_ring_free(struc + struct bgmac_slot_info *slot; + int i; + +- for (i = 0; i < ring->num_slots; i++) { ++ for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) { + slot = &ring->slots[i]; + if (!slot->dma_addr) + continue; +@@ -560,7 +560,8 @@ static void bgmac_dma_rx_ring_free(struc + } + + static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, +- struct bgmac_dma_ring *ring) ++ struct bgmac_dma_ring *ring, ++ int num_slots) + { + struct device *dma_dev = bgmac->core->dma_dev; + int size; +@@ -569,7 +570,7 @@ static void bgmac_dma_ring_desc_free(str + return; + + /* Free ring of descriptors */ +- size = ring->num_slots * sizeof(struct bgmac_dma_desc); ++ size = num_slots * sizeof(struct bgmac_dma_desc); + dma_free_coherent(dma_dev, size, ring->cpu_base, + ring->dma_base); + } +@@ -590,10 +591,12 @@ static void bgmac_dma_free(struct bgmac + int i; + + for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) +- bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); ++ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i], ++ BGMAC_TX_RING_SLOTS); + + for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) +- bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); ++ bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i], ++ BGMAC_RX_RING_SLOTS); + } + + static int bgmac_dma_alloc(struct bgmac *bgmac) +@@ -616,11 +619,10 @@ static int bgmac_dma_alloc(struct bgmac + + for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { + ring = &bgmac->tx_ring[i]; +- ring->num_slots = BGMAC_TX_RING_SLOTS; + ring->mmio_base = ring_base[i]; + + /* Alloc ring of descriptors */ +- size = ring->num_slots * sizeof(struct bgmac_dma_desc); ++ size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc); + ring->cpu_base = dma_zalloc_coherent(dma_dev, size, + &ring->dma_base, + GFP_KERNEL); +@@ -642,11 +644,10 @@ static int bgmac_dma_alloc(struct bgmac + + for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { + ring = &bgmac->rx_ring[i]; +- ring->num_slots = BGMAC_RX_RING_SLOTS; + ring->mmio_base = ring_base[i]; + + /* Alloc ring of descriptors */ +- size = ring->num_slots * sizeof(struct bgmac_dma_desc); ++ size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc); + ring->cpu_base = dma_zalloc_coherent(dma_dev, size, + &ring->dma_base, + GFP_KERNEL); +@@ -709,7 +710,7 @@ static int bgmac_dma_init(struct bgmac * + + ring->start = 0; + ring->end = 0; +- for (j = 0; j < ring->num_slots; j++) { ++ for (j = 0; j < BGMAC_RX_RING_SLOTS; j++) { + err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); + if (err) + goto error; +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -419,11 +419,10 @@ struct bgmac_dma_ring { + u32 start; + u32 end; + +- u16 num_slots; +- u16 mmio_base; + struct bgmac_dma_desc *cpu_base; + dma_addr_t dma_base; + u32 index_base; /* Used for unaligned rings only, otherwise 0 */ ++ u16 mmio_base; + bool unaligned; + + struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS]; diff --git a/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch b/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch new file mode 100644 index 000000000..a4c7876d7 --- /dev/null +++ b/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch @@ -0,0 +1,31 @@ +From b4dfd8e92956b396d3438212bc9a0be6267b8b34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 12 Apr 2016 13:30:45 +0200 +Subject: [PATCH] bgmac: reset & enable Ethernet core before using it +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes Ethernet on D-Link DIR-885L with BCM47094 SoC. Felix reported +similar fix was needed for his BCM4709 device (Buffalo WXR-1900DHP?). +I tested this for regressions on BCM4706, BCM4708A0 and BCM47081A0. + +Cc: Felix Fietkau +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1569,6 +1569,11 @@ static int bgmac_probe(struct bcma_devic + */ + bcma_core_enable(core, 0); + ++ /* This (reset &) enable is not preset in specs or reference driver but ++ * Broadcom does it in arch PCI code when enabling fake PCI device. ++ */ ++ bcma_core_enable(core, 0); ++ + /* Allocation and references */ + net_dev = alloc_etherdev(sizeof(*bgmac)); + if (!net_dev) diff --git a/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch new file mode 100644 index 000000000..f8d0a5876 --- /dev/null +++ b/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch @@ -0,0 +1,34 @@ +From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Tue, 12 Apr 2016 18:27:29 +0200 +Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly +fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means +only some devices as most of BCM4708A0KF-s got core rev 4). +This was tested for regressions on BCM47094 which doesn't seem to care +which bit gets used. + +Signed-off-by: Felix Fietkau +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -198,9 +198,9 @@ + #define BGMAC_CMDCFG_TAI 0x00000200 + #define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */ + #define BGMAC_CMDCFG_HD_SHIFT 10 +-#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for other revs */ +-#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, only for core rev 4 */ +-#define BGMAC_CMDCFG_SR(rev) ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) ++#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for core rev 0-3 */ ++#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, for core rev >= 4 */ ++#define BGMAC_CMDCFG_SR(rev) ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) + #define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */ + #define BGMAC_CMDCFG_AE 0x00400000 + #define BGMAC_CMDCFG_CFE 0x00800000 diff --git a/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch b/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch new file mode 100644 index 000000000..5d99367ad --- /dev/null +++ b/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch @@ -0,0 +1,46 @@ +From: Alexander Duyck +Date: Tue, 2 Dec 2014 10:58:21 -0800 +Subject: [PATCH] fib_trie: Fix /proc/net/fib_trie when + CONFIG_IP_MULTIPLE_TABLES is not defined + +In recent testing I had disabled CONFIG_IP_MULTIPLE_TABLES and as a result +when I ran "cat /proc/net/fib_trie" the main trie was displayed multiple +times. I found that the problem line of code was in the function +fib_trie_seq_next. Specifically the line below caused the indexes to go in +the opposite direction of our traversal: + + h = tb->tb_id & (FIB_TABLE_HASHSZ - 1); + +This issue was that the RT tables are defined such that RT_TABLE_LOCAL is ID +255, while it is located at TABLE_LOCAL_INDEX of 0, and RT_TABLE_MAIN is 254 +with a TABLE_MAIN_INDEX of 1. This means that the above line will return 1 +for the local table and 0 for main. The result is that fib_trie_seq_next +will return NULL at the end of the local table, fib_trie_seq_start will +return the start of the main table, and then fib_trie_seq_next will loop on +main forever as h will always return 0. + +The fix for this is to reverse the ordering of the two tables. It has the +advantage of making it so that the tables now print in the same order +regardless of if multiple tables are enabled or not. In order to make the +definition consistent with the multiple tables case I simply masked the to +RT_TABLE_XXX values by (FIB_TABLE_HASHSZ - 1). This way the two table +layouts should always stay consistent. + +Fixes: 93456b6 ("[IPV4]: Unify access to the routing tables") +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/include/net/ip_fib.h ++++ b/include/net/ip_fib.h +@@ -201,8 +201,8 @@ void fib_free_table(struct fib_table *tb + + #ifndef CONFIG_IP_MULTIPLE_TABLES + +-#define TABLE_LOCAL_INDEX 0 +-#define TABLE_MAIN_INDEX 1 ++#define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1)) ++#define TABLE_MAIN_INDEX (RT_TABLE_MAIN & (FIB_TABLE_HASHSZ - 1)) + + static inline struct fib_table *fib_get_table(struct net *net, u32 id) + { diff --git a/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch b/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch new file mode 100644 index 000000000..4e09f8a18 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch @@ -0,0 +1,72 @@ +From: Alexander Duyck +Date: Wed, 10 Dec 2014 21:49:22 -0800 +Subject: [PATCH] fib_trie: Fix trie balancing issue if new node pushes down + existing node + +This patch addresses an issue with the level compression of the fib_trie. +Specifically in the case of adding a new leaf that triggers a new node to +be added that takes the place of the old node. The result is a trie where +the 1 child tnode is on one side and one leaf is on the other which gives +you a very deep trie. Below is the script I used to generate a trie on +dummy0 with a 10.X.X.X family of addresses. + + ip link add type dummy + ipval=184549374 + bit=2 + for i in `seq 1 23` + do + ifconfig dummy0:$bit $ipval/8 + ipval=`expr $ipval - $bit` + bit=`expr $bit \* 2` + done + cat /proc/net/fib_triestat + +Running the script before the patch: + + Local: + Aver depth: 10.82 + Max depth: 23 + Leaves: 29 + Prefixes: 30 + Internal nodes: 27 + 1: 26 2: 1 + Pointers: 56 + Null ptrs: 1 + Total size: 5 kB + +After applying the patch and repeating: + + Local: + Aver depth: 4.72 + Max depth: 9 + Leaves: 29 + Prefixes: 30 + Internal nodes: 12 + 1: 3 2: 2 3: 7 + Pointers: 70 + Null ptrs: 30 + Total size: 4 kB + +What this fix does is start the rebalance at the newly created tnode +instead of at the parent tnode. This way if there is a gap between the +parent and the new node it doesn't prevent the new tnode from being +coalesced with any pre-existing nodes that may have been pushed into one +of the new nodes child branches. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -1143,8 +1143,9 @@ static struct list_head *fib_insert_node + put_child(tp, cindex, (struct rt_trie_node *)tn); + } else { + rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); +- tp = tn; + } ++ ++ tp = tn; + } + + if (tp && tp->pos + tp->bits > 32) diff --git a/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch b/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch new file mode 100644 index 000000000..2e6deb5bb --- /dev/null +++ b/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch @@ -0,0 +1,200 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:55:29 -0800 +Subject: [PATCH] fib_trie: Update usage stats to be percpu instead of + global variables + +The trie usage stats were currently being shared by all threads that were +calling fib_table_lookup. As a result when multiple threads were +performing lookups simultaneously the trie would begin to cache bounce +between those threads. + +In order to prevent this I have updated the usage stats to use a set of +percpu variables. By doing this we should be able to avoid the cache +bouncing and still make use of these stats. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_frontend.c ++++ b/net/ipv4/fib_frontend.c +@@ -67,7 +67,7 @@ static int __net_init fib4_rules_init(st + return 0; + + fail: +- kfree(local_table); ++ fib_free_table(local_table); + return -ENOMEM; + } + #else +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -153,7 +153,7 @@ struct trie_stat { + struct trie { + struct rt_trie_node __rcu *trie; + #ifdef CONFIG_IP_FIB_TRIE_STATS +- struct trie_use_stats stats; ++ struct trie_use_stats __percpu *stats; + #endif + }; + +@@ -631,7 +631,7 @@ static struct rt_trie_node *resize(struc + if (IS_ERR(tn)) { + tn = old_tn; + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.resize_node_skipped++; ++ this_cpu_inc(t->stats->resize_node_skipped); + #endif + break; + } +@@ -658,7 +658,7 @@ static struct rt_trie_node *resize(struc + if (IS_ERR(tn)) { + tn = old_tn; + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.resize_node_skipped++; ++ this_cpu_inc(t->stats->resize_node_skipped); + #endif + break; + } +@@ -1357,7 +1357,7 @@ static int check_leaf(struct fib_table * + err = fib_props[fa->fa_type].error; + if (err) { + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.semantic_match_passed++; ++ this_cpu_inc(t->stats->semantic_match_passed); + #endif + return err; + } +@@ -1372,7 +1372,7 @@ static int check_leaf(struct fib_table * + continue; + + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.semantic_match_passed++; ++ this_cpu_inc(t->stats->semantic_match_passed); + #endif + res->prefixlen = li->plen; + res->nh_sel = nhsel; +@@ -1388,7 +1388,7 @@ static int check_leaf(struct fib_table * + } + + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.semantic_match_miss++; ++ this_cpu_inc(t->stats->semantic_match_miss); + #endif + } + +@@ -1399,6 +1399,9 @@ int fib_table_lookup(struct fib_table *t + struct fib_result *res, int fib_flags) + { + struct trie *t = (struct trie *) tb->tb_data; ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ struct trie_use_stats __percpu *stats = t->stats; ++#endif + int ret; + struct rt_trie_node *n; + struct tnode *pn; +@@ -1417,7 +1420,7 @@ int fib_table_lookup(struct fib_table *t + goto failed; + + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.gets++; ++ this_cpu_inc(stats->gets); + #endif + + /* Just a leaf? */ +@@ -1441,7 +1444,7 @@ int fib_table_lookup(struct fib_table *t + + if (n == NULL) { + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.null_node_hit++; ++ this_cpu_inc(stats->null_node_hit); + #endif + goto backtrace; + } +@@ -1576,7 +1579,7 @@ backtrace: + chopped_off = 0; + + #ifdef CONFIG_IP_FIB_TRIE_STATS +- t->stats.backtrack++; ++ this_cpu_inc(stats->backtrack); + #endif + goto backtrace; + } +@@ -1830,6 +1833,11 @@ int fib_table_flush(struct fib_table *tb + + void fib_free_table(struct fib_table *tb) + { ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ struct trie *t = (struct trie *)tb->tb_data; ++ ++ free_percpu(t->stats); ++#endif /* CONFIG_IP_FIB_TRIE_STATS */ + kfree(tb); + } + +@@ -1973,7 +1981,14 @@ struct fib_table *fib_trie_table(u32 id) + tb->tb_num_default = 0; + + t = (struct trie *) tb->tb_data; +- memset(t, 0, sizeof(*t)); ++ RCU_INIT_POINTER(t->trie, NULL); ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ t->stats = alloc_percpu(struct trie_use_stats); ++ if (!t->stats) { ++ kfree(tb); ++ tb = NULL; ++ } ++#endif + + return tb; + } +@@ -2139,18 +2154,31 @@ static void trie_show_stats(struct seq_f + + #ifdef CONFIG_IP_FIB_TRIE_STATS + static void trie_show_usage(struct seq_file *seq, +- const struct trie_use_stats *stats) ++ const struct trie_use_stats __percpu *stats) + { ++ struct trie_use_stats s = { 0 }; ++ int cpu; ++ ++ /* loop through all of the CPUs and gather up the stats */ ++ for_each_possible_cpu(cpu) { ++ const struct trie_use_stats *pcpu = per_cpu_ptr(stats, cpu); ++ ++ s.gets += pcpu->gets; ++ s.backtrack += pcpu->backtrack; ++ s.semantic_match_passed += pcpu->semantic_match_passed; ++ s.semantic_match_miss += pcpu->semantic_match_miss; ++ s.null_node_hit += pcpu->null_node_hit; ++ s.resize_node_skipped += pcpu->resize_node_skipped; ++ } ++ + seq_printf(seq, "\nCounters:\n---------\n"); +- seq_printf(seq, "gets = %u\n", stats->gets); +- seq_printf(seq, "backtracks = %u\n", stats->backtrack); ++ seq_printf(seq, "gets = %u\n", s.gets); ++ seq_printf(seq, "backtracks = %u\n", s.backtrack); + seq_printf(seq, "semantic match passed = %u\n", +- stats->semantic_match_passed); +- seq_printf(seq, "semantic match miss = %u\n", +- stats->semantic_match_miss); +- seq_printf(seq, "null node hit= %u\n", stats->null_node_hit); +- seq_printf(seq, "skipped node resize = %u\n\n", +- stats->resize_node_skipped); ++ s.semantic_match_passed); ++ seq_printf(seq, "semantic match miss = %u\n", s.semantic_match_miss); ++ seq_printf(seq, "null node hit= %u\n", s.null_node_hit); ++ seq_printf(seq, "skipped node resize = %u\n\n", s.resize_node_skipped); + } + #endif /* CONFIG_IP_FIB_TRIE_STATS */ + +@@ -2191,7 +2219,7 @@ static int fib_triestat_seq_show(struct + trie_collect_stats(t, &stat); + trie_show_stats(seq, &stat); + #ifdef CONFIG_IP_FIB_TRIE_STATS +- trie_show_usage(seq, &t->stats); ++ trie_show_usage(seq, t->stats); + #endif + } + } diff --git a/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch b/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch new file mode 100644 index 000000000..4c727cdfc --- /dev/null +++ b/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch @@ -0,0 +1,421 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:55:35 -0800 +Subject: [PATCH] fib_trie: Make leaf and tnode more uniform + +This change makes some fundamental changes to the way leaves and tnodes are +constructed. The big differences are: +1. Leaves now populate pos and bits indicating their full key size. +2. Trie nodes now mask out their lower bits to be consistent with the leaf +3. Both structures have been reordered so that rt_trie_node now consisists + of a much larger region including the pos, bits, and rcu portions of + the tnode structure. + +On 32b systems this will result in the leaf being 4B larger as the pos and +bits values were added to a hole created by the key as it was only 4B in +length. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -87,24 +87,38 @@ + + typedef unsigned int t_key; + +-#define T_TNODE 0 +-#define T_LEAF 1 +-#define NODE_TYPE_MASK 0x1UL +-#define NODE_TYPE(node) ((node)->parent & NODE_TYPE_MASK) ++#define IS_TNODE(n) ((n)->bits) ++#define IS_LEAF(n) (!(n)->bits) + +-#define IS_TNODE(n) (!(n->parent & T_LEAF)) +-#define IS_LEAF(n) (n->parent & T_LEAF) ++struct tnode { ++ t_key key; ++ unsigned char bits; /* 2log(KEYLENGTH) bits needed */ ++ unsigned char pos; /* 2log(KEYLENGTH) bits needed */ ++ struct tnode __rcu *parent; ++ union { ++ struct rcu_head rcu; ++ struct tnode *tnode_free; ++ }; ++ unsigned int full_children; /* KEYLENGTH bits needed */ ++ unsigned int empty_children; /* KEYLENGTH bits needed */ ++ struct rt_trie_node __rcu *child[0]; ++}; + + struct rt_trie_node { +- unsigned long parent; + t_key key; ++ unsigned char bits; ++ unsigned char pos; ++ struct tnode __rcu *parent; ++ struct rcu_head rcu; + }; + + struct leaf { +- unsigned long parent; + t_key key; +- struct hlist_head list; ++ unsigned char bits; ++ unsigned char pos; ++ struct tnode __rcu *parent; + struct rcu_head rcu; ++ struct hlist_head list; + }; + + struct leaf_info { +@@ -115,20 +129,6 @@ struct leaf_info { + struct rcu_head rcu; + }; + +-struct tnode { +- unsigned long parent; +- t_key key; +- unsigned char pos; /* 2log(KEYLENGTH) bits needed */ +- unsigned char bits; /* 2log(KEYLENGTH) bits needed */ +- unsigned int full_children; /* KEYLENGTH bits needed */ +- unsigned int empty_children; /* KEYLENGTH bits needed */ +- union { +- struct rcu_head rcu; +- struct tnode *tnode_free; +- }; +- struct rt_trie_node __rcu *child[0]; +-}; +- + #ifdef CONFIG_IP_FIB_TRIE_STATS + struct trie_use_stats { + unsigned int gets; +@@ -176,38 +176,27 @@ static const int sync_pages = 128; + static struct kmem_cache *fn_alias_kmem __read_mostly; + static struct kmem_cache *trie_leaf_kmem __read_mostly; + +-/* +- * caller must hold RTNL +- */ +-static inline struct tnode *node_parent(const struct rt_trie_node *node) +-{ +- unsigned long parent; ++/* caller must hold RTNL */ ++#define node_parent(n) rtnl_dereference((n)->parent) + +- parent = rcu_dereference_index_check(node->parent, lockdep_rtnl_is_held()); ++/* caller must hold RCU read lock or RTNL */ ++#define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent) + +- return (struct tnode *)(parent & ~NODE_TYPE_MASK); +-} +- +-/* +- * caller must hold RCU read lock or RTNL +- */ +-static inline struct tnode *node_parent_rcu(const struct rt_trie_node *node) ++/* wrapper for rcu_assign_pointer */ ++static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) + { +- unsigned long parent; +- +- parent = rcu_dereference_index_check(node->parent, rcu_read_lock_held() || +- lockdep_rtnl_is_held()); +- +- return (struct tnode *)(parent & ~NODE_TYPE_MASK); ++ if (node) ++ rcu_assign_pointer(node->parent, ptr); + } + +-/* Same as rcu_assign_pointer +- * but that macro() assumes that value is a pointer. ++#define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p) ++ ++/* This provides us with the number of children in this node, in the case of a ++ * leaf this will return 0 meaning none of the children are accessible. + */ +-static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) ++static inline int tnode_child_length(const struct tnode *tn) + { +- smp_wmb(); +- node->parent = (unsigned long)ptr | NODE_TYPE(node); ++ return (1ul << tn->bits) & ~(1ul); + } + + /* +@@ -215,7 +204,7 @@ static inline void node_set_parent(struc + */ + static inline struct rt_trie_node *tnode_get_child(const struct tnode *tn, unsigned int i) + { +- BUG_ON(i >= 1U << tn->bits); ++ BUG_ON(i >= tnode_child_length(tn)); + + return rtnl_dereference(tn->child[i]); + } +@@ -225,16 +214,11 @@ static inline struct rt_trie_node *tnode + */ + static inline struct rt_trie_node *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) + { +- BUG_ON(i >= 1U << tn->bits); ++ BUG_ON(i >= tnode_child_length(tn)); + + return rcu_dereference_rtnl(tn->child[i]); + } + +-static inline int tnode_child_length(const struct tnode *tn) +-{ +- return 1 << tn->bits; +-} +- + static inline t_key mask_pfx(t_key k, unsigned int l) + { + return (l == 0) ? 0 : k >> (KEYLENGTH-l) << (KEYLENGTH-l); +@@ -336,11 +320,6 @@ static inline int tkey_mismatch(t_key a, + + */ + +-static inline void check_tnode(const struct tnode *tn) +-{ +- WARN_ON(tn && tn->pos+tn->bits > 32); +-} +- + static const int halve_threshold = 25; + static const int inflate_threshold = 50; + static const int halve_threshold_root = 15; +@@ -426,11 +405,20 @@ static void tnode_free_flush(void) + } + } + +-static struct leaf *leaf_new(void) ++static struct leaf *leaf_new(t_key key) + { + struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); + if (l) { +- l->parent = T_LEAF; ++ l->parent = NULL; ++ /* set key and pos to reflect full key value ++ * any trailing zeros in the key should be ignored ++ * as the nodes are searched ++ */ ++ l->key = key; ++ l->pos = KEYLENGTH; ++ /* set bits to 0 indicating we are not a tnode */ ++ l->bits = 0; ++ + INIT_HLIST_HEAD(&l->list); + } + return l; +@@ -451,12 +439,16 @@ static struct tnode *tnode_new(t_key key + { + size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); + struct tnode *tn = tnode_alloc(sz); ++ unsigned int shift = pos + bits; ++ ++ /* verify bits and pos their msb bits clear and values are valid */ ++ BUG_ON(!bits || (shift > KEYLENGTH)); + + if (tn) { +- tn->parent = T_TNODE; ++ tn->parent = NULL; + tn->pos = pos; + tn->bits = bits; +- tn->key = key; ++ tn->key = mask_pfx(key, pos); + tn->full_children = 0; + tn->empty_children = 1<pos == tn->pos + tn->bits; ++ return n && IS_TNODE(n) && (n->pos == (tn->pos + tn->bits)); + } + + static inline void put_child(struct tnode *tn, int i, +@@ -514,8 +503,7 @@ static void tnode_put_child_reorg(struct + else if (!wasfull && isfull) + tn->full_children++; + +- if (n) +- node_set_parent(n, tn); ++ node_set_parent(n, tn); + + rcu_assign_pointer(tn->child[i], n); + } +@@ -523,7 +511,7 @@ static void tnode_put_child_reorg(struct + #define MAX_WORK 10 + static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) + { +- int i; ++ struct rt_trie_node *n = NULL; + struct tnode *old_tn; + int inflate_threshold_use; + int halve_threshold_use; +@@ -536,12 +524,11 @@ static struct rt_trie_node *resize(struc + tn, inflate_threshold, halve_threshold); + + /* No children */ +- if (tn->empty_children == tnode_child_length(tn)) { +- tnode_free_safe(tn); +- return NULL; +- } ++ if (tn->empty_children > (tnode_child_length(tn) - 1)) ++ goto no_children; ++ + /* One child */ +- if (tn->empty_children == tnode_child_length(tn) - 1) ++ if (tn->empty_children == (tnode_child_length(tn) - 1)) + goto one_child; + /* + * Double as long as the resulting node has a number of +@@ -607,11 +594,9 @@ static struct rt_trie_node *resize(struc + * + */ + +- check_tnode(tn); +- + /* Keep root node larger */ + +- if (!node_parent((struct rt_trie_node *)tn)) { ++ if (!node_parent(tn)) { + inflate_threshold_use = inflate_threshold_root; + halve_threshold_use = halve_threshold_root; + } else { +@@ -637,8 +622,6 @@ static struct rt_trie_node *resize(struc + } + } + +- check_tnode(tn); +- + /* Return if at least one inflate is run */ + if (max_work != MAX_WORK) + return (struct rt_trie_node *) tn; +@@ -666,21 +649,16 @@ static struct rt_trie_node *resize(struc + + + /* Only one child remains */ +- if (tn->empty_children == tnode_child_length(tn) - 1) { ++ if (tn->empty_children == (tnode_child_length(tn) - 1)) { ++ unsigned long i; + one_child: +- for (i = 0; i < tnode_child_length(tn); i++) { +- struct rt_trie_node *n; +- +- n = rtnl_dereference(tn->child[i]); +- if (!n) +- continue; +- +- /* compress one level */ +- +- node_set_parent(n, NULL); +- tnode_free_safe(tn); +- return n; +- } ++ for (i = tnode_child_length(tn); !n && i;) ++ n = tnode_get_child(tn, --i); ++no_children: ++ /* compress one level */ ++ node_set_parent(n, NULL); ++ tnode_free_safe(tn); ++ return n; + } + return (struct rt_trie_node *) tn; + } +@@ -760,8 +738,7 @@ static struct tnode *inflate(struct trie + + /* A leaf or an internal node with skipped bits */ + +- if (IS_LEAF(node) || ((struct tnode *) node)->pos > +- tn->pos + tn->bits - 1) { ++ if (IS_LEAF(node) || (node->pos > (tn->pos + tn->bits - 1))) { + put_child(tn, + tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1), + node); +@@ -958,11 +935,9 @@ fib_find_node(struct trie *t, u32 key) + pos = 0; + n = rcu_dereference_rtnl(t->trie); + +- while (n != NULL && NODE_TYPE(n) == T_TNODE) { ++ while (n && IS_TNODE(n)) { + tn = (struct tnode *) n; + +- check_tnode(tn); +- + if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { + pos = tn->pos + tn->bits; + n = tnode_get_child_rcu(tn, +@@ -988,7 +963,7 @@ static void trie_rebalance(struct trie * + + key = tn->key; + +- while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) { ++ while (tn != NULL && (tp = node_parent(tn)) != NULL) { + cindex = tkey_extract_bits(key, tp->pos, tp->bits); + wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); + tn = (struct tnode *)resize(t, tn); +@@ -996,7 +971,7 @@ static void trie_rebalance(struct trie * + tnode_put_child_reorg(tp, cindex, + (struct rt_trie_node *)tn, wasfull); + +- tp = node_parent((struct rt_trie_node *) tn); ++ tp = node_parent(tn); + if (!tp) + rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); + +@@ -1048,11 +1023,9 @@ static struct list_head *fib_insert_node + * If it doesn't, we need to replace it with a T_TNODE. + */ + +- while (n != NULL && NODE_TYPE(n) == T_TNODE) { ++ while (n && IS_TNODE(n)) { + tn = (struct tnode *) n; + +- check_tnode(tn); +- + if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { + tp = tn; + pos = tn->pos + tn->bits; +@@ -1087,12 +1060,11 @@ static struct list_head *fib_insert_node + insert_leaf_info(&l->list, li); + goto done; + } +- l = leaf_new(); ++ l = leaf_new(key); + + if (!l) + return NULL; + +- l->key = key; + li = leaf_info_new(plen); + + if (!li) { +@@ -1569,7 +1541,7 @@ backtrace: + if (chopped_off <= pn->bits) { + cindex &= ~(1 << (chopped_off-1)); + } else { +- struct tnode *parent = node_parent_rcu((struct rt_trie_node *) pn); ++ struct tnode *parent = node_parent_rcu(pn); + if (!parent) + goto failed; + +@@ -1597,7 +1569,7 @@ EXPORT_SYMBOL_GPL(fib_table_lookup); + */ + static void trie_leaf_remove(struct trie *t, struct leaf *l) + { +- struct tnode *tp = node_parent((struct rt_trie_node *) l); ++ struct tnode *tp = node_parent(l); + + pr_debug("entering trie_leaf_remove(%p)\n", l); + +@@ -2374,7 +2346,7 @@ static int fib_trie_seq_show(struct seq_ + + if (IS_TNODE(n)) { + struct tnode *tn = (struct tnode *) n; +- __be32 prf = htonl(mask_pfx(tn->key, tn->pos)); ++ __be32 prf = htonl(tn->key); + + seq_indent(seq, iter->depth-1); + seq_printf(seq, " +-- %pI4/%d %d %d %d\n", diff --git a/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch b/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch new file mode 100644 index 000000000..3f8d03067 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch @@ -0,0 +1,209 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:55:41 -0800 +Subject: [PATCH] fib_trie: Merge tnode_free and leaf_free into node_free + +Both the leaf and the tnode had an rcu_head in them, but they had them in +slightly different places. Since we now have them in the same spot and +know that any node with bits == 0 is a leaf and the rest are either vmalloc +or kmalloc tnodes depending on the value of bits it makes it easy to combine +the functions and reduce overhead. + +In addition I have taken advantage of the rcu_head pointer to go ahead and +put together a simple linked list instead of using the tnode pointer as +this way we can merge either type of structure for freeing. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -95,15 +95,17 @@ struct tnode { + unsigned char bits; /* 2log(KEYLENGTH) bits needed */ + unsigned char pos; /* 2log(KEYLENGTH) bits needed */ + struct tnode __rcu *parent; +- union { +- struct rcu_head rcu; +- struct tnode *tnode_free; +- }; ++ struct rcu_head rcu; ++ /* everything above this comment must be the same as rt_trie_node */ + unsigned int full_children; /* KEYLENGTH bits needed */ + unsigned int empty_children; /* KEYLENGTH bits needed */ + struct rt_trie_node __rcu *child[0]; + }; + ++/* This struct represents the shared bits between tnode and leaf. If any ++ * ordering is changed here is must also be updated in tnode and leaf as ++ * well. ++ */ + struct rt_trie_node { + t_key key; + unsigned char bits; +@@ -118,6 +120,7 @@ struct leaf { + unsigned char pos; + struct tnode __rcu *parent; + struct rcu_head rcu; ++ /* everything above this comment must be the same as rt_trie_node */ + struct hlist_head list; + }; + +@@ -163,7 +166,7 @@ static struct rt_trie_node *resize(struc + static struct tnode *inflate(struct trie *t, struct tnode *tn); + static struct tnode *halve(struct trie *t, struct tnode *tn); + /* tnodes to free after resize(); protected by RTNL */ +-static struct tnode *tnode_free_head; ++static struct callback_head *tnode_free_head; + static size_t tnode_free_size; + + /* +@@ -336,17 +339,23 @@ static inline void alias_free_mem_rcu(st + call_rcu(&fa->rcu, __alias_free_mem); + } + +-static void __leaf_free_rcu(struct rcu_head *head) +-{ +- struct leaf *l = container_of(head, struct leaf, rcu); +- kmem_cache_free(trie_leaf_kmem, l); +-} ++#define TNODE_KMALLOC_MAX \ ++ ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct rt_trie_node *)) + +-static inline void free_leaf(struct leaf *l) ++static void __node_free_rcu(struct rcu_head *head) + { +- call_rcu(&l->rcu, __leaf_free_rcu); ++ struct rt_trie_node *n = container_of(head, struct rt_trie_node, rcu); ++ ++ if (IS_LEAF(n)) ++ kmem_cache_free(trie_leaf_kmem, n); ++ else if (n->bits <= TNODE_KMALLOC_MAX) ++ kfree(n); ++ else ++ vfree(n); + } + ++#define node_free(n) call_rcu(&n->rcu, __node_free_rcu) ++ + static inline void free_leaf_info(struct leaf_info *leaf) + { + kfree_rcu(leaf, rcu); +@@ -360,43 +369,24 @@ static struct tnode *tnode_alloc(size_t + return vzalloc(size); + } + +-static void __tnode_free_rcu(struct rcu_head *head) +-{ +- struct tnode *tn = container_of(head, struct tnode, rcu); +- size_t size = sizeof(struct tnode) + +- (sizeof(struct rt_trie_node *) << tn->bits); +- +- if (size <= PAGE_SIZE) +- kfree(tn); +- else +- vfree(tn); +-} +- +-static inline void tnode_free(struct tnode *tn) +-{ +- if (IS_LEAF(tn)) +- free_leaf((struct leaf *) tn); +- else +- call_rcu(&tn->rcu, __tnode_free_rcu); +-} +- + static void tnode_free_safe(struct tnode *tn) + { + BUG_ON(IS_LEAF(tn)); +- tn->tnode_free = tnode_free_head; +- tnode_free_head = tn; +- tnode_free_size += sizeof(struct tnode) + +- (sizeof(struct rt_trie_node *) << tn->bits); ++ tn->rcu.next = tnode_free_head; ++ tnode_free_head = &tn->rcu; + } + + static void tnode_free_flush(void) + { +- struct tnode *tn; ++ struct callback_head *head; ++ ++ while ((head = tnode_free_head)) { ++ struct tnode *tn = container_of(head, struct tnode, rcu); ++ ++ tnode_free_head = head->next; ++ tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); + +- while ((tn = tnode_free_head)) { +- tnode_free_head = tn->tnode_free; +- tn->tnode_free = NULL; +- tnode_free(tn); ++ node_free(tn); + } + + if (tnode_free_size >= PAGE_SIZE * sync_pages) { +@@ -437,7 +427,7 @@ static struct leaf_info *leaf_info_new(i + + static struct tnode *tnode_new(t_key key, int pos, int bits) + { +- size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); ++ size_t sz = offsetof(struct tnode, child[1 << bits]); + struct tnode *tn = tnode_alloc(sz); + unsigned int shift = pos + bits; + +@@ -666,15 +656,15 @@ no_children: + + static void tnode_clean_free(struct tnode *tn) + { ++ struct rt_trie_node *tofree; + int i; +- struct tnode *tofree; + + for (i = 0; i < tnode_child_length(tn); i++) { +- tofree = (struct tnode *)rtnl_dereference(tn->child[i]); ++ tofree = rtnl_dereference(tn->child[i]); + if (tofree) +- tnode_free(tofree); ++ node_free(tofree); + } +- tnode_free(tn); ++ node_free(tn); + } + + static struct tnode *inflate(struct trie *t, struct tnode *tn) +@@ -717,7 +707,7 @@ static struct tnode *inflate(struct trie + inode->bits - 1); + + if (!right) { +- tnode_free(left); ++ node_free(left); + goto nomem; + } + +@@ -1068,7 +1058,7 @@ static struct list_head *fib_insert_node + li = leaf_info_new(plen); + + if (!li) { +- free_leaf(l); ++ node_free(l); + return NULL; + } + +@@ -1100,7 +1090,7 @@ static struct list_head *fib_insert_node + + if (!tn) { + free_leaf_info(li); +- free_leaf(l); ++ node_free(l); + return NULL; + } + +@@ -1580,7 +1570,7 @@ static void trie_leaf_remove(struct trie + } else + RCU_INIT_POINTER(t->trie, NULL); + +- free_leaf(l); ++ node_free(l); + } + + /* diff --git a/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch b/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch new file mode 100644 index 000000000..a3393bf93 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch @@ -0,0 +1,928 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:55:47 -0800 +Subject: [PATCH] fib_trie: Merge leaf into tnode + +This change makes it so that leaf and tnode are the same struct. As a +result there is no need for rt_trie_node anymore since everyting can be +merged into tnode. + +On 32b systems this results in the leaf being 4 bytes larger, however I +don't know if that is really an issue as this and an eariler patch that +added bits & pos have increased the size from 20 to 28. If I am not +mistaken slub/slab allocate on power of 2 sizes so 20 was likely being +rounded up to 32 anyway. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -96,32 +96,16 @@ struct tnode { + unsigned char pos; /* 2log(KEYLENGTH) bits needed */ + struct tnode __rcu *parent; + struct rcu_head rcu; +- /* everything above this comment must be the same as rt_trie_node */ +- unsigned int full_children; /* KEYLENGTH bits needed */ +- unsigned int empty_children; /* KEYLENGTH bits needed */ +- struct rt_trie_node __rcu *child[0]; +-}; +- +-/* This struct represents the shared bits between tnode and leaf. If any +- * ordering is changed here is must also be updated in tnode and leaf as +- * well. +- */ +-struct rt_trie_node { +- t_key key; +- unsigned char bits; +- unsigned char pos; +- struct tnode __rcu *parent; +- struct rcu_head rcu; +-}; +- +-struct leaf { +- t_key key; +- unsigned char bits; +- unsigned char pos; +- struct tnode __rcu *parent; +- struct rcu_head rcu; +- /* everything above this comment must be the same as rt_trie_node */ +- struct hlist_head list; ++ union { ++ /* The fields in this struct are valid if bits > 0 (TNODE) */ ++ struct { ++ unsigned int full_children; /* KEYLENGTH bits needed */ ++ unsigned int empty_children; /* KEYLENGTH bits needed */ ++ struct tnode __rcu *child[0]; ++ }; ++ /* This list pointer if valid if bits == 0 (LEAF) */ ++ struct hlist_head list; ++ }; + }; + + struct leaf_info { +@@ -154,15 +138,15 @@ struct trie_stat { + }; + + struct trie { +- struct rt_trie_node __rcu *trie; ++ struct tnode __rcu *trie; + #ifdef CONFIG_IP_FIB_TRIE_STATS + struct trie_use_stats __percpu *stats; + #endif + }; + +-static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, ++static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, + int wasfull); +-static struct rt_trie_node *resize(struct trie *t, struct tnode *tn); ++static struct tnode *resize(struct trie *t, struct tnode *tn); + static struct tnode *inflate(struct trie *t, struct tnode *tn); + static struct tnode *halve(struct trie *t, struct tnode *tn); + /* tnodes to free after resize(); protected by RTNL */ +@@ -186,10 +170,10 @@ static struct kmem_cache *trie_leaf_kmem + #define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent) + + /* wrapper for rcu_assign_pointer */ +-static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) ++static inline void node_set_parent(struct tnode *n, struct tnode *tp) + { +- if (node) +- rcu_assign_pointer(node->parent, ptr); ++ if (n) ++ rcu_assign_pointer(n->parent, tp); + } + + #define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p) +@@ -205,7 +189,7 @@ static inline int tnode_child_length(con + /* + * caller must hold RTNL + */ +-static inline struct rt_trie_node *tnode_get_child(const struct tnode *tn, unsigned int i) ++static inline struct tnode *tnode_get_child(const struct tnode *tn, unsigned int i) + { + BUG_ON(i >= tnode_child_length(tn)); + +@@ -215,7 +199,7 @@ static inline struct rt_trie_node *tnode + /* + * caller must hold RCU read lock or RTNL + */ +-static inline struct rt_trie_node *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) ++static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) + { + BUG_ON(i >= tnode_child_length(tn)); + +@@ -340,11 +324,11 @@ static inline void alias_free_mem_rcu(st + } + + #define TNODE_KMALLOC_MAX \ +- ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct rt_trie_node *)) ++ ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct tnode *)) + + static void __node_free_rcu(struct rcu_head *head) + { +- struct rt_trie_node *n = container_of(head, struct rt_trie_node, rcu); ++ struct tnode *n = container_of(head, struct tnode, rcu); + + if (IS_LEAF(n)) + kmem_cache_free(trie_leaf_kmem, n); +@@ -395,9 +379,9 @@ static void tnode_free_flush(void) + } + } + +-static struct leaf *leaf_new(t_key key) ++static struct tnode *leaf_new(t_key key) + { +- struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); ++ struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); + if (l) { + l->parent = NULL; + /* set key and pos to reflect full key value +@@ -444,7 +428,7 @@ static struct tnode *tnode_new(t_key key + } + + pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), +- sizeof(struct rt_trie_node *) << bits); ++ sizeof(struct tnode *) << bits); + return tn; + } + +@@ -453,13 +437,13 @@ static struct tnode *tnode_new(t_key key + * and no bits are skipped. See discussion in dyntree paper p. 6 + */ + +-static inline int tnode_full(const struct tnode *tn, const struct rt_trie_node *n) ++static inline int tnode_full(const struct tnode *tn, const struct tnode *n) + { + return n && IS_TNODE(n) && (n->pos == (tn->pos + tn->bits)); + } + + static inline void put_child(struct tnode *tn, int i, +- struct rt_trie_node *n) ++ struct tnode *n) + { + tnode_put_child_reorg(tn, i, n, -1); + } +@@ -469,10 +453,10 @@ static inline void put_child(struct tnod + * Update the value of full_children and empty_children. + */ + +-static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, ++static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, + int wasfull) + { +- struct rt_trie_node *chi = rtnl_dereference(tn->child[i]); ++ struct tnode *chi = rtnl_dereference(tn->child[i]); + int isfull; + + BUG_ON(i >= 1<bits); +@@ -499,10 +483,9 @@ static void tnode_put_child_reorg(struct + } + + #define MAX_WORK 10 +-static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) ++static struct tnode *resize(struct trie *t, struct tnode *tn) + { +- struct rt_trie_node *n = NULL; +- struct tnode *old_tn; ++ struct tnode *old_tn, *n = NULL; + int inflate_threshold_use; + int halve_threshold_use; + int max_work; +@@ -614,7 +597,7 @@ static struct rt_trie_node *resize(struc + + /* Return if at least one inflate is run */ + if (max_work != MAX_WORK) +- return (struct rt_trie_node *) tn; ++ return tn; + + /* + * Halve as long as the number of empty children in this +@@ -650,13 +633,13 @@ no_children: + tnode_free_safe(tn); + return n; + } +- return (struct rt_trie_node *) tn; ++ return tn; + } + + + static void tnode_clean_free(struct tnode *tn) + { +- struct rt_trie_node *tofree; ++ struct tnode *tofree; + int i; + + for (i = 0; i < tnode_child_length(tn); i++) { +@@ -667,10 +650,10 @@ static void tnode_clean_free(struct tnod + node_free(tn); + } + +-static struct tnode *inflate(struct trie *t, struct tnode *tn) ++static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) + { +- struct tnode *oldtnode = tn; +- int olen = tnode_child_length(tn); ++ int olen = tnode_child_length(oldtnode); ++ struct tnode *tn; + int i; + + pr_debug("In inflate\n"); +@@ -690,11 +673,8 @@ static struct tnode *inflate(struct trie + for (i = 0; i < olen; i++) { + struct tnode *inode; + +- inode = (struct tnode *) tnode_get_child(oldtnode, i); +- if (inode && +- IS_TNODE(inode) && +- inode->pos == oldtnode->pos + oldtnode->bits && +- inode->bits > 1) { ++ inode = tnode_get_child(oldtnode, i); ++ if (tnode_full(oldtnode, inode) && inode->bits > 1) { + struct tnode *left, *right; + t_key m = ~0U << (KEYLENGTH - 1) >> inode->pos; + +@@ -711,33 +691,29 @@ static struct tnode *inflate(struct trie + goto nomem; + } + +- put_child(tn, 2*i, (struct rt_trie_node *) left); +- put_child(tn, 2*i+1, (struct rt_trie_node *) right); ++ put_child(tn, 2*i, left); ++ put_child(tn, 2*i+1, right); + } + } + + for (i = 0; i < olen; i++) { +- struct tnode *inode; +- struct rt_trie_node *node = tnode_get_child(oldtnode, i); ++ struct tnode *inode = tnode_get_child(oldtnode, i); + struct tnode *left, *right; + int size, j; + + /* An empty child */ +- if (node == NULL) ++ if (inode == NULL) + continue; + + /* A leaf or an internal node with skipped bits */ +- +- if (IS_LEAF(node) || (node->pos > (tn->pos + tn->bits - 1))) { ++ if (!tnode_full(oldtnode, inode)) { + put_child(tn, +- tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1), +- node); ++ tkey_extract_bits(inode->key, tn->pos, tn->bits), ++ inode); + continue; + } + + /* An internal node with two children */ +- inode = (struct tnode *) node; +- + if (inode->bits == 1) { + put_child(tn, 2*i, rtnl_dereference(inode->child[0])); + put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); +@@ -769,12 +745,12 @@ static struct tnode *inflate(struct trie + * bit to zero. + */ + +- left = (struct tnode *) tnode_get_child(tn, 2*i); ++ left = tnode_get_child(tn, 2*i); + put_child(tn, 2*i, NULL); + + BUG_ON(!left); + +- right = (struct tnode *) tnode_get_child(tn, 2*i+1); ++ right = tnode_get_child(tn, 2*i+1); + put_child(tn, 2*i+1, NULL); + + BUG_ON(!right); +@@ -796,12 +772,11 @@ nomem: + return ERR_PTR(-ENOMEM); + } + +-static struct tnode *halve(struct trie *t, struct tnode *tn) ++static struct tnode *halve(struct trie *t, struct tnode *oldtnode) + { +- struct tnode *oldtnode = tn; +- struct rt_trie_node *left, *right; ++ int olen = tnode_child_length(oldtnode); ++ struct tnode *tn, *left, *right; + int i; +- int olen = tnode_child_length(tn); + + pr_debug("In halve\n"); + +@@ -830,7 +805,7 @@ static struct tnode *halve(struct trie * + if (!newn) + goto nomem; + +- put_child(tn, i/2, (struct rt_trie_node *)newn); ++ put_child(tn, i/2, newn); + } + + } +@@ -855,7 +830,7 @@ static struct tnode *halve(struct trie * + } + + /* Two nonempty children */ +- newBinNode = (struct tnode *) tnode_get_child(tn, i/2); ++ newBinNode = tnode_get_child(tn, i/2); + put_child(tn, i/2, NULL); + put_child(newBinNode, 0, left); + put_child(newBinNode, 1, right); +@@ -871,7 +846,7 @@ nomem: + /* readside must use rcu_read_lock currently dump routines + via get_fa_head and dump */ + +-static struct leaf_info *find_leaf_info(struct leaf *l, int plen) ++static struct leaf_info *find_leaf_info(struct tnode *l, int plen) + { + struct hlist_head *head = &l->list; + struct leaf_info *li; +@@ -883,7 +858,7 @@ static struct leaf_info *find_leaf_info( + return NULL; + } + +-static inline struct list_head *get_fa_head(struct leaf *l, int plen) ++static inline struct list_head *get_fa_head(struct tnode *l, int plen) + { + struct leaf_info *li = find_leaf_info(l, plen); + +@@ -915,32 +890,25 @@ static void insert_leaf_info(struct hlis + + /* rcu_read_lock needs to be hold by caller from readside */ + +-static struct leaf * +-fib_find_node(struct trie *t, u32 key) ++static struct tnode *fib_find_node(struct trie *t, u32 key) + { +- int pos; +- struct tnode *tn; +- struct rt_trie_node *n; +- +- pos = 0; +- n = rcu_dereference_rtnl(t->trie); ++ struct tnode *n = rcu_dereference_rtnl(t->trie); ++ int pos = 0; + + while (n && IS_TNODE(n)) { +- tn = (struct tnode *) n; +- +- if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { +- pos = tn->pos + tn->bits; +- n = tnode_get_child_rcu(tn, ++ if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { ++ pos = n->pos + n->bits; ++ n = tnode_get_child_rcu(n, + tkey_extract_bits(key, +- tn->pos, +- tn->bits)); ++ n->pos, ++ n->bits)); + } else + break; + } + /* Case we have found a leaf. Compare prefixes */ + + if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) +- return (struct leaf *)n; ++ return n; + + return NULL; + } +@@ -956,14 +924,13 @@ static void trie_rebalance(struct trie * + while (tn != NULL && (tp = node_parent(tn)) != NULL) { + cindex = tkey_extract_bits(key, tp->pos, tp->bits); + wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); +- tn = (struct tnode *)resize(t, tn); ++ tn = resize(t, tn); + +- tnode_put_child_reorg(tp, cindex, +- (struct rt_trie_node *)tn, wasfull); ++ tnode_put_child_reorg(tp, cindex, tn, wasfull); + + tp = node_parent(tn); + if (!tp) +- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); ++ rcu_assign_pointer(t->trie, tn); + + tnode_free_flush(); + if (!tp) +@@ -973,9 +940,9 @@ static void trie_rebalance(struct trie * + + /* Handle last (top) tnode */ + if (IS_TNODE(tn)) +- tn = (struct tnode *)resize(t, tn); ++ tn = resize(t, tn); + +- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); ++ rcu_assign_pointer(t->trie, tn); + tnode_free_flush(); + } + +@@ -985,8 +952,8 @@ static struct list_head *fib_insert_node + { + int pos, newpos; + struct tnode *tp = NULL, *tn = NULL; +- struct rt_trie_node *n; +- struct leaf *l; ++ struct tnode *n; ++ struct tnode *l; + int missbit; + struct list_head *fa_head = NULL; + struct leaf_info *li; +@@ -1014,17 +981,15 @@ static struct list_head *fib_insert_node + */ + + while (n && IS_TNODE(n)) { +- tn = (struct tnode *) n; +- +- if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { +- tp = tn; +- pos = tn->pos + tn->bits; +- n = tnode_get_child(tn, ++ if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { ++ tp = n; ++ pos = n->pos + n->bits; ++ n = tnode_get_child(n, + tkey_extract_bits(key, +- tn->pos, +- tn->bits)); ++ n->pos, ++ n->bits)); + +- BUG_ON(n && node_parent(n) != tn); ++ BUG_ON(n && node_parent(n) != tp); + } else + break; + } +@@ -1040,14 +1005,13 @@ static struct list_head *fib_insert_node + /* Case 1: n is a leaf. Compare prefixes */ + + if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) { +- l = (struct leaf *) n; + li = leaf_info_new(plen); + + if (!li) + return NULL; + + fa_head = &li->falh; +- insert_leaf_info(&l->list, li); ++ insert_leaf_info(&n->list, li); + goto done; + } + l = leaf_new(key); +@@ -1068,10 +1032,10 @@ static struct list_head *fib_insert_node + if (t->trie && n == NULL) { + /* Case 2: n is NULL, and will just insert a new leaf */ + +- node_set_parent((struct rt_trie_node *)l, tp); ++ node_set_parent(l, tp); + + cindex = tkey_extract_bits(key, tp->pos, tp->bits); +- put_child(tp, cindex, (struct rt_trie_node *)l); ++ put_child(tp, cindex, l); + } else { + /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ + /* +@@ -1094,17 +1058,17 @@ static struct list_head *fib_insert_node + return NULL; + } + +- node_set_parent((struct rt_trie_node *)tn, tp); ++ node_set_parent(tn, tp); + + missbit = tkey_extract_bits(key, newpos, 1); +- put_child(tn, missbit, (struct rt_trie_node *)l); ++ put_child(tn, missbit, l); + put_child(tn, 1-missbit, n); + + if (tp) { + cindex = tkey_extract_bits(key, tp->pos, tp->bits); +- put_child(tp, cindex, (struct rt_trie_node *)tn); ++ put_child(tp, cindex, tn); + } else { +- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); ++ rcu_assign_pointer(t->trie, tn); + } + + tp = tn; +@@ -1134,7 +1098,7 @@ int fib_table_insert(struct fib_table *t + u8 tos = cfg->fc_tos; + u32 key, mask; + int err; +- struct leaf *l; ++ struct tnode *l; + + if (plen > 32) + return -EINVAL; +@@ -1292,7 +1256,7 @@ err: + } + + /* should be called with rcu_read_lock */ +-static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, ++static int check_leaf(struct fib_table *tb, struct trie *t, struct tnode *l, + t_key key, const struct flowi4 *flp, + struct fib_result *res, int fib_flags) + { +@@ -1365,7 +1329,7 @@ int fib_table_lookup(struct fib_table *t + struct trie_use_stats __percpu *stats = t->stats; + #endif + int ret; +- struct rt_trie_node *n; ++ struct tnode *n; + struct tnode *pn; + unsigned int pos, bits; + t_key key = ntohl(flp->daddr); +@@ -1387,11 +1351,11 @@ int fib_table_lookup(struct fib_table *t + + /* Just a leaf? */ + if (IS_LEAF(n)) { +- ret = check_leaf(tb, t, (struct leaf *)n, key, flp, res, fib_flags); ++ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); + goto found; + } + +- pn = (struct tnode *) n; ++ pn = n; + chopped_off = 0; + + while (pn) { +@@ -1412,13 +1376,13 @@ int fib_table_lookup(struct fib_table *t + } + + if (IS_LEAF(n)) { +- ret = check_leaf(tb, t, (struct leaf *)n, key, flp, res, fib_flags); ++ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); + if (ret > 0) + goto backtrace; + goto found; + } + +- cn = (struct tnode *)n; ++ cn = n; + + /* + * It's a tnode, and we can do some extra checks here if we +@@ -1506,7 +1470,7 @@ int fib_table_lookup(struct fib_table *t + current_prefix_length = mp; + } + +- pn = (struct tnode *)n; /* Descend */ ++ pn = n; /* Descend */ + chopped_off = 0; + continue; + +@@ -1557,7 +1521,7 @@ EXPORT_SYMBOL_GPL(fib_table_lookup); + /* + * Remove the leaf and return parent. + */ +-static void trie_leaf_remove(struct trie *t, struct leaf *l) ++static void trie_leaf_remove(struct trie *t, struct tnode *l) + { + struct tnode *tp = node_parent(l); + +@@ -1584,7 +1548,7 @@ int fib_table_delete(struct fib_table *t + u8 tos = cfg->fc_tos; + struct fib_alias *fa, *fa_to_delete; + struct list_head *fa_head; +- struct leaf *l; ++ struct tnode *l; + struct leaf_info *li; + + if (plen > 32) +@@ -1682,7 +1646,7 @@ static int trie_flush_list(struct list_h + return found; + } + +-static int trie_flush_leaf(struct leaf *l) ++static int trie_flush_leaf(struct tnode *l) + { + int found = 0; + struct hlist_head *lih = &l->list; +@@ -1704,7 +1668,7 @@ static int trie_flush_leaf(struct leaf * + * Scan for the next right leaf starting at node p->child[idx] + * Since we have back pointer, no recursion necessary. + */ +-static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c) ++static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) + { + do { + t_key idx; +@@ -1720,47 +1684,46 @@ static struct leaf *leaf_walk_rcu(struct + continue; + + if (IS_LEAF(c)) +- return (struct leaf *) c; ++ return c; + + /* Rescan start scanning in new node */ +- p = (struct tnode *) c; ++ p = c; + idx = 0; + } + + /* Node empty, walk back up to parent */ +- c = (struct rt_trie_node *) p; ++ c = p; + } while ((p = node_parent_rcu(c)) != NULL); + + return NULL; /* Root of trie */ + } + +-static struct leaf *trie_firstleaf(struct trie *t) ++static struct tnode *trie_firstleaf(struct trie *t) + { +- struct tnode *n = (struct tnode *)rcu_dereference_rtnl(t->trie); ++ struct tnode *n = rcu_dereference_rtnl(t->trie); + + if (!n) + return NULL; + + if (IS_LEAF(n)) /* trie is just a leaf */ +- return (struct leaf *) n; ++ return n; + + return leaf_walk_rcu(n, NULL); + } + +-static struct leaf *trie_nextleaf(struct leaf *l) ++static struct tnode *trie_nextleaf(struct tnode *l) + { +- struct rt_trie_node *c = (struct rt_trie_node *) l; +- struct tnode *p = node_parent_rcu(c); ++ struct tnode *p = node_parent_rcu(l); + + if (!p) + return NULL; /* trie with just one leaf */ + +- return leaf_walk_rcu(p, c); ++ return leaf_walk_rcu(p, l); + } + +-static struct leaf *trie_leafindex(struct trie *t, int index) ++static struct tnode *trie_leafindex(struct trie *t, int index) + { +- struct leaf *l = trie_firstleaf(t); ++ struct tnode *l = trie_firstleaf(t); + + while (l && index-- > 0) + l = trie_nextleaf(l); +@@ -1775,7 +1738,7 @@ static struct leaf *trie_leafindex(struc + int fib_table_flush(struct fib_table *tb) + { + struct trie *t = (struct trie *) tb->tb_data; +- struct leaf *l, *ll = NULL; ++ struct tnode *l, *ll = NULL; + int found = 0; + + for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) { +@@ -1840,7 +1803,7 @@ static int fn_trie_dump_fa(t_key key, in + return skb->len; + } + +-static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb, ++static int fn_trie_dump_leaf(struct tnode *l, struct fib_table *tb, + struct sk_buff *skb, struct netlink_callback *cb) + { + struct leaf_info *li; +@@ -1876,7 +1839,7 @@ static int fn_trie_dump_leaf(struct leaf + int fib_table_dump(struct fib_table *tb, struct sk_buff *skb, + struct netlink_callback *cb) + { +- struct leaf *l; ++ struct tnode *l; + struct trie *t = (struct trie *) tb->tb_data; + t_key key = cb->args[2]; + int count = cb->args[3]; +@@ -1922,7 +1885,7 @@ void __init fib_trie_init(void) + 0, SLAB_PANIC, NULL); + + trie_leaf_kmem = kmem_cache_create("ip_fib_trie", +- max(sizeof(struct leaf), ++ max(sizeof(struct tnode), + sizeof(struct leaf_info)), + 0, SLAB_PANIC, NULL); + } +@@ -1965,7 +1928,7 @@ struct fib_trie_iter { + unsigned int depth; + }; + +-static struct rt_trie_node *fib_trie_get_next(struct fib_trie_iter *iter) ++static struct tnode *fib_trie_get_next(struct fib_trie_iter *iter) + { + struct tnode *tn = iter->tnode; + unsigned int cindex = iter->index; +@@ -1979,7 +1942,7 @@ static struct rt_trie_node *fib_trie_get + iter->tnode, iter->index, iter->depth); + rescan: + while (cindex < (1<bits)) { +- struct rt_trie_node *n = tnode_get_child_rcu(tn, cindex); ++ struct tnode *n = tnode_get_child_rcu(tn, cindex); + + if (n) { + if (IS_LEAF(n)) { +@@ -1987,7 +1950,7 @@ rescan: + iter->index = cindex + 1; + } else { + /* push down one level */ +- iter->tnode = (struct tnode *) n; ++ iter->tnode = n; + iter->index = 0; + ++iter->depth; + } +@@ -1998,7 +1961,7 @@ rescan: + } + + /* Current node exhausted, pop back up */ +- p = node_parent_rcu((struct rt_trie_node *)tn); ++ p = node_parent_rcu(tn); + if (p) { + cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; + tn = p; +@@ -2010,10 +1973,10 @@ rescan: + return NULL; + } + +-static struct rt_trie_node *fib_trie_get_first(struct fib_trie_iter *iter, ++static struct tnode *fib_trie_get_first(struct fib_trie_iter *iter, + struct trie *t) + { +- struct rt_trie_node *n; ++ struct tnode *n; + + if (!t) + return NULL; +@@ -2023,7 +1986,7 @@ static struct rt_trie_node *fib_trie_get + return NULL; + + if (IS_TNODE(n)) { +- iter->tnode = (struct tnode *) n; ++ iter->tnode = n; + iter->index = 0; + iter->depth = 1; + } else { +@@ -2037,7 +2000,7 @@ static struct rt_trie_node *fib_trie_get + + static void trie_collect_stats(struct trie *t, struct trie_stat *s) + { +- struct rt_trie_node *n; ++ struct tnode *n; + struct fib_trie_iter iter; + + memset(s, 0, sizeof(*s)); +@@ -2045,7 +2008,6 @@ static void trie_collect_stats(struct tr + rcu_read_lock(); + for (n = fib_trie_get_first(&iter, t); n; n = fib_trie_get_next(&iter)) { + if (IS_LEAF(n)) { +- struct leaf *l = (struct leaf *)n; + struct leaf_info *li; + + s->leaves++; +@@ -2053,18 +2015,17 @@ static void trie_collect_stats(struct tr + if (iter.depth > s->maxdepth) + s->maxdepth = iter.depth; + +- hlist_for_each_entry_rcu(li, &l->list, hlist) ++ hlist_for_each_entry_rcu(li, &n->list, hlist) + ++s->prefixes; + } else { +- const struct tnode *tn = (const struct tnode *) n; + int i; + + s->tnodes++; +- if (tn->bits < MAX_STAT_DEPTH) +- s->nodesizes[tn->bits]++; ++ if (n->bits < MAX_STAT_DEPTH) ++ s->nodesizes[n->bits]++; + +- for (i = 0; i < (1<bits); i++) +- if (!tn->child[i]) ++ for (i = 0; i < tnode_child_length(n); i++) ++ if (!rcu_access_pointer(n->child[i])) + s->nullpointers++; + } + } +@@ -2088,7 +2049,7 @@ static void trie_show_stats(struct seq_f + seq_printf(seq, "\tMax depth: %u\n", stat->maxdepth); + + seq_printf(seq, "\tLeaves: %u\n", stat->leaves); +- bytes = sizeof(struct leaf) * stat->leaves; ++ bytes = sizeof(struct tnode) * stat->leaves; + + seq_printf(seq, "\tPrefixes: %u\n", stat->prefixes); + bytes += sizeof(struct leaf_info) * stat->prefixes; +@@ -2109,7 +2070,7 @@ static void trie_show_stats(struct seq_f + seq_putc(seq, '\n'); + seq_printf(seq, "\tPointers: %u\n", pointers); + +- bytes += sizeof(struct rt_trie_node *) * pointers; ++ bytes += sizeof(struct tnode *) * pointers; + seq_printf(seq, "Null ptrs: %u\n", stat->nullpointers); + seq_printf(seq, "Total size: %u kB\n", (bytes + 1023) / 1024); + } +@@ -2163,7 +2124,7 @@ static int fib_triestat_seq_show(struct + seq_printf(seq, + "Basic info: size of leaf:" + " %Zd bytes, size of tnode: %Zd bytes.\n", +- sizeof(struct leaf), sizeof(struct tnode)); ++ sizeof(struct tnode), sizeof(struct tnode)); + + for (h = 0; h < FIB_TABLE_HASHSZ; h++) { + struct hlist_head *head = &net->ipv4.fib_table_hash[h]; +@@ -2202,7 +2163,7 @@ static const struct file_operations fib_ + .release = single_release_net, + }; + +-static struct rt_trie_node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) ++static struct tnode *fib_trie_get_idx(struct seq_file *seq, loff_t pos) + { + struct fib_trie_iter *iter = seq->private; + struct net *net = seq_file_net(seq); +@@ -2214,7 +2175,7 @@ static struct rt_trie_node *fib_trie_get + struct fib_table *tb; + + hlist_for_each_entry_rcu(tb, head, tb_hlist) { +- struct rt_trie_node *n; ++ struct tnode *n; + + for (n = fib_trie_get_first(iter, + (struct trie *) tb->tb_data); +@@ -2243,7 +2204,7 @@ static void *fib_trie_seq_next(struct se + struct fib_table *tb = iter->tb; + struct hlist_node *tb_node; + unsigned int h; +- struct rt_trie_node *n; ++ struct tnode *n; + + ++*pos; + /* next node in same table */ +@@ -2329,29 +2290,26 @@ static inline const char *rtn_type(char + static int fib_trie_seq_show(struct seq_file *seq, void *v) + { + const struct fib_trie_iter *iter = seq->private; +- struct rt_trie_node *n = v; ++ struct tnode *n = v; + + if (!node_parent_rcu(n)) + fib_table_print(seq, iter->tb); + + if (IS_TNODE(n)) { +- struct tnode *tn = (struct tnode *) n; +- __be32 prf = htonl(tn->key); ++ __be32 prf = htonl(n->key); + +- seq_indent(seq, iter->depth-1); ++ seq_indent(seq, iter->depth - 1); + seq_printf(seq, " +-- %pI4/%d %d %d %d\n", +- &prf, tn->pos, tn->bits, tn->full_children, +- tn->empty_children); +- ++ &prf, n->pos, n->bits, n->full_children, ++ n->empty_children); + } else { +- struct leaf *l = (struct leaf *) n; + struct leaf_info *li; +- __be32 val = htonl(l->key); ++ __be32 val = htonl(n->key); + + seq_indent(seq, iter->depth); + seq_printf(seq, " |-- %pI4\n", &val); + +- hlist_for_each_entry_rcu(li, &l->list, hlist) { ++ hlist_for_each_entry_rcu(li, &n->list, hlist) { + struct fib_alias *fa; + + list_for_each_entry_rcu(fa, &li->falh, fa_list) { +@@ -2401,9 +2359,9 @@ struct fib_route_iter { + t_key key; + }; + +-static struct leaf *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) ++static struct tnode *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) + { +- struct leaf *l = NULL; ++ struct tnode *l = NULL; + struct trie *t = iter->main_trie; + + /* use cache location of last found key */ +@@ -2448,7 +2406,7 @@ static void *fib_route_seq_start(struct + static void *fib_route_seq_next(struct seq_file *seq, void *v, loff_t *pos) + { + struct fib_route_iter *iter = seq->private; +- struct leaf *l = v; ++ struct tnode *l = v; + + ++*pos; + if (v == SEQ_START_TOKEN) { +@@ -2494,7 +2452,7 @@ static unsigned int fib_flag_trans(int t + */ + static int fib_route_seq_show(struct seq_file *seq, void *v) + { +- struct leaf *l = v; ++ struct tnode *l = v; + struct leaf_info *li; + + if (v == SEQ_START_TOKEN) { diff --git a/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch b/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch new file mode 100644 index 000000000..e84412687 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch @@ -0,0 +1,343 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:55:54 -0800 +Subject: [PATCH] fib_trie: Optimize fib_table_lookup to avoid wasting + time on loops/variables + +This patch is meant to reduce the complexity of fib_table_lookup by reducing +the number of variables to the bare minimum while still keeping the same if +not improved functionality versus the original. + +Most of this change was started off by the desire to rid the function of +chopped_off and current_prefix_length as they actually added very little to +the function since they only applied when computing the cindex. I was able +to replace them mostly with just a check for the prefix match. As long as +the prefix between the key and the node being tested was the same we know +we can search the tnode fully versus just testing cindex 0. + +The second portion of the change ended up being a massive reordering. +Originally the calls to check_leaf were up near the start of the loop, and +the backtracing and descending into lower levels of tnodes was later. This +didn't make much sense as the structure of the tree means the leaves are +always the last thing to be tested. As such I reordered things so that we +instead have a loop that will delve into the tree and only exit when we +have either found a leaf or we have exhausted the tree. The advantage of +rearranging things like this is that we can fully inline check_leaf since +there is now only one reference to it in the function. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -90,6 +90,9 @@ typedef unsigned int t_key; + #define IS_TNODE(n) ((n)->bits) + #define IS_LEAF(n) (!(n)->bits) + ++#define get_shift(_kv) (KEYLENGTH - (_kv)->pos - (_kv)->bits) ++#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> get_shift(_kv)) ++ + struct tnode { + t_key key; + unsigned char bits; /* 2log(KEYLENGTH) bits needed */ +@@ -1281,7 +1284,7 @@ static int check_leaf(struct fib_table * + continue; + fib_alias_accessed(fa); + err = fib_props[fa->fa_type].error; +- if (err) { ++ if (unlikely(err < 0)) { + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(t->stats->semantic_match_passed); + #endif +@@ -1303,7 +1306,7 @@ static int check_leaf(struct fib_table * + res->prefixlen = li->plen; + res->nh_sel = nhsel; + res->type = fa->fa_type; +- res->scope = fa->fa_info->fib_scope; ++ res->scope = fi->fib_scope; + res->fi = fi; + res->table = tb; + res->fa_head = &li->falh; +@@ -1321,23 +1324,24 @@ static int check_leaf(struct fib_table * + return 1; + } + ++static inline t_key prefix_mismatch(t_key key, struct tnode *n) ++{ ++ t_key prefix = n->key; ++ ++ return (key ^ prefix) & (prefix | -prefix); ++} ++ + int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, + struct fib_result *res, int fib_flags) + { +- struct trie *t = (struct trie *) tb->tb_data; ++ struct trie *t = (struct trie *)tb->tb_data; + #ifdef CONFIG_IP_FIB_TRIE_STATS + struct trie_use_stats __percpu *stats = t->stats; + #endif +- int ret; +- struct tnode *n; +- struct tnode *pn; +- unsigned int pos, bits; +- t_key key = ntohl(flp->daddr); +- unsigned int chopped_off; +- t_key cindex = 0; +- unsigned int current_prefix_length = KEYLENGTH; +- struct tnode *cn; +- t_key pref_mismatch; ++ const t_key key = ntohl(flp->daddr); ++ struct tnode *n, *pn; ++ t_key cindex; ++ int ret = 1; + + rcu_read_lock(); + +@@ -1349,170 +1353,102 @@ int fib_table_lookup(struct fib_table *t + this_cpu_inc(stats->gets); + #endif + +- /* Just a leaf? */ +- if (IS_LEAF(n)) { +- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); +- goto found; +- } +- + pn = n; +- chopped_off = 0; +- +- while (pn) { +- pos = pn->pos; +- bits = pn->bits; ++ cindex = 0; + +- if (!chopped_off) +- cindex = tkey_extract_bits(mask_pfx(key, current_prefix_length), +- pos, bits); +- +- n = tnode_get_child_rcu(pn, cindex); +- +- if (n == NULL) { +-#ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(stats->null_node_hit); +-#endif +- goto backtrace; +- } ++ /* Step 1: Travel to the longest prefix match in the trie */ ++ for (;;) { ++ unsigned long index = get_index(key, n); ++ ++ /* This bit of code is a bit tricky but it combines multiple ++ * checks into a single check. The prefix consists of the ++ * prefix plus zeros for the "bits" in the prefix. The index ++ * is the difference between the key and this value. From ++ * this we can actually derive several pieces of data. ++ * if !(index >> bits) ++ * we know the value is child index ++ * else ++ * we have a mismatch in skip bits and failed ++ */ ++ if (index >> n->bits) ++ break; + +- if (IS_LEAF(n)) { +- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); +- if (ret > 0) +- goto backtrace; ++ /* we have found a leaf. Prefixes have already been compared */ ++ if (IS_LEAF(n)) + goto found; +- } +- +- cn = n; + +- /* +- * It's a tnode, and we can do some extra checks here if we +- * like, to avoid descending into a dead-end branch. +- * This tnode is in the parent's child array at index +- * key[p_pos..p_pos+p_bits] but potentially with some bits +- * chopped off, so in reality the index may be just a +- * subprefix, padded with zero at the end. +- * We can also take a look at any skipped bits in this +- * tnode - everything up to p_pos is supposed to be ok, +- * and the non-chopped bits of the index (se previous +- * paragraph) are also guaranteed ok, but the rest is +- * considered unknown. +- * +- * The skipped bits are key[pos+bits..cn->pos]. +- */ +- +- /* If current_prefix_length < pos+bits, we are already doing +- * actual prefix matching, which means everything from +- * pos+(bits-chopped_off) onward must be zero along some +- * branch of this subtree - otherwise there is *no* valid +- * prefix present. Here we can only check the skipped +- * bits. Remember, since we have already indexed into the +- * parent's child array, we know that the bits we chopped of +- * *are* zero. ++ /* only record pn and cindex if we are going to be chopping ++ * bits later. Otherwise we are just wasting cycles. + */ +- +- /* NOTA BENE: Checking only skipped bits +- for the new node here */ +- +- if (current_prefix_length < pos+bits) { +- if (tkey_extract_bits(cn->key, current_prefix_length, +- cn->pos - current_prefix_length) +- || !(cn->child[0])) +- goto backtrace; ++ if (index) { ++ pn = n; ++ cindex = index; + } + +- /* +- * If chopped_off=0, the index is fully validated and we +- * only need to look at the skipped bits for this, the new, +- * tnode. What we actually want to do is to find out if +- * these skipped bits match our key perfectly, or if we will +- * have to count on finding a matching prefix further down, +- * because if we do, we would like to have some way of +- * verifying the existence of such a prefix at this point. +- */ +- +- /* The only thing we can do at this point is to verify that +- * any such matching prefix can indeed be a prefix to our +- * key, and if the bits in the node we are inspecting that +- * do not match our key are not ZERO, this cannot be true. +- * Thus, find out where there is a mismatch (before cn->pos) +- * and verify that all the mismatching bits are zero in the +- * new tnode's key. +- */ ++ n = rcu_dereference(n->child[index]); ++ if (unlikely(!n)) ++ goto backtrace; ++ } + +- /* +- * Note: We aren't very concerned about the piece of +- * the key that precede pn->pos+pn->bits, since these +- * have already been checked. The bits after cn->pos +- * aren't checked since these are by definition +- * "unknown" at this point. Thus, what we want to see +- * is if we are about to enter the "prefix matching" +- * state, and in that case verify that the skipped +- * bits that will prevail throughout this subtree are +- * zero, as they have to be if we are to find a +- * matching prefix. ++ /* Step 2: Sort out leaves and begin backtracing for longest prefix */ ++ for (;;) { ++ /* record the pointer where our next node pointer is stored */ ++ struct tnode __rcu **cptr = n->child; ++ ++ /* This test verifies that none of the bits that differ ++ * between the key and the prefix exist in the region of ++ * the lsb and higher in the prefix. + */ ++ if (unlikely(prefix_mismatch(key, n))) ++ goto backtrace; + +- pref_mismatch = mask_pfx(cn->key ^ key, cn->pos); ++ /* exit out and process leaf */ ++ if (unlikely(IS_LEAF(n))) ++ break; + +- /* +- * In short: If skipped bits in this node do not match +- * the search key, enter the "prefix matching" +- * state.directly. ++ /* Don't bother recording parent info. Since we are in ++ * prefix match mode we will have to come back to wherever ++ * we started this traversal anyway + */ +- if (pref_mismatch) { +- /* fls(x) = __fls(x) + 1 */ +- int mp = KEYLENGTH - __fls(pref_mismatch) - 1; +- +- if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) +- goto backtrace; +- +- if (current_prefix_length >= cn->pos) +- current_prefix_length = mp; +- } +- +- pn = n; /* Descend */ +- chopped_off = 0; +- continue; + ++ while ((n = rcu_dereference(*cptr)) == NULL) { + backtrace: +- chopped_off++; +- +- /* As zero don't change the child key (cindex) */ +- while ((chopped_off <= pn->bits) +- && !(cindex & (1<<(chopped_off-1)))) +- chopped_off++; +- +- /* Decrease current_... with bits chopped off */ +- if (current_prefix_length > pn->pos + pn->bits - chopped_off) +- current_prefix_length = pn->pos + pn->bits +- - chopped_off; +- +- /* +- * Either we do the actual chop off according or if we have +- * chopped off all bits in this tnode walk up to our parent. +- */ +- +- if (chopped_off <= pn->bits) { +- cindex &= ~(1 << (chopped_off-1)); +- } else { +- struct tnode *parent = node_parent_rcu(pn); +- if (!parent) +- goto failed; +- +- /* Get Child's index */ +- cindex = tkey_extract_bits(pn->key, parent->pos, parent->bits); +- pn = parent; +- chopped_off = 0; +- + #ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(stats->backtrack); ++ if (!n) ++ this_cpu_inc(stats->null_node_hit); + #endif +- goto backtrace; ++ /* If we are at cindex 0 there are no more bits for ++ * us to strip at this level so we must ascend back ++ * up one level to see if there are any more bits to ++ * be stripped there. ++ */ ++ while (!cindex) { ++ t_key pkey = pn->key; ++ ++ pn = node_parent_rcu(pn); ++ if (unlikely(!pn)) ++ goto failed; ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ this_cpu_inc(stats->backtrack); ++#endif ++ /* Get Child's index */ ++ cindex = get_index(pkey, pn); ++ } ++ ++ /* strip the least significant bit from the cindex */ ++ cindex &= cindex - 1; ++ ++ /* grab pointer for next child node */ ++ cptr = &pn->child[cindex]; + } + } +-failed: +- ret = 1; ++ + found: ++ /* Step 3: Process the leaf, if that fails fall back to backtracing */ ++ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); ++ if (unlikely(ret > 0)) ++ goto backtrace; ++failed: + rcu_read_unlock(); + return ret; + } diff --git a/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch b/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch new file mode 100644 index 000000000..0193f758f --- /dev/null +++ b/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch @@ -0,0 +1,64 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:00 -0800 +Subject: [PATCH] fib_trie: Optimize fib_find_node + +This patch makes use of the same features I made use of for +fib_table_lookup to streamline fib_find_node. The resultant code should be +smaller and run faster than the original. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -892,28 +892,34 @@ static void insert_leaf_info(struct hlis + } + + /* rcu_read_lock needs to be hold by caller from readside */ +- + static struct tnode *fib_find_node(struct trie *t, u32 key) + { + struct tnode *n = rcu_dereference_rtnl(t->trie); +- int pos = 0; + +- while (n && IS_TNODE(n)) { +- if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { +- pos = n->pos + n->bits; +- n = tnode_get_child_rcu(n, +- tkey_extract_bits(key, +- n->pos, +- n->bits)); +- } else ++ while (n) { ++ unsigned long index = get_index(key, n); ++ ++ /* This bit of code is a bit tricky but it combines multiple ++ * checks into a single check. The prefix consists of the ++ * prefix plus zeros for the bits in the cindex. The index ++ * is the difference between the key and this value. From ++ * this we can actually derive several pieces of data. ++ * if !(index >> bits) ++ * we know the value is cindex ++ * else ++ * we have a mismatch in skip bits and failed ++ */ ++ if (index >> n->bits) ++ return NULL; ++ ++ /* we have found a leaf. Prefixes have already been compared */ ++ if (IS_LEAF(n)) + break; +- } +- /* Case we have found a leaf. Compare prefixes */ + +- if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) +- return n; ++ n = rcu_dereference_rtnl(n->child[index]); ++ } + +- return NULL; ++ return n; + } + + static void trie_rebalance(struct trie *t, struct tnode *tn) diff --git a/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch b/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch new file mode 100644 index 000000000..b328d2c5d --- /dev/null +++ b/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch @@ -0,0 +1,276 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:06 -0800 +Subject: [PATCH] fib_trie: Optimize fib_table_insert + +This patch updates the fib_table_insert function to take advantage of the +changes made to improve the performance of fib_table_lookup. As a result +the code should be smaller and run faster then the original. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -222,31 +222,6 @@ static inline t_key tkey_extract_bits(t_ + return 0; + } + +-static inline int tkey_equals(t_key a, t_key b) +-{ +- return a == b; +-} +- +-static inline int tkey_sub_equals(t_key a, int offset, int bits, t_key b) +-{ +- if (bits == 0 || offset >= KEYLENGTH) +- return 1; +- bits = bits > KEYLENGTH ? KEYLENGTH : bits; +- return ((a ^ b) << offset) >> (KEYLENGTH - bits) == 0; +-} +- +-static inline int tkey_mismatch(t_key a, int offset, t_key b) +-{ +- t_key diff = a ^ b; +- int i = offset; +- +- if (!diff) +- return 0; +- while ((diff << i) >> (KEYLENGTH-1) == 0) +- i++; +- return i; +-} +- + /* + To understand this stuff, an understanding of keys and all their bits is + necessary. Every node in the trie has a key associated with it, but not +@@ -485,6 +460,15 @@ static void tnode_put_child_reorg(struct + rcu_assign_pointer(tn->child[i], n); + } + ++static void put_child_root(struct tnode *tp, struct trie *t, ++ t_key key, struct tnode *n) ++{ ++ if (tp) ++ put_child(tp, get_index(key, tp), n); ++ else ++ rcu_assign_pointer(t->trie, n); ++} ++ + #define MAX_WORK 10 + static struct tnode *resize(struct trie *t, struct tnode *tn) + { +@@ -959,138 +943,100 @@ static void trie_rebalance(struct trie * + + static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) + { +- int pos, newpos; +- struct tnode *tp = NULL, *tn = NULL; +- struct tnode *n; +- struct tnode *l; +- int missbit; + struct list_head *fa_head = NULL; ++ struct tnode *l, *n, *tp = NULL; + struct leaf_info *li; +- t_key cindex; + +- pos = 0; ++ li = leaf_info_new(plen); ++ if (!li) ++ return NULL; ++ fa_head = &li->falh; ++ + n = rtnl_dereference(t->trie); + + /* If we point to NULL, stop. Either the tree is empty and we should + * just put a new leaf in if, or we have reached an empty child slot, + * and we should just put our new leaf in that. +- * If we point to a T_TNODE, check if it matches our key. Note that +- * a T_TNODE might be skipping any number of bits - its 'pos' need +- * not be the parent's 'pos'+'bits'! +- * +- * If it does match the current key, get pos/bits from it, extract +- * the index from our key, push the T_TNODE and walk the tree. +- * +- * If it doesn't, we have to replace it with a new T_TNODE. + * +- * If we point to a T_LEAF, it might or might not have the same key +- * as we do. If it does, just change the value, update the T_LEAF's +- * value, and return it. +- * If it doesn't, we need to replace it with a T_TNODE. ++ * If we hit a node with a key that does't match then we should stop ++ * and create a new tnode to replace that node and insert ourselves ++ * and the other node into the new tnode. + */ ++ while (n) { ++ unsigned long index = get_index(key, n); + +- while (n && IS_TNODE(n)) { +- if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { +- tp = n; +- pos = n->pos + n->bits; +- n = tnode_get_child(n, +- tkey_extract_bits(key, +- n->pos, +- n->bits)); +- +- BUG_ON(n && node_parent(n) != tp); +- } else ++ /* This bit of code is a bit tricky but it combines multiple ++ * checks into a single check. The prefix consists of the ++ * prefix plus zeros for the "bits" in the prefix. The index ++ * is the difference between the key and this value. From ++ * this we can actually derive several pieces of data. ++ * if !(index >> bits) ++ * we know the value is child index ++ * else ++ * we have a mismatch in skip bits and failed ++ */ ++ if (index >> n->bits) + break; +- } +- +- /* +- * n ----> NULL, LEAF or TNODE +- * +- * tp is n's (parent) ----> NULL or TNODE +- */ + +- BUG_ON(tp && IS_LEAF(tp)); +- +- /* Case 1: n is a leaf. Compare prefixes */ +- +- if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) { +- li = leaf_info_new(plen); +- +- if (!li) +- return NULL; ++ /* we have found a leaf. Prefixes have already been compared */ ++ if (IS_LEAF(n)) { ++ /* Case 1: n is a leaf, and prefixes match*/ ++ insert_leaf_info(&n->list, li); ++ return fa_head; ++ } + +- fa_head = &li->falh; +- insert_leaf_info(&n->list, li); +- goto done; ++ tp = n; ++ n = rcu_dereference_rtnl(n->child[index]); + } +- l = leaf_new(key); +- +- if (!l) +- return NULL; + +- li = leaf_info_new(plen); +- +- if (!li) { +- node_free(l); ++ l = leaf_new(key); ++ if (!l) { ++ free_leaf_info(li); + return NULL; + } + +- fa_head = &li->falh; + insert_leaf_info(&l->list, li); + +- if (t->trie && n == NULL) { +- /* Case 2: n is NULL, and will just insert a new leaf */ +- +- node_set_parent(l, tp); +- +- cindex = tkey_extract_bits(key, tp->pos, tp->bits); +- put_child(tp, cindex, l); +- } else { +- /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ +- /* +- * Add a new tnode here +- * first tnode need some special handling +- */ ++ /* Case 2: n is a LEAF or a TNODE and the key doesn't match. ++ * ++ * Add a new tnode here ++ * first tnode need some special handling ++ * leaves us in position for handling as case 3 ++ */ ++ if (n) { ++ struct tnode *tn; ++ int newpos; + +- if (n) { +- pos = tp ? tp->pos+tp->bits : 0; +- newpos = tkey_mismatch(key, pos, n->key); +- tn = tnode_new(n->key, newpos, 1); +- } else { +- newpos = 0; +- tn = tnode_new(key, newpos, 1); /* First tnode */ +- } ++ newpos = KEYLENGTH - __fls(n->key ^ key) - 1; + ++ tn = tnode_new(key, newpos, 1); + if (!tn) { + free_leaf_info(li); + node_free(l); + return NULL; + } + +- node_set_parent(tn, tp); +- +- missbit = tkey_extract_bits(key, newpos, 1); +- put_child(tn, missbit, l); +- put_child(tn, 1-missbit, n); +- +- if (tp) { +- cindex = tkey_extract_bits(key, tp->pos, tp->bits); +- put_child(tp, cindex, tn); +- } else { +- rcu_assign_pointer(t->trie, tn); +- } ++ /* initialize routes out of node */ ++ NODE_INIT_PARENT(tn, tp); ++ put_child(tn, get_index(key, tn) ^ 1, n); ++ ++ /* start adding routes into the node */ ++ put_child_root(tp, t, key, tn); ++ node_set_parent(n, tn); + ++ /* parent now has a NULL spot where the leaf can go */ + tp = tn; + } + +- if (tp && tp->pos + tp->bits > 32) +- pr_warn("fib_trie tp=%p pos=%d, bits=%d, key=%0x plen=%d\n", +- tp, tp->pos, tp->bits, key, plen); +- +- /* Rebalance the trie */ ++ /* Case 3: n is NULL, and will just insert a new leaf */ ++ if (tp) { ++ NODE_INIT_PARENT(l, tp); ++ put_child(tp, get_index(key, tp), l); ++ trie_rebalance(t, tp); ++ } else { ++ rcu_assign_pointer(t->trie, l); ++ } + +- trie_rebalance(t, tp); +-done: + return fa_head; + } + +@@ -1470,11 +1416,11 @@ static void trie_leaf_remove(struct trie + pr_debug("entering trie_leaf_remove(%p)\n", l); + + if (tp) { +- t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits); +- put_child(tp, cindex, NULL); ++ put_child(tp, get_index(l->key, tp), NULL); + trie_rebalance(t, tp); +- } else ++ } else { + RCU_INIT_POINTER(t->trie, NULL); ++ } + + node_free(l); + } diff --git a/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch b/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch new file mode 100644 index 000000000..a0d34762b --- /dev/null +++ b/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch @@ -0,0 +1,346 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:12 -0800 +Subject: [PATCH] fib_trie: Update meaning of pos to represent unchecked + bits + +This change moves the pos value to the other side of the "bits" field. By +doing this it actually simplifies a significant amount of code in the trie. + +For example when halving a tree we know that the bit lost exists at +oldnode->pos, and if we inflate the tree the new bit being add is at +tn->pos. Previously to find those bits you would have to subtract pos and +bits from the keylength or start with a value of (1 << 31) and then shift +that. + +There are a number of spots throughout the code that benefit from this. In +the case of the hot-path searches the main advantage is that we can drop 2 +or more operations from the search path as we no longer need to compute the +value for the index to be shifted by and can instead just use the raw pos +value. + +In addition the tkey_extract_bits is now defunct and can be replaced by +get_index since the two operations were doing the same thing, but now +get_index does it much more quickly as it is only an xor and shift versus a +pair of shifts and a subtraction. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -90,8 +90,7 @@ typedef unsigned int t_key; + #define IS_TNODE(n) ((n)->bits) + #define IS_LEAF(n) (!(n)->bits) + +-#define get_shift(_kv) (KEYLENGTH - (_kv)->pos - (_kv)->bits) +-#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> get_shift(_kv)) ++#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> (_kv)->pos) + + struct tnode { + t_key key; +@@ -209,81 +208,64 @@ static inline struct tnode *tnode_get_ch + return rcu_dereference_rtnl(tn->child[i]); + } + +-static inline t_key mask_pfx(t_key k, unsigned int l) +-{ +- return (l == 0) ? 0 : k >> (KEYLENGTH-l) << (KEYLENGTH-l); +-} +- +-static inline t_key tkey_extract_bits(t_key a, unsigned int offset, unsigned int bits) +-{ +- if (offset < KEYLENGTH) +- return ((t_key)(a << offset)) >> (KEYLENGTH - bits); +- else +- return 0; +-} +- +-/* +- To understand this stuff, an understanding of keys and all their bits is +- necessary. Every node in the trie has a key associated with it, but not +- all of the bits in that key are significant. +- +- Consider a node 'n' and its parent 'tp'. +- +- If n is a leaf, every bit in its key is significant. Its presence is +- necessitated by path compression, since during a tree traversal (when +- searching for a leaf - unless we are doing an insertion) we will completely +- ignore all skipped bits we encounter. Thus we need to verify, at the end of +- a potentially successful search, that we have indeed been walking the +- correct key path. +- +- Note that we can never "miss" the correct key in the tree if present by +- following the wrong path. Path compression ensures that segments of the key +- that are the same for all keys with a given prefix are skipped, but the +- skipped part *is* identical for each node in the subtrie below the skipped +- bit! trie_insert() in this implementation takes care of that - note the +- call to tkey_sub_equals() in trie_insert(). +- +- if n is an internal node - a 'tnode' here, the various parts of its key +- have many different meanings. +- +- Example: +- _________________________________________________________________ +- | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | +- ----------------------------------------------------------------- +- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +- +- _________________________________________________________________ +- | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | +- ----------------------------------------------------------------- +- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 +- +- tp->pos = 7 +- tp->bits = 3 +- n->pos = 15 +- n->bits = 4 +- +- First, let's just ignore the bits that come before the parent tp, that is +- the bits from 0 to (tp->pos-1). They are *known* but at this point we do +- not use them for anything. +- +- The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the +- index into the parent's child array. That is, they will be used to find +- 'n' among tp's children. +- +- The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits +- for the node n. +- +- All the bits we have seen so far are significant to the node n. The rest +- of the bits are really not needed or indeed known in n->key. +- +- The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into +- n's child array, and will of course be different for each child. +- +- +- The rest of the bits, from (n->pos + n->bits) onward, are completely unknown +- at this point. +- +-*/ ++/* To understand this stuff, an understanding of keys and all their bits is ++ * necessary. Every node in the trie has a key associated with it, but not ++ * all of the bits in that key are significant. ++ * ++ * Consider a node 'n' and its parent 'tp'. ++ * ++ * If n is a leaf, every bit in its key is significant. Its presence is ++ * necessitated by path compression, since during a tree traversal (when ++ * searching for a leaf - unless we are doing an insertion) we will completely ++ * ignore all skipped bits we encounter. Thus we need to verify, at the end of ++ * a potentially successful search, that we have indeed been walking the ++ * correct key path. ++ * ++ * Note that we can never "miss" the correct key in the tree if present by ++ * following the wrong path. Path compression ensures that segments of the key ++ * that are the same for all keys with a given prefix are skipped, but the ++ * skipped part *is* identical for each node in the subtrie below the skipped ++ * bit! trie_insert() in this implementation takes care of that. ++ * ++ * if n is an internal node - a 'tnode' here, the various parts of its key ++ * have many different meanings. ++ * ++ * Example: ++ * _________________________________________________________________ ++ * | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | ++ * ----------------------------------------------------------------- ++ * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 ++ * ++ * _________________________________________________________________ ++ * | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | ++ * ----------------------------------------------------------------- ++ * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ++ * ++ * tp->pos = 22 ++ * tp->bits = 3 ++ * n->pos = 13 ++ * n->bits = 4 ++ * ++ * First, let's just ignore the bits that come before the parent tp, that is ++ * the bits from (tp->pos + tp->bits) to 31. They are *known* but at this ++ * point we do not use them for anything. ++ * ++ * The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the ++ * index into the parent's child array. That is, they will be used to find ++ * 'n' among tp's children. ++ * ++ * The bits from (n->pos + n->bits) to (tn->pos - 1) - "S" - are skipped bits ++ * for the node n. ++ * ++ * All the bits we have seen so far are significant to the node n. The rest ++ * of the bits are really not needed or indeed known in n->key. ++ * ++ * The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into ++ * n's child array, and will of course be different for each child. ++ * ++ * The rest of the bits, from 0 to (n->pos + n->bits), are completely unknown ++ * at this point. ++ */ + + static const int halve_threshold = 25; + static const int inflate_threshold = 50; +@@ -367,7 +349,7 @@ static struct tnode *leaf_new(t_key key) + * as the nodes are searched + */ + l->key = key; +- l->pos = KEYLENGTH; ++ l->pos = 0; + /* set bits to 0 indicating we are not a tnode */ + l->bits = 0; + +@@ -400,7 +382,7 @@ static struct tnode *tnode_new(t_key key + tn->parent = NULL; + tn->pos = pos; + tn->bits = bits; +- tn->key = mask_pfx(key, pos); ++ tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; + tn->full_children = 0; + tn->empty_children = 1<pos == (tn->pos + tn->bits)); ++ return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); + } + + static inline void put_child(struct tnode *tn, int i, +@@ -641,11 +621,12 @@ static struct tnode *inflate(struct trie + { + int olen = tnode_child_length(oldtnode); + struct tnode *tn; ++ t_key m; + int i; + + pr_debug("In inflate\n"); + +- tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1); ++ tn = tnode_new(oldtnode->key, oldtnode->pos - 1, oldtnode->bits + 1); + + if (!tn) + return ERR_PTR(-ENOMEM); +@@ -656,21 +637,18 @@ static struct tnode *inflate(struct trie + * fails. In case of failure we return the oldnode and inflate + * of tnode is ignored. + */ ++ for (i = 0, m = 1u << tn->pos; i < olen; i++) { ++ struct tnode *inode = tnode_get_child(oldtnode, i); + +- for (i = 0; i < olen; i++) { +- struct tnode *inode; +- +- inode = tnode_get_child(oldtnode, i); +- if (tnode_full(oldtnode, inode) && inode->bits > 1) { ++ if (tnode_full(oldtnode, inode) && (inode->bits > 1)) { + struct tnode *left, *right; +- t_key m = ~0U << (KEYLENGTH - 1) >> inode->pos; + +- left = tnode_new(inode->key&(~m), inode->pos + 1, ++ left = tnode_new(inode->key & ~m, inode->pos, + inode->bits - 1); + if (!left) + goto nomem; + +- right = tnode_new(inode->key|m, inode->pos + 1, ++ right = tnode_new(inode->key | m, inode->pos, + inode->bits - 1); + + if (!right) { +@@ -694,9 +672,7 @@ static struct tnode *inflate(struct trie + + /* A leaf or an internal node with skipped bits */ + if (!tnode_full(oldtnode, inode)) { +- put_child(tn, +- tkey_extract_bits(inode->key, tn->pos, tn->bits), +- inode); ++ put_child(tn, get_index(inode->key, tn), inode); + continue; + } + +@@ -767,7 +743,7 @@ static struct tnode *halve(struct trie * + + pr_debug("In halve\n"); + +- tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1); ++ tn = tnode_new(oldtnode->key, oldtnode->pos + 1, oldtnode->bits - 1); + + if (!tn) + return ERR_PTR(-ENOMEM); +@@ -787,7 +763,7 @@ static struct tnode *halve(struct trie * + if (left && right) { + struct tnode *newn; + +- newn = tnode_new(left->key, tn->pos + tn->bits, 1); ++ newn = tnode_new(left->key, oldtnode->pos, 1); + + if (!newn) + goto nomem; +@@ -915,7 +891,7 @@ static void trie_rebalance(struct trie * + key = tn->key; + + while (tn != NULL && (tp = node_parent(tn)) != NULL) { +- cindex = tkey_extract_bits(key, tp->pos, tp->bits); ++ cindex = get_index(key, tp); + wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); + tn = resize(t, tn); + +@@ -1005,11 +981,8 @@ static struct list_head *fib_insert_node + */ + if (n) { + struct tnode *tn; +- int newpos; +- +- newpos = KEYLENGTH - __fls(n->key ^ key) - 1; + +- tn = tnode_new(key, newpos, 1); ++ tn = tnode_new(key, __fls(key ^ n->key), 1); + if (!tn) { + free_leaf_info(li); + node_free(l); +@@ -1559,12 +1532,7 @@ static int trie_flush_leaf(struct tnode + static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) + { + do { +- t_key idx; +- +- if (c) +- idx = tkey_extract_bits(c->key, p->pos, p->bits) + 1; +- else +- idx = 0; ++ t_key idx = c ? idx = get_index(c->key, p) + 1 : 0; + + while (idx < 1u << p->bits) { + c = tnode_get_child_rcu(p, idx++); +@@ -1851,7 +1819,7 @@ rescan: + /* Current node exhausted, pop back up */ + p = node_parent_rcu(tn); + if (p) { +- cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; ++ cindex = get_index(tn->key, p) + 1; + tn = p; + --iter->depth; + goto rescan; +@@ -2186,10 +2154,10 @@ static int fib_trie_seq_show(struct seq_ + if (IS_TNODE(n)) { + __be32 prf = htonl(n->key); + +- seq_indent(seq, iter->depth - 1); +- seq_printf(seq, " +-- %pI4/%d %d %d %d\n", +- &prf, n->pos, n->bits, n->full_children, +- n->empty_children); ++ seq_indent(seq, iter->depth-1); ++ seq_printf(seq, " +-- %pI4/%zu %u %u %u\n", ++ &prf, KEYLENGTH - n->pos - n->bits, n->bits, ++ n->full_children, n->empty_children); + } else { + struct leaf_info *li; + __be32 val = htonl(n->key); diff --git a/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch b/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch new file mode 100644 index 000000000..487a25f0d --- /dev/null +++ b/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch @@ -0,0 +1,186 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:18 -0800 +Subject: [PATCH] fib_trie: Use unsigned long for anything dealing with a + shift by bits + +This change makes it so that anything that can be shifted by, or compared +to a value shifted by bits is updated to be an unsigned long. This is +mostly a precaution against an insanely huge address space that somehow +starts coming close to the 2^32 root node size which would require +something like 1.5 billion addresses. + +I chose unsigned long instead of unsigned long long since I do not believe +it is possible to allocate a 32 bit tnode on a 32 bit system as the memory +consumed would be 16GB + 28B which exceeds the addressible space for any +one process. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -146,8 +146,8 @@ struct trie { + #endif + }; + +-static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, +- int wasfull); ++static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, ++ struct tnode *n, int wasfull); + static struct tnode *resize(struct trie *t, struct tnode *tn); + static struct tnode *inflate(struct trie *t, struct tnode *tn); + static struct tnode *halve(struct trie *t, struct tnode *tn); +@@ -183,25 +183,23 @@ static inline void node_set_parent(struc + /* This provides us with the number of children in this node, in the case of a + * leaf this will return 0 meaning none of the children are accessible. + */ +-static inline int tnode_child_length(const struct tnode *tn) ++static inline unsigned long tnode_child_length(const struct tnode *tn) + { + return (1ul << tn->bits) & ~(1ul); + } + +-/* +- * caller must hold RTNL +- */ +-static inline struct tnode *tnode_get_child(const struct tnode *tn, unsigned int i) ++/* caller must hold RTNL */ ++static inline struct tnode *tnode_get_child(const struct tnode *tn, ++ unsigned long i) + { + BUG_ON(i >= tnode_child_length(tn)); + + return rtnl_dereference(tn->child[i]); + } + +-/* +- * caller must hold RCU read lock or RTNL +- */ +-static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) ++/* caller must hold RCU read lock or RTNL */ ++static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, ++ unsigned long i) + { + BUG_ON(i >= tnode_child_length(tn)); + +@@ -400,7 +398,7 @@ static inline int tnode_full(const struc + return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); + } + +-static inline void put_child(struct tnode *tn, int i, ++static inline void put_child(struct tnode *tn, unsigned long i, + struct tnode *n) + { + tnode_put_child_reorg(tn, i, n, -1); +@@ -411,13 +409,13 @@ static inline void put_child(struct tnod + * Update the value of full_children and empty_children. + */ + +-static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, +- int wasfull) ++static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, ++ struct tnode *n, int wasfull) + { + struct tnode *chi = rtnl_dereference(tn->child[i]); + int isfull; + +- BUG_ON(i >= 1<bits); ++ BUG_ON(i >= tnode_child_length(tn)); + + /* update emptyChildren */ + if (n == NULL && chi != NULL) +@@ -607,10 +605,10 @@ no_children: + static void tnode_clean_free(struct tnode *tn) + { + struct tnode *tofree; +- int i; ++ unsigned long i; + + for (i = 0; i < tnode_child_length(tn); i++) { +- tofree = rtnl_dereference(tn->child[i]); ++ tofree = tnode_get_child(tn, i); + if (tofree) + node_free(tofree); + } +@@ -619,10 +617,10 @@ static void tnode_clean_free(struct tnod + + static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) + { +- int olen = tnode_child_length(oldtnode); ++ unsigned long olen = tnode_child_length(oldtnode); + struct tnode *tn; ++ unsigned long i; + t_key m; +- int i; + + pr_debug("In inflate\n"); + +@@ -664,7 +662,7 @@ static struct tnode *inflate(struct trie + for (i = 0; i < olen; i++) { + struct tnode *inode = tnode_get_child(oldtnode, i); + struct tnode *left, *right; +- int size, j; ++ unsigned long size, j; + + /* An empty child */ + if (inode == NULL) +@@ -737,7 +735,7 @@ nomem: + + static struct tnode *halve(struct trie *t, struct tnode *oldtnode) + { +- int olen = tnode_child_length(oldtnode); ++ unsigned long olen = tnode_child_length(oldtnode); + struct tnode *tn, *left, *right; + int i; + +@@ -1532,9 +1530,9 @@ static int trie_flush_leaf(struct tnode + static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) + { + do { +- t_key idx = c ? idx = get_index(c->key, p) + 1 : 0; ++ unsigned long idx = c ? idx = get_index(c->key, p) + 1 : 0; + +- while (idx < 1u << p->bits) { ++ while (idx < tnode_child_length(p)) { + c = tnode_get_child_rcu(p, idx++); + if (!c) + continue; +@@ -1786,8 +1784,8 @@ struct fib_trie_iter { + + static struct tnode *fib_trie_get_next(struct fib_trie_iter *iter) + { ++ unsigned long cindex = iter->index; + struct tnode *tn = iter->tnode; +- unsigned int cindex = iter->index; + struct tnode *p; + + /* A single entry routing table */ +@@ -1797,7 +1795,7 @@ static struct tnode *fib_trie_get_next(s + pr_debug("get_next iter={node=%p index=%d depth=%d}\n", + iter->tnode, iter->index, iter->depth); + rescan: +- while (cindex < (1<bits)) { ++ while (cindex < tnode_child_length(tn)) { + struct tnode *n = tnode_get_child_rcu(tn, cindex); + + if (n) { +@@ -1874,15 +1872,16 @@ static void trie_collect_stats(struct tr + hlist_for_each_entry_rcu(li, &n->list, hlist) + ++s->prefixes; + } else { +- int i; ++ unsigned long i; + + s->tnodes++; + if (n->bits < MAX_STAT_DEPTH) + s->nodesizes[n->bits]++; + +- for (i = 0; i < tnode_child_length(n); i++) ++ for (i = 0; i < tnode_child_length(n); i++) { + if (!rcu_access_pointer(n->child[i])) + s->nullpointers++; ++ } + } + } + rcu_read_unlock(); diff --git a/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch b/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch new file mode 100644 index 000000000..29bec8387 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch @@ -0,0 +1,403 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:24 -0800 +Subject: [PATCH] fib_trie: Push rcu_read_lock/unlock to callers + +This change is to start cleaning up some of the rcu_read_lock/unlock +handling. I realized while reviewing the code there are several spots that +I don't believe are being handled correctly or are masking warnings by +locally calling rcu_read_lock/unlock instead of calling them at the correct +level. + +A common example is a call to fib_get_table followed by fib_table_lookup. +The rcu_read_lock/unlock ought to wrap both but there are several spots where +they were not wrapped. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/include/net/ip_fib.h ++++ b/include/net/ip_fib.h +@@ -222,16 +222,19 @@ static inline struct fib_table *fib_new_ + static inline int fib_lookup(struct net *net, const struct flowi4 *flp, + struct fib_result *res) + { +- struct fib_table *table; ++ int err = -ENETUNREACH; + +- table = fib_get_table(net, RT_TABLE_LOCAL); +- if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) +- return 0; +- +- table = fib_get_table(net, RT_TABLE_MAIN); +- if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) +- return 0; +- return -ENETUNREACH; ++ rcu_read_lock(); ++ ++ if (!fib_table_lookup(fib_get_table(net, RT_TABLE_LOCAL), flp, res, ++ FIB_LOOKUP_NOREF) || ++ !fib_table_lookup(fib_get_table(net, RT_TABLE_MAIN), flp, res, ++ FIB_LOOKUP_NOREF)) ++ err = 0; ++ ++ rcu_read_unlock(); ++ ++ return err; + } + + #else /* CONFIG_IP_MULTIPLE_TABLES */ +@@ -247,20 +250,25 @@ static inline int fib_lookup(struct net + struct fib_result *res) + { + if (!net->ipv4.fib_has_custom_rules) { ++ int err = -ENETUNREACH; ++ ++ rcu_read_lock(); ++ + res->tclassid = 0; +- if (net->ipv4.fib_local && +- !fib_table_lookup(net->ipv4.fib_local, flp, res, +- FIB_LOOKUP_NOREF)) +- return 0; +- if (net->ipv4.fib_main && +- !fib_table_lookup(net->ipv4.fib_main, flp, res, +- FIB_LOOKUP_NOREF)) +- return 0; +- if (net->ipv4.fib_default && +- !fib_table_lookup(net->ipv4.fib_default, flp, res, +- FIB_LOOKUP_NOREF)) +- return 0; +- return -ENETUNREACH; ++ if ((net->ipv4.fib_local && ++ !fib_table_lookup(net->ipv4.fib_local, flp, res, ++ FIB_LOOKUP_NOREF)) || ++ (net->ipv4.fib_main && ++ !fib_table_lookup(net->ipv4.fib_main, flp, res, ++ FIB_LOOKUP_NOREF)) || ++ (net->ipv4.fib_default && ++ !fib_table_lookup(net->ipv4.fib_default, flp, res, ++ FIB_LOOKUP_NOREF))) ++ err = 0; ++ ++ rcu_read_unlock(); ++ ++ return err; + } + return __fib_lookup(net, flp, res); + } +--- a/net/ipv4/fib_frontend.c ++++ b/net/ipv4/fib_frontend.c +@@ -109,6 +109,7 @@ struct fib_table *fib_new_table(struct n + return tb; + } + ++/* caller must hold either rtnl or rcu read lock */ + struct fib_table *fib_get_table(struct net *net, u32 id) + { + struct fib_table *tb; +@@ -119,15 +120,11 @@ struct fib_table *fib_get_table(struct n + id = RT_TABLE_MAIN; + h = id & (FIB_TABLE_HASHSZ - 1); + +- rcu_read_lock(); + head = &net->ipv4.fib_table_hash[h]; + hlist_for_each_entry_rcu(tb, head, tb_hlist) { +- if (tb->tb_id == id) { +- rcu_read_unlock(); ++ if (tb->tb_id == id) + return tb; +- } + } +- rcu_read_unlock(); + return NULL; + } + #endif /* CONFIG_IP_MULTIPLE_TABLES */ +@@ -167,16 +164,18 @@ static inline unsigned int __inet_dev_ad + if (ipv4_is_multicast(addr)) + return RTN_MULTICAST; + ++ rcu_read_lock(); ++ + local_table = fib_get_table(net, RT_TABLE_LOCAL); + if (local_table) { + ret = RTN_UNICAST; +- rcu_read_lock(); + if (!fib_table_lookup(local_table, &fl4, &res, FIB_LOOKUP_NOREF)) { + if (!dev || dev == res.fi->fib_dev) + ret = res.type; + } +- rcu_read_unlock(); + } ++ ++ rcu_read_unlock(); + return ret; + } + +@@ -923,7 +922,7 @@ no_promotions: + #undef BRD1_OK + } + +-static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb) ++static void nl_fib_lookup(struct net *net, struct fib_result_nl *frn) + { + + struct fib_result res; +@@ -933,6 +932,11 @@ static void nl_fib_lookup(struct fib_res + .flowi4_tos = frn->fl_tos, + .flowi4_scope = frn->fl_scope, + }; ++ struct fib_table *tb; ++ ++ rcu_read_lock(); ++ ++ tb = fib_get_table(net, frn->tb_id_in); + + frn->err = -ENOENT; + if (tb) { +@@ -949,6 +953,8 @@ static void nl_fib_lookup(struct fib_res + } + local_bh_enable(); + } ++ ++ rcu_read_unlock(); + } + + static void nl_fib_input(struct sk_buff *skb) +@@ -956,7 +962,6 @@ static void nl_fib_input(struct sk_buff + struct net *net; + struct fib_result_nl *frn; + struct nlmsghdr *nlh; +- struct fib_table *tb; + u32 portid; + + net = sock_net(skb->sk); +@@ -972,9 +977,7 @@ static void nl_fib_input(struct sk_buff + nlh = nlmsg_hdr(skb); + + frn = (struct fib_result_nl *) nlmsg_data(nlh); +- tb = fib_get_table(net, frn->tb_id_in); +- +- nl_fib_lookup(frn, tb); ++ nl_fib_lookup(net, frn); + + portid = NETLINK_CB(skb).portid; /* netlink portid */ + NETLINK_CB(skb).portid = 0; /* from kernel */ +--- a/net/ipv4/fib_rules.c ++++ b/net/ipv4/fib_rules.c +@@ -81,27 +81,25 @@ static int fib4_rule_action(struct fib_r + break; + + case FR_ACT_UNREACHABLE: +- err = -ENETUNREACH; +- goto errout; ++ return -ENETUNREACH; + + case FR_ACT_PROHIBIT: +- err = -EACCES; +- goto errout; ++ return -EACCES; + + case FR_ACT_BLACKHOLE: + default: +- err = -EINVAL; +- goto errout; ++ return -EINVAL; + } + ++ rcu_read_lock(); ++ + tbl = fib_get_table(rule->fr_net, rule->table); +- if (!tbl) +- goto errout; ++ if (tbl) ++ err = fib_table_lookup(tbl, &flp->u.ip4, ++ (struct fib_result *)arg->result, ++ arg->flags); + +- err = fib_table_lookup(tbl, &flp->u.ip4, (struct fib_result *) arg->result, arg->flags); +- if (err > 0) +- err = -EAGAIN; +-errout: ++ rcu_read_unlock(); + return err; + } + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -1181,72 +1181,6 @@ err: + return err; + } + +-/* should be called with rcu_read_lock */ +-static int check_leaf(struct fib_table *tb, struct trie *t, struct tnode *l, +- t_key key, const struct flowi4 *flp, +- struct fib_result *res, int fib_flags) +-{ +- struct leaf_info *li; +- struct hlist_head *hhead = &l->list; +- +- hlist_for_each_entry_rcu(li, hhead, hlist) { +- struct fib_alias *fa; +- +- if (l->key != (key & li->mask_plen)) +- continue; +- +- list_for_each_entry_rcu(fa, &li->falh, fa_list) { +- struct fib_info *fi = fa->fa_info; +- int nhsel, err; +- +- if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) +- continue; +- if (fi->fib_dead) +- continue; +- if (fa->fa_info->fib_scope < flp->flowi4_scope) +- continue; +- fib_alias_accessed(fa); +- err = fib_props[fa->fa_type].error; +- if (unlikely(err < 0)) { +-#ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(t->stats->semantic_match_passed); +-#endif +- return err; +- } +- if (fi->fib_flags & RTNH_F_DEAD) +- continue; +- for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) { +- const struct fib_nh *nh = &fi->fib_nh[nhsel]; +- +- if (nh->nh_flags & RTNH_F_DEAD) +- continue; +- if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) +- continue; +- +-#ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(t->stats->semantic_match_passed); +-#endif +- res->prefixlen = li->plen; +- res->nh_sel = nhsel; +- res->type = fa->fa_type; +- res->scope = fi->fib_scope; +- res->fi = fi; +- res->table = tb; +- res->fa_head = &li->falh; +- if (!(fib_flags & FIB_LOOKUP_NOREF)) +- atomic_inc(&fi->fib_clntref); +- return 0; +- } +- } +- +-#ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(t->stats->semantic_match_miss); +-#endif +- } +- +- return 1; +-} +- + static inline t_key prefix_mismatch(t_key key, struct tnode *n) + { + t_key prefix = n->key; +@@ -1254,6 +1188,7 @@ static inline t_key prefix_mismatch(t_ke + return (key ^ prefix) & (prefix | -prefix); + } + ++/* should be called with rcu_read_lock */ + int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, + struct fib_result *res, int fib_flags) + { +@@ -1263,14 +1198,12 @@ int fib_table_lookup(struct fib_table *t + #endif + const t_key key = ntohl(flp->daddr); + struct tnode *n, *pn; ++ struct leaf_info *li; + t_key cindex; +- int ret = 1; +- +- rcu_read_lock(); + + n = rcu_dereference(t->trie); + if (!n) +- goto failed; ++ return -EAGAIN; + + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(stats->gets); +@@ -1350,7 +1283,7 @@ backtrace: + + pn = node_parent_rcu(pn); + if (unlikely(!pn)) +- goto failed; ++ return -EAGAIN; + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(stats->backtrack); + #endif +@@ -1368,12 +1301,62 @@ backtrace: + + found: + /* Step 3: Process the leaf, if that fails fall back to backtracing */ +- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); +- if (unlikely(ret > 0)) +- goto backtrace; +-failed: +- rcu_read_unlock(); +- return ret; ++ hlist_for_each_entry_rcu(li, &n->list, hlist) { ++ struct fib_alias *fa; ++ ++ if ((key ^ n->key) & li->mask_plen) ++ continue; ++ ++ list_for_each_entry_rcu(fa, &li->falh, fa_list) { ++ struct fib_info *fi = fa->fa_info; ++ int nhsel, err; ++ ++ if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) ++ continue; ++ if (fi->fib_dead) ++ continue; ++ if (fa->fa_info->fib_scope < flp->flowi4_scope) ++ continue; ++ fib_alias_accessed(fa); ++ err = fib_props[fa->fa_type].error; ++ if (unlikely(err < 0)) { ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ this_cpu_inc(stats->semantic_match_passed); ++#endif ++ return err; ++ } ++ if (fi->fib_flags & RTNH_F_DEAD) ++ continue; ++ for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) { ++ const struct fib_nh *nh = &fi->fib_nh[nhsel]; ++ ++ if (nh->nh_flags & RTNH_F_DEAD) ++ continue; ++ if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) ++ continue; ++ ++ if (!(fib_flags & FIB_LOOKUP_NOREF)) ++ atomic_inc(&fi->fib_clntref); ++ ++ res->prefixlen = li->plen; ++ res->nh_sel = nhsel; ++ res->type = fa->fa_type; ++ res->scope = fi->fib_scope; ++ res->fi = fi; ++ res->table = tb; ++ res->fa_head = &li->falh; ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ this_cpu_inc(stats->semantic_match_passed); ++#endif ++ return err; ++ } ++ } ++ ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ this_cpu_inc(stats->semantic_match_miss); ++#endif ++ } ++ goto backtrace; + } + EXPORT_SYMBOL_GPL(fib_table_lookup); + diff --git a/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch b/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch new file mode 100644 index 000000000..a373add1d --- /dev/null +++ b/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch @@ -0,0 +1,345 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:31 -0800 +Subject: [PATCH] fib_trie: Move resize to after inflate/halve + +This change consists of a cut/paste of resize to behind inflate and halve +so that I could remove the two function prototypes. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -149,8 +149,6 @@ struct trie { + static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, + struct tnode *n, int wasfull); + static struct tnode *resize(struct trie *t, struct tnode *tn); +-static struct tnode *inflate(struct trie *t, struct tnode *tn); +-static struct tnode *halve(struct trie *t, struct tnode *tn); + /* tnodes to free after resize(); protected by RTNL */ + static struct callback_head *tnode_free_head; + static size_t tnode_free_size; +@@ -447,161 +445,6 @@ static void put_child_root(struct tnode + rcu_assign_pointer(t->trie, n); + } + +-#define MAX_WORK 10 +-static struct tnode *resize(struct trie *t, struct tnode *tn) +-{ +- struct tnode *old_tn, *n = NULL; +- int inflate_threshold_use; +- int halve_threshold_use; +- int max_work; +- +- if (!tn) +- return NULL; +- +- pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", +- tn, inflate_threshold, halve_threshold); +- +- /* No children */ +- if (tn->empty_children > (tnode_child_length(tn) - 1)) +- goto no_children; +- +- /* One child */ +- if (tn->empty_children == (tnode_child_length(tn) - 1)) +- goto one_child; +- /* +- * Double as long as the resulting node has a number of +- * nonempty nodes that are above the threshold. +- */ +- +- /* +- * From "Implementing a dynamic compressed trie" by Stefan Nilsson of +- * the Helsinki University of Technology and Matti Tikkanen of Nokia +- * Telecommunications, page 6: +- * "A node is doubled if the ratio of non-empty children to all +- * children in the *doubled* node is at least 'high'." +- * +- * 'high' in this instance is the variable 'inflate_threshold'. It +- * is expressed as a percentage, so we multiply it with +- * tnode_child_length() and instead of multiplying by 2 (since the +- * child array will be doubled by inflate()) and multiplying +- * the left-hand side by 100 (to handle the percentage thing) we +- * multiply the left-hand side by 50. +- * +- * The left-hand side may look a bit weird: tnode_child_length(tn) +- * - tn->empty_children is of course the number of non-null children +- * in the current node. tn->full_children is the number of "full" +- * children, that is non-null tnodes with a skip value of 0. +- * All of those will be doubled in the resulting inflated tnode, so +- * we just count them one extra time here. +- * +- * A clearer way to write this would be: +- * +- * to_be_doubled = tn->full_children; +- * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - +- * tn->full_children; +- * +- * new_child_length = tnode_child_length(tn) * 2; +- * +- * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / +- * new_child_length; +- * if (new_fill_factor >= inflate_threshold) +- * +- * ...and so on, tho it would mess up the while () loop. +- * +- * anyway, +- * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= +- * inflate_threshold +- * +- * avoid a division: +- * 100 * (not_to_be_doubled + 2*to_be_doubled) >= +- * inflate_threshold * new_child_length +- * +- * expand not_to_be_doubled and to_be_doubled, and shorten: +- * 100 * (tnode_child_length(tn) - tn->empty_children + +- * tn->full_children) >= inflate_threshold * new_child_length +- * +- * expand new_child_length: +- * 100 * (tnode_child_length(tn) - tn->empty_children + +- * tn->full_children) >= +- * inflate_threshold * tnode_child_length(tn) * 2 +- * +- * shorten again: +- * 50 * (tn->full_children + tnode_child_length(tn) - +- * tn->empty_children) >= inflate_threshold * +- * tnode_child_length(tn) +- * +- */ +- +- /* Keep root node larger */ +- +- if (!node_parent(tn)) { +- inflate_threshold_use = inflate_threshold_root; +- halve_threshold_use = halve_threshold_root; +- } else { +- inflate_threshold_use = inflate_threshold; +- halve_threshold_use = halve_threshold; +- } +- +- max_work = MAX_WORK; +- while ((tn->full_children > 0 && max_work-- && +- 50 * (tn->full_children + tnode_child_length(tn) +- - tn->empty_children) +- >= inflate_threshold_use * tnode_child_length(tn))) { +- +- old_tn = tn; +- tn = inflate(t, tn); +- +- if (IS_ERR(tn)) { +- tn = old_tn; +-#ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(t->stats->resize_node_skipped); +-#endif +- break; +- } +- } +- +- /* Return if at least one inflate is run */ +- if (max_work != MAX_WORK) +- return tn; +- +- /* +- * Halve as long as the number of empty children in this +- * node is above threshold. +- */ +- +- max_work = MAX_WORK; +- while (tn->bits > 1 && max_work-- && +- 100 * (tnode_child_length(tn) - tn->empty_children) < +- halve_threshold_use * tnode_child_length(tn)) { +- +- old_tn = tn; +- tn = halve(t, tn); +- if (IS_ERR(tn)) { +- tn = old_tn; +-#ifdef CONFIG_IP_FIB_TRIE_STATS +- this_cpu_inc(t->stats->resize_node_skipped); +-#endif +- break; +- } +- } +- +- +- /* Only one child remains */ +- if (tn->empty_children == (tnode_child_length(tn) - 1)) { +- unsigned long i; +-one_child: +- for (i = tnode_child_length(tn); !n && i;) +- n = tnode_get_child(tn, --i); +-no_children: +- /* compress one level */ +- node_set_parent(n, NULL); +- tnode_free_safe(tn); +- return n; +- } +- return tn; +-} +- +- + static void tnode_clean_free(struct tnode *tn) + { + struct tnode *tofree; +@@ -804,6 +647,160 @@ nomem: + return ERR_PTR(-ENOMEM); + } + ++#define MAX_WORK 10 ++static struct tnode *resize(struct trie *t, struct tnode *tn) ++{ ++ struct tnode *old_tn, *n = NULL; ++ int inflate_threshold_use; ++ int halve_threshold_use; ++ int max_work; ++ ++ if (!tn) ++ return NULL; ++ ++ pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", ++ tn, inflate_threshold, halve_threshold); ++ ++ /* No children */ ++ if (tn->empty_children > (tnode_child_length(tn) - 1)) ++ goto no_children; ++ ++ /* One child */ ++ if (tn->empty_children == (tnode_child_length(tn) - 1)) ++ goto one_child; ++ /* ++ * Double as long as the resulting node has a number of ++ * nonempty nodes that are above the threshold. ++ */ ++ ++ /* ++ * From "Implementing a dynamic compressed trie" by Stefan Nilsson of ++ * the Helsinki University of Technology and Matti Tikkanen of Nokia ++ * Telecommunications, page 6: ++ * "A node is doubled if the ratio of non-empty children to all ++ * children in the *doubled* node is at least 'high'." ++ * ++ * 'high' in this instance is the variable 'inflate_threshold'. It ++ * is expressed as a percentage, so we multiply it with ++ * tnode_child_length() and instead of multiplying by 2 (since the ++ * child array will be doubled by inflate()) and multiplying ++ * the left-hand side by 100 (to handle the percentage thing) we ++ * multiply the left-hand side by 50. ++ * ++ * The left-hand side may look a bit weird: tnode_child_length(tn) ++ * - tn->empty_children is of course the number of non-null children ++ * in the current node. tn->full_children is the number of "full" ++ * children, that is non-null tnodes with a skip value of 0. ++ * All of those will be doubled in the resulting inflated tnode, so ++ * we just count them one extra time here. ++ * ++ * A clearer way to write this would be: ++ * ++ * to_be_doubled = tn->full_children; ++ * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - ++ * tn->full_children; ++ * ++ * new_child_length = tnode_child_length(tn) * 2; ++ * ++ * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / ++ * new_child_length; ++ * if (new_fill_factor >= inflate_threshold) ++ * ++ * ...and so on, tho it would mess up the while () loop. ++ * ++ * anyway, ++ * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= ++ * inflate_threshold ++ * ++ * avoid a division: ++ * 100 * (not_to_be_doubled + 2*to_be_doubled) >= ++ * inflate_threshold * new_child_length ++ * ++ * expand not_to_be_doubled and to_be_doubled, and shorten: ++ * 100 * (tnode_child_length(tn) - tn->empty_children + ++ * tn->full_children) >= inflate_threshold * new_child_length ++ * ++ * expand new_child_length: ++ * 100 * (tnode_child_length(tn) - tn->empty_children + ++ * tn->full_children) >= ++ * inflate_threshold * tnode_child_length(tn) * 2 ++ * ++ * shorten again: ++ * 50 * (tn->full_children + tnode_child_length(tn) - ++ * tn->empty_children) >= inflate_threshold * ++ * tnode_child_length(tn) ++ * ++ */ ++ ++ /* Keep root node larger */ ++ ++ if (!node_parent(tn)) { ++ inflate_threshold_use = inflate_threshold_root; ++ halve_threshold_use = halve_threshold_root; ++ } else { ++ inflate_threshold_use = inflate_threshold; ++ halve_threshold_use = halve_threshold; ++ } ++ ++ max_work = MAX_WORK; ++ while ((tn->full_children > 0 && max_work-- && ++ 50 * (tn->full_children + tnode_child_length(tn) ++ - tn->empty_children) ++ >= inflate_threshold_use * tnode_child_length(tn))) { ++ ++ old_tn = tn; ++ tn = inflate(t, tn); ++ ++ if (IS_ERR(tn)) { ++ tn = old_tn; ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ this_cpu_inc(t->stats->resize_node_skipped); ++#endif ++ break; ++ } ++ } ++ ++ /* Return if at least one inflate is run */ ++ if (max_work != MAX_WORK) ++ return tn; ++ ++ /* ++ * Halve as long as the number of empty children in this ++ * node is above threshold. ++ */ ++ ++ max_work = MAX_WORK; ++ while (tn->bits > 1 && max_work-- && ++ 100 * (tnode_child_length(tn) - tn->empty_children) < ++ halve_threshold_use * tnode_child_length(tn)) { ++ ++ old_tn = tn; ++ tn = halve(t, tn); ++ if (IS_ERR(tn)) { ++ tn = old_tn; ++#ifdef CONFIG_IP_FIB_TRIE_STATS ++ this_cpu_inc(t->stats->resize_node_skipped); ++#endif ++ break; ++ } ++ } ++ ++ ++ /* Only one child remains */ ++ if (tn->empty_children == (tnode_child_length(tn) - 1)) { ++ unsigned long i; ++one_child: ++ for (i = tnode_child_length(tn); !n && i;) ++ n = tnode_get_child(tn, --i); ++no_children: ++ /* compress one level */ ++ node_set_parent(n, NULL); ++ tnode_free_safe(tn); ++ return n; ++ } ++ return tn; ++} ++ + /* readside must use rcu_read_lock currently dump routines + via get_fa_head and dump */ + diff --git a/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch b/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch new file mode 100644 index 000000000..c01d57af0 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch @@ -0,0 +1,250 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:37 -0800 +Subject: [PATCH] fib_trie: Add functions should_inflate and should_halve + +This change pulls the logic for if we should inflate/halve the nodes out +into separate functions. It also addresses what I believe is a bug where 1 +full node is all that is needed to keep a node from ever being halved. + +Simple script to reproduce the issue: + modprobe dummy; ifconfig dummy0 up + for i in `seq 0 255`; do ifconfig dummy0:$i 10.0.${i}.1/24 up; done + ifconfig dummy0:256 10.0.255.33/16 up + for i in `seq 0 254`; do ifconfig dummy0:$i down; done + +Results from /proc/net/fib_triestat +Before: + Local: + Aver depth: 3.00 + Max depth: 4 + Leaves: 17 + Prefixes: 18 + Internal nodes: 11 + 1: 8 2: 2 10: 1 + Pointers: 1048 + Null ptrs: 1021 + Total size: 11 kB +After: + Local: + Aver depth: 3.41 + Max depth: 5 + Leaves: 17 + Prefixes: 18 + Internal nodes: 12 + 1: 8 2: 3 3: 1 + Pointers: 36 + Null ptrs: 8 + Total size: 3 kB + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -647,12 +647,94 @@ nomem: + return ERR_PTR(-ENOMEM); + } + ++/* From "Implementing a dynamic compressed trie" by Stefan Nilsson of ++ * the Helsinki University of Technology and Matti Tikkanen of Nokia ++ * Telecommunications, page 6: ++ * "A node is doubled if the ratio of non-empty children to all ++ * children in the *doubled* node is at least 'high'." ++ * ++ * 'high' in this instance is the variable 'inflate_threshold'. It ++ * is expressed as a percentage, so we multiply it with ++ * tnode_child_length() and instead of multiplying by 2 (since the ++ * child array will be doubled by inflate()) and multiplying ++ * the left-hand side by 100 (to handle the percentage thing) we ++ * multiply the left-hand side by 50. ++ * ++ * The left-hand side may look a bit weird: tnode_child_length(tn) ++ * - tn->empty_children is of course the number of non-null children ++ * in the current node. tn->full_children is the number of "full" ++ * children, that is non-null tnodes with a skip value of 0. ++ * All of those will be doubled in the resulting inflated tnode, so ++ * we just count them one extra time here. ++ * ++ * A clearer way to write this would be: ++ * ++ * to_be_doubled = tn->full_children; ++ * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - ++ * tn->full_children; ++ * ++ * new_child_length = tnode_child_length(tn) * 2; ++ * ++ * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / ++ * new_child_length; ++ * if (new_fill_factor >= inflate_threshold) ++ * ++ * ...and so on, tho it would mess up the while () loop. ++ * ++ * anyway, ++ * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= ++ * inflate_threshold ++ * ++ * avoid a division: ++ * 100 * (not_to_be_doubled + 2*to_be_doubled) >= ++ * inflate_threshold * new_child_length ++ * ++ * expand not_to_be_doubled and to_be_doubled, and shorten: ++ * 100 * (tnode_child_length(tn) - tn->empty_children + ++ * tn->full_children) >= inflate_threshold * new_child_length ++ * ++ * expand new_child_length: ++ * 100 * (tnode_child_length(tn) - tn->empty_children + ++ * tn->full_children) >= ++ * inflate_threshold * tnode_child_length(tn) * 2 ++ * ++ * shorten again: ++ * 50 * (tn->full_children + tnode_child_length(tn) - ++ * tn->empty_children) >= inflate_threshold * ++ * tnode_child_length(tn) ++ * ++ */ ++static bool should_inflate(const struct tnode *tn) ++{ ++ unsigned long used = tnode_child_length(tn); ++ unsigned long threshold = used; ++ ++ /* Keep root node larger */ ++ threshold *= node_parent(tn) ? inflate_threshold : ++ inflate_threshold_root; ++ used += tn->full_children; ++ used -= tn->empty_children; ++ ++ return tn->pos && ((50 * used) >= threshold); ++} ++ ++static bool should_halve(const struct tnode *tn) ++{ ++ unsigned long used = tnode_child_length(tn); ++ unsigned long threshold = used; ++ ++ /* Keep root node larger */ ++ threshold *= node_parent(tn) ? halve_threshold : ++ halve_threshold_root; ++ used -= tn->empty_children; ++ ++ return (tn->bits > 1) && ((100 * used) < threshold); ++} ++ + #define MAX_WORK 10 + static struct tnode *resize(struct trie *t, struct tnode *tn) + { + struct tnode *old_tn, *n = NULL; +- int inflate_threshold_use; +- int halve_threshold_use; + int max_work; + + if (!tn) +@@ -668,86 +750,12 @@ static struct tnode *resize(struct trie + /* One child */ + if (tn->empty_children == (tnode_child_length(tn) - 1)) + goto one_child; +- /* +- * Double as long as the resulting node has a number of +- * nonempty nodes that are above the threshold. +- */ + +- /* +- * From "Implementing a dynamic compressed trie" by Stefan Nilsson of +- * the Helsinki University of Technology and Matti Tikkanen of Nokia +- * Telecommunications, page 6: +- * "A node is doubled if the ratio of non-empty children to all +- * children in the *doubled* node is at least 'high'." +- * +- * 'high' in this instance is the variable 'inflate_threshold'. It +- * is expressed as a percentage, so we multiply it with +- * tnode_child_length() and instead of multiplying by 2 (since the +- * child array will be doubled by inflate()) and multiplying +- * the left-hand side by 100 (to handle the percentage thing) we +- * multiply the left-hand side by 50. +- * +- * The left-hand side may look a bit weird: tnode_child_length(tn) +- * - tn->empty_children is of course the number of non-null children +- * in the current node. tn->full_children is the number of "full" +- * children, that is non-null tnodes with a skip value of 0. +- * All of those will be doubled in the resulting inflated tnode, so +- * we just count them one extra time here. +- * +- * A clearer way to write this would be: +- * +- * to_be_doubled = tn->full_children; +- * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - +- * tn->full_children; +- * +- * new_child_length = tnode_child_length(tn) * 2; +- * +- * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / +- * new_child_length; +- * if (new_fill_factor >= inflate_threshold) +- * +- * ...and so on, tho it would mess up the while () loop. +- * +- * anyway, +- * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= +- * inflate_threshold +- * +- * avoid a division: +- * 100 * (not_to_be_doubled + 2*to_be_doubled) >= +- * inflate_threshold * new_child_length +- * +- * expand not_to_be_doubled and to_be_doubled, and shorten: +- * 100 * (tnode_child_length(tn) - tn->empty_children + +- * tn->full_children) >= inflate_threshold * new_child_length +- * +- * expand new_child_length: +- * 100 * (tnode_child_length(tn) - tn->empty_children + +- * tn->full_children) >= +- * inflate_threshold * tnode_child_length(tn) * 2 +- * +- * shorten again: +- * 50 * (tn->full_children + tnode_child_length(tn) - +- * tn->empty_children) >= inflate_threshold * +- * tnode_child_length(tn) +- * ++ /* Double as long as the resulting node has a number of ++ * nonempty nodes that are above the threshold. + */ +- +- /* Keep root node larger */ +- +- if (!node_parent(tn)) { +- inflate_threshold_use = inflate_threshold_root; +- halve_threshold_use = halve_threshold_root; +- } else { +- inflate_threshold_use = inflate_threshold; +- halve_threshold_use = halve_threshold; +- } +- + max_work = MAX_WORK; +- while ((tn->full_children > 0 && max_work-- && +- 50 * (tn->full_children + tnode_child_length(tn) +- - tn->empty_children) +- >= inflate_threshold_use * tnode_child_length(tn))) { +- ++ while (should_inflate(tn) && max_work--) { + old_tn = tn; + tn = inflate(t, tn); + +@@ -764,16 +772,11 @@ static struct tnode *resize(struct trie + if (max_work != MAX_WORK) + return tn; + +- /* +- * Halve as long as the number of empty children in this ++ /* Halve as long as the number of empty children in this + * node is above threshold. + */ +- + max_work = MAX_WORK; +- while (tn->bits > 1 && max_work-- && +- 100 * (tnode_child_length(tn) - tn->empty_children) < +- halve_threshold_use * tnode_child_length(tn)) { +- ++ while (should_halve(tn) && max_work--) { + old_tn = tn; + tn = halve(t, tn); + if (IS_ERR(tn)) { diff --git a/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch b/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch new file mode 100644 index 000000000..8f26e32d3 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch @@ -0,0 +1,336 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:43 -0800 +Subject: [PATCH] fib_trie: Push assignment of child to parent down into + inflate/halve + +This change makes it so that the assignment of the tnode to the parent is +handled directly within whatever function is currently handling the node be +it inflate, halve, or resize. By doing this we can avoid some of the need +to set NULL pointers in the tree while we are resizing the subnodes. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -146,9 +146,7 @@ struct trie { + #endif + }; + +-static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, +- struct tnode *n, int wasfull); +-static struct tnode *resize(struct trie *t, struct tnode *tn); ++static void resize(struct trie *t, struct tnode *tn); + /* tnodes to free after resize(); protected by RTNL */ + static struct callback_head *tnode_free_head; + static size_t tnode_free_size; +@@ -396,22 +394,13 @@ static inline int tnode_full(const struc + return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); + } + +-static inline void put_child(struct tnode *tn, unsigned long i, +- struct tnode *n) +-{ +- tnode_put_child_reorg(tn, i, n, -1); +-} +- +- /* +- * Add a child at position i overwriting the old value. +- * Update the value of full_children and empty_children. +- */ +- +-static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, +- struct tnode *n, int wasfull) ++/* Add a child at position i overwriting the old value. ++ * Update the value of full_children and empty_children. ++ */ ++static void put_child(struct tnode *tn, unsigned long i, struct tnode *n) + { + struct tnode *chi = rtnl_dereference(tn->child[i]); +- int isfull; ++ int isfull, wasfull; + + BUG_ON(i >= tnode_child_length(tn)); + +@@ -422,10 +411,9 @@ static void tnode_put_child_reorg(struct + tn->empty_children--; + + /* update fullChildren */ +- if (wasfull == -1) +- wasfull = tnode_full(tn, chi); +- ++ wasfull = tnode_full(tn, chi); + isfull = tnode_full(tn, n); ++ + if (wasfull && !isfull) + tn->full_children--; + else if (!wasfull && isfull) +@@ -458,9 +446,10 @@ static void tnode_clean_free(struct tnod + node_free(tn); + } + +-static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) ++static int inflate(struct trie *t, struct tnode *oldtnode) + { + unsigned long olen = tnode_child_length(oldtnode); ++ struct tnode *tp = node_parent(oldtnode); + struct tnode *tn; + unsigned long i; + t_key m; +@@ -468,9 +457,8 @@ static struct tnode *inflate(struct trie + pr_debug("In inflate\n"); + + tn = tnode_new(oldtnode->key, oldtnode->pos - 1, oldtnode->bits + 1); +- + if (!tn) +- return ERR_PTR(-ENOMEM); ++ return -ENOMEM; + + /* + * Preallocate and store tnodes before the actual work so we +@@ -564,30 +552,36 @@ static struct tnode *inflate(struct trie + put_child(left, j, rtnl_dereference(inode->child[j])); + put_child(right, j, rtnl_dereference(inode->child[j + size])); + } +- put_child(tn, 2*i, resize(t, left)); +- put_child(tn, 2*i+1, resize(t, right)); ++ ++ put_child(tn, 2 * i, left); ++ put_child(tn, 2 * i + 1, right); + + tnode_free_safe(inode); ++ ++ resize(t, left); ++ resize(t, right); + } ++ ++ put_child_root(tp, t, tn->key, tn); + tnode_free_safe(oldtnode); +- return tn; ++ return 0; + nomem: + tnode_clean_free(tn); +- return ERR_PTR(-ENOMEM); ++ return -ENOMEM; + } + +-static struct tnode *halve(struct trie *t, struct tnode *oldtnode) ++static int halve(struct trie *t, struct tnode *oldtnode) + { + unsigned long olen = tnode_child_length(oldtnode); ++ struct tnode *tp = node_parent(oldtnode); + struct tnode *tn, *left, *right; + int i; + + pr_debug("In halve\n"); + + tn = tnode_new(oldtnode->key, oldtnode->pos + 1, oldtnode->bits - 1); +- + if (!tn) +- return ERR_PTR(-ENOMEM); ++ return -ENOMEM; + + /* + * Preallocate and store tnodes before the actual work so we +@@ -606,8 +600,10 @@ static struct tnode *halve(struct trie * + + newn = tnode_new(left->key, oldtnode->pos, 1); + +- if (!newn) +- goto nomem; ++ if (!newn) { ++ tnode_clean_free(tn); ++ return -ENOMEM; ++ } + + put_child(tn, i/2, newn); + } +@@ -635,16 +631,18 @@ static struct tnode *halve(struct trie * + + /* Two nonempty children */ + newBinNode = tnode_get_child(tn, i/2); +- put_child(tn, i/2, NULL); + put_child(newBinNode, 0, left); + put_child(newBinNode, 1, right); +- put_child(tn, i/2, resize(t, newBinNode)); ++ ++ put_child(tn, i / 2, newBinNode); ++ ++ resize(t, newBinNode); + } ++ ++ put_child_root(tp, t, tn->key, tn); + tnode_free_safe(oldtnode); +- return tn; +-nomem: +- tnode_clean_free(tn); +- return ERR_PTR(-ENOMEM); ++ ++ return 0; + } + + /* From "Implementing a dynamic compressed trie" by Stefan Nilsson of +@@ -704,45 +702,48 @@ nomem: + * tnode_child_length(tn) + * + */ +-static bool should_inflate(const struct tnode *tn) ++static bool should_inflate(const struct tnode *tp, const struct tnode *tn) + { + unsigned long used = tnode_child_length(tn); + unsigned long threshold = used; + + /* Keep root node larger */ +- threshold *= node_parent(tn) ? inflate_threshold : +- inflate_threshold_root; ++ threshold *= tp ? inflate_threshold : inflate_threshold_root; + used += tn->full_children; + used -= tn->empty_children; + + return tn->pos && ((50 * used) >= threshold); + } + +-static bool should_halve(const struct tnode *tn) ++static bool should_halve(const struct tnode *tp, const struct tnode *tn) + { + unsigned long used = tnode_child_length(tn); + unsigned long threshold = used; + + /* Keep root node larger */ +- threshold *= node_parent(tn) ? halve_threshold : +- halve_threshold_root; ++ threshold *= tp ? halve_threshold : halve_threshold_root; + used -= tn->empty_children; + + return (tn->bits > 1) && ((100 * used) < threshold); + } + + #define MAX_WORK 10 +-static struct tnode *resize(struct trie *t, struct tnode *tn) ++static void resize(struct trie *t, struct tnode *tn) + { +- struct tnode *old_tn, *n = NULL; ++ struct tnode *tp = node_parent(tn), *n = NULL; ++ struct tnode __rcu **cptr; + int max_work; + +- if (!tn) +- return NULL; +- + pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", + tn, inflate_threshold, halve_threshold); + ++ /* track the tnode via the pointer from the parent instead of ++ * doing it ourselves. This way we can let RCU fully do its ++ * thing without us interfering ++ */ ++ cptr = tp ? &tp->child[get_index(tn->key, tp)] : &t->trie; ++ BUG_ON(tn != rtnl_dereference(*cptr)); ++ + /* No children */ + if (tn->empty_children > (tnode_child_length(tn) - 1)) + goto no_children; +@@ -755,39 +756,35 @@ static struct tnode *resize(struct trie + * nonempty nodes that are above the threshold. + */ + max_work = MAX_WORK; +- while (should_inflate(tn) && max_work--) { +- old_tn = tn; +- tn = inflate(t, tn); +- +- if (IS_ERR(tn)) { +- tn = old_tn; ++ while (should_inflate(tp, tn) && max_work--) { ++ if (inflate(t, tn)) { + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(t->stats->resize_node_skipped); + #endif + break; + } ++ ++ tn = rtnl_dereference(*cptr); + } + + /* Return if at least one inflate is run */ + if (max_work != MAX_WORK) +- return tn; ++ return; + + /* Halve as long as the number of empty children in this + * node is above threshold. + */ + max_work = MAX_WORK; +- while (should_halve(tn) && max_work--) { +- old_tn = tn; +- tn = halve(t, tn); +- if (IS_ERR(tn)) { +- tn = old_tn; ++ while (should_halve(tp, tn) && max_work--) { ++ if (halve(t, tn)) { + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(t->stats->resize_node_skipped); + #endif + break; + } +- } + ++ tn = rtnl_dereference(*cptr); ++ } + + /* Only one child remains */ + if (tn->empty_children == (tnode_child_length(tn) - 1)) { +@@ -797,11 +794,12 @@ one_child: + n = tnode_get_child(tn, --i); + no_children: + /* compress one level */ +- node_set_parent(n, NULL); ++ put_child_root(tp, t, tn->key, n); ++ node_set_parent(n, tp); ++ ++ /* drop dead node */ + tnode_free_safe(tn); +- return n; + } +- return tn; + } + + /* readside must use rcu_read_lock currently dump routines +@@ -882,34 +880,19 @@ static struct tnode *fib_find_node(struc + + static void trie_rebalance(struct trie *t, struct tnode *tn) + { +- int wasfull; +- t_key cindex, key; + struct tnode *tp; + +- key = tn->key; +- +- while (tn != NULL && (tp = node_parent(tn)) != NULL) { +- cindex = get_index(key, tp); +- wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); +- tn = resize(t, tn); +- +- tnode_put_child_reorg(tp, cindex, tn, wasfull); +- +- tp = node_parent(tn); +- if (!tp) +- rcu_assign_pointer(t->trie, tn); ++ while ((tp = node_parent(tn)) != NULL) { ++ resize(t, tn); + + tnode_free_flush(); +- if (!tp) +- break; + tn = tp; + } + + /* Handle last (top) tnode */ + if (IS_TNODE(tn)) +- tn = resize(t, tn); ++ resize(t, tn); + +- rcu_assign_pointer(t->trie, tn); + tnode_free_flush(); + } + diff --git a/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch b/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch new file mode 100644 index 000000000..51178a0f1 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch @@ -0,0 +1,237 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:49 -0800 +Subject: [PATCH] fib_trie: Push tnode flushing down to inflate/halve + +This change pushes the tnode freeing down into the inflate and halve +functions. It makes more sense here as we have a better grasp of what is +going on and when a given cluster of nodes is ready to be freed. + +I believe this may address a bug in the freeing logic as well. For some +reason if the freelist got to a certain size we would call +synchronize_rcu(). I'm assuming that what they meant to do is call +synchronize_rcu() after they had handed off that much memory via +call_rcu(). As such that is what I have updated the behavior to be. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -147,8 +147,6 @@ struct trie { + }; + + static void resize(struct trie *t, struct tnode *tn); +-/* tnodes to free after resize(); protected by RTNL */ +-static struct callback_head *tnode_free_head; + static size_t tnode_free_size; + + /* +@@ -307,32 +305,6 @@ static struct tnode *tnode_alloc(size_t + return vzalloc(size); + } + +-static void tnode_free_safe(struct tnode *tn) +-{ +- BUG_ON(IS_LEAF(tn)); +- tn->rcu.next = tnode_free_head; +- tnode_free_head = &tn->rcu; +-} +- +-static void tnode_free_flush(void) +-{ +- struct callback_head *head; +- +- while ((head = tnode_free_head)) { +- struct tnode *tn = container_of(head, struct tnode, rcu); +- +- tnode_free_head = head->next; +- tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); +- +- node_free(tn); +- } +- +- if (tnode_free_size >= PAGE_SIZE * sync_pages) { +- tnode_free_size = 0; +- synchronize_rcu(); +- } +-} +- + static struct tnode *leaf_new(t_key key) + { + struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); +@@ -433,17 +405,33 @@ static void put_child_root(struct tnode + rcu_assign_pointer(t->trie, n); + } + +-static void tnode_clean_free(struct tnode *tn) ++static inline void tnode_free_init(struct tnode *tn) + { +- struct tnode *tofree; +- unsigned long i; ++ tn->rcu.next = NULL; ++} ++ ++static inline void tnode_free_append(struct tnode *tn, struct tnode *n) ++{ ++ n->rcu.next = tn->rcu.next; ++ tn->rcu.next = &n->rcu; ++} + +- for (i = 0; i < tnode_child_length(tn); i++) { +- tofree = tnode_get_child(tn, i); +- if (tofree) +- node_free(tofree); ++static void tnode_free(struct tnode *tn) ++{ ++ struct callback_head *head = &tn->rcu; ++ ++ while (head) { ++ head = head->next; ++ tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); ++ node_free(tn); ++ ++ tn = container_of(head, struct tnode, rcu); ++ } ++ ++ if (tnode_free_size >= PAGE_SIZE * sync_pages) { ++ tnode_free_size = 0; ++ synchronize_rcu(); + } +- node_free(tn); + } + + static int inflate(struct trie *t, struct tnode *oldtnode) +@@ -476,20 +464,23 @@ static int inflate(struct trie *t, struc + inode->bits - 1); + if (!left) + goto nomem; ++ tnode_free_append(tn, left); + + right = tnode_new(inode->key | m, inode->pos, + inode->bits - 1); + +- if (!right) { +- node_free(left); ++ if (!right) + goto nomem; +- } ++ tnode_free_append(tn, right); + + put_child(tn, 2*i, left); + put_child(tn, 2*i+1, right); + } + } + ++ /* prepare oldtnode to be freed */ ++ tnode_free_init(oldtnode); ++ + for (i = 0; i < olen; i++) { + struct tnode *inode = tnode_get_child(oldtnode, i); + struct tnode *left, *right; +@@ -505,12 +496,13 @@ static int inflate(struct trie *t, struc + continue; + } + ++ /* drop the node in the old tnode free list */ ++ tnode_free_append(oldtnode, inode); ++ + /* An internal node with two children */ + if (inode->bits == 1) { + put_child(tn, 2*i, rtnl_dereference(inode->child[0])); + put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); +- +- tnode_free_safe(inode); + continue; + } + +@@ -556,17 +548,19 @@ static int inflate(struct trie *t, struc + put_child(tn, 2 * i, left); + put_child(tn, 2 * i + 1, right); + +- tnode_free_safe(inode); +- ++ /* resize child nodes */ + resize(t, left); + resize(t, right); + } + + put_child_root(tp, t, tn->key, tn); +- tnode_free_safe(oldtnode); ++ ++ /* we completed without error, prepare to free old node */ ++ tnode_free(oldtnode); + return 0; + nomem: +- tnode_clean_free(tn); ++ /* all pointers should be clean so we are done */ ++ tnode_free(tn); + return -ENOMEM; + } + +@@ -599,17 +593,20 @@ static int halve(struct trie *t, struct + struct tnode *newn; + + newn = tnode_new(left->key, oldtnode->pos, 1); +- + if (!newn) { +- tnode_clean_free(tn); ++ tnode_free(tn); + return -ENOMEM; + } ++ tnode_free_append(tn, newn); + + put_child(tn, i/2, newn); + } + + } + ++ /* prepare oldtnode to be freed */ ++ tnode_free_init(oldtnode); ++ + for (i = 0; i < olen; i += 2) { + struct tnode *newBinNode; + +@@ -636,11 +633,14 @@ static int halve(struct trie *t, struct + + put_child(tn, i / 2, newBinNode); + ++ /* resize child node */ + resize(t, newBinNode); + } + + put_child_root(tp, t, tn->key, tn); +- tnode_free_safe(oldtnode); ++ ++ /* all pointers should be clean so we are done */ ++ tnode_free(oldtnode); + + return 0; + } +@@ -798,7 +798,8 @@ no_children: + node_set_parent(n, tp); + + /* drop dead node */ +- tnode_free_safe(tn); ++ tnode_free_init(tn); ++ tnode_free(tn); + } + } + +@@ -884,16 +885,12 @@ static void trie_rebalance(struct trie * + + while ((tp = node_parent(tn)) != NULL) { + resize(t, tn); +- +- tnode_free_flush(); + tn = tp; + } + + /* Handle last (top) tnode */ + if (IS_TNODE(tn)) + resize(t, tn); +- +- tnode_free_flush(); + } + + /* only used from updater-side */ diff --git a/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch b/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch new file mode 100644 index 000000000..d6b600c5d --- /dev/null +++ b/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch @@ -0,0 +1,345 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:56:55 -0800 +Subject: [PATCH] fib_trie: inflate/halve nodes in a more RCU friendly + way + +This change pulls the node_set_parent functionality out of put_child_reorg +and instead leaves that to the function to take care of as well. By doing +this we can fully construct the new cluster of tnodes and all of the +pointers out of it before we start routing pointers into it. + +I am suspecting this will likely fix some concurency issues though I don't +have a good test to show as such. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -391,8 +391,6 @@ static void put_child(struct tnode *tn, + else if (!wasfull && isfull) + tn->full_children++; + +- node_set_parent(n, tn); +- + rcu_assign_pointer(tn->child[i], n); + } + +@@ -436,10 +434,8 @@ static void tnode_free(struct tnode *tn) + + static int inflate(struct trie *t, struct tnode *oldtnode) + { +- unsigned long olen = tnode_child_length(oldtnode); +- struct tnode *tp = node_parent(oldtnode); +- struct tnode *tn; +- unsigned long i; ++ struct tnode *inode, *node0, *node1, *tn, *tp; ++ unsigned long i, j, k; + t_key m; + + pr_debug("In inflate\n"); +@@ -448,43 +444,13 @@ static int inflate(struct trie *t, struc + if (!tn) + return -ENOMEM; + +- /* +- * Preallocate and store tnodes before the actual work so we +- * don't get into an inconsistent state if memory allocation +- * fails. In case of failure we return the oldnode and inflate +- * of tnode is ignored. ++ /* Assemble all of the pointers in our cluster, in this case that ++ * represents all of the pointers out of our allocated nodes that ++ * point to existing tnodes and the links between our allocated ++ * nodes. + */ +- for (i = 0, m = 1u << tn->pos; i < olen; i++) { +- struct tnode *inode = tnode_get_child(oldtnode, i); +- +- if (tnode_full(oldtnode, inode) && (inode->bits > 1)) { +- struct tnode *left, *right; +- +- left = tnode_new(inode->key & ~m, inode->pos, +- inode->bits - 1); +- if (!left) +- goto nomem; +- tnode_free_append(tn, left); +- +- right = tnode_new(inode->key | m, inode->pos, +- inode->bits - 1); +- +- if (!right) +- goto nomem; +- tnode_free_append(tn, right); +- +- put_child(tn, 2*i, left); +- put_child(tn, 2*i+1, right); +- } +- } +- +- /* prepare oldtnode to be freed */ +- tnode_free_init(oldtnode); +- +- for (i = 0; i < olen; i++) { +- struct tnode *inode = tnode_get_child(oldtnode, i); +- struct tnode *left, *right; +- unsigned long size, j; ++ for (i = tnode_child_length(oldtnode), m = 1u << tn->pos; i;) { ++ inode = tnode_get_child(oldtnode, --i); + + /* An empty child */ + if (inode == NULL) +@@ -496,65 +462,99 @@ static int inflate(struct trie *t, struc + continue; + } + +- /* drop the node in the old tnode free list */ +- tnode_free_append(oldtnode, inode); +- + /* An internal node with two children */ + if (inode->bits == 1) { +- put_child(tn, 2*i, rtnl_dereference(inode->child[0])); +- put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); ++ put_child(tn, 2 * i + 1, tnode_get_child(inode, 1)); ++ put_child(tn, 2 * i, tnode_get_child(inode, 0)); + continue; + } + +- /* An internal node with more than two children */ +- + /* We will replace this node 'inode' with two new +- * ones, 'left' and 'right', each with half of the ++ * ones, 'node0' and 'node1', each with half of the + * original children. The two new nodes will have + * a position one bit further down the key and this + * means that the "significant" part of their keys + * (see the discussion near the top of this file) + * will differ by one bit, which will be "0" in +- * left's key and "1" in right's key. Since we are ++ * node0's key and "1" in node1's key. Since we are + * moving the key position by one step, the bit that + * we are moving away from - the bit at position +- * (inode->pos) - is the one that will differ between +- * left and right. So... we synthesize that bit in the +- * two new keys. +- * The mask 'm' below will be a single "one" bit at +- * the position (inode->pos) ++ * (tn->pos) - is the one that will differ between ++ * node0 and node1. So... we synthesize that bit in the ++ * two new keys. + */ ++ node1 = tnode_new(inode->key | m, inode->pos, inode->bits - 1); ++ if (!node1) ++ goto nomem; ++ tnode_free_append(tn, node1); ++ ++ node0 = tnode_new(inode->key & ~m, inode->pos, inode->bits - 1); ++ if (!node0) ++ goto nomem; ++ tnode_free_append(tn, node0); ++ ++ /* populate child pointers in new nodes */ ++ for (k = tnode_child_length(inode), j = k / 2; j;) { ++ put_child(node1, --j, tnode_get_child(inode, --k)); ++ put_child(node0, j, tnode_get_child(inode, j)); ++ put_child(node1, --j, tnode_get_child(inode, --k)); ++ put_child(node0, j, tnode_get_child(inode, j)); ++ } ++ ++ /* link new nodes to parent */ ++ NODE_INIT_PARENT(node1, tn); ++ NODE_INIT_PARENT(node0, tn); ++ ++ /* link parent to nodes */ ++ put_child(tn, 2 * i + 1, node1); ++ put_child(tn, 2 * i, node0); ++ } ++ ++ /* setup the parent pointer into and out of this node */ ++ tp = node_parent(oldtnode); ++ NODE_INIT_PARENT(tn, tp); ++ put_child_root(tp, t, tn->key, tn); + +- /* Use the old key, but set the new significant +- * bit to zero. +- */ ++ /* prepare oldtnode to be freed */ ++ tnode_free_init(oldtnode); + +- left = tnode_get_child(tn, 2*i); +- put_child(tn, 2*i, NULL); ++ /* update all child nodes parent pointers to route to us */ ++ for (i = tnode_child_length(oldtnode); i;) { ++ inode = tnode_get_child(oldtnode, --i); + +- BUG_ON(!left); ++ /* A leaf or an internal node with skipped bits */ ++ if (!tnode_full(oldtnode, inode)) { ++ node_set_parent(inode, tn); ++ continue; ++ } + +- right = tnode_get_child(tn, 2*i+1); +- put_child(tn, 2*i+1, NULL); ++ /* drop the node in the old tnode free list */ ++ tnode_free_append(oldtnode, inode); + +- BUG_ON(!right); ++ /* fetch new nodes */ ++ node1 = tnode_get_child(tn, 2 * i + 1); ++ node0 = tnode_get_child(tn, 2 * i); + +- size = tnode_child_length(left); +- for (j = 0; j < size; j++) { +- put_child(left, j, rtnl_dereference(inode->child[j])); +- put_child(right, j, rtnl_dereference(inode->child[j + size])); ++ /* bits == 1 then node0 and node1 represent inode's children */ ++ if (inode->bits == 1) { ++ node_set_parent(node1, tn); ++ node_set_parent(node0, tn); ++ continue; + } + +- put_child(tn, 2 * i, left); +- put_child(tn, 2 * i + 1, right); ++ /* update parent pointers in child node's children */ ++ for (k = tnode_child_length(inode), j = k / 2; j;) { ++ node_set_parent(tnode_get_child(inode, --k), node1); ++ node_set_parent(tnode_get_child(inode, --j), node0); ++ node_set_parent(tnode_get_child(inode, --k), node1); ++ node_set_parent(tnode_get_child(inode, --j), node0); ++ } + + /* resize child nodes */ +- resize(t, left); +- resize(t, right); ++ resize(t, node1); ++ resize(t, node0); + } + +- put_child_root(tp, t, tn->key, tn); +- + /* we completed without error, prepare to free old node */ + tnode_free(oldtnode); + return 0; +@@ -566,10 +566,8 @@ nomem: + + static int halve(struct trie *t, struct tnode *oldtnode) + { +- unsigned long olen = tnode_child_length(oldtnode); +- struct tnode *tp = node_parent(oldtnode); +- struct tnode *tn, *left, *right; +- int i; ++ struct tnode *tn, *tp, *inode, *node0, *node1; ++ unsigned long i; + + pr_debug("In halve\n"); + +@@ -577,68 +575,64 @@ static int halve(struct trie *t, struct + if (!tn) + return -ENOMEM; + +- /* +- * Preallocate and store tnodes before the actual work so we +- * don't get into an inconsistent state if memory allocation +- * fails. In case of failure we return the oldnode and halve +- * of tnode is ignored. ++ /* Assemble all of the pointers in our cluster, in this case that ++ * represents all of the pointers out of our allocated nodes that ++ * point to existing tnodes and the links between our allocated ++ * nodes. + */ ++ for (i = tnode_child_length(oldtnode); i;) { ++ node1 = tnode_get_child(oldtnode, --i); ++ node0 = tnode_get_child(oldtnode, --i); + +- for (i = 0; i < olen; i += 2) { +- left = tnode_get_child(oldtnode, i); +- right = tnode_get_child(oldtnode, i+1); ++ /* At least one of the children is empty */ ++ if (!node1 || !node0) { ++ put_child(tn, i / 2, node1 ? : node0); ++ continue; ++ } + + /* Two nonempty children */ +- if (left && right) { +- struct tnode *newn; +- +- newn = tnode_new(left->key, oldtnode->pos, 1); +- if (!newn) { +- tnode_free(tn); +- return -ENOMEM; +- } +- tnode_free_append(tn, newn); +- +- put_child(tn, i/2, newn); ++ inode = tnode_new(node0->key, oldtnode->pos, 1); ++ if (!inode) { ++ tnode_free(tn); ++ return -ENOMEM; + } ++ tnode_free_append(tn, inode); + ++ /* initialize pointers out of node */ ++ put_child(inode, 1, node1); ++ put_child(inode, 0, node0); ++ NODE_INIT_PARENT(inode, tn); ++ ++ /* link parent to node */ ++ put_child(tn, i / 2, inode); + } + ++ /* setup the parent pointer out of and back into this node */ ++ tp = node_parent(oldtnode); ++ NODE_INIT_PARENT(tn, tp); ++ put_child_root(tp, t, tn->key, tn); ++ + /* prepare oldtnode to be freed */ + tnode_free_init(oldtnode); + +- for (i = 0; i < olen; i += 2) { +- struct tnode *newBinNode; +- +- left = tnode_get_child(oldtnode, i); +- right = tnode_get_child(oldtnode, i+1); +- +- /* At least one of the children is empty */ +- if (left == NULL) { +- if (right == NULL) /* Both are empty */ +- continue; +- put_child(tn, i/2, right); +- continue; +- } +- +- if (right == NULL) { +- put_child(tn, i/2, left); ++ /* update all of the child parent pointers */ ++ for (i = tnode_child_length(tn); i;) { ++ inode = tnode_get_child(tn, --i); ++ ++ /* only new tnodes will be considered "full" nodes */ ++ if (!tnode_full(tn, inode)) { ++ node_set_parent(inode, tn); + continue; + } + + /* Two nonempty children */ +- newBinNode = tnode_get_child(tn, i/2); +- put_child(newBinNode, 0, left); +- put_child(newBinNode, 1, right); +- +- put_child(tn, i / 2, newBinNode); ++ node_set_parent(tnode_get_child(inode, 1), inode); ++ node_set_parent(tnode_get_child(inode, 0), inode); + + /* resize child node */ +- resize(t, newBinNode); ++ resize(t, inode); + } + +- put_child_root(tp, t, tn->key, tn); +- + /* all pointers should be clean so we are done */ + tnode_free(oldtnode); + diff --git a/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch b/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch new file mode 100644 index 000000000..8f7c671ac --- /dev/null +++ b/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch @@ -0,0 +1,95 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:57:02 -0800 +Subject: [PATCH] fib_trie: Remove checks for index >= tnode_child_length + from tnode_get_child + +For some reason the compiler doesn't seem to understand that when we are in +a loop that runs from tnode_child_length - 1 to 0 we don't expect the value +of tn->bits to change. As such every call to tnode_get_child was rerunning +tnode_chile_length which ended up consuming quite a bit of space in the +resultant assembly code. + +I have gone though and verified that in all cases where tnode_get_child +is used we are either winding though a fixed loop from tnode_child_length - +1 to 0, or are in a fastpath case where we are verifying the value by +either checking for any remaining bits after shifting index by bits and +testing for leaf, or by using tnode_child_length. + +size net/ipv4/fib_trie.o +Before: + text data bss dec hex filename + 15506 376 8 15890 3e12 net/ipv4/fib_trie.o + +After: + text data bss dec hex filename + 14827 376 8 15211 3b6b net/ipv4/fib_trie.o + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -186,8 +186,6 @@ static inline unsigned long tnode_child_ + static inline struct tnode *tnode_get_child(const struct tnode *tn, + unsigned long i) + { +- BUG_ON(i >= tnode_child_length(tn)); +- + return rtnl_dereference(tn->child[i]); + } + +@@ -195,8 +193,6 @@ static inline struct tnode *tnode_get_ch + static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, + unsigned long i) + { +- BUG_ON(i >= tnode_child_length(tn)); +- + return rcu_dereference_rtnl(tn->child[i]); + } + +@@ -371,7 +367,7 @@ static inline int tnode_full(const struc + */ + static void put_child(struct tnode *tn, unsigned long i, struct tnode *n) + { +- struct tnode *chi = rtnl_dereference(tn->child[i]); ++ struct tnode *chi = tnode_get_child(tn, i); + int isfull, wasfull; + + BUG_ON(i >= tnode_child_length(tn)); +@@ -867,7 +863,7 @@ static struct tnode *fib_find_node(struc + if (IS_LEAF(n)) + break; + +- n = rcu_dereference_rtnl(n->child[index]); ++ n = tnode_get_child_rcu(n, index); + } + + return n; +@@ -934,7 +930,7 @@ static struct list_head *fib_insert_node + } + + tp = n; +- n = rcu_dereference_rtnl(n->child[index]); ++ n = tnode_get_child_rcu(n, index); + } + + l = leaf_new(key); +@@ -1215,7 +1211,7 @@ int fib_table_lookup(struct fib_table *t + cindex = index; + } + +- n = rcu_dereference(n->child[index]); ++ n = tnode_get_child_rcu(n, index); + if (unlikely(!n)) + goto backtrace; + } +@@ -1835,7 +1831,7 @@ static void trie_collect_stats(struct tr + if (n->bits < MAX_STAT_DEPTH) + s->nodesizes[n->bits]++; + +- for (i = 0; i < tnode_child_length(n); i++) { ++ for (i = tnode_child_length(n); i--;) { + if (!rcu_access_pointer(n->child[i])) + s->nullpointers++; + } diff --git a/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch b/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch new file mode 100644 index 000000000..6a4a45e95 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch @@ -0,0 +1,234 @@ +From: Alexander Duyck +Date: Wed, 31 Dec 2014 10:57:08 -0800 +Subject: [PATCH] fib_trie: Add tracking value for suffix length + +This change adds a tracking value for the maximum suffix length of all +prefixes stored in any given tnode. With this value we can determine if we +need to backtrace or not based on if the suffix is greater than the pos +value. + +By doing this we can reduce the CPU overhead for lookups in the local table +as many of the prefixes there are 32b long and have a suffix length of 0 +meaning we can immediately backtrace to the root node without needing to +test any of the nodes between it and where we ended up. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -96,6 +96,7 @@ struct tnode { + t_key key; + unsigned char bits; /* 2log(KEYLENGTH) bits needed */ + unsigned char pos; /* 2log(KEYLENGTH) bits needed */ ++ unsigned char slen; + struct tnode __rcu *parent; + struct rcu_head rcu; + union { +@@ -311,6 +312,7 @@ static struct tnode *leaf_new(t_key key) + * as the nodes are searched + */ + l->key = key; ++ l->slen = 0; + l->pos = 0; + /* set bits to 0 indicating we are not a tnode */ + l->bits = 0; +@@ -342,6 +344,7 @@ static struct tnode *tnode_new(t_key key + + if (tn) { + tn->parent = NULL; ++ tn->slen = pos; + tn->pos = pos; + tn->bits = bits; + tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; +@@ -387,6 +390,9 @@ static void put_child(struct tnode *tn, + else if (!wasfull && isfull) + tn->full_children++; + ++ if (n && (tn->slen < n->slen)) ++ tn->slen = n->slen; ++ + rcu_assign_pointer(tn->child[i], n); + } + +@@ -635,6 +641,41 @@ static int halve(struct trie *t, struct + return 0; + } + ++static unsigned char update_suffix(struct tnode *tn) ++{ ++ unsigned char slen = tn->pos; ++ unsigned long stride, i; ++ ++ /* search though the list of children looking for nodes that might ++ * have a suffix greater than the one we currently have. This is ++ * why we start with a stride of 2 since a stride of 1 would ++ * represent the nodes with suffix length equal to tn->pos ++ */ ++ for (i = 0, stride = 0x2ul ; i < tnode_child_length(tn); i += stride) { ++ struct tnode *n = tnode_get_child(tn, i); ++ ++ if (!n || (n->slen <= slen)) ++ continue; ++ ++ /* update stride and slen based on new value */ ++ stride <<= (n->slen - slen); ++ slen = n->slen; ++ i &= ~(stride - 1); ++ ++ /* if slen covers all but the last bit we can stop here ++ * there will be nothing longer than that since only node ++ * 0 and 1 << (bits - 1) could have that as their suffix ++ * length. ++ */ ++ if ((slen + 1) >= (tn->pos + tn->bits)) ++ break; ++ } ++ ++ tn->slen = slen; ++ ++ return slen; ++} ++ + /* From "Implementing a dynamic compressed trie" by Stefan Nilsson of + * the Helsinki University of Technology and Matti Tikkanen of Nokia + * Telecommunications, page 6: +@@ -790,6 +831,19 @@ no_children: + /* drop dead node */ + tnode_free_init(tn); + tnode_free(tn); ++ return; ++ } ++ ++ /* Return if at least one deflate was run */ ++ if (max_work != MAX_WORK) ++ return; ++ ++ /* push the suffix length to the parent node */ ++ if (tn->slen > tn->pos) { ++ unsigned char slen = update_suffix(tn); ++ ++ if (tp && (slen > tp->slen)) ++ tp->slen = slen; + } + } + +@@ -818,8 +872,58 @@ static inline struct list_head *get_fa_h + return &li->falh; + } + +-static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new) ++static void leaf_pull_suffix(struct tnode *l) ++{ ++ struct tnode *tp = node_parent(l); ++ ++ while (tp && (tp->slen > tp->pos) && (tp->slen > l->slen)) { ++ if (update_suffix(tp) > l->slen) ++ break; ++ tp = node_parent(tp); ++ } ++} ++ ++static void leaf_push_suffix(struct tnode *l) ++{ ++ struct tnode *tn = node_parent(l); ++ ++ /* if this is a new leaf then tn will be NULL and we can sort ++ * out parent suffix lengths as a part of trie_rebalance ++ */ ++ while (tn && (tn->slen < l->slen)) { ++ tn->slen = l->slen; ++ tn = node_parent(tn); ++ } ++} ++ ++static void remove_leaf_info(struct tnode *l, struct leaf_info *old) ++{ ++ struct hlist_node *prev; ++ ++ /* record the location of the pointer to this object */ ++ prev = rtnl_dereference(hlist_pprev_rcu(&old->hlist)); ++ ++ /* remove the leaf info from the list */ ++ hlist_del_rcu(&old->hlist); ++ ++ /* if we emptied the list this leaf will be freed and we can sort ++ * out parent suffix lengths as a part of trie_rebalance ++ */ ++ if (hlist_empty(&l->list)) ++ return; ++ ++ /* if we removed the tail then we need to update slen */ ++ if (!rcu_access_pointer(hlist_next_rcu(prev))) { ++ struct leaf_info *li = hlist_entry(prev, typeof(*li), hlist); ++ ++ l->slen = KEYLENGTH - li->plen; ++ leaf_pull_suffix(l); ++ } ++} ++ ++static void insert_leaf_info(struct tnode *l, struct leaf_info *new) + { ++ struct hlist_head *head = &l->list; + struct leaf_info *li = NULL, *last = NULL; + + if (hlist_empty(head)) { +@@ -836,6 +940,12 @@ static void insert_leaf_info(struct hlis + else + hlist_add_before_rcu(&new->hlist, &li->hlist); + } ++ ++ /* if we added to the tail node then we need to update slen */ ++ if (!rcu_access_pointer(hlist_next_rcu(&new->hlist))) { ++ l->slen = KEYLENGTH - new->plen; ++ leaf_push_suffix(l); ++ } + } + + /* rcu_read_lock needs to be hold by caller from readside */ +@@ -925,7 +1035,7 @@ static struct list_head *fib_insert_node + /* we have found a leaf. Prefixes have already been compared */ + if (IS_LEAF(n)) { + /* Case 1: n is a leaf, and prefixes match*/ +- insert_leaf_info(&n->list, li); ++ insert_leaf_info(n, li); + return fa_head; + } + +@@ -939,7 +1049,7 @@ static struct list_head *fib_insert_node + return NULL; + } + +- insert_leaf_info(&l->list, li); ++ insert_leaf_info(l, li); + + /* Case 2: n is a LEAF or a TNODE and the key doesn't match. + * +@@ -1206,7 +1316,7 @@ int fib_table_lookup(struct fib_table *t + /* only record pn and cindex if we are going to be chopping + * bits later. Otherwise we are just wasting cycles. + */ +- if (index) { ++ if (n->slen > n->pos) { + pn = n; + cindex = index; + } +@@ -1225,7 +1335,7 @@ int fib_table_lookup(struct fib_table *t + * between the key and the prefix exist in the region of + * the lsb and higher in the prefix. + */ +- if (unlikely(prefix_mismatch(key, n))) ++ if (unlikely(prefix_mismatch(key, n)) || (n->slen == n->pos)) + goto backtrace; + + /* exit out and process leaf */ +@@ -1425,7 +1535,7 @@ int fib_table_delete(struct fib_table *t + tb->tb_num_default--; + + if (list_empty(fa_head)) { +- hlist_del_rcu(&li->hlist); ++ remove_leaf_info(l, li); + free_leaf_info(li); + } + diff --git a/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch b/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch new file mode 100644 index 000000000..d5fc11256 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch @@ -0,0 +1,52 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:08 -0800 +Subject: [PATCH] fib_trie: Use index & (~0ul << n->bits) instead of index >> + n->bits + +In doing performance testing and analysis of the changes I recently found +that by shifting the index I had created an unnecessary dependency. + +I have updated the code so that we instead shift a mask by bits and then +just test against that as that should save us about 2 CPU cycles since we +can generate the mask while the key and pos are being processed. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -961,12 +961,12 @@ static struct tnode *fib_find_node(struc + * prefix plus zeros for the bits in the cindex. The index + * is the difference between the key and this value. From + * this we can actually derive several pieces of data. +- * if !(index >> bits) +- * we know the value is cindex +- * else ++ * if (index & (~0ul << bits)) + * we have a mismatch in skip bits and failed ++ * else ++ * we know the value is cindex + */ +- if (index >> n->bits) ++ if (index & (~0ul << n->bits)) + return NULL; + + /* we have found a leaf. Prefixes have already been compared */ +@@ -1301,12 +1301,12 @@ int fib_table_lookup(struct fib_table *t + * prefix plus zeros for the "bits" in the prefix. The index + * is the difference between the key and this value. From + * this we can actually derive several pieces of data. +- * if !(index >> bits) +- * we know the value is child index +- * else ++ * if (index & (~0ul << bits)) + * we have a mismatch in skip bits and failed ++ * else ++ * we know the value is cindex + */ +- if (index >> n->bits) ++ if (index & (~0ul << n->bits)) + break; + + /* we have found a leaf. Prefixes have already been compared */ diff --git a/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch b/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch new file mode 100644 index 000000000..7e2612708 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch @@ -0,0 +1,267 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:14 -0800 +Subject: [PATCH] fib_trie: Fix RCU bug and merge similar bits of inflate/halve + +This patch addresses two issues. + +The first issue is the fact that I believe I had the RCU freeing sequence +slightly out of order. As a result we could get into an issue if a caller +went into a child of a child of the new node, then backtraced into the to be +freed parent, and then attempted to access a child of a child that may have +been consumed in a resize of one of the new nodes children. To resolve this I +have moved the resize after we have freed the oldtnode. The only side effect +of this is that we will now be calling resize on more nodes in the case of +inflate due to the fact that we don't have a good way to test to see if a +full_tnode on the new node was there before or after the allocation. This +should have minimal impact however since the node should already be +correctly size so it is just the cost of calling should_inflate that we +will be taking on the node which is only a couple of cycles. + +The second issue is the fact that inflate and halve were essentially doing +the same thing after the new node was added to the trie replacing the old +one. As such it wasn't really necessary to keep the code in both functions +so I have split it out into two other functions, called replace and +update_children. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -396,8 +396,30 @@ static void put_child(struct tnode *tn, + rcu_assign_pointer(tn->child[i], n); + } + +-static void put_child_root(struct tnode *tp, struct trie *t, +- t_key key, struct tnode *n) ++static void update_children(struct tnode *tn) ++{ ++ unsigned long i; ++ ++ /* update all of the child parent pointers */ ++ for (i = tnode_child_length(tn); i;) { ++ struct tnode *inode = tnode_get_child(tn, --i); ++ ++ if (!inode) ++ continue; ++ ++ /* Either update the children of a tnode that ++ * already belongs to us or update the child ++ * to point to ourselves. ++ */ ++ if (node_parent(inode) == tn) ++ update_children(inode); ++ else ++ node_set_parent(inode, tn); ++ } ++} ++ ++static inline void put_child_root(struct tnode *tp, struct trie *t, ++ t_key key, struct tnode *n) + { + if (tp) + put_child(tp, get_index(key, tp), n); +@@ -434,10 +456,35 @@ static void tnode_free(struct tnode *tn) + } + } + ++static void replace(struct trie *t, struct tnode *oldtnode, struct tnode *tn) ++{ ++ struct tnode *tp = node_parent(oldtnode); ++ unsigned long i; ++ ++ /* setup the parent pointer out of and back into this node */ ++ NODE_INIT_PARENT(tn, tp); ++ put_child_root(tp, t, tn->key, tn); ++ ++ /* update all of the child parent pointers */ ++ update_children(tn); ++ ++ /* all pointers should be clean so we are done */ ++ tnode_free(oldtnode); ++ ++ /* resize children now that oldtnode is freed */ ++ for (i = tnode_child_length(tn); i;) { ++ struct tnode *inode = tnode_get_child(tn, --i); ++ ++ /* resize child node */ ++ if (tnode_full(tn, inode)) ++ resize(t, inode); ++ } ++} ++ + static int inflate(struct trie *t, struct tnode *oldtnode) + { +- struct tnode *inode, *node0, *node1, *tn, *tp; +- unsigned long i, j, k; ++ struct tnode *tn; ++ unsigned long i; + t_key m; + + pr_debug("In inflate\n"); +@@ -446,13 +493,18 @@ static int inflate(struct trie *t, struc + if (!tn) + return -ENOMEM; + ++ /* prepare oldtnode to be freed */ ++ tnode_free_init(oldtnode); ++ + /* Assemble all of the pointers in our cluster, in this case that + * represents all of the pointers out of our allocated nodes that + * point to existing tnodes and the links between our allocated + * nodes. + */ + for (i = tnode_child_length(oldtnode), m = 1u << tn->pos; i;) { +- inode = tnode_get_child(oldtnode, --i); ++ struct tnode *inode = tnode_get_child(oldtnode, --i); ++ struct tnode *node0, *node1; ++ unsigned long j, k; + + /* An empty child */ + if (inode == NULL) +@@ -464,6 +516,9 @@ static int inflate(struct trie *t, struc + continue; + } + ++ /* drop the node in the old tnode free list */ ++ tnode_free_append(oldtnode, inode); ++ + /* An internal node with two children */ + if (inode->bits == 1) { + put_child(tn, 2 * i + 1, tnode_get_child(inode, 1)); +@@ -488,9 +543,9 @@ static int inflate(struct trie *t, struc + node1 = tnode_new(inode->key | m, inode->pos, inode->bits - 1); + if (!node1) + goto nomem; +- tnode_free_append(tn, node1); ++ node0 = tnode_new(inode->key, inode->pos, inode->bits - 1); + +- node0 = tnode_new(inode->key & ~m, inode->pos, inode->bits - 1); ++ tnode_free_append(tn, node1); + if (!node0) + goto nomem; + tnode_free_append(tn, node0); +@@ -512,53 +567,9 @@ static int inflate(struct trie *t, struc + put_child(tn, 2 * i, node0); + } + +- /* setup the parent pointer into and out of this node */ +- tp = node_parent(oldtnode); +- NODE_INIT_PARENT(tn, tp); +- put_child_root(tp, t, tn->key, tn); ++ /* setup the parent pointers into and out of this node */ ++ replace(t, oldtnode, tn); + +- /* prepare oldtnode to be freed */ +- tnode_free_init(oldtnode); +- +- /* update all child nodes parent pointers to route to us */ +- for (i = tnode_child_length(oldtnode); i;) { +- inode = tnode_get_child(oldtnode, --i); +- +- /* A leaf or an internal node with skipped bits */ +- if (!tnode_full(oldtnode, inode)) { +- node_set_parent(inode, tn); +- continue; +- } +- +- /* drop the node in the old tnode free list */ +- tnode_free_append(oldtnode, inode); +- +- /* fetch new nodes */ +- node1 = tnode_get_child(tn, 2 * i + 1); +- node0 = tnode_get_child(tn, 2 * i); +- +- /* bits == 1 then node0 and node1 represent inode's children */ +- if (inode->bits == 1) { +- node_set_parent(node1, tn); +- node_set_parent(node0, tn); +- continue; +- } +- +- /* update parent pointers in child node's children */ +- for (k = tnode_child_length(inode), j = k / 2; j;) { +- node_set_parent(tnode_get_child(inode, --k), node1); +- node_set_parent(tnode_get_child(inode, --j), node0); +- node_set_parent(tnode_get_child(inode, --k), node1); +- node_set_parent(tnode_get_child(inode, --j), node0); +- } +- +- /* resize child nodes */ +- resize(t, node1); +- resize(t, node0); +- } +- +- /* we completed without error, prepare to free old node */ +- tnode_free(oldtnode); + return 0; + nomem: + /* all pointers should be clean so we are done */ +@@ -568,7 +579,7 @@ nomem: + + static int halve(struct trie *t, struct tnode *oldtnode) + { +- struct tnode *tn, *tp, *inode, *node0, *node1; ++ struct tnode *tn; + unsigned long i; + + pr_debug("In halve\n"); +@@ -577,14 +588,18 @@ static int halve(struct trie *t, struct + if (!tn) + return -ENOMEM; + ++ /* prepare oldtnode to be freed */ ++ tnode_free_init(oldtnode); ++ + /* Assemble all of the pointers in our cluster, in this case that + * represents all of the pointers out of our allocated nodes that + * point to existing tnodes and the links between our allocated + * nodes. + */ + for (i = tnode_child_length(oldtnode); i;) { +- node1 = tnode_get_child(oldtnode, --i); +- node0 = tnode_get_child(oldtnode, --i); ++ struct tnode *node1 = tnode_get_child(oldtnode, --i); ++ struct tnode *node0 = tnode_get_child(oldtnode, --i); ++ struct tnode *inode; + + /* At least one of the children is empty */ + if (!node1 || !node0) { +@@ -609,34 +624,8 @@ static int halve(struct trie *t, struct + put_child(tn, i / 2, inode); + } + +- /* setup the parent pointer out of and back into this node */ +- tp = node_parent(oldtnode); +- NODE_INIT_PARENT(tn, tp); +- put_child_root(tp, t, tn->key, tn); +- +- /* prepare oldtnode to be freed */ +- tnode_free_init(oldtnode); +- +- /* update all of the child parent pointers */ +- for (i = tnode_child_length(tn); i;) { +- inode = tnode_get_child(tn, --i); +- +- /* only new tnodes will be considered "full" nodes */ +- if (!tnode_full(tn, inode)) { +- node_set_parent(inode, tn); +- continue; +- } +- +- /* Two nonempty children */ +- node_set_parent(tnode_get_child(inode, 1), inode); +- node_set_parent(tnode_get_child(inode, 0), inode); +- +- /* resize child node */ +- resize(t, inode); +- } +- +- /* all pointers should be clean so we are done */ +- tnode_free(oldtnode); ++ /* setup the parent pointers into and out of this node */ ++ replace(t, oldtnode, tn); + + return 0; + } diff --git a/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch b/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch new file mode 100644 index 000000000..058b33bf9 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch @@ -0,0 +1,61 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:20 -0800 +Subject: [PATCH] fib_trie: Fall back to slen update on inflate/halve failure + +This change corrects an issue where if inflate or halve fails we were +exiting the resize function without at least updating the slen for the +node. To correct this I have moved the update of max_size into the while +loop so that it is only decremented on a successful call to either inflate +or halve. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -752,7 +752,7 @@ static void resize(struct trie *t, struc + { + struct tnode *tp = node_parent(tn), *n = NULL; + struct tnode __rcu **cptr; +- int max_work; ++ int max_work = MAX_WORK; + + pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", + tn, inflate_threshold, halve_threshold); +@@ -775,8 +775,7 @@ static void resize(struct trie *t, struc + /* Double as long as the resulting node has a number of + * nonempty nodes that are above the threshold. + */ +- max_work = MAX_WORK; +- while (should_inflate(tp, tn) && max_work--) { ++ while (should_inflate(tp, tn) && max_work) { + if (inflate(t, tn)) { + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(t->stats->resize_node_skipped); +@@ -784,6 +783,7 @@ static void resize(struct trie *t, struc + break; + } + ++ max_work--; + tn = rtnl_dereference(*cptr); + } + +@@ -794,8 +794,7 @@ static void resize(struct trie *t, struc + /* Halve as long as the number of empty children in this + * node is above threshold. + */ +- max_work = MAX_WORK; +- while (should_halve(tp, tn) && max_work--) { ++ while (should_halve(tp, tn) && max_work) { + if (halve(t, tn)) { + #ifdef CONFIG_IP_FIB_TRIE_STATS + this_cpu_inc(t->stats->resize_node_skipped); +@@ -803,6 +802,7 @@ static void resize(struct trie *t, struc + break; + } + ++ max_work--; + tn = rtnl_dereference(*cptr); + } + diff --git a/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch b/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch new file mode 100644 index 000000000..19b7db7f9 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch @@ -0,0 +1,206 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:26 -0800 +Subject: [PATCH] fib_trie: Add collapse() and should_collapse() to resize + +This patch really does two things. + +First it pulls the logic for determining if we should collapse one node out +of the tree and the actual code doing the collapse into a separate pair of +functions. This helps to make the changes to these areas more readable. + +Second it encodes the upper 32b of the empty_children value onto the +full_children value in the case of bits == KEYLENGTH. By doing this we are +able to handle the case of a 32b node where empty_children would appear to +be 0 when it was actually 1ul << 32. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -83,7 +83,8 @@ + + #define MAX_STAT_DEPTH 32 + +-#define KEYLENGTH (8*sizeof(t_key)) ++#define KEYLENGTH (8*sizeof(t_key)) ++#define KEY_MAX ((t_key)~0) + + typedef unsigned int t_key; + +@@ -102,8 +103,8 @@ struct tnode { + union { + /* The fields in this struct are valid if bits > 0 (TNODE) */ + struct { +- unsigned int full_children; /* KEYLENGTH bits needed */ +- unsigned int empty_children; /* KEYLENGTH bits needed */ ++ t_key empty_children; /* KEYLENGTH bits needed */ ++ t_key full_children; /* KEYLENGTH bits needed */ + struct tnode __rcu *child[0]; + }; + /* This list pointer if valid if bits == 0 (LEAF) */ +@@ -302,6 +303,16 @@ static struct tnode *tnode_alloc(size_t + return vzalloc(size); + } + ++static inline void empty_child_inc(struct tnode *n) ++{ ++ ++n->empty_children ? : ++n->full_children; ++} ++ ++static inline void empty_child_dec(struct tnode *n) ++{ ++ n->empty_children-- ? : n->full_children--; ++} ++ + static struct tnode *leaf_new(t_key key) + { + struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); +@@ -335,7 +346,7 @@ static struct leaf_info *leaf_info_new(i + + static struct tnode *tnode_new(t_key key, int pos, int bits) + { +- size_t sz = offsetof(struct tnode, child[1 << bits]); ++ size_t sz = offsetof(struct tnode, child[1ul << bits]); + struct tnode *tn = tnode_alloc(sz); + unsigned int shift = pos + bits; + +@@ -348,8 +359,10 @@ static struct tnode *tnode_new(t_key key + tn->pos = pos; + tn->bits = bits; + tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; +- tn->full_children = 0; +- tn->empty_children = 1<full_children = 1; ++ else ++ tn->empty_children = 1ul << bits; + } + + pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), +@@ -375,11 +388,11 @@ static void put_child(struct tnode *tn, + + BUG_ON(i >= tnode_child_length(tn)); + +- /* update emptyChildren */ ++ /* update emptyChildren, overflow into fullChildren */ + if (n == NULL && chi != NULL) +- tn->empty_children++; +- else if (n != NULL && chi == NULL) +- tn->empty_children--; ++ empty_child_inc(tn); ++ if (n != NULL && chi == NULL) ++ empty_child_dec(tn); + + /* update fullChildren */ + wasfull = tnode_full(tn, chi); +@@ -630,6 +643,24 @@ static int halve(struct trie *t, struct + return 0; + } + ++static void collapse(struct trie *t, struct tnode *oldtnode) ++{ ++ struct tnode *n, *tp; ++ unsigned long i; ++ ++ /* scan the tnode looking for that one child that might still exist */ ++ for (n = NULL, i = tnode_child_length(oldtnode); !n && i;) ++ n = tnode_get_child(oldtnode, --i); ++ ++ /* compress one level */ ++ tp = node_parent(oldtnode); ++ put_child_root(tp, t, oldtnode->key, n); ++ node_set_parent(n, tp); ++ ++ /* drop dead node */ ++ node_free(oldtnode); ++} ++ + static unsigned char update_suffix(struct tnode *tn) + { + unsigned char slen = tn->pos; +@@ -729,10 +760,12 @@ static bool should_inflate(const struct + + /* Keep root node larger */ + threshold *= tp ? inflate_threshold : inflate_threshold_root; +- used += tn->full_children; + used -= tn->empty_children; ++ used += tn->full_children; + +- return tn->pos && ((50 * used) >= threshold); ++ /* if bits == KEYLENGTH then pos = 0, and will fail below */ ++ ++ return (used > 1) && tn->pos && ((50 * used) >= threshold); + } + + static bool should_halve(const struct tnode *tp, const struct tnode *tn) +@@ -744,13 +777,29 @@ static bool should_halve(const struct tn + threshold *= tp ? halve_threshold : halve_threshold_root; + used -= tn->empty_children; + +- return (tn->bits > 1) && ((100 * used) < threshold); ++ /* if bits == KEYLENGTH then used = 100% on wrap, and will fail below */ ++ ++ return (used > 1) && (tn->bits > 1) && ((100 * used) < threshold); ++} ++ ++static bool should_collapse(const struct tnode *tn) ++{ ++ unsigned long used = tnode_child_length(tn); ++ ++ used -= tn->empty_children; ++ ++ /* account for bits == KEYLENGTH case */ ++ if ((tn->bits == KEYLENGTH) && tn->full_children) ++ used -= KEY_MAX; ++ ++ /* One child or none, time to drop us from the trie */ ++ return used < 2; + } + + #define MAX_WORK 10 + static void resize(struct trie *t, struct tnode *tn) + { +- struct tnode *tp = node_parent(tn), *n = NULL; ++ struct tnode *tp = node_parent(tn); + struct tnode __rcu **cptr; + int max_work = MAX_WORK; + +@@ -764,14 +813,6 @@ static void resize(struct trie *t, struc + cptr = tp ? &tp->child[get_index(tn->key, tp)] : &t->trie; + BUG_ON(tn != rtnl_dereference(*cptr)); + +- /* No children */ +- if (tn->empty_children > (tnode_child_length(tn) - 1)) +- goto no_children; +- +- /* One child */ +- if (tn->empty_children == (tnode_child_length(tn) - 1)) +- goto one_child; +- + /* Double as long as the resulting node has a number of + * nonempty nodes that are above the threshold. + */ +@@ -807,19 +848,8 @@ static void resize(struct trie *t, struc + } + + /* Only one child remains */ +- if (tn->empty_children == (tnode_child_length(tn) - 1)) { +- unsigned long i; +-one_child: +- for (i = tnode_child_length(tn); !n && i;) +- n = tnode_get_child(tn, --i); +-no_children: +- /* compress one level */ +- put_child_root(tp, t, tn->key, n); +- node_set_parent(n, tp); +- +- /* drop dead node */ +- tnode_free_init(tn); +- tnode_free(tn); ++ if (should_collapse(tn)) { ++ collapse(t, tn); + return; + } + diff --git a/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch b/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch new file mode 100644 index 000000000..160fbe1f3 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch @@ -0,0 +1,34 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:33 -0800 +Subject: [PATCH] fib_trie: Use empty_children instead of counting empty nodes + in stats collection + +It doesn't make much sense to count the pointers ourselves when +empty_children already has a count for the number of NULL pointers stored +in the tnode. As such save ourselves the cycles and just use +empty_children. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -1954,16 +1954,10 @@ static void trie_collect_stats(struct tr + hlist_for_each_entry_rcu(li, &n->list, hlist) + ++s->prefixes; + } else { +- unsigned long i; +- + s->tnodes++; + if (n->bits < MAX_STAT_DEPTH) + s->nodesizes[n->bits]++; +- +- for (i = tnode_child_length(n); i--;) { +- if (!rcu_access_pointer(n->child[i])) +- s->nullpointers++; +- } ++ s->nullpointers += n->empty_children; + } + } + rcu_read_unlock(); diff --git a/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch b/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch new file mode 100644 index 000000000..5eba700ca --- /dev/null +++ b/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch @@ -0,0 +1,79 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:39 -0800 +Subject: [PATCH] fib_trie: Move fib_find_alias to file where it is used + +The function fib_find_alias is only accessed by functions in fib_trie.c as +such it makes sense to relocate it and cast it as static so that the +compiler can take advantage of optimizations it can do to it as a local +function. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_lookup.h ++++ b/net/ipv4/fib_lookup.h +@@ -32,7 +32,6 @@ int fib_dump_info(struct sk_buff *skb, u + unsigned int); + void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len, + u32 tb_id, const struct nl_info *info, unsigned int nlm_flags); +-struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio); + + static inline void fib_result_assign(struct fib_result *res, + struct fib_info *fi) +--- a/net/ipv4/fib_semantics.c ++++ b/net/ipv4/fib_semantics.c +@@ -410,24 +410,6 @@ errout: + rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); + } + +-/* Return the first fib alias matching TOS with +- * priority less than or equal to PRIO. +- */ +-struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) +-{ +- if (fah) { +- struct fib_alias *fa; +- list_for_each_entry(fa, fah, fa_list) { +- if (fa->fa_tos > tos) +- continue; +- if (fa->fa_info->fib_priority >= prio || +- fa->fa_tos < tos) +- return fa; +- } +- } +- return NULL; +-} +- + static int fib_detect_death(struct fib_info *fi, int order, + struct fib_info **last_resort, int *last_idx, + int dflt) +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -998,6 +998,26 @@ static struct tnode *fib_find_node(struc + return n; + } + ++/* Return the first fib alias matching TOS with ++ * priority less than or equal to PRIO. ++ */ ++static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) ++{ ++ struct fib_alias *fa; ++ ++ if (!fah) ++ return NULL; ++ ++ list_for_each_entry(fa, fah, fa_list) { ++ if (fa->fa_tos > tos) ++ continue; ++ if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos) ++ return fa; ++ } ++ ++ return NULL; ++} ++ + static void trie_rebalance(struct trie *t, struct tnode *tn) + { + struct tnode *tp; diff --git a/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch b/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch new file mode 100644 index 000000000..c7739d032 --- /dev/null +++ b/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch @@ -0,0 +1,116 @@ +From: Alexander Duyck +Date: Thu, 22 Jan 2015 15:51:45 -0800 +Subject: [PATCH] fib_trie: Various clean-ups for handling slen + +While doing further work on the fib_trie I noted a few items. + +First I was using calls that were far more complicated than they needed to +be for determining when to push/pull the suffix length. I have updated the +code to reflect the simplier logic. + +The second issue is that I realised we weren't necessarily handling the +case of a leaf_info struct surviving a flush. I have updated the logic so +that now we will call pull_suffix in the event of having a leaf info value +left in the leaf after flushing it. + +Signed-off-by: Alexander Duyck +Signed-off-by: David S. Miller +--- + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -917,27 +917,20 @@ static void leaf_push_suffix(struct tnod + + static void remove_leaf_info(struct tnode *l, struct leaf_info *old) + { +- struct hlist_node *prev; +- +- /* record the location of the pointer to this object */ +- prev = rtnl_dereference(hlist_pprev_rcu(&old->hlist)); ++ /* record the location of the previous list_info entry */ ++ struct hlist_node **pprev = old->hlist.pprev; ++ struct leaf_info *li = hlist_entry(pprev, typeof(*li), hlist.next); + + /* remove the leaf info from the list */ + hlist_del_rcu(&old->hlist); + +- /* if we emptied the list this leaf will be freed and we can sort +- * out parent suffix lengths as a part of trie_rebalance +- */ +- if (hlist_empty(&l->list)) ++ /* only access li if it is pointing at the last valid hlist_node */ ++ if (hlist_empty(&l->list) || (*pprev)) + return; + +- /* if we removed the tail then we need to update slen */ +- if (!rcu_access_pointer(hlist_next_rcu(prev))) { +- struct leaf_info *li = hlist_entry(prev, typeof(*li), hlist); +- +- l->slen = KEYLENGTH - li->plen; +- leaf_pull_suffix(l); +- } ++ /* update the trie with the latest suffix length */ ++ l->slen = KEYLENGTH - li->plen; ++ leaf_pull_suffix(l); + } + + static void insert_leaf_info(struct tnode *l, struct leaf_info *new) +@@ -961,7 +954,7 @@ static void insert_leaf_info(struct tnod + } + + /* if we added to the tail node then we need to update slen */ +- if (!rcu_access_pointer(hlist_next_rcu(&new->hlist))) { ++ if (l->slen < (KEYLENGTH - new->plen)) { + l->slen = KEYLENGTH - new->plen; + leaf_push_suffix(l); + } +@@ -1613,6 +1606,7 @@ static int trie_flush_leaf(struct tnode + struct hlist_head *lih = &l->list; + struct hlist_node *tmp; + struct leaf_info *li = NULL; ++ unsigned char plen = KEYLENGTH; + + hlist_for_each_entry_safe(li, tmp, lih, hlist) { + found += trie_flush_list(&li->falh); +@@ -1620,8 +1614,14 @@ static int trie_flush_leaf(struct tnode + if (list_empty(&li->falh)) { + hlist_del_rcu(&li->hlist); + free_leaf_info(li); ++ continue; + } ++ ++ plen = li->plen; + } ++ ++ l->slen = KEYLENGTH - plen; ++ + return found; + } + +@@ -1700,13 +1700,22 @@ int fib_table_flush(struct fib_table *tb + for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) { + found += trie_flush_leaf(l); + +- if (ll && hlist_empty(&ll->list)) +- trie_leaf_remove(t, ll); ++ if (ll) { ++ if (hlist_empty(&ll->list)) ++ trie_leaf_remove(t, ll); ++ else ++ leaf_pull_suffix(ll); ++ } ++ + ll = l; + } + +- if (ll && hlist_empty(&ll->list)) +- trie_leaf_remove(t, ll); ++ if (ll) { ++ if (hlist_empty(&ll->list)) ++ trie_leaf_remove(t, ll); ++ else ++ leaf_pull_suffix(ll); ++ } + + pr_debug("trie_flush found=%d\n", found); + return found; diff --git a/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch b/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch new file mode 100644 index 000000000..fb44df97e --- /dev/null +++ b/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch @@ -0,0 +1,89 @@ +From: Simon Farnsworth +Date: Sun, 1 Mar 2015 10:54:39 +0000 +Subject: [PATCH] pppoe: Use workqueue to die properly when a PADT is received + +When a PADT frame is received, the socket may not be in a good state to +close down the PPP interface. The current implementation handles this by +simply blocking all further PPP traffic, and hoping that the lack of traffic +will trigger the user to investigate. + +Use schedule_work to get to a process context from which we clear down the +PPP interface, in a fashion analogous to hangup on a TTY-based PPP +interface. This causes pppd to disconnect immediately, and allows tools to +take immediate corrective action. + +Note that pppd's rp_pppoe.so plugin has code in it to disable the session +when it disconnects; however, as a consequence of this patch, the session is +already disabled before rp_pppoe.so is asked to disable the session. The +result is a harmless error message: + +Failed to disconnect PPPoE socket: 114 Operation already in progress + +This message is safe to ignore, as long as the error is 114 Operation +already in progress; in that specific case, it means that the PPPoE session +has already been disabled before pppd tried to disable it. + +Signed-off-by: Simon Farnsworth +Tested-by: Dan Williams +Tested-by: Christoph Schulz +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -454,6 +454,18 @@ out: + return NET_RX_DROP; + } + ++static void pppoe_unbind_sock_work(struct work_struct *work) ++{ ++ struct pppox_sock *po = container_of(work, struct pppox_sock, ++ proto.pppoe.padt_work); ++ struct sock *sk = sk_pppox(po); ++ ++ lock_sock(sk); ++ pppox_unbind_sock(sk); ++ release_sock(sk); ++ sock_put(sk); ++} ++ + /************************************************************************ + * + * Receive a PPPoE Discovery frame. +@@ -499,7 +511,8 @@ static int pppoe_disc_rcv(struct sk_buff + } + + bh_unlock_sock(sk); +- sock_put(sk); ++ if (!schedule_work(&po->proto.pppoe.padt_work)) ++ sock_put(sk); + } + + abort: +@@ -612,6 +625,8 @@ static int pppoe_connect(struct socket * + + lock_sock(sk); + ++ INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); ++ + error = -EINVAL; + + if (sockaddr_len != sizeof(struct sockaddr_pppox)) +--- a/include/linux/if_pppox.h ++++ b/include/linux/if_pppox.h +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + + static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) +@@ -32,6 +33,7 @@ struct pppoe_opt { + struct pppoe_addr pa; /* what this socket is bound to*/ + struct sockaddr_pppox relay; /* what socket data will be + relayed to (PPPoE relaying) */ ++ struct work_struct padt_work;/* Work item for handling PADT */ + }; + + struct pptp_opt { diff --git a/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch b/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch new file mode 100644 index 000000000..f592929b3 --- /dev/null +++ b/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch @@ -0,0 +1,25 @@ +From: Joakim Tjernlund +Date: Mon, 20 Apr 2015 21:07:48 +0200 +Subject: [PATCH] pppoe: Lacks DST MAC address check + +A pppoe session is identified by its session ID and MAC address. +Currently pppoe does not check if the received pkg has the correct +MAC address. This is a problem when the eth I/F is in promisc mode +as then any DST MAC address is accepted. + +Signed-off-by: Joakim Tjernlund +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -379,6 +379,9 @@ static int pppoe_rcv_core(struct sock *s + * can't change. + */ + ++ if (skb->pkt_type == PACKET_OTHERHOST) ++ goto abort_kfree; ++ + if (sk->sk_state & PPPOX_BOUND) { + ppp_input(&po->chan, skb); + } else if (sk->sk_state & PPPOX_RELAY) { diff --git a/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch b/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch new file mode 100644 index 000000000..07d64359c --- /dev/null +++ b/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch @@ -0,0 +1,28 @@ +From: Felix Fietkau +Date: Sat, 9 May 2015 23:08:38 +0200 +Subject: [PATCH] pppoe: drop pppoe device in pppoe_unbind_sock_work + +After receiving a PADT and the socket is closed, user space will no +longer drop the reference to the pppoe device. +This leads to errors like this: + +[ 488.570000] unregister_netdevice: waiting for eth0.2 to become free. Usage count = 2 + +Fixes: 287f3a943fe ("pppoe: Use workqueue to die properly when a PADT is received") +Signed-off-by: Felix Fietkau +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -464,6 +464,10 @@ static void pppoe_unbind_sock_work(struc + struct sock *sk = sk_pppox(po); + + lock_sock(sk); ++ if (po->pppoe_dev) { ++ dev_put(po->pppoe_dev); ++ po->pppoe_dev = NULL; ++ } + pppox_unbind_sock(sk); + release_sock(sk); + sock_put(sk); diff --git a/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch b/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch new file mode 100644 index 000000000..8d155eba1 --- /dev/null +++ b/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch @@ -0,0 +1,45 @@ +From: Guillaume Nault +Date: Thu, 19 Nov 2015 12:52:56 +0100 +Subject: [PATCH] ppp: don't set sk_state to PPPOX_ZOMBIE in pppoe_disc_rcv() + +Since 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT +is received"), pppoe_disc_rcv() disconnects the socket by scheduling +pppoe_unbind_sock_work(). This is enough to stop socket transmission +and makes the PPPOX_ZOMBIE state uncessary. + +Signed-off-by: Guillaume Nault +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -500,27 +500,9 @@ static int pppoe_disc_rcv(struct sk_buff + + pn = pppoe_pernet(dev_net(dev)); + po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); +- if (po) { +- struct sock *sk = sk_pppox(po); +- +- bh_lock_sock(sk); +- +- /* If the user has locked the socket, just ignore +- * the packet. With the way two rcv protocols hook into +- * one socket family type, we cannot (easily) distinguish +- * what kind of SKB it is during backlog rcv. +- */ +- if (sock_owned_by_user(sk) == 0) { +- /* We're no longer connect at the PPPOE layer, +- * and must wait for ppp channel to disconnect us. +- */ +- sk->sk_state = PPPOX_ZOMBIE; +- } +- +- bh_unlock_sock(sk); ++ if (po) + if (!schedule_work(&po->proto.pppoe.padt_work)) +- sock_put(sk); +- } ++ sock_put(sk_pppox(po)); + + abort: + kfree_skb(skb); diff --git a/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch b/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch new file mode 100644 index 000000000..28ec03b41 --- /dev/null +++ b/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch @@ -0,0 +1,51 @@ +From: Guillaume Nault +Date: Thu, 19 Nov 2015 12:53:21 +0100 +Subject: [PATCH] ppp: remove PPPOX_ZOMBIE socket state + +PPPOX_ZOMBIE is never set anymore. + +Signed-off-by: Guillaume Nault +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -311,7 +311,7 @@ static void pppoe_flush_dev(struct net_d + lock_sock(sk); + + if (po->pppoe_dev == dev && +- sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { ++ sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { + pppox_unbind_sock(sk); + sk->sk_state_change(sk); + po->pppoe_dev = NULL; +@@ -779,7 +779,7 @@ static int pppoe_ioctl(struct socket *so + struct pppox_sock *relay_po; + + err = -EBUSY; +- if (sk->sk_state & (PPPOX_BOUND | PPPOX_ZOMBIE | PPPOX_DEAD)) ++ if (sk->sk_state & (PPPOX_BOUND | PPPOX_DEAD)) + break; + + err = -ENOTCONN; +--- a/drivers/net/ppp/pppox.c ++++ b/drivers/net/ppp/pppox.c +@@ -58,7 +58,7 @@ void pppox_unbind_sock(struct sock *sk) + { + /* Clear connection to ppp device, if attached. */ + +- if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED | PPPOX_ZOMBIE)) { ++ if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED)) { + ppp_unregister_channel(&pppox_sk(sk)->chan); + sk->sk_state = PPPOX_DEAD; + } +--- a/include/linux/if_pppox.h ++++ b/include/linux/if_pppox.h +@@ -91,7 +91,6 @@ enum { + PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */ + PPPOX_BOUND = 2, /* bound to ppp device */ + PPPOX_RELAY = 4, /* forwarding is enabled */ +- PPPOX_ZOMBIE = 8, /* dead, but still bound to ppp device */ + PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ + }; + diff --git a/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch b/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch new file mode 100644 index 000000000..8637746b5 --- /dev/null +++ b/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch @@ -0,0 +1,82 @@ +From: Guillaume Nault +Date: Thu, 3 Dec 2015 16:49:32 +0100 +Subject: [PATCH] pppoe: fix memory corruption in padt work structure + +pppoe_connect() mustn't touch the padt_work field of pppoe sockets +because that work could be already pending. + +[ 21.473147] BUG: unable to handle kernel NULL pointer dereference at 00000004 +[ 21.474523] IP: [] process_one_work+0x29/0x31c +[ 21.475164] *pde = 00000000 +[ 21.475513] Oops: 0000 [#1] SMP +[ 21.475910] Modules linked in: pppoe pppox ppp_generic slhc crc32c_intel aesni_intel virtio_net xts aes_i586 lrw gf128mul ablk_helper cryptd evdev acpi_cpufreq processor serio_raw button ext4 crc16 mbcache jbd2 virtio_blk virtio_pci virtio_ring virtio +[ 21.476168] CPU: 2 PID: 164 Comm: kworker/2:2 Not tainted 4.4.0-rc1 #1 +[ 21.476168] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 +[ 21.476168] task: f5f83c00 ti: f5e28000 task.ti: f5e28000 +[ 21.476168] EIP: 0060:[] EFLAGS: 00010046 CPU: 2 +[ 21.476168] EIP is at process_one_work+0x29/0x31c +[ 21.484082] EAX: 00000000 EBX: f678b2a0 ECX: 00000004 EDX: 00000000 +[ 21.484082] ESI: f6c69940 EDI: f5e29ef0 EBP: f5e29f0c ESP: f5e29edc +[ 21.484082] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 +[ 21.484082] CR0: 80050033 CR2: 000000a4 CR3: 317ad000 CR4: 00040690 +[ 21.484082] Stack: +[ 21.484082] 00000000 f6c69950 00000000 f6c69940 c0042338 f5e29f0c c1327945 00000000 +[ 21.484082] 00000008 f678b2a0 f6c69940 f678b2b8 f5e29f30 c1043984 f5f83c00 f6c69970 +[ 21.484082] f678b2a0 c10437d3 f6775e80 f678b2a0 c10437d3 f5e29fac c1047059 f5e29f74 +[ 21.484082] Call Trace: +[ 21.484082] [] ? _raw_spin_lock_irq+0x28/0x30 +[ 21.484082] [] worker_thread+0x1b1/0x244 +[ 21.484082] [] ? rescuer_thread+0x229/0x229 +[ 21.484082] [] ? rescuer_thread+0x229/0x229 +[ 21.484082] [] kthread+0x8f/0x94 +[ 21.484082] [] ? _raw_spin_unlock_irq+0x22/0x26 +[ 21.484082] [] ret_from_kernel_thread+0x21/0x38 +[ 21.484082] [] ? kthread_parkme+0x19/0x19 +[ 21.496082] Code: 5d c3 55 89 e5 57 56 53 89 c3 83 ec 24 89 d0 89 55 e0 8d 7d e4 e8 6c d8 ff ff b9 04 00 00 00 89 45 d8 8b 43 24 89 45 dc 8b 45 d8 <8b> 40 04 8b 80 e0 00 00 00 c1 e8 05 24 01 88 45 d7 8b 45 e0 8d +[ 21.496082] EIP: [] process_one_work+0x29/0x31c SS:ESP 0068:f5e29edc +[ 21.496082] CR2: 0000000000000004 +[ 21.496082] ---[ end trace e362cc9cf10dae89 ]--- + +Reported-by: Andrew +Fixes: 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT is received") +Signed-off-by: Guillaume Nault +Signed-off-by: David S. Miller +--- + +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -550,6 +550,9 @@ static int pppoe_create(struct net *net, + sk->sk_family = PF_PPPOX; + sk->sk_protocol = PX_PROTO_OE; + ++ INIT_WORK(&pppox_sk(sk)->proto.pppoe.padt_work, ++ pppoe_unbind_sock_work); ++ + return 0; + } + +@@ -614,8 +617,6 @@ static int pppoe_connect(struct socket * + + lock_sock(sk); + +- INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); +- + error = -EINVAL; + + if (sockaddr_len != sizeof(struct sockaddr_pppox)) +@@ -649,8 +650,13 @@ static int pppoe_connect(struct socket * + po->pppoe_dev = NULL; + } + +- memset(sk_pppox(po) + 1, 0, +- sizeof(struct pppox_sock) - sizeof(struct sock)); ++ po->pppoe_ifindex = 0; ++ memset(&po->pppoe_pa, 0, sizeof(po->pppoe_pa)); ++ memset(&po->pppoe_relay, 0, sizeof(po->pppoe_relay)); ++ memset(&po->chan, 0, sizeof(po->chan)); ++ po->next = NULL; ++ po->num = 0; ++ + sk->sk_state = PPPOX_NONE; + } + diff --git a/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch b/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch new file mode 100644 index 000000000..51f31ea06 --- /dev/null +++ b/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch @@ -0,0 +1,101 @@ +From: Florian Westphal +Date: Thu, 17 Sep 2015 11:24:48 +0100 +Subject: [PATCH] ipv6: ip6_fragment: fix headroom tests and skb leak + +David Woodhouse reports skb_under_panic when we try to push ethernet +header to fragmented ipv6 skbs: + + skbuff: skb_under_panic: text:c1277f1e len:1294 put:14 head:dec98000 + data:dec97ffc tail:0xdec9850a end:0xdec98f40 dev:br-lan +[..] +ip6_finish_output2+0x196/0x4da + +David further debugged this: + [..] offending fragments were arriving here with skb_headroom(skb)==10. + Which is reasonable, being the Solos ADSL card's header of 8 bytes + followed by 2 bytes of PPP frame type. + +The problem is that if netfilter ipv6 defragmentation is used, skb_cow() +in ip6_forward will only see reassembled skb. + +Therefore, headroom is overestimated by 8 bytes (we pulled fragment +header) and we don't check the skbs in the frag_list either. + +We can't do these checks in netfilter defrag since outdev isn't known yet. + +Furthermore, existing tests in ip6_fragment did not consider the fragment +or ipv6 header size when checking headroom of the fraglist skbs. + +While at it, also fix a skb leak on memory allocation -- ip6_fragment +must consume the skb. + +I tested this e1000 driver hacked to not allocate additional headroom +(we end up in slowpath, since LL_RESERVED_SPACE is 16). + +If 2 bytes of headroom are allocated, fastpath is taken (14 byte +ethernet header was pulled, so 16 byte headroom available in all +fragments). + +Reported-by: David Woodhouse +Diagnosed-by: David Woodhouse +Signed-off-by: Florian Westphal +Closes 20532 +--- + +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -602,20 +602,22 @@ int ip6_fragment(struct sk_buff *skb, in + } + mtu -= hlen + sizeof(struct frag_hdr); + ++ hroom = LL_RESERVED_SPACE(rt->dst.dev); + if (skb_has_frag_list(skb)) { + int first_len = skb_pagelen(skb); + struct sk_buff *frag2; + + if (first_len - hlen > mtu || + ((first_len - hlen) & 7) || +- skb_cloned(skb)) ++ skb_cloned(skb) || ++ skb_headroom(skb) < (hroom + sizeof(struct frag_hdr))) + goto slow_path; + + skb_walk_frags(skb, frag) { + /* Correct geometry. */ + if (frag->len > mtu || + ((frag->len & 7) && frag->next) || +- skb_headroom(frag) < hlen) ++ skb_headroom(frag) < (hlen + hroom + sizeof(struct frag_hdr))) + goto slow_path_clean; + + /* Partially cloned skb? */ +@@ -632,8 +634,6 @@ int ip6_fragment(struct sk_buff *skb, in + + err = 0; + offset = 0; +- frag = skb_shinfo(skb)->frag_list; +- skb_frag_list_init(skb); + /* BUILD HEADER */ + + *prevhdr = NEXTHDR_FRAGMENT; +@@ -641,8 +641,11 @@ int ip6_fragment(struct sk_buff *skb, in + if (!tmp_hdr) { + IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), + IPSTATS_MIB_FRAGFAILS); +- return -ENOMEM; ++ err = -ENOMEM; ++ goto fail; + } ++ frag = skb_shinfo(skb)->frag_list; ++ skb_frag_list_init(skb); + + __skb_pull(skb, hlen); + fh = (struct frag_hdr *)__skb_push(skb, sizeof(struct frag_hdr)); +@@ -740,7 +743,6 @@ slow_path: + */ + + *prevhdr = NEXTHDR_FRAGMENT; +- hroom = LL_RESERVED_SPACE(rt->dst.dev); + troom = rt->dst.dev->needed_tailroom; + + /* diff --git a/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch b/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch new file mode 100644 index 000000000..7f9f9266c --- /dev/null +++ b/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch @@ -0,0 +1,54 @@ +From: David Woodhouse +Date: Thu, 17 Sep 2015 11:19:53 +0100 +Subject: [PATCH] solos-pci: Increase headroom on received packets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +A comment in include/linux/skbuff.h says that: + + * Various parts of the networking layer expect at least 32 bytes of + * headroom, you should not reduce this. + +This was demonstrated by a panic when handling fragmented IPv6 packets: +http://marc.info/?l=linux-netdev&m=144236093519172&w=2 + +It's not entirely clear if that comment is still valid — and if it is, +perhaps netif_rx() ought to be enforcing it with a warning. + +But either way, it is rather stupid from a performance point of view +for us to be receiving packets into a buffer which doesn't have enough +room to prepend an Ethernet header — it means that *every* incoming +packet is going to be need to be reallocated. So let's fix that. + +Signed-off-by: David Woodhouse +--- + +--- a/drivers/atm/solos-pci.c ++++ b/drivers/atm/solos-pci.c +@@ -805,7 +805,12 @@ static void solos_bh(unsigned long card_ + continue; + } + +- skb = alloc_skb(size + 1, GFP_ATOMIC); ++ /* Use netdev_alloc_skb() because it adds NET_SKB_PAD of ++ * headroom, and ensures we can route packets back out an ++ * Ethernet interface (for example) without having to ++ * reallocate. Adding NET_IP_ALIGN also ensures that both ++ * PPPoATM and PPPoEoBR2684 packets end up aligned. */ ++ skb = netdev_alloc_skb_ip_align(NULL, size + 1); + if (!skb) { + if (net_ratelimit()) + dev_warn(&card->dev->dev, "Failed to allocate sk_buff for RX\n"); +@@ -869,7 +874,10 @@ static void solos_bh(unsigned long card_ + /* Allocate RX skbs for any ports which need them */ + if (card->using_dma && card->atmdev[port] && + !card->rx_skb[port]) { +- struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, GFP_ATOMIC); ++ /* Unlike the MMIO case (qv) we can't add NET_IP_ALIGN ++ * here; the FPGA can only DMA to addresses which are ++ * aligned to 4 bytes. */ ++ struct sk_buff *skb = dev_alloc_skb(RX_DMA_SIZE); + if (skb) { + SKB_CB(skb)->dma_addr = + pci_map_single(card->dev, skb->data, diff --git a/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch b/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch new file mode 100644 index 000000000..94b61fdab --- /dev/null +++ b/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch @@ -0,0 +1,67 @@ +From de88e9b0354c2e3ff8eae3f97afe43a34f5ed239 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Sat, 13 May 2017 13:03:21 +0200 +Subject: [PATCH] regmap: make LZO cache optional + +Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support +for LZO compression in regcache, but there were never any users added +afterwards. Since LZO support itself has its own size, it currently is +rather a deoptimization. + +So make it optional by introducing a symbol that can be selected by +drivers wanting to make use of it. + +Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code). + +Signed-off-by: Jonas Gorski +--- +I tried using google to find any users (even out-of-tree ones), but at +best I found a single driver submission that was switched to RBTREE in +subsequent resubmissions (MFD_SMSC). + +One could maybe also just drop the code because of no users for 5 years, +but that would be up to the maintainer(s) to decide. + + drivers/base/regmap/Kconfig | 5 ++++- + drivers/base/regmap/Makefile | 3 ++- + drivers/base/regmap/regcache.c | 2 ++ + 3 files changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/base/regmap/Kconfig ++++ b/drivers/base/regmap/Kconfig +@@ -4,9 +4,12 @@ + + config REGMAP + default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) ++ select IRQ_DOMAIN if REGMAP_IRQ ++ bool ++ ++config REGCACHE_COMPRESSED + select LZO_COMPRESS + select LZO_DECOMPRESS +- select IRQ_DOMAIN if REGMAP_IRQ + bool + + config REGMAP_I2C +--- a/drivers/base/regmap/Makefile ++++ b/drivers/base/regmap/Makefile +@@ -1,5 +1,6 @@ + obj-$(CONFIG_REGMAP) += regmap.o regcache.o +-obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o ++obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o ++obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o + obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o + obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o + obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o +--- a/drivers/base/regmap/regcache.c ++++ b/drivers/base/regmap/regcache.c +@@ -21,7 +21,9 @@ + + static const struct regcache_ops *cache_types[] = { + ®cache_rbtree_ops, ++#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED) + ®cache_lzo_ops, ++#endif + ®cache_flat_ops, + }; + diff --git a/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch b/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch new file mode 100644 index 000000000..6c26a47c5 --- /dev/null +++ b/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch @@ -0,0 +1,109 @@ +[linux-unionfs added to Cc] + +On Tue, May 19, 2015 at 09:51:20AM +0200, Bastian Bittorf wrote: +> Hi Miklos, +> +> sorry for writing directly to you, feel free to forward +> this to the appropriate mailinglist. +> +> we have a problem with mainline overlay filesystem on kernel 3.18: +> https://dev.openwrt.org/ticket/19564 +> +> 2 things are odd: +> when the working filesystem is full, overlays fails with: +> +> overlayfs: failed to create directory /overlay/work/work +> +> what is strange, that we call it with: +> +> mount(overlay, "/mnt", "overlay", MS_NOATIME, lowerdir) +> +> see here: +> http://nbd.name/gitweb.cgi?p=fstools.git;a=blob;f=libfstools/mount.c;h=81176ce399b4cd8e2d347c0008c13dec92407f55;hb=e6004000ff15d7bd32cf5663e8690fc94d7ec747#l125 +> +> do you have an idea whats wrong? +> 1) is it really needed, that we need space for creating dir "/overlay/work"? +> 2) why does overlay need "/overlay/work/work"? + +The work directory is needed for atomic copy-up and similar. It is not actually +necessary to mount a read-only overlay. Post 4.0 it is possible to mount the +overlay without workdir (but even then it won't happen automatically in case the +upper fs is full, so this should be fixed in the latest kernel too). + +Could you please try the following patch? If the workdir can't be created it +will fall back to mounting the overlay read-only. + +Thanks, +Miklos + +--- + fs/overlayfs/copy_up.c | 3 +++ + fs/overlayfs/dir.c | 9 +++++++++ + fs/overlayfs/super.c | 12 +++++++++--- + 3 files changed, 21 insertions(+), 3 deletions(-) + +--- a/fs/overlayfs/copy_up.c ++++ b/fs/overlayfs/copy_up.c +@@ -315,6 +315,9 @@ int ovl_copy_up_one(struct dentry *paren + struct cred *override_cred; + char *link = NULL; + ++ if (WARN_ON(!workdir)) ++ return -EROFS; ++ + ovl_path_upper(parent, &parentpath); + upperdir = parentpath.dentry; + +--- a/fs/overlayfs/dir.c ++++ b/fs/overlayfs/dir.c +@@ -222,6 +222,9 @@ static struct dentry *ovl_clear_empty(st + struct kstat stat; + int err; + ++ if (WARN_ON(!workdir)) ++ return ERR_PTR(-EROFS); ++ + err = ovl_lock_rename_workdir(workdir, upperdir); + if (err) + goto out; +@@ -322,6 +325,9 @@ static int ovl_create_over_whiteout(stru + struct dentry *newdentry; + int err; + ++ if (WARN_ON(!workdir)) ++ return -EROFS; ++ + err = ovl_lock_rename_workdir(workdir, upperdir); + if (err) + goto out; +@@ -507,6 +513,9 @@ static int ovl_remove_and_whiteout(struc + int err; + int flags = 0; + ++ if (WARN_ON(!workdir)) ++ return -EROFS; ++ + if (is_dir) { + opaquedir = ovl_check_empty_and_clear(dentry); + err = PTR_ERR(opaquedir); +--- a/fs/overlayfs/super.c ++++ b/fs/overlayfs/super.c +@@ -760,9 +760,15 @@ static int ovl_fill_super(struct super_b + ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); + err = PTR_ERR(ufs->workdir); + if (IS_ERR(ufs->workdir)) { +- pr_err("overlayfs: failed to create directory %s/%s\n", +- ufs->config.workdir, OVL_WORKDIR_NAME); +- goto out_put_lower_mnt; ++ if (err == -ENOSPC || err == -EROFS) { ++ pr_warning("overlayfs: failed to create work directory (%s), mounting read-only\n", err == ENOSPC ? "ENOSPC" : "EROFS"); ++ sb->s_flags |= MS_RDONLY; ++ ufs->workdir = NULL; ++ } else { ++ pr_err("overlayfs: failed to create directory %s/%s\n", ++ ufs->config.workdir, OVL_WORKDIR_NAME); ++ goto out_put_lower_mnt; ++ } + } + + /* diff --git a/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch b/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch new file mode 100644 index 000000000..24aa0752d --- /dev/null +++ b/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -567,6 +567,7 @@ static const struct spi_device_id spi_no + { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, + { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) }, + { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, + + /* SST -- large erase sizes are "overlays", "sectors" are 4K */ + { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, diff --git a/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch b/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch new file mode 100644 index 000000000..fa3ab6a63 --- /dev/null +++ b/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch @@ -0,0 +1,47 @@ +From: Mark Brown +Date: Tue, 9 Dec 2014 19:46:56 +0000 +Subject: [PATCH] spi: Check to see if the device is processing a message + before we idle + +cur_msg is updated under the queue lock and holds the message we are +currently processing. Since currently we only ever do removals in the +pump kthread it doesn't matter in what order we do things but we want +to be able to push things out from the submitting thread so pull the +check to see if we're currently handling a message before we check to +see if the queue is idle. + +Signed-off-by: Mark Brown +--- + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -891,8 +891,16 @@ static void spi_pump_messages(struct kth + bool was_busy = false; + int ret; + +- /* Lock queue and check for queue work */ ++ /* Lock queue */ + spin_lock_irqsave(&master->queue_lock, flags); ++ ++ /* Make sure we are not already running a message */ ++ if (master->cur_msg) { ++ spin_unlock_irqrestore(&master->queue_lock, flags); ++ return; ++ } ++ ++ /* Check if the queue is idle */ + if (list_empty(&master->queue) || !master->running) { + if (!master->busy) { + spin_unlock_irqrestore(&master->queue_lock, flags); +@@ -916,11 +924,6 @@ static void spi_pump_messages(struct kth + return; + } + +- /* Make sure we are not already running a message */ +- if (master->cur_msg) { +- spin_unlock_irqrestore(&master->queue_lock, flags); +- return; +- } + /* Extract head of queue */ + master->cur_msg = + list_first_entry(&master->queue, struct spi_message, queue); diff --git a/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch b/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch new file mode 100644 index 000000000..b74b4cb93 --- /dev/null +++ b/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch @@ -0,0 +1,184 @@ +From: Mark Brown +Date: Tue, 9 Dec 2014 21:38:05 +0000 +Subject: [PATCH] spi: Pump transfers inside calling context for spi_sync() + +If we are using the standard SPI message pump (which all drivers should be +transitioning over to) then special case the message enqueue and instead of +starting the worker thread to push messages to the hardware do so in the +context of the caller if the controller is idle. This avoids a context +switch in the common case where the controller has a single user in a +single thread, for short PIO transfers there may be no need to context +switch away from the calling context to complete the transfer. + +The code is a bit more complex than is desirable in part due to the need +to handle drivers not using the standard queue and in part due to handling +the various combinations of bus locking and asynchronous submission in +interrupt context. + +It is still suboptimal since it will still wake the message pump for each +transfer in order to schedule idling of the hardware and if multiple +contexts are using the controller simultaneously a caller may end up +pumping a message for some random other thread rather than for itself, +and if the thread ends up deferring due to another context idling the +hardware then it will just busy wait. It can, however, have the benefit +of aggregating power up and down of the hardware when a caller performs +a series of transfers back to back without any need for the use of +spi_async(). + +Signed-off-by: Mark Brown +--- + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -882,6 +882,9 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_t + * needs processing and if so call out to the driver to initialize hardware + * and transfer each message. + * ++ * Note that it is called both from the kthread itself and also from ++ * inside spi_sync(); the queue extraction handling at the top of the ++ * function should deal with this safely. + */ + static void spi_pump_messages(struct kthread_work *work) + { +@@ -900,6 +903,13 @@ static void spi_pump_messages(struct kth + return; + } + ++ /* If another context is idling the device then defer */ ++ if (master->idling) { ++ queue_kthread_work(&master->kworker, &master->pump_messages); ++ spin_unlock_irqrestore(&master->queue_lock, flags); ++ return; ++ } ++ + /* Check if the queue is idle */ + if (list_empty(&master->queue) || !master->running) { + if (!master->busy) { +@@ -907,7 +917,9 @@ static void spi_pump_messages(struct kth + return; + } + master->busy = false; ++ master->idling = true; + spin_unlock_irqrestore(&master->queue_lock, flags); ++ + kfree(master->dummy_rx); + master->dummy_rx = NULL; + kfree(master->dummy_tx); +@@ -921,6 +933,10 @@ static void spi_pump_messages(struct kth + pm_runtime_put_autosuspend(master->dev.parent); + } + trace_spi_master_idle(master); ++ ++ spin_lock_irqsave(&master->queue_lock, flags); ++ master->idling = false; ++ spin_unlock_irqrestore(&master->queue_lock, flags); + return; + } + +@@ -1166,12 +1182,9 @@ static int spi_destroy_queue(struct spi_ + return 0; + } + +-/** +- * spi_queued_transfer - transfer function for queued transfers +- * @spi: spi device which is requesting transfer +- * @msg: spi message which is to handled is queued to driver queue +- */ +-static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) ++static int __spi_queued_transfer(struct spi_device *spi, ++ struct spi_message *msg, ++ bool need_pump) + { + struct spi_master *master = spi->master; + unsigned long flags; +@@ -1186,13 +1199,23 @@ static int spi_queued_transfer(struct sp + msg->status = -EINPROGRESS; + + list_add_tail(&msg->queue, &master->queue); +- if (!master->busy) ++ if (!master->busy && need_pump) + queue_kthread_work(&master->kworker, &master->pump_messages); + + spin_unlock_irqrestore(&master->queue_lock, flags); + return 0; + } + ++/** ++ * spi_queued_transfer - transfer function for queued transfers ++ * @spi: spi device which is requesting transfer ++ * @msg: spi message which is to handled is queued to driver queue ++ */ ++static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) ++{ ++ return __spi_queued_transfer(spi, msg, true); ++} ++ + static int spi_master_initialize_queue(struct spi_master *master) + { + int ret; +@@ -2104,19 +2127,46 @@ static int __spi_sync(struct spi_device + DECLARE_COMPLETION_ONSTACK(done); + int status; + struct spi_master *master = spi->master; ++ unsigned long flags; ++ ++ status = __spi_validate(spi, message); ++ if (status != 0) ++ return status; + + message->complete = spi_complete; + message->context = &done; ++ message->spi = spi; + + if (!bus_locked) + mutex_lock(&master->bus_lock_mutex); + +- status = spi_async_locked(spi, message); ++ /* If we're not using the legacy transfer method then we will ++ * try to transfer in the calling context so special case. ++ * This code would be less tricky if we could remove the ++ * support for driver implemented message queues. ++ */ ++ if (master->transfer == spi_queued_transfer) { ++ spin_lock_irqsave(&master->bus_lock_spinlock, flags); ++ ++ trace_spi_message_submit(message); ++ ++ status = __spi_queued_transfer(spi, message, false); ++ ++ spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); ++ } else { ++ status = spi_async_locked(spi, message); ++ } + + if (!bus_locked) + mutex_unlock(&master->bus_lock_mutex); + + if (status == 0) { ++ /* Push out the messages in the calling context if we ++ * can. ++ */ ++ if (master->transfer == spi_queued_transfer) ++ spi_pump_messages(&master->pump_messages); ++ + wait_for_completion(&done); + status = message->status; + } +--- a/include/linux/spi/spi.h ++++ b/include/linux/spi/spi.h +@@ -260,6 +260,7 @@ static inline void spi_unregister_driver + * @pump_messages: work struct for scheduling work to the message pump + * @queue_lock: spinlock to syncronise access to message queue + * @queue: message queue ++ * @idling: the device is entering idle state + * @cur_msg: the currently in-flight message + * @cur_msg_prepared: spi_prepare_message was called for the currently + * in-flight message +@@ -425,6 +426,7 @@ struct spi_master { + spinlock_t queue_lock; + struct list_head queue; + struct spi_message *cur_msg; ++ bool idling; + bool busy; + bool running; + bool rt; diff --git a/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch b/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch new file mode 100644 index 000000000..a5d85be2b --- /dev/null +++ b/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch @@ -0,0 +1,83 @@ +From: Mark Brown +Date: Wed, 10 Dec 2014 13:46:33 +0000 +Subject: [PATCH] spi: Only idle the message pump in the worker kthread + +In order to avoid the situation where the kthread is waiting for another +context to make the hardware idle let the message pump know if it's being +called from the worker thread context and if it isn't then defer to the +worker thread instead of idling the hardware immediately. This will ensure +that if this situation happens we block rather than busy waiting. + +Signed-off-by: Mark Brown +--- + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -875,8 +875,9 @@ void spi_finalize_current_transfer(struc + EXPORT_SYMBOL_GPL(spi_finalize_current_transfer); + + /** +- * spi_pump_messages - kthread work function which processes spi message queue +- * @work: pointer to kthread work struct contained in the master struct ++ * __spi_pump_messages - function which processes spi message queue ++ * @master: master to process queue for ++ * @in_kthread: true if we are in the context of the message pump thread + * + * This function checks if there is any spi message in the queue that + * needs processing and if so call out to the driver to initialize hardware +@@ -886,10 +887,8 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_t + * inside spi_sync(); the queue extraction handling at the top of the + * function should deal with this safely. + */ +-static void spi_pump_messages(struct kthread_work *work) ++static void __spi_pump_messages(struct spi_master *master, bool in_kthread) + { +- struct spi_master *master = +- container_of(work, struct spi_master, pump_messages); + unsigned long flags; + bool was_busy = false; + int ret; +@@ -916,6 +915,15 @@ static void spi_pump_messages(struct kth + spin_unlock_irqrestore(&master->queue_lock, flags); + return; + } ++ ++ /* Only do teardown in the thread */ ++ if (!in_kthread) { ++ queue_kthread_work(&master->kworker, ++ &master->pump_messages); ++ spin_unlock_irqrestore(&master->queue_lock, flags); ++ return; ++ } ++ + master->busy = false; + master->idling = true; + spin_unlock_irqrestore(&master->queue_lock, flags); +@@ -1004,6 +1012,18 @@ static void spi_pump_messages(struct kth + } + } + ++/** ++ * spi_pump_messages - kthread work function which processes spi message queue ++ * @work: pointer to kthread work struct contained in the master struct ++ */ ++static void spi_pump_messages(struct kthread_work *work) ++{ ++ struct spi_master *master = ++ container_of(work, struct spi_master, pump_messages); ++ ++ __spi_pump_messages(master, true); ++} ++ + static int spi_init_queue(struct spi_master *master) + { + struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 }; +@@ -2165,7 +2185,7 @@ static int __spi_sync(struct spi_device + * can. + */ + if (master->transfer == spi_queued_transfer) +- spi_pump_messages(&master->pump_messages); ++ __spi_pump_messages(master, false); + + wait_for_completion(&done); + status = message->status; diff --git a/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch b/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch new file mode 100644 index 000000000..4c5cd596f --- /dev/null +++ b/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch @@ -0,0 +1,146 @@ +From 279c6c7fa64f5763e6b9f05e7ab3840092e702e7 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Mon, 29 Jun 2015 14:57:48 -1000 +Subject: [PATCH] api: fix compatibility of linux/in.h with netinet/in.h + +u +This fixes breakage to iproute2 build with recent kernel headers +caused by: + commit a263653ed798216c0069922d7b5237ca49436007 + Author: Pablo Neira Ayuso + Date: Wed Jun 17 10:28:27 2015 -0500 + + netfilter: don't pull include/linux/netfilter.h from netns headers + +The issue is that definitions in linux/in.h overlap with those +in netinet/in.h. This patch solves this by introducing the same +mechanism as was used to solve the same problem with linux/in6.h + +Signed-off-by: Stephen Hemminger +Signed-off-by: David S. Miller +--- + include/uapi/linux/in.h | 16 +++++++++++++--- + include/uapi/linux/libc-compat.h | 22 ++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 3 deletions(-) + +--- a/include/uapi/linux/in.h ++++ b/include/uapi/linux/in.h +@@ -19,8 +19,10 @@ + #define _UAPI_LINUX_IN_H + + #include ++#include + #include + ++#if __UAPI_DEF_IN_IPPROTO + /* Standard well-defined IP protocols. */ + enum { + IPPROTO_IP = 0, /* Dummy protocol for TCP */ +@@ -73,12 +75,14 @@ enum { + #define IPPROTO_RAW IPPROTO_RAW + IPPROTO_MAX + }; ++#endif + +- ++#if __UAPI_DEF_IN_ADDR + /* Internet address. */ + struct in_addr { + __be32 s_addr; + }; ++#endif + + #define IP_TOS 1 + #define IP_TTL 2 +@@ -154,6 +158,7 @@ struct in_addr { + + /* Request struct for multicast socket ops */ + ++#if __UAPI_DEF_IP_MREQ + struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +@@ -205,14 +210,18 @@ struct group_filter { + #define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ + + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) ++#endif + ++#if __UAPI_DEF_IN_PKTINFO + struct in_pktinfo { + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; + }; ++#endif + + /* Structure describing an Internet (IP) socket address. */ ++#if __UAPI_DEF_SOCKADDR_IN + #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ + struct sockaddr_in { + __kernel_sa_family_t sin_family; /* Address family */ +@@ -224,8 +233,9 @@ struct sockaddr_in { + sizeof(unsigned short int) - sizeof(struct in_addr)]; + }; + #define sin_zero __pad /* for BSD UNIX comp. -FvK */ ++#endif + +- ++#if __UAPI_DEF_IN_CLASS + /* + * Definitions of the bits in an Internet address integer. + * On subnets, host and network parts are found according +@@ -276,7 +286,7 @@ struct sockaddr_in { + #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ + #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ + #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ +- ++#endif + + /* contains the htonl type stuff.. */ + #include +--- a/include/uapi/linux/libc-compat.h ++++ b/include/uapi/linux/libc-compat.h +@@ -56,6 +56,13 @@ + + /* GLIBC headers included first so don't define anything + * that would already be defined. */ ++#define __UAPI_DEF_IN_ADDR 0 ++#define __UAPI_DEF_IN_IPPROTO 0 ++#define __UAPI_DEF_IN_PKTINFO 0 ++#define __UAPI_DEF_IP_MREQ 0 ++#define __UAPI_DEF_SOCKADDR_IN 0 ++#define __UAPI_DEF_IN_CLASS 0 ++ + #define __UAPI_DEF_IN6_ADDR 0 + /* The exception is the in6_addr macros which must be defined + * if the glibc code didn't define them. This guard matches +@@ -76,6 +83,13 @@ + /* Linux headers included first, and we must define everything + * we need. The expectation is that glibc will check the + * __UAPI_DEF_* defines and adjust appropriately. */ ++#define __UAPI_DEF_IN_ADDR 1 ++#define __UAPI_DEF_IN_IPPROTO 1 ++#define __UAPI_DEF_IN_PKTINFO 1 ++#define __UAPI_DEF_IP_MREQ 1 ++#define __UAPI_DEF_SOCKADDR_IN 1 ++#define __UAPI_DEF_IN_CLASS 1 ++ + #define __UAPI_DEF_IN6_ADDR 1 + /* We unconditionally define the in6_addr macros and glibc must + * coordinate. */ +@@ -99,6 +113,14 @@ + * that we need. */ + #else /* !defined(__GLIBC__) */ + ++/* Definitions for in.h */ ++#define __UAPI_DEF_IN_ADDR 1 ++#define __UAPI_DEF_IN_IPPROTO 1 ++#define __UAPI_DEF_IN_PKTINFO 1 ++#define __UAPI_DEF_IP_MREQ 1 ++#define __UAPI_DEF_SOCKADDR_IN 1 ++#define __UAPI_DEF_IN_CLASS 1 ++ + /* Definitions for in6.h */ + #define __UAPI_DEF_IN6_ADDR 1 + #define __UAPI_DEF_IN6_ADDR_ALT 1 diff --git a/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch b/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch new file mode 100644 index 000000000..352bf6de1 --- /dev/null +++ b/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch @@ -0,0 +1,182 @@ +From: Rusty Russell +Date: Tue, 20 Jan 2015 09:07:04 +1030 +Subject: [PATCH] module_arch_freeing_init(): new hook for archs before module->module_init freed. + +Archs have been abusing module_free() to clean up their arch-specific +allocations. Since module_free() is also (ab)used by BPF and trace code, +let's keep it to simple allocations, and provide a hook called before +that. + +This means that avr32, ia64, parisc and s390 no longer need to implement +their own module_free() at all. avr32 doesn't need module_finalize() +either. + +Signed-off-by: Rusty Russell +Cc: Chris Metcalf +Cc: Haavard Skinnemoen +Cc: Hans-Christian Egtvedt +Cc: Tony Luck +Cc: Fenghua Yu +Cc: "James E.J. Bottomley" +Cc: Helge Deller +Cc: Martin Schwidefsky +Cc: Heiko Carstens +Cc: linux-kernel@vger.kernel.org +Cc: linux-ia64@vger.kernel.org +Cc: linux-parisc@vger.kernel.org +Cc: linux-s390@vger.kernel.org + +Origin: backport, https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d453cded05ee219b77815ea194dc36efa5398bca +--- + arch/avr32/kernel/module.c | 13 +------------ + arch/ia64/kernel/module.c | 6 ++---- + arch/parisc/kernel/module.c | 6 +----- + arch/s390/kernel/module.c | 10 +++------- + arch/tile/kernel/module.c | 2 +- + include/linux/moduleloader.h | 2 ++ + kernel/module.c | 7 +++++++ + 7 files changed, 17 insertions(+), 29 deletions(-) + +--- a/arch/avr32/kernel/module.c ++++ b/arch/avr32/kernel/module.c +@@ -19,12 +19,10 @@ + #include + #include + +-void module_free(struct module *mod, void *module_region) ++void module_arch_freeing_init(struct module *mod) + { + vfree(mod->arch.syminfo); + mod->arch.syminfo = NULL; +- +- vfree(module_region); + } + + static inline int check_rela(Elf32_Rela *rela, struct module *module, +@@ -291,12 +289,3 @@ int apply_relocate_add(Elf32_Shdr *sechd + + return ret; + } +- +-int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, +- struct module *module) +-{ +- vfree(module->arch.syminfo); +- module->arch.syminfo = NULL; +- +- return 0; +-} +--- a/arch/ia64/kernel/module.c ++++ b/arch/ia64/kernel/module.c +@@ -305,14 +305,12 @@ plt_target (struct plt_entry *plt) + #endif /* !USE_BRL */ + + void +-module_free (struct module *mod, void *module_region) ++module_arch_freeing_init (struct module *mod) + { +- if (mod && mod->arch.init_unw_table && +- module_region == mod->module_init) { ++ if (mod->arch.init_unw_table) { + unw_remove_unwind_table(mod->arch.init_unw_table); + mod->arch.init_unw_table = NULL; + } +- vfree(module_region); + } + + /* Have we already seen one of these relocations? */ +--- a/arch/parisc/kernel/module.c ++++ b/arch/parisc/kernel/module.c +@@ -298,14 +298,10 @@ static inline unsigned long count_stubs( + } + #endif + +- +-/* Free memory returned from module_alloc */ +-void module_free(struct module *mod, void *module_region) ++void module_arch_freeing_init(struct module *mod) + { + kfree(mod->arch.section); + mod->arch.section = NULL; +- +- vfree(module_region); + } + + /* Additional bytes needed in front of individual sections */ +--- a/arch/s390/kernel/module.c ++++ b/arch/s390/kernel/module.c +@@ -55,14 +55,10 @@ void *module_alloc(unsigned long size) + } + #endif + +-/* Free memory returned from module_alloc */ +-void module_free(struct module *mod, void *module_region) ++void module_arch_freeing_init(struct module *mod) + { +- if (mod) { +- vfree(mod->arch.syminfo); +- mod->arch.syminfo = NULL; +- } +- vfree(module_region); ++ vfree(mod->arch.syminfo); ++ mod->arch.syminfo = NULL; + } + + static void check_rela(Elf_Rela *rela, struct module *me) +--- a/arch/tile/kernel/module.c ++++ b/arch/tile/kernel/module.c +@@ -83,7 +83,7 @@ void module_free(struct module *mod, voi + 0, 0, 0, NULL, NULL, 0); + + /* +- * FIXME: If module_region == mod->module_init, trim exception ++ * FIXME: Add module_arch_freeing_init to trim exception + * table entries. + */ + } +--- a/include/linux/moduleloader.h ++++ b/include/linux/moduleloader.h +@@ -82,4 +82,6 @@ int module_finalize(const Elf_Ehdr *hdr, + /* Any cleanup needed when module leaves. */ + void module_arch_cleanup(struct module *mod); + ++/* Any cleanup before freeing mod->module_init */ ++void module_arch_freeing_init(struct module *mod); + #endif +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -1840,6 +1840,10 @@ void __weak module_arch_cleanup(struct m + { + } + ++void __weak module_arch_freeing_init(struct module *mod) ++{ ++} ++ + /* Free a module, remove from lists, etc. */ + static void free_module(struct module *mod) + { +@@ -1872,6 +1876,7 @@ static void free_module(struct module *m + + /* This may be NULL, but that's OK */ + unset_module_init_ro_nx(mod); ++ module_arch_freeing_init(mod); + module_free(mod, mod->module_init); + kfree(mod->args); + percpu_modfree(mod); +@@ -2983,6 +2988,7 @@ static struct module *layout_and_allocat + static void module_deallocate(struct module *mod, struct load_info *info) + { + percpu_modfree(mod); ++ module_arch_freeing_init(mod); + module_free(mod, mod->module_init); + module_free(mod, mod->module_core); + } +@@ -3105,6 +3111,7 @@ static int do_init_module(struct module + rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); + #endif + unset_module_init_ro_nx(mod); ++ module_arch_freeing_init(mod); + module_free(mod, mod->module_init); + mod->module_init = NULL; + mod->init_size = 0; diff --git a/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch new file mode 100644 index 000000000..a5645596f --- /dev/null +++ b/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch @@ -0,0 +1,82 @@ +From 1e311820ec3055e3f08e687de6564692a7cec675 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 28 Jan 2013 20:06:29 +0100 +Subject: [PATCH 11/12] USB: EHCI: add ignore_oc flag to disable overcurrent + checking + +This patch adds an ignore_oc flag which can be set by EHCI controller +not supporting or wanting to disable overcurrent checking. The EHCI +platform data in include/linux/usb/ehci_pdriver.h is also augmented to +take advantage of this new flag. + +Signed-off-by: Florian Fainelli +--- + drivers/usb/host/ehci-hcd.c | 2 +- + drivers/usb/host/ehci-hub.c | 4 ++-- + drivers/usb/host/ehci-platform.c | 1 + + drivers/usb/host/ehci.h | 1 + + include/linux/usb/ehci_pdriver.h | 1 + + 5 files changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -633,7 +633,7 @@ static int ehci_run (struct usb_hcd *hcd + "USB %x.%x started, EHCI %x.%02x%s\n", + ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), + temp >> 8, temp & 0xff, +- ignore_oc ? ", overcurrent ignored" : ""); ++ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : ""); + + ehci_writel(ehci, INTR_MASK, + &ehci->regs->intr_enable); /* Turn On Interrupts */ +--- a/drivers/usb/host/ehci-hub.c ++++ b/drivers/usb/host/ehci-hub.c +@@ -635,7 +635,7 @@ ehci_hub_status_data (struct usb_hcd *hc + * always set, seem to clear PORT_OCC and PORT_CSC when writing to + * PORT_POWER; that's surprising, but maybe within-spec. + */ +- if (!ignore_oc) ++ if (!ignore_oc && !ehci->ignore_oc) + mask = PORT_CSC | PORT_PEC | PORT_OCC; + else + mask = PORT_CSC | PORT_PEC; +@@ -995,7 +995,7 @@ int ehci_hub_control( + if (temp & PORT_PEC) + status |= USB_PORT_STAT_C_ENABLE << 16; + +- if ((temp & PORT_OCC) && !ignore_oc){ ++ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){ + status |= USB_PORT_STAT_C_OVERCURRENT << 16; + + /* +--- a/drivers/usb/host/ehci-platform.c ++++ b/drivers/usb/host/ehci-platform.c +@@ -226,6 +226,8 @@ static int ehci_platform_probe(struct pl + ehci->big_endian_desc = 1; + if (pdata->big_endian_mmio) + ehci->big_endian_mmio = 1; ++ if (pdata->ignore_oc) ++ ehci->ignore_oc = 1; + + #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO + if (ehci->big_endian_mmio) { +--- a/drivers/usb/host/ehci.h ++++ b/drivers/usb/host/ehci.h +@@ -226,6 +226,7 @@ struct ehci_hcd { /* one per controlle + unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ + unsigned need_oc_pp_cycle:1; /* MPC834X port power */ + unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ ++ unsigned ignore_oc:1; + + /* required for usb32 quirk */ + #define OHCI_CTRL_HCFS (3 << 6) +--- a/include/linux/usb/ehci_pdriver.h ++++ b/include/linux/usb/ehci_pdriver.h +@@ -45,6 +45,7 @@ struct usb_ehci_pdata { + unsigned big_endian_desc:1; + unsigned big_endian_mmio:1; + unsigned no_io_watchdog:1; ++ unsigned ignore_oc:1; + + /* Turn on all power and clocks */ + int (*power_on)(struct platform_device *pdev); diff --git a/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch new file mode 100644 index 000000000..6bbeb93cf --- /dev/null +++ b/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch @@ -0,0 +1,86 @@ +From: Felix Fietkau +Date: Fri, 10 Apr 2015 13:35:29 +0200 +Subject: [PATCH] jffs2: use .rename2 and add RENAME_WHITEOUT support + +It is required for renames on overlayfs + +Signed-off-by: Felix Fietkau +--- + +--- a/fs/jffs2/dir.c ++++ b/fs/jffs2/dir.c +@@ -35,7 +35,7 @@ static int jffs2_mkdir (struct inode *,s + static int jffs2_rmdir (struct inode *,struct dentry *); + static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); + static int jffs2_rename (struct inode *, struct dentry *, +- struct inode *, struct dentry *); ++ struct inode *, struct dentry *, unsigned int); + + const struct file_operations jffs2_dir_operations = + { +@@ -57,7 +57,7 @@ const struct inode_operations jffs2_dir_ + .mkdir = jffs2_mkdir, + .rmdir = jffs2_rmdir, + .mknod = jffs2_mknod, +- .rename = jffs2_rename, ++ .rename2 = jffs2_rename, + .get_acl = jffs2_get_acl, + .set_acl = jffs2_set_acl, + .setattr = jffs2_setattr, +@@ -752,8 +752,27 @@ static int jffs2_mknod (struct inode *di + return ret; + } + ++static int jffs2_whiteout(struct inode *old_dir, struct dentry *old_dentry) ++{ ++ struct dentry *wh; ++ int err; ++ ++ wh = d_alloc(old_dentry->d_parent, &old_dentry->d_name); ++ if (!wh) ++ return -ENOMEM; ++ ++ err = jffs2_mknod(old_dir, wh, S_IFCHR | WHITEOUT_MODE, ++ WHITEOUT_DEV); ++ if (err) ++ return err; ++ ++ d_rehash(wh); ++ return 0; ++} ++ + static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, +- struct inode *new_dir_i, struct dentry *new_dentry) ++ struct inode *new_dir_i, struct dentry *new_dentry, ++ unsigned int flags) + { + int ret; + struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); +@@ -761,6 +780,9 @@ static int jffs2_rename (struct inode *o + uint8_t type; + uint32_t now; + ++ if (flags & ~RENAME_WHITEOUT) ++ return -EINVAL; ++ + /* The VFS will check for us and prevent trying to rename a + * file over a directory and vice versa, but if it's a directory, + * the VFS can't check whether the victim is empty. The filesystem +@@ -824,9 +846,14 @@ static int jffs2_rename (struct inode *o + if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f) + inc_nlink(new_dir_i); + +- /* Unlink the original */ +- ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), +- old_dentry->d_name.name, old_dentry->d_name.len, NULL, now); ++ if (flags & RENAME_WHITEOUT) ++ /* Replace with whiteout */ ++ ret = jffs2_whiteout(old_dir_i, old_dentry); ++ else ++ /* Unlink the original */ ++ ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), ++ old_dentry->d_name.name, ++ old_dentry->d_name.len, NULL, now); + + /* We don't touch inode->i_nlink */ + diff --git a/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch new file mode 100644 index 000000000..e0ed3312a --- /dev/null +++ b/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch @@ -0,0 +1,58 @@ +From: Felix Fietkau +Date: Sat, 25 Apr 2015 12:41:32 +0200 +Subject: [PATCH] jffs2: add RENAME_EXCHANGE support + +Signed-off-by: Felix Fietkau +--- + +--- a/fs/jffs2/dir.c ++++ b/fs/jffs2/dir.c +@@ -780,7 +780,7 @@ static int jffs2_rename (struct inode *o + uint8_t type; + uint32_t now; + +- if (flags & ~RENAME_WHITEOUT) ++ if (flags & ~(RENAME_WHITEOUT | RENAME_EXCHANGE)) + return -EINVAL; + + /* The VFS will check for us and prevent trying to rename a +@@ -788,7 +788,7 @@ static int jffs2_rename (struct inode *o + * the VFS can't check whether the victim is empty. The filesystem + * needs to do that for itself. + */ +- if (new_dentry->d_inode) { ++ if (new_dentry->d_inode && !(flags & RENAME_EXCHANGE)) { + victim_f = JFFS2_INODE_INFO(new_dentry->d_inode); + if (S_ISDIR(new_dentry->d_inode->i_mode)) { + struct jffs2_full_dirent *fd; +@@ -823,7 +823,7 @@ static int jffs2_rename (struct inode *o + if (ret) + return ret; + +- if (victim_f) { ++ if (victim_f && !(flags & RENAME_EXCHANGE)) { + /* There was a victim. Kill it off nicely */ + if (S_ISDIR(new_dentry->d_inode->i_mode)) + clear_nlink(new_dentry->d_inode); +@@ -849,6 +849,12 @@ static int jffs2_rename (struct inode *o + if (flags & RENAME_WHITEOUT) + /* Replace with whiteout */ + ret = jffs2_whiteout(old_dir_i, old_dentry); ++ else if (flags & RENAME_EXCHANGE) ++ /* Replace the original */ ++ ret = jffs2_do_link(c, JFFS2_INODE_INFO(old_dir_i), ++ new_dentry->d_inode->i_ino, type, ++ old_dentry->d_name.name, old_dentry->d_name.len, ++ now); + else + /* Unlink the original */ + ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), +@@ -875,7 +881,7 @@ static int jffs2_rename (struct inode *o + return ret; + } + +- if (S_ISDIR(old_dentry->d_inode->i_mode)) ++ if (S_ISDIR(old_dentry->d_inode->i_mode) && !(flags & RENAME_EXCHANGE)) + drop_nlink(old_dir_i); + + new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); diff --git a/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch new file mode 100644 index 000000000..909611403 --- /dev/null +++ b/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch @@ -0,0 +1,54 @@ +From: Stephen Hemminger +Subject: bridge: allow receiption on disabled port + +When an ethernet device is enslaved to a bridge, and the bridge STP +detects loss of carrier (or operational state down), then normally +packet receiption is blocked. + +This breaks control applications like WPA which maybe expecting to +receive packets to negotiate to bring link up. The bridge needs to +block forwarding packets from these disabled ports, but there is no +hard requirement to not allow local packet delivery. + +Signed-off-by: Stephen Hemminger +Signed-off-by: Felix Fietkau + +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -146,11 +146,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish + static int br_handle_local_finish(struct sk_buff *skb) + { + struct net_bridge_port *p = br_port_get_rcu(skb->dev); +- u16 vid = 0; ++ if (p->state != BR_STATE_DISABLED) { ++ u16 vid = 0; + +- /* check if vlan is allowed, to avoid spoofing */ +- if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) +- br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); ++ /* check if vlan is allowed, to avoid spoofing */ ++ if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) ++ br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); ++ } + return 0; /* process further */ + } + +@@ -224,6 +226,18 @@ rx_handler_result_t br_handle_frame(stru + + forward: + switch (p->state) { ++ case BR_STATE_DISABLED: ++ if (ether_addr_equal(p->br->dev->dev_addr, dest)) ++ skb->pkt_type = PACKET_HOST; ++ ++ if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, ++ br_handle_local_finish)) ++ break; ++ ++ BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; ++ br_pass_frame_up(skb); ++ break; ++ + case BR_STATE_FORWARDING: + rhook = rcu_dereference(br_should_route_hook); + if (rhook) { diff --git a/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch b/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch new file mode 100644 index 000000000..c008aea41 --- /dev/null +++ b/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch @@ -0,0 +1,688 @@ +From 2c58080407554e1bac8fd50d23cb02420524caed Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Mon, 12 Aug 2013 12:50:22 +0200 +Subject: [PATCH] MIPS: partially inline dma ops + +Several DMA ops are no-op on many platforms, and the indirection through +the mips_dma_map_ops function table is causing the compiler to emit +unnecessary code. + +Inlining visibly improves network performance in my tests (on a 24Kc +based system), and also slightly reduces code size of a few drivers. + +Signed-off-by: Felix Fietkau +--- + arch/mips/Kconfig | 4 + + arch/mips/include/asm/dma-mapping.h | 360 +++++++++++++++++++++++++++++++++++- + arch/mips/mm/dma-default.c | 163 ++-------------- + 3 files changed, 373 insertions(+), 154 deletions(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -1450,6 +1450,7 @@ config CPU_CAVIUM_OCTEON + select CPU_SUPPORTS_HUGEPAGES + select USB_EHCI_BIG_ENDIAN_MMIO + select MIPS_L1_CACHE_SHIFT_7 ++ select SYS_HAS_DMA_OPS + help + The Cavium Octeon processor is a highly integrated chip containing + many ethernet hardware widgets for networking tasks. The processor +@@ -1705,6 +1706,9 @@ config MIPS_MALTA_PM + bool + default y + ++config SYS_HAS_DMA_OPS ++ bool ++ + # + # CPU may reorder R->R, R->W, W->R, W->W + # Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC +--- a/arch/mips/include/asm/dma-mapping.h ++++ b/arch/mips/include/asm/dma-mapping.h +@@ -1,9 +1,16 @@ + #ifndef _ASM_DMA_MAPPING_H + #define _ASM_DMA_MAPPING_H + ++#include ++#include ++#include ++#include ++#include ++ + #include + #include + #include ++#include + #include + + #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ +@@ -12,12 +19,48 @@ + + extern struct dma_map_ops *mips_dma_map_ops; + ++void __dma_sync(struct page *page, unsigned long offset, size_t size, ++ enum dma_data_direction direction); ++void *mips_dma_alloc_coherent(struct device *dev, size_t size, ++ dma_addr_t *dma_handle, gfp_t gfp, ++ struct dma_attrs *attrs); ++void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, ++ dma_addr_t dma_handle, struct dma_attrs *attrs); ++ + static inline struct dma_map_ops *get_dma_ops(struct device *dev) + { ++#ifdef CONFIG_SYS_HAS_DMA_OPS + if (dev && dev->archdata.dma_ops) + return dev->archdata.dma_ops; + else + return mips_dma_map_ops; ++#else ++ return NULL; ++#endif ++} ++ ++/* ++ * Warning on the terminology - Linux calls an uncached area coherent; ++ * MIPS terminology calls memory areas with hardware maintained coherency ++ * coherent. ++ */ ++ ++static inline int cpu_needs_post_dma_flush(struct device *dev) ++{ ++#ifndef CONFIG_SYS_HAS_CPU_R10000 ++ return 0; ++#endif ++ return !plat_device_is_coherent(dev) && ++ (boot_cpu_type() == CPU_R10000 || ++ boot_cpu_type() == CPU_R12000 || ++ boot_cpu_type() == CPU_BMIPS5000); ++} ++ ++static inline struct page *dma_addr_to_page(struct device *dev, ++ dma_addr_t dma_addr) ++{ ++ return pfn_to_page( ++ plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT); + } + + static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) +@@ -30,12 +73,304 @@ static inline bool dma_capable(struct de + + static inline void dma_mark_clean(void *addr, size_t size) {} + +-#include ++static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, ++ size_t size, ++ enum dma_data_direction dir, ++ struct dma_attrs *attrs) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ unsigned long offset = (unsigned long)ptr & ~PAGE_MASK; ++ struct page *page = virt_to_page(ptr); ++ dma_addr_t addr; ++ ++ kmemcheck_mark_initialized(ptr, size); ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) { ++ addr = ops->map_page(dev, page, offset, size, dir, attrs); ++ } else { ++ if (!plat_device_is_coherent(dev)) ++ __dma_sync(page, offset, size, dir); ++ ++ addr = plat_map_dma_mem_page(dev, page) + offset; ++ } ++ debug_dma_map_page(dev, page, offset, size, dir, addr, true); ++ return addr; ++} ++ ++static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, ++ size_t size, ++ enum dma_data_direction dir, ++ struct dma_attrs *attrs) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) { ++ ops->unmap_page(dev, addr, size, dir, attrs); ++ } else { ++ if (cpu_needs_post_dma_flush(dev)) ++ __dma_sync(dma_addr_to_page(dev, addr), ++ addr & ~PAGE_MASK, size, dir); ++ ++ plat_unmap_dma_mem(dev, addr, size, dir); ++ } ++ debug_dma_unmap_page(dev, addr, size, dir, true); ++} ++ ++static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, ++ int nents, enum dma_data_direction dir, ++ struct dma_attrs *attrs) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ int i, ents; ++ struct scatterlist *s; ++ ++ for_each_sg(sg, s, nents, i) ++ kmemcheck_mark_initialized(sg_virt(s), s->length); ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) { ++ ents = ops->map_sg(dev, sg, nents, dir, attrs); ++ } else { ++ for_each_sg(sg, s, nents, i) { ++ struct page *page = sg_page(s); ++ ++ if (!plat_device_is_coherent(dev)) ++ __dma_sync(page, s->offset, s->length, dir); ++#ifdef CONFIG_NEED_SG_DMA_LENGTH ++ s->dma_length = s->length; ++#endif ++ s->dma_address = ++ plat_map_dma_mem_page(dev, page) + s->offset; ++ } ++ ents = nents; ++ } ++ debug_dma_map_sg(dev, sg, nents, ents, dir); ++ ++ return ents; ++} ++ ++static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, ++ int nents, enum dma_data_direction dir, ++ struct dma_attrs *attrs) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ struct scatterlist *s; ++ int i; ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ debug_dma_unmap_sg(dev, sg, nents, dir); ++ if (ops) { ++ ops->unmap_sg(dev, sg, nents, dir, attrs); ++ return; ++ } ++ ++ for_each_sg(sg, s, nents, i) { ++ if (!plat_device_is_coherent(dev) && dir != DMA_TO_DEVICE) ++ __dma_sync(sg_page(s), s->offset, s->length, dir); ++ plat_unmap_dma_mem(dev, s->dma_address, s->length, dir); ++ } ++} ++ ++static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, ++ size_t offset, size_t size, ++ enum dma_data_direction dir) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ dma_addr_t addr; ++ ++ kmemcheck_mark_initialized(page_address(page) + offset, size); ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) { ++ addr = ops->map_page(dev, page, offset, size, dir, NULL); ++ } else { ++ if (!plat_device_is_coherent(dev)) ++ __dma_sync(page, offset, size, dir); ++ ++ addr = plat_map_dma_mem_page(dev, page) + offset; ++ } ++ debug_dma_map_page(dev, page, offset, size, dir, addr, false); ++ ++ return addr; ++} ++ ++static inline void dma_unmap_page(struct device *dev, dma_addr_t addr, ++ size_t size, enum dma_data_direction dir) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) { ++ ops->unmap_page(dev, addr, size, dir, NULL); ++ } else { ++ if (cpu_needs_post_dma_flush(dev)) ++ __dma_sync(dma_addr_to_page(dev, addr), ++ addr & ~PAGE_MASK, size, dir); ++ ++ plat_unmap_dma_mem(dev, addr, size, dir); ++ } ++ debug_dma_unmap_page(dev, addr, size, dir, false); ++} ++ ++static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, ++ size_t size, ++ enum dma_data_direction dir) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) ++ ops->sync_single_for_cpu(dev, addr, size, dir); ++ else if (cpu_needs_post_dma_flush(dev)) ++ __dma_sync(dma_addr_to_page(dev, addr), ++ addr & ~PAGE_MASK, size, dir); ++ debug_dma_sync_single_for_cpu(dev, addr, size, dir); ++} ++ ++static inline void dma_sync_single_for_device(struct device *dev, ++ dma_addr_t addr, size_t size, ++ enum dma_data_direction dir) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) ++ ops->sync_single_for_device(dev, addr, size, dir); ++ else if (!plat_device_is_coherent(dev)) ++ __dma_sync(dma_addr_to_page(dev, addr), ++ addr & ~PAGE_MASK, size, dir); ++ debug_dma_sync_single_for_device(dev, addr, size, dir); ++} ++ ++static inline void dma_sync_single_range_for_cpu(struct device *dev, ++ dma_addr_t addr, ++ unsigned long offset, ++ size_t size, ++ enum dma_data_direction dir) ++{ ++ const struct dma_map_ops *ops = get_dma_ops(dev); ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) ++ ops->sync_single_for_cpu(dev, addr + offset, size, dir); ++ else if (cpu_needs_post_dma_flush(dev)) ++ __dma_sync(dma_addr_to_page(dev, addr + offset), ++ (addr + offset) & ~PAGE_MASK, size, dir); ++ debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); ++} ++ ++static inline void dma_sync_single_range_for_device(struct device *dev, ++ dma_addr_t addr, ++ unsigned long offset, ++ size_t size, ++ enum dma_data_direction dir) ++{ ++ const struct dma_map_ops *ops = get_dma_ops(dev); ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) ++ ops->sync_single_for_device(dev, addr + offset, size, dir); ++ else if (!plat_device_is_coherent(dev)) ++ __dma_sync(dma_addr_to_page(dev, addr + offset), ++ (addr + offset) & ~PAGE_MASK, size, dir); ++ debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); ++} ++ ++static inline void ++dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, ++ int nelems, enum dma_data_direction dir) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ struct scatterlist *s; ++ int i; ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) ++ ops->sync_sg_for_cpu(dev, sg, nelems, dir); ++ else if (cpu_needs_post_dma_flush(dev)) { ++ for_each_sg(sg, s, nelems, i) ++ __dma_sync(sg_page(s), s->offset, s->length, dir); ++ } ++ debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir); ++} ++ ++static inline void ++dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, ++ int nelems, enum dma_data_direction dir) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ struct scatterlist *s; ++ int i; ++ ++ BUG_ON(!valid_dma_direction(dir)); ++ if (ops) ++ ops->sync_sg_for_device(dev, sg, nelems, dir); ++ else if (!plat_device_is_coherent(dev)) { ++ for_each_sg(sg, s, nelems, i) ++ __dma_sync(sg_page(s), s->offset, s->length, dir); ++ } ++ debug_dma_sync_sg_for_device(dev, sg, nelems, dir); ++ ++} ++ ++#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) ++#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL) ++#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) ++#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) ++ ++extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, ++ void *cpu_addr, dma_addr_t dma_addr, size_t size); ++ ++/** ++ * dma_mmap_attrs - map a coherent DMA allocation into user space ++ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices ++ * @vma: vm_area_struct describing requested user mapping ++ * @cpu_addr: kernel CPU-view address returned from dma_alloc_attrs ++ * @handle: device-view address returned from dma_alloc_attrs ++ * @size: size of memory originally requested in dma_alloc_attrs ++ * @attrs: attributes of mapping properties requested in dma_alloc_attrs ++ * ++ * Map a coherent DMA buffer previously allocated by dma_alloc_attrs ++ * into user space. The coherent DMA buffer must not be freed by the ++ * driver until the user space mapping has been released. ++ */ ++static inline int ++dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, ++ dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ BUG_ON(!ops); ++ if (ops && ops->mmap) ++ return ops->mmap(dev, vma, cpu_addr, dma_addr, size, attrs); ++ return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size); ++} ++ ++#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) ++ ++int ++dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, ++ void *cpu_addr, dma_addr_t dma_addr, size_t size); ++ ++static inline int ++dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr, ++ dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) ++{ ++ struct dma_map_ops *ops = get_dma_ops(dev); ++ BUG_ON(!ops); ++ if (ops && ops->get_sgtable) ++ return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size, ++ attrs); ++ return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size); ++} ++ ++#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL) ++ + + static inline int dma_supported(struct device *dev, u64 mask) + { + struct dma_map_ops *ops = get_dma_ops(dev); +- return ops->dma_supported(dev, mask); ++ if (ops) ++ return ops->dma_supported(dev, mask); ++ return plat_dma_supported(dev, mask); + } + + static inline int dma_mapping_error(struct device *dev, u64 mask) +@@ -43,7 +378,9 @@ static inline int dma_mapping_error(stru + struct dma_map_ops *ops = get_dma_ops(dev); + + debug_dma_mapping_error(dev, mask); +- return ops->mapping_error(dev, mask); ++ if (ops) ++ return ops->mapping_error(dev, mask); ++ return 0; + } + + static inline int +@@ -54,7 +391,7 @@ dma_set_mask(struct device *dev, u64 mas + if(!dev->dma_mask || !dma_supported(dev, mask)) + return -EIO; + +- if (ops->set_dma_mask) ++ if (ops && ops->set_dma_mask) + return ops->set_dma_mask(dev, mask); + + *dev->dma_mask = mask; +@@ -74,7 +411,11 @@ static inline void *dma_alloc_attrs(stru + void *ret; + struct dma_map_ops *ops = get_dma_ops(dev); + +- ret = ops->alloc(dev, size, dma_handle, gfp, attrs); ++ if (ops) ++ ret = ops->alloc(dev, size, dma_handle, gfp, attrs); ++ else ++ ret = mips_dma_alloc_coherent(dev, size, dma_handle, gfp, ++ attrs); + + debug_dma_alloc_coherent(dev, size, *dma_handle, ret); + +@@ -89,7 +430,10 @@ static inline void dma_free_attrs(struct + { + struct dma_map_ops *ops = get_dma_ops(dev); + +- ops->free(dev, size, vaddr, dma_handle, attrs); ++ if (ops) ++ ops->free(dev, size, vaddr, dma_handle, attrs); ++ else ++ mips_dma_free_coherent(dev, size, vaddr, dma_handle, attrs); + + debug_dma_free_coherent(dev, size, vaddr, dma_handle); + } +--- a/arch/mips/mm/dma-default.c ++++ b/arch/mips/mm/dma-default.c +@@ -26,7 +26,7 @@ + + #ifdef CONFIG_DMA_MAYBE_COHERENT + int coherentio = 0; /* User defined DMA coherency from command line. */ +-EXPORT_SYMBOL_GPL(coherentio); ++EXPORT_SYMBOL(coherentio); + int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ + + static int __init setcoherentio(char *str) +@@ -46,30 +46,6 @@ static int __init setnocoherentio(char * + early_param("nocoherentio", setnocoherentio); + #endif + +-static inline struct page *dma_addr_to_page(struct device *dev, +- dma_addr_t dma_addr) +-{ +- return pfn_to_page( +- plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT); +-} +- +-/* +- * The affected CPUs below in 'cpu_needs_post_dma_flush()' can +- * speculatively fill random cachelines with stale data at any time, +- * requiring an extra flush post-DMA. +- * +- * Warning on the terminology - Linux calls an uncached area coherent; +- * MIPS terminology calls memory areas with hardware maintained coherency +- * coherent. +- */ +-static inline int cpu_needs_post_dma_flush(struct device *dev) +-{ +- return !plat_device_is_coherent(dev) && +- (boot_cpu_type() == CPU_R10000 || +- boot_cpu_type() == CPU_R12000 || +- boot_cpu_type() == CPU_BMIPS5000); +-} +- + static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) + { + gfp_t dma_flag; +@@ -125,8 +101,9 @@ void *dma_alloc_noncoherent(struct devic + } + EXPORT_SYMBOL(dma_alloc_noncoherent); + +-static void *mips_dma_alloc_coherent(struct device *dev, size_t size, +- dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) ++void *mips_dma_alloc_coherent(struct device *dev, size_t size, ++ dma_addr_t *dma_handle, gfp_t gfp, ++ struct dma_attrs *attrs) + { + void *ret; + struct page *page = NULL; +@@ -157,6 +134,7 @@ static void *mips_dma_alloc_coherent(str + + return ret; + } ++EXPORT_SYMBOL(mips_dma_alloc_coherent); + + + void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, +@@ -167,8 +145,8 @@ void dma_free_noncoherent(struct device + } + EXPORT_SYMBOL(dma_free_noncoherent); + +-static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, +- dma_addr_t dma_handle, struct dma_attrs *attrs) ++void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, ++ dma_addr_t dma_handle, struct dma_attrs *attrs) + { + unsigned long addr = (unsigned long) vaddr; + int order = get_order(size); +@@ -188,6 +166,7 @@ static void mips_dma_free_coherent(struc + if (!dma_release_from_contiguous(dev, page, count)) + __free_pages(page, get_order(size)); + } ++EXPORT_SYMBOL(mips_dma_free_coherent); + + static inline void __dma_sync_virtual(void *addr, size_t size, + enum dma_data_direction direction) +@@ -216,8 +195,8 @@ static inline void __dma_sync_virtual(vo + * If highmem is not configured then the bulk of this loop gets + * optimized out. + */ +-static inline void __dma_sync(struct page *page, +- unsigned long offset, size_t size, enum dma_data_direction direction) ++void __dma_sync(struct page *page, unsigned long offset, size_t size, ++ enum dma_data_direction direction) + { + size_t left = size; + +@@ -246,108 +225,7 @@ static inline void __dma_sync(struct pag + left -= len; + } while (left); + } +- +-static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, +- size_t size, enum dma_data_direction direction, struct dma_attrs *attrs) +-{ +- if (cpu_needs_post_dma_flush(dev)) +- __dma_sync(dma_addr_to_page(dev, dma_addr), +- dma_addr & ~PAGE_MASK, size, direction); +- +- plat_unmap_dma_mem(dev, dma_addr, size, direction); +-} +- +-static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg, +- int nents, enum dma_data_direction direction, struct dma_attrs *attrs) +-{ +- int i; +- +- for (i = 0; i < nents; i++, sg++) { +- if (!plat_device_is_coherent(dev)) +- __dma_sync(sg_page(sg), sg->offset, sg->length, +- direction); +-#ifdef CONFIG_NEED_SG_DMA_LENGTH +- sg->dma_length = sg->length; +-#endif +- sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) + +- sg->offset; +- } +- +- return nents; +-} +- +-static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page, +- unsigned long offset, size_t size, enum dma_data_direction direction, +- struct dma_attrs *attrs) +-{ +- if (!plat_device_is_coherent(dev)) +- __dma_sync(page, offset, size, direction); +- +- return plat_map_dma_mem_page(dev, page) + offset; +-} +- +-static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg, +- int nhwentries, enum dma_data_direction direction, +- struct dma_attrs *attrs) +-{ +- int i; +- +- for (i = 0; i < nhwentries; i++, sg++) { +- if (!plat_device_is_coherent(dev) && +- direction != DMA_TO_DEVICE) +- __dma_sync(sg_page(sg), sg->offset, sg->length, +- direction); +- plat_unmap_dma_mem(dev, sg->dma_address, sg->length, direction); +- } +-} +- +-static void mips_dma_sync_single_for_cpu(struct device *dev, +- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) +-{ +- if (cpu_needs_post_dma_flush(dev)) +- __dma_sync(dma_addr_to_page(dev, dma_handle), +- dma_handle & ~PAGE_MASK, size, direction); +-} +- +-static void mips_dma_sync_single_for_device(struct device *dev, +- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) +-{ +- if (!plat_device_is_coherent(dev)) +- __dma_sync(dma_addr_to_page(dev, dma_handle), +- dma_handle & ~PAGE_MASK, size, direction); +-} +- +-static void mips_dma_sync_sg_for_cpu(struct device *dev, +- struct scatterlist *sg, int nelems, enum dma_data_direction direction) +-{ +- int i; +- +- if (cpu_needs_post_dma_flush(dev)) +- for (i = 0; i < nelems; i++, sg++) +- __dma_sync(sg_page(sg), sg->offset, sg->length, +- direction); +-} +- +-static void mips_dma_sync_sg_for_device(struct device *dev, +- struct scatterlist *sg, int nelems, enum dma_data_direction direction) +-{ +- int i; +- +- if (!plat_device_is_coherent(dev)) +- for (i = 0; i < nelems; i++, sg++) +- __dma_sync(sg_page(sg), sg->offset, sg->length, +- direction); +-} +- +-int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) +-{ +- return 0; +-} +- +-int mips_dma_supported(struct device *dev, u64 mask) +-{ +- return plat_dma_supported(dev, mask); +-} ++EXPORT_SYMBOL(__dma_sync); + + void dma_cache_sync(struct device *dev, void *vaddr, size_t size, + enum dma_data_direction direction) +@@ -360,23 +238,10 @@ void dma_cache_sync(struct device *dev, + + EXPORT_SYMBOL(dma_cache_sync); + +-static struct dma_map_ops mips_default_dma_map_ops = { +- .alloc = mips_dma_alloc_coherent, +- .free = mips_dma_free_coherent, +- .map_page = mips_dma_map_page, +- .unmap_page = mips_dma_unmap_page, +- .map_sg = mips_dma_map_sg, +- .unmap_sg = mips_dma_unmap_sg, +- .sync_single_for_cpu = mips_dma_sync_single_for_cpu, +- .sync_single_for_device = mips_dma_sync_single_for_device, +- .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu, +- .sync_sg_for_device = mips_dma_sync_sg_for_device, +- .mapping_error = mips_dma_mapping_error, +- .dma_supported = mips_dma_supported +-}; +- +-struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops; ++#ifdef CONFIG_SYS_HAS_DMA_OPS ++struct dma_map_ops *mips_dma_map_ops = NULL; + EXPORT_SYMBOL(mips_dma_map_ops); ++#endif + + #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) + diff --git a/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch new file mode 100644 index 000000000..bd34f9698 --- /dev/null +++ b/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -0,0 +1,175 @@ +From 173b0add0cff6558f950c0cb1eacfb729d482711 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 17 May 2015 18:48:38 +0200 +Subject: [PATCH 4/8] mtd: part: add generic parsing of linux,part-probe + +This moves the linux,part-probe device tree parsing code from +physmap_of.c to mtdpart.c. Now all drivers can use this feature by just +providing a reference to their device tree node in struct +mtd_part_parser_data. + +Signed-off-by: Hauke Mehrtens +--- + Documentation/devicetree/bindings/mtd/nand.txt | 16 ++++++++++ + drivers/mtd/maps/physmap_of.c | 40 +----------------------- + drivers/mtd/mtdpart.c | 43 ++++++++++++++++++++++++++ + 3 files changed, 60 insertions(+), 39 deletions(-) + +--- a/Documentation/devicetree/bindings/mtd/nand.txt ++++ b/Documentation/devicetree/bindings/mtd/nand.txt +@@ -12,6 +12,22 @@ + - nand-ecc-step-size: integer representing the number of data bytes + that are covered by a single ECC step. + ++- linux,part-probe: list of name as strings of the partition parser ++ which should be used to parse the partition table. ++ They will be tried in the specified ordering and ++ the next one will be used if the previous one ++ failed. ++ ++ Example: linux,part-probe = "cmdlinepart", "ofpart"; ++ ++ This is also the default value, which will be used ++ if this attribute is not specified. It could be ++ that the flash driver in use overwrote the default ++ value and uses some other default. ++ ++ Possible values are: bcm47xxpart, afs, ar7part, ++ ofoldpart, ofpart, bcm63xxpart, RedBoot, cmdlinepart ++ + The ECC strength and ECC step size properties define the correction capability + of a controller. Together, they say a controller can correct "{strength} bit + errors per {size} bytes". +--- a/drivers/mtd/maps/physmap_of.c ++++ b/drivers/mtd/maps/physmap_of.c +@@ -114,45 +114,9 @@ static struct mtd_info *obsolete_probe(s + static const char * const part_probe_types_def[] = { + "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL }; + +-static const char * const *of_get_probes(struct device_node *dp) +-{ +- const char *cp; +- int cplen; +- unsigned int l; +- unsigned int count; +- const char **res; +- +- cp = of_get_property(dp, "linux,part-probe", &cplen); +- if (cp == NULL) +- return part_probe_types_def; +- +- count = 0; +- for (l = 0; l != cplen; l++) +- if (cp[l] == 0) +- count++; +- +- res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); +- count = 0; +- while (cplen > 0) { +- res[count] = cp; +- l = strlen(cp) + 1; +- cp += l; +- cplen -= l; +- count++; +- } +- return res; +-} +- +-static void of_free_probes(const char * const *probes) +-{ +- if (probes != part_probe_types_def) +- kfree(probes); +-} +- + static struct of_device_id of_flash_match[]; + static int of_flash_probe(struct platform_device *dev) + { +- const char * const *part_probe_types; + const struct of_device_id *match; + struct device_node *dp = dev->dev.of_node; + struct resource res; +@@ -302,10 +266,8 @@ static int of_flash_probe(struct platfor + goto err_out; + + ppdata.of_node = dp; +- part_probe_types = of_get_probes(dp); +- mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, ++ mtd_device_parse_register(info->cmtd, part_probe_types_def, &ppdata, + NULL, 0); +- of_free_probes(part_probe_types); + + kfree(mtd_list); + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + + #include "mtdcore.h" +@@ -702,6 +703,40 @@ void deregister_mtd_parser(struct mtd_pa + EXPORT_SYMBOL_GPL(deregister_mtd_parser); + + /* ++ * Parses the linux,part-probe device tree property. ++ * When a non null value is returned it has to be freed with kfree() by ++ * the caller. ++ */ ++static const char * const *of_get_probes(struct device_node *dp) ++{ ++ const char *cp; ++ int cplen; ++ unsigned int l; ++ unsigned int count; ++ const char **res; ++ ++ cp = of_get_property(dp, "linux,part-probe", &cplen); ++ if (cp == NULL) ++ return NULL; ++ ++ count = 0; ++ for (l = 0; l != cplen; l++) ++ if (cp[l] == 0) ++ count++; ++ ++ res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); ++ count = 0; ++ while (cplen > 0) { ++ res[count] = cp; ++ l = strlen(cp) + 1; ++ cp += l; ++ cplen -= l; ++ count++; ++ } ++ return res; ++} ++ ++/* + * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you + * are changing this array! + */ +@@ -737,6 +772,13 @@ int parse_mtd_partitions(struct mtd_info + { + struct mtd_part_parser *parser; + int ret = 0; ++ const char *const *types_of = NULL; ++ ++ if (data && data->of_node) { ++ types_of = of_get_probes(data->of_node); ++ if (types_of != NULL) ++ types = types_of; ++ } + + if (!types) + types = default_mtd_part_types; +@@ -755,6 +797,7 @@ int parse_mtd_partitions(struct mtd_info + break; + } + } ++ kfree(types_of); + return ret; + } + diff --git a/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch b/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch new file mode 100644 index 000000000..926de5fef --- /dev/null +++ b/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch @@ -0,0 +1,92 @@ +From dfe4b4c732365fc1d83c2d2fd9cc18054ae850b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 6 Dec 2015 11:24:05 +0100 +Subject: [PATCH] mtd: bcm47xxpart: don't fail because of bit-flips +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Bit-flip errors may occur on NAND flashes and are harmless. Handle them +gracefully as read content is still reliable and can be parsed. + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/bcm47xxpart.c | 38 ++++++++++++++++++++++---------------- + 1 file changed, 22 insertions(+), 16 deletions(-) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -66,11 +66,13 @@ static const char *bcm47xxpart_trx_data_ + { + uint32_t buf; + size_t bytes_read; ++ int err; + +- if (mtd_read(master, offset, sizeof(buf), &bytes_read, +- (uint8_t *)&buf) < 0) { +- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", +- offset); ++ err = mtd_read(master, offset, sizeof(buf), &bytes_read, ++ (uint8_t *)&buf); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", ++ offset, err); + goto out_default; + } + +@@ -95,6 +97,7 @@ static int bcm47xxpart_parse(struct mtd_ + int trx_part = -1; + int last_trx_part = -1; + int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; ++ int err; + + /* + * Some really old flashes (like AT45DB*) had smaller erasesize-s, but +@@ -128,10 +131,11 @@ static int bcm47xxpart_parse(struct mtd_ + } + + /* Read beginning of the block */ +- if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, +- &bytes_read, (uint8_t *)buf) < 0) { +- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", +- offset); ++ err = mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, ++ &bytes_read, (uint8_t *)buf); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", ++ offset, err); + continue; + } + +@@ -252,10 +256,11 @@ static int bcm47xxpart_parse(struct mtd_ + } + + /* Read middle of the block */ +- if (mtd_read(master, offset + 0x8000, 0x4, +- &bytes_read, (uint8_t *)buf) < 0) { +- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", +- offset); ++ err = mtd_read(master, offset + 0x8000, 0x4, &bytes_read, ++ (uint8_t *)buf); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", ++ offset, err); + continue; + } + +@@ -275,10 +280,11 @@ static int bcm47xxpart_parse(struct mtd_ + } + + offset = master->size - possible_nvram_sizes[i]; +- if (mtd_read(master, offset, 0x4, &bytes_read, +- (uint8_t *)buf) < 0) { +- pr_err("mtd_read error while reading at offset 0x%X!\n", +- offset); ++ err = mtd_read(master, offset, 0x4, &bytes_read, ++ (uint8_t *)buf); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("mtd_read error while reading (offset 0x%X): %d\n", ++ offset, err); + continue; + } + diff --git a/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch b/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch new file mode 100644 index 000000000..a17e39800 --- /dev/null +++ b/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch @@ -0,0 +1,41 @@ +From 9612e686b235dc9e33c8dfb5e6d2ff2b2140fb9d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 16 Jun 2015 21:01:30 +0200 +Subject: [PATCH V2] usb: xhci: make USB_XHCI_PLATFORM selectable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Right now xhci-plat-hcd can be built when using one of platform specific +drivers only (mvebu/rcar). There shouldn't be such limitation as some +platforms may not require any quirks and may want to just use a generic +driver ("generic-xhci" / "xhci-hcd"). + +Signed-off-by: Rafał Miłecki +--- +Greg/Mathias: I'm not sure if it's more like USB subsystem stuff or xHCI +Could you decide which one of you could pick that, please? + +V2: Drop useless "default n", thanks Sergei :) +--- + drivers/usb/host/Kconfig | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -32,7 +32,14 @@ config USB_XHCI_PCI + default y + + config USB_XHCI_PLATFORM +- tristate ++ tristate "Generic xHCI driver for a platform device" ++ ---help--- ++ Adds an xHCI host driver for a generic platform device, which ++ provides a memory space and an irq. ++ It is also a prerequisite for platform specific drivers that ++ implement some extra quirks. ++ ++ If unsure, say N. + + config USB_XHCI_MVEBU + tristate "xHCI support for Marvell Armada 375/38x" diff --git a/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch b/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch new file mode 100644 index 000000000..632384d56 --- /dev/null +++ b/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch @@ -0,0 +1,228 @@ +From 4a0e3e989d66bb7204b163d9cfaa7fa96d0f2023 Mon Sep 17 00:00:00 2001 +From: Enrico Mioso +Date: Wed, 8 Jul 2015 13:05:57 +0200 +Subject: [PATCH] cdc_ncm: Add support for moving NDP to end of NCM frame + +NCM specs are not actually mandating a specific position in the frame for +the NDP (Network Datagram Pointer). However, some Huawei devices will +ignore our aggregates if it is not placed after the datagrams it points +to. Add support for doing just this, in a per-device configurable way. +While at it, update NCM subdrivers, disabling this functionality in all of +them, except in huawei_cdc_ncm where it is enabled instead. +We aren't making any distinction between different Huawei NCM devices, +based on what the vendor driver does. Standard NCM devices are left +unaffected: if they are compliant, they should be always usable, still +stay on the safe side. + +This change has been tested and working with a Huawei E3131 device (which +works regardless of NDP position), a Huawei E3531 (also working both +ways) and an E3372 (which mandates NDP to be after indexed datagrams). + +V1->V2: +- corrected wrong NDP acronym definition +- fixed possible NULL pointer dereference +- patch cleanup +V2->V3: +- Properly account for the NDP size when writing new packets to SKB + +Signed-off-by: Enrico Mioso +Signed-off-by: David S. Miller +--- + drivers/net/usb/cdc_mbim.c | 2 +- + drivers/net/usb/cdc_ncm.c | 61 ++++++++++++++++++++++++++++++++++++---- + drivers/net/usb/huawei_cdc_ncm.c | 7 +++-- + include/linux/usb/cdc_ncm.h | 7 ++++- + 4 files changed, 67 insertions(+), 10 deletions(-) + +--- a/drivers/net/usb/cdc_mbim.c ++++ b/drivers/net/usb/cdc_mbim.c +@@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet * + if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) + goto err; + +- ret = cdc_ncm_bind_common(dev, intf, data_altsetting); ++ ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0); + if (ret) + goto err; + +--- a/drivers/net/usb/cdc_ncm.c ++++ b/drivers/net/usb/cdc_ncm.c +@@ -684,10 +684,12 @@ static void cdc_ncm_free(struct cdc_ncm_ + ctx->tx_curr_skb = NULL; + } + ++ kfree(ctx->delayed_ndp16); ++ + kfree(ctx); + } + +-int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) ++int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) + { + const struct usb_cdc_union_desc *union_desc = NULL; + struct cdc_ncm_ctx *ctx; +@@ -859,6 +861,17 @@ advance: + /* finish setting up the device specific data */ + cdc_ncm_setup(dev); + ++ /* Device-specific flags */ ++ ctx->drvflags = drvflags; ++ ++ /* Allocate the delayed NDP if needed. */ ++ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { ++ ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL); ++ if (!ctx->delayed_ndp16) ++ goto error2; ++ dev_info(&intf->dev, "NDP will be placed at end of frame for this device."); ++ } ++ + /* override ethtool_ops */ + dev->net->ethtool_ops = &cdc_ncm_ethtool_ops; + +@@ -956,8 +969,11 @@ static int cdc_ncm_bind(struct usbnet *d + if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) + return -ENODEV; + +- /* The NCM data altsetting is fixed */ +- return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); ++ /* The NCM data altsetting is fixed, so we hard-coded it. ++ * Additionally, generic NCM devices are assumed to accept arbitrarily ++ * placed NDP. ++ */ ++ return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM, 0); + } + + static void cdc_ncm_align_tail(struct sk_buff *skb, size_t modulus, size_t remainder, size_t max) +@@ -979,6 +995,14 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm + struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data; + size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex); + ++ /* If NDP should be moved to the end of the NCM package, we can't follow the ++ * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and ++ * the wNdpIndex field in the header is actually not consistent with reality. It will be later. ++ */ ++ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) ++ if (ctx->delayed_ndp16->dwSignature == sign) ++ return ctx->delayed_ndp16; ++ + /* follow the chain of NDPs, looking for a match */ + while (ndpoffset) { + ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); +@@ -988,7 +1012,8 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm + } + + /* align new NDP */ +- cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); ++ if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) ++ cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); + + /* verify that there is room for the NDP and the datagram (reserve) */ + if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size) +@@ -1001,7 +1026,11 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm + nth16->wNdpIndex = cpu_to_le16(skb->len); + + /* push a new empty NDP */ +- ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); ++ if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) ++ ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); ++ else ++ ndp16 = ctx->delayed_ndp16; ++ + ndp16->dwSignature = sign; + ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16)); + return ndp16; +@@ -1016,6 +1045,15 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev + struct sk_buff *skb_out; + u16 n = 0, index, ndplen; + u8 ready2send = 0; ++ u32 delayed_ndp_size; ++ ++ /* When our NDP gets written in cdc_ncm_ndp(), then skb_out->len gets updated ++ * accordingly. Otherwise, we should check here. ++ */ ++ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) ++ delayed_ndp_size = ctx->max_ndp_size; ++ else ++ delayed_ndp_size = 0; + + /* if there is a remaining skb, it gets priority */ + if (skb != NULL) { +@@ -1070,7 +1108,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev + cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max); + + /* check if we had enough room left for both NDP and frame */ +- if (!ndp16 || skb_out->len + skb->len > ctx->tx_max) { ++ if (!ndp16 || skb_out->len + skb->len + delayed_ndp_size > ctx->tx_max) { + if (n == 0) { + /* won't fit, MTU problem? */ + dev_kfree_skb_any(skb); +@@ -1143,6 +1181,17 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev + /* variables will be reset at next call */ + } + ++ /* If requested, put NDP at end of frame. */ ++ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { ++ nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data; ++ cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max); ++ nth16->wNdpIndex = cpu_to_le16(skb_out->len); ++ memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size); ++ ++ /* Zero out delayed NDP - signature checking will naturally fail. */ ++ ndp16 = memset(ctx->delayed_ndp16, 0, ctx->max_ndp_size); ++ } ++ + /* If collected data size is less or equal ctx->min_tx_pkt + * bytes, we send buffers as it is. If we get more data, it + * would be more efficient for USB HS mobile device with DMA +--- a/drivers/net/usb/huawei_cdc_ncm.c ++++ b/drivers/net/usb/huawei_cdc_ncm.c +@@ -73,11 +73,14 @@ static int huawei_cdc_ncm_bind(struct us + struct usb_driver *subdriver = ERR_PTR(-ENODEV); + int ret = -ENODEV; + struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data; ++ int drvflags = 0; + + /* altsetting should always be 1 for NCM devices - so we hard-coded +- * it here ++ * it here. Some huawei devices will need the NDP part of the NCM package to ++ * be at the end of the frame. + */ +- ret = cdc_ncm_bind_common(usbnet_dev, intf, 1); ++ drvflags |= CDC_NCM_FLAG_NDP_TO_END; ++ ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags); + if (ret) + goto err; + +--- a/include/linux/usb/cdc_ncm.h ++++ b/include/linux/usb/cdc_ncm.h +@@ -80,6 +80,9 @@ + #define CDC_NCM_TIMER_INTERVAL_MIN 5UL + #define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) + ++/* Driver flags */ ++#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ ++ + #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ + (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) + #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) +@@ -103,9 +106,11 @@ struct cdc_ncm_ctx { + + spinlock_t mtx; + atomic_t stop; ++ int drvflags; + + u32 timer_interval; + u32 max_ndp_size; ++ struct usb_cdc_ncm_ndp16 *delayed_ndp16; + + u32 tx_timer_pending; + u32 tx_curr_frame_num; +@@ -133,7 +138,7 @@ struct cdc_ncm_ctx { + }; + + u8 cdc_ncm_select_altsetting(struct usb_interface *intf); +-int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); ++int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); + void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); + struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); + int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); diff --git a/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch b/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch new file mode 100644 index 000000000..c75cc9ded --- /dev/null +++ b/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch @@ -0,0 +1,114 @@ +From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Tue, 3 Nov 2015 11:01:42 +0100 +Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It seems like this device has same vendor and product IDs as G2K +devices, but it has different number of interfaces(4 vs 5) and also +different interface layout which makes it currently unusable: + + usbcore: registered new interface driver qcserial + usbserial: USB Serial support registered for Qualcomm USB modem + usb 2-1.2: unknown number of interfaces: 5 + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -22,6 +22,8 @@ + #define DRIVER_AUTHOR "Qualcomm Inc" + #define DRIVER_DESC "Qualcomm USB Serial driver" + ++#define QUECTEL_EC20_IDPRODUCT 0x9215 ++ + /* standard device layouts supported by this driver */ + enum qcserial_layouts { + QCSERIAL_G2K = 0, /* Gobi 2000 */ +@@ -181,6 +183,38 @@ static const struct usb_device_id id_tab + }; + MODULE_DEVICE_TABLE(usb, id_table); + ++static int handle_quectel_ec20(struct device *dev, int ifnum) ++{ ++ int altsetting = 0; ++ ++ /* ++ * Quectel EC20 Mini PCIe LTE module layout: ++ * 0: DM/DIAG (use libqcdm from ModemManager for communication) ++ * 1: NMEA ++ * 2: AT-capable modem port ++ * 3: Modem interface ++ * 4: NDIS ++ */ ++ switch (ifnum) { ++ case 0: ++ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); ++ break; ++ case 1: ++ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); ++ break; ++ case 2: ++ case 3: ++ dev_dbg(dev, "Quectel EC20 Modem port found\n"); ++ break; ++ case 4: ++ /* Don't claim the QMI/net interface */ ++ altsetting = -1; ++ break; ++ } ++ ++ return altsetting; ++} ++ + static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + { + struct usb_host_interface *intf = serial->interface->cur_altsetting; +@@ -249,6 +283,11 @@ static int qcprobe(struct usb_serial *se + altsetting = -1; + break; + case QCSERIAL_G2K: ++ if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { ++ altsetting = handle_quectel_ec20(dev, ifnum); ++ goto done; ++ } ++ + /* + * Gobi 2K+ USB layout: + * 0: QMI/net diff --git a/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch new file mode 100644 index 000000000..ae3533db1 --- /dev/null +++ b/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch @@ -0,0 +1,91 @@ +From fe29727caa7fe434fcb3166df2a62672bc516b54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Wed, 4 Nov 2015 16:23:37 +0100 +Subject: [PATCH 2/2] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This device has same vendor and product IDs as G2K devices, but it has +different number of interfaces(4 vs 5) and also different interface +layout where EC20 has QMI on interface 4 instead of 0. + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/net/usb/qmi_wwan.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -836,6 +836,7 @@ static const struct usb_device_id produc + {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ + {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ ++ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */ + {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ +@@ -867,6 +868,19 @@ static const struct usb_device_id produc + }; + MODULE_DEVICE_TABLE(usb, products); + ++static bool quectel_ec20_detected(struct usb_interface *intf) ++{ ++ struct usb_device *dev = interface_to_usbdev(intf); ++ ++ if (dev->actconfig && ++ le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && ++ le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && ++ dev->actconfig->desc.bNumInterfaces == 5) ++ return true; ++ ++ return false; ++} ++ + static int qmi_wwan_probe(struct usb_interface *intf, + const struct usb_device_id *prod) + { +@@ -895,6 +909,12 @@ static int qmi_wwan_probe(struct usb_int + return -ENODEV; + } + ++ /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ ++ if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { ++ dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); ++ return -ENODEV; ++ } ++ + return usbnet_probe(intf, id); + } + diff --git a/target/linux/generic/pending-3.18/200-fix_localversion.patch b/target/linux/generic/pending-3.18/200-fix_localversion.patch new file mode 100644 index 000000000..70228bb5f --- /dev/null +++ b/target/linux/generic/pending-3.18/200-fix_localversion.patch @@ -0,0 +1,11 @@ +--- a/scripts/setlocalversion ++++ b/scripts/setlocalversion +@@ -165,7 +165,7 @@ else + # annotated or signed tagged state (as git describe only + # looks at signed or annotated tags - git tag -a/-s) and + # LOCALVERSION= is not specified +- if test "${LOCALVERSION+set}" != "set"; then ++ if test "${CONFIG_LOCALVERSION+set}" != "set"; then + scm=$(scm_version --short) + res="$res${scm:++}" + fi diff --git a/target/linux/generic/pending-3.18/201-extra_optimization.patch b/target/linux/generic/pending-3.18/201-extra_optimization.patch new file mode 100644 index 000000000..5a2396cfa --- /dev/null +++ b/target/linux/generic/pending-3.18/201-extra_optimization.patch @@ -0,0 +1,14 @@ +--- a/Makefile ++++ b/Makefile +@@ -618,9 +618,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-P + KBUILD_AFLAGS += $(call cc-option,-fno-PIE) + + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE +-KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) ++KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION) $(call cc-disable-warning,maybe-uninitialized,) + else +-KBUILD_CFLAGS += -O2 ++KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION) + endif + + # Tell gcc to never replace conditional load with a non-conditional one diff --git a/target/linux/generic/pending-3.18/202-reduce_module_size.patch b/target/linux/generic/pending-3.18/202-reduce_module_size.patch new file mode 100644 index 000000000..60ea5c208 --- /dev/null +++ b/target/linux/generic/pending-3.18/202-reduce_module_size.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -408,7 +408,7 @@ KBUILD_CFLAGS_KERNEL := + KBUILD_AFLAGS := -D__ASSEMBLY__ + KBUILD_AFLAGS_MODULE := -DMODULE + KBUILD_CFLAGS_MODULE := -DMODULE +-KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds ++KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) + + # Read KERNELRELEASE from include/config/kernel.release (if it exists) + KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) diff --git a/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch new file mode 100644 index 000000000..b9d82207a --- /dev/null +++ b/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch @@ -0,0 +1,108 @@ +--- a/scripts/kallsyms.c ++++ b/scripts/kallsyms.c +@@ -58,6 +58,7 @@ static struct addr_range percpu_range = + static struct sym_entry *table; + static unsigned int table_size, table_cnt; + static int all_symbols = 0; ++static int uncompressed = 0; + static int absolute_percpu = 0; + static char symbol_prefix_char = '\0'; + static unsigned long long kernel_start_addr = 0; +@@ -392,6 +393,9 @@ static void write_src(void) + + free(markers); + ++ if (uncompressed) ++ return; ++ + output_label("kallsyms_token_table"); + off = 0; + for (i = 0; i < 256; i++) { +@@ -450,6 +454,9 @@ static void *find_token(unsigned char *s + { + int i; + ++ if (uncompressed) ++ return NULL; ++ + for (i = 0; i < len - 1; i++) { + if (str[i] == token[0] && str[i+1] == token[1]) + return &str[i]; +@@ -522,6 +529,9 @@ static void optimize_result(void) + { + int i, best; + ++ if (uncompressed) ++ return; ++ + /* using the '\0' symbol last allows compress_symbols to use standard + * fast string functions */ + for (i = 255; i >= 0; i--) { +@@ -692,7 +702,9 @@ int main(int argc, char **argv) + } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { + const char *p = &argv[i][14]; + kernel_start_addr = strtoull(p, NULL, 16); +- } else ++ } else if (strcmp(argv[i], "--uncompressed") == 0) ++ uncompressed = 1; ++ else + usage(); + } + } else if (argc != 1) +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1338,6 +1338,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW + the unaligned access emulation. + see arch/parisc/kernel/unaligned.c for reference + ++config KALLSYMS_UNCOMPRESSED ++ bool "Keep kallsyms uncompressed" ++ depends on KALLSYMS ++ help ++ Normally kallsyms contains compressed symbols (using a token table), ++ reducing the uncompressed kernel image size. Keeping the symbol table ++ uncompressed significantly improves the size of this part in compressed ++ kernel images. ++ ++ Say N unless you need compressed kernel images to be small. ++ + config HAVE_PCSPKR_PLATFORM + bool + +--- a/scripts/link-vmlinux.sh ++++ b/scripts/link-vmlinux.sh +@@ -90,6 +90,10 @@ kallsyms() + kallsymopt="${kallsymopt} --absolute-percpu" + fi + ++ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then ++ kallsymopt="${kallsymopt} --uncompressed" ++ fi ++ + local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ + ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" + +--- a/kernel/kallsyms.c ++++ b/kernel/kallsyms.c +@@ -109,6 +109,11 @@ static unsigned int kallsyms_expand_symb + * For every byte on the compressed symbol data, copy the table + * entry for that byte. + */ ++#ifdef CONFIG_KALLSYMS_UNCOMPRESSED ++ memcpy(result, data + 1, len - 1); ++ result += len - 1; ++ len = 0; ++#endif + while (len) { + tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; + data++; +@@ -141,6 +146,9 @@ tail: + */ + static char kallsyms_get_symbol_type(unsigned int off) + { ++#ifdef CONFIG_KALLSYMS_UNCOMPRESSED ++ return kallsyms_names[off + 1]; ++#endif + /* + * Get just the first code, look it up in the token table, + * and return the first char from this token. diff --git a/target/linux/generic/pending-3.18/204-module_strip.patch b/target/linux/generic/pending-3.18/204-module_strip.patch new file mode 100644 index 000000000..2df7ba013 --- /dev/null +++ b/target/linux/generic/pending-3.18/204-module_strip.patch @@ -0,0 +1,190 @@ +From: Felix Fietkau +Subject: [PATCH] build: add a hack for removing non-essential module info + +Signed-off-by: Felix Fietkau +--- +--- a/include/linux/module.h ++++ b/include/linux/module.h +@@ -84,6 +84,7 @@ void trim_init_extable(struct module *m) + + /* Generic info of form tag = "info" */ + #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) ++#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info) + + /* For userspace: you can also call me... */ + #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) +@@ -127,12 +128,12 @@ void trim_init_extable(struct module *m) + * Author(s), use "Name " or just "Name", for multiple + * authors use multiple MODULE_AUTHOR() statements/lines. + */ +-#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) ++#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author) + + /* What your module does. */ +-#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) ++#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description) + +-#ifdef MODULE ++#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED) + /* Creates an alias so file2alias.c can find device table. */ + #define MODULE_DEVICE_TABLE(type, name) \ + extern const typeof(name) __mod_##type##__##name##_device_table \ +@@ -159,7 +160,9 @@ extern const typeof(name) __mod_##type## + */ + + #if defined(MODULE) || !defined(CONFIG_SYSFS) +-#define MODULE_VERSION(_version) MODULE_INFO(version, _version) ++#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version) ++#elif defined(CONFIG_MODULE_STRIPPED) ++#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version) + #else + #define MODULE_VERSION(_version) \ + static struct module_version_attribute ___modver_attr = { \ +@@ -181,7 +184,7 @@ extern const typeof(name) __mod_##type## + /* Optional firmware file (or files) needed by the module + * format is simply firmware file name. Multiple firmware + * files require multiple MODULE_FIRMWARE() specifiers */ +-#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) ++#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware) + + /* Given an address, look for it in the exception tables */ + const struct exception_table_entry *search_exception_tables(unsigned long add); +--- a/include/linux/moduleparam.h ++++ b/include/linux/moduleparam.h +@@ -16,6 +16,16 @@ + /* Chosen so that structs with an unsigned long line up. */ + #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) + ++/* This struct is here for syntactic coherency, it is not used */ ++#define __MODULE_INFO_DISABLED(name) \ ++ struct __UNIQUE_ID(name) {} ++ ++#ifdef CONFIG_MODULE_STRIPPED ++#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name) ++#else ++#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info) ++#endif ++ + #ifdef MODULE + #define __MODULE_INFO(tag, name, info) \ + static const char __UNIQUE_ID(name)[] \ +@@ -23,8 +33,7 @@ static const char __UNIQUE_ID(name)[] + = __stringify(tag) "=" info + #else /* !MODULE */ + /* This struct is here for syntactic coherency, it is not used */ +-#define __MODULE_INFO(tag, name, info) \ +- struct __UNIQUE_ID(name) {} ++#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name) + #endif + #define __MODULE_PARM_TYPE(name, _type) \ + __MODULE_INFO(parmtype, name##type, #name ":" _type) +@@ -32,7 +41,7 @@ static const char __UNIQUE_ID(name)[] + /* One for each parameter, describing how to use it. Some files do + multiple of these per line, so can't just use MODULE_INFO. */ + #define MODULE_PARM_DESC(_parm, desc) \ +- __MODULE_INFO(parm, _parm, #_parm ":" desc) ++ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc) + + struct kernel_param; + +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1987,6 +1987,13 @@ config MODULE_COMPRESS_XZ + + endchoice + ++config MODULE_STRIPPED ++ bool "Reduce module size" ++ depends on MODULES ++ help ++ Remove module parameter descriptions, author info, version, aliases, ++ device tables, etc. ++ + endif # MODULES + + config INIT_ALL_POSSIBLE +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -2699,6 +2699,7 @@ static struct module *setup_load_info(st + + static int check_modinfo(struct module *mod, struct load_info *info, int flags) + { ++#ifndef CONFIG_MODULE_STRIPPED + const char *modmagic = get_modinfo(info, "vermagic"); + int err; + +@@ -2724,6 +2725,7 @@ static int check_modinfo(struct module * + pr_warn("%s: module is from the staging directory, the quality " + "is unknown, you have been warned.\n", mod->name); + } ++#endif + + /* Set up license info based on the info section */ + set_license(mod, get_modinfo(info, "license")); +--- a/scripts/mod/modpost.c ++++ b/scripts/mod/modpost.c +@@ -1758,7 +1758,9 @@ static void read_symbols(char *modname) + symname = remove_dot(info.strtab + sym->st_name); + + handle_modversions(mod, &info, sym, symname); ++#ifndef CONFIG_MODULE_STRIPPED + handle_moddevtable(mod, &info, sym, symname); ++#endif + } + if (!is_vmlinux(modname) || + (is_vmlinux(modname) && vmlinux_section_warnings)) +@@ -1902,7 +1904,9 @@ static void add_header(struct buffer *b, + buf_printf(b, "#include \n"); + buf_printf(b, "#include \n"); + buf_printf(b, "\n"); ++#ifndef CONFIG_MODULE_STRIPPED + buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); ++#endif + buf_printf(b, "\n"); + buf_printf(b, "__visible struct module __this_module\n"); + buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); +@@ -1919,16 +1923,20 @@ static void add_header(struct buffer *b, + + static void add_intree_flag(struct buffer *b, int is_intree) + { ++#ifndef CONFIG_MODULE_STRIPPED + if (is_intree) + buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); ++#endif + } + + static void add_staging_flag(struct buffer *b, const char *name) + { ++#ifndef CONFIG_MODULE_STRIPPED + static const char *staging_dir = "drivers/staging"; + + if (strncmp(staging_dir, name, strlen(staging_dir)) == 0) + buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); ++#endif + } + + /** +@@ -2021,11 +2029,13 @@ static void add_depends(struct buffer *b + + static void add_srcversion(struct buffer *b, struct module *mod) + { ++#ifndef CONFIG_MODULE_STRIPPED + if (mod->srcversion[0]) { + buf_printf(b, "\n"); + buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n", + mod->srcversion); + } ++#endif + } + + static void write_if_changed(struct buffer *b, const char *fname) +@@ -2256,7 +2266,9 @@ int main(int argc, char **argv) + add_staging_flag(&buf, mod->name); + err |= add_versions(&buf, mod); + add_depends(&buf, mod, modules); ++#ifndef CONFIG_MODULE_STRIPPED + add_moddevtable(&buf, mod); ++#endif + add_srcversion(&buf, mod); + + sprintf(fname, "%s.mod.c", mod->name); diff --git a/target/linux/generic/pending-3.18/205-backtrace_module_info.patch b/target/linux/generic/pending-3.18/205-backtrace_module_info.patch new file mode 100644 index 000000000..f83b21ebc --- /dev/null +++ b/target/linux/generic/pending-3.18/205-backtrace_module_info.patch @@ -0,0 +1,36 @@ +--- a/lib/vsprintf.c ++++ b/lib/vsprintf.c +@@ -614,8 +614,10 @@ char *symbol_string(char *buf, char *end + struct printf_spec spec, const char *fmt) + { + unsigned long value; +-#ifdef CONFIG_KALLSYMS + char sym[KSYM_SYMBOL_LEN]; ++#ifndef CONFIG_KALLSYMS ++ struct module *mod; ++ int len; + #endif + + if (fmt[1] == 'R') +@@ -629,15 +631,15 @@ char *symbol_string(char *buf, char *end + sprint_symbol(sym, value); + else + sprint_symbol_no_offset(sym, value); +- +- return string(buf, end, sym, spec); + #else +- spec.field_width = 2 * sizeof(void *); +- spec.flags |= SPECIAL | SMALL | ZEROPAD; +- spec.base = 16; ++ len = snprintf(sym, sizeof(sym), "0x%lx", value); + +- return number(buf, end, value, spec); ++ mod = __module_address(value); ++ if (mod) ++ snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", ++ mod->name, mod->module_core, mod->core_size); + #endif ++ return string(buf, end, sym, spec); + } + + static noinline_for_stack diff --git a/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch b/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch new file mode 100644 index 000000000..dc554de24 --- /dev/null +++ b/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch @@ -0,0 +1,3088 @@ +--- a/scripts/kallsyms.c ++++ b/scripts/kallsyms.c +@@ -22,6 +22,35 @@ + #include + #include + #include ++#ifdef __APPLE__ ++/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */ ++void *memmem (const void *haystack, size_t haystack_len, ++ const void *needle, size_t needle_len) ++{ ++ const char *begin; ++ const char *const last_possible ++ = (const char *) haystack + haystack_len - needle_len; ++ ++ if (needle_len == 0) ++ /* The first occurrence of the empty string is deemed to occur at ++ the beginning of the string. */ ++ return (void *) haystack; ++ ++ /* Sanity check, otherwise the loop might search through the whole ++ memory. */ ++ if (__builtin_expect (haystack_len < needle_len, 0)) ++ return NULL; ++ ++ for (begin = (const char *) haystack; begin <= last_possible; ++begin) ++ if (begin[0] == ((const char *) needle)[0] && ++ !memcmp ((const void *) &begin[1], ++ (const void *) ((const char *) needle + 1), ++ needle_len - 1)) ++ return (void *) begin; ++ ++ return NULL; ++} ++#endif + + #ifndef ARRAY_SIZE + #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) +--- a/scripts/kconfig/Makefile ++++ b/scripts/kconfig/Makefile +@@ -151,6 +151,9 @@ check-lxdialog := $(srctree)/$(src)/lxd + # we really need to do so. (Do not call gcc as part of make mrproper) + HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ + -DLOCALE ++ifeq ($(shell uname -s),Darwin) ++HOST_LOADLIBES += -lncurses ++endif + + # =========================================================================== + # Shared Makefile for the various kconfig executables: +--- a/scripts/mod/mk_elfconfig.c ++++ b/scripts/mod/mk_elfconfig.c +@@ -1,7 +1,11 @@ + #include + #include + #include ++#ifndef __APPLE__ + #include ++#else ++#include "elf.h" ++#endif + + int + main(int argc, char **argv) +--- a/scripts/mod/modpost.h ++++ b/scripts/mod/modpost.h +@@ -7,7 +7,11 @@ + #include + #include + #include ++#if !(defined(__APPLE__) || defined(__CYGWIN__)) + #include ++#else ++#include "elf.h" ++#endif + + #include "elfconfig.h" + +--- /dev/null ++++ b/scripts/mod/elf.h +@@ -0,0 +1,3007 @@ ++/* This file defines standard ELF types, structures, and macros. ++ Copyright (C) 1995-2012 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifndef _ELF_H ++#define _ELF_H 1 ++ ++/* Standard ELF types. */ ++ ++#include ++ ++/* Type for a 16-bit quantity. */ ++typedef uint16_t Elf32_Half; ++typedef uint16_t Elf64_Half; ++ ++/* Types for signed and unsigned 32-bit quantities. */ ++typedef uint32_t Elf32_Word; ++typedef int32_t Elf32_Sword; ++typedef uint32_t Elf64_Word; ++typedef int32_t Elf64_Sword; ++ ++/* Types for signed and unsigned 64-bit quantities. */ ++typedef uint64_t Elf32_Xword; ++typedef int64_t Elf32_Sxword; ++typedef uint64_t Elf64_Xword; ++typedef int64_t Elf64_Sxword; ++ ++/* Type of addresses. */ ++typedef uint32_t Elf32_Addr; ++typedef uint64_t Elf64_Addr; ++ ++/* Type of file offsets. */ ++typedef uint32_t Elf32_Off; ++typedef uint64_t Elf64_Off; ++ ++/* Type for section indices, which are 16-bit quantities. */ ++typedef uint16_t Elf32_Section; ++typedef uint16_t Elf64_Section; ++ ++/* Type for version symbol information. */ ++typedef Elf32_Half Elf32_Versym; ++typedef Elf64_Half Elf64_Versym; ++ ++ ++/* The ELF file header. This appears at the start of every ELF file. */ ++ ++#define EI_NIDENT (16) ++ ++typedef struct ++{ ++ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ ++ Elf32_Half e_type; /* Object file type */ ++ Elf32_Half e_machine; /* Architecture */ ++ Elf32_Word e_version; /* Object file version */ ++ Elf32_Addr e_entry; /* Entry point virtual address */ ++ Elf32_Off e_phoff; /* Program header table file offset */ ++ Elf32_Off e_shoff; /* Section header table file offset */ ++ Elf32_Word e_flags; /* Processor-specific flags */ ++ Elf32_Half e_ehsize; /* ELF header size in bytes */ ++ Elf32_Half e_phentsize; /* Program header table entry size */ ++ Elf32_Half e_phnum; /* Program header table entry count */ ++ Elf32_Half e_shentsize; /* Section header table entry size */ ++ Elf32_Half e_shnum; /* Section header table entry count */ ++ Elf32_Half e_shstrndx; /* Section header string table index */ ++} Elf32_Ehdr; ++ ++typedef struct ++{ ++ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ ++ Elf64_Half e_type; /* Object file type */ ++ Elf64_Half e_machine; /* Architecture */ ++ Elf64_Word e_version; /* Object file version */ ++ Elf64_Addr e_entry; /* Entry point virtual address */ ++ Elf64_Off e_phoff; /* Program header table file offset */ ++ Elf64_Off e_shoff; /* Section header table file offset */ ++ Elf64_Word e_flags; /* Processor-specific flags */ ++ Elf64_Half e_ehsize; /* ELF header size in bytes */ ++ Elf64_Half e_phentsize; /* Program header table entry size */ ++ Elf64_Half e_phnum; /* Program header table entry count */ ++ Elf64_Half e_shentsize; /* Section header table entry size */ ++ Elf64_Half e_shnum; /* Section header table entry count */ ++ Elf64_Half e_shstrndx; /* Section header string table index */ ++} Elf64_Ehdr; ++ ++/* Fields in the e_ident array. The EI_* macros are indices into the ++ array. The macros under each EI_* macro are the values the byte ++ may have. */ ++ ++#define EI_MAG0 0 /* File identification byte 0 index */ ++#define ELFMAG0 0x7f /* Magic number byte 0 */ ++ ++#define EI_MAG1 1 /* File identification byte 1 index */ ++#define ELFMAG1 'E' /* Magic number byte 1 */ ++ ++#define EI_MAG2 2 /* File identification byte 2 index */ ++#define ELFMAG2 'L' /* Magic number byte 2 */ ++ ++#define EI_MAG3 3 /* File identification byte 3 index */ ++#define ELFMAG3 'F' /* Magic number byte 3 */ ++ ++/* Conglomeration of the identification bytes, for easy testing as a word. */ ++#define ELFMAG "\177ELF" ++#define SELFMAG 4 ++ ++#define EI_CLASS 4 /* File class byte index */ ++#define ELFCLASSNONE 0 /* Invalid class */ ++#define ELFCLASS32 1 /* 32-bit objects */ ++#define ELFCLASS64 2 /* 64-bit objects */ ++#define ELFCLASSNUM 3 ++ ++#define EI_DATA 5 /* Data encoding byte index */ ++#define ELFDATANONE 0 /* Invalid data encoding */ ++#define ELFDATA2LSB 1 /* 2's complement, little endian */ ++#define ELFDATA2MSB 2 /* 2's complement, big endian */ ++#define ELFDATANUM 3 ++ ++#define EI_VERSION 6 /* File version byte index */ ++ /* Value must be EV_CURRENT */ ++ ++#define EI_OSABI 7 /* OS ABI identification */ ++#define ELFOSABI_NONE 0 /* UNIX System V ABI */ ++#define ELFOSABI_SYSV 0 /* Alias. */ ++#define ELFOSABI_HPUX 1 /* HP-UX */ ++#define ELFOSABI_NETBSD 2 /* NetBSD. */ ++#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ ++#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ ++#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ ++#define ELFOSABI_AIX 7 /* IBM AIX. */ ++#define ELFOSABI_IRIX 8 /* SGI Irix. */ ++#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ ++#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ ++#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ ++#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ ++#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ ++#define ELFOSABI_ARM 97 /* ARM */ ++#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ ++ ++#define EI_ABIVERSION 8 /* ABI version */ ++ ++#define EI_PAD 9 /* Byte index of padding bytes */ ++ ++/* Legal values for e_type (object file type). */ ++ ++#define ET_NONE 0 /* No file type */ ++#define ET_REL 1 /* Relocatable file */ ++#define ET_EXEC 2 /* Executable file */ ++#define ET_DYN 3 /* Shared object file */ ++#define ET_CORE 4 /* Core file */ ++#define ET_NUM 5 /* Number of defined types */ ++#define ET_LOOS 0xfe00 /* OS-specific range start */ ++#define ET_HIOS 0xfeff /* OS-specific range end */ ++#define ET_LOPROC 0xff00 /* Processor-specific range start */ ++#define ET_HIPROC 0xffff /* Processor-specific range end */ ++ ++/* Legal values for e_machine (architecture). */ ++ ++#define EM_NONE 0 /* No machine */ ++#define EM_M32 1 /* AT&T WE 32100 */ ++#define EM_SPARC 2 /* SUN SPARC */ ++#define EM_386 3 /* Intel 80386 */ ++#define EM_68K 4 /* Motorola m68k family */ ++#define EM_88K 5 /* Motorola m88k family */ ++#define EM_860 7 /* Intel 80860 */ ++#define EM_MIPS 8 /* MIPS R3000 big-endian */ ++#define EM_S370 9 /* IBM System/370 */ ++#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ ++ ++#define EM_PARISC 15 /* HPPA */ ++#define EM_VPP500 17 /* Fujitsu VPP500 */ ++#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ ++#define EM_960 19 /* Intel 80960 */ ++#define EM_PPC 20 /* PowerPC */ ++#define EM_PPC64 21 /* PowerPC 64-bit */ ++#define EM_S390 22 /* IBM S390 */ ++ ++#define EM_V800 36 /* NEC V800 series */ ++#define EM_FR20 37 /* Fujitsu FR20 */ ++#define EM_RH32 38 /* TRW RH-32 */ ++#define EM_RCE 39 /* Motorola RCE */ ++#define EM_ARM 40 /* ARM */ ++#define EM_FAKE_ALPHA 41 /* Digital Alpha */ ++#define EM_SH 42 /* Hitachi SH */ ++#define EM_SPARCV9 43 /* SPARC v9 64-bit */ ++#define EM_TRICORE 44 /* Siemens Tricore */ ++#define EM_ARC 45 /* Argonaut RISC Core */ ++#define EM_H8_300 46 /* Hitachi H8/300 */ ++#define EM_H8_300H 47 /* Hitachi H8/300H */ ++#define EM_H8S 48 /* Hitachi H8S */ ++#define EM_H8_500 49 /* Hitachi H8/500 */ ++#define EM_IA_64 50 /* Intel Merced */ ++#define EM_MIPS_X 51 /* Stanford MIPS-X */ ++#define EM_COLDFIRE 52 /* Motorola Coldfire */ ++#define EM_68HC12 53 /* Motorola M68HC12 */ ++#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ ++#define EM_PCP 55 /* Siemens PCP */ ++#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ ++#define EM_NDR1 57 /* Denso NDR1 microprocessor */ ++#define EM_STARCORE 58 /* Motorola Start*Core processor */ ++#define EM_ME16 59 /* Toyota ME16 processor */ ++#define EM_ST100 60 /* STMicroelectronic ST100 processor */ ++#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ ++#define EM_X86_64 62 /* AMD x86-64 architecture */ ++#define EM_PDSP 63 /* Sony DSP Processor */ ++ ++#define EM_FX66 66 /* Siemens FX66 microcontroller */ ++#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ ++#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ ++#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ ++#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ ++#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ ++#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ ++#define EM_SVX 73 /* Silicon Graphics SVx */ ++#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ ++#define EM_VAX 75 /* Digital VAX */ ++#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ ++#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ ++#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ ++#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ ++#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ ++#define EM_HUANY 81 /* Harvard University machine-independent object files */ ++#define EM_PRISM 82 /* SiTera Prism */ ++#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ ++#define EM_FR30 84 /* Fujitsu FR30 */ ++#define EM_D10V 85 /* Mitsubishi D10V */ ++#define EM_D30V 86 /* Mitsubishi D30V */ ++#define EM_V850 87 /* NEC v850 */ ++#define EM_M32R 88 /* Mitsubishi M32R */ ++#define EM_MN10300 89 /* Matsushita MN10300 */ ++#define EM_MN10200 90 /* Matsushita MN10200 */ ++#define EM_PJ 91 /* picoJava */ ++#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ ++#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ ++#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ ++#define EM_TILEPRO 188 /* Tilera TILEPro */ ++#define EM_TILEGX 191 /* Tilera TILE-Gx */ ++#define EM_NUM 192 ++ ++/* If it is necessary to assign new unofficial EM_* values, please ++ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the ++ chances of collision with official or non-GNU unofficial values. */ ++ ++#define EM_ALPHA 0x9026 ++ ++/* Legal values for e_version (version). */ ++ ++#define EV_NONE 0 /* Invalid ELF version */ ++#define EV_CURRENT 1 /* Current version */ ++#define EV_NUM 2 ++ ++/* Section header. */ ++ ++typedef struct ++{ ++ Elf32_Word sh_name; /* Section name (string tbl index) */ ++ Elf32_Word sh_type; /* Section type */ ++ Elf32_Word sh_flags; /* Section flags */ ++ Elf32_Addr sh_addr; /* Section virtual addr at execution */ ++ Elf32_Off sh_offset; /* Section file offset */ ++ Elf32_Word sh_size; /* Section size in bytes */ ++ Elf32_Word sh_link; /* Link to another section */ ++ Elf32_Word sh_info; /* Additional section information */ ++ Elf32_Word sh_addralign; /* Section alignment */ ++ Elf32_Word sh_entsize; /* Entry size if section holds table */ ++} Elf32_Shdr; ++ ++typedef struct ++{ ++ Elf64_Word sh_name; /* Section name (string tbl index) */ ++ Elf64_Word sh_type; /* Section type */ ++ Elf64_Xword sh_flags; /* Section flags */ ++ Elf64_Addr sh_addr; /* Section virtual addr at execution */ ++ Elf64_Off sh_offset; /* Section file offset */ ++ Elf64_Xword sh_size; /* Section size in bytes */ ++ Elf64_Word sh_link; /* Link to another section */ ++ Elf64_Word sh_info; /* Additional section information */ ++ Elf64_Xword sh_addralign; /* Section alignment */ ++ Elf64_Xword sh_entsize; /* Entry size if section holds table */ ++} Elf64_Shdr; ++ ++/* Special section indices. */ ++ ++#define SHN_UNDEF 0 /* Undefined section */ ++#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ ++#define SHN_LOPROC 0xff00 /* Start of processor-specific */ ++#define SHN_BEFORE 0xff00 /* Order section before all others ++ (Solaris). */ ++#define SHN_AFTER 0xff01 /* Order section after all others ++ (Solaris). */ ++#define SHN_HIPROC 0xff1f /* End of processor-specific */ ++#define SHN_LOOS 0xff20 /* Start of OS-specific */ ++#define SHN_HIOS 0xff3f /* End of OS-specific */ ++#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ ++#define SHN_COMMON 0xfff2 /* Associated symbol is common */ ++#define SHN_XINDEX 0xffff /* Index is in extra table. */ ++#define SHN_HIRESERVE 0xffff /* End of reserved indices */ ++ ++/* Legal values for sh_type (section type). */ ++ ++#define SHT_NULL 0 /* Section header table entry unused */ ++#define SHT_PROGBITS 1 /* Program data */ ++#define SHT_SYMTAB 2 /* Symbol table */ ++#define SHT_STRTAB 3 /* String table */ ++#define SHT_RELA 4 /* Relocation entries with addends */ ++#define SHT_HASH 5 /* Symbol hash table */ ++#define SHT_DYNAMIC 6 /* Dynamic linking information */ ++#define SHT_NOTE 7 /* Notes */ ++#define SHT_NOBITS 8 /* Program space with no data (bss) */ ++#define SHT_REL 9 /* Relocation entries, no addends */ ++#define SHT_SHLIB 10 /* Reserved */ ++#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ ++#define SHT_INIT_ARRAY 14 /* Array of constructors */ ++#define SHT_FINI_ARRAY 15 /* Array of destructors */ ++#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ ++#define SHT_GROUP 17 /* Section group */ ++#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ ++#define SHT_NUM 19 /* Number of defined types. */ ++#define SHT_LOOS 0x60000000 /* Start OS-specific. */ ++#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ ++#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ ++#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ ++#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ ++#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ ++#define SHT_SUNW_move 0x6ffffffa ++#define SHT_SUNW_COMDAT 0x6ffffffb ++#define SHT_SUNW_syminfo 0x6ffffffc ++#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ ++#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ ++#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ ++#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ ++#define SHT_HIOS 0x6fffffff /* End OS-specific type */ ++#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ ++#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ ++#define SHT_LOUSER 0x80000000 /* Start of application-specific */ ++#define SHT_HIUSER 0x8fffffff /* End of application-specific */ ++ ++/* Legal values for sh_flags (section flags). */ ++ ++#define SHF_WRITE (1 << 0) /* Writable */ ++#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ ++#define SHF_EXECINSTR (1 << 2) /* Executable */ ++#define SHF_MERGE (1 << 4) /* Might be merged */ ++#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ ++#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ ++#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ ++#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling ++ required */ ++#define SHF_GROUP (1 << 9) /* Section is member of a group. */ ++#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ ++#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ ++#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ ++#define SHF_ORDERED (1 << 30) /* Special ordering requirement ++ (Solaris). */ ++#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless ++ referenced or allocated (Solaris).*/ ++ ++/* Section group handling. */ ++#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ ++ ++/* Symbol table entry. */ ++ ++typedef struct ++{ ++ Elf32_Word st_name; /* Symbol name (string tbl index) */ ++ Elf32_Addr st_value; /* Symbol value */ ++ Elf32_Word st_size; /* Symbol size */ ++ unsigned char st_info; /* Symbol type and binding */ ++ unsigned char st_other; /* Symbol visibility */ ++ Elf32_Section st_shndx; /* Section index */ ++} Elf32_Sym; ++ ++typedef struct ++{ ++ Elf64_Word st_name; /* Symbol name (string tbl index) */ ++ unsigned char st_info; /* Symbol type and binding */ ++ unsigned char st_other; /* Symbol visibility */ ++ Elf64_Section st_shndx; /* Section index */ ++ Elf64_Addr st_value; /* Symbol value */ ++ Elf64_Xword st_size; /* Symbol size */ ++} Elf64_Sym; ++ ++/* The syminfo section if available contains additional information about ++ every dynamic symbol. */ ++ ++typedef struct ++{ ++ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ ++ Elf32_Half si_flags; /* Per symbol flags */ ++} Elf32_Syminfo; ++ ++typedef struct ++{ ++ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ ++ Elf64_Half si_flags; /* Per symbol flags */ ++} Elf64_Syminfo; ++ ++/* Possible values for si_boundto. */ ++#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ ++#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ ++#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ ++ ++/* Possible bitmasks for si_flags. */ ++#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ ++#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ ++#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ ++#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy ++ loaded */ ++/* Syminfo version values. */ ++#define SYMINFO_NONE 0 ++#define SYMINFO_CURRENT 1 ++#define SYMINFO_NUM 2 ++ ++ ++/* How to extract and insert information held in the st_info field. */ ++ ++#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) ++#define ELF32_ST_TYPE(val) ((val) & 0xf) ++#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) ++ ++/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ ++#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) ++#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) ++#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) ++ ++/* Legal values for ST_BIND subfield of st_info (symbol binding). */ ++ ++#define STB_LOCAL 0 /* Local symbol */ ++#define STB_GLOBAL 1 /* Global symbol */ ++#define STB_WEAK 2 /* Weak symbol */ ++#define STB_NUM 3 /* Number of defined types. */ ++#define STB_LOOS 10 /* Start of OS-specific */ ++#define STB_GNU_UNIQUE 10 /* Unique symbol. */ ++#define STB_HIOS 12 /* End of OS-specific */ ++#define STB_LOPROC 13 /* Start of processor-specific */ ++#define STB_HIPROC 15 /* End of processor-specific */ ++ ++/* Legal values for ST_TYPE subfield of st_info (symbol type). */ ++ ++#define STT_NOTYPE 0 /* Symbol type is unspecified */ ++#define STT_OBJECT 1 /* Symbol is a data object */ ++#define STT_FUNC 2 /* Symbol is a code object */ ++#define STT_SECTION 3 /* Symbol associated with a section */ ++#define STT_FILE 4 /* Symbol's name is file name */ ++#define STT_COMMON 5 /* Symbol is a common data object */ ++#define STT_TLS 6 /* Symbol is thread-local data object*/ ++#define STT_NUM 7 /* Number of defined types. */ ++#define STT_LOOS 10 /* Start of OS-specific */ ++#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ ++#define STT_HIOS 12 /* End of OS-specific */ ++#define STT_LOPROC 13 /* Start of processor-specific */ ++#define STT_HIPROC 15 /* End of processor-specific */ ++ ++ ++/* Symbol table indices are found in the hash buckets and chain table ++ of a symbol hash table section. This special index value indicates ++ the end of a chain, meaning no further symbols are found in that bucket. */ ++ ++#define STN_UNDEF 0 /* End of a chain. */ ++ ++ ++/* How to extract and insert information held in the st_other field. */ ++ ++#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) ++ ++/* For ELF64 the definitions are the same. */ ++#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) ++ ++/* Symbol visibility specification encoded in the st_other field. */ ++#define STV_DEFAULT 0 /* Default symbol visibility rules */ ++#define STV_INTERNAL 1 /* Processor specific hidden class */ ++#define STV_HIDDEN 2 /* Sym unavailable in other modules */ ++#define STV_PROTECTED 3 /* Not preemptible, not exported */ ++ ++ ++/* Relocation table entry without addend (in section of type SHT_REL). */ ++ ++typedef struct ++{ ++ Elf32_Addr r_offset; /* Address */ ++ Elf32_Word r_info; /* Relocation type and symbol index */ ++} Elf32_Rel; ++ ++/* I have seen two different definitions of the Elf64_Rel and ++ Elf64_Rela structures, so we'll leave them out until Novell (or ++ whoever) gets their act together. */ ++/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ ++ ++typedef struct ++{ ++ Elf64_Addr r_offset; /* Address */ ++ Elf64_Xword r_info; /* Relocation type and symbol index */ ++} Elf64_Rel; ++ ++/* Relocation table entry with addend (in section of type SHT_RELA). */ ++ ++typedef struct ++{ ++ Elf32_Addr r_offset; /* Address */ ++ Elf32_Word r_info; /* Relocation type and symbol index */ ++ Elf32_Sword r_addend; /* Addend */ ++} Elf32_Rela; ++ ++typedef struct ++{ ++ Elf64_Addr r_offset; /* Address */ ++ Elf64_Xword r_info; /* Relocation type and symbol index */ ++ Elf64_Sxword r_addend; /* Addend */ ++} Elf64_Rela; ++ ++/* How to extract and insert information held in the r_info field. */ ++ ++#define ELF32_R_SYM(val) ((val) >> 8) ++#define ELF32_R_TYPE(val) ((val) & 0xff) ++#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) ++ ++#define ELF64_R_SYM(i) ((i) >> 32) ++#define ELF64_R_TYPE(i) ((i) & 0xffffffff) ++#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) ++ ++/* Program segment header. */ ++ ++typedef struct ++{ ++ Elf32_Word p_type; /* Segment type */ ++ Elf32_Off p_offset; /* Segment file offset */ ++ Elf32_Addr p_vaddr; /* Segment virtual address */ ++ Elf32_Addr p_paddr; /* Segment physical address */ ++ Elf32_Word p_filesz; /* Segment size in file */ ++ Elf32_Word p_memsz; /* Segment size in memory */ ++ Elf32_Word p_flags; /* Segment flags */ ++ Elf32_Word p_align; /* Segment alignment */ ++} Elf32_Phdr; ++ ++typedef struct ++{ ++ Elf64_Word p_type; /* Segment type */ ++ Elf64_Word p_flags; /* Segment flags */ ++ Elf64_Off p_offset; /* Segment file offset */ ++ Elf64_Addr p_vaddr; /* Segment virtual address */ ++ Elf64_Addr p_paddr; /* Segment physical address */ ++ Elf64_Xword p_filesz; /* Segment size in file */ ++ Elf64_Xword p_memsz; /* Segment size in memory */ ++ Elf64_Xword p_align; /* Segment alignment */ ++} Elf64_Phdr; ++ ++/* Special value for e_phnum. This indicates that the real number of ++ program headers is too large to fit into e_phnum. Instead the real ++ value is in the field sh_info of section 0. */ ++ ++#define PN_XNUM 0xffff ++ ++/* Legal values for p_type (segment type). */ ++ ++#define PT_NULL 0 /* Program header table entry unused */ ++#define PT_LOAD 1 /* Loadable program segment */ ++#define PT_DYNAMIC 2 /* Dynamic linking information */ ++#define PT_INTERP 3 /* Program interpreter */ ++#define PT_NOTE 4 /* Auxiliary information */ ++#define PT_SHLIB 5 /* Reserved */ ++#define PT_PHDR 6 /* Entry for header table itself */ ++#define PT_TLS 7 /* Thread-local storage segment */ ++#define PT_NUM 8 /* Number of defined types */ ++#define PT_LOOS 0x60000000 /* Start of OS-specific */ ++#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ ++#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ ++#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ ++#define PT_LOSUNW 0x6ffffffa ++#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ ++#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ ++#define PT_HISUNW 0x6fffffff ++#define PT_HIOS 0x6fffffff /* End of OS-specific */ ++#define PT_LOPROC 0x70000000 /* Start of processor-specific */ ++#define PT_HIPROC 0x7fffffff /* End of processor-specific */ ++ ++/* Legal values for p_flags (segment flags). */ ++ ++#define PF_X (1 << 0) /* Segment is executable */ ++#define PF_W (1 << 1) /* Segment is writable */ ++#define PF_R (1 << 2) /* Segment is readable */ ++#define PF_MASKOS 0x0ff00000 /* OS-specific */ ++#define PF_MASKPROC 0xf0000000 /* Processor-specific */ ++ ++/* Legal values for note segment descriptor types for core files. */ ++ ++#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ ++#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ ++#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ ++#define NT_PRXREG 4 /* Contains copy of prxregset struct */ ++#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ ++#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ ++#define NT_AUXV 6 /* Contains copy of auxv array */ ++#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ ++#define NT_ASRS 8 /* Contains copy of asrset struct */ ++#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ ++#define NT_PSINFO 13 /* Contains copy of psinfo struct */ ++#define NT_PRCRED 14 /* Contains copy of prcred struct */ ++#define NT_UTSNAME 15 /* Contains copy of utsname struct */ ++#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ ++#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ ++#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ ++#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ ++#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ ++#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ ++#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ ++#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ ++#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ ++#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ ++ ++/* Legal values for the note segment descriptor types for object files. */ ++ ++#define NT_VERSION 1 /* Contains a version string. */ ++ ++ ++/* Dynamic section entry. */ ++ ++typedef struct ++{ ++ Elf32_Sword d_tag; /* Dynamic entry type */ ++ union ++ { ++ Elf32_Word d_val; /* Integer value */ ++ Elf32_Addr d_ptr; /* Address value */ ++ } d_un; ++} Elf32_Dyn; ++ ++typedef struct ++{ ++ Elf64_Sxword d_tag; /* Dynamic entry type */ ++ union ++ { ++ Elf64_Xword d_val; /* Integer value */ ++ Elf64_Addr d_ptr; /* Address value */ ++ } d_un; ++} Elf64_Dyn; ++ ++/* Legal values for d_tag (dynamic entry type). */ ++ ++#define DT_NULL 0 /* Marks end of dynamic section */ ++#define DT_NEEDED 1 /* Name of needed library */ ++#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ ++#define DT_PLTGOT 3 /* Processor defined value */ ++#define DT_HASH 4 /* Address of symbol hash table */ ++#define DT_STRTAB 5 /* Address of string table */ ++#define DT_SYMTAB 6 /* Address of symbol table */ ++#define DT_RELA 7 /* Address of Rela relocs */ ++#define DT_RELASZ 8 /* Total size of Rela relocs */ ++#define DT_RELAENT 9 /* Size of one Rela reloc */ ++#define DT_STRSZ 10 /* Size of string table */ ++#define DT_SYMENT 11 /* Size of one symbol table entry */ ++#define DT_INIT 12 /* Address of init function */ ++#define DT_FINI 13 /* Address of termination function */ ++#define DT_SONAME 14 /* Name of shared object */ ++#define DT_RPATH 15 /* Library search path (deprecated) */ ++#define DT_SYMBOLIC 16 /* Start symbol search here */ ++#define DT_REL 17 /* Address of Rel relocs */ ++#define DT_RELSZ 18 /* Total size of Rel relocs */ ++#define DT_RELENT 19 /* Size of one Rel reloc */ ++#define DT_PLTREL 20 /* Type of reloc in PLT */ ++#define DT_DEBUG 21 /* For debugging; unspecified */ ++#define DT_TEXTREL 22 /* Reloc might modify .text */ ++#define DT_JMPREL 23 /* Address of PLT relocs */ ++#define DT_BIND_NOW 24 /* Process relocations of object */ ++#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ ++#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ ++#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ ++#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ ++#define DT_RUNPATH 29 /* Library search path */ ++#define DT_FLAGS 30 /* Flags for the object being loaded */ ++#define DT_ENCODING 32 /* Start of encoded range */ ++#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ ++#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ ++#define DT_NUM 34 /* Number used */ ++#define DT_LOOS 0x6000000d /* Start of OS-specific */ ++#define DT_HIOS 0x6ffff000 /* End of OS-specific */ ++#define DT_LOPROC 0x70000000 /* Start of processor-specific */ ++#define DT_HIPROC 0x7fffffff /* End of processor-specific */ ++#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ ++ ++/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the ++ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's ++ approach. */ ++#define DT_VALRNGLO 0x6ffffd00 ++#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ ++#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ ++#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ ++#define DT_CHECKSUM 0x6ffffdf8 ++#define DT_PLTPADSZ 0x6ffffdf9 ++#define DT_MOVEENT 0x6ffffdfa ++#define DT_MOVESZ 0x6ffffdfb ++#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ ++#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting ++ the following DT_* entry. */ ++#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ ++#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ ++#define DT_VALRNGHI 0x6ffffdff ++#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ ++#define DT_VALNUM 12 ++ ++/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the ++ Dyn.d_un.d_ptr field of the Elf*_Dyn structure. ++ ++ If any adjustment is made to the ELF object after it has been ++ built these entries will need to be adjusted. */ ++#define DT_ADDRRNGLO 0x6ffffe00 ++#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ ++#define DT_TLSDESC_PLT 0x6ffffef6 ++#define DT_TLSDESC_GOT 0x6ffffef7 ++#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ ++#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ ++#define DT_CONFIG 0x6ffffefa /* Configuration information. */ ++#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ ++#define DT_AUDIT 0x6ffffefc /* Object auditing. */ ++#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ ++#define DT_MOVETAB 0x6ffffefe /* Move table. */ ++#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ ++#define DT_ADDRRNGHI 0x6ffffeff ++#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ ++#define DT_ADDRNUM 11 ++ ++/* The versioning entry types. The next are defined as part of the ++ GNU extension. */ ++#define DT_VERSYM 0x6ffffff0 ++ ++#define DT_RELACOUNT 0x6ffffff9 ++#define DT_RELCOUNT 0x6ffffffa ++ ++/* These were chosen by Sun. */ ++#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ ++#define DT_VERDEF 0x6ffffffc /* Address of version definition ++ table */ ++#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ ++#define DT_VERNEED 0x6ffffffe /* Address of table with needed ++ versions */ ++#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ ++#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ ++#define DT_VERSIONTAGNUM 16 ++ ++/* Sun added these machine-independent extensions in the "processor-specific" ++ range. Be compatible. */ ++#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ ++#define DT_FILTER 0x7fffffff /* Shared object to get values from */ ++#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) ++#define DT_EXTRANUM 3 ++ ++/* Values of `d_un.d_val' in the DT_FLAGS entry. */ ++#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ ++#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ ++#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ ++#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ ++#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ ++ ++/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 ++ entry in the dynamic section. */ ++#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ ++#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ ++#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ ++#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ ++#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ ++#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ ++#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ ++#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ ++#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ ++#define DF_1_TRANS 0x00000200 ++#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ ++#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ ++#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ ++#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ ++#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ ++#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ ++#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ ++ ++/* Flags for the feature selection in DT_FEATURE_1. */ ++#define DTF_1_PARINIT 0x00000001 ++#define DTF_1_CONFEXP 0x00000002 ++ ++/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ ++#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ ++#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not ++ generally available. */ ++ ++/* Version definition sections. */ ++ ++typedef struct ++{ ++ Elf32_Half vd_version; /* Version revision */ ++ Elf32_Half vd_flags; /* Version information */ ++ Elf32_Half vd_ndx; /* Version Index */ ++ Elf32_Half vd_cnt; /* Number of associated aux entries */ ++ Elf32_Word vd_hash; /* Version name hash value */ ++ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ ++ Elf32_Word vd_next; /* Offset in bytes to next verdef ++ entry */ ++} Elf32_Verdef; ++ ++typedef struct ++{ ++ Elf64_Half vd_version; /* Version revision */ ++ Elf64_Half vd_flags; /* Version information */ ++ Elf64_Half vd_ndx; /* Version Index */ ++ Elf64_Half vd_cnt; /* Number of associated aux entries */ ++ Elf64_Word vd_hash; /* Version name hash value */ ++ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ ++ Elf64_Word vd_next; /* Offset in bytes to next verdef ++ entry */ ++} Elf64_Verdef; ++ ++ ++/* Legal values for vd_version (version revision). */ ++#define VER_DEF_NONE 0 /* No version */ ++#define VER_DEF_CURRENT 1 /* Current version */ ++#define VER_DEF_NUM 2 /* Given version number */ ++ ++/* Legal values for vd_flags (version information flags). */ ++#define VER_FLG_BASE 0x1 /* Version definition of file itself */ ++#define VER_FLG_WEAK 0x2 /* Weak version identifier */ ++ ++/* Versym symbol index values. */ ++#define VER_NDX_LOCAL 0 /* Symbol is local. */ ++#define VER_NDX_GLOBAL 1 /* Symbol is global. */ ++#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ ++#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ ++ ++/* Auxialiary version information. */ ++ ++typedef struct ++{ ++ Elf32_Word vda_name; /* Version or dependency names */ ++ Elf32_Word vda_next; /* Offset in bytes to next verdaux ++ entry */ ++} Elf32_Verdaux; ++ ++typedef struct ++{ ++ Elf64_Word vda_name; /* Version or dependency names */ ++ Elf64_Word vda_next; /* Offset in bytes to next verdaux ++ entry */ ++} Elf64_Verdaux; ++ ++ ++/* Version dependency section. */ ++ ++typedef struct ++{ ++ Elf32_Half vn_version; /* Version of structure */ ++ Elf32_Half vn_cnt; /* Number of associated aux entries */ ++ Elf32_Word vn_file; /* Offset of filename for this ++ dependency */ ++ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ ++ Elf32_Word vn_next; /* Offset in bytes to next verneed ++ entry */ ++} Elf32_Verneed; ++ ++typedef struct ++{ ++ Elf64_Half vn_version; /* Version of structure */ ++ Elf64_Half vn_cnt; /* Number of associated aux entries */ ++ Elf64_Word vn_file; /* Offset of filename for this ++ dependency */ ++ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ ++ Elf64_Word vn_next; /* Offset in bytes to next verneed ++ entry */ ++} Elf64_Verneed; ++ ++ ++/* Legal values for vn_version (version revision). */ ++#define VER_NEED_NONE 0 /* No version */ ++#define VER_NEED_CURRENT 1 /* Current version */ ++#define VER_NEED_NUM 2 /* Given version number */ ++ ++/* Auxiliary needed version information. */ ++ ++typedef struct ++{ ++ Elf32_Word vna_hash; /* Hash value of dependency name */ ++ Elf32_Half vna_flags; /* Dependency specific information */ ++ Elf32_Half vna_other; /* Unused */ ++ Elf32_Word vna_name; /* Dependency name string offset */ ++ Elf32_Word vna_next; /* Offset in bytes to next vernaux ++ entry */ ++} Elf32_Vernaux; ++ ++typedef struct ++{ ++ Elf64_Word vna_hash; /* Hash value of dependency name */ ++ Elf64_Half vna_flags; /* Dependency specific information */ ++ Elf64_Half vna_other; /* Unused */ ++ Elf64_Word vna_name; /* Dependency name string offset */ ++ Elf64_Word vna_next; /* Offset in bytes to next vernaux ++ entry */ ++} Elf64_Vernaux; ++ ++ ++/* Legal values for vna_flags. */ ++#define VER_FLG_WEAK 0x2 /* Weak version identifier */ ++ ++ ++/* Auxiliary vector. */ ++ ++/* This vector is normally only used by the program interpreter. The ++ usual definition in an ABI supplement uses the name auxv_t. The ++ vector is not usually defined in a standard file, but it ++ can't hurt. We rename it to avoid conflicts. The sizes of these ++ types are an arrangement between the exec server and the program ++ interpreter, so we don't fully specify them here. */ ++ ++typedef struct ++{ ++ uint32_t a_type; /* Entry type */ ++ union ++ { ++ uint32_t a_val; /* Integer value */ ++ /* We use to have pointer elements added here. We cannot do that, ++ though, since it does not work when using 32-bit definitions ++ on 64-bit platforms and vice versa. */ ++ } a_un; ++} Elf32_auxv_t; ++ ++typedef struct ++{ ++ uint64_t a_type; /* Entry type */ ++ union ++ { ++ uint64_t a_val; /* Integer value */ ++ /* We use to have pointer elements added here. We cannot do that, ++ though, since it does not work when using 32-bit definitions ++ on 64-bit platforms and vice versa. */ ++ } a_un; ++} Elf64_auxv_t; ++ ++/* Legal values for a_type (entry type). */ ++ ++#define AT_NULL 0 /* End of vector */ ++#define AT_IGNORE 1 /* Entry should be ignored */ ++#define AT_EXECFD 2 /* File descriptor of program */ ++#define AT_PHDR 3 /* Program headers for program */ ++#define AT_PHENT 4 /* Size of program header entry */ ++#define AT_PHNUM 5 /* Number of program headers */ ++#define AT_PAGESZ 6 /* System page size */ ++#define AT_BASE 7 /* Base address of interpreter */ ++#define AT_FLAGS 8 /* Flags */ ++#define AT_ENTRY 9 /* Entry point of program */ ++#define AT_NOTELF 10 /* Program is not ELF */ ++#define AT_UID 11 /* Real uid */ ++#define AT_EUID 12 /* Effective uid */ ++#define AT_GID 13 /* Real gid */ ++#define AT_EGID 14 /* Effective gid */ ++#define AT_CLKTCK 17 /* Frequency of times() */ ++ ++/* Some more special a_type values describing the hardware. */ ++#define AT_PLATFORM 15 /* String identifying platform. */ ++#define AT_HWCAP 16 /* Machine dependent hints about ++ processor capabilities. */ ++ ++/* This entry gives some information about the FPU initialization ++ performed by the kernel. */ ++#define AT_FPUCW 18 /* Used FPU control word. */ ++ ++/* Cache block sizes. */ ++#define AT_DCACHEBSIZE 19 /* Data cache block size. */ ++#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ ++#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ ++ ++/* A special ignored value for PPC, used by the kernel to control the ++ interpretation of the AUXV. Must be > 16. */ ++#define AT_IGNOREPPC 22 /* Entry should be ignored. */ ++ ++#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ ++ ++#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ ++ ++#define AT_RANDOM 25 /* Address of 16 random bytes. */ ++ ++#define AT_EXECFN 31 /* Filename of executable. */ ++ ++/* Pointer to the global system page used for system calls and other ++ nice things. */ ++#define AT_SYSINFO 32 ++#define AT_SYSINFO_EHDR 33 ++ ++/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains ++ log2 of line size; mask those to get cache size. */ ++#define AT_L1I_CACHESHAPE 34 ++#define AT_L1D_CACHESHAPE 35 ++#define AT_L2_CACHESHAPE 36 ++#define AT_L3_CACHESHAPE 37 ++ ++/* Note section contents. Each entry in the note section begins with ++ a header of a fixed form. */ ++ ++typedef struct ++{ ++ Elf32_Word n_namesz; /* Length of the note's name. */ ++ Elf32_Word n_descsz; /* Length of the note's descriptor. */ ++ Elf32_Word n_type; /* Type of the note. */ ++} Elf32_Nhdr; ++ ++typedef struct ++{ ++ Elf64_Word n_namesz; /* Length of the note's name. */ ++ Elf64_Word n_descsz; /* Length of the note's descriptor. */ ++ Elf64_Word n_type; /* Type of the note. */ ++} Elf64_Nhdr; ++ ++/* Known names of notes. */ ++ ++/* Solaris entries in the note section have this name. */ ++#define ELF_NOTE_SOLARIS "SUNW Solaris" ++ ++/* Note entries for GNU systems have this name. */ ++#define ELF_NOTE_GNU "GNU" ++ ++ ++/* Defined types of notes for Solaris. */ ++ ++/* Value of descriptor (one word) is desired pagesize for the binary. */ ++#define ELF_NOTE_PAGESIZE_HINT 1 ++ ++ ++/* Defined note types for GNU systems. */ ++ ++/* ABI information. The descriptor consists of words: ++ word 0: OS descriptor ++ word 1: major version of the ABI ++ word 2: minor version of the ABI ++ word 3: subminor version of the ABI ++*/ ++#define NT_GNU_ABI_TAG 1 ++#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ ++ ++/* Known OSes. These values can appear in word 0 of an ++ NT_GNU_ABI_TAG note section entry. */ ++#define ELF_NOTE_OS_LINUX 0 ++#define ELF_NOTE_OS_GNU 1 ++#define ELF_NOTE_OS_SOLARIS2 2 ++#define ELF_NOTE_OS_FREEBSD 3 ++ ++/* Synthetic hwcap information. The descriptor begins with two words: ++ word 0: number of entries ++ word 1: bitmask of enabled entries ++ Then follow variable-length entries, one byte followed by a ++ '\0'-terminated hwcap name string. The byte gives the bit ++ number to test if enabled, (1U << bit) & bitmask. */ ++#define NT_GNU_HWCAP 2 ++ ++/* Build ID bits as generated by ld --build-id. ++ The descriptor consists of any nonzero number of bytes. */ ++#define NT_GNU_BUILD_ID 3 ++ ++/* Version note generated by GNU gold containing a version string. */ ++#define NT_GNU_GOLD_VERSION 4 ++ ++ ++/* Move records. */ ++typedef struct ++{ ++ Elf32_Xword m_value; /* Symbol value. */ ++ Elf32_Word m_info; /* Size and index. */ ++ Elf32_Word m_poffset; /* Symbol offset. */ ++ Elf32_Half m_repeat; /* Repeat count. */ ++ Elf32_Half m_stride; /* Stride info. */ ++} Elf32_Move; ++ ++typedef struct ++{ ++ Elf64_Xword m_value; /* Symbol value. */ ++ Elf64_Xword m_info; /* Size and index. */ ++ Elf64_Xword m_poffset; /* Symbol offset. */ ++ Elf64_Half m_repeat; /* Repeat count. */ ++ Elf64_Half m_stride; /* Stride info. */ ++} Elf64_Move; ++ ++/* Macro to construct move records. */ ++#define ELF32_M_SYM(info) ((info) >> 8) ++#define ELF32_M_SIZE(info) ((unsigned char) (info)) ++#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) ++ ++#define ELF64_M_SYM(info) ELF32_M_SYM (info) ++#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) ++#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) ++ ++ ++/* Motorola 68k specific definitions. */ ++ ++/* Values for Elf32_Ehdr.e_flags. */ ++#define EF_CPU32 0x00810000 ++ ++/* m68k relocs. */ ++ ++#define R_68K_NONE 0 /* No reloc */ ++#define R_68K_32 1 /* Direct 32 bit */ ++#define R_68K_16 2 /* Direct 16 bit */ ++#define R_68K_8 3 /* Direct 8 bit */ ++#define R_68K_PC32 4 /* PC relative 32 bit */ ++#define R_68K_PC16 5 /* PC relative 16 bit */ ++#define R_68K_PC8 6 /* PC relative 8 bit */ ++#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ ++#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ ++#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ ++#define R_68K_GOT32O 10 /* 32 bit GOT offset */ ++#define R_68K_GOT16O 11 /* 16 bit GOT offset */ ++#define R_68K_GOT8O 12 /* 8 bit GOT offset */ ++#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ ++#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ ++#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ ++#define R_68K_PLT32O 16 /* 32 bit PLT offset */ ++#define R_68K_PLT16O 17 /* 16 bit PLT offset */ ++#define R_68K_PLT8O 18 /* 8 bit PLT offset */ ++#define R_68K_COPY 19 /* Copy symbol at runtime */ ++#define R_68K_GLOB_DAT 20 /* Create GOT entry */ ++#define R_68K_JMP_SLOT 21 /* Create PLT entry */ ++#define R_68K_RELATIVE 22 /* Adjust by program base */ ++#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ ++#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ ++#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ ++#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ ++#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ ++#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ ++#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ ++#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ ++#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ ++#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ ++#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ ++#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ ++#define R_68K_TLS_LE32 37 /* 32 bit offset relative to ++ static TLS block */ ++#define R_68K_TLS_LE16 38 /* 16 bit offset relative to ++ static TLS block */ ++#define R_68K_TLS_LE8 39 /* 8 bit offset relative to ++ static TLS block */ ++#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ ++#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ ++#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ ++/* Keep this the last entry. */ ++#define R_68K_NUM 43 ++ ++/* Intel 80386 specific definitions. */ ++ ++/* i386 relocs. */ ++ ++#define R_386_NONE 0 /* No reloc */ ++#define R_386_32 1 /* Direct 32 bit */ ++#define R_386_PC32 2 /* PC relative 32 bit */ ++#define R_386_GOT32 3 /* 32 bit GOT entry */ ++#define R_386_PLT32 4 /* 32 bit PLT address */ ++#define R_386_COPY 5 /* Copy symbol at runtime */ ++#define R_386_GLOB_DAT 6 /* Create GOT entry */ ++#define R_386_JMP_SLOT 7 /* Create PLT entry */ ++#define R_386_RELATIVE 8 /* Adjust by program base */ ++#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ ++#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ ++#define R_386_32PLT 11 ++#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ ++#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS ++ block offset */ ++#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block ++ offset */ ++#define R_386_TLS_LE 17 /* Offset relative to static TLS ++ block */ ++#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of ++ general dynamic thread local data */ ++#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of ++ local dynamic thread local data ++ in LE code */ ++#define R_386_16 20 ++#define R_386_PC16 21 ++#define R_386_8 22 ++#define R_386_PC8 23 ++#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic ++ thread local data */ ++#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ ++#define R_386_TLS_GD_CALL 26 /* Relocation for call to ++ __tls_get_addr() */ ++#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ ++#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic ++ thread local data in LE code */ ++#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ ++#define R_386_TLS_LDM_CALL 30 /* Relocation for call to ++ __tls_get_addr() in LDM code */ ++#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ ++#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ ++#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS ++ block offset */ ++#define R_386_TLS_LE_32 34 /* Negated offset relative to static ++ TLS block */ ++#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ ++#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ ++#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ ++/* 38? */ ++#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ ++#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS ++ descriptor for ++ relaxation. */ ++#define R_386_TLS_DESC 41 /* TLS descriptor containing ++ pointer to code and to ++ argument, returning the TLS ++ offset for the symbol. */ ++#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ ++/* Keep this the last entry. */ ++#define R_386_NUM 43 ++ ++/* SUN SPARC specific definitions. */ ++ ++/* Legal values for ST_TYPE subfield of st_info (symbol type). */ ++ ++#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ ++ ++/* Values for Elf64_Ehdr.e_flags. */ ++ ++#define EF_SPARCV9_MM 3 ++#define EF_SPARCV9_TSO 0 ++#define EF_SPARCV9_PSO 1 ++#define EF_SPARCV9_RMO 2 ++#define EF_SPARC_LEDATA 0x800000 /* little endian data */ ++#define EF_SPARC_EXT_MASK 0xFFFF00 ++#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ ++#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ ++#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ ++#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ ++ ++/* SPARC relocs. */ ++ ++#define R_SPARC_NONE 0 /* No reloc */ ++#define R_SPARC_8 1 /* Direct 8 bit */ ++#define R_SPARC_16 2 /* Direct 16 bit */ ++#define R_SPARC_32 3 /* Direct 32 bit */ ++#define R_SPARC_DISP8 4 /* PC relative 8 bit */ ++#define R_SPARC_DISP16 5 /* PC relative 16 bit */ ++#define R_SPARC_DISP32 6 /* PC relative 32 bit */ ++#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ ++#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ ++#define R_SPARC_HI22 9 /* High 22 bit */ ++#define R_SPARC_22 10 /* Direct 22 bit */ ++#define R_SPARC_13 11 /* Direct 13 bit */ ++#define R_SPARC_LO10 12 /* Truncated 10 bit */ ++#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ ++#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ ++#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ ++#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ ++#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ ++#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ ++#define R_SPARC_COPY 19 /* Copy symbol at runtime */ ++#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ ++#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ ++#define R_SPARC_RELATIVE 22 /* Adjust by program base */ ++#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ ++ ++/* Additional Sparc64 relocs. */ ++ ++#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ ++#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ ++#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ ++#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ ++#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ ++#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ ++#define R_SPARC_10 30 /* Direct 10 bit */ ++#define R_SPARC_11 31 /* Direct 11 bit */ ++#define R_SPARC_64 32 /* Direct 64 bit */ ++#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ ++#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ ++#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ ++#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ ++#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ ++#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ ++#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ ++#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ ++#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ ++#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ ++#define R_SPARC_7 43 /* Direct 7 bit */ ++#define R_SPARC_5 44 /* Direct 5 bit */ ++#define R_SPARC_6 45 /* Direct 6 bit */ ++#define R_SPARC_DISP64 46 /* PC relative 64 bit */ ++#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ ++#define R_SPARC_HIX22 48 /* High 22 bit complemented */ ++#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ ++#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ ++#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ ++#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ ++#define R_SPARC_REGISTER 53 /* Global register usage */ ++#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ ++#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ ++#define R_SPARC_TLS_GD_HI22 56 ++#define R_SPARC_TLS_GD_LO10 57 ++#define R_SPARC_TLS_GD_ADD 58 ++#define R_SPARC_TLS_GD_CALL 59 ++#define R_SPARC_TLS_LDM_HI22 60 ++#define R_SPARC_TLS_LDM_LO10 61 ++#define R_SPARC_TLS_LDM_ADD 62 ++#define R_SPARC_TLS_LDM_CALL 63 ++#define R_SPARC_TLS_LDO_HIX22 64 ++#define R_SPARC_TLS_LDO_LOX10 65 ++#define R_SPARC_TLS_LDO_ADD 66 ++#define R_SPARC_TLS_IE_HI22 67 ++#define R_SPARC_TLS_IE_LO10 68 ++#define R_SPARC_TLS_IE_LD 69 ++#define R_SPARC_TLS_IE_LDX 70 ++#define R_SPARC_TLS_IE_ADD 71 ++#define R_SPARC_TLS_LE_HIX22 72 ++#define R_SPARC_TLS_LE_LOX10 73 ++#define R_SPARC_TLS_DTPMOD32 74 ++#define R_SPARC_TLS_DTPMOD64 75 ++#define R_SPARC_TLS_DTPOFF32 76 ++#define R_SPARC_TLS_DTPOFF64 77 ++#define R_SPARC_TLS_TPOFF32 78 ++#define R_SPARC_TLS_TPOFF64 79 ++#define R_SPARC_GOTDATA_HIX22 80 ++#define R_SPARC_GOTDATA_LOX10 81 ++#define R_SPARC_GOTDATA_OP_HIX22 82 ++#define R_SPARC_GOTDATA_OP_LOX10 83 ++#define R_SPARC_GOTDATA_OP 84 ++#define R_SPARC_H34 85 ++#define R_SPARC_SIZE32 86 ++#define R_SPARC_SIZE64 87 ++#define R_SPARC_WDISP10 88 ++#define R_SPARC_JMP_IREL 248 ++#define R_SPARC_IRELATIVE 249 ++#define R_SPARC_GNU_VTINHERIT 250 ++#define R_SPARC_GNU_VTENTRY 251 ++#define R_SPARC_REV32 252 ++/* Keep this the last entry. */ ++#define R_SPARC_NUM 253 ++ ++/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ ++ ++#define DT_SPARC_REGISTER 0x70000001 ++#define DT_SPARC_NUM 2 ++ ++/* MIPS R3000 specific definitions. */ ++ ++/* Legal values for e_flags field of Elf32_Ehdr. */ ++ ++#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ ++#define EF_MIPS_PIC 2 /* Contains PIC code */ ++#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ ++#define EF_MIPS_XGOT 8 ++#define EF_MIPS_64BIT_WHIRL 16 ++#define EF_MIPS_ABI2 32 ++#define EF_MIPS_ABI_ON32 64 ++#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ ++ ++/* Legal values for MIPS architecture level. */ ++ ++#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ ++#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ ++#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ ++#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ ++#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ ++#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ ++#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ ++ ++/* The following are non-official names and should not be used. */ ++ ++#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ ++#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ ++#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ ++#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ ++#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ ++#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ ++#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ ++ ++/* Special section indices. */ ++ ++#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ ++#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ ++#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ ++#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ ++#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ ++ ++/* Legal values for sh_type field of Elf32_Shdr. */ ++ ++#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ ++#define SHT_MIPS_MSYM 0x70000001 ++#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ ++#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ ++#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ ++#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ ++#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ ++#define SHT_MIPS_PACKAGE 0x70000007 ++#define SHT_MIPS_PACKSYM 0x70000008 ++#define SHT_MIPS_RELD 0x70000009 ++#define SHT_MIPS_IFACE 0x7000000b ++#define SHT_MIPS_CONTENT 0x7000000c ++#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ ++#define SHT_MIPS_SHDR 0x70000010 ++#define SHT_MIPS_FDESC 0x70000011 ++#define SHT_MIPS_EXTSYM 0x70000012 ++#define SHT_MIPS_DENSE 0x70000013 ++#define SHT_MIPS_PDESC 0x70000014 ++#define SHT_MIPS_LOCSYM 0x70000015 ++#define SHT_MIPS_AUXSYM 0x70000016 ++#define SHT_MIPS_OPTSYM 0x70000017 ++#define SHT_MIPS_LOCSTR 0x70000018 ++#define SHT_MIPS_LINE 0x70000019 ++#define SHT_MIPS_RFDESC 0x7000001a ++#define SHT_MIPS_DELTASYM 0x7000001b ++#define SHT_MIPS_DELTAINST 0x7000001c ++#define SHT_MIPS_DELTACLASS 0x7000001d ++#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ ++#define SHT_MIPS_DELTADECL 0x7000001f ++#define SHT_MIPS_SYMBOL_LIB 0x70000020 ++#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ ++#define SHT_MIPS_TRANSLATE 0x70000022 ++#define SHT_MIPS_PIXIE 0x70000023 ++#define SHT_MIPS_XLATE 0x70000024 ++#define SHT_MIPS_XLATE_DEBUG 0x70000025 ++#define SHT_MIPS_WHIRL 0x70000026 ++#define SHT_MIPS_EH_REGION 0x70000027 ++#define SHT_MIPS_XLATE_OLD 0x70000028 ++#define SHT_MIPS_PDR_EXCEPTION 0x70000029 ++ ++/* Legal values for sh_flags field of Elf32_Shdr. */ ++ ++#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ ++#define SHF_MIPS_MERGE 0x20000000 ++#define SHF_MIPS_ADDR 0x40000000 ++#define SHF_MIPS_STRINGS 0x80000000 ++#define SHF_MIPS_NOSTRIP 0x08000000 ++#define SHF_MIPS_LOCAL 0x04000000 ++#define SHF_MIPS_NAMES 0x02000000 ++#define SHF_MIPS_NODUPE 0x01000000 ++ ++ ++/* Symbol tables. */ ++ ++/* MIPS specific values for `st_other'. */ ++#define STO_MIPS_DEFAULT 0x0 ++#define STO_MIPS_INTERNAL 0x1 ++#define STO_MIPS_HIDDEN 0x2 ++#define STO_MIPS_PROTECTED 0x3 ++#define STO_MIPS_PLT 0x8 ++#define STO_MIPS_SC_ALIGN_UNUSED 0xff ++ ++/* MIPS specific values for `st_info'. */ ++#define STB_MIPS_SPLIT_COMMON 13 ++ ++/* Entries found in sections of type SHT_MIPS_GPTAB. */ ++ ++typedef union ++{ ++ struct ++ { ++ Elf32_Word gt_current_g_value; /* -G value used for compilation */ ++ Elf32_Word gt_unused; /* Not used */ ++ } gt_header; /* First entry in section */ ++ struct ++ { ++ Elf32_Word gt_g_value; /* If this value were used for -G */ ++ Elf32_Word gt_bytes; /* This many bytes would be used */ ++ } gt_entry; /* Subsequent entries in section */ ++} Elf32_gptab; ++ ++/* Entry found in sections of type SHT_MIPS_REGINFO. */ ++ ++typedef struct ++{ ++ Elf32_Word ri_gprmask; /* General registers used */ ++ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ ++ Elf32_Sword ri_gp_value; /* $gp register value */ ++} Elf32_RegInfo; ++ ++/* Entries found in sections of type SHT_MIPS_OPTIONS. */ ++ ++typedef struct ++{ ++ unsigned char kind; /* Determines interpretation of the ++ variable part of descriptor. */ ++ unsigned char size; /* Size of descriptor, including header. */ ++ Elf32_Section section; /* Section header index of section affected, ++ 0 for global options. */ ++ Elf32_Word info; /* Kind-specific information. */ ++} Elf_Options; ++ ++/* Values for `kind' field in Elf_Options. */ ++ ++#define ODK_NULL 0 /* Undefined. */ ++#define ODK_REGINFO 1 /* Register usage information. */ ++#define ODK_EXCEPTIONS 2 /* Exception processing options. */ ++#define ODK_PAD 3 /* Section padding options. */ ++#define ODK_HWPATCH 4 /* Hardware workarounds performed */ ++#define ODK_FILL 5 /* record the fill value used by the linker. */ ++#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ ++#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ ++#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ ++ ++/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ ++ ++#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ ++#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ ++#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ ++#define OEX_SMM 0x20000 /* Force sequential memory mode? */ ++#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ ++#define OEX_PRECISEFP OEX_FPDBUG ++#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ ++ ++#define OEX_FPU_INVAL 0x10 ++#define OEX_FPU_DIV0 0x08 ++#define OEX_FPU_OFLO 0x04 ++#define OEX_FPU_UFLO 0x02 ++#define OEX_FPU_INEX 0x01 ++ ++/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ ++ ++#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ ++#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ ++#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ ++#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ ++ ++#define OPAD_PREFIX 0x1 ++#define OPAD_POSTFIX 0x2 ++#define OPAD_SYMBOL 0x4 ++ ++/* Entry found in `.options' section. */ ++ ++typedef struct ++{ ++ Elf32_Word hwp_flags1; /* Extra flags. */ ++ Elf32_Word hwp_flags2; /* Extra flags. */ ++} Elf_Options_Hw; ++ ++/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ ++ ++#define OHWA0_R4KEOP_CHECKED 0x00000001 ++#define OHWA1_R4KEOP_CLEAN 0x00000002 ++ ++/* MIPS relocs. */ ++ ++#define R_MIPS_NONE 0 /* No reloc */ ++#define R_MIPS_16 1 /* Direct 16 bit */ ++#define R_MIPS_32 2 /* Direct 32 bit */ ++#define R_MIPS_REL32 3 /* PC relative 32 bit */ ++#define R_MIPS_26 4 /* Direct 26 bit shifted */ ++#define R_MIPS_HI16 5 /* High 16 bit */ ++#define R_MIPS_LO16 6 /* Low 16 bit */ ++#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ ++#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ ++#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ ++#define R_MIPS_PC16 10 /* PC relative 16 bit */ ++#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ ++#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ ++ ++#define R_MIPS_SHIFT5 16 ++#define R_MIPS_SHIFT6 17 ++#define R_MIPS_64 18 ++#define R_MIPS_GOT_DISP 19 ++#define R_MIPS_GOT_PAGE 20 ++#define R_MIPS_GOT_OFST 21 ++#define R_MIPS_GOT_HI16 22 ++#define R_MIPS_GOT_LO16 23 ++#define R_MIPS_SUB 24 ++#define R_MIPS_INSERT_A 25 ++#define R_MIPS_INSERT_B 26 ++#define R_MIPS_DELETE 27 ++#define R_MIPS_HIGHER 28 ++#define R_MIPS_HIGHEST 29 ++#define R_MIPS_CALL_HI16 30 ++#define R_MIPS_CALL_LO16 31 ++#define R_MIPS_SCN_DISP 32 ++#define R_MIPS_REL16 33 ++#define R_MIPS_ADD_IMMEDIATE 34 ++#define R_MIPS_PJUMP 35 ++#define R_MIPS_RELGOT 36 ++#define R_MIPS_JALR 37 ++#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ ++#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ ++#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ ++#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ ++#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ ++#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ ++#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ ++#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ ++#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ ++#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ ++#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ ++#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ ++#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ ++#define R_MIPS_GLOB_DAT 51 ++#define R_MIPS_COPY 126 ++#define R_MIPS_JUMP_SLOT 127 ++/* Keep this the last entry. */ ++#define R_MIPS_NUM 128 ++ ++/* Legal values for p_type field of Elf32_Phdr. */ ++ ++#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ ++#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ ++#define PT_MIPS_OPTIONS 0x70000002 ++ ++/* Special program header types. */ ++ ++#define PF_MIPS_LOCAL 0x10000000 ++ ++/* Legal values for d_tag field of Elf32_Dyn. */ ++ ++#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ ++#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ ++#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ ++#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ ++#define DT_MIPS_FLAGS 0x70000005 /* Flags */ ++#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ ++#define DT_MIPS_MSYM 0x70000007 ++#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ ++#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ ++#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ ++#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ ++#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ ++#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ ++#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ ++#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ ++#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ ++#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ ++#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ ++#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in ++ DT_MIPS_DELTA_CLASS. */ ++#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ ++#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in ++ DT_MIPS_DELTA_INSTANCE. */ ++#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ ++#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in ++ DT_MIPS_DELTA_RELOC. */ ++#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta ++ relocations refer to. */ ++#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in ++ DT_MIPS_DELTA_SYM. */ ++#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the ++ class declaration. */ ++#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in ++ DT_MIPS_DELTA_CLASSSYM. */ ++#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ ++#define DT_MIPS_PIXIE_INIT 0x70000023 ++#define DT_MIPS_SYMBOL_LIB 0x70000024 ++#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 ++#define DT_MIPS_LOCAL_GOTIDX 0x70000026 ++#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 ++#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 ++#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ ++#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ ++#define DT_MIPS_DYNSTR_ALIGN 0x7000002b ++#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ ++#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve ++ function stored in GOT. */ ++#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added ++ by rld on dlopen() calls. */ ++#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ ++#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ ++#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ ++/* The address of .got.plt in an executable using the new non-PIC ABI. */ ++#define DT_MIPS_PLTGOT 0x70000032 ++/* The base of the PLT in an executable using the new non-PIC ABI if that ++ PLT is writable. For a non-writable PLT, this is omitted or has a zero ++ value. */ ++#define DT_MIPS_RWPLT 0x70000034 ++#define DT_MIPS_NUM 0x35 ++ ++/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ ++ ++#define RHF_NONE 0 /* No flags */ ++#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ ++#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ ++#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ ++#define RHF_NO_MOVE (1 << 3) ++#define RHF_SGI_ONLY (1 << 4) ++#define RHF_GUARANTEE_INIT (1 << 5) ++#define RHF_DELTA_C_PLUS_PLUS (1 << 6) ++#define RHF_GUARANTEE_START_INIT (1 << 7) ++#define RHF_PIXIE (1 << 8) ++#define RHF_DEFAULT_DELAY_LOAD (1 << 9) ++#define RHF_REQUICKSTART (1 << 10) ++#define RHF_REQUICKSTARTED (1 << 11) ++#define RHF_CORD (1 << 12) ++#define RHF_NO_UNRES_UNDEF (1 << 13) ++#define RHF_RLD_ORDER_SAFE (1 << 14) ++ ++/* Entries found in sections of type SHT_MIPS_LIBLIST. */ ++ ++typedef struct ++{ ++ Elf32_Word l_name; /* Name (string table index) */ ++ Elf32_Word l_time_stamp; /* Timestamp */ ++ Elf32_Word l_checksum; /* Checksum */ ++ Elf32_Word l_version; /* Interface version */ ++ Elf32_Word l_flags; /* Flags */ ++} Elf32_Lib; ++ ++typedef struct ++{ ++ Elf64_Word l_name; /* Name (string table index) */ ++ Elf64_Word l_time_stamp; /* Timestamp */ ++ Elf64_Word l_checksum; /* Checksum */ ++ Elf64_Word l_version; /* Interface version */ ++ Elf64_Word l_flags; /* Flags */ ++} Elf64_Lib; ++ ++ ++/* Legal values for l_flags. */ ++ ++#define LL_NONE 0 ++#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ ++#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ ++#define LL_REQUIRE_MINOR (1 << 2) ++#define LL_EXPORTS (1 << 3) ++#define LL_DELAY_LOAD (1 << 4) ++#define LL_DELTA (1 << 5) ++ ++/* Entries found in sections of type SHT_MIPS_CONFLICT. */ ++ ++typedef Elf32_Addr Elf32_Conflict; ++ ++ ++/* HPPA specific definitions. */ ++ ++/* Legal values for e_flags field of Elf32_Ehdr. */ ++ ++#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ ++#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ ++#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ ++#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ ++#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch ++ prediction. */ ++#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ ++#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ ++ ++/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ ++ ++#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ ++#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ ++#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ ++ ++/* Additional section indeces. */ ++ ++#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared ++ symbols in ANSI C. */ ++#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ ++ ++/* Legal values for sh_type field of Elf32_Shdr. */ ++ ++#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ ++#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ ++#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ ++ ++/* Legal values for sh_flags field of Elf32_Shdr. */ ++ ++#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ ++#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ ++#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ ++ ++/* Legal values for ST_TYPE subfield of st_info (symbol type). */ ++ ++#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ ++ ++#define STT_HP_OPAQUE (STT_LOOS + 0x1) ++#define STT_HP_STUB (STT_LOOS + 0x2) ++ ++/* HPPA relocs. */ ++ ++#define R_PARISC_NONE 0 /* No reloc. */ ++#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ ++#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ ++#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ ++#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ ++#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ ++#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ ++#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ ++#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ ++#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ ++#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ ++#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ ++#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ ++#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ ++#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ ++#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ ++#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ ++#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ ++#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ ++#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ ++#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ ++#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ ++#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ ++#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ ++#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ ++#define R_PARISC_FPTR64 64 /* 64 bits function address. */ ++#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ ++#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ ++#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ ++#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ ++#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ ++#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ ++#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ ++#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ ++#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ ++#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ ++#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ ++#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ ++#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ ++#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ ++#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ ++#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ ++#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ ++#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ ++#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ ++#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ ++#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ ++#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ ++#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ ++#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ ++#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ ++#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ ++#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ ++#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ ++#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ ++#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ ++#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ ++#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ ++#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ ++#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ ++#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ ++#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ ++#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ ++#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ ++#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ ++#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ ++#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ ++#define R_PARISC_LORESERVE 128 ++#define R_PARISC_COPY 128 /* Copy relocation. */ ++#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ ++#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ ++#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ ++#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ ++#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ ++#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ ++#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ ++#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ ++#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ ++#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ ++#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ ++#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ ++#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ ++#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ ++#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ ++#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ ++#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ ++#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ ++#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ ++#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ ++#define R_PARISC_GNU_VTENTRY 232 ++#define R_PARISC_GNU_VTINHERIT 233 ++#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ ++#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ ++#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ ++#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ ++#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ ++#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ ++#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ ++#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ ++#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ ++#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ ++#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ ++#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ ++#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L ++#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R ++#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L ++#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R ++#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 ++#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 ++#define R_PARISC_HIRESERVE 255 ++ ++/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ ++ ++#define PT_HP_TLS (PT_LOOS + 0x0) ++#define PT_HP_CORE_NONE (PT_LOOS + 0x1) ++#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) ++#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) ++#define PT_HP_CORE_COMM (PT_LOOS + 0x4) ++#define PT_HP_CORE_PROC (PT_LOOS + 0x5) ++#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) ++#define PT_HP_CORE_STACK (PT_LOOS + 0x7) ++#define PT_HP_CORE_SHM (PT_LOOS + 0x8) ++#define PT_HP_CORE_MMF (PT_LOOS + 0x9) ++#define PT_HP_PARALLEL (PT_LOOS + 0x10) ++#define PT_HP_FASTBIND (PT_LOOS + 0x11) ++#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) ++#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) ++#define PT_HP_STACK (PT_LOOS + 0x14) ++ ++#define PT_PARISC_ARCHEXT 0x70000000 ++#define PT_PARISC_UNWIND 0x70000001 ++ ++/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ ++ ++#define PF_PARISC_SBP 0x08000000 ++ ++#define PF_HP_PAGE_SIZE 0x00100000 ++#define PF_HP_FAR_SHARED 0x00200000 ++#define PF_HP_NEAR_SHARED 0x00400000 ++#define PF_HP_CODE 0x01000000 ++#define PF_HP_MODIFY 0x02000000 ++#define PF_HP_LAZYSWAP 0x04000000 ++#define PF_HP_SBP 0x08000000 ++ ++ ++/* Alpha specific definitions. */ ++ ++/* Legal values for e_flags field of Elf64_Ehdr. */ ++ ++#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ ++#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ ++ ++/* Legal values for sh_type field of Elf64_Shdr. */ ++ ++/* These two are primerily concerned with ECOFF debugging info. */ ++#define SHT_ALPHA_DEBUG 0x70000001 ++#define SHT_ALPHA_REGINFO 0x70000002 ++ ++/* Legal values for sh_flags field of Elf64_Shdr. */ ++ ++#define SHF_ALPHA_GPREL 0x10000000 ++ ++/* Legal values for st_other field of Elf64_Sym. */ ++#define STO_ALPHA_NOPV 0x80 /* No PV required. */ ++#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ ++ ++/* Alpha relocs. */ ++ ++#define R_ALPHA_NONE 0 /* No reloc */ ++#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ ++#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ ++#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ ++#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ ++#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ ++#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ ++#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ ++#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ ++#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ ++#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ ++#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ ++#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ ++#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ ++#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ ++#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ ++#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ ++#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ ++#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ ++#define R_ALPHA_TLS_GD_HI 28 ++#define R_ALPHA_TLSGD 29 ++#define R_ALPHA_TLS_LDM 30 ++#define R_ALPHA_DTPMOD64 31 ++#define R_ALPHA_GOTDTPREL 32 ++#define R_ALPHA_DTPREL64 33 ++#define R_ALPHA_DTPRELHI 34 ++#define R_ALPHA_DTPRELLO 35 ++#define R_ALPHA_DTPREL16 36 ++#define R_ALPHA_GOTTPREL 37 ++#define R_ALPHA_TPREL64 38 ++#define R_ALPHA_TPRELHI 39 ++#define R_ALPHA_TPRELLO 40 ++#define R_ALPHA_TPREL16 41 ++/* Keep this the last entry. */ ++#define R_ALPHA_NUM 46 ++ ++/* Magic values of the LITUSE relocation addend. */ ++#define LITUSE_ALPHA_ADDR 0 ++#define LITUSE_ALPHA_BASE 1 ++#define LITUSE_ALPHA_BYTOFF 2 ++#define LITUSE_ALPHA_JSR 3 ++#define LITUSE_ALPHA_TLS_GD 4 ++#define LITUSE_ALPHA_TLS_LDM 5 ++ ++/* Legal values for d_tag of Elf64_Dyn. */ ++#define DT_ALPHA_PLTRO (DT_LOPROC + 0) ++#define DT_ALPHA_NUM 1 ++ ++/* PowerPC specific declarations */ ++ ++/* Values for Elf32/64_Ehdr.e_flags. */ ++#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ ++ ++/* Cygnus local bits below */ ++#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ ++#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib ++ flag */ ++ ++/* PowerPC relocations defined by the ABIs */ ++#define R_PPC_NONE 0 ++#define R_PPC_ADDR32 1 /* 32bit absolute address */ ++#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ ++#define R_PPC_ADDR16 3 /* 16bit absolute address */ ++#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ ++#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ ++#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ ++#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ ++#define R_PPC_ADDR14_BRTAKEN 8 ++#define R_PPC_ADDR14_BRNTAKEN 9 ++#define R_PPC_REL24 10 /* PC relative 26 bit */ ++#define R_PPC_REL14 11 /* PC relative 16 bit */ ++#define R_PPC_REL14_BRTAKEN 12 ++#define R_PPC_REL14_BRNTAKEN 13 ++#define R_PPC_GOT16 14 ++#define R_PPC_GOT16_LO 15 ++#define R_PPC_GOT16_HI 16 ++#define R_PPC_GOT16_HA 17 ++#define R_PPC_PLTREL24 18 ++#define R_PPC_COPY 19 ++#define R_PPC_GLOB_DAT 20 ++#define R_PPC_JMP_SLOT 21 ++#define R_PPC_RELATIVE 22 ++#define R_PPC_LOCAL24PC 23 ++#define R_PPC_UADDR32 24 ++#define R_PPC_UADDR16 25 ++#define R_PPC_REL32 26 ++#define R_PPC_PLT32 27 ++#define R_PPC_PLTREL32 28 ++#define R_PPC_PLT16_LO 29 ++#define R_PPC_PLT16_HI 30 ++#define R_PPC_PLT16_HA 31 ++#define R_PPC_SDAREL16 32 ++#define R_PPC_SECTOFF 33 ++#define R_PPC_SECTOFF_LO 34 ++#define R_PPC_SECTOFF_HI 35 ++#define R_PPC_SECTOFF_HA 36 ++ ++/* PowerPC relocations defined for the TLS access ABI. */ ++#define R_PPC_TLS 67 /* none (sym+add)@tls */ ++#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ ++#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ ++#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ ++#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ ++#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ ++#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ ++#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ ++#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ ++#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ ++#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ ++#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ ++#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ ++#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ ++#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ ++#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ ++#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ ++#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ ++#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ ++#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ ++#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ ++#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ ++#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ ++#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ ++#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ ++#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ ++#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ ++#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ ++ ++/* The remaining relocs are from the Embedded ELF ABI, and are not ++ in the SVR4 ELF ABI. */ ++#define R_PPC_EMB_NADDR32 101 ++#define R_PPC_EMB_NADDR16 102 ++#define R_PPC_EMB_NADDR16_LO 103 ++#define R_PPC_EMB_NADDR16_HI 104 ++#define R_PPC_EMB_NADDR16_HA 105 ++#define R_PPC_EMB_SDAI16 106 ++#define R_PPC_EMB_SDA2I16 107 ++#define R_PPC_EMB_SDA2REL 108 ++#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ ++#define R_PPC_EMB_MRKREF 110 ++#define R_PPC_EMB_RELSEC16 111 ++#define R_PPC_EMB_RELST_LO 112 ++#define R_PPC_EMB_RELST_HI 113 ++#define R_PPC_EMB_RELST_HA 114 ++#define R_PPC_EMB_BIT_FLD 115 ++#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ ++ ++/* Diab tool relocations. */ ++#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ ++#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ ++#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ ++#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ ++#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ ++#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ ++ ++/* GNU extension to support local ifunc. */ ++#define R_PPC_IRELATIVE 248 ++ ++/* GNU relocs used in PIC code sequences. */ ++#define R_PPC_REL16 249 /* half16 (sym+add-.) */ ++#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ ++#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ ++#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ ++ ++/* This is a phony reloc to handle any old fashioned TOC16 references ++ that may still be in object files. */ ++#define R_PPC_TOC16 255 ++ ++/* PowerPC specific values for the Dyn d_tag field. */ ++#define DT_PPC_GOT (DT_LOPROC + 0) ++#define DT_PPC_NUM 1 ++ ++/* PowerPC64 relocations defined by the ABIs */ ++#define R_PPC64_NONE R_PPC_NONE ++#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ ++#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ ++#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ ++#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ ++#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ ++#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ ++#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ ++#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN ++#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN ++#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ ++#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ ++#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN ++#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN ++#define R_PPC64_GOT16 R_PPC_GOT16 ++#define R_PPC64_GOT16_LO R_PPC_GOT16_LO ++#define R_PPC64_GOT16_HI R_PPC_GOT16_HI ++#define R_PPC64_GOT16_HA R_PPC_GOT16_HA ++ ++#define R_PPC64_COPY R_PPC_COPY ++#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT ++#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT ++#define R_PPC64_RELATIVE R_PPC_RELATIVE ++ ++#define R_PPC64_UADDR32 R_PPC_UADDR32 ++#define R_PPC64_UADDR16 R_PPC_UADDR16 ++#define R_PPC64_REL32 R_PPC_REL32 ++#define R_PPC64_PLT32 R_PPC_PLT32 ++#define R_PPC64_PLTREL32 R_PPC_PLTREL32 ++#define R_PPC64_PLT16_LO R_PPC_PLT16_LO ++#define R_PPC64_PLT16_HI R_PPC_PLT16_HI ++#define R_PPC64_PLT16_HA R_PPC_PLT16_HA ++ ++#define R_PPC64_SECTOFF R_PPC_SECTOFF ++#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO ++#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI ++#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA ++#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ ++#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ ++#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ ++#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ ++#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ ++#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ ++#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ ++#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ ++#define R_PPC64_PLT64 45 /* doubleword64 L + A */ ++#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ ++#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ ++#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ ++#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ ++#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ ++#define R_PPC64_TOC 51 /* doubleword64 .TOC */ ++#define R_PPC64_PLTGOT16 52 /* half16* M + A */ ++#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ ++#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ ++#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ ++ ++#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ ++#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ ++#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ ++#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ ++#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ ++#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ ++#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ ++#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ ++#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ ++#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ ++#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ ++ ++/* PowerPC64 relocations defined for the TLS access ABI. */ ++#define R_PPC64_TLS 67 /* none (sym+add)@tls */ ++#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ ++#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ ++#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ ++#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ ++#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ ++#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ ++#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ ++#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ ++#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ ++#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ ++#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ ++#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ ++#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ ++#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ ++#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ ++#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ ++#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ ++#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ ++#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ ++#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ ++#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ ++#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ ++#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ ++#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ ++#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ ++#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ ++#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ ++#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ ++#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ ++#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ ++#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ ++#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ ++#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ ++#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ ++#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ ++#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ ++#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ ++#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ ++#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ ++ ++/* GNU extension to support local ifunc. */ ++#define R_PPC64_JMP_IREL 247 ++#define R_PPC64_IRELATIVE 248 ++#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ ++#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ ++#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ ++#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ ++ ++/* PowerPC64 specific values for the Dyn d_tag field. */ ++#define DT_PPC64_GLINK (DT_LOPROC + 0) ++#define DT_PPC64_OPD (DT_LOPROC + 1) ++#define DT_PPC64_OPDSZ (DT_LOPROC + 2) ++#define DT_PPC64_NUM 3 ++ ++ ++/* ARM specific declarations */ ++ ++/* Processor specific flags for the ELF header e_flags field. */ ++#define EF_ARM_RELEXEC 0x01 ++#define EF_ARM_HASENTRY 0x02 ++#define EF_ARM_INTERWORK 0x04 ++#define EF_ARM_APCS_26 0x08 ++#define EF_ARM_APCS_FLOAT 0x10 ++#define EF_ARM_PIC 0x20 ++#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ ++#define EF_ARM_NEW_ABI 0x80 ++#define EF_ARM_OLD_ABI 0x100 ++#define EF_ARM_SOFT_FLOAT 0x200 ++#define EF_ARM_VFP_FLOAT 0x400 ++#define EF_ARM_MAVERICK_FLOAT 0x800 ++ ++ ++/* Other constants defined in the ARM ELF spec. version B-01. */ ++/* NB. These conflict with values defined above. */ ++#define EF_ARM_SYMSARESORTED 0x04 ++#define EF_ARM_DYNSYMSUSESEGIDX 0x08 ++#define EF_ARM_MAPSYMSFIRST 0x10 ++#define EF_ARM_EABIMASK 0XFF000000 ++ ++/* Constants defined in AAELF. */ ++#define EF_ARM_BE8 0x00800000 ++#define EF_ARM_LE8 0x00400000 ++ ++#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) ++#define EF_ARM_EABI_UNKNOWN 0x00000000 ++#define EF_ARM_EABI_VER1 0x01000000 ++#define EF_ARM_EABI_VER2 0x02000000 ++#define EF_ARM_EABI_VER3 0x03000000 ++#define EF_ARM_EABI_VER4 0x04000000 ++#define EF_ARM_EABI_VER5 0x05000000 ++ ++/* Additional symbol types for Thumb. */ ++#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ ++#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ ++ ++/* ARM-specific values for sh_flags */ ++#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ ++#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined ++ in the input to a link step. */ ++ ++/* ARM-specific program header flags */ ++#define PF_ARM_SB 0x10000000 /* Segment contains the location ++ addressed by the static base. */ ++#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ ++#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ ++ ++/* Processor specific values for the Phdr p_type field. */ ++#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ ++ ++/* Processor specific values for the Shdr sh_type field. */ ++#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ ++#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ ++#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ ++ ++ ++/* ARM relocs. */ ++ ++#define R_ARM_NONE 0 /* No reloc */ ++#define R_ARM_PC24 1 /* PC relative 26 bit branch */ ++#define R_ARM_ABS32 2 /* Direct 32 bit */ ++#define R_ARM_REL32 3 /* PC relative 32 bit */ ++#define R_ARM_PC13 4 ++#define R_ARM_ABS16 5 /* Direct 16 bit */ ++#define R_ARM_ABS12 6 /* Direct 12 bit */ ++#define R_ARM_THM_ABS5 7 ++#define R_ARM_ABS8 8 /* Direct 8 bit */ ++#define R_ARM_SBREL32 9 ++#define R_ARM_THM_PC22 10 ++#define R_ARM_THM_PC8 11 ++#define R_ARM_AMP_VCALL9 12 ++#define R_ARM_SWI24 13 /* Obsolete static relocation. */ ++#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ ++#define R_ARM_THM_SWI8 14 ++#define R_ARM_XPC25 15 ++#define R_ARM_THM_XPC22 16 ++#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ ++#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ ++#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ ++#define R_ARM_COPY 20 /* Copy symbol at runtime */ ++#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ ++#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ ++#define R_ARM_RELATIVE 23 /* Adjust by program base */ ++#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ ++#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ ++#define R_ARM_GOT32 26 /* 32 bit GOT entry */ ++#define R_ARM_PLT32 27 /* 32 bit PLT address */ ++#define R_ARM_ALU_PCREL_7_0 32 ++#define R_ARM_ALU_PCREL_15_8 33 ++#define R_ARM_ALU_PCREL_23_15 34 ++#define R_ARM_LDR_SBREL_11_0 35 ++#define R_ARM_ALU_SBREL_19_12 36 ++#define R_ARM_ALU_SBREL_27_20 37 ++#define R_ARM_TLS_GOTDESC 90 ++#define R_ARM_TLS_CALL 91 ++#define R_ARM_TLS_DESCSEQ 92 ++#define R_ARM_THM_TLS_CALL 93 ++#define R_ARM_GNU_VTENTRY 100 ++#define R_ARM_GNU_VTINHERIT 101 ++#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ ++#define R_ARM_THM_PC9 103 /* thumb conditional branch */ ++#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic ++ thread local data */ ++#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic ++ thread local data */ ++#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS ++ block */ ++#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of ++ static TLS block offset */ ++#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static ++ TLS block */ ++#define R_ARM_THM_TLS_DESCSEQ 129 ++#define R_ARM_IRELATIVE 160 ++#define R_ARM_RXPC25 249 ++#define R_ARM_RSBREL32 250 ++#define R_ARM_THM_RPC22 251 ++#define R_ARM_RREL32 252 ++#define R_ARM_RABS22 253 ++#define R_ARM_RPC24 254 ++#define R_ARM_RBASE 255 ++/* Keep this the last entry. */ ++#define R_ARM_NUM 256 ++ ++/* IA-64 specific declarations. */ ++ ++/* Processor specific flags for the Ehdr e_flags field. */ ++#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ ++#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ ++#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ ++ ++/* Processor specific values for the Phdr p_type field. */ ++#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ ++#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ ++#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) ++#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) ++#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) ++ ++/* Processor specific flags for the Phdr p_flags field. */ ++#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ ++ ++/* Processor specific values for the Shdr sh_type field. */ ++#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ ++#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ ++ ++/* Processor specific flags for the Shdr sh_flags field. */ ++#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ ++#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ ++ ++/* Processor specific values for the Dyn d_tag field. */ ++#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) ++#define DT_IA_64_NUM 1 ++ ++/* IA-64 relocations. */ ++#define R_IA64_NONE 0x00 /* none */ ++#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ ++#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ ++#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ ++#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ ++#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ ++#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ ++#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ ++#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ ++#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ ++#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ ++#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ ++#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ ++#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ ++#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ ++#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ ++#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ ++#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ ++#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ ++#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ ++#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ ++#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ ++#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ ++#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ ++#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ ++#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ ++#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ ++#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ ++#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ ++#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ ++#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ ++#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ ++#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ ++#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ ++#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ ++#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ ++#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ ++#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ ++#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ ++#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ ++#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ ++#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ ++#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ ++#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ ++#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ ++#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ ++#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ ++#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ ++#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ ++#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ ++#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ ++#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ ++#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ ++#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ ++#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ ++#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ ++#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ ++#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ ++#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ ++#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ ++#define R_IA64_COPY 0x84 /* copy relocation */ ++#define R_IA64_SUB 0x85 /* Addend and symbol difference */ ++#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ ++#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ ++#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ ++#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ ++#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ ++#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ ++#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ ++#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ ++#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ ++#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ ++#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ ++#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ ++#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ ++#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ ++#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ ++#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ ++#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ ++#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ ++#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ ++ ++/* SH specific declarations */ ++ ++/* Processor specific flags for the ELF header e_flags field. */ ++#define EF_SH_MACH_MASK 0x1f ++#define EF_SH_UNKNOWN 0x0 ++#define EF_SH1 0x1 ++#define EF_SH2 0x2 ++#define EF_SH3 0x3 ++#define EF_SH_DSP 0x4 ++#define EF_SH3_DSP 0x5 ++#define EF_SH4AL_DSP 0x6 ++#define EF_SH3E 0x8 ++#define EF_SH4 0x9 ++#define EF_SH2E 0xb ++#define EF_SH4A 0xc ++#define EF_SH2A 0xd ++#define EF_SH4_NOFPU 0x10 ++#define EF_SH4A_NOFPU 0x11 ++#define EF_SH4_NOMMU_NOFPU 0x12 ++#define EF_SH2A_NOFPU 0x13 ++#define EF_SH3_NOMMU 0x14 ++#define EF_SH2A_SH4_NOFPU 0x15 ++#define EF_SH2A_SH3_NOFPU 0x16 ++#define EF_SH2A_SH4 0x17 ++#define EF_SH2A_SH3E 0x18 ++ ++/* SH relocs. */ ++#define R_SH_NONE 0 ++#define R_SH_DIR32 1 ++#define R_SH_REL32 2 ++#define R_SH_DIR8WPN 3 ++#define R_SH_IND12W 4 ++#define R_SH_DIR8WPL 5 ++#define R_SH_DIR8WPZ 6 ++#define R_SH_DIR8BP 7 ++#define R_SH_DIR8W 8 ++#define R_SH_DIR8L 9 ++#define R_SH_SWITCH16 25 ++#define R_SH_SWITCH32 26 ++#define R_SH_USES 27 ++#define R_SH_COUNT 28 ++#define R_SH_ALIGN 29 ++#define R_SH_CODE 30 ++#define R_SH_DATA 31 ++#define R_SH_LABEL 32 ++#define R_SH_SWITCH8 33 ++#define R_SH_GNU_VTINHERIT 34 ++#define R_SH_GNU_VTENTRY 35 ++#define R_SH_TLS_GD_32 144 ++#define R_SH_TLS_LD_32 145 ++#define R_SH_TLS_LDO_32 146 ++#define R_SH_TLS_IE_32 147 ++#define R_SH_TLS_LE_32 148 ++#define R_SH_TLS_DTPMOD32 149 ++#define R_SH_TLS_DTPOFF32 150 ++#define R_SH_TLS_TPOFF32 151 ++#define R_SH_GOT32 160 ++#define R_SH_PLT32 161 ++#define R_SH_COPY 162 ++#define R_SH_GLOB_DAT 163 ++#define R_SH_JMP_SLOT 164 ++#define R_SH_RELATIVE 165 ++#define R_SH_GOTOFF 166 ++#define R_SH_GOTPC 167 ++/* Keep this the last entry. */ ++#define R_SH_NUM 256 ++ ++/* S/390 specific definitions. */ ++ ++/* Valid values for the e_flags field. */ ++ ++#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ ++ ++/* Additional s390 relocs */ ++ ++#define R_390_NONE 0 /* No reloc. */ ++#define R_390_8 1 /* Direct 8 bit. */ ++#define R_390_12 2 /* Direct 12 bit. */ ++#define R_390_16 3 /* Direct 16 bit. */ ++#define R_390_32 4 /* Direct 32 bit. */ ++#define R_390_PC32 5 /* PC relative 32 bit. */ ++#define R_390_GOT12 6 /* 12 bit GOT offset. */ ++#define R_390_GOT32 7 /* 32 bit GOT offset. */ ++#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ ++#define R_390_COPY 9 /* Copy symbol at runtime. */ ++#define R_390_GLOB_DAT 10 /* Create GOT entry. */ ++#define R_390_JMP_SLOT 11 /* Create PLT entry. */ ++#define R_390_RELATIVE 12 /* Adjust by program base. */ ++#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ ++#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ ++#define R_390_GOT16 15 /* 16 bit GOT offset. */ ++#define R_390_PC16 16 /* PC relative 16 bit. */ ++#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ ++#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ ++#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ ++#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ ++#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ ++#define R_390_64 22 /* Direct 64 bit. */ ++#define R_390_PC64 23 /* PC relative 64 bit. */ ++#define R_390_GOT64 24 /* 64 bit GOT offset. */ ++#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ ++#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ ++#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ ++#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ ++#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ ++#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ ++#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ ++#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ ++#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ ++#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ ++#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ ++#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ ++#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ ++#define R_390_TLS_GDCALL 38 /* Tag for function call in general ++ dynamic TLS code. */ ++#define R_390_TLS_LDCALL 39 /* Tag for function call in local ++ dynamic TLS code. */ ++#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic ++ thread local data. */ ++#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic ++ thread local data. */ ++#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS ++ block offset. */ ++#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS ++ block offset. */ ++#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS ++ block offset. */ ++#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic ++ thread local data in LE code. */ ++#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic ++ thread local data in LE code. */ ++#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for ++ negated static TLS block offset. */ ++#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for ++ negated static TLS block offset. */ ++#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for ++ negated static TLS block offset. */ ++#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to ++ static TLS block. */ ++#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to ++ static TLS block. */ ++#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS ++ block. */ ++#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS ++ block. */ ++#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ ++#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ ++#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS ++ block. */ ++#define R_390_20 57 /* Direct 20 bit. */ ++#define R_390_GOT20 58 /* 20 bit GOT offset. */ ++#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ ++#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS ++ block offset. */ ++#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ ++/* Keep this the last entry. */ ++#define R_390_NUM 62 ++ ++ ++/* CRIS relocations. */ ++#define R_CRIS_NONE 0 ++#define R_CRIS_8 1 ++#define R_CRIS_16 2 ++#define R_CRIS_32 3 ++#define R_CRIS_8_PCREL 4 ++#define R_CRIS_16_PCREL 5 ++#define R_CRIS_32_PCREL 6 ++#define R_CRIS_GNU_VTINHERIT 7 ++#define R_CRIS_GNU_VTENTRY 8 ++#define R_CRIS_COPY 9 ++#define R_CRIS_GLOB_DAT 10 ++#define R_CRIS_JUMP_SLOT 11 ++#define R_CRIS_RELATIVE 12 ++#define R_CRIS_16_GOT 13 ++#define R_CRIS_32_GOT 14 ++#define R_CRIS_16_GOTPLT 15 ++#define R_CRIS_32_GOTPLT 16 ++#define R_CRIS_32_GOTREL 17 ++#define R_CRIS_32_PLT_GOTREL 18 ++#define R_CRIS_32_PLT_PCREL 19 ++ ++#define R_CRIS_NUM 20 ++ ++ ++/* AMD x86-64 relocations. */ ++#define R_X86_64_NONE 0 /* No reloc */ ++#define R_X86_64_64 1 /* Direct 64 bit */ ++#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ ++#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ ++#define R_X86_64_PLT32 4 /* 32 bit PLT address */ ++#define R_X86_64_COPY 5 /* Copy symbol at runtime */ ++#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ ++#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ ++#define R_X86_64_RELATIVE 8 /* Adjust by program base */ ++#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative ++ offset to GOT */ ++#define R_X86_64_32 10 /* Direct 32 bit zero extended */ ++#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ ++#define R_X86_64_16 12 /* Direct 16 bit zero extended */ ++#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ ++#define R_X86_64_8 14 /* Direct 8 bit sign extended */ ++#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ ++#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ ++#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ ++#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ ++#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset ++ to two GOT entries for GD symbol */ ++#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset ++ to two GOT entries for LD symbol */ ++#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ ++#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset ++ to GOT entry for IE symbol */ ++#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ ++#define R_X86_64_PC64 24 /* PC relative 64 bit */ ++#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ ++#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative ++ offset to GOT */ ++#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ ++#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset ++ to GOT entry */ ++#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ ++#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ ++#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset ++ to PLT entry */ ++#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ ++#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ ++#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ ++#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS ++ descriptor. */ ++#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ ++#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ ++#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ ++ ++#define R_X86_64_NUM 39 ++ ++ ++/* AM33 relocations. */ ++#define R_MN10300_NONE 0 /* No reloc. */ ++#define R_MN10300_32 1 /* Direct 32 bit. */ ++#define R_MN10300_16 2 /* Direct 16 bit. */ ++#define R_MN10300_8 3 /* Direct 8 bit. */ ++#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ ++#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ ++#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ ++#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ ++#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ ++#define R_MN10300_24 9 /* Direct 24 bit. */ ++#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ ++#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ ++#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ ++#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ ++#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ ++#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ ++#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ ++#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ ++#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ ++#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ ++#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ ++#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ ++#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ ++#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ ++ ++#define R_MN10300_NUM 24 ++ ++ ++/* M32R relocs. */ ++#define R_M32R_NONE 0 /* No reloc. */ ++#define R_M32R_16 1 /* Direct 16 bit. */ ++#define R_M32R_32 2 /* Direct 32 bit. */ ++#define R_M32R_24 3 /* Direct 24 bit. */ ++#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ ++#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ ++#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ ++#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ ++#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ ++#define R_M32R_LO16 9 /* Low 16 bit. */ ++#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ ++#define R_M32R_GNU_VTINHERIT 11 ++#define R_M32R_GNU_VTENTRY 12 ++/* M32R relocs use SHT_RELA. */ ++#define R_M32R_16_RELA 33 /* Direct 16 bit. */ ++#define R_M32R_32_RELA 34 /* Direct 32 bit. */ ++#define R_M32R_24_RELA 35 /* Direct 24 bit. */ ++#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ ++#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ ++#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ ++#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ ++#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ ++#define R_M32R_LO16_RELA 41 /* Low 16 bit */ ++#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ ++#define R_M32R_RELA_GNU_VTINHERIT 43 ++#define R_M32R_RELA_GNU_VTENTRY 44 ++#define R_M32R_REL32 45 /* PC relative 32 bit. */ ++ ++#define R_M32R_GOT24 48 /* 24 bit GOT entry */ ++#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ ++#define R_M32R_COPY 50 /* Copy symbol at runtime */ ++#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ ++#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ ++#define R_M32R_RELATIVE 53 /* Adjust by program base */ ++#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ ++#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ ++#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned ++ low */ ++#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed ++ low */ ++#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ ++#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to ++ GOT with unsigned low */ ++#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to ++ GOT with signed low */ ++#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to ++ GOT */ ++#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT ++ with unsigned low */ ++#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT ++ with signed low */ ++#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ ++#define R_M32R_NUM 256 /* Keep this the last entry. */ ++ ++ ++/* TILEPro relocations. */ ++#define R_TILEPRO_NONE 0 /* No reloc */ ++#define R_TILEPRO_32 1 /* Direct 32 bit */ ++#define R_TILEPRO_16 2 /* Direct 16 bit */ ++#define R_TILEPRO_8 3 /* Direct 8 bit */ ++#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ ++#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ ++#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ ++#define R_TILEPRO_LO16 7 /* Low 16 bit */ ++#define R_TILEPRO_HI16 8 /* High 16 bit */ ++#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ ++#define R_TILEPRO_COPY 10 /* Copy relocation */ ++#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ ++#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ ++#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ ++#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ ++#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ ++#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ ++#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ ++#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ ++#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ ++#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ ++#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ ++#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ ++#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ ++#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ ++#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ ++#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ ++#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ ++#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ ++#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ ++#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ ++#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ ++#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ ++#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ ++#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ ++#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ ++#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ ++#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ ++#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ ++#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ ++#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ ++#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ ++#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ ++#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ ++#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ ++#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ ++#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ ++#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ ++#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ ++#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ ++/* Relocs 56-59 are currently not defined. */ ++#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ ++#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ ++#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ ++#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ ++#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ ++#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ ++#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ ++#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ ++#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ ++#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ ++#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ ++#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ ++#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ ++ ++#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ ++#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ ++ ++#define R_TILEPRO_NUM 130 ++ ++ ++/* TILE-Gx relocations. */ ++#define R_TILEGX_NONE 0 /* No reloc */ ++#define R_TILEGX_64 1 /* Direct 64 bit */ ++#define R_TILEGX_32 2 /* Direct 32 bit */ ++#define R_TILEGX_16 3 /* Direct 16 bit */ ++#define R_TILEGX_8 4 /* Direct 8 bit */ ++#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ ++#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ ++#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ ++#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ ++#define R_TILEGX_HW0 9 /* hword 0 16-bit */ ++#define R_TILEGX_HW1 10 /* hword 1 16-bit */ ++#define R_TILEGX_HW2 11 /* hword 2 16-bit */ ++#define R_TILEGX_HW3 12 /* hword 3 16-bit */ ++#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ ++#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ ++#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ ++#define R_TILEGX_COPY 16 /* Copy relocation */ ++#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ ++#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ ++#define R_TILEGX_RELATIVE 19 /* Adjust by program base */ ++#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ ++#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ ++#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ ++#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ ++#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ ++#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ ++#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ ++#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ ++#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ ++#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ ++#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ ++#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ ++#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ ++#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ ++#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ ++#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ ++#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ ++#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ ++#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ ++#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ ++#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ ++#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ ++#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ ++#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ ++#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ ++#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ ++#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ ++#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ ++#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ ++#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ ++#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ ++#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ ++#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ ++#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ ++#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ ++#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ ++#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ ++#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ ++#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ ++#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ ++#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ ++#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ ++#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ ++#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ ++#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ ++#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ ++/* Relocs 66-71 are currently not defined. */ ++#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ ++#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ ++#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ ++#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ ++/* Relocs 76-77 are currently not defined. */ ++#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ ++#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ ++#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ ++#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ ++#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ ++#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ ++#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ ++#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ ++#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ ++#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ ++#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ ++#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ ++/* Relocs 90-91 are currently not defined. */ ++#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ ++#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ ++/* Relocs 94-99 are currently not defined. */ ++#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ ++#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ ++#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ ++#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ ++/* Relocs 104-105 are currently not defined. */ ++#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ ++#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ ++#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ ++#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ ++#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ ++#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ ++#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ ++#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ ++#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ ++#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ ++#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ ++#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ ++#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ ++#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ ++#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ ++#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ ++ ++#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ ++#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ ++ ++#define R_TILEGX_NUM 130 ++ ++#endif /* elf.h */ diff --git a/target/linux/generic/pending-3.18/212-byteshift_portability.patch b/target/linux/generic/pending-3.18/212-byteshift_portability.patch new file mode 100644 index 000000000..0f23ba9be --- /dev/null +++ b/target/linux/generic/pending-3.18/212-byteshift_portability.patch @@ -0,0 +1,51 @@ +--- a/tools/include/tools/be_byteshift.h ++++ b/tools/include/tools/be_byteshift.h +@@ -1,6 +1,10 @@ + #ifndef _TOOLS_BE_BYTESHIFT_H + #define _TOOLS_BE_BYTESHIFT_H + ++#ifndef __linux__ ++#include "linux_types.h" ++#endif ++ + #include + + static inline uint16_t __get_unaligned_be16(const uint8_t *p) +--- a/tools/include/tools/le_byteshift.h ++++ b/tools/include/tools/le_byteshift.h +@@ -1,6 +1,10 @@ + #ifndef _TOOLS_LE_BYTESHIFT_H + #define _TOOLS_LE_BYTESHIFT_H + ++#ifndef __linux__ ++#include "linux_types.h" ++#endif ++ + #include + + static inline uint16_t __get_unaligned_le16(const uint8_t *p) +--- /dev/null ++++ b/tools/include/tools/linux_types.h +@@ -0,0 +1,22 @@ ++#ifndef __LINUX_TYPES_H ++#define __LINUX_TYPES_H ++ ++#include ++ ++typedef uint8_t __u8; ++typedef uint8_t __be8; ++typedef uint8_t __le8; ++ ++typedef uint16_t __u16; ++typedef uint16_t __be16; ++typedef uint16_t __le16; ++ ++typedef uint32_t __u32; ++typedef uint32_t __be32; ++typedef uint32_t __le32; ++ ++typedef uint64_t __u64; ++typedef uint64_t __be64; ++typedef uint64_t __le64; ++ ++#endif diff --git a/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch b/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch new file mode 100644 index 000000000..937ab9054 --- /dev/null +++ b/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch @@ -0,0 +1,13 @@ +--- a/arch/x86/vdso/vdso2c.c ++++ b/arch/x86/vdso/vdso2c.c +@@ -63,8 +63,8 @@ + + #include + +-#include +-#include ++#include ++#include + + const char *outfilename; + diff --git a/target/linux/generic/pending-3.18/214-spidev_h_portability.patch b/target/linux/generic/pending-3.18/214-spidev_h_portability.patch new file mode 100644 index 000000000..39fa32ffa --- /dev/null +++ b/target/linux/generic/pending-3.18/214-spidev_h_portability.patch @@ -0,0 +1,11 @@ +--- a/include/uapi/linux/spi/spidev.h ++++ b/include/uapi/linux/spi/spidev.h +@@ -112,7 +112,7 @@ struct spi_ioc_transfer { + + /* not all platforms use or _IOC_TYPECHECK() ... */ + #define SPI_MSGSIZE(N) \ +- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ ++ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \ + ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) + #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) + diff --git a/target/linux/generic/pending-3.18/220-gc_sections.patch b/target/linux/generic/pending-3.18/220-gc_sections.patch new file mode 100644 index 000000000..d872949f8 --- /dev/null +++ b/target/linux/generic/pending-3.18/220-gc_sections.patch @@ -0,0 +1,531 @@ +From: Felix Fietkau + +use -ffunction-sections, -fdata-sections and --gc-sections + +In combination with kernel symbol export stripping this significantly reduces +the kernel image size. Used on both ARM and MIPS architectures. + +Signed-off-by: Felix Fietkau +Signed-off-by: Jonas Gorski +Signed-off-by: Gabor Juhos +--- + +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -89,10 +89,14 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin + # + cflags-y += -G 0 -mno-abicalls -fno-pic -pipe + cflags-y += -msoft-float +-LDFLAGS_vmlinux += -G 0 -static -n -nostdlib ++LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections + KBUILD_AFLAGS_MODULE += -mlong-calls + KBUILD_CFLAGS_MODULE += -mlong-calls + ++ifndef CONFIG_FUNCTION_TRACER ++KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections ++endif ++ + # + # pass -msoft-float to GAS if it supports it. However on newer binutils + # (specifically newer than 2.24.51.20140728) we then also need to explicitly +--- a/arch/mips/kernel/vmlinux.lds.S ++++ b/arch/mips/kernel/vmlinux.lds.S +@@ -67,7 +67,7 @@ SECTIONS + /* Exception table for data bus errors */ + __dbe_table : { + __start___dbe_table = .; +- *(__dbe_table) ++ KEEP(*(__dbe_table)) + __stop___dbe_table = .; + } + +@@ -112,7 +112,7 @@ SECTIONS + . = ALIGN(4); + .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { + __mips_machines_start = .; +- *(.mips.machines.init) ++ KEEP(*(.mips.machines.init)) + __mips_machines_end = .; + } + +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -89,7 +89,7 @@ + #ifdef CONFIG_FTRACE_MCOUNT_RECORD + #define MCOUNT_REC() . = ALIGN(8); \ + VMLINUX_SYMBOL(__start_mcount_loc) = .; \ +- *(__mcount_loc) \ ++ KEEP(*(__mcount_loc)) \ + VMLINUX_SYMBOL(__stop_mcount_loc) = .; + #else + #define MCOUNT_REC() +@@ -97,7 +97,7 @@ + + #ifdef CONFIG_TRACE_BRANCH_PROFILING + #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \ +- *(_ftrace_annotated_branch) \ ++ KEEP(*(_ftrace_annotated_branch)) \ + VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .; + #else + #define LIKELY_PROFILE() +@@ -105,7 +105,7 @@ + + #ifdef CONFIG_PROFILE_ALL_BRANCHES + #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \ +- *(_ftrace_branch) \ ++ KEEP(*(_ftrace_branch)) \ + VMLINUX_SYMBOL(__stop_branch_profile) = .; + #else + #define BRANCH_PROFILE() +@@ -114,7 +114,7 @@ + #ifdef CONFIG_KPROBES + #define KPROBE_BLACKLIST() . = ALIGN(8); \ + VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \ +- *(_kprobe_blacklist) \ ++ KEEP(*(_kprobe_blacklist)) \ + VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .; + #else + #define KPROBE_BLACKLIST() +@@ -123,7 +123,7 @@ + #ifdef CONFIG_EVENT_TRACING + #define FTRACE_EVENTS() . = ALIGN(8); \ + VMLINUX_SYMBOL(__start_ftrace_events) = .; \ +- *(_ftrace_events) \ ++ KEEP(*(_ftrace_events)) \ + VMLINUX_SYMBOL(__stop_ftrace_events) = .; + #else + #define FTRACE_EVENTS() +@@ -131,7 +131,7 @@ + + #ifdef CONFIG_TRACING + #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \ +- *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \ ++ KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \ + VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .; + #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \ + *(__tracepoint_str) /* Trace_printk fmt' pointer */ \ +@@ -144,7 +144,7 @@ + #ifdef CONFIG_FTRACE_SYSCALLS + #define TRACE_SYSCALLS() . = ALIGN(8); \ + VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ +- *(__syscalls_metadata) \ ++ KEEP(*(__syscalls_metadata)) \ + VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; + #else + #define TRACE_SYSCALLS() +@@ -158,8 +158,8 @@ + #define _OF_TABLE_1(name) \ + . = ALIGN(8); \ + VMLINUX_SYMBOL(__##name##_of_table) = .; \ +- *(__##name##_of_table) \ +- *(__##name##_of_table_end) ++ KEEP(*(__##name##_of_table)) \ ++ KEEP(*(__##name##_of_table_end)) + + #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc) + #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) +@@ -171,7 +171,7 @@ + #define KERNEL_DTB() \ + STRUCT_ALIGN(); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ +- *(.dtb.init.rodata) \ ++ KEEP(*(.dtb.init.rodata)) \ + VMLINUX_SYMBOL(__dtb_end) = .; + + /* .data section */ +@@ -187,16 +187,17 @@ + /* implement dynamic printk debug */ \ + . = ALIGN(8); \ + VMLINUX_SYMBOL(__start___jump_table) = .; \ +- *(__jump_table) \ ++ KEEP(*(__jump_table)) \ + VMLINUX_SYMBOL(__stop___jump_table) = .; \ + . = ALIGN(8); \ + VMLINUX_SYMBOL(__start___verbose) = .; \ +- *(__verbose) \ ++ KEEP(*(__verbose)) \ + VMLINUX_SYMBOL(__stop___verbose) = .; \ + LIKELY_PROFILE() \ + BRANCH_PROFILE() \ + TRACE_PRINTKS() \ +- TRACEPOINT_STR() ++ TRACEPOINT_STR() \ ++ *(.data.[a-zA-Z_]*) + + /* + * Data section helpers +@@ -250,35 +251,35 @@ + /* PCI quirks */ \ + .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ +- *(.pci_fixup_early) \ ++ KEEP(*(.pci_fixup_early)) \ + VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \ +- *(.pci_fixup_header) \ ++ KEEP(*(.pci_fixup_header)) \ + VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \ +- *(.pci_fixup_final) \ ++ KEEP(*(.pci_fixup_final)) \ + VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ +- *(.pci_fixup_enable) \ ++ KEEP(*(.pci_fixup_enable)) \ + VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ +- *(.pci_fixup_resume) \ ++ KEEP(*(.pci_fixup_resume)) \ + VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \ +- *(.pci_fixup_resume_early) \ ++ KEEP(*(.pci_fixup_resume_early)) \ + VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \ +- *(.pci_fixup_suspend) \ ++ KEEP(*(.pci_fixup_suspend)) \ + VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \ +- *(.pci_fixup_suspend_late) \ ++ KEEP(*(.pci_fixup_suspend_late)) \ + VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \ + } \ + \ + /* Built-in firmware blobs */ \ + .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start_builtin_fw) = .; \ +- *(.builtin_fw) \ ++ KEEP(*(.builtin_fw)) \ + VMLINUX_SYMBOL(__end_builtin_fw) = .; \ + } \ + \ +@@ -287,49 +288,49 @@ + /* Kernel symbol table: Normal symbols */ \ + __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab) = .; \ +- *(SORT(___ksymtab+*)) \ ++ KEEP(*(SORT(___ksymtab+*))) \ + VMLINUX_SYMBOL(__stop___ksymtab) = .; \ + } \ + \ + /* Kernel symbol table: GPL-only symbols */ \ + __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ +- *(SORT(___ksymtab_gpl+*)) \ ++ KEEP(*(SORT(___ksymtab_gpl+*))) \ + VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ + } \ + \ + /* Kernel symbol table: Normal unused symbols */ \ + __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ +- *(SORT(___ksymtab_unused+*)) \ ++ KEEP(*(SORT(___ksymtab_unused+*))) \ + VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ + } \ + \ + /* Kernel symbol table: GPL-only unused symbols */ \ + __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ +- *(SORT(___ksymtab_unused_gpl+*)) \ ++ KEEP(*(SORT(___ksymtab_unused_gpl+*))) \ + VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ + } \ + \ + /* Kernel symbol table: GPL-future-only symbols */ \ + __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ +- *(SORT(___ksymtab_gpl_future+*)) \ ++ KEEP(*(SORT(___ksymtab_gpl_future+*))) \ + VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \ + } \ + \ + /* Kernel symbol table: Normal symbols */ \ + __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___kcrctab) = .; \ +- *(SORT(___kcrctab+*)) \ ++ KEEP(*(SORT(___kcrctab+*))) \ + VMLINUX_SYMBOL(__stop___kcrctab) = .; \ + } \ + \ + /* Kernel symbol table: GPL-only symbols */ \ + __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ +- *(SORT(___kcrctab_gpl+*)) \ ++ KEEP(*(SORT(___kcrctab_gpl+*))) \ + VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ + } \ + \ +@@ -343,14 +344,14 @@ + /* Kernel symbol table: GPL-only unused symbols */ \ + __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ +- *(SORT(___kcrctab_unused_gpl+*)) \ ++ KEEP(*(SORT(___kcrctab_unused_gpl+*))) \ + VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ + } \ + \ + /* Kernel symbol table: GPL-future-only symbols */ \ + __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ +- *(SORT(___kcrctab_gpl_future+*)) \ ++ KEEP(*(SORT(___kcrctab_gpl_future+*))) \ + VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \ + } \ + \ +@@ -369,14 +370,14 @@ + /* Built-in module parameters. */ \ + __param : AT(ADDR(__param) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___param) = .; \ +- *(__param) \ ++ KEEP(*(__param)) \ + VMLINUX_SYMBOL(__stop___param) = .; \ + } \ + \ + /* Built-in module versions. */ \ + __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___modver) = .; \ +- *(__modver) \ ++ KEEP(*(__modver)) \ + VMLINUX_SYMBOL(__stop___modver) = .; \ + . = ALIGN((align)); \ + VMLINUX_SYMBOL(__end_rodata) = .; \ +@@ -432,7 +433,7 @@ + #define ENTRY_TEXT \ + ALIGN_FUNCTION(); \ + VMLINUX_SYMBOL(__entry_text_start) = .; \ +- *(.entry.text) \ ++ KEEP(*(.entry.text)) \ + VMLINUX_SYMBOL(__entry_text_end) = .; + + #ifdef CONFIG_FUNCTION_GRAPH_TRACER +@@ -460,7 +461,7 @@ + . = ALIGN(align); \ + __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ex_table) = .; \ +- *(__ex_table) \ ++ KEEP(*(__ex_table)) \ + VMLINUX_SYMBOL(__stop___ex_table) = .; \ + } + +@@ -476,8 +477,8 @@ + #ifdef CONFIG_CONSTRUCTORS + #define KERNEL_CTORS() . = ALIGN(8); \ + VMLINUX_SYMBOL(__ctors_start) = .; \ +- *(.ctors) \ +- *(.init_array) \ ++ KEEP(*(.ctors)) \ ++ KEEP(*(.init_array)) \ + VMLINUX_SYMBOL(__ctors_end) = .; + #else + #define KERNEL_CTORS() +@@ -525,7 +526,7 @@ + #define SBSS(sbss_align) \ + . = ALIGN(sbss_align); \ + .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ +- *(.sbss) \ ++ *(.sbss .sbss.*) \ + *(.scommon) \ + } + +@@ -543,7 +544,7 @@ + BSS_FIRST_SECTIONS \ + *(.bss..page_aligned) \ + *(.dynbss) \ +- *(.bss) \ ++ *(.bss .bss.*) \ + *(COMMON) \ + } + +@@ -592,7 +593,7 @@ + . = ALIGN(8); \ + __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___bug_table) = .; \ +- *(__bug_table) \ ++ KEEP(*(__bug_table)) \ + VMLINUX_SYMBOL(__stop___bug_table) = .; \ + } + #else +@@ -604,7 +605,7 @@ + . = ALIGN(4); \ + .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__tracedata_start) = .; \ +- *(.tracedata) \ ++ KEEP(*(.tracedata)) \ + VMLINUX_SYMBOL(__tracedata_end) = .; \ + } + #else +@@ -621,17 +622,17 @@ + #define INIT_SETUP(initsetup_align) \ + . = ALIGN(initsetup_align); \ + VMLINUX_SYMBOL(__setup_start) = .; \ +- *(.init.setup) \ ++ KEEP(*(.init.setup)) \ + VMLINUX_SYMBOL(__setup_end) = .; + + #define INIT_CALLS_LEVEL(level) \ + VMLINUX_SYMBOL(__initcall##level##_start) = .; \ +- *(.initcall##level##.init) \ +- *(.initcall##level##s.init) \ ++ KEEP(*(.initcall##level##.init)) \ ++ KEEP(*(.initcall##level##s.init)) \ + + #define INIT_CALLS \ + VMLINUX_SYMBOL(__initcall_start) = .; \ +- *(.initcallearly.init) \ ++ KEEP(*(.initcallearly.init)) \ + INIT_CALLS_LEVEL(0) \ + INIT_CALLS_LEVEL(1) \ + INIT_CALLS_LEVEL(2) \ +@@ -645,21 +646,21 @@ + + #define CON_INITCALL \ + VMLINUX_SYMBOL(__con_initcall_start) = .; \ +- *(.con_initcall.init) \ ++ KEEP(*(.con_initcall.init)) \ + VMLINUX_SYMBOL(__con_initcall_end) = .; + + #define SECURITY_INITCALL \ + VMLINUX_SYMBOL(__security_initcall_start) = .; \ +- *(.security_initcall.init) \ ++ KEEP(*(.security_initcall.init)) \ + VMLINUX_SYMBOL(__security_initcall_end) = .; + + #ifdef CONFIG_BLK_DEV_INITRD + #define INIT_RAM_FS \ + . = ALIGN(4); \ + VMLINUX_SYMBOL(__initramfs_start) = .; \ +- *(.init.ramfs) \ ++ KEEP(*(.init.ramfs)) \ + . = ALIGN(8); \ +- *(.init.ramfs.info) ++ KEEP(*(.init.ramfs.info)) + #else + #define INIT_RAM_FS + #endif +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -18,11 +18,16 @@ ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) + LDFLAGS_vmlinux += --be8 + LDFLAGS_MODULE += --be8 + endif ++LDFLAGS_vmlinux += --gc-sections + + OBJCOPYFLAGS :=-O binary -R .comment -S + GZFLAGS :=-9 + #KBUILD_CFLAGS +=-pipe + ++ifndef CONFIG_FUNCTION_TRACER ++KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections ++endif ++ + # Never generate .eh_frame + KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) + +--- a/arch/arm/kernel/vmlinux.lds.S ++++ b/arch/arm/kernel/vmlinux.lds.S +@@ -12,13 +12,13 @@ + #define PROC_INFO \ + . = ALIGN(4); \ + VMLINUX_SYMBOL(__proc_info_begin) = .; \ +- *(.proc.info.init) \ ++ KEEP(*(.proc.info.init)) \ + VMLINUX_SYMBOL(__proc_info_end) = .; + + #define IDMAP_TEXT \ + ALIGN_FUNCTION(); \ + VMLINUX_SYMBOL(__idmap_text_start) = .; \ +- *(.idmap.text) \ ++ KEEP(*(.idmap.text)) \ + VMLINUX_SYMBOL(__idmap_text_end) = .; \ + . = ALIGN(32); \ + VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ +@@ -93,7 +93,7 @@ SECTIONS + .text : { /* Real text segment */ + _stext = .; /* Text and read-only data */ + __exception_text_start = .; +- *(.exception.text) ++ KEEP(*(.exception.text)) + __exception_text_end = .; + IRQENTRY_TEXT + TEXT_TEXT +@@ -118,7 +118,7 @@ SECTIONS + __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { + __start___ex_table = .; + #ifdef CONFIG_MMU +- *(__ex_table) ++ KEEP(*(__ex_table)) + #endif + __stop___ex_table = .; + } +@@ -130,12 +130,12 @@ SECTIONS + . = ALIGN(8); + .ARM.unwind_idx : { + __start_unwind_idx = .; +- *(.ARM.exidx*) ++ KEEP(*(.ARM.exidx*)) + __stop_unwind_idx = .; + } + .ARM.unwind_tab : { + __start_unwind_tab = .; +- *(.ARM.extab*) ++ KEEP(*(.ARM.extab*)) + __stop_unwind_tab = .; + } + #endif +@@ -154,14 +154,14 @@ SECTIONS + */ + __vectors_start = .; + .vectors 0 : AT(__vectors_start) { +- *(.vectors) ++ KEEP(*(.vectors)) + } + . = __vectors_start + SIZEOF(.vectors); + __vectors_end = .; + + __stubs_start = .; + .stubs 0x1000 : AT(__stubs_start) { +- *(.stubs) ++ KEEP(*(.stubs)) + } + . = __stubs_start + SIZEOF(.stubs); + __stubs_end = .; +@@ -175,24 +175,24 @@ SECTIONS + } + .init.arch.info : { + __arch_info_begin = .; +- *(.arch.info.init) ++ KEEP(*(.arch.info.init)) + __arch_info_end = .; + } + .init.tagtable : { + __tagtable_begin = .; +- *(.taglist.init) ++ KEEP(*(.taglist.init)) + __tagtable_end = .; + } + #ifdef CONFIG_SMP_ON_UP + .init.smpalt : { + __smpalt_begin = .; +- *(.alt.smp.init) ++ KEEP(*(.alt.smp.init)) + __smpalt_end = .; + } + #endif + .init.pv_table : { + __pv_table_begin = .; +- *(.pv_table) ++ KEEP(*(.pv_table)) + __pv_table_end = .; + } + .init.data : { +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -122,6 +122,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) + ORIG_CFLAGS := $(KBUILD_CFLAGS) + KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) + endif ++KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL)) + + ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) + asflags-y := -DZIMAGE diff --git a/target/linux/generic/pending-3.18/221-module_exports.patch b/target/linux/generic/pending-3.18/221-module_exports.patch new file mode 100644 index 000000000..f2cad7a02 --- /dev/null +++ b/target/linux/generic/pending-3.18/221-module_exports.patch @@ -0,0 +1,88 @@ +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -54,6 +54,16 @@ + #define LOAD_OFFSET 0 + #endif + ++#ifndef SYMTAB_KEEP ++#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*))) ++#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*))) ++#endif ++ ++#ifndef SYMTAB_DISCARD ++#define SYMTAB_DISCARD ++#define SYMTAB_DISCARD_GPL ++#endif ++ + #include + + /* Align . to a 8 byte boundary equals to maximum function alignment. */ +@@ -288,14 +298,14 @@ + /* Kernel symbol table: Normal symbols */ \ + __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab) = .; \ +- KEEP(*(SORT(___ksymtab+*))) \ ++ SYMTAB_KEEP \ + VMLINUX_SYMBOL(__stop___ksymtab) = .; \ + } \ + \ + /* Kernel symbol table: GPL-only symbols */ \ + __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ +- KEEP(*(SORT(___ksymtab_gpl+*))) \ ++ SYMTAB_KEEP_GPL \ + VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ + } \ + \ +@@ -357,7 +367,7 @@ + \ + /* Kernel symbol table: strings */ \ + __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ +- *(__ksymtab_strings) \ ++ *(__ksymtab_strings+*) \ + } \ + \ + /* __*init sections */ \ +@@ -679,6 +689,8 @@ + EXIT_TEXT \ + EXIT_DATA \ + EXIT_CALL \ ++ SYMTAB_DISCARD \ ++ SYMTAB_DISCARD_GPL \ + *(.discard) \ + *(.discard.*) \ + } +--- a/scripts/Makefile.build ++++ b/scripts/Makefile.build +@@ -298,7 +298,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( + # Linker scripts preprocessor (.lds.S -> .lds) + # --------------------------------------------------------------------------- + quiet_cmd_cpp_lds_S = LDS $@ +- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ ++ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \ + -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< + + $(obj)/%.lds: $(src)/%.lds.S FORCE +--- a/include/linux/export.h ++++ b/include/linux/export.h +@@ -52,12 +52,19 @@ extern struct module __this_module; + #define __CRC_SYMBOL(sym, sec) + #endif + ++#ifdef MODULE ++#define __EXPORT_SUFFIX(sym) ++#else ++#define __EXPORT_SUFFIX(sym) "+" #sym ++#endif ++ + /* For every exported symbol, place a struct in the __ksymtab section */ + #define __EXPORT_SYMBOL(sym, sec) \ + extern typeof(sym) sym; \ + __CRC_SYMBOL(sym, sec) \ + static const char __kstrtab_##sym[] \ +- __attribute__((section("__ksymtab_strings"), aligned(1))) \ ++ __attribute__((section("__ksymtab_strings" \ ++ __EXPORT_SUFFIX(sym)), aligned(1))) \ + = VMLINUX_SYMBOL_STR(sym); \ + extern const struct kernel_symbol __ksymtab_##sym; \ + __visible const struct kernel_symbol __ksymtab_##sym \ diff --git a/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch b/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch new file mode 100644 index 000000000..e59fdcd2e --- /dev/null +++ b/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch @@ -0,0 +1,58 @@ +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -325,7 +325,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) + + quiet_cmd_lzma = LZMA $@ + cmd_lzma = (cat $(filter-out FORCE,$^) | \ +- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ ++ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + (rm -f $@ ; false) + + quiet_cmd_lzo = LZO $@ +--- a/scripts/gen_initramfs_list.sh ++++ b/scripts/gen_initramfs_list.sh +@@ -226,7 +226,7 @@ cpio_list= + output="/dev/stdout" + output_file="" + is_cpio_compressed= +-compr="gzip -n -9 -f" ++compr="gzip -n -9 -f -" + + arg="$1" + case "$arg" in +@@ -242,13 +242,13 @@ case "$arg" in + output=${cpio_list} + echo "$output_file" | grep -q "\.gz$" \ + && [ -x "`which gzip 2> /dev/null`" ] \ +- && compr="gzip -n -9 -f" ++ && compr="gzip -n -9 -f -" + echo "$output_file" | grep -q "\.bz2$" \ + && [ -x "`which bzip2 2> /dev/null`" ] \ +- && compr="bzip2 -9 -f" ++ && compr="bzip2 -9 -f -" + echo "$output_file" | grep -q "\.lzma$" \ + && [ -x "`which lzma 2> /dev/null`" ] \ +- && compr="lzma -9 -f" ++ && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so" + echo "$output_file" | grep -q "\.xz$" \ + && [ -x "`which xz 2> /dev/null`" ] \ + && compr="xz --check=crc32 --lzma2=dict=1MiB" +@@ -315,7 +315,7 @@ if [ ! -z ${output_file} ]; then + if [ "${is_cpio_compressed}" = "compressed" ]; then + cat ${cpio_tfile} > ${output_file} + else +- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ ++ (cat ${cpio_tfile} | ${compr} > ${output_file}) \ + || (rm -f ${output_file} ; false) + fi + [ -z ${cpio_file} ] && rm ${cpio_tfile} +--- a/lib/decompress.c ++++ b/lib/decompress.c +@@ -48,6 +48,7 @@ static const struct compress_format comp + { {037, 0236}, "gzip", gunzip }, + { {0x42, 0x5a}, "bzip2", bunzip2 }, + { {0x5d, 0x00}, "lzma", unlzma }, ++ { {0x6d, 0x00}, "lzma-openwrt", unlzma }, + { {0xfd, 0x37}, "xz", unxz }, + { {0x89, 0x4c}, "lzo", unlzo }, + { {0x02, 0x21}, "lz4", unlz4 }, diff --git a/target/linux/generic/pending-3.18/250-netfilter_depends.patch b/target/linux/generic/pending-3.18/250-netfilter_depends.patch new file mode 100644 index 000000000..47be4a019 --- /dev/null +++ b/target/linux/generic/pending-3.18/250-netfilter_depends.patch @@ -0,0 +1,18 @@ +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -210,7 +210,6 @@ config NF_CONNTRACK_FTP + + config NF_CONNTRACK_H323 + tristate "H.323 protocol support" +- depends on (IPV6 || IPV6=n) + depends on NETFILTER_ADVANCED + help + H.323 is a VoIP signalling protocol from ITU-T. As one of the most +@@ -907,7 +906,6 @@ config NETFILTER_XT_TARGET_SECMARK + + config NETFILTER_XT_TARGET_TCPMSS + tristate '"TCPMSS" target support' +- depends on (IPV6 || IPV6=n) + default m if NETFILTER_ADVANCED=n + ---help--- + This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic/pending-3.18/251-sound_kconfig.patch b/target/linux/generic/pending-3.18/251-sound_kconfig.patch new file mode 100644 index 000000000..c2ebacecd --- /dev/null +++ b/target/linux/generic/pending-3.18/251-sound_kconfig.patch @@ -0,0 +1,18 @@ +--- a/sound/core/Kconfig ++++ b/sound/core/Kconfig +@@ -10,13 +10,13 @@ config SND_DMAENGINE_PCM + tristate + + config SND_HWDEP +- tristate ++ tristate "Sound hardware support" + + config SND_RAWMIDI + tristate + + config SND_COMPRESS_OFFLOAD +- tristate ++ tristate "Compression offloading support" + + # To be effective this also requires INPUT - users should say: + # select SND_JACK if INPUT=y || INPUT=SND diff --git a/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch b/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch new file mode 100644 index 000000000..fee28db12 --- /dev/null +++ b/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch @@ -0,0 +1,10 @@ +--- a/drivers/crypto/Kconfig ++++ b/drivers/crypto/Kconfig +@@ -164,6 +164,7 @@ config CRYPTO_DEV_MV_CESA + depends on PLAT_ORION + select CRYPTO_ALGAPI + select CRYPTO_AES ++ select CRYPTO_HASH2 + select CRYPTO_BLKCIPHER2 + select CRYPTO_HASH + help diff --git a/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch b/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch new file mode 100644 index 000000000..29d2a41a3 --- /dev/null +++ b/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch @@ -0,0 +1,29 @@ +--- a/drivers/ssb/Kconfig ++++ b/drivers/ssb/Kconfig +@@ -29,6 +29,7 @@ config SSB_SPROM + config SSB_BLOCKIO + bool + depends on SSB ++ default y + + config SSB_PCIHOST_POSSIBLE + bool +@@ -49,7 +50,7 @@ config SSB_PCIHOST + config SSB_B43_PCI_BRIDGE + bool + depends on SSB_PCIHOST +- default n ++ default y + + config SSB_PCMCIAHOST_POSSIBLE + bool +--- a/drivers/bcma/Kconfig ++++ b/drivers/bcma/Kconfig +@@ -17,6 +17,7 @@ config BCMA + config BCMA_BLOCKIO + bool + depends on BCMA ++ default y + + config BCMA_HOST_PCI_POSSIBLE + bool diff --git a/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch b/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch new file mode 100644 index 000000000..3c3b1e1b5 --- /dev/null +++ b/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch @@ -0,0 +1,23 @@ +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -320,16 +320,16 @@ config BCH_CONST_T + # Textsearch support is select'ed if needed + # + config TEXTSEARCH +- boolean ++ boolean "Textsearch support" + + config TEXTSEARCH_KMP +- tristate ++ tristate "Textsearch KMP" + + config TEXTSEARCH_BM +- tristate ++ tristate "Textsearch BM" + + config TEXTSEARCH_FSM +- tristate ++ tristate "Textsearch FSM" + + config BTREE + boolean diff --git a/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch b/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch new file mode 100644 index 000000000..d8752359c --- /dev/null +++ b/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch @@ -0,0 +1,31 @@ +--- a/net/wireless/Kconfig ++++ b/net/wireless/Kconfig +@@ -183,7 +183,7 @@ config CFG80211_WEXT + extensions with cfg80211-based drivers. + + config LIB80211 +- tristate ++ tristate "LIB80211" + default n + help + This options enables a library of common routines used +@@ -192,13 +192,16 @@ config LIB80211 + Drivers should select this themselves if needed. + + config LIB80211_CRYPT_WEP +- tristate ++ tristate "LIB80211_CRYPT_WEP" ++ select LIB80211 + + config LIB80211_CRYPT_CCMP +- tristate ++ tristate "LIB80211_CRYPT_CCMP" ++ select LIB80211 + + config LIB80211_CRYPT_TKIP +- tristate ++ tristate "LIB80211_CRYPT_TKIP" ++ select LIB80211 + + config LIB80211_DEBUG + bool "lib80211 debugging messages" diff --git a/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch b/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch new file mode 100644 index 000000000..f9f6c0ea7 --- /dev/null +++ b/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch @@ -0,0 +1,47 @@ +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -32,7 +32,7 @@ config CRYPTO_FIPS + this is. + + config CRYPTO_ALGAPI +- tristate ++ tristate "ALGAPI" + select CRYPTO_ALGAPI2 + help + This option provides the API for cryptographic algorithms. +@@ -41,7 +41,7 @@ config CRYPTO_ALGAPI2 + tristate + + config CRYPTO_AEAD +- tristate ++ tristate "AEAD" + select CRYPTO_AEAD2 + select CRYPTO_ALGAPI + +@@ -50,7 +50,7 @@ config CRYPTO_AEAD2 + select CRYPTO_ALGAPI2 + + config CRYPTO_BLKCIPHER +- tristate ++ tristate "BLKCIPHER" + select CRYPTO_BLKCIPHER2 + select CRYPTO_ALGAPI + +@@ -61,7 +61,7 @@ config CRYPTO_BLKCIPHER2 + select CRYPTO_WORKQUEUE + + config CRYPTO_HASH +- tristate ++ tristate "HASH" + select CRYPTO_HASH2 + select CRYPTO_ALGAPI + +@@ -70,7 +70,7 @@ config CRYPTO_HASH2 + select CRYPTO_ALGAPI2 + + config CRYPTO_RNG +- tristate ++ tristate "RNG" + select CRYPTO_RNG2 + select CRYPTO_ALGAPI + diff --git a/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch b/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch new file mode 100644 index 000000000..daac5898a --- /dev/null +++ b/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch @@ -0,0 +1,22 @@ +--- a/net/wireless/Kconfig ++++ b/net/wireless/Kconfig +@@ -1,5 +1,5 @@ + config WIRELESS_EXT +- bool ++ bool "Wireless extensions" + + config WEXT_CORE + def_bool y +@@ -11,10 +11,10 @@ config WEXT_PROC + depends on WEXT_CORE + + config WEXT_SPY +- bool ++ bool "WEXT_SPY" + + config WEXT_PRIV +- bool ++ bool "WEXT_PRIV" + + config CFG80211 + tristate "cfg80211 - wireless configuration API" diff --git a/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch b/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch new file mode 100644 index 000000000..9d827c253 --- /dev/null +++ b/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch @@ -0,0 +1,11 @@ +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -2,7 +2,7 @@ menu "Core Netfilter Configuration" + depends on NET && INET && NETFILTER + + config NETFILTER_NETLINK +- tristate ++ tristate "Netfilter NFNETLINK interface" + + config NETFILTER_NETLINK_ACCT + tristate "Netfilter NFACCT over NFNETLINK interface" diff --git a/target/linux/generic/pending-3.18/259-regmap_dynamic.patch b/target/linux/generic/pending-3.18/259-regmap_dynamic.patch new file mode 100644 index 000000000..5e422ebd4 --- /dev/null +++ b/target/linux/generic/pending-3.18/259-regmap_dynamic.patch @@ -0,0 +1,87 @@ +--- a/drivers/base/regmap/Kconfig ++++ b/drivers/base/regmap/Kconfig +@@ -3,9 +3,8 @@ + # subsystems should select the appropriate symbols. + + config REGMAP +- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) + select IRQ_DOMAIN if REGMAP_IRQ +- bool ++ tristate "Regmap" + + config REGCACHE_COMPRESSED + select LZO_COMPRESS +@@ -13,19 +12,25 @@ config REGCACHE_COMPRESSED + bool + + config REGMAP_I2C +- tristate ++ tristate "Regmap I2C" ++ select REGMAP + depends on I2C + + config REGMAP_SPI +- tristate ++ tristate "Regmap SPI" ++ select REGMAP ++ depends on SPI_MASTER + depends on SPI + + config REGMAP_SPMI ++ select REGMAP + tristate + depends on SPMI + + config REGMAP_MMIO +- tristate ++ tristate "Regmap MMIO" ++ select REGMAP + + config REGMAP_IRQ ++ select REGMAP + bool +--- a/include/linux/regmap.h ++++ b/include/linux/regmap.h +@@ -49,7 +49,7 @@ struct reg_default { + unsigned int def; + }; + +-#ifdef CONFIG_REGMAP ++#if IS_ENABLED(CONFIG_REGMAP) + + enum regmap_endian { + /* Unspecified -> 0 -> Backwards compatible default */ +--- a/drivers/base/regmap/Makefile ++++ b/drivers/base/regmap/Makefile +@@ -1,7 +1,11 @@ +-obj-$(CONFIG_REGMAP) += regmap.o regcache.o +-obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o +-obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o +-obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o ++regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o ++ifdef CONFIG_DEBUG_FS ++regmap-core-objs += regmap-debugfs.o ++endif ++ifdef CONFIG_REGCACHE_COMPRESSED ++regmap-core-objs += regcache-lzo.o ++endif ++obj-$(CONFIG_REGMAP) += regmap-core.o + obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o + obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o + obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o +--- a/drivers/base/regmap/regmap.c ++++ b/drivers/base/regmap/regmap.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2630,3 +2631,5 @@ static int __init regmap_initcall(void) + return 0; + } + postcore_initcall(regmap_initcall); ++ ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch b/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch new file mode 100644 index 000000000..8a96fd9da --- /dev/null +++ b/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch @@ -0,0 +1,37 @@ +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -96,10 +96,10 @@ config CRYPTO_MANAGER + + config CRYPTO_MANAGER2 + def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y) +- select CRYPTO_AEAD2 +- select CRYPTO_HASH2 +- select CRYPTO_BLKCIPHER2 +- select CRYPTO_PCOMP2 ++ select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS ++ select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS ++ select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS ++ select CRYPTO_PCOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS + + config CRYPTO_USER + tristate "Userspace cryptographic algorithm configuration" +--- a/crypto/algboss.c ++++ b/crypto/algboss.c +@@ -248,6 +248,9 @@ static int cryptomgr_schedule_test(struc + type = alg->cra_flags; + + /* This piece of crap needs to disappear into per-type test hooks. */ ++#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ++ type |= CRYPTO_ALG_TESTED; ++#else + if ((!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) & + CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) && + ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == +@@ -256,6 +259,7 @@ static int cryptomgr_schedule_test(struc + (!((type ^ CRYPTO_ALG_TYPE_AEAD) & CRYPTO_ALG_TYPE_MASK) && + alg->cra_type == &crypto_nivaead_type && alg->cra_aead.ivsize)) + type |= CRYPTO_ALG_TESTED; ++#endif + + param->type = type; + diff --git a/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch b/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch new file mode 100644 index 000000000..67895995b --- /dev/null +++ b/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch @@ -0,0 +1,102 @@ +From c6bdd0d302119819de72439972d0462c26ef9eda Mon Sep 17 00:00:00 2001 +From: Felix Janda +Date: Sun, 12 Nov 2017 13:30:17 -0500 +Subject: uapi libc compat: add fallback for unsupported libcs + +libc-compat.h aims to prevent symbol collisions between uapi and libc +headers for each supported libc. This requires continuous coordination +between them. + +The goal of this commit is to improve the situation for libcs (such as +musl) which are not yet supported and/or do not wish to be explicitly +supported, while not affecting supported libcs. More precisely, with +this commit, unsupported libcs can request the suppression of any +specific uapi definition by defining the correspondings _UAPI_DEF_* +macro as 0. This can fix symbol collisions for them, as long as the +libc headers are included before the uapi headers. Inclusion in the +other order is outside the scope of this commit. + +All infrastructure in order to enable this fallback for unsupported +libcs is already in place, except that libc-compat.h unconditionally +defines all _UAPI_DEF_* macros to 1 for all unsupported libcs so that +any previous definitions are ignored. In order to fix this, this commit +merely makes these definitions conditional. + +This commit together with the musl libc commit + +http://git.musl-libc.org/cgit/musl/commit/?id=04983f2272382af92eb8f8838964ff944fbb8258 + +fixes for example the following compiler errors when is +included after musl's : + +./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' +./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' +./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' + +The comments referencing glibc are still correct, but this file is not +only used for glibc any more. + +Signed-off-by: Felix Janda +Reviewed-by: Hauke Mehrtens +--- + include/uapi/linux/libc-compat.h | 55 +++++++++++++++++++++++++++++++++++++++- + 1 file changed, 54 insertions(+), 1 deletion(-) + +--- a/include/uapi/linux/libc-compat.h ++++ b/include/uapi/linux/libc-compat.h +@@ -110,27 +110,54 @@ + + /* If we did not see any headers from any supported C libraries, + * or we are being included in the kernel, then define everything +- * that we need. */ ++ * that we need. Check for previous __UAPI_* definitions to give ++ * unsupported C libraries a way to opt out of any kernel definition. */ + #else /* !defined(__GLIBC__) */ + + /* Definitions for in.h */ ++#ifndef __UAPI_DEF_IN_ADDR + #define __UAPI_DEF_IN_ADDR 1 ++#endif ++#ifndef __UAPI_DEF_IN_IPPROTO + #define __UAPI_DEF_IN_IPPROTO 1 ++#endif ++#ifndef __UAPI_DEF_IN_PKTINFO + #define __UAPI_DEF_IN_PKTINFO 1 ++#endif ++#ifndef __UAPI_DEF_IP_MREQ + #define __UAPI_DEF_IP_MREQ 1 ++#endif ++#ifndef __UAPI_DEF_SOCKADDR_IN + #define __UAPI_DEF_SOCKADDR_IN 1 ++#endif ++#ifndef __UAPI_DEF_IN_CLASS + #define __UAPI_DEF_IN_CLASS 1 ++#endif + + /* Definitions for in6.h */ ++#ifndef __UAPI_DEF_IN6_ADDR + #define __UAPI_DEF_IN6_ADDR 1 ++#endif ++#ifndef __UAPI_DEF_IN6_ADDR_ALT + #define __UAPI_DEF_IN6_ADDR_ALT 1 ++#endif ++#ifndef __UAPI_DEF_SOCKADDR_IN6 + #define __UAPI_DEF_SOCKADDR_IN6 1 ++#endif ++#ifndef __UAPI_DEF_IPV6_MREQ + #define __UAPI_DEF_IPV6_MREQ 1 ++#endif ++#ifndef __UAPI_DEF_IPPROTO_V6 + #define __UAPI_DEF_IPPROTO_V6 1 ++#endif ++#ifndef __UAPI_DEF_IPV6_OPTIONS + #define __UAPI_DEF_IPV6_OPTIONS 1 ++#endif + + /* Definitions for xattr.h */ ++#ifndef __UAPI_DEF_XATTR + #define __UAPI_DEF_XATTR 1 ++#endif + + #endif /* __GLIBC__ */ + diff --git a/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch b/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch new file mode 100644 index 000000000..6f7ba681c --- /dev/null +++ b/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch @@ -0,0 +1,55 @@ +From 649affd04813c43e0a72886517fcfccd63230981 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 29 Jun 2015 16:53:03 +0200 +Subject: uapi/if_ether.h: prevent redefinition of struct ethhdr + +Musl provides its own ethhdr struct definition. Add a guard to prevent +its definition of the appropriate musl header has already been included. + +glibc does not implement this header, but when glibc will implement this +they can just define __UAPI_DEF_ETHHDR 0 to make it work with the +kernel. + +Signed-off-by: Hauke Mehrtens +--- + include/uapi/linux/if_ether.h | 3 +++ + include/uapi/linux/libc-compat.h | 6 ++++++ + 2 files changed, 9 insertions(+) + +--- a/include/uapi/linux/if_ether.h ++++ b/include/uapi/linux/if_ether.h +@@ -22,6 +22,7 @@ + #define _UAPI_LINUX_IF_ETHER_H + + #include ++#include + + /* + * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble +@@ -135,11 +136,13 @@ + * This is an Ethernet frame header. + */ + ++#if __UAPI_DEF_ETHHDR + struct ethhdr { + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + __be16 h_proto; /* packet type ID field */ + } __attribute__((packed)); ++#endif + + + #endif /* _UAPI_LINUX_IF_ETHER_H */ +--- a/include/uapi/linux/libc-compat.h ++++ b/include/uapi/linux/libc-compat.h +@@ -161,4 +161,10 @@ + + #endif /* __GLIBC__ */ + ++/* Definitions for if_ether.h */ ++/* allow libcs like musl to deactivate this, glibc does not implement this. */ ++#ifndef __UAPI_DEF_ETHHDR ++#define __UAPI_DEF_ETHHDR 1 ++#endif ++ + #endif /* _UAPI_LIBC_COMPAT_H */ diff --git a/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch new file mode 100644 index 000000000..69d61f20a --- /dev/null +++ b/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch @@ -0,0 +1,39 @@ +From: Mark Miller + +This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on +certain Broadcom chipsets running CFE in order to load the kernel. + +Signed-off-by: Mark Miller +Acked-by: Rob Landley +--- +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -892,9 +892,6 @@ config FW_ARC + config ARCH_MAY_HAVE_PC_FDC + bool + +-config BOOT_RAW +- bool +- + config CEVT_BCM1480 + bool + +@@ -2503,6 +2500,18 @@ config USE_OF + config BUILTIN_DTB + bool + ++config BOOT_RAW ++ bool "Enable the kernel to be executed from the load address" ++ default n ++ help ++ Allow the kernel to be executed from the load address for ++ bootloaders which cannot read the ELF format. This places ++ a jump to start_kernel at the load address. ++ ++ If unsure, say N. ++ ++ ++ + endmenu + + config LOCKDEP_SUPPORT diff --git a/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch b/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch new file mode 100644 index 000000000..c87d4480c --- /dev/null +++ b/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch @@ -0,0 +1,28 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -988,6 +988,10 @@ config SYNC_R4K + config MIPS_MACHINE + def_bool n + ++config IMAGE_CMDLINE_HACK ++ bool "OpenWrt specific image command line hack" ++ default n ++ + config NO_IOPORT_MAP + def_bool n + +--- a/arch/mips/kernel/head.S ++++ b/arch/mips/kernel/head.S +@@ -80,6 +80,12 @@ FEXPORT(__kernel_entry) + j kernel_entry + #endif + ++#ifdef CONFIG_IMAGE_CMDLINE_HACK ++ .ascii "CMDLINE:" ++EXPORT(__image_cmdline) ++ .fill 0x400 ++#endif /* CONFIG_IMAGE_CMDLINE_HACK */ ++ + __REF + + NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch b/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch new file mode 100644 index 000000000..44c6b04fc --- /dev/null +++ b/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch @@ -0,0 +1,11 @@ +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -87,7 +87,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin + # machines may also. Since BFD is incredibly buggy with respect to + # crossformat linking we rely on the elf2ecoff tool for format conversion. + # +-cflags-y += -G 0 -mno-abicalls -fno-pic -pipe ++cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely + cflags-y += -msoft-float + LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections + KBUILD_AFLAGS_MODULE += -mlong-calls diff --git a/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch b/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch new file mode 100644 index 000000000..37ec9934f --- /dev/null +++ b/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch @@ -0,0 +1,105 @@ +From: Manuel Lauss +Subject: [RFC PATCH v4 2/2] MIPS: make FPU emulator optional +Date: Mon, 7 Apr 2014 12:57:04 +0200 +Message-Id: <1396868224-252888-2-git-send-email-manuel.lauss@gmail.com> + +This small patch makes the MIPS FPU emulator optional. The kernel +kills float-users on systems without a hardware FPU by sending a SIGILL. + +Disabling the emulator shrinks vmlinux by about 54kBytes (32bit, +optimizing for size). + +Signed-off-by: Manuel Lauss +--- +v4: rediffed because of patch 1/2, should now work with micromips as well +v3: updated patch description with size savings. +v2: incorporated changes suggested by Jonas Gorski + force the fpu emulator on for micromips: relocating the parts + of the mmips code in the emulator to other areas would be a + much larger change; I went the cheap route instead with this. + + arch/mips/Kbuild | 2 +- + arch/mips/Kconfig | 14 ++++++++++++++ + arch/mips/include/asm/fpu.h | 5 +++-- + arch/mips/include/asm/fpu_emulator.h | 15 +++++++++++++++ + 4 files changed, 33 insertions(+), 3 deletions(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -2495,6 +2495,20 @@ config MIPS_O32_FP64_SUPPORT + + If unsure, say N. + ++config MIPS_FPU_EMULATOR ++ bool "MIPS FPU Emulator" ++ default y ++ help ++ This option lets you disable the built-in MIPS FPU (Coprocessor 1) ++ emulator, which handles floating-point instructions on processors ++ without a hardware FPU. It is generally a good idea to keep the ++ emulator built-in, unless you are perfectly sure you have a ++ complete soft-float environment. With the emulator disabled, all ++ users of float operations will be killed with an illegal instr- ++ uction exception. ++ ++ Say Y, please. ++ + config USE_OF + bool + select OF +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -275,7 +275,7 @@ OBJCOPYFLAGS += --remove-section=.regin + head-y := arch/mips/kernel/head.o + + libs-y += arch/mips/lib/ +-libs-y += arch/mips/math-emu/ ++libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/ + + # See arch/mips/Kbuild for content of core part of the kernel + core-y += arch/mips/ +--- a/arch/mips/include/asm/fpu.h ++++ b/arch/mips/include/asm/fpu.h +@@ -169,8 +169,10 @@ static inline int init_fpu(void) + ret = __own_fpu(); + if (!ret) + _init_fpu(); +- } else ++ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR)) + fpu_emulator_init_fpu(); ++ else ++ ret = SIGILL; + + return ret; + } +--- a/arch/mips/include/asm/fpu_emulator.h ++++ b/arch/mips/include/asm/fpu_emulator.h +@@ -30,6 +30,7 @@ + #include + #include + ++#ifdef CONFIG_MIPS_FPU_EMULATOR + #ifdef CONFIG_DEBUG_FS + + struct mips_fpu_emulator_stats { +@@ -65,6 +66,20 @@ extern int do_dsemulret(struct pt_regs * + extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, + struct mips_fpu_struct *ctx, int has_fpu, + void *__user *fault_addr); ++#else /* no CONFIG_MIPS_FPU_EMULATOR */ ++static inline int do_dsemulret(struct pt_regs *xcp) ++{ ++ return 0; /* 0 means error, should never get here anyway */ ++} ++ ++static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp, ++ struct mips_fpu_struct *ctx, int has_fpu, ++ void *__user *fault_addr) ++{ ++ return SIGILL; /* we don't speak MIPS FPU */ ++} ++#endif /* CONFIG_MIPS_FPU_EMULATOR */ ++ + int process_fpemu_return(int sig, void __user *fault_addr); + int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, + unsigned long *contpc); diff --git a/target/linux/generic/pending-3.18/305-mips_module_reloc.patch b/target/linux/generic/pending-3.18/305-mips_module_reloc.patch new file mode 100644 index 000000000..fae7e70f0 --- /dev/null +++ b/target/linux/generic/pending-3.18/305-mips_module_reloc.patch @@ -0,0 +1,356 @@ +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -90,8 +90,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin + cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely + cflags-y += -msoft-float + LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections ++ifdef CONFIG_64BIT + KBUILD_AFLAGS_MODULE += -mlong-calls + KBUILD_CFLAGS_MODULE += -mlong-calls ++else ++KBUILD_AFLAGS_MODULE += -mno-long-calls ++KBUILD_CFLAGS_MODULE += -mno-long-calls ++endif + + ifndef CONFIG_FUNCTION_TRACER + KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections +--- a/arch/mips/include/asm/module.h ++++ b/arch/mips/include/asm/module.h +@@ -11,6 +11,11 @@ struct mod_arch_specific { + const struct exception_table_entry *dbe_start; + const struct exception_table_entry *dbe_end; + struct mips_hi16 *r_mips_hi16_list; ++ ++ void *phys_plt_tbl; ++ void *virt_plt_tbl; ++ unsigned int phys_plt_offset; ++ unsigned int virt_plt_offset; + }; + + typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ +--- a/arch/mips/kernel/module.c ++++ b/arch/mips/kernel/module.c +@@ -43,14 +43,222 @@ struct mips_hi16 { + static LIST_HEAD(dbe_list); + static DEFINE_SPINLOCK(dbe_lock); + +-#ifdef MODULE_START ++/* ++ * Get the potential max trampolines size required of the init and ++ * non-init sections. Only used if we cannot find enough contiguous ++ * physically mapped memory to put the module into. ++ */ ++static unsigned int ++get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, ++ const char *secstrings, unsigned int symindex, bool is_init) ++{ ++ unsigned long ret = 0; ++ unsigned int i, j; ++ Elf_Sym *syms; ++ ++ /* Everything marked ALLOC (this includes the exported symbols) */ ++ for (i = 1; i < hdr->e_shnum; ++i) { ++ unsigned int info = sechdrs[i].sh_info; ++ ++ if (sechdrs[i].sh_type != SHT_REL ++ && sechdrs[i].sh_type != SHT_RELA) ++ continue; ++ ++ /* Not a valid relocation section? */ ++ if (info >= hdr->e_shnum) ++ continue; ++ ++ /* Don't bother with non-allocated sections */ ++ if (!(sechdrs[info].sh_flags & SHF_ALLOC)) ++ continue; ++ ++ /* If it's called *.init*, and we're not init, we're ++ not interested */ ++ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) ++ != is_init) ++ continue; ++ ++ syms = (Elf_Sym *) sechdrs[symindex].sh_addr; ++ if (sechdrs[i].sh_type == SHT_REL) { ++ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; ++ unsigned int size = sechdrs[i].sh_size / sizeof(*rel); ++ ++ for (j = 0; j < size; ++j) { ++ Elf_Sym *sym; ++ ++ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) ++ continue; ++ ++ sym = syms + ELF_MIPS_R_SYM(rel[j]); ++ if (!is_init && sym->st_shndx != SHN_UNDEF) ++ continue; ++ ++ ret += 4 * sizeof(int); ++ } ++ } else { ++ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; ++ unsigned int size = sechdrs[i].sh_size / sizeof(*rela); ++ ++ for (j = 0; j < size; ++j) { ++ Elf_Sym *sym; ++ ++ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) ++ continue; ++ ++ sym = syms + ELF_MIPS_R_SYM(rela[j]); ++ if (!is_init && sym->st_shndx != SHN_UNDEF) ++ continue; ++ ++ ret += 4 * sizeof(int); ++ } ++ } ++ } ++ ++ return ret; ++} ++ ++#ifndef MODULE_START ++static void *alloc_phys(unsigned long size) ++{ ++ unsigned order; ++ struct page *page; ++ struct page *p; ++ ++ size = PAGE_ALIGN(size); ++ order = get_order(size); ++ ++ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | ++ __GFP_THISNODE, order); ++ if (!page) ++ return NULL; ++ ++ split_page(page, order); ++ ++ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) ++ __free_page(p); ++ ++ return page_address(page); ++} ++#endif ++ ++static void free_phys(void *ptr, unsigned long size) ++{ ++ struct page *page; ++ struct page *end; ++ ++ page = virt_to_page(ptr); ++ end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); ++ ++ for (; page < end; ++page) ++ __free_page(page); ++} ++ ++ + void *module_alloc(unsigned long size) + { ++#ifdef MODULE_START + return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, + GFP_KERNEL, PAGE_KERNEL, NUMA_NO_NODE, + __builtin_return_address(0)); ++#else ++ void *ptr; ++ ++ if (size == 0) ++ return NULL; ++ ++ ptr = alloc_phys(size); ++ ++ /* If we failed to allocate physically contiguous memory, ++ * fall back to regular vmalloc. The module loader code will ++ * create jump tables to handle long jumps */ ++ if (!ptr) ++ return vmalloc(size); ++ ++ return ptr; ++#endif + } ++ ++static inline bool is_phys_addr(void *ptr) ++{ ++#ifdef CONFIG_64BIT ++ return (KSEGX((unsigned long)ptr) == CKSEG0); ++#else ++ return (KSEGX(ptr) == KSEG0); + #endif ++} ++ ++/* Free memory returned from module_alloc */ ++void module_free(struct module *mod, void *module_region) ++{ ++ if (is_phys_addr(module_region)) { ++ if (mod->module_init == module_region) ++ free_phys(module_region, mod->init_size); ++ else if (mod->module_core == module_region) ++ free_phys(module_region, mod->core_size); ++ else ++ BUG(); ++ } else { ++ vfree(module_region); ++ } ++} ++ ++static void *__module_alloc(int size, bool phys) ++{ ++ void *ptr; ++ ++ if (phys) ++ ptr = kmalloc(size, GFP_KERNEL); ++ else ++ ptr = vmalloc(size); ++ return ptr; ++} ++ ++static void __module_free(void *ptr) ++{ ++ if (is_phys_addr(ptr)) ++ kfree(ptr); ++ else ++ vfree(ptr); ++} ++ ++int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, ++ char *secstrings, struct module *mod) ++{ ++ unsigned int symindex = 0; ++ unsigned int core_size, init_size; ++ int i; ++ ++ mod->arch.phys_plt_offset = 0; ++ mod->arch.virt_plt_offset = 0; ++ mod->arch.phys_plt_tbl = NULL; ++ mod->arch.virt_plt_tbl = NULL; ++ ++ if (IS_ENABLED(CONFIG_64BIT)) ++ return 0; ++ ++ for (i = 1; i < hdr->e_shnum; i++) ++ if (sechdrs[i].sh_type == SHT_SYMTAB) ++ symindex = i; ++ ++ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); ++ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); ++ ++ if ((core_size + init_size) == 0) ++ return 0; ++ ++ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1); ++ if (!mod->arch.phys_plt_tbl) ++ return -ENOMEM; ++ ++ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0); ++ if (!mod->arch.virt_plt_tbl) { ++ __module_free(mod->arch.phys_plt_tbl); ++ mod->arch.phys_plt_tbl = NULL; ++ return -ENOMEM; ++ } ++ ++ return 0; ++} + + int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) + { +@@ -64,8 +272,39 @@ static int apply_r_mips_32_rel(struct mo + return 0; + } + ++static Elf_Addr add_plt_entry_to(unsigned *plt_offset, ++ void *start, Elf_Addr v) ++{ ++ unsigned *tramp = start + *plt_offset; ++ *plt_offset += 4 * sizeof(int); ++ ++ /* adjust carry for addiu */ ++ if (v & 0x00008000) ++ v += 0x10000; ++ ++ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ ++ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ ++ tramp[2] = 0x03200008; /* jr t9 */ ++ tramp[3] = 0x00000000; /* nop */ ++ ++ return (Elf_Addr) tramp; ++} ++ ++static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) ++{ ++ if (is_phys_addr(location)) ++ return add_plt_entry_to(&me->arch.phys_plt_offset, ++ me->arch.phys_plt_tbl, v); ++ else ++ return add_plt_entry_to(&me->arch.virt_plt_offset, ++ me->arch.virt_plt_tbl, v); ++ ++} ++ + static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) + { ++ u32 ofs = *location & 0x03ffffff; ++ + if (v % 4) { + pr_err("module %s: dangerous R_MIPS_26 REL relocation\n", + me->name); +@@ -73,14 +312,17 @@ static int apply_r_mips_26_rel(struct mo + } + + if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { +- printk(KERN_ERR +- "module %s: relocation overflow\n", +- me->name); +- return -ENOEXEC; ++ v = add_plt_entry(me, location, v + (ofs << 2)); ++ if (!v) { ++ printk(KERN_ERR ++ "module %s: relocation overflow\n", me->name); ++ return -ENOEXEC; ++ } ++ ofs = 0; + } + + *location = (*location & ~0x03ffffff) | +- ((*location + (v >> 2)) & 0x03ffffff); ++ ((ofs + (v >> 2)) & 0x03ffffff); + + return 0; + } +@@ -287,9 +529,36 @@ int module_finalize(const Elf_Ehdr *hdr, + list_add(&me->arch.dbe_list, &dbe_list); + spin_unlock_irq(&dbe_lock); + } ++ ++ /* Get rid of the fixup trampoline if we're running the module ++ * from physically mapped address space */ ++ if (me->arch.phys_plt_offset == 0) { ++ __module_free(me->arch.phys_plt_tbl); ++ me->arch.phys_plt_tbl = NULL; ++ } ++ if (me->arch.virt_plt_offset == 0) { ++ __module_free(me->arch.virt_plt_tbl); ++ me->arch.virt_plt_tbl = NULL; ++ } ++ + return 0; + } + ++void module_arch_freeing_init(struct module *mod) ++{ ++ if (mod->state == MODULE_STATE_LIVE) ++ return; ++ ++ if (mod->arch.phys_plt_tbl) { ++ __module_free(mod->arch.phys_plt_tbl); ++ mod->arch.phys_plt_tbl = NULL; ++ } ++ if (mod->arch.virt_plt_tbl) { ++ __module_free(mod->arch.virt_plt_tbl); ++ mod->arch.virt_plt_tbl = NULL; ++ } ++} ++ + void module_arch_cleanup(struct module *mod) + { + spin_lock_irq(&dbe_lock); diff --git a/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch b/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch new file mode 100644 index 000000000..981867742 --- /dev/null +++ b/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch @@ -0,0 +1,83 @@ +--- a/arch/mips/include/asm/string.h ++++ b/arch/mips/include/asm/string.h +@@ -133,11 +133,44 @@ strncmp(__const__ char *__cs, __const__ + + #define __HAVE_ARCH_MEMSET + extern void *memset(void *__s, int __c, size_t __count); ++#define memset(__s, __c, len) \ ++({ \ ++ size_t __len = (len); \ ++ void *__ret; \ ++ if (__builtin_constant_p(len) && __len >= 64) \ ++ __ret = memset((__s), (__c), __len); \ ++ else \ ++ __ret = __builtin_memset((__s), (__c), __len); \ ++ __ret; \ ++}) + + #define __HAVE_ARCH_MEMCPY + extern void *memcpy(void *__to, __const__ void *__from, size_t __n); ++#define memcpy(dst, src, len) \ ++({ \ ++ size_t __len = (len); \ ++ void *__ret; \ ++ if (__builtin_constant_p(len) && __len >= 64) \ ++ __ret = memcpy((dst), (src), __len); \ ++ else \ ++ __ret = __builtin_memcpy((dst), (src), __len); \ ++ __ret; \ ++}) + + #define __HAVE_ARCH_MEMMOVE + extern void *memmove(void *__dest, __const__ void *__src, size_t __n); ++#define memmove(dst, src, len) \ ++({ \ ++ size_t __len = (len); \ ++ void *__ret; \ ++ if (__builtin_constant_p(len) && __len >= 64) \ ++ __ret = memmove((dst), (src), __len); \ ++ else \ ++ __ret = __builtin_memmove((dst), (src), __len); \ ++ __ret; \ ++}) ++ ++#define __HAVE_ARCH_MEMCMP ++#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len)) + + #endif /* _ASM_STRING_H */ +--- a/arch/mips/lib/Makefile ++++ b/arch/mips/lib/Makefile +@@ -4,7 +4,7 @@ + + lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \ + mips-atomic.o strlen_user.o strncpy_user.o \ +- strnlen_user.o uncached.o ++ strnlen_user.o uncached.o memcmp.o + + obj-y += iomap.o + obj-$(CONFIG_PCI) += iomap-pci.o +--- /dev/null ++++ b/arch/mips/lib/memcmp.c +@@ -0,0 +1,22 @@ ++/* ++ * copied from linux/lib/string.c ++ * ++ * Copyright (C) 1991, 1992 Linus Torvalds ++ */ ++ ++#include ++#include ++ ++#undef memcmp ++int memcmp(const void *cs, const void *ct, size_t count) ++{ ++ const unsigned char *su1, *su2; ++ int res = 0; ++ ++ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) ++ if ((res = *su1 - *su2) != 0) ++ break; ++ return res; ++} ++EXPORT_SYMBOL(memcmp); ++ diff --git a/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch b/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch new file mode 100644 index 000000000..5a7dc9cee --- /dev/null +++ b/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch @@ -0,0 +1,17 @@ +Adjust highmem offset to 0x10000000 to ensure that all kmalloc allocations +stay within the same 256M boundary. This ensures that -mlong-calls is not +needed on systems with more than 256M RAM. + +Signed-off-by: Felix Fietkau +--- +--- a/arch/mips/include/asm/mach-generic/spaces.h ++++ b/arch/mips/include/asm/mach-generic/spaces.h +@@ -44,7 +44,7 @@ + * Memory above this physical address will be considered highmem. + */ + #ifndef HIGHMEM_START +-#define HIGHMEM_START _AC(0x20000000, UL) ++#define HIGHMEM_START _AC(0x10000000, UL) + #endif + + #endif /* CONFIG_32BIT */ diff --git a/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch new file mode 100644 index 000000000..9210c1d2d --- /dev/null +++ b/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch @@ -0,0 +1,13 @@ +--- a/arch/arm/kernel/module.c ++++ b/arch/arm/kernel/module.c +@@ -83,6 +83,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons + return -ENOEXEC; + } + ++ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) && ++ ELF_ST_BIND(sym->st_info) == STB_WEAK) ++ continue; ++ + loc = dstsec->sh_addr + rel->r_offset; + + switch (ELF32_R_TYPE(rel->r_info)) { diff --git a/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch b/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch new file mode 100644 index 000000000..8673de4df --- /dev/null +++ b/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch @@ -0,0 +1,31 @@ +Upstream doesn't optimize the kernel and bootwrappers for ppc44x because +they still want to support gcc 3.3 -- well, we don't. + +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -203,7 +203,8 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) + KBUILD_CFLAGS += -mno-sched-epilog + endif + +-cpu-as-$(CONFIG_4xx) += -Wa,-m405 ++cpu-as-$(CONFIG_40x) += -Wa,-m405 ++cpu-as-$(CONFIG_44x) += -Wa,-m440 + cpu-as-$(CONFIG_ALTIVEC) += -Wa,-maltivec + cpu-as-$(CONFIG_E200) += -Wa,-me200 + +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -45,10 +45,10 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(ob + DTC_FLAGS ?= -p 1024 + + $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 +-$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 ++$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 +-$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 +-$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 ++$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 ++$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 diff --git a/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch new file mode 100644 index 000000000..ab6ea7beb --- /dev/null +++ b/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch @@ -0,0 +1,10 @@ +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -165,7 +165,6 @@ CPP = $(CC) -E $(KBUILD_CFLAGS) + + CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ + +-KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o + + ifeq ($(CONFIG_476FPE_ERR46),y) + KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ diff --git a/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch new file mode 100644 index 000000000..a69d197e6 --- /dev/null +++ b/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch @@ -0,0 +1,298 @@ +From d8582dcf1ed66eee88a11e4760f42c0d6c8822be Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Sat, 31 Jan 2015 22:26:03 +0800 +Subject: [PATCH 331/331] MIPS: kexec: Accept command line parameters from + userspace. + +Signed-off-by: Yousong Zhou +--- + arch/mips/kernel/machine_kexec.c | 153 +++++++++++++++++++++++++++++++----- + arch/mips/kernel/machine_kexec.h | 20 +++++ + arch/mips/kernel/relocate_kernel.S | 21 +++-- + 3 files changed, 167 insertions(+), 27 deletions(-) + create mode 100644 arch/mips/kernel/machine_kexec.h + +--- a/arch/mips/kernel/machine_kexec.c ++++ b/arch/mips/kernel/machine_kexec.c +@@ -10,45 +10,145 @@ + #include + #include + ++#include + #include + #include +- +-extern const unsigned char relocate_new_kernel[]; +-extern const size_t relocate_new_kernel_size; +- +-extern unsigned long kexec_start_address; +-extern unsigned long kexec_indirection_page; ++#include ++#include "machine_kexec.h" + + int (*_machine_kexec_prepare)(struct kimage *) = NULL; + void (*_machine_kexec_shutdown)(void) = NULL; + void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL; ++ + #ifdef CONFIG_SMP + void (*relocated_kexec_smp_wait) (void *); + atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0); + #endif + +-int +-machine_kexec_prepare(struct kimage *kimage) ++static void machine_kexec_print_args(void) + { ++ unsigned long argc = (int)kexec_args[0]; ++ int i; ++ ++ pr_info("kexec_args[0] (argc): %lu\n", argc); ++ pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]); ++ pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]); ++ pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]); ++ ++ for (i = 0; i < argc; i++) { ++ pr_info("kexec_argv[%d] = %p, %s\n", ++ i, kexec_argv[i], kexec_argv[i]); ++ } ++} ++ ++static void machine_kexec_init_argv(struct kimage *image) ++{ ++ void __user *buf = NULL; ++ size_t bufsz; ++ size_t size; ++ int i; ++ ++ bufsz = 0; ++ for (i = 0; i < image->nr_segments; i++) { ++ struct kexec_segment *seg; ++ ++ seg = &image->segment[i]; ++ if (seg->bufsz < 6) ++ continue; ++ ++ if (strncmp((char *) seg->buf, "kexec ", 6)) ++ continue; ++ ++ buf = seg->buf; ++ bufsz = seg->bufsz; ++ break; ++ } ++ ++ if (!buf) ++ return; ++ ++ size = KEXEC_COMMAND_LINE_SIZE; ++ size = min(size, bufsz); ++ if (size < bufsz) ++ pr_warn("kexec command line truncated to %zd bytes\n", size); ++ ++ /* Copy to kernel space */ ++ copy_from_user(kexec_argv_buf, buf, size); ++ kexec_argv_buf[size - 1] = 0; ++} ++ ++static void machine_kexec_parse_argv(struct kimage *image) ++{ ++ char *reboot_code_buffer; ++ int reloc_delta; ++ char *ptr; ++ int argc; ++ int i; ++ ++ ptr = kexec_argv_buf; ++ argc = 0; ++ ++ /* ++ * convert command line string to array of parameters ++ * (as bootloader does). ++ */ ++ while (ptr && *ptr && (KEXEC_MAX_ARGC > argc)) { ++ if (*ptr == ' ') { ++ *ptr++ = '\0'; ++ continue; ++ } ++ ++ kexec_argv[argc++] = ptr; ++ ptr = strchr(ptr, ' '); ++ } ++ ++ if (!argc) ++ return; ++ ++ kexec_args[0] = argc; ++ kexec_args[1] = (unsigned long)kexec_argv; ++ kexec_args[2] = 0; ++ kexec_args[3] = 0; ++ ++ reboot_code_buffer = page_address(image->control_code_page); ++ reloc_delta = reboot_code_buffer - (char *)kexec_relocate_new_kernel; ++ ++ kexec_args[1] += reloc_delta; ++ for (i = 0; i < argc; i++) ++ kexec_argv[i] += reloc_delta; ++} ++ ++int machine_kexec_prepare(struct kimage *kimage) ++{ ++ /* ++ * Whenever arguments passed from kexec-tools, Init the arguments as ++ * the original ones to try avoiding booting failure. ++ */ ++ ++ kexec_args[0] = fw_arg0; ++ kexec_args[1] = fw_arg1; ++ kexec_args[2] = fw_arg2; ++ kexec_args[3] = fw_arg3; ++ ++ machine_kexec_init_argv(kimage); ++ machine_kexec_parse_argv(kimage); ++ + if (_machine_kexec_prepare) + return _machine_kexec_prepare(kimage); + return 0; + } + +-void +-machine_kexec_cleanup(struct kimage *kimage) ++void machine_kexec_cleanup(struct kimage *kimage) + { + } + +-void +-machine_shutdown(void) ++void machine_shutdown(void) + { + if (_machine_kexec_shutdown) + _machine_kexec_shutdown(); + } + +-void +-machine_crash_shutdown(struct pt_regs *regs) ++void machine_crash_shutdown(struct pt_regs *regs) + { + if (_machine_crash_shutdown) + _machine_crash_shutdown(regs); +@@ -66,10 +166,12 @@ machine_kexec(struct kimage *image) + unsigned long *ptr; + + reboot_code_buffer = +- (unsigned long)page_address(image->control_code_page); ++ (unsigned long)page_address(image->control_code_page); ++ pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer); + + kexec_start_address = + (unsigned long) phys_to_virt(image->start); ++ pr_info("kexec_start_address = %p\n", (void *)kexec_start_address); + + if (image->type == KEXEC_TYPE_DEFAULT) { + kexec_indirection_page = +@@ -77,9 +179,19 @@ machine_kexec(struct kimage *image) + } else { + kexec_indirection_page = (unsigned long)&image->head; + } ++ pr_info("kexec_indirection_page = %p\n", (void *)kexec_indirection_page); + +- memcpy((void*)reboot_code_buffer, relocate_new_kernel, +- relocate_new_kernel_size); ++ pr_info("Where is memcpy: %p\n", memcpy); ++ pr_info("kexec_relocate_new_kernel = %p, kexec_relocate_new_kernel_end = %p\n", ++ (void *)kexec_relocate_new_kernel, &kexec_relocate_new_kernel_end); ++ pr_info("Copy %lu bytes from %p to %p\n", KEXEC_RELOCATE_NEW_KERNEL_SIZE, ++ (void *)kexec_relocate_new_kernel, (void *)reboot_code_buffer); ++ memcpy((void*)reboot_code_buffer, kexec_relocate_new_kernel, ++ KEXEC_RELOCATE_NEW_KERNEL_SIZE); ++ ++ pr_info("Before _print_args().\n"); ++ machine_kexec_print_args(); ++ pr_info("Before eval loop.\n"); + + /* + * The generic kexec code builds a page list with physical +@@ -98,15 +210,16 @@ machine_kexec(struct kimage *image) + /* + * we do not want to be bothered. + */ ++ pr_info("Before irq_disable.\n"); + local_irq_disable(); + +- printk("Will call new kernel at %08lx\n", image->start); +- printk("Bye ...\n"); ++ pr_info("Will call new kernel at %08lx\n", image->start); ++ pr_info("Bye ...\n"); + __flush_cache_all(); + #ifdef CONFIG_SMP + /* All secondary cpus now may jump to kexec_wait cycle */ + relocated_kexec_smp_wait = reboot_code_buffer + +- (void *)(kexec_smp_wait - relocate_new_kernel); ++ (void *)(kexec_smp_wait - kexec_relocate_new_kernel); + smp_wmb(); + atomic_set(&kexec_ready_to_reboot, 1); + #endif +--- /dev/null ++++ b/arch/mips/kernel/machine_kexec.h +@@ -0,0 +1,20 @@ ++#ifndef _MACHINE_KEXEC_H ++#define _MACHINE_KEXEC_H ++ ++#ifndef __ASSEMBLY__ ++extern const unsigned char kexec_relocate_new_kernel[]; ++extern unsigned long kexec_relocate_new_kernel_end; ++extern unsigned long kexec_start_address; ++extern unsigned long kexec_indirection_page; ++ ++extern char kexec_argv_buf[]; ++extern char *kexec_argv[]; ++ ++#define KEXEC_RELOCATE_NEW_KERNEL_SIZE ((unsigned long)&kexec_relocate_new_kernel_end - (unsigned long)kexec_relocate_new_kernel) ++#endif /* !__ASSEMBLY__ */ ++ ++#define KEXEC_COMMAND_LINE_SIZE 256 ++#define KEXEC_ARGV_SIZE (KEXEC_COMMAND_LINE_SIZE / 16) ++#define KEXEC_MAX_ARGC (KEXEC_ARGV_SIZE / sizeof(long)) ++ ++#endif +--- a/arch/mips/kernel/relocate_kernel.S ++++ b/arch/mips/kernel/relocate_kernel.S +@@ -12,8 +12,9 @@ + #include + #include + #include ++#include "machine_kexec.h" + +-LEAF(relocate_new_kernel) ++LEAF(kexec_relocate_new_kernel) + PTR_L a0, arg0 + PTR_L a1, arg1 + PTR_L a2, arg2 +@@ -98,7 +99,7 @@ done: + #endif + /* jump to kexec_start_address */ + j s1 +- END(relocate_new_kernel) ++ END(kexec_relocate_new_kernel) + + #ifdef CONFIG_SMP + /* +@@ -184,9 +185,15 @@ kexec_indirection_page: + PTR 0 + .size kexec_indirection_page, PTRSIZE + +-relocate_new_kernel_end: ++kexec_argv_buf: ++ EXPORT(kexec_argv_buf) ++ .skip KEXEC_COMMAND_LINE_SIZE ++ .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE ++ ++kexec_argv: ++ EXPORT(kexec_argv) ++ .skip KEXEC_ARGV_SIZE ++ .size kexec_argv, KEXEC_ARGV_SIZE + +-relocate_new_kernel_size: +- EXPORT(relocate_new_kernel_size) +- PTR relocate_new_kernel_end - relocate_new_kernel +- .size relocate_new_kernel_size, PTRSIZE ++kexec_relocate_new_kernel_end: ++ EXPORT(kexec_relocate_new_kernel_end) diff --git a/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch new file mode 100644 index 000000000..0a6e134ed --- /dev/null +++ b/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch @@ -0,0 +1,171 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -12,6 +12,23 @@ menuconfig MTD + + if MTD + ++menu "OpenWrt specific MTD options" ++ ++config MTD_ROOTFS_ROOT_DEV ++ bool "Automatically set 'rootfs' partition to be root filesystem" ++ default y ++ ++config MTD_SPLIT_FIRMWARE ++ bool "Automatically split firmware partition for kernel+rootfs" ++ default y ++ ++config MTD_SPLIT_FIRMWARE_NAME ++ string "Firmware partition name" ++ depends on MTD_SPLIT_FIRMWARE ++ default "firmware" ++ ++endmenu ++ + config MTD_TESTS + tristate "MTD tests support (DANGEROUS)" + depends on m +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -30,9 +30,11 @@ + #include + #include + #include ++#include + #include + + #include "mtdcore.h" ++#include "mtdsplit/mtdsplit.h" + + /* Our partition linked list */ + static LIST_HEAD(mtd_partitions); +@@ -46,13 +48,14 @@ struct mtd_part { + struct list_head list; + }; + ++static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); ++ + /* + * Given a pointer to the MTD object in the mtd_part structure, we can retrieve + * the pointer to that structure with this macro. + */ + #define PART(x) ((struct mtd_part *)(x)) + +- + /* + * MTD methods which simply translate the effective address and pass through + * to the _real_ device. +@@ -548,8 +551,10 @@ out_register: + return slave; + } + +-int mtd_add_partition(struct mtd_info *master, const char *name, +- long long offset, long long length) ++ ++static int ++__mtd_add_partition(struct mtd_info *master, const char *name, ++ long long offset, long long length, bool dup_check) + { + struct mtd_partition part; + struct mtd_part *p, *new; +@@ -581,21 +586,24 @@ int mtd_add_partition(struct mtd_info *m + end = offset + length; + + mutex_lock(&mtd_partitions_mutex); +- list_for_each_entry(p, &mtd_partitions, list) +- if (p->master == master) { +- if ((start >= p->offset) && +- (start < (p->offset + p->mtd.size))) +- goto err_inv; +- +- if ((end >= p->offset) && +- (end < (p->offset + p->mtd.size))) +- goto err_inv; +- } ++ if (dup_check) { ++ list_for_each_entry(p, &mtd_partitions, list) ++ if (p->master == master) { ++ if ((start >= p->offset) && ++ (start < (p->offset + p->mtd.size))) ++ goto err_inv; ++ ++ if ((end >= p->offset) && ++ (end < (p->offset + p->mtd.size))) ++ goto err_inv; ++ } ++ } + + list_add(&new->list, &mtd_partitions); + mutex_unlock(&mtd_partitions_mutex); + + add_mtd_device(&new->mtd); ++ mtd_partition_split(master, new); + + return ret; + err_inv: +@@ -605,6 +613,12 @@ err_inv: + } + EXPORT_SYMBOL_GPL(mtd_add_partition); + ++int mtd_add_partition(struct mtd_info *master, const char *name, ++ long long offset, long long length) ++{ ++ return __mtd_add_partition(master, name, offset, length, true); ++} ++ + int mtd_del_partition(struct mtd_info *master, int partno) + { + struct mtd_part *slave, *next; +@@ -628,6 +642,35 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME ++#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME ++#else ++#define SPLIT_FIRMWARE_NAME "unused" ++#endif ++ ++static void split_firmware(struct mtd_info *master, struct mtd_part *part) ++{ ++} ++ ++void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, ++ int offset, int size) ++{ ++} ++ ++static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) ++{ ++ static int rootfs_found = 0; ++ ++ if (rootfs_found) ++ return; ++ ++ if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && ++ config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) ++ split_firmware(master, part); ++ ++ arch_split_mtd_part(master, part->mtd.name, part->offset, ++ part->mtd.size); ++} + /* + * This function, given a master MTD object and a partition table, creates + * and registers slave MTD objects which are bound to the master according to +@@ -657,6 +700,7 @@ int add_mtd_partitions(struct mtd_info * + mutex_unlock(&mtd_partitions_mutex); + + add_mtd_device(&slave->mtd); ++ mtd_partition_split(master, slave); + + cur_offset = slave->offset + slave->mtd.size; + } +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -84,5 +84,7 @@ int mtd_add_partition(struct mtd_info *m + long long offset, long long length); + int mtd_del_partition(struct mtd_info *master, int partno); + uint64_t mtd_get_device_size(const struct mtd_info *mtd); ++extern void __weak arch_split_mtd_part(struct mtd_info *master, ++ const char *name, int offset, int size); + + #endif diff --git a/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch new file mode 100644 index 000000000..684234161 --- /dev/null +++ b/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch @@ -0,0 +1,113 @@ +From 02cff0ccaa6d364f5c1eeea83f47ac80ccc967d4 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Tue, 3 Sep 2013 18:11:50 +0200 +Subject: [PATCH] mtd: add support for different partition parser types + +Signed-off-by: Gabor Juhos +--- + drivers/mtd/mtdpart.c | 56 ++++++++++++++++++++++++++++++++++++++++ + include/linux/mtd/partitions.h | 11 ++++++++ + 2 files changed, 67 insertions(+) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -730,6 +730,30 @@ static struct mtd_part_parser *get_parti + + #define put_partition_parser(p) do { module_put((p)->owner); } while (0) + ++static struct mtd_part_parser * ++get_partition_parser_by_type(enum mtd_parser_type type, ++ struct mtd_part_parser *start) ++{ ++ struct mtd_part_parser *p, *ret = NULL; ++ ++ spin_lock(&part_parser_lock); ++ ++ p = list_prepare_entry(start, &part_parsers, list); ++ if (start) ++ put_partition_parser(start); ++ ++ list_for_each_entry_continue(p, &part_parsers, list) { ++ if (p->type == type && try_module_get(p->owner)) { ++ ret = p; ++ break; ++ } ++ } ++ ++ spin_unlock(&part_parser_lock); ++ ++ return ret; ++} ++ + void register_mtd_parser(struct mtd_part_parser *p) + { + spin_lock(&part_parser_lock); +@@ -845,6 +869,38 @@ int parse_mtd_partitions(struct mtd_info + return ret; + } + ++int parse_mtd_partitions_by_type(struct mtd_info *master, ++ enum mtd_parser_type type, ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct mtd_part_parser *prev = NULL; ++ int ret = 0; ++ ++ while (1) { ++ struct mtd_part_parser *parser; ++ ++ parser = get_partition_parser_by_type(type, prev); ++ if (!parser) ++ break; ++ ++ ret = (*parser->parse_fn)(master, pparts, data); ++ ++ if (ret > 0) { ++ put_partition_parser(parser); ++ printk(KERN_NOTICE ++ "%d %s partitions found on MTD device %s\n", ++ ret, parser->name, master->name); ++ break; ++ } ++ ++ prev = parser; ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); ++ + int mtd_is_partition(const struct mtd_info *mtd) + { + struct mtd_part *part; +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -68,12 +68,17 @@ struct mtd_part_parser_data { + * Functions dealing with the various ways of partitioning the space + */ + ++enum mtd_parser_type { ++ MTD_PARSER_TYPE_DEVICE = 0, ++}; ++ + struct mtd_part_parser { + struct list_head list; + struct module *owner; + const char *name; + int (*parse_fn)(struct mtd_info *, struct mtd_partition **, + struct mtd_part_parser_data *); ++ enum mtd_parser_type type; + }; + + extern void register_mtd_parser(struct mtd_part_parser *parser); +@@ -87,4 +92,9 @@ uint64_t mtd_get_device_size(const struc + extern void __weak arch_split_mtd_part(struct mtd_info *master, + const char *name, int offset, int size); + ++int parse_mtd_partitions_by_type(struct mtd_info *master, ++ enum mtd_parser_type type, ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data); ++ + #endif diff --git a/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch new file mode 100644 index 000000000..dead0fbf5 --- /dev/null +++ b/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -0,0 +1,72 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -642,6 +642,37 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++static int ++run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) ++{ ++ struct mtd_partition *parts; ++ int nr_parts; ++ int i; ++ ++ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts, ++ NULL); ++ if (nr_parts <= 0) ++ return nr_parts; ++ ++ if (WARN_ON(!parts)) ++ return 0; ++ ++ for (i = 0; i < nr_parts; i++) { ++ /* adjust partition offsets */ ++ parts[i].offset += slave->offset; ++ ++ __mtd_add_partition(slave->master, ++ parts[i].name, ++ parts[i].offset, ++ parts[i].size, ++ false); ++ } ++ ++ kfree(parts); ++ ++ return nr_parts; ++} ++ + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME + #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME + #else +@@ -650,6 +681,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); + + static void split_firmware(struct mtd_info *master, struct mtd_part *part) + { ++ run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); + } + + void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, +@@ -664,6 +696,12 @@ static void mtd_partition_split(struct m + if (rootfs_found) + return; + ++ if (!strcmp(part->mtd.name, "rootfs")) { ++ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); ++ ++ rootfs_found = 1; ++ } ++ + if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && + config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) + split_firmware(master, part); +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -70,6 +70,8 @@ struct mtd_part_parser_data { + + enum mtd_parser_type { + MTD_PARSER_TYPE_DEVICE = 0, ++ MTD_PARSER_TYPE_ROOTFS, ++ MTD_PARSER_TYPE_FIRMWARE, + }; + + struct mtd_part_parser { diff --git a/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch new file mode 100644 index 000000000..0cf1c3855 --- /dev/null +++ b/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch @@ -0,0 +1,22 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -27,6 +27,8 @@ config MTD_SPLIT_FIRMWARE_NAME + depends on MTD_SPLIT_FIRMWARE + default "firmware" + ++source "drivers/mtd/mtdsplit/Kconfig" ++ + endmenu + + config MTD_TESTS +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -6,6 +6,8 @@ + obj-$(CONFIG_MTD) += mtd.o + mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o + ++obj-$(CONFIG_MTD_SPLIT) += mtdsplit/ ++ + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o + obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o + obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o diff --git a/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch new file mode 100644 index 000000000..b2f62c115 --- /dev/null +++ b/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch @@ -0,0 +1,101 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -446,14 +446,12 @@ static struct mtd_part *allocate_partiti + if (slave->offset == MTDPART_OFS_APPEND) + slave->offset = cur_offset; + if (slave->offset == MTDPART_OFS_NXTBLK) { +- slave->offset = cur_offset; +- if (mtd_mod_by_eb(cur_offset, master) != 0) { +- /* Round up to next erasesize */ +- slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; ++ /* Round up to next erasesize */ ++ slave->offset = mtd_roundup_to_eb(cur_offset, master); ++ if (slave->offset != cur_offset) + printk(KERN_NOTICE "Moving partition %d: " + "0x%012llx -> 0x%012llx\n", partno, + (unsigned long long)cur_offset, (unsigned long long)slave->offset); +- } + } + if (slave->offset == MTDPART_OFS_RETAIN) { + slave->offset = cur_offset; +@@ -673,6 +671,17 @@ run_parsers_by_type(struct mtd_part *sla + return nr_parts; + } + ++static inline unsigned long ++mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) ++{ ++ unsigned long mask = mtd->erasesize - 1; ++ ++ len += offset & mask; ++ len = (len + mask) & ~mask; ++ len -= offset & mask; ++ return len; ++} ++ + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME + #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME + #else +@@ -956,6 +965,24 @@ int mtd_is_partition(const struct mtd_in + } + EXPORT_SYMBOL_GPL(mtd_is_partition); + ++struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd) ++{ ++ if (!mtd_is_partition(mtd)) ++ return (struct mtd_info *)mtd; ++ ++ return PART(mtd)->master; ++} ++EXPORT_SYMBOL_GPL(mtdpart_get_master); ++ ++uint64_t mtdpart_get_offset(const struct mtd_info *mtd) ++{ ++ if (!mtd_is_partition(mtd)) ++ return 0; ++ ++ return PART(mtd)->offset; ++} ++EXPORT_SYMBOL_GPL(mtdpart_get_offset); ++ + /* Returns the size of the entire flash chip */ + uint64_t mtd_get_device_size(const struct mtd_info *mtd) + { +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -90,6 +90,8 @@ int mtd_is_partition(const struct mtd_in + int mtd_add_partition(struct mtd_info *master, const char *name, + long long offset, long long length); + int mtd_del_partition(struct mtd_info *master, int partno); ++struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); ++uint64_t mtdpart_get_offset(const struct mtd_info *mtd); + uint64_t mtd_get_device_size(const struct mtd_info *mtd); + extern void __weak arch_split_mtd_part(struct mtd_info *master, + const char *name, int offset, int size); +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -333,6 +333,24 @@ static inline uint32_t mtd_mod_by_eb(uin + return do_div(sz, mtd->erasesize); + } + ++static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd) ++{ ++ if (mtd_mod_by_eb(sz, mtd) == 0) ++ return sz; ++ ++ /* Round up to next erase block */ ++ return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize; ++} ++ ++static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd) ++{ ++ if (mtd_mod_by_eb(sz, mtd) == 0) ++ return sz; ++ ++ /* Round down to the start of the current erase block */ ++ return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize; ++} ++ + static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) + { + if (mtd->writesize_shift) diff --git a/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch b/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch new file mode 100644 index 000000000..7e74c4e53 --- /dev/null +++ b/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch @@ -0,0 +1,70 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -27,6 +27,11 @@ config MTD_SPLIT_FIRMWARE_NAME + depends on MTD_SPLIT_FIRMWARE + default "firmware" + ++config MTD_UIMAGE_SPLIT ++ bool "Enable split support for firmware partitions containing a uImage" ++ depends on MTD_SPLIT_FIRMWARE ++ default y ++ + source "drivers/mtd/mtdsplit/Kconfig" + + endmenu +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -682,6 +682,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, + return len; + } + ++#define UBOOT_MAGIC 0x27051956 ++ ++static void split_uimage(struct mtd_info *master, struct mtd_part *part) ++{ ++ struct { ++ __be32 magic; ++ __be32 pad[2]; ++ __be32 size; ++ } hdr; ++ size_t len; ++ ++ if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) ++ return; ++ ++ if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) ++ return; ++ ++ len = be32_to_cpu(hdr.size) + 0x40; ++ len = mtd_pad_erasesize(master, part->offset, len); ++ if (len + master->erasesize > part->mtd.size) ++ return; ++ ++ if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW)) ++ pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n"); ++ else ++ pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n"); ++ ++ __mtd_add_partition(master, "rootfs", part->offset + len, ++ part->mtd.size - len, false); ++} ++ + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME + #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME + #else +@@ -690,7 +721,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, + + static void split_firmware(struct mtd_info *master, struct mtd_part *part) + { +- run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); ++ int ret; ++ ++ ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); ++ if (ret > 0) ++ return; ++ ++ if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) ++ split_uimage(master, part); + } + + void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, diff --git a/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch b/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch new file mode 100644 index 000000000..cc548efb6 --- /dev/null +++ b/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch @@ -0,0 +1,76 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -18,6 +18,11 @@ config MTD_ROOTFS_ROOT_DEV + bool "Automatically set 'rootfs' partition to be root filesystem" + default y + ++config MTD_ROOTFS_SPLIT ++ bool "Automatically split 'rootfs' partition for squashfs" ++ select MTD_SPLIT ++ default y ++ + config MTD_SPLIT_FIRMWARE + bool "Automatically split firmware partition for kernel+rootfs" + default y +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -682,6 +682,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, + return len; + } + ++static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) ++{ ++ size_t squashfs_len; ++ int len, ret; ++ ++ ret = mtd_get_squashfs_len(master, offset, &squashfs_len); ++ if (ret) ++ return ret; ++ ++ len = mtd_pad_erasesize(master, offset, squashfs_len); ++ *split_offset = offset + len; ++ ++ return 0; ++} ++ ++static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part) ++{ ++ unsigned int split_offset = 0; ++ unsigned int split_size; ++ int ret; ++ ++ ret = split_squashfs(master, part->offset, &split_offset); ++ if (ret) ++ return; ++ ++ if (split_offset <= 0) ++ return; ++ ++ if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT)) ++ pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n"); ++ else ++ pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n"); ++ ++ split_size = part->mtd.size - (split_offset - part->offset); ++ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", ++ ROOTFS_SPLIT_NAME, split_offset, split_size); ++ ++ __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset, ++ split_size, false); ++} ++ + #define UBOOT_MAGIC 0x27051956 + + static void split_uimage(struct mtd_info *master, struct mtd_part *part) +@@ -744,7 +785,10 @@ static void mtd_partition_split(struct m + return; + + if (!strcmp(part->mtd.name, "rootfs")) { +- run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); ++ int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); ++ ++ if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) ++ split_rootfs_data(master, part); + + rootfs_found = 1; + } diff --git a/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch b/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch new file mode 100644 index 000000000..78ebbf88c --- /dev/null +++ b/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch @@ -0,0 +1,18 @@ +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -35,6 +35,7 @@ + * Note: writeable partitions require their size and offset be + * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). + */ ++struct mtd_info; + + struct mtd_partition { + const char *name; /* identifier string */ +@@ -50,7 +51,6 @@ struct mtd_partition { + #define MTDPART_SIZ_FULL (0) + + +-struct mtd_info; + struct device_node; + + /** diff --git a/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch new file mode 100644 index 000000000..5d5c6ed5d --- /dev/null +++ b/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch @@ -0,0 +1,142 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -36,6 +36,8 @@ + #include "mtdcore.h" + #include "mtdsplit/mtdsplit.h" + ++#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ ++ + /* Our partition linked list */ + static LIST_HEAD(mtd_partitions); + static DEFINE_MUTEX(mtd_partitions_mutex); +@@ -234,13 +236,61 @@ static int part_erase(struct mtd_info *m + struct mtd_part *part = PART(mtd); + int ret; + ++ ++ instr->partial_start = false; ++ if (mtd->flags & MTD_ERASE_PARTIAL) { ++ size_t readlen = 0; ++ u64 mtd_ofs; ++ ++ instr->erase_buf = kmalloc(part->master->erasesize, GFP_ATOMIC); ++ if (!instr->erase_buf) ++ return -ENOMEM; ++ ++ mtd_ofs = part->offset + instr->addr; ++ instr->erase_buf_ofs = do_div(mtd_ofs, part->master->erasesize); ++ ++ if (instr->erase_buf_ofs > 0) { ++ instr->addr -= instr->erase_buf_ofs; ++ ret = mtd_read(part->master, ++ instr->addr + part->offset, ++ part->master->erasesize, ++ &readlen, instr->erase_buf); ++ ++ instr->len += instr->erase_buf_ofs; ++ instr->partial_start = true; ++ } else { ++ mtd_ofs = part->offset + part->mtd.size; ++ instr->erase_buf_ofs = part->master->erasesize - ++ do_div(mtd_ofs, part->master->erasesize); ++ ++ if (instr->erase_buf_ofs > 0) { ++ instr->len += instr->erase_buf_ofs; ++ ret = mtd_read(part->master, ++ part->offset + instr->addr + ++ instr->len - part->master->erasesize, ++ part->master->erasesize, &readlen, ++ instr->erase_buf); ++ } else { ++ ret = 0; ++ } ++ } ++ if (ret < 0) { ++ kfree(instr->erase_buf); ++ return ret; ++ } ++ ++ } ++ + instr->addr += part->offset; + ret = part->master->_erase(part->master, instr); + if (ret) { + if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) + instr->fail_addr -= part->offset; + instr->addr -= part->offset; ++ if (mtd->flags & MTD_ERASE_PARTIAL) ++ kfree(instr->erase_buf); + } ++ + return ret; + } + +@@ -248,7 +298,25 @@ void mtd_erase_callback(struct erase_inf + { + if (instr->mtd->_erase == part_erase) { + struct mtd_part *part = PART(instr->mtd); ++ size_t wrlen = 0; + ++ if (instr->mtd->flags & MTD_ERASE_PARTIAL) { ++ if (instr->partial_start) { ++ part->master->_write(part->master, ++ instr->addr, instr->erase_buf_ofs, ++ &wrlen, instr->erase_buf); ++ instr->addr += instr->erase_buf_ofs; ++ } else { ++ instr->len -= instr->erase_buf_ofs; ++ part->master->_write(part->master, ++ instr->addr + instr->len, ++ instr->erase_buf_ofs, &wrlen, ++ instr->erase_buf + ++ part->master->erasesize - ++ instr->erase_buf_ofs); ++ } ++ kfree(instr->erase_buf); ++ } + if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) + instr->fail_addr -= part->offset; + instr->addr -= part->offset; +@@ -515,17 +583,20 @@ static struct mtd_part *allocate_partiti + if ((slave->mtd.flags & MTD_WRITEABLE) && + mtd_mod_by_eb(slave->offset, &slave->mtd)) { + /* Doesn't start on a boundary of major erase size */ +- /* FIXME: Let it be writable if it is on a boundary of +- * _minor_ erase size though */ +- slave->mtd.flags &= ~MTD_WRITEABLE; +- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", +- part->name); ++ slave->mtd.flags |= MTD_ERASE_PARTIAL; ++ if (((u32) slave->mtd.size) > master->erasesize) ++ slave->mtd.flags &= ~MTD_WRITEABLE; ++ else ++ slave->mtd.erasesize = slave->mtd.size; + } + if ((slave->mtd.flags & MTD_WRITEABLE) && +- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { +- slave->mtd.flags &= ~MTD_WRITEABLE; +- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", +- part->name); ++ mtd_mod_by_eb(slave->offset + slave->mtd.size, &slave->mtd)) { ++ slave->mtd.flags |= MTD_ERASE_PARTIAL; ++ ++ if ((u32) slave->mtd.size > master->erasesize) ++ slave->mtd.flags &= ~MTD_WRITEABLE; ++ else ++ slave->mtd.erasesize = slave->mtd.size; + } + + slave->mtd.ecclayout = master->ecclayout; +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -55,6 +55,10 @@ struct erase_info { + u_long priv; + u_char state; + struct erase_info *next; ++ ++ u8 *erase_buf; ++ u32 erase_buf_ofs; ++ bool partial_start; + }; + + struct mtd_erase_region_info { diff --git a/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch new file mode 100644 index 000000000..62f9d5bad --- /dev/null +++ b/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch @@ -0,0 +1,18 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -335,7 +335,14 @@ static int part_lock(struct mtd_info *mt + static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) + { + struct mtd_part *part = PART(mtd); +- return part->master->_unlock(part->master, ofs + part->offset, len); ++ ++ ofs += part->offset; ++ if (mtd->flags & MTD_ERASE_PARTIAL) { ++ /* round up len to next erasesize and round down offset to prev block */ ++ len = (mtd_div_by_eb(len, part->master) + 1) * part->master->erasesize; ++ ofs &= ~(part->master->erasesize - 1); ++ } ++ return part->master->_unlock(part->master, ofs, len); + } + + static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch b/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch new file mode 100644 index 000000000..f74affcef --- /dev/null +++ b/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch @@ -0,0 +1,30 @@ +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru + #endif + names += strlen(names)+1; + +-#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED + if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) { +- i++; +- parts[i].offset = parts[i-1].size + parts[i-1].offset; +- parts[i].size = fl->next->img->flash_base - parts[i].offset; +- parts[i].name = nullname; +- } ++ if (!strcmp(parts[i].name, "rootfs")) { ++ parts[i].size = fl->next->img->flash_base; ++ parts[i].size &= ~(master->erasesize - 1); ++ parts[i].size -= parts[i].offset; ++#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED ++ nrparts--; ++ } else { ++ i++; ++ parts[i].offset = parts[i-1].size + parts[i-1].offset; ++ parts[i].size = fl->next->img->flash_base - parts[i].offset; ++ parts[i].name = nullname; + #endif ++ } ++ } + tmp_fl = fl; + fl = fl->next; + kfree(tmp_fl); diff --git a/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch new file mode 100644 index 000000000..25e0ecd04 --- /dev/null +++ b/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch @@ -0,0 +1,35 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -184,6 +184,22 @@ config MTD_BCM47XX_PARTS + This provides partitions parser for devices based on BCM47xx + boards. + ++config MTD_MYLOADER_PARTS ++ tristate "MyLoader partition parsing" ++ depends on ADM5120 || ATH25 || ATH79 ++ ---help--- ++ MyLoader is a bootloader which allows the user to define partitions ++ in flash devices, by putting a table in the second erase block ++ on the device, similar to a partition table. This table gives the ++ offsets and lengths of the user defined partitions. ++ ++ If you need code which can detect and parse these tables, and ++ register MTD 'partitions' corresponding to each image detected, ++ enable this option. ++ ++ You will still need the parsing functions to be called by the driver ++ for your particular device. It won't happen automatically. ++ + comment "User Modules And Translation Layers" + + # +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o + obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o ++obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o + + # 'Users' - code which presents functionality to userspace. + obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch new file mode 100644 index 000000000..5ad82f1f5 --- /dev/null +++ b/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch @@ -0,0 +1,100 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 2 Jan 2016 01:04:52 +0100 +Subject: [PATCH] mtd: bcm47xxpart: check for bad blocks when calculating + offsets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/bcm47xxpart.c | 50 +++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 40 insertions(+), 10 deletions(-) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -61,6 +61,34 @@ static void bcm47xxpart_add_part(struct + part->mask_flags = mask_flags; + } + ++/* ++ * Calculate real end offset (address) for a given amount of data. It checks ++ * all blocks skipping bad ones. ++ */ ++static size_t bcm47xxpart_real_offset(struct mtd_info *master, size_t offset, ++ size_t bytes) ++{ ++ size_t real_offset = offset; ++ ++ if (mtd_block_isbad(master, real_offset)) ++ pr_warn("Base offset shouldn't be at bad block"); ++ ++ while (bytes >= master->erasesize) { ++ bytes -= master->erasesize; ++ real_offset += master->erasesize; ++ while (mtd_block_isbad(master, real_offset)) { ++ real_offset += master->erasesize; ++ ++ if (real_offset >= master->size) ++ return real_offset - master->erasesize; ++ } ++ } ++ ++ real_offset += bytes; ++ ++ return real_offset; ++} ++ + static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, + size_t offset) + { +@@ -182,6 +210,8 @@ static int bcm47xxpart_parse(struct mtd_ + + /* TRX */ + if (buf[0x000 / 4] == TRX_MAGIC) { ++ uint32_t tmp; ++ + if (BCM47XXPART_MAX_PARTS - curr_part < 4) { + pr_warn("Not enough partitions left to register trx, scanning stopped!\n"); + break; +@@ -196,18 +226,18 @@ static int bcm47xxpart_parse(struct mtd_ + i = 0; + /* We have LZMA loader if offset[2] points to sth */ + if (trx->offset[2]) { ++ tmp = bcm47xxpart_real_offset(master, offset, ++ trx->offset[i]); + bcm47xxpart_add_part(&parts[curr_part++], +- "loader", +- offset + trx->offset[i], +- 0); ++ "loader", tmp, 0); + i++; + } + + if (trx->offset[i]) { ++ tmp = bcm47xxpart_real_offset(master, offset, ++ trx->offset[i]); + bcm47xxpart_add_part(&parts[curr_part++], +- "linux", +- offset + trx->offset[i], +- 0); ++ "linux", tmp, 0); + i++; + } + +@@ -219,11 +249,11 @@ static int bcm47xxpart_parse(struct mtd_ + if (trx->offset[i]) { + const char *name; + +- name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); ++ tmp = bcm47xxpart_real_offset(master, offset, ++ trx->offset[i]); ++ name = bcm47xxpart_trx_data_part_name(master, tmp); + bcm47xxpart_add_part(&parts[curr_part++], +- name, +- offset + trx->offset[i], +- 0); ++ name, tmp, 0); + i++; + } + diff --git a/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch new file mode 100644 index 000000000..9e5ca91e5 --- /dev/null +++ b/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch @@ -0,0 +1,42 @@ +From fd54aa583296f9adfb1f519affbc10ba521eb809 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 28 Jan 2015 22:14:41 +0100 +Subject: [PATCH] mtd: bcm47xxpart: detect T_Meter partition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It can be found on many Netgear devices. It consists of many 0x30 blocks +starting with 4D 54. + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/bcm47xxpart.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -38,6 +38,7 @@ + #define NVRAM_HEADER 0x48534C46 /* FLSH */ + #define POT_MAGIC1 0x54544f50 /* POTT */ + #define POT_MAGIC2 0x504f /* OP */ ++#define T_METER_MAGIC 0x4D540000 /* MT */ + #define ML_MAGIC1 0x39685a42 + #define ML_MAGIC2 0x26594131 + #define TRX_MAGIC 0x30524448 +@@ -207,6 +208,15 @@ static int bcm47xxpart_parse(struct mtd_ + MTD_WRITEABLE); + continue; + } ++ ++ /* T_Meter */ ++ if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC && ++ (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC && ++ (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) { ++ bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset, ++ MTD_WRITEABLE); ++ continue; ++ } + + /* TRX */ + if (buf[0x000 / 4] == TRX_MAGIC) { diff --git a/target/linux/generic/pending-3.18/440-block2mtd_init.patch b/target/linux/generic/pending-3.18/440-block2mtd_init.patch new file mode 100644 index 000000000..5ab60265a --- /dev/null +++ b/target/linux/generic/pending-3.18/440-block2mtd_init.patch @@ -0,0 +1,107 @@ +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -209,11 +210,12 @@ static void block2mtd_free_device(struct + } + + +-static struct block2mtd_dev *add_device(char *devname, int erase_size) ++static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) + { + const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; + struct block_device *bdev; + struct block2mtd_dev *dev; ++ struct mtd_partition *part; + char *name; + + if (!devname) +@@ -257,13 +259,16 @@ static struct block2mtd_dev *add_device( + + /* Setup the MTD structure */ + /* make the name contain the block device in */ +- name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); ++ if (!mtdname) ++ mtdname = devname; ++ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); + if (!name) + goto err_destroy_mutex; + ++ strcpy(name, mtdname); + dev->mtd.name = name; + +- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; ++ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); + dev->mtd.erasesize = erase_size; + dev->mtd.writesize = 1; + dev->mtd.writebufsize = PAGE_SIZE; +@@ -276,15 +281,18 @@ static struct block2mtd_dev *add_device( + dev->mtd.priv = dev; + dev->mtd.owner = THIS_MODULE; + +- if (mtd_device_register(&dev->mtd, NULL, 0)) { ++ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); ++ part->name = name; ++ part->offset = 0; ++ part->size = dev->mtd.size; ++ if (mtd_device_register(&dev->mtd, part, 1)) { + /* Device didn't get added, so free the entry */ + goto err_destroy_mutex; + } + list_add(&dev->list, &blkmtd_device_list); + pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", + dev->mtd.index, +- dev->mtd.name + strlen("block2mtd: "), +- dev->mtd.erasesize >> 10, dev->mtd.erasesize); ++ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); + return dev; + + err_destroy_mutex: +@@ -353,9 +361,9 @@ static char block2mtd_paramline[80 + 12] + + static int block2mtd_setup2(const char *val) + { +- char buf[80 + 12]; /* 80 for device, 12 for erase size */ ++ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ + char *str = buf; +- char *token[2]; ++ char *token[3]; + char *name; + size_t erase_size = PAGE_SIZE; + int i, ret; +@@ -368,7 +376,7 @@ static int block2mtd_setup2(const char * + strcpy(str, val); + kill_final_newline(str); + +- for (i = 0; i < 2; i++) ++ for (i = 0; i < 3; i++) + token[i] = strsep(&str, ","); + + if (str) { +@@ -394,8 +402,10 @@ static int block2mtd_setup2(const char * + return 0; + } + } ++ if (token[2] && (strlen(token[2]) + 1 > 80)) ++ pr_err("mtd device name too long\n"); + +- add_device(name, erase_size); ++ add_device(name, erase_size, token[2]); + + return 0; + } +@@ -429,7 +439,7 @@ static int block2mtd_setup(const char *v + + + module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); +-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); ++MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); + + static int __init block2mtd_init(void) + { diff --git a/target/linux/generic/pending-3.18/441-block2mtd_probe.patch b/target/linux/generic/pending-3.18/441-block2mtd_probe.patch new file mode 100644 index 000000000..6836a48e3 --- /dev/null +++ b/target/linux/generic/pending-3.18/441-block2mtd_probe.patch @@ -0,0 +1,110 @@ +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -10,6 +10,7 @@ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + #include ++#include + #include + #include + #include +@@ -210,13 +211,16 @@ static void block2mtd_free_device(struct + } + + +-static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) ++static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname, int timeout) + { + const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; +- struct block_device *bdev; ++ struct block_device *bdev = ERR_PTR(-ENODEV); + struct block2mtd_dev *dev; + struct mtd_partition *part; + char *name; ++#ifndef MODULE ++ int i; ++#endif + + if (!devname) + return NULL; +@@ -227,15 +231,20 @@ static struct block2mtd_dev *add_device( + + /* Get a handle on the device */ + bdev = blkdev_get_by_path(devname, mode, dev); ++ + #ifndef MODULE +- if (IS_ERR(bdev)) { ++ for (i = 0; IS_ERR(bdev) && i <= timeout; i++) { ++ dev_t devt; + +- /* We might not have rootfs mounted at this point. Try +- to resolve the device name by other means. */ ++ if (i) ++ msleep(1000); ++ wait_for_device_probe(); ++ ++ devt = name_to_dev_t(devname); ++ if (!devt) ++ continue; + +- dev_t devt = name_to_dev_t(devname); +- if (devt) +- bdev = blkdev_get_by_dev(devt, mode, dev); ++ bdev = blkdev_get_by_dev(devt, mode, dev); + } + #endif + +@@ -361,11 +370,12 @@ static char block2mtd_paramline[80 + 12] + + static int block2mtd_setup2(const char *val) + { +- char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ ++ char buf[80 + 12 + 80 + 8]; /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ + char *str = buf; +- char *token[3]; ++ char *token[4]; + char *name; + size_t erase_size = PAGE_SIZE; ++ unsigned long timeout = 0; + int i, ret; + + if (strnlen(val, sizeof(buf)) >= sizeof(buf)) { +@@ -376,7 +386,7 @@ static int block2mtd_setup2(const char * + strcpy(str, val); + kill_final_newline(str); + +- for (i = 0; i < 3; i++) ++ for (i = 0; i < 4; i++) + token[i] = strsep(&str, ","); + + if (str) { +@@ -405,7 +415,10 @@ static int block2mtd_setup2(const char * + if (token[2] && (strlen(token[2]) + 1 > 80)) + pr_err("mtd device name too long\n"); + +- add_device(name, erase_size, token[2]); ++ if (token[3] && kstrtoul(token[3], 0, &timeout)) ++ pr_err("invalid timeout\n"); ++ ++ add_device(name, erase_size, token[2], timeout); + + return 0; + } +@@ -439,7 +452,7 @@ static int block2mtd_setup(const char *v + + + module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); +-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); ++MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,[,]]]\""); + + static int __init block2mtd_init(void) + { +@@ -474,7 +487,7 @@ static void block2mtd_exit(void) + } + + +-module_init(block2mtd_init); ++late_initcall(block2mtd_init); + module_exit(block2mtd_exit); + + MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch b/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch new file mode 100644 index 000000000..0f5abaa72 --- /dev/null +++ b/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch @@ -0,0 +1,37 @@ +--- + drivers/mtd/nand/plat_nand.c | 13 ++++++++++++- + include/linux/mtd/nand.h | 1 + + 2 files changed, 13 insertions(+), 1 deletion(-) + +--- a/include/linux/mtd/nand.h ++++ b/include/linux/mtd/nand.h +@@ -851,6 +851,7 @@ struct platform_nand_chip { + unsigned int options; + unsigned int bbt_options; + const char **part_probe_types; ++ int (*chip_fixup)(struct mtd_info *mtd); + }; + + /* Keep gcc happy */ +--- a/drivers/mtd/nand/plat_nand.c ++++ b/drivers/mtd/nand/plat_nand.c +@@ -90,7 +90,18 @@ static int plat_nand_probe(struct platfo + } + + /* Scan to find existence of the device */ +- if (nand_scan(&data->mtd, pdata->chip.nr_chips)) { ++ if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) { ++ err = -ENXIO; ++ goto out; ++ } ++ ++ if (pdata->chip.chip_fixup) { ++ err = pdata->chip.chip_fixup(&data->mtd); ++ if (err) ++ goto out; ++ } ++ ++ if (nand_scan_tail(&data->mtd)) { + err = -ENXIO; + goto out; + } diff --git a/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch b/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch new file mode 100644 index 000000000..6a2092ce2 --- /dev/null +++ b/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch @@ -0,0 +1,11 @@ +--- a/drivers/mtd/nand/nand_ecc.c ++++ b/drivers/mtd/nand/nand_ecc.c +@@ -507,7 +507,7 @@ int __nand_correct_data(unsigned char *b + return 1; /* error in ECC data; no action needed */ + + pr_err("%s: uncorrectable ECC error\n", __func__); +- return -1; ++ return -EBADMSG; + } + EXPORT_SYMBOL(__nand_correct_data); + diff --git a/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch new file mode 100644 index 000000000..68fbd1246 --- /dev/null +++ b/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch @@ -0,0 +1,11 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -809,7 +809,7 @@ static int get_chip(struct map_info *map + return 0; + + case FL_ERASING: +- if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) || ++ if (1 /* no suspend */ || !cfip || !(cfip->EraseSuspend & (0x1|0x2)) || + !(mode == FL_READY || mode == FL_POINT || + (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) + goto sleep; diff --git a/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch new file mode 100644 index 000000000..382b44a93 --- /dev/null +++ b/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch @@ -0,0 +1,18 @@ +From: George Kashperko + +Issue map read after Write Buffer Load command to ensure chip is ready +to receive data. +Signed-off-by: George Kashperko +--- + drivers/mtd/chips/cfi_cmdset_0002.c | 1 + + 1 file changed, 1 insertion(+) +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -1831,6 +1831,7 @@ static int __xipram do_write_buffer(stru + + /* Write Buffer Load */ + map_write(map, CMD(0x25), cmd_adr); ++ (void) map_read(map, cmd_adr); + + chip->state = FL_WRITING_TO_BUFFER; + diff --git a/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch b/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch new file mode 100644 index 000000000..f059aa777 --- /dev/null +++ b/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch @@ -0,0 +1,20 @@ +From eef9dfc4e821408af1af13aa0cc707fc496fb7c6 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 11 Dec 2013 19:05:59 +0100 +Subject: [PATCH] m25p80: add support for the Winbond W25X05 flash + +Signed-off-by: Gabor Juhos +--- + drivers/mtd/devices/m25p80.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -618,6 +618,7 @@ static const struct spi_device_id spi_no + { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, + + /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ ++ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, + { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, + { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, + { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, diff --git a/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch b/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch new file mode 100644 index 000000000..9ba7a4ab2 --- /dev/null +++ b/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch @@ -0,0 +1,21 @@ +From 0d7388de0911c1a4fc4a8a3898ef9d0ab818ca08 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Tue, 7 Apr 2015 18:35:15 +0200 +Subject: [PATCH] mtd: spi-nor: add support for the Macronix MX25L512E SPI + flash chip + +Signed-off-by: Gabor Juhos +--- + drivers/mtd/spi-nor/spi-nor.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -518,6 +518,7 @@ static const struct spi_device_id spi_no + { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, + + /* Macronix */ ++ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, + { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, + { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, + { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, diff --git a/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch b/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch new file mode 100644 index 000000000..b06ac73fa --- /dev/null +++ b/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch @@ -0,0 +1,22 @@ +From 34e2b403040a2f9d3ba071d95a7f42457e2950f9 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Tue, 7 Apr 2015 18:35:15 +0200 +Subject: [PATCH] mtd: spi-nor: add support for the ISSI SI25CD512 SPI flash + +Signed-off-by: Gabor Juhos +--- + drivers/mtd/spi-nor/spi-nor.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -517,6 +517,9 @@ static const struct spi_device_id spi_no + { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, + { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, + ++ /* ISSI */ ++ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, ++ + /* Macronix */ + { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, + { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, diff --git a/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch b/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch new file mode 100644 index 000000000..72c083232 --- /dev/null +++ b/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -532,6 +532,7 @@ static const struct spi_device_id spi_no + { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, + { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, + { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, ++ { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, 0) }, + { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, + { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, + { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch new file mode 100644 index 000000000..950970dbc --- /dev/null +++ b/target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -497,6 +497,7 @@ static const struct spi_device_id spi_no + { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, + { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, + { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, + { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, + diff --git a/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch new file mode 100644 index 000000000..8fc3578a6 --- /dev/null +++ b/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch @@ -0,0 +1,26 @@ +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -456,6 +457,15 @@ int add_mtd_device(struct mtd_info *mtd) + of this try_ nonsense, and no bitching about it + either. :) */ + __module_get(THIS_MODULE); ++ ++ if (!strcmp(mtd->name, "rootfs") && ++ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && ++ ROOT_DEV == 0) { ++ pr_notice("mtd: device %d (%s) set to be root filesystem\n", ++ mtd->index, mtd->name); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); ++ } ++ + return 0; + + fail_added: diff --git a/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch new file mode 100644 index 000000000..b2b46ac6a --- /dev/null +++ b/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -0,0 +1,76 @@ +From 8a52e4100d7c3a4a1dfddfa02b8864a9b0068c13 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 17 May 2014 03:36:18 +0200 +Subject: [PATCH 1/5] ubi: auto-attach mtd device named "ubi" or "data" on boot +To: openwrt-devel@lists.openwrt.org + +Signed-off-by: Daniel Golle +--- + drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/drivers/mtd/ubi/build.c ++++ b/drivers/mtd/ubi/build.c +@@ -1223,6 +1223,49 @@ static struct mtd_info * __init open_mtd + return mtd; + } + ++/* ++ * This function tries attaching mtd partitions named either "ubi" or "data" ++ * during boot. ++ */ ++static void __init ubi_auto_attach(void) ++{ ++ int err; ++ struct mtd_info *mtd; ++ ++ /* try attaching mtd device named "ubi" or "data" */ ++ mtd = open_mtd_device("ubi"); ++ if (IS_ERR(mtd)) ++ mtd = open_mtd_device("data"); ++ ++ if (!IS_ERR(mtd)) { ++ size_t len; ++ char magic[4]; ++ ++ /* check for a valid ubi magic */ ++ err = mtd_read(mtd, 0, 4, &len, (void *) magic); ++ if (!err && len == 4 && strncmp(magic, "UBI#", 4)) { ++ ubi_err("no valid UBI magic found inside mtd%d", mtd->index); ++ put_mtd_device(mtd); ++ return; ++ } ++ ++ /* auto-add only media types where UBI makes sense */ ++ if (mtd->type == MTD_NANDFLASH || ++ mtd->type == MTD_NORFLASH || ++ mtd->type == MTD_DATAFLASH || ++ mtd->type == MTD_MLCNANDFLASH) { ++ mutex_lock(&ubi_devices_mutex); ++ ubi_msg("auto-attach mtd%d", mtd->index); ++ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); ++ mutex_unlock(&ubi_devices_mutex); ++ if (err < 0) { ++ ubi_err("cannot attach mtd%d", mtd->index); ++ put_mtd_device(mtd); ++ } ++ } ++ } ++} ++ + static int __init ubi_init(void) + { + int err, i, k; +@@ -1312,6 +1355,12 @@ static int __init ubi_init(void) + } + } + ++ /* auto-attach mtd devices only if built-in to the kernel and no ubi.mtd ++ * parameter was given */ ++ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && ++ !ubi_is_module() && !mtd_devs) ++ ubi_auto_attach(); ++ + err = ubiblock_init(); + if (err) { + ubi_err("block: cannot initialize, error %d", err); diff --git a/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch new file mode 100644 index 000000000..b152fba1b --- /dev/null +++ b/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch @@ -0,0 +1,69 @@ +From 0f3966579815f889bb2fcb4846152c35f65e79c4 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 15 May 2014 21:06:33 +0200 +Subject: [PATCH 2/5] ubi: auto-create ubiblock device for rootfs +To: openwrt-devel@lists.openwrt.org + +Signed-off-by: Daniel Golle +--- + drivers/mtd/ubi/block.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +--- a/drivers/mtd/ubi/block.c ++++ b/drivers/mtd/ubi/block.c +@@ -615,6 +615,44 @@ static int __init ubiblock_create_from_p + return ret; + } + ++#define UBIFS_NODE_MAGIC 0x06101831 ++static inline int ubi_vol_is_ubifs(struct ubi_volume_desc *desc) ++{ ++ int ret; ++ uint32_t magic_of, magic; ++ ret = ubi_read(desc, 0, (char *)&magic_of, 0, 4); ++ if (ret) ++ return 0; ++ magic = le32_to_cpu(magic_of); ++ return magic == UBIFS_NODE_MAGIC; ++} ++ ++static void __init ubiblock_create_auto_rootfs(void) ++{ ++ int ubi_num, ret, is_ubifs; ++ struct ubi_volume_desc *desc; ++ struct ubi_volume_info vi; ++ ++ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { ++ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); ++ if (IS_ERR(desc)) ++ continue; ++ ++ ubi_get_volume_info(desc, &vi); ++ is_ubifs = ubi_vol_is_ubifs(desc); ++ ubi_close_volume(desc); ++ if (is_ubifs) ++ break; ++ ++ ret = ubiblock_create(&vi); ++ if (ret) ++ ubi_err("block: can't add '%s' volume, err=%d\n", ++ vi.name, ret); ++ /* always break if we get here */ ++ break; ++ } ++} ++ + static void ubiblock_remove_all(void) + { + struct ubiblock *next; +@@ -645,6 +683,10 @@ int __init ubiblock_init(void) + if (ret) + goto err_remove; + ++ /* auto-attach "rootfs" volume if existing and non-ubifs */ ++ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV)) ++ ubiblock_create_auto_rootfs(); ++ + /* + * Block devices are only created upon user requests, so we ignore + * existing volumes. diff --git a/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch new file mode 100644 index 000000000..54a2f8259 --- /dev/null +++ b/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch @@ -0,0 +1,54 @@ +From eea9e1785e4c05c2a3444506aabafa0ae958538f Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 17 May 2014 03:35:02 +0200 +Subject: [PATCH 4/5] try auto-mounting ubi0:rootfs in init/do_mounts.c +To: openwrt-devel@lists.openwrt.org + +Signed-off-by: Daniel Golle +--- + init/do_mounts.c | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -433,7 +433,28 @@ retry: + out: + put_page(page); + } +- ++ ++static int __init mount_ubi_rootfs(void) ++{ ++ int flags = MS_SILENT; ++ int err, tried = 0; ++ ++ while (tried < 2) { ++ err = do_mount_root("ubi0:rootfs", "ubifs", flags, \ ++ root_mount_data); ++ switch (err) { ++ case -EACCES: ++ flags |= MS_RDONLY; ++ tried++; ++ break; ++ default: ++ return err; ++ } ++ } ++ ++ return -EINVAL; ++} ++ + #ifdef CONFIG_ROOT_NFS + + #define NFSROOT_TIMEOUT_MIN 5 +@@ -527,6 +548,10 @@ void __init mount_root(void) + change_floppy("root floppy"); + } + #endif ++#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++ if (!mount_ubi_rootfs()) ++ return; ++#endif + #ifdef CONFIG_BLOCK + create_dev("/dev/root", ROOT_DEV); + mount_block_root("/dev/root", root_mountflags); diff --git a/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch new file mode 100644 index 000000000..46917d12d --- /dev/null +++ b/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch @@ -0,0 +1,37 @@ +From cd68d1b12b5ea4c01a664c064179ada42bf55d3d Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 15 May 2014 20:55:42 +0200 +Subject: [PATCH 5/5] ubi: set ROOT_DEV to ubiblock "rootfs" if unset +To: openwrt-devel@lists.openwrt.org + +Signed-off-by: Daniel Golle +--- + drivers/mtd/ubi/block.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/mtd/ubi/block.c ++++ b/drivers/mtd/ubi/block.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + + #include "ubi-media.h" + #include "ubi.h" +@@ -448,6 +449,15 @@ int ubiblock_create(struct ubi_volume_in + add_disk(dev->gd); + ubi_msg("%s created from ubi%d:%d(%s)", + dev->gd->disk_name, dev->ubi_num, dev->vol_id, vi->name); ++ ++ if (!strcmp(vi->name, "rootfs") && ++ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && ++ ROOT_DEV == 0) { ++ pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n", ++ dev->ubi_num, dev->vol_id, vi->name); ++ ROOT_DEV = MKDEV(gd->major, gd->first_minor); ++ } ++ + return 0; + + out_free_queue: diff --git a/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch new file mode 100644 index 000000000..4b5eb4568 --- /dev/null +++ b/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch @@ -0,0 +1,51 @@ +--- a/drivers/mtd/ubi/attach.c ++++ b/drivers/mtd/ubi/attach.c +@@ -800,6 +800,13 @@ out_unlock: + return err; + } + ++static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech) ++{ ++ return ech->padding1[0] == 'E' && ++ ech->padding1[1] == 'O' && ++ ech->padding1[2] == 'F'; ++} ++ + /** + * scan_peb - scan and process UBI headers of a PEB. + * @ubi: UBI device description object +@@ -830,9 +837,21 @@ static int scan_peb(struct ubi_device *u + return 0; + } + +- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); +- if (err < 0) +- return err; ++ if (!ai->eof_found) { ++ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); ++ if (err < 0) ++ return err; ++ ++ if (ec_hdr_has_eof(ech)) { ++ ubi_msg("EOF marker found, PEBs from %d will be erased", ++ pnum); ++ ai->eof_found = true; ++ } ++ } ++ ++ if (ai->eof_found) ++ err = UBI_IO_FF_BITFLIPS; ++ + switch (err) { + case 0: + break; +--- a/drivers/mtd/ubi/ubi.h ++++ b/drivers/mtd/ubi/ubi.h +@@ -705,6 +705,7 @@ struct ubi_attach_info { + int mean_ec; + uint64_t ec_sum; + int ec_count; ++ bool eof_found; + struct kmem_cache *aeb_slab_cache; + }; + diff --git a/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch new file mode 100644 index 000000000..c92209a72 --- /dev/null +++ b/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch @@ -0,0 +1,5142 @@ +--- a/fs/jffs2/Kconfig ++++ b/fs/jffs2/Kconfig +@@ -139,6 +139,15 @@ config JFFS2_LZO + This feature was added in July, 2007. Say 'N' if you need + compatibility with older bootloaders or kernels. + ++config JFFS2_LZMA ++ bool "JFFS2 LZMA compression support" if JFFS2_COMPRESSION_OPTIONS ++ select LZMA_COMPRESS ++ select LZMA_DECOMPRESS ++ depends on JFFS2_FS ++ default n ++ help ++ JFFS2 wrapper to the LZMA C SDK ++ + config JFFS2_RTIME + bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS + depends on JFFS2_FS +--- a/fs/jffs2/Makefile ++++ b/fs/jffs2/Makefile +@@ -18,4 +18,7 @@ jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rub + jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o + jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o + jffs2-$(CONFIG_JFFS2_LZO) += compr_lzo.o ++jffs2-$(CONFIG_JFFS2_LZMA) += compr_lzma.o + jffs2-$(CONFIG_JFFS2_SUMMARY) += summary.o ++ ++CFLAGS_compr_lzma.o += -Iinclude/linux -Ilib/lzma +--- a/fs/jffs2/compr.c ++++ b/fs/jffs2/compr.c +@@ -378,6 +378,9 @@ int __init jffs2_compressors_init(void) + #ifdef CONFIG_JFFS2_LZO + jffs2_lzo_init(); + #endif ++#ifdef CONFIG_JFFS2_LZMA ++ jffs2_lzma_init(); ++#endif + /* Setting default compression mode */ + #ifdef CONFIG_JFFS2_CMODE_NONE + jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; +@@ -401,6 +404,9 @@ int __init jffs2_compressors_init(void) + int jffs2_compressors_exit(void) + { + /* Unregistering compressors */ ++#ifdef CONFIG_JFFS2_LZMA ++ jffs2_lzma_exit(); ++#endif + #ifdef CONFIG_JFFS2_LZO + jffs2_lzo_exit(); + #endif +--- a/fs/jffs2/compr.h ++++ b/fs/jffs2/compr.h +@@ -29,9 +29,9 @@ + #define JFFS2_DYNRUBIN_PRIORITY 20 + #define JFFS2_LZARI_PRIORITY 30 + #define JFFS2_RTIME_PRIORITY 50 +-#define JFFS2_ZLIB_PRIORITY 60 +-#define JFFS2_LZO_PRIORITY 80 +- ++#define JFFS2_LZMA_PRIORITY 70 ++#define JFFS2_ZLIB_PRIORITY 80 ++#define JFFS2_LZO_PRIORITY 90 + + #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */ + #define JFFS2_DYNRUBIN_DISABLED /* for decompression */ +@@ -101,5 +101,9 @@ void jffs2_zlib_exit(void); + int jffs2_lzo_init(void); + void jffs2_lzo_exit(void); + #endif ++#ifdef CONFIG_JFFS2_LZMA ++int jffs2_lzma_init(void); ++void jffs2_lzma_exit(void); ++#endif + + #endif /* __JFFS2_COMPR_H__ */ +--- /dev/null ++++ b/fs/jffs2/compr_lzma.c +@@ -0,0 +1,128 @@ ++/* ++ * JFFS2 -- Journalling Flash File System, Version 2. ++ * ++ * For licensing information, see the file 'LICENCE' in this directory. ++ * ++ * JFFS2 wrapper to the LZMA C SDK ++ * ++ */ ++ ++#include ++#include "compr.h" ++ ++#ifdef __KERNEL__ ++ static DEFINE_MUTEX(deflate_mutex); ++#endif ++ ++CLzmaEncHandle *p; ++Byte propsEncoded[LZMA_PROPS_SIZE]; ++SizeT propsSize = sizeof(propsEncoded); ++ ++STATIC void lzma_free_workspace(void) ++{ ++ LzmaEnc_Destroy(p, &lzma_alloc, &lzma_alloc); ++} ++ ++STATIC int INIT lzma_alloc_workspace(CLzmaEncProps *props) ++{ ++ if ((p = (CLzmaEncHandle *)LzmaEnc_Create(&lzma_alloc)) == NULL) ++ { ++ PRINT_ERROR("Failed to allocate lzma deflate workspace\n"); ++ return -ENOMEM; ++ } ++ ++ if (LzmaEnc_SetProps(p, props) != SZ_OK) ++ { ++ lzma_free_workspace(); ++ return -1; ++ } ++ ++ if (LzmaEnc_WriteProperties(p, propsEncoded, &propsSize) != SZ_OK) ++ { ++ lzma_free_workspace(); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out, ++ uint32_t *sourcelen, uint32_t *dstlen) ++{ ++ SizeT compress_size = (SizeT)(*dstlen); ++ int ret; ++ ++ #ifdef __KERNEL__ ++ mutex_lock(&deflate_mutex); ++ #endif ++ ++ ret = LzmaEnc_MemEncode(p, cpage_out, &compress_size, data_in, *sourcelen, ++ 0, NULL, &lzma_alloc, &lzma_alloc); ++ ++ #ifdef __KERNEL__ ++ mutex_unlock(&deflate_mutex); ++ #endif ++ ++ if (ret != SZ_OK) ++ return -1; ++ ++ *dstlen = (uint32_t)compress_size; ++ ++ return 0; ++} ++ ++STATIC int jffs2_lzma_decompress(unsigned char *data_in, unsigned char *cpage_out, ++ uint32_t srclen, uint32_t destlen) ++{ ++ int ret; ++ SizeT dl = (SizeT)destlen; ++ SizeT sl = (SizeT)srclen; ++ ELzmaStatus status; ++ ++ ret = LzmaDecode(cpage_out, &dl, data_in, &sl, propsEncoded, ++ propsSize, LZMA_FINISH_ANY, &status, &lzma_alloc); ++ ++ if (ret != SZ_OK || status == LZMA_STATUS_NOT_FINISHED || dl != (SizeT)destlen) ++ return -1; ++ ++ return 0; ++} ++ ++static struct jffs2_compressor jffs2_lzma_comp = { ++ .priority = JFFS2_LZMA_PRIORITY, ++ .name = "lzma", ++ .compr = JFFS2_COMPR_LZMA, ++ .compress = &jffs2_lzma_compress, ++ .decompress = &jffs2_lzma_decompress, ++ .disabled = 0, ++}; ++ ++int INIT jffs2_lzma_init(void) ++{ ++ int ret; ++ CLzmaEncProps props; ++ LzmaEncProps_Init(&props); ++ ++ props.dictSize = LZMA_BEST_DICT(0x2000); ++ props.level = LZMA_BEST_LEVEL; ++ props.lc = LZMA_BEST_LC; ++ props.lp = LZMA_BEST_LP; ++ props.pb = LZMA_BEST_PB; ++ props.fb = LZMA_BEST_FB; ++ ++ ret = lzma_alloc_workspace(&props); ++ if (ret < 0) ++ return ret; ++ ++ ret = jffs2_register_compressor(&jffs2_lzma_comp); ++ if (ret) ++ lzma_free_workspace(); ++ ++ return ret; ++} ++ ++void jffs2_lzma_exit(void) ++{ ++ jffs2_unregister_compressor(&jffs2_lzma_comp); ++ lzma_free_workspace(); ++} +--- a/fs/jffs2/super.c ++++ b/fs/jffs2/super.c +@@ -375,14 +375,41 @@ static int __init init_jffs2_fs(void) + BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); + BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); + +- pr_info("version 2.2." ++ pr_info("version 2.2" + #ifdef CONFIG_JFFS2_FS_WRITEBUFFER + " (NAND)" + #endif + #ifdef CONFIG_JFFS2_SUMMARY +- " (SUMMARY) " ++ " (SUMMARY)" + #endif +- " © 2001-2006 Red Hat, Inc.\n"); ++#ifdef CONFIG_JFFS2_ZLIB ++ " (ZLIB)" ++#endif ++#ifdef CONFIG_JFFS2_LZO ++ " (LZO)" ++#endif ++#ifdef CONFIG_JFFS2_LZMA ++ " (LZMA)" ++#endif ++#ifdef CONFIG_JFFS2_RTIME ++ " (RTIME)" ++#endif ++#ifdef CONFIG_JFFS2_RUBIN ++ " (RUBIN)" ++#endif ++#ifdef CONFIG_JFFS2_CMODE_NONE ++ " (CMODE_NONE)" ++#endif ++#ifdef CONFIG_JFFS2_CMODE_PRIORITY ++ " (CMODE_PRIORITY)" ++#endif ++#ifdef CONFIG_JFFS2_CMODE_SIZE ++ " (CMODE_SIZE)" ++#endif ++#ifdef CONFIG_JFFS2_CMODE_FAVOURLZO ++ " (CMODE_FAVOURLZO)" ++#endif ++ " (c) 2001-2006 Red Hat, Inc.\n"); + + jffs2_inode_cachep = kmem_cache_create("jffs2_i", + sizeof(struct jffs2_inode_info), +--- a/include/uapi/linux/jffs2.h ++++ b/include/uapi/linux/jffs2.h +@@ -46,6 +46,7 @@ + #define JFFS2_COMPR_DYNRUBIN 0x05 + #define JFFS2_COMPR_ZLIB 0x06 + #define JFFS2_COMPR_LZO 0x07 ++#define JFFS2_COMPR_LZMA 0x08 + /* Compatibility flags. */ + #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ + #define JFFS2_NODE_ACCURATE 0x2000 +--- /dev/null ++++ b/include/linux/lzma.h +@@ -0,0 +1,62 @@ ++#ifndef __LZMA_H__ ++#define __LZMA_H__ ++ ++#ifdef __KERNEL__ ++ #include ++ #include ++ #include ++ #include ++ #include ++ #define LZMA_MALLOC vmalloc ++ #define LZMA_FREE vfree ++ #define PRINT_ERROR(msg) printk(KERN_WARNING #msg) ++ #define INIT __init ++ #define STATIC static ++#else ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #ifndef PAGE_SIZE ++ extern int page_size; ++ #define PAGE_SIZE page_size ++ #endif ++ #define LZMA_MALLOC malloc ++ #define LZMA_FREE free ++ #define PRINT_ERROR(msg) fprintf(stderr, msg) ++ #define INIT ++ #define STATIC ++#endif ++ ++#include "lzma/LzmaDec.h" ++#include "lzma/LzmaEnc.h" ++ ++#define LZMA_BEST_LEVEL (9) ++#define LZMA_BEST_LC (0) ++#define LZMA_BEST_LP (0) ++#define LZMA_BEST_PB (0) ++#define LZMA_BEST_FB (273) ++ ++#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2) ++ ++static void *p_lzma_malloc(void *p, size_t size) ++{ ++ if (size == 0) ++ return NULL; ++ ++ return LZMA_MALLOC(size); ++} ++ ++static void p_lzma_free(void *p, void *address) ++{ ++ if (address != NULL) ++ LZMA_FREE(address); ++} ++ ++static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; ++ ++#endif +--- /dev/null ++++ b/include/linux/lzma/LzFind.h +@@ -0,0 +1,115 @@ ++/* LzFind.h -- Match finder for LZ algorithms ++2009-04-22 : Igor Pavlov : Public domain */ ++ ++#ifndef __LZ_FIND_H ++#define __LZ_FIND_H ++ ++#include "Types.h" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++typedef UInt32 CLzRef; ++ ++typedef struct _CMatchFinder ++{ ++ Byte *buffer; ++ UInt32 pos; ++ UInt32 posLimit; ++ UInt32 streamPos; ++ UInt32 lenLimit; ++ ++ UInt32 cyclicBufferPos; ++ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ ++ ++ UInt32 matchMaxLen; ++ CLzRef *hash; ++ CLzRef *son; ++ UInt32 hashMask; ++ UInt32 cutValue; ++ ++ Byte *bufferBase; ++ ISeqInStream *stream; ++ int streamEndWasReached; ++ ++ UInt32 blockSize; ++ UInt32 keepSizeBefore; ++ UInt32 keepSizeAfter; ++ ++ UInt32 numHashBytes; ++ int directInput; ++ size_t directInputRem; ++ int btMode; ++ int bigHash; ++ UInt32 historySize; ++ UInt32 fixedHashSize; ++ UInt32 hashSizeSum; ++ UInt32 numSons; ++ SRes result; ++ UInt32 crc[256]; ++} CMatchFinder; ++ ++#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) ++#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) ++ ++#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) ++ ++int MatchFinder_NeedMove(CMatchFinder *p); ++Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); ++void MatchFinder_MoveBlock(CMatchFinder *p); ++void MatchFinder_ReadIfRequired(CMatchFinder *p); ++ ++void MatchFinder_Construct(CMatchFinder *p); ++ ++/* Conditions: ++ historySize <= 3 GB ++ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB ++*/ ++int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, ++ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ++ ISzAlloc *alloc); ++void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); ++void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); ++void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); ++ ++UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, ++ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, ++ UInt32 *distances, UInt32 maxLen); ++ ++/* ++Conditions: ++ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. ++ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function ++*/ ++ ++typedef void (*Mf_Init_Func)(void *object); ++typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); ++typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); ++typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); ++typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); ++typedef void (*Mf_Skip_Func)(void *object, UInt32); ++ ++typedef struct _IMatchFinder ++{ ++ Mf_Init_Func Init; ++ Mf_GetIndexByte_Func GetIndexByte; ++ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; ++ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; ++ Mf_GetMatches_Func GetMatches; ++ Mf_Skip_Func Skip; ++} IMatchFinder; ++ ++void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); ++ ++void MatchFinder_Init(CMatchFinder *p); ++UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); ++UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); ++void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); ++void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/lzma/LzHash.h +@@ -0,0 +1,54 @@ ++/* LzHash.h -- HASH functions for LZ algorithms ++2009-02-07 : Igor Pavlov : Public domain */ ++ ++#ifndef __LZ_HASH_H ++#define __LZ_HASH_H ++ ++#define kHash2Size (1 << 10) ++#define kHash3Size (1 << 16) ++#define kHash4Size (1 << 20) ++ ++#define kFix3HashSize (kHash2Size) ++#define kFix4HashSize (kHash2Size + kHash3Size) ++#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) ++ ++#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); ++ ++#define HASH3_CALC { \ ++ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ ++ hash2Value = temp & (kHash2Size - 1); \ ++ hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } ++ ++#define HASH4_CALC { \ ++ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ ++ hash2Value = temp & (kHash2Size - 1); \ ++ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ ++ hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } ++ ++#define HASH5_CALC { \ ++ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ ++ hash2Value = temp & (kHash2Size - 1); \ ++ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ ++ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ ++ hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ ++ hash4Value &= (kHash4Size - 1); } ++ ++/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ ++#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; ++ ++ ++#define MT_HASH2_CALC \ ++ hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); ++ ++#define MT_HASH3_CALC { \ ++ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ ++ hash2Value = temp & (kHash2Size - 1); \ ++ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } ++ ++#define MT_HASH4_CALC { \ ++ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ ++ hash2Value = temp & (kHash2Size - 1); \ ++ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ ++ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } ++ ++#endif +--- /dev/null ++++ b/include/linux/lzma/LzmaDec.h +@@ -0,0 +1,231 @@ ++/* LzmaDec.h -- LZMA Decoder ++2009-02-07 : Igor Pavlov : Public domain */ ++ ++#ifndef __LZMA_DEC_H ++#define __LZMA_DEC_H ++ ++#include "Types.h" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* #define _LZMA_PROB32 */ ++/* _LZMA_PROB32 can increase the speed on some CPUs, ++ but memory usage for CLzmaDec::probs will be doubled in that case */ ++ ++#ifdef _LZMA_PROB32 ++#define CLzmaProb UInt32 ++#else ++#define CLzmaProb UInt16 ++#endif ++ ++ ++/* ---------- LZMA Properties ---------- */ ++ ++#define LZMA_PROPS_SIZE 5 ++ ++typedef struct _CLzmaProps ++{ ++ unsigned lc, lp, pb; ++ UInt32 dicSize; ++} CLzmaProps; ++ ++/* LzmaProps_Decode - decodes properties ++Returns: ++ SZ_OK ++ SZ_ERROR_UNSUPPORTED - Unsupported properties ++*/ ++ ++SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); ++ ++ ++/* ---------- LZMA Decoder state ---------- */ ++ ++/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. ++ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ ++ ++#define LZMA_REQUIRED_INPUT_MAX 20 ++ ++typedef struct ++{ ++ CLzmaProps prop; ++ CLzmaProb *probs; ++ Byte *dic; ++ const Byte *buf; ++ UInt32 range, code; ++ SizeT dicPos; ++ SizeT dicBufSize; ++ UInt32 processedPos; ++ UInt32 checkDicSize; ++ unsigned state; ++ UInt32 reps[4]; ++ unsigned remainLen; ++ int needFlush; ++ int needInitState; ++ UInt32 numProbs; ++ unsigned tempBufSize; ++ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; ++} CLzmaDec; ++ ++#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } ++ ++void LzmaDec_Init(CLzmaDec *p); ++ ++/* There are two types of LZMA streams: ++ 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. ++ 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ ++ ++typedef enum ++{ ++ LZMA_FINISH_ANY, /* finish at any point */ ++ LZMA_FINISH_END /* block must be finished at the end */ ++} ELzmaFinishMode; ++ ++/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! ++ ++ You must use LZMA_FINISH_END, when you know that current output buffer ++ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. ++ ++ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, ++ and output value of destLen will be less than output buffer size limit. ++ You can check status result also. ++ ++ You can use multiple checks to test data integrity after full decompression: ++ 1) Check Result and "status" variable. ++ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. ++ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. ++ You must use correct finish mode in that case. */ ++ ++typedef enum ++{ ++ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ ++ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ ++ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ ++ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ ++ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ ++} ELzmaStatus; ++ ++/* ELzmaStatus is used only as output value for function call */ ++ ++ ++/* ---------- Interfaces ---------- */ ++ ++/* There are 3 levels of interfaces: ++ 1) Dictionary Interface ++ 2) Buffer Interface ++ 3) One Call Interface ++ You can select any of these interfaces, but don't mix functions from different ++ groups for same object. */ ++ ++ ++/* There are two variants to allocate state for Dictionary Interface: ++ 1) LzmaDec_Allocate / LzmaDec_Free ++ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs ++ You can use variant 2, if you set dictionary buffer manually. ++ For Buffer Interface you must always use variant 1. ++ ++LzmaDec_Allocate* can return: ++ SZ_OK ++ SZ_ERROR_MEM - Memory allocation error ++ SZ_ERROR_UNSUPPORTED - Unsupported properties ++*/ ++ ++SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); ++void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); ++ ++SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); ++void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); ++ ++/* ---------- Dictionary Interface ---------- */ ++ ++/* You can use it, if you want to eliminate the overhead for data copying from ++ dictionary to some other external buffer. ++ You must work with CLzmaDec variables directly in this interface. ++ ++ STEPS: ++ LzmaDec_Constr() ++ LzmaDec_Allocate() ++ for (each new stream) ++ { ++ LzmaDec_Init() ++ while (it needs more decompression) ++ { ++ LzmaDec_DecodeToDic() ++ use data from CLzmaDec::dic and update CLzmaDec::dicPos ++ } ++ } ++ LzmaDec_Free() ++*/ ++ ++/* LzmaDec_DecodeToDic ++ ++ The decoding to internal dictionary buffer (CLzmaDec::dic). ++ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! ++ ++finishMode: ++ It has meaning only if the decoding reaches output limit (dicLimit). ++ LZMA_FINISH_ANY - Decode just dicLimit bytes. ++ LZMA_FINISH_END - Stream must be finished after dicLimit. ++ ++Returns: ++ SZ_OK ++ status: ++ LZMA_STATUS_FINISHED_WITH_MARK ++ LZMA_STATUS_NOT_FINISHED ++ LZMA_STATUS_NEEDS_MORE_INPUT ++ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK ++ SZ_ERROR_DATA - Data error ++*/ ++ ++SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, ++ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); ++ ++ ++/* ---------- Buffer Interface ---------- */ ++ ++/* It's zlib-like interface. ++ See LzmaDec_DecodeToDic description for information about STEPS and return results, ++ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need ++ to work with CLzmaDec variables manually. ++ ++finishMode: ++ It has meaning only if the decoding reaches output limit (*destLen). ++ LZMA_FINISH_ANY - Decode just destLen bytes. ++ LZMA_FINISH_END - Stream must be finished after (*destLen). ++*/ ++ ++SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, ++ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); ++ ++ ++/* ---------- One Call Interface ---------- */ ++ ++/* LzmaDecode ++ ++finishMode: ++ It has meaning only if the decoding reaches output limit (*destLen). ++ LZMA_FINISH_ANY - Decode just destLen bytes. ++ LZMA_FINISH_END - Stream must be finished after (*destLen). ++ ++Returns: ++ SZ_OK ++ status: ++ LZMA_STATUS_FINISHED_WITH_MARK ++ LZMA_STATUS_NOT_FINISHED ++ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK ++ SZ_ERROR_DATA - Data error ++ SZ_ERROR_MEM - Memory allocation error ++ SZ_ERROR_UNSUPPORTED - Unsupported properties ++ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). ++*/ ++ ++SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ++ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ++ ELzmaStatus *status, ISzAlloc *alloc); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/lzma/LzmaEnc.h +@@ -0,0 +1,80 @@ ++/* LzmaEnc.h -- LZMA Encoder ++2009-02-07 : Igor Pavlov : Public domain */ ++ ++#ifndef __LZMA_ENC_H ++#define __LZMA_ENC_H ++ ++#include "Types.h" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#define LZMA_PROPS_SIZE 5 ++ ++typedef struct _CLzmaEncProps ++{ ++ int level; /* 0 <= level <= 9 */ ++ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version ++ (1 << 12) <= dictSize <= (1 << 30) for 64-bit version ++ default = (1 << 24) */ ++ int lc; /* 0 <= lc <= 8, default = 3 */ ++ int lp; /* 0 <= lp <= 4, default = 0 */ ++ int pb; /* 0 <= pb <= 4, default = 2 */ ++ int algo; /* 0 - fast, 1 - normal, default = 1 */ ++ int fb; /* 5 <= fb <= 273, default = 32 */ ++ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ ++ int numHashBytes; /* 2, 3 or 4, default = 4 */ ++ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ ++ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ ++ int numThreads; /* 1 or 2, default = 2 */ ++} CLzmaEncProps; ++ ++void LzmaEncProps_Init(CLzmaEncProps *p); ++void LzmaEncProps_Normalize(CLzmaEncProps *p); ++UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); ++ ++ ++/* ---------- CLzmaEncHandle Interface ---------- */ ++ ++/* LzmaEnc_* functions can return the following exit codes: ++Returns: ++ SZ_OK - OK ++ SZ_ERROR_MEM - Memory allocation error ++ SZ_ERROR_PARAM - Incorrect paramater in props ++ SZ_ERROR_WRITE - Write callback error. ++ SZ_ERROR_PROGRESS - some break from progress callback ++ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) ++*/ ++ ++typedef void * CLzmaEncHandle; ++ ++CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); ++void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); ++SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); ++SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); ++SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, ++ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); ++SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, ++ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); ++ ++/* ---------- One Call Interface ---------- */ ++ ++/* LzmaEncode ++Return code: ++ SZ_OK - OK ++ SZ_ERROR_MEM - Memory allocation error ++ SZ_ERROR_PARAM - Incorrect paramater ++ SZ_ERROR_OUTPUT_EOF - output buffer overflow ++ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) ++*/ ++ ++SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, ++ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, ++ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/lzma/Types.h +@@ -0,0 +1,226 @@ ++/* Types.h -- Basic types ++2009-11-23 : Igor Pavlov : Public domain */ ++ ++#ifndef __7Z_TYPES_H ++#define __7Z_TYPES_H ++ ++#include ++ ++#ifdef _WIN32 ++#include ++#endif ++ ++#ifndef EXTERN_C_BEGIN ++#ifdef __cplusplus ++#define EXTERN_C_BEGIN extern "C" { ++#define EXTERN_C_END } ++#else ++#define EXTERN_C_BEGIN ++#define EXTERN_C_END ++#endif ++#endif ++ ++EXTERN_C_BEGIN ++ ++#define SZ_OK 0 ++ ++#define SZ_ERROR_DATA 1 ++#define SZ_ERROR_MEM 2 ++#define SZ_ERROR_CRC 3 ++#define SZ_ERROR_UNSUPPORTED 4 ++#define SZ_ERROR_PARAM 5 ++#define SZ_ERROR_INPUT_EOF 6 ++#define SZ_ERROR_OUTPUT_EOF 7 ++#define SZ_ERROR_READ 8 ++#define SZ_ERROR_WRITE 9 ++#define SZ_ERROR_PROGRESS 10 ++#define SZ_ERROR_FAIL 11 ++#define SZ_ERROR_THREAD 12 ++ ++#define SZ_ERROR_ARCHIVE 16 ++#define SZ_ERROR_NO_ARCHIVE 17 ++ ++typedef int SRes; ++ ++#ifdef _WIN32 ++typedef DWORD WRes; ++#else ++typedef int WRes; ++#endif ++ ++#ifndef RINOK ++#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } ++#endif ++ ++typedef unsigned char Byte; ++typedef short Int16; ++typedef unsigned short UInt16; ++ ++#ifdef _LZMA_UINT32_IS_ULONG ++typedef long Int32; ++typedef unsigned long UInt32; ++#else ++typedef int Int32; ++typedef unsigned int UInt32; ++#endif ++ ++#ifdef _SZ_NO_INT_64 ++ ++/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. ++ NOTES: Some code will work incorrectly in that case! */ ++ ++typedef long Int64; ++typedef unsigned long UInt64; ++ ++#else ++ ++#if defined(_MSC_VER) || defined(__BORLANDC__) ++typedef __int64 Int64; ++typedef unsigned __int64 UInt64; ++#else ++typedef long long int Int64; ++typedef unsigned long long int UInt64; ++#endif ++ ++#endif ++ ++#ifdef _LZMA_NO_SYSTEM_SIZE_T ++typedef UInt32 SizeT; ++#else ++typedef size_t SizeT; ++#endif ++ ++typedef int Bool; ++#define True 1 ++#define False 0 ++ ++ ++#ifdef _WIN32 ++#define MY_STD_CALL __stdcall ++#else ++#define MY_STD_CALL ++#endif ++ ++#ifdef _MSC_VER ++ ++#if _MSC_VER >= 1300 ++#define MY_NO_INLINE __declspec(noinline) ++#else ++#define MY_NO_INLINE ++#endif ++ ++#define MY_CDECL __cdecl ++#define MY_FAST_CALL __fastcall ++ ++#else ++ ++#define MY_CDECL ++#define MY_FAST_CALL ++ ++#endif ++ ++ ++/* The following interfaces use first parameter as pointer to structure */ ++ ++typedef struct ++{ ++ SRes (*Read)(void *p, void *buf, size_t *size); ++ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. ++ (output(*size) < input(*size)) is allowed */ ++} ISeqInStream; ++ ++/* it can return SZ_ERROR_INPUT_EOF */ ++SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); ++SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); ++SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); ++ ++typedef struct ++{ ++ size_t (*Write)(void *p, const void *buf, size_t size); ++ /* Returns: result - the number of actually written bytes. ++ (result < size) means error */ ++} ISeqOutStream; ++ ++typedef enum ++{ ++ SZ_SEEK_SET = 0, ++ SZ_SEEK_CUR = 1, ++ SZ_SEEK_END = 2 ++} ESzSeek; ++ ++typedef struct ++{ ++ SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ ++ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); ++} ISeekInStream; ++ ++typedef struct ++{ ++ SRes (*Look)(void *p, void **buf, size_t *size); ++ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. ++ (output(*size) > input(*size)) is not allowed ++ (output(*size) < input(*size)) is allowed */ ++ SRes (*Skip)(void *p, size_t offset); ++ /* offset must be <= output(*size) of Look */ ++ ++ SRes (*Read)(void *p, void *buf, size_t *size); ++ /* reads directly (without buffer). It's same as ISeqInStream::Read */ ++ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); ++} ILookInStream; ++ ++SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); ++SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); ++ ++/* reads via ILookInStream::Read */ ++SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); ++SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); ++ ++#define LookToRead_BUF_SIZE (1 << 14) ++ ++typedef struct ++{ ++ ILookInStream s; ++ ISeekInStream *realStream; ++ size_t pos; ++ size_t size; ++ Byte buf[LookToRead_BUF_SIZE]; ++} CLookToRead; ++ ++void LookToRead_CreateVTable(CLookToRead *p, int lookahead); ++void LookToRead_Init(CLookToRead *p); ++ ++typedef struct ++{ ++ ISeqInStream s; ++ ILookInStream *realStream; ++} CSecToLook; ++ ++void SecToLook_CreateVTable(CSecToLook *p); ++ ++typedef struct ++{ ++ ISeqInStream s; ++ ILookInStream *realStream; ++} CSecToRead; ++ ++void SecToRead_CreateVTable(CSecToRead *p); ++ ++typedef struct ++{ ++ SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); ++ /* Returns: result. (result != SZ_OK) means break. ++ Value (UInt64)(Int64)-1 for size means unknown value. */ ++} ICompressProgress; ++ ++typedef struct ++{ ++ void *(*Alloc)(void *p, size_t size); ++ void (*Free)(void *p, void *address); /* address can be 0 */ ++} ISzAlloc; ++ ++#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) ++#define IAlloc_Free(p, a) (p)->Free((p), a) ++ ++EXTERN_C_END ++ ++#endif +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -227,6 +227,12 @@ config LZ4_DECOMPRESS + + source "lib/xz/Kconfig" + ++config LZMA_COMPRESS ++ tristate ++ ++config LZMA_DECOMPRESS ++ tristate ++ + # + # These all provide a common interface (hence the apparent duplication with + # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -2,6 +2,16 @@ + # Makefile for some libs needed in the kernel. + # + ++ifdef CONFIG_JFFS2_ZLIB ++ CONFIG_ZLIB_INFLATE:=y ++ CONFIG_ZLIB_DEFLATE:=y ++endif ++ ++ifdef CONFIG_JFFS2_LZMA ++ CONFIG_LZMA_DECOMPRESS:=y ++ CONFIG_LZMA_COMPRESS:=y ++endif ++ + ifdef CONFIG_FUNCTION_TRACER + ORIG_CFLAGS := $(KBUILD_CFLAGS) + KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) +@@ -85,6 +95,8 @@ obj-$(CONFIG_LZ4HC_COMPRESS) += lz4/ + obj-$(CONFIG_LZ4_DECOMPRESS) += lz4/ + obj-$(CONFIG_XZ_DEC) += xz/ + obj-$(CONFIG_RAID6_PQ) += raid6/ ++obj-$(CONFIG_LZMA_COMPRESS) += lzma/ ++obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ + + lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o + lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o +--- /dev/null ++++ b/lib/lzma/LzFind.c +@@ -0,0 +1,761 @@ ++/* LzFind.c -- Match finder for LZ algorithms ++2009-04-22 : Igor Pavlov : Public domain */ ++ ++#include ++ ++#include "LzFind.h" ++#include "LzHash.h" ++ ++#define kEmptyHashValue 0 ++#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) ++#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ ++#define kNormalizeMask (~(kNormalizeStepMin - 1)) ++#define kMaxHistorySize ((UInt32)3 << 30) ++ ++#define kStartMaxLen 3 ++ ++static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) ++{ ++ if (!p->directInput) ++ { ++ alloc->Free(alloc, p->bufferBase); ++ p->bufferBase = 0; ++ } ++} ++ ++/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ ++ ++static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) ++{ ++ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; ++ if (p->directInput) ++ { ++ p->blockSize = blockSize; ++ return 1; ++ } ++ if (p->bufferBase == 0 || p->blockSize != blockSize) ++ { ++ LzInWindow_Free(p, alloc); ++ p->blockSize = blockSize; ++ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); ++ } ++ return (p->bufferBase != 0); ++} ++ ++Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } ++Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } ++ ++UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } ++ ++void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) ++{ ++ p->posLimit -= subValue; ++ p->pos -= subValue; ++ p->streamPos -= subValue; ++} ++ ++static void MatchFinder_ReadBlock(CMatchFinder *p) ++{ ++ if (p->streamEndWasReached || p->result != SZ_OK) ++ return; ++ if (p->directInput) ++ { ++ UInt32 curSize = 0xFFFFFFFF - p->streamPos; ++ if (curSize > p->directInputRem) ++ curSize = (UInt32)p->directInputRem; ++ p->directInputRem -= curSize; ++ p->streamPos += curSize; ++ if (p->directInputRem == 0) ++ p->streamEndWasReached = 1; ++ return; ++ } ++ for (;;) ++ { ++ Byte *dest = p->buffer + (p->streamPos - p->pos); ++ size_t size = (p->bufferBase + p->blockSize - dest); ++ if (size == 0) ++ return; ++ p->result = p->stream->Read(p->stream, dest, &size); ++ if (p->result != SZ_OK) ++ return; ++ if (size == 0) ++ { ++ p->streamEndWasReached = 1; ++ return; ++ } ++ p->streamPos += (UInt32)size; ++ if (p->streamPos - p->pos > p->keepSizeAfter) ++ return; ++ } ++} ++ ++void MatchFinder_MoveBlock(CMatchFinder *p) ++{ ++ memmove(p->bufferBase, ++ p->buffer - p->keepSizeBefore, ++ (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); ++ p->buffer = p->bufferBase + p->keepSizeBefore; ++} ++ ++int MatchFinder_NeedMove(CMatchFinder *p) ++{ ++ if (p->directInput) ++ return 0; ++ /* if (p->streamEndWasReached) return 0; */ ++ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); ++} ++ ++void MatchFinder_ReadIfRequired(CMatchFinder *p) ++{ ++ if (p->streamEndWasReached) ++ return; ++ if (p->keepSizeAfter >= p->streamPos - p->pos) ++ MatchFinder_ReadBlock(p); ++} ++ ++static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) ++{ ++ if (MatchFinder_NeedMove(p)) ++ MatchFinder_MoveBlock(p); ++ MatchFinder_ReadBlock(p); ++} ++ ++static void MatchFinder_SetDefaultSettings(CMatchFinder *p) ++{ ++ p->cutValue = 32; ++ p->btMode = 1; ++ p->numHashBytes = 4; ++ p->bigHash = 0; ++} ++ ++#define kCrcPoly 0xEDB88320 ++ ++void MatchFinder_Construct(CMatchFinder *p) ++{ ++ UInt32 i; ++ p->bufferBase = 0; ++ p->directInput = 0; ++ p->hash = 0; ++ MatchFinder_SetDefaultSettings(p); ++ ++ for (i = 0; i < 256; i++) ++ { ++ UInt32 r = i; ++ int j; ++ for (j = 0; j < 8; j++) ++ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); ++ p->crc[i] = r; ++ } ++} ++ ++static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) ++{ ++ alloc->Free(alloc, p->hash); ++ p->hash = 0; ++} ++ ++void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) ++{ ++ MatchFinder_FreeThisClassMemory(p, alloc); ++ LzInWindow_Free(p, alloc); ++} ++ ++static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) ++{ ++ size_t sizeInBytes = (size_t)num * sizeof(CLzRef); ++ if (sizeInBytes / sizeof(CLzRef) != num) ++ return 0; ++ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); ++} ++ ++int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, ++ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ++ ISzAlloc *alloc) ++{ ++ UInt32 sizeReserv; ++ if (historySize > kMaxHistorySize) ++ { ++ MatchFinder_Free(p, alloc); ++ return 0; ++ } ++ sizeReserv = historySize >> 1; ++ if (historySize > ((UInt32)2 << 30)) ++ sizeReserv = historySize >> 2; ++ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); ++ ++ p->keepSizeBefore = historySize + keepAddBufferBefore + 1; ++ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; ++ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ ++ if (LzInWindow_Create(p, sizeReserv, alloc)) ++ { ++ UInt32 newCyclicBufferSize = historySize + 1; ++ UInt32 hs; ++ p->matchMaxLen = matchMaxLen; ++ { ++ p->fixedHashSize = 0; ++ if (p->numHashBytes == 2) ++ hs = (1 << 16) - 1; ++ else ++ { ++ hs = historySize - 1; ++ hs |= (hs >> 1); ++ hs |= (hs >> 2); ++ hs |= (hs >> 4); ++ hs |= (hs >> 8); ++ hs >>= 1; ++ hs |= 0xFFFF; /* don't change it! It's required for Deflate */ ++ if (hs > (1 << 24)) ++ { ++ if (p->numHashBytes == 3) ++ hs = (1 << 24) - 1; ++ else ++ hs >>= 1; ++ } ++ } ++ p->hashMask = hs; ++ hs++; ++ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; ++ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; ++ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; ++ hs += p->fixedHashSize; ++ } ++ ++ { ++ UInt32 prevSize = p->hashSizeSum + p->numSons; ++ UInt32 newSize; ++ p->historySize = historySize; ++ p->hashSizeSum = hs; ++ p->cyclicBufferSize = newCyclicBufferSize; ++ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); ++ newSize = p->hashSizeSum + p->numSons; ++ if (p->hash != 0 && prevSize == newSize) ++ return 1; ++ MatchFinder_FreeThisClassMemory(p, alloc); ++ p->hash = AllocRefs(newSize, alloc); ++ if (p->hash != 0) ++ { ++ p->son = p->hash + p->hashSizeSum; ++ return 1; ++ } ++ } ++ } ++ MatchFinder_Free(p, alloc); ++ return 0; ++} ++ ++static void MatchFinder_SetLimits(CMatchFinder *p) ++{ ++ UInt32 limit = kMaxValForNormalize - p->pos; ++ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; ++ if (limit2 < limit) ++ limit = limit2; ++ limit2 = p->streamPos - p->pos; ++ if (limit2 <= p->keepSizeAfter) ++ { ++ if (limit2 > 0) ++ limit2 = 1; ++ } ++ else ++ limit2 -= p->keepSizeAfter; ++ if (limit2 < limit) ++ limit = limit2; ++ { ++ UInt32 lenLimit = p->streamPos - p->pos; ++ if (lenLimit > p->matchMaxLen) ++ lenLimit = p->matchMaxLen; ++ p->lenLimit = lenLimit; ++ } ++ p->posLimit = p->pos + limit; ++} ++ ++void MatchFinder_Init(CMatchFinder *p) ++{ ++ UInt32 i; ++ for (i = 0; i < p->hashSizeSum; i++) ++ p->hash[i] = kEmptyHashValue; ++ p->cyclicBufferPos = 0; ++ p->buffer = p->bufferBase; ++ p->pos = p->streamPos = p->cyclicBufferSize; ++ p->result = SZ_OK; ++ p->streamEndWasReached = 0; ++ MatchFinder_ReadBlock(p); ++ MatchFinder_SetLimits(p); ++} ++ ++static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) ++{ ++ return (p->pos - p->historySize - 1) & kNormalizeMask; ++} ++ ++void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) ++{ ++ UInt32 i; ++ for (i = 0; i < numItems; i++) ++ { ++ UInt32 value = items[i]; ++ if (value <= subValue) ++ value = kEmptyHashValue; ++ else ++ value -= subValue; ++ items[i] = value; ++ } ++} ++ ++static void MatchFinder_Normalize(CMatchFinder *p) ++{ ++ UInt32 subValue = MatchFinder_GetSubValue(p); ++ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); ++ MatchFinder_ReduceOffsets(p, subValue); ++} ++ ++static void MatchFinder_CheckLimits(CMatchFinder *p) ++{ ++ if (p->pos == kMaxValForNormalize) ++ MatchFinder_Normalize(p); ++ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) ++ MatchFinder_CheckAndMoveAndRead(p); ++ if (p->cyclicBufferPos == p->cyclicBufferSize) ++ p->cyclicBufferPos = 0; ++ MatchFinder_SetLimits(p); ++} ++ ++static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, ++ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, ++ UInt32 *distances, UInt32 maxLen) ++{ ++ son[_cyclicBufferPos] = curMatch; ++ for (;;) ++ { ++ UInt32 delta = pos - curMatch; ++ if (cutValue-- == 0 || delta >= _cyclicBufferSize) ++ return distances; ++ { ++ const Byte *pb = cur - delta; ++ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; ++ if (pb[maxLen] == cur[maxLen] && *pb == *cur) ++ { ++ UInt32 len = 0; ++ while (++len != lenLimit) ++ if (pb[len] != cur[len]) ++ break; ++ if (maxLen < len) ++ { ++ *distances++ = maxLen = len; ++ *distances++ = delta - 1; ++ if (len == lenLimit) ++ return distances; ++ } ++ } ++ } ++ } ++} ++ ++UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, ++ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, ++ UInt32 *distances, UInt32 maxLen) ++{ ++ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; ++ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); ++ UInt32 len0 = 0, len1 = 0; ++ for (;;) ++ { ++ UInt32 delta = pos - curMatch; ++ if (cutValue-- == 0 || delta >= _cyclicBufferSize) ++ { ++ *ptr0 = *ptr1 = kEmptyHashValue; ++ return distances; ++ } ++ { ++ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); ++ const Byte *pb = cur - delta; ++ UInt32 len = (len0 < len1 ? len0 : len1); ++ if (pb[len] == cur[len]) ++ { ++ if (++len != lenLimit && pb[len] == cur[len]) ++ while (++len != lenLimit) ++ if (pb[len] != cur[len]) ++ break; ++ if (maxLen < len) ++ { ++ *distances++ = maxLen = len; ++ *distances++ = delta - 1; ++ if (len == lenLimit) ++ { ++ *ptr1 = pair[0]; ++ *ptr0 = pair[1]; ++ return distances; ++ } ++ } ++ } ++ if (pb[len] < cur[len]) ++ { ++ *ptr1 = curMatch; ++ ptr1 = pair + 1; ++ curMatch = *ptr1; ++ len1 = len; ++ } ++ else ++ { ++ *ptr0 = curMatch; ++ ptr0 = pair; ++ curMatch = *ptr0; ++ len0 = len; ++ } ++ } ++ } ++} ++ ++static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, ++ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) ++{ ++ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; ++ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); ++ UInt32 len0 = 0, len1 = 0; ++ for (;;) ++ { ++ UInt32 delta = pos - curMatch; ++ if (cutValue-- == 0 || delta >= _cyclicBufferSize) ++ { ++ *ptr0 = *ptr1 = kEmptyHashValue; ++ return; ++ } ++ { ++ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); ++ const Byte *pb = cur - delta; ++ UInt32 len = (len0 < len1 ? len0 : len1); ++ if (pb[len] == cur[len]) ++ { ++ while (++len != lenLimit) ++ if (pb[len] != cur[len]) ++ break; ++ { ++ if (len == lenLimit) ++ { ++ *ptr1 = pair[0]; ++ *ptr0 = pair[1]; ++ return; ++ } ++ } ++ } ++ if (pb[len] < cur[len]) ++ { ++ *ptr1 = curMatch; ++ ptr1 = pair + 1; ++ curMatch = *ptr1; ++ len1 = len; ++ } ++ else ++ { ++ *ptr0 = curMatch; ++ ptr0 = pair; ++ curMatch = *ptr0; ++ len0 = len; ++ } ++ } ++ } ++} ++ ++#define MOVE_POS \ ++ ++p->cyclicBufferPos; \ ++ p->buffer++; \ ++ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); ++ ++#define MOVE_POS_RET MOVE_POS return offset; ++ ++static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } ++ ++#define GET_MATCHES_HEADER2(minLen, ret_op) \ ++ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ ++ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ ++ cur = p->buffer; ++ ++#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) ++#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) ++ ++#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue ++ ++#define GET_MATCHES_FOOTER(offset, maxLen) \ ++ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ ++ distances + offset, maxLen) - distances); MOVE_POS_RET; ++ ++#define SKIP_FOOTER \ ++ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; ++ ++static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) ++{ ++ UInt32 offset; ++ GET_MATCHES_HEADER(2) ++ HASH2_CALC; ++ curMatch = p->hash[hashValue]; ++ p->hash[hashValue] = p->pos; ++ offset = 0; ++ GET_MATCHES_FOOTER(offset, 1) ++} ++ ++UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) ++{ ++ UInt32 offset; ++ GET_MATCHES_HEADER(3) ++ HASH_ZIP_CALC; ++ curMatch = p->hash[hashValue]; ++ p->hash[hashValue] = p->pos; ++ offset = 0; ++ GET_MATCHES_FOOTER(offset, 2) ++} ++ ++static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) ++{ ++ UInt32 hash2Value, delta2, maxLen, offset; ++ GET_MATCHES_HEADER(3) ++ ++ HASH3_CALC; ++ ++ delta2 = p->pos - p->hash[hash2Value]; ++ curMatch = p->hash[kFix3HashSize + hashValue]; ++ ++ p->hash[hash2Value] = ++ p->hash[kFix3HashSize + hashValue] = p->pos; ++ ++ ++ maxLen = 2; ++ offset = 0; ++ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) ++ { ++ for (; maxLen != lenLimit; maxLen++) ++ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) ++ break; ++ distances[0] = maxLen; ++ distances[1] = delta2 - 1; ++ offset = 2; ++ if (maxLen == lenLimit) ++ { ++ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); ++ MOVE_POS_RET; ++ } ++ } ++ GET_MATCHES_FOOTER(offset, maxLen) ++} ++ ++static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) ++{ ++ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; ++ GET_MATCHES_HEADER(4) ++ ++ HASH4_CALC; ++ ++ delta2 = p->pos - p->hash[ hash2Value]; ++ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; ++ curMatch = p->hash[kFix4HashSize + hashValue]; ++ ++ p->hash[ hash2Value] = ++ p->hash[kFix3HashSize + hash3Value] = ++ p->hash[kFix4HashSize + hashValue] = p->pos; ++ ++ maxLen = 1; ++ offset = 0; ++ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) ++ { ++ distances[0] = maxLen = 2; ++ distances[1] = delta2 - 1; ++ offset = 2; ++ } ++ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) ++ { ++ maxLen = 3; ++ distances[offset + 1] = delta3 - 1; ++ offset += 2; ++ delta2 = delta3; ++ } ++ if (offset != 0) ++ { ++ for (; maxLen != lenLimit; maxLen++) ++ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) ++ break; ++ distances[offset - 2] = maxLen; ++ if (maxLen == lenLimit) ++ { ++ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); ++ MOVE_POS_RET; ++ } ++ } ++ if (maxLen < 3) ++ maxLen = 3; ++ GET_MATCHES_FOOTER(offset, maxLen) ++} ++ ++static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) ++{ ++ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; ++ GET_MATCHES_HEADER(4) ++ ++ HASH4_CALC; ++ ++ delta2 = p->pos - p->hash[ hash2Value]; ++ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; ++ curMatch = p->hash[kFix4HashSize + hashValue]; ++ ++ p->hash[ hash2Value] = ++ p->hash[kFix3HashSize + hash3Value] = ++ p->hash[kFix4HashSize + hashValue] = p->pos; ++ ++ maxLen = 1; ++ offset = 0; ++ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) ++ { ++ distances[0] = maxLen = 2; ++ distances[1] = delta2 - 1; ++ offset = 2; ++ } ++ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) ++ { ++ maxLen = 3; ++ distances[offset + 1] = delta3 - 1; ++ offset += 2; ++ delta2 = delta3; ++ } ++ if (offset != 0) ++ { ++ for (; maxLen != lenLimit; maxLen++) ++ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) ++ break; ++ distances[offset - 2] = maxLen; ++ if (maxLen == lenLimit) ++ { ++ p->son[p->cyclicBufferPos] = curMatch; ++ MOVE_POS_RET; ++ } ++ } ++ if (maxLen < 3) ++ maxLen = 3; ++ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), ++ distances + offset, maxLen) - (distances)); ++ MOVE_POS_RET ++} ++ ++UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) ++{ ++ UInt32 offset; ++ GET_MATCHES_HEADER(3) ++ HASH_ZIP_CALC; ++ curMatch = p->hash[hashValue]; ++ p->hash[hashValue] = p->pos; ++ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), ++ distances, 2) - (distances)); ++ MOVE_POS_RET ++} ++ ++static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) ++{ ++ do ++ { ++ SKIP_HEADER(2) ++ HASH2_CALC; ++ curMatch = p->hash[hashValue]; ++ p->hash[hashValue] = p->pos; ++ SKIP_FOOTER ++ } ++ while (--num != 0); ++} ++ ++void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) ++{ ++ do ++ { ++ SKIP_HEADER(3) ++ HASH_ZIP_CALC; ++ curMatch = p->hash[hashValue]; ++ p->hash[hashValue] = p->pos; ++ SKIP_FOOTER ++ } ++ while (--num != 0); ++} ++ ++static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) ++{ ++ do ++ { ++ UInt32 hash2Value; ++ SKIP_HEADER(3) ++ HASH3_CALC; ++ curMatch = p->hash[kFix3HashSize + hashValue]; ++ p->hash[hash2Value] = ++ p->hash[kFix3HashSize + hashValue] = p->pos; ++ SKIP_FOOTER ++ } ++ while (--num != 0); ++} ++ ++static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) ++{ ++ do ++ { ++ UInt32 hash2Value, hash3Value; ++ SKIP_HEADER(4) ++ HASH4_CALC; ++ curMatch = p->hash[kFix4HashSize + hashValue]; ++ p->hash[ hash2Value] = ++ p->hash[kFix3HashSize + hash3Value] = p->pos; ++ p->hash[kFix4HashSize + hashValue] = p->pos; ++ SKIP_FOOTER ++ } ++ while (--num != 0); ++} ++ ++static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) ++{ ++ do ++ { ++ UInt32 hash2Value, hash3Value; ++ SKIP_HEADER(4) ++ HASH4_CALC; ++ curMatch = p->hash[kFix4HashSize + hashValue]; ++ p->hash[ hash2Value] = ++ p->hash[kFix3HashSize + hash3Value] = ++ p->hash[kFix4HashSize + hashValue] = p->pos; ++ p->son[p->cyclicBufferPos] = curMatch; ++ MOVE_POS ++ } ++ while (--num != 0); ++} ++ ++void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) ++{ ++ do ++ { ++ SKIP_HEADER(3) ++ HASH_ZIP_CALC; ++ curMatch = p->hash[hashValue]; ++ p->hash[hashValue] = p->pos; ++ p->son[p->cyclicBufferPos] = curMatch; ++ MOVE_POS ++ } ++ while (--num != 0); ++} ++ ++void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) ++{ ++ vTable->Init = (Mf_Init_Func)MatchFinder_Init; ++ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; ++ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; ++ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; ++ if (!p->btMode) ++ { ++ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; ++ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; ++ } ++ else if (p->numHashBytes == 2) ++ { ++ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; ++ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; ++ } ++ else if (p->numHashBytes == 3) ++ { ++ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; ++ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; ++ } ++ else ++ { ++ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; ++ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; ++ } ++} +--- /dev/null ++++ b/lib/lzma/LzmaDec.c +@@ -0,0 +1,999 @@ ++/* LzmaDec.c -- LZMA Decoder ++2009-09-20 : Igor Pavlov : Public domain */ ++ ++#include "LzmaDec.h" ++ ++#include ++ ++#define kNumTopBits 24 ++#define kTopValue ((UInt32)1 << kNumTopBits) ++ ++#define kNumBitModelTotalBits 11 ++#define kBitModelTotal (1 << kNumBitModelTotalBits) ++#define kNumMoveBits 5 ++ ++#define RC_INIT_SIZE 5 ++ ++#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } ++ ++#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) ++#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); ++#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); ++#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ ++ { UPDATE_0(p); i = (i + i); A0; } else \ ++ { UPDATE_1(p); i = (i + i) + 1; A1; } ++#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) ++ ++#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } ++#define TREE_DECODE(probs, limit, i) \ ++ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } ++ ++/* #define _LZMA_SIZE_OPT */ ++ ++#ifdef _LZMA_SIZE_OPT ++#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) ++#else ++#define TREE_6_DECODE(probs, i) \ ++ { i = 1; \ ++ TREE_GET_BIT(probs, i); \ ++ TREE_GET_BIT(probs, i); \ ++ TREE_GET_BIT(probs, i); \ ++ TREE_GET_BIT(probs, i); \ ++ TREE_GET_BIT(probs, i); \ ++ TREE_GET_BIT(probs, i); \ ++ i -= 0x40; } ++#endif ++ ++#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } ++ ++#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) ++#define UPDATE_0_CHECK range = bound; ++#define UPDATE_1_CHECK range -= bound; code -= bound; ++#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ ++ { UPDATE_0_CHECK; i = (i + i); A0; } else \ ++ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } ++#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) ++#define TREE_DECODE_CHECK(probs, limit, i) \ ++ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } ++ ++ ++#define kNumPosBitsMax 4 ++#define kNumPosStatesMax (1 << kNumPosBitsMax) ++ ++#define kLenNumLowBits 3 ++#define kLenNumLowSymbols (1 << kLenNumLowBits) ++#define kLenNumMidBits 3 ++#define kLenNumMidSymbols (1 << kLenNumMidBits) ++#define kLenNumHighBits 8 ++#define kLenNumHighSymbols (1 << kLenNumHighBits) ++ ++#define LenChoice 0 ++#define LenChoice2 (LenChoice + 1) ++#define LenLow (LenChoice2 + 1) ++#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) ++#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) ++#define kNumLenProbs (LenHigh + kLenNumHighSymbols) ++ ++ ++#define kNumStates 12 ++#define kNumLitStates 7 ++ ++#define kStartPosModelIndex 4 ++#define kEndPosModelIndex 14 ++#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) ++ ++#define kNumPosSlotBits 6 ++#define kNumLenToPosStates 4 ++ ++#define kNumAlignBits 4 ++#define kAlignTableSize (1 << kNumAlignBits) ++ ++#define kMatchMinLen 2 ++#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) ++ ++#define IsMatch 0 ++#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) ++#define IsRepG0 (IsRep + kNumStates) ++#define IsRepG1 (IsRepG0 + kNumStates) ++#define IsRepG2 (IsRepG1 + kNumStates) ++#define IsRep0Long (IsRepG2 + kNumStates) ++#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) ++#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) ++#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) ++#define LenCoder (Align + kAlignTableSize) ++#define RepLenCoder (LenCoder + kNumLenProbs) ++#define Literal (RepLenCoder + kNumLenProbs) ++ ++#define LZMA_BASE_SIZE 1846 ++#define LZMA_LIT_SIZE 768 ++ ++#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) ++ ++#if Literal != LZMA_BASE_SIZE ++StopCompilingDueBUG ++#endif ++ ++#define LZMA_DIC_MIN (1 << 12) ++ ++/* First LZMA-symbol is always decoded. ++And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization ++Out: ++ Result: ++ SZ_OK - OK ++ SZ_ERROR_DATA - Error ++ p->remainLen: ++ < kMatchSpecLenStart : normal remain ++ = kMatchSpecLenStart : finished ++ = kMatchSpecLenStart + 1 : Flush marker ++ = kMatchSpecLenStart + 2 : State Init Marker ++*/ ++ ++static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) ++{ ++ CLzmaProb *probs = p->probs; ++ ++ unsigned state = p->state; ++ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; ++ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; ++ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; ++ unsigned lc = p->prop.lc; ++ ++ Byte *dic = p->dic; ++ SizeT dicBufSize = p->dicBufSize; ++ SizeT dicPos = p->dicPos; ++ ++ UInt32 processedPos = p->processedPos; ++ UInt32 checkDicSize = p->checkDicSize; ++ unsigned len = 0; ++ ++ const Byte *buf = p->buf; ++ UInt32 range = p->range; ++ UInt32 code = p->code; ++ ++ do ++ { ++ CLzmaProb *prob; ++ UInt32 bound; ++ unsigned ttt; ++ unsigned posState = processedPos & pbMask; ++ ++ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; ++ IF_BIT_0(prob) ++ { ++ unsigned symbol; ++ UPDATE_0(prob); ++ prob = probs + Literal; ++ if (checkDicSize != 0 || processedPos != 0) ++ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + ++ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); ++ ++ if (state < kNumLitStates) ++ { ++ state -= (state < 4) ? state : 3; ++ symbol = 1; ++ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); ++ } ++ else ++ { ++ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; ++ unsigned offs = 0x100; ++ state -= (state < 10) ? 3 : 6; ++ symbol = 1; ++ do ++ { ++ unsigned bit; ++ CLzmaProb *probLit; ++ matchByte <<= 1; ++ bit = (matchByte & offs); ++ probLit = prob + offs + bit + symbol; ++ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) ++ } ++ while (symbol < 0x100); ++ } ++ dic[dicPos++] = (Byte)symbol; ++ processedPos++; ++ continue; ++ } ++ else ++ { ++ UPDATE_1(prob); ++ prob = probs + IsRep + state; ++ IF_BIT_0(prob) ++ { ++ UPDATE_0(prob); ++ state += kNumStates; ++ prob = probs + LenCoder; ++ } ++ else ++ { ++ UPDATE_1(prob); ++ if (checkDicSize == 0 && processedPos == 0) ++ return SZ_ERROR_DATA; ++ prob = probs + IsRepG0 + state; ++ IF_BIT_0(prob) ++ { ++ UPDATE_0(prob); ++ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; ++ IF_BIT_0(prob) ++ { ++ UPDATE_0(prob); ++ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; ++ dicPos++; ++ processedPos++; ++ state = state < kNumLitStates ? 9 : 11; ++ continue; ++ } ++ UPDATE_1(prob); ++ } ++ else ++ { ++ UInt32 distance; ++ UPDATE_1(prob); ++ prob = probs + IsRepG1 + state; ++ IF_BIT_0(prob) ++ { ++ UPDATE_0(prob); ++ distance = rep1; ++ } ++ else ++ { ++ UPDATE_1(prob); ++ prob = probs + IsRepG2 + state; ++ IF_BIT_0(prob) ++ { ++ UPDATE_0(prob); ++ distance = rep2; ++ } ++ else ++ { ++ UPDATE_1(prob); ++ distance = rep3; ++ rep3 = rep2; ++ } ++ rep2 = rep1; ++ } ++ rep1 = rep0; ++ rep0 = distance; ++ } ++ state = state < kNumLitStates ? 8 : 11; ++ prob = probs + RepLenCoder; ++ } ++ { ++ unsigned limit, offset; ++ CLzmaProb *probLen = prob + LenChoice; ++ IF_BIT_0(probLen) ++ { ++ UPDATE_0(probLen); ++ probLen = prob + LenLow + (posState << kLenNumLowBits); ++ offset = 0; ++ limit = (1 << kLenNumLowBits); ++ } ++ else ++ { ++ UPDATE_1(probLen); ++ probLen = prob + LenChoice2; ++ IF_BIT_0(probLen) ++ { ++ UPDATE_0(probLen); ++ probLen = prob + LenMid + (posState << kLenNumMidBits); ++ offset = kLenNumLowSymbols; ++ limit = (1 << kLenNumMidBits); ++ } ++ else ++ { ++ UPDATE_1(probLen); ++ probLen = prob + LenHigh; ++ offset = kLenNumLowSymbols + kLenNumMidSymbols; ++ limit = (1 << kLenNumHighBits); ++ } ++ } ++ TREE_DECODE(probLen, limit, len); ++ len += offset; ++ } ++ ++ if (state >= kNumStates) ++ { ++ UInt32 distance; ++ prob = probs + PosSlot + ++ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); ++ TREE_6_DECODE(prob, distance); ++ if (distance >= kStartPosModelIndex) ++ { ++ unsigned posSlot = (unsigned)distance; ++ int numDirectBits = (int)(((distance >> 1) - 1)); ++ distance = (2 | (distance & 1)); ++ if (posSlot < kEndPosModelIndex) ++ { ++ distance <<= numDirectBits; ++ prob = probs + SpecPos + distance - posSlot - 1; ++ { ++ UInt32 mask = 1; ++ unsigned i = 1; ++ do ++ { ++ GET_BIT2(prob + i, i, ; , distance |= mask); ++ mask <<= 1; ++ } ++ while (--numDirectBits != 0); ++ } ++ } ++ else ++ { ++ numDirectBits -= kNumAlignBits; ++ do ++ { ++ NORMALIZE ++ range >>= 1; ++ ++ { ++ UInt32 t; ++ code -= range; ++ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ ++ distance = (distance << 1) + (t + 1); ++ code += range & t; ++ } ++ /* ++ distance <<= 1; ++ if (code >= range) ++ { ++ code -= range; ++ distance |= 1; ++ } ++ */ ++ } ++ while (--numDirectBits != 0); ++ prob = probs + Align; ++ distance <<= kNumAlignBits; ++ { ++ unsigned i = 1; ++ GET_BIT2(prob + i, i, ; , distance |= 1); ++ GET_BIT2(prob + i, i, ; , distance |= 2); ++ GET_BIT2(prob + i, i, ; , distance |= 4); ++ GET_BIT2(prob + i, i, ; , distance |= 8); ++ } ++ if (distance == (UInt32)0xFFFFFFFF) ++ { ++ len += kMatchSpecLenStart; ++ state -= kNumStates; ++ break; ++ } ++ } ++ } ++ rep3 = rep2; ++ rep2 = rep1; ++ rep1 = rep0; ++ rep0 = distance + 1; ++ if (checkDicSize == 0) ++ { ++ if (distance >= processedPos) ++ return SZ_ERROR_DATA; ++ } ++ else if (distance >= checkDicSize) ++ return SZ_ERROR_DATA; ++ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; ++ } ++ ++ len += kMatchMinLen; ++ ++ if (limit == dicPos) ++ return SZ_ERROR_DATA; ++ { ++ SizeT rem = limit - dicPos; ++ unsigned curLen = ((rem < len) ? (unsigned)rem : len); ++ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); ++ ++ processedPos += curLen; ++ ++ len -= curLen; ++ if (pos + curLen <= dicBufSize) ++ { ++ Byte *dest = dic + dicPos; ++ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; ++ const Byte *lim = dest + curLen; ++ dicPos += curLen; ++ do ++ *(dest) = (Byte)*(dest + src); ++ while (++dest != lim); ++ } ++ else ++ { ++ do ++ { ++ dic[dicPos++] = dic[pos]; ++ if (++pos == dicBufSize) ++ pos = 0; ++ } ++ while (--curLen != 0); ++ } ++ } ++ } ++ } ++ while (dicPos < limit && buf < bufLimit); ++ NORMALIZE; ++ p->buf = buf; ++ p->range = range; ++ p->code = code; ++ p->remainLen = len; ++ p->dicPos = dicPos; ++ p->processedPos = processedPos; ++ p->reps[0] = rep0; ++ p->reps[1] = rep1; ++ p->reps[2] = rep2; ++ p->reps[3] = rep3; ++ p->state = state; ++ ++ return SZ_OK; ++} ++ ++static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) ++{ ++ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) ++ { ++ Byte *dic = p->dic; ++ SizeT dicPos = p->dicPos; ++ SizeT dicBufSize = p->dicBufSize; ++ unsigned len = p->remainLen; ++ UInt32 rep0 = p->reps[0]; ++ if (limit - dicPos < len) ++ len = (unsigned)(limit - dicPos); ++ ++ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) ++ p->checkDicSize = p->prop.dicSize; ++ ++ p->processedPos += len; ++ p->remainLen -= len; ++ while (len-- != 0) ++ { ++ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; ++ dicPos++; ++ } ++ p->dicPos = dicPos; ++ } ++} ++ ++static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) ++{ ++ do ++ { ++ SizeT limit2 = limit; ++ if (p->checkDicSize == 0) ++ { ++ UInt32 rem = p->prop.dicSize - p->processedPos; ++ if (limit - p->dicPos > rem) ++ limit2 = p->dicPos + rem; ++ } ++ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); ++ if (p->processedPos >= p->prop.dicSize) ++ p->checkDicSize = p->prop.dicSize; ++ LzmaDec_WriteRem(p, limit); ++ } ++ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); ++ ++ if (p->remainLen > kMatchSpecLenStart) ++ { ++ p->remainLen = kMatchSpecLenStart; ++ } ++ return 0; ++} ++ ++typedef enum ++{ ++ DUMMY_ERROR, /* unexpected end of input stream */ ++ DUMMY_LIT, ++ DUMMY_MATCH, ++ DUMMY_REP ++} ELzmaDummy; ++ ++static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) ++{ ++ UInt32 range = p->range; ++ UInt32 code = p->code; ++ const Byte *bufLimit = buf + inSize; ++ CLzmaProb *probs = p->probs; ++ unsigned state = p->state; ++ ELzmaDummy res; ++ ++ { ++ CLzmaProb *prob; ++ UInt32 bound; ++ unsigned ttt; ++ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); ++ ++ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; ++ IF_BIT_0_CHECK(prob) ++ { ++ UPDATE_0_CHECK ++ ++ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ ++ ++ prob = probs + Literal; ++ if (p->checkDicSize != 0 || p->processedPos != 0) ++ prob += (LZMA_LIT_SIZE * ++ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + ++ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); ++ ++ if (state < kNumLitStates) ++ { ++ unsigned symbol = 1; ++ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); ++ } ++ else ++ { ++ unsigned matchByte = p->dic[p->dicPos - p->reps[0] + ++ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; ++ unsigned offs = 0x100; ++ unsigned symbol = 1; ++ do ++ { ++ unsigned bit; ++ CLzmaProb *probLit; ++ matchByte <<= 1; ++ bit = (matchByte & offs); ++ probLit = prob + offs + bit + symbol; ++ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) ++ } ++ while (symbol < 0x100); ++ } ++ res = DUMMY_LIT; ++ } ++ else ++ { ++ unsigned len; ++ UPDATE_1_CHECK; ++ ++ prob = probs + IsRep + state; ++ IF_BIT_0_CHECK(prob) ++ { ++ UPDATE_0_CHECK; ++ state = 0; ++ prob = probs + LenCoder; ++ res = DUMMY_MATCH; ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ res = DUMMY_REP; ++ prob = probs + IsRepG0 + state; ++ IF_BIT_0_CHECK(prob) ++ { ++ UPDATE_0_CHECK; ++ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; ++ IF_BIT_0_CHECK(prob) ++ { ++ UPDATE_0_CHECK; ++ NORMALIZE_CHECK; ++ return DUMMY_REP; ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ } ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ prob = probs + IsRepG1 + state; ++ IF_BIT_0_CHECK(prob) ++ { ++ UPDATE_0_CHECK; ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ prob = probs + IsRepG2 + state; ++ IF_BIT_0_CHECK(prob) ++ { ++ UPDATE_0_CHECK; ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ } ++ } ++ } ++ state = kNumStates; ++ prob = probs + RepLenCoder; ++ } ++ { ++ unsigned limit, offset; ++ CLzmaProb *probLen = prob + LenChoice; ++ IF_BIT_0_CHECK(probLen) ++ { ++ UPDATE_0_CHECK; ++ probLen = prob + LenLow + (posState << kLenNumLowBits); ++ offset = 0; ++ limit = 1 << kLenNumLowBits; ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ probLen = prob + LenChoice2; ++ IF_BIT_0_CHECK(probLen) ++ { ++ UPDATE_0_CHECK; ++ probLen = prob + LenMid + (posState << kLenNumMidBits); ++ offset = kLenNumLowSymbols; ++ limit = 1 << kLenNumMidBits; ++ } ++ else ++ { ++ UPDATE_1_CHECK; ++ probLen = prob + LenHigh; ++ offset = kLenNumLowSymbols + kLenNumMidSymbols; ++ limit = 1 << kLenNumHighBits; ++ } ++ } ++ TREE_DECODE_CHECK(probLen, limit, len); ++ len += offset; ++ } ++ ++ if (state < 4) ++ { ++ unsigned posSlot; ++ prob = probs + PosSlot + ++ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << ++ kNumPosSlotBits); ++ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); ++ if (posSlot >= kStartPosModelIndex) ++ { ++ int numDirectBits = ((posSlot >> 1) - 1); ++ ++ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ ++ ++ if (posSlot < kEndPosModelIndex) ++ { ++ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; ++ } ++ else ++ { ++ numDirectBits -= kNumAlignBits; ++ do ++ { ++ NORMALIZE_CHECK ++ range >>= 1; ++ code -= range & (((code - range) >> 31) - 1); ++ /* if (code >= range) code -= range; */ ++ } ++ while (--numDirectBits != 0); ++ prob = probs + Align; ++ numDirectBits = kNumAlignBits; ++ } ++ { ++ unsigned i = 1; ++ do ++ { ++ GET_BIT_CHECK(prob + i, i); ++ } ++ while (--numDirectBits != 0); ++ } ++ } ++ } ++ } ++ } ++ NORMALIZE_CHECK; ++ return res; ++} ++ ++ ++static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) ++{ ++ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); ++ p->range = 0xFFFFFFFF; ++ p->needFlush = 0; ++} ++ ++void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) ++{ ++ p->needFlush = 1; ++ p->remainLen = 0; ++ p->tempBufSize = 0; ++ ++ if (initDic) ++ { ++ p->processedPos = 0; ++ p->checkDicSize = 0; ++ p->needInitState = 1; ++ } ++ if (initState) ++ p->needInitState = 1; ++} ++ ++void LzmaDec_Init(CLzmaDec *p) ++{ ++ p->dicPos = 0; ++ LzmaDec_InitDicAndState(p, True, True); ++} ++ ++static void LzmaDec_InitStateReal(CLzmaDec *p) ++{ ++ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); ++ UInt32 i; ++ CLzmaProb *probs = p->probs; ++ for (i = 0; i < numProbs; i++) ++ probs[i] = kBitModelTotal >> 1; ++ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; ++ p->state = 0; ++ p->needInitState = 0; ++} ++ ++SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ++ ELzmaFinishMode finishMode, ELzmaStatus *status) ++{ ++ SizeT inSize = *srcLen; ++ (*srcLen) = 0; ++ LzmaDec_WriteRem(p, dicLimit); ++ ++ *status = LZMA_STATUS_NOT_SPECIFIED; ++ ++ while (p->remainLen != kMatchSpecLenStart) ++ { ++ int checkEndMarkNow; ++ ++ if (p->needFlush != 0) ++ { ++ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) ++ p->tempBuf[p->tempBufSize++] = *src++; ++ if (p->tempBufSize < RC_INIT_SIZE) ++ { ++ *status = LZMA_STATUS_NEEDS_MORE_INPUT; ++ return SZ_OK; ++ } ++ if (p->tempBuf[0] != 0) ++ return SZ_ERROR_DATA; ++ ++ LzmaDec_InitRc(p, p->tempBuf); ++ p->tempBufSize = 0; ++ } ++ ++ checkEndMarkNow = 0; ++ if (p->dicPos >= dicLimit) ++ { ++ if (p->remainLen == 0 && p->code == 0) ++ { ++ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; ++ return SZ_OK; ++ } ++ if (finishMode == LZMA_FINISH_ANY) ++ { ++ *status = LZMA_STATUS_NOT_FINISHED; ++ return SZ_OK; ++ } ++ if (p->remainLen != 0) ++ { ++ *status = LZMA_STATUS_NOT_FINISHED; ++ return SZ_ERROR_DATA; ++ } ++ checkEndMarkNow = 1; ++ } ++ ++ if (p->needInitState) ++ LzmaDec_InitStateReal(p); ++ ++ if (p->tempBufSize == 0) ++ { ++ SizeT processed; ++ const Byte *bufLimit; ++ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) ++ { ++ int dummyRes = LzmaDec_TryDummy(p, src, inSize); ++ if (dummyRes == DUMMY_ERROR) ++ { ++ memcpy(p->tempBuf, src, inSize); ++ p->tempBufSize = (unsigned)inSize; ++ (*srcLen) += inSize; ++ *status = LZMA_STATUS_NEEDS_MORE_INPUT; ++ return SZ_OK; ++ } ++ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) ++ { ++ *status = LZMA_STATUS_NOT_FINISHED; ++ return SZ_ERROR_DATA; ++ } ++ bufLimit = src; ++ } ++ else ++ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; ++ p->buf = src; ++ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) ++ return SZ_ERROR_DATA; ++ processed = (SizeT)(p->buf - src); ++ (*srcLen) += processed; ++ src += processed; ++ inSize -= processed; ++ } ++ else ++ { ++ unsigned rem = p->tempBufSize, lookAhead = 0; ++ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) ++ p->tempBuf[rem++] = src[lookAhead++]; ++ p->tempBufSize = rem; ++ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) ++ { ++ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); ++ if (dummyRes == DUMMY_ERROR) ++ { ++ (*srcLen) += lookAhead; ++ *status = LZMA_STATUS_NEEDS_MORE_INPUT; ++ return SZ_OK; ++ } ++ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) ++ { ++ *status = LZMA_STATUS_NOT_FINISHED; ++ return SZ_ERROR_DATA; ++ } ++ } ++ p->buf = p->tempBuf; ++ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) ++ return SZ_ERROR_DATA; ++ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); ++ (*srcLen) += lookAhead; ++ src += lookAhead; ++ inSize -= lookAhead; ++ p->tempBufSize = 0; ++ } ++ } ++ if (p->code == 0) ++ *status = LZMA_STATUS_FINISHED_WITH_MARK; ++ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; ++} ++ ++SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) ++{ ++ SizeT outSize = *destLen; ++ SizeT inSize = *srcLen; ++ *srcLen = *destLen = 0; ++ for (;;) ++ { ++ SizeT inSizeCur = inSize, outSizeCur, dicPos; ++ ELzmaFinishMode curFinishMode; ++ SRes res; ++ if (p->dicPos == p->dicBufSize) ++ p->dicPos = 0; ++ dicPos = p->dicPos; ++ if (outSize > p->dicBufSize - dicPos) ++ { ++ outSizeCur = p->dicBufSize; ++ curFinishMode = LZMA_FINISH_ANY; ++ } ++ else ++ { ++ outSizeCur = dicPos + outSize; ++ curFinishMode = finishMode; ++ } ++ ++ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); ++ src += inSizeCur; ++ inSize -= inSizeCur; ++ *srcLen += inSizeCur; ++ outSizeCur = p->dicPos - dicPos; ++ memcpy(dest, p->dic + dicPos, outSizeCur); ++ dest += outSizeCur; ++ outSize -= outSizeCur; ++ *destLen += outSizeCur; ++ if (res != 0) ++ return res; ++ if (outSizeCur == 0 || outSize == 0) ++ return SZ_OK; ++ } ++} ++ ++void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) ++{ ++ alloc->Free(alloc, p->probs); ++ p->probs = 0; ++} ++ ++static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) ++{ ++ alloc->Free(alloc, p->dic); ++ p->dic = 0; ++} ++ ++void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) ++{ ++ LzmaDec_FreeProbs(p, alloc); ++ LzmaDec_FreeDict(p, alloc); ++} ++ ++SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) ++{ ++ UInt32 dicSize; ++ Byte d; ++ ++ if (size < LZMA_PROPS_SIZE) ++ return SZ_ERROR_UNSUPPORTED; ++ else ++ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); ++ ++ if (dicSize < LZMA_DIC_MIN) ++ dicSize = LZMA_DIC_MIN; ++ p->dicSize = dicSize; ++ ++ d = data[0]; ++ if (d >= (9 * 5 * 5)) ++ return SZ_ERROR_UNSUPPORTED; ++ ++ p->lc = d % 9; ++ d /= 9; ++ p->pb = d / 5; ++ p->lp = d % 5; ++ ++ return SZ_OK; ++} ++ ++static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) ++{ ++ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); ++ if (p->probs == 0 || numProbs != p->numProbs) ++ { ++ LzmaDec_FreeProbs(p, alloc); ++ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); ++ p->numProbs = numProbs; ++ if (p->probs == 0) ++ return SZ_ERROR_MEM; ++ } ++ return SZ_OK; ++} ++ ++SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) ++{ ++ CLzmaProps propNew; ++ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); ++ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); ++ p->prop = propNew; ++ return SZ_OK; ++} ++ ++SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) ++{ ++ CLzmaProps propNew; ++ SizeT dicBufSize; ++ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); ++ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); ++ dicBufSize = propNew.dicSize; ++ if (p->dic == 0 || dicBufSize != p->dicBufSize) ++ { ++ LzmaDec_FreeDict(p, alloc); ++ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); ++ if (p->dic == 0) ++ { ++ LzmaDec_FreeProbs(p, alloc); ++ return SZ_ERROR_MEM; ++ } ++ } ++ p->dicBufSize = dicBufSize; ++ p->prop = propNew; ++ return SZ_OK; ++} ++ ++SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ++ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ++ ELzmaStatus *status, ISzAlloc *alloc) ++{ ++ CLzmaDec p; ++ SRes res; ++ SizeT inSize = *srcLen; ++ SizeT outSize = *destLen; ++ *srcLen = *destLen = 0; ++ if (inSize < RC_INIT_SIZE) ++ return SZ_ERROR_INPUT_EOF; ++ ++ LzmaDec_Construct(&p); ++ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); ++ if (res != 0) ++ return res; ++ p.dic = dest; ++ p.dicBufSize = outSize; ++ ++ LzmaDec_Init(&p); ++ ++ *srcLen = inSize; ++ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); ++ ++ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) ++ res = SZ_ERROR_INPUT_EOF; ++ ++ (*destLen) = p.dicPos; ++ LzmaDec_FreeProbs(&p, alloc); ++ return res; ++} +--- /dev/null ++++ b/lib/lzma/LzmaEnc.c +@@ -0,0 +1,2271 @@ ++/* LzmaEnc.c -- LZMA Encoder ++2009-11-24 : Igor Pavlov : Public domain */ ++ ++#include ++ ++/* #define SHOW_STAT */ ++/* #define SHOW_STAT2 */ ++ ++#if defined(SHOW_STAT) || defined(SHOW_STAT2) ++#include ++#endif ++ ++#include "LzmaEnc.h" ++ ++/* disable MT */ ++#define _7ZIP_ST ++ ++#include "LzFind.h" ++#ifndef _7ZIP_ST ++#include "LzFindMt.h" ++#endif ++ ++#ifdef SHOW_STAT ++static int ttt = 0; ++#endif ++ ++#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) ++ ++#define kBlockSize (9 << 10) ++#define kUnpackBlockSize (1 << 18) ++#define kMatchArraySize (1 << 21) ++#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) ++ ++#define kNumMaxDirectBits (31) ++ ++#define kNumTopBits 24 ++#define kTopValue ((UInt32)1 << kNumTopBits) ++ ++#define kNumBitModelTotalBits 11 ++#define kBitModelTotal (1 << kNumBitModelTotalBits) ++#define kNumMoveBits 5 ++#define kProbInitValue (kBitModelTotal >> 1) ++ ++#define kNumMoveReducingBits 4 ++#define kNumBitPriceShiftBits 4 ++#define kBitPrice (1 << kNumBitPriceShiftBits) ++ ++void LzmaEncProps_Init(CLzmaEncProps *p) ++{ ++ p->level = 5; ++ p->dictSize = p->mc = 0; ++ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; ++ p->writeEndMark = 0; ++} ++ ++void LzmaEncProps_Normalize(CLzmaEncProps *p) ++{ ++ int level = p->level; ++ if (level < 0) level = 5; ++ p->level = level; ++ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); ++ if (p->lc < 0) p->lc = 3; ++ if (p->lp < 0) p->lp = 0; ++ if (p->pb < 0) p->pb = 2; ++ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); ++ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); ++ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); ++ if (p->numHashBytes < 0) p->numHashBytes = 4; ++ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); ++ if (p->numThreads < 0) ++ p->numThreads = ++ #ifndef _7ZIP_ST ++ ((p->btMode && p->algo) ? 2 : 1); ++ #else ++ 1; ++ #endif ++} ++ ++UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) ++{ ++ CLzmaEncProps props = *props2; ++ LzmaEncProps_Normalize(&props); ++ return props.dictSize; ++} ++ ++/* #define LZMA_LOG_BSR */ ++/* Define it for Intel's CPU */ ++ ++ ++#ifdef LZMA_LOG_BSR ++ ++#define kDicLogSizeMaxCompress 30 ++ ++#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } ++ ++UInt32 GetPosSlot1(UInt32 pos) ++{ ++ UInt32 res; ++ BSR2_RET(pos, res); ++ return res; ++} ++#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } ++#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } ++ ++#else ++ ++#define kNumLogBits (9 + (int)sizeof(size_t) / 2) ++#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) ++ ++void LzmaEnc_FastPosInit(Byte *g_FastPos) ++{ ++ int c = 2, slotFast; ++ g_FastPos[0] = 0; ++ g_FastPos[1] = 1; ++ ++ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) ++ { ++ UInt32 k = (1 << ((slotFast >> 1) - 1)); ++ UInt32 j; ++ for (j = 0; j < k; j++, c++) ++ g_FastPos[c] = (Byte)slotFast; ++ } ++} ++ ++#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ ++ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ ++ res = p->g_FastPos[pos >> i] + (i * 2); } ++/* ++#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ ++ p->g_FastPos[pos >> 6] + 12 : \ ++ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } ++*/ ++ ++#define GetPosSlot1(pos) p->g_FastPos[pos] ++#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } ++#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } ++ ++#endif ++ ++ ++#define LZMA_NUM_REPS 4 ++ ++typedef unsigned CState; ++ ++typedef struct ++{ ++ UInt32 price; ++ ++ CState state; ++ int prev1IsChar; ++ int prev2; ++ ++ UInt32 posPrev2; ++ UInt32 backPrev2; ++ ++ UInt32 posPrev; ++ UInt32 backPrev; ++ UInt32 backs[LZMA_NUM_REPS]; ++} COptimal; ++ ++#define kNumOpts (1 << 12) ++ ++#define kNumLenToPosStates 4 ++#define kNumPosSlotBits 6 ++#define kDicLogSizeMin 0 ++#define kDicLogSizeMax 32 ++#define kDistTableSizeMax (kDicLogSizeMax * 2) ++ ++ ++#define kNumAlignBits 4 ++#define kAlignTableSize (1 << kNumAlignBits) ++#define kAlignMask (kAlignTableSize - 1) ++ ++#define kStartPosModelIndex 4 ++#define kEndPosModelIndex 14 ++#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) ++ ++#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) ++ ++#ifdef _LZMA_PROB32 ++#define CLzmaProb UInt32 ++#else ++#define CLzmaProb UInt16 ++#endif ++ ++#define LZMA_PB_MAX 4 ++#define LZMA_LC_MAX 8 ++#define LZMA_LP_MAX 4 ++ ++#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) ++ ++ ++#define kLenNumLowBits 3 ++#define kLenNumLowSymbols (1 << kLenNumLowBits) ++#define kLenNumMidBits 3 ++#define kLenNumMidSymbols (1 << kLenNumMidBits) ++#define kLenNumHighBits 8 ++#define kLenNumHighSymbols (1 << kLenNumHighBits) ++ ++#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) ++ ++#define LZMA_MATCH_LEN_MIN 2 ++#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) ++ ++#define kNumStates 12 ++ ++typedef struct ++{ ++ CLzmaProb choice; ++ CLzmaProb choice2; ++ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; ++ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; ++ CLzmaProb high[kLenNumHighSymbols]; ++} CLenEnc; ++ ++typedef struct ++{ ++ CLenEnc p; ++ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; ++ UInt32 tableSize; ++ UInt32 counters[LZMA_NUM_PB_STATES_MAX]; ++} CLenPriceEnc; ++ ++typedef struct ++{ ++ UInt32 range; ++ Byte cache; ++ UInt64 low; ++ UInt64 cacheSize; ++ Byte *buf; ++ Byte *bufLim; ++ Byte *bufBase; ++ ISeqOutStream *outStream; ++ UInt64 processed; ++ SRes res; ++} CRangeEnc; ++ ++typedef struct ++{ ++ CLzmaProb *litProbs; ++ ++ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; ++ CLzmaProb isRep[kNumStates]; ++ CLzmaProb isRepG0[kNumStates]; ++ CLzmaProb isRepG1[kNumStates]; ++ CLzmaProb isRepG2[kNumStates]; ++ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; ++ ++ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; ++ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; ++ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; ++ ++ CLenPriceEnc lenEnc; ++ CLenPriceEnc repLenEnc; ++ ++ UInt32 reps[LZMA_NUM_REPS]; ++ UInt32 state; ++} CSaveState; ++ ++typedef struct ++{ ++ IMatchFinder matchFinder; ++ void *matchFinderObj; ++ ++ #ifndef _7ZIP_ST ++ Bool mtMode; ++ CMatchFinderMt matchFinderMt; ++ #endif ++ ++ CMatchFinder matchFinderBase; ++ ++ #ifndef _7ZIP_ST ++ Byte pad[128]; ++ #endif ++ ++ UInt32 optimumEndIndex; ++ UInt32 optimumCurrentIndex; ++ ++ UInt32 longestMatchLength; ++ UInt32 numPairs; ++ UInt32 numAvail; ++ COptimal opt[kNumOpts]; ++ ++ #ifndef LZMA_LOG_BSR ++ Byte g_FastPos[1 << kNumLogBits]; ++ #endif ++ ++ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; ++ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; ++ UInt32 numFastBytes; ++ UInt32 additionalOffset; ++ UInt32 reps[LZMA_NUM_REPS]; ++ UInt32 state; ++ ++ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; ++ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; ++ UInt32 alignPrices[kAlignTableSize]; ++ UInt32 alignPriceCount; ++ ++ UInt32 distTableSize; ++ ++ unsigned lc, lp, pb; ++ unsigned lpMask, pbMask; ++ ++ CLzmaProb *litProbs; ++ ++ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; ++ CLzmaProb isRep[kNumStates]; ++ CLzmaProb isRepG0[kNumStates]; ++ CLzmaProb isRepG1[kNumStates]; ++ CLzmaProb isRepG2[kNumStates]; ++ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; ++ ++ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; ++ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; ++ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; ++ ++ CLenPriceEnc lenEnc; ++ CLenPriceEnc repLenEnc; ++ ++ unsigned lclp; ++ ++ Bool fastMode; ++ ++ CRangeEnc rc; ++ ++ Bool writeEndMark; ++ UInt64 nowPos64; ++ UInt32 matchPriceCount; ++ Bool finished; ++ Bool multiThread; ++ ++ SRes result; ++ UInt32 dictSize; ++ UInt32 matchFinderCycles; ++ ++ int needInit; ++ ++ CSaveState saveState; ++} CLzmaEnc; ++ ++void LzmaEnc_SaveState(CLzmaEncHandle pp) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ CSaveState *dest = &p->saveState; ++ int i; ++ dest->lenEnc = p->lenEnc; ++ dest->repLenEnc = p->repLenEnc; ++ dest->state = p->state; ++ ++ for (i = 0; i < kNumStates; i++) ++ { ++ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); ++ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); ++ } ++ for (i = 0; i < kNumLenToPosStates; i++) ++ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); ++ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); ++ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); ++ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); ++ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); ++ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); ++ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); ++ memcpy(dest->reps, p->reps, sizeof(p->reps)); ++ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); ++} ++ ++void LzmaEnc_RestoreState(CLzmaEncHandle pp) ++{ ++ CLzmaEnc *dest = (CLzmaEnc *)pp; ++ const CSaveState *p = &dest->saveState; ++ int i; ++ dest->lenEnc = p->lenEnc; ++ dest->repLenEnc = p->repLenEnc; ++ dest->state = p->state; ++ ++ for (i = 0; i < kNumStates; i++) ++ { ++ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); ++ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); ++ } ++ for (i = 0; i < kNumLenToPosStates; i++) ++ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); ++ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); ++ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); ++ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); ++ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); ++ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); ++ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); ++ memcpy(dest->reps, p->reps, sizeof(p->reps)); ++ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); ++} ++ ++SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ CLzmaEncProps props = *props2; ++ LzmaEncProps_Normalize(&props); ++ ++ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || ++ props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30)) ++ return SZ_ERROR_PARAM; ++ p->dictSize = props.dictSize; ++ p->matchFinderCycles = props.mc; ++ { ++ unsigned fb = props.fb; ++ if (fb < 5) ++ fb = 5; ++ if (fb > LZMA_MATCH_LEN_MAX) ++ fb = LZMA_MATCH_LEN_MAX; ++ p->numFastBytes = fb; ++ } ++ p->lc = props.lc; ++ p->lp = props.lp; ++ p->pb = props.pb; ++ p->fastMode = (props.algo == 0); ++ p->matchFinderBase.btMode = props.btMode; ++ { ++ UInt32 numHashBytes = 4; ++ if (props.btMode) ++ { ++ if (props.numHashBytes < 2) ++ numHashBytes = 2; ++ else if (props.numHashBytes < 4) ++ numHashBytes = props.numHashBytes; ++ } ++ p->matchFinderBase.numHashBytes = numHashBytes; ++ } ++ ++ p->matchFinderBase.cutValue = props.mc; ++ ++ p->writeEndMark = props.writeEndMark; ++ ++ #ifndef _7ZIP_ST ++ /* ++ if (newMultiThread != _multiThread) ++ { ++ ReleaseMatchFinder(); ++ _multiThread = newMultiThread; ++ } ++ */ ++ p->multiThread = (props.numThreads > 1); ++ #endif ++ ++ return SZ_OK; ++} ++ ++static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; ++static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; ++static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; ++static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; ++ ++#define IsCharState(s) ((s) < 7) ++ ++#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) ++ ++#define kInfinityPrice (1 << 30) ++ ++static void RangeEnc_Construct(CRangeEnc *p) ++{ ++ p->outStream = 0; ++ p->bufBase = 0; ++} ++ ++#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) ++ ++#define RC_BUF_SIZE (1 << 16) ++static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) ++{ ++ if (p->bufBase == 0) ++ { ++ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); ++ if (p->bufBase == 0) ++ return 0; ++ p->bufLim = p->bufBase + RC_BUF_SIZE; ++ } ++ return 1; ++} ++ ++static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) ++{ ++ alloc->Free(alloc, p->bufBase); ++ p->bufBase = 0; ++} ++ ++static void RangeEnc_Init(CRangeEnc *p) ++{ ++ /* Stream.Init(); */ ++ p->low = 0; ++ p->range = 0xFFFFFFFF; ++ p->cacheSize = 1; ++ p->cache = 0; ++ ++ p->buf = p->bufBase; ++ ++ p->processed = 0; ++ p->res = SZ_OK; ++} ++ ++static void RangeEnc_FlushStream(CRangeEnc *p) ++{ ++ size_t num; ++ if (p->res != SZ_OK) ++ return; ++ num = p->buf - p->bufBase; ++ if (num != p->outStream->Write(p->outStream, p->bufBase, num)) ++ p->res = SZ_ERROR_WRITE; ++ p->processed += num; ++ p->buf = p->bufBase; ++} ++ ++static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) ++{ ++ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) ++ { ++ Byte temp = p->cache; ++ do ++ { ++ Byte *buf = p->buf; ++ *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); ++ p->buf = buf; ++ if (buf == p->bufLim) ++ RangeEnc_FlushStream(p); ++ temp = 0xFF; ++ } ++ while (--p->cacheSize != 0); ++ p->cache = (Byte)((UInt32)p->low >> 24); ++ } ++ p->cacheSize++; ++ p->low = (UInt32)p->low << 8; ++} ++ ++static void RangeEnc_FlushData(CRangeEnc *p) ++{ ++ int i; ++ for (i = 0; i < 5; i++) ++ RangeEnc_ShiftLow(p); ++} ++ ++static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) ++{ ++ do ++ { ++ p->range >>= 1; ++ p->low += p->range & (0 - ((value >> --numBits) & 1)); ++ if (p->range < kTopValue) ++ { ++ p->range <<= 8; ++ RangeEnc_ShiftLow(p); ++ } ++ } ++ while (numBits != 0); ++} ++ ++static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) ++{ ++ UInt32 ttt = *prob; ++ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; ++ if (symbol == 0) ++ { ++ p->range = newBound; ++ ttt += (kBitModelTotal - ttt) >> kNumMoveBits; ++ } ++ else ++ { ++ p->low += newBound; ++ p->range -= newBound; ++ ttt -= ttt >> kNumMoveBits; ++ } ++ *prob = (CLzmaProb)ttt; ++ if (p->range < kTopValue) ++ { ++ p->range <<= 8; ++ RangeEnc_ShiftLow(p); ++ } ++} ++ ++static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) ++{ ++ symbol |= 0x100; ++ do ++ { ++ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); ++ symbol <<= 1; ++ } ++ while (symbol < 0x10000); ++} ++ ++static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) ++{ ++ UInt32 offs = 0x100; ++ symbol |= 0x100; ++ do ++ { ++ matchByte <<= 1; ++ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); ++ symbol <<= 1; ++ offs &= ~(matchByte ^ symbol); ++ } ++ while (symbol < 0x10000); ++} ++ ++void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) ++{ ++ UInt32 i; ++ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) ++ { ++ const int kCyclesBits = kNumBitPriceShiftBits; ++ UInt32 w = i; ++ UInt32 bitCount = 0; ++ int j; ++ for (j = 0; j < kCyclesBits; j++) ++ { ++ w = w * w; ++ bitCount <<= 1; ++ while (w >= ((UInt32)1 << 16)) ++ { ++ w >>= 1; ++ bitCount++; ++ } ++ } ++ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); ++ } ++} ++ ++ ++#define GET_PRICE(prob, symbol) \ ++ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; ++ ++#define GET_PRICEa(prob, symbol) \ ++ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; ++ ++#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] ++#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] ++ ++#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] ++#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] ++ ++static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) ++{ ++ UInt32 price = 0; ++ symbol |= 0x100; ++ do ++ { ++ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); ++ symbol <<= 1; ++ } ++ while (symbol < 0x10000); ++ return price; ++} ++ ++static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) ++{ ++ UInt32 price = 0; ++ UInt32 offs = 0x100; ++ symbol |= 0x100; ++ do ++ { ++ matchByte <<= 1; ++ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); ++ symbol <<= 1; ++ offs &= ~(matchByte ^ symbol); ++ } ++ while (symbol < 0x10000); ++ return price; ++} ++ ++ ++static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) ++{ ++ UInt32 m = 1; ++ int i; ++ for (i = numBitLevels; i != 0;) ++ { ++ UInt32 bit; ++ i--; ++ bit = (symbol >> i) & 1; ++ RangeEnc_EncodeBit(rc, probs + m, bit); ++ m = (m << 1) | bit; ++ } ++} ++ ++static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) ++{ ++ UInt32 m = 1; ++ int i; ++ for (i = 0; i < numBitLevels; i++) ++ { ++ UInt32 bit = symbol & 1; ++ RangeEnc_EncodeBit(rc, probs + m, bit); ++ m = (m << 1) | bit; ++ symbol >>= 1; ++ } ++} ++ ++static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) ++{ ++ UInt32 price = 0; ++ symbol |= (1 << numBitLevels); ++ while (symbol != 1) ++ { ++ price += GET_PRICEa(probs[symbol >> 1], symbol & 1); ++ symbol >>= 1; ++ } ++ return price; ++} ++ ++static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) ++{ ++ UInt32 price = 0; ++ UInt32 m = 1; ++ int i; ++ for (i = numBitLevels; i != 0; i--) ++ { ++ UInt32 bit = symbol & 1; ++ symbol >>= 1; ++ price += GET_PRICEa(probs[m], bit); ++ m = (m << 1) | bit; ++ } ++ return price; ++} ++ ++ ++static void LenEnc_Init(CLenEnc *p) ++{ ++ unsigned i; ++ p->choice = p->choice2 = kProbInitValue; ++ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) ++ p->low[i] = kProbInitValue; ++ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) ++ p->mid[i] = kProbInitValue; ++ for (i = 0; i < kLenNumHighSymbols; i++) ++ p->high[i] = kProbInitValue; ++} ++ ++static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) ++{ ++ if (symbol < kLenNumLowSymbols) ++ { ++ RangeEnc_EncodeBit(rc, &p->choice, 0); ++ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); ++ } ++ else ++ { ++ RangeEnc_EncodeBit(rc, &p->choice, 1); ++ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) ++ { ++ RangeEnc_EncodeBit(rc, &p->choice2, 0); ++ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); ++ } ++ else ++ { ++ RangeEnc_EncodeBit(rc, &p->choice2, 1); ++ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); ++ } ++ } ++} ++ ++static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) ++{ ++ UInt32 a0 = GET_PRICE_0a(p->choice); ++ UInt32 a1 = GET_PRICE_1a(p->choice); ++ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); ++ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); ++ UInt32 i = 0; ++ for (i = 0; i < kLenNumLowSymbols; i++) ++ { ++ if (i >= numSymbols) ++ return; ++ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); ++ } ++ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) ++ { ++ if (i >= numSymbols) ++ return; ++ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); ++ } ++ for (; i < numSymbols; i++) ++ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); ++} ++ ++static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) ++{ ++ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); ++ p->counters[posState] = p->tableSize; ++} ++ ++static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) ++{ ++ UInt32 posState; ++ for (posState = 0; posState < numPosStates; posState++) ++ LenPriceEnc_UpdateTable(p, posState, ProbPrices); ++} ++ ++static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) ++{ ++ LenEnc_Encode(&p->p, rc, symbol, posState); ++ if (updatePrice) ++ if (--p->counters[posState] == 0) ++ LenPriceEnc_UpdateTable(p, posState, ProbPrices); ++} ++ ++ ++ ++ ++static void MovePos(CLzmaEnc *p, UInt32 num) ++{ ++ #ifdef SHOW_STAT ++ ttt += num; ++ printf("\n MovePos %d", num); ++ #endif ++ if (num != 0) ++ { ++ p->additionalOffset += num; ++ p->matchFinder.Skip(p->matchFinderObj, num); ++ } ++} ++ ++static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) ++{ ++ UInt32 lenRes = 0, numPairs; ++ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); ++ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); ++ #ifdef SHOW_STAT ++ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); ++ ttt++; ++ { ++ UInt32 i; ++ for (i = 0; i < numPairs; i += 2) ++ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); ++ } ++ #endif ++ if (numPairs > 0) ++ { ++ lenRes = p->matches[numPairs - 2]; ++ if (lenRes == p->numFastBytes) ++ { ++ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; ++ UInt32 distance = p->matches[numPairs - 1] + 1; ++ UInt32 numAvail = p->numAvail; ++ if (numAvail > LZMA_MATCH_LEN_MAX) ++ numAvail = LZMA_MATCH_LEN_MAX; ++ { ++ const Byte *pby2 = pby - distance; ++ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); ++ } ++ } ++ } ++ p->additionalOffset++; ++ *numDistancePairsRes = numPairs; ++ return lenRes; ++} ++ ++ ++#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; ++#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; ++#define IsShortRep(p) ((p)->backPrev == 0) ++ ++static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) ++{ ++ return ++ GET_PRICE_0(p->isRepG0[state]) + ++ GET_PRICE_0(p->isRep0Long[state][posState]); ++} ++ ++static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) ++{ ++ UInt32 price; ++ if (repIndex == 0) ++ { ++ price = GET_PRICE_0(p->isRepG0[state]); ++ price += GET_PRICE_1(p->isRep0Long[state][posState]); ++ } ++ else ++ { ++ price = GET_PRICE_1(p->isRepG0[state]); ++ if (repIndex == 1) ++ price += GET_PRICE_0(p->isRepG1[state]); ++ else ++ { ++ price += GET_PRICE_1(p->isRepG1[state]); ++ price += GET_PRICE(p->isRepG2[state], repIndex - 2); ++ } ++ } ++ return price; ++} ++ ++static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) ++{ ++ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + ++ GetPureRepPrice(p, repIndex, state, posState); ++} ++ ++static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) ++{ ++ UInt32 posMem = p->opt[cur].posPrev; ++ UInt32 backMem = p->opt[cur].backPrev; ++ p->optimumEndIndex = cur; ++ do ++ { ++ if (p->opt[cur].prev1IsChar) ++ { ++ MakeAsChar(&p->opt[posMem]) ++ p->opt[posMem].posPrev = posMem - 1; ++ if (p->opt[cur].prev2) ++ { ++ p->opt[posMem - 1].prev1IsChar = False; ++ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; ++ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; ++ } ++ } ++ { ++ UInt32 posPrev = posMem; ++ UInt32 backCur = backMem; ++ ++ backMem = p->opt[posPrev].backPrev; ++ posMem = p->opt[posPrev].posPrev; ++ ++ p->opt[posPrev].backPrev = backCur; ++ p->opt[posPrev].posPrev = cur; ++ cur = posPrev; ++ } ++ } ++ while (cur != 0); ++ *backRes = p->opt[0].backPrev; ++ p->optimumCurrentIndex = p->opt[0].posPrev; ++ return p->optimumCurrentIndex; ++} ++ ++#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) ++ ++static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) ++{ ++ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; ++ UInt32 matchPrice, repMatchPrice, normalMatchPrice; ++ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; ++ UInt32 *matches; ++ const Byte *data; ++ Byte curByte, matchByte; ++ if (p->optimumEndIndex != p->optimumCurrentIndex) ++ { ++ const COptimal *opt = &p->opt[p->optimumCurrentIndex]; ++ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; ++ *backRes = opt->backPrev; ++ p->optimumCurrentIndex = opt->posPrev; ++ return lenRes; ++ } ++ p->optimumCurrentIndex = p->optimumEndIndex = 0; ++ ++ if (p->additionalOffset == 0) ++ mainLen = ReadMatchDistances(p, &numPairs); ++ else ++ { ++ mainLen = p->longestMatchLength; ++ numPairs = p->numPairs; ++ } ++ ++ numAvail = p->numAvail; ++ if (numAvail < 2) ++ { ++ *backRes = (UInt32)(-1); ++ return 1; ++ } ++ if (numAvail > LZMA_MATCH_LEN_MAX) ++ numAvail = LZMA_MATCH_LEN_MAX; ++ ++ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; ++ repMaxIndex = 0; ++ for (i = 0; i < LZMA_NUM_REPS; i++) ++ { ++ UInt32 lenTest; ++ const Byte *data2; ++ reps[i] = p->reps[i]; ++ data2 = data - (reps[i] + 1); ++ if (data[0] != data2[0] || data[1] != data2[1]) ++ { ++ repLens[i] = 0; ++ continue; ++ } ++ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); ++ repLens[i] = lenTest; ++ if (lenTest > repLens[repMaxIndex]) ++ repMaxIndex = i; ++ } ++ if (repLens[repMaxIndex] >= p->numFastBytes) ++ { ++ UInt32 lenRes; ++ *backRes = repMaxIndex; ++ lenRes = repLens[repMaxIndex]; ++ MovePos(p, lenRes - 1); ++ return lenRes; ++ } ++ ++ matches = p->matches; ++ if (mainLen >= p->numFastBytes) ++ { ++ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; ++ MovePos(p, mainLen - 1); ++ return mainLen; ++ } ++ curByte = *data; ++ matchByte = *(data - (reps[0] + 1)); ++ ++ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) ++ { ++ *backRes = (UInt32)-1; ++ return 1; ++ } ++ ++ p->opt[0].state = (CState)p->state; ++ ++ posState = (position & p->pbMask); ++ ++ { ++ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); ++ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + ++ (!IsCharState(p->state) ? ++ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : ++ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); ++ } ++ ++ MakeAsChar(&p->opt[1]); ++ ++ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); ++ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); ++ ++ if (matchByte == curByte) ++ { ++ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); ++ if (shortRepPrice < p->opt[1].price) ++ { ++ p->opt[1].price = shortRepPrice; ++ MakeAsShortRep(&p->opt[1]); ++ } ++ } ++ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); ++ ++ if (lenEnd < 2) ++ { ++ *backRes = p->opt[1].backPrev; ++ return 1; ++ } ++ ++ p->opt[1].posPrev = 0; ++ for (i = 0; i < LZMA_NUM_REPS; i++) ++ p->opt[0].backs[i] = reps[i]; ++ ++ len = lenEnd; ++ do ++ p->opt[len--].price = kInfinityPrice; ++ while (len >= 2); ++ ++ for (i = 0; i < LZMA_NUM_REPS; i++) ++ { ++ UInt32 repLen = repLens[i]; ++ UInt32 price; ++ if (repLen < 2) ++ continue; ++ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); ++ do ++ { ++ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; ++ COptimal *opt = &p->opt[repLen]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = 0; ++ opt->backPrev = i; ++ opt->prev1IsChar = False; ++ } ++ } ++ while (--repLen >= 2); ++ } ++ ++ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); ++ ++ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); ++ if (len <= mainLen) ++ { ++ UInt32 offs = 0; ++ while (len > matches[offs]) ++ offs += 2; ++ for (; ; len++) ++ { ++ COptimal *opt; ++ UInt32 distance = matches[offs + 1]; ++ ++ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; ++ UInt32 lenToPosState = GetLenToPosState(len); ++ if (distance < kNumFullDistances) ++ curAndLenPrice += p->distancesPrices[lenToPosState][distance]; ++ else ++ { ++ UInt32 slot; ++ GetPosSlot2(distance, slot); ++ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; ++ } ++ opt = &p->opt[len]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = 0; ++ opt->backPrev = distance + LZMA_NUM_REPS; ++ opt->prev1IsChar = False; ++ } ++ if (len == matches[offs]) ++ { ++ offs += 2; ++ if (offs == numPairs) ++ break; ++ } ++ } ++ } ++ ++ cur = 0; ++ ++ #ifdef SHOW_STAT2 ++ if (position >= 0) ++ { ++ unsigned i; ++ printf("\n pos = %4X", position); ++ for (i = cur; i <= lenEnd; i++) ++ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); ++ } ++ #endif ++ ++ for (;;) ++ { ++ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; ++ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; ++ Bool nextIsChar; ++ Byte curByte, matchByte; ++ const Byte *data; ++ COptimal *curOpt; ++ COptimal *nextOpt; ++ ++ cur++; ++ if (cur == lenEnd) ++ return Backward(p, backRes, cur); ++ ++ newLen = ReadMatchDistances(p, &numPairs); ++ if (newLen >= p->numFastBytes) ++ { ++ p->numPairs = numPairs; ++ p->longestMatchLength = newLen; ++ return Backward(p, backRes, cur); ++ } ++ position++; ++ curOpt = &p->opt[cur]; ++ posPrev = curOpt->posPrev; ++ if (curOpt->prev1IsChar) ++ { ++ posPrev--; ++ if (curOpt->prev2) ++ { ++ state = p->opt[curOpt->posPrev2].state; ++ if (curOpt->backPrev2 < LZMA_NUM_REPS) ++ state = kRepNextStates[state]; ++ else ++ state = kMatchNextStates[state]; ++ } ++ else ++ state = p->opt[posPrev].state; ++ state = kLiteralNextStates[state]; ++ } ++ else ++ state = p->opt[posPrev].state; ++ if (posPrev == cur - 1) ++ { ++ if (IsShortRep(curOpt)) ++ state = kShortRepNextStates[state]; ++ else ++ state = kLiteralNextStates[state]; ++ } ++ else ++ { ++ UInt32 pos; ++ const COptimal *prevOpt; ++ if (curOpt->prev1IsChar && curOpt->prev2) ++ { ++ posPrev = curOpt->posPrev2; ++ pos = curOpt->backPrev2; ++ state = kRepNextStates[state]; ++ } ++ else ++ { ++ pos = curOpt->backPrev; ++ if (pos < LZMA_NUM_REPS) ++ state = kRepNextStates[state]; ++ else ++ state = kMatchNextStates[state]; ++ } ++ prevOpt = &p->opt[posPrev]; ++ if (pos < LZMA_NUM_REPS) ++ { ++ UInt32 i; ++ reps[0] = prevOpt->backs[pos]; ++ for (i = 1; i <= pos; i++) ++ reps[i] = prevOpt->backs[i - 1]; ++ for (; i < LZMA_NUM_REPS; i++) ++ reps[i] = prevOpt->backs[i]; ++ } ++ else ++ { ++ UInt32 i; ++ reps[0] = (pos - LZMA_NUM_REPS); ++ for (i = 1; i < LZMA_NUM_REPS; i++) ++ reps[i] = prevOpt->backs[i - 1]; ++ } ++ } ++ curOpt->state = (CState)state; ++ ++ curOpt->backs[0] = reps[0]; ++ curOpt->backs[1] = reps[1]; ++ curOpt->backs[2] = reps[2]; ++ curOpt->backs[3] = reps[3]; ++ ++ curPrice = curOpt->price; ++ nextIsChar = False; ++ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; ++ curByte = *data; ++ matchByte = *(data - (reps[0] + 1)); ++ ++ posState = (position & p->pbMask); ++ ++ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); ++ { ++ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); ++ curAnd1Price += ++ (!IsCharState(state) ? ++ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : ++ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); ++ } ++ ++ nextOpt = &p->opt[cur + 1]; ++ ++ if (curAnd1Price < nextOpt->price) ++ { ++ nextOpt->price = curAnd1Price; ++ nextOpt->posPrev = cur; ++ MakeAsChar(nextOpt); ++ nextIsChar = True; ++ } ++ ++ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); ++ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); ++ ++ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) ++ { ++ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); ++ if (shortRepPrice <= nextOpt->price) ++ { ++ nextOpt->price = shortRepPrice; ++ nextOpt->posPrev = cur; ++ MakeAsShortRep(nextOpt); ++ nextIsChar = True; ++ } ++ } ++ numAvailFull = p->numAvail; ++ { ++ UInt32 temp = kNumOpts - 1 - cur; ++ if (temp < numAvailFull) ++ numAvailFull = temp; ++ } ++ ++ if (numAvailFull < 2) ++ continue; ++ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); ++ ++ if (!nextIsChar && matchByte != curByte) /* speed optimization */ ++ { ++ /* try Literal + rep0 */ ++ UInt32 temp; ++ UInt32 lenTest2; ++ const Byte *data2 = data - (reps[0] + 1); ++ UInt32 limit = p->numFastBytes + 1; ++ if (limit > numAvailFull) ++ limit = numAvailFull; ++ ++ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); ++ lenTest2 = temp - 1; ++ if (lenTest2 >= 2) ++ { ++ UInt32 state2 = kLiteralNextStates[state]; ++ UInt32 posStateNext = (position + 1) & p->pbMask; ++ UInt32 nextRepMatchPrice = curAnd1Price + ++ GET_PRICE_1(p->isMatch[state2][posStateNext]) + ++ GET_PRICE_1(p->isRep[state2]); ++ /* for (; lenTest2 >= 2; lenTest2--) */ ++ { ++ UInt32 curAndLenPrice; ++ COptimal *opt; ++ UInt32 offset = cur + 1 + lenTest2; ++ while (lenEnd < offset) ++ p->opt[++lenEnd].price = kInfinityPrice; ++ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); ++ opt = &p->opt[offset]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = cur + 1; ++ opt->backPrev = 0; ++ opt->prev1IsChar = True; ++ opt->prev2 = False; ++ } ++ } ++ } ++ } ++ ++ startLen = 2; /* speed optimization */ ++ { ++ UInt32 repIndex; ++ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) ++ { ++ UInt32 lenTest; ++ UInt32 lenTestTemp; ++ UInt32 price; ++ const Byte *data2 = data - (reps[repIndex] + 1); ++ if (data[0] != data2[0] || data[1] != data2[1]) ++ continue; ++ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); ++ while (lenEnd < cur + lenTest) ++ p->opt[++lenEnd].price = kInfinityPrice; ++ lenTestTemp = lenTest; ++ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); ++ do ++ { ++ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; ++ COptimal *opt = &p->opt[cur + lenTest]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = cur; ++ opt->backPrev = repIndex; ++ opt->prev1IsChar = False; ++ } ++ } ++ while (--lenTest >= 2); ++ lenTest = lenTestTemp; ++ ++ if (repIndex == 0) ++ startLen = lenTest + 1; ++ ++ /* if (_maxMode) */ ++ { ++ UInt32 lenTest2 = lenTest + 1; ++ UInt32 limit = lenTest2 + p->numFastBytes; ++ UInt32 nextRepMatchPrice; ++ if (limit > numAvailFull) ++ limit = numAvailFull; ++ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); ++ lenTest2 -= lenTest + 1; ++ if (lenTest2 >= 2) ++ { ++ UInt32 state2 = kRepNextStates[state]; ++ UInt32 posStateNext = (position + lenTest) & p->pbMask; ++ UInt32 curAndLenCharPrice = ++ price + p->repLenEnc.prices[posState][lenTest - 2] + ++ GET_PRICE_0(p->isMatch[state2][posStateNext]) + ++ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), ++ data[lenTest], data2[lenTest], p->ProbPrices); ++ state2 = kLiteralNextStates[state2]; ++ posStateNext = (position + lenTest + 1) & p->pbMask; ++ nextRepMatchPrice = curAndLenCharPrice + ++ GET_PRICE_1(p->isMatch[state2][posStateNext]) + ++ GET_PRICE_1(p->isRep[state2]); ++ ++ /* for (; lenTest2 >= 2; lenTest2--) */ ++ { ++ UInt32 curAndLenPrice; ++ COptimal *opt; ++ UInt32 offset = cur + lenTest + 1 + lenTest2; ++ while (lenEnd < offset) ++ p->opt[++lenEnd].price = kInfinityPrice; ++ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); ++ opt = &p->opt[offset]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = cur + lenTest + 1; ++ opt->backPrev = 0; ++ opt->prev1IsChar = True; ++ opt->prev2 = True; ++ opt->posPrev2 = cur; ++ opt->backPrev2 = repIndex; ++ } ++ } ++ } ++ } ++ } ++ } ++ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ ++ if (newLen > numAvail) ++ { ++ newLen = numAvail; ++ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); ++ matches[numPairs] = newLen; ++ numPairs += 2; ++ } ++ if (newLen >= startLen) ++ { ++ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); ++ UInt32 offs, curBack, posSlot; ++ UInt32 lenTest; ++ while (lenEnd < cur + newLen) ++ p->opt[++lenEnd].price = kInfinityPrice; ++ ++ offs = 0; ++ while (startLen > matches[offs]) ++ offs += 2; ++ curBack = matches[offs + 1]; ++ GetPosSlot2(curBack, posSlot); ++ for (lenTest = /*2*/ startLen; ; lenTest++) ++ { ++ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; ++ UInt32 lenToPosState = GetLenToPosState(lenTest); ++ COptimal *opt; ++ if (curBack < kNumFullDistances) ++ curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; ++ else ++ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; ++ ++ opt = &p->opt[cur + lenTest]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = cur; ++ opt->backPrev = curBack + LZMA_NUM_REPS; ++ opt->prev1IsChar = False; ++ } ++ ++ if (/*_maxMode && */lenTest == matches[offs]) ++ { ++ /* Try Match + Literal + Rep0 */ ++ const Byte *data2 = data - (curBack + 1); ++ UInt32 lenTest2 = lenTest + 1; ++ UInt32 limit = lenTest2 + p->numFastBytes; ++ UInt32 nextRepMatchPrice; ++ if (limit > numAvailFull) ++ limit = numAvailFull; ++ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); ++ lenTest2 -= lenTest + 1; ++ if (lenTest2 >= 2) ++ { ++ UInt32 state2 = kMatchNextStates[state]; ++ UInt32 posStateNext = (position + lenTest) & p->pbMask; ++ UInt32 curAndLenCharPrice = curAndLenPrice + ++ GET_PRICE_0(p->isMatch[state2][posStateNext]) + ++ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), ++ data[lenTest], data2[lenTest], p->ProbPrices); ++ state2 = kLiteralNextStates[state2]; ++ posStateNext = (posStateNext + 1) & p->pbMask; ++ nextRepMatchPrice = curAndLenCharPrice + ++ GET_PRICE_1(p->isMatch[state2][posStateNext]) + ++ GET_PRICE_1(p->isRep[state2]); ++ ++ /* for (; lenTest2 >= 2; lenTest2--) */ ++ { ++ UInt32 offset = cur + lenTest + 1 + lenTest2; ++ UInt32 curAndLenPrice; ++ COptimal *opt; ++ while (lenEnd < offset) ++ p->opt[++lenEnd].price = kInfinityPrice; ++ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); ++ opt = &p->opt[offset]; ++ if (curAndLenPrice < opt->price) ++ { ++ opt->price = curAndLenPrice; ++ opt->posPrev = cur + lenTest + 1; ++ opt->backPrev = 0; ++ opt->prev1IsChar = True; ++ opt->prev2 = True; ++ opt->posPrev2 = cur; ++ opt->backPrev2 = curBack + LZMA_NUM_REPS; ++ } ++ } ++ } ++ offs += 2; ++ if (offs == numPairs) ++ break; ++ curBack = matches[offs + 1]; ++ if (curBack >= kNumFullDistances) ++ GetPosSlot2(curBack, posSlot); ++ } ++ } ++ } ++ } ++} ++ ++#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) ++ ++static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) ++{ ++ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; ++ const Byte *data; ++ const UInt32 *matches; ++ ++ if (p->additionalOffset == 0) ++ mainLen = ReadMatchDistances(p, &numPairs); ++ else ++ { ++ mainLen = p->longestMatchLength; ++ numPairs = p->numPairs; ++ } ++ ++ numAvail = p->numAvail; ++ *backRes = (UInt32)-1; ++ if (numAvail < 2) ++ return 1; ++ if (numAvail > LZMA_MATCH_LEN_MAX) ++ numAvail = LZMA_MATCH_LEN_MAX; ++ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; ++ ++ repLen = repIndex = 0; ++ for (i = 0; i < LZMA_NUM_REPS; i++) ++ { ++ UInt32 len; ++ const Byte *data2 = data - (p->reps[i] + 1); ++ if (data[0] != data2[0] || data[1] != data2[1]) ++ continue; ++ for (len = 2; len < numAvail && data[len] == data2[len]; len++); ++ if (len >= p->numFastBytes) ++ { ++ *backRes = i; ++ MovePos(p, len - 1); ++ return len; ++ } ++ if (len > repLen) ++ { ++ repIndex = i; ++ repLen = len; ++ } ++ } ++ ++ matches = p->matches; ++ if (mainLen >= p->numFastBytes) ++ { ++ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; ++ MovePos(p, mainLen - 1); ++ return mainLen; ++ } ++ ++ mainDist = 0; /* for GCC */ ++ if (mainLen >= 2) ++ { ++ mainDist = matches[numPairs - 1]; ++ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) ++ { ++ if (!ChangePair(matches[numPairs - 3], mainDist)) ++ break; ++ numPairs -= 2; ++ mainLen = matches[numPairs - 2]; ++ mainDist = matches[numPairs - 1]; ++ } ++ if (mainLen == 2 && mainDist >= 0x80) ++ mainLen = 1; ++ } ++ ++ if (repLen >= 2 && ( ++ (repLen + 1 >= mainLen) || ++ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || ++ (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) ++ { ++ *backRes = repIndex; ++ MovePos(p, repLen - 1); ++ return repLen; ++ } ++ ++ if (mainLen < 2 || numAvail <= 2) ++ return 1; ++ ++ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); ++ if (p->longestMatchLength >= 2) ++ { ++ UInt32 newDistance = matches[p->numPairs - 1]; ++ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || ++ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || ++ (p->longestMatchLength > mainLen + 1) || ++ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) ++ return 1; ++ } ++ ++ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; ++ for (i = 0; i < LZMA_NUM_REPS; i++) ++ { ++ UInt32 len, limit; ++ const Byte *data2 = data - (p->reps[i] + 1); ++ if (data[0] != data2[0] || data[1] != data2[1]) ++ continue; ++ limit = mainLen - 1; ++ for (len = 2; len < limit && data[len] == data2[len]; len++); ++ if (len >= limit) ++ return 1; ++ } ++ *backRes = mainDist + LZMA_NUM_REPS; ++ MovePos(p, mainLen - 2); ++ return mainLen; ++} ++ ++static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) ++{ ++ UInt32 len; ++ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); ++ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); ++ p->state = kMatchNextStates[p->state]; ++ len = LZMA_MATCH_LEN_MIN; ++ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); ++ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); ++ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); ++ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); ++} ++ ++static SRes CheckErrors(CLzmaEnc *p) ++{ ++ if (p->result != SZ_OK) ++ return p->result; ++ if (p->rc.res != SZ_OK) ++ p->result = SZ_ERROR_WRITE; ++ if (p->matchFinderBase.result != SZ_OK) ++ p->result = SZ_ERROR_READ; ++ if (p->result != SZ_OK) ++ p->finished = True; ++ return p->result; ++} ++ ++static SRes Flush(CLzmaEnc *p, UInt32 nowPos) ++{ ++ /* ReleaseMFStream(); */ ++ p->finished = True; ++ if (p->writeEndMark) ++ WriteEndMarker(p, nowPos & p->pbMask); ++ RangeEnc_FlushData(&p->rc); ++ RangeEnc_FlushStream(&p->rc); ++ return CheckErrors(p); ++} ++ ++static void FillAlignPrices(CLzmaEnc *p) ++{ ++ UInt32 i; ++ for (i = 0; i < kAlignTableSize; i++) ++ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); ++ p->alignPriceCount = 0; ++} ++ ++static void FillDistancesPrices(CLzmaEnc *p) ++{ ++ UInt32 tempPrices[kNumFullDistances]; ++ UInt32 i, lenToPosState; ++ for (i = kStartPosModelIndex; i < kNumFullDistances; i++) ++ { ++ UInt32 posSlot = GetPosSlot1(i); ++ UInt32 footerBits = ((posSlot >> 1) - 1); ++ UInt32 base = ((2 | (posSlot & 1)) << footerBits); ++ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); ++ } ++ ++ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) ++ { ++ UInt32 posSlot; ++ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; ++ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; ++ for (posSlot = 0; posSlot < p->distTableSize; posSlot++) ++ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); ++ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) ++ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); ++ ++ { ++ UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; ++ UInt32 i; ++ for (i = 0; i < kStartPosModelIndex; i++) ++ distancesPrices[i] = posSlotPrices[i]; ++ for (; i < kNumFullDistances; i++) ++ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; ++ } ++ } ++ p->matchPriceCount = 0; ++} ++ ++void LzmaEnc_Construct(CLzmaEnc *p) ++{ ++ RangeEnc_Construct(&p->rc); ++ MatchFinder_Construct(&p->matchFinderBase); ++ #ifndef _7ZIP_ST ++ MatchFinderMt_Construct(&p->matchFinderMt); ++ p->matchFinderMt.MatchFinder = &p->matchFinderBase; ++ #endif ++ ++ { ++ CLzmaEncProps props; ++ LzmaEncProps_Init(&props); ++ LzmaEnc_SetProps(p, &props); ++ } ++ ++ #ifndef LZMA_LOG_BSR ++ LzmaEnc_FastPosInit(p->g_FastPos); ++ #endif ++ ++ LzmaEnc_InitPriceTables(p->ProbPrices); ++ p->litProbs = 0; ++ p->saveState.litProbs = 0; ++} ++ ++CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) ++{ ++ void *p; ++ p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); ++ if (p != 0) ++ LzmaEnc_Construct((CLzmaEnc *)p); ++ return p; ++} ++ ++void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) ++{ ++ alloc->Free(alloc, p->litProbs); ++ alloc->Free(alloc, p->saveState.litProbs); ++ p->litProbs = 0; ++ p->saveState.litProbs = 0; ++} ++ ++void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ #ifndef _7ZIP_ST ++ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); ++ #endif ++ MatchFinder_Free(&p->matchFinderBase, allocBig); ++ LzmaEnc_FreeLits(p, alloc); ++ RangeEnc_Free(&p->rc, alloc); ++} ++ ++void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); ++ alloc->Free(alloc, p); ++} ++ ++static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) ++{ ++ UInt32 nowPos32, startPos32; ++ if (p->needInit) ++ { ++ p->matchFinder.Init(p->matchFinderObj); ++ p->needInit = 0; ++ } ++ ++ if (p->finished) ++ return p->result; ++ RINOK(CheckErrors(p)); ++ ++ nowPos32 = (UInt32)p->nowPos64; ++ startPos32 = nowPos32; ++ ++ if (p->nowPos64 == 0) ++ { ++ UInt32 numPairs; ++ Byte curByte; ++ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) ++ return Flush(p, nowPos32); ++ ReadMatchDistances(p, &numPairs); ++ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); ++ p->state = kLiteralNextStates[p->state]; ++ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); ++ LitEnc_Encode(&p->rc, p->litProbs, curByte); ++ p->additionalOffset--; ++ nowPos32++; ++ } ++ ++ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) ++ for (;;) ++ { ++ UInt32 pos, len, posState; ++ ++ if (p->fastMode) ++ len = GetOptimumFast(p, &pos); ++ else ++ len = GetOptimum(p, nowPos32, &pos); ++ ++ #ifdef SHOW_STAT2 ++ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); ++ #endif ++ ++ posState = nowPos32 & p->pbMask; ++ if (len == 1 && pos == (UInt32)-1) ++ { ++ Byte curByte; ++ CLzmaProb *probs; ++ const Byte *data; ++ ++ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); ++ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; ++ curByte = *data; ++ probs = LIT_PROBS(nowPos32, *(data - 1)); ++ if (IsCharState(p->state)) ++ LitEnc_Encode(&p->rc, probs, curByte); ++ else ++ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); ++ p->state = kLiteralNextStates[p->state]; ++ } ++ else ++ { ++ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); ++ if (pos < LZMA_NUM_REPS) ++ { ++ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); ++ if (pos == 0) ++ { ++ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); ++ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); ++ } ++ else ++ { ++ UInt32 distance = p->reps[pos]; ++ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); ++ if (pos == 1) ++ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); ++ else ++ { ++ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); ++ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); ++ if (pos == 3) ++ p->reps[3] = p->reps[2]; ++ p->reps[2] = p->reps[1]; ++ } ++ p->reps[1] = p->reps[0]; ++ p->reps[0] = distance; ++ } ++ if (len == 1) ++ p->state = kShortRepNextStates[p->state]; ++ else ++ { ++ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); ++ p->state = kRepNextStates[p->state]; ++ } ++ } ++ else ++ { ++ UInt32 posSlot; ++ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); ++ p->state = kMatchNextStates[p->state]; ++ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); ++ pos -= LZMA_NUM_REPS; ++ GetPosSlot(pos, posSlot); ++ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); ++ ++ if (posSlot >= kStartPosModelIndex) ++ { ++ UInt32 footerBits = ((posSlot >> 1) - 1); ++ UInt32 base = ((2 | (posSlot & 1)) << footerBits); ++ UInt32 posReduced = pos - base; ++ ++ if (posSlot < kEndPosModelIndex) ++ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); ++ else ++ { ++ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); ++ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); ++ p->alignPriceCount++; ++ } ++ } ++ p->reps[3] = p->reps[2]; ++ p->reps[2] = p->reps[1]; ++ p->reps[1] = p->reps[0]; ++ p->reps[0] = pos; ++ p->matchPriceCount++; ++ } ++ } ++ p->additionalOffset -= len; ++ nowPos32 += len; ++ if (p->additionalOffset == 0) ++ { ++ UInt32 processed; ++ if (!p->fastMode) ++ { ++ if (p->matchPriceCount >= (1 << 7)) ++ FillDistancesPrices(p); ++ if (p->alignPriceCount >= kAlignTableSize) ++ FillAlignPrices(p); ++ } ++ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) ++ break; ++ processed = nowPos32 - startPos32; ++ if (useLimits) ++ { ++ if (processed + kNumOpts + 300 >= maxUnpackSize || ++ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) ++ break; ++ } ++ else if (processed >= (1 << 15)) ++ { ++ p->nowPos64 += nowPos32 - startPos32; ++ return CheckErrors(p); ++ } ++ } ++ } ++ p->nowPos64 += nowPos32 - startPos32; ++ return Flush(p, nowPos32); ++} ++ ++#define kBigHashDicLimit ((UInt32)1 << 24) ++ ++static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ UInt32 beforeSize = kNumOpts; ++ Bool btMode; ++ if (!RangeEnc_Alloc(&p->rc, alloc)) ++ return SZ_ERROR_MEM; ++ btMode = (p->matchFinderBase.btMode != 0); ++ #ifndef _7ZIP_ST ++ p->mtMode = (p->multiThread && !p->fastMode && btMode); ++ #endif ++ ++ { ++ unsigned lclp = p->lc + p->lp; ++ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) ++ { ++ LzmaEnc_FreeLits(p, alloc); ++ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); ++ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); ++ if (p->litProbs == 0 || p->saveState.litProbs == 0) ++ { ++ LzmaEnc_FreeLits(p, alloc); ++ return SZ_ERROR_MEM; ++ } ++ p->lclp = lclp; ++ } ++ } ++ ++ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); ++ ++ if (beforeSize + p->dictSize < keepWindowSize) ++ beforeSize = keepWindowSize - p->dictSize; ++ ++ #ifndef _7ZIP_ST ++ if (p->mtMode) ++ { ++ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); ++ p->matchFinderObj = &p->matchFinderMt; ++ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); ++ } ++ else ++ #endif ++ { ++ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) ++ return SZ_ERROR_MEM; ++ p->matchFinderObj = &p->matchFinderBase; ++ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); ++ } ++ return SZ_OK; ++} ++ ++void LzmaEnc_Init(CLzmaEnc *p) ++{ ++ UInt32 i; ++ p->state = 0; ++ for (i = 0 ; i < LZMA_NUM_REPS; i++) ++ p->reps[i] = 0; ++ ++ RangeEnc_Init(&p->rc); ++ ++ ++ for (i = 0; i < kNumStates; i++) ++ { ++ UInt32 j; ++ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) ++ { ++ p->isMatch[i][j] = kProbInitValue; ++ p->isRep0Long[i][j] = kProbInitValue; ++ } ++ p->isRep[i] = kProbInitValue; ++ p->isRepG0[i] = kProbInitValue; ++ p->isRepG1[i] = kProbInitValue; ++ p->isRepG2[i] = kProbInitValue; ++ } ++ ++ { ++ UInt32 num = 0x300 << (p->lp + p->lc); ++ for (i = 0; i < num; i++) ++ p->litProbs[i] = kProbInitValue; ++ } ++ ++ { ++ for (i = 0; i < kNumLenToPosStates; i++) ++ { ++ CLzmaProb *probs = p->posSlotEncoder[i]; ++ UInt32 j; ++ for (j = 0; j < (1 << kNumPosSlotBits); j++) ++ probs[j] = kProbInitValue; ++ } ++ } ++ { ++ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) ++ p->posEncoders[i] = kProbInitValue; ++ } ++ ++ LenEnc_Init(&p->lenEnc.p); ++ LenEnc_Init(&p->repLenEnc.p); ++ ++ for (i = 0; i < (1 << kNumAlignBits); i++) ++ p->posAlignEncoder[i] = kProbInitValue; ++ ++ p->optimumEndIndex = 0; ++ p->optimumCurrentIndex = 0; ++ p->additionalOffset = 0; ++ ++ p->pbMask = (1 << p->pb) - 1; ++ p->lpMask = (1 << p->lp) - 1; ++} ++ ++void LzmaEnc_InitPrices(CLzmaEnc *p) ++{ ++ if (!p->fastMode) ++ { ++ FillDistancesPrices(p); ++ FillAlignPrices(p); ++ } ++ ++ p->lenEnc.tableSize = ++ p->repLenEnc.tableSize = ++ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; ++ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); ++ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); ++} ++ ++static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ UInt32 i; ++ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) ++ if (p->dictSize <= ((UInt32)1 << i)) ++ break; ++ p->distTableSize = i * 2; ++ ++ p->finished = False; ++ p->result = SZ_OK; ++ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); ++ LzmaEnc_Init(p); ++ LzmaEnc_InitPrices(p); ++ p->nowPos64 = 0; ++ return SZ_OK; ++} ++ ++static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ++ ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ p->matchFinderBase.stream = inStream; ++ p->needInit = 1; ++ p->rc.outStream = outStream; ++ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); ++} ++ ++SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ++ ISeqInStream *inStream, UInt32 keepWindowSize, ++ ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ p->matchFinderBase.stream = inStream; ++ p->needInit = 1; ++ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); ++} ++ ++static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) ++{ ++ p->matchFinderBase.directInput = 1; ++ p->matchFinderBase.bufferBase = (Byte *)src; ++ p->matchFinderBase.directInputRem = srcLen; ++} ++ ++SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, ++ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ LzmaEnc_SetInputBuf(p, src, srcLen); ++ p->needInit = 1; ++ ++ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); ++} ++ ++void LzmaEnc_Finish(CLzmaEncHandle pp) ++{ ++ #ifndef _7ZIP_ST ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ if (p->mtMode) ++ MatchFinderMt_ReleaseStream(&p->matchFinderMt); ++ #else ++ pp = pp; ++ #endif ++} ++ ++typedef struct ++{ ++ ISeqOutStream funcTable; ++ Byte *data; ++ SizeT rem; ++ Bool overflow; ++} CSeqOutStreamBuf; ++ ++static size_t MyWrite(void *pp, const void *data, size_t size) ++{ ++ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; ++ if (p->rem < size) ++ { ++ size = p->rem; ++ p->overflow = True; ++ } ++ memcpy(p->data, data, size); ++ p->rem -= size; ++ p->data += size; ++ return size; ++} ++ ++ ++UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) ++{ ++ const CLzmaEnc *p = (CLzmaEnc *)pp; ++ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); ++} ++ ++const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) ++{ ++ const CLzmaEnc *p = (CLzmaEnc *)pp; ++ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; ++} ++ ++SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, ++ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ UInt64 nowPos64; ++ SRes res; ++ CSeqOutStreamBuf outStream; ++ ++ outStream.funcTable.Write = MyWrite; ++ outStream.data = dest; ++ outStream.rem = *destLen; ++ outStream.overflow = False; ++ ++ p->writeEndMark = False; ++ p->finished = False; ++ p->result = SZ_OK; ++ ++ if (reInit) ++ LzmaEnc_Init(p); ++ LzmaEnc_InitPrices(p); ++ nowPos64 = p->nowPos64; ++ RangeEnc_Init(&p->rc); ++ p->rc.outStream = &outStream.funcTable; ++ ++ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); ++ ++ *unpackSize = (UInt32)(p->nowPos64 - nowPos64); ++ *destLen -= outStream.rem; ++ if (outStream.overflow) ++ return SZ_ERROR_OUTPUT_EOF; ++ ++ return res; ++} ++ ++static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) ++{ ++ SRes res = SZ_OK; ++ ++ #ifndef _7ZIP_ST ++ Byte allocaDummy[0x300]; ++ int i = 0; ++ for (i = 0; i < 16; i++) ++ allocaDummy[i] = (Byte)i; ++ #endif ++ ++ for (;;) ++ { ++ res = LzmaEnc_CodeOneBlock(p, False, 0, 0); ++ if (res != SZ_OK || p->finished != 0) ++ break; ++ if (progress != 0) ++ { ++ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); ++ if (res != SZ_OK) ++ { ++ res = SZ_ERROR_PROGRESS; ++ break; ++ } ++ } ++ } ++ LzmaEnc_Finish(p); ++ return res; ++} ++ ++SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, ++ ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); ++ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); ++} ++ ++SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ int i; ++ UInt32 dictSize = p->dictSize; ++ if (*size < LZMA_PROPS_SIZE) ++ return SZ_ERROR_PARAM; ++ *size = LZMA_PROPS_SIZE; ++ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); ++ ++ for (i = 11; i <= 30; i++) ++ { ++ if (dictSize <= ((UInt32)2 << i)) ++ { ++ dictSize = (2 << i); ++ break; ++ } ++ if (dictSize <= ((UInt32)3 << i)) ++ { ++ dictSize = (3 << i); ++ break; ++ } ++ } ++ ++ for (i = 0; i < 4; i++) ++ props[1 + i] = (Byte)(dictSize >> (8 * i)); ++ return SZ_OK; ++} ++ ++SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, ++ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ SRes res; ++ CLzmaEnc *p = (CLzmaEnc *)pp; ++ ++ CSeqOutStreamBuf outStream; ++ ++ LzmaEnc_SetInputBuf(p, src, srcLen); ++ ++ outStream.funcTable.Write = MyWrite; ++ outStream.data = dest; ++ outStream.rem = *destLen; ++ outStream.overflow = False; ++ ++ p->writeEndMark = writeEndMark; ++ ++ p->rc.outStream = &outStream.funcTable; ++ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); ++ if (res == SZ_OK) ++ res = LzmaEnc_Encode2(p, progress); ++ ++ *destLen -= outStream.rem; ++ if (outStream.overflow) ++ return SZ_ERROR_OUTPUT_EOF; ++ return res; ++} ++ ++SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, ++ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, ++ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) ++{ ++ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); ++ SRes res; ++ if (p == 0) ++ return SZ_ERROR_MEM; ++ ++ res = LzmaEnc_SetProps(p, props); ++ if (res == SZ_OK) ++ { ++ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); ++ if (res == SZ_OK) ++ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, ++ writeEndMark, progress, alloc, allocBig); ++ } ++ ++ LzmaEnc_Destroy(p, alloc, allocBig); ++ return res; ++} +--- /dev/null ++++ b/lib/lzma/Makefile +@@ -0,0 +1,7 @@ ++lzma_compress-objs := LzFind.o LzmaEnc.o ++lzma_decompress-objs := LzmaDec.o ++ ++obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o ++obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o ++ ++EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h diff --git a/target/linux/generic/pending-3.18/531-debloat_lzma.patch b/target/linux/generic/pending-3.18/531-debloat_lzma.patch new file mode 100644 index 000000000..aa3c49801 --- /dev/null +++ b/target/linux/generic/pending-3.18/531-debloat_lzma.patch @@ -0,0 +1,1024 @@ +--- a/include/linux/lzma/LzmaDec.h ++++ b/include/linux/lzma/LzmaDec.h +@@ -31,14 +31,6 @@ typedef struct _CLzmaProps + UInt32 dicSize; + } CLzmaProps; + +-/* LzmaProps_Decode - decodes properties +-Returns: +- SZ_OK +- SZ_ERROR_UNSUPPORTED - Unsupported properties +-*/ +- +-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); +- + + /* ---------- LZMA Decoder state ---------- */ + +@@ -70,8 +62,6 @@ typedef struct + + #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } + +-void LzmaDec_Init(CLzmaDec *p); +- + /* There are two types of LZMA streams: + 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. + 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ +@@ -108,97 +98,6 @@ typedef enum + + /* ELzmaStatus is used only as output value for function call */ + +- +-/* ---------- Interfaces ---------- */ +- +-/* There are 3 levels of interfaces: +- 1) Dictionary Interface +- 2) Buffer Interface +- 3) One Call Interface +- You can select any of these interfaces, but don't mix functions from different +- groups for same object. */ +- +- +-/* There are two variants to allocate state for Dictionary Interface: +- 1) LzmaDec_Allocate / LzmaDec_Free +- 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs +- You can use variant 2, if you set dictionary buffer manually. +- For Buffer Interface you must always use variant 1. +- +-LzmaDec_Allocate* can return: +- SZ_OK +- SZ_ERROR_MEM - Memory allocation error +- SZ_ERROR_UNSUPPORTED - Unsupported properties +-*/ +- +-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); +-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); +- +-SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); +-void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); +- +-/* ---------- Dictionary Interface ---------- */ +- +-/* You can use it, if you want to eliminate the overhead for data copying from +- dictionary to some other external buffer. +- You must work with CLzmaDec variables directly in this interface. +- +- STEPS: +- LzmaDec_Constr() +- LzmaDec_Allocate() +- for (each new stream) +- { +- LzmaDec_Init() +- while (it needs more decompression) +- { +- LzmaDec_DecodeToDic() +- use data from CLzmaDec::dic and update CLzmaDec::dicPos +- } +- } +- LzmaDec_Free() +-*/ +- +-/* LzmaDec_DecodeToDic +- +- The decoding to internal dictionary buffer (CLzmaDec::dic). +- You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! +- +-finishMode: +- It has meaning only if the decoding reaches output limit (dicLimit). +- LZMA_FINISH_ANY - Decode just dicLimit bytes. +- LZMA_FINISH_END - Stream must be finished after dicLimit. +- +-Returns: +- SZ_OK +- status: +- LZMA_STATUS_FINISHED_WITH_MARK +- LZMA_STATUS_NOT_FINISHED +- LZMA_STATUS_NEEDS_MORE_INPUT +- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK +- SZ_ERROR_DATA - Data error +-*/ +- +-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, +- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); +- +- +-/* ---------- Buffer Interface ---------- */ +- +-/* It's zlib-like interface. +- See LzmaDec_DecodeToDic description for information about STEPS and return results, +- but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need +- to work with CLzmaDec variables manually. +- +-finishMode: +- It has meaning only if the decoding reaches output limit (*destLen). +- LZMA_FINISH_ANY - Decode just destLen bytes. +- LZMA_FINISH_END - Stream must be finished after (*destLen). +-*/ +- +-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, +- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); +- +- + /* ---------- One Call Interface ---------- */ + + /* LzmaDecode +--- a/lib/lzma/LzmaDec.c ++++ b/lib/lzma/LzmaDec.c +@@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p, + p->needFlush = 0; + } + +-void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) ++static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) + { + p->needFlush = 1; + p->remainLen = 0; +@@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p + p->needInitState = 1; + } + +-void LzmaDec_Init(CLzmaDec *p) ++static void LzmaDec_Init(CLzmaDec *p) + { + p->dicPos = 0; + LzmaDec_InitDicAndState(p, True, True); +@@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD + p->needInitState = 0; + } + +-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ++static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, + ELzmaFinishMode finishMode, ELzmaStatus *status) + { + SizeT inSize = *srcLen; +@@ -837,65 +837,13 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si + return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; + } + +-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +-{ +- SizeT outSize = *destLen; +- SizeT inSize = *srcLen; +- *srcLen = *destLen = 0; +- for (;;) +- { +- SizeT inSizeCur = inSize, outSizeCur, dicPos; +- ELzmaFinishMode curFinishMode; +- SRes res; +- if (p->dicPos == p->dicBufSize) +- p->dicPos = 0; +- dicPos = p->dicPos; +- if (outSize > p->dicBufSize - dicPos) +- { +- outSizeCur = p->dicBufSize; +- curFinishMode = LZMA_FINISH_ANY; +- } +- else +- { +- outSizeCur = dicPos + outSize; +- curFinishMode = finishMode; +- } +- +- res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); +- src += inSizeCur; +- inSize -= inSizeCur; +- *srcLen += inSizeCur; +- outSizeCur = p->dicPos - dicPos; +- memcpy(dest, p->dic + dicPos, outSizeCur); +- dest += outSizeCur; +- outSize -= outSizeCur; +- *destLen += outSizeCur; +- if (res != 0) +- return res; +- if (outSizeCur == 0 || outSize == 0) +- return SZ_OK; +- } +-} +- +-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) ++static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) + { + alloc->Free(alloc, p->probs); + p->probs = 0; + } + +-static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) +-{ +- alloc->Free(alloc, p->dic); +- p->dic = 0; +-} +- +-void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) +-{ +- LzmaDec_FreeProbs(p, alloc); +- LzmaDec_FreeDict(p, alloc); +-} +- +-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) ++static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) + { + UInt32 dicSize; + Byte d; +@@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma + return SZ_OK; + } + +-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) ++static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) + { + CLzmaProps propNew; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); +@@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p, + p->prop = propNew; + return SZ_OK; + } +- +-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +-{ +- CLzmaProps propNew; +- SizeT dicBufSize; +- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); +- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); +- dicBufSize = propNew.dicSize; +- if (p->dic == 0 || dicBufSize != p->dicBufSize) +- { +- LzmaDec_FreeDict(p, alloc); +- p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); +- if (p->dic == 0) +- { +- LzmaDec_FreeProbs(p, alloc); +- return SZ_ERROR_MEM; +- } +- } +- p->dicBufSize = dicBufSize; +- p->prop = propNew; +- return SZ_OK; +-} + + SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, +--- a/include/linux/lzma/LzmaEnc.h ++++ b/include/linux/lzma/LzmaEnc.h +@@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps + } CLzmaEncProps; + + void LzmaEncProps_Init(CLzmaEncProps *p); +-void LzmaEncProps_Normalize(CLzmaEncProps *p); +-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); +- + + /* ---------- CLzmaEncHandle Interface ---------- */ + +@@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * + void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); + SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); + SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); +-SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, +- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); + SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); + +-/* ---------- One Call Interface ---------- */ +- +-/* LzmaEncode +-Return code: +- SZ_OK - OK +- SZ_ERROR_MEM - Memory allocation error +- SZ_ERROR_PARAM - Incorrect paramater +- SZ_ERROR_OUTPUT_EOF - output buffer overflow +- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +-*/ +- +-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, +- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, +- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); +- + #ifdef __cplusplus + } + #endif +--- a/lib/lzma/LzmaEnc.c ++++ b/lib/lzma/LzmaEnc.c +@@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) + p->writeEndMark = 0; + } + +-void LzmaEncProps_Normalize(CLzmaEncProps *p) ++static void LzmaEncProps_Normalize(CLzmaEncProps *p) + { + int level = p->level; + if (level < 0) level = 5; +@@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp + #endif + } + +-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) ++static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) + { + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); +@@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL + + #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } + +-UInt32 GetPosSlot1(UInt32 pos) ++static UInt32 GetPosSlot1(UInt32 pos) + { + UInt32 res; + BSR2_RET(pos, res); +@@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos) + #define kNumLogBits (9 + (int)sizeof(size_t) / 2) + #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) + +-void LzmaEnc_FastPosInit(Byte *g_FastPos) ++static void LzmaEnc_FastPosInit(Byte *g_FastPos) + { + int c = 2, slotFast; + g_FastPos[0] = 0; +@@ -339,58 +339,6 @@ typedef struct + CSaveState saveState; + } CLzmaEnc; + +-void LzmaEnc_SaveState(CLzmaEncHandle pp) +-{ +- CLzmaEnc *p = (CLzmaEnc *)pp; +- CSaveState *dest = &p->saveState; +- int i; +- dest->lenEnc = p->lenEnc; +- dest->repLenEnc = p->repLenEnc; +- dest->state = p->state; +- +- for (i = 0; i < kNumStates; i++) +- { +- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); +- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); +- } +- for (i = 0; i < kNumLenToPosStates; i++) +- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); +- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); +- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); +- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); +- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); +- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); +- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); +- memcpy(dest->reps, p->reps, sizeof(p->reps)); +- memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); +-} +- +-void LzmaEnc_RestoreState(CLzmaEncHandle pp) +-{ +- CLzmaEnc *dest = (CLzmaEnc *)pp; +- const CSaveState *p = &dest->saveState; +- int i; +- dest->lenEnc = p->lenEnc; +- dest->repLenEnc = p->repLenEnc; +- dest->state = p->state; +- +- for (i = 0; i < kNumStates; i++) +- { +- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); +- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); +- } +- for (i = 0; i < kNumLenToPosStates; i++) +- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); +- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); +- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); +- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); +- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); +- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); +- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); +- memcpy(dest->reps, p->reps, sizeof(p->reps)); +- memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); +-} +- + SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) + { + CLzmaEnc *p = (CLzmaEnc *)pp; +@@ -600,7 +548,7 @@ static void LitEnc_EncodeMatched(CRangeE + while (symbol < 0x10000); + } + +-void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) ++static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) + { + UInt32 i; + for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) +@@ -1676,7 +1624,7 @@ static void FillDistancesPrices(CLzmaEnc + p->matchPriceCount = 0; + } + +-void LzmaEnc_Construct(CLzmaEnc *p) ++static void LzmaEnc_Construct(CLzmaEnc *p) + { + RangeEnc_Construct(&p->rc); + MatchFinder_Construct(&p->matchFinderBase); +@@ -1709,7 +1657,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * + return p; + } + +-void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) ++static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) + { + alloc->Free(alloc, p->litProbs); + alloc->Free(alloc, p->saveState.litProbs); +@@ -1717,7 +1665,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAl + p->saveState.litProbs = 0; + } + +-void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) ++static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) + { + #ifndef _7ZIP_ST + MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); +@@ -1947,7 +1895,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U + return SZ_OK; + } + +-void LzmaEnc_Init(CLzmaEnc *p) ++static void LzmaEnc_Init(CLzmaEnc *p) + { + UInt32 i; + p->state = 0; +@@ -2005,7 +1953,7 @@ void LzmaEnc_Init(CLzmaEnc *p) + p->lpMask = (1 << p->lp) - 1; + } + +-void LzmaEnc_InitPrices(CLzmaEnc *p) ++static void LzmaEnc_InitPrices(CLzmaEnc *p) + { + if (!p->fastMode) + { +@@ -2037,26 +1985,6 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn + return SZ_OK; + } + +-static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, +- ISzAlloc *alloc, ISzAlloc *allocBig) +-{ +- CLzmaEnc *p = (CLzmaEnc *)pp; +- p->matchFinderBase.stream = inStream; +- p->needInit = 1; +- p->rc.outStream = outStream; +- return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); +-} +- +-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, +- ISeqInStream *inStream, UInt32 keepWindowSize, +- ISzAlloc *alloc, ISzAlloc *allocBig) +-{ +- CLzmaEnc *p = (CLzmaEnc *)pp; +- p->matchFinderBase.stream = inStream; +- p->needInit = 1; +- return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +-} +- + static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) + { + p->matchFinderBase.directInput = 1; +@@ -2064,7 +1992,7 @@ static void LzmaEnc_SetInputBuf(CLzmaEnc + p->matchFinderBase.directInputRem = srcLen; + } + +-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, ++static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) + { + CLzmaEnc *p = (CLzmaEnc *)pp; +@@ -2074,7 +2002,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); + } + +-void LzmaEnc_Finish(CLzmaEncHandle pp) ++static void LzmaEnc_Finish(CLzmaEncHandle pp) + { + #ifndef _7ZIP_ST + CLzmaEnc *p = (CLzmaEnc *)pp; +@@ -2107,53 +2035,6 @@ static size_t MyWrite(void *pp, const vo + return size; + } + +- +-UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) +-{ +- const CLzmaEnc *p = (CLzmaEnc *)pp; +- return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); +-} +- +-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) +-{ +- const CLzmaEnc *p = (CLzmaEnc *)pp; +- return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; +-} +- +-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, +- Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) +-{ +- CLzmaEnc *p = (CLzmaEnc *)pp; +- UInt64 nowPos64; +- SRes res; +- CSeqOutStreamBuf outStream; +- +- outStream.funcTable.Write = MyWrite; +- outStream.data = dest; +- outStream.rem = *destLen; +- outStream.overflow = False; +- +- p->writeEndMark = False; +- p->finished = False; +- p->result = SZ_OK; +- +- if (reInit) +- LzmaEnc_Init(p); +- LzmaEnc_InitPrices(p); +- nowPos64 = p->nowPos64; +- RangeEnc_Init(&p->rc); +- p->rc.outStream = &outStream.funcTable; +- +- res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); +- +- *unpackSize = (UInt32)(p->nowPos64 - nowPos64); +- *destLen -= outStream.rem; +- if (outStream.overflow) +- return SZ_ERROR_OUTPUT_EOF; +- +- return res; +-} +- + static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) + { + SRes res = SZ_OK; +@@ -2184,13 +2065,6 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, + return res; + } + +-SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, +- ISzAlloc *alloc, ISzAlloc *allocBig) +-{ +- RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); +- return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); +-} +- + SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) + { + CLzmaEnc *p = (CLzmaEnc *)pp; +@@ -2247,25 +2121,3 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp + return SZ_ERROR_OUTPUT_EOF; + return res; + } +- +-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, +- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, +- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +-{ +- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); +- SRes res; +- if (p == 0) +- return SZ_ERROR_MEM; +- +- res = LzmaEnc_SetProps(p, props); +- if (res == SZ_OK) +- { +- res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); +- if (res == SZ_OK) +- res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, +- writeEndMark, progress, alloc, allocBig); +- } +- +- LzmaEnc_Destroy(p, alloc, allocBig); +- return res; +-} +--- a/include/linux/lzma/LzFind.h ++++ b/include/linux/lzma/LzFind.h +@@ -55,11 +55,6 @@ typedef struct _CMatchFinder + + #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) + +-int MatchFinder_NeedMove(CMatchFinder *p); +-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); +-void MatchFinder_MoveBlock(CMatchFinder *p); +-void MatchFinder_ReadIfRequired(CMatchFinder *p); +- + void MatchFinder_Construct(CMatchFinder *p); + + /* Conditions: +@@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p, + UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, + ISzAlloc *alloc); + void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); +-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); +-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); +- +-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, +- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, +- UInt32 *distances, UInt32 maxLen); + + /* + Conditions: +@@ -102,12 +91,6 @@ typedef struct _IMatchFinder + + void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); + +-void MatchFinder_Init(CMatchFinder *p); +-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); +-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); +-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); +-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); +- + #ifdef __cplusplus + } + #endif +--- a/lib/lzma/LzFind.c ++++ b/lib/lzma/LzFind.c +@@ -14,9 +14,15 @@ + + #define kStartMaxLen 3 + ++#if 0 ++#define DIRECT_INPUT p->directInput ++#else ++#define DIRECT_INPUT 1 ++#endif ++ + static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) + { +- if (!p->directInput) ++ if (!DIRECT_INPUT) + { + alloc->Free(alloc, p->bufferBase); + p->bufferBase = 0; +@@ -28,7 +34,7 @@ static void LzInWindow_Free(CMatchFinder + static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) + { + UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; +- if (p->directInput) ++ if (DIRECT_INPUT) + { + p->blockSize = blockSize; + return 1; +@@ -42,12 +48,12 @@ static int LzInWindow_Create(CMatchFinde + return (p->bufferBase != 0); + } + +-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } +-Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } ++static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } ++static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } + +-UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } ++static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } + +-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) ++static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) + { + p->posLimit -= subValue; + p->pos -= subValue; +@@ -58,7 +64,7 @@ static void MatchFinder_ReadBlock(CMatch + { + if (p->streamEndWasReached || p->result != SZ_OK) + return; +- if (p->directInput) ++ if (DIRECT_INPUT) + { + UInt32 curSize = 0xFFFFFFFF - p->streamPos; + if (curSize > p->directInputRem) +@@ -89,7 +95,7 @@ static void MatchFinder_ReadBlock(CMatch + } + } + +-void MatchFinder_MoveBlock(CMatchFinder *p) ++static void MatchFinder_MoveBlock(CMatchFinder *p) + { + memmove(p->bufferBase, + p->buffer - p->keepSizeBefore, +@@ -97,22 +103,14 @@ void MatchFinder_MoveBlock(CMatchFinder + p->buffer = p->bufferBase + p->keepSizeBefore; + } + +-int MatchFinder_NeedMove(CMatchFinder *p) ++static int MatchFinder_NeedMove(CMatchFinder *p) + { +- if (p->directInput) ++ if (DIRECT_INPUT) + return 0; + /* if (p->streamEndWasReached) return 0; */ + return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); + } + +-void MatchFinder_ReadIfRequired(CMatchFinder *p) +-{ +- if (p->streamEndWasReached) +- return; +- if (p->keepSizeAfter >= p->streamPos - p->pos) +- MatchFinder_ReadBlock(p); +-} +- + static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) + { + if (MatchFinder_NeedMove(p)) +@@ -268,7 +266,7 @@ static void MatchFinder_SetLimits(CMatch + p->posLimit = p->pos + limit; + } + +-void MatchFinder_Init(CMatchFinder *p) ++static void MatchFinder_Init(CMatchFinder *p) + { + UInt32 i; + for (i = 0; i < p->hashSizeSum; i++) +@@ -287,7 +285,7 @@ static UInt32 MatchFinder_GetSubValue(CM + return (p->pos - p->historySize - 1) & kNormalizeMask; + } + +-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) ++static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) + { + UInt32 i; + for (i = 0; i < numItems; i++) +@@ -319,38 +317,7 @@ static void MatchFinder_CheckLimits(CMat + MatchFinder_SetLimits(p); + } + +-static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, +- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, +- UInt32 *distances, UInt32 maxLen) +-{ +- son[_cyclicBufferPos] = curMatch; +- for (;;) +- { +- UInt32 delta = pos - curMatch; +- if (cutValue-- == 0 || delta >= _cyclicBufferSize) +- return distances; +- { +- const Byte *pb = cur - delta; +- curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; +- if (pb[maxLen] == cur[maxLen] && *pb == *cur) +- { +- UInt32 len = 0; +- while (++len != lenLimit) +- if (pb[len] != cur[len]) +- break; +- if (maxLen < len) +- { +- *distances++ = maxLen = len; +- *distances++ = delta - 1; +- if (len == lenLimit) +- return distances; +- } +- } +- } +- } +-} +- +-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, ++static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) + { +@@ -460,10 +427,10 @@ static void SkipMatchesSpec(UInt32 lenLi + p->buffer++; \ + if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); + +-#define MOVE_POS_RET MOVE_POS return offset; +- + static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } + ++#define MOVE_POS_RET MatchFinder_MovePos(p); return offset; ++ + #define GET_MATCHES_HEADER2(minLen, ret_op) \ + UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ + lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ +@@ -479,62 +446,7 @@ static void MatchFinder_MovePos(CMatchFi + distances + offset, maxLen) - distances); MOVE_POS_RET; + + #define SKIP_FOOTER \ +- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; +- +-static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +-{ +- UInt32 offset; +- GET_MATCHES_HEADER(2) +- HASH2_CALC; +- curMatch = p->hash[hashValue]; +- p->hash[hashValue] = p->pos; +- offset = 0; +- GET_MATCHES_FOOTER(offset, 1) +-} +- +-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +-{ +- UInt32 offset; +- GET_MATCHES_HEADER(3) +- HASH_ZIP_CALC; +- curMatch = p->hash[hashValue]; +- p->hash[hashValue] = p->pos; +- offset = 0; +- GET_MATCHES_FOOTER(offset, 2) +-} +- +-static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +-{ +- UInt32 hash2Value, delta2, maxLen, offset; +- GET_MATCHES_HEADER(3) +- +- HASH3_CALC; +- +- delta2 = p->pos - p->hash[hash2Value]; +- curMatch = p->hash[kFix3HashSize + hashValue]; +- +- p->hash[hash2Value] = +- p->hash[kFix3HashSize + hashValue] = p->pos; +- +- +- maxLen = 2; +- offset = 0; +- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) +- { +- for (; maxLen != lenLimit; maxLen++) +- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) +- break; +- distances[0] = maxLen; +- distances[1] = delta2 - 1; +- offset = 2; +- if (maxLen == lenLimit) +- { +- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); +- MOVE_POS_RET; +- } +- } +- GET_MATCHES_FOOTER(offset, maxLen) +-} ++ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MatchFinder_MovePos(p); + + static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) + { +@@ -583,108 +495,6 @@ static UInt32 Bt4_MatchFinder_GetMatches + GET_MATCHES_FOOTER(offset, maxLen) + } + +-static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +-{ +- UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; +- GET_MATCHES_HEADER(4) +- +- HASH4_CALC; +- +- delta2 = p->pos - p->hash[ hash2Value]; +- delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; +- curMatch = p->hash[kFix4HashSize + hashValue]; +- +- p->hash[ hash2Value] = +- p->hash[kFix3HashSize + hash3Value] = +- p->hash[kFix4HashSize + hashValue] = p->pos; +- +- maxLen = 1; +- offset = 0; +- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) +- { +- distances[0] = maxLen = 2; +- distances[1] = delta2 - 1; +- offset = 2; +- } +- if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) +- { +- maxLen = 3; +- distances[offset + 1] = delta3 - 1; +- offset += 2; +- delta2 = delta3; +- } +- if (offset != 0) +- { +- for (; maxLen != lenLimit; maxLen++) +- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) +- break; +- distances[offset - 2] = maxLen; +- if (maxLen == lenLimit) +- { +- p->son[p->cyclicBufferPos] = curMatch; +- MOVE_POS_RET; +- } +- } +- if (maxLen < 3) +- maxLen = 3; +- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), +- distances + offset, maxLen) - (distances)); +- MOVE_POS_RET +-} +- +-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +-{ +- UInt32 offset; +- GET_MATCHES_HEADER(3) +- HASH_ZIP_CALC; +- curMatch = p->hash[hashValue]; +- p->hash[hashValue] = p->pos; +- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), +- distances, 2) - (distances)); +- MOVE_POS_RET +-} +- +-static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +-{ +- do +- { +- SKIP_HEADER(2) +- HASH2_CALC; +- curMatch = p->hash[hashValue]; +- p->hash[hashValue] = p->pos; +- SKIP_FOOTER +- } +- while (--num != 0); +-} +- +-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +-{ +- do +- { +- SKIP_HEADER(3) +- HASH_ZIP_CALC; +- curMatch = p->hash[hashValue]; +- p->hash[hashValue] = p->pos; +- SKIP_FOOTER +- } +- while (--num != 0); +-} +- +-static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +-{ +- do +- { +- UInt32 hash2Value; +- SKIP_HEADER(3) +- HASH3_CALC; +- curMatch = p->hash[kFix3HashSize + hashValue]; +- p->hash[hash2Value] = +- p->hash[kFix3HashSize + hashValue] = p->pos; +- SKIP_FOOTER +- } +- while (--num != 0); +-} +- + static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) + { + do +@@ -701,61 +511,12 @@ static void Bt4_MatchFinder_Skip(CMatchF + while (--num != 0); + } + +-static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +-{ +- do +- { +- UInt32 hash2Value, hash3Value; +- SKIP_HEADER(4) +- HASH4_CALC; +- curMatch = p->hash[kFix4HashSize + hashValue]; +- p->hash[ hash2Value] = +- p->hash[kFix3HashSize + hash3Value] = +- p->hash[kFix4HashSize + hashValue] = p->pos; +- p->son[p->cyclicBufferPos] = curMatch; +- MOVE_POS +- } +- while (--num != 0); +-} +- +-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +-{ +- do +- { +- SKIP_HEADER(3) +- HASH_ZIP_CALC; +- curMatch = p->hash[hashValue]; +- p->hash[hashValue] = p->pos; +- p->son[p->cyclicBufferPos] = curMatch; +- MOVE_POS +- } +- while (--num != 0); +-} +- + void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) + { + vTable->Init = (Mf_Init_Func)MatchFinder_Init; + vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; + vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; + vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; +- if (!p->btMode) +- { +- vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; +- vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; +- } +- else if (p->numHashBytes == 2) +- { +- vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; +- vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; +- } +- else if (p->numHashBytes == 3) +- { +- vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; +- vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; +- } +- else +- { +- vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; +- vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; +- } ++ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; ++ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; + } diff --git a/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch b/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch new file mode 100644 index 000000000..8ce53d8be --- /dev/null +++ b/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch @@ -0,0 +1,56 @@ +--- a/fs/jffs2/build.c ++++ b/fs/jffs2/build.c +@@ -116,6 +116,16 @@ static int jffs2_build_filesystem(struct + dbg_fsbuild("scanned flash completely\n"); + jffs2_dbg_dump_block_lists_nolock(c); + ++ if (c->flags & (1 << 7)) { ++ printk("%s(): unlocking the mtd device... ", __func__); ++ mtd_unlock(c->mtd, 0, c->mtd->size); ++ printk("done.\n"); ++ ++ printk("%s(): erasing all blocks after the end marker... ", __func__); ++ jffs2_erase_pending_blocks(c, -1); ++ printk("done.\n"); ++ } ++ + dbg_fsbuild("pass 1 starting\n"); + c->flags |= JFFS2_SB_FLAG_BUILDING; + /* Now scan the directory tree, increasing nlink according to every dirent found. */ +--- a/fs/jffs2/scan.c ++++ b/fs/jffs2/scan.c +@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in + /* reset summary info for next eraseblock scan */ + jffs2_sum_reset_collected(s); + +- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), +- buf_size, s); ++ if (c->flags & (1 << 7)) { ++ if (mtd_block_isbad(c->mtd, jeb->offset)) ++ ret = BLK_STATE_BADBLOCK; ++ else ++ ret = BLK_STATE_ALLFF; ++ } else ++ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), ++ buf_size, s); + + if (ret < 0) + goto out; +@@ -561,6 +567,17 @@ full_scan: + return err; + } + ++ if ((buf[0] == 0xde) && ++ (buf[1] == 0xad) && ++ (buf[2] == 0xc0) && ++ (buf[3] == 0xde)) { ++ /* end of filesystem. erase everything after this point */ ++ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); ++ c->flags |= (1 << 7); ++ ++ return BLK_STATE_ALLFF; ++ } ++ + /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ + ofs = 0; + max_ofs = EMPTY_SCAN_SIZE(c->sector_size); diff --git a/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch b/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch new file mode 100644 index 000000000..6e08ca302 --- /dev/null +++ b/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch @@ -0,0 +1,55 @@ +--- a/fs/ubifs/file.c ++++ b/fs/ubifs/file.c +@@ -1597,6 +1597,10 @@ const struct inode_operations ubifs_syml + .follow_link = ubifs_follow_link, + .setattr = ubifs_setattr, + .getattr = ubifs_getattr, ++ .setxattr = ubifs_setxattr, ++ .getxattr = ubifs_getxattr, ++ .listxattr = ubifs_listxattr, ++ .removexattr = ubifs_removexattr, + }; + + const struct file_operations ubifs_file_operations = { +--- a/fs/ubifs/journal.c ++++ b/fs/ubifs/journal.c +@@ -572,6 +572,13 @@ int ubifs_jnl_update(struct ubifs_info * + aligned_dlen = ALIGN(dlen, 8); + aligned_ilen = ALIGN(ilen, 8); + len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ; ++ if (xent) { ++ /* ++ * Make sure to account for host_ui->data_len in ++ * length calculation in case there is extended attribute. ++ */ ++ len += host_ui->data_len; ++ } + dent = kmalloc(len, GFP_NOFS); + if (!dent) + return -ENOMEM; +@@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info * + + ino_key_init(c, &ino_key, dir->i_ino); + ino_offs += aligned_ilen; +- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ); ++ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, ++ UBIFS_INO_NODE_SZ + host_ui->data_len); + if (err) + goto out_ro; + +--- a/fs/ubifs/xattr.c ++++ b/fs/ubifs/xattr.c +@@ -210,12 +210,12 @@ static int change_xattr(struct ubifs_inf + goto out_free; + } + inode->i_size = ui->ui_size = size; +- ui->data_len = size; + + mutex_lock(&host_ui->ui_mutex); + host->i_ctime = ubifs_current_time(host); + host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len); + host_ui->xattr_size += CALC_XATTR_BYTES(size); ++ ui->data_len = size; + + /* + * It is important to write the host inode after the xattr inode diff --git a/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch new file mode 100644 index 000000000..1b0f30718 --- /dev/null +++ b/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch @@ -0,0 +1,29 @@ +--- a/fs/ubifs/sb.c ++++ b/fs/ubifs/sb.c +@@ -63,6 +63,17 @@ + /* Default time granularity in nanoseconds */ + #define DEFAULT_TIME_GRAN 1000000000 + ++static int get_default_compressor(void) ++{ ++ if (ubifs_compr_present(UBIFS_COMPR_LZO)) ++ return UBIFS_COMPR_LZO; ++ ++ if (ubifs_compr_present(UBIFS_COMPR_ZLIB)) ++ return UBIFS_COMPR_ZLIB; ++ ++ return UBIFS_COMPR_NONE; ++} ++ + /** + * create_default_filesystem - format empty UBI volume. + * @c: UBIFS file-system description object +@@ -183,7 +194,7 @@ static int create_default_filesystem(str + if (c->mount_opts.override_compr) + sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); + else +- sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO); ++ sup->default_compr = cpu_to_le16(get_default_compressor()); + + generate_random_uuid(sup->uuid); + diff --git a/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch b/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch new file mode 100644 index 000000000..bc6ed3e5d --- /dev/null +++ b/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch @@ -0,0 +1,86 @@ +--- a/net/netfilter/nf_conntrack_standalone.c ++++ b/net/netfilter/nf_conntrack_standalone.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + #ifdef CONFIG_SYSCTL + #include +@@ -262,10 +263,66 @@ static int ct_open(struct inode *inode, + sizeof(struct ct_iter_state)); + } + ++struct kill_request { ++ u16 family; ++ union nf_inet_addr addr; ++}; ++ ++static int kill_matching(struct nf_conn *i, void *data) ++{ ++ struct kill_request *kr = data; ++ struct nf_conntrack_tuple *t1 = &i->tuplehash[IP_CT_DIR_ORIGINAL].tuple; ++ struct nf_conntrack_tuple *t2 = &i->tuplehash[IP_CT_DIR_REPLY].tuple; ++ ++ if (!kr->family) ++ return 1; ++ ++ if (t1->src.l3num != kr->family) ++ return 0; ++ ++ return (nf_inet_addr_cmp(&kr->addr, &t1->src.u3) || ++ nf_inet_addr_cmp(&kr->addr, &t1->dst.u3) || ++ nf_inet_addr_cmp(&kr->addr, &t2->src.u3) || ++ nf_inet_addr_cmp(&kr->addr, &t2->dst.u3)); ++} ++ ++static ssize_t ct_file_write(struct file *file, const char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ struct seq_file *seq = file->private_data; ++ struct net *net = seq_file_net(seq); ++ struct kill_request kr = { }; ++ char req[INET6_ADDRSTRLEN] = { }; ++ ++ if (count == 0) ++ return 0; ++ ++ if (count >= INET6_ADDRSTRLEN) ++ count = INET6_ADDRSTRLEN - 1; ++ ++ if (copy_from_user(req, buf, count)) ++ return -EFAULT; ++ ++ if (strnchr(req, count, ':')) { ++ kr.family = AF_INET6; ++ if (!in6_pton(req, count, (void *)&kr.addr, '\n', NULL)) ++ return -EINVAL; ++ } else if (strnchr(req, count, '.')) { ++ kr.family = AF_INET; ++ if (!in4_pton(req, count, (void *)&kr.addr, '\n', NULL)) ++ return -EINVAL; ++ } ++ ++ nf_ct_iterate_cleanup(net, kill_matching, &kr, 0, 0); ++ ++ return count; ++} ++ + static const struct file_operations ct_file_ops = { + .owner = THIS_MODULE, + .open = ct_open, + .read = seq_read, ++ .write = ct_file_write, + .llseek = seq_lseek, + .release = seq_release_net, + }; +@@ -367,7 +424,7 @@ static int nf_conntrack_standalone_init_ + { + struct proc_dir_entry *pde; + +- pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops); ++ pde = proc_create("nf_conntrack", 0660, net->proc_net, &ct_file_ops); + if (!pde) + goto out_nf_conntrack; + diff --git a/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch new file mode 100644 index 000000000..b96402fd3 --- /dev/null +++ b/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch @@ -0,0 +1,101 @@ +--- a/include/uapi/linux/netfilter_ipv4/ip_tables.h ++++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h +@@ -87,6 +87,7 @@ struct ipt_ip { + #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ + #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ + #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ ++#define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */ + + /* Values for "inv" field in struct ipt_ip. */ + #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ +--- a/net/ipv4/netfilter/ip_tables.c ++++ b/net/ipv4/netfilter/ip_tables.c +@@ -82,6 +82,9 @@ ip_packet_match(const struct iphdr *ip, + + #define FWINV(bool, invflg) ((bool) ^ !!(ipinfo->invflags & (invflg))) + ++ if (ipinfo->flags & IPT_F_NO_DEF_MATCH) ++ return true; ++ + if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, + IPT_INV_SRCIP) || + FWINV((ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, +@@ -135,6 +138,29 @@ ip_packet_match(const struct iphdr *ip, + return true; + } + ++static void ++ip_checkdefault(struct ipt_ip *ip) ++{ ++ static const char iface_mask[IFNAMSIZ] = {}; ++ ++ if (ip->invflags || ip->flags & IPT_F_FRAG) ++ return; ++ ++ if (memcmp(ip->iniface_mask, iface_mask, IFNAMSIZ) != 0) ++ return; ++ ++ if (memcmp(ip->outiface_mask, iface_mask, IFNAMSIZ) != 0) ++ return; ++ ++ if (ip->smsk.s_addr || ip->dmsk.s_addr) ++ return; ++ ++ if (ip->proto) ++ return; ++ ++ ip->flags |= IPT_F_NO_DEF_MATCH; ++} ++ + static bool + ip_checkentry(const struct ipt_ip *ip) + { +@@ -650,6 +676,8 @@ find_check_entry(struct ipt_entry *e, st + struct xt_mtchk_param mtpar; + struct xt_entry_match *ematch; + ++ ip_checkdefault(&e->ip); ++ + j = 0; + memset(&mtpar, 0, sizeof(mtpar)); + mtpar.net = net; +@@ -943,6 +971,7 @@ copy_entries_to_user(unsigned int total_ + const struct xt_table_info *private = table->private; + int ret = 0; + const void *loc_cpu_entry; ++ u8 flags; + + counters = alloc_counters(table); + if (IS_ERR(counters)) +@@ -974,6 +1003,14 @@ copy_entries_to_user(unsigned int total_ + goto free_counters; + } + ++ flags = e->ip.flags & IPT_F_MASK; ++ if (copy_to_user(userptr + off ++ + offsetof(struct ipt_entry, ip.flags), ++ &flags, sizeof(flags)) != 0) { ++ ret = -EFAULT; ++ goto free_counters; ++ } ++ + for (i = sizeof(struct ipt_entry); + i < e->target_offset; + i += m->u.match_size) { +@@ -1380,12 +1417,15 @@ compat_copy_entry_to_user(struct ipt_ent + compat_uint_t origsize; + const struct xt_entry_match *ematch; + int ret = 0; ++ u8 flags = e->ip.flags & IPT_F_MASK; + + origsize = *size; + ce = (struct compat_ipt_entry __user *)*dstptr; + if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 || + copy_to_user(&ce->counters, &counters[i], +- sizeof(counters[i])) != 0) ++ sizeof(counters[i])) != 0 || ++ copy_to_user(&ce->ip.flags, &flags, ++ sizeof(flags)) != 0) + return -EFAULT; + + *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch new file mode 100644 index 000000000..ef993c864 --- /dev/null +++ b/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch @@ -0,0 +1,94 @@ +--- a/net/ipv4/netfilter/ip_tables.c ++++ b/net/ipv4/netfilter/ip_tables.c +@@ -310,6 +310,33 @@ struct ipt_entry *ipt_next_entry(const s + return (void *)entry + entry->next_offset; + } + ++static bool ++ipt_handle_default_rule(struct ipt_entry *e, unsigned int *verdict) ++{ ++ struct xt_entry_target *t; ++ struct xt_standard_target *st; ++ ++ if (e->target_offset != sizeof(struct ipt_entry)) ++ return false; ++ ++ if (!(e->ip.flags & IPT_F_NO_DEF_MATCH)) ++ return false; ++ ++ t = ipt_get_target(e); ++ if (t->u.kernel.target->target) ++ return false; ++ ++ st = (struct xt_standard_target *) t; ++ if (st->verdict == XT_RETURN) ++ return false; ++ ++ if (st->verdict >= 0) ++ return false; ++ ++ *verdict = (unsigned)(-st->verdict) - 1; ++ return true; ++} ++ + /* Returns one of the generic firewall policies, like NF_ACCEPT. */ + unsigned int + ipt_do_table(struct sk_buff *skb, +@@ -331,9 +358,33 @@ ipt_do_table(struct sk_buff *skb, + unsigned int addend; + + /* Initialization */ ++ IP_NF_ASSERT(table->valid_hooks & (1 << hook)); ++ local_bh_disable(); ++ private = table->private; ++ cpu = smp_processor_id(); ++ /* ++ * Ensure we load private-> members after we've fetched the base ++ * pointer. ++ */ ++ smp_read_barrier_depends(); ++ table_base = private->entries[cpu]; ++ ++ e = get_entry(table_base, private->hook_entry[hook]); ++ if (ipt_handle_default_rule(e, &verdict)) { ++ ADD_COUNTER(e->counters, skb->len, 1); ++ local_bh_enable(); ++ return verdict; ++ } ++ + ip = ip_hdr(skb); + indev = in ? in->name : nulldevname; + outdev = out ? out->name : nulldevname; ++ ++ addend = xt_write_recseq_begin(); ++ jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; ++ stackptr = per_cpu_ptr(private->stackptr, cpu); ++ origptr = *stackptr; ++ + /* We handle fragments by dealing with the first fragment as + * if it was a normal packet. All other fragments are treated + * normally, except that they will NEVER match rules that ask +@@ -348,23 +399,6 @@ ipt_do_table(struct sk_buff *skb, + acpar.family = NFPROTO_IPV4; + acpar.hooknum = hook; + +- IP_NF_ASSERT(table->valid_hooks & (1 << hook)); +- local_bh_disable(); +- addend = xt_write_recseq_begin(); +- private = table->private; +- cpu = smp_processor_id(); +- /* +- * Ensure we load private-> members after we've fetched the base +- * pointer. +- */ +- smp_read_barrier_depends(); +- table_base = private->entries[cpu]; +- jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; +- stackptr = per_cpu_ptr(private->stackptr, cpu); +- origptr = *stackptr; +- +- e = get_entry(table_base, private->hook_entry[hook]); +- + pr_debug("Entering %s(hook %u); sp at %u (UF %p)\n", + table->name, hook, origptr, + get_entry(table_base, private->underflow[hook])); diff --git a/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch new file mode 100644 index 000000000..72172d8bb --- /dev/null +++ b/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch @@ -0,0 +1,16 @@ +--- a/net/ipv4/netfilter/ip_tables.c ++++ b/net/ipv4/netfilter/ip_tables.c +@@ -85,9 +85,11 @@ ip_packet_match(const struct iphdr *ip, + if (ipinfo->flags & IPT_F_NO_DEF_MATCH) + return true; + +- if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, ++ if (FWINV(ipinfo->smsk.s_addr && ++ (ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, + IPT_INV_SRCIP) || +- FWINV((ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, ++ FWINV(ipinfo->dmsk.s_addr && ++ (ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, + IPT_INV_DSTIP)) { + dprintf("Source or dest mismatch.\n"); + diff --git a/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch new file mode 100644 index 000000000..1d3b37cc1 --- /dev/null +++ b/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch @@ -0,0 +1,36 @@ +--- a/net/netfilter/nf_conntrack_proto_tcp.c ++++ b/net/netfilter/nf_conntrack_proto_tcp.c +@@ -33,6 +33,9 @@ + #include + #include + ++/* Do not check the TCP window for incoming packets */ ++static int nf_ct_tcp_no_window_check __read_mostly = 1; ++ + /* "Be conservative in what you do, + be liberal in what you accept from others." + If it's non-zero, we mark only out of window RST segments as INVALID. */ +@@ -515,6 +518,9 @@ static bool tcp_in_window(const struct n + s32 receiver_offset; + bool res, in_recv_win; + ++ if (nf_ct_tcp_no_window_check) ++ return true; ++ + /* + * Get the required data from the packet. + */ +@@ -1452,6 +1458,13 @@ static struct ctl_table tcp_sysctl_table + .mode = 0644, + .proc_handler = proc_dointvec, + }, ++ { ++ .procname = "nf_conntrack_tcp_no_window_check", ++ .data = &nf_ct_tcp_no_window_check, ++ .maxlen = sizeof(unsigned int), ++ .mode = 0644, ++ .proc_handler = proc_dointvec, ++ }, + { } + }; + diff --git a/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch b/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch new file mode 100644 index 000000000..2a64d5420 --- /dev/null +++ b/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch @@ -0,0 +1,12 @@ +--- a/net/netfilter/nf_nat_core.c ++++ b/net/netfilter/nf_nat_core.c +@@ -90,6 +90,9 @@ int nf_xfrm_me_harder(struct sk_buff *sk + struct dst_entry *dst; + int err; + ++ if (skb->dev && !dev_net(skb->dev)->xfrm.policy_count[XFRM_POLICY_OUT]) ++ return 0; ++ + err = xfrm_decode_session(skb, &fl, family); + if (err < 0) + return err; diff --git a/target/linux/generic/pending-3.18/621-sched_act_connmark.patch b/target/linux/generic/pending-3.18/621-sched_act_connmark.patch new file mode 100644 index 000000000..72d8e5343 --- /dev/null +++ b/target/linux/generic/pending-3.18/621-sched_act_connmark.patch @@ -0,0 +1,161 @@ +--- /dev/null ++++ b/net/sched/act_connmark.c +@@ -0,0 +1,126 @@ ++/* ++ * Copyright (c) 2011 Felix Fietkau ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License along with ++ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ++ * Place - Suite 330, Boston, MA 02111-1307 USA. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#define TCA_ACT_CONNMARK 20 ++ ++#define CONNMARK_TAB_MASK 3 ++ ++static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a, ++ struct tcf_result *res) ++{ ++ struct nf_conn *c; ++ enum ip_conntrack_info ctinfo; ++ int proto; ++ int r; ++ ++ if (skb->protocol == htons(ETH_P_IP)) { ++ if (skb->len < sizeof(struct iphdr)) ++ goto out; ++ proto = PF_INET; ++ } else if (skb->protocol == htons(ETH_P_IPV6)) { ++ if (skb->len < sizeof(struct ipv6hdr)) ++ goto out; ++ proto = PF_INET6; ++ } else ++ goto out; ++ ++ r = nf_conntrack_in(dev_net(skb->dev), proto, NF_INET_PRE_ROUTING, skb); ++ if (r != NF_ACCEPT) ++ goto out; ++ ++ c = nf_ct_get(skb, &ctinfo); ++ if (!c) ++ goto out; ++ ++ skb->mark = c->mark; ++ nf_conntrack_put(skb->nfct); ++ skb->nfct = NULL; ++ ++out: ++ return TC_ACT_PIPE; ++} ++ ++static int tcf_connmark_init(struct net *net, struct nlattr *nla, ++ struct nlattr *est, struct tc_action *a, ++ int ovr, int bind) ++{ ++ int ret = 0; ++ ++ if (!tcf_hash_check(0, a, bind)) { ++ ret = tcf_hash_create(0, est, a, sizeof(struct tcf_common), bind); ++ if (ret) ++ return ret; ++ ++ tcf_hash_insert(a); ++ ret = ACT_P_CREATED; ++ } else { ++ if (!ovr) { ++ tcf_hash_release(a, bind); ++ return -EEXIST; ++ } ++ } ++ ++ return ret; ++} ++ ++static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, ++ int bind, int ref) ++{ ++ return skb->len; ++} ++ ++static struct tc_action_ops act_connmark_ops = { ++ .kind = "connmark", ++ .type = TCA_ACT_CONNMARK, ++ .owner = THIS_MODULE, ++ .act = tcf_connmark, ++ .dump = tcf_connmark_dump, ++ .init = tcf_connmark_init, ++}; ++ ++MODULE_AUTHOR("Felix Fietkau "); ++MODULE_DESCRIPTION("Connection tracking mark restoring"); ++MODULE_LICENSE("GPL"); ++ ++static int __init connmark_init_module(void) ++{ ++ ++ return tcf_register_action(&act_connmark_ops, CONNMARK_TAB_MASK); ++} ++ ++static void __exit connmark_cleanup_module(void) ++{ ++ tcf_unregister_action(&act_connmark_ops); ++} ++ ++module_init(connmark_init_module); ++module_exit(connmark_cleanup_module); +--- a/net/sched/Kconfig ++++ b/net/sched/Kconfig +@@ -686,6 +686,19 @@ config NET_ACT_CSUM + To compile this code as a module, choose M here: the + module will be called act_csum. + ++config NET_ACT_CONNMARK ++ tristate "Connection Tracking Marking" ++ depends on NET_CLS_ACT ++ depends on NF_CONNTRACK ++ depends on NF_CONNTRACK_MARK ++ ---help--- ++ Say Y here to restore the connmark from a scheduler action ++ ++ If unsure, say N. ++ ++ To compile this code as a module, choose M here: the ++ module will be called act_connmark. ++ + config NET_CLS_IND + bool "Incoming device classification" + depends on NET_CLS_U32 || NET_CLS_FW +--- a/net/sched/Makefile ++++ b/net/sched/Makefile +@@ -16,6 +16,7 @@ obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit + obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o + obj-$(CONFIG_NET_ACT_SKBEDIT) += act_skbedit.o + obj-$(CONFIG_NET_ACT_CSUM) += act_csum.o ++obj-$(CONFIG_NET_ACT_CONNMARK) += act_connmark.o + obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o + obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o + obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o diff --git a/target/linux/generic/pending-3.18/630-packet_socket_type.patch b/target/linux/generic/pending-3.18/630-packet_socket_type.patch new file mode 100644 index 000000000..81e296e03 --- /dev/null +++ b/target/linux/generic/pending-3.18/630-packet_socket_type.patch @@ -0,0 +1,134 @@ +This patch allows the user to specify desired packet types (outgoing, +broadcast, unicast, etc.) on packet sockets via setsockopt. +This can reduce the load in situations where only a limited number +of packet types are necessary + +Signed-off-by: Felix Fietkau + +--- a/include/uapi/linux/if_packet.h ++++ b/include/uapi/linux/if_packet.h +@@ -31,6 +31,8 @@ struct sockaddr_ll { + #define PACKET_KERNEL 7 /* To kernel space */ + /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ + #define PACKET_FASTROUTE 6 /* Fastrouted frame */ ++#define PACKET_MASK_ANY 0xffffffff /* mask for packet type bits */ ++ + + /* Packet socket options */ + +@@ -54,6 +56,7 @@ struct sockaddr_ll { + #define PACKET_FANOUT 18 + #define PACKET_TX_HAS_OFF 19 + #define PACKET_QDISC_BYPASS 20 ++#define PACKET_RECV_TYPE 21 + + #define PACKET_FANOUT_HASH 0 + #define PACKET_FANOUT_LB 1 +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -1551,6 +1551,7 @@ static int packet_rcv_spkt(struct sk_buf + { + struct sock *sk; + struct sockaddr_pkt *spkt; ++ struct packet_sock *po; + + /* + * When we registered the protocol we saved the socket in the data +@@ -1558,6 +1559,7 @@ static int packet_rcv_spkt(struct sk_buf + */ + + sk = pt->af_packet_priv; ++ po = pkt_sk(sk); + + /* + * Yank back the headers [hope the device set this +@@ -1570,7 +1572,7 @@ static int packet_rcv_spkt(struct sk_buf + * so that this procedure is noop. + */ + +- if (skb->pkt_type == PACKET_LOOPBACK) ++ if (!(po->pkt_type & (1 << skb->pkt_type))) + goto out; + + if (!net_eq(dev_net(dev), sock_net(sk))) +@@ -1769,12 +1771,12 @@ static int packet_rcv(struct sk_buff *sk + int skb_len = skb->len; + unsigned int snaplen, res; + +- if (skb->pkt_type == PACKET_LOOPBACK) +- goto drop; +- + sk = pt->af_packet_priv; + po = pkt_sk(sk); + ++ if (!(po->pkt_type & (1 << skb->pkt_type))) ++ goto drop; ++ + if (!net_eq(dev_net(dev), sock_net(sk))) + goto drop; + +@@ -1894,12 +1896,12 @@ static int tpacket_rcv(struct sk_buff *s + BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); + BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); + +- if (skb->pkt_type == PACKET_LOOPBACK) +- goto drop; +- + sk = pt->af_packet_priv; + po = pkt_sk(sk); + ++ if (!(po->pkt_type & (1 << skb->pkt_type))) ++ goto drop; ++ + if (!net_eq(dev_net(dev), sock_net(sk))) + goto drop; + +@@ -2862,6 +2864,7 @@ static int packet_create(struct net *net + spin_lock_init(&po->bind_lock); + mutex_init(&po->pg_vec_lock); + po->prot_hook.func = packet_rcv; ++ po->pkt_type = PACKET_MASK_ANY & ~(1 << PACKET_LOOPBACK); + + if (sock->type == SOCK_PACKET) + po->prot_hook.func = packet_rcv_spkt; +@@ -3485,6 +3488,16 @@ packet_setsockopt(struct socket *sock, i + po->xmit = val ? packet_direct_xmit : dev_queue_xmit; + return 0; + } ++ case PACKET_RECV_TYPE: ++ { ++ unsigned int val; ++ if (optlen != sizeof(val)) ++ return -EINVAL; ++ if (copy_from_user(&val, optval, sizeof(val))) ++ return -EFAULT; ++ po->pkt_type = val & ~BIT(PACKET_LOOPBACK); ++ return 0; ++ } + default: + return -ENOPROTOOPT; + } +@@ -3536,6 +3549,13 @@ static int packet_getsockopt(struct sock + case PACKET_VNET_HDR: + val = po->has_vnet_hdr; + break; ++ case PACKET_RECV_TYPE: ++ if (len > sizeof(unsigned int)) ++ len = sizeof(unsigned int); ++ val = po->pkt_type; ++ ++ data = &val; ++ break; + case PACKET_VERSION: + val = po->tp_version; + break; +--- a/net/packet/internal.h ++++ b/net/packet/internal.h +@@ -117,6 +117,7 @@ struct packet_sock { + struct net_device __rcu *cached_dev; + int (*xmit)(struct sk_buff *skb); + struct packet_type prot_hook ____cacheline_aligned_in_smp; ++ unsigned int pkt_type; + }; + + static struct packet_sock *pkt_sk(struct sock *sk) diff --git a/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch b/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch new file mode 100644 index 000000000..35802d63d --- /dev/null +++ b/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch @@ -0,0 +1,23 @@ +From: Felix Fietkau +Subject: [PATCH] bridge: no EAP forward + +When bridging, do not forward EAP frames to other ports, only deliver +them locally. +Fixes WPA authentication issues with multiples APs that are connected to +each other via bridges. +--- +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -97,7 +97,11 @@ int br_handle_frame_finish(struct sk_buf + + dst = NULL; + +- if (is_broadcast_ether_addr(dest)) { ++ if (skb->protocol == htons(ETH_P_PAE)) { ++ skb2 = skb; ++ /* Do not forward 802.1x/EAP frames */ ++ skb = NULL; ++ } else if (is_broadcast_ether_addr(dest)) { + skb2 = skb; + unicast = false; + } else if (is_multicast_ether_addr(dest)) { diff --git a/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch b/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch new file mode 100644 index 000000000..a822fb0dc --- /dev/null +++ b/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch @@ -0,0 +1,17 @@ +From: Felix Fietkau +Subject: [PATCH] bridge: always accept EAP + +Allow EAP frames to pass through bridges even in learning state. Fixes +issues with WDS. +--- +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -84,7 +84,7 @@ int br_handle_frame_finish(struct sk_buf + br_multicast_rcv(br, p, skb, vid)) + goto drop; + +- if (p->state == BR_STATE_LEARNING) ++ if ((p->state == BR_STATE_LEARNING) && skb->protocol != htons(ETH_P_PAE)) + goto drop; + + BR_INPUT_SKB_CB(skb)->brdev = br->dev; diff --git a/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch b/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch new file mode 100644 index 000000000..47f8eb160 --- /dev/null +++ b/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch @@ -0,0 +1,92 @@ +From: Felix Fietkau +Subject: [PATCH] bridge: port isolate + +Isolating individual bridge ports +--- +--- a/net/bridge/br_private.h ++++ b/net/bridge/br_private.h +@@ -172,6 +172,7 @@ struct net_bridge_port + #define BR_FLOOD 0x00000040 + #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING) + #define BR_PROMISC 0x00000080 ++#define BR_ISOLATE_MODE 0x00000100 + + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING + struct bridge_mcast_own_query ip4_own_query; +--- a/net/bridge/br_sysfs_if.c ++++ b/net/bridge/br_sysfs_if.c +@@ -170,6 +170,7 @@ BRPORT_ATTR_FLAG(bpdu_guard, BR_BPDU_GUA + BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLOCK); + BRPORT_ATTR_FLAG(learning, BR_LEARNING); + BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD); ++BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE); + + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING + static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) +@@ -213,6 +214,7 @@ static const struct brport_attribute *br + &brport_attr_multicast_router, + &brport_attr_multicast_fast_leave, + #endif ++ &brport_attr_isolated, + NULL + }; + +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -120,8 +120,8 @@ int br_handle_frame_finish(struct sk_buf + + unicast = false; + br->dev->stats.multicast++; +- } else if ((dst = __br_fdb_get(br, dest, vid)) && +- dst->is_local) { ++ } else if ((p->flags & BR_ISOLATE_MODE) || ++ ((dst = __br_fdb_get(br, dest, vid)) && dst->is_local)) { + skb2 = skb; + /* Do not forward the packet since it's local. */ + skb = NULL; +--- a/net/bridge/br_forward.c ++++ b/net/bridge/br_forward.c +@@ -117,7 +117,7 @@ EXPORT_SYMBOL_GPL(br_deliver); + /* called with rcu_read_lock */ + void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) + { +- if (should_deliver(to, skb)) { ++ if (should_deliver(to, skb) && !(to->flags & BR_ISOLATE_MODE)) { + if (skb0) + deliver_clone(to, skb, __br_forward); + else +@@ -173,7 +173,7 @@ static void br_flood(struct net_bridge * + struct sk_buff *skb0, + void (*__packet_hook)(const struct net_bridge_port *p, + struct sk_buff *skb), +- bool unicast) ++ bool unicast, bool forward) + { + struct net_bridge_port *p; + struct net_bridge_port *prev; +@@ -181,6 +181,8 @@ static void br_flood(struct net_bridge * + prev = NULL; + + list_for_each_entry_rcu(p, &br->port_list, list) { ++ if (forward && (p->flags & BR_ISOLATE_MODE)) ++ continue; + /* Do not flood unicast traffic to ports that turn it off */ + if (unicast && !(p->flags & BR_FLOOD)) + continue; +@@ -207,14 +209,14 @@ out: + /* called with rcu_read_lock */ + void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, bool unicast) + { +- br_flood(br, skb, NULL, __br_deliver, unicast); ++ br_flood(br, skb, NULL, __br_deliver, unicast, false); + } + + /* called under bridge lock */ + void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, + struct sk_buff *skb2, bool unicast) + { +- br_flood(br, skb, skb2, __br_forward, unicast); ++ br_flood(br, skb, skb2, __br_forward, unicast, true); + } + + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING diff --git a/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch b/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch new file mode 100644 index 000000000..642cf03d3 --- /dev/null +++ b/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch @@ -0,0 +1,390 @@ +From: Felix Fietkau +Subject: [PATCH] bridge: multicast to unicast + +Implement optinal multicast->unicast conversion for igmp snooping +--- +--- a/net/bridge/br_multicast.c ++++ b/net/bridge/br_multicast.c +@@ -635,7 +635,8 @@ struct net_bridge_port_group *br_multica + struct net_bridge_port *port, + struct br_ip *group, + struct net_bridge_port_group __rcu *next, +- unsigned char state) ++ unsigned char state, ++ const unsigned char *src) + { + struct net_bridge_port_group *p; + +@@ -650,12 +651,33 @@ struct net_bridge_port_group *br_multica + hlist_add_head(&p->mglist, &port->mglist); + setup_timer(&p->timer, br_multicast_port_group_expired, + (unsigned long)p); ++ if ((port->flags & BR_MULTICAST_TO_UCAST) && src) { ++ memcpy(p->eth_addr, src, ETH_ALEN); ++ p->unicast = true; ++ } + return p; + } + ++static bool br_port_group_equal(struct net_bridge_port_group *p, ++ struct net_bridge_port *port, ++ const unsigned char *src) ++{ ++ if (p->port != port) ++ return false; ++ ++ if (!p->unicast) ++ return true; ++ ++ if (!src) ++ return false; ++ ++ return ether_addr_equal(src, p->eth_addr); ++} ++ + static int br_multicast_add_group(struct net_bridge *br, + struct net_bridge_port *port, +- struct br_ip *group) ++ struct br_ip *group, ++ const unsigned char *src) + { + struct net_bridge_mdb_entry *mp; + struct net_bridge_port_group *p; +@@ -682,13 +704,13 @@ static int br_multicast_add_group(struct + for (pp = &mp->ports; + (p = mlock_dereference(*pp, br)) != NULL; + pp = &p->next) { +- if (p->port == port) ++ if (br_port_group_equal(p, port, src)) + goto found; + if ((unsigned long)p->port < (unsigned long)port) + break; + } + +- p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY); ++ p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY, src); + if (unlikely(!p)) + goto err; + rcu_assign_pointer(*pp, p); +@@ -707,7 +729,7 @@ err: + static int br_ip4_multicast_add_group(struct net_bridge *br, + struct net_bridge_port *port, + __be32 group, +- __u16 vid) ++ __u16 vid, const unsigned char *src) + { + struct br_ip br_group; + +@@ -718,14 +740,14 @@ static int br_ip4_multicast_add_group(st + br_group.proto = htons(ETH_P_IP); + br_group.vid = vid; + +- return br_multicast_add_group(br, port, &br_group); ++ return br_multicast_add_group(br, port, &br_group, src); + } + + #if IS_ENABLED(CONFIG_IPV6) + static int br_ip6_multicast_add_group(struct net_bridge *br, + struct net_bridge_port *port, + const struct in6_addr *group, +- __u16 vid) ++ __u16 vid, const unsigned char *src) + { + struct br_ip br_group; + +@@ -736,7 +758,7 @@ static int br_ip6_multicast_add_group(st + br_group.proto = htons(ETH_P_IPV6); + br_group.vid = vid; + +- return br_multicast_add_group(br, port, &br_group); ++ return br_multicast_add_group(br, port, &br_group, src); + } + #endif + +@@ -965,6 +987,7 @@ static int br_ip4_multicast_igmp3_report + struct sk_buff *skb, + u16 vid) + { ++ const unsigned char *src; + struct igmpv3_report *ih; + struct igmpv3_grec *grec; + int i; +@@ -1008,7 +1031,8 @@ static int br_ip4_multicast_igmp3_report + continue; + } + +- err = br_ip4_multicast_add_group(br, port, group, vid); ++ src = eth_hdr(skb)->h_source; ++ err = br_ip4_multicast_add_group(br, port, group, vid, src); + if (err) + break; + } +@@ -1022,6 +1046,7 @@ static int br_ip6_multicast_mld2_report( + struct sk_buff *skb, + u16 vid) + { ++ const unsigned char *src; + struct icmp6hdr *icmp6h; + struct mld2_grec *grec; + int i; +@@ -1069,8 +1094,9 @@ static int br_ip6_multicast_mld2_report( + continue; + } + ++ src = eth_hdr(skb)->h_source; + err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, +- vid); ++ vid, src); + if (err) + break; + } +@@ -1406,7 +1432,8 @@ br_multicast_leave_group(struct net_brid + struct net_bridge_port *port, + struct br_ip *group, + struct bridge_mcast_other_query *other_query, +- struct bridge_mcast_own_query *own_query) ++ struct bridge_mcast_own_query *own_query, ++ const unsigned char *src) + { + struct net_bridge_mdb_htable *mdb; + struct net_bridge_mdb_entry *mp; +@@ -1456,7 +1483,7 @@ br_multicast_leave_group(struct net_brid + for (pp = &mp->ports; + (p = mlock_dereference(*pp, br)) != NULL; + pp = &p->next) { +- if (p->port != port) ++ if (!br_port_group_equal(p, port, src)) + continue; + + rcu_assign_pointer(*pp, p->next); +@@ -1490,7 +1517,7 @@ br_multicast_leave_group(struct net_brid + for (p = mlock_dereference(mp->ports, br); + p != NULL; + p = mlock_dereference(p->next, br)) { +- if (p->port != port) ++ if (!br_port_group_equal(p, port, src)) + continue; + + if (!hlist_unhashed(&p->mglist) && +@@ -1508,8 +1535,8 @@ out: + + static void br_ip4_multicast_leave_group(struct net_bridge *br, + struct net_bridge_port *port, +- __be32 group, +- __u16 vid) ++ __be32 group, __u16 vid, ++ const unsigned char *src) + { + struct br_ip br_group; + struct bridge_mcast_own_query *own_query; +@@ -1524,14 +1551,14 @@ static void br_ip4_multicast_leave_group + br_group.vid = vid; + + br_multicast_leave_group(br, port, &br_group, &br->ip4_other_query, +- own_query); ++ own_query, src); + } + + #if IS_ENABLED(CONFIG_IPV6) + static void br_ip6_multicast_leave_group(struct net_bridge *br, + struct net_bridge_port *port, + const struct in6_addr *group, +- __u16 vid) ++ __u16 vid, const unsigned char *src) + { + struct br_ip br_group; + struct bridge_mcast_own_query *own_query; +@@ -1546,7 +1573,7 @@ static void br_ip6_multicast_leave_group + br_group.vid = vid; + + br_multicast_leave_group(br, port, &br_group, &br->ip6_other_query, +- own_query); ++ own_query, src); + } + #endif + +@@ -1555,6 +1582,7 @@ static int br_multicast_ipv4_rcv(struct + struct sk_buff *skb, + u16 vid) + { ++ const unsigned char *src; + struct sk_buff *skb2 = skb; + const struct iphdr *iph; + struct igmphdr *ih; +@@ -1628,7 +1656,8 @@ static int br_multicast_ipv4_rcv(struct + case IGMP_HOST_MEMBERSHIP_REPORT: + case IGMPV2_HOST_MEMBERSHIP_REPORT: + BR_INPUT_SKB_CB(skb)->mrouters_only = 1; +- err = br_ip4_multicast_add_group(br, port, ih->group, vid); ++ src = eth_hdr(skb)->h_source; ++ err = br_ip4_multicast_add_group(br, port, ih->group, vid, src); + break; + case IGMPV3_HOST_MEMBERSHIP_REPORT: + err = br_ip4_multicast_igmp3_report(br, port, skb2, vid); +@@ -1637,7 +1666,8 @@ static int br_multicast_ipv4_rcv(struct + err = br_ip4_multicast_query(br, port, skb2, vid); + break; + case IGMP_HOST_LEAVE_MESSAGE: +- br_ip4_multicast_leave_group(br, port, ih->group, vid); ++ src = eth_hdr(skb)->h_source; ++ br_ip4_multicast_leave_group(br, port, ih->group, vid, src); + break; + } + +@@ -1655,6 +1685,7 @@ static int br_multicast_ipv6_rcv(struct + struct sk_buff *skb, + u16 vid) + { ++ const unsigned char *src; + struct sk_buff *skb2; + const struct ipv6hdr *ip6h; + u8 icmp6_type; +@@ -1764,7 +1795,9 @@ static int br_multicast_ipv6_rcv(struct + } + mld = (struct mld_msg *)skb_transport_header(skb2); + BR_INPUT_SKB_CB(skb)->mrouters_only = 1; +- err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid); ++ src = eth_hdr(skb)->h_source; ++ err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid, ++ src); + break; + } + case ICMPV6_MLD2_REPORT: +@@ -1781,7 +1814,8 @@ static int br_multicast_ipv6_rcv(struct + goto out; + } + mld = (struct mld_msg *)skb_transport_header(skb2); +- br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid); ++ src = eth_hdr(skb)->h_source; ++ br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid, src); + } + } + +--- a/net/bridge/br_private.h ++++ b/net/bridge/br_private.h +@@ -112,6 +112,9 @@ struct net_bridge_port_group { + struct timer_list timer; + struct br_ip addr; + unsigned char state; ++ ++ unsigned char eth_addr[ETH_ALEN]; ++ bool unicast; + }; + + struct net_bridge_mdb_entry +@@ -173,6 +176,7 @@ struct net_bridge_port + #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING) + #define BR_PROMISC 0x00000080 + #define BR_ISOLATE_MODE 0x00000100 ++#define BR_MULTICAST_TO_UCAST 0x00000200 + + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING + struct bridge_mcast_own_query ip4_own_query; +@@ -485,7 +489,8 @@ void br_multicast_free_pg(struct rcu_hea + struct net_bridge_port_group * + br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, + struct net_bridge_port_group __rcu *next, +- unsigned char state); ++ unsigned char state, ++ const unsigned char *src); + void br_mdb_init(void); + void br_mdb_uninit(void); + void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, +--- a/net/bridge/br_mdb.c ++++ b/net/bridge/br_mdb.c +@@ -342,7 +342,7 @@ static int br_mdb_add_group(struct net_b + break; + } + +- p = br_multicast_new_port_group(port, group, *pp, state); ++ p = br_multicast_new_port_group(port, group, *pp, state, NULL); + if (unlikely(!p)) + return -ENOMEM; + rcu_assign_pointer(*pp, p); +--- a/net/bridge/br_forward.c ++++ b/net/bridge/br_forward.c +@@ -168,6 +168,34 @@ out: + return p; + } + ++static struct net_bridge_port *maybe_deliver_addr( ++ struct net_bridge_port *prev, struct net_bridge_port *p, ++ struct sk_buff *skb, const unsigned char *addr, ++ void (*__packet_hook)(const struct net_bridge_port *p, ++ struct sk_buff *skb)) ++{ ++ struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; ++ const unsigned char *src = eth_hdr(skb)->h_source; ++ ++ if (!should_deliver(p, skb)) ++ return prev; ++ ++ /* Even with hairpin, no soliloquies - prevent breaking IPv6 DAD */ ++ if (skb->dev == p->dev && ether_addr_equal(src, addr)) ++ return prev; ++ ++ skb = skb_copy(skb, GFP_ATOMIC); ++ if (!skb) { ++ dev->stats.tx_dropped++; ++ return prev; ++ } ++ ++ memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN); ++ __packet_hook(p, skb); ++ ++ return prev; ++} ++ + /* called under bridge lock */ + static void br_flood(struct net_bridge *br, struct sk_buff *skb, + struct sk_buff *skb0, +@@ -232,6 +260,7 @@ static void br_multicast_flood(struct ne + struct net_bridge_port *prev = NULL; + struct net_bridge_port_group *p; + struct hlist_node *rp; ++ const unsigned char *addr; + + rp = rcu_dereference(hlist_first_rcu(&br->router_list)); + p = mdst ? rcu_dereference(mdst->ports) : NULL; +@@ -242,10 +271,19 @@ static void br_multicast_flood(struct ne + rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) : + NULL; + +- port = (unsigned long)lport > (unsigned long)rport ? +- lport : rport; +- +- prev = maybe_deliver(prev, port, skb, __packet_hook); ++ if ((unsigned long)lport > (unsigned long)rport) { ++ port = lport; ++ addr = p->unicast ? p->eth_addr : NULL; ++ } else { ++ port = rport; ++ addr = NULL; ++ } ++ ++ if (addr) ++ prev = maybe_deliver_addr(prev, port, skb, addr, ++ __packet_hook); ++ else ++ prev = maybe_deliver(prev, port, skb, __packet_hook); + if (IS_ERR(prev)) + goto out; + +--- a/net/bridge/br_sysfs_if.c ++++ b/net/bridge/br_sysfs_if.c +@@ -187,6 +187,7 @@ static BRPORT_ATTR(multicast_router, S_I + store_multicast_router); + + BRPORT_ATTR_FLAG(multicast_fast_leave, BR_MULTICAST_FAST_LEAVE); ++BRPORT_ATTR_FLAG(multicast_to_unicast, BR_MULTICAST_TO_UCAST); + #endif + + static const struct brport_attribute *brport_attrs[] = { +@@ -213,6 +214,7 @@ static const struct brport_attribute *br + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING + &brport_attr_multicast_router, + &brport_attr_multicast_fast_leave, ++ &brport_attr_multicast_to_unicast, + #endif + &brport_attr_isolated, + NULL diff --git a/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch b/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch new file mode 100644 index 000000000..e69de29bb diff --git a/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch b/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch new file mode 100644 index 000000000..16da5cd66 --- /dev/null +++ b/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch @@ -0,0 +1,11 @@ +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -130,7 +130,7 @@ static inline bool dev_xmit_complete(int + */ + + #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) +-# if defined(CONFIG_MAC80211_MESH) ++# if 1 || defined(CONFIG_MAC80211_MESH) + # define LL_MAX_HEADER 128 + # else + # define LL_MAX_HEADER 96 diff --git a/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch b/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch new file mode 100644 index 000000000..ebe5da4ec --- /dev/null +++ b/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch @@ -0,0 +1,26 @@ +--- a/net/netlink/af_netlink.c ++++ b/net/netlink/af_netlink.c +@@ -1154,23 +1154,7 @@ void netlink_detachskb(struct sock *sk, + + static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation) + { +- int delta; +- + WARN_ON(skb->sk != NULL); +- delta = skb->end - skb->tail; +- if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize) +- return skb; +- +- if (skb_shared(skb)) { +- struct sk_buff *nskb = skb_clone(skb, allocation); +- if (!nskb) +- return skb; +- consume_skb(skb); +- skb = nskb; +- } +- +- if (!pskb_expand_head(skb, 0, -delta, allocation)) +- skb->truesize -= delta; + + return skb; + } diff --git a/target/linux/generic/pending-3.18/655-increase_skb_pad.patch b/target/linux/generic/pending-3.18/655-increase_skb_pad.patch new file mode 100644 index 000000000..96f81e9aa --- /dev/null +++ b/target/linux/generic/pending-3.18/655-increase_skb_pad.patch @@ -0,0 +1,11 @@ +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -2024,7 +2024,7 @@ static inline int pskb_network_may_pull( + * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) + */ + #ifndef NET_SKB_PAD +-#define NET_SKB_PAD max(32, L1_CACHE_BYTES) ++#define NET_SKB_PAD max(64, L1_CACHE_BYTES) + #endif + + int ___pskb_trim(struct sk_buff *skb, unsigned int len); diff --git a/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch b/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch new file mode 100644 index 000000000..0fde9f6e6 --- /dev/null +++ b/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch @@ -0,0 +1,41 @@ +From 4593a806e31119c5bd3faa00c7210ad862d515af Mon Sep 17 00:00:00 2001 +From: Dave Taht +Date: Mon, 31 Dec 2012 10:02:21 -0800 +Subject: [PATCH 3/7] skb_reduce_truesize: helper function for shrinking skbs + whenever needed + +On embedded devices in particular, large queues of small packets from the rx +path with a large truesize can exist. Reducing their size can reduce +memory pressure. skb_reduce_truesize is a helper function for doing this, +when needed. +--- + include/linux/skbuff.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -2069,6 +2069,24 @@ static inline void pskb_trim_unique(stru + BUG_ON(err); + } + ++/* ++ * Caller wants to reduce memory needs before queueing skb ++ * The (expensive) copy should not be be done in fast path. ++ */ ++static inline struct sk_buff *skb_reduce_truesize(struct sk_buff *skb) ++{ ++ if (skb->truesize > 2 * SKB_TRUESIZE(skb->len)) { ++ struct sk_buff *nskb; ++ nskb = skb_copy_expand(skb, skb_headroom(skb), 0, ++ GFP_ATOMIC | __GFP_NOWARN); ++ if (nskb) { ++ __kfree_skb(skb); ++ skb = nskb; ++ } ++ } ++ return skb; ++} ++ + /** + * skb_orphan - orphan a buffer + * @skb: buffer to orphan diff --git a/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch b/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch new file mode 100644 index 000000000..410e0b763 --- /dev/null +++ b/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch @@ -0,0 +1,63 @@ +From bc9fec2f87d57bdbff30d296605e24504513f65c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dave=20T=C3=A4ht?= +Date: Mon, 17 Sep 2012 19:20:22 -0700 +Subject: [PATCH 4/7] net: add skb_reduce_truesize support to common qdiscs + +Reduce skb size under load when queues begin to fill on the +commont qdiscs. +--- + net/sched/sch_codel.c | 2 ++ + net/sched/sch_fifo.c | 12 ++++++++---- + net/sched/sch_fq_codel.c | 2 ++ + 3 files changed, 12 insertions(+), 4 deletions(-) + +--- a/net/sched/sch_codel.c ++++ b/net/sched/sch_codel.c +@@ -97,6 +97,8 @@ static int codel_qdisc_enqueue(struct sk + struct codel_sched_data *q; + + if (likely(qdisc_qlen(sch) < sch->limit)) { ++ if(qdisc_qlen(sch) > 128) ++ skb = skb_reduce_truesize(skb); + codel_set_enqueue_time(skb); + return qdisc_enqueue_tail(skb, sch); + } +--- a/net/sched/sch_fifo.c ++++ b/net/sched/sch_fifo.c +@@ -29,17 +29,21 @@ static int bfifo_enqueue(struct sk_buff + + static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch) + { +- if (likely(skb_queue_len(&sch->q) < sch->limit)) ++ if (likely(skb_queue_len(&sch->q) < sch->limit)) { ++ if (skb_queue_len(&sch->q) > 128) ++ skb = skb_reduce_truesize(skb); + return qdisc_enqueue_tail(skb, sch); +- ++ } + return qdisc_reshape_fail(skb, sch); + } + + static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch) + { +- if (likely(skb_queue_len(&sch->q) < sch->limit)) ++ if (likely(skb_queue_len(&sch->q) < sch->limit)) { ++ if (skb_queue_len(&sch->q) > 128) ++ skb = skb_reduce_truesize(skb); + return qdisc_enqueue_tail(skb, sch); +- ++ } + /* queue full, remove one skb to fulfill the limit */ + __qdisc_queue_drop_head(sch, &sch->q); + qdisc_qstats_drop(sch); +--- a/net/sched/sch_fq_codel.c ++++ b/net/sched/sch_fq_codel.c +@@ -185,6 +185,8 @@ static int fq_codel_enqueue(struct sk_bu + return ret; + } + idx--; ++ if (sch->q.qlen > 128) ++ skb = skb_reduce_truesize(skb); + + codel_set_enqueue_time(skb); + flow = &q->flows[idx]; diff --git a/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch b/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch new file mode 100644 index 000000000..8a870cccc --- /dev/null +++ b/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch @@ -0,0 +1,13 @@ +--- a/net/sched/sch_fq_codel.c ++++ b/net/sched/sch_fq_codel.c +@@ -394,8 +394,8 @@ static int fq_codel_init(struct Qdisc *s + struct fq_codel_sched_data *q = qdisc_priv(sch); + int i; + +- sch->limit = 10*1024; +- q->flows_cnt = 1024; ++ sch->limit = 1024; ++ q->flows_cnt = 128; + q->quantum = psched_mtu(qdisc_dev(sch)); + q->perturbation = prandom_u32(); + INIT_LIST_HEAD(&q->new_flows); diff --git a/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch b/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch new file mode 100644 index 000000000..45a8d6836 --- /dev/null +++ b/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch @@ -0,0 +1,10 @@ +--- a/net/sched/sch_fq_codel.c ++++ b/net/sched/sch_fq_codel.c +@@ -198,7 +198,6 @@ static int fq_codel_enqueue(struct sk_bu + list_add_tail(&flow->flowchain, &q->new_flows); + q->new_flow_count++; + flow->deficit = q->quantum; +- flow->dropped = 0; + } + if (++sch->q.qlen <= sch->limit) + return NET_XMIT_SUCCESS; diff --git a/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch b/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch new file mode 100644 index 000000000..39abfaabe --- /dev/null +++ b/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch @@ -0,0 +1,95 @@ +--- a/net/sched/Kconfig ++++ b/net/sched/Kconfig +@@ -3,8 +3,9 @@ + # + + menuconfig NET_SCHED +- bool "QoS and/or fair queueing" ++ def_bool y + select NET_SCH_FIFO ++ select NET_SCH_FQ_CODEL + ---help--- + When the kernel has several packets to send out over a network + device, it has to decide which ones to send first, which ones to +--- a/net/sched/sch_fq_codel.c ++++ b/net/sched/sch_fq_codel.c +@@ -599,7 +599,7 @@ static const struct Qdisc_class_ops fq_c + .walk = fq_codel_walk, + }; + +-static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { ++struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { + .cl_ops = &fq_codel_class_ops, + .id = "fq_codel", + .priv_size = sizeof(struct fq_codel_sched_data), +@@ -615,6 +615,7 @@ static struct Qdisc_ops fq_codel_qdisc_o + .dump_stats = fq_codel_dump_stats, + .owner = THIS_MODULE, + }; ++EXPORT_SYMBOL(fq_codel_qdisc_ops); + + static int __init fq_codel_module_init(void) + { +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -341,6 +341,7 @@ extern struct Qdisc noop_qdisc; + extern struct Qdisc_ops noop_qdisc_ops; + extern struct Qdisc_ops pfifo_fast_ops; + extern struct Qdisc_ops mq_qdisc_ops; ++extern struct Qdisc_ops fq_codel_qdisc_ops; + extern const struct Qdisc_ops *default_qdisc_ops; + + struct Qdisc_class_common { +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -31,7 +31,7 @@ + #include + + /* Qdisc to use by default */ +-const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; ++const struct Qdisc_ops *default_qdisc_ops = &fq_codel_qdisc_ops; + EXPORT_SYMBOL(default_qdisc_ops); + + /* Main transmission queue. */ +@@ -742,7 +742,7 @@ static void attach_one_default_qdisc(str + + if (dev->tx_queue_len) { + qdisc = qdisc_create_dflt(dev_queue, +- default_qdisc_ops, TC_H_ROOT); ++ &fq_codel_qdisc_ops, TC_H_ROOT); + if (!qdisc) { + netdev_info(dev, "activation failed\n"); + return; +--- a/net/sched/sch_mq.c ++++ b/net/sched/sch_mq.c +@@ -57,7 +57,7 @@ static int mq_init(struct Qdisc *sch, st + + for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { + dev_queue = netdev_get_tx_queue(dev, ntx); +- qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops, ++ qdisc = qdisc_create_dflt(dev_queue, &fq_codel_qdisc_ops, + TC_H_MAKE(TC_H_MAJ(sch->handle), + TC_H_MIN(ntx + 1))); + if (qdisc == NULL) +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -124,7 +124,7 @@ static int mqprio_init(struct Qdisc *sch + + for (i = 0; i < dev->num_tx_queues; i++) { + dev_queue = netdev_get_tx_queue(dev, i); +- qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops, ++ qdisc = qdisc_create_dflt(dev_queue, &fq_codel_qdisc_ops, + TC_H_MAKE(TC_H_MAJ(sch->handle), + TC_H_MIN(i + 1))); + if (qdisc == NULL) { +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -1949,7 +1949,7 @@ static int __init pktsched_init(void) + return err; + } + +- register_qdisc(&pfifo_fast_ops); ++ register_qdisc(&fq_codel_qdisc_ops); + register_qdisc(&pfifo_qdisc_ops); + register_qdisc(&bfifo_qdisc_ops); + register_qdisc(&pfifo_head_drop_qdisc_ops); diff --git a/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch b/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch new file mode 100644 index 000000000..50b90b375 --- /dev/null +++ b/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch @@ -0,0 +1,143 @@ +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -445,140 +445,6 @@ static struct Qdisc noqueue_qdisc = { + .busylock = __SPIN_LOCK_UNLOCKED(noqueue_qdisc.busylock), + }; + +- +-static const u8 prio2band[TC_PRIO_MAX + 1] = { +- 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 +-}; +- +-/* 3-band FIFO queue: old style, but should be a bit faster than +- generic prio+fifo combination. +- */ +- +-#define PFIFO_FAST_BANDS 3 +- +-/* +- * Private data for a pfifo_fast scheduler containing: +- * - queues for the three band +- * - bitmap indicating which of the bands contain skbs +- */ +-struct pfifo_fast_priv { +- u32 bitmap; +- struct sk_buff_head q[PFIFO_FAST_BANDS]; +-}; +- +-/* +- * Convert a bitmap to the first band number where an skb is queued, where: +- * bitmap=0 means there are no skbs on any band. +- * bitmap=1 means there is an skb on band 0. +- * bitmap=7 means there are skbs on all 3 bands, etc. +- */ +-static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0}; +- +-static inline struct sk_buff_head *band2list(struct pfifo_fast_priv *priv, +- int band) +-{ +- return priv->q + band; +-} +- +-static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc) +-{ +- if (skb_queue_len(&qdisc->q) < qdisc_dev(qdisc)->tx_queue_len) { +- int band = prio2band[skb->priority & TC_PRIO_MAX]; +- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); +- struct sk_buff_head *list = band2list(priv, band); +- +- priv->bitmap |= (1 << band); +- qdisc->q.qlen++; +- return __qdisc_enqueue_tail(skb, qdisc, list); +- } +- +- return qdisc_drop(skb, qdisc); +-} +- +-static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) +-{ +- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); +- int band = bitmap2band[priv->bitmap]; +- +- if (likely(band >= 0)) { +- struct sk_buff_head *list = band2list(priv, band); +- struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list); +- +- qdisc->q.qlen--; +- if (skb_queue_empty(list)) +- priv->bitmap &= ~(1 << band); +- +- return skb; +- } +- +- return NULL; +-} +- +-static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) +-{ +- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); +- int band = bitmap2band[priv->bitmap]; +- +- if (band >= 0) { +- struct sk_buff_head *list = band2list(priv, band); +- +- return skb_peek(list); +- } +- +- return NULL; +-} +- +-static void pfifo_fast_reset(struct Qdisc *qdisc) +-{ +- int prio; +- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); +- +- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) +- __qdisc_reset_queue(qdisc, band2list(priv, prio)); +- +- priv->bitmap = 0; +- qdisc->qstats.backlog = 0; +- qdisc->q.qlen = 0; +-} +- +-static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) +-{ +- struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; +- +- memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); +- if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) +- goto nla_put_failure; +- return skb->len; +- +-nla_put_failure: +- return -1; +-} +- +-static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) +-{ +- int prio; +- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); +- +- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) +- __skb_queue_head_init(band2list(priv, prio)); +- +- /* Can by-pass the queue discipline */ +- qdisc->flags |= TCQ_F_CAN_BYPASS; +- return 0; +-} +- +-struct Qdisc_ops pfifo_fast_ops __read_mostly = { +- .id = "pfifo_fast", +- .priv_size = sizeof(struct pfifo_fast_priv), +- .enqueue = pfifo_fast_enqueue, +- .dequeue = pfifo_fast_dequeue, +- .peek = pfifo_fast_peek, +- .init = pfifo_fast_init, +- .reset = pfifo_fast_reset, +- .dump = pfifo_fast_dump, +- .owner = THIS_MODULE, +-}; +- + static struct lock_class_key qdisc_tx_busylock; + + struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, diff --git a/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch new file mode 100644 index 000000000..c9686f1f0 --- /dev/null +++ b/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch @@ -0,0 +1,481 @@ +From 775d6fe74d1eaec2ba387535b068dde2dc89de9e Mon Sep 17 00:00:00 2001 +From: Steven Barth +Date: Thu, 22 May 2014 09:49:05 +0200 +Subject: [PATCH] Add support for MAP-E FMRs (mesh mode) + +MAP-E FMRs (draft-ietf-softwire-map-10) are rules for IPv4-communication +between MAP CEs (mesh mode) without the need to forward such data to a +border relay. This is similar to how 6rd works but for IPv4 over IPv6. + +Signed-off-by: Steven Barth +--- + include/net/ip6_tunnel.h | 13 ++ + include/uapi/linux/if_tunnel.h | 13 ++ + net/ipv6/ip6_tunnel.c | 276 +++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 291 insertions(+), 11 deletions(-) + +--- a/include/net/ip6_tunnel.h ++++ b/include/net/ip6_tunnel.h +@@ -15,6 +15,18 @@ + /* determine capability on a per-packet basis */ + #define IP6_TNL_F_CAP_PER_PACKET 0x40000 + ++/* IPv6 tunnel FMR */ ++struct __ip6_tnl_fmr { ++ struct __ip6_tnl_fmr *next; /* next fmr in list */ ++ struct in6_addr ip6_prefix; ++ struct in_addr ip4_prefix; ++ ++ __u8 ip6_prefix_len; ++ __u8 ip4_prefix_len; ++ __u8 ea_len; ++ __u8 offset; ++}; ++ + struct __ip6_tnl_parm { + char name[IFNAMSIZ]; /* name of tunnel device */ + int link; /* ifindex of underlying L2 interface */ +@@ -25,6 +37,7 @@ struct __ip6_tnl_parm { + __u32 flags; /* tunnel flags */ + struct in6_addr laddr; /* local tunnel end-point address */ + struct in6_addr raddr; /* remote tunnel end-point address */ ++ struct __ip6_tnl_fmr *fmrs; /* FMRs */ + + __be16 i_flags; + __be16 o_flags; +--- a/include/uapi/linux/if_tunnel.h ++++ b/include/uapi/linux/if_tunnel.h +@@ -57,10 +57,23 @@ enum { + IFLA_IPTUN_ENCAP_FLAGS, + IFLA_IPTUN_ENCAP_SPORT, + IFLA_IPTUN_ENCAP_DPORT, ++ IFLA_IPTUN_FMRS, + __IFLA_IPTUN_MAX, + }; + #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) + ++enum { ++ IFLA_IPTUN_FMR_UNSPEC, ++ IFLA_IPTUN_FMR_IP6_PREFIX, ++ IFLA_IPTUN_FMR_IP4_PREFIX, ++ IFLA_IPTUN_FMR_IP6_PREFIX_LEN, ++ IFLA_IPTUN_FMR_IP4_PREFIX_LEN, ++ IFLA_IPTUN_FMR_EA_LEN, ++ IFLA_IPTUN_FMR_OFFSET, ++ __IFLA_IPTUN_FMR_MAX, ++}; ++#define IFLA_IPTUN_FMR_MAX (__IFLA_IPTUN_FMR_MAX - 1) ++ + enum tunnel_encap_types { + TUNNEL_ENCAP_NONE, + TUNNEL_ENCAP_FOU, +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -16,6 +16,8 @@ + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * ++ * Changes: ++ * Steven Barth : MAP-E FMR support + */ + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +@@ -77,11 +79,9 @@ static bool log_ecn_error = true; + module_param(log_ecn_error, bool, 0644); + MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); + +-static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2) ++static u32 HASH(const struct in6_addr *addr) + { +- u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); +- +- return hash_32(hash, HASH_SIZE_SHIFT); ++ return hash_32(ipv6_addr_hash(addr), HASH_SIZE_SHIFT); + } + + static int ip6_tnl_dev_init(struct net_device *dev); +@@ -180,15 +180,24 @@ EXPORT_SYMBOL_GPL(ip6_tnl_dst_store); + static struct ip6_tnl * + ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) + { +- unsigned int hash = HASH(remote, local); ++ unsigned int hash = HASH(local); + struct ip6_tnl *t; + struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); ++ struct __ip6_tnl_fmr *fmr; + + for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { +- if (ipv6_addr_equal(local, &t->parms.laddr) && +- ipv6_addr_equal(remote, &t->parms.raddr) && +- (t->dev->flags & IFF_UP)) ++ if (!ipv6_addr_equal(local, &t->parms.laddr) || ++ !(t->dev->flags & IFF_UP)) ++ continue; ++ ++ if (ipv6_addr_equal(remote, &t->parms.raddr)) + return t; ++ ++ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { ++ if (ipv6_prefix_equal(remote, &fmr->ip6_prefix, ++ fmr->ip6_prefix_len)) ++ return t; ++ } + } + t = rcu_dereference(ip6n->tnls_wc[0]); + if (t && (t->dev->flags & IFF_UP)) +@@ -218,7 +227,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, + + if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) { + prio = 1; +- h = HASH(remote, local); ++ h = HASH(local); + } + return &ip6n->tnls[prio][h]; + } +@@ -391,6 +400,12 @@ ip6_tnl_dev_uninit(struct net_device *de + struct net *net = t->net; + struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); + ++ while (t->parms.fmrs) { ++ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; ++ kfree(t->parms.fmrs); ++ t->parms.fmrs = next; ++ } ++ + if (dev == ip6n->fb_tnl_dev) + RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL); + else +@@ -784,6 +799,108 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t, + } + EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl); + ++ ++/** ++ * ip4ip6_fmr_calc - calculate target / source IPv6-address based on FMR ++ * @dest: destination IPv6 address buffer ++ * @skb: received socket buffer ++ * @fmr: MAP FMR ++ * @xmit: Calculate for xmit or rcv ++ **/ ++static void ip4ip6_fmr_calc(struct in6_addr *dest, ++ const struct iphdr *iph, const uint8_t *end, ++ const struct __ip6_tnl_fmr *fmr, bool xmit) ++{ ++ int psidlen = fmr->ea_len - (32 - fmr->ip4_prefix_len); ++ u8 *portp = NULL; ++ bool use_dest_addr; ++ const struct iphdr *dsth = iph; ++ ++ if ((u8*)dsth >= end) ++ return; ++ ++ /* find significant IP header */ ++ if (iph->protocol == IPPROTO_ICMP) { ++ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); ++ if (ih && ((u8*)&ih[1]) <= end && ( ++ ih->type == ICMP_DEST_UNREACH || ++ ih->type == ICMP_SOURCE_QUENCH || ++ ih->type == ICMP_TIME_EXCEEDED || ++ ih->type == ICMP_PARAMETERPROB || ++ ih->type == ICMP_REDIRECT)) ++ dsth = (const struct iphdr*)&ih[1]; ++ } ++ ++ /* in xmit-path use dest port by default and source port only if ++ this is an ICMP reply to something else; vice versa in rcv-path */ ++ use_dest_addr = (xmit && dsth == iph) || (!xmit && dsth != iph); ++ ++ /* get dst port */ ++ if (((u8*)&dsth[1]) <= end && ( ++ dsth->protocol == IPPROTO_UDP || ++ dsth->protocol == IPPROTO_TCP || ++ dsth->protocol == IPPROTO_SCTP || ++ dsth->protocol == IPPROTO_DCCP)) { ++ /* for UDP, TCP, SCTP and DCCP source and dest port ++ follow IPv4 header directly */ ++ portp = ((u8*)dsth) + dsth->ihl * 4; ++ ++ if (use_dest_addr) ++ portp += sizeof(u16); ++ } else if (iph->protocol == IPPROTO_ICMP) { ++ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); ++ ++ /* use icmp identifier as port */ ++ if (((u8*)&ih) <= end && ( ++ (use_dest_addr && ( ++ ih->type == ICMP_ECHOREPLY || ++ ih->type == ICMP_TIMESTAMPREPLY || ++ ih->type == ICMP_INFO_REPLY || ++ ih->type == ICMP_ADDRESSREPLY)) || ++ (!use_dest_addr && ( ++ ih->type == ICMP_ECHO || ++ ih->type == ICMP_TIMESTAMP || ++ ih->type == ICMP_INFO_REQUEST || ++ ih->type == ICMP_ADDRESS) ++ ))) ++ portp = (u8*)&ih->un.echo.id; ++ } ++ ++ if ((portp && &portp[2] <= end) || psidlen == 0) { ++ int frombyte = fmr->ip6_prefix_len / 8; ++ int fromrem = fmr->ip6_prefix_len % 8; ++ int bytes = sizeof(struct in6_addr) - frombyte; ++ const u32 *addr = (use_dest_addr) ? &iph->daddr : &iph->saddr; ++ u64 eabits = ((u64)ntohl(*addr)) << (32 + fmr->ip4_prefix_len); ++ u64 t = 0; ++ ++ /* extract PSID from port and add it to eabits */ ++ u16 psidbits = 0; ++ if (psidlen > 0) { ++ psidbits = ((u16)portp[0]) << 8 | ((u16)portp[1]); ++ psidbits >>= 16 - psidlen - fmr->offset; ++ psidbits = (u16)(psidbits << (16 - psidlen)); ++ eabits |= ((u64)psidbits) << (48 - (fmr->ea_len - psidlen)); ++ } ++ ++ /* rewrite destination address */ ++ *dest = fmr->ip6_prefix; ++ memcpy(&dest->s6_addr[10], addr, sizeof(*addr)); ++ dest->s6_addr16[7] = htons(psidbits >> (16 - psidlen)); ++ ++ if (bytes > sizeof(u64)) ++ bytes = sizeof(u64); ++ ++ /* insert eabits */ ++ memcpy(&t, &dest->s6_addr[frombyte], bytes); ++ t = be64_to_cpu(t) & ~(((((u64)1) << fmr->ea_len) - 1) ++ << (64 - fmr->ea_len - fromrem)); ++ t = cpu_to_be64(t | (eabits >> fromrem)); ++ memcpy(&dest->s6_addr[frombyte], &t, bytes); ++ } ++} ++ ++ + /** + * ip6_tnl_rcv - decapsulate IPv6 packet and retransmit it locally + * @skb: received socket buffer +@@ -828,6 +945,26 @@ static int ip6_tnl_rcv(struct sk_buff *s + skb_reset_network_header(skb); + skb->protocol = htons(protocol); + memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); ++ if (protocol == ETH_P_IP && t->parms.fmrs && ++ !ipv6_addr_equal(&ipv6h->saddr, &t->parms.raddr)) { ++ /* Packet didn't come from BR, so lookup FMR */ ++ struct __ip6_tnl_fmr *fmr; ++ struct in6_addr expected = t->parms.raddr; ++ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) ++ if (ipv6_prefix_equal(&ipv6h->saddr, ++ &fmr->ip6_prefix, fmr->ip6_prefix_len)) ++ break; ++ ++ /* Check that IPv6 matches IPv4 source to prevent spoofing */ ++ if (fmr) ++ ip4ip6_fmr_calc(&expected, ip_hdr(skb), ++ skb_tail_pointer(skb), fmr, false); ++ ++ if (!ipv6_addr_equal(&ipv6h->saddr, &expected)) { ++ rcu_read_unlock(); ++ goto discard; ++ } ++ } + + __skb_tunnel_rx(skb, t->dev, t->net); + +@@ -1089,6 +1226,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, str + __u8 dsfield; + __u32 mtu; + int err; ++ struct __ip6_tnl_fmr *fmr; + + if ((t->parms.proto != IPPROTO_IPIP && t->parms.proto != 0) || + !ip6_tnl_xmit_ctl(t)) +@@ -1108,6 +1246,18 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, str + if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) + fl6.flowi6_mark = skb->mark; + ++ /* try to find matching FMR */ ++ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { ++ unsigned mshift = 32 - fmr->ip4_prefix_len; ++ if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == ++ ntohl(iph->daddr) >> mshift) ++ break; ++ } ++ ++ /* change dstaddr according to FMR */ ++ if (fmr) ++ ip4ip6_fmr_calc(&fl6.daddr, iph, skb_tail_pointer(skb), fmr, true); ++ + err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); + if (err != 0) { + /* XXX: send ICMP error even if DF is not set. */ +@@ -1276,6 +1426,14 @@ ip6_tnl_change(struct ip6_tnl *t, const + t->parms.flowinfo = p->flowinfo; + t->parms.link = p->link; + t->parms.proto = p->proto; ++ ++ while (t->parms.fmrs) { ++ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; ++ kfree(t->parms.fmrs); ++ t->parms.fmrs = next; ++ } ++ t->parms.fmrs = p->fmrs; ++ + ip6_tnl_dst_reset(t); + ip6_tnl_link_config(t); + return 0; +@@ -1306,6 +1464,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ + p->flowinfo = u->flowinfo; + p->link = u->link; + p->proto = u->proto; ++ p->fmrs = NULL; + memcpy(p->name, u->name, sizeof(u->name)); + } + +@@ -1581,6 +1740,15 @@ static int ip6_tnl_validate(struct nlatt + return 0; + } + ++static const struct nla_policy ip6_tnl_fmr_policy[IFLA_IPTUN_FMR_MAX + 1] = { ++ [IFLA_IPTUN_FMR_IP6_PREFIX] = { .len = sizeof(struct in6_addr) }, ++ [IFLA_IPTUN_FMR_IP4_PREFIX] = { .len = sizeof(struct in_addr) }, ++ [IFLA_IPTUN_FMR_IP6_PREFIX_LEN] = { .type = NLA_U8 }, ++ [IFLA_IPTUN_FMR_IP4_PREFIX_LEN] = { .type = NLA_U8 }, ++ [IFLA_IPTUN_FMR_EA_LEN] = { .type = NLA_U8 }, ++ [IFLA_IPTUN_FMR_OFFSET] = { .type = NLA_U8 } ++}; ++ + static void ip6_tnl_netlink_parms(struct nlattr *data[], + struct __ip6_tnl_parm *parms) + { +@@ -1614,6 +1782,46 @@ static void ip6_tnl_netlink_parms(struct + + if (data[IFLA_IPTUN_PROTO]) + parms->proto = nla_get_u8(data[IFLA_IPTUN_PROTO]); ++ ++ if (data[IFLA_IPTUN_FMRS]) { ++ unsigned rem; ++ struct nlattr *fmr; ++ nla_for_each_nested(fmr, data[IFLA_IPTUN_FMRS], rem) { ++ struct nlattr *fmrd[IFLA_IPTUN_FMR_MAX + 1], *c; ++ struct __ip6_tnl_fmr *nfmr; ++ ++ nla_parse_nested(fmrd, IFLA_IPTUN_FMR_MAX, ++ fmr, ip6_tnl_fmr_policy); ++ ++ if (!(nfmr = kzalloc(sizeof(*nfmr), GFP_KERNEL))) ++ continue; ++ ++ nfmr->offset = 6; ++ ++ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX])) ++ nla_memcpy(&nfmr->ip6_prefix, fmrd[IFLA_IPTUN_FMR_IP6_PREFIX], ++ sizeof(nfmr->ip6_prefix)); ++ ++ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX])) ++ nla_memcpy(&nfmr->ip4_prefix, fmrd[IFLA_IPTUN_FMR_IP4_PREFIX], ++ sizeof(nfmr->ip4_prefix)); ++ ++ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX_LEN])) ++ nfmr->ip6_prefix_len = nla_get_u8(c); ++ ++ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX_LEN])) ++ nfmr->ip4_prefix_len = nla_get_u8(c); ++ ++ if ((c = fmrd[IFLA_IPTUN_FMR_EA_LEN])) ++ nfmr->ea_len = nla_get_u8(c); ++ ++ if ((c = fmrd[IFLA_IPTUN_FMR_OFFSET])) ++ nfmr->offset = nla_get_u8(c); ++ ++ nfmr->next = parms->fmrs; ++ parms->fmrs = nfmr; ++ } ++ } + } + + static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev, +@@ -1666,6 +1874,12 @@ static void ip6_tnl_dellink(struct net_d + + static size_t ip6_tnl_get_size(const struct net_device *dev) + { ++ const struct ip6_tnl *t = netdev_priv(dev); ++ struct __ip6_tnl_fmr *c; ++ int fmrs = 0; ++ for (c = t->parms.fmrs; c; c = c->next) ++ ++fmrs; ++ + return + /* IFLA_IPTUN_LINK */ + nla_total_size(4) + +@@ -1683,6 +1897,24 @@ static size_t ip6_tnl_get_size(const str + nla_total_size(4) + + /* IFLA_IPTUN_PROTO */ + nla_total_size(1) + ++ /* IFLA_IPTUN_FMRS */ ++ nla_total_size(0) + ++ ( ++ /* nest */ ++ nla_total_size(0) + ++ /* IFLA_IPTUN_FMR_IP6_PREFIX */ ++ nla_total_size(sizeof(struct in6_addr)) + ++ /* IFLA_IPTUN_FMR_IP4_PREFIX */ ++ nla_total_size(sizeof(struct in_addr)) + ++ /* IFLA_IPTUN_FMR_EA_LEN */ ++ nla_total_size(1) + ++ /* IFLA_IPTUN_FMR_IP6_PREFIX_LEN */ ++ nla_total_size(1) + ++ /* IFLA_IPTUN_FMR_IP4_PREFIX_LEN */ ++ nla_total_size(1) + ++ /* IFLA_IPTUN_FMR_OFFSET */ ++ nla_total_size(1) ++ ) * fmrs + + 0; + } + +@@ -1690,6 +1922,9 @@ static int ip6_tnl_fill_info(struct sk_b + { + struct ip6_tnl *tunnel = netdev_priv(dev); + struct __ip6_tnl_parm *parm = &tunnel->parms; ++ struct __ip6_tnl_fmr *c; ++ int fmrcnt = 0; ++ struct nlattr *fmrs; + + if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || + nla_put(skb, IFLA_IPTUN_LOCAL, sizeof(struct in6_addr), +@@ -1700,8 +1935,27 @@ static int ip6_tnl_fill_info(struct sk_b + nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) || + nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) || + nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) || +- nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto)) ++ nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) || ++ !(fmrs = nla_nest_start(skb, IFLA_IPTUN_FMRS))) + goto nla_put_failure; ++ ++ for (c = parm->fmrs; c; c = c->next) { ++ struct nlattr *fmr = nla_nest_start(skb, ++fmrcnt); ++ if (!fmr || ++ nla_put(skb, IFLA_IPTUN_FMR_IP6_PREFIX, ++ sizeof(c->ip6_prefix), &c->ip6_prefix) || ++ nla_put(skb, IFLA_IPTUN_FMR_IP4_PREFIX, ++ sizeof(c->ip4_prefix), &c->ip4_prefix) || ++ nla_put_u8(skb, IFLA_IPTUN_FMR_IP6_PREFIX_LEN, c->ip6_prefix_len) || ++ nla_put_u8(skb, IFLA_IPTUN_FMR_IP4_PREFIX_LEN, c->ip4_prefix_len) || ++ nla_put_u8(skb, IFLA_IPTUN_FMR_EA_LEN, c->ea_len) || ++ nla_put_u8(skb, IFLA_IPTUN_FMR_OFFSET, c->offset)) ++ goto nla_put_failure; ++ ++ nla_nest_end(skb, fmr); ++ } ++ nla_nest_end(skb, fmrs); ++ + return 0; + + nla_put_failure: +@@ -1717,6 +1971,7 @@ static const struct nla_policy ip6_tnl_p + [IFLA_IPTUN_FLOWINFO] = { .type = NLA_U32 }, + [IFLA_IPTUN_FLAGS] = { .type = NLA_U32 }, + [IFLA_IPTUN_PROTO] = { .type = NLA_U8 }, ++ [IFLA_IPTUN_FMRS] = { .type = NLA_NESTED }, + }; + + static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch b/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch new file mode 100644 index 000000000..95d357813 --- /dev/null +++ b/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch @@ -0,0 +1,96 @@ +From e16e888b525503be05b3aea64190e8b3bdef44d0 Mon Sep 17 00:00:00 2001 +From: Markus Stenberg +Date: Tue, 5 May 2015 13:36:59 +0300 +Subject: [PATCH] ipv6: Fixed source specific default route handling. + +If there are only IPv6 source specific default routes present, the +host gets -ENETUNREACH on e.g. connect() because ip6_dst_lookup_tail +calls ip6_route_output first, and given source address any, it fails, +and ip6_route_get_saddr is never called. + +The change is to use the ip6_route_get_saddr, even if the initial +ip6_route_output fails, and then doing ip6_route_output _again_ after +we have appropriate source address available. + +Note that this is '99% fix' to the problem; a correct fix would be to +do route lookups only within addrconf.c when picking a source address, +and never call ip6_route_output before source address has been +populated. + +Signed-off-by: Markus Stenberg +Signed-off-by: David S. Miller +--- + net/ipv6/ip6_output.c | 39 +++++++++++++++++++++++++++++++-------- + net/ipv6/route.c | 5 +++-- + 2 files changed, 34 insertions(+), 10 deletions(-) + +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -908,21 +908,45 @@ static int ip6_dst_lookup_tail(struct so + #endif + int err; + +- if (*dst == NULL) +- *dst = ip6_route_output(net, sk, fl6); +- +- if ((err = (*dst)->error)) +- goto out_err_release; ++ /* The correct way to handle this would be to do ++ * ip6_route_get_saddr, and then ip6_route_output; however, ++ * the route-specific preferred source forces the ++ * ip6_route_output call _before_ ip6_route_get_saddr. ++ * ++ * In source specific routing (no src=any default route), ++ * ip6_route_output will fail given src=any saddr, though, so ++ * that's why we try it again later. ++ */ ++ if (ipv6_addr_any(&fl6->saddr) && (!*dst || !(*dst)->error)) { ++ struct rt6_info *rt; ++ bool had_dst = *dst != NULL; + +- if (ipv6_addr_any(&fl6->saddr)) { +- struct rt6_info *rt = (struct rt6_info *) *dst; ++ if (!had_dst) ++ *dst = ip6_route_output(net, sk, fl6); ++ rt = (*dst)->error ? NULL : (struct rt6_info *)*dst; + err = ip6_route_get_saddr(net, rt, &fl6->daddr, + sk ? inet6_sk(sk)->srcprefs : 0, + &fl6->saddr); + if (err) + goto out_err_release; ++ ++ /* If we had an erroneous initial result, pretend it ++ * never existed and let the SA-enabled version take ++ * over. ++ */ ++ if (!had_dst && (*dst)->error) { ++ dst_release(*dst); ++ *dst = NULL; ++ } + } + ++ if (!*dst) ++ *dst = ip6_route_output(net, sk, fl6); ++ ++ err = (*dst)->error; ++ if (err) ++ goto out_err_release; ++ + #ifdef CONFIG_IPV6_OPTIMISTIC_DAD + /* + * Here if the dst entry we've looked up +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -2185,9 +2185,10 @@ int ip6_route_get_saddr(struct net *net, + unsigned int prefs, + struct in6_addr *saddr) + { +- struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt); ++ struct inet6_dev *idev = ++ rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL; + int err = 0; +- if (rt->rt6i_prefsrc.plen) ++ if (rt && rt->rt6i_prefsrc.plen) + *saddr = rt->rt6i_prefsrc.addr; + else + err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, diff --git a/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch new file mode 100644 index 000000000..ac4a0a6bf --- /dev/null +++ b/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -0,0 +1,249 @@ +From 1b5aaa4b16f6e6471ab1c07b38068197a1b4c395 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Fri, 24 May 2013 14:40:54 +0200 +Subject: [PATCH 1/2] ipv6: allow rejecting with "source address failed policy" + +RFC6204 L-14 requires rejecting traffic from invalid addresses with +ICMPv6 Destination Unreachable, Code 5 (Source address failed ingress/ +egress policy) on the LAN side, so add an appropriate rule for that. + +Signed-off-by: Jonas Gorski +--- + include/net/netns/ipv6.h | 1 + + include/uapi/linux/fib_rules.h | 4 +++ + include/uapi/linux/rtnetlink.h | 1 + + net/ipv4/fib_semantics.c | 4 +++ + net/ipv4/fib_trie.c | 1 + + net/ipv4/ipmr.c | 1 + + net/ipv6/fib6_rules.c | 4 +++ + net/ipv6/ip6mr.c | 2 ++ + net/ipv6/route.c | 58 +++++++++++++++++++++++++++++++++++++++++- + 9 files changed, 75 insertions(+), 1 deletion(-) + +--- a/include/net/netns/ipv6.h ++++ b/include/net/netns/ipv6.h +@@ -59,6 +59,7 @@ struct netns_ipv6 { + unsigned long ip6_rt_last_gc; + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + struct rt6_info *ip6_prohibit_entry; ++ struct rt6_info *ip6_policy_failed_entry; + struct rt6_info *ip6_blk_hole_entry; + struct fib6_table *fib6_local_tbl; + struct fib_rules_ops *fib6_rules_ops; +--- a/include/uapi/linux/fib_rules.h ++++ b/include/uapi/linux/fib_rules.h +@@ -64,6 +64,10 @@ enum { + FR_ACT_BLACKHOLE, /* Drop without notification */ + FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ + FR_ACT_PROHIBIT, /* Drop with EACCES */ ++ FR_ACT_RES9, ++ FR_ACT_RES10, ++ FR_ACT_RES11, ++ FR_ACT_POLICY_FAILED, /* Drop with EACCES */ + __FR_ACT_MAX, + }; + +--- a/include/uapi/linux/rtnetlink.h ++++ b/include/uapi/linux/rtnetlink.h +@@ -203,6 +203,7 @@ enum { + RTN_THROW, /* Not in this table */ + RTN_NAT, /* Translate this address */ + RTN_XRESOLVE, /* Use external resolver */ ++ RTN_POLICY_FAILED, /* Failed ingress/egress policy */ + __RTN_MAX + }; + +--- a/net/ipv4/fib_semantics.c ++++ b/net/ipv4/fib_semantics.c +@@ -138,6 +138,10 @@ const struct fib_prop fib_props[RTN_MAX + .error = -EINVAL, + .scope = RT_SCOPE_NOWHERE, + }, ++ [RTN_POLICY_FAILED] = { ++ .error = -EACCES, ++ .scope = RT_SCOPE_UNIVERSE, ++ }, + }; + + static void rt_fibinfo_free(struct rtable __rcu **rtp) +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -2236,6 +2236,7 @@ static const char *const rtn_type_names[ + [RTN_THROW] = "THROW", + [RTN_NAT] = "NAT", + [RTN_XRESOLVE] = "XRESOLVE", ++ [RTN_POLICY_FAILED] = "POLICY_FAILED", + }; + + static inline const char *rtn_type(char *buf, size_t len, unsigned int t) +--- a/net/ipv4/ipmr.c ++++ b/net/ipv4/ipmr.c +@@ -184,6 +184,7 @@ static int ipmr_rule_action(struct fib_r + case FR_ACT_UNREACHABLE: + return -ENETUNREACH; + case FR_ACT_PROHIBIT: ++ case FR_ACT_POLICY_FAILED: + return -EACCES; + case FR_ACT_BLACKHOLE: + default: +--- a/net/ipv6/fib6_rules.c ++++ b/net/ipv6/fib6_rules.c +@@ -73,6 +73,10 @@ static int fib6_rule_action(struct fib_r + err = -EACCES; + rt = net->ipv6.ip6_prohibit_entry; + goto discard_pkt; ++ case FR_ACT_POLICY_FAILED: ++ err = -EACCES; ++ rt = net->ipv6.ip6_policy_failed_entry; ++ goto discard_pkt; + } + + table = fib6_get_table(net, rule->table); +--- a/net/ipv6/ip6mr.c ++++ b/net/ipv6/ip6mr.c +@@ -169,6 +169,8 @@ static int ip6mr_rule_action(struct fib_ + return -ENETUNREACH; + case FR_ACT_PROHIBIT: + return -EACCES; ++ case FR_ACT_POLICY_FAILED: ++ return -EACCES; + case FR_ACT_BLACKHOLE: + default: + return -EINVAL; +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -87,6 +87,8 @@ static int ip6_pkt_discard(struct sk_bu + static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb); + static int ip6_pkt_prohibit(struct sk_buff *skb); + static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb); ++static int ip6_pkt_policy_failed(struct sk_buff *skb); ++static int ip6_pkt_policy_failed_out(struct sock *sk, struct sk_buff *skb); + static void ip6_link_failure(struct sk_buff *skb); + static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, + struct sk_buff *skb, u32 mtu); +@@ -283,6 +285,21 @@ static const struct rt6_info ip6_prohibi + .rt6i_ref = ATOMIC_INIT(1), + }; + ++static const struct rt6_info ip6_policy_failed_entry_template = { ++ .dst = { ++ .__refcnt = ATOMIC_INIT(1), ++ .__use = 1, ++ .obsolete = DST_OBSOLETE_FORCE_CHK, ++ .error = -EACCES, ++ .input = ip6_pkt_policy_failed, ++ .output = ip6_pkt_policy_failed_out, ++ }, ++ .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), ++ .rt6i_protocol = RTPROT_KERNEL, ++ .rt6i_metric = ~(u32) 0, ++ .rt6i_ref = ATOMIC_INIT(1), ++}; ++ + static const struct rt6_info ip6_blk_hole_entry_template = { + .dst = { + .__refcnt = ATOMIC_INIT(1), +@@ -1579,6 +1596,11 @@ int ip6_route_add(struct fib6_config *cf + rt->dst.output = ip6_pkt_prohibit_out; + rt->dst.input = ip6_pkt_prohibit; + break; ++ case RTN_POLICY_FAILED: ++ rt->dst.error = -EACCES; ++ rt->dst.output = ip6_pkt_policy_failed_out; ++ rt->dst.input = ip6_pkt_policy_failed; ++ break; + case RTN_THROW: + default: + rt->dst.error = (cfg->fc_type == RTN_THROW) ? -EAGAIN +@@ -2142,6 +2164,17 @@ static int ip6_pkt_prohibit_out(struct s + return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); + } + ++static int ip6_pkt_policy_failed(struct sk_buff *skb) ++{ ++ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_INNOROUTES); ++} ++ ++static int ip6_pkt_policy_failed_out(struct sock *sk, struct sk_buff *skb) ++{ ++ skb->dev = skb_dst(skb)->dev; ++ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_OUTNOROUTES); ++} ++ + /* + * Allocate a dst for local (unicast / anycast) address. + */ +@@ -2368,7 +2401,8 @@ static int rtm_to_fib6_config(struct sk_ + if (rtm->rtm_type == RTN_UNREACHABLE || + rtm->rtm_type == RTN_BLACKHOLE || + rtm->rtm_type == RTN_PROHIBIT || +- rtm->rtm_type == RTN_THROW) ++ rtm->rtm_type == RTN_THROW || ++ rtm->rtm_type == RTN_POLICY_FAILED) + cfg->fc_flags |= RTF_REJECT; + + if (rtm->rtm_type == RTN_LOCAL) +@@ -2570,6 +2604,9 @@ static int rt6_fill_node(struct net *net + case -EACCES: + rtm->rtm_type = RTN_PROHIBIT; + break; ++ case -EPERM: ++ rtm->rtm_type = RTN_POLICY_FAILED; ++ break; + case -EAGAIN: + rtm->rtm_type = RTN_THROW; + break; +@@ -2828,6 +2865,8 @@ static int ip6_route_dev_notify(struct n + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + net->ipv6.ip6_prohibit_entry->dst.dev = dev; + net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); ++ net->ipv6.ip6_policy_failed_entry->dst.dev = dev; ++ net->ipv6.ip6_policy_failed_entry->rt6i_idev = in6_dev_get(dev); + net->ipv6.ip6_blk_hole_entry->dst.dev = dev; + net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); + #endif +@@ -3054,6 +3093,17 @@ static int __net_init ip6_route_net_init + net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; + dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, + ip6_template_metrics, true); ++ ++ net->ipv6.ip6_policy_failed_entry = ++ kmemdup(&ip6_policy_failed_entry_template, ++ sizeof(*net->ipv6.ip6_policy_failed_entry), GFP_KERNEL); ++ if (!net->ipv6.ip6_policy_failed_entry) ++ goto out_ip6_blk_hole_entry; ++ net->ipv6.ip6_policy_failed_entry->dst.path = ++ (struct dst_entry *)net->ipv6.ip6_policy_failed_entry; ++ net->ipv6.ip6_policy_failed_entry->dst.ops = &net->ipv6.ip6_dst_ops; ++ dst_init_metrics(&net->ipv6.ip6_policy_failed_entry->dst, ++ ip6_template_metrics, true); + #endif + + net->ipv6.sysctl.flush_delay = 0; +@@ -3072,6 +3122,8 @@ out: + return ret; + + #ifdef CONFIG_IPV6_MULTIPLE_TABLES ++out_ip6_blk_hole_entry: ++ kfree(net->ipv6.ip6_blk_hole_entry); + out_ip6_prohibit_entry: + kfree(net->ipv6.ip6_prohibit_entry); + out_ip6_null_entry: +@@ -3089,6 +3141,7 @@ static void __net_exit ip6_route_net_exi + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + kfree(net->ipv6.ip6_prohibit_entry); + kfree(net->ipv6.ip6_blk_hole_entry); ++ kfree(net->ipv6.ip6_policy_failed_entry); + #endif + dst_entries_destroy(&net->ipv6.ip6_dst_ops); + } +@@ -3162,6 +3215,9 @@ void __init ip6_route_init_special_entri + init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); + init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; + init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); ++ init_net.ipv6.ip6_policy_failed_entry->dst.dev = init_net.loopback_dev; ++ init_net.ipv6.ip6_policy_failed_entry->rt6i_idev = ++ in6_dev_get(init_net.loopback_dev); + #endif + } + diff --git a/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch new file mode 100644 index 000000000..25a863939 --- /dev/null +++ b/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch @@ -0,0 +1,53 @@ +From 7749b481ce5d7e232b1f7da5e6b2c44816f51681 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Sun, 19 Jan 2014 20:45:51 +0100 +Subject: [PATCH 2/2] net: provide defines for _POLICY_FAILED until all code is + updated + +Upstream introduced ICMPV6_POLICY_FAIL for code 5 of destination +unreachable, conflicting with our name. + +Add appropriate defines to allow our code to build with the new +name until we have updated our local patches for older kernels +and userspace packages. + +Signed-off-by: Jonas Gorski +--- + include/uapi/linux/fib_rules.h | 2 ++ + include/uapi/linux/icmpv6.h | 2 ++ + include/uapi/linux/rtnetlink.h | 2 ++ + 3 files changed, 6 insertions(+) + +--- a/include/uapi/linux/fib_rules.h ++++ b/include/uapi/linux/fib_rules.h +@@ -71,6 +71,8 @@ enum { + __FR_ACT_MAX, + }; + ++#define FR_ACT_FAILED_POLICY FR_ACT_POLICY_FAILED ++ + #define FR_ACT_MAX (__FR_ACT_MAX - 1) + + #endif +--- a/include/uapi/linux/icmpv6.h ++++ b/include/uapi/linux/icmpv6.h +@@ -118,6 +118,8 @@ struct icmp6hdr { + #define ICMPV6_POLICY_FAIL 5 + #define ICMPV6_REJECT_ROUTE 6 + ++#define ICMPV6_FAILED_POLICY ICMPV6_POLICY_FAIL ++ + /* + * Codes for Time Exceeded + */ +--- a/include/uapi/linux/rtnetlink.h ++++ b/include/uapi/linux/rtnetlink.h +@@ -207,6 +207,8 @@ enum { + __RTN_MAX + }; + ++#define RTN_FAILED_POLICY RTN_POLICY_FAILED ++ + #define RTN_MAX (__RTN_MAX - 1) + + diff --git a/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch new file mode 100644 index 000000000..1f2f89daa --- /dev/null +++ b/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -0,0 +1,160 @@ +Subject: NET: skip GRO for foreign MAC addresses + +For network drivers using napi_gro_receive, packets are run through GRO, +even when the destination MAC address does not match, and they're supposed +to be delivered to another host behind a different bridge port. + +This can be very expensive, because for drivers without TSO or scatter- +gather, this can only be undone by copying the skb and checksumming it +again. + +To be able to track foreign MAC addresses in an inexpensive way, create +a mask of changed bits in MAC addresses of upper devices. This allows +handling VLANs and bridge devices with different addresses (as long as +they are not too different). + +Signed-off-by: Felix Fietkau + +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -4028,6 +4028,9 @@ static enum gro_result dev_gro_receive(s + enum gro_result ret; + int grow; + ++ if (skb->gro_skip) ++ goto normal; ++ + if (!(skb->dev->features & NETIF_F_GRO)) + goto normal; + +@@ -5099,6 +5102,48 @@ static void __netdev_adjacent_dev_unlink + &upper_dev->adj_list.lower); + } + ++static void __netdev_addr_mask(unsigned char *mask, const unsigned char *addr, ++ struct net_device *dev) ++{ ++ int i; ++ ++ for (i = 0; i < dev->addr_len; i++) ++ mask[i] |= addr[i] ^ dev->dev_addr[i]; ++} ++ ++static void __netdev_upper_mask(unsigned char *mask, struct net_device *dev, ++ struct net_device *lower) ++{ ++ struct net_device *cur; ++ struct list_head *iter; ++ ++ netdev_for_each_upper_dev_rcu(dev, cur, iter) { ++ __netdev_addr_mask(mask, cur->dev_addr, lower); ++ __netdev_upper_mask(mask, cur, lower); ++ } ++} ++ ++static void __netdev_update_addr_mask(struct net_device *dev) ++{ ++ unsigned char mask[MAX_ADDR_LEN]; ++ struct net_device *cur; ++ struct list_head *iter; ++ ++ memset(mask, 0, sizeof(mask)); ++ __netdev_upper_mask(mask, dev, dev); ++ memcpy(dev->local_addr_mask, mask, dev->addr_len); ++ ++ netdev_for_each_lower_dev(dev, cur, iter) ++ __netdev_update_addr_mask(cur); ++} ++ ++static void netdev_update_addr_mask(struct net_device *dev) ++{ ++ rcu_read_lock(); ++ __netdev_update_addr_mask(dev); ++ rcu_read_unlock(); ++} ++ + static int __netdev_upper_dev_link(struct net_device *dev, + struct net_device *upper_dev, bool master, + void *private) +@@ -5159,6 +5204,7 @@ static int __netdev_upper_dev_link(struc + goto rollback_lower_mesh; + } + ++ netdev_update_addr_mask(dev); + call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev); + return 0; + +@@ -5276,6 +5322,7 @@ void netdev_upper_dev_unlink(struct net_ + list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) + __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr); + ++ netdev_update_addr_mask(dev); + call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev); + } + EXPORT_SYMBOL(netdev_upper_dev_unlink); +@@ -5795,6 +5842,7 @@ int dev_set_mac_address(struct net_devic + if (err) + return err; + dev->addr_assign_type = NET_ADDR_SET; ++ netdev_update_addr_mask(dev); + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); + add_device_randomness(dev->dev_addr, dev->addr_len); + return 0; +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1556,6 +1556,8 @@ struct net_device { + struct netdev_hw_addr_list mc; + struct netdev_hw_addr_list dev_addrs; + ++ unsigned char local_addr_mask[MAX_ADDR_LEN]; ++ + #ifdef CONFIG_SYSFS + struct kset *queues_kset; + #endif +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -598,7 +598,8 @@ struct sk_buff { + __u8 ipvs_property:1; + + __u8 inner_protocol_type:1; +- /* 4 or 6 bit hole */ ++ __u8 gro_skip:1; ++ /* 3 or 5 bit hole */ + + #ifdef CONFIG_NET_SCHED + __u16 tc_index; /* traffic control index */ +--- a/net/ethernet/eth.c ++++ b/net/ethernet/eth.c +@@ -172,6 +172,18 @@ u32 eth_get_headlen(void *data, unsigned + } + EXPORT_SYMBOL(eth_get_headlen); + ++static inline bool ++eth_check_local_mask(const void *addr1, const void *addr2, const void *mask) ++{ ++ const u16 *a1 = addr1; ++ const u16 *a2 = addr2; ++ const u16 *m = mask; ++ ++ return (((a1[0] ^ a2[0]) & ~m[0]) | ++ ((a1[1] ^ a2[1]) & ~m[1]) | ++ ((a1[2] ^ a2[2]) & ~m[2])); ++} ++ + /** + * eth_type_trans - determine the packet's protocol ID. + * @skb: received socket data +@@ -199,8 +211,12 @@ __be16 eth_type_trans(struct sk_buff *sk + skb->pkt_type = PACKET_MULTICAST; + } + else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, +- dev->dev_addr))) ++ dev->dev_addr))) { + skb->pkt_type = PACKET_OTHERHOST; ++ if (eth_check_local_mask(eth->h_dest, dev->dev_addr, ++ dev->local_addr_mask)) ++ skb->gro_skip = 1; ++ } + + /* + * Some variants of DSA tagging don't have an ethertype field diff --git a/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch new file mode 100644 index 000000000..a836eed86 --- /dev/null +++ b/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch @@ -0,0 +1,88 @@ +From: John Crispin +Date: Sun, 27 Jul 2014 09:40:01 +0100 +Subject: NET: add of_get_mac_address_mtd() + +Many embedded devices have information such as mac addresses stored inside mtd +devices. This patch allows us to add a property inside a node describing a +network interface. The new property points at a mtd partition with an offset +where the mac address can be found. + +Signed-off-by: John Crispin +--- + drivers/of/of_net.c | 37 +++++++++++++++++++++++++++++++++++++ + include/linux/of_net.h | 1 + + 2 files changed, 38 insertions(+) + +--- a/drivers/of/of_net.c ++++ b/drivers/of/of_net.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + /** + * of_get_phy_mode - Get phy mode for given device_node +@@ -75,3 +76,45 @@ const void *of_get_mac_address(struct de + return NULL; + } + EXPORT_SYMBOL(of_get_mac_address); ++ ++#ifdef CONFIG_MTD ++int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac) ++{ ++ struct device_node *mtd_np = NULL; ++ size_t retlen; ++ int size, ret; ++ struct mtd_info *mtd; ++ const char *part; ++ const __be32 *list; ++ phandle phandle; ++ u32 mac_inc = 0; ++ ++ list = of_get_property(np, "mtd-mac-address", &size); ++ if (!list || (size != (2 * sizeof(*list)))) ++ return -ENOENT; ++ ++ phandle = be32_to_cpup(list++); ++ if (phandle) ++ mtd_np = of_find_node_by_phandle(phandle); ++ ++ if (!mtd_np) ++ return -ENOENT; ++ ++ part = of_get_property(mtd_np, "label", NULL); ++ if (!part) ++ part = mtd_np->name; ++ ++ mtd = get_mtd_device_nm(part); ++ if (IS_ERR(mtd)) ++ return PTR_ERR(mtd); ++ ++ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac); ++ put_mtd_device(mtd); ++ ++ if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc)) ++ mac[5] += mac_inc; ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(of_get_mac_address_mtd); ++#endif +--- a/include/linux/of_net.h ++++ b/include/linux/of_net.h +@@ -11,6 +11,14 @@ + #include + extern int of_get_phy_mode(struct device_node *np); + extern const void *of_get_mac_address(struct device_node *np); ++#ifdef CONFIG_MTD ++extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac); ++#else ++static inline int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac) ++{ ++ return -ENOENT; ++} ++#endif + #else + static inline int of_get_phy_mode(struct device_node *np) + { diff --git a/target/linux/generic/pending-3.18/700-swconfig.patch b/target/linux/generic/pending-3.18/700-swconfig.patch new file mode 100644 index 000000000..7cf525a50 --- /dev/null +++ b/target/linux/generic/pending-3.18/700-swconfig.patch @@ -0,0 +1,39 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -12,6 +12,16 @@ menuconfig PHYLIB + + if PHYLIB + ++config SWCONFIG ++ tristate "Switch configuration API" ++ ---help--- ++ Switch configuration API using netlink. This allows ++ you to configure the VLAN features of certain switches. ++ ++config SWCONFIG_LEDS ++ bool "Switch LED trigger support" ++ depends on (SWCONFIG && LEDS_TRIGGERS) ++ + comment "MII PHY device drivers" + + config AT803X_PHY +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -3,6 +3,7 @@ + libphy-objs := phy.o phy_device.o mdio_bus.o + + obj-$(CONFIG_PHYLIB) += libphy.o ++obj-$(CONFIG_SWCONFIG) += swconfig.o + obj-$(CONFIG_MARVELL_PHY) += marvell.o + obj-$(CONFIG_DAVICOM_PHY) += davicom.o + obj-$(CONFIG_CICADA_PHY) += cicada.o +--- a/include/uapi/linux/Kbuild ++++ b/include/uapi/linux/Kbuild +@@ -374,6 +374,7 @@ header-y += stddef.h + header-y += string.h + header-y += suspend_ioctls.h + header-y += swab.h ++header-y += switch.h + header-y += synclink.h + header-y += sysctl.h + header-y += sysinfo.h diff --git a/target/linux/generic/pending-3.18/701-phy_extension.patch b/target/linux/generic/pending-3.18/701-phy_extension.patch new file mode 100644 index 000000000..ffc310a13 --- /dev/null +++ b/target/linux/generic/pending-3.18/701-phy_extension.patch @@ -0,0 +1,63 @@ +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -363,6 +363,50 @@ int phy_ethtool_gset(struct phy_device * + } + EXPORT_SYMBOL(phy_ethtool_gset); + ++int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) ++{ ++ u32 cmd; ++ int tmp; ++ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; ++ struct ethtool_value edata = { ETHTOOL_GLINK }; ++ ++ if (get_user(cmd, (u32 *) useraddr)) ++ return -EFAULT; ++ ++ switch (cmd) { ++ case ETHTOOL_GSET: ++ phy_ethtool_gset(phydev, &ecmd); ++ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) ++ return -EFAULT; ++ return 0; ++ ++ case ETHTOOL_SSET: ++ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) ++ return -EFAULT; ++ return phy_ethtool_sset(phydev, &ecmd); ++ ++ case ETHTOOL_NWAY_RST: ++ /* if autoneg is off, it's an error */ ++ tmp = phy_read(phydev, MII_BMCR); ++ if (tmp & BMCR_ANENABLE) { ++ tmp |= (BMCR_ANRESTART); ++ phy_write(phydev, MII_BMCR, tmp); ++ return 0; ++ } ++ return -EINVAL; ++ ++ case ETHTOOL_GLINK: ++ edata.data = (phy_read(phydev, ++ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; ++ if (copy_to_user(useraddr, &edata, sizeof(edata))) ++ return -EFAULT; ++ return 0; ++ } ++ ++ return -EOPNOTSUPP; ++} ++EXPORT_SYMBOL(phy_ethtool_ioctl); ++ + /** + * phy_mii_ioctl - generic PHY MII ioctl interface + * @phydev: the phy_device struct +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -759,6 +759,7 @@ void phy_start_machine(struct phy_device + void phy_stop_machine(struct phy_device *phydev); + int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); + int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); ++int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); + int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); + int phy_start_interrupts(struct phy_device *phydev); + void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch b/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch new file mode 100644 index 000000000..49ffd2781 --- /dev/null +++ b/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch @@ -0,0 +1,27 @@ +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -480,6 +480,12 @@ struct phy_driver { + /* Determines the negotiated speed and duplex */ + int (*read_status)(struct phy_device *phydev); + ++ /* ++ * Update the value in phydev->link to reflect the ++ * current link value ++ */ ++ int (*update_link)(struct phy_device *phydev); ++ + /* Clears any pending interrupts */ + int (*ack_interrupt)(struct phy_device *phydev); + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -915,6 +915,9 @@ int genphy_update_link(struct phy_device + { + int status; + ++ if (phydev->drv && phydev->drv->update_link) ++ return phydev->drv->update_link(phydev); ++ + /* Do a fake read */ + status = phy_read(phydev, MII_BMSR); + if (status < 0) diff --git a/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch new file mode 100644 index 000000000..ca8e45583 --- /dev/null +++ b/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -0,0 +1,27 @@ +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -674,6 +674,9 @@ void phy_detach(struct phy_device *phyde + { + int i; + ++ if (phydev->drv && phydev->drv->detach) ++ phydev->drv->detach(phydev); ++ + if (phydev->bus->dev.driver) + module_put(phydev->bus->dev.driver->owner); + +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -498,6 +498,12 @@ struct phy_driver { + */ + int (*did_interrupt)(struct phy_device *phydev); + ++ /* ++ * Called before an ethernet device is detached ++ * from the PHY. ++ */ ++ void (*detach)(struct phy_device *phydev); ++ + /* Clears up any memory if needed */ + void (*remove)(struct phy_device *phydev); + diff --git a/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch new file mode 100644 index 000000000..60026b474 --- /dev/null +++ b/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch @@ -0,0 +1,192 @@ +--- a/drivers/net/phy/mdio_bus.c ++++ b/drivers/net/phy/mdio_bus.c +@@ -38,6 +38,8 @@ + + #include + ++#include "mdio-boardinfo.h" ++ + /** + * mdiobus_alloc_size - allocate a mii_bus structure + * @size: extra amount of memory to allocate for private storage. +@@ -335,9 +337,21 @@ void mdiobus_free(struct mii_bus *bus) + } + EXPORT_SYMBOL(mdiobus_free); + ++static void mdiobus_setup_phydev_from_boardinfo(struct mii_bus *bus, ++ struct phy_device *phydev, ++ struct mdio_board_info *bi) ++{ ++ if (strcmp(bus->id, bi->bus_id) || ++ bi->phy_addr != phydev->addr) ++ return; ++ ++ phydev->dev.platform_data = (void *) bi->platform_data; ++} ++ + struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) + { + struct phy_device *phydev; ++ struct mdio_board_entry *be; + int err; + + phydev = get_phy_device(bus, addr, false); +@@ -350,6 +364,12 @@ struct phy_device *mdiobus_scan(struct m + */ + of_mdiobus_link_phydev(bus, phydev); + ++ mutex_lock(&__mdio_board_lock); ++ list_for_each_entry(be, &__mdio_board_list, list) ++ mdiobus_setup_phydev_from_boardinfo(bus, phydev, ++ &be->board_info); ++ mutex_unlock(&__mdio_board_lock); ++ + err = phy_device_register(phydev); + if (err) { + phy_device_free(phydev); +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -796,4 +796,22 @@ int __init mdio_bus_init(void); + void mdio_bus_exit(void); + + extern struct bus_type mdio_bus_type; ++ ++struct mdio_board_info { ++ const char *bus_id; ++ int phy_addr; ++ ++ const void *platform_data; ++}; ++ ++#ifdef CONFIG_MDIO_BOARDINFO ++int mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n); ++#else ++static inline int ++mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n) ++{ ++ return 0; ++} ++#endif ++ + #endif /* __PHY_H */ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -12,6 +12,10 @@ menuconfig PHYLIB + + if PHYLIB + ++config MDIO_BOARDINFO ++ bool ++ default y ++ + config SWCONFIG + tristate "Switch configuration API" + ---help--- +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -2,6 +2,8 @@ + + libphy-objs := phy.o phy_device.o mdio_bus.o + ++obj-$(CONFIG_MDIO_BOARDINFO) += mdio-boardinfo.o ++ + obj-$(CONFIG_PHYLIB) += libphy.o + obj-$(CONFIG_SWCONFIG) += swconfig.o + obj-$(CONFIG_MARVELL_PHY) += marvell.o +--- /dev/null ++++ b/drivers/net/phy/mdio-boardinfo.c +@@ -0,0 +1,58 @@ ++/* ++ * mdio-boardinfo.c - collect pre-declarations of PHY devices ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "mdio-boardinfo.h" ++ ++/* ++ * These symbols are exported ONLY FOR the mdio_bus component. ++ * No other users will be supported. ++ */ ++ ++LIST_HEAD(__mdio_board_list); ++EXPORT_SYMBOL_GPL(__mdio_board_list); ++ ++DEFINE_MUTEX(__mdio_board_lock); ++EXPORT_SYMBOL_GPL(__mdio_board_lock); ++ ++/** ++ * mdio_register_board_info - register PHY devices for a given board ++ * @info: array of chip descriptors ++ * @n: how many descriptors are provided ++ * Context: can sleep ++ * ++ * The board info passed can safely be __initdata ... but be careful of ++ * any embedded pointers (platform_data, etc), they're copied as-is. ++ */ ++int __init ++mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) ++{ ++ struct mdio_board_entry *be; ++ int i; ++ ++ be = kzalloc(n * sizeof(*be), GFP_KERNEL); ++ if (!be) ++ return -ENOMEM; ++ ++ for (i = 0; i < n; i++, be++, info++) { ++ memcpy(&be->board_info, info, sizeof(*info)); ++ mutex_lock(&__mdio_board_lock); ++ list_add_tail(&be->list, &__mdio_board_list); ++ mutex_unlock(&__mdio_board_lock); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/net/phy/mdio-boardinfo.h +@@ -0,0 +1,22 @@ ++/* ++ * mdio-boardinfo.h - boardinfo interface internal to the mdio_bus component ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include ++ ++struct mdio_board_entry { ++ struct list_head list; ++ struct mdio_board_info board_info; ++}; ++ ++/* __mdio_board_lock protects __mdio_board_list ++ * only mdio_bus components are allowed to use these symbols. ++ */ ++extern struct mutex __mdio_board_lock; ++extern struct list_head __mdio_board_list; +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile +@@ -15,7 +15,7 @@ obj-$(CONFIG_MII) += mii.o + obj-$(CONFIG_MDIO) += mdio.o + obj-$(CONFIG_NET) += Space.o loopback.o + obj-$(CONFIG_NETCONSOLE) += netconsole.o +-obj-$(CONFIG_PHYLIB) += phy/ ++obj-y += phy/ + obj-$(CONFIG_RIONET) += rionet.o + obj-$(CONFIG_NET_TEAM) += team/ + obj-$(CONFIG_TUN) += tun.o diff --git a/target/linux/generic/pending-3.18/720-phy_adm6996.patch b/target/linux/generic/pending-3.18/720-phy_adm6996.patch new file mode 100644 index 000000000..b0b8db4e5 --- /dev/null +++ b/target/linux/generic/pending-3.18/720-phy_adm6996.patch @@ -0,0 +1,26 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -132,6 +132,13 @@ config MICREL_PHY + ---help--- + Supports the KSZ9021, VSC8201, KS8001 PHYs. + ++config ADM6996_PHY ++ tristate "Driver for ADM6996 switches" ++ select SWCONFIG ++ ---help--- ++ Currently supports the ADM6996FC and ADM6996M switches. ++ Support for FC is very limited. ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o + obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o + obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o ++obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/721-phy_packets.patch b/target/linux/generic/pending-3.18/721-phy_packets.patch new file mode 100644 index 000000000..ed51bb1d2 --- /dev/null +++ b/target/linux/generic/pending-3.18/721-phy_packets.patch @@ -0,0 +1,161 @@ +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1228,6 +1228,7 @@ enum netdev_priv_flags { + IFF_LIVE_ADDR_CHANGE = 1<<20, + IFF_MACVLAN = 1<<21, + IFF_XMIT_DST_RELEASE_PERM = 1<<22, ++ IFF_NO_IP_ALIGN = 1<<23, + }; + + #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN +@@ -1253,6 +1254,7 @@ enum netdev_priv_flags { + #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE + #define IFF_MACVLAN IFF_MACVLAN + #define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM ++#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN + + /** + * struct net_device - The DEVICE structure. +@@ -1523,6 +1525,11 @@ struct net_device { + const struct ethtool_ops *ethtool_ops; + const struct forwarding_accel_ops *fwd_ops; + ++#ifdef CONFIG_ETHERNET_PACKET_MANGLE ++ void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb); ++ struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb); ++#endif ++ + const struct header_ops *header_ops; + + unsigned int flags; +@@ -1587,6 +1594,10 @@ struct net_device { + void *ax25_ptr; + struct wireless_dev *ieee80211_ptr; + ++#ifdef CONFIG_ETHERNET_PACKET_MANGLE ++ void *phy_ptr; /* PHY device specific data */ ++#endif ++ + /* + * Cache lines mostly used on receive path (including eth_type_trans()) + */ +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -2055,6 +2055,10 @@ static inline int pskb_trim(struct sk_bu + return (len < skb->len) ? __pskb_trim(skb, len) : 0; + } + ++extern struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, ++ unsigned int length, gfp_t gfp); ++ ++ + /** + * pskb_trim_unique - remove end from a paged unique (not cloned) buffer + * @skb: buffer to alter +@@ -2181,16 +2185,6 @@ static inline struct sk_buff *dev_alloc_ + } + + +-static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, +- unsigned int length, gfp_t gfp) +-{ +- struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); +- +- if (NET_IP_ALIGN && skb) +- skb_reserve(skb, NET_IP_ALIGN); +- return skb; +-} +- + static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, + unsigned int length) + { +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -25,6 +25,12 @@ menuconfig NET + + if NET + ++config ETHERNET_PACKET_MANGLE ++ bool ++ help ++ This option can be selected by phy drivers that need to mangle ++ packets going in or out of an ethernet device. ++ + config WANT_COMPAT_NETLINK_MESSAGES + bool + help +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -2637,10 +2637,20 @@ static int xmit_one(struct sk_buff *skb, + if (!list_empty(&ptype_all)) + dev_queue_xmit_nit(skb, dev); + +- len = skb->len; +- trace_net_dev_start_xmit(skb, dev); +- rc = netdev_start_xmit(skb, dev, txq, more); +- trace_net_dev_xmit(skb, rc, dev, len); ++#ifdef CONFIG_ETHERNET_PACKET_MANGLE ++ if (!dev->eth_mangle_tx || ++ (skb = dev->eth_mangle_tx(dev, skb)) != NULL) ++#else ++ if (1) ++#endif ++ { ++ len = skb->len; ++ trace_net_dev_start_xmit(skb, dev); ++ rc = netdev_start_xmit(skb, dev, txq, more); ++ trace_net_dev_xmit(skb, rc, dev, len); ++ } else { ++ rc = NETDEV_TX_OK; ++ } + + return rc; + } +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -63,6 +63,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -471,6 +472,22 @@ struct sk_buff *__netdev_alloc_skb(struc + } + EXPORT_SYMBOL(__netdev_alloc_skb); + ++struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, ++ unsigned int length, gfp_t gfp) ++{ ++ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); ++ ++#ifdef CONFIG_ETHERNET_PACKET_MANGLE ++ if (dev && (dev->priv_flags & IFF_NO_IP_ALIGN)) ++ return skb; ++#endif ++ ++ if (NET_IP_ALIGN && skb) ++ skb_reserve(skb, NET_IP_ALIGN); ++ return skb; ++} ++EXPORT_SYMBOL(__netdev_alloc_skb_ip_align); ++ + void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, + int size, unsigned int truesize) + { +--- a/net/ethernet/eth.c ++++ b/net/ethernet/eth.c +@@ -200,6 +200,12 @@ __be16 eth_type_trans(struct sk_buff *sk + const struct ethhdr *eth; + + skb->dev = dev; ++ ++#ifdef CONFIG_ETHERNET_PACKET_MANGLE ++ if (dev->eth_mangle_rx) ++ dev->eth_mangle_rx(dev, skb); ++#endif ++ + skb_reset_mac_header(skb); + skb_pull_inline(skb, ETH_HLEN); + eth = eth_hdr(skb); diff --git a/target/linux/generic/pending-3.18/722-phy_mvswitch.patch b/target/linux/generic/pending-3.18/722-phy_mvswitch.patch new file mode 100644 index 000000000..f577a9f68 --- /dev/null +++ b/target/linux/generic/pending-3.18/722-phy_mvswitch.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -139,6 +139,10 @@ config ADM6996_PHY + Currently supports the ADM6996FC and ADM6996M switches. + Support for FC is very limited. + ++config MVSWITCH_PHY ++ tristate "Driver for Marvell 88E6060 switches" ++ select ETHERNET_PACKET_MANGLE ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o + obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o + obj-$(CONFIG_ADM6996_PHY) += adm6996.o ++obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/723-phy_ip175c.patch b/target/linux/generic/pending-3.18/723-phy_ip175c.patch new file mode 100644 index 000000000..c7c4f99ee --- /dev/null +++ b/target/linux/generic/pending-3.18/723-phy_ip175c.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -143,6 +143,10 @@ config MVSWITCH_PHY + tristate "Driver for Marvell 88E6060 switches" + select ETHERNET_PACKET_MANGLE + ++config IP17XX_PHY ++ tristate "Driver for IC+ IP17xx switches" ++ select SWCONFIG ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o + obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o ++obj-$(CONFIG_IP17XX_PHY) += ip17xx.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/724-phy_ar8216.patch b/target/linux/generic/pending-3.18/724-phy_ar8216.patch new file mode 100644 index 000000000..acb2df8f8 --- /dev/null +++ b/target/linux/generic/pending-3.18/724-phy_ar8216.patch @@ -0,0 +1,24 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -147,6 +147,11 @@ config IP17XX_PHY + tristate "Driver for IC+ IP17xx switches" + select SWCONFIG + ++config AR8216_PHY ++ tristate "Driver for Atheros AR8216 switches" ++ select ETHERNET_PACKET_MANGLE ++ select SWCONFIG ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -22,6 +22,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o + obj-$(CONFIG_IP17XX_PHY) += ip17xx.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o ++obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/725-phy_rtl8306.patch b/target/linux/generic/pending-3.18/725-phy_rtl8306.patch new file mode 100644 index 000000000..78ac6ce98 --- /dev/null +++ b/target/linux/generic/pending-3.18/725-phy_rtl8306.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -152,6 +152,10 @@ config AR8216_PHY + select ETHERNET_PACKET_MANGLE + select SWCONFIG + ++config RTL8306_PHY ++ tristate "Driver for Realtek RTL8306S switches" ++ select SWCONFIG ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -23,6 +23,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o + obj-$(CONFIG_IP17XX_PHY) += ip17xx.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o ++obj-$(CONFIG_RTL8306_PHY) += rtl8306.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/726-phy_rtl8366.patch b/target/linux/generic/pending-3.18/726-phy_rtl8366.patch new file mode 100644 index 000000000..4a4a4acee --- /dev/null +++ b/target/linux/generic/pending-3.18/726-phy_rtl8366.patch @@ -0,0 +1,45 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -250,6 +250,30 @@ config MDIO_BCM_UNIMAC + controllers as well as some Broadcom Ethernet switches such as the + Starfighter 2 switches. + ++config RTL8366_SMI ++ tristate "Driver for the RTL8366 SMI interface" ++ depends on GPIOLIB ++ ---help--- ++ This module implements the SMI interface protocol which is used ++ by some RTL8366 ethernet switch devices via the generic GPIO API. ++ ++if RTL8366_SMI ++ ++config RTL8366_SMI_DEBUG_FS ++ bool "RTL8366 SMI interface debugfs support" ++ depends on DEBUG_FS ++ default n ++ ++config RTL8366S_PHY ++ tristate "Driver for the Realtek RTL8366S switch" ++ select SWCONFIG ++ ++config RTL8366RB_PHY ++ tristate "Driver for the Realtek RTL8366RB switch" ++ select SWCONFIG ++ ++endif # RTL8366_SMI ++ + endif # PHYLIB + + config MICREL_KS8995MA +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -24,6 +24,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o + obj-$(CONFIG_RTL8306_PHY) += rtl8306.o ++obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o ++obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o ++obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/727-phy-rtl8367.patch b/target/linux/generic/pending-3.18/727-phy-rtl8367.patch new file mode 100644 index 000000000..8481b589d --- /dev/null +++ b/target/linux/generic/pending-3.18/727-phy-rtl8367.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -272,6 +272,10 @@ config RTL8366RB_PHY + tristate "Driver for the Realtek RTL8366RB switch" + select SWCONFIG + ++config RTL8367_PHY ++ tristate "Driver for the Realtek RTL8367R/M switches" ++ select SWCONFIG ++ + endif # RTL8366_SMI + + endif # PHYLIB +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -27,6 +27,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o + obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o + obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o + obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o ++obj-$(CONFIG_RTL8367_PHY) += rtl8367.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch b/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch new file mode 100644 index 000000000..958ff5890 --- /dev/null +++ b/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -276,6 +276,10 @@ config RTL8367_PHY + tristate "Driver for the Realtek RTL8367R/M switches" + select SWCONFIG + ++config RTL8367B_PHY ++ tristate "Driver fot the Realtek RTL8367R-VB switch" ++ select SWCONFIG ++ + endif # RTL8366_SMI + + endif # PHYLIB +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -28,6 +28,7 @@ obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi + obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o + obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o + obj-$(CONFIG_RTL8367_PHY) += rtl8367.o ++obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/729-phy-tantos.patch b/target/linux/generic/pending-3.18/729-phy-tantos.patch new file mode 100644 index 000000000..019f91949 --- /dev/null +++ b/target/linux/generic/pending-3.18/729-phy-tantos.patch @@ -0,0 +1,21 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -287,3 +287,8 @@ endif # PHYLIB + config MICREL_KS8995MA + tristate "Micrel KS8995MA 5-ports 10/100 managed Ethernet switch" + depends on SPI ++ ++config PSB6970_PHY ++ tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" ++ select SWCONFIG ++ select ETHERNET_PACKET_MANGLE +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -30,6 +30,7 @@ obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb + obj-$(CONFIG_RTL8367_PHY) += rtl8367.o + obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o ++obj-$(CONFIG_PSB6970_PHY) += psb6970.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o + obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/pending-3.18/730-phy_b53.patch b/target/linux/generic/pending-3.18/730-phy_b53.patch new file mode 100644 index 000000000..03fc369c9 --- /dev/null +++ b/target/linux/generic/pending-3.18/730-phy_b53.patch @@ -0,0 +1,21 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -282,6 +282,8 @@ config RTL8367B_PHY + + endif # RTL8366_SMI + ++source "drivers/net/phy/b53/Kconfig" ++ + endif # PHYLIB + + config MICREL_KS8995MA +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -31,6 +31,7 @@ obj-$(CONFIG_RTL8367_PHY) += rtl8367.o + obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_PSB6970_PHY) += psb6970.o ++obj-$(CONFIG_SWCONFIG_B53) += b53/ + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o + obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch b/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch new file mode 100644 index 000000000..c75396757 --- /dev/null +++ b/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch @@ -0,0 +1,13 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -152,6 +152,10 @@ config AR8216_PHY + select ETHERNET_PACKET_MANGLE + select SWCONFIG + ++config AR8216_PHY_LEDS ++ bool "Atheros AR8216 switch LED support" ++ depends on (AR8216_PHY && LEDS_CLASS) ++ + config RTL8306_PHY + tristate "Driver for Realtek RTL8306S switches" + select SWCONFIG diff --git a/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch b/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch new file mode 100644 index 000000000..041d168b6 --- /dev/null +++ b/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -143,6 +143,10 @@ config MVSWITCH_PHY + tristate "Driver for Marvell 88E6060 switches" + select ETHERNET_PACKET_MANGLE + ++config MVSW61XX_PHY ++ tristate "Driver for Marvell 88E6171/6172 switches" ++ select SWCONFIG ++ + config IP17XX_PHY + tristate "Driver for IC+ IP17xx switches" + select SWCONFIG +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o + obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o ++obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o + obj-$(CONFIG_IP17XX_PHY) += ip17xx.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o diff --git a/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch new file mode 100644 index 000000000..0d021ac7b --- /dev/null +++ b/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch @@ -0,0 +1,180 @@ +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -12,12 +12,14 @@ + */ + + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + + #define AT803X_INTR_ENABLE 0x12 + #define AT803X_INTR_STATUS 0x13 +@@ -34,8 +36,16 @@ + #define AT803X_INER 0x0012 + #define AT803X_INER_INIT 0xec00 + #define AT803X_INSR 0x0013 ++ ++#define AT803X_PCS_SMART_EEE_CTRL3 0x805D ++#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 ++#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT 12 ++#define AT803X_SMART_EEE_CTRL3_LPI_EN BIT(8) ++ + #define AT803X_DEBUG_ADDR 0x1D + #define AT803X_DEBUG_DATA 0x1E ++#define AT803X_DBG0_REG 0x00 ++#define AT803X_DEBUG_RGMII_RX_CLK_DLY BIT(8) + #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 + #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) + +@@ -50,6 +60,7 @@ MODULE_LICENSE("GPL"); + struct at803x_priv { + bool phy_reset:1; + struct gpio_desc *gpiod_reset; ++ int prev_speed; + }; + + struct at803x_context { +@@ -61,6 +72,43 @@ struct at803x_context { + u16 led_control; + }; + ++static u16 ++at803x_dbg_reg_rmw(struct phy_device *phydev, u16 reg, u16 clear, u16 set) ++{ ++ struct mii_bus *bus = phydev->bus; ++ int val; ++ ++ mutex_lock(&bus->mdio_lock); ++ ++ bus->write(bus, phydev->addr, AT803X_DEBUG_ADDR, reg); ++ val = bus->read(bus, phydev->addr, AT803X_DEBUG_DATA); ++ if (val < 0) { ++ val = 0xffff; ++ goto out; ++ } ++ ++ val &= ~clear; ++ val |= set; ++ bus->write(bus, phydev->addr, AT803X_DEBUG_DATA, val); ++ ++out: ++ mutex_unlock(&bus->mdio_lock); ++ return val; ++} ++ ++static inline void ++at803x_dbg_reg_set(struct phy_device *phydev, u16 reg, u16 set) ++{ ++ at803x_dbg_reg_rmw(phydev, reg, 0, set); ++} ++ ++static inline void ++at803x_dbg_reg_clr(struct phy_device *phydev, u16 reg, u16 clear) ++{ ++ at803x_dbg_reg_rmw(phydev, reg, clear, 0); ++} ++ ++ + /* save relevant PHY registers to private copy */ + static void at803x_context_save(struct phy_device *phydev, + struct at803x_context *context) +@@ -208,8 +256,16 @@ static int at803x_probe(struct phy_devic + return 0; + } + ++static void at803x_disable_smarteee(struct phy_device *phydev) ++{ ++ phy_write_mmd(phydev, MDIO_MMD_PCS, AT803X_PCS_SMART_EEE_CTRL3, ++ 1 << AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT); ++ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); ++} ++ + static int at803x_config_init(struct phy_device *phydev) + { ++ struct at803x_platform_data *pdata; + int ret; + + ret = genphy_config_init(phydev); +@@ -227,6 +283,26 @@ static int at803x_config_init(struct phy + return ret; + } + ++ pdata = dev_get_platdata(&phydev->dev); ++ if (pdata) { ++ if (pdata->disable_smarteee) ++ at803x_disable_smarteee(phydev); ++ ++ if (pdata->enable_rgmii_rx_delay) ++ at803x_dbg_reg_set(phydev, AT803X_DBG0_REG, ++ AT803X_DEBUG_RGMII_RX_CLK_DLY); ++ else ++ at803x_dbg_reg_clr(phydev, AT803X_DBG0_REG, ++ AT803X_DEBUG_RGMII_RX_CLK_DLY); ++ ++ if (pdata->enable_rgmii_tx_delay) ++ at803x_dbg_reg_set(phydev, AT803X_DEBUG_SYSTEM_MODE_CTRL, ++ AT803X_DEBUG_RGMII_TX_CLK_DLY); ++ else ++ at803x_dbg_reg_clr(phydev, AT803X_DEBUG_SYSTEM_MODE_CTRL, ++ AT803X_DEBUG_RGMII_TX_CLK_DLY); ++ } ++ + return 0; + } + +@@ -258,6 +334,8 @@ static int at803x_config_intr(struct phy + static void at803x_link_change_notify(struct phy_device *phydev) + { + struct at803x_priv *priv = phydev->priv; ++ struct at803x_platform_data *pdata; ++ pdata = dev_get_platdata(&phydev->dev); + + /* + * Conduct a hardware reset for AT8030 every time a link loss is +@@ -288,6 +366,26 @@ static void at803x_link_change_notify(st + priv->phy_reset = false; + } + } ++ if (pdata && pdata->fixup_rgmii_tx_delay && ++ phydev->speed != priv->prev_speed) { ++ switch (phydev->speed) { ++ case SPEED_10: ++ case SPEED_100: ++ at803x_dbg_reg_set(phydev, ++ AT803X_DEBUG_SYSTEM_MODE_CTRL, ++ AT803X_DEBUG_RGMII_TX_CLK_DLY); ++ break; ++ case SPEED_1000: ++ at803x_dbg_reg_clr(phydev, ++ AT803X_DEBUG_SYSTEM_MODE_CTRL, ++ AT803X_DEBUG_RGMII_TX_CLK_DLY); ++ break; ++ default: ++ break; ++ } ++ ++ priv->prev_speed = phydev->speed; ++ } + } + + static struct phy_driver at803x_driver[] = { +--- /dev/null ++++ b/include/linux/platform_data/phy-at803x.h +@@ -0,0 +1,11 @@ ++#ifndef _PHY_AT803X_PDATA_H ++#define _PHY_AT803X_PDATA_H ++ ++struct at803x_platform_data { ++ int disable_smarteee:1; ++ int enable_rgmii_tx_delay:1; ++ int enable_rgmii_rx_delay:1; ++ int fixup_rgmii_tx_delay:1; ++}; ++ ++#endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch new file mode 100644 index 000000000..4a8f532aa --- /dev/null +++ b/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch @@ -0,0 +1,96 @@ +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -36,6 +36,9 @@ + #define AT803X_INER 0x0012 + #define AT803X_INER_INIT 0xec00 + #define AT803X_INSR 0x0013 ++#define AT803X_REG_CHIP_CONFIG 0x1f ++#define AT803X_BT_BX_REG_SEL 0x8000 ++#define AT803X_SGMII_ANEG_EN 0x1000 + + #define AT803X_PCS_SMART_EEE_CTRL3 0x805D + #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 +@@ -49,9 +52,10 @@ + #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 + #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) + +-#define ATH8030_PHY_ID 0x004dd076 +-#define ATH8031_PHY_ID 0x004dd074 +-#define ATH8035_PHY_ID 0x004dd072 ++#define AT803X_PHY_ID_MASK 0xffffffef ++#define ATH8030_PHY_ID 0x004dd076 ++#define ATH8031_PHY_ID 0x004dd074 ++#define ATH8035_PHY_ID 0x004dd072 + + MODULE_DESCRIPTION("Atheros 803x PHY driver"); + MODULE_AUTHOR("Matus Ujhelyi"); +@@ -267,6 +271,27 @@ static int at803x_config_init(struct phy + { + struct at803x_platform_data *pdata; + int ret; ++ u32 v; ++ ++ if (phydev->drv->phy_id == ATH8031_PHY_ID && ++ phydev->interface == PHY_INTERFACE_MODE_SGMII) ++ { ++ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); ++ /* select SGMII/fiber page */ ++ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, ++ v & ~AT803X_BT_BX_REG_SEL); ++ if (ret) ++ return ret; ++ /* enable SGMII autonegotiation */ ++ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); ++ if (ret) ++ return ret; ++ /* select copper page */ ++ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, ++ v | AT803X_BT_BX_REG_SEL); ++ if (ret) ++ return ret; ++ } + + ret = genphy_config_init(phydev); + if (ret < 0) +@@ -393,7 +418,7 @@ static struct phy_driver at803x_driver[] + /* ATHEROS 8035 */ + .phy_id = ATH8035_PHY_ID, + .name = "Atheros 8035 ethernet", +- .phy_id_mask = 0xffffffef, ++ .phy_id_mask = AT803X_PHY_ID_MASK, + .probe = at803x_probe, + .config_init = at803x_config_init, + .link_change_notify = at803x_link_change_notify, +@@ -412,7 +437,7 @@ static struct phy_driver at803x_driver[] + /* ATHEROS 8030 */ + .phy_id = ATH8030_PHY_ID, + .name = "Atheros 8030 ethernet", +- .phy_id_mask = 0xffffffef, ++ .phy_id_mask = AT803X_PHY_ID_MASK, + .probe = at803x_probe, + .config_init = at803x_config_init, + .link_change_notify = at803x_link_change_notify, +@@ -430,8 +455,8 @@ static struct phy_driver at803x_driver[] + }, { + /* ATHEROS 8031 */ + .phy_id = ATH8031_PHY_ID, +- .name = "Atheros 8031 ethernet", +- .phy_id_mask = 0xffffffef, ++ .name = "Atheros 8031/8033 ethernet", ++ .phy_id_mask = AT803X_PHY_ID_MASK, + .probe = at803x_probe, + .config_init = at803x_config_init, + .link_change_notify = at803x_link_change_notify, +@@ -465,9 +490,9 @@ module_init(atheros_init); + module_exit(atheros_exit); + + static struct mdio_device_id __maybe_unused atheros_tbl[] = { +- { ATH8030_PHY_ID, 0xffffffef }, +- { ATH8031_PHY_ID, 0xffffffef }, +- { ATH8035_PHY_ID, 0xffffffef }, ++ { ATH8030_PHY_ID, AT803X_PHY_ID_MASK }, ++ { ATH8031_PHY_ID, AT803X_PHY_ID_MASK }, ++ { ATH8035_PHY_ID, AT803X_PHY_ID_MASK }, + { } + }; + diff --git a/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch b/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch new file mode 100644 index 000000000..7051843b7 --- /dev/null +++ b/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch @@ -0,0 +1,365 @@ +commit 41b976414c88016e2c9d9b2f6667ee67a998d388 +Author: David Woodhouse +Date: Wed Sep 23 09:45:31 2015 +0100 + + 8139cp: Dump contents of descriptor ring on TX timeout + + We are seeing unexplained TX timeouts under heavy load. Let's try to get + a better idea of what's going on. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit 7f4c685633e2df9ba10d49a31dda13715745db37 +Author: David Woodhouse +Date: Wed Sep 23 09:45:16 2015 +0100 + + 8139cp: Fix DMA unmapping of transmitted buffers + + The low 16 bits of the 'opts1' field in the TX descriptor are supposed + to still contain the buffer length when the descriptor is handed back to + us. In practice, at least on my hardware, they don't. So stash the + original value of the opts1 field and get the length to unmap from + there. + + There are other ways we could have worked out the length, but I actually + want a stash of the opts1 field anyway so that I can dump it alongside + the contents of the descriptor ring when we suffer a TX timeout. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit 0a5aeee0b79fa99d8e04c98dd4e87d4f52aa497b +Author: David Woodhouse +Date: Wed Sep 23 09:44:57 2015 +0100 + + 8139cp: Reduce duplicate csum/tso code in cp_start_xmit() + + We calculate the value of the opts1 descriptor field in three different + places. With two different behaviours when given an invalid packet to + be checksummed — none of them correct. Sort that out. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit a3b804043f490aeec57d8ca5baccdd35e6250857 +Author: David Woodhouse +Date: Wed Sep 23 09:44:38 2015 +0100 + + 8139cp: Fix TSO/scatter-gather descriptor setup + + When sending a TSO frame in multiple buffers, we were neglecting to set + the first descriptor up in TSO mode. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit 26b0bad6ac3a0167792dc4ffb276c29bc597d239 +Author: David Woodhouse +Date: Wed Sep 23 09:44:06 2015 +0100 + + 8139cp: Fix tx_queued debug message to print correct slot numbers + + After a certain amount of staring at the debug output of this driver, I + realised it was lying to me. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit aaa0062ecf4877a26dea66bee1039c6eaf906c94 +Author: David Woodhouse +Date: Wed Sep 23 09:43:41 2015 +0100 + + 8139cp: Do not re-enable RX interrupts in cp_tx_timeout() + + If an RX interrupt was already received but NAPI has not yet run when + the RX timeout happens, we end up in cp_tx_timeout() with RX interrupts + already disabled. Blindly re-enabling them will cause an IRQ storm. + + (This is made particularly horrid by the fact that cp_interrupt() always + returns that it's handled the interrupt, even when it hasn't actually + done anything. If it didn't do that, the core IRQ code would have + detected the storm and handled it, I'd have had a clear smoking gun + backtrace instead of just a spontaneously resetting router, and I'd have + at *least* two days of my life back. Changing the return value of + cp_interrupt() will be argued about under separate cover.) + + Unconditionally leave RX interrupts disabled after the reset, and + schedule NAPI to check the receive ring and re-enable them. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit 7a8a8e75d505147358b225173e890ada43a267e2 +Author: David Woodhouse +Date: Fri Sep 18 00:21:54 2015 +0100 + + 8139cp: Call __cp_set_rx_mode() from cp_tx_timeout() + + Unless we reset the RX config, on real hardware I don't seem to receive + any packets after a TX timeout. + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller + +commit fc27bd115b334e3ebdc682a42a47c3aea2566dcc +Author: David Woodhouse +Date: Fri Sep 18 00:19:08 2015 +0100 + + 8139cp: Use dev_kfree_skb_any() instead of dev_kfree_skb() in cp_clean_rings() + + This can be called from cp_tx_timeout() with interrupts disabled. + Spotted by Francois Romieu + + Signed-off-by: David Woodhouse + Signed-off-by: David S. Miller +--- a/drivers/net/ethernet/realtek/8139cp.c ++++ b/drivers/net/ethernet/realtek/8139cp.c +@@ -157,6 +157,7 @@ enum { + NWayAdvert = 0x66, /* MII ADVERTISE */ + NWayLPAR = 0x68, /* MII LPA */ + NWayExpansion = 0x6A, /* MII Expansion */ ++ TxDmaOkLowDesc = 0x82, /* Low 16 bit address of a Tx descriptor. */ + Config5 = 0xD8, /* Config5 */ + TxPoll = 0xD9, /* Tell chip to check Tx descriptors for work */ + RxMaxSize = 0xDA, /* Max size of an Rx packet (8169 only) */ +@@ -341,6 +342,7 @@ struct cp_private { + unsigned tx_tail; + struct cp_desc *tx_ring; + struct sk_buff *tx_skb[CP_TX_RING_SIZE]; ++ u32 tx_opts[CP_TX_RING_SIZE]; + + unsigned rx_buf_sz; + unsigned wol_enabled : 1; /* Is Wake-on-LAN enabled? */ +@@ -665,7 +667,7 @@ static void cp_tx (struct cp_private *cp + BUG_ON(!skb); + + dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr), +- le32_to_cpu(txd->opts1) & 0xffff, ++ cp->tx_opts[tx_tail] & 0xffff, + PCI_DMA_TODEVICE); + + if (status & LastFrag) { +@@ -733,7 +735,7 @@ static netdev_tx_t cp_start_xmit (struct + { + struct cp_private *cp = netdev_priv(dev); + unsigned entry; +- u32 eor, flags; ++ u32 eor, opts1; + unsigned long intr_flags; + __le32 opts2; + int mss = 0; +@@ -753,6 +755,21 @@ static netdev_tx_t cp_start_xmit (struct + mss = skb_shinfo(skb)->gso_size; + + opts2 = cpu_to_le32(cp_tx_vlan_tag(skb)); ++ opts1 = DescOwn; ++ if (mss) ++ opts1 |= LargeSend | ((mss & MSSMask) << MSSShift); ++ else if (skb->ip_summed == CHECKSUM_PARTIAL) { ++ const struct iphdr *ip = ip_hdr(skb); ++ if (ip->protocol == IPPROTO_TCP) ++ opts1 |= IPCS | TCPCS; ++ else if (ip->protocol == IPPROTO_UDP) ++ opts1 |= IPCS | UDPCS; ++ else { ++ WARN_ONCE(1, ++ "Net bug: asked to checksum invalid Legacy IP packet\n"); ++ goto out_dma_error; ++ } ++ } + + if (skb_shinfo(skb)->nr_frags == 0) { + struct cp_desc *txd = &cp->tx_ring[entry]; +@@ -768,31 +785,20 @@ static netdev_tx_t cp_start_xmit (struct + txd->addr = cpu_to_le64(mapping); + wmb(); + +- flags = eor | len | DescOwn | FirstFrag | LastFrag; +- +- if (mss) +- flags |= LargeSend | ((mss & MSSMask) << MSSShift); +- else if (skb->ip_summed == CHECKSUM_PARTIAL) { +- const struct iphdr *ip = ip_hdr(skb); +- if (ip->protocol == IPPROTO_TCP) +- flags |= IPCS | TCPCS; +- else if (ip->protocol == IPPROTO_UDP) +- flags |= IPCS | UDPCS; +- else +- WARN_ON(1); /* we need a WARN() */ +- } ++ opts1 |= eor | len | FirstFrag | LastFrag; + +- txd->opts1 = cpu_to_le32(flags); ++ txd->opts1 = cpu_to_le32(opts1); + wmb(); + + cp->tx_skb[entry] = skb; +- entry = NEXT_TX(entry); ++ cp->tx_opts[entry] = opts1; ++ netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n", ++ entry, skb->len); + } else { + struct cp_desc *txd; +- u32 first_len, first_eor; ++ u32 first_len, first_eor, ctrl; + dma_addr_t first_mapping; + int frag, first_entry = entry; +- const struct iphdr *ip = ip_hdr(skb); + + /* We must give this initial chunk to the device last. + * Otherwise we could race with the device. +@@ -805,14 +811,14 @@ static netdev_tx_t cp_start_xmit (struct + goto out_dma_error; + + cp->tx_skb[entry] = skb; +- entry = NEXT_TX(entry); + + for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { + const skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag]; + u32 len; +- u32 ctrl; + dma_addr_t mapping; + ++ entry = NEXT_TX(entry); ++ + len = skb_frag_size(this_frag); + mapping = dma_map_single(&cp->pdev->dev, + skb_frag_address(this_frag), +@@ -824,19 +830,7 @@ static netdev_tx_t cp_start_xmit (struct + + eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; + +- ctrl = eor | len | DescOwn; +- +- if (mss) +- ctrl |= LargeSend | +- ((mss & MSSMask) << MSSShift); +- else if (skb->ip_summed == CHECKSUM_PARTIAL) { +- if (ip->protocol == IPPROTO_TCP) +- ctrl |= IPCS | TCPCS; +- else if (ip->protocol == IPPROTO_UDP) +- ctrl |= IPCS | UDPCS; +- else +- BUG(); +- } ++ ctrl = opts1 | eor | len; + + if (frag == skb_shinfo(skb)->nr_frags - 1) + ctrl |= LastFrag; +@@ -849,8 +843,8 @@ static netdev_tx_t cp_start_xmit (struct + txd->opts1 = cpu_to_le32(ctrl); + wmb(); + ++ cp->tx_opts[entry] = ctrl; + cp->tx_skb[entry] = skb; +- entry = NEXT_TX(entry); + } + + txd = &cp->tx_ring[first_entry]; +@@ -858,27 +852,17 @@ static netdev_tx_t cp_start_xmit (struct + txd->addr = cpu_to_le64(first_mapping); + wmb(); + +- if (skb->ip_summed == CHECKSUM_PARTIAL) { +- if (ip->protocol == IPPROTO_TCP) +- txd->opts1 = cpu_to_le32(first_eor | first_len | +- FirstFrag | DescOwn | +- IPCS | TCPCS); +- else if (ip->protocol == IPPROTO_UDP) +- txd->opts1 = cpu_to_le32(first_eor | first_len | +- FirstFrag | DescOwn | +- IPCS | UDPCS); +- else +- BUG(); +- } else +- txd->opts1 = cpu_to_le32(first_eor | first_len | +- FirstFrag | DescOwn); ++ ctrl = opts1 | first_eor | first_len | FirstFrag; ++ txd->opts1 = cpu_to_le32(ctrl); + wmb(); ++ ++ cp->tx_opts[first_entry] = ctrl; ++ netif_dbg(cp, tx_queued, cp->dev, "tx queued, slots %d-%d, skblen %d\n", ++ first_entry, entry, skb->len); + } +- cp->tx_head = entry; ++ cp->tx_head = NEXT_TX(entry); + + netdev_sent_queue(dev, skb->len); +- netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n", +- entry, skb->len); + if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) + netif_stop_queue(dev); + +@@ -1115,6 +1099,7 @@ static int cp_init_rings (struct cp_priv + { + memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); + cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd); ++ memset(cp->tx_opts, 0, sizeof(cp->tx_opts)); + + cp_init_rings_index(cp); + +@@ -1151,7 +1136,7 @@ static void cp_clean_rings (struct cp_pr + desc = cp->rx_ring + i; + dma_unmap_single(&cp->pdev->dev,le64_to_cpu(desc->addr), + cp->rx_buf_sz, PCI_DMA_FROMDEVICE); +- dev_kfree_skb(cp->rx_skb[i]); ++ dev_kfree_skb_any(cp->rx_skb[i]); + } + } + +@@ -1164,7 +1149,7 @@ static void cp_clean_rings (struct cp_pr + le32_to_cpu(desc->opts1) & 0xffff, + PCI_DMA_TODEVICE); + if (le32_to_cpu(desc->opts1) & LastFrag) +- dev_kfree_skb(skb); ++ dev_kfree_skb_any(skb); + cp->dev->stats.tx_dropped++; + } + } +@@ -1172,6 +1157,7 @@ static void cp_clean_rings (struct cp_pr + + memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); + memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); ++ memset(cp->tx_opts, 0, sizeof(cp->tx_opts)); + + memset(cp->rx_skb, 0, sizeof(struct sk_buff *) * CP_RX_RING_SIZE); + memset(cp->tx_skb, 0, sizeof(struct sk_buff *) * CP_TX_RING_SIZE); +@@ -1249,7 +1235,7 @@ static void cp_tx_timeout(struct net_dev + { + struct cp_private *cp = netdev_priv(dev); + unsigned long flags; +- int rc; ++ int rc, i; + + netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n", + cpr8(Cmd), cpr16(CpCmd), +@@ -1257,13 +1243,26 @@ static void cp_tx_timeout(struct net_dev + + spin_lock_irqsave(&cp->lock, flags); + ++ netif_dbg(cp, tx_err, cp->dev, "TX ring head %d tail %d desc %x\n", ++ cp->tx_head, cp->tx_tail, cpr16(TxDmaOkLowDesc)); ++ for (i = 0; i < CP_TX_RING_SIZE; i++) { ++ netif_dbg(cp, tx_err, cp->dev, ++ "TX slot %d @%p: %08x (%08x) %08x %llx %p\n", ++ i, &cp->tx_ring[i], le32_to_cpu(cp->tx_ring[i].opts1), ++ cp->tx_opts[i], le32_to_cpu(cp->tx_ring[i].opts2), ++ le64_to_cpu(cp->tx_ring[i].addr), ++ cp->tx_skb[i]); ++ } ++ + cp_stop_hw(cp); + cp_clean_rings(cp); + rc = cp_init_rings(cp); + cp_start_hw(cp); +- cp_enable_irq(cp); ++ __cp_set_rx_mode(dev); ++ cpw16_f(IntrMask, cp_norx_intr_mask); + + netif_wake_queue(dev); ++ napi_schedule(&cp->napi); + + spin_unlock_irqrestore(&cp->lock, flags); + } diff --git a/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch b/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch new file mode 100644 index 000000000..a93877b69 --- /dev/null +++ b/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch @@ -0,0 +1,72 @@ +Register switch connected to srab + +Signed-off-by: Hauke Mehrtens + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + + static const struct bcma_device_id bgmac_bcma_tbl[] = { +@@ -1538,6 +1539,17 @@ static void bgmac_mii_unregister(struct + mdiobus_free(mii_bus); + } + ++static struct b53_platform_data bgmac_b53_pdata = { ++}; ++ ++static struct platform_device bgmac_b53_dev = { ++ .name = "b53-srab-switch", ++ .id = -1, ++ .dev = { ++ .platform_data = &bgmac_b53_pdata, ++ }, ++}; ++ + /************************************************** + * BCMA bus ops + **************************************************/ +@@ -1671,6 +1683,16 @@ static int bgmac_probe(struct bcma_devic + net_dev->hw_features = net_dev->features; + net_dev->vlan_features = net_dev->features; + ++ if ((ci->id == BCMA_CHIP_ID_BCM4707 || ++ ci->id == BCMA_CHIP_ID_BCM53018) && ++ !bgmac_b53_pdata.regs) { ++ bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); ++ ++ err = platform_device_register(&bgmac_b53_dev); ++ if (!err) ++ bgmac->b53_device = &bgmac_b53_dev; ++ } ++ + err = register_netdev(bgmac->net_dev); + if (err) { + bgmac_err(bgmac, "Cannot register net device\n"); +@@ -1697,6 +1719,10 @@ static void bgmac_remove(struct bcma_dev + { + struct bgmac *bgmac = bcma_get_drvdata(core); + ++ if (bgmac->b53_device) ++ platform_device_unregister(&bgmac_b53_dev); ++ bgmac->b53_device = NULL; ++ + unregister_netdev(bgmac->net_dev); + bgmac_mii_unregister(bgmac); + netif_napi_del(&bgmac->napi); +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -462,6 +462,9 @@ struct bgmac { + bool has_robosw; + + bool loopback; ++ ++ /* platform device for associated switch */ ++ struct platform_device *b53_device; + }; + + static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) diff --git a/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch b/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch new file mode 100644 index 000000000..50bccc4df --- /dev/null +++ b/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch @@ -0,0 +1,25 @@ +--- a/drivers/net/usb/hso.c ++++ b/drivers/net/usb/hso.c +@@ -468,6 +468,7 @@ static const struct usb_device_id hso_id + {USB_DEVICE(0x0af0, 0x8900)}, + {USB_DEVICE(0x0af0, 0x9000)}, + {USB_DEVICE(0x0af0, 0x9200)}, /* Option GTM671WFS */ ++ {USB_DEVICE(0x0af0, 0x9300)}, /* GTM 66xxWFS */ + {USB_DEVICE(0x0af0, 0xd035)}, + {USB_DEVICE(0x0af0, 0xd055)}, + {USB_DEVICE(0x0af0, 0xd155)}, +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1330,6 +1330,12 @@ UNUSUAL_DEV( 0x0af0, 0x8304, 0x0000, 0x0 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + 0 ), + ++UNUSUAL_DEV( 0x0af0, 0x9300, 0x0000, 0x0000, ++ "Option", ++ "Globetrotter 66xxWFS SD-Card", ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, ++ 0 ), ++ + UNUSUAL_DEV( 0x0af0, 0xc100, 0x0000, 0x0000, + "Option", + "GI 070x SD-Card", diff --git a/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch new file mode 100644 index 000000000..5155bcdad --- /dev/null +++ b/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch @@ -0,0 +1,51 @@ +--- a/drivers/pci/Kconfig ++++ b/drivers/pci/Kconfig +@@ -58,6 +58,12 @@ config XEN_PCIDEV_FRONTEND + The PCI device frontend driver allows the kernel to import arbitrary + PCI devices from a PCI backend to support PCI driver domains. + ++config PCI_DISABLE_COMMON_QUIRKS ++ bool "PCI disable common quirks" ++ depends on PCI ++ help ++ If you don't know what to do here, say N. ++ + config HT_IRQ + bool "Interrupts on hypertransport devices" + default y +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -41,6 +41,7 @@ static void quirk_mmio_always_on(struct + DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, + PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS + /* The Mellanox Tavor device gives false positive parity errors + * Mark this device with a broken_parity_status, to allow + * PCI scanning code to "skip" this now blacklisted device. +@@ -2929,6 +2930,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); + ++#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ + + /* + * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. To +@@ -2985,6 +2987,8 @@ static void fixup_debug_report(struct pc + } + } + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS ++ + /* + * Some BIOS implementations leave the Intel GPU interrupts enabled, + * even though no one is handling them (f.e. i915 driver is never loaded). +@@ -3019,6 +3023,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); + ++#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ ++ + /* + * PCI devices which are on Intel chips can skip the 10ms delay + * before entering D3 mode. diff --git a/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch new file mode 100644 index 000000000..ddc854963 --- /dev/null +++ b/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch @@ -0,0 +1,101 @@ + +--- a/drivers/usb/host/pci-quirks.c ++++ b/drivers/usb/host/pci-quirks.c +@@ -98,6 +98,8 @@ struct amd_chipset_type { + u8 rev; + }; + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS ++ + static struct amd_chipset_info { + struct pci_dev *nb_dev; + struct pci_dev *smbus_dev; +@@ -462,6 +464,10 @@ void usb_amd_dev_put(void) + } + EXPORT_SYMBOL_GPL(usb_amd_dev_put); + ++#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ ++ ++#if IS_ENABLED(CONFIG_USB_UHCI_HCD) ++ + /* + * Make sure the controller is completely inactive, unable to + * generate interrupts or do DMA. +@@ -541,8 +547,17 @@ reset_needed: + uhci_reset_hc(pdev, base); + return 1; + } ++#else ++int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) ++{ ++ return 0; ++} ++ ++#endif + EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS ++ + static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) + { + u16 cmd; +@@ -1103,3 +1118,4 @@ static void quirk_usb_early_handoff(stru + } + DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, + PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); ++#endif +--- a/drivers/usb/host/pci-quirks.h ++++ b/drivers/usb/host/pci-quirks.h +@@ -4,6 +4,9 @@ + #ifdef CONFIG_PCI + void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); + int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); ++#endif /* CONFIG_PCI */ ++ ++#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) + int usb_amd_find_chipset_info(void); + int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); + bool usb_amd_hang_symptom_quirk(void); +@@ -16,11 +19,24 @@ void usb_disable_xhci_ports(struct pci_d + void sb800_prefetch(struct device *dev, int on); + #else + struct pci_dev; ++static inline int usb_amd_find_chipset_info(void) ++{ ++ return 0; ++} ++static inline bool usb_amd_hang_symptom_quirk(void) ++{ ++ return false; ++} ++static inline bool usb_amd_prefetch_quirk(void) ++{ ++ return false; ++} + static inline void usb_amd_quirk_pll_disable(void) {} + static inline void usb_amd_quirk_pll_enable(void) {} + static inline void usb_amd_dev_put(void) {} + static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} + static inline void sb800_prefetch(struct device *dev, int on) {} +-#endif /* CONFIG_PCI */ ++static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {} ++#endif + + #endif /* __LINUX_USB_PCI_QUIRKS_H */ +--- a/include/linux/usb/hcd.h ++++ b/include/linux/usb/hcd.h +@@ -445,7 +445,14 @@ extern int usb_hcd_pci_probe(struct pci_ + extern void usb_hcd_pci_remove(struct pci_dev *dev); + extern void usb_hcd_pci_shutdown(struct pci_dev *dev); + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS + extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); ++#else ++static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev) ++{ ++ return 0; ++} ++#endif + + #ifdef CONFIG_PM + extern const struct dev_pm_ops usb_hcd_pci_pm_ops; diff --git a/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch b/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch new file mode 100644 index 000000000..9e841cb64 --- /dev/null +++ b/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch @@ -0,0 +1,146 @@ +--- a/drivers/usb/dwc2/Kconfig ++++ b/drivers/usb/dwc2/Kconfig +@@ -1,6 +1,6 @@ + config USB_DWC2 +- bool "DesignWare USB2 DRD Core Support" +- depends on USB ++ tristate "DesignWare USB2 DRD Core Support" ++ depends on USB || USB_GADGET + help + Say Y here if your system has a Dual Role Hi-Speed USB + controller based on the DesignWare HSOTG IP Core. +@@ -10,49 +10,61 @@ config USB_DWC2 + bus interface module (if you have a PCI bus system) will be + called dwc2_pci.ko, and the platform interface module (for + controllers directly connected to the CPU) will be called +- dwc2_platform.ko. For gadget mode, there will be a single +- module called dwc2_gadget.ko. +- +- NOTE: The s3c-hsotg driver is now renamed to dwc2_gadget. The +- host and gadget drivers are still currently separate drivers. +- There are plans to merge the dwc2_gadget driver with the dwc2 +- host driver in the near future to create a dual-role driver. ++ dwc2_platform.ko. For all modes(host, gadget and dual-role), there ++ will be an additional module named dwc2.ko. + + if USB_DWC2 + ++choice ++ bool "DWC2 Mode Selection" ++ default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET) ++ default USB_DWC2_HOST if (USB && !USB_GADGET) ++ default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET) ++ + config USB_DWC2_HOST +- tristate "Host only mode" ++ bool "Host only mode" + depends on USB + help + The Designware USB2.0 high-speed host controller +- integrated into many SoCs. ++ integrated into many SoCs. Select this option if you want the ++ driver to operate in Host-only mode. + +-config USB_DWC2_PLATFORM +- bool "DWC2 Platform" +- depends on USB_DWC2_HOST +- default USB_DWC2_HOST ++comment "Gadget/Dual-role mode requires USB Gadget support to be enabled" ++ ++config USB_DWC2_PERIPHERAL ++ bool "Gadget only mode" ++ depends on USB_GADGET=y || USB_GADGET=USB_DWC2 ++ help ++ The Designware USB2.0 high-speed gadget controller ++ integrated into many SoCs. Select this option if you want the ++ driver to operate in Peripheral-only mode. This option requires ++ USB_GADGET to be enabled. ++ ++config USB_DWC2_DUAL_ROLE ++ bool "Dual Role mode" ++ depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2) + help +- The Designware USB2.0 platform interface module for +- controllers directly connected to the CPU. This is only +- used for host mode. ++ Select this option if you want the driver to work in a dual-role ++ mode. In this mode both host and gadget features are enabled, and ++ the role will be determined by the cable that gets plugged-in. This ++ option requires USB_GADGET to be enabled. ++endchoice ++ ++config USB_DWC2_PLATFORM ++ tristate "DWC2 Platform" ++ default USB_DWC2_HOST || USB_DWC2_PERIPHERAL ++ help ++ The Designware USB2.0 platform interface module for ++ controllers directly connected to the CPU. + + config USB_DWC2_PCI +- bool "DWC2 PCI" ++ tristate "DWC2 PCI" + depends on USB_DWC2_HOST && PCI + default USB_DWC2_HOST + help + The Designware USB2.0 PCI interface module for controllers + connected to a PCI bus. This is only used for host mode. + +-comment "Gadget mode requires USB Gadget support to be enabled" +- +-config USB_DWC2_PERIPHERAL +- tristate "Gadget only mode" +- depends on USB_GADGET +- help +- The Designware USB2.0 high-speed gadget controller +- integrated into many SoCs. +- + config USB_DWC2_DEBUG + bool "Enable Debugging Messages" + help +--- a/drivers/usb/dwc2/Makefile ++++ b/drivers/usb/dwc2/Makefile +@@ -1,28 +1,28 @@ + ccflags-$(CONFIG_USB_DWC2_DEBUG) += -DDEBUG + ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG + +-obj-$(CONFIG_USB_DWC2_HOST) += dwc2.o ++obj-$(CONFIG_USB_DWC2) += dwc2.o + dwc2-y := core.o core_intr.o +-dwc2-y += hcd.o hcd_intr.o +-dwc2-y += hcd_queue.o hcd_ddma.o ++ ++ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),) ++ dwc2-y += hcd.o hcd_intr.o ++ dwc2-y += hcd_queue.o hcd_ddma.o ++endif ++ ++ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),) ++ dwc2-y += gadget.o ++endif + + # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to + # this location and renamed gadget.c. When building for dynamically linked +-# modules, dwc2_gadget.ko will get built for peripheral mode. For host mode, +-# the core module will be dwc2.ko, the PCI bus interface module will called +-# dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko. +-# At present the host and gadget driver will be separate drivers, but there +-# are plans in the near future to create a dual-role driver. ++# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role ++# mode. The PCI bus interface module will called dwc2_pci.ko and the platform ++# interface module will be called dwc2_platform.ko. + + ifneq ($(CONFIG_USB_DWC2_PCI),) +- obj-$(CONFIG_USB_DWC2_HOST) += dwc2_pci.o ++ obj-$(CONFIG_USB_DWC2) += dwc2_pci.o + dwc2_pci-y := pci.o + endif + +-ifneq ($(CONFIG_USB_DWC2_PLATFORM),) +- obj-$(CONFIG_USB_DWC2_HOST) += dwc2_platform.o +- dwc2_platform-y := platform.o +-endif +- +-obj-$(CONFIG_USB_DWC2_PERIPHERAL) += dwc2_gadget.o +-dwc2_gadget-y := gadget.o ++obj-$(CONFIG_USB_DWC2_PLATFORM) += dwc2_platform.o ++dwc2_platform-y := platform.o diff --git a/target/linux/generic/pending-3.18/831-ledtrig_netdev.patch b/target/linux/generic/pending-3.18/831-ledtrig_netdev.patch new file mode 100644 index 000000000..3b46b4a9f --- /dev/null +++ b/target/linux/generic/pending-3.18/831-ledtrig_netdev.patch @@ -0,0 +1,21 @@ +--- a/drivers/leds/trigger/Kconfig ++++ b/drivers/leds/trigger/Kconfig +@@ -108,4 +108,11 @@ config LEDS_TRIGGER_CAMERA + This enables direct flash/torch on/off by the driver, kernel space. + If unsure, say Y. + ++config LEDS_TRIGGER_NETDEV ++ tristate "LED Netdev Trigger" ++ depends on NET && LEDS_TRIGGERS ++ help ++ This allows LEDs to be controlled by network device activity. ++ If unsure, say Y. ++ + endif # LEDS_TRIGGERS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -62,3 +62,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d + + # LED Triggers + obj-$(CONFIG_LEDS_TRIGGERS) += trigger/ ++obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o diff --git a/target/linux/generic/pending-3.18/834-ledtrig-libata.patch b/target/linux/generic/pending-3.18/834-ledtrig-libata.patch new file mode 100644 index 000000000..25dffdc58 --- /dev/null +++ b/target/linux/generic/pending-3.18/834-ledtrig-libata.patch @@ -0,0 +1,153 @@ +From 52cfd51cdf6a6e14d4fb270c6343abac3bac00f4 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 12 Dec 2014 13:38:33 +0100 +Subject: [PATCH] libata: add ledtrig support +To: linux-ide@vger.kernel.org, + Tejun Heo + +This adds a LED trigger for each ATA port indicating disk activity. + +As this is needed only on specific platforms (NAS SoCs and such), +these platforms should define ARCH_WANTS_LIBATA_LEDS if there +are boards with LED(s) intended to indicate ATA disk activity and +need the OS to take care of that. +In that way, if not selected, LED trigger support not will be +included in libata-core and both, codepaths and structures remain +untouched. + +Signed-off-by: Daniel Golle +--- + drivers/ata/Kconfig | 16 ++++++++++++++++ + drivers/ata/libata-core.c | 41 +++++++++++++++++++++++++++++++++++++++++ + include/linux/libata.h | 9 +++++++++ + 3 files changed, 66 insertions(+) + +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -46,6 +46,22 @@ config ATA_VERBOSE_ERROR + + If unsure, say Y. + ++config ARCH_WANT_LIBATA_LEDS ++ bool ++ ++config ATA_LEDS ++ bool "support ATA port LED triggers" ++ depends on ARCH_WANT_LIBATA_LEDS ++ select NEW_LEDS ++ select LEDS_CLASS ++ select LEDS_TRIGGERS ++ default y ++ help ++ This option adds a LED trigger for each registered ATA port. ++ It is used to drive disk activity leds connected via GPIO. ++ ++ If unsure, say N. ++ + config ATA_ACPI + bool "ATA ACPI Support" + depends on ACPI && PCI +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -725,6 +725,19 @@ u64 ata_tf_read_block(struct ata_taskfil + return block; + } + ++#ifdef CONFIG_ATA_LEDS ++#define LIBATA_BLINK_DELAY 20 /* ms */ ++static inline void ata_led_act(struct ata_port *ap) ++{ ++ unsigned long led_delay = LIBATA_BLINK_DELAY; ++ ++ if (unlikely(!ap->ledtrig)) ++ return; ++ ++ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); ++} ++#endif ++ + /** + * ata_build_rw_tf - Build ATA taskfile for given read/write request + * @tf: Target ATA taskfile +@@ -4825,6 +4838,9 @@ static struct ata_queued_cmd *ata_qc_new + break; + } + } ++#ifdef CONFIG_ATA_LEDS ++ ata_led_act(ap); ++#endif + + return qc; + } +@@ -5734,6 +5750,9 @@ struct ata_port *ata_port_alloc(struct a + ap->stats.unhandled_irq = 1; + ap->stats.idle_irq = 1; + #endif ++#ifdef CONFIG_ATA_LEDS ++ ap->ledtrig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); ++#endif + ata_sff_port_init(ap); + + return ap; +@@ -5755,6 +5774,12 @@ static void ata_host_release(struct devi + + kfree(ap->pmp_link); + kfree(ap->slave_link); ++#ifdef CONFIG_ATA_LEDS ++ if (ap->ledtrig) { ++ led_trigger_unregister(ap->ledtrig); ++ kfree(ap->ledtrig); ++ }; ++#endif + kfree(ap); + host->ports[i] = NULL; + } +@@ -6201,7 +6226,23 @@ int ata_host_register(struct ata_host *h + host->ports[i]->print_id = atomic_inc_return(&ata_print_id); + host->ports[i]->local_port_no = i + 1; + } ++#ifdef CONFIG_ATA_LEDS ++ for (i = 0; i < host->n_ports; i++) { ++ if (unlikely(!host->ports[i]->ledtrig)) ++ continue; + ++ snprintf(host->ports[i]->ledtrig_name, ++ sizeof(host->ports[i]->ledtrig_name), "ata%u", ++ host->ports[i]->print_id); ++ ++ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; ++ ++ if (led_trigger_register(host->ports[i]->ledtrig)) { ++ kfree(host->ports[i]->ledtrig); ++ host->ports[i]->ledtrig = NULL; ++ } ++ } ++#endif + /* Create associated sysfs transport objects */ + for (i = 0; i < host->n_ports; i++) { + rc = ata_tport_add(host->dev,host->ports[i]); +--- a/include/linux/libata.h ++++ b/include/linux/libata.h +@@ -38,6 +38,9 @@ + #include + #include + #include ++#ifdef CONFIG_ATA_LEDS ++#include ++#endif + + /* + * Define if arch has non-standard setup. This is a _PCI_ standard +@@ -874,6 +877,12 @@ struct ata_port { + #ifdef CONFIG_ATA_ACPI + struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ + #endif ++ ++#ifdef CONFIG_ATA_LEDS ++ struct led_trigger *ledtrig; ++ char ledtrig_name[8]; ++#endif ++ + /* owned by EH */ + u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; + }; diff --git a/target/linux/generic/pending-3.18/840-rtc7301.patch b/target/linux/generic/pending-3.18/840-rtc7301.patch new file mode 100644 index 000000000..2134d8747 --- /dev/null +++ b/target/linux/generic/pending-3.18/840-rtc7301.patch @@ -0,0 +1,250 @@ +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -979,6 +979,15 @@ config RTC_DRV_NUC900 + If you say yes here you get support for the RTC subsystem of the + NUC910/NUC920 used in embedded systems. + ++config RTC_DRV_RTC7301 ++ tristate "Epson RTC-7301 SF/DG" ++ help ++ If you say Y here you will get support for the ++ Epson RTC-7301 SF/DG RTC chips. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-7301. ++ + comment "on-CPU RTC drivers" + + config RTC_DRV_DAVINCI +--- a/drivers/rtc/Makefile ++++ b/drivers/rtc/Makefile +@@ -115,6 +115,7 @@ obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c + obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o + obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o + obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o ++obj-$(CONFIG_RTC_DRV_RTC7301) += rtc-rtc7301.o + obj-$(CONFIG_RTC_DRV_RV3029C2) += rtc-rv3029c2.o + obj-$(CONFIG_RTC_DRV_RX4581) += rtc-rx4581.o + obj-$(CONFIG_RTC_DRV_RX8025) += rtc-rx8025.o +--- /dev/null ++++ b/drivers/rtc/rtc-rtc7301.c +@@ -0,0 +1,219 @@ ++/* ++ * Driver for Epson RTC-7301SF/DG ++ * ++ * Copyright (C) 2009 Jose Vasconcellos ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RTC_NAME "rtc7301" ++#define RTC_VERSION "0.1" ++ ++/* Epson RTC-7301 register addresses */ ++#define RTC7301_SEC 0x00 ++#define RTC7301_SEC10 0x01 ++#define RTC7301_MIN 0x02 ++#define RTC7301_MIN10 0x03 ++#define RTC7301_HOUR 0x04 ++#define RTC7301_HOUR10 0x05 ++#define RTC7301_WEEKDAY 0x06 ++#define RTC7301_DAY 0x07 ++#define RTC7301_DAY10 0x08 ++#define RTC7301_MON 0x09 ++#define RTC7301_MON10 0x0A ++#define RTC7301_YEAR 0x0B ++#define RTC7301_YEAR10 0x0C ++#define RTC7301_YEAR100 0x0D ++#define RTC7301_YEAR1000 0x0E ++#define RTC7301_CTRLREG 0x0F ++ ++static uint8_t __iomem *rtc7301_base; ++ ++#define read_reg(offset) (readb(rtc7301_base + offset) & 0xf) ++#define write_reg(offset, data) writeb(data, rtc7301_base + (offset)) ++ ++#define rtc7301_isbusy() (read_reg(RTC7301_CTRLREG) & 1) ++ ++static void rtc7301_init_settings(void) ++{ ++ int i; ++ ++ write_reg(RTC7301_CTRLREG, 2); ++ write_reg(RTC7301_YEAR1000, 2); ++ udelay(122); ++ ++ /* bank 1 */ ++ write_reg(RTC7301_CTRLREG, 6); ++ for (i=0; i<15; i++) ++ write_reg(i, 0); ++ ++ /* bank 2 */ ++ write_reg(RTC7301_CTRLREG, 14); ++ for (i=0; i<15; i++) ++ write_reg(i, 0); ++ write_reg(RTC7301_CTRLREG, 0); ++} ++ ++static int rtc7301_get_datetime(struct device *dev, struct rtc_time *dt) ++{ ++ int cnt; ++ uint8_t buf[16]; ++ ++ cnt = 0; ++ while (rtc7301_isbusy()) { ++ udelay(244); ++ if (cnt++ > 100) { ++ dev_err(dev, "%s: timeout error %x\n", __func__, rtc7301_base[RTC7301_CTRLREG]); ++ return -EIO; ++ } ++ } ++ ++ for (cnt=0; cnt<16; cnt++) ++ buf[cnt] = read_reg(cnt); ++ ++ if (buf[RTC7301_SEC10] & 8) { ++ dev_err(dev, "%s: RTC not set\n", __func__); ++ return -EINVAL; ++ } ++ ++ memset(dt, 0, sizeof(*dt)); ++ ++ dt->tm_sec = buf[RTC7301_SEC] + buf[RTC7301_SEC10]*10; ++ dt->tm_min = buf[RTC7301_MIN] + buf[RTC7301_MIN10]*10; ++ dt->tm_hour = buf[RTC7301_HOUR] + buf[RTC7301_HOUR10]*10; ++ ++ dt->tm_mday = buf[RTC7301_DAY] + buf[RTC7301_DAY10]*10; ++ dt->tm_mon = buf[RTC7301_MON] + buf[RTC7301_MON10]*10 - 1; ++ dt->tm_year = buf[RTC7301_YEAR] + buf[RTC7301_YEAR10]*10 + ++ buf[RTC7301_YEAR100]*100 + ++ ((buf[RTC7301_YEAR1000] & 3)*1000) - 1900; ++ ++ /* the rtc device may contain illegal values on power up ++ * according to the data sheet. make sure they are valid. ++ */ ++ ++ return rtc_valid_tm(dt); ++} ++ ++static int rtc7301_set_datetime(struct device *dev, struct rtc_time *dt) ++{ ++ int data; ++ ++ data = dt->tm_year + 1900; ++ if (data >= 2100 || data < 1900) ++ return -EINVAL; ++ ++ write_reg(RTC7301_CTRLREG, 2); ++ udelay(122); ++ ++ data = bin2bcd(dt->tm_sec); ++ write_reg(RTC7301_SEC, data); ++ write_reg(RTC7301_SEC10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_min); ++ write_reg(RTC7301_MIN, data ); ++ write_reg(RTC7301_MIN10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_hour); ++ write_reg(RTC7301_HOUR, data); ++ write_reg(RTC7301_HOUR10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_mday); ++ write_reg(RTC7301_DAY, data); ++ write_reg(RTC7301_DAY10, (data>> 4)); ++ ++ data = bin2bcd(dt->tm_mon + 1); ++ write_reg(RTC7301_MON, data); ++ write_reg(RTC7301_MON10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_year % 100); ++ write_reg(RTC7301_YEAR, data); ++ write_reg(RTC7301_YEAR10, (data >> 4)); ++ data = bin2bcd((1900 + dt->tm_year) / 100); ++ write_reg(RTC7301_YEAR100, data); ++ ++ data = bin2bcd(dt->tm_wday); ++ write_reg(RTC7301_WEEKDAY, data); ++ ++ write_reg(RTC7301_CTRLREG, 0); ++ ++ return 0; ++} ++ ++static const struct rtc_class_ops rtc7301_rtc_ops = { ++ .read_time = rtc7301_get_datetime, ++ .set_time = rtc7301_set_datetime, ++}; ++ ++static int rtc7301_probe(struct platform_device *pdev) ++{ ++ struct rtc_device *rtc; ++ struct resource *res; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -ENOENT; ++ ++ rtc7301_base = ioremap_nocache(res->start, 0x1000 /*res->end - res->start + 1*/); ++ if (!rtc7301_base) ++ return -EINVAL; ++ ++ rtc = rtc_device_register(RTC_NAME, &pdev->dev, ++ &rtc7301_rtc_ops, THIS_MODULE); ++ if (IS_ERR(rtc)) { ++ iounmap(rtc7301_base); ++ return PTR_ERR(rtc); ++ } ++ ++ platform_set_drvdata(pdev, rtc); ++ ++ rtc7301_init_settings(); ++ return 0; ++} ++ ++static int rtc7301_remove(struct platform_device *pdev) ++{ ++ struct rtc_device *rtc = platform_get_drvdata(pdev); ++ ++ if (rtc) ++ rtc_device_unregister(rtc); ++ if (rtc7301_base) ++ iounmap(rtc7301_base); ++ return 0; ++} ++ ++static struct platform_driver rtc7301_driver = { ++ .driver = { ++ .name = RTC_NAME, ++ .owner = THIS_MODULE, ++ }, ++ .probe = rtc7301_probe, ++ .remove = rtc7301_remove, ++}; ++ ++static __init int rtc7301_init(void) ++{ ++ return platform_driver_register(&rtc7301_driver); ++} ++module_init(rtc7301_init); ++ ++static __exit void rtc7301_exit(void) ++{ ++ platform_driver_unregister(&rtc7301_driver); ++} ++module_exit(rtc7301_exit); ++ ++MODULE_DESCRIPTION("Epson 7301 RTC driver"); ++MODULE_AUTHOR("Jose Vasconcellos "); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:" RTC_NAME); ++MODULE_VERSION(RTC_VERSION); diff --git a/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch b/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch new file mode 100644 index 000000000..83b0232e1 --- /dev/null +++ b/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch @@ -0,0 +1,247 @@ +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -567,6 +567,15 @@ config RTC_DRV_S5M + This driver can also be built as a module. If so, the module + will be called rtc-s5m. + ++config RTC_DRV_PT7C4338 ++ tristate "Pericom Technology Inc. PT7C4338 RTC" ++ help ++ If you say yes here you get support for the Pericom Technology ++ Inc. PT7C4338 RTC chip. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-pt7c4338. ++ + endif # I2C + + comment "SPI RTC drivers" +--- a/drivers/rtc/Makefile ++++ b/drivers/rtc/Makefile +@@ -106,6 +106,7 @@ obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030 + obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o + obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o + obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o ++obj-$(CONFIG_RTC_DRV_PT7C4338) += rtc-pt7c4338.o + obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o + obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o + obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o +--- /dev/null ++++ b/drivers/rtc/rtc-pt7c4338.c +@@ -0,0 +1,216 @@ ++/* ++ * Copyright 2010 Freescale Semiconductor, Inc. ++ * ++ * Author: Priyanka Jain ++ * ++ * See file CREDITS for list of people who contributed to this ++ * project. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, ++ * MA 02111-1307 USA ++ */ ++ ++/* ++ * This file provides Date & Time support (no alarms) for PT7C4338 chip. ++ * ++ * This file is based on drivers/rtc/rtc-ds1307.c ++ * ++ * PT7C4338 chip is manufactured by Pericom Technology Inc. ++ * It is a serial real-time clock which provides ++ * 1)Low-power clock/calendar. ++ * 2)Programmable square-wave output. ++ * It has 56 bytes of nonvolatile RAM. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* RTC register addresses */ ++#define PT7C4338_REG_SECONDS 0x00 ++#define PT7C4338_REG_MINUTES 0x01 ++#define PT7C4338_REG_HOURS 0x02 ++#define PT7C4338_REG_AMPM 0x02 ++#define PT7C4338_REG_DAY 0x03 ++#define PT7C4338_REG_DATE 0x04 ++#define PT7C4338_REG_MONTH 0x05 ++#define PT7C4338_REG_YEAR 0x06 ++#define PT7C4338_REG_CTRL_STAT 0x07 ++ ++/* RTC second register address bit */ ++#define PT7C4338_SEC_BIT_CH 0x80 /*Clock Halt (in Register 0)*/ ++ ++/* RTC control and status register bits */ ++#define PT7C4338_CTRL_STAT_BIT_RS0 0x1 /*Rate select 0*/ ++#define PT7C4338_CTRL_STAT_BIT_RS1 0x2 /*Rate select 1*/ ++#define PT7C4338_CTRL_STAT_BIT_SQWE 0x10 /*Square Wave Enable*/ ++#define PT7C4338_CTRL_STAT_BIT_OSF 0x20 /*Oscillator Stop Flag*/ ++#define PT7C4338_CTRL_STAT_BIT_OUT 0x80 /*Output Level Control*/ ++ ++static const struct i2c_device_id pt7c4338_id[] = { ++ { "pt7c4338", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, pt7c4338_id); ++ ++struct pt7c4338{ ++ struct i2c_client *client; ++ struct rtc_device *rtc; ++}; ++ ++static int pt7c4338_read_time(struct device *dev, struct rtc_time *time) ++{ ++ struct i2c_client *client = to_i2c_client(dev); ++ int ret; ++ u8 buf[7]; ++ u8 year, month, day, hour, minute, second; ++ u8 week, twelve_hr, am_pm; ++ ++ ret = i2c_smbus_read_i2c_block_data(client, ++ PT7C4338_REG_SECONDS, 7, buf); ++ if (ret < 0) ++ return ret; ++ if (ret < 7) ++ return -EIO; ++ ++ second = buf[0]; ++ minute = buf[1]; ++ hour = buf[2]; ++ week = buf[3]; ++ day = buf[4]; ++ month = buf[5]; ++ year = buf[6]; ++ ++ /* Extract additional information for AM/PM */ ++ twelve_hr = hour & 0x40; ++ am_pm = hour & 0x20; ++ ++ /* Write to rtc_time structure */ ++ time->tm_sec = bcd2bin(second & 0x7f); ++ time->tm_min = bcd2bin(minute & 0x7f); ++ if (twelve_hr) { ++ /* Convert to 24 hr */ ++ if (am_pm) ++ time->tm_hour = bcd2bin(hour & 0x10) + 12; ++ else ++ time->tm_hour = bcd2bin(hour & 0xBF); ++ } else { ++ time->tm_hour = bcd2bin(hour); ++ } ++ ++ time->tm_wday = bcd2bin(week & 0x07) - 1; ++ time->tm_mday = bcd2bin(day & 0x3f); ++ time->tm_mon = bcd2bin(month & 0x1F) - 1; ++ /* assume 20YY not 19YY */ ++ time->tm_year = bcd2bin(year) + 100; ++ ++ return 0; ++} ++ ++static int pt7c4338_set_time(struct device *dev, struct rtc_time *time) ++{ ++ struct i2c_client *client = to_i2c_client(dev); ++ u8 buf[7]; ++ ++ /* Extract time from rtc_time and load into pt7c4338*/ ++ buf[0] = bin2bcd(time->tm_sec); ++ buf[1] = bin2bcd(time->tm_min); ++ buf[2] = bin2bcd(time->tm_hour); ++ buf[3] = bin2bcd(time->tm_wday + 1); /* Day of the week */ ++ buf[4] = bin2bcd(time->tm_mday); /* Date */ ++ buf[5] = bin2bcd(time->tm_mon + 1); ++ ++ /* assume 20YY not 19YY */ ++ if (time->tm_year >= 100) ++ buf[6] = bin2bcd(time->tm_year - 100); ++ else ++ buf[6] = bin2bcd(time->tm_year); ++ ++ return i2c_smbus_write_i2c_block_data(client, ++ PT7C4338_REG_SECONDS, 7, buf); ++} ++ ++static const struct rtc_class_ops pt7c4338_rtc_ops = { ++ .read_time = pt7c4338_read_time, ++ .set_time = pt7c4338_set_time, ++}; ++ ++static int pt7c4338_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct pt7c4338 *pt7c4338; ++ struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); ++ int ret; ++ ++ pt7c4338 = kzalloc(sizeof(struct pt7c4338), GFP_KERNEL); ++ if (!pt7c4338) ++ return -ENOMEM; ++ ++ pt7c4338->client = client; ++ i2c_set_clientdata(client, pt7c4338); ++ pt7c4338->rtc = rtc_device_register(client->name, &client->dev, ++ &pt7c4338_rtc_ops, THIS_MODULE); ++ if (IS_ERR(pt7c4338->rtc)) { ++ ret = PTR_ERR(pt7c4338->rtc); ++ dev_err(&client->dev, "unable to register the class device\n"); ++ goto out_free; ++ } ++ ++ return 0; ++out_free: ++ i2c_set_clientdata(client, NULL); ++ kfree(pt7c4338); ++ return ret; ++} ++ ++static int pt7c4338_remove(struct i2c_client *client) ++{ ++ struct pt7c4338 *pt7c4338 = i2c_get_clientdata(client); ++ ++ rtc_device_unregister(pt7c4338->rtc); ++ i2c_set_clientdata(client, NULL); ++ kfree(pt7c4338); ++ return 0; ++} ++ ++static struct i2c_driver pt7c4338_driver = { ++ .driver = { ++ .name = "rtc-pt7c4338", ++ .owner = THIS_MODULE, ++ }, ++ .probe = pt7c4338_probe, ++ .remove = pt7c4338_remove, ++ .id_table = pt7c4338_id, ++}; ++ ++static int __init pt7c4338_init(void) ++{ ++ return i2c_add_driver(&pt7c4338_driver); ++} ++ ++static void __exit pt7c4338_exit(void) ++{ ++ i2c_del_driver(&pt7c4338_driver); ++} ++ ++module_init(pt7c4338_init); ++module_exit(pt7c4338_exit); ++ ++MODULE_AUTHOR("Priyanka Jain "); ++MODULE_DESCRIPTION("pericom Technology Inc. PT7C4338 RTC Driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch b/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch new file mode 100644 index 000000000..e7b32a50b --- /dev/null +++ b/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch @@ -0,0 +1,58 @@ +Implement the SPI-GPIO delay function for busses that need speed limitation. + +--mb + + + +--- a/drivers/spi/spi-gpio.c ++++ b/drivers/spi/spi-gpio.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -73,6 +74,7 @@ struct spi_gpio { + * #define SPI_MOSI_GPIO 120 + * #define SPI_SCK_GPIO 121 + * #define SPI_N_CHIPSEL 4 ++ * #undef NEED_SPIDELAY + * #include "spi-gpio.c" + */ + +@@ -80,6 +82,7 @@ struct spi_gpio { + #define DRIVER_NAME "spi_gpio" + + #define GENERIC_BITBANG /* vs tight inlines */ ++#define NEED_SPIDELAY 1 + + /* all functions referencing these symbols must define pdata */ + #define SPI_MISO_GPIO ((pdata)->miso) +@@ -130,12 +133,20 @@ static inline int getmiso(const struct s + #undef pdata + + /* +- * NOTE: this clocks "as fast as we can". It "should" be a function of the +- * requested device clock. Software overhead means we usually have trouble +- * reaching even one Mbit/sec (except when we can inline bitops), so for now +- * we'll just assume we never need additional per-bit slowdowns. ++ * NOTE: to clock "as fast as we can", set spi_device.max_speed_hz ++ * and spi_transfer.speed_hz to 0. ++ * Otherwise this is a function of the requested device clock. ++ * Software overhead means we usually have trouble ++ * reaching even one Mbit/sec (except when we can inline bitops). So on small ++ * embedded devices with fast SPI slaves you usually don't need a delay. + */ +-#define spidelay(nsecs) do {} while (0) ++static inline void spidelay(unsigned nsecs) ++{ ++#ifdef NEED_SPIDELAY ++ if (unlikely(nsecs)) ++ ndelay(nsecs); ++#endif /* NEED_SPIDELAY */ ++} + + #include "spi-bitbang-txrx.h" + diff --git a/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch b/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch new file mode 100644 index 000000000..70bf11f8f --- /dev/null +++ b/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch @@ -0,0 +1,373 @@ +THIS CODE IS DEPRECATED. + +Please use the new mainline SPI-GPIO driver, as of 2.6.29. + +--mb + + + +--- + drivers/spi/Kconfig | 9 + + drivers/spi/Makefile | 1 + drivers/spi/spi_gpio_old.c | 251 +++++++++++++++++++++++++++++++++++++++ + include/linux/spi/spi_gpio_old.h | 73 +++++++++++ + 4 files changed, 334 insertions(+) + +--- /dev/null ++++ b/include/linux/spi/spi_gpio_old.h +@@ -0,0 +1,73 @@ ++/* ++ * spi_gpio interface to platform code ++ * ++ * Copyright (c) 2008 Piotr Skamruk ++ * Copyright (c) 2008 Michael Buesch ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++#ifndef _LINUX_SPI_SPI_GPIO ++#define _LINUX_SPI_SPI_GPIO ++ ++#include ++#include ++ ++ ++/** ++ * struct spi_gpio_platform_data - Data definitions for a SPI-GPIO device. ++ * ++ * This structure holds information about a GPIO-based SPI device. ++ * ++ * @pin_clk: The GPIO pin number of the CLOCK pin. ++ * ++ * @pin_miso: The GPIO pin number of the MISO pin. ++ * ++ * @pin_mosi: The GPIO pin number of the MOSI pin. ++ * ++ * @pin_cs: The GPIO pin number of the CHIPSELECT pin. ++ * ++ * @cs_activelow: If true, the chip is selected when the CS line is low. ++ * ++ * @no_spi_delay: If true, no delay is done in the lowlevel bitbanging. ++ * Note that doing no delay is not standards compliant, ++ * but it might be needed to speed up transfers on some ++ * slow embedded machines. ++ * ++ * @boardinfo_setup: This callback is called after the ++ * SPI master device was registered, but before the ++ * device is registered. ++ * @boardinfo_setup_data: Data argument passed to boardinfo_setup(). ++ */ ++struct spi_gpio_platform_data { ++ unsigned int pin_clk; ++ unsigned int pin_miso; ++ unsigned int pin_mosi; ++ unsigned int pin_cs; ++ bool cs_activelow; ++ bool no_spi_delay; ++ int (*boardinfo_setup)(struct spi_board_info *bi, ++ struct spi_master *master, ++ void *data); ++ void *boardinfo_setup_data; ++}; ++ ++/** ++ * SPI_GPIO_PLATDEV_NAME - The platform device name string. ++ * ++ * The name string that has to be used for platform_device_alloc ++ * when allocating a spi-gpio device. ++ */ ++#define SPI_GPIO_PLATDEV_NAME "spi-gpio" ++ ++/** ++ * spi_gpio_next_id - Get another platform device ID number. ++ * ++ * This returns the next platform device ID number that has to be used ++ * for platform_device_alloc. The ID is opaque and should not be used for ++ * anything else. ++ */ ++int spi_gpio_next_id(void); ++ ++#endif /* _LINUX_SPI_SPI_GPIO */ +--- /dev/null ++++ b/drivers/spi/spi_gpio_old.c +@@ -0,0 +1,251 @@ ++/* ++ * Bitbanging SPI bus driver using GPIO API ++ * ++ * Copyright (c) 2008 Piotr Skamruk ++ * Copyright (c) 2008 Michael Buesch ++ * ++ * based on spi_s3c2410_gpio.c ++ * Copyright (c) 2006 Ben Dooks ++ * Copyright (c) 2006 Simtec Electronics ++ * and on i2c-gpio.c ++ * Copyright (C) 2007 Atmel Corporation ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++struct spi_gpio { ++ struct spi_bitbang bitbang; ++ struct spi_gpio_platform_data *info; ++ struct platform_device *pdev; ++ struct spi_board_info bi; ++}; ++ ++ ++static inline struct spi_gpio *spidev_to_sg(struct spi_device *dev) ++{ ++ return dev->controller_data; ++} ++ ++static inline void setsck(struct spi_device *dev, int val) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ gpio_set_value(sp->info->pin_clk, val ? 1 : 0); ++} ++ ++static inline void setmosi(struct spi_device *dev, int val) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ gpio_set_value(sp->info->pin_mosi, val ? 1 : 0); ++} ++ ++static inline u32 getmiso(struct spi_device *dev) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ return gpio_get_value(sp->info->pin_miso) ? 1 : 0; ++} ++ ++static inline void do_spidelay(struct spi_device *dev, unsigned nsecs) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ ++ if (!sp->info->no_spi_delay) ++ ndelay(nsecs); ++} ++ ++#define spidelay(nsecs) do { \ ++ /* Steal the spi_device pointer from our caller. \ ++ * The bitbang-API should probably get fixed here... */ \ ++ do_spidelay(spi, nsecs); \ ++ } while (0) ++ ++#define EXPAND_BITBANG_TXRX ++#include "spi-bitbang-txrx.h" ++ ++static u32 spi_gpio_txrx_mode0(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); ++} ++ ++static u32 spi_gpio_txrx_mode1(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits); ++} ++ ++static u32 spi_gpio_txrx_mode2(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits); ++} ++ ++static u32 spi_gpio_txrx_mode3(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits); ++} ++ ++static void spi_gpio_chipselect(struct spi_device *dev, int on) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ ++ if (sp->info->cs_activelow) ++ on = !on; ++ gpio_set_value(sp->info->pin_cs, on ? 1 : 0); ++} ++ ++static int spi_gpio_probe(struct platform_device *pdev) ++{ ++ struct spi_master *master; ++ struct spi_gpio_platform_data *pdata; ++ struct spi_gpio *sp; ++ struct spi_device *spidev; ++ int err; ++ ++ pdata = pdev->dev.platform_data; ++ if (!pdata) ++ return -ENXIO; ++ ++ err = -ENOMEM; ++ master = spi_alloc_master(&pdev->dev, sizeof(struct spi_gpio)); ++ if (!master) ++ goto err_alloc_master; ++ ++ sp = spi_master_get_devdata(master); ++ platform_set_drvdata(pdev, sp); ++ sp->info = pdata; ++ ++ err = gpio_request(pdata->pin_clk, "spi_clock"); ++ if (err) ++ goto err_request_clk; ++ err = gpio_request(pdata->pin_mosi, "spi_mosi"); ++ if (err) ++ goto err_request_mosi; ++ err = gpio_request(pdata->pin_miso, "spi_miso"); ++ if (err) ++ goto err_request_miso; ++ err = gpio_request(pdata->pin_cs, "spi_cs"); ++ if (err) ++ goto err_request_cs; ++ ++ sp->bitbang.master = spi_master_get(master); ++ sp->bitbang.master->bus_num = -1; ++ sp->bitbang.master->num_chipselect = 1; ++ sp->bitbang.chipselect = spi_gpio_chipselect; ++ sp->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_mode0; ++ sp->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_mode1; ++ sp->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_mode2; ++ sp->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_txrx_mode3; ++ ++ gpio_direction_output(pdata->pin_clk, 0); ++ gpio_direction_output(pdata->pin_mosi, 0); ++ gpio_direction_output(pdata->pin_cs, ++ pdata->cs_activelow ? 1 : 0); ++ gpio_direction_input(pdata->pin_miso); ++ ++ err = spi_bitbang_start(&sp->bitbang); ++ if (err) ++ goto err_no_bitbang; ++ err = pdata->boardinfo_setup(&sp->bi, master, ++ pdata->boardinfo_setup_data); ++ if (err) ++ goto err_bi_setup; ++ sp->bi.controller_data = sp; ++ spidev = spi_new_device(master, &sp->bi); ++ if (!spidev) ++ goto err_new_dev; ++ ++ return 0; ++ ++err_new_dev: ++err_bi_setup: ++ spi_bitbang_stop(&sp->bitbang); ++err_no_bitbang: ++ spi_master_put(sp->bitbang.master); ++ gpio_free(pdata->pin_cs); ++err_request_cs: ++ gpio_free(pdata->pin_miso); ++err_request_miso: ++ gpio_free(pdata->pin_mosi); ++err_request_mosi: ++ gpio_free(pdata->pin_clk); ++err_request_clk: ++ kfree(master); ++ ++err_alloc_master: ++ return err; ++} ++ ++static int spi_gpio_remove(struct platform_device *pdev) ++{ ++ struct spi_gpio *sp; ++ struct spi_gpio_platform_data *pdata; ++ ++ pdata = pdev->dev.platform_data; ++ sp = platform_get_drvdata(pdev); ++ ++ gpio_free(pdata->pin_clk); ++ gpio_free(pdata->pin_mosi); ++ gpio_free(pdata->pin_miso); ++ gpio_free(pdata->pin_cs); ++ spi_bitbang_stop(&sp->bitbang); ++ spi_master_put(sp->bitbang.master); ++ ++ return 0; ++} ++ ++static struct platform_driver spi_gpio_driver = { ++ .driver = { ++ .name = SPI_GPIO_PLATDEV_NAME, ++ .owner = THIS_MODULE, ++ }, ++ .probe = spi_gpio_probe, ++ .remove = spi_gpio_remove, ++}; ++ ++int spi_gpio_next_id(void) ++{ ++ static atomic_t counter = ATOMIC_INIT(-1); ++ ++ return atomic_inc_return(&counter); ++} ++EXPORT_SYMBOL(spi_gpio_next_id); ++ ++static int __init spi_gpio_init(void) ++{ ++ int err; ++ ++ err = platform_driver_register(&spi_gpio_driver); ++ if (err) ++ printk(KERN_ERR "spi-gpio: register failed: %d\n", err); ++ ++ return err; ++} ++module_init(spi_gpio_init); ++ ++static void __exit spi_gpio_exit(void) ++{ ++ platform_driver_unregister(&spi_gpio_driver); ++} ++module_exit(spi_gpio_exit); ++ ++MODULE_AUTHOR("Piot Skamruk "); ++MODULE_AUTHOR("Michael Buesch"); ++MODULE_DESCRIPTION("Platform independent GPIO bitbanging SPI driver"); ++MODULE_LICENSE("GPL v2"); +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -225,6 +225,15 @@ config SPI_GPIO + GPIO operations, you should be able to leverage that for better + speed with a custom version of this driver; see the source code. + ++config SPI_GPIO_OLD ++ tristate "Old GPIO API based bitbanging SPI controller (DEPRECATED)" ++ depends on SPI_MASTER && GPIOLIB ++ select SPI_BITBANG ++ help ++ This code is deprecated. Please use the new mainline SPI-GPIO driver. ++ ++ If unsure, say N. ++ + config SPI_IMX + tristate "Freescale i.MX SPI controllers" + depends on ARCH_MXC || COMPILE_TEST +--- a/drivers/spi/Makefile ++++ b/drivers/spi/Makefile +@@ -40,6 +40,7 @@ obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-li + obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o + obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o + obj-$(CONFIG_SPI_GPIO) += spi-gpio.o ++obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o + obj-$(CONFIG_SPI_IMX) += spi-imx.o + obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o + obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o diff --git a/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch b/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch new file mode 100644 index 000000000..3a37c951e --- /dev/null +++ b/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch @@ -0,0 +1,17 @@ +--- a/drivers/crypto/hifn_795x.c ++++ b/drivers/crypto/hifn_795x.c +@@ -682,12 +682,12 @@ static inline u32 hifn_read_1(struct hif + + static inline void hifn_write_0(struct hifn_device *dev, u32 reg, u32 val) + { +- writel((__force u32)cpu_to_le32(val), dev->bar[0] + reg); ++ writel(val, dev->bar[0] + reg); + } + + static inline void hifn_write_1(struct hifn_device *dev, u32 reg, u32 val) + { +- writel((__force u32)cpu_to_le32(val), dev->bar[1] + reg); ++ writel(val, dev->bar[1] + reg); + } + + static void hifn_wait_puc(struct hifn_device *dev) diff --git a/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch b/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch new file mode 100644 index 000000000..8815e4c64 --- /dev/null +++ b/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch @@ -0,0 +1,24 @@ +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -16,7 +16,7 @@ + * membase is an 'ioremapped' cookie. + */ + +-#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ++#if defined(CONFIG_SERIAL_8250_SYSRQ) && defined(CONFIG_MAGIC_SYSRQ) + #define SUPPORT_SYSRQ + #endif + +--- a/drivers/tty/serial/8250/Kconfig ++++ b/drivers/tty/serial/8250/Kconfig +@@ -91,6 +91,10 @@ config SERIAL_8250_CONSOLE + + If unsure, say N. + ++config SERIAL_8250_SYSRQ ++ bool "Magic sysrq support on 8250/16550 devices" ++ depends on SERIAL_8250_CONSOLE ++ + config SERIAL_8250_GSC + tristate + depends on SERIAL_8250 && GSC diff --git a/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch b/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch new file mode 100644 index 000000000..41c9220a6 --- /dev/null +++ b/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch @@ -0,0 +1,65 @@ +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -89,6 +89,9 @@ source "net/netlabel/Kconfig" + + endif # if INET + ++config SOCK_DIAG ++ bool ++ + config NETWORK_SECMARK + bool "Security Marking" + help +--- a/net/core/Makefile ++++ b/net/core/Makefile +@@ -9,8 +9,9 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core. + + obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \ + neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ +- sock_diag.o dev_ioctl.o tso.o ++ dev_ioctl.o tso.o + ++obj-$(CONFIG_SOCK_DIAG) += sock_diag.o + obj-$(CONFIG_XFRM) += flow.o + obj-y += net-sysfs.o + obj-$(CONFIG_PROC_FS) += net-procfs.o +--- a/net/ipv4/Kconfig ++++ b/net/ipv4/Kconfig +@@ -419,6 +419,7 @@ config INET_LRO + + config INET_DIAG + tristate "INET: socket monitoring interface" ++ select SOCK_DIAG + default y + ---help--- + Support for INET (TCP, DCCP, etc) socket monitoring interface used by +--- a/net/unix/Kconfig ++++ b/net/unix/Kconfig +@@ -22,6 +22,7 @@ config UNIX + config UNIX_DIAG + tristate "UNIX: socket monitoring interface" + depends on UNIX ++ select SOCK_DIAG + default n + ---help--- + Support for UNIX socket monitoring interface used by the ss tool. +--- a/net/netlink/Kconfig ++++ b/net/netlink/Kconfig +@@ -4,6 +4,7 @@ + + config NETLINK_DIAG + tristate "NETLINK: socket monitoring interface" ++ select SOCK_DIAG + default n + ---help--- + Support for NETLINK socket monitoring interface used by the ss tool. +--- a/net/packet/Kconfig ++++ b/net/packet/Kconfig +@@ -18,6 +18,7 @@ config PACKET + config PACKET_DIAG + tristate "Packet: sockets monitoring interface" + depends on PACKET ++ select SOCK_DIAG + default n + ---help--- + Support for PF_PACKET sockets monitoring interface used by the ss tool. diff --git a/target/linux/generic/pending-3.18/902-debloat_proc.patch b/target/linux/generic/pending-3.18/902-debloat_proc.patch new file mode 100644 index 000000000..69cf44841 --- /dev/null +++ b/target/linux/generic/pending-3.18/902-debloat_proc.patch @@ -0,0 +1,341 @@ +--- a/fs/locks.c ++++ b/fs/locks.c +@@ -2620,6 +2620,8 @@ static const struct file_operations proc + + static int __init proc_locks_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; + proc_create("locks", 0, NULL, &proc_locks_operations); + return 0; + } +--- a/fs/proc/Kconfig ++++ b/fs/proc/Kconfig +@@ -71,3 +71,8 @@ config PROC_PAGE_MONITOR + /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap, + /proc/kpagecount, and /proc/kpageflags. Disabling these + interfaces will reduce the size of the kernel by approximately 4kb. ++ ++config PROC_STRIPPED ++ default n ++ depends on EXPERT ++ bool "Strip non-essential /proc functionality to reduce code size" +--- a/fs/proc/consoles.c ++++ b/fs/proc/consoles.c +@@ -106,6 +106,9 @@ static const struct file_operations proc + + static int __init proc_consoles_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; ++ + proc_create("consoles", 0, NULL, &proc_consoles_operations); + return 0; + } +--- a/fs/proc/proc_tty.c ++++ b/fs/proc/proc_tty.c +@@ -144,7 +144,10 @@ static const struct file_operations proc + void proc_tty_register_driver(struct tty_driver *driver) + { + struct proc_dir_entry *ent; +- ++ ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; ++ + if (!driver->driver_name || driver->proc_entry || + !driver->ops->proc_fops) + return; +@@ -161,6 +164,9 @@ void proc_tty_unregister_driver(struct t + { + struct proc_dir_entry *ent; + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; ++ + ent = driver->proc_entry; + if (!ent) + return; +@@ -175,6 +181,9 @@ void proc_tty_unregister_driver(struct t + */ + void __init proc_tty_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; ++ + if (!proc_mkdir("tty", NULL)) + return; + proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ +--- a/kernel/exec_domain.c ++++ b/kernel/exec_domain.c +@@ -176,6 +176,8 @@ static const struct file_operations exec + + static int __init proc_execdomains_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; + proc_create("execdomains", 0, NULL, &execdomains_proc_fops); + return 0; + } +--- a/kernel/irq/proc.c ++++ b/kernel/irq/proc.c +@@ -330,6 +330,9 @@ void register_irq_proc(unsigned int irq, + static DEFINE_MUTEX(register_lock); + char name [MAX_NAMELEN]; + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) ++ return; ++ + if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) + return; + +@@ -379,6 +382,9 @@ void unregister_irq_proc(unsigned int ir + { + char name [MAX_NAMELEN]; + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) ++ return; ++ + if (!root_irq_dir || !desc->dir) + return; + #ifdef CONFIG_SMP +@@ -414,6 +420,9 @@ void init_irq_proc(void) + unsigned int irq; + struct irq_desc *desc; + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) ++ return; ++ + /* create /proc/irq */ + root_irq_dir = proc_mkdir("irq", NULL); + if (!root_irq_dir) +--- a/kernel/time/timer_list.c ++++ b/kernel/time/timer_list.c +@@ -362,6 +362,8 @@ static int __init init_timer_list_procfs + { + struct proc_dir_entry *pe; + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; + pe = proc_create("timer_list", 0444, NULL, &timer_list_fops); + if (!pe) + return -ENOMEM; +--- a/mm/vmalloc.c ++++ b/mm/vmalloc.c +@@ -2663,6 +2663,8 @@ static const struct file_operations proc + + static int __init proc_vmalloc_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; + proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); + return 0; + } +--- a/mm/vmstat.c ++++ b/mm/vmstat.c +@@ -1424,10 +1424,12 @@ static int __init setup_vmstat(void) + cpu_notifier_register_done(); + #endif + #ifdef CONFIG_PROC_FS +- proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); +- proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { ++ proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); ++ proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); ++ proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); ++ } + proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); +- proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); + #endif + return 0; + } +--- a/net/8021q/vlanproc.c ++++ b/net/8021q/vlanproc.c +@@ -127,6 +127,9 @@ void vlan_proc_cleanup(struct net *net) + { + struct vlan_net *vn = net_generic(net, vlan_net_id); + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; ++ + if (vn->proc_vlan_conf) + remove_proc_entry(name_conf, vn->proc_vlan_dir); + +@@ -146,6 +149,9 @@ int __net_init vlan_proc_init(struct net + { + struct vlan_net *vn = net_generic(net, vlan_net_id); + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; ++ + vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net); + if (!vn->proc_vlan_dir) + goto err; +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -2941,6 +2941,8 @@ static __net_initdata struct pernet_oper + + static int __init proto_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; + return register_pernet_subsys(&proto_net_ops); + } + +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -2490,10 +2490,12 @@ static const struct file_operations fib_ + + int __net_init fib_proc_init(struct net *net) + { +- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && ++ !proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) + goto out1; + +- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net, ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && ++ !proc_create("fib_triestat", S_IRUGO, net->proc_net, + &fib_triestat_fops)) + goto out2; + +@@ -2503,17 +2505,21 @@ int __net_init fib_proc_init(struct net + return 0; + + out3: +- remove_proc_entry("fib_triestat", net->proc_net); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ remove_proc_entry("fib_triestat", net->proc_net); + out2: +- remove_proc_entry("fib_trie", net->proc_net); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ remove_proc_entry("fib_trie", net->proc_net); + out1: + return -ENOMEM; + } + + void __net_exit fib_proc_exit(struct net *net) + { +- remove_proc_entry("fib_trie", net->proc_net); +- remove_proc_entry("fib_triestat", net->proc_net); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { ++ remove_proc_entry("fib_trie", net->proc_net); ++ remove_proc_entry("fib_triestat", net->proc_net); ++ } + remove_proc_entry("route", net->proc_net); + } + +--- a/net/ipv4/proc.c ++++ b/net/ipv4/proc.c +@@ -524,6 +524,9 @@ static __net_initdata struct pernet_oper + + int __init ip_misc_proc_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; ++ + return register_pernet_subsys(&ip_proc_ops); + } + +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -418,6 +418,9 @@ static struct pernet_operations ip_rt_pr + + static int __init ip_rt_proc_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return 0; ++ + return register_pernet_subsys(&ip_rt_proc_ops); + } + +--- a/ipc/msg.c ++++ b/ipc/msg.c +@@ -1075,6 +1075,9 @@ void __init msg_init(void) + printk(KERN_INFO "msgmni has been set to %d\n", + init_ipc_ns.msg_ctlmni); + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; ++ + ipc_init_proc_interface("sysvipc/msg", + " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", + IPC_MSG_IDS, sysvipc_msg_proc_show); +--- a/ipc/sem.c ++++ b/ipc/sem.c +@@ -191,6 +191,8 @@ void sem_exit_ns(struct ipc_namespace *n + void __init sem_init(void) + { + sem_init_ns(&init_ipc_ns); ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; + ipc_init_proc_interface("sysvipc/sem", + " key semid perms nsems uid gid cuid cgid otime ctime\n", + IPC_SEM_IDS, sysvipc_sem_proc_show); +--- a/ipc/shm.c ++++ b/ipc/shm.c +@@ -118,6 +118,8 @@ pure_initcall(ipc_ns_init); + + void __init shm_init(void) + { ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; + ipc_init_proc_interface("sysvipc/shm", + #if BITS_PER_LONG <= 32 + " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", +--- a/ipc/util.c ++++ b/ipc/util.c +@@ -161,6 +161,9 @@ void __init ipc_init_proc_interface(cons + struct proc_dir_entry *pde; + struct ipc_proc_iface *iface; + ++ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ return; ++ + iface = kmalloc(sizeof(*iface), GFP_KERNEL); + if (!iface) + return; +--- a/net/core/net-procfs.c ++++ b/net/core/net-procfs.c +@@ -318,10 +318,12 @@ static int __net_init dev_proc_net_init( + + if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) + goto out; +- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net, ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && ++ !proc_create("softnet_stat", S_IRUGO, net->proc_net, + &softnet_seq_fops)) + goto out_dev; +- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && ++ !proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) + goto out_softnet; + + if (wext_proc_init(net)) +@@ -330,9 +332,11 @@ static int __net_init dev_proc_net_init( + out: + return rc; + out_ptype: +- remove_proc_entry("ptype", net->proc_net); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ remove_proc_entry("ptype", net->proc_net); + out_softnet: +- remove_proc_entry("softnet_stat", net->proc_net); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) ++ remove_proc_entry("softnet_stat", net->proc_net); + out_dev: + remove_proc_entry("dev", net->proc_net); + goto out; +@@ -342,8 +346,10 @@ static void __net_exit dev_proc_net_exit + { + wext_proc_exit(net); + +- remove_proc_entry("ptype", net->proc_net); +- remove_proc_entry("softnet_stat", net->proc_net); ++ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { ++ remove_proc_entry("ptype", net->proc_net); ++ remove_proc_entry("softnet_stat", net->proc_net); ++ } + remove_proc_entry("dev", net->proc_net); + } + diff --git a/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch b/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch new file mode 100644 index 000000000..a5e0be249 --- /dev/null +++ b/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch @@ -0,0 +1,44 @@ +--- a/drivers/base/Kconfig ++++ b/drivers/base/Kconfig +@@ -229,7 +229,7 @@ config SOC_BUS + source "drivers/base/regmap/Kconfig" + + config DMA_SHARED_BUFFER +- bool ++ tristate + default n + select ANON_INODES + help +--- a/drivers/dma-buf/Makefile ++++ b/drivers/dma-buf/Makefile +@@ -1 +1,2 @@ +-obj-y := dma-buf.o fence.o reservation.o seqno-fence.o ++obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o ++dma-shared-buffer-objs := dma-buf.o fence.o reservation.o seqno-fence.o +--- a/drivers/dma-buf/dma-buf.c ++++ b/drivers/dma-buf/dma-buf.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + static inline int is_dma_buf_file(struct file *); + +@@ -904,4 +905,5 @@ static void __exit dma_buf_deinit(void) + { + dma_buf_uninit_debugfs(); + } +-__exitcall(dma_buf_deinit); ++module_exit(dma_buf_deinit); ++MODULE_LICENSE("GPL"); +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -1823,6 +1823,7 @@ int wake_up_state(struct task_struct *p, + { + return try_to_wake_up(p, state, 0); + } ++EXPORT_SYMBOL_GPL(wake_up_state); + + /* + * This function clears the sched_dl_entity static params. diff --git a/target/linux/generic/pending-3.18/910-kobject_uevent.patch b/target/linux/generic/pending-3.18/910-kobject_uevent.patch new file mode 100644 index 000000000..f69294b4f --- /dev/null +++ b/target/linux/generic/pending-3.18/910-kobject_uevent.patch @@ -0,0 +1,21 @@ +--- a/lib/kobject_uevent.c ++++ b/lib/kobject_uevent.c +@@ -53,6 +53,18 @@ static const char *kobject_actions[] = { + [KOBJ_OFFLINE] = "offline", + }; + ++u64 uevent_next_seqnum(void) ++{ ++ u64 seq; ++ ++ mutex_lock(&uevent_sock_mutex); ++ seq = ++uevent_seqnum; ++ mutex_unlock(&uevent_sock_mutex); ++ ++ return seq; ++} ++EXPORT_SYMBOL_GPL(uevent_next_seqnum); ++ + /** + * kobject_action_type - translate action string to numeric type + * diff --git a/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch new file mode 100644 index 000000000..6e4c14029 --- /dev/null +++ b/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch @@ -0,0 +1,65 @@ +--- a/include/linux/kobject.h ++++ b/include/linux/kobject.h +@@ -32,6 +32,8 @@ + #define UEVENT_NUM_ENVP 32 /* number of env pointers */ + #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ + ++struct sk_buff; ++ + #ifdef CONFIG_UEVENT_HELPER + /* path to the userspace helper executed on an event */ + extern char uevent_helper[]; +@@ -221,4 +223,7 @@ int add_uevent_var(struct kobj_uevent_en + int kobject_action_type(const char *buf, size_t count, + enum kobject_action *type); + ++int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, ++ gfp_t allocation); ++ + #endif /* _KOBJECT_H_ */ +--- a/lib/kobject_uevent.c ++++ b/lib/kobject_uevent.c +@@ -424,6 +424,43 @@ int add_uevent_var(struct kobj_uevent_en + EXPORT_SYMBOL_GPL(add_uevent_var); + + #if defined(CONFIG_NET) ++int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, ++ gfp_t allocation) ++{ ++ struct uevent_sock *ue_sk; ++ int err = 0; ++ ++ /* send netlink message */ ++ mutex_lock(&uevent_sock_mutex); ++ list_for_each_entry(ue_sk, &uevent_sock_list, list) { ++ struct sock *uevent_sock = ue_sk->sk; ++ struct sk_buff *skb2; ++ ++ skb2 = skb_clone(skb, allocation); ++ if (!skb2) ++ break; ++ ++ err = netlink_broadcast(uevent_sock, skb2, pid, group, ++ allocation); ++ if (err) ++ break; ++ } ++ mutex_unlock(&uevent_sock_mutex); ++ ++ kfree_skb(skb); ++ return err; ++} ++#else ++int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, ++ gfp_t allocation) ++{ ++ kfree_skb(skb); ++ return 0; ++} ++#endif ++EXPORT_SYMBOL_GPL(broadcast_uevent); ++ ++#if defined(CONFIG_NET) + static int uevent_net_init(struct net *net) + { + struct uevent_sock *ue_sk; diff --git a/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch b/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch new file mode 100644 index 000000000..57c2fe27b --- /dev/null +++ b/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch @@ -0,0 +1,12 @@ +--- a/init/main.c ++++ b/init/main.c +@@ -963,7 +963,8 @@ static int __ref kernel_init(void *unuse + pr_err("Failed to execute %s (error %d). Attempting defaults...\n", + execute_command, ret); + } +- if (!try_to_run_init_process("/sbin/init") || ++ if (!try_to_run_init_process("/etc/preinit") || ++ !try_to_run_init_process("/sbin/init") || + !try_to_run_init_process("/etc/init") || + !try_to_run_init_process("/bin/init") || + !try_to_run_init_process("/bin/sh")) diff --git a/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch b/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch new file mode 100644 index 000000000..988de35ce --- /dev/null +++ b/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch @@ -0,0 +1,30 @@ +--- a/scripts/gen_initramfs_list.sh ++++ b/scripts/gen_initramfs_list.sh +@@ -59,6 +59,18 @@ default_initramfs() { + EOF + } + ++list_openwrt_initramfs() { ++ : ++} ++ ++openwrt_initramfs() { ++ # make sure that /dev/console exists ++ cat <<-EOF >> ${output} ++ dir /dev 0755 0 0 ++ nod /dev/console 0600 0 0 c 5 1 ++ EOF ++} ++ + filetype() { + local argv1="$1" + +@@ -177,6 +189,8 @@ dir_filelist() { + if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then + ${dep_list}print_mtime "$1" + ++ ${dep_list}openwrt_initramfs ++ + echo "${dirlist}" | \ + while read x; do + ${dep_list}parse ${x} diff --git a/target/linux/generic/pending-3.18/930-crashlog.patch b/target/linux/generic/pending-3.18/930-crashlog.patch new file mode 100644 index 000000000..9b0eb732d --- /dev/null +++ b/target/linux/generic/pending-3.18/930-crashlog.patch @@ -0,0 +1,276 @@ +--- /dev/null ++++ b/include/linux/crashlog.h +@@ -0,0 +1,17 @@ ++#ifndef __CRASHLOG_H ++#define __CRASHLOG_H ++ ++#ifdef CONFIG_CRASHLOG ++void crashlog_init_bootmem(struct bootmem_data *bdata); ++void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size); ++#else ++static inline void crashlog_init_bootmem(struct bootmem_data *bdata) ++{ ++} ++ ++static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) ++{ ++} ++#endif ++ ++#endif +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1279,6 +1279,10 @@ config RELAY + + If unsure, say N. + ++config CRASHLOG ++ bool "Crash logging" ++ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) && !(ARM || SPARC || PPC) ++ + config BLK_DEV_INITRD + bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" + depends on BROKEN || !FRV +--- a/kernel/Makefile ++++ b/kernel/Makefile +@@ -96,6 +96,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o + obj-$(CONFIG_JUMP_LABEL) += jump_label.o + obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o + obj-$(CONFIG_TORTURE_TEST) += torture.o ++obj-$(CONFIG_CRASHLOG) += crashlog.o + + $(obj)/configs.o: $(obj)/config_data.h + +--- /dev/null ++++ b/kernel/crashlog.c +@@ -0,0 +1,181 @@ ++/* ++ * Crash information logger ++ * Copyright (C) 2010 Felix Fietkau ++ * ++ * Based on ramoops.c ++ * Copyright (C) 2010 Marco Stornelli ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ++ * 02110-1301 USA ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define CRASHLOG_PAGES 4 ++#define CRASHLOG_SIZE (CRASHLOG_PAGES * PAGE_SIZE) ++#define CRASHLOG_MAGIC 0xa1eedead ++ ++/* ++ * Start the log at 1M before the end of RAM, as some boot loaders like ++ * to use the end of the RAM for stack usage and other things ++ * If this fails, fall back to using the last part. ++ */ ++#define CRASHLOG_OFFSET (1024 * 1024) ++ ++struct crashlog_data { ++ u32 magic; ++ u32 len; ++ u8 data[]; ++}; ++ ++static struct debugfs_blob_wrapper crashlog_blob; ++static unsigned long crashlog_addr = 0; ++static struct crashlog_data *crashlog_buf; ++static struct kmsg_dumper dump; ++static bool first = true; ++ ++extern struct list_head *crashlog_modules; ++ ++#ifndef CONFIG_NO_BOOTMEM ++void __init crashlog_init_bootmem(bootmem_data_t *bdata) ++{ ++ unsigned long addr; ++ ++ if (crashlog_addr) ++ return; ++ ++ addr = PFN_PHYS(bdata->node_low_pfn) - CRASHLOG_OFFSET; ++ if (reserve_bootmem(addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { ++ printk("Crashlog failed to allocate RAM at address 0x%lx\n", addr); ++ bdata->node_low_pfn -= CRASHLOG_PAGES; ++ addr = PFN_PHYS(bdata->node_low_pfn); ++ } ++ crashlog_addr = addr; ++} ++#endif ++ ++#ifdef CONFIG_HAVE_MEMBLOCK ++void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) ++{ ++ if (crashlog_addr) ++ return; ++ ++ addr += size - CRASHLOG_OFFSET; ++ if (memblock_reserve(addr, CRASHLOG_SIZE)) { ++ printk("Crashlog failed to allocate RAM at address 0x%lx\n", (unsigned long) addr); ++ return; ++ } ++ ++ crashlog_addr = addr; ++} ++#endif ++ ++static void __init crashlog_copy(void) ++{ ++ if (crashlog_buf->magic != CRASHLOG_MAGIC) ++ return; ++ ++ if (!crashlog_buf->len || crashlog_buf->len > ++ CRASHLOG_SIZE - sizeof(*crashlog_buf)) ++ return; ++ ++ crashlog_blob.size = crashlog_buf->len; ++ crashlog_blob.data = kmemdup(crashlog_buf->data, ++ crashlog_buf->len, GFP_KERNEL); ++ ++ debugfs_create_blob("crashlog", 0700, NULL, &crashlog_blob); ++} ++ ++static int get_maxlen(void) ++{ ++ return CRASHLOG_SIZE - sizeof(*crashlog_buf) - crashlog_buf->len; ++} ++ ++static void crashlog_printf(const char *fmt, ...) ++{ ++ va_list args; ++ int len = get_maxlen(); ++ ++ if (!len) ++ return; ++ ++ va_start(args, fmt); ++ crashlog_buf->len += vscnprintf( ++ &crashlog_buf->data[crashlog_buf->len], ++ len, fmt, args); ++ va_end(args); ++} ++ ++static void crashlog_do_dump(struct kmsg_dumper *dumper, ++ enum kmsg_dump_reason reason) ++{ ++ struct timeval tv; ++ struct module *m; ++ char *buf; ++ size_t len; ++ ++ if (!first) ++ crashlog_printf("\n===================================\n"); ++ ++ do_gettimeofday(&tv); ++ crashlog_printf("Time: %lu.%lu\n", ++ (long)tv.tv_sec, (long)tv.tv_usec); ++ ++ if (first) { ++ crashlog_printf("Modules:"); ++ list_for_each_entry(m, crashlog_modules, list) { ++ crashlog_printf("\t%s@%p+%x", m->name, ++ m->module_core, m->core_size, ++ m->module_init, m->init_size); ++ } ++ crashlog_printf("\n"); ++ first = false; ++ } ++ ++ buf = (char *)&crashlog_buf->data[crashlog_buf->len]; ++ ++ kmsg_dump_get_buffer(dumper, true, buf, get_maxlen(), &len); ++ ++ crashlog_buf->len += len; ++} ++ ++ ++int __init crashlog_init_fs(void) ++{ ++ if (!crashlog_addr) ++ return -ENOMEM; ++ ++ crashlog_buf = ioremap(crashlog_addr, CRASHLOG_SIZE); ++ ++ crashlog_copy(); ++ ++ crashlog_buf->magic = CRASHLOG_MAGIC; ++ crashlog_buf->len = 0; ++ ++ dump.max_reason = KMSG_DUMP_OOPS; ++ dump.dump = crashlog_do_dump; ++ kmsg_dump_register(&dump); ++ ++ return 0; ++} ++module_init(crashlog_init_fs); +--- a/mm/bootmem.c ++++ b/mm/bootmem.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -177,6 +178,7 @@ static unsigned long __init free_all_boo + if (!bdata->node_bootmem_map) + return 0; + ++ crashlog_init_bootmem(bdata); + map = bdata->node_bootmem_map; + start = bdata->node_min_pfn; + end = bdata->node_low_pfn; +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -105,6 +105,9 @@ static LIST_HEAD(modules); + #ifdef CONFIG_KGDB_KDB + struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ + #endif /* CONFIG_KGDB_KDB */ ++#ifdef CONFIG_CRASHLOG ++struct list_head *crashlog_modules = &modules; ++#endif + + #ifdef CONFIG_MODULE_SIG + #ifdef CONFIG_MODULE_SIG_FORCE +--- a/mm/memblock.c ++++ b/mm/memblock.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -477,6 +478,8 @@ static void __init_memblock memblock_ins + memblock_set_region_node(rgn, nid); + type->cnt++; + type->total_size += size; ++ if (type == &memblock.memory && idx == 0) ++ crashlog_init_memblock(base, size); + } + + /** diff --git a/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch new file mode 100644 index 000000000..ac13c9e67 --- /dev/null +++ b/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch @@ -0,0 +1,29 @@ +--- a/usr/Makefile ++++ b/usr/Makefile +@@ -53,6 +53,8 @@ ifneq ($(wildcard $(obj)/.initramfs_data + include $(obj)/.initramfs_data.cpio.d + endif + ++deps_initramfs_sane := $(foreach v,$(deps_initramfs),$(if $(findstring :,$(v)),,$(v))) ++ + quiet_cmd_initfs = GEN $@ + cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) + +@@ -61,14 +63,14 @@ targets := initramfs_data.cpio.gz initra + initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \ + initramfs_data.cpio + # do not try to update files included in initramfs +-$(deps_initramfs): ; ++$(deps_initramfs_sane): ; + +-$(deps_initramfs): klibcdirs ++$(deps_initramfs_sane): klibcdirs + # We rebuild initramfs_data.cpio if: + # 1) Any included file is newer then initramfs_data.cpio + # 2) There are changes in which files are included (added or deleted) + # 3) If gen_init_cpio are newer than initramfs_data.cpio + # 4) arguments to gen_initramfs.sh changes +-$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs ++$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs_sane) klibcdirs + $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d + $(call if_changed,initfs) diff --git a/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch b/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch new file mode 100644 index 000000000..5e9718b61 --- /dev/null +++ b/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch @@ -0,0 +1,32 @@ +--- a/arch/arm/tools/mach-types ++++ b/arch/arm/tools/mach-types +@@ -1007,3 +1007,29 @@ eco5_bx2 MACH_ECO5_BX2 ECO5_BX2 4572 + eukrea_cpuimx28sd MACH_EUKREA_CPUIMX28SD EUKREA_CPUIMX28SD 4573 + domotab MACH_DOMOTAB DOMOTAB 4574 + pfla03 MACH_PFLA03 PFLA03 4575 ++# ++# Additional mach-types supported by OpenWrt ++# ++wg302v1 MACH_WG302V1 WG302V1 889 ++pronghorn MACH_PRONGHORN PRONGHORN 928 ++pronghorn_metro MACH_PRONGHORNMETRO PRONGHORNMETRO 1040 ++sidewinder MACH_SIDEWINDER SIDEWINDER 1041 ++wrt300nv2 MACH_WRT300NV2 WRT300NV2 1077 ++compex42x MACH_COMPEXWP18 COMPEXWP18 1273 ++goldfish MACH_GOLDFISH GOLDFISH 1441 ++cambria MACH_CAMBRIA CAMBRIA 1468 ++dt2 MACH_DT2 DT2 1514 ++ap1000 MACH_AP1000 AP1000 1543 ++tw2662 MACH_TW2662 TW2662 1658 ++tw5334 MACH_TW5334 TW5334 1664 ++usr8200 MACH_USR8200 USR8200 1762 ++mi424wr MACH_MI424WR MI424WR 1778 ++gw2388 MACH_GW2388 GW2388 2635 ++iconnect MACH_ICONNECT ICONNECT 2870 ++nsb3ast MACH_NSB3AST NSB3AST 2917 ++goflexnet MACH_GOFLEXNET GOFLEXNET 3089 ++nas6210 MACH_NAS6210 NAS6210 3104 ++ns_k330 MACH_NS_K330 NS_K330 3108 ++bcm2708 MACH_BCM2708 BCM2708 3138 ++wn802t MACH_WN802T WN802T 3306 ++nsa310 MACH_NSA310 NSA310 4022 diff --git a/target/linux/generic/pending-3.18/990-gpio_wdt.patch b/target/linux/generic/pending-3.18/990-gpio_wdt.patch new file mode 100644 index 000000000..47422734f --- /dev/null +++ b/target/linux/generic/pending-3.18/990-gpio_wdt.patch @@ -0,0 +1,360 @@ +This generic GPIO watchdog is used on Huawei E970 (brcm47xx) + +Signed-off-by: Mathias Adam + +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1139,6 +1139,15 @@ config WDT_MTX1 + Hardware driver for the MTX-1 boards. This is a watchdog timer that + will reboot the machine after a 100 seconds timer expired. + ++config GPIO_WDT ++ tristate "GPIO Hardware Watchdog" ++ help ++ Hardware driver for GPIO-controlled watchdogs. GPIO pin and ++ toggle interval settings are platform-specific. The driver ++ will stop toggling the GPIO (i.e. machine reboots) after a ++ 100 second timer expired and no process has written to ++ /dev/watchdog during that time. ++ + config PNX833X_WDT + tristate "PNX833x Hardware Watchdog" + depends on SOC_PNX8335 +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -134,6 +134,7 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt + obj-$(CONFIG_INDYDOG) += indydog.o + obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o + obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o ++obj-$(CONFIG_GPIO_WDT) += old_gpio_wdt.o + obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o + obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o + obj-$(CONFIG_AR7_WDT) += ar7_wdt.o +--- /dev/null ++++ b/drivers/watchdog/old_gpio_wdt.c +@@ -0,0 +1,301 @@ ++/* ++ * Driver for GPIO-controlled Hardware Watchdogs. ++ * ++ * Copyright (C) 2013 Mathias Adam ++ * ++ * Replaces mtx1_wdt (driver for the MTX-1 Watchdog): ++ * ++ * (C) Copyright 2005 4G Systems , ++ * All Rights Reserved. ++ * http://www.4g-systems.biz ++ * ++ * (C) Copyright 2007 OpenWrt.org, Florian Fainelli ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ * Neither Michael Stickel nor 4G Systems admit liability nor provide ++ * warranty for any of this software. This material is provided ++ * "AS-IS" and at no charge. ++ * ++ * (c) Copyright 2005 4G Systems ++ * ++ * Release 0.01. ++ * Author: Michael Stickel michael.stickel@4g-systems.biz ++ * ++ * Release 0.02. ++ * Author: Florian Fainelli florian@openwrt.org ++ * use the Linux watchdog/timer APIs ++ * ++ * Release 0.03. ++ * Author: Mathias Adam ++ * make it a generic gpio watchdog driver ++ * ++ * The Watchdog is configured to reset the MTX-1 ++ * if it is not triggered for 100 seconds. ++ * It should not be triggered more often than 1.6 seconds. ++ * ++ * A timer triggers the watchdog every 5 seconds, until ++ * it is opened for the first time. After the first open ++ * it MUST be triggered every 2..95 seconds. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int ticks = 100 * HZ; ++ ++static struct { ++ struct completion stop; ++ spinlock_t lock; ++ int running; ++ struct timer_list timer; ++ int queue; ++ int default_ticks; ++ unsigned long inuse; ++ unsigned gpio; ++ unsigned int gstate; ++ int interval; ++ int first_interval; ++} gpio_wdt_device; ++ ++static void gpio_wdt_trigger(unsigned long unused) ++{ ++ spin_lock(&gpio_wdt_device.lock); ++ if (gpio_wdt_device.running && ticks > 0) ++ ticks -= gpio_wdt_device.interval; ++ ++ /* toggle wdt gpio */ ++ gpio_wdt_device.gstate = !gpio_wdt_device.gstate; ++ gpio_set_value(gpio_wdt_device.gpio, gpio_wdt_device.gstate); ++ ++ if (gpio_wdt_device.queue && ticks > 0) ++ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.interval); ++ else ++ complete(&gpio_wdt_device.stop); ++ spin_unlock(&gpio_wdt_device.lock); ++} ++ ++static void gpio_wdt_reset(void) ++{ ++ ticks = gpio_wdt_device.default_ticks; ++} ++ ++ ++static void gpio_wdt_start(void) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&gpio_wdt_device.lock, flags); ++ if (!gpio_wdt_device.queue) { ++ gpio_wdt_device.queue = 1; ++ gpio_wdt_device.gstate = 1; ++ gpio_set_value(gpio_wdt_device.gpio, 1); ++ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.first_interval); ++ } ++ gpio_wdt_device.running++; ++ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); ++} ++ ++static int gpio_wdt_stop(void) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&gpio_wdt_device.lock, flags); ++ if (gpio_wdt_device.queue) { ++ gpio_wdt_device.queue = 0; ++ gpio_wdt_device.gstate = 0; ++ gpio_set_value(gpio_wdt_device.gpio, 0); ++ } ++ ticks = gpio_wdt_device.default_ticks; ++ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); ++ return 0; ++} ++ ++/* Filesystem functions */ ++ ++static int gpio_wdt_open(struct inode *inode, struct file *file) ++{ ++ if (test_and_set_bit(0, &gpio_wdt_device.inuse)) ++ return -EBUSY; ++ return nonseekable_open(inode, file); ++} ++ ++ ++static int gpio_wdt_release(struct inode *inode, struct file *file) ++{ ++ clear_bit(0, &gpio_wdt_device.inuse); ++ return 0; ++} ++ ++static long gpio_wdt_ioctl(struct file *file, unsigned int cmd, ++ unsigned long arg) ++{ ++ void __user *argp = (void __user *)arg; ++ int __user *p = (int __user *)argp; ++ unsigned int value; ++ static const struct watchdog_info ident = { ++ .options = WDIOF_CARDRESET, ++ .identity = "GPIO WDT", ++ }; ++ ++ switch (cmd) { ++ case WDIOC_GETSUPPORT: ++ if (copy_to_user(argp, &ident, sizeof(ident))) ++ return -EFAULT; ++ break; ++ case WDIOC_GETSTATUS: ++ case WDIOC_GETBOOTSTATUS: ++ put_user(0, p); ++ break; ++ case WDIOC_SETOPTIONS: ++ if (get_user(value, p)) ++ return -EFAULT; ++ if (value & WDIOS_ENABLECARD) ++ gpio_wdt_start(); ++ else if (value & WDIOS_DISABLECARD) ++ gpio_wdt_stop(); ++ else ++ return -EINVAL; ++ return 0; ++ case WDIOC_KEEPALIVE: ++ gpio_wdt_reset(); ++ break; ++ default: ++ return -ENOTTY; ++ } ++ return 0; ++} ++ ++ ++static ssize_t gpio_wdt_write(struct file *file, const char *buf, ++ size_t count, loff_t *ppos) ++{ ++ if (!count) ++ return -EIO; ++ gpio_wdt_reset(); ++ return count; ++} ++ ++static const struct file_operations gpio_wdt_fops = { ++ .owner = THIS_MODULE, ++ .llseek = no_llseek, ++ .unlocked_ioctl = gpio_wdt_ioctl, ++ .open = gpio_wdt_open, ++ .write = gpio_wdt_write, ++ .release = gpio_wdt_release, ++}; ++ ++ ++static struct miscdevice gpio_wdt_misc = { ++ .minor = WATCHDOG_MINOR, ++ .name = "watchdog", ++ .fops = &gpio_wdt_fops, ++}; ++ ++ ++static int gpio_wdt_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct gpio_wdt_platform_data *gpio_wdt_data = pdev->dev.platform_data; ++ ++ gpio_wdt_device.gpio = gpio_wdt_data->gpio; ++ gpio_wdt_device.interval = gpio_wdt_data->interval; ++ gpio_wdt_device.first_interval = gpio_wdt_data->first_interval; ++ if (gpio_wdt_device.first_interval <= 0) { ++ gpio_wdt_device.first_interval = gpio_wdt_device.interval; ++ } ++ ++ ret = gpio_request(gpio_wdt_device.gpio, "gpio-wdt"); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "failed to request gpio"); ++ return ret; ++ } ++ ++ spin_lock_init(&gpio_wdt_device.lock); ++ init_completion(&gpio_wdt_device.stop); ++ gpio_wdt_device.queue = 0; ++ clear_bit(0, &gpio_wdt_device.inuse); ++ setup_timer(&gpio_wdt_device.timer, gpio_wdt_trigger, 0L); ++ gpio_wdt_device.default_ticks = ticks; ++ ++ gpio_wdt_start(); ++ dev_info(&pdev->dev, "GPIO Hardware Watchdog driver (gpio=%i interval=%i/%i)\n", ++ gpio_wdt_data->gpio, gpio_wdt_data->first_interval, gpio_wdt_data->interval); ++ return 0; ++} ++ ++static int gpio_wdt_remove(struct platform_device *pdev) ++{ ++ /* FIXME: do we need to lock this test ? */ ++ if (gpio_wdt_device.queue) { ++ gpio_wdt_device.queue = 0; ++ wait_for_completion(&gpio_wdt_device.stop); ++ } ++ ++ gpio_free(gpio_wdt_device.gpio); ++ misc_deregister(&gpio_wdt_misc); ++ return 0; ++} ++ ++static struct platform_driver gpio_wdt_driver = { ++ .probe = gpio_wdt_probe, ++ .remove = gpio_wdt_remove, ++ .driver.name = "gpio-wdt", ++ .driver.owner = THIS_MODULE, ++}; ++ ++static int __init gpio_wdt_init(void) ++{ ++ return platform_driver_register(&gpio_wdt_driver); ++} ++arch_initcall(gpio_wdt_init); ++ ++/* ++ * We do wdt initialization in two steps: arch_initcall probes the wdt ++ * very early to start pinging the watchdog (misc devices are not yet ++ * available), and later module_init() just registers the misc device. ++ */ ++static int gpio_wdt_init_late(void) ++{ ++ int ret; ++ ++ ret = misc_register(&gpio_wdt_misc); ++ if (ret < 0) { ++ pr_err("GPIO_WDT: failed to register misc device\n"); ++ return ret; ++ } ++ return 0; ++} ++#ifndef MODULE ++module_init(gpio_wdt_init_late); ++#endif ++ ++static void __exit gpio_wdt_exit(void) ++{ ++ platform_driver_unregister(&gpio_wdt_driver); ++} ++module_exit(gpio_wdt_exit); ++ ++MODULE_AUTHOR("Michael Stickel, Florian Fainelli, Mathias Adam"); ++MODULE_DESCRIPTION("Driver for GPIO hardware watchdogs"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); ++MODULE_ALIAS("platform:gpio-wdt"); +--- /dev/null ++++ b/include/linux/old_gpio_wdt.h +@@ -0,0 +1,21 @@ ++/* ++ * Definitions for the GPIO watchdog driver ++ * ++ * Copyright (C) 2013 Mathias Adam ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#ifndef _GPIO_WDT_H_ ++#define _GPIO_WDT_H_ ++ ++struct gpio_wdt_platform_data { ++ int gpio; /* GPIO line number */ ++ int interval; /* watchdog reset interval in system ticks */ ++ int first_interval; /* first wd reset interval in system ticks */ ++}; ++ ++#endif /* _GPIO_WDT_H_ */ diff --git a/target/linux/generic/pending-3.18/995-mangle_bootargs.patch b/target/linux/generic/pending-3.18/995-mangle_bootargs.patch new file mode 100644 index 000000000..0029e9082 --- /dev/null +++ b/target/linux/generic/pending-3.18/995-mangle_bootargs.patch @@ -0,0 +1,58 @@ +--- a/init/main.c ++++ b/init/main.c +@@ -362,6 +362,29 @@ static inline void setup_nr_cpu_ids(void + static inline void smp_prepare_cpus(unsigned int maxcpus) { } + #endif + ++#ifdef CONFIG_MANGLE_BOOTARGS ++static void __init mangle_bootargs(char *command_line) ++{ ++ char *rootdev; ++ char *rootfs; ++ ++ rootdev = strstr(command_line, "root=/dev/mtdblock"); ++ ++ if (rootdev) ++ strncpy(rootdev, "mangled_rootblock=", 18); ++ ++ rootfs = strstr(command_line, "rootfstype"); ++ ++ if (rootfs) ++ strncpy(rootfs, "mangled_fs", 10); ++ ++} ++#else ++static void __init mangle_bootargs(char *command_line) ++{ ++} ++#endif ++ + /* + * We need to store the untouched command line for future reference. + * We also need to store the touched command line since the parameter +@@ -530,6 +553,7 @@ asmlinkage __visible void __init start_k + pr_notice("%s", linux_banner); + setup_arch(&command_line); + mm_init_cpumask(&init_mm); ++ mangle_bootargs(command_line); + setup_command_line(command_line); + setup_nr_cpu_ids(); + setup_per_cpu_areas(); +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1597,6 +1597,15 @@ config EMBEDDED + an embedded system so certain expert options are available + for configuration. + ++config MANGLE_BOOTARGS ++ bool "Rename offending bootargs" ++ depends on EXPERT ++ help ++ Sometimes the bootloader passed bogus root= and rootfstype= ++ parameters to the kernel, and while you want to ignore them, ++ you need to know the values f.e. to support dual firmware ++ layouts on the flash. ++ + config HAVE_PERF_EVENTS + bool + help diff --git a/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch b/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch new file mode 100644 index 000000000..61fe71b78 --- /dev/null +++ b/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch @@ -0,0 +1,24 @@ +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -909,6 +909,9 @@ int __init early_init_dt_scan_chosen(uns + p = of_get_flat_dt_prop(node, "bootargs", &l); + if (p != NULL && l > 0) + strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); ++ p = of_get_flat_dt_prop(node, "bootargs-append", &l); ++ if (p != NULL && l > 0) ++ strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); + + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else +--- a/arch/mips/kernel/prom.c ++++ b/arch/mips/kernel/prom.c +@@ -49,6 +49,9 @@ void * __init early_init_dt_alloc_memory + + void __init __dt_setup_arch(void *bph) + { ++ if (boot_command_line[0] == '\0') ++ strcpy(boot_command_line, arcs_cmdline); ++ + if (!early_init_dt_scan(bph)) + return; + diff --git a/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch b/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch new file mode 100644 index 000000000..d317de110 --- /dev/null +++ b/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch @@ -0,0 +1,15 @@ +We use backports for driver updates - make sure we can compile in the glue code regardless + +Signed-off-by: Imre Kaloz + +--- a/drivers/net/wireless/ti/Kconfig ++++ b/drivers/net/wireless/ti/Kconfig +@@ -15,7 +15,7 @@ source "drivers/net/wireless/ti/wlcore/K + + config WILINK_PLATFORM_DATA + bool "TI WiLink platform data" +- depends on WLCORE_SDIO || WL1251_SDIO ++ depends on WLCORE_SDIO || WL1251_SDIO || ARCH_OMAP2PLUS + default y + ---help--- + Small platform data bit needed to pass data to the sdio modules. diff --git a/target/linux/generic/pending-3.18/999-seccomp_log.patch b/target/linux/generic/pending-3.18/999-seccomp_log.patch new file mode 100644 index 000000000..1db6b18d4 --- /dev/null +++ b/target/linux/generic/pending-3.18/999-seccomp_log.patch @@ -0,0 +1,34 @@ +--- a/kernel/seccomp.c ++++ b/kernel/seccomp.c +@@ -614,6 +614,7 @@ int __secure_computing(void) + #ifdef CONFIG_SECCOMP_FILTER + static u32 __seccomp_phase1_filter(int this_syscall, struct seccomp_data *sd) + { ++ char name[sizeof(current->comm)]; + u32 filter_ret, action; + int data; + +@@ -644,6 +645,13 @@ static u32 __seccomp_phase1_filter(int t + case SECCOMP_RET_TRACE: + return filter_ret; /* Save the rest for phase 2. */ + ++ case SECCOMP_RET_LOG: ++ get_task_comm(name, current); ++ pr_err_ratelimited("seccomp: %s [%u] tried to call non-whitelisted syscall: %d\n", name, current->pid, this_syscall); ++ syscall_set_return_value(current, task_pt_regs(current), ++ -data, 0); ++ goto skip; ++ + case SECCOMP_RET_ALLOW: + return SECCOMP_PHASE1_OK; + +--- a/include/uapi/linux/seccomp.h ++++ b/include/uapi/linux/seccomp.h +@@ -28,6 +28,7 @@ + #define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */ + #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ + #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ ++#define SECCOMP_RET_LOG 0x00070000U /* allow + logline */ + #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ + #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ + diff --git a/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch index 03267310a..9fcffdee0 100644 --- a/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch +++ b/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c -@@ -238,7 +238,8 @@ static int br_handle_local_finish(struct +@@ -239,7 +239,8 @@ static int br_handle_local_finish(struct { struct net_bridge_port *p = br_port_get_rcu(skb->dev); @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; br_pass_frame_up(skb); -@@ -326,6 +327,15 @@ rx_handler_result_t br_handle_frame(stru +@@ -327,6 +328,15 @@ rx_handler_result_t br_handle_frame(stru forward: switch (p->state) { diff --git a/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch b/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch new file mode 100644 index 000000000..588b571e0 --- /dev/null +++ b/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch @@ -0,0 +1,50 @@ +From 81da1738eee68f1961e03bdeb2d60cf0eb4dd713 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= +Date: Thu, 5 Jul 2018 12:06:18 +0300 +Subject: [PATCH 2/2] usb: dwc2: Fix inefficient copy of unaligned buffers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make sure only to copy any actual data rather than the whole buffer, +when releasing the temporary buffer used for unaligned non-isochronous +transfers. + +Taken directly from commit 0efd937e27d5e ("USB: ehci-tegra: fix inefficient +copy of unaligned buffers") + +Tested with Lantiq xRX200 (MIPS) and RPi Model B Rev 2 (ARM) + +Signed-off-by: Antti Seppälä +--- + drivers/usb/dwc2/hcd.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -2669,6 +2669,7 @@ static int dwc2_alloc_split_dma_aligned_ + static void dwc2_free_dma_aligned_buffer(struct urb *urb) + { + void *stored_xfer_buffer; ++ size_t length; + + if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER)) + return; +@@ -2677,9 +2678,14 @@ static void dwc2_free_dma_aligned_buffer + memcpy(&stored_xfer_buffer, urb->transfer_buffer + + urb->transfer_buffer_length, sizeof(urb->transfer_buffer)); + +- if (usb_urb_dir_in(urb)) +- memcpy(stored_xfer_buffer, urb->transfer_buffer, +- urb->transfer_buffer_length); ++ if (usb_urb_dir_in(urb)) { ++ if (usb_pipeisoc(urb->pipe)) ++ length = urb->transfer_buffer_length; ++ else ++ length = urb->actual_length; ++ ++ memcpy(stored_xfer_buffer, urb->transfer_buffer, length); ++ } + kfree(urb->transfer_buffer); + urb->transfer_buffer = stored_xfer_buffer; + diff --git a/target/linux/generic/pending-4.14/180-net-phy-at803x-add-support-for-AT8032.patch b/target/linux/generic/pending-4.14/180-net-phy-at803x-add-support-for-AT8032.patch index 86a03f225..828b160be 100644 --- a/target/linux/generic/pending-4.14/180-net-phy-at803x-add-support-for-AT8032.patch +++ b/target/linux/generic/pending-4.14/180-net-phy-at803x-add-support-for-AT8032.patch @@ -8,15 +8,18 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -62,6 +62,7 @@ +@@ -62,8 +62,10 @@ #define ATH8030_PHY_ID 0x004dd076 #define ATH8031_PHY_ID 0x004dd074 +#define ATH8032_PHY_ID 0x004dd023 #define ATH8035_PHY_ID 0x004dd072 #define AT803X_PHY_ID_MASK 0xffffffef ++#define AT8032_PHY_ID_MASK 0xffffffff -@@ -256,7 +257,8 @@ static int at803x_probe(struct phy_devic + MODULE_DESCRIPTION("Atheros 803x PHY driver"); + MODULE_AUTHOR("Matus Ujhelyi"); +@@ -256,7 +258,8 @@ static int at803x_probe(struct phy_devic if (!priv) return -ENOMEM; @@ -26,7 +29,7 @@ Signed-off-by: Felix Fietkau goto does_not_require_reset_workaround; gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); -@@ -332,7 +334,7 @@ static void at803x_link_change_notify(st +@@ -332,7 +335,7 @@ static void at803x_link_change_notify(st struct at803x_priv *priv = phydev->priv; /* @@ -35,7 +38,7 @@ Signed-off-by: Felix Fietkau * signalled. This is necessary to circumvent a hardware bug that * occurs when the cable is unplugged while TX packets are pending * in the FIFO. In such cases, the FIFO enters an error mode it -@@ -444,6 +446,24 @@ static struct phy_driver at803x_driver[] +@@ -444,6 +447,24 @@ static struct phy_driver at803x_driver[] .aneg_done = at803x_aneg_done, .ack_interrupt = &at803x_ack_interrupt, .config_intr = &at803x_config_intr, @@ -43,7 +46,7 @@ Signed-off-by: Felix Fietkau + /* ATHEROS 8032 */ + .phy_id = ATH8032_PHY_ID, + .name = "Atheros 8032 ethernet", -+ .phy_id_mask = 0xffffffef, ++ .phy_id_mask = AT8032_PHY_ID_MASK, + .probe = at803x_probe, + .config_init = at803x_config_init, + .link_change_notify = at803x_link_change_notify, @@ -60,11 +63,11 @@ Signed-off-by: Felix Fietkau } }; module_phy_driver(at803x_driver); -@@ -451,6 +471,7 @@ module_phy_driver(at803x_driver); +@@ -451,6 +472,7 @@ module_phy_driver(at803x_driver); static struct mdio_device_id __maybe_unused atheros_tbl[] = { { ATH8030_PHY_ID, AT803X_PHY_ID_MASK }, { ATH8031_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8032_PHY_ID, AT803X_PHY_ID_MASK }, ++ { ATH8032_PHY_ID, AT8032_PHY_ID_MASK }, { ATH8035_PHY_ID, AT803X_PHY_ID_MASK }, { } }; diff --git a/target/linux/generic/pending-4.14/419-mtd-redboot-add-of_match_table-with-DT-binding.patch b/target/linux/generic/pending-4.14/419-mtd-redboot-add-of_match_table-with-DT-binding.patch new file mode 100644 index 000000000..fbf9a0553 --- /dev/null +++ b/target/linux/generic/pending-4.14/419-mtd-redboot-add-of_match_table-with-DT-binding.patch @@ -0,0 +1,31 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Subject: [PATCH] mtd: redboot: add of_match_table with DT binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows parsing RedBoot compatible partitions for properly described +flash device in DT. + +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -289,9 +289,16 @@ static int parse_redboot_partitions(stru + return ret; + } + ++static const struct of_device_id redboot_parser_of_match_table[] = { ++ { .compatible = "ecoscentric,redboot-fis-partitions" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, redboot_parser_of_match_table); ++ + static struct mtd_part_parser redboot_parser = { + .parse_fn = parse_redboot_partitions, + .name = "RedBoot", ++ .of_match_table = redboot_parser_of_match_table, + }; + module_mtd_part_parser(redboot_parser); + diff --git a/target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch new file mode 100644 index 000000000..b8d510151 --- /dev/null +++ b/target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -955,6 +955,7 @@ static const struct flash_info spi_nor_i + { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, + { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, + { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, ++ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, + { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 63afabb1d..6e4dd3b36 100644 --- a/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1171,6 +1171,49 @@ static struct mtd_info * __init open_mtd +@@ -1171,6 +1171,73 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -20,45 +20,69 @@ Signed-off-by: Daniel Golle +{ + int err; + struct mtd_info *mtd; ++ loff_t offset = 0; ++ size_t len; ++ char magic[4]; + + /* try attaching mtd device named "ubi" or "data" */ + mtd = open_mtd_device("ubi"); + if (IS_ERR(mtd)) + mtd = open_mtd_device("data"); + -+ if (!IS_ERR(mtd)) { -+ size_t len; -+ char magic[4]; ++ if (IS_ERR(mtd)) ++ return; + -+ /* check for a valid ubi magic */ -+ err = mtd_read(mtd, 0, 4, &len, (void *) magic); -+ if (!err && len == 4 && strncmp(magic, "UBI#", 4)) { -+ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index); -+ put_mtd_device(mtd); -+ return; -+ } ++ /* get the first not bad block */ ++ if (mtd_can_have_bb(mtd)) ++ while (mtd_block_isbad(mtd, offset)) { ++ offset += mtd->erasesize; + -+ /* auto-add only media types where UBI makes sense */ -+ if (mtd->type == MTD_NANDFLASH || -+ mtd->type == MTD_NORFLASH || -+ mtd->type == MTD_DATAFLASH || -+ mtd->type == MTD_MLCNANDFLASH) { -+ mutex_lock(&ubi_devices_mutex); -+ pr_notice("UBI: auto-attach mtd%d\n", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); -+ put_mtd_device(mtd); ++ if (offset > mtd->size) { ++ pr_err("UBI error: Failed to find a non-bad " ++ "block on mtd%d\n", mtd->index); ++ goto cleanup; + } + } ++ ++ /* check if the read from flash was successful */ ++ err = mtd_read(mtd, offset, 4, &len, (void *) magic); ++ if ((err && !mtd_is_bitflip(err)) || len != 4) { ++ pr_err("UBI error: unable to read from mtd%d\n", mtd->index); ++ goto cleanup; + } ++ ++ /* check for a valid ubi magic */ ++ if (strncmp(magic, "UBI#", 4)) { ++ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index); ++ goto cleanup; ++ } ++ ++ /* don't auto-add media types where UBI doesn't makes sense */ ++ if (mtd->type != MTD_NANDFLASH && ++ mtd->type != MTD_NORFLASH && ++ mtd->type != MTD_DATAFLASH && ++ mtd->type != MTD_MLCNANDFLASH) ++ goto cleanup; ++ ++ mutex_lock(&ubi_devices_mutex); ++ pr_notice("UBI: auto-attach mtd%d\n", mtd->index); ++ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); ++ mutex_unlock(&ubi_devices_mutex); ++ if (err < 0) { ++ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); ++ goto cleanup; ++ } ++ ++ return; ++ ++cleanup: ++ put_mtd_device(mtd); +} + static int __init ubi_init(void) { int err, i, k; -@@ -1254,6 +1297,12 @@ static int __init ubi_init(void) +@@ -1254,6 +1321,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-4.14/630-packet_socket_type.patch b/target/linux/generic/pending-4.14/630-packet_socket_type.patch index 82e2c51af..e1736214f 100644 --- a/target/linux/generic/pending-4.14/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.14/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3260,6 +3262,7 @@ static int packet_create(struct net *net +@@ -3262,6 +3264,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3873,6 +3876,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3875,6 +3878,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3925,6 +3938,13 @@ static int packet_getsockopt(struct sock +@@ -3927,6 +3940,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch index b29b5f11b..2b89a0523 100644 --- a/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch +++ b/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau { struct property *pp = of_find_property(np, name, NULL); -@@ -47,6 +48,73 @@ static const void *of_get_mac_addr(struc +@@ -47,6 +48,79 @@ static const void *of_get_mac_addr(struc return NULL; } @@ -50,6 +50,7 @@ Signed-off-by: Felix Fietkau + u32 mac_inc = 0; + u8 mac[ETH_ALEN]; + void *addr; ++ u32 inc_idx; + + list = of_get_property(np, "mtd-mac-address", &size); + if (!list || (size != (2 * sizeof(*list)))) @@ -73,8 +74,13 @@ Signed-off-by: Felix Fietkau + ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac); + put_mtd_device(mtd); + ++ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx)) ++ inc_idx = 5; ++ if (inc_idx > 5) ++ return NULL; ++ + if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc)) -+ mac[5] += mac_inc; ++ mac[inc_idx] += mac_inc; + + if (!is_valid_ether_addr(mac)) + return NULL; @@ -106,7 +112,7 @@ Signed-off-by: Felix Fietkau /** * Search the device tree for the best MAC address to use. 'mac-address' is * checked first, because that is supposed to contain to "most recent" MAC -@@ -64,11 +132,18 @@ static const void *of_get_mac_addr(struc +@@ -64,11 +138,18 @@ static const void *of_get_mac_addr(struc * addresses. Some older U-Boots only initialized 'local-mac-address'. In * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists * but is all zeros. diff --git a/target/linux/generic/pending-4.14/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-4.14/734-net-phy-at803x-allow-to-configure-via-pdata.patch index a217f750b..27bbf572e 100644 --- a/target/linux/generic/pending-4.14/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ b/target/linux/generic/pending-4.14/734-net-phy-at803x-allow-to-configure-via-pdata.patch @@ -40,7 +40,7 @@ Signed-off-by: Gabor Juhos #define AT803X_DEBUG_ADDR 0x1D #define AT803X_DEBUG_DATA 0x1E -@@ -73,6 +80,7 @@ MODULE_LICENSE("GPL"); +@@ -74,6 +81,7 @@ MODULE_LICENSE("GPL"); struct at803x_priv { bool phy_reset:1; struct gpio_desc *gpiod_reset; @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos }; struct at803x_context { -@@ -273,8 +281,16 @@ does_not_require_reset_workaround: +@@ -274,8 +282,16 @@ does_not_require_reset_workaround: return 0; } @@ -65,7 +65,7 @@ Signed-off-by: Gabor Juhos int ret; ret = genphy_config_init(phydev); -@@ -295,6 +311,26 @@ static int at803x_config_init(struct phy +@@ -296,6 +312,26 @@ static int at803x_config_init(struct phy return ret; } @@ -92,7 +92,7 @@ Signed-off-by: Gabor Juhos return 0; } -@@ -332,6 +368,8 @@ static int at803x_config_intr(struct phy +@@ -333,6 +369,8 @@ static int at803x_config_intr(struct phy static void at803x_link_change_notify(struct phy_device *phydev) { struct at803x_priv *priv = phydev->priv; @@ -101,7 +101,7 @@ Signed-off-by: Gabor Juhos /* * Conduct a hardware reset for AT8030/2 every time a link loss is -@@ -360,6 +398,24 @@ static void at803x_link_change_notify(st +@@ -361,6 +399,24 @@ static void at803x_link_change_notify(st } else { priv->phy_reset = false; } diff --git a/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch index 0bb365a6e..8c5c21b1b 100644 --- a/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ b/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch @@ -21,7 +21,7 @@ Signed-off-by: Roman Yeryomin #define AT803X_PCS_SMART_EEE_CTRL3 0x805D #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -@@ -292,6 +293,27 @@ static int at803x_config_init(struct phy +@@ -293,6 +294,27 @@ static int at803x_config_init(struct phy { struct at803x_platform_data *pdata; int ret; diff --git a/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch new file mode 100644 index 000000000..6bc626dd6 --- /dev/null +++ b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch @@ -0,0 +1,47 @@ +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -354,6 +354,14 @@ static int at803x_config_init(struct phy + AT803X_DEBUG_TX_CLK_DLY_EN, 0); + } + ++#ifdef CONFIG_OF_MDIO ++ if (phydev->mdio.dev.of_node && ++ of_property_read_bool(phydev->mdio.dev.of_node, ++ "at803x-disable-smarteee")) { ++ at803x_disable_smarteee(phydev); ++ } ++#endif ++ + return 0; + } + +@@ -392,6 +400,7 @@ static void at803x_link_change_notify(st + { + struct at803x_priv *priv = phydev->priv; + struct at803x_platform_data *pdata; ++ u8 fixup_rgmii_tx_delay = 0; + pdata = dev_get_platdata(&phydev->mdio.dev); + + /* +@@ -421,8 +430,19 @@ static void at803x_link_change_notify(st + } else { + priv->phy_reset = false; + } +- if (pdata && pdata->fixup_rgmii_tx_delay && +- phydev->speed != priv->prev_speed) { ++ ++ if (pdata && pdata->fixup_rgmii_tx_delay) ++ fixup_rgmii_tx_delay = 1; ++ ++#ifdef CONFIG_OF_MDIO ++ if (phydev->mdio.dev.of_node && ++ of_property_read_bool(phydev->mdio.dev.of_node, ++ "at803x-fixup-rgmii-tx-delay")) { ++ fixup_rgmii_tx_delay = 1; ++ } ++#endif ++ ++ if (fixup_rgmii_tx_delay && phydev->speed != priv->prev_speed) { + switch (phydev->speed) { + case SPEED_10: + case SPEED_100: diff --git a/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch b/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch new file mode 100644 index 000000000..869bf7b9b --- /dev/null +++ b/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch @@ -0,0 +1,76 @@ +From 24d5ba8ad40c3ac7903f688580c345aafa764dc7 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 4 Jun 2018 14:51:29 +0200 +Subject: [PATCH] tty: serial: exar: generalize rs485 setup +To: linux-serial@vger.kernel.org, + Greg Kroah-Hartman +Cc: Linus Walleij , + Jan Kiszka + +Move the non-board-specific part of the RS485 initialization +from iot2040_rs485_config function to a new generic function +used also for other boards. +This allows using PCIe boards which are hard-wired to RS485 +or have jumpers for their configurations. + +Signed-off-by: Daniel Golle +--- + drivers/tty/serial/8250/8250_exar.c | 38 +++++++++++++++++++---------- + 1 file changed, 25 insertions(+), 13 deletions(-) + +--- a/drivers/tty/serial/8250/8250_exar.c ++++ b/drivers/tty/serial/8250/8250_exar.c +@@ -275,8 +275,32 @@ static int xr17v35x_register_gpio(struct + return 0; + } + ++static int generic_rs485_config(struct uart_port *port, ++ struct serial_rs485 *rs485) ++{ ++ bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); ++ u8 __iomem *p = port->membase; ++ u8 value; ++ ++ value = readb(p + UART_EXAR_FCTR); ++ if (is_rs485) ++ value |= UART_FCTR_EXAR_485; ++ else ++ value &= ~UART_FCTR_EXAR_485; ++ ++ writeb(value, p + UART_EXAR_FCTR); ++ ++ if (is_rs485) ++ writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); ++ ++ port->rs485 = *rs485; ++ ++ return 0; ++} ++ + static const struct exar8250_platform exar8250_default_platform = { + .register_gpio = xr17v35x_register_gpio, ++ .rs485_config = generic_rs485_config, + }; + + static int iot2040_rs485_config(struct uart_port *port, +@@ -309,19 +333,7 @@ static int iot2040_rs485_config(struct u + value |= mode; + writeb(value, p + UART_EXAR_MPIOLVL_7_0); + +- value = readb(p + UART_EXAR_FCTR); +- if (is_rs485) +- value |= UART_FCTR_EXAR_485; +- else +- value &= ~UART_FCTR_EXAR_485; +- writeb(value, p + UART_EXAR_FCTR); +- +- if (is_rs485) +- writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); +- +- port->rs485 = *rs485; +- +- return 0; ++ return generic_rs485_config(port, rs485); + } + + static const struct property_entry iot2040_gpio_properties[] = { diff --git a/target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch b/target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch new file mode 100644 index 000000000..4da571a60 --- /dev/null +++ b/target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch @@ -0,0 +1,39 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Subject: [PATCH] mtd: redboot: add of_match_table with DT binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows parsing RedBoot compatible partitions for properly described +flash device in DT. + +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + struct fis_image_desc { + unsigned char name[16]; // Null terminated name +@@ -289,9 +290,16 @@ static int parse_redboot_partitions(stru + return ret; + } + ++static const struct of_device_id redboot_parser_of_match_table[] = { ++ { .compatible = "ecoscentric,redboot-fis-partitions" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, redboot_parser_of_match_table); ++ + static struct mtd_part_parser redboot_parser = { + .parse_fn = parse_redboot_partitions, + .name = "RedBoot", ++ .of_match_table = redboot_parser_of_match_table, + }; + module_mtd_part_parser(redboot_parser); + diff --git a/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch b/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch index 85fbe0512..6a612a0e7 100644 --- a/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch +++ b/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/mtd/redboot.c +++ b/drivers/mtd/redboot.c -@@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru +@@ -266,14 +266,21 @@ static int parse_redboot_partitions(stru #endif names += strlen(names)+1; diff --git a/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch new file mode 100644 index 000000000..b8d510151 --- /dev/null +++ b/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -955,6 +955,7 @@ static const struct flash_info spi_nor_i + { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, + { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, + { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, ++ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, + { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 8b37dba03..168cfe50e 100644 --- a/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1226,6 +1226,49 @@ static struct mtd_info * __init open_mtd +@@ -1226,6 +1226,73 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -20,45 +20,69 @@ Signed-off-by: Daniel Golle +{ + int err; + struct mtd_info *mtd; ++ loff_t offset = 0; ++ size_t len; ++ char magic[4]; + + /* try attaching mtd device named "ubi" or "data" */ + mtd = open_mtd_device("ubi"); + if (IS_ERR(mtd)) + mtd = open_mtd_device("data"); + -+ if (!IS_ERR(mtd)) { -+ size_t len; -+ char magic[4]; ++ if (IS_ERR(mtd)) ++ return; + -+ /* check for a valid ubi magic */ -+ err = mtd_read(mtd, 0, 4, &len, (void *) magic); -+ if (!err && len == 4 && strncmp(magic, "UBI#", 4)) { -+ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index); -+ put_mtd_device(mtd); -+ return; -+ } ++ /* get the first not bad block */ ++ if (mtd_can_have_bb(mtd)) ++ while (mtd_block_isbad(mtd, offset)) { ++ offset += mtd->erasesize; + -+ /* auto-add only media types where UBI makes sense */ -+ if (mtd->type == MTD_NANDFLASH || -+ mtd->type == MTD_NORFLASH || -+ mtd->type == MTD_DATAFLASH || -+ mtd->type == MTD_MLCNANDFLASH) { -+ mutex_lock(&ubi_devices_mutex); -+ pr_notice("UBI: auto-attach mtd%d\n", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); -+ put_mtd_device(mtd); ++ if (offset > mtd->size) { ++ pr_err("UBI error: Failed to find a non-bad " ++ "block on mtd%d\n", mtd->index); ++ goto cleanup; + } + } ++ ++ /* check if the read from flash was successful */ ++ err = mtd_read(mtd, offset, 4, &len, (void *) magic); ++ if ((err && !mtd_is_bitflip(err)) || len != 4) { ++ pr_err("UBI error: unable to read from mtd%d\n", mtd->index); ++ goto cleanup; + } ++ ++ /* check for a valid ubi magic */ ++ if (strncmp(magic, "UBI#", 4)) { ++ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index); ++ goto cleanup; ++ } ++ ++ /* don't auto-add media types where UBI doesn't makes sense */ ++ if (mtd->type != MTD_NANDFLASH && ++ mtd->type != MTD_NORFLASH && ++ mtd->type != MTD_DATAFLASH && ++ mtd->type != MTD_MLCNANDFLASH) ++ goto cleanup; ++ ++ mutex_lock(&ubi_devices_mutex); ++ pr_notice("UBI: auto-attach mtd%d\n", mtd->index); ++ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); ++ mutex_unlock(&ubi_devices_mutex); ++ if (err < 0) { ++ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); ++ goto cleanup; ++ } ++ ++ return; ++ ++cleanup: ++ put_mtd_device(mtd); +} + static int __init ubi_init(void) { int err, i, k; -@@ -1309,6 +1352,12 @@ static int __init ubi_init(void) +@@ -1309,6 +1376,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-4.9/630-packet_socket_type.patch b/target/linux/generic/pending-4.9/630-packet_socket_type.patch index 08d730ac3..0bf9339d1 100644 --- a/target/linux/generic/pending-4.9/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.9/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3260,6 +3262,7 @@ static int packet_create(struct net *net +@@ -3262,6 +3264,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3873,6 +3876,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3875,6 +3878,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3925,6 +3938,13 @@ static int packet_getsockopt(struct sock +@@ -3927,6 +3940,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/imx6/Makefile b/target/linux/imx6/Makefile index 152a58e8b..73512ca98 100644 --- a/target/linux/imx6/Makefile +++ b/target/linux/imx6/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=imx6 BOARDNAME:=Freescale i.MX 6 -FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs +FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs boot-part rootfs-part CPU_TYPE:=cortex-a9 CPU_SUBTYPE:=neon MAINTAINER:=Luka Perkov @@ -20,6 +20,6 @@ include $(INCLUDE_DIR)/target.mk KERNELNAME:=zImage dtbs -DEFAULT_PACKAGES += uboot-envtools +DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs $(eval $(call BuildTarget)) diff --git a/target/linux/imx6/base-files/etc/board.d/02_network b/target/linux/imx6/base-files/etc/board.d/02_network index 3f269dfae..6ec667346 100755 --- a/target/linux/imx6/base-files/etc/board.d/02_network +++ b/target/linux/imx6/base-files/etc/board.d/02_network @@ -10,6 +10,7 @@ board=$(board_name) board_config_update case "$board" in +cubox-i |\ *gw51xx |\ *gw52xx |\ *gw5904) diff --git a/target/linux/imx6/base-files/lib/imx6.sh b/target/linux/imx6/base-files/lib/imx6.sh index e211f54e5..1bf143952 100755 --- a/target/linux/imx6/base-files/lib/imx6.sh +++ b/target/linux/imx6/base-files/lib/imx6.sh @@ -54,6 +54,11 @@ imx6_board_detect() { name="gw5904" ;; + "SolidRun Cubox-i Solo/DualLite" |\ + "SolidRun Cubox-i Dual/Quad") + name="cubox-i" + ;; + "Wandboard i.MX6 Dual Lite Board") name="wandboard" ;; diff --git a/target/linux/imx6/config-4.14 b/target/linux/imx6/config-4.14 index ea72d18f9..4a3935ef2 100644 --- a/target/linux/imx6/config-4.14 +++ b/target/linux/imx6/config-4.14 @@ -55,6 +55,7 @@ CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_ATA=y CONFIG_ATAGS=y CONFIG_AUTO_ZRELADDR=y +CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_SCSI_REQUEST=y CONFIG_CACHE_L2X0=y @@ -108,6 +109,7 @@ CONFIG_CRYPTO_AKCIPHER2=y CONFIG_CRYPTO_AUTHENC=y CONFIG_CRYPTO_CBC=y # CONFIG_CRYPTO_CHACHA20_NEON is not set +CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y # CONFIG_CRYPTO_CRC32_ARM_CE is not set CONFIG_CRYPTO_CRYPTD=y @@ -178,6 +180,11 @@ CONFIG_EXT4_FS_ENCRYPTION=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXTCON=y +# CONFIG_F2FS_CHECK_FS is not set +CONFIG_F2FS_FS=y +# CONFIG_F2FS_FS_SECURITY is not set +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_STAT_FS=y CONFIG_FEC=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y diff --git a/target/linux/imx6/image/Makefile b/target/linux/imx6/image/Makefile index cef08f227..f13412f1e 100644 --- a/target/linux/imx6/image/Makefile +++ b/target/linux/imx6/image/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/image.mk # Images ################################################# -DEVICE_VARS += MKUBIFS_OPTS +DEVICE_VARS += MKUBIFS_OPTS UBOOT BOOT_SCRIPT define Build/boot-overlay rm -rf $@.boot @@ -51,6 +51,45 @@ define Build/bootfs.tar.gz -czvf $@ . endef +define Build/boot-scr + mkimage -A arm -O linux -T script -C none -a 0 -e 0 \ + -n '$(DEVICE_ID) OpenWrt bootscript' \ + -d ./bootscript-$(DEVICE_NAME) \ + $(BIN_DIR)/boot.scr +endef + +define Build/imx6-sdcard + rm -rf $@.boot + mkdir -p $@.boot + + $(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img $@.boot/u-boot.img + $(CP) $(IMAGE_KERNEL) $@.boot/uImage + + $(foreach dts,$(DEVICE_DTS), \ + $(CP) \ + $(DTS_DIR)/$(dts).dtb \ + $@.boot/; + ) + + mkimage -A arm -O linux -T script -C none -a 0 -e 0 \ + -n '$(DEVICE_ID) OpenWrt bootscript' \ + -d $(BOOT_SCRIPT) \ + $@.boot/boot.scr + + cp $@ $@.fs + + $(SCRIPT_DIR)/gen_image_generic.sh $@ \ + $(CONFIG_TARGET_KERNEL_PARTSIZE) \ + $@.boot \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) \ + $@.fs \ + 1024 + + dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc + + rm -rf $@.boot $@.fs +endef + ################################################# # Devices ################################################# @@ -65,7 +104,6 @@ define Device/Default KERNEL_NAME := zImage KERNEL_PREFIX := $$(IMAGE_PREFIX) KERNEL := kernel-bin | uImage none - IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2) IMAGES := endef @@ -96,6 +134,7 @@ define Device/ventana kobs-ng KERNEL += | boot-overlay IMAGES := nand.ubi bootfs.tar.gz + IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2) UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15 IMAGE/nand.ubi := append-ubi IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb @@ -123,4 +162,18 @@ define Device/wandboard endef TARGET_DEVICES += wandboard +define Device/cubox-i + KERNEL := kernel-bin | install-dtb + UBOOT := mx6cuboxi + BOOT_SCRIPT = bootscript-cubox + DEVICE_NAME := cubox + DEVICE_TITLE := SolidRun CuBox-i + DEVICE_PACKAGES := kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid + DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i imx6q-hummingboard imx6dl-hummingboard + IMAGES := combined.bin + FILESYSTEMS := squashfs + IMAGE/combined.bin := append-rootfs | pad-extra 128k | imx6-sdcard +endef +TARGET_DEVICES += cubox-i + $(eval $(call BuildImage)) diff --git a/target/linux/imx6/image/bootscript-cubox b/target/linux/imx6/image/bootscript-cubox new file mode 100644 index 000000000..2ed48ab94 --- /dev/null +++ b/target/linux/imx6/image/bootscript-cubox @@ -0,0 +1,31 @@ +echo "CuBox OpenWrt Boot script" + +# Set console variable for both UART and HDMI +setenv console console=ttymxc0,115200 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 + +# Find correct dtb +if test ${board_rev} = MX6DL; then + setenv fdt_soc_type imx6dl; +elif test ${board_rev} = MX6Q; then + setenv fdt_soc_type imx6q; +fi +if test ${board_name} = CUBOXI; then + setenv fdt_name ${fdt_soc_type}-cubox-i.dtb; +elif test ${board_name} = HUMMINGBOARD; then + setenv fdt_name ${fdt_soc_type}-hummingboard.dtb; +fi + +# Set correct devtype and partition +if test ${devtype} != mmc; then setenv devtype mmc; fi +if mmc dev 0; then + setenv mmcdev 0 +elif mmc dev 1; then + setenv mmcdev 1 +fi + +# Boot from the SD card is supported at the moment +setenv bootargs "${console} root=/dev/mmcblk1p2 rw rootwait" +mmc dev ${mmcdev} +load ${devtype} ${mmcdev}:${devplist} ${kernel_addr_r} /uImage +load ${devtype} ${mmcdev}:${devplist} ${fdt_addr_r} /${fdt_name} +bootz ${kernel_addr_r} - ${fdt_addr_r} diff --git a/target/linux/imx6/profiles/100-generic.mk b/target/linux/imx6/profiles/100-default.mk similarity index 67% rename from target/linux/imx6/profiles/100-generic.mk rename to target/linux/imx6/profiles/100-default.mk index 218cd6940..60b3ef538 100644 --- a/target/linux/imx6/profiles/100-generic.mk +++ b/target/linux/imx6/profiles/100-default.mk @@ -5,13 +5,13 @@ # See /LICENSE for more information. # -define Profile/Generic +define Profile/Default PRIORITY:=1 - NAME:=Generic (default) + NAME:=Default Profile endef -define Profile/Generic/Description +define Profile/Default/Description Package set compatible with most Freescale i.MX 6 based boards. endef -$(eval $(call Profile,Generic)) +$(eval $(call Profile,Default)) diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds index fea4d7c8b..769afb8b8 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds @@ -43,8 +43,6 @@ tplink,vr2600v) ucidef_set_led_switch "wan" "wan" "${boardname}:white:wan" "switch0" "0x20" ;; zyxel,nbg6817) - ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:amber:wifi2g" "phy1tpt" - ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:amber:wifi5g" "phy0tpt" ucidef_set_led_netdev "wan" "WAN" "${boardname}:white:internet" "eth1" ;; *) diff --git a/target/linux/ipq806x/base-files/etc/diag.sh b/target/linux/ipq806x/base-files/etc/diag.sh index df4afd936..9e6b4918e 100755 --- a/target/linux/ipq806x/base-files/etc/diag.sh +++ b/target/linux/ipq806x/base-files/etc/diag.sh @@ -29,9 +29,11 @@ set_state() { ;; upgrade) [ -n "$running" ] && { - status_led="$upgrade" - status_led_blink_preinit_regular + status_led="$running" + status_led_off } + status_led="$upgrade" + status_led_blink_preinit_regular ;; done) status_led_off diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index b41bea1c2..6e282f99f 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -46,9 +46,3 @@ platform_nand_pre_upgrade() { ;; esac } - -blink_led() { - . /etc/diag.sh; set_state upgrade -} - -append sysupgrade_pre_upgrade blink_led diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts index a3df82909..3eaa90db2 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts @@ -199,7 +199,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -213,7 +212,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts index b683f0275..c32115934 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts @@ -362,7 +362,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -376,7 +375,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts index 209d513f1..7c829babb 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts @@ -283,7 +283,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -297,7 +296,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts index 4c5686607..562659fef 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts @@ -169,7 +169,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -183,17 +182,14 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; phy6: ethernet-phy@6 { - device_type = "ethernet-phy"; reg = <6>; }; phy7: ethernet-phy@7 { - device_type = "ethernet-phy"; reg = <7>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts index 1e82a48db..642c1d91b 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts @@ -309,7 +309,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -323,7 +322,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; @@ -412,4 +410,3 @@ /delete-node/ &pcie2_pins; /delete-node/ &pcie2; - diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts index 9ce572bd8..1c7cf792c 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts @@ -248,7 +248,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -262,7 +261,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts index 30bf0abd4..aafe258c8 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts @@ -284,7 +284,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -298,7 +297,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts index 087752733..e8f74c35d 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts @@ -275,7 +275,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -289,7 +288,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts index b643014b4..a6606a0f1 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts @@ -295,7 +295,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -309,7 +308,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts index 9440de5b8..34377e350 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts @@ -57,7 +57,7 @@ }; soc { - rpm@108000 { + rpm@108000 { pinctrl-0 = <&rpm_pins>; pinctrl-names = "default"; }; @@ -229,7 +229,6 @@ gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -243,7 +242,6 @@ }; ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; }; }; @@ -445,7 +443,7 @@ led_pins: led_pins { mux { - pins = "gpio7", "gpio8", "gpio9", "gpio22", + pins = "gpio7", "gpio8", "gpio9", "gpio22", "gpio23", "gpio24", "gpio25", "gpio53"; function = "gpio"; drive-strength = <2>; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts index 0b96ba64c..35ee40c0a 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts @@ -243,7 +243,6 @@ pinctrl-names = "default"; phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -271,7 +270,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; qca,ar8327-initvals = < 0x000e4 0x6a545 /* MAC_POWER_SEL */ diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts index 29b14df4d..5b741598e 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts @@ -341,7 +341,6 @@ phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; reg = <0>; qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ @@ -373,7 +372,6 @@ }; phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; reg = <4>; qca,ar8327-initvals = < 0x000e4 0x6a545 /* MAC_POWER_SEL */ diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 2902af323..a7f740ff6 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -67,7 +67,8 @@ define Device/ZyXELImage KERNEL_SUFFIX := -uImage KERNEL = kernel-bin | append-dtb | uImage none | pad-to $${KERNEL_SIZE} KERNEL_NAME := zImage - IMAGES := sysupgrade.bin mmcblk0p5-rootfs.bin mmcblk0p4-kernel.bin + IMAGES := factory.bin sysupgrade.bin mmcblk0p5-rootfs.bin mmcblk0p4-kernel.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | zyxel-ras-image separate-kernel IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to $$$${BLOCKSIZE} | sysupgrade-tar rootfs=$$$$@ | append-metadata IMAGE/mmcblk0p5-rootfs.bin := append-rootfs | pad-rootfs | pad-to $$$${BLOCKSIZE} IMAGE/mmcblk0p4-kernel.bin := append-kernel @@ -245,6 +246,9 @@ define Device/zyxel_nbg6817 KERNEL_SIZE := 4096k BLOCKSIZE := 64k BOARD_NAME := nbg6817 + RAS_BOARD := NBG6817 + RAS_ROOTFS_SIZE := 20934k + RAS_VERSION := "V1.99(OWRT.9999)C0" SUPPORTED_DEVICES += nbg6817 DEVICE_TITLE := ZyXEL NBG6817 DEVICE_PACKAGES := ath10k-firmware-qca9984 e2fsprogs kmod-fs-ext4 losetup diff --git a/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch b/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch deleted file mode 100644 index 026816d2e..000000000 --- a/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch +++ /dev/null @@ -1,166 +0,0 @@ -From a37b0c9113647b2120cf1a18cfc46afdb3f1fccc Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 12 Aug 2014 20:49:27 +0200 -Subject: [PATCH 66/69] GPIO: add named gpio exports - -Signed-off-by: John Crispin ---- - drivers/gpio/gpiolib-of.c | 68 +++++++++++++++++++++++++++++++++++++++++++ - drivers/gpio/gpiolib-sysfs.c | 10 ++++++- - include/asm-generic/gpio.h | 6 ++++ - include/linux/gpio/consumer.h | 8 +++++ - 4 files changed, 91 insertions(+), 1 deletion(-) - ---- a/drivers/gpio/gpiolib-of.c -+++ b/drivers/gpio/gpiolib-of.c -@@ -23,6 +23,8 @@ - #include - #include - #include -+#include -+#include - - #include "gpiolib.h" - -@@ -506,3 +508,69 @@ void of_gpiochip_remove(struct gpio_chip - gpiochip_remove_pin_ranges(chip); - of_node_put(chip->of_node); - } -+ -+static struct of_device_id gpio_export_ids[] = { -+ { .compatible = "gpio-export" }, -+ { /* sentinel */ } -+}; -+ -+static int __init of_gpio_export_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ struct device_node *cnp; -+ u32 val; -+ int nb = 0; -+ -+ for_each_child_of_node(np, cnp) { -+ const char *name = NULL; -+ int gpio; -+ bool dmc; -+ int max_gpio = 1; -+ int i; -+ -+ of_property_read_string(cnp, "gpio-export,name", &name); -+ -+ if (!name) -+ max_gpio = of_gpio_count(cnp); -+ -+ for (i = 0; i < max_gpio; i++) { -+ unsigned flags = 0; -+ enum of_gpio_flags of_flags; -+ -+ gpio = of_get_gpio_flags(cnp, i, &of_flags); -+ -+ if (of_flags == OF_GPIO_ACTIVE_LOW) -+ flags |= GPIOF_ACTIVE_LOW; -+ -+ if (!of_property_read_u32(cnp, "gpio-export,output", &val)) -+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; -+ else -+ flags |= GPIOF_IN; -+ -+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np))) -+ continue; -+ -+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); -+ gpio_export_with_name(gpio, dmc, name); -+ nb++; -+ } -+ } -+ -+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb); -+ -+ return 0; -+} -+ -+static struct platform_driver gpio_export_driver = { -+ .driver = { -+ .name = "gpio-export", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(gpio_export_ids), -+ }, -+}; -+ -+static int __init of_gpio_export_init(void) -+{ -+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe); -+} -+device_initcall(of_gpio_export_init); ---- a/drivers/gpio/gpiolib-sysfs.c -+++ b/drivers/gpio/gpiolib-sysfs.c -@@ -553,7 +553,7 @@ static struct class gpio_class = { - * - * Returns zero on success, else an error. - */ --int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) - { - struct gpio_chip *chip; - struct gpio_device *gdev; -@@ -615,6 +615,8 @@ int gpiod_export(struct gpio_desc *desc, - offset = gpio_chip_hwgpio(desc); - if (chip->names && chip->names[offset]) - ioname = chip->names[offset]; -+ if (name) -+ ioname = name; - - dev = device_create_with_groups(&gpio_class, &gdev->dev, - MKDEV(0, 0), data, gpio_groups, -@@ -636,6 +638,12 @@ err_unlock: - gpiod_dbg(desc, "%s: status %d\n", __func__, status); - return status; - } -+EXPORT_SYMBOL_GPL(__gpiod_export); -+ -+int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+{ -+ return __gpiod_export(desc, direction_may_change, NULL); -+} - EXPORT_SYMBOL_GPL(gpiod_export); - - static int match_export(struct device *dev, const void *desc) ---- a/include/asm-generic/gpio.h -+++ b/include/asm-generic/gpio.h -@@ -127,6 +127,12 @@ static inline int gpio_export(unsigned g - return gpiod_export(gpio_to_desc(gpio), direction_may_change); - } - -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); -+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name) -+{ -+ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name); -+} -+ - static inline int gpio_export_link(struct device *dev, const char *name, - unsigned gpio) - { ---- a/include/linux/gpio/consumer.h -+++ b/include/linux/gpio/consumer.h -@@ -451,6 +451,7 @@ struct gpio_desc *devm_fwnode_get_gpiod_ - - #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) - -+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); - int gpiod_export(struct gpio_desc *desc, bool direction_may_change); - int gpiod_export_link(struct device *dev, const char *name, - struct gpio_desc *desc); -@@ -458,6 +459,13 @@ void gpiod_unexport(struct gpio_desc *de - - #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ - -+static inline int _gpiod_export(struct gpio_desc *desc, -+ bool direction_may_change, -+ const char *name) -+{ -+ return -ENOSYS; -+} -+ - static inline int gpiod_export(struct gpio_desc *desc, - bool direction_may_change) - { diff --git a/target/linux/ipq806x/patches-4.14/0074-ipq806x-usb-Control-USB-master-reset.patch b/target/linux/ipq806x/patches-4.14/0074-ipq806x-usb-Control-USB-master-reset.patch index 24cfd1802..ee410ca6f 100644 --- a/target/linux/ipq806x/patches-4.14/0074-ipq806x-usb-Control-USB-master-reset.patch +++ b/target/linux/ipq806x/patches-4.14/0074-ipq806x-usb-Control-USB-master-reset.patch @@ -68,4 +68,4 @@ Signed-off-by: Vasudevan Murugesan + of_platform_depopulate(dev); - pm_runtime_put_sync(dev); + pm_runtime_disable(dev); diff --git a/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch b/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch index 24a7fda22..6ecda6c35 100644 --- a/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch +++ b/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch @@ -11,7 +11,7 @@ the ubi volume created by the other. --- --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1023,7 +1023,7 @@ static const struct flash_info spi_nor_i +@@ -1024,7 +1024,7 @@ static const struct flash_info spi_nor_i { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, diff --git a/target/linux/ixp4xx/patches-4.9/116-sidewinder_fis_location.patch b/target/linux/ixp4xx/patches-4.9/116-sidewinder_fis_location.patch index 7d633f713..8a28eb0a7 100644 --- a/target/linux/ixp4xx/patches-4.9/116-sidewinder_fis_location.patch +++ b/target/linux/ixp4xx/patches-4.9/116-sidewinder_fis_location.patch @@ -1,15 +1,15 @@ --- a/drivers/mtd/redboot.c +++ b/drivers/mtd/redboot.c -@@ -30,6 +30,8 @@ - #include +@@ -31,6 +31,8 @@ #include + #include +#include + struct fis_image_desc { unsigned char name[16]; // Null terminated name uint32_t flash_base; // Address within FLASH of image -@@ -47,7 +49,8 @@ struct fis_list { +@@ -48,7 +50,8 @@ struct fis_list { struct fis_list *next; }; @@ -19,7 +19,7 @@ module_param(directory, int, 0); static inline int redboot_checksum(struct fis_image_desc *img) -@@ -75,6 +78,8 @@ static int parse_redboot_partitions(stru +@@ -76,6 +79,8 @@ static int parse_redboot_partitions(stru #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED static char nullstring[] = "unallocated"; #endif diff --git a/target/linux/kirkwood/base-files/etc/board.d/01_leds b/target/linux/kirkwood/base-files/etc/board.d/01_leds index 4e72e344a..5cfc4cf30 100755 --- a/target/linux/kirkwood/base-files/etc/board.d/01_leds +++ b/target/linux/kirkwood/base-files/etc/board.d/01_leds @@ -14,6 +14,9 @@ case "$board" in ucidef_set_led_default "health" "health" "pogo_e02:green:health" "1" ucidef_set_led_default "fault" "fault" "pogo_e02:orange:fault" "1" ;; +"iom,ix2-200") + ucidef_set_led_timer "health" "health" "status:white:rebuild_led" "200" "800" + ;; "linksys,audi") ucidef_set_led_default "power" "power" "audi:green:power" "1" ;; diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index 5d66e0ffe..15e51d88f 100755 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -17,6 +17,7 @@ case "$board" in "cloudengines,pogoe02"|\ "cloudengines,pogoplugv4"|\ "iom,iconnect-1.1"|\ +"iom,ix2-200"|\ "raidsonic,ib-nas62x0"|\ "seagate,dockstar"|\ "seagate,goflexhome"|\ diff --git a/target/linux/kirkwood/base-files/etc/diag.sh b/target/linux/kirkwood/base-files/etc/diag.sh index 0667ad29f..fc61846c1 100755 --- a/target/linux/kirkwood/base-files/etc/diag.sh +++ b/target/linux/kirkwood/base-files/etc/diag.sh @@ -15,6 +15,9 @@ get_status_led() { cloudengines,pogoplugv4) status_led="pogoplugv4:green:health" ;; + iom,ix2-200) + status_led="status:white:power_led" + ;; linksys,audi) status_led="audi:green:power" ;; diff --git a/target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol b/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol similarity index 62% rename from target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol rename to target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol index 10eb5aa73..0adc5d072 100755 --- a/target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol +++ b/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol @@ -4,17 +4,20 @@ START=98 boot() { . /lib/functions.sh -#configuring lm85 onboard temp/fan controller to run the fan on its own +#configuring (lm85/lm63) onboard temp/fan controller to run the fan on its own #for more information, please read https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface -path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0' - case $(board_name) in - zyxel,nsa310b) +zyxel,nsa310b) + path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0' echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1 echo 1 > "$path_to_hwmon/pwm1_auto_channels" # temp1 is the only one that changes echo 23000 > "$path_to_hwmon/temp1_auto_temp_min" echo 43000 > "$path_to_hwmon/temp1_auto_temp_max" # next step is 49600 millicelsius, or 50 celsius, 43 celsius is better - ;; + ;; +iom,ix2-200) + path_to_hwmon='/sys/class/hwmon/hwmon0' + echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1 + ;; esac } diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index fdf86099b..84e749f49 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -62,6 +62,22 @@ define Device/iom_iconnect-1.1 endef TARGET_DEVICES += iom_iconnect-1.1 +define Device/iom_ix2_200 + DEVICE_TITLE := Iomega StorCenter ix2-200 + DEVICE_DTS := kirkwood-iomega_ix2_200 + DEVICE_PACKAGES += kmod-gpio-button-hotplug kmod-i2c-mv64xxx kmod-hwmon-lm63 + DEVICE_TYPE:=nas + PAGESIZE := 512 + SUBPAGESIZE := 256 + BLOCKSIZE := 16KiB + KERNEL_SIZE := 3072k + KERNEL_IN_UBI := 0 + UBINIZE_OPTS := -E 5 + IMAGE_SIZE := 32505856 + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += iom_ix2_200 + define Device/linksys_audi DEVICE_TITLE := Linksys EA3500 (Audi) DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-mini kmod-gpio-button-hotplug diff --git a/target/linux/kirkwood/patches-4.14/103-iomega-ix2-200.patch b/target/linux/kirkwood/patches-4.14/103-iomega-ix2-200.patch new file mode 100644 index 000000000..9036ead95 --- /dev/null +++ b/target/linux/kirkwood/patches-4.14/103-iomega-ix2-200.patch @@ -0,0 +1,33 @@ +--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts ++++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts +@@ -186,18 +186,18 @@ + }; + + partition@a0000 { +- label = "env"; ++ label = "u-boot environment"; + reg = <0xa0000 0x20000>; + read-only; + }; + + partition@100000 { +- label = "uImage"; ++ label = "kernel"; + reg = <0x100000 0x300000>; + }; + + partition@400000 { +- label = "rootfs"; ++ label = "ubi"; + reg = <0x400000 0x1C00000>; + }; + }; +@@ -211,7 +211,7 @@ + }; + + ð0 { +- status = "okay"; ++ status = "disabled"; + ethernet0-port@0 { + speed = <1000>; + duplex = <1>; diff --git a/target/linux/kirkwood/patches-4.9/103-iomega-ix2-200.patch b/target/linux/kirkwood/patches-4.9/103-iomega-ix2-200.patch new file mode 100644 index 000000000..f3c06cd5f --- /dev/null +++ b/target/linux/kirkwood/patches-4.9/103-iomega-ix2-200.patch @@ -0,0 +1,33 @@ +--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts ++++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts +@@ -185,18 +185,18 @@ + }; + + partition@a0000 { +- label = "env"; ++ label = "u-boot environment"; + reg = <0xa0000 0x20000>; + read-only; + }; + + partition@100000 { +- label = "uImage"; ++ label = "kernel"; + reg = <0x100000 0x300000>; + }; + + partition@400000 { +- label = "rootfs"; ++ label = "ubi"; + reg = <0x400000 0x1C00000>; + }; + }; +@@ -210,7 +210,7 @@ + }; + + ð0 { +- status = "okay"; ++ status = "disabled"; + ethernet0-port@0 { + speed = <1000>; + duplex = <1>; diff --git a/target/linux/lantiq/Makefile b/target/linux/lantiq/Makefile index 4ae3a9ab0..2180b8394 100644 --- a/target/linux/lantiq/Makefile +++ b/target/linux/lantiq/Makefile @@ -12,7 +12,7 @@ FEATURES:=squashfs SUBTARGETS:=xrx200 xway xway_legacy falcon ase MAINTAINER:=John Crispin -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 define Target/Description Build firmware images for Lantiq SoC diff --git a/target/linux/lantiq/ase/config-4.9 b/target/linux/lantiq/ase/config-4.9 deleted file mode 100644 index 0dfd21436..000000000 --- a/target/linux/lantiq/ase/config-4.9 +++ /dev/null @@ -1,24 +0,0 @@ -CONFIG_ADM6996_PHY=y -CONFIG_CPU_MIPS32_R1=y -# CONFIG_CPU_MIPS32_R2 is not set -CONFIG_CPU_MIPSR1=y -CONFIG_CRC16=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_FIRMWARE_MEMMAP=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -# CONFIG_ISDN is not set -# CONFIG_LBDAF is not set -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_NLS=y -# CONFIG_PSB6970_PHY is not set -# CONFIG_RTL8366_SMI is not set -CONFIG_SOC_AMAZON_SE=y -# CONFIG_SOC_XWAY is not set -CONFIG_USB=y -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_SUPPORT=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/lantiq/base-files/etc/board.d/01_leds b/target/linux/lantiq/base-files/etc/board.d/01_leds index 0426fb18e..4476a7eb4 100755 --- a/target/linux/lantiq/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/base-files/etc/board.d/01_leds @@ -53,6 +53,10 @@ bt,homehub-v5a) netgear,dm200) ucidef_set_led_netdev "lan" "lan" "dm200:green:lan" "eth0" ;; +avm,fritz3370-rev2-hynix|\ +avm,fritz3370-rev2-micron) + ucidef_set_led_switch "lan" "LAN" "fritz3370:green:lan" "switch0" "0x17" + ;; avm,fritz7320) ucidef_set_led_netdev "wifi" "wifi" "fritz7320:green:wlan" "wlan0" ;; diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/base-files/etc/board.d/02_network index 31eec377e..7817bdd00 100755 --- a/target/linux/lantiq/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/base-files/etc/board.d/02_network @@ -135,12 +135,16 @@ lantiq,easy80920-nand|lantiq,easy80920-nor) "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" ;; -avm,fritz3370) +avm,fritz3370-rev2-hynix|\ +avm,fritz3370-rev2-micron) annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2439)" 1) - ucidef_set_interface_lan 'eth0' + lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) + wan_mac=$(macaddr_add "$lan_mac" 3) + ucidef_add_switch "switch0" \ + "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" ;; +avm,fritz7312|\ avm,fritz7320) annex="b" wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1) diff --git a/target/linux/lantiq/base-files/etc/diag.sh b/target/linux/lantiq/base-files/etc/diag.sh index 4fb47bd27..06cf7e271 100644 --- a/target/linux/lantiq/base-files/etc/diag.sh +++ b/target/linux/lantiq/base-files/etc/diag.sh @@ -6,6 +6,7 @@ boot="$(get_dt_led boot)" failsafe="$(get_dt_led failsafe)" running="$(get_dt_led running)" +upgrade="$(get_dt_led upgrade)" set_state() { status_led="$boot" @@ -26,6 +27,14 @@ set_state() { preinit_regular) status_led_blink_preinit_regular ;; + upgrade) + [ -n "$running" ] && { + status_led="$running" + status_led_off + } + status_led="$upgrade" + status_led_blink_preinit_regular + ;; done) status_led_off [ -n "$running" ] && { diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index 498a50901..40642e580 100644 --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -47,6 +47,24 @@ ath9k_eeprom_extract_raw() { ath9k_eeprom_die "failed to extract from $mtd" } +ath9k_eeprom_extract_reverse() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + local reversed + local caldata + + mtd=$(find_mtd_chardev "$part") + reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd) + + for byte in $reversed; do + caldata="\x${byte}${caldata}" + done + + printf "%b" "$caldata" > /lib/firmware/$FIRMWARE +} + ath9k_eeprom_extract() { local part=$1 local offset=$2 @@ -138,7 +156,11 @@ case "$FIRMWARE" in ath9k_eeprom_extract "calibration" 61440 0 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524 ;; - avm,fritz3370|avm,fritz7320|avm,fritz7360sl) + avm,fritz3370-rev2-hynix|\ + avm,fritz3370-rev2-micron) + ath9k_eeprom_extract_reverse "urlader" 5441 1088 + ;; + avm,fritz7312|avm,fritz7320|avm,fritz7360sl) ath9k_eeprom_extract "urlader" 2437 0 ;; tplink,tdw8970|tplink,tdw8980) diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/base-files/lib/upgrade/platform.sh index 2e58cb799..ecbb939e3 100755 --- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh +++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh @@ -9,7 +9,13 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in - bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3) + avm,fritz3370-rev2-hynix|\ + avm,fritz3370-rev2-micron|\ + bt,homehub-v2b|\ + bt,homehub-v3a|\ + bt,homehub-v5a|\ + zyxel,p-2812hnu-f1|\ + zyxel,p-2812hnu-f3) nand_do_upgrade $1 ;; *) diff --git a/target/linux/lantiq/config-4.14 b/target/linux/lantiq/config-4.14 index 12264413d..aec0efa40 100644 --- a/target/linux/lantiq/config-4.14 +++ b/target/linux/lantiq/config-4.14 @@ -20,8 +20,6 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y diff --git a/target/linux/lantiq/config-4.9 b/target/linux/lantiq/config-4.9 deleted file mode 100644 index a98509e5d..000000000 --- a/target/linux/lantiq/config-4.9 +++ /dev/null @@ -1,199 +0,0 @@ -CONFIG_ARCH_BINFMT_ELF_STATE=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -# CONFIG_ARCH_HAS_SG_CHAIN is not set -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_CEVT_R4K=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_RIXI=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_MIPS32=y -# CONFIG_CPU_MIPS32_R1 is not set -CONFIG_CPU_MIPS32_R2=y -CONFIG_CPU_MIPSR2=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_R4K_FPU=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CPU_SUPPORTS_MSA=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_DTC=y -# CONFIG_DT_EASY50712 is not set -CONFIG_EARLY_PRINTK=y -CONFIG_ETHERNET_PACKET_MANGLE=y -CONFIG_FIXED_PHY=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_MM_LANTIQ=y -CONFIG_GPIO_STP_XWAY=y -CONFIG_GPIO_SYSFS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -# CONFIG_HAVE_ARCH_BITREVERSE is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_CBPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_LANTIQ=y -CONFIG_LANTIQ_DT_NONE=y -CONFIG_LANTIQ_ETOP=y -CONFIG_LANTIQ_WDT=y -# CONFIG_LANTIQ_XRX200 is not set -CONFIG_LEDS_GPIO=y -CONFIG_LIBFDT=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MIPS=y -CONFIG_MIPS_ASID_BITS=8 -CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set -# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_MIPS_CMDLINE_FROM_DTB=y -# CONFIG_MIPS_ELF_APPENDED_DTB is not set -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -# CONFIG_MIPS_MT_SMP is not set -# CONFIG_MIPS_NO_APPENDED_DTB is not set -CONFIG_MIPS_RAW_APPENDED_DTB=y -CONFIG_MIPS_SPRAM=y -# CONFIG_MIPS_VPE_LOADER is not set -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_GEOMETRY=y -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_LANTIQ=y -CONFIG_MTD_M25P80=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPLIT_BRNIMAGE_FW=y -CONFIG_MTD_SPLIT_EVA_FW=y -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_TPLINK_FW=y -CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -# CONFIG_NO_IOPORT_MAP is not set -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_PCI_DRIVERS_LEGACY=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_LANTIQ=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_XWAY=y -CONFIG_PSB6970_PHY=y -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_RESET_CONTROLLER=y -CONFIG_RTL8366RB_PHY=y -CONFIG_RTL8366_SMI=y -# CONFIG_SCHED_INFO is not set -# CONFIG_SCSI_DMA is not set -# CONFIG_SENSORS_LTQ_CPUTEMP is not set -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_LANTIQ=y -# CONFIG_SOC_AMAZON_SE is not set -# CONFIG_SOC_FALCON is not set -CONFIG_SOC_TYPE_XWAY=y -CONFIG_SOC_XWAY=y -CONFIG_SPI=y -CONFIG_SPI_LANTIQ_SSC=y -CONFIG_SPI_MASTER=y -CONFIG_SRCU=y -CONFIG_SWAP_IO_SPACE=y -CONFIG_SWCONFIG=y -CONFIG_SWPHY=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_CPU_MIPS32_R2=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_MIPS16=y -CONFIG_SYS_SUPPORTS_MULTITHREADING=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USE_OF=y -# CONFIG_XRX200_PHY_FW is not set diff --git a/target/linux/lantiq/falcon/config-4.9 b/target/linux/lantiq/falcon/config-4.9 deleted file mode 100644 index de4fa3686..000000000 --- a/target/linux/lantiq/falcon/config-4.9 +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_SPLIT_FIRMWARE_NAME="linux" -CONFIG_PINCTRL_FALCON=y -# CONFIG_PSB6970_PHY is not set -# CONFIG_RTL8366_SMI is not set -CONFIG_SOC_FALCON=y -# CONFIG_SOC_TYPE_XWAY is not set -# CONFIG_SOC_XWAY is not set -CONFIG_SPI_FALCON=y diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts index 5e1f27160..5a2d86719 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts @@ -101,11 +101,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ALL0333CJ.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ALL0333CJ.dts index 0d128e038..df62ac2d9 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ALL0333CJ.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ALL0333CJ.dts @@ -13,11 +13,11 @@ led-boot = &power; led-failsafe = &power; led-running = &power; + led-upgrade = &power; led-dsl = &dsl; led-internet = &online_green; }; - }; memory@0 { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4510PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4510PW.dts index 0d0b70c68..6598a60f5 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4510PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4510PW.dts @@ -16,6 +16,7 @@ led-boot = &power; led-failsafe = &power2; led-running = &power; + led-upgrade = &power; led-dsl = &adsl; led-internet = &internet; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi index 458a38753..f29c416c0 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi @@ -11,6 +11,7 @@ led-boot = &power; led-failsafe = &power; led-running = &power; + led-upgrade = &power; led-dsl = &dsl; led-internet = &online; @@ -192,11 +193,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts index 5733d2ce1..e307b381a 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &internet_green; @@ -180,7 +181,7 @@ }; }; -&pci0 { +&pci0 { status = "okay"; lantiq,external-clock; gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; @@ -189,11 +190,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts index aa4269305..cd76bf579 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts @@ -16,6 +16,7 @@ led-boot = &power_blue; led-failsafe = &power_red; led-running = &power_blue; + led-upgrade = &power_blue; led-dsl = &dsl; led-internet = &internet_blue; @@ -213,11 +214,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts index 1e1183d1b..203a30df5 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts @@ -16,6 +16,7 @@ led-boot = &power_blue; led-failsafe = &power_red; led-running = &power_blue; + led-upgrade = &power_blue; led-dsl = &dsl_blue; led-usb = &led_usb; @@ -231,11 +232,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7506PW11.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7506PW11.dts index 0c251c61f..8fe22e9a4 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7506PW11.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7506PW11.dts @@ -16,6 +16,7 @@ led-boot = &power; led-failsafe = &power_red; led-running = &power; + led-upgrade = &power; led-dsl = &dsl; led-internet = &internet; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts index 337f969b3..92d01b4dc 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts @@ -16,6 +16,7 @@ led-boot = &power; led-failsafe = &power; led-running = &power; + led-upgrade = &power; led-dsl = &internet; led-usb = &umts; @@ -195,11 +196,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts index 1d6f404ee..72f3a686b 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &online_green; @@ -227,11 +228,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519PW.dts index 39dcf4561..bcb3b502a 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519PW.dts @@ -16,6 +16,7 @@ led-boot = &power; led-failsafe = &power2; led-running = &power; + led-upgrade = &power; led-dsl = &dsl; led-internet = &online; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts index 40607aebd..baa9adcc9 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts @@ -17,6 +17,7 @@ led-boot = &power_green; led-failsafe = &power_green; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &internet_green; }; @@ -236,18 +237,18 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7525PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7525PW.dts index 425222633..a395d4ff4 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7525PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7525PW.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &power_green; led-internet = &online; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts index 7b337b4f5..5f877723f 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts @@ -16,6 +16,7 @@ led-boot = &power_red; led-failsafe = &power_blue; led-running = &power_red; + led-upgrade = &power_red; led-dsl = &internet_red; led-usb = &umts; @@ -232,11 +233,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts index feb92d4d9..1d4d662ab 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts @@ -16,6 +16,7 @@ led-boot = &power_red; led-failsafe = &power_blue; led-running = &power_red; + led-upgrade = &power_red; led-dsl = &internet_red; led-usb = &umts; @@ -254,11 +255,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts index 1e39380f6..1e55d8159 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl_green; led-internet = &online_green; @@ -178,11 +179,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ASL56026.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ASL56026.dts index 9a78822be..90bfcabcb 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ASL56026.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ASL56026.dts @@ -17,6 +17,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; }; @@ -92,7 +93,6 @@ phy-mode = "mii"; phy-handle = <&phy14>; }; - }; mdio@0 { @@ -110,7 +110,6 @@ reg = <0x14>; compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; }; - }; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV2B.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV2B.dts index 105dae408..e126065ea 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV2B.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV2B.dts @@ -16,6 +16,7 @@ led-boot = &power_orange; led-failsafe = &power_red; led-running = &power_blue; + led-upgrade = &power_blue; led-dsl = &broadband_blue; led-wifi = &wireless_blue; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts index 6bba7e420..b854ac0a9 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts @@ -16,6 +16,7 @@ led-boot = &power_orange; led-failsafe = &power_red; led-running = &power_blue; + led-upgrade = &power_blue; led-dsl = &broadband_blue; led-wifi = &wireless_blue; @@ -207,9 +208,9 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts index a3be0a5c9..c251fc3fc 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts @@ -17,6 +17,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_blue; + led-upgrade = &power_blue; led-dsl = &broadband_blue; led-wifi = &wireless_blue; @@ -291,9 +292,9 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN1000B.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN1000B.dts index 8982c27be..8c61e1b74 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN1000B.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN1000B.dts @@ -16,6 +16,7 @@ led-boot = &power; led-failsafe = &power; led-running = &power; + led-upgrade = &power; led-dsl = &dsl; led-internet = &online_green; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN3500.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN3500.dtsi index 614845f09..b0facb410 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN3500.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DGN3500.dtsi @@ -11,6 +11,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &internet; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DM200.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DM200.dts index 8302336bd..8cf3456ee 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DM200.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/DM200.dts @@ -17,6 +17,7 @@ led-boot = &power_green; led-failsafe = &power_amber; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl_green; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi index 464ab5bd4..781cdfdb5 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi @@ -14,6 +14,7 @@ led-boot = &power; led-failsafe = &power; led-running = &power; + led-upgrade = &power; led-usb = &led_usb1; led-usb2 = &led_usb2; @@ -304,9 +305,9 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88388.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88388.dts index a9c5b3c24..4821a66b0 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88388.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88388.dts @@ -28,7 +28,7 @@ pinctrl { led_pins: led-pins { - lantiq,pins = "io34", "io35", "io36", "io37", "io38", + lantiq,pins = "io34", "io35", "io36", "io37", "io38", "io39", "io40", "io41"; lantiq,function = "gpio"; }; @@ -100,7 +100,6 @@ gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; default-state = "off"; }; - }; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88444.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88444.dts index ceb81ea13..0ac74b330 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88444.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY88444.dts @@ -14,7 +14,7 @@ memory@0 { device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 + reg = <0x0 0x4000000>; // 64M at 0x0 }; gpio-keys { @@ -74,7 +74,6 @@ gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; default-state = "off"; }; - }; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY98021.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY98021.dts index 7b2e490fc..38154d6f1 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY98021.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY98021.dts @@ -15,7 +15,7 @@ memory@0 { device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 + reg = <0x0 0x4000000>; // 64M at 0x0 }; gpio-keys { @@ -31,12 +31,12 @@ /* Place-holder for SIM-Card connector, to list the used GPIOs, no official binding */ compatible = "gpio-mmc"; - gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>, - <&gpio0 3 GPIO_ACTIVE_HIGH>, - <&gpio0 2 GPIO_ACTIVE_HIGH>, - <0>; /* no CS */ + gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>, + <&gpio0 3 GPIO_ACTIVE_HIGH>, + <&gpio0 2 GPIO_ACTIVE_HIGH>, + <0>; /* no CS */ gpio-names = "di", "do", "clk", "cs"; - reset-gpio = <&gpio3 24 GPIO_ACTIVE_HIGH>; + reset-gpio = <&gpio3 24 GPIO_ACTIVE_HIGH>; }; pinctrl { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts new file mode 100644 index 000000000..3cb7d7d72 --- /dev/null +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts @@ -0,0 +1,38 @@ +/dts-v1/; + +#include "FRITZ3370-REV2.dtsi" + +/ { + compatible = "avm,fritz3370-rev2-hynix", "avm,fritz3370-rev2", "lantiq,xway", "lantiq,vr9"; + model = "AVM Fritz!Box WLAN 3370 Rev. 2 (Hynix NAND)"; +}; + +&localbus { + nand@1 { + compatible = "lantiq,nand-xway"; + bank-width = <2>; + reg = <1 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + nand-ecc-mode = "soft"; + nand-ecc-strength = <3>; + nand-ecc-step-size = <256>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x7c00000>; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts new file mode 100644 index 000000000..1a1be6fd3 --- /dev/null +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts @@ -0,0 +1,36 @@ +/dts-v1/; + +#include "FRITZ3370-REV2.dtsi" + +/ { + compatible = "avm,fritz3370-rev2-micron", "avm,fritz3370-rev2", "lantiq,xway", "lantiq,vr9"; + model = "AVM Fritz!Box WLAN 3370 Rev. 2 (Micron NAND)"; +}; + +&localbus { + nand@1 { + compatible = "lantiq,nand-xway"; + bank-width = <2>; + reg = <1 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + nand-ecc-mode = "on-die"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x7c00000>; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2.dtsi similarity index 78% rename from target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370.dts rename to target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2.dtsi index a958fc67a..a7e0c7191 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2.dtsi @@ -1,22 +1,21 @@ -/dts-v1/; - #include "vr9.dtsi" #include #include / { - compatible = "avm,fritz3370", "lantiq,xway", "lantiq,vr9"; - model = "Fritz!Box WLAN 3370"; + compatible = "avm,fritz3370-rev2", "lantiq,xway", "lantiq,vr9"; + model = "AVM Fritz!Box WLAN 3370 Rev. 2"; chosen { - bootargs = "console=ttyLTQ0,115200 ubi.mtd=1,512 root=/dev/mtdblock9"; + bootargs = "console=ttyLTQ0,115200"; }; aliases { led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &info_green; @@ -27,21 +26,28 @@ reg = <0x0 0x8000000>; }; + gpio-poweroff { + compatible = "gpio-poweroff"; + gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; #address-cells = <1>; #size-cells = <0>; poll-interval = <100>; + power { label = "power"; gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; linux,code = ; }; -/* wifi { - label = "wifi"; + + wifi { + label = "wlan"; gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; - linux,code = ; - };*/ + linux,code = ; + }; }; gpio-leds { @@ -52,31 +58,61 @@ gpios = <&gpio 32 GPIO_ACTIVE_LOW>; default-state = "keep"; }; + power_red: power2 { label = "fritz3370:red:power"; gpios = <&gpio 33 GPIO_ACTIVE_LOW>; }; + info_red { label = "fritz3370:red:info"; gpios = <&gpio 34 GPIO_ACTIVE_LOW>; }; + wifi: wifi { label = "fritz3370:green:wlan"; gpios = <&gpio 35 GPIO_ACTIVE_LOW>; }; + dsl: dsl { label = "fritz3370:green:dsl"; gpios = <&gpio 36 GPIO_ACTIVE_LOW>; }; + lan { label = "fritz3370:green:lan"; gpios = <&gpio 38 GPIO_ACTIVE_LOW>; }; + info_green: info_green { label = "fritz3370:green:info"; gpios = <&gpio 47 GPIO_ACTIVE_LOW>; }; }; + + usb0_vbus: regulator-usb0-vbus { + compatible = "regulator-fixed"; + + regulator-name = "USB0_VBUS"; + + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + gpio = <&gpio 14 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb1_vbus: regulator-usb1-vbus { + compatible = "regulator-fixed"; + + regulator-name = "USB1_VBUS"; + + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + gpio = <&gpio 5 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; ð0 { @@ -85,8 +121,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0>; - mtd-mac-address = <&urlader 0x987>; - mtd-mac-address-increment = <(-2)>; lantiq,switch; ethernet@0 { @@ -96,6 +130,7 @@ phy-handle = <&phy0>; gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; }; + ethernet@1 { compatible = "lantiq,xrx200-pdi-port"; reg = <1>; @@ -103,13 +138,15 @@ phy-handle = <&phy1>; gpios = <&gpio 44 GPIO_ACTIVE_HIGH>; }; + ethernet@2 { compatible = "lantiq,xrx200-pdi-port"; reg = <2>; phy-mode = "gmii"; phy-handle = <&phy11>; }; - ethernet@3 { + + ethernet@4 { compatible = "lantiq,xrx200-pdi-port"; reg = <4>; phy-mode = "gmii"; @@ -127,14 +164,17 @@ reg = <0x0>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; }; + phy1: ethernet-phy@1 { reg = <0x1>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; }; + phy11: ethernet-phy@11 { reg = <0x11>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; }; + phy13: ethernet-phy@13 { reg = <0x13>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; @@ -159,29 +199,34 @@ lantiq,groups = "mdio"; lantiq,function = "mdio"; }; + nand { lantiq,groups = "nand cle", "nand ale", "nand rd", "nand cs1", "nand rdy"; lantiq,function = "ebu"; lantiq,pull = <1>; }; + phy-rst { lantiq,pins = "io37", "io44"; lantiq,pull = <0>; lantiq,open-drain = <0>; lantiq,output = <1>; }; + pcie-rst { - lantiq,pins = "io38"; + lantiq,pins = "io21"; lantiq,pull = <0>; lantiq,output = <1>; }; }; + pins_spi_default: pins_spi_default { spi_in { lantiq,groups = "spi_di"; lantiq,function = "spi"; }; + spi_out { lantiq,groups = "spi_do", "spi_clk", "spi_cs4"; @@ -191,50 +236,9 @@ }; }; -&localbus { - nand@1 { - compatible = "lantiq,nand-xway"; - bank-width = <2>; - reg = <1 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x0 0x400000>; - }; - - partition@400000 { - label = "rootfs_ubi"; - reg = <0x400000 0x3000000>; - }; - - partition@3400000 { - label = "vr9_firmware"; - reg = <0x3400000 0x400000>; - }; - partition@3800000 { - label = "reserved"; - reg = <0x3800000 0x3000000>; - }; - partition@6800000 { - label = "config"; - reg = <0x6800000 0x200000>; - }; - partition@6a00000 { - label = "nand-filesystem"; - reg = <0x6a00000 0x1600000>; - }; - }; - }; -}; - &pcie0 { + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + pcie@0 { reg = <0 0 0 0 0>; #interrupt-cells = <1>; @@ -283,14 +287,20 @@ }; }; -/* - * TODO: add phy-supply, gpio 5 GPIO_ACTIVE_HIGH and gpio 14 GPIO_ACTIVE_HIGH are - * related - */ &usb_phy0 { status = "okay"; }; +&usb_phy1 { + status = "okay"; +}; + &usb0 { status = "okay"; + vbus-supply = <&usb0_vbus>; +}; + +&usb1 { + status = "okay"; + vbus-supply = <&usb1_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7312.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7312.dts new file mode 100644 index 000000000..c14695413 --- /dev/null +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7312.dts @@ -0,0 +1,182 @@ +/dts-v1/; + +#include "ar9.dtsi" + +#include + +/ { + compatible = "avm,fritz7312", "lantiq,xway", "lantiq,ar9"; + model = "FritzBox 7312 (1&1 WLAN-MODEM)"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; + + led-internet = &info_green; + led-dsl = &power; + led-wifi = &wlan; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wlan { + label = "wlan"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + dect { + label = "dect"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power: power { + label = "fritz7312:green:power"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + voice { + label = "fritz7312:green:fon"; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + dect { + label = "fritz7312:green:dect"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + wlan: wlan { + label = "fritz7312:green:wlan"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + info_green: info_green { + label = "fritz7312:green:info"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pci { + lantiq,groups = "gnt1", "req1", "req2", "req4", "gnt2", "gnt3", "gnt4"; + lantiq,function = "pci"; + }; + pci-in { + lantiq,groups = "req1", "req2", "req4"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci-out { + lantiq,groups = "gnt1", "gnt2", "gnt3", "gnt4"; + lantiq,output = <1>; + lantiq,pull = <0>; + }; + ar8030-intr { + lantiq,groups = "exin3"; + lantiq,function = "exin"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + ar8030-clk { + lantiq,groups = "clkout2"; + lantiq,output = <1>; + lantiq,open-drain; + }; + ar8030-rst { + lantiq,pins = "io34"; + lantiq,output = <1>; + lantiq,pull = <2>; + lantiq,open-drain; + }; + }; +}; + +&gsw { + phy-mode = "rmii"; + phy-handle = <&phy0>; + mtd-mac-address = <&ath9k_cal 0xa91>; + mtd-mac-address-increment = <(-2)>; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + reset-gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&localbus { + nor@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + ath9k_cal: partition@0 { + label = "urlader"; + reg = <0x00000 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0xf60000>; + }; + + partition@f80000 { + label = "tffs (1)"; + reg = <0xf80000 0x40000>; + read-only; + }; + + partition@fc0000 { + label = "tffs (2)"; + reg = <0xfc0000 0x40000>; + read-only; + }; + }; + }; +}; + +&pci0 { + status = "okay"; + req-mask = <0xf>; + gpio-reset = <&gpio 21 GPIO_ACTIVE_LOW>; + + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + }; +}; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7320.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7320.dts index eed4ae316..45a59c012 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7320.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7320.dts @@ -16,6 +16,7 @@ led-boot = &power; led-failsafe = &power; led-running = &power; + led-upgrade = &power; led-internet = &info_green; led-dsl = &power; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7360SL.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7360SL.dts index a0f5d8ee0..91520c813 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7360SL.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7360SL.dts @@ -17,6 +17,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &info_green; led-wifi = &wifi; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts index fc028bb5f..36b82515d 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts @@ -117,11 +117,11 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts index 43a4b42d8..46cae21a5 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_green; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &online; @@ -165,10 +166,10 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts index 267a4f3a7..6e01068ed 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &online; @@ -186,9 +187,9 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi index 03858afef..65424e3ef 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi @@ -14,6 +14,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl_green; led-internet = &internet_green; @@ -280,18 +281,18 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi index e176bca30..233b7e333 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi @@ -281,18 +281,18 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VG3503J.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VG3503J.dts index bb001cb21..9735b2e01 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VG3503J.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VG3503J.dts @@ -17,6 +17,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi index 8f22380cc..811f39d08 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi @@ -14,6 +14,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &internet_green; @@ -253,11 +254,11 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi index 297f5f7f4..8ffa9146d 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi @@ -14,6 +14,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &broadband_green; led-internet = &internet_green; @@ -288,20 +289,20 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts index d0fcd6fcd..331f08ed5 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts @@ -288,18 +288,18 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts index 6bee3308a..9759b311b 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts @@ -16,6 +16,7 @@ led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; + led-upgrade = &power_green; led-dsl = &dsl; led-internet = &online_green; @@ -191,9 +192,9 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts index 4092b6b6e..5dcf13912 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts @@ -17,6 +17,7 @@ led-boot = &power_g; led-failsafe = &diag_r; led-running = &power_g; + led-upgrade = &power_g; led-dsl = &dsl; led-internet = &router_g; @@ -312,18 +313,18 @@ &usb_phy0 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; - phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; + vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; + vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts deleted file mode 100644 index 729472011..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts +++ /dev/null @@ -1,102 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -/ { - compatible = "audiocodes,mp-252", "lantiq,xway", "lantiq,danube"; - model = "AudioCodes MediaPack MP-252"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x20000>; - read-only; - }; - - partition@20000 { - label = "uboot_env"; - reg = <0x20000 0x20000>; - }; - - partition@40000 { - label = "boardconfig"; - reg = <0x40000 0x60000>; - read-only; - }; - - partition@a0000 { - label = "firmware"; - reg = <0xa0000 0xf20000>; - }; - - partition@fc0000 { - label = "sysconfig"; - reg = <0xfc0000 0x40000>; - }; - - partition@0x1000000 { - label = "rootfs_data"; - reg = <0x1000000 0x1000000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci { - lantiq,groups = "gnt1", "req1"; - lantiq,function = "pci"; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - - pci@E105400 { - status = "okay"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts deleted file mode 100644 index 16c5facb3..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts +++ /dev/null @@ -1,120 +0,0 @@ -/dts-v1/; - -#include "amazonse.dtsi" - -/ { - compatible = "allnet,all0333cj", "lantiq,xway", "lantiq,ase"; - model = "Allnet ALL0333CJ DSL Modem"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - - led-dsl = &dsl; - led-internet = &online_green; - }; - - }; - - memory@0 { - reg = <0x0 0x1000000>; - }; - - fpi@b0000000 { - etop@E180000 { - phy-mode = "mii"; - }; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - asc { - lantiq,groups = "asc"; - lantiq,function = "asc"; - }; - keys_in { - lantiq,pins = "io0",/* "io25", */"io29"; - lantiq,pull = <2>; - lantiq,open-drain = <1>; - }; - }; - }; - - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x400000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "firmware"; - reg = <0x10000 0x3ef200>; - }; - - partition@3ff200 { - label = "uboot_env"; - reg = <0x3ff200 0xc00>; - read-only; - }; - - partition@3ffe00 { - label = "dummy_bits"; - reg = <0x3ffe00 0x200>; - read-only; - }; - }; - }; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - /* power led: red=off, green=on */ - power: power { - label = "all0333cj:green:power"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - - lan: lan { - label = "all0333cj:green:lan"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - - dsl: dsl { - label = "all0333cj:green:dsl"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - - online_green: online { - label = "all0333cj:green:online"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - online_red { - label = "all0333cj:red:online"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts deleted file mode 100644 index 4720b57dd..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts +++ /dev/null @@ -1,232 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv4510pw", "lantiq,xway", "lantiq,danube"; - model = "Wippies, Elisa"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power2; - led-running = &power; - - led-dsl = &adsl; - led-internet = &internet; - led-usb = &usb; - led-usb2 = &usb2; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x1000000>; - #address-cells = <1>; - #size-cells = <1>; - - lantiq,noxip; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x20000>; - read-only; - }; - - partition@60000 { - label = "firmware"; - reg = <0x60000 0xfa0000>; - }; - }; - }; - }; - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu a23"; - lantiq,function = "ebu"; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - exin { - lantiq,groups = "exin1", "exin2"; - lantiq,function = "exin"; - lantiq,output = <0>; - }; - pci_in { - lantiq,groups = "req1", "req2"; - lantiq,function = "pci"; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1", "gnt2"; - lantiq,function = "pci"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - buttons { - lantiq,pins = "io3", "io14"; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - }; - }; - - gpios: stp@E100BB0 { - status = "okay"; - lantiq,groups = <0x7>; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - - pci@E105400 { - status = "okay"; - lantiq,external-clock; - interrupt-map = < - 0x6000 0 0 1 &icu0 135 - 0x7800 0 0 1 &icu0 66 - 0x7800 0 0 2 &icu0 66 - 0x7800 0 0 3 &icu0 66 - >; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - req-mask = <0x7>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power: power { - label = "power"; - gpios = <&gpios 21 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - power2: power2 { - label = "power2"; - gpios = <&gpios 20 GPIO_ACTIVE_HIGH>; - }; - lan1 { - label = "lan1"; - gpios = <&gpios 19 GPIO_ACTIVE_HIGH>; - }; - lan2 { - label = "lan2"; - gpios = <&gpios 18 GPIO_ACTIVE_HIGH>; - }; - lan3 { - label = "lan3"; - gpios = <&gpios 17 GPIO_ACTIVE_HIGH>; - }; - lan4 { - label = "lan4"; - gpios = <&gpios 16 GPIO_ACTIVE_HIGH>; - }; - wifi: wifi { - label = "wifi"; - gpios = <&gpios 15 GPIO_ACTIVE_HIGH>; - }; - adsl: adsl { - label = "adsl"; - gpios = <&gpios 14 GPIO_ACTIVE_HIGH>; - }; - internet: internet { - label = "internet"; - gpios = <&gpios 13 GPIO_ACTIVE_HIGH>; - }; - internet2 { - label = "internet2"; - gpios = <&gpios 12 GPIO_ACTIVE_HIGH>; - }; - voip { - label = "voip"; - gpios = <&gpios 11 GPIO_ACTIVE_HIGH>; - }; - phone { - label = "phone"; - gpios = <&gpios 10 GPIO_ACTIVE_HIGH>; - }; - phone2 { - label = "phone2"; - gpios = <&gpios 9 GPIO_ACTIVE_HIGH>; - }; - usb: usb { - label = "usb"; - gpios = <&gpios 8 GPIO_ACTIVE_HIGH>; - }; - usb2: usb2 { - label = "usb2"; - gpios = <&gpios 7 GPIO_ACTIVE_HIGH>; - }; - usb3 { - label = "usb3"; - gpios = <&gpios 6 GPIO_ACTIVE_HIGH>; - }; - unlabeled { - label = "unlabeled"; - gpios = <&gpios 5 GPIO_ACTIVE_HIGH>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts deleted file mode 100644 index 34f868f48..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts +++ /dev/null @@ -1,8 +0,0 @@ -/dts-v1/; - -#include "ARV4518PWR01.dtsi" - -/ { - compatible = "arcadyan,arv4518pwr01", "lantiq,xway", "lantiq,danube"; - model = "SMC7908A-ISP"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi deleted file mode 100644 index 8e712bfec..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi +++ /dev/null @@ -1,198 +0,0 @@ -#include "danube.dtsi" - -#include - -/ { - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - - led-dsl = &dsl; - led-internet = &online; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; /* 64 KB */ - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; /* 64 KB */ - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - boardconfig: partition@400000 { - label = "boardconfig"; - reg = <0x3f0000 0x10000>; - read-only; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x0>; - }; - - ath5k_eep { - compatible = "ath5k,eeprom"; - ath,eep-flash = <&boardconfig 0x400>; - ath,mac-offset = <0x16>; - ath,mac-increment = <1>; - ath,eep-swap; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - pci_in { - lantiq,groups = "req1", "req2"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1", "gnt2"; - lantiq,function = "pci"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; - }; - - pci@E105400 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - req-mask = <0xf>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power: power { - label = "power"; - gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - dsl: dsl { - label = "dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - online: online { - label = "online"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "wifi"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - wps { - label = "wps"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - dsl2 { - label = "dsl2"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "usb"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - voice { - label = "voice"; - gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; - }; - fxs1 { - label = "fxs1"; - gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "fxs2"; - gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; - }; - fxo { - label = "fxo"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts deleted file mode 100644 index 771d0146d..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts +++ /dev/null @@ -1,14 +0,0 @@ -/dts-v1/; - -#include "ARV4518PWR01.dtsi" - -/ { - compatible = "arcadyan,arv4518pwr01a", "lantiq,xway", "lantiq,danube"; - model = "SMC7908A-ISP, Airties WAV-221"; - - fpi@10000000 { - pci@E105400 { - lantiq,external-clock; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts deleted file mode 100644 index 8f781760f..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts +++ /dev/null @@ -1,195 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv4519pw", "lantiq,xway", "lantiq,danube"; - model = "Vodafone Netfaster IAD 2, Pirelli P.RG A4201G"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &internet_green; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - boardconfig: partition@3f0000 { - label = "boardconfig"; - reg = <0x3f0000 0x10000>; - read-only; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x400>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; - }; - - pci@E105400 { - status = "okay"; - lantiq,external-clock; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - req-mask = <0xf>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power { - label = "arv4519pw:green:power"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power2 { - label = "arv4519pw:red:power"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv4519pw:green:wlan"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "arv4519pw:green:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - internet_green: online { - label = "arv4519pw:green:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - online2 { - label = "arv4519pw:red:internet"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "arv4519pw:green:usb"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - voip { - label = "arv4519pw:green:voip"; - gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; - }; - fxs1 { - label = "arv4519pw:green:phone1"; - gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "arv4519pw:green:phone2"; - gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; - }; - fxo { - label = "arv4519pw:green:line"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - wps2 { - label = "arv4519pw:green:wps"; - gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; - }; - wps { - label = "arv4519pw:orange:wps"; - gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; - }; - wps3 { - label = "arv4519pw:red:wps"; - gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts deleted file mode 100644 index 05e0dfe04..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts +++ /dev/null @@ -1,221 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv4520pw", "lantiq,xway", "lantiq,danube"; - model = "Easybox 800, WAV-281"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_blue; - led-failsafe = &power_red; - led-running = &power_blue; - - led-dsl = &dsl; - led-internet = &internet_blue; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH - &gpiomm 7 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x20000>; - read-only; - }; - - partition@20000 { - label = "uboot_env"; - reg = <0x20000 0x10000>; - read-only; - }; - - partition@30000 { - label = "firmware"; - reg = <0x30000 0x3c0000>; - }; - - boardconfig: partition@7f0000 { - label = "boardconfig"; - reg = <0x3f0000 0x10000>; - read-only; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x400>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - }; - }; - - etop@E180000 { - phy-mode = "rmii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; - }; - - pci@E105400 { - status = "okay"; - lantiq,external-clock; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - -// gpiomm 10 - switch - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "wps"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_blue: power { - label = "arv4520pw:blue:power"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - dsl: dsl { - label = "arv4520pw:blue:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - internet_blue: internet { - label = "arv4520pw:blue:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - power_red: power2 { - label = "arv4520pw:red:power"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - wps { - label = "arv4520pw:yellow:wps"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - wps2 { - label = "arv4520pw:red:wps"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - /* - wps green is missing - */ - fxs1 { - label = "arv4520pw:blue:telefon1"; - gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "arv4520pw:blue:telefon2"; - gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; - }; - isdn { - label = "arv4520pw:blue:isdn"; - gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; - }; - fxo { - label = "arv4520pw:blue:line"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - voice { - label = "arv4520pw:blue:sprache"; - gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "arv4520pw:blue:usb"; - gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv4520pw:blue:wifi"; - gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; - }; - internet2 { - label = "arv4520pw:red:internet"; - gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; - }; - /* - info is missing - */ - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts deleted file mode 100644 index 61548c793..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts +++ /dev/null @@ -1,169 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv4525pw", "lantiq,xway", "lantiq,danube"; - model = "Speedport W501V Typ A"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - /* we dont have a power led, lets use the online led */ - led-boot = &online; - led-failsafe = &online; - - led-dsl = &dsl; - led-internet = &online; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - boardconfig: partition@400000 { - label = "boardconfig"; - reg = <0x3f0000 0x10000>; - read-only; - }; - }; - }; - - ath5k_eep { - compatible = "ath5k,eeprom"; - ath,eep-flash = <&boardconfig 0x400>; - ath,mac-offset = <0x0>; - ath,eep-swap; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - relay { - lantiq,pins = "io31"; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - pci@E105400 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - -/* -#define ARV4525PW_PHYRESET 13 -#define ARV4525PW_RELAY 31 -*/ - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - fxo { - label = "arv4525pw:green:festnetz"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - fxs { - label = "arv4525pw:green:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "arv4525pw:green:t-dsl"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv4525pw:green:wlan"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - online: online { - label = "arv4525pw:green:online"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts deleted file mode 100644 index d996e8b66..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts +++ /dev/null @@ -1,237 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv452cqw", "lantiq,xway", "lantiq,danube"; - model = "Arcor 801"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_blue; - led-failsafe = &power_red; - led-running = &power_blue; - - led-dsl = &dsl_blue; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH - &gpiomm 7 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x400000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - boardconfig: partition@3f0000 { - label = "boardconfig"; - reg = <0x3f0000 0x10000>; - read-only; - }; - }; - }; - - ath5k_eep { - compatible = "ath5k,eeprom"; - ath,eep-flash = <&boardconfig 0x400>; - ath,mac-offset = <0x0>; - ath,eep-swap; - }; - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10>; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x77f>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - leds { - lantiq,pins = "io3", "io5", "io6", "io7", "io9"; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; - }; - - etop@E180000 { - phy-mode = "rmii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - pci@E105400 { - status = "okay"; - lantiq,external-clock; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - -/* -#define ARV452CPW_SWITCH_RESET 110 -*/ - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power_blue: power0 { - label = "arv452cqw:blue:power"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - dsl_blue: dsl { - label = "arv452cqw:blue:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - isdn { - label = "arv452cqw:blue:isdn"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - power_red: power1 { - label = "arv452cqw:red:power"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - wps { - label = "arv452cqw:blue:wps"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - wps1 { - label = "arv452cqw:yellow:wps"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - fxs1 { - label = "arv452cqw:blue:telefon1"; - gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "arv452cqw:blue:telefon2"; - gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; - }; - wps2 { - label = "arv452cqw:red:wps"; - gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; - }; - fxo { - label = "arv452cqw:blue:line"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - voice { - label = "arv452cqw:blue:sprache"; - gpios = <&gpiomm 4 1>; - }; - usb: usb { - label = "arv452cqw:blue:usb"; - gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv452cqw:blue:wlan"; - gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; - }; - /* - internet blue and internet red are missing - dsl2 and dsl3 are not referenced in manual - */ - dsl2 { - label = "arv452cqw:yellow:dsl"; - gpios = <&gpiomm 8 GPIO_ACTIVE_LOW>; - }; - dsl3 { - label = "arv452cqw:red:dsl"; - gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts deleted file mode 100644 index 3ec4bf41a..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts +++ /dev/null @@ -1,165 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv7506pw11", "lantiq,xway", "lantiq,danube"; - model = "Alice/O2 IAD 4421"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power_red; - led-running = &power; - - led-dsl = &dsl; - led-internet = &internet; - led-wifi = &wlan; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7a0000>; - }; - - boardconfig: partition@7f0000 { - label = "board_config"; - reg = <0x7f0000 0x10000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - pci { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - }; - }; - - /* GPIO 19: switch reset */ - etop@E180000 { - phy-mode = "rmii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - wlan: wlan { - label = "arv7506pw11:green:wlan"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; - power: power { - label = "arv7506pw11:green:power"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - dsl: dsl { - label = "arv7506pw11:green:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - internet: internet { - label = "arv7506pw11:green:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - power_red: power_red { - label = "arv7506pw11:red:power"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - internet_red { - label = "arv7506pw11:red:internet"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - info { - label = "arv7506pw11:green:info"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - telefon { - label = "arv7506pw11:green:telefon"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - info_red { - label = "arv7506pw11:red:info"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - lantiq,external-clock; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@1814,3592 { - compatible = "pci1814,3592"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - mtd-mac-address = <&boardconfig 0x16>; - mtd-mac-address-increment = <1>; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts deleted file mode 100644 index dc3f614b9..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts +++ /dev/null @@ -1,196 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv7510pw22", "lantiq,xway", "lantiq,danube"; - model = "Astoria Networks ARV7510PW22"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - - led-dsl = &internet; - led-usb = &umts; - led-wifi = &wlan; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x1000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x20000>; - read-only; - }; - - partition@60000 { - label = "firmware"; - reg = <0x60000 0xf80000>; - }; - - boardconfig: partition@fe0000 { - label = "board_config"; - reg = <0xfe0000 0x20000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_in { - lantiq,groups = "req1", "req2"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - pins_out { - lantiq,pins = "io2", "io4", "io8", "io9", "io10", "io15", "io20"; - lantiq,output = <1>; - }; - pins_in { - lantiq,pins = "io11", "io12", "io28"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - }; - - etop@E180000 { - /* Switch reset 19 */ - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - restart { - label = "restart"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power: power { - label = "power"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - internet: internet { - label = "internet"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - wlan: wlan { - label = "wlan"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - umts: 3g { - label = "3g"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - message { - label = "message"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - lantiq,external-clock; - interrupt-map = < - 0x7000 0 0 1 &icu0 30 - 0x7800 0 0 1 &icu0 135 - 0x7800 0 0 2 &icu0 135 - 0x7800 0 0 3 &icu0 135 - >; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - req-mask = <0x3>; - - wifi@1814,3592 { - compatible = "pci1814,3592"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts deleted file mode 100644 index 41b124932..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts +++ /dev/null @@ -1,232 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv7518pw", "lantiq,xway", "lantiq,danube"; - model = "Astoria Networks ARV7518PW"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &online_green; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7d0000>; - }; - - boardconfig: partition@400000 { - label = "boardconfig"; - reg = <0x7f0000 0x10000>; - read-only; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x0>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - leds { - lantiq,pins = "io2", "io4", "io5", "io6", "io7", "io8", "io19"; - lantiq,output = <1>; - }; - keys { - lantiq,pins = "io28", "io30"; - lantiq,output = <0>; - lantiq,pull = <2>; - lantiq,open-drain = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; - }; - }; - -/* -#define SWITCH_RESET 13 -*/ - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power_green: power { - label = "arv7518pw:green:power"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - dsl: dsl { - label = "arv7518pw:green:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - online_green: online { - label = "arv7518pw:green:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv7518pw:green:wlan"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - power_red: power2 { - label = "arv7518pw:red:power"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - online2 { - label = "arv7518pw:red:internet"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "arv7518pw:green:usb"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - voice { - label = "arv7518pw:green:voip"; - gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; - }; - fxs1 { - label = "arv7518pw:green:phone1"; - gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "arv7518pw:green:phone2"; - gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; - }; - unlabeled { - label = "arv7518pw:amber:unlabeled"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - wps { - label = "arv7518pw:amber:wps"; - gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; - }; - wps2 { - label = "arv7518pw:green:wps"; - gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; - }; - wps3 { - label = "arv7518pw:red:wps"; - gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - lantiq,external-clock; - req-mask = <0xf>; - - wifi@168c,0029 { - compatible = "pci168c,0029"; - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - mtd-mac-address = <&boardconfig 0x16>; - mtd-mac-address-increment = <1>; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts deleted file mode 100644 index 9983a7906..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts +++ /dev/null @@ -1,229 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv7519pw", "lantiq,xway", "lantiq,danube"; - model = "Astoria Networks ARV7519PW"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power2; - led-running = &power; - - led-dsl = &dsl; - led-internet = &online; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x20000>; - }; - - partition@60000 { - label = "firmware"; - reg = <0x60000 0xf80000>; - }; - - boardconfig: partition@fe0000 { - label = "board_config"; - reg = <0xfe0000 0x20000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - switch_rst { - lantiq,pins = "io19"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - - /* warning: passive port - only works with active devices */ - ifxhcd@E101000 { - status = "okay"; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power: power { - label = "power"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power2: power2 { - label = "power2"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - online: online { - label = "online"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - online2 { - label = "online2"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "wifi"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - wifi2 { - label = "wifi2"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - wifi3 { - label = "wifi3"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - voice { - label = "voice"; - gpios = <&gpio 31 GPIO_ACTIVE_LOW>; - }; - wps { - label = "wps"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - wps2 { - label = "wps2"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - wps3 { - label = "wps3"; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - lan { - label = "lan"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - tv { - label = "tv"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - upgrade { - label = "upgrade"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - }; - }; - - /* is there another way to "reserve" the GPIO? */ - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - switch { - gpio-export,name = "switch"; - gpio-export,output = <1>; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pci0 { - status = "okay"; - lantiq,external-clock; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - req-mask = <0xf>; - - wifi@0,0 { - compatible = "pci0,0"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts deleted file mode 100644 index 0bdc150a1..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts +++ /dev/null @@ -1,231 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "arcadyan,arv7519rw22", "lantiq,xway", "lantiq,vr9"; - model = "Orange Livebox 2.1"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_green; - led-running = &power_green; - - led-dsl = &internet_green; - }; - - memory@0 { - reg = <0x0 0x8000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x60000>; - read-only; - }; - - partition@60000 { - label = "uboot-env"; - reg = <0x60000 0x20000>; - read-only; - }; - - partition@80000 { - label = "firmware"; - reg = <0x80000 0x1f00000>; - }; - - boardconfig: partition@1f80000 { - label = "boardconfig"; - reg = <0x1f80000 0x80000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - pcie-rst { - lantiq,pins = "io21"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; - }; - - ifxhcd@E106000 { - status = "okay"; - gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; - }; - - pcie@d900000 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy22f_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy22f_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - rfkill { - label = "rfkill"; - gpios = <&gpio 33 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 37 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - lan_green { - label = "arv7519rw22:green:lan"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; - internet_red { - label = "arv7519rw22:red:internet"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - power_green: power_green { - label = "arv7519rw22:green:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - alarm_blue { - label = "arv7519rw22:blue:alarm"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - internet_orange { - label = "arv7519rw22:orange:internet"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - internet_green: internet_green { - label = "arv7519rw22:green:internet"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - }; - voice_green { - label = "arv7519rw22:green:voice"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&boardconfig 0x16>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "mii"; - phy-handle = <&phy13>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "mii"; - phy-handle = <&phy14>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "mii"; - phy-handle = <&phy11>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <3>; - phy-mode = "mii"; - phy-handle = <&phy12>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy12: ethernet-phy@12 { - reg = <0x12>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy14: ethernet-phy@14 { - reg = <0x14>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts deleted file mode 100644 index 000753589..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts +++ /dev/null @@ -1,155 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv7525pw", "lantiq,xway", "lantiq,danube"; - model = "Speedport W303V Typ A"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &power_green; - led-internet = &online; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - boardconfig: partition@400000 { - label = "board_config"; - reg = <0x3f0000 0x10000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci { - lantiq,groups = "gnt1", "req1"; - lantiq,function = "pci"; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power_green: power { - label = "arv7525pw:green:power"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power1 { - label = "arv7525pw:red:power"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - online: online { - label = "arv7525pw:green:online"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - voice { - label = "arv7525pw:green:telefonie"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - voice2 { - label = "arv7525pw:red:telefonie"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv7525pw:green:wlan"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - interrupt-map = <0x7000 0 0 1 &icu0 135 1>; - - wifi@0,0 { - compatible = "pci0,0"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts deleted file mode 100644 index 3591b4367..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts +++ /dev/null @@ -1,238 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv752dpw", "lantiq,xway", "lantiq,danube"; - model = "Arcor 802"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_red; - led-failsafe = &power_blue; - led-running = &power_red; - - led-dsl = &internet_red; - led-usb = &umts; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpiomm 1 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7d0000>; - }; - - boardconfig: partition@7f0000 { - label = "board_config"; - reg = <0x7f0000 0x10000>; - read-only; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x3>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_in { - lantiq,groups = "req2", "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - leds { - lantiq,pins = "io3", "io5", "io6", "io8"; - lantiq,output = <1>; - lantiq,pull = <0>; - }; - keys { - lantiq,pins = "io11", "io12", "io13", "io28"; - lantiq,output = <0>; - lantiq,pull = <2>; - lantiq,open-drain = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpiomm 0 GPIO_ACTIVE_HIGH>; - }; - - etop@E180000 { - phy-mode = "rmii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - restart { - label = "restart"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - dsl { - label = "dsl"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power_blue: power1 { - label = "arv752dpw:blue:power"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - internet_red: internet { - label = "arv752dpw:red:internet"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - message { - label = "arv752dpw:red:message"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - power_red: power { - label = "arv752dpw:red:power"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - voice1 { - label = "arv752dpw:red:voice"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - umts: umts { - label = "arv752dpw:red:umts"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv752dpw:red:wifi"; - gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; - }; - fxs1 { - label = "arv752dpw:green:tae-n"; - gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "arv752dpw:green:tae-u"; - gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; - }; - fxo { - label = "arv752dpw:green:isdn"; - gpios = <&gpiomm 7 GPIO_ACTIVE_LOW>; - }; - internet2 { - label = "arv752dpw:blue:internet"; - gpios = <&gpiomm 8 GPIO_ACTIVE_LOW>; - }; - voice2 { - label = "arv752dpw:blue:voice"; - gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - lantiq,external-clock; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - interrupt-map = <0x7000 0 0 1 &icu0 135>; - req-mask = <0x3>; - - wifi@1814,0601 { - compatible = "pci1814,0601"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts deleted file mode 100644 index 8b5be8b76..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts +++ /dev/null @@ -1,259 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv752dpw22", "lantiq,xway", "lantiq,danube"; - model = "Arcor 803"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_red; - led-failsafe = &power_blue; - led-running = &power_red; - - led-dsl = &internet_red; - led-usb = &umts; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpiomm 1 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x30000>; - read-only; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x30000 0x10000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x40000 0x7b0000>; - }; - - boardconfig: partition@7f0000 { - label = "board_config"; - reg = <0x7f0000 0x10000>; - read-only; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <3>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - ebu { - lantiq,groups = "ebu cs1"; - lantiq,function = "ebu"; - }; - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,open-drain = <1>; - lantiq,output = <1>; - }; - leds { - lantiq,pins = "io3", "io5", "io6", "io8"; - lantiq,open-drain = <1>; - lantiq,output = <1>; - }; - buttons { - lantiq,pins = "io11", "io12", "io13", "io28"; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpiomm 0 GPIO_ACTIVE_HIGH>; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&boardconfig 0x16>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - restart { - label = "restart"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - dsl { - label = "dsl"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power_blue: power1 { - label = "arv752dpw22:blue:power"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - internet_red: internet { - label = "arv752dpw22:red:internet"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - message { - label = "arv752dpw22:red:message"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - power_red: power { - label = "arv752dpw22:red:power"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - voice1 { - label = "arv752dpw22:red:voice"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - umts: umts { - label = "arv752dpw22:red:umts"; - gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "arv752dpw22:red:wifi"; - gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; - }; - fxs1 { - label = "arv752dpw22:green:tae-n"; - gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; - }; - fxs2 { - label = "arv752dpw22:green:tae-u"; - gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; - }; - fxo { - label = "arv752dpw22:green:isdn"; - gpios = <&gpiomm 7 GPIO_ACTIVE_LOW>; - }; - internet2 { - label = "arv752dpw22:blue:internet"; - gpios = <&gpiomm 8 GPIO_ACTIVE_LOW>; - }; - voice2 { - label = "arv752dpw22:blue:voice"; - gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; - }; - eth1 { - label = "arv752dpw22:green:lan1"; - gpios = <&gpiomm 11 GPIO_ACTIVE_LOW>; - }; - eth2 { - label = "arv752dpw22:green:lan2"; - gpios = <&gpiomm 12 GPIO_ACTIVE_LOW>; - }; - eth3 { - label = "arv752dpw22:green:lan3"; - gpios = <&gpiomm 13 GPIO_ACTIVE_LOW>; - }; - eth4 { - label = "arv752dpw22:green:lan4"; - gpios = <&gpiomm 14 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - lantiq,external-clock; - interrupt-map = < - 0x7000 0 0 1 &icu0 30 - 0x7800 0 0 1 &icu0 135 - 0x7800 0 0 2 &icu0 135 - 0x7800 0 0 3 &icu0 135 - >; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - req-mask = <0x3>; - - wifi@1814,3592 { - compatible = "pci1814,3592"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - mtd-mac-address = <&boardconfig 0x16>; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts deleted file mode 100644 index 4edcde976..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts +++ /dev/null @@ -1,180 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "arcadyan,arv8539pw22", "lantiq,xway", "lantiq,danube"; - model = "Speedport W 504V Typ A"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl_green; - led-internet = &online_green; - led-wifi = &wireless_green; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x30000>; /* 192 KiB */ - read-only; - }; - - partition@30000 { - label = "uboot"; - reg = <0x30000 0x10000>; /* 64 KiB */ - read-only; - }; - - partition@40000 { - label = "firmware"; - reg = <0x40000 0x7B0000>; /* 7872 KiB */ - }; - - art: partition@7F0000 { - label = "art"; - reg = <0x7F0000 0x10000>; /* 64 KiB*/ - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - lantiq,output = <0>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - relay { - lantiq,pins = "io31"; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&art 0x16>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wlan { - label = "wlan"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - /* key DECT is missing */ - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power-green { - label = "arv8539pw22:green:power"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power-red { - label = "arv8539pw22:red:power"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - - dsl_green: dsl-green { - label = "arv8539pw22:green:dsl"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - - online_green: online-green { - label = "arv8539pw22:green:online"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - wireless_green: wireless-green { - label = "arv8539pw22:green:wlan"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - /* - telefonie green is missing - */ - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@168c,0029 { - compatible = "pci168c,0029"; - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - mtd-mac-address = <&art 0x16>; - mtd-mac-address-increment = <1>; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts deleted file mode 100644 index 2037f40f0..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts +++ /dev/null @@ -1,171 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "alphanetworks,asl56026", "lantiq,xway", "lantiq,vr9"; - model = "BT OpenReach VDSL Modem"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x0800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - }; - - partition@30000 { - label = "uboot_env"; - reg = <0x30000 0x10000>; - }; - - partition@40000 { - label = "firmware"; - reg = <0x40000 0x750000>; - }; - - partition@790000 { - label = "ddrconfig"; - reg = <0x790000 0x70000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - }; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy22f_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy22f_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 40 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - dsl: dsl { - label = "asl56026:green:dsl"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - /* power-* is a bicolour led */ - power_green: power_green { - label = "asl56026:green:power"; - gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - power_red: power_red { - label = "asl56026:red:power"; - gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - power_led_blink { - gpio-export,name = "power_led_blink"; - gpio-export,output = <0>; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - lantiq,switch; - - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "mii"; - phy-handle = <&phy11>; - }; - - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <3>; - phy-mode = "mii"; - phy-handle = <&phy14>; - }; - - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - - phy14: ethernet-phy@14 { - reg = <0x14>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts deleted file mode 100644 index 961fd9b92..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts +++ /dev/null @@ -1,262 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "bt,homehub-v2b", "lantiq,xway", "lantiq,danube"; - model = "BT Home Hub 2B"; /* SoC: Lantiq Danube-S PSB 50712 @ 333MHz V1.3/1.5 */ - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_orange; - led-failsafe = &power_red; - led-running = &power_blue; - - led-dsl = &broadband_blue; - led-wifi = &wireless_blue; - }; - - memory@0 { /* RAM: Samsung K4H511638F-LC 64MB */ - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { /* NOR Flash: Spansion S29AL004D 512KB */ - compatible = "lantiq,nor"; /* "AMD AM29LV400BB" compatible on 3.3.8 */ - lantiq,cs = <0>; - bank-width = <2>; - reg = <0 0x0 0x80000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; /* 256KB */ - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x10000>; /* 64KB */ - }; - - partition@50000 { - label = "rg_conf_1"; - reg = <0x50000 0x10000>; - }; - - partition@60000 { - label = "rg_conf_2"; - reg = <0x60000 0x10000>; - }; - - partition@70000 { - label = "rg_conf_factory"; - reg = <0x70000 0x10000>; - }; - }; - }; - - nand-parts@0 { /* NAND Flash: Samsung K9F5608U0D-JIB0 32MB */ - compatible = "lantiq,nand-xway"; - lantiq,cs = <1>; - bank-width = <2>; - reg = <1 0x0 0x2000000 >; - #address-cells = <1>; - #size-cells = <1>; - req-mask = <0x1>; /* PCI request lines to mask during NAND access */ - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - ath9k_cal: partition@0 { - label = "art"; /* Atheros 9160 wifi b/g/n radio EEPROM */ - reg = <0x00000 0x4000>; - read-only; - }; - - partition@4000 { - label = "kernel"; - reg = <0x4000 0x200000>; - }; - - partition@164000 { - label = "ubi"; - reg = <0x204000 0x1DFC000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - nand_out { - lantiq,groups = "nand cle", "nand ale"; - lantiq,function = "ebu"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - nand_cs1 { - lantiq,groups = "nand cs1"; - lantiq,function = "ebu"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - - pci_rst { - lantiq,pins = "io21"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - }; - - btn_in { - lantiq,pins = "io2", "io15", "io22"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - }; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - - ifxhcd@E101000 { - status = "okay"; - }; - - gpios: stp@E100BB0 { - status = "okay"; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - findhandset { - label = "findhandset"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - upgrading-orange { - label = "bthomehubv2b:orange:upgrading"; - gpios = <&gpios 5 GPIO_ACTIVE_HIGH>; - }; - - phone-orange { - label = "bthomehubv2b:orange:phone"; - gpios = <&gpios 6 GPIO_ACTIVE_HIGH>; - }; - phone-blue { - label = "bthomehubv2b:blue:phone"; - gpios = <&gpios 7 GPIO_ACTIVE_HIGH>; - }; - - wireless-orange { - label = "bthomehubv2b:orange:wireless"; - gpios = <&gpios 8 GPIO_ACTIVE_HIGH>; - }; - wireless_blue: wireless-blue { - label = "bthomehubv2b:blue:wireless"; - gpios = <&gpios 9 GPIO_ACTIVE_HIGH>; - }; - - broadband-red { - label = "bthomehubv2b:red:broadband"; - gpios = <&gpios 10 GPIO_ACTIVE_HIGH>; - }; - broadband-orange { - label = "bthomehubv2b:orange:broadband"; - gpios = <&gpios 11 GPIO_ACTIVE_HIGH>; - }; - broadband_blue: broadband-blue { - label = "bthomehubv2b:blue:broadband"; - gpios = <&gpios 12 GPIO_ACTIVE_HIGH>; - }; - - power_red: power-red { - label = "bthomehubv2b:red:power"; - gpios = <&gpios 13 GPIO_ACTIVE_HIGH>; - }; - power_orange: power-orange { - label = "bthomehubv2b:orange:power"; - gpios = <&gpios 14 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - power_blue: power-blue { - label = "bthomehubv2b:blue:power"; - gpios = <&gpios 15 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@168c,0027 { - compatible = "pci168c,0027"; - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts deleted file mode 100644 index d37b9728d..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts +++ /dev/null @@ -1,208 +0,0 @@ -/dts-v1/; - -#include "ar9.dtsi" - -#include - -/ { - compatible = "bt,homehub-v3a", "lantiq,xway", "lantiq,ar9"; - model = "BT Home Hub 3A"; /* SoC: Lantiq ar9 @ 333MHz */ - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_orange; - led-failsafe = &power_red; - led-running = &power_blue; - - led-dsl = &broadband_blue; - led-wifi = &wireless_blue; - }; - - memory@0 { /* RAM: Samsung K4H511638F-LC 64MB */ - reg = <0x0 0x4000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nand-parts@0 { /* NAND Flash: Samsung K9F5608U0D-JIB0 32MB */ - compatible = "lantiq,nand-xway"; - lantiq,cs = <1>; - bank-width = <2>; - reg = <1 0x0 0x2000000 >; - #address-cells = <1>; - #size-cells = <1>; - req-mask = <0x1>; /* PCI request lines to mask during NAND access */ - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "preboot"; - reg = <0x00000 0x8000>; - read-only; - }; - partition@8000 { - label = "u-boot"; - reg = <0x8000 0x05c000>; - read-only; - }; - partition@64000 { - label = "uboot_env"; - reg = <0x64000 0x004000>; - }; - ath9k_cal: partition@68000 { - label = "art-copy"; - reg = <0x68000 0x004000>; - }; - partition@6c000 { - label = "kernel"; - reg = <0x6c000 0x200000>; - }; - partition@26c000 { - label = "ubi"; - reg = <0x26c000 0x1d94000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - nand_out { - lantiq,groups = "nand cle", "nand ale"; - lantiq,function = "ebu"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - nand_cs1 { - lantiq,groups = "nand cs1"; - lantiq,function = "ebu"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - - pci_in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - pci_out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - - pci_rst { - lantiq,pins = "io21"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - }; - }; - }; - - etop@E180000 { - phy-mode = "rgmii"; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - reset { - label = "reset"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - restart { - label = "restart"; - gpios = <&gpio 52 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 53 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - wireless-red { - label = "bthomehubv3a:red:wireless"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; - wireless-orange { - label = "bthomehubv3a:orange:wireless"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - wireless_blue: wireless-blue { - label = "bthomehubv3a:blue:wireless"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - - broadband-red { - label = "bthomehubv3a:red:broadband"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - broadband-orange { - label = "bthomehubv3a:orange:broadband"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - }; - broadband_blue: broadband-blue { - label = "bthomehubv3a:blue:broadband"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - - power_red: power-red { - label = "bthomehubv3a:red:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - power_orange: power-orange { - label = "bthomehubv3a:orange:power"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_blue: power-blue { - label = "bthomehubv3a:blue:power"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - ath9k@7000 { - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts deleted file mode 100644 index 2f7507469..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts +++ /dev/null @@ -1,282 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "bt,homehub-v5a", "lantiq,xway", "lantiq,vr9"; - model = "BT Home Hub 5A"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_blue; - - led-dsl = &broadband_blue; - led-wifi = &wireless_blue; - }; - - memory@0 { - reg = <0x0 0x8000000>; - }; - - fpi@10000000 { - localbus@0 { - nand-parts@0 { - compatible = "lantiq,nand-xway"; - lantiq,cs = <1>; - bank-width = <2>; - reg = <0x1 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - nand-on-flash-bbt; - nand-ecc-strength = <3>; - nand-ecc-step-size = <256>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0xa0000>; - read-only; - }; - partition@a0000 { - label = "uboot-env"; - reg = <0xa0000 0x20000>; - read-only; - }; - partition@c0000 { - label = "unused"; - reg = <0xc0000 0x40000>; - }; - partition@100000 { - label = "ubi"; - reg = <0x100000 0x7e80000>; - }; - /* - * last 512 KiB are for the bad block table, not writable - */ - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,output = <1>; - lantiq,open-drain; - }; - pcie_rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - lantiq,open-drain; - }; - usb_vbus { - lantiq,pins = "io33"; - lantiq,pull = <0>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - nand_out { - lantiq,groups = "nand cle", "nand ale"; - lantiq,function = "ebu"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - nand_cs1 { - lantiq,groups = "nand cs1"; - lantiq,function = "ebu"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - restart { - label = "restart"; - gpios = <&gpio 39 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - /* broadband-* is a single RGB led */ - broadband-red { - label = "bthomehubv5a:red:broadband"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - }; - broadband-green { - label = "bthomehubv5a:green:broadband"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - broadband_blue: broadband-blue { - label = "bthomehubv5a:blue:broadband"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - /* wireless-* is a single RGB led */ - wireless-red { - label = "bthomehubv5a:red:wireless"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - wireless-green { - label = "bthomehubv5a:green:wireless"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - wireless_blue: wireless-blue { - label = "bthomehubv5a:blue:wireless"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - - /* power-* is a single RGB led */ - power_red: power-red { - label = "bthomehubv5a:red:power"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - power_green: power-green { - label = "bthomehubv5a:green:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_blue: power-blue { - label = "bthomehubv5a:blue:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - dimmed { - label = "dimmed"; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@168c,002d { - compatible = "pci168c,002d"; - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - qca,disable-5ghz; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <1>; - phy-mode = "rgmii"; - phy-handle = <&phy1>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy1: ethernet-phy@1 { - reg = <0x1>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy5: ethernet-phy@5 { - reg = <0x5>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts deleted file mode 100644 index e5637efca..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts +++ /dev/null @@ -1,171 +0,0 @@ -/dts-v1/; - -#include "amazonse.dtsi" - -#include - -/ { - compatible = "netgear,dgn1000b", "lantiq,xway", "lantiq,ase"; - model = "Netgear DGN1000B"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - - led-dsl = &dsl; - led-internet = &online_green; - }; - - memory@0 { - reg = <0x0 0x1000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - asc { - lantiq,groups = "asc"; - lantiq,function = "asc"; - }; - keys_in { - lantiq,pins = "io0",/* "io25", */"io29"; - lantiq,pull = <2>; - lantiq,open-drain = <1>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs1"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mac-address = [ 00 11 22 33 44 55 ]; - }; - - spi@E100800 { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - m25p80@1 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <1 0>; - spi-max-frequency = <5000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x20000>; - label = "SPI (RO) U-Boot Image"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0x10000>; - label = "ENV_MAC"; - read-only; - }; - - partition@30000 { - reg = <0x30000 0x10000>; - label = "DPF"; - read-only; - }; - - partition@40000 { - reg = <0x40000 0x10000>; - label = "NVRAM"; - read-only; - }; - - partition@500000 { - reg = <0x50000 0x003a0000>; - label = "kernel"; - }; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - rfkill { - label = "rfkill"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - dsl: dsl { - label = "dgn1000b:green:dsl"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - online_green: online { - label = "dgn1000b:green:online"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - online2 { - label = "dgn1000b:red:online"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - wps { - label = "dgn1000b:green:wps"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - power: power { - label = "dgn1000b:green:power"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - /* - power red is missing - */ - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts deleted file mode 100644 index 98a2ebd98..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts +++ /dev/null @@ -1,8 +0,0 @@ -/dts-v1/; - -#include "DGN3500.dtsi" - -/ { - compatible = "netgear,dgn3500", "lantiq,xway", "lantiq,ar9"; - model = "Netgear DGN3500"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi deleted file mode 100644 index d58d71753..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi +++ /dev/null @@ -1,213 +0,0 @@ -#include "ar9.dtsi" - -#include - -/ { - chosen { - bootargs = "root= console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &internet; - led-usb = &usb; - led-wifi = &wifi_green; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci { - lantiq,groups = "gnt1", "req1"; - lantiq,function = "pci"; - }; - pci-in { - lantiq,groups = "req1"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - pci-out { - lantiq,groups = "gnt1"; - lantiq,output = <1>; - lantiq,pull = <0>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - }; - - ifxhcd@E101000 { - status = "okay"; - }; - }; - - rtl8366rb { - compatible = "realtek,rtl8366rb"; - gpio-sda = <&gpio 35 GPIO_ACTIVE_HIGH>; - gpio-sck = <&gpio 37 GPIO_ACTIVE_HIGH>; - - realtek,initvals = < - 0x0000 0x0830 - 0x0400 0x8130 - 0x000A 0x83ED - 0x0F51 0x0017 - 0x02F5 0x0048 - 0x02FA 0xFFDF - 0x02FB 0xFFE0 - 0x0450 0x0000 - 0x0401 0x0000 - 0x0431 0x0960 - >; - }; - - - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 36 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 53 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - internet: internet { - label = "dgn3500:green:internet"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; - internet2 { - label = "dgn3500:red:internet"; - gpios = <&gpio 30 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "dgn3500:green:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "dgn3500:green:usb"; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - }; - power_green: power { - label = "dgn3500:green:power"; - gpios = <&gpio 34 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power2 { - label = "dgn3500:red:power"; - gpios = <&gpio 39 GPIO_ACTIVE_LOW>; - }; - wifi_green: wifi { - label = "dgn3500:green:wireless"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - wifi2 { - label = "dgn3500:amber:wireless"; - gpios = <&gpio 51 GPIO_ACTIVE_LOW>; - }; - wps { - label = "dgn3500:green:wps"; - gpios = <&gpio 52 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@168c,0029 { - compatible = "pci168c,0029"; - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <20000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x10000>; - label = "uboot"; - read-only; - }; - - partition@10000 { - reg = <0x10000 0x10000>; - label = "uboot-env"; - read-only; - }; - - ath9k_cal: partition@20000 { - reg = <0x20000 0x10000>; - label = "calibration"; - read-only; - }; - - partition@50000 { - reg = <0x50000 0xfa0000>; - label = "firmware"; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts deleted file mode 100644 index d1d788cc7..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts +++ /dev/null @@ -1,8 +0,0 @@ -/dts-v1/; - -#include "DGN3500.dtsi" - -/ { - compatible = "netgear,dgn3500b", "lantiq,xway", "lantiq,ar9"; - model = "Netgear DGN3500B"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts deleted file mode 100644 index 3c8a2a1fa..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts +++ /dev/null @@ -1,215 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "netgear,dm200", "lantiq,xway", "lantiq,vr9"; - model = "Netgear DM200"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_amber; - led-running = &power_green; - - led-dsl = &dsl_green; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - }; - - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - pcie@d900000 { - status = "disabled"; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware = "lantiq/xrx200_phy22f_a22.bin"; - phys = [ 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - reset { - label = "reset"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - annexa { - gpio-export,name = "annexa"; - gpio-export,output = <0>; - gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - }; - annexb { - gpio-export,name = "annexb"; - gpio-export,output = <0>; - gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_amber: power_amber { - label = "dm200:amber:power"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - }; - power_green: power_green { - label = "dm200:green:power"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - }; - - lan_amber { - label = "dm200:amber:lan"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - lan_green { - label = "dm200:green:lan"; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - - dsl_amber { - label = "dm200:amber:dsl"; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - }; - dsl_green: dsl_green { - label = "dm200:green:dsl"; - gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x20000>; - label = "uboot"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0x10000>; - label = "gphyfirmware"; - read-only; - }; - - partition@30000 { - reg = <0x30000 0x7b0000>; - label = "firmware"; - }; - - partition@7e0000 { - reg = <0x7e0000 0x10000>; - label = "sysconfig"; - read-only; - }; - - partition@7f0000 { - reg = <0x7f0000 0x2000>; - label = "ubootconfig"; - read-only; - }; - - partition@7f2000 { - reg = <0x7f2000 0x1000>; - label = "ART"; - read-only; - }; - - partition@7f3000 { - reg = <0x7f3000 0x1000>; - label = "pot"; - read-only; - }; - - partition@7f4000 { - reg = <0x7f4000 0xc000>; - label = "ret"; - read-only; - }; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "mii"; - phy-handle = <&phy13>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts deleted file mode 100644 index ebd30a7c0..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts +++ /dev/null @@ -1,83 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -/ { - compatible = "lantiq,easy50712", "lantiq,xway", "lantiq,danube"; - model = "Intel EASY50712 Nand"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; /* 64 KB */ - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; /* 64 KB */ - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - partition@400000 { - label = "rootfs"; - reg = <0x400000 0x400000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - }; - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - }; - conf_out { - lantiq,pins = "io4", "io5", "io6"; /* stp */ - lantiq,open-drain; - lantiq,pull = <0>; - }; - }; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts deleted file mode 100644 index 605eb826a..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts +++ /dev/null @@ -1,93 +0,0 @@ -/dts-v1/; - -#include "ar9.dtsi" - -/ { - compatible = "lantiq,easy50810", "lantiq,xway", "lantiq,ar9"; - model = "Lantiq EASY50810"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; /* 64 KB */ - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; /* 64 KB */ - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; - - partition@400000 { - label = "rootfs"; - reg = <0x400000 0x400000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - }; - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - }; - conf_out { - lantiq,pins = "io4", "io5", "io6"; /* stp */ - lantiq,open-drain; - lantiq,pull = <0>; - }; - }; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - - stp0: stp@E100BB0 { - #gpio-cells = <2>; - compatible = "lantiq,gpio-stp-xway"; - gpio-controller; - reg = <0xE100BB0 0x40>; - - lantiq,shadow = <0xfff>; - lantiq,groups = <0x3>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi deleted file mode 100644 index b19b9713f..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi +++ /dev/null @@ -1,298 +0,0 @@ -#include "vr9.dtsi" - -#include - -/ { - compatible = "lantiq,easy80920", "lantiq,xway", "lantiq,vr9"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - - led-usb = &usb1; - led-usb2 = &usb2; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - exin3 { - lantiq,groups = "exin3"; - lantiq,function = "exin"; - }; - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - }; - nand { - lantiq,groups = "nand cle", "nand ale", - "nand rd", "nand rdy"; - lantiq,function = "ebu"; - }; - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - pci { - lantiq,groups = "gnt1", "req1"; - lantiq,function = "pci"; - }; - conf_out { - lantiq,pins = "io24", "io13", "io49", /* nand cle, ale and rd */ - "io4", "io5", "io6", /* stp */ - "io21", - "io33"; - lantiq,open-drain; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - conf_in { - lantiq,pins = "io39", /* exin3 */ - "io48"; /* nand rdy */ - lantiq,pull = <2>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - stp: stp@E100BB0 { - compatible = "lantiq,gpio-stp-xway"; - reg = <0xE100BB0 0x40>; - #gpio-cells = <2>; - gpio-controller; - - lantiq,shadow = <0xffff>; - lantiq,groups = <0x7>; - lantiq,dsl = <0x3>; - lantiq,phy1 = <0x7>; - lantiq,phy2 = <0x7>; - /* lantiq,rising; */ - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy11g_a14.bin"; - firmware2 = "lantiq/xrx200_phy11g_a22.bin"; - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; -/* reset { - label = "reset"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - linux,code = ; - };*/ - paging { - label = "paging"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power: power { - label = "easy80920:green:power"; - gpios = <&stp 9 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - warning { - label = "easy80920:green:warning"; - gpios = <&stp 22 GPIO_ACTIVE_HIGH>; - }; - fxs1 { - label = "easy80920:green:fxs1"; - gpios = <&stp 21 GPIO_ACTIVE_HIGH>; - }; - fxs2 { - label = "easy80920:green:fxs2"; - gpios = <&stp 20 GPIO_ACTIVE_HIGH>; - }; - fxo { - label = "easy80920:green:fxo"; - gpios = <&stp 19 GPIO_ACTIVE_HIGH>; - }; - usb1: usb1 { - label = "easy80920:green:usb1"; - gpios = <&stp 18 GPIO_ACTIVE_HIGH>; - }; - usb2: usb2 { - label = "easy80920:green:usb2"; - gpios = <&stp 15 GPIO_ACTIVE_HIGH>; - }; - sd { - label = "easy80920:green:sd"; - gpios = <&stp 14 GPIO_ACTIVE_HIGH>; - }; - wps { - label = "easy80920:green:wps"; - gpios = <&stp 12 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <1000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x20000>; - label = "SPI (RO) U-Boot Image"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0x10000>; - label = "ENV_MAC"; - read-only; - }; - - partition@30000 { - reg = <0x30000 0x10000>; - label = "DPF"; - read-only; - }; - - partition@40000 { - reg = <0x40000 0x10000>; - label = "NVRAM"; - read-only; - }; - - partition@500000 { - reg = <0x50000 0x003a0000>; - label = "kernel"; - }; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - lantiq,switch; - - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <1>; - phy-mode = "rgmii"; - phy-handle = <&phy1>; - }; - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - }; - }; - - wan: interface@1 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <1>; - lantiq,wan; - - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy1: ethernet-phy@1 { - reg = <0x1>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy5: ethernet-phy@5 { - reg = <0x5>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts deleted file mode 100644 index 095bd564d..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts +++ /dev/null @@ -1,68 +0,0 @@ -/dts-v1/; - - -#include "EASY80920.dtsi" - -/ { - compatible = "lantiq,easy80920-nand", "lantiq,easy80920", "lantiq,xway", "lantiq,vr9"; - model = "Intel EASY80920 Nand"; - - chosen { - bootargs = "ubi.mtd=ubi ubi.block=0,rootfsA root=/dev/ubiblock0_1"; - }; - - fpi@10000000 { - localbus@0 { - ranges = <0 0 0x4000000 0x3ffffff>; - nand-parts@0 { - compatible = "lantiq,nand-xway"; - lantiq,cs = <1>; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x100000>; /* 1024 KB */ - }; - - partition@100000 { - label = "uboot_env"; - reg = <0x100000 0x40000>; /* 256 KB */ - }; - - partition@140000 { - label = "ubootconfigB"; - reg = <0x140000 0x40000>; /* 256 KB */ - }; - - partition@180000 { - label = "gphyfirmware"; - reg = <0x180000 0x40000>; /* 256 KB */ - }; - - partition@1c0000 { - label = "ubi"; - reg = <0x1c0000 0xc800000>; - }; - - partition@c9c0000 { - label = "calibration"; - reg = <0xc9c0000 0x100000>; - }; - - partition@cac0000 { - label = "res"; - reg = <0xcac0000 0x13540000>; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts deleted file mode 100644 index e273138d8..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts +++ /dev/null @@ -1,43 +0,0 @@ -/dts-v1/; - - -#include "EASY80920.dtsi" - -/ { - compatible = "lantiq,easy80920-nor", "lantiq,easy80920", "lantiq,xway", "lantiq,vr9"; - model = "Intel EASY80920 Nor"; - - fpi@10000000 { - localbus@0 { - ranges = <0 0 0x0 0x3ffffff>; - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x10000>; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x10000 0x10000>; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7e0000>; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts deleted file mode 100644 index a9c5b3c24..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts +++ /dev/null @@ -1,106 +0,0 @@ -/dts-v1/; - -#include -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon FTTDP8 Reference Board"; - compatible = "lantiq,easy88388", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - gpio-keys { - compatible = "gpio-keys"; - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = <0x198>; - }; - }; - - pinctrl { - led_pins: led-pins { - lantiq,pins = "io34", "io35", "io36", "io37", "io38", - "io39", "io40", "io41"; - lantiq,function = "gpio"; - }; - }; - - easy88388-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins &bootled_pins>; - - GPON { - label = "easy88388:green:gpon"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - TEST { - label = "easy88388:green:test"; - gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - STATUS { - label = "easy88388:green:status"; - gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - ERROR { - label = "easy88388:red:error"; - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - DSL1 { - label = "easy88388:dsl:1"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL2 { - label = "easy88388:dsl:2"; - gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL3 { - label = "easy88388:dsl:3"; - gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL4 { - label = "easy88388:dsl:4"; - gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL5 { - label = "easy88388:dsl:5"; - gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL6 { - label = "easy88388:dsl:6"; - gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL7 { - label = "easy88388:dsl:7"; - gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - DSL8 { - label = "easy88388:dsl:8"; - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - }; -}; - diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts deleted file mode 100644 index ceb81ea13..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts +++ /dev/null @@ -1,80 +0,0 @@ -/dts-v1/; - -#include -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon FTTdp G.FAST Reference Board"; - compatible = "lantiq,easy88444", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - gpio-keys { - compatible = "gpio-keys"; - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = <0x198>; - }; - }; - - pinctrl { - led_pins: led-pins { - lantiq,pins = "io34", "io35", "io37"; - lantiq,function = "gpio"; - }; - }; - - easy88444-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins &bootled_pins>; - - GPON { - label = "easy88444:green:gpon"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - TEST { - label = "easy88444:green:test"; - gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - STATUS { - label = "easy88444:green:status"; - gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - GFAST1 { - label = "easy88444:gfast:1"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - GFAST2 { - label = "easy88444:gfast:2"; - gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - GFAST3 { - label = "easy88444:gfast:3"; - gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - GFAST4 { - label = "easy88444:gfast:4"; - gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - }; -}; - diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi deleted file mode 100644 index cfe1140ac..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include - -/ { - compatible = "lantiq,easy98000", "lantiq,falcon"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - easy98000-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&bootled_pins>; - - LED_0 { - label = "easy98000:green:gpon"; - gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_1 { - label = "easy98000:red:gpon"; - gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_2 { - label = "easy98000:green:gpon_tx"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_3 { - label = "easy98000:green:gpon_rx"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_4 { - label = "easy98000:green:voice"; - gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_5 { - label = "easy98000:green:status"; - gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - }; -}; - -&ebu_cs1 { - eth0: ethernet@0000000 { - compatible = "davicom,dm9000"; - device_type = "network"; - reg = <0x0000003 0x1>, <0x0000001 0x1>; - reg-names = "addr", "data"; - interrupt-parent = <&gpio1>; - #interrupt-cells = <2>; - interrupts = <10 IRQ_TYPE_LEVEL_LOW>; - local-mac-address = [ 00 00 00 00 00 00 ]; - }; - - cpld@3c00000 { - compatible = "lantiq,easy98000_addon"; - reg = <0x3c00000 0x2>; - }; - - cpld@3c0000c { - compatible = "lantiq,easy98000_cpld_led"; - reg = <0x3c0000c 0x2>, <0x3c00012 0x2>; - }; -}; - -/* // enable this for second uart: -&serial1 { - status = "okay"; -};*/ - -&spi { - status = "okay"; - - eeprom@1 { - compatible = "atmel,at25", "atmel,at25160n"; - reg = <2>; - spi-max-frequency = <1000000>; - spi-cpha; - spi-cpol; - - pagesize = <32>; - size = <2048>; - address-width = <16>; - }; -}; - -&i2c { - status = "okay"; - - clock-frequency = <100000>; - - /* eeprom-emulation by OMU */ - eeprom@50 { - compatible = "at,24c02"; - reg = <0x50>; - }; - eeprom@51 { - compatible = "at,24c02"; - reg = <0x51>; - }; -}; - diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts deleted file mode 100644 index a40cef393..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts +++ /dev/null @@ -1,40 +0,0 @@ -/dts-v1/; - -#include "falcon.dtsi" -#include "EASY98000-base.dtsi" - -/ { - model = "Lantiq Falcon (NAND)"; - compatible = "lantiq,easy98000-nand", "lantiq,easy98000", "lantiq,falcon"; - - aliases { - spi0 = &spi; - }; -}; - -&ebu_cs0 { - gen_nand@0 { - compatible = "gen_nand", "lantiq,nand-falcon"; - bank-width = <1>; - reg = <0x0 0x40000>; - #address-cells = <1>; - #size-cells = <1>; - linux,mtd-name = "gen_nand"; - bbt-use-flash; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x40000 0x40000>; - }; - - partition@20000 { - label = "linux"; - reg = <0x80000 0x3d0000>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts deleted file mode 100644 index ad53bf96e..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts +++ /dev/null @@ -1,38 +0,0 @@ -/dts-v1/; - -#include "falcon.dtsi" -#include "EASY98000-base.dtsi" - -/ { - model = "Lantiq Falcon (NOR)"; - compatible = "lantiq,easy98000-nor", "lantiq,easy98000", "lantiq,falcon"; - - aliases { - spi0 = &spi; - }; -}; - -&ebu_cs0 { - cfi@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0x0 0x4000000>; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x40000 0x40000>; - }; - - partition@20000 { - label = "linux"; - reg = <0x80000 0x3d0000>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts deleted file mode 100644 index bbe524e94..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts +++ /dev/null @@ -1,16 +0,0 @@ -/dts-v1/; - -#include "falcon.dtsi" -#include "EASY98000-base.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon (SFLASH)"; - compatible = "lantiq,easy98000-sflash", "lantiq,easy98000", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - spi1 = &spi; - }; -}; - diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts deleted file mode 100644 index c0970ef48..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts +++ /dev/null @@ -1,95 +0,0 @@ -/dts-v1/; - -#include - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon Reference Board"; - compatible = "lantiq,easy98020", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - gpio-keys { - compatible = "gpio-keys"; - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = <0x198>; - }; - }; - - pinctrl { - led_pins: phy-led-pins { - lantiq,pins = "io42", "io41", "io38", "io37"; - lantiq,function = "gpio"; - }; - }; - - easy98020-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&bootled_pins>; - - GPON { - label = "easy98020:green:gpon"; - gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - TEST { - label = "easy98020:green:test"; - gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - ETH { - label = "easy98020:green:status"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - VOICE { - label = "easy98020:green:voice"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - VIDEO { - label = "easy98020:green:video"; - gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - }; - - easy98020-phy-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins>; - - GE0_ACT { - label = "easy98020:ge0_act"; - gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - GE0_LINK { - label = "easy98020:ge0_link"; - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - GE1_ACT { - label = "easy98020:ge1_act"; - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - GE1_LINK { - label = "easy98020:ge1_link"; - gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts deleted file mode 100644 index 9aa1be91e..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts +++ /dev/null @@ -1,68 +0,0 @@ -/dts-v1/; - -#include - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon Reference Board V1.8"; - compatible = "lantiq,easy98020-v18", "lantiq,easy98020", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - gpio-keys { - compatible = "gpio-keys"; - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = <0x198>; - }; - }; - - pinctrl { - led_pins: led-pins { - lantiq,pins = "io11", "io14", "io36", "io37", "io38"; - lantiq,function = "gpio"; - }; - }; - - easy98020-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins &bootled_pins>; - - GPON { - label = "easy98020:green:gpon"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - TEST { - label = "easy98020:green:test"; - gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - ETH { - label = "easy98020:green:status"; - gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - VOICE { - label = "easy98020:green:voice"; - gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - VIDEO { - label = "easy98020:green:video"; - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts deleted file mode 100644 index 7b2e490fc..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts +++ /dev/null @@ -1,81 +0,0 @@ -/dts-v1/; - -#include - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon HGU Reference Board"; - compatible = "lantiq,easy98021", "lantiq,easy98020", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - gpio-keys { - compatible = "gpio-keys"; - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = <0x198>; - }; - }; - - gpio-mmc { - /* Place-holder for SIM-Card connector, - to list the used GPIOs, no official binding */ - compatible = "gpio-mmc"; - gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>, - <&gpio0 3 GPIO_ACTIVE_HIGH>, - <&gpio0 2 GPIO_ACTIVE_HIGH>, - <0>; /* no CS */ - gpio-names = "di", "do", "clk", "cs"; - reset-gpio = <&gpio3 24 GPIO_ACTIVE_HIGH>; - }; - - pinctrl { - led_pins: led-pins { - lantiq,pins = "io11", "io14", "io36", "io37", "io38"; - lantiq,function = "gpio"; - }; - }; - - easy98021-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins &bootled_pins>; - - GPON { - label = "easy98021:green:gpon"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - TEST { - label = "easy98021:red:test"; - gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - ETH { - label = "easy98021:green:status"; - gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - VOICE { - label = "easy98021:green:voice"; - gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - SIMCARD { - label = "easy98021:green:simcard"; - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - }; -}; - diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts deleted file mode 100644 index df941cdb6..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts +++ /dev/null @@ -1,76 +0,0 @@ -/dts-v1/; - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon SFP Stick with SyncE"; - compatible = "lantiq,easy98035synce", "lantiq,falcon-sfp", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - pinctrl { - compatible = "lantiq,pinctrl-falcon"; - - asc0_func1: func1 { - func1_tx { - lantiq,pins = "io32"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - func1_rx { - lantiq,pins = "io33"; - lantiq,mux = <0>; - }; - }; - asc0_func2: func2 { - func2_tx { - lantiq,pins = "io32"; - lantiq,mux = <0>; - }; - func2_rx { - lantiq,pins = "io33"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - }; - asc0_func3: func3 { - func3_tx { - lantiq,pins = "io32"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - func3_rx { - lantiq,pins = "io33"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - }; - }; - - pinselect-asc0 { - compatible = "lantiq,pinselect-asc0"; - pinctrl-names = "asc0", "func1", "func2", "func3"; - pinctrl-0 = <&asc0_pins>; - pinctrl-1 = <&asc0_func1>; - pinctrl-2 = <&asc0_func2>; - pinctrl-3 = <&asc0_func3>; - }; -}; - -&serial0 { - pinctrl-names = "default"; - /* use "empty" pinctrl to leave setting from u-boot enabled */ - pinctrl-0 = < >; -}; - -&i2c { - status = "okay"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts deleted file mode 100644 index a3abc6e70..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts +++ /dev/null @@ -1,76 +0,0 @@ -/dts-v1/; - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon SFP Stick with SyncE/1588"; - compatible = "lantiq,easy98035synce1588", "lantiq,falcon-sfp", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - pinctrl { - compatible = "lantiq,pinctrl-falcon"; - - asc0_func1: func1 { - func1_tx { - lantiq,pins = "io32"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - func1_rx { - lantiq,pins = "io33"; - lantiq,mux = <0>; - }; - }; - asc0_func2: func2 { - func2_tx { - lantiq,pins = "io32"; - lantiq,mux = <0>; - }; - func2_rx { - lantiq,pins = "io33"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - }; - asc0_func3: func3 { - func3_tx { - lantiq,pins = "io32"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - func3_rx { - lantiq,pins = "io33"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - }; - }; - - pinselect-asc0 { - compatible = "lantiq,pinselect-asc0"; - pinctrl-names = "asc0", "func1", "func2", "func3"; - pinctrl-0 = <&asc0_pins>; - pinctrl-1 = <&asc0_func1>; - pinctrl-2 = <&asc0_func2>; - pinctrl-3 = <&asc0_func3>; - }; -}; - -&serial0 { - pinctrl-names = "default"; - /* use "empty" pinctrl to leave setting from u-boot enabled */ - pinctrl-0 = < >; -}; - -&i2c { - status = "okay"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts deleted file mode 100644 index 6710bbe98..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts +++ /dev/null @@ -1,53 +0,0 @@ -/dts-v1/; - -#include - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon / Vinax MDU Board"; - compatible = "lantiq,falcon-mdu", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - mdu-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&bootled_pins>; - - LED_0 { - label = "mdu:green:gpon"; - gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_1 { - label = "mdu:green:status"; - gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_2 { - label = "mdu:green:2"; - gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_3 { - label = "mdu:green:3"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - LED_4 { - label = "mdu:green:4"; - gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - }; -}; - diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts deleted file mode 100644 index 8d45de4eb..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts +++ /dev/null @@ -1,76 +0,0 @@ -/dts-v1/; - -#include "falcon.dtsi" -#include "falcon-sflash-16M.dtsi" - -/ { - model = "Lantiq Falcon SFP Stick"; - compatible = "lantiq,falcon-sfp", "lantiq,falcon"; - - aliases { - spi0 = &ebu_cs0; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; // 64M at 0x0 - }; - - pinctrl { - compatible = "lantiq,pinctrl-falcon"; - - asc0_func1: func1 { - func1_tx { - lantiq,pins = "io32"; - lantiq,mux = <1>; - lantiq,output = <0>; - }; - func1_rx { - lantiq,pins = "io33"; - lantiq,mux = <0>; - }; - }; - asc0_func2: func2 { - func2_tx { - lantiq,pins = "io32"; - lantiq,mux = <0>; - }; - func2_rx { - lantiq,pins = "io33"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - }; - asc0_func3: func3 { - func3_tx { - lantiq,pins = "io32"; - lantiq,mux = <1>; - lantiq,output = <0>; - }; - func3_rx { - lantiq,pins = "io33"; - lantiq,mux = <1>; - lantiq,input = <0>; - }; - }; - }; - - pinselect-asc0 { - compatible = "lantiq,pinselect-asc0"; - pinctrl-names = "asc0", "func1", "func2", "func3"; - pinctrl-0 = <&asc0_pins>; - pinctrl-1 = <&asc0_func1>; - pinctrl-2 = <&asc0_func2>; - pinctrl-3 = <&asc0_func3>; - }; -}; - -&serial0 { - pinctrl-names = "default"; - /* use "empty" pinctrl to leave setting from u-boot enabled */ - pinctrl-0 = < >; -}; - -&i2c { - status = "okay"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts deleted file mode 100644 index ef3655de6..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts +++ /dev/null @@ -1,288 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "avm,fritz3370", "lantiq,xway", "lantiq,vr9"; - model = "Fritz!Box WLAN 3370"; - - chosen { - bootargs = "console=ttyLTQ0,115200 ubi.mtd=1,512 root=/dev/mtdblock9"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &info_green; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x8000000>; - }; - - fpi@10000000 { - localbus@0 { - nand-parts@0 { - compatible = "lantiq,nand-xway"; - bank-width = <2>; - reg = <1 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x0 0x400000>; - }; - - partition@400000 { - label = "rootfs_ubi"; - reg = <0x400000 0x3000000>; - }; - - partition@3400000 { - label = "vr9_firmware"; - reg = <0x3400000 0x400000>; - }; - partition@3800000 { - label = "reserved"; - reg = <0x3800000 0x3000000>; - }; - partition@6800000 { - label = "config"; - reg = <0x6800000 0x200000>; - }; - partition@6a00000 { - label = "nand-filesystem"; - reg = <0x6a00000 0x1600000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - nand { - lantiq,groups = "nand cle", "nand ale", - "nand rd", "nand cs1", "nand rdy"; - lantiq,function = "ebu"; - lantiq,pull = <1>; - }; - phy-rst { - lantiq,pins = "io37", "io44"; - lantiq,pull = <0>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 5 GPIO_ACTIVE_HIGH - &gpio 14 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware = "lantiq/xrx200_phy11g_a14.bin"; - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - power { - label = "power"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; -/* wifi { - label = "wifi"; - gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; - linux,code = ; - };*/ - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power { - label = "fritz3370:green:power"; - gpios = <&gpio 32 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power2 { - label = "fritz3370:red:power"; - gpios = <&gpio 33 GPIO_ACTIVE_LOW>; - }; - info_red { - label = "fritz3370:red:info"; - gpios = <&gpio 34 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "fritz3370:green:wlan"; - gpios = <&gpio 35 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "fritz3370:green:dsl"; - gpios = <&gpio 36 GPIO_ACTIVE_LOW>; - }; - lan { - label = "fritz3370:green:lan"; - gpios = <&gpio 38 GPIO_ACTIVE_LOW>; - }; - info_green: info_green { - label = "fritz3370:green:info"; - gpios = <&gpio 47 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <1000000>; - - urlader: partition@0 { - reg = <0x0 0x20000>; - label = "urlader"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0x10000>; - label = "tffs (1)"; - read-only; - }; - - partition@30000 { - reg = <0x30000 0x10000>; - label = "tffs (2)"; - read-only; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&urlader 0x987>; - mtd-mac-address-increment = <(-2)>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <1>; - phy-mode = "rgmii"; - phy-handle = <&phy1>; - gpios = <&gpio 44 GPIO_ACTIVE_HIGH>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy1: ethernet-phy@1 { - reg = <0x1>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; - -&pcie0 { - pcie@0 { - reg = <0 0 0 0 0>; - #interrupt-cells = <1>; - #size-cells = <2>; - #address-cells = <3>; - device_type = "pci"; - - wifi@0,0 { - compatible = "pci0,0"; - reg = <0 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts deleted file mode 100644 index 34d0df9b3..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts +++ /dev/null @@ -1,161 +0,0 @@ -/dts-v1/; - -#include "ar9.dtsi" - -#include - -/ { - compatible = "avm,fritz7320", "lantiq,xway", "lantiq,ar9"; - model = "1&1 HomeServer"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - - led-internet = &info_green; - led-dsl = &power; - led-wifi = &wlan; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x1000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - ath9k_cal: partition@0 { - label = "urlader"; - reg = <0x00000 0x20000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0xf60000>; - }; - - partition@f80000 { - label = "tffs (1)"; - reg = <0xf80000 0x40000>; - read-only; - }; - - partition@fc0000 { - label = "tffs (2)"; - reg = <0xfc0000 0x40000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - pci { - lantiq,groups = "gnt1", "req1", "req2", "req3", "req4", "gnt2", "gnt3", "gnt4"; - lantiq,function = "pci"; - }; - pci-in { - lantiq,groups = "req1", "req2", "req3", "req4"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - pci-out { - lantiq,groups = "gnt1", "gnt2", "gnt3", "gnt4"; - lantiq,output = <1>; - lantiq,pull = <0>; - }; - }; - }; - - etop@E180000 { - phy-mode = "mii"; - mtd-mac-address = <&ath9k_cal 0xa91>; - mtd-mac-address-increment = <(-2)>; - }; - - ifxhcd@E101000 { - status = "okay"; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - rfkill { - label = "rfkill"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - dect { - label = "dect"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power: power { - label = "fritz7320:green:power"; - gpios = <&gpio 44 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - voice { - label = "fritz7320:green:fon"; - gpios = <&gpio 47 GPIO_ACTIVE_LOW>; - }; - dect { - label = "fritz7320:green:dect"; - gpios = <&gpio 38 GPIO_ACTIVE_LOW>; - }; - wlan: wlan { - label = "fritz7320:green:wlan"; - gpios = <&gpio 37 GPIO_ACTIVE_LOW>; - }; - info_green: info_green { - label = "fritz7320:green:info"; - gpios = <&gpio 35 GPIO_ACTIVE_LOW>; - }; - info_red { - label = "fritz7320:red:info"; - gpios = <&gpio 45 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - req-mask = <0xf>; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@0,0 { - compatible = "pci0,0"; - reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts deleted file mode 100644 index b16487110..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts +++ /dev/null @@ -1,228 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "avm,fritz7360sl", "lantiq,xway", "lantiq,vr9"; - model = "1&1 HomeServer"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &info_green; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x8000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x1000000>; - #address-cells = <1>; - #size-cells = <1>; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - urlader: partition@0 { - label = "urlader"; - reg = <0x00000 0x20000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0xf60000>; - }; - - partition@f80000 { - label = "tffs (1)"; - reg = <0xf80000 0x40000>; - read-only; - }; - - partition@fc0000 { - label = "tffs (2)"; - reg = <0xfc0000 0x40000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - phy-rst { - lantiq,pins = "io37", "io44"; - lantiq,pull = <0>; - lantiq,open-drain; - lantiq,output = <1>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - lantiq,portmask = <0x3>; - }; - - ifxhcd@E106000 { - status = "okay"; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware = "lantiq/xrx200_phy11g_a22.bin"; - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - dect { - label = "dect"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; - wifi { - label = "wifi"; - gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power { - label = "fritz7360sl:green:power"; - gpios = <&gpio 32 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power2 { - label = "fritz7360sl:red:power"; - gpios = <&gpio 33 GPIO_ACTIVE_LOW>; - }; - info_red { - label = "fritz7360sl:red:info"; - gpios = <&gpio 34 GPIO_ACTIVE_LOW>; - }; - info_green: info_green { - label = "fritz7360sl:green:info"; - gpios = <&gpio 47 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "fritz7360sl:green:wlan"; - gpios = <&gpio 36 GPIO_ACTIVE_LOW>; - }; - dect { - label = "fritz7360sl:green:dect"; - gpios = <&gpio 35 GPIO_ACTIVE_LOW>; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&urlader 0xa91>; - mtd-mac-address-increment = <(-2)>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rmii"; - phy-handle = <&phy0>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <1>; - phy-mode = "rmii"; - phy-handle = <&phy1>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x00>; - compatible = "ethernet-phy-ieee802.3-c22"; - reset-gpios = <&gpio 37 GPIO_ACTIVE_LOW>; - }; - phy1: ethernet-phy@1 { - reg = <0x01>; - compatible = "ethernet-phy-ieee802.3-c22"; - reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; - -&pcie0 { - pcie@0 { - reg = <0 0 0 0 0>; - #interrupt-cells = <1>; - #size-cells = <2>; - #address-cells = <3>; - device_type = "pci"; - - wifi@168c,002e { - compatible = "pci168c,002e"; - reg = <0 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts deleted file mode 100644 index 99ccbce29..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts +++ /dev/null @@ -1,122 +0,0 @@ -/dts-v1/; - -#include "danube.dtsi" - -#include - -/ { - compatible = "siemens,gigaset-sx76x", "lantiq,xway", "lantiq,danube"; - model = "Gigaset SX761,SX762,SX763"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpiomm 1 GPIO_ACTIVE_HIGH>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - }; - - partition@10000 { - label = "uboot_env"; - reg = <0x30000 0x10000>; - }; - - partition@40000 { - label = "firmware"; - reg = <0x40000 0x7c0000>; - }; - }; - }; - - gpiomm: gpiomm@4000000 { - compatible = "lantiq,gpio-mm"; - reg = <1 0x0 0x10 >; - #address-cells = <1>; - #size-cells = <1>; - #gpio-cells = <2>; - gpio-controller; - lantiq,shadow = <0x3>; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - }; - }; - }; - - gpios: stp@E100BB0 { - status = "okay"; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; - }; - - pci@E105400 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; - }; - - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - switch { - gpio-export,name = "switch"; - gpio-export,output = <1>; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts deleted file mode 100644 index 01016f45c..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts +++ /dev/null @@ -1,159 +0,0 @@ -/dts-v1/; - -#include "ar9.dtsi" - -#include - -/ { - compatible = "zte,h201l", "lantiq,xway", "lantiq,ar9"; - model = "ZTE H210L"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_green; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &online; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x20000>; - read-only; - }; - - partition@20000 { - label = "uboot_env"; - reg = <0x20000 0x10000>; - read-only; - }; - - partition@30000 { - label = "firmware"; - reg = <0x30000 0x7d0000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - }; - }; - - etop@E180000 { - phy-mode = "rgmii"; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 53 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - rfkill { - label = "rfkill"; - gpios = <&gpio 55 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power { - label = "h201l:green:power"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - online: online { - label = "h201l:green:internet"; - gpios = <&gpio 37 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "h201l:green:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - phone { - label = "h201l:green:phone"; - gpios = <&gpio 39 GPIO_ACTIVE_LOW>; - }; - wps { - label = "h201l:green:wps"; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "h201l:green:wlan"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "h201l:green:usb"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - }; - - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - switch { - gpio-export,name = "switch"; - gpio-export,output = <1>; - gpios = <&gpio 38 GPIO_ACTIVE_HIGH>; - }; - usb { - gpio-export,name = "usb"; - gpio-export,output = <1>; - gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; - }; - wifi { - gpio-export,name = "wifi"; - gpio-export,output = <1>; - gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts deleted file mode 100644 index 1b885ad84..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts +++ /dev/null @@ -1,190 +0,0 @@ -/dts-v1/; - -#include "ar9.dtsi" - -#include - -/ { - compatible = "zyxel,p-2601hn", "lantiq,xway", "lantiq,ar9"; - model = "ZyXEL P-2601HN-Fx"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &online; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x20000>; - read-only; - }; - - partition@60000 { - label = "firmware"; - reg = <0x60000 0xfa0000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - lantiq,pull = <2>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - exin { - lantiq,groups = "exin1"; - lantiq,function = "exin"; - }; - pci { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - }; - conf_out { - lantiq,pins = "io4", "io5", "io6"; - lantiq,open-drain; - lantiq,pull = <0>; - }; - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - }; - }; - - etop@E180000 { - phy-mode = "rmii"; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; - }; - - stp: stp@E100BB0 { - #gpio-cells = <2>; - compatible = "lantiq,gpio-stp-xway"; - gpio-controller; - reg = <0xE100BB0 0x40>; - - lantiq,shadow = <0xfff>; - lantiq,groups = <0x3>; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 53 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - rfkill { - label = "rfkill"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power { - label = "p2601hnfx:green:power"; - gpios = <&stp 11 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power2 { - label = "p2601hnfx:red:power"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - }; - online: online { - label = "p2601hnfx:green:internet"; - gpios = <&stp 13 GPIO_ACTIVE_LOW>; - }; - online2 { - label = "p2601hnfx:red:internet"; - gpios = <&stp 12 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "p2601hnfx:green:dsl"; - gpios = <&stp 14 GPIO_ACTIVE_LOW>; - }; - phone { - label = "p2601hnfx:green:phone"; - gpios = <&stp 9 GPIO_ACTIVE_LOW>; - }; - phone2 { - label = "p2601hnfx:orange:phone"; - gpios = <&stp 8 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "p2601hnfx:green:wireless"; - gpios = <&stp 15 GPIO_ACTIVE_LOW>; - }; - wifi2 { - label = "p2601hnfx:orange:wireless"; - gpios = <&stp 10 GPIO_ACTIVE_LOW>; - }; - }; - - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - switch { - gpio-export,name = "switch"; - gpio-export,output = <1>; - gpios = <&gpio 50 GPIO_ACTIVE_HIGH>; - }; - usb { - gpio-export,name = "wifi"; - gpio-export,output = <1>; - gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts deleted file mode 100644 index 4a29cd929..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts +++ /dev/null @@ -1,72 +0,0 @@ -/dts-v1/; - -#include "P2812HNUFX.dtsi" - -/ { - compatible = "zyxel,p-2812hnu-f1", "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9"; - model = "ZyXEL P-2812HNU-F1"; - - aliases { - led-usb = &usb1; - led-usb2 = &usb2; - }; - - fpi@10000000 { - localbus@0 { - nand-parts@0 { - compatible = "lantiq,nand-xway"; - lantiq,cs = <1>; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - }; - partition@40000 { - label = "uboot-env"; - reg = <0x40000 0x20000>; - }; - partition@60000 { - label = "kernel"; - reg = <0x60000 0x200000>; - }; - partition@260000 { - label = "ubi"; - reg = <0x260000 0x7da0000>; - }; - }; - }; - }; - - pcie@d900000 { - status = "disabled"; - }; - }; - - gpio-leds { - usb1: usb1 { - label = "p2812hnuf1:green:usb1"; - gpios = <&gpio 38 GPIO_ACTIVE_LOW>; - }; - usb2: usb2 { - label = "p2812hnuf1:green:usb2"; - gpios = <&gpio 44 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - wifi@1814,3062 { - compatible = "pci1814,3062"; - reg = <0x7000 0 0 0 0>; - ralink,eeprom = "RT3062.eeprom"; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts deleted file mode 100644 index d37ad0a8e..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts +++ /dev/null @@ -1,66 +0,0 @@ -/dts-v1/; - -#include "P2812HNUFX.dtsi" - -/ { - compatible = "zyxel,p-2812hnu-f3", "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9"; - model = "ZyXEL P-2812HNU-F3"; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x50000>; - read-only; - }; - partition@50000 { - label = "uboot-env"; - reg = <0x50000 0x10000>; - }; - partition@60000 { - label = "unused"; - reg = <0x60000 0x7a0000>; - }; - }; - }; - - nand-parts@0 { - compatible = "lantiq,nand-xway"; - lantiq,cs = <1>; - bank-width = <2>; - reg = <1 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x0 0x200000>; - }; - partition@200000 { - label = "ubi"; - reg = <0x200000 0x7e00000>; - }; - }; - }; - }; -}; - -&pci0 { - wifi@1814,3092 { - compatible = "pci1814,3092"; - reg = <0x7000 0 0 0 0>; - ralink,eeprom = "RT3092.eeprom"; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi deleted file mode 100644 index ec3bd1033..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi +++ /dev/null @@ -1,280 +0,0 @@ -#include "vr9.dtsi" - -#include - -/ { - compatible = "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl_green; - led-internet = &internet_green; - led-wifi = &wireless_green; - }; - - memory@0 { - reg = <0x0 0x8000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - exin3 { - lantiq,groups = "exin3"; - lantiq,function = "exin"; - }; - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - gphy-leds { - lantiq,groups = "gphy0 led1", "gphy1 led1", - "gphy0 led2", "gphy1 led2"; - lantiq,function = "gphy"; - lantiq,pull = <2>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - lantiq,pull = <2>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - pci-in { - lantiq,groups = "req1"; - lantiq,function = "pci"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - pci-out { - lantiq,groups = "gnt1"; - lantiq,function = "pci"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <2>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - ifxhcd-rst { - lantiq,pins = "io33"; - lantiq,pull = <0>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - nand_out { - lantiq,groups = "nand cle", "nand ale"; - lantiq,function = "ebu"; - lantiq,output = <1>; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - nand_cs1 { - lantiq,groups = "nand cs1"; - lantiq,function = "ebu"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - }; - }; - }; - - stp: stp@E100BB0 { - compatible = "lantiq,gpio-stp-xway"; - reg = <0xE100BB0 0x40>; - #gpio-cells = <2>; - gpio-controller; - - lantiq,shadow = <0xffffff>; - lantiq,groups = <0x7>; - lantiq,dsl = <0x0>; - lantiq,phy1 = <0x0>; - lantiq,phy2 = <0x0>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - - ifxhcd@E106000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - - pci@E105400 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 39 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - rfkill { - label = "rfkill"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - internet_red { - label = "p2812hnufx:red:internet"; - gpios = <&stp 16 GPIO_ACTIVE_LOW>; - }; - internet_green: internet_green { - label = "p2812hnufx:green:internet"; - gpios = <&stp 17 GPIO_ACTIVE_LOW>; - }; - dsl_green: dsl_green { - label = "p2812hnufx:green:dsl"; - gpios = <&stp 18 GPIO_ACTIVE_LOW>; - }; - dsl_orange { - label = "p2812hnufx:orange:dsl"; - gpios = <&stp 19 GPIO_ACTIVE_LOW>; - }; - wireless_orange { - label = "p2812hnufx:orange:wlan"; - gpios = <&stp 20 GPIO_ACTIVE_LOW>; - }; - wireless_green: wireless_green { - label = "p2812hnufx:green:wlan"; - gpios = <&stp 21 GPIO_ACTIVE_LOW>; - }; - power_red: power { - label = "p2812hnufx:red:power"; - gpios = <&stp 22 GPIO_ACTIVE_LOW>; - }; - power_green: power2 { - label = "p2812hnufx:green:power"; - gpios = <&stp 23 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - phone1 { - label = "p2812hnufx:green:phone"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - phone1warn { - label = "p2812hnufx:orange:phone"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - phone2warn { - label = "p2812hnufx:orange:phone2"; - gpios = <&gpio 26 GPIO_ACTIVE_LOW>; - }; - phone2 { - label = "p2812hnufx:green:phone2"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mac-address = [ 00 11 22 33 44 55 ]; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <1>; - phy-mode = "rgmii"; - phy-handle = <&phy1>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy1: ethernet-phy@1 { - reg = <0x1>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy5: ethernet-phy@5 { - reg = <0x5>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts deleted file mode 100644 index 25eb3dac6..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts +++ /dev/null @@ -1,8 +0,0 @@ -/dts-v1/; - -#include "TDW89X0.dtsi" - -/ { - compatible = "tplink,tdw8970", "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; - model = "TP-LINK TD-W8970"; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts deleted file mode 100644 index def34b55b..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts +++ /dev/null @@ -1,35 +0,0 @@ -/dts-v1/; - -#include "TDW89X0.dtsi" - -/ { - compatible = "tplink,tdw8980", "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; - model = "TP-LINK TD-W8980"; - - fpi@10000000 { - gpio: pinmux@E100B10 { - state_default: pinmux { - pci_rst { - lantiq,pins = "io21"; - lantiq,output = <1>; - lantiq,open-drain; - }; - }; - }; - - pci@E105400 { - status = "okay"; - lantiq,bus-clock = <33333333>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; - interrupt-map = <0x7000 0 0 1 &icu0 30 1>; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio-leds { - wifi2 { - label = "tdw8980:green:wlan5ghz"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi deleted file mode 100644 index a629d92e4..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi +++ /dev/null @@ -1,274 +0,0 @@ -#include "vr9.dtsi" - -#include - -/ { - compatible = "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - /* the power led can't be controlled, use the wps led instead */ - led-boot = &wps; - led-failsafe = &wps; - - led-dsl = &dsl; - led-internet = &internet; - led-wifi = &wifi; - led-usb = &usb0; - led-usb2 = &usb2; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - gphy-leds { - lantiq,groups = "gphy0 led1", "gphy1 led1"; - lantiq,function = "gphy"; - lantiq,pull = <2>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - phy-rst { - lantiq,pins = "io42"; - lantiq,pull = <0>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - - ifxhcd@E106000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware = "lantiq/xrx200_phy11g_a22.bin"; - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - reset { - label = "reset"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wifi { - label = "wifi"; - gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; - linux,code = ; - linux,input-type = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 39 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - /* - power is not controllable via gpio - */ - dsl: dsl { - label = "tdw89x0:green:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; - internet: internet { - label = "tdw89x0:green:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; - }; - usb0: usb0 { - label = "tdw89x0:green:usb"; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - }; - usb2: usb2 { - label = "tdw89x0:green:usb2"; - gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; - }; - wps: wps { - label = "tdw89x0:green:wps"; - gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; - }; - }; - - wifi-leds { - compatible = "gpio-leds"; - - wifi: wifi { - label = "tdw89x0:green:wifi"; - gpios = <&ath9k 0 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <33250000>; - m25p,fast-read; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x20000>; - label = "u-boot"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0x7a0000>; - label = "firmware"; - }; - - partition@7c0000 { - reg = <0x7c0000 0x10000>; - label = "config"; - read-only; - }; - - ath9k_cal: partition@7d0000 { - reg = <0x7d0000 0x30000>; - label = "boardconfig"; - read-only; - }; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&ath9k_cal 0xf100>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - // gpios = <&gpio 42 GPIO_ACTIVE_LOW>; - }; - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy5: ethernet-phy@5 { - reg = <0x5>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; - -&pcie0 { - pcie@0 { - reg = <0 0 0 0 0>; - #interrupt-cells = <1>; - #size-cells = <2>; - #address-cells = <3>; - device_type = "pci"; - - ath9k: wifi@168c,002e { - compatible = "pci168c,002e"; - reg = <0 0 0 0 0>; - #gpio-cells = <2>; - gpio-controller; - qca,no-eeprom; - qca,disable-5ghz; - mtd-mac-address = <&ath9k_cal 0xf100>; - mtd-mac-address-increment = <2>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts deleted file mode 100644 index 8a73de9a2..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts +++ /dev/null @@ -1,163 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "arcadyan,vg3503j", "lantiq,xway", "lantiq,vr9"; - model = "BT OpenReach VDSL Modem"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - }; - - memory@0 { - reg = <0x0 0x2000000>; - }; - - fpi@10000000 { - localbus@0 { - ranges = <0 0 0x0 0x3ffffff>; - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x20000>; - }; - - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7d0000>; - }; - - partition@7f0000 { - label = "uboot-env"; - reg = <0x7f0000 0x10000>; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - gphy-leds { - lantiq,groups = "gphy0 led0", "gphy0 led1", - "gphy0 led2", "gphy1 led0", - "gphy1 led1", "gphy1 led2"; - lantiq,function = "gphy"; - lantiq,pull = <2>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - }; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - reset { - label = "reset"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_red: power2 { - label = "vg3503j:red:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "vg3503j:green:dsl"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - power_green: power { - label = "vg3503j:green:power"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - }; -}; - -ð0 { - interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - - lantiq,switch; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "mii"; - phy-handle = <&phy11>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "mii"; - phy-handle = <&phy13>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - lantiq,led1h = <0x70>; - lantiq,led1l = <0x00>; - lantiq,led2h = <0x00>; - lantiq,led2l = <0x03>; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - lantiq,led1h = <0x70>; - lantiq,led1l = <0x00>; - lantiq,led2h = <0x00>; - lantiq,led2l = <0x03>; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi deleted file mode 100644 index fb4486aca..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi +++ /dev/null @@ -1,253 +0,0 @@ -#include "vr9.dtsi" - -#include - -/ { - compatible = "arcadyan,vgv7510kw22", "lantiq,xway", "lantiq,vr9"; - - chosen { - bootargs = "console=ttyLTQ0,115200 mem=62M vpe1_load_addr=0x83e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &internet_green; - led-wifi = &wifi; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 30 GPIO_ACTIVE_HIGH //fxs relay - &gpio 31 GPIO_ACTIVE_HIGH //still unknown - &gpio 3 GPIO_ACTIVE_HIGH>; //reset_slic? - }; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x1000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boardconfig: partition@fe0000 { - label = "board_config"; - reg = <0xfe0000 0x20000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - gphy-leds { - lantiq,groups = "gphy0 led0", "gphy0 led1", - "gphy1 led0", "gphy1 led1"; - lantiq,function = "gphy"; - lantiq,open-drain = <0>; - lantiq,pull = <2>; - lantiq,output = <1>; - }; - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - pci-rst { - lantiq,pins = "io21"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; - }; - - pcie@d900000 { - status = "disabled"; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy22f_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy22f_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - reset { - label = "reset"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - dsl: dsl { - label = "vgv7510kw22:green:dsl"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; - - internet_red { - label = "vgv7510kw22:red:internet"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - - info_red { - label = "vgv7510kw22:red:info"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - - power_green: power { - label = "vgv7510kw22:green:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - - info_green { - label = "vgv7510kw22:green:info"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - internet_green: internet_green { - label = "vgv7510kw22:green:internet"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - - wifi: wifi { - label = "vgv7510kw22:green:wlan"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - - power_red: power2 { - label = "vgv7510kw22:red:power"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - }; - - phone { - label = "vgv7510kw22:green:telefon"; - gpios = <&gpio 29 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@1814,3592 { - compatible = "pci1814,3592"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - mtd-mac-address = <&boardconfig 0x16>; - mtd-mac-address-increment = <1>; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&boardconfig 0x16>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "mii"; - phy-handle = <&phy1>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "mii"; - phy-handle = <&phy11>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <3>; - phy-mode = "mii"; - phy-handle = <&phy12>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "mii"; - phy-handle = <&phy13>; - }; - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "mii"; - phy-handle = <&phy14>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - - phy1: ethernet-phy@1 { - reg = <0x1>; - compatible = "ethernet-phy-ieee802.3-c22"; - }; - - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy12: ethernet-phy@12 { - reg = <0x12>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy14: ethernet-phy@14 { - reg = <0x14>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts deleted file mode 100644 index d0be62f63..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts +++ /dev/null @@ -1,67 +0,0 @@ -/dts-v1/; - -#include "VGV7510KW22.dtsi" - -/ { - compatible = "arcadyan,vgv7510kw22-brn", "arcadyan,vgv7510kw22", "lantiq,xway", "lantiq,vr9"; - model = "o2 Box 6431"; - - sram@1F000000 { - cgu@103000 { - lantiq,phy-clk-src = <0x2>; - }; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - partitions { - partition@0 { - label = "Boot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "Configuration"; - reg = <0x40000 0x40000>; - read-only; - }; - - partition@80000 { - label = "Certificate"; - reg = <0x80000 0x20000>; - read-only; - }; - - partition@a0000 { - label = "Special_Area"; - reg = <0xa0000 0x20000>; - read-only; - }; - - partition@c0000 { - compatible = "brnboot,root-selector"; - label = "Primary_Setting"; - reg = <0xc0000 0x20000>; - read-only; - }; - - partition@e0000 { - label = "Code_Image_0"; - reg = <0xe0000 0x780000>; - brnboot,root-id = <0x00>; - read-only; - }; - - partition@860000 { - label = "Code_Image_1"; - reg = <0x860000 0x780000>; - brnboot,root-id = <0x01>; - read-only; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts deleted file mode 100644 index 1d21e14f0..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts +++ /dev/null @@ -1,33 +0,0 @@ -/dts-v1/; - -#include "VGV7510KW22.dtsi" - -/ { - compatible = "arcadyan,vgv7510kw22-nor", "arcadyan,vgv7510kw22", "lantiq,xway", "lantiq,vr9"; - model = "o2 Box 6431"; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - partitions { - partition@0 { - label = "uboot"; - reg = <0x0 0x60000>; /* 384 KiB */ - read-only; - }; - - partition@60000 { - label = "uboot-env"; - reg = <0x60000 0x20000>; /* 128 KiB */ - read-only; - }; - - partition@80000 { - label = "firmware"; - reg = <0x80000 0xf60000>; /* 15744 KiB */ - }; - }; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi deleted file mode 100644 index e807b5271..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi +++ /dev/null @@ -1,298 +0,0 @@ -#include "vr9.dtsi" - -#include - -/ { - compatible = "arcadyan,vgv7519", "lantiq,xway", "lantiq,vr9"; - - chosen { - bootargs = "console=ttyLTQ0,115200 mem=62M vpe1_load_addr=0x83e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &broadband_green; - led-internet = &internet_green; - led-wifi = &wireless_green; - }; - - sram@1F000000 { - vmmc@107000 { - status = "okay"; - gpios = <&gpio 30 GPIO_ACTIVE_HIGH //fxs relay - &gpio 31 GPIO_ACTIVE_HIGH //still unknown - &gpio 3 GPIO_ACTIVE_HIGH>; //reset_slic? - }; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x800000>, <1 0x800000 0x800000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boardconfig: partition@40000 { - label = "board_config"; - reg = <0x40000 0x10000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - stp { - lantiq,groups = "stp"; - lantiq,function = "stp"; - lantiq,open-drain = <0>; - lantiq,output = <1>; - lantiq,pull = <0>; - }; - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - pci-rst { - lantiq,pins = "io21"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - gphy-leds { - lantiq,groups = "gphy0 led1", "gphy1 led0"; - lantiq,function = "gphy"; - lantiq,open-drain = <0>; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - }; - - stp: stp@E100BB0 { - compatible = "lantiq,gpio-stp-xway"; - reg = <0xE100BB0 0x40>; - #gpio-cells = <2>; - gpio-controller; - - lantiq,shadow = <0xffff>; - lantiq,groups = <0x3>; - lantiq,dsl = <0x0>; - lantiq,phy1 = <0x0>; - lantiq,phy2 = <0x0>; - /* lantiq,rising; */ - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - - ifxhcd@E106000 { - status = "okay"; - gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; - }; - - pcie@d900000 { - status = "disabled"; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ - firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - reset { - label = "reset"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - eco { - label = "eco"; - gpios = <&gpio 41 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - rfkill { - label = "rfkill"; - gpios = <&gpio 45 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps { - label = "wps"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - eco { - label = "vgv7519:blue:eco"; - gpios = <&stp 2 GPIO_ACTIVE_LOW>; - }; - wps_red { - label = "vgv7519:red:wps"; - gpios = <&stp 3 GPIO_ACTIVE_LOW>; - }; - wps_green { - label = "vgv7519:green:wps"; - gpios = <&stp 4 GPIO_ACTIVE_LOW>; - }; - upgrade { - label = "vgv7519:blue:upgrade"; - gpios = <&stp 5 GPIO_ACTIVE_LOW>; - }; - tv { - label = "vgv7519:green:tv"; - gpios = <&stp 6 GPIO_ACTIVE_LOW>; - }; - internet_green: internet_green { - label = "vgv7519:green:internet"; - gpios = <&stp 7 GPIO_ACTIVE_LOW>; - }; - internet_red { - label = "vgv7519:red:internet"; - gpios = <&stp 8 GPIO_ACTIVE_LOW>; - }; - broadband_red { - label = "vgv7519:red:broadband"; - gpios = <&stp 9 GPIO_ACTIVE_LOW>; - }; - broadband_green: broadband_green { - label = "vgv7519:green:broadband"; - gpios = <&stp 10 GPIO_ACTIVE_LOW>; - }; - voice { - label = "vgv7519:green:voice"; - gpios = <&stp 11 GPIO_ACTIVE_LOW>; - }; - wireless_red { - label = "vgv7519:red:wireless"; - gpios = <&stp 12 GPIO_ACTIVE_LOW>; - }; - wireless_green: wireless_green { - label = "vgv7519:green:wireless"; - gpios = <&stp 13 GPIO_ACTIVE_LOW>; - }; - power_green: power2 { - label = "vgv7519:green:power"; - gpios = <&stp 14 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power { - label = "vgv7519:red:power"; - gpios = <&stp 15 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pci0 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - - wifi@1814,3091 { - compatible = "pci1814,3091"; - reg = <0x7000 0 0 0 0>; - ralink,mtd-eeprom = <&boardconfig 0x410>; - ralink,mtd-eeprom-swap; - mtd-mac-address = <&boardconfig 0x16>; - mtd-mac-address-increment = <1>; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&boardconfig 0x16>; - mtd-mac-address-increment = <1>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - }; - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <1>; - phy-mode = "rgmii"; - phy-handle = <&phy1>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy1: ethernet-phy@1 { - reg = <0x1>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy5: ethernet-phy@5 { - reg = <0x5>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts deleted file mode 100644 index f30d2f920..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts +++ /dev/null @@ -1,73 +0,0 @@ -/dts-v1/; - - -#include "VGV7519.dtsi" - -/ { - compatible = "arcadyan,vgv7519-brn", "arcadyan,vgv7519", "lantiq,xway", "lantiq,vr9"; - model = "KPN Experiabox V8"; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - partitions { - partition@0 { - label = "Boot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@50000 { - label = "Certificate"; - reg = <0x50000 0x10000>; - read-only; - }; - partition@60000 { - label = "Special_Area"; - reg = <0x60000 0x10000>; - read-only; - }; - - partition@70000 { - label = " Reserve_0"; - reg = <0x70000 0x10000>; - read-only; - }; - - partition@80000 { - label = "Code_Image_0"; - reg = <0x80000 0x780000>; - brnboot,root-id = <0x00>; - read-only; - }; - - partition@4000000 { - compatible = "brnboot,root-selector"; - label = "Primary_Setting"; - reg = <0x4000000 0x10000>; - read-only; - }; - - partition@4010000 { - label = "Configuration"; - reg = <0x4010000 0x60000>; - read-only; - }; - - partition@4070000 { - label = " Reserve_1"; - reg = <0x4070000 0x10000>; - read-only; - }; - - partition@4080000 { - label = "Code_Image_1"; - reg = <0x4080000 0x780000>; - brnboot,root-id = <0x01>; - read-only; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts deleted file mode 100644 index ec548fbe7..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts +++ /dev/null @@ -1,32 +0,0 @@ -/dts-v1/; - - -#include "VGV7519.dtsi" - -/ { - compatible = "arcadyan,vgv7519-nor", "arcadyan,vgv7519", "lantiq,xway", "lantiq,vr9"; - model = "KPN Experiabox V8"; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - partitions { - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - partition@60000 { - label = "uboot_env"; - reg = <0x60000 0x10000>; - read-only; - }; - partition@80000 { - label = "firmware"; - reg = <0x80000 0xf80000>; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts deleted file mode 100644 index 6eccc5bdd..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts +++ /dev/null @@ -1,283 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "tplink,vr200v", "lantiq,xway", "lantiq,vr9"; - model = "TP-LINK Archer VR200v"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - - led-dsl = &dsl; - led-internet = &internet; - led-usb = &usb; - led-usb2 = &usb; - }; - - memory@0 { - reg = <0x0 0x7f00000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - gphy-leds { - lantiq,groups = "gphy0 led1", "gphy1 led1"; - lantiq,function = "gphy"; - lantiq,pull = <2>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - phy-rst { - lantiq,pins = "io42"; - lantiq,pull = <0>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - - ifxhcd@E106000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - - pci0: pci@E105400 { - status = "okay"; - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware = "lantiq/xrx200_phy11g_a22.bin"; - phys = [ 00 01 ]; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - reset { - label = "reset"; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wifi { - label = "wifi"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - linux,code = ; - linux,input-type = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - dect_paging { - label = "dect_paging"; - gpios = <&gpio 39 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - power: power { - label = "vr200v:blue:power"; - gpios = <&gpio 46 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "vr200v:blue:dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - internet: internet { - label = "vr200v:blue:internet"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "vr200v:blue:usb"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; - }; - eth { - label = "vr200v:blue:lan"; - gpios = <&gpio 40 GPIO_ACTIVE_LOW>; - }; - wlan { - label = "vr200v:blue:wlan"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - wlan5g { - label = "vr200v:blue:wlan5g"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - phone { - label = "vr200v:blue:phone"; - gpios = <&gpio 44 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <33250000>; - m25p,fast-read; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x20000>; - label = "u-boot"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0xf90000>; - label = "firmware"; - }; - - partition@fb0000 { - reg = <0xfb0000 0x10000>; - label = "radioDECT"; - read-only; - }; - - partition@fc0000 { - reg = <0xfc0000 0x10000>; - label = "config"; - read-only; - }; - - romfile: partition@fd0000 { - reg = <0xfd0000 0x10000>; - label = "romfile"; - read-only; - }; - - partition@fe0000 { - reg = <0xfe0000 0x10000>; - label = "rom"; - read-only; - }; - - partition@ff0000 { - reg = <0xff0000 0x10000>; - label = "radio"; - read-only; - }; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - mtd-mac-address = <&romfile 0xf100>; - lantiq,switch; - - ethernet@0 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <0>; - phy-mode = "rgmii"; - phy-handle = <&phy0>; - // gpios = <&gpio 42 GPIO_ACTIVE_LOW>; - }; - ethernet@5 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "gmii"; - phy-handle = <&phy11>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "gmii"; - phy-handle = <&phy13>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy0: ethernet-phy@0 { - reg = <0x0>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy5: ethernet-phy@5 { - reg = <0x5>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts deleted file mode 100644 index fab99d00e..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts +++ /dev/null @@ -1,185 +0,0 @@ -/dts-v1/; - -#include "ar9.dtsi" - -#include - -/ { - compatible = "buffalo,wbmr-hp-g300h", "lantiq,xway", "lantiq,ar9"; - model = "Buffalo WBMR-HP-G300H"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - - led-dsl = &dsl; - led-internet = &online_green; - led-usb = &usb; - led-wifi = &wifi; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - localbus@0 { - nor-boot@0 { - compatible = "lantiq,nor"; - bank-width = <2>; - reg = <0 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x40000>; - read-only; - }; - - partition@40000 { - label = "uboot_env"; - reg = <0x40000 0x20000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x60000 0x1f20000>; - }; - - boardconfig: partition@1fc0000 { - label = "board"; - reg = <0x1fc0000 0x20000>; - read-only; - }; - - partition@1fe0000 { - label = "calibration"; - reg = <0x1fe0000 0x20000>; - read-only; - }; - }; - }; - }; - - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - pci-in { - lantiq,groups = "req1"; - lantiq,output = <0>; - lantiq,open-drain = <1>; - lantiq,pull = <2>; - }; - pci-out { - lantiq,groups = "gnt1"; - lantiq,output = <1>; - lantiq,pull = <0>; - }; - pci_rst { - lantiq,pins = "io21"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - }; - - etop@E180000 { - phy-mode = "rgmii"; - mtd-mac-address = <&boardconfig 0x10024>; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; - }; - - pci@E105400 { - status = "okay"; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - reset { - label = "reset"; - gpios = <&gpio 37 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - eject { - label = "eject"; - gpios = <&gpio 34 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - movie { - label = "movie"; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power_green: power { - label = "wbmr:green:power"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - power_red: power2 { - label = "wbmr:red:power"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - security { - label = "wbmr:yellow:security"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - wifi: wifi { - label = "wbmr:green:wireless"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - dsl: dsl { - label = "wbmr:green:dsl"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - online_green: online { - label = "wbmr:green:internet"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - online2 { - label = "wbmr:red:internet"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - }; - movie { - label = "wbmr:blue:movie"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - usb: usb { - label = "wbmr:green:usb"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts deleted file mode 100644 index 2ecfe4bc9..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts +++ /dev/null @@ -1,306 +0,0 @@ -/dts-v1/; - -#include "vr9.dtsi" - -#include - -/ { - compatible = "buffalo,wbmr-300hpd", "lantiq,xway", "lantiq,vr9"; - model = "Buffalo WBMR-300HPD"; - - chosen { - bootargs = "console=ttyLTQ0,115200"; - }; - - aliases { - led-boot = &power_g; - led-failsafe = &diag_r; - led-running = &power_g; - - led-dsl = &dsl; - led-internet = &router_g; - led-wifi = &wifi_g; - }; - - memory@0 { - reg = <0x0 0x4000000>; - }; - - fpi@10000000 { - gpio: pinmux@E100B10 { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - mdio { - lantiq,groups = "mdio"; - lantiq,function = "mdio"; - }; - phy-rst { - lantiq,pins = "io42"; - lantiq,pull = <0>; - lantiq,open-drain = <0>; - lantiq,output = <1>; - }; - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; - }; - }; - pins_spi_default: pins_spi_default { - spi_in { - lantiq,groups = "spi_di"; - lantiq,function = "spi"; - }; - spi_out { - lantiq,groups = "spi_do", "spi_clk", - "spi_cs4"; - lantiq,function = "spi"; - lantiq,output = <1>; - }; - }; - }; - - ifxhcd@E101000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - lantiq,portmask = <0x3>; - }; - - ifxhcd@E106000 { - status = "okay"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - }; - - gphy-xrx200 { - compatible = "lantiq,phy-xrx200"; - firmware = "lantiq/xrx200_phy22f_a22.bin"; - phys = [ 00 01 ]; - }; - - gpio_poweroff { - compatible = "gpio-poweroff"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - power { - label = "power"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 31 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - auto { - label = "auto"; - gpios = <&gpio 48 GPIO_ACTIVE_HIGH>; - linux,code = ; - linux,input-type = ; - }; - - router { - label = "router"; - gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; - linux,code = ; - linux,input-type = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - diag_r: diag_r { - label = "wbmr300:red:diag"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - default_state = "off"; - }; - - wifi_g: wifi_g { - label = "wbmr300:green:wifi"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - }; - - dsl: dsl { - label = "dsl"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; - - router_y: router_y { - label = "wbmr300:yellow:router"; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - }; - - wifi_y: wifi_y { - label = "wbmr300:yellow:wifi"; - gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; - }; - - lan1: lan1 { - label = "wbmr300:green:lan1"; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - - wan: wan { - label = "wbmr300:green:wan"; - gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - }; - - lan3: lan3 { - label = "wbmr300:green:lan3"; - gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - }; - - lan2: lan2 { - label = "wbmr300:green:lan2"; - gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; - }; - - internet_g: internet_g { - label = "wbmr300:green:internet"; - gpios = <&gpio 34 GPIO_ACTIVE_HIGH>; - }; - - internet_y: internet_y { - label = "wbmr300:yellow:internet"; - gpios = <&gpio 35 GPIO_ACTIVE_HIGH>; - }; - - router_g: router_g { - label = "wbmr300:green:router"; - gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; - }; - - power_g: power_g { - label = "wbmr300:green:power"; - gpios = <&gpio 49 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&spi { - pinctrl-names = "default"; - pinctrl-0 = <&pins_spi_default>; - - status = "ok"; - m25p80@4 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <4 0>; - spi-max-frequency = <20000000>; - - partition@0 { - reg = <0x0 0x10000>; - label = "u-boot"; - read-only; - }; - - partition@10000 { - reg = <0x10000 0x10000>; - label = "gphyfirmware"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0x80000>; - label = "dsl_fw"; - }; - - partition@de0000 { - reg = <0xa0000 0xf40000>; - label = "firmware"; - }; - - partition@fe0000 { - reg = <0xfe0000 0x10000>; - label = "sysconfig"; - read-only; - }; - - partition@ff0000 { - reg = <0xff0000 0x2000>; - label = "ubootconfig"; - }; - - partition@ff3000 { - reg = <0xff3000 0x2000>; - label = "board_config"; - read-only; - }; - }; -}; - -ð0 { - lan: interface@0 { - compatible = "lantiq,xrx200-pdi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - lantiq,switch; - - ethernet@1 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <4>; - phy-mode = "mii"; - phy-handle = <&phy13>; - }; - ethernet@2 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <5>; - phy-mode = "mii"; - phy-handle = <&phy14>; - }; - ethernet@3 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <2>; - phy-mode = "mii"; - phy-handle = <&phy11>; - }; - ethernet@4 { - compatible = "lantiq,xrx200-pdi-port"; - reg = <3>; - phy-mode = "mii"; - phy-handle = <&phy12>; - }; - }; - - mdio@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-mdio"; - phy11: ethernet-phy@11 { - reg = <0x11>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy12: ethernet-phy@12 { - reg = <0x12>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy13: ethernet-phy@13 { - reg = <0x13>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - phy14: ethernet-phy@14 { - reg = <0x14>; - compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi deleted file mode 100644 index e6925a3ad..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi +++ /dev/null @@ -1,174 +0,0 @@ -#include - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,xway", "lantiq,ase"; - - aliases { - serial0 = &asc1; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - cpus { - cpu@0 { - compatible = "mips,mips4Kc"; - }; - }; - - memory@0 { - device_type = "memory"; - }; - - biu@1F800000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,biu", "simple-bus"; - reg = <0x1F800000 0x800000>; - ranges = <0x0 0x1F800000 0x7FFFFF>; - - icu0: icu@80200 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,icu"; - reg = <0x80200 0x28 - 0x80228 0x28 - 0x80250 0x28 - 0x80278 0x28 - 0x802a0 0x28>; - }; - - watchdog@803F0 { - compatible = "lantiq,wdt"; - reg = <0x803F0 0x10>; - }; - }; - - sram@1F000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,sram", "simple-bus"; - reg = <0x1F000000 0x800000>; - ranges = <0x0 0x1F000000 0x7FFFFF>; - - eiu0: eiu@101000 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,eiu-xway"; - reg = <0x101000 0x1000>; - interrupt-parent = <&icu0>; - lantiq,eiu-irqs = <29 30 31>; - }; - - pmu0: pmu@102000 { - compatible = "lantiq,pmu-xway"; - reg = <0x102000 0x1000>; - }; - - cgu0: cgu@103000 { - compatible = "lantiq,cgu-xway"; - reg = <0x103000 0x1000>; - #clock-cells = <1>; - }; - - rcu0: rcu@203000 { - compatible = "lantiq,rcu-xway"; - reg = <0x203000 0x1000>; - }; - }; - - fpi@10000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,fpi", "simple-bus"; - ranges = <0x0 0x10000000 0xEEFFFFF>; - reg = <0x10000000 0xEF00000>; - - localbus@0 { - #address-cells = <2>; - #size-cells = <1>; - ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ - 1 0 0x4000000 0x4000010>; /* addsel1 */ - compatible = "lantiq,localbus", "simple-bus"; - }; - - spi@E100800 { - compatible = "lantiq,ase-spi"; - reg = <0xE100800 0x100>; - interrupt-parent = <&icu0>; - interrupts = <24 25 26>; - interrupt-names = "spi_rx", "spi_tx", "spi_err", - "spi_frm"; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - }; - - gptu@E100A00 { - compatible = "lantiq,gptu-xway"; - reg = <0xE100A00 0x100>; - interrupt-parent = <&icu0>; - interrupts = <33 34 35 36 37 38>; - }; - - gpio: pinmux@E100B10 { - compatible = "lantiq,ase-pinctrl"; - #gpio-cells = <2>; - gpio-controller; - reg = <0xE100B10 0xA0>; - }; - - asc1: serial@E100C00 { - compatible = "lantiq,asc"; - reg = <0xE100C00 0x400>; - interrupt-parent = <&icu0>; - interrupts = <72 74 75>; - }; - - mei@E116000 { - compatible = "lantiq,mei-xway"; - interrupt-parent = <&icu0>; - interrupts = <81>; - }; - - ifxhcd@E101000 { - compatible = "lantiq,ase-usb", "lantiq,ifxhcd-ase"; - reg = <0xE101000 0x1000 - 0xE120000 0x3f000>; - interrupt-parent = <&icu0>; - interrupts = <39>; - dr_mode = "host"; - status = "disabled"; - }; - - dma0: dma@E104100 { - compatible = "lantiq,dma-xway"; - reg = <0xE104100 0x800>; - }; - - ebu0: ebu@E105300 { - compatible = "lantiq,ebu-xway"; - reg = <0xE105300 0x100>; - }; - - ppe@E234000 { - compatible = "lantiq,ppe-ase"; - interrupt-parent = <&icu0>; - interrupts = <85>; - }; - - etop@E180000 { - compatible = "lantiq,etop-xway"; - reg = <0xE180000 0x40000>; - interrupt-parent = <&icu0>; - interrupts = <105 109>; - }; - }; - - adsl { - compatible = "lantiq,adsl-ase"; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi deleted file mode 100644 index 2638a4b26..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi +++ /dev/null @@ -1,216 +0,0 @@ -#include - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,xway", "lantiq,ar9"; - - aliases { - serial0 = &asc1; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - cpus { - cpu@0 { - compatible = "mips,mips34K"; - }; - }; - - memory@0 { - device_type = "memory"; - }; - - biu@1F800000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,biu", "simple-bus"; - reg = <0x1F800000 0x800000>; - ranges = <0x0 0x1F800000 0x7FFFFF>; - - icu0: icu@80200 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,icu"; - reg = <0x80200 0x28 - 0x80228 0x28 - 0x80250 0x28 - 0x80278 0x28 - 0x802a0 0x28>; - }; - - watchdog@803F0 { - compatible = "lantiq,wdt"; - reg = <0x803F0 0x10>; - }; - }; - - sram@1F000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,sram", "simple-bus"; - reg = <0x1F000000 0x800000>; - ranges = <0x0 0x1F000000 0x7FFFFF>; - - eiu0: eiu@101000 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,eiu-xway"; - reg = <0x101000 0x1000>; - interrupt-parent = <&icu0>; - lantiq,eiu-irqs = <166 135 66 40 41 42>; - }; - - pmu0: pmu@102000 { - compatible = "lantiq,pmu-xway"; - reg = <0x102000 0x1000>; - }; - - cgu0: cgu@103000 { - compatible = "lantiq,cgu-xway"; - reg = <0x103000 0x1000>; - #clock-cells = <1>; - }; - - rcu0: rcu@203000 { - compatible = "lantiq,rcu-xway"; - reg = <0x203000 0x1000>; - }; - }; - - fpi@10000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,fpi", "simple-bus"; - ranges = <0x0 0x10000000 0xEEFFFFF>; - reg = <0x10000000 0xEF00000>; - - localbus@0 { - #address-cells = <2>; - #size-cells = <1>; - ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ - 1 0 0x4000000 0x4000010>; /* addsel1 */ - compatible = "lantiq,localbus", "simple-bus"; - }; - - gptu@E100A00 { - compatible = "lantiq,gptu-xway"; - reg = <0xE100A00 0x100>; - interrupt-parent = <&icu0>; - interrupts = <126 127 128 129 130 131>; - }; - - asc0: serial@E100400 { - compatible = "lantiq,asc"; - reg = <0xE100400 0x400>; - interrupt-parent = <&icu0>; - interrupts = <104 105 106>; - status = "disabled"; - }; - - spi: spi@E100800 { - compatible = "lantiq,xrx100-spi"; - reg = <0xE100800 0x100>; - interrupt-parent = <&icu0>; - interrupts = <22 23 24>; - interrupt-names = "spi_rx", "spi_tx", "spi_err", - "spi_frm"; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - }; - - gpio: pinmux@E100B10 { - compatible = "lantiq,xrx100-pinctrl"; - #gpio-cells = <2>; - gpio-controller; - reg = <0xE100B10 0xA0>; - }; - - asc1: serial@E100C00 { - compatible = "lantiq,asc"; - reg = <0xE100C00 0x400>; - interrupt-parent = <&icu0>; - interrupts = <112 113 114>; - }; - - ifxhcd@E101000 { - compatible = "lantiq,arx100-usb", "lantiq,ifxhcd-arx100"; - reg = <0xE101000 0x1000 - 0xE120000 0x3f000>; - interrupt-parent = <&icu0>; - interrupts = <62 91>; - dr_mode = "host"; - status = "disabled"; - }; - - ifxhcd@E106000 { - compatible = "lantiq,arx100-usb"; - reg = <0xE106000 0x1000 - 0xE1E0000 0x3f000>; - interrupt-parent = <&icu0>; - interrupts = <91>; - dr_mode = "host"; - status = "disabled"; - }; - - deu@E103100 { - compatible = "lantiq,deu-arx100"; - reg = <0xE103100 0xf00>; - }; - - dma0: dma@E104100 { - compatible = "lantiq,dma-xway"; - reg = <0xE104100 0x800>; - }; - - ebu0: ebu@E105300 { - compatible = "lantiq,ebu-xway"; - reg = <0xE105300 0x100>; - }; - - mei@E116000 { - compatible = "lantiq,mei-xway"; - interrupt-parent = <&icu0>; - interrupts = <63>; - }; - - etop@E180000 { - compatible = "lantiq,etop-xway"; - reg = <0xE180000 0x40000 - 0xE108000 0x200>; - interrupt-parent = <&icu0>; - interrupts = <73 72>; - mac-address = [ 00 11 22 33 44 55 ]; - }; - - ppe@E234000 { - compatible = "lantiq,ppe-arx100"; - interrupt-parent = <&icu0>; - interrupts = <96>; - }; - - pci0: pci@E105400 { - status = "disabled"; - #address-cells = <3>; - #size-cells = <2>; - #interrupt-cells = <1>; - compatible = "lantiq,pci-xway"; - bus-range = <0x0 0x0>; - ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ - 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ - reg = <0x7000000 0x8000 /* config space */ - 0xE105400 0x400>; /* pci bridge */ - lantiq,bus-clock = <33333333>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; - interrupt-map = <0x7000 0 0 1 &icu0 30 1>; - req-mask = <0x1>; - }; - }; - - adsl { - compatible = "lantiq,adsl-arx100"; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi deleted file mode 100644 index 83e85c36a..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi +++ /dev/null @@ -1,212 +0,0 @@ -#include - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,xway", "lantiq,danube"; - - aliases { - serial0 = &asc1; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - cpus { - cpu@0 { - compatible = "mips,mips24Kc"; - }; - }; - - memory@0 { - device_type = "memory"; - }; - - biu@1F800000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,biu", "simple-bus"; - reg = <0x1F800000 0x800000>; - ranges = <0x0 0x1F800000 0x7FFFFF>; - - icu0: icu@80200 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,icu"; - reg = <0x80200 0x28 - 0x80228 0x28 - 0x80250 0x28 - 0x80278 0x28 - 0x802a0 0x28>; - }; - - watchdog@803F0 { - compatible = "lantiq,wdt"; - reg = <0x803F0 0x10>; - }; - }; - - sram@1F000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,sram", "simple-bus"; - reg = <0x1F000000 0x800000>; - ranges = <0x0 0x1F000000 0x7FFFFF>; - - eiu0: eiu@101000 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,eiu-xway"; - reg = <0x101000 0x1000>; - interrupt-parent = <&icu0>; - lantiq,eiu-irqs = <166 135 66>; - }; - - pmu0: pmu@102000 { - compatible = "lantiq,pmu-xway"; - reg = <0x102000 0x1000>; - }; - - cgu0: cgu@103000 { - compatible = "lantiq,cgu-xway"; - reg = <0x103000 0x1000>; - #clock-cells = <1>; - }; - - vmmc@107000 { - status = "disabled"; - compatible = "lantiq,vmmc-xway"; - reg = <0x103000 0x400>; - interrupt-parent = <&icu0>; - interrupts = <150 151 152 153 154 155>; - }; - - rcu0: rcu@203000 { - compatible = "lantiq,rcu-xway"; - reg = <0x203000 0x1000>; - }; - }; - - fpi@10000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,fpi", "simple-bus"; - ranges = <0x0 0x10000000 0xEEFFFFF>; - reg = <0x10000000 0xEF00000>; - - localbus@0 { - #address-cells = <2>; - #size-cells = <1>; - ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ - 1 0 0x4000000 0x4000010>; /* addsel1 */ - compatible = "lantiq,localbus", "simple-bus"; - }; - - gptu@E100A00 { - compatible = "lantiq,gptu-xway"; - reg = <0xE100A00 0x100>; - interrupt-parent = <&icu0>; - interrupts = <126 127 128 129 130 131>; - }; - - gpios: stp@E100BB0 { - #gpio-cells = <2>; - compatible = "lantiq,gpio-stp-xway"; - gpio-controller; - reg = <0xE100BB0 0x40>; - lantiq,shadow = <0xfff>; - lantiq,groups = <0x3>; - status = "disabled"; - }; - - asc0: serial@E100400 { - compatible = "lantiq,asc"; - reg = <0xE100400 0x400>; - interrupt-parent = <&icu0>; - interrupts = <104 105 106>; - status = "disabled"; - }; - - gpio: pinmux@E100B10 { - compatible = "lantiq,danube-pinctrl"; - #gpio-cells = <2>; - gpio-controller; - reg = <0xE100B10 0xA0>; - }; - - asc1: serial@E100C00 { - compatible = "lantiq,asc"; - reg = <0xE100C00 0x400>; - interrupt-parent = <&icu0>; - interrupts = <112 113 114>; - }; - - ifxhcd@E101000 { - compatible = "lantiq,danube-usb", "lantiq,ifxhcd-danube"; - reg = <0xE101000 0x1000 - 0xE120000 0x3f000>; - interrupt-parent = <&icu0>; - interrupts = <62>; - dr_mode = "host"; - status = "disabled"; - }; - - deu@E103100 { - compatible = "lantiq,deu-danube"; - reg = <0xE103100 0xf00>; - }; - - dma0: dma@E104100 { - compatible = "lantiq,dma-xway"; - reg = <0xE104100 0x800>; - }; - - ebu0: ebu@E105300 { - compatible = "lantiq,ebu-xway"; - reg = <0xE105300 0x100>; - }; - - mei@E116000 { - compatible = "lantiq,mei-xway"; - interrupt-parent = <&icu0>; - interrupts = <63>; - }; - - etop@E180000 { - compatible = "lantiq,etop-xway"; - reg = <0xE180000 0x40000>; - interrupt-parent = <&icu0>; - interrupts = <73 78>; - mac-address = [ 00 11 22 33 44 55 ]; - }; - - ppe@E234000 { - compatible = "lantiq,ppe-danube"; - interrupt-parent = <&icu0>; - interrupts = <96>; - }; - - pci0: pci@E105400 { - status = "disabled"; - - #address-cells = <3>; - #size-cells = <2>; - #interrupt-cells = <1>; - compatible = "lantiq,pci-xway"; - bus-range = <0x0 0x0>; - ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ - 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ - reg = <0x7000000 0x8000 /* config space */ - 0xE105400 0x400>; /* pci bridge */ - lantiq,bus-clock = <33333333>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; - interrupt-map = <0x7000 0 0 1 &icu0 30 1>; /* slot 14, irq 30 */ - req-mask = <0x1>; /* GNT1 */ - }; - }; - - adsl { - compatible = "lantiq,adsl-danube"; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi deleted file mode 100644 index d95acc21e..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi +++ /dev/null @@ -1,37 +0,0 @@ - -&ebu_cs0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,sflash-falcon", "simple-bus"; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "spansion,s25fl129p0", "spansion,s25fl129p1"; - reg = <0 0>; - linux,mtd-name = "sflash"; - spi-max-frequency = <80000000>; - m25p,fast-read; - - partition@0 { - reg = <0x0 0x40000>; - label = "uboot"; - read-only; - }; - - partition@40000 { - reg = <0x40000 0x80000>; - label = "uboot_env"; - }; - - partition@C0000 { - reg = <0xC0000 0x740000>; - label = "image0"; - }; - - partition@800000 { - reg = <0x800000 0x800000>; - label = "image1"; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi deleted file mode 100644 index 98f71819a..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi +++ /dev/null @@ -1,392 +0,0 @@ -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,falcon"; - - cpus { - cpu@0 { - compatible = "mips,mips34kc"; - }; - }; - - aliases { - serial0 = &serial0; - serial1 = &serial1; - gpio0 = &gpio0; - gpio1 = &gpio1; - gpio2 = &gpio2; - gpio3 = &gpio3; - gpio4 = &gpio4; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - clocks { - compatible = "simple-bus"; - - cpu_clk: cpu { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <400000000>; - clock-output-names = "cpu"; - }; - - io_clk: io { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <200000000>; - clock-output-names = "io"; - }; - - fpi_clk: fpi { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <100000000>; - clock-output-names = "fpi"; - }; - }; - - ebu_cs0: localbus@10000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,localbus", "simple-bus"; - reg = <0x10000000 0x4000000>; - ranges = <0x0 0x10000000 0x4000000>; - }; - ebu_cs1: localbus@14000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,localbus", "simple-bus"; - reg = <0x14000000 0x4000000>; - ranges = <0x0 0x14000000 0x4000000>; - }; - - ebu@18000000 { - compatible = "lantiq,ebu-falcon"; - reg = <0x18000000 0x100>; - }; - - sbs2@1D000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,sysb2", "simple-bus"; - reg = <0x1D000000 0x1000000>; - ranges = <0x0 0x1D000000 0x1000000>; - - clock_sysgpe: clock-controller@700000 { - compatible = "lantiq,sysgpe-falcon"; - reg = <0x700000 0x100>; - #clock-cells = <1>; - }; - - mps@4000 { - compatible = "lantiq,mps-falcon", "lantiq,mps-xrx100"; - reg = <0x4000 0x1000>; - interrupt-parent = <&icu0>; - interrupts = <154 155>; - lantiq,mbx = <&mpsmbx>; - }; - - gpio0: gpio@810000 { - compatible = "lantiq,falcon-gpio"; - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&icu0>; - interrupts = <44>; - reg = <0x810000 0x80>; - clocks = <&clock_syseth 16>; - }; - - gpio2: gpio@810100 { - compatible = "lantiq,falcon-gpio"; - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&icu0>; - interrupts = <46>; - reg = <0x810100 0x80>; - clocks = <&clock_syseth 17>; - }; - - clock_syseth: clock-controller@B00000 { - compatible = "lantiq,syseth-falcon"; - reg = <0xB00000 0x100>; - #clock-cells = <1>; - }; - - pad@B01000 { - compatible = "lantiq,pad-falcon"; - reg = <0xB01000 0x100>; - lantiq,bank = <0>; - clocks = <&clock_syseth 20>; - }; - - pad@B02000 { - compatible = "lantiq,pad-falcon"; - reg = <0xB02000 0x100>; - lantiq,bank = <2>; - clocks = <&clock_syseth 21>; - }; - }; - - fpi@1E000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,fpi", "simple-bus"; - reg = <0x1E000000 0x1000000>; - ranges = <0x0 0x1E000000 0x1000000>; - - serial1: serial@100B00 { - status = "disabled"; - compatible = "lantiq,asc"; - reg = <0x100B00 0x100>; - interrupt-parent = <&icu0>; - interrupts = <112 113 114>; - line = <1>; - pinctrl-names = "default"; - pinctrl-0 = <&asc1_pins>; - clocks = <&clock_sys1 11>; - }; - - serial0: serial@100C00 { - compatible = "lantiq,asc"; - reg = <0x100C00 0x100>; - interrupt-parent = <&icu0>; - interrupts = <104 105 106>; - line = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&asc0_pins>; - clocks = <&clock_sys1 12>; - }; - - spi: spi@100D00 { - status = "disabled"; - compatible = "lantiq,falcon-spi", "lantiq,xrx100-spi", "lantiq,spi-lantiq-ssc"; - interrupts = <22 23 24 25>; - interrupt-names = "spi_tx", "spi_rx", "spi_err", "spi_frm"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x100D00 0x100>; - interrupt-parent = <&icu0>; - clocks = <&clock_sys1 13>; - base_cs = <1>; - num_cs = <2>; - }; - - gptc@100E00 { - compatible = "lantiq,gptc-falcon"; - reg = <0x100E00 0x100>; - }; - - i2c: i2c@200000 { - status = "disabled"; - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,lantiq-i2c"; - reg = <0x200000 0x10000>; - interrupt-parent = <&icu0>; - interrupts = <18 19 20 21>; - gpios = <&gpio1 7 0 &gpio1 8 0>; - pinctrl-names = "default"; - pinctrl-0 = <&i2c_pins>; - clocks = <&clock_sys1 14>; - }; - - gpio1: gpio@800100 { - compatible = "lantiq,falcon-gpio"; - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&icu0>; - interrupts = <45>; - reg = <0x800100 0x100>; - clocks = <&clock_sys1 16>; - }; - - gpio3: gpio@800200 { - compatible = "lantiq,falcon-gpio"; - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&icu0>; - interrupts = <47>; - reg = <0x800200 0x100>; - clocks = <&clock_sys1 17>; - }; - - gpio4: gpio@800300 { - compatible = "lantiq,falcon-gpio"; - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&icu0>; - interrupts = <48>; - reg = <0x800300 0x100>; - clocks = <&clock_sys1 18>; - }; - - pad@800400 { - compatible = "lantiq,pad-falcon"; - reg = <0x800400 0x100>; - lantiq,bank = <1>; - clocks = <&clock_sys1 20>; - }; - - pad@800500 { - compatible = "lantiq,pad-falcon"; - reg = <0x800500 0x100>; - lantiq,bank = <3>; - clocks = <&clock_sys1 21>; - }; - - pad@800600 { - compatible = "lantiq,pad-falcon"; - reg = <0x800600 0x100>; - lantiq,bank = <4>; - clocks = <&clock_sys1 22>; - }; - - status@802000 { - compatible = "lantiq,status-falcon"; - reg = <0x802000 0x80>; - }; - - clock_sys1: clock-controller@F00000 { - compatible = "lantiq,sys1-falcon"; - reg = <0xF00000 0x100>; - #clock-cells = <1>; - }; - }; - - sbs0@1F000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "simple-bus"; - reg = <0x1F000000 0x400000>; - ranges = <0x0 0x1F000000 0x400000>; - - mpsmbx: mpsmbx@200000 { - reg = <0x200000 0x200>; - }; - }; - - sbs1@1F700000 { - - }; - - biu@1F800000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,biu", "simple-bus"; - reg = <0x1F800000 0x800000>; - ranges = <0x0 0x1F800000 0x800000>; - - icu0: icu@80200 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,icu"; - reg = <0x80200 0x28 - 0x80228 0x28 - 0x80250 0x28 - 0x80278 0x28 - 0x802a0 0x28>; - }; - - watchdog@803F0 { - compatible = "lantiq,wdt"; - reg = <0x803F0 0x10>; - clocks = <&io_clk>; /* currently no effect */ - }; - }; - - pinctrl { - compatible = "lantiq,pinctrl-falcon"; - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinctrl0 { - /*ntr { - lantiq,groups = "ntr8k"; - lantiq,function = "ntr"; - };*/ - hrst { - lantiq,groups = "hrst"; - lantiq,function = "rst"; - }; - }; - - asc0_pins: asc0 { - asc0 { - lantiq,groups = "asc0"; - lantiq,function = "asc"; - }; - }; - asc1_pins: asc1 { - asc1 { - lantiq,groups = "asc1"; - lantiq,function = "asc"; - }; - }; - i2c_pins: i2c { - i2c { - lantiq,groups = "i2c"; - lantiq,function = "i2c"; - }; - }; - bootled_pins: bootled { - bootled { - lantiq,groups = "bootled"; - lantiq,function = "led"; - }; - }; - ntr_ntr8k: ntr8k { - ntr8k { - lantiq,groups = "ntr8k"; - lantiq,function = "ntr"; - }; - }; - ntr_pps: pps { - pps { - lantiq,groups = "pps"; - lantiq,function = "ntr"; - }; - }; - ntr_gpio: gpio { - gpio { - lantiq,pins = "io5"; - lantiq,mux = <1>; - lantiq,output = <0>; - }; - }; - slic_pins: slic { - slic { - lantiq,groups = "slic"; - lantiq,function = "slic"; - }; - }; - }; - - pinselect-ntr { - compatible = "lantiq,onu-ntr","lantiq,pinselect-ntr"; - pinctrl-names = "ntr8k", "pps", "gpio"; - pinctrl-0 = <&ntr_ntr8k>; - pinctrl-1 = <&ntr_pps>; - pinctrl-2 = <&ntr_gpio>; - }; - - pinselect-asc1 { - compatible = "lantiq,onu-asc1","lantiq,pinselect-asc1"; - pinctrl-names = "default", "asc1"; - pinctrl-0 = <&slic_pins>; - pinctrl-1 = <&asc1_pins>; - }; - -}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi deleted file mode 100644 index dbcbb3dce..000000000 --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi +++ /dev/null @@ -1,260 +0,0 @@ -#include - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,xway", "lantiq,vr9"; - - aliases { - serial0 = &asc1; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - cpus { - cpu@0 { - compatible = "mips,mips34Kc"; - }; - }; - - memory@0 { - device_type = "memory"; - }; - - cputemp@0 { - compatible = "lantiq,cputemp"; - }; - - biu@1F800000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,biu", "simple-bus"; - reg = <0x1F800000 0x800000>; - ranges = <0x0 0x1F800000 0x7FFFFF>; - - icu0: icu@80200 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,icu"; - reg = <0x80200 0x28 - 0x80228 0x28 - 0x80250 0x28 - 0x80278 0x28 - 0x802a0 0x28>; - }; - - watchdog@803F0 { - compatible = "lantiq,wdt"; - reg = <0x803F0 0x10>; - }; - }; - - sram@1F000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,sram", "simple-bus"; - reg = <0x1F000000 0x800000>; - ranges = <0x0 0x1F000000 0x7FFFFF>; - - eiu0: eiu@101000 { - #interrupt-cells = <1>; - interrupt-controller; - compatible = "lantiq,eiu-xway"; - reg = <0x101000 0x1000>; - interrupt-parent = <&icu0>; - lantiq,eiu-irqs = <166 135 66 40 41 42>; - }; - - pmu0: pmu@102000 { - compatible = "lantiq,pmu-xway"; - reg = <0x102000 0x1000>; - }; - - cgu0: cgu@103000 { - compatible = "lantiq,cgu-xway"; - reg = <0x103000 0x1000>; - }; - - dcdc@106a00 { - compatible = "lantiq,dcdc-xrx200"; - reg = <0x106a00 0x200>; - }; - - vmmc@107000 { - status = "disabled"; - compatible = "lantiq,vmmc-xway"; - reg = <0x103000 0x400>; - interrupt-parent = <&icu0>; - interrupts = <150 151 152 153 154 155>; - }; - - rcu0: rcu@203000 { - compatible = "lantiq,rcu-xrx200"; - reg = <0x203000 0x1000>; - /* irq for thermal sensor */ - interrupt-parent = <&icu0>; - interrupts = <115>; - }; - - xbar0: xbar@400000 { - compatible = "lantiq,xbar-xway"; - reg = <0x400000 0x1000>; - }; - }; - - fpi@10000000 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "lantiq,fpi", "simple-bus"; - ranges = <0x0 0x10000000 0xEEFFFFF>; - reg = <0x10000000 0xEF00000>; - - localbus@0 { - #address-cells = <2>; - #size-cells = <1>; - ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ - 1 0 0x4000000 0x4000010>; /* addsel1 */ - compatible = "lantiq,localbus", "simple-bus"; - }; - - gptu@E100A00 { - compatible = "lantiq,gptu-xway"; - reg = <0xE100A00 0x100>; - interrupt-parent = <&icu0>; - interrupts = <126 127 128 129 130 131>; - }; - - usif: usif@da00000 { - compatible = "lantiq,usif"; - reg = <0xda00000 0x1000000>; - interrupt-parent = <&icu0>; - interrupts = <29 125 107 108 109 110>; - status = "disabled"; - }; - - spi: spi@E100800 { - compatible = "lantiq,xrx200-spi", "lantiq,xrx100-spi"; - reg = <0xE100800 0x100>; - interrupt-parent = <&icu0>; - interrupts = <22 23 24>; - interrupt-names = "spi_rx", "spi_tx", "spi_err", - "spi_frm"; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - }; - - gpio: pinmux@E100B10 { - compatible = "lantiq,xrx200-pinctrl"; - #gpio-cells = <2>; - gpio-controller; - reg = <0xE100B10 0xA0>; - }; - - asc1: serial@E100C00 { - compatible = "lantiq,asc"; - reg = <0xE100C00 0x400>; - interrupt-parent = <&icu0>; - interrupts = <112 113 114>; - }; - - deu@E103100 { - compatible = "lantiq,deu-xrx200"; - reg = <0xE103100 0xf00>; - }; - - dma0: dma@E104100 { - compatible = "lantiq,dma-xway"; - reg = <0xE104100 0x800>; - }; - - ebu0: ebu@E105300 { - compatible = "lantiq,ebu-xway"; - reg = <0xE105300 0x100>; - }; - - ifxhcd@E101000 { - status = "disabled"; - compatible = "lantiq,xrx200-usb", "lantiq,ifxhcd-xrx200"; - reg = <0xE101000 0x1000 - 0xE120000 0x3f000>; - interrupt-parent = <&icu0>; - interrupts = <62 91>; - dr_mode = "host"; - }; - - ifxhcd@E106000 { - status = "disabled"; - compatible = "lantiq,xrx200-usb"; - reg = <0xE106000 0x1000>; - interrupt-parent = <&icu0>; - interrupts = <91>; - dr_mode = "host"; - }; - - eth0: eth@E108000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "lantiq,xrx200-net"; - reg = < 0xE108000 0x3000 /* switch */ - 0xE10B100 0x70 /* mdio */ - 0xE10B1D8 0x30 /* mii */ - 0xE10B308 0x30 /* pmac */ - >; - interrupt-parent = <&icu0>; - interrupts = <75 73 72>; - }; - - mei@E116000 { - compatible = "lantiq,mei-xrx200"; - reg = <0xE116000 0x9c>; - interrupt-parent = <&icu0>; - interrupts = <63>; - }; - - ppe@E234000 { - compatible = "lantiq,ppe-xrx200"; - interrupt-parent = <&icu0>; - interrupts = <96>; - }; - - pcie0: pcie@d900000 { - compatible = "lantiq,pcie-xrx200"; - - #interrupt-cells = <1>; - #size-cells = <2>; - #address-cells = <3>; - - interrupt-parent = <&icu0>; - interrupts = <161 144>; - - device_type = "pci"; - - gpio-reset = <&gpio 38 GPIO_ACTIVE_HIGH>; - }; - - pci0: pci@E105400 { - status = "disabled"; - - #address-cells = <3>; - #size-cells = <2>; - #interrupt-cells = <1>; - compatible = "lantiq,pci-xway"; - bus-range = <0x0 0x0>; - ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ - 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ - reg = <0x7000000 0x8000 /* config space */ - 0xE105400 0x400>; /* pci bridge */ - lantiq,bus-clock = <33333333>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; - interrupt-map = <0x7000 0 0 1 &icu0 30 1>; /* slot 14, irq 30 */ - req-mask = <0x1>; /* GNT1 */ - }; - }; - - vdsl { - compatible = "lantiq,vdsl-vrx200"; - }; -}; diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index 031c3fcb8..0bedfcf0a 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -485,6 +485,19 @@ define Device/buffalo_wbmr-hp-g300h-b endef TARGET_DEVICES += buffalo_wbmr-hp-g300h-b +define Device/avm_fritz7312 + $(Device/AVM) + DEVICE_DTS := FRITZ7312 + IMAGE_SIZE := 15744k + DEVICE_TITLE := 1&1 WLAN-MODEM - FRITZ7312 + DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini \ + kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \ + kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \ + ltq-adsl-app ppp-mod-pppoa \ + kmod-ltq-deu-ar9 -swconfig +endef +TARGET_DEVICES += avm_fritz7312 + define Device/avm_fritz7320 $(Device/AVM) DEVICE_DTS := FRITZ7320 @@ -617,13 +630,29 @@ TARGET_DEVICES += lantiq_easy80920-nor define Device/avm_fritz3370 $(Device/AVM) $(Device/NAND) - BOARD_NAME := FRITZ3370 DEVICE_DTS := FRITZ3370 - DEVICE_TITLE := Fritz!Box WLan - FRITZ3370 - DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2 - SUPPORTED_DEVICES += FRITZ3370 + DEVICE_TITLE := AVM Fritz!Box WLan 3370 Rev. 2 + KERNEL_SIZE := 4096k + UBINIZE_OPTS := -E 5 + IMAGES += eva-kernel.bin eva-filesystem.bin + IMAGE/eva-kernel.bin := append-kernel + IMAGE/eva-filesystem.bin := append-ubi + DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2 fritz-tffs endef -TARGET_DEVICES += avm_fritz3370 + +define Device/avm_fritz3370-rev2-hynix + $(Device/avm_fritz3370) + DEVICE_DTS := FRITZ3370-REV2-HYNIX + DEVICE_TITLE := AVM Fritz!Box WLan 3370 Rev. 2 (Hynix NAND) +endef +TARGET_DEVICES += avm_fritz3370-rev2-hynix + +define Device/avm_fritz3370-rev2-micron + $(Device/avm_fritz3370) + DEVICE_DTS := FRITZ3370-REV2-MICRON + DEVICE_TITLE := AVM Fritz!Box WLan 3370 Rev. 2 (Micron NAND) +endef +TARGET_DEVICES += avm_fritz3370-rev2-micron define Device/avm_fritz7360sl $(Device/AVM) diff --git a/target/linux/lantiq/patches-4.14/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-4.14/0001-MIPS-lantiq-add-pcie-driver.patch index 77351e179..f72f39448 100644 --- a/target/linux/lantiq/patches-4.14/0001-MIPS-lantiq-add-pcie-driver.patch +++ b/target/linux/lantiq/patches-4.14/0001-MIPS-lantiq-add-pcie-driver.patch @@ -5494,7 +5494,7 @@ Signed-off-by: John Crispin (transaction layer end-to-end CRC checking). --- a/include/linux/pci.h +++ b/include/linux/pci.h -@@ -1300,6 +1300,8 @@ void pci_walk_bus(struct pci_bus *top, i +@@ -1302,6 +1302,8 @@ void pci_walk_bus(struct pci_bus *top, i void *userdata); int pci_cfg_space_size(struct pci_dev *dev); unsigned char pci_bus_max_busnr(struct pci_bus *bus); diff --git a/target/linux/lantiq/patches-4.14/0004-MIPS-lantiq-add-atm-hack.patch b/target/linux/lantiq/patches-4.14/0004-MIPS-lantiq-add-atm-hack.patch index 2c73cec55..66ca2fd5a 100644 --- a/target/linux/lantiq/patches-4.14/0004-MIPS-lantiq-add-atm-hack.patch +++ b/target/linux/lantiq/patches-4.14/0004-MIPS-lantiq-add-atm-hack.patch @@ -467,25 +467,6 @@ Signed-off-by: John Crispin struct atm_trafprm { unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ int max_pcr; /* maximum PCR in cells per second */ ---- a/net/atm/common.c -+++ b/net/atm/common.c -@@ -62,10 +62,16 @@ static void vcc_remove_socket(struct soc - write_unlock_irq(&vcc_sklist_lock); - } - -+struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL; -+EXPORT_SYMBOL(ifx_atm_alloc_tx); -+ - static bool vcc_tx_ready(struct atm_vcc *vcc, unsigned int size) - { - struct sock *sk = sk_atm(vcc); - -+ if (ifx_atm_alloc_tx != NULL) -+ return ifx_atm_alloc_tx(vcc, size); -+ - if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) { - pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n", - sk_wmem_alloc_get(sk), size, sk->sk_sndbuf); --- a/net/atm/proc.c +++ b/net/atm/proc.c @@ -155,7 +155,7 @@ static void *vcc_seq_next(struct seq_fil diff --git a/target/linux/lantiq/patches-4.14/0030-GPIO-add-named-gpio-exports.patch b/target/linux/lantiq/patches-4.14/0030-GPIO-add-named-gpio-exports.patch index 30b6a1181..95cdf8c5a 100644 --- a/target/linux/lantiq/patches-4.14/0030-GPIO-add-named-gpio-exports.patch +++ b/target/linux/lantiq/patches-4.14/0030-GPIO-add-named-gpio-exports.patch @@ -22,7 +22,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" -@@ -506,3 +508,73 @@ void of_gpiochip_remove(struct gpio_chip +@@ -506,3 +508,72 @@ void of_gpiochip_remove(struct gpio_chip gpiochip_remove_pin_ranges(chip); of_node_put(chip->of_node); } @@ -34,7 +34,7 @@ Signed-off-by: John Crispin + { /* sentinel */ } +}; + -+static int __init of_gpio_export_probe(struct platform_device *pdev) ++static int of_gpio_export_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct device_node *cnp; @@ -58,6 +58,8 @@ Signed-off-by: John Crispin + enum of_gpio_flags of_flags; + + gpio = of_get_gpio_flags(cnp, i, &of_flags); ++ if (!gpio_is_valid(gpio)) ++ return gpio; + + if (of_flags == OF_GPIO_ACTIVE_LOW) + flags |= GPIOF_ACTIVE_LOW; @@ -87,13 +89,10 @@ Signed-off-by: John Crispin + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(gpio_export_ids), + }, ++ .probe = of_gpio_export_probe, +}; + -+static int __init of_gpio_export_init(void) -+{ -+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe); -+} -+device_initcall(of_gpio_export_init); ++module_platform_driver(gpio_export_driver); + +#endif --- a/include/asm-generic/gpio.h diff --git a/target/linux/lantiq/patches-4.14/0701-NET-lantiq-etop-of-mido.patch b/target/linux/lantiq/patches-4.14/0701-NET-lantiq-etop-of-mido.patch new file mode 100644 index 000000000..5dc4b8152 --- /dev/null +++ b/target/linux/lantiq/patches-4.14/0701-NET-lantiq-etop-of-mido.patch @@ -0,0 +1,37 @@ +--- a/drivers/net/ethernet/lantiq_etop.c ++++ b/drivers/net/ethernet/lantiq_etop.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + + #include + +@@ -567,7 +568,8 @@ static int + ltq_etop_mdio_init(struct net_device *dev) + { + struct ltq_etop_priv *priv = netdev_priv(dev); +- int err; ++ struct device_node *mdio_np = NULL; ++ int err, ret; + + priv->mii_bus = mdiobus_alloc(); + if (!priv->mii_bus) { +@@ -587,7 +589,15 @@ ltq_etop_mdio_init(struct net_device *de + priv->mii_bus->name = "ltq_mii"; + snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", + priv->pdev->name, priv->pdev->id); +- if (mdiobus_register(priv->mii_bus)) { ++ ++ mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus"); ++ ++ if (mdio_np) ++ ret = of_mdiobus_register(priv->mii_bus, mdio_np); ++ else ++ ret = mdiobus_register(priv->mii_bus); ++ ++ if (ret) { + err = -ENXIO; + goto err_out_free_mdiobus; + } diff --git a/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch deleted file mode 100644 index 91a6acce3..000000000 --- a/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch +++ /dev/null @@ -1,5520 +0,0 @@ -From 6f933347d0b4ed02d9534f5fa07f7b99f13eeaa1 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 7 Aug 2014 18:12:28 +0200 -Subject: [PATCH 01/36] MIPS: lantiq: add pcie driver - -Signed-off-by: John Crispin ---- - arch/mips/lantiq/Kconfig | 10 + - arch/mips/lantiq/xway/sysctrl.c | 2 + - arch/mips/pci/Makefile | 2 + - arch/mips/pci/fixup-lantiq-pcie.c | 82 +++ - arch/mips/pci/fixup-lantiq.c | 5 +- - arch/mips/pci/ifxmips_pci_common.h | 57 ++ - arch/mips/pci/ifxmips_pcie.c | 1099 ++++++++++++++++++++++++++++++ - arch/mips/pci/ifxmips_pcie.h | 135 ++++ - arch/mips/pci/ifxmips_pcie_ar10.h | 290 ++++++++ - arch/mips/pci/ifxmips_pcie_msi.c | 392 +++++++++++ - arch/mips/pci/ifxmips_pcie_phy.c | 478 +++++++++++++ - arch/mips/pci/ifxmips_pcie_pm.c | 176 +++++ - arch/mips/pci/ifxmips_pcie_pm.h | 36 + - arch/mips/pci/ifxmips_pcie_reg.h | 1001 +++++++++++++++++++++++++++ - arch/mips/pci/ifxmips_pcie_vr9.h | 271 ++++++++ - arch/mips/pci/pci.c | 25 + - arch/mips/pci/pcie-lantiq.h | 1305 ++++++++++++++++++++++++++++++++++++ - drivers/pci/pcie/aer/Kconfig | 2 +- - include/linux/pci.h | 2 + - include/linux/pci_ids.h | 6 + - 20 files changed, 5374 insertions(+), 2 deletions(-) - create mode 100644 arch/mips/pci/fixup-lantiq-pcie.c - create mode 100644 arch/mips/pci/ifxmips_pci_common.h - create mode 100644 arch/mips/pci/ifxmips_pcie.c - create mode 100644 arch/mips/pci/ifxmips_pcie.h - create mode 100644 arch/mips/pci/ifxmips_pcie_ar10.h - create mode 100644 arch/mips/pci/ifxmips_pcie_msi.c - create mode 100644 arch/mips/pci/ifxmips_pcie_phy.c - create mode 100644 arch/mips/pci/ifxmips_pcie_pm.c - create mode 100644 arch/mips/pci/ifxmips_pcie_pm.h - create mode 100644 arch/mips/pci/ifxmips_pcie_reg.h - create mode 100644 arch/mips/pci/ifxmips_pcie_vr9.h - create mode 100644 arch/mips/pci/pcie-lantiq.h - ---- a/arch/mips/lantiq/Kconfig -+++ b/arch/mips/lantiq/Kconfig -@@ -17,6 +17,7 @@ config SOC_XWAY - bool "XWAY" - select SOC_TYPE_XWAY - select HW_HAS_PCI -+ select ARCH_SUPPORTS_MSI - - config SOC_FALCON - bool "FALCON" -@@ -47,6 +48,15 @@ config PCI_LANTIQ - bool "PCI Support" - depends on SOC_XWAY && PCI - -+config PCIE_LANTIQ -+ bool "PCIE Support" -+ depends on SOC_XWAY && PCI -+ -+config PCIE_LANTIQ_MSI -+ bool -+ depends on PCIE_LANTIQ && PCI_MSI -+ default y -+ - config XRX200_PHY_FW - bool "XRX200 PHY firmware loader" - depends on SOC_XWAY ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -48,6 +48,8 @@ obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o - obj-$(CONFIG_SOC_MT7620) += pci-mt7620.o - obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o - obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o -+obj-$(CONFIG_PCIE_LANTIQ) += ifxmips_pcie_phy.o ifxmips_pcie.o fixup-lantiq-pcie.o -+obj-$(CONFIG_PCIE_LANTIQ_MSI) += pcie-lantiq-msi.o - obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o - obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o - obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o ---- /dev/null -+++ b/arch/mips/pci/fixup-lantiq-pcie.c -@@ -0,0 +1,74 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_fixup_pcie.c -+** PROJECT : IFX UEIP for VRX200 -+** MODULES : PCIe -+** -+** DATE : 02 Mar 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Version $Date $Author $Comment -+** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+/*! -+ \file ifxmips_fixup_pcie.c -+ \ingroup IFX_PCIE -+ \brief PCIe Fixup functions source file -+*/ -+#include -+#include -+#include -+ -+#include -+ -+#include "pcie-lantiq.h" -+ -+static void -+ifx_pcie_fixup_resource(struct pci_dev *dev) -+{ -+ u32 reg; -+ -+ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: enter\n", __func__, pci_name(dev)); -+ -+ printk("%s: fixup host controller %s (%04x:%04x)\n", -+ __func__, pci_name(dev), dev->vendor, dev->device); -+ -+ /* Setup COMMAND register */ -+ reg = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER /* | -+ PCI_COMMAND_INTX_DISABLE */| PCI_COMMAND_SERR; -+ pci_write_config_word(dev, PCI_COMMAND, reg); -+ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: exit\n", __func__, pci_name(dev)); -+} -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INFINEON, PCI_DEVICE_ID_INFINEON_PCIE, ifx_pcie_fixup_resource); -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LANTIQ, PCI_VENDOR_ID_LANTIQ, ifx_pcie_fixup_resource); -+ -+static void -+ifx_pcie_rc_class_early_fixup(struct pci_dev *dev) -+{ -+ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: enter\n", __func__, pci_name(dev)); -+ -+ if (dev->devfn == PCI_DEVFN(0, 0) && -+ (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) { -+ -+ dev->class = (PCI_CLASS_BRIDGE_PCI << 8) | (dev->class & 0xff); -+ -+ printk(KERN_INFO "%s: fixed pcie host bridge to pci-pci bridge\n", __func__); -+ } -+ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: exit\n", __func__, pci_name(dev)); -+ mdelay(10); -+} -+ -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INFINEON, PCI_DEVICE_ID_INFINEON_PCIE, -+ ifx_pcie_rc_class_early_fixup); -+ -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LANTIQ, PCI_DEVICE_ID_LANTIQ_PCIE, -+ ifx_pcie_rc_class_early_fixup); ---- a/arch/mips/pci/fixup-lantiq.c -+++ b/arch/mips/pci/fixup-lantiq.c -@@ -8,12 +8,18 @@ - - #include - #include -+#include "ifxmips_pci_common.h" - - int (*ltq_pci_plat_arch_init)(struct pci_dev *dev) = NULL; - int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) = NULL; - - int pcibios_plat_dev_init(struct pci_dev *dev) - { -+#ifdef CONFIG_PCIE_LANTIQ -+ if (pci_find_capability(dev, PCI_CAP_ID_EXP)) -+ ifx_pcie_bios_plat_dev_init(dev); -+#endif -+ - if (ltq_pci_plat_arch_init) - return ltq_pci_plat_arch_init(dev); - -@@ -25,5 +31,10 @@ int pcibios_plat_dev_init(struct pci_dev - - int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) - { -+#ifdef CONFIG_PCIE_LANTIQ -+ if (pci_find_capability(dev, PCI_CAP_ID_EXP)) -+ return ifx_pcie_bios_map_irq(dev, slot, pin); -+#endif -+ - return of_irq_parse_and_map_pci(dev, slot, pin); - } ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pci_common.h -@@ -0,0 +1,57 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pci_common.h -+** PROJECT : IFX UEIP -+** MODULES : PCI subsystem -+** -+** DATE : 30 June 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Version $Date $Author $Comment -+** 0.0.1 30 June,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+ -+#ifndef IFXMIPS_PCI_COMMON_H -+#define IFXMIPS_PCI_COMMON_H -+#include -+/*! -+ \defgroup IFX_PCI_COM IFX PCI/PCIe common parts for OS integration -+ \brief PCI/PCIe common parts -+*/ -+ -+/*! -+ \defgroup IFX_PCI_COM_OS OS APIs -+ \ingroup IFX_PCI_COM -+ \brief PCI/PCIe bus driver OS interface functions -+*/ -+/*! -+ \file ifxmips_pci_common.h -+ \ingroup IFX_PCI_COM -+ \brief PCI/PCIe bus driver common OS header file -+*/ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -+#define IFX_PCI_CONST -+#else -+#define IFX_PCI_CONST const -+#endif -+#ifdef CONFIG_IFX_PCI -+extern int ifx_pci_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin); -+extern int ifx_pci_bios_plat_dev_init(struct pci_dev *dev); -+#endif /* COFNIG_IFX_PCI */ -+ -+#ifdef CONFIG_PCIE_LANTIQ -+extern int ifx_pcie_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin); -+extern int ifx_pcie_bios_plat_dev_init(struct pci_dev *dev); -+#endif -+ -+#endif /* IFXMIPS_PCI_COMMON_H */ -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie.c -@@ -0,0 +1,1092 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ * Copyright (C) 2009 Lei Chuanhua -+ * Copyright (C) 2013 John Crispin -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "ifxmips_pcie.h" -+#include "ifxmips_pcie_reg.h" -+ -+/* Enable 32bit io due to its mem mapped io nature */ -+#define IFX_PCIE_ERROR_INT -+#define IFX_PCIE_IO_32BIT -+ -+#define IFX_PCIE_IR (INT_NUM_IM4_IRL0 + 25) -+#define IFX_PCIE_INTA (INT_NUM_IM4_IRL0 + 8) -+#define IFX_PCIE_INTB (INT_NUM_IM4_IRL0 + 9) -+#define IFX_PCIE_INTC (INT_NUM_IM4_IRL0 + 10) -+#define IFX_PCIE_INTD (INT_NUM_IM4_IRL0 + 11) -+#define MS(_v, _f) (((_v) & (_f)) >> _f##_S) -+#define SM(_v, _f) (((_v) << _f##_S) & (_f)) -+#define IFX_REG_SET_BIT(_f, _r) \ -+ IFX_REG_W32((IFX_REG_R32((_r)) &~ (_f)) | (_f), (_r)) -+ -+#define IFX_PCIE_LTSSM_ENABLE_TIMEOUT 10 -+ -+static DEFINE_SPINLOCK(ifx_pcie_lock); -+ -+u32 g_pcie_debug_flag = PCIE_MSG_ANY & (~PCIE_MSG_CFG); -+ -+static ifx_pcie_irq_t pcie_irqs[IFX_PCIE_CORE_NR] = { -+ { -+ .ir_irq = { -+ .irq = IFX_PCIE_IR, -+ .name = "ifx_pcie_rc0", -+ }, -+ -+ .legacy_irq = { -+ { -+ .irq_bit = PCIE_IRN_INTA, -+ .irq = IFX_PCIE_INTA, -+ }, -+ { -+ .irq_bit = PCIE_IRN_INTB, -+ .irq = IFX_PCIE_INTB, -+ }, -+ { -+ .irq_bit = PCIE_IRN_INTC, -+ .irq = IFX_PCIE_INTC, -+ }, -+ { -+ .irq_bit = PCIE_IRN_INTD, -+ .irq = IFX_PCIE_INTD, -+ }, -+ }, -+ }, -+ -+}; -+ -+void ifx_pcie_debug(const char *fmt, ...) -+{ -+ static char buf[256] = {0}; /* XXX */ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vsnprintf(buf, sizeof(buf), fmt, ap); -+ va_end(ap); -+ -+ printk("%s", buf); -+} -+ -+ -+static inline int pcie_ltssm_enable(int pcie_port) -+{ -+ int i; -+ -+ /* Enable LTSSM */ -+ IFX_REG_W32(PCIE_RC_CCR_LTSSM_ENABLE, PCIE_RC_CCR(pcie_port)); -+ -+ /* Wait for the link to come up */ -+ for (i = 0; i < IFX_PCIE_LTSSM_ENABLE_TIMEOUT; i++) { -+ if (!(IFX_REG_R32(PCIE_LCTLSTS(pcie_port)) & PCIE_LCTLSTS_RETRAIN_PENDING)) -+ return 0; -+ udelay(10); -+ } -+ -+ printk("%s link timeout!!!!!\n", __func__); -+ return -1; -+} -+ -+static inline void pcie_status_register_clear(int pcie_port) -+{ -+ IFX_REG_W32(0, PCIE_RC_DR(pcie_port)); -+ IFX_REG_W32(0, PCIE_PCICMDSTS(pcie_port)); -+ IFX_REG_W32(0, PCIE_DCTLSTS(pcie_port)); -+ IFX_REG_W32(0, PCIE_LCTLSTS(pcie_port)); -+ IFX_REG_W32(0, PCIE_SLCTLSTS(pcie_port)); -+ IFX_REG_W32(0, PCIE_RSTS(pcie_port)); -+ IFX_REG_W32(0, PCIE_UES_R(pcie_port)); -+ IFX_REG_W32(0, PCIE_UEMR(pcie_port)); -+ IFX_REG_W32(0, PCIE_UESR(pcie_port)); -+ IFX_REG_W32(0, PCIE_CESR(pcie_port)); -+ IFX_REG_W32(0, PCIE_CEMR(pcie_port)); -+ IFX_REG_W32(0, PCIE_RESR(pcie_port)); -+ IFX_REG_W32(0, PCIE_PVCCRSR(pcie_port)); -+ IFX_REG_W32(0, PCIE_VC0_RSR0(pcie_port)); -+ IFX_REG_W32(0, PCIE_TPFCS(pcie_port)); -+ IFX_REG_W32(0, PCIE_TNPFCS(pcie_port)); -+ IFX_REG_W32(0, PCIE_TCFCS(pcie_port)); -+ IFX_REG_W32(0, PCIE_QSR(pcie_port)); -+ IFX_REG_W32(0, PCIE_IOBLSECS(pcie_port)); -+} -+ -+static inline int ifx_pcie_link_up(int pcie_port) -+{ -+ return (IFX_REG_R32(PCIE_PHY_SR(pcie_port)) & PCIE_PHY_SR_PHY_LINK_UP) ? 1 : 0; -+} -+ -+ -+static inline void pcie_mem_io_setup(int pcie_port) -+{ -+ u32 reg; -+ /* -+ * BAR[0:1] readonly register -+ * RC contains only minimal BARs for packets mapped to this device -+ * Mem/IO filters defines a range of memory occupied by memory mapped IO devices that -+ * reside on the downstream side fo the bridge. -+ */ -+ reg = SM((PCIE_MEM_PHY_PORT_TO_END(pcie_port) >> 20), PCIE_MBML_MEM_LIMIT_ADDR) -+ | SM((PCIE_MEM_PHY_PORT_TO_BASE(pcie_port) >> 20), PCIE_MBML_MEM_BASE_ADDR); -+ -+ IFX_REG_W32(reg, PCIE_MBML(pcie_port)); -+ -+ -+#ifdef IFX_PCIE_PREFETCH_MEM_64BIT -+ reg = SM((PCIE_MEM_PHY_PORT_TO_END(pcie_port) >> 20), PCIE_PMBL_END_ADDR) -+ | SM((PCIE_MEM_PHY_PORT_TO_BASE(pcie_port) >> 20), PCIE_PMBL_UPPER_12BIT) -+ | PCIE_PMBL_64BIT_ADDR; -+ IFX_REG_W32(reg, PCIE_PMBL(pcie_port)); -+ -+ /* Must configure upper 32bit */ -+ IFX_REG_W32(0, PCIE_PMBU32(pcie_port)); -+ IFX_REG_W32(0, PCIE_PMLU32(pcie_port)); -+#else -+ /* PCIe_PBML, same as MBML */ -+ IFX_REG_W32(IFX_REG_R32(PCIE_MBML(pcie_port)), PCIE_PMBL(pcie_port)); -+#endif -+ -+ /* IO Address Range */ -+ reg = SM((PCIE_IO_PHY_PORT_TO_END(pcie_port) >> 12), PCIE_IOBLSECS_IO_LIMIT_ADDR) -+ | SM((PCIE_IO_PHY_PORT_TO_BASE(pcie_port) >> 12), PCIE_IOBLSECS_IO_BASE_ADDR); -+#ifdef IFX_PCIE_IO_32BIT -+ reg |= PCIE_IOBLSECS_32BIT_IO_ADDR; -+#endif /* IFX_PCIE_IO_32BIT */ -+ IFX_REG_W32(reg, PCIE_IOBLSECS(pcie_port)); -+ -+#ifdef IFX_PCIE_IO_32BIT -+ reg = SM((PCIE_IO_PHY_PORT_TO_END(pcie_port) >> 16), PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT) -+ | SM((PCIE_IO_PHY_PORT_TO_BASE(pcie_port) >> 16), PCIE_IO_BANDL_UPPER_16BIT_IO_BASE); -+ IFX_REG_W32(reg, PCIE_IO_BANDL(pcie_port)); -+ -+#endif /* IFX_PCIE_IO_32BIT */ -+} -+ -+static inline void -+pcie_device_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ /* Device capability register, set up Maximum payload size */ -+ reg = IFX_REG_R32(PCIE_DCAP(pcie_port)); -+ reg |= PCIE_DCAP_ROLE_BASE_ERR_REPORT; -+ reg |= SM(PCIE_MAX_PAYLOAD_128, PCIE_DCAP_MAX_PAYLOAD_SIZE); -+ -+ /* Only available for EP */ -+ reg &= ~(PCIE_DCAP_EP_L0S_LATENCY | PCIE_DCAP_EP_L1_LATENCY); -+ IFX_REG_W32(reg, PCIE_DCAP(pcie_port)); -+ -+ /* Device control and status register */ -+ /* Set Maximum Read Request size for the device as a Requestor */ -+ reg = IFX_REG_R32(PCIE_DCTLSTS(pcie_port)); -+ -+ /* -+ * Request size can be larger than the MPS used, but the completions returned -+ * for the read will be bounded by the MPS size. -+ * In our system, Max request size depends on AHB burst size. It is 64 bytes. -+ * but we set it as 128 as minimum one. -+ */ -+ reg |= SM(PCIE_MAX_PAYLOAD_128, PCIE_DCTLSTS_MAX_READ_SIZE) -+ | SM(PCIE_MAX_PAYLOAD_128, PCIE_DCTLSTS_MAX_PAYLOAD_SIZE); -+ -+ /* Enable relaxed ordering, no snoop, and all kinds of errors */ -+ reg |= PCIE_DCTLSTS_RELAXED_ORDERING_EN | PCIE_DCTLSTS_ERR_EN | PCIE_DCTLSTS_NO_SNOOP_EN; -+ -+ IFX_REG_W32(reg, PCIE_DCTLSTS(pcie_port)); -+} -+ -+static inline void -+pcie_link_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ /* -+ * XXX, Link capability register, bit 18 for EP CLKREQ# dynamic clock management for L1, L2/3 CPM -+ * L0s is reported during link training via TS1 order set by N_FTS -+ */ -+ reg = IFX_REG_R32(PCIE_LCAP(pcie_port)); -+ reg &= ~PCIE_LCAP_L0S_EIXT_LATENCY; -+ reg |= SM(3, PCIE_LCAP_L0S_EIXT_LATENCY); -+ IFX_REG_W32(reg, PCIE_LCAP(pcie_port)); -+ -+ /* Link control and status register */ -+ reg = IFX_REG_R32(PCIE_LCTLSTS(pcie_port)); -+ -+ /* Link Enable, ASPM enabled */ -+ reg &= ~PCIE_LCTLSTS_LINK_DISABLE; -+ -+#ifdef CONFIG_PCIEASPM -+ /* -+ * We use the same physical reference clock that the platform provides on the connector -+ * It paved the way for ASPM to calculate the new exit Latency -+ */ -+ reg |= PCIE_LCTLSTS_SLOT_CLK_CFG; -+ reg |= PCIE_LCTLSTS_COM_CLK_CFG; -+ /* -+ * We should disable ASPM by default except that we have dedicated power management support -+ * Enable ASPM will cause the system hangup/instability, performance degration -+ */ -+ reg |= PCIE_LCTLSTS_ASPM_ENABLE; -+#else -+ reg &= ~PCIE_LCTLSTS_ASPM_ENABLE; -+#endif /* CONFIG_PCIEASPM */ -+ -+ /* -+ * The maximum size of any completion with data packet is bounded by the MPS setting -+ * in device control register -+ */ -+ -+ /* RCB may cause multiple split transactions, two options available, we use 64 byte RCB */ -+ reg &= ~ PCIE_LCTLSTS_RCB128; -+ -+ IFX_REG_W32(reg, PCIE_LCTLSTS(pcie_port)); -+} -+ -+static inline void pcie_error_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ /* -+ * Forward ERR_COR, ERR_NONFATAL, ERR_FATAL to the backbone -+ * Poisoned write TLPs and completions indicating poisoned TLPs will set the PCIe_PCICMDSTS.MDPE -+ */ -+ reg = IFX_REG_R32(PCIE_INTRBCTRL(pcie_port)); -+ reg |= PCIE_INTRBCTRL_SERR_ENABLE | PCIE_INTRBCTRL_PARITY_ERR_RESP_ENABLE; -+ -+ IFX_REG_W32(reg, PCIE_INTRBCTRL(pcie_port)); -+ -+ /* Uncorrectable Error Mask Register, Unmask all bits in PCIE_UESR */ -+ reg = IFX_REG_R32(PCIE_UEMR(pcie_port)); -+ reg &= ~PCIE_ALL_UNCORRECTABLE_ERR; -+ IFX_REG_W32(reg, PCIE_UEMR(pcie_port)); -+ -+ /* Uncorrectable Error Severity Register, ALL errors are FATAL */ -+ IFX_REG_W32(PCIE_ALL_UNCORRECTABLE_ERR, PCIE_UESR(pcie_port)); -+ -+ /* Correctable Error Mask Register, unmask all bits */ -+ reg = IFX_REG_R32(PCIE_CEMR(pcie_port)); -+ reg &= ~PCIE_CORRECTABLE_ERR; -+ IFX_REG_W32(reg, PCIE_CEMR(pcie_port)); -+ -+ /* Advanced Error Capabilities and Control Registr */ -+ reg = IFX_REG_R32(PCIE_AECCR(pcie_port)); -+ reg |= PCIE_AECCR_ECRC_CHECK_EN | PCIE_AECCR_ECRC_GEN_EN; -+ IFX_REG_W32(reg, PCIE_AECCR(pcie_port)); -+ -+ /* Root Error Command Register, Report all types of errors */ -+ reg = IFX_REG_R32(PCIE_RECR(pcie_port)); -+ reg |= PCIE_RECR_ERR_REPORT_EN; -+ IFX_REG_W32(reg, PCIE_RECR(pcie_port)); -+ -+ /* Clear the Root status register */ -+ reg = IFX_REG_R32(PCIE_RESR(pcie_port)); -+ IFX_REG_W32(reg, PCIE_RESR(pcie_port)); -+} -+ -+static inline void pcie_port_logic_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ /* FTS number, default 12, increase to 63, may increase time from/to L0s to L0 */ -+ reg = IFX_REG_R32(PCIE_AFR(pcie_port)); -+ reg &= ~(PCIE_AFR_FTS_NUM | PCIE_AFR_COM_FTS_NUM); -+ reg |= SM(PCIE_AFR_FTS_NUM_DEFAULT, PCIE_AFR_FTS_NUM) -+ | SM(PCIE_AFR_FTS_NUM_DEFAULT, PCIE_AFR_COM_FTS_NUM); -+ /* L0s and L1 entry latency */ -+ reg &= ~(PCIE_AFR_L0S_ENTRY_LATENCY | PCIE_AFR_L1_ENTRY_LATENCY); -+ reg |= SM(PCIE_AFR_L0S_ENTRY_LATENCY_DEFAULT, PCIE_AFR_L0S_ENTRY_LATENCY) -+ | SM(PCIE_AFR_L1_ENTRY_LATENCY_DEFAULT, PCIE_AFR_L1_ENTRY_LATENCY); -+ IFX_REG_W32(reg, PCIE_AFR(pcie_port)); -+ -+ -+ /* Port Link Control Register */ -+ reg = IFX_REG_R32(PCIE_PLCR(pcie_port)); -+ reg |= PCIE_PLCR_DLL_LINK_EN; /* Enable the DLL link */ -+ IFX_REG_W32(reg, PCIE_PLCR(pcie_port)); -+ -+ /* Lane Skew Register */ -+ reg = IFX_REG_R32(PCIE_LSR(pcie_port)); -+ /* Enable ACK/NACK and FC */ -+ reg &= ~(PCIE_LSR_ACKNAK_DISABLE | PCIE_LSR_FC_DISABLE); -+ IFX_REG_W32(reg, PCIE_LSR(pcie_port)); -+ -+ /* Symbol Timer Register and Filter Mask Register 1 */ -+ reg = IFX_REG_R32(PCIE_STRFMR(pcie_port)); -+ -+ /* Default SKP interval is very accurate already, 5us */ -+ /* Enable IO/CFG transaction */ -+ reg |= PCIE_STRFMR_RX_CFG_TRANS_ENABLE | PCIE_STRFMR_RX_IO_TRANS_ENABLE; -+ /* Disable FC WDT */ -+ reg &= ~PCIE_STRFMR_FC_WDT_DISABLE; -+ IFX_REG_W32(reg, PCIE_STRFMR(pcie_port)); -+ -+ /* Filter Masker Register 2 */ -+ reg = IFX_REG_R32(PCIE_FMR2(pcie_port)); -+ reg |= PCIE_FMR2_VENDOR_MSG1_PASSED_TO_TRGT1 | PCIE_FMR2_VENDOR_MSG0_PASSED_TO_TRGT1; -+ IFX_REG_W32(reg, PCIE_FMR2(pcie_port)); -+ -+ /* VC0 Completion Receive Queue Control Register */ -+ reg = IFX_REG_R32(PCIE_VC0_CRQCR(pcie_port)); -+ reg &= ~PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE; -+ reg |= SM(PCIE_VC0_TLP_QUEUE_MODE_BYPASS, PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE); -+ IFX_REG_W32(reg, PCIE_VC0_CRQCR(pcie_port)); -+} -+ -+static inline void pcie_rc_cfg_reg_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ /* Disable LTSSM */ -+ IFX_REG_W32(0, PCIE_RC_CCR(pcie_port)); /* Disable LTSSM */ -+ -+ pcie_mem_io_setup(pcie_port); -+ -+ /* XXX, MSI stuff should only apply to EP */ -+ /* MSI Capability: Only enable 32-bit addresses */ -+ reg = IFX_REG_R32(PCIE_MCAPR(pcie_port)); -+ reg &= ~PCIE_MCAPR_ADDR64_CAP; -+ -+ reg |= PCIE_MCAPR_MSI_ENABLE; -+ -+ /* Disable multiple message */ -+ reg &= ~(PCIE_MCAPR_MULTI_MSG_CAP | PCIE_MCAPR_MULTI_MSG_ENABLE); -+ IFX_REG_W32(reg, PCIE_MCAPR(pcie_port)); -+ -+ -+ /* Enable PME, Soft reset enabled */ -+ reg = IFX_REG_R32(PCIE_PM_CSR(pcie_port)); -+ reg |= PCIE_PM_CSR_PME_ENABLE | PCIE_PM_CSR_SW_RST; -+ IFX_REG_W32(reg, PCIE_PM_CSR(pcie_port)); -+ -+ /* setup the bus */ -+ reg = SM(0, PCIE_BNR_PRIMARY_BUS_NUM) | SM(1, PCIE_PNR_SECONDARY_BUS_NUM) | SM(0xFF, PCIE_PNR_SUB_BUS_NUM); -+ IFX_REG_W32(reg, PCIE_BNR(pcie_port)); -+ -+ -+ pcie_device_setup(pcie_port); -+ pcie_link_setup(pcie_port); -+ pcie_error_setup(pcie_port); -+ -+ /* Root control and capabilities register */ -+ reg = IFX_REG_R32(PCIE_RCTLCAP(pcie_port)); -+ reg |= PCIE_RCTLCAP_SERR_ENABLE | PCIE_RCTLCAP_PME_INT_EN; -+ IFX_REG_W32(reg, PCIE_RCTLCAP(pcie_port)); -+ -+ /* Port VC Capability Register 2 */ -+ reg = IFX_REG_R32(PCIE_PVC2(pcie_port)); -+ reg &= ~PCIE_PVC2_VC_ARB_WRR; -+ reg |= PCIE_PVC2_VC_ARB_16P_FIXED_WRR; -+ IFX_REG_W32(reg, PCIE_PVC2(pcie_port)); -+ -+ /* VC0 Resource Capability Register */ -+ reg = IFX_REG_R32(PCIE_VC0_RC(pcie_port)); -+ reg &= ~PCIE_VC0_RC_REJECT_SNOOP; -+ IFX_REG_W32(reg, PCIE_VC0_RC(pcie_port)); -+ -+ pcie_port_logic_setup(pcie_port); -+} -+ -+static int ifx_pcie_wait_phy_link_up(int pcie_port) -+{ -+#define IFX_PCIE_PHY_LINK_UP_TIMEOUT 1000 /* XXX, tunable */ -+ int i; -+ -+ /* Wait for PHY link is up */ -+ for (i = 0; i < IFX_PCIE_PHY_LINK_UP_TIMEOUT; i++) { -+ if (ifx_pcie_link_up(pcie_port)) { -+ break; -+ } -+ udelay(100); -+ } -+ if (i >= IFX_PCIE_PHY_LINK_UP_TIMEOUT) { -+ printk(KERN_ERR "%s timeout\n", __func__); -+ return -1; -+ } -+ -+ /* Check data link up or not */ -+ if (!(IFX_REG_R32(PCIE_RC_DR(pcie_port)) & PCIE_RC_DR_DLL_UP)) { -+ printk(KERN_ERR "%s DLL link is still down\n", __func__); -+ return -1; -+ } -+ -+ /* Check Data link active or not */ -+ if (!(IFX_REG_R32(PCIE_LCTLSTS(pcie_port)) & PCIE_LCTLSTS_DLL_ACTIVE)) { -+ printk(KERN_ERR "%s DLL is not active\n", __func__); -+ return -1; -+ } -+ return 0; -+} -+ -+static inline int pcie_app_loigc_setup(int pcie_port) -+{ -+ /* supress ahb bus errrors */ -+ IFX_REG_W32(PCIE_AHB_CTRL_BUS_ERROR_SUPPRESS, PCIE_AHB_CTRL(pcie_port)); -+ -+ /* Pull PCIe EP out of reset */ -+ pcie_device_rst_deassert(pcie_port); -+ -+ /* Start LTSSM training between RC and EP */ -+ pcie_ltssm_enable(pcie_port); -+ -+ /* Check PHY status after enabling LTSSM */ -+ if (ifx_pcie_wait_phy_link_up(pcie_port) != 0) -+ return -1; -+ -+ return 0; -+} -+ -+/* -+ * The numbers below are directly from the PCIe spec table 3-4/5. -+ */ -+static inline void pcie_replay_time_update(int pcie_port) -+{ -+ u32 reg; -+ int nlw; -+ int rtl; -+ -+ reg = IFX_REG_R32(PCIE_LCTLSTS(pcie_port)); -+ -+ nlw = MS(reg, PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH); -+ switch (nlw) { -+ case PCIE_MAX_LENGTH_WIDTH_X1: -+ rtl = 1677; -+ break; -+ case PCIE_MAX_LENGTH_WIDTH_X2: -+ rtl = 867; -+ break; -+ case PCIE_MAX_LENGTH_WIDTH_X4: -+ rtl = 462; -+ break; -+ case PCIE_MAX_LENGTH_WIDTH_X8: -+ rtl = 258; -+ break; -+ default: -+ rtl = 1677; -+ break; -+ } -+ reg = IFX_REG_R32(PCIE_ALTRT(pcie_port)); -+ reg &= ~PCIE_ALTRT_REPLAY_TIME_LIMIT; -+ reg |= SM(rtl, PCIE_ALTRT_REPLAY_TIME_LIMIT); -+ IFX_REG_W32(reg, PCIE_ALTRT(pcie_port)); -+} -+ -+/* -+ * Table 359 Enhanced Configuration Address Mapping1) -+ * 1) This table is defined in Table 7-1, page 341, PCI Express Base Specification v1.1 -+ * Memory Address PCI Express Configuration Space -+ * A[(20+n-1):20] Bus Number 1 < n < 8 -+ * A[19:15] Device Number -+ * A[14:12] Function Number -+ * A[11:8] Extended Register Number -+ * A[7:2] Register Number -+ * A[1:0] Along with size of the access, used to generate Byte Enables -+ * For VR9, only the address bits [22:0] are mapped to the configuration space: -+ * . Address bits [22:20] select the target bus (1-of-8)1) -+ * . Address bits [19:15] select the target device (1-of-32) on the bus -+ * . Address bits [14:12] select the target function (1-of-8) within the device. -+ * . Address bits [11:2] selects the target dword (1-of-1024) within the selected function.s configuration space -+ * . Address bits [1:0] define the start byte location within the selected dword. -+ */ -+static inline u32 pcie_bus_addr(u8 bus_num, u16 devfn, int where) -+{ -+ u32 addr; -+ u8 bus; -+ -+ if (!bus_num) { -+ /* type 0 */ -+ addr = ((PCI_SLOT(devfn) & 0x1F) << 15) | ((PCI_FUNC(devfn) & 0x7) << 12) | ((where & 0xFFF)& ~3); -+ } else { -+ bus = bus_num; -+ /* type 1, only support 8 buses */ -+ addr = ((bus & 0x7) << 20) | ((PCI_SLOT(devfn) & 0x1F) << 15) | -+ ((PCI_FUNC(devfn) & 0x7) << 12) | ((where & 0xFFF) & ~3); -+ } -+ return addr; -+} -+ -+static int pcie_valid_config(int pcie_port, int bus, int dev) -+{ -+ /* RC itself */ -+ if ((bus == 0) && (dev == 0)) { -+ return 1; -+ } -+ -+ /* No physical link */ -+ if (!ifx_pcie_link_up(pcie_port)) { -+ return 0; -+ } -+ -+ /* Bus zero only has RC itself -+ * XXX, check if EP will be integrated -+ */ -+ if ((bus == 0) && (dev != 0)) { -+ return 0; -+ } -+ -+ /* Maximum 8 buses supported for VRX */ -+ if (bus > 9) { -+ return 0; -+ } -+ -+ /* -+ * PCIe is PtP link, one bus only supports only one device -+ * except bus zero and PCIe switch which is virtual bus device -+ * The following two conditions really depends on the system design -+ * and attached the device. -+ * XXX, how about more new switch -+ */ -+ if ((bus == 1) && (dev != 0)) { -+ return 0; -+ } -+ -+ if ((bus >= 3) && (dev != 0)) { -+ return 0; -+ } -+ return 1; -+} -+ -+static inline u32 ifx_pcie_cfg_rd(int pcie_port, u32 reg) -+{ -+ return IFX_REG_R32((volatile u32 *)(PCIE_CFG_PORT_TO_BASE(pcie_port) + reg)); -+} -+ -+static inline void ifx_pcie_cfg_wr(int pcie_port, unsigned int reg, u32 val) -+{ -+ IFX_REG_W32( val, (volatile u32 *)(PCIE_CFG_PORT_TO_BASE(pcie_port) + reg)); -+} -+ -+static inline u32 ifx_pcie_rc_cfg_rd(int pcie_port, u32 reg) -+{ -+ return IFX_REG_R32((volatile u32 *)(PCIE_RC_PORT_TO_BASE(pcie_port) + reg)); -+} -+ -+static inline void ifx_pcie_rc_cfg_wr(int pcie_port, unsigned int reg, u32 val) -+{ -+ IFX_REG_W32(val, (volatile u32 *)(PCIE_RC_PORT_TO_BASE(pcie_port) + reg)); -+} -+ -+u32 ifx_pcie_bus_enum_read_hack(int where, u32 value) -+{ -+ u32 tvalue = value; -+ -+ if (where == PCI_PRIMARY_BUS) { -+ u8 primary, secondary, subordinate; -+ -+ primary = tvalue & 0xFF; -+ secondary = (tvalue >> 8) & 0xFF; -+ subordinate = (tvalue >> 16) & 0xFF; -+ primary += pcibios_1st_host_bus_nr(); -+ secondary += pcibios_1st_host_bus_nr(); -+ subordinate += pcibios_1st_host_bus_nr(); -+ tvalue = (tvalue & 0xFF000000) | (u32)primary | (u32)(secondary << 8) | (u32)(subordinate << 16); -+ } -+ return tvalue; -+} -+ -+u32 ifx_pcie_bus_enum_write_hack(int where, u32 value) -+{ -+ u32 tvalue = value; -+ -+ if (where == PCI_PRIMARY_BUS) { -+ u8 primary, secondary, subordinate; -+ -+ primary = tvalue & 0xFF; -+ secondary = (tvalue >> 8) & 0xFF; -+ subordinate = (tvalue >> 16) & 0xFF; -+ if (primary > 0 && primary != 0xFF) { -+ primary -= pcibios_1st_host_bus_nr(); -+ } -+ -+ if (secondary > 0 && secondary != 0xFF) { -+ secondary -= pcibios_1st_host_bus_nr(); -+ } -+ if (subordinate > 0 && subordinate != 0xFF) { -+ subordinate -= pcibios_1st_host_bus_nr(); -+ } -+ tvalue = (tvalue & 0xFF000000) | (u32)primary | (u32)(secondary << 8) | (u32)(subordinate << 16); -+ } -+ else if (where == PCI_SUBORDINATE_BUS) { -+ u8 subordinate = tvalue & 0xFF; -+ -+ subordinate = subordinate > 0 ? subordinate - pcibios_1st_host_bus_nr() : 0; -+ tvalue = subordinate; -+ } -+ return tvalue; -+} -+ -+static int ifx_pcie_read_config(struct pci_bus *bus, u32 devfn, -+ int where, int size, u32 *value) -+{ -+ u32 data = 0; -+ int bus_number = bus->number; -+ static const u32 mask[8] = {0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0}; -+ int ret = PCIBIOS_SUCCESSFUL; -+ struct ifx_pci_controller *ctrl = bus->sysdata; -+ int pcie_port = ctrl->port; -+ -+ if (unlikely(size != 1 && size != 2 && size != 4)){ -+ ret = PCIBIOS_BAD_REGISTER_NUMBER; -+ goto out; -+ } -+ -+ /* Make sure the address is aligned to natural boundary */ -+ if (unlikely(((size - 1) & where))) { -+ ret = PCIBIOS_BAD_REGISTER_NUMBER; -+ goto out; -+ } -+ -+ /* -+ * If we are second controller, we have to cheat OS so that it assume -+ * its bus number starts from 0 in host controller -+ */ -+ bus_number = ifx_pcie_bus_nr_deduct(bus_number, pcie_port); -+ -+ /* -+ * We need to force the bus number to be zero on the root -+ * bus. Linux numbers the 2nd root bus to start after all -+ * busses on root 0. -+ */ -+ if (bus->parent == NULL) { -+ bus_number = 0; -+ } -+ -+ /* -+ * PCIe only has a single device connected to it. It is -+ * always device ID 0. Don't bother doing reads for other -+ * device IDs on the first segment. -+ */ -+ if ((bus_number == 0) && (PCI_SLOT(devfn) != 0)) { -+ ret = PCIBIOS_FUNC_NOT_SUPPORTED; -+ goto out; -+ } -+ -+ if (pcie_valid_config(pcie_port, bus_number, PCI_SLOT(devfn)) == 0) { -+ *value = 0xffffffff; -+ ret = PCIBIOS_DEVICE_NOT_FOUND; -+ goto out; -+ } -+ -+ PCIE_IRQ_LOCK(ifx_pcie_lock); -+ if (bus_number == 0) { /* RC itself */ -+ u32 t; -+ -+ t = (where & ~3); -+ data = ifx_pcie_rc_cfg_rd(pcie_port, t); -+ } else { -+ u32 addr = pcie_bus_addr(bus_number, devfn, where); -+ -+ data = ifx_pcie_cfg_rd(pcie_port, addr); -+ #ifdef CONFIG_IFX_PCIE_HW_SWAP -+ data = le32_to_cpu(data); -+ #endif /* CONFIG_IFX_PCIE_HW_SWAP */ -+ } -+ /* To get a correct PCI topology, we have to restore the bus number to OS */ -+ data = ifx_pcie_bus_enum_hack(bus, devfn, where, data, pcie_port, 1); -+ -+ PCIE_IRQ_UNLOCK(ifx_pcie_lock); -+ -+ *value = (data >> (8 * (where & 3))) & mask[size & 7]; -+out: -+ return ret; -+} -+ -+static u32 ifx_pcie_size_to_value(int where, int size, u32 data, u32 value) -+{ -+ u32 shift; -+ u32 tdata = data; -+ -+ switch (size) { -+ case 1: -+ shift = (where & 0x3) << 3; -+ tdata &= ~(0xffU << shift); -+ tdata |= ((value & 0xffU) << shift); -+ break; -+ case 2: -+ shift = (where & 3) << 3; -+ tdata &= ~(0xffffU << shift); -+ tdata |= ((value & 0xffffU) << shift); -+ break; -+ case 4: -+ tdata = value; -+ break; -+ } -+ return tdata; -+} -+ -+static int ifx_pcie_write_config(struct pci_bus *bus, u32 devfn, -+ int where, int size, u32 value) -+{ -+ int bus_number = bus->number; -+ int ret = PCIBIOS_SUCCESSFUL; -+ struct ifx_pci_controller *ctrl = bus->sysdata; -+ int pcie_port = ctrl->port; -+ u32 tvalue = value; -+ u32 data; -+ -+ /* Make sure the address is aligned to natural boundary */ -+ if (unlikely(((size - 1) & where))) { -+ ret = PCIBIOS_BAD_REGISTER_NUMBER; -+ goto out; -+ } -+ /* -+ * If we are second controller, we have to cheat OS so that it assume -+ * its bus number starts from 0 in host controller -+ */ -+ bus_number = ifx_pcie_bus_nr_deduct(bus_number, pcie_port); -+ -+ /* -+ * We need to force the bus number to be zero on the root -+ * bus. Linux numbers the 2nd root bus to start after all -+ * busses on root 0. -+ */ -+ if (bus->parent == NULL) { -+ bus_number = 0; -+ } -+ -+ if (pcie_valid_config(pcie_port, bus_number, PCI_SLOT(devfn)) == 0) { -+ ret = PCIBIOS_DEVICE_NOT_FOUND; -+ goto out; -+ } -+ -+ /* XXX, some PCIe device may need some delay */ -+ PCIE_IRQ_LOCK(ifx_pcie_lock); -+ -+ /* -+ * To configure the correct bus topology using native way, we have to cheat Os so that -+ * it can configure the PCIe hardware correctly. -+ */ -+ tvalue = ifx_pcie_bus_enum_hack(bus, devfn, where, value, pcie_port, 0); -+ -+ if (bus_number == 0) { /* RC itself */ -+ u32 t; -+ -+ t = (where & ~3); -+ data = ifx_pcie_rc_cfg_rd(pcie_port, t); -+ -+ data = ifx_pcie_size_to_value(where, size, data, tvalue); -+ -+ ifx_pcie_rc_cfg_wr(pcie_port, t, data); -+ } else { -+ u32 addr = pcie_bus_addr(bus_number, devfn, where); -+ -+ data = ifx_pcie_cfg_rd(pcie_port, addr); -+#ifdef CONFIG_IFX_PCIE_HW_SWAP -+ data = le32_to_cpu(data); -+#endif -+ -+ data = ifx_pcie_size_to_value(where, size, data, tvalue); -+#ifdef CONFIG_IFX_PCIE_HW_SWAP -+ data = cpu_to_le32(data); -+#endif -+ ifx_pcie_cfg_wr(pcie_port, addr, data); -+ } -+ PCIE_IRQ_UNLOCK(ifx_pcie_lock); -+out: -+ return ret; -+} -+ -+static struct resource ifx_pcie_io_resource = { -+ .name = "PCIe0 I/O space", -+ .start = PCIE_IO_PHY_BASE, -+ .end = PCIE_IO_PHY_END, -+ .flags = IORESOURCE_IO, -+}; -+ -+static struct resource ifx_pcie_mem_resource = { -+ .name = "PCIe0 Memory space", -+ .start = PCIE_MEM_PHY_BASE, -+ .end = PCIE_MEM_PHY_END, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct pci_ops ifx_pcie_ops = { -+ .read = ifx_pcie_read_config, -+ .write = ifx_pcie_write_config, -+}; -+ -+static struct ifx_pci_controller ifx_pcie_controller[IFX_PCIE_CORE_NR] = { -+ { -+ .pcic = { -+ .pci_ops = &ifx_pcie_ops, -+ .mem_resource = &ifx_pcie_mem_resource, -+ .io_resource = &ifx_pcie_io_resource, -+ }, -+ .port = IFX_PCIE_PORT0, -+ }, -+}; -+ -+#ifdef IFX_PCIE_ERROR_INT -+ -+static irqreturn_t pcie_rc_core_isr(int irq, void *dev_id) -+{ -+ struct ifx_pci_controller *ctrl = (struct ifx_pci_controller *)dev_id; -+ int pcie_port = ctrl->port; -+ u32 reg; -+ -+ pr_debug("PCIe RC error intr %d\n", irq); -+ reg = IFX_REG_R32(PCIE_IRNCR(pcie_port)); -+ reg &= PCIE_RC_CORE_COMBINED_INT; -+ IFX_REG_W32(reg, PCIE_IRNCR(pcie_port)); -+ -+ return IRQ_HANDLED; -+} -+ -+static int -+pcie_rc_core_int_init(int pcie_port) -+{ -+ int ret; -+ -+ /* Enable core interrupt */ -+ IFX_REG_SET_BIT(PCIE_RC_CORE_COMBINED_INT, PCIE_IRNEN(pcie_port)); -+ -+ /* Clear it first */ -+ IFX_REG_SET_BIT(PCIE_RC_CORE_COMBINED_INT, PCIE_IRNCR(pcie_port)); -+ ret = request_irq(pcie_irqs[pcie_port].ir_irq.irq, pcie_rc_core_isr, 0, -+ pcie_irqs[pcie_port].ir_irq.name, &ifx_pcie_controller[pcie_port]); -+ if (ret) -+ printk(KERN_ERR "%s request irq %d failed\n", __func__, IFX_PCIE_IR); -+ -+ return ret; -+} -+#endif -+ -+int ifx_pcie_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ u32 irq_bit = 0; -+ int irq = 0; -+ struct ifx_pci_controller *ctrl = dev->bus->sysdata; -+ int pcie_port = ctrl->port; -+ -+ printk("%s port %d dev %s slot %d pin %d \n", __func__, pcie_port, pci_name(dev), slot, pin); -+ -+ if ((pin == PCIE_LEGACY_DISABLE) || (pin > PCIE_LEGACY_INT_MAX)) { -+ printk(KERN_WARNING "WARNING: dev %s: invalid interrupt pin %d\n", pci_name(dev), pin); -+ return -1; -+ } -+ -+ /* Pin index so minus one */ -+ irq_bit = pcie_irqs[pcie_port].legacy_irq[pin - 1].irq_bit; -+ irq = pcie_irqs[pcie_port].legacy_irq[pin - 1].irq; -+ IFX_REG_SET_BIT(irq_bit, PCIE_IRNEN(pcie_port)); -+ IFX_REG_SET_BIT(irq_bit, PCIE_IRNCR(pcie_port)); -+ printk("%s dev %s irq %d assigned\n", __func__, pci_name(dev), irq); -+ return irq; -+} -+ -+int ifx_pcie_bios_plat_dev_init(struct pci_dev *dev) -+{ -+ u16 config; -+#ifdef IFX_PCIE_ERROR_INT -+ u32 dconfig; -+ int pos; -+#endif -+ -+ /* Enable reporting System errors and parity errors on all devices */ -+ /* Enable parity checking and error reporting */ -+ pci_read_config_word(dev, PCI_COMMAND, &config); -+ config |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR /*| PCI_COMMAND_INVALIDATE | -+ PCI_COMMAND_FAST_BACK*/; -+ pci_write_config_word(dev, PCI_COMMAND, config); -+ -+ if (dev->subordinate) { -+ /* Set latency timers on sub bridges */ -+ pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, 0x40); /* XXX, */ -+ /* More bridge error detection */ -+ pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &config); -+ config |= PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR; -+ pci_write_config_word(dev, PCI_BRIDGE_CONTROL, config); -+ } -+#ifdef IFX_PCIE_ERROR_INT -+ /* Enable the PCIe normal error reporting */ -+ pos = pci_find_capability(dev, PCI_CAP_ID_EXP); -+ if (pos) { -+ -+ /* Disable system error generation in response to error messages */ -+ pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &config); -+ config &= ~(PCI_EXP_RTCTL_SECEE | PCI_EXP_RTCTL_SENFEE | PCI_EXP_RTCTL_SEFEE); -+ pci_write_config_word(dev, pos + PCI_EXP_RTCTL, config); -+ -+ /* Clear PCIE Capability's Device Status */ -+ pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &config); -+ pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, config); -+ -+ /* Update Device Control */ -+ pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &config); -+ /* Correctable Error Reporting */ -+ config |= PCI_EXP_DEVCTL_CERE; -+ /* Non-Fatal Error Reporting */ -+ config |= PCI_EXP_DEVCTL_NFERE; -+ /* Fatal Error Reporting */ -+ config |= PCI_EXP_DEVCTL_FERE; -+ /* Unsupported Request */ -+ config |= PCI_EXP_DEVCTL_URRE; -+ pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, config); -+ } -+ -+ /* Find the Advanced Error Reporting capability */ -+ pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); -+ if (pos) { -+ /* Clear Uncorrectable Error Status */ -+ pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &dconfig); -+ pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, dconfig); -+ /* Enable reporting of all uncorrectable errors */ -+ /* Uncorrectable Error Mask - turned on bits disable errors */ -+ pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, 0); -+ /* -+ * Leave severity at HW default. This only controls if -+ * errors are reported as uncorrectable or -+ * correctable, not if the error is reported. -+ */ -+ /* PCI_ERR_UNCOR_SEVER - Uncorrectable Error Severity */ -+ /* Clear Correctable Error Status */ -+ pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, &dconfig); -+ pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, dconfig); -+ /* Enable reporting of all correctable errors */ -+ /* Correctable Error Mask - turned on bits disable errors */ -+ pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, 0); -+ /* Advanced Error Capabilities */ -+ pci_read_config_dword(dev, pos + PCI_ERR_CAP, &dconfig); -+ /* ECRC Generation Enable */ -+ if (dconfig & PCI_ERR_CAP_ECRC_GENC) { -+ dconfig |= PCI_ERR_CAP_ECRC_GENE; -+ } -+ /* ECRC Check Enable */ -+ if (dconfig & PCI_ERR_CAP_ECRC_CHKC) { -+ dconfig |= PCI_ERR_CAP_ECRC_CHKE; -+ } -+ pci_write_config_dword(dev, pos + PCI_ERR_CAP, dconfig); -+ -+ /* PCI_ERR_HEADER_LOG - Header Log Register (16 bytes) */ -+ /* Enable Root Port's interrupt in response to error messages */ -+ pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, -+ PCI_ERR_ROOT_CMD_COR_EN | -+ PCI_ERR_ROOT_CMD_NONFATAL_EN | -+ PCI_ERR_ROOT_CMD_FATAL_EN); -+ /* Clear the Root status register */ -+ pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &dconfig); -+ pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig); -+ } -+#endif /* IFX_PCIE_ERROR_INT */ -+ /* WAR, only 128 MRRS is supported, force all EPs to support this value */ -+ pcie_set_readrq(dev, 128); -+ return 0; -+} -+ -+static int -+pcie_rc_initialize(int pcie_port) -+{ -+ int i; -+#define IFX_PCIE_PHY_LOOP_CNT 5 -+ -+ pcie_rcu_endian_setup(pcie_port); -+ -+ pcie_ep_gpio_rst_init(pcie_port); -+ -+ /* -+ * XXX, PCIe elastic buffer bug will cause not to be detected. One more -+ * reset PCIe PHY will solve this issue -+ */ -+ for (i = 0; i < IFX_PCIE_PHY_LOOP_CNT; i++) { -+ /* Disable PCIe PHY Analog part for sanity check */ -+ pcie_phy_pmu_disable(pcie_port); -+ -+ pcie_phy_rst_assert(pcie_port); -+ pcie_phy_rst_deassert(pcie_port); -+ -+ /* Make sure PHY PLL is stable */ -+ udelay(20); -+ -+ /* PCIe Core reset enabled, low active, sw programmed */ -+ pcie_core_rst_assert(pcie_port); -+ -+ /* Put PCIe EP in reset status */ -+ pcie_device_rst_assert(pcie_port); -+ -+ /* PCI PHY & Core reset disabled, high active, sw programmed */ -+ pcie_core_rst_deassert(pcie_port); -+ -+ /* Already in a quiet state, program PLL, enable PHY, check ready bit */ -+ pcie_phy_clock_mode_setup(pcie_port); -+ -+ /* Enable PCIe PHY and Clock */ -+ pcie_core_pmu_setup(pcie_port); -+ -+ /* Clear status registers */ -+ pcie_status_register_clear(pcie_port); -+ -+#ifdef CONFIG_PCI_MSI -+ pcie_msi_init(pcie_port); -+#endif /* CONFIG_PCI_MSI */ -+ pcie_rc_cfg_reg_setup(pcie_port); -+ -+ /* Once link is up, break out */ -+ if (pcie_app_loigc_setup(pcie_port) == 0) -+ break; -+ } -+ if (i >= IFX_PCIE_PHY_LOOP_CNT) { -+ printk(KERN_ERR "%s link up failed!!!!!\n", __func__); -+ return -EIO; -+ } -+ /* NB, don't increase ACK/NACK timer timeout value, which will cause a lot of COR errors */ -+ pcie_replay_time_update(pcie_port); -+ return 0; -+} -+ -+static int __init ifx_pcie_bios_init(void) -+{ -+ void __iomem *io_map_base; -+ int pcie_port; -+ int startup_port; -+ -+ /* Enable AHB Master/ Slave */ -+ pcie_ahb_pmu_setup(); -+ -+ startup_port = IFX_PCIE_PORT0; -+ -+ for (pcie_port = startup_port; pcie_port < IFX_PCIE_CORE_NR; pcie_port++){ -+ if (pcie_rc_initialize(pcie_port) == 0) { -+ IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: ifx_pcie_cfg_base 0x%p\n", -+ __func__, PCIE_CFG_PORT_TO_BASE(pcie_port)); -+ /* Otherwise, warning will pop up */ -+ io_map_base = ioremap(PCIE_IO_PHY_PORT_TO_BASE(pcie_port), PCIE_IO_SIZE); -+ if (io_map_base == NULL) { -+ IFX_PCIE_PRINT(PCIE_MSG_ERR, "%s io space ioremap failed\n", __func__); -+ return -ENOMEM; -+ } -+ ifx_pcie_controller[pcie_port].pcic.io_map_base = (unsigned long)io_map_base; -+ -+ register_pci_controller(&ifx_pcie_controller[pcie_port].pcic); -+ /* XXX, clear error status */ -+ -+ IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: mem_resource 0x%p, io_resource 0x%p\n", -+ __func__, &ifx_pcie_controller[pcie_port].pcic.mem_resource, -+ &ifx_pcie_controller[pcie_port].pcic.io_resource); -+ -+ #ifdef IFX_PCIE_ERROR_INT -+ pcie_rc_core_int_init(pcie_port); -+ #endif /* IFX_PCIE_ERROR_INT */ -+ } -+ } -+ -+ return 0; -+} -+arch_initcall(ifx_pcie_bios_init); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Chuanhua.Lei@infineon.com"); -+MODULE_SUPPORTED_DEVICE("Infineon builtin PCIe RC module"); -+MODULE_DESCRIPTION("Infineon builtin PCIe RC driver"); -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie.h -@@ -0,0 +1,135 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie.h -+** PROJECT : IFX UEIP for VRX200 -+** MODULES : PCIe module -+** -+** DATE : 02 Mar 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Version $Date $Author $Comment -+** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+#ifndef IFXMIPS_PCIE_H -+#define IFXMIPS_PCIE_H -+#include -+#include -+#include -+#include -+#include "ifxmips_pci_common.h" -+#include "ifxmips_pcie_reg.h" -+ -+/*! -+ \defgroup IFX_PCIE PCI Express bus driver module -+ \brief PCI Express IP module support VRX200 -+*/ -+ -+/*! -+ \defgroup IFX_PCIE_OS OS APIs -+ \ingroup IFX_PCIE -+ \brief PCIe bus driver OS interface functions -+*/ -+ -+/*! -+ \file ifxmips_pcie.h -+ \ingroup IFX_PCIE -+ \brief header file for PCIe module common header file -+*/ -+#define PCIE_IRQ_LOCK(lock) do { \ -+ unsigned long flags; \ -+ spin_lock_irqsave(&(lock), flags); -+#define PCIE_IRQ_UNLOCK(lock) \ -+ spin_unlock_irqrestore(&(lock), flags); \ -+} while (0) -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+#define IRQF_SHARED SA_SHIRQ -+#endif -+ -+#define PCIE_MSG_MSI 0x00000001 -+#define PCIE_MSG_ISR 0x00000002 -+#define PCIE_MSG_FIXUP 0x00000004 -+#define PCIE_MSG_READ_CFG 0x00000008 -+#define PCIE_MSG_WRITE_CFG 0x00000010 -+#define PCIE_MSG_CFG (PCIE_MSG_READ_CFG | PCIE_MSG_WRITE_CFG) -+#define PCIE_MSG_REG 0x00000020 -+#define PCIE_MSG_INIT 0x00000040 -+#define PCIE_MSG_ERR 0x00000080 -+#define PCIE_MSG_PHY 0x00000100 -+#define PCIE_MSG_ANY 0x000001ff -+ -+#define IFX_PCIE_PORT0 0 -+#define IFX_PCIE_PORT1 1 -+ -+#ifdef CONFIG_IFX_PCIE_2ND_CORE -+#define IFX_PCIE_CORE_NR 2 -+#else -+#define IFX_PCIE_CORE_NR 1 -+#endif -+ -+#define IFX_PCIE_ERROR_INT -+ -+//#define IFX_PCIE_DBG -+ -+#if defined(IFX_PCIE_DBG) -+#define IFX_PCIE_PRINT(_m, _fmt, args...) do { \ -+ ifx_pcie_debug((_fmt), ##args); \ -+} while (0) -+ -+#define INLINE -+#else -+#define IFX_PCIE_PRINT(_m, _fmt, args...) \ -+ do {} while(0) -+#define INLINE inline -+#endif -+ -+struct ifx_pci_controller { -+ struct pci_controller pcic; -+ -+ /* RC specific, per host bus information */ -+ u32 port; /* Port index, 0 -- 1st core, 1 -- 2nd core */ -+}; -+ -+typedef struct ifx_pcie_ir_irq { -+ const unsigned int irq; -+ const char name[16]; -+}ifx_pcie_ir_irq_t; -+ -+typedef struct ifx_pcie_legacy_irq{ -+ const u32 irq_bit; -+ const int irq; -+}ifx_pcie_legacy_irq_t; -+ -+typedef struct ifx_pcie_irq { -+ ifx_pcie_ir_irq_t ir_irq; -+ ifx_pcie_legacy_irq_t legacy_irq[PCIE_LEGACY_INT_MAX]; -+}ifx_pcie_irq_t; -+ -+extern u32 g_pcie_debug_flag; -+extern void ifx_pcie_debug(const char *fmt, ...); -+extern void pcie_phy_clock_mode_setup(int pcie_port); -+extern void pcie_msi_pic_init(int pcie_port); -+extern u32 ifx_pcie_bus_enum_read_hack(int where, u32 value); -+extern u32 ifx_pcie_bus_enum_write_hack(int where, u32 value); -+ -+#define CONFIG_VR9 -+ -+#ifdef CONFIG_VR9 -+#include "ifxmips_pcie_vr9.h" -+#elif defined (CONFIG_AR10) -+#include "ifxmips_pcie_ar10.h" -+#else -+#error "PCIE: platform not defined" -+#endif /* CONFIG_VR9 */ -+ -+#endif /* IFXMIPS_PCIE_H */ -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_ar10.h -@@ -0,0 +1,290 @@ -+/**************************************************************************** -+ Copyright (c) 2010 -+ Lantiq Deutschland GmbH -+ Am Campeon 3; 85579 Neubiberg, Germany -+ -+ For licensing information, see the file 'LICENSE' in the root folder of -+ this software module. -+ -+ *****************************************************************************/ -+/*! -+ \file ifxmips_pcie_ar10.h -+ \ingroup IFX_PCIE -+ \brief PCIe RC driver ar10 specific file -+*/ -+ -+#ifndef IFXMIPS_PCIE_AR10_H -+#define IFXMIPS_PCIE_AR10_H -+#ifndef AUTOCONF_INCLUDED -+#include -+#endif /* AUTOCONF_INCLUDED */ -+#include -+#include -+ -+/* Project header file */ -+#include -+#include -+#include -+#include -+ -+static inline void pcie_ep_gpio_rst_init(int pcie_port) -+{ -+ ifx_ebu_led_enable(); -+ if (pcie_port == 0) { -+ ifx_ebu_led_set_data(11, 1); -+ } -+ else { -+ ifx_ebu_led_set_data(12, 1); -+ } -+} -+ -+static inline void pcie_ahb_pmu_setup(void) -+{ -+ /* XXX, moved to CGU to control AHBM */ -+} -+ -+static inline void pcie_rcu_endian_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); -+ /* Inbound, big endian */ -+ reg |= IFX_RCU_BE_AHB4S; -+ if (pcie_port == 0) { -+ reg |= IFX_RCU_BE_PCIE0M; -+ -+ #ifdef CONFIG_IFX_PCIE_HW_SWAP -+ /* Outbound, software swap needed */ -+ reg |= IFX_RCU_BE_AHB3M; -+ reg &= ~IFX_RCU_BE_PCIE0S; -+ #else -+ /* Outbound little endian */ -+ reg &= ~IFX_RCU_BE_AHB3M; -+ reg &= ~IFX_RCU_BE_PCIE0S; -+ #endif -+ } -+ else { -+ reg |= IFX_RCU_BE_PCIE1M; -+ #ifdef CONFIG_IFX_PCIE1_HW_SWAP -+ /* Outbound, software swap needed */ -+ reg |= IFX_RCU_BE_AHB3M; -+ reg &= ~IFX_RCU_BE_PCIE1S; -+ #else -+ /* Outbound little endian */ -+ reg &= ~IFX_RCU_BE_AHB3M; -+ reg &= ~IFX_RCU_BE_PCIE1S; -+ #endif -+ } -+ -+ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); -+ IFX_PCIE_PRINT(PCIE_MSG_REG, "%s IFX_RCU_AHB_ENDIAN: 0x%08x\n", __func__, IFX_REG_R32(IFX_RCU_AHB_ENDIAN)); -+} -+ -+static inline void pcie_phy_pmu_enable(int pcie_port) -+{ -+ if (pcie_port == 0) { /* XXX, should use macro*/ -+ PCIE0_PHY_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+ else { -+ PCIE1_PHY_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+} -+ -+static inline void pcie_phy_pmu_disable(int pcie_port) -+{ -+ if (pcie_port == 0) { /* XXX, should use macro*/ -+ PCIE0_PHY_PMU_SETUP(IFX_PMU_DISABLE); -+ } -+ else { -+ PCIE1_PHY_PMU_SETUP(IFX_PMU_DISABLE); -+ } -+} -+ -+static inline void pcie_pdi_big_endian(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); -+ if (pcie_port == 0) { -+ /* Config AHB->PCIe and PDI endianness */ -+ reg |= IFX_RCU_BE_PCIE0_PDI; -+ } -+ else { -+ /* Config AHB->PCIe and PDI endianness */ -+ reg |= IFX_RCU_BE_PCIE1_PDI; -+ } -+ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); -+} -+ -+static inline void pcie_pdi_pmu_enable(int pcie_port) -+{ -+ if (pcie_port == 0) { -+ /* Enable PDI to access PCIe PHY register */ -+ PDI0_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+ else { -+ PDI1_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+} -+ -+static inline void pcie_core_rst_assert(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ -+ /* Reset Core, bit 22 */ -+ if (pcie_port == 0) { -+ reg |= 0x00400000; -+ } -+ else { -+ reg |= 0x08000000; /* Bit 27 */ -+ } -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_core_rst_deassert(int pcie_port) -+{ -+ u32 reg; -+ -+ /* Make sure one micro-second delay */ -+ udelay(1); -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ if (pcie_port == 0) { -+ reg &= ~0x00400000; /* bit 22 */ -+ } -+ else { -+ reg &= ~0x08000000; /* Bit 27 */ -+ } -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_phy_rst_assert(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ if (pcie_port == 0) { -+ reg |= 0x00001000; /* Bit 12 */ -+ } -+ else { -+ reg |= 0x00002000; /* Bit 13 */ -+ } -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_phy_rst_deassert(int pcie_port) -+{ -+ u32 reg; -+ -+ /* Make sure one micro-second delay */ -+ udelay(1); -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ if (pcie_port == 0) { -+ reg &= ~0x00001000; /* Bit 12 */ -+ } -+ else { -+ reg &= ~0x00002000; /* Bit 13 */ -+ } -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_device_rst_assert(int pcie_port) -+{ -+ if (pcie_port == 0) { -+ ifx_ebu_led_set_data(11, 0); -+ } -+ else { -+ ifx_ebu_led_set_data(12, 0); -+ } -+} -+ -+static inline void pcie_device_rst_deassert(int pcie_port) -+{ -+ mdelay(100); -+ if (pcie_port == 0) { -+ ifx_ebu_led_set_data(11, 1); -+ } -+ else { -+ ifx_ebu_led_set_data(12, 1); -+ } -+ ifx_ebu_led_disable(); -+} -+ -+static inline void pcie_core_pmu_setup(int pcie_port) -+{ -+ if (pcie_port == 0) { -+ PCIE0_CTRL_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+ else { -+ PCIE1_CTRL_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+} -+ -+static inline void pcie_msi_init(int pcie_port) -+{ -+ pcie_msi_pic_init(pcie_port); -+ if (pcie_port == 0) { -+ MSI0_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+ else { -+ MSI1_PMU_SETUP(IFX_PMU_ENABLE); -+ } -+} -+ -+static inline u32 -+ifx_pcie_bus_nr_deduct(u32 bus_number, int pcie_port) -+{ -+ u32 tbus_number = bus_number; -+ -+#ifdef CONFIG_IFX_PCIE_2ND_CORE -+ if (pcie_port == IFX_PCIE_PORT1) { /* Port 1 must check if there are two cores enabled */ -+ if (pcibios_host_nr() > 1) { -+ tbus_number -= pcibios_1st_host_bus_nr(); -+ } -+ } -+#endif /* CONFIG_IFX_PCI */ -+ return tbus_number; -+} -+ -+static inline u32 -+ifx_pcie_bus_enum_hack(struct pci_bus *bus, u32 devfn, int where, u32 value, int pcie_port, int read) -+{ -+ struct pci_dev *pdev; -+ u32 tvalue = value; -+ -+ /* Sanity check */ -+ pdev = pci_get_slot(bus, devfn); -+ if (pdev == NULL) { -+ return tvalue; -+ } -+ -+ /* Only care about PCI bridge */ -+ if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { -+ return tvalue; -+ } -+ -+ if (read) { /* Read hack */ -+ #ifdef CONFIG_IFX_PCIE_2ND_CORE -+ if (pcie_port == IFX_PCIE_PORT1) { /* Port 1 must check if there are two cores enabled */ -+ if (pcibios_host_nr() > 1) { -+ tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue); -+ } -+ } -+ #endif /* CONFIG_IFX_PCIE_2ND_CORE */ -+ } -+ else { /* Write hack */ -+ #ifdef CONFIG_IFX_PCIE_2ND_CORE -+ if (pcie_port == IFX_PCIE_PORT1) { /* Port 1 must check if there are two cores enabled */ -+ if (pcibios_host_nr() > 1) { -+ tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue); -+ } -+ } -+ #endif -+ } -+ return tvalue; -+} -+ -+#endif /* IFXMIPS_PCIE_AR10_H */ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_msi.c -@@ -0,0 +1,392 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie_msi.c -+** PROJECT : IFX UEIP for VRX200 -+** MODULES : PCI MSI sub module -+** -+** DATE : 02 Mar 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe MSI Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Date $Author $Comment -+** 02 Mar,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+/*! -+ \defgroup IFX_PCIE_MSI MSI OS APIs -+ \ingroup IFX_PCIE -+ \brief PCIe bus driver OS interface functions -+*/ -+ -+/*! -+ \file ifxmips_pcie_msi.c -+ \ingroup IFX_PCIE -+ \brief PCIe MSI OS interface file -+*/ -+ -+#ifndef AUTOCONF_INCLUDED -+#include -+#endif /* AUTOCONF_INCLUDED */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "ifxmips_pcie_reg.h" -+#include "ifxmips_pcie.h" -+ -+#define IFX_MSI_IRQ_NUM 16 -+ -+enum { -+ IFX_PCIE_MSI_IDX0 = 0, -+ IFX_PCIE_MSI_IDX1, -+ IFX_PCIE_MSI_IDX2, -+ IFX_PCIE_MSI_IDX3, -+}; -+ -+typedef struct ifx_msi_irq_idx { -+ const int irq; -+ const int idx; -+}ifx_msi_irq_idx_t; -+ -+struct ifx_msi_pic { -+ volatile u32 pic_table[IFX_MSI_IRQ_NUM]; -+ volatile u32 pic_endian; /* 0x40 */ -+}; -+typedef struct ifx_msi_pic *ifx_msi_pic_t; -+ -+typedef struct ifx_msi_irq { -+ const volatile ifx_msi_pic_t msi_pic_p; -+ const u32 msi_phy_base; -+ const ifx_msi_irq_idx_t msi_irq_idx[IFX_MSI_IRQ_NUM]; -+ /* -+ * Each bit in msi_free_irq_bitmask represents a MSI interrupt that is -+ * in use. -+ */ -+ u16 msi_free_irq_bitmask; -+ -+ /* -+ * Each bit in msi_multiple_irq_bitmask tells that the device using -+ * this bit in msi_free_irq_bitmask is also using the next bit. This -+ * is used so we can disable all of the MSI interrupts when a device -+ * uses multiple. -+ */ -+ u16 msi_multiple_irq_bitmask; -+}ifx_msi_irq_t; -+ -+static ifx_msi_irq_t msi_irqs[IFX_PCIE_CORE_NR] = { -+ { -+ .msi_pic_p = (const volatile ifx_msi_pic_t)IFX_MSI_PIC_REG_BASE, -+ .msi_phy_base = PCIE_MSI_PHY_BASE, -+ .msi_irq_idx = { -+ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ }, -+ .msi_free_irq_bitmask = 0, -+ .msi_multiple_irq_bitmask= 0, -+ }, -+#ifdef CONFIG_IFX_PCIE_2ND_CORE -+ { -+ .msi_pic_p = (const volatile ifx_msi_pic_t)IFX_MSI1_PIC_REG_BASE, -+ .msi_phy_base = PCIE1_MSI_PHY_BASE, -+ .msi_irq_idx = { -+ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, -+ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, -+ }, -+ .msi_free_irq_bitmask = 0, -+ .msi_multiple_irq_bitmask= 0, -+ -+ }, -+#endif /* CONFIG_IFX_PCIE_2ND_CORE */ -+}; -+ -+/* -+ * This lock controls updates to msi_free_irq_bitmask, -+ * msi_multiple_irq_bitmask and pic register settting -+ */ -+static DEFINE_SPINLOCK(ifx_pcie_msi_lock); -+ -+void pcie_msi_pic_init(int pcie_port) -+{ -+ spin_lock(&ifx_pcie_msi_lock); -+ msi_irqs[pcie_port].msi_pic_p->pic_endian = IFX_MSI_PIC_BIG_ENDIAN; -+ spin_unlock(&ifx_pcie_msi_lock); -+} -+ -+/** -+ * \fn int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) -+ * \brief Called when a driver request MSI interrupts instead of the -+ * legacy INT A-D. This routine will allocate multiple interrupts -+ * for MSI devices that support them. A device can override this by -+ * programming the MSI control bits [6:4] before calling -+ * pci_enable_msi(). -+ * -+ * \param[in] pdev Device requesting MSI interrupts -+ * \param[in] desc MSI descriptor -+ * -+ * \return -EINVAL Invalid pcie root port or invalid msi bit -+ * \return 0 OK -+ * \ingroup IFX_PCIE_MSI -+ */ -+int -+arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) -+{ -+ int irq, pos; -+ u16 control; -+ int irq_idx; -+ int irq_step; -+ int configured_private_bits; -+ int request_private_bits; -+ struct msi_msg msg; -+ u16 search_mask; -+ struct ifx_pci_controller *ctrl = pdev->bus->sysdata; -+ int pcie_port = ctrl->port; -+ -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s %s enter\n", __func__, pci_name(pdev)); -+ -+ /* XXX, skip RC MSI itself */ -+ if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) { -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s RC itself doesn't use MSI interrupt\n", __func__); -+ return -EINVAL; -+ } -+ -+ /* -+ * Read the MSI config to figure out how many IRQs this device -+ * wants. Most devices only want 1, which will give -+ * configured_private_bits and request_private_bits equal 0. -+ */ -+ pci_read_config_word(pdev, desc->msi_attrib.pos + PCI_MSI_FLAGS, &control); -+ -+ /* -+ * If the number of private bits has been configured then use -+ * that value instead of the requested number. This gives the -+ * driver the chance to override the number of interrupts -+ * before calling pci_enable_msi(). -+ */ -+ configured_private_bits = (control & PCI_MSI_FLAGS_QSIZE) >> 4; -+ if (configured_private_bits == 0) { -+ /* Nothing is configured, so use the hardware requested size */ -+ request_private_bits = (control & PCI_MSI_FLAGS_QMASK) >> 1; -+ } -+ else { -+ /* -+ * Use the number of configured bits, assuming the -+ * driver wanted to override the hardware request -+ * value. -+ */ -+ request_private_bits = configured_private_bits; -+ } -+ -+ /* -+ * The PCI 2.3 spec mandates that there are at most 32 -+ * interrupts. If this device asks for more, only give it one. -+ */ -+ if (request_private_bits > 5) { -+ request_private_bits = 0; -+ } -+again: -+ /* -+ * The IRQs have to be aligned on a power of two based on the -+ * number being requested. -+ */ -+ irq_step = (1 << request_private_bits); -+ -+ /* Mask with one bit for each IRQ */ -+ search_mask = (1 << irq_step) - 1; -+ -+ /* -+ * We're going to search msi_free_irq_bitmask_lock for zero -+ * bits. This represents an MSI interrupt number that isn't in -+ * use. -+ */ -+ spin_lock(&ifx_pcie_msi_lock); -+ for (pos = 0; pos < IFX_MSI_IRQ_NUM; pos += irq_step) { -+ if ((msi_irqs[pcie_port].msi_free_irq_bitmask & (search_mask << pos)) == 0) { -+ msi_irqs[pcie_port].msi_free_irq_bitmask |= search_mask << pos; -+ msi_irqs[pcie_port].msi_multiple_irq_bitmask |= (search_mask >> 1) << pos; -+ break; -+ } -+ } -+ spin_unlock(&ifx_pcie_msi_lock); -+ -+ /* Make sure the search for available interrupts didn't fail */ -+ if (pos >= IFX_MSI_IRQ_NUM) { -+ if (request_private_bits) { -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s: Unable to find %d free " -+ "interrupts, trying just one", __func__, 1 << request_private_bits); -+ request_private_bits = 0; -+ goto again; -+ } -+ else { -+ printk(KERN_ERR "%s: Unable to find a free MSI interrupt\n", __func__); -+ return -EINVAL; -+ } -+ } -+ irq = msi_irqs[pcie_port].msi_irq_idx[pos].irq; -+ irq_idx = msi_irqs[pcie_port].msi_irq_idx[pos].idx; -+ -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "pos %d, irq %d irq_idx %d\n", pos, irq, irq_idx); -+ -+ /* -+ * Initialize MSI. This has to match the memory-write endianess from the device -+ * Address bits [23:12] -+ */ -+ spin_lock(&ifx_pcie_msi_lock); -+ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] = SM(irq_idx, IFX_MSI_PIC_INT_LINE) | -+ SM((msi_irqs[pcie_port].msi_phy_base >> 12), IFX_MSI_PIC_MSG_ADDR) | -+ SM((1 << pos), IFX_MSI_PIC_MSG_DATA); -+ -+ /* Enable this entry */ -+ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] &= ~IFX_MSI_PCI_INT_DISABLE; -+ spin_unlock(&ifx_pcie_msi_lock); -+ -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "pic_table[%d]: 0x%08x\n", -+ pos, msi_irqs[pcie_port].msi_pic_p->pic_table[pos]); -+ -+ /* Update the number of IRQs the device has available to it */ -+ control &= ~PCI_MSI_FLAGS_QSIZE; -+ control |= (request_private_bits << 4); -+ pci_write_config_word(pdev, desc->msi_attrib.pos + PCI_MSI_FLAGS, control); -+ -+ set_irq_msi(irq, desc); -+ msg.address_hi = 0x0; -+ msg.address_lo = msi_irqs[pcie_port].msi_phy_base; -+ msg.data = SM((1 << pos), IFX_MSI_PIC_MSG_DATA); -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "msi_data: pos %d 0x%08x\n", pos, msg.data); -+ -+ write_msi_msg(irq, &msg); -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s exit\n", __func__); -+ return 0; -+} -+ -+static int -+pcie_msi_irq_to_port(unsigned int irq, int *port) -+{ -+ int ret = 0; -+ -+ if (irq == IFX_PCIE_MSI_IR0 || irq == IFX_PCIE_MSI_IR1 || -+ irq == IFX_PCIE_MSI_IR2 || irq == IFX_PCIE_MSI_IR3) { -+ *port = IFX_PCIE_PORT0; -+ } -+#ifdef CONFIG_IFX_PCIE_2ND_CORE -+ else if (irq == IFX_PCIE1_MSI_IR0 || irq == IFX_PCIE1_MSI_IR1 || -+ irq == IFX_PCIE1_MSI_IR2 || irq == IFX_PCIE1_MSI_IR3) { -+ *port = IFX_PCIE_PORT1; -+ } -+#endif /* CONFIG_IFX_PCIE_2ND_CORE */ -+ else { -+ printk(KERN_ERR "%s: Attempted to teardown illegal " -+ "MSI interrupt (%d)\n", __func__, irq); -+ ret = -EINVAL; -+ } -+ return ret; -+} -+ -+/** -+ * \fn void arch_teardown_msi_irq(unsigned int irq) -+ * \brief Called when a device no longer needs its MSI interrupts. All -+ * MSI interrupts for the device are freed. -+ * -+ * \param irq The devices first irq number. There may be multple in sequence. -+ * \return none -+ * \ingroup IFX_PCIE_MSI -+ */ -+void -+arch_teardown_msi_irq(unsigned int irq) -+{ -+ int pos; -+ int number_irqs; -+ u16 bitmask; -+ int pcie_port; -+ -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s enter\n", __func__); -+ -+ BUG_ON(irq > INT_NUM_IM4_IRL31); -+ -+ if (pcie_msi_irq_to_port(irq, &pcie_port) != 0) { -+ return; -+ } -+ -+ /* Shift the mask to the correct bit location, not always correct -+ * Probally, the first match will be chosen. -+ */ -+ for (pos = 0; pos < IFX_MSI_IRQ_NUM; pos++) { -+ if ((msi_irqs[pcie_port].msi_irq_idx[pos].irq == irq) -+ && (msi_irqs[pcie_port].msi_free_irq_bitmask & ( 1 << pos))) { -+ break; -+ } -+ } -+ if (pos >= IFX_MSI_IRQ_NUM) { -+ printk(KERN_ERR "%s: Unable to find a matched MSI interrupt\n", __func__); -+ return; -+ } -+ spin_lock(&ifx_pcie_msi_lock); -+ /* Disable this entry */ -+ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] |= IFX_MSI_PCI_INT_DISABLE; -+ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] &= ~(IFX_MSI_PIC_INT_LINE | IFX_MSI_PIC_MSG_ADDR | IFX_MSI_PIC_MSG_DATA); -+ spin_unlock(&ifx_pcie_msi_lock); -+ /* -+ * Count the number of IRQs we need to free by looking at the -+ * msi_multiple_irq_bitmask. Each bit set means that the next -+ * IRQ is also owned by this device. -+ */ -+ number_irqs = 0; -+ while (((pos + number_irqs) < IFX_MSI_IRQ_NUM) && -+ (msi_irqs[pcie_port].msi_multiple_irq_bitmask & (1 << (pos + number_irqs)))) { -+ number_irqs++; -+ } -+ number_irqs++; -+ -+ /* Mask with one bit for each IRQ */ -+ bitmask = (1 << number_irqs) - 1; -+ -+ bitmask <<= pos; -+ if ((msi_irqs[pcie_port].msi_free_irq_bitmask & bitmask) != bitmask) { -+ printk(KERN_ERR "%s: Attempted to teardown MSI " -+ "interrupt (%d) not in use\n", __func__, irq); -+ return; -+ } -+ /* Checks are done, update the in use bitmask */ -+ spin_lock(&ifx_pcie_msi_lock); -+ msi_irqs[pcie_port].msi_free_irq_bitmask &= ~bitmask; -+ msi_irqs[pcie_port].msi_multiple_irq_bitmask &= ~(bitmask >> 1); -+ spin_unlock(&ifx_pcie_msi_lock); -+ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s exit\n", __func__); -+} -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Chuanhua.Lei@infineon.com"); -+MODULE_SUPPORTED_DEVICE("Infineon PCIe IP builtin MSI PIC module"); -+MODULE_DESCRIPTION("Infineon PCIe IP builtin MSI PIC driver"); -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_phy.c -@@ -0,0 +1,478 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie_phy.c -+** PROJECT : IFX UEIP for VRX200 -+** MODULES : PCIe PHY sub module -+** -+** DATE : 14 May 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Version $Date $Author $Comment -+** 0.0.1 14 May,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+/*! -+ \file ifxmips_pcie_phy.c -+ \ingroup IFX_PCIE -+ \brief PCIe PHY PLL register programming source file -+*/ -+#include -+#include -+#include -+#include -+ -+#include "ifxmips_pcie_reg.h" -+#include "ifxmips_pcie.h" -+ -+/* PCIe PDI only supports 16 bit operation */ -+ -+#define IFX_PCIE_PHY_REG_WRITE16(__addr, __data) \ -+ ((*(volatile u16 *) (__addr)) = (__data)) -+ -+#define IFX_PCIE_PHY_REG_READ16(__addr) \ -+ (*(volatile u16 *) (__addr)) -+ -+#define IFX_PCIE_PHY_REG16(__addr) \ -+ (*(volatile u16 *) (__addr)) -+ -+#define IFX_PCIE_PHY_REG(__reg, __value, __mask) do { \ -+ u16 read_data; \ -+ u16 write_data; \ -+ read_data = IFX_PCIE_PHY_REG_READ16((__reg)); \ -+ write_data = (read_data & ((u16)~(__mask))) | (((u16)(__value)) & ((u16)(__mask)));\ -+ IFX_PCIE_PHY_REG_WRITE16((__reg), write_data); \ -+} while (0) -+ -+#define IFX_PCIE_PLL_TIMEOUT 1000 /* Tunnable */ -+ -+//#define IFX_PCI_PHY_REG_DUMP -+ -+#ifdef IFX_PCI_PHY_REG_DUMP -+static void -+pcie_phy_reg_dump(int pcie_port) -+{ -+ printk("PLL REGFILE\n"); -+ printk("PCIE_PHY_PLL_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL1(pcie_port))); -+ printk("PCIE_PHY_PLL_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL2(pcie_port))); -+ printk("PCIE_PHY_PLL_CTRL3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL3(pcie_port))); -+ printk("PCIE_PHY_PLL_CTRL4 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL4(pcie_port))); -+ printk("PCIE_PHY_PLL_CTRL5 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL5(pcie_port))); -+ printk("PCIE_PHY_PLL_CTRL6 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL6(pcie_port))); -+ printk("PCIE_PHY_PLL_CTRL7 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL7(pcie_port))); -+ printk("PCIE_PHY_PLL_A_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_A_CTRL1(pcie_port))); -+ printk("PCIE_PHY_PLL_A_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_A_CTRL2(pcie_port))); -+ printk("PCIE_PHY_PLL_A_CTRL3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_A_CTRL3(pcie_port))); -+ printk("PCIE_PHY_PLL_STATUS 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_STATUS(pcie_port))); -+ -+ printk("TX1 REGFILE\n"); -+ printk("PCIE_PHY_TX1_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_CTRL1(pcie_port))); -+ printk("PCIE_PHY_TX1_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_CTRL2(pcie_port))); -+ printk("PCIE_PHY_TX1_CTRL3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_CTRL3(pcie_port))); -+ printk("PCIE_PHY_TX1_A_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_A_CTRL1(pcie_port))); -+ printk("PCIE_PHY_TX1_A_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_A_CTRL2(pcie_port))); -+ printk("PCIE_PHY_TX1_MOD1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_MOD1(pcie_port))); -+ printk("PCIE_PHY_TX1_MOD2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_MOD2(pcie_port))); -+ printk("PCIE_PHY_TX1_MOD3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_MOD3(pcie_port))); -+ -+ printk("TX2 REGFILE\n"); -+ printk("PCIE_PHY_TX2_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_CTRL1(pcie_port))); -+ printk("PCIE_PHY_TX2_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_CTRL2(pcie_port))); -+ printk("PCIE_PHY_TX2_A_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_A_CTRL1(pcie_port))); -+ printk("PCIE_PHY_TX2_A_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_A_CTRL2(pcie_port))); -+ printk("PCIE_PHY_TX2_MOD1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_MOD1(pcie_port))); -+ printk("PCIE_PHY_TX2_MOD2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_MOD2(pcie_port))); -+ printk("PCIE_PHY_TX2_MOD3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_MOD3(pcie_port))); -+ -+ printk("RX1 REGFILE\n"); -+ printk("PCIE_PHY_RX1_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_CTRL1(pcie_port))); -+ printk("PCIE_PHY_RX1_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_CTRL2(pcie_port))); -+ printk("PCIE_PHY_RX1_CDR 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_CDR(pcie_port))); -+ printk("PCIE_PHY_RX1_EI 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_EI(pcie_port))); -+ printk("PCIE_PHY_RX1_A_CTRL 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_A_CTRL(pcie_port))); -+} -+#endif /* IFX_PCI_PHY_REG_DUMP */ -+ -+static void -+pcie_phy_comm_setup(int pcie_port) -+{ -+ /* PLL Setting */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL1(pcie_port), 0x120e, 0xFFFF); -+ -+ /* increase the bias reference voltage */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x39D7, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x0900, 0xFFFF); -+ -+ /* Endcnt */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_EI(pcie_port), 0x0004, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_A_CTRL(pcie_port), 0x6803, 0xFFFF); -+ -+ /* force */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0008, 0x0008); -+ -+ /* predrv_ser_en */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL2(pcie_port), 0x0706, 0xFFFF); -+ -+ /* ctrl_lim */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL3(pcie_port), 0x1FFF, 0xFFFF); -+ -+ /* ctrl */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL1(pcie_port), 0x0800, 0xFF00); -+ -+ /* predrv_ser_en */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4702, 0x7F00); -+ -+ /* RTERM*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL2(pcie_port), 0x2e00, 0xFFFF); -+ -+ /* Improved 100MHz clock output */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL2(pcie_port), 0x3096, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4707, 0xFFFF); -+ -+ /* Reduced CDR BW to avoid glitches */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CDR(pcie_port), 0x0235, 0xFFFF); -+} -+ -+#ifdef CONFIG_IFX_PCIE_PHY_36MHZ_MODE -+static void -+pcie_phy_36mhz_mode_setup(int pcie_port) -+{ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); -+#ifdef IFX_PCI_PHY_REG_DUMP -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); -+ pcie_phy_reg_dump(pcie_port); -+#endif -+ -+ /* en_ext_mmd_div_ratio */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0002); -+ -+ /* ext_mmd_div_ratio*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0070); -+ -+ /* pll_ensdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0200, 0x0200); -+ -+ /* en_const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0100, 0x0100); -+ -+ /* mmd */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x2000, 0xe000); -+ -+ /* lf_mode */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x0000, 0x4000); -+ -+ /* const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL1(pcie_port), 0x38e4, 0xFFFF); -+ -+ /* const sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x00ee, 0x00FF); -+ -+ /* pllmod */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL7(pcie_port), 0x0002, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL6(pcie_port), 0x3a04, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL5(pcie_port), 0xfae3, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL4(pcie_port), 0x1b72, 0xFFFF); -+ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); -+} -+#endif /* CONFIG_IFX_PCIE_PHY_36MHZ_MODE */ -+ -+#ifdef CONFIG_IFX_PCIE_PHY_36MHZ_SSC_MODE -+static void -+pcie_phy_36mhz_ssc_mode_setup(int pcie_port) -+{ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); -+#ifdef IFX_PCI_PHY_REG_DUMP -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); -+ pcie_phy_reg_dump(pcie_port); -+#endif -+ -+ /* PLL Setting */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL1(pcie_port), 0x120e, 0xFFFF); -+ -+ /* Increase the bias reference voltage */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x39D7, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x0900, 0xFFFF); -+ -+ /* Endcnt */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_EI(pcie_port), 0x0004, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_A_CTRL(pcie_port), 0x6803, 0xFFFF); -+ -+ /* Force */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0008, 0x0008); -+ -+ /* Predrv_ser_en */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL2(pcie_port), 0x0706, 0xFFFF); -+ -+ /* ctrl_lim */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL3(pcie_port), 0x1FFF, 0xFFFF); -+ -+ /* ctrl */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL1(pcie_port), 0x0800, 0xFF00); -+ -+ /* predrv_ser_en */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4702, 0x7F00); -+ -+ /* RTERM*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL2(pcie_port), 0x2e00, 0xFFFF); -+ -+ /* en_ext_mmd_div_ratio */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0002); -+ -+ /* ext_mmd_div_ratio*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0070); -+ -+ /* pll_ensdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0400, 0x0400); -+ -+ /* en_const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0200, 0x0200); -+ -+ /* mmd */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x2000, 0xe000); -+ -+ /* lf_mode */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x0000, 0x4000); -+ -+ /* const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL1(pcie_port), 0x38e4, 0xFFFF); -+ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0000, 0x0100); -+ /* const sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x00ee, 0x00FF); -+ -+ /* pllmod */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL7(pcie_port), 0x0002, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL6(pcie_port), 0x3a04, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL5(pcie_port), 0xfae3, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL4(pcie_port), 0x1c72, 0xFFFF); -+ -+ /* improved 100MHz clock output */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL2(pcie_port), 0x3096, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4707, 0xFFFF); -+ -+ /* reduced CDR BW to avoid glitches */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CDR(pcie_port), 0x0235, 0xFFFF); -+ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); -+} -+#endif /* CONFIG_IFX_PCIE_PHY_36MHZ_SSC_MODE */ -+ -+#ifdef CONFIG_IFX_PCIE_PHY_25MHZ_MODE -+static void -+pcie_phy_25mhz_mode_setup(int pcie_port) -+{ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); -+#ifdef IFX_PCI_PHY_REG_DUMP -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); -+ pcie_phy_reg_dump(pcie_port); -+#endif -+ /* en_const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0100, 0x0100); -+ -+ /* pll_ensdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0000, 0x0200); -+ -+ /* en_ext_mmd_div_ratio*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0002, 0x0002); -+ -+ /* ext_mmd_div_ratio*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0040, 0x0070); -+ -+ /* mmd */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x6000, 0xe000); -+ -+ /* lf_mode */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x4000, 0x4000); -+ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); -+} -+#endif /* CONFIG_IFX_PCIE_PHY_25MHZ_MODE */ -+ -+#ifdef CONFIG_IFX_PCIE_PHY_100MHZ_MODE -+static void -+pcie_phy_100mhz_mode_setup(int pcie_port) -+{ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); -+#ifdef IFX_PCI_PHY_REG_DUMP -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); -+ pcie_phy_reg_dump(pcie_port); -+#endif -+ /* en_ext_mmd_div_ratio */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0002); -+ -+ /* ext_mmd_div_ratio*/ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0070); -+ -+ /* pll_ensdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0200, 0x0200); -+ -+ /* en_const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0100, 0x0100); -+ -+ /* mmd */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x2000, 0xe000); -+ -+ /* lf_mode */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x0000, 0x4000); -+ -+ /* const_sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL1(pcie_port), 0x38e4, 0xFFFF); -+ -+ /* const sdm */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x00ee, 0x00FF); -+ -+ /* pllmod */ -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL7(pcie_port), 0x0002, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL6(pcie_port), 0x3a04, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL5(pcie_port), 0xfae3, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL4(pcie_port), 0x1b72, 0xFFFF); -+ -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); -+} -+#endif /* CONFIG_IFX_PCIE_PHY_100MHZ_MODE */ -+ -+static int -+pcie_phy_wait_startup_ready(int pcie_port) -+{ -+ int i; -+ -+ for (i = 0; i < IFX_PCIE_PLL_TIMEOUT; i++) { -+ if ((IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_STATUS(pcie_port)) & 0x0040) != 0) { -+ break; -+ } -+ udelay(10); -+ } -+ if (i >= IFX_PCIE_PLL_TIMEOUT) { -+ printk(KERN_ERR "%s PLL Link timeout\n", __func__); -+ return -1; -+ } -+ return 0; -+} -+ -+static void -+pcie_phy_load_enable(int pcie_port, int slice) -+{ -+ /* Set the load_en of tx/rx slice to '1' */ -+ switch (slice) { -+ case 1: -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0010, 0x0010); -+ break; -+ case 2: -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL1(pcie_port), 0x0010, 0x0010); -+ break; -+ case 3: -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CTRL1(pcie_port), 0x0002, 0x0002); -+ break; -+ } -+} -+ -+static void -+pcie_phy_load_disable(int pcie_port, int slice) -+{ -+ /* set the load_en of tx/rx slice to '0' */ -+ switch (slice) { -+ case 1: -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0000, 0x0010); -+ break; -+ case 2: -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL1(pcie_port), 0x0000, 0x0010); -+ break; -+ case 3: -+ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CTRL1(pcie_port), 0x0000, 0x0002); -+ break; -+ } -+} -+ -+static void -+pcie_phy_load_war(int pcie_port) -+{ -+ int slice; -+ -+ for (slice = 1; slice < 4; slice++) { -+ pcie_phy_load_enable(pcie_port, slice); -+ udelay(1); -+ pcie_phy_load_disable(pcie_port, slice); -+ } -+} -+ -+static void -+pcie_phy_tx2_modulation(int pcie_port) -+{ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD1(pcie_port), 0x1FFE, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD2(pcie_port), 0xFFFE, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD3(pcie_port), 0x0601, 0xFFFF); -+ mdelay(1); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD3(pcie_port), 0x0001, 0xFFFF); -+} -+ -+static void -+pcie_phy_tx1_modulation(int pcie_port) -+{ -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD1(pcie_port), 0x1FFE, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD2(pcie_port), 0xFFFE, 0xFFFF); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD3(pcie_port), 0x0601, 0xFFFF); -+ mdelay(1); -+ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD3(pcie_port), 0x0001, 0xFFFF); -+} -+ -+static void -+pcie_phy_tx_modulation_war(int pcie_port) -+{ -+ int i; -+ -+#define PCIE_PHY_MODULATION_NUM 5 -+ for (i = 0; i < PCIE_PHY_MODULATION_NUM; i++) { -+ pcie_phy_tx2_modulation(pcie_port); -+ pcie_phy_tx1_modulation(pcie_port); -+ } -+#undef PCIE_PHY_MODULATION_NUM -+} -+ -+void -+pcie_phy_clock_mode_setup(int pcie_port) -+{ -+ pcie_pdi_big_endian(pcie_port); -+ -+ /* Enable PDI to access PCIe PHY register */ -+ pcie_pdi_pmu_enable(pcie_port); -+ -+ /* Configure PLL and PHY clock */ -+ pcie_phy_comm_setup(pcie_port); -+ -+#ifdef CONFIG_IFX_PCIE_PHY_36MHZ_MODE -+ pcie_phy_36mhz_mode_setup(pcie_port); -+#elif defined(CONFIG_IFX_PCIE_PHY_36MHZ_SSC_MODE) -+ pcie_phy_36mhz_ssc_mode_setup(pcie_port); -+#elif defined(CONFIG_IFX_PCIE_PHY_25MHZ_MODE) -+ pcie_phy_25mhz_mode_setup(pcie_port); -+#elif defined (CONFIG_IFX_PCIE_PHY_100MHZ_MODE) -+ pcie_phy_100mhz_mode_setup(pcie_port); -+#else -+ #error "PCIE PHY Clock Mode must be chosen first!!!!" -+#endif /* CONFIG_IFX_PCIE_PHY_36MHZ_MODE */ -+ -+ /* Enable PCIe PHY and make PLL setting take effect */ -+ pcie_phy_pmu_enable(pcie_port); -+ -+ /* Check if we are in startup_ready status */ -+ pcie_phy_wait_startup_ready(pcie_port); -+ -+ pcie_phy_load_war(pcie_port); -+ -+ /* Apply TX modulation workarounds */ -+ pcie_phy_tx_modulation_war(pcie_port); -+ -+#ifdef IFX_PCI_PHY_REG_DUMP -+ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Modified PHY register dump\n"); -+ pcie_phy_reg_dump(pcie_port); -+#endif -+} -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_pm.c -@@ -0,0 +1,176 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie_pm.c -+** PROJECT : IFX UEIP -+** MODULES : PCIE Root Complex Driver -+** -+** DATE : 21 Dec 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIE Root Complex Driver Power Managment -+** COPYRIGHT : Copyright (c) 2009 -+** Lantiq Deutschland GmbH -+** Am Campeon 3, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** -+** HISTORY -+** $Date $Author $Comment -+** 21 Dec,2009 Lei Chuanhua First UEIP release -+*******************************************************************************/ -+/*! -+ \defgroup IFX_PCIE_PM Power Management functions -+ \ingroup IFX_PCIE -+ \brief IFX PCIE Root Complex Driver power management functions -+*/ -+ -+/*! -+ \file ifxmips_pcie_pm.c -+ \ingroup IFX_PCIE -+ \brief source file for PCIE Root Complex Driver Power Management -+*/ -+ -+#ifndef EXPORT_SYMTAB -+#define EXPORT_SYMTAB -+#endif -+#ifndef AUTOCONF_INCLUDED -+#include -+#endif /* AUTOCONF_INCLUDED */ -+#include -+#include -+#include -+#include -+#include -+ -+/* Project header */ -+#include -+#include -+#include -+#include -+#include "ifxmips_pcie_pm.h" -+ -+/** -+ * \fn static IFX_PMCU_RETURN_t ifx_pcie_pmcu_state_change(IFX_PMCU_STATE_t pmcuState) -+ * \brief the callback function to request pmcu state in the power management hardware-dependent module -+ * -+ * \param pmcuState This parameter is a PMCU state. -+ * -+ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully -+ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. -+ * \return IFX_PMCU_RETURN_DENIED Not allowed to operate power state -+ * \ingroup IFX_PCIE_PM -+ */ -+static IFX_PMCU_RETURN_t -+ifx_pcie_pmcu_state_change(IFX_PMCU_STATE_t pmcuState) -+{ -+ switch(pmcuState) -+ { -+ case IFX_PMCU_STATE_D0: -+ return IFX_PMCU_RETURN_SUCCESS; -+ case IFX_PMCU_STATE_D1: // Not Applicable -+ return IFX_PMCU_RETURN_DENIED; -+ case IFX_PMCU_STATE_D2: // Not Applicable -+ return IFX_PMCU_RETURN_DENIED; -+ case IFX_PMCU_STATE_D3: // Module clock gating and Power gating -+ return IFX_PMCU_RETURN_SUCCESS; -+ default: -+ return IFX_PMCU_RETURN_DENIED; -+ } -+} -+ -+/** -+ * \fn static IFX_PMCU_RETURN_t ifx_pcie_pmcu_state_get(IFX_PMCU_STATE_t *pmcuState) -+ * \brief the callback function to get pmcu state in the power management hardware-dependent module -+ -+ * \param pmcuState Pointer to return power state. -+ * -+ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully -+ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. -+ * \return IFX_PMCU_RETURN_DENIED Not allowed to operate power state -+ * \ingroup IFX_PCIE_PM -+ */ -+static IFX_PMCU_RETURN_t -+ifx_pcie_pmcu_state_get(IFX_PMCU_STATE_t *pmcuState) -+{ -+ return IFX_PMCU_RETURN_SUCCESS; -+} -+ -+/** -+ * \fn IFX_PMCU_RETURN_t ifx_pcie_pmcu_prechange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) -+ * \brief Apply all callbacks registered to be executed before a state change for pmcuModule -+ * -+ * \param pmcuModule Module -+ * \param newState New state -+ * \param oldState Old state -+ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully -+ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. -+ * \ingroup IFX_PCIE_PM -+ */ -+static IFX_PMCU_RETURN_t -+ifx_pcie_pmcu_prechange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) -+{ -+ return IFX_PMCU_RETURN_SUCCESS; -+} -+ -+/** -+ * \fn IFX_PMCU_RETURN_t ifx_pcie_pmcu_postchange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) -+ * \brief Apply all callbacks registered to be executed before a state change for pmcuModule -+ * -+ * \param pmcuModule Module -+ * \param newState New state -+ * \param oldState Old state -+ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully -+ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. -+ * \ingroup IFX_PCIE_PM -+ */ -+static IFX_PMCU_RETURN_t -+ifx_pcie_pmcu_postchange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) -+{ -+ return IFX_PMCU_RETURN_SUCCESS; -+} -+ -+/** -+ * \fn static void ifx_pcie_pmcu_init(void) -+ * \brief Register with central PMCU module -+ * \return none -+ * \ingroup IFX_PCIE_PM -+ */ -+void -+ifx_pcie_pmcu_init(void) -+{ -+ IFX_PMCU_REGISTER_t pmcuRegister; -+ -+ /* XXX, hook driver context */ -+ -+ /* State function register */ -+ memset(&pmcuRegister, 0, sizeof(IFX_PMCU_REGISTER_t)); -+ pmcuRegister.pmcuModule = IFX_PMCU_MODULE_PCIE; -+ pmcuRegister.pmcuModuleNr = 0; -+ pmcuRegister.ifx_pmcu_state_change = ifx_pcie_pmcu_state_change; -+ pmcuRegister.ifx_pmcu_state_get = ifx_pcie_pmcu_state_get; -+ pmcuRegister.pre = ifx_pcie_pmcu_prechange; -+ pmcuRegister.post= ifx_pcie_pmcu_postchange; -+ ifx_pmcu_register(&pmcuRegister); -+} -+ -+/** -+ * \fn static void ifx_pcie_pmcu_exit(void) -+ * \brief Unregister with central PMCU module -+ * -+ * \return none -+ * \ingroup IFX_PCIE_PM -+ */ -+void -+ifx_pcie_pmcu_exit(void) -+{ -+ IFX_PMCU_REGISTER_t pmcuUnRegister; -+ -+ /* XXX, hook driver context */ -+ -+ pmcuUnRegister.pmcuModule = IFX_PMCU_MODULE_PCIE; -+ pmcuUnRegister.pmcuModuleNr = 0; -+ ifx_pmcu_unregister(&pmcuUnRegister); -+} -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_pm.h -@@ -0,0 +1,36 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie_pm.h -+** PROJECT : IFX UEIP -+** MODULES : PCIe Root Complex Driver -+** -+** DATE : 21 Dec 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver Power Managment -+** COPYRIGHT : Copyright (c) 2009 -+** Lantiq Deutschland GmbH -+** Am Campeon 3, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** -+** HISTORY -+** $Date $Author $Comment -+** 21 Dec,2009 Lei Chuanhua First UEIP release -+*******************************************************************************/ -+/*! -+ \file ifxmips_pcie_pm.h -+ \ingroup IFX_PCIE -+ \brief header file for PCIe Root Complex Driver Power Management -+*/ -+ -+#ifndef IFXMIPS_PCIE_PM_H -+#define IFXMIPS_PCIE_PM_H -+ -+void ifx_pcie_pmcu_init(void); -+void ifx_pcie_pmcu_exit(void); -+ -+#endif /* IFXMIPS_PCIE_PM_H */ -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_reg.h -@@ -0,0 +1,1001 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie_reg.h -+** PROJECT : IFX UEIP for VRX200 -+** MODULES : PCIe module -+** -+** DATE : 02 Mar 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Version $Date $Author $Comment -+** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+#ifndef IFXMIPS_PCIE_REG_H -+#define IFXMIPS_PCIE_REG_H -+/*! -+ \file ifxmips_pcie_reg.h -+ \ingroup IFX_PCIE -+ \brief header file for PCIe module register definition -+*/ -+/* PCIe Address Mapping Base */ -+#define PCIE_CFG_PHY_BASE 0x1D000000UL -+#define PCIE_CFG_BASE (KSEG1 + PCIE_CFG_PHY_BASE) -+#define PCIE_CFG_SIZE (8 * 1024 * 1024) -+ -+#define PCIE_MEM_PHY_BASE 0x1C000000UL -+#define PCIE_MEM_BASE (KSEG1 + PCIE_MEM_PHY_BASE) -+#define PCIE_MEM_SIZE (16 * 1024 * 1024) -+#define PCIE_MEM_PHY_END (PCIE_MEM_PHY_BASE + PCIE_MEM_SIZE - 1) -+ -+#define PCIE_IO_PHY_BASE 0x1D800000UL -+#define PCIE_IO_BASE (KSEG1 + PCIE_IO_PHY_BASE) -+#define PCIE_IO_SIZE (1 * 1024 * 1024) -+#define PCIE_IO_PHY_END (PCIE_IO_PHY_BASE + PCIE_IO_SIZE - 1) -+ -+#define PCIE_RC_CFG_BASE (KSEG1 + 0x1D900000) -+#define PCIE_APP_LOGIC_REG (KSEG1 + 0x1E100900) -+#define PCIE_MSI_PHY_BASE 0x1F600000UL -+ -+#define PCIE_PDI_PHY_BASE 0x1F106800UL -+#define PCIE_PDI_BASE (KSEG1 + PCIE_PDI_PHY_BASE) -+#define PCIE_PDI_SIZE 0x400 -+ -+#define PCIE1_CFG_PHY_BASE 0x19000000UL -+#define PCIE1_CFG_BASE (KSEG1 + PCIE1_CFG_PHY_BASE) -+#define PCIE1_CFG_SIZE (8 * 1024 * 1024) -+ -+#define PCIE1_MEM_PHY_BASE 0x18000000UL -+#define PCIE1_MEM_BASE (KSEG1 + PCIE1_MEM_PHY_BASE) -+#define PCIE1_MEM_SIZE (16 * 1024 * 1024) -+#define PCIE1_MEM_PHY_END (PCIE1_MEM_PHY_BASE + PCIE1_MEM_SIZE - 1) -+ -+#define PCIE1_IO_PHY_BASE 0x19800000UL -+#define PCIE1_IO_BASE (KSEG1 + PCIE1_IO_PHY_BASE) -+#define PCIE1_IO_SIZE (1 * 1024 * 1024) -+#define PCIE1_IO_PHY_END (PCIE1_IO_PHY_BASE + PCIE1_IO_SIZE - 1) -+ -+#define PCIE1_RC_CFG_BASE (KSEG1 + 0x19900000) -+#define PCIE1_APP_LOGIC_REG (KSEG1 + 0x1E100700) -+#define PCIE1_MSI_PHY_BASE 0x1F400000UL -+ -+#define PCIE1_PDI_PHY_BASE 0x1F700400UL -+#define PCIE1_PDI_BASE (KSEG1 + PCIE1_PDI_PHY_BASE) -+#define PCIE1_PDI_SIZE 0x400 -+ -+#define PCIE_CFG_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_CFG_BASE) : (PCIE_CFG_BASE)) -+#define PCIE_MEM_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_BASE) : (PCIE_MEM_BASE)) -+#define PCIE_IO_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_BASE) : (PCIE_IO_BASE)) -+#define PCIE_MEM_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_PHY_BASE) : (PCIE_MEM_PHY_BASE)) -+#define PCIE_MEM_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_MEM_PHY_END) : (PCIE_MEM_PHY_END)) -+#define PCIE_IO_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_PHY_BASE) : (PCIE_IO_PHY_BASE)) -+#define PCIE_IO_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_IO_PHY_END) : (PCIE_IO_PHY_END)) -+#define PCIE_APP_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_APP_LOGIC_REG) : (PCIE_APP_LOGIC_REG)) -+#define PCIE_RC_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_RC_CFG_BASE) : (PCIE_RC_CFG_BASE)) -+#define PCIE_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_PDI_BASE) : (PCIE_PDI_BASE)) -+ -+/* PCIe Application Logic Register */ -+/* RC Core Control Register */ -+#define PCIE_RC_CCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x10) -+/* This should be enabled after initializing configuratin registers -+ * Also should check link status retraining bit -+ */ -+#define PCIE_RC_CCR_LTSSM_ENABLE 0x00000001 /* Enable LTSSM to continue link establishment */ -+ -+/* RC Core Debug Register */ -+#define PCIE_RC_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x14) -+#define PCIE_RC_DR_DLL_UP 0x00000001 /* Data Link Layer Up */ -+#define PCIE_RC_DR_CURRENT_POWER_STATE 0x0000000E /* Current Power State */ -+#define PCIE_RC_DR_CURRENT_POWER_STATE_S 1 -+#define PCIE_RC_DR_CURRENT_LTSSM_STATE 0x000001F0 /* Current LTSSM State */ -+#define PCIE_RC_DR_CURRENT_LTSSM_STATE_S 4 -+ -+#define PCIE_RC_DR_PM_DEV_STATE 0x00000E00 /* Power Management D-State */ -+#define PCIE_RC_DR_PM_DEV_STATE_S 9 -+ -+#define PCIE_RC_DR_PM_ENABLED 0x00001000 /* Power Management State from PMU */ -+#define PCIE_RC_DR_PME_EVENT_ENABLED 0x00002000 /* Power Management Event Enable State */ -+#define PCIE_RC_DR_AUX_POWER_ENABLED 0x00004000 /* Auxiliary Power Enable */ -+ -+/* Current Power State Definition */ -+enum { -+ PCIE_RC_DR_D0 = 0, -+ PCIE_RC_DR_D1, /* Not supported */ -+ PCIE_RC_DR_D2, /* Not supported */ -+ PCIE_RC_DR_D3, -+ PCIE_RC_DR_UN, -+}; -+ -+/* PHY Link Status Register */ -+#define PCIE_PHY_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x18) -+#define PCIE_PHY_SR_PHY_LINK_UP 0x00000001 /* PHY Link Up/Down Indicator */ -+ -+/* Electromechanical Control Register */ -+#define PCIE_EM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x1C) -+#define PCIE_EM_CR_CARD_IS_PRESENT 0x00000001 /* Card Presence Detect State */ -+#define PCIE_EM_CR_MRL_OPEN 0x00000002 /* MRL Sensor State */ -+#define PCIE_EM_CR_POWER_FAULT_SET 0x00000004 /* Power Fault Detected */ -+#define PCIE_EM_CR_MRL_SENSOR_SET 0x00000008 /* MRL Sensor Changed */ -+#define PCIE_EM_CR_PRESENT_DETECT_SET 0x00000010 /* Card Presense Detect Changed */ -+#define PCIE_EM_CR_CMD_CPL_INT_SET 0x00000020 /* Command Complete Interrupt */ -+#define PCIE_EM_CR_SYS_INTERLOCK_SET 0x00000040 /* System Electromechanical IterLock Engaged */ -+#define PCIE_EM_CR_ATTENTION_BUTTON_SET 0x00000080 /* Attention Button Pressed */ -+ -+/* Interrupt Status Register */ -+#define PCIE_IR_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x20) -+#define PCIE_IR_SR_PME_CAUSE_MSI 0x00000002 /* MSI caused by PME */ -+#define PCIE_IR_SR_HP_PME_WAKE_GEN 0x00000004 /* Hotplug PME Wake Generation */ -+#define PCIE_IR_SR_HP_MSI 0x00000008 /* Hotplug MSI */ -+#define PCIE_IR_SR_AHB_LU_ERR 0x00000030 /* AHB Bridge Lookup Error Signals */ -+#define PCIE_IR_SR_AHB_LU_ERR_S 4 -+#define PCIE_IR_SR_INT_MSG_NUM 0x00003E00 /* Interrupt Message Number */ -+#define PCIE_IR_SR_INT_MSG_NUM_S 9 -+#define PCIE_IR_SR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ -+#define PCIE_IR_SR_AER_INT_MSG_NUM_S 27 -+ -+/* Message Control Register */ -+#define PCIE_MSG_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x30) -+#define PCIE_MSG_CR_GEN_PME_TURN_OFF_MSG 0x00000001 /* Generate PME Turn Off Message */ -+#define PCIE_MSG_CR_GEN_UNLOCK_MSG 0x00000002 /* Generate Unlock Message */ -+ -+#define PCIE_VDM_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x34) -+ -+/* Vendor-Defined Message Requester ID Register */ -+#define PCIE_VDM_RID(X) (PCIE_APP_PORT_TO_BASE (X) + 0x38) -+#define PCIE_VDM_RID_VENROR_MSG_REQ_ID 0x0000FFFF -+#define PCIE_VDM_RID_VDMRID_S 0 -+ -+/* ASPM Control Register */ -+#define PCIE_ASPM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x40) -+#define PCIE_ASPM_CR_HOT_RST 0x00000001 /* Hot Reset Request to the downstream device */ -+#define PCIE_ASPM_CR_REQ_EXIT_L1 0x00000002 /* Request to Exit L1 */ -+#define PCIE_ASPM_CR_REQ_ENTER_L1 0x00000004 /* Request to Enter L1 */ -+ -+/* Vendor Message DW0 Register */ -+#define PCIE_VM_MSG_DW0(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x50) -+#define PCIE_VM_MSG_DW0_TYPE 0x0000001F /* Message type */ -+#define PCIE_VM_MSG_DW0_TYPE_S 0 -+#define PCIE_VM_MSG_DW0_FORMAT 0x00000060 /* Format */ -+#define PCIE_VM_MSG_DW0_FORMAT_S 5 -+#define PCIE_VM_MSG_DW0_TC 0x00007000 /* Traffic Class */ -+#define PCIE_VM_MSG_DW0_TC_S 12 -+#define PCIE_VM_MSG_DW0_ATTR 0x000C0000 /* Atrributes */ -+#define PCIE_VM_MSG_DW0_ATTR_S 18 -+#define PCIE_VM_MSG_DW0_EP_TLP 0x00100000 /* Poisoned TLP */ -+#define PCIE_VM_MSG_DW0_TD 0x00200000 /* TLP Digest */ -+#define PCIE_VM_MSG_DW0_LEN 0xFFC00000 /* Length */ -+#define PCIE_VM_MSG_DW0_LEN_S 22 -+ -+/* Format Definition */ -+enum { -+ PCIE_VM_MSG_FORMAT_00 = 0, /* 3DW Hdr, no data*/ -+ PCIE_VM_MSG_FORMAT_01, /* 4DW Hdr, no data */ -+ PCIE_VM_MSG_FORMAT_10, /* 3DW Hdr, with data */ -+ PCIE_VM_MSG_FORMAT_11, /* 4DW Hdr, with data */ -+}; -+ -+/* Traffic Class Definition */ -+enum { -+ PCIE_VM_MSG_TC0 = 0, -+ PCIE_VM_MSG_TC1, -+ PCIE_VM_MSG_TC2, -+ PCIE_VM_MSG_TC3, -+ PCIE_VM_MSG_TC4, -+ PCIE_VM_MSG_TC5, -+ PCIE_VM_MSG_TC6, -+ PCIE_VM_MSG_TC7, -+}; -+ -+/* Attributes Definition */ -+enum { -+ PCIE_VM_MSG_ATTR_00 = 0, /* RO and No Snoop cleared */ -+ PCIE_VM_MSG_ATTR_01, /* RO cleared , No Snoop set */ -+ PCIE_VM_MSG_ATTR_10, /* RO set, No Snoop cleared*/ -+ PCIE_VM_MSG_ATTR_11, /* RO and No Snoop set */ -+}; -+ -+/* Payload Size Definition */ -+#define PCIE_VM_MSG_LEN_MIN 0 -+#define PCIE_VM_MSG_LEN_MAX 1024 -+ -+/* Vendor Message DW1 Register */ -+#define PCIE_VM_MSG_DW1(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x54) -+#define PCIE_VM_MSG_DW1_FUNC_NUM 0x00000070 /* Function Number */ -+#define PCIE_VM_MSG_DW1_FUNC_NUM_S 8 -+#define PCIE_VM_MSG_DW1_CODE 0x00FF0000 /* Message Code */ -+#define PCIE_VM_MSG_DW1_CODE_S 16 -+#define PCIE_VM_MSG_DW1_TAG 0xFF000000 /* Tag */ -+#define PCIE_VM_MSG_DW1_TAG_S 24 -+ -+#define PCIE_VM_MSG_DW2(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x58) -+#define PCIE_VM_MSG_DW3(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x5C) -+ -+/* Vendor Message Request Register */ -+#define PCIE_VM_MSG_REQR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x60) -+#define PCIE_VM_MSG_REQR_REQ 0x00000001 /* Vendor Message Request */ -+ -+ -+/* AHB Slave Side Band Control Register */ -+#define PCIE_AHB_SSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x70) -+#define PCIE_AHB_SSB_REQ_BCM 0x00000001 /* Slave Reques BCM filed */ -+#define PCIE_AHB_SSB_REQ_EP 0x00000002 /* Slave Reques EP filed */ -+#define PCIE_AHB_SSB_REQ_TD 0x00000004 /* Slave Reques TD filed */ -+#define PCIE_AHB_SSB_REQ_ATTR 0x00000018 /* Slave Reques Attribute number */ -+#define PCIE_AHB_SSB_REQ_ATTR_S 3 -+#define PCIE_AHB_SSB_REQ_TC 0x000000E0 /* Slave Request TC Field */ -+#define PCIE_AHB_SSB_REQ_TC_S 5 -+ -+/* AHB Master SideBand Ctrl Register */ -+#define PCIE_AHB_MSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x74) -+#define PCIE_AHB_MSB_RESP_ATTR 0x00000003 /* Master Response Attribute number */ -+#define PCIE_AHB_MSB_RESP_ATTR_S 0 -+#define PCIE_AHB_MSB_RESP_BAD_EOT 0x00000004 /* Master Response Badeot filed */ -+#define PCIE_AHB_MSB_RESP_BCM 0x00000008 /* Master Response BCM filed */ -+#define PCIE_AHB_MSB_RESP_EP 0x00000010 /* Master Response EP filed */ -+#define PCIE_AHB_MSB_RESP_TD 0x00000020 /* Master Response TD filed */ -+#define PCIE_AHB_MSB_RESP_FUN_NUM 0x000003C0 /* Master Response Function number */ -+#define PCIE_AHB_MSB_RESP_FUN_NUM_S 6 -+ -+/* AHB Control Register, fixed bus enumeration exception */ -+#define PCIE_AHB_CTRL(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x78) -+#define PCIE_AHB_CTRL_BUS_ERROR_SUPPRESS 0x00000001 -+ -+/* Interrupt Enalbe Register */ -+#define PCIE_IRNEN(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF4) -+#define PCIE_IRNCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF8) -+#define PCIE_IRNICR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xFC) -+ -+/* PCIe interrupt enable/control/capture register definition */ -+#define PCIE_IRN_AER_REPORT 0x00000001 /* AER Interrupt */ -+#define PCIE_IRN_AER_MSIX 0x00000002 /* Advanced Error MSI-X Interrupt */ -+#define PCIE_IRN_PME 0x00000004 /* PME Interrupt */ -+#define PCIE_IRN_HOTPLUG 0x00000008 /* Hotplug Interrupt */ -+#define PCIE_IRN_RX_VDM_MSG 0x00000010 /* Vendor-Defined Message Interrupt */ -+#define PCIE_IRN_RX_CORRECTABLE_ERR_MSG 0x00000020 /* Correctable Error Message Interrupt */ -+#define PCIE_IRN_RX_NON_FATAL_ERR_MSG 0x00000040 /* Non-fatal Error Message */ -+#define PCIE_IRN_RX_FATAL_ERR_MSG 0x00000080 /* Fatal Error Message */ -+#define PCIE_IRN_RX_PME_MSG 0x00000100 /* PME Message Interrupt */ -+#define PCIE_IRN_RX_PME_TURNOFF_ACK 0x00000200 /* PME Turnoff Ack Message Interrupt */ -+#define PCIE_IRN_AHB_BR_FATAL_ERR 0x00000400 /* AHB Fatal Error Interrupt */ -+#define PCIE_IRN_LINK_AUTO_BW_STATUS 0x00000800 /* Link Auto Bandwidth Status Interrupt */ -+#define PCIE_IRN_BW_MGT 0x00001000 /* Bandwidth Managment Interrupt */ -+#define PCIE_IRN_INTA 0x00002000 /* INTA */ -+#define PCIE_IRN_INTB 0x00004000 /* INTB */ -+#define PCIE_IRN_INTC 0x00008000 /* INTC */ -+#define PCIE_IRN_INTD 0x00010000 /* INTD */ -+#define PCIE_IRN_WAKEUP 0x00020000 /* Wake up Interrupt */ -+ -+#define PCIE_RC_CORE_COMBINED_INT (PCIE_IRN_AER_REPORT | PCIE_IRN_AER_MSIX | PCIE_IRN_PME | \ -+ PCIE_IRN_HOTPLUG | PCIE_IRN_RX_VDM_MSG | PCIE_IRN_RX_CORRECTABLE_ERR_MSG |\ -+ PCIE_IRN_RX_NON_FATAL_ERR_MSG | PCIE_IRN_RX_FATAL_ERR_MSG | \ -+ PCIE_IRN_RX_PME_MSG | PCIE_IRN_RX_PME_TURNOFF_ACK | PCIE_IRN_AHB_BR_FATAL_ERR | \ -+ PCIE_IRN_LINK_AUTO_BW_STATUS | PCIE_IRN_BW_MGT) -+/* PCIe RC Configuration Register */ -+#define PCIE_VDID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x00) -+ -+/* Bit definition from pci_reg.h */ -+#define PCIE_PCICMDSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x04) -+#define PCIE_CCRID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x08) -+#define PCIE_CLSLTHTBR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x0C) /* EP only */ -+/* BAR0, BAR1,Only necessary if the bridges implements a device-specific register set or memory buffer */ -+#define PCIE_BAR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10) /* Not used*/ -+#define PCIE_BAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14) /* Not used */ -+ -+#define PCIE_BNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x18) /* Mandatory */ -+/* Bus Number Register bits */ -+#define PCIE_BNR_PRIMARY_BUS_NUM 0x000000FF -+#define PCIE_BNR_PRIMARY_BUS_NUM_S 0 -+#define PCIE_PNR_SECONDARY_BUS_NUM 0x0000FF00 -+#define PCIE_PNR_SECONDARY_BUS_NUM_S 8 -+#define PCIE_PNR_SUB_BUS_NUM 0x00FF0000 -+#define PCIE_PNR_SUB_BUS_NUM_S 16 -+ -+/* IO Base/Limit Register bits */ -+#define PCIE_IOBLSECS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x1C) /* RC only */ -+#define PCIE_IOBLSECS_32BIT_IO_ADDR 0x00000001 -+#define PCIE_IOBLSECS_IO_BASE_ADDR 0x000000F0 -+#define PCIE_IOBLSECS_IO_BASE_ADDR_S 4 -+#define PCIE_IOBLSECS_32BIT_IOLIMT 0x00000100 -+#define PCIE_IOBLSECS_IO_LIMIT_ADDR 0x0000F000 -+#define PCIE_IOBLSECS_IO_LIMIT_ADDR_S 12 -+ -+/* Non-prefetchable Memory Base/Limit Register bit */ -+#define PCIE_MBML(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x20) /* RC only */ -+#define PCIE_MBML_MEM_BASE_ADDR 0x0000FFF0 -+#define PCIE_MBML_MEM_BASE_ADDR_S 4 -+#define PCIE_MBML_MEM_LIMIT_ADDR 0xFFF00000 -+#define PCIE_MBML_MEM_LIMIT_ADDR_S 20 -+ -+/* Prefetchable Memory Base/Limit Register bit */ -+#define PCIE_PMBL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x24) /* RC only */ -+#define PCIE_PMBL_64BIT_ADDR 0x00000001 -+#define PCIE_PMBL_UPPER_12BIT 0x0000FFF0 -+#define PCIE_PMBL_UPPER_12BIT_S 4 -+#define PCIE_PMBL_E64MA 0x00010000 -+#define PCIE_PMBL_END_ADDR 0xFFF00000 -+#define PCIE_PMBL_END_ADDR_S 20 -+#define PCIE_PMBU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x28) /* RC only */ -+#define PCIE_PMLU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x2C) /* RC only */ -+ -+/* I/O Base/Limit Upper 16 bits register */ -+#define PCIE_IO_BANDL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x30) /* RC only */ -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE 0x0000FFFF -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE_S 0 -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT 0xFFFF0000 -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT_S 16 -+ -+#define PCIE_CPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x34) -+#define PCIE_EBBAR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x38) -+ -+/* Interrupt and Secondary Bridge Control Register */ -+#define PCIE_INTRBCTRL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x3C) -+ -+#define PCIE_INTRBCTRL_INT_LINE 0x000000FF -+#define PCIE_INTRBCTRL_INT_LINE_S 0 -+#define PCIE_INTRBCTRL_INT_PIN 0x0000FF00 -+#define PCIE_INTRBCTRL_INT_PIN_S 8 -+#define PCIE_INTRBCTRL_PARITY_ERR_RESP_ENABLE 0x00010000 /* #PERR */ -+#define PCIE_INTRBCTRL_SERR_ENABLE 0x00020000 /* #SERR */ -+#define PCIE_INTRBCTRL_ISA_ENABLE 0x00040000 /* ISA enable, IO 64KB only */ -+#define PCIE_INTRBCTRL_VGA_ENABLE 0x00080000 /* VGA enable */ -+#define PCIE_INTRBCTRL_VGA_16BIT_DECODE 0x00100000 /* VGA 16bit decode */ -+#define PCIE_INTRBCTRL_RST_SECONDARY_BUS 0x00400000 /* Secondary bus rest, hot rest, 1ms */ -+/* Others are read only */ -+enum { -+ PCIE_INTRBCTRL_INT_NON = 0, -+ PCIE_INTRBCTRL_INTA, -+ PCIE_INTRBCTRL_INTB, -+ PCIE_INTRBCTRL_INTC, -+ PCIE_INTRBCTRL_INTD, -+}; -+ -+#define PCIE_PM_CAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x40) -+ -+/* Power Management Control and Status Register */ -+#define PCIE_PM_CSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x44) -+ -+#define PCIE_PM_CSR_POWER_STATE 0x00000003 /* Power State */ -+#define PCIE_PM_CSR_POWER_STATE_S 0 -+#define PCIE_PM_CSR_SW_RST 0x00000008 /* Soft Reset Enabled */ -+#define PCIE_PM_CSR_PME_ENABLE 0x00000100 /* PME Enable */ -+#define PCIE_PM_CSR_PME_STATUS 0x00008000 /* PME status */ -+ -+/* MSI Capability Register for EP */ -+#define PCIE_MCAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x50) -+ -+#define PCIE_MCAPR_MSI_CAP_ID 0x000000FF /* MSI Capability ID */ -+#define PCIE_MCAPR_MSI_CAP_ID_S 0 -+#define PCIE_MCAPR_MSI_NEXT_CAP_PTR 0x0000FF00 /* Next Capability Pointer */ -+#define PCIE_MCAPR_MSI_NEXT_CAP_PTR_S 8 -+#define PCIE_MCAPR_MSI_ENABLE 0x00010000 /* MSI Enable */ -+#define PCIE_MCAPR_MULTI_MSG_CAP 0x000E0000 /* Multiple Message Capable */ -+#define PCIE_MCAPR_MULTI_MSG_CAP_S 17 -+#define PCIE_MCAPR_MULTI_MSG_ENABLE 0x00700000 /* Multiple Message Enable */ -+#define PCIE_MCAPR_MULTI_MSG_ENABLE_S 20 -+#define PCIE_MCAPR_ADDR64_CAP 0X00800000 /* 64-bit Address Capable */ -+ -+/* MSI Message Address Register */ -+#define PCIE_MA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x54) -+ -+#define PCIE_MA_ADDR_MASK 0xFFFFFFFC /* Message Address */ -+ -+/* MSI Message Upper Address Register */ -+#define PCIE_MUA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x58) -+ -+/* MSI Message Data Register */ -+#define PCIE_MD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x5C) -+ -+#define PCIE_MD_DATA 0x0000FFFF /* Message Data */ -+#define PCIE_MD_DATA_S 0 -+ -+/* PCI Express Capability Register */ -+#define PCIE_XCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70) -+ -+#define PCIE_XCAP_ID 0x000000FF /* PCI Express Capability ID */ -+#define PCIE_XCAP_ID_S 0 -+#define PCIE_XCAP_NEXT_CAP 0x0000FF00 /* Next Capability Pointer */ -+#define PCIE_XCAP_NEXT_CAP_S 8 -+#define PCIE_XCAP_VER 0x000F0000 /* PCI Express Capability Version */ -+#define PCIE_XCAP_VER_S 16 -+#define PCIE_XCAP_DEV_PORT_TYPE 0x00F00000 /* Device Port Type */ -+#define PCIE_XCAP_DEV_PORT_TYPE_S 20 -+#define PCIE_XCAP_SLOT_IMPLEMENTED 0x01000000 /* Slot Implemented */ -+#define PCIE_XCAP_MSG_INT_NUM 0x3E000000 /* Interrupt Message Number */ -+#define PCIE_XCAP_MSG_INT_NUM_S 25 -+ -+/* Device Capability Register */ -+#define PCIE_DCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74) -+ -+#define PCIE_DCAP_MAX_PAYLOAD_SIZE 0x00000007 /* Max Payload size */ -+#define PCIE_DCAP_MAX_PAYLOAD_SIZE_S 0 -+#define PCIE_DCAP_PHANTOM_FUNC 0x00000018 /* Phanton Function, not supported */ -+#define PCIE_DCAP_PHANTOM_FUNC_S 3 -+#define PCIE_DCAP_EXT_TAG 0x00000020 /* Extended Tag Field */ -+#define PCIE_DCAP_EP_L0S_LATENCY 0x000001C0 /* EP L0s latency only */ -+#define PCIE_DCAP_EP_L0S_LATENCY_S 6 -+#define PCIE_DCAP_EP_L1_LATENCY 0x00000E00 /* EP L1 latency only */ -+#define PCIE_DCAP_EP_L1_LATENCY_S 9 -+#define PCIE_DCAP_ROLE_BASE_ERR_REPORT 0x00008000 /* Role Based ERR */ -+ -+/* Maximum payload size supported */ -+enum { -+ PCIE_MAX_PAYLOAD_128 = 0, -+ PCIE_MAX_PAYLOAD_256, -+ PCIE_MAX_PAYLOAD_512, -+ PCIE_MAX_PAYLOAD_1024, -+ PCIE_MAX_PAYLOAD_2048, -+ PCIE_MAX_PAYLOAD_4096, -+}; -+ -+/* Device Control and Status Register */ -+#define PCIE_DCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x78) -+ -+#define PCIE_DCTLSTS_CORRECTABLE_ERR_EN 0x00000001 /* COR-ERR */ -+#define PCIE_DCTLSTS_NONFATAL_ERR_EN 0x00000002 /* Non-fatal ERR */ -+#define PCIE_DCTLSTS_FATAL_ERR_EN 0x00000004 /* Fatal ERR */ -+#define PCIE_DCTLSYS_UR_REQ_EN 0x00000008 /* UR ERR */ -+#define PCIE_DCTLSTS_RELAXED_ORDERING_EN 0x00000010 /* Enable relaxing ordering */ -+#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE 0x000000E0 /* Max payload mask */ -+#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE_S 5 -+#define PCIE_DCTLSTS_EXT_TAG_EN 0x00000100 /* Extended tag field */ -+#define PCIE_DCTLSTS_PHANTOM_FUNC_EN 0x00000200 /* Phantom Function Enable */ -+#define PCIE_DCTLSTS_AUX_PM_EN 0x00000400 /* AUX Power PM Enable */ -+#define PCIE_DCTLSTS_NO_SNOOP_EN 0x00000800 /* Enable no snoop, except root port*/ -+#define PCIE_DCTLSTS_MAX_READ_SIZE 0x00007000 /* Max Read Request size*/ -+#define PCIE_DCTLSTS_MAX_READ_SIZE_S 12 -+#define PCIE_DCTLSTS_CORRECTABLE_ERR 0x00010000 /* COR-ERR Detected */ -+#define PCIE_DCTLSTS_NONFATAL_ERR 0x00020000 /* Non-Fatal ERR Detected */ -+#define PCIE_DCTLSTS_FATAL_ER 0x00040000 /* Fatal ERR Detected */ -+#define PCIE_DCTLSTS_UNSUPPORTED_REQ 0x00080000 /* UR Detected */ -+#define PCIE_DCTLSTS_AUX_POWER 0x00100000 /* Aux Power Detected */ -+#define PCIE_DCTLSTS_TRANSACT_PENDING 0x00200000 /* Transaction pending */ -+ -+#define PCIE_DCTLSTS_ERR_EN (PCIE_DCTLSTS_CORRECTABLE_ERR_EN | \ -+ PCIE_DCTLSTS_NONFATAL_ERR_EN | PCIE_DCTLSTS_FATAL_ERR_EN | \ -+ PCIE_DCTLSYS_UR_REQ_EN) -+ -+/* Link Capability Register */ -+#define PCIE_LCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7C) -+#define PCIE_LCAP_MAX_LINK_SPEED 0x0000000F /* Max link speed, 0x1 by default */ -+#define PCIE_LCAP_MAX_LINK_SPEED_S 0 -+#define PCIE_LCAP_MAX_LENGTH_WIDTH 0x000003F0 /* Maxium Length Width */ -+#define PCIE_LCAP_MAX_LENGTH_WIDTH_S 4 -+#define PCIE_LCAP_ASPM_LEVEL 0x00000C00 /* Active State Link PM Support */ -+#define PCIE_LCAP_ASPM_LEVEL_S 10 -+#define PCIE_LCAP_L0S_EIXT_LATENCY 0x00007000 /* L0s Exit Latency */ -+#define PCIE_LCAP_L0S_EIXT_LATENCY_S 12 -+#define PCIE_LCAP_L1_EXIT_LATENCY 0x00038000 /* L1 Exit Latency */ -+#define PCIE_LCAP_L1_EXIT_LATENCY_S 15 -+#define PCIE_LCAP_CLK_PM 0x00040000 /* Clock Power Management */ -+#define PCIE_LCAP_SDER 0x00080000 /* Surprise Down Error Reporting */ -+#define PCIE_LCAP_DLL_ACTIVE_REPROT 0x00100000 /* Data Link Layer Active Reporting Capable */ -+#define PCIE_LCAP_PORT_NUM 0xFF0000000 /* Port number */ -+#define PCIE_LCAP_PORT_NUM_S 24 -+ -+/* Maximum Length width definition */ -+#define PCIE_MAX_LENGTH_WIDTH_RES 0x00 -+#define PCIE_MAX_LENGTH_WIDTH_X1 0x01 /* Default */ -+#define PCIE_MAX_LENGTH_WIDTH_X2 0x02 -+#define PCIE_MAX_LENGTH_WIDTH_X4 0x04 -+#define PCIE_MAX_LENGTH_WIDTH_X8 0x08 -+#define PCIE_MAX_LENGTH_WIDTH_X12 0x0C -+#define PCIE_MAX_LENGTH_WIDTH_X16 0x10 -+#define PCIE_MAX_LENGTH_WIDTH_X32 0x20 -+ -+/* Active State Link PM definition */ -+enum { -+ PCIE_ASPM_RES0 = 0, -+ PCIE_ASPM_L0S_ENTRY_SUPPORT, /* L0s */ -+ PCIE_ASPM_RES1, -+ PCIE_ASPM_L0S_L1_ENTRY_SUPPORT, /* L0s and L1, default */ -+}; -+ -+/* L0s Exit Latency definition */ -+enum { -+ PCIE_L0S_EIXT_LATENCY_L64NS = 0, /* < 64 ns */ -+ PCIE_L0S_EIXT_LATENCY_B64A128, /* > 64 ns < 128 ns */ -+ PCIE_L0S_EIXT_LATENCY_B128A256, /* > 128 ns < 256 ns */ -+ PCIE_L0S_EIXT_LATENCY_B256A512, /* > 256 ns < 512 ns */ -+ PCIE_L0S_EIXT_LATENCY_B512TO1U, /* > 512 ns < 1 us */ -+ PCIE_L0S_EIXT_LATENCY_B1A2U, /* > 1 us < 2 us */ -+ PCIE_L0S_EIXT_LATENCY_B2A4U, /* > 2 us < 4 us */ -+ PCIE_L0S_EIXT_LATENCY_M4US, /* > 4 us */ -+}; -+ -+/* L1 Exit Latency definition */ -+enum { -+ PCIE_L1_EXIT_LATENCY_L1US = 0, /* < 1 us */ -+ PCIE_L1_EXIT_LATENCY_B1A2, /* > 1 us < 2 us */ -+ PCIE_L1_EXIT_LATENCY_B2A4, /* > 2 us < 4 us */ -+ PCIE_L1_EXIT_LATENCY_B4A8, /* > 4 us < 8 us */ -+ PCIE_L1_EXIT_LATENCY_B8A16, /* > 8 us < 16 us */ -+ PCIE_L1_EXIT_LATENCY_B16A32, /* > 16 us < 32 us */ -+ PCIE_L1_EXIT_LATENCY_B32A64, /* > 32 us < 64 us */ -+ PCIE_L1_EXIT_LATENCY_M64US, /* > 64 us */ -+}; -+ -+/* Link Control and Status Register */ -+#define PCIE_LCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x80) -+#define PCIE_LCTLSTS_ASPM_ENABLE 0x00000003 /* Active State Link PM Control */ -+#define PCIE_LCTLSTS_ASPM_ENABLE_S 0 -+#define PCIE_LCTLSTS_RCB128 0x00000008 /* Read Completion Boundary 128*/ -+#define PCIE_LCTLSTS_LINK_DISABLE 0x00000010 /* Link Disable */ -+#define PCIE_LCTLSTS_RETRIAN_LINK 0x00000020 /* Retrain Link */ -+#define PCIE_LCTLSTS_COM_CLK_CFG 0x00000040 /* Common Clock Configuration */ -+#define PCIE_LCTLSTS_EXT_SYNC 0x00000080 /* Extended Synch */ -+#define PCIE_LCTLSTS_CLK_PM_EN 0x00000100 /* Enable Clock Powerm Management */ -+#define PCIE_LCTLSTS_LINK_SPEED 0x000F0000 /* Link Speed */ -+#define PCIE_LCTLSTS_LINK_SPEED_S 16 -+#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH 0x03F00000 /* Negotiated Link Width */ -+#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH_S 20 -+#define PCIE_LCTLSTS_RETRAIN_PENDING 0x08000000 /* Link training is ongoing */ -+#define PCIE_LCTLSTS_SLOT_CLK_CFG 0x10000000 /* Slot Clock Configuration */ -+#define PCIE_LCTLSTS_DLL_ACTIVE 0x20000000 /* Data Link Layer Active */ -+ -+/* Slot Capabilities Register */ -+#define PCIE_SLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x84) -+ -+/* Slot Capabilities */ -+#define PCIE_SLCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x88) -+ -+/* Root Control and Capability Register */ -+#define PCIE_RCTLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x8C) -+#define PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR 0x00000001 /* #SERR on COR-ERR */ -+#define PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR 0x00000002 /* #SERR on Non-Fatal ERR */ -+#define PCIE_RCTLCAP_SERR_ON_FATAL_ERR 0x00000004 /* #SERR on Fatal ERR */ -+#define PCIE_RCTLCAP_PME_INT_EN 0x00000008 /* PME Interrupt Enable */ -+#define PCIE_RCTLCAP_SERR_ENABLE (PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR | \ -+ PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR | PCIE_RCTLCAP_SERR_ON_FATAL_ERR) -+/* Root Status Register */ -+#define PCIE_RSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x90) -+#define PCIE_RSTS_PME_REQ_ID 0x0000FFFF /* PME Request ID */ -+#define PCIE_RSTS_PME_REQ_ID_S 0 -+#define PCIE_RSTS_PME_STATUS 0x00010000 /* PME Status */ -+#define PCIE_RSTS_PME_PENDING 0x00020000 /* PME Pending */ -+ -+/* PCI Express Enhanced Capability Header */ -+#define PCIE_ENHANCED_CAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x100) -+#define PCIE_ENHANCED_CAP_ID 0x0000FFFF /* PCI Express Extended Capability ID */ -+#define PCIE_ENHANCED_CAP_ID_S 0 -+#define PCIE_ENHANCED_CAP_VER 0x000F0000 /* Capability Version */ -+#define PCIE_ENHANCED_CAP_VER_S 16 -+#define PCIE_ENHANCED_CAP_NEXT_OFFSET 0xFFF00000 /* Next Capability Offset */ -+#define PCIE_ENHANCED_CAP_NEXT_OFFSET_S 20 -+ -+/* Uncorrectable Error Status Register */ -+#define PCIE_UES_R(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x104) -+#define PCIE_DATA_LINK_PROTOCOL_ERR 0x00000010 /* Data Link Protocol Error Status */ -+#define PCIE_SURPRISE_DOWN_ERROR 0x00000020 /* Surprise Down Error Status */ -+#define PCIE_POISONED_TLP 0x00001000 /* Poisoned TLP Status */ -+#define PCIE_FC_PROTOCOL_ERR 0x00002000 /* Flow Control Protocol Error Status */ -+#define PCIE_COMPLETION_TIMEOUT 0x00004000 /* Completion Timeout Status */ -+#define PCIE_COMPLETOR_ABORT 0x00008000 /* Completer Abort Error */ -+#define PCIE_UNEXPECTED_COMPLETION 0x00010000 /* Unexpected Completion Status */ -+#define PCIE_RECEIVER_OVERFLOW 0x00020000 /* Receive Overflow Status */ -+#define PCIE_MALFORNED_TLP 0x00040000 /* Malformed TLP Stauts */ -+#define PCIE_ECRC_ERR 0x00080000 /* ECRC Error Stauts */ -+#define PCIE_UR_REQ 0x00100000 /* Unsupported Request Error Status */ -+#define PCIE_ALL_UNCORRECTABLE_ERR (PCIE_DATA_LINK_PROTOCOL_ERR | PCIE_SURPRISE_DOWN_ERROR | \ -+ PCIE_POISONED_TLP | PCIE_FC_PROTOCOL_ERR | PCIE_COMPLETION_TIMEOUT | \ -+ PCIE_COMPLETOR_ABORT | PCIE_UNEXPECTED_COMPLETION | PCIE_RECEIVER_OVERFLOW |\ -+ PCIE_MALFORNED_TLP | PCIE_ECRC_ERR | PCIE_UR_REQ) -+ -+/* Uncorrectable Error Mask Register, Mask means no report */ -+#define PCIE_UEMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x108) -+ -+/* Uncorrectable Error Severity Register */ -+#define PCIE_UESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10C) -+ -+/* Correctable Error Status Register */ -+#define PCIE_CESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x110) -+#define PCIE_RX_ERR 0x00000001 /* Receive Error Status */ -+#define PCIE_BAD_TLP 0x00000040 /* Bad TLP Status */ -+#define PCIE_BAD_DLLP 0x00000080 /* Bad DLLP Status */ -+#define PCIE_REPLAY_NUM_ROLLOVER 0x00000100 /* Replay Number Rollover Status */ -+#define PCIE_REPLAY_TIMER_TIMEOUT_ERR 0x00001000 /* Reply Timer Timeout Status */ -+#define PCIE_ADVISORY_NONFTAL_ERR 0x00002000 /* Advisory Non-Fatal Error Status */ -+#define PCIE_CORRECTABLE_ERR (PCIE_RX_ERR | PCIE_BAD_TLP | PCIE_BAD_DLLP | PCIE_REPLAY_NUM_ROLLOVER |\ -+ PCIE_REPLAY_TIMER_TIMEOUT_ERR | PCIE_ADVISORY_NONFTAL_ERR) -+ -+/* Correctable Error Mask Register */ -+#define PCIE_CEMR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x114) -+ -+/* Advanced Error Capabilities and Control Register */ -+#define PCIE_AECCR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x118) -+#define PCIE_AECCR_FIRST_ERR_PTR 0x0000001F /* First Error Pointer */ -+#define PCIE_AECCR_FIRST_ERR_PTR_S 0 -+#define PCIE_AECCR_ECRC_GEN_CAP 0x00000020 /* ECRC Generation Capable */ -+#define PCIE_AECCR_ECRC_GEN_EN 0x00000040 /* ECRC Generation Enable */ -+#define PCIE_AECCR_ECRC_CHECK_CAP 0x00000080 /* ECRC Check Capable */ -+#define PCIE_AECCR_ECRC_CHECK_EN 0x00000100 /* ECRC Check Enable */ -+ -+/* Header Log Register 1 */ -+#define PCIE_HLR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x11C) -+ -+/* Header Log Register 2 */ -+#define PCIE_HLR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x120) -+ -+/* Header Log Register 3 */ -+#define PCIE_HLR3(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x124) -+ -+/* Header Log Register 4 */ -+#define PCIE_HLR4(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x128) -+ -+/* Root Error Command Register */ -+#define PCIE_RECR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x12C) -+#define PCIE_RECR_CORRECTABLE_ERR_REPORT_EN 0x00000001 /* COR-ERR */ -+#define PCIE_RECR_NONFATAL_ERR_REPORT_EN 0x00000002 /* Non-Fatal ERR */ -+#define PCIE_RECR_FATAL_ERR_REPORT_EN 0x00000004 /* Fatal ERR */ -+#define PCIE_RECR_ERR_REPORT_EN (PCIE_RECR_CORRECTABLE_ERR_REPORT_EN | \ -+ PCIE_RECR_NONFATAL_ERR_REPORT_EN | PCIE_RECR_FATAL_ERR_REPORT_EN) -+ -+/* Root Error Status Register */ -+#define PCIE_RESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x130) -+#define PCIE_RESR_CORRECTABLE_ERR 0x00000001 /* COR-ERR Receveid */ -+#define PCIE_RESR_MULTI_CORRECTABLE_ERR 0x00000002 /* Multiple COR-ERR Received */ -+#define PCIE_RESR_FATAL_NOFATAL_ERR 0x00000004 /* ERR Fatal/Non-Fatal Received */ -+#define PCIE_RESR_MULTI_FATAL_NOFATAL_ERR 0x00000008 /* Multiple ERR Fatal/Non-Fatal Received */ -+#define PCIE_RESR_FIRST_UNCORRECTABLE_FATAL_ERR 0x00000010 /* First UN-COR Fatal */ -+#define PCIR_RESR_NON_FATAL_ERR 0x00000020 /* Non-Fatal Error Message Received */ -+#define PCIE_RESR_FATAL_ERR 0x00000040 /* Fatal Message Received */ -+#define PCIE_RESR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ -+#define PCIE_RESR_AER_INT_MSG_NUM_S 27 -+ -+/* Error Source Indentification Register */ -+#define PCIE_ESIR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x134) -+#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID 0x0000FFFF -+#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID_S 0 -+#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID 0xFFFF0000 -+#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID_S 16 -+ -+/* VC Enhanced Capability Header */ -+#define PCIE_VC_ECH(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x140) -+ -+/* Port VC Capability Register */ -+#define PCIE_PVC1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x144) -+#define PCIE_PVC1_EXT_VC_CNT 0x00000007 /* Extended VC Count */ -+#define PCIE_PVC1_EXT_VC_CNT_S 0 -+#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT 0x00000070 /* Low Priority Extended VC Count */ -+#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT_S 4 -+#define PCIE_PVC1_REF_CLK 0x00000300 /* Reference Clock */ -+#define PCIE_PVC1_REF_CLK_S 8 -+#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE 0x00000C00 /* Port Arbitration Table Entry Size */ -+#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE_S 10 -+ -+/* Extended Virtual Channel Count Defintion */ -+#define PCIE_EXT_VC_CNT_MIN 0 -+#define PCIE_EXT_VC_CNT_MAX 7 -+ -+/* Port Arbitration Table Entry Size Definition */ -+enum { -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S1BIT = 0, -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S2BIT, -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S4BIT, -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S8BIT, -+}; -+ -+/* Port VC Capability Register 2 */ -+#define PCIE_PVC2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x148) -+#define PCIE_PVC2_VC_ARB_16P_FIXED_WRR 0x00000001 /* HW Fixed arbitration, 16 phase WRR */ -+#define PCIE_PVC2_VC_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ -+#define PCIE_PVC2_VC_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ -+#define PCIE_PVC2_VC_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ -+#define PCIE_PVC2_VC_ARB_WRR 0x0000000F -+#define PCIE_PVC2_VC_ARB_TAB_OFFSET 0xFF000000 /* VC arbitration table offset, not support */ -+#define PCIE_PVC2_VC_ARB_TAB_OFFSET_S 24 -+ -+/* Port VC Control and Status Register */ -+#define PCIE_PVCCRSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14C) -+#define PCIE_PVCCRSR_LOAD_VC_ARB_TAB 0x00000001 /* Load VC Arbitration Table */ -+#define PCIE_PVCCRSR_VC_ARB_SEL 0x0000000E /* VC Arbitration Select */ -+#define PCIE_PVCCRSR_VC_ARB_SEL_S 1 -+#define PCIE_PVCCRSR_VC_ARB_TAB_STATUS 0x00010000 /* Arbitration Status */ -+ -+/* VC0 Resource Capability Register */ -+#define PCIE_VC0_RC(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x150) -+#define PCIE_VC0_RC_PORT_ARB_HW_FIXED 0x00000001 /* HW Fixed arbitration */ -+#define PCIE_VC0_RC_PORT_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_TM_128P_WRR 0x00000010 /* Time-based 128 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_TM_256P_WRR 0x00000020 /* Time-based 256 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB (PCIE_VC0_RC_PORT_ARB_HW_FIXED | PCIE_VC0_RC_PORT_ARB_32P_WRR |\ -+ PCIE_VC0_RC_PORT_ARB_64P_WRR | PCIE_VC0_RC_PORT_ARB_128P_WRR | \ -+ PCIE_VC0_RC_PORT_ARB_TM_128P_WRR | PCIE_VC0_RC_PORT_ARB_TM_256P_WRR) -+ -+#define PCIE_VC0_RC_REJECT_SNOOP 0x00008000 /* Reject Snoop Transactioin */ -+#define PCIE_VC0_RC_MAX_TIMESLOTS 0x007F0000 /* Maximum time Slots */ -+#define PCIE_VC0_RC_MAX_TIMESLOTS_S 16 -+#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET 0xFF000000 /* Port Arbitration Table Offset */ -+#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET_S 24 -+ -+/* VC0 Resource Control Register */ -+#define PCIE_VC0_RC0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x154) -+#define PCIE_VC0_RC0_TVM0 0x00000001 /* TC0 and VC0 */ -+#define PCIE_VC0_RC0_TVM1 0x00000002 /* TC1 and VC1 */ -+#define PCIE_VC0_RC0_TVM2 0x00000004 /* TC2 and VC2 */ -+#define PCIE_VC0_RC0_TVM3 0x00000008 /* TC3 and VC3 */ -+#define PCIE_VC0_RC0_TVM4 0x00000010 /* TC4 and VC4 */ -+#define PCIE_VC0_RC0_TVM5 0x00000020 /* TC5 and VC5 */ -+#define PCIE_VC0_RC0_TVM6 0x00000040 /* TC6 and VC6 */ -+#define PCIE_VC0_RC0_TVM7 0x00000080 /* TC7 and VC7 */ -+#define PCIE_VC0_RC0_TC_VC 0x000000FF /* TC/VC mask */ -+ -+#define PCIE_VC0_RC0_LOAD_PORT_ARB_TAB 0x00010000 /* Load Port Arbitration Table */ -+#define PCIE_VC0_RC0_PORT_ARB_SEL 0x000E0000 /* Port Arbitration Select */ -+#define PCIE_VC0_RC0_PORT_ARB_SEL_S 17 -+#define PCIE_VC0_RC0_VC_ID 0x07000000 /* VC ID */ -+#define PCIE_VC0_RC0_VC_ID_S 24 -+#define PCIE_VC0_RC0_VC_EN 0x80000000 /* VC Enable */ -+ -+/* VC0 Resource Status Register */ -+#define PCIE_VC0_RSR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x158) -+#define PCIE_VC0_RSR0_PORT_ARB_TAB_STATUS 0x00010000 /* Port Arbitration Table Status,not used */ -+#define PCIE_VC0_RSR0_VC_NEG_PENDING 0x00020000 /* VC Negotiation Pending */ -+ -+/* Ack Latency Timer and Replay Timer Register */ -+#define PCIE_ALTRT(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x700) -+#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT 0x0000FFFF /* Round Trip Latency Time Limit */ -+#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT_S 0 -+#define PCIE_ALTRT_REPLAY_TIME_LIMIT 0xFFFF0000 /* Replay Time Limit */ -+#define PCIE_ALTRT_REPLAY_TIME_LIMIT_S 16 -+ -+/* Other Message Register */ -+#define PCIE_OMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x704) -+ -+/* Port Force Link Register */ -+#define PCIE_PFLR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x708) -+#define PCIE_PFLR_LINK_NUM 0x000000FF /* Link Number */ -+#define PCIE_PFLR_LINK_NUM_S 0 -+#define PCIE_PFLR_FORCE_LINK 0x00008000 /* Force link */ -+#define PCIE_PFLR_LINK_STATE 0x003F0000 /* Link State */ -+#define PCIE_PFLR_LINK_STATE_S 16 -+#define PCIE_PFLR_LOW_POWER_ENTRY_CNT 0xFF000000 /* Low Power Entrance Count, only for EP */ -+#define PCIE_PFLR_LOW_POWER_ENTRY_CNT_S 24 -+ -+/* Ack Frequency Register */ -+#define PCIE_AFR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70C) -+#define PCIE_AFR_AF 0x000000FF /* Ack Frequency */ -+#define PCIE_AFR_AF_S 0 -+#define PCIE_AFR_FTS_NUM 0x0000FF00 /* The number of Fast Training Sequence from L0S to L0 */ -+#define PCIE_AFR_FTS_NUM_S 8 -+#define PCIE_AFR_COM_FTS_NUM 0x00FF0000 /* N_FTS; when common clock is used*/ -+#define PCIE_AFR_COM_FTS_NUM_S 16 -+#define PCIE_AFR_L0S_ENTRY_LATENCY 0x07000000 /* L0s Entrance Latency */ -+#define PCIE_AFR_L0S_ENTRY_LATENCY_S 24 -+#define PCIE_AFR_L1_ENTRY_LATENCY 0x38000000 /* L1 Entrance Latency */ -+#define PCIE_AFR_L1_ENTRY_LATENCY_S 27 -+#define PCIE_AFR_FTS_NUM_DEFAULT 32 -+#define PCIE_AFR_L0S_ENTRY_LATENCY_DEFAULT 7 -+#define PCIE_AFR_L1_ENTRY_LATENCY_DEFAULT 5 -+ -+/* Port Link Control Register */ -+#define PCIE_PLCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x710) -+#define PCIE_PLCR_OTHER_MSG_REQ 0x00000001 /* Other Message Request */ -+#define PCIE_PLCR_SCRAMBLE_DISABLE 0x00000002 /* Scramble Disable */ -+#define PCIE_PLCR_LOOPBACK_EN 0x00000004 /* Loopback Enable */ -+#define PCIE_PLCR_LTSSM_HOT_RST 0x00000008 /* Force LTSSM to the hot reset */ -+#define PCIE_PLCR_DLL_LINK_EN 0x00000020 /* Enable Link initialization */ -+#define PCIE_PLCR_FAST_LINK_SIM_EN 0x00000080 /* Sets all internal timers to fast mode for simulation purposes */ -+#define PCIE_PLCR_LINK_MODE 0x003F0000 /* Link Mode Enable Mask */ -+#define PCIE_PLCR_LINK_MODE_S 16 -+#define PCIE_PLCR_CORRUPTED_CRC_EN 0x02000000 /* Enabled Corrupt CRC */ -+ -+/* Lane Skew Register */ -+#define PCIE_LSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x714) -+#define PCIE_LSR_LANE_SKEW_NUM 0x00FFFFFF /* Insert Lane Skew for Transmit, not applicable */ -+#define PCIE_LSR_LANE_SKEW_NUM_S 0 -+#define PCIE_LSR_FC_DISABLE 0x01000000 /* Disable of Flow Control */ -+#define PCIE_LSR_ACKNAK_DISABLE 0x02000000 /* Disable of Ack/Nak */ -+#define PCIE_LSR_LANE_DESKEW_DISABLE 0x80000000 /* Disable of Lane-to-Lane Skew */ -+ -+/* Symbol Number Register */ -+#define PCIE_SNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x718) -+#define PCIE_SNR_TS 0x0000000F /* Number of TS Symbol */ -+#define PCIE_SNR_TS_S 0 -+#define PCIE_SNR_SKP 0x00000700 /* Number of SKP Symbol */ -+#define PCIE_SNR_SKP_S 8 -+#define PCIE_SNR_REPLAY_TIMER 0x0007C000 /* Timer Modifier for Replay Timer */ -+#define PCIE_SNR_REPLAY_TIMER_S 14 -+#define PCIE_SNR_ACKNAK_LATENCY_TIMER 0x00F80000 /* Timer Modifier for Ack/Nak Latency Timer */ -+#define PCIE_SNR_ACKNAK_LATENCY_TIMER_S 19 -+#define PCIE_SNR_FC_TIMER 0x1F000000 /* Timer Modifier for Flow Control Watchdog Timer */ -+#define PCIE_SNR_FC_TIMER_S 28 -+ -+/* Symbol Timer Register and Filter Mask Register 1 */ -+#define PCIE_STRFMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x71C) -+#define PCIE_STRFMR_SKP_INTERVAL 0x000007FF /* SKP lnterval Value */ -+#define PCIE_STRFMR_SKP_INTERVAL_S 0 -+#define PCIE_STRFMR_FC_WDT_DISABLE 0x00008000 /* Disable of FC Watchdog Timer */ -+#define PCIE_STRFMR_TLP_FUNC_MISMATCH_OK 0x00010000 /* Mask Function Mismatch Filtering for Incoming Requests */ -+#define PCIE_STRFMR_POISONED_TLP_OK 0x00020000 /* Mask Poisoned TLP Filtering */ -+#define PCIE_STRFMR_BAR_MATCH_OK 0x00040000 /* Mask BAR Match Filtering */ -+#define PCIE_STRFMR_TYPE1_CFG_REQ_OK 0x00080000 /* Mask Type 1 Configuration Request Filtering */ -+#define PCIE_STRFMR_LOCKED_REQ_OK 0x00100000 /* Mask Locked Request Filtering */ -+#define PCIE_STRFMR_CPL_TAG_ERR_RULES_OK 0x00200000 /* Mask Tag Error Rules for Received Completions */ -+#define PCIE_STRFMR_CPL_REQUESTOR_ID_MISMATCH_OK 0x00400000 /* Mask Requester ID Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_FUNC_MISMATCH_OK 0x00800000 /* Mask Function Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_TC_MISMATCH_OK 0x01000000 /* Mask Traffic Class Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_ATTR_MISMATCH_OK 0x02000000 /* Mask Attribute Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_LENGTH_MISMATCH_OK 0x04000000 /* Mask Length Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_TLP_ECRC_ERR_OK 0x08000000 /* Mask ECRC Error Filtering */ -+#define PCIE_STRFMR_CPL_TLP_ECRC_OK 0x10000000 /* Mask ECRC Error Filtering for Completions */ -+#define PCIE_STRFMR_RX_TLP_MSG_NO_DROP 0x20000000 /* Send Message TLPs */ -+#define PCIE_STRFMR_RX_IO_TRANS_ENABLE 0x40000000 /* Mask Filtering of received I/O Requests */ -+#define PCIE_STRFMR_RX_CFG_TRANS_ENABLE 0x80000000 /* Mask Filtering of Received Configuration Requests */ -+ -+#define PCIE_DEF_SKP_INTERVAL 700 /* 1180 ~1538 , 125MHz * 2, 250MHz * 1 */ -+ -+/* Filter Masker Register 2 */ -+#define PCIE_FMR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x720) -+#define PCIE_FMR2_VENDOR_MSG0_PASSED_TO_TRGT1 0x00000001 /* Mask RADM Filtering and Error Handling Rules */ -+#define PCIE_FMR2_VENDOR_MSG1_PASSED_TO_TRGT1 0x00000002 /* Mask RADM Filtering and Error Handling Rules */ -+ -+/* Debug Register 0 */ -+#define PCIE_DBR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x728) -+ -+/* Debug Register 1 */ -+#define PCIE_DBR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x72C) -+ -+/* Transmit Posted FC Credit Status Register */ -+#define PCIE_TPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x730) -+#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS 0x00000FFF /* Transmit Posted Data FC Credits */ -+#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS_S 0 -+#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS 0x000FF000 /* Transmit Posted Header FC Credits */ -+#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS_S 12 -+ -+/* Transmit Non-Posted FC Credit Status */ -+#define PCIE_TNPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x734) -+#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS 0x00000FFF /* Transmit Non-Posted Data FC Credits */ -+#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS_S 0 -+#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS 0x000FF000 /* Transmit Non-Posted Header FC Credits */ -+#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS_S 12 -+ -+/* Transmit Complete FC Credit Status Register */ -+#define PCIE_TCFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x738) -+#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS 0x00000FFF /* Transmit Completion Data FC Credits */ -+#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS_S 0 -+#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS 0x000FF000 /* Transmit Completion Header FC Credits */ -+#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS_S 12 -+ -+/* Queue Status Register */ -+#define PCIE_QSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x73C) -+#define PCIE_QSR_WAIT_UPDATE_FC_DLL 0x00000001 /* Received TLP FC Credits Not Returned */ -+#define PCIE_QSR_TX_RETRY_BUF_NOT_EMPTY 0x00000002 /* Transmit Retry Buffer Not Empty */ -+#define PCIE_QSR_RX_QUEUE_NOT_EMPTY 0x00000004 /* Received Queue Not Empty */ -+ -+/* VC Transmit Arbitration Register 1 */ -+#define PCIE_VCTAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x740) -+#define PCIE_VCTAR1_WRR_WEIGHT_VC0 0x000000FF /* WRR Weight for VC0 */ -+#define PCIE_VCTAR1_WRR_WEIGHT_VC1 0x0000FF00 /* WRR Weight for VC1 */ -+#define PCIE_VCTAR1_WRR_WEIGHT_VC2 0x00FF0000 /* WRR Weight for VC2 */ -+#define PCIE_VCTAR1_WRR_WEIGHT_VC3 0xFF000000 /* WRR Weight for VC3 */ -+ -+/* VC Transmit Arbitration Register 2 */ -+#define PCIE_VCTAR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x744) -+#define PCIE_VCTAR2_WRR_WEIGHT_VC4 0x000000FF /* WRR Weight for VC4 */ -+#define PCIE_VCTAR2_WRR_WEIGHT_VC5 0x0000FF00 /* WRR Weight for VC5 */ -+#define PCIE_VCTAR2_WRR_WEIGHT_VC6 0x00FF0000 /* WRR Weight for VC6 */ -+#define PCIE_VCTAR2_WRR_WEIGHT_VC7 0xFF000000 /* WRR Weight for VC7 */ -+ -+/* VC0 Posted Receive Queue Control Register */ -+#define PCIE_VC0_PRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x748) -+#define PCIE_VC0_PRQCR_P_DATA_CREDITS 0x00000FFF /* VC0 Posted Data Credits */ -+#define PCIE_VC0_PRQCR_P_DATA_CREDITS_S 0 -+#define PCIE_VC0_PRQCR_P_HDR_CREDITS 0x000FF000 /* VC0 Posted Header Credits */ -+#define PCIE_VC0_PRQCR_P_HDR_CREDITS_S 12 -+#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE 0x00E00000 /* VC0 Posted TLP Queue Mode */ -+#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE_S 20 -+#define PCIE_VC0_PRQCR_TLP_RELAX_ORDER 0x40000000 /* TLP Type Ordering for VC0 */ -+#define PCIE_VC0_PRQCR_VC_STRICT_ORDER 0x80000000 /* VC0 Ordering for Receive Queues */ -+ -+/* VC0 Non-Posted Receive Queue Control */ -+#define PCIE_VC0_NPRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74C) -+#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS 0x00000FFF /* VC0 Non-Posted Data Credits */ -+#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS_S 0 -+#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS 0x000FF000 /* VC0 Non-Posted Header Credits */ -+#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS_S 12 -+#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE 0x00E00000 /* VC0 Non-Posted TLP Queue Mode */ -+#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE_S 20 -+ -+/* VC0 Completion Receive Queue Control */ -+#define PCIE_VC0_CRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x750) -+#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS 0x00000FFF /* VC0 Completion TLP Queue Mode */ -+#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS_S 0 -+#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS 0x000FF000 /* VC0 Completion Header Credits */ -+#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS_S 12 -+#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE 0x00E00000 /* VC0 Completion Data Credits */ -+#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE_S 21 -+ -+/* Applicable to the above three registers */ -+enum { -+ PCIE_VC0_TLP_QUEUE_MODE_STORE_FORWARD = 1, -+ PCIE_VC0_TLP_QUEUE_MODE_CUT_THROUGH = 2, -+ PCIE_VC0_TLP_QUEUE_MODE_BYPASS = 4, -+}; -+ -+/* VC0 Posted Buffer Depth Register */ -+#define PCIE_VC0_PBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7A8) -+#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Posted Data Queue Depth */ -+#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES_S 0 -+#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Posted Header Queue Depth */ -+#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES_S 16 -+ -+/* VC0 Non-Posted Buffer Depth Register */ -+#define PCIE_VC0_NPBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7AC) -+#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Non-Posted Data Queue Depth */ -+#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES_S 0 -+#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Non-Posted Header Queue Depth */ -+#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES_S 16 -+ -+/* VC0 Completion Buffer Depth Register */ -+#define PCIE_VC0_CBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7B0) -+#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES 0x00003FFF /* C0 Completion Data Queue Depth */ -+#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES_S 0 -+#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Completion Header Queue Depth */ -+#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES_S 16 -+ -+/* PHY Status Register, all zeros in VR9 */ -+#define PCIE_PHYSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x810) -+ -+/* PHY Control Register, all zeros in VR9 */ -+#define PCIE_PHYCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x814) -+ -+/* -+ * PCIe PDI PHY register definition, suppose all the following -+ * stuff is confidential. -+ * XXX, detailed bit definition -+ */ -+#define PCIE_PHY_PLL_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x22 << 1)) -+#define PCIE_PHY_PLL_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x23 << 1)) -+#define PCIE_PHY_PLL_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x24 << 1)) -+#define PCIE_PHY_PLL_CTRL4(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x25 << 1)) -+#define PCIE_PHY_PLL_CTRL5(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x26 << 1)) -+#define PCIE_PHY_PLL_CTRL6(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x27 << 1)) -+#define PCIE_PHY_PLL_CTRL7(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x28 << 1)) -+#define PCIE_PHY_PLL_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x29 << 1)) -+#define PCIE_PHY_PLL_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2A << 1)) -+#define PCIE_PHY_PLL_A_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2B << 1)) -+#define PCIE_PHY_PLL_STATUS(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2C << 1)) -+ -+#define PCIE_PHY_TX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x30 << 1)) -+#define PCIE_PHY_TX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x31 << 1)) -+#define PCIE_PHY_TX1_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x32 << 1)) -+#define PCIE_PHY_TX1_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x33 << 1)) -+#define PCIE_PHY_TX1_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x34 << 1)) -+#define PCIE_PHY_TX1_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x35 << 1)) -+#define PCIE_PHY_TX1_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x36 << 1)) -+#define PCIE_PHY_TX1_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x37 << 1)) -+ -+#define PCIE_PHY_TX2_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x38 << 1)) -+#define PCIE_PHY_TX2_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x39 << 1)) -+#define PCIE_PHY_TX2_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3B << 1)) -+#define PCIE_PHY_TX2_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3C << 1)) -+#define PCIE_PHY_TX2_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3D << 1)) -+#define PCIE_PHY_TX2_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3E << 1)) -+#define PCIE_PHY_TX2_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3F << 1)) -+ -+#define PCIE_PHY_RX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x50 << 1)) -+#define PCIE_PHY_RX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x51 << 1)) -+#define PCIE_PHY_RX1_CDR(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x52 << 1)) -+#define PCIE_PHY_RX1_EI(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x53 << 1)) -+#define PCIE_PHY_RX1_A_CTRL(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x55 << 1)) -+ -+/* Interrupt related stuff */ -+#define PCIE_LEGACY_DISABLE 0 -+#define PCIE_LEGACY_INTA 1 -+#define PCIE_LEGACY_INTB 2 -+#define PCIE_LEGACY_INTC 3 -+#define PCIE_LEGACY_INTD 4 -+#define PCIE_LEGACY_INT_MAX PCIE_LEGACY_INTD -+ -+#endif /* IFXMIPS_PCIE_REG_H */ -+ ---- /dev/null -+++ b/arch/mips/pci/ifxmips_pcie_vr9.h -@@ -0,0 +1,269 @@ -+/**************************************************************************** -+ Copyright (c) 2010 -+ Lantiq Deutschland GmbH -+ Am Campeon 3; 85579 Neubiberg, Germany -+ -+ For licensing information, see the file 'LICENSE' in the root folder of -+ this software module. -+ -+ *****************************************************************************/ -+/*! -+ \file ifxmips_pcie_vr9.h -+ \ingroup IFX_PCIE -+ \brief PCIe RC driver vr9 specific file -+*/ -+ -+#ifndef IFXMIPS_PCIE_VR9_H -+#define IFXMIPS_PCIE_VR9_H -+ -+#include -+#include -+ -+#include -+#include -+ -+#define IFX_PCIE_GPIO_RESET 494 -+ -+#define IFX_REG_R32 ltq_r32 -+#define IFX_REG_W32 ltq_w32 -+#define CONFIG_IFX_PCIE_HW_SWAP -+#define IFX_RCU_AHB_ENDIAN ((volatile u32*)(IFX_RCU + 0x004C)) -+#define IFX_RCU_RST_REQ ((volatile u32*)(IFX_RCU + 0x0010)) -+#define IFX_RCU_AHB_BE_PCIE_PDI 0x00000080 /* Configure PCIE PDI module in big endian*/ -+ -+#define IFX_RCU (KSEG1 | 0x1F203000) -+#define IFX_RCU_AHB_BE_PCIE_M 0x00000001 /* Configure AHB master port that connects to PCIe RC in big endian */ -+#define IFX_RCU_AHB_BE_PCIE_S 0x00000010 /* Configure AHB slave port that connects to PCIe RC in little endian */ -+#define IFX_RCU_AHB_BE_XBAR_M 0x00000002 /* Configure AHB master port that connects to XBAR in big endian */ -+#define CONFIG_IFX_PCIE_PHY_36MHZ_MODE -+ -+#define IFX_PMU1_MODULE_PCIE_PHY (0) -+#define IFX_PMU1_MODULE_PCIE_CTRL (1) -+#define IFX_PMU1_MODULE_PDI (4) -+#define IFX_PMU1_MODULE_MSI (5) -+ -+#define IFX_PMU_MODULE_PCIE_L0_CLK (31) -+ -+ -+#define IFX_GPIO (KSEG1 | 0x1E100B00) -+#define ALT0 ((volatile u32*)(IFX_GPIO + 0x007c)) -+#define ALT1 ((volatile u32*)(IFX_GPIO + 0x0080)) -+#define OD ((volatile u32*)(IFX_GPIO + 0x0084)) -+#define DIR ((volatile u32*)(IFX_GPIO + 0x0078)) -+#define OUT ((volatile u32*)(IFX_GPIO + 0x0070)) -+ -+ -+static inline void pcie_ep_gpio_rst_init(int pcie_port) -+{ -+ -+ gpio_request(IFX_PCIE_GPIO_RESET, "pcie-reset"); -+ gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); -+ gpio_set_value(IFX_PCIE_GPIO_RESET, 1); -+ -+/* ifx_gpio_pin_reserve(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+ ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+ ifx_gpio_dir_out_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+ ifx_gpio_altsel0_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+ ifx_gpio_altsel1_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+ ifx_gpio_open_drain_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id);*/ -+} -+ -+static inline void pcie_ahb_pmu_setup(void) -+{ -+ /* Enable AHB bus master/slave */ -+ struct clk *clk; -+ clk = clk_get_sys("1d900000.pcie", "ahb"); -+ clk_enable(clk); -+ -+ //AHBM_PMU_SETUP(IFX_PMU_ENABLE); -+ //AHBS_PMU_SETUP(IFX_PMU_ENABLE); -+} -+ -+static inline void pcie_rcu_endian_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); -+#ifdef CONFIG_IFX_PCIE_HW_SWAP -+ reg |= IFX_RCU_AHB_BE_PCIE_M; -+ reg |= IFX_RCU_AHB_BE_PCIE_S; -+ reg &= ~IFX_RCU_AHB_BE_XBAR_M; -+#else -+ reg |= IFX_RCU_AHB_BE_PCIE_M; -+ reg &= ~IFX_RCU_AHB_BE_PCIE_S; -+ reg &= ~IFX_RCU_AHB_BE_XBAR_M; -+#endif /* CONFIG_IFX_PCIE_HW_SWAP */ -+ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); -+ IFX_PCIE_PRINT(PCIE_MSG_REG, "%s IFX_RCU_AHB_ENDIAN: 0x%08x\n", __func__, IFX_REG_R32(IFX_RCU_AHB_ENDIAN)); -+} -+ -+static inline void pcie_phy_pmu_enable(int pcie_port) -+{ -+ struct clk *clk; -+ clk = clk_get_sys("1d900000.pcie", "phy"); -+ clk_enable(clk); -+ -+ //PCIE_PHY_PMU_SETUP(IFX_PMU_ENABLE); -+} -+ -+static inline void pcie_phy_pmu_disable(int pcie_port) -+{ -+ struct clk *clk; -+ clk = clk_get_sys("1d900000.pcie", "phy"); -+ clk_disable(clk); -+ -+// PCIE_PHY_PMU_SETUP(IFX_PMU_DISABLE); -+} -+ -+static inline void pcie_pdi_big_endian(int pcie_port) -+{ -+ u32 reg; -+ -+ /* SRAM2PDI endianness control. */ -+ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); -+ /* Config AHB->PCIe and PDI endianness */ -+ reg |= IFX_RCU_AHB_BE_PCIE_PDI; -+ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); -+} -+ -+static inline void pcie_pdi_pmu_enable(int pcie_port) -+{ -+ /* Enable PDI to access PCIe PHY register */ -+ struct clk *clk; -+ clk = clk_get_sys("1d900000.pcie", "pdi"); -+ clk_enable(clk); -+ //PDI_PMU_SETUP(IFX_PMU_ENABLE); -+} -+ -+static inline void pcie_core_rst_assert(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ -+ /* Reset PCIe PHY & Core, bit 22, bit 26 may be affected if write it directly */ -+ reg |= 0x00400000; -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_core_rst_deassert(int pcie_port) -+{ -+ u32 reg; -+ -+ /* Make sure one micro-second delay */ -+ udelay(1); -+ -+ /* Reset PCIe PHY & Core, bit 22 */ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ reg &= ~0x00400000; -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_phy_rst_assert(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ reg |= 0x00001000; /* Bit 12 */ -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_phy_rst_deassert(int pcie_port) -+{ -+ u32 reg; -+ -+ /* Make sure one micro-second delay */ -+ udelay(1); -+ -+ reg = IFX_REG_R32(IFX_RCU_RST_REQ); -+ reg &= ~0x00001000; /* Bit 12 */ -+ IFX_REG_W32(reg, IFX_RCU_RST_REQ); -+} -+ -+static inline void pcie_device_rst_assert(int pcie_port) -+{ -+ gpio_set_value(IFX_PCIE_GPIO_RESET, 0); -+// ifx_gpio_output_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+} -+ -+static inline void pcie_device_rst_deassert(int pcie_port) -+{ -+ mdelay(100); -+ gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); -+// gpio_set_value(IFX_PCIE_GPIO_RESET, 1); -+ //ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -+} -+ -+static inline void pcie_core_pmu_setup(int pcie_port) -+{ -+ struct clk *clk; -+ clk = clk_get_sys("1d900000.pcie", "ctl"); -+ clk_enable(clk); -+ clk = clk_get_sys("1d900000.pcie", "bus"); -+ clk_enable(clk); -+ -+ /* PCIe Core controller enabled */ -+// PCIE_CTRL_PMU_SETUP(IFX_PMU_ENABLE); -+ -+ /* Enable PCIe L0 Clock */ -+// PCIE_L0_CLK_PMU_SETUP(IFX_PMU_ENABLE); -+} -+ -+static inline void pcie_msi_init(int pcie_port) -+{ -+ struct clk *clk; -+ pcie_msi_pic_init(pcie_port); -+ clk = clk_get_sys("ltq_pcie", "msi"); -+ clk_enable(clk); -+// MSI_PMU_SETUP(IFX_PMU_ENABLE); -+} -+ -+static inline u32 -+ifx_pcie_bus_nr_deduct(u32 bus_number, int pcie_port) -+{ -+ u32 tbus_number = bus_number; -+ -+#ifdef CONFIG_PCI_LANTIQ -+ if (pcibios_host_nr() > 1) { -+ tbus_number -= pcibios_1st_host_bus_nr(); -+ } -+#endif /* CONFIG_PCI_LANTIQ */ -+ return tbus_number; -+} -+ -+static inline u32 -+ifx_pcie_bus_enum_hack(struct pci_bus *bus, u32 devfn, int where, u32 value, int pcie_port, int read) -+{ -+ struct pci_dev *pdev; -+ u32 tvalue = value; -+ -+ /* Sanity check */ -+ pdev = pci_get_slot(bus, devfn); -+ if (pdev == NULL) { -+ return tvalue; -+ } -+ -+ /* Only care about PCI bridge */ -+ if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { -+ return tvalue; -+ } -+ -+ if (read) { /* Read hack */ -+ #ifdef CONFIG_PCI_LANTIQ -+ if (pcibios_host_nr() > 1) { -+ tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue); -+ } -+ #endif /* CONFIG_PCI_LANTIQ */ -+ } -+ else { /* Write hack */ -+ #ifdef CONFIG_PCI_LANTIQ -+ if (pcibios_host_nr() > 1) { -+ tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue); -+ } -+ #endif -+ } -+ return tvalue; -+} -+ -+#endif /* IFXMIPS_PCIE_VR9_H */ -+ ---- a/arch/mips/pci/pci-legacy.c -+++ b/arch/mips/pci/pci-legacy.c -@@ -300,3 +300,30 @@ char *__init pcibios_setup(char *str) - return pcibios_plat_setup(str); - return str; - } -+ -+int pcibios_host_nr(void) -+{ -+ int count = 0; -+ struct pci_controller *hose; -+ list_for_each_entry(hose, &controllers, list) { -+ count++; -+ } -+ return count; -+} -+EXPORT_SYMBOL(pcibios_host_nr); -+ -+int pcibios_1st_host_bus_nr(void) -+{ -+ int bus_nr = 0; -+ struct pci_controller *hose; -+ -+ hose = list_first_entry_or_null(&controllers, struct pci_controller, list); -+ -+ if (hose != NULL) { -+ if (hose->bus != NULL) { -+ bus_nr = hose->bus->number + 1; -+ } -+ } -+ return bus_nr; -+} -+EXPORT_SYMBOL(pcibios_1st_host_bus_nr); ---- /dev/null -+++ b/arch/mips/pci/pcie-lantiq.h -@@ -0,0 +1,1305 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifxmips_pcie_reg.h -+** PROJECT : IFX UEIP for VRX200 -+** MODULES : PCIe module -+** -+** DATE : 02 Mar 2009 -+** AUTHOR : Lei Chuanhua -+** DESCRIPTION : PCIe Root Complex Driver -+** COPYRIGHT : Copyright (c) 2009 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** HISTORY -+** $Version $Date $Author $Comment -+** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version -+*******************************************************************************/ -+#ifndef IFXMIPS_PCIE_REG_H -+#define IFXMIPS_PCIE_REG_H -+#include -+#include -+#include -+#include -+/*! -+ \file ifxmips_pcie_reg.h -+ \ingroup IFX_PCIE -+ \brief header file for PCIe module register definition -+*/ -+/* PCIe Address Mapping Base */ -+#define PCIE_CFG_PHY_BASE 0x1D000000UL -+#define PCIE_CFG_BASE (KSEG1 + PCIE_CFG_PHY_BASE) -+#define PCIE_CFG_SIZE (8 * 1024 * 1024) -+ -+#define PCIE_MEM_PHY_BASE 0x1C000000UL -+#define PCIE_MEM_BASE (KSEG1 + PCIE_MEM_PHY_BASE) -+#define PCIE_MEM_SIZE (16 * 1024 * 1024) -+#define PCIE_MEM_PHY_END (PCIE_MEM_PHY_BASE + PCIE_MEM_SIZE - 1) -+ -+#define PCIE_IO_PHY_BASE 0x1D800000UL -+#define PCIE_IO_BASE (KSEG1 + PCIE_IO_PHY_BASE) -+#define PCIE_IO_SIZE (1 * 1024 * 1024) -+#define PCIE_IO_PHY_END (PCIE_IO_PHY_BASE + PCIE_IO_SIZE - 1) -+ -+#define PCIE_RC_CFG_BASE (KSEG1 + 0x1D900000) -+#define PCIE_APP_LOGIC_REG (KSEG1 + 0x1E100900) -+#define PCIE_MSI_PHY_BASE 0x1F600000UL -+ -+#define PCIE_PDI_PHY_BASE 0x1F106800UL -+#define PCIE_PDI_BASE (KSEG1 + PCIE_PDI_PHY_BASE) -+#define PCIE_PDI_SIZE 0x400 -+ -+#define PCIE1_CFG_PHY_BASE 0x19000000UL -+#define PCIE1_CFG_BASE (KSEG1 + PCIE1_CFG_PHY_BASE) -+#define PCIE1_CFG_SIZE (8 * 1024 * 1024) -+ -+#define PCIE1_MEM_PHY_BASE 0x18000000UL -+#define PCIE1_MEM_BASE (KSEG1 + PCIE1_MEM_PHY_BASE) -+#define PCIE1_MEM_SIZE (16 * 1024 * 1024) -+#define PCIE1_MEM_PHY_END (PCIE1_MEM_PHY_BASE + PCIE1_MEM_SIZE - 1) -+ -+#define PCIE1_IO_PHY_BASE 0x19800000UL -+#define PCIE1_IO_BASE (KSEG1 + PCIE1_IO_PHY_BASE) -+#define PCIE1_IO_SIZE (1 * 1024 * 1024) -+#define PCIE1_IO_PHY_END (PCIE1_IO_PHY_BASE + PCIE1_IO_SIZE - 1) -+ -+#define PCIE1_RC_CFG_BASE (KSEG1 + 0x19900000) -+#define PCIE1_APP_LOGIC_REG (KSEG1 + 0x1E100700) -+#define PCIE1_MSI_PHY_BASE 0x1F400000UL -+ -+#define PCIE1_PDI_PHY_BASE 0x1F700400UL -+#define PCIE1_PDI_BASE (KSEG1 + PCIE1_PDI_PHY_BASE) -+#define PCIE1_PDI_SIZE 0x400 -+ -+#define PCIE_CFG_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_CFG_BASE) : (PCIE_CFG_BASE)) -+#define PCIE_MEM_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_BASE) : (PCIE_MEM_BASE)) -+#define PCIE_IO_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_BASE) : (PCIE_IO_BASE)) -+#define PCIE_MEM_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_PHY_BASE) : (PCIE_MEM_PHY_BASE)) -+#define PCIE_MEM_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_MEM_PHY_END) : (PCIE_MEM_PHY_END)) -+#define PCIE_IO_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_PHY_BASE) : (PCIE_IO_PHY_BASE)) -+#define PCIE_IO_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_IO_PHY_END) : (PCIE_IO_PHY_END)) -+#define PCIE_APP_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_APP_LOGIC_REG) : (PCIE_APP_LOGIC_REG)) -+#define PCIE_RC_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_RC_CFG_BASE) : (PCIE_RC_CFG_BASE)) -+#define PCIE_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_PDI_BASE) : (PCIE_PDI_BASE)) -+ -+/* PCIe Application Logic Register */ -+/* RC Core Control Register */ -+#define PCIE_RC_CCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x10) -+/* This should be enabled after initializing configuratin registers -+ * Also should check link status retraining bit -+ */ -+#define PCIE_RC_CCR_LTSSM_ENABLE 0x00000001 /* Enable LTSSM to continue link establishment */ -+ -+/* RC Core Debug Register */ -+#define PCIE_RC_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x14) -+#define PCIE_RC_DR_DLL_UP 0x00000001 /* Data Link Layer Up */ -+#define PCIE_RC_DR_CURRENT_POWER_STATE 0x0000000E /* Current Power State */ -+#define PCIE_RC_DR_CURRENT_POWER_STATE_S 1 -+#define PCIE_RC_DR_CURRENT_LTSSM_STATE 0x000001F0 /* Current LTSSM State */ -+#define PCIE_RC_DR_CURRENT_LTSSM_STATE_S 4 -+ -+#define PCIE_RC_DR_PM_DEV_STATE 0x00000E00 /* Power Management D-State */ -+#define PCIE_RC_DR_PM_DEV_STATE_S 9 -+ -+#define PCIE_RC_DR_PM_ENABLED 0x00001000 /* Power Management State from PMU */ -+#define PCIE_RC_DR_PME_EVENT_ENABLED 0x00002000 /* Power Management Event Enable State */ -+#define PCIE_RC_DR_AUX_POWER_ENABLED 0x00004000 /* Auxiliary Power Enable */ -+ -+/* Current Power State Definition */ -+enum { -+ PCIE_RC_DR_D0 = 0, -+ PCIE_RC_DR_D1, /* Not supported */ -+ PCIE_RC_DR_D2, /* Not supported */ -+ PCIE_RC_DR_D3, -+ PCIE_RC_DR_UN, -+}; -+ -+/* PHY Link Status Register */ -+#define PCIE_PHY_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x18) -+#define PCIE_PHY_SR_PHY_LINK_UP 0x00000001 /* PHY Link Up/Down Indicator */ -+ -+/* Electromechanical Control Register */ -+#define PCIE_EM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x1C) -+#define PCIE_EM_CR_CARD_IS_PRESENT 0x00000001 /* Card Presence Detect State */ -+#define PCIE_EM_CR_MRL_OPEN 0x00000002 /* MRL Sensor State */ -+#define PCIE_EM_CR_POWER_FAULT_SET 0x00000004 /* Power Fault Detected */ -+#define PCIE_EM_CR_MRL_SENSOR_SET 0x00000008 /* MRL Sensor Changed */ -+#define PCIE_EM_CR_PRESENT_DETECT_SET 0x00000010 /* Card Presense Detect Changed */ -+#define PCIE_EM_CR_CMD_CPL_INT_SET 0x00000020 /* Command Complete Interrupt */ -+#define PCIE_EM_CR_SYS_INTERLOCK_SET 0x00000040 /* System Electromechanical IterLock Engaged */ -+#define PCIE_EM_CR_ATTENTION_BUTTON_SET 0x00000080 /* Attention Button Pressed */ -+ -+/* Interrupt Status Register */ -+#define PCIE_IR_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x20) -+#define PCIE_IR_SR_PME_CAUSE_MSI 0x00000002 /* MSI caused by PME */ -+#define PCIE_IR_SR_HP_PME_WAKE_GEN 0x00000004 /* Hotplug PME Wake Generation */ -+#define PCIE_IR_SR_HP_MSI 0x00000008 /* Hotplug MSI */ -+#define PCIE_IR_SR_AHB_LU_ERR 0x00000030 /* AHB Bridge Lookup Error Signals */ -+#define PCIE_IR_SR_AHB_LU_ERR_S 4 -+#define PCIE_IR_SR_INT_MSG_NUM 0x00003E00 /* Interrupt Message Number */ -+#define PCIE_IR_SR_INT_MSG_NUM_S 9 -+#define PCIE_IR_SR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ -+#define PCIE_IR_SR_AER_INT_MSG_NUM_S 27 -+ -+/* Message Control Register */ -+#define PCIE_MSG_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x30) -+#define PCIE_MSG_CR_GEN_PME_TURN_OFF_MSG 0x00000001 /* Generate PME Turn Off Message */ -+#define PCIE_MSG_CR_GEN_UNLOCK_MSG 0x00000002 /* Generate Unlock Message */ -+ -+#define PCIE_VDM_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x34) -+ -+/* Vendor-Defined Message Requester ID Register */ -+#define PCIE_VDM_RID(X) (PCIE_APP_PORT_TO_BASE (X) + 0x38) -+#define PCIE_VDM_RID_VENROR_MSG_REQ_ID 0x0000FFFF -+#define PCIE_VDM_RID_VDMRID_S 0 -+ -+/* ASPM Control Register */ -+#define PCIE_ASPM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x40) -+#define PCIE_ASPM_CR_HOT_RST 0x00000001 /* Hot Reset Request to the downstream device */ -+#define PCIE_ASPM_CR_REQ_EXIT_L1 0x00000002 /* Request to Exit L1 */ -+#define PCIE_ASPM_CR_REQ_ENTER_L1 0x00000004 /* Request to Enter L1 */ -+ -+/* Vendor Message DW0 Register */ -+#define PCIE_VM_MSG_DW0(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x50) -+#define PCIE_VM_MSG_DW0_TYPE 0x0000001F /* Message type */ -+#define PCIE_VM_MSG_DW0_TYPE_S 0 -+#define PCIE_VM_MSG_DW0_FORMAT 0x00000060 /* Format */ -+#define PCIE_VM_MSG_DW0_FORMAT_S 5 -+#define PCIE_VM_MSG_DW0_TC 0x00007000 /* Traffic Class */ -+#define PCIE_VM_MSG_DW0_TC_S 12 -+#define PCIE_VM_MSG_DW0_ATTR 0x000C0000 /* Atrributes */ -+#define PCIE_VM_MSG_DW0_ATTR_S 18 -+#define PCIE_VM_MSG_DW0_EP_TLP 0x00100000 /* Poisoned TLP */ -+#define PCIE_VM_MSG_DW0_TD 0x00200000 /* TLP Digest */ -+#define PCIE_VM_MSG_DW0_LEN 0xFFC00000 /* Length */ -+#define PCIE_VM_MSG_DW0_LEN_S 22 -+ -+/* Format Definition */ -+enum { -+ PCIE_VM_MSG_FORMAT_00 = 0, /* 3DW Hdr, no data*/ -+ PCIE_VM_MSG_FORMAT_01, /* 4DW Hdr, no data */ -+ PCIE_VM_MSG_FORMAT_10, /* 3DW Hdr, with data */ -+ PCIE_VM_MSG_FORMAT_11, /* 4DW Hdr, with data */ -+}; -+ -+/* Traffic Class Definition */ -+enum { -+ PCIE_VM_MSG_TC0 = 0, -+ PCIE_VM_MSG_TC1, -+ PCIE_VM_MSG_TC2, -+ PCIE_VM_MSG_TC3, -+ PCIE_VM_MSG_TC4, -+ PCIE_VM_MSG_TC5, -+ PCIE_VM_MSG_TC6, -+ PCIE_VM_MSG_TC7, -+}; -+ -+/* Attributes Definition */ -+enum { -+ PCIE_VM_MSG_ATTR_00 = 0, /* RO and No Snoop cleared */ -+ PCIE_VM_MSG_ATTR_01, /* RO cleared , No Snoop set */ -+ PCIE_VM_MSG_ATTR_10, /* RO set, No Snoop cleared*/ -+ PCIE_VM_MSG_ATTR_11, /* RO and No Snoop set */ -+}; -+ -+/* Payload Size Definition */ -+#define PCIE_VM_MSG_LEN_MIN 0 -+#define PCIE_VM_MSG_LEN_MAX 1024 -+ -+/* Vendor Message DW1 Register */ -+#define PCIE_VM_MSG_DW1(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x54) -+#define PCIE_VM_MSG_DW1_FUNC_NUM 0x00000070 /* Function Number */ -+#define PCIE_VM_MSG_DW1_FUNC_NUM_S 8 -+#define PCIE_VM_MSG_DW1_CODE 0x00FF0000 /* Message Code */ -+#define PCIE_VM_MSG_DW1_CODE_S 16 -+#define PCIE_VM_MSG_DW1_TAG 0xFF000000 /* Tag */ -+#define PCIE_VM_MSG_DW1_TAG_S 24 -+ -+#define PCIE_VM_MSG_DW2(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x58) -+#define PCIE_VM_MSG_DW3(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x5C) -+ -+/* Vendor Message Request Register */ -+#define PCIE_VM_MSG_REQR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x60) -+#define PCIE_VM_MSG_REQR_REQ 0x00000001 /* Vendor Message Request */ -+ -+ -+/* AHB Slave Side Band Control Register */ -+#define PCIE_AHB_SSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x70) -+#define PCIE_AHB_SSB_REQ_BCM 0x00000001 /* Slave Reques BCM filed */ -+#define PCIE_AHB_SSB_REQ_EP 0x00000002 /* Slave Reques EP filed */ -+#define PCIE_AHB_SSB_REQ_TD 0x00000004 /* Slave Reques TD filed */ -+#define PCIE_AHB_SSB_REQ_ATTR 0x00000018 /* Slave Reques Attribute number */ -+#define PCIE_AHB_SSB_REQ_ATTR_S 3 -+#define PCIE_AHB_SSB_REQ_TC 0x000000E0 /* Slave Request TC Field */ -+#define PCIE_AHB_SSB_REQ_TC_S 5 -+ -+/* AHB Master SideBand Ctrl Register */ -+#define PCIE_AHB_MSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x74) -+#define PCIE_AHB_MSB_RESP_ATTR 0x00000003 /* Master Response Attribute number */ -+#define PCIE_AHB_MSB_RESP_ATTR_S 0 -+#define PCIE_AHB_MSB_RESP_BAD_EOT 0x00000004 /* Master Response Badeot filed */ -+#define PCIE_AHB_MSB_RESP_BCM 0x00000008 /* Master Response BCM filed */ -+#define PCIE_AHB_MSB_RESP_EP 0x00000010 /* Master Response EP filed */ -+#define PCIE_AHB_MSB_RESP_TD 0x00000020 /* Master Response TD filed */ -+#define PCIE_AHB_MSB_RESP_FUN_NUM 0x000003C0 /* Master Response Function number */ -+#define PCIE_AHB_MSB_RESP_FUN_NUM_S 6 -+ -+/* AHB Control Register, fixed bus enumeration exception */ -+#define PCIE_AHB_CTRL(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x78) -+#define PCIE_AHB_CTRL_BUS_ERROR_SUPPRESS 0x00000001 -+ -+/* Interrupt Enalbe Register */ -+#define PCIE_IRNEN(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF4) -+#define PCIE_IRNCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF8) -+#define PCIE_IRNICR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xFC) -+ -+/* PCIe interrupt enable/control/capture register definition */ -+#define PCIE_IRN_AER_REPORT 0x00000001 /* AER Interrupt */ -+#define PCIE_IRN_AER_MSIX 0x00000002 /* Advanced Error MSI-X Interrupt */ -+#define PCIE_IRN_PME 0x00000004 /* PME Interrupt */ -+#define PCIE_IRN_HOTPLUG 0x00000008 /* Hotplug Interrupt */ -+#define PCIE_IRN_RX_VDM_MSG 0x00000010 /* Vendor-Defined Message Interrupt */ -+#define PCIE_IRN_RX_CORRECTABLE_ERR_MSG 0x00000020 /* Correctable Error Message Interrupt */ -+#define PCIE_IRN_RX_NON_FATAL_ERR_MSG 0x00000040 /* Non-fatal Error Message */ -+#define PCIE_IRN_RX_FATAL_ERR_MSG 0x00000080 /* Fatal Error Message */ -+#define PCIE_IRN_RX_PME_MSG 0x00000100 /* PME Message Interrupt */ -+#define PCIE_IRN_RX_PME_TURNOFF_ACK 0x00000200 /* PME Turnoff Ack Message Interrupt */ -+#define PCIE_IRN_AHB_BR_FATAL_ERR 0x00000400 /* AHB Fatal Error Interrupt */ -+#define PCIE_IRN_LINK_AUTO_BW_STATUS 0x00000800 /* Link Auto Bandwidth Status Interrupt */ -+#define PCIE_IRN_BW_MGT 0x00001000 /* Bandwidth Managment Interrupt */ -+#define PCIE_IRN_INTA 0x00002000 /* INTA */ -+#define PCIE_IRN_INTB 0x00004000 /* INTB */ -+#define PCIE_IRN_INTC 0x00008000 /* INTC */ -+#define PCIE_IRN_INTD 0x00010000 /* INTD */ -+#define PCIE_IRN_WAKEUP 0x00020000 /* Wake up Interrupt */ -+ -+#define PCIE_RC_CORE_COMBINED_INT (PCIE_IRN_AER_REPORT | PCIE_IRN_AER_MSIX | PCIE_IRN_PME | \ -+ PCIE_IRN_HOTPLUG | PCIE_IRN_RX_VDM_MSG | PCIE_IRN_RX_CORRECTABLE_ERR_MSG |\ -+ PCIE_IRN_RX_NON_FATAL_ERR_MSG | PCIE_IRN_RX_FATAL_ERR_MSG | \ -+ PCIE_IRN_RX_PME_MSG | PCIE_IRN_RX_PME_TURNOFF_ACK | PCIE_IRN_AHB_BR_FATAL_ERR | \ -+ PCIE_IRN_LINK_AUTO_BW_STATUS | PCIE_IRN_BW_MGT) -+/* PCIe RC Configuration Register */ -+#define PCIE_VDID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x00) -+ -+/* Bit definition from pci_reg.h */ -+#define PCIE_PCICMDSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x04) -+#define PCIE_CCRID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x08) -+#define PCIE_CLSLTHTBR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x0C) /* EP only */ -+/* BAR0, BAR1,Only necessary if the bridges implements a device-specific register set or memory buffer */ -+#define PCIE_BAR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10) /* Not used*/ -+#define PCIE_BAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14) /* Not used */ -+ -+#define PCIE_BNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x18) /* Mandatory */ -+/* Bus Number Register bits */ -+#define PCIE_BNR_PRIMARY_BUS_NUM 0x000000FF -+#define PCIE_BNR_PRIMARY_BUS_NUM_S 0 -+#define PCIE_PNR_SECONDARY_BUS_NUM 0x0000FF00 -+#define PCIE_PNR_SECONDARY_BUS_NUM_S 8 -+#define PCIE_PNR_SUB_BUS_NUM 0x00FF0000 -+#define PCIE_PNR_SUB_BUS_NUM_S 16 -+ -+/* IO Base/Limit Register bits */ -+#define PCIE_IOBLSECS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x1C) /* RC only */ -+#define PCIE_IOBLSECS_32BIT_IO_ADDR 0x00000001 -+#define PCIE_IOBLSECS_IO_BASE_ADDR 0x000000F0 -+#define PCIE_IOBLSECS_IO_BASE_ADDR_S 4 -+#define PCIE_IOBLSECS_32BIT_IOLIMT 0x00000100 -+#define PCIE_IOBLSECS_IO_LIMIT_ADDR 0x0000F000 -+#define PCIE_IOBLSECS_IO_LIMIT_ADDR_S 12 -+ -+/* Non-prefetchable Memory Base/Limit Register bit */ -+#define PCIE_MBML(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x20) /* RC only */ -+#define PCIE_MBML_MEM_BASE_ADDR 0x0000FFF0 -+#define PCIE_MBML_MEM_BASE_ADDR_S 4 -+#define PCIE_MBML_MEM_LIMIT_ADDR 0xFFF00000 -+#define PCIE_MBML_MEM_LIMIT_ADDR_S 20 -+ -+/* Prefetchable Memory Base/Limit Register bit */ -+#define PCIE_PMBL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x24) /* RC only */ -+#define PCIE_PMBL_64BIT_ADDR 0x00000001 -+#define PCIE_PMBL_UPPER_12BIT 0x0000FFF0 -+#define PCIE_PMBL_UPPER_12BIT_S 4 -+#define PCIE_PMBL_E64MA 0x00010000 -+#define PCIE_PMBL_END_ADDR 0xFFF00000 -+#define PCIE_PMBL_END_ADDR_S 20 -+#define PCIE_PMBU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x28) /* RC only */ -+#define PCIE_PMLU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x2C) /* RC only */ -+ -+/* I/O Base/Limit Upper 16 bits register */ -+#define PCIE_IO_BANDL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x30) /* RC only */ -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE 0x0000FFFF -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE_S 0 -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT 0xFFFF0000 -+#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT_S 16 -+ -+#define PCIE_CPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x34) -+#define PCIE_EBBAR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x38) -+ -+/* Interrupt and Secondary Bridge Control Register */ -+#define PCIE_INTRBCTRL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x3C) -+ -+#define PCIE_INTRBCTRL_INT_LINE 0x000000FF -+#define PCIE_INTRBCTRL_INT_LINE_S 0 -+#define PCIE_INTRBCTRL_INT_PIN 0x0000FF00 -+#define PCIE_INTRBCTRL_INT_PIN_S 8 -+#define PCIE_INTRBCTRL_PARITY_ERR_RESP_ENABLE 0x00010000 /* #PERR */ -+#define PCIE_INTRBCTRL_SERR_ENABLE 0x00020000 /* #SERR */ -+#define PCIE_INTRBCTRL_ISA_ENABLE 0x00040000 /* ISA enable, IO 64KB only */ -+#define PCIE_INTRBCTRL_VGA_ENABLE 0x00080000 /* VGA enable */ -+#define PCIE_INTRBCTRL_VGA_16BIT_DECODE 0x00100000 /* VGA 16bit decode */ -+#define PCIE_INTRBCTRL_RST_SECONDARY_BUS 0x00400000 /* Secondary bus rest, hot rest, 1ms */ -+/* Others are read only */ -+enum { -+ PCIE_INTRBCTRL_INT_NON = 0, -+ PCIE_INTRBCTRL_INTA, -+ PCIE_INTRBCTRL_INTB, -+ PCIE_INTRBCTRL_INTC, -+ PCIE_INTRBCTRL_INTD, -+}; -+ -+#define PCIE_PM_CAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x40) -+ -+/* Power Management Control and Status Register */ -+#define PCIE_PM_CSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x44) -+ -+#define PCIE_PM_CSR_POWER_STATE 0x00000003 /* Power State */ -+#define PCIE_PM_CSR_POWER_STATE_S 0 -+#define PCIE_PM_CSR_SW_RST 0x00000008 /* Soft Reset Enabled */ -+#define PCIE_PM_CSR_PME_ENABLE 0x00000100 /* PME Enable */ -+#define PCIE_PM_CSR_PME_STATUS 0x00008000 /* PME status */ -+ -+/* MSI Capability Register for EP */ -+#define PCIE_MCAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x50) -+ -+#define PCIE_MCAPR_MSI_CAP_ID 0x000000FF /* MSI Capability ID */ -+#define PCIE_MCAPR_MSI_CAP_ID_S 0 -+#define PCIE_MCAPR_MSI_NEXT_CAP_PTR 0x0000FF00 /* Next Capability Pointer */ -+#define PCIE_MCAPR_MSI_NEXT_CAP_PTR_S 8 -+#define PCIE_MCAPR_MSI_ENABLE 0x00010000 /* MSI Enable */ -+#define PCIE_MCAPR_MULTI_MSG_CAP 0x000E0000 /* Multiple Message Capable */ -+#define PCIE_MCAPR_MULTI_MSG_CAP_S 17 -+#define PCIE_MCAPR_MULTI_MSG_ENABLE 0x00700000 /* Multiple Message Enable */ -+#define PCIE_MCAPR_MULTI_MSG_ENABLE_S 20 -+#define PCIE_MCAPR_ADDR64_CAP 0X00800000 /* 64-bit Address Capable */ -+ -+/* MSI Message Address Register */ -+#define PCIE_MA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x54) -+ -+#define PCIE_MA_ADDR_MASK 0xFFFFFFFC /* Message Address */ -+ -+/* MSI Message Upper Address Register */ -+#define PCIE_MUA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x58) -+ -+/* MSI Message Data Register */ -+#define PCIE_MD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x5C) -+ -+#define PCIE_MD_DATA 0x0000FFFF /* Message Data */ -+#define PCIE_MD_DATA_S 0 -+ -+/* PCI Express Capability Register */ -+#define PCIE_XCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70) -+ -+#define PCIE_XCAP_ID 0x000000FF /* PCI Express Capability ID */ -+#define PCIE_XCAP_ID_S 0 -+#define PCIE_XCAP_NEXT_CAP 0x0000FF00 /* Next Capability Pointer */ -+#define PCIE_XCAP_NEXT_CAP_S 8 -+#define PCIE_XCAP_VER 0x000F0000 /* PCI Express Capability Version */ -+#define PCIE_XCAP_VER_S 16 -+#define PCIE_XCAP_DEV_PORT_TYPE 0x00F00000 /* Device Port Type */ -+#define PCIE_XCAP_DEV_PORT_TYPE_S 20 -+#define PCIE_XCAP_SLOT_IMPLEMENTED 0x01000000 /* Slot Implemented */ -+#define PCIE_XCAP_MSG_INT_NUM 0x3E000000 /* Interrupt Message Number */ -+#define PCIE_XCAP_MSG_INT_NUM_S 25 -+ -+/* Device Capability Register */ -+#define PCIE_DCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74) -+ -+#define PCIE_DCAP_MAX_PAYLOAD_SIZE 0x00000007 /* Max Payload size */ -+#define PCIE_DCAP_MAX_PAYLOAD_SIZE_S 0 -+#define PCIE_DCAP_PHANTOM_FUNC 0x00000018 /* Phanton Function, not supported */ -+#define PCIE_DCAP_PHANTOM_FUNC_S 3 -+#define PCIE_DCAP_EXT_TAG 0x00000020 /* Extended Tag Field */ -+#define PCIE_DCAP_EP_L0S_LATENCY 0x000001C0 /* EP L0s latency only */ -+#define PCIE_DCAP_EP_L0S_LATENCY_S 6 -+#define PCIE_DCAP_EP_L1_LATENCY 0x00000E00 /* EP L1 latency only */ -+#define PCIE_DCAP_EP_L1_LATENCY_S 9 -+#define PCIE_DCAP_ROLE_BASE_ERR_REPORT 0x00008000 /* Role Based ERR */ -+ -+/* Maximum payload size supported */ -+enum { -+ PCIE_MAX_PAYLOAD_128 = 0, -+ PCIE_MAX_PAYLOAD_256, -+ PCIE_MAX_PAYLOAD_512, -+ PCIE_MAX_PAYLOAD_1024, -+ PCIE_MAX_PAYLOAD_2048, -+ PCIE_MAX_PAYLOAD_4096, -+}; -+ -+/* Device Control and Status Register */ -+#define PCIE_DCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x78) -+ -+#define PCIE_DCTLSTS_CORRECTABLE_ERR_EN 0x00000001 /* COR-ERR */ -+#define PCIE_DCTLSTS_NONFATAL_ERR_EN 0x00000002 /* Non-fatal ERR */ -+#define PCIE_DCTLSTS_FATAL_ERR_EN 0x00000004 /* Fatal ERR */ -+#define PCIE_DCTLSYS_UR_REQ_EN 0x00000008 /* UR ERR */ -+#define PCIE_DCTLSTS_RELAXED_ORDERING_EN 0x00000010 /* Enable relaxing ordering */ -+#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE 0x000000E0 /* Max payload mask */ -+#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE_S 5 -+#define PCIE_DCTLSTS_EXT_TAG_EN 0x00000100 /* Extended tag field */ -+#define PCIE_DCTLSTS_PHANTOM_FUNC_EN 0x00000200 /* Phantom Function Enable */ -+#define PCIE_DCTLSTS_AUX_PM_EN 0x00000400 /* AUX Power PM Enable */ -+#define PCIE_DCTLSTS_NO_SNOOP_EN 0x00000800 /* Enable no snoop, except root port*/ -+#define PCIE_DCTLSTS_MAX_READ_SIZE 0x00007000 /* Max Read Request size*/ -+#define PCIE_DCTLSTS_MAX_READ_SIZE_S 12 -+#define PCIE_DCTLSTS_CORRECTABLE_ERR 0x00010000 /* COR-ERR Detected */ -+#define PCIE_DCTLSTS_NONFATAL_ERR 0x00020000 /* Non-Fatal ERR Detected */ -+#define PCIE_DCTLSTS_FATAL_ER 0x00040000 /* Fatal ERR Detected */ -+#define PCIE_DCTLSTS_UNSUPPORTED_REQ 0x00080000 /* UR Detected */ -+#define PCIE_DCTLSTS_AUX_POWER 0x00100000 /* Aux Power Detected */ -+#define PCIE_DCTLSTS_TRANSACT_PENDING 0x00200000 /* Transaction pending */ -+ -+#define PCIE_DCTLSTS_ERR_EN (PCIE_DCTLSTS_CORRECTABLE_ERR_EN | \ -+ PCIE_DCTLSTS_NONFATAL_ERR_EN | PCIE_DCTLSTS_FATAL_ERR_EN | \ -+ PCIE_DCTLSYS_UR_REQ_EN) -+ -+/* Link Capability Register */ -+#define PCIE_LCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7C) -+#define PCIE_LCAP_MAX_LINK_SPEED 0x0000000F /* Max link speed, 0x1 by default */ -+#define PCIE_LCAP_MAX_LINK_SPEED_S 0 -+#define PCIE_LCAP_MAX_LENGTH_WIDTH 0x000003F0 /* Maxium Length Width */ -+#define PCIE_LCAP_MAX_LENGTH_WIDTH_S 4 -+#define PCIE_LCAP_ASPM_LEVEL 0x00000C00 /* Active State Link PM Support */ -+#define PCIE_LCAP_ASPM_LEVEL_S 10 -+#define PCIE_LCAP_L0S_EIXT_LATENCY 0x00007000 /* L0s Exit Latency */ -+#define PCIE_LCAP_L0S_EIXT_LATENCY_S 12 -+#define PCIE_LCAP_L1_EXIT_LATENCY 0x00038000 /* L1 Exit Latency */ -+#define PCIE_LCAP_L1_EXIT_LATENCY_S 15 -+#define PCIE_LCAP_CLK_PM 0x00040000 /* Clock Power Management */ -+#define PCIE_LCAP_SDER 0x00080000 /* Surprise Down Error Reporting */ -+#define PCIE_LCAP_DLL_ACTIVE_REPROT 0x00100000 /* Data Link Layer Active Reporting Capable */ -+#define PCIE_LCAP_PORT_NUM 0xFF0000000 /* Port number */ -+#define PCIE_LCAP_PORT_NUM_S 24 -+ -+/* Maximum Length width definition */ -+#define PCIE_MAX_LENGTH_WIDTH_RES 0x00 -+#define PCIE_MAX_LENGTH_WIDTH_X1 0x01 /* Default */ -+#define PCIE_MAX_LENGTH_WIDTH_X2 0x02 -+#define PCIE_MAX_LENGTH_WIDTH_X4 0x04 -+#define PCIE_MAX_LENGTH_WIDTH_X8 0x08 -+#define PCIE_MAX_LENGTH_WIDTH_X12 0x0C -+#define PCIE_MAX_LENGTH_WIDTH_X16 0x10 -+#define PCIE_MAX_LENGTH_WIDTH_X32 0x20 -+ -+/* Active State Link PM definition */ -+enum { -+ PCIE_ASPM_RES0 = 0, -+ PCIE_ASPM_L0S_ENTRY_SUPPORT, /* L0s */ -+ PCIE_ASPM_RES1, -+ PCIE_ASPM_L0S_L1_ENTRY_SUPPORT, /* L0s and L1, default */ -+}; -+ -+/* L0s Exit Latency definition */ -+enum { -+ PCIE_L0S_EIXT_LATENCY_L64NS = 0, /* < 64 ns */ -+ PCIE_L0S_EIXT_LATENCY_B64A128, /* > 64 ns < 128 ns */ -+ PCIE_L0S_EIXT_LATENCY_B128A256, /* > 128 ns < 256 ns */ -+ PCIE_L0S_EIXT_LATENCY_B256A512, /* > 256 ns < 512 ns */ -+ PCIE_L0S_EIXT_LATENCY_B512TO1U, /* > 512 ns < 1 us */ -+ PCIE_L0S_EIXT_LATENCY_B1A2U, /* > 1 us < 2 us */ -+ PCIE_L0S_EIXT_LATENCY_B2A4U, /* > 2 us < 4 us */ -+ PCIE_L0S_EIXT_LATENCY_M4US, /* > 4 us */ -+}; -+ -+/* L1 Exit Latency definition */ -+enum { -+ PCIE_L1_EXIT_LATENCY_L1US = 0, /* < 1 us */ -+ PCIE_L1_EXIT_LATENCY_B1A2, /* > 1 us < 2 us */ -+ PCIE_L1_EXIT_LATENCY_B2A4, /* > 2 us < 4 us */ -+ PCIE_L1_EXIT_LATENCY_B4A8, /* > 4 us < 8 us */ -+ PCIE_L1_EXIT_LATENCY_B8A16, /* > 8 us < 16 us */ -+ PCIE_L1_EXIT_LATENCY_B16A32, /* > 16 us < 32 us */ -+ PCIE_L1_EXIT_LATENCY_B32A64, /* > 32 us < 64 us */ -+ PCIE_L1_EXIT_LATENCY_M64US, /* > 64 us */ -+}; -+ -+/* Link Control and Status Register */ -+#define PCIE_LCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x80) -+#define PCIE_LCTLSTS_ASPM_ENABLE 0x00000003 /* Active State Link PM Control */ -+#define PCIE_LCTLSTS_ASPM_ENABLE_S 0 -+#define PCIE_LCTLSTS_RCB128 0x00000008 /* Read Completion Boundary 128*/ -+#define PCIE_LCTLSTS_LINK_DISABLE 0x00000010 /* Link Disable */ -+#define PCIE_LCTLSTS_RETRIAN_LINK 0x00000020 /* Retrain Link */ -+#define PCIE_LCTLSTS_COM_CLK_CFG 0x00000040 /* Common Clock Configuration */ -+#define PCIE_LCTLSTS_EXT_SYNC 0x00000080 /* Extended Synch */ -+#define PCIE_LCTLSTS_CLK_PM_EN 0x00000100 /* Enable Clock Powerm Management */ -+#define PCIE_LCTLSTS_LINK_SPEED 0x000F0000 /* Link Speed */ -+#define PCIE_LCTLSTS_LINK_SPEED_S 16 -+#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH 0x03F00000 /* Negotiated Link Width */ -+#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH_S 20 -+#define PCIE_LCTLSTS_RETRAIN_PENDING 0x08000000 /* Link training is ongoing */ -+#define PCIE_LCTLSTS_SLOT_CLK_CFG 0x10000000 /* Slot Clock Configuration */ -+#define PCIE_LCTLSTS_DLL_ACTIVE 0x20000000 /* Data Link Layer Active */ -+ -+/* Slot Capabilities Register */ -+#define PCIE_SLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x84) -+ -+/* Slot Capabilities */ -+#define PCIE_SLCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x88) -+ -+/* Root Control and Capability Register */ -+#define PCIE_RCTLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x8C) -+#define PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR 0x00000001 /* #SERR on COR-ERR */ -+#define PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR 0x00000002 /* #SERR on Non-Fatal ERR */ -+#define PCIE_RCTLCAP_SERR_ON_FATAL_ERR 0x00000004 /* #SERR on Fatal ERR */ -+#define PCIE_RCTLCAP_PME_INT_EN 0x00000008 /* PME Interrupt Enable */ -+#define PCIE_RCTLCAP_SERR_ENABLE (PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR | \ -+ PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR | PCIE_RCTLCAP_SERR_ON_FATAL_ERR) -+/* Root Status Register */ -+#define PCIE_RSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x90) -+#define PCIE_RSTS_PME_REQ_ID 0x0000FFFF /* PME Request ID */ -+#define PCIE_RSTS_PME_REQ_ID_S 0 -+#define PCIE_RSTS_PME_STATUS 0x00010000 /* PME Status */ -+#define PCIE_RSTS_PME_PENDING 0x00020000 /* PME Pending */ -+ -+/* PCI Express Enhanced Capability Header */ -+#define PCIE_ENHANCED_CAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x100) -+#define PCIE_ENHANCED_CAP_ID 0x0000FFFF /* PCI Express Extended Capability ID */ -+#define PCIE_ENHANCED_CAP_ID_S 0 -+#define PCIE_ENHANCED_CAP_VER 0x000F0000 /* Capability Version */ -+#define PCIE_ENHANCED_CAP_VER_S 16 -+#define PCIE_ENHANCED_CAP_NEXT_OFFSET 0xFFF00000 /* Next Capability Offset */ -+#define PCIE_ENHANCED_CAP_NEXT_OFFSET_S 20 -+ -+/* Uncorrectable Error Status Register */ -+#define PCIE_UES_R(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x104) -+#define PCIE_DATA_LINK_PROTOCOL_ERR 0x00000010 /* Data Link Protocol Error Status */ -+#define PCIE_SURPRISE_DOWN_ERROR 0x00000020 /* Surprise Down Error Status */ -+#define PCIE_POISONED_TLP 0x00001000 /* Poisoned TLP Status */ -+#define PCIE_FC_PROTOCOL_ERR 0x00002000 /* Flow Control Protocol Error Status */ -+#define PCIE_COMPLETION_TIMEOUT 0x00004000 /* Completion Timeout Status */ -+#define PCIE_COMPLETOR_ABORT 0x00008000 /* Completer Abort Error */ -+#define PCIE_UNEXPECTED_COMPLETION 0x00010000 /* Unexpected Completion Status */ -+#define PCIE_RECEIVER_OVERFLOW 0x00020000 /* Receive Overflow Status */ -+#define PCIE_MALFORNED_TLP 0x00040000 /* Malformed TLP Stauts */ -+#define PCIE_ECRC_ERR 0x00080000 /* ECRC Error Stauts */ -+#define PCIE_UR_REQ 0x00100000 /* Unsupported Request Error Status */ -+#define PCIE_ALL_UNCORRECTABLE_ERR (PCIE_DATA_LINK_PROTOCOL_ERR | PCIE_SURPRISE_DOWN_ERROR | \ -+ PCIE_POISONED_TLP | PCIE_FC_PROTOCOL_ERR | PCIE_COMPLETION_TIMEOUT | \ -+ PCIE_COMPLETOR_ABORT | PCIE_UNEXPECTED_COMPLETION | PCIE_RECEIVER_OVERFLOW |\ -+ PCIE_MALFORNED_TLP | PCIE_ECRC_ERR | PCIE_UR_REQ) -+ -+/* Uncorrectable Error Mask Register, Mask means no report */ -+#define PCIE_UEMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x108) -+ -+/* Uncorrectable Error Severity Register */ -+#define PCIE_UESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10C) -+ -+/* Correctable Error Status Register */ -+#define PCIE_CESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x110) -+#define PCIE_RX_ERR 0x00000001 /* Receive Error Status */ -+#define PCIE_BAD_TLP 0x00000040 /* Bad TLP Status */ -+#define PCIE_BAD_DLLP 0x00000080 /* Bad DLLP Status */ -+#define PCIE_REPLAY_NUM_ROLLOVER 0x00000100 /* Replay Number Rollover Status */ -+#define PCIE_REPLAY_TIMER_TIMEOUT_ERR 0x00001000 /* Reply Timer Timeout Status */ -+#define PCIE_ADVISORY_NONFTAL_ERR 0x00002000 /* Advisory Non-Fatal Error Status */ -+#define PCIE_CORRECTABLE_ERR (PCIE_RX_ERR | PCIE_BAD_TLP | PCIE_BAD_DLLP | PCIE_REPLAY_NUM_ROLLOVER |\ -+ PCIE_REPLAY_TIMER_TIMEOUT_ERR | PCIE_ADVISORY_NONFTAL_ERR) -+ -+/* Correctable Error Mask Register */ -+#define PCIE_CEMR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x114) -+ -+/* Advanced Error Capabilities and Control Register */ -+#define PCIE_AECCR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x118) -+#define PCIE_AECCR_FIRST_ERR_PTR 0x0000001F /* First Error Pointer */ -+#define PCIE_AECCR_FIRST_ERR_PTR_S 0 -+#define PCIE_AECCR_ECRC_GEN_CAP 0x00000020 /* ECRC Generation Capable */ -+#define PCIE_AECCR_ECRC_GEN_EN 0x00000040 /* ECRC Generation Enable */ -+#define PCIE_AECCR_ECRC_CHECK_CAP 0x00000080 /* ECRC Check Capable */ -+#define PCIE_AECCR_ECRC_CHECK_EN 0x00000100 /* ECRC Check Enable */ -+ -+/* Header Log Register 1 */ -+#define PCIE_HLR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x11C) -+ -+/* Header Log Register 2 */ -+#define PCIE_HLR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x120) -+ -+/* Header Log Register 3 */ -+#define PCIE_HLR3(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x124) -+ -+/* Header Log Register 4 */ -+#define PCIE_HLR4(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x128) -+ -+/* Root Error Command Register */ -+#define PCIE_RECR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x12C) -+#define PCIE_RECR_CORRECTABLE_ERR_REPORT_EN 0x00000001 /* COR-ERR */ -+#define PCIE_RECR_NONFATAL_ERR_REPORT_EN 0x00000002 /* Non-Fatal ERR */ -+#define PCIE_RECR_FATAL_ERR_REPORT_EN 0x00000004 /* Fatal ERR */ -+#define PCIE_RECR_ERR_REPORT_EN (PCIE_RECR_CORRECTABLE_ERR_REPORT_EN | \ -+ PCIE_RECR_NONFATAL_ERR_REPORT_EN | PCIE_RECR_FATAL_ERR_REPORT_EN) -+ -+/* Root Error Status Register */ -+#define PCIE_RESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x130) -+#define PCIE_RESR_CORRECTABLE_ERR 0x00000001 /* COR-ERR Receveid */ -+#define PCIE_RESR_MULTI_CORRECTABLE_ERR 0x00000002 /* Multiple COR-ERR Received */ -+#define PCIE_RESR_FATAL_NOFATAL_ERR 0x00000004 /* ERR Fatal/Non-Fatal Received */ -+#define PCIE_RESR_MULTI_FATAL_NOFATAL_ERR 0x00000008 /* Multiple ERR Fatal/Non-Fatal Received */ -+#define PCIE_RESR_FIRST_UNCORRECTABLE_FATAL_ERR 0x00000010 /* First UN-COR Fatal */ -+#define PCIR_RESR_NON_FATAL_ERR 0x00000020 /* Non-Fatal Error Message Received */ -+#define PCIE_RESR_FATAL_ERR 0x00000040 /* Fatal Message Received */ -+#define PCIE_RESR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ -+#define PCIE_RESR_AER_INT_MSG_NUM_S 27 -+ -+/* Error Source Indentification Register */ -+#define PCIE_ESIR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x134) -+#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID 0x0000FFFF -+#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID_S 0 -+#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID 0xFFFF0000 -+#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID_S 16 -+ -+/* VC Enhanced Capability Header */ -+#define PCIE_VC_ECH(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x140) -+ -+/* Port VC Capability Register */ -+#define PCIE_PVC1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x144) -+#define PCIE_PVC1_EXT_VC_CNT 0x00000007 /* Extended VC Count */ -+#define PCIE_PVC1_EXT_VC_CNT_S 0 -+#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT 0x00000070 /* Low Priority Extended VC Count */ -+#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT_S 4 -+#define PCIE_PVC1_REF_CLK 0x00000300 /* Reference Clock */ -+#define PCIE_PVC1_REF_CLK_S 8 -+#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE 0x00000C00 /* Port Arbitration Table Entry Size */ -+#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE_S 10 -+ -+/* Extended Virtual Channel Count Defintion */ -+#define PCIE_EXT_VC_CNT_MIN 0 -+#define PCIE_EXT_VC_CNT_MAX 7 -+ -+/* Port Arbitration Table Entry Size Definition */ -+enum { -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S1BIT = 0, -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S2BIT, -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S4BIT, -+ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S8BIT, -+}; -+ -+/* Port VC Capability Register 2 */ -+#define PCIE_PVC2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x148) -+#define PCIE_PVC2_VC_ARB_16P_FIXED_WRR 0x00000001 /* HW Fixed arbitration, 16 phase WRR */ -+#define PCIE_PVC2_VC_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ -+#define PCIE_PVC2_VC_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ -+#define PCIE_PVC2_VC_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ -+#define PCIE_PVC2_VC_ARB_WRR 0x0000000F -+#define PCIE_PVC2_VC_ARB_TAB_OFFSET 0xFF000000 /* VC arbitration table offset, not support */ -+#define PCIE_PVC2_VC_ARB_TAB_OFFSET_S 24 -+ -+/* Port VC Control and Status Register */ -+#define PCIE_PVCCRSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14C) -+#define PCIE_PVCCRSR_LOAD_VC_ARB_TAB 0x00000001 /* Load VC Arbitration Table */ -+#define PCIE_PVCCRSR_VC_ARB_SEL 0x0000000E /* VC Arbitration Select */ -+#define PCIE_PVCCRSR_VC_ARB_SEL_S 1 -+#define PCIE_PVCCRSR_VC_ARB_TAB_STATUS 0x00010000 /* Arbitration Status */ -+ -+/* VC0 Resource Capability Register */ -+#define PCIE_VC0_RC(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x150) -+#define PCIE_VC0_RC_PORT_ARB_HW_FIXED 0x00000001 /* HW Fixed arbitration */ -+#define PCIE_VC0_RC_PORT_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_TM_128P_WRR 0x00000010 /* Time-based 128 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB_TM_256P_WRR 0x00000020 /* Time-based 256 phase WRR */ -+#define PCIE_VC0_RC_PORT_ARB (PCIE_VC0_RC_PORT_ARB_HW_FIXED | PCIE_VC0_RC_PORT_ARB_32P_WRR |\ -+ PCIE_VC0_RC_PORT_ARB_64P_WRR | PCIE_VC0_RC_PORT_ARB_128P_WRR | \ -+ PCIE_VC0_RC_PORT_ARB_TM_128P_WRR | PCIE_VC0_RC_PORT_ARB_TM_256P_WRR) -+ -+#define PCIE_VC0_RC_REJECT_SNOOP 0x00008000 /* Reject Snoop Transactioin */ -+#define PCIE_VC0_RC_MAX_TIMESLOTS 0x007F0000 /* Maximum time Slots */ -+#define PCIE_VC0_RC_MAX_TIMESLOTS_S 16 -+#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET 0xFF000000 /* Port Arbitration Table Offset */ -+#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET_S 24 -+ -+/* VC0 Resource Control Register */ -+#define PCIE_VC0_RC0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x154) -+#define PCIE_VC0_RC0_TVM0 0x00000001 /* TC0 and VC0 */ -+#define PCIE_VC0_RC0_TVM1 0x00000002 /* TC1 and VC1 */ -+#define PCIE_VC0_RC0_TVM2 0x00000004 /* TC2 and VC2 */ -+#define PCIE_VC0_RC0_TVM3 0x00000008 /* TC3 and VC3 */ -+#define PCIE_VC0_RC0_TVM4 0x00000010 /* TC4 and VC4 */ -+#define PCIE_VC0_RC0_TVM5 0x00000020 /* TC5 and VC5 */ -+#define PCIE_VC0_RC0_TVM6 0x00000040 /* TC6 and VC6 */ -+#define PCIE_VC0_RC0_TVM7 0x00000080 /* TC7 and VC7 */ -+#define PCIE_VC0_RC0_TC_VC 0x000000FF /* TC/VC mask */ -+ -+#define PCIE_VC0_RC0_LOAD_PORT_ARB_TAB 0x00010000 /* Load Port Arbitration Table */ -+#define PCIE_VC0_RC0_PORT_ARB_SEL 0x000E0000 /* Port Arbitration Select */ -+#define PCIE_VC0_RC0_PORT_ARB_SEL_S 17 -+#define PCIE_VC0_RC0_VC_ID 0x07000000 /* VC ID */ -+#define PCIE_VC0_RC0_VC_ID_S 24 -+#define PCIE_VC0_RC0_VC_EN 0x80000000 /* VC Enable */ -+ -+/* VC0 Resource Status Register */ -+#define PCIE_VC0_RSR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x158) -+#define PCIE_VC0_RSR0_PORT_ARB_TAB_STATUS 0x00010000 /* Port Arbitration Table Status,not used */ -+#define PCIE_VC0_RSR0_VC_NEG_PENDING 0x00020000 /* VC Negotiation Pending */ -+ -+/* Ack Latency Timer and Replay Timer Register */ -+#define PCIE_ALTRT(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x700) -+#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT 0x0000FFFF /* Round Trip Latency Time Limit */ -+#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT_S 0 -+#define PCIE_ALTRT_REPLAY_TIME_LIMIT 0xFFFF0000 /* Replay Time Limit */ -+#define PCIE_ALTRT_REPLAY_TIME_LIMIT_S 16 -+ -+/* Other Message Register */ -+#define PCIE_OMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x704) -+ -+/* Port Force Link Register */ -+#define PCIE_PFLR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x708) -+#define PCIE_PFLR_LINK_NUM 0x000000FF /* Link Number */ -+#define PCIE_PFLR_LINK_NUM_S 0 -+#define PCIE_PFLR_FORCE_LINK 0x00008000 /* Force link */ -+#define PCIE_PFLR_LINK_STATE 0x003F0000 /* Link State */ -+#define PCIE_PFLR_LINK_STATE_S 16 -+#define PCIE_PFLR_LOW_POWER_ENTRY_CNT 0xFF000000 /* Low Power Entrance Count, only for EP */ -+#define PCIE_PFLR_LOW_POWER_ENTRY_CNT_S 24 -+ -+/* Ack Frequency Register */ -+#define PCIE_AFR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70C) -+#define PCIE_AFR_AF 0x000000FF /* Ack Frequency */ -+#define PCIE_AFR_AF_S 0 -+#define PCIE_AFR_FTS_NUM 0x0000FF00 /* The number of Fast Training Sequence from L0S to L0 */ -+#define PCIE_AFR_FTS_NUM_S 8 -+#define PCIE_AFR_COM_FTS_NUM 0x00FF0000 /* N_FTS; when common clock is used*/ -+#define PCIE_AFR_COM_FTS_NUM_S 16 -+#define PCIE_AFR_L0S_ENTRY_LATENCY 0x07000000 /* L0s Entrance Latency */ -+#define PCIE_AFR_L0S_ENTRY_LATENCY_S 24 -+#define PCIE_AFR_L1_ENTRY_LATENCY 0x38000000 /* L1 Entrance Latency */ -+#define PCIE_AFR_L1_ENTRY_LATENCY_S 27 -+#define PCIE_AFR_FTS_NUM_DEFAULT 32 -+#define PCIE_AFR_L0S_ENTRY_LATENCY_DEFAULT 7 -+#define PCIE_AFR_L1_ENTRY_LATENCY_DEFAULT 5 -+ -+/* Port Link Control Register */ -+#define PCIE_PLCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x710) -+#define PCIE_PLCR_OTHER_MSG_REQ 0x00000001 /* Other Message Request */ -+#define PCIE_PLCR_SCRAMBLE_DISABLE 0x00000002 /* Scramble Disable */ -+#define PCIE_PLCR_LOOPBACK_EN 0x00000004 /* Loopback Enable */ -+#define PCIE_PLCR_LTSSM_HOT_RST 0x00000008 /* Force LTSSM to the hot reset */ -+#define PCIE_PLCR_DLL_LINK_EN 0x00000020 /* Enable Link initialization */ -+#define PCIE_PLCR_FAST_LINK_SIM_EN 0x00000080 /* Sets all internal timers to fast mode for simulation purposes */ -+#define PCIE_PLCR_LINK_MODE 0x003F0000 /* Link Mode Enable Mask */ -+#define PCIE_PLCR_LINK_MODE_S 16 -+#define PCIE_PLCR_CORRUPTED_CRC_EN 0x02000000 /* Enabled Corrupt CRC */ -+ -+/* Lane Skew Register */ -+#define PCIE_LSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x714) -+#define PCIE_LSR_LANE_SKEW_NUM 0x00FFFFFF /* Insert Lane Skew for Transmit, not applicable */ -+#define PCIE_LSR_LANE_SKEW_NUM_S 0 -+#define PCIE_LSR_FC_DISABLE 0x01000000 /* Disable of Flow Control */ -+#define PCIE_LSR_ACKNAK_DISABLE 0x02000000 /* Disable of Ack/Nak */ -+#define PCIE_LSR_LANE_DESKEW_DISABLE 0x80000000 /* Disable of Lane-to-Lane Skew */ -+ -+/* Symbol Number Register */ -+#define PCIE_SNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x718) -+#define PCIE_SNR_TS 0x0000000F /* Number of TS Symbol */ -+#define PCIE_SNR_TS_S 0 -+#define PCIE_SNR_SKP 0x00000700 /* Number of SKP Symbol */ -+#define PCIE_SNR_SKP_S 8 -+#define PCIE_SNR_REPLAY_TIMER 0x0007C000 /* Timer Modifier for Replay Timer */ -+#define PCIE_SNR_REPLAY_TIMER_S 14 -+#define PCIE_SNR_ACKNAK_LATENCY_TIMER 0x00F80000 /* Timer Modifier for Ack/Nak Latency Timer */ -+#define PCIE_SNR_ACKNAK_LATENCY_TIMER_S 19 -+#define PCIE_SNR_FC_TIMER 0x1F000000 /* Timer Modifier for Flow Control Watchdog Timer */ -+#define PCIE_SNR_FC_TIMER_S 28 -+ -+/* Symbol Timer Register and Filter Mask Register 1 */ -+#define PCIE_STRFMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x71C) -+#define PCIE_STRFMR_SKP_INTERVAL 0x000007FF /* SKP lnterval Value */ -+#define PCIE_STRFMR_SKP_INTERVAL_S 0 -+#define PCIE_STRFMR_FC_WDT_DISABLE 0x00008000 /* Disable of FC Watchdog Timer */ -+#define PCIE_STRFMR_TLP_FUNC_MISMATCH_OK 0x00010000 /* Mask Function Mismatch Filtering for Incoming Requests */ -+#define PCIE_STRFMR_POISONED_TLP_OK 0x00020000 /* Mask Poisoned TLP Filtering */ -+#define PCIE_STRFMR_BAR_MATCH_OK 0x00040000 /* Mask BAR Match Filtering */ -+#define PCIE_STRFMR_TYPE1_CFG_REQ_OK 0x00080000 /* Mask Type 1 Configuration Request Filtering */ -+#define PCIE_STRFMR_LOCKED_REQ_OK 0x00100000 /* Mask Locked Request Filtering */ -+#define PCIE_STRFMR_CPL_TAG_ERR_RULES_OK 0x00200000 /* Mask Tag Error Rules for Received Completions */ -+#define PCIE_STRFMR_CPL_REQUESTOR_ID_MISMATCH_OK 0x00400000 /* Mask Requester ID Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_FUNC_MISMATCH_OK 0x00800000 /* Mask Function Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_TC_MISMATCH_OK 0x01000000 /* Mask Traffic Class Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_ATTR_MISMATCH_OK 0x02000000 /* Mask Attribute Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_CPL_LENGTH_MISMATCH_OK 0x04000000 /* Mask Length Mismatch Error for Received Completions */ -+#define PCIE_STRFMR_TLP_ECRC_ERR_OK 0x08000000 /* Mask ECRC Error Filtering */ -+#define PCIE_STRFMR_CPL_TLP_ECRC_OK 0x10000000 /* Mask ECRC Error Filtering for Completions */ -+#define PCIE_STRFMR_RX_TLP_MSG_NO_DROP 0x20000000 /* Send Message TLPs */ -+#define PCIE_STRFMR_RX_IO_TRANS_ENABLE 0x40000000 /* Mask Filtering of received I/O Requests */ -+#define PCIE_STRFMR_RX_CFG_TRANS_ENABLE 0x80000000 /* Mask Filtering of Received Configuration Requests */ -+ -+#define PCIE_DEF_SKP_INTERVAL 700 /* 1180 ~1538 , 125MHz * 2, 250MHz * 1 */ -+ -+/* Filter Masker Register 2 */ -+#define PCIE_FMR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x720) -+#define PCIE_FMR2_VENDOR_MSG0_PASSED_TO_TRGT1 0x00000001 /* Mask RADM Filtering and Error Handling Rules */ -+#define PCIE_FMR2_VENDOR_MSG1_PASSED_TO_TRGT1 0x00000002 /* Mask RADM Filtering and Error Handling Rules */ -+ -+/* Debug Register 0 */ -+#define PCIE_DBR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x728) -+ -+/* Debug Register 1 */ -+#define PCIE_DBR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x72C) -+ -+/* Transmit Posted FC Credit Status Register */ -+#define PCIE_TPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x730) -+#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS 0x00000FFF /* Transmit Posted Data FC Credits */ -+#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS_S 0 -+#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS 0x000FF000 /* Transmit Posted Header FC Credits */ -+#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS_S 12 -+ -+/* Transmit Non-Posted FC Credit Status */ -+#define PCIE_TNPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x734) -+#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS 0x00000FFF /* Transmit Non-Posted Data FC Credits */ -+#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS_S 0 -+#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS 0x000FF000 /* Transmit Non-Posted Header FC Credits */ -+#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS_S 12 -+ -+/* Transmit Complete FC Credit Status Register */ -+#define PCIE_TCFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x738) -+#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS 0x00000FFF /* Transmit Completion Data FC Credits */ -+#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS_S 0 -+#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS 0x000FF000 /* Transmit Completion Header FC Credits */ -+#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS_S 12 -+ -+/* Queue Status Register */ -+#define PCIE_QSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x73C) -+#define PCIE_QSR_WAIT_UPDATE_FC_DLL 0x00000001 /* Received TLP FC Credits Not Returned */ -+#define PCIE_QSR_TX_RETRY_BUF_NOT_EMPTY 0x00000002 /* Transmit Retry Buffer Not Empty */ -+#define PCIE_QSR_RX_QUEUE_NOT_EMPTY 0x00000004 /* Received Queue Not Empty */ -+ -+/* VC Transmit Arbitration Register 1 */ -+#define PCIE_VCTAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x740) -+#define PCIE_VCTAR1_WRR_WEIGHT_VC0 0x000000FF /* WRR Weight for VC0 */ -+#define PCIE_VCTAR1_WRR_WEIGHT_VC1 0x0000FF00 /* WRR Weight for VC1 */ -+#define PCIE_VCTAR1_WRR_WEIGHT_VC2 0x00FF0000 /* WRR Weight for VC2 */ -+#define PCIE_VCTAR1_WRR_WEIGHT_VC3 0xFF000000 /* WRR Weight for VC3 */ -+ -+/* VC Transmit Arbitration Register 2 */ -+#define PCIE_VCTAR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x744) -+#define PCIE_VCTAR2_WRR_WEIGHT_VC4 0x000000FF /* WRR Weight for VC4 */ -+#define PCIE_VCTAR2_WRR_WEIGHT_VC5 0x0000FF00 /* WRR Weight for VC5 */ -+#define PCIE_VCTAR2_WRR_WEIGHT_VC6 0x00FF0000 /* WRR Weight for VC6 */ -+#define PCIE_VCTAR2_WRR_WEIGHT_VC7 0xFF000000 /* WRR Weight for VC7 */ -+ -+/* VC0 Posted Receive Queue Control Register */ -+#define PCIE_VC0_PRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x748) -+#define PCIE_VC0_PRQCR_P_DATA_CREDITS 0x00000FFF /* VC0 Posted Data Credits */ -+#define PCIE_VC0_PRQCR_P_DATA_CREDITS_S 0 -+#define PCIE_VC0_PRQCR_P_HDR_CREDITS 0x000FF000 /* VC0 Posted Header Credits */ -+#define PCIE_VC0_PRQCR_P_HDR_CREDITS_S 12 -+#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE 0x00E00000 /* VC0 Posted TLP Queue Mode */ -+#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE_S 20 -+#define PCIE_VC0_PRQCR_TLP_RELAX_ORDER 0x40000000 /* TLP Type Ordering for VC0 */ -+#define PCIE_VC0_PRQCR_VC_STRICT_ORDER 0x80000000 /* VC0 Ordering for Receive Queues */ -+ -+/* VC0 Non-Posted Receive Queue Control */ -+#define PCIE_VC0_NPRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74C) -+#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS 0x00000FFF /* VC0 Non-Posted Data Credits */ -+#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS_S 0 -+#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS 0x000FF000 /* VC0 Non-Posted Header Credits */ -+#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS_S 12 -+#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE 0x00E00000 /* VC0 Non-Posted TLP Queue Mode */ -+#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE_S 20 -+ -+/* VC0 Completion Receive Queue Control */ -+#define PCIE_VC0_CRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x750) -+#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS 0x00000FFF /* VC0 Completion TLP Queue Mode */ -+#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS_S 0 -+#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS 0x000FF000 /* VC0 Completion Header Credits */ -+#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS_S 12 -+#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE 0x00E00000 /* VC0 Completion Data Credits */ -+#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE_S 21 -+ -+/* Applicable to the above three registers */ -+enum { -+ PCIE_VC0_TLP_QUEUE_MODE_STORE_FORWARD = 1, -+ PCIE_VC0_TLP_QUEUE_MODE_CUT_THROUGH = 2, -+ PCIE_VC0_TLP_QUEUE_MODE_BYPASS = 4, -+}; -+ -+/* VC0 Posted Buffer Depth Register */ -+#define PCIE_VC0_PBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7A8) -+#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Posted Data Queue Depth */ -+#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES_S 0 -+#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Posted Header Queue Depth */ -+#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES_S 16 -+ -+/* VC0 Non-Posted Buffer Depth Register */ -+#define PCIE_VC0_NPBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7AC) -+#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Non-Posted Data Queue Depth */ -+#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES_S 0 -+#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Non-Posted Header Queue Depth */ -+#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES_S 16 -+ -+/* VC0 Completion Buffer Depth Register */ -+#define PCIE_VC0_CBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7B0) -+#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES 0x00003FFF /* C0 Completion Data Queue Depth */ -+#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES_S 0 -+#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Completion Header Queue Depth */ -+#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES_S 16 -+ -+/* PHY Status Register, all zeros in VR9 */ -+#define PCIE_PHYSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x810) -+ -+/* PHY Control Register, all zeros in VR9 */ -+#define PCIE_PHYCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x814) -+ -+/* -+ * PCIe PDI PHY register definition, suppose all the following -+ * stuff is confidential. -+ * XXX, detailed bit definition -+ */ -+#define PCIE_PHY_PLL_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x22 << 1)) -+#define PCIE_PHY_PLL_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x23 << 1)) -+#define PCIE_PHY_PLL_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x24 << 1)) -+#define PCIE_PHY_PLL_CTRL4(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x25 << 1)) -+#define PCIE_PHY_PLL_CTRL5(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x26 << 1)) -+#define PCIE_PHY_PLL_CTRL6(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x27 << 1)) -+#define PCIE_PHY_PLL_CTRL7(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x28 << 1)) -+#define PCIE_PHY_PLL_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x29 << 1)) -+#define PCIE_PHY_PLL_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2A << 1)) -+#define PCIE_PHY_PLL_A_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2B << 1)) -+#define PCIE_PHY_PLL_STATUS(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2C << 1)) -+ -+#define PCIE_PHY_TX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x30 << 1)) -+#define PCIE_PHY_TX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x31 << 1)) -+#define PCIE_PHY_TX1_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x32 << 1)) -+#define PCIE_PHY_TX1_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x33 << 1)) -+#define PCIE_PHY_TX1_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x34 << 1)) -+#define PCIE_PHY_TX1_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x35 << 1)) -+#define PCIE_PHY_TX1_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x36 << 1)) -+#define PCIE_PHY_TX1_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x37 << 1)) -+ -+#define PCIE_PHY_TX2_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x38 << 1)) -+#define PCIE_PHY_TX2_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x39 << 1)) -+#define PCIE_PHY_TX2_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3B << 1)) -+#define PCIE_PHY_TX2_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3C << 1)) -+#define PCIE_PHY_TX2_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3D << 1)) -+#define PCIE_PHY_TX2_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3E << 1)) -+#define PCIE_PHY_TX2_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3F << 1)) -+ -+#define PCIE_PHY_RX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x50 << 1)) -+#define PCIE_PHY_RX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x51 << 1)) -+#define PCIE_PHY_RX1_CDR(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x52 << 1)) -+#define PCIE_PHY_RX1_EI(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x53 << 1)) -+#define PCIE_PHY_RX1_A_CTRL(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x55 << 1)) -+ -+/* Interrupt related stuff */ -+#define PCIE_LEGACY_DISABLE 0 -+#define PCIE_LEGACY_INTA 1 -+#define PCIE_LEGACY_INTB 2 -+#define PCIE_LEGACY_INTC 3 -+#define PCIE_LEGACY_INTD 4 -+#define PCIE_LEGACY_INT_MAX PCIE_LEGACY_INTD -+ -+#define PCIE_IRQ_LOCK(lock) do { \ -+ unsigned long flags; \ -+ spin_lock_irqsave(&(lock), flags); -+#define PCIE_IRQ_UNLOCK(lock) \ -+ spin_unlock_irqrestore(&(lock), flags); \ -+} while (0) -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+#define IRQF_SHARED SA_SHIRQ -+#endif -+ -+#define PCIE_MSG_MSI 0x00000001 -+#define PCIE_MSG_ISR 0x00000002 -+#define PCIE_MSG_FIXUP 0x00000004 -+#define PCIE_MSG_READ_CFG 0x00000008 -+#define PCIE_MSG_WRITE_CFG 0x00000010 -+#define PCIE_MSG_CFG (PCIE_MSG_READ_CFG | PCIE_MSG_WRITE_CFG) -+#define PCIE_MSG_REG 0x00000020 -+#define PCIE_MSG_INIT 0x00000040 -+#define PCIE_MSG_ERR 0x00000080 -+#define PCIE_MSG_PHY 0x00000100 -+#define PCIE_MSG_ANY 0x000001ff -+ -+#define IFX_PCIE_PORT0 0 -+#define IFX_PCIE_PORT1 1 -+ -+#ifdef CONFIG_IFX_PCIE_2ND_CORE -+#define IFX_PCIE_CORE_NR 2 -+#else -+#define IFX_PCIE_CORE_NR 1 -+#endif -+ -+//#define IFX_PCIE_ERROR_INT -+ -+//#define IFX_PCIE_DBG -+ -+#if defined(IFX_PCIE_DBG) -+#define IFX_PCIE_PRINT(_m, _fmt, args...) do { \ -+ if (g_pcie_debug_flag & (_m)) { \ -+ ifx_pcie_debug((_fmt), ##args); \ -+ } \ -+} while (0) -+ -+#define INLINE -+#else -+#define IFX_PCIE_PRINT(_m, _fmt, args...) \ -+ do {} while(0) -+#define INLINE inline -+#endif -+ -+struct ifx_pci_controller { -+ struct pci_controller pcic; -+ -+ /* RC specific, per host bus information */ -+ u32 port; /* Port index, 0 -- 1st core, 1 -- 2nd core */ -+}; -+ -+typedef struct ifx_pcie_ir_irq { -+ const unsigned int irq; -+ const char name[16]; -+}ifx_pcie_ir_irq_t; -+ -+typedef struct ifx_pcie_legacy_irq{ -+ const u32 irq_bit; -+ const int irq; -+}ifx_pcie_legacy_irq_t; -+ -+typedef struct ifx_pcie_irq { -+ ifx_pcie_ir_irq_t ir_irq; -+ ifx_pcie_legacy_irq_t legacy_irq[PCIE_LEGACY_INT_MAX]; -+}ifx_pcie_irq_t; -+ -+extern u32 g_pcie_debug_flag; -+extern void ifx_pcie_debug(const char *fmt, ...); -+extern void pcie_phy_clock_mode_setup(int pcie_port); -+extern void pcie_msi_pic_init(int pcie_port); -+extern u32 ifx_pcie_bus_enum_read_hack(int where, u32 value); -+extern u32 ifx_pcie_bus_enum_write_hack(int where, u32 value); -+ -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define IFX_PCIE_GPIO_RESET 38 -+#define IFX_REG_R32 ltq_r32 -+#define IFX_REG_W32 ltq_w32 -+#define CONFIG_IFX_PCIE_HW_SWAP -+#define IFX_RCU_AHB_ENDIAN ((volatile u32*)(IFX_RCU + 0x004C)) -+#define IFX_RCU_RST_REQ ((volatile u32*)(IFX_RCU + 0x0010)) -+#define IFX_RCU_AHB_BE_PCIE_PDI 0x00000080 /* Configure PCIE PDI module in big endian*/ -+ -+#define IFX_RCU (KSEG1 | 0x1F203000) -+#define IFX_RCU_AHB_BE_PCIE_M 0x00000001 /* Configure AHB master port that connects to PCIe RC in big endian */ -+#define IFX_RCU_AHB_BE_PCIE_S 0x00000010 /* Configure AHB slave port that connects to PCIe RC in little endian */ -+#define IFX_RCU_AHB_BE_XBAR_M 0x00000002 /* Configure AHB master port that connects to XBAR in big endian */ -+#define CONFIG_IFX_PCIE_PHY_36MHZ_MODE -+ -+#define IFX_PMU1_MODULE_PCIE_PHY (0) -+#define IFX_PMU1_MODULE_PCIE_CTRL (1) -+#define IFX_PMU1_MODULE_PDI (4) -+#define IFX_PMU1_MODULE_MSI (5) -+ -+#define IFX_PMU_MODULE_PCIE_L0_CLK (31) -+ -+ -+static inline void pcie_ep_gpio_rst_init(int pcie_port) -+{ -+} -+ -+static inline void pcie_ahb_pmu_setup(void) -+{ -+ struct clk *clk; -+ clk = clk_get_sys("ltq_pcie", "ahb"); -+ clk_enable(clk); -+ //ltq_pmu_enable(PMU_AHBM | PMU_AHBS); -+} -+ -+static inline void pcie_rcu_endian_setup(int pcie_port) -+{ -+ u32 reg; -+ -+ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); -+#ifdef CONFIG_IFX_PCIE_HW_SWAP -+ reg |= IFX_RCU_AHB_BE_PCIE_M; -+ reg |= IFX_RCU_AHB_BE_PCIE_S; -+ reg &= ~IFX_RCU_AHB_BE_XBAR_M; -+#else -+ reg |= IFX_RCU_AHB_BE_PCIE_M; -+ reg &= ~IFX_RCU_AHB_BE_PCIE_S; -+ reg &= ~IFX_RCU_AHB_BE_XBAR_M; -+#endif /* CONFIG_IFX_PCIE_HW_SWAP */ -+ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); -+ IFX_PCIE_PRINT(PCIE_MSG_REG, "%s IFX_RCU_AHB_ENDIAN: 0x%08x\n", __func__, IFX_REG_R32(IFX_RCU_AHB_ENDIAN)); -+} -+ -+static inline void pcie_phy_pmu_enable(int pcie_port) -+{ -+ struct clk *clk; -+ clk = clk_get_sys("ltq_pcie", "phy"); -+ clk_enable(clk); -+ //ltq_pmu1_enable(1<PCIe and PDI endianness */ -+ reg |= IFX_RCU_AHB_BE_PCIE_PDI; -+ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); -+} -+ -+static inline void pcie_pdi_pmu_enable(int pcie_port) -+{ -+ struct clk *clk; -+ clk = clk_get_sys("ltq_pcie", "pdi"); -+ clk_enable(clk); -+ //ltq_pmu1_enable(1< 1) { -+ tbus_number -= pcibios_1st_host_bus_nr(); -+ } -+#endif /* CONFIG_PCI_LANTIQ */ -+ return tbus_number; -+} -+ -+static inline u32 -+ifx_pcie_bus_enum_hack(struct pci_bus *bus, u32 devfn, int where, u32 value, int pcie_port, int read) -+{ -+ struct pci_dev *pdev; -+ u32 tvalue = value; -+ -+ /* Sanity check */ -+ pdev = pci_get_slot(bus, devfn); -+ if (pdev == NULL) { -+ return tvalue; -+ } -+ -+ /* Only care about PCI bridge */ -+ if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { -+ return tvalue; -+ } -+ -+ if (read) { /* Read hack */ -+ #ifdef CONFIG_PCI_LANTIQ -+ if (pcibios_host_nr() > 1) { -+ tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue); -+ } -+ #endif /* CONFIG_PCI_LANTIQ */ -+ } -+ else { /* Write hack */ -+ #ifdef CONFIG_PCI_LANTIQ -+ if (pcibios_host_nr() > 1) { -+ tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue); -+ } -+ #endif -+ } -+ return tvalue; -+} -+ -+#endif /* IFXMIPS_PCIE_VR9_H */ -+ ---- a/drivers/pci/pcie/aer/Kconfig -+++ b/drivers/pci/pcie/aer/Kconfig -@@ -19,6 +19,7 @@ config PCIEAER - config PCIE_ECRC - bool "PCI Express ECRC settings control" - depends on PCIEAER -+ default n - help - Used to override firmware/bios settings for PCI Express ECRC - (transaction layer end-to-end CRC checking). ---- a/include/linux/pci.h -+++ b/include/linux/pci.h -@@ -1250,6 +1250,8 @@ void pci_walk_bus(struct pci_bus *top, i - void *userdata); - int pci_cfg_space_size(struct pci_dev *dev); - unsigned char pci_bus_max_busnr(struct pci_bus *bus); -+int pcibios_host_nr(void); -+int pcibios_1st_host_bus_nr(void); - void pci_setup_bridge(struct pci_bus *bus); - resource_size_t pcibios_window_alignment(struct pci_bus *bus, - unsigned long type); ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -1056,6 +1056,12 @@ - #define PCI_DEVICE_ID_SGI_LITHIUM 0x1002 - #define PCI_DEVICE_ID_SGI_IOC4 0x100a - -+#define PCI_VENDOR_ID_INFINEON 0x15D1 -+#define PCI_DEVICE_ID_INFINEON_DANUBE 0x000F -+#define PCI_DEVICE_ID_INFINEON_PCIE 0x0011 -+#define PCI_VENDOR_ID_LANTIQ 0x1BEF -+#define PCI_DEVICE_ID_LANTIQ_PCIE 0x0011 -+ - #define PCI_VENDOR_ID_WINBOND 0x10ad - #define PCI_DEVICE_ID_WINBOND_82C105 0x0105 - #define PCI_DEVICE_ID_WINBOND_83C553 0x0565 diff --git a/target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch b/target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch deleted file mode 100644 index c32b3d6bb..000000000 --- a/target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5b9b2b5284f81941972105b13337c58489ea8fca Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Thu, 28 Jun 2018 21:57:40 +0200 -Subject: [PATCH] gpio: stp-xway: Implement get callback - -Add an implementation to get the current GPIO state. - -The callback is used by the leds-gpio driver for example, in case the -current LED/GPIO state should be kept during driver load. - -Signed-off-by: Mathias Kresin -Signed-off-by: Linus Walleij ---- - drivers/gpio/gpio-stp-xway.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/drivers/gpio/gpio-stp-xway.c -+++ b/drivers/gpio/gpio-stp-xway.c -@@ -91,6 +91,20 @@ struct xway_stp { - }; - - /** -+ * xway_stp_get() - gpio_chip->get - get gpios. -+ * @gc: Pointer to gpio_chip device structure. -+ * @gpio: GPIO signal number. -+ * -+ * Gets the shadow value. -+ */ -+static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio) -+{ -+ struct xway_stp *chip = gpiochip_get_data(gc); -+ -+ return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio)); -+} -+ -+/** - * xway_stp_set() - gpio_chip->set - set gpios. - * @gc: Pointer to gpio_chip device structure. - * @gpio: GPIO signal number. -@@ -215,6 +229,7 @@ static int xway_stp_probe(struct platfor - chip->gc.parent = &pdev->dev; - chip->gc.label = "stp-xway"; - chip->gc.direction_output = xway_stp_dir_out; -+ chip->gc.get = xway_stp_get; - chip->gc.set = xway_stp_set; - chip->gc.request = xway_stp_request; - chip->gc.base = -1; diff --git a/target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch b/target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch deleted file mode 100644 index 479decd6a..000000000 --- a/target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch +++ /dev/null @@ -1,500 +0,0 @@ -From 9afadf01b1be371ee88491819aa67364684461f9 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 3 Aug 2012 10:27:25 +0200 -Subject: [PATCH 04/36] MIPS: lantiq: add atm hack - -Signed-off-by: John Crispin ---- - arch/mips/include/asm/mach-lantiq/lantiq_atm.h | 196 +++++++++++++++++++++++ - arch/mips/include/asm/mach-lantiq/lantiq_ptm.h | 203 ++++++++++++++++++++++++ - arch/mips/lantiq/irq.c | 2 + - arch/mips/mm/cache.c | 2 + - include/uapi/linux/atm.h | 6 + - net/atm/common.c | 6 + - net/atm/proc.c | 2 +- - 7 files changed, 416 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_atm.h - create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_ptm.h - ---- /dev/null -+++ b/arch/mips/include/asm/mach-lantiq/lantiq_atm.h -@@ -0,0 +1,196 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifx_atm.h -+** PROJECT : UEIP -+** MODULES : ATM -+** -+** DATE : 17 Jun 2009 -+** AUTHOR : Xu Liang -+** DESCRIPTION : Global ATM driver header file -+** COPYRIGHT : Copyright (c) 2006 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** -+** HISTORY -+** $Date $Author $Comment -+** 07 JUL 2009 Xu Liang Init Version -+*******************************************************************************/ -+ -+#ifndef IFX_ATM_H -+#define IFX_ATM_H -+ -+ -+ -+/*! -+ \defgroup IFX_ATM UEIP Project - ATM driver module -+ \brief UEIP Project - ATM driver module, support Danube, Amazon-SE, AR9, VR9. -+ */ -+ -+/*! -+ \defgroup IFX_ATM_IOCTL IOCTL Commands -+ \ingroup IFX_ATM -+ \brief IOCTL Commands used by user application. -+ */ -+ -+/*! -+ \defgroup IFX_ATM_STRUCT Structures -+ \ingroup IFX_ATM -+ \brief Structures used by user application. -+ */ -+ -+/*! -+ \file ifx_atm.h -+ \ingroup IFX_ATM -+ \brief ATM driver header file -+ */ -+ -+ -+ -+/* -+ * #################################### -+ * Definition -+ * #################################### -+ */ -+ -+/*! -+ \addtogroup IFX_ATM_STRUCT -+ */ -+/*@{*/ -+ -+/* -+ * ATM MIB -+ */ -+ -+/*! -+ \struct atm_cell_ifEntry_t -+ \brief Structure used for Cell Level MIB Counters. -+ -+ User application use this structure to call IOCTL command "PPE_ATM_MIB_CELL". -+ */ -+typedef struct { -+ __u32 ifHCInOctets_h; /*!< byte counter of ingress cells (upper 32 bits, total 64 bits) */ -+ __u32 ifHCInOctets_l; /*!< byte counter of ingress cells (lower 32 bits, total 64 bits) */ -+ __u32 ifHCOutOctets_h; /*!< byte counter of egress cells (upper 32 bits, total 64 bits) */ -+ __u32 ifHCOutOctets_l; /*!< byte counter of egress cells (lower 32 bits, total 64 bits) */ -+ __u32 ifInErrors; /*!< counter of error ingress cells */ -+ __u32 ifInUnknownProtos; /*!< counter of unknown ingress cells */ -+ __u32 ifOutErrors; /*!< counter of error egress cells */ -+} atm_cell_ifEntry_t; -+ -+/*! -+ \struct atm_aal5_ifEntry_t -+ \brief Structure used for AAL5 Frame Level MIB Counters. -+ -+ User application use this structure to call IOCTL command "PPE_ATM_MIB_AAL5". -+ */ -+typedef struct { -+ __u32 ifHCInOctets_h; /*!< byte counter of ingress packets (upper 32 bits, total 64 bits) */ -+ __u32 ifHCInOctets_l; /*!< byte counter of ingress packets (lower 32 bits, total 64 bits) */ -+ __u32 ifHCOutOctets_h; /*!< byte counter of egress packets (upper 32 bits, total 64 bits) */ -+ __u32 ifHCOutOctets_l; /*!< byte counter of egress packets (lower 32 bits, total 64 bits) */ -+ __u32 ifInUcastPkts; /*!< counter of ingress packets */ -+ __u32 ifOutUcastPkts; /*!< counter of egress packets */ -+ __u32 ifInErrors; /*!< counter of error ingress packets */ -+ __u32 ifInDiscards; /*!< counter of dropped ingress packets */ -+ __u32 ifOutErros; /*!< counter of error egress packets */ -+ __u32 ifOutDiscards; /*!< counter of dropped egress packets */ -+} atm_aal5_ifEntry_t; -+ -+/*! -+ \struct atm_aal5_vcc_t -+ \brief Structure used for per PVC AAL5 Frame Level MIB Counters. -+ -+ This structure is a part of structure "atm_aal5_vcc_x_t". -+ */ -+typedef struct { -+ __u32 aal5VccCrcErrors; /*!< counter of ingress packets with CRC error */ -+ __u32 aal5VccSarTimeOuts; /*!< counter of ingress packets with Re-assemble timeout */ //no timer support yet -+ __u32 aal5VccOverSizedSDUs; /*!< counter of oversized ingress packets */ -+} atm_aal5_vcc_t; -+ -+/*! -+ \struct atm_aal5_vcc_x_t -+ \brief Structure used for per PVC AAL5 Frame Level MIB Counters. -+ -+ User application use this structure to call IOCTL command "PPE_ATM_MIB_VCC". -+ */ -+typedef struct { -+ int vpi; /*!< VPI of the VCC to get MIB counters */ -+ int vci; /*!< VCI of the VCC to get MIB counters */ -+ atm_aal5_vcc_t mib_vcc; /*!< structure to get MIB counters */ -+} atm_aal5_vcc_x_t; -+ -+/*@}*/ -+ -+ -+ -+/* -+ * #################################### -+ * IOCTL -+ * #################################### -+ */ -+ -+/*! -+ \addtogroup IFX_ATM_IOCTL -+ */ -+/*@{*/ -+ -+/* -+ * ioctl Command -+ */ -+/*! -+ \brief ATM IOCTL Magic Number -+ */ -+#define PPE_ATM_IOC_MAGIC 'o' -+/*! -+ \brief ATM IOCTL Command - Get Cell Level MIB Counters -+ -+ This command is obsolete. User can get cell level MIB from DSL API. -+ This command uses structure "atm_cell_ifEntry_t" as parameter for output of MIB counters. -+ */ -+#define PPE_ATM_MIB_CELL _IOW(PPE_ATM_IOC_MAGIC, 0, atm_cell_ifEntry_t) -+/*! -+ \brief ATM IOCTL Command - Get AAL5 Level MIB Counters -+ -+ Get AAL5 packet counters. -+ This command uses structure "atm_aal5_ifEntry_t" as parameter for output of MIB counters. -+ */ -+#define PPE_ATM_MIB_AAL5 _IOW(PPE_ATM_IOC_MAGIC, 1, atm_aal5_ifEntry_t) -+/*! -+ \brief ATM IOCTL Command - Get Per PVC MIB Counters -+ -+ Get AAL5 packet counters for each PVC. -+ This command uses structure "atm_aal5_vcc_x_t" as parameter for input of VPI/VCI information and output of MIB counters. -+ */ -+#define PPE_ATM_MIB_VCC _IOWR(PPE_ATM_IOC_MAGIC, 2, atm_aal5_vcc_x_t) -+/*! -+ \brief Total Number of ATM IOCTL Commands -+ */ -+#define PPE_ATM_IOC_MAXNR 3 -+ -+/*@}*/ -+ -+ -+ -+/* -+ * #################################### -+ * API -+ * #################################### -+ */ -+ -+#ifdef __KERNEL__ -+struct port_cell_info { -+ unsigned int port_num; -+ unsigned int tx_link_rate[2]; -+}; -+#endif -+ -+ -+ -+#endif // IFX_ATM_H -+ ---- /dev/null -+++ b/arch/mips/include/asm/mach-lantiq/lantiq_ptm.h -@@ -0,0 +1,203 @@ -+/****************************************************************************** -+** -+** FILE NAME : ifx_ptm.h -+** PROJECT : UEIP -+** MODULES : PTM -+** -+** DATE : 17 Jun 2009 -+** AUTHOR : Xu Liang -+** DESCRIPTION : Global PTM driver header file -+** COPYRIGHT : Copyright (c) 2006 -+** Infineon Technologies AG -+** Am Campeon 1-12, 85579 Neubiberg, Germany -+** -+** This program is free software; you can redistribute it and/or modify -+** it under the terms of the GNU General Public License as published by -+** the Free Software Foundation; either version 2 of the License, or -+** (at your option) any later version. -+** -+** HISTORY -+** $Date $Author $Comment -+** 07 JUL 2009 Xu Liang Init Version -+*******************************************************************************/ -+ -+#ifndef IFX_PTM_H -+#define IFX_PTM_H -+ -+ -+ -+/*! -+ \defgroup IFX_PTM UEIP Project - PTM driver module -+ \brief UEIP Project - PTM driver module, support Danube, Amazon-SE, AR9, VR9. -+ */ -+ -+/*! -+ \defgroup IFX_PTM_IOCTL IOCTL Commands -+ \ingroup IFX_PTM -+ \brief IOCTL Commands used by user application. -+ */ -+ -+/*! -+ \defgroup IFX_PTM_STRUCT Structures -+ \ingroup IFX_PTM -+ \brief Structures used by user application. -+ */ -+ -+/*! -+ \file ifx_ptm.h -+ \ingroup IFX_PTM -+ \brief PTM driver header file -+ */ -+ -+ -+ -+/* -+ * #################################### -+ * Definition -+ * #################################### -+ */ -+ -+ -+ -+/* -+ * #################################### -+ * IOCTL -+ * #################################### -+ */ -+ -+/*! -+ \addtogroup IFX_PTM_IOCTL -+ */ -+/*@{*/ -+ -+/* -+ * ioctl Command -+ */ -+/*! -+ \brief PTM IOCTL Command - Get codeword MIB counters. -+ -+ This command uses structure "PTM_CW_IF_ENTRY_T" to get codeword level MIB counters. -+ */ -+#define IFX_PTM_MIB_CW_GET SIOCDEVPRIVATE + 1 -+/*! -+ \brief PTM IOCTL Command - Get packet MIB counters. -+ -+ This command uses structure "PTM_FRAME_MIB_T" to get packet level MIB counters. -+ */ -+#define IFX_PTM_MIB_FRAME_GET SIOCDEVPRIVATE + 2 -+/*! -+ \brief PTM IOCTL Command - Get firmware configuration (CRC). -+ -+ This command uses structure "IFX_PTM_CFG_T" to get firmware configuration (CRC). -+ */ -+#define IFX_PTM_CFG_GET SIOCDEVPRIVATE + 3 -+/*! -+ \brief PTM IOCTL Command - Set firmware configuration (CRC). -+ -+ This command uses structure "IFX_PTM_CFG_T" to set firmware configuration (CRC). -+ */ -+#define IFX_PTM_CFG_SET SIOCDEVPRIVATE + 4 -+/*! -+ \brief PTM IOCTL Command - Program priority value to TX queue mapping. -+ -+ This command uses structure "IFX_PTM_PRIO_Q_MAP_T" to program priority value to TX queue mapping. -+ */ -+#define IFX_PTM_MAP_PKT_PRIO_TO_Q SIOCDEVPRIVATE + 14 -+ -+/*@}*/ -+ -+ -+/*! -+ \addtogroup IFX_PTM_STRUCT -+ */ -+/*@{*/ -+ -+/* -+ * ioctl Data Type -+ */ -+ -+/*! -+ \typedef PTM_CW_IF_ENTRY_T -+ \brief Wrapping of structure "ptm_cw_ifEntry_t". -+ */ -+/*! -+ \struct ptm_cw_ifEntry_t -+ \brief Structure used for CodeWord level MIB counters. -+ */ -+typedef struct ptm_cw_ifEntry_t { -+ uint32_t ifRxNoIdleCodewords; /*!< output, number of ingress user codeword */ -+ uint32_t ifRxIdleCodewords; /*!< output, number of ingress idle codeword */ -+ uint32_t ifRxCodingViolation; /*!< output, number of error ingress codeword */ -+ uint32_t ifTxNoIdleCodewords; /*!< output, number of egress user codeword */ -+ uint32_t ifTxIdleCodewords; /*!< output, number of egress idle codeword */ -+} PTM_CW_IF_ENTRY_T; -+ -+/*! -+ \typedef PTM_FRAME_MIB_T -+ \brief Wrapping of structure "ptm_frame_mib_t". -+ */ -+/*! -+ \struct ptm_frame_mib_t -+ \brief Structure used for packet level MIB counters. -+ */ -+typedef struct ptm_frame_mib_t { -+ uint32_t RxCorrect; /*!< output, number of ingress packet */ -+ uint32_t TC_CrcError; /*!< output, number of egress packet with CRC error */ -+ uint32_t RxDropped; /*!< output, number of dropped ingress packet */ -+ uint32_t TxSend; /*!< output, number of egress packet */ -+} PTM_FRAME_MIB_T; -+ -+/*! -+ \typedef IFX_PTM_CFG_T -+ \brief Wrapping of structure "ptm_cfg_t". -+ */ -+/*! -+ \struct ptm_cfg_t -+ \brief Structure used for ETH/TC CRC configuration. -+ */ -+typedef struct ptm_cfg_t { -+ uint32_t RxEthCrcPresent; /*!< input/output, ingress packet has ETH CRC */ -+ uint32_t RxEthCrcCheck; /*!< input/output, check ETH CRC of ingress packet */ -+ uint32_t RxTcCrcCheck; /*!< input/output, check TC CRC of ingress codeword */ -+ uint32_t RxTcCrcLen; /*!< input/output, length of TC CRC of ingress codeword */ -+ uint32_t TxEthCrcGen; /*!< input/output, generate ETH CRC for egress packet */ -+ uint32_t TxTcCrcGen; /*!< input/output, generate TC CRC for egress codeword */ -+ uint32_t TxTcCrcLen; /*!< input/output, length of TC CRC of egress codeword */ -+} IFX_PTM_CFG_T; -+ -+/*! -+ \typedef IFX_PTM_PRIO_Q_MAP_T -+ \brief Wrapping of structure "ppe_prio_q_map". -+ */ -+/*! -+ \struct ppe_prio_q_map -+ \brief Structure used for Priority Value to TX Queue mapping. -+ */ -+typedef struct ppe_prio_q_map { -+ int pkt_prio; -+ int qid; -+ int vpi; // ignored in eth interface -+ int vci; // ignored in eth interface -+} IFX_PTM_PRIO_Q_MAP_T; -+ -+/*@}*/ -+ -+ -+ -+/* -+ * #################################### -+ * API -+ * #################################### -+ */ -+ -+#ifdef __KERNEL__ -+struct port_cell_info { -+ unsigned int port_num; -+ unsigned int tx_link_rate[2]; -+}; -+#endif -+ -+ -+ -+#endif // IFX_PTM_H -+ ---- a/arch/mips/lantiq/irq.c -+++ b/arch/mips/lantiq/irq.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -100,6 +101,7 @@ void ltq_mask_and_ack_irq(struct irq_dat - ltq_icu_w32(im, ltq_icu_r32(im, ier) & ~BIT(offset), ier); - ltq_icu_w32(im, BIT(offset), isr); - } -+EXPORT_SYMBOL(ltq_mask_and_ack_irq); - - static void ltq_ack_irq(struct irq_data *d) - { ---- a/arch/mips/mm/cache.c -+++ b/arch/mips/mm/cache.c -@@ -63,6 +63,8 @@ void (*_dma_cache_wback)(unsigned long s - void (*_dma_cache_inv)(unsigned long start, unsigned long size); - - EXPORT_SYMBOL(_dma_cache_wback_inv); -+EXPORT_SYMBOL(_dma_cache_wback); -+EXPORT_SYMBOL(_dma_cache_inv); - - #endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ - ---- a/include/uapi/linux/atm.h -+++ b/include/uapi/linux/atm.h -@@ -130,8 +130,14 @@ - #define ATM_ABR 4 - #define ATM_ANYCLASS 5 /* compatible with everything */ - -+#define ATM_VBR_NRT ATM_VBR -+#define ATM_VBR_RT 6 -+#define ATM_UBR_PLUS 7 -+#define ATM_GFR 8 -+ - #define ATM_MAX_PCR -1 /* maximum available PCR */ - -+ - struct atm_trafprm { - unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ - int max_pcr; /* maximum PCR in cells per second */ ---- a/net/atm/common.c -+++ b/net/atm/common.c -@@ -62,11 +62,17 @@ static void vcc_remove_socket(struct soc - write_unlock_irq(&vcc_sklist_lock); - } - -+struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL; -+EXPORT_SYMBOL(ifx_atm_alloc_tx); -+ - static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned int size) - { - struct sk_buff *skb; - struct sock *sk = sk_atm(vcc); - -+ if (ifx_atm_alloc_tx != NULL) -+ return ifx_atm_alloc_tx(vcc, size); -+ - if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) { - pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n", - sk_wmem_alloc_get(sk), size, sk->sk_sndbuf); ---- a/net/atm/proc.c -+++ b/net/atm/proc.c -@@ -154,7 +154,7 @@ static void *vcc_seq_next(struct seq_fil - static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) - { - static const char *const class_name[] = { -- "off", "UBR", "CBR", "VBR", "ABR"}; -+ "off","UBR","CBR","NTR-VBR","ABR","ANY","RT-VBR","UBR+","GFR"}; - static const char *const aal_name[] = { - "---", "1", "2", "3/4", /* 0- 3 */ - "???", "5", "???", "???", /* 4- 7 */ diff --git a/target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch b/target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch deleted file mode 100644 index 335a1e261..000000000 --- a/target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch +++ /dev/null @@ -1,1034 +0,0 @@ -From 94800350cb8d2f29dda2206b5e9a3772024ee168 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 7 Aug 2014 18:30:56 +0200 -Subject: [PATCH 08/36] MIPS: lantiq: backport old timer code - -Signed-off-by: John Crispin ---- - arch/mips/include/asm/mach-lantiq/lantiq_timer.h | 155 ++++ - arch/mips/lantiq/xway/Makefile | 2 +- - arch/mips/lantiq/xway/timer.c | 845 ++++++++++++++++++++++ - 3 files changed, 1001 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_timer.h - create mode 100644 arch/mips/lantiq/xway/timer.c - ---- /dev/null -+++ b/arch/mips/include/asm/mach-lantiq/lantiq_timer.h -@@ -0,0 +1,155 @@ -+#ifndef __DANUBE_GPTU_DEV_H__2005_07_26__10_19__ -+#define __DANUBE_GPTU_DEV_H__2005_07_26__10_19__ -+ -+ -+/****************************************************************************** -+ Copyright (c) 2002, Infineon Technologies. All rights reserved. -+ -+ No Warranty -+ Because the program is licensed free of charge, there is no warranty for -+ the program, to the extent permitted by applicable law. Except when -+ otherwise stated in writing the copyright holders and/or other parties -+ provide the program "as is" without warranty of any kind, either -+ expressed or implied, including, but not limited to, the implied -+ warranties of merchantability and fitness for a particular purpose. The -+ entire risk as to the quality and performance of the program is with -+ you. should the program prove defective, you assume the cost of all -+ necessary servicing, repair or correction. -+ -+ In no event unless required by applicable law or agreed to in writing -+ will any copyright holder, or any other party who may modify and/or -+ redistribute the program as permitted above, be liable to you for -+ damages, including any general, special, incidental or consequential -+ damages arising out of the use or inability to use the program -+ (including but not limited to loss of data or data being rendered -+ inaccurate or losses sustained by you or third parties or a failure of -+ the program to operate with any other programs), even if such holder or -+ other party has been advised of the possibility of such damages. -+******************************************************************************/ -+ -+ -+/* -+ * #################################### -+ * Definition -+ * #################################### -+ */ -+ -+/* -+ * Available Timer/Counter Index -+ */ -+#define TIMER(n, X) (n * 2 + (X ? 1 : 0)) -+#define TIMER_ANY 0x00 -+#define TIMER1A TIMER(1, 0) -+#define TIMER1B TIMER(1, 1) -+#define TIMER2A TIMER(2, 0) -+#define TIMER2B TIMER(2, 1) -+#define TIMER3A TIMER(3, 0) -+#define TIMER3B TIMER(3, 1) -+ -+/* -+ * Flag of Timer/Counter -+ * These flags specify the way in which timer is configured. -+ */ -+/* Bit size of timer/counter. */ -+#define TIMER_FLAG_16BIT 0x0000 -+#define TIMER_FLAG_32BIT 0x0001 -+/* Switch between timer and counter. */ -+#define TIMER_FLAG_TIMER 0x0000 -+#define TIMER_FLAG_COUNTER 0x0002 -+/* Stop or continue when overflowing/underflowing. */ -+#define TIMER_FLAG_ONCE 0x0000 -+#define TIMER_FLAG_CYCLIC 0x0004 -+/* Count up or counter down. */ -+#define TIMER_FLAG_UP 0x0000 -+#define TIMER_FLAG_DOWN 0x0008 -+/* Count on specific level or edge. */ -+#define TIMER_FLAG_HIGH_LEVEL_SENSITIVE 0x0000 -+#define TIMER_FLAG_LOW_LEVEL_SENSITIVE 0x0040 -+#define TIMER_FLAG_RISE_EDGE 0x0010 -+#define TIMER_FLAG_FALL_EDGE 0x0020 -+#define TIMER_FLAG_ANY_EDGE 0x0030 -+/* Signal is syncronous to module clock or not. */ -+#define TIMER_FLAG_UNSYNC 0x0000 -+#define TIMER_FLAG_SYNC 0x0080 -+/* Different interrupt handle type. */ -+#define TIMER_FLAG_NO_HANDLE 0x0000 -+#if defined(__KERNEL__) -+ #define TIMER_FLAG_CALLBACK_IN_IRQ 0x0100 -+#endif // defined(__KERNEL__) -+#define TIMER_FLAG_SIGNAL 0x0300 -+/* Internal clock source or external clock source */ -+#define TIMER_FLAG_INT_SRC 0x0000 -+#define TIMER_FLAG_EXT_SRC 0x1000 -+ -+ -+/* -+ * ioctl Command -+ */ -+#define GPTU_REQUEST_TIMER 0x01 /* General method to setup timer/counter. */ -+#define GPTU_FREE_TIMER 0x02 /* Free timer/counter. */ -+#define GPTU_START_TIMER 0x03 /* Start or resume timer/counter. */ -+#define GPTU_STOP_TIMER 0x04 /* Suspend timer/counter. */ -+#define GPTU_GET_COUNT_VALUE 0x05 /* Get current count value. */ -+#define GPTU_CALCULATE_DIVIDER 0x06 /* Calculate timer divider from given freq.*/ -+#define GPTU_SET_TIMER 0x07 /* Simplified method to setup timer. */ -+#define GPTU_SET_COUNTER 0x08 /* Simplified method to setup counter. */ -+ -+/* -+ * Data Type Used to Call ioctl -+ */ -+struct gptu_ioctl_param { -+ unsigned int timer; /* In command GPTU_REQUEST_TIMER, GPTU_SET_TIMER, and * -+ * GPTU_SET_COUNTER, this field is ID of expected * -+ * timer/counter. If it's zero, a timer/counter would * -+ * be dynamically allocated and ID would be stored in * -+ * this field. * -+ * In command GPTU_GET_COUNT_VALUE, this field is * -+ * ignored. * -+ * In other command, this field is ID of timer/counter * -+ * allocated. */ -+ unsigned int flag; /* In command GPTU_REQUEST_TIMER, GPTU_SET_TIMER, and * -+ * GPTU_SET_COUNTER, this field contains flags to * -+ * specify how to configure timer/counter. * -+ * In command GPTU_START_TIMER, zero indicate start * -+ * and non-zero indicate resume timer/counter. * -+ * In other command, this field is ignored. */ -+ unsigned long value; /* In command GPTU_REQUEST_TIMER, this field contains * -+ * init/reload value. * -+ * In command GPTU_SET_TIMER, this field contains * -+ * frequency (0.001Hz) of timer. * -+ * In command GPTU_GET_COUNT_VALUE, current count * -+ * value would be stored in this field. * -+ * In command GPTU_CALCULATE_DIVIDER, this field * -+ * contains frequency wanted, and after calculation, * -+ * divider would be stored in this field to overwrite * -+ * the frequency. * -+ * In other command, this field is ignored. */ -+ int pid; /* In command GPTU_REQUEST_TIMER and GPTU_SET_TIMER, * -+ * if signal is required, this field contains process * -+ * ID to which signal would be sent. * -+ * In other command, this field is ignored. */ -+ int sig; /* In command GPTU_REQUEST_TIMER and GPTU_SET_TIMER, * -+ * if signal is required, this field contains signal * -+ * number which would be sent. * -+ * In other command, this field is ignored. */ -+}; -+ -+/* -+ * #################################### -+ * Data Type -+ * #################################### -+ */ -+typedef void (*timer_callback)(unsigned long arg); -+ -+extern int lq_request_timer(unsigned int, unsigned int, unsigned long, unsigned long, unsigned long); -+extern int lq_free_timer(unsigned int); -+extern int lq_start_timer(unsigned int, int); -+extern int lq_stop_timer(unsigned int); -+extern int lq_reset_counter_flags(u32 timer, u32 flags); -+extern int lq_get_count_value(unsigned int, unsigned long *); -+extern u32 lq_cal_divider(unsigned long); -+extern int lq_set_timer(unsigned int, unsigned int, int, int, unsigned int, unsigned long, unsigned long); -+extern int lq_set_counter(unsigned int timer, unsigned int flag, -+ u32 reload, unsigned long arg1, unsigned long arg2); -+ -+#endif /* __DANUBE_GPTU_DEV_H__2005_07_26__10_19__ */ ---- a/arch/mips/lantiq/xway/Makefile -+++ b/arch/mips/lantiq/xway/Makefile -@@ -1,4 +1,10 @@ --obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o -+obj-y := prom.o sysctrl.o clk.o reset.o dma.o dcdc.o -+ -+ifdef CONFIG_SOC_AMAZON_SE -+obj-y += gptu.o -+else -+obj-y += timer.o -+endif - - obj-y += vmmc.o - ---- /dev/null -+++ b/arch/mips/lantiq/xway/timer.c -@@ -0,0 +1,845 @@ -+#ifndef CONFIG_SOC_AMAZON_SE -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include "../clk.h" -+ -+#include -+#include -+#include -+ -+#define MAX_NUM_OF_32BIT_TIMER_BLOCKS 6 -+ -+#ifdef TIMER1A -+#define FIRST_TIMER TIMER1A -+#else -+#define FIRST_TIMER 2 -+#endif -+ -+/* -+ * GPTC divider is set or not. -+ */ -+#define GPTU_CLC_RMC_IS_SET 0 -+ -+/* -+ * Timer Interrupt (IRQ) -+ */ -+/* Must be adjusted when ICU driver is available */ -+#define TIMER_INTERRUPT (INT_NUM_IM3_IRL0 + 22) -+ -+/* -+ * Bits Operation -+ */ -+#define GET_BITS(x, msb, lsb) \ -+ (((x) & ((1 << ((msb) + 1)) - 1)) >> (lsb)) -+#define SET_BITS(x, msb, lsb, value) \ -+ (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | \ -+ (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb))) -+ -+/* -+ * GPTU Register Mapping -+ */ -+#define LQ_GPTU (KSEG1 + 0x1E100A00) -+#define LQ_GPTU_CLC ((volatile u32 *)(LQ_GPTU + 0x0000)) -+#define LQ_GPTU_ID ((volatile u32 *)(LQ_GPTU + 0x0008)) -+#define LQ_GPTU_CON(n, X) ((volatile u32 *)(LQ_GPTU + 0x0010 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ -+#define LQ_GPTU_RUN(n, X) ((volatile u32 *)(LQ_GPTU + 0x0018 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ -+#define LQ_GPTU_RELOAD(n, X) ((volatile u32 *)(LQ_GPTU + 0x0020 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ -+#define LQ_GPTU_COUNT(n, X) ((volatile u32 *)(LQ_GPTU + 0x0028 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ -+#define LQ_GPTU_IRNEN ((volatile u32 *)(LQ_GPTU + 0x00F4)) -+#define LQ_GPTU_IRNICR ((volatile u32 *)(LQ_GPTU + 0x00F8)) -+#define LQ_GPTU_IRNCR ((volatile u32 *)(LQ_GPTU + 0x00FC)) -+ -+/* -+ * Clock Control Register -+ */ -+#define GPTU_CLC_SMC GET_BITS(*LQ_GPTU_CLC, 23, 16) -+#define GPTU_CLC_RMC GET_BITS(*LQ_GPTU_CLC, 15, 8) -+#define GPTU_CLC_FSOE (*LQ_GPTU_CLC & (1 << 5)) -+#define GPTU_CLC_EDIS (*LQ_GPTU_CLC & (1 << 3)) -+#define GPTU_CLC_SPEN (*LQ_GPTU_CLC & (1 << 2)) -+#define GPTU_CLC_DISS (*LQ_GPTU_CLC & (1 << 1)) -+#define GPTU_CLC_DISR (*LQ_GPTU_CLC & (1 << 0)) -+ -+#define GPTU_CLC_SMC_SET(value) SET_BITS(0, 23, 16, (value)) -+#define GPTU_CLC_RMC_SET(value) SET_BITS(0, 15, 8, (value)) -+#define GPTU_CLC_FSOE_SET(value) ((value) ? (1 << 5) : 0) -+#define GPTU_CLC_SBWE_SET(value) ((value) ? (1 << 4) : 0) -+#define GPTU_CLC_EDIS_SET(value) ((value) ? (1 << 3) : 0) -+#define GPTU_CLC_SPEN_SET(value) ((value) ? (1 << 2) : 0) -+#define GPTU_CLC_DISR_SET(value) ((value) ? (1 << 0) : 0) -+ -+/* -+ * ID Register -+ */ -+#define GPTU_ID_ID GET_BITS(*LQ_GPTU_ID, 15, 8) -+#define GPTU_ID_CFG GET_BITS(*LQ_GPTU_ID, 7, 5) -+#define GPTU_ID_REV GET_BITS(*LQ_GPTU_ID, 4, 0) -+ -+/* -+ * Control Register of Timer/Counter nX -+ * n is the index of block (1 based index) -+ * X is either A or B -+ */ -+#define GPTU_CON_SRC_EG(n, X) (*LQ_GPTU_CON(n, X) & (1 << 10)) -+#define GPTU_CON_SRC_EXT(n, X) (*LQ_GPTU_CON(n, X) & (1 << 9)) -+#define GPTU_CON_SYNC(n, X) (*LQ_GPTU_CON(n, X) & (1 << 8)) -+#define GPTU_CON_EDGE(n, X) GET_BITS(*LQ_GPTU_CON(n, X), 7, 6) -+#define GPTU_CON_INV(n, X) (*LQ_GPTU_CON(n, X) & (1 << 5)) -+#define GPTU_CON_EXT(n, X) (*LQ_GPTU_CON(n, A) & (1 << 4)) /* Timer/Counter B does not have this bit */ -+#define GPTU_CON_STP(n, X) (*LQ_GPTU_CON(n, X) & (1 << 3)) -+#define GPTU_CON_CNT(n, X) (*LQ_GPTU_CON(n, X) & (1 << 2)) -+#define GPTU_CON_DIR(n, X) (*LQ_GPTU_CON(n, X) & (1 << 1)) -+#define GPTU_CON_EN(n, X) (*LQ_GPTU_CON(n, X) & (1 << 0)) -+ -+#define GPTU_CON_SRC_EG_SET(value) ((value) ? 0 : (1 << 10)) -+#define GPTU_CON_SRC_EXT_SET(value) ((value) ? (1 << 9) : 0) -+#define GPTU_CON_SYNC_SET(value) ((value) ? (1 << 8) : 0) -+#define GPTU_CON_EDGE_SET(value) SET_BITS(0, 7, 6, (value)) -+#define GPTU_CON_INV_SET(value) ((value) ? (1 << 5) : 0) -+#define GPTU_CON_EXT_SET(value) ((value) ? (1 << 4) : 0) -+#define GPTU_CON_STP_SET(value) ((value) ? (1 << 3) : 0) -+#define GPTU_CON_CNT_SET(value) ((value) ? (1 << 2) : 0) -+#define GPTU_CON_DIR_SET(value) ((value) ? (1 << 1) : 0) -+ -+#define GPTU_RUN_RL_SET(value) ((value) ? (1 << 2) : 0) -+#define GPTU_RUN_CEN_SET(value) ((value) ? (1 << 1) : 0) -+#define GPTU_RUN_SEN_SET(value) ((value) ? (1 << 0) : 0) -+ -+#define GPTU_IRNEN_TC_SET(n, X, value) ((value) ? (1 << (((n) - 1) * 2 + (X))) : 0) -+#define GPTU_IRNCR_TC_SET(n, X, value) ((value) ? (1 << (((n) - 1) * 2 + (X))) : 0) -+ -+#define TIMER_FLAG_MASK_SIZE(x) (x & 0x0001) -+#define TIMER_FLAG_MASK_TYPE(x) (x & 0x0002) -+#define TIMER_FLAG_MASK_STOP(x) (x & 0x0004) -+#define TIMER_FLAG_MASK_DIR(x) (x & 0x0008) -+#define TIMER_FLAG_NONE_EDGE 0x0000 -+#define TIMER_FLAG_MASK_EDGE(x) (x & 0x0030) -+#define TIMER_FLAG_REAL 0x0000 -+#define TIMER_FLAG_INVERT 0x0040 -+#define TIMER_FLAG_MASK_INVERT(x) (x & 0x0040) -+#define TIMER_FLAG_MASK_TRIGGER(x) (x & 0x0070) -+#define TIMER_FLAG_MASK_SYNC(x) (x & 0x0080) -+#define TIMER_FLAG_CALLBACK_IN_HB 0x0200 -+#define TIMER_FLAG_MASK_HANDLE(x) (x & 0x0300) -+#define TIMER_FLAG_MASK_SRC(x) (x & 0x1000) -+ -+struct timer_dev_timer { -+ unsigned int f_irq_on; -+ unsigned int irq; -+ unsigned int flag; -+ unsigned long arg1; -+ unsigned long arg2; -+}; -+ -+struct timer_dev { -+ struct mutex gptu_mutex; -+ unsigned int number_of_timers; -+ unsigned int occupation; -+ unsigned int f_gptu_on; -+ struct timer_dev_timer timer[MAX_NUM_OF_32BIT_TIMER_BLOCKS * 2]; -+}; -+ -+ -+unsigned int ltq_get_fpi_bus_clock(int fpi) { -+ struct clk *clk = clk_get_fpi(); -+ return clk_get_rate(clk); -+} -+ -+ -+static long gptu_ioctl(struct file *, unsigned int, unsigned long); -+static int gptu_open(struct inode *, struct file *); -+static int gptu_release(struct inode *, struct file *); -+ -+static struct file_operations gptu_fops = { -+ .owner = THIS_MODULE, -+ .unlocked_ioctl = gptu_ioctl, -+ .open = gptu_open, -+ .release = gptu_release -+}; -+ -+static struct miscdevice gptu_miscdev = { -+ .minor = MISC_DYNAMIC_MINOR, -+ .name = "gptu", -+ .fops = &gptu_fops, -+}; -+ -+static struct timer_dev timer_dev; -+ -+static irqreturn_t timer_irq_handler(int irq, void *p) -+{ -+ unsigned int timer; -+ unsigned int flag; -+ struct timer_dev_timer *dev_timer = (struct timer_dev_timer *)p; -+ -+ timer = irq - TIMER_INTERRUPT; -+ if (timer < timer_dev.number_of_timers -+ && dev_timer == &timer_dev.timer[timer]) { -+ /* Clear interrupt. */ -+ ltq_w32(1 << timer, LQ_GPTU_IRNCR); -+ -+ /* Call user hanler or signal. */ -+ flag = dev_timer->flag; -+ if (!(timer & 0x01) -+ || TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT) { -+ /* 16-bit timer or timer A of 32-bit timer */ -+ switch (TIMER_FLAG_MASK_HANDLE(flag)) { -+ case TIMER_FLAG_CALLBACK_IN_IRQ: -+ case TIMER_FLAG_CALLBACK_IN_HB: -+ if (dev_timer->arg1) -+ (*(timer_callback)dev_timer->arg1)(dev_timer->arg2); -+ break; -+ case TIMER_FLAG_SIGNAL: -+ send_sig((int)dev_timer->arg2, (struct task_struct *)dev_timer->arg1, 0); -+ break; -+ } -+ } -+ } -+ return IRQ_HANDLED; -+} -+ -+static inline void lq_enable_gptu(void) -+{ -+ struct clk *clk = clk_get_sys("1e100a00.gptu", NULL); -+ clk_enable(clk); -+ -+ //ltq_pmu_enable(PMU_GPT); -+ -+ /* Set divider as 1, disable write protection for SPEN, enable module. */ -+ *LQ_GPTU_CLC = -+ GPTU_CLC_SMC_SET(0x00) | -+ GPTU_CLC_RMC_SET(0x01) | -+ GPTU_CLC_FSOE_SET(0) | -+ GPTU_CLC_SBWE_SET(1) | -+ GPTU_CLC_EDIS_SET(0) | -+ GPTU_CLC_SPEN_SET(0) | -+ GPTU_CLC_DISR_SET(0); -+} -+ -+static inline void lq_disable_gptu(void) -+{ -+ struct clk *clk = clk_get_sys("1e100a00.gptu", NULL); -+ ltq_w32(0x00, LQ_GPTU_IRNEN); -+ ltq_w32(0xfff, LQ_GPTU_IRNCR); -+ -+ /* Set divider as 0, enable write protection for SPEN, disable module. */ -+ *LQ_GPTU_CLC = -+ GPTU_CLC_SMC_SET(0x00) | -+ GPTU_CLC_RMC_SET(0x00) | -+ GPTU_CLC_FSOE_SET(0) | -+ GPTU_CLC_SBWE_SET(0) | -+ GPTU_CLC_EDIS_SET(0) | -+ GPTU_CLC_SPEN_SET(0) | -+ GPTU_CLC_DISR_SET(1); -+ -+ clk_enable(clk); -+} -+ -+int lq_request_timer(unsigned int timer, unsigned int flag, -+ unsigned long value, unsigned long arg1, unsigned long arg2) -+{ -+ int ret = 0; -+ unsigned int con_reg, irnen_reg; -+ int n, X; -+ -+ if (timer >= FIRST_TIMER + timer_dev.number_of_timers) -+ return -EINVAL; -+ -+ printk(KERN_INFO "request_timer(%d, 0x%08X, %lu)...", -+ timer, flag, value); -+ -+ if (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT) -+ value &= 0xFFFF; -+ else -+ timer &= ~0x01; -+ -+ mutex_lock(&timer_dev.gptu_mutex); -+ -+ /* -+ * Allocate timer. -+ */ -+ if (timer < FIRST_TIMER) { -+ unsigned int mask; -+ unsigned int shift; -+ /* This takes care of TIMER1B which is the only choice for Voice TAPI system */ -+ unsigned int offset = TIMER2A; -+ -+ /* -+ * Pick up a free timer. -+ */ -+ if (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT) { -+ mask = 1 << offset; -+ shift = 1; -+ } else { -+ mask = 3 << offset; -+ shift = 2; -+ } -+ for (timer = offset; -+ timer < offset + timer_dev.number_of_timers; -+ timer += shift, mask <<= shift) -+ if (!(timer_dev.occupation & mask)) { -+ timer_dev.occupation |= mask; -+ break; -+ } -+ if (timer >= offset + timer_dev.number_of_timers) { -+ printk("failed![%d]\n", __LINE__); -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EINVAL; -+ } else -+ ret = timer; -+ } else { -+ register unsigned int mask; -+ -+ /* -+ * Check if the requested timer is free. -+ */ -+ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; -+ if ((timer_dev.occupation & mask)) { -+ printk("failed![%d] mask %#x, timer_dev.occupation %#x\n", -+ __LINE__, mask, timer_dev.occupation); -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EBUSY; -+ } else { -+ timer_dev.occupation |= mask; -+ ret = 0; -+ } -+ } -+ -+ /* -+ * Prepare control register value. -+ */ -+ switch (TIMER_FLAG_MASK_EDGE(flag)) { -+ default: -+ case TIMER_FLAG_NONE_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x00); -+ break; -+ case TIMER_FLAG_RISE_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x01); -+ break; -+ case TIMER_FLAG_FALL_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x02); -+ break; -+ case TIMER_FLAG_ANY_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x03); -+ break; -+ } -+ if (TIMER_FLAG_MASK_TYPE(flag) == TIMER_FLAG_TIMER) -+ con_reg |= -+ TIMER_FLAG_MASK_SRC(flag) == -+ TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EXT_SET(1) : -+ GPTU_CON_SRC_EXT_SET(0); -+ else -+ con_reg |= -+ TIMER_FLAG_MASK_SRC(flag) == -+ TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EG_SET(1) : -+ GPTU_CON_SRC_EG_SET(0); -+ con_reg |= -+ TIMER_FLAG_MASK_SYNC(flag) == -+ TIMER_FLAG_UNSYNC ? GPTU_CON_SYNC_SET(0) : -+ GPTU_CON_SYNC_SET(1); -+ con_reg |= -+ TIMER_FLAG_MASK_INVERT(flag) == -+ TIMER_FLAG_REAL ? GPTU_CON_INV_SET(0) : GPTU_CON_INV_SET(1); -+ con_reg |= -+ TIMER_FLAG_MASK_SIZE(flag) == -+ TIMER_FLAG_16BIT ? GPTU_CON_EXT_SET(0) : -+ GPTU_CON_EXT_SET(1); -+ con_reg |= -+ TIMER_FLAG_MASK_STOP(flag) == -+ TIMER_FLAG_ONCE ? GPTU_CON_STP_SET(1) : GPTU_CON_STP_SET(0); -+ con_reg |= -+ TIMER_FLAG_MASK_TYPE(flag) == -+ TIMER_FLAG_TIMER ? GPTU_CON_CNT_SET(0) : -+ GPTU_CON_CNT_SET(1); -+ con_reg |= -+ TIMER_FLAG_MASK_DIR(flag) == -+ TIMER_FLAG_UP ? GPTU_CON_DIR_SET(1) : GPTU_CON_DIR_SET(0); -+ -+ /* -+ * Fill up running data. -+ */ -+ timer_dev.timer[timer - FIRST_TIMER].flag = flag; -+ timer_dev.timer[timer - FIRST_TIMER].arg1 = arg1; -+ timer_dev.timer[timer - FIRST_TIMER].arg2 = arg2; -+ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) -+ timer_dev.timer[timer - FIRST_TIMER + 1].flag = flag; -+ -+ /* -+ * Enable GPTU module. -+ */ -+ if (!timer_dev.f_gptu_on) { -+ lq_enable_gptu(); -+ timer_dev.f_gptu_on = 1; -+ } -+ -+ /* -+ * Enable IRQ. -+ */ -+ if (TIMER_FLAG_MASK_HANDLE(flag) != TIMER_FLAG_NO_HANDLE) { -+ if (TIMER_FLAG_MASK_HANDLE(flag) == TIMER_FLAG_SIGNAL) -+ timer_dev.timer[timer - FIRST_TIMER].arg1 = -+ (unsigned long) find_task_by_vpid((int) arg1); -+ -+ irnen_reg = 1 << (timer - FIRST_TIMER); -+ -+ if (TIMER_FLAG_MASK_HANDLE(flag) == TIMER_FLAG_SIGNAL -+ || (TIMER_FLAG_MASK_HANDLE(flag) == -+ TIMER_FLAG_CALLBACK_IN_IRQ -+ && timer_dev.timer[timer - FIRST_TIMER].arg1)) { -+ enable_irq(timer_dev.timer[timer - FIRST_TIMER].irq); -+ timer_dev.timer[timer - FIRST_TIMER].f_irq_on = 1; -+ } -+ } else -+ irnen_reg = 0; -+ -+ /* -+ * Write config register, reload value and enable interrupt. -+ */ -+ n = timer >> 1; -+ X = timer & 0x01; -+ *LQ_GPTU_CON(n, X) = con_reg; -+ *LQ_GPTU_RELOAD(n, X) = value; -+ /* printk("reload value = %d\n", (u32)value); */ -+ *LQ_GPTU_IRNEN |= irnen_reg; -+ -+ mutex_unlock(&timer_dev.gptu_mutex); -+ printk("successful!\n"); -+ return ret; -+} -+EXPORT_SYMBOL(lq_request_timer); -+ -+int lq_free_timer(unsigned int timer) -+{ -+ unsigned int flag; -+ unsigned int mask; -+ int n, X; -+ -+ if (!timer_dev.f_gptu_on) -+ return -EINVAL; -+ -+ if (timer < FIRST_TIMER || timer >= FIRST_TIMER + timer_dev.number_of_timers) -+ return -EINVAL; -+ -+ mutex_lock(&timer_dev.gptu_mutex); -+ -+ flag = timer_dev.timer[timer - FIRST_TIMER].flag; -+ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) -+ timer &= ~0x01; -+ -+ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; -+ if (((timer_dev.occupation & mask) ^ mask)) { -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EINVAL; -+ } -+ -+ n = timer >> 1; -+ X = timer & 0x01; -+ -+ if (GPTU_CON_EN(n, X)) -+ *LQ_GPTU_RUN(n, X) = GPTU_RUN_CEN_SET(1); -+ -+ *LQ_GPTU_IRNEN &= ~GPTU_IRNEN_TC_SET(n, X, 1); -+ *LQ_GPTU_IRNCR |= GPTU_IRNCR_TC_SET(n, X, 1); -+ -+ if (timer_dev.timer[timer - FIRST_TIMER].f_irq_on) { -+ disable_irq(timer_dev.timer[timer - FIRST_TIMER].irq); -+ timer_dev.timer[timer - FIRST_TIMER].f_irq_on = 0; -+ } -+ -+ timer_dev.occupation &= ~mask; -+ if (!timer_dev.occupation && timer_dev.f_gptu_on) { -+ lq_disable_gptu(); -+ timer_dev.f_gptu_on = 0; -+ } -+ -+ mutex_unlock(&timer_dev.gptu_mutex); -+ -+ return 0; -+} -+EXPORT_SYMBOL(lq_free_timer); -+ -+int lq_start_timer(unsigned int timer, int is_resume) -+{ -+ unsigned int flag; -+ unsigned int mask; -+ int n, X; -+ -+ if (!timer_dev.f_gptu_on) -+ return -EINVAL; -+ -+ if (timer < FIRST_TIMER || timer >= FIRST_TIMER + timer_dev.number_of_timers) -+ return -EINVAL; -+ -+ mutex_lock(&timer_dev.gptu_mutex); -+ -+ flag = timer_dev.timer[timer - FIRST_TIMER].flag; -+ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) -+ timer &= ~0x01; -+ -+ mask = (TIMER_FLAG_MASK_SIZE(flag) == -+ TIMER_FLAG_16BIT ? 1 : 3) << timer; -+ if (((timer_dev.occupation & mask) ^ mask)) { -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EINVAL; -+ } -+ -+ n = timer >> 1; -+ X = timer & 0x01; -+ -+ *LQ_GPTU_RUN(n, X) = GPTU_RUN_RL_SET(!is_resume) | GPTU_RUN_SEN_SET(1); -+ -+ -+ mutex_unlock(&timer_dev.gptu_mutex); -+ -+ return 0; -+} -+EXPORT_SYMBOL(lq_start_timer); -+ -+int lq_stop_timer(unsigned int timer) -+{ -+ unsigned int flag; -+ unsigned int mask; -+ int n, X; -+ -+ if (!timer_dev.f_gptu_on) -+ return -EINVAL; -+ -+ if (timer < FIRST_TIMER -+ || timer >= FIRST_TIMER + timer_dev.number_of_timers) -+ return -EINVAL; -+ -+ mutex_lock(&timer_dev.gptu_mutex); -+ -+ flag = timer_dev.timer[timer - FIRST_TIMER].flag; -+ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) -+ timer &= ~0x01; -+ -+ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; -+ if (((timer_dev.occupation & mask) ^ mask)) { -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EINVAL; -+ } -+ -+ n = timer >> 1; -+ X = timer & 0x01; -+ -+ *LQ_GPTU_RUN(n, X) = GPTU_RUN_CEN_SET(1); -+ -+ mutex_unlock(&timer_dev.gptu_mutex); -+ -+ return 0; -+} -+EXPORT_SYMBOL(lq_stop_timer); -+ -+int lq_reset_counter_flags(u32 timer, u32 flags) -+{ -+ unsigned int oflag; -+ unsigned int mask, con_reg; -+ int n, X; -+ -+ if (!timer_dev.f_gptu_on) -+ return -EINVAL; -+ -+ if (timer < FIRST_TIMER || timer >= FIRST_TIMER + timer_dev.number_of_timers) -+ return -EINVAL; -+ -+ mutex_lock(&timer_dev.gptu_mutex); -+ -+ oflag = timer_dev.timer[timer - FIRST_TIMER].flag; -+ if (TIMER_FLAG_MASK_SIZE(oflag) != TIMER_FLAG_16BIT) -+ timer &= ~0x01; -+ -+ mask = (TIMER_FLAG_MASK_SIZE(oflag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; -+ if (((timer_dev.occupation & mask) ^ mask)) { -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EINVAL; -+ } -+ -+ switch (TIMER_FLAG_MASK_EDGE(flags)) { -+ default: -+ case TIMER_FLAG_NONE_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x00); -+ break; -+ case TIMER_FLAG_RISE_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x01); -+ break; -+ case TIMER_FLAG_FALL_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x02); -+ break; -+ case TIMER_FLAG_ANY_EDGE: -+ con_reg = GPTU_CON_EDGE_SET(0x03); -+ break; -+ } -+ if (TIMER_FLAG_MASK_TYPE(flags) == TIMER_FLAG_TIMER) -+ con_reg |= TIMER_FLAG_MASK_SRC(flags) == TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EXT_SET(1) : GPTU_CON_SRC_EXT_SET(0); -+ else -+ con_reg |= TIMER_FLAG_MASK_SRC(flags) == TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EG_SET(1) : GPTU_CON_SRC_EG_SET(0); -+ con_reg |= TIMER_FLAG_MASK_SYNC(flags) == TIMER_FLAG_UNSYNC ? GPTU_CON_SYNC_SET(0) : GPTU_CON_SYNC_SET(1); -+ con_reg |= TIMER_FLAG_MASK_INVERT(flags) == TIMER_FLAG_REAL ? GPTU_CON_INV_SET(0) : GPTU_CON_INV_SET(1); -+ con_reg |= TIMER_FLAG_MASK_SIZE(flags) == TIMER_FLAG_16BIT ? GPTU_CON_EXT_SET(0) : GPTU_CON_EXT_SET(1); -+ con_reg |= TIMER_FLAG_MASK_STOP(flags) == TIMER_FLAG_ONCE ? GPTU_CON_STP_SET(1) : GPTU_CON_STP_SET(0); -+ con_reg |= TIMER_FLAG_MASK_TYPE(flags) == TIMER_FLAG_TIMER ? GPTU_CON_CNT_SET(0) : GPTU_CON_CNT_SET(1); -+ con_reg |= TIMER_FLAG_MASK_DIR(flags) == TIMER_FLAG_UP ? GPTU_CON_DIR_SET(1) : GPTU_CON_DIR_SET(0); -+ -+ timer_dev.timer[timer - FIRST_TIMER].flag = flags; -+ if (TIMER_FLAG_MASK_SIZE(flags) != TIMER_FLAG_16BIT) -+ timer_dev.timer[timer - FIRST_TIMER + 1].flag = flags; -+ -+ n = timer >> 1; -+ X = timer & 0x01; -+ -+ *LQ_GPTU_CON(n, X) = con_reg; -+ smp_wmb(); -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return 0; -+} -+EXPORT_SYMBOL(lq_reset_counter_flags); -+ -+int lq_get_count_value(unsigned int timer, unsigned long *value) -+{ -+ unsigned int flag; -+ unsigned int mask; -+ int n, X; -+ -+ if (!timer_dev.f_gptu_on) -+ return -EINVAL; -+ -+ if (timer < FIRST_TIMER -+ || timer >= FIRST_TIMER + timer_dev.number_of_timers) -+ return -EINVAL; -+ -+ mutex_lock(&timer_dev.gptu_mutex); -+ -+ flag = timer_dev.timer[timer - FIRST_TIMER].flag; -+ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) -+ timer &= ~0x01; -+ -+ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; -+ if (((timer_dev.occupation & mask) ^ mask)) { -+ mutex_unlock(&timer_dev.gptu_mutex); -+ return -EINVAL; -+ } -+ -+ n = timer >> 1; -+ X = timer & 0x01; -+ -+ *value = *LQ_GPTU_COUNT(n, X); -+ -+ -+ mutex_unlock(&timer_dev.gptu_mutex); -+ -+ return 0; -+} -+EXPORT_SYMBOL(lq_get_count_value); -+ -+u32 lq_cal_divider(unsigned long freq) -+{ -+ u64 module_freq, fpi = ltq_get_fpi_bus_clock(2); -+ u32 clock_divider = 1; -+ module_freq = fpi * 1000; -+ do_div(module_freq, clock_divider * freq); -+ return module_freq; -+} -+EXPORT_SYMBOL(lq_cal_divider); -+ -+int lq_set_timer(unsigned int timer, unsigned int freq, int is_cyclic, -+ int is_ext_src, unsigned int handle_flag, unsigned long arg1, -+ unsigned long arg2) -+{ -+ unsigned long divider; -+ unsigned int flag; -+ -+ divider = lq_cal_divider(freq); -+ if (divider == 0) -+ return -EINVAL; -+ flag = ((divider & ~0xFFFF) ? TIMER_FLAG_32BIT : TIMER_FLAG_16BIT) -+ | (is_cyclic ? TIMER_FLAG_CYCLIC : TIMER_FLAG_ONCE) -+ | (is_ext_src ? TIMER_FLAG_EXT_SRC : TIMER_FLAG_INT_SRC) -+ | TIMER_FLAG_TIMER | TIMER_FLAG_DOWN -+ | TIMER_FLAG_MASK_HANDLE(handle_flag); -+ -+ printk(KERN_INFO "lq_set_timer(%d, %d), divider = %lu\n", -+ timer, freq, divider); -+ return lq_request_timer(timer, flag, divider, arg1, arg2); -+} -+EXPORT_SYMBOL(lq_set_timer); -+ -+int lq_set_counter(unsigned int timer, unsigned int flag, u32 reload, -+ unsigned long arg1, unsigned long arg2) -+{ -+ printk(KERN_INFO "lq_set_counter(%d, %#x, %d)\n", timer, flag, reload); -+ return lq_request_timer(timer, flag, reload, arg1, arg2); -+} -+EXPORT_SYMBOL(lq_set_counter); -+ -+static long gptu_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ int ret; -+ struct gptu_ioctl_param param; -+ -+ if (!access_ok(VERIFY_READ, arg, sizeof(struct gptu_ioctl_param))) -+ return -EFAULT; -+ copy_from_user(¶m, (void *) arg, sizeof(param)); -+ -+ if ((((cmd == GPTU_REQUEST_TIMER || cmd == GPTU_SET_TIMER -+ || GPTU_SET_COUNTER) && param.timer < 2) -+ || cmd == GPTU_GET_COUNT_VALUE || cmd == GPTU_CALCULATE_DIVIDER) -+ && !access_ok(VERIFY_WRITE, arg, -+ sizeof(struct gptu_ioctl_param))) -+ return -EFAULT; -+ -+ switch (cmd) { -+ case GPTU_REQUEST_TIMER: -+ ret = lq_request_timer(param.timer, param.flag, param.value, -+ (unsigned long) param.pid, -+ (unsigned long) param.sig); -+ if (ret > 0) { -+ copy_to_user(&((struct gptu_ioctl_param *) arg)-> -+ timer, &ret, sizeof(&ret)); -+ ret = 0; -+ } -+ break; -+ case GPTU_FREE_TIMER: -+ ret = lq_free_timer(param.timer); -+ break; -+ case GPTU_START_TIMER: -+ ret = lq_start_timer(param.timer, param.flag); -+ break; -+ case GPTU_STOP_TIMER: -+ ret = lq_stop_timer(param.timer); -+ break; -+ case GPTU_GET_COUNT_VALUE: -+ ret = lq_get_count_value(param.timer, ¶m.value); -+ if (!ret) -+ copy_to_user(&((struct gptu_ioctl_param *) arg)-> -+ value, ¶m.value, -+ sizeof(param.value)); -+ break; -+ case GPTU_CALCULATE_DIVIDER: -+ param.value = lq_cal_divider(param.value); -+ if (param.value == 0) -+ ret = -EINVAL; -+ else { -+ copy_to_user(&((struct gptu_ioctl_param *) arg)-> -+ value, ¶m.value, -+ sizeof(param.value)); -+ ret = 0; -+ } -+ break; -+ case GPTU_SET_TIMER: -+ ret = lq_set_timer(param.timer, param.value, -+ TIMER_FLAG_MASK_STOP(param.flag) != -+ TIMER_FLAG_ONCE ? 1 : 0, -+ TIMER_FLAG_MASK_SRC(param.flag) == -+ TIMER_FLAG_EXT_SRC ? 1 : 0, -+ TIMER_FLAG_MASK_HANDLE(param.flag) == -+ TIMER_FLAG_SIGNAL ? TIMER_FLAG_SIGNAL : -+ TIMER_FLAG_NO_HANDLE, -+ (unsigned long) param.pid, -+ (unsigned long) param.sig); -+ if (ret > 0) { -+ copy_to_user(&((struct gptu_ioctl_param *) arg)-> -+ timer, &ret, sizeof(&ret)); -+ ret = 0; -+ } -+ break; -+ case GPTU_SET_COUNTER: -+ lq_set_counter(param.timer, param.flag, param.value, 0, 0); -+ if (ret > 0) { -+ copy_to_user(&((struct gptu_ioctl_param *) arg)-> -+ timer, &ret, sizeof(&ret)); -+ ret = 0; -+ } -+ break; -+ default: -+ ret = -ENOTTY; -+ } -+ -+ return ret; -+} -+ -+static int gptu_open(struct inode *inode, struct file *file) -+{ -+ return 0; -+} -+ -+static int gptu_release(struct inode *inode, struct file *file) -+{ -+ return 0; -+} -+ -+int __init lq_gptu_init(void) -+{ -+ int ret; -+ unsigned int i; -+ -+ ltq_w32(0, LQ_GPTU_IRNEN); -+ ltq_w32(0xfff, LQ_GPTU_IRNCR); -+ -+ memset(&timer_dev, 0, sizeof(timer_dev)); -+ mutex_init(&timer_dev.gptu_mutex); -+ -+ lq_enable_gptu(); -+ timer_dev.number_of_timers = GPTU_ID_CFG * 2; -+ lq_disable_gptu(); -+ if (timer_dev.number_of_timers > MAX_NUM_OF_32BIT_TIMER_BLOCKS * 2) -+ timer_dev.number_of_timers = MAX_NUM_OF_32BIT_TIMER_BLOCKS * 2; -+ printk(KERN_INFO "gptu: totally %d 16-bit timers/counters\n", timer_dev.number_of_timers); -+ -+ ret = misc_register(&gptu_miscdev); -+ if (ret) { -+ printk(KERN_ERR "gptu: can't misc_register, get error %d\n", -ret); -+ return ret; -+ } else { -+ printk(KERN_INFO "gptu: misc_register on minor %d\n", gptu_miscdev.minor); -+ } -+ -+ for (i = 0; i < timer_dev.number_of_timers; i++) { -+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]); -+ if (ret) { -+ for (; i >= 0; i--) -+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]); -+ misc_deregister(&gptu_miscdev); -+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret); -+ return ret; -+ } else { -+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i; -+ disable_irq(timer_dev.timer[i].irq); -+ printk(KERN_INFO "gptu: succeeded to request irq %d\n", timer_dev.timer[i].irq); -+ } -+ } -+ -+ return 0; -+} -+ -+void __exit lq_gptu_exit(void) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < timer_dev.number_of_timers; i++) { -+ if (timer_dev.timer[i].f_irq_on) -+ disable_irq(timer_dev.timer[i].irq); -+ free_irq(timer_dev.timer[i].irq, &timer_dev.timer[i]); -+ } -+ lq_disable_gptu(); -+ misc_deregister(&gptu_miscdev); -+} -+ -+module_init(lq_gptu_init); -+module_exit(lq_gptu_exit); -+ -+#endif diff --git a/target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch b/target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch deleted file mode 100644 index b97967d20..000000000 --- a/target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 997a8965db8417266bea3fbdcfa3e5655a1b52fa Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 9 Sep 2014 23:12:15 +0200 -Subject: [PATCH 18/36] MTD: nand: lots of xrx200 fixes - -Signed-off-by: John Crispin ---- - drivers/mtd/nand/xway_nand.c | 63 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 63 insertions(+) - ---- a/drivers/mtd/nand/xway_nand.c -+++ b/drivers/mtd/nand/xway_nand.c -@@ -63,6 +63,24 @@ - #define NAND_CON_CSMUX (1 << 1) - #define NAND_CON_NANDM 1 - -+#define DANUBE_PCI_REG32( addr ) (*(volatile u32 *)(addr)) -+#define PCI_CR_PR_OFFSET (KSEG1+0x1E105400) -+#define PCI_CR_PC_ARB (PCI_CR_PR_OFFSET + 0x0080) -+ -+/* -+ * req_mask provides a mechanism to prevent interference between -+ * nand and pci (probably only relevant for the BT Home Hub 2B). -+ * Setting it causes the corresponding pci req pins to be masked -+ * during nand access, and also moves ebu locking from the read/write -+ * functions to the chip select function to ensure that the whole -+ * operation runs with interrupts disabled. -+ * In addition it switches on some extra waiting in xway_cmd_ctrl(). -+ * This seems to be necessary if the ebu_cs1 pin has open-drain disabled, -+ * which in turn seems to be necessary for the nor chip to be recognised -+ * reliably, on a board (Home Hub 2B again) which has both nor and nand. -+ */ -+static __be32 req_mask = 0; -+ - struct xway_nand_data { - struct nand_chip chip; - unsigned long csflags; -@@ -94,10 +112,22 @@ static void xway_select_chip(struct mtd_ - case -1: - ltq_ebu_w32_mask(NAND_CON_CE, 0, EBU_NAND_CON); - ltq_ebu_w32_mask(NAND_CON_NANDM, 0, EBU_NAND_CON); -+ -+ if (req_mask) { -+ /* Unmask all external PCI request */ -+ DANUBE_PCI_REG32(PCI_CR_PC_ARB) &= ~(req_mask << 16); -+ } -+ - spin_unlock_irqrestore(&ebu_lock, data->csflags); - break; - case 0: - spin_lock_irqsave(&ebu_lock, data->csflags); -+ -+ if (req_mask) { -+ /* Mask all external PCI request */ -+ DANUBE_PCI_REG32(PCI_CR_PC_ARB) |= (req_mask << 16); -+ } -+ - ltq_ebu_w32_mask(0, NAND_CON_NANDM, EBU_NAND_CON); - ltq_ebu_w32_mask(0, NAND_CON_CE, EBU_NAND_CON); - break; -@@ -108,6 +138,12 @@ static void xway_select_chip(struct mtd_ - - static void xway_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) - { -+ -+ if (req_mask) { -+ if (cmd != NAND_CMD_STATUS) -+ ltq_ebu_w32(0, EBU_NAND_WAIT); /* Clear nand ready */ -+ } -+ - if (cmd == NAND_CMD_NONE) - return; - -@@ -118,6 +154,24 @@ static void xway_cmd_ctrl(struct mtd_inf - - while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0) - ; -+ -+ if (req_mask) { -+ /* -+ * program and erase have their own busy handlers -+ * status and sequential in needs no delay -+ */ -+ switch (cmd) { -+ case NAND_CMD_ERASE1: -+ case NAND_CMD_SEQIN: -+ case NAND_CMD_STATUS: -+ case NAND_CMD_READID: -+ return; -+ } -+ -+ /* wait until command is processed */ -+ while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_RD) == 0) -+ ; -+ } - } - - static int xway_dev_ready(struct mtd_info *mtd) -@@ -157,6 +211,7 @@ static int xway_nand_probe(struct platfo - int err; - u32 cs; - u32 cs_flag = 0; -+ const __be32 *req_mask_ptr; - - /* Allocate memory for the device structure (and zero it) */ - data = devm_kzalloc(&pdev->dev, sizeof(struct xway_nand_data), -@@ -192,6 +247,15 @@ static int xway_nand_probe(struct platfo - if (!err && cs == 1) - cs_flag = NAND_CON_IN_CS1 | NAND_CON_OUT_CS1; - -+ req_mask_ptr = of_get_property(pdev->dev.of_node, -+ "req-mask", NULL); -+ -+ /* -+ * Load the PCI req lines to mask from the device tree. If the -+ * property is not present, setting req_mask to 0 disables masking. -+ */ -+ req_mask = (req_mask_ptr ? *req_mask_ptr : 0); -+ - /* setup the EBU to run in NAND mode on our base addr */ - ltq_ebu_w32(CPHYSADDR(data->nandaddr) - | ADDSEL1_MASK(3) | ADDSEL1_REGEN, EBU_ADDSEL1); diff --git a/target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch b/target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch deleted file mode 100644 index 64bf2aaca..000000000 --- a/target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e3b20f04e9f9cae1babe091fdc1d08d7703ae344 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 7 Aug 2014 18:18:00 +0200 -Subject: [PATCH 20/36] MTD: lantiq: handle NO_XIP on cfi0001 flash - -Signed-off-by: John Crispin ---- - drivers/mtd/maps/lantiq-flash.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/maps/lantiq-flash.c -+++ b/drivers/mtd/maps/lantiq-flash.c -@@ -137,7 +137,11 @@ ltq_mtd_probe(struct platform_device *pd - if (!ltq_mtd->map) - return -ENOMEM; - -- ltq_mtd->map->phys = ltq_mtd->res->start; -+ if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) -+ ltq_mtd->map->phys = NO_XIP; -+ else -+ ltq_mtd->map->phys = ltq_mtd->res->start; -+ ltq_mtd->res->start; - ltq_mtd->map->size = resource_size(ltq_mtd->res); - ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); - if (IS_ERR(ltq_mtd->map->virt)) diff --git a/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch b/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch deleted file mode 100644 index cfeded1eb..000000000 --- a/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 4400e1f593ea40a51912128adb4f53d59e62cad8 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Wed, 10 Sep 2014 22:40:18 +0200 -Subject: [PATCH 22/36] MTD: m25p80: allow loading mtd name from OF - -In accordance with the physmap flash we should honour the linux,mtd-name -property when deciding what name the mtd device has. - -Signed-off-by: Thomas Langer -Signed-off-by: John Crispin ---- - drivers/mtd/devices/m25p80.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -201,6 +202,10 @@ static int m25p_probe(struct spi_device - enum read_mode mode = SPI_NOR_NORMAL; - char *flash_name; - int ret; -+ const char __maybe_unused *of_mtd_name = NULL; -+ -+ of_property_read_string(spi->dev.of_node, -+ "linux,mtd-name", &of_mtd_name); - - data = dev_get_platdata(&spi->dev); - -@@ -230,6 +235,8 @@ static int m25p_probe(struct spi_device - - if (data && data->name) - nor->mtd.name = data->name; -+ else if (of_mtd_name) -+ nor->mtd.name = of_mtd_name; - - /* For some (historical?) reason many platforms provide two different - * names in flash_platform_data: "name" and "type". Quite often name is diff --git a/target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch b/target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch deleted file mode 100644 index e91527759..000000000 --- a/target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch +++ /dev/null @@ -1,294 +0,0 @@ -From 0a63ab263725c427051a8bbaa0732b749627da27 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 7 Aug 2014 18:15:36 +0200 -Subject: [PATCH 23/36] NET: PHY: adds driver for lantiq PHY11G - -Signed-off-by: John Crispin ---- - drivers/net/phy/Kconfig | 5 + - drivers/net/phy/Makefile | 1 + - drivers/net/phy/lantiq.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 237 insertions(+) - create mode 100644 drivers/net/phy/lantiq.c - ---- a/drivers/net/phy/intel-xway.c -+++ b/drivers/net/phy/intel-xway.c -@@ -152,6 +152,51 @@ - #define PHY_ID_PHY11G_VR9 0xD565A409 - #define PHY_ID_PHY22F_VR9 0xD565A419 - -+#if IS_ENABLED(CONFIG_OF_MDIO) -+static int vr9_gphy_of_reg_init(struct phy_device *phydev) -+{ -+ u32 tmp; -+ -+ /* store the led values if one was passed by the devicetree */ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,ledch", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LEDCH, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,ledcl", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LEDCL, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led0h", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED0H, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led0l", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED0L, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led1h", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED1H, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led1l", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED1L, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led2h", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3H, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led2l", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3L, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led3h", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3H, MDIO_MMD_VEND2, tmp); -+ -+ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led3l", &tmp)) -+ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3L, MDIO_MMD_VEND2, tmp); -+ -+ return 0; -+} -+#else -+static int vr9_gphy_of_reg_init(struct phy_device *phydev) -+{ -+ return 0; -+} -+#endif /* CONFIG_OF_MDIO */ -+ - static int xway_gphy_config_init(struct phy_device *phydev) - { - int err; -@@ -190,6 +235,7 @@ static int xway_gphy_config_init(struct - phy_write_mmd_indirect(phydev, XWAY_MMD_LED2H, MDIO_MMD_VEND2, ledxh); - phy_write_mmd_indirect(phydev, XWAY_MMD_LED2L, MDIO_MMD_VEND2, ledxl); - -+ vr9_gphy_of_reg_init(phydev); - return 0; - } - ---- /dev/null -+++ b/Documentation/devicetree/bindings/phy/phy-lanitq.txt -@@ -0,0 +1,216 @@ -+Lanitq PHY binding -+============================================ -+ -+This devicetree binding controls the lantiq ethernet phys led functionality. -+ -+Example: -+ mdio@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "lantiq,xrx200-mdio"; -+ phy5: ethernet-phy@5 { -+ reg = <0x1>; -+ compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; -+ }; -+ phy11: ethernet-phy@11 { -+ reg = <0x11>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led2h = <0x00>; -+ lantiq,led2l = <0x03>; -+ }; -+ phy12: ethernet-phy@12 { -+ reg = <0x12>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led1h = <0x00>; -+ lantiq,led1l = <0x03>; -+ }; -+ phy13: ethernet-phy@13 { -+ reg = <0x13>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led2h = <0x00>; -+ lantiq,led2l = <0x03>; -+ }; -+ phy14: ethernet-phy@14 { -+ reg = <0x14>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led1h = <0x00>; -+ lantiq,led1l = <0x03>; -+ }; -+ }; -+ -+Register Description -+============================================ -+ -+LEDCH: -+ -+Name Hardware Reset Value -+LEDCH 0x00C5 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+| FBF | SBF |RES | NACS | -+========================================= -+ -+Field Bits Type Description -+FBF 7:6 RW Fast Blink Frequency -+ --- -+ 0x0 (00b) F02HZ 2 Hz blinking frequency -+ 0x1 (01b) F04HZ 4 Hz blinking frequency -+ 0x2 (10b) F08HZ 8 Hz blinking frequency -+ 0x3 (11b) F16HZ 16 Hz blinking frequency -+ -+SBF 5:4 RW Slow Blink Frequency -+ --- -+ 0x0 (00b) F02HZ 2 Hz blinking frequency -+ 0x1 (01b) F04HZ 4 Hz blinking frequency -+ 0x2 (10b) F08HZ 8 Hz blinking frequency -+ 0x3 (11b) F16HZ 16 Hz blinking frequency -+ -+NACS 2:0 RW Inverse of Scan Function -+ --- -+ 0x0 (000b) NONE No Function -+ 0x1 (001b) LINK Complex function enabled when link is up -+ 0x2 (010b) PDOWN Complex function enabled when device is powered-down -+ 0x3 (011b) EEE Complex function enabled when device is in EEE mode -+ 0x4 (100b) ANEG Complex function enabled when auto-negotiation is running -+ 0x5 (101b) ABIST Complex function enabled when analog self-test is running -+ 0x6 (110b) CDIAG Complex function enabled when cable diagnostics are running -+ 0x7 (111b) TEST Complex function enabled when test mode is running -+ -+LEDCL: -+ -+Name Hardware Reset Value -+LEDCL 0x0067 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+|RES | SCAN |RES | CBLINK | -+========================================= -+ -+Field Bits Type Description -+SCAN 6:4 RW Complex Scan Configuration -+ --- -+ 000 B NONE No Function -+ 001 B LINK Complex function enabled when link is up -+ 010 B PDOWN Complex function enabled when device is powered-down -+ 011 B EEE Complex function enabled when device is in EEE mode -+ 100 B ANEG Complex function enabled when auto-negotiation is running -+ 101 B ABIST Complex function enabled when analog self-test is running -+ 110 B CDIAG Complex function enabled when cable diagnostics are running -+ 111 B TEST Complex function enabled when test mode is running -+ -+CBLINK 2:0 RW Complex Blinking Configuration -+ --- -+ 000 B NONE No Function -+ 001 B LINK Complex function enabled when link is up -+ 010 B PDOWN Complex function enabled when device is powered-down -+ 011 B EEE Complex function enabled when device is in EEE mode -+ 100 B ANEG Complex function enabled when auto-negotiation is running -+ 101 B ABIST Complex function enabled when analog self-test is running -+ 110 B CDIAG Complex function enabled when cable diagnostics are running -+ 111 B TEST Complex function enabled when test mode is running -+ -+LEDxH: -+ -+Name Hardware Reset Value -+LED0H 0x0070 -+LED1H 0x0020 -+LED2H 0x0040 -+LED3H 0x0040 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+| CON | BLINKF | -+========================================= -+ -+Field Bits Type Description -+CON 7:4 RW Constant On Configuration -+ --- -+ 0x0 (0000b) NONE LED does not light up constantly -+ 0x1 (0001b) LINK10 LED is on when link is 10 Mbit/s -+ 0x2 (0010b) LINK100 LED is on when link is 100 Mbit/s -+ 0x3 (0011b) LINK10X LED is on when link is 10/100 Mbit/s -+ 0x4 (0100b) LINK1000 LED is on when link is 1000 Mbit/s -+ 0x5 (0101b) LINK10_0 LED is on when link is 10/1000 Mbit/s -+ 0x6 (0110b) LINK100X LED is on when link is 100/1000 Mbit/s -+ 0x7 (0111b) LINK10XX LED is on when link is 10/100/1000 Mbit/s -+ 0x8 (1000b) PDOWN LED is on when device is powered-down -+ 0x9 (1001b) EEE LED is on when device is in EEE mode -+ 0xA (1010b) ANEG LED is on when auto-negotiation is running -+ 0xB (1011b) ABIST LED is on when analog self-test is running -+ 0xC (1100b) CDIAG LED is on when cable diagnostics are running -+ -+BLINKF 3:0 RW Fast Blinking Configuration -+ --- -+ 0x0 (0000b) NONE No Blinking -+ 0x1 (0001b) LINK10 Blink when link is 10 Mbit/s -+ 0x2 (0010b) LINK100 Blink when link is 100 Mbit/s -+ 0x3 (0011b) LINK10X Blink when link is 10/100 Mbit/s -+ 0x4 (0100b) LINK1000 Blink when link is 1000 Mbit/s -+ 0x5 (0101b) LINK10_0 Blink when link is 10/1000 Mbit/s -+ 0x6 (0110b) LINK100X Blink when link is 100/1000 Mbit/s -+ 0x7 (0111b) LINK10XX Blink when link is 10/100/1000 Mbit/s -+ 0x8 (1000b) PDOWN Blink when device is powered-down -+ 0x9 (1001b) EEE Blink when device is in EEE mode -+ 0xA (1010b) ANEG Blink when auto-negotiation is running -+ 0xB (1011b) ABIST Blink when analog self-test is running -+ 0xC (1100b) CDIAG Blink when cable diagnostics are running -+ -+LEDxL: -+ -+Name Hardware Reset Value -+LED0L 0x0003 -+LED1L 0x0000 -+LED2L 0x0000 -+LED3L 0x0020 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+| BLINKS | PULSE | -+========================================= -+ -+Field Bits Type Description -+BLINKS 7:4 RW Slow Blinkin Configuration -+ --- -+ 0x0 (0000b) NONE No Blinking -+ 0x1 (0001b) LINK10 Blink when link is 10 Mbit/s -+ 0x2 (0010b) LINK100 Blink when link is 100 Mbit/s -+ 0x3 (0011b) LINK10X Blink when link is 10/100 Mbit/s -+ 0x4 (0100b) LINK1000 Blink when link is 1000 Mbit/s -+ 0x5 (0101b) LINK10_0 Blink when link is 10/1000 Mbit/s -+ 0x6 (0110b) LINK100X Blink when link is 100/1000 Mbit/s -+ 0x7 (0111b) LINK10XX Blink when link is 10/100/1000 Mbit/s -+ 0x8 (1000b) PDOWN Blink when device is powered-down -+ 0x9 (1001b) EEE Blink when device is in EEE mode -+ 0xA (1010b) ANEG Blink when auto-negotiation is running -+ 0xB (1011b) ABIST Blink when analog self-test is running -+ 0xC (1100b) CDIAG Blink when cable diagnostics are runningning -+ -+PULSE 3:0 RW Pulsing Configuration -+ The pulse field is a mask field by which certain events can be combined -+ --- -+ 0x0 (0000b) NONE No pulsing -+ 0x1 (0001b) TXACT Transmit activity -+ 0x2 (0010b) RXACT Receive activity -+ 0x4 (0100b) COL Collision -+ 0x8 (1000b) RES Reserved diff --git a/target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch b/target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch deleted file mode 100644 index e62ff2f69..000000000 --- a/target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch +++ /dev/null @@ -1,364 +0,0 @@ -From 77e89d5a28be35058041c79e9874ab26f222c603 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Mon, 22 Oct 2012 09:26:24 +0200 -Subject: [PATCH 24/36] NET: lantiq: adds PHY11G firmware blobs - -Signed-off-by: John Crispin ---- - firmware/Makefile | 4 + - firmware/lantiq/COPYING | 286 +++++++++++++++++++++++++++++++++++++++++++++++ - firmware/lantiq/README | 45 ++++++++ - 3 files changed, 335 insertions(+) - create mode 100644 firmware/lantiq/COPYING - create mode 100644 firmware/lantiq/README - ---- a/firmware/Makefile -+++ b/firmware/Makefile -@@ -134,6 +134,10 @@ fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_P - fw-shipped-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda/xircom_pgs.fw - fw-shipped-$(CONFIG_USB_VICAM) += vicam/firmware.fw - fw-shipped-$(CONFIG_VIDEO_CPIA2) += cpia2/stv0672_vp4.bin -+fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy11g_a14.bin -+fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy11g_a22.bin -+fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy22f_a14.bin -+fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy22f_a22.bin - fw-shipped-$(CONFIG_YAM) += yam/1200.bin yam/9600.bin - - fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-) ---- /dev/null -+++ b/firmware/lantiq/COPYING -@@ -0,0 +1,286 @@ -+All firmware files are copyrighted by Lantiq Deutschland GmbH. -+The files have been extracted from header files found in Lantiq BSPs. -+If not stated otherwise all files are licensed under GPL. -+ -+======================================================================= -+ -+ GNU GENERAL PUBLIC LICENSE -+ Version 2, June 1991 -+ -+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. -+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+ Preamble -+ -+ The licenses for most software are designed to take away your -+freedom to share and change it. By contrast, the GNU General Public -+License is intended to guarantee your freedom to share and change free -+software--to make sure the software is free for all its users. This -+General Public License applies to most of the Free Software -+Foundation's software and to any other program whose authors commit to -+using it. (Some other Free Software Foundation software is covered by -+the GNU Library General Public License instead.) You can apply it to -+your programs, too. -+ -+ When we speak of free software, we are referring to freedom, not -+price. Our General Public Licenses are designed to make sure that you -+have the freedom to distribute copies of free software (and charge for -+this service if you wish), that you receive source code or can get it -+if you want it, that you can change the software or use pieces of it -+in new free programs; and that you know you can do these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+anyone to deny you these rights or to ask you to surrender the rights. -+These restrictions translate to certain responsibilities for you if you -+distribute copies of the software, or if you modify it. -+ -+ For example, if you distribute copies of such a program, whether -+gratis or for a fee, you must give the recipients all the rights that -+you have. You must make sure that they, too, receive or can get the -+source code. And you must show them these terms so they know their -+rights. -+ -+ We protect your rights with two steps: (1) copyright the software, and -+(2) offer you this license which gives you legal permission to copy, -+distribute and/or modify the software. -+ -+ Also, for each author's protection and ours, we want to make certain -+that everyone understands that there is no warranty for this free -+software. If the software is modified by someone else and passed on, we -+want its recipients to know that what they have is not the original, so -+that any problems introduced by others will not reflect on the original -+authors' reputations. -+ -+ Finally, any free program is threatened constantly by software -+patents. We wish to avoid the danger that redistributors of a free -+program will individually obtain patent licenses, in effect making the -+program proprietary. To prevent this, we have made it clear that any -+patent must be licensed for everyone's free use or not licensed at all. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. -+ -+ GNU GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License applies to any program or other work which contains -+a notice placed by the copyright holder saying it may be distributed -+under the terms of this General Public License. The "Program", below, -+refers to any such program or work, and a "work based on the Program" -+means either the Program or any derivative work under copyright law: -+that is to say, a work containing the Program or a portion of it, -+either verbatim or with modifications and/or translated into another -+language. (Hereinafter, translation is included without limitation in -+the term "modification".) Each licensee is addressed as "you". -+ -+Activities other than copying, distribution and modification are not -+covered by this License; they are outside its scope. The act of -+running the Program is not restricted, and the output from the Program -+is covered only if its contents constitute a work based on the -+Program (independent of having been made by running the Program). -+Whether that is true depends on what the Program does. -+ -+ 1. You may copy and distribute verbatim copies of the Program's -+source code as you receive it, in any medium, provided that you -+conspicuously and appropriately publish on each copy an appropriate -+copyright notice and disclaimer of warranty; keep intact all the -+notices that refer to this License and to the absence of any warranty; -+and give any other recipients of the Program a copy of this License -+along with the Program. -+ -+You may charge a fee for the physical act of transferring a copy, and -+you may at your option offer warranty protection in exchange for a fee. -+ -+ 2. You may modify your copy or copies of the Program or any portion -+of it, thus forming a work based on the Program, and copy and -+distribute such modifications or work under the terms of Section 1 -+above, provided that you also meet all of these conditions: -+ -+ a) You must cause the modified files to carry prominent notices -+ stating that you changed the files and the date of any change. -+ -+ b) You must cause any work that you distribute or publish, that in -+ whole or in part contains or is derived from the Program or any -+ part thereof, to be licensed as a whole at no charge to all third -+ parties under the terms of this License. -+ -+ c) If the modified program normally reads commands interactively -+ when run, you must cause it, when started running for such -+ interactive use in the most ordinary way, to print or display an -+ announcement including an appropriate copyright notice and a -+ notice that there is no warranty (or else, saying that you provide -+ a warranty) and that users may redistribute the program under -+ these conditions, and telling the user how to view a copy of this -+ License. (Exception: if the Program itself is interactive but -+ does not normally print such an announcement, your work based on -+ the Program is not required to print an announcement.) -+ -+These requirements apply to the modified work as a whole. If -+identifiable sections of that work are not derived from the Program, -+and can be reasonably considered independent and separate works in -+themselves, then this License, and its terms, do not apply to those -+sections when you distribute them as separate works. But when you -+distribute the same sections as part of a whole which is a work based -+on the Program, the distribution of the whole must be on the terms of -+this License, whose permissions for other licensees extend to the -+entire whole, and thus to each and every part regardless of who wrote it. -+ -+Thus, it is not the intent of this section to claim rights or contest -+your rights to work written entirely by you; rather, the intent is to -+exercise the right to control the distribution of derivative or -+collective works based on the Program. -+ -+In addition, mere aggregation of another work not based on the Program -+with the Program (or with a work based on the Program) on a volume of -+a storage or distribution medium does not bring the other work under -+the scope of this License. -+ -+ 3. You may copy and distribute the Program (or a work based on it, -+under Section 2) in object code or executable form under the terms of -+Sections 1 and 2 above provided that you also do one of the following: -+ -+ a) Accompany it with the complete corresponding machine-readable -+ source code, which must be distributed under the terms of Sections -+ 1 and 2 above on a medium customarily used for software interchange; or, -+ -+ b) Accompany it with a written offer, valid for at least three -+ years, to give any third party, for a charge no more than your -+ cost of physically performing source distribution, a complete -+ machine-readable copy of the corresponding source code, to be -+ distributed under the terms of Sections 1 and 2 above on a medium -+ customarily used for software interchange; or, -+ -+ c) Accompany it with the information you received as to the offer -+ to distribute corresponding source code. (This alternative is -+ allowed only for noncommercial distribution and only if you -+ received the program in object code or executable form with such -+ an offer, in accord with Subsection b above.) -+ -+The source code for a work means the preferred form of the work for -+making modifications to it. For an executable work, complete source -+code means all the source code for all modules it contains, plus any -+associated interface definition files, plus the scripts used to -+control compilation and installation of the executable. However, as a -+special exception, the source code distributed need not include -+anything that is normally distributed (in either source or binary -+form) with the major components (compiler, kernel, and so on) of the -+operating system on which the executable runs, unless that component -+itself accompanies the executable. -+ -+If distribution of executable or object code is made by offering -+access to copy from a designated place, then offering equivalent -+access to copy the source code from the same place counts as -+distribution of the source code, even though third parties are not -+compelled to copy the source along with the object code. -+ -+ 4. You may not copy, modify, sublicense, or distribute the Program -+except as expressly provided under this License. Any attempt -+otherwise to copy, modify, sublicense or distribute the Program is -+void, and will automatically terminate your rights under this License. -+However, parties who have received copies, or rights, from you under -+this License will not have their licenses terminated so long as such -+parties remain in full compliance. -+ -+ 5. You are not required to accept this License, since you have not -+signed it. However, nothing else grants you permission to modify or -+distribute the Program or its derivative works. These actions are -+prohibited by law if you do not accept this License. Therefore, by -+modifying or distributing the Program (or any work based on the -+Program), you indicate your acceptance of this License to do so, and -+all its terms and conditions for copying, distributing or modifying -+the Program or works based on it. -+ -+ 6. Each time you redistribute the Program (or any work based on the -+Program), the recipient automatically receives a license from the -+original licensor to copy, distribute or modify the Program subject to -+these terms and conditions. You may not impose any further -+restrictions on the recipients' exercise of the rights granted herein. -+You are not responsible for enforcing compliance by third parties to -+this License. -+ -+ 7. If, as a consequence of a court judgment or allegation of patent -+infringement or for any other reason (not limited to patent issues), -+conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot -+distribute so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you -+may not distribute the Program at all. For example, if a patent -+license would not permit royalty-free redistribution of the Program by -+all those who receive copies directly or indirectly through you, then -+the only way you could satisfy both it and this License would be to -+refrain entirely from distribution of the Program. -+ -+If any portion of this section is held invalid or unenforceable under -+any particular circumstance, the balance of the section is intended to -+apply and the section as a whole is intended to apply in other -+circumstances. -+ -+It is not the purpose of this section to induce you to infringe any -+patents or other property right claims or to contest validity of any -+such claims; this section has the sole purpose of protecting the -+integrity of the free software distribution system, which is -+implemented by public license practices. Many people have made -+generous contributions to the wide range of software distributed -+through that system in reliance on consistent application of that -+system; it is up to the author/donor to decide if he or she is willing -+to distribute software through any other system and a licensee cannot -+impose that choice. -+ -+This section is intended to make thoroughly clear what is believed to -+be a consequence of the rest of this License. -+ -+ 8. If the distribution and/or use of the Program is restricted in -+certain countries either by patents or by copyrighted interfaces, the -+original copyright holder who places the Program under this License -+may add an explicit geographical distribution limitation excluding -+those countries, so that distribution is permitted only in or among -+countries not thus excluded. In such case, this License incorporates -+the limitation as if written in the body of this License. -+ -+ 9. The Free Software Foundation may publish revised and/or new versions -+of the General Public License from time to time. Such new versions will -+be similar in spirit to the present version, but may differ in detail to -+address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Program -+specifies a version number of this License which applies to it and "any -+later version", you have the option of following the terms and conditions -+either of that version or of any later version published by the Free -+Software Foundation. If the Program does not specify a version number of -+this License, you may choose any version ever published by the Free Software -+Foundation. -+ -+ 10. If you wish to incorporate parts of the Program into other free -+programs whose distribution conditions are different, write to the author -+to ask for permission. For software which is copyrighted by the Free -+Software Foundation, write to the Free Software Foundation; we sometimes -+make exceptions for this. Our decision will be guided by the two goals -+of preserving the free status of all derivatives of our free software and -+of promoting the sharing and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -+REPAIR OR CORRECTION. -+ -+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -+POSSIBILITY OF SUCH DAMAGES. -+ -+ END OF TERMS AND CONDITIONS ---- /dev/null -+++ b/firmware/lantiq/README -@@ -0,0 +1,45 @@ -+# -+# This program is free software; you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation; either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# (C) Copyright 2007 - 2012 -+# Lantiq Deutschland GmbH -+# -+# (C) Copyright 2012 -+# Daniel Schwierzeck -+# -+ -+# -+# How to use -+# -+Configure kernel with: -+CONFIG_FW_LOADER=y -+CONFIG_EXTRA_FIRMWARE_DIR="FIRMWARE_DIR" -+CONFIG_EXTRA_FIRMWARE="FIRMWARE_FILES" -+ -+where FIRMWARE_DIR should point to this git tree and FIRMWARE_FILES is a list -+of space separated files from list below. -+ -+# -+# Firmware files -+# -+ -+# GPHY core on Lantiq XWAY VR9 v1.1 -+lantiq/xrx200_phy11g_a14.bin -+lantiq/xrx200_phy22f_a14.bin -+ -+# GPHY core on Lantiq XWAY VR9 v1.2 -+lantiq/xrx200_phy11g_a22.bin -+lantiq/xrx200_phy22f_a22.bin diff --git a/target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch b/target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch deleted file mode 100644 index 5224e7a00..000000000 --- a/target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch +++ /dev/null @@ -1,3394 +0,0 @@ -From fb0c9601f4414c39ff68e26b88681bef0bb04954 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Mon, 22 Oct 2012 12:22:23 +0200 -Subject: [PATCH 25/36] NET: MIPS: lantiq: adds xrx200-net - ---- - drivers/net/ethernet/Kconfig | 8 +- - drivers/net/ethernet/Makefile | 1 + - drivers/net/ethernet/lantiq_pce.h | 163 +++ - drivers/net/ethernet/lantiq_xrx200.c | 1798 +++++++++++++++++++++++++++++++ - drivers/net/ethernet/lantiq_xrx200_sw.h | 1328 +++++++++++++++++++++++ - 5 files changed, 3297 insertions(+), 1 deletion(-) - create mode 100644 drivers/net/ethernet/lantiq_pce.h - create mode 100644 drivers/net/ethernet/lantiq_xrx200.c - create mode 100644 drivers/net/ethernet/lantiq_xrx200_sw.h - ---- a/drivers/net/ethernet/Kconfig -+++ b/drivers/net/ethernet/Kconfig -@@ -104,7 +104,13 @@ config LANTIQ_ETOP - tristate "Lantiq SoC ETOP driver" - depends on SOC_TYPE_XWAY - ---help--- -- Support for the MII0 inside the Lantiq SoC -+ Support for the MII0 inside the Lantiq ADSL SoC -+ -+config LANTIQ_XRX200 -+ tristate "Lantiq SoC XRX200 driver" -+ depends on SOC_TYPE_XWAY -+ ---help--- -+ Support for the MII0 inside the Lantiq VDSL SoC - - source "drivers/net/ethernet/marvell/Kconfig" - source "drivers/net/ethernet/mediatek/Kconfig" ---- a/drivers/net/ethernet/Makefile -+++ b/drivers/net/ethernet/Makefile -@@ -46,6 +46,7 @@ obj-$(CONFIG_NET_VENDOR_XSCALE) += xscal - obj-$(CONFIG_JME) += jme.o - obj-$(CONFIG_KORINA) += korina.o - obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o -+obj-$(CONFIG_LANTIQ_XRX200) += lantiq_xrx200.o - obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ - obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ - obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ ---- /dev/null -+++ b/drivers/net/ethernet/lantiq_pce.h -@@ -0,0 +1,163 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * Copyright (C) 2010 Lantiq Deutschland GmbH -+ * Copyright (C) 2012 John Crispin -+ * -+ * PCE microcode extracted from UGW5.2 switch api -+ */ -+ -+/* Switch API Micro Code V0.3 */ -+enum { -+ OUT_MAC0 = 0, -+ OUT_MAC1, -+ OUT_MAC2, -+ OUT_MAC3, -+ OUT_MAC4, -+ OUT_MAC5, -+ OUT_ETHTYP, -+ OUT_VTAG0, -+ OUT_VTAG1, -+ OUT_ITAG0, -+ OUT_ITAG1, /*10 */ -+ OUT_ITAG2, -+ OUT_ITAG3, -+ OUT_IP0, -+ OUT_IP1, -+ OUT_IP2, -+ OUT_IP3, -+ OUT_SIP0, -+ OUT_SIP1, -+ OUT_SIP2, -+ OUT_SIP3, /*20*/ -+ OUT_SIP4, -+ OUT_SIP5, -+ OUT_SIP6, -+ OUT_SIP7, -+ OUT_DIP0, -+ OUT_DIP1, -+ OUT_DIP2, -+ OUT_DIP3, -+ OUT_DIP4, -+ OUT_DIP5, /*30*/ -+ OUT_DIP6, -+ OUT_DIP7, -+ OUT_SESID, -+ OUT_PROT, -+ OUT_APP0, -+ OUT_APP1, -+ OUT_IGMP0, -+ OUT_IGMP1, -+ OUT_IPOFF, /*39*/ -+ OUT_NONE = 63 -+}; -+ -+/* parser's microcode length type */ -+#define INSTR 0 -+#define IPV6 1 -+#define LENACCU 2 -+ -+/* parser's microcode flag type */ -+enum { -+ FLAG_ITAG = 0, -+ FLAG_VLAN, -+ FLAG_SNAP, -+ FLAG_PPPOE, -+ FLAG_IPV6, -+ FLAG_IPV6FL, -+ FLAG_IPV4, -+ FLAG_IGMP, -+ FLAG_TU, -+ FLAG_HOP, -+ FLAG_NN1, /*10 */ -+ FLAG_NN2, -+ FLAG_END, -+ FLAG_NO, /*13*/ -+}; -+ -+/* Micro code version V2_11 (extension for parsing IPv6 in PPPoE) */ -+#define MC_ENTRY(val, msk, ns, out, len, type, flags, ipv4_len) \ -+ { {val, msk, (ns<<10 | out<<4 | len>>1), (len&1)<<15 | type<<13 | flags<<9 | ipv4_len<<8 }} -+struct pce_microcode { -+ unsigned short val[4]; -+/* unsigned short val_2; -+ unsigned short val_1; -+ unsigned short val_0;*/ -+} pce_microcode[] = { -+ /* value mask ns fields L type flags ipv4_len */ -+ MC_ENTRY(0x88c3, 0xFFFF, 1, OUT_ITAG0, 4, INSTR, FLAG_ITAG, 0), -+ MC_ENTRY(0x8100, 0xFFFF, 2, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), -+ MC_ENTRY(0x88A8, 0xFFFF, 1, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), -+ MC_ENTRY(0x8100, 0xFFFF, 1, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), -+ MC_ENTRY(0x8864, 0xFFFF, 17, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0800, 0xFFFF, 21, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x86DD, 0xFFFF, 22, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x8863, 0xFFFF, 16, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0xF800, 10, OUT_NONE, 0, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 38, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0600, 0x0600, 38, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 12, OUT_NONE, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0xAAAA, 0xFFFF, 14, OUT_NONE, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0300, 0xFF00, 39, OUT_NONE, 0, INSTR, FLAG_SNAP, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_DIP7, 3, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 18, OUT_DIP7, 3, INSTR, FLAG_PPPOE, 0), -+ MC_ENTRY(0x0021, 0xFFFF, 21, OUT_NONE, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0057, 0xFFFF, 22, OUT_NONE, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x4000, 0xF000, 24, OUT_IP0, 4, INSTR, FLAG_IPV4, 1), -+ MC_ENTRY(0x6000, 0xF000, 27, OUT_IP0, 3, INSTR, FLAG_IPV6, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 25, OUT_IP3, 2, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 26, OUT_SIP0, 4, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 38, OUT_NONE, 0, LENACCU, FLAG_NO, 0), -+ MC_ENTRY(0x1100, 0xFF00, 37, OUT_PROT, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0600, 0xFF00, 37, OUT_PROT, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_HOP, 0), -+ MC_ENTRY(0x2B00, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_NN1, 0), -+ MC_ENTRY(0x3C00, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_NN2, 0), -+ MC_ENTRY(0x0000, 0x0000, 37, OUT_PROT, 1, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_HOP, 0), -+ MC_ENTRY(0x2B00, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_NN1, 0), -+ MC_ENTRY(0x3C00, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_NN2, 0), -+ MC_ENTRY(0x0000, 0x0000, 38, OUT_PROT, 1, IPV6, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 38, OUT_SIP0, 16, INSTR, FLAG_NO, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_APP0, 4, INSTR, FLAG_IGMP, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), -+}; ---- /dev/null -+++ b/drivers/net/ethernet/lantiq_xrx200.c -@@ -0,0 +1,1851 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * Copyright (C) 2010 Lantiq Deutschland -+ * Copyright (C) 2012 John Crispin -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "lantiq_pce.h" -+#include "lantiq_xrx200_sw.h" -+ -+#define SW_POLLING -+#define SW_ROUTING -+ -+#ifdef SW_ROUTING -+#define XRX200_MAX_DEV 2 -+#else -+#define XRX200_MAX_DEV 1 -+#endif -+ -+#define XRX200_MAX_VLAN 64 -+#define XRX200_PCE_ACTVLAN_IDX 0x01 -+#define XRX200_PCE_VLANMAP_IDX 0x02 -+ -+#define XRX200_MAX_PORT 7 -+#define XRX200_MAX_DMA 8 -+ -+#define XRX200_HEADROOM 4 -+ -+#define XRX200_TX_TIMEOUT (10 * HZ) -+ -+/* port type */ -+#define XRX200_PORT_TYPE_PHY 1 -+#define XRX200_PORT_TYPE_MAC 2 -+ -+/* DMA */ -+#define XRX200_DMA_DATA_LEN 0x600 -+#define XRX200_DMA_IRQ INT_NUM_IM2_IRL0 -+#define XRX200_DMA_RX 0 -+#define XRX200_DMA_TX 1 -+#define XRX200_DMA_TX_2 3 -+#define XRX200_DMA_IS_TX(x) (x%2) -+#define XRX200_DMA_IS_RX(x) (!XRX200_DMA_IS_TX(x)) -+ -+/* fetch / store dma */ -+#define FDMA_PCTRL0 0x2A00 -+#define FDMA_PCTRLx(x) (FDMA_PCTRL0 + (x * 0x18)) -+#define SDMA_PCTRL0 0x2F00 -+#define SDMA_PCTRLx(x) (SDMA_PCTRL0 + (x * 0x18)) -+ -+/* buffer management */ -+#define BM_PCFG0 0x200 -+#define BM_PCFGx(x) (BM_PCFG0 + (x * 8)) -+ -+/* MDIO */ -+#define MDIO_GLOB 0x0000 -+#define MDIO_CTRL 0x0020 -+#define MDIO_READ 0x0024 -+#define MDIO_WRITE 0x0028 -+#define MDIO_PHY0 0x0054 -+#define MDIO_PHY(x) (0x0054 - (x * sizeof(unsigned))) -+#define MDIO_CLK_CFG0 0x002C -+#define MDIO_CLK_CFG1 0x0030 -+ -+#define MDIO_GLOB_ENABLE 0x8000 -+#define MDIO_BUSY BIT(12) -+#define MDIO_RD BIT(11) -+#define MDIO_WR BIT(10) -+#define MDIO_MASK 0x1f -+#define MDIO_ADDRSHIFT 5 -+#define MDIO1_25MHZ 9 -+ -+#define MDIO_PHY_LINK_DOWN 0x4000 -+#define MDIO_PHY_LINK_UP 0x2000 -+ -+#define MDIO_PHY_SPEED_M10 0x0000 -+#define MDIO_PHY_SPEED_M100 0x0800 -+#define MDIO_PHY_SPEED_G1 0x1000 -+ -+#define MDIO_PHY_FDUP_EN 0x0200 -+#define MDIO_PHY_FDUP_DIS 0x0600 -+ -+#define MDIO_PHY_LINK_MASK 0x6000 -+#define MDIO_PHY_SPEED_MASK 0x1800 -+#define MDIO_PHY_FDUP_MASK 0x0600 -+#define MDIO_PHY_ADDR_MASK 0x001f -+#define MDIO_UPDATE_MASK MDIO_PHY_ADDR_MASK | MDIO_PHY_LINK_MASK | \ -+ MDIO_PHY_SPEED_MASK | MDIO_PHY_FDUP_MASK -+ -+/* MII */ -+#define MII_CFG(p) (p * 8) -+ -+#define MII_CFG_EN BIT(14) -+ -+#define MII_CFG_MODE_MIIP 0x0 -+#define MII_CFG_MODE_MIIM 0x1 -+#define MII_CFG_MODE_RMIIP 0x2 -+#define MII_CFG_MODE_RMIIM 0x3 -+#define MII_CFG_MODE_RGMII 0x4 -+#define MII_CFG_MODE_MASK 0xf -+ -+#define MII_CFG_RATE_M2P5 0x00 -+#define MII_CFG_RATE_M25 0x10 -+#define MII_CFG_RATE_M125 0x20 -+#define MII_CFG_RATE_M50 0x30 -+#define MII_CFG_RATE_AUTO 0x40 -+#define MII_CFG_RATE_MASK 0x70 -+ -+/* cpu port mac */ -+#define PMAC_HD_CTL 0x0000 -+#define PMAC_RX_IPG 0x0024 -+#define PMAC_EWAN 0x002c -+ -+#define PMAC_IPG_MASK 0xf -+#define PMAC_HD_CTL_AS 0x0008 -+#define PMAC_HD_CTL_AC 0x0004 -+#define PMAC_HD_CTL_RC 0x0010 -+#define PMAC_HD_CTL_RXSH 0x0040 -+#define PMAC_HD_CTL_AST 0x0080 -+#define PMAC_HD_CTL_RST 0x0100 -+ -+/* PCE */ -+#define PCE_TBL_KEY(x) (0x1100 + ((7 - x) * 4)) -+#define PCE_TBL_MASK 0x1120 -+#define PCE_TBL_VAL(x) (0x1124 + ((4 - x) * 4)) -+#define PCE_TBL_ADDR 0x1138 -+#define PCE_TBL_CTRL 0x113c -+#define PCE_PMAP1 0x114c -+#define PCE_PMAP2 0x1150 -+#define PCE_PMAP3 0x1154 -+#define PCE_GCTRL_REG(x) (0x1158 + (x * 4)) -+#define PCE_PCTRL_REG(p, x) (0x1200 + (((p * 0xa) + x) * 4)) -+ -+#define PCE_TBL_BUSY BIT(15) -+#define PCE_TBL_CFG_ADDR_MASK 0x1f -+#define PCE_TBL_CFG_ADWR 0x20 -+#define PCE_TBL_CFG_ADWR_MASK 0x60 -+#define PCE_INGRESS BIT(11) -+ -+/* MAC */ -+#define MAC_FLEN_REG (0x2314) -+#define MAC_CTRL_REG(p, x) (0x240c + (((p * 0xc) + x) * 4)) -+ -+/* buffer management */ -+#define BM_PCFG(p) (0x200 + (p * 8)) -+ -+/* special tag in TX path header */ -+#define SPID_SHIFT 24 -+#define DPID_SHIFT 16 -+#define DPID_ENABLE 1 -+#define SPID_CPU_PORT 2 -+#define PORT_MAP_SEL BIT(15) -+#define PORT_MAP_EN BIT(14) -+#define PORT_MAP_SHIFT 1 -+#define PORT_MAP_MASK 0x3f -+ -+#define SPPID_MASK 0x7 -+#define SPPID_SHIFT 4 -+ -+/* MII regs not yet in linux */ -+#define MDIO_DEVAD_NONE (-1) -+#define ADVERTIZE_MPD (1 << 10) -+ -+struct xrx200_port { -+ u8 num; -+ u8 phy_addr; -+ u16 flags; -+ phy_interface_t phy_if; -+ -+ int link; -+ int gpio; -+ enum of_gpio_flags gpio_flags; -+ -+ struct phy_device *phydev; -+ struct device_node *phy_node; -+}; -+ -+struct xrx200_chan { -+ int idx; -+ int refcount; -+ int tx_free; -+ -+ struct net_device dummy_dev; -+ struct net_device *devs[XRX200_MAX_DEV]; -+ -+ struct tasklet_struct tasklet; -+ struct napi_struct napi; -+ struct ltq_dma_channel dma; -+ struct sk_buff *skb[LTQ_DESC_NUM]; -+ -+ spinlock_t lock; -+}; -+ -+struct xrx200_hw { -+ struct clk *clk; -+ struct mii_bus *mii_bus; -+ -+ struct xrx200_chan chan[XRX200_MAX_DMA]; -+ u16 vlan_vid[XRX200_MAX_VLAN]; -+ u16 vlan_port_map[XRX200_MAX_VLAN]; -+ -+ struct net_device *devs[XRX200_MAX_DEV]; -+ int num_devs; -+ -+ int port_map[XRX200_MAX_PORT]; -+ unsigned short wan_map; -+ -+ struct switch_dev swdev; -+}; -+ -+struct xrx200_priv { -+ struct net_device_stats stats; -+ int id; -+ -+ struct xrx200_port port[XRX200_MAX_PORT]; -+ int num_port; -+ bool wan; -+ bool sw; -+ unsigned short port_map; -+ unsigned char mac[6]; -+ -+ struct xrx200_hw *hw; -+}; -+ -+static __iomem void *xrx200_switch_membase; -+static __iomem void *xrx200_mii_membase; -+static __iomem void *xrx200_mdio_membase; -+static __iomem void *xrx200_pmac_membase; -+ -+#define ltq_switch_r32(x) ltq_r32(xrx200_switch_membase + (x)) -+#define ltq_switch_w32(x, y) ltq_w32(x, xrx200_switch_membase + (y)) -+#define ltq_switch_w32_mask(x, y, z) \ -+ ltq_w32_mask(x, y, xrx200_switch_membase + (z)) -+ -+#define ltq_mdio_r32(x) ltq_r32(xrx200_mdio_membase + (x)) -+#define ltq_mdio_w32(x, y) ltq_w32(x, xrx200_mdio_membase + (y)) -+#define ltq_mdio_w32_mask(x, y, z) \ -+ ltq_w32_mask(x, y, xrx200_mdio_membase + (z)) -+ -+#define ltq_mii_r32(x) ltq_r32(xrx200_mii_membase + (x)) -+#define ltq_mii_w32(x, y) ltq_w32(x, xrx200_mii_membase + (y)) -+#define ltq_mii_w32_mask(x, y, z) \ -+ ltq_w32_mask(x, y, xrx200_mii_membase + (z)) -+ -+#define ltq_pmac_r32(x) ltq_r32(xrx200_pmac_membase + (x)) -+#define ltq_pmac_w32(x, y) ltq_w32(x, xrx200_pmac_membase + (y)) -+#define ltq_pmac_w32_mask(x, y, z) \ -+ ltq_w32_mask(x, y, xrx200_pmac_membase + (z)) -+ -+#define XRX200_GLOBAL_REGATTR(reg) \ -+ .id = reg, \ -+ .type = SWITCH_TYPE_INT, \ -+ .set = xrx200_set_global_attr, \ -+ .get = xrx200_get_global_attr -+ -+#define XRX200_PORT_REGATTR(reg) \ -+ .id = reg, \ -+ .type = SWITCH_TYPE_INT, \ -+ .set = xrx200_set_port_attr, \ -+ .get = xrx200_get_port_attr -+ -+static int xrx200sw_read_x(int reg, int x) -+{ -+ int value, mask, addr; -+ -+ addr = xrx200sw_reg[reg].offset + (xrx200sw_reg[reg].mult * x); -+ value = ltq_switch_r32(addr); -+ mask = (1 << xrx200sw_reg[reg].size) - 1; -+ value = (value >> xrx200sw_reg[reg].shift); -+ -+ return (value & mask); -+} -+ -+static int xrx200sw_read(int reg) -+{ -+ return xrx200sw_read_x(reg, 0); -+} -+ -+static void xrx200sw_write_x(int value, int reg, int x) -+{ -+ int mask, addr; -+ -+ addr = xrx200sw_reg[reg].offset + (xrx200sw_reg[reg].mult * x); -+ mask = (1 << xrx200sw_reg[reg].size) - 1; -+ mask = (mask << xrx200sw_reg[reg].shift); -+ value = (value << xrx200sw_reg[reg].shift) & mask; -+ -+ ltq_switch_w32_mask(mask, value, addr); -+} -+ -+static void xrx200sw_write(int value, int reg) -+{ -+ xrx200sw_write_x(value, reg, 0); -+} -+ -+struct xrx200_pce_table_entry { -+ int index; // PCE_TBL_ADDR.ADDR = pData->table_index -+ int table; // PCE_TBL_CTRL.ADDR = pData->table -+ unsigned short key[8]; -+ unsigned short val[5]; -+ unsigned short mask; -+ unsigned short type; -+ unsigned short valid; -+ unsigned short gmap; -+}; -+ -+static int xrx200_pce_table_entry_read(struct xrx200_pce_table_entry *tbl) -+{ -+ // wait until hardware is ready -+ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; -+ -+ // prepare the table access: -+ // PCE_TBL_ADDR.ADDR = pData->table_index -+ xrx200sw_write(tbl->index, XRX200_PCE_TBL_ADDR_ADDR); -+ // PCE_TBL_CTRL.ADDR = pData->table -+ xrx200sw_write(tbl->table, XRX200_PCE_TBL_CTRL_ADDR); -+ -+ //(address-based read) -+ xrx200sw_write(0, XRX200_PCE_TBL_CTRL_OPMOD); // OPMOD_ADRD -+ -+ xrx200sw_write(1, XRX200_PCE_TBL_CTRL_BAS); // start access -+ -+ // wait until hardware is ready -+ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; -+ -+ // read the keys -+ tbl->key[7] = xrx200sw_read(XRX200_PCE_TBL_KEY_7); -+ tbl->key[6] = xrx200sw_read(XRX200_PCE_TBL_KEY_6); -+ tbl->key[5] = xrx200sw_read(XRX200_PCE_TBL_KEY_5); -+ tbl->key[4] = xrx200sw_read(XRX200_PCE_TBL_KEY_4); -+ tbl->key[3] = xrx200sw_read(XRX200_PCE_TBL_KEY_3); -+ tbl->key[2] = xrx200sw_read(XRX200_PCE_TBL_KEY_2); -+ tbl->key[1] = xrx200sw_read(XRX200_PCE_TBL_KEY_1); -+ tbl->key[0] = xrx200sw_read(XRX200_PCE_TBL_KEY_0); -+ -+ // read the values -+ tbl->val[4] = xrx200sw_read(XRX200_PCE_TBL_VAL_4); -+ tbl->val[3] = xrx200sw_read(XRX200_PCE_TBL_VAL_3); -+ tbl->val[2] = xrx200sw_read(XRX200_PCE_TBL_VAL_2); -+ tbl->val[1] = xrx200sw_read(XRX200_PCE_TBL_VAL_1); -+ tbl->val[0] = xrx200sw_read(XRX200_PCE_TBL_VAL_0); -+ -+ // read the mask -+ tbl->mask = xrx200sw_read(XRX200_PCE_TBL_MASK_0); -+ // read the type -+ tbl->type = xrx200sw_read(XRX200_PCE_TBL_CTRL_TYPE); -+ // read the valid flag -+ tbl->valid = xrx200sw_read(XRX200_PCE_TBL_CTRL_VLD); -+ // read the group map -+ tbl->gmap = xrx200sw_read(XRX200_PCE_TBL_CTRL_GMAP); -+ -+ return 0; -+} -+ -+static int xrx200_pce_table_entry_write(struct xrx200_pce_table_entry *tbl) -+{ -+ // wait until hardware is ready -+ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; -+ -+ // prepare the table access: -+ // PCE_TBL_ADDR.ADDR = pData->table_index -+ xrx200sw_write(tbl->index, XRX200_PCE_TBL_ADDR_ADDR); -+ // PCE_TBL_CTRL.ADDR = pData->table -+ xrx200sw_write(tbl->table, XRX200_PCE_TBL_CTRL_ADDR); -+ -+ //(address-based write) -+ xrx200sw_write(1, XRX200_PCE_TBL_CTRL_OPMOD); // OPMOD_ADRD -+ -+ // read the keys -+ xrx200sw_write(tbl->key[7], XRX200_PCE_TBL_KEY_7); -+ xrx200sw_write(tbl->key[6], XRX200_PCE_TBL_KEY_6); -+ xrx200sw_write(tbl->key[5], XRX200_PCE_TBL_KEY_5); -+ xrx200sw_write(tbl->key[4], XRX200_PCE_TBL_KEY_4); -+ xrx200sw_write(tbl->key[3], XRX200_PCE_TBL_KEY_3); -+ xrx200sw_write(tbl->key[2], XRX200_PCE_TBL_KEY_2); -+ xrx200sw_write(tbl->key[1], XRX200_PCE_TBL_KEY_1); -+ xrx200sw_write(tbl->key[0], XRX200_PCE_TBL_KEY_0); -+ -+ // read the values -+ xrx200sw_write(tbl->val[4], XRX200_PCE_TBL_VAL_4); -+ xrx200sw_write(tbl->val[3], XRX200_PCE_TBL_VAL_3); -+ xrx200sw_write(tbl->val[2], XRX200_PCE_TBL_VAL_2); -+ xrx200sw_write(tbl->val[1], XRX200_PCE_TBL_VAL_1); -+ xrx200sw_write(tbl->val[0], XRX200_PCE_TBL_VAL_0); -+ -+ // read the mask -+ xrx200sw_write(tbl->mask, XRX200_PCE_TBL_MASK_0); -+ // read the type -+ xrx200sw_write(tbl->type, XRX200_PCE_TBL_CTRL_TYPE); -+ // read the valid flag -+ xrx200sw_write(tbl->valid, XRX200_PCE_TBL_CTRL_VLD); -+ // read the group map -+ xrx200sw_write(tbl->gmap, XRX200_PCE_TBL_CTRL_GMAP); -+ -+ xrx200sw_write(1, XRX200_PCE_TBL_CTRL_BAS); // start access -+ -+ // wait until hardware is ready -+ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; -+ -+ return 0; -+} -+ -+static void xrx200sw_fixup_pvids(void) -+{ -+ int index, p, portmap, untagged; -+ struct xrx200_pce_table_entry tem; -+ struct xrx200_pce_table_entry tev; -+ -+ portmap = 0; -+ for (p = 0; p < XRX200_MAX_PORT; p++) -+ portmap |= BIT(p); -+ -+ tem.table = XRX200_PCE_VLANMAP_IDX; -+ tev.table = XRX200_PCE_ACTVLAN_IDX; -+ -+ for (index = XRX200_MAX_VLAN; index-- > 0;) -+ { -+ tev.index = index; -+ xrx200_pce_table_entry_read(&tev); -+ -+ if (tev.valid == 0) -+ continue; -+ -+ tem.index = index; -+ xrx200_pce_table_entry_read(&tem); -+ -+ if (tem.val[0] == 0) -+ continue; -+ -+ untagged = portmap & (tem.val[1] ^ tem.val[2]); -+ -+ for (p = 0; p < XRX200_MAX_PORT; p++) -+ if (untagged & BIT(p)) -+ { -+ portmap &= ~BIT(p); -+ xrx200sw_write_x(index, XRX200_PCE_DEFPVID_PVID, p); -+ } -+ -+ for (p = 0; p < XRX200_MAX_PORT; p++) -+ if (portmap & BIT(p)) -+ xrx200sw_write_x(index, XRX200_PCE_DEFPVID_PVID, p); -+ } -+} -+ -+// swconfig interface -+static void xrx200_hw_init(struct xrx200_hw *hw); -+ -+// global -+static int xrx200sw_reset_switch(struct switch_dev *dev) -+{ -+ struct xrx200_hw *hw = container_of(dev, struct xrx200_hw, swdev); -+ -+ xrx200_hw_init(hw); -+ -+ return 0; -+} -+ -+static int xrx200_set_vlan_mode_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) -+{ -+ int p; -+ -+ if ((attr->max > 0) && (val->value.i > attr->max)) -+ return -EINVAL; -+ -+ for (p = 0; p < XRX200_MAX_PORT; p++) { -+ xrx200sw_write_x(val->value.i, XRX200_PCE_VCTRL_VEMR, p); -+ xrx200sw_write_x(val->value.i, XRX200_PCE_VCTRL_VIMR, p); -+ } -+ -+ xrx200sw_write(val->value.i, XRX200_PCE_GCTRL_0_VLAN); -+ return 0; -+} -+ -+static int xrx200_get_vlan_mode_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) -+{ -+ val->value.i = xrx200sw_read(attr->id); -+ return 0; -+} -+ -+static int xrx200_set_global_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) -+{ -+ if ((attr->max > 0) && (val->value.i > attr->max)) -+ return -EINVAL; -+ -+ xrx200sw_write(val->value.i, attr->id); -+ return 0; -+} -+ -+static int xrx200_get_global_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) -+{ -+ val->value.i = xrx200sw_read(attr->id); -+ return 0; -+} -+ -+// vlan -+static int xrx200sw_set_vlan_vid(struct switch_dev *dev, const struct switch_attr *attr, -+ struct switch_val *val) -+{ -+ struct xrx200_hw *hw = container_of(dev, struct xrx200_hw, swdev); -+ int i; -+ struct xrx200_pce_table_entry tev; -+ struct xrx200_pce_table_entry tem; -+ -+ tev.table = XRX200_PCE_ACTVLAN_IDX; -+ -+ for (i = 0; i < XRX200_MAX_VLAN; i++) -+ { -+ tev.index = i; -+ xrx200_pce_table_entry_read(&tev); -+ if (tev.key[0] == val->value.i && i != val->port_vlan) -+ return -EINVAL; -+ } -+ -+ hw->vlan_vid[val->port_vlan] = val->value.i; -+ -+ tev.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tev); -+ tev.key[0] = val->value.i; -+ tev.valid = val->value.i > 0; -+ xrx200_pce_table_entry_write(&tev); -+ -+ tem.table = XRX200_PCE_VLANMAP_IDX; -+ tem.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tem); -+ tem.val[0] = val->value.i; -+ xrx200_pce_table_entry_write(&tem); -+ -+ xrx200sw_fixup_pvids(); -+ return 0; -+} -+ -+static int xrx200sw_get_vlan_vid(struct switch_dev *dev, const struct switch_attr *attr, -+ struct switch_val *val) -+{ -+ struct xrx200_pce_table_entry te; -+ -+ te.table = XRX200_PCE_ACTVLAN_IDX; -+ te.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&te); -+ val->value.i = te.key[0]; -+ -+ return 0; -+} -+ -+static int xrx200sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val) -+{ -+ struct xrx200_hw *hw = container_of(dev, struct xrx200_hw, swdev); -+ int i, portmap, tagmap, untagged; -+ struct xrx200_pce_table_entry tem; -+ -+ portmap = 0; -+ tagmap = 0; -+ for (i = 0; i < val->len; i++) -+ { -+ struct switch_port *p = &val->value.ports[i]; -+ -+ portmap |= (1 << p->id); -+ if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)) -+ tagmap |= (1 << p->id); -+ } -+ -+ tem.table = XRX200_PCE_VLANMAP_IDX; -+ -+ untagged = portmap ^ tagmap; -+ for (i = 0; i < XRX200_MAX_VLAN; i++) -+ { -+ tem.index = i; -+ xrx200_pce_table_entry_read(&tem); -+ -+ if (tem.val[0] == 0) -+ continue; -+ -+ if ((untagged & (tem.val[1] ^ tem.val[2])) && (val->port_vlan != i)) -+ return -EINVAL; -+ } -+ -+ tem.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tem); -+ -+ // auto-enable this vlan if not enabled already -+ if (tem.val[0] == 0) -+ { -+ struct switch_val v; -+ v.port_vlan = val->port_vlan; -+ v.value.i = val->port_vlan; -+ if(xrx200sw_set_vlan_vid(dev, NULL, &v)) -+ return -EINVAL; -+ -+ //read updated tem -+ tem.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tem); -+ } -+ -+ tem.val[1] = portmap; -+ tem.val[2] = tagmap; -+ xrx200_pce_table_entry_write(&tem); -+ -+ ltq_switch_w32_mask(0, portmap, PCE_PMAP2); -+ ltq_switch_w32_mask(0, portmap, PCE_PMAP3); -+ hw->vlan_port_map[val->port_vlan] = portmap; -+ -+ xrx200sw_fixup_pvids(); -+ -+ return 0; -+} -+ -+static int xrx200sw_get_vlan_ports(struct switch_dev *dev, struct switch_val *val) -+{ -+ int i; -+ unsigned short ports, tags; -+ struct xrx200_pce_table_entry tem; -+ -+ tem.table = XRX200_PCE_VLANMAP_IDX; -+ tem.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tem); -+ -+ ports = tem.val[1]; -+ tags = tem.val[2]; -+ -+ for (i = 0; i < XRX200_MAX_PORT; i++) { -+ struct switch_port *p; -+ -+ if (!(ports & (1 << i))) -+ continue; -+ -+ p = &val->value.ports[val->len++]; -+ p->id = i; -+ if (tags & (1 << i)) -+ p->flags = (1 << SWITCH_PORT_FLAG_TAGGED); -+ else -+ p->flags = 0; -+ } -+ -+ return 0; -+} -+ -+static int xrx200sw_set_vlan_enable(struct switch_dev *dev, const struct switch_attr *attr, -+ struct switch_val *val) -+{ -+ struct xrx200_pce_table_entry tev; -+ -+ tev.table = XRX200_PCE_ACTVLAN_IDX; -+ tev.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tev); -+ -+ if (tev.key[0] == 0) -+ return -EINVAL; -+ -+ tev.valid = val->value.i; -+ xrx200_pce_table_entry_write(&tev); -+ -+ xrx200sw_fixup_pvids(); -+ return 0; -+} -+ -+static int xrx200sw_get_vlan_enable(struct switch_dev *dev, const struct switch_attr *attr, -+ struct switch_val *val) -+{ -+ struct xrx200_pce_table_entry tev; -+ -+ tev.table = XRX200_PCE_ACTVLAN_IDX; -+ tev.index = val->port_vlan; -+ xrx200_pce_table_entry_read(&tev); -+ val->value.i = tev.valid; -+ -+ return 0; -+} -+ -+// port -+static int xrx200sw_get_port_pvid(struct switch_dev *dev, int port, int *val) -+{ -+ struct xrx200_pce_table_entry tev; -+ -+ if (port >= XRX200_MAX_PORT) -+ return -EINVAL; -+ -+ tev.table = XRX200_PCE_ACTVLAN_IDX; -+ tev.index = xrx200sw_read_x(XRX200_PCE_DEFPVID_PVID, port); -+ xrx200_pce_table_entry_read(&tev); -+ -+ *val = tev.key[0]; -+ return 0; -+} -+ -+static int xrx200sw_get_port_link(struct switch_dev *dev, -+ int port, -+ struct switch_port_link *link) -+{ -+ if (port >= XRX200_MAX_PORT) -+ return -EINVAL; -+ -+ link->link = xrx200sw_read_x(XRX200_MAC_PSTAT_LSTAT, port); -+ if (!link->link) -+ return 0; -+ -+ link->duplex = xrx200sw_read_x(XRX200_MAC_PSTAT_FDUP, port); -+ -+ link->rx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) && 0x0010); -+ link->tx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) && 0x0020); -+ link->aneg = !(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port)); -+ -+ link->speed = SWITCH_PORT_SPEED_10; -+ if (xrx200sw_read_x(XRX200_MAC_PSTAT_MBIT, port)) -+ link->speed = SWITCH_PORT_SPEED_100; -+ if (xrx200sw_read_x(XRX200_MAC_PSTAT_GBIT, port)) -+ link->speed = SWITCH_PORT_SPEED_1000; -+ -+ return 0; -+} -+ -+static int xrx200_set_port_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) -+{ -+ if (val->port_vlan >= XRX200_MAX_PORT) -+ return -EINVAL; -+ -+ if ((attr->max > 0) && (val->value.i > attr->max)) -+ return -EINVAL; -+ -+ xrx200sw_write_x(val->value.i, attr->id, val->port_vlan); -+ return 0; -+} -+ -+static int xrx200_get_port_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) -+{ -+ if (val->port_vlan >= XRX200_MAX_PORT) -+ return -EINVAL; -+ -+ val->value.i = xrx200sw_read_x(attr->id, val->port_vlan); -+ return 0; -+} -+ -+// attributes -+static struct switch_attr xrx200sw_globals[] = { -+ { -+ .type = SWITCH_TYPE_INT, -+ .set = xrx200_set_vlan_mode_enable, -+ .get = xrx200_get_vlan_mode_enable, -+ .name = "enable_vlan", -+ .description = "Enable VLAN mode", -+ .max = 1}, -+}; -+ -+static struct switch_attr xrx200sw_port[] = { -+ { -+ XRX200_PORT_REGATTR(XRX200_PCE_VCTRL_UVR), -+ .name = "uvr", -+ .description = "Unknown VLAN Rule", -+ .max = 1, -+ }, -+ { -+ XRX200_PORT_REGATTR(XRX200_PCE_VCTRL_VSR), -+ .name = "vsr", -+ .description = "VLAN Security Rule", -+ .max = 1, -+ }, -+ { -+ XRX200_PORT_REGATTR(XRX200_PCE_VCTRL_VINR), -+ .name = "vinr", -+ .description = "VLAN Ingress Tag Rule", -+ .max = 2, -+ }, -+ { -+ XRX200_PORT_REGATTR(XRX200_PCE_PCTRL_0_TVM), -+ .name = "tvm", -+ .description = "Transparent VLAN Mode", -+ .max = 1, -+ }, -+}; -+ -+static struct switch_attr xrx200sw_vlan[] = { -+ { -+ .type = SWITCH_TYPE_INT, -+ .name = "vid", -+ .description = "VLAN ID (0-4094)", -+ .set = xrx200sw_set_vlan_vid, -+ .get = xrx200sw_get_vlan_vid, -+ .max = 4094, -+ }, -+ { -+ .type = SWITCH_TYPE_INT, -+ .name = "enable", -+ .description = "Enable VLAN", -+ .set = xrx200sw_set_vlan_enable, -+ .get = xrx200sw_get_vlan_enable, -+ .max = 1, -+ }, -+}; -+ -+static const struct switch_dev_ops xrx200sw_ops = { -+ .attr_global = { -+ .attr = xrx200sw_globals, -+ .n_attr = ARRAY_SIZE(xrx200sw_globals), -+ }, -+ .attr_port = { -+ .attr = xrx200sw_port, -+ .n_attr = ARRAY_SIZE(xrx200sw_port), -+ }, -+ .attr_vlan = { -+ .attr = xrx200sw_vlan, -+ .n_attr = ARRAY_SIZE(xrx200sw_vlan), -+ }, -+ .get_vlan_ports = xrx200sw_get_vlan_ports, -+ .set_vlan_ports = xrx200sw_set_vlan_ports, -+ .get_port_pvid = xrx200sw_get_port_pvid, -+ .reset_switch = xrx200sw_reset_switch, -+ .get_port_link = xrx200sw_get_port_link, -+// .get_port_stats = xrx200sw_get_port_stats, //TODO -+}; -+ -+static int xrx200sw_init(struct xrx200_hw *hw) -+{ -+ int netdev_num; -+ -+ for (netdev_num = 0; netdev_num < hw->num_devs; netdev_num++) -+ { -+ struct switch_dev *swdev; -+ struct net_device *dev = hw->devs[netdev_num]; -+ struct xrx200_priv *priv = netdev_priv(dev); -+ if (!priv->sw) -+ continue; -+ -+ swdev = &hw->swdev; -+ -+ swdev->name = "Lantiq XRX200 Switch"; -+ swdev->vlans = XRX200_MAX_VLAN; -+ swdev->ports = XRX200_MAX_PORT; -+ swdev->cpu_port = 6; -+ swdev->ops = &xrx200sw_ops; -+ -+ register_switch(swdev, dev); -+ return 0; // enough switches -+ } -+ return 0; -+} -+ -+static int xrx200_open(struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ int i; -+ -+ for (i = 0; i < XRX200_MAX_DMA; i++) { -+ if (!priv->hw->chan[i].dma.irq) -+ continue; -+ spin_lock_bh(&priv->hw->chan[i].lock); -+ if (!priv->hw->chan[i].refcount) { -+ if (XRX200_DMA_IS_RX(i)) -+ napi_enable(&priv->hw->chan[i].napi); -+ ltq_dma_open(&priv->hw->chan[i].dma); -+ } -+ priv->hw->chan[i].refcount++; -+ spin_unlock_bh(&priv->hw->chan[i].lock); -+ } -+ for (i = 0; i < priv->num_port; i++) -+ if (priv->port[i].phydev) -+ phy_start(priv->port[i].phydev); -+ netif_wake_queue(dev); -+ -+ return 0; -+} -+ -+static int xrx200_close(struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ int i; -+ -+ netif_stop_queue(dev); -+ -+ for (i = 0; i < priv->num_port; i++) -+ if (priv->port[i].phydev) -+ phy_stop(priv->port[i].phydev); -+ -+ for (i = 0; i < XRX200_MAX_DMA; i++) { -+ if (!priv->hw->chan[i].dma.irq) -+ continue; -+ -+ priv->hw->chan[i].refcount--; -+ if (!priv->hw->chan[i].refcount) { -+ if (XRX200_DMA_IS_RX(i)) -+ napi_disable(&priv->hw->chan[i].napi); -+ spin_lock_bh(&priv->hw->chan[i].lock); -+ ltq_dma_close(&priv->hw->chan[XRX200_DMA_RX].dma); -+ spin_unlock_bh(&priv->hw->chan[i].lock); -+ } -+ } -+ -+ return 0; -+} -+ -+static int xrx200_alloc_skb(struct xrx200_chan *ch) -+{ -+#define DMA_PAD (NET_IP_ALIGN + NET_SKB_PAD) -+ ch->skb[ch->dma.desc] = dev_alloc_skb(XRX200_DMA_DATA_LEN + DMA_PAD); -+ if (!ch->skb[ch->dma.desc]) -+ goto skip; -+ -+ skb_reserve(ch->skb[ch->dma.desc], NET_SKB_PAD); -+ ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL, -+ ch->skb[ch->dma.desc]->data, XRX200_DMA_DATA_LEN, -+ DMA_FROM_DEVICE); -+ ch->dma.desc_base[ch->dma.desc].addr = -+ CPHYSADDR(ch->skb[ch->dma.desc]->data); -+ skb_reserve(ch->skb[ch->dma.desc], NET_IP_ALIGN); -+ -+skip: -+ ch->dma.desc_base[ch->dma.desc].ctl = -+ LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | -+ XRX200_DMA_DATA_LEN; -+ -+ return 0; -+} -+ -+static void xrx200_hw_receive(struct xrx200_chan *ch, int id) -+{ -+ struct net_device *dev = ch->devs[id]; -+ struct xrx200_priv *priv = netdev_priv(dev); -+ struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; -+ struct sk_buff *skb = ch->skb[ch->dma.desc]; -+ int len = (desc->ctl & LTQ_DMA_SIZE_MASK); -+ int ret; -+ -+ ret = xrx200_alloc_skb(ch); -+ -+ ch->dma.desc++; -+ ch->dma.desc %= LTQ_DESC_NUM; -+ -+ if (ret) { -+ netdev_err(dev, -+ "failed to allocate new rx buffer\n"); -+ return; -+ } -+ -+ skb_put(skb, len); -+#ifdef SW_ROUTING -+ skb_pull(skb, 8); -+#endif -+ skb->dev = dev; -+ skb->protocol = eth_type_trans(skb, dev); -+ netif_receive_skb(skb); -+ priv->stats.rx_packets++; -+ priv->stats.rx_bytes+=len; -+} -+ -+static int xrx200_poll_rx(struct napi_struct *napi, int budget) -+{ -+ struct xrx200_chan *ch = container_of(napi, -+ struct xrx200_chan, napi); -+ struct xrx200_priv *priv = netdev_priv(ch->devs[0]); -+ int rx = 0; -+ int complete = 0; -+ -+ while ((rx < budget) && !complete) { -+ struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; -+ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { -+#ifdef SW_ROUTING -+ struct sk_buff *skb = ch->skb[ch->dma.desc]; -+ u8 *special_tag = (u8*)skb->data; -+ int port = (special_tag[7] >> SPPID_SHIFT) & SPPID_MASK; -+ xrx200_hw_receive(ch, priv->hw->port_map[port]); -+#else -+ xrx200_hw_receive(ch, 0); -+#endif -+ rx++; -+ } else { -+ complete = 1; -+ } -+ } -+ -+ if (complete || !rx) { -+ napi_complete(&ch->napi); -+ ltq_dma_enable_irq(&ch->dma); -+ } -+ -+ return rx; -+} -+ -+static void xrx200_tx_housekeeping(unsigned long ptr) -+{ -+ struct xrx200_chan *ch = (struct xrx200_chan *) ptr; -+ int pkts = 0; -+ int i; -+ -+ spin_lock_bh(&ch->lock); -+ ltq_dma_ack_irq(&ch->dma); -+ while ((ch->dma.desc_base[ch->tx_free].ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { -+ struct sk_buff *skb = ch->skb[ch->tx_free]; -+ -+ pkts++; -+ ch->skb[ch->tx_free] = NULL; -+ dev_kfree_skb(skb); -+ memset(&ch->dma.desc_base[ch->tx_free], 0, -+ sizeof(struct ltq_dma_desc)); -+ ch->tx_free++; -+ ch->tx_free %= LTQ_DESC_NUM; -+ } -+ ltq_dma_enable_irq(&ch->dma); -+ spin_unlock_bh(&ch->lock); -+ -+ if (!pkts) -+ return; -+ -+ for (i = 0; i < XRX200_MAX_DEV && ch->devs[i]; i++) -+ netif_wake_queue(ch->devs[i]); -+} -+ -+static struct net_device_stats *xrx200_get_stats (struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ -+ return &priv->stats; -+} -+ -+static void xrx200_tx_timeout(struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ -+ printk(KERN_ERR "%s: transmit timed out, disable the dma channel irq\n", dev->name); -+ -+ priv->stats.tx_errors++; -+ netif_wake_queue(dev); -+} -+ -+static int xrx200_start_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ struct xrx200_chan *ch; -+ struct ltq_dma_desc *desc; -+ u32 byte_offset; -+ int ret = NETDEV_TX_OK; -+ int len; -+#ifdef SW_ROUTING -+ u32 special_tag = (SPID_CPU_PORT << SPID_SHIFT) | DPID_ENABLE; -+#endif -+ if(priv->id) -+ ch = &priv->hw->chan[XRX200_DMA_TX_2]; -+ else -+ ch = &priv->hw->chan[XRX200_DMA_TX]; -+ -+ desc = &ch->dma.desc_base[ch->dma.desc]; -+ -+ skb->dev = dev; -+ len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; -+ -+#ifdef SW_ROUTING -+ if (is_multicast_ether_addr(eth_hdr(skb)->h_dest)) { -+ u16 port_map = priv->port_map; -+ -+ if (priv->sw && skb->protocol == htons(ETH_P_8021Q)) { -+ u16 vid; -+ int i; -+ -+ port_map = 0; -+ if (!__vlan_get_tag(skb, &vid)) { -+ for (i = 0; i < XRX200_MAX_VLAN; i++) { -+ if (priv->hw->vlan_vid[i] != vid) -+ continue; -+ port_map = priv->hw->vlan_port_map[i]; -+ break; -+ } -+ } -+ } -+ -+ special_tag |= (port_map << PORT_MAP_SHIFT) | -+ PORT_MAP_SEL | PORT_MAP_EN; -+ } -+ if(priv->wan) -+ special_tag |= (1 << DPID_SHIFT); -+ if(skb_headroom(skb) < 4) { -+ struct sk_buff *tmp = skb_realloc_headroom(skb, 4); -+ dev_kfree_skb_any(skb); -+ skb = tmp; -+ } -+ skb_push(skb, 4); -+ memcpy(skb->data, &special_tag, sizeof(u32)); -+ len += 4; -+#endif -+ -+ /* dma needs to start on a 16 byte aligned address */ -+ byte_offset = CPHYSADDR(skb->data) % 16; -+ -+ spin_lock_bh(&ch->lock); -+ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { -+ netdev_err(dev, "tx ring full\n"); -+ netif_stop_queue(dev); -+ ret = NETDEV_TX_BUSY; -+ goto out; -+ } -+ -+ ch->skb[ch->dma.desc] = skb; -+ -+ netif_trans_update(dev); -+ -+ desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len, -+ DMA_TO_DEVICE)) - byte_offset; -+ wmb(); -+ desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | -+ LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK); -+ ch->dma.desc++; -+ ch->dma.desc %= LTQ_DESC_NUM; -+ if (ch->dma.desc == ch->tx_free) -+ netif_stop_queue(dev); -+ -+ -+ priv->stats.tx_packets++; -+ priv->stats.tx_bytes+=len; -+ -+out: -+ spin_unlock_bh(&ch->lock); -+ -+ return ret; -+} -+ -+static irqreturn_t xrx200_dma_irq(int irq, void *priv) -+{ -+ struct xrx200_hw *hw = priv; -+ int chnr = irq - XRX200_DMA_IRQ; -+ struct xrx200_chan *ch = &hw->chan[chnr]; -+ -+ ltq_dma_disable_irq(&ch->dma); -+ ltq_dma_ack_irq(&ch->dma); -+ -+ if (chnr % 2) -+ tasklet_schedule(&ch->tasklet); -+ else -+ napi_schedule(&ch->napi); -+ -+ return IRQ_HANDLED; -+} -+ -+static int xrx200_dma_init(struct xrx200_hw *hw) -+{ -+ int i, err = 0; -+ -+ ltq_dma_init_port(DMA_PORT_ETOP); -+ -+ for (i = 0; i < 8 && !err; i++) { -+ int irq = XRX200_DMA_IRQ + i; -+ struct xrx200_chan *ch = &hw->chan[i]; -+ -+ spin_lock_init(&ch->lock); -+ -+ ch->idx = ch->dma.nr = i; -+ -+ if (i == XRX200_DMA_TX) { -+ ltq_dma_alloc_tx(&ch->dma); -+ err = request_irq(irq, xrx200_dma_irq, 0, "vrx200_tx", hw); -+ } else if (i == XRX200_DMA_TX_2) { -+ ltq_dma_alloc_tx(&ch->dma); -+ err = request_irq(irq, xrx200_dma_irq, 0, "vrx200_tx_2", hw); -+ } else if (i == XRX200_DMA_RX) { -+ ltq_dma_alloc_rx(&ch->dma); -+ for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; -+ ch->dma.desc++) -+ if (xrx200_alloc_skb(ch)) -+ err = -ENOMEM; -+ ch->dma.desc = 0; -+ err = request_irq(irq, xrx200_dma_irq, 0, "vrx200_rx", hw); -+ } else -+ continue; -+ -+ if (!err) -+ ch->dma.irq = irq; -+ else -+ pr_err("net-xrx200: failed to request irq %d\n", irq); -+ } -+ -+ return err; -+} -+ -+#ifdef SW_POLLING -+static void xrx200_gmac_update(struct xrx200_port *port) -+{ -+ u16 phyaddr = port->phydev->mdio.addr & MDIO_PHY_ADDR_MASK; -+ u16 miimode = ltq_mii_r32(MII_CFG(port->num)) & MII_CFG_MODE_MASK; -+ u16 miirate = 0; -+ -+ switch (port->phydev->speed) { -+ case SPEED_1000: -+ phyaddr |= MDIO_PHY_SPEED_G1; -+ miirate = MII_CFG_RATE_M125; -+ break; -+ -+ case SPEED_100: -+ phyaddr |= MDIO_PHY_SPEED_M100; -+ switch (miimode) { -+ case MII_CFG_MODE_RMIIM: -+ case MII_CFG_MODE_RMIIP: -+ miirate = MII_CFG_RATE_M50; -+ break; -+ default: -+ miirate = MII_CFG_RATE_M25; -+ break; -+ } -+ break; -+ -+ default: -+ phyaddr |= MDIO_PHY_SPEED_M10; -+ miirate = MII_CFG_RATE_M2P5; -+ break; -+ } -+ -+ if (port->phydev->link) -+ phyaddr |= MDIO_PHY_LINK_UP; -+ else -+ phyaddr |= MDIO_PHY_LINK_DOWN; -+ -+ if (port->phydev->duplex == DUPLEX_FULL) -+ phyaddr |= MDIO_PHY_FDUP_EN; -+ else -+ phyaddr |= MDIO_PHY_FDUP_DIS; -+ -+ ltq_mdio_w32_mask(MDIO_UPDATE_MASK, phyaddr, MDIO_PHY(port->num)); -+ ltq_mii_w32_mask(MII_CFG_RATE_MASK, miirate, MII_CFG(port->num)); -+ udelay(1); -+} -+#else -+static void xrx200_gmac_update(struct xrx200_port *port) -+{ -+ -+} -+#endif -+ -+static void xrx200_mdio_link(struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ bool link = false; -+ int i; -+ -+ for (i = 0; i < priv->num_port; i++) { -+ if (!priv->port[i].phydev) -+ continue; -+ -+ if (priv->port[i].phydev->link) -+ link = true; -+ -+ if (priv->port[i].link != priv->port[i].phydev->link) { -+ xrx200_gmac_update(&priv->port[i]); -+ priv->port[i].link = priv->port[i].phydev->link; -+ netdev_info(dev, "port %d %s link\n", -+ priv->port[i].num, -+ (priv->port[i].link)?("got"):("lost")); -+ } -+ } -+ if (netif_carrier_ok(dev) && !link) -+ netif_carrier_off(dev); -+} -+ -+static inline int xrx200_mdio_poll(struct mii_bus *bus) -+{ -+ unsigned cnt = 10000; -+ -+ while (likely(cnt--)) { -+ unsigned ctrl = ltq_mdio_r32(MDIO_CTRL); -+ if ((ctrl & MDIO_BUSY) == 0) -+ return 0; -+ } -+ -+ return 1; -+} -+ -+static int xrx200_mdio_wr(struct mii_bus *bus, int addr, int reg, u16 val) -+{ -+ if (xrx200_mdio_poll(bus)) -+ return 1; -+ -+ ltq_mdio_w32(val, MDIO_WRITE); -+ ltq_mdio_w32(MDIO_BUSY | MDIO_WR | -+ ((addr & MDIO_MASK) << MDIO_ADDRSHIFT) | -+ (reg & MDIO_MASK), -+ MDIO_CTRL); -+ -+ return 0; -+} -+ -+static int xrx200_mdio_rd(struct mii_bus *bus, int addr, int reg) -+{ -+ if (xrx200_mdio_poll(bus)) -+ return -1; -+ -+ ltq_mdio_w32(MDIO_BUSY | MDIO_RD | -+ ((addr & MDIO_MASK) << MDIO_ADDRSHIFT) | -+ (reg & MDIO_MASK), -+ MDIO_CTRL); -+ -+ if (xrx200_mdio_poll(bus)) -+ return -1; -+ -+ return ltq_mdio_r32(MDIO_READ); -+} -+ -+static int xrx200_mdio_probe(struct net_device *dev, struct xrx200_port *port) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ struct phy_device *phydev = NULL; -+ unsigned val; -+ -+ phydev = mdiobus_get_phy(priv->hw->mii_bus, port->phy_addr); -+ -+ if (!phydev) { -+ netdev_err(dev, "no PHY found\n"); -+ return -ENODEV; -+ } -+ -+ phydev = phy_connect(dev, phydev_name(phydev), &xrx200_mdio_link, -+ port->phy_if); -+ -+ if (IS_ERR(phydev)) { -+ netdev_err(dev, "Could not attach to PHY\n"); -+ return PTR_ERR(phydev); -+ } -+ -+ phydev->supported &= (SUPPORTED_10baseT_Half -+ | SUPPORTED_10baseT_Full -+ | SUPPORTED_100baseT_Half -+ | SUPPORTED_100baseT_Full -+ | SUPPORTED_1000baseT_Half -+ | SUPPORTED_1000baseT_Full -+ | SUPPORTED_Autoneg -+ | SUPPORTED_MII -+ | SUPPORTED_TP); -+ phydev->advertising = phydev->supported; -+ port->phydev = phydev; -+ phydev->no_auto_carrier_off = true; -+ -+ phy_attached_info(phydev); -+ -+#ifdef SW_POLLING -+ phy_read_status(phydev); -+ -+ val = xrx200_mdio_rd(priv->hw->mii_bus, MDIO_DEVAD_NONE, MII_CTRL1000); -+ val |= ADVERTIZE_MPD; -+ xrx200_mdio_wr(priv->hw->mii_bus, MDIO_DEVAD_NONE, MII_CTRL1000, val); -+ xrx200_mdio_wr(priv->hw->mii_bus, 0, 0, 0x1040); -+ -+ phy_start_aneg(phydev); -+#endif -+ return 0; -+} -+ -+static void xrx200_port_config(struct xrx200_priv *priv, -+ const struct xrx200_port *port) -+{ -+ u16 miimode = 0; -+ -+ switch (port->num) { -+ case 0: /* xMII0 */ -+ case 1: /* xMII1 */ -+ switch (port->phy_if) { -+ case PHY_INTERFACE_MODE_MII: -+ if (port->flags & XRX200_PORT_TYPE_PHY) -+ /* MII MAC mode, connected to external PHY */ -+ miimode = MII_CFG_MODE_MIIM; -+ else -+ /* MII PHY mode, connected to external MAC */ -+ miimode = MII_CFG_MODE_MIIP; -+ break; -+ case PHY_INTERFACE_MODE_RMII: -+ if (port->flags & XRX200_PORT_TYPE_PHY) -+ /* RMII MAC mode, connected to external PHY */ -+ miimode = MII_CFG_MODE_RMIIM; -+ else -+ /* RMII PHY mode, connected to external MAC */ -+ miimode = MII_CFG_MODE_RMIIP; -+ break; -+ case PHY_INTERFACE_MODE_RGMII: -+ /* RGMII MAC mode, connected to external PHY */ -+ miimode = MII_CFG_MODE_RGMII; -+ break; -+ default: -+ break; -+ } -+ break; -+ case 2: /* internal GPHY0 */ -+ case 3: /* internal GPHY0 */ -+ case 4: /* internal GPHY1 */ -+ switch (port->phy_if) { -+ case PHY_INTERFACE_MODE_MII: -+ case PHY_INTERFACE_MODE_GMII: -+ /* MII MAC mode, connected to internal GPHY */ -+ miimode = MII_CFG_MODE_MIIM; -+ break; -+ default: -+ break; -+ } -+ break; -+ case 5: /* internal GPHY1 or xMII2 */ -+ switch (port->phy_if) { -+ case PHY_INTERFACE_MODE_MII: -+ /* MII MAC mode, connected to internal GPHY */ -+ miimode = MII_CFG_MODE_MIIM; -+ break; -+ case PHY_INTERFACE_MODE_RGMII: -+ /* RGMII MAC mode, connected to external PHY */ -+ miimode = MII_CFG_MODE_RGMII; -+ break; -+ default: -+ break; -+ } -+ break; -+ default: -+ break; -+ } -+ -+ ltq_mii_w32_mask(MII_CFG_MODE_MASK, miimode | MII_CFG_EN, -+ MII_CFG(port->num)); -+} -+ -+static int xrx200_init(struct net_device *dev) -+{ -+ struct xrx200_priv *priv = netdev_priv(dev); -+ struct sockaddr mac; -+ int err, i; -+ -+#ifndef SW_POLLING -+ unsigned int reg = 0; -+ -+ /* enable auto polling */ -+ for (i = 0; i < priv->num_port; i++) -+ reg |= BIT(priv->port[i].num); -+ ltq_mdio_w32(reg, MDIO_CLK_CFG0); -+ ltq_mdio_w32(MDIO1_25MHZ, MDIO_CLK_CFG1); -+#endif -+ -+ /* setup each port */ -+ for (i = 0; i < priv->num_port; i++) -+ xrx200_port_config(priv, &priv->port[i]); -+ -+ memcpy(&mac.sa_data, priv->mac, ETH_ALEN); -+ if (!is_valid_ether_addr(mac.sa_data)) { -+ pr_warn("net-xrx200: invalid MAC, using random\n"); -+ eth_random_addr(mac.sa_data); -+ dev->addr_assign_type |= NET_ADDR_RANDOM; -+ } -+ -+ err = eth_mac_addr(dev, &mac); -+ if (err) -+ goto err_netdev; -+ -+ for (i = 0; i < priv->num_port; i++) -+ if (xrx200_mdio_probe(dev, &priv->port[i])) -+ pr_warn("xrx200-mdio: probing phy of port %d failed\n", -+ priv->port[i].num); -+ -+ return 0; -+ -+err_netdev: -+ unregister_netdev(dev); -+ free_netdev(dev); -+ return err; -+} -+ -+static void xrx200_pci_microcode(void) -+{ -+ int i; -+ -+ ltq_switch_w32_mask(PCE_TBL_CFG_ADDR_MASK | PCE_TBL_CFG_ADWR_MASK, -+ PCE_TBL_CFG_ADWR, PCE_TBL_CTRL); -+ ltq_switch_w32(0, PCE_TBL_MASK); -+ -+ for (i = 0; i < ARRAY_SIZE(pce_microcode); i++) { -+ ltq_switch_w32(i, PCE_TBL_ADDR); -+ ltq_switch_w32(pce_microcode[i].val[3], PCE_TBL_VAL(0)); -+ ltq_switch_w32(pce_microcode[i].val[2], PCE_TBL_VAL(1)); -+ ltq_switch_w32(pce_microcode[i].val[1], PCE_TBL_VAL(2)); -+ ltq_switch_w32(pce_microcode[i].val[0], PCE_TBL_VAL(3)); -+ -+ // start the table access: -+ ltq_switch_w32_mask(0, PCE_TBL_BUSY, PCE_TBL_CTRL); -+ while (ltq_switch_r32(PCE_TBL_CTRL) & PCE_TBL_BUSY); -+ } -+ -+ /* tell the switch that the microcode is loaded */ -+ ltq_switch_w32_mask(0, BIT(3), PCE_GCTRL_REG(0)); -+} -+ -+static void xrx200_hw_init(struct xrx200_hw *hw) -+{ -+ int i; -+ -+ /* enable clock gate */ -+ clk_enable(hw->clk); -+ -+ ltq_switch_w32(1, 0); -+ mdelay(100); -+ ltq_switch_w32(0, 0); -+ /* -+ * TODO: we should really disbale all phys/miis here and explicitly -+ * enable them in the device secific init function -+ */ -+ -+ /* disable port fetch/store dma */ -+ for (i = 0; i < 7; i++ ) { -+ ltq_switch_w32(0, FDMA_PCTRLx(i)); -+ ltq_switch_w32(0, SDMA_PCTRLx(i)); -+ } -+ -+ /* enable Switch */ -+ ltq_mdio_w32_mask(0, MDIO_GLOB_ENABLE, MDIO_GLOB); -+ -+ /* load the pce microcode */ -+ xrx200_pci_microcode(); -+ -+ /* Default unknown Broadcat/Multicast/Unicast port maps */ -+ ltq_switch_w32(0x40, PCE_PMAP1); -+ ltq_switch_w32(0x40, PCE_PMAP2); -+ ltq_switch_w32(0x40, PCE_PMAP3); -+ -+ /* RMON Counter Enable for all physical ports */ -+ for (i = 0; i < 7; i++) -+ ltq_switch_w32(0x1, BM_PCFG(i)); -+ -+ /* disable auto polling */ -+ ltq_mdio_w32(0x0, MDIO_CLK_CFG0); -+ -+ /* enable port statistic counters */ -+ for (i = 0; i < 7; i++) -+ ltq_switch_w32(0x1, BM_PCFGx(i)); -+ -+ /* set IPG to 12 */ -+ ltq_pmac_w32_mask(PMAC_IPG_MASK, 0xb, PMAC_RX_IPG); -+ -+#ifdef SW_ROUTING -+ /* enable status header, enable CRC */ -+ ltq_pmac_w32_mask(0, -+ PMAC_HD_CTL_RST | PMAC_HD_CTL_AST | PMAC_HD_CTL_RXSH | PMAC_HD_CTL_AS | PMAC_HD_CTL_AC | PMAC_HD_CTL_RC, -+ PMAC_HD_CTL); -+#else -+ /* disable status header, enable CRC */ -+ ltq_pmac_w32_mask(PMAC_HD_CTL_AST | PMAC_HD_CTL_RXSH | PMAC_HD_CTL_AS, -+ PMAC_HD_CTL_AC | PMAC_HD_CTL_RC, -+ PMAC_HD_CTL); -+#endif -+ -+ /* enable port fetch/store dma & VLAN Modification */ -+ for (i = 0; i < 7; i++ ) { -+ ltq_switch_w32_mask(0, 0x19, FDMA_PCTRLx(i)); -+ ltq_switch_w32_mask(0, 0x01, SDMA_PCTRLx(i)); -+ ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(i, 0)); -+ } -+ -+ /* enable special tag insertion on cpu port */ -+ ltq_switch_w32_mask(0, 0x02, FDMA_PCTRLx(6)); -+ ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(6, 0)); -+ ltq_switch_w32_mask(0, BIT(3), MAC_CTRL_REG(6, 2)); -+ ltq_switch_w32(1518 + 8 + 4 * 2, MAC_FLEN_REG); -+ xrx200sw_write_x(1, XRX200_BM_QUEUE_GCTRL_GL_MOD, 0); -+ -+ for (i = 0; i < XRX200_MAX_VLAN; i++) -+ hw->vlan_vid[i] = i; -+} -+ -+static void xrx200_hw_cleanup(struct xrx200_hw *hw) -+{ -+ int i; -+ -+ /* disable the switch */ -+ ltq_mdio_w32_mask(MDIO_GLOB_ENABLE, 0, MDIO_GLOB); -+ -+ /* free the channels and IRQs */ -+ for (i = 0; i < 2; i++) { -+ ltq_dma_free(&hw->chan[i].dma); -+ if (hw->chan[i].dma.irq) -+ free_irq(hw->chan[i].dma.irq, hw); -+ } -+ -+ /* free the allocated RX ring */ -+ for (i = 0; i < LTQ_DESC_NUM; i++) -+ dev_kfree_skb_any(hw->chan[XRX200_DMA_RX].skb[i]); -+ -+ /* clear the mdio bus */ -+ mdiobus_unregister(hw->mii_bus); -+ mdiobus_free(hw->mii_bus); -+ -+ /* release the clock */ -+ clk_disable(hw->clk); -+ clk_put(hw->clk); -+} -+ -+static int xrx200_of_mdio(struct xrx200_hw *hw, struct device_node *np) -+{ -+ hw->mii_bus = mdiobus_alloc(); -+ if (!hw->mii_bus) -+ return -ENOMEM; -+ -+ hw->mii_bus->read = xrx200_mdio_rd; -+ hw->mii_bus->write = xrx200_mdio_wr; -+ hw->mii_bus->name = "lantiq,xrx200-mdio"; -+ snprintf(hw->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0); -+ -+ if (of_mdiobus_register(hw->mii_bus, np)) { -+ mdiobus_free(hw->mii_bus); -+ return -ENXIO; -+ } -+ -+ return 0; -+} -+ -+static void xrx200_of_port(struct xrx200_priv *priv, struct device_node *port) -+{ -+ const __be32 *addr, *id = of_get_property(port, "reg", NULL); -+ struct xrx200_port *p = &priv->port[priv->num_port]; -+ -+ if (!id) -+ return; -+ -+ memset(p, 0, sizeof(struct xrx200_port)); -+ p->phy_node = of_parse_phandle(port, "phy-handle", 0); -+ addr = of_get_property(p->phy_node, "reg", NULL); -+ if (!addr) -+ return; -+ -+ p->num = *id; -+ p->phy_addr = *addr; -+ p->phy_if = of_get_phy_mode(port); -+ if (p->phy_addr > 0x10) -+ p->flags = XRX200_PORT_TYPE_MAC; -+ else -+ p->flags = XRX200_PORT_TYPE_PHY; -+ priv->num_port++; -+ -+ p->gpio = of_get_gpio_flags(port, 0, &p->gpio_flags); -+ if (gpio_is_valid(p->gpio)) -+ if (!gpio_request(p->gpio, "phy-reset")) { -+ gpio_direction_output(p->gpio, -+ (p->gpio_flags & OF_GPIO_ACTIVE_LOW) ? (1) : (0)); -+ udelay(100); -+ gpio_set_value(p->gpio, (p->gpio_flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); -+ } -+ /* is this port a wan port ? */ -+ if (priv->wan) -+ priv->hw->wan_map |= BIT(p->num); -+ -+ priv->port_map |= BIT(p->num); -+ -+ /* store the port id in the hw struct so we can map ports -> devices */ -+ priv->hw->port_map[p->num] = priv->hw->num_devs; -+} -+ -+static const struct net_device_ops xrx200_netdev_ops = { -+ .ndo_init = xrx200_init, -+ .ndo_open = xrx200_open, -+ .ndo_stop = xrx200_close, -+ .ndo_start_xmit = xrx200_start_xmit, -+ .ndo_set_mac_address = eth_mac_addr, -+ .ndo_validate_addr = eth_validate_addr, -+ .ndo_change_mtu = eth_change_mtu, -+ .ndo_get_stats = xrx200_get_stats, -+ .ndo_tx_timeout = xrx200_tx_timeout, -+}; -+ -+static void xrx200_of_iface(struct xrx200_hw *hw, struct device_node *iface, struct device *dev) -+{ -+ struct xrx200_priv *priv; -+ struct device_node *port; -+ const __be32 *wan; -+ const u8 *mac; -+ -+ /* alloc the network device */ -+ hw->devs[hw->num_devs] = alloc_etherdev(sizeof(struct xrx200_priv)); -+ if (!hw->devs[hw->num_devs]) -+ return; -+ -+ /* setup the network device */ -+ strcpy(hw->devs[hw->num_devs]->name, "eth%d"); -+ hw->devs[hw->num_devs]->netdev_ops = &xrx200_netdev_ops; -+ hw->devs[hw->num_devs]->watchdog_timeo = XRX200_TX_TIMEOUT; -+ hw->devs[hw->num_devs]->needed_headroom = XRX200_HEADROOM; -+ SET_NETDEV_DEV(hw->devs[hw->num_devs], dev); -+ -+ /* setup our private data */ -+ priv = netdev_priv(hw->devs[hw->num_devs]); -+ priv->hw = hw; -+ priv->id = hw->num_devs; -+ -+ mac = of_get_mac_address(iface); -+ if (mac) -+ memcpy(priv->mac, mac, ETH_ALEN); -+ -+ /* is this the wan interface ? */ -+ wan = of_get_property(iface, "lantiq,wan", NULL); -+ if (wan && (*wan == 1)) -+ priv->wan = 1; -+ -+ /* should the switch be enabled on this interface ? */ -+ if (of_find_property(iface, "lantiq,switch", NULL)) -+ priv->sw = 1; -+ -+ /* load the ports that are part of the interface */ -+ for_each_child_of_node(iface, port) -+ if (of_device_is_compatible(port, "lantiq,xrx200-pdi-port")) -+ xrx200_of_port(priv, port); -+ -+ /* register the actual device */ -+ if (!register_netdev(hw->devs[hw->num_devs])) -+ hw->num_devs++; -+} -+ -+static struct xrx200_hw xrx200_hw; -+ -+static int xrx200_probe(struct platform_device *pdev) -+{ -+ struct resource *res[4]; -+ struct device_node *mdio_np, *iface_np; -+ int i; -+ -+ /* load the memory ranges */ -+ for (i = 0; i < 4; i++) { -+ res[i] = platform_get_resource(pdev, IORESOURCE_MEM, i); -+ if (!res[i]) { -+ dev_err(&pdev->dev, "failed to get resources\n"); -+ return -ENOENT; -+ } -+ } -+ xrx200_switch_membase = devm_ioremap_resource(&pdev->dev, res[0]); -+ xrx200_mdio_membase = devm_ioremap_resource(&pdev->dev, res[1]); -+ xrx200_mii_membase = devm_ioremap_resource(&pdev->dev, res[2]); -+ xrx200_pmac_membase = devm_ioremap_resource(&pdev->dev, res[3]); -+ if (!xrx200_switch_membase || !xrx200_mdio_membase || -+ !xrx200_mii_membase || !xrx200_pmac_membase) { -+ dev_err(&pdev->dev, "failed to request and remap io ranges \n"); -+ return -ENOMEM; -+ } -+ -+ /* get the clock */ -+ xrx200_hw.clk = clk_get(&pdev->dev, NULL); -+ if (IS_ERR(xrx200_hw.clk)) { -+ dev_err(&pdev->dev, "failed to get clock\n"); -+ return PTR_ERR(xrx200_hw.clk); -+ } -+ -+ /* bring up the dma engine and IP core */ -+ xrx200_dma_init(&xrx200_hw); -+ xrx200_hw_init(&xrx200_hw); -+ tasklet_init(&xrx200_hw.chan[XRX200_DMA_TX].tasklet, xrx200_tx_housekeeping, (u32) &xrx200_hw.chan[XRX200_DMA_TX]); -+ tasklet_init(&xrx200_hw.chan[XRX200_DMA_TX_2].tasklet, xrx200_tx_housekeeping, (u32) &xrx200_hw.chan[XRX200_DMA_TX_2]); -+ -+ /* bring up the mdio bus */ -+ mdio_np = of_find_compatible_node(pdev->dev.of_node, NULL, -+ "lantiq,xrx200-mdio"); -+ if (mdio_np) -+ if (xrx200_of_mdio(&xrx200_hw, mdio_np)) -+ dev_err(&pdev->dev, "mdio probe failed\n"); -+ -+ /* load the interfaces */ -+ for_each_child_of_node(pdev->dev.of_node, iface_np) -+ if (of_device_is_compatible(iface_np, "lantiq,xrx200-pdi")) { -+ if (xrx200_hw.num_devs < XRX200_MAX_DEV) -+ xrx200_of_iface(&xrx200_hw, iface_np, &pdev->dev); -+ else -+ dev_err(&pdev->dev, -+ "only %d interfaces allowed\n", -+ XRX200_MAX_DEV); -+ } -+ -+ if (!xrx200_hw.num_devs) { -+ xrx200_hw_cleanup(&xrx200_hw); -+ dev_err(&pdev->dev, "failed to load interfaces\n"); -+ return -ENOENT; -+ } -+ -+ xrx200sw_init(&xrx200_hw); -+ -+ /* set wan port mask */ -+ ltq_pmac_w32(xrx200_hw.wan_map, PMAC_EWAN); -+ -+ for (i = 0; i < xrx200_hw.num_devs; i++) { -+ xrx200_hw.chan[XRX200_DMA_RX].devs[i] = xrx200_hw.devs[i]; -+ xrx200_hw.chan[XRX200_DMA_TX].devs[i] = xrx200_hw.devs[i]; -+ xrx200_hw.chan[XRX200_DMA_TX_2].devs[i] = xrx200_hw.devs[i]; -+ } -+ -+ /* setup NAPI */ -+ init_dummy_netdev(&xrx200_hw.chan[XRX200_DMA_RX].dummy_dev); -+ netif_napi_add(&xrx200_hw.chan[XRX200_DMA_RX].dummy_dev, -+ &xrx200_hw.chan[XRX200_DMA_RX].napi, xrx200_poll_rx, 32); -+ -+ platform_set_drvdata(pdev, &xrx200_hw); -+ -+ return 0; -+} -+ -+static int xrx200_remove(struct platform_device *pdev) -+{ -+ struct net_device *dev = platform_get_drvdata(pdev); -+ struct xrx200_priv *priv; -+ -+ if (!dev) -+ return 0; -+ -+ priv = netdev_priv(dev); -+ -+ /* free stack related instances */ -+ netif_stop_queue(dev); -+ netif_napi_del(&xrx200_hw.chan[XRX200_DMA_RX].napi); -+ -+ /* shut down hardware */ -+ xrx200_hw_cleanup(&xrx200_hw); -+ -+ /* remove the actual device */ -+ unregister_netdev(dev); -+ free_netdev(dev); -+ -+ return 0; -+} -+ -+static const struct of_device_id xrx200_match[] = { -+ { .compatible = "lantiq,xrx200-net" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, xrx200_match); -+ -+static struct platform_driver xrx200_driver = { -+ .probe = xrx200_probe, -+ .remove = xrx200_remove, -+ .driver = { -+ .name = "lantiq,xrx200-net", -+ .of_match_table = xrx200_match, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(xrx200_driver); -+ -+MODULE_AUTHOR("John Crispin "); -+MODULE_DESCRIPTION("Lantiq SoC XRX200 ethernet"); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/drivers/net/ethernet/lantiq_xrx200_sw.h -@@ -0,0 +1,1328 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * Copyright (C) 2010 Lantiq Deutschland GmbH -+ * Copyright (C) 2013 Antonios Vamporakis -+ * -+ * VR9 switch registers extracted from 310TUJ0 switch api -+ * WARNING mult values of 0x00 may not be correct -+ * -+ */ -+ -+enum { -+// XRX200_ETHSW_SWRES, /* Ethernet Switch ResetControl Register */ -+// XRX200_ETHSW_SWRES_R1, /* Hardware Reset */ -+// XRX200_ETHSW_SWRES_R0, /* Register Configuration */ -+// XRX200_ETHSW_CLK_MAC_GAT, /* Ethernet Switch Clock ControlRegister */ -+// XRX200_ETHSW_CLK_EXP_SLEEP, /* Exponent to put system into sleep */ -+// XRX200_ETHSW_CLK_EXP_WAKE, /* Exponent to wake up system */ -+// XRX200_ETHSW_CLK_CLK2_EN, /* CLK2 Input for MAC */ -+// XRX200_ETHSW_CLK_EXT_DIV_EN, /* External Clock Divider Enable */ -+// XRX200_ETHSW_CLK_RAM_DBG_EN, /* Clock Gating Enable */ -+// XRX200_ETHSW_CLK_REG_GAT_EN, /* Clock Gating Enable */ -+// XRX200_ETHSW_CLK_GAT_EN, /* Clock Gating Enable */ -+// XRX200_ETHSW_CLK_MAC_GAT_EN, /* Clock Gating Enable */ -+// XRX200_ETHSW_DBG_STEP, /* Ethernet Switch Debug ControlRegister */ -+// XRX200_ETHSW_DBG_CLK_SEL, /* Trigger Enable */ -+// XRX200_ETHSW_DBG_MON_EN, /* Monitoring Enable */ -+// XRX200_ETHSW_DBG_TRIG_EN, /* Trigger Enable */ -+// XRX200_ETHSW_DBG_MODE, /* Debug Mode */ -+// XRX200_ETHSW_DBG_STEP_TIME, /* Clock Step Size */ -+// XRX200_ETHSW_SSB_MODE, /* Ethernet Switch SharedSegment Buffer Mode Register */ -+// XRX200_ETHSW_SSB_MODE_ADDE, /* Memory Address */ -+// XRX200_ETHSW_SSB_MODE_MODE, /* Memory Access Mode */ -+// XRX200_ETHSW_SSB_ADDR, /* Ethernet Switch SharedSegment Buffer Address Register */ -+// XRX200_ETHSW_SSB_ADDR_ADDE, /* Memory Address */ -+// XRX200_ETHSW_SSB_DATA, /* Ethernet Switch SharedSegment Buffer Data Register */ -+// XRX200_ETHSW_SSB_DATA_DATA, /* Data Value */ -+// XRX200_ETHSW_CAP_0, /* Ethernet Switch CapabilityRegister 0 */ -+// XRX200_ETHSW_CAP_0_SPEED, /* Clock frequency */ -+// XRX200_ETHSW_CAP_1, /* Ethernet Switch CapabilityRegister 1 */ -+// XRX200_ETHSW_CAP_1_GMAC, /* MAC operation mode */ -+// XRX200_ETHSW_CAP_1_QUEUE, /* Number of queues */ -+// XRX200_ETHSW_CAP_1_VPORTS, /* Number of virtual ports */ -+// XRX200_ETHSW_CAP_1_PPORTS, /* Number of physical ports */ -+// XRX200_ETHSW_CAP_2, /* Ethernet Switch CapabilityRegister 2 */ -+// XRX200_ETHSW_CAP_2_PACKETS, /* Number of packets */ -+// XRX200_ETHSW_CAP_3, /* Ethernet Switch CapabilityRegister 3 */ -+// XRX200_ETHSW_CAP_3_METERS, /* Number of traffic meters */ -+// XRX200_ETHSW_CAP_3_SHAPERS, /* Number of traffic shapers */ -+// XRX200_ETHSW_CAP_4, /* Ethernet Switch CapabilityRegister 4 */ -+// XRX200_ETHSW_CAP_4_PPPOE, /* PPPoE table size */ -+// XRX200_ETHSW_CAP_4_VLAN, /* Active VLAN table size */ -+// XRX200_ETHSW_CAP_5, /* Ethernet Switch CapabilityRegister 5 */ -+// XRX200_ETHSW_CAP_5_IPPLEN, /* IP packet length table size */ -+// XRX200_ETHSW_CAP_5_PROT, /* Protocol table size */ -+// XRX200_ETHSW_CAP_6, /* Ethernet Switch CapabilityRegister 6 */ -+// XRX200_ETHSW_CAP_6_MACDASA, /* MAC DA/SA table size */ -+// XRX200_ETHSW_CAP_6_APPL, /* Application table size */ -+// XRX200_ETHSW_CAP_7, /* Ethernet Switch CapabilityRegister 7 */ -+// XRX200_ETHSW_CAP_7_IPDASAM, /* IP DA/SA MSB table size */ -+// XRX200_ETHSW_CAP_7_IPDASAL, /* IP DA/SA LSB table size */ -+// XRX200_ETHSW_CAP_8, /* Ethernet Switch CapabilityRegister 8 */ -+// XRX200_ETHSW_CAP_8_MCAST, /* Multicast table size */ -+// XRX200_ETHSW_CAP_9, /* Ethernet Switch CapabilityRegister 9 */ -+// XRX200_ETHSW_CAP_9_FLAGG, /* Flow Aggregation table size */ -+// XRX200_ETHSW_CAP_10, /* Ethernet Switch CapabilityRegister 10 */ -+// XRX200_ETHSW_CAP_10_MACBT, /* MAC bridging table size */ -+// XRX200_ETHSW_CAP_11, /* Ethernet Switch CapabilityRegister 11 */ -+// XRX200_ETHSW_CAP_11_BSIZEL, /* Packet buffer size (lower part, in byte) */ -+// XRX200_ETHSW_CAP_12, /* Ethernet Switch CapabilityRegister 12 */ -+// XRX200_ETHSW_CAP_12_BSIZEH, /* Packet buffer size (higher part, in byte) */ -+// XRX200_ETHSW_VERSION_REV, /* Ethernet Switch VersionRegister */ -+// XRX200_ETHSW_VERSION_MOD_ID, /* Module Identification */ -+// XRX200_ETHSW_VERSION_REV_ID, /* Hardware Revision Identification */ -+// XRX200_ETHSW_IER, /* Interrupt Enable Register */ -+// XRX200_ETHSW_IER_FDMAIE, /* Fetch DMA Interrupt Enable */ -+// XRX200_ETHSW_IER_SDMAIE, /* Store DMA Interrupt Enable */ -+// XRX200_ETHSW_IER_MACIE, /* Ethernet MAC Interrupt Enable */ -+// XRX200_ETHSW_IER_PCEIE, /* Parser and Classification Engine Interrupt Enable */ -+// XRX200_ETHSW_IER_BMIE, /* Buffer Manager Interrupt Enable */ -+// XRX200_ETHSW_ISR, /* Interrupt Status Register */ -+// XRX200_ETHSW_ISR_FDMAINT, /* Fetch DMA Interrupt */ -+// XRX200_ETHSW_ISR_SDMAINT, /* Store DMA Interrupt */ -+// XRX200_ETHSW_ISR_MACINT, /* Ethernet MAC Interrupt */ -+// XRX200_ETHSW_ISR_PCEINT, /* Parser and Classification Engine Interrupt */ -+// XRX200_ETHSW_ISR_BMINT, /* Buffer Manager Interrupt */ -+// XRX200_ETHSW_SPARE_0, /* Ethernet Switch SpareCells 0 */ -+// XRX200_ETHSW_SPARE_0_SPARE, /* SPARE0 */ -+// XRX200_ETHSW_SPARE_1, /* Ethernet Switch SpareCells 1 */ -+// XRX200_ETHSW_SPARE_1_SPARE, /* SPARE1 */ -+// XRX200_ETHSW_SPARE_2, /* Ethernet Switch SpareCells 2 */ -+// XRX200_ETHSW_SPARE_2_SPARE, /* SPARE2 */ -+// XRX200_ETHSW_SPARE_3, /* Ethernet Switch SpareCells 3 */ -+// XRX200_ETHSW_SPARE_3_SPARE, /* SPARE3 */ -+// XRX200_ETHSW_SPARE_4, /* Ethernet Switch SpareCells 4 */ -+// XRX200_ETHSW_SPARE_4_SPARE, /* SPARE4 */ -+// XRX200_ETHSW_SPARE_5, /* Ethernet Switch SpareCells 5 */ -+// XRX200_ETHSW_SPARE_5_SPARE, /* SPARE5 */ -+// XRX200_ETHSW_SPARE_6, /* Ethernet Switch SpareCells 6 */ -+// XRX200_ETHSW_SPARE_6_SPARE, /* SPARE6 */ -+// XRX200_ETHSW_SPARE_7, /* Ethernet Switch SpareCells 7 */ -+// XRX200_ETHSW_SPARE_7_SPARE, /* SPARE7 */ -+// XRX200_ETHSW_SPARE_8, /* Ethernet Switch SpareCells 8 */ -+// XRX200_ETHSW_SPARE_8_SPARE, /* SPARE8 */ -+// XRX200_ETHSW_SPARE_9, /* Ethernet Switch SpareCells 9 */ -+// XRX200_ETHSW_SPARE_9_SPARE, /* SPARE9 */ -+// XRX200_ETHSW_SPARE_10, /* Ethernet Switch SpareCells 10 */ -+// XRX200_ETHSW_SPARE_10_SPARE, /* SPARE10 */ -+// XRX200_ETHSW_SPARE_11, /* Ethernet Switch SpareCells 11 */ -+// XRX200_ETHSW_SPARE_11_SPARE, /* SPARE11 */ -+// XRX200_ETHSW_SPARE_12, /* Ethernet Switch SpareCells 12 */ -+// XRX200_ETHSW_SPARE_12_SPARE, /* SPARE12 */ -+// XRX200_ETHSW_SPARE_13, /* Ethernet Switch SpareCells 13 */ -+// XRX200_ETHSW_SPARE_13_SPARE, /* SPARE13 */ -+// XRX200_ETHSW_SPARE_14, /* Ethernet Switch SpareCells 14 */ -+// XRX200_ETHSW_SPARE_14_SPARE, /* SPARE14 */ -+// XRX200_ETHSW_SPARE_15, /* Ethernet Switch SpareCells 15 */ -+// XRX200_ETHSW_SPARE_15_SPARE, /* SPARE15 */ -+// XRX200_BM_RAM_VAL_3, /* RAM Value Register 3 */ -+// XRX200_BM_RAM_VAL_3_VAL3, /* Data value [15:0] */ -+// XRX200_BM_RAM_VAL_2, /* RAM Value Register 2 */ -+// XRX200_BM_RAM_VAL_2_VAL2, /* Data value [15:0] */ -+// XRX200_BM_RAM_VAL_1, /* RAM Value Register 1 */ -+// XRX200_BM_RAM_VAL_1_VAL1, /* Data value [15:0] */ -+// XRX200_BM_RAM_VAL_0, /* RAM Value Register 0 */ -+// XRX200_BM_RAM_VAL_0_VAL0, /* Data value [15:0] */ -+// XRX200_BM_RAM_ADDR, /* RAM Address Register */ -+// XRX200_BM_RAM_ADDR_ADDR, /* RAM Address */ -+// XRX200_BM_RAM_CTRL, /* RAM Access Control Register */ -+// XRX200_BM_RAM_CTRL_BAS, /* Access Busy/Access Start */ -+// XRX200_BM_RAM_CTRL_OPMOD, /* Lookup Table Access Operation Mode */ -+// XRX200_BM_RAM_CTRL_ADDR, /* Address for RAM selection */ -+// XRX200_BM_FSQM_GCTRL, /* Free Segment Queue ManagerGlobal Control Register */ -+// XRX200_BM_FSQM_GCTRL_SEGNUM, /* Maximum Segment Number */ -+// XRX200_BM_CONS_SEG, /* Number of Consumed SegmentsRegister */ -+// XRX200_BM_CONS_SEG_FSEG, /* Number of Consumed Segments */ -+// XRX200_BM_CONS_PKT, /* Number of Consumed PacketPointers Register */ -+// XRX200_BM_CONS_PKT_FQP, /* Number of Consumed Packet Pointers */ -+// XRX200_BM_GCTRL_F, /* Buffer Manager Global ControlRegister 0 */ -+// XRX200_BM_GCTRL_BM_STA, /* Buffer Manager Initialization Status Bit */ -+// XRX200_BM_GCTRL_SAT, /* RMON Counter Update Mode */ -+// XRX200_BM_GCTRL_FR_RBC, /* Freeze RMON RX Bad Byte 64 Bit Counter */ -+// XRX200_BM_GCTRL_FR_RGC, /* Freeze RMON RX Good Byte 64 Bit Counter */ -+// XRX200_BM_GCTRL_FR_TGC, /* Freeze RMON TX Good Byte 64 Bit Counter */ -+// XRX200_BM_GCTRL_I_FIN, /* RAM initialization finished */ -+// XRX200_BM_GCTRL_CX_INI, /* PQM Context RAM initialization */ -+// XRX200_BM_GCTRL_FP_INI, /* FPQM RAM initialization */ -+// XRX200_BM_GCTRL_FS_INI, /* FSQM RAM initialization */ -+// XRX200_BM_GCTRL_R_SRES, /* Software Reset for RMON */ -+// XRX200_BM_GCTRL_S_SRES, /* Software Reset for Scheduler */ -+// XRX200_BM_GCTRL_A_SRES, /* Software Reset for AVG */ -+// XRX200_BM_GCTRL_P_SRES, /* Software Reset for PQM */ -+// XRX200_BM_GCTRL_F_SRES, /* Software Reset for FSQM */ -+// XRX200_BM_QUEUE_GCTRL, /* Queue Manager GlobalControl Register 0 */ -+ XRX200_BM_QUEUE_GCTRL_GL_MOD, /* WRED Mode Signal */ -+// XRX200_BM_QUEUE_GCTRL_AQUI, /* Average Queue Update Interval */ -+// XRX200_BM_QUEUE_GCTRL_AQWF, /* Average Queue Weight Factor */ -+// XRX200_BM_QUEUE_GCTRL_QAVGEN, /* Queue Average Calculation Enable */ -+// XRX200_BM_QUEUE_GCTRL_DPROB, /* Drop Probability Profile */ -+// XRX200_BM_WRED_RTH_0, /* WRED Red Threshold Register0 */ -+// XRX200_BM_WRED_RTH_0_MINTH, /* Minimum Threshold */ -+// XRX200_BM_WRED_RTH_1, /* WRED Red Threshold Register1 */ -+// XRX200_BM_WRED_RTH_1_MAXTH, /* Maximum Threshold */ -+// XRX200_BM_WRED_YTH_0, /* WRED Yellow ThresholdRegister 0 */ -+// XRX200_BM_WRED_YTH_0_MINTH, /* Minimum Threshold */ -+// XRX200_BM_WRED_YTH_1, /* WRED Yellow ThresholdRegister 1 */ -+// XRX200_BM_WRED_YTH_1_MAXTH, /* Maximum Threshold */ -+// XRX200_BM_WRED_GTH_0, /* WRED Green ThresholdRegister 0 */ -+// XRX200_BM_WRED_GTH_0_MINTH, /* Minimum Threshold */ -+// XRX200_BM_WRED_GTH_1, /* WRED Green ThresholdRegister 1 */ -+// XRX200_BM_WRED_GTH_1_MAXTH, /* Maximum Threshold */ -+// XRX200_BM_DROP_GTH_0_THR, /* Drop Threshold ConfigurationRegister 0 */ -+// XRX200_BM_DROP_GTH_0_THR_FQ, /* Threshold for frames marked red */ -+// XRX200_BM_DROP_GTH_1_THY, /* Drop Threshold ConfigurationRegister 1 */ -+// XRX200_BM_DROP_GTH_1_THY_FQ, /* Threshold for frames marked yellow */ -+// XRX200_BM_DROP_GTH_2_THG, /* Drop Threshold ConfigurationRegister 2 */ -+// XRX200_BM_DROP_GTH_2_THG_FQ, /* Threshold for frames marked green */ -+// XRX200_BM_IER, /* Buffer Manager Global InterruptEnable Register */ -+// XRX200_BM_IER_CNT4, /* Counter Group 4 (RMON-CLASSIFICATION) Interrupt Enable */ -+// XRX200_BM_IER_CNT3, /* Counter Group 3 (RMON-PQM) Interrupt Enable */ -+// XRX200_BM_IER_CNT2, /* Counter Group 2 (RMON-SCHEDULER) Interrupt Enable */ -+// XRX200_BM_IER_CNT1, /* Counter Group 1 (RMON-QFETCH) Interrupt Enable */ -+// XRX200_BM_IER_CNT0, /* Counter Group 0 (RMON-QSTOR) Interrupt Enable */ -+// XRX200_BM_IER_DEQ, /* PQM dequeue Interrupt Enable */ -+// XRX200_BM_IER_ENQ, /* PQM Enqueue Interrupt Enable */ -+// XRX200_BM_IER_FSQM, /* Buffer Empty Interrupt Enable */ -+// XRX200_BM_ISR, /* Buffer Manager Global InterruptStatus Register */ -+// XRX200_BM_ISR_CNT4, /* Counter Group 4 Interrupt */ -+// XRX200_BM_ISR_CNT3, /* Counter Group 3 Interrupt */ -+// XRX200_BM_ISR_CNT2, /* Counter Group 2 Interrupt */ -+// XRX200_BM_ISR_CNT1, /* Counter Group 1 Interrupt */ -+// XRX200_BM_ISR_CNT0, /* Counter Group 0 Interrupt */ -+// XRX200_BM_ISR_DEQ, /* PQM dequeue Interrupt Enable */ -+// XRX200_BM_ISR_ENQ, /* PQM Enqueue Interrupt */ -+// XRX200_BM_ISR_FSQM, /* Buffer Empty Interrupt */ -+// XRX200_BM_CISEL, /* Buffer Manager RMON CounterInterrupt Select Register */ -+// XRX200_BM_CISEL_PORT, /* Port Number */ -+// XRX200_BM_DEBUG_CTRL_DBG, /* Debug Control Register */ -+// XRX200_BM_DEBUG_CTRL_DBG_SEL, /* Select Signal for Debug Multiplexer */ -+// XRX200_BM_DEBUG_VAL_DBG, /* Debug Value Register */ -+// XRX200_BM_DEBUG_VAL_DBG_DAT, /* Debug Data Value */ -+// XRX200_BM_PCFG, /* Buffer Manager PortConfiguration Register */ -+// XRX200_BM_PCFG_CNTEN, /* RMON Counter Enable */ -+// XRX200_BM_RMON_CTRL_RAM1, /* Buffer ManagerRMON Control Register */ -+// XRX200_BM_RMON_CTRL_RAM2_RES, /* Software Reset for RMON RAM2 */ -+// XRX200_BM_RMON_CTRL_RAM1_RES, /* Software Reset for RMON RAM1 */ -+// XRX200_PQM_DP, /* Packet Queue ManagerDrop Probability Register */ -+// XRX200_PQM_DP_DPROB, /* Drop Probability Profile */ -+// XRX200_PQM_RS, /* Packet Queue ManagerRate Shaper Assignment Register */ -+// XRX200_PQM_RS_EN2, /* Rate Shaper 2 Enable */ -+// XRX200_PQM_RS_RS2, /* Rate Shaper 2 */ -+// XRX200_PQM_RS_EN1, /* Rate Shaper 1 Enable */ -+// XRX200_PQM_RS_RS1, /* Rate Shaper 1 */ -+// XRX200_RS_CTRL, /* Rate Shaper ControlRegister */ -+// XRX200_RS_CTRL_RSEN, /* Rate Shaper Enable */ -+// XRX200_RS_CBS, /* Rate Shaper CommittedBurst Size Register */ -+// XRX200_RS_CBS_CBS, /* Committed Burst Size */ -+// XRX200_RS_IBS, /* Rate Shaper InstantaneousBurst Size Register */ -+// XRX200_RS_IBS_IBS, /* Instantaneous Burst Size */ -+// XRX200_RS_CIR_EXP, /* Rate Shaper RateExponent Register */ -+// XRX200_RS_CIR_EXP_EXP, /* Exponent */ -+// XRX200_RS_CIR_MANT, /* Rate Shaper RateMantissa Register */ -+// XRX200_RS_CIR_MANT_MANT, /* Mantissa */ -+ XRX200_PCE_TBL_KEY_7, /* Table Key Data 7 */ -+// XRX200_PCE_TBL_KEY_7_KEY7, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_KEY_6, /* Table Key Data 6 */ -+// XRX200_PCE_TBL_KEY_6_KEY6, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_KEY_5, /* Table Key Data 5 */ -+// XRX200_PCE_TBL_KEY_5_KEY5, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_KEY_4, /* Table Key Data 4 */ -+// XRX200_PCE_TBL_KEY_4_KEY4, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_KEY_3, /* Table Key Data 3 */ -+// XRX200_PCE_TBL_KEY_3_KEY3, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_KEY_2, /* Table Key Data 2 */ -+// XRX200_PCE_TBL_KEY_2_KEY2, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_KEY_1, /* Table Key Data 1 */ -+// XRX200_PCE_TBL_KEY_1_KEY1, /* Key Value[31:16] */ -+ XRX200_PCE_TBL_KEY_0, /* Table Key Data 0 */ -+// XRX200_PCE_TBL_KEY_0_KEY0, /* Key Value[15:0] */ -+ XRX200_PCE_TBL_MASK_0, /* Table Mask Write Register0 */ -+// XRX200_PCE_TBL_MASK_0_MASK0, /* Mask Pattern [15:0] */ -+ XRX200_PCE_TBL_VAL_4, /* Table Value Register4 */ -+// XRX200_PCE_TBL_VAL_4_VAL4, /* Data value [15:0] */ -+ XRX200_PCE_TBL_VAL_3, /* Table Value Register3 */ -+// XRX200_PCE_TBL_VAL_3_VAL3, /* Data value [15:0] */ -+ XRX200_PCE_TBL_VAL_2, /* Table Value Register2 */ -+// XRX200_PCE_TBL_VAL_2_VAL2, /* Data value [15:0] */ -+ XRX200_PCE_TBL_VAL_1, /* Table Value Register1 */ -+// XRX200_PCE_TBL_VAL_1_VAL1, /* Data value [15:0] */ -+ XRX200_PCE_TBL_VAL_0, /* Table Value Register0 */ -+// XRX200_PCE_TBL_VAL_0_VAL0, /* Data value [15:0] */ -+// XRX200_PCE_TBL_ADDR, /* Table Entry AddressRegister */ -+ XRX200_PCE_TBL_ADDR_ADDR, /* Table Address */ -+// XRX200_PCE_TBL_CTRL, /* Table Access ControlRegister */ -+ XRX200_PCE_TBL_CTRL_BAS, /* Access Busy/Access Start */ -+ XRX200_PCE_TBL_CTRL_TYPE, /* Lookup Entry Type */ -+ XRX200_PCE_TBL_CTRL_VLD, /* Lookup Entry Valid */ -+ XRX200_PCE_TBL_CTRL_GMAP, /* Group Map */ -+ XRX200_PCE_TBL_CTRL_OPMOD, /* Lookup Table Access Operation Mode */ -+ XRX200_PCE_TBL_CTRL_ADDR, /* Lookup Table Address */ -+// XRX200_PCE_TBL_STAT, /* Table General StatusRegister */ -+// XRX200_PCE_TBL_STAT_TBUSY, /* Table Access Busy */ -+// XRX200_PCE_TBL_STAT_TEMPT, /* Table Empty */ -+// XRX200_PCE_TBL_STAT_TFUL, /* Table Full */ -+// XRX200_PCE_AGE_0, /* Aging Counter ConfigurationRegister 0 */ -+// XRX200_PCE_AGE_0_EXP, /* Aging Counter Exponent Value */ -+// XRX200_PCE_AGE_1, /* Aging Counter ConfigurationRegister 1 */ -+// XRX200_PCE_AGE_1_MANT, /* Aging Counter Mantissa Value */ -+// XRX200_PCE_PMAP_1, /* Port Map Register 1 */ -+// XRX200_PCE_PMAP_1_MPMAP, /* Monitoring Port Map */ -+// XRX200_PCE_PMAP_2, /* Port Map Register 2 */ -+// XRX200_PCE_PMAP_2_DMCPMAP, /* Default Multicast Port Map */ -+// XRX200_PCE_PMAP_3, /* Port Map Register 3 */ -+// XRX200_PCE_PMAP_3_UUCMAP, /* Default Unknown Unicast Port Map */ -+// XRX200_PCE_GCTRL_0, /* PCE Global Control Register0 */ -+// XRX200_PCE_GCTRL_0_IGMP, /* IGMP Mode Selection */ -+ XRX200_PCE_GCTRL_0_VLAN, /* VLAN-aware Switching */ -+// XRX200_PCE_GCTRL_0_NOPM, /* No Port Map Forwarding */ -+// XRX200_PCE_GCTRL_0_SCONUC, /* Unknown Unicast Storm Control */ -+// XRX200_PCE_GCTRL_0_SCONMC, /* Multicast Storm Control */ -+// XRX200_PCE_GCTRL_0_SCONBC, /* Broadcast Storm Control */ -+// XRX200_PCE_GCTRL_0_SCONMOD, /* Storm Control Mode */ -+// XRX200_PCE_GCTRL_0_SCONMET, /* Storm Control Metering Instance */ -+// XRX200_PCE_GCTRL_0_MC_VALID, /* Access Request */ -+// XRX200_PCE_GCTRL_0_PLCKMOD, /* Port Lock Mode */ -+// XRX200_PCE_GCTRL_0_PLIMMOD, /* MAC Address Learning Limitation Mode */ -+// XRX200_PCE_GCTRL_0_MTFL, /* MAC Table Flushing */ -+// XRX200_PCE_GCTRL_1, /* PCE Global Control Register1 */ -+// XRX200_PCE_GCTRL_1_PCE_DIS, /* PCE Disable after currently processed packet */ -+// XRX200_PCE_GCTRL_1_LRNMOD, /* MAC Address Learning Mode */ -+// XRX200_PCE_TCM_GLOB_CTRL, /* Three-color MarkerGlobal Control Register */ -+// XRX200_PCE_TCM_GLOB_CTRL_DPRED, /* Re-marking Drop Precedence Red Encoding */ -+// XRX200_PCE_TCM_GLOB_CTRL_DPYEL, /* Re-marking Drop Precedence Yellow Encoding */ -+// XRX200_PCE_TCM_GLOB_CTRL_DPGRN, /* Re-marking Drop Precedence Green Encoding */ -+// XRX200_PCE_IGMP_CTRL, /* IGMP Control Register */ -+// XRX200_PCE_IGMP_CTRL_FAGEEN, /* Force Aging of Table Entries Enable */ -+// XRX200_PCE_IGMP_CTRL_FLEAVE, /* Fast Leave Enable */ -+// XRX200_PCE_IGMP_CTRL_DMRTEN, /* Default Maximum Response Time Enable */ -+// XRX200_PCE_IGMP_CTRL_JASUP, /* Join Aggregation Suppression Enable */ -+// XRX200_PCE_IGMP_CTRL_REPSUP, /* Report Suppression Enable */ -+// XRX200_PCE_IGMP_CTRL_SRPEN, /* Snooping of Router Port Enable */ -+// XRX200_PCE_IGMP_CTRL_ROB, /* Robustness Variable */ -+// XRX200_PCE_IGMP_CTRL_DMRT, /* IGMP Default Maximum Response Time */ -+// XRX200_PCE_IGMP_DRPM, /* IGMP Default RouterPort Map Register */ -+// XRX200_PCE_IGMP_DRPM_DRPM, /* IGMP Default Router Port Map */ -+// XRX200_PCE_IGMP_AGE_0, /* IGMP Aging Register0 */ -+// XRX200_PCE_IGMP_AGE_0_MANT, /* IGMP Group Aging Time Mantissa */ -+// XRX200_PCE_IGMP_AGE_0_EXP, /* IGMP Group Aging Time Exponent */ -+// XRX200_PCE_IGMP_AGE_1, /* IGMP Aging Register1 */ -+// XRX200_PCE_IGMP_AGE_1_MANT, /* IGMP Router Port Aging Time Mantissa */ -+// XRX200_PCE_IGMP_STAT, /* IGMP Status Register */ -+// XRX200_PCE_IGMP_STAT_IGPM, /* IGMP Port Map */ -+// XRX200_WOL_GLB_CTRL, /* Wake-on-LAN ControlRegister */ -+// XRX200_WOL_GLB_CTRL_PASSEN, /* WoL Password Enable */ -+// XRX200_WOL_DA_0, /* Wake-on-LAN DestinationAddress Register 0 */ -+// XRX200_WOL_DA_0_DA0, /* WoL Destination Address [15:0] */ -+// XRX200_WOL_DA_1, /* Wake-on-LAN DestinationAddress Register 1 */ -+// XRX200_WOL_DA_1_DA1, /* WoL Destination Address [31:16] */ -+// XRX200_WOL_DA_2, /* Wake-on-LAN DestinationAddress Register 2 */ -+// XRX200_WOL_DA_2_DA2, /* WoL Destination Address [47:32] */ -+// XRX200_WOL_PW_0, /* Wake-on-LAN Password Register0 */ -+// XRX200_WOL_PW_0_PW0, /* WoL Password [15:0] */ -+// XRX200_WOL_PW_1, /* Wake-on-LAN Password Register1 */ -+// XRX200_WOL_PW_1_PW1, /* WoL Password [31:16] */ -+// XRX200_WOL_PW_2, /* Wake-on-LAN Password Register2 */ -+// XRX200_WOL_PW_2_PW2, /* WoL Password [47:32] */ -+// XRX200_PCE_IER_0_PINT, /* Parser and ClassificationEngine Global Interrupt Enable Register 0 */ -+// XRX200_PCE_IER_0_PINT_15, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_14, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_13, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_12, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_11, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_10, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_9, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_8, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_7, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_6, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_5, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_4, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_3, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_2, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_1, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_0_PINT_0, /* Port Interrupt Enable */ -+// XRX200_PCE_IER_1, /* Parser and ClassificationEngine Global Interrupt Enable Register 1 */ -+// XRX200_PCE_IER_1_FLOWINT, /* Traffic Flow Table Interrupt Rule matched Interrupt Enable */ -+// XRX200_PCE_IER_1_CPH2, /* Classification Phase 2 Ready Interrupt Enable */ -+// XRX200_PCE_IER_1_CPH1, /* Classification Phase 1 Ready Interrupt Enable */ -+// XRX200_PCE_IER_1_CPH0, /* Classification Phase 0 Ready Interrupt Enable */ -+// XRX200_PCE_IER_1_PRDY, /* Parser Ready Interrupt Enable */ -+// XRX200_PCE_IER_1_IGTF, /* IGMP Table Full Interrupt Enable */ -+// XRX200_PCE_IER_1_MTF, /* MAC Table Full Interrupt Enable */ -+// XRX200_PCE_ISR_0_PINT, /* Parser and ClassificationEngine Global Interrupt Status Register 0 */ -+// XRX200_PCE_ISR_0_PINT_15, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_14, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_13, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_12, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_11, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_10, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_9, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_8, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_7, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_6, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_5, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_4, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_3, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_2, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_1, /* Port Interrupt */ -+// XRX200_PCE_ISR_0_PINT_0, /* Port Interrupt */ -+// XRX200_PCE_ISR_1, /* Parser and ClassificationEngine Global Interrupt Status Register 1 */ -+// XRX200_PCE_ISR_1_FLOWINT, /* Traffic Flow Table Interrupt Rule matched */ -+// XRX200_PCE_ISR_1_CPH2, /* Classification Phase 2 Ready Interrupt */ -+// XRX200_PCE_ISR_1_CPH1, /* Classification Phase 1 Ready Interrupt */ -+// XRX200_PCE_ISR_1_CPH0, /* Classification Phase 0 Ready Interrupt */ -+// XRX200_PCE_ISR_1_PRDY, /* Parser Ready Interrupt */ -+// XRX200_PCE_ISR_1_IGTF, /* IGMP Table Full Interrupt */ -+// XRX200_PCE_ISR_1_MTF, /* MAC Table Full Interrupt */ -+// XRX200_PARSER_STAT_FIFO, /* Parser Status Register */ -+// XRX200_PARSER_STAT_FSM_DAT_CNT, /* Parser FSM Data Counter */ -+// XRX200_PARSER_STAT_FSM_STATE, /* Parser FSM State */ -+// XRX200_PARSER_STAT_PKT_ERR, /* Packet error detected */ -+// XRX200_PARSER_STAT_FSM_FIN, /* Parser FSM finished */ -+// XRX200_PARSER_STAT_FSM_START, /* Parser FSM start */ -+// XRX200_PARSER_STAT_FIFO_RDY, /* Parser FIFO ready for read. */ -+// XRX200_PARSER_STAT_FIFO_FULL, /* Parser */ -+// XRX200_PCE_PCTRL_0, /* PCE Port ControlRegister 0 */ -+// XRX200_PCE_PCTRL_0_MCST, /* Multicast Forwarding Mode Selection */ -+// XRX200_PCE_PCTRL_0_EGSTEN, /* Table-based Egress Special Tag Enable */ -+// XRX200_PCE_PCTRL_0_IGSTEN, /* Ingress Special Tag Enable */ -+// XRX200_PCE_PCTRL_0_PCPEN, /* PCP Remarking Mode */ -+// XRX200_PCE_PCTRL_0_CLPEN, /* Class Remarking Mode */ -+// XRX200_PCE_PCTRL_0_DPEN, /* Drop Precedence Remarking Mode */ -+// XRX200_PCE_PCTRL_0_CMOD, /* Three-color Marker Color Mode */ -+// XRX200_PCE_PCTRL_0_VREP, /* VLAN Replacement Mode */ -+ XRX200_PCE_PCTRL_0_TVM, /* Transparent VLAN Mode */ -+// XRX200_PCE_PCTRL_0_PLOCK, /* Port Locking Enable */ -+// XRX200_PCE_PCTRL_0_AGEDIS, /* Aging Disable */ -+// XRX200_PCE_PCTRL_0_PSTATE, /* Port State */ -+// XRX200_PCE_PCTRL_1, /* PCE Port ControlRegister 1 */ -+// XRX200_PCE_PCTRL_1_LRNLIM, /* MAC Address Learning Limit */ -+// XRX200_PCE_PCTRL_2, /* PCE Port ControlRegister 2 */ -+// XRX200_PCE_PCTRL_2_DSCPMOD, /* DSCP Mode Selection */ -+// XRX200_PCE_PCTRL_2_DSCP, /* Enable DSCP to select the Class of Service */ -+// XRX200_PCE_PCTRL_2_PCP, /* Enable VLAN PCP to select the Class of Service */ -+// XRX200_PCE_PCTRL_2_PCLASS, /* Port-based Traffic Class */ -+// XRX200_PCE_PCTRL_3_VIO, /* PCE Port ControlRegister 3 */ -+// XRX200_PCE_PCTRL_3_EDIR, /* Egress Redirection Mode */ -+// XRX200_PCE_PCTRL_3_RXDMIR, /* Receive Mirroring Enable for dropped frames */ -+// XRX200_PCE_PCTRL_3_RXVMIR, /* Receive Mirroring Enable for valid frames */ -+// XRX200_PCE_PCTRL_3_TXMIR, /* Transmit Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_7, /* Violation Type 7 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_6, /* Violation Type 6 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_5, /* Violation Type 5 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_4, /* Violation Type 4 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_3, /* Violation Type 3 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_2, /* Violation Type 2 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_1, /* Violation Type 1 Mirroring Enable */ -+// XRX200_PCE_PCTRL_3_VIO_0, /* Violation Type 0 Mirroring Enable */ -+// XRX200_WOL_CTRL, /* Wake-on-LAN ControlRegister */ -+// XRX200_WOL_CTRL_PORT, /* WoL Enable */ -+// XRX200_PCE_VCTRL, /* PCE VLAN ControlRegister */ -+ XRX200_PCE_VCTRL_VSR, /* VLAN Security Rule */ -+ XRX200_PCE_VCTRL_VEMR, /* VLAN Egress Member Violation Rule */ -+ XRX200_PCE_VCTRL_VIMR, /* VLAN Ingress Member Violation Rule */ -+ XRX200_PCE_VCTRL_VINR, /* VLAN Ingress Tag Rule */ -+ XRX200_PCE_VCTRL_UVR, /* Unknown VLAN Rule */ -+// XRX200_PCE_DEFPVID, /* PCE Default PortVID Register */ -+ XRX200_PCE_DEFPVID_PVID, /* Default Port VID Index */ -+// XRX200_PCE_PSTAT, /* PCE Port StatusRegister */ -+// XRX200_PCE_PSTAT_LRNCNT, /* Learning Count */ -+// XRX200_PCE_PIER, /* Parser and ClassificationEngine Port Interrupt Enable Register */ -+// XRX200_PCE_PIER_CLDRP, /* Classification Drop Interrupt Enable */ -+// XRX200_PCE_PIER_PTDRP, /* Port Drop Interrupt Enable */ -+// XRX200_PCE_PIER_VLAN, /* VLAN Violation Interrupt Enable */ -+// XRX200_PCE_PIER_WOL, /* Wake-on-LAN Interrupt Enable */ -+// XRX200_PCE_PIER_LOCK, /* Port Limit Alert Interrupt Enable */ -+// XRX200_PCE_PIER_LIM, /* Port Lock Alert Interrupt Enable */ -+// XRX200_PCE_PISR, /* Parser and ClassificationEngine Port Interrupt Status Register */ -+// XRX200_PCE_PISR_CLDRP, /* Classification Drop Interrupt */ -+// XRX200_PCE_PISR_PTDRP, /* Port Drop Interrupt */ -+// XRX200_PCE_PISR_VLAN, /* VLAN Violation Interrupt */ -+// XRX200_PCE_PISR_WOL, /* Wake-on-LAN Interrupt */ -+// XRX200_PCE_PISR_LOCK, /* Port Lock Alert Interrupt */ -+// XRX200_PCE_PISR_LIMIT, /* Port Limitation Alert Interrupt */ -+// XRX200_PCE_TCM_CTRL, /* Three-colorMarker Control Register */ -+// XRX200_PCE_TCM_CTRL_TCMEN, /* Three-color Marker metering instance enable */ -+// XRX200_PCE_TCM_STAT, /* Three-colorMarker Status Register */ -+// XRX200_PCE_TCM_STAT_AL1, /* Three-color Marker Alert 1 Status */ -+// XRX200_PCE_TCM_STAT_AL0, /* Three-color Marker Alert 0 Status */ -+// XRX200_PCE_TCM_CBS, /* Three-color MarkerCommitted Burst Size Register */ -+// XRX200_PCE_TCM_CBS_CBS, /* Committed Burst Size */ -+// XRX200_PCE_TCM_EBS, /* Three-color MarkerExcess Burst Size Register */ -+// XRX200_PCE_TCM_EBS_EBS, /* Excess Burst Size */ -+// XRX200_PCE_TCM_IBS, /* Three-color MarkerInstantaneous Burst Size Register */ -+// XRX200_PCE_TCM_IBS_IBS, /* Instantaneous Burst Size */ -+// XRX200_PCE_TCM_CIR_MANT, /* Three-colorMarker Constant Information Rate Mantissa Register */ -+// XRX200_PCE_TCM_CIR_MANT_MANT, /* Rate Counter Mantissa */ -+// XRX200_PCE_TCM_CIR_EXP, /* Three-colorMarker Constant Information Rate Exponent Register */ -+// XRX200_PCE_TCM_CIR_EXP_EXP, /* Rate Counter Exponent */ -+// XRX200_MAC_TEST, /* MAC Test Register */ -+// XRX200_MAC_TEST_JTP, /* Jitter Test Pattern */ -+// XRX200_MAC_PFAD_CFG, /* MAC Pause FrameSource Address Configuration Register */ -+// XRX200_MAC_PFAD_CFG_SAMOD, /* Source Address Mode */ -+// XRX200_MAC_PFSA_0, /* Pause Frame SourceAddress Part 0 */ -+// XRX200_MAC_PFSA_0_PFAD, /* Pause Frame Source Address Part 0 */ -+// XRX200_MAC_PFSA_1, /* Pause Frame SourceAddress Part 1 */ -+// XRX200_MAC_PFSA_1_PFAD, /* Pause Frame Source Address Part 1 */ -+// XRX200_MAC_PFSA_2, /* Pause Frame SourceAddress Part 2 */ -+// XRX200_MAC_PFSA_2_PFAD, /* Pause Frame Source Address Part 2 */ -+// XRX200_MAC_FLEN, /* MAC Frame Length Register */ -+// XRX200_MAC_FLEN_LEN, /* Maximum Frame Length */ -+// XRX200_MAC_VLAN_ETYPE_0, /* MAC VLAN EthertypeRegister 0 */ -+// XRX200_MAC_VLAN_ETYPE_0_OUTER, /* Ethertype */ -+// XRX200_MAC_VLAN_ETYPE_1, /* MAC VLAN EthertypeRegister 1 */ -+// XRX200_MAC_VLAN_ETYPE_1_INNER, /* Ethertype */ -+// XRX200_MAC_IER, /* MAC Interrupt EnableRegister */ -+// XRX200_MAC_IER_MACIEN, /* MAC Interrupt Enable */ -+// XRX200_MAC_ISR, /* MAC Interrupt StatusRegister */ -+// XRX200_MAC_ISR_MACINT, /* MAC Interrupt */ -+// XRX200_MAC_PSTAT, /* MAC Port Status Register */ -+// XRX200_MAC_PSTAT_PACT, /* PHY Active Status */ -+ XRX200_MAC_PSTAT_GBIT, /* Gigabit Speed Status */ -+ XRX200_MAC_PSTAT_MBIT, /* Megabit Speed Status */ -+ XRX200_MAC_PSTAT_FDUP, /* Full Duplex Status */ -+// XRX200_MAC_PSTAT_RXPAU, /* Receive Pause Status */ -+// XRX200_MAC_PSTAT_TXPAU, /* Transmit Pause Status */ -+// XRX200_MAC_PSTAT_RXPAUEN, /* Receive Pause Enable Status */ -+// XRX200_MAC_PSTAT_TXPAUEN, /* Transmit Pause Enable Status */ -+ XRX200_MAC_PSTAT_LSTAT, /* Link Status */ -+// XRX200_MAC_PSTAT_CRS, /* Carrier Sense Status */ -+// XRX200_MAC_PSTAT_TXLPI, /* Transmit Low-power Idle Status */ -+// XRX200_MAC_PSTAT_RXLPI, /* Receive Low-power Idle Status */ -+// XRX200_MAC_PISR, /* MAC Interrupt Status Register */ -+// XRX200_MAC_PISR_PACT, /* PHY Active Status */ -+// XRX200_MAC_PISR_SPEED, /* Megabit Speed Status */ -+// XRX200_MAC_PISR_FDUP, /* Full Duplex Status */ -+// XRX200_MAC_PISR_RXPAUEN, /* Receive Pause Enable Status */ -+// XRX200_MAC_PISR_TXPAUEN, /* Transmit Pause Enable Status */ -+// XRX200_MAC_PISR_LPIOFF, /* Receive Low-power Idle Mode is left */ -+// XRX200_MAC_PISR_LPION, /* Receive Low-power Idle Mode is entered */ -+// XRX200_MAC_PISR_JAM, /* Jam Status Detected */ -+// XRX200_MAC_PISR_TOOSHORT, /* Too Short Frame Error Detected */ -+// XRX200_MAC_PISR_TOOLONG, /* Too Long Frame Error Detected */ -+// XRX200_MAC_PISR_LENERR, /* Length Mismatch Error Detected */ -+// XRX200_MAC_PISR_FCSERR, /* Frame Checksum Error Detected */ -+// XRX200_MAC_PISR_TXPAUSE, /* Pause Frame Transmitted */ -+// XRX200_MAC_PISR_RXPAUSE, /* Pause Frame Received */ -+// XRX200_MAC_PIER, /* MAC Interrupt Enable Register */ -+// XRX200_MAC_PIER_PACT, /* PHY Active Status */ -+// XRX200_MAC_PIER_SPEED, /* Megabit Speed Status */ -+// XRX200_MAC_PIER_FDUP, /* Full Duplex Status */ -+// XRX200_MAC_PIER_RXPAUEN, /* Receive Pause Enable Status */ -+// XRX200_MAC_PIER_TXPAUEN, /* Transmit Pause Enable Status */ -+// XRX200_MAC_PIER_LPIOFF, /* Low-power Idle Off Interrupt Mask */ -+// XRX200_MAC_PIER_LPION, /* Low-power Idle On Interrupt Mask */ -+// XRX200_MAC_PIER_JAM, /* Jam Status Interrupt Mask */ -+// XRX200_MAC_PIER_TOOSHORT, /* Too Short Frame Error Interrupt Mask */ -+// XRX200_MAC_PIER_TOOLONG, /* Too Long Frame Error Interrupt Mask */ -+// XRX200_MAC_PIER_LENERR, /* Length Mismatch Error Interrupt Mask */ -+// XRX200_MAC_PIER_FCSERR, /* Frame Checksum Error Interrupt Mask */ -+// XRX200_MAC_PIER_TXPAUSE, /* Transmit Pause Frame Interrupt Mask */ -+// XRX200_MAC_PIER_RXPAUSE, /* Receive Pause Frame Interrupt Mask */ -+// XRX200_MAC_CTRL_0, /* MAC Control Register0 */ -+// XRX200_MAC_CTRL_0_LCOL, /* Late Collision Control */ -+// XRX200_MAC_CTRL_0_BM, /* Burst Mode Control */ -+// XRX200_MAC_CTRL_0_APADEN, /* Automatic VLAN Padding Enable */ -+// XRX200_MAC_CTRL_0_VPAD2EN, /* Stacked VLAN Padding Enable */ -+// XRX200_MAC_CTRL_0_VPADEN, /* VLAN Padding Enable */ -+// XRX200_MAC_CTRL_0_PADEN, /* Padding Enable */ -+// XRX200_MAC_CTRL_0_FCS, /* Transmit FCS Control */ -+ XRX200_MAC_CTRL_0_FCON, /* Flow Control Mode */ -+// XRX200_MAC_CTRL_0_FDUP, /* Full Duplex Control */ -+// XRX200_MAC_CTRL_0_GMII, /* GMII/MII interface mode selection */ -+// XRX200_MAC_CTRL_1, /* MAC Control Register1 */ -+// XRX200_MAC_CTRL_1_SHORTPRE, /* Short Preamble Control */ -+// XRX200_MAC_CTRL_1_IPG, /* Minimum Inter Packet Gap Size */ -+// XRX200_MAC_CTRL_2, /* MAC Control Register2 */ -+// XRX200_MAC_CTRL_2_MLEN, /* Maximum Untagged Frame Length */ -+// XRX200_MAC_CTRL_2_LCHKL, /* Frame Length Check Long Enable */ -+// XRX200_MAC_CTRL_2_LCHKS, /* Frame Length Check Short Enable */ -+// XRX200_MAC_CTRL_3, /* MAC Control Register3 */ -+// XRX200_MAC_CTRL_3_RCNT, /* Retry Count */ -+// XRX200_MAC_CTRL_4, /* MAC Control Register4 */ -+// XRX200_MAC_CTRL_4_LPIEN, /* LPI Mode Enable */ -+// XRX200_MAC_CTRL_4_WAIT, /* LPI Wait Time */ -+// XRX200_MAC_CTRL_5_PJPS, /* MAC Control Register5 */ -+// XRX200_MAC_CTRL_5_PJPS_NOBP, /* Prolonged Jam pattern size during no-backpressure state */ -+// XRX200_MAC_CTRL_5_PJPS_BP, /* Prolonged Jam pattern size during backpressure state */ -+// XRX200_MAC_CTRL_6_XBUF, /* Transmit and ReceiveBuffer Control Register */ -+// XRX200_MAC_CTRL_6_RBUF_DLY_WP, /* Delay */ -+// XRX200_MAC_CTRL_6_RBUF_INIT, /* Receive Buffer Initialization */ -+// XRX200_MAC_CTRL_6_RBUF_BYPASS, /* Bypass the Receive Buffer */ -+// XRX200_MAC_CTRL_6_XBUF_DLY_WP, /* Delay */ -+// XRX200_MAC_CTRL_6_XBUF_INIT, /* Initialize the Transmit Buffer */ -+// XRX200_MAC_CTRL_6_XBUF_BYPASS, /* Bypass the Transmit Buffer */ -+// XRX200_MAC_BUFST_XBUF, /* MAC Receive and TransmitBuffer Status Register */ -+// XRX200_MAC_BUFST_RBUF_UFL, /* Receive Buffer Underflow Indicator */ -+// XRX200_MAC_BUFST_RBUF_OFL, /* Receive Buffer Overflow Indicator */ -+// XRX200_MAC_BUFST_XBUF_UFL, /* Transmit Buffer Underflow Indicator */ -+// XRX200_MAC_BUFST_XBUF_OFL, /* Transmit Buffer Overflow Indicator */ -+// XRX200_MAC_TESTEN, /* MAC Test Enable Register */ -+// XRX200_MAC_TESTEN_JTEN, /* Jitter Test Enable */ -+// XRX200_MAC_TESTEN_TXER, /* Transmit Error Insertion */ -+// XRX200_MAC_TESTEN_LOOP, /* MAC Loopback Enable */ -+// XRX200_FDMA_CTRL, /* Ethernet Switch FetchDMA Control Register */ -+// XRX200_FDMA_CTRL_LPI_THRESHOLD, /* Low Power Idle Threshold */ -+// XRX200_FDMA_CTRL_LPI_MODE, /* Low Power Idle Mode */ -+// XRX200_FDMA_CTRL_EGSTAG, /* Egress Special Tag Size */ -+// XRX200_FDMA_CTRL_IGSTAG, /* Ingress Special Tag Size */ -+// XRX200_FDMA_CTRL_EXCOL, /* Excessive Collision Handling */ -+// XRX200_FDMA_STETYPE, /* Special Tag EthertypeControl Register */ -+// XRX200_FDMA_STETYPE_ETYPE, /* Special Tag Ethertype */ -+// XRX200_FDMA_VTETYPE, /* VLAN Tag EthertypeControl Register */ -+// XRX200_FDMA_VTETYPE_ETYPE, /* VLAN Tag Ethertype */ -+// XRX200_FDMA_STAT_0, /* FDMA Status Register0 */ -+// XRX200_FDMA_STAT_0_FSMS, /* FSM states status */ -+// XRX200_FDMA_IER, /* Fetch DMA Global InterruptEnable Register */ -+// XRX200_FDMA_IER_PCKD, /* Packet Drop Interrupt Enable */ -+// XRX200_FDMA_IER_PCKR, /* Packet Ready Interrupt Enable */ -+// XRX200_FDMA_IER_PCKT, /* Packet Sent Interrupt Enable */ -+// XRX200_FDMA_ISR, /* Fetch DMA Global InterruptStatus Register */ -+// XRX200_FDMA_ISR_PCKTD, /* Packet Drop */ -+// XRX200_FDMA_ISR_PCKR, /* Packet is Ready for Transmission */ -+// XRX200_FDMA_ISR_PCKT, /* Packet Sent Event */ -+// XRX200_FDMA_PCTRL, /* Ethernet SwitchFetch DMA Port Control Register */ -+// XRX200_FDMA_PCTRL_VLANMOD, /* VLAN Modification Enable */ -+// XRX200_FDMA_PCTRL_DSCPRM, /* DSCP Re-marking Enable */ -+// XRX200_FDMA_PCTRL_STEN, /* Special Tag Insertion Enable */ -+// XRX200_FDMA_PCTRL_EN, /* FDMA Port Enable */ -+// XRX200_FDMA_PRIO, /* Ethernet SwitchFetch DMA Port Priority Register */ -+// XRX200_FDMA_PRIO_PRIO, /* FDMA PRIO */ -+// XRX200_FDMA_PSTAT0, /* Ethernet SwitchFetch DMA Port Status Register 0 */ -+// XRX200_FDMA_PSTAT0_PKT_AVAIL, /* Port Egress Packet Available */ -+// XRX200_FDMA_PSTAT0_POK, /* Port Status OK */ -+// XRX200_FDMA_PSTAT0_PSEG, /* Port Egress Segment Count */ -+// XRX200_FDMA_PSTAT1_HDR, /* Ethernet SwitchFetch DMA Port Status Register 1 */ -+// XRX200_FDMA_PSTAT1_HDR_PTR, /* Header Pointer */ -+// XRX200_FDMA_TSTAMP0, /* Egress TimeStamp Register 0 */ -+// XRX200_FDMA_TSTAMP0_TSTL, /* Time Stamp [15:0] */ -+// XRX200_FDMA_TSTAMP1, /* Egress TimeStamp Register 1 */ -+// XRX200_FDMA_TSTAMP1_TSTH, /* Time Stamp [31:16] */ -+// XRX200_SDMA_CTRL, /* Ethernet Switch StoreDMA Control Register */ -+// XRX200_SDMA_CTRL_TSTEN, /* Time Stamp Enable */ -+// XRX200_SDMA_FCTHR1, /* SDMA Flow Control Threshold1 Register */ -+// XRX200_SDMA_FCTHR1_THR1, /* Threshold 1 */ -+// XRX200_SDMA_FCTHR2, /* SDMA Flow Control Threshold2 Register */ -+// XRX200_SDMA_FCTHR2_THR2, /* Threshold 2 */ -+// XRX200_SDMA_FCTHR3, /* SDMA Flow Control Threshold3 Register */ -+// XRX200_SDMA_FCTHR3_THR3, /* Threshold 3 */ -+// XRX200_SDMA_FCTHR4, /* SDMA Flow Control Threshold4 Register */ -+// XRX200_SDMA_FCTHR4_THR4, /* Threshold 4 */ -+// XRX200_SDMA_FCTHR5, /* SDMA Flow Control Threshold5 Register */ -+// XRX200_SDMA_FCTHR5_THR5, /* Threshold 5 */ -+// XRX200_SDMA_FCTHR6, /* SDMA Flow Control Threshold6 Register */ -+// XRX200_SDMA_FCTHR6_THR6, /* Threshold 6 */ -+// XRX200_SDMA_FCTHR7, /* SDMA Flow Control Threshold7 Register */ -+// XRX200_SDMA_FCTHR7_THR7, /* Threshold 7 */ -+// XRX200_SDMA_STAT_0, /* SDMA Status Register0 */ -+// XRX200_SDMA_STAT_0_BPS_FILL, /* Back Pressure Status */ -+// XRX200_SDMA_STAT_0_BPS_PNT, /* Back Pressure Status */ -+// XRX200_SDMA_STAT_0_DROP, /* Back Pressure Status */ -+// XRX200_SDMA_STAT_1, /* SDMA Status Register1 */ -+// XRX200_SDMA_STAT_1_FILL, /* Buffer Filling Level */ -+// XRX200_SDMA_STAT_2, /* SDMA Status Register2 */ -+// XRX200_SDMA_STAT_2_FSMS, /* FSM states status */ -+// XRX200_SDMA_IER, /* SDMA Interrupt Enable Register */ -+// XRX200_SDMA_IER_BPEX, /* Buffer Pointers Exceeded */ -+// XRX200_SDMA_IER_BFULL, /* Buffer Full */ -+// XRX200_SDMA_IER_FERR, /* Frame Error */ -+// XRX200_SDMA_IER_FRX, /* Frame Received Successfully */ -+// XRX200_SDMA_ISR, /* SDMA Interrupt Status Register */ -+// XRX200_SDMA_ISR_BPEX, /* Packet Descriptors Exceeded */ -+// XRX200_SDMA_ISR_BFULL, /* Buffer Full */ -+// XRX200_SDMA_ISR_FERR, /* Frame Error */ -+// XRX200_SDMA_ISR_FRX, /* Frame Received Successfully */ -+// XRX200_SDMA_PCTRL, /* Ethernet SwitchStore DMA Port Control Register */ -+// XRX200_SDMA_PCTRL_DTHR, /* Drop Threshold Selection */ -+// XRX200_SDMA_PCTRL_PTHR, /* Pause Threshold Selection */ -+// XRX200_SDMA_PCTRL_PHYEFWD, /* Forward PHY Error Frames */ -+// XRX200_SDMA_PCTRL_ALGFWD, /* Forward Alignment Error Frames */ -+// XRX200_SDMA_PCTRL_LENFWD, /* Forward Length Errored Frames */ -+// XRX200_SDMA_PCTRL_OSFWD, /* Forward Oversized Frames */ -+// XRX200_SDMA_PCTRL_USFWD, /* Forward Undersized Frames */ -+// XRX200_SDMA_PCTRL_FCSIGN, /* Ignore FCS Errors */ -+// XRX200_SDMA_PCTRL_FCSFWD, /* Forward FCS Errored Frames */ -+// XRX200_SDMA_PCTRL_PAUFWD, /* Pause Frame Forwarding */ -+// XRX200_SDMA_PCTRL_MFCEN, /* Metering Flow Control Enable */ -+// XRX200_SDMA_PCTRL_FCEN, /* Flow Control Enable */ -+// XRX200_SDMA_PCTRL_PEN, /* Port Enable */ -+// XRX200_SDMA_PRIO, /* Ethernet SwitchStore DMA Port Priority Register */ -+// XRX200_SDMA_PRIO_PRIO, /* SDMA PRIO */ -+// XRX200_SDMA_PSTAT0_HDR, /* Ethernet SwitchStore DMA Port Status Register 0 */ -+// XRX200_SDMA_PSTAT0_HDR_PTR, /* Port Ingress Queue Header Pointer */ -+// XRX200_SDMA_PSTAT1, /* Ethernet SwitchStore DMA Port Status Register 1 */ -+// XRX200_SDMA_PSTAT1_PPKT, /* Port Ingress Packet Count */ -+// XRX200_SDMA_TSTAMP0, /* Ingress TimeStamp Register 0 */ -+// XRX200_SDMA_TSTAMP0_TSTL, /* Time Stamp [15:0] */ -+// XRX200_SDMA_TSTAMP1, /* Ingress TimeStamp Register 1 */ -+// XRX200_SDMA_TSTAMP1_TSTH, /* Time Stamp [31:16] */ -+}; -+ -+ -+struct xrx200sw_reg { -+ int offset; -+ int shift; -+ int size; -+ int mult; -+} xrx200sw_reg[] = { -+// offeset shift size mult -+// {0x0000, 0, 16, 0x00}, /* XRX200_ETHSW_SWRES Ethernet Switch ResetControl Register */ -+// {0x0000, 1, 1, 0x00}, /* XRX200_ETHSW_SWRES_R1 Hardware Reset */ -+// {0x0000, 0, 1, 0x00}, /* XRX200_ETHSW_SWRES_R0 Register Configuration */ -+// {0x0004, 0, 16, 0x00}, /* XRX200_ETHSW_CLK_MAC_GAT Ethernet Switch Clock ControlRegister */ -+// {0x0004, 12, 4, 0x00}, /* XRX200_ETHSW_CLK_EXP_SLEEP Exponent to put system into sleep */ -+// {0x0004, 8, 4, 0x00}, /* XRX200_ETHSW_CLK_EXP_WAKE Exponent to wake up system */ -+// {0x0004, 7, 1, 0x00}, /* XRX200_ETHSW_CLK_CLK2_EN CLK2 Input for MAC */ -+// {0x0004, 6, 1, 0x00}, /* XRX200_ETHSW_CLK_EXT_DIV_EN External Clock Divider Enable */ -+// {0x0004, 5, 1, 0x00}, /* XRX200_ETHSW_CLK_RAM_DBG_EN Clock Gating Enable */ -+// {0x0004, 4, 1, 0x00}, /* XRX200_ETHSW_CLK_REG_GAT_EN Clock Gating Enable */ -+// {0x0004, 3, 1, 0x00}, /* XRX200_ETHSW_CLK_GAT_EN Clock Gating Enable */ -+// {0x0004, 2, 1, 0x00}, /* XRX200_ETHSW_CLK_MAC_GAT_EN Clock Gating Enable */ -+// {0x0008, 0, 16, 0x00}, /* XRX200_ETHSW_DBG_STEP Ethernet Switch Debug ControlRegister */ -+// {0x0008, 12, 4, 0x00}, /* XRX200_ETHSW_DBG_CLK_SEL Trigger Enable */ -+// {0x0008, 11, 1, 0x00}, /* XRX200_ETHSW_DBG_MON_EN Monitoring Enable */ -+// {0x0008, 9, 2, 0x00}, /* XRX200_ETHSW_DBG_TRIG_EN Trigger Enable */ -+// {0x0008, 8, 1, 0x00}, /* XRX200_ETHSW_DBG_MODE Debug Mode */ -+// {0x0008, 0, 8, 0x00}, /* XRX200_ETHSW_DBG_STEP_TIME Clock Step Size */ -+// {0x000C, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_MODE Ethernet Switch SharedSegment Buffer Mode Register */ -+// {0x000C, 2, 4, 0x00}, /* XRX200_ETHSW_SSB_MODE_ADDE Memory Address */ -+// {0x000C, 0, 2, 0x00}, /* XRX200_ETHSW_SSB_MODE_MODE Memory Access Mode */ -+// {0x0010, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_ADDR Ethernet Switch SharedSegment Buffer Address Register */ -+// {0x0010, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_ADDR_ADDE Memory Address */ -+// {0x0014, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_DATA Ethernet Switch SharedSegment Buffer Data Register */ -+// {0x0014, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_DATA_DATA Data Value */ -+// {0x0018, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_0 Ethernet Switch CapabilityRegister 0 */ -+// {0x0018, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_0_SPEED Clock frequency */ -+// {0x001C, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_1 Ethernet Switch CapabilityRegister 1 */ -+// {0x001C, 15, 1, 0x00}, /* XRX200_ETHSW_CAP_1_GMAC MAC operation mode */ -+// {0x001C, 8, 7, 0x00}, /* XRX200_ETHSW_CAP_1_QUEUE Number of queues */ -+// {0x001C, 4, 4, 0x00}, /* XRX200_ETHSW_CAP_1_VPORTS Number of virtual ports */ -+// {0x001C, 0, 4, 0x00}, /* XRX200_ETHSW_CAP_1_PPORTS Number of physical ports */ -+// {0x0020, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_2 Ethernet Switch CapabilityRegister 2 */ -+// {0x0020, 0, 11, 0x00}, /* XRX200_ETHSW_CAP_2_PACKETS Number of packets */ -+// {0x0024, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_3 Ethernet Switch CapabilityRegister 3 */ -+// {0x0024, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_3_METERS Number of traffic meters */ -+// {0x0024, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_3_SHAPERS Number of traffic shapers */ -+// {0x0028, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_4 Ethernet Switch CapabilityRegister 4 */ -+// {0x0028, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_4_PPPOE PPPoE table size */ -+// {0x0028, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_4_VLAN Active VLAN table size */ -+// {0x002C, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_5 Ethernet Switch CapabilityRegister 5 */ -+// {0x002C, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_5_IPPLEN IP packet length table size */ -+// {0x002C, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_5_PROT Protocol table size */ -+// {0x0030, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_6 Ethernet Switch CapabilityRegister 6 */ -+// {0x0030, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_6_MACDASA MAC DA/SA table size */ -+// {0x0030, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_6_APPL Application table size */ -+// {0x0034, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_7 Ethernet Switch CapabilityRegister 7 */ -+// {0x0034, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_7_IPDASAM IP DA/SA MSB table size */ -+// {0x0034, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_7_IPDASAL IP DA/SA LSB table size */ -+// {0x0038, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_8 Ethernet Switch CapabilityRegister 8 */ -+// {0x0038, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_8_MCAST Multicast table size */ -+// {0x003C, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_9 Ethernet Switch CapabilityRegister 9 */ -+// {0x003C, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_9_FLAGG Flow Aggregation table size */ -+// {0x0040, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_10 Ethernet Switch CapabilityRegister 10 */ -+// {0x0040, 0, 13, 0x00}, /* XRX200_ETHSW_CAP_10_MACBT MAC bridging table size */ -+// {0x0044, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_11 Ethernet Switch CapabilityRegister 11 */ -+// {0x0044, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_11_BSIZEL Packet buffer size (lower part, in byte) */ -+// {0x0048, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_12 Ethernet Switch CapabilityRegister 12 */ -+// {0x0048, 0, 3, 0x00}, /* XRX200_ETHSW_CAP_12_BSIZEH Packet buffer size (higher part, in byte) */ -+// {0x004C, 0, 16, 0x00}, /* XRX200_ETHSW_VERSION_REV Ethernet Switch VersionRegister */ -+// {0x004C, 8, 8, 0x00}, /* XRX200_ETHSW_VERSION_MOD_ID Module Identification */ -+// {0x004C, 0, 8, 0x00}, /* XRX200_ETHSW_VERSION_REV_ID Hardware Revision Identification */ -+// {0x0050, 0, 16, 0x00}, /* XRX200_ETHSW_IER Interrupt Enable Register */ -+// {0x0050, 4, 1, 0x00}, /* XRX200_ETHSW_IER_FDMAIE Fetch DMA Interrupt Enable */ -+// {0x0050, 3, 1, 0x00}, /* XRX200_ETHSW_IER_SDMAIE Store DMA Interrupt Enable */ -+// {0x0050, 2, 1, 0x00}, /* XRX200_ETHSW_IER_MACIE Ethernet MAC Interrupt Enable */ -+// {0x0050, 1, 1, 0x00}, /* XRX200_ETHSW_IER_PCEIE Parser and Classification Engine Interrupt Enable */ -+// {0x0050, 0, 1, 0x00}, /* XRX200_ETHSW_IER_BMIE Buffer Manager Interrupt Enable */ -+// {0x0054, 0, 16, 0x00}, /* XRX200_ETHSW_ISR Interrupt Status Register */ -+// {0x0054, 4, 1, 0x00}, /* XRX200_ETHSW_ISR_FDMAINT Fetch DMA Interrupt */ -+// {0x0054, 3, 1, 0x00}, /* XRX200_ETHSW_ISR_SDMAINT Store DMA Interrupt */ -+// {0x0054, 2, 1, 0x00}, /* XRX200_ETHSW_ISR_MACINT Ethernet MAC Interrupt */ -+// {0x0054, 1, 1, 0x00}, /* XRX200_ETHSW_ISR_PCEINT Parser and Classification Engine Interrupt */ -+// {0x0054, 0, 1, 0x00}, /* XRX200_ETHSW_ISR_BMINT Buffer Manager Interrupt */ -+// {0x0058, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_0 Ethernet Switch SpareCells 0 */ -+// {0x0058, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_0_SPARE SPARE0 */ -+// {0x005C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_1 Ethernet Switch SpareCells 1 */ -+// {0x005C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_1_SPARE SPARE1 */ -+// {0x0060, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_2 Ethernet Switch SpareCells 2 */ -+// {0x0060, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_2_SPARE SPARE2 */ -+// {0x0064, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_3 Ethernet Switch SpareCells 3 */ -+// {0x0064, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_3_SPARE SPARE3 */ -+// {0x0068, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_4 Ethernet Switch SpareCells 4 */ -+// {0x0068, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_4_SPARE SPARE4 */ -+// {0x006C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_5 Ethernet Switch SpareCells 5 */ -+// {0x006C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_5_SPARE SPARE5 */ -+// {0x0070, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_6 Ethernet Switch SpareCells 6 */ -+// {0x0070, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_6_SPARE SPARE6 */ -+// {0x0074, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_7 Ethernet Switch SpareCells 7 */ -+// {0x0074, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_7_SPARE SPARE7 */ -+// {0x0078, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_8 Ethernet Switch SpareCells 8 */ -+// {0x0078, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_8_SPARE SPARE8 */ -+// {0x007C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_9 Ethernet Switch SpareCells 9 */ -+// {0x007C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_9_SPARE SPARE9 */ -+// {0x0080, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_10 Ethernet Switch SpareCells 10 */ -+// {0x0080, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_10_SPARE SPARE10 */ -+// {0x0084, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_11 Ethernet Switch SpareCells 11 */ -+// {0x0084, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_11_SPARE SPARE11 */ -+// {0x0088, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_12 Ethernet Switch SpareCells 12 */ -+// {0x0088, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_12_SPARE SPARE12 */ -+// {0x008C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_13 Ethernet Switch SpareCells 13 */ -+// {0x008C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_13_SPARE SPARE13 */ -+// {0x0090, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_14 Ethernet Switch SpareCells 14 */ -+// {0x0090, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_14_SPARE SPARE14 */ -+// {0x0094, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_15 Ethernet Switch SpareCells 15 */ -+// {0x0094, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_15_SPARE SPARE15 */ -+// {0x0100, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_3 RAM Value Register 3 */ -+// {0x0100, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_3_VAL3 Data value [15:0] */ -+// {0x0104, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_2 RAM Value Register 2 */ -+// {0x0104, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_2_VAL2 Data value [15:0] */ -+// {0x0108, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_1 RAM Value Register 1 */ -+// {0x0108, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_1_VAL1 Data value [15:0] */ -+// {0x010C, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_0 RAM Value Register 0 */ -+// {0x010C, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_0_VAL0 Data value [15:0] */ -+// {0x0110, 0, 16, 0x00}, /* XRX200_BM_RAM_ADDR RAM Address Register */ -+// {0x0110, 0, 11, 0x00}, /* XRX200_BM_RAM_ADDR_ADDR RAM Address */ -+// {0x0114, 0, 16, 0x00}, /* XRX200_BM_RAM_CTRL RAM Access Control Register */ -+// {0x0114, 15, 1, 0x00}, /* XRX200_BM_RAM_CTRL_BAS Access Busy/Access Start */ -+// {0x0114, 5, 1, 0x00}, /* XRX200_BM_RAM_CTRL_OPMOD Lookup Table Access Operation Mode */ -+// {0x0114, 0, 5, 0x00}, /* XRX200_BM_RAM_CTRL_ADDR Address for RAM selection */ -+// {0x0118, 0, 16, 0x00}, /* XRX200_BM_FSQM_GCTRL Free Segment Queue ManagerGlobal Control Register */ -+// {0x0118, 0, 10, 0x00}, /* XRX200_BM_FSQM_GCTRL_SEGNUM Maximum Segment Number */ -+// {0x011C, 0, 16, 0x00}, /* XRX200_BM_CONS_SEG Number of Consumed SegmentsRegister */ -+// {0x011C, 0, 10, 0x00}, /* XRX200_BM_CONS_SEG_FSEG Number of Consumed Segments */ -+// {0x0120, 0, 16, 0x00}, /* XRX200_BM_CONS_PKT Number of Consumed PacketPointers Register */ -+// {0x0120, 0, 11, 0x00}, /* XRX200_BM_CONS_PKT_FQP Number of Consumed Packet Pointers */ -+// {0x0124, 0, 16, 0x00}, /* XRX200_BM_GCTRL_F Buffer Manager Global ControlRegister 0 */ -+// {0x0124, 13, 1, 0x00}, /* XRX200_BM_GCTRL_BM_STA Buffer Manager Initialization Status Bit */ -+// {0x0124, 12, 1, 0x00}, /* XRX200_BM_GCTRL_SAT RMON Counter Update Mode */ -+// {0x0124, 11, 1, 0x00}, /* XRX200_BM_GCTRL_FR_RBC Freeze RMON RX Bad Byte 64 Bit Counter */ -+// {0x0124, 10, 1, 0x00}, /* XRX200_BM_GCTRL_FR_RGC Freeze RMON RX Good Byte 64 Bit Counter */ -+// {0x0124, 9, 1, 0x00}, /* XRX200_BM_GCTRL_FR_TGC Freeze RMON TX Good Byte 64 Bit Counter */ -+// {0x0124, 8, 1, 0x00}, /* XRX200_BM_GCTRL_I_FIN RAM initialization finished */ -+// {0x0124, 7, 1, 0x00}, /* XRX200_BM_GCTRL_CX_INI PQM Context RAM initialization */ -+// {0x0124, 6, 1, 0x00}, /* XRX200_BM_GCTRL_FP_INI FPQM RAM initialization */ -+// {0x0124, 5, 1, 0x00}, /* XRX200_BM_GCTRL_FS_INI FSQM RAM initialization */ -+// {0x0124, 4, 1, 0x00}, /* XRX200_BM_GCTRL_R_SRES Software Reset for RMON */ -+// {0x0124, 3, 1, 0x00}, /* XRX200_BM_GCTRL_S_SRES Software Reset for Scheduler */ -+// {0x0124, 2, 1, 0x00}, /* XRX200_BM_GCTRL_A_SRES Software Reset for AVG */ -+// {0x0124, 1, 1, 0x00}, /* XRX200_BM_GCTRL_P_SRES Software Reset for PQM */ -+// {0x0124, 0, 1, 0x00}, /* XRX200_BM_GCTRL_F_SRES Software Reset for FSQM */ -+// {0x0128, 0, 16, 0x00}, /* XRX200_BM_QUEUE_GCTRL Queue Manager GlobalControl Register 0 */ -+ {0x0128, 10, 1, 0x00}, /* XRX200_BM_QUEUE_GCTRL_GL_MOD WRED Mode Signal */ -+// {0x0128, 7, 3, 0x00}, /* XRX200_BM_QUEUE_GCTRL_AQUI Average Queue Update Interval */ -+// {0x0128, 3, 4, 0x00}, /* XRX200_BM_QUEUE_GCTRL_AQWF Average Queue Weight Factor */ -+// {0x0128, 2, 1, 0x00}, /* XRX200_BM_QUEUE_GCTRL_QAVGEN Queue Average Calculation Enable */ -+// {0x0128, 0, 2, 0x00}, /* XRX200_BM_QUEUE_GCTRL_DPROB Drop Probability Profile */ -+// {0x012C, 0, 16, 0x00}, /* XRX200_BM_WRED_RTH_0 WRED Red Threshold Register0 */ -+// {0x012C, 0, 10, 0x00}, /* XRX200_BM_WRED_RTH_0_MINTH Minimum Threshold */ -+// {0x0130, 0, 16, 0x00}, /* XRX200_BM_WRED_RTH_1 WRED Red Threshold Register1 */ -+// {0x0130, 0, 10, 0x00}, /* XRX200_BM_WRED_RTH_1_MAXTH Maximum Threshold */ -+// {0x0134, 0, 16, 0x00}, /* XRX200_BM_WRED_YTH_0 WRED Yellow ThresholdRegister 0 */ -+// {0x0134, 0, 10, 0x00}, /* XRX200_BM_WRED_YTH_0_MINTH Minimum Threshold */ -+// {0x0138, 0, 16, 0x00}, /* XRX200_BM_WRED_YTH_1 WRED Yellow ThresholdRegister 1 */ -+// {0x0138, 0, 10, 0x00}, /* XRX200_BM_WRED_YTH_1_MAXTH Maximum Threshold */ -+// {0x013C, 0, 16, 0x00}, /* XRX200_BM_WRED_GTH_0 WRED Green ThresholdRegister 0 */ -+// {0x013C, 0, 10, 0x00}, /* XRX200_BM_WRED_GTH_0_MINTH Minimum Threshold */ -+// {0x0140, 0, 16, 0x00}, /* XRX200_BM_WRED_GTH_1 WRED Green ThresholdRegister 1 */ -+// {0x0140, 0, 10, 0x00}, /* XRX200_BM_WRED_GTH_1_MAXTH Maximum Threshold */ -+// {0x0144, 0, 16, 0x00}, /* XRX200_BM_DROP_GTH_0_THR Drop Threshold ConfigurationRegister 0 */ -+// {0x0144, 0, 11, 0x00}, /* XRX200_BM_DROP_GTH_0_THR_FQ Threshold for frames marked red */ -+// {0x0148, 0, 16, 0x00}, /* XRX200_BM_DROP_GTH_1_THY Drop Threshold ConfigurationRegister 1 */ -+// {0x0148, 0, 11, 0x00}, /* XRX200_BM_DROP_GTH_1_THY_FQ Threshold for frames marked yellow */ -+// {0x014C, 0, 16, 0x00}, /* XRX200_BM_DROP_GTH_2_THG Drop Threshold ConfigurationRegister 2 */ -+// {0x014C, 0, 11, 0x00}, /* XRX200_BM_DROP_GTH_2_THG_FQ Threshold for frames marked green */ -+// {0x0150, 0, 16, 0x00}, /* XRX200_BM_IER Buffer Manager Global InterruptEnable Register */ -+// {0x0150, 7, 1, 0x00}, /* XRX200_BM_IER_CNT4 Counter Group 4 (RMON-CLASSIFICATION) Interrupt Enable */ -+// {0x0150, 6, 1, 0x00}, /* XRX200_BM_IER_CNT3 Counter Group 3 (RMON-PQM) Interrupt Enable */ -+// {0x0150, 5, 1, 0x00}, /* XRX200_BM_IER_CNT2 Counter Group 2 (RMON-SCHEDULER) Interrupt Enable */ -+// {0x0150, 4, 1, 0x00}, /* XRX200_BM_IER_CNT1 Counter Group 1 (RMON-QFETCH) Interrupt Enable */ -+// {0x0150, 3, 1, 0x00}, /* XRX200_BM_IER_CNT0 Counter Group 0 (RMON-QSTOR) Interrupt Enable */ -+// {0x0150, 2, 1, 0x00}, /* XRX200_BM_IER_DEQ PQM dequeue Interrupt Enable */ -+// {0x0150, 1, 1, 0x00}, /* XRX200_BM_IER_ENQ PQM Enqueue Interrupt Enable */ -+// {0x0150, 0, 1, 0x00}, /* XRX200_BM_IER_FSQM Buffer Empty Interrupt Enable */ -+// {0x0154, 0, 16, 0x00}, /* XRX200_BM_ISR Buffer Manager Global InterruptStatus Register */ -+// {0x0154, 7, 1, 0x00}, /* XRX200_BM_ISR_CNT4 Counter Group 4 Interrupt */ -+// {0x0154, 6, 1, 0x00}, /* XRX200_BM_ISR_CNT3 Counter Group 3 Interrupt */ -+// {0x0154, 5, 1, 0x00}, /* XRX200_BM_ISR_CNT2 Counter Group 2 Interrupt */ -+// {0x0154, 4, 1, 0x00}, /* XRX200_BM_ISR_CNT1 Counter Group 1 Interrupt */ -+// {0x0154, 3, 1, 0x00}, /* XRX200_BM_ISR_CNT0 Counter Group 0 Interrupt */ -+// {0x0154, 2, 1, 0x00}, /* XRX200_BM_ISR_DEQ PQM dequeue Interrupt Enable */ -+// {0x0154, 1, 1, 0x00}, /* XRX200_BM_ISR_ENQ PQM Enqueue Interrupt */ -+// {0x0154, 0, 1, 0x00}, /* XRX200_BM_ISR_FSQM Buffer Empty Interrupt */ -+// {0x0158, 0, 16, 0x00}, /* XRX200_BM_CISEL Buffer Manager RMON CounterInterrupt Select Register */ -+// {0x0158, 0, 3, 0x00}, /* XRX200_BM_CISEL_PORT Port Number */ -+// {0x015C, 0, 16, 0x00}, /* XRX200_BM_DEBUG_CTRL_DBG Debug Control Register */ -+// {0x015C, 0, 8, 0x00}, /* XRX200_BM_DEBUG_CTRL_DBG_SEL Select Signal for Debug Multiplexer */ -+// {0x0160, 0, 16, 0x00}, /* XRX200_BM_DEBUG_VAL_DBG Debug Value Register */ -+// {0x0160, 0, 16, 0x00}, /* XRX200_BM_DEBUG_VAL_DBG_DAT Debug Data Value */ -+// {0x0200, 0, 16, 0x08}, /* XRX200_BM_PCFG Buffer Manager PortConfiguration Register */ -+// {0x0200, 0, 1, 0x08}, /* XRX200_BM_PCFG_CNTEN RMON Counter Enable */ -+// {0x0204, 0, 16, 0x08}, /* XRX200_BM_RMON_CTRL_RAM1 Buffer ManagerRMON Control Register */ -+// {0x0204, 1, 1, 0x08}, /* XRX200_BM_RMON_CTRL_RAM2_RES Software Reset for RMON RAM2 */ -+// {0x0204, 0, 1, 0x08}, /* XRX200_BM_RMON_CTRL_RAM1_RES Software Reset for RMON RAM1 */ -+// {0x0400, 0, 16, 0x08}, /* XRX200_PQM_DP Packet Queue ManagerDrop Probability Register */ -+// {0x0400, 0, 2, 0x08}, /* XRX200_PQM_DP_DPROB Drop Probability Profile */ -+// {0x0404, 0, 16, 0x08}, /* XRX200_PQM_RS Packet Queue ManagerRate Shaper Assignment Register */ -+// {0x0404, 15, 1, 0x08}, /* XRX200_PQM_RS_EN2 Rate Shaper 2 Enable */ -+// {0x0404, 8, 6, 0x08}, /* XRX200_PQM_RS_RS2 Rate Shaper 2 */ -+// {0x0404, 7, 1, 0x08}, /* XRX200_PQM_RS_EN1 Rate Shaper 1 Enable */ -+// {0x0404, 0, 6, 0x08}, /* XRX200_PQM_RS_RS1 Rate Shaper 1 */ -+// {0x0500, 0, 16, 0x14}, /* XRX200_RS_CTRL Rate Shaper ControlRegister */ -+// {0x0500, 0, 1, 0x14}, /* XRX200_RS_CTRL_RSEN Rate Shaper Enable */ -+// {0x0504, 0, 16, 0x14}, /* XRX200_RS_CBS Rate Shaper CommittedBurst Size Register */ -+// {0x0504, 0, 10, 0x14}, /* XRX200_RS_CBS_CBS Committed Burst Size */ -+// {0x0508, 0, 16, 0x14}, /* XRX200_RS_IBS Rate Shaper InstantaneousBurst Size Register */ -+// {0x0508, 0, 2, 0x14}, /* XRX200_RS_IBS_IBS Instantaneous Burst Size */ -+// {0x050C, 0, 16, 0x14}, /* XRX200_RS_CIR_EXP Rate Shaper RateExponent Register */ -+// {0x050C, 0, 4, 0x14}, /* XRX200_RS_CIR_EXP_EXP Exponent */ -+// {0x0510, 0, 16, 0x14}, /* XRX200_RS_CIR_MANT Rate Shaper RateMantissa Register */ -+// {0x0510, 0, 10, 0x14}, /* XRX200_RS_CIR_MANT_MANT Mantissa */ -+ {0x1100, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_7 Table Key Data 7 */ -+// {0x1100, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_7_KEY7 Key Value[15:0] */ -+ {0x1104, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_6 Table Key Data 6 */ -+// {0x1104, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_6_KEY6 Key Value[15:0] */ -+ {0x1108, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_5 Table Key Data 5 */ -+// {0x1108, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_5_KEY5 Key Value[15:0] */ -+ {0x110C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_4 Table Key Data 4 */ -+// {0x110C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_4_KEY4 Key Value[15:0] */ -+ {0x1110, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_3 Table Key Data 3 */ -+// {0x1110, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_3_KEY3 Key Value[15:0] */ -+ {0x1114, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_2 Table Key Data 2 */ -+// {0x1114, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_2_KEY2 Key Value[15:0] */ -+ {0x1118, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_1 Table Key Data 1 */ -+// {0x1118, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_1_KEY1 Key Value[31:16] */ -+ {0x111C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_0 Table Key Data 0 */ -+// {0x111C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_0_KEY0 Key Value[15:0] */ -+ {0x1120, 0, 16, 0x00}, /* XRX200_PCE_TBL_MASK_0 Table Mask Write Register0 */ -+// {0x1120, 0, 16, 0x00}, /* XRX200_PCE_TBL_MASK_0_MASK0 Mask Pattern [15:0] */ -+ {0x1124, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_4 Table Value Register4 */ -+// {0x1124, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_4_VAL4 Data value [15:0] */ -+ {0x1128, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_3 Table Value Register3 */ -+// {0x1128, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_3_VAL3 Data value [15:0] */ -+ {0x112C, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_2 Table Value Register2 */ -+// {0x112C, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_2_VAL2 Data value [15:0] */ -+ {0x1130, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_1 Table Value Register1 */ -+// {0x1130, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_1_VAL1 Data value [15:0] */ -+ {0x1134, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_0 Table Value Register0 */ -+// {0x1134, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_0_VAL0 Data value [15:0] */ -+// {0x1138, 0, 16, 0x00}, /* XRX200_PCE_TBL_ADDR Table Entry AddressRegister */ -+ {0x1138, 0, 11, 0x00}, /* XRX200_PCE_TBL_ADDR_ADDR Table Address */ -+// {0x113C, 0, 16, 0x00}, /* XRX200_PCE_TBL_CTRL Table Access ControlRegister */ -+ {0x113C, 15, 1, 0x00}, /* XRX200_PCE_TBL_CTRL_BAS Access Busy/Access Start */ -+ {0x113C, 13, 1, 0x00}, /* XRX200_PCE_TBL_CTRL_TYPE Lookup Entry Type */ -+ {0x113C, 12, 1, 0x00}, /* XRX200_PCE_TBL_CTRL_VLD Lookup Entry Valid */ -+ {0x113C, 7, 4, 0x00}, /* XRX200_PCE_TBL_CTRL_GMAP Group Map */ -+ {0x113C, 5, 2, 0x00}, /* XRX200_PCE_TBL_CTRL_OPMOD Lookup Table Access Operation Mode */ -+ {0x113C, 0, 5, 0x00}, /* XRX200_PCE_TBL_CTRL_ADDR Lookup Table Address */ -+// {0x1140, 0, 16, 0x00}, /* XRX200_PCE_TBL_STAT Table General StatusRegister */ -+// {0x1140, 2, 1, 0x00}, /* XRX200_PCE_TBL_STAT_TBUSY Table Access Busy */ -+// {0x1140, 1, 1, 0x00}, /* XRX200_PCE_TBL_STAT_TEMPT Table Empty */ -+// {0x1140, 0, 1, 0x00}, /* XRX200_PCE_TBL_STAT_TFUL Table Full */ -+// {0x1144, 0, 16, 0x00}, /* XRX200_PCE_AGE_0 Aging Counter ConfigurationRegister 0 */ -+// {0x1144, 0, 4, 0x00}, /* XRX200_PCE_AGE_0_EXP Aging Counter Exponent Value */ -+// {0x1148, 0, 16, 0x00}, /* XRX200_PCE_AGE_1 Aging Counter ConfigurationRegister 1 */ -+// {0x1148, 0, 16, 0x00}, /* XRX200_PCE_AGE_1_MANT Aging Counter Mantissa Value */ -+// {0x114C, 0, 16, 0x00}, /* XRX200_PCE_PMAP_1 Port Map Register 1 */ -+// {0x114C, 0, 16, 0x00}, /* XRX200_PCE_PMAP_1_MPMAP Monitoring Port Map */ -+// {0x1150, 0, 16, 0x00}, /* XRX200_PCE_PMAP_2 Port Map Register 2 */ -+// {0x1150, 0, 16, 0x00}, /* XRX200_PCE_PMAP_2_DMCPMAP Default Multicast Port Map */ -+// {0x1154, 0, 16, 0x00}, /* XRX200_PCE_PMAP_3 Port Map Register 3 */ -+// {0x1154, 0, 16, 0x00}, /* XRX200_PCE_PMAP_3_UUCMAP Default Unknown Unicast Port Map */ -+// {0x1158, 0, 16, 0x00}, /* XRX200_PCE_GCTRL_0 PCE Global Control Register0 */ -+// {0x1158, 15, 1, 0x00}, /* XRX200_PCE_GCTRL_0_IGMP IGMP Mode Selection */ -+ {0x1158, 14, 1, 0x00}, /* XRX200_PCE_GCTRL_0_VLAN VLAN-aware Switching */ -+// {0x1158, 13, 1, 0x00}, /* XRX200_PCE_GCTRL_0_NOPM No Port Map Forwarding */ -+// {0x1158, 12, 1, 0x00}, /* XRX200_PCE_GCTRL_0_SCONUC Unknown Unicast Storm Control */ -+// {0x1158, 11, 1, 0x00}, /* XRX200_PCE_GCTRL_0_SCONMC Multicast Storm Control */ -+// {0x1158, 10, 1, 0x00}, /* XRX200_PCE_GCTRL_0_SCONBC Broadcast Storm Control */ -+// {0x1158, 8, 2, 0x00}, /* XRX200_PCE_GCTRL_0_SCONMOD Storm Control Mode */ -+// {0x1158, 4, 4, 0x00}, /* XRX200_PCE_GCTRL_0_SCONMET Storm Control Metering Instance */ -+// {0x1158, 3, 1, 0x00}, /* XRX200_PCE_GCTRL_0_MC_VALID Access Request */ -+// {0x1158, 2, 1, 0x00}, /* XRX200_PCE_GCTRL_0_PLCKMOD Port Lock Mode */ -+// {0x1158, 1, 1, 0x00}, /* XRX200_PCE_GCTRL_0_PLIMMOD MAC Address Learning Limitation Mode */ -+// {0x1158, 0, 1, 0x00}, /* XRX200_PCE_GCTRL_0_MTFL MAC Table Flushing */ -+// {0x115C, 0, 16, 0x00}, /* XRX200_PCE_GCTRL_1 PCE Global Control Register1 */ -+// {0x115C, 1, 1, 0x00}, /* XRX200_PCE_GCTRL_1_PCE_DIS PCE Disable after currently processed packet */ -+// {0x115C, 0, 1, 0x00}, /* XRX200_PCE_GCTRL_1_LRNMOD MAC Address Learning Mode */ -+// {0x1160, 0, 16, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL Three-color MarkerGlobal Control Register */ -+// {0x1160, 6, 3, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL_DPRED Re-marking Drop Precedence Red Encoding */ -+// {0x1160, 3, 3, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL_DPYEL Re-marking Drop Precedence Yellow Encoding */ -+// {0x1160, 0, 3, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL_DPGRN Re-marking Drop Precedence Green Encoding */ -+// {0x1164, 0, 16, 0x00}, /* XRX200_PCE_IGMP_CTRL IGMP Control Register */ -+// {0x1164, 15, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_FAGEEN Force Aging of Table Entries Enable */ -+// {0x1164, 14, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_FLEAVE Fast Leave Enable */ -+// {0x1164, 13, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_DMRTEN Default Maximum Response Time Enable */ -+// {0x1164, 12, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_JASUP Join Aggregation Suppression Enable */ -+// {0x1164, 11, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_REPSUP Report Suppression Enable */ -+// {0x1164, 10, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_SRPEN Snooping of Router Port Enable */ -+// {0x1164, 8, 2, 0x00}, /* XRX200_PCE_IGMP_CTRL_ROB Robustness Variable */ -+// {0x1164, 0, 8, 0x00}, /* XRX200_PCE_IGMP_CTRL_DMRT IGMP Default Maximum Response Time */ -+// {0x1168, 0, 16, 0x00}, /* XRX200_PCE_IGMP_DRPM IGMP Default RouterPort Map Register */ -+// {0x1168, 0, 16, 0x00}, /* XRX200_PCE_IGMP_DRPM_DRPM IGMP Default Router Port Map */ -+// {0x116C, 0, 16, 0x00}, /* XRX200_PCE_IGMP_AGE_0 IGMP Aging Register0 */ -+// {0x116C, 3, 8, 0x00}, /* XRX200_PCE_IGMP_AGE_0_MANT IGMP Group Aging Time Mantissa */ -+// {0x116C, 0, 3, 0x00}, /* XRX200_PCE_IGMP_AGE_0_EXP IGMP Group Aging Time Exponent */ -+// {0x1170, 0, 16, 0x00}, /* XRX200_PCE_IGMP_AGE_1 IGMP Aging Register1 */ -+// {0x1170, 0, 12, 0x00}, /* XRX200_PCE_IGMP_AGE_1_MANT IGMP Router Port Aging Time Mantissa */ -+// {0x1174, 0, 16, 0x00}, /* XRX200_PCE_IGMP_STAT IGMP Status Register */ -+// {0x1174, 0, 16, 0x00}, /* XRX200_PCE_IGMP_STAT_IGPM IGMP Port Map */ -+// {0x1178, 0, 16, 0x00}, /* XRX200_WOL_GLB_CTRL Wake-on-LAN ControlRegister */ -+// {0x1178, 0, 1, 0x00}, /* XRX200_WOL_GLB_CTRL_PASSEN WoL Password Enable */ -+// {0x117C, 0, 16, 0x00}, /* XRX200_WOL_DA_0 Wake-on-LAN DestinationAddress Register 0 */ -+// {0x117C, 0, 16, 0x00}, /* XRX200_WOL_DA_0_DA0 WoL Destination Address [15:0] */ -+// {0x1180, 0, 16, 0x00}, /* XRX200_WOL_DA_1 Wake-on-LAN DestinationAddress Register 1 */ -+// {0x1180, 0, 16, 0x00}, /* XRX200_WOL_DA_1_DA1 WoL Destination Address [31:16] */ -+// {0x1184, 0, 16, 0x00}, /* XRX200_WOL_DA_2 Wake-on-LAN DestinationAddress Register 2 */ -+// {0x1184, 0, 16, 0x00}, /* XRX200_WOL_DA_2_DA2 WoL Destination Address [47:32] */ -+// {0x1188, 0, 16, 0x00}, /* XRX200_WOL_PW_0 Wake-on-LAN Password Register0 */ -+// {0x1188, 0, 16, 0x00}, /* XRX200_WOL_PW_0_PW0 WoL Password [15:0] */ -+// {0x118C, 0, 16, 0x00}, /* XRX200_WOL_PW_1 Wake-on-LAN Password Register1 */ -+// {0x118C, 0, 16, 0x00}, /* XRX200_WOL_PW_1_PW1 WoL Password [31:16] */ -+// {0x1190, 0, 16, 0x00}, /* XRX200_WOL_PW_2 Wake-on-LAN Password Register2 */ -+// {0x1190, 0, 16, 0x00}, /* XRX200_WOL_PW_2_PW2 WoL Password [47:32] */ -+// {0x1194, 0, 16, 0x00}, /* XRX200_PCE_IER_0_PINT Parser and ClassificationEngine Global Interrupt Enable Register 0 */ -+// {0x1194, 15, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_15 Port Interrupt Enable */ -+// {0x1194, 14, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_14 Port Interrupt Enable */ -+// {0x1194, 13, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_13 Port Interrupt Enable */ -+// {0x1194, 12, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_12 Port Interrupt Enable */ -+// {0x1194, 11, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_11 Port Interrupt Enable */ -+// {0x1194, 10, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_10 Port Interrupt Enable */ -+// {0x1194, 9, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_9 Port Interrupt Enable */ -+// {0x1194, 8, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_8 Port Interrupt Enable */ -+// {0x1194, 7, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_7 Port Interrupt Enable */ -+// {0x1194, 6, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_6 Port Interrupt Enable */ -+// {0x1194, 5, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_5 Port Interrupt Enable */ -+// {0x1194, 4, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_4 Port Interrupt Enable */ -+// {0x1194, 3, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_3 Port Interrupt Enable */ -+// {0x1194, 2, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_2 Port Interrupt Enable */ -+// {0x1194, 1, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_1 Port Interrupt Enable */ -+// {0x1194, 0, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_0 Port Interrupt Enable */ -+// {0x1198, 0, 16, 0x00}, /* XRX200_PCE_IER_1 Parser and ClassificationEngine Global Interrupt Enable Register 1 */ -+// {0x1198, 6, 1, 0x00}, /* XRX200_PCE_IER_1_FLOWINT Traffic Flow Table Interrupt Rule matched Interrupt Enable */ -+// {0x1198, 5, 1, 0x00}, /* XRX200_PCE_IER_1_CPH2 Classification Phase 2 Ready Interrupt Enable */ -+// {0x1198, 4, 1, 0x00}, /* XRX200_PCE_IER_1_CPH1 Classification Phase 1 Ready Interrupt Enable */ -+// {0x1198, 3, 1, 0x00}, /* XRX200_PCE_IER_1_CPH0 Classification Phase 0 Ready Interrupt Enable */ -+// {0x1198, 2, 1, 0x00}, /* XRX200_PCE_IER_1_PRDY Parser Ready Interrupt Enable */ -+// {0x1198, 1, 1, 0x00}, /* XRX200_PCE_IER_1_IGTF IGMP Table Full Interrupt Enable */ -+// {0x1198, 0, 1, 0x00}, /* XRX200_PCE_IER_1_MTF MAC Table Full Interrupt Enable */ -+// {0x119C, 0, 16, 0x00}, /* XRX200_PCE_ISR_0_PINT Parser and ClassificationEngine Global Interrupt Status Register 0 */ -+// {0x119C, 15, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_15 Port Interrupt */ -+// {0x119C, 14, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_14 Port Interrupt */ -+// {0x119C, 13, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_13 Port Interrupt */ -+// {0x119C, 12, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_12 Port Interrupt */ -+// {0x119C, 11, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_11 Port Interrupt */ -+// {0x119C, 10, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_10 Port Interrupt */ -+// {0x119C, 9, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_9 Port Interrupt */ -+// {0x119C, 8, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_8 Port Interrupt */ -+// {0x119C, 7, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_7 Port Interrupt */ -+// {0x119C, 6, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_6 Port Interrupt */ -+// {0x119C, 5, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_5 Port Interrupt */ -+// {0x119C, 4, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_4 Port Interrupt */ -+// {0x119C, 3, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_3 Port Interrupt */ -+// {0x119C, 2, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_2 Port Interrupt */ -+// {0x119C, 1, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_1 Port Interrupt */ -+// {0x119C, 0, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_0 Port Interrupt */ -+// {0x11A0, 0, 16, 0x00}, /* XRX200_PCE_ISR_1 Parser and ClassificationEngine Global Interrupt Status Register 1 */ -+// {0x11A0, 6, 1, 0x00}, /* XRX200_PCE_ISR_1_FLOWINT Traffic Flow Table Interrupt Rule matched */ -+// {0x11A0, 5, 1, 0x00}, /* XRX200_PCE_ISR_1_CPH2 Classification Phase 2 Ready Interrupt */ -+// {0x11A0, 4, 1, 0x00}, /* XRX200_PCE_ISR_1_CPH1 Classification Phase 1 Ready Interrupt */ -+// {0x11A0, 3, 1, 0x00}, /* XRX200_PCE_ISR_1_CPH0 Classification Phase 0 Ready Interrupt */ -+// {0x11A0, 2, 1, 0x00}, /* XRX200_PCE_ISR_1_PRDY Parser Ready Interrupt */ -+// {0x11A0, 1, 1, 0x00}, /* XRX200_PCE_ISR_1_IGTF IGMP Table Full Interrupt */ -+// {0x11A0, 0, 1, 0x00}, /* XRX200_PCE_ISR_1_MTF MAC Table Full Interrupt */ -+// {0x11A4, 0, 16, 0x00}, /* XRX200_PARSER_STAT_FIFO Parser Status Register */ -+// {0x11A4, 8, 8, 0x00}, /* XRX200_PARSER_STAT_FSM_DAT_CNT Parser FSM Data Counter */ -+// {0x11A4, 5, 3, 0x00}, /* XRX200_PARSER_STAT_FSM_STATE Parser FSM State */ -+// {0x11A4, 4, 1, 0x00}, /* XRX200_PARSER_STAT_PKT_ERR Packet error detected */ -+// {0x11A4, 3, 1, 0x00}, /* XRX200_PARSER_STAT_FSM_FIN Parser FSM finished */ -+// {0x11A4, 2, 1, 0x00}, /* XRX200_PARSER_STAT_FSM_START Parser FSM start */ -+// {0x11A4, 1, 1, 0x00}, /* XRX200_PARSER_STAT_FIFO_RDY Parser FIFO ready for read. */ -+// {0x11A4, 0, 1, 0x00}, /* XRX200_PARSER_STAT_FIFO_FULL Parser */ -+// {0x1200, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_0 PCE Port ControlRegister 0 */ -+// {0x1200, 13, 1, 0x28}, /* XRX200_PCE_PCTRL_0_MCST Multicast Forwarding Mode Selection */ -+// {0x1200, 12, 1, 0x28}, /* XRX200_PCE_PCTRL_0_EGSTEN Table-based Egress Special Tag Enable */ -+// {0x1200, 11, 1, 0x28}, /* XRX200_PCE_PCTRL_0_IGSTEN Ingress Special Tag Enable */ -+// {0x1200, 10, 1, 0x28}, /* XRX200_PCE_PCTRL_0_PCPEN PCP Remarking Mode */ -+// {0x1200, 9, 1, 0x28}, /* XRX200_PCE_PCTRL_0_CLPEN Class Remarking Mode */ -+// {0x1200, 8, 1, 0x28}, /* XRX200_PCE_PCTRL_0_DPEN Drop Precedence Remarking Mode */ -+// {0x1200, 7, 1, 0x28}, /* XRX200_PCE_PCTRL_0_CMOD Three-color Marker Color Mode */ -+// {0x1200, 6, 1, 0x28}, /* XRX200_PCE_PCTRL_0_VREP VLAN Replacement Mode */ -+ {0x1200, 5, 1, 0x28}, /* XRX200_PCE_PCTRL_0_TVM Transparent VLAN Mode */ -+// {0x1200, 4, 1, 0x28}, /* XRX200_PCE_PCTRL_0_PLOCK Port Locking Enable */ -+// {0x1200, 3, 1, 0x28}, /* XRX200_PCE_PCTRL_0_AGEDIS Aging Disable */ -+// {0x1200, 0, 3, 0x28}, /* XRX200_PCE_PCTRL_0_PSTATE Port State */ -+// {0x1204, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_1 PCE Port ControlRegister 1 */ -+// {0x1204, 0, 8, 0x28}, /* XRX200_PCE_PCTRL_1_LRNLIM MAC Address Learning Limit */ -+// {0x1208, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_2 PCE Port ControlRegister 2 */ -+// {0x1208, 7, 1, 0x28}, /* XRX200_PCE_PCTRL_2_DSCPMOD DSCP Mode Selection */ -+// {0x1208, 5, 2, 0x28}, /* XRX200_PCE_PCTRL_2_DSCP Enable DSCP to select the Class of Service */ -+// {0x1208, 4, 1, 0x28}, /* XRX200_PCE_PCTRL_2_PCP Enable VLAN PCP to select the Class of Service */ -+// {0x1208, 0, 4, 0x28}, /* XRX200_PCE_PCTRL_2_PCLASS Port-based Traffic Class */ -+// {0x120C, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_3_VIO PCE Port ControlRegister 3 */ -+// {0x120C, 11, 1, 0x28}, /* XRX200_PCE_PCTRL_3_EDIR Egress Redirection Mode */ -+// {0x120C, 10, 1, 0x28}, /* XRX200_PCE_PCTRL_3_RXDMIR Receive Mirroring Enable for dropped frames */ -+// {0x120C, 9, 1, 0x28}, /* XRX200_PCE_PCTRL_3_RXVMIR Receive Mirroring Enable for valid frames */ -+// {0x120C, 8, 1, 0x28}, /* XRX200_PCE_PCTRL_3_TXMIR Transmit Mirroring Enable */ -+// {0x120C, 7, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_7 Violation Type 7 Mirroring Enable */ -+// {0x120C, 6, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_6 Violation Type 6 Mirroring Enable */ -+// {0x120C, 5, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_5 Violation Type 5 Mirroring Enable */ -+// {0x120C, 4, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_4 Violation Type 4 Mirroring Enable */ -+// {0x120C, 3, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_3 Violation Type 3 Mirroring Enable */ -+// {0x120C, 2, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_2 Violation Type 2 Mirroring Enable */ -+// {0x120C, 1, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_1 Violation Type 1 Mirroring Enable */ -+// {0x120C, 0, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_0 Violation Type 0 Mirroring Enable */ -+// {0x1210, 0, 16, 0x28}, /* XRX200_WOL_CTRL Wake-on-LAN ControlRegister */ -+// {0x1210, 0, 1, 0x28}, /* XRX200_WOL_CTRL_PORT WoL Enable */ -+// {0x1214, 0, 16, 0x28}, /* XRX200_PCE_VCTRL PCE VLAN ControlRegister */ -+ {0x1214, 5, 1, 0x28}, /* XRX200_PCE_VCTRL_VSR VLAN Security Rule */ -+ {0x1214, 4, 1, 0x28}, /* XRX200_PCE_VCTRL_VEMR VLAN Egress Member Violation Rule */ -+ {0x1214, 3, 1, 0x28}, /* XRX200_PCE_VCTRL_VIMR VLAN Ingress Member Violation Rule */ -+ {0x1214, 1, 2, 0x28}, /* XRX200_PCE_VCTRL_VINR VLAN Ingress Tag Rule */ -+ {0x1214, 0, 1, 0x28}, /* XRX200_PCE_VCTRL_UVR Unknown VLAN Rule */ -+// {0x1218, 0, 16, 0x28}, /* XRX200_PCE_DEFPVID PCE Default PortVID Register */ -+ {0x1218, 0, 6, 0x28}, /* XRX200_PCE_DEFPVID_PVID Default Port VID Index */ -+// {0x121C, 0, 16, 0x28}, /* XRX200_PCE_PSTAT PCE Port StatusRegister */ -+// {0x121C, 0, 16, 0x28}, /* XRX200_PCE_PSTAT_LRNCNT Learning Count */ -+// {0x1220, 0, 16, 0x28}, /* XRX200_PCE_PIER Parser and ClassificationEngine Port Interrupt Enable Register */ -+// {0x1220, 5, 1, 0x28}, /* XRX200_PCE_PIER_CLDRP Classification Drop Interrupt Enable */ -+// {0x1220, 4, 1, 0x28}, /* XRX200_PCE_PIER_PTDRP Port Drop Interrupt Enable */ -+// {0x1220, 3, 1, 0x28}, /* XRX200_PCE_PIER_VLAN VLAN Violation Interrupt Enable */ -+// {0x1220, 2, 1, 0x28}, /* XRX200_PCE_PIER_WOL Wake-on-LAN Interrupt Enable */ -+// {0x1220, 1, 1, 0x28}, /* XRX200_PCE_PIER_LOCK Port Limit Alert Interrupt Enable */ -+// {0x1220, 0, 1, 0x28}, /* XRX200_PCE_PIER_LIM Port Lock Alert Interrupt Enable */ -+// {0x1224, 0, 16, 0x28}, /* XRX200_PCE_PISR Parser and ClassificationEngine Port Interrupt Status Register */ -+// {0x1224, 5, 1, 0x28}, /* XRX200_PCE_PISR_CLDRP Classification Drop Interrupt */ -+// {0x1224, 4, 1, 0x28}, /* XRX200_PCE_PISR_PTDRP Port Drop Interrupt */ -+// {0x1224, 3, 1, 0x28}, /* XRX200_PCE_PISR_VLAN VLAN Violation Interrupt */ -+// {0x1224, 2, 1, 0x28}, /* XRX200_PCE_PISR_WOL Wake-on-LAN Interrupt */ -+// {0x1224, 1, 1, 0x28}, /* XRX200_PCE_PISR_LOCK Port Lock Alert Interrupt */ -+// {0x1224, 0, 1, 0x28}, /* XRX200_PCE_PISR_LIMIT Port Limitation Alert Interrupt */ -+// {0x1600, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CTRL Three-colorMarker Control Register */ -+// {0x1600, 0, 1, 0x1c}, /* XRX200_PCE_TCM_CTRL_TCMEN Three-color Marker metering instance enable */ -+// {0x1604, 0, 16, 0x1c}, /* XRX200_PCE_TCM_STAT Three-colorMarker Status Register */ -+// {0x1604, 1, 1, 0x1c}, /* XRX200_PCE_TCM_STAT_AL1 Three-color Marker Alert 1 Status */ -+// {0x1604, 0, 1, 0x1c}, /* XRX200_PCE_TCM_STAT_AL0 Three-color Marker Alert 0 Status */ -+// {0x1608, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CBS Three-color MarkerCommitted Burst Size Register */ -+// {0x1608, 0, 10, 0x1c}, /* XRX200_PCE_TCM_CBS_CBS Committed Burst Size */ -+// {0x160C, 0, 16, 0x1c}, /* XRX200_PCE_TCM_EBS Three-color MarkerExcess Burst Size Register */ -+// {0x160C, 0, 10, 0x1c}, /* XRX200_PCE_TCM_EBS_EBS Excess Burst Size */ -+// {0x1610, 0, 16, 0x1c}, /* XRX200_PCE_TCM_IBS Three-color MarkerInstantaneous Burst Size Register */ -+// {0x1610, 0, 2, 0x1c}, /* XRX200_PCE_TCM_IBS_IBS Instantaneous Burst Size */ -+// {0x1614, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CIR_MANT Three-colorMarker Constant Information Rate Mantissa Register */ -+// {0x1614, 0, 10, 0x1c}, /* XRX200_PCE_TCM_CIR_MANT_MANT Rate Counter Mantissa */ -+// {0x1618, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CIR_EXP Three-colorMarker Constant Information Rate Exponent Register */ -+// {0x1618, 0, 4, 0x1c}, /* XRX200_PCE_TCM_CIR_EXP_EXP Rate Counter Exponent */ -+// {0x2300, 0, 16, 0x00}, /* XRX200_MAC_TEST MAC Test Register */ -+// {0x2300, 0, 16, 0x00}, /* XRX200_MAC_TEST_JTP Jitter Test Pattern */ -+// {0x2304, 0, 16, 0x00}, /* XRX200_MAC_PFAD_CFG MAC Pause FrameSource Address Configuration Register */ -+// {0x2304, 0, 1, 0x00}, /* XRX200_MAC_PFAD_CFG_SAMOD Source Address Mode */ -+// {0x2308, 0, 16, 0x00}, /* XRX200_MAC_PFSA_0 Pause Frame SourceAddress Part 0 */ -+// {0x2308, 0, 16, 0x00}, /* XRX200_MAC_PFSA_0_PFAD Pause Frame Source Address Part 0 */ -+// {0x230C, 0, 16, 0x00}, /* XRX200_MAC_PFSA_1 Pause Frame SourceAddress Part 1 */ -+// {0x230C, 0, 16, 0x00}, /* XRX200_MAC_PFSA_1_PFAD Pause Frame Source Address Part 1 */ -+// {0x2310, 0, 16, 0x00}, /* XRX200_MAC_PFSA_2 Pause Frame SourceAddress Part 2 */ -+// {0x2310, 0, 16, 0x00}, /* XRX200_MAC_PFSA_2_PFAD Pause Frame Source Address Part 2 */ -+// {0x2314, 0, 16, 0x00}, /* XRX200_MAC_FLEN MAC Frame Length Register */ -+// {0x2314, 0, 14, 0x00}, /* XRX200_MAC_FLEN_LEN Maximum Frame Length */ -+// {0x2318, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_0 MAC VLAN EthertypeRegister 0 */ -+// {0x2318, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_0_OUTER Ethertype */ -+// {0x231C, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_1 MAC VLAN EthertypeRegister 1 */ -+// {0x231C, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_1_INNER Ethertype */ -+// {0x2320, 0, 16, 0x00}, /* XRX200_MAC_IER MAC Interrupt EnableRegister */ -+// {0x2320, 0, 8, 0x00}, /* XRX200_MAC_IER_MACIEN MAC Interrupt Enable */ -+// {0x2324, 0, 16, 0x00}, /* XRX200_MAC_ISR MAC Interrupt StatusRegister */ -+// {0x2324, 0, 8, 0x00}, /* XRX200_MAC_ISR_MACINT MAC Interrupt */ -+// {0x2400, 0, 16, 0x30}, /* XRX200_MAC_PSTAT MAC Port Status Register */ -+// {0x2400, 11, 1, 0x30}, /* XRX200_MAC_PSTAT_PACT PHY Active Status */ -+ {0x2400, 10, 1, 0x30}, /* XRX200_MAC_PSTAT_GBIT Gigabit Speed Status */ -+ {0x2400, 9, 1, 0x30}, /* XRX200_MAC_PSTAT_MBIT Megabit Speed Status */ -+ {0x2400, 8, 1, 0x30}, /* XRX200_MAC_PSTAT_FDUP Full Duplex Status */ -+// {0x2400, 7, 1, 0x30}, /* XRX200_MAC_PSTAT_RXPAU Receive Pause Status */ -+// {0x2400, 6, 1, 0x30}, /* XRX200_MAC_PSTAT_TXPAU Transmit Pause Status */ -+// {0x2400, 5, 1, 0x30}, /* XRX200_MAC_PSTAT_RXPAUEN Receive Pause Enable Status */ -+// {0x2400, 4, 1, 0x30}, /* XRX200_MAC_PSTAT_TXPAUEN Transmit Pause Enable Status */ -+ {0x2400, 3, 1, 0x30}, /* XRX200_MAC_PSTAT_LSTAT Link Status */ -+// {0x2400, 2, 1, 0x30}, /* XRX200_MAC_PSTAT_CRS Carrier Sense Status */ -+// {0x2400, 1, 1, 0x30}, /* XRX200_MAC_PSTAT_TXLPI Transmit Low-power Idle Status */ -+// {0x2400, 0, 1, 0x30}, /* XRX200_MAC_PSTAT_RXLPI Receive Low-power Idle Status */ -+// {0x2404, 0, 16, 0x30}, /* XRX200_MAC_PISR MAC Interrupt Status Register */ -+// {0x2404, 13, 1, 0x30}, /* XRX200_MAC_PISR_PACT PHY Active Status */ -+// {0x2404, 12, 1, 0x30}, /* XRX200_MAC_PISR_SPEED Megabit Speed Status */ -+// {0x2404, 11, 1, 0x30}, /* XRX200_MAC_PISR_FDUP Full Duplex Status */ -+// {0x2404, 10, 1, 0x30}, /* XRX200_MAC_PISR_RXPAUEN Receive Pause Enable Status */ -+// {0x2404, 9, 1, 0x30}, /* XRX200_MAC_PISR_TXPAUEN Transmit Pause Enable Status */ -+// {0x2404, 8, 1, 0x30}, /* XRX200_MAC_PISR_LPIOFF Receive Low-power Idle Mode is left */ -+// {0x2404, 7, 1, 0x30}, /* XRX200_MAC_PISR_LPION Receive Low-power Idle Mode is entered */ -+// {0x2404, 6, 1, 0x30}, /* XRX200_MAC_PISR_JAM Jam Status Detected */ -+// {0x2404, 5, 1, 0x30}, /* XRX200_MAC_PISR_TOOSHORT Too Short Frame Error Detected */ -+// {0x2404, 4, 1, 0x30}, /* XRX200_MAC_PISR_TOOLONG Too Long Frame Error Detected */ -+// {0x2404, 3, 1, 0x30}, /* XRX200_MAC_PISR_LENERR Length Mismatch Error Detected */ -+// {0x2404, 2, 1, 0x30}, /* XRX200_MAC_PISR_FCSERR Frame Checksum Error Detected */ -+// {0x2404, 1, 1, 0x30}, /* XRX200_MAC_PISR_TXPAUSE Pause Frame Transmitted */ -+// {0x2404, 0, 1, 0x30}, /* XRX200_MAC_PISR_RXPAUSE Pause Frame Received */ -+// {0x2408, 0, 16, 0x30}, /* XRX200_MAC_PIER MAC Interrupt Enable Register */ -+// {0x2408, 13, 1, 0x30}, /* XRX200_MAC_PIER_PACT PHY Active Status */ -+// {0x2408, 12, 1, 0x30}, /* XRX200_MAC_PIER_SPEED Megabit Speed Status */ -+// {0x2408, 11, 1, 0x30}, /* XRX200_MAC_PIER_FDUP Full Duplex Status */ -+// {0x2408, 10, 1, 0x30}, /* XRX200_MAC_PIER_RXPAUEN Receive Pause Enable Status */ -+// {0x2408, 9, 1, 0x30}, /* XRX200_MAC_PIER_TXPAUEN Transmit Pause Enable Status */ -+// {0x2408, 8, 1, 0x30}, /* XRX200_MAC_PIER_LPIOFF Low-power Idle Off Interrupt Mask */ -+// {0x2408, 7, 1, 0x30}, /* XRX200_MAC_PIER_LPION Low-power Idle On Interrupt Mask */ -+// {0x2408, 6, 1, 0x30}, /* XRX200_MAC_PIER_JAM Jam Status Interrupt Mask */ -+// {0x2408, 5, 1, 0x30}, /* XRX200_MAC_PIER_TOOSHORT Too Short Frame Error Interrupt Mask */ -+// {0x2408, 4, 1, 0x30}, /* XRX200_MAC_PIER_TOOLONG Too Long Frame Error Interrupt Mask */ -+// {0x2408, 3, 1, 0x30}, /* XRX200_MAC_PIER_LENERR Length Mismatch Error Interrupt Mask */ -+// {0x2408, 2, 1, 0x30}, /* XRX200_MAC_PIER_FCSERR Frame Checksum Error Interrupt Mask */ -+// {0x2408, 1, 1, 0x30}, /* XRX200_MAC_PIER_TXPAUSE Transmit Pause Frame Interrupt Mask */ -+// {0x2408, 0, 1, 0x30}, /* XRX200_MAC_PIER_RXPAUSE Receive Pause Frame Interrupt Mask */ -+// {0x240C, 0, 16, 0x30}, /* XRX200_MAC_CTRL_0 MAC Control Register0 */ -+// {0x240C, 13, 2, 0x30}, /* XRX200_MAC_CTRL_0_LCOL Late Collision Control */ -+// {0x240C, 12, 1, 0x30}, /* XRX200_MAC_CTRL_0_BM Burst Mode Control */ -+// {0x240C, 11, 1, 0x30}, /* XRX200_MAC_CTRL_0_APADEN Automatic VLAN Padding Enable */ -+// {0x240C, 10, 1, 0x30}, /* XRX200_MAC_CTRL_0_VPAD2EN Stacked VLAN Padding Enable */ -+// {0x240C, 9, 1, 0x30}, /* XRX200_MAC_CTRL_0_VPADEN VLAN Padding Enable */ -+// {0x240C, 8, 1, 0x30}, /* XRX200_MAC_CTRL_0_PADEN Padding Enable */ -+// {0x240C, 7, 1, 0x30}, /* XRX200_MAC_CTRL_0_FCS Transmit FCS Control */ -+ {0x240C, 4, 3, 0x30}, /* XRX200_MAC_CTRL_0_FCON Flow Control Mode */ -+// {0x240C, 2, 2, 0x30}, /* XRX200_MAC_CTRL_0_FDUP Full Duplex Control */ -+// {0x240C, 0, 2, 0x30}, /* XRX200_MAC_CTRL_0_GMII GMII/MII interface mode selection */ -+// {0x2410, 0, 16, 0x30}, /* XRX200_MAC_CTRL_1 MAC Control Register1 */ -+// {0x2410, 8, 1, 0x30}, /* XRX200_MAC_CTRL_1_SHORTPRE Short Preamble Control */ -+// {0x2410, 0, 4, 0x30}, /* XRX200_MAC_CTRL_1_IPG Minimum Inter Packet Gap Size */ -+// {0x2414, 0, 16, 0x30}, /* XRX200_MAC_CTRL_2 MAC Control Register2 */ -+// {0x2414, 3, 1, 0x30}, /* XRX200_MAC_CTRL_2_MLEN Maximum Untagged Frame Length */ -+// {0x2414, 2, 1, 0x30}, /* XRX200_MAC_CTRL_2_LCHKL Frame Length Check Long Enable */ -+// {0x2414, 0, 2, 0x30}, /* XRX200_MAC_CTRL_2_LCHKS Frame Length Check Short Enable */ -+// {0x2418, 0, 16, 0x30}, /* XRX200_MAC_CTRL_3 MAC Control Register3 */ -+// {0x2418, 0, 4, 0x30}, /* XRX200_MAC_CTRL_3_RCNT Retry Count */ -+// {0x241C, 0, 16, 0x30}, /* XRX200_MAC_CTRL_4 MAC Control Register4 */ -+// {0x241C, 7, 1, 0x30}, /* XRX200_MAC_CTRL_4_LPIEN LPI Mode Enable */ -+// {0x241C, 0, 7, 0x30}, /* XRX200_MAC_CTRL_4_WAIT LPI Wait Time */ -+// {0x2420, 0, 16, 0x30}, /* XRX200_MAC_CTRL_5_PJPS MAC Control Register5 */ -+// {0x2420, 1, 1, 0x30}, /* XRX200_MAC_CTRL_5_PJPS_NOBP Prolonged Jam pattern size during no-backpressure state */ -+// {0x2420, 0, 1, 0x30}, /* XRX200_MAC_CTRL_5_PJPS_BP Prolonged Jam pattern size during backpressure state */ -+// {0x2424, 0, 16, 0x30}, /* XRX200_MAC_CTRL_6_XBUF Transmit and ReceiveBuffer Control Register */ -+// {0x2424, 9, 3, 0x30}, /* XRX200_MAC_CTRL_6_RBUF_DLY_WP Delay */ -+// {0x2424, 8, 1, 0x30}, /* XRX200_MAC_CTRL_6_RBUF_INIT Receive Buffer Initialization */ -+// {0x2424, 6, 1, 0x30}, /* XRX200_MAC_CTRL_6_RBUF_BYPASS Bypass the Receive Buffer */ -+// {0x2424, 3, 3, 0x30}, /* XRX200_MAC_CTRL_6_XBUF_DLY_WP Delay */ -+// {0x2424, 2, 1, 0x30}, /* XRX200_MAC_CTRL_6_XBUF_INIT Initialize the Transmit Buffer */ -+// {0x2424, 0, 1, 0x30}, /* XRX200_MAC_CTRL_6_XBUF_BYPASS Bypass the Transmit Buffer */ -+// {0x2428, 0, 16, 0x30}, /* XRX200_MAC_BUFST_XBUF MAC Receive and TransmitBuffer Status Register */ -+// {0x2428, 3, 1, 0x30}, /* XRX200_MAC_BUFST_RBUF_UFL Receive Buffer Underflow Indicator */ -+// {0x2428, 2, 1, 0x30}, /* XRX200_MAC_BUFST_RBUF_OFL Receive Buffer Overflow Indicator */ -+// {0x2428, 1, 1, 0x30}, /* XRX200_MAC_BUFST_XBUF_UFL Transmit Buffer Underflow Indicator */ -+// {0x2428, 0, 1, 0x30}, /* XRX200_MAC_BUFST_XBUF_OFL Transmit Buffer Overflow Indicator */ -+// {0x242C, 0, 16, 0x30}, /* XRX200_MAC_TESTEN MAC Test Enable Register */ -+// {0x242C, 2, 1, 0x30}, /* XRX200_MAC_TESTEN_JTEN Jitter Test Enable */ -+// {0x242C, 1, 1, 0x30}, /* XRX200_MAC_TESTEN_TXER Transmit Error Insertion */ -+// {0x242C, 0, 1, 0x30}, /* XRX200_MAC_TESTEN_LOOP MAC Loopback Enable */ -+// {0x2900, 0, 16, 0x00}, /* XRX200_FDMA_CTRL Ethernet Switch FetchDMA Control Register */ -+// {0x2900, 7, 5, 0x00}, /* XRX200_FDMA_CTRL_LPI_THRESHOLD Low Power Idle Threshold */ -+// {0x2900, 4, 3, 0x00}, /* XRX200_FDMA_CTRL_LPI_MODE Low Power Idle Mode */ -+// {0x2900, 2, 2, 0x00}, /* XRX200_FDMA_CTRL_EGSTAG Egress Special Tag Size */ -+// {0x2900, 1, 1, 0x00}, /* XRX200_FDMA_CTRL_IGSTAG Ingress Special Tag Size */ -+// {0x2900, 0, 1, 0x00}, /* XRX200_FDMA_CTRL_EXCOL Excessive Collision Handling */ -+// {0x2904, 0, 16, 0x00}, /* XRX200_FDMA_STETYPE Special Tag EthertypeControl Register */ -+// {0x2904, 0, 16, 0x00}, /* XRX200_FDMA_STETYPE_ETYPE Special Tag Ethertype */ -+// {0x2908, 0, 16, 0x00}, /* XRX200_FDMA_VTETYPE VLAN Tag EthertypeControl Register */ -+// {0x2908, 0, 16, 0x00}, /* XRX200_FDMA_VTETYPE_ETYPE VLAN Tag Ethertype */ -+// {0x290C, 0, 16, 0x00}, /* XRX200_FDMA_STAT_0 FDMA Status Register0 */ -+// {0x290C, 0, 16, 0x00}, /* XRX200_FDMA_STAT_0_FSMS FSM states status */ -+// {0x2910, 0, 16, 0x00}, /* XRX200_FDMA_IER Fetch DMA Global InterruptEnable Register */ -+// {0x2910, 14, 1, 0x00}, /* XRX200_FDMA_IER_PCKD Packet Drop Interrupt Enable */ -+// {0x2910, 13, 1, 0x00}, /* XRX200_FDMA_IER_PCKR Packet Ready Interrupt Enable */ -+// {0x2910, 0, 8, 0x00}, /* XRX200_FDMA_IER_PCKT Packet Sent Interrupt Enable */ -+// {0x2914, 0, 16, 0x00}, /* XRX200_FDMA_ISR Fetch DMA Global InterruptStatus Register */ -+// {0x2914, 14, 1, 0x00}, /* XRX200_FDMA_ISR_PCKTD Packet Drop */ -+// {0x2914, 13, 1, 0x00}, /* XRX200_FDMA_ISR_PCKR Packet is Ready for Transmission */ -+// {0x2914, 0, 8, 0x00}, /* XRX200_FDMA_ISR_PCKT Packet Sent Event */ -+// {0x2A00, 0, 16, 0x18}, /* XRX200_FDMA_PCTRL Ethernet SwitchFetch DMA Port Control Register */ -+// {0x2A00, 3, 2, 0x18}, /* XRX200_FDMA_PCTRL_VLANMOD VLAN Modification Enable */ -+// {0x2A00, 2, 1, 0x18}, /* XRX200_FDMA_PCTRL_DSCPRM DSCP Re-marking Enable */ -+// {0x2A00, 1, 1, 0x18}, /* XRX200_FDMA_PCTRL_STEN Special Tag Insertion Enable */ -+// {0x2A00, 0, 1, 0x18}, /* XRX200_FDMA_PCTRL_EN FDMA Port Enable */ -+// {0x2A04, 0, 16, 0x18}, /* XRX200_FDMA_PRIO Ethernet SwitchFetch DMA Port Priority Register */ -+// {0x2A04, 0, 2, 0x18}, /* XRX200_FDMA_PRIO_PRIO FDMA PRIO */ -+// {0x2A08, 0, 16, 0x18}, /* XRX200_FDMA_PSTAT0 Ethernet SwitchFetch DMA Port Status Register 0 */ -+// {0x2A08, 15, 1, 0x18}, /* XRX200_FDMA_PSTAT0_PKT_AVAIL Port Egress Packet Available */ -+// {0x2A08, 14, 1, 0x18}, /* XRX200_FDMA_PSTAT0_POK Port Status OK */ -+// {0x2A08, 0, 6, 0x18}, /* XRX200_FDMA_PSTAT0_PSEG Port Egress Segment Count */ -+// {0x2A0C, 0, 16, 0x18}, /* XRX200_FDMA_PSTAT1_HDR Ethernet SwitchFetch DMA Port Status Register 1 */ -+// {0x2A0C, 0, 10, 0x18}, /* XRX200_FDMA_PSTAT1_HDR_PTR Header Pointer */ -+// {0x2A10, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP0 Egress TimeStamp Register 0 */ -+// {0x2A10, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP0_TSTL Time Stamp [15:0] */ -+// {0x2A14, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP1 Egress TimeStamp Register 1 */ -+// {0x2A14, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP1_TSTH Time Stamp [31:16] */ -+// {0x2D00, 0, 16, 0x00}, /* XRX200_SDMA_CTRL Ethernet Switch StoreDMA Control Register */ -+// {0x2D00, 0, 1, 0x00}, /* XRX200_SDMA_CTRL_TSTEN Time Stamp Enable */ -+// {0x2D04, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR1 SDMA Flow Control Threshold1 Register */ -+// {0x2D04, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR1_THR1 Threshold 1 */ -+// {0x2D08, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR2 SDMA Flow Control Threshold2 Register */ -+// {0x2D08, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR2_THR2 Threshold 2 */ -+// {0x2D0C, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR3 SDMA Flow Control Threshold3 Register */ -+// {0x2D0C, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR3_THR3 Threshold 3 */ -+// {0x2D10, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR4 SDMA Flow Control Threshold4 Register */ -+// {0x2D10, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR4_THR4 Threshold 4 */ -+// {0x2D14, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR5 SDMA Flow Control Threshold5 Register */ -+// {0x2D14, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR5_THR5 Threshold 5 */ -+// {0x2D18, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR6 SDMA Flow Control Threshold6 Register */ -+// {0x2D18, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR6_THR6 Threshold 6 */ -+// {0x2D1C, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR7 SDMA Flow Control Threshold7 Register */ -+// {0x2D1C, 0, 11, 0x00}, /* XRX200_SDMA_FCTHR7_THR7 Threshold 7 */ -+// {0x2D20, 0, 16, 0x00}, /* XRX200_SDMA_STAT_0 SDMA Status Register0 */ -+// {0x2D20, 4, 3, 0x00}, /* XRX200_SDMA_STAT_0_BPS_FILL Back Pressure Status */ -+// {0x2D20, 2, 2, 0x00}, /* XRX200_SDMA_STAT_0_BPS_PNT Back Pressure Status */ -+// {0x2D20, 0, 2, 0x00}, /* XRX200_SDMA_STAT_0_DROP Back Pressure Status */ -+// {0x2D24, 0, 16, 0x00}, /* XRX200_SDMA_STAT_1 SDMA Status Register1 */ -+// {0x2D24, 0, 10, 0x00}, /* XRX200_SDMA_STAT_1_FILL Buffer Filling Level */ -+// {0x2D28, 0, 16, 0x00}, /* XRX200_SDMA_STAT_2 SDMA Status Register2 */ -+// {0x2D28, 0, 16, 0x00}, /* XRX200_SDMA_STAT_2_FSMS FSM states status */ -+// {0x2D2C, 0, 16, 0x00}, /* XRX200_SDMA_IER SDMA Interrupt Enable Register */ -+// {0x2D2C, 15, 1, 0x00}, /* XRX200_SDMA_IER_BPEX Buffer Pointers Exceeded */ -+// {0x2D2C, 14, 1, 0x00}, /* XRX200_SDMA_IER_BFULL Buffer Full */ -+// {0x2D2C, 13, 1, 0x00}, /* XRX200_SDMA_IER_FERR Frame Error */ -+// {0x2D2C, 0, 8, 0x00}, /* XRX200_SDMA_IER_FRX Frame Received Successfully */ -+// {0x2D30, 0, 16, 0x00}, /* XRX200_SDMA_ISR SDMA Interrupt Status Register */ -+// {0x2D30, 15, 1, 0x00}, /* XRX200_SDMA_ISR_BPEX Packet Descriptors Exceeded */ -+// {0x2D30, 14, 1, 0x00}, /* XRX200_SDMA_ISR_BFULL Buffer Full */ -+// {0x2D30, 13, 1, 0x00}, /* XRX200_SDMA_ISR_FERR Frame Error */ -+// {0x2D30, 0, 8, 0x00}, /* XRX200_SDMA_ISR_FRX Frame Received Successfully */ -+// {0x2F00, 0, 16, 0x18}, /* XRX200_SDMA_PCTRL Ethernet SwitchStore DMA Port Control Register */ -+// {0x2F00, 13, 2, 0x18}, /* XRX200_SDMA_PCTRL_DTHR Drop Threshold Selection */ -+// {0x2F00, 11, 2, 0x18}, /* XRX200_SDMA_PCTRL_PTHR Pause Threshold Selection */ -+// {0x2F00, 10, 1, 0x18}, /* XRX200_SDMA_PCTRL_PHYEFWD Forward PHY Error Frames */ -+// {0x2F00, 9, 1, 0x18}, /* XRX200_SDMA_PCTRL_ALGFWD Forward Alignment Error Frames */ -+// {0x2F00, 8, 1, 0x18}, /* XRX200_SDMA_PCTRL_LENFWD Forward Length Errored Frames */ -+// {0x2F00, 7, 1, 0x18}, /* XRX200_SDMA_PCTRL_OSFWD Forward Oversized Frames */ -+// {0x2F00, 6, 1, 0x18}, /* XRX200_SDMA_PCTRL_USFWD Forward Undersized Frames */ -+// {0x2F00, 5, 1, 0x18}, /* XRX200_SDMA_PCTRL_FCSIGN Ignore FCS Errors */ -+// {0x2F00, 4, 1, 0x18}, /* XRX200_SDMA_PCTRL_FCSFWD Forward FCS Errored Frames */ -+// {0x2F00, 3, 1, 0x18}, /* XRX200_SDMA_PCTRL_PAUFWD Pause Frame Forwarding */ -+// {0x2F00, 2, 1, 0x18}, /* XRX200_SDMA_PCTRL_MFCEN Metering Flow Control Enable */ -+// {0x2F00, 1, 1, 0x18}, /* XRX200_SDMA_PCTRL_FCEN Flow Control Enable */ -+// {0x2F00, 0, 1, 0x18}, /* XRX200_SDMA_PCTRL_PEN Port Enable */ -+// {0x2F04, 0, 16, 0x18}, /* XRX200_SDMA_PRIO Ethernet SwitchStore DMA Port Priority Register */ -+// {0x2F04, 0, 2, 0x18}, /* XRX200_SDMA_PRIO_PRIO SDMA PRIO */ -+// {0x2F08, 0, 16, 0x18}, /* XRX200_SDMA_PSTAT0_HDR Ethernet SwitchStore DMA Port Status Register 0 */ -+// {0x2F08, 0, 10, 0x18}, /* XRX200_SDMA_PSTAT0_HDR_PTR Port Ingress Queue Header Pointer */ -+// {0x2F0C, 0, 16, 0x18}, /* XRX200_SDMA_PSTAT1 Ethernet SwitchStore DMA Port Status Register 1 */ -+// {0x2F0C, 0, 10, 0x18}, /* XRX200_SDMA_PSTAT1_PPKT Port Ingress Packet Count */ -+// {0x2F10, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP0 Ingress TimeStamp Register 0 */ -+// {0x2F10, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP0_TSTL Time Stamp [15:0] */ -+// {0x2F14, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP1 Ingress TimeStamp Register 1 */ -+// {0x2F14, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP1_TSTH Time Stamp [31:16] */ -+}; -+ -+ diff --git a/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch b/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch deleted file mode 100644 index eb6acdb2f..000000000 --- a/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c6feeeb407a3b8a6597ae377ba4dd138e185e3dd Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Sun, 27 Jul 2014 09:38:50 +0100 -Subject: [PATCH 26/36] NET: multi phy support - -Signed-off-by: John Crispin ---- - drivers/net/phy/phy.c | 9 ++++++--- - include/linux/phy.h | 1 + - 2 files changed, 7 insertions(+), 3 deletions(-) - ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -1038,7 +1038,8 @@ void phy_state_machine(struct work_struc - /* If the link is down, give up on negotiation for now */ - if (!phydev->link) { - phydev->state = PHY_NOLINK; -- netif_carrier_off(phydev->attached_dev); -+ if (!phydev->no_auto_carrier_off) -+ netif_carrier_off(phydev->attached_dev); - phydev->adjust_link(phydev->attached_dev); - break; - } -@@ -1130,7 +1131,8 @@ void phy_state_machine(struct work_struc - netif_carrier_on(phydev->attached_dev); - } else { - phydev->state = PHY_NOLINK; -- netif_carrier_off(phydev->attached_dev); -+ if (!phydev->no_auto_carrier_off) -+ netif_carrier_off(phydev->attached_dev); - } - - phydev->adjust_link(phydev->attached_dev); -@@ -1142,7 +1144,8 @@ void phy_state_machine(struct work_struc - case PHY_HALTED: - if (phydev->link) { - phydev->link = 0; -- netif_carrier_off(phydev->attached_dev); -+ if (!phydev->no_auto_carrier_off) -+ netif_carrier_off(phydev->attached_dev); - phydev->adjust_link(phydev->attached_dev); - do_suspend = true; - } ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -369,6 +369,7 @@ struct phy_device { - bool is_pseudo_fixed_link; - bool has_fixups; - bool suspended; -+ bool no_auto_carrier_off; - - enum phy_state state; - diff --git a/target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch b/target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch deleted file mode 100644 index 21261b459..000000000 --- a/target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 5b73d9955fb4b0e3c37f8f6c71910293246c89dc Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Thu, 22 Mar 2018 23:31:38 +0100 -Subject: [PATCH 1/2] net: phy: intel-xway: add VR9 version number - -The VR9 phy ids are matching only for the SoC version 1.2. Rename the -macros and change the names to take this into account. - -Signed-off-by: Mathias Kresin -Signed-off-by: David S. Miller ---- - drivers/net/phy/intel-xway.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - ---- a/drivers/net/phy/intel-xway.c -+++ b/drivers/net/phy/intel-xway.c -@@ -149,8 +149,8 @@ - #define PHY_ID_PHY22F_1_4 0xD565A410 - #define PHY_ID_PHY11G_1_5 0xD565A401 - #define PHY_ID_PHY22F_1_5 0xD565A411 --#define PHY_ID_PHY11G_VR9 0xD565A409 --#define PHY_ID_PHY22F_VR9 0xD565A419 -+#define PHY_ID_PHY11G_VR9_1_2 0xD565A409 -+#define PHY_ID_PHY22F_VR9_1_2 0xD565A419 - - #if IS_ENABLED(CONFIG_OF_MDIO) - static int vr9_gphy_of_reg_init(struct phy_device *phydev) -@@ -372,9 +372,9 @@ static struct phy_driver xway_gphy[] = { - .suspend = genphy_suspend, - .resume = genphy_resume, - }, { -- .phy_id = PHY_ID_PHY11G_VR9, -+ .phy_id = PHY_ID_PHY11G_VR9_1_2, - .phy_id_mask = 0xffffffff, -- .name = "Intel XWAY PHY11G (xRX integrated)", -+ .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), - .flags = PHY_HAS_INTERRUPT, -@@ -387,9 +387,9 @@ static struct phy_driver xway_gphy[] = { - .suspend = genphy_suspend, - .resume = genphy_resume, - }, { -- .phy_id = PHY_ID_PHY22F_VR9, -+ .phy_id = PHY_ID_PHY22F_VR9_1_2, - .phy_id_mask = 0xffffffff, -- .name = "Intel XWAY PHY22F (xRX integrated)", -+ .name = "Intel XWAY PHY22F (xRX v1.2 integrated)", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), - .flags = PHY_HAS_INTERRUPT, -@@ -412,8 +412,8 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_PHY22F_1_4, 0xffffffff }, - { PHY_ID_PHY11G_1_5, 0xffffffff }, - { PHY_ID_PHY22F_1_5, 0xffffffff }, -- { PHY_ID_PHY11G_VR9, 0xffffffff }, -- { PHY_ID_PHY22F_VR9, 0xffffffff }, -+ { PHY_ID_PHY11G_VR9_1_2, 0xffffffff }, -+ { PHY_ID_PHY22F_VR9_1_2, 0xffffffff }, - { } - }; - MODULE_DEVICE_TABLE(mdio, xway_gphy_tbl); diff --git a/target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch b/target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch deleted file mode 100644 index 9a9253290..000000000 --- a/target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch +++ /dev/null @@ -1,71 +0,0 @@ -From f452518c982e57538e6d49da0a2c80eef22087ab Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Thu, 22 Mar 2018 23:31:39 +0100 -Subject: [PATCH 2/2] net: phy: intel-xway: add VR9 v1.1 phy ids - -The phys embedded into the v1.1 of the VR9 SoC are using different phy -ids. Add the phy ids to use the driver for this VR9 version as well. - -Signed-off-by: Mathias Kresin -Signed-off-by: David S. Miller ---- - drivers/net/phy/intel-xway.c | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - ---- a/drivers/net/phy/intel-xway.c -+++ b/drivers/net/phy/intel-xway.c -@@ -149,6 +149,8 @@ - #define PHY_ID_PHY22F_1_4 0xD565A410 - #define PHY_ID_PHY11G_1_5 0xD565A401 - #define PHY_ID_PHY22F_1_5 0xD565A411 -+#define PHY_ID_PHY11G_VR9_1_1 0xD565A408 -+#define PHY_ID_PHY22F_VR9_1_1 0xD565A418 - #define PHY_ID_PHY11G_VR9_1_2 0xD565A409 - #define PHY_ID_PHY22F_VR9_1_2 0xD565A419 - -@@ -372,6 +374,36 @@ static struct phy_driver xway_gphy[] = { - .suspend = genphy_suspend, - .resume = genphy_resume, - }, { -+ .phy_id = PHY_ID_PHY11G_VR9_1_1, -+ .phy_id_mask = 0xffffffff, -+ .name = "Intel XWAY PHY11G (xRX v1.1 integrated)", -+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | -+ SUPPORTED_Asym_Pause), -+ .flags = PHY_HAS_INTERRUPT, -+ .config_init = xway_gphy_config_init, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = xway_gphy_ack_interrupt, -+ .did_interrupt = xway_gphy_did_interrupt, -+ .config_intr = xway_gphy_config_intr, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ }, { -+ .phy_id = PHY_ID_PHY22F_VR9_1_1, -+ .phy_id_mask = 0xffffffff, -+ .name = "Intel XWAY PHY22F (xRX v1.1 integrated)", -+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | -+ SUPPORTED_Asym_Pause), -+ .flags = PHY_HAS_INTERRUPT, -+ .config_init = xway_gphy_config_init, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = xway_gphy_ack_interrupt, -+ .did_interrupt = xway_gphy_did_interrupt, -+ .config_intr = xway_gphy_config_intr, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ }, { - .phy_id = PHY_ID_PHY11G_VR9_1_2, - .phy_id_mask = 0xffffffff, - .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", -@@ -412,6 +444,8 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_PHY22F_1_4, 0xffffffff }, - { PHY_ID_PHY11G_1_5, 0xffffffff }, - { PHY_ID_PHY22F_1_5, 0xffffffff }, -+ { PHY_ID_PHY11G_VR9_1_1, 0xffffffff }, -+ { PHY_ID_PHY22F_VR9_1_1, 0xffffffff }, - { PHY_ID_PHY11G_VR9_1_2, 0xffffffff }, - { PHY_ID_PHY22F_VR9_1_2, 0xffffffff }, - { } diff --git a/target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch b/target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch deleted file mode 100644 index dc99f48ea..000000000 --- a/target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch +++ /dev/null @@ -1,880 +0,0 @@ -From 870ed9cae083ff8a60a739ef7e74c5a1800533be Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 9 Sep 2014 22:45:34 +0200 -Subject: [PATCH 28/36] NET: lantiq: various etop fixes - -Signed-off-by: John Crispin ---- - drivers/net/ethernet/lantiq_etop.c | 555 +++++++++++++++++++++++++----------- - 1 file changed, 389 insertions(+), 166 deletions(-) - ---- a/drivers/net/ethernet/lantiq_etop.c -+++ b/drivers/net/ethernet/lantiq_etop.c -@@ -11,7 +11,7 @@ - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - * -- * Copyright (C) 2011 John Crispin -+ * Copyright (C) 2011-12 John Crispin - */ - - #include -@@ -30,11 +30,16 @@ - #include - #include - #include -+#include - #include - #include - #include - #include - #include -+#include -+#include -+#include -+#include - - #include - -@@ -42,7 +47,7 @@ - #include - #include - --#define LTQ_ETOP_MDIO 0x11804 -+#define LTQ_ETOP_MDIO_ACC 0x11804 - #define MDIO_REQUEST 0x80000000 - #define MDIO_READ 0x40000000 - #define MDIO_ADDR_MASK 0x1f -@@ -51,44 +56,91 @@ - #define MDIO_REG_OFFSET 0x10 - #define MDIO_VAL_MASK 0xffff - --#define PPE32_CGEN 0x800 --#define LQ_PPE32_ENET_MAC_CFG 0x1840 -+#define LTQ_ETOP_MDIO_CFG 0x11800 -+#define MDIO_CFG_MASK 0x6 -+ -+#define LTQ_ETOP_CFG 0x11808 -+#define LTQ_ETOP_IGPLEN 0x11820 -+#define LTQ_ETOP_MAC_CFG 0x11840 - - #define LTQ_ETOP_ENETS0 0x11850 - #define LTQ_ETOP_MAC_DA0 0x1186C - #define LTQ_ETOP_MAC_DA1 0x11870 --#define LTQ_ETOP_CFG 0x16020 --#define LTQ_ETOP_IGPLEN 0x16080 -+ -+#define MAC_CFG_MASK 0xfff -+#define MAC_CFG_CGEN (1 << 11) -+#define MAC_CFG_DUPLEX (1 << 2) -+#define MAC_CFG_SPEED (1 << 1) -+#define MAC_CFG_LINK (1 << 0) - - #define MAX_DMA_CHAN 0x8 - #define MAX_DMA_CRC_LEN 0x4 - #define MAX_DMA_DATA_LEN 0x600 - - #define ETOP_FTCU BIT(28) --#define ETOP_MII_MASK 0xf --#define ETOP_MII_NORMAL 0xd --#define ETOP_MII_REVERSE 0xe - #define ETOP_PLEN_UNDER 0x40 --#define ETOP_CGEN 0x800 -+#define ETOP_CFG_MII0 0x01 - --/* use 2 static channels for TX/RX */ --#define LTQ_ETOP_TX_CHANNEL 1 --#define LTQ_ETOP_RX_CHANNEL 6 --#define IS_TX(x) (x == LTQ_ETOP_TX_CHANNEL) --#define IS_RX(x) (x == LTQ_ETOP_RX_CHANNEL) -+#define ETOP_CFG_MASK 0xfff -+#define ETOP_CFG_FEN0 (1 << 8) -+#define ETOP_CFG_SEN0 (1 << 6) -+#define ETOP_CFG_OFF1 (1 << 3) -+#define ETOP_CFG_REMII0 (1 << 1) -+#define ETOP_CFG_OFF0 (1 << 0) -+ -+#define LTQ_GBIT_MDIO_CTL 0xCC -+#define LTQ_GBIT_MDIO_DATA 0xd0 -+#define LTQ_GBIT_GCTL0 0x68 -+#define LTQ_GBIT_PMAC_HD_CTL 0x8c -+#define LTQ_GBIT_P0_CTL 0x4 -+#define LTQ_GBIT_PMAC_RX_IPG 0xa8 -+#define LTQ_GBIT_RGMII_CTL 0x78 -+ -+#define PMAC_HD_CTL_AS (1 << 19) -+#define PMAC_HD_CTL_RXSH (1 << 22) -+ -+/* Switch Enable (0=disable, 1=enable) */ -+#define GCTL0_SE 0x80000000 -+/* Disable MDIO auto polling (0=disable, 1=enable) */ -+#define PX_CTL_DMDIO 0x00400000 -+ -+/* MDC clock divider, clock = 25MHz/((MDC_CLOCK + 1) * 2) */ -+#define MDC_CLOCK_MASK 0xff000000 -+#define MDC_CLOCK_OFFSET 24 -+ -+/* register information for the gbit's MDIO bus */ -+#define MDIO_XR9_REQUEST 0x00008000 -+#define MDIO_XR9_READ 0x00000800 -+#define MDIO_XR9_WRITE 0x00000400 -+#define MDIO_XR9_REG_MASK 0x1f -+#define MDIO_XR9_ADDR_MASK 0x1f -+#define MDIO_XR9_RD_MASK 0xffff -+#define MDIO_XR9_REG_OFFSET 0 -+#define MDIO_XR9_ADDR_OFFSET 5 -+#define MDIO_XR9_WR_OFFSET 16 - -+#define LTQ_DMA_ETOP ((of_machine_is_compatible("lantiq,ase")) ? \ -+ (INT_NUM_IM3_IRL0) : (INT_NUM_IM2_IRL0)) -+ -+/* the newer xway socks have a embedded 3/7 port gbit multiplexer */ - #define ltq_etop_r32(x) ltq_r32(ltq_etop_membase + (x)) - #define ltq_etop_w32(x, y) ltq_w32(x, ltq_etop_membase + (y)) - #define ltq_etop_w32_mask(x, y, z) \ - ltq_w32_mask(x, y, ltq_etop_membase + (z)) - --#define DRV_VERSION "1.0" -+#define ltq_gbit_r32(x) ltq_r32(ltq_gbit_membase + (x)) -+#define ltq_gbit_w32(x, y) ltq_w32(x, ltq_gbit_membase + (y)) -+#define ltq_gbit_w32_mask(x, y, z) \ -+ ltq_w32_mask(x, y, ltq_gbit_membase + (z)) -+ -+#define DRV_VERSION "1.2" - - static void __iomem *ltq_etop_membase; -+static void __iomem *ltq_gbit_membase; - - struct ltq_etop_chan { -- int idx; - int tx_free; -+ int irq; - struct net_device *netdev; - struct napi_struct napi; - struct ltq_dma_channel dma; -@@ -98,21 +150,34 @@ struct ltq_etop_chan { - struct ltq_etop_priv { - struct net_device *netdev; - struct platform_device *pdev; -- struct ltq_eth_data *pldata; - struct resource *res; - - struct mii_bus *mii_bus; - -- struct ltq_etop_chan ch[MAX_DMA_CHAN]; -- int tx_free[MAX_DMA_CHAN >> 1]; -+ struct ltq_etop_chan txch; -+ struct ltq_etop_chan rxch; -+ -+ int tx_irq; -+ int rx_irq; -+ -+ unsigned char mac[6]; -+ int mii_mode; - - spinlock_t lock; -+ -+ struct clk *clk_ppe; -+ struct clk *clk_switch; -+ struct clk *clk_ephy; -+ struct clk *clk_ephycgu; - }; - -+static int ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, -+ int phy_reg, u16 phy_data); -+ - static int - ltq_etop_alloc_skb(struct ltq_etop_chan *ch) - { -- ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN); -+ ch->skb[ch->dma.desc] = dev_alloc_skb(MAX_DMA_DATA_LEN); - if (!ch->skb[ch->dma.desc]) - return -ENOMEM; - ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL, -@@ -147,8 +212,11 @@ ltq_etop_hw_receive(struct ltq_etop_chan - spin_unlock_irqrestore(&priv->lock, flags); - - skb_put(skb, len); -+ skb->dev = ch->netdev; - skb->protocol = eth_type_trans(skb, ch->netdev); - netif_receive_skb(skb); -+ ch->netdev->stats.rx_packets++; -+ ch->netdev->stats.rx_bytes += len; - } - - static int -@@ -156,7 +224,9 @@ ltq_etop_poll_rx(struct napi_struct *nap - { - struct ltq_etop_chan *ch = container_of(napi, - struct ltq_etop_chan, napi); -+ struct ltq_etop_priv *priv = netdev_priv(ch->netdev); - int work_done = 0; -+ unsigned long flags; - - while (work_done < budget) { - struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; -@@ -168,7 +238,9 @@ ltq_etop_poll_rx(struct napi_struct *nap - } - if (work_done < budget) { - napi_complete_done(&ch->napi, work_done); -+ spin_lock_irqsave(&priv->lock, flags); - ltq_dma_ack_irq(&ch->dma); -+ spin_unlock_irqrestore(&priv->lock, flags); - } - return work_done; - } -@@ -180,12 +252,14 @@ ltq_etop_poll_tx(struct napi_struct *nap - container_of(napi, struct ltq_etop_chan, napi); - struct ltq_etop_priv *priv = netdev_priv(ch->netdev); - struct netdev_queue *txq = -- netdev_get_tx_queue(ch->netdev, ch->idx >> 1); -+ netdev_get_tx_queue(ch->netdev, ch->dma.nr >> 1); - unsigned long flags; - - spin_lock_irqsave(&priv->lock, flags); - while ((ch->dma.desc_base[ch->tx_free].ctl & - (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { -+ ch->netdev->stats.tx_packets++; -+ ch->netdev->stats.tx_bytes += ch->skb[ch->tx_free]->len; - dev_kfree_skb_any(ch->skb[ch->tx_free]); - ch->skb[ch->tx_free] = NULL; - memset(&ch->dma.desc_base[ch->tx_free], 0, -@@ -198,7 +272,9 @@ ltq_etop_poll_tx(struct napi_struct *nap - if (netif_tx_queue_stopped(txq)) - netif_tx_start_queue(txq); - napi_complete(&ch->napi); -+ spin_lock_irqsave(&priv->lock, flags); - ltq_dma_ack_irq(&ch->dma); -+ spin_unlock_irqrestore(&priv->lock, flags); - return 1; - } - -@@ -206,9 +282,10 @@ static irqreturn_t - ltq_etop_dma_irq(int irq, void *_priv) - { - struct ltq_etop_priv *priv = _priv; -- int ch = irq - LTQ_DMA_CH0_INT; -- -- napi_schedule(&priv->ch[ch].napi); -+ if (irq == priv->txch.dma.irq) -+ napi_schedule(&priv->txch.napi); -+ else -+ napi_schedule(&priv->rxch.napi); - return IRQ_HANDLED; - } - -@@ -220,7 +297,7 @@ ltq_etop_free_channel(struct net_device - ltq_dma_free(&ch->dma); - if (ch->dma.irq) - free_irq(ch->dma.irq, priv); -- if (IS_RX(ch->idx)) { -+ if (ch == &priv->txch) { - int desc; - for (desc = 0; desc < LTQ_DESC_NUM; desc++) - dev_kfree_skb_any(ch->skb[ch->dma.desc]); -@@ -231,65 +308,133 @@ static void - ltq_etop_hw_exit(struct net_device *dev) - { - struct ltq_etop_priv *priv = netdev_priv(dev); -- int i; - -- ltq_pmu_disable(PMU_PPE); -- for (i = 0; i < MAX_DMA_CHAN; i++) -- if (IS_TX(i) || IS_RX(i)) -- ltq_etop_free_channel(dev, &priv->ch[i]); -+ clk_disable(priv->clk_ppe); -+ -+ if (of_machine_is_compatible("lantiq,ar9")) -+ clk_disable(priv->clk_switch); -+ -+ if (of_machine_is_compatible("lantiq,ase")) { -+ clk_disable(priv->clk_ephy); -+ clk_disable(priv->clk_ephycgu); -+ } -+ -+ ltq_etop_free_channel(dev, &priv->txch); -+ ltq_etop_free_channel(dev, &priv->rxch); -+} -+ -+static void -+ltq_etop_gbit_init(struct net_device *dev) -+{ -+ struct ltq_etop_priv *priv = netdev_priv(dev); -+ -+ clk_enable(priv->clk_switch); -+ -+ /* enable gbit port0 on the SoC */ -+ ltq_gbit_w32_mask((1 << 17), (1 << 18), LTQ_GBIT_P0_CTL); -+ -+ ltq_gbit_w32_mask(0, GCTL0_SE, LTQ_GBIT_GCTL0); -+ /* disable MDIO auto polling mode */ -+ ltq_gbit_w32_mask(0, PX_CTL_DMDIO, LTQ_GBIT_P0_CTL); -+ /* set 1522 packet size */ -+ ltq_gbit_w32_mask(0x300, 0, LTQ_GBIT_GCTL0); -+ /* disable pmac & dmac headers */ -+ ltq_gbit_w32_mask(PMAC_HD_CTL_AS | PMAC_HD_CTL_RXSH, 0, -+ LTQ_GBIT_PMAC_HD_CTL); -+ /* Due to traffic halt when burst length 8, -+ replace default IPG value with 0x3B */ -+ ltq_gbit_w32(0x3B, LTQ_GBIT_PMAC_RX_IPG); -+ /* set mdc clock to 2.5 MHz */ -+ ltq_gbit_w32_mask(MDC_CLOCK_MASK, 4 << MDC_CLOCK_OFFSET, -+ LTQ_GBIT_RGMII_CTL); - } - - static int - ltq_etop_hw_init(struct net_device *dev) - { - struct ltq_etop_priv *priv = netdev_priv(dev); -- int i; -+ int mii_mode = priv->mii_mode; -+ -+ clk_enable(priv->clk_ppe); - -- ltq_pmu_enable(PMU_PPE); -+ if (of_machine_is_compatible("lantiq,ar9")) { -+ ltq_etop_gbit_init(dev); -+ /* force the etops link to the gbit to MII */ -+ mii_mode = PHY_INTERFACE_MODE_MII; -+ } -+ ltq_etop_w32_mask(MDIO_CFG_MASK, 0, LTQ_ETOP_MDIO_CFG); -+ ltq_etop_w32_mask(MAC_CFG_MASK, MAC_CFG_CGEN | MAC_CFG_DUPLEX | -+ MAC_CFG_SPEED | MAC_CFG_LINK, LTQ_ETOP_MAC_CFG); - -- switch (priv->pldata->mii_mode) { -+ switch (mii_mode) { - case PHY_INTERFACE_MODE_RMII: -- ltq_etop_w32_mask(ETOP_MII_MASK, -- ETOP_MII_REVERSE, LTQ_ETOP_CFG); -+ ltq_etop_w32_mask(ETOP_CFG_MASK, ETOP_CFG_REMII0 | ETOP_CFG_OFF1 | -+ ETOP_CFG_SEN0 | ETOP_CFG_FEN0, LTQ_ETOP_CFG); - break; - - case PHY_INTERFACE_MODE_MII: -- ltq_etop_w32_mask(ETOP_MII_MASK, -- ETOP_MII_NORMAL, LTQ_ETOP_CFG); -+ ltq_etop_w32_mask(ETOP_CFG_MASK, ETOP_CFG_OFF1 | -+ ETOP_CFG_SEN0 | ETOP_CFG_FEN0, LTQ_ETOP_CFG); - break; - - default: -+ if (of_machine_is_compatible("lantiq,ase")) { -+ clk_enable(priv->clk_ephy); -+ /* disable external MII */ -+ ltq_etop_w32_mask(0, ETOP_CFG_MII0, LTQ_ETOP_CFG); -+ /* enable clock for internal PHY */ -+ clk_enable(priv->clk_ephycgu); -+ /* we need to write this magic to the internal phy to -+ make it work */ -+ ltq_etop_mdio_wr(NULL, 0x8, 0x12, 0xC020); -+ pr_info("Selected EPHY mode\n"); -+ break; -+ } - netdev_err(dev, "unknown mii mode %d\n", -- priv->pldata->mii_mode); -+ mii_mode); - return -ENOTSUPP; - } - -- /* enable crc generation */ -- ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG); -+ return 0; -+} -+ -+static int -+ltq_etop_dma_init(struct net_device *dev) -+{ -+ struct ltq_etop_priv *priv = netdev_priv(dev); -+ int tx = priv->tx_irq - LTQ_DMA_ETOP; -+ int rx = priv->rx_irq - LTQ_DMA_ETOP; -+ int err; - - ltq_dma_init_port(DMA_PORT_ETOP); - -- for (i = 0; i < MAX_DMA_CHAN; i++) { -- int irq = LTQ_DMA_CH0_INT + i; -- struct ltq_etop_chan *ch = &priv->ch[i]; -- -- ch->idx = ch->dma.nr = i; -- -- if (IS_TX(i)) { -- ltq_dma_alloc_tx(&ch->dma); -- request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); -- } else if (IS_RX(i)) { -- ltq_dma_alloc_rx(&ch->dma); -- for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; -- ch->dma.desc++) -- if (ltq_etop_alloc_skb(ch)) -- return -ENOMEM; -- ch->dma.desc = 0; -- request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); -+ priv->txch.dma.nr = tx; -+ ltq_dma_alloc_tx(&priv->txch.dma); -+ err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv); -+ if (err) { -+ netdev_err(dev, "failed to allocate tx irq\n"); -+ goto err_out; -+ } -+ priv->txch.dma.irq = priv->tx_irq; -+ -+ priv->rxch.dma.nr = rx; -+ ltq_dma_alloc_rx(&priv->rxch.dma); -+ for (priv->rxch.dma.desc = 0; priv->rxch.dma.desc < LTQ_DESC_NUM; -+ priv->rxch.dma.desc++) { -+ if (ltq_etop_alloc_skb(&priv->rxch)) { -+ netdev_err(dev, "failed to allocate skbs\n"); -+ err = -ENOMEM; -+ goto err_out; - } -- ch->dma.irq = irq; - } -- return 0; -+ priv->rxch.dma.desc = 0; -+ err = request_irq(priv->rx_irq, ltq_etop_dma_irq, 0, "eth_rx", priv); -+ if (err) -+ netdev_err(dev, "failed to allocate rx irq\n"); -+ else -+ priv->rxch.dma.irq = priv->rx_irq; -+err_out: -+ return err; - } - - static void -@@ -303,7 +448,10 @@ ltq_etop_get_drvinfo(struct net_device * - static int - ltq_etop_nway_reset(struct net_device *dev) - { -- return phy_start_aneg(dev->phydev); -+ if (dev->phydev) -+ return phy_start_aneg(dev->phydev); -+ else -+ return 0; - } - - static const struct ethtool_ops ltq_etop_ethtool_ops = { -@@ -314,6 +462,39 @@ static const struct ethtool_ops ltq_etop - }; - - static int -+ltq_etop_mdio_wr_xr9(struct mii_bus *bus, int phy_addr, -+ int phy_reg, u16 phy_data) -+{ -+ u32 val = MDIO_XR9_REQUEST | MDIO_XR9_WRITE | -+ (phy_data << MDIO_XR9_WR_OFFSET) | -+ ((phy_addr & MDIO_XR9_ADDR_MASK) << MDIO_XR9_ADDR_OFFSET) | -+ ((phy_reg & MDIO_XR9_REG_MASK) << MDIO_XR9_REG_OFFSET); -+ -+ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) -+ ; -+ ltq_gbit_w32(val, LTQ_GBIT_MDIO_CTL); -+ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) -+ ; -+ return 0; -+} -+ -+static int -+ltq_etop_mdio_rd_xr9(struct mii_bus *bus, int phy_addr, int phy_reg) -+{ -+ u32 val = MDIO_XR9_REQUEST | MDIO_XR9_READ | -+ ((phy_addr & MDIO_XR9_ADDR_MASK) << MDIO_XR9_ADDR_OFFSET) | -+ ((phy_reg & MDIO_XR9_REG_MASK) << MDIO_XR9_REG_OFFSET); -+ -+ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) -+ ; -+ ltq_gbit_w32(val, LTQ_GBIT_MDIO_CTL); -+ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) -+ ; -+ val = ltq_gbit_r32(LTQ_GBIT_MDIO_DATA) & MDIO_XR9_RD_MASK; -+ return val; -+} -+ -+static int - ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, int phy_reg, u16 phy_data) - { - u32 val = MDIO_REQUEST | -@@ -321,9 +502,9 @@ ltq_etop_mdio_wr(struct mii_bus *bus, in - ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET) | - phy_data; - -- while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST) -+ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_REQUEST) - ; -- ltq_etop_w32(val, LTQ_ETOP_MDIO); -+ ltq_etop_w32(val, LTQ_ETOP_MDIO_ACC); - return 0; - } - -@@ -334,12 +515,12 @@ ltq_etop_mdio_rd(struct mii_bus *bus, in - ((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) | - ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET); - -- while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST) -+ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_REQUEST) - ; -- ltq_etop_w32(val, LTQ_ETOP_MDIO); -- while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST) -+ ltq_etop_w32(val, LTQ_ETOP_MDIO_ACC); -+ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_REQUEST) - ; -- val = ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_VAL_MASK; -+ val = ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_VAL_MASK; - return val; - } - -@@ -354,8 +535,18 @@ ltq_etop_mdio_probe(struct net_device *d - { - struct ltq_etop_priv *priv = netdev_priv(dev); - struct phy_device *phydev; -+ u32 phy_supported = (SUPPORTED_10baseT_Half -+ | SUPPORTED_10baseT_Full -+ | SUPPORTED_100baseT_Half -+ | SUPPORTED_100baseT_Full -+ | SUPPORTED_Autoneg -+ | SUPPORTED_MII -+ | SUPPORTED_TP); - -- phydev = phy_find_first(priv->mii_bus); -+ if (of_machine_is_compatible("lantiq,ase")) -+ phydev = mdiobus_get_phy(priv->mii_bus, 8); -+ else -+ phydev = mdiobus_get_phy(priv->mii_bus, 0); - - if (!phydev) { - netdev_err(dev, "no PHY found\n"); -@@ -363,21 +554,18 @@ ltq_etop_mdio_probe(struct net_device *d - } - - phydev = phy_connect(dev, phydev_name(phydev), -- <q_etop_mdio_link, priv->pldata->mii_mode); -+ <q_etop_mdio_link, priv->mii_mode); - - if (IS_ERR(phydev)) { - netdev_err(dev, "Could not attach to PHY\n"); - return PTR_ERR(phydev); - } - -- phydev->supported &= (SUPPORTED_10baseT_Half -- | SUPPORTED_10baseT_Full -- | SUPPORTED_100baseT_Half -- | SUPPORTED_100baseT_Full -- | SUPPORTED_Autoneg -- | SUPPORTED_MII -- | SUPPORTED_TP); -+ if (of_machine_is_compatible("lantiq,ar9")) -+ phy_supported |= SUPPORTED_1000baseT_Half -+ | SUPPORTED_1000baseT_Full; - -+ phydev->supported &= phy_supported; - phydev->advertising = phydev->supported; - phy_attached_info(phydev); - -@@ -398,8 +586,13 @@ ltq_etop_mdio_init(struct net_device *de - } - - priv->mii_bus->priv = dev; -- priv->mii_bus->read = ltq_etop_mdio_rd; -- priv->mii_bus->write = ltq_etop_mdio_wr; -+ if (of_machine_is_compatible("lantiq,ar9")) { -+ priv->mii_bus->read = ltq_etop_mdio_rd_xr9; -+ priv->mii_bus->write = ltq_etop_mdio_wr_xr9; -+ } else { -+ priv->mii_bus->read = ltq_etop_mdio_rd; -+ priv->mii_bus->write = ltq_etop_mdio_wr; -+ } - priv->mii_bus->name = "ltq_mii"; - snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", - priv->pdev->name, priv->pdev->id); -@@ -436,17 +629,19 @@ static int - ltq_etop_open(struct net_device *dev) - { - struct ltq_etop_priv *priv = netdev_priv(dev); -- int i; -+ unsigned long flags; - -- for (i = 0; i < MAX_DMA_CHAN; i++) { -- struct ltq_etop_chan *ch = &priv->ch[i]; -+ napi_enable(&priv->txch.napi); -+ napi_enable(&priv->rxch.napi); -+ -+ spin_lock_irqsave(&priv->lock, flags); -+ ltq_dma_open(&priv->txch.dma); -+ ltq_dma_open(&priv->rxch.dma); -+ spin_unlock_irqrestore(&priv->lock, flags); -+ -+ if (dev->phydev) -+ phy_start(dev->phydev); - -- if (!IS_TX(i) && (!IS_RX(i))) -- continue; -- ltq_dma_open(&ch->dma); -- napi_enable(&ch->napi); -- } -- phy_start(dev->phydev); - netif_tx_start_all_queues(dev); - return 0; - } -@@ -455,18 +650,19 @@ static int - ltq_etop_stop(struct net_device *dev) - { - struct ltq_etop_priv *priv = netdev_priv(dev); -- int i; -+ unsigned long flags; - - netif_tx_stop_all_queues(dev); -- phy_stop(dev->phydev); -- for (i = 0; i < MAX_DMA_CHAN; i++) { -- struct ltq_etop_chan *ch = &priv->ch[i]; -- -- if (!IS_RX(i) && !IS_TX(i)) -- continue; -- napi_disable(&ch->napi); -- ltq_dma_close(&ch->dma); -- } -+ if (dev->phydev) -+ phy_stop(dev->phydev); -+ napi_disable(&priv->txch.napi); -+ napi_disable(&priv->rxch.napi); -+ -+ spin_lock_irqsave(&priv->lock, flags); -+ ltq_dma_close(&priv->txch.dma); -+ ltq_dma_close(&priv->rxch.dma); -+ spin_unlock_irqrestore(&priv->lock, flags); -+ - return 0; - } - -@@ -476,16 +672,16 @@ ltq_etop_tx(struct sk_buff *skb, struct - int queue = skb_get_queue_mapping(skb); - struct netdev_queue *txq = netdev_get_tx_queue(dev, queue); - struct ltq_etop_priv *priv = netdev_priv(dev); -- struct ltq_etop_chan *ch = &priv->ch[(queue << 1) | 1]; -- struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; -- int len; -+ struct ltq_dma_desc *desc = -+ &priv->txch.dma.desc_base[priv->txch.dma.desc]; - unsigned long flags; - u32 byte_offset; -+ int len; - - len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; - -- if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { -- dev_kfree_skb_any(skb); -+ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || -+ priv->txch.skb[priv->txch.dma.desc]) { - netdev_err(dev, "tx ring full\n"); - netif_tx_stop_queue(txq); - return NETDEV_TX_BUSY; -@@ -493,7 +689,7 @@ ltq_etop_tx(struct sk_buff *skb, struct - - /* dma needs to start on a 16 byte aligned address */ - byte_offset = CPHYSADDR(skb->data) % 16; -- ch->skb[ch->dma.desc] = skb; -+ priv->txch.skb[priv->txch.dma.desc] = skb; - - netif_trans_update(dev); - -@@ -503,11 +699,11 @@ ltq_etop_tx(struct sk_buff *skb, struct - wmb(); - desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | - LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK); -- ch->dma.desc++; -- ch->dma.desc %= LTQ_DESC_NUM; -+ priv->txch.dma.desc++; -+ priv->txch.dma.desc %= LTQ_DESC_NUM; - spin_unlock_irqrestore(&priv->lock, flags); - -- if (ch->dma.desc_base[ch->dma.desc].ctl & LTQ_DMA_OWN) -+ if (priv->txch.dma.desc_base[priv->txch.dma.desc].ctl & LTQ_DMA_OWN) - netif_tx_stop_queue(txq); - - return NETDEV_TX_OK; -@@ -522,8 +718,10 @@ ltq_etop_change_mtu(struct net_device *d - struct ltq_etop_priv *priv = netdev_priv(dev); - unsigned long flags; - -+ int max = ETH_HLEN + VLAN_HLEN + new_mtu + ETH_FCS_LEN; -+ - spin_lock_irqsave(&priv->lock, flags); -- ltq_etop_w32((ETOP_PLEN_UNDER << 16) | new_mtu, -+ ltq_etop_w32((ETOP_PLEN_UNDER << 16) | max, - LTQ_ETOP_IGPLEN); - spin_unlock_irqrestore(&priv->lock, flags); - } -@@ -592,6 +790,9 @@ ltq_etop_init(struct net_device *dev) - if (err) - goto err_hw; - ltq_etop_change_mtu(dev, 1500); -+ err = ltq_etop_dma_init(dev); -+ if (err) -+ goto err_hw; - - memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr)); - if (!is_valid_ether_addr(mac.sa_data)) { -@@ -609,9 +810,10 @@ ltq_etop_init(struct net_device *dev) - dev->addr_assign_type = NET_ADDR_RANDOM; - - ltq_etop_set_multicast_list(dev); -- err = ltq_etop_mdio_init(dev); -- if (err) -- goto err_netdev; -+ if (!ltq_etop_mdio_init(dev)) -+ dev->ethtool_ops = <q_etop_ethtool_ops; -+ else -+ pr_warn("etop: mdio probe failed\n");; - return 0; - - err_netdev: -@@ -631,6 +833,9 @@ ltq_etop_tx_timeout(struct net_device *d - err = ltq_etop_hw_init(dev); - if (err) - goto err_hw; -+ err = ltq_etop_dma_init(dev); -+ if (err) -+ goto err_hw; - netif_trans_update(dev); - netif_wake_queue(dev); - return; -@@ -654,14 +859,19 @@ static const struct net_device_ops ltq_e - .ndo_tx_timeout = ltq_etop_tx_timeout, - }; - --static int __init --ltq_etop_probe(struct platform_device *pdev) -+static int ltq_etop_probe(struct platform_device *pdev) - { - struct net_device *dev; - struct ltq_etop_priv *priv; -- struct resource *res; -+ struct resource *res, *gbit_res, irqres[2]; -+ const u8 *mac; - int err; -- int i; -+ -+ err = of_irq_to_resource_table(pdev->dev.of_node, irqres, 2); -+ if (err != 2) { -+ dev_err(&pdev->dev, "failed to get etop irqs\n"); -+ return -EINVAL; -+ } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { -@@ -687,31 +897,62 @@ ltq_etop_probe(struct platform_device *p - goto err_out; - } - -- dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4); -- if (!dev) { -- err = -ENOMEM; -- goto err_out; -+ if (of_machine_is_compatible("lantiq,ar9")) { -+ gbit_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ if (!gbit_res) { -+ dev_err(&pdev->dev, "failed to get gbit resource\n"); -+ err = -ENOENT; -+ goto err_out; -+ } -+ ltq_gbit_membase = devm_ioremap_nocache(&pdev->dev, -+ gbit_res->start, resource_size(gbit_res)); -+ if (!ltq_gbit_membase) { -+ dev_err(&pdev->dev, "failed to remap gigabit switch %d\n", -+ pdev->id); -+ err = -ENOMEM; -+ goto err_out; -+ } - } -+ -+ dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4); - strcpy(dev->name, "eth%d"); - dev->netdev_ops = <q_eth_netdev_ops; -- dev->ethtool_ops = <q_etop_ethtool_ops; - priv = netdev_priv(dev); - priv->res = res; - priv->pdev = pdev; -- priv->pldata = dev_get_platdata(&pdev->dev); - priv->netdev = dev; -+ priv->tx_irq = irqres[0].start; -+ priv->rx_irq = irqres[1].start; -+ priv->mii_mode = of_get_phy_mode(pdev->dev.of_node); -+ -+ mac = of_get_mac_address(pdev->dev.of_node); -+ if (mac) -+ memcpy(priv->mac, mac, ETH_ALEN); -+ -+ priv->clk_ppe = clk_get(&pdev->dev, NULL); -+ if (IS_ERR(priv->clk_ppe)) -+ return PTR_ERR(priv->clk_ppe); -+ if (of_machine_is_compatible("lantiq,ar9")) { -+ priv->clk_switch = clk_get(&pdev->dev, "switch"); -+ if (IS_ERR(priv->clk_switch)) -+ return PTR_ERR(priv->clk_switch); -+ } -+ if (of_machine_is_compatible("lantiq,ase")) { -+ priv->clk_ephy = clk_get(&pdev->dev, "ephy"); -+ if (IS_ERR(priv->clk_ephy)) -+ return PTR_ERR(priv->clk_ephy); -+ priv->clk_ephycgu = clk_get(&pdev->dev, "ephycgu"); -+ if (IS_ERR(priv->clk_ephycgu)) -+ return PTR_ERR(priv->clk_ephycgu); -+ } -+ - spin_lock_init(&priv->lock); - SET_NETDEV_DEV(dev, &pdev->dev); - -- for (i = 0; i < MAX_DMA_CHAN; i++) { -- if (IS_TX(i)) -- netif_napi_add(dev, &priv->ch[i].napi, -- ltq_etop_poll_tx, 8); -- else if (IS_RX(i)) -- netif_napi_add(dev, &priv->ch[i].napi, -- ltq_etop_poll_rx, 32); -- priv->ch[i].netdev = dev; -- } -+ netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8); -+ netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32); -+ priv->txch.netdev = dev; -+ priv->rxch.netdev = dev; - - err = register_netdev(dev); - if (err) -@@ -740,31 +981,22 @@ ltq_etop_remove(struct platform_device * - return 0; - } - -+static const struct of_device_id ltq_etop_match[] = { -+ { .compatible = "lantiq,etop-xway" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ltq_etop_match); -+ - static struct platform_driver ltq_mii_driver = { -+ .probe = ltq_etop_probe, - .remove = ltq_etop_remove, - .driver = { - .name = "ltq_etop", -+ .of_match_table = ltq_etop_match, - }, - }; - --int __init --init_ltq_etop(void) --{ -- int ret = platform_driver_probe(<q_mii_driver, ltq_etop_probe); -- -- if (ret) -- pr_err("ltq_etop: Error registering platform driver!"); -- return ret; --} -- --static void __exit --exit_ltq_etop(void) --{ -- platform_driver_unregister(<q_mii_driver); --} -- --module_init(init_ltq_etop); --module_exit(exit_ltq_etop); -+module_platform_driver(ltq_mii_driver); - - MODULE_AUTHOR("John Crispin "); - MODULE_DESCRIPTION("Lantiq SoC ETOP"); diff --git a/target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch b/target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch deleted file mode 100644 index e2a421b27..000000000 --- a/target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch +++ /dev/null @@ -1,170 +0,0 @@ -From cc809a441d8f2924f785eb863dfa6aef47a25b0b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 12 Aug 2014 20:49:27 +0200 -Subject: [PATCH 30/36] GPIO: add named gpio exports - -Signed-off-by: John Crispin ---- - drivers/gpio/gpiolib-of.c | 68 +++++++++++++++++++++++++++++++++++++++++ - drivers/gpio/gpiolib.c | 11 +++++-- - include/asm-generic/gpio.h | 5 +++ - include/linux/gpio/consumer.h | 8 +++++ - 4 files changed, 90 insertions(+), 2 deletions(-) - ---- a/drivers/gpio/gpiolib-of.c -+++ b/drivers/gpio/gpiolib-of.c -@@ -23,6 +23,8 @@ - #include - #include - #include -+#include -+#include - - #include "gpiolib.h" - -@@ -538,3 +540,73 @@ void of_gpiochip_remove(struct gpio_chip - gpiochip_remove_pin_ranges(chip); - of_node_put(chip->of_node); - } -+ -+#ifdef CONFIG_GPIO_SYSFS -+ -+static struct of_device_id gpio_export_ids[] = { -+ { .compatible = "gpio-export" }, -+ { /* sentinel */ } -+}; -+ -+static int __init of_gpio_export_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ struct device_node *cnp; -+ u32 val; -+ int nb = 0; -+ -+ for_each_child_of_node(np, cnp) { -+ const char *name = NULL; -+ int gpio; -+ bool dmc; -+ int max_gpio = 1; -+ int i; -+ -+ of_property_read_string(cnp, "gpio-export,name", &name); -+ -+ if (!name) -+ max_gpio = of_gpio_count(cnp); -+ -+ for (i = 0; i < max_gpio; i++) { -+ unsigned flags = 0; -+ enum of_gpio_flags of_flags; -+ -+ gpio = of_get_gpio_flags(cnp, i, &of_flags); -+ -+ if (of_flags == OF_GPIO_ACTIVE_LOW) -+ flags |= GPIOF_ACTIVE_LOW; -+ -+ if (!of_property_read_u32(cnp, "gpio-export,output", &val)) -+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; -+ else -+ flags |= GPIOF_IN; -+ -+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np))) -+ continue; -+ -+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); -+ gpio_export_with_name(gpio, dmc, name); -+ nb++; -+ } -+ } -+ -+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb); -+ -+ return 0; -+} -+ -+static struct platform_driver gpio_export_driver = { -+ .driver = { -+ .name = "gpio-export", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(gpio_export_ids), -+ }, -+}; -+ -+static int __init of_gpio_export_init(void) -+{ -+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe); -+} -+device_initcall(of_gpio_export_init); -+ -+#endif ---- a/include/asm-generic/gpio.h -+++ b/include/asm-generic/gpio.h -@@ -126,6 +126,12 @@ static inline int gpio_export(unsigned g - return gpiod_export(gpio_to_desc(gpio), direction_may_change); - } - -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); -+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name) -+{ -+ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name); -+} -+ - static inline int gpio_export_link(struct device *dev, const char *name, - unsigned gpio) - { ---- a/include/linux/gpio/consumer.h -+++ b/include/linux/gpio/consumer.h -@@ -427,6 +427,7 @@ static inline struct gpio_desc *devm_get - - #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) - -+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); - int gpiod_export(struct gpio_desc *desc, bool direction_may_change); - int gpiod_export_link(struct device *dev, const char *name, - struct gpio_desc *desc); -@@ -434,6 +435,13 @@ void gpiod_unexport(struct gpio_desc *de - - #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ - -+static inline int _gpiod_export(struct gpio_desc *desc, -+ bool direction_may_change, -+ const char *name) -+{ -+ return -ENOSYS; -+} -+ - static inline int gpiod_export(struct gpio_desc *desc, - bool direction_may_change) - { ---- a/drivers/gpio/gpiolib-sysfs.c -+++ b/drivers/gpio/gpiolib-sysfs.c -@@ -544,7 +544,7 @@ static struct class gpio_class = { - * - * Returns zero on success, else an error. - */ --int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) - { - struct gpio_chip *chip; - struct gpio_device *gdev; -@@ -606,6 +606,8 @@ int gpiod_export(struct gpio_desc *desc, - offset = gpio_chip_hwgpio(desc); - if (chip->names && chip->names[offset]) - ioname = chip->names[offset]; -+ if (name) -+ ioname = name; - - dev = device_create_with_groups(&gpio_class, &gdev->dev, - MKDEV(0, 0), data, gpio_groups, -@@ -627,6 +629,12 @@ err_unlock: - gpiod_dbg(desc, "%s: status %d\n", __func__, status); - return status; - } -+EXPORT_SYMBOL_GPL(__gpiod_export); -+ -+int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+{ -+ return __gpiod_export(desc, direction_may_change, NULL); -+} - EXPORT_SYMBOL_GPL(gpiod_export); - - static int match_export(struct device *dev, const void *desc) diff --git a/target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch deleted file mode 100644 index c275b55ef..000000000 --- a/target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch +++ /dev/null @@ -1,1034 +0,0 @@ -From f17e50f67fa3c77624edf2ca03fae0d50f0ce39b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 7 Aug 2014 18:26:42 +0200 -Subject: [PATCH 31/36] I2C: MIPS: lantiq: add FALC-ON i2c bus master - -This patch adds the driver needed to make the I2C bus work on FALC-ON SoCs. - -Signed-off-by: Thomas Langer -Signed-off-by: John Crispin ---- - drivers/i2c/busses/Kconfig | 10 + - drivers/i2c/busses/Makefile | 1 + - drivers/i2c/busses/i2c-lantiq.c | 747 +++++++++++++++++++++++++++++++++++++++ - drivers/i2c/busses/i2c-lantiq.h | 234 ++++++++++++ - 4 files changed, 992 insertions(+) - create mode 100644 drivers/i2c/busses/i2c-lantiq.c - create mode 100644 drivers/i2c/busses/i2c-lantiq.h - ---- a/drivers/i2c/busses/Kconfig -+++ b/drivers/i2c/busses/Kconfig -@@ -643,6 +643,16 @@ config I2C_MESON - If you say yes to this option, support will be included for the - I2C interface on the Amlogic Meson family of SoCs. - -+config I2C_LANTIQ -+ tristate "Lantiq I2C interface" -+ depends on LANTIQ && SOC_FALCON -+ help -+ If you say yes to this option, support will be included for the -+ Lantiq I2C core. -+ -+ This driver can also be built as a module. If so, the module -+ will be called i2c-lantiq. -+ - config I2C_MPC - tristate "MPC107/824x/85xx/512x/52xx/83xx/86xx" - depends on PPC ---- a/drivers/i2c/busses/Makefile -+++ b/drivers/i2c/busses/Makefile -@@ -59,6 +59,7 @@ obj-$(CONFIG_I2C_IMX) += i2c-imx.o - obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o - obj-$(CONFIG_I2C_JZ4780) += i2c-jz4780.o - obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o -+obj-$(CONFIG_I2C_LANTIQ) += i2c-lantiq.o - obj-$(CONFIG_I2C_LPC2K) += i2c-lpc2k.o - obj-$(CONFIG_I2C_MESON) += i2c-meson.o - obj-$(CONFIG_I2C_MPC) += i2c-mpc.o ---- /dev/null -+++ b/drivers/i2c/busses/i2c-lantiq.c -@@ -0,0 +1,747 @@ -+ -+/* -+ * Lantiq I2C bus adapter -+ * -+ * Parts based on i2c-designware.c and other i2c drivers from Linux 2.6.33 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ * -+ * Copyright (C) 2012 Thomas Langer -+ */ -+ -+#include -+#include -+#include -+#include /* for kzalloc, kfree */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include "i2c-lantiq.h" -+ -+/* -+ * CURRENT ISSUES: -+ * - no high speed support -+ * - ten bit mode is not tested (no slave devices) -+ */ -+ -+/* access macros */ -+#define i2c_r32(reg) \ -+ __raw_readl(&(priv->membase)->reg) -+#define i2c_w32(val, reg) \ -+ __raw_writel(val, &(priv->membase)->reg) -+#define i2c_w32_mask(clear, set, reg) \ -+ i2c_w32((i2c_r32(reg) & ~(clear)) | (set), reg) -+ -+#define DRV_NAME "i2c-lantiq" -+#define DRV_VERSION "1.00" -+ -+#define LTQ_I2C_BUSY_TIMEOUT 20 /* ms */ -+ -+#ifdef DEBUG -+#define LTQ_I2C_XFER_TIMEOUT (25*HZ) -+#else -+#define LTQ_I2C_XFER_TIMEOUT HZ -+#endif -+ -+#define LTQ_I2C_IMSC_DEFAULT_MASK (I2C_IMSC_I2C_P_INT_EN | \ -+ I2C_IMSC_I2C_ERR_INT_EN) -+ -+#define LTQ_I2C_ARB_LOST (1 << 0) -+#define LTQ_I2C_NACK (1 << 1) -+#define LTQ_I2C_RX_UFL (1 << 2) -+#define LTQ_I2C_RX_OFL (1 << 3) -+#define LTQ_I2C_TX_UFL (1 << 4) -+#define LTQ_I2C_TX_OFL (1 << 5) -+ -+struct ltq_i2c { -+ struct mutex mutex; -+ -+ -+ /* active clock settings */ -+ unsigned int input_clock; /* clock input for i2c hardware block */ -+ unsigned int i2c_clock; /* approximated bus clock in kHz */ -+ -+ struct clk *clk_gate; -+ struct clk *clk_input; -+ -+ -+ /* resources (memory and interrupts) */ -+ int irq_lb; /* last burst irq */ -+ -+ struct lantiq_reg_i2c __iomem *membase; /* base of mapped registers */ -+ -+ struct i2c_adapter adap; -+ struct device *dev; -+ -+ struct completion cmd_complete; -+ -+ -+ /* message transfer data */ -+ struct i2c_msg *current_msg; /* current message */ -+ int msgs_num; /* number of messages to handle */ -+ u8 *msg_buf; /* current buffer */ -+ u32 msg_buf_len; /* remaining length of current buffer */ -+ int msg_err; /* error status of the current transfer */ -+ -+ -+ /* master status codes */ -+ enum { -+ STATUS_IDLE, -+ STATUS_ADDR, /* address phase */ -+ STATUS_WRITE, -+ STATUS_READ, -+ STATUS_READ_END, -+ STATUS_STOP -+ } status; -+}; -+ -+static irqreturn_t ltq_i2c_isr(int irq, void *dev_id); -+ -+static inline void enable_burst_irq(struct ltq_i2c *priv) -+{ -+ i2c_w32_mask(0, I2C_IMSC_LBREQ_INT_EN | I2C_IMSC_BREQ_INT_EN, imsc); -+} -+static inline void disable_burst_irq(struct ltq_i2c *priv) -+{ -+ i2c_w32_mask(I2C_IMSC_LBREQ_INT_EN | I2C_IMSC_BREQ_INT_EN, 0, imsc); -+} -+ -+static void prepare_msg_send_addr(struct ltq_i2c *priv) -+{ -+ struct i2c_msg *msg = priv->current_msg; -+ int rd = !!(msg->flags & I2C_M_RD); /* extends to 0 or 1 */ -+ u16 addr = msg->addr; -+ -+ /* new i2c_msg */ -+ priv->msg_buf = msg->buf; -+ priv->msg_buf_len = msg->len; -+ if (rd) -+ priv->status = STATUS_READ; -+ else -+ priv->status = STATUS_WRITE; -+ -+ /* send slave address */ -+ if (msg->flags & I2C_M_TEN) { -+ i2c_w32(0xf0 | ((addr & 0x300) >> 7) | rd, txd); -+ i2c_w32(addr & 0xff, txd); -+ } else { -+ i2c_w32((addr & 0x7f) << 1 | rd, txd); -+ } -+} -+ -+static void ltq_i2c_set_tx_len(struct ltq_i2c *priv) -+{ -+ struct i2c_msg *msg = priv->current_msg; -+ int len = (msg->flags & I2C_M_TEN) ? 2 : 1; -+ -+ pr_debug("set_tx_len %cX\n", (msg->flags & I2C_M_RD) ? 'R' : 'T'); -+ -+ priv->status = STATUS_ADDR; -+ -+ if (!(msg->flags & I2C_M_RD)) -+ len += msg->len; -+ else -+ /* set maximum received packet size (before rx int!) */ -+ i2c_w32(msg->len, mrps_ctrl); -+ i2c_w32(len, tps_ctrl); -+ enable_burst_irq(priv); -+} -+ -+static int ltq_i2c_hw_set_clock(struct i2c_adapter *adap) -+{ -+ struct ltq_i2c *priv = i2c_get_adapdata(adap); -+ unsigned int input_clock = clk_get_rate(priv->clk_input); -+ u32 dec, inc = 1; -+ -+ /* clock changed? */ -+ if (priv->input_clock == input_clock) -+ return 0; -+ -+ /* -+ * this formula is only an approximation, found by the recommended -+ * values in the "I2C Architecture Specification 1.7.1" -+ */ -+ dec = input_clock / (priv->i2c_clock * 2); -+ if (dec <= 6) -+ return -ENXIO; -+ -+ i2c_w32(0, fdiv_high_cfg); -+ i2c_w32((inc << I2C_FDIV_CFG_INC_OFFSET) | -+ (dec << I2C_FDIV_CFG_DEC_OFFSET), -+ fdiv_cfg); -+ -+ dev_info(priv->dev, "setup clocks (in %d kHz, bus %d kHz, dec=%d)\n", -+ input_clock, priv->i2c_clock, dec); -+ -+ priv->input_clock = input_clock; -+ return 0; -+} -+ -+static int ltq_i2c_hw_init(struct i2c_adapter *adap) -+{ -+ int ret = 0; -+ struct ltq_i2c *priv = i2c_get_adapdata(adap); -+ -+ /* disable bus */ -+ i2c_w32_mask(I2C_RUN_CTRL_RUN_EN, 0, run_ctrl); -+ -+#ifndef DEBUG -+ /* set normal operation clock divider */ -+ i2c_w32(1 << I2C_CLC_RMC_OFFSET, clc); -+#else -+ /* for debugging a higher divider value! */ -+ i2c_w32(0xF0 << I2C_CLC_RMC_OFFSET, clc); -+#endif -+ -+ /* setup clock */ -+ ret = ltq_i2c_hw_set_clock(adap); -+ if (ret != 0) { -+ dev_warn(priv->dev, "invalid clock settings\n"); -+ return ret; -+ } -+ -+ /* configure fifo */ -+ i2c_w32(I2C_FIFO_CFG_TXFC | /* tx fifo as flow controller */ -+ I2C_FIFO_CFG_RXFC | /* rx fifo as flow controller */ -+ I2C_FIFO_CFG_TXFA_TXFA2 | /* tx fifo 4-byte aligned */ -+ I2C_FIFO_CFG_RXFA_RXFA2 | /* rx fifo 4-byte aligned */ -+ I2C_FIFO_CFG_TXBS_TXBS0 | /* tx fifo burst size is 1 word */ -+ I2C_FIFO_CFG_RXBS_RXBS0, /* rx fifo burst size is 1 word */ -+ fifo_cfg); -+ -+ /* configure address */ -+ i2c_w32(I2C_ADDR_CFG_SOPE_EN | /* generate stop when no more data in -+ the fifo */ -+ I2C_ADDR_CFG_SONA_EN | /* generate stop when NA received */ -+ I2C_ADDR_CFG_MnS_EN | /* we are master device */ -+ 0, /* our slave address (not used!) */ -+ addr_cfg); -+ -+ /* enable bus */ -+ i2c_w32_mask(0, I2C_RUN_CTRL_RUN_EN, run_ctrl); -+ -+ return 0; -+} -+ -+static int ltq_i2c_wait_bus_not_busy(struct ltq_i2c *priv) -+{ -+ unsigned long timeout; -+ -+ timeout = jiffies + msecs_to_jiffies(LTQ_I2C_BUSY_TIMEOUT); -+ -+ do { -+ u32 stat = i2c_r32(bus_stat); -+ -+ if ((stat & I2C_BUS_STAT_BS_MASK) == I2C_BUS_STAT_BS_FREE) -+ return 0; -+ -+ cond_resched(); -+ } while (!time_after_eq(jiffies, timeout)); -+ -+ dev_err(priv->dev, "timeout waiting for bus ready\n"); -+ return -ETIMEDOUT; -+} -+ -+static void ltq_i2c_tx(struct ltq_i2c *priv, int last) -+{ -+ if (priv->msg_buf_len && priv->msg_buf) { -+ i2c_w32(*priv->msg_buf, txd); -+ -+ if (--priv->msg_buf_len) -+ priv->msg_buf++; -+ else -+ priv->msg_buf = NULL; -+ } else { -+ last = 1; -+ } -+ -+ if (last) -+ disable_burst_irq(priv); -+} -+ -+static void ltq_i2c_rx(struct ltq_i2c *priv, int last) -+{ -+ u32 fifo_stat, timeout; -+ if (priv->msg_buf_len && priv->msg_buf) { -+ timeout = 5000000; -+ do { -+ fifo_stat = i2c_r32(ffs_stat); -+ } while (!fifo_stat && --timeout); -+ if (!timeout) { -+ last = 1; -+ pr_debug("\nrx timeout\n"); -+ goto err; -+ } -+ while (fifo_stat) { -+ *priv->msg_buf = i2c_r32(rxd); -+ if (--priv->msg_buf_len) { -+ priv->msg_buf++; -+ } else { -+ priv->msg_buf = NULL; -+ last = 1; -+ break; -+ } -+ /* -+ * do not read more than burst size, otherwise no "last -+ * burst" is generated and the transaction is blocked! -+ */ -+ fifo_stat = 0; -+ } -+ } else { -+ last = 1; -+ } -+err: -+ if (last) { -+ disable_burst_irq(priv); -+ -+ if (priv->status == STATUS_READ_END) { -+ /* -+ * do the STATUS_STOP and complete() here, as sometimes -+ * the tx_end is already seen before this is finished -+ */ -+ priv->status = STATUS_STOP; -+ complete(&priv->cmd_complete); -+ } else { -+ i2c_w32(I2C_ENDD_CTRL_SETEND, endd_ctrl); -+ priv->status = STATUS_READ_END; -+ } -+ } -+} -+ -+static void ltq_i2c_xfer_init(struct ltq_i2c *priv) -+{ -+ /* enable interrupts */ -+ i2c_w32(LTQ_I2C_IMSC_DEFAULT_MASK, imsc); -+ -+ /* trigger transfer of first msg */ -+ ltq_i2c_set_tx_len(priv); -+} -+ -+static void dump_msgs(struct i2c_msg msgs[], int num, int rx) -+{ -+#if defined(DEBUG) -+ int i, j; -+ pr_debug("Messages %d %s\n", num, rx ? "out" : "in"); -+ for (i = 0; i < num; i++) { -+ pr_debug("%2d %cX Msg(%d) addr=0x%X: ", i, -+ (msgs[i].flags & I2C_M_RD) ? 'R' : 'T', -+ msgs[i].len, msgs[i].addr); -+ if (!(msgs[i].flags & I2C_M_RD) || rx) { -+ for (j = 0; j < msgs[i].len; j++) -+ pr_debug("%02X ", msgs[i].buf[j]); -+ } -+ pr_debug("\n"); -+ } -+#endif -+} -+ -+static void ltq_i2c_release_bus(struct ltq_i2c *priv) -+{ -+ if ((i2c_r32(bus_stat) & I2C_BUS_STAT_BS_MASK) == I2C_BUS_STAT_BS_BM) -+ i2c_w32(I2C_ENDD_CTRL_SETEND, endd_ctrl); -+} -+ -+static int ltq_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], -+ int num) -+{ -+ struct ltq_i2c *priv = i2c_get_adapdata(adap); -+ int ret; -+ -+ dev_dbg(priv->dev, "xfer %u messages\n", num); -+ dump_msgs(msgs, num, 0); -+ -+ mutex_lock(&priv->mutex); -+ -+ init_completion(&priv->cmd_complete); -+ priv->current_msg = msgs; -+ priv->msgs_num = num; -+ priv->msg_err = 0; -+ priv->status = STATUS_IDLE; -+ -+ /* wait for the bus to become ready */ -+ ret = ltq_i2c_wait_bus_not_busy(priv); -+ if (ret) -+ goto done; -+ -+ while (priv->msgs_num) { -+ /* start the transfers */ -+ ltq_i2c_xfer_init(priv); -+ -+ /* wait for transfers to complete */ -+ ret = wait_for_completion_interruptible_timeout( -+ &priv->cmd_complete, LTQ_I2C_XFER_TIMEOUT); -+ if (ret == 0) { -+ dev_err(priv->dev, "controller timed out\n"); -+ ltq_i2c_hw_init(adap); -+ ret = -ETIMEDOUT; -+ goto done; -+ } else if (ret < 0) -+ goto done; -+ -+ if (priv->msg_err) { -+ if (priv->msg_err & LTQ_I2C_NACK) -+ ret = -ENXIO; -+ else -+ ret = -EREMOTEIO; -+ goto done; -+ } -+ if (--priv->msgs_num) -+ priv->current_msg++; -+ } -+ /* no error? */ -+ ret = num; -+ -+done: -+ ltq_i2c_release_bus(priv); -+ -+ mutex_unlock(&priv->mutex); -+ -+ if (ret >= 0) -+ dump_msgs(msgs, num, 1); -+ -+ pr_debug("XFER ret %d\n", ret); -+ return ret; -+} -+ -+static irqreturn_t ltq_i2c_isr_burst(int irq, void *dev_id) -+{ -+ struct ltq_i2c *priv = dev_id; -+ struct i2c_msg *msg = priv->current_msg; -+ int last = (irq == priv->irq_lb); -+ -+ if (last) -+ pr_debug("LB "); -+ else -+ pr_debug("B "); -+ -+ if (msg->flags & I2C_M_RD) { -+ switch (priv->status) { -+ case STATUS_ADDR: -+ pr_debug("X"); -+ prepare_msg_send_addr(priv); -+ disable_burst_irq(priv); -+ break; -+ case STATUS_READ: -+ case STATUS_READ_END: -+ pr_debug("R"); -+ ltq_i2c_rx(priv, last); -+ break; -+ default: -+ disable_burst_irq(priv); -+ pr_warn("Status R %d\n", priv->status); -+ break; -+ } -+ } else { -+ switch (priv->status) { -+ case STATUS_ADDR: -+ pr_debug("x"); -+ prepare_msg_send_addr(priv); -+ break; -+ case STATUS_WRITE: -+ pr_debug("w"); -+ ltq_i2c_tx(priv, last); -+ break; -+ default: -+ disable_burst_irq(priv); -+ pr_warn("Status W %d\n", priv->status); -+ break; -+ } -+ } -+ -+ i2c_w32(I2C_ICR_BREQ_INT_CLR | I2C_ICR_LBREQ_INT_CLR, icr); -+ return IRQ_HANDLED; -+} -+ -+static void ltq_i2c_isr_prot(struct ltq_i2c *priv) -+{ -+ u32 i_pro = i2c_r32(p_irqss); -+ -+ pr_debug("i2c-p"); -+ -+ /* not acknowledge */ -+ if (i_pro & I2C_P_IRQSS_NACK) { -+ priv->msg_err |= LTQ_I2C_NACK; -+ pr_debug(" nack"); -+ } -+ -+ /* arbitration lost */ -+ if (i_pro & I2C_P_IRQSS_AL) { -+ priv->msg_err |= LTQ_I2C_ARB_LOST; -+ pr_debug(" arb-lost"); -+ } -+ /* tx -> rx switch */ -+ if (i_pro & I2C_P_IRQSS_RX) -+ pr_debug(" rx"); -+ -+ /* tx end */ -+ if (i_pro & I2C_P_IRQSS_TX_END) -+ pr_debug(" txend"); -+ pr_debug("\n"); -+ -+ if (!priv->msg_err) { -+ /* tx -> rx switch */ -+ if (i_pro & I2C_P_IRQSS_RX) { -+ priv->status = STATUS_READ; -+ enable_burst_irq(priv); -+ } -+ if (i_pro & I2C_P_IRQSS_TX_END) { -+ if (priv->status == STATUS_READ) -+ priv->status = STATUS_READ_END; -+ else { -+ disable_burst_irq(priv); -+ priv->status = STATUS_STOP; -+ } -+ } -+ } -+ -+ i2c_w32(i_pro, p_irqsc); -+} -+ -+static irqreturn_t ltq_i2c_isr(int irq, void *dev_id) -+{ -+ u32 i_raw, i_err = 0; -+ struct ltq_i2c *priv = dev_id; -+ -+ i_raw = i2c_r32(mis); -+ pr_debug("i_raw 0x%08X\n", i_raw); -+ -+ /* error interrupt */ -+ if (i_raw & I2C_RIS_I2C_ERR_INT_INTOCC) { -+ i_err = i2c_r32(err_irqss); -+ pr_debug("i_err 0x%08X bus_stat 0x%04X\n", -+ i_err, i2c_r32(bus_stat)); -+ -+ /* tx fifo overflow (8) */ -+ if (i_err & I2C_ERR_IRQSS_TXF_OFL) -+ priv->msg_err |= LTQ_I2C_TX_OFL; -+ -+ /* tx fifo underflow (4) */ -+ if (i_err & I2C_ERR_IRQSS_TXF_UFL) -+ priv->msg_err |= LTQ_I2C_TX_UFL; -+ -+ /* rx fifo overflow (2) */ -+ if (i_err & I2C_ERR_IRQSS_RXF_OFL) -+ priv->msg_err |= LTQ_I2C_RX_OFL; -+ -+ /* rx fifo underflow (1) */ -+ if (i_err & I2C_ERR_IRQSS_RXF_UFL) -+ priv->msg_err |= LTQ_I2C_RX_UFL; -+ -+ i2c_w32(i_err, err_irqsc); -+ } -+ -+ /* protocol interrupt */ -+ if (i_raw & I2C_RIS_I2C_P_INT_INTOCC) -+ ltq_i2c_isr_prot(priv); -+ -+ if ((priv->msg_err) || (priv->status == STATUS_STOP)) -+ complete(&priv->cmd_complete); -+ -+ return IRQ_HANDLED; -+} -+ -+static u32 ltq_i2c_functionality(struct i2c_adapter *adap) -+{ -+ return I2C_FUNC_I2C | -+ I2C_FUNC_10BIT_ADDR | -+ I2C_FUNC_SMBUS_EMUL; -+} -+ -+static struct i2c_algorithm ltq_i2c_algorithm = { -+ .master_xfer = ltq_i2c_xfer, -+ .functionality = ltq_i2c_functionality, -+}; -+ -+static int ltq_i2c_probe(struct platform_device *pdev) -+{ -+ struct device_node *node = pdev->dev.of_node; -+ struct ltq_i2c *priv; -+ struct i2c_adapter *adap; -+ struct resource *mmres, irqres[4]; -+ int ret = 0; -+ -+ dev_dbg(&pdev->dev, "probing\n"); -+ -+ mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ ret = of_irq_to_resource_table(node, irqres, 4); -+ if (!mmres || (ret != 4)) { -+ dev_err(&pdev->dev, "no resources\n"); -+ return -ENODEV; -+ } -+ -+ /* allocate private data */ -+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) { -+ dev_err(&pdev->dev, "can't allocate private data\n"); -+ return -ENOMEM; -+ } -+ -+ adap = &priv->adap; -+ i2c_set_adapdata(adap, priv); -+ adap->owner = THIS_MODULE; -+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; -+ strlcpy(adap->name, DRV_NAME "-adapter", sizeof(adap->name)); -+ adap->algo = <q_i2c_algorithm; -+ adap->dev.parent = &pdev->dev; -+ adap->dev.of_node = pdev->dev.of_node; -+ -+ if (of_property_read_u32(node, "clock-frequency", &priv->i2c_clock)) { -+ dev_warn(&pdev->dev, "No I2C speed selected, using 100kHz\n"); -+ priv->i2c_clock = 100000; -+ } -+ -+ init_completion(&priv->cmd_complete); -+ mutex_init(&priv->mutex); -+ -+ priv->membase = devm_ioremap_resource(&pdev->dev, mmres); -+ if (IS_ERR(priv->membase)) -+ return PTR_ERR(priv->membase); -+ -+ priv->dev = &pdev->dev; -+ priv->irq_lb = irqres[0].start; -+ -+ ret = devm_request_irq(&pdev->dev, irqres[0].start, ltq_i2c_isr_burst, -+ 0x0, "i2c lb", priv); -+ if (ret) { -+ dev_err(&pdev->dev, "can't get last burst IRQ %d\n", -+ irqres[0].start); -+ return -ENODEV; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, irqres[1].start, ltq_i2c_isr_burst, -+ 0x0, "i2c b", priv); -+ if (ret) { -+ dev_err(&pdev->dev, "can't get burst IRQ %d\n", -+ irqres[1].start); -+ return -ENODEV; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, irqres[2].start, ltq_i2c_isr, -+ 0x0, "i2c err", priv); -+ if (ret) { -+ dev_err(&pdev->dev, "can't get error IRQ %d\n", -+ irqres[2].start); -+ return -ENODEV; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, irqres[3].start, ltq_i2c_isr, -+ 0x0, "i2c p", priv); -+ if (ret) { -+ dev_err(&pdev->dev, "can't get protocol IRQ %d\n", -+ irqres[3].start); -+ return -ENODEV; -+ } -+ -+ dev_dbg(&pdev->dev, "mapped io-space to %p\n", priv->membase); -+ dev_dbg(&pdev->dev, "use IRQs %d, %d, %d, %d\n", irqres[0].start, -+ irqres[1].start, irqres[2].start, irqres[3].start); -+ -+ priv->clk_gate = devm_clk_get(&pdev->dev, NULL); -+ if (IS_ERR(priv->clk_gate)) { -+ dev_err(&pdev->dev, "failed to get i2c clk\n"); -+ return -ENOENT; -+ } -+ -+ /* this is a static clock, which has no refcounting */ -+ priv->clk_input = clk_get_fpi(); -+ if (IS_ERR(priv->clk_input)) { -+ dev_err(&pdev->dev, "failed to get fpi clk\n"); -+ return -ENOENT; -+ } -+ -+ clk_activate(priv->clk_gate); -+ -+ /* add our adapter to the i2c stack */ -+ ret = i2c_add_numbered_adapter(adap); -+ if (ret) { -+ dev_err(&pdev->dev, "can't register I2C adapter\n"); -+ goto out; -+ } -+ -+ platform_set_drvdata(pdev, priv); -+ i2c_set_adapdata(adap, priv); -+ -+ /* print module version information */ -+ dev_dbg(&pdev->dev, "module id=%u revision=%u\n", -+ (i2c_r32(id) & I2C_ID_ID_MASK) >> I2C_ID_ID_OFFSET, -+ (i2c_r32(id) & I2C_ID_REV_MASK) >> I2C_ID_REV_OFFSET); -+ -+ /* initialize HW */ -+ ret = ltq_i2c_hw_init(adap); -+ if (ret) { -+ dev_err(&pdev->dev, "can't configure adapter\n"); -+ i2c_del_adapter(adap); -+ platform_set_drvdata(pdev, NULL); -+ goto out; -+ } else { -+ dev_info(&pdev->dev, "version %s\n", DRV_VERSION); -+ } -+ -+out: -+ /* if init failed, we need to deactivate the clock gate */ -+ if (ret) -+ clk_deactivate(priv->clk_gate); -+ -+ return ret; -+} -+ -+static int ltq_i2c_remove(struct platform_device *pdev) -+{ -+ struct ltq_i2c *priv = platform_get_drvdata(pdev); -+ -+ /* disable bus */ -+ i2c_w32_mask(I2C_RUN_CTRL_RUN_EN, 0, run_ctrl); -+ -+ /* power down the core */ -+ clk_deactivate(priv->clk_gate); -+ -+ /* remove driver */ -+ i2c_del_adapter(&priv->adap); -+ kfree(priv); -+ -+ dev_dbg(&pdev->dev, "removed\n"); -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+static const struct of_device_id ltq_i2c_match[] = { -+ { .compatible = "lantiq,lantiq-i2c" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ltq_i2c_match); -+ -+static struct platform_driver ltq_i2c_driver = { -+ .probe = ltq_i2c_probe, -+ .remove = ltq_i2c_remove, -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = ltq_i2c_match, -+ }, -+}; -+ -+module_platform_driver(ltq_i2c_driver); -+ -+MODULE_DESCRIPTION("Lantiq I2C bus adapter"); -+MODULE_AUTHOR("Thomas Langer "); -+MODULE_ALIAS("platform:" DRV_NAME); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION(DRV_VERSION); ---- /dev/null -+++ b/drivers/i2c/busses/i2c-lantiq.h -@@ -0,0 +1,234 @@ -+#ifndef I2C_LANTIQ_H -+#define I2C_LANTIQ_H -+ -+/* I2C register structure */ -+struct lantiq_reg_i2c { -+ /* I2C Kernel Clock Control Register */ -+ unsigned int clc; /* 0x00000000 */ -+ /* Reserved */ -+ unsigned int res_0; /* 0x00000004 */ -+ /* I2C Identification Register */ -+ unsigned int id; /* 0x00000008 */ -+ /* Reserved */ -+ unsigned int res_1; /* 0x0000000C */ -+ /* -+ * I2C RUN Control Register -+ * This register enables and disables the I2C peripheral. Before -+ * enabling, the I2C has to be configured properly. After enabling -+ * no configuration is possible -+ */ -+ unsigned int run_ctrl; /* 0x00000010 */ -+ /* -+ * I2C End Data Control Register -+ * This register is used to either turn around the data transmission -+ * direction or to address another slave without sending a stop -+ * condition. Also the software can stop the slave-transmitter by -+ * sending a not-accolade when working as master-receiver or even -+ * stop data transmission immediately when operating as -+ * master-transmitter. The writing to the bits of this control -+ * register is only effective when in MASTER RECEIVES BYTES, MASTER -+ * TRANSMITS BYTES, MASTER RESTART or SLAVE RECEIVE BYTES state -+ */ -+ unsigned int endd_ctrl; /* 0x00000014 */ -+ /* -+ * I2C Fractional Divider Configuration Register -+ * These register is used to program the fractional divider of the I2C -+ * bus. Before the peripheral is switched on by setting the RUN-bit the -+ * two (fixed) values for the two operating frequencies are programmed -+ * into these (configuration) registers. The Register FDIV_HIGH_CFG has -+ * the same layout as I2C_FDIV_CFG. -+ */ -+ unsigned int fdiv_cfg; /* 0x00000018 */ -+ /* -+ * I2C Fractional Divider (highspeed mode) Configuration Register -+ * These register is used to program the fractional divider of the I2C -+ * bus. Before the peripheral is switched on by setting the RUN-bit the -+ * two (fixed) values for the two operating frequencies are programmed -+ * into these (configuration) registers. The Register FDIV_CFG has the -+ * same layout as I2C_FDIV_CFG. -+ */ -+ unsigned int fdiv_high_cfg; /* 0x0000001C */ -+ /* I2C Address Configuration Register */ -+ unsigned int addr_cfg; /* 0x00000020 */ -+ /* I2C Bus Status Register -+ * This register gives a status information of the I2C. This additional -+ * information can be used by the software to start proper actions. -+ */ -+ unsigned int bus_stat; /* 0x00000024 */ -+ /* I2C FIFO Configuration Register */ -+ unsigned int fifo_cfg; /* 0x00000028 */ -+ /* I2C Maximum Received Packet Size Register */ -+ unsigned int mrps_ctrl; /* 0x0000002C */ -+ /* I2C Received Packet Size Status Register */ -+ unsigned int rps_stat; /* 0x00000030 */ -+ /* I2C Transmit Packet Size Register */ -+ unsigned int tps_ctrl; /* 0x00000034 */ -+ /* I2C Filled FIFO Stages Status Register */ -+ unsigned int ffs_stat; /* 0x00000038 */ -+ /* Reserved */ -+ unsigned int res_2; /* 0x0000003C */ -+ /* I2C Timing Configuration Register */ -+ unsigned int tim_cfg; /* 0x00000040 */ -+ /* Reserved */ -+ unsigned int res_3[7]; /* 0x00000044 */ -+ /* I2C Error Interrupt Request Source Mask Register */ -+ unsigned int err_irqsm; /* 0x00000060 */ -+ /* I2C Error Interrupt Request Source Status Register */ -+ unsigned int err_irqss; /* 0x00000064 */ -+ /* I2C Error Interrupt Request Source Clear Register */ -+ unsigned int err_irqsc; /* 0x00000068 */ -+ /* Reserved */ -+ unsigned int res_4; /* 0x0000006C */ -+ /* I2C Protocol Interrupt Request Source Mask Register */ -+ unsigned int p_irqsm; /* 0x00000070 */ -+ /* I2C Protocol Interrupt Request Source Status Register */ -+ unsigned int p_irqss; /* 0x00000074 */ -+ /* I2C Protocol Interrupt Request Source Clear Register */ -+ unsigned int p_irqsc; /* 0x00000078 */ -+ /* Reserved */ -+ unsigned int res_5; /* 0x0000007C */ -+ /* I2C Raw Interrupt Status Register */ -+ unsigned int ris; /* 0x00000080 */ -+ /* I2C Interrupt Mask Control Register */ -+ unsigned int imsc; /* 0x00000084 */ -+ /* I2C Masked Interrupt Status Register */ -+ unsigned int mis; /* 0x00000088 */ -+ /* I2C Interrupt Clear Register */ -+ unsigned int icr; /* 0x0000008C */ -+ /* I2C Interrupt Set Register */ -+ unsigned int isr; /* 0x00000090 */ -+ /* I2C DMA Enable Register */ -+ unsigned int dmae; /* 0x00000094 */ -+ /* Reserved */ -+ unsigned int res_6[8154]; /* 0x00000098 */ -+ /* I2C Transmit Data Register */ -+ unsigned int txd; /* 0x00008000 */ -+ /* Reserved */ -+ unsigned int res_7[4095]; /* 0x00008004 */ -+ /* I2C Receive Data Register */ -+ unsigned int rxd; /* 0x0000C000 */ -+ /* Reserved */ -+ unsigned int res_8[4095]; /* 0x0000C004 */ -+}; -+ -+/* -+ * Clock Divider for Normal Run Mode -+ * Max 8-bit divider value. IF RMC is 0 the module is disabled. Note: As long -+ * as the new divider value RMC is not valid, the register returns 0x0000 00xx -+ * on reading. -+ */ -+#define I2C_CLC_RMC_MASK 0x0000FF00 -+/* field offset */ -+#define I2C_CLC_RMC_OFFSET 8 -+ -+/* Fields of "I2C Identification Register" */ -+/* Module ID */ -+#define I2C_ID_ID_MASK 0x0000FF00 -+/* field offset */ -+#define I2C_ID_ID_OFFSET 8 -+/* Revision */ -+#define I2C_ID_REV_MASK 0x000000FF -+/* field offset */ -+#define I2C_ID_REV_OFFSET 0 -+ -+/* Fields of "I2C Interrupt Mask Control Register" */ -+/* Enable */ -+#define I2C_IMSC_BREQ_INT_EN 0x00000008 -+/* Enable */ -+#define I2C_IMSC_LBREQ_INT_EN 0x00000004 -+ -+/* Fields of "I2C Fractional Divider Configuration Register" */ -+/* field offset */ -+#define I2C_FDIV_CFG_INC_OFFSET 16 -+ -+/* Fields of "I2C Interrupt Mask Control Register" */ -+/* Enable */ -+#define I2C_IMSC_I2C_P_INT_EN 0x00000020 -+/* Enable */ -+#define I2C_IMSC_I2C_ERR_INT_EN 0x00000010 -+ -+/* Fields of "I2C Error Interrupt Request Source Status Register" */ -+/* TXF_OFL */ -+#define I2C_ERR_IRQSS_TXF_OFL 0x00000008 -+/* TXF_UFL */ -+#define I2C_ERR_IRQSS_TXF_UFL 0x00000004 -+/* RXF_OFL */ -+#define I2C_ERR_IRQSS_RXF_OFL 0x00000002 -+/* RXF_UFL */ -+#define I2C_ERR_IRQSS_RXF_UFL 0x00000001 -+ -+/* Fields of "I2C Raw Interrupt Status Register" */ -+/* Read: Interrupt occurred. */ -+#define I2C_RIS_I2C_ERR_INT_INTOCC 0x00000010 -+/* Read: Interrupt occurred. */ -+#define I2C_RIS_I2C_P_INT_INTOCC 0x00000020 -+ -+/* Fields of "I2C FIFO Configuration Register" */ -+/* TX FIFO Flow Control */ -+#define I2C_FIFO_CFG_TXFC 0x00020000 -+/* RX FIFO Flow Control */ -+#define I2C_FIFO_CFG_RXFC 0x00010000 -+/* Word aligned (character alignment of four characters) */ -+#define I2C_FIFO_CFG_TXFA_TXFA2 0x00002000 -+/* Word aligned (character alignment of four characters) */ -+#define I2C_FIFO_CFG_RXFA_RXFA2 0x00000200 -+/* 1 word */ -+#define I2C_FIFO_CFG_TXBS_TXBS0 0x00000000 -+ -+/* Fields of "I2C FIFO Configuration Register" */ -+/* 1 word */ -+#define I2C_FIFO_CFG_RXBS_RXBS0 0x00000000 -+/* Stop on Packet End Enable */ -+#define I2C_ADDR_CFG_SOPE_EN 0x00200000 -+/* Stop on Not Acknowledge Enable */ -+#define I2C_ADDR_CFG_SONA_EN 0x00100000 -+/* Enable */ -+#define I2C_ADDR_CFG_MnS_EN 0x00080000 -+ -+/* Fields of "I2C Interrupt Clear Register" */ -+/* Clear */ -+#define I2C_ICR_BREQ_INT_CLR 0x00000008 -+/* Clear */ -+#define I2C_ICR_LBREQ_INT_CLR 0x00000004 -+ -+/* Fields of "I2C Fractional Divider Configuration Register" */ -+/* field offset */ -+#define I2C_FDIV_CFG_DEC_OFFSET 0 -+ -+/* Fields of "I2C Bus Status Register" */ -+/* Bus Status */ -+#define I2C_BUS_STAT_BS_MASK 0x00000003 -+/* Read from I2C Bus. */ -+#define I2C_BUS_STAT_RNW_READ 0x00000004 -+/* I2C Bus is free. */ -+#define I2C_BUS_STAT_BS_FREE 0x00000000 -+/* -+ * The device is working as master and has claimed the control on the -+ * I2C-bus (busy master). -+ */ -+#define I2C_BUS_STAT_BS_BM 0x00000002 -+ -+/* Fields of "I2C RUN Control Register" */ -+/* Enable */ -+#define I2C_RUN_CTRL_RUN_EN 0x00000001 -+ -+/* Fields of "I2C End Data Control Register" */ -+/* -+ * Set End of Transmission -+ * Note:Do not write '1' to this bit when bus is free. This will cause an -+ * abort after the first byte when a new transfer is started. -+ */ -+#define I2C_ENDD_CTRL_SETEND 0x00000002 -+ -+/* Fields of "I2C Protocol Interrupt Request Source Status Register" */ -+/* NACK */ -+#define I2C_P_IRQSS_NACK 0x00000010 -+/* AL */ -+#define I2C_P_IRQSS_AL 0x00000008 -+/* RX */ -+#define I2C_P_IRQSS_RX 0x00000040 -+/* TX_END */ -+#define I2C_P_IRQSS_TX_END 0x00000020 -+ -+ -+#endif /* I2C_LANTIQ_H */ diff --git a/target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch b/target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch deleted file mode 100644 index a5ecd94c4..000000000 --- a/target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch +++ /dev/null @@ -1,219 +0,0 @@ -From f8c5db89e793a4bc6c1e87bd7b3a5cec16b75bc3 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Wed, 10 Sep 2014 22:42:14 +0200 -Subject: [PATCH 35/36] owrt: lantiq: wifi and ethernet eeprom handling - -Signed-off-by: John Crispin ---- - .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 3 + - arch/mips/lantiq/xway/Makefile | 3 + - arch/mips/lantiq/xway/ath5k_eep.c | 136 +++++++++++++++++++++ - arch/mips/lantiq/xway/eth_mac.c | 25 ++++ - drivers/net/ethernet/lantiq_etop.c | 6 +- - 5 files changed, 172 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/lantiq/xway/ath5k_eep.c - create mode 100644 arch/mips/lantiq/xway/eth_mac.c - ---- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h -+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h -@@ -104,5 +104,8 @@ int xrx200_gphy_boot(struct device *dev, - extern void ltq_pmu_enable(unsigned int module); - extern void ltq_pmu_disable(unsigned int module); - -+/* allow the ethernet driver to load a flash mapped mac addr */ -+const u8* ltq_get_eth_mac(void); -+ - #endif /* CONFIG_SOC_TYPE_XWAY */ - #endif /* _LTQ_XWAY_H__ */ ---- a/arch/mips/lantiq/xway/Makefile -+++ b/arch/mips/lantiq/xway/Makefile -@@ -8,4 +8,7 @@ endif - - obj-y += vmmc.o - -+obj-y += eth_mac.o -+obj-$(CONFIG_PCI) += ath5k_eep.o -+ - obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o ---- /dev/null -+++ b/arch/mips/lantiq/xway/ath5k_eep.c -@@ -0,0 +1,136 @@ -+/* -+ * Copyright (C) 2011 Luca Olivetti -+ * Copyright (C) 2011 John Crispin -+ * Copyright (C) 2011 Andrej Vlašić -+ * Copyright (C) 2013 Álvaro Fernández Rojas -+ * Copyright (C) 2013 Daniel Gimpelevich -+ * Copyright (C) 2015 Vittorio Gambaletta -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+extern int (*ltq_pci_plat_dev_init)(struct pci_dev *dev); -+struct ath5k_platform_data ath5k_pdata; -+static u8 athxk_eeprom_mac[6]; -+ -+static int ath5k_pci_plat_dev_init(struct pci_dev *dev) -+{ -+ dev->dev.platform_data = &ath5k_pdata; -+ return 0; -+} -+ -+static int ath5k_eep_load; -+int __init of_ath5k_eeprom_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node, *mtd_np = NULL; -+ int mac_offset; -+ u32 mac_inc = 0; -+ int i; -+ struct mtd_info *the_mtd; -+ size_t flash_readlen; -+ const __be32 *list; -+ const char *part; -+ phandle phandle; -+ -+ list = of_get_property(np, "ath,eep-flash", &i); -+ if (!list || (i != (2 * sizeof(*list)))) -+ return -ENODEV; -+ -+ phandle = be32_to_cpup(list++); -+ if (phandle) -+ mtd_np = of_find_node_by_phandle(phandle); -+ -+ if (!mtd_np) -+ return -ENODEV; -+ -+ part = of_get_property(mtd_np, "label", NULL); -+ if (!part) -+ part = mtd_np->name; -+ -+ the_mtd = get_mtd_device_nm(part); -+ if (IS_ERR(the_mtd)) -+ return -ENODEV; -+ -+ ath5k_pdata.eeprom_data = kmalloc(ATH5K_PLAT_EEP_MAX_WORDS<<1, GFP_KERNEL); -+ -+ i = mtd_read(the_mtd, be32_to_cpup(list), ATH5K_PLAT_EEP_MAX_WORDS << 1, -+ &flash_readlen, (void *) ath5k_pdata.eeprom_data); -+ -+ if (!of_property_read_u32(np, "ath,mac-offset", &mac_offset)) { -+ size_t mac_readlen; -+ mtd_read(the_mtd, mac_offset, 6, &mac_readlen, -+ (void *) athxk_eeprom_mac); -+ } -+ put_mtd_device(the_mtd); -+ -+ if (((ATH5K_PLAT_EEP_MAX_WORDS<<1) != flash_readlen) || i) { -+ dev_err(&pdev->dev, "failed to load eeprom from mtd\n"); -+ return -ENODEV; -+ } -+ -+ if (of_find_property(np, "ath,eep-swap", NULL)) -+ for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS; i++) -+ ath5k_pdata.eeprom_data[i] = swab16(ath5k_pdata.eeprom_data[i]); -+ -+ if (!is_valid_ether_addr(athxk_eeprom_mac) && ltq_get_eth_mac()) -+ ether_addr_copy(athxk_eeprom_mac, ltq_get_eth_mac()); -+ -+ if (!is_valid_ether_addr(athxk_eeprom_mac)) { -+ dev_warn(&pdev->dev, "using random mac\n"); -+ random_ether_addr(athxk_eeprom_mac); -+ } -+ -+ if (!of_property_read_u32(np, "ath,mac-increment", &mac_inc)) -+ athxk_eeprom_mac[5] += mac_inc; -+ -+ ath5k_pdata.macaddr = athxk_eeprom_mac; -+ ltq_pci_plat_dev_init = ath5k_pci_plat_dev_init; -+ -+ dev_info(&pdev->dev, "loaded ath5k eeprom\n"); -+ -+ return 0; -+} -+ -+static struct of_device_id ath5k_eeprom_ids[] = { -+ { .compatible = "ath5k,eeprom" }, -+ { } -+}; -+ -+static struct platform_driver ath5k_eeprom_driver = { -+ .driver = { -+ .name = "ath5k,eeprom", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(ath5k_eeprom_ids), -+ }, -+}; -+ -+static int __init of_ath5k_eeprom_init(void) -+{ -+ int ret = platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe); -+ -+ if (ret) -+ ath5k_eep_load = 1; -+ -+ return ret; -+} -+ -+static int __init of_ath5k_eeprom_init_late(void) -+{ -+ if (!ath5k_eep_load) -+ return 0; -+ -+ return platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe); -+} -+late_initcall(of_ath5k_eeprom_init_late); -+subsys_initcall(of_ath5k_eeprom_init); ---- /dev/null -+++ b/arch/mips/lantiq/xway/eth_mac.c -@@ -0,0 +1,25 @@ -+/* -+ * Copyright (C) 2012 John Crispin -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+ -+static u8 eth_mac[6]; -+static int eth_mac_set; -+ -+const u8* ltq_get_eth_mac(void) -+{ -+ return eth_mac; -+} -+ -+static int __init setup_ethaddr(char *str) -+{ -+ eth_mac_set = mac_pton(str, eth_mac); -+ return !eth_mac_set; -+} -+early_param("ethaddr", setup_ethaddr); ---- a/drivers/net/ethernet/lantiq_etop.c -+++ b/drivers/net/ethernet/lantiq_etop.c -@@ -794,7 +794,11 @@ ltq_etop_init(struct net_device *dev) - if (err) - goto err_hw; - -- memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr)); -+ memcpy(&mac.sa_data, ltq_get_eth_mac(), ETH_ALEN); -+ -+ if (priv->mac && !is_valid_ether_addr(mac.sa_data)) -+ memcpy(&mac.sa_data, priv->mac, ETH_ALEN); -+ - if (!is_valid_ether_addr(mac.sa_data)) { - pr_warn("etop: invalid MAC, using random\n"); - eth_random_addr(mac.sa_data); diff --git a/target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch b/target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch deleted file mode 100644 index fc6312310..000000000 --- a/target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/usb/dwc2/platform.c -+++ b/drivers/usb/dwc2/platform.c -@@ -42,6 +42,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -544,6 +545,7 @@ static int dwc2_driver_probe(struct plat - struct dwc2_hsotg *hsotg; - struct resource *res; - int retval; -+ int gpio_count; - - match = of_match_device(dwc2_of_match_table, &dev->dev); - if (match && match->data) { -@@ -562,6 +564,16 @@ static int dwc2_driver_probe(struct plat - defparams.dma_desc_fs_enable = 0; - } - -+ gpio_count = of_gpio_count(dev->dev.of_node); -+ while (gpio_count > 0) { -+ enum of_gpio_flags flags; -+ int gpio = of_get_gpio_flags(dev->dev.of_node, --gpio_count, &flags); -+ if (gpio_request(gpio, "usb")) -+ continue; -+ dev_info(&dev->dev, "requested GPIO %d\n", gpio); -+ gpio_direction_output(gpio, (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); -+ } -+ - hsotg = devm_kzalloc(&dev->dev, sizeof(*hsotg), GFP_KERNEL); - if (!hsotg) - return -ENOMEM; diff --git a/target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch b/target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch deleted file mode 100644 index 14b417e69..000000000 --- a/target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 9807eb80a1b3bad7a4a89aa6566497bb1cadd6ef Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 3 Jun 2016 13:12:20 +0200 -Subject: [PATCH] arch: mips: increase io_space_limit - -this value comes from x86 and breaks some pci devices - -Signed-off-by: John Crispin ---- - arch/mips/include/asm/io.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/include/asm/io.h -+++ b/arch/mips/include/asm/io.h -@@ -50,7 +50,7 @@ - - /* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ - --#define IO_SPACE_LIMIT 0xffff -+#define IO_SPACE_LIMIT 0xffffffff - - /* - * On MIPS I/O ports are memory mapped, so we access them using normal diff --git a/target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch b/target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch deleted file mode 100644 index a2fc9d955..000000000 --- a/target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/pinctrl/pinctrl-xway.c -+++ b/drivers/pinctrl/pinctrl-xway.c -@@ -1028,7 +1028,7 @@ static const struct ltq_pin_group xrx200 - GRP_MUX("spi_cs5", SPI, xrx200_pins_spi_cs5), - GRP_MUX("spi_cs6", SPI, xrx200_pins_spi_cs6), - GRP_MUX("usif uart_rx", USIF, xrx200_pins_usif_uart_rx), -- GRP_MUX("usif uart_rx", USIF, xrx200_pins_usif_uart_tx), -+ GRP_MUX("usif uart_tx", USIF, xrx200_pins_usif_uart_tx), - GRP_MUX("usif uart_rts", USIF, xrx200_pins_usif_uart_rts), - GRP_MUX("usif uart_cts", USIF, xrx200_pins_usif_uart_cts), - GRP_MUX("usif uart_dtr", USIF, xrx200_pins_usif_uart_dtr), diff --git a/target/linux/lantiq/patches-4.9/0047-poweroff.patch b/target/linux/lantiq/patches-4.9/0047-poweroff.patch deleted file mode 100644 index 54249bba5..000000000 --- a/target/linux/lantiq/patches-4.9/0047-poweroff.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/arch/mips/lantiq/xway/reset.c -+++ b/arch/mips/lantiq/xway/reset.c -@@ -301,12 +301,6 @@ static void ltq_machine_halt(void) - unreachable(); - } - --static void ltq_machine_power_off(void) --{ -- local_irq_disable(); -- unreachable(); --} -- - static void ltq_usb_init(void) - { - /* Power for USB cores 1 & 2 */ -@@ -379,7 +373,6 @@ static int __init mips_reboot_setup(void - - _machine_restart = ltq_machine_restart; - _machine_halt = ltq_machine_halt; -- pm_power_off = ltq_machine_power_off; - - return 0; - } diff --git a/target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch b/target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch deleted file mode 100644 index c0d7afc54..000000000 --- a/target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Felix Fietkau -Date: Thu, 19 Jan 2017 12:14:44 +0100 -Subject: [PATCH] MIPS: Lantiq: Fix cascaded IRQ setup - -With the IRQ stack changes integrated, the XRX200 devices started -emitting a constant stream of kernel messages like this: - -[ 565.415310] Spurious IRQ: CAUSE=0x1100c300 - -This appears to be caused by IP0 firing for some reason without being -handled. Fix this by setting up IP2-6 as a proper chained IRQ handler and -calling do_IRQ for all MIPS CPU interrupts. - -Cc: john@phrozen.org -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/lantiq/irq.c -+++ b/arch/mips/lantiq/irq.c -@@ -271,6 +271,11 @@ static void ltq_hw5_irqdispatch(void) - DEFINE_HWx_IRQDISPATCH(5) - #endif - -+static void ltq_hw_irq_handler(struct irq_desc *desc) -+{ -+ ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); -+} -+ - #ifdef CONFIG_MIPS_MT_SMP - void __init arch_init_ipiirq(int irq, struct irqaction *action) - { -@@ -315,23 +320,19 @@ static struct irqaction irq_call = { - asmlinkage void plat_irq_dispatch(void) - { - unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; -- unsigned int i; -+ int irq; - -- if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) { -- do_IRQ(MIPS_CPU_TIMER_IRQ); -- goto out; -- } else { -- for (i = 0; i < MAX_IM; i++) { -- if (pending & (CAUSEF_IP2 << i)) { -- ltq_hw_irqdispatch(i); -- goto out; -- } -- } -+ if (!pending) { -+ spurious_interrupt(); -+ return; - } -- pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status()); - --out: -- return; -+ pending >>= CAUSEB_IP; -+ while (pending) { -+ irq = fls(pending) - 1; -+ do_IRQ(MIPS_CPU_IRQ_BASE + irq); -+ pending &= ~BIT(irq); -+ } - } - - static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) -@@ -356,11 +357,6 @@ static const struct irq_domain_ops irq_d - .map = icu_map, - }; - --static struct irqaction cascade = { -- .handler = no_action, -- .name = "cascade", --}; -- - int __init icu_of_init(struct device_node *node, struct device_node *parent) - { - struct device_node *eiu_node; -@@ -392,7 +388,7 @@ int __init icu_of_init(struct device_nod - mips_cpu_irq_init(); - - for (i = 0; i < MAX_IM; i++) -- setup_irq(i + 2, &cascade); -+ irq_set_chained_handler(i + 2, ltq_hw_irq_handler); - - if (cpu_has_vint) { - pr_info("Setting up vectored interrupts\n"); diff --git a/target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch b/target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch deleted file mode 100644 index 4d1844394..000000000 --- a/target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch +++ /dev/null @@ -1,130 +0,0 @@ -From de2cad82c4d0872066f83ce59462603852b47f03 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Fri, 6 Jan 2017 17:55:24 +0100 -Subject: [PATCH 2/2] usb: dwc2: add support for other Lantiq SoCs - -The size of the internal RAM of the DesignWare USB controller changed -between the different Lantiq SoCs. We have the following sizes: - -Amazon + Danube: 8 KByte -Amazon SE + arx100: 2 KByte -xrx200 + xrx300: 2.5 KByte - -For Danube SoC we do not provide the params and let the driver decide -to use sane defaults, for the Amazon SE and arx100 we use small fifos -and for the xrx200 and xrx300 SCs a little bit bigger periodic fifo. -The auto detection of max_transfer_size and max_packet_count should -work, so remove it. - -Signed-off-by: Hauke Mehrtens ---- - drivers/usb/dwc2/platform.c | 46 ++++++++++++++++++++++++++++++++++++++------- - 1 file changed, 39 insertions(+), 7 deletions(-) - ---- a/drivers/usb/dwc2/platform.c -+++ b/drivers/usb/dwc2/platform.c -@@ -151,7 +151,38 @@ static const struct dwc2_core_params par - .hibernation = -1, - }; - --static const struct dwc2_core_params params_ltq = { -+static const struct dwc2_core_params params_danube = { -+ .otg_cap = 2, /* non-HNP/non-SRP */ -+ .otg_ver = -1, -+ .dma_enable = -1, -+ .dma_desc_enable = -1, -+ .dma_desc_fs_enable = -1, -+ .speed = -1, -+ .enable_dynamic_fifo = -1, -+ .en_multiple_tx_fifo = -1, -+ .host_rx_fifo_size = -1, -+ .host_nperio_tx_fifo_size = -1, -+ .host_perio_tx_fifo_size = -1, -+ .max_transfer_size = -1, -+ .max_packet_count = -1, -+ .host_channels = -1, -+ .phy_type = -1, -+ .phy_utmi_width = -1, -+ .phy_ulpi_ddr = -1, -+ .phy_ulpi_ext_vbus = -1, -+ .i2c_enable = -1, -+ .ulpi_fs_ls = -1, -+ .host_support_fs_ls_low_power = -1, -+ .host_ls_low_power_phy_clk = -1, -+ .ts_dline = -1, -+ .reload_ctl = -1, -+ .ahbcfg = -1, -+ .uframe_sched = -1, -+ .external_id_pin_ctl = -1, -+ .hibernation = -1, -+}; -+ -+static const struct dwc2_core_params params_ase = { - .otg_cap = 2, /* non-HNP/non-SRP */ - .otg_ver = -1, - .dma_enable = -1, -@@ -163,8 +194,8 @@ static const struct dwc2_core_params par - .host_rx_fifo_size = 288, /* 288 DWORDs */ - .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ - .host_perio_tx_fifo_size = 96, /* 96 DWORDs */ -- .max_transfer_size = 65535, -- .max_packet_count = 511, -+ .max_transfer_size = -1, -+ .max_packet_count = -1, - .host_channels = -1, - .phy_type = -1, - .phy_utmi_width = -1, -@@ -176,8 +207,37 @@ static const struct dwc2_core_params par - .host_ls_low_power_phy_clk = -1, - .ts_dline = -1, - .reload_ctl = -1, -- .ahbcfg = GAHBCFG_HBSTLEN_INCR16 << -- GAHBCFG_HBSTLEN_SHIFT, -+ .ahbcfg = -1, -+ .uframe_sched = -1, -+ .external_id_pin_ctl = -1, -+ .hibernation = -1, -+}; -+ -+static const struct dwc2_core_params params_xrx200 = { -+ .otg_cap = 2, /* non-HNP/non-SRP */ -+ .otg_ver = -1, -+ .dma_enable = -1, -+ .dma_desc_enable = -1, -+ .speed = -1, -+ .enable_dynamic_fifo = -1, -+ .en_multiple_tx_fifo = -1, -+ .host_rx_fifo_size = 288, /* 288 DWORDs */ -+ .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ -+ .host_perio_tx_fifo_size = 136, /* 136 DWORDs */ -+ .max_transfer_size = -1, -+ .max_packet_count = -1, -+ .host_channels = -1, -+ .phy_type = -1, -+ .phy_utmi_width = -1, -+ .phy_ulpi_ddr = -1, -+ .phy_ulpi_ext_vbus = -1, -+ .i2c_enable = -1, -+ .ulpi_fs_ls = -1, -+ .host_support_fs_ls_low_power = -1, -+ .host_ls_low_power_phy_clk = -1, -+ .ts_dline = -1, -+ .reload_ctl = -1, -+ .ahbcfg = -1, - .uframe_sched = -1, - .external_id_pin_ctl = -1, - .hibernation = -1, -@@ -515,8 +575,11 @@ static const struct of_device_id dwc2_of - { .compatible = "brcm,bcm2835-usb", .data = ¶ms_bcm2835 }, - { .compatible = "hisilicon,hi6220-usb", .data = ¶ms_hi6220 }, - { .compatible = "rockchip,rk3066-usb", .data = ¶ms_rk3066 }, -- { .compatible = "lantiq,arx100-usb", .data = ¶ms_ltq }, -- { .compatible = "lantiq,xrx200-usb", .data = ¶ms_ltq }, -+ { .compatible = "lantiq,danube-usb", .data = ¶ms_danube }, -+ { .compatible = "lantiq,ase-usb", .data = ¶ms_ase }, -+ { .compatible = "lantiq,arx100-usb", .data = ¶ms_ase }, -+ { .compatible = "lantiq,xrx200-usb", .data = ¶ms_xrx200 }, -+ { .compatible = "lantiq,xrx300-usb", .data = ¶ms_xrx200 }, - { .compatible = "snps,dwc2", .data = NULL }, - { .compatible = "samsung,s3c6400-hsotg", .data = NULL}, - { .compatible = "amlogic,meson8b-usb", .data = ¶ms_amlogic }, diff --git a/target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch b/target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch deleted file mode 100644 index acc23080f..000000000 --- a/target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch +++ /dev/null @@ -1,202 +0,0 @@ -From 14909c4e4e836925668e74fc6e0e85ba0283cbf9 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Fri, 6 Jan 2017 17:40:12 +0100 -Subject: [PATCH 2/2] MIPS: lantiq: improve USB initialization - -This adds code to initialize the USB controller and PHY also on Danube, -Amazon SE and AR10. This code is based on the Vendor driver from -different UGW versions and compared to the hardware documentation. - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/lantiq/xway/reset.c | 120 ++++++++++++++++++++++++++++++---------- - arch/mips/lantiq/xway/sysctrl.c | 20 +++++++ - 2 files changed, 110 insertions(+), 30 deletions(-) - ---- a/arch/mips/lantiq/xway/reset.c -+++ b/arch/mips/lantiq/xway/reset.c -@@ -72,6 +72,8 @@ - #define RCU_USBCFG_HDSEL_BIT BIT(11) - #define RCU_USBCFG_HOST_END_BIT BIT(10) - #define RCU_USBCFG_SLV_END_BIT BIT(9) -+#define RCU_USBCFG_SLV_END_BIT_AR9 BIT(17) -+ - - /* USB reset bits */ - #define RCU_USBRESET 0x0010 -@@ -85,6 +87,8 @@ - - #define RCU_CFG1A 0x0038 - #define RCU_CFG1B 0x003C -+#define RCU_CFG1_TX_PEE BIT(0) -+#define RCU_CFG1_DIS_THR_SHIFT 15 /* Disconnect Threshold */ - - /* USB PMU devices */ - #define PMU_AHBM BIT(15) -@@ -306,38 +310,91 @@ static void ltq_usb_init(void) - /* Power for USB cores 1 & 2 */ - ltq_pmu_enable(PMU_AHBM); - ltq_pmu_enable(PMU_USB0); -- ltq_pmu_enable(PMU_USB1); - -- ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1A) | BIT(0), RCU_CFG1A); -- ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1B) | BIT(0), RCU_CFG1B); -+ if (of_machine_is_compatible("lantiq,ar10") || -+ of_machine_is_compatible("lantiq,grx390") || -+ of_machine_is_compatible("lantiq,ar9") || -+ of_machine_is_compatible("lantiq,vr9")) -+ ltq_pmu_enable(PMU_USB1); -+ -+ if (of_machine_is_compatible("lantiq,vr9") || -+ of_machine_is_compatible("lantiq,ar10")) { -+ ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1A) | RCU_CFG1_TX_PEE | -+ 7 << RCU_CFG1_DIS_THR_SHIFT, RCU_CFG1A); -+ ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1B) | RCU_CFG1_TX_PEE | -+ 7 << RCU_CFG1_DIS_THR_SHIFT, RCU_CFG1B); -+ } - - /* Enable USB PHY power for cores 1 & 2 */ - ltq_pmu_enable(PMU_USB0_P); -- ltq_pmu_enable(PMU_USB1_P); -+ if (of_machine_is_compatible("lantiq,ar10") || -+ of_machine_is_compatible("lantiq,grx390") || -+ of_machine_is_compatible("lantiq,ar9") || -+ of_machine_is_compatible("lantiq,vr9")) -+ ltq_pmu_enable(PMU_USB1_P); -+ -+ if (of_machine_is_compatible("lantiq,ase") || -+ of_machine_is_compatible("lantiq,danube")) { -+ /* Configure cores to host mode */ -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, -+ RCU_USB1CFG); -+ -+ /* Select DMA endianness (Host-endian: big-endian) */ -+ ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT) -+ | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); -+ } -+ -+ if (of_machine_is_compatible("lantiq,ar9")) { -+ /* Configure cores to host mode */ -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, -+ RCU_USB1CFG); -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USB2CFG) & ~RCU_USBCFG_HDSEL_BIT, -+ RCU_USB2CFG); -+ -+ /* Select DMA endianness (Host-endian: big-endian) */ -+ ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT_AR9) -+ | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); -+ ltq_rcu_w32(ltq_rcu_r32((RCU_USB2CFG) & ~RCU_USBCFG_SLV_END_BIT_AR9) -+ | RCU_USBCFG_HOST_END_BIT, RCU_USB2CFG); -+ } -+ -+ if (of_machine_is_compatible("lantiq,vr9") || -+ of_machine_is_compatible("lantiq,ar10")) { -+ /* Configure cores to host mode */ -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, -+ RCU_USB1CFG); -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USB2CFG) & ~RCU_USBCFG_HDSEL_BIT, -+ RCU_USB2CFG); -+ -+ /* Select DMA endianness (Host-endian: big-endian) */ -+ ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT) -+ | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); -+ ltq_rcu_w32(ltq_rcu_r32((RCU_USB2CFG) & ~RCU_USBCFG_SLV_END_BIT) -+ | RCU_USBCFG_HOST_END_BIT, RCU_USB2CFG); -+ } -+ -+ if (of_machine_is_compatible("lantiq,ar9")) { -+ /* Hard reset USB state machines */ -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) -+ | USBRESET_BIT | BIT(28), RCU_USBRESET); -+ udelay(50 * 1000); -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) -+ & ~(USBRESET_BIT | BIT(28)), RCU_USBRESET); -+ } else { -+ /* Hard reset USB state machines */ -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) | USBRESET_BIT, RCU_USBRESET); -+ udelay(50 * 1000); -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) & ~USBRESET_BIT, RCU_USBRESET); -+ } - -- /* Configure cores to host mode */ -- ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, -- RCU_USB1CFG); -- ltq_rcu_w32(ltq_rcu_r32(RCU_USB2CFG) & ~RCU_USBCFG_HDSEL_BIT, -- RCU_USB2CFG); -- -- /* Select DMA endianness (Host-endian: big-endian) */ -- ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT) -- | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); -- ltq_rcu_w32(ltq_rcu_r32((RCU_USB2CFG) & ~RCU_USBCFG_SLV_END_BIT) -- | RCU_USBCFG_HOST_END_BIT, RCU_USB2CFG); -- -- /* Hard reset USB state machines */ -- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) | USBRESET_BIT, RCU_USBRESET); -- udelay(50 * 1000); -- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) & ~USBRESET_BIT, RCU_USBRESET); -- -- /* Soft reset USB state machines */ -- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) -- | USB1RESET_BIT | USB2RESET_BIT, RCU_USBRESET2); -- udelay(50 * 1000); -- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) -- & ~(USB1RESET_BIT | USB2RESET_BIT), RCU_USBRESET2); -+ if (of_machine_is_compatible("lantiq,vr9")) { -+ /* Soft reset USB state machines */ -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) -+ | USB1RESET_BIT | USB2RESET_BIT, RCU_USBRESET2); -+ udelay(50 * 1000); -+ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) -+ & ~(USB1RESET_BIT | USB2RESET_BIT), RCU_USBRESET2); -+ } - } - - static int __init mips_reboot_setup(void) -@@ -363,8 +420,11 @@ static int __init mips_reboot_setup(void - if (!ltq_rcu_membase) - panic("Failed to remap core memory"); - -- if (of_machine_is_compatible("lantiq,ar9") || -- of_machine_is_compatible("lantiq,vr9")) -+ if (of_machine_is_compatible("lantiq,danube") || -+ of_machine_is_compatible("lantiq,ase") || -+ of_machine_is_compatible("lantiq,ar9") || -+ of_machine_is_compatible("lantiq,vr9") || -+ of_machine_is_compatible("lantiq,ar10")) - ltq_usb_init(); - - if (of_machine_is_compatible("lantiq,vr9")) ---- a/arch/mips/lantiq/xway/sysctrl.c -+++ b/arch/mips/lantiq/xway/sysctrl.c -@@ -254,6 +254,25 @@ static void pmu_disable(struct clk *clk) - pr_warn("deactivating PMU module failed!"); - } - -+static void usb_set_clock(void) -+{ -+ unsigned int val = ltq_cgu_r32(ifccr); -+ -+ if (of_machine_is_compatible("lantiq,ar10") || -+ of_machine_is_compatible("lantiq,grx390")) { -+ val &= ~0x03; /* XTAL divided by 3 */ -+ } else if (of_machine_is_compatible("lantiq,ar9") || -+ of_machine_is_compatible("lantiq,vr9")) { -+ /* TODO: this depends on the XTAL frequency */ -+ val |= 0x03; /* XTAL divided by 3 */ -+ } else if (of_machine_is_compatible("lantiq,ase")) { -+ val |= 0x20; /* from XTAL */ -+ } else if (of_machine_is_compatible("lantiq,danube")) { -+ val |= 0x30; /* 12 MHz, generated from 36 MHz */ -+ } -+ ltq_cgu_w32(val, ifccr); -+} -+ - /* the pci enable helper */ - static int pci_enable(struct clk *clk) - { -@@ -608,4 +627,5 @@ void __init ltq_soc_init(void) - - if (of_machine_is_compatible("lantiq,vr9")) - xbar_fpi_burst_disable(); -+ usb_set_clock(); - } diff --git a/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch b/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch deleted file mode 100644 index da48ae3a1..000000000 --- a/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch +++ /dev/null @@ -1,1078 +0,0 @@ -From 941ab0bc001fe24e5f8ce88eed27f2a1b89f3e20 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Tue, 14 Feb 2017 00:31:11 +0100 -Subject: spi: lantiq-ssc: add support for Lantiq SSC SPI controller - -This driver supports the Lantiq SSC SPI controller in master -mode. This controller is found on Intel (former Lantiq) SoCs like -the Danube, Falcon, xRX200, xRX300. - -The hardware uses two hardware FIFOs one for received and one for -transferred bytes. When the driver writes data into the transmit FIFO -the complete word is taken from the FIFO into a shift register. The -data from this shift register is then written to the wire. This driver -uses the interrupts signaling the status of the FIFOs and not the shift -register. It is also possible to use the interrupts for the shift -register, but they will send a signal after every word. When using the -interrupts for the shift register we get a signal when the last word is -written into the shift register and not when it is written to the wire. -After all FIFOs are empty the driver busy waits till the hardware is -not busy any more and returns the transfer status. - -Signed-off-by: Daniel Schwierzeck -Signed-off-by: Hauke Mehrtens -Signed-off-by: Mark Brown ---- - .../devicetree/bindings/spi/spi-lantiq-ssc.txt | 29 + - drivers/spi/Kconfig | 8 + - drivers/spi/Makefile | 1 + - drivers/spi/spi-lantiq-ssc.c | 983 +++++++++++++++++++++ - 4 files changed, 1021 insertions(+) - create mode 100644 Documentation/devicetree/bindings/spi/spi-lantiq-ssc.txt - create mode 100644 drivers/spi/spi-lantiq-ssc.c - ---- /dev/null -+++ b/Documentation/devicetree/bindings/spi/spi-lantiq-ssc.txt -@@ -0,0 +1,29 @@ -+Lantiq Synchronous Serial Controller (SSC) SPI master driver -+ -+Required properties: -+- compatible: "lantiq,ase-spi", "lantiq,falcon-spi", "lantiq,xrx100-spi" -+- #address-cells: see spi-bus.txt -+- #size-cells: see spi-bus.txt -+- reg: address and length of the spi master registers -+- interrupts: should contain the "spi_rx", "spi_tx" and "spi_err" interrupt. -+ -+ -+Optional properties: -+- clocks: spi clock phandle -+- num-cs: see spi-bus.txt, set to 8 if unset -+- base-cs: the number of the first chip select, set to 1 if unset. -+ -+Example: -+ -+ -+spi: spi@E100800 { -+ compatible = "lantiq,xrx200-spi", "lantiq,xrx100-spi"; -+ reg = <0xE100800 0x100>; -+ interrupt-parent = <&icu0>; -+ interrupts = <22 23 24>; -+ interrupt-names = "spi_rx", "spi_tx", "spi_err"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ num-cs = <6>; -+ base-cs = <1>; -+}; ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -403,6 +403,14 @@ config SPI_NUC900 - help - SPI driver for Nuvoton NUC900 series ARM SoCs - -+config SPI_LANTIQ_SSC -+ tristate "Lantiq SSC SPI controller" -+ depends on LANTIQ -+ help -+ This driver supports the Lantiq SSC SPI controller in master -+ mode. This controller is found on Intel (former Lantiq) SoCs like -+ the Danube, Falcon, xRX200, xRX300. -+ - config SPI_OC_TINY - tristate "OpenCores tiny SPI" - depends on GPIOLIB || COMPILE_TEST ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -47,6 +47,7 @@ obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-sp - obj-$(CONFIG_SPI_GPIO) += spi-gpio.o - obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o - obj-$(CONFIG_SPI_IMX) += spi-imx.o -+obj-$(CONFIG_SPI_LANTIQ_SSC) += spi-lantiq-ssc.o - obj-$(CONFIG_SPI_JCORE) += spi-jcore.o - obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o - obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o ---- /dev/null -+++ b/drivers/spi/spi-lantiq-ssc.c -@@ -0,0 +1,983 @@ -+/* -+ * Copyright (C) 2011-2015 Daniel Schwierzeck -+ * Copyright (C) 2016 Hauke Mehrtens -+ * -+ * This program is free software; you can distribute it and/or modify it -+ * under the terms of the GNU General Public License (Version 2) as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_LANTIQ -+#include -+#endif -+ -+#define SPI_RX_IRQ_NAME "spi_rx" -+#define SPI_TX_IRQ_NAME "spi_tx" -+#define SPI_ERR_IRQ_NAME "spi_err" -+#define SPI_FRM_IRQ_NAME "spi_frm" -+ -+#define SPI_CLC 0x00 -+#define SPI_PISEL 0x04 -+#define SPI_ID 0x08 -+#define SPI_CON 0x10 -+#define SPI_STAT 0x14 -+#define SPI_WHBSTATE 0x18 -+#define SPI_TB 0x20 -+#define SPI_RB 0x24 -+#define SPI_RXFCON 0x30 -+#define SPI_TXFCON 0x34 -+#define SPI_FSTAT 0x38 -+#define SPI_BRT 0x40 -+#define SPI_BRSTAT 0x44 -+#define SPI_SFCON 0x60 -+#define SPI_SFSTAT 0x64 -+#define SPI_GPOCON 0x70 -+#define SPI_GPOSTAT 0x74 -+#define SPI_FPGO 0x78 -+#define SPI_RXREQ 0x80 -+#define SPI_RXCNT 0x84 -+#define SPI_DMACON 0xec -+#define SPI_IRNEN 0xf4 -+#define SPI_IRNICR 0xf8 -+#define SPI_IRNCR 0xfc -+ -+#define SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ -+#define SPI_CLC_SMC_M (0xFF << SPI_CLC_SMC_S) -+#define SPI_CLC_RMC_S 8 /* Clock divider for normal run mode */ -+#define SPI_CLC_RMC_M (0xFF << SPI_CLC_RMC_S) -+#define SPI_CLC_DISS BIT(1) /* Disable status bit */ -+#define SPI_CLC_DISR BIT(0) /* Disable request bit */ -+ -+#define SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ -+#define SPI_ID_TXFS_M (0x3F << SPI_ID_TXFS_S) -+#define SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ -+#define SPI_ID_RXFS_M (0x3F << SPI_ID_RXFS_S) -+#define SPI_ID_MOD_S 8 /* Module ID */ -+#define SPI_ID_MOD_M (0xff << SPI_ID_MOD_S) -+#define SPI_ID_CFG_S 5 /* DMA interface support */ -+#define SPI_ID_CFG_M (1 << SPI_ID_CFG_S) -+#define SPI_ID_REV_M 0x1F /* Hardware revision number */ -+ -+#define SPI_CON_BM_S 16 /* Data width selection */ -+#define SPI_CON_BM_M (0x1F << SPI_CON_BM_S) -+#define SPI_CON_EM BIT(24) /* Echo mode */ -+#define SPI_CON_IDLE BIT(23) /* Idle bit value */ -+#define SPI_CON_ENBV BIT(22) /* Enable byte valid control */ -+#define SPI_CON_RUEN BIT(12) /* Receive underflow error enable */ -+#define SPI_CON_TUEN BIT(11) /* Transmit underflow error enable */ -+#define SPI_CON_AEN BIT(10) /* Abort error enable */ -+#define SPI_CON_REN BIT(9) /* Receive overflow error enable */ -+#define SPI_CON_TEN BIT(8) /* Transmit overflow error enable */ -+#define SPI_CON_LB BIT(7) /* Loopback control */ -+#define SPI_CON_PO BIT(6) /* Clock polarity control */ -+#define SPI_CON_PH BIT(5) /* Clock phase control */ -+#define SPI_CON_HB BIT(4) /* Heading control */ -+#define SPI_CON_RXOFF BIT(1) /* Switch receiver off */ -+#define SPI_CON_TXOFF BIT(0) /* Switch transmitter off */ -+ -+#define SPI_STAT_RXBV_S 28 -+#define SPI_STAT_RXBV_M (0x7 << SPI_STAT_RXBV_S) -+#define SPI_STAT_BSY BIT(13) /* Busy flag */ -+#define SPI_STAT_RUE BIT(12) /* Receive underflow error flag */ -+#define SPI_STAT_TUE BIT(11) /* Transmit underflow error flag */ -+#define SPI_STAT_AE BIT(10) /* Abort error flag */ -+#define SPI_STAT_RE BIT(9) /* Receive error flag */ -+#define SPI_STAT_TE BIT(8) /* Transmit error flag */ -+#define SPI_STAT_ME BIT(7) /* Mode error flag */ -+#define SPI_STAT_MS BIT(1) /* Master/slave select bit */ -+#define SPI_STAT_EN BIT(0) /* Enable bit */ -+#define SPI_STAT_ERRORS (SPI_STAT_ME | SPI_STAT_TE | SPI_STAT_RE | \ -+ SPI_STAT_AE | SPI_STAT_TUE | SPI_STAT_RUE) -+ -+#define SPI_WHBSTATE_SETTUE BIT(15) /* Set transmit underflow error flag */ -+#define SPI_WHBSTATE_SETAE BIT(14) /* Set abort error flag */ -+#define SPI_WHBSTATE_SETRE BIT(13) /* Set receive error flag */ -+#define SPI_WHBSTATE_SETTE BIT(12) /* Set transmit error flag */ -+#define SPI_WHBSTATE_CLRTUE BIT(11) /* Clear transmit underflow error flag */ -+#define SPI_WHBSTATE_CLRAE BIT(10) /* Clear abort error flag */ -+#define SPI_WHBSTATE_CLRRE BIT(9) /* Clear receive error flag */ -+#define SPI_WHBSTATE_CLRTE BIT(8) /* Clear transmit error flag */ -+#define SPI_WHBSTATE_SETME BIT(7) /* Set mode error flag */ -+#define SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */ -+#define SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */ -+#define SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */ -+#define SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */ -+#define SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */ -+#define SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */ -+#define SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */ -+#define SPI_WHBSTATE_CLR_ERRORS (SPI_WHBSTATE_CLRRUE | SPI_WHBSTATE_CLRME | \ -+ SPI_WHBSTATE_CLRTE | SPI_WHBSTATE_CLRRE | \ -+ SPI_WHBSTATE_CLRAE | SPI_WHBSTATE_CLRTUE) -+ -+#define SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ -+#define SPI_RXFCON_RXFITL_M (0x3F << SPI_RXFCON_RXFITL_S) -+#define SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ -+#define SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ -+ -+#define SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ -+#define SPI_TXFCON_TXFITL_M (0x3F << SPI_TXFCON_TXFITL_S) -+#define SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ -+#define SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ -+ -+#define SPI_FSTAT_RXFFL_S 0 -+#define SPI_FSTAT_RXFFL_M (0x3f << SPI_FSTAT_RXFFL_S) -+#define SPI_FSTAT_TXFFL_S 8 -+#define SPI_FSTAT_TXFFL_M (0x3f << SPI_FSTAT_TXFFL_S) -+ -+#define SPI_GPOCON_ISCSBN_S 8 -+#define SPI_GPOCON_INVOUTN_S 0 -+ -+#define SPI_FGPO_SETOUTN_S 8 -+#define SPI_FGPO_CLROUTN_S 0 -+ -+#define SPI_RXREQ_RXCNT_M 0xFFFF /* Receive count value */ -+#define SPI_RXCNT_TODO_M 0xFFFF /* Recevie to-do value */ -+ -+#define SPI_IRNEN_TFI BIT(4) /* TX finished interrupt */ -+#define SPI_IRNEN_F BIT(3) /* Frame end interrupt request */ -+#define SPI_IRNEN_E BIT(2) /* Error end interrupt request */ -+#define SPI_IRNEN_T_XWAY BIT(1) /* Transmit end interrupt request */ -+#define SPI_IRNEN_R_XWAY BIT(0) /* Receive end interrupt request */ -+#define SPI_IRNEN_R_XRX BIT(1) /* Transmit end interrupt request */ -+#define SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ -+#define SPI_IRNEN_ALL 0x1F -+ -+struct lantiq_ssc_hwcfg { -+ unsigned int irnen_r; -+ unsigned int irnen_t; -+}; -+ -+struct lantiq_ssc_spi { -+ struct spi_master *master; -+ struct device *dev; -+ void __iomem *regbase; -+ struct clk *spi_clk; -+ struct clk *fpi_clk; -+ const struct lantiq_ssc_hwcfg *hwcfg; -+ -+ spinlock_t lock; -+ struct workqueue_struct *wq; -+ struct work_struct work; -+ -+ const u8 *tx; -+ u8 *rx; -+ unsigned int tx_todo; -+ unsigned int rx_todo; -+ unsigned int bits_per_word; -+ unsigned int speed_hz; -+ unsigned int tx_fifo_size; -+ unsigned int rx_fifo_size; -+ unsigned int base_cs; -+}; -+ -+static u32 lantiq_ssc_readl(const struct lantiq_ssc_spi *spi, u32 reg) -+{ -+ return __raw_readl(spi->regbase + reg); -+} -+ -+static void lantiq_ssc_writel(const struct lantiq_ssc_spi *spi, u32 val, -+ u32 reg) -+{ -+ __raw_writel(val, spi->regbase + reg); -+} -+ -+static void lantiq_ssc_maskl(const struct lantiq_ssc_spi *spi, u32 clr, -+ u32 set, u32 reg) -+{ -+ u32 val = __raw_readl(spi->regbase + reg); -+ -+ val &= ~clr; -+ val |= set; -+ __raw_writel(val, spi->regbase + reg); -+} -+ -+static unsigned int tx_fifo_level(const struct lantiq_ssc_spi *spi) -+{ -+ u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); -+ -+ return (fstat & SPI_FSTAT_TXFFL_M) >> SPI_FSTAT_TXFFL_S; -+} -+ -+static unsigned int rx_fifo_level(const struct lantiq_ssc_spi *spi) -+{ -+ u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); -+ -+ return fstat & SPI_FSTAT_RXFFL_M; -+} -+ -+static unsigned int tx_fifo_free(const struct lantiq_ssc_spi *spi) -+{ -+ return spi->tx_fifo_size - tx_fifo_level(spi); -+} -+ -+static void rx_fifo_reset(const struct lantiq_ssc_spi *spi) -+{ -+ u32 val = spi->rx_fifo_size << SPI_RXFCON_RXFITL_S; -+ -+ val |= SPI_RXFCON_RXFEN | SPI_RXFCON_RXFLU; -+ lantiq_ssc_writel(spi, val, SPI_RXFCON); -+} -+ -+static void tx_fifo_reset(const struct lantiq_ssc_spi *spi) -+{ -+ u32 val = 1 << SPI_TXFCON_TXFITL_S; -+ -+ val |= SPI_TXFCON_TXFEN | SPI_TXFCON_TXFLU; -+ lantiq_ssc_writel(spi, val, SPI_TXFCON); -+} -+ -+static void rx_fifo_flush(const struct lantiq_ssc_spi *spi) -+{ -+ lantiq_ssc_maskl(spi, 0, SPI_RXFCON_RXFLU, SPI_RXFCON); -+} -+ -+static void tx_fifo_flush(const struct lantiq_ssc_spi *spi) -+{ -+ lantiq_ssc_maskl(spi, 0, SPI_TXFCON_TXFLU, SPI_TXFCON); -+} -+ -+static void hw_enter_config_mode(const struct lantiq_ssc_spi *spi) -+{ -+ lantiq_ssc_writel(spi, SPI_WHBSTATE_CLREN, SPI_WHBSTATE); -+} -+ -+static void hw_enter_active_mode(const struct lantiq_ssc_spi *spi) -+{ -+ lantiq_ssc_writel(spi, SPI_WHBSTATE_SETEN, SPI_WHBSTATE); -+} -+ -+static void hw_setup_speed_hz(const struct lantiq_ssc_spi *spi, -+ unsigned int max_speed_hz) -+{ -+ u32 spi_clk, brt; -+ -+ /* -+ * SPI module clock is derived from FPI bus clock dependent on -+ * divider value in CLC.RMS which is always set to 1. -+ * -+ * f_SPI -+ * baudrate = -------------- -+ * 2 * (BR + 1) -+ */ -+ spi_clk = clk_get_rate(spi->fpi_clk) / 2; -+ -+ if (max_speed_hz > spi_clk) -+ brt = 0; -+ else -+ brt = spi_clk / max_speed_hz - 1; -+ -+ if (brt > 0xFFFF) -+ brt = 0xFFFF; -+ -+ dev_dbg(spi->dev, "spi_clk %u, max_speed_hz %u, brt %u\n", -+ spi_clk, max_speed_hz, brt); -+ -+ lantiq_ssc_writel(spi, brt, SPI_BRT); -+} -+ -+static void hw_setup_bits_per_word(const struct lantiq_ssc_spi *spi, -+ unsigned int bits_per_word) -+{ -+ u32 bm; -+ -+ /* CON.BM value = bits_per_word - 1 */ -+ bm = (bits_per_word - 1) << SPI_CON_BM_S; -+ -+ lantiq_ssc_maskl(spi, SPI_CON_BM_M, bm, SPI_CON); -+} -+ -+static void hw_setup_clock_mode(const struct lantiq_ssc_spi *spi, -+ unsigned int mode) -+{ -+ u32 con_set = 0, con_clr = 0; -+ -+ /* -+ * SPI mode mapping in CON register: -+ * Mode CPOL CPHA CON.PO CON.PH -+ * 0 0 0 0 1 -+ * 1 0 1 0 0 -+ * 2 1 0 1 1 -+ * 3 1 1 1 0 -+ */ -+ if (mode & SPI_CPHA) -+ con_clr |= SPI_CON_PH; -+ else -+ con_set |= SPI_CON_PH; -+ -+ if (mode & SPI_CPOL) -+ con_set |= SPI_CON_PO | SPI_CON_IDLE; -+ else -+ con_clr |= SPI_CON_PO | SPI_CON_IDLE; -+ -+ /* Set heading control */ -+ if (mode & SPI_LSB_FIRST) -+ con_clr |= SPI_CON_HB; -+ else -+ con_set |= SPI_CON_HB; -+ -+ /* Set loopback mode */ -+ if (mode & SPI_LOOP) -+ con_set |= SPI_CON_LB; -+ else -+ con_clr |= SPI_CON_LB; -+ -+ lantiq_ssc_maskl(spi, con_clr, con_set, SPI_CON); -+} -+ -+static void lantiq_ssc_hw_init(const struct lantiq_ssc_spi *spi) -+{ -+ const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; -+ -+ /* -+ * Set clock divider for run mode to 1 to -+ * run at same frequency as FPI bus -+ */ -+ lantiq_ssc_writel(spi, 1 << SPI_CLC_RMC_S, SPI_CLC); -+ -+ /* Put controller into config mode */ -+ hw_enter_config_mode(spi); -+ -+ /* Clear error flags */ -+ lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); -+ -+ /* Enable error checking, disable TX/RX */ -+ lantiq_ssc_writel(spi, SPI_CON_RUEN | SPI_CON_AEN | SPI_CON_TEN | -+ SPI_CON_REN | SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); -+ -+ /* Setup default SPI mode */ -+ hw_setup_bits_per_word(spi, spi->bits_per_word); -+ hw_setup_clock_mode(spi, SPI_MODE_0); -+ -+ /* Enable master mode and clear error flags */ -+ lantiq_ssc_writel(spi, SPI_WHBSTATE_SETMS | SPI_WHBSTATE_CLR_ERRORS, -+ SPI_WHBSTATE); -+ -+ /* Reset GPIO/CS registers */ -+ lantiq_ssc_writel(spi, 0, SPI_GPOCON); -+ lantiq_ssc_writel(spi, 0xFF00, SPI_FPGO); -+ -+ /* Enable and flush FIFOs */ -+ rx_fifo_reset(spi); -+ tx_fifo_reset(spi); -+ -+ /* Enable interrupts */ -+ lantiq_ssc_writel(spi, hwcfg->irnen_t | hwcfg->irnen_r | SPI_IRNEN_E, -+ SPI_IRNEN); -+} -+ -+static int lantiq_ssc_setup(struct spi_device *spidev) -+{ -+ struct spi_master *master = spidev->master; -+ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); -+ unsigned int cs = spidev->chip_select; -+ u32 gpocon; -+ -+ /* GPIOs are used for CS */ -+ if (gpio_is_valid(spidev->cs_gpio)) -+ return 0; -+ -+ dev_dbg(spi->dev, "using internal chipselect %u\n", cs); -+ -+ if (cs < spi->base_cs) { -+ dev_err(spi->dev, -+ "chipselect %i too small (min %i)\n", cs, spi->base_cs); -+ return -EINVAL; -+ } -+ -+ /* set GPO pin to CS mode */ -+ gpocon = 1 << ((cs - spi->base_cs) + SPI_GPOCON_ISCSBN_S); -+ -+ /* invert GPO pin */ -+ if (spidev->mode & SPI_CS_HIGH) -+ gpocon |= 1 << (cs - spi->base_cs); -+ -+ lantiq_ssc_maskl(spi, 0, gpocon, SPI_GPOCON); -+ -+ return 0; -+} -+ -+static int lantiq_ssc_prepare_message(struct spi_master *master, -+ struct spi_message *message) -+{ -+ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); -+ -+ hw_enter_config_mode(spi); -+ hw_setup_clock_mode(spi, message->spi->mode); -+ hw_enter_active_mode(spi); -+ -+ return 0; -+} -+ -+static void hw_setup_transfer(struct lantiq_ssc_spi *spi, -+ struct spi_device *spidev, struct spi_transfer *t) -+{ -+ unsigned int speed_hz = t->speed_hz; -+ unsigned int bits_per_word = t->bits_per_word; -+ u32 con; -+ -+ if (bits_per_word != spi->bits_per_word || -+ speed_hz != spi->speed_hz) { -+ hw_enter_config_mode(spi); -+ hw_setup_speed_hz(spi, speed_hz); -+ hw_setup_bits_per_word(spi, bits_per_word); -+ hw_enter_active_mode(spi); -+ -+ spi->speed_hz = speed_hz; -+ spi->bits_per_word = bits_per_word; -+ } -+ -+ /* Configure transmitter and receiver */ -+ con = lantiq_ssc_readl(spi, SPI_CON); -+ if (t->tx_buf) -+ con &= ~SPI_CON_TXOFF; -+ else -+ con |= SPI_CON_TXOFF; -+ -+ if (t->rx_buf) -+ con &= ~SPI_CON_RXOFF; -+ else -+ con |= SPI_CON_RXOFF; -+ -+ lantiq_ssc_writel(spi, con, SPI_CON); -+} -+ -+static int lantiq_ssc_unprepare_message(struct spi_master *master, -+ struct spi_message *message) -+{ -+ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); -+ -+ flush_workqueue(spi->wq); -+ -+ /* Disable transmitter and receiver while idle */ -+ lantiq_ssc_maskl(spi, 0, SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); -+ -+ return 0; -+} -+ -+static void tx_fifo_write(struct lantiq_ssc_spi *spi) -+{ -+ const u8 *tx8; -+ const u16 *tx16; -+ const u32 *tx32; -+ u32 data; -+ unsigned int tx_free = tx_fifo_free(spi); -+ -+ while (spi->tx_todo && tx_free) { -+ switch (spi->bits_per_word) { -+ case 2 ... 8: -+ tx8 = spi->tx; -+ data = *tx8; -+ spi->tx_todo--; -+ spi->tx++; -+ break; -+ case 16: -+ tx16 = (u16 *) spi->tx; -+ data = *tx16; -+ spi->tx_todo -= 2; -+ spi->tx += 2; -+ break; -+ case 32: -+ tx32 = (u32 *) spi->tx; -+ data = *tx32; -+ spi->tx_todo -= 4; -+ spi->tx += 4; -+ break; -+ default: -+ WARN_ON(1); -+ data = 0; -+ break; -+ } -+ -+ lantiq_ssc_writel(spi, data, SPI_TB); -+ tx_free--; -+ } -+} -+ -+static void rx_fifo_read_full_duplex(struct lantiq_ssc_spi *spi) -+{ -+ u8 *rx8; -+ u16 *rx16; -+ u32 *rx32; -+ u32 data; -+ unsigned int rx_fill = rx_fifo_level(spi); -+ -+ while (rx_fill) { -+ data = lantiq_ssc_readl(spi, SPI_RB); -+ -+ switch (spi->bits_per_word) { -+ case 2 ... 8: -+ rx8 = spi->rx; -+ *rx8 = data; -+ spi->rx_todo--; -+ spi->rx++; -+ break; -+ case 16: -+ rx16 = (u16 *) spi->rx; -+ *rx16 = data; -+ spi->rx_todo -= 2; -+ spi->rx += 2; -+ break; -+ case 32: -+ rx32 = (u32 *) spi->rx; -+ *rx32 = data; -+ spi->rx_todo -= 4; -+ spi->rx += 4; -+ break; -+ default: -+ WARN_ON(1); -+ break; -+ } -+ -+ rx_fill--; -+ } -+} -+ -+static void rx_fifo_read_half_duplex(struct lantiq_ssc_spi *spi) -+{ -+ u32 data, *rx32; -+ u8 *rx8; -+ unsigned int rxbv, shift; -+ unsigned int rx_fill = rx_fifo_level(spi); -+ -+ /* -+ * In RX-only mode the bits per word value is ignored by HW. A value -+ * of 32 is used instead. Thus all 4 bytes per FIFO must be read. -+ * If remaining RX bytes are less than 4, the FIFO must be read -+ * differently. The amount of received and valid bytes is indicated -+ * by STAT.RXBV register value. -+ */ -+ while (rx_fill) { -+ if (spi->rx_todo < 4) { -+ rxbv = (lantiq_ssc_readl(spi, SPI_STAT) & -+ SPI_STAT_RXBV_M) >> SPI_STAT_RXBV_S; -+ data = lantiq_ssc_readl(spi, SPI_RB); -+ -+ shift = (rxbv - 1) * 8; -+ rx8 = spi->rx; -+ -+ while (rxbv) { -+ *rx8++ = (data >> shift) & 0xFF; -+ rxbv--; -+ shift -= 8; -+ spi->rx_todo--; -+ spi->rx++; -+ } -+ } else { -+ data = lantiq_ssc_readl(spi, SPI_RB); -+ rx32 = (u32 *) spi->rx; -+ -+ *rx32++ = data; -+ spi->rx_todo -= 4; -+ spi->rx += 4; -+ } -+ rx_fill--; -+ } -+} -+ -+static void rx_request(struct lantiq_ssc_spi *spi) -+{ -+ unsigned int rxreq, rxreq_max; -+ -+ /* -+ * To avoid receive overflows at high clocks it is better to request -+ * only the amount of bytes that fits into all FIFOs. This value -+ * depends on the FIFO size implemented in hardware. -+ */ -+ rxreq = spi->rx_todo; -+ rxreq_max = spi->rx_fifo_size * 4; -+ if (rxreq > rxreq_max) -+ rxreq = rxreq_max; -+ -+ lantiq_ssc_writel(spi, rxreq, SPI_RXREQ); -+} -+ -+static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data) -+{ -+ struct lantiq_ssc_spi *spi = data; -+ -+ if (spi->tx) { -+ if (spi->rx && spi->rx_todo) -+ rx_fifo_read_full_duplex(spi); -+ -+ if (spi->tx_todo) -+ tx_fifo_write(spi); -+ else if (!tx_fifo_level(spi)) -+ goto completed; -+ } else if (spi->rx) { -+ if (spi->rx_todo) { -+ rx_fifo_read_half_duplex(spi); -+ -+ if (spi->rx_todo) -+ rx_request(spi); -+ else -+ goto completed; -+ } else { -+ goto completed; -+ } -+ } -+ -+ return IRQ_HANDLED; -+ -+completed: -+ queue_work(spi->wq, &spi->work); -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data) -+{ -+ struct lantiq_ssc_spi *spi = data; -+ u32 stat = lantiq_ssc_readl(spi, SPI_STAT); -+ -+ if (!(stat & SPI_STAT_ERRORS)) -+ return IRQ_NONE; -+ -+ if (stat & SPI_STAT_RUE) -+ dev_err(spi->dev, "receive underflow error\n"); -+ if (stat & SPI_STAT_TUE) -+ dev_err(spi->dev, "transmit underflow error\n"); -+ if (stat & SPI_STAT_AE) -+ dev_err(spi->dev, "abort error\n"); -+ if (stat & SPI_STAT_RE) -+ dev_err(spi->dev, "receive overflow error\n"); -+ if (stat & SPI_STAT_TE) -+ dev_err(spi->dev, "transmit overflow error\n"); -+ if (stat & SPI_STAT_ME) -+ dev_err(spi->dev, "mode error\n"); -+ -+ /* Clear error flags */ -+ lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); -+ -+ /* set bad status so it can be retried */ -+ if (spi->master->cur_msg) -+ spi->master->cur_msg->status = -EIO; -+ queue_work(spi->wq, &spi->work); -+ -+ return IRQ_HANDLED; -+} -+ -+static int transfer_start(struct lantiq_ssc_spi *spi, struct spi_device *spidev, -+ struct spi_transfer *t) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&spi->lock, flags); -+ -+ spi->tx = t->tx_buf; -+ spi->rx = t->rx_buf; -+ -+ if (t->tx_buf) { -+ spi->tx_todo = t->len; -+ -+ /* initially fill TX FIFO */ -+ tx_fifo_write(spi); -+ } -+ -+ if (spi->rx) { -+ spi->rx_todo = t->len; -+ -+ /* start shift clock in RX-only mode */ -+ if (!spi->tx) -+ rx_request(spi); -+ } -+ -+ spin_unlock_irqrestore(&spi->lock, flags); -+ -+ return t->len; -+} -+ -+/* -+ * The driver only gets an interrupt when the FIFO is empty, but there -+ * is an additional shift register from which the data is written to -+ * the wire. We get the last interrupt when the controller starts to -+ * write the last word to the wire, not when it is finished. Do busy -+ * waiting till it finishes. -+ */ -+static void lantiq_ssc_bussy_work(struct work_struct *work) -+{ -+ struct lantiq_ssc_spi *spi; -+ unsigned long long timeout = 8LL * 1000LL; -+ unsigned long end; -+ -+ spi = container_of(work, typeof(*spi), work); -+ -+ do_div(timeout, spi->speed_hz); -+ timeout += timeout + 100; /* some tolerance */ -+ -+ end = jiffies + msecs_to_jiffies(timeout); -+ do { -+ u32 stat = lantiq_ssc_readl(spi, SPI_STAT); -+ -+ if (!(stat & SPI_STAT_BSY)) { -+ spi_finalize_current_transfer(spi->master); -+ return; -+ } -+ -+ cond_resched(); -+ } while (!time_after_eq(jiffies, end)); -+ -+ if (spi->master->cur_msg) -+ spi->master->cur_msg->status = -EIO; -+ spi_finalize_current_transfer(spi->master); -+} -+ -+static void lantiq_ssc_handle_err(struct spi_master *master, -+ struct spi_message *message) -+{ -+ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); -+ -+ /* flush FIFOs on timeout */ -+ rx_fifo_flush(spi); -+ tx_fifo_flush(spi); -+} -+ -+static void lantiq_ssc_set_cs(struct spi_device *spidev, bool enable) -+{ -+ struct lantiq_ssc_spi *spi = spi_master_get_devdata(spidev->master); -+ unsigned int cs = spidev->chip_select; -+ u32 fgpo; -+ -+ if (!!(spidev->mode & SPI_CS_HIGH) == enable) -+ fgpo = (1 << (cs - spi->base_cs)); -+ else -+ fgpo = (1 << (cs - spi->base_cs + SPI_FGPO_SETOUTN_S)); -+ -+ lantiq_ssc_writel(spi, fgpo, SPI_FPGO); -+} -+ -+static int lantiq_ssc_transfer_one(struct spi_master *master, -+ struct spi_device *spidev, -+ struct spi_transfer *t) -+{ -+ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); -+ -+ hw_setup_transfer(spi, spidev, t); -+ -+ return transfer_start(spi, spidev, t); -+} -+ -+static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = { -+ .irnen_r = SPI_IRNEN_R_XWAY, -+ .irnen_t = SPI_IRNEN_T_XWAY, -+}; -+ -+static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = { -+ .irnen_r = SPI_IRNEN_R_XRX, -+ .irnen_t = SPI_IRNEN_T_XRX, -+}; -+ -+static const struct of_device_id lantiq_ssc_match[] = { -+ { .compatible = "lantiq,ase-spi", .data = &lantiq_ssc_xway, }, -+ { .compatible = "lantiq,falcon-spi", .data = &lantiq_ssc_xrx, }, -+ { .compatible = "lantiq,xrx100-spi", .data = &lantiq_ssc_xrx, }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, lantiq_ssc_match); -+ -+static int lantiq_ssc_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct spi_master *master; -+ struct resource *res; -+ struct lantiq_ssc_spi *spi; -+ const struct lantiq_ssc_hwcfg *hwcfg; -+ const struct of_device_id *match; -+ int err, rx_irq, tx_irq, err_irq; -+ u32 id, supports_dma, revision; -+ unsigned int num_cs; -+ -+ match = of_match_device(lantiq_ssc_match, dev); -+ if (!match) { -+ dev_err(dev, "no device match\n"); -+ return -EINVAL; -+ } -+ hwcfg = match->data; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) { -+ dev_err(dev, "failed to get resources\n"); -+ return -ENXIO; -+ } -+ -+ rx_irq = platform_get_irq_byname(pdev, SPI_RX_IRQ_NAME); -+ if (rx_irq < 0) { -+ dev_err(dev, "failed to get %s\n", SPI_RX_IRQ_NAME); -+ return -ENXIO; -+ } -+ -+ tx_irq = platform_get_irq_byname(pdev, SPI_TX_IRQ_NAME); -+ if (tx_irq < 0) { -+ dev_err(dev, "failed to get %s\n", SPI_TX_IRQ_NAME); -+ return -ENXIO; -+ } -+ -+ err_irq = platform_get_irq_byname(pdev, SPI_ERR_IRQ_NAME); -+ if (err_irq < 0) { -+ dev_err(dev, "failed to get %s\n", SPI_ERR_IRQ_NAME); -+ return -ENXIO; -+ } -+ -+ master = spi_alloc_master(dev, sizeof(struct lantiq_ssc_spi)); -+ if (!master) -+ return -ENOMEM; -+ -+ spi = spi_master_get_devdata(master); -+ spi->master = master; -+ spi->dev = dev; -+ spi->hwcfg = hwcfg; -+ platform_set_drvdata(pdev, spi); -+ -+ spi->regbase = devm_ioremap_resource(dev, res); -+ if (IS_ERR(spi->regbase)) { -+ err = PTR_ERR(spi->regbase); -+ goto err_master_put; -+ } -+ -+ err = devm_request_irq(dev, rx_irq, lantiq_ssc_xmit_interrupt, -+ 0, SPI_RX_IRQ_NAME, spi); -+ if (err) -+ goto err_master_put; -+ -+ err = devm_request_irq(dev, tx_irq, lantiq_ssc_xmit_interrupt, -+ 0, SPI_TX_IRQ_NAME, spi); -+ if (err) -+ goto err_master_put; -+ -+ err = devm_request_irq(dev, err_irq, lantiq_ssc_err_interrupt, -+ 0, SPI_ERR_IRQ_NAME, spi); -+ if (err) -+ goto err_master_put; -+ -+ spi->spi_clk = devm_clk_get(dev, "gate"); -+ if (IS_ERR(spi->spi_clk)) { -+ err = PTR_ERR(spi->spi_clk); -+ goto err_master_put; -+ } -+ err = clk_prepare_enable(spi->spi_clk); -+ if (err) -+ goto err_master_put; -+ -+ /* -+ * Use the old clk_get_fpi() function on Lantiq platform, till it -+ * supports common clk. -+ */ -+#if defined(CONFIG_LANTIQ) && !defined(CONFIG_COMMON_CLK) -+ spi->fpi_clk = clk_get_fpi(); -+#else -+ spi->fpi_clk = clk_get(dev, "freq"); -+#endif -+ if (IS_ERR(spi->fpi_clk)) { -+ err = PTR_ERR(spi->fpi_clk); -+ goto err_clk_disable; -+ } -+ -+ num_cs = 8; -+ of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); -+ -+ spi->base_cs = 1; -+ of_property_read_u32(pdev->dev.of_node, "base-cs", &spi->base_cs); -+ -+ spin_lock_init(&spi->lock); -+ spi->bits_per_word = 8; -+ spi->speed_hz = 0; -+ -+ master->dev.of_node = pdev->dev.of_node; -+ master->num_chipselect = num_cs; -+ master->setup = lantiq_ssc_setup; -+ master->set_cs = lantiq_ssc_set_cs; -+ master->handle_err = lantiq_ssc_handle_err; -+ master->prepare_message = lantiq_ssc_prepare_message; -+ master->unprepare_message = lantiq_ssc_unprepare_message; -+ master->transfer_one = lantiq_ssc_transfer_one; -+ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH | -+ SPI_LOOP; -+ master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) | -+ SPI_BPW_MASK(16) | SPI_BPW_MASK(32); -+ -+ spi->wq = alloc_ordered_workqueue(dev_name(dev), 0); -+ if (!spi->wq) { -+ err = -ENOMEM; -+ goto err_clk_put; -+ } -+ INIT_WORK(&spi->work, lantiq_ssc_bussy_work); -+ -+ id = lantiq_ssc_readl(spi, SPI_ID); -+ spi->tx_fifo_size = (id & SPI_ID_TXFS_M) >> SPI_ID_TXFS_S; -+ spi->rx_fifo_size = (id & SPI_ID_RXFS_M) >> SPI_ID_RXFS_S; -+ supports_dma = (id & SPI_ID_CFG_M) >> SPI_ID_CFG_S; -+ revision = id & SPI_ID_REV_M; -+ -+ lantiq_ssc_hw_init(spi); -+ -+ dev_info(dev, -+ "Lantiq SSC SPI controller (Rev %i, TXFS %u, RXFS %u, DMA %u)\n", -+ revision, spi->tx_fifo_size, spi->rx_fifo_size, supports_dma); -+ -+ err = devm_spi_register_master(dev, master); -+ if (err) { -+ dev_err(dev, "failed to register spi_master\n"); -+ goto err_wq_destroy; -+ } -+ -+ return 0; -+ -+err_wq_destroy: -+ destroy_workqueue(spi->wq); -+err_clk_put: -+ clk_put(spi->fpi_clk); -+err_clk_disable: -+ clk_disable_unprepare(spi->spi_clk); -+err_master_put: -+ spi_master_put(master); -+ -+ return err; -+} -+ -+static int lantiq_ssc_remove(struct platform_device *pdev) -+{ -+ struct lantiq_ssc_spi *spi = platform_get_drvdata(pdev); -+ -+ lantiq_ssc_writel(spi, 0, SPI_IRNEN); -+ lantiq_ssc_writel(spi, 0, SPI_CLC); -+ rx_fifo_flush(spi); -+ tx_fifo_flush(spi); -+ hw_enter_config_mode(spi); -+ -+ destroy_workqueue(spi->wq); -+ clk_disable_unprepare(spi->spi_clk); -+ clk_put(spi->fpi_clk); -+ -+ return 0; -+} -+ -+static struct platform_driver lantiq_ssc_driver = { -+ .probe = lantiq_ssc_probe, -+ .remove = lantiq_ssc_remove, -+ .driver = { -+ .name = "spi-lantiq-ssc", -+ .owner = THIS_MODULE, -+ .of_match_table = lantiq_ssc_match, -+ }, -+}; -+module_platform_driver(lantiq_ssc_driver); -+ -+MODULE_DESCRIPTION("Lantiq SSC SPI controller driver"); -+MODULE_AUTHOR("Daniel Schwierzeck "); -+MODULE_AUTHOR("Hauke Mehrtens "); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:spi-lantiq-ssc"); diff --git a/target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch b/target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch deleted file mode 100644 index e81f97f9d..000000000 --- a/target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch +++ /dev/null @@ -1,28 +0,0 @@ -From ba6e1e39969fa5435127a632757e2906caca7730 Mon Sep 17 00:00:00 2001 -From: kbuild test robot -Date: Mon, 20 Feb 2017 01:33:10 +0800 -Subject: spi: lantiq-ssc: fix platform_no_drv_owner.cocci warnings - -drivers/spi/spi-lantiq-ssc.c:973:3-8: No need to set .owner here. The core will do it. - - Remove .owner field if calls are used which set it automatically - -Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci - -Signed-off-by: Fengguang Wu -Acked-by: Hauke Mehrtens -Signed-off-by: Mark Brown ---- - drivers/spi/spi-lantiq-ssc.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/spi/spi-lantiq-ssc.c -+++ b/drivers/spi/spi-lantiq-ssc.c -@@ -970,7 +970,6 @@ static struct platform_driver lantiq_ssc - .remove = lantiq_ssc_remove, - .driver = { - .name = "spi-lantiq-ssc", -- .owner = THIS_MODULE, - .of_match_table = lantiq_ssc_match, - }, - }; diff --git a/target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch b/target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch deleted file mode 100644 index 9bcde3c08..000000000 --- a/target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch +++ /dev/null @@ -1,723 +0,0 @@ -From 1aa83e0a2821cd7f4e8f3ddb367859f52e468bf1 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 27 Feb 2017 23:21:25 +0100 -Subject: spi: lantiq-ssc: add LTQ_ prefix to defines - -The blackfin architecture has a SPI_STAT define which conflicts with -the define from the spi-lantiq-ssc driver in compile test mode. Fix -this by adding a prefix in front of every define. - -Reported-by: kbuild test robot -Signed-off-by: Hauke Mehrtens -Signed-off-by: Mark Brown ---- - drivers/spi/spi-lantiq-ssc.c | 437 ++++++++++++++++++++++--------------------- - 1 file changed, 222 insertions(+), 215 deletions(-) - ---- a/drivers/spi/spi-lantiq-ssc.c -+++ b/drivers/spi/spi-lantiq-ssc.c -@@ -26,136 +26,140 @@ - #include - #endif - --#define SPI_RX_IRQ_NAME "spi_rx" --#define SPI_TX_IRQ_NAME "spi_tx" --#define SPI_ERR_IRQ_NAME "spi_err" --#define SPI_FRM_IRQ_NAME "spi_frm" -- --#define SPI_CLC 0x00 --#define SPI_PISEL 0x04 --#define SPI_ID 0x08 --#define SPI_CON 0x10 --#define SPI_STAT 0x14 --#define SPI_WHBSTATE 0x18 --#define SPI_TB 0x20 --#define SPI_RB 0x24 --#define SPI_RXFCON 0x30 --#define SPI_TXFCON 0x34 --#define SPI_FSTAT 0x38 --#define SPI_BRT 0x40 --#define SPI_BRSTAT 0x44 --#define SPI_SFCON 0x60 --#define SPI_SFSTAT 0x64 --#define SPI_GPOCON 0x70 --#define SPI_GPOSTAT 0x74 --#define SPI_FPGO 0x78 --#define SPI_RXREQ 0x80 --#define SPI_RXCNT 0x84 --#define SPI_DMACON 0xec --#define SPI_IRNEN 0xf4 --#define SPI_IRNICR 0xf8 --#define SPI_IRNCR 0xfc -- --#define SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ --#define SPI_CLC_SMC_M (0xFF << SPI_CLC_SMC_S) --#define SPI_CLC_RMC_S 8 /* Clock divider for normal run mode */ --#define SPI_CLC_RMC_M (0xFF << SPI_CLC_RMC_S) --#define SPI_CLC_DISS BIT(1) /* Disable status bit */ --#define SPI_CLC_DISR BIT(0) /* Disable request bit */ -- --#define SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ --#define SPI_ID_TXFS_M (0x3F << SPI_ID_TXFS_S) --#define SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ --#define SPI_ID_RXFS_M (0x3F << SPI_ID_RXFS_S) --#define SPI_ID_MOD_S 8 /* Module ID */ --#define SPI_ID_MOD_M (0xff << SPI_ID_MOD_S) --#define SPI_ID_CFG_S 5 /* DMA interface support */ --#define SPI_ID_CFG_M (1 << SPI_ID_CFG_S) --#define SPI_ID_REV_M 0x1F /* Hardware revision number */ -- --#define SPI_CON_BM_S 16 /* Data width selection */ --#define SPI_CON_BM_M (0x1F << SPI_CON_BM_S) --#define SPI_CON_EM BIT(24) /* Echo mode */ --#define SPI_CON_IDLE BIT(23) /* Idle bit value */ --#define SPI_CON_ENBV BIT(22) /* Enable byte valid control */ --#define SPI_CON_RUEN BIT(12) /* Receive underflow error enable */ --#define SPI_CON_TUEN BIT(11) /* Transmit underflow error enable */ --#define SPI_CON_AEN BIT(10) /* Abort error enable */ --#define SPI_CON_REN BIT(9) /* Receive overflow error enable */ --#define SPI_CON_TEN BIT(8) /* Transmit overflow error enable */ --#define SPI_CON_LB BIT(7) /* Loopback control */ --#define SPI_CON_PO BIT(6) /* Clock polarity control */ --#define SPI_CON_PH BIT(5) /* Clock phase control */ --#define SPI_CON_HB BIT(4) /* Heading control */ --#define SPI_CON_RXOFF BIT(1) /* Switch receiver off */ --#define SPI_CON_TXOFF BIT(0) /* Switch transmitter off */ -- --#define SPI_STAT_RXBV_S 28 --#define SPI_STAT_RXBV_M (0x7 << SPI_STAT_RXBV_S) --#define SPI_STAT_BSY BIT(13) /* Busy flag */ --#define SPI_STAT_RUE BIT(12) /* Receive underflow error flag */ --#define SPI_STAT_TUE BIT(11) /* Transmit underflow error flag */ --#define SPI_STAT_AE BIT(10) /* Abort error flag */ --#define SPI_STAT_RE BIT(9) /* Receive error flag */ --#define SPI_STAT_TE BIT(8) /* Transmit error flag */ --#define SPI_STAT_ME BIT(7) /* Mode error flag */ --#define SPI_STAT_MS BIT(1) /* Master/slave select bit */ --#define SPI_STAT_EN BIT(0) /* Enable bit */ --#define SPI_STAT_ERRORS (SPI_STAT_ME | SPI_STAT_TE | SPI_STAT_RE | \ -- SPI_STAT_AE | SPI_STAT_TUE | SPI_STAT_RUE) -- --#define SPI_WHBSTATE_SETTUE BIT(15) /* Set transmit underflow error flag */ --#define SPI_WHBSTATE_SETAE BIT(14) /* Set abort error flag */ --#define SPI_WHBSTATE_SETRE BIT(13) /* Set receive error flag */ --#define SPI_WHBSTATE_SETTE BIT(12) /* Set transmit error flag */ --#define SPI_WHBSTATE_CLRTUE BIT(11) /* Clear transmit underflow error flag */ --#define SPI_WHBSTATE_CLRAE BIT(10) /* Clear abort error flag */ --#define SPI_WHBSTATE_CLRRE BIT(9) /* Clear receive error flag */ --#define SPI_WHBSTATE_CLRTE BIT(8) /* Clear transmit error flag */ --#define SPI_WHBSTATE_SETME BIT(7) /* Set mode error flag */ --#define SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */ --#define SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */ --#define SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */ --#define SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */ --#define SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */ --#define SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */ --#define SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */ --#define SPI_WHBSTATE_CLR_ERRORS (SPI_WHBSTATE_CLRRUE | SPI_WHBSTATE_CLRME | \ -- SPI_WHBSTATE_CLRTE | SPI_WHBSTATE_CLRRE | \ -- SPI_WHBSTATE_CLRAE | SPI_WHBSTATE_CLRTUE) -- --#define SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ --#define SPI_RXFCON_RXFITL_M (0x3F << SPI_RXFCON_RXFITL_S) --#define SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ --#define SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ -- --#define SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ --#define SPI_TXFCON_TXFITL_M (0x3F << SPI_TXFCON_TXFITL_S) --#define SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ --#define SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ -- --#define SPI_FSTAT_RXFFL_S 0 --#define SPI_FSTAT_RXFFL_M (0x3f << SPI_FSTAT_RXFFL_S) --#define SPI_FSTAT_TXFFL_S 8 --#define SPI_FSTAT_TXFFL_M (0x3f << SPI_FSTAT_TXFFL_S) -- --#define SPI_GPOCON_ISCSBN_S 8 --#define SPI_GPOCON_INVOUTN_S 0 -- --#define SPI_FGPO_SETOUTN_S 8 --#define SPI_FGPO_CLROUTN_S 0 -- --#define SPI_RXREQ_RXCNT_M 0xFFFF /* Receive count value */ --#define SPI_RXCNT_TODO_M 0xFFFF /* Recevie to-do value */ -- --#define SPI_IRNEN_TFI BIT(4) /* TX finished interrupt */ --#define SPI_IRNEN_F BIT(3) /* Frame end interrupt request */ --#define SPI_IRNEN_E BIT(2) /* Error end interrupt request */ --#define SPI_IRNEN_T_XWAY BIT(1) /* Transmit end interrupt request */ --#define SPI_IRNEN_R_XWAY BIT(0) /* Receive end interrupt request */ --#define SPI_IRNEN_R_XRX BIT(1) /* Transmit end interrupt request */ --#define SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ --#define SPI_IRNEN_ALL 0x1F -+#define LTQ_SPI_RX_IRQ_NAME "spi_rx" -+#define LTQ_SPI_TX_IRQ_NAME "spi_tx" -+#define LTQ_SPI_ERR_IRQ_NAME "spi_err" -+#define LTQ_SPI_FRM_IRQ_NAME "spi_frm" -+ -+#define LTQ_SPI_CLC 0x00 -+#define LTQ_SPI_PISEL 0x04 -+#define LTQ_SPI_ID 0x08 -+#define LTQ_SPI_CON 0x10 -+#define LTQ_SPI_STAT 0x14 -+#define LTQ_SPI_WHBSTATE 0x18 -+#define LTQ_SPI_TB 0x20 -+#define LTQ_SPI_RB 0x24 -+#define LTQ_SPI_RXFCON 0x30 -+#define LTQ_SPI_TXFCON 0x34 -+#define LTQ_SPI_FSTAT 0x38 -+#define LTQ_SPI_BRT 0x40 -+#define LTQ_SPI_BRSTAT 0x44 -+#define LTQ_SPI_SFCON 0x60 -+#define LTQ_SPI_SFSTAT 0x64 -+#define LTQ_SPI_GPOCON 0x70 -+#define LTQ_SPI_GPOSTAT 0x74 -+#define LTQ_SPI_FPGO 0x78 -+#define LTQ_SPI_RXREQ 0x80 -+#define LTQ_SPI_RXCNT 0x84 -+#define LTQ_SPI_DMACON 0xec -+#define LTQ_SPI_IRNEN 0xf4 -+#define LTQ_SPI_IRNICR 0xf8 -+#define LTQ_SPI_IRNCR 0xfc -+ -+#define LTQ_SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ -+#define LTQ_SPI_CLC_SMC_M (0xFF << LTQ_SPI_CLC_SMC_S) -+#define LTQ_SPI_CLC_RMC_S 8 /* Clock divider for normal run mode */ -+#define LTQ_SPI_CLC_RMC_M (0xFF << LTQ_SPI_CLC_RMC_S) -+#define LTQ_SPI_CLC_DISS BIT(1) /* Disable status bit */ -+#define LTQ_SPI_CLC_DISR BIT(0) /* Disable request bit */ -+ -+#define LTQ_SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ -+#define LTQ_SPI_ID_TXFS_M (0x3F << LTQ_SPI_ID_TXFS_S) -+#define LTQ_SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ -+#define LTQ_SPI_ID_RXFS_M (0x3F << LTQ_SPI_ID_RXFS_S) -+#define LTQ_SPI_ID_MOD_S 8 /* Module ID */ -+#define LTQ_SPI_ID_MOD_M (0xff << LTQ_SPI_ID_MOD_S) -+#define LTQ_SPI_ID_CFG_S 5 /* DMA interface support */ -+#define LTQ_SPI_ID_CFG_M (1 << LTQ_SPI_ID_CFG_S) -+#define LTQ_SPI_ID_REV_M 0x1F /* Hardware revision number */ -+ -+#define LTQ_SPI_CON_BM_S 16 /* Data width selection */ -+#define LTQ_SPI_CON_BM_M (0x1F << LTQ_SPI_CON_BM_S) -+#define LTQ_SPI_CON_EM BIT(24) /* Echo mode */ -+#define LTQ_SPI_CON_IDLE BIT(23) /* Idle bit value */ -+#define LTQ_SPI_CON_ENBV BIT(22) /* Enable byte valid control */ -+#define LTQ_SPI_CON_RUEN BIT(12) /* Receive underflow error enable */ -+#define LTQ_SPI_CON_TUEN BIT(11) /* Transmit underflow error enable */ -+#define LTQ_SPI_CON_AEN BIT(10) /* Abort error enable */ -+#define LTQ_SPI_CON_REN BIT(9) /* Receive overflow error enable */ -+#define LTQ_SPI_CON_TEN BIT(8) /* Transmit overflow error enable */ -+#define LTQ_SPI_CON_LB BIT(7) /* Loopback control */ -+#define LTQ_SPI_CON_PO BIT(6) /* Clock polarity control */ -+#define LTQ_SPI_CON_PH BIT(5) /* Clock phase control */ -+#define LTQ_SPI_CON_HB BIT(4) /* Heading control */ -+#define LTQ_SPI_CON_RXOFF BIT(1) /* Switch receiver off */ -+#define LTQ_SPI_CON_TXOFF BIT(0) /* Switch transmitter off */ -+ -+#define LTQ_SPI_STAT_RXBV_S 28 -+#define LTQ_SPI_STAT_RXBV_M (0x7 << LTQ_SPI_STAT_RXBV_S) -+#define LTQ_SPI_STAT_BSY BIT(13) /* Busy flag */ -+#define LTQ_SPI_STAT_RUE BIT(12) /* Receive underflow error flag */ -+#define LTQ_SPI_STAT_TUE BIT(11) /* Transmit underflow error flag */ -+#define LTQ_SPI_STAT_AE BIT(10) /* Abort error flag */ -+#define LTQ_SPI_STAT_RE BIT(9) /* Receive error flag */ -+#define LTQ_SPI_STAT_TE BIT(8) /* Transmit error flag */ -+#define LTQ_SPI_STAT_ME BIT(7) /* Mode error flag */ -+#define LTQ_SPI_STAT_MS BIT(1) /* Master/slave select bit */ -+#define LTQ_SPI_STAT_EN BIT(0) /* Enable bit */ -+#define LTQ_SPI_STAT_ERRORS (LTQ_SPI_STAT_ME | LTQ_SPI_STAT_TE | \ -+ LTQ_SPI_STAT_RE | LTQ_SPI_STAT_AE | \ -+ LTQ_SPI_STAT_TUE | LTQ_SPI_STAT_RUE) -+ -+#define LTQ_SPI_WHBSTATE_SETTUE BIT(15) /* Set transmit underflow error flag */ -+#define LTQ_SPI_WHBSTATE_SETAE BIT(14) /* Set abort error flag */ -+#define LTQ_SPI_WHBSTATE_SETRE BIT(13) /* Set receive error flag */ -+#define LTQ_SPI_WHBSTATE_SETTE BIT(12) /* Set transmit error flag */ -+#define LTQ_SPI_WHBSTATE_CLRTUE BIT(11) /* Clear transmit underflow error flag */ -+#define LTQ_SPI_WHBSTATE_CLRAE BIT(10) /* Clear abort error flag */ -+#define LTQ_SPI_WHBSTATE_CLRRE BIT(9) /* Clear receive error flag */ -+#define LTQ_SPI_WHBSTATE_CLRTE BIT(8) /* Clear transmit error flag */ -+#define LTQ_SPI_WHBSTATE_SETME BIT(7) /* Set mode error flag */ -+#define LTQ_SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */ -+#define LTQ_SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */ -+#define LTQ_SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */ -+#define LTQ_SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */ -+#define LTQ_SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */ -+#define LTQ_SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */ -+#define LTQ_SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */ -+#define LTQ_SPI_WHBSTATE_CLR_ERRORS (LTQ_SPI_WHBSTATE_CLRRUE | \ -+ LTQ_SPI_WHBSTATE_CLRME | \ -+ LTQ_SPI_WHBSTATE_CLRTE | \ -+ LTQ_SPI_WHBSTATE_CLRRE | \ -+ LTQ_SPI_WHBSTATE_CLRAE | \ -+ LTQ_SPI_WHBSTATE_CLRTUE) -+ -+#define LTQ_SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ -+#define LTQ_SPI_RXFCON_RXFITL_M (0x3F << LTQ_SPI_RXFCON_RXFITL_S) -+#define LTQ_SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ -+#define LTQ_SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ -+ -+#define LTQ_SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ -+#define LTQ_SPI_TXFCON_TXFITL_M (0x3F << LTQ_SPI_TXFCON_TXFITL_S) -+#define LTQ_SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ -+#define LTQ_SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ -+ -+#define LTQ_SPI_FSTAT_RXFFL_S 0 -+#define LTQ_SPI_FSTAT_RXFFL_M (0x3f << LTQ_SPI_FSTAT_RXFFL_S) -+#define LTQ_SPI_FSTAT_TXFFL_S 8 -+#define LTQ_SPI_FSTAT_TXFFL_M (0x3f << LTQ_SPI_FSTAT_TXFFL_S) -+ -+#define LTQ_SPI_GPOCON_ISCSBN_S 8 -+#define LTQ_SPI_GPOCON_INVOUTN_S 0 -+ -+#define LTQ_SPI_FGPO_SETOUTN_S 8 -+#define LTQ_SPI_FGPO_CLROUTN_S 0 -+ -+#define LTQ_SPI_RXREQ_RXCNT_M 0xFFFF /* Receive count value */ -+#define LTQ_SPI_RXCNT_TODO_M 0xFFFF /* Recevie to-do value */ -+ -+#define LTQ_SPI_IRNEN_TFI BIT(4) /* TX finished interrupt */ -+#define LTQ_SPI_IRNEN_F BIT(3) /* Frame end interrupt request */ -+#define LTQ_SPI_IRNEN_E BIT(2) /* Error end interrupt request */ -+#define LTQ_SPI_IRNEN_T_XWAY BIT(1) /* Transmit end interrupt request */ -+#define LTQ_SPI_IRNEN_R_XWAY BIT(0) /* Receive end interrupt request */ -+#define LTQ_SPI_IRNEN_R_XRX BIT(1) /* Transmit end interrupt request */ -+#define LTQ_SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ -+#define LTQ_SPI_IRNEN_ALL 0x1F - - struct lantiq_ssc_hwcfg { - unsigned int irnen_r; -@@ -208,16 +212,16 @@ static void lantiq_ssc_maskl(const struc - - static unsigned int tx_fifo_level(const struct lantiq_ssc_spi *spi) - { -- u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); -+ u32 fstat = lantiq_ssc_readl(spi, LTQ_SPI_FSTAT); - -- return (fstat & SPI_FSTAT_TXFFL_M) >> SPI_FSTAT_TXFFL_S; -+ return (fstat & LTQ_SPI_FSTAT_TXFFL_M) >> LTQ_SPI_FSTAT_TXFFL_S; - } - - static unsigned int rx_fifo_level(const struct lantiq_ssc_spi *spi) - { -- u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); -+ u32 fstat = lantiq_ssc_readl(spi, LTQ_SPI_FSTAT); - -- return fstat & SPI_FSTAT_RXFFL_M; -+ return fstat & LTQ_SPI_FSTAT_RXFFL_M; - } - - static unsigned int tx_fifo_free(const struct lantiq_ssc_spi *spi) -@@ -227,38 +231,38 @@ static unsigned int tx_fifo_free(const s - - static void rx_fifo_reset(const struct lantiq_ssc_spi *spi) - { -- u32 val = spi->rx_fifo_size << SPI_RXFCON_RXFITL_S; -+ u32 val = spi->rx_fifo_size << LTQ_SPI_RXFCON_RXFITL_S; - -- val |= SPI_RXFCON_RXFEN | SPI_RXFCON_RXFLU; -- lantiq_ssc_writel(spi, val, SPI_RXFCON); -+ val |= LTQ_SPI_RXFCON_RXFEN | LTQ_SPI_RXFCON_RXFLU; -+ lantiq_ssc_writel(spi, val, LTQ_SPI_RXFCON); - } - - static void tx_fifo_reset(const struct lantiq_ssc_spi *spi) - { -- u32 val = 1 << SPI_TXFCON_TXFITL_S; -+ u32 val = 1 << LTQ_SPI_TXFCON_TXFITL_S; - -- val |= SPI_TXFCON_TXFEN | SPI_TXFCON_TXFLU; -- lantiq_ssc_writel(spi, val, SPI_TXFCON); -+ val |= LTQ_SPI_TXFCON_TXFEN | LTQ_SPI_TXFCON_TXFLU; -+ lantiq_ssc_writel(spi, val, LTQ_SPI_TXFCON); - } - - static void rx_fifo_flush(const struct lantiq_ssc_spi *spi) - { -- lantiq_ssc_maskl(spi, 0, SPI_RXFCON_RXFLU, SPI_RXFCON); -+ lantiq_ssc_maskl(spi, 0, LTQ_SPI_RXFCON_RXFLU, LTQ_SPI_RXFCON); - } - - static void tx_fifo_flush(const struct lantiq_ssc_spi *spi) - { -- lantiq_ssc_maskl(spi, 0, SPI_TXFCON_TXFLU, SPI_TXFCON); -+ lantiq_ssc_maskl(spi, 0, LTQ_SPI_TXFCON_TXFLU, LTQ_SPI_TXFCON); - } - - static void hw_enter_config_mode(const struct lantiq_ssc_spi *spi) - { -- lantiq_ssc_writel(spi, SPI_WHBSTATE_CLREN, SPI_WHBSTATE); -+ lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_CLREN, LTQ_SPI_WHBSTATE); - } - - static void hw_enter_active_mode(const struct lantiq_ssc_spi *spi) - { -- lantiq_ssc_writel(spi, SPI_WHBSTATE_SETEN, SPI_WHBSTATE); -+ lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_SETEN, LTQ_SPI_WHBSTATE); - } - - static void hw_setup_speed_hz(const struct lantiq_ssc_spi *spi, -@@ -287,7 +291,7 @@ static void hw_setup_speed_hz(const stru - dev_dbg(spi->dev, "spi_clk %u, max_speed_hz %u, brt %u\n", - spi_clk, max_speed_hz, brt); - -- lantiq_ssc_writel(spi, brt, SPI_BRT); -+ lantiq_ssc_writel(spi, brt, LTQ_SPI_BRT); - } - - static void hw_setup_bits_per_word(const struct lantiq_ssc_spi *spi, -@@ -296,9 +300,9 @@ static void hw_setup_bits_per_word(const - u32 bm; - - /* CON.BM value = bits_per_word - 1 */ -- bm = (bits_per_word - 1) << SPI_CON_BM_S; -+ bm = (bits_per_word - 1) << LTQ_SPI_CON_BM_S; - -- lantiq_ssc_maskl(spi, SPI_CON_BM_M, bm, SPI_CON); -+ lantiq_ssc_maskl(spi, LTQ_SPI_CON_BM_M, bm, LTQ_SPI_CON); - } - - static void hw_setup_clock_mode(const struct lantiq_ssc_spi *spi, -@@ -315,28 +319,28 @@ static void hw_setup_clock_mode(const st - * 3 1 1 1 0 - */ - if (mode & SPI_CPHA) -- con_clr |= SPI_CON_PH; -+ con_clr |= LTQ_SPI_CON_PH; - else -- con_set |= SPI_CON_PH; -+ con_set |= LTQ_SPI_CON_PH; - - if (mode & SPI_CPOL) -- con_set |= SPI_CON_PO | SPI_CON_IDLE; -+ con_set |= LTQ_SPI_CON_PO | LTQ_SPI_CON_IDLE; - else -- con_clr |= SPI_CON_PO | SPI_CON_IDLE; -+ con_clr |= LTQ_SPI_CON_PO | LTQ_SPI_CON_IDLE; - - /* Set heading control */ - if (mode & SPI_LSB_FIRST) -- con_clr |= SPI_CON_HB; -+ con_clr |= LTQ_SPI_CON_HB; - else -- con_set |= SPI_CON_HB; -+ con_set |= LTQ_SPI_CON_HB; - - /* Set loopback mode */ - if (mode & SPI_LOOP) -- con_set |= SPI_CON_LB; -+ con_set |= LTQ_SPI_CON_LB; - else -- con_clr |= SPI_CON_LB; -+ con_clr |= LTQ_SPI_CON_LB; - -- lantiq_ssc_maskl(spi, con_clr, con_set, SPI_CON); -+ lantiq_ssc_maskl(spi, con_clr, con_set, LTQ_SPI_CON); - } - - static void lantiq_ssc_hw_init(const struct lantiq_ssc_spi *spi) -@@ -347,37 +351,39 @@ static void lantiq_ssc_hw_init(const str - * Set clock divider for run mode to 1 to - * run at same frequency as FPI bus - */ -- lantiq_ssc_writel(spi, 1 << SPI_CLC_RMC_S, SPI_CLC); -+ lantiq_ssc_writel(spi, 1 << LTQ_SPI_CLC_RMC_S, LTQ_SPI_CLC); - - /* Put controller into config mode */ - hw_enter_config_mode(spi); - - /* Clear error flags */ -- lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); -+ lantiq_ssc_maskl(spi, 0, LTQ_SPI_WHBSTATE_CLR_ERRORS, LTQ_SPI_WHBSTATE); - - /* Enable error checking, disable TX/RX */ -- lantiq_ssc_writel(spi, SPI_CON_RUEN | SPI_CON_AEN | SPI_CON_TEN | -- SPI_CON_REN | SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); -+ lantiq_ssc_writel(spi, LTQ_SPI_CON_RUEN | LTQ_SPI_CON_AEN | -+ LTQ_SPI_CON_TEN | LTQ_SPI_CON_REN | LTQ_SPI_CON_TXOFF | -+ LTQ_SPI_CON_RXOFF, LTQ_SPI_CON); - - /* Setup default SPI mode */ - hw_setup_bits_per_word(spi, spi->bits_per_word); - hw_setup_clock_mode(spi, SPI_MODE_0); - - /* Enable master mode and clear error flags */ -- lantiq_ssc_writel(spi, SPI_WHBSTATE_SETMS | SPI_WHBSTATE_CLR_ERRORS, -- SPI_WHBSTATE); -+ lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_SETMS | -+ LTQ_SPI_WHBSTATE_CLR_ERRORS, -+ LTQ_SPI_WHBSTATE); - - /* Reset GPIO/CS registers */ -- lantiq_ssc_writel(spi, 0, SPI_GPOCON); -- lantiq_ssc_writel(spi, 0xFF00, SPI_FPGO); -+ lantiq_ssc_writel(spi, 0, LTQ_SPI_GPOCON); -+ lantiq_ssc_writel(spi, 0xFF00, LTQ_SPI_FPGO); - - /* Enable and flush FIFOs */ - rx_fifo_reset(spi); - tx_fifo_reset(spi); - - /* Enable interrupts */ -- lantiq_ssc_writel(spi, hwcfg->irnen_t | hwcfg->irnen_r | SPI_IRNEN_E, -- SPI_IRNEN); -+ lantiq_ssc_writel(spi, hwcfg->irnen_t | hwcfg->irnen_r | -+ LTQ_SPI_IRNEN_E, LTQ_SPI_IRNEN); - } - - static int lantiq_ssc_setup(struct spi_device *spidev) -@@ -400,13 +406,13 @@ static int lantiq_ssc_setup(struct spi_d - } - - /* set GPO pin to CS mode */ -- gpocon = 1 << ((cs - spi->base_cs) + SPI_GPOCON_ISCSBN_S); -+ gpocon = 1 << ((cs - spi->base_cs) + LTQ_SPI_GPOCON_ISCSBN_S); - - /* invert GPO pin */ - if (spidev->mode & SPI_CS_HIGH) - gpocon |= 1 << (cs - spi->base_cs); - -- lantiq_ssc_maskl(spi, 0, gpocon, SPI_GPOCON); -+ lantiq_ssc_maskl(spi, 0, gpocon, LTQ_SPI_GPOCON); - - return 0; - } -@@ -442,18 +448,18 @@ static void hw_setup_transfer(struct lan - } - - /* Configure transmitter and receiver */ -- con = lantiq_ssc_readl(spi, SPI_CON); -+ con = lantiq_ssc_readl(spi, LTQ_SPI_CON); - if (t->tx_buf) -- con &= ~SPI_CON_TXOFF; -+ con &= ~LTQ_SPI_CON_TXOFF; - else -- con |= SPI_CON_TXOFF; -+ con |= LTQ_SPI_CON_TXOFF; - - if (t->rx_buf) -- con &= ~SPI_CON_RXOFF; -+ con &= ~LTQ_SPI_CON_RXOFF; - else -- con |= SPI_CON_RXOFF; -+ con |= LTQ_SPI_CON_RXOFF; - -- lantiq_ssc_writel(spi, con, SPI_CON); -+ lantiq_ssc_writel(spi, con, LTQ_SPI_CON); - } - - static int lantiq_ssc_unprepare_message(struct spi_master *master, -@@ -464,7 +470,8 @@ static int lantiq_ssc_unprepare_message( - flush_workqueue(spi->wq); - - /* Disable transmitter and receiver while idle */ -- lantiq_ssc_maskl(spi, 0, SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); -+ lantiq_ssc_maskl(spi, 0, LTQ_SPI_CON_TXOFF | LTQ_SPI_CON_RXOFF, -+ LTQ_SPI_CON); - - return 0; - } -@@ -503,7 +510,7 @@ static void tx_fifo_write(struct lantiq_ - break; - } - -- lantiq_ssc_writel(spi, data, SPI_TB); -+ lantiq_ssc_writel(spi, data, LTQ_SPI_TB); - tx_free--; - } - } -@@ -517,7 +524,7 @@ static void rx_fifo_read_full_duplex(str - unsigned int rx_fill = rx_fifo_level(spi); - - while (rx_fill) { -- data = lantiq_ssc_readl(spi, SPI_RB); -+ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); - - switch (spi->bits_per_word) { - case 2 ... 8: -@@ -563,9 +570,9 @@ static void rx_fifo_read_half_duplex(str - */ - while (rx_fill) { - if (spi->rx_todo < 4) { -- rxbv = (lantiq_ssc_readl(spi, SPI_STAT) & -- SPI_STAT_RXBV_M) >> SPI_STAT_RXBV_S; -- data = lantiq_ssc_readl(spi, SPI_RB); -+ rxbv = (lantiq_ssc_readl(spi, LTQ_SPI_STAT) & -+ LTQ_SPI_STAT_RXBV_M) >> LTQ_SPI_STAT_RXBV_S; -+ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); - - shift = (rxbv - 1) * 8; - rx8 = spi->rx; -@@ -578,7 +585,7 @@ static void rx_fifo_read_half_duplex(str - spi->rx++; - } - } else { -- data = lantiq_ssc_readl(spi, SPI_RB); -+ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); - rx32 = (u32 *) spi->rx; - - *rx32++ = data; -@@ -603,7 +610,7 @@ static void rx_request(struct lantiq_ssc - if (rxreq > rxreq_max) - rxreq = rxreq_max; - -- lantiq_ssc_writel(spi, rxreq, SPI_RXREQ); -+ lantiq_ssc_writel(spi, rxreq, LTQ_SPI_RXREQ); - } - - static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data) -@@ -642,26 +649,26 @@ completed: - static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data) - { - struct lantiq_ssc_spi *spi = data; -- u32 stat = lantiq_ssc_readl(spi, SPI_STAT); -+ u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT); - -- if (!(stat & SPI_STAT_ERRORS)) -+ if (!(stat & LTQ_SPI_STAT_ERRORS)) - return IRQ_NONE; - -- if (stat & SPI_STAT_RUE) -+ if (stat & LTQ_SPI_STAT_RUE) - dev_err(spi->dev, "receive underflow error\n"); -- if (stat & SPI_STAT_TUE) -+ if (stat & LTQ_SPI_STAT_TUE) - dev_err(spi->dev, "transmit underflow error\n"); -- if (stat & SPI_STAT_AE) -+ if (stat & LTQ_SPI_STAT_AE) - dev_err(spi->dev, "abort error\n"); -- if (stat & SPI_STAT_RE) -+ if (stat & LTQ_SPI_STAT_RE) - dev_err(spi->dev, "receive overflow error\n"); -- if (stat & SPI_STAT_TE) -+ if (stat & LTQ_SPI_STAT_TE) - dev_err(spi->dev, "transmit overflow error\n"); -- if (stat & SPI_STAT_ME) -+ if (stat & LTQ_SPI_STAT_ME) - dev_err(spi->dev, "mode error\n"); - - /* Clear error flags */ -- lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); -+ lantiq_ssc_maskl(spi, 0, LTQ_SPI_WHBSTATE_CLR_ERRORS, LTQ_SPI_WHBSTATE); - - /* set bad status so it can be retried */ - if (spi->master->cur_msg) -@@ -721,9 +728,9 @@ static void lantiq_ssc_bussy_work(struct - - end = jiffies + msecs_to_jiffies(timeout); - do { -- u32 stat = lantiq_ssc_readl(spi, SPI_STAT); -+ u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT); - -- if (!(stat & SPI_STAT_BSY)) { -+ if (!(stat & LTQ_SPI_STAT_BSY)) { - spi_finalize_current_transfer(spi->master); - return; - } -@@ -755,9 +762,9 @@ static void lantiq_ssc_set_cs(struct spi - if (!!(spidev->mode & SPI_CS_HIGH) == enable) - fgpo = (1 << (cs - spi->base_cs)); - else -- fgpo = (1 << (cs - spi->base_cs + SPI_FGPO_SETOUTN_S)); -+ fgpo = (1 << (cs - spi->base_cs + LTQ_SPI_FGPO_SETOUTN_S)); - -- lantiq_ssc_writel(spi, fgpo, SPI_FPGO); -+ lantiq_ssc_writel(spi, fgpo, LTQ_SPI_FPGO); - } - - static int lantiq_ssc_transfer_one(struct spi_master *master, -@@ -772,13 +779,13 @@ static int lantiq_ssc_transfer_one(struc - } - - static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = { -- .irnen_r = SPI_IRNEN_R_XWAY, -- .irnen_t = SPI_IRNEN_T_XWAY, -+ .irnen_r = LTQ_SPI_IRNEN_R_XWAY, -+ .irnen_t = LTQ_SPI_IRNEN_T_XWAY, - }; - - static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = { -- .irnen_r = SPI_IRNEN_R_XRX, -- .irnen_t = SPI_IRNEN_T_XRX, -+ .irnen_r = LTQ_SPI_IRNEN_R_XRX, -+ .irnen_t = LTQ_SPI_IRNEN_T_XRX, - }; - - static const struct of_device_id lantiq_ssc_match[] = { -@@ -814,21 +821,21 @@ static int lantiq_ssc_probe(struct platf - return -ENXIO; - } - -- rx_irq = platform_get_irq_byname(pdev, SPI_RX_IRQ_NAME); -+ rx_irq = platform_get_irq_byname(pdev, LTQ_SPI_RX_IRQ_NAME); - if (rx_irq < 0) { -- dev_err(dev, "failed to get %s\n", SPI_RX_IRQ_NAME); -+ dev_err(dev, "failed to get %s\n", LTQ_SPI_RX_IRQ_NAME); - return -ENXIO; - } - -- tx_irq = platform_get_irq_byname(pdev, SPI_TX_IRQ_NAME); -+ tx_irq = platform_get_irq_byname(pdev, LTQ_SPI_TX_IRQ_NAME); - if (tx_irq < 0) { -- dev_err(dev, "failed to get %s\n", SPI_TX_IRQ_NAME); -+ dev_err(dev, "failed to get %s\n", LTQ_SPI_TX_IRQ_NAME); - return -ENXIO; - } - -- err_irq = platform_get_irq_byname(pdev, SPI_ERR_IRQ_NAME); -+ err_irq = platform_get_irq_byname(pdev, LTQ_SPI_ERR_IRQ_NAME); - if (err_irq < 0) { -- dev_err(dev, "failed to get %s\n", SPI_ERR_IRQ_NAME); -+ dev_err(dev, "failed to get %s\n", LTQ_SPI_ERR_IRQ_NAME); - return -ENXIO; - } - -@@ -849,17 +856,17 @@ static int lantiq_ssc_probe(struct platf - } - - err = devm_request_irq(dev, rx_irq, lantiq_ssc_xmit_interrupt, -- 0, SPI_RX_IRQ_NAME, spi); -+ 0, LTQ_SPI_RX_IRQ_NAME, spi); - if (err) - goto err_master_put; - - err = devm_request_irq(dev, tx_irq, lantiq_ssc_xmit_interrupt, -- 0, SPI_TX_IRQ_NAME, spi); -+ 0, LTQ_SPI_TX_IRQ_NAME, spi); - if (err) - goto err_master_put; - - err = devm_request_irq(dev, err_irq, lantiq_ssc_err_interrupt, -- 0, SPI_ERR_IRQ_NAME, spi); -+ 0, LTQ_SPI_ERR_IRQ_NAME, spi); - if (err) - goto err_master_put; - -@@ -916,11 +923,11 @@ static int lantiq_ssc_probe(struct platf - } - INIT_WORK(&spi->work, lantiq_ssc_bussy_work); - -- id = lantiq_ssc_readl(spi, SPI_ID); -- spi->tx_fifo_size = (id & SPI_ID_TXFS_M) >> SPI_ID_TXFS_S; -- spi->rx_fifo_size = (id & SPI_ID_RXFS_M) >> SPI_ID_RXFS_S; -- supports_dma = (id & SPI_ID_CFG_M) >> SPI_ID_CFG_S; -- revision = id & SPI_ID_REV_M; -+ id = lantiq_ssc_readl(spi, LTQ_SPI_ID); -+ spi->tx_fifo_size = (id & LTQ_SPI_ID_TXFS_M) >> LTQ_SPI_ID_TXFS_S; -+ spi->rx_fifo_size = (id & LTQ_SPI_ID_RXFS_M) >> LTQ_SPI_ID_RXFS_S; -+ supports_dma = (id & LTQ_SPI_ID_CFG_M) >> LTQ_SPI_ID_CFG_S; -+ revision = id & LTQ_SPI_ID_REV_M; - - lantiq_ssc_hw_init(spi); - -@@ -952,8 +959,8 @@ static int lantiq_ssc_remove(struct plat - { - struct lantiq_ssc_spi *spi = platform_get_drvdata(pdev); - -- lantiq_ssc_writel(spi, 0, SPI_IRNEN); -- lantiq_ssc_writel(spi, 0, SPI_CLC); -+ lantiq_ssc_writel(spi, 0, LTQ_SPI_IRNEN); -+ lantiq_ssc_writel(spi, 0, LTQ_SPI_CLC); - rx_fifo_flush(spi); - tx_fifo_flush(spi); - hw_enter_config_mode(spi); diff --git a/target/linux/lantiq/patches-4.9/0101-find_active_root.patch b/target/linux/lantiq/patches-4.9/0101-find_active_root.patch deleted file mode 100644 index 73361c87f..000000000 --- a/target/linux/lantiq/patches-4.9/0101-find_active_root.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- a/drivers/mtd/ofpart.c -+++ b/drivers/mtd/ofpart.c -@@ -25,6 +25,38 @@ static bool node_has_compatible(struct d - return of_get_property(pp, "compatible", NULL); - } - -+static uint8_t * brnboot_get_selected_root_part(struct mtd_info *master, -+ loff_t offset) -+{ -+ static uint8_t root_id; -+ int err, len; -+ -+ err = mtd_read(master, offset, 0x01, &len, &root_id); -+ -+ if (mtd_is_bitflip(err) || !err) -+ return &root_id; -+ -+ return NULL; -+} -+ -+static void brnboot_set_active_root_part(struct mtd_partition *pparts, -+ struct device_node **part_nodes, -+ int nr_parts, -+ uint8_t *root_id) -+{ -+ int i; -+ -+ for (i = 0; i < nr_parts; i++) { -+ int part_root_id; -+ -+ if (!of_property_read_u32(part_nodes[i], "brnboot,root-id", &part_root_id) -+ && part_root_id == *root_id) { -+ pparts[i].name = "firmware"; -+ break; -+ } -+ } -+} -+ - static int parse_fixed_partitions(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -36,7 +68,8 @@ static int parse_fixed_partitions(struct - struct device_node *pp; - int nr_parts, i, ret = 0; - bool dedicated = true; -- -+ uint8_t *proot_id = NULL; -+ struct device_node **part_nodes; - - /* Pull of_node from the master device node */ - mtd_node = mtd_get_of_node(master); -@@ -72,7 +105,9 @@ static int parse_fixed_partitions(struct - return 0; - - parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL); -- if (!parts) -+ part_nodes = kzalloc(nr_parts * sizeof(*part_nodes), GFP_KERNEL); -+ -+ if (!parts || !part_nodes) - return -ENOMEM; - - i = 0; -@@ -121,12 +156,22 @@ static int parse_fixed_partitions(struct - if (of_get_property(pp, "lock", &len)) - parts[i].mask_flags |= MTD_POWERUP_LOCK; - -+ if (!proot_id && of_device_is_compatible(pp, "brnboot,root-selector")) -+ proot_id = brnboot_get_selected_root_part(master, parts[i].offset); -+ -+ part_nodes[i] = pp; -+ - i++; - } - - if (!nr_parts) - goto ofpart_none; - -+ if (proot_id) -+ brnboot_set_active_root_part(parts, part_nodes, nr_parts, proot_id); -+ -+ kfree(part_nodes); -+ - *pparts = parts; - return nr_parts; - -@@ -137,6 +182,7 @@ ofpart_fail: - ofpart_none: - of_node_put(pp); - kfree(parts); -+ kfree(part_nodes); - return ret; - } - diff --git a/target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch b/target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch deleted file mode 100644 index 03d43c241..000000000 --- a/target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- a/arch/mips/pci/ifxmips_pcie.c -+++ b/arch/mips/pci/ifxmips_pcie.c -@@ -18,6 +18,9 @@ - #include - #include - -+#include -+#include -+ - #include "ifxmips_pcie.h" - #include "ifxmips_pcie_reg.h" - -@@ -40,6 +43,7 @@ - static DEFINE_SPINLOCK(ifx_pcie_lock); - - u32 g_pcie_debug_flag = PCIE_MSG_ANY & (~PCIE_MSG_CFG); -+static int pcie_reset_gpio; - - static ifx_pcie_irq_t pcie_irqs[IFX_PCIE_CORE_NR] = { - { -@@ -82,6 +86,22 @@ void ifx_pcie_debug(const char *fmt, ... - printk("%s", buf); - } - -+static inline void pcie_ep_gpio_rst_init(int pcie_port) -+{ -+ gpio_direction_output(pcie_reset_gpio, 1); -+ gpio_set_value(pcie_reset_gpio, 1); -+} -+ -+static inline void pcie_device_rst_assert(int pcie_port) -+{ -+ gpio_set_value(pcie_reset_gpio, 0); -+} -+ -+static inline void pcie_device_rst_deassert(int pcie_port) -+{ -+ mdelay(100); -+ gpio_direction_output(pcie_reset_gpio, 1); -+} - - static inline int pcie_ltssm_enable(int pcie_port) - { -@@ -1045,8 +1065,9 @@ pcie_rc_initialize(int pcie_port) - return 0; - } - --static int __init ifx_pcie_bios_init(void) -+static int ifx_pcie_bios_probe(struct platform_device *pdev) - { -+ struct device_node *node = pdev->dev.of_node; - void __iomem *io_map_base; - int pcie_port; - int startup_port; -@@ -1055,7 +1076,17 @@ static int __init ifx_pcie_bios_init(voi - pcie_ahb_pmu_setup(); - - startup_port = IFX_PCIE_PORT0; -- -+ -+ pcie_reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); -+ if (gpio_is_valid(pcie_reset_gpio)) { -+ int ret = devm_gpio_request(&pdev->dev, pcie_reset_gpio, "pcie-reset"); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio %d\n", pcie_reset_gpio); -+ return ret; -+ } -+ gpio_direction_output(pcie_reset_gpio, 1); -+ } -+ - for (pcie_port = startup_port; pcie_port < IFX_PCIE_CORE_NR; pcie_port++){ - if (pcie_rc_initialize(pcie_port) == 0) { - IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: ifx_pcie_cfg_base 0x%p\n", -@@ -1067,6 +1098,7 @@ static int __init ifx_pcie_bios_init(voi - return -ENOMEM; - } - ifx_pcie_controller[pcie_port].pcic.io_map_base = (unsigned long)io_map_base; -+ pci_load_of_ranges(&ifx_pcie_controller[pcie_port].pcic, node); - - register_pci_controller(&ifx_pcie_controller[pcie_port].pcic); - /* XXX, clear error status */ -@@ -1083,6 +1115,30 @@ static int __init ifx_pcie_bios_init(voi - - return 0; - } -+ -+static const struct of_device_id ifxmips_pcie_match[] = { -+ { .compatible = "lantiq,pcie-xrx200" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ifxmips_pcie_match); -+ -+static struct platform_driver ltq_pci_driver = { -+ .probe = ifx_pcie_bios_probe, -+ .driver = { -+ .name = "pcie-xrx200", -+ .owner = THIS_MODULE, -+ .of_match_table = ifxmips_pcie_match, -+ }, -+}; -+ -+int __init ifx_pcie_bios_init(void) -+{ -+ int ret = platform_driver_register(<q_pci_driver); -+ if (ret) -+ pr_info("pcie-xrx200: Error registering platform driver!"); -+ return ret; -+} -+ - arch_initcall(ifx_pcie_bios_init); - - MODULE_LICENSE("GPL"); ---- a/arch/mips/pci/ifxmips_pcie_vr9.h -+++ b/arch/mips/pci/ifxmips_pcie_vr9.h -@@ -22,8 +22,6 @@ - #include - #include - --#define IFX_PCIE_GPIO_RESET 494 -- - #define IFX_REG_R32 ltq_r32 - #define IFX_REG_W32 ltq_w32 - #define CONFIG_IFX_PCIE_HW_SWAP -@@ -53,21 +51,6 @@ - #define OUT ((volatile u32*)(IFX_GPIO + 0x0070)) - - --static inline void pcie_ep_gpio_rst_init(int pcie_port) --{ -- -- gpio_request(IFX_PCIE_GPIO_RESET, "pcie-reset"); -- gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); -- gpio_set_value(IFX_PCIE_GPIO_RESET, 1); -- --/* ifx_gpio_pin_reserve(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -- ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -- ifx_gpio_dir_out_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -- ifx_gpio_altsel0_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -- ifx_gpio_altsel1_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); -- ifx_gpio_open_drain_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id);*/ --} -- - static inline void pcie_ahb_pmu_setup(void) - { - /* Enable AHB bus master/slave */ -@@ -180,20 +163,6 @@ static inline void pcie_phy_rst_deassert - IFX_REG_W32(reg, IFX_RCU_RST_REQ); - } - --static inline void pcie_device_rst_assert(int pcie_port) --{ -- gpio_set_value(IFX_PCIE_GPIO_RESET, 0); --// ifx_gpio_output_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); --} -- --static inline void pcie_device_rst_deassert(int pcie_port) --{ -- mdelay(100); -- gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); --// gpio_set_value(IFX_PCIE_GPIO_RESET, 1); -- //ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); --} -- - static inline void pcie_core_pmu_setup(int pcie_port) - { - struct clk *clk; diff --git a/target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch deleted file mode 100644 index 7d6e4b808..000000000 --- a/target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch +++ /dev/null @@ -1,180 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -2321,6 +2321,12 @@ config MIPS_VPE_LOADER - Includes a loader for loading an elf relocatable object - onto another VPE and running it. - -+config IFX_VPE_EXT -+ bool "IFX APRP Extensions" -+ depends on MIPS_VPE_LOADER -+ help -+ IFX included extensions in APRP -+ - config MIPS_VPE_LOADER_CMP - bool - default "y" ---- a/arch/mips/include/asm/vpe.h -+++ b/arch/mips/include/asm/vpe.h -@@ -127,4 +127,13 @@ void cleanup_tc(struct tc *tc); - - int __init vpe_module_init(void); - void __exit vpe_module_exit(void); -+ -+/* For the explanation of the APIs please refer the section "MT APRP Kernel -+ * Programming" in AR9 SW Architecture Specification -+ */ -+int32_t vpe1_sw_start(void *sw_start_addr, uint32_t tcmask, uint32_t flags); -+int32_t vpe1_sw_stop(uint32_t flags); -+uint32_t vpe1_get_load_addr(uint32_t flags); -+uint32_t vpe1_get_max_mem(uint32_t flags); -+ - #endif /* _ASM_VPE_H */ ---- a/arch/mips/kernel/vpe-mt.c -+++ b/arch/mips/kernel/vpe-mt.c -@@ -29,6 +29,7 @@ int vpe_run(struct vpe *v) - struct vpe_notifications *notifier; - unsigned int vpeflags; - struct tc *t; -+ unsigned long physical_memsize = 0L; - - /* check we are the Master VPE */ - local_irq_save(flags); -@@ -417,6 +418,8 @@ int __init vpe_module_init(void) - } - - v->ntcs = hw_tcs - aprp_cpu_index(); -+ write_tc_c0_tcbind((read_tc_c0_tcbind() & -+ ~TCBIND_CURVPE) | 1); - - /* add the tc to the list of this vpe's tc's. */ - list_add(&t->tc, &v->tc); -@@ -519,3 +522,47 @@ void __exit vpe_module_exit(void) - release_vpe(v); - } - } -+ -+#ifdef CONFIG_IFX_VPE_EXT -+int32_t vpe1_sw_start(void *sw_start_addr, uint32_t tcmask, uint32_t flags) -+{ -+ enum vpe_state state; -+ struct vpe *v = get_vpe(tclimit); -+ struct vpe_notifications *not; -+ -+ if (tcmask || flags) { -+ pr_warn("Currently tcmask and flags should be 0. Other values are not supported\n"); -+ return -1; -+ } -+ -+ state = xchg(&v->state, VPE_STATE_INUSE); -+ if (state != VPE_STATE_UNUSED) { -+ vpe_stop(v); -+ -+ list_for_each_entry(not, &v->notify, list) { -+ not->stop(tclimit); -+ } -+ } -+ -+ v->__start = (unsigned long)sw_start_addr; -+ -+ if (!vpe_run(v)) { -+ pr_debug("VPE loader: VPE1 running successfully\n"); -+ return 0; -+ } -+ return -1; -+} -+EXPORT_SYMBOL(vpe1_sw_start); -+ -+int32_t vpe1_sw_stop(uint32_t flags) -+{ -+ struct vpe *v = get_vpe(tclimit); -+ -+ if (!vpe_free(v)) { -+ pr_debug("RP Stopped\n"); -+ return 0; -+ } else -+ return -1; -+} -+EXPORT_SYMBOL(vpe1_sw_stop); -+#endif ---- a/arch/mips/kernel/vpe.c -+++ b/arch/mips/kernel/vpe.c -@@ -49,6 +49,41 @@ struct vpe_control vpecontrol = { - .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list) - }; - -+#ifdef CONFIG_IFX_VPE_EXT -+unsigned int vpe1_load_addr; -+ -+static int __init load_address(char *str) -+{ -+ get_option(&str, &vpe1_load_addr); -+ return 1; -+} -+__setup("vpe1_load_addr=", load_address); -+ -+static unsigned int vpe1_mem; -+static int __init vpe1mem(char *str) -+{ -+ vpe1_mem = memparse(str, &str); -+ return 1; -+} -+__setup("vpe1_mem=", vpe1mem); -+ -+uint32_t vpe1_get_load_addr(uint32_t flags) -+{ -+ return vpe1_load_addr; -+} -+EXPORT_SYMBOL(vpe1_get_load_addr); -+ -+uint32_t vpe1_get_max_mem(uint32_t flags) -+{ -+ if (!vpe1_mem) -+ return P_SIZE; -+ else -+ return vpe1_mem; -+} -+EXPORT_SYMBOL(vpe1_get_max_mem); -+ -+#endif -+ - /* get the vpe associated with this minor */ - struct vpe *get_vpe(int minor) - { ---- a/arch/mips/lantiq/prom.c -+++ b/arch/mips/lantiq/prom.c -@@ -31,10 +31,14 @@ EXPORT_SYMBOL_GPL(ebu_lock); - */ - static struct ltq_soc_info soc_info; - -+/* for Multithreading (APRP), vpe.c will use it */ -+unsigned long cp0_memsize; -+ - const char *get_system_type(void) - { - return soc_info.sys_type; - } -+EXPORT_SYMBOL(ltq_soc_type); - - int ltq_soc_type(void) - { ---- a/arch/mips/include/asm/mipsmtregs.h -+++ b/arch/mips/include/asm/mipsmtregs.h -@@ -31,6 +31,9 @@ - #define read_c0_vpeconf1() __read_32bit_c0_register($1, 3) - #define write_c0_vpeconf1(val) __write_32bit_c0_register($1, 3, val) - -+#define read_c0_vpeopt() __read_32bit_c0_register($1, 7) -+#define write_c0_vpeopt(val) __write_32bit_c0_register($1, 7, val) -+ - #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) - #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) - -@@ -376,6 +379,8 @@ do { \ - #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) - #define read_vpe_c0_vpeconf1() mftc0(1, 3) - #define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val) -+#define read_vpe_c0_vpeopt() mftc0(1, 7) -+#define write_vpe_c0_vpeopt(val) mttc0(1, 7, val) - #define read_vpe_c0_count() mftc0(9, 0) - #define write_vpe_c0_count(val) mttc0(9, 0, val) - #define read_vpe_c0_status() mftc0(12, 0) diff --git a/target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch b/target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch deleted file mode 100644 index d0acd4bb1..000000000 --- a/target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/pci/pci-lantiq.c -+++ b/arch/mips/pci/pci-lantiq.c -@@ -61,6 +61,8 @@ - #define ltq_pci_cfg_w32(x, y) ltq_w32((x), ltq_pci_mapped_cfg + (y)) - #define ltq_pci_cfg_r32(x) ltq_r32(ltq_pci_mapped_cfg + (x)) - -+extern u32 max_low_pfn; -+ - __iomem void *ltq_pci_mapped_cfg; - static __iomem void *ltq_pci_membase; - -@@ -86,8 +88,8 @@ static inline u32 ltq_calc_bar11mask(voi - u32 mem, bar11mask; - - /* BAR11MASK value depends on available memory on system. */ -- mem = get_num_physpages() * PAGE_SIZE; -- bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8; -+ mem = max_low_pfn << PAGE_SHIFT; -+ bar11mask = ((-roundup_pow_of_two(mem)) & 0x0F000000) | 8; - - return bar11mask; - } diff --git a/target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch b/target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch deleted file mode 100644 index 898c2d482..000000000 --- a/target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/arch/mips/kernel/vpe-mt.c -+++ b/arch/mips/kernel/vpe-mt.c -@@ -132,7 +132,10 @@ int vpe_run(struct vpe *v) - * kernels need to turn it on, even if that wasn't the pre-dvpe() state. - */ - #ifdef CONFIG_SMP -- evpe(vpeflags); -+ if (!setup_max_cpus) /* nosmp is set */ -+ evpe(EVPE_ENABLE); -+ else -+ evpe(vpeflags); - #else - evpe(EVPE_ENABLE); - #endif diff --git a/target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch b/target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch deleted file mode 100644 index fd8b7b892..000000000 --- a/target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch +++ /dev/null @@ -1,221 +0,0 @@ ---- a/drivers/mtd/maps/lantiq-flash.c -+++ b/drivers/mtd/maps/lantiq-flash.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - - #include -@@ -38,13 +39,16 @@ enum { - LTQ_NOR_NORMAL - }; - -+#define MAX_RESOURCES 4 -+ - struct ltq_mtd { -- struct resource *res; -- struct mtd_info *mtd; -- struct map_info *map; -+ struct mtd_info *mtd[MAX_RESOURCES]; -+ struct mtd_info *cmtd; -+ struct map_info map[MAX_RESOURCES]; - }; - - static const char ltq_map_name[] = "ltq_nor"; -+static const char * const ltq_probe_types[] = { "cmdlinepart", "ofpart", NULL }; - - static map_word - ltq_read16(struct map_info *map, unsigned long adr) -@@ -108,11 +112,43 @@ ltq_copy_to(struct map_info *map, unsign - } - - static int -+ltq_mtd_remove(struct platform_device *pdev) -+{ -+ struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); -+ int i; -+ -+ if (ltq_mtd == NULL) -+ return 0; -+ -+ if (ltq_mtd->cmtd) { -+ mtd_device_unregister(ltq_mtd->cmtd); -+ if (ltq_mtd->cmtd != ltq_mtd->mtd[0]) -+ mtd_concat_destroy(ltq_mtd->cmtd); -+ } -+ -+ for (i = 0; i < MAX_RESOURCES; i++) { -+ if (ltq_mtd->mtd[i] != NULL) -+ map_destroy(ltq_mtd->mtd[i]); -+ } -+ -+ kfree(ltq_mtd); -+ -+ return 0; -+} -+ -+static int - ltq_mtd_probe(struct platform_device *pdev) - { - struct ltq_mtd *ltq_mtd; - struct cfi_private *cfi; -- int err; -+ int err = 0; -+ int i; -+ int devices_found = 0; -+ -+ static const char *rom_probe_types[] = { -+ "cfi_probe", "jedec_probe", NULL -+ }; -+ const char **type; - - if (of_machine_is_compatible("lantiq,falcon") && - (ltq_boot_select() != BS_FLASH)) { -@@ -126,75 +162,89 @@ ltq_mtd_probe(struct platform_device *pd - - platform_set_drvdata(pdev, ltq_mtd); - -- ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- if (!ltq_mtd->res) { -- dev_err(&pdev->dev, "failed to get memory resource\n"); -- return -ENOENT; -+ for (i = 0; i < pdev->num_resources; i++) { -+ printk(KERN_NOTICE "lantiq nor flash device: %.8llx at %.8llx\n", -+ (unsigned long long)resource_size(&pdev->resource[i]), -+ (unsigned long long)pdev->resource[i].start); -+ -+ if (!devm_request_mem_region(&pdev->dev, -+ pdev->resource[i].start, -+ resource_size(&pdev->resource[i]), -+ dev_name(&pdev->dev))) { -+ dev_err(&pdev->dev, "Could not reserve memory region\n"); -+ return -ENOMEM; -+ } -+ -+ ltq_mtd->map[i].name = ltq_map_name; -+ ltq_mtd->map[i].bankwidth = 2; -+ ltq_mtd->map[i].read = ltq_read16; -+ ltq_mtd->map[i].write = ltq_write16; -+ ltq_mtd->map[i].copy_from = ltq_copy_from; -+ ltq_mtd->map[i].copy_to = ltq_copy_to; -+ -+ if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) -+ ltq_mtd->map[i].phys = NO_XIP; -+ else -+ ltq_mtd->map[i].phys = pdev->resource[i].start; -+ ltq_mtd->map[i].size = resource_size(&pdev->resource[i]); -+ ltq_mtd->map[i].virt = devm_ioremap(&pdev->dev, pdev->resource[i].start, -+ ltq_mtd->map[i].size); -+ if (IS_ERR(ltq_mtd->map[i].virt)) -+ return PTR_ERR(ltq_mtd->map[i].virt); -+ -+ if (ltq_mtd->map[i].virt == NULL) { -+ dev_err(&pdev->dev, "Failed to ioremap flash region\n"); -+ err = PTR_ERR(ltq_mtd->map[i].virt); -+ goto err_out; -+ } -+ -+ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_PROBING; -+ for (type = rom_probe_types; !ltq_mtd->mtd[i] && *type; type++) -+ ltq_mtd->mtd[i] = do_map_probe(*type, <q_mtd->map[i]); -+ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_NORMAL; -+ -+ if (!ltq_mtd->mtd[i]) { -+ dev_err(&pdev->dev, "probing failed\n"); -+ return -ENXIO; -+ } else { -+ devices_found++; -+ } -+ -+ ltq_mtd->mtd[i]->owner = THIS_MODULE; -+ ltq_mtd->mtd[i]->dev.parent = &pdev->dev; -+ -+ cfi = ltq_mtd->map[i].fldrv_priv; -+ cfi->addr_unlock1 ^= 1; -+ cfi->addr_unlock2 ^= 1; - } - -- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), -- GFP_KERNEL); -- if (!ltq_mtd->map) -- return -ENOMEM; -+ if (devices_found == 1) { -+ ltq_mtd->cmtd = ltq_mtd->mtd[0]; -+ } else if (devices_found > 1) { -+ /* -+ * We detected multiple devices. Concatenate them together. -+ */ -+ ltq_mtd->cmtd = mtd_concat_create(ltq_mtd->mtd, devices_found, dev_name(&pdev->dev)); -+ if (ltq_mtd->cmtd == NULL) -+ err = -ENXIO; -+ } - -- if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) -- ltq_mtd->map->phys = NO_XIP; -- else -- ltq_mtd->map->phys = ltq_mtd->res->start; -- ltq_mtd->res->start; -- ltq_mtd->map->size = resource_size(ltq_mtd->res); -- ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); -- if (IS_ERR(ltq_mtd->map->virt)) -- return PTR_ERR(ltq_mtd->map->virt); -- -- ltq_mtd->map->name = ltq_map_name; -- ltq_mtd->map->bankwidth = 2; -- ltq_mtd->map->read = ltq_read16; -- ltq_mtd->map->write = ltq_write16; -- ltq_mtd->map->copy_from = ltq_copy_from; -- ltq_mtd->map->copy_to = ltq_copy_to; -- -- ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING; -- ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map); -- ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL; -- -- if (!ltq_mtd->mtd) { -- dev_err(&pdev->dev, "probing failed\n"); -- return -ENXIO; -- } -- -- ltq_mtd->mtd->dev.parent = &pdev->dev; -- mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); -- -- cfi = ltq_mtd->map->fldrv_priv; -- cfi->addr_unlock1 ^= 1; -- cfi->addr_unlock2 ^= 1; -+ ltq_mtd->cmtd->dev.parent = &pdev->dev; -+ mtd_set_of_node(ltq_mtd->cmtd, pdev->dev.of_node); - -- err = mtd_device_register(ltq_mtd->mtd, NULL, 0); -+ err = mtd_device_register(ltq_mtd->cmtd, NULL, 0); - if (err) { - dev_err(&pdev->dev, "failed to add partitions\n"); -- goto err_destroy; -+ goto err_out; - } - - return 0; - --err_destroy: -- map_destroy(ltq_mtd->mtd); -+err_out: -+ ltq_mtd_remove(pdev); - return err; - } - --static int --ltq_mtd_remove(struct platform_device *pdev) --{ -- struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); -- -- if (ltq_mtd && ltq_mtd->mtd) { -- mtd_device_unregister(ltq_mtd->mtd); -- map_destroy(ltq_mtd->mtd); -- } -- return 0; --} -- - static const struct of_device_id ltq_mtd_match[] = { - { .compatible = "lantiq,nor" }, - {}, diff --git a/target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch b/target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch deleted file mode 100644 index 234a2527f..000000000 --- a/target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 58078a30038b578c26c532545448fe3746648390 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Thu, 29 Dec 2016 21:02:57 +0100 -Subject: [PATCH] MIPS: lantiq: lock DMA register accesses for SMP - -The DMA controller channel and port configuration is changed by -selecting the port or channel in one register and then update the -configuration in other registers. This has to be done in an atomic -operation. Previously only the local interrupts were deactivated which -works for single CPU systems. If the system supports SMP a better -locking is needed, use spinlocks instead. -On more recent SoCs (at least xrx200 and later) there are two memory -regions to change the configuration, there we could use one area for -each CPU and do not have to synchronize between the CPUs and more. - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/lantiq/xway/dma.c | 38 ++++++++++++++++++++------------------ - 1 file changed, 20 insertions(+), 18 deletions(-) - ---- a/arch/mips/lantiq/xway/dma.c -+++ b/arch/mips/lantiq/xway/dma.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -59,16 +60,17 @@ - ltq_dma_membase + (z)) - - static void __iomem *ltq_dma_membase; -+static DEFINE_SPINLOCK(ltq_dma_lock); - - void - ltq_dma_enable_irq(struct ltq_dma_channel *ch) - { - unsigned long flags; - -- local_irq_save(flags); -+ spin_lock_irqsave(<q_dma_lock, flags); - ltq_dma_w32(ch->nr, LTQ_DMA_CS); - ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); -- local_irq_restore(flags); -+ spin_unlock_irqrestore(<q_dma_lock, flags); - } - EXPORT_SYMBOL_GPL(ltq_dma_enable_irq); - -@@ -77,10 +79,10 @@ ltq_dma_disable_irq(struct ltq_dma_chann - { - unsigned long flags; - -- local_irq_save(flags); -+ spin_lock_irqsave(<q_dma_lock, flags); - ltq_dma_w32(ch->nr, LTQ_DMA_CS); - ltq_dma_w32_mask(1 << ch->nr, 0, LTQ_DMA_IRNEN); -- local_irq_restore(flags); -+ spin_unlock_irqrestore(<q_dma_lock, flags); - } - EXPORT_SYMBOL_GPL(ltq_dma_disable_irq); - -@@ -89,10 +91,10 @@ ltq_dma_ack_irq(struct ltq_dma_channel * - { - unsigned long flags; - -- local_irq_save(flags); -+ spin_lock_irqsave(<q_dma_lock, flags); - ltq_dma_w32(ch->nr, LTQ_DMA_CS); - ltq_dma_w32(DMA_IRQ_ACK, LTQ_DMA_CIS); -- local_irq_restore(flags); -+ spin_unlock_irqrestore(<q_dma_lock, flags); - } - EXPORT_SYMBOL_GPL(ltq_dma_ack_irq); - -@@ -101,11 +103,11 @@ ltq_dma_open(struct ltq_dma_channel *ch) - { - unsigned long flag; - -- local_irq_save(flag); -+ spin_lock_irqsave(<q_dma_lock, flag); - ltq_dma_w32(ch->nr, LTQ_DMA_CS); - ltq_dma_w32_mask(0, DMA_CHAN_ON, LTQ_DMA_CCTRL); -- ltq_dma_enable_irq(ch); -- local_irq_restore(flag); -+ ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); -+ spin_unlock_irqrestore(<q_dma_lock, flag); - } - EXPORT_SYMBOL_GPL(ltq_dma_open); - -@@ -114,11 +116,11 @@ ltq_dma_close(struct ltq_dma_channel *ch - { - unsigned long flag; - -- local_irq_save(flag); -+ spin_lock_irqsave(<q_dma_lock, flag); - ltq_dma_w32(ch->nr, LTQ_DMA_CS); - ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL); -- ltq_dma_disable_irq(ch); -- local_irq_restore(flag); -+ ltq_dma_w32_mask(1 << ch->nr, 0, LTQ_DMA_IRNEN); -+ spin_unlock_irqrestore(<q_dma_lock, flag); - } - EXPORT_SYMBOL_GPL(ltq_dma_close); - -@@ -133,7 +135,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch - &ch->phys, GFP_ATOMIC); - memset(ch->desc_base, 0, LTQ_DESC_NUM * LTQ_DESC_SIZE); - -- local_irq_save(flags); -+ spin_lock_irqsave(<q_dma_lock, flags); - ltq_dma_w32(ch->nr, LTQ_DMA_CS); - ltq_dma_w32(ch->phys, LTQ_DMA_CDBA); - ltq_dma_w32(LTQ_DESC_NUM, LTQ_DMA_CDLEN); -@@ -142,7 +144,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch - ltq_dma_w32_mask(0, DMA_CHAN_RST, LTQ_DMA_CCTRL); - while (ltq_dma_r32(LTQ_DMA_CCTRL) & DMA_CHAN_RST) - ; -- local_irq_restore(flags); -+ spin_unlock_irqrestore(<q_dma_lock, flags); - } - - void -@@ -152,11 +154,11 @@ ltq_dma_alloc_tx(struct ltq_dma_channel - - ltq_dma_alloc(ch); - -- local_irq_save(flags); -+ spin_lock_irqsave(<q_dma_lock, flags); - ltq_dma_w32(DMA_DESCPT, LTQ_DMA_CIE); - ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); - ltq_dma_w32(DMA_WEIGHT | DMA_TX, LTQ_DMA_CCTRL); -- local_irq_restore(flags); -+ spin_unlock_irqrestore(<q_dma_lock, flags); - } - EXPORT_SYMBOL_GPL(ltq_dma_alloc_tx); - -@@ -167,11 +169,11 @@ ltq_dma_alloc_rx(struct ltq_dma_channel - - ltq_dma_alloc(ch); - -- local_irq_save(flags); -+ spin_lock_irqsave(<q_dma_lock, flags); - ltq_dma_w32(DMA_DESCPT, LTQ_DMA_CIE); - ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); - ltq_dma_w32(DMA_WEIGHT, LTQ_DMA_CCTRL); -- local_irq_restore(flags); -+ spin_unlock_irqrestore(<q_dma_lock, flags); - } - EXPORT_SYMBOL_GPL(ltq_dma_alloc_rx); - diff --git a/target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch b/target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch deleted file mode 100644 index d153c521d..000000000 --- a/target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0001.c -+++ b/drivers/mtd/chips/cfi_cmdset_0001.c -@@ -39,7 +39,7 @@ - /* #define CMDSET0001_DISABLE_WRITE_SUSPEND */ - - // debugging, turns off buffer write mode if set to 1 --#define FORCE_WORD_WRITE 0 -+#define FORCE_WORD_WRITE 1 - - /* Intel chips */ - #define I82802AB 0x00ad diff --git a/target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch b/target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch deleted file mode 100644 index e42aaf9c0..000000000 --- a/target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/arch/mips/lantiq/xway/sysctrl.c -+++ b/arch/mips/lantiq/xway/sysctrl.c -@@ -442,6 +442,20 @@ static void clkdev_add_clkout(void) - } - } - -+static void set_phy_clock_source(struct device_node *np_cgu) -+{ -+ u32 phy_clk_src, ifcc; -+ -+ if (!np_cgu) -+ return; -+ -+ if (of_property_read_u32(np_cgu, "lantiq,phy-clk-src", &phy_clk_src)) -+ return; -+ -+ ifcc = ltq_cgu_r32(ifccr) & ~(0x1c); -+ ltq_cgu_w32(ifcc | (phy_clk_src << 2), ifccr); -+} -+ - /* bring up all register ranges that we need for basic system control */ - void __init ltq_soc_init(void) - { -@@ -628,4 +642,6 @@ void __init ltq_soc_init(void) - if (of_machine_is_compatible("lantiq,vr9")) - xbar_fpi_burst_disable(); - usb_set_clock(); -+ -+ set_phy_clock_source(np_cgu); - } diff --git a/target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch b/target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch deleted file mode 100644 index 7e0051e66..000000000 --- a/target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch +++ /dev/null @@ -1,184 +0,0 @@ ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -109,6 +109,7 @@ obj-$(CONFIG_SENSORS_LTC4222) += ltc4222 - obj-$(CONFIG_SENSORS_LTC4245) += ltc4245.o - obj-$(CONFIG_SENSORS_LTC4260) += ltc4260.o - obj-$(CONFIG_SENSORS_LTC4261) += ltc4261.o -+obj-$(CONFIG_SENSORS_LTQ_CPUTEMP) += ltq-cputemp.o - obj-$(CONFIG_SENSORS_MAX1111) += max1111.o - obj-$(CONFIG_SENSORS_MAX16065) += max16065.o - obj-$(CONFIG_SENSORS_MAX1619) += max1619.o ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -780,6 +780,14 @@ config SENSORS_LTC4261 - This driver can also be built as a module. If so, the module will - be called ltc4261. - -+config SENSORS_LTQ_CPUTEMP -+ bool "Lantiq CPU temperature sensor" -+ depends on LANTIQ -+ default n -+ help -+ If you say yes here you get support for the temperature -+ sensor inside your CPU. -+ - config SENSORS_MAX1111 - tristate "Maxim MAX1111 Serial 8-bit ADC chip and compatibles" - depends on SPI_MASTER ---- /dev/null -+++ b/drivers/hwmon/ltq-cputemp.c -@@ -0,0 +1,154 @@ -+/* Lantiq CPU Temperatur sensor driver for xrx200 -+ * -+ * Copyright (C) 2016 Florian Eckert -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version -+ * -+ * This program is distributed in the hope that it will be useful -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+/* gphy1 configuration register contains cpu temperature */ -+#define CGU_GPHY1_CR 0x0040 -+#define CGU_TEMP_PD BIT(19) -+ -+static void ltq_cputemp_enable(void) -+{ -+ ltq_cgu_w32(ltq_cgu_r32(CGU_GPHY1_CR) | CGU_TEMP_PD, CGU_GPHY1_CR); -+ -+ /* wait a short moment to let the SoC get the first temperatur value */ -+ mdelay(100); -+} -+ -+static void ltq_cputemp_disable(void) -+{ -+ ltq_cgu_w32(ltq_cgu_r32(CGU_GPHY1_CR) & ~CGU_TEMP_PD, CGU_GPHY1_CR); -+} -+ -+static int ltq_cputemp_read(void) -+{ -+ int value; -+ -+ /* get the temperature including one decimal place */ -+ value = (ltq_cgu_r32(CGU_GPHY1_CR) >> 9) & 0x01FF; -+ value = (value << 2 ) + value; -+ -+ /* range -38 to +154 °C, register value zero is -38.0 °C */ -+ value -= 380; -+ -+ return value; -+} -+ -+static ssize_t show_cputemp(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ int value; -+ -+ value = ltq_cputemp_read(); -+ /* scale temp to millidegree */ -+ value = value * 100; -+ -+ return sprintf(buf, "%d\n", value); -+} -+ -+static DEVICE_ATTR(temp1_input, S_IRUGO, show_cputemp, NULL); -+ -+static struct attribute *ltq_cputemp_attrs[] = { -+ &dev_attr_temp1_input.attr, -+ NULL -+}; -+ -+ATTRIBUTE_GROUPS(ltq_cputemp); -+ -+static int ltq_cputemp_probe(struct platform_device *pdev) -+{ -+ int value = 0; -+ int ret; -+ struct device *hwmon_dev; -+ -+ /* available on vr9 v1.2 SoCs only */ -+ if (ltq_soc_type() != SOC_TYPE_VR9_2) -+ return -ENODEV; -+ -+ hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev, -+ "CPU0", -+ NULL, -+ ltq_cputemp_groups); -+ -+ if (IS_ERR(hwmon_dev)) { -+ dev_err(&pdev->dev, "Failed to register as hwmon device"); -+ ret = PTR_ERR(hwmon_dev); -+ goto error_hwmon; -+ } -+ -+ ltq_cputemp_enable(); -+ value = ltq_cputemp_read(); -+ dev_info(&pdev->dev, "Current CPU die temperature: %d.%d °C", value / 10, value % 10); -+ -+ return 0; -+ -+error_hwmon: -+ return ret; -+} -+ -+static int ltq_cputemp_release(struct platform_device *pdev) -+{ -+ hwmon_device_unregister(&pdev->dev); -+ ltq_cputemp_disable(); -+ return 0; -+} -+ -+const struct of_device_id ltq_cputemp_match[] = { -+ { .compatible = "lantiq,cputemp" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ltq_cputemp_match); -+ -+static struct platform_driver ltq_cputemp_driver = { -+ .probe = ltq_cputemp_probe, -+ .remove = ltq_cputemp_release, -+ .driver = { -+ .name = "ltq-cputemp", -+ .owner = THIS_MODULE, -+ .of_match_table = ltq_cputemp_match, -+ }, -+}; -+ -+int __init init_ltq_cputemp(void) -+{ -+ int ret; -+ -+ ret = platform_driver_register(<q_cputemp_driver); -+ return ret; -+} -+ -+void clean_ltq_cputemp(void) -+{ -+ platform_driver_unregister(<q_cputemp_driver); -+ return; -+} -+ -+module_init(init_ltq_cputemp); -+module_exit(clean_ltq_cputemp); -+ -+MODULE_AUTHOR("Florian Eckert "); -+ -+MODULE_DESCRIPTION("Lantiq Temperature Sensor"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/lantiq/xrx200/config-4.9 b/target/linux/lantiq/xrx200/config-4.9 deleted file mode 100644 index 73ccaf34a..000000000 --- a/target/linux/lantiq/xrx200/config-4.9 +++ /dev/null @@ -1,90 +0,0 @@ -CONFIG_ADM6996_PHY=y -CONFIG_AR8216_PHY=y -CONFIG_AT803X_PHY=y -CONFIG_BLK_MQ_PCI=y -CONFIG_CPU_MIPSR2_IRQ_EI=y -CONFIG_CPU_MIPSR2_IRQ_VI=y -CONFIG_CPU_RMAP=y -CONFIG_CRC16=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL2=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_HWMON=y -CONFIG_ICPLUS_PHY=y -CONFIG_IFX_VPE_EXT=y -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_POLLDEV=y -CONFIG_INTEL_XWAY_PHY=y -# CONFIG_ISDN is not set -CONFIG_LANTIQ_XRX200=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MIPS_MT=y -# CONFIG_MIPS_MT_FPAFF is not set -CONFIG_MIPS_MT_SMP=y -CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y -CONFIG_MIPS_VPE_APSP_API=y -CONFIG_MIPS_VPE_APSP_API_MT=y -CONFIG_MIPS_VPE_LOADER=y -CONFIG_MIPS_VPE_LOADER_MT=y -CONFIG_MIPS_VPE_LOADER_TOM=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_PLATFORM=y -CONFIG_MTD_NAND_XWAY=y -# CONFIG_MTD_PHYSMAP_OF is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NLS=y -CONFIG_NR_CPUS=2 -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_PADATA=y -CONFIG_PCI=y -CONFIG_PCIE_LANTIQ=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LANTIQ=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_SUPPLY=y -CONFIG_RCU_STALL_COMMON=y -CONFIG_RFS_ACCEL=y -CONFIG_RPS=y -CONFIG_RTL8306_PHY=y -CONFIG_RTL8366S_PHY=y -CONFIG_RTL8367B_PHY=y -CONFIG_RTL8367_PHY=y -CONFIG_SENSORS_LTQ_CPUTEMP=y -CONFIG_SMP=y -CONFIG_SMP_UP=y -CONFIG_SWCONFIG_LEDS=y -CONFIG_SYNC_R4K=y -CONFIG_SYS_SUPPORTS_SCHED_SMT=y -CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_TREE_RCU=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -CONFIG_USB=y -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_SUPPORT=y -# CONFIG_USB_UHCI_HCD is not set -CONFIG_XPS=y -CONFIG_XRX200_PHY_FW=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/lantiq/xrx200/target.mk b/target/linux/lantiq/xrx200/target.mk index fc8115e79..4f682bf48 100644 --- a/target/linux/lantiq/xrx200/target.mk +++ b/target/linux/lantiq/xrx200/target.mk @@ -6,6 +6,7 @@ CPU_TYPE:=24kc DEFAULT_PACKAGES+=kmod-leds-gpio \ kmod-gpio-button-hotplug \ + ltq-vdsl-vr9-vectoring-fw-installer \ kmod-ltq-vdsl-vr9-mei \ kmod-ltq-vdsl-vr9 \ kmod-ltq-atm-vr9 \ diff --git a/target/linux/lantiq/xway/config-4.14 b/target/linux/lantiq/xway/config-4.14 index 5e18a4dee..64a6c5583 100644 --- a/target/linux/lantiq/xway/config-4.14 +++ b/target/linux/lantiq/xway/config-4.14 @@ -1,5 +1,6 @@ CONFIG_ADM6996_PHY=y CONFIG_AR8216_PHY=y +CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_CRC16=y CONFIG_CRYPTO_ACOMP2=y diff --git a/target/linux/lantiq/xway/config-4.9 b/target/linux/lantiq/xway/config-4.9 deleted file mode 100644 index 79064ccc0..000000000 --- a/target/linux/lantiq/xway/config-4.9 +++ /dev/null @@ -1,48 +0,0 @@ -CONFIG_ADM6996_PHY=y -CONFIG_AR8216_PHY=y -CONFIG_BLK_MQ_PCI=y -CONFIG_CRC16=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_LZO=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_POLLDEV=y -# CONFIG_ISDN is not set -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_PLATFORM=y -CONFIG_MTD_NAND_XWAY=y -# CONFIG_MTD_PHYSMAP_OF is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_NLS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_PCI=y -# CONFIG_PCIE_LANTIQ is not set -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LANTIQ=y -CONFIG_RTL8306_PHY=y -CONFIG_RTL8366S_PHY=y -CONFIG_RTL8367B_PHY=y -CONFIG_RTL8367_PHY=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -CONFIG_USB=y -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_SUPPORT=y -# CONFIG_USB_UHCI_HCD is not set -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/lantiq/xway_legacy/config-4.9 b/target/linux/lantiq/xway_legacy/config-4.9 deleted file mode 100644 index c8aa63178..000000000 --- a/target/linux/lantiq/xway_legacy/config-4.9 +++ /dev/null @@ -1,37 +0,0 @@ -CONFIG_ADM6996_PHY=y -CONFIG_AR8216_PHY=y -CONFIG_BLK_MQ_PCI=y -CONFIG_CRC16=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_LZO=y -CONFIG_FIRMWARE_IN_KERNEL=y -# CONFIG_GPIO_SYSFS is not set -# CONFIG_HW_RANDOM is not set -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_POLLDEV=y -# CONFIG_ISDN is not set -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_TIMER is not set -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -# CONFIG_MTD_PHYSMAP_OF is not set -CONFIG_NLS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_PCI=y -# CONFIG_PCIE_LANTIQ is not set -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LANTIQ=y -CONFIG_RTL8306_PHY=y -CONFIG_RTL8366S_PHY=y -CONFIG_RTL8367B_PHY=y -CONFIG_RTL8367_PHY=y -CONFIG_USB=y -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_SUPPORT=y -# CONFIG_USB_UHCI_HCD is not set -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/layerscape/Makefile b/target/linux/layerscape/Makefile index f533767fa..e5bb1932d 100644 --- a/target/linux/layerscape/Makefile +++ b/target/linux/layerscape/Makefile @@ -8,7 +8,6 @@ include $(TOPDIR)/rules.mk BOARD:=layerscape BOARDNAME:=NXP Layerscape -DEVICE_TYPE:=developerboard KERNEL_PATCHVER:=4.9 FEATURES:=squashfs nand usb pcie gpio fpu ubifs SUBTARGETS:=armv8_64b armv8_32b diff --git a/target/linux/layerscape/armv8_32b/config-4.9 b/target/linux/layerscape/armv8_32b/config-4.9 index 1ee8fdb0d..b7695891d 100644 --- a/target/linux/layerscape/armv8_32b/config-4.9 +++ b/target/linux/layerscape/armv8_32b/config-4.9 @@ -145,8 +145,6 @@ CONFIG_CAN_RAW=y # CONFIG_CAN_SJA1000 is not set # CONFIG_CAN_SOFTING is not set # CONFIG_CAN_TI_HECC is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # CONFIG_CFS_BANDWIDTH is not set CONFIG_CGROUPS=y CONFIG_CGROUP_CPUACCT=y @@ -297,8 +295,6 @@ CONFIG_DETECT_HUNG_TASK=y # CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND is not set # CONFIG_DEVFREQ_GOV_USERSPACE is not set # CONFIG_DEVFREQ_THERMAL is not set -CONFIG_DEVKMEM=y -CONFIG_DEVMEM=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_DMADEVICES=y diff --git a/target/linux/layerscape/armv8_64b/config-4.9 b/target/linux/layerscape/armv8_64b/config-4.9 index 20758d41e..caf7be72e 100644 --- a/target/linux/layerscape/armv8_64b/config-4.9 +++ b/target/linux/layerscape/armv8_64b/config-4.9 @@ -157,8 +157,6 @@ CONFIG_CAVIUM_ERRATUM_22375=y CONFIG_CAVIUM_ERRATUM_23144=y CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_CEPH_LIB=y # CONFIG_CEPH_LIB_PRETTYDEBUG is not set # CONFIG_CEPH_LIB_USE_DNS_RESOLVER is not set @@ -323,8 +321,6 @@ CONFIG_DEFAULT_CFQ=y CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 CONFIG_DEFAULT_IOSCHED="cfq" CONFIG_DETECT_HUNG_TASK=y -CONFIG_DEVKMEM=y -CONFIG_DEVMEM=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y # CONFIG_DEV_DAX is not set @@ -1237,3 +1233,4 @@ CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_X86=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_QORIQ_THERMAL=y diff --git a/target/linux/layerscape/base-files/etc/board.d/01_led b/target/linux/layerscape/base-files/etc/board.d/01_led new file mode 100755 index 000000000..b9b62a07e --- /dev/null +++ b/target/linux/layerscape/base-files/etc/board.d/01_led @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +traverse,ls1043v) + ucidef_set_led_netdev "wan" "WAN LED" "ls1043v:yellow:wan" "eth4" + ;; +traverse,ls1043s) + ucidef_set_led_netdev "wan" "WAN LED" "ls1043s:yellow:wan" "eth4" + ucidef_set_led_netdev "xgact" "10G Activity" "ls1043s:yellow:10gact" "eth6" + ucidef_set_led_netdev "xglink" "10G Link" "ls1043s:green:10glink" "eth6" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/layerscape/base-files/etc/board.d/02_network b/target/linux/layerscape/base-files/etc/board.d/02_network new file mode 100755 index 000000000..c50b4a346 --- /dev/null +++ b/target/linux/layerscape/base-files/etc/board.d/02_network @@ -0,0 +1,21 @@ +#!/bin/sh + +. /lib/functions/system.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + traverse,ls1043v) + ucidef_set_interface_lan "eth0 eth1 eth2 eth3" + ucidef_set_interface_wan "eth4" + ;; + traverse,ls1043s) + ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth6" + ucidef_set_interface_wan "eth4" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches new file mode 100755 index 000000000..7f9da0866 --- /dev/null +++ b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +traverse,ls1043v) + ucidef_add_gpio_switch "lte_reset" "LTE Reset" "377" + ucidef_add_gpio_switch "lte_disable" "LTE Airplane mode" "378" + ;; +traverse,ls1043s) + ucidef_add_gpio_switch "tensfp_txdisable" "SFP+ TX Disable" "378" + ucidef_add_gpio_switch "gigsfp_txdisable" "SFP TX Disable" "381" + ucidef_add_gpio_switch "lte_reset" "LTE Reset" "502" + ucidef_add_gpio_switch "lte_disable" "LTE Airplane Mode" "394" + ucidef_add_gpio_switch "lte_power" "LTE Power" "395" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth new file mode 100644 index 000000000..c4feec42b --- /dev/null +++ b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth @@ -0,0 +1,28 @@ +#!/bin/sh + +reorder_layerscape_interfaces() { + if [ ! -f /tmp/sysinfo/board_name ]; then + echo "No board name found, not doing reorder_layerscape_interfaces" + return 0 + fi + + board=$(cat /tmp/sysinfo/board_name) + case "$board" in + "traverse,ls1043v" | \ + "traverse,ls1043s") + + # Reorder ethernet interfaces to match the physical order + ip link set eth2 name fm1-mac3 + ip link set eth4 name eth2 + ip link set eth3 name fm1-mac4 + ip link set eth5 name eth3 + ip link set fm1-mac3 name eth4 + ip link set fm1-mac4 name eth5 + ;; + default) + echo "Unknown board $board" + ;; + esac +} + +boot_hook_add preinit_main reorder_layerscape_interfaces diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..9cc960a5f --- /dev/null +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -0,0 +1,94 @@ +#!/bin/sh +# +# Copyright 2015-2018 Traverse Technologies +# +platform_do_upgrade_traverse_nandubi() { + bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}') + newbootsys=2 + if [ "$bootsys" -eq "2" ]; then + newbootsys=1 + fi + mkdir -p /tmp/image + cd /tmp/image + get_image "$1" > image.tar + ls -la image.tar + files=$(tar -tf image.tar) + echo "Files in image:" + echo $files + for f in $files + do + part_name=$(echo $f | awk -F '/' '{{print $2}}') + if [ -z "$part_name" ] || [ "$part_name" = "CONTROL" ]; then + continue + fi + + [ "$part_name" = "root" ] && part_name="rootfs" + + volume=$part_name + if [ "$part_name" = "kernel" ] || [ "$part_name" = "rootfs" ]; then + volume="${part_name}${newbootsys}" + fi + volume_id=$(ubinfo -d 0 --name $volume | awk '/Volume ID/ {print $3}') + file_size=$(tar -tvf image.tar $f | awk '{{print $3}}') + echo "$f size $file_size" + tar -xOf image.tar $f | ubiupdatevol -s $file_size /dev/ubi0_$volume_id - + + echo "$volume upgraded" + done + fw_setenv bootsys $newbootsys + echo "Upgrade complete" +} +platform_copy_config() { + bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}') + rootvol=rootfs$bootsys + volume_id=$(ubinfo -d 0 --name $rootvol | awk '/Volume ID/ {print $3}') + mkdir -p /mnt/oldsys + mount -t ubifs -o rw,noatime /dev/ubi0_$volume_id /mnt/oldsys + cp -af "$CONF_TAR" /mnt/oldsys + umount /mnt/oldsys +} +platform_check_image() { + local board=$(board_name) + + case "$board" in + traverse,ls1043v | \ + traverse,ls1043s | \ + traverse,five64) + local tar_file="$1" + local kernel_length=$( (tar xf $tar_file sysupgrade-traverse-five64/kernel -O | wc -c) 2> /dev/null) + local rootfs_length=$( (tar xf $tar_file sysupgrade-traverse-five64/root -O | wc -c) 2> /dev/null) + [ "$kernel_length" -eq 0 -o "$rootfs_length" -eq 0 ] && { + echo "The upgrade image is corrupt." + return 1 + } + return 0 + ;; + *) + echo "Sysupgrade is not currently supported on $board" + ;; + esac + + return 1 +} +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + traverse,ls1043v | \ + traverse,ls1043s | \ + traverse,five64) + platform_do_upgrade_traverse_nandubi "$ARGV" + ;; + *) + echo "Sysupgrade is not currently supported on $board" + ;; + esac +} +platform_pre_upgrade() { + # Force the creation of fw_printenv.lock + mkdir -p /var/lock + touch /var/lock/fw_printenv.lock + + export RAMFS_COPY_BIN="/usr/sbin/fw_printenv /usr/sbin/fw_setenv /usr/sbin/ubinfo /bin/echo ${RAMFS_COPY_BIN}" + export RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock ${RAMFS_COPY_DATA}" +} diff --git a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts new file mode 100644 index 000000000..3896f39e5 --- /dev/null +++ b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts @@ -0,0 +1,332 @@ +/* + * Device Tree Include file for Traverse LS1043S board. + * + * Copyright 2014-2015, Freescale Semiconductor + * Copyright 2017-2018, Traverse Technologies + * + * This file is dual-licensed: you can use it either under the terms + * of the GPLv2 or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "fsl-ls1043a.dtsi" +#include +#include + +/ { + model = "Traverse LS1043S"; + compatible = "traverse,ls1043s"; + + aliases { + crypto = &crypto; + ethernet0 = &EMAC0; + ethernet1 = &EMAC1; + ethernet2 = &EMAC2; + ethernet3 = &EMAC3; + ethernet4 = &EMAC4; + ethernet5 = &EMAC5; + }; + + leds { + compatible = "gpio-leds"; + gpio0 { + label = "ls1043s:green:user0"; + gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + gpio1 { + label = "ls1043s:green:user1"; + gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>; + }; + /* LED D17 */ + gpio2 { + label = "ls1043s:green:wan"; + gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; + }; + gpio3 { + label = "ls1043s:yellow:wan"; + gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + }; + /* LED D18 */ + gpio4 { + label = "ls1043s:green:mgmt"; + gpios = <&gpio1 28 GPIO_ACTIVE_LOW>; + }; + gpio5 { + label = "ls1043s:yellow:mgmt"; + gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; + }; + /* LED D6 */ + gpio6 { + label = "ls1043s:green:user2"; + gpios = <&gpio1 31 GPIO_ACTIVE_HIGH>; + }; + + /* SFP+ LEDs - these are for chassis + * with lightpipes only + */ + teng_act { + label = "ls1043s:yellow:10gact"; + gpios = <&gpio4 0 GPIO_ACTIVE_LOW>; + }; + + teng_link { + label = "ls1043s:green:10glink"; + gpios = <&gpio4 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <1000>; + /* This button may not be loaded on all boards */ + button@0 { + label = "Front button"; + linux,code = ; + gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + }; + /* This is wired to header S3 */ + button@1 { + label = "Rear button"; + linux,code = ; + gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&esdhc { + mmc-hs200-1_8v; + sd-uhs-sdr104; + sd-uhs-sdr50; + sd-uhs-sdr25; + sd-uhs-sdr12; +}; + +&i2c0 { + status = "okay"; + rtc@6f { + compatible = "intersil,isl1208"; + reg = <0x6f>; + }; + + sfp_pca9534: pca9534@24 { + compatible = "ti,tca9534", "nxp,pca9534"; + gpio-controller; + #gpio-cells = <2>; + reg = <0x24>; + gpio-base = <100>; + }; + + controller@50 { + compatible = "traverse,controller"; + reg = <0x50>; + }; + + ds125df111@18 { + compatible = "ti,ds125df111"; + reg = <0x18>; + }; + + emc1704@4c { + compatible = "microchip,emc1704"; + reg = <0x4c>; + }; + + pac1934@16 { + compatible = "microchip,pac1934"; + reg = <0x16>; + /* Monitoring 3.3V, 5V, Vin/12V (voltage only), Vbat/RTC (voltage only) */ + shunt-resistors = <4000 12000 0 0>; + }; + + pmic@8 { + compatible = "freescale,mc34vr500"; + reg = <0x08>; + }; +}; + +/* I2C Bus for SFP EEPROM and control + * These are multiplexed so + * they don't collide when loaded + */ +&i2c3 { + status = "okay"; + i2c-switch@70 { + compatible = "nxp,pca9540"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x70>; + + gigsfp_i2c: i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + }; + tensfp_i2c: i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + }; + }; +}; + +&ifc { + status = "okay"; + #address-cells = <2>; + #size-cells = <1>; + /* Only NAND flash is used on this board */ + ranges = <0x0 0x0 0x0 0x7e800000 0x00010000>; + + nand@1,0 { + compatible = "fsl,ifc-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x0 0x0 0x10000>; + }; +}; + +&duart0 { + status = "okay"; +}; + +&duart1 { + status = "okay"; +}; + +#include "fsl-ls1043-post.dtsi" + +&fman0 { + EMAC0: ethernet@e0000 { + phy-handle = <&qsgmii_phy1>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 01]; + }; + + EMAC1: ethernet@e2000 { + phy-handle = <&qsgmii_phy2>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 02]; + }; + + EMAC2: ethernet@e8000 { + phy-handle = <&qsgmii_phy3>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 03]; + }; + + EMAC3: ethernet@ea000 { + phy-handle = <&qsgmii_phy4>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 04]; + }; + + /* SFP via AR8031 + * We treat this as a fixed-link as the + * AR8031 is hard-configured into + * 1000BASE-X mode + * Should MII control be desired, remove + * fixed-link and add + * phy-handle = <&rgmii_phy1>; + */ + EMAC4: ethernet@e4000 { + phy-connection-type = "rgmii"; + local-mac-address = [0A 00 00 00 00 05]; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + /* Connection to Expansion (M.2) slot + * Future WAN (i.e xDSL) plugin + */ + EMAC5: ethernet@e6000 { + phy-connection-type = "rgmii-id"; + local-mac-address = [00 00 00 00 00 06]; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + /* 10G SFP+ interface + * This can also run at 1.25 and 2.5G with + * the appropriate SerDes protocol setting in RCW + */ + TENSFP: ethernet@f0000 { + status = "okay"; + phy-connection-type = "xgmii"; + fixed-link { + speed = <10000>; + full-duplex; + }; + }; + + mdio@fc000 { + rgmii_phy1: ethernet-phy@2 { + reg = <0x2>; + }; + qsgmii_phy1: ethernet-phy@4 { + reg = <0x4>; + }; + qsgmii_phy2: ethernet-phy@5 { + reg = <0x5>; + }; + qsgmii_phy3: ethernet-phy@6 { + reg = <0x6>; + }; + qsgmii_phy4: ethernet-phy@7 { + reg = <0x7>; + }; + }; +}; + +/* No QUICC engine functions on this board - + * pins are used for other functions (GPIO, I2C etc.) + */ +&uqe { + status = "disabled"; +}; + +/* LS1043S does not use the QorIQ AHCI + * controller. + */ +&sata { + status = "disabled"; +}; diff --git a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts new file mode 100644 index 000000000..cfbc0d037 --- /dev/null +++ b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts @@ -0,0 +1,253 @@ +/* + * Device Tree Include file for Traverse LS1043V board. + * + * Copyright 2014-2015, Freescale Semiconductor + * Copyright 2017, Traverse Technologies + * + * This file is dual-licensed: you can use it either under the terms + * of the GPLv2 or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "fsl-ls1043a.dtsi" +#include +#include + +/ { + model = "Traverse LS1043V"; + compatible = "traverse,ls1043v"; + + aliases { + crypto = &crypto; + ethernet0 = &EMAC0; + ethernet1 = &EMAC1; + ethernet2 = &EMAC2; + ethernet3 = &EMAC3; + ethernet4 = &EMAC4; + ethernet5 = &EMAC5; + pca9555 = &pca9555; + }; + + leds { + compatible = "gpio-leds"; + gpio0 { + label = "ls1043v:green:user0"; + gpios = <&pca9555 0 GPIO_ACTIVE_LOW>; + }; + gpio1 { + label = "ls1043v:yellow:user0"; + gpios = <&pca9555 1 GPIO_ACTIVE_LOW>; + }; + gpio2 { + label = "ls1043v:green:user1"; + gpios = <&pca9555 2 GPIO_ACTIVE_LOW>; + }; + gpio3 { + label = "ls1043v:yellow:user1"; + gpios = <&pca9555 3 GPIO_ACTIVE_LOW>; + }; + gpio4 { + label = "ls1043v:green:user2"; + gpios = <&pca9555 4 GPIO_ACTIVE_HIGH>; + }; + gpio5 { + label = "ls1043v:yellow:wlan"; + gpios = <&pca9555 5 GPIO_ACTIVE_HIGH>; + }; + gpio6 { + label = "ls1043v:yellow:wan"; + gpios = <&pca9555 6 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <1000>; + button@0 { + label = "Front button"; + linux,code = ; + gpios = <&pca9555 14 GPIO_ACTIVE_LOW>; + }; + button@1 { + label = "Rear button"; + linux,code = ; + gpios = <&pca9555 15 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&i2c0 { + status = "okay"; + rtc@6f { + compatible = "intersil,isl1208"; + reg = <0x6f>; + }; + + pca9555: pca9555@20 { + compatible = "nxp,pca9555"; + gpio-controller; + #gpio-cells = <2>; + reg = <0x20>; + gpio-base = <0>; + }; + + /* CPU core temp sensor and VDD (1.0V) sensor */ + ltc2990@4c { + compatible = "lltc,ltc2990"; + reg = <0x4C>; + lltc,meas-mode = <4 3>; + }; + + /* 3.3V and 5V monitor (may not be loaded on some SKUs) */ + ltc2990@4f { + compatible = "lltc,ltc2990"; + reg = <0x4F>; + lltc,meas-mode = <6 3>; + }; +}; + +&ifc { + status = "okay"; + #address-cells = <2>; + #size-cells = <1>; + /* Only NAND flash is used on this board */ + ranges = <0x0 0x0 0x0 0x7e800000 0x00010000>; + + nand@1,0 { + compatible = "fsl,ifc-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x0 0x0 0x10000>; + }; +}; + +&duart0 { + status = "okay"; +}; + +&duart1 { + status = "okay"; +}; + +#include "fsl-ls1043-post.dtsi" + +&fman0 { + EMAC0: ethernet@e0000 { + phy-handle = <&qsgmii_phy1>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 01]; + }; + + EMAC1: ethernet@e2000 { + phy-handle = <&qsgmii_phy2>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 02]; + }; + + EMAC2: ethernet@e8000 { + phy-handle = <&qsgmii_phy3>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 03]; + }; + + EMAC3: ethernet@ea000 { + phy-handle = <&qsgmii_phy4>; + phy-connection-type = "qsgmii"; + local-mac-address = [0A 00 00 00 00 04]; + }; + EMAC4: ethernet@e4000 { + phy-handle = <&rgmii_phy1>; + phy-connection-type = "rgmii"; + local-mac-address = [0A 00 00 00 00 05]; + }; + + /* Connection to VDSL SoC */ + EMAC5: ethernet@e6000 { + phy-connection-type = "rgmii-id"; + local-mac-address = [00 00 00 00 00 06]; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + /* 10G XFI interface - not in use on this platform */ + TENSFP: ethernet@f0000 { + status = "disabled"; + + phy-connection-type = "sgmii"; + fixed-link { + /* NB: speed = 1000 and sgmii allows forward compatibility + * with both 1G and 10G, the same is not true + * in the reverse. + */ + speed = <1000>; + full-duplex; + }; + }; + + mdio@fc000 { + rgmii_phy1: ethernet-phy@3 { + reg = <0x3>; + }; + qsgmii_phy1: ethernet-phy@4 { + reg = <0x4>; + }; + qsgmii_phy2: ethernet-phy@5 { + reg = <0x5>; + }; + qsgmii_phy3: ethernet-phy@6 { + reg = <0x6>; + }; + qsgmii_phy4: ethernet-phy@7 { + reg = <0x7>; + }; + }; +}; + +/* No QUICC engine functions on this board */ +&uqe { + status = "disabled"; +}; + +/* No SATA/AHCI on this board */ +&sata { + status = "disabled"; +}; diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index fc76ddd2e..8e1e847f5 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -7,6 +7,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +ITB_BOARDS = traverse-five64 + define Build/append-ls-rcw rm -f $@ dd if=$(STAGING_DIR_IMAGE)/$(1)-rcw.bin >> $@ @@ -45,6 +47,16 @@ define Build/append-ls-dtb dd if=$(DTS_DIR)/$(1).dtb >> $@ endef +define Build/traverse-fit + ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) -v $(LINUX_VERSION) \ + -k $@ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + -C gzip -c 1 -c 2 \ + -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043s.dtb -D "Traverse_LS1043S" -n "ls1043s" -a $(FDT_LOADADDR) -c 1 \ + -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043v.dtb -D "Traverse_LS1043V" -n "ls1043v" -a $(FDT_LOADADDR) -c 2 + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new + @mv -f $@.new $@ +endef + define Device/Default PROFILES = Default FILESYSTEMS := squashfs @@ -62,6 +74,7 @@ ifeq ($(SUBTARGET),armv8_32b) KERNEL_LOADADDR = 0x80008000 KERNEL_ENTRY_POINT = 0x80008000 endif + FDT_LOADADDR = 0x90000000 endef define Device/ls1043ardb @@ -182,4 +195,28 @@ endef TARGET_DEVICES += ls2088ardb endif +define Device/traverse-five64 + KERNEL_NAME := Image + KERNEL_SUFFIX := -kernel.itb + KERNEL_INSTALL := 1 + FILESYSTEMS := ubifs + DEVICE_TITLE := Traverse LS1043 Boards (Five64, LS1043S) + DEVICE_PACKAGES += fman-layerscape-ls1043ardb kmod-i2c-core kmod-rtc-isl1208 uboot-envtools \ + uboot-traverse-ls1043v uboot-traverse-ls1043v-sdcard \ + kmod-hwmon-core kmod-hwmon-ltc2990 kmod-gpio-pca953x kmod-input-gpio-keys-polled \ + kmod-i2c-mux-pca954x kmod-hwmon-pac1934 kmod-hwmon-emc17xx + DEVICE_DESCRIPTION = Build images for Traverse LS1043 boards. This generates a single image \ + capable of booting on any of the boards in this family. + DEVICE_DTS = freescale/traverse-ls1043s + DEVICE_DTS_DIR = $(LINUX_DIR)/arch/arm64/boot/dts + DEVICE_DTS_CONFIG = ls1043s + KERNEL := kernel-bin | gzip | traverse-fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR) + KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR) + IMAGES = root sysupgrade.tar + IMAGE/root = append-rootfs + IMAGE/sysupgrade.tar = sysupgrade-tar + UBIFS_OPTS := -m 2048 -e 124KiB -c 4096 +endef +TARGET_DEVICES += traverse-five64 + $(eval $(call BuildImage)) diff --git a/target/linux/layerscape/image/mkits-multiple-config.sh b/target/linux/layerscape/image/mkits-multiple-config.sh new file mode 100755 index 000000000..5daee5458 --- /dev/null +++ b/target/linux/layerscape/image/mkits-multiple-config.sh @@ -0,0 +1,596 @@ +#!/usr/bin/env bash +# +# Licensed under the terms of the GNU GPL License version 2 or later. +# +# Author: Jason Wu +# with modifications for multi-DTB-same-image by: +# Mathew McBride +# +# U-Boot firmware supports the booting of images in the Flattened Image +# Tree (FIT) format. The FIT format uses a device tree structure to +# describe a kernel image, device tree blob, ramdisk, etc. This script +# creates an Image Tree Source (.its file) which can be passed to the +# 'mkimage' utility to generate an Image Tree Blob (.itb file). The .itb +# file can then be booted by U-Boot (or other bootloaders which support +# FIT images). See doc/uImage.FIT/howto.txt in U-Boot source code for +# additional information on FIT images. +# +# This tools supports: +# - multi-configuration +# - multi-image support - multiple kernel/fdt/ramdsik +# - per image configuration: +# - hash algorithm and generated required subnodes +# - compression +# - signature and generated required subnodes +# +set -e + +# image config limit +MAX_IMG=50 +# conf config limit +MAX_CONF=10 + +# declare main data array +declare -a img_array +declare -a conf_array + +# initialize array with empty values +for (( index=1; index<=$MAX_IMG; index++ )); do + declare -a img$index + for i in {0..13}; do + eval img${index}[$i]="" + done +done + +for (( index=1; index<=$MAX_CONF; index++ )); do + declare -a conf$index + for i in {0..9}; do + eval conf${index}[$i]="" + done +done + +# imgX array index information +# 0: type of image - kernel, fdt, ramdsik +# 1: image location +# 2: image index +# 3: loadaddr of image +# 4: entrypoint of image +# 5: compression +# 6: hash algorithm +# 7: part of the configuration +# 8: Human friend name for the image +# 9: key file name +# 10: signature +# 11: conf friendly name + +# confX array index information +# 0: conf number +# 1: kernel conf +# 2: fdt conf +# 3: rootfs conf +# 4: kernel key file +# 5: fdt key file +# 6: rootfs key file +# 7: kernel sign_algorithm +# 8: fdt sign_algorithm +# 9: rootfs sign_algorithm +# 10: conf friendly name + +usage() { + echo "Usage: `basename $0` -A arch -v version -o its_file" \ + "-k kernel -a addr -e entry [-C none] [-h sha1] [-c conf]" + echo -e "Example1:\n\tkernel image ker_img1 with no compression +" + echo -e "\tsha1 hash + fdt dtb1 with sha1 and crc32 hash for conf 1" + echo -e "\t $ `basename $0` -A arm -v 4.4 \ " + echo -e "\t -k ker_img1 -C none -h sha1 -e 0x8000 -a 0x8000 -c 1 \ " + echo -e "\t -d dtb1 -h sha1 -h crc32 -c 1\n" + echo "General settings:" + echo -e "\t-A ==> set architecture to 'arch'" + echo -e "\t-v ==> set kernel version to 'version'" + echo -e "\t-o ==> create output file 'its_file' [optional]" + echo "Input image type:" + echo -e "\t-k ==> kernel image 'kernel'" + echo -e "\t-d ==> Device Tree Blob 'dtb'" + echo -e "\t-r ==> ramdisk image 'ramdisk" + echo "Per image configurations:" + echo -e "\t-C ==> set compression type 'comp'" + echo -e "\t-c ==> set image config (multiple -c allowed)" + echo -e "\t-a ==> set load address to 'addr' (hex)" + echo -e "\t-e ==> set entry point to 'entry' (hex)" + echo -e "\t-D ==> human friendly 'name' (one word only)" + echo -e "\t-h ==> set hash algorithm (multiple -h allowed)" + echo -e "\t-s ==> set signature for given config image" + echo -e "\t-K ==> set key file for given config image" + exit 1 +} + +array_check() +{ + local a=999 + local max_a=0 + local max_i=0 + + if echo $1 | grep -q img; then + max_a=$MAX_IMG + max_i=13 + let a=$(echo $1 | awk -F "img" '{print $2}') + elif echo $1 | grep -q conf; then + max_a=$MAX_CONF + max_i=10 + let a=$(echo $1 | awk -F "conf" '{print $2}') + fi + if [ ${a} -lt 0 -o ${a} -gt ${max_a} -o \ + ${2} -lt 0 -o ${2} -gt ${max_i} ]; then + echo "WARNING: Invalid array name, skipping!!!" + return 255 + fi +} + +# +# $1: array name +# $2: index +# $3: value +# $4: append operation +# +array_put() +{ + # check if array is declared + array_check $1 $2 || return 0 + if [ -z "$4" ]; then + eval $1[$2]=$3 + else + eval $1[$2]=\"\${$1[$2]} $3\" + fi +} + +# +# $1: array name +# $2: index +# +array_get() +{ + local val + eval val=\${$1[$2]} + echo $val +} + +parse_args() { + local i=-1 k=-1 d=-1 r=-1 + while getopts ":A:a:C:c:D:d:e:h:k:K:o:v:r:s:n:" OPTION; do + case $OPTION in + A ) ARCH=$OPTARG;; + a ) array_put img$i 3 $OPTARG;; + C ) value_sanity_chk compression $OPTARG; + array_put img$i 5 $OPTARG;; + c ) array_put img$i 7 $OPTARG append;; + D ) array_put img$i 8 $OPTARG;; + d ) i=$(($i + 1)); + d=$(($d + 1)); + img_array[$i]=img$i; + array_put img$i 0 fdt; + array_put img$i 1 $OPTARG; + array_put img$i 2 $d; + ;; + e ) array_put img$i 4 $OPTARG;; + h ) value_sanity_chk hash $OPTARG; + array_put img$i 6 $OPTARG append;; + k ) i=$(($i + 1)); + k=$(($k + 1)); + img_array[$i]=img$i; + array_put img$i 0 "kernel"; + array_put img$i 1 $OPTARG; + array_put img$i 2 $k; + ;; + K ) array_put img$i 9 $OPTARG;; + n ) array_put img$i 11 $OPTARG;; + o ) OUTPUT=$OPTARG;; + v ) VERSION=$OPTARG;; + r ) i=$(($i + 1)); + r=$(($r + 1)); + img_array[$i]=img$i; + array_put img$i 0 "ramdisk"; + array_put img$i 1 $OPTARG; + array_put img$i 2 $r; + ;; + s ) value_sanity_chk signature $OPTARG; + array_put img$i 10 $OPTARG; + ;; + * ) echo "Invalid option passed to '$0' (options:$@)" + usage;; + esac + done + [ -n "${OUTPUT}" ] || OUTPUT=fitimage.its + [ -n "${VERSION}" ] || VERSION="Unknown" + [ -n "${ARCH}" ] || ARCH=arm +} + +# +# sanity check for signature, compression and hash +# +value_sanity_chk() +{ + local valid="" + case $1 in + signature) valid="sha-1,rsa-2048 sha-256,rsa-2048 sha-256,rsa-4096";; + compression) valid="gzip bzip2 none";; + hash) valid="sha1 md5 crc32";; + esac + if ! echo $valid | grep -q "$2"; then + echo "Error: Invalid $1 provided '$2'" + echo "Valid options are: $valid" + exit 255 + fi +} + +# +# Emit the fitImage section bits +# +# $1: Section bit type: fitstart - its header +# imagestart - image section start +# confstart - configuration section start +# sectend - section end +# fitend - fitimage end +# $2: optional variable for confstart section +# +emit_its() { + case $1 in + fitstart) + cat << EOF > ${OUTPUT} +/dts-v1/; + +/ { + description = "U-Boot fitImage for ${VERSION} kernel"; + #address-cells = <1>; +EOF + ;; + imagestart) + echo -e "\n\timages {" >> ${OUTPUT};; + confstart) +# echo -e "\tconfigurations {\n\t\tdefault = \"conf@${2:-0}\";" \ + echo -e "\tconfigurations {\n" \ + >> ${OUTPUT};; + sectend) + echo -e "\t};" >> ${OUTPUT};; + fitend) + echo -e "};" >> ${OUTPUT};; + esac +} + +# +# Emit kernel image node +# +emit_kernel() { + local image=${1} + local count=${2:-${MAX_IMG}} + local loaddaddr=${3:-0x8000} + local entrypoint=${4:-0x8000} + local compresson=${5:-none} + local checksum=${6:-sha1} + local name=${7} + + [ -z "${name}" ] || name=" ${name}" + cat << EOF >> ${OUTPUT} + kernel@${count} { + description = "Linux Kernel${name}"; + data = /incbin/("${image}"); + type = "kernel"; + arch = "${ARCH}"; + os = "linux"; + compression = "${compresson}"; + load = <${loaddaddr}>; + entry = <${entrypoint}>; +EOF + emit_cksum ${checksum} + + if [ -z "$SIGN_IN_CONF" ] ; then + emit_signature "$9" "" "" "$8" "" "" + fi + + echo " };" >> ${OUTPUT} +} + +# +# Emit fdt node +# +emit_fdt() { + local image=${1} + local count=${2:-${MAX_IMG}} + local compresson=${3:-none} + local checksum=${4:-sha1} + local name=${5} + local loadaddr=${6} + + [ -z "${name}" ] || name=" ${name}" + cat << EOF >> ${OUTPUT} + fdt@${count} { + description = "Flattened Device Tree blob${name}"; + data = /incbin/("${image}"); + type = "flat_dt"; + arch = "${ARCH}"; + load = <${loadaddr}>; + compression = "none"; +EOF + emit_cksum ${checksum} + if [ -z "$SIGN_IN_CONF" ] ; then + emit_signature "" "$7" "" "" "$6" "" + fi + echo " };" >> ${OUTPUT} +} + +# +# Emit ramdisk node +# +emit_ramdisk() { + local image=${1} + local count=${2:-${MAX_IMG}} + local compresson=${3:-none} + local checksum=${4:-sha1} + local name=${5} + + [ -z "${name}" ] || name=" ${name}" + cat << EOF >> ${OUTPUT} + ramdisk@${count} { + description = "ramdisk${name}"; + data = /incbin/("${image}"); + type = "ramdisk"; + arch = "${ARCH}"; + os = "linux"; + compression = "${compresson}"; +EOF + emit_cksum ${checksum} + if [ -z "$SIGN_IN_CONF" ] ; then + emit_signature "" "" "$7" "" "" "$6" + fi + echo " };" >> ${OUTPUT} +} + +# +# Emit check sum sub node +# +emit_cksum() { + csum_list=$@ + count=1 + for csum in ${csum_list}; do + cat << EOF >> ${OUTPUT} + hash@${count} { + algo = "${csum}"; + }; +EOF + count=`expr ${count} + 1` + done +} + +# +# Emit signature sub node +# +emit_signature() { + local kernel=$1 + local fdt=$2 + local rootfs=$3 + local kernel_key=$4 + local fdt_key=$5 + local rootfs_key=$6 + local imgs="" + local count=0 + local chk_list="" algo="" algos="" i="" + + for i in kernel fdt rootfs; do + eval algo=\$$i + eval key=\$${i}_key + [ -n "$algo" ] || continue + if ! echo "$algos" | grep -q $algo; then + if [ -z "$algos" ]; then + algos=$algo + else + algos="${algos} $algo" + fi + fi + if ! echo "$keys" | grep -q $key; then + if [ -z "$keys" ]; then + keys=$key + else + keys="${keys} $key" + fi + fi + done + + for algo in $algos; do + for key in $keys; do + img="" + for i in kernel fdt rootfs; do + eval tmp_algo=\$$i + eval tmp_key=\$${i}_key + [ "$tmp_algo" == "$algo" ] || continue + [ "$tmp_key" == "$key" ] || continue + if [ -z "$img" ]; then + img=$i + else + img=${img},$i + fi + done + + [ -n "$img" ] || continue + cat << EOF >> ${OUTPUT} + signature@${count} { + algo = "${algo}"; + key-name-hint = "${key}"; +EOF + if [ -n "$SIGN_IN_CONF" ] ; then + echo " sign-images = \"$img\";" >> ${OUTPUT} + fi + echo " };" >> ${OUTPUT} + + count=`expr ${count} + 1` + done + done +} + +# +# Emit config sub nodes +# +emit_config() { + local conf_csum="sha1" + + config_name="conf@${1}" + if [ ! -z "${11}" ]; then + config_name="${11}" + fi + if [ -z "${2}" ]; then + echo "Error: config has no kernel img, skipping conf node!" + return 0 + fi + + # Test if we have any DTBs at all + if [ -z "${3}" ] ; then + conf_desc="Boot Linux kernel" + fdt_line="" + else + conf_desc="Boot Linux kernel with FDT blob" + fdt_line=" + fdt = \"fdt@${3}\";" + fi + + # Test if we have any ROOTFS at all + if [ -n "${4}" ] ; then + conf_desc="$conf_desc + ramdisk" + fdt_line="${fdt_line} + ramdisk = \"ramdisk@${4}\";" + fi + + kernel_line="kernel = \"kernel@${2}\";" + + cat << EOF >> ${OUTPUT} + ${config_name} { + description = "${conf_desc}"; + ${kernel_line}${fdt_line} + hash@1 { + algo = "${conf_csum}"; + }; +EOF + if [ -n "$SIGN_IN_CONF" ] ; then + emit_signature "$5" "$6" "$7" "$8" "$9" "${10}" + fi + + echo " };" >> ${OUTPUT} +} + +# +# remove prefix space +# +remove_prefix_space() +{ + echo "$@" | sed "s:^ ::g" +} + +# +# generate image nodes and its subnodes +# +emit_image_nodes() +{ + local t img_c img_i img_index chk + local img_type img_path img_count img_loadadr img_entrypoint \ + img_compression img_hash img_conf img_name img_key img_sign \ + img_index + + emit_its imagestart + for t in "kernel" "fdt" "ramdisk"; do + img_index=0 + for a in ${img_array[@]}; do + img_type=$(array_get $a 0) + img_path=$(array_get $a 1) + img_count=$(array_get $a 2) + img_loadadr=$(array_get $a 3) + img_entrypoint=$(array_get $a 4) + img_compression=$(array_get $a 5) + img_hash=$(array_get $a 6) + img_conf=$(array_get $a 7) + img_name=$(array_get $a 8) + img_key=$(array_get $a 9) + img_sign=$(array_get $a 10) + img_cname=$(array_get $a 11) + + img_conf=$(remove_prefix_space $img_conf) + img_hash=$(remove_prefix_space $img_hash) + + [ "${img_type}" == $t ] || continue + # generate sub nodes + eval chk=\$DEF_$t + [ -n "${chk}" ] || eval DEF_$t=$img_count + case $t in + kernel) emit_kernel "$img_path" "$img_count" \ + "$img_loadadr" "$img_entrypoint" \ + "$img_compression" "$img_hash" \ + "$img_name" "$img_key" "$img_sign";; + fdt) emit_fdt "$img_path" "$img_count" \ + "$img_compression" "$img_hash" \ + "$img_name" "$img_loadadr" "$img_key" "$img_sign" ;; + + ramdisk) emit_ramdisk "$img_path" "$img_count" \ + "$img_compression" "$img_hash" \ + "$img_name" "$img_key" "$img_sign";; + esac + + # set up configuration data + for img_c in $img_conf; do + img_i="" + #set up default configuration if its not set + [ -n "$DEF_CONFIG" ] || DEF_CONFIG=$img_c + [ -z "${img_c}" ] || conf_array[$img_c]=conf$img_c + array_put conf$img_c 0 ${img_c} + case $t in + kernel) img_i=1;; + fdt) img_i=2;; + ramdisk) img_i=3;; + esac + array_put conf$img_c $img_i $img_index + array_put conf$img_c $(($img_i + 3)) ${img_sign} + array_put conf$img_c $(($img_i + 6)) ${img_key} + array_put conf$img_c 10 $img_cname + done + img_index=$((img_index + 1)) + done + done + emit_its sectend +} + +# +# generate configuration node and its subnodes +# +emit_configuration_nodes () +{ + local count kernel fdt ramdisk ker_file fdt_file rfs_file ker_sign \ + fdt_sign rfs_sign + emit_its confstart $DEF_CONFIG + for a in ${conf_array[@]}; do + count=$(array_get $a 0) + kernel=$(array_get $a 1) + fdt=$(array_get $a 2) + ramdisk=$(array_get $a 3) + er_file=$(array_get $a 4) + fdt_file=$(array_get $a 5) + rfs_file=$(array_get $a 6) + ker_sign=$(array_get $a 7) + fdt_sign=$(array_get $a 8) + rfs_sign=$(array_get $a 9) + cname=$(array_get $a 10) + emit_config "$count" "$kernel" "$fdt" "$ramdisk" "$ker_file" \ + "$fdt_file" "$rfs_file" "$ker_sign" "$fdt_sign" \ + "$rfs_sign" "${cname}" + done + if [ -z "${DEF_CONFIG}" ]; then + emit_config "0" "$DEF_kernel" "$DEF_fdt" "$DEF_ramdisk" + fi + emit_its sectend +} + +# Set to none empty to create signature sub node under images node +SIGN_IN_CONF=${SIGN_IN_CONF:-""} +# Set to default config used +DEF_CONFIG=${DEF_CONFIG:-""} + +parse_args $@ + +emit_its fitstart +emit_image_nodes +emit_configuration_nodes +emit_its fitend diff --git a/target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch b/target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch new file mode 100644 index 000000000..90ebc202a --- /dev/null +++ b/target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch @@ -0,0 +1,89 @@ +From c0612164b379ebc8964da6bc6f6ced9736dce488 Mon Sep 17 00:00:00 2001 +From: Mathew McBride +Date: Tue, 17 Apr 2018 10:01:03 +1000 +Subject: [PATCH] add DTS for Traverse LS1043 Boards + +Signed-off-by: Mathew McBride +--- + arch/arm64/boot/dts/freescale/Makefile | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + create mode 100644 arch/arm64/boot/dts/freescale/traverse-ls1043v.dts + +--- a/arch/arm64/boot/dts/freescale/Makefile ++++ b/arch/arm64/boot/dts/freescale/Makefile +@@ -20,7 +20,10 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2 + dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2080a-simu.dtb + dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-qds.dtb + dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-rdb.dtb +- ++ ++dtb-$(CONFIG_ARCH_LAYERSCAPE) += traverse-ls1043v.dtb ++dtb-$(CONFIG_ARCH_LAYERSCAPE) += traverse-ls1043s.dtb ++ + always := $(dtb-y) + subdir-y := $(dts-dirs) + clean-files := *.dtb +--- a/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts ++++ b/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts +@@ -330,3 +330,29 @@ + &sata { + status = "disabled"; + }; ++ ++/* Additions for Layerscape SDK (4.4/4.9) Kernel only ++ * These kernels need additional setup for FMan/QMan DMA shared memory ++ */ ++ ++&bman_fbpr { ++ compatible = "fsl,bman-fbpr"; ++ alloc-ranges = <0 0 0x10000 0>; ++}; ++&qman_fqd { ++ compatible = "fsl,qman-fqd"; ++ alloc-ranges = <0 0 0x10000 0>; ++}; ++&qman_pfdr { ++ compatible = "fsl,qman-pfdr"; ++ alloc-ranges = <0 0 0x10000 0>; ++}; ++ ++&soc { ++#include "qoriq-dpaa-eth.dtsi" ++#include "qoriq-fman3-0-6oh.dtsi" ++}; ++ ++&fman0 { ++ compatible = "fsl,fman", "simple-bus"; ++}; +--- a/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts ++++ b/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts +@@ -251,3 +251,29 @@ + &sata { + status = "disabled"; + }; ++ ++/* Additions for Layerscape SDK (4.4/4.9) Kernel only ++ * These kernels need additional setup for FMan/QMan DMA shared memory ++ */ ++ ++&bman_fbpr { ++ compatible = "fsl,bman-fbpr"; ++ alloc-ranges = <0 0 0x10000 0>; ++}; ++&qman_fqd { ++ compatible = "fsl,qman-fqd"; ++ alloc-ranges = <0 0 0x10000 0>; ++}; ++&qman_pfdr { ++ compatible = "fsl,qman-pfdr"; ++ alloc-ranges = <0 0 0x10000 0>; ++}; ++ ++&soc { ++#include "qoriq-dpaa-eth.dtsi" ++#include "qoriq-fman3-0-6oh.dtsi" ++}; ++ ++&fman0 { ++ compatible = "fsl,fman", "simple-bus"; ++}; diff --git a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch index 9d8496860..e8fc1ec2b 100644 --- a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch @@ -705,7 +705,7 @@ Signed-off-by: Yangbo Lu case SPI_NOR_NORMAL: return 0; } -@@ -961,6 +973,8 @@ static const struct flash_info spi_nor_i +@@ -962,6 +974,8 @@ static const struct flash_info spi_nor_i /* ESMT */ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, @@ -714,7 +714,7 @@ Signed-off-by: Yangbo Lu /* Everspin */ { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, -@@ -1014,12 +1028,15 @@ static const struct flash_info spi_nor_i +@@ -1015,12 +1029,15 @@ static const struct flash_info spi_nor_i { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, @@ -731,7 +731,7 @@ Signed-off-by: Yangbo Lu { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, -@@ -1033,10 +1050,11 @@ static const struct flash_info spi_nor_i +@@ -1034,10 +1051,11 @@ static const struct flash_info spi_nor_i { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, @@ -745,7 +745,7 @@ Signed-off-by: Yangbo Lu /* PMC */ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, -@@ -1054,8 +1072,11 @@ static const struct flash_info spi_nor_i +@@ -1055,8 +1073,11 @@ static const struct flash_info spi_nor_i { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, @@ -758,7 +758,7 @@ Signed-off-by: Yangbo Lu { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) }, { "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) }, -@@ -1130,6 +1151,9 @@ static const struct flash_info spi_nor_i +@@ -1131,6 +1152,9 @@ static const struct flash_info spi_nor_i { "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) }, { "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) }, { "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) }, @@ -768,7 +768,7 @@ Signed-off-by: Yangbo Lu { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, -@@ -1196,6 +1220,53 @@ static const struct flash_info *spi_nor_ +@@ -1197,6 +1221,53 @@ static const struct flash_info *spi_nor_ id[0], id[1], id[2]); return ERR_PTR(-ENODEV); } @@ -822,7 +822,7 @@ Signed-off-by: Yangbo Lu static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) -@@ -1415,7 +1486,7 @@ static int macronix_quad_enable(struct s +@@ -1416,7 +1487,7 @@ static int macronix_quad_enable(struct s * Write status Register and configuration register with 2 bytes * The first byte will be written to the status register, while the * second byte will be written to the configuration register. @@ -831,7 +831,7 @@ Signed-off-by: Yangbo Lu */ static int write_sr_cr(struct spi_nor *nor, u16 val) { -@@ -1463,6 +1534,24 @@ static int spansion_quad_enable(struct s +@@ -1464,6 +1535,24 @@ static int spansion_quad_enable(struct s return 0; } @@ -856,7 +856,7 @@ Signed-off-by: Yangbo Lu static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) { int status; -@@ -1609,9 +1698,25 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1610,9 +1699,25 @@ int spi_nor_scan(struct spi_nor *nor, co write_sr(nor, 0); spi_nor_wait_till_ready(nor); } @@ -882,7 +882,7 @@ Signed-off-by: Yangbo Lu mtd->priv = nor; mtd->type = MTD_NORFLASH; mtd->writesize = 1; -@@ -1645,6 +1750,8 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1646,6 +1751,8 @@ int spi_nor_scan(struct spi_nor *nor, co nor->flags |= SNOR_F_USE_FSR; if (info->flags & SPI_NOR_HAS_TB) nor->flags |= SNOR_F_HAS_SR_TB; @@ -891,7 +891,7 @@ Signed-off-by: Yangbo Lu #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS /* prefer "small sector" erase if possible */ -@@ -1684,9 +1791,15 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1685,9 +1792,15 @@ int spi_nor_scan(struct spi_nor *nor, co /* Some devices cannot do fast-read, no matter what DT tells us */ if (info->flags & SPI_NOR_NO_FR) nor->flash_read = SPI_NOR_NORMAL; @@ -910,7 +910,7 @@ Signed-off-by: Yangbo Lu ret = set_quad_mode(nor, info); if (ret) { dev_err(dev, "quad mode not supported\n"); -@@ -1699,6 +1812,9 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1700,6 +1813,9 @@ int spi_nor_scan(struct spi_nor *nor, co /* Default commands */ switch (nor->flash_read) { diff --git a/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch b/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch index 724c6841f..03c3fb7cb 100644 --- a/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch @@ -2074,7 +2074,7 @@ Signed-off-by: Yangbo Lu +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, quirk_fsl_no_msi); --- a/include/linux/pci.h +++ b/include/linux/pci.h -@@ -1823,6 +1823,7 @@ void pcibios_release_device(struct pci_d +@@ -1825,6 +1825,7 @@ void pcibios_release_device(struct pci_d void pcibios_penalize_isa_irq(int irq, int active); int pcibios_alloc_irq(struct pci_dev *dev); void pcibios_free_irq(struct pci_dev *dev); diff --git a/target/linux/layerscape/patches-4.9/808-guts-support-layerscape.patch b/target/linux/layerscape/patches-4.9/808-guts-support-layerscape.patch index 0999832a1..26412c5eb 100644 --- a/target/linux/layerscape/patches-4.9/808-guts-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/808-guts-support-layerscape.patch @@ -258,7 +258,7 @@ Signed-off-by: Yangbo Lu +module_exit(fsl_guts_exit); --- a/include/linux/fsl/guts.h +++ b/include/linux/fsl/guts.h -@@ -29,83 +29,112 @@ +@@ -30,83 +30,112 @@ * #ifdefs. */ struct ccsr_guts { diff --git a/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch b/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch index 5af0b088a..7afef36e4 100644 --- a/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch @@ -1494,7 +1494,7 @@ Signed-off-by: Yangbo Lu while (ep_ring->dequeue != td->last_trb) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1604,14 +1604,38 @@ int xhci_urb_dequeue(struct usb_hcd *hcd +@@ -1609,14 +1609,38 @@ int xhci_urb_dequeue(struct usb_hcd *hcd ret = -ENOMEM; goto done; } diff --git a/target/linux/layerscape/patches-4.9/820-rgmii-fixed-link.patch b/target/linux/layerscape/patches-4.9/820-rgmii-fixed-link.patch new file mode 100644 index 000000000..593bd3e79 --- /dev/null +++ b/target/linux/layerscape/patches-4.9/820-rgmii-fixed-link.patch @@ -0,0 +1,62 @@ +From f27ef8941ca29b2d10428754be51e8ee06bb1263 Mon Sep 17 00:00:00 2001 +From: Mathew McBride +Date: Mon, 7 Aug 2017 10:19:48 +1000 +Subject: [PATCH] Recognize when an RGMII Link is set as fixed (in the device + tree) and set up the MAC accordingly + +--- + drivers/net/ethernet/freescale/sdk_dpaa/mac.c | 1 + drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c | 13 ++++++++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/net/ethernet/freescale/sdk_dpaa/mac.c ++++ b/drivers/net/ethernet/freescale/sdk_dpaa/mac.c +@@ -386,6 +386,7 @@ static int __cold mac_probe(struct platf + mac_dev->fixed_link->duplex = phy->duplex; + mac_dev->fixed_link->pause = phy->pause; + mac_dev->fixed_link->asym_pause = phy->asym_pause; ++ printk(KERN_INFO "Setting up fixed link, speed %d duplex %d\n", mac_dev->fixed_link->speed, mac_dev->fixed_link->duplex); + } + + _errno = mac_dev->init(mac_dev); +--- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c ++++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c +@@ -36,6 +36,8 @@ + + @Description FM mEMAC driver + *//***************************************************************************/ ++#include <../../../../sdk_dpaa/mac.h> ++#include + + #include "std_ext.h" + #include "string_ext.h" +@@ -48,6 +50,8 @@ + #include "memac.h" + + ++static t_Error MemacAdjustLink(t_Handle h_Memac, e_EnetSpeed speed, bool fullDuplex); ++ + /*****************************************************************************/ + /* Internal routines */ + /*****************************************************************************/ +@@ -276,11 +280,20 @@ static t_Error MemacEnable(t_Handle h_Me + { + t_Memac *p_Memac = (t_Memac *)h_Memac; + ++ struct mac_device *mac_dev = (struct mac_device *)p_Memac->h_App; ++ + SANITY_CHECK_RETURN_ERROR(p_Memac, E_INVALID_HANDLE); + SANITY_CHECK_RETURN_ERROR(!p_Memac->p_MemacDriverParam, E_INVALID_STATE); + + fman_memac_enable(p_Memac->p_MemMap, (mode & e_COMM_MODE_RX), (mode & e_COMM_MODE_TX)); + ++ if (ENET_INTERFACE_FROM_MODE(p_Memac->enetMode) == e_ENET_IF_RGMII) { ++ if (mac_dev->fixed_link) { ++ printk(KERN_INFO "This is a fixed-link, forcing speed %d duplex %d\n",mac_dev->fixed_link->speed,mac_dev->fixed_link->duplex); ++ MemacAdjustLink(h_Memac,mac_dev->fixed_link->speed,mac_dev->fixed_link->duplex); ++ } ++ } ++ + return E_OK; + } + diff --git a/target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch b/target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch new file mode 100644 index 000000000..c45c6b4a2 --- /dev/null +++ b/target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch @@ -0,0 +1,10 @@ +--- a/drivers/mmc/host/sdhci-of-esdhc.c ++++ b/drivers/mmc/host/sdhci-of-esdhc.c +@@ -619,6 +619,7 @@ static void esdhc_reset(struct sdhci_hos + static const struct of_device_id scfg_device_ids[] = { + { .compatible = "fsl,t1040-scfg", }, + { .compatible = "fsl,ls1012a-scfg", }, ++ { .compatible = "fsl,ls1043a-scfg", }, + { .compatible = "fsl,ls1046a-scfg", }, + {} + }; diff --git a/target/linux/mcs814x/Makefile b/target/linux/mcs814x/Makefile new file mode 100644 index 000000000..f507842f0 --- /dev/null +++ b/target/linux/mcs814x/Makefile @@ -0,0 +1,31 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=mcs814x +BOARDNAME:=Moschip MCS814x +FEATURES:=usb squashfs low_mem small_flash source-only +CPU_TYPE:=arm926ej-s +MAINTAINER:=Florian Fainelli + +KERNEL_PATCHVER:=3.18 + +DEVICE_TYPE:=other + +include $(INCLUDE_DIR)/target.mk + +DEFAULT_PACKAGES := $(filter-out ppp%,$(DEFAULT_PACKAGES)) \ + kmod-usb-core kmod-usb2 kmod-usb-ohci \ + kmod-usb-storage kmod-fs-vfat \ + kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \ + kmod-nls-utf8 \ + kmod-mcs814x-wdt kmod-usb-ledtrig-usbport + +KERNELNAME:=zImage dtbs + +$(eval $(call BuildTarget)) diff --git a/target/linux/mcs814x/base-files/etc/board.d/01_leds b/target/linux/mcs814x/base-files/etc/board.d/01_leds new file mode 100755 index 000000000..65d738f0a --- /dev/null +++ b/target/linux/mcs814x/base-files/etc/board.d/01_leds @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Copyright (C) 2012-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +dlan-usb-extender) + ucidef_set_led_usbdev "usb" "USB" "dlan-usb-extender:green:usb" "2-1" + ;; +rbt-832) + ucidef_set_led_usbdev "usb1" "USB1" "rbt-832:red:usb0" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "rbt-832:red:usb1" "1-2" + ucidef_set_led_usbdev "usb3" "USB3" "rbt-832:red:usb2" "1-3" + ucidef_set_led_usbdev "usb4" "USB4" "rbt-832:red:usb3" "1-4" + ucidef_set_led_netdev "eth" "eth" "rbt-832:red:ethernet" "eth0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mcs814x/base-files/etc/board.d/02_network b/target/linux/mcs814x/base-files/etc/board.d/02_network new file mode 100755 index 000000000..d3f2e653f --- /dev/null +++ b/target/linux/mcs814x/base-files/etc/board.d/02_network @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update +ucidef_set_interface_lan "eth0" +board_config_flush + +exit 0 diff --git a/target/linux/mcs814x/base-files/lib/mcs814x.sh b/target/linux/mcs814x/base-files/lib/mcs814x.sh new file mode 100644 index 000000000..3c16c9c12 --- /dev/null +++ b/target/linux/mcs814x/base-files/lib/mcs814x.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Copyright (C) 2012 OpenWrt.org +# + +MCS814X_BOARD_NAME= +MCS814X_MODEL= + +mcs814x_board_detect() { + local machine + local name + + machine=$(cat /proc/device-tree/model) + + case "$machine" in + *"Devolo dLAN USB Extender") + name="dlan-usb-extender" + ;; + *"Tigal RBT-832") + name="rbt-832" + ;; + esac + + [ -z "$name" ] && name="unknown" + + [ -z "$MCS814X_BOARD_NAME" ] && MCS814X_BOARD_NAME="$name" + [ -z "$MCS814X_MODEL" ] && MCS814X_MODEL="$machine" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$MCS814X_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$MCS814X_MODEL" > /tmp/sysinfo/model +} diff --git a/target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh b/target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh new file mode 100755 index 000000000..d509770c5 --- /dev/null +++ b/target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +do_mcs814x() { + . /lib/mcs814x.sh + + mcs814x_board_detect +} + +boot_hook_add preinit_main do_mcs814x diff --git a/target/linux/mcs814x/config-3.18 b/target/linux/mcs814x/config-3.18 new file mode 100644 index 000000000..0b74cd699 --- /dev/null +++ b/target/linux/mcs814x/config-3.18 @@ -0,0 +1,235 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_ARCH_HAS_SG_CHAIN is not set +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MCS814X=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_NR_GPIO=0 +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USES_GETTIMEOFFSET=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARM=y +CONFIG_ARM_APPENDED_DTB=y +# CONFIG_ARM_ATAG_DTB_COMPAT is not set +# CONFIG_ARM_CPU_SUSPEND is not set +CONFIG_ARM_L1_CACHE_SHIFT=5 +# CONFIG_ARM_THUMB is not set +CONFIG_BINFMT_MISC=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="earlyprintk" +CONFIG_CPU_32v5=y +CONFIG_CPU_ABRT_EV5TJ=y +CONFIG_CPU_ARM926T=y +# CONFIG_CPU_CACHE_ROUND_ROBIN is not set +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_COPY_V4WB=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +# CONFIG_CPU_DCACHE_WRITETHROUGH is not set +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_PABRT_LEGACY=y +CONFIG_CPU_TLB_V4WBI=y +CONFIG_CPU_USE_DOMAINS=y +CONFIG_CRC_CCITT=y +CONFIG_CRC_ITU_T=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_DEBUG_LL=y +CONFIG_DEBUG_LL_INCLUDE="debug/8250.S" +CONFIG_DEBUG_LL_UART_NONE=y +CONFIG_DEBUG_UART_8250=y +# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set +CONFIG_DEBUG_UART_8250_SHIFT=2 +# CONFIG_DEBUG_UART_8250_WORD is not set +CONFIG_DEBUG_UART_PHYS=0x400dc000 +# CONFIG_DEBUG_UART_PL01X is not set +CONFIG_DEBUG_UART_VIRT=0xf00dc000 +# CONFIG_DEBUG_USER is not set +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=y +# CONFIG_ENABLE_WARN_DEPRECATED is not set +CONFIG_FIQ=y +CONFIG_FRAME_POINTER=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_MCS814X=y +CONFIG_GPIO_SYSFS=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_UID16=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_MCS814X=y +CONFIG_HZ_FIXED=0 +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IOMMU_HELPER=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISDN is not set +CONFIG_JFFS2_LZO=y +CONFIG_JFFS2_RUBIN=y +# CONFIG_JFFS2_SUMMARY is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_KALLSYMS=y +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set +CONFIG_LIBCRC32C=y +CONFIG_LIBFDT=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACH_DLAN_USB_EXT=y +CONFIG_MACH_RBT_832=y +CONFIG_MCS8140=y +CONFIG_MCS814X_PHY=y +# CONFIG_MCS814X_WATCHDOG is not set +CONFIG_MDIO_BOARDINFO=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_IMPA7 is not set +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_ROOTFS_SPLIT is not set +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_FIRMWARE_NAME="linux" +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MULTI_IRQ_HANDLER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_KUSER_HELPERS=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_KEY=y +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-15" +CONFIG_NO_BOOTMEM=y +CONFIG_NUPORT_ETHERNET_DRIVER=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MDIO=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARTITION_ADVANCED is not set +# CONFIG_PCI_SYSCALL is not set +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PHYLIB=y +CONFIG_PHYS_OFFSET=0x00000000 +# CONFIG_PREEMPT_RCU is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SCHED_HRTICK is not set +# CONFIG_SCSI_DMA is not set +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SPLIT_PTLOCK_CPUS=999999 +# CONFIG_SWAP is not set +CONFIG_SWIOTLB=y +# CONFIG_SYN_COOKIES is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_UID16=y +CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y +CONFIG_VECTORS_BASE=0xffff0000 +# CONFIG_VFP is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_WATCHDOG_CORE=y +CONFIG_WATCHDOG_NOWAYOUT=y +# CONFIG_WEXT_PRIV is not set +# CONFIG_WEXT_SPY is not set +# CONFIG_WIRELESS_EXT is not set +CONFIG_XFRM_ALGO=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts new file mode 100644 index 000000000..ea75a255e --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts @@ -0,0 +1,68 @@ +/* + * dlan-usb-extender.dts - Device Tree file for Devolo dLAN USB Extender + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2 + */ + +/dts-v1/; +#include "mcs8140.dtsi" + +/ { + model = "Devolo dLAN USB Extender"; + compatible = "devolo,dlan-usb-extender", "moschip,mcs8140", "moschip,mcs814x"; + + chosen { + bootargs = "mem=16M console=ttyS0,57600 earlyprintk"; + }; + + ahb { + vci { + eth0: ethernet@40084000 { + phy = <&phy0>; + phy-mode = "mii"; + + phy0: ethernet-phy@0 { + reg = <8>; + }; + }; + + adc { + sdram: memory@0,0 { + reg = <0 0 0x1000000>; + }; + + nor: flash@7,0 { + + partition@0 { + label = "ArmBoot"; + reg = <0 0x30000>; + }; + partition@30000 { + label = "Config1"; + reg = <0x30000 0x10000>; + }; + partition@40000 { + label = "Config2"; + reg = <0x40000 0x10000>; + }; + partition@50000 { + label = "linux"; + reg = <0x50000 0x4C0000>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + usb { + label = "dlan-usb-extender:green:usb"; + gpios = <&gpio 19 0>; // gpio 19 active high + }; + }; + }; + }; +}; + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi new file mode 100644 index 000000000..e30dc550b --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi @@ -0,0 +1,189 @@ +/* + * mcs8140.dtsi - Device Tree Include file for Moschip MCS8140 family SoC + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2. + */ + +#include "skeleton.dtsi" + +/ { + model = "Moschip MCS8140 family SoC"; + compatible = "moschip,mcs8140"; + interrupt-parent = <&intc>; + + aliases { + serial0 = &uart0; + eth0 = ð0; + }; + + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + vci { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + eth0: ethernet@40084000 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "moschip,nuport-mac"; + reg = <0x40084000 0xd8 // mac + 0x40080000 0x58>; // dma channels + interrupts = <4 5 29>; /* tx, rx, link */ + nuport-mac,buffer-shifting; + nuport-mac,link-activity = <0>; + }; + + tso@40088000 { + reg = <0x40088000 0x1c>; + interrupts = <7>; + }; + + i2s@4008c000 { + compatible = "moschip,mcs814x-i2s"; + reg = <0x4008c000 0x18>; + interrupts = <8>; + }; + + ipsec@40094000 { + compatible = "moschip,mcs814x-ipsec"; + reg = <0x40094000 0x1d8>; + interrupts = <16>; + }; + + rng@4009c000 { + compatible = "moschip,mcs814x-rng"; + reg = <0x4009c000 0x8>; + }; + + memc@400a8000 { + reg = <0x400a8000 0x58>; + }; + + list-proc@400ac0c0 { + reg = <0x400ac0c0 0x38>; + interrupts = <19 27>; // done, error + }; + + gpio: gpio@400d0000 { + compatible = "moschip,mcs814x-gpio"; + reg = <0x400d0000 0x670>; + interrupts = <10>; + #gpio-cells = <2>; + gpio-controller; + num-gpios = <20>; + }; + + eepio: gpio@400d4000 { + compatible = "moschip,mcs814x-gpio"; + reg = <0x400d4000 0x470>; + #gpio-cells = <2>; + gpio-controller; + num-gpios = <4>; + }; + + uart0: serial@400dc000 { + compatible = "ns16550"; + reg = <0x400dc000 0x20>; + clock-frequency = <50000000>; + reg-shift = <2>; + interrupts = <21>; + status = "okay"; + }; + + intc: interrupt-controller@400e4000 { + #interrupt-cells = <1>; + compatible = "moschip,mcs814x-intc"; + interrupt-controller; + interrupt-parent; + reg = <0x400e4000 0x48>; + }; + + m2m@400e8000 { + reg = <0x400e8000 0x24>; + interrupts = <17>; + }; + + eth-filters@400ec000 { + reg = <0x400ec000 0x80>; + }; + + timer: timer@400f800c { + compatible = "moschip,mcs814x-timer"; + interrupts = <0>; + reg = <0x400f800c 0x8>; + }; + + watchdog@400f8014 { + compatible = "moschip,mcs814x-wdt"; + reg = <0x400f8014 0x8>; + }; + + adc { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <1>; + // 8 64MB chip-selects + ranges = <0 0 0x00000000 0x4000000 // sdram + 1 0 0x04000000 0x4000000 // sdram + 2 0 0x08000000 0x4000000 // reserved + 3 0 0x0c000000 0x4000000 // flash/localbus + 4 0 0x10000000 0x4000000 // flash/localbus + 5 0 0x14000000 0x4000000 // flash/localbus + 6 0 0x18000000 0x4000000 // flash/localbus + 7 0 0x1c000000 0x4000000>; // flash/localbus + + sdram: memory@0,0 { + reg = <0 0 0>; + }; + + nor: flash@7,0 { + reg = <7 0 0x4000000>; + compatible = "cfi-flash"; + bank-width = <1>; // 8-bit external flash + #address-cells = <1>; + #size-cells = <1>; + }; + }; + + usb0: ehci@400fc000 { + compatible = "moschip,mcs814x-ehci", "usb-ehci"; + reg = <0x400fc000 0x74>; + interrupts = <2>; + }; + + usb1: ohci@400fd000 { + compatible = "moschip,mcs814x-ohci", "ohci-le"; + reg = <0x400fd000 0x74>; + interrupts = <11>; + }; + + usb2: ohci@400fe000 { + compatible = "moschip,mcs814x-ohci", "ohci-le"; + reg = <0x400fe000 0x74>; + interrupts = <12>; + }; + + usb3: otg@400ff000 { + compatible = "moschip,msc814x-otg", "usb-otg"; + reg = <0x400ff000 0x1000>; + interrupts = <13>; + }; + }; + + }; +}; diff --git a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts new file mode 100644 index 000000000..997de7d13 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts @@ -0,0 +1,89 @@ +/* + * rbt-832.dts - Device Tree file for Tigal RBT-832 + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2 + */ + +/dts-v1/; +#include "mcs8140.dtsi" + +/ { + model = "Tigal RBT-832"; + compatible = "tigal,rbt-832", "moschip,mcs8140", "moschip,mcs814x"; + + chosen { + bootargs = "mem=32M console=ttyS0,115200 earlyprintk"; + }; + + ahb { + vci { + eth0: ethernet@40084000 { + nuport-mac,link-activity = <0x01>; + phy = <&phy0>; + phy-mode = "mii"; + + phy0: ethernet-phy@0 { + reg = <1>; + }; + }; + + adc { + sdram: memory@0,0 { + reg = <0 0 0x2000000>; + }; + + nor: flash@7,0 { + + partition@0 { + label = "ArmBoot"; + reg = <0 0x40000>; + }; + partition@30000 { + label = "Enviroment"; + reg = <0x40000 0x20000>; + }; + partition@50000 { + label = "bZimage"; + reg = <0x60000 0x1a0000>; + }; + partition@150000 { + label = "UserFS"; + reg = <0x200000 0x600000>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + ethernet { + label = "rbt-832:red:ethernet"; + gpios = <&gpio 0 0>; // gpio 0 active high + }; + + usb0 { + label = "rbt-832:red:usb0"; + gpios = <&gpio 4 0>; // gpio 4 active high + }; + + usb1 { + label = "rbt-832:red:usb1"; + gpios = <&gpio 3 0>; // gpio 3 active high + }; + + usb2 { + label = "rbt-832:red:usb2"; + gpios = <&gpio 2 0>; // gpio 2 active high + }; + + usb3 { + label = "rbt-832:red:usb3"; + gpios = <&gpio 1 0>; // gpio 1 active high + }; + }; + }; + }; +}; + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig new file mode 100644 index 000000000..372c9b87b --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig @@ -0,0 +1,29 @@ +if ARCH_MCS814X + +config MCS8140 + bool + select CPU_ARM926T + +menu "Moschip MCS8140 boards" + +config MACH_DLAN_USB_EXT + bool "Devolo dLAN USB Extender" + select MCS8140 + select NEW_LEDS + select LEDS_CLASS + select LEDS_GPIO + help + Machine support for the Devolo dLAN USB Extender + +config MACH_RBT_832 + bool "Tigal RBT-832" + select MCS8140 + select NEW_LEDS + select LEDS_CLASS + select LEDS_GPIO + help + Machine support for the Tigal RBT-832 board + +endmenu + +endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile new file mode 100644 index 000000000..68c5f4a9f --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile @@ -0,0 +1,5 @@ +obj-y += clock.o +obj-y += common.o +obj-y += irq.o +obj-y += timer.o +obj-y += board-mcs8140-dt.o diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot new file mode 100644 index 000000000..b5725078d --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot @@ -0,0 +1,4 @@ + zreladdr-y := 0x00008000 + +dtb-$(CONFIG_MACH_DLAN_USB_EXT) += dlan-usb-extender.dtb +dtb-$(CONFIG_MACH_RBT_832) += rbt-832.dtb diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c new file mode 100644 index 000000000..0d11450c7 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c @@ -0,0 +1,45 @@ +/* + * Setup code for Moschip MCS8140-based board using Device Tree + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2. + */ +#include +#include +#include +#include +#include +#include + +#include "common.h" + +#include +#include +#include +#include +#include + +static void __init mcs814x_dt_device_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + mcs814x_init_machine(); +} + +static const char *mcs8140_dt_board_compat[] __initdata = { + "moschip,mcs8140", + NULL, /* sentinel */ +}; + +DT_MACHINE_START(mcs8140_dt, "Moschip MCS8140 board") + /* Maintainer: Florian Fainelli */ + .map_io = mcs814x_map_io, + .init_early = mcs814x_clk_init, + .init_irq = mcs814x_of_irq_init, + .init_time = mcs814x_timer_init, + .init_machine = mcs814x_dt_device_init, + .restart = mcs814x_restart, + .dt_compat = mcs8140_dt_board_compat, + .handle_irq = mcs814x_handle_irq, +MACHINE_END + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c new file mode 100644 index 000000000..413bfecaa --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c @@ -0,0 +1,271 @@ +/* + * Moschip MCS814x clock routines + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2 + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "common.h" + +#define KHZ 1000 +#define MHZ (KHZ * KHZ) + +struct clk_ops { + unsigned long (*get_rate)(struct clk *clk); + int (*set_rate)(struct clk *clk, unsigned long rate); + struct clk *(*get_parent)(struct clk *clk); + int (*enable)(struct clk *clk, int enable); +}; + +struct clk { + struct clk *parent; /* parent clk */ + unsigned long rate; /* clock rate in Hz */ + unsigned long divider; /* clock divider */ + u32 usecount; /* reference count */ + struct clk_ops *ops; /* clock operation */ + u32 enable_reg; /* clock enable register */ + u32 enable_mask; /* clock enable mask */ +}; + +static unsigned long clk_divide_parent(struct clk *clk) +{ + if (clk->parent && clk->divider) + return clk_get_rate(clk->parent) / clk->divider; + else + return 0; +} + +static int clk_local_onoff_enable(struct clk *clk, int enable) +{ + u32 tmp; + + /* no enable_reg means the clock is always enabled */ + if (!clk->enable_reg) + return 0; + + tmp = readl_relaxed(mcs814x_sysdbg_base + clk->enable_reg); + if (!enable) + tmp &= ~clk->enable_mask; + else + tmp |= clk->enable_mask; + + writel_relaxed(tmp, mcs814x_sysdbg_base + clk->enable_reg); + + return 0; +} + +static struct clk_ops default_clk_ops = { + .get_rate = clk_divide_parent, + .enable = clk_local_onoff_enable, +}; + +static DEFINE_SPINLOCK(clocks_lock); + +static const unsigned long cpu_freq_table[] = { + 175000, + 300000, + 125000, + 137500, + 212500, + 250000, + 162500, + 187500, + 162500, + 150000, + 225000, + 237500, + 200000, + 262500, + 275000, + 287500 +}; + +static struct clk clk_cpu; + +/* System clock is fixed at 50Mhz */ +static struct clk clk_sys = { + .rate = 50 * MHZ, +}; + +static struct clk clk_sdram; + +static struct clk clk_timer0 = { + .parent = &clk_sdram, + .divider = 2, + .ops = &default_clk_ops, +}; + +static struct clk clk_timer1_2 = { + .parent = &clk_sys, +}; + +/* Watchdog clock is system clock / 128 */ +static struct clk clk_wdt = { + .parent = &clk_sys, + .divider = 128, + .ops = &default_clk_ops, +}; + +static struct clk clk_emac = { + .ops = &default_clk_ops, + .enable_reg = SYSDBG_SYSCTL, + .enable_mask = SYSCTL_EMAC, +}; + +static struct clk clk_ephy = { + .ops = &default_clk_ops, + .enable_reg = SYSDBG_PLL_CTL, + .enable_mask = ~SYSCTL_EPHY, /* active low */ +}; + +static struct clk clk_cipher = { + .ops = &default_clk_ops, + .enable_reg = SYSDBG_SYSCTL, + .enable_mask = SYSCTL_CIPHER, +}; + +#define CLK(_dev, _con, _clk) \ +{ .dev_id = (_dev), .con_id = (_con), .clk = (_clk) }, + +static struct clk_lookup mcs814x_chip_clks[] = { + CLK("cpu", NULL, &clk_cpu) + CLK("sys", NULL, &clk_sys) + CLK("sdram", NULL, &clk_sdram) + /* 32-bits timer0 */ + CLK("timer0", NULL, &clk_timer0) + /* 16-bits timer1 */ + CLK("timer1", NULL, &clk_timer1_2) + /* 64-bits timer2, same as timer 1 */ + CLK("timer2", NULL, &clk_timer1_2) + CLK(NULL, "wdt", &clk_wdt) + CLK(NULL, "emac", &clk_emac) + CLK(NULL, "ephy", &clk_ephy) + CLK(NULL, "cipher", &clk_cipher) +}; + +static void local_clk_disable(struct clk *clk) +{ + WARN_ON(!clk->usecount); + + if (clk->usecount > 0) { + clk->usecount--; + + if ((clk->usecount == 0) && (clk->ops->enable)) + clk->ops->enable(clk, 0); + + if (clk->parent) + local_clk_disable(clk->parent); + } +} + +static int local_clk_enable(struct clk *clk) +{ + int ret = 0; + + if (clk->parent) + ret = local_clk_enable(clk->parent); + + if (ret) + return ret; + + if ((clk->usecount == 0) && (clk->ops->enable)) + ret = clk->ops->enable(clk, 1); + + if (!ret) + clk->usecount++; + else if (clk->parent && clk->parent->ops->enable) + local_clk_disable(clk->parent); + + return ret; +} + +int clk_enable(struct clk *clk) +{ + int ret; + unsigned long flags; + + spin_lock_irqsave(&clocks_lock, flags); + ret = local_clk_enable(clk); + spin_unlock_irqrestore(&clocks_lock, flags); + + return ret; +} +EXPORT_SYMBOL(clk_enable); + +void clk_disable(struct clk *clk) +{ + unsigned long flags; + + spin_lock_irqsave(&clocks_lock, flags); + local_clk_disable(clk); + spin_unlock_irqrestore(&clocks_lock, flags); +} +EXPORT_SYMBOL(clk_disable); + +unsigned long clk_get_rate(struct clk *clk) +{ + if (unlikely(IS_ERR_OR_NULL(clk))) + return 0; + + if (clk->rate) + return clk->rate; + + if (clk->ops && clk->ops->get_rate) + return clk->ops->get_rate(clk); + + return clk_get_rate(clk->parent); +} +EXPORT_SYMBOL(clk_get_rate); + +struct clk *clk_get_parent(struct clk *clk) +{ + unsigned long flags; + + if (unlikely(IS_ERR_OR_NULL(clk))) + return NULL; + + if (!clk->ops || !clk->ops->get_parent) + return clk->parent; + + spin_lock_irqsave(&clocks_lock, flags); + clk->parent = clk->ops->get_parent(clk); + spin_unlock_irqrestore(&clocks_lock, flags); + + return clk->parent; +} +EXPORT_SYMBOL(clk_get_parent); + +void __init mcs814x_clk_init(void) +{ + u32 bs1; + u8 cpu_freq; + + clkdev_add_table(mcs814x_chip_clks, ARRAY_SIZE(mcs814x_chip_clks)); + + /* read the bootstrap registers to know the exact clocking scheme */ + bs1 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS1); + cpu_freq = (bs1 >> CPU_FREQ_SHIFT) & CPU_FREQ_MASK; + + pr_info("CPU frequency: %lu (kHz)\n", cpu_freq_table[cpu_freq]); + clk_cpu.rate = cpu_freq * KHZ; + + /* read SDRAM frequency */ + if (bs1 & SDRAM_FREQ_BIT) + clk_sdram.rate = 100 * MHZ; + else + clk_sdram.rate = 133 * MHZ; + + pr_info("SDRAM frequency: %lu (MHz)\n", clk_sdram.rate / MHZ); +} + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c new file mode 100644 index 000000000..3f1be1fe2 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c @@ -0,0 +1,166 @@ +/* + * arch/arm/mach-mcs814x/common.c + * + * Core functions for Moschip MCS814x SoCs + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +void __iomem *mcs814x_sysdbg_base; + +static struct map_desc mcs814x_io_desc[] __initdata = { + { + .virtual = MCS814X_IO_BASE, + .pfn = __phys_to_pfn(MCS814X_IO_START), + .length = MCS814X_IO_SIZE, + .type = MT_DEVICE + }, +}; + +struct cpu_mode { + const char *name; + int gpio_start; + int gpio_end; +}; + +static const struct cpu_mode cpu_modes[] = { + { + .name = "I2S", + .gpio_start = 4, + .gpio_end = 8, + }, + { + .name = "UART", + .gpio_start = 4, + .gpio_end = 9, + }, + { + .name = "External MII", + .gpio_start = 0, + .gpio_end = 16, + }, + { + .name = "Normal", + .gpio_start = -1, + .gpio_end = -1, + }, +}; + +static void mcs814x_eth_hardware_filter_set(u8 value) +{ + u32 reg; + + reg = readl_relaxed(MCS814X_VIRT_BASE + MCS814X_DBGLED); + if (value) + reg |= 0x80; + else + reg &= ~0x80; + writel_relaxed(reg, MCS814X_VIRT_BASE + MCS814X_DBGLED); +} + +static void mcs814x_eth_led_cfg_set(u8 cfg) +{ + u32 reg; + + reg = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2); + reg &= ~LED_CFG_MASK; + reg |= cfg; + writel_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_BS2); +} + +static void mcs814x_eth_buffer_shifting_set(u8 value) +{ + u8 reg; + + reg = readb_relaxed(mcs814x_sysdbg_base + SYSDBG_SYSCTL_MAC); + if (value) + reg |= BUF_SHIFT_BIT; + else + reg &= ~BUF_SHIFT_BIT; + writeb_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_SYSCTL_MAC); +} + +static struct of_device_id mcs814x_eth_ids[] __initdata = { + { .compatible = "moschip,nuport-mac", }, + { /* sentinel */ }, +}; + +/* Configure platform specific knobs based on ethernet device node + * properties */ +static void mcs814x_eth_init(void) +{ + struct device_node *np; + const unsigned int *intspec; + + np = of_find_matching_node(NULL, mcs814x_eth_ids); + if (!np) + return; + + /* hardware filter must always be enabled */ + mcs814x_eth_hardware_filter_set(1); + + intspec = of_get_property(np, "nuport-mac,buffer-shifting", NULL); + if (!intspec) + mcs814x_eth_buffer_shifting_set(0); + else + mcs814x_eth_buffer_shifting_set(1); + + intspec = of_get_property(np, "nuport-mac,link-activity", NULL); + if (intspec) + mcs814x_eth_led_cfg_set(be32_to_cpup(intspec)); + + of_node_put(np); +} + +void __init mcs814x_init_machine(void) +{ + u32 bs2, cpu_mode; + int gpio; + + bs2 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2); + cpu_mode = (bs2 >> CPU_MODE_SHIFT) & CPU_MODE_MASK; + + pr_info("CPU mode: %s\n", cpu_modes[cpu_mode].name); + + /* request the gpios since the pins are muxed for functionnality */ + for (gpio = cpu_modes[cpu_mode].gpio_start; + gpio == cpu_modes[cpu_mode].gpio_end; gpio++) { + if (gpio != -1) + gpio_request(gpio, cpu_modes[cpu_mode].name); + } + + mcs814x_eth_init(); +} + +void __init mcs814x_map_io(void) +{ + iotable_init(mcs814x_io_desc, ARRAY_SIZE(mcs814x_io_desc)); + + mcs814x_sysdbg_base = ioremap(MCS814X_IO_START + MCS814X_SYSDBG, + MCS814X_SYSDBG_SIZE); + if (!mcs814x_sysdbg_base) + panic("unable to remap sysdbg base"); +} + +void mcs814x_restart(enum reboot_mode mode, const char *cmd) +{ + writel_relaxed(~(1 << 31), mcs814x_sysdbg_base); +} diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h new file mode 100644 index 000000000..4a6c9ad2a --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h @@ -0,0 +1,16 @@ +#ifndef __ARCH_MCS814X_COMMON_H +#define __ARCH_MCS814X_COMMON_H + +#include +#include + +void mcs814x_map_io(void); +void mcs814x_clk_init(void); +void mcs814x_of_irq_init(void); +void mcs814x_init_machine(void); +void mcs814x_handle_irq(struct pt_regs *regs); +void mcs814x_restart(enum reboot_mode mode, const char *cmd); +void mcs814x_timer_init(void); +extern void __iomem *mcs814x_sysdbg_base; + +#endif /* __ARCH_MCS814X_COMMON_H */ diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h new file mode 100644 index 000000000..1ef3c4a03 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h @@ -0,0 +1,16 @@ +#ifndef __ASM_ARCH_CPU_H__ +#define __ASM_ARCH_CPU_H__ + +#include + +#define MCS8140_ID 0x41069260 /* ARM926EJ-S */ +#define MCS814X_MASK 0xff0ffff0 + +#ifdef CONFIG_MCS8140 +/* Moschip MCS8140 is based on an ARM926EJ-S core */ +#define soc_is_mcs8140() ((read_cpuid_id() & MCS814X_MASK) == MCS8140_ID) +#else +#define soc_is_mcs8140() (0) +#endif /* !CONFIG_MCS8140 */ + +#endif /* __ASM_ARCH_CPU_H__ */ diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S new file mode 100644 index 000000000..93ecea4ed --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S @@ -0,0 +1,11 @@ +#include + + .macro addruart, rp, rv, tmp + ldr \rp, =MCS814X_PHYS_BASE + ldr \rv, =MCS814X_VIRT_BASE + orr \rp, \rp, #MCS814X_UART + orr \rv, \rv, #MCS814X_UART + .endm + +#define UART_SHIFT 2 +#include diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S new file mode 100644 index 000000000..16d2d6d1a --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S @@ -0,0 +1,6 @@ +#include + .macro disable_fiq + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h new file mode 100644 index 000000000..20240c2ea --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h @@ -0,0 +1,21 @@ +#ifndef __ASM_ARCH_GPIO_H +#define __ASM_ARCH_GPIO_H + +/* new generic GPIO API */ +#include + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value +#define gpio_cansleep __gpio_cansleep + +static inline int gpio_to_irq(unsigned gpio) +{ + return -EINVAL; +} + +static inline int irq_to_gpio(unsigned irq) +{ + return -EINVAL; +} + +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h new file mode 100644 index 000000000..529f648ae --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +#include "mcs814x.h" + +#endif + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h new file mode 100644 index 000000000..80e56f6ca --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * Copyright (C) 2012, Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +/* + * We don't support ins[lb]/outs[lb]. Make them fault. + */ +#define __raw_readsb(p, d, l) do { *(int *)0 = 0; } while (0) +#define __raw_readsl(p, d, l) do { *(int *)0 = 0; } while (0) +#define __raw_writesb(p, d, l) do { *(int *)0 = 0; } while (0) +#define __raw_writesl(p, d, l) do { *(int *)0 = 0; } while (0) + +#define __io(a) __typesafe_io(a) +#define __mem_pci(a) (a) + +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h new file mode 100644 index 000000000..7b9e07c1a --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARCH_IRQS_H +#define __ASM_ARCH_IRQS_H + +#define FIQ_START 0 + +#define NR_IRQS 32 + +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h new file mode 100644 index 000000000..8252d33a7 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARCH_MCS814X_H +#define __ASM_ARCH_MCS814X_H + +#define MCS814X_IO_BASE 0xF0000000 +#define MCS814X_IO_START 0x40000000 +#define MCS814X_IO_SIZE 0x00100000 + +/* IRQ controller register offset */ +#define MCS814X_IRQ_ICR 0x00 +#define MCS814X_IRQ_ISR 0x04 +#define MCS814X_IRQ_MASK 0x20 +#define MCS814X_IRQ_STS0 0x40 + +#define MCS814X_PHYS_BASE 0x40000000 +#define MCS814X_VIRT_BASE MCS814X_IO_BASE + +#define MCS814X_UART 0x000DC000 +#define MCS814X_DBGLED 0x000EC000 +#define MCS814X_SYSDBG 0x000F8000 +#define MCS814X_SYSDBG_SIZE 0x50 + +/* System configuration and bootstrap registers */ +#define SYSDBG_BS1 0x00 +#define CPU_FREQ_SHIFT 27 +#define CPU_FREQ_MASK 0x0F +#define SDRAM_FREQ_BIT (1 << 22) + +#define SYSDBG_BS2 0x04 +#define LED_CFG_MASK 0x03 +#define CPU_MODE_SHIFT 23 +#define CPU_MODE_MASK 0x03 + +#define SYSDBG_SYSCTL_MAC 0x1d +#define BUF_SHIFT_BIT (1 << 0) + +#define SYSDBG_SYSCTL 0x08 +#define SYSCTL_EMAC (1 << 0) +#define SYSCTL_EPHY (1 << 0) /* active low */ +#define SYSCTL_CIPHER (1 << 16) + +#define SYSDBG_PLL_CTL 0x3C + +#endif /* __ASM_ARCH_MCS814X_H */ + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h new file mode 100644 index 000000000..7ffe70b7d --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARCH_PARAM_H +#define __ASM_ARCH_PARAM_H + +#define HZ 100 + +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h new file mode 100644 index 000000000..cf5453df2 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * Copyright (C) 2012 Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +static inline void arch_idle(void) +{ + cpu_do_idle(); +} +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h new file mode 100644 index 000000000..f05c8eeb6 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2003 Artec Design Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef __ASM_ARCH_TIMEX_H +#define __ASM_ARCH_TIMEX_H + +/* + * Timex specification for MCS814X + */ +#define CLOCK_TICK_RATE 100 + +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h new file mode 100644 index 000000000..cf3ed9a1a --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012, Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __ASM_ARCH_UNCOMPRESS_H +#define __ASM_ARCH_UNCOMPRESS_H + +#include +#include +#include +#include + +#define UART_SHIFT (2) + +/* cannot be static because the code will be inlined */ +void __iomem *uart_base; + +static inline void putc(int c) +{ + while (!(__raw_readb(uart_base + (UART_LSR << UART_SHIFT)) & UART_LSR_TEMT)); + __raw_writeb(c, uart_base + (UART_TX << UART_SHIFT)); +} + +static inline void flush(void) +{ +} + +static inline void arch_decomp_setup(void) +{ + if (soc_is_mcs8140()) + uart_base = (void __iomem *)(MCS814X_PHYS_BASE +MCS814X_UART); +} + +#define arch_decomp_wdog() + +#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c new file mode 100644 index 000000000..d1cab682e --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c @@ -0,0 +1,94 @@ +/* + * Moschip MCS814x generic interrupt controller routines + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under the GPLv2 + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static void __iomem *mcs814x_intc_base; +static struct irq_domain *domain; + +static void __init mcs814x_alloc_gc(void __iomem *base, unsigned int irq_start, + unsigned int num) +{ + struct irq_chip_generic *gc; + struct irq_chip_type *ct; + + if (irq_alloc_domain_generic_chips(domain, num, 1, "mcs814x-intc", handle_level_irq, + IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, 0)) + panic("unable to allocate domain generic irq chip"); + + gc = irq_get_domain_generic_chip(domain, irq_start); + if (!gc) + panic("unable to get generic irq chip"); + + gc->reg_base = base; + ct = gc->chip_types; + ct->chip.irq_ack = irq_gc_unmask_enable_reg; + ct->chip.irq_mask = irq_gc_mask_clr_bit; + ct->chip.irq_unmask = irq_gc_mask_set_bit; + ct->regs.mask = MCS814X_IRQ_MASK; + ct->regs.enable = MCS814X_IRQ_ICR; + + /* Clear all interrupts */ + writel_relaxed(0xffffffff, base + MCS814X_IRQ_ICR); +} + +asmlinkage void __exception_irq_entry mcs814x_handle_irq(struct pt_regs *regs) +{ + u32 status, irq; + + do { + /* read the status register */ + status = __raw_readl(mcs814x_intc_base + MCS814X_IRQ_STS0); + if (!status) + break; + + irq = ffs(status) - 1; + status |= (1 << irq); + /* clear the interrupt */ + __raw_writel(status, mcs814x_intc_base + MCS814X_IRQ_STS0); + /* call the generic handler */ + handle_domain_irq(domain, irq, regs); + + } while (1); +} + +static const struct of_device_id mcs814x_intc_ids[] = { + { .compatible = "moschip,mcs814x-intc" }, + { /* sentinel */ }, +}; + +void __init mcs814x_of_irq_init(void) +{ + struct device_node *np; + + np = of_find_matching_node(NULL, mcs814x_intc_ids); + if (!np) + panic("unable to find compatible intc node in dtb\n"); + + mcs814x_intc_base = of_iomap(np, 0); + if (!mcs814x_intc_base) + panic("unable to map intc cpu registers\n"); + + domain = irq_domain_add_linear(np, 32, &irq_generic_chip_ops, NULL); + if (!domain) + panic("unable to add irq domain\n"); + irq_set_default_host(domain); + + of_node_put(np); + + mcs814x_alloc_gc(mcs814x_intc_base, 0, 32); +} + diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c new file mode 100644 index 000000000..31d0ba65a --- /dev/null +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c @@ -0,0 +1,132 @@ +/* + * Moschip MCS814x timer routines + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Timer block registers */ +#define TIMER_VAL 0x00 +#define TIMER_CTL 0x04 +#define TIMER_CTL_EN 0x01 +#define TIMER_CTL_DBG 0x02 + +static u32 last_reload; +static u32 timer_correct; +static u32 clock_rate; +static u32 timer_reload_value; +static void __iomem *mcs814x_timer_base; + +static inline u32 ticks2usecs(u32 x) +{ + return x / (clock_rate / 1000000); +} + +/* + * Returns number of ms since last clock interrupt. Note that interrupts + * will have been disabled by do_gettimeoffset() + */ +static u32 mcs814x_gettimeoffset(void) +{ + u32 ticks = readl_relaxed(mcs814x_timer_base + TIMER_VAL); + + if (ticks < last_reload) + return ticks2usecs(ticks + (u32)(0xffffffff - last_reload)); + else + return ticks2usecs(ticks - last_reload); +} + + +static irqreturn_t mcs814x_timer_interrupt(int irq, void *dev_id) +{ + u32 count = readl_relaxed(mcs814x_timer_base + TIMER_VAL); + + /* take into account delay up to this moment */ + last_reload = count + timer_correct + timer_reload_value; + + if (last_reload < timer_reload_value) { + last_reload = timer_reload_value; + } else { + if (timer_correct == 0) + timer_correct = readl_relaxed(mcs814x_timer_base + TIMER_VAL) - count; + } + writel_relaxed(last_reload, mcs814x_timer_base + TIMER_VAL); + + timer_tick(); + + return IRQ_HANDLED; +} + +static struct of_device_id mcs814x_timer_ids[] = { + { .compatible = "moschip,mcs814x-timer" }, + { /* sentinel */ }, +}; + +static int __init mcs814x_of_timer_init(void) +{ + struct device_node *np; + int irq; + + np = of_find_matching_node(NULL, mcs814x_timer_ids); + if (!np) + panic("unable to find compatible timer node in dtb"); + + mcs814x_timer_base = of_iomap(np, 0); + if (!mcs814x_timer_base) + panic("unable to remap timer cpu registers"); + + irq = irq_of_parse_and_map(np, 0); + if (!irq) + panic("no interrupts property/mapping failed for timer"); + + return irq; +} + +void __init mcs814x_timer_init(void) +{ + struct clk *clk; + int irq; + + arch_gettimeoffset = mcs814x_gettimeoffset; + + clk = clk_get_sys("timer0", NULL); + if (IS_ERR_OR_NULL(clk)) + panic("unable to get timer0 clock"); + + clock_rate = clk_get_rate(clk); + + irq = mcs814x_of_timer_init(); + + pr_info("Timer frequency: %d (kHz)\n", clock_rate / 1000); + + timer_reload_value = 0xffffffff - (clock_rate / HZ); + + /* disable timer */ + writel_relaxed(~TIMER_CTL_EN, mcs814x_timer_base + TIMER_CTL); + writel_relaxed(timer_reload_value, mcs814x_timer_base + TIMER_VAL); + last_reload = timer_reload_value; + + if (request_irq(irq, mcs814x_timer_interrupt, + IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, + "mcs814x-timer", NULL)) + panic("unable to request timer0 irq %d", irq); + + /* enable timer, stop timer in debug mode */ + writel_relaxed(TIMER_CTL_EN | TIMER_CTL_DBG, + mcs814x_timer_base + TIMER_CTL); +} diff --git a/target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c b/target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c new file mode 100644 index 000000000..cb3f339e3 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c @@ -0,0 +1,121 @@ +/* + * RNG driver for Moschip MCS814x SoC + * + * Copyright 2012 (C), Florian Fainelli + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define STAT 0x00 +#define RND 0x04 + +struct mcs814x_rng_priv { + void __iomem *regs; +}; + +static int mcs814x_rng_data_read(struct hwrng *rng, u32 *buffer) +{ + struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv; + + *buffer = readl_relaxed(priv->regs + RND); + + return 4; +} + +static int mcs814x_rng_probe(struct platform_device *pdev) +{ + struct resource *res; + struct mcs814x_rng_priv *priv; + struct hwrng *rng; + int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) { + ret = -ENOMEM; + goto out; + } + + rng = kzalloc(sizeof(*rng), GFP_KERNEL); + if (!rng) { + ret = -ENOMEM; + goto out_priv; + } + + platform_set_drvdata(pdev, rng); + rng->priv = (unsigned long)priv; + rng->name = pdev->name; + rng->data_read = mcs814x_rng_data_read; + + priv->regs = devm_ioremap_resource(&pdev->dev, res); + if (!priv->regs) { + ret = -ENOMEM; + goto out_rng; + } + + ret = hwrng_register(rng); + if (ret) { + dev_err(&pdev->dev, "failed to register hwrng driver\n"); + goto out; + } + + dev_info(&pdev->dev, "registered\n"); + + return ret; + +out_rng: + platform_set_drvdata(pdev, NULL); + kfree(rng); +out_priv: + kfree(priv); +out: + return ret; +} + +static int mcs814x_rng_remove(struct platform_device *pdev) +{ + struct hwrng *rng = platform_get_drvdata(pdev); + struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv; + + hwrng_unregister(rng); + kfree(priv); + kfree(rng); + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static const struct of_device_id mcs814x_rng_ids[] = { + { .compatible = "moschip,mcs814x-rng", }, + { /* sentinel */ }, +}; + +static struct platform_driver mcs814x_rng_driver = { + .driver = { + .name = "mcs814x-rng", + .owner = THIS_MODULE, + .of_match_table = mcs814x_rng_ids, + }, + .probe = mcs814x_rng_probe, + .remove = mcs814x_rng_remove, +}; + +module_platform_driver(mcs814x_rng_driver); + +MODULE_AUTHOR("Florian Fainelli "); +MODULE_DESCRIPTION("H/W Random Number Generator (RNG) for Moschip MCS814x"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c new file mode 100644 index 000000000..c8a6509cf --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c @@ -0,0 +1,148 @@ +/* + * Moschip MCS814x GPIO support + * + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under the GPLv2 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct mcs814x_gpio_chip { + void __iomem *regs; + struct gpio_chip chip; +}; + +#define GPIO_PIN 0x00 +#define GPIO_DIR 0x04 + +#define to_mcs814x_gpio_chip(x) container_of(x, struct mcs814x_gpio_chip, chip) + +static int mcs814x_gpio_get(struct gpio_chip *chip, unsigned offset) +{ + struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); + + return readl_relaxed(mcs814x->regs + GPIO_PIN) & (1 << offset); +} + +static void mcs814x_gpio_set(struct gpio_chip *chip, + unsigned offset, int value) +{ + struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); + u32 mask; + + mask = readl_relaxed(mcs814x->regs + GPIO_PIN); + if (value) + mask |= (1 << offset); + else + mask &= ~(1 << offset); + writel_relaxed(mask, mcs814x->regs + GPIO_PIN); +} + +static int mcs814x_gpio_direction_output(struct gpio_chip *chip, + unsigned offset, int value) +{ + struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); + u32 mask; + + mask = readl_relaxed(mcs814x->regs + GPIO_DIR); + mask &= ~(1 << offset); + writel_relaxed(mask, mcs814x->regs + GPIO_DIR); + + return 0; +} + +static int mcs814x_gpio_direction_input(struct gpio_chip *chip, + unsigned offset) +{ + struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); + u32 mask; + + mask = readl_relaxed(mcs814x->regs + GPIO_DIR); + mask |= (1 << offset); + writel_relaxed(mask, mcs814x->regs + GPIO_DIR); + + return 0; +} + +static int mcs814x_gpio_probe(struct platform_device *pdev) +{ + struct resource *res; + struct mcs814x_gpio_chip *mcs814x_chip; + int ret; + const unsigned int *num_gpios; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + num_gpios = of_get_property(pdev->dev.of_node, "num-gpios", NULL); + if (!num_gpios) + dev_err(&pdev->dev, "FIXME: no num-gpios property\n"); + + mcs814x_chip = kzalloc(sizeof(*mcs814x_chip), GFP_KERNEL); + if (!mcs814x_chip) + return -ENOMEM; + + mcs814x_chip->regs = devm_ioremap_resource(&pdev->dev, res); + if (!mcs814x_chip->regs) { + ret = -ENOMEM; + goto out; + } + + platform_set_drvdata(pdev, mcs814x_chip); + +#ifdef CONFIG_OF_GPIO + mcs814x_chip->chip.of_node = pdev->dev.of_node; +#endif + + mcs814x_chip->chip.label = pdev->name; + mcs814x_chip->chip.get = mcs814x_gpio_get; + mcs814x_chip->chip.set = mcs814x_gpio_set; + mcs814x_chip->chip.direction_input = mcs814x_gpio_direction_input; + mcs814x_chip->chip.direction_output = mcs814x_gpio_direction_output; + mcs814x_chip->chip.ngpio = be32_to_cpup(num_gpios); + /* we want dynamic base allocation */ + mcs814x_chip->chip.base = -1; + + ret = gpiochip_add(&mcs814x_chip->chip); + if (ret) { + dev_err(&pdev->dev, "failed to register gpiochip\n"); + goto out; + } + + return 0; + +out: + platform_set_drvdata(pdev, NULL); + kfree(mcs814x_chip); + return ret; +} + +static struct of_device_id mcs814x_gpio_ids[] = { + { .compatible = "moschip,mcs814x-gpio" }, + { /* sentinel */ }, +}; + +static struct platform_driver mcs814x_gpio_driver = { + .driver = { + .name = "mcs814x-gpio", + .owner = THIS_MODULE, + .of_match_table = mcs814x_gpio_ids, + }, + .probe = mcs814x_gpio_probe, +}; + +int __init mcs814x_gpio_init(void) +{ + return platform_driver_register(&mcs814x_gpio_driver); +} +postcore_initcall(mcs814x_gpio_init); diff --git a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig new file mode 100644 index 000000000..8fa38a409 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig @@ -0,0 +1,4 @@ +config NUPORT_ETHERNET_DRIVER + tristate "MCS8140 Ethernet driver" + depends on ETHERNET && ARCH_MCS814X + help diff --git a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile new file mode 100644 index 000000000..9719c51b7 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_NUPORT_ETHERNET_DRIVER) += mcs8140.o + +mcs8140-objs := nuport_mac.o diff --git a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c new file mode 100644 index 000000000..a02144e28 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c @@ -0,0 +1,1206 @@ +/* + * Moschip MCS8140 Ethernet MAC driver + * + * Copyright (C) 2003, Moschip Semiconductors + * Copyright (C) 2012, Florian Fainelli + * + * Licensed under GPLv2 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Hardware registers */ +#define MAC_BASE_ADDR ((priv->mac_base)) + +#define CTRL_REG (MAC_BASE_ADDR) +#define MII_BUSY (1 << 0) +#define MII_WRITE (1 << 1) +#define RX_ENABLE (1 << 2) +#define TX_ENABLE (1 << 3) +#define DEFER_CHECK (1 << 5) +#define STRIP_PAD (1 << 8) +#define DRTRY_DISABLE (1 << 10) +#define FULL_DUPLEX (1 << 20) +#define HBD_DISABLE (1 << 28) +#define MAC_ADDR_HIGH_REG (MAC_BASE_ADDR + 0x04) +#define MAC_ADDR_LOW_REG (MAC_BASE_ADDR + 0x08) +#define MII_ADDR_REG (MAC_BASE_ADDR + 0x14) +#define MII_ADDR_SHIFT (11) +#define MII_REG_SHIFT (6) +#define MII_DATA_REG (MAC_BASE_ADDR + 0x18) +/* Link interrupt registers */ +#define LINK_INT_CSR (MAC_BASE_ADDR + 0xD0) +#define LINK_INT_EN (1 << 0) +#define LINK_PHY_ADDR_SHIFT (1) +#define LINK_PHY_REG_SHIFT (6) +#define LINK_BIT_UP_SHIFT (11) +#define LINK_UP (1 << 16) +#define LINK_INT_POLL_TIME (MAC_BASE_ADDR + 0xD4) +#define LINK_POLL_MASK ((1 << 20) - 1) + +#define DMA_CHAN_WIDTH 32 +#define DMA_RX_CHAN 0 +#define DMA_TX_CHAN 2 + +/* Receive DMA registers */ +#define RX_DMA_BASE ((priv->dma_base) + \ + (DMA_CHAN_WIDTH * DMA_RX_CHAN)) +#define RX_BUFFER_ADDR (RX_DMA_BASE + 0x00) +#define RX_MAX_BYTES (RX_DMA_BASE + 0x04) +#define RX_ACT_BYTES (RX_DMA_BASE + 0x08) +#define RX_START_DMA (RX_DMA_BASE + 0x0C) +#define RX_DMA_ENABLE (1 << 0) +#define RX_DMA_RESET (1 << 1) +#define RX_DMA_STATUS_FIFO (1 << 12) +#define RX_DMA_ENH (RX_DMA_BASE + 0x14) +#define RX_DMA_INT_ENABLE (1 << 1) + +/* Transmit DMA registers */ +#define TX_DMA_BASE ((priv->dma_base) + \ + (DMA_CHAN_WIDTH * DMA_TX_CHAN)) +#define TX_BUFFER_ADDR (TX_DMA_BASE + 0x00) +#define TX_PKT_BYTES (TX_DMA_BASE + 0x04) +#define TX_BYTES_SENT (TX_DMA_BASE + 0x08) +#define TX_START_DMA (TX_DMA_BASE + 0x0C) +#define TX_DMA_ENABLE (1 << 0) +#define TX_DMA_START_FRAME (1 << 2) +#define TX_DMA_END_FRAME (1 << 3) +#define TX_DMA_PAD_DISABLE (1 << 8) +#define TX_DMA_CRC_DISABLE (1 << 9) +#define TX_DMA_FIFO_FULL (1 << 16) +#define TX_DMA_FIFO_EMPTY (1 << 17) +#define TX_DMA_STATUS_AVAIL (1 << 18) +#define TX_DMA_RESET (1 << 24) +#define TX_DMA_STATUS (TX_DMA_BASE + 0x10) +#define TX_DMA_ENH (TX_DMA_BASE + 0x14) +#define TX_DMA_ENH_ENABLE (1 << 0) +#define TX_DMA_INT_FIFO (1 << 1) + +#define RX_ALLOC_SIZE SZ_2K +#define MAX_ETH_FRAME_SIZE 1536 +#define RX_SKB_TAILROOM 128 +#define RX_SKB_HEADROOM (RX_ALLOC_SIZE - \ + (MAX_ETH_FRAME_SIZE + RX_SKB_TAILROOM) + 0) + + /* WDT Late COL Lenght COL Type */ +#define ERROR_FILTER_MASK ((1<<14) | (1<<15) | (1<<16) | (1<<17) | (0<<18) | \ + /* MII Dribbling CRC Len/type Control */\ + (1<<19) | (1<<20) | (1<<21) | (0<<24) | (1<<25) | \ + /* Unsup Missed */\ + (1<<26) | (0<<31)) +#define TX_RING_SIZE 30 +#define RX_RING_SIZE 30 + +static inline u32 nuport_mac_readl(void __iomem *reg) +{ + return readl_relaxed(reg); +} + +static inline u8 nuport_mac_readb(void __iomem *reg) +{ + return readb_relaxed(reg); +} + +static inline void nuport_mac_writel(u32 value, void __iomem *reg) +{ + writel_relaxed(value, reg); +} + +static inline void nuport_mac_writeb(u8 value, void __iomem *reg) +{ + writel_relaxed(value, reg); +} + +/* MAC private data */ +struct nuport_mac_priv { + spinlock_t lock; + + void __iomem *mac_base; + void __iomem *dma_base; + + int rx_irq; + int tx_irq; + int link_irq; + struct clk *emac_clk; + struct clk *ephy_clk; + + /* Transmit buffers */ + struct sk_buff *tx_skb[TX_RING_SIZE]; + dma_addr_t tx_addr; + unsigned int valid_txskb[TX_RING_SIZE]; + unsigned int cur_tx; + unsigned int dma_tx; + unsigned int tx_full; + + /* Receive buffers */ + struct sk_buff *rx_skb[RX_RING_SIZE]; + dma_addr_t rx_addr; + unsigned int irq_rxskb[RX_RING_SIZE]; + int pkt_len[RX_RING_SIZE]; + unsigned int cur_rx; + unsigned int dma_rx; + unsigned int rx_full; + + unsigned int first_pkt; + + /* Private data */ + struct napi_struct napi; + struct net_device *dev; + struct platform_device *pdev; + struct mii_bus *mii_bus; + struct phy_device *phydev; + struct device_node *phy_node; + phy_interface_t phy_interface; + int old_link; + int old_duplex; + u32 msg_level; + unsigned int buffer_shifting_len; +}; + +static inline int nuport_mac_mii_busy_wait(struct nuport_mac_priv *priv) +{ + unsigned long curr; + unsigned long finish = jiffies + 3 * HZ; + + do { + curr = jiffies; + if (!(nuport_mac_readl(MII_ADDR_REG) & MII_BUSY)) + return 0; + cpu_relax(); + } while (!time_after_eq(curr, finish)); + + return -EBUSY; +} + +/* Read from PHY registers */ +static int nuport_mac_mii_read(struct mii_bus *bus, + int mii_id, int regnum) +{ + struct net_device *dev = bus->priv; + struct nuport_mac_priv *priv = netdev_priv(dev); + int ret; + u32 val = 0; + + ret = nuport_mac_mii_busy_wait(priv); + if (ret) + return ret; + + val |= (mii_id << MII_ADDR_SHIFT) | (regnum << MII_REG_SHIFT) | MII_BUSY; + nuport_mac_writel(val, MII_ADDR_REG); + ret = nuport_mac_mii_busy_wait(priv); + if (ret) + return ret; + + return nuport_mac_readl(MII_DATA_REG); +} + +static int nuport_mac_mii_write(struct mii_bus *bus, int mii_id, + int regnum, u16 value) +{ + struct net_device *dev = bus->priv; + struct nuport_mac_priv *priv = netdev_priv(dev); + int ret; + u32 val = 0; + + ret = nuport_mac_mii_busy_wait(priv); + if (ret) + return ret; + + val |= (mii_id << MII_ADDR_SHIFT) | (regnum << MII_REG_SHIFT); + val |= MII_BUSY | MII_WRITE; + nuport_mac_writel(value, MII_DATA_REG); + nuport_mac_writel(val, MII_ADDR_REG); + + return nuport_mac_mii_busy_wait(priv); +} + +static int nuport_mac_mii_reset(struct mii_bus *bus) +{ + return 0; +} + +static int nuport_mac_start_tx_dma(struct nuport_mac_priv *priv, + struct sk_buff *skb) +{ + u32 reg; + unsigned int timeout = 2048; + + while (timeout--) { + reg = nuport_mac_readl(TX_START_DMA); + if (!(reg & TX_DMA_ENABLE)) { + netdev_dbg(priv->dev, "dma ready\n"); + break; + } + cpu_relax(); + } + + if (!timeout) + return -EBUSY; + + priv->tx_addr = dma_map_single(&priv->pdev->dev, skb->data, + skb->len, DMA_TO_DEVICE); + if (dma_mapping_error(&priv->pdev->dev, priv->tx_addr)) + return -ENOMEM; + + /* enable enhanced mode */ + nuport_mac_writel(TX_DMA_ENH_ENABLE, TX_DMA_ENH); + nuport_mac_writel(priv->tx_addr, TX_BUFFER_ADDR); + nuport_mac_writel((skb->len) - 1, TX_PKT_BYTES); + wmb(); + reg = TX_DMA_ENABLE | TX_DMA_START_FRAME | TX_DMA_END_FRAME; + nuport_mac_writel(reg, TX_START_DMA); + + return 0; +} + +static void nuport_mac_reset_tx_dma(struct nuport_mac_priv *priv) +{ + u32 reg; + + reg = nuport_mac_readl(TX_START_DMA); + reg |= TX_DMA_RESET; + nuport_mac_writel(reg, TX_START_DMA); +} + +static int nuport_mac_start_rx_dma(struct nuport_mac_priv *priv, + struct sk_buff *skb) +{ + u32 reg; + unsigned int timeout = 2048; + + while (timeout--) { + reg = nuport_mac_readl(RX_START_DMA); + if (!(reg & RX_DMA_ENABLE)) { + netdev_dbg(priv->dev, "dma ready\n"); + break; + } + cpu_relax(); + } + + if (!timeout) + return -EBUSY; + + priv->rx_addr = dma_map_single(&priv->pdev->dev, skb->data, + RX_ALLOC_SIZE, DMA_FROM_DEVICE); + if (dma_mapping_error(&priv->pdev->dev, priv->rx_addr)) + return -ENOMEM; + + nuport_mac_writel(priv->rx_addr, RX_BUFFER_ADDR); + wmb(); + nuport_mac_writel(RX_DMA_ENABLE, RX_START_DMA); + + return 0; +} + +static void nuport_mac_reset_rx_dma(struct nuport_mac_priv *priv) +{ + u32 reg; + + reg = nuport_mac_readl(RX_START_DMA); + reg |= RX_DMA_RESET; + nuport_mac_writel(reg, RX_START_DMA); +} + +/* I suppose this might do something, but I am not sure actually */ +static void nuport_mac_disable_rx_dma(struct nuport_mac_priv *priv) +{ + u32 reg; + + reg = nuport_mac_readl(RX_DMA_ENH); + reg &= ~RX_DMA_INT_ENABLE; + nuport_mac_writel(reg, RX_DMA_ENH); +} + +static void nuport_mac_enable_rx_dma(struct nuport_mac_priv *priv) +{ + u32 reg; + + reg = nuport_mac_readl(RX_DMA_ENH); + reg |= RX_DMA_INT_ENABLE; + nuport_mac_writel(reg, RX_DMA_ENH); +} + +/* Add packets to the transmit queue */ +static int nuport_mac_start_xmit(struct sk_buff *skb, struct net_device *dev) +{ + unsigned long flags; + struct nuport_mac_priv *priv = netdev_priv(dev); + int ret; + + if (netif_queue_stopped(dev)) { + netdev_warn(dev, "netif queue was stopped, restarting\n"); + netif_start_queue(dev); + } + + spin_lock_irqsave(&priv->lock, flags); + if (priv->first_pkt) { + ret = nuport_mac_start_tx_dma(priv, skb); + if (ret) { + netif_stop_queue(dev); + spin_unlock_irqrestore(&priv->lock, flags); + netdev_err(dev, "transmit path busy\n"); + return NETDEV_TX_BUSY; + } + priv->first_pkt = 0; + } + + priv->tx_skb[priv->cur_tx] = skb; + dev->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + priv->valid_txskb[priv->cur_tx] = 1; + priv->cur_tx++; + dev->trans_start = jiffies; + + if (priv->cur_tx >= TX_RING_SIZE) + priv->cur_tx = 0; + + spin_unlock_irqrestore(&priv->lock, flags); + + if (priv->valid_txskb[priv->cur_tx]) { + priv->tx_full = 1; + netdev_err(dev, "stopping queue\n"); + netif_stop_queue(dev); + } + + return NETDEV_TX_OK; +} + +static void nuport_mac_adjust_link(struct net_device *dev) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + struct phy_device *phydev = priv->phydev; + unsigned int status_changed = 0; + u32 reg; + + BUG_ON(!phydev); + + if (priv->old_link != phydev->link) { + status_changed = 1; + priv->old_link = phydev->link; + } + + if (phydev->link && (priv->old_duplex != phydev->duplex)) { + reg = nuport_mac_readl(CTRL_REG); + if (phydev->duplex == DUPLEX_FULL) + reg |= DUPLEX_FULL; + else + reg &= ~DUPLEX_FULL; + nuport_mac_writel(reg, CTRL_REG); + + status_changed = 1; + priv->old_duplex = phydev->duplex; + } + + if (!status_changed) + return; + + pr_info("%s: link %s", dev->name, phydev->link ? + "UP" : "DOWN"); + if (phydev->link) { + pr_cont(" - %d/%s", phydev->speed, + phydev->duplex == DUPLEX_FULL ? "full" : "half"); + } + pr_cont("\n"); +} + +static irqreturn_t nuport_mac_link_interrupt(int irq, void *dev_id) +{ + struct net_device *dev = dev_id; + struct nuport_mac_priv *priv = netdev_priv(dev); + u32 reg; + u8 phy_addr; + unsigned long flags; + irqreturn_t ret = IRQ_HANDLED; + + spin_lock_irqsave(&priv->lock, flags); + reg = nuport_mac_readl(LINK_INT_CSR); + phy_addr = (reg >> LINK_PHY_ADDR_SHIFT) & (PHY_MAX_ADDR - 1); + + if (phy_addr != priv->phydev->addr) { + netdev_err(dev, "spurious PHY irq (phy: %d)\n", phy_addr); + ret = IRQ_NONE; + goto out; + } + + priv->phydev->link = (reg & LINK_UP); + nuport_mac_adjust_link(dev); + +out: + spin_unlock_irqrestore(&priv->lock, flags); + return ret; +} + +static irqreturn_t nuport_mac_tx_interrupt(int irq, void *dev_id) +{ + struct net_device *dev = (struct net_device *)dev_id; + struct nuport_mac_priv *priv = netdev_priv(dev); + struct sk_buff *skb; + unsigned long flags; + int ret; + u32 reg; + + spin_lock_irqsave(&priv->lock, flags); + /* clear status word available if ready */ + reg = nuport_mac_readl(TX_START_DMA); + if (reg & TX_DMA_STATUS_AVAIL) { + nuport_mac_writel(reg, TX_START_DMA); + reg = nuport_mac_readl(TX_DMA_STATUS); + + if (reg & 1) + dev->stats.tx_errors++; + } else + netdev_dbg(dev, "no status word: %08x\n", reg); + + skb = priv->tx_skb[priv->dma_tx]; + priv->tx_skb[priv->dma_tx] = NULL; + priv->valid_txskb[priv->dma_tx] = 0; + dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len, + DMA_TO_DEVICE); + dev_kfree_skb_irq(skb); + + priv->dma_tx++; + if (priv->dma_tx >= TX_RING_SIZE) + priv->dma_tx = 0; + + if (!priv->valid_txskb[priv->dma_tx]) + priv->first_pkt = 1; + else { + ret = nuport_mac_start_tx_dma(priv, priv->tx_skb[priv->dma_tx]); + if (ret) + netdev_err(dev, "failed to restart TX dma\n"); + } + + if (priv->tx_full) { + netdev_dbg(dev, "restarting transmit queue\n"); + netif_wake_queue(dev); + priv->tx_full = 0; + } + + spin_unlock_irqrestore(&priv->lock, flags); + + return IRQ_HANDLED; +} + +static unsigned int nuport_mac_has_work(struct nuport_mac_priv *priv) +{ + unsigned int i; + + for (i = 0; i < RX_RING_SIZE; i++) + if (priv->rx_skb[i]) + return 1; + + return 0; +} + +static irqreturn_t nuport_mac_rx_interrupt(int irq, void *dev_id) +{ + struct net_device *dev = (struct net_device *)dev_id; + struct nuport_mac_priv *priv = netdev_priv(dev); + unsigned long flags; + int ret; + + spin_lock_irqsave(&priv->lock, flags); + if (!priv->rx_full) { + priv->pkt_len[priv->dma_rx] = nuport_mac_readl(RX_ACT_BYTES) - 4; + priv->irq_rxskb[priv->dma_rx] = 0; + priv->dma_rx++; + + if (priv->dma_rx >= RX_RING_SIZE) + priv->dma_rx = 0; + } else + priv->rx_full = 0; + + if (priv->irq_rxskb[priv->dma_rx] == 1) { + ret = nuport_mac_start_rx_dma(priv, priv->rx_skb[priv->dma_rx]); + if (ret) + netdev_err(dev, "failed to start rx dma\n"); + } else { + priv->rx_full = 1; + netdev_dbg(dev, "RX ring full\n"); + } + + if (likely(nuport_mac_has_work(priv))) { + /* find a way to disable DMA rx irq */ + nuport_mac_disable_rx_dma(priv); + napi_schedule(&priv->napi); + } + spin_unlock_irqrestore(&priv->lock, flags); + + return IRQ_HANDLED; +} + +/* Process received packets in tasklet */ +static int nuport_mac_rx(struct net_device *dev, int limit) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + struct sk_buff *skb; + int len, status; + int count = 0; + + while (count < limit && !priv->irq_rxskb[priv->cur_rx]) { + skb = priv->rx_skb[priv->cur_rx]; + len = priv->pkt_len[priv->cur_rx]; + + /* Remove 2 bytes added by RX buffer shifting */ + len = len - priv->buffer_shifting_len; + skb->data = skb->data + priv->buffer_shifting_len; + + /* Get packet status */ + status = get_unaligned((u32 *) (skb->data + len)); + + dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len, + DMA_FROM_DEVICE); + + /* packet filter failed */ + if (!(status & (1 << 30))) { + dev_kfree_skb_irq(skb); + goto exit; + } + + /* missed frame */ + if (status & (1 << 31)) { + dev->stats.rx_missed_errors++; + dev_kfree_skb_irq(skb); + goto exit; + } + + /* Not ethernet type */ + if ((!(status & (1 << 18))) || (status & ERROR_FILTER_MASK)) + dev->stats.rx_errors++; + + if (len > MAX_ETH_FRAME_SIZE) { + dev_kfree_skb_irq(skb); + goto exit; + } else + skb_put(skb, len); + + skb->protocol = eth_type_trans(skb, dev); + dev->stats.rx_packets++; + + if (status & (1 << 29)) + skb->pkt_type = PACKET_OTHERHOST; + if (status & (1 << 27)) + skb->pkt_type = PACKET_MULTICAST; + if (status & (1 << 28)) + skb->pkt_type = PACKET_BROADCAST; + + skb->ip_summed = CHECKSUM_UNNECESSARY; + + /* Pass the received packet to network layer */ + status = netif_receive_skb(skb); + if (status != NET_RX_DROP) + dev->stats.rx_bytes += len - 4; /* Without CRC */ + else + dev->stats.rx_dropped++; + + dev->last_rx = jiffies; + +exit: + skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE); + if (!skb) + goto out; + + skb_reserve(skb, RX_SKB_HEADROOM); + priv->rx_skb[priv->cur_rx] = skb; + priv->irq_rxskb[priv->cur_rx] = 1; + priv->cur_rx++; + + if (priv->cur_rx >= RX_RING_SIZE) + priv->cur_rx = 0; + count++; + } +out: + return count; +} + +static int nuport_mac_poll(struct napi_struct *napi, int budget) +{ + struct nuport_mac_priv *priv = + container_of(napi, struct nuport_mac_priv, napi); + struct net_device *dev = priv->dev; + int work_done; + + work_done = nuport_mac_rx(dev, budget); + + if (work_done < budget) { + napi_complete(napi); + nuport_mac_enable_rx_dma(priv); + } + + return work_done; +} + +static void nuport_mac_init_tx_ring(struct nuport_mac_priv *priv) +{ + int i; + + priv->cur_tx = priv->dma_tx = priv->tx_full = 0; + for (i = 0; i < TX_RING_SIZE; i++) { + priv->tx_skb[i] = NULL; + priv->valid_txskb[i] = 0; + } + priv->first_pkt = 1; +} + +static int nuport_mac_init_rx_ring(struct net_device *dev) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + struct sk_buff *skb; + int i; + + priv->cur_rx = priv->dma_rx = priv->rx_full = 0; + + for (i = 0; i < RX_RING_SIZE; i++) { + skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE); + if (!skb) + return -ENOMEM; + skb_reserve(skb, RX_SKB_HEADROOM); + priv->rx_skb[i] = skb; + priv->irq_rxskb[i] = 1; + } + + return 0; +} + +static void nuport_mac_free_rx_ring(struct nuport_mac_priv *priv) +{ + int i; + + for (i = 0; i < RX_RING_SIZE; i++) { + if (!priv->rx_skb[i]) + continue; + + dev_kfree_skb(priv->rx_skb[i]); + priv->rx_skb[i] = NULL; + } + + if (priv->rx_addr) + dma_unmap_single(&priv->pdev->dev, priv->rx_addr, RX_ALLOC_SIZE, + DMA_TO_DEVICE); +} + +static void nuport_mac_read_mac_address(struct net_device *dev) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + int i; + + for (i = 0; i < 4; i++) + dev->dev_addr[i] = nuport_mac_readb(MAC_ADDR_LOW_REG + i); + dev->dev_addr[4] = nuport_mac_readb(MAC_ADDR_HIGH_REG); + dev->dev_addr[5] = nuport_mac_readb(MAC_ADDR_HIGH_REG + 1); + + if (!is_valid_ether_addr(dev->dev_addr)) { + dev_info(&priv->pdev->dev, "using random address\n"); + random_ether_addr(dev->dev_addr); + } +} + +static int nuport_mac_change_mac_address(struct net_device *dev, void *mac_addr) +{ + struct sockaddr *addr = mac_addr; + struct nuport_mac_priv *priv = netdev_priv(dev); + unsigned long *temp = (unsigned long *)dev->dev_addr; + u32 high, low; + + if (netif_running(dev)) + return -EBUSY; + + memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + + spin_lock_irq(&priv->lock); + + nuport_mac_writel(*temp, MAC_ADDR_LOW_REG); + temp = (unsigned long *)(dev->dev_addr + 4); + nuport_mac_writel(*temp, MAC_ADDR_HIGH_REG); + + low = nuport_mac_readl(MAC_ADDR_LOW_REG); + high = nuport_mac_readl(MAC_ADDR_HIGH_REG); + + spin_unlock_irq(&priv->lock); + + return 0; +} + +static int nuport_mac_open(struct net_device *dev) +{ + int ret; + struct nuport_mac_priv *priv = netdev_priv(dev); + unsigned long flags; + u32 reg = 0; + + ret = clk_enable(priv->emac_clk); + if (ret) { + netdev_err(dev, "failed to enable EMAC clock\n"); + return ret; + } + + /* Set MAC into full duplex mode by default */ + reg |= RX_ENABLE | TX_ENABLE; + reg |= DEFER_CHECK | STRIP_PAD | DRTRY_DISABLE; + reg |= FULL_DUPLEX | HBD_DISABLE; + nuport_mac_writel(reg, CTRL_REG); + + /* set mac address in hardware in case it was not already */ + nuport_mac_change_mac_address(dev, dev->dev_addr); + + ret = request_irq(priv->link_irq, &nuport_mac_link_interrupt, + 0, dev->name, dev); + if (ret) { + netdev_err(dev, "unable to request link interrupt\n"); + goto out_emac_clk; + } + + ret = request_irq(priv->tx_irq, &nuport_mac_tx_interrupt, + 0, dev->name, dev); + if (ret) { + netdev_err(dev, "unable to request rx interrupt\n"); + goto out_link_irq; + } + + /* Enable link interrupt monitoring for our PHY address */ + reg = LINK_INT_EN | (priv->phydev->addr << LINK_PHY_ADDR_SHIFT); + /* MII_BMSR register to be watched */ + reg |= (1 << LINK_PHY_REG_SHIFT); + /* BMSR_STATUS to be watched in particular */ + reg |= (2 << LINK_BIT_UP_SHIFT); + + spin_lock_irqsave(&priv->lock, flags); + nuport_mac_writel(reg, LINK_INT_CSR); + nuport_mac_writel(LINK_POLL_MASK, LINK_INT_POLL_TIME); + spin_unlock_irqrestore(&priv->lock, flags); + + phy_start(priv->phydev); + + ret = request_irq(priv->rx_irq, &nuport_mac_rx_interrupt, + 0, dev->name, dev); + if (ret) { + netdev_err(dev, "unable to request tx interrupt\n"); + goto out_tx_irq; + } + + netif_start_queue(dev); + + nuport_mac_init_tx_ring(priv); + + ret = nuport_mac_init_rx_ring(dev); + if (ret) { + netdev_err(dev, "rx ring init failed\n"); + goto out_rx_skb; + } + + nuport_mac_reset_tx_dma(priv); + nuport_mac_reset_rx_dma(priv); + + /* Start RX DMA */ + spin_lock_irqsave(&priv->lock, flags); + ret = nuport_mac_start_rx_dma(priv, priv->rx_skb[0]); + spin_unlock_irqrestore(&priv->lock, flags); + + napi_enable(&priv->napi); + + return ret; + +out_rx_skb: + nuport_mac_free_rx_ring(priv); + free_irq(priv->rx_irq, dev); +out_tx_irq: + free_irq(priv->tx_irq, dev); +out_link_irq: + free_irq(priv->link_irq, dev); +out_emac_clk: + clk_disable(priv->emac_clk); + return ret; +} + +static int nuport_mac_close(struct net_device *dev) +{ + u32 reg; + struct nuport_mac_priv *priv = netdev_priv(dev); + + spin_lock_irq(&priv->lock); + reg = nuport_mac_readl(CTRL_REG); + reg &= ~(RX_ENABLE | TX_ENABLE); + nuport_mac_writel(reg, CTRL_REG); + + napi_disable(&priv->napi); + netif_stop_queue(dev); + + free_irq(priv->link_irq, dev); + /* disable PHY polling */ + nuport_mac_writel(0, LINK_INT_CSR); + nuport_mac_writel(0, LINK_INT_POLL_TIME); + phy_stop(priv->phydev); + + free_irq(priv->tx_irq, dev); + free_irq(priv->rx_irq, dev); + spin_unlock_irq(&priv->lock); + + nuport_mac_free_rx_ring(priv); + + clk_disable(priv->emac_clk); + + return 0; +} + +static void nuport_mac_tx_timeout(struct net_device *dev) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + unsigned int i; + + netdev_warn(dev, "transmit timeout, attempting recovery\n"); + + netdev_info(dev, "TX DMA regs\n"); + for (i = 0; i < DMA_CHAN_WIDTH; i += 4) + netdev_info(dev, "[%02x]: 0x%08x\n", i, nuport_mac_readl(TX_DMA_BASE + i)); + netdev_info(dev, "RX DMA regs\n"); + for (i = 0; i < DMA_CHAN_WIDTH; i += 4) + netdev_info(dev, "[%02x]: 0x%08x\n", i, nuport_mac_readl(RX_DMA_BASE + i)); + + nuport_mac_init_tx_ring(priv); + nuport_mac_reset_tx_dma(priv); + + netif_wake_queue(dev); +} + +static int nuport_mac_mii_probe(struct net_device *dev) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + struct phy_device *phydev = NULL; + int ret; + + ret = clk_enable(priv->ephy_clk); + if (ret) { + netdev_err(dev, "unable to enable ePHY clk\n"); + return ret; + } + + phydev = phy_find_first(priv->mii_bus); + if (!phydev) { + netdev_err(dev, "no PHYs found\n"); + ret = -ENODEV; + goto out; + } + + phydev = of_phy_connect(dev, priv->phy_node, + nuport_mac_adjust_link, 0, + priv->phy_interface); + if (IS_ERR(phydev)) { + netdev_err(dev, "could not attach PHY\n"); + ret = PTR_ERR(phydev); + goto out; + } + + phydev->supported &= PHY_BASIC_FEATURES; + phydev->advertising = phydev->supported; + priv->phydev = phydev; + priv->old_link = 1; + priv->old_duplex = DUPLEX_FULL; + + dev_info(&priv->pdev->dev, "attached PHY driver [%s] " + "(mii_bus:phy_addr=%d)\n", + phydev->drv->name, phydev->addr); + + return 0; + +out: + /* disable the Ethernet PHY clock for the moment */ + clk_disable(priv->ephy_clk); + + return ret; +} + +static void nuport_mac_ethtool_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strncpy(info->driver, "nuport-mac", sizeof(info->driver)); + strncpy(info->version, "0.1", sizeof(info->version)); + strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); + strncpy(info->bus_info, "internal", sizeof(info->bus_info)); + info->n_stats = 0; + info->testinfo_len = 0; + info->regdump_len = 0; + info->eedump_len = 0; +} + +static int nuport_mac_ethtool_get_settings(struct net_device *dev, + struct ethtool_cmd *cmd) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + + if (priv->phydev) + return phy_ethtool_gset(priv->phydev, cmd); + + return -EINVAL; +} + +static int nuport_mac_ethtool_set_settings(struct net_device *dev, + struct ethtool_cmd *cmd) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + + if (priv->phydev) + return phy_ethtool_sset(priv->phydev, cmd); + + return -EINVAL; +} + +static void nuport_mac_set_msglevel(struct net_device *dev, u32 msg_level) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + + priv->msg_level = msg_level; +} + +static u32 nuport_mac_get_msglevel(struct net_device *dev) +{ + struct nuport_mac_priv *priv = netdev_priv(dev); + + return priv->msg_level; +} + +static const struct ethtool_ops nuport_mac_ethtool_ops = { + .get_drvinfo = nuport_mac_ethtool_drvinfo, + .get_link = ethtool_op_get_link, + .get_settings = nuport_mac_ethtool_get_settings, + .set_settings = nuport_mac_ethtool_set_settings, + .set_msglevel = nuport_mac_set_msglevel, + .get_msglevel = nuport_mac_get_msglevel, +}; + +static const struct net_device_ops nuport_mac_ops = { + .ndo_open = nuport_mac_open, + .ndo_stop = nuport_mac_close, + .ndo_start_xmit = nuport_mac_start_xmit, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = nuport_mac_change_mac_address, + .ndo_tx_timeout = nuport_mac_tx_timeout, +}; + +static int __init nuport_mac_probe(struct platform_device *pdev) +{ + struct net_device *dev; + struct nuport_mac_priv *priv = NULL; + struct resource *regs, *dma; + int ret = 0; + int rx_irq, tx_irq, link_irq; + int i; + const unsigned int *intspec; + + dev = alloc_etherdev(sizeof(struct nuport_mac_priv)); + if (!dev) { + dev_err(&pdev->dev, "no memory for net_device\n"); + return -ENOMEM; + } + + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + dma = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!regs || !dma) { + dev_err(&pdev->dev, "failed to get regs resources\n"); + ret = -ENODEV; + goto out; + } + + rx_irq = platform_get_irq(pdev, 0); + tx_irq = platform_get_irq(pdev, 1); + link_irq = platform_get_irq(pdev, 2); + if (rx_irq < 0 || tx_irq < 0 || link_irq < 0) { + ret = -ENODEV; + goto out; + } + + platform_set_drvdata(pdev, dev); + SET_NETDEV_DEV(dev, &pdev->dev); + priv = netdev_priv(dev); + priv->pdev = pdev; + priv->dev = dev; + spin_lock_init(&priv->lock); + + intspec = of_get_property(pdev->dev.of_node, + "nuport-mac,buffer-shifting", NULL); + if (!intspec) + priv->buffer_shifting_len = 0; + else + priv->buffer_shifting_len = 2; + + priv->mac_base = devm_ioremap_resource(&pdev->dev, regs); + if (!priv->mac_base) { + dev_err(&pdev->dev, "failed to remap regs\n"); + ret = -ENOMEM; + goto out_platform; + } + + priv->dma_base = devm_ioremap_resource(&pdev->dev, dma); + if (!priv->dma_base) { + dev_err(&pdev->dev, "failed to remap dma-regs\n"); + ret = -ENOMEM; + goto out_platform; + } + + priv->emac_clk = clk_get(&pdev->dev, "emac"); + if (IS_ERR_OR_NULL(priv->emac_clk)) { + dev_err(&pdev->dev, "failed to get emac clk\n"); + ret = PTR_ERR(priv->emac_clk); + goto out_platform; + } + + priv->ephy_clk = clk_get(&pdev->dev, "ephy"); + if (IS_ERR_OR_NULL(priv->ephy_clk)) { + dev_err(&pdev->dev, "failed to get ephy clk\n"); + ret = PTR_ERR(priv->ephy_clk); + goto out_platform; + } + + priv->link_irq = link_irq; + priv->rx_irq = rx_irq; + priv->tx_irq = tx_irq; + priv->msg_level = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK; + dev->netdev_ops = &nuport_mac_ops; + dev->ethtool_ops = &nuport_mac_ethtool_ops; + dev->watchdog_timeo = HZ; + dev->flags = IFF_BROADCAST; /* Supports Broadcast */ + dev->tx_queue_len = TX_RING_SIZE / 2; + + netif_napi_add(dev, &priv->napi, nuport_mac_poll, 64); + + priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy", 0); + if (!priv->phy_node) { + dev_err(&pdev->dev, "no associated PHY\n"); + ret = -ENODEV; + goto out; + } + + priv->phy_interface = of_get_phy_mode(pdev->dev.of_node); + if (priv->phy_interface < 0) { + dev_err(&pdev->dev, "invalid PHY mode\n"); + ret = -EINVAL; + goto out; + } + + priv->mii_bus = mdiobus_alloc(); + if (!priv->mii_bus) { + dev_err(&pdev->dev, "mii bus allocation failed\n"); + goto out; + } + + priv->mii_bus->priv = dev; + priv->mii_bus->read = nuport_mac_mii_read; + priv->mii_bus->write = nuport_mac_mii_write; + priv->mii_bus->reset = nuport_mac_mii_reset; + priv->mii_bus->name = "nuport-mac-mii"; + priv->mii_bus->phy_mask = (1 << 0); + snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s", pdev->name); + priv->mii_bus->irq = kzalloc(PHY_MAX_ADDR * sizeof(int), GFP_KERNEL); + if (!priv->mii_bus->irq) { + dev_err(&pdev->dev, "failed to allocate mii_bus irqs\n"); + ret = -ENOMEM; + goto out_mdio; + } + + /* We support PHY interrupts routed back to the MAC */ + for (i = 0; i < PHY_MAX_ADDR; i++) + priv->mii_bus->irq[i] = PHY_IGNORE_INTERRUPT; + + ret = of_mdiobus_register(priv->mii_bus, pdev->dev.of_node); + if (ret) { + dev_err(&pdev->dev, "failed to register mii_bus\n"); + goto out_mdio_irq; + } + + ret = nuport_mac_mii_probe(dev); + if (ret) { + dev_err(&pdev->dev, "failed to probe MII bus\n"); + goto out_mdio_unregister; + } + + ret = register_netdev(dev); + if (ret) { + dev_err(&pdev->dev, "failed to register net_device\n"); + goto out_mdio_probe; + } + + /* read existing mac address */ + nuport_mac_read_mac_address(dev); + + dev_info(&pdev->dev, "registered (MAC: %pM)\n", dev->dev_addr); + + return ret; + +out_mdio_probe: + phy_disconnect(priv->phydev); +out_mdio_unregister: + mdiobus_unregister(priv->mii_bus); +out_mdio_irq: + kfree(priv->mii_bus->irq); +out_mdio: + mdiobus_free(priv->mii_bus); +out_platform: + platform_set_drvdata(pdev, NULL); +out: + clk_put(priv->ephy_clk); + clk_put(priv->emac_clk); + free_netdev(dev); + platform_set_drvdata(pdev, NULL); + return ret; +} + +static int nuport_mac_remove(struct platform_device *pdev) +{ + struct net_device *dev = platform_get_drvdata(pdev); + struct nuport_mac_priv *priv = netdev_priv(dev); + + unregister_netdev(dev); + phy_disconnect(priv->phydev); + mdiobus_unregister(priv->mii_bus); + kfree(priv->mii_bus->irq); + mdiobus_free(priv->mii_bus); + clk_put(priv->ephy_clk); + clk_put(priv->emac_clk); + free_netdev(dev); + + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static struct of_device_id nuport_eth_ids[] __initdata = { + {.compatible = "moschip,nuport-mac",}, + { /* sentinel */ }, +}; + +static struct platform_driver nuport_eth_driver = { + .driver = { + .name = "nuport-mac", + .owner = THIS_MODULE, + .of_match_table = nuport_eth_ids, + }, + .probe = nuport_mac_probe, + .remove = nuport_mac_remove, +}; + +module_platform_driver(nuport_eth_driver); + +MODULE_AUTHOR("Moschip Semiconductors Ltd."); +MODULE_DESCRIPTION("Moschip MCS8140 Ethernet MAC driver"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c new file mode 100644 index 000000000..e92176e3b --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c @@ -0,0 +1,64 @@ +/* + * Driver for Moschip MCS814x internal PHY + * + * Copyright (c) 2012 Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_DESCRIPTION("Moschip MCS814x PHY driver"); +MODULE_AUTHOR("Florian Fainelli "); +MODULE_LICENSE("GPL"); + +/* Nothing special about this PHY but its OUI (O) */ +static struct phy_driver mcs8140_driver = { + .phy_id = 0, + .name = "Moschip MCS8140", + .phy_id_mask = 0x02, + .features = PHY_BASIC_FEATURES, + .config_aneg = &genphy_config_aneg, + .read_status = &genphy_read_status, + .suspend = genphy_suspend, + .resume = genphy_resume, + .driver = { .owner = THIS_MODULE,}, +}; + +static int __init mcs814x_phy_init(void) +{ + return phy_driver_register(&mcs8140_driver); +} + +static void __exit mcs814x_phy_exit(void) +{ + phy_driver_unregister(&mcs8140_driver); +} + +module_init(mcs814x_phy_init); +module_exit(mcs814x_phy_exit); + +static struct mdio_device_id __maybe_unused mcs814x_phy_tbl[] = { + { 0x0, 0x0ffffff0 }, + { } +}; + +MODULE_DEVICE_TABLE(mdio, mcs814x_phy_tbl); diff --git a/target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c new file mode 100644 index 000000000..23928f2c4 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c @@ -0,0 +1,163 @@ +/* + * MCS814X EHCI Host Controller Driver + * + * Based on "ehci-fsl.c" by Randy Vinson + * + * 2007 (c) MontaVista Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + */ + +#include +#include + +#define MCS814X_EHCI_CAPS_OFFSET 0x68 + +static int mcs814x_ehci_init(struct usb_hcd *hcd) +{ + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + int retval = 0; + + ehci->caps = hcd->regs + MCS814X_EHCI_CAPS_OFFSET; + ehci->regs = hcd->regs + + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); + ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); + ehci_reset(ehci); + + retval = ehci_init(hcd); + if (retval) { + pr_err("ehci_init failed\n"); + return retval; + } + + return retval; +} + +static const struct hc_driver mcs814x_ehci_hc_driver = { + .description = hcd_name, + .product_desc = "MCS814X EHCI Host Controller", + .hcd_priv_size = sizeof(struct ehci_hcd), + .irq = ehci_irq, + .flags = HCD_MEMORY | HCD_USB2, + .reset = mcs814x_ehci_init, + .start = ehci_run, + .stop = ehci_stop, + .shutdown = ehci_shutdown, + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + .get_frame_number = ehci_get_frame, + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, +#if defined(CONFIG_PM) + .bus_suspend = ehci_bus_suspend, + .bus_resume = ehci_bus_resume, +#endif + .relinquish_port = ehci_relinquish_port, + .port_handed_over = ehci_port_handed_over, + + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, +}; + +static int mcs814x_ehci_probe(struct platform_device *pdev) +{ + struct usb_hcd *hcd; + const struct hc_driver *driver = &mcs814x_ehci_hc_driver; + struct resource *res; + int irq; + int retval; + + if (usb_disabled()) + return -ENODEV; + + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) { + dev_err(&pdev->dev, + "Found HC with no IRQ. Check %s setup!\n", + dev_name(&pdev->dev)); + return -ENODEV; + } + irq = res->start; + + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; + + hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); + if (!hcd) { + retval = -ENOMEM; + goto fail_create_hcd; + } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, + "Found HC with no register addr. Check %s setup!\n", + dev_name(&pdev->dev)); + retval = -ENODEV; + goto fail_request_resource; + } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, + driver->description)) { + dev_dbg(&pdev->dev, "controller already in use\n"); + retval = -EBUSY; + goto fail_request_resource; + } + + hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); + if (hcd->regs == NULL) { + dev_dbg(&pdev->dev, "error mapping memory\n"); + retval = -EFAULT; + goto fail_ioremap; + } + + retval = usb_add_hcd(hcd, irq, IRQF_SHARED); + if (retval) + goto fail_add_hcd; + + dev_info(&pdev->dev, "added MCS814X EHCI driver\n"); + + return retval; + +fail_add_hcd: + iounmap(hcd->regs); +fail_ioremap: + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); +fail_request_resource: + usb_put_hcd(hcd); +fail_create_hcd: + dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval); + return retval; +} + +static int mcs814x_ehci_remove(struct platform_device *pdev) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + + usb_remove_hcd(hcd); + iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + usb_put_hcd(hcd); + + return 0; +} + +MODULE_ALIAS("platform:mcs814x-ehci"); + +static const struct of_device_id mcs814x_ehci_id[] = { + { .compatible = "moschip,mcs814x-ehci" }, + { .compatible = "usb-ehci" }, + { /* sentinel */ }, +}; + +static struct platform_driver mcs814x_ehci_driver = { + .probe = mcs814x_ehci_probe, + .remove = mcs814x_ehci_remove, + .driver = { + .name = "mcs814x-ehci", + .of_match_table = mcs814x_ehci_id, + }, +}; diff --git a/target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c new file mode 100644 index 000000000..161176b0e --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c @@ -0,0 +1,202 @@ +/* + * OHCI HCD (Host Controller Driver) for USB. + * + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000-2002 David Brownell + * (C) Copyright 2002 Hewlett-Packard Company + * + * Bus Glue for Moschip MCS814x. + * + * Written by Christopher Hoover + * Based on fragments of previous driver by Russell King et al. + * + * Modified for LH7A404 from ohci-sa1111.c + * by Durgesh Pattamatta + * + * Modified for pxa27x from ohci-lh7a404.c + * by Nick Bane 26-8-2004 + * + * Modified for mcs814x from ohci-mcs814x.c + * by Lennert Buytenhek 28-2-2006 + * Based on an earlier driver by Ray Lehtiniemi + * + * This file is licenced under the GPL. + */ + +#include +#include +#include +#include + +static int usb_hcd_mcs814x_probe(const struct hc_driver *driver, + struct platform_device *pdev) +{ + int retval; + struct usb_hcd *hcd; + + if (pdev->resource[1].flags != IORESOURCE_IRQ) { + pr_debug("resource[1] is not IORESOURCE_IRQ"); + return -ENOMEM; + } + + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; + + hcd = usb_create_hcd(driver, &pdev->dev, "mcs814x"); + if (hcd == NULL) + return -ENOMEM; + + hcd->rsrc_start = pdev->resource[0].start; + hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { + usb_put_hcd(hcd); + retval = -EBUSY; + goto err1; + } + + hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); + if (hcd->regs == NULL) { + pr_debug("ioremap failed"); + retval = -ENOMEM; + goto err2; + } + + ohci_hcd_init(hcd_to_ohci(hcd)); + + retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); + if (retval == 0) + return retval; + + iounmap(hcd->regs); +err2: + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); +err1: + usb_put_hcd(hcd); + + return retval; +} + +static void usb_hcd_mcs814x_remove(struct usb_hcd *hcd, + struct platform_device *pdev) +{ + usb_remove_hcd(hcd); + iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + usb_put_hcd(hcd); +} + +static int ohci_mcs814x_start(struct usb_hcd *hcd) +{ + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + int ret; + + ret = ohci_init(ohci); + if (ret < 0) + return ret; + + ret = ohci_run(ohci); + if (ret < 0) { + ohci_err(ohci, "can't start %s", hcd->self.bus_name); + ohci_stop(hcd); + return ret; + } + + return 0; +} + +static struct hc_driver ohci_mcs814x_hc_driver = { + .description = hcd_name, + .product_desc = "MCS814X OHCI", + .hcd_priv_size = sizeof(struct ohci_hcd), + .irq = ohci_irq, + .flags = HCD_USB11 | HCD_MEMORY, + .start = ohci_mcs814x_start, + .stop = ohci_stop, + .shutdown = ohci_shutdown, + .urb_enqueue = ohci_urb_enqueue, + .urb_dequeue = ohci_urb_dequeue, + .endpoint_disable = ohci_endpoint_disable, + .get_frame_number = ohci_get_frame, + .hub_status_data = ohci_hub_status_data, + .hub_control = ohci_hub_control, +#ifdef CONFIG_PM + .bus_suspend = ohci_bus_suspend, + .bus_resume = ohci_bus_resume, +#endif + .start_port_reset = ohci_start_port_reset, +}; + +extern int usb_disabled(void); + +static int ohci_hcd_mcs814x_drv_probe(struct platform_device *pdev) +{ + int ret; + + ret = -ENODEV; + if (!usb_disabled()) + ret = usb_hcd_mcs814x_probe(&ohci_mcs814x_hc_driver, pdev); + + return ret; +} + +static int ohci_hcd_mcs814x_drv_remove(struct platform_device *pdev) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + + usb_hcd_mcs814x_remove(hcd, pdev); + + return 0; +} + +#ifdef CONFIG_PM +static int ohci_hcd_mcs814x_drv_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + + if (time_before(jiffies, ohci->next_statechange)) + msleep(5); + ohci->next_statechange = jiffies; + + hcd->state = HC_STATE_SUSPENDED; + + return 0; +} + +static int ohci_hcd_mcs814x_drv_resume(struct platform_device *pdev) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + int status; + + if (time_before(jiffies, ohci->next_statechange)) + msleep(5); + ohci->next_statechange = jiffies; + + ohci_finish_controller_resume(hcd); + return 0; +} +#endif + +static const struct of_device_id mcs814x_ohci_id[] = { + { .compatible = "moschip,mcs814x-ohci" }, + { .compatible = "ohci-le" }, + { /* sentinel */ }, +}; + +static struct platform_driver ohci_hcd_mcs814x_driver = { + .probe = ohci_hcd_mcs814x_drv_probe, + .remove = ohci_hcd_mcs814x_drv_remove, + .shutdown = usb_hcd_platform_shutdown, +#ifdef CONFIG_PM + .suspend = ohci_hcd_mcs814x_drv_suspend, + .resume = ohci_hcd_mcs814x_drv_resume, +#endif + .driver = { + .name = "mcs814x-ohci", + .owner = THIS_MODULE, + .of_match_table = mcs814x_ohci_id, + }, +}; + +MODULE_ALIAS("platform:mcs814x-ohci"); diff --git a/target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c b/target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c new file mode 100644 index 000000000..7bcded505 --- /dev/null +++ b/target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c @@ -0,0 +1,207 @@ +/* + * Moschip MCS814x Watchdog driver + * + * Copyright (C) 2012, Florian Fainelli + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define WDT_COUNT 0x00 +#define WDT_CTRL 0x04 +#define WDT_CTRL_EN 0x1 + +/* watchdog frequency */ +#define WDT_MAX_VALUE (0xffffffff) + +struct mcs814x_wdt { + void __iomem *regs; + spinlock_t lock; + struct watchdog_device wdt_dev; + struct clk *clk; +}; + +static int mcs814x_wdt_start(struct watchdog_device *dev) +{ + struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev); + u32 reg; + + spin_lock(&wdt->lock); + reg = readl_relaxed(wdt->regs + WDT_CTRL); + reg |= WDT_CTRL_EN; + writel_relaxed(reg, wdt->regs + WDT_CTRL); + spin_unlock(&wdt->lock); + + return 0; +} + +static int mcs814x_wdt_stop(struct watchdog_device *dev) +{ + struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev); + u32 reg; + + spin_lock(&wdt->lock); + reg = readl_relaxed(wdt->regs + WDT_CTRL); + reg &= ~WDT_CTRL_EN; + writel_relaxed(reg, wdt->regs + WDT_CTRL); + spin_unlock(&wdt->lock); + + return 0; +} + +static int mcs814x_wdt_set_timeout(struct watchdog_device *dev, + unsigned int new_timeout) +{ + struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev); + + spin_lock(&wdt->lock); + /* watchdog counts upward and rollover (0xfffffff -> 0) + * triggers the reboot + */ + writel_relaxed(WDT_MAX_VALUE - (new_timeout * clk_get_rate(wdt->clk)), + wdt->regs + WDT_COUNT); + spin_unlock(&wdt->lock); + + return 0; +} + +static int mcs814x_wdt_ping(struct watchdog_device *dev) +{ + /* restart the watchdog */ + mcs814x_wdt_stop(dev); + mcs814x_wdt_set_timeout(dev, dev->timeout); + mcs814x_wdt_start(dev); + + return 0; +} + +static const struct watchdog_info mcs814x_wdt_ident = { + .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .identity = "MCS814x Watchdog", +}; + +static struct watchdog_ops mcs814x_wdt_ops = { + .owner = THIS_MODULE, + .start = mcs814x_wdt_start, + .stop = mcs814x_wdt_stop, + .set_timeout = mcs814x_wdt_set_timeout, + .ping = mcs814x_wdt_ping, +}; + +static int mcs814x_wdt_probe(struct platform_device *pdev) +{ + struct resource *res; + struct mcs814x_wdt *wdt; + int ret; + struct clk *clk; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + clk = clk_get(NULL, "wdt"); + if (IS_ERR_OR_NULL(clk)) { + dev_err(&pdev->dev, "failed to get watchdog clock\n"); + return PTR_ERR(clk); + } + + wdt = kzalloc(sizeof(*wdt), GFP_KERNEL); + if (!wdt) { + ret = -ENOMEM; + goto out_clk; + } + + spin_lock_init(&wdt->lock); + wdt->clk = clk; + wdt->wdt_dev.info = &mcs814x_wdt_ident; + wdt->wdt_dev.ops = &mcs814x_wdt_ops; + wdt->wdt_dev.min_timeout = 1; + /* approximately 10995 secs */ + wdt->wdt_dev.max_timeout = (WDT_MAX_VALUE / clk_get_rate(clk)); + + platform_set_drvdata(pdev, wdt); + + /* only ioremap registers, because the register is shared */ + wdt->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!wdt->regs) { + ret = -ENOMEM; + goto out; + } + + watchdog_set_drvdata(&wdt->wdt_dev, wdt); + + ret = watchdog_register_device(&wdt->wdt_dev); + if (ret) { + dev_err(&pdev->dev, "cannot register watchdog: %d\n", ret); + goto out; + } + + dev_info(&pdev->dev, "registered\n"); + return 0; + +out: + platform_set_drvdata(pdev, NULL); + kfree(wdt); +out_clk: + clk_put(clk); + return ret; +} + +static int mcs814x_wdt_remove(struct platform_device *pdev) +{ + struct mcs814x_wdt *wdt = platform_get_drvdata(pdev); + + clk_put(wdt->clk); + watchdog_unregister_device(&wdt->wdt_dev); + watchdog_set_drvdata(&wdt->wdt_dev, NULL); + kfree(wdt); + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static const struct of_device_id mcs814x_wdt_ids[] = { + { .compatible = "moschip,mcs814x-wdt", }, + { /* sentinel */ }, +}; + +static struct platform_driver mcs814x_wdt_driver = { + .driver = { + .name = "mcs814x-wdt", + .owner = THIS_MODULE, + .of_match_table = mcs814x_wdt_ids, + }, + .probe = mcs814x_wdt_probe, + .remove = mcs814x_wdt_remove, +}; + +module_platform_driver(mcs814x_wdt_driver); + +MODULE_AUTHOR("Florian Fainelli "); +MODULE_DESCRIPTION("Moschip MCS814x Watchdog driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); +MODULE_ALIAS("platform:mcs814x-wdt"); diff --git a/target/linux/mcs814x/image/Makefile b/target/linux/mcs814x/image/Makefile new file mode 100644 index 000000000..ff905b308 --- /dev/null +++ b/target/linux/mcs814x/image/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +JFFS2_BLOCKSIZE = 128k + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +TARGET_DTBS := rbt-832 dlan-usb-extender + +DTBS_DIR:=dts/ + +LOADADDR:=0x00008000 + +UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage + +define Image/Build/MkuImage + mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \ + -n 'ARM $(VERSION_DIST) Linux-$(LINUX_VERSION)' -d $(1) $(2); +endef + +define Image/Build/DTB + cp $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1); + cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(DTBS_DIR)$(1).dtb >> $(KDIR)/zImage$(2)-$(1); + $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1)) + cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1); +endef + +define Image/Build/Profile/dLAN_USB_Extender + dd if=$(KDIR)/uImage-dlan-usb-extender bs=64k conv=sync of=$(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin + cat $(KDIR)/root.$(1) >> $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin + cp $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin $(BIN_DIR)/ +endef + +define Image/BuildKernel + $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb))) +endef + +define Image/Build/Initramfs + $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs)) +endef + +define Image/Build/squashfs + $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128 +endef + +define Image/Build + $(call Image/Build/$(1)) + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync + $(call Image/Build/Profile/$(PROFILE),$(1)) +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + $(call Image/Build/Initramfs) +endif +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/mcs814x/modules.mk b/target/linux/mcs814x/modules.mk new file mode 100644 index 000000000..c29ca860d --- /dev/null +++ b/target/linux/mcs814x/modules.mk @@ -0,0 +1,20 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +define KernelPackage/mcs814x-wdt + SUBMENU:=$(OTHER_MENU) + DEPENDS:=@TARGET_mcs814x + TITLE:=MCS814x watchdog driver + KCONFIG:=CONFIG_MCS814X_WATCHDOG + FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/mcs814x_wdt.ko + AUTOLOAD:=$(call AutoLoad,50,mcs814x_wdt) +endef + +define KernelPackage/mcs814x-wdt/description + Kernel module for the Moschip MCS814x watchdog timer. +endef + +$(eval $(call KernelPackage,mcs814x-wdt)) diff --git a/target/linux/mcs814x/patches-3.18/001-platform.patch b/target/linux/mcs814x/patches-3.18/001-platform.patch new file mode 100644 index 000000000..83f1683b0 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/001-platform.patch @@ -0,0 +1,64 @@ +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -267,7 +267,8 @@ config PHYS_OFFSET + ARCH_INTEGRATOR || \ + ARCH_IOP13XX || \ + ARCH_KS8695 || \ +- (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET) ++ (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET) || \ ++ ARCH_MCS814X + default 0x10000000 if ARCH_OMAP1 || ARCH_RPC + default 0x20000000 if ARCH_S5PV210 + default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET +@@ -786,6 +787,21 @@ config ARCH_OMAP1 + help + Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx) + ++config ARCH_MCS814X ++ bool "Moschip MCS814x" ++ select FIQ ++ select GENERIC_IRQ_CHIP ++ select GENERIC_GPIO ++ select ARCH_REQUIRE_GPIOLIB ++ select CLKDEV_LOOKUP ++ select ARCH_USES_GETTIMEOFFSET ++ select USB_ARCH_HAS_OHCI ++ select USB_ARCH_HAS_EHCI ++ select MULTI_IRQ_HANDLER ++ help ++ Support for Moschip MCS814x SoCs (MCS8140). ++ ++ + endchoice + + menu "Multiple platform selection" +@@ -927,6 +943,8 @@ source "arch/arm/mach-picoxcell/Kconfig" + source "arch/arm/mach-pxa/Kconfig" + source "arch/arm/plat-pxa/Kconfig" + ++source "arch/arm/mach-mcs814x/Kconfig" ++ + source "arch/arm/mach-mmp/Kconfig" + + source "arch/arm/mach-qcom/Kconfig" +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -180,6 +180,7 @@ machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx + machine-$(CONFIG_ARCH_KEYSTONE) += keystone + machine-$(CONFIG_ARCH_KS8695) += ks8695 + machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx ++machine-$(CONFIG_ARCH_MCS814X) += mcs814x + machine-$(CONFIG_ARCH_MESON) += meson + machine-$(CONFIG_ARCH_MMP) += mmp + machine-$(CONFIG_ARCH_MOXART) += moxart +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -163,6 +163,8 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood- + kirkwood-ts419-6282.dtb + dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb + dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb ++dtb-$(CONFIG_ARCH_MCS814X) += dlan-usb-extender.dtb \ ++ rbt-832.dtb + dtb-$(CONFIG_MACH_MESON6) += meson6-atv1200.dtb + dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb + dtb-$(CONFIG_ARCH_MXC) += \ diff --git a/target/linux/mcs814x/patches-3.18/003-ethernet.patch b/target/linux/mcs814x/patches-3.18/003-ethernet.patch new file mode 100644 index 000000000..3ee8cd6b3 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/003-ethernet.patch @@ -0,0 +1,16 @@ +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -186,4 +186,6 @@ source "drivers/net/ethernet/wiznet/Kcon + source "drivers/net/ethernet/xilinx/Kconfig" + source "drivers/net/ethernet/xircom/Kconfig" + ++source "drivers/net/ethernet/mcs8140/Kconfig" ++ + endif # ETHERNET +--- a/drivers/net/ethernet/Makefile ++++ b/drivers/net/ethernet/Makefile +@@ -84,3 +84,4 @@ obj-$(CONFIG_NET_VENDOR_VIA) += via/ + obj-$(CONFIG_NET_VENDOR_WIZNET) += wiznet/ + obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/ + obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/ ++obj-$(CONFIG_NUPORT_ETHERNET_DRIVER) += mcs8140/ diff --git a/target/linux/mcs814x/patches-3.18/004-usb.patch b/target/linux/mcs814x/patches-3.18/004-usb.patch new file mode 100644 index 000000000..410c53085 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/004-usb.patch @@ -0,0 +1,28 @@ +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -1298,6 +1298,11 @@ MODULE_LICENSE ("GPL"); + #define PLATFORM_DRIVER ehci_hcd_sead3_driver + #endif + ++#ifdef CONFIG_ARCH_MCS814X ++#include "ehci-mcs814x.c" ++#define PLATFORM_DRIVER mcs814x_ehci_driver ++#endif ++ + static int __init ehci_hcd_init(void) + { + int retval = 0; +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -1260,6 +1260,11 @@ MODULE_LICENSE ("GPL"); + #define PLATFORM_DRIVER ohci_hcd_tilegx_driver + #endif + ++#ifdef CONFIG_ARCH_MCS814X ++#include "ohci-mcs814x.c" ++#define PLATFORM_DRIVER ohci_hcd_mcs814x_driver ++#endif ++ + static int __init ohci_hcd_mod_init(void) + { + int retval = 0; diff --git a/target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch b/target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch new file mode 100644 index 000000000..4af3d8683 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch @@ -0,0 +1,31 @@ +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -229,6 +229,18 @@ config HW_RANDOM_TX4939 + + If unsure, say Y. + ++config HW_RANDOM_MCS814X ++ tristate "Moschip MCS814x Random Number Generator" ++ depends on HW_RANDOM && ARCH_MCS814X ++ ---help--- ++ This driver provides kernel-side support for the Random Number ++ Generator hardware found on Moschip MCS814x processors. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called mcs814x-rng. ++ ++ If unusure, say Y. ++ + config HW_RANDOM_MXC_RNGA + tristate "Freescale i.MX RNGA Random Number Generator" + depends on ARCH_HAS_RNGA +--- a/drivers/char/hw_random/Makefile ++++ b/drivers/char/hw_random/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += oma + obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o + obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o + obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o ++obj-$(CONFIG_HW_RANDOM_MCS814X) += mcs814x-rng.o + obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o + obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o + obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o diff --git a/target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch b/target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch new file mode 100644 index 000000000..72481f6b8 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch @@ -0,0 +1,25 @@ +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -505,6 +505,12 @@ config MESON_WATCHDOG + To compile this driver as a module, choose M here: the + module will be called meson_wdt. + ++config MCS814X_WATCHDOG ++ tristate "Moschip MCS814x watchdog" ++ depends on WATCHDOG_CORE && ARCH_MCS814X ++ help ++ Support for the Moschip MCS814x SoCs on-chip watchdog timer. ++ + # AVR32 Architecture + + config AT32AP700X_WDT +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -63,6 +63,7 @@ obj-$(CONFIG_QCOM_WDT) += qcom-wdt.o + obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o + obj-$(CONFIG_TEGRA_WATCHDOG) += tegra_wdt.o + obj-$(CONFIG_MESON_WATCHDOG) += meson_wdt.o ++obj-$(CONFIG_MCS814X_WATCHDOG) += mcs814x_wdt.o + + # AVR32 Architecture + obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch b/target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch new file mode 100644 index 000000000..f0944bffd --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch @@ -0,0 +1,25 @@ +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -820,6 +820,12 @@ config GPIO_MC33880 + SPI driver for Freescale MC33880 high-side/low-side switch. + This provides GPIO interface supporting inputs and outputs. + ++config GPIO_MCS814X ++ tristate "Moschip MCS814x GPIO support" ++ depends on ARCH_MCS814X ++ help ++ GPIO driver for Moschip MCS814x SoC gpio controllers. ++ + config GPIO_74X164 + tristate "74x164 serial-in/parallel-out 8-bits shift register" + depends on SPI_MASTER && OF +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -49,6 +49,7 @@ obj-$(CONFIG_GPIO_MAX732X) += gpio-max73 + obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o + obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o + obj-$(CONFIG_GPIO_MCP23S08) += gpio-mcp23s08.o ++obj-$(CONFIG_GPIO_MCS814X) += gpio-mcs814x.o + obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o + obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o + obj-$(CONFIG_GPIO_MOXART) += gpio-moxart.o diff --git a/target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch b/target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch new file mode 100644 index 000000000..20d5add20 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch @@ -0,0 +1,20 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -164,6 +164,10 @@ config RTL8306_PHY + tristate "Driver for Realtek RTL8306S switches" + select SWCONFIG + ++config MCS814X_PHY ++ tristate "Driver for the Moschip MCS814x internal PHY" ++ depends on ARCH_MCS814X ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -51,3 +51,4 @@ obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o + obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o + obj-$(CONFIG_AMD_XGBE_PHY) += amd-xgbe-phy.o + obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o ++obj-$(CONFIG_MCS814X_PHY) += mcs814x.o diff --git a/target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch new file mode 100644 index 000000000..6269e40a0 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch @@ -0,0 +1,14 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -40,9 +40,9 @@ + #include + + #define AMD_BOOTLOC_BUG +-#define FORCE_WORD_WRITE 0 ++#define FORCE_WORD_WRITE 1 + +-#define MAX_RETRIES 3 ++#define MAX_RETRIES 10 + + #define SST49LF004B 0x0060 + #define SST49LF040B 0x0050 diff --git a/target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch b/target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch new file mode 100644 index 000000000..9d4982b0f --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch @@ -0,0 +1,64 @@ +--- a/drivers/usb/host/ohci.h ++++ b/drivers/usb/host/ohci.h +@@ -122,7 +122,7 @@ struct td { + /* PSW is only for ISO. Only 1 PSW entry is used, but on + * big-endian PPC hardware that's the second entry. + */ +-#define MAXPSW 2 ++#define MAXPSW 8 + __hc16 hwPSW [MAXPSW]; + + /* rest are purely for the driver's use */ +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -441,6 +441,7 @@ static int ohci_init (struct ohci_hcd *o + { + int ret; + struct usb_hcd *hcd = ohci_to_hcd(ohci); ++ u32 hcca_area; + + /* Accept arbitrarily long scatter-gather lists */ + if (!(hcd->driver->flags & HCD_LOCAL_MEM)) +@@ -502,11 +503,13 @@ static int ohci_init (struct ohci_hcd *o + (unsigned long) ohci); + set_timer_slack(&ohci->io_watchdog, msecs_to_jiffies(20)); + +- ohci->hcca = dma_alloc_coherent (hcd->self.controller, +- sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL); ++ hcca_area = ohci_readl(ohci, &ohci->regs->hcca); ++ ohci->hcca = ioremap_nocache(hcca_area, sizeof *ohci->hcca); + if (!ohci->hcca) + return -ENOMEM; + ++ ohci->hcca_dma = hcca_area; ++ + if ((ret = ohci_mem_init (ohci)) < 0) + ohci_stop (hcd); + else { +@@ -524,6 +527,7 @@ static int ohci_init (struct ohci_hcd *o + */ + static int ohci_run (struct ohci_hcd *ohci) + { ++ int i = 0; + u32 mask, val; + int first = ohci->fminterval == 0; + struct usb_hcd *hcd = ohci_to_hcd(ohci); +@@ -574,6 +578,8 @@ static int ohci_run (struct ohci_hcd *oh + msleep(val); + + memset (ohci->hcca, 0, sizeof (struct ohci_hcca)); ++ for (i = 0; i < NUM_INTS; i++) ++ ohci->hcca->int_table[i] = 0; + + /* 2msec timelimit here means no irqs/preempt */ + spin_lock_irq (&ohci->lock); +@@ -985,9 +991,6 @@ static void ohci_stop (struct usb_hcd *h + remove_debug_files (ohci); + ohci_mem_cleanup (ohci); + if (ohci->hcca) { +- dma_free_coherent (hcd->self.controller, +- sizeof *ohci->hcca, +- ohci->hcca, ohci->hcca_dma); + ohci->hcca = NULL; + ohci->hcca_dma = 0; + } diff --git a/target/linux/mcs814x/patches-3.18/014-debuguart.patch b/target/linux/mcs814x/patches-3.18/014-debuguart.patch new file mode 100644 index 000000000..5f1b67f30 --- /dev/null +++ b/target/linux/mcs814x/patches-3.18/014-debuguart.patch @@ -0,0 +1,41 @@ +--- a/arch/arm/mach-mcs814x/include/mach/debug-macro.S ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +- +- .macro addruart, rp, rv, tmp +- ldr \rp, =MCS814X_PHYS_BASE +- ldr \rv, =MCS814X_VIRT_BASE +- orr \rp, \rp, #MCS814X_UART +- orr \rv, \rv, #MCS814X_UART +- .endm +- +-#define UART_SHIFT 2 +-#include +--- a/arch/arm/Kconfig.debug ++++ b/arch/arm/Kconfig.debug +@@ -1089,7 +1089,7 @@ config DEBUG_UART_8250 + (FOOTBRIDGE && !DEBUG_DC21285_PORT) || \ + ARCH_GEMINI || ARCH_IOP13XX || ARCH_IOP32X || \ + ARCH_IOP33X || ARCH_IXP4XX || \ +- ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC ++ ARCH_LPC32XX || ARCH_MCS814X || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC + + # Compatibility options for BCM63xx + config DEBUG_UART_BCM63XX +@@ -1124,6 +1124,7 @@ config DEBUG_UART_PHYS + default 0x3e000000 if DEBUG_BCM_KONA_UART + default 0x4000e400 if DEBUG_LL_UART_EFM32 + default 0x40090000 if ARCH_LPC32XX ++ default 0x400dc000 if ARCH_MCS814X + default 0x40100000 if DEBUG_PXA_UART1 + default 0x42000000 if ARCH_GEMINI + default 0x50000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ +@@ -1178,6 +1179,7 @@ config DEBUG_UART_VIRT + default 0xe0010fe0 if ARCH_RPC + default 0xe1000000 if DEBUG_MSM_UART + default 0xf0000be0 if ARCH_EBSA110 ++ default 0xf00dc000 if ARCH_MCS814X + default 0xf01fb000 if DEBUG_NOMADIK_UART + default 0xf0201000 if DEBUG_BCM2835 + default 0xf1000300 if DEBUG_BCM_5301X diff --git a/target/linux/mcs814x/profiles/000-Generic.mk b/target/linux/mcs814x/profiles/000-Generic.mk new file mode 100644 index 000000000..a6d0f30ec --- /dev/null +++ b/target/linux/mcs814x/profiles/000-Generic.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Generic + NAME:=Generic profile +endef + +define Profile/Generic/Description + Default profile for Moschip MCS814x targets +endef +$(eval $(call Profile,Generic)) + diff --git a/target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk b/target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk new file mode 100644 index 000000000..168bfa143 --- /dev/null +++ b/target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk @@ -0,0 +1,25 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/dLAN_USB_Extender + NAME:=Devolo dLAN USB Extender + PACKAGES:=kmod-usb-serial kmod-usb-serial-ftdi +endef + +define Profile/dLAN_USB_Extender/Description + Package set specifically tuned for the Devolo dLAN USB Extender device. + + Binary packages are required to enable the power line portion of the + device, these packages can be found in the following package feed: + + src-git dlan https://github.com/ffainelli/dlan-usb-extender-3rd-party.git + + Instructions are available here: + http://ffainelli.github.io/dlan-usb-extender-3rd-party/ +endef +$(eval $(call Profile,dLAN_USB_Extender)) + diff --git a/target/linux/mediatek/base-files/etc/board.d/02_network b/target/linux/mediatek/base-files/etc/board.d/02_network index 8015cf3cc..faa243424 100755 --- a/target/linux/mediatek/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/base-files/etc/board.d/02_network @@ -13,9 +13,21 @@ mediatek_setup_interfaces() ucidef_set_interface_lan "lan0 lan1 lan2 lan3" ucidef_set_interface_wan eth1 ;; - 'bananapi,bpi-r2') - ucidef_set_interface_lan "lan0 lan1 lan2 lan3" - ucidef_set_interface_wan wan + 'bananapi,bpi-r2'|\ + "unielec,u7623"*) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" + ;; + esac +} + +mediatek_setup_macs() +{ + local board="$1" + + case $board in + "unielec,u7623"*) + mac=$(cat /sys/class/net/wan/address) + ucidef_set_interface_macaddr "wan" $mac ;; esac } @@ -23,6 +35,7 @@ mediatek_setup_interfaces() board_config_update board=$(board_name) mediatek_setup_interfaces $board +mediatek_setup_macs $board board_config_flush exit 0 diff --git a/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac b/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac new file mode 100644 index 000000000..3d0400073 --- /dev/null +++ b/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac @@ -0,0 +1,47 @@ +#!/bin/sh +# Copyright (C) 2018 OpenWrt.org + +RECOVERY_PART=/dev/mmcblk0p1 + +preinit_set_mac_address() { + local mac + + . /lib/functions.sh + . /lib/functions/system.sh + + case $(board_name) in + "unielec,u7623"*) + if [ -b $RECOVERY_PART ]; then + insmod nls_cp437 + insmod nls_iso8859-1 + insmod fat + insmod vfat + mkdir -p /tmp/recovery + mount -o rw,noatime $RECOVERY_PART /tmp/recovery + + if [ -f "/tmp/recovery/mac_addr" ]; + then + mac=$(cat /tmp/recovery/mac_addr) + else + mac=$(cat /sys/class/net/eth0/address) + echo "$mac" > /tmp/recovery/mac_addr + fi + + sync + umount /tmp/recovery + rm -rf /tmp/recovery + fi + + ip link set dev wan address $mac 2> /dev/null + + mac=$(macaddr_add $mac 1) + + ip link set dev lan0 address $mac 2>/dev/null + ip link set dev lan1 address $mac 2>/dev/null + ip link set dev lan2 address $mac 2>/dev/null + ip link set dev lan3 address $mac 2>/dev/null + ;; + esac +} + +boot_hook_add preinit_main preinit_set_mac_address diff --git a/target/linux/mediatek/base-files/lib/preinit/79_move_config b/target/linux/mediatek/base-files/lib/preinit/79_move_config new file mode 100644 index 000000000..e8e62883d --- /dev/null +++ b/target/linux/mediatek/base-files/lib/preinit/79_move_config @@ -0,0 +1,19 @@ +#!/bin/sh +# Copyright (C) 2015 OpenWrt.org + +RECOVERY_PART=/dev/mmcblk0p1 + +move_config() { + if [ -b $RECOVERY_PART ]; then + insmod nls_cp437 + insmod nls_iso8859-1 + insmod fat + insmod vfat + mkdir -p /recovery + mount -o rw,noatime $RECOVERY_PART /recovery + [ -f /recovery/sysupgrade.tgz ] && mv -f /recovery/sysupgrade.tgz / + umount /recovery + fi +} + +boot_hook_add preinit_mount_root move_config diff --git a/target/linux/mediatek/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/base-files/lib/upgrade/platform.sh index 646ce0dc5..487a262dc 100755 --- a/target/linux/mediatek/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/base-files/lib/upgrade/platform.sh @@ -1,6 +1,28 @@ platform_do_upgrade() { - default_do_upgrade "$ARGV" -} + local board=$(board_name) + case "$board" in + "unielec,u7623"*) + #Keep the persisten random mac address (if it exists) + mkdir -p /tmp/recovery + mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery + [ -f "/tmp/recovery/mac_addr" ] && \ + mv -f /tmp/recovery/mac_addr /tmp/ + umount /tmp/recovery + + #1310720 is the offset in bytes from the start of eMMC and to + #the location of the kernel (2560 512 byte sectors) + get_image "$1" | dd of=/dev/mmcblk0 bs=1310720 seek=1 conv=fsync + + mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery + [ -f "/tmp/mac_addr" ] && mv -f /tmp/mac_addr /tmp/recovery + sync + umount /tmp/recovery + ;; + *) + default_do_upgrade "$ARGV" + ;; + esac +} PART_NAME=firmware @@ -11,7 +33,8 @@ platform_check_image() { [ "$#" -gt 1 ] && return 1 case "$board" in - bananapi,bpi-r2) + bananapi,bpi-r2|\ + "unielec,u7623"*) [ "$magic" != "27051956" ] && { echo "Invalid image type." return 1 @@ -26,4 +49,20 @@ platform_check_image() { esac return 0 -} +} + +platform_copy_config_emmc() { + mkdir -p /recovery + mount -o rw,noatime /dev/mmcblk0p1 /recovery + cp -af "$CONF_TAR" /recovery/ + sync + umount /recovery +} + +platform_copy_config() { + case "$(board_name)" in + "unielec,u7623"*) + platform_copy_config_emmc + ;; + esac +} diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile index 41ad6e051..d14c12ee7 100644 --- a/target/linux/mediatek/image/Makefile +++ b/target/linux/mediatek/image/Makefile @@ -16,6 +16,16 @@ ifeq ($(SUBTARGET),mt7622) KERNEL_LOADADDR = 0x41080000 endif +define Build/sysupgrade-emmc + rm -f $@.recovery + mkfs.fat -C $@.recovery 3070 + + ./gen_mt7623_emmc_img.sh $@ \ + $(IMAGE_KERNEL) \ + $@.recovery \ + $(IMAGE_ROOTFS) +endef + # default all platform image(fit) build define Device/Default PROFILES = Default $$(DEVICE_NAME) diff --git a/target/linux/mediatek/image/gen_mt7623_emmc_img.sh b/target/linux/mediatek/image/gen_mt7623_emmc_img.sh new file mode 100755 index 000000000..1cb0883fb --- /dev/null +++ b/target/linux/mediatek/image/gen_mt7623_emmc_img.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +OUTPUT_FILE=$1 +KERNEL_FILE=$2 +RECOVERY_FILE=$3 +ROOTFS_FILE=$4 + +BS=512 + +#These to offsets are relative to the absolute location of the kernel on the mmc +#(0xA00), so their position in the image is -2560 blocks +RECOVERY_OFFSET=67072 +ROOTFS_OFFSET=87552 + +dd bs="$BS" of="$OUTPUT_FILE" if="$KERNEL_FILE" +dd bs="$BS" of="$OUTPUT_FILE" if="$RECOVERY_FILE" seek="$RECOVERY_OFFSET" +dd bs="$BS" of="$OUTPUT_FILE" if="$ROOTFS_FILE" seek="$ROOTFS_OFFSET" +dd if=/dev/zero of="$OUTPUT_FILE" bs=128k count=1 oflag=append conv=notrunc diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index ddb4faa48..fa6774e78 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -1,3 +1,14 @@ +define Device/7623a-unielec-u7623-02-emmc-512m + DEVICE_TITLE := MTK7623a UniElec U7623-02 (eMMC/512MB RAM) + DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512M + DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc + SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m + IMAGES := sysupgrade-emmc.bin.gz + IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata +endef + +TARGET_DEVICES += 7623a-unielec-u7623-02-emmc-512m + define Device/7623n-bananapi-bpi-r2 DEVICE_TITLE := MTK7623n BananaPi R2 DEVICE_DTS := mt7623n-bananapi-bpi-r2 diff --git a/target/linux/mediatek/mt7622/config-4.14 b/target/linux/mediatek/mt7622/config-4.14 index fdfb68d08..86951e198 100644 --- a/target/linux/mediatek/mt7622/config-4.14 +++ b/target/linux/mediatek/mt7622/config-4.14 @@ -89,8 +89,6 @@ CONFIG_BT_HCIUART=y CONFIG_BT_HCIUART_SERDEV=y CONFIG_BT_HCIVHCI=y CONFIG_BUILD_BIN2C=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y CONFIG_CLOCK_THERMAL=y @@ -445,7 +443,6 @@ CONFIG_TREE_SRCU=y CONFIG_USB=y CONFIG_USB_COMMON=y # CONFIG_USB_EHCI_HCD is not set -# CONFIG_USB_MTU3 is not set CONFIG_USB_SUPPORT=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_MTK=y diff --git a/target/linux/mediatek/mt7623/config-4.14 b/target/linux/mediatek/mt7623/config-4.14 index 9f7098941..043774046 100644 --- a/target/linux/mediatek/mt7623/config-4.14 +++ b/target/linux/mediatek/mt7623/config-4.14 @@ -51,6 +51,7 @@ CONFIG_ARM_UNWIND=y CONFIG_ARM_VIRT_EXT=y CONFIG_ATAGS=y CONFIG_AUTO_ZRELADDR=y +CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_MQ_PCI=y CONFIG_BOUNCE=y # CONFIG_CACHE_L2X0 is not set @@ -114,6 +115,8 @@ CONFIG_CROSS_MEMORY_ATTACH=y CONFIG_CRYPTO_ACOMP2=y CONFIG_CRYPTO_AEAD=y CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_CTR=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DEV_MEDIATEK=y @@ -165,9 +168,16 @@ CONFIG_EARLY_PRINTK=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_ELF_CORE=y +CONFIG_EXT4_FS=y +# CONFIG_F2FS_CHECK_FS is not set +CONFIG_F2FS_FS=y +# CONFIG_F2FS_FS_SECURITY is not set +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_STAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FREEZER=y +CONFIG_FS_MBCACHE=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -269,6 +279,7 @@ CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y +CONFIG_JBD2=y CONFIG_KALLSYMS=y CONFIG_LEDS_MT6323=y CONFIG_LIBFDT=y @@ -472,7 +483,6 @@ CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_USB=y CONFIG_USB_COMMON=y # CONFIG_USB_EHCI_HCD is not set -# CONFIG_USB_MTU3 is not set CONFIG_USB_SUPPORT=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_MTK=y diff --git a/target/linux/mediatek/patches-4.14/0225-arm-dts-Add-missing-mt7623-pcie-nodes.patch b/target/linux/mediatek/patches-4.14/0225-arm-dts-Add-missing-mt7623-pcie-nodes.patch new file mode 100644 index 000000000..68dd23bdb --- /dev/null +++ b/target/linux/mediatek/patches-4.14/0225-arm-dts-Add-missing-mt7623-pcie-nodes.patch @@ -0,0 +1,123 @@ +From d31800ff6ed81f44488b590fe372e7b6572d2896 Mon Sep 17 00:00:00 2001 +From: Kristian Evensen +Date: Sun, 17 Jun 2018 14:18:45 +0200 +Subject: [PATCH] arm: dts: Add missing mt7623 pcie nodes + +--- + arch/arm/boot/dts/mt7623.dtsi | 105 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 105 insertions(+) + +--- a/arch/arm/boot/dts/mt7623.dtsi ++++ b/arch/arm/boot/dts/mt7623.dtsi +@@ -671,6 +671,111 @@ + #reset-cells = <1>; + }; + ++ pcie: pcie@1a140000 { ++ compatible = "mediatek,mt7623-pcie"; ++ device_type = "pci"; ++ reg = <0 0x1a140000 0 0x1000>, /* PCIe shared registers */ ++ <0 0x1a142000 0 0x1000>, /* Port0 registers */ ++ <0 0x1a143000 0 0x1000>, /* Port1 registers */ ++ <0 0x1a144000 0 0x1000>; /* Port2 registers */ ++ reg-names = "subsys", "port0", "port1", "port2"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ interrupt-map-mask = <0xf800 0 0 0>; ++ interrupt-map = <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>, ++ <0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>, ++ <0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; ++ clocks = <&topckgen CLK_TOP_ETHIF_SEL>, ++ <&hifsys CLK_HIFSYS_PCIE0>, ++ <&hifsys CLK_HIFSYS_PCIE1>, ++ <&hifsys CLK_HIFSYS_PCIE2>; ++ clock-names = "free_ck", "sys_ck0", "sys_ck1", "sys_ck2"; ++ resets = <&hifsys MT2701_HIFSYS_PCIE0_RST>, ++ <&hifsys MT2701_HIFSYS_PCIE1_RST>, ++ <&hifsys MT2701_HIFSYS_PCIE2_RST>; ++ reset-names = "pcie-rst0", "pcie-rst1", "pcie-rst2"; ++ phys = <&pcie0_port PHY_TYPE_PCIE>, ++ <&pcie1_port PHY_TYPE_PCIE>, ++ <&u3port1 PHY_TYPE_PCIE>; ++ phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2"; ++ power-domains = <&scpsys MT2701_POWER_DOMAIN_HIF>; ++ bus-range = <0x00 0xff>; ++ status = "disabled"; ++ ranges = <0x81000000 0 0x1a160000 0 0x1a160000 0 0x00010000 ++ 0x83000000 0 0x60000000 0 0x60000000 0 0x10000000>; ++ ++ pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ interrupt-map-mask = <0 0 0 0>; ++ interrupt-map = <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>; ++ ranges; ++ num-lanes = <1>; ++ status = "disabled"; ++ }; ++ pcie@1,0 { ++ reg = <0x0800 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ interrupt-map-mask = <0 0 0 0>; ++ interrupt-map = <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>; ++ ranges; ++ num-lanes = <1>; ++ status = "disabled"; ++ }; ++ ++ pcie@2,0 { ++ reg = <0x1000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ interrupt-map-mask = <0 0 0 0>; ++ interrupt-map = <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; ++ ranges; ++ num-lanes = <1>; ++ status = "disabled"; ++ }; ++ }; ++ ++ pcie0_phy: pcie-phy@1a149000 { ++ compatible = "mediatek,generic-tphy-v1"; ++ reg = <0 0x1a149000 0 0x0700>; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ status = "disabled"; ++ ++ pcie0_port: pcie-phy@1a149900 { ++ reg = <0 0x1a149900 0 0x0700>; ++ clocks = <&clk26m>; ++ clock-names = "ref"; ++ #phy-cells = <1>; ++ status = "okay"; ++ }; ++ }; ++ ++ pcie1_phy: pcie-phy@1a14a000 { ++ compatible = "mediatek,generic-tphy-v1"; ++ reg = <0 0x1a14a000 0 0x0700>; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ status = "disabled"; ++ ++ pcie1_port: pcie-phy@1a14a900 { ++ reg = <0 0x1a14a900 0 0x0700>; ++ clocks = <&clk26m>; ++ clock-names = "ref"; ++ #phy-cells = <1>; ++ status = "okay"; ++ }; ++ }; ++ ++ + usb1: usb@1a1c0000 { + compatible = "mediatek,mt7623-xhci", + "mediatek,mt8173-xhci"; diff --git a/target/linux/mediatek/patches-4.14/0226-phy-phy-mtk-tphy-Add-hifsys-support.patch b/target/linux/mediatek/patches-4.14/0226-phy-phy-mtk-tphy-Add-hifsys-support.patch new file mode 100644 index 000000000..b480e9b4c --- /dev/null +++ b/target/linux/mediatek/patches-4.14/0226-phy-phy-mtk-tphy-Add-hifsys-support.patch @@ -0,0 +1,66 @@ +From 28f9a5e2a3f5441ab5594669ed82da11e32277a9 Mon Sep 17 00:00:00 2001 +From: Kristian Evensen +Date: Mon, 30 Apr 2018 14:38:01 +0200 +Subject: [PATCH] phy: phy-mtk-tphy: Add hifsys-support + +--- + drivers/phy/mediatek/phy-mtk-tphy.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/phy/mediatek/phy-mtk-tphy.c ++++ b/drivers/phy/mediatek/phy-mtk-tphy.c +@@ -23,6 +23,8 @@ + #include + #include + #include ++#include ++#include + + /* version V1 sub-banks offset base address */ + /* banks shared by multiple phys */ +@@ -262,6 +264,9 @@ + #define RG_CDR_BIRLTD0_GEN3_MSK GENMASK(4, 0) + #define RG_CDR_BIRLTD0_GEN3_VAL(x) (0x1f & (x)) + ++#define HIF_SYSCFG1 0x14 ++#define HIF_SYSCFG1_PHY2_MASK (0x3 << 20) ++ + enum mtk_phy_version { + MTK_PHY_V1 = 1, + MTK_PHY_V2, +@@ -305,6 +310,7 @@ struct mtk_tphy { + struct clk *u3phya_ref; /* reference clock of usb3 anolog phy */ + const struct mtk_phy_pdata *pdata; + struct mtk_phy_instance **phys; ++ struct regmap *hif; + int nphys; + }; + +@@ -617,6 +623,10 @@ static void pcie_phy_instance_init(struc + if (tphy->pdata->version != MTK_PHY_V1) + return; + ++ if (tphy->hif) ++ regmap_update_bits(tphy->hif, HIF_SYSCFG1, ++ HIF_SYSCFG1_PHY2_MASK, 0); ++ + tmp = readl(u3_banks->phya + U3P_U3_PHYA_DA_REG0); + tmp &= ~(P3A_RG_XTAL_EXT_PE1H | P3A_RG_XTAL_EXT_PE2H); + tmp |= P3A_RG_XTAL_EXT_PE1H_VAL(0x2) | P3A_RG_XTAL_EXT_PE2H_VAL(0x2); +@@ -1042,6 +1052,16 @@ static int mtk_tphy_probe(struct platfor + tphy->u3phya_ref = NULL; + } + ++ if (of_find_property(np, "mediatek,phy-switch", NULL)) { ++ tphy->hif = syscon_regmap_lookup_by_phandle(np, ++ "mediatek,phy-switch"); ++ if (IS_ERR(tphy->hif)) { ++ dev_err(&pdev->dev, ++ "missing \"mediatek,phy-switch\" phandle\n"); ++ return PTR_ERR(tphy->hif); ++ } ++ } ++ + port = 0; + for_each_child_of_node(np, child_np) { + struct mtk_phy_instance *instance; diff --git a/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch b/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch new file mode 100644 index 000000000..996b309e8 --- /dev/null +++ b/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch @@ -0,0 +1,413 @@ +From 004eb24e939b5b31f828333f37fb5cb2a877d6f2 Mon Sep 17 00:00:00 2001 +From: Kristian Evensen +Date: Sun, 17 Jun 2018 14:41:47 +0200 +Subject: [PATCH] arm: dts: Add Unielec U7623 DTS + +--- + arch/arm/boot/dts/Makefile | 1 + + .../dts/mt7623a-unielec-u7623-02-emmc-512M.dts | 18 + + .../boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi | 366 +++++++++++++++++++++ + 3 files changed, 385 insertions(+) + create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512M.dts + create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1062,6 +1062,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt6589-aquaris5.dtb \ + mt6592-evb.dtb \ + mt7623a-rfb-emmc.dtb \ ++ mt7623a-unielec-u7623-02-emmc-512M.dtb \ + mt7623n-rfb-nand.dtb \ + mt7623n-bananapi-bpi-r2.dtb \ + mt8127-moose.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512M.dts +@@ -0,0 +1,18 @@ ++/* ++ * Copyright 2018 Kristian Evensen ++ * ++ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ */ ++ ++/dts-v1/; ++#include "mt7623a-unielec-u7623-02-emmc.dtsi" ++ ++/ { ++ model = "UniElec U7623-02 eMMC (512M RAM)"; ++ compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02-emmc", "mediatek,mt7623"; ++ ++ memory@80000000 { ++ device_type = "memory"; ++ reg = <0 0x80000000 0 0x20000000>; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi +@@ -0,0 +1,366 @@ ++/* ++ * Copyright 2018 Kristian Evensen ++ * ++ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ */ ++ ++#include ++#include "mt7623.dtsi" ++#include "mt6323.dtsi" ++ ++/ { ++ compatible = "unielec,u7623-02-emmc", "mediatek,mt7623"; ++ ++ aliases { ++ serial2 = &uart2; ++ }; ++ ++ chosen { ++ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs"; ++ stdout-path = "serial2:115200n8"; ++ }; ++ ++ cpus { ++ cpu@0 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ ++ cpu@1 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ ++ cpu@2 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ ++ cpu@3 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-1.8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_5v: regulator-5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&key_pins_a>; ++ ++ factory { ++ label = "factory"; ++ linux,code = ; ++ gpios = <&pio 256 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&led_pins_unielec>; ++ ++ led3 { ++ label = "u7623-01:green:led3"; ++ gpios = <&pio 14 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ ++ led4 { ++ label = "u7623-01:green:led4"; ++ gpios = <&pio 15 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ }; ++ ++ mt7530: switch@0 { ++ compatible = "mediatek,mt7530"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++}; ++ ++&crypto { ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ ++ gmac0: mac@0 { ++ compatible = "mediatek,eth-mac"; ++ reg = <0>; ++ phy-mode = "trgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++ }; ++ ++ mdio: mdio-bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ phy5: ethernet-phy@5 { ++ reg = <5>; ++ phy-mode = "rgmii-rxid"; ++ }; ++ }; ++}; ++ ++&mt7530 { ++ compatible = "mediatek,mt7530"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ pinctrl-names = "default"; ++ mediatek,mcm; ++ resets = <ðsys 2>; ++ reset-names = "mcm"; ++ core-supply = <&mt6323_vpa_reg>; ++ io-supply = <&mt6323_vemc3v3_reg>; ++ ++ dsa,mii-bus = <&mdio>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "lan0"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "wan"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ cpu_port0: port@6 { ++ reg = <6>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ phy-mode = "trgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; ++ ++&mmc0 { ++ pinctrl-names = "default", "state_uhs"; ++ pinctrl-0 = <&mmc0_pins_default>; ++ pinctrl-1 = <&mmc0_pins_uhs>; ++ status = "okay"; ++ bus-width = <8>; ++ max-frequency = <50000000>; ++ cap-mmc-highspeed; ++ vmmc-supply = <®_3p3v>; ++ vqmmc-supply = <®_1p8v>; ++ non-removable; ++}; ++ ++&pio { ++ key_pins_a: keys-alt { ++ pins-keys { ++ pinmux = , ++ ; ++ input-enable; ++ }; ++ }; ++ ++ led_pins_unielec: leds-unielec { ++ pins-leds { ++ pinmux = , ++ ; ++ }; ++ }; ++ ++ mmc0_pins_default: mmc0default { ++ pins_cmd_dat { ++ pinmux = , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ ; ++ input-enable; ++ bias-pull-up; ++ }; ++ ++ pins_clk { ++ pinmux = ; ++ bias-pull-down; ++ }; ++ ++ pins_rst { ++ pinmux = ; ++ bias-pull-up; ++ }; ++ }; ++ ++ mmc0_pins_uhs: mmc0 { ++ pins_cmd_dat { ++ pinmux = , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ ; ++ input-enable; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ pins_clk { ++ pinmux = ; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ ++ pins_rst { ++ pinmux = ; ++ bias-pull-up; ++ }; ++ }; ++ ++ pwm_pins_a: pwm@0 { ++ pins_pwm { ++ pinmux = , ++ , ++ , ++ , ++ ; ++ }; ++ }; ++ ++ uart2_pins_b: uart@2 { ++ pins_dat { ++ pinmux = , ++ ; ++ }; ++ }; ++ ++ pcie_default: pcie_pin_default { ++ pins_cmd_dat { ++ pinmux = , ++ ; ++ bias-disable; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins_a>; ++ status = "okay"; ++}; ++ ++&pwrap { ++ mt6323 { ++ mt6323led: led { ++ compatible = "mediatek,mt6323-led"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ led@0 { ++ reg = <0>; ++ label = "led0"; ++ default-state = "off"; ++ }; ++ }; ++ }; ++}; ++ ++&uart2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart2_pins_b>; ++ status = "okay"; ++}; ++ ++&usb1 { ++ vusb33-supply = <®_3p3v>; ++ vbus-supply = <®_3p3v>; ++ status = "okay"; ++}; ++ ++&u3phy1 { ++ status = "okay"; ++}; ++ ++&u3phy2 { ++ status = "okay"; ++ mediatek,phy-switch = <&hifsys>; ++}; ++ ++&pcie { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_default>; ++ status = "okay"; ++ ++ pcie@1,0 { ++ status = "okay"; ++ }; ++ ++ pcie@2,0 { ++ status = "okay"; ++ }; ++}; ++ ++&pcie1_phy { ++ status = "okay"; ++}; ++ diff --git a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate new file mode 100644 index 000000000..49dde052f --- /dev/null +++ b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate @@ -0,0 +1,63 @@ +#!/bin/sh + +# This must run before 10-wifi-detect + + +[ "${ACTION}" = "add" ] || return + + +. /lib/functions.sh + + +check_radio() +{ + local cfg="$1" to="$2" + + config_get path "$cfg" path + + [ "$path" = "$to" ] && PATH_EXISTS=true +} + +do_migrate_radio() +{ + local cfg="$1" from="$2" to="$3" + + config_get path "$cfg" path + + [ "$path" = "$from" ] || return + + uci set "wireless.${cfg}.path=${to}" + WIRELESS_CHANGED=true + + logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'" +} + +migrate_radio() +{ + local from="$1" to="$2" + + config_load wireless + + # Check if there is already a section with the target path: In this case, the system + # was already upgraded to a version without this migration script before; better bail out, + # as we can't be sure we don't break more than we fix. + PATH_EXISTS=false + config_foreach check_radio wifi-device "$to" + $PATH_EXISTS && return + + config_foreach do_migrate_radio wifi-device "$from" "$to" +} + + +WIRELESS_CHANGED=false + +case "$(board_name)" in +tplink,tl-wdr4900-v1) + migrate_radio 'ffe09000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0' 'ffe09000.pcie/pci9000:00/9000:00:00.0/9000:01:00.0' + migrate_radio 'ffe0a000.pcie/pci0001:02/0001:02:00.0/0001:03:00.0' 'ffe0a000.pcie/pcia000:02/a000:02:00.0/a000:03:00.0' + ;; +esac + +$WIRELESS_CHANGED && uci commit wireless + +exit 0 diff --git a/target/linux/mvebu/base-files/etc/board.d/02_network b/target/linux/mvebu/base-files/etc/board.d/02_network index 66d35dda7..2c1015492 100755 --- a/target/linux/mvebu/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/base-files/etc/board.d/02_network @@ -46,9 +46,18 @@ armada-xp-gp) globalscale,espressobin) ucidef_set_interfaces_lan_wan "lan0 lan1" "wan" ;; +marvell,armada-3720-db) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; marvell,armada8040-mcbin) ucidef_set_interfaces_lan_wan "eth0 eth1 eth3" "eth2" ;; +marvell,armada8040-db) + ucidef_set_interfaces_lan_wan "eth0 eth2 eth3" "eth1" + ;; +marvell,armada7040-db) + ucidef_set_interfaces_lan_wan "eth0 eth2" "eth1" + ;; *) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/mvebu/base-files/lib/mvebu.sh b/target/linux/mvebu/base-files/lib/mvebu.sh index 33ac83239..5a0d7b293 100755 --- a/target/linux/mvebu/base-files/lib/mvebu.sh +++ b/target/linux/mvebu/base-files/lib/mvebu.sh @@ -20,9 +20,18 @@ mvebu_board_detect() { *"Globalscale Marvell ESPRESSOBin Board") name="globalscale,espressobin" ;; + *"Marvell Armada 3720 Development Board DB-88F3720-DDR3") + name="marvell,armada-3720-db" + ;; *"Marvell 8040 MACHIATOBin") name="marvell,armada8040-mcbin" ;; + *"Marvell Armada 8040 DB board") + name="marvell,armada8040-db" + ;; + *"Marvell Armada 7040 DB board") + name="marvell,armada7040-db" + ;; *"Globalscale Mirabox") name="mirabox" ;; diff --git a/target/linux/mvebu/config-4.14 b/target/linux/mvebu/config-4.14 index aa6b0104b..296da5a10 100644 --- a/target/linux/mvebu/config-4.14 +++ b/target/linux/mvebu/config-4.14 @@ -265,6 +265,7 @@ CONFIG_HIGHMEM=y CONFIG_HOTPLUG_CPU=y CONFIG_HWBM=y CONFIG_HWMON=y +CONFIG_HW_RANDOM=y CONFIG_HZ_FIXED=0 CONFIG_HZ_PERIODIC=y CONFIG_I2C=y diff --git a/target/linux/mvebu/files-4.14/arch/arm/boot/dts/armada-385-linksys-venom.dts b/target/linux/mvebu/files-4.14/arch/arm/boot/dts/armada-385-linksys-venom.dts index 00a4ee9f3..2e0bed815 100644 --- a/target/linux/mvebu/files-4.14/arch/arm/boot/dts/armada-385-linksys-venom.dts +++ b/target/linux/mvebu/files-4.14/arch/arm/boot/dts/armada-385-linksys-venom.dts @@ -121,51 +121,51 @@ /* Spansion S34ML02G2 256MiB, OEM Layout */ partition@0 { label = "u-boot"; - reg = <0x0000000 0x200000>; /* 2MB */ + reg = <0x0000000 0x200000>; /* 2MB */ read-only; }; partition@200000 { label = "u_env"; - reg = <0x200000 0x20000>; /* 128KB */ + reg = <0x200000 0x20000>; /* 128KB */ }; partition@220000 { label = "s_env"; - reg = <0x220000 0x40000>; /* 256KB */ + reg = <0x220000 0x40000>; /* 256KB */ }; partition@180000 { label = "unused_area"; - reg = <0x260000 0x5c0000>; /* 5.75MB */ + reg = <0x260000 0x5c0000>; /* 5.75MB */ }; partition@7e0000 { label = "devinfo"; - reg = <0x7e0000 0x40000>; /* 256KB */ + reg = <0x7e0000 0x40000>; /* 256KB */ read-only; }; /* kernel1 overlaps with rootfs1 by design */ partition@900000 { label = "kernel1"; - reg = <0x900000 0x7b00000>; /* 123MB */ + reg = <0x900000 0x7b00000>; /* 123MB */ }; partition@c00000 { label = "rootfs1"; - reg = <0xc00000 0x7800000>; /* 120MB */ + reg = <0xc00000 0x7800000>; /* 120MB */ }; /* kernel2 overlaps with rootfs2 by design */ partition@8400000 { label = "kernel2"; - reg = <0x8400000 0x7b00000>; /* 123MB */ + reg = <0x8400000 0x7b00000>; /* 123MB */ }; partition@8700000 { label = "rootfs2"; - reg = <0x8700000 0x7800000>; /* 120MB */ + reg = <0x8700000 0x7800000>; /* 120MB */ }; /* last MB is for the BBT, not writable */ diff --git a/target/linux/mvebu/image/armada-3720-db.bootscript b/target/linux/mvebu/image/armada-3720-db.bootscript new file mode 100644 index 000000000..65e39a1af --- /dev/null +++ b/target/linux/mvebu/image/armada-3720-db.bootscript @@ -0,0 +1,10 @@ +setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait" + +if test -n "${console}"; then + setenv bootargs "${bootargs} ${console}" +fi + +load mmc 0:1 ${fdt_addr} armada-3720-db.dtb +load mmc 0:1 ${kernel_addr} Image + +booti ${kernel_addr} - ${fdt_addr} diff --git a/target/linux/mvebu/image/cortex-a53.mk b/target/linux/mvebu/image/cortex-a53.mk index 711d2c0be..89c336344 100644 --- a/target/linux/mvebu/image/cortex-a53.mk +++ b/target/linux/mvebu/image/cortex-a53.mk @@ -13,4 +13,17 @@ define Device/globalscale-espressobin endef TARGET_DEVICES += globalscale-espressobin +define Device/armada-3720-db + KERNEL_NAME := Image + KERNEL := kernel-bin + DEVICE_TITLE := Marvell Armada 3720 Development Board DB-88F3720-DDR3 + DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-usb2 kmod-usb3 kmod-usb-storage + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata + DEVICE_DTS := armada-3720-db + DTS_DIR := $(DTS_DIR)/marvell + SUPPORTED_DEVICES := marvell,armada-3720-db +endef +TARGET_DEVICES += armada-3720-db + endif diff --git a/target/linux/mvebu/image/cortex-a72.mk b/target/linux/mvebu/image/cortex-a72.mk index ac9cb50a8..ac5b80233 100644 --- a/target/linux/mvebu/image/cortex-a72.mk +++ b/target/linux/mvebu/image/cortex-a72.mk @@ -13,4 +13,30 @@ define Device/armada-macchiatobin endef TARGET_DEVICES += armada-macchiatobin +define Device/armada-8040-db + KERNEL_NAME := Image + KERNEL := kernel-bin + DEVICE_TITLE := Marvell Armada 8040 DB board + DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-mmc + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata + DEVICE_DTS := armada-8040-db + DTS_DIR := $(DTS_DIR)/marvell + SUPPORTED_DEVICES := marvell,armada8040-db +endef +TARGET_DEVICES += armada-8040-db + +define Device/armada-7040-db + KERNEL_NAME := Image + KERNEL := kernel-bin + DEVICE_TITLE := Marvell Armada 7040 DB board + DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-mmc + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata + DEVICE_DTS := armada-7040-db + DTS_DIR := $(DTS_DIR)/marvell + SUPPORTED_DEVICES := marvell,armada7040-db +endef +TARGET_DEVICES += armada-7040-db + endif diff --git a/target/linux/mvebu/patches-4.14/521-arm64-dts-armada-3720-espressobin-wire-up-spi-flash.patch b/target/linux/mvebu/patches-4.14/521-arm64-dts-armada-3720-espressobin-wire-up-spi-flash.patch new file mode 100644 index 000000000..fb80db7e8 --- /dev/null +++ b/target/linux/mvebu/patches-4.14/521-arm64-dts-armada-3720-espressobin-wire-up-spi-flash.patch @@ -0,0 +1,45 @@ +From bffed3d4abcd32ba6d492a9bd7ebe81dc92eaa9a Mon Sep 17 00:00:00 2001 +From: Ellie Reeves +Date: Sun, 25 Mar 2018 21:57:36 +0200 +Subject: [PATCH] arm64: dts: armada-3720-espressobin: wire up spi flash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is the storage the machine boots from by default. The partitioning +is taken from the U-Boot that is shipped with the board. There is some +more space on the flash that isn't used. + +Tested-by: Gregory CLEMENT +Signed-off-by: Ellie Reeves +Signed-off-by: Uwe Kleine-König +Signed-off-by: Gregory CLEMENT + +[drop partitions, not every U-Boot has same layout] +Signed-off-by: Tomasz Maciej Nowak +--- + .../dts/marvell/armada-3720-espressobin.dts | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +@@ -96,6 +96,19 @@ + status = "okay"; + }; + ++&spi0 { ++ status = "okay"; ++ ++ flash@0 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ reg = <0>; ++ compatible = "winbond,w25q32dw", "jedec,spi-flash"; ++ spi-max-frequency = <104000000>; ++ m25p,fast-read; ++ }; ++}; ++ + /* Exported on the micro USB connector J5 through an FTDI */ + &uart0 { + status = "okay"; diff --git a/target/linux/mvebu/patches-4.14/521-esporessobin-dt-enable-spi-nor-on-i2c.patch b/target/linux/mvebu/patches-4.14/521-esporessobin-dt-enable-spi-nor-on-i2c.patch deleted file mode 100644 index 3cabaa7a0..000000000 --- a/target/linux/mvebu/patches-4.14/521-esporessobin-dt-enable-spi-nor-on-i2c.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts -+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts -@@ -111,6 +111,26 @@ - status = "okay"; - }; - -+&spi0 { -+ status = "okay"; -+ -+ w25q32dw@0 { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ compatible = "jedec,spi-nor"; -+ reg = <0>; -+ spi-max-frequency = <104000000>; -+ m25,fast-read; -+ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi_quad_pins>; -+ }; -+}; -+ -+&i2c0 { -+ status = "okay"; -+}; -+ - &mdio { - switch0: switch0@1 { - compatible = "marvell,mv88e6085"; diff --git a/target/linux/octeon/Makefile b/target/linux/octeon/Makefile index bbf1296c2..6c0623cb9 100644 --- a/target/linux/octeon/Makefile +++ b/target/linux/octeon/Makefile @@ -10,7 +10,7 @@ ARCH:=mips64 BOARD:=octeon BOARDNAME:=Cavium Networks Octeon FEATURES:=squashfs ramdisk pci usb -CPU_TYPE:=octeon +CPU_TYPE:=octeonplus MAINTAINER:=John Crispin KERNEL_PATCHVER:=4.14 diff --git a/target/linux/omap/Makefile b/target/linux/omap/Makefile index 539aded43..3e5c921d6 100644 --- a/target/linux/omap/Makefile +++ b/target/linux/omap/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=omap BOARDNAME:=TI OMAP3/4/AM33xx -FEATURES:=usb usbgadget ext4 targz fpu audio display nand ubifs +FEATURES:=usb usbgadget ext4 targz fpu audio display nand squashfs CPU_TYPE:=cortex-a8 CPU_SUBTYPE:=vfpv3 @@ -26,4 +26,6 @@ endef include $(INCLUDE_DIR)/target.mk +DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs + $(eval $(call BuildTarget)) diff --git a/target/linux/omap/base-files/lib/preinit/79_move_config b/target/linux/omap/base-files/lib/preinit/79_move_config new file mode 100644 index 000000000..c11258868 --- /dev/null +++ b/target/linux/omap/base-files/lib/preinit/79_move_config @@ -0,0 +1,20 @@ +#!/bin/sh +# Copyright (C) 2012-2015 OpenWrt.org + +move_config() { + local partdev + + . /lib/upgrade/common.sh + + if export_bootdevice && export_partdevice partdev -1; then + if mount -t vfat -o rw,noatime "/dev/$partdev" /mnt; then + if [ -f /mnt/sysupgrade.tgz ]; then + mv -f /mnt/sysupgrade.tgz / + fi + umount /mnt + fi + fi +} + +boot_hook_add preinit_mount_root move_config + diff --git a/target/linux/omap/base-files/lib/upgrade/platform.sh b/target/linux/omap/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..88ef4790e --- /dev/null +++ b/target/linux/omap/base-files/lib/upgrade/platform.sh @@ -0,0 +1,89 @@ +platform_check_image() { + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev -2 || { + echo "Unable to determine upgrade device" + return 1 + } + + get_partitions "/dev/$diskdev" bootdisk + + #extract the boot sector from the image + get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + + rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image + + if [ -n "$diff" ]; then + echo "Partition layout has changed. Full image will be written." + ask_bool 0 "Abort" && exit 1 + return 0 + fi +} + +platform_copy_config() { + local partdev + + if export_partdevice partdev -1; then + mount -t vfat -o rw,noatime "/dev/$partdev" /mnt + cp -af "$CONF_TAR" /mnt/ + umount /mnt + fi +} + +platform_do_upgrade() { + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev -2 || { + echo "Unable to determine upgrade device" + return 1 + } + + sync + + if [ "$SAVE_PARTITIONS" = "1" ]; then + get_partitions "/dev/$diskdev" bootdisk + + #extract the boot sector from the image + get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + else + diff=1 + fi + + if [ -n "$diff" ]; then + get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync + + # Separate removal and addtion is necessary; otherwise, partition 1 + # will be missing if it overlaps with the old partition 2 + partx -d - "/dev/$diskdev" + partx -a - "/dev/$diskdev" + + return 0 + fi + + #write uboot image + get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 count=1016 conv=fsync + #iterate over each partition from the image and write it to the boot disk + while read part start size; do + part="$(($part - 2))" + if export_partdevice partdev $part; then + echo "Writing image to /dev/$partdev..." + get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync + else + echo "Unable to find partition $part device, skipped." + fi + done < /tmp/partmap.image + + #copy partition uuid + echo "Writing new UUID to /dev/$diskdev..." + get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync +} diff --git a/target/linux/omap/config-4.14 b/target/linux/omap/config-4.14 index d5f817156..a94e127a4 100644 --- a/target/linux/omap/config-4.14 +++ b/target/linux/omap/config-4.14 @@ -232,6 +232,11 @@ CONFIG_EXTCON=y CONFIG_EXTCON_PALMAS=y CONFIG_EXTCON_USB_GPIO=y CONFIG_FANOTIFY=y +# CONFIG_F2FS_CHECK_FS is not set +CONFIG_F2FS_FS=y +# CONFIG_F2FS_FS_SECURITY is not set +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_STAT_FS=y CONFIG_FAT_FS=y CONFIG_FB_CMDLINE=y CONFIG_FHANDLE=y @@ -729,6 +734,8 @@ CONFIG_WATCHDOG_CORE=y CONFIG_XFRM_ALGO=y CONFIG_XFRM_MIGRATE=y CONFIG_XPS=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_BCJ=y CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ZBOOT_ROM_TEXT=0x0 CONFIG_ZLIB_DEFLATE=y diff --git a/target/linux/omap/config-4.9 b/target/linux/omap/config-4.9 index d6f064909..9cd408430 100644 --- a/target/linux/omap/config-4.9 +++ b/target/linux/omap/config-4.9 @@ -229,6 +229,11 @@ CONFIG_EXTCON=y CONFIG_EXTCON_PALMAS=y CONFIG_EXTCON_USB_GPIO=y CONFIG_FANOTIFY=y +# CONFIG_F2FS_CHECK_FS is not set +CONFIG_F2FS_FS=y +# CONFIG_F2FS_FS_SECURITY is not set +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_STAT_FS=y CONFIG_FAT_FS=y CONFIG_FB_CMDLINE=y CONFIG_FHANDLE=y @@ -724,6 +729,8 @@ CONFIG_WATCHDOG_CORE=y CONFIG_XFRM_ALGO=y CONFIG_XFRM_MIGRATE=y CONFIG_XPS=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_BCJ=y CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ZBOOT_ROM_TEXT=0x0 CONFIG_ZLIB_DEFLATE=y diff --git a/target/linux/omap/image/Makefile b/target/linux/omap/image/Makefile index 2f1e5b5ac..c7271aba8 100644 --- a/target/linux/omap/image/Makefile +++ b/target/linux/omap/image/Makefile @@ -38,34 +38,34 @@ define Device/Default KERNEL := kernel-bin IMAGES := sdcard.img.gz IMAGE/sdcard.img.gz := omap-sdcard | append-metadata | gzip - SUPPORTED_DEVICES = $$(DEVICE_DTS) + SUPPORTED_DEVICES = $(subst _,$(comma),$(1)) endef #uboot-omap-am335x_evm uboot-omap-omap3_beagle uboot-omap-omap3_overo uboot-omap-omap4_panda -define Device/am335x-evm +define Device/ti_am335x-evm DEVICE_TITLE := TI AM335x EVM DEVICE_DTS := am335x-evm endef -TARGET_DEVICES += am335x-evm +TARGET_DEVICES += ti_am335x-evm -define Device/am335x-boneblack +define Device/ti_am335x-bone-black DEVICE_TITLE := TI AM335x BeagleBone Black DEVICE_DTS := am335x-boneblack endef -TARGET_DEVICES += am335x-boneblack +TARGET_DEVICES += ti_am335x-bone-black -define Device/omap4-panda +define Device/ti_omap4-panda DEVICE_TITLE := OMAP4 TI pandaboard DEVICE_DTS := omap4-panda DEVICE_PACKAGES := kmod-usb-net-smsc95xx endef -TARGET_DEVICES += omap4-panda +TARGET_DEVICES += ti_omap4-panda -define Device/omap3-beagle +define Device/ti_omap3-beagle DEVICE_TITLE := OMAP3 TI beagleboard DEVICE_DTS := omap3-beagle # beagleboard doesn't have a network interface, support most common usb net @@ -75,6 +75,6 @@ define Device/omap3-beagle kmod-usb-net-smsc95xx kmod-usb-net-dm9601-ether endef -TARGET_DEVICES += omap3-beagle +TARGET_DEVICES += ti_omap3-beagle $(eval $(call BuildImage)) diff --git a/target/linux/omap24xx/Makefile b/target/linux/omap24xx/Makefile new file mode 100644 index 000000000..5dd5938db --- /dev/null +++ b/target/linux/omap24xx/Makefile @@ -0,0 +1,26 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=omap24xx +BOARDNAME:=TI OMAP24xx +MAINTAINER:=Michael Buesch +FEATURES:=targz squashfs jffs2_nand usb usbgadget display gpio audio broken +CPU_TYPE:=arm1136j-s + +KERNEL_PATCHVER:=4.1 + +KERNELNAME:=zImage dtbs + +define Target/Description + TI OMAP-24xx +endef + +include $(INCLUDE_DIR)/target.mk + +$(eval $(call BuildTarget)) diff --git a/target/linux/omap24xx/base-files/etc/config/fstab b/target/linux/omap24xx/base-files/etc/config/fstab new file mode 100644 index 000000000..0910277b2 --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/config/fstab @@ -0,0 +1,13 @@ +config mount + option target /maemo/initfs + option device /dev/mtdblock3 + option fstype jffs2 + option options rw,noatime + option enabled 0 + +config mount + option target /maemo/rootfs + option device /dev/mtdblock4 + option fstype jffs2 + option options rw,noatime + option enabled 0 diff --git a/target/linux/omap24xx/base-files/etc/config/network b/target/linux/omap24xx/base-files/etc/config/network new file mode 100644 index 000000000..8207443f3 --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/config/network @@ -0,0 +1,15 @@ +config interface loopback + option ifname lo + option proto static + option netmask 255.0.0.0 + +config interface lan + option proto dhcp + option netmask 255.255.255.0 + +config interface usb + option ifname usb0 + option proto static + option ipaddr 192.168.168.168 + option netmask 255.255.255.0 + option ip6addr fe80::810:1 diff --git a/target/linux/omap24xx/base-files/etc/config/wireless b/target/linux/omap24xx/base-files/etc/config/wireless new file mode 100644 index 000000000..b640ce6c2 --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/config/wireless @@ -0,0 +1,20 @@ +config wifi-device radio0 + option type mac80211 + option phy phy0 + option channel auto + # TODO: CHANGE THE MAC-ADDRESS: + option macaddr 00:11:22:33:44:55 + option hwmode 11g +# option country DE + + # REMOVE THIS LINE TO ENABLE WIFI: + option disabled 1 + +config wifi-iface + option device radio0 + option powersave 1 + option network lan + option mode sta + option ssid OpenWrt +# option encryption psk2 +# option key "foobar" diff --git a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image new file mode 100644 index 000000000..26d367d3c --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image @@ -0,0 +1,17 @@ +#!/bin/sh + +n810_cal_bme_pmm_extract() { + [ -x /usr/bin/calvaria ] && { + /usr/bin/calvaria -p -n bme -i last /dev/mtdblock1 >/lib/firmware/n810-cal-bme-pmm.fw ||\ + echo "CAL-BME extract: Failed to extract blob" + } +} + +. /lib/functions.sh + +[ "$FIRMWARE" = "n810-cal-bme-pmm.fw" ] && { + [ "$(board_name)" != "nokia,n810" ] || { + [ -e /lib/firmware/n810-cal-bme-pmm.fw ] ||\ + n810_cal_bme_pmm_extract + } +} diff --git a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom new file mode 100644 index 000000000..c53574723 --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom @@ -0,0 +1,32 @@ +#!/bin/sh + +p54spi_eeprom_clean() { + rm -f /tmp/wlan-iq-align /tmp/wlan-tx-gen2 +} + +p54spi_eeprom_die() { + echo "$*" + p54spi_eeprom_clean + exit 1 +} + +p54spi_eeprom_extract() { + [ -x /usr/bin/calvaria -a -x /usr/bin/cal2p54 ] && { + /usr/bin/calvaria -p -n wlan-iq-align -i last /dev/mtdblock1 >/tmp/wlan-iq-align ||\ + p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-iq-align" + /usr/bin/calvaria -p -n wlan-tx-gen2 -i last /dev/mtdblock1 >/tmp/wlan-tx-gen2 ||\ + p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-tx-gen2" + /usr/bin/cal2p54 /tmp/wlan-tx-gen2 /tmp/wlan-iq-align >/lib/firmware/3826.eeprom ||\ + p54spi_eeprom_die "p54spi EEPROM: Failed to generate EEPROM" + p54spi_eeprom_clean + } +} + +. /lib/functions.sh + +[ "$FIRMWARE" = "3826.eeprom" ] && { + [ "$(board_name)" != "nokia,n810" ] || { + [ -e /lib/firmware/3826.eeprom ] ||\ + p54spi_eeprom_extract + } +} diff --git a/target/linux/omap24xx/base-files/etc/init.d/watchdog b/target/linux/omap24xx/base-files/etc/init.d/watchdog new file mode 100755 index 000000000..0d042c64e --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/init.d/watchdog @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2010 OpenWrt.org + +START=25 + +start() { + [ -c /dev/watchdog -a -x /sbin/watchdog ] || { + echo "WARNING: Watchdog not available. System will reboot soon!" + return 1 + } + /sbin/watchdog -T 63 -t 50 /dev/watchdog + [ -x /usr/bin/schedtool ] && /usr/bin/schedtool -R -p 60 -n -20 $(pidof watchdog) +} + +stop() { + killall -q watchdog +} diff --git a/target/linux/omap24xx/base-files/etc/inittab b/target/linux/omap24xx/base-files/etc/inittab new file mode 100644 index 000000000..192115826 --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/inittab @@ -0,0 +1,5 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +tts/0::askfirst:/usr/libexec/login.sh +ttyO2::askfirst:/usr/libexec/login.sh +tty1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/omap24xx/base-files/etc/pointercal b/target/linux/omap24xx/base-files/etc/pointercal new file mode 100644 index 000000000..eba5ab6aa --- /dev/null +++ b/target/linux/omap24xx/base-files/etc/pointercal @@ -0,0 +1 @@ +14706 -12 -3754952 36 -9898 35656000 65536 diff --git a/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin b/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin new file mode 100644 index 0000000000000000000000000000000000000000..b7335db148c1a8dab37c44205f2feb22236764e5 GIT binary patch literal 2034 zcmZWqZERCz6n@^@?=r@^-FtW2BCM^qWi-T1%06HQbO|wN{NY#}p+qoZVl){>qDF`m zQsIaESWF7)kBLTtq6Uys{77`s{va`$nCM^FT1a&f@!KJRnR zbIy6sX_GgI69RY~#{joa8paBNdiZ+@O#obb00B3xLe2+01a}jx5n#h#qJ?0ALl-jg zCg|5rpw&>UP_=d>@Cu1}iNy55$6`w8;!MQs>Il7f zw<5h21n1J$Ks_O3xAXQX?fkf1azAP@UsOaSRXEoos^#o#nf?@_P_ubacV(<(cEH^{ zSG88{#%tvEWpdjOKf8So-A-k3S^vq7%IriX{D$dO<7HtaA~5Q-|IgV+d0!3xLwmWT z7;W~RShwtm%X4=kE=uzem#^3nSFMdpFhP#LA;&uqV8<6QOpYb|_<<}t+CS8Ot|04$ zFMKoYj=&sLVY=vR2P7G7x0Zi&V8Uu%8)=d}s`O%M5u#gYz&0^?Oax$fgSKV^fs31-VfM zN*u=`=gS#b%?!Fw3yk|1SjWI3#tH_y=7Hy^D!ZsEU0BILH&)Sc8cx7QY{u_c%Bx55 zC+OdX-aQ6`MvT3B0wxl?dJ_L)HLpfcM}}9=@Y6o`Jk@hSSO>cqVE@TRAjZJ29OJOS zgCuMX2~!bg;8RyKS*%zddb+8NfF9JXUiw2BroHW>fs$a#X@^2r;w}Z$NWldP4PEC_ L(oot&=lJtKcoXFJ literal 0 HcmV?d00001 diff --git a/target/linux/omap24xx/config-4.1 b/target/linux/omap24xx/config-4.1 new file mode 100644 index 000000000..9daded60c --- /dev/null +++ b/target/linux/omap24xx/config-4.1 @@ -0,0 +1,290 @@ +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_APM_EMULATION is not set +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAS_BANDGAP=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +CONFIG_ARCH_MULTI_V6=y +CONFIG_ARCH_MULTI_V6_V7=y +CONFIG_ARCH_NR_GPIO=0 +CONFIG_ARCH_OMAP=y +CONFIG_ARCH_OMAP2=y +CONFIG_ARCH_OMAP2PLUS=y +CONFIG_ARCH_OMAP2PLUS_TYPICAL=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ARCH_WM8750 is not set +CONFIG_ARM=y +CONFIG_ARM_APPENDED_DTB=y +CONFIG_ARM_ATAG_DTB_COMPAT=y +CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND=y +# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set +# CONFIG_ARM_CPU_SUSPEND is not set +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_L1_CACHE_SHIFT=5 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_ARM_THUMB=y +CONFIG_ATAGS=y +CONFIG_AUTO_ZRELADDR=y +CONFIG_BINFMT_MISC=y +CONFIG_BOUNCE=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLKSRC_OF=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="root=/dev/mmcblk0p1 rootwait rootfstype=ext4,ext3,ext2,squashfs,jffs2 console=tty0 console=ttyO2,115200n8 earlyprintk" +CONFIG_CMDLINE_FORCE=y +CONFIG_COMMON_CLK=y +CONFIG_CPU_32v6=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_ABRT_EV6=y +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_CPU_CACHE_V6=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_HAS_ASID=y +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_PABRT_V6=y +CONFIG_CPU_TLB_V6=y +CONFIG_CPU_V6=y +CONFIG_CPU_V6K=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DISPLAY_ENCODER_OPA362 is not set +CONFIG_DTC=y +CONFIG_EXTCON=y +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +CONFIG_FB=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_OMAP2=y +CONFIG_FB_OMAP2_DEBUG_SUPPORT=y +CONFIG_FB_OMAP2_NUM_FBS=3 +CONFIG_FRAME_POINTER=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_OMAP=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +# CONFIG_HAVE_ARCH_BITREVERSE is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_UID16=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HDMI=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_HZ_FIXED=0 +CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_OMAP=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_INPUT_RETU_PWRBUTTON=y +CONFIG_IOMMU_HELPER=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_LIBFDT=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACH_NOKIA_N810=y +CONFIG_MACH_NOKIA_N810_WIMAX=y +CONFIG_MACH_NOKIA_N8X0=y +CONFIG_MACH_OMAP2_TUSB6010=y +CONFIG_MACH_OMAP_GENERIC=y +CONFIG_MEMORY=y +CONFIG_MENELAUS=y +CONFIG_MFD_CORE=y +CONFIG_MFD_RETU=y +CONFIG_MFD_SYSCON=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MULTI_IRQ_HANDLER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NLS=y +CONFIG_NO_BOOTMEM=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OMAP2_DSS=y +CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS=y +CONFIG_OMAP2_DSS_DEBUG=y +CONFIG_OMAP2_DSS_DEBUGFS=y +# CONFIG_OMAP2_DSS_DPI is not set +# CONFIG_OMAP2_DSS_DSI is not set +CONFIG_OMAP2_DSS_INIT=y +CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=0 +CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y +# CONFIG_OMAP2_DSS_VENC is not set +CONFIG_OMAP2_VRFB=y +# CONFIG_OMAP4_DSS_HDMI is not set +# CONFIG_OMAP5_DSS_HDMI is not set +CONFIG_OMAP_32K_TIMER=y +# CONFIG_OMAP_CONTROL_PHY is not set +CONFIG_OMAP_DM_TIMER=y +CONFIG_OMAP_GPMC=y +# CONFIG_OMAP_INTERCONNECT is not set +CONFIG_OMAP_IRQCHIP=y +CONFIG_OMAP_MUX=y +# CONFIG_OMAP_MUX_DEBUG is not set +CONFIG_OMAP_MUX_WARNINGS=y +CONFIG_OMAP_PM_NOOP=y +# CONFIG_OMAP_RESET_CLOCKS is not set +# CONFIG_OMAP_WATCHDOG is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PCI is not set +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +# CONFIG_PHY_DM816X_USB is not set +CONFIG_PINCTRL=y +CONFIG_PM=y +CONFIG_PM_CLK=y +# CONFIG_PM_DEBUG is not set +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_IRQ=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_PBIAS is not set +CONFIG_RETU_WATCHDOG=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_SCHED_HRTICK=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250_OMAP is not set +# CONFIG_SERIAL_OMAP is not set +CONFIG_SOC_BUS=y +CONFIG_SOC_HAS_OMAP2_SDRC=y +CONFIG_SOC_OMAP2420=y +# CONFIG_SOC_OMAP2430 is not set +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +# CONFIG_SPI_OMAP24XX is not set +CONFIG_SRCU=y +CONFIG_SWIOTLB=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TAHVO_USB=y +# CONFIG_TAHVO_USB_HOST_BY_DEFAULT is not set +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_TI_EMIF is not set +CONFIG_TI_PRIV_EDMA=y +CONFIG_UID16=y +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_USB=y +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_MON=y +CONFIG_USB_OTG=y +CONFIG_USB_OTG_FSM=y +CONFIG_USB_PHY=y +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_VFP=y +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_WATCHDOG_CORE=y +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/omap24xx/image/Makefile b/target/linux/omap24xx/image/Makefile new file mode 100644 index 000000000..316cce0f9 --- /dev/null +++ b/target/linux/omap24xx/image/Makefile @@ -0,0 +1,27 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +NAND_BLOCKSIZE=2048-128k + +define Image/BuildKernel + cat $(KDIR)/zImage $(DTS_DIR)/omap2420-n810.dtb > $(BIN_DIR)/$(IMG_PREFIX)-zImage + chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-zImage +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)) +endef + +define Image/Build + $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) + $(call Image/Build/$(1),$(1)) +endef + + +$(eval $(call BuildImage)) diff --git a/target/linux/omap24xx/modules.mk b/target/linux/omap24xx/modules.mk new file mode 100644 index 000000000..6b7e85d79 --- /dev/null +++ b/target/linux/omap24xx/modules.mk @@ -0,0 +1,83 @@ +# +# Copyright (C) 2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define KernelPackage/sound-soc-omap + TITLE:=OMAP SoC sound support + KCONFIG:= \ + CONFIG_SND_OMAP_SOC + FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap.ko + AUTOLOAD:=$(call AutoLoad,60,snd-soc-omap) + DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-core + $(call AddDepends/sound) +endef + +$(eval $(call KernelPackage,sound-soc-omap)) + + +define KernelPackage/sound-soc-omap-mcbsp + TITLE:=OMAP SoC MCBSP support + KCONFIG:= \ + CONFIG_SND_OMAP_SOC_MCBSP + FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap-mcbsp.ko + AUTOLOAD:=$(call AutoLoad,61,snd-soc-omap-mcbsp) + DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap + $(call AddDepends/sound) +endef + +$(eval $(call KernelPackage,sound-soc-omap-mcbsp)) + + +define KernelPackage/sound-soc-n810 + TITLE:=Nokia n810 SoC sound support + KCONFIG:= \ + CONFIG_SND_OMAP_SOC_N810 + FILES:= \ + $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko \ + $(LINUX_DIR)/sound/soc/omap/snd-soc-n810.ko + AUTOLOAD:=$(call AutoLoad,65,snd-soc-tlv320aic3x snd-soc-n810) + DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap +kmod-sound-soc-omap-mcbsp + $(call AddDepends/sound) +endef + +$(eval $(call KernelPackage,sound-soc-n810)) + + +define KernelPackage/n810bm + SUBMENU:=$(OTHER_MENU) + TITLE:=Nokia N810 battery management driver + DEPENDS:=@TARGET_omap24xx + KCONFIG:=CONFIG_N810BM + FILES:=$(LINUX_DIR)/drivers/cbus/n810bm.ko + AUTOLOAD:=$(call AutoLoad,01,n810bm) +endef + +define KernelPackage/n810bm/description + Nokia N810 battery management driver. + Controls battery power management and battery charging. +endef + +$(eval $(call KernelPackage,n810bm)) + + +define KernelPackage/usb-tahvo + TITLE:=Support for Tahvo (Nokia n810) USB + KCONFIG:= \ + CONFIG_TAHVO_USB \ + CONFIG_TAHVO_USB_HOST_BY_DEFAULT=n \ + CONFIG_USB_OHCI_HCD_OMAP1=y \ + CONFIG_USB_GADGET_DEBUG_FS=n + DEPENDS:=@TARGET_omap24xx + FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-tahvo.ko + AUTOLOAD:=$(call AutoLoad,45,phy-tahvo) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-tahvo/description + Kernel support for Nokia n810 USB OHCI controller. +endef + +$(eval $(call KernelPackage,usb-tahvo)) diff --git a/target/linux/omap24xx/profiles/100-n810.mk b/target/linux/omap24xx/profiles/100-n810.mk new file mode 100644 index 000000000..bf2598c61 --- /dev/null +++ b/target/linux/omap24xx/profiles/100-n810.mk @@ -0,0 +1,31 @@ +# +# Copyright (C) 2010-2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/n810-base + NAME:=Nokia n810 (base) + PACKAGES:= \ + block-mount \ + gpsd \ + ip iw kmod-p54-spi wpa-supplicant \ + dnsmasq dropbear \ + pwrtray-backend \ + kmod-fs-vfat kmod-fs-msdos \ + kmod-input-evdev \ + kmod-leds-gpio \ + kmod-usb-tahvo kmod-usb-gadget-eth \ + kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-pegasus kmod-usb-net-rndis \ + kmod-usb-storage kmod-usb-hid \ + kmod-bluetooth kmod-bluetooth-hci-h4p bluez-utils bluez-hcidump \ + kmod-n810bm maemo-kexec calvaria \ + schedtool +endef + +define Profile/n810-base/Description + Minimal package set for Nokia n810 hardware. +endef +$(eval $(call Profile,n810-base)) + diff --git a/target/linux/omap24xx/profiles/110-n810-gui.mk b/target/linux/omap24xx/profiles/110-n810-gui.mk new file mode 100644 index 000000000..9c3c5d025 --- /dev/null +++ b/target/linux/omap24xx/profiles/110-n810-gui.mk @@ -0,0 +1,22 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/n810-gui + $(call Profile/n810-base) + NAME:=Nokia n810 (GUI) + PACKAGES+= \ + xserver-xorg xinit xauth xkeyboard-config xkbdata xterm \ + xf86-video-omapfb xf86-input-tslib xf86-input-evdev \ + openbox tint2 matchbox-keyboard \ + pwrtray +endef + +define Profile/n810-gui/Description + Graphical user interface package set for Nokia n810 hardware. +endef +$(eval $(call Profile,n810-gui)) + diff --git a/target/linux/oxnas/config-4.14 b/target/linux/oxnas/config-4.14 index 4d6943aea..1bf7d0c07 100644 --- a/target/linux/oxnas/config-4.14 +++ b/target/linux/oxnas/config-4.14 @@ -103,7 +103,6 @@ CONFIG_DECOMPRESS_XZ=y CONFIG_DEFAULT_CFQ=y # CONFIG_DEFAULT_DEADLINE is not set CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_DEVMEM=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_DMA_CMA=y diff --git a/target/linux/oxnas/files/arch/arm/boot/dts/ox820-mitrastar-stg212.dts b/target/linux/oxnas/files/arch/arm/boot/dts/ox820-mitrastar-stg212.dts index 834ea7765..d3a06fdab 100644 --- a/target/linux/oxnas/files/arch/arm/boot/dts/ox820-mitrastar-stg212.dts +++ b/target/linux/oxnas/files/arch/arm/boot/dts/ox820-mitrastar-stg212.dts @@ -64,7 +64,6 @@ gpios = <&gpio1 9 0 &gpio1 10 0>; i2c-gpio,delay-us = <10>; }; - }; &uart0 { diff --git a/target/linux/pistachio/base-files/lib/upgrade/platform.sh b/target/linux/pistachio/base-files/lib/upgrade/platform.sh index d7d2ba065..4de019a27 100755 --- a/target/linux/pistachio/base-files/lib/upgrade/platform.sh +++ b/target/linux/pistachio/base-files/lib/upgrade/platform.sh @@ -49,8 +49,3 @@ platform_nand_pre_upgrade() { ;; esac } - -blink_led() { - . /etc/diag.sh; set_state upgrade -} -append sysupgrade_pre_upgrade blink_led diff --git a/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch index eeb1e4dee..60474ceae 100644 --- a/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -2650,6 +2650,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -2651,6 +2651,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -2725,7 +2726,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -2726,7 +2727,12 @@ int spi_nor_scan(struct spi_nor *nor, co spi_nor_wait_till_ready(nor); } diff --git a/target/linux/ppc40x/Makefile b/target/linux/ppc40x/Makefile new file mode 100644 index 000000000..ebe09988a --- /dev/null +++ b/target/linux/ppc40x/Makefile @@ -0,0 +1,26 @@ +# +# Copyright (C) 2008-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=powerpc +BOARD:=ppc40x +BOARDNAME:=AMCC/IBM PPC40x +FEATURES:=squashfs small_flash broken +CPU_TYPE:=405 +MAINTAINER:=Imre Kaloz + +KERNEL_PATCHVER:=3.18 + +define Target/Description + Build firmware images for AMCC/IBM PPC40x based boards. +endef + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:=uImage cuImage.magicbox cuImage.openrb + +$(eval $(call BuildTarget)) diff --git a/target/linux/ppc40x/base-files/lib/preinit/01_sysinfo b/target/linux/ppc40x/base-files/lib/preinit/01_sysinfo new file mode 100644 index 000000000..9f82c84b2 --- /dev/null +++ b/target/linux/ppc40x/base-files/lib/preinit/01_sysinfo @@ -0,0 +1,12 @@ +#!/bin/sh + +do_sysinfo_ppc40x() { + local name="$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)" + [ -z "$name" ] && name="unknown" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + echo "$name" > /tmp/sysinfo/board_name + echo "unknown" > /tmp/sysinfo/model +} + +boot_hook_add preinit_main do_sysinfo_ppc40x diff --git a/target/linux/ppc40x/base-files/lib/upgrade/platform.sh b/target/linux/ppc40x/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..222a25a5c --- /dev/null +++ b/target/linux/ppc40x/base-files/lib/upgrade/platform.sh @@ -0,0 +1,35 @@ +# +# Copyright (C) 2010 OpenWrt.org +# + +PART_NAME=firmware + +platform_check_image() { + local board=$(board_name) + local magic="$(get_magic_word "$1")" + + [ "$#" -gt 1 ] && return 1 + + case "$board" in + kilauea | openrb | magicbox) + [ "$magic" != "2705" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + *) + default_do_upgrade "$ARGV" + ;; + esac +} diff --git a/target/linux/ppc40x/config-3.18 b/target/linux/ppc40x/config-3.18 new file mode 100644 index 000000000..fc53dde8c --- /dev/null +++ b/target/linux/ppc40x/config-3.18 @@ -0,0 +1,235 @@ +CONFIG_405EX=y +CONFIG_40x=y +# CONFIG_44x is not set +CONFIG_4xx=y +CONFIG_4xx_SOC=y +# CONFIG_ACADIA is not set +# CONFIG_ADVANCED_OPTIONS is not set +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAS_ILOG2_U32=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAS_WALK_MEMORY=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +# CONFIG_ARCH_RANDOM is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_AUDIT_ARCH=y +CONFIG_BOOKE_WDT=y +CONFIG_BOUNCE=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" +CONFIG_CMDLINE_BOOL=y +CONFIG_CONSISTENT_SIZE=0x00200000 +CONFIG_CPU_BIG_ENDIAN=y +# CONFIG_CPU_LITTLE_ENDIAN is not set +# CONFIG_CRYPTO_SHA1_PPC is not set +# CONFIG_DEFAULT_UIMAGE is not set +CONFIG_DTC=y +# CONFIG_E200 is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_EP405 is not set +# CONFIG_EPAPR_BOOT is not set +CONFIG_EXTRA_TARGETS="uImage" +# CONFIG_FSL_ULI1575 is not set +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CSUM is not set +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_NVRAM=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +# CONFIG_GENERIC_TBSYNC is not set +CONFIG_GENERIC_TIME_VSYSCALL_OLD=y +# CONFIG_GEN_RTC is not set +# CONFIG_GE_FPGA is not set +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_SYSFS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAS_RAPIDIO is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +# CONFIG_HOTFOOT is not set +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_HZ_PERIODIC=y +CONFIG_IBM_EMAC=y +CONFIG_IBM_EMAC_EMAC4=y +CONFIG_IBM_EMAC_POLL_WEIGHT=32 +CONFIG_IBM_EMAC_RGMII=y +CONFIG_IBM_EMAC_RXB=256 +CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256 +CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0 +CONFIG_IBM_EMAC_TXB=256 +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_IOMMU_HELPER is not set +# CONFIG_IPIC is not set +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_ISA_DMA_API=y +CONFIG_KERNEL_START=0xc0000000 +CONFIG_KILAUEA=y +CONFIG_LIBFDT=y +CONFIG_LOWMEM_SIZE=0x30000000 +CONFIG_MAGICBOX=y +# CONFIG_MAKALU is not set +# CONFIG_MATH_EMULATION is not set +# CONFIG_MMIO_NVRAM is not set +CONFIG_MODULES_USE_ELF_RELA=y +# CONFIG_MPIC is not set +# CONFIG_MPIC_U3_HT_IRQS is not set +# CONFIG_MPIC_WEIRD is not set +CONFIG_MTD_CFI_ADV_OPTIONS=y +# CONFIG_MTD_CFI_GEOMETRY is not set +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_NEED_DMA_MAP_STATE=y +# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NEED_SG_DMA_LENGTH=y +# CONFIG_NONSTATIC_KERNEL is not set +CONFIG_NOT_COHERENT_CACHE=y +CONFIG_NR_IRQS=512 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND=y +CONFIG_OPENRB=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xc0000000 +CONFIG_PCI=y +CONFIG_PCIEAER=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_MSI=y +CONFIG_PHYSICAL_START=0x00000000 +CONFIG_PPC=y +CONFIG_PPC32=y +CONFIG_PPC40x_SIMPLE=y +# CONFIG_PPC4xx_HSTA_MSI is not set +CONFIG_PPC4xx_MSI=y +# CONFIG_PPC4xx_OCM is not set +CONFIG_PPC4xx_PCI_EXPRESS=y +# CONFIG_PPC64 is not set +# CONFIG_PPC_85xx is not set +# CONFIG_PPC_8xx is not set +# CONFIG_PPC_970_NAP is not set +CONFIG_PPC_ADV_DEBUG_DACS=2 +CONFIG_PPC_ADV_DEBUG_DVCS=0 +CONFIG_PPC_ADV_DEBUG_IACS=2 +CONFIG_PPC_ADV_DEBUG_REGS=y +# CONFIG_PPC_BOOK3S_32 is not set +# CONFIG_PPC_CELL is not set +# CONFIG_PPC_CELL_NATIVE is not set +# CONFIG_PPC_COPRO_BASE is not set +CONFIG_PPC_DCR=y +# CONFIG_PPC_DCR_MMIO is not set +CONFIG_PPC_DCR_NATIVE=y +# CONFIG_PPC_DOORBELL is not set +# CONFIG_PPC_EARLY_DEBUG is not set +# CONFIG_PPC_EPAPR_HV_PIC is not set +# CONFIG_PPC_I8259 is not set +# CONFIG_PPC_ICP_HV is not set +# CONFIG_PPC_ICP_NATIVE is not set +# CONFIG_PPC_ICS_RTAS is not set +CONFIG_PPC_INDIRECT_PCI=y +CONFIG_PPC_MMU_NOHASH=y +# CONFIG_PPC_MM_SLICES is not set +# CONFIG_PPC_MPC106 is not set +CONFIG_PPC_MSI_BITMAP=y +CONFIG_PPC_OF=y +# CONFIG_PPC_P7_NAP is not set +CONFIG_PPC_PCI_CHOICE=y +# CONFIG_PPC_RTAS is not set +CONFIG_PPC_UDBG_16550=y +CONFIG_PPC_WERROR=y +# CONFIG_PPC_XICS is not set +# CONFIG_PQ2ADS is not set +# CONFIG_PREEMPT_RCU is not set +CONFIG_RAS=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_SCHED_HRTICK=y +# CONFIG_SCSI_DMA is not set +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +CONFIG_SPARSE_IRQ=y +# CONFIG_SWIOTLB is not set +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_TASK_SIZE=0xc0000000 +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB_SUPPORT=y +# CONFIG_WALNUT is not set +CONFIG_WORD_SIZE=32 +# CONFIG_XILINX_SYSACE is not set +# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_POWERPC=y diff --git a/target/linux/ppc40x/image/Makefile b/target/linux/ppc40x/image/Makefile new file mode 100644 index 000000000..407077429 --- /dev/null +++ b/target/linux/ppc40x/image/Makefile @@ -0,0 +1,72 @@ +# +# Copyright (C) 2008-2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +JFFS2_BLOCKSIZE=128k 64k + +define Image/Prepare + $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/kilauea.dts > $(KDIR)/openwrt-kilauea.dtb +endef + +define Image/BuildKernel + cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage + $(call Image/Build/Initramfs) +endef + +define Image/Build + $(call Image/Build/$(1),$(1)) +endef + +define Image/Build/ext2 + cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img +endef + +define Image/Build/jffs2-128k + ( \ + dd if=$(KDIR)/uImage bs=1920k conv=sync; \ + dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-jffs2.img +endef + +define Image/Build/jffs2-64k + ( \ + dd if=$(KDIR)/cuImage.magicbox bs=1408k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-jffs2.img + ( \ + dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-jffs2.img +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) + ( \ + dd if=$(KDIR)/uImage bs=1920k conv=sync; \ + dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-$(1).img + ( \ + dd if=$(KDIR)/cuImage.magicbox bs=64k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-$(1).img + ( \ + dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-$(1).img +endef + +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) +define Image/Build/Initramfs + cp $(KDIR)/cuImage.magicbox-initramfs $(BIN_DIR)/openwrt-$(BOARD)-magicbox-initramfs.bin + cp $(KDIR)/cuImage.openrb-initramfs $(BIN_DIR)/openwrt-$(BOARD)-openrb-initramfs.bin +endef +endif + +$(eval $(call BuildImage)) diff --git a/target/linux/ppc40x/modules.mk b/target/linux/ppc40x/modules.mk new file mode 100644 index 000000000..4db39fac7 --- /dev/null +++ b/target/linux/ppc40x/modules.mk @@ -0,0 +1,41 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define KernelPackage/ata-magicbox-cf + SUBMENU:=$(BLOCK_MENU) + TITLE:=Magicbox v2/OpenRB Compact flash support + DEPENDS:=@TARGET_ppc40x + KCONFIG:=CONFIG_PATA_MAGICBOX_CF + FILES:=$(LINUX_DIR)/drivers/ata/pata_magicbox_cf.ko + AUTOLOAD:=$(call AutoLoad,41,pata_magicbox_cf,1) + $(call AddDepends/ata) +endef + +define KernelPackage/ata-magicbox-cf/description + Support for Magicbox v2/OpenRB on-board CF slot. +endef + +$(eval $(call KernelPackage,ata-magicbox-cf)) + + +define KernelPackage/usb-isp116x-hcd + TITLE:=Support for the ISP116x USB Host Controller + DEPENDS:=@TARGET_ppc40x + KCONFIG:= \ + CONFIG_USB_ISP116X_HCD \ + CONFIG_USB_ISP116X_HCD_OF=y \ + CONFIG_USB_ISP116X_HCD_PLATFORM=n + FILES:=$(LINUX_DIR)/drivers/usb/host/isp116x-hcd.ko + AUTOLOAD:=$(call AutoLoad,50,isp116x-hcd) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-isp116x-hcd/description + Kernel support for the ISP116X USB Host Controller +endef + +$(eval $(call KernelPackage,usb-isp116x-hcd)) diff --git a/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch b/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch new file mode 100644 index 000000000..5c7329dde --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch @@ -0,0 +1,27 @@ +--- a/arch/powerpc/boot/dcr.h ++++ b/arch/powerpc/boot/dcr.h +@@ -59,6 +59,14 @@ static const unsigned long sdram_bxcr[] + #define EBC_BXCR(n) (n) + #define EBC_BXCR_BAS 0xfff00000 + #define EBC_BXCR_BS 0x000e0000 ++#define EBC_BXCR_BS_1M 0x00000000 ++#define EBC_BXCR_BS_2M 0x00020000 ++#define EBC_BXCR_BS_4M 0x00040000 ++#define EBC_BXCR_BS_8M 0x00060000 ++#define EBC_BXCR_BS_16M 0x00080000 ++#define EBC_BXCR_BS_32M 0x000a0000 ++#define EBC_BXCR_BS_64M 0x000c0000 ++#define EBC_BXCR_BS_128M 0x000e0000 + #define EBC_BXCR_BANK_SIZE(reg) \ + (0x100000 << (((reg) & EBC_BXCR_BS) >> 17)) + #define EBC_BXCR_BU 0x00018000 +@@ -67,6 +75,9 @@ static const unsigned long sdram_bxcr[] + #define EBC_BXCR_BU_WO 0x00010000 + #define EBC_BXCR_BU_RW 0x00018000 + #define EBC_BXCR_BW 0x00006000 ++#define EBC_BXCR_BW_8 0x00000000 ++#define EBC_BXCR_BW_16 0x00002000 ++#define EBC_BXCR_BW_32 0x00006000 + #define EBC_B0AP 0x10 + #define EBC_B1AP 0x11 + #define EBC_B2AP 0x12 diff --git a/target/linux/ppc40x/patches-3.18/004-magicbox.patch b/target/linux/ppc40x/patches-3.18/004-magicbox.patch new file mode 100644 index 000000000..48f5912e4 --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/004-magicbox.patch @@ -0,0 +1,446 @@ +--- /dev/null ++++ b/arch/powerpc/boot/cuboot-magicbox.c +@@ -0,0 +1,98 @@ ++/* ++ * Old U-boot compatibility for Magicbox boards ++ * ++ * Author: Imre Kaloz ++ * Gabor Juhos ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include "ops.h" ++#include "io.h" ++#include "dcr.h" ++#include "stdio.h" ++#include "4xx.h" ++#include "44x.h" ++#include "cuboot.h" ++ ++#define TARGET_4xx ++#define TARGET_405EP ++#include "ppcboot.h" ++ ++static bd_t bd; ++ ++static void fixup_perwe(void) ++{ ++ ++#define DCRN_CPC0_PCI_BASE 0xf9 ++ ++ /* Turn on PerWE instead of PCIINT */ ++ mtdcr(DCRN_CPC0_PCI_BASE, ++ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); ++ ++#undef DCRN_CPC0_PCI_BASE ++} ++ ++static void fixup_cf_card(void) ++{ ++ ++#define CF_CS0_BASE 0xff100000 ++#define CF_CS1_BASE 0xff200000 ++ ++ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); ++ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M | ++ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); ++ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); ++ ++ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); ++ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M | ++ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); ++ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); ++ ++#undef CF_CS0_BASE ++#undef CF_CS1_BASE ++} ++ ++static void magicbox_fixups(void) ++{ ++ ibm405ep_fixup_clocks(bd.bi_procfreq / 8); ++ ibm4xx_sdram_fixup_memsize(); ++ ++ /* Magicbox v1 has only one ethernet, one serial and no ++ * CF slot -- detect it using it's fake enet1addr ++ */ ++ if ((bd.bi_enet1addr[2] == 0x02) && ++ (bd.bi_enet1addr[3] == 0xfa) && ++ (bd.bi_enet1addr[4] == 0xf0) && ++ (bd.bi_enet1addr[5] == 0x80)) { ++ void *devp; ++ devp = finddevice("/plb/opb/ethernet@ef600900"); ++ del_node(devp); ++ devp = finddevice("/plb/opb/serial@ef600400"); ++ del_node(devp); ++ devp = finddevice("/plb/ebc/cf_card@ff100000"); ++ del_node(devp); ++ ++ } else { ++ fixup_perwe(); ++ fixup_cf_card(); ++ } ++ ++ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); ++} ++ ++void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ++ unsigned long r6, unsigned long r7) ++{ ++ CUBOOT_INIT(); ++ platform_ops.fixups = magicbox_fixups; ++ platform_ops.exit = ibm40x_dbcr_reset; ++ fdt_init(_dtb_start); ++ serial_console_init(); ++} +--- /dev/null ++++ b/arch/powerpc/boot/dts/magicbox.dts +@@ -0,0 +1,285 @@ ++/* ++ * Device Tree Source for Magicbox boards ++ * ++ * Copyright 2008-2009 Imre Kaloz ++ * Copyright 2009 Gabor Juhos ++ * ++ * Based on walnut.dts ++ * ++ * This file is licensed under the terms of the GNU General Public ++ * License version 2. This program is licensed "as is" without ++ * any warranty of any kind, whether express or implied. ++ */ ++ ++/dts-v1/; ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "magicbox"; ++ compatible = "magicbox"; ++ dcr-parent = <&{/cpus/cpu@0}>; ++ ++ aliases { ++ ethernet0 = &EMAC0; ++ ethernet1 = &EMAC1; ++ serial0 = &UART0; ++ serial1 = &UART1; ++ }; ++ ++ cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ cpu@0 { ++ device_type = "cpu"; ++ model = "PowerPC,405EP"; ++ reg = <0x00000000>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ timebase-frequency = <0>; /* Filled in by zImage */ ++ i-cache-line-size = <0x20>; ++ d-cache-line-size = <0x20>; ++ i-cache-size = <0x4000>; ++ d-cache-size = <0x4000>; ++ dcr-controller; ++ dcr-access-method = "native"; ++ }; ++ }; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ ++ }; ++ ++ UIC0: interrupt-controller { ++ compatible = "ibm,uic"; ++ interrupt-controller; ++ cell-index = <0>; ++ dcr-reg = <0x0c0 0x009>; ++ #address-cells = <0>; ++ #size-cells = <0>; ++ #interrupt-cells = <2>; ++ }; ++ ++ plb { ++ compatible = "ibm,plb3"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ ++ SDRAM0: memory-controller { ++ compatible = "ibm,sdram-405ep"; ++ dcr-reg = <0x010 0x002>; ++ }; ++ ++ MAL: mcmal { ++ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; ++ dcr-reg = <0x180 0x062>; ++ num-tx-chans = <4>; ++ num-rx-chans = <2>; ++ interrupt-parent = <&UIC0>; ++ interrupts = < ++ 0xb 0x4 /* TXEOB */ ++ 0xc 0x4 /* RXEOB */ ++ 0xa 0x4 /* SERR */ ++ 0xd 0x4 /* TXDE */ ++ 0xe 0x4 /* RXDE */>; ++ }; ++ ++ POB0: opb { ++ compatible = "ibm,opb-405ep", "ibm,opb"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0xef600000 0xef600000 0x00a00000>; ++ dcr-reg = <0x0a0 0x005>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ ++ UART0: serial@ef600300 { ++ device_type = "serial"; ++ compatible = "ns16550"; ++ reg = <0xef600300 0x00000008>; ++ virtual-reg = <0xef600300>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ current-speed = <115200>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x0 0x4>; ++ }; ++ ++ UART1: serial@ef600400 { ++ device_type = "serial"; ++ compatible = "ns16550"; ++ reg = <0xef600400 0x00000008>; ++ virtual-reg = <0xef600400>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ current-speed = <115200>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x1 0x4>; ++ }; ++ ++ IIC: i2c@ef600500 { ++ compatible = "ibm,iic-405ep", "ibm,iic"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0xef600500 0x00000011>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x2 0x4>; ++ ++ dtt@48 { ++ compatible = "national,lm75"; ++ reg = <0x48>; ++ }; ++ ++ eeprom@50 { ++ compatible = "at24,24c16"; ++ reg = <0x50>; ++ }; ++ }; ++ ++ GPIO0: gpio-controller@ef600700 { ++ compatible = "ibm,ppc4xx-gpio"; ++ reg = <0xef600700 0x00000020>; ++ #gpio-cells = <2>; ++ gpio-controller; ++ }; ++ ++ EMAC0: ethernet@ef600800 { ++ linux,network-index = <0x0>; ++ device_type = "network"; ++ compatible = "ibm,emac-405ep", "ibm,emac"; ++ interrupt-parent = <&UIC0>; ++ interrupts = < ++ 0xf 0x4 /* Ethernet */ ++ 0x9 0x4 /* Ethernet Wake Up */>; ++ local-mac-address = [000000000000]; /* Filled in by zImage */ ++ reg = <0xef600800 0x00000070>; ++ mal-device = <&MAL>; ++ mal-tx-channel = <0>; ++ mal-rx-channel = <0>; ++ cell-index = <0>; ++ max-frame-size = <0x5dc>; ++ rx-fifo-size = <0x1000>; ++ tx-fifo-size = <0x800>; ++ phy-mode = "mii"; ++ phy-map = <0x00000000>; ++ }; ++ ++ EMAC1: ethernet@ef600900 { ++ linux,network-index = <0x1>; ++ device_type = "network"; ++ compatible = "ibm,emac-405ep", "ibm,emac"; ++ interrupt-parent = <&UIC0>; ++ interrupts = < ++ 0x11 0x4 /* Ethernet */ ++ 0x09 0x4 /* Ethernet Wake Up */>; ++ local-mac-address = [000000000000]; /* Filled in by zImage */ ++ reg = <0xef600900 0x00000070>; ++ mal-device = <&MAL>; ++ mal-tx-channel = <2>; ++ mal-rx-channel = <1>; ++ cell-index = <1>; ++ max-frame-size = <0x5dc>; ++ rx-fifo-size = <0x1000>; ++ tx-fifo-size = <0x800>; ++ mdio-device = <&EMAC0>; ++ phy-mode = "mii"; ++ phy-map = <0x00000001>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ user { ++ label = "magicbox:red:user"; ++ gpios = <&GPIO0 2 1>; ++ }; ++ }; ++ }; ++ ++ EBC0: ebc { ++ compatible = "ibm,ebc-405ep", "ibm,ebc"; ++ dcr-reg = <0x012 0x002>; ++ #address-cells = <2>; ++ #size-cells = <1>; ++ /* The ranges property is supplied by the bootwrapper ++ * and is based on the firmware's configuration of the ++ * EBC bridge ++ */ ++ clock-frequency = <0>; /* Filled in by zImage */ ++ ++ cf_card@ff100000 { ++ compatible = "magicbox-cf", "pata-magicbox-cf"; ++ reg = <0x00000000 0xff100000 0x00001000 ++ 0x00000000 0xff200000 0x00001000>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; ++ }; ++ ++ nor_flash@ffc00000 { ++ compatible = "cfi-flash"; ++ bank-width = <2>; ++ reg = <0x00000000 0xffc00000 0x00400000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ partition0@0 { ++ label = "linux"; ++ reg = <0x0 0x160000>; ++ }; ++ partition1@120000 { ++ label = "rootfs"; ++ reg = <0x160000 0x260000>; ++ }; ++ partition2@3c0000 { ++ label = "u-boot"; ++ reg = <0x3c0000 0x30000>; ++ read-only; ++ }; ++ partition3@0 { ++ label = "firmware"; ++ reg = <0x0 0x3c0000>; ++ }; ++ }; ++ }; ++ ++ PCI0: pci@ec000000 { ++ device_type = "pci"; ++ #interrupt-cells = <1>; ++ #size-cells = <2>; ++ #address-cells = <3>; ++ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; ++ primary; ++ reg = <0xeec00000 0x00000008 /* Config space access */ ++ 0xeed80000 0x00000004 /* IACK */ ++ 0xeed80000 0x00000004 /* Special cycle */ ++ 0xef480000 0x00000040>; /* Internal registers */ ++ ++ /* Outbound ranges, one memory and one IO, ++ * later cannot be changed. Chip supports a second ++ * IO range but we don't use it for now ++ */ ++ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 ++ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; ++ ++ /* Inbound 2GB range starting at 0 */ ++ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; ++ ++ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; ++ interrupt-map = < ++ /* IDSEL 1 */ ++ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 ++ ++ /* IDSEL 2 */ ++ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 ++ ++ /* IDSEL 3 */ ++ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 ++ ++ /* IDSEL 4 */ ++ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 ++ >; ++ }; ++ }; ++ ++ chosen { ++ linux,stdout-path = "/plb/opb/serial@ef600300"; ++ }; ++}; +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -50,6 +50,7 @@ $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += - + $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 ++$(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 +@@ -86,7 +87,8 @@ src-plat-y := of.c epapr.c + src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \ + treeboot-walnut.c cuboot-acadia.c \ + cuboot-kilauea.c simpleboot.c \ +- virtex405-head.S virtex.c ++ virtex405-head.S virtex.c \ ++ cuboot-magicbox.c + src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ + cuboot-bamboo.c cuboot-sam440ep.c \ + cuboot-sequoia.c cuboot-rainier.c \ +@@ -238,6 +240,7 @@ image-$(CONFIG_HOTFOOT) += cuImage.hot + image-$(CONFIG_WALNUT) += treeImage.walnut + image-$(CONFIG_ACADIA) += cuImage.acadia + image-$(CONFIG_OBS600) += uImage.obs600 ++image-$(CONFIG_MAGICBOX) += cuImage.magicbox + + # Board ports in arch/powerpc/platform/44x/Kconfig + image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony +--- a/arch/powerpc/platforms/40x/Kconfig ++++ b/arch/powerpc/platforms/40x/Kconfig +@@ -37,6 +37,16 @@ config KILAUEA + help + This option enables support for the AMCC PPC405EX evaluation board. + ++config MAGICBOX ++ bool "Magicbox" ++ depends on 40x ++ default n ++ select PPC40x_SIMPLE ++ select 405EP ++ select PCI ++ help ++ This option enables support for the Magicbox boards. ++ + config MAKALU + bool "Makalu" + depends on 40x +--- a/arch/powerpc/platforms/40x/ppc40x_simple.c ++++ b/arch/powerpc/platforms/40x/ppc40x_simple.c +@@ -58,6 +58,7 @@ static const char * const board[] __init + "apm,klondike", + "est,hotfoot", + "plathome,obs600", ++ "magicbox", + NULL + }; + diff --git a/target/linux/ppc40x/patches-3.18/005-openrb.patch b/target/linux/ppc40x/patches-3.18/005-openrb.patch new file mode 100644 index 000000000..a21d9fa72 --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/005-openrb.patch @@ -0,0 +1,447 @@ +--- /dev/null ++++ b/arch/powerpc/boot/cuboot-openrb.c +@@ -0,0 +1,94 @@ ++/* ++ * Old U-boot compatibility for OpenRB boards ++ * ++ * Author: Gabor Juhos ++ * Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include "ops.h" ++#include "io.h" ++#include "dcr.h" ++#include "stdio.h" ++#include "4xx.h" ++#include "44x.h" ++#include "cuboot.h" ++ ++#define TARGET_4xx ++#define TARGET_405EP ++#include "ppcboot.h" ++ ++static bd_t bd; ++ ++static void fixup_perwe(void) ++{ ++#define DCRN_CPC0_PCI_BASE 0xf9 ++ ++ /* Turn on PerWE instead of PCIINT */ ++ mtdcr(DCRN_CPC0_PCI_BASE, ++ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); ++ ++#undef DCRN_CPC0_PCI_BASE ++} ++ ++static void fixup_cf_card(void) ++{ ++#define CF_CS0_BASE 0xff100000 ++#define CF_CS1_BASE 0xff200000 ++ ++ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); ++ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M | ++ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); ++ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); ++ ++ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); ++ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M | ++ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); ++ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); ++ ++#undef CF_CS0_BASE ++#undef CF_CS1_BASE ++} ++ ++static void fixup_isp116x(void) ++{ ++#define ISP116X_CS_BASE 0xf0000000 ++ ++ /* PerCS3 (ISP1160's CS): base 0xf0000000, size 32MB, 16-bit, rw */ ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3CR); ++ mtdcr(DCRN_EBC0_CFGDATA, ISP116X_CS_BASE | EBC_BXCR_BS_32M | ++ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); ++ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3AP); ++ mtdcr(DCRN_EBC0_CFGDATA, 0x03016600); ++ ++#undef ISP116X_CS_BASE ++} ++ ++static void openrb_fixups(void) ++{ ++ ibm405ep_fixup_clocks(bd.bi_procfreq / 8); ++ ibm4xx_sdram_fixup_memsize(); ++ ++ fixup_perwe(); ++ fixup_cf_card(); ++ fixup_isp116x(); ++ ++ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); ++} ++ ++void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ++ unsigned long r6, unsigned long r7) ++{ ++ CUBOOT_INIT(); ++ platform_ops.fixups = openrb_fixups; ++ platform_ops.exit = ibm40x_dbcr_reset; ++ fdt_init(_dtb_start); ++ serial_console_init(); ++} +--- /dev/null ++++ b/arch/powerpc/boot/dts/openrb.dts +@@ -0,0 +1,291 @@ ++/* ++ * Device Tree Source for OpenRB boards ++ * ++ * Copyright 2009 Gabor Juhos ++ * Copyright 2009 Imre Kaloz ++ * ++ * Based on walnut.dts ++ * ++ * This file is licensed under the terms of the GNU General Public ++ * License version 2. This program is licensed "as is" without ++ * any warranty of any kind, whether express or implied. ++ */ ++ ++/dts-v1/; ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "openrb"; ++ compatible = "openrb"; ++ dcr-parent = <&{/cpus/cpu@0}>; ++ ++ aliases { ++ ethernet0 = &EMAC0; ++ ethernet1 = &EMAC1; ++ serial0 = &UART0; ++ serial1 = &UART1; ++ }; ++ ++ cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ cpu@0 { ++ device_type = "cpu"; ++ model = "PowerPC,405EP"; ++ reg = <0x00000000>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ timebase-frequency = <0>; /* Filled in by zImage */ ++ i-cache-line-size = <0x20>; ++ d-cache-line-size = <0x20>; ++ i-cache-size = <0x4000>; ++ d-cache-size = <0x4000>; ++ dcr-controller; ++ dcr-access-method = "native"; ++ }; ++ }; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ ++ }; ++ ++ UIC0: interrupt-controller { ++ compatible = "ibm,uic"; ++ interrupt-controller; ++ cell-index = <0>; ++ dcr-reg = <0x0c0 0x009>; ++ #address-cells = <0>; ++ #size-cells = <0>; ++ #interrupt-cells = <2>; ++ }; ++ ++ plb { ++ compatible = "ibm,plb3"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ ++ SDRAM0: memory-controller { ++ compatible = "ibm,sdram-405ep"; ++ dcr-reg = <0x010 0x002>; ++ }; ++ ++ MAL: mcmal { ++ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; ++ dcr-reg = <0x180 0x062>; ++ num-tx-chans = <4>; ++ num-rx-chans = <2>; ++ interrupt-parent = <&UIC0>; ++ interrupts = < ++ 0xb 0x4 /* TXEOB */ ++ 0xc 0x4 /* RXEOB */ ++ 0xa 0x4 /* SERR */ ++ 0xd 0x4 /* TXDE */ ++ 0xe 0x4 /* RXDE */>; ++ }; ++ ++ POB0: opb { ++ compatible = "ibm,opb-405ep", "ibm,opb"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0xef600000 0xef600000 0x00a00000>; ++ dcr-reg = <0x0a0 0x005>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ ++ UART0: serial@ef600300 { ++ device_type = "serial"; ++ compatible = "ns16550"; ++ reg = <0xef600300 0x00000008>; ++ virtual-reg = <0xef600300>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ current-speed = <115200>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x0 0x4>; ++ }; ++ ++ UART1: serial@ef600400 { ++ device_type = "serial"; ++ compatible = "ns16550"; ++ reg = <0xef600400 0x00000008>; ++ virtual-reg = <0xef600400>; ++ clock-frequency = <0>; /* Filled in by zImage */ ++ current-speed = <115200>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x1 0x4>; ++ }; ++ ++ IIC: i2c@ef600500 { ++ compatible = "ibm,iic-405ep", "ibm,iic"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0xef600500 0x00000011>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x2 0x4>; ++ ++ eeprom@50 { ++ compatible = "at24,24c16"; ++ reg = <0x50>; ++ }; ++ }; ++ ++ GPIO0: gpio-controller@ef600700 { ++ compatible = "ibm,ppc4xx-gpio"; ++ reg = <0xef600700 0x00000020>; ++ #gpio-cells = <2>; ++ gpio-controller; ++ }; ++ ++ EMAC0: ethernet@ef600800 { ++ linux,network-index = <0x0>; ++ device_type = "network"; ++ compatible = "ibm,emac-405ep", "ibm,emac"; ++ interrupt-parent = <&UIC0>; ++ interrupts = < ++ 0xf 0x4 /* Ethernet */ ++ 0x9 0x4 /* Ethernet Wake Up */>; ++ local-mac-address = [000000000000]; /* Filled in by zImage */ ++ reg = <0xef600800 0x00000070>; ++ mal-device = <&MAL>; ++ mal-tx-channel = <0>; ++ mal-rx-channel = <0>; ++ cell-index = <0>; ++ max-frame-size = <0x5dc>; ++ rx-fifo-size = <0x1000>; ++ tx-fifo-size = <0x800>; ++ phy-mode = "mii"; ++ phy-map = <0x00000000>; ++ }; ++ ++ EMAC1: ethernet@ef600900 { ++ linux,network-index = <0x1>; ++ device_type = "network"; ++ compatible = "ibm,emac-405ep", "ibm,emac"; ++ interrupt-parent = <&UIC0>; ++ interrupts = < ++ 0x11 0x4 /* Ethernet */ ++ 0x09 0x4 /* Ethernet Wake Up */>; ++ local-mac-address = [000000000000]; /* Filled in by zImage */ ++ reg = <0xef600900 0x00000070>; ++ mal-device = <&MAL>; ++ mal-tx-channel = <2>; ++ mal-rx-channel = <1>; ++ cell-index = <1>; ++ max-frame-size = <0x5dc>; ++ rx-fifo-size = <0x1000>; ++ tx-fifo-size = <0x800>; ++ mdio-device = <&EMAC0>; ++ phy-mode = "mii"; ++ phy-map = <0x00000001>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ user { ++ label = "openrb:green:user"; ++ gpios = <&GPIO0 2 1>; ++ }; ++ }; ++ }; ++ ++ EBC0: ebc { ++ compatible = "ibm,ebc-405ep", "ibm,ebc"; ++ dcr-reg = <0x012 0x002>; ++ #address-cells = <2>; ++ #size-cells = <1>; ++ /* The ranges property is supplied by the bootwrapper ++ * and is based on the firmware's configuration of the ++ * EBC bridge ++ */ ++ clock-frequency = <0>; /* Filled in by zImage */ ++ ++ isp116x@f0000000 { ++ compatible = "isp116x-hcd"; ++ oc_enable; ++ int_act_high; ++ int_edge_triggered; ++ reg = <0x00000000 0xf0000000 0x00000002 /* data */ ++ 0x00000000 0xf1000000 0x00000002 /* addr */ >; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x1b 0x1 /* IRQ_TYPE_EDGE_RISING */ >; ++ }; ++ ++ cf_card@ff100000 { ++ compatible = "magicbox-cf", "pata-magicbox-cf"; ++ reg = <0x00000000 0xff100000 0x00001000 ++ 0x00000000 0xff200000 0x00001000>; ++ interrupt-parent = <&UIC0>; ++ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; ++ }; ++ ++ nor_flash@ff800000 { ++ compatible = "cfi-flash"; ++ bank-width = <2>; ++ reg = <0x00000000 0xff800000 0x00800000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ partition0@0 { ++ label = "linux"; ++ reg = <0x0 0x160000>; ++ }; ++ partition1@120000 { ++ label = "rootfs"; ++ reg = <0x160000 0x660000>; ++ }; ++ partition2@7c0000 { ++ label = "u-boot"; ++ reg = <0x7c0000 0x30000>; ++ read-only; ++ }; ++ partition3@0 { ++ label = "firmware"; ++ reg = <0x0 0x7c0000>; ++ }; ++ }; ++ }; ++ ++ PCI0: pci@ec000000 { ++ device_type = "pci"; ++ #interrupt-cells = <1>; ++ #size-cells = <2>; ++ #address-cells = <3>; ++ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; ++ primary; ++ reg = <0xeec00000 0x00000008 /* Config space access */ ++ 0xeed80000 0x00000004 /* IACK */ ++ 0xeed80000 0x00000004 /* Special cycle */ ++ 0xef480000 0x00000040>; /* Internal registers */ ++ ++ /* Outbound ranges, one memory and one IO, ++ * later cannot be changed. Chip supports a second ++ * IO range but we don't use it for now ++ */ ++ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 ++ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; ++ ++ /* Inbound 2GB range starting at 0 */ ++ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; ++ ++ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; ++ interrupt-map = < ++ /* IDSEL 1 */ ++ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 ++ ++ /* IDSEL 2 */ ++ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 ++ ++ /* IDSEL 3 */ ++ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 ++ ++ /* IDSEL 4 */ ++ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 ++ >; ++ }; ++ }; ++ ++ chosen { ++ linux,stdout-path = "/plb/opb/serial@ef600300"; ++ }; ++}; +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -51,6 +51,7 @@ $(obj)/cuboot-taishan.o: BOOTCFLAGS += - + $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 + $(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405 ++$(obj)/cuboot-openrb.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 +@@ -88,7 +89,7 @@ src-plat-$(CONFIG_40x) += fixed-head.S e + treeboot-walnut.c cuboot-acadia.c \ + cuboot-kilauea.c simpleboot.c \ + virtex405-head.S virtex.c \ +- cuboot-magicbox.c ++ cuboot-magicbox.c cuboot-openrb + src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ + cuboot-bamboo.c cuboot-sam440ep.c \ + cuboot-sequoia.c cuboot-rainier.c \ +@@ -241,6 +242,7 @@ image-$(CONFIG_WALNUT) += treeImage.wa + image-$(CONFIG_ACADIA) += cuImage.acadia + image-$(CONFIG_OBS600) += uImage.obs600 + image-$(CONFIG_MAGICBOX) += cuImage.magicbox ++image-$(CONFIG_OPENRB) += cuImage.openrb + + # Board ports in arch/powerpc/platform/44x/Kconfig + image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony +--- a/arch/powerpc/platforms/40x/Kconfig ++++ b/arch/powerpc/platforms/40x/Kconfig +@@ -47,6 +47,16 @@ config MAGICBOX + help + This option enables support for the Magicbox boards. + ++config OPENRB ++ bool "OpenRB" ++ depends on 40x ++ default n ++ select PPC40x_SIMPLE ++ select 405EP ++ select PCI ++ help ++ This option enables support for the OpenRB boards. ++ + config MAKALU + bool "Makalu" + depends on 40x +--- a/arch/powerpc/platforms/40x/ppc40x_simple.c ++++ b/arch/powerpc/platforms/40x/ppc40x_simple.c +@@ -59,6 +59,7 @@ static const char * const board[] __init + "est,hotfoot", + "plathome,obs600", + "magicbox", ++ "openrb", + NULL + }; + diff --git a/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch b/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch new file mode 100644 index 000000000..d0e89b713 --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch @@ -0,0 +1,433 @@ +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -234,6 +234,16 @@ config PDC_ADMA + + If unsure, say N. + ++config PATA_MAGICBOX_CF ++ tristate "Magicbox/OpenRB Compact Flash support" ++ depends on MAGICBOX || OPENRB ++ help ++ This option enables support for a Compact Flash conected on ++ the ppc405ep expansion bus. This driver had been written for ++ the Magicbox v2 and OpenRB boards. ++ ++ If unsure, say N. ++ + config PATA_OCTEON_CF + tristate "OCTEON Boot Bus Compact Flash support" + depends on CAVIUM_OCTEON_SOC +--- a/drivers/ata/Makefile ++++ b/drivers/ata/Makefile +@@ -91,6 +91,7 @@ obj-$(CONFIG_PATA_AT91) += pata_at91.o + obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o + obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o + obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o ++obj-$(CONFIG_PATA_MAGICBOX_CF) += pata_magicbox_cf.o + obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o + obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o + obj-$(CONFIG_PATA_OPTI) += pata_opti.o +--- /dev/null ++++ b/drivers/ata/pata_magicbox_cf.c +@@ -0,0 +1,401 @@ ++/* ++ * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards. ++ * ++ * Copyright (C) 2009,2012 Gabor Juhos ++ * ++ * Based on the IDE driver by Wojtek Kaniewski ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++//#include ++//#include ++#include ++#include ++ ++#define DRV_DESC "PATA/CompactFlash driver for Magicbox/OpenRB boards" ++#define DRV_NAME "pata_magicbox_cf" ++#define DRV_VERSION "0.1.0" ++ ++#define MAGICBOX_CF_REG_CMD (2 * ATA_REG_CMD) ++#define MAGICBOX_CF_REG_DATA (2 * ATA_REG_DATA) ++#define MAGICBOX_CF_REG_ERR (2 * ATA_REG_ERR) ++#define MAGICBOX_CF_REG_FEATURE (2 * ATA_REG_FEATURE) ++#define MAGICBOX_CF_REG_NSECT (2 * ATA_REG_NSECT) ++#define MAGICBOX_CF_REG_LBAL (2 * ATA_REG_LBAL) ++#define MAGICBOX_CF_REG_LBAM (2 * ATA_REG_LBAM) ++#define MAGICBOX_CF_REG_LBAH (2 * ATA_REG_LBAH) ++#define MAGICBOX_CF_REG_DEVICE (2 * ATA_REG_DEVICE) ++#define MAGICBOX_CF_REG_STATUS (2 * ATA_REG_STATUS) ++#define MAGICBOX_CF_REG_ALTSTATUS (2 * 6) ++#define MAGICBOX_CF_REG_CTL (2 * 6) ++ ++#define MAGICBOX_CF_MAXPORTS 1 ++ ++struct magicbox_cf_info { ++ void __iomem *base; ++ void __iomem *ctrl; ++}; ++ ++static inline u8 magicbox_cf_inb(void __iomem *port) ++{ ++ return (u8) (readw(port) >> 8) & 0xff; ++} ++ ++static inline void magicbox_cf_outb(void __iomem *port, u8 value) ++{ ++ writew(value << 8, port); ++} ++ ++static int magicbox_cf_set_mode(struct ata_link *link, ++ struct ata_device **error) ++{ ++ struct ata_device *dev; ++ ++ ata_for_each_dev(dev, link, ENABLED) { ++ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); ++ dev->pio_mode = XFER_PIO_0; ++ dev->xfer_mode = XFER_PIO_0; ++ dev->xfer_shift = ATA_SHIFT_PIO; ++ dev->flags |= ATA_DFLAG_PIO; ++ } ++ ++ return 0; ++} ++ ++static void magicbox_cf_exec_command(struct ata_port *ap, ++ const struct ata_taskfile *tf) ++{ ++ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); ++ ++ magicbox_cf_outb(ap->ioaddr.command_addr, tf->command); ++ ata_sff_pause(ap); ++} ++ ++static u8 magicbox_cf_check_status(struct ata_port *ap) ++{ ++ u8 status; ++ ++ status = magicbox_cf_inb(ap->ioaddr.status_addr); ++ ++ DPRINTK("ata%u: status 0x%X, from %p\n", ap->print_id, status, ++ ap->ioaddr.status_addr); ++ ++ return status; ++} ++ ++static u8 magicbox_cf_check_altstatus(struct ata_port *ap) ++{ ++ u8 altstatus; ++ ++ altstatus = magicbox_cf_inb(ap->ioaddr.altstatus_addr); ++ ++ DPRINTK("ata%u: altstatus 0x%X, from %p\n", ap->print_id, ++ altstatus, ap->ioaddr.altstatus_addr); ++ ++ return altstatus; ++} ++ ++static void magicbox_cf_dev_select(struct ata_port *ap, unsigned int device) ++{ ++ /* Nothing to do. We are supporting one device only. */ ++} ++ ++static void magicbox_cf_tf_load(struct ata_port *ap, ++ const struct ata_taskfile *tf) ++{ ++ struct ata_ioports *ioaddr = &ap->ioaddr; ++ unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; ++ ++ if (tf->ctl != ap->last_ctl) { ++ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl); ++ ap->last_ctl = tf->ctl; ++ ata_wait_idle(ap); ++ } ++ ++ if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { ++ magicbox_cf_outb(ioaddr->feature_addr, tf->hob_feature); ++ magicbox_cf_outb(ioaddr->nsect_addr, tf->hob_nsect); ++ magicbox_cf_outb(ioaddr->lbal_addr, tf->hob_lbal); ++ magicbox_cf_outb(ioaddr->lbam_addr, tf->hob_lbam); ++ magicbox_cf_outb(ioaddr->lbah_addr, tf->hob_lbah); ++ VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", ++ tf->hob_feature, ++ tf->hob_nsect, ++ tf->hob_lbal, ++ tf->hob_lbam, ++ tf->hob_lbah); ++ } ++ ++ if (is_addr) { ++ magicbox_cf_outb(ioaddr->feature_addr, tf->feature); ++ magicbox_cf_outb(ioaddr->nsect_addr, tf->nsect); ++ magicbox_cf_outb(ioaddr->lbal_addr, tf->lbal); ++ magicbox_cf_outb(ioaddr->lbam_addr, tf->lbam); ++ magicbox_cf_outb(ioaddr->lbah_addr, tf->lbah); ++ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", ++ tf->feature, ++ tf->nsect, ++ tf->lbal, ++ tf->lbam, ++ tf->lbah); ++ } ++ ++ if (tf->flags & ATA_TFLAG_DEVICE) { ++ magicbox_cf_outb(ioaddr->device_addr, tf->device); ++ VPRINTK("device 0x%X\n", tf->device); ++ } ++ ++ ata_wait_idle(ap); ++} ++ ++static void magicbox_cf_tf_read(struct ata_port *ap, struct ata_taskfile *tf) ++{ ++ struct ata_ioports *ioaddr = &ap->ioaddr; ++ ++ tf->command = magicbox_cf_inb(ap->ioaddr.status_addr); ++ tf->feature = magicbox_cf_inb(ioaddr->error_addr); ++ tf->nsect = magicbox_cf_inb(ioaddr->nsect_addr); ++ tf->lbal = magicbox_cf_inb(ioaddr->lbal_addr); ++ tf->lbam = magicbox_cf_inb(ioaddr->lbam_addr); ++ tf->lbah = magicbox_cf_inb(ioaddr->lbah_addr); ++ tf->device = magicbox_cf_inb(ioaddr->device_addr); ++ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", ++ tf->feature, ++ tf->nsect, ++ tf->lbal, ++ tf->lbam, ++ tf->lbah); ++ ++ if (tf->flags & ATA_TFLAG_LBA48) { ++ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl | ATA_HOB); ++ tf->hob_feature = magicbox_cf_inb(ioaddr->error_addr); ++ tf->hob_nsect = magicbox_cf_inb(ioaddr->nsect_addr); ++ tf->hob_lbal = magicbox_cf_inb(ioaddr->lbal_addr); ++ tf->hob_lbam = magicbox_cf_inb(ioaddr->lbam_addr); ++ tf->hob_lbah = magicbox_cf_inb(ioaddr->lbah_addr); ++ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl); ++ ap->last_ctl = tf->ctl; ++ VPRINTK("hob: feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", ++ tf->feature, ++ tf->nsect, ++ tf->lbal, ++ tf->lbam, ++ tf->lbah); ++ } ++} ++ ++static unsigned int magicbox_cf_data_xfer(struct ata_device *dev, ++ unsigned char *buf, ++ unsigned int buflen, int rw) ++{ ++ struct ata_port *ap = dev->link->ap; ++ unsigned int words = buflen >> 1; ++ unsigned int i; ++ u16 *buf16 = (u16 *) buf; ++ void __iomem *mmio = ap->ioaddr.data_addr; ++ ++ /* Transfer multiple of 2 bytes */ ++ if (rw == READ) ++ for (i = 0; i < words; i++) ++ buf16[i] = readw(mmio); ++ else ++ for (i = 0; i < words; i++) ++ writew(buf16[i], mmio); ++ ++ /* Transfer trailing 1 byte, if any. */ ++ if (unlikely(buflen & 0x01)) { ++ u16 align_buf[1] = { 0 }; ++ unsigned char *trailing_buf = buf + buflen - 1; ++ ++ if (rw == READ) { ++ align_buf[0] = readw(mmio); ++ memcpy(trailing_buf, align_buf, 1); ++ } else { ++ memcpy(align_buf, trailing_buf, 1); ++ writew(align_buf[0], mmio); ++ } ++ words++; ++ } ++ ++ return words << 1; ++} ++ ++static void magicbox_cf_irq_on(struct ata_port *ap) ++{ ++ /* Nothing to do. */ ++} ++ ++static void magicbox_cf_irq_clear(struct ata_port *ap) ++{ ++ /* Nothing to do. */ ++} ++ ++static struct ata_port_operations magicbox_cf_port_ops = { ++ .inherits = &ata_sff_port_ops, ++ ++ .cable_detect = ata_cable_40wire, ++ .set_mode = magicbox_cf_set_mode, ++ ++ .sff_exec_command = magicbox_cf_exec_command, ++ .sff_check_status = magicbox_cf_check_status, ++ .sff_check_altstatus = magicbox_cf_check_altstatus, ++ .sff_dev_select = magicbox_cf_dev_select, ++ .sff_tf_load = magicbox_cf_tf_load, ++ .sff_tf_read = magicbox_cf_tf_read, ++ .sff_data_xfer = magicbox_cf_data_xfer, ++ ++ .sff_irq_on = magicbox_cf_irq_on, ++ .sff_irq_clear = magicbox_cf_irq_clear, ++ ++ .port_start = ATA_OP_NULL, ++}; ++ ++static struct scsi_host_template magicbox_cf_sht = { ++ ATA_PIO_SHT(DRV_NAME), ++}; ++ ++static inline void magicbox_cf_setup_port(struct ata_host *host) ++{ ++ struct magicbox_cf_info *info = host->private_data; ++ struct ata_port *ap; ++ ++ ap = host->ports[0]; ++ ++ ap->ops = &magicbox_cf_port_ops; ++ ap->pio_mask = ATA_PIO4; ++ ap->flags |= ATA_FLAG_NO_ATAPI; ++ ++ ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD; ++ ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA; ++ ap->ioaddr.error_addr = info->base + MAGICBOX_CF_REG_ERR; ++ ap->ioaddr.feature_addr = info->base + MAGICBOX_CF_REG_FEATURE; ++ ap->ioaddr.nsect_addr = info->base + MAGICBOX_CF_REG_NSECT; ++ ap->ioaddr.lbal_addr = info->base + MAGICBOX_CF_REG_LBAL; ++ ap->ioaddr.lbam_addr = info->base + MAGICBOX_CF_REG_LBAM; ++ ap->ioaddr.lbah_addr = info->base + MAGICBOX_CF_REG_LBAH; ++ ap->ioaddr.device_addr = info->base + MAGICBOX_CF_REG_DEVICE; ++ ap->ioaddr.status_addr = info->base + MAGICBOX_CF_REG_STATUS; ++ ap->ioaddr.command_addr = info->base + MAGICBOX_CF_REG_CMD; ++ ++ ap->ioaddr.altstatus_addr = info->ctrl + MAGICBOX_CF_REG_ALTSTATUS; ++ ap->ioaddr.ctl_addr = info->ctrl + MAGICBOX_CF_REG_CTL; ++ ++ ata_port_desc(ap, "cmd 0x%p ctl 0x%p", ap->ioaddr.cmd_addr, ++ ap->ioaddr.ctl_addr); ++} ++ ++static int magicbox_cf_of_probe(struct platform_device *op) ++{ ++ struct magicbox_cf_info *info; ++ struct ata_host *host; ++ int irq; ++ int ret = 0; ++ ++ info = kzalloc(sizeof(struct magicbox_cf_info), GFP_KERNEL); ++ if (info == NULL) { ++ ret = -ENOMEM; ++ goto err_exit; ++ } ++ ++ irq = irq_of_parse_and_map(op->dev.of_node, 0); ++ if (irq < 0) { ++ dev_err(&op->dev, "invalid irq\n"); ++ ret = -EINVAL; ++ goto err_free_info; ++ } ++ ++ info->base = of_iomap(op->dev.of_node, 0); ++ if (info->base == NULL) { ++ ret = -ENOMEM; ++ goto err_free_info; ++ } ++ ++ info->ctrl = of_iomap(op->dev.of_node, 1); ++ if (info->ctrl == NULL) { ++ ret = -ENOMEM; ++ goto err_unmap_base; ++ } ++ ++ host = ata_host_alloc(&op->dev, MAGICBOX_CF_MAXPORTS); ++ if (host == NULL) { ++ ret = -ENOMEM; ++ goto err_unmap_ctrl; ++ } ++ ++ host->private_data = info; ++ magicbox_cf_setup_port(host); ++ ++ ret = ata_host_activate(host, irq, ata_sff_interrupt, ++ IRQF_TRIGGER_RISING, &magicbox_cf_sht); ++ if (ret) ++ goto err_unmap_ctrl; ++ ++ dev_set_drvdata(&op->dev, host); ++ return 0; ++ ++ err_unmap_ctrl: ++ iounmap(info->ctrl); ++ err_unmap_base: ++ iounmap(info->base); ++ err_free_info: ++ kfree(info); ++ err_exit: ++ return ret; ++} ++ ++static int magicbox_cf_of_remove(struct platform_device *op) ++{ ++ struct ata_host *host = dev_get_drvdata(&op->dev); ++ struct magicbox_cf_info *info = host->private_data; ++ ++ ata_host_detach(host); ++ iounmap(info->ctrl); ++ iounmap(info->base); ++ kfree(info); ++ ++ return 0; ++} ++ ++static struct of_device_id magicbox_cf_of_match[] = { ++ { .compatible = "pata-magicbox-cf", }, ++ {}, ++}; ++ ++static struct platform_driver magicbox_cf_of_platform_driver = { ++ .probe = magicbox_cf_of_probe, ++ .remove = magicbox_cf_of_remove, ++ .driver = { ++ .name = DRV_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = magicbox_cf_of_match, ++ }, ++}; ++ ++static int __init magicbox_cf_init(void) ++{ ++ return platform_driver_register(&magicbox_cf_of_platform_driver); ++} ++ ++static void __exit magicbox_cf_exit(void) ++{ ++ platform_driver_unregister(&magicbox_cf_of_platform_driver); ++} ++ ++module_init(magicbox_cf_init); ++module_exit(magicbox_cf_exit); ++ ++MODULE_DESCRIPTION(DRV_DESC); ++MODULE_AUTHOR("Gabor Juhos "); ++MODULE_LICENSE("GPL v2"); ++MODULE_VERSION(DRV_VERSION); ++MODULE_DEVICE_TABLE(of, magicbox_cf_of_match); diff --git a/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch b/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch new file mode 100644 index 000000000..ab44a2d57 --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch @@ -0,0 +1,55 @@ +--- a/arch/powerpc/boot/dts/kilauea.dts ++++ b/arch/powerpc/boot/dts/kilauea.dts +@@ -102,8 +102,8 @@ + compatible = "ibm,sdram-405ex", "ibm,sdram-4xx-ddr2"; + dcr-reg = <0x010 0x002>; + interrupt-parent = <&UIC2>; +- interrupts = <0x5 0x4 /* ECC DED Error */ +- 0x6 0x4>; /* ECC SEC Error */ ++ interrupts = <0x5 0x4 /* ECC DED Error */ ++ 0x6 0x4>; /* ECC SEC Error */ + }; + + CRYPTO: crypto@ef700000 { +@@ -157,30 +157,30 @@ + reg = <0x00000000 0x00000000 0x04000000>; + #address-cells = <1>; + #size-cells = <1>; +- partition@0 { ++ partition0@0 { + label = "kernel"; + reg = <0x00000000 0x001e0000>; + }; +- partition@1e0000 { ++ partition1@1e0000 { + label = "dtb"; + reg = <0x001e0000 0x00020000>; + }; +- partition@200000 { +- label = "root"; +- reg = <0x00200000 0x00200000>; +- }; +- partition@400000 { +- label = "user"; +- reg = <0x00400000 0x03b60000>; ++ partition2@200000 { ++ label = "rootfs"; ++ reg = <0x00200000 0x03d60000>; + }; +- partition@3f60000 { ++ partition3@3f60000 { + label = "env"; + reg = <0x03f60000 0x00040000>; + }; +- partition@3fa0000 { ++ partition4@3fa0000 { + label = "u-boot"; + reg = <0x03fa0000 0x00060000>; + }; ++ partition5@0 { ++ label = "firmware"; ++ reg = <0x00000000 0x03f60000>; ++ }; + }; + + ndfc@1,0 { diff --git a/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch b/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch new file mode 100644 index 000000000..e7639d6b4 --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch @@ -0,0 +1,290 @@ +--- a/drivers/usb/host/isp116x-hcd.c ++++ b/drivers/usb/host/isp116x-hcd.c +@@ -1533,6 +1533,7 @@ static struct hc_driver isp116x_hc_drive + + /*----------------------------------------------------------------*/ + ++#ifdef CONFIG_USB_ISP116X_HCD_PLATFORM + static int isp116x_remove(struct platform_device *pdev) + { + struct usb_hcd *hcd = platform_get_drvdata(pdev); +@@ -1711,4 +1712,251 @@ static struct platform_driver isp116x_dr + }, + }; + +-module_platform_driver(isp116x_driver); ++static inline int isp116x_platform_register(void) ++{ ++ return platform_driver_register(&isp116x_driver); ++} ++ ++static inline void isp116x_platform_unregister(void) ++{ ++ platform_driver_unregister(&isp116x_driver); ++} ++#else ++static inline int isp116x_platform_register(void) { return 0; }; ++static void isp116x_platform_unregister(void) {}; ++#endif /* CONFIG_USB_ISP116X_PLATFORM */ ++ ++/*-----------------------------------------------------------------*/ ++ ++#ifdef CONFIG_USB_ISP116X_HCD_OF ++ ++/* TODO: rework platform probe instead of using a separate probe */ ++ ++#include ++ ++#ifdef USE_PLATFORM_DELAY ++static void isp116x_of_delay(struct device *ddev, int delay) ++{ ++ ndelay(delay); ++} ++#else ++#define isp116x_of_delay NULL ++#endif ++ ++static int isp116x_of_probe(struct platform_device *op) ++{ ++ struct device_node *dn = op->dev.of_node; ++ struct usb_hcd *hcd; ++ struct isp116x *isp116x; ++ struct resource addr, data; ++ struct isp116x_platform_data *board; ++ void __iomem *addr_reg; ++ void __iomem *data_reg; ++ int irq; ++ int ret = 0; ++ unsigned long irqflags; ++ ++ ret = of_address_to_resource(dn, 0, &data); ++ if (ret) ++ return ret; ++ ++ ret = of_address_to_resource(dn, 1, &addr); ++ if (ret) ++ return ret; ++ ++ board = kzalloc(sizeof(struct isp116x_platform_data), GFP_KERNEL); ++ if (board == NULL) ++ return -ENOMEM; ++ ++ if (!request_mem_region(addr.start, resource_size(&addr), hcd_name)) { ++ ret = -EBUSY; ++ goto err_free_board; ++ } ++ ++ addr_reg = ioremap_nocache(addr.start, resource_size(&addr)); ++ if (addr_reg == NULL) { ++ ret = -ENOMEM; ++ goto err_release_addr; ++ } ++ ++ if (!request_mem_region(data.start, resource_size(&data), hcd_name)) { ++ ret = -EBUSY; ++ goto err_unmap_addr; ++ } ++ ++ data_reg = ioremap_nocache(data.start, resource_size(&data)); ++ if (data_reg == NULL) { ++ ret = -ENOMEM; ++ goto err_release_data; ++ } ++ ++ irq = irq_of_parse_and_map(dn, 0); ++ if (irq == NO_IRQ) { ++ ret = -EINVAL; ++ goto err_unmap_data; ++ } ++ ++ /* allocate and initialize hcd */ ++ hcd = usb_create_hcd(&isp116x_hc_driver, &op->dev, dev_name(&op->dev)); ++ if (!hcd) { ++ ret = -ENOMEM; ++ goto err_irq_dispose; ++ } ++ ++ /* this rsrc_start is bogus */ ++ hcd->rsrc_start = addr.start; ++ isp116x = hcd_to_isp116x(hcd); ++ isp116x->data_reg = data_reg; ++ isp116x->addr_reg = addr_reg; ++ isp116x->board = board; ++ spin_lock_init(&isp116x->lock); ++ INIT_LIST_HEAD(&isp116x->async); ++ ++ board->delay = isp116x_of_delay; ++ if (of_get_property(dn, "sel15Kres", NULL)) ++ board->sel15Kres = 1; ++ if (of_get_property(dn, "oc_enable", NULL)) ++ board->oc_enable = 1; ++ if (of_get_property(dn, "remote_wakeup_enable", NULL)) ++ board->remote_wakeup_enable = 1; ++ ++ if (of_get_property(dn, "int_act_high", NULL)) ++ board->int_act_high = 1; ++ if (of_get_property(dn, "int_edge_triggered", NULL)) ++ board->int_edge_triggered = 1; ++ ++ if (board->int_edge_triggered) ++ irqflags = board->int_act_high ? IRQF_TRIGGER_RISING : ++ IRQF_TRIGGER_FALLING; ++ else ++ irqflags = board->int_act_high ? IRQF_TRIGGER_HIGH : ++ IRQF_TRIGGER_LOW; ++ ++ ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED); ++ if (ret) ++ goto err_put_hcd; ++ ++ ret = create_debug_file(isp116x); ++ if (ret) { ++ ERR("Couldn't create debugfs entry\n"); ++ goto err_remove_hcd; ++ } ++ ++ return 0; ++ ++ err_remove_hcd: ++ usb_remove_hcd(hcd); ++ err_put_hcd: ++ usb_put_hcd(hcd); ++ err_irq_dispose: ++ irq_dispose_mapping(irq); ++ err_unmap_data: ++ iounmap(data_reg); ++ err_release_data: ++ release_mem_region(data.start, resource_size(&data)); ++ err_unmap_addr: ++ iounmap(addr_reg); ++ err_release_addr: ++ release_mem_region(addr.start, resource_size(&addr)); ++ err_free_board: ++ kfree(board); ++ return ret; ++} ++ ++static int isp116x_of_remove(struct platform_device *op) ++{ ++ struct usb_hcd *hcd = dev_get_drvdata(&op->dev); ++ struct isp116x *isp116x; ++ struct resource res; ++ ++ if (!hcd) ++ return 0; ++ ++ dev_set_drvdata(&op->dev, NULL); ++ ++ isp116x = hcd_to_isp116x(hcd); ++ remove_debug_file(isp116x); ++ usb_remove_hcd(hcd); ++ ++ irq_dispose_mapping(hcd->irq); ++ ++ iounmap(isp116x->data_reg); ++ (void) of_address_to_resource(op->dev.of_node, 0, &res); ++ release_mem_region(res.start, resource_size(&res)); ++ ++ iounmap(isp116x->addr_reg); ++ (void) of_address_to_resource(op->dev.of_node, 1, &res); ++ release_mem_region(res.start, resource_size(&res)); ++ ++ kfree(isp116x->board); ++ usb_put_hcd(hcd); ++ ++ return 0; ++} ++ ++static struct of_device_id isp116x_of_match[] = { ++ { .compatible = "isp116x-hcd", }, ++ {}, ++}; ++ ++static struct platform_driver isp116x_of_platform_driver = { ++ .probe = isp116x_of_probe, ++ .remove = isp116x_of_remove, ++ .driver = { ++ .name = "isp116x-hcd-of", ++ .owner = THIS_MODULE, ++ .of_match_table = isp116x_of_match, ++ }, ++}; ++ ++static int __init isp116x_of_register(void) ++{ ++ return platform_driver_register(&isp116x_of_platform_driver); ++} ++ ++static void __exit isp116x_of_unregister(void) ++{ ++ platform_driver_unregister(&isp116x_of_platform_driver); ++} ++ ++MODULE_DEVICE_TABLE(of, isp116x_of_match); ++ ++#else ++static inline int isp116x_of_register(void) { return 0; }; ++static void isp116x_of_unregister(void) {}; ++#endif /* CONFIG_USB_ISP116X_HCD_OF */ ++ ++/*-----------------------------------------------------------------*/ ++ ++static int __init isp116x_init(void) ++{ ++ int ret; ++ ++ if (usb_disabled()) ++ return -ENODEV; ++ ++ INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); ++ ret = isp116x_platform_register(); ++ if (ret) ++ return ret; ++ ++ ret = isp116x_of_register(); ++ if (ret) ++ goto err_platform_unregister; ++ ++ return 0; ++ ++ err_platform_unregister: ++ isp116x_platform_unregister(); ++ return ret; ++} ++ ++module_init(isp116x_init); ++ ++static void __exit isp116x_cleanup(void) ++{ ++ isp116x_of_unregister(); ++ isp116x_platform_unregister(); ++} ++ ++module_exit(isp116x_cleanup); +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -327,6 +327,24 @@ config USB_ISP116X_HCD + To compile this driver as a module, choose M here: the + module will be called isp116x-hcd. + ++config USB_ISP116X_HCD_PLATFORM ++ bool "ISP116X support for controllers on platform bus" ++ depends on USB_ISP116X_HCD ++ default n if PPC_OF ++ default y ++ ---help--- ++ Enables support for the ISP116x USB controller present on the ++ platform bus. ++ ++config USB_ISP116X_HCD_OF ++ bool "ISP116X support for controllers on OF platform bus" ++ depends on USB_ISP116X_HCD && PPC_OF ++ default y if PPC_OF ++ default n ++ ---help--- ++ Enables support for the ISP116x USB controller present on the ++ OpenFirmware platform bus. ++ + config USB_ISP1760_HCD + tristate "ISP 1760 HCD support" + ---help--- diff --git a/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch b/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch new file mode 100644 index 000000000..4fb47181b --- /dev/null +++ b/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch @@ -0,0 +1,110 @@ +--- a/drivers/usb/host/isp116x.h ++++ b/drivers/usb/host/isp116x.h +@@ -354,21 +354,63 @@ struct isp116x_ep { + #define isp116x_check_platform_delay(h) 0 + #endif + ++#ifdef CONFIG_PPC ++static inline void isp116x_writew(u16 val, void __iomem *addr) ++{ ++ writew(cpu_to_le16(val), addr); ++} ++ ++static inline u16 isp116x_readw(void __iomem *addr) ++{ ++ return le16_to_cpu(readw(addr)); ++} ++ ++static inline void isp116x_raw_writew(u16 val, void __iomem *addr) ++{ ++ writew(cpu_to_le16(val), addr); ++} ++ ++static inline u16 isp116x_raw_readw(void __iomem *addr) ++{ ++ return le16_to_cpu(readw(addr)); ++} ++#else ++static inline void isp116x_writew(u16 val, void __iomem *addr) ++{ ++ writew(val, addr); ++} ++ ++static inline u16 isp116x_readw(void __iomem *addr) ++{ ++ return readw(addr); ++} ++ ++static inline void isp116x_raw_writew(u16 val, void __iomem *addr) ++{ ++ __raw_writew(val, addr); ++} ++ ++static inline u16 isp116x_raw_readw(void __iomem *addr) ++{ ++ return __raw_readw(addr); ++} ++#endif ++ + static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg) + { +- writew(reg & 0xff, isp116x->addr_reg); ++ isp116x_writew(reg & 0xff, isp116x->addr_reg); + isp116x_delay(isp116x, 300); + } + + static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val) + { +- writew(val, isp116x->data_reg); ++ isp116x_writew(val, isp116x->data_reg); + isp116x_delay(isp116x, 150); + } + + static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val) + { +- __raw_writew(val, isp116x->data_reg); ++ isp116x_raw_writew(val, isp116x->data_reg); + isp116x_delay(isp116x, 150); + } + +@@ -376,7 +418,7 @@ static inline u16 isp116x_read_data16(st + { + u16 val; + +- val = readw(isp116x->data_reg); ++ val = isp116x_readw(isp116x->data_reg); + isp116x_delay(isp116x, 150); + return val; + } +@@ -385,16 +427,16 @@ static inline u16 isp116x_raw_read_data1 + { + u16 val; + +- val = __raw_readw(isp116x->data_reg); ++ val = isp116x_raw_readw(isp116x->data_reg); + isp116x_delay(isp116x, 150); + return val; + } + + static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val) + { +- writew(val & 0xffff, isp116x->data_reg); ++ isp116x_writew(val & 0xffff, isp116x->data_reg); + isp116x_delay(isp116x, 150); +- writew(val >> 16, isp116x->data_reg); ++ isp116x_writew(val >> 16, isp116x->data_reg); + isp116x_delay(isp116x, 150); + } + +@@ -402,9 +444,9 @@ static inline u32 isp116x_read_data32(st + { + u32 val; + +- val = (u32) readw(isp116x->data_reg); ++ val = (u32) isp116x_readw(isp116x->data_reg); + isp116x_delay(isp116x, 150); +- val |= ((u32) readw(isp116x->data_reg)) << 16; ++ val |= ((u32) isp116x_readw(isp116x->data_reg)) << 16; + isp116x_delay(isp116x, 150); + return val; + } diff --git a/target/linux/ppc44x/Makefile b/target/linux/ppc44x/Makefile new file mode 100644 index 000000000..52772e4a8 --- /dev/null +++ b/target/linux/ppc44x/Makefile @@ -0,0 +1,26 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=powerpc +BOARD:=ppc44x +BOARDNAME:=AMCC/IBM PPC44x +FEATURES:=squashfs small_flash broken +CPU_TYPE:=440 +MAINTAINER:=Imre Kaloz + +KERNEL_PATCHVER:=3.18 + +define Target/Description + Build firmware images for AMCC/IBM PPC44x based boards. +endef + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:=uImage cuImage.taishan + +$(eval $(call BuildTarget)) diff --git a/target/linux/ppc44x/base-files/etc/inittab b/target/linux/ppc44x/base-files/etc/inittab new file mode 100644 index 000000000..c929c3dea --- /dev/null +++ b/target/linux/ppc44x/base-files/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +ttyS0::askfirst:/usr/libexec/login.sh +ttyS1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/ppc44x/config-3.18 b/target/linux/ppc44x/config-3.18 new file mode 100644 index 000000000..48880b667 --- /dev/null +++ b/target/linux/ppc44x/config-3.18 @@ -0,0 +1,250 @@ +# CONFIG_40x is not set +CONFIG_440GX=y +CONFIG_44x=y +CONFIG_460EX=y +CONFIG_4xx=y +CONFIG_4xx_SOC=y +# CONFIG_ADVANCED_OPTIONS is not set +# CONFIG_ARCHES is not set +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAS_ILOG2_U32=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAS_WALK_MEMORY=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +# CONFIG_ARCH_RANDOM is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_AUDIT_ARCH=y +# CONFIG_BAMBOO is not set +# CONFIG_BLUESTONE is not set +CONFIG_BOOKE=y +CONFIG_BOOKE_WDT=y +CONFIG_BOUNCE=y +CONFIG_CANYONLANDS=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" +CONFIG_CMDLINE_BOOL=y +CONFIG_CONSISTENT_SIZE=0x00200000 +CONFIG_CPU_BIG_ENDIAN=y +# CONFIG_CPU_LITTLE_ENDIAN is not set +# CONFIG_CRYPTO_SHA1_PPC is not set +# CONFIG_DEFAULT_UIMAGE is not set +CONFIG_DTC=y +# CONFIG_E200 is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_EBONY is not set +# CONFIG_EIGER is not set +# CONFIG_EPAPR_BOOT is not set +CONFIG_EXTRA_TARGETS="uImage" +# CONFIG_FSL_ULI1575 is not set +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CSUM is not set +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_NVRAM=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +# CONFIG_GENERIC_TBSYNC is not set +CONFIG_GENERIC_TIME_VSYSCALL_OLD=y +# CONFIG_GEN_RTC is not set +# CONFIG_GE_FPGA is not set +# CONFIG_GLACIER is not set +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAS_RAPIDIO is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_HZ_PERIODIC=y +CONFIG_IBM_EMAC=y +CONFIG_IBM_EMAC_EMAC4=y +CONFIG_IBM_EMAC_POLL_WEIGHT=32 +CONFIG_IBM_EMAC_RGMII=y +CONFIG_IBM_EMAC_RXB=128 +CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256 +CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0 +CONFIG_IBM_EMAC_TAH=y +CONFIG_IBM_EMAC_TXB=128 +CONFIG_IBM_EMAC_ZMII=y +# CONFIG_ICON is not set +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_IOMMU_HELPER is not set +# CONFIG_IPIC is not set +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_ISA_DMA_API=y +# CONFIG_KATMAI is not set +CONFIG_KERNEL_START=0xc0000000 +CONFIG_LIBFDT=y +CONFIG_LOWMEM_SIZE=0x30000000 +# CONFIG_MATH_EMULATION is not set +# CONFIG_MMIO_NVRAM is not set +CONFIG_MODULES_USE_ELF_RELA=y +# CONFIG_MPIC is not set +# CONFIG_MPIC_U3_HT_IRQS is not set +# CONFIG_MPIC_WEIRD is not set +CONFIG_MTD_CFI_ADV_OPTIONS=y +# CONFIG_MTD_CFI_GEOMETRY is not set +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_NEED_DMA_MAP_STATE=y +# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NEED_SG_DMA_LENGTH=y +# CONFIG_NONSTATIC_KERNEL is not set +CONFIG_NOT_COHERENT_CACHE=y +CONFIG_NR_IRQS=512 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xc0000000 +CONFIG_PCI=y +CONFIG_PCIEAER=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_MSI=y +CONFIG_PHYSICAL_START=0x00000000 +CONFIG_PHYS_64BIT=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PPC=y +CONFIG_PPC32=y +CONFIG_PPC44x_SIMPLE=y +# CONFIG_PPC4xx_HSTA_MSI is not set +CONFIG_PPC4xx_MSI=y +# CONFIG_PPC4xx_OCM is not set +CONFIG_PPC4xx_PCI_EXPRESS=y +# CONFIG_PPC64 is not set +# CONFIG_PPC_47x is not set +# CONFIG_PPC_85xx is not set +# CONFIG_PPC_8xx is not set +# CONFIG_PPC_970_NAP is not set +CONFIG_PPC_ADV_DEBUG_DACS=2 +CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y +CONFIG_PPC_ADV_DEBUG_DVCS=2 +CONFIG_PPC_ADV_DEBUG_IACS=4 +CONFIG_PPC_ADV_DEBUG_REGS=y +# CONFIG_PPC_BOOK3S_32 is not set +# CONFIG_PPC_CELL is not set +# CONFIG_PPC_CELL_NATIVE is not set +# CONFIG_PPC_COPRO_BASE is not set +CONFIG_PPC_DCR=y +# CONFIG_PPC_DCR_MMIO is not set +CONFIG_PPC_DCR_NATIVE=y +# CONFIG_PPC_DOORBELL is not set +# CONFIG_PPC_EARLY_DEBUG is not set +# CONFIG_PPC_EPAPR_HV_PIC is not set +CONFIG_PPC_FPU=y +# CONFIG_PPC_I8259 is not set +# CONFIG_PPC_ICP_HV is not set +# CONFIG_PPC_ICP_NATIVE is not set +# CONFIG_PPC_ICS_RTAS is not set +CONFIG_PPC_INDIRECT_PCI=y +CONFIG_PPC_MMU_NOHASH=y +# CONFIG_PPC_MM_SLICES is not set +# CONFIG_PPC_MPC106 is not set +CONFIG_PPC_MSI_BITMAP=y +CONFIG_PPC_OF=y +# CONFIG_PPC_P7_NAP is not set +CONFIG_PPC_PCI_CHOICE=y +# CONFIG_PPC_RTAS is not set +CONFIG_PPC_UDBG_16550=y +CONFIG_PPC_WERROR=y +# CONFIG_PPC_XICS is not set +# CONFIG_PQ2ADS is not set +# CONFIG_PREEMPT_RCU is not set +CONFIG_PTE_64BIT=y +# CONFIG_RAINIER is not set +CONFIG_RAS=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SAM440EP is not set +CONFIG_SCHED_HRTICK=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SEQUOIA is not set +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SPARSE_IRQ=y +# CONFIG_SWIOTLB is not set +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_TAISHAN=y +CONFIG_TASK_SIZE=0xc0000000 +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB_SUPPORT=y +# CONFIG_WARP is not set +CONFIG_WORD_SIZE=32 +# CONFIG_XILINX_SYSACE is not set +# CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_POWERPC=y +# CONFIG_YOSEMITE is not set diff --git a/target/linux/ppc44x/image/Makefile b/target/linux/ppc44x/image/Makefile new file mode 100644 index 000000000..e2303f6e7 --- /dev/null +++ b/target/linux/ppc44x/image/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +JFFS2_BLOCKSIZE=256k + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + + +define Image/Prepare + $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/canyonlands.dts > $(KDIR)/openwrt-canyonlands.dtb +endef + +define Image/BuildKernel + cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage +endef + +define Image/Build + $(call Image/Build/$(1),$(1)) +endef + +define Image/Build/jffs2-256k + ( \ + dd if=$(KDIR)/uImage bs=2048k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-jffs2.img +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) + ( \ + dd if=$(KDIR)/cuImage.taishan bs=256k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-taishan-$(1).img + ( \ + dd if=$(KDIR)/uImage bs=1920k conv=sync; \ + dd if=$(KDIR)/openwrt-canyonlands.dtb bs=128k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ + ) > $(BIN_DIR)/$(IMG_PREFIX)-canyonlands-$(1).img +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch b/target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch new file mode 100644 index 000000000..09b6523dc --- /dev/null +++ b/target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch @@ -0,0 +1,46 @@ +From 1eb8a1b340e2f0a562b4987683bbaee4d620bf0a Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Mon, 9 Mar 2015 13:35:39 -0700 +Subject: [PATCH] crypto: amcc - remove incorrect __init/__exit markups + +Even if bus is not hot-pluggable, the devices can be bound and unbound +from the driver via sysfs, so we should not be using __init/__exit +annotations on probe() and remove() methods. The only exception is +drivers registered with platform_driver_probe() which specifically +disables sysfs bind/unbind attributes. + +Signed-off-by: Dmitry Torokhov +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -1155,7 +1155,7 @@ struct crypto4xx_alg_common crypto4xx_al + /** + * Module Initialization Routine + */ +-static int __init crypto4xx_probe(struct platform_device *ofdev) ++static int crypto4xx_probe(struct platform_device *ofdev) + { + int rc; + struct resource res; +@@ -1263,7 +1263,7 @@ err_alloc_dev: + return rc; + } + +-static int __exit crypto4xx_remove(struct platform_device *ofdev) ++static int crypto4xx_remove(struct platform_device *ofdev) + { + struct device *dev = &ofdev->dev; + struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev); +@@ -1292,7 +1292,7 @@ static struct platform_driver crypto4xx_ + .of_match_table = crypto4xx_match, + }, + .probe = crypto4xx_probe, +- .remove = __exit_p(crypto4xx_remove), ++ .remove = crypto4xx_remove, + }; + + module_platform_driver(crypto4xx_driver); diff --git a/target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch b/target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch new file mode 100644 index 000000000..5a0295ea7 --- /dev/null +++ b/target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch @@ -0,0 +1,55 @@ +--- a/arch/powerpc/boot/dts/taishan.dts ++++ b/arch/powerpc/boot/dts/taishan.dts +@@ -194,16 +194,12 @@ + #address-cells = <1>; + #size-cells = <1>; + partition@0 { +- label = "kernel"; +- reg = <0x0 0x180000>; ++ label = "firmware"; ++ reg = <0x0 0x3e00000>; + }; +- partition@180000 { +- label = "root"; +- reg = <0x180000 0x200000>; +- }; +- partition@380000 { +- label = "user"; +- reg = <0x380000 0x3bc0000>; ++ partition@3e00000 { ++ label = "diagnostics"; ++ reg = <0x3e00000 0x140000>; + }; + partition@3f40000 { + label = "env"; +--- a/arch/powerpc/boot/dts/canyonlands.dts ++++ b/arch/powerpc/boot/dts/canyonlands.dts +@@ -222,24 +222,12 @@ + #address-cells = <1>; + #size-cells = <1>; + partition@0 { +- label = "kernel"; +- reg = <0x00000000 0x001e0000>; +- }; +- partition@1e0000 { +- label = "dtb"; +- reg = <0x001e0000 0x00020000>; ++ label = "kernel+dtb"; ++ reg = <0x00000000 0x00200000>; + }; + partition@200000 { +- label = "ramdisk"; +- reg = <0x00200000 0x01400000>; +- }; +- partition@1600000 { +- label = "jffs2"; +- reg = <0x01600000 0x00400000>; +- }; +- partition@1a00000 { +- label = "user"; +- reg = <0x01a00000 0x02560000>; ++ label = "rootfs"; ++ reg = <0x00200000 0x03d60000>; + }; + partition@3f60000 { + label = "env"; diff --git a/target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch b/target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch new file mode 100644 index 000000000..bcf18718e --- /dev/null +++ b/target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch @@ -0,0 +1,9 @@ +--- a/arch/powerpc/boot/dts/taishan.dts ++++ b/arch/powerpc/boot/dts/taishan.dts +@@ -419,5 +419,6 @@ + + chosen { + linux,stdout-path = "/plb/opb/serial@40000300"; ++ bootargs = "rootfstype=squashfs noinitrd"; + }; + }; diff --git a/target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch b/target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch new file mode 100644 index 000000000..313347cea --- /dev/null +++ b/target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch @@ -0,0 +1,45 @@ +From: Jo-Philipp Wich +Date: Wed, 4 Jan 2017 10:35:00 +0100 +Subject: [PATCH] powerpc: boot: fix build with parallel make + +The powerpc boot wrapper Makefile is not parallel build safe, causing fixdep +to fail reading dependency files of the addnote, hack-coff and mktree +utilities when concurrently building different image targets. + +A typical failure looks like: + + Building modules, stage 2. + HOSTCC arch/powerpc/boot/addnote + HOSTCC arch/powerpc/boot/hack-coff + DTC arch/powerpc/boot/taishan.dtb + HOSTCC arch/powerpc/boot/addnote + HOSTCC arch/powerpc/boot/hack-coff + MODPOST 800 modules + fixdep: error opening depfile: arch/powerpc/boot/.hack-coff.d: No such file or directory + scripts/Makefile.host:91: recipe for target 'arch/powerpc/boot/hack-coff' failed + make[5]: *** [arch/powerpc/boot/hack-coff] Error 2 + make[5]: *** Waiting for unfinished jobs.... + fixdep: error opening depfile: arch/powerpc/boot/.addnote.d: No such file or directory + scripts/Makefile.host:91: recipe for target 'arch/powerpc/boot/addnote' failed + make[5]: *** [arch/powerpc/boot/addnote] Error 2 + rm arch/powerpc/boot/taishan.dtb + arch/powerpc/Makefile:263: recipe for target 'cuImage.taishan' failed + make[4]: *** [cuImage.taishan] Error 2 + make[4]: *** Waiting for unfinished jobs.... + +Add a GNU make specific .NOTPARALLEL pseudo rule to enforce sequential building +of the addnote, hack-coff and mktree executables. + +Signed-off-by: Jo-Philipp Wich + +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -194,6 +194,8 @@ wrapper :=$(srctree)/$(src)/wrapper + wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ + $(wrapper) FORCE + ++.NOTPARALLEL: $(addprefix $(obj)/,addnote hack-coff mktree) $(wrapper) ++ + ############# + # Bits for building various flavours of zImage + diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds index 54504c6ee..293e91ea2 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -44,10 +44,6 @@ br-6475nd|\ mzk-w300nh2) set_wifi_led "$boardname:amber:wlan" ;; -a5-v11|\ -cs-qr10) - ucidef_set_led_default "power" "POWER" "$boardname:red:power" "1" - ;; ai-br100) ucidef_set_led_netdev "wan" "wan" "$boardname:blue:wan" "eth0.2" set_wifi_led "$boardname:blue:wlan" @@ -78,7 +74,6 @@ awapn2403) ;; asl26555-8M|\ asl26555-16M) - ucidef_set_led_default "power" "POWER" "asl26555:green:power" "1" ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0" set_wifi_led "asl26555:green:wlan" set_usb_led "asl26555:green:3g" @@ -116,28 +111,18 @@ cy-swr1100) set_usb_led "$boardname:blue:usb" ;; d105) - ucidef_set_led_default "power" "POWER" "$boardname:red:power" "1" set_usb_led "$boardname:green:usb" ;; d240) set_wifi_led "$boardname:blue:wifi" set_usb_led "$boardname:blue:usb" ;; -db-wrt01) - ucidef_set_led_default "power" "power" "$boardname:orange:power" "1" - ;; -dch-m225) - ucidef_set_led_default "power" "POWER" "$board:geeen:power" "1" - ucidef_set_led_default "status" "STATUS" "$board:red:status" "0" - ;; dcs-930l-b1) - ucidef_set_led_default "power" "POWER" "$boardname:red:power" "1" ucidef_set_led_netdev "wifi" "WiFi" "$boardname:blue:wps" ;; dir-300-b1|\ dir-600-b1|\ dir-620-a1) - ucidef_set_led_default "wan" "WAN LED (amber)" "$boardname:amber:wan" "1" set_wifi_led "rt2800pci-phy0::radio" ;; dir-300-b7|\ @@ -154,7 +139,6 @@ wt1520-8M) ;; dir-615-d|\ dir-615-h1) - ucidef_set_led_default "status" "Status LED (amber)" "$boardname:amber:status" "0" set_wifi_led "rt2800pci-phy0::radio" ;; dir-620-d1|\ @@ -162,22 +146,25 @@ dlink,dwr-116-a1|\ mzk-ex300np) set_wifi_led "$boardname:green:wifi" ;; +dlink,dwr-118-a2) + ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0e" + ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" + set_wifi_led "$boardname:green:wlan2g" "wlan1" + set_usb_led "$boardname:green:usb" + ucidef_set_led_default "internet" "internet" "$boardname:green:internet" "0" + ;; dlink,dwr-921-c1) set_wifi_led "$boardname:green:wifi" ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0f" ucidef_set_led_default "sigstrength" "Signal Strength" "$boardname:green:sigstrength" "0" ;; -dir-810l|\ -elecom,wrc-1167ghbk2-s|\ -iodata,wn-gx300gr|\ -mzk-750dhp|\ -mzk-dp150n|\ -vr500) - ucidef_set_led_default "power" "power" "$boardname:green:power" "1" - ;; dir-860l-b1) ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "eth0.2" ;; +edimax,br-6478ac-v2) + set_wifi_led "$boardname:blue:wlan" + set_usb_led "$boardname:blue:usb" + ;; ex2700|\ wn3000rpv3) set_wifi_led "$boardname:green:router" @@ -213,30 +200,28 @@ gl-mt300n-v2) ;; hc5661|\ hc5661a) - ucidef_set_led_default "system" "system" "$boardname:blue:system" "1" ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "eth0.2" set_wifi_led "$boardname:blue:wlan2g" ;; hc5761) - ucidef_set_led_default "system" "system" "$boardname:blue:system" "1" ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "eth0.2" set_wifi_led "$boardname:blue:wlan2g" ucidef_set_led_netdev "wifi5g" "wifi5g" "$boardname:blue:wlan5g" "rai0" ;; hc5861) - ucidef_set_led_default "system" "system" "$boardname:blue:system" "1" ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "eth0.2" set_wifi_led "$boardname:blue:wlan2g" ucidef_set_led_netdev "wifi5g" "wifi5g" "$boardname:blue:wlan5g" "rai0" - ucidef_set_led_default "turbo" "turbo" "$boardname:blue:turbo" "0" ;; hg255d) set_wifi_led "$boardname:green:wlan" set_usb_led "$boardname:green:usb" ucidef_set_led_netdev "internet" "internet" "$boardname:green:internet" "eth0.2" ;; +hiwifi,hc5861b) + set_wifi_led "$boardname:green:wlan2g" + ;; hpm) - ucidef_set_led_default "power" "POWER" "$boardname:orange:power" "1" ucidef_set_led_netdev "eth" "ETH" "$boardname:green:eth" "eth0" set_wifi_led "$boardname:green:wifi" ;; @@ -244,6 +229,10 @@ ht-tm02) ucidef_set_led_netdev "eth" "Ethernet" "$boardname:green:lan" "eth0" set_wifi_led "$boardname:blue:wlan" ;; +kimax,u35wf) + set_wifi_led "$boardname:blue:wifi" + ucidef_set_led_netdev "eth" "ETH" "$boardname:green:eth" "eth0" + ;; kn|\ nbg-419n2) set_usb_led "$boardname:green:usb" @@ -262,6 +251,14 @@ m2m) set_wifi_led "$boardname:blue:wifi" ucidef_set_led_netdev "eth" "Ethernet" "$boardname:green:wan" "eth0" ;; +mikrotik,rbm11g) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:green:rssi0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:green:rssi1" "wlan0" "20" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssi2" "wlan0" "40" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssi3" "wlan0" "60" "100" + ucidef_set_led_rssi "rssiveryhigh" "RSSIVERYHIGH" "$boardname:green:rssi4" "wlan0" "80" "100" + ;; miniembplug) set_wifi_led "$boardname:red:wlan" set_usb_led "$boardname:green:mobile" @@ -271,13 +268,9 @@ mir3g) ucidef_set_led_switch "lan1-amber" "LAN1 (amber)" "$boardname:amber:lan1" "switch0" "0x08" "0x08" ucidef_set_led_switch "lan2-amber" "LAN2 (amber)" "$boardname:amber:lan2" "switch0" "0x04" "0x08" ;; -miwifi-mini) - ucidef_set_led_default "power" "power" "$boardname:red:status" "1" - ;; mlw221|\ mlwg2) set_wifi_led "$boardname:blue:wifi" - ucidef_set_led_default "system" "system" "$boardname:blue:system" "1" ;; mpr-a1|\ mpr-a2) @@ -288,26 +281,25 @@ mr-102n) set_usb_led "$boardname:green:usb" ;; mr200) - ucidef_set_led_default "power" "power" "$boardname:white:power" "1" ucidef_set_led_netdev "lan" "lan" "$boardname:white:lan" "eth0.1" ucidef_set_led_netdev "wan" "wan" "$boardname:white:wan" "usb0" set_wifi_led "$boardname:white:wlan" ;; mzk-ex750np) - ucidef_set_led_default "power" "power" "$boardname:red:power" "1" set_wifi_led "$boardname:red:wifi" ;; na930) set_usb_led "$boardname:blue:status" ;; -newifi-d1) - set_usb_led "$boardname:red:status" +netgear,r6120) + ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0f" + ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WiFi 5GHz" "$boardname:green:wlan5g" "phy1tpt" ;; nw718) set_usb_led "$boardname:amber:usb" ;; oy-0001) - ucidef_set_led_default "power" "power" "$boardname:green:power" "1" set_wifi_led "$boardname:green:wifi" ;; pbr-d1) @@ -315,8 +307,6 @@ pbr-d1) ;; pbr-m1) ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "eth0.2" - ucidef_set_led_default "power" "power" "$boardname:blue:power" "1" - ucidef_set_led_default "sys" "sys" "$boardname:blue:sys" "1" ;; d-team,newifi-d2) set_usb_led "$boardname:blue:usb" @@ -327,11 +317,6 @@ d-team,newifi-d2) psg1208) set_wifi_led "$boardname:white:wlan2g" ;; -psg1218a|\ -psg1218b) - ucidef_set_led_netdev "Network" "Network" "$boardname:blue:status" "eth0" - ucidef_set_led_default "status" "STATUS" "$boardname:yellow:status" "0" - ;; px-4885-4M|\ px-4885-8M) set_wifi_led "px-4885:orange:wifi" @@ -348,10 +333,6 @@ re350-v1) ucidef_set_led_netdev "eth_act" "LAN act" "$boardname:green:eth_act" "eth0" "tx rx" ucidef_set_led_switch "eth_link" "LAN link" "$boardname:green:eth_link" "switch0" "0x01" ;; -re6500) - ucidef_set_led_default "power" "power" "$boardname:white:power" "1" - ucidef_set_led_default "wifi" "wifi" "$boardname:orange:wifi" "1" - ;; rp-n53) ucidef_set_led_netdev "eth" "Network" "$boardname:white:back" "eth0" set_wifi_led "$boardname:blue:wifi" @@ -361,13 +342,11 @@ rt-ac51u) set_usb_led "$boardname:blue:usb" "1-1" ;; rt-n12p) - ucidef_set_led_default "power" "power" "$board:green:power" "1" - ucidef_set_led_netdev "lan" "lan" "$board:green:lan" eth0.1 - ucidef_set_led_netdev "wan" "wan" "$board:green:wan" eth0.2 - set_wifi_led "$board:green:air" + ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" eth0.1 + ucidef_set_led_netdev "wan" "wan" "$boardname:green:wan" eth0.2 + set_wifi_led "$boardname:green:air" ;; rt-n14u) - ucidef_set_led_default "power" "power" "$boardname:blue:power" "1" ucidef_set_led_netdev "lan" "lan" "$boardname:blue:lan" eth0.1 ucidef_set_led_netdev "wan" "wan" "$boardname:blue:wan" eth0.2 set_wifi_led "$boardname:blue:air" @@ -398,6 +377,12 @@ tl-wr841n-v13) ucidef_set_led_switch "lan4" "lan4" "$boardname:green:lan4" "switch0" "0x10" ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" ;; +tplink,c2-v1) + ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch1" "0x1e" + ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch1" "0x01" + set_usb_led "$boardname:green:usb" "2-1" + set_wifi_led "$boardname:green:wlan" + ;; tplink,c20-v1) ucidef_set_led_switch "lan" "lan" "$boardname:blue:lan" "switch0" "0x1e" ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x01" @@ -415,6 +400,15 @@ tplink,c50-v3) ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan2g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "wlan5g" "$boardname:green:wlan5g" "phy1tpt" ;; +tplink,tl-wa801nd-v5) + ucidef_set_led_wlan "wlan" "wlan" "$boardname:green:wlan" "phy0tpt" + ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" "eth0" + ;; +tplink,tl-mr3020-v3) + set_usb_led "$boardname:green:3g" + set_wifi_led "$boardname:green:wlan" + ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" + ;; tplink,tl-mr3420-v5|\ tplink,tl-wr842n-v5) set_usb_led "$boardname:green:usb" @@ -463,12 +457,6 @@ we1026-5g-16m) set_wifi_led "we1026-5g:green:wifi" set_usb_led "we1026-5g:green:usb" "1-1.1" ;; -whr-1166d|\ -whr-300hp2|\ -whr-600d) - ucidef_set_led_default "power" "power" "$boardname:green:power" "1" - ucidef_set_led_default "router" "router" "$boardname:green:router" "1" - ;; wl-wn575a3) ucidef_set_rssimon "wlan1" "200000" "1" ucidef_set_led_rssi "wifi-low" "wifi-low" "$boardname:green:wifi-low" "wlan1" "1" "49" @@ -479,13 +467,6 @@ wrh-300cr) set_wifi_led "$boardname:green:wlan" ucidef_set_led_netdev "lan" "lan" "$boardname:green:ethernet" "eth0" ;; -wndr3700v5) - ucidef_set_led_default "power" "POWER" "$boardname:green:power" "0" - ;; -wt3020-4M|\ -wt3020-8M) - ucidef_set_led_default "power" "power" "wt3020:blue:power" "0" - ;; y1) set_usb_led "$boardname:blue:usb" ucidef_set_led_netdev "wifi" "WIFI" "$boardname:blue:wifi" "wlan1" @@ -512,7 +493,6 @@ zbt-cpe102) ucidef_set_led_default "power" "power" "$boardname:green:4g-0" "0" ;; zbt-wa05) - ucidef_set_led_default "power" "power" "$boardname:blue:power" "1" set_wifi_led "$boardname:blue:air" set_usb_led "$boardname:blue:usb" ;; @@ -531,7 +511,6 @@ zbtlink,zbt-we1226) ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x10" ;; zbt-wr8305rt) - ucidef_set_led_default "power" "power" "$boardname:green:sys" "1" set_usb_led "$boardname:green:usb" set_wifi_led "$boardname:green:wifi" ;; @@ -541,6 +520,11 @@ zorlik,zl5900v2) zte-q7) set_wifi_led "$boardname:blue:status" ;; +zyxel,keenetic-extra-ii) + set_wifi_led "$boardname:green:wifi" + set_usb_led "$boardname:green:usb" + ucidef_set_led_switch "internet" "internet" "$boardname:green:internet" "switch0" "0x01" + ;; youku-yk1) set_wifi_led "$boardname:blue:air" set_usb_led "$boardname:blue:usb" diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network index 76b6fe9f5..9e9ecbcb5 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -49,14 +49,17 @@ ramips_setup_interfaces() dcs-930|\ dcs-930l-b1|\ ht-tm02|\ + kimax,u35wf|\ linkits7688 | \ m2m|\ microwrt|\ + mikrotik,rbm11g|\ mpr-a2|\ ncs601w|\ omega2 | \ omega2p | \ timecloud|\ + tplink,tl-wa801nd-v5|\ w150m|\ widora,neo-16m|\ widora,neo-32m|\ @@ -82,6 +85,7 @@ ramips_setup_interfaces() dir-320-b1|\ dir-610-a1|\ dir-615-h1|\ + dir-810l|\ dlink,dwr-116-a1|\ dlink,dwr-921-c1|\ ew1200|\ @@ -100,6 +104,7 @@ ramips_setup_interfaces() mzk-750dhp|\ mzk-w300nh2|\ d-team,newifi-d2|\ + netgear,r6120|\ nixcore-x1-8M|\ nixcore-x1-16M|\ oy-0001|\ @@ -145,6 +150,7 @@ ramips_setup_interfaces() pbr-d1|\ ravpower,wd03|\ tama,w06|\ + tplink,tl-mr3020-v3|\ u25awf-h1|\ wli-tx4-ag300n|\ wmdr-143n|\ @@ -153,6 +159,10 @@ ramips_setup_interfaces() wrh-300cr) ucidef_set_interface_lan "eth0" ;; + dlink,dwr-118-a2) + ucidef_add_switch "switch0" \ + "1:lan:2" "2:lan:1" "3:lan:3" "4:lan" "0:wan" "6@eth0" + ;; mir3g) ucidef_add_switch "switch0" \ "2:lan:2" "3:lan:1" "1:wan" "6t@eth0" @@ -195,6 +205,7 @@ ramips_setup_interfaces() gl-mt300n|\ gl-mt750|\ hg255d|\ + hiwifi,hc5861b|\ jhr-n805r|\ jhr-n825r|\ jhr-n926r|\ @@ -217,7 +228,8 @@ ramips_setup_interfaces() wrtnode2p | \ wrtnode2r | \ youhua,wr1200js|\ - zbt-wa05) + zbt-wa05|\ + zyxel,keenetic-extra-ii) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" ;; @@ -228,6 +240,9 @@ ramips_setup_interfaces() ;; dir-860l-b1|\ elecom,wrc-1167ghbk2-s|\ + elecom,wrc-2533gst|\ + elecom,wrc-1900gst|\ + iodata,wn-ax1167gr|\ iodata,wn-gx300gr) ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0" @@ -276,6 +291,11 @@ ramips_setup_interfaces() ucidef_add_switch "switch1" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; + edimax,br-6478ac-v2|\ + tplink,c2-v1) + ucidef_add_switch "switch1" \ + "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" + ;; hc5*61|\ y1s) ucidef_add_switch "switch0" \ @@ -372,7 +392,7 @@ ramips_setup_interfaces() ;; wizfi630a) ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "0:wan" "6@eth0" + "0:lan" "1:lan" "2:wan" "6@eth0" ;; wt3020-4M|\ wt3020-8M) @@ -449,6 +469,7 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii factory wanmac) ;; dlink,dwr-116-a1|\ + dlink,dwr-118-a2|\ dlink,dwr-921-c1) wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) lan_mac=$(macaddr_add "$wan_mac" 1) @@ -456,7 +477,13 @@ ramips_setup_macs() e1700) wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR) ;; + edimax,br-6478ac-v2) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(macaddr_add "$lan_mac" 2) + ;; elecom,wrc-1167ghbk2-s|\ + elecom,wrc-2533gst|\ + elecom,wrc-1900gst|\ sk-wb8) wan_mac=$(mtd_get_mac_binary factory 57350) ;; @@ -466,11 +493,13 @@ ramips_setup_macs() ;; hc5*61|\ hc5661a|\ - hc5962) + hc5962|\ + hiwifi,hc5861b) lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "` [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 1) ;; + iodata,wn-ax1167gr|\ iodata,wn-gx300gr) wan_mac=$(macaddr_add "$(mtd_get_mac_binary Factory 4)" 1) ;; diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 2f51add33..d4318b61a 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -1,354 +1,11 @@ #!/bin/sh # Copyright (C) 2010-2013 OpenWrt.org -. /lib/functions.sh . /lib/functions/leds.sh -get_status_led() { - board=$(board_name) - boardname="${board##*,}" - - case $board in - 3g150b|\ - 3g300m|\ - w150m) - status_led="$boardname:blue:ap" - ;; - 3g-6200n|\ - ar670w|\ - ar725w|\ - br-6475nd|\ - c50|\ - dch-m225|\ - dir-860l-b1|\ - e1700|\ - elecom,wrc-1167ghbk2-s|\ - ex2700|\ - ex3700|\ - fonera20n|\ - firewrt|\ - hg255d|\ - iodata,wn-gx300gr|\ - kn|\ - kn_rc|\ - kn_rf|\ - kng_rc|\ - mzk-750dhp|\ - mzk-dp150n|\ - mzk-w300nh2|\ - nbg-419n|\ - nbg-419n2|\ - pwh2004|\ - r6220|\ - tplink,c20-v4|\ - tplink,c50-v3|\ - tplink,tl-mr3420-v5|\ - tplink,tl-wr842n-v5|\ - tplink,tl-wr902ac-v3|\ - tl-wr840n-v4|\ - tl-wr840n-v5|\ - tl-wr841n-v13|\ - vr500|\ - wnce2001|\ - wndr3700v5|\ - x5|\ - x8|\ - xdxrn502j|\ - wn3000rpv3) - status_led="$boardname:green:power" - ;; - 3g-6200nl) - status_led="$boardname:green:internet" - ;; - a5-v11|\ - cs-qr10|\ - d105|\ - dcs-930l-b1|\ - hlk-rm04|\ - jhr-n825r|\ - mpr-a1|\ - mpr-a2|\ - mzk-ex750np) - status_led="$boardname:red:power" - ;; - ai-br100|\ - ht-tm02) - status_led="$boardname:blue:wlan" - ;; - alfa-network,ac1200rm|\ - awapn2403|\ - dir-645|\ - sk-wb8|\ - wrh-300cr) - status_led="$boardname:green:wps" - ;; - alfa-network,awusfree1) - status_led="$boardname:orange:system" - ;; - all0239-3g|\ - dcs-930|\ - dir-300-b1|\ - dir-300-b7|\ - dir-320-b1|\ - dir-600-b1|\ - dir-610-a1|\ - dir-615-d|\ - dir-615-h1|\ - dir-620-a1|\ - dir-620-d1|\ - dwr-512-b|\ - dlink,dwr-116-a1|\ - gnubee,gb-pc1|\ - gnubee,gb-pc2|\ - hpm|\ - hw550-3g|\ - mac1200rv2|\ - miniembwifi|\ - mofi3500-3gn|\ - rut5xx|\ - v11st-fe|\ - wmr-300|\ - zbt-wg2626) - status_led="$boardname:green:status" - ;; - dlink,dwr-921-c1) - status_led="$boardname:green:sigstrength" - ;; - asl26555-8M|\ - asl26555-16M) - status_led="asl26555:green:power" - ;; - atp-52b|\ - ew1200|\ - ip2202) - status_led="$boardname:green:run" - ;; - c108) - status_led="$boardname:green:lan" - ;; - cf-wr800n|\ - psg1208) - status_led="$boardname:white:wps" - ;; - psg1218a|\ - psg1218b) - status_led="$boardname:yellow:status" - ;; - cy-swr1100|\ - w502u|\ - youhua,wr1200js) - status_led="$boardname:blue:wps" - ;; - d240|\ - dap-1350|\ - na930|\ - d-team,newifi-d2|\ - pbr-m1|\ - re350-v1|\ - rt-ac51u|\ - rt-n13u|\ - rt-n14u|\ - rt-n15|\ - rt-n56u|\ - tplink,c20-v1|\ - wl-330n|\ - wl-330n3g|\ - wli-tx4-ag300n|\ - y1|\ - y1s|\ - youku-yk1|\ - zorlik,zl5900v2) - status_led="$boardname:blue:power" - ;; - dlink,dap-1522-a1|\ - phicomm,k2g|\ - k2p|\ - m3|\ - mir3g|\ - miwifi-nano) - status_led="$boardname:blue:status" - ;; - db-wrt01|\ - esr-9753|\ - pbr-d1) - status_led="$boardname:orange:power" - ;; - f5d8235-v1) - status_led="$boardname:blue:wired" - ;; - f5d8235-v2) - status_led="$boardname:blue:router" - ;; - f7c027|\ - timecloud) - status_led="$boardname:orange:status" - ;; - hc5*61|\ - hc5661a|\ - jhr-n805r|\ - jhr-n926r|\ - mlw221|\ - mlwg2|\ - vonets,var11n-300) - status_led="$boardname:blue:system" - ;; - hc5962) - status_led="$boardname:white:status" - ;; - linkits7688) - status_led="linkit-smart-7688:orange:wifi" - ;; - m2m) - status_led="$boardname:blue:wifi" - ;; - gl-mt300n-v2) - status_led="$boardname:green:power" - ;; - m4-4M|\ - m4-8M) - status_led="m4:blue:status" - ;; - mikrotik,rbm33g) - status_led="rbm33g:green:usr" - ;; - miwifi-mini|\ - zte-q7) - status_led="$boardname:red:status" - ;; - mr-102n) - status_led="$boardname:amber:status" - ;; - mr200) - status_led="$boardname:white:power" - ;; - nw718) - status_led="$boardname:amber:cpu" - ;; - newifi-d1) - status_led="$boardname:blue:status" - ;; - omega2| \ - omega2p) - status_led="$boardname:amber:system" - ;; - oy-0001|\ - sl-r7205) - status_led="$boardname:green:wifi" - ;; - psr-680w) - status_led="$boardname:red:wan" - ;; - px-4885-4M|\ - px-4885-8M) - status_led="px-4885:orange:wifi" - ;; - re6500|\ - whr-1166d|\ - whr-600d) - status_led="$boardname:orange:wifi" - ;; - mzk-ex300np|\ - rt-n10-plus|\ - tew-638apb-v2|\ - tew-691gr|\ - tew-692gr|\ - ur-326n4g|\ - ur-336un|\ - wf-2881) - status_led="$boardname:green:wps" - ;; - rb750gr3) - status_led="$boardname:blue:pwr" - ;; - sap-g3200u3) - status_led="$boardname:green:usb" - ;; - u25awf-h1) - status_led="u25awf:red:wifi" - ;; - u7621-06-256M-16M) - status_led="u7621-06:green:status" - ;; - u7628-01-128M-16M) - status_led="u7628-01:green:power" - ;; - v22rw-2x2) - status_led="$boardname:green:security" - ;; - vocore-8M|\ - vocore-16M) - status_led="vocore:green:status" - ;; - vocore2) - status_led="$boardname:fuchsia:status" - ;; - vocore2lite) - status_led="$boardname:green:status" - ;; - w306r-v20|\ - mqmaker,witi-256m|\ - mqmaker,witi-512m|\ - zbt-wr8305rt) - status_led="$boardname:green:sys" - ;; - wcr-1166ds|\ - whr-300hp2|\ - wsr-1166|\ - wsr-600) - status_led="$boardname:green:power" - ;; - wcr-150gn|\ - wl-351) - status_led="$boardname:amber:power" - ;; - whr-g300n|\ - wlr-6000|\ - zbt-we2026) - status_led="$boardname:red:power" - ;; - widora,neo-16m|\ - widora,neo-32m) - status_led="widora:orange:wifi" - ;; - wzr-agl300nh) - status_led="$boardname:green:router" - ;; - wizfi630a) - status_led="$boardname::run" - ;; - wr512-3gn-4M|\ - wr512-3gn-8M) - status_led="wr512-3gn:green:wps" - ;; - wrtnode2r | \ - wrtnode2p | \ - wrtnode) - status_led="wrtnode:blue:indicator" - ;; - wt3020-4M|\ - wt3020-8M) - status_led="wt3020:blue:power" - ;; - zbt-cpe102) - status_led="$boardname:green:4g-0" - ;; - zbt-we826-16M|\ - zbt-we826-32M) - status_led="zbt-we826:green:power" - ;; - zbtlink,zbt-we1226) - status_led="$boardname:green:wlan" - ;; - zbt-wg3526-16M|\ - zbt-wg3526-32M) - status_led="zbt-wg3526:green:status" - ;; - esac -} +status_led="$(get_dt_led status)" set_state() { - get_status_led $1 - case "$1" in preinit) status_led_blink_preinit diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index c0c6a3eca..711b8388b 100644 --- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -55,6 +55,7 @@ case "$FIRMWARE" in "soc_wmac.eeprom") case $board in dlink,dwr-116-a1|\ + dlink,dwr-118-a2|\ dlink,dwr-921-c1) wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index ffdc5e73e..7558b4e31 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -55,6 +55,8 @@ platform_check_image() { duzun-dm06|\ e1700|\ elecom,wrc-1167ghbk2-s|\ + elecom,wrc-2533gst|\ + elecom,wrc-1900gst|\ esr-9753|\ ew1200|\ ex2700|\ @@ -72,16 +74,19 @@ platform_check_image() { hc5*61|\ hc5661a|\ hg255d|\ + hiwifi,hc5861b|\ hlk-rm04|\ hpm|\ ht-tm02|\ hw550-3g|\ + iodata,wn-ax1167gr|\ iodata,wn-gx300gr|\ ip2202|\ jhr-n805r|\ jhr-n825r|\ jhr-n926r|\ k2p|\ + kimax,u35wf|\ kn|\ kn_rc|\ kn_rf|\ @@ -129,6 +134,7 @@ platform_check_image() { psr-680w|\ px-4885-4M|\ px-4885-8M|\ + netgear,r6120|\ rb750gr3|\ re6500|\ rp-n53|\ @@ -226,6 +232,7 @@ platform_check_image() { zbt-wr8305rt|\ zorlik,zl5900v2|\ zte-q7|\ + zyxel,keenetic-extra-ii|\ youku-yk1) [ "$magic" != "27051956" ] && { echo "Invalid image type." @@ -235,7 +242,8 @@ platform_check_image() { ;; 3g-6200n|\ 3g-6200nl|\ - br-6475nd) + br-6475nd|\ + edimax,br-6478ac-v2) [ "$magic" != "43535953" ] && { echo "Invalid image type." return 1 @@ -253,10 +261,13 @@ platform_check_image() { c20i|\ c50|\ mr200|\ + tplink,c2-v1|\ tplink,c20-v1|\ tplink,c20-v4|\ tplink,c50-v3|\ + tplink,tl-mr3020-v3|\ tplink,tl-mr3420-v5|\ + tplink,tl-wa801nd-v5|\ tplink,tl-wr842n-v5|\ tplink,tl-wr902ac-v3|\ tl-wr840n-v4|\ @@ -280,6 +291,7 @@ platform_check_image() { return 0 ;; dlink,dwr-116-a1|\ + dlink,dwr-118-a2|\ dlink,dwr-921-c1|\ dwr-512-b) [ "$magic" != "0404242b" ] && { @@ -296,6 +308,7 @@ platform_check_image() { nand_do_platform_check "$board" "$1" return $?; ;; + mikrotik,rbm11g|\ mikrotik,rbm33g|\ re350-v1) [ "$magic" != "01000000" ] && { @@ -322,6 +335,7 @@ platform_pre_upgrade() { local board=$(board_name) case "$board" in + mikrotik,rbm11g|\ mikrotik,rbm33g) [ -z "$(rootfs_type)" ] && mtd erase firmware ;; @@ -355,9 +369,3 @@ platform_do_upgrade() { ;; esac } - -blink_led() { - . /etc/diag.sh; set_state upgrade -} - -append sysupgrade_pre_upgrade blink_led diff --git a/target/linux/ramips/dts/11ACNAS.dts b/target/linux/ramips/dts/11ACNAS.dts index b8c326889..f66bee636 100644 --- a/target/linux/ramips/dts/11ACNAS.dts +++ b/target/linux/ramips/dts/11ACNAS.dts @@ -14,11 +14,6 @@ gpio-leds { compatible = "gpio-leds"; - // Only USB LED is connected to GPIO. - // All of other LEDs are connected directly to - // switch, WiFi chip, Vcc, so they are not controllable - // via GPIO - usb { label = "11acnas:green:usb"; gpios = <&gpio0 27 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/3G-6200N.dts b/target/linux/ramips/dts/3G-6200N.dts index 82cfaa800..88ee81dfa 100644 --- a/target/linux/ramips/dts/3G-6200N.dts +++ b/target/linux/ramips/dts/3G-6200N.dts @@ -9,48 +9,56 @@ compatible = "edimax,3g-6200n", "ralink,rt3050-soc"; model = "Edimax 3g-6200n"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@3e0000 { - label = "cimage"; - reg = <0x3e0000 0x20000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x390000>; + partition@3e0000 { + label = "cimage"; + reg = <0x3e0000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x390000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "3g-6200n:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -68,8 +76,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/3G-6200NL.dts b/target/linux/ramips/dts/3G-6200NL.dts index c95c5bf2d..091f9654f 100644 --- a/target/linux/ramips/dts/3G-6200NL.dts +++ b/target/linux/ramips/dts/3G-6200NL.dts @@ -9,48 +9,56 @@ compatible = "edimax,3g-6200nl", "ralink,rt3050-soc"; model = "Edimax 3g-6200nl"; + aliases { + led-status = &led_internet; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@3e0000 { - label = "cimage"; - reg = <0x3e0000 0x20000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x390000>; + partition@3e0000 { + label = "cimage"; + reg = <0x3e0000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x390000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - internet { + led_internet: internet { label = "3g-6200nl:green:internet"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -63,8 +71,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/3G150B.dts b/target/linux/ramips/dts/3G150B.dts index afe9fafe9..90a52fa8b 100644 --- a/target/linux/ramips/dts/3G150B.dts +++ b/target/linux/ramips/dts/3G150B.dts @@ -9,10 +9,14 @@ compatible = "tenda,3g150b", "ralink,rt5350-soc"; model = "Tenda 3G150B"; + aliases { + led-status = &led_ap; + }; + gpio-leds { compatible = "gpio-leds"; - ap { + led_ap: ap { label = "3g150b:blue:ap"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -52,33 +54,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; @@ -90,7 +96,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf", "led"; + ralink,group = "i2c", "jtag", "uartf", "led"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/3G300M.dts b/target/linux/ramips/dts/3G300M.dts index eb1399529..8d55020e7 100644 --- a/target/linux/ramips/dts/3G300M.dts +++ b/target/linux/ramips/dts/3G300M.dts @@ -9,6 +9,10 @@ compatible = "tenda,3g300m", "ralink,rt3052-soc"; model = "Tenda 3G300M"; + aliases { + led-status = &led_ap; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - ap { + led_ap: ap { label = "3g300m:blue:ap"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -45,8 +49,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -67,33 +69,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/A5-V11.dts b/target/linux/ramips/dts/A5-V11.dts index 40b0b1c37..389bd4aa3 100644 --- a/target/linux/ramips/dts/A5-V11.dts +++ b/target/linux/ramips/dts/A5-V11.dts @@ -9,6 +9,10 @@ compatible = "unbranded,a5-v11", "ralink,rt5350-soc"; model = "A5-V11"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "a5-v11:red:power"; gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -58,33 +60,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AC1200RM.dts b/target/linux/ramips/dts/AC1200RM.dts index 9bdbf5cad..b2d0202ed 100644 --- a/target/linux/ramips/dts/AC1200RM.dts +++ b/target/linux/ramips/dts/AC1200RM.dts @@ -41,14 +41,16 @@ compatible = "alfa-network,ac1200rm", "ralink,mt7620a-soc"; model = "ALFA Network AC1200RM"; + aliases { + led-status = &led_wps; + }; + chosen { bootargs = "console=ttyS0,115200"; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -66,7 +68,7 @@ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "ac1200rm:green:wps"; gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; }; @@ -106,18 +108,17 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; - led { - led-sources = <2>; - led-active-low; - }; + led { + led-sources = <2>; + led-active-low; }; }; }; @@ -135,38 +136,42 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x1000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@031000 { - label = "config"; - reg = <0x31000 0xf000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@31000 { + label = "config"; + reg = <0x31000 0xf000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AI-BR100.dts b/target/linux/ramips/dts/AI-BR100.dts index b0100f63b..1068179a2 100644 --- a/target/linux/ramips/dts/AI-BR100.dts +++ b/target/linux/ramips/dts/AI-BR100.dts @@ -9,6 +9,10 @@ compatible = "aigale,ai-br100", "ralink,mt7620a-soc"; model = "Aigale Ai-BR100"; + aliases { + led-status = &led_wlan; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; }; - wlan { + led_wlan: wlan { label = "ai-br100:blue:wlan"; gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -49,33 +51,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0 0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "u-boot-env"; - reg = <0x20000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - factory: partition@30000 { - label = "factory"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@20000 { + label = "u-boot-env"; + reg = <0x20000 0x10000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0x7c0000>; + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7c0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AIR3GII.dts b/target/linux/ramips/dts/AIR3GII.dts index 042037559..c3ce087ed 100644 --- a/target/linux/ramips/dts/AIR3GII.dts +++ b/target/linux/ramips/dts/AIR3GII.dts @@ -25,8 +25,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -45,33 +43,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ALL0239-3G.dts b/target/linux/ramips/dts/ALL0239-3G.dts index f34567f28..305fe6e26 100644 --- a/target/linux/ramips/dts/ALL0239-3G.dts +++ b/target/linux/ramips/dts/ALL0239-3G.dts @@ -9,36 +9,44 @@ compatible = "allnet,all0239-3g", "ralink,rt3052-soc"; model = "Allnet ALL0239-3G"; + aliases { + led-status = &led_status; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -55,7 +63,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "all0239-3g:green:status"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -68,8 +76,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/ALL0256N-4M.dts b/target/linux/ramips/dts/ALL0256N-4M.dts index 0b673b492..62a3f116c 100644 --- a/target/linux/ramips/dts/ALL0256N-4M.dts +++ b/target/linux/ramips/dts/ALL0256N-4M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3c8000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3c8000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ALL0256N-8M.dts b/target/linux/ramips/dts/ALL0256N-8M.dts index 5e2e3895a..b0d5e195e 100644 --- a/target/linux/ramips/dts/ALL0256N-8M.dts +++ b/target/linux/ramips/dts/ALL0256N-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ALL0256N.dtsi b/target/linux/ramips/dts/ALL0256N.dtsi index 462b854fa..0437b96b6 100644 --- a/target/linux/ramips/dts/ALL0256N.dtsi +++ b/target/linux/ramips/dts/ALL0256N.dtsi @@ -27,8 +27,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/ALL5002.dts b/target/linux/ramips/dts/ALL5002.dts index 73421f162..acd5f0923 100644 --- a/target/linux/ramips/dts/ALL5002.dts +++ b/target/linux/ramips/dts/ALL5002.dts @@ -53,33 +53,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ALL5003.dts b/target/linux/ramips/dts/ALL5003.dts index a740455ae..303bc4068 100644 --- a/target/linux/ramips/dts/ALL5003.dts +++ b/target/linux/ramips/dts/ALL5003.dts @@ -53,33 +53,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; @@ -87,7 +91,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/AP-MT7621A-V60.dts b/target/linux/ramips/dts/AP-MT7621A-V60.dts index a98d8a646..0a4322fec 100644 --- a/target/linux/ramips/dts/AP-MT7621A-V60.dts +++ b/target/linux/ramips/dts/AP-MT7621A-V60.dts @@ -21,7 +21,7 @@ simple-audio-card,format = "i2s"; simple-audio-card,bitclock-master = <&dailink0_master>; simple-audio-card,frame-master = <&dailink0_master>; - simple-audio-card,widgets = + simple-audio-card,widgets = "Microphone", "Microphone Jack", "Headphone", "Headphone Jack"; simple-audio-card,routing = @@ -82,34 +82,38 @@ status = "okay"; mx25l6405d@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "mx25l6405d","jedec,spi-nor"; reg = <0 0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AR670W.dts b/target/linux/ramips/dts/AR670W.dts index 3759f4a8c..077e447e8 100644 --- a/target/linux/ramips/dts/AR670W.dts +++ b/target/linux/ramips/dts/AR670W.dts @@ -9,35 +9,43 @@ compatible = "airlink101,ar670w", "ralink,rt2880-soc"; model = "Airlink101 AR670W"; + aliases { + led-status = &led_power; + }; + cfi@bdc00000 { compatible = "cfi-flash"; reg = <0xbc400000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - u-boot@0 { - reg = <0x0 0x30000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - factory: factory@30000 { - reg = <0x30000 0x10000>; - label = "factory"; - read-only; - }; + partition@0 { + reg = <0x0 0x30000>; + label = "u-boot"; + read-only; + }; - firmware@40000 { - reg = <0x40000 0x3c0000>; - label = "firmware"; + factory: partition@30000 { + reg = <0x30000 0x10000>; + label = "factory"; + read-only; + }; + + partition@40000 { + reg = <0x40000 0x3c0000>; + label = "firmware"; + }; }; }; gpio-leds { compatible = "gpio-leds"; - status { + led_power: power { label = "ar670w:green:power"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -50,8 +58,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { diff --git a/target/linux/ramips/dts/AR725W.dts b/target/linux/ramips/dts/AR725W.dts index ae5034ede..a99978892 100644 --- a/target/linux/ramips/dts/AR725W.dts +++ b/target/linux/ramips/dts/AR725W.dts @@ -9,40 +9,48 @@ compatible = "airlink101,ar725w", "ralink,rt2880-soc"; model = "Airlink101 AR725W"; + aliases { + led-status = &led_power; + }; + cfi@bdc00000 { compatible = "cfi-flash"; reg = <0xbc400000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - u-boot@0 { - reg = <0x0 0x30000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - u-boot-env@30000 { - reg = <0x30000 0x10000>; - label = "u-boot-env"; - }; + partition@0 { + reg = <0x0 0x30000>; + label = "u-boot"; + read-only; + }; - factory: factory@40000 { - reg = <0x40000 0x10000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x30000 0x10000>; + label = "u-boot-env"; + }; - firmware@50000 { - reg = <0x50000 0x3B0000>; - label = "firmware"; + factory: partition@40000 { + reg = <0x40000 0x10000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x50000 0x3B0000>; + label = "firmware"; + }; }; }; gpio-leds { compatible = "gpio-leds"; - status { + led_power: power { label = "ar725w:green:power"; gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; @@ -60,8 +68,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { diff --git a/target/linux/ramips/dts/ASL26555-16M.dts b/target/linux/ramips/dts/ASL26555-16M.dts index c61d45b7a..15352c2f2 100644 --- a/target/linux/ramips/dts/ASL26555-16M.dts +++ b/target/linux/ramips/dts/ASL26555-16M.dts @@ -11,51 +11,55 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; - }; + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@fd0000 { - label = "cert"; - reg = <0xfd0000 0x10000>; - read-only; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; - partition@fe0000 { - label = "langpack"; - reg = <0xfe0000 0x10000>; - read-only; - }; + partition@fd0000 { + label = "cert"; + reg = <0xfd0000 0x10000>; + read-only; + }; - devdata: partition@ff0000 { - label = "devdata"; - reg = <0xff0000 0x10000>; - read-only; + partition@fe0000 { + label = "langpack"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + devdata: partition@ff0000 { + label = "devdata"; + reg = <0xff0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/ASL26555-8M.dts b/target/linux/ramips/dts/ASL26555-8M.dts index 2beb9f56c..0eb6a01c1 100644 --- a/target/linux/ramips/dts/ASL26555-8M.dts +++ b/target/linux/ramips/dts/ASL26555-8M.dts @@ -11,45 +11,49 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - devdata: partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "rgdb"; - reg = <0x40000 0x10000>; - read-only; - }; + devdata: partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x790000>; - }; + partition@40000 { + label = "rgdb"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@7e0000 { - label = "cert"; - reg = <0x7e0000 0x10000>; - read-only; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; - partition@7f0000 { - label = "langpack"; - reg = <0x7f0000 0x10000>; - read-only; + partition@7e0000 { + label = "cert"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "langpack"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/ASL26555.dtsi b/target/linux/ramips/dts/ASL26555.dtsi index 67dc34787..890a7de18 100644 --- a/target/linux/ramips/dts/ASL26555.dtsi +++ b/target/linux/ramips/dts/ASL26555.dtsi @@ -6,10 +6,12 @@ / { compatible = "alphanetworks,asl26555", "ralink,rt3050-soc"; + aliases { + led-status = &led_power_green; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -48,7 +50,7 @@ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; - power-green { + led_power_green: power-green { label = "asl26555:green:power"; gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; }; diff --git a/target/linux/ramips/dts/ATP-52B.dts b/target/linux/ramips/dts/ATP-52B.dts index ca62a443c..7f0d84732 100644 --- a/target/linux/ramips/dts/ATP-52B.dts +++ b/target/linux/ramips/dts/ATP-52B.dts @@ -9,40 +9,48 @@ compatible = "argus,atp-52b", "ralink,rt3052-soc"; model = "Argus ATP-52B"; + aliases { + led-status = &led_run; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "bootloader"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7a0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7a0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - run { + led_run: run { label = "atp-52b:green:run"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -55,8 +63,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { diff --git a/target/linux/ramips/dts/AWAPN2403.dts b/target/linux/ramips/dts/AWAPN2403.dts index c304373ce..b9028bce0 100644 --- a/target/linux/ramips/dts/AWAPN2403.dts +++ b/target/linux/ramips/dts/AWAPN2403.dts @@ -9,10 +9,15 @@ compatible = "asiarf,awapn2403", "ralink,rt3052-soc"; model = "AsiaRF AWAPN2403"; + aliases { + led-status = &led_wps; + }; + + gpio-leds { compatible = "gpio-leds"; - link { + led_wps: wps { label = "awapn2403:green:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -20,8 +25,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,33 +39,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AWM002-EVB-4M.dts b/target/linux/ramips/dts/AWM002-EVB-4M.dts index b1394405f..91ef26372 100644 --- a/target/linux/ramips/dts/AWM002-EVB-4M.dts +++ b/target/linux/ramips/dts/AWM002-EVB-4M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80: m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; reg = <0>; compatible = "jedec,spi-nor"; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AWM002-EVB-8M.dts b/target/linux/ramips/dts/AWM002-EVB-8M.dts index 52d5ed7f9..ef982c345 100644 --- a/target/linux/ramips/dts/AWM002-EVB-8M.dts +++ b/target/linux/ramips/dts/AWM002-EVB-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80: m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; reg = <0>; compatible = "jedec,spi-nor"; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/AWM002-EVB.dtsi b/target/linux/ramips/dts/AWM002-EVB.dtsi index 7a66af21a..a2770d9ba 100644 --- a/target/linux/ramips/dts/AWM002-EVB.dtsi +++ b/target/linux/ramips/dts/AWM002-EVB.dtsi @@ -27,8 +27,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { diff --git a/target/linux/ramips/dts/AWUSFREE1.dts b/target/linux/ramips/dts/AWUSFREE1.dts index c0ffbb279..959f6b7db 100644 --- a/target/linux/ramips/dts/AWUSFREE1.dts +++ b/target/linux/ramips/dts/AWUSFREE1.dts @@ -41,14 +41,16 @@ compatible = "alfa-network,awusfree1", "mediatek,mt7628an-soc"; model = "ALFA Network AWUSFREE1"; + aliases { + led-status = &led_system; + }; + chosen { bootargs = "console=ttyS0,115200"; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -61,7 +63,7 @@ gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "awusfree1:orange:system"; gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; }; @@ -121,39 +123,43 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x1000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@031000 { - label = "config"; - reg = <0x31000 0xf000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@31000 { + label = "config"; + reg = <0x31000 0xf000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ArcherC2-v1.dts b/target/linux/ramips/dts/ArcherC2-v1.dts new file mode 100644 index 000000000..cc0d46a6b --- /dev/null +++ b/target/linux/ramips/dts/ArcherC2-v1.dts @@ -0,0 +1,185 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "tplink,c2-v1", "ralink,mt7620a-soc"; + model = "TP-Link Archer C2 v1"; + + aliases { + led-status = &led_wps; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "wled", "ephy", "spi refclk"; + ralink,function = "gpio"; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan { + label = "c2-v1:green:lan"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "c2-v1:green:usb"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + led_wps: wps { + label = "c2-v1:green:wps"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "c2-v1:green:wan"; + gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "c2-v1:green:wlan"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + rtl8367rb { + compatible = "realtek,rtl8367b", "rtl8367b"; + cpu_port = <6>; + realtek,extif1 = <1 0 1 1 1 1 1 1 2>; + mii-bus = <&mdio0>; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; + + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + read-only; + }; + + rom: partition@7d0000 { + label = "rom"; + reg = <0x7d0000 0x10000>; + read-only; + }; + + partition@7e0000 { + label = "romfile"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&rom 0xf100>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + port@5 { + status = "okay"; + mediatek,fixed-link = <1000 1 1 1>; + phy-mode = "rgmii"; + }; + + mdio0: mdio-bus { + status = "okay"; + }; +}; + + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&radio 0>; + mtd-mac-address = <&rom 0xf100>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0x8000>; + }; +}; diff --git a/target/linux/ramips/dts/ArcherC20i.dts b/target/linux/ramips/dts/ArcherC20i.dts index c12f49855..edaa76e3d 100644 --- a/target/linux/ramips/dts/ArcherC20i.dts +++ b/target/linux/ramips/dts/ArcherC20i.dts @@ -39,8 +39,7 @@ gpio-keys { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; + rfkill { label = "rfkill"; gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; @@ -70,41 +69,45 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7a0000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - partition@7c0000 { - label = "config"; - reg = <0x7c0000 0x10000>; - }; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; - rom: partition@7d0000 { - label = "rom"; - reg = <0x7d0000 0x10000>; - }; + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + }; - partition@7e0000 { - label = "romfile"; - reg = <0x7e0000 0x10000>; - }; + rom: partition@7d0000 { + label = "rom"; + reg = <0x7d0000 0x10000>; + }; - radio: partition@7f0000 { - label = "radio"; - reg = <0x7f0000 0x10000>; + partition@7e0000 { + label = "romfile"; + reg = <0x7e0000 0x10000>; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + }; }; }; }; @@ -142,12 +145,11 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 32768>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 32768>; }; }; diff --git a/target/linux/ramips/dts/ArcherC20v1.dts b/target/linux/ramips/dts/ArcherC20v1.dts index 9d8a2b595..70c6f8430 100644 --- a/target/linux/ramips/dts/ArcherC20v1.dts +++ b/target/linux/ramips/dts/ArcherC20v1.dts @@ -9,6 +9,10 @@ compatible = "tplink,c20-v1", "ralink,mt7620a-soc"; model = "TP-Link Archer C20 v1"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -21,7 +25,7 @@ gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "c20-v1:blue:power"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; default-state = "keep"; @@ -60,8 +64,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -94,45 +96,49 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7a0000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - partition@7c0000 { - label = "config"; - reg = <0x7c0000 0x10000>; - read-only; - }; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; - rom: partition@7d0000 { - label = "rom"; - reg = <0x7d0000 0x10000>; - read-only; - }; + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + read-only; + }; - partition@7e0000 { - label = "romfile"; - reg = <0x7e0000 0x10000>; - read-only; - }; + rom: partition@7d0000 { + label = "rom"; + reg = <0x7d0000 0x10000>; + read-only; + }; - radio: partition@7f0000 { - label = "radio"; - reg = <0x7f0000 0x10000>; - read-only; + partition@7e0000 { + label = "romfile"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; @@ -174,15 +180,14 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&rom 0xf100>; - mtd-mac-address-increment = <(-1)>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&rom 0xf100>; + mtd-mac-address-increment = <(-1)>; }; }; diff --git a/target/linux/ramips/dts/ArcherC20v4.dts b/target/linux/ramips/dts/ArcherC20v4.dts index 77f70bd84..49f9dc9a0 100644 --- a/target/linux/ramips/dts/ArcherC20v4.dts +++ b/target/linux/ramips/dts/ArcherC20v4.dts @@ -9,6 +9,10 @@ compatible = "tplink,c20-v4", "mediatek,mt7628an-soc"; model = "TP-Link Archer C20 v4"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "c20-v4:green:power"; gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; }; @@ -31,7 +35,7 @@ label = "c20-v4:orange:wan"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - + wlan5g { label = "c20-v4:green:wlan5g"; gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; @@ -50,8 +54,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -87,15 +89,14 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x28000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&factory 0xf100>; - mtd-mac-address-increment = <(-1)>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x28000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0xf100>; + mtd-mac-address-increment = <(-1)>; }; }; diff --git a/target/linux/ramips/dts/ArcherC50.dts b/target/linux/ramips/dts/ArcherC50.dts index 88bd3272d..efcb17094 100644 --- a/target/linux/ramips/dts/ArcherC50.dts +++ b/target/linux/ramips/dts/ArcherC50.dts @@ -9,6 +9,10 @@ compatible = "tplink,c50", "ralink,mt7620a-soc"; model = "TP-Link Archer C50"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -21,7 +25,7 @@ gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "c50:green:power"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; default-state = "on"; @@ -60,8 +64,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -93,45 +95,49 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7a0000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - partition@7c0000 { - label = "config"; - reg = <0x7c0000 0x10000>; - read-only; - }; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; - rom: partition@7d0000 { - label = "rom"; - reg = <0x7d0000 0x10000>; - read-only; - }; + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + read-only; + }; - partition@7e0000 { - label = "romfile"; - reg = <0x7e0000 0x10000>; - read-only; - }; + rom: partition@7d0000 { + label = "rom"; + reg = <0x7d0000 0x10000>; + read-only; + }; - radio: partition@7f0000 { - label = "radio"; - reg = <0x7f0000 0x10000>; - read-only; + partition@7e0000 { + label = "romfile"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; @@ -173,15 +179,14 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 32768>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&rom 0xf100>; - mtd-mac-address-increment = <(-1)>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 32768>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&rom 0xf100>; + mtd-mac-address-increment = <(-1)>; }; }; diff --git a/target/linux/ramips/dts/ArcherC50V3.dts b/target/linux/ramips/dts/ArcherC50V3.dts index ebb76abcd..397dc22bb 100644 --- a/target/linux/ramips/dts/ArcherC50V3.dts +++ b/target/linux/ramips/dts/ArcherC50V3.dts @@ -9,10 +9,12 @@ compatible = "tplink,c50-v3", "mediatek,mt7628an-soc"; model = "TP-Link Archer C50 v3"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,7 +38,7 @@ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "c50-v3:green:power"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; @@ -80,15 +82,14 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x28000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&factory 0xf100>; - mtd-mac-address-increment = <(-1)>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x28000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0xf100>; + mtd-mac-address-increment = <(-1)>; }; }; diff --git a/target/linux/ramips/dts/ArcherMR200.dts b/target/linux/ramips/dts/ArcherMR200.dts index ec28d3967..2735d7406 100644 --- a/target/linux/ramips/dts/ArcherMR200.dts +++ b/target/linux/ramips/dts/ArcherMR200.dts @@ -9,6 +9,10 @@ compatible = "tplink,mr200", "ralink,mt7620a-soc"; model = "TP-Link Archer MR200"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -26,7 +30,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "mr200:white:power"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -69,8 +73,6 @@ gpio-keys { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; reset { label = "reset"; @@ -95,7 +97,6 @@ gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; }; }; - }; &gpio1 { @@ -114,39 +115,43 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7b0000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - rom: partition@7d0000 { - label = "rom"; - reg = <0x7d0000 0x10000>; - read-only; - }; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7b0000>; + }; - partition@7e0000 { - label = "romfile"; - reg = <0x7e0000 0x10000>; - read-only; - }; + rom: partition@7d0000 { + label = "rom"; + reg = <0x7d0000 0x10000>; + read-only; + }; - radio: partition@7f0000 { - label = "radio"; - reg = <0x7f0000 0x10000>; - read-only; + partition@7e0000 { + label = "romfile"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; @@ -183,12 +188,11 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 32768>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 32768>; }; }; diff --git a/target/linux/ramips/dts/BC2.dts b/target/linux/ramips/dts/BC2.dts index 94a22ec7f..c57e79e53 100644 --- a/target/linux/ramips/dts/BC2.dts +++ b/target/linux/ramips/dts/BC2.dts @@ -14,30 +14,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -52,8 +56,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/BOCCO.dts b/target/linux/ramips/dts/BOCCO.dts index 96aab7bd0..8f78f2dac 100644 --- a/target/linux/ramips/dts/BOCCO.dts +++ b/target/linux/ramips/dts/BOCCO.dts @@ -11,8 +11,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -98,33 +96,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/BR-6475ND.dts b/target/linux/ramips/dts/BR-6475ND.dts index 11611b083..3f260fe06 100644 --- a/target/linux/ramips/dts/BR-6475ND.dts +++ b/target/linux/ramips/dts/BR-6475ND.dts @@ -9,10 +9,12 @@ compatible = "edimax,br-6475nd", "ralink,rt3883-soc"; model = "Edimax BR-6475nD"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -32,7 +34,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "br-6475nd:green:power"; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; }; @@ -52,36 +54,40 @@ compatible = "cfi-flash"; reg = <0x1c000000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - reg = <0x00000000 0x00030000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - reg = <0x00030000 0x00010000>; - label = "nvram"; - read-only; - }; + partition@0 { + reg = <0x00000000 0x00030000>; + label = "u-boot"; + read-only; + }; - factory: partition@40000 { - reg = <0x00040000 0x00010000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "nvram"; + read-only; + }; - devdata: partition@50000 { - reg = <0x00050000 0x00020000>; - label = "devdata"; - read-only; - }; + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; - partition@70000 { - reg = <0x00070000 0x00790000>; - label = "firmware"; + devdata: partition@50000 { + reg = <0x00050000 0x00020000>; + label = "devdata"; + read-only; + }; + + partition@70000 { + reg = <0x00070000 0x00790000>; + label = "firmware"; + }; }; }; @@ -92,9 +98,11 @@ realtek,extif0 = <1 0 1 1 1 1 1 1 2>; }; - /* Unclear if this is the correct gpio setup; the USB ports are - unpopulated on a stock BR-6475nD, even though the hardware exists - and the headers are there. */ + /* + * Unclear if this is the correct gpio setup; the USB ports are + * unpopulated on a stock BR-6475nD, even though the hardware exists + * and the headers are there. + */ /* gpio_export { compatible = "gpio-export"; @@ -146,27 +154,16 @@ &pci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pci_pins>; +}; - pci_pins: pci { - pci { - ralink,group = "pci"; - ralink,function = "pci-fnc"; - }; - }; +&pci1 { + status = "okay"; - host-bridge { - pci-bridge@1 { - status = "okay"; - - wifi@0,0 { - compatible = "pci0,0"; - reg = <0x10000 0 0 0 0>; - ralink,5ghz = <0>; - ralink,mtd-eeprom = <&factory 0x8000>; - }; - }; + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x10000 0 0 0 0>; + ralink,5ghz = <0>; + ralink,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/BR-6478AC-V2.dts b/target/linux/ramips/dts/BR-6478AC-V2.dts new file mode 100644 index 000000000..b38be1e2c --- /dev/null +++ b/target/linux/ramips/dts/BR-6478AC-V2.dts @@ -0,0 +1,210 @@ +/* + * Device Tree file for the Edimax BR-6478AC V2 + * based on Linksys E1700 + * + * Copyright (C) 2016 Rohan Murch + * Copyright (C) 2016 Hans Ulli Kroll + * Copyright (C) 2017 James McKenzie + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "edimax,br-6478ac-v2", "ralink,mt7620a-soc"; + model = "Edimax BR-6478AC v2"; + + aliases { + led-status = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: power { + label = "br-6478ac-v2:white:power"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + internet { + label = "br-6478ac-v2:blue:internet"; + gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + }; + wlan { + label = "br-6478ac-v2:blue:wlan"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + }; + usb { + label = "br-6478ac-v2:blue:usb"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; + }; + + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + usb-power { + gpio-export,name="usb-power"; + gpio-export,output=<1>; + gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; + }; + }; +}; + + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0 0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "cimage"; + reg = <0x50000 0x20000>; + read-only; + }; + + partition@70000 { + label = "firmware"; + reg = <0x00070000 0x00790000>; + }; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "wllll"; + + port@5 { + status = "okay"; + mediatek,fixed-link = <1000 1 1 1>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + }; + + phy1: ethernet-phy@1 { + reg = <1>; + phy-mode = "rgmii"; + }; + + phy2: ethernet-phy@2 { + reg = <2>; + phy-mode = "rgmii"; + }; + + phy3: ethernet-phy@3 { + reg = <3>; + phy-mode = "rgmii"; + }; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy1f: ethernet-phy@1f { + reg = <0x1f>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/BROADWAY.dts b/target/linux/ramips/dts/BROADWAY.dts index 4b6b6ca42..a5664fe79 100644 --- a/target/linux/ramips/dts/BROADWAY.dts +++ b/target/linux/ramips/dts/BROADWAY.dts @@ -14,30 +14,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "bootloader"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x790000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; }; }; @@ -57,8 +61,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; factory { diff --git a/target/linux/ramips/dts/C108.dts b/target/linux/ramips/dts/C108.dts index c449a36fc..b30addf28 100644 --- a/target/linux/ramips/dts/C108.dts +++ b/target/linux/ramips/dts/C108.dts @@ -42,6 +42,10 @@ compatible = "hnet,c108", "ralink,mt7620a-soc"; model = "HNET C108"; + aliases { + led-status = &led_lan_green; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -80,7 +84,7 @@ gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; }; - lan_green { + led_lan_green: lan_green { label = "c108:green:lan"; gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; }; @@ -88,8 +92,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -112,33 +114,37 @@ status = "okay"; en25q128@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/CARAMBOLA.dts b/target/linux/ramips/dts/CARAMBOLA.dts index 908770977..4a59c11ae 100644 --- a/target/linux/ramips/dts/CARAMBOLA.dts +++ b/target/linux/ramips/dts/CARAMBOLA.dts @@ -18,30 +18,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; diff --git a/target/linux/ramips/dts/CF-WR800N.dts b/target/linux/ramips/dts/CF-WR800N.dts index b66df862f..8c5778527 100644 --- a/target/linux/ramips/dts/CF-WR800N.dts +++ b/target/linux/ramips/dts/CF-WR800N.dts @@ -9,6 +9,10 @@ compatible = "comfast,cf-wr800n", "ralink,mt7620n-soc"; model = "Comfast CF-WR800N"; + aliases { + led-status = &led_wps; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -26,7 +30,7 @@ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "cf-wr800n:white:wps"; gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -66,33 +68,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/CS-QR10.dts b/target/linux/ramips/dts/CS-QR10.dts index 6b70a3167..c81629f42 100644 --- a/target/linux/ramips/dts/CS-QR10.dts +++ b/target/linux/ramips/dts/CS-QR10.dts @@ -9,10 +9,14 @@ compatible = "planex,cs-qr10", "ralink,mt7620a-soc"; model = "Planex CS-QR10"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "cs-qr10:red:power"; gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; s1 { @@ -68,33 +70,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/CY-SWR1100.dts b/target/linux/ramips/dts/CY-SWR1100.dts index b5b594bf5..787667a6e 100644 --- a/target/linux/ramips/dts/CY-SWR1100.dts +++ b/target/linux/ramips/dts/CY-SWR1100.dts @@ -9,45 +9,53 @@ compatible = "samsung,cy-swr1100", "ralink,rt3883-soc"; model = "Samsung CY-SWR1100"; + aliases { + led-status = &led_wps; + }; + nor-flash@1c000000 { compatible = "cfi-flash"; reg = <0x1c000000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x4000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@34000 { - label = "factory"; - reg = <0x34000 0x4000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x4000>; + read-only; + }; - partition@38000 { - label = "nvram"; - reg = <0x38000 0x8000>; - read-only; - }; + factory: partition@34000 { + label = "factory"; + reg = <0x34000 0x4000>; + read-only; + }; - partition@40000 { - label = "devdata"; - reg = <0x40000 0x10000>; - }; + partition@38000 { + label = "nvram"; + reg = <0x38000 0x8000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + partition@40000 { + label = "devdata"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -60,8 +68,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -80,7 +86,7 @@ gpio-leds { compatible = "gpio-leds"; - wps { + led_wps: wps { label = "cy-swr1100:blue:wps"; gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; }; @@ -114,27 +120,16 @@ &pci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pci_pins>; +}; - pci_pins: pci { - pci { - ralink,group = "pci"; - ralink,function = "pci-fnc"; - }; - }; +&pci1 { + status = "okay"; - host-bridge { - pci-bridge@1 { - status = "okay"; - - wifi@0,0 { - compatible = "pci0,0"; - reg = <0x10000 0 0 0 0>; - ralink,5ghz = <0>; - ralink,mtd-eeprom = <&factory 0x2000>; - }; - }; + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x10000 0 0 0 0>; + ralink,5ghz = <0>; + ralink,mtd-eeprom = <&factory 0x2000>; }; }; diff --git a/target/linux/ramips/dts/D105.dts b/target/linux/ramips/dts/D105.dts index a7d7d3777..89cde124b 100644 --- a/target/linux/ramips/dts/D105.dts +++ b/target/linux/ramips/dts/D105.dts @@ -9,47 +9,55 @@ compatible = "huawei,d105", "ralink,rt3050-soc"; model = "Huawei D105"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "d105:red:power"; gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; }; - wps { + usb { label = "d105:green:usb"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/D240.dts b/target/linux/ramips/dts/D240.dts index 392e92d46..613a20f99 100644 --- a/target/linux/ramips/dts/D240.dts +++ b/target/linux/ramips/dts/D240.dts @@ -42,6 +42,10 @@ compatible = "sanlinking,d240", "ralink,mt7620a-soc"; model = "Sanlinking Technologies D240"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -61,13 +65,12 @@ gpio-export,output = <1>; gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>; }; - }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "d240:blue:power"; gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; }; @@ -85,8 +88,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -113,33 +114,37 @@ status = "okay"; en25q128@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; @@ -168,7 +173,7 @@ &pinctrl { state_default: pinctrl0 { default { - ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa", "nd_sd"; + ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/DAP-1350.dts b/target/linux/ramips/dts/DAP-1350.dts index 107acdb2c..cd6d07f4a 100644 --- a/target/linux/ramips/dts/DAP-1350.dts +++ b/target/linux/ramips/dts/DAP-1350.dts @@ -9,6 +9,10 @@ compatible = "dlink,dap-1350", "ralink,rt3052-soc"; model = "D-Link DAP-1350"; + aliases { + led-status = &led_power_blue; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -18,43 +22,47 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - devdata: partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "devconf"; - reg = <0x40000 0x30000>; - read-only; - }; + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@70000 { - label = "devlang"; - reg = <0x70000 0x40000>; - read-only; - }; + partition@40000 { + label = "devconf"; + reg = <0x40000 0x30000>; + read-only; + }; - partition@b0000 { - label = "firmware"; - reg = <0xb0000 0x750000>; + partition@70000 { + label = "devlang"; + reg = <0x70000 0x40000>; + read-only; + }; + + partition@b0000 { + label = "firmware"; + reg = <0xb0000 0x750000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power_blue: power { label = "dap-1350:blue:power"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -72,8 +80,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/DAP-1522-A1.dts b/target/linux/ramips/dts/DAP-1522-A1.dts index 8f8d098bd..11efb5bbf 100644 --- a/target/linux/ramips/dts/DAP-1522-A1.dts +++ b/target/linux/ramips/dts/DAP-1522-A1.dts @@ -9,29 +9,37 @@ compatible = "dlink,dap-1522-a1", "ralink,rt2880-soc"; model = "D-Link DAP-1522 A1"; + aliases { + led-status = &led_status; + }; + cfi@bc400000 { compatible = "cfi-flash"; reg = <0xbc400000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - factory: partition@30000 { - label = "factory"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0x3a0000>; + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x3a0000>; + }; }; }; @@ -43,8 +51,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -92,7 +98,7 @@ gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "dap-1522-a1:blue:status"; gpios = <&gpio2 20 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/DB-WRT01.dts b/target/linux/ramips/dts/DB-WRT01.dts index 09efff6f5..e25b2f0d6 100644 --- a/target/linux/ramips/dts/DB-WRT01.dts +++ b/target/linux/ramips/dts/DB-WRT01.dts @@ -9,10 +9,14 @@ compatible = "planex,db-wrt01", "ralink,mt7620a-soc"; model = "Planex DB-WRT01"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "db-wrt01:orange:power"; gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; s1 { @@ -40,33 +42,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DCH-M225.dts b/target/linux/ramips/dts/DCH-M225.dts index 1aea90805..b21843692 100644 --- a/target/linux/ramips/dts/DCH-M225.dts +++ b/target/linux/ramips/dts/DCH-M225.dts @@ -9,10 +9,12 @@ compatible = "dlink,dch-m225", "ralink,mt7620a-soc"; model = "D-Link DCH-M225"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { @@ -31,14 +33,16 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "dch-m225:green:power"; gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + default-state = "on"; }; status { label = "dch-m225:red:status"; gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + default-state = "off"; }; }; @@ -97,52 +101,56 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <80000000>; m25p,fast-read; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x4000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@34000 { - label = "factory"; - reg = <0x34000 0x4000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x4000>; + read-only; + }; - nvram: partition@38000 { - label = "nvram"; - reg = <0x38000 0x8000>; - read-only; - }; + factory: partition@34000 { + label = "factory"; + reg = <0x34000 0x4000>; + read-only; + }; - partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + nvram: partition@38000 { + label = "nvram"; + reg = <0x38000 0x8000>; + read-only; + }; - partition@50000 { - label = "upgrade_rec"; - reg = <0x50000 0x100000>; - read-only; - }; + partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@150000 { - label = "firmware"; - reg = <0x150000 0x6b0000>; + partition@50000 { + label = "upgrade_rec"; + reg = <0x50000 0x100000>; + read-only; + }; + + partition@150000 { + label = "firmware"; + reg = <0x150000 0x6b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DCS-930.dts b/target/linux/ramips/dts/DCS-930.dts index 348cdb438..3c9c3d39f 100644 --- a/target/linux/ramips/dts/DCS-930.dts +++ b/target/linux/ramips/dts/DCS-930.dts @@ -9,45 +9,43 @@ compatible = "dlink,dcs-930", "ralink,rt3050-soc"; model = "D-Link DCS-930"; + aliases { + led-status = &led_status; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x400000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "kernel"; - reg = <0x50000 0x150000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@150000 { - label = "rootfs"; - reg = <0x150000 0x2b0000>; - }; - - partition { - label = "firmware"; - reg = <0x50000 0x3b0000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -59,7 +57,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - power { + led_status: status { label = "dcs-930:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -72,8 +70,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { diff --git a/target/linux/ramips/dts/DCS-930L-B1.dts b/target/linux/ramips/dts/DCS-930L-B1.dts index 5d2899ea2..8ec52457f 100644 --- a/target/linux/ramips/dts/DCS-930L-B1.dts +++ b/target/linux/ramips/dts/DCS-930L-B1.dts @@ -9,10 +9,14 @@ compatible = "dlink,dcs-930l-b1", "ralink,rt5350-soc"; model = "D-Link DCS-930L B1"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "dcs-930l-b1:red:power"; gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -47,33 +49,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DIR-300-B1.dts b/target/linux/ramips/dts/DIR-300-B1.dts index b8d8f1645..515b29bf0 100644 --- a/target/linux/ramips/dts/DIR-300-B1.dts +++ b/target/linux/ramips/dts/DIR-300-B1.dts @@ -9,42 +9,48 @@ compatible = "dlink,dir-300-b1", "ralink,rt3050-soc"; model = "D-Link DIR-300 B1"; + aliases { + led-status = &led_status_green; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - devdata: partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -68,7 +74,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - status2 { + led_status_green: status2 { label = "dir-300-b1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/DIR-300-B7.dts b/target/linux/ramips/dts/DIR-300-B7.dts index 12ccd1620..f6a858250 100644 --- a/target/linux/ramips/dts/DIR-300-B7.dts +++ b/target/linux/ramips/dts/DIR-300-B7.dts @@ -9,10 +9,14 @@ compatible = "dlink,dir-300-b7", "ralink,rt5350-soc"; model = "D-Link DIR-300 B7"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "dir-300-b7:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -47,33 +49,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -81,7 +87,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/DIR-320-B1.dts b/target/linux/ramips/dts/DIR-320-B1.dts index 9e05b63e9..36c23de08 100644 --- a/target/linux/ramips/dts/DIR-320-B1.dts +++ b/target/linux/ramips/dts/DIR-320-B1.dts @@ -9,10 +9,14 @@ compatible = "dlink,dir-320-b1", "ralink,rt5350-soc"; model = "D-Link DIR-320 B1"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "dir-320-b1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -69,33 +71,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -103,7 +109,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/DIR-600-B1.dts b/target/linux/ramips/dts/DIR-600-B1.dts index 0e8239d0b..541b5cece 100644 --- a/target/linux/ramips/dts/DIR-600-B1.dts +++ b/target/linux/ramips/dts/DIR-600-B1.dts @@ -9,42 +9,48 @@ compatible = "dlink,dir-600-b1", "ralink,rt3050-soc"; model = "D-Link DIR-600 B1"; + aliases { + led-status = &led_status_green; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - devdata: partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -68,7 +74,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - status2 { + led_status_green: status2 { label = "dir-600-b1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/DIR-610-A1.dts b/target/linux/ramips/dts/DIR-610-A1.dts index eda0bc8c2..445fd2885 100644 --- a/target/linux/ramips/dts/DIR-610-A1.dts +++ b/target/linux/ramips/dts/DIR-610-A1.dts @@ -9,10 +9,14 @@ compatible = "dlink,dir-610-a1", "ralink,rt5350-soc"; model = "D-Link DIR-610 A1"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "dir-610-a1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -47,33 +49,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - devdata: partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DIR-615-D.dts b/target/linux/ramips/dts/DIR-615-D.dts index 507f08774..b59ff3c7c 100644 --- a/target/linux/ramips/dts/DIR-615-D.dts +++ b/target/linux/ramips/dts/DIR-615-D.dts @@ -9,42 +9,48 @@ compatible = "dlink,dir-615-d1", "ralink,rt3050-soc"; model = "D-Link DIR-615 D"; + aliases { + led-status = &led_status_green; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - devdata: partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -66,11 +72,13 @@ status { label = "dir-615-d:amber:status"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + default-state = "off"; }; - status2 { + led_status_green: status2 { label = "dir-615-d:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + default-state = "on"; }; wan { diff --git a/target/linux/ramips/dts/DIR-615-H1.dts b/target/linux/ramips/dts/DIR-615-H1.dts index 7d410f1dd..cbc3dadb7 100644 --- a/target/linux/ramips/dts/DIR-615-H1.dts +++ b/target/linux/ramips/dts/DIR-615-H1.dts @@ -9,17 +9,23 @@ compatible = "dlink,dir-615-h1", "ralink,rt3352-soc"; model = "D-Link DIR-615 H1"; + aliases { + led-status = &led_status_green; + }; + gpio-leds { compatible = "gpio-leds"; status { label = "dir-615-h1:amber:status"; gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + default-state = "off"; }; - status2 { + led_status_green: status2 { label = "dir-615-h1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + default-state = "on"; }; wan { @@ -40,8 +46,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -62,33 +66,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DIR-620-A1.dts b/target/linux/ramips/dts/DIR-620-A1.dts index 23f5a5dae..fdf68b58f 100644 --- a/target/linux/ramips/dts/DIR-620-A1.dts +++ b/target/linux/ramips/dts/DIR-620-A1.dts @@ -9,42 +9,48 @@ compatible = "dlink,dir-620-a1", "ralink,rt3050-soc"; model = "D-Link DIR-620 A1"; + aliases { + led-status = &led_status_green; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -68,7 +74,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - status2 { + led_status_green: status2 { label = "dir-620-a1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/DIR-620-D1.dts b/target/linux/ramips/dts/DIR-620-D1.dts index 2def8aae4..e0b2f78c7 100644 --- a/target/linux/ramips/dts/DIR-620-D1.dts +++ b/target/linux/ramips/dts/DIR-620-D1.dts @@ -9,10 +9,14 @@ compatible = "dlink,dir-620-d1", "ralink,rt3352-soc"; model = "D-Link DIR-620 D1"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "dir-620-d1:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { @@ -41,33 +43,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DIR-645.dts b/target/linux/ramips/dts/DIR-645.dts index 0afa87a07..1728cb25c 100644 --- a/target/linux/ramips/dts/DIR-645.dts +++ b/target/linux/ramips/dts/DIR-645.dts @@ -9,6 +9,10 @@ compatible = "dlink,dir-645", "ralink,rt3883-soc"; model = "D-Link DIR-645"; + aliases { + led-status = &led_wps; + }; + rtl8367b { compatible = "realtek,rtl8367b"; gpio-sda = <&gpio0 1 GPIO_ACTIVE_HIGH>; @@ -18,8 +22,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -43,7 +45,7 @@ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "dir-645:green:wps"; gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; }; @@ -69,44 +71,48 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <25000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x4000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@34000 { - label = "factory"; - reg = <0x34000 0x4000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x4000>; + read-only; + }; - partition@38000 { - label = "nvram"; - reg = <0x38000 0x8000>; - read-only; - }; + factory: partition@34000 { + label = "factory"; + reg = <0x34000 0x4000>; + read-only; + }; - partition@40000 { - label = "devdata"; - reg = <0x40000 0x10000>; - }; + partition@38000 { + label = "nvram"; + reg = <0x38000 0x8000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + partition@40000 { + label = "devdata"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DIR-810L.dts b/target/linux/ramips/dts/DIR-810L.dts index 7a1736d56..2121a2172 100644 --- a/target/linux/ramips/dts/DIR-810L.dts +++ b/target/linux/ramips/dts/DIR-810L.dts @@ -9,10 +9,12 @@ compatible = "dlink,dir-810l", "ralink,mt7620a-soc"; model = "D-Link DIR-810L"; + aliases { + led-status = &led_power_green; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -31,7 +33,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power_green: power { label = "dir-810l:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; }; @@ -41,7 +43,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; }; - status { + power2 { label = "dir-810l:orange:power"; gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; }; @@ -52,57 +54,61 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - factory5g: partition@50000 { - label = "factory5g"; - reg = <0x50000 0x10000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@60000 { - label = "Wolf_Config"; - reg = <0x60000 0x10000>; - read-only; - }; + factory5g: partition@50000 { + label = "factory5g"; + reg = <0x50000 0x10000>; + read-only; + }; - partition@70000 { - label = "MyDlink"; - reg = <0x70000 0x80000>; - read-only; - }; + partition@60000 { + label = "Wolf_Config"; + reg = <0x60000 0x10000>; + read-only; + }; - partition@e0000 { - label = "Jffs2"; - reg = <0xe0000 0x80000>; - read-only; - }; + partition@70000 { + label = "MyDlink"; + reg = <0x70000 0x80000>; + read-only; + }; - partition@170000 { - label = "firmware"; - reg = <0x170000 0x690000>; + partition@e0000 { + label = "Jffs2"; + reg = <0xe0000 0x80000>; + read-only; + }; + + partition@170000 { + label = "firmware"; + reg = <0x170000 0x690000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DIR-860L-B1.dts b/target/linux/ramips/dts/DIR-860L-B1.dts index 5dfc1eeae..b1eeb117a 100644 --- a/target/linux/ramips/dts/DIR-860L-B1.dts +++ b/target/linux/ramips/dts/DIR-860L-B1.dts @@ -9,6 +9,10 @@ compatible = "dlink,dir-860l-b1", "mediatek,mt7621-soc"; model = "D-Link DIR-860L B1"; + aliases { + led-status = &led_power_green; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; - power2 { + led_power_green: power2 { label = "dir-860l-b1:green:power"; gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; }; @@ -44,8 +48,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -66,69 +68,71 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x4000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - radio: partition@34000 { - label = "radio"; - reg = <0x34000 0x4000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x4000>; + read-only; + }; - factory: partition@38000 { - label = "factory"; - reg = <0x38000 0x8000>; - read-only; - }; + radio: partition@34000 { + label = "radio"; + reg = <0x34000 0x4000>; + read-only; + }; - partition@40000 { - label = "defaults"; - reg = <0x40000 0x10000>; - read-only; - }; + factory: partition@38000 { + label = "factory"; + reg = <0x38000 0x8000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + partition@40000 { + label = "defaults"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 0x2000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0x2000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 0>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/DUZUN-DM06.dts b/target/linux/ramips/dts/DUZUN-DM06.dts index b8261a591..a90ed7d34 100644 --- a/target/linux/ramips/dts/DUZUN-DM06.dts +++ b/target/linux/ramips/dts/DUZUN-DM06.dts @@ -16,8 +16,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -109,35 +107,39 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <60000000>; m25p,chunked-io = <32>; m25p,fast-read; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DWR-116-A1.dts b/target/linux/ramips/dts/DWR-116-A1.dts index 928e34ea4..bbafadd36 100644 --- a/target/linux/ramips/dts/DWR-116-A1.dts +++ b/target/linux/ramips/dts/DWR-116-A1.dts @@ -9,10 +9,12 @@ compatible = "dlink,dwr-116-a1", "ralink,mt7620n-soc"; model = "D-Link DWR-116 A1/A2"; + aliases { + led-status = &led_status; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -31,7 +33,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "dwr-116-a1:green:status"; gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; @@ -55,27 +57,31 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; - partition@0 { - label = "jboot"; - reg = <0x0 0x10000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@10000 { - label = "firmware"; - reg = <0x10000 0x7e0000>; - }; + partition@0 { + label = "jboot"; + reg = <0x0 0x10000>; + read-only; + }; - config: partition@7f0000 { - label = "config"; - reg = <0x7f0000 0x10000>; - read-only; + partition@10000 { + label = "firmware"; + reg = <0x10000 0x7e0000>; + }; + + config: partition@7f0000 { + label = "config"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/DWR-118-A2.dts b/target/linux/ramips/dts/DWR-118-A2.dts new file mode 100644 index 000000000..fd8f93241 --- /dev/null +++ b/target/linux/ramips/dts/DWR-118-A2.dts @@ -0,0 +1,177 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "dlink,dwr-118-a2", "ralink,mt7620a-soc"; + model = "D-Link DWR-118 A2"; + + aliases { + led-status = &led_internet; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "dwr-118-a2:green:wan"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + + led_internet: internet { + label = "dwr-118-a2:green:internet"; + gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "dwr-118-a2:green:lan"; + gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "dwr-118-a2:green:wlan2g"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "dwr-118-a2:green:usb"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "jboot"; + reg = <0x0 0x10000>; + read-only; + }; + + partition@10000 { + label = "firmware"; + reg = <0x10000 0xfe0000>; + }; + + config: partition@ff0000 { + label = "config"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "uartf", "spi refclk", "wled"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&config 0xe4a8>; + mtd-mac-address-increment = <(2)>; + + led { + led-sources = <2>; + led-active-low; + }; + }; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &mdio_pins>; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; diff --git a/target/linux/ramips/dts/DWR-512-B.dts b/target/linux/ramips/dts/DWR-512-B.dts index 74a33e10e..6860e9dfd 100644 --- a/target/linux/ramips/dts/DWR-512-B.dts +++ b/target/linux/ramips/dts/DWR-512-B.dts @@ -9,10 +9,12 @@ compatible = "dlink,dwr-512-b", "ralink,rt5350-soc"; model = "D-Link DWR-512 B"; + aliases { + led-status = &led_status; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -35,7 +37,7 @@ label = "dwr-512-b:green:sms"; gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; }; - status { + led_status: status { label = "dwr-512-b:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -77,27 +79,31 @@ status = "okay"; mx25l6405d@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <30000000>; m25p,fast-read; - partition@0 { - label = "jboot"; - reg = <0x0 0x10000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@10000 { - label = "firmware"; - reg = <0x10000 0x7e0000>; - }; + partition@0 { + label = "jboot"; + reg = <0x0 0x10000>; + read-only; + }; - config: partition@7f0000 { - label = "config"; - reg = <0x7f0000 0x10000>; + partition@10000 { + label = "firmware"; + reg = <0x10000 0x7e0000>; + }; + + config: partition@7f0000 { + label = "config"; + reg = <0x7f0000 0x10000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/DWR-921-C1.dts b/target/linux/ramips/dts/DWR-921-C1.dts index dbcbc17d8..b94ce95bb 100644 --- a/target/linux/ramips/dts/DWR-921-C1.dts +++ b/target/linux/ramips/dts/DWR-921-C1.dts @@ -9,10 +9,12 @@ compatible = "dlink,dwr-921-c1", "ralink,mt7620n-soc"; model = "D-Link DWR-921 C1"; + aliases { + led-status = &led_sstrenghg; + }; + gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; + compatible = "gpio-keys-polled"; poll-interval = <20>; wps { @@ -41,7 +43,7 @@ gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; }; - sstrengthg { + led_sstrenghg: sstrengthg { label = "dwr-921-c1:green:sigstrength"; gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; }; @@ -95,27 +97,31 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "jboot"; - reg = <0x0 0x10000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@10000 { - label = "firmware"; - reg = <0x10000 0xfe0000>; - }; + partition@0 { + label = "jboot"; + reg = <0x0 0x10000>; + read-only; + }; - config: partition@ff0000 { - label = "config"; - reg = <0xff0000 0x10000>; - read-only; + partition@10000 { + label = "firmware"; + reg = <0x10000 0xfe0000>; + }; + + config: partition@ff0000 { + label = "config"; + reg = <0xff0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/E1700.dts b/target/linux/ramips/dts/E1700.dts index f65f14492..75e1e0782 100644 --- a/target/linux/ramips/dts/E1700.dts +++ b/target/linux/ramips/dts/E1700.dts @@ -19,10 +19,12 @@ compatible = "linksys,e1700", "ralink,mt7620a-soc"; model = "Linksys E1700"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -41,7 +43,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "e1700:green:power"; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; }; @@ -57,33 +59,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -146,7 +152,6 @@ &gsw { mediatek,port4 = "gmac"; - mediatek,mt7530 = <1>; }; &wmac { diff --git a/target/linux/ramips/dts/ESR-9753.dts b/target/linux/ramips/dts/ESR-9753.dts index 444bea1af..590727370 100644 --- a/target/linux/ramips/dts/ESR-9753.dts +++ b/target/linux/ramips/dts/ESR-9753.dts @@ -9,42 +9,50 @@ compatible = "engenius,esr-9753", "ralink,rt3052-soc"; model = "Senao / EnGenius ESR-9753"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "esr-9753:orange:power"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/EW1200.dts b/target/linux/ramips/dts/EW1200.dts index 84c4f72cb..b7b15137e 100644 --- a/target/linux/ramips/dts/EW1200.dts +++ b/target/linux/ramips/dts/EW1200.dts @@ -9,6 +9,10 @@ compatible = "afoundry,ew1200", "mediatek,mt7621-soc"; model = "EW1200"; + aliases { + led-status = &led_run; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -26,8 +30,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -40,7 +42,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_run: run { label = "ew1200:green:run"; gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; }; @@ -60,57 +62,59 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/EX2700.dts b/target/linux/ramips/dts/EX2700.dts index 380db801d..fd0def609 100644 --- a/target/linux/ramips/dts/EX2700.dts +++ b/target/linux/ramips/dts/EX2700.dts @@ -19,6 +19,10 @@ compatible = "netgear,ex2700", "ralink,mt7620a-soc"; model = "Netgear EX2700"; + aliases { + led-status = &led_power_green; + }; + chosen { bootargs = "console=ttyS0,57600"; }; @@ -26,7 +30,7 @@ gpio-leds { compatible = "gpio-leds"; - power_g { + led_power_green: power_g { label = "ex2700:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; default-state = "on"; @@ -65,8 +69,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -95,33 +97,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0x3b0000>; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - art: partition@3f0000 { - label = "art"; - reg = <0x3f0000 0x10000>; - read-only; + partition@40000 { + label = "firmware"; + reg = <0x40000 0x3b0000>; + }; + + art: partition@3f0000 { + label = "art"; + reg = <0x3f0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/EX3700.dts b/target/linux/ramips/dts/EX3700.dts index 18079ea79..2f284e9ac 100644 --- a/target/linux/ramips/dts/EX3700.dts +++ b/target/linux/ramips/dts/EX3700.dts @@ -11,6 +11,10 @@ compatible = "netgear,ex3700", "ralink,mt7620a-soc"; model = "Netgear EX3700/EX3800"; + aliases { + led-status = &led_power_green; + }; + chosen { bootargs = "console=ttyS0,57600"; }; @@ -18,7 +22,7 @@ gpio-leds { compatible = "gpio-leds"; - power_g { + led_power_green: power_g { label = "ex3700:green:power"; gpios = <&gpio2 23 GPIO_ACTIVE_LOW>; default-state = "on"; @@ -58,8 +62,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -88,59 +90,62 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x790000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@7e0000 { - label = "board_data"; - reg = <0x7e0000 0x10000>; - read-only; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; - partition@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x10000>; - read-only; + partition@7e0000 { + label = "board_data"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "nvram"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0 >; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0 >; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/F5D8235_V1.dts b/target/linux/ramips/dts/F5D8235_V1.dts index 79920922d..f588c9fb2 100644 --- a/target/linux/ramips/dts/F5D8235_V1.dts +++ b/target/linux/ramips/dts/F5D8235_V1.dts @@ -11,8 +11,8 @@ compatible = "belkin,f5d8235-v1", "ralink,rt2880-soc"; model = "Belkin F5D8235 v1"; - pci@440000 { - status = "ok"; + aliases { + led-status = &led_wired_blue; }; cfi@1f000000 { @@ -20,30 +20,34 @@ reg = <0xbc400000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -96,8 +100,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { @@ -161,7 +163,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; - wired { + led_wired_blue: wired { label = "f5d8235-v1:blue:wired"; gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; }; @@ -205,6 +207,10 @@ }; }; +&pci { + status = "okay"; +}; + &wmac { status = "okay"; ralink,mtd-eeprom = <&factory 0x0>; diff --git a/target/linux/ramips/dts/F5D8235_V2.dts b/target/linux/ramips/dts/F5D8235_V2.dts index 5e32d7ff7..f075dff49 100644 --- a/target/linux/ramips/dts/F5D8235_V2.dts +++ b/target/linux/ramips/dts/F5D8235_V2.dts @@ -9,33 +9,41 @@ compatible = "belkin,f5d8235-v2", "ralink,rt3052-soc"; model = "Belkin F5D8235 v2"; + aliases { + led-status = &led_router; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - uboot: partition@0 { - label = "uboot"; - reg = <0x0 0x50000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x790000>; - }; + uboot: partition@0 { + label = "uboot"; + reg = <0x0 0x50000>; + read-only; + }; - partition@7e0000 { - label = "nvram"; - reg = <0x7e0000 0x10000>; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; - factory: partition@7f0000 { - label = "factory"; - reg = <0x7f0000 0x10000>; + partition@7e0000 { + label = "nvram"; + reg = <0x7e0000 0x10000>; + }; + + factory: partition@7f0000 { + label = "factory"; + reg = <0x7f0000 0x10000>; + }; }; }; @@ -68,7 +76,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - router { + led_router: router { label = "f5d8235-v2:blue:router"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/F7C027.dts b/target/linux/ramips/dts/F7C027.dts index 532c6243b..e97f8b4f4 100644 --- a/target/linux/ramips/dts/F7C027.dts +++ b/target/linux/ramips/dts/F7C027.dts @@ -9,6 +9,10 @@ compatible = "belkin,f7c027", "ralink,rt5350-soc"; model = "Belkin F7C027"; + aliases { + led-status = &led_status_orange; + }; + gpio-leds { compatible = "gpio-leds"; @@ -22,7 +26,7 @@ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; - orange { + led_status_orange: orange { label = "f7c027:orange:status"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; @@ -35,8 +39,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; top { @@ -63,58 +65,62 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x770000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@7c0000 { - label = "firmware2"; - reg = <0x7c0000 0x770000>; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x770000>; + }; - partition@f30000 { - label = "belkin_settings"; - reg = <0xf30000 0xa0000>; - }; + partition@7c0000 { + label = "firmware2"; + reg = <0x7c0000 0x770000>; + }; - partition@fd0000 { - label = "unknown"; - reg = <0xfd0000 0x10000>; - }; + partition@f30000 { + label = "belkin_settings"; + reg = <0xf30000 0xa0000>; + }; - partition@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x10000>; - }; + partition@fd0000 { + label = "unknown"; + reg = <0xfd0000 0x10000>; + }; - partition@ff0000 { - label = "user_factory"; - reg = <0xff0000 0x10000>; + partition@fe0000 { + label = "nvram"; + reg = <0xfe0000 0x10000>; + }; + + partition@ff0000 { + label = "user_factory"; + reg = <0xff0000 0x10000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/FIREWRT.dts b/target/linux/ramips/dts/FIREWRT.dts index 262dbb5f5..077c61286 100644 --- a/target/linux/ramips/dts/FIREWRT.dts +++ b/target/linux/ramips/dts/FIREWRT.dts @@ -9,6 +9,10 @@ compatible = "firefly,firewrt", "mediatek,mt7621-soc"; model = "Firefly FireWRT"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "firewrt:green:power"; gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; }; @@ -29,8 +33,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -55,57 +57,59 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/FONERA20N.dts b/target/linux/ramips/dts/FONERA20N.dts index bc7474ccf..17bf4a83f 100644 --- a/target/linux/ramips/dts/FONERA20N.dts +++ b/target/linux/ramips/dts/FONERA20N.dts @@ -9,35 +9,43 @@ compatible = "fon,fonera20n", "ralink,rt3052-soc"; model = "La Fonera 2.0N"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -49,7 +57,7 @@ gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "fonera20n:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -62,8 +70,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -95,34 +101,42 @@ }; &esw { + #address-cells = <1>; + #size-cells = <0>; + mediatek,portmap = <0x2f>; port@0 { compatible = "swconfig,port"; + reg = <0>; swconfig,segment = "lan"; swconfig,portmap = <0 4>; }; port@1 { compatible = "swconfig,port"; + reg = <1>; swconfig,segment = "lan"; swconfig,portmap = <1 3>; }; port@2 { compatible = "swconfig,port"; + reg = <2>; swconfig,segment = "lan"; swconfig,portmap = <2 2>; }; port@3 { compatible = "swconfig,port"; + reg = <3>; swconfig,segment = "lan"; swconfig,portmap = <3 1>; }; port@4 { compatible = "swconfig,port"; + reg = <4>; swconfig,segment = "wan"; swconfig,portmap = <4 0>; }; diff --git a/target/linux/ramips/dts/FREESTATION5.dts b/target/linux/ramips/dts/FREESTATION5.dts index 38f058dfa..b518a4121 100644 --- a/target/linux/ramips/dts/FREESTATION5.dts +++ b/target/linux/ramips/dts/FREESTATION5.dts @@ -18,50 +18,58 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; gpio-export { compatible = "gpio-export"; - // Used to enable power-over-ethernet passthrough from port0 to port1. - // Disable passthrough by default to prevent accidental equipment damage. + /* + * Used to enable power-over-ethernet passthrough from port0 to port1. + * Disable passthrough by default to prevent accidental equipment damage. + */ poe { gpio-export,name = "poe-passthrough"; - gpio-export,output = <1>; // OUT_INIT_HIGH - gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; // GPIO 11, ACTIVE_LOW + gpio-export,output = <1>; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; }; gpio-leds { compatible = "gpio-leds"; - // The following leds are defined in the ArcOS firmware, but reportedly - // not present in the Freestation5 device. + /* + * The following leds are defined in the ArcOS firmware, but reportedly + * not present in the Freestation5 device. + */ wifi { label = "freestation5:unknown:wifi"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/GB-PC1.dts b/target/linux/ramips/dts/GB-PC1.dts index 2ea6582e0..996d7c8b5 100644 --- a/target/linux/ramips/dts/GB-PC1.dts +++ b/target/linux/ramips/dts/GB-PC1.dts @@ -9,6 +9,10 @@ compatible = "gnubee,gb-pc1", "mediatek,mt7621-soc"; model = "GB-PC1"; + aliases { + led-status = &led_status; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -39,7 +41,7 @@ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "gb-pc1:green:status"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -64,34 +66,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/GB-PC2.dts b/target/linux/ramips/dts/GB-PC2.dts index ccaf54f3c..1e7f3b2ea 100644 --- a/target/linux/ramips/dts/GB-PC2.dts +++ b/target/linux/ramips/dts/GB-PC2.dts @@ -9,6 +9,10 @@ compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc"; model = "GB-PC2"; + aliases { + led-status = &led_status; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -39,7 +41,7 @@ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "gb-pc2:green:status"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -63,49 +65,49 @@ label = "gb-pc2:green:lan3"; gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; }; - }; }; &sdhci { status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&sdhci_pins>; }; &spi0 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; @@ -126,7 +128,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "jtag", "rgmii3", "uart3", "wdt"; + ralink,group = "jtag", "rgmii2", "uart3", "wdt"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/GL-MT300A.dts b/target/linux/ramips/dts/GL-MT300A.dts index ed954ce87..d83bb3955 100644 --- a/target/linux/ramips/dts/GL-MT300A.dts +++ b/target/linux/ramips/dts/GL-MT300A.dts @@ -35,13 +35,10 @@ label = "gl-mt300a:usb"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -55,12 +52,12 @@ linux,code = ; }; - BTN_1 { + BTN_1 { label = "BTN_1"; gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; linux,code = ; }; - }; + }; }; &gpio0 { @@ -74,7 +71,7 @@ &gpio2 { status = "okay"; }; - + &gpio3 { status = "okay"; }; @@ -83,37 +80,41 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@ff0000 { - label = "art"; - reg = <0xff0000 0x10000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/GL-MT300N-V2.dts b/target/linux/ramips/dts/GL-MT300N-V2.dts index ada618f17..b41a9ae66 100644 --- a/target/linux/ramips/dts/GL-MT300N-V2.dts +++ b/target/linux/ramips/dts/GL-MT300N-V2.dts @@ -6,9 +6,13 @@ #include /{ - compatible = "glinet,gl-mt300n-v2", "ralink,mt7620an-soc"; + compatible = "glinet,gl-mt300n-v2", "mediatek,mt7628an-soc"; model = "GL-MT300N-V2"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "gl-mt300n-v2:green:power"; default-state = "on"; gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; @@ -40,8 +44,6 @@ gpio-keys { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -73,7 +75,6 @@ gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; }; }; - }; &pinctrl { @@ -98,34 +99,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/GL-MT300N.dts b/target/linux/ramips/dts/GL-MT300N.dts index 27f3d065e..644cfed28 100644 --- a/target/linux/ramips/dts/GL-MT300N.dts +++ b/target/linux/ramips/dts/GL-MT300N.dts @@ -30,13 +30,10 @@ label = "gl-mt300n:wlan"; gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -50,7 +47,7 @@ linux,code = ; }; - BTN_1 { + BTN_1 { label = "BTN_1"; gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; linux,code = ; @@ -69,7 +66,7 @@ &gpio2 { status = "okay"; }; - + &gpio3 { status = "okay"; }; @@ -78,37 +75,41 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@ff0000 { - label = "art"; - reg = <0xff0000 0x10000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/GL-MT750.dts b/target/linux/ramips/dts/GL-MT750.dts index 007f745b6..7786620cc 100644 --- a/target/linux/ramips/dts/GL-MT750.dts +++ b/target/linux/ramips/dts/GL-MT750.dts @@ -30,13 +30,10 @@ label = "gl-mt750:wlan"; gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -50,12 +47,12 @@ linux,code = ; }; - BTN_1 { + BTN_1 { label = "BTN_1"; gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; linux,code = ; }; - }; + }; }; &gpio0 { @@ -69,7 +66,7 @@ &gpio2 { status = "okay"; }; - + &gpio3 { status = "okay"; }; @@ -78,37 +75,41 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@ff0000 { - label = "art"; - reg = <0xff0000 0x10000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + }; }; }; }; @@ -136,13 +137,12 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/HC5661.dts b/target/linux/ramips/dts/HC5661.dts index 5227ee06c..c7d6039a0 100644 --- a/target/linux/ramips/dts/HC5661.dts +++ b/target/linux/ramips/dts/HC5661.dts @@ -6,10 +6,14 @@ compatible = "hiwifi,hc5661", "hiwifi,hc5x61", "ralink,mt7620a-soc"; model = "HiWiFi HC5661"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "hc5661:blue:system"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/HC5661A.dts b/target/linux/ramips/dts/HC5661A.dts index 9ca734f0a..7541677ab 100644 --- a/target/linux/ramips/dts/HC5661A.dts +++ b/target/linux/ramips/dts/HC5661A.dts @@ -9,6 +9,10 @@ compatible = "hiwifi,hc5661a", "mediatek,mt7628an-soc"; model = "HiWiFi HC5661A"; + aliases { + led-status = &led_system; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "hc5661a:blue:system"; gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; }; @@ -37,8 +41,6 @@ gpio-keys { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -58,57 +60,65 @@ }; }; +&sdhci { + status = "okay"; +}; + &spi0 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "hw_panic"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "hw_panic"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf70000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@fc0000 { - label = "oem"; - reg = <0xfc0000 0x20000>; - read-only; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf70000>; + }; - bdinfo: partition@fe0000 { - label = "bdinfo"; - reg = <0xfe0000 0x10000>; - read-only; - }; + partition@fc0000 { + label = "oem"; + reg = <0xfc0000 0x20000>; + read-only; + }; - partition@ff0000 { - label = "backup"; - reg = <0xff0000 0x10000>; - read-only; + bdinfo: partition@fe0000 { + label = "bdinfo"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "backup"; + reg = <0xff0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/HC5761.dts b/target/linux/ramips/dts/HC5761.dts index 6cc7c6ba7..64b6d27af 100644 --- a/target/linux/ramips/dts/HC5761.dts +++ b/target/linux/ramips/dts/HC5761.dts @@ -6,10 +6,14 @@ compatible = "hiwifi,hc5761", "hiwifi,hc5x61", "ralink,mt7620a-soc"; model = "HiWiFi HC5761"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "hc5761:blue:system"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/HC5861.dts b/target/linux/ramips/dts/HC5861.dts index 8773588e3..d6049fd8e 100644 --- a/target/linux/ramips/dts/HC5861.dts +++ b/target/linux/ramips/dts/HC5861.dts @@ -6,10 +6,14 @@ compatible = "hiwifi,hc5861", "hiwifi,hc5x61", "ralink,mt7620a-soc"; model = "HiWiFi HC5861"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "hc5861:blue:system"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/HC5861B.dts b/target/linux/ramips/dts/HC5861B.dts new file mode 100644 index 000000000..e4a4cce81 --- /dev/null +++ b/target/linux/ramips/dts/HC5861B.dts @@ -0,0 +1,141 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "hiwifi,hc5861b", "mediatek,mt7628an-soc"; + model = "HiWiFi HC5861B"; + + aliases { + led-status = &led_system; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_system: system { + label = "hc5861b:green:system"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + wlan2g { + label = "hc5861b:green:wlan2g"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "refclk", "wdt", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "hw_panic"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf70000>; + }; + + partition@fc0000 { + label = "oem"; + reg = <0xfc0000 0x20000>; + read-only; + }; + + bdinfo: partition@fe0000 { + label = "bdinfo"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "backup"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + mtd-mac-address = <&factory 0x2e>; + ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; + }; +}; diff --git a/target/linux/ramips/dts/HC5962.dts b/target/linux/ramips/dts/HC5962.dts index c6fc7cb15..1bad7e6a1 100644 --- a/target/linux/ramips/dts/HC5962.dts +++ b/target/linux/ramips/dts/HC5962.dts @@ -9,6 +9,10 @@ compatible = "hiwifi,hc5962", "mediatek,mt7621-soc"; model = "HiWiFi HC5962"; + aliases { + led-status = &led_status; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "hc5962:white:status"; gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -49,92 +51,96 @@ &nand { status = "okay"; - partition@0 { - label = "u-boot"; - reg = <0x0 0x80000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@80000 { - label = "debug"; - reg = <0x80000 0x80000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; + partition@80000 { + label = "debug"; + reg = <0x80000 0x80000>; + read-only; + }; - partition@140000 { - label = "kernel"; - reg = <0x140000 0x200000>; - }; + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; - partition@340000 { - label = "ubi"; - reg = <0x340000 0x1E00000>; - }; + partition@140000 { + label = "kernel"; + reg = <0x140000 0x200000>; + }; - partition@2140000 { - label = "hw_panic"; - reg = <0x2140000 0x80000>; - read-only; - }; + partition@340000 { + label = "ubi"; + reg = <0x340000 0x1E00000>; + }; - partition@21c0000 { - label = "bdinfo"; - reg = <0x21c0000 0x80000>; - read-only; - }; + partition@2140000 { + label = "hw_panic"; + reg = <0x2140000 0x80000>; + read-only; + }; - partition@2240000 { - label = "backup"; - reg = <0x2240000 0x80000>; - read-only; - }; + partition@21c0000 { + label = "bdinfo"; + reg = <0x21c0000 0x80000>; + read-only; + }; - partition@22c0000 { - label = "overly"; - reg = <0x22c0000 0x1000000>; - }; + partition@2240000 { + label = "backup"; + reg = <0x2240000 0x80000>; + read-only; + }; - partition@32c0000 { - label = "firmware_backup"; - reg = <0x32c0000 0x2000000>; - }; + partition@22c0000 { + label = "overly"; + reg = <0x22c0000 0x1000000>; + }; - partition@52c0000 { - label = "oem"; - reg = <0x52c0000 0x200000>; - }; + partition@32c0000 { + label = "firmware_backup"; + reg = <0x32c0000 0x2000000>; + }; - partition@54c0000 { - label = "opt"; - reg = <0x54c0000 0x2ac0000>; + partition@52c0000 { + label = "oem"; + reg = <0x52c0000 0x200000>; + }; + + partition@54c0000 { + label = "opt"; + reg = <0x54c0000 0x2ac0000>; + }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/HC5X61.dtsi b/target/linux/ramips/dts/HC5X61.dtsi index f0b59ecf1..674ce23cb 100644 --- a/target/linux/ramips/dts/HC5X61.dtsi +++ b/target/linux/ramips/dts/HC5X61.dtsi @@ -12,8 +12,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -57,46 +55,50 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + }; - partition@fd0000 { - label = "hwf_config"; - reg = <0xfd0000 0x10000>; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; - bdinfo: partition@fe0000 { - label = "bdinfo"; - reg = <0xfe0000 0x10000>; - }; + partition@fd0000 { + label = "hwf_config"; + reg = <0xfd0000 0x10000>; + }; - partition@ff0000 { - label = "backup"; - reg = <0xff0000 0x10000>; + bdinfo: partition@fe0000 { + label = "bdinfo"; + reg = <0xfe0000 0x10000>; + }; + + partition@ff0000 { + label = "backup"; + reg = <0xff0000 0x10000>; + }; }; }; }; @@ -133,7 +135,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "uartf", "wled", "nd_sd"; + ralink,group = "uartf", "wled"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/HG255D.dts b/target/linux/ramips/dts/HG255D.dts index bed5977ac..0e4ad421e 100644 --- a/target/linux/ramips/dts/HG255D.dts +++ b/target/linux/ramips/dts/HG255D.dts @@ -9,48 +9,56 @@ compatible = "huawei,hg255d", "ralink,rt3052-soc"; model = "HuaWei HG255D"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x1000000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x40000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x40000 0x20000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; - factory: partition@60000 { - label = "factory"; - reg = <0x60000 0x20000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x40000 0x20000>; + read-only; + }; - partition@80000 { - label = "firmware"; - reg = <0x80000 0xf60000>; - }; + factory: partition@60000 { + label = "factory"; + reg = <0x60000 0x20000>; + read-only; + }; - partition@fa0000 { - label = "factory-orig"; - reg = <0xfa0000 0x20000>; - read-only; + partition@80000 { + label = "firmware"; + reg = <0x80000 0xf60000>; + }; + + partition@fa0000 { + label = "factory-orig"; + reg = <0xfa0000 0x20000>; + read-only; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "hg255d:green:power"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -83,8 +91,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <10>; reset { diff --git a/target/linux/ramips/dts/HLKRM04.dts b/target/linux/ramips/dts/HLKRM04.dts index 301330549..52621aa41 100644 --- a/target/linux/ramips/dts/HLKRM04.dts +++ b/target/linux/ramips/dts/HLKRM04.dts @@ -39,8 +39,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -63,33 +61,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/HPM.dts b/target/linux/ramips/dts/HPM.dts index 904c8df9f..9d50697d8 100644 --- a/target/linux/ramips/dts/HPM.dts +++ b/target/linux/ramips/dts/HPM.dts @@ -9,14 +9,16 @@ compatible = "omnima,hpm", "ralink,rt3883-soc"; model = "Omnima HPM"; + aliases { + led-status = &led_status; + }; + chosen { bootargs = "console=ttyS0,115200"; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -32,11 +34,13 @@ power { label = "hpm:orange:power"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + default-state = "on"; }; - status { + led_status: status { label = "hpm:green:status"; gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + default-state = "on"; }; eth { @@ -86,30 +90,34 @@ compatible = "jedec,spi-nor"; spi-max-frequency = <25000000>; reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - reg = <0x0 0x0030000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - reg = <0x00030000 0x00010000>; - label = "config"; - read-only; - }; + partition@0 { + reg = <0x0 0x0030000>; + label = "u-boot"; + read-only; + }; - factory: partition@40000 { - reg = <0x00040000 0x00010000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "config"; + read-only; + }; - partition@50000 { - reg = <0x00050000 0x00fb0000>; - label = "firmware"; + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x00fb0000>; + label = "firmware"; + }; }; }; }; diff --git a/target/linux/ramips/dts/HT-TM02.dts b/target/linux/ramips/dts/HT-TM02.dts index a28747250..d75d19ef4 100644 --- a/target/linux/ramips/dts/HT-TM02.dts +++ b/target/linux/ramips/dts/HT-TM02.dts @@ -9,10 +9,14 @@ compatible = "hootoo,ht-tm02", "ralink,rt5350-soc"; model = "HooToo HT-TM02"; + aliases { + led-status = &led_wlan; + }; + gpio-leds { compatible = "gpio-leds"; - wlan { + led_wlan: wlan { label = "ht-tm02:blue:wlan"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -52,33 +54,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/HW550-3G.dts b/target/linux/ramips/dts/HW550-3G.dts index f6a05fcd5..1b589b5f6 100644 --- a/target/linux/ramips/dts/HW550-3G.dts +++ b/target/linux/ramips/dts/HW550-3G.dts @@ -9,35 +9,43 @@ compatible = "aztech,hw550-3g", "ralink,rt3052-soc"; model = "Aztech HW550-3G"; + aliases { + led-status = &led_status; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -54,7 +62,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "hw550-3g:green:status"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -67,8 +75,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/IP2202.dts b/target/linux/ramips/dts/IP2202.dts index 260846e16..ed4e5a972 100644 --- a/target/linux/ramips/dts/IP2202.dts +++ b/target/linux/ramips/dts/IP2202.dts @@ -9,42 +9,50 @@ compatible = "poray,ip2202", "ralink,rt3052-soc"; model = "Poray IP2202"; + aliases { + led-status = &led_run; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - run { + led_run: run { label = "ip2202:green:run"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/JHR-N805R.dts b/target/linux/ramips/dts/JHR-N805R.dts index d043e0f05..f5a084048 100644 --- a/target/linux/ramips/dts/JHR-N805R.dts +++ b/target/linux/ramips/dts/JHR-N805R.dts @@ -9,26 +9,28 @@ compatible = "jcg,jhr-n805r", "ralink,rt3050-soc"; model = "JCG JHR-N805R"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "jhr-n805r:blue:system"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; }; - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; - reset { - label = "reset"; - gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; - linux,code = ; - }; + reset { + label = "reset"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; }; }; @@ -45,33 +47,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/JHR-N825R.dts b/target/linux/ramips/dts/JHR-N825R.dts index 5e64b2cc0..d04b20288 100644 --- a/target/linux/ramips/dts/JHR-N825R.dts +++ b/target/linux/ramips/dts/JHR-N825R.dts @@ -9,41 +9,49 @@ compatible = "jcg,jhr-n825r", "ralink,rt3052-soc"; model = "JCG JHR-N825R"; + aliases { + led-status = &led_system; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "jhr-n825r:red:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -51,8 +59,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { label = "reset_wps"; diff --git a/target/linux/ramips/dts/JHR-N926R.dts b/target/linux/ramips/dts/JHR-N926R.dts index d1d2627f2..9e043ddc1 100644 --- a/target/linux/ramips/dts/JHR-N926R.dts +++ b/target/linux/ramips/dts/JHR-N926R.dts @@ -9,35 +9,43 @@ compatible = "jcg,jhr-n926r", "ralink,rt3052-soc"; model = "JCG JHR-N926R"; + aliases { + led-status = &led_system; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -59,7 +67,7 @@ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; }; - system { + led_system: system { label = "jhr-n926r:blue:system"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -90,8 +98,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { diff --git a/target/linux/ramips/dts/K2G.dts b/target/linux/ramips/dts/K2G.dts index 7aed533c3..891b08998 100644 --- a/target/linux/ramips/dts/K2G.dts +++ b/target/linux/ramips/dts/K2G.dts @@ -10,6 +10,7 @@ model = "Phicomm K2G"; aliases { + led-status = &led_blue; serial0 = &uartlite; }; @@ -34,8 +35,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -50,8 +49,6 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <24000000>; @@ -61,28 +58,33 @@ #address-cells = <1>; #size-cells = <1>; - u-boot@0 { + partition@0 { reg = <0x0 0x30000>; + label = "u-boot"; read-only; }; - u-boot-env@30000 { + partition@30000 { reg = <0x30000 0x10000>; + label = "u-boot-env"; read-only; }; - factory: factory@40000 { + factory: partition@40000 { reg = <0x40000 0x10000>; + label = "factory"; read-only; }; - permanent_config@50000 { + partition@50000 { reg = <0x50000 0x50000>; + label = "permanent_config"; read-only; }; - firmware@a0000 { + partition@a0000 { reg = <0xa0000 0x760000>; + label = "firmware"; }; }; }; @@ -121,14 +123,13 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/K2P.dts b/target/linux/ramips/dts/K2P.dts index db4dc2987..50d29edbe 100644 --- a/target/linux/ramips/dts/K2P.dts +++ b/target/linux/ramips/dts/K2P.dts @@ -9,6 +9,10 @@ compatible = "phicomm,k2p", "mediatek,mt7621-soc"; model = "Phicomm K2P"; + aliases { + led-status = &led_blue; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -31,7 +35,7 @@ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; - stat_b { + led_blue: stat_b { label = "k2p:blue:status"; gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; }; @@ -39,8 +43,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -55,53 +57,56 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "permanent_config"; - reg = <0x50000 0x50000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@a0000 { - label = "firmware"; - reg = <0xa0000 0xf60000>; + partition@50000 { + label = "permanent_config"; + reg = <0x50000 0x50000>; + read-only; + }; + + partition@a0000 { + label = "firmware"; + reg = <0xa0000 0xf60000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; }; }; diff --git a/target/linux/ramips/dts/LINKIT7688.dts b/target/linux/ramips/dts/LINKIT7688.dts index a81a2d5a4..600f1b46a 100644 --- a/target/linux/ramips/dts/LINKIT7688.dts +++ b/target/linux/ramips/dts/LINKIT7688.dts @@ -9,6 +9,10 @@ compatible = "mediatek,linkit-smart-7688", "mediatek,mt7628an-soc"; model = "MediaTek LinkIt Smart 7688"; + aliases { + led-status = &led_wifi; + }; + chosen { bootargs = "console=ttyS2,57600"; }; @@ -31,7 +35,7 @@ gpio-leds { compatible = "gpio-leds"; - wifi { + led_wifi: wifi { label = "linkit-smart-7688:orange:wifi"; gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; }; @@ -39,8 +43,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -96,33 +98,37 @@ pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; diff --git a/target/linux/ramips/dts/M2M.dts b/target/linux/ramips/dts/M2M.dts index d828f5a74..2e9092a4b 100644 --- a/target/linux/ramips/dts/M2M.dts +++ b/target/linux/ramips/dts/M2M.dts @@ -9,6 +9,10 @@ compatible = "intenso,memory2move", "ralink,rt5350-soc"; model = "Intenso Memory 2 Move"; + aliases { + led-status = &led_wifi; + }; + chosen { bootargs = "console=ttyS0,57600n8 root=/dev/mtdblock5"; }; @@ -16,7 +20,7 @@ gpio-leds { compatible = "gpio-leds"; - wifi { + led_wifi: wifi { label = "m2m:blue:wifi"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -29,8 +33,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; power { @@ -51,33 +53,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "Bootloader"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "Config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "Factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "Config"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "Factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/M3.dts b/target/linux/ramips/dts/M3.dts index 5f52e6064..43b1cbf83 100644 --- a/target/linux/ramips/dts/M3.dts +++ b/target/linux/ramips/dts/M3.dts @@ -9,10 +9,14 @@ compatible = "poray,m3", "ralink,rt5350-soc"; model = "Poray M3"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "m3:blue:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -43,33 +45,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/M4-4M.dts b/target/linux/ramips/dts/M4-4M.dts index 914eaf364..7db48ebfc 100644 --- a/target/linux/ramips/dts/M4-4M.dts +++ b/target/linux/ramips/dts/M4-4M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/M4-8M.dts b/target/linux/ramips/dts/M4-8M.dts index 8fcca21eb..9429eeadf 100644 --- a/target/linux/ramips/dts/M4-8M.dts +++ b/target/linux/ramips/dts/M4-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/M4.dtsi b/target/linux/ramips/dts/M4.dtsi index f657325b5..e56ea8261 100644 --- a/target/linux/ramips/dts/M4.dtsi +++ b/target/linux/ramips/dts/M4.dtsi @@ -6,10 +6,14 @@ / { compatible = "poray,m4", "ralink,rt5350-soc"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "m4:blue:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -17,8 +21,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/MAC1200RV2.dts b/target/linux/ramips/dts/MAC1200RV2.dts index bcbe55f3f..3e2b60268 100644 --- a/target/linux/ramips/dts/MAC1200RV2.dts +++ b/target/linux/ramips/dts/MAC1200RV2.dts @@ -9,6 +9,10 @@ compatible = "mercury,mac1200r-v2", "mediatek,mt7628an-soc"; model = "Mercury MAC1200R v2"; + aliases { + led-status = &led_status; + }; + chosen { bootargs = "console=ttyS0,57600"; }; @@ -20,7 +24,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "mac1200rv2:green:status"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; @@ -31,43 +35,47 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0 0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x1d800>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - factory: partition@0x1d800 { - label = "factory_info"; - reg = <0x1d800 0x800>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x1d800>; + }; - art: partition@0x1e000 { - label = "art"; - reg = <0x1e000 0x2000>; - read-only; - }; + factory: partition@1d800 { + label = "factory_info"; + reg = <0x1d800 0x800>; + read-only; + }; - partition@20000 { - label = "config"; - reg = <0x20000 0x10000>; - }; + art: partition@1e000 { + label = "art"; + reg = <0x1e000 0x2000>; + read-only; + }; - partition@30000 { - label = "u-boot2"; - reg = <0x30000 0x10000>; - }; + partition@20000 { + label = "config"; + reg = <0x20000 0x10000>; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0x7c0000>; + partition@30000 { + label = "u-boot2"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7c0000>; + }; }; }; }; @@ -85,12 +93,12 @@ &pcie { status = "okay"; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&art 0x1000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&art 0x1000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/MINIEMBPLUG.dts b/target/linux/ramips/dts/MINIEMBPLUG.dts index 2f58eafdb..94d6b410f 100644 --- a/target/linux/ramips/dts/MINIEMBPLUG.dts +++ b/target/linux/ramips/dts/MINIEMBPLUG.dts @@ -25,8 +25,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -72,33 +70,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MINIEMBWIFI.dts b/target/linux/ramips/dts/MINIEMBWIFI.dts index d45518963..754e92e24 100644 --- a/target/linux/ramips/dts/MINIEMBWIFI.dts +++ b/target/linux/ramips/dts/MINIEMBWIFI.dts @@ -9,10 +9,14 @@ compatible = "omnima,miniembwifi", "ralink,rt3052-soc"; model = "Omnima MiniEMBWiFi"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "miniembwifi:green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -41,30 +43,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MIR3G.dts b/target/linux/ramips/dts/MIR3G.dts index efe98b0e1..ab49acfb3 100644 --- a/target/linux/ramips/dts/MIR3G.dts +++ b/target/linux/ramips/dts/MIR3G.dts @@ -9,6 +9,10 @@ compatible = "xiaomi,mir3g", "mediatek,mt7621-soc"; model = "Xiaomi Mi Router 3G"; + aliases { + led-status = &led_status_blue; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; - status_blue { + led_status_blue: status_blue { label = "mir3g:blue:status"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -50,13 +54,10 @@ label = "mir3g:amber:lan2"; gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -66,117 +67,125 @@ }; }; - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - usbpower { - gpio-export,name = "usbpower"; - gpio-export,output = <1>; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - }; + reg_usb_vbus: reg_usb_vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; + enable-active-high; }; }; +&xhci { + vbus-supply = <®_usb_vbus>; +}; + &nand { status = "okay"; - partition@0 { - label = "Bootloader"; - reg = <0x0 0x80000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@80000 { - label = "Config"; - reg = <0x80000 0x40000>; - }; + partition@0 { + label = "Bootloader"; + reg = <0x0 0x80000>; + read-only; + }; - partition@c0000 { - label = "Bdata"; - reg = <0xc0000 0x40000>; - read-only; - }; + partition@80000 { + label = "Config"; + reg = <0x80000 0x40000>; + }; - factory: partition@100000 { - label = "Factory"; - reg = <0x100000 0x40000>; - read-only; - }; + partition@c0000 { + label = "Bdata"; + reg = <0xc0000 0x40000>; + read-only; + }; - partition@140000 { - label = "crash"; - reg = <0x140000 0x40000>; - }; + factory: partition@100000 { + label = "Factory"; + reg = <0x100000 0x40000>; + read-only; + }; - partition@180000 { - label = "crash_syslog"; - reg = <0x180000 0x40000>; - }; + partition@140000 { + label = "crash"; + reg = <0x140000 0x40000>; + }; - partition@1c0000 { - label = "reserved0"; - reg = <0x1c0000 0x40000>; - read-only; - }; + partition@180000 { + label = "crash_syslog"; + reg = <0x180000 0x40000>; + }; - /* uboot expects to find kernels at 0x200000 & 0x600000 - * referred to as system 1 & system 2 respectively. - * a kernel is considered suitable for handing control over - * if its linux magic number exists & uImage CRC are correct. - * If either of those conditions fail, a matching sys'n'_fail flag - * is set in uboot env & a restart performed in the hope that the - * alternate kernel is okay. - * if neither kernel checksums ok and both are marked failed, system 2 - * is booted anyway. - * - * Note uboot's tftp flash install writes the transferred - * image to both kernel partitions. - */ + partition@1c0000 { + label = "reserved0"; + reg = <0x1c0000 0x40000>; + read-only; + }; - partition@200000 { - label = "kernel_stock"; - reg = <0x200000 0x400000>; - }; + /* uboot expects to find kernels at 0x200000 & 0x600000 + * referred to as system 1 & system 2 respectively. + * a kernel is considered suitable for handing control over + * if its linux magic number exists & uImage CRC are correct. + * If either of those conditions fail, a matching sys'n'_fail flag + * is set in uboot env & a restart performed in the hope that the + * alternate kernel is okay. + * if neither kernel checksums ok and both are marked failed, system 2 + * is booted anyway. + * + * Note uboot's tftp flash install writes the transferred + * image to both kernel partitions. + */ - partition@600000 { - label = "kernel"; - reg = <0x600000 0x400000>; - }; + partition@200000 { + label = "kernel_stock"; + reg = <0x200000 0x400000>; + }; - /* ubi partition is the result of squashing - * next consecutive stock partitions: - * - rootfs0 (rootfs partition for stock kernel0), - * - rootfs1 (rootfs partition for stock failsafe kernel1), - * - overlay (used as ubi overlay in stock fw) - * resulting 117,5MiB space for packages. - */ + partition@600000 { + label = "kernel"; + reg = <0x600000 0x400000>; + }; - partition@a00000 { - label = "ubi"; - reg = <0xa00000 0x7580000>; + /* ubi partition is the result of squashing + * next consecutive stock partitions: + * - rootfs0 (rootfs partition for stock kernel0), + * - rootfs1 (rootfs partition for stock failsafe kernel1), + * - overlay (used as ubi overlay in stock fw) + * resulting 117,5MiB space for packages. + */ + + partition@a00000 { + label = "ubi"; + reg = <0xa00000 0x7580000>; + }; }; }; &pcie { status = "okay"; +}; - pcie0 { - wifi@14c3,7603 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; +}; - pcie1 { - wifi@14c3,7662 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/MIWIFI-MINI.dts b/target/linux/ramips/dts/MIWIFI-MINI.dts index 3da39c529..89a688bfe 100644 --- a/target/linux/ramips/dts/MIWIFI-MINI.dts +++ b/target/linux/ramips/dts/MIWIFI-MINI.dts @@ -9,6 +9,10 @@ compatible = "xiaomi,miwifi-mini", "ralink,mt7620a-soc"; model = "Xiaomi MiWiFi Mini"; + aliases { + led-status = &led_blue; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -16,26 +20,27 @@ gpio-leds { compatible = "gpio-leds"; - blue { + led_blue: blue { label = "miwifi-mini:blue:status"; gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + default-state = "on"; }; yellow { label = "miwifi-mini:yellow:status"; gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + default-state = "off"; }; red { label = "miwifi-mini:red:status"; gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + default-state = "off"; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -62,48 +67,52 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@fd0000 { - label = "crash"; - reg = <0xfd0000 0x10000>; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; - partition@fe0000 { - label = "reserved"; - reg = <0xfe0000 0x10000>; - read-only; - }; + partition@fd0000 { + label = "crash"; + reg = <0xfd0000 0x10000>; + }; - partition@ff0000 { - label = "Bdata"; - reg = <0xff0000 0x10000>; + partition@fe0000 { + label = "reserved"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "Bdata"; + reg = <0xff0000 0x10000>; + }; }; }; }; @@ -131,14 +140,13 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/MIWIFI-NANO.dts b/target/linux/ramips/dts/MIWIFI-NANO.dts index b8a325d4f..823132cfa 100644 --- a/target/linux/ramips/dts/MIWIFI-NANO.dts +++ b/target/linux/ramips/dts/MIWIFI-NANO.dts @@ -9,6 +9,10 @@ compatible = "xiaomi,miwifi-nano", "mediatek,mt7628an-soc"; model = "MiWiFi Nano"; + aliases { + led-status = &led_blue; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - status_blue { + led_blue: status_blue { label = "miwifi-nano:blue:status"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; @@ -37,8 +41,6 @@ gpio-keys { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -71,34 +73,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MLW221.dts b/target/linux/ramips/dts/MLW221.dts index f4a715247..f6567dc9e 100644 --- a/target/linux/ramips/dts/MLW221.dts +++ b/target/linux/ramips/dts/MLW221.dts @@ -9,10 +9,14 @@ compatible = "kingston,mlw221", "ralink,mt7620n-soc"; model = "Kingston MLW221"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "mlw221:blue:system"; gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -59,38 +61,42 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf60000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@fb0000 { - label = "user-config"; - reg = <0xfb0000 0x50000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf60000>; + }; + + partition@fb0000 { + label = "user-config"; + reg = <0xfb0000 0x50000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MLWG2.dts b/target/linux/ramips/dts/MLWG2.dts index 58fce43b4..9c05b59d1 100644 --- a/target/linux/ramips/dts/MLWG2.dts +++ b/target/linux/ramips/dts/MLWG2.dts @@ -9,10 +9,14 @@ compatible = "kingston,mlwg2", "ralink,mt7620n-soc"; model = "Kingston MLWG2"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "mlwg2:blue:system"; gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -59,38 +61,42 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf60000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@fb0000 { - label = "user-config"; - reg = <0xfb0000 0x50000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf60000>; + }; + + partition@fb0000 { + label = "user-config"; + reg = <0xfb0000 0x50000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MOFI3500-3GN.dts b/target/linux/ramips/dts/MOFI3500-3GN.dts index f60919d5a..345c028d0 100644 --- a/target/linux/ramips/dts/MOFI3500-3GN.dts +++ b/target/linux/ramips/dts/MOFI3500-3GN.dts @@ -9,35 +9,43 @@ compatible = "mofinetwork,mofi3500-3gn", "ralink,rt3052-soc"; model = "MoFi Network MOFI3500-3GN"; + aliases { + led-status = &led_status; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -54,7 +62,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "mofi3500-3gn:green:status"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -67,8 +75,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/MPRA1.dts b/target/linux/ramips/dts/MPRA1.dts index 59dfe4ebd..22e2010e2 100644 --- a/target/linux/ramips/dts/MPRA1.dts +++ b/target/linux/ramips/dts/MPRA1.dts @@ -9,10 +9,14 @@ compatible = "hame,mpr-a1", "ralink,rt5350-soc"; model = "HAME MPR-A1"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "mpr-a1:blue:system"; gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -58,33 +60,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; @@ -96,7 +102,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf", "led"; + ralink,group = "i2c", "jtag", "uartf", "led"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/MPRA2.dts b/target/linux/ramips/dts/MPRA2.dts index 4bf9b5754..7c8cdd2eb 100644 --- a/target/linux/ramips/dts/MPRA2.dts +++ b/target/linux/ramips/dts/MPRA2.dts @@ -9,10 +9,14 @@ compatible = "hame,mpr-a2", "ralink,rt5350-soc"; model = "HAME MPR-A2"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "mpr-a2:blue:system"; gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -58,33 +60,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -92,7 +98,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/MR-102N.dts b/target/linux/ramips/dts/MR-102N.dts index 44569eb62..c278b9cb9 100644 --- a/target/linux/ramips/dts/MR-102N.dts +++ b/target/linux/ramips/dts/MR-102N.dts @@ -9,45 +9,53 @@ compatible = "aximcom,mr-102n", "ralink,rt3052-soc"; model = "AXIMCom MR-102N"; + aliases { + led-status = &led_status; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x790000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@7e0000 { - label = "nvram"; - reg = <0x7e0000 0x10000>; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; - partition@7f0000 { - label = "nvram_backup"; - reg = <0x7f0000 0x10000>; + partition@7e0000 { + label = "nvram"; + reg = <0x7e0000 0x10000>; + }; + + partition@7f0000 { + label = "nvram_backup"; + reg = <0x7f0000 0x10000>; + }; }; }; @@ -59,7 +67,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - status { + led_status: status { label = "mr-102n:amber:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -72,8 +80,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/MT7620a.dts b/target/linux/ramips/dts/MT7620a.dts index cbd7319a8..bb7b60405 100644 --- a/target/linux/ramips/dts/MT7620a.dts +++ b/target/linux/ramips/dts/MT7620a.dts @@ -11,8 +11,6 @@ gpio-keys-polled { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; s2 { @@ -33,33 +31,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MT7620a_MT7530.dts b/target/linux/ramips/dts/MT7620a_MT7530.dts index 70f92536f..706ba72d1 100644 --- a/target/linux/ramips/dts/MT7620a_MT7530.dts +++ b/target/linux/ramips/dts/MT7620a_MT7530.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -100,7 +104,6 @@ &gsw { mediatek,port4 = "gmac"; - mediatek,mt7530 = <1>; }; &pcie { diff --git a/target/linux/ramips/dts/MT7620a_MT7610e.dts b/target/linux/ramips/dts/MT7620a_MT7610e.dts index d5f5dbba9..6bbddad58 100644 --- a/target/linux/ramips/dts/MT7620a_MT7610e.dts +++ b/target/linux/ramips/dts/MT7620a_MT7610e.dts @@ -11,8 +11,6 @@ gpio-keys-polled { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -37,33 +35,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <1000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MT7620a_V22SG.dts b/target/linux/ramips/dts/MT7620a_V22SG.dts index 25b3cc7a1..8020ab30d 100644 --- a/target/linux/ramips/dts/MT7620a_V22SG.dts +++ b/target/linux/ramips/dts/MT7620a_V22SG.dts @@ -11,8 +11,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -29,31 +27,35 @@ }; nand { - #address-cells = <1>; - #size-cells = <1>; compatible = "mtk,mt7620-nand"; - partition@0 { - label = "u-boot"; - reg = <0x0 0x40000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@40000 { - label = "u-boot-env"; - reg = <0x40000 0x20000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; - factory: partition@60000 { - label = "factory"; - reg = <0x60000 0x20000>; - read-only; - }; + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x20000>; + read-only; + }; - partition@80000 { - label = "firmware"; - reg = <0x80000 0x7f80000>; + factory: partition@60000 { + label = "factory"; + reg = <0x60000 0x20000>; + read-only; + }; + + partition@80000 { + label = "firmware"; + reg = <0x80000 0x7f80000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MT7621.dts b/target/linux/ramips/dts/MT7621.dts index 83d0c86c1..290083a85 100644 --- a/target/linux/ramips/dts/MT7621.dts +++ b/target/linux/ramips/dts/MT7621.dts @@ -19,24 +19,30 @@ &nand { status = "okay"; - partition@0 { - label = "uboot"; - reg = <0x00000 0x80000>; /* 64 KB */ - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@80000 { - label = "uboot_env"; - reg = <0x80000 0x80000>; /* 64 KB */ - }; + partition@0 { + label = "uboot"; + reg = <0x00000 0x80000>; /* 64 KB */ + }; - partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - }; + partition@80000 { + label = "uboot_env"; + reg = <0x80000 0x80000>; /* 64 KB */ + }; - partition@140000 { - label = "rootfs"; - reg = <0x140000 0xec0000>; + partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "rootfs"; + reg = <0x140000 0xec0000>; + }; }; }; diff --git a/target/linux/ramips/dts/MT7628.dts b/target/linux/ramips/dts/MT7628.dts index 3bd172a05..d32c62af5 100644 --- a/target/linux/ramips/dts/MT7628.dts +++ b/target/linux/ramips/dts/MT7628.dts @@ -29,34 +29,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MZK-750DHP.dts b/target/linux/ramips/dts/MZK-750DHP.dts index f9f02550c..9ca7efb98 100644 --- a/target/linux/ramips/dts/MZK-750DHP.dts +++ b/target/linux/ramips/dts/MZK-750DHP.dts @@ -9,6 +9,10 @@ compatible = "planex,mzk-750dhp", "ralink,mt7620a-soc"; model = "Planex MZK-750DHP"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio2 15 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "mzk-750dhp:green:power"; gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; s1 { @@ -60,33 +62,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -117,12 +123,11 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/MZK-DP150N.dts b/target/linux/ramips/dts/MZK-DP150N.dts index 6e5d9c180..c63629269 100644 --- a/target/linux/ramips/dts/MZK-DP150N.dts +++ b/target/linux/ramips/dts/MZK-DP150N.dts @@ -9,10 +9,14 @@ compatible = "planex,mzk-dp150n", "ralink,rt5350-soc"; model = "Planex MZK-DP150N"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "mzk-dp150n:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -40,33 +42,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MZK-EX300NP.dts b/target/linux/ramips/dts/MZK-EX300NP.dts index 3463201f8..01a326a54 100644 --- a/target/linux/ramips/dts/MZK-EX300NP.dts +++ b/target/linux/ramips/dts/MZK-EX300NP.dts @@ -9,6 +9,10 @@ compatible = "planex,mzk-ex300np", "ralink,mt7620a-soc"; model = "Planex MZK-EX300NP"; + aliases { + led-status = &led_wps; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "mzk-ex300np:green:wps"; gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; }; @@ -45,8 +49,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -75,38 +77,42 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x730000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@780000 { - label = "Udata"; - reg = <0x780000 0x80000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x730000>; + }; + + partition@780000 { + label = "Udata"; + reg = <0x780000 0x80000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/MZK-EX750NP.dts b/target/linux/ramips/dts/MZK-EX750NP.dts index 21d47ddfa..1236df8f1 100644 --- a/target/linux/ramips/dts/MZK-EX750NP.dts +++ b/target/linux/ramips/dts/MZK-EX750NP.dts @@ -9,10 +9,14 @@ compatible = "planex,mzk-ex750np", "ralink,mt7620a-soc"; model = "Planex MZK-EX750NP"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "mzk-ex750np:red:power"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -50,8 +54,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -80,38 +82,42 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x730000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@780000 { - label = "Udata"; - reg = <0x780000 0x80000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x730000>; + }; + + partition@780000 { + label = "Udata"; + reg = <0x780000 0x80000>; + }; }; }; }; @@ -138,12 +144,11 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/MZK-W300NH2.dts b/target/linux/ramips/dts/MZK-W300NH2.dts index d96ea6094..af172f180 100644 --- a/target/linux/ramips/dts/MZK-W300NH2.dts +++ b/target/linux/ramips/dts/MZK-W300NH2.dts @@ -9,48 +9,56 @@ compatible = "planex,mzk-w300nh2", "ralink,rt3052-soc"; model = "Planex MZK-W300NH2"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@3e0000 { - label = "cimage"; - reg = <0x3e0000 0x20000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x390000>; + partition@3e0000 { + label = "cimage"; + reg = <0x3e0000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x390000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "mzk-w300nh2:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -68,8 +76,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { diff --git a/target/linux/ramips/dts/MZK-WDPR.dts b/target/linux/ramips/dts/MZK-WDPR.dts index ee0d5c04e..b0461092b 100644 --- a/target/linux/ramips/dts/MZK-WDPR.dts +++ b/target/linux/ramips/dts/MZK-WDPR.dts @@ -18,36 +18,40 @@ bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@7f0000 { - label = "Data3G"; - reg = <0x7f0000 0x10000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x680000>; + partition@7f0000 { + label = "Data3G"; + reg = <0x7f0000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x680000>; + }; }; }; diff --git a/target/linux/ramips/dts/MicroWRT.dts b/target/linux/ramips/dts/MicroWRT.dts index 5a63e6842..d1a72d99d 100644 --- a/target/linux/ramips/dts/MicroWRT.dts +++ b/target/linux/ramips/dts/MicroWRT.dts @@ -15,8 +15,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -45,33 +43,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "u-boot-env"; - reg = <0x20000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - factory: partition@30000 { - label = "factory"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@20000 { + label = "u-boot-env"; + reg = <0x20000 0x10000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0xfc0000>; + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0xfc0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/NA930.dts b/target/linux/ramips/dts/NA930.dts index be909cf33..fadb484f3 100644 --- a/target/linux/ramips/dts/NA930.dts +++ b/target/linux/ramips/dts/NA930.dts @@ -9,43 +9,49 @@ compatible = "sercomm,na930", "ralink,mt7620a-soc"; model = "Sercomm NA930"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS1,57600"; }; nand { - #address-cells = <1>; - #size-cells = <1>; compatible = "mtk,mt7620-nand"; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@200000 { - label = "factory"; - reg = <0x200000 0x40000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - partition@240000 { - label = "Config"; - reg = <0x240000 0x400000>; - read-only; - }; + partition@200000 { + label = "factory"; + reg = <0x200000 0x40000>; + read-only; + }; - partition@640000 { - label = "firmware"; - reg = <0x640000 0x1400000>; + partition@240000 { + label = "Config"; + reg = <0x240000 0x400000>; + read-only; + }; + + partition@640000 { + label = "firmware"; + reg = <0x640000 0x1400000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -85,7 +91,7 @@ gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "na930:blue:power"; gpios = <&gpio2 29 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/NBG-419N.dts b/target/linux/ramips/dts/NBG-419N.dts index 55590de1b..90bac5ce4 100644 --- a/target/linux/ramips/dts/NBG-419N.dts +++ b/target/linux/ramips/dts/NBG-419N.dts @@ -9,42 +9,50 @@ compatible = "zyxel,nbg-419n", "ralink,rt3052-soc"; model = "ZyXEL NBG-419N"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "nbg-419n:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/NBG-419N2.dts b/target/linux/ramips/dts/NBG-419N2.dts index a6e480396..151da1484 100644 --- a/target/linux/ramips/dts/NBG-419N2.dts +++ b/target/linux/ramips/dts/NBG-419N2.dts @@ -9,37 +9,45 @@ compatible = "zyxel,nbg-419n-v2", "ralink,rt3352-soc"; model = "ZyXEL NBG-419N v2"; + aliases { + led-status = &led_power; + }; + palmbus@10000000 { spi@b00 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0 0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -48,7 +56,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "nbg-419n2:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -66,8 +74,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -86,7 +92,6 @@ linux,code = ; }; }; - }; &pinctrl { diff --git a/target/linux/ramips/dts/NCS601W.dts b/target/linux/ramips/dts/NCS601W.dts index 500fdf974..cd1a7a534 100644 --- a/target/linux/ramips/dts/NCS601W.dts +++ b/target/linux/ramips/dts/NCS601W.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -45,7 +49,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/NIXCORE-16M.dts b/target/linux/ramips/dts/NIXCORE-16M.dts index 9c127cbba..236ae94b9 100644 --- a/target/linux/ramips/dts/NIXCORE-16M.dts +++ b/target/linux/ramips/dts/NIXCORE-16M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/NIXCORE-8M.dts b/target/linux/ramips/dts/NIXCORE-8M.dts index bdda4d7a6..972fde6b0 100644 --- a/target/linux/ramips/dts/NIXCORE-8M.dts +++ b/target/linux/ramips/dts/NIXCORE-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/NIXCORE.dtsi b/target/linux/ramips/dts/NIXCORE.dtsi index 4d2a82d24..1702d74db 100644 --- a/target/linux/ramips/dts/NIXCORE.dtsi +++ b/target/linux/ramips/dts/NIXCORE.dtsi @@ -109,20 +109,20 @@ }; &gpio0 { - status = "okay"; + status = "okay"; }; &gpio1 { - status = "okay"; + status = "okay"; }; &i2c { - status = "okay"; + status = "okay"; }; &uart { - status = "okay"; - reset-names = "gpio uartf"; + status = "okay"; + reset-names = "gpio uartf"; }; &pinctrl { diff --git a/target/linux/ramips/dts/NW718.dts b/target/linux/ramips/dts/NW718.dts index 904739753..c87a8d3cf 100644 --- a/target/linux/ramips/dts/NW718.dts +++ b/target/linux/ramips/dts/NW718.dts @@ -9,10 +9,14 @@ compatible = "netcore,nw718", "ralink,rt3050-soc"; model = "Netcore NW718"; + aliases { + led-status = &led_cpu; + }; + gpio-leds { compatible = "gpio-leds"; - cpu { + led_cpu: cpu { label = "nw718:amber:cpu"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -52,33 +54,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <25000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x20000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@50000 { - label = "factory"; - reg = <0x50000 0x10000>; - read-only; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x20000>; + read-only; + }; - partition@60000 { - label = "firmware"; - reg = <0x60000 0x3a0000>; + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0x3a0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/Newifi-D1.dts b/target/linux/ramips/dts/Newifi-D1.dts index 5368b19ea..772054f3d 100644 --- a/target/linux/ramips/dts/Newifi-D1.dts +++ b/target/linux/ramips/dts/Newifi-D1.dts @@ -9,6 +9,10 @@ compatible = "lenovo,newifi-d1", "mediatek,mt7621-soc"; model = "Newifi-D1"; + aliases { + led-status = &led_blue; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -24,23 +28,24 @@ status-red { label = "newifi-d1:red:status"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + default-state = "off"; }; status-green { label = "newifi-d1:green:status"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + default-state = "off"; }; - statys-blue { + led_blue: status-blue { label = "newifi-d1:blue:status"; gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + default-state = "on"; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -70,65 +75,64 @@ &sdhci { status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&sdhci_pins>; }; &spi0 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/Newifi-D2.dts b/target/linux/ramips/dts/Newifi-D2.dts index e919338e4..f9c5ca8da 100644 --- a/target/linux/ramips/dts/Newifi-D2.dts +++ b/target/linux/ramips/dts/Newifi-D2.dts @@ -9,6 +9,10 @@ compatible = "d-team,newifi-d2", "mediatek,mt7621-soc"; model = "Newifi-D2"; + aliases { + led-status = &led_power_blue; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; - power-blue { + led_power_blue: power-blue { label = "newifi-d2:blue:power"; gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; }; @@ -59,8 +63,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -92,56 +94,58 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/OMEGA2.dtsi b/target/linux/ramips/dts/OMEGA2.dtsi index 73a690879..2dccc20c6 100644 --- a/target/linux/ramips/dts/OMEGA2.dtsi +++ b/target/linux/ramips/dts/OMEGA2.dtsi @@ -6,6 +6,10 @@ / { compatible = "onion,omega2", "mediatek,mt7628an-soc"; + aliases { + led-status = &system_led; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -101,33 +103,37 @@ pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + }; }; }; diff --git a/target/linux/ramips/dts/OY-0001.dts b/target/linux/ramips/dts/OY-0001.dts index 0fe372dd3..0aca63eb5 100644 --- a/target/linux/ramips/dts/OY-0001.dts +++ b/target/linux/ramips/dts/OY-0001.dts @@ -9,6 +9,10 @@ compatible = "ohyeah,oy-0001", "ralink,mt7620a-soc"; model = "OY-0001"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -16,7 +20,7 @@ gpio-leds { compatible = "gpio-leds"; - powerled { + led_power: powerled { label = "oy-0001:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -29,8 +33,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; s1 { @@ -53,33 +55,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; @@ -87,7 +93,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd"; + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/PBR-D1.dts b/target/linux/ramips/dts/PBR-D1.dts index 78a36577c..01ac2a127 100644 --- a/target/linux/ramips/dts/PBR-D1.dts +++ b/target/linux/ramips/dts/PBR-D1.dts @@ -9,6 +9,10 @@ compatible = "d-team,pbr-d1", "mediatek,mt7628an-soc"; model = "PBR-D1"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -31,7 +35,7 @@ default-state = "off"; }; - power { + led_power: power { label = "pbr-d1:orange:power"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; default-state = "on"; @@ -40,8 +44,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -96,33 +98,37 @@ pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x0fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x0fb0000>; + }; }; }; diff --git a/target/linux/ramips/dts/PBR-M1.dts b/target/linux/ramips/dts/PBR-M1.dts index 66a71a91a..1f304a7f7 100644 --- a/target/linux/ramips/dts/PBR-M1.dts +++ b/target/linux/ramips/dts/PBR-M1.dts @@ -9,6 +9,10 @@ compatible = "d-team,pbr-m1", "mediatek,mt7621-soc"; model = "PBR-M1"; + aliases { + led-status = &led_sys; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -36,9 +40,10 @@ power { label = "pbr-m1:blue:power"; gpios = <&gpio0 31 GPIO_ACTIVE_LOW>; + default-state = "on"; }; - sys { + led_sys: sys { label = "pbr-m1:blue:sys"; gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; }; @@ -61,8 +66,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -103,64 +106,64 @@ &sdhci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&sdhci_pins>; }; &spi0 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/PSG1208.dts b/target/linux/ramips/dts/PSG1208.dts index f008ec7ab..0c703f534 100644 --- a/target/linux/ramips/dts/PSG1208.dts +++ b/target/linux/ramips/dts/PSG1208.dts @@ -9,10 +9,14 @@ compatible = "phicomm,psg1208", "ralink,mt7620a-soc"; model = "Phicomm PSG1208"; + aliases { + led-status = &led_wps; + }; + gpio-leds { compatible = "gpio-leds"; - wan { + led_wps: wps { label = "psg1208:white:wps"; gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -49,33 +51,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@30000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@20000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@30000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -98,14 +104,13 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/PSG1218.dtsi b/target/linux/ramips/dts/PSG1218.dtsi index c24f5ff2b..4209c2d2b 100644 --- a/target/linux/ramips/dts/PSG1218.dtsi +++ b/target/linux/ramips/dts/PSG1218.dtsi @@ -8,8 +8,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -28,47 +26,50 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@30000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@20000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@30000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/PSG1218A.dts b/target/linux/ramips/dts/PSG1218A.dts index d76abc39f..5065b7946 100644 --- a/target/linux/ramips/dts/PSG1218A.dts +++ b/target/linux/ramips/dts/PSG1218A.dts @@ -6,21 +6,28 @@ compatible = "phicomm,psg1218a", "phicomm,psg1218", "ralink,mt7620a-soc"; model = "Phicomm PSG1218 rev.A"; + aliases { + led-status = &led_blue; + }; + gpio-leds { compatible = "gpio-leds"; - blue { + led_blue: blue { label = "psg1218a:blue:status"; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + default-state = "on"; }; yellow { label = "psg1218a:yellow:status"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + default-state = "off"; }; red { label = "psg1218a:red:status"; - gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + default-state = "off"; }; }; }; diff --git a/target/linux/ramips/dts/PSG1218B.dts b/target/linux/ramips/dts/PSG1218B.dts index 2dfa7635d..3278a51bf 100644 --- a/target/linux/ramips/dts/PSG1218B.dts +++ b/target/linux/ramips/dts/PSG1218B.dts @@ -6,21 +6,28 @@ compatible = "phicomm,psg1218b", "phicomm,psg1218", "ralink,mt7620a-soc"; model = "Phicomm PSG1218 rev.B"; + aliases { + led-status = &led_blue; + }; + gpio-leds { compatible = "gpio-leds"; - blue { + led_blue: blue { label = "psg1218b:blue:status"; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + default-state = "on"; }; yellow { label = "psg1218b:yellow:status"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + default-state = "off"; }; red { label = "psg1218b:red:status"; - gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + default-state = "off"; }; }; }; diff --git a/target/linux/ramips/dts/PSR-680W.dts b/target/linux/ramips/dts/PSR-680W.dts index 2297c1126..abf5f3c92 100644 --- a/target/linux/ramips/dts/PSR-680W.dts +++ b/target/linux/ramips/dts/PSR-680W.dts @@ -9,6 +9,10 @@ compatible = "petatel,psr-680w", "ralink,rt3052-soc"; model = "Petatel PSR-680W Wireless 3G Router"; + aliases { + led-status = &led_wan; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -18,37 +22,41 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - wan { + led_wan: wan { label = "psr-680w:red:wan"; gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; }; @@ -56,8 +64,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/PWH2004.dts b/target/linux/ramips/dts/PWH2004.dts index c086894fd..aee8fa760 100644 --- a/target/linux/ramips/dts/PWH2004.dts +++ b/target/linux/ramips/dts/PWH2004.dts @@ -9,35 +9,43 @@ compatible = "prolink,pwh2004", "ralink,rt3052-soc"; model = "Prolink PWH2004"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -49,7 +57,7 @@ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "pwh2004:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { diff --git a/target/linux/ramips/dts/PX-4885-4M.dts b/target/linux/ramips/dts/PX-4885-4M.dts index f6d366c3e..c1da0a4e3 100644 --- a/target/linux/ramips/dts/PX-4885-4M.dts +++ b/target/linux/ramips/dts/PX-4885-4M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "devdata"; - reg = <0x20000 0x20000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - factory: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@20000 { + label = "devdata"; + reg = <0x20000 0x20000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/PX-4885-8M.dts b/target/linux/ramips/dts/PX-4885-8M.dts index 39327e960..4aa4d8927 100644 --- a/target/linux/ramips/dts/PX-4885-8M.dts +++ b/target/linux/ramips/dts/PX-4885-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "devdata"; - reg = <0x20000 0x20000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - factory: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@20000 { + label = "devdata"; + reg = <0x20000 0x20000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/PX-4885.dtsi b/target/linux/ramips/dts/PX-4885.dtsi index ac47ed845..64e007adc 100644 --- a/target/linux/ramips/dts/PX-4885.dtsi +++ b/target/linux/ramips/dts/PX-4885.dtsi @@ -6,10 +6,12 @@ / { compatible = "7links,px-4885", "ralink,rt5350-soc"; + aliases { + led-status = &led_wifi; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -22,12 +24,12 @@ gpio-leds { compatible = "gpio-leds"; - orange { + led_wifi: wifi { label = "px-4885:orange:wifi"; gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; }; - blue { + storage { label = "px-4885:blue:storage"; gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/R6120.dts b/target/linux/ramips/dts/R6120.dts new file mode 100644 index 000000000..eac9e1768 --- /dev/null +++ b/target/linux/ramips/dts/R6120.dts @@ -0,0 +1,145 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "netgear,r6120", "mediatek,mt7628an-soc"; + model = "Netgear AC1200 R6120"; + + aliases { + led-status = &led_power; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan { + label = "r6120:green:lan"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + led_power: power { + label = "r6120:green:power"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "r6120:green:wlan2g"; + gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; + }; + + wlan_orange { + label = "r6120:orange:wlan2g"; + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + }; + + wlan5 { + label = "r6120:green:wlan5g"; + gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + }; + + wlan5_orange { + label = "r6120:orange:wlan5g"; + gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "p0led_an", "p1led_an", "p2led_an", + "p3led_an", "p4led_an", "wdt", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x20000>; + read-only; + }; + + nvram: partition@60000 { + label = "nvram"; + reg = <0x60000 0x30000>; + read-only; + }; + + partition@90000 { + label = "firmware"; + reg = <0x90000 0xf60000>; + }; + + partition@ff0000 { + label = "reserved"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&wmac { + status = "okay"; + mtd-mac-address = <&nvram 0x100b0>; + mediatek,mtd-eeprom = <&factory 0x20000>; +}; + +ðernet { + mtd-mac-address = <&nvram 0x100b0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x28000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&nvram 0x100b0>; + mtd-mac-address-increment = <(2)>; + }; +}; diff --git a/target/linux/ramips/dts/R6220.dts b/target/linux/ramips/dts/R6220.dts index 7d886725e..83ba4531d 100644 --- a/target/linux/ramips/dts/R6220.dts +++ b/target/linux/ramips/dts/R6220.dts @@ -9,6 +9,10 @@ compatible = "netgear,r6220", "mediatek,mt7621-soc"; model = "Netgear R6220"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "r6220:green:power"; gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; }; @@ -49,8 +53,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -87,60 +89,64 @@ &nand { status = "okay"; - partition@0 { - label = "u-boot"; - reg = <0x0 0x100000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@100000 { - label = "SC PID"; - reg = <0x100000 0x100000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + read-only; + }; - partition@200000 { - label = "kernel"; - reg = <0x200000 0x400000>; - }; + partition@100000 { + label = "SC PID"; + reg = <0x100000 0x100000>; + read-only; + }; - partition@600000 { - label = "ubi"; - reg = <0x600000 0x1c00000>; - }; + partition@200000 { + label = "kernel"; + reg = <0x200000 0x400000>; + }; - factory: partition@2e00000 { - label = "factory"; - reg = <0x2e00000 0x100000>; - read-only; - }; + partition@600000 { + label = "ubi"; + reg = <0x600000 0x1c00000>; + }; - partition@4200000 { - label = "reserved"; - reg = <0x4200000 0x3c00000>; - read-only; + factory: partition@2e00000 { + label = "factory"; + reg = <0x2e00000 0x100000>; + read-only; + }; + + partition@4200000 { + label = "reserved"; + reg = <0x4200000 0x3c00000>; + read-only; + }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/RB750Gr3.dts b/target/linux/ramips/dts/RB750Gr3.dts index dc359b10b..20198eb9c 100644 --- a/target/linux/ramips/dts/RB750Gr3.dts +++ b/target/linux/ramips/dts/RB750Gr3.dts @@ -9,6 +9,10 @@ compatible = "mikrotik,rb750gr3", "mediatek,mt7621-soc"; model = "MikroTik RB750Gr3"; + aliases { + led-status = &led_pwr; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - pwr { + led_pwr: pwr { label = "rb750gr3:blue:pwr"; gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; mode { @@ -73,36 +75,39 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; }; }; diff --git a/target/linux/ramips/dts/RBM11G.dts b/target/linux/ramips/dts/RBM11G.dts new file mode 100644 index 000000000..41dabdd1a --- /dev/null +++ b/target/linux/ramips/dts/RBM11G.dts @@ -0,0 +1,164 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,rbm11g", "mediatek,mt7621-soc"; + model = "MikroTik RouterBOARD M11G"; + + aliases { + led-status = &led_usr; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_usr: usr { + label = "rbm11g:green:usr"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + }; + + rssi0 { + label = "rbm11g:green:rssi0"; + gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; + }; + + rssi1 { + label = "rbm11g:green:rssi1"; + gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; + }; + + rssi2 { + label = "rbm11g:green:rssi2"; + gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; + }; + + rssi3 { + label = "rbm11g:green:rssi3"; + gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; + + rssi4 { + label = "rbm11g:green:rssi4"; + gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + res { + label = "reset"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + pcie0_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "pcie0_vcc"; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + regulator-always-on; + }; +}; + + +&spi0 { + status = "okay"; + + w25q128@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + // XXX empiric value to obtain actual 10MHz SCK at the chip + spi-max-frequency = <3125000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "RouterBoot"; + reg = <0x0 0x40000>; + read-only; + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader1"; + reg = <0x0 0xf000>; + read-only; + }; + + hard_config: partition@f000 { + label = "hard_config"; + reg = <0xf000 0x1000>; + read-only; + }; + + partition@10000 { + label = "bootloader2"; + reg = <0x10000 0xf000>; + read-only; + }; + + partition@20000 { + label = "soft_config"; + reg = <0x20000 0x1000>; + }; + + partition@30000 { + label = "bios"; + reg = <0x30000 0x1000>; + read-only; + }; + }; + + partition@40000 { + label = "firmware"; + reg = <0x040000 0xFC0000>; + }; + }; + }; +}; + +ðernet { + mtd-mac-address = <&hard_config 0x0010>; + mtd-mac-address-increment = <1>; +}; + + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart2", "wdt", "rgmii2"; + ralink,function = "gpio"; + }; + }; +}; + +&i2c { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RBM33G.dts b/target/linux/ramips/dts/RBM33G.dts index ed2cb841d..662aad7b3 100644 --- a/target/linux/ramips/dts/RBM33G.dts +++ b/target/linux/ramips/dts/RBM33G.dts @@ -7,7 +7,11 @@ / { compatible = "mikrotik,rbm33g", "mediatek,mt7621-soc"; - model = "MikroTik RBM33G"; + model = "MikroTik RouterBOARD M33G"; + + aliases { + led-status = &led_usr; + }; memory@0 { device_type = "memory"; @@ -21,17 +25,14 @@ gpio-leds { compatible = "gpio-leds"; - usr { + led_usr: usr { label = "rbm33g:green:usr"; gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; res { @@ -94,42 +95,78 @@ status = "okay"; w25q40@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <3125000>; - partition@0 { - label = "routerboot"; - reg = <0x0 0xf000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - factory: partition@f000 { - label = "factory"; - reg = <0xf000 0x71000>; - read-only; - }; + partition@0 { + label = "RouterBoot"; + reg = <0x0 0x40000>; + read-only; + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "bootloader1"; + reg = <0x0 0xf000>; + read-only; + }; + + hard_config: partition@f000 { + label = "hard_config"; + reg = <0xf000 0x1000>; + read-only; + }; + + partition@10000 { + label = "bootloader2"; + reg = <0x10000 0xf000>; + read-only; + }; + + partition@20000 { + label = "soft_config"; + reg = <0x20000 0x1000>; + }; + + partition@30000 { + label = "bios"; + reg = <0x30000 0x1000>; + read-only; + }; + }; + }; }; - w25q128@0 { - #address-cells = <1>; - #size-cells = <1>; + w25q128@1 { compatible = "jedec,spi-nor"; reg = <1>; + // XXX empiric value to obtain actual 10MHz SCK at the chip spi-max-frequency = <3125000>; - partition@40000 { - label = "firmware"; - reg = <0x040000 0xFC0000>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + // Region <0x0 0x40000> seems reserved by OEM + + partition@40000 { + label = "firmware"; + reg = <0x040000 0xFC0000>; + }; }; }; }; ðernet { - mtd-mac-address = <&factory 0x0010>; + mtd-mac-address = <&hard_config 0x0010>; mtd-mac-address-increment = <1>; }; diff --git a/target/linux/ramips/dts/RE350.dts b/target/linux/ramips/dts/RE350.dts index 2f3bb1245..0f743239f 100644 --- a/target/linux/ramips/dts/RE350.dts +++ b/target/linux/ramips/dts/RE350.dts @@ -9,6 +9,10 @@ compatible = "tplink,re350-v1", "mediatek,mt7621-soc"; model = "TP-LINK RE350 v1"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x4000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "re350-v1:blue:power"; gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; }; @@ -59,8 +63,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; led { @@ -93,60 +95,62 @@ status = "okay"; w25q64@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x5e0000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - config: partition@600000 { - label = "config"; - reg = <0x600000 0x50000>; - read-only; - }; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x5e0000>; + }; - radio: partition@7f0000 { - label = "radio"; - reg = <0x7f0000 0x10000>; - read-only; + config: partition@600000 { + label = "config"; + reg = <0x600000 0x50000>; + read-only; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 0>; - mtd-mac-address = <&config 0x10008>; - mtd-mac-address-increment = <1>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0>; + mtd-mac-address = <&config 0x10008>; + mtd-mac-address-increment = <1>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&radio 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&config 0x10008>; - mtd-mac-address-increment = <2>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&config 0x10008>; + mtd-mac-address-increment = <2>; }; }; diff --git a/target/linux/ramips/dts/RE6500.dts b/target/linux/ramips/dts/RE6500.dts index b2b5a2923..54433b668 100644 --- a/target/linux/ramips/dts/RE6500.dts +++ b/target/linux/ramips/dts/RE6500.dts @@ -9,6 +9,10 @@ compatible = "linksys,re6500", "mediatek,mt7621-soc"; model = "Linksys RE6500"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x4000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; - power { + led_power: power { label = "re6500:white:power"; gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -56,34 +58,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -99,23 +105,21 @@ &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/RP-N53.dts b/target/linux/ramips/dts/RP-N53.dts index b921d9ca5..d46d853ae 100644 --- a/target/linux/ramips/dts/RP-N53.dts +++ b/target/linux/ramips/dts/RP-N53.dts @@ -11,8 +11,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; touch { @@ -103,33 +101,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -163,13 +165,13 @@ &pcie { status = "okay"; +}; - pcie-bridge { - wifi@1814,5592 { - compatible = "pci1814,5592"; - reg = <0x0000 0 0 0 0>; - ralink,2ghz = <0>; - ralink,mtd-eeprom = <&factory 0x8000>; - }; +&pcie0 { + wifi@0,0 { + compatible = "pci1814,5592"; + reg = <0x0000 0 0 0 0>; + ralink,2ghz = <0>; + ralink,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/RT-AC51U.dts b/target/linux/ramips/dts/RT-AC51U.dts index ec313cc5a..7281bc9ce 100644 --- a/target/linux/ramips/dts/RT-AC51U.dts +++ b/target/linux/ramips/dts/RT-AC51U.dts @@ -9,10 +9,14 @@ compatible = "asus,rt-ac51u", "ralink,mt7620a-soc"; model = "Asus RT-AC51U"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "rt-ac51u:blue:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -63,33 +65,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/RT-G32-B1.dts b/target/linux/ramips/dts/RT-G32-B1.dts index af923c6e6..dde60ad54 100644 --- a/target/linux/ramips/dts/RT-G32-B1.dts +++ b/target/linux/ramips/dts/RT-G32-B1.dts @@ -11,8 +11,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -33,33 +31,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - devconf: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + devconf: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/RT-N10-PLUS.dts b/target/linux/ramips/dts/RT-N10-PLUS.dts index a55d06f1b..9e5dcacfb 100644 --- a/target/linux/ramips/dts/RT-N10-PLUS.dts +++ b/target/linux/ramips/dts/RT-N10-PLUS.dts @@ -9,42 +9,50 @@ compatible = "asus,rt-n10-plus", "ralink,rt3050-soc"; model = "Asus RT-N10+"; + aliases { + led-status = &led_wps; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "devdata"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - devconf: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + devconf: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - wps { + led_wps: wps { label = "rt-n10-plus:green:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -52,8 +60,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/RT-N12-PLUS.dts b/target/linux/ramips/dts/RT-N12-PLUS.dts index f3e0284ae..f40ed5caa 100644 --- a/target/linux/ramips/dts/RT-N12-PLUS.dts +++ b/target/linux/ramips/dts/RT-N12-PLUS.dts @@ -9,6 +9,10 @@ compatible = "asus,rt-n12p", "ralink,mt7620n-soc"; model = "Asus RT-N12+"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -26,7 +30,7 @@ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "rt-n12p:green:power"; gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; }; @@ -39,8 +43,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -67,33 +69,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/RT-N13U.dts b/target/linux/ramips/dts/RT-N13U.dts index 35a6c0aa2..4b8ddf7c0 100644 --- a/target/linux/ramips/dts/RT-N13U.dts +++ b/target/linux/ramips/dts/RT-N13U.dts @@ -9,42 +9,50 @@ compatible = "asus,rt-n13u", "ralink,rt3052-soc"; model = "Asus RT-N13U"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "rt-n13u:blue:power"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <10>; reset { diff --git a/target/linux/ramips/dts/RT-N14U.dts b/target/linux/ramips/dts/RT-N14U.dts index 8ae4580b9..3a72026a2 100644 --- a/target/linux/ramips/dts/RT-N14U.dts +++ b/target/linux/ramips/dts/RT-N14U.dts @@ -9,6 +9,10 @@ compatible = "asus,rt-n14u", "ralink,mt7620n-soc"; model = "Asus RT-N14U"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -27,7 +31,7 @@ gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "rt-n14u:blue:power"; gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; }; @@ -40,8 +44,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -70,33 +72,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/RT-N15.dts b/target/linux/ramips/dts/RT-N15.dts index ee1c34024..7764eb536 100644 --- a/target/linux/ramips/dts/RT-N15.dts +++ b/target/linux/ramips/dts/RT-N15.dts @@ -11,35 +11,43 @@ compatible = "asus,rt-n15", "ralink,rt2880-soc"; model = "Asus RT-N15"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -51,8 +59,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { @@ -71,7 +77,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "rt-n15:blue:power"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/RT-N56U.dts b/target/linux/ramips/dts/RT-N56U.dts index 417411db7..3c5148c67 100644 --- a/target/linux/ramips/dts/RT-N56U.dts +++ b/target/linux/ramips/dts/RT-N56U.dts @@ -9,34 +9,42 @@ compatible = "asus,rt-n56u", "ralink,rt3883-soc"; model = "Asus RT-N56U"; + aliases { + led-status = &led_power; + }; + nor-flash@1c000000 { compatible = "cfi-flash"; reg = <0x1c000000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - reg = <0x0 0x0030000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - reg = <0x00030000 0x00010000>; - label = "u-boot-env"; - read-only; - }; + partition@0 { + reg = <0x0 0x0030000>; + label = "u-boot"; + read-only; + }; - factory: partition@40000 { - reg = <0x00040000 0x00010000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; - partition@50000 { - reg = <0x00050000 0x007b0000>; - label = "firmware"; + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x007b0000>; + label = "firmware"; + }; }; }; @@ -49,8 +57,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -69,7 +75,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "rt-n56u:blue:power"; gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; }; @@ -114,26 +120,15 @@ &pci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pci_pins>; +}; - pci_pins: pci { - pci { - ralink,group = "pci"; - ralink,function = "pci-fnc"; - }; - }; +&pci1 { + status = "okay"; - host-bridge { - pci-bridge@1 { - status = "okay"; - - wifi@1814,3091 { - compatible = "pci1814,3091"; - reg = <0x10000 0 0 0 0>; - ralink,mtd-eeprom = <&factory 0x8000>; - }; - }; + wifi@0,0 { + compatible = "pci1814,3091"; + reg = <0x10000 0 0 0 0>; + ralink,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi b/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi index 629dab893..81cb81fb2 100644 --- a/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi +++ b/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi @@ -3,10 +3,10 @@ / { compatible = "olimex,rt5350f-olinuxino", "ralink,rt5350-soc"; - aliases { - serial0 = &uartlite; - serial1 = &uart; - }; + aliases { + serial0 = &uartlite; + serial1 = &uart; + }; }; @@ -14,33 +14,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -52,7 +56,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "jtag", "rgmii", "mdio"; + ralink,group = "jtag"; ralink,function = "gpio"; }; uartf_gpio { diff --git a/target/linux/ramips/dts/RUT5XX.dts b/target/linux/ramips/dts/RUT5XX.dts index e80b64d4e..45f39b260 100644 --- a/target/linux/ramips/dts/RUT5XX.dts +++ b/target/linux/ramips/dts/RUT5XX.dts @@ -9,10 +9,14 @@ compatible = "teltonika,rut5xx", "ralink,rt3050-soc"; model = "Teltonika RUT5XX"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "rut5xx:green:status"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,33 +38,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/SAP-G3200U3.dts b/target/linux/ramips/dts/SAP-G3200U3.dts index 7264e30b5..4ca5e889d 100644 --- a/target/linux/ramips/dts/SAP-G3200U3.dts +++ b/target/linux/ramips/dts/SAP-G3200U3.dts @@ -9,6 +9,10 @@ compatible = "storylink,sap-g3200u3", "mediatek,mt7621-soc"; model = "STORYLiNK SAP-G3200U3"; + aliases { + led-status = &led_usb; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - usb { + led_usb: usb { label = "sap-g3200u3:green:usb"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -29,8 +33,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -51,63 +53,65 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x1000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@31000 { - label = "config"; - reg = <0x31000 0xf000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@31000 { + label = "config"; + reg = <0x31000 0xf000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/SK-WB8.dts b/target/linux/ramips/dts/SK-WB8.dts index 0ded039d8..7cbd205ac 100644 --- a/target/linux/ramips/dts/SK-WB8.dts +++ b/target/linux/ramips/dts/SK-WB8.dts @@ -8,6 +8,10 @@ compatible = "samknows,whitebox-v8", "mediatek,mt7621-soc"; model = "SamKnows Whitebox 8"; + aliases { + led-status = &led_wps; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -20,7 +24,7 @@ gpio-leds { compatible = "gpio-leds"; - wps { + led_wps: wps { label = "sk-wb8:green:wps"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -33,8 +37,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { label = "wps"; @@ -53,56 +55,57 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/SL-R7205.dts b/target/linux/ramips/dts/SL-R7205.dts index f6f20a817..5ecd8381d 100644 --- a/target/linux/ramips/dts/SL-R7205.dts +++ b/target/linux/ramips/dts/SL-R7205.dts @@ -9,42 +9,50 @@ compatible = "skyline,sl-r7205", "ralink,rt3052-soc"; model = "Skyline SL-R7205 Wireless 3G Router"; + aliases { + led-status = &led_wifi; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - wifi { + led_wifi: wifi { label = "sl-r7205:green:wifi"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -52,8 +60,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/TEW-638APB-V2.dts b/target/linux/ramips/dts/TEW-638APB-V2.dts index 3c9b12968..b69a77ba2 100644 --- a/target/linux/ramips/dts/TEW-638APB-V2.dts +++ b/target/linux/ramips/dts/TEW-638APB-V2.dts @@ -9,42 +9,48 @@ compatible = "trendnet,tew-638apb-v2", "ralink,rt3050-soc"; model = "TRENDnet TEW-638APB v2"; + aliases { + led-status = &led_wps_green; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x400000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -68,7 +74,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - wps2 { + led_wps_green: wps2 { label = "tew-638apb-v2:green:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/TEW-691GR.dts b/target/linux/ramips/dts/TEW-691GR.dts index 0ee5e4ab2..23f1a91e4 100644 --- a/target/linux/ramips/dts/TEW-691GR.dts +++ b/target/linux/ramips/dts/TEW-691GR.dts @@ -9,41 +9,47 @@ compatible = "trendnet,tew-691gr", "ralink,rt3883-soc"; model = "TRENDnet TEW-691GR"; + aliases { + led-status = &led_wps; + }; + nor-flash@1c000000 { compatible = "cfi-flash"; reg = <0x1c000000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - reg = <0x0 0x0030000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - reg = <0x00030000 0x00010000>; - label = "u-boot-env"; - read-only; - }; + partition@0 { + reg = <0x0 0x0030000>; + label = "u-boot"; + read-only; + }; - factory: partition@40000 { - reg = <0x00040000 0x00010000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; - partition@50000 { - reg = <0x00050000 0x007b0000>; - label = "firmware"; + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x007b0000>; + label = "firmware"; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -68,7 +74,7 @@ gpio-leds { compatible = "gpio-leds"; - wps { + led_wps: wps { label = "tew-691gr:green:wps"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/TEW-692GR.dts b/target/linux/ramips/dts/TEW-692GR.dts index a2e853a0a..8bb7f1748 100644 --- a/target/linux/ramips/dts/TEW-692GR.dts +++ b/target/linux/ramips/dts/TEW-692GR.dts @@ -9,41 +9,47 @@ compatible = "trendnet,tew-692gr", "ralink,rt3883-soc"; model = "TRENDnet TEW-692GR"; + aliases { + led-status = &led_wps_green; + }; + nor-flash@1c000000 { compatible = "cfi-flash"; reg = <0x1c000000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - reg = <0x0 0x0030000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - reg = <0x00030000 0x00010000>; - label = "u-boot-env"; - read-only; - }; + partition@0 { + reg = <0x0 0x0030000>; + label = "u-boot"; + read-only; + }; - factory: partition@40000 { - reg = <0x00040000 0x00010000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; - partition@50000 { - reg = <0x00050000 0x007b0000>; - label = "firmware"; + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x007b0000>; + label = "firmware"; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; reset { @@ -67,7 +73,7 @@ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; - wps2 { + led_wps_green: wps2 { label = "tew-692gr:green:wps"; gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; }; @@ -120,26 +126,15 @@ &pci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pci_pins>; +}; - pci_pins: pci { - pci { - ralink,group = "pci"; - ralink,function = "pci-fnc"; - }; - }; +&pci1 { + status = "okay"; - host-bridge { - pci-bridge@1 { - status = "okay"; - - wifi@0,0 { - compatible = "pci0,0"; - reg = < 0x10000 0 0 0 0 >; - ralink,2ghz = <0>; - }; - }; + wifi@0,0 { + compatible = "pci0,0"; + reg = < 0x10000 0 0 0 0 >; + ralink,2ghz = <0>; }; }; diff --git a/target/linux/ramips/dts/TEW-714TRU.dts b/target/linux/ramips/dts/TEW-714TRU.dts index 5099e5ce3..0fc798ee1 100644 --- a/target/linux/ramips/dts/TEW-714TRU.dts +++ b/target/linux/ramips/dts/TEW-714TRU.dts @@ -25,21 +25,19 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; - reset { - label = "reset"; - gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; - linux,code = ; - }; + reset { + label = "reset"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; - wps { - label = "wps"; - gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; - linux,code = ; - }; + wps { + label = "wps"; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; }; gpio_export { @@ -62,33 +60,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/TINY-AC.dts b/target/linux/ramips/dts/TINY-AC.dts index 27c443ee2..ed539b1d0 100644 --- a/target/linux/ramips/dts/TINY-AC.dts +++ b/target/linux/ramips/dts/TINY-AC.dts @@ -25,13 +25,10 @@ label = "tiny-ac:orange:wifi"; gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -39,7 +36,6 @@ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; linux,code = ; }; - }; gpio_export { @@ -70,33 +66,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -144,7 +144,6 @@ &gsw { mediatek,port4 = "gmac"; - mediatek,mt7530 = <1>; }; &pcie { diff --git a/target/linux/ramips/dts/TL-MR3020V3.dts b/target/linux/ramips/dts/TL-MR3020V3.dts new file mode 100644 index 000000000..5bc1a82cc --- /dev/null +++ b/target/linux/ramips/dts/TL-MR3020V3.dts @@ -0,0 +1,144 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "tplink,tl-mr3020-v3", "mediatek,mt7628an-soc"; + model = "TP-Link TL-MR3020 v3"; + + aliases { + led-status = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + modec1 { + label = "sw1"; + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + modec2 { + label = "sw2"; + gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: power { + label = "tl-mr3020-v3:green:power"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wan { + label = "tl-mr3020-v3:green:3g"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "tl-mr3020-v3:green:wlan"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "tl-mr3020-v3:green:wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "tl-mr3020-v3:green:lan"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; + + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + read-only; + }; + + factory: partition@7d0000 { + label = "factory"; + reg = <0x7d0000 0x30000>; + read-only; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2s", "refclk", "wdt", "p2led_an", "p1led_an", "p0led_an", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; + +&wmac { + status = "okay"; + mtd-mac-address = <&factory 0xf100>; + mediatek,mtd-eeprom = <&factory 0x20000>; +}; + +ðernet { + mtd-mac-address = <&factory 0xf100>; +}; diff --git a/target/linux/ramips/dts/TL-MR3420V5.dts b/target/linux/ramips/dts/TL-MR3420V5.dts index 397b2e169..8845e8075 100644 --- a/target/linux/ramips/dts/TL-MR3420V5.dts +++ b/target/linux/ramips/dts/TL-MR3420V5.dts @@ -9,10 +9,12 @@ compatible = "tplink,tl-mr3420-v5", "mediatek,mt7628an-soc"; model = "TP-Link TL-MR3420 v5"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,7 +38,7 @@ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "tl-mr3420-v5:green:power"; gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/TL-WA801NDV5.dts b/target/linux/ramips/dts/TL-WA801NDV5.dts new file mode 100644 index 000000000..9e3844d11 --- /dev/null +++ b/target/linux/ramips/dts/TL-WA801NDV5.dts @@ -0,0 +1,59 @@ +/dts-v1/; + +#include "TPLINK-8M.dtsi" + +#include +#include + +/ { + compatible = "tplink,tl-wa801nd-v5", "mediatek,mt7628an-soc"; + model = "TP-Link TL-WA801ND v5"; + + aliases { + led-status = &led_power; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: power { + label = "tl-wa801nd-v5:green:power"; + gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "tl-wa801nd-v5:green:lan"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "tl-wa801nd-v5:green:wlan"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "tl-wa801nd-v5:orange:wps"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "p0led_an", "perst", "refclk", "wdt", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/TL-WR840NV4.dts b/target/linux/ramips/dts/TL-WR840NV4.dts index 09952e7a7..9290019e2 100644 --- a/target/linux/ramips/dts/TL-WR840NV4.dts +++ b/target/linux/ramips/dts/TL-WR840NV4.dts @@ -9,10 +9,12 @@ compatible = "tplink,tl-wr840n-v4", "mediatek,mt7628an-soc"; model = "TP-Link TL-WR840N v4"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -30,7 +32,7 @@ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "tl-wr840n-v4:green:power"; gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/TL-WR840NV5.dts b/target/linux/ramips/dts/TL-WR840NV5.dts index ecc0fedd5..fe8fba227 100644 --- a/target/linux/ramips/dts/TL-WR840NV5.dts +++ b/target/linux/ramips/dts/TL-WR840NV5.dts @@ -9,6 +9,10 @@ compatible = "tplink,tl-wr840n-v5", "mediatek,mt7628an-soc"; model = "TP-Link TL-WR840N v5"; + aliases { + led-status = &led_power_green; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -34,7 +36,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power_green: power { label = "tl-wr840n-v5:green:power"; gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; }; @@ -50,28 +52,32 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x3d0000>; - }; + partition@0 { + label = "boot"; + reg = <0x0 0x20000>; + read-only; + }; - factory: partition@3f0000 { - label = "factory"; - reg = <0x3f0000 0x10000>; - read-only; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + factory: partition@3f0000 { + label = "factory"; + reg = <0x3f0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/TL-WR841NV13.dts b/target/linux/ramips/dts/TL-WR841NV13.dts index e552b4703..baba0015e 100644 --- a/target/linux/ramips/dts/TL-WR841NV13.dts +++ b/target/linux/ramips/dts/TL-WR841NV13.dts @@ -9,10 +9,12 @@ compatible = "tplink,tl-wr841n-v13", "mediatek,mt7628an-soc"; model = "TP-Link TL-WR841N v13"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -31,7 +33,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "tl-wr841n-v13:green:power"; gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/TL-WR842NV5.dts b/target/linux/ramips/dts/TL-WR842NV5.dts index 397c10637..c20e78061 100644 --- a/target/linux/ramips/dts/TL-WR842NV5.dts +++ b/target/linux/ramips/dts/TL-WR842NV5.dts @@ -9,10 +9,12 @@ compatible = "tplink,tl-wr842n-v5", "mediatek,mt7628an-soc"; model = "TP-Link TL-WR842N v5"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,7 +38,7 @@ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "tl-wr842n-v5:green:power"; gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/TL-WR902ACV3.dts b/target/linux/ramips/dts/TL-WR902ACV3.dts index bfdc03b1b..014c545e9 100644 --- a/target/linux/ramips/dts/TL-WR902ACV3.dts +++ b/target/linux/ramips/dts/TL-WR902ACV3.dts @@ -9,10 +9,12 @@ compatible = "tplink,tl-wr902ac-v3", "mediatek,mt7628an-soc"; model = "TP-Link TL-WR902AC v3"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -48,7 +50,7 @@ gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; }; - power { + led_power: power { label = "tl-wr902ac-v3:green:power"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -94,15 +96,14 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x28000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&factory 0xf100>; - mtd-mac-address-increment = <(-1)>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x28000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0xf100>; + mtd-mac-address-increment = <(-1)>; }; }; diff --git a/target/linux/ramips/dts/TPLINK-8M.dtsi b/target/linux/ramips/dts/TPLINK-8M.dtsi index c9d0cddb3..8c663822b 100644 --- a/target/linux/ramips/dts/TPLINK-8M.dtsi +++ b/target/linux/ramips/dts/TPLINK-8M.dtsi @@ -15,34 +15,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@20000 { - label = "firmware"; - reg = <0x20000 0x7a0000>; - }; + partition@0 { + label = "boot"; + reg = <0x0 0x20000>; + read-only; + }; - partition@7c0000 { - label = "config"; - reg = <0x7c0000 0x10000>; - read-only; - }; + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; - factory: partition@7d0000 { - label = "factory"; - reg = <0x7d0000 0x30000>; - read-only; + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + read-only; + }; + + factory: partition@7d0000 { + label = "factory"; + reg = <0x7d0000 0x30000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/Timecloud.dts b/target/linux/ramips/dts/Timecloud.dts index 066d16a8f..641a225ae 100644 --- a/target/linux/ramips/dts/Timecloud.dts +++ b/target/linux/ramips/dts/Timecloud.dts @@ -9,6 +9,10 @@ compatible = "thunder,timecloud", "mediatek,mt7621-soc"; model = "Thunder Timecloud"; + aliases { + led-status = &led_statuso; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -26,17 +30,14 @@ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; - stato { + led_statuso: stato { label = "timecloud:orange:status"; gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; }; - }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -55,43 +56,44 @@ &sdhci { status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&sdhci_pins>; }; &spi0 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/U25AWF-H1.dts b/target/linux/ramips/dts/U25AWF-H1.dts index 8021b0f79..54c763bea 100644 --- a/target/linux/ramips/dts/U25AWF-H1.dts +++ b/target/linux/ramips/dts/U25AWF-H1.dts @@ -9,10 +9,12 @@ compatible = "kimax,u25awf-h1","ralink,mt7620a-soc"; model = "Kimax U25AWF-H1"; + aliases { + led-status = &led_wifi; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -25,7 +27,7 @@ gpio-leds { compatible = "gpio-leds"; - wifi { + led_wifi: wifi { label = "u25awf:red:wifi"; gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; @@ -49,33 +51,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/U35WF.dts b/target/linux/ramips/dts/U35WF.dts new file mode 100644 index 000000000..b950fddc0 --- /dev/null +++ b/target/linux/ramips/dts/U35WF.dts @@ -0,0 +1,112 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include +#include + +/ { + compatible = "kimax,u35wf","ralink,mt7620n-soc"; + model = "Kimax U35WF"; + + aliases { + led-status = &led_wifi; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_wifi: wifi { + label = "u35wf:blue:wifi"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "u35wf:green:eth"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/U7621-06-256M-16M.dts b/target/linux/ramips/dts/U7621-06-256M-16M.dts index 1bf03fdf5..facd8c0a6 100644 --- a/target/linux/ramips/dts/U7621-06-256M-16M.dts +++ b/target/linux/ramips/dts/U7621-06-256M-16M.dts @@ -53,34 +53,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <14000000>; m25p,chunked-io = <32>; - partition@0 { - label = "bootloader"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/U7621-06.dtsi b/target/linux/ramips/dts/U7621-06.dtsi index 0502904bd..80c129dfb 100644 --- a/target/linux/ramips/dts/U7621-06.dtsi +++ b/target/linux/ramips/dts/U7621-06.dtsi @@ -40,6 +40,10 @@ / { compatible = "unielec,u7621-06", "mediatek,mt7621-soc"; + aliases { + led-status = &led_status; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -57,8 +61,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -71,7 +73,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "u7621-06:green:status"; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; }; @@ -94,8 +96,6 @@ &sdhci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&sdhci_pins>; }; &pcie { diff --git a/target/linux/ramips/dts/U7628-01-128M-16M.dts b/target/linux/ramips/dts/U7628-01-128M-16M.dts index 4b3345da3..c238e024e 100644 --- a/target/linux/ramips/dts/U7628-01-128M-16M.dts +++ b/target/linux/ramips/dts/U7628-01-128M-16M.dts @@ -50,34 +50,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <12000000>; m25p,chunked-io = <32>; - partition@0 { - label = "bootloader"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/U7628-01.dtsi b/target/linux/ramips/dts/U7628-01.dtsi index 34226a4a4..f9f94be82 100644 --- a/target/linux/ramips/dts/U7628-01.dtsi +++ b/target/linux/ramips/dts/U7628-01.dtsi @@ -40,14 +40,16 @@ / { compatible = "unielec,u7628-01", "mediatek,mt7628an-soc"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -59,7 +61,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "u7628-01:green:power"; gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/UBNT-ER-e50.dtsi b/target/linux/ramips/dts/UBNT-ER-e50.dtsi index 0947dd610..2a983d08f 100644 --- a/target/linux/ramips/dts/UBNT-ER-e50.dtsi +++ b/target/linux/ramips/dts/UBNT-ER-e50.dtsi @@ -17,8 +17,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,36 +34,42 @@ &nand { status = "okay"; - partition@0 { - label = "u-boot"; - reg = <0x0 0x80000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@80000 { - label = "u-boot-env"; - reg = <0x80000 0x60000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; - factory: partition@e0000 { - label = "factory"; - reg = <0xe0000 0x60000>; - }; + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x60000>; + read-only; + }; - partition@140000 { - label = "kernel1"; - reg = <0x140000 0x300000>; - }; + factory: partition@e0000 { + label = "factory"; + reg = <0xe0000 0x60000>; + }; - partition@440000 { - label = "kernel2"; - reg = <0x440000 0x300000>; - }; + partition@140000 { + label = "kernel1"; + reg = <0x140000 0x300000>; + }; - partition@740000 { - label = "ubi"; - reg = <0x740000 0xf7c0000>; + partition@440000 { + label = "kernel2"; + reg = <0x440000 0x300000>; + }; + + partition@740000 { + label = "ubi"; + reg = <0x740000 0xf7c0000>; + }; }; }; @@ -79,24 +83,30 @@ }; &spi0 { - /* This board has 2Mb spi flash soldered in and visible - from manufacturer's firmware. - But this SoC shares spi and nand pins, - and current driver does't handle this sharing well */ + /* + * This board has 2Mb spi flash soldered in and visible + * from manufacturer's firmware. + * But this SoC shares spi and nand pins, + * and current driver doesn't handle this sharing well + */ status = "disabled"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <1>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "spi"; - reg = <0x0 0x200000>; - read-only; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "spi"; + reg = <0x0 0x200000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/UR-326N4G.dts b/target/linux/ramips/dts/UR-326N4G.dts index ecb747c76..367b53838 100644 --- a/target/linux/ramips/dts/UR-326N4G.dts +++ b/target/linux/ramips/dts/UR-326N4G.dts @@ -9,35 +9,43 @@ compatible = "upvel,ur-326n4g", "ralink,rt3052-soc"; model = "UPVEL UR-326N4G"; + aliases { + led-status = &led_wps; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -59,7 +67,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "ur-326n4g:green:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -72,8 +80,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { diff --git a/target/linux/ramips/dts/UR-336UN.dts b/target/linux/ramips/dts/UR-336UN.dts index 31aa62e72..8acbc9e25 100644 --- a/target/linux/ramips/dts/UR-336UN.dts +++ b/target/linux/ramips/dts/UR-336UN.dts @@ -9,35 +9,43 @@ compatible = "upvel,ur-336un", "ralink,rt3052-soc"; model = "UPVEL UR-336UN"; + aliases { + led-status = &led_wps; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -59,7 +67,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "ur-336un:green:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -72,8 +80,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { diff --git a/target/linux/ramips/dts/V11STFE.dts b/target/linux/ramips/dts/V11STFE.dts index ae306670c..899330d77 100644 --- a/target/linux/ramips/dts/V11STFE.dts +++ b/target/linux/ramips/dts/V11STFE.dts @@ -9,51 +9,47 @@ compatible = "ralink,v11st-fe", "ralink,rt2880-soc"; model = "Ralink V11ST-FE"; - pci@440000 { - status = "okay"; - - host-bridge { - pci-bridge@1 { - status = "okay"; - }; - }; + aliases { + led-status = &led_status; }; nor-flash@1c000000 { compatible = "cfi-flash"; reg = <0x1c000000 0x800000>; bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - reg = <0x0 0x0030000>; - label = "u-boot"; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - reg = <0x00030000 0x00010000>; - label = "u-boot-env"; - read-only; - }; + partition@0 { + reg = <0x0 0x0030000>; + label = "u-boot"; + read-only; + }; - factory: partition@40000 { - reg = <0x00040000 0x00010000>; - label = "factory"; - read-only; - }; + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; - partition@50000 { - reg = <0x00050000 0x003b0000>; - label = "firmware"; + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x003b0000>; + label = "firmware"; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { @@ -66,7 +62,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "v11st-fe:green:status"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -81,6 +77,10 @@ status = "okay"; }; +&pci { + status = "okay"; +}; + &wmac { ralink,mtd-eeprom = <&factory 0>; }; diff --git a/target/linux/ramips/dts/V22RW-2X2.dts b/target/linux/ramips/dts/V22RW-2X2.dts index 8b0fba191..8fe822505 100644 --- a/target/linux/ramips/dts/V22RW-2X2.dts +++ b/target/linux/ramips/dts/V22RW-2X2.dts @@ -9,42 +9,50 @@ compatible = "ralink,v22rw-2x2", "ralink,rt3052-soc"; model = "Ralink AP-RT3052-V22RW-2X2"; + aliases { + led-status = &led_security; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - security { + led_security: security { label = "v22rw-2x2:green:security"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/VAR11N-300.dts b/target/linux/ramips/dts/VAR11N-300.dts index 54bcb3df0..8fec52730 100644 --- a/target/linux/ramips/dts/VAR11N-300.dts +++ b/target/linux/ramips/dts/VAR11N-300.dts @@ -9,10 +9,14 @@ compatible = "vonets,var11n-300", "ralink,mt7620n-soc"; model = "Vonets VAR11N-300"; + aliases { + led-status = &led_system; + }; + gpio-leds { compatible = "gpio-leds"; - system { + led_system: system { label = "var11n-300:blue:system"; gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -40,33 +42,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/VOCORE-16M.dts b/target/linux/ramips/dts/VOCORE-16M.dts index f6422f162..0a8ddab0f 100644 --- a/target/linux/ramips/dts/VOCORE-16M.dts +++ b/target/linux/ramips/dts/VOCORE-16M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/VOCORE-8M.dts b/target/linux/ramips/dts/VOCORE-8M.dts index e329324fd..affecb84a 100644 --- a/target/linux/ramips/dts/VOCORE-8M.dts +++ b/target/linux/ramips/dts/VOCORE-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/VOCORE.dtsi b/target/linux/ramips/dts/VOCORE.dtsi index 4c4522710..9b214dde8 100644 --- a/target/linux/ramips/dts/VOCORE.dtsi +++ b/target/linux/ramips/dts/VOCORE.dtsi @@ -5,6 +5,10 @@ / { compatible = "vocore,vocore", "ralink,rt5350-soc"; + aliases { + led-status = &led_status; + }; + gpio-export { compatible = "gpio-export"; #size-cells = <0>; @@ -134,7 +138,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { /* UARTF_RXD */ label = "vocore:green:status"; gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/ramips/dts/VOCORE2.dts b/target/linux/ramips/dts/VOCORE2.dts index 43f847585..89c975ab2 100644 --- a/target/linux/ramips/dts/VOCORE2.dts +++ b/target/linux/ramips/dts/VOCORE2.dts @@ -8,10 +8,14 @@ compatible = "vocore,vocore2", "mediatek,mt7628an-soc"; model = "VoCore2"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "vocore2:fuchsia:status"; gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; }; @@ -22,34 +26,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/VOCORE2LITE.dts b/target/linux/ramips/dts/VOCORE2LITE.dts index 8e87c1d51..b9cfdfc65 100644 --- a/target/linux/ramips/dts/VOCORE2LITE.dts +++ b/target/linux/ramips/dts/VOCORE2LITE.dts @@ -8,10 +8,14 @@ compatible = "vocore,vocore2lite", "vocore,vocore2", "mediatek,mt7628an-soc"; model = "VoCore2-Lite"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "vocore2lite:green:status"; gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; }; @@ -22,34 +26,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/VR500.dts b/target/linux/ramips/dts/VR500.dts index 776cc2ac5..48da2b5dd 100644 --- a/target/linux/ramips/dts/VR500.dts +++ b/target/linux/ramips/dts/VR500.dts @@ -9,6 +9,10 @@ compatible = "planex,vr500", "mediatek,mt7621-soc"; model = "Planex VR500"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "vr500:green:power"; gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; }; @@ -29,8 +33,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -45,34 +47,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3fb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/W06.dts b/target/linux/ramips/dts/W06.dts index c29a01ff9..f609ae72d 100644 --- a/target/linux/ramips/dts/W06.dts +++ b/target/linux/ramips/dts/W06.dts @@ -35,8 +35,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -72,40 +70,44 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xeb0000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@f00000 { - label = "user-data"; - reg = <0xf00000 0x100000>; - read-only; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xeb0000>; + }; + + partition@f00000 { + label = "user-data"; + reg = <0xf00000 0x100000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/W150M.dts b/target/linux/ramips/dts/W150M.dts index d2f857408..e963f2a59 100644 --- a/target/linux/ramips/dts/W150M.dts +++ b/target/linux/ramips/dts/W150M.dts @@ -9,35 +9,43 @@ compatible = "tenda,w150m", "ralink,rt3050-soc"; model = "Tenda W150M"; + aliases { + led-status = &led_ap; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3c8000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3c8000>; + }; }; }; @@ -49,7 +57,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - ap { + led_ap: ap { label = "w150m:blue:ap"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -77,8 +85,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/W2914NSV2.dts b/target/linux/ramips/dts/W2914NSV2.dts index ac26dbe75..e1a9c4162 100644 --- a/target/linux/ramips/dts/W2914NSV2.dts +++ b/target/linux/ramips/dts/W2914NSV2.dts @@ -13,11 +13,6 @@ gpio-leds { compatible = "gpio-leds"; - // Only USB LED is connected to GPIO. - // All of other LEDs are connected directly to - // switch, WiFi chip, Vcc, so they are not controllable - // via GPIO - usb { label = "w2914nsv2:green:usb"; gpios = <&gpio0 27 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/W2914NSV2.dtsi b/target/linux/ramips/dts/W2914NSV2.dtsi index d67998dfb..f960bc26a 100644 --- a/target/linux/ramips/dts/W2914NSV2.dtsi +++ b/target/linux/ramips/dts/W2914NSV2.dtsi @@ -12,8 +12,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -38,56 +36,60 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - wifi@14c3,7603 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; +}; - pcie1 { - wifi@14c3,7662 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/W306R_V20.dts b/target/linux/ramips/dts/W306R_V20.dts index 5aeb91cfb..75df091b0 100644 --- a/target/linux/ramips/dts/W306R_V20.dts +++ b/target/linux/ramips/dts/W306R_V20.dts @@ -9,42 +9,50 @@ compatible = "tenda,w306r-v2", "ralink,rt3052-soc"; model = "Tenda W306R V2.0"; + aliases { + led-status = &led_sys; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - sys { + led_sys: sys { label = "w306r-v20:green:sys"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/W502U.dts b/target/linux/ramips/dts/W502U.dts index b02c6c125..6b8775ef3 100644 --- a/target/linux/ramips/dts/W502U.dts +++ b/target/linux/ramips/dts/W502U.dts @@ -9,6 +9,10 @@ compatible = "alfanetworks,w502u", "ralink,rt3052-soc"; model = "ALFA Networks W502U"; + aliases { + led-status = &led_wps; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -18,30 +22,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; @@ -53,7 +61,7 @@ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "w502u:blue:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -61,8 +69,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/WCR-1166DS.dts b/target/linux/ramips/dts/WCR-1166DS.dts index 34734ceda..420b3e5ab 100644 --- a/target/linux/ramips/dts/WCR-1166DS.dts +++ b/target/linux/ramips/dts/WCR-1166DS.dts @@ -9,10 +9,12 @@ compatible = "buffalo,wcr-1166ds", "mediatek,mt7628an-soc"; model = "Buffalo WCR-1166DS"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; aoss { @@ -73,7 +75,7 @@ gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wcr-1166ds:green:power"; gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; }; @@ -95,13 +97,13 @@ &pcie { status = "okay"; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; @@ -118,51 +120,55 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7c0000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@810000 { - label = "firmware2"; - reg = <0x810000 0x7c0000>; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7c0000>; + }; - partition@fd0000 { - label = "glbcfg"; - reg = <0xfd0000 0x10000>; - read-only; - }; + partition@810000 { + label = "firmware2"; + reg = <0x810000 0x7c0000>; + }; - partition@fe0000 { - label = "board_data"; - reg = <0xfe0000 0x10000>; - read-only; + partition@fd0000 { + label = "glbcfg"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "board_data"; + reg = <0xfe0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/WCR150GN.dts b/target/linux/ramips/dts/WCR150GN.dts index 9a4c4fc7d..93c7c5493 100644 --- a/target/linux/ramips/dts/WCR150GN.dts +++ b/target/linux/ramips/dts/WCR150GN.dts @@ -9,35 +9,43 @@ compatible = "sparklan,wcr150gn", "ralink,rt3050-soc"; model = "Sparklan WCR-150GN"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -49,7 +57,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wcr-150gn:amber:power"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { diff --git a/target/linux/ramips/dts/WD03.dts b/target/linux/ramips/dts/WD03.dts index 454e757ce..1c9548c3a 100644 --- a/target/linux/ramips/dts/WD03.dts +++ b/target/linux/ramips/dts/WD03.dts @@ -6,7 +6,7 @@ #include / { - compatible = "ravpower,wd03", "ralink,mt7620a-soc"; + compatible = "ravpower,wd03", "ralink,mt7620n-soc"; model = "Ravpower WD03"; chosen { @@ -30,8 +30,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -50,37 +48,45 @@ status = "okay"; }; +&i2c { + status = "okay"; +}; + &spi0 { status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WE1026-5G-16M.dts b/target/linux/ramips/dts/WE1026-5G-16M.dts index e01e86423..631d02854 100644 --- a/target/linux/ramips/dts/WE1026-5G-16M.dts +++ b/target/linux/ramips/dts/WE1026-5G-16M.dts @@ -44,33 +44,37 @@ status = "okay"; en25q128@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WE1026-5G.dtsi b/target/linux/ramips/dts/WE1026-5G.dtsi index c357e1eee..f82c4b94b 100644 --- a/target/linux/ramips/dts/WE1026-5G.dtsi +++ b/target/linux/ramips/dts/WE1026-5G.dtsi @@ -63,8 +63,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -113,12 +111,13 @@ &pcie { status = "okay"; - pcie-bridge { - wifi@14c3,7662 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/WF-2881.dts b/target/linux/ramips/dts/WF-2881.dts index 33f521cb9..17011b1e3 100644 --- a/target/linux/ramips/dts/WF-2881.dts +++ b/target/linux/ramips/dts/WF-2881.dts @@ -9,6 +9,10 @@ compatible = "netis,wf-2881", "mediatek,mt7621-soc"; model = "NETIS WF-2881"; + aliases { + led-status = &led_wps; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "wf-2881:green:wps"; gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -49,55 +51,59 @@ &nand { status = "okay"; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x1000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@80000 { - label = "config"; - reg = <0x80000 0x80000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + read-only; + }; - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; - partition@140000 { - label = "firmware"; - reg = <0x140000 0x7E40000>; + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "firmware"; + reg = <0x140000 0x7E40000>; + }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/WHR-1166D.dts b/target/linux/ramips/dts/WHR-1166D.dts index ab5d2d25a..bfa0ebd64 100644 --- a/target/linux/ramips/dts/WHR-1166D.dts +++ b/target/linux/ramips/dts/WHR-1166D.dts @@ -9,6 +9,10 @@ compatible = "buffalo,whr-1166d", "ralink,mt7620a-soc"; model = "Buffalo WHR-1166D"; + aliases { + led-status = &led_power_green; + }; + gpio-leds { compatible = "gpio-leds"; @@ -22,7 +26,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - power2 { + led_power_green: power2 { label = "whr-1166d:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -50,8 +54,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -90,33 +92,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; @@ -160,13 +166,13 @@ &pcie { status = "okay"; +}; - pcie-bridge { - wifi@0,0 { - compatible = "pci0,0"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/WHR-300HP2.dts b/target/linux/ramips/dts/WHR-300HP2.dts index d405686d7..7acc84f16 100644 --- a/target/linux/ramips/dts/WHR-300HP2.dts +++ b/target/linux/ramips/dts/WHR-300HP2.dts @@ -9,6 +9,10 @@ compatible = "buffalo,whr-300hp2", "ralink,mt7620a-soc"; model = "Buffalo WHR-300HP2"; + aliases { + led-status = &led_power_green; + }; + gpio-leds { compatible = "gpio-leds"; @@ -22,7 +26,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - power2 { + led_power_green: power2 { label = "whr-300hp2:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -50,8 +54,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -90,33 +92,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WHR-600D.dts b/target/linux/ramips/dts/WHR-600D.dts index 611a23d9b..8fa4aa6e3 100644 --- a/target/linux/ramips/dts/WHR-600D.dts +++ b/target/linux/ramips/dts/WHR-600D.dts @@ -9,6 +9,10 @@ compatible = "buffalo,whr-600d", "ralink,mt7620a-soc"; model = "Buffalo WHR-600D"; + aliases { + led-status = &led_power_green; + }; + gpio-leds { compatible = "gpio-leds"; @@ -22,7 +26,7 @@ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; - power2 { + led_power_green: power2 { label = "whr-600d:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -50,8 +54,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -90,33 +92,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -147,12 +153,12 @@ &pcie { status = "okay"; +}; - pcie-bridge { - wifi@1814,5592 { - compatible = "pci1814,5592"; - reg = <0x0000 0 0 0 0>; - ralink,mtd-eeprom = <&factory 0x8000>; - }; +&pcie0 { + wifi@0,0 { + compatible = "pci1814,5592"; + reg = <0x0000 0 0 0 0>; + ralink,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/WHR-G300N.dts b/target/linux/ramips/dts/WHR-G300N.dts index a7c28341b..ce0d989ba 100644 --- a/target/linux/ramips/dts/WHR-G300N.dts +++ b/target/linux/ramips/dts/WHR-G300N.dts @@ -9,41 +9,49 @@ compatible = "buffalo,whr-g300n", "ralink,rt3052-soc"; model = "Buffalo WHR-G300N"; + aliases { + led-status = &led_router; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3a0000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@3f0000 { - label = "user"; - reg = <0x3f0000 0x10000>; - read-only; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3a0000>; + }; + + partition@3f0000 { + label = "user"; + reg = <0x3f0000 0x10000>; + read-only; + }; }; }; @@ -55,7 +63,7 @@ gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; - router { + led_router: router { label = "whr-g300n:green:router"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -68,8 +76,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/WIDORA-NEO-16M.dts b/target/linux/ramips/dts/WIDORA-NEO-16M.dts index 726515e7e..3672ca68d 100644 --- a/target/linux/ramips/dts/WIDORA-NEO-16M.dts +++ b/target/linux/ramips/dts/WIDORA-NEO-16M.dts @@ -14,33 +14,37 @@ pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x0fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x0fb0000>; + }; }; }; diff --git a/target/linux/ramips/dts/WIDORA-NEO-32M.dts b/target/linux/ramips/dts/WIDORA-NEO-32M.dts index 591101e3f..c4d9c7f26 100644 --- a/target/linux/ramips/dts/WIDORA-NEO-32M.dts +++ b/target/linux/ramips/dts/WIDORA-NEO-32M.dts @@ -14,33 +14,37 @@ pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; diff --git a/target/linux/ramips/dts/WIDORA-NEO.dtsi b/target/linux/ramips/dts/WIDORA-NEO.dtsi index 3334c88e2..4c037c703 100644 --- a/target/linux/ramips/dts/WIDORA-NEO.dtsi +++ b/target/linux/ramips/dts/WIDORA-NEO.dtsi @@ -6,6 +6,10 @@ / { compatible = "widora,neo", "mediatek,mt7628an-soc"; + aliases { + led-status = &led_wifi; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -18,7 +22,7 @@ gpio-leds { compatible = "gpio-leds"; - wifi { + led_wifi: wifi { label = "widora:orange:wifi"; gpios = <&wgpio 0 GPIO_ACTIVE_HIGH>; default-state = "on"; @@ -27,8 +31,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { diff --git a/target/linux/ramips/dts/WITI.dtsi b/target/linux/ramips/dts/WITI.dtsi index 767ea03ff..abc28e649 100644 --- a/target/linux/ramips/dts/WITI.dtsi +++ b/target/linux/ramips/dts/WITI.dtsi @@ -26,8 +26,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -46,58 +44,60 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&factory 0xe000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0xe000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - mtd-mac-address = <&factory 0xe000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + mtd-mac-address = <&factory 0xe000>; }; }; diff --git a/target/linux/ramips/dts/WIZARD8800.dts b/target/linux/ramips/dts/WIZARD8800.dts index 3cd48cdeb..1e99359e3 100644 --- a/target/linux/ramips/dts/WIZARD8800.dts +++ b/target/linux/ramips/dts/WIZARD8800.dts @@ -19,33 +19,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -53,7 +57,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/WIZFI630A.dts b/target/linux/ramips/dts/WIZFI630A.dts index d12753650..efd1038b8 100644 --- a/target/linux/ramips/dts/WIZFI630A.dts +++ b/target/linux/ramips/dts/WIZFI630A.dts @@ -9,6 +9,10 @@ compatible = "wiznet,wizfi630a", "ralink,rt5350-soc"; model = "WIZnet WizFi630A"; + aliases { + led-status = &led_run; + }; + chosen { bootargs = "console=ttyS1,115200"; }; @@ -16,7 +20,7 @@ gpio-leds { compatible = "gpio-leds"; - run { + led_run: run { label = "wizfi630a::run"; gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; }; @@ -39,8 +43,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -54,7 +56,7 @@ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; linux,code = ; }; - + scm1 { label = "SCM1"; gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; @@ -77,37 +79,41 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; #size-cells = <1>; - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; - partition@30000 { - #size-cells = <1>; - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + #size-cells = <1>; + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - #size-cells = <1>; - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + #size-cells = <1>; + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - #size-cells = <1>; - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + #size-cells = <1>; + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + #size-cells = <1>; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WL-330N.dts b/target/linux/ramips/dts/WL-330N.dts index 0eb7b7ff7..31456c6cf 100644 --- a/target/linux/ramips/dts/WL-330N.dts +++ b/target/linux/ramips/dts/WL-330N.dts @@ -9,6 +9,10 @@ compatible = "asus,wl-330n", "ralink,rt3050-soc"; model = "Asus WL-330N"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wl-330n:blue:power"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -47,33 +49,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WL-330N3G.dts b/target/linux/ramips/dts/WL-330N3G.dts index 3801a9d9e..35836fb6f 100644 --- a/target/linux/ramips/dts/WL-330N3G.dts +++ b/target/linux/ramips/dts/WL-330N3G.dts @@ -9,6 +9,10 @@ compatible = "asus,wl-330n3g", "ralink,rt3050-soc"; model = "Asus WL-330N3G"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -22,7 +26,7 @@ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wl-330n3g:blue:power"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -52,33 +54,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WL-341V3.dts b/target/linux/ramips/dts/WL-341V3.dts index 02b8e1438..1cd1079c7 100644 --- a/target/linux/ramips/dts/WL-341V3.dts +++ b/target/linux/ramips/dts/WL-341V3.dts @@ -14,30 +14,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - boardnvram: partition@20000 { - label = "board-nvram"; - reg = <0x20000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + boardnvram: partition@20000 { + label = "board-nvram"; + reg = <0x20000 0x10000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0x3b0000>; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x3b0000>; + }; }; }; @@ -82,8 +86,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/WL-351.dts b/target/linux/ramips/dts/WL-351.dts index 0dd596cfe..baa6f131a 100644 --- a/target/linux/ramips/dts/WL-351.dts +++ b/target/linux/ramips/dts/WL-351.dts @@ -9,42 +9,50 @@ compatible = "sitecom,wl-351", "ralink,rt3052-soc"; model = "Sitecom WL-351 v1 002"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "wl-351:amber:power"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -62,8 +70,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/WL-WN575A3.dts b/target/linux/ramips/dts/WL-WN575A3.dts index 213cf9c70..3e51e99cd 100644 --- a/target/linux/ramips/dts/WL-WN575A3.dts +++ b/target/linux/ramips/dts/WL-WN575A3.dts @@ -19,8 +19,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -72,13 +70,13 @@ &pcie { status = "okay"; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; @@ -86,34 +84,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WLI-TX4-AG300N.dts b/target/linux/ramips/dts/WLI-TX4-AG300N.dts index 3c04d49b6..bfe4490af 100644 --- a/target/linux/ramips/dts/WLI-TX4-AG300N.dts +++ b/target/linux/ramips/dts/WLI-TX4-AG300N.dts @@ -11,42 +11,48 @@ compatible = "buffalo,wli-tx4-ag300n", "ralink,rt2880-soc"; model = "Buffalo WLI-TX4-AG300N"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { @@ -76,7 +82,7 @@ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wli-tx4-ag300n:blue:power"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/WLR-6000.dts b/target/linux/ramips/dts/WLR-6000.dts index 4f8ba6fff..a005774d0 100644 --- a/target/linux/ramips/dts/WLR-6000.dts +++ b/target/linux/ramips/dts/WLR-6000.dts @@ -9,10 +9,12 @@ compatible = "sitecom,wlr-6000", "ralink,rt3883-soc"; model = "Sitecom WLR-6000"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -25,7 +27,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "wlr-6000:red:power"; gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; }; @@ -97,78 +99,71 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <8600000>; m25p,fast-read; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x713000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@763000 { - label = "manufacture"; - reg = <0x763000 0x7D000>; - read-only; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0x713000>; + }; - partition@7E0000 { - label = "backup"; - reg = <0x7E0000 0x10000>; - read-only; - }; + partition@763000 { + label = "manufacture"; + reg = <0x763000 0x7D000>; + read-only; + }; - partition@7F0000 { - label = "storage"; - reg = <0x7F0000 0x10000>; - read-only; + partition@7E0000 { + label = "backup"; + reg = <0x7E0000 0x10000>; + read-only; + }; + + partition@7F0000 { + label = "storage"; + reg = <0x7F0000 0x10000>; + read-only; + }; }; }; }; &pci { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pci_pins>; +}; - pci_pins: pci { - pci { - ralink,group = "pci"; - ralink,function = "pci-fnc"; - }; - }; +&pci1 { + status = "okay"; - host-bridge { - pci-bridge@1 { - status = "okay"; - - wifi@1814,3091 { - compatible = "pci1814,3091"; - reg = <0x10000 0 0 0 0>; - ralink,mtd-eeprom = <&factory 0x8000>; - }; - }; + wifi@0,0 { + compatible = "pci1814,3091"; + reg = <0x10000 0 0 0 0>; + ralink,mtd-eeprom = <&factory 0x8000>; }; }; diff --git a/target/linux/ramips/dts/WMDR-143N.dts b/target/linux/ramips/dts/WMDR-143N.dts index ccb1df351..a758137d0 100644 --- a/target/linux/ramips/dts/WMDR-143N.dts +++ b/target/linux/ramips/dts/WMDR-143N.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <25000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x00010000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x00010000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WMR-300.dts b/target/linux/ramips/dts/WMR-300.dts index 63354dafb..662da6140 100644 --- a/target/linux/ramips/dts/WMR-300.dts +++ b/target/linux/ramips/dts/WMR-300.dts @@ -9,6 +9,10 @@ compatible = "buffalo,wmr-300", "ralink,mt7620n-soc"; model = "Buffalo WMR-300"; + aliases { + led-status = &led_status; + }; + gpio-leds { compatible = "gpio-leds"; @@ -22,7 +26,7 @@ gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; }; - power { + led_status: status { label = "wmr-300:green:status"; gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -56,33 +58,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WN-AX1167GR.dts b/target/linux/ramips/dts/WN-AX1167GR.dts new file mode 100644 index 000000000..3015bdbbe --- /dev/null +++ b/target/linux/ramips/dts/WN-AX1167GR.dts @@ -0,0 +1,169 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "iodata,wn-ax1167gr", "mediatek,mt7621-soc"; + model = "I-O DATA WN-AX1167GR"; + + aliases { + led-status = &led_power; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: power { + label = "wn-ax1167gr:green:power"; + gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wn-ax1167gr:green:wps"; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + auto { + label = "auto"; + gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + custom { + label = "custom"; + gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "Config"; + reg = <0x30000 0x10000>; + read-only; + }; + + Factory: partition@40000 { + label = "Factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + iNIC_rf: partition@50000 { + label = "iNIC_rf"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0xf30000>; + }; + + partition@f90000 { + label = "Key"; + reg = <0xf90000 0x10000>; + read-only; + }; + + partition@fa0000 { + label = "backup"; + reg = <0xfa0000 0x10000>; + read-only; + }; + + partition@fb0000 { + label = "storage"; + reg = <0xfb0000 0x50000>; + read-only; + }; + }; + }; +}; + +ðernet { + mtd-mac-address = <&iNIC_rf 0x4>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart2", "uart3", "jtag"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&iNIC_rf 0x0>; + }; +}; + +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&Factory 0x0>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/WN-GX300GR.dts b/target/linux/ramips/dts/WN-GX300GR.dts index aa89f0555..491a93c87 100644 --- a/target/linux/ramips/dts/WN-GX300GR.dts +++ b/target/linux/ramips/dts/WN-GX300GR.dts @@ -9,6 +9,10 @@ compatible = "iodata,wn-gx300gr", "mediatek,mt7621-soc"; model = "I-O DATA WN-GX300GR"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x4000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "wn-gx300gr:green:power"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -70,58 +72,62 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "Bootloader"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "Config"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; - Factory: partition@40000 { - label = "Factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "Config"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "iNIC_rf"; - reg = <0x50000 0x10000>; - read-only; - }; + Factory: partition@40000 { + label = "Factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@60000 { - label = "firmware"; - reg = <0x60000 0x770000>; - }; + partition@50000 { + label = "iNIC_rf"; + reg = <0x50000 0x10000>; + read-only; + }; - partition@7d0000 { - label = "Key"; - reg = <0x7d0000 0x10000>; - read-only; - }; + partition@60000 { + label = "firmware"; + reg = <0x60000 0x770000>; + }; - partition@7e0000 { - label = "backup"; - reg = <0x7e0000 0x10000>; - read-only; - }; + partition@7d0000 { + label = "Key"; + reg = <0x7d0000 0x10000>; + read-only; + }; - partition@7f0000 { - label = "storage"; - reg = <0x7f0000 0x10000>; - read-only; + partition@7e0000 { + label = "backup"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "storage"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; @@ -141,13 +147,12 @@ &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&Factory 0x0>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&Factory 0x0>; }; }; diff --git a/target/linux/ramips/dts/WN3000RPV3.dts b/target/linux/ramips/dts/WN3000RPV3.dts index 8fb76c0a4..ba81397f8 100644 --- a/target/linux/ramips/dts/WN3000RPV3.dts +++ b/target/linux/ramips/dts/WN3000RPV3.dts @@ -11,6 +11,10 @@ compatible = "netgear,wn3000rp-v3", "ralink,mt7620a-soc"; model = "Netgear WN3000RPv3"; + aliases { + led-status = &led_power_green; + }; + chosen { bootargs = "console=ttyS0,57600"; }; @@ -18,7 +22,7 @@ gpio-leds { compatible = "gpio-leds"; - power_g { + led_power_green: power_g { label = "wn3000rpv3:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; default-state = "on"; @@ -67,8 +71,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -93,33 +95,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "firmware"; - reg = <0x40000 0x7b0000>; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - art: partition@7f0000 { - label = "art"; - reg = <0x7f0000 0x10000>; - read-only; + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7b0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/WNCE2001.dts b/target/linux/ramips/dts/WNCE2001.dts index 0421ee660..a89bb8a72 100644 --- a/target/linux/ramips/dts/WNCE2001.dts +++ b/target/linux/ramips/dts/WNCE2001.dts @@ -9,6 +9,10 @@ compatible = "netgear,wnce2001", "ralink,rt3052-soc"; model = "Netgear WNCE2001"; + aliases { + led-status = &led_power_green; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -16,7 +20,7 @@ gpio-leds { compatible = "gpio-leds"; - power-green { + led_power_green: power-green { label = "wnce2001:green:power"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -39,8 +43,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -73,50 +75,54 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - factory: partition@30000 { - label = "factory"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - partition@40000 { - label = "config"; - reg = <0x40000 0x20000>; - read-only; - }; + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@60000 { - label = "language"; - reg = <0x60000 0x30000>; - read-only; - }; + partition@40000 { + label = "config"; + reg = <0x40000 0x20000>; + read-only; + }; - partition@90000 { - label = "pot"; - reg = <0x90000 0x10000>; - read-only; - }; + partition@60000 { + label = "language"; + reg = <0x60000 0x30000>; + read-only; + }; - partition@a0000 { - label = "checksum"; - reg = <0xa0000 0x10000>; - }; + partition@90000 { + label = "pot"; + reg = <0x90000 0x10000>; + read-only; + }; - partition@b0000 { - label = "firmware"; - reg = <0xb0000 0x350000>; + partition@a0000 { + label = "checksum"; + reg = <0xa0000 0x10000>; + }; + + partition@b0000 { + label = "firmware"; + reg = <0xb0000 0x350000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WNDR3700V5.dts b/target/linux/ramips/dts/WNDR3700V5.dts index ce9644036..3d3fde997 100644 --- a/target/linux/ramips/dts/WNDR3700V5.dts +++ b/target/linux/ramips/dts/WNDR3700V5.dts @@ -9,6 +9,10 @@ compatible = "netgear,wndr3700-v5", "mediatek,mt7621-soc"; model = "Netgear WNDR3700v5"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wndr3700v5:green:power"; gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; wps { @@ -73,56 +75,58 @@ status = "okay"; mx25l12805d@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@f30000 { - label = "factory"; - reg = <0xf30000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xee0000>; + factory: partition@f30000 { + label = "factory"; + reg = <0xf30000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xee0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; @@ -133,7 +137,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "rgmii2", "mdio", "wdt"; + ralink,group = "rgmii2", "mdio", "wdt"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/WR1200JS.dts b/target/linux/ramips/dts/WR1200JS.dts index 2169e74e2..f79164864 100644 --- a/target/linux/ramips/dts/WR1200JS.dts +++ b/target/linux/ramips/dts/WR1200JS.dts @@ -9,6 +9,10 @@ compatible = "youhua,wr1200js", "mediatek,mt7621-soc"; model = "YouHua WR1200JS"; + aliases { + led-status = &led_wps; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -26,7 +30,7 @@ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "wr1200js:blue:wps"; gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; @@ -39,8 +43,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -67,60 +69,62 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; - led { - led-sources = <2>; - led-active-low; - }; + led { + led-sources = <2>; + led-active-low; }; }; }; diff --git a/target/linux/ramips/dts/WR512-3GN-4M.dts b/target/linux/ramips/dts/WR512-3GN-4M.dts index dab003fd9..ba3834982 100644 --- a/target/linux/ramips/dts/WR512-3GN-4M.dts +++ b/target/linux/ramips/dts/WR512-3GN-4M.dts @@ -11,30 +11,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3c8000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3c8000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WR512-3GN-8M.dts b/target/linux/ramips/dts/WR512-3GN-8M.dts index 16abf9799..77d625f9f 100644 --- a/target/linux/ramips/dts/WR512-3GN-8M.dts +++ b/target/linux/ramips/dts/WR512-3GN-8M.dts @@ -11,30 +11,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WR512-3GN.dtsi b/target/linux/ramips/dts/WR512-3GN.dtsi index 854ab251b..4b55869a9 100644 --- a/target/linux/ramips/dts/WR512-3GN.dtsi +++ b/target/linux/ramips/dts/WR512-3GN.dtsi @@ -6,6 +6,10 @@ / { compatible = "unbranded,wr512-3gn", "ralink,rt3052-soc"; + aliases { + led-status = &led_wps; + }; + gpio-leds { compatible = "gpio-leds"; @@ -24,7 +28,7 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; - wps { + led_wps: wps { label = "wr512-3gn:green:wps"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -37,8 +41,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset_wps { diff --git a/target/linux/ramips/dts/WR6202.dts b/target/linux/ramips/dts/WR6202.dts index 2f3981804..915f63842 100644 --- a/target/linux/ramips/dts/WR6202.dts +++ b/target/linux/ramips/dts/WR6202.dts @@ -29,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -51,30 +49,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; diff --git a/target/linux/ramips/dts/WRC-1167GHBK2-S.dts b/target/linux/ramips/dts/WRC-1167GHBK2-S.dts index 7b1cfd730..05c1749d2 100644 --- a/target/linux/ramips/dts/WRC-1167GHBK2-S.dts +++ b/target/linux/ramips/dts/WRC-1167GHBK2-S.dts @@ -9,6 +9,10 @@ compatible = "elecom,wrc-1167ghbk2-s", "mediatek,mt7621-soc"; model = "ELECOM WRC-1167GHBK2-S"; + aliases { + led-status = &led_power_green; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -31,7 +35,7 @@ gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; }; - power_green { + led_power_green: power_green { label = "wrc-1167ghbk2-s:green:power"; gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; @@ -54,8 +58,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -80,46 +82,50 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf20000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@f70000 { - label = "user_data"; - reg = <0xf70000 0x80000>; - read-only; - }; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf20000>; + }; - partition@ff0000 { - label = "NVRAM"; - reg = <0xff0000 0x10000>; - read-only; + partition@f70000 { + label = "user_data"; + reg = <0xf70000 0x80000>; + read-only; + }; + + partition@ff0000 { + label = "NVRAM"; + reg = <0xff0000 0x10000>; + read-only; + }; }; }; }; @@ -135,8 +141,10 @@ &pcie { status = "okay"; - // WRC-1167GHBK2-S has MT7615D for 2.4/5 GHz wifi, - // but it's not supported in OpenWrt. + /* + * WRC-1167GHBK2-S has MT7615D for 2.4/5 GHz wifi, + * but it's not supported in OpenWrt. + */ }; &xhci { diff --git a/target/linux/ramips/dts/WRC-1900GST.dts b/target/linux/ramips/dts/WRC-1900GST.dts new file mode 100644 index 000000000..550a27b9c --- /dev/null +++ b/target/linux/ramips/dts/WRC-1900GST.dts @@ -0,0 +1,9 @@ +/dts-v1/; + +#include "elecom_wrc-gst.dtsi" + + +/ { + compatible = "elecom,wrc-1900gst", "mediatek,mt7621-soc"; + model = "ELECOM WRC-1900GST"; + }; diff --git a/target/linux/ramips/dts/WRC-2533GST.dts b/target/linux/ramips/dts/WRC-2533GST.dts new file mode 100644 index 000000000..7aecdccbf --- /dev/null +++ b/target/linux/ramips/dts/WRC-2533GST.dts @@ -0,0 +1,9 @@ +/dts-v1/; + +#include "elecom_wrc-gst.dtsi" + + +/ { + compatible = "elecom,wrc-2533gst", "mediatek,mt7621-soc"; + model = "ELECOM WRC-2533GST"; + }; diff --git a/target/linux/ramips/dts/WRH-300CR.dts b/target/linux/ramips/dts/WRH-300CR.dts index 2b40f981f..22a8788e4 100644 --- a/target/linux/ramips/dts/WRH-300CR.dts +++ b/target/linux/ramips/dts/WRH-300CR.dts @@ -9,10 +9,14 @@ compatible = "elecom,wrh-300cr", "ralink,mt7620n-soc"; model = "ELECOM WRH-300CR"; + aliases { + led-status = &led_wps; + }; + gpio-leds { compatible = "gpio-leds"; - wps { + led_wps: wps { label = "wrh-300cr:green:wps"; gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -64,38 +66,42 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; - partition@50000 { - label = "recover"; - reg = <0x50000 0x1c0000>; - read-only; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@210000 { - label = "firmware"; - reg = <0x210000 0xdf0000>; + partition@50000 { + label = "recover"; + reg = <0x50000 0x1c0000>; + read-only; + }; + + partition@210000 { + label = "firmware"; + reg = <0x210000 0xdf0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WRTNODE.dts b/target/linux/ramips/dts/WRTNODE.dts index 888d32ab1..665693f9d 100644 --- a/target/linux/ramips/dts/WRTNODE.dts +++ b/target/linux/ramips/dts/WRTNODE.dts @@ -8,10 +8,14 @@ compatible = "wrtnode,wrtnode", "ralink,mt7620n-soc"; model = "WRTNODE"; + aliases { + led-status = &led_indicator; + }; + gpio-leds { compatible = "gpio-leds"; - indicator { + led_indicator: indicator { label = "wrtnode:blue:indicator"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -34,33 +38,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WRTNODE2.dtsi b/target/linux/ramips/dts/WRTNODE2.dtsi index 4253c57a3..b5746ca48 100644 --- a/target/linux/ramips/dts/WRTNODE2.dtsi +++ b/target/linux/ramips/dts/WRTNODE2.dtsi @@ -12,8 +12,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -28,34 +26,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; diff --git a/target/linux/ramips/dts/WRTNODE2P.dts b/target/linux/ramips/dts/WRTNODE2P.dts index 53619138b..d49470afb 100644 --- a/target/linux/ramips/dts/WRTNODE2P.dts +++ b/target/linux/ramips/dts/WRTNODE2P.dts @@ -6,20 +6,24 @@ compatible = "wrtnode,wrtnode2p", "wrtnode,wrtnode2", "mediatek,mt7628an-soc"; model = "WRTnode2P"; + aliases { + led-status = &led_indicator; + }; + gpio-leds { compatible = "gpio-leds"; - indicator { + led_indicator: indicator { label = "wrtnode:blue:indicator"; gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; }; - }; + }; }; &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "gpio", "jtag"; + ralink,group = "i2c", "gpio"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/WRTNODE2R.dts b/target/linux/ramips/dts/WRTNODE2R.dts index abcbc7377..79f65e059 100644 --- a/target/linux/ramips/dts/WRTNODE2R.dts +++ b/target/linux/ramips/dts/WRTNODE2R.dts @@ -6,14 +6,18 @@ compatible = "wrtnode,wrtnode2r", "wrtnode,wrtnode2", "mediatek,mt7628an-soc"; model = "WRTnode2R"; + aliases { + led-status = &led_indicator; + }; + gpio-leds { compatible = "gpio-leds"; - indicator { + led_indicator: indicator { label = "wrtnode:blue:indicator"; gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; }; - }; + }; }; &pinctrl { diff --git a/target/linux/ramips/dts/WSR-1166.dts b/target/linux/ramips/dts/WSR-1166.dts index 38edbde74..28ac6ab6d 100644 --- a/target/linux/ramips/dts/WSR-1166.dts +++ b/target/linux/ramips/dts/WSR-1166.dts @@ -9,6 +9,10 @@ compatible = "buffalo,wsr-1166dhp", "mediatek,mt7621-soc"; model = "Buffalo WSR-1166DHP"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; @@ -46,7 +50,7 @@ gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "wsr-1166:green:power"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -64,8 +68,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; power { @@ -118,39 +120,43 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf90000>; - }; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; - partition@fe0000 { - label = "board_data"; - reg = <0xfe0000 0x20000>; + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf90000>; + }; + + partition@fe0000 { + label = "board_data"; + reg = <0xfe0000 0x20000>; + }; }; }; }; @@ -166,22 +172,20 @@ &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/WSR-600.dts b/target/linux/ramips/dts/WSR-600.dts index 1db280902..faee19dce 100644 --- a/target/linux/ramips/dts/WSR-600.dts +++ b/target/linux/ramips/dts/WSR-600.dts @@ -9,6 +9,10 @@ compatible = "buffalo,wsr-600dhp", "mediatek,mt7621-soc"; model = "Buffalo WSR-600DHP"; + aliases { + led-status = &led_power; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x4000000>; @@ -21,7 +25,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "wsr-600:green:power"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; @@ -64,8 +68,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; power { @@ -118,34 +120,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; @@ -161,21 +167,19 @@ &pcie { status = "okay"; +}; - pcie0 { - rt5592@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - ralink,mtd-eeprom = <&factory 0x8000>; - }; +&pcie0 { + rt5592@0,0 { + reg = <0x0000 0 0 0 0>; + ralink,mtd-eeprom = <&factory 0x8000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/WT1520-4M.dts b/target/linux/ramips/dts/WT1520-4M.dts index 358d83953..f9c8414ec 100644 --- a/target/linux/ramips/dts/WT1520-4M.dts +++ b/target/linux/ramips/dts/WT1520-4M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WT1520-8M.dts b/target/linux/ramips/dts/WT1520-8M.dts index 0451998b6..fec5ec204 100644 --- a/target/linux/ramips/dts/WT1520-8M.dts +++ b/target/linux/ramips/dts/WT1520-8M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WT1520.dtsi b/target/linux/ramips/dts/WT1520.dtsi index 95886d7e2..1a383876a 100644 --- a/target/linux/ramips/dts/WT1520.dtsi +++ b/target/linux/ramips/dts/WT1520.dtsi @@ -13,8 +13,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/WT3020-4M.dts b/target/linux/ramips/dts/WT3020-4M.dts index f7e87c673..88c76b49e 100644 --- a/target/linux/ramips/dts/WT3020-4M.dts +++ b/target/linux/ramips/dts/WT3020-4M.dts @@ -11,33 +11,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WT3020-8M.dts b/target/linux/ramips/dts/WT3020-8M.dts index b2397d2cd..7e75ad3a5 100644 --- a/target/linux/ramips/dts/WT3020-8M.dts +++ b/target/linux/ramips/dts/WT3020-8M.dts @@ -19,33 +19,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/WT3020.dtsi b/target/linux/ramips/dts/WT3020.dtsi index 91720e32c..615dcf381 100644 --- a/target/linux/ramips/dts/WT3020.dtsi +++ b/target/linux/ramips/dts/WT3020.dtsi @@ -6,10 +6,12 @@ / { compatible = "nexx,wt3020", "ralink,mt7620n-soc"; + aliases { + led-status = &led_power; + }; + gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -22,7 +24,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "wt3020:blue:power"; gpios = <&gpio3 0 GPIO_ACTIVE_HIGH>; }; diff --git a/target/linux/ramips/dts/WZR-AGL300NH.dts b/target/linux/ramips/dts/WZR-AGL300NH.dts index ff7a5ecf9..e0b93a826 100644 --- a/target/linux/ramips/dts/WZR-AGL300NH.dts +++ b/target/linux/ramips/dts/WZR-AGL300NH.dts @@ -11,8 +11,8 @@ compatible = "buffalo,wzr-agl300nh", "ralink,rt2880-soc"; model = "Buffalo WZR-AGL300NH"; - pci@440000 { - status = "ok"; + aliases { + led-status = &led_router; }; cfi@1f000000 { @@ -20,30 +20,34 @@ reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -55,8 +59,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; wps { @@ -81,7 +83,7 @@ gpio-leds { compatible = "gpio-leds"; - router { + led_router: router { label = "wzr-agl300nh:green:router"; gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; }; @@ -134,6 +136,10 @@ }; }; +&pci { + status = "okay"; +}; + &wmac { ralink,mtd-eeprom = <&factory 0>; }; diff --git a/target/linux/ramips/dts/X5.dts b/target/linux/ramips/dts/X5.dts index 20c4237eb..ebd7d17d0 100644 --- a/target/linux/ramips/dts/X5.dts +++ b/target/linux/ramips/dts/X5.dts @@ -9,10 +9,14 @@ compatible = "poray,x5", "ralink,rt5350-soc"; model = "Poray X5"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "x5:green:power"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -35,8 +39,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; bat { @@ -75,33 +77,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/X8.dts b/target/linux/ramips/dts/X8.dts index 30041e0b0..14aea65c0 100644 --- a/target/linux/ramips/dts/X8.dts +++ b/target/linux/ramips/dts/X8.dts @@ -9,10 +9,14 @@ compatible = "poray,x8", "ralink,rt5350-soc"; model = "Poray X8"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "x8:green:power"; gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; @@ -20,8 +24,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -36,33 +38,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/XDXRN502J.dts b/target/linux/ramips/dts/XDXRN502J.dts index cba8f0881..a03c64a82 100644 --- a/target/linux/ramips/dts/XDXRN502J.dts +++ b/target/linux/ramips/dts/XDXRN502J.dts @@ -9,35 +9,43 @@ compatible = "unbranded,xdxrn502j", "ralink,rt3052-soc"; model = "XDX RN502J"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; @@ -49,7 +57,7 @@ gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "xdxrn502j:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -57,8 +65,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/Y1.dts b/target/linux/ramips/dts/Y1.dts index 8aed5c120..d9d00f082 100644 --- a/target/linux/ramips/dts/Y1.dts +++ b/target/linux/ramips/dts/Y1.dts @@ -6,10 +6,14 @@ compatible = "lenovo,newifi-y1", "ralink,mt7620a-soc"; model = "Lenovo Y1"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; - power1 { + led_power: power { label = "y1:blue:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/Y1.dtsi b/target/linux/ramips/dts/Y1.dtsi index 0db064576..560695ecb 100644 --- a/target/linux/ramips/dts/Y1.dtsi +++ b/target/linux/ramips/dts/Y1.dtsi @@ -12,8 +12,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -23,7 +21,7 @@ }; }; }; - + &gpio0 { status = "okay"; }; @@ -40,33 +38,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; @@ -81,17 +83,16 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; - + &wmac { ralink,mtd-eeprom = <&factory 0>; pinctrl-names = "default"; diff --git a/target/linux/ramips/dts/Y1S.dts b/target/linux/ramips/dts/Y1S.dts index 74f7ca93c..51bd10d75 100644 --- a/target/linux/ramips/dts/Y1S.dts +++ b/target/linux/ramips/dts/Y1S.dts @@ -6,14 +6,18 @@ compatible = "lenovo,newifi-y1s", "lenovo,newifi-y1", "ralink,mt7620a-soc"; model = "Lenovo Y1S"; + aliases { + led-status = &led_power_blue; + }; + gpio_export { compatible = "gpio-export"; #size-cells = <0>; - /* GPIO 54、55、56 USB1、2、3 */ + usb0 { gpio-export,name = "usb0"; - gpio-export,output = <1>; // GPIOF_OUT_INIT_HIGH - gpios = <&gpio2 14 GPIO_ACTIVE_HIGH>; // GPIO2:40+14=GPIO 54 + gpio-export,output = <1>; + gpios = <&gpio2 14 GPIO_ACTIVE_HIGH>; }; usb1 { gpio-export,name = "usb1"; @@ -35,7 +39,7 @@ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; - power2 { + led_power_blue: power2 { label = "y1s:blue:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts b/target/linux/ramips/dts/YOUKU-YK1.dts index 8a0e0819e..5c0699e2e 100644 --- a/target/linux/ramips/dts/YOUKU-YK1.dts +++ b/target/linux/ramips/dts/YOUKU-YK1.dts @@ -9,6 +9,10 @@ compatible = "youku,yk1", "ralink,mt7620a-soc"; model = "YOUKU YK1"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; wan { @@ -23,7 +27,7 @@ label = "youku-yk1:blue:usb"; gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "youku-yk1:blue:power"; gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; }; @@ -31,8 +35,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; @@ -62,33 +64,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-APE522II.dts b/target/linux/ramips/dts/ZBT-APE522II.dts index 05d053f22..79d76334e 100644 --- a/target/linux/ramips/dts/ZBT-APE522II.dts +++ b/target/linux/ramips/dts/ZBT-APE522II.dts @@ -44,8 +44,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -76,32 +74,36 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xf80000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; }; }; }; @@ -121,14 +123,13 @@ &pcie { status = "okay"; +}; - pcie-bridge { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/ZBT-CPE102.dts b/target/linux/ramips/dts/ZBT-CPE102.dts index 42add891c..eeaf07e33 100644 --- a/target/linux/ramips/dts/ZBT-CPE102.dts +++ b/target/linux/ramips/dts/ZBT-CPE102.dts @@ -13,10 +13,15 @@ bootargs = "console=ttyS0,115200"; }; + + aliases { + led-status = &led_4g_0; + }; + gpio-leds { compatible = "gpio-leds"; - 4g-0 { + led_4g_0: 4g-0 { label = "zbt-cpe102:green:4g-0"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -34,8 +39,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -62,33 +65,37 @@ status = "okay"; en25q64@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x760000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x760000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-WA05.dts b/target/linux/ramips/dts/ZBT-WA05.dts index b1586ae82..bd5bdb26b 100644 --- a/target/linux/ramips/dts/ZBT-WA05.dts +++ b/target/linux/ramips/dts/ZBT-WA05.dts @@ -9,6 +9,10 @@ compatible = "zbtlink,zbt-wa05", "ralink,mt7620n-soc"; model = "Zbtlink ZBT-WA05"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -16,7 +20,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "zbt-wa05:blue:power"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -34,8 +38,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -62,33 +64,37 @@ status = "okay"; en25q64@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x760000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x760000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE1226.dts b/target/linux/ramips/dts/ZBT-WE1226.dts index 5ece7567f..426d9ad8e 100644 --- a/target/linux/ramips/dts/ZBT-WE1226.dts +++ b/target/linux/ramips/dts/ZBT-WE1226.dts @@ -8,6 +8,10 @@ compatible = "zbtlink,zbt-we1226", "mediatek,mt7628an-soc"; model = "Zbtlink ZBT-WE1226"; + aliases { + led-status = &led_wlan; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -19,8 +23,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -48,7 +50,7 @@ gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; }; - wlan { + led_wlan: wlan { label = "zbt-we1226:green:wlan"; gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; }; @@ -68,34 +70,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE1326.dts b/target/linux/ramips/dts/ZBT-WE1326.dts index 6cbab6630..09e7ba33b 100644 --- a/target/linux/ramips/dts/ZBT-WE1326.dts +++ b/target/linux/ramips/dts/ZBT-WE1326.dts @@ -20,8 +20,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -45,34 +43,38 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; @@ -83,23 +85,21 @@ &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE2026.dts b/target/linux/ramips/dts/ZBT-WE2026.dts index 02f337889..6cb07ca8a 100644 --- a/target/linux/ramips/dts/ZBT-WE2026.dts +++ b/target/linux/ramips/dts/ZBT-WE2026.dts @@ -9,6 +9,10 @@ compatible = "zbtlink,zbt-we2026", "ralink,mt7620n-soc"; model = "Zbtlink ZBT-WE2026"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; @@ -16,7 +20,7 @@ gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "zbt-we2026:red:power"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -29,8 +33,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -53,33 +55,37 @@ status = "okay"; en25q64@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x760000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x760000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE3526.dts b/target/linux/ramips/dts/ZBT-WE3526.dts index dc7896f13..a5f8ce258 100644 --- a/target/linux/ramips/dts/ZBT-WE3526.dts +++ b/target/linux/ramips/dts/ZBT-WE3526.dts @@ -26,8 +26,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -46,60 +44,64 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - wifi@14c3,7662 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; - led { - led-sources = <2>; - }; + led { + led-sources = <2>; }; }; +}; - pcie1 { - wifi@14c3,7603 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE826-16M.dts b/target/linux/ramips/dts/ZBT-WE826-16M.dts index 50c1728f1..c39425be2 100644 --- a/target/linux/ramips/dts/ZBT-WE826-16M.dts +++ b/target/linux/ramips/dts/ZBT-WE826-16M.dts @@ -11,33 +11,37 @@ status = "okay"; en25q128@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE826-32M.dts b/target/linux/ramips/dts/ZBT-WE826-32M.dts index 0eb2b9700..827af3769 100644 --- a/target/linux/ramips/dts/ZBT-WE826-32M.dts +++ b/target/linux/ramips/dts/ZBT-WE826-32M.dts @@ -11,33 +11,37 @@ status = "okay"; en25q128@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZBT-WE826.dtsi b/target/linux/ramips/dts/ZBT-WE826.dtsi index dcfcb8500..1210568ca 100644 --- a/target/linux/ramips/dts/ZBT-WE826.dtsi +++ b/target/linux/ramips/dts/ZBT-WE826.dtsi @@ -6,13 +6,17 @@ / { compatible = "zbtlink,zbt-we826", "ralink,mt7620a-soc"; + aliases { + led-status = &led_power; + }; + chosen { bootargs = "console=ttyS0,115200"; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "zbt-we826:green:power"; gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; }; @@ -28,8 +32,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; diff --git a/target/linux/ramips/dts/ZBT-WG2626.dts b/target/linux/ramips/dts/ZBT-WG2626.dts index 79f2859bb..469977bb4 100644 --- a/target/linux/ramips/dts/ZBT-WG2626.dts +++ b/target/linux/ramips/dts/ZBT-WG2626.dts @@ -9,6 +9,10 @@ compatible = "zbtlink,zbt-wg2626", "mediatek,mt7621-soc"; model = "ZBT-WG2626"; + aliases { + led-status = &led_status; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; @@ -26,8 +30,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -40,7 +42,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "zbt-wg2626:green:status"; gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; }; @@ -55,57 +57,59 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - mt76@0,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; +}; - pcie1 { - mt76@1,0 { - reg = <0x0000 0 0 0 0>; - device_type = "pci"; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; +&pcie1 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/ZBT-WG3526.dtsi b/target/linux/ramips/dts/ZBT-WG3526.dtsi index 104a51f8d..17ddae848 100644 --- a/target/linux/ramips/dts/ZBT-WG3526.dtsi +++ b/target/linux/ramips/dts/ZBT-WG3526.dtsi @@ -6,6 +6,10 @@ / { compatible = "zbtlink,zbt-wg3526", "mediatek,mt7621-soc"; + aliases { + led-status = &led_status; + }; + memory@0 { device_type = "memory"; reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; @@ -23,8 +27,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -37,7 +39,7 @@ gpio-leds { compatible = "gpio-leds"; - status { + led_status: status { label = "zbt-wg3526:green:status"; gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; }; @@ -52,55 +54,59 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - firmware: partition@50000 { - label = "firmware"; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + label = "firmware"; + }; }; }; }; &pcie { status = "okay"; +}; - pcie0 { - wifi@14c3,7603 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; }; +}; - pcie1 { - wifi@14c3,7662 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; }; diff --git a/target/linux/ramips/dts/ZBT-WR8305RT.dts b/target/linux/ramips/dts/ZBT-WR8305RT.dts index 52cac80a7..528609097 100644 --- a/target/linux/ramips/dts/ZBT-WR8305RT.dts +++ b/target/linux/ramips/dts/ZBT-WR8305RT.dts @@ -9,10 +9,14 @@ compatible = "zbtlink,zbt-wr8305rt", "ralink,mt7620n-soc"; model = "Zbtlink ZBT-WR8305RT"; + aliases { + led-status = &led_sys; + }; + gpio-leds { compatible = "gpio-leds"; - sys { + led_sys: sys { label = "zbt-wr8305rt:green:sys"; gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; }; @@ -30,8 +34,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -54,33 +56,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZL5900V2.dts b/target/linux/ramips/dts/ZL5900V2.dts index 2d8daf134..9480e59b8 100644 --- a/target/linux/ramips/dts/ZL5900V2.dts +++ b/target/linux/ramips/dts/ZL5900V2.dts @@ -9,6 +9,10 @@ compatible = "zorlik,zl5900v2", "ralink,rt5350-soc"; model = "Zorlik ZL5900V2"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; }; - power { + led_power: power { label = "zl5900v2:blue:power"; gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -41,33 +43,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/ZTE-Q7.dts b/target/linux/ramips/dts/ZTE-Q7.dts index db426eea3..ffeee7ad2 100644 --- a/target/linux/ramips/dts/ZTE-Q7.dts +++ b/target/linux/ramips/dts/ZTE-Q7.dts @@ -9,6 +9,10 @@ compatible = "zte,q7", "ralink,mt7620a-soc"; model = "ZTE Q7"; + aliases { + led-status = &led_status_blue; + }; + gpio-leds { compatible = "gpio-leds"; @@ -17,7 +21,7 @@ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; }; - statblue { + led_status_blue: statblue { label = "zte-q7:blue:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -25,8 +29,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -49,33 +51,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; @@ -83,7 +89,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/elecom_wrc-gst.dtsi b/target/linux/ramips/dts/elecom_wrc-gst.dtsi new file mode 100644 index 000000000..6c52c1c00 --- /dev/null +++ b/target/linux/ramips/dts/elecom_wrc-gst.dtsi @@ -0,0 +1,176 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-status = &led_power_green; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "wrc-gst:green:power"; + gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + }; + + power_blue { + label = "wrc-gst:blue:power"; + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + }; + + wps { + label = "wrc-gst:red:wps"; + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + }; + + power_red { + label = "wrc-gst:red:power"; + gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + client { + label = "client"; + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + ap { + label = "ap"; + gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + extender { + label = "extender"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + router { + label = "router"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xb00000>; + }; + + partition@b50000 { + label = "tm_pattern"; + reg = <0xb50000 0x380000>; + read-only; + }; + + partition@ed0000 { + label = "tm_key"; + reg = <0xed0000 0x80000>; + read-only; + }; + + partition@f50000 { + label = "art_block"; + reg = <0xf50000 0x30000>; + read-only; + }; + + partition@f80000 { + label = "user_data"; + reg = <0xf80000 0x80000>; + read-only; + }; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart3", "jtag", "wdt", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; + /* WRC-xxxxGST has MT7615 for 2.4/5 GHz wifi, but it's not supported */ +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/ki_rb.dts b/target/linux/ramips/dts/ki_rb.dts new file mode 100644 index 000000000..ea4b06077 --- /dev/null +++ b/target/linux/ramips/dts/ki_rb.dts @@ -0,0 +1,211 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "zyxel,keenetic-extra-ii", "mediatek,mt7628an-soc"; + model = "ZyXEL Keenetic Extra II"; + + aliases { + led-status = &led_power; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600n8"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn { + label = "fn"; + gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: power { + label = "keenetic-extra-ii:green:power"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + internet { + label = "keenetic-extra-ii:green:internet"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "keenetic-extra-ii:green:wifi"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "keenetic-extra-ii:green:usb"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "rf-eeprom"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xe90000>; + }; + + partition@ee0000 { + label = "config_1"; + reg = <0xee0000 0x10000>; + read-only; + }; + + partition@ef0000 { + label = "storage"; + reg = <0xef0000 0x100000>; + read-only; + }; + + partition@ff0000 { + label = "dump"; + reg = <0xff0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xe90000>; + read-only; + }; + + partition@1ee0000 { + label = "config_2"; + reg = <0x1ee0000 0x10000>; + read-only; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + status = "okay"; + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0x8004>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "gpio", "i2s", "refclk", "spi cs1", "uart1", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/kn.dts b/target/linux/ramips/dts/kn.dts index 77b047c09..eccd52a99 100644 --- a/target/linux/ramips/dts/kn.dts +++ b/target/linux/ramips/dts/kn.dts @@ -9,42 +9,50 @@ compatible = "zyxel,keenetic", "ralink,rt3052-soc"; model = "ZyXEL Keenetic"; + aliases { + led-status = &led_power; + }; + cfi@1f000000 { compatible = "cfi-flash"; reg = <0x1f000000 0x800000>; bank-width = <2>; device-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x3b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; }; }; gpio-leds { compatible = "gpio-leds"; - power { + led_power: power { label = "kn:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; @@ -62,8 +70,6 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { diff --git a/target/linux/ramips/dts/kn_rc.dts b/target/linux/ramips/dts/kn_rc.dts index 533142b49..461e726fe 100644 --- a/target/linux/ramips/dts/kn_rc.dts +++ b/target/linux/ramips/dts/kn_rc.dts @@ -9,6 +9,10 @@ compatible = "zyxel,keenetic-omni", "ralink,mt7620n-soc"; model = "ZyXEL Keenetic Omni"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -27,7 +31,7 @@ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "kn_rc:green:power"; gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; }; @@ -35,8 +39,6 @@ gpio-keys-polled { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -82,33 +84,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/kn_rf.dts b/target/linux/ramips/dts/kn_rf.dts index bccd50035..184cbd238 100644 --- a/target/linux/ramips/dts/kn_rf.dts +++ b/target/linux/ramips/dts/kn_rf.dts @@ -9,6 +9,10 @@ compatible = "zyxel,keenetic-omni-ii", "ralink,mt7620n-soc"; model = "ZyXEL Keenetic Omni II"; + aliases { + led-status = &led_power; + }; + gpio-leds { compatible = "gpio-leds"; @@ -27,7 +31,7 @@ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; - power { + led_power: power { label = "kn_rc:green:power"; gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; @@ -35,8 +39,6 @@ gpio-keys-polled { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -82,33 +84,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0x7b0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/kng_rc.dts b/target/linux/ramips/dts/kng_rc.dts index 8d74595b9..2aea16c21 100644 --- a/target/linux/ramips/dts/kng_rc.dts +++ b/target/linux/ramips/dts/kng_rc.dts @@ -9,6 +9,10 @@ compatible = "zyxel,keenetic-viva", "ralink,mt7620a-soc"; model = "ZyXEL Keenetic Viva"; + aliases { + led-status = &led_power_green; + }; + gpio-leds { compatible = "gpio-leds"; @@ -32,7 +36,7 @@ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; }; - power { + led_power_green: power { label = "kng_rc:green:power"; gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; }; @@ -40,8 +44,6 @@ gpio-keys-polled { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <20>; reset { @@ -78,7 +80,7 @@ compatible = "realtek,rtl8367b"; cpu_port = <7>; realtek,extif2 = <1 0 1 1 1 1 1 1 2>; - mdio = <&mdio0>; + mii-bus = <&mdio0>; }; }; @@ -86,33 +88,37 @@ status = "okay"; m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; - partition@50000 { - label = "firmware"; - reg = <0x50000 0xfb0000>; + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi index 83ff10274..a242684fd 100644 --- a/target/linux/ramips/dts/mt7620a.dtsi +++ b/target/linux/ramips/dts/mt7620a.dtsi @@ -1,11 +1,15 @@ / { #address-cells = <1>; #size-cells = <1>; - compatible = "ralink,mtk7620a-soc"; + compatible = "ralink,mt7620a-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -13,7 +17,7 @@ bootargs = "console=ttyS0,57600"; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -112,7 +116,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -129,7 +133,7 @@ #gpio-cells = <2>; ralink,gpio-base = <24>; - ralink,num-gpios = <16>; + ralink,nr-gpio = <16>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -148,7 +152,7 @@ #gpio-cells = <2>; ralink,gpio-base = <40>; - ralink,num-gpios = <32>; + ralink,nr-gpio = <32>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -167,7 +171,7 @@ #gpio-cells = <2>; ralink,gpio-base = <72>; - ralink,num-gpios = <1>; + ralink,nr-gpio = <1>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -339,8 +343,8 @@ spi_cs1: spi1 { spi1 { - ralink,group = "spi_cs1"; - ralink,function = "spi_cs1"; + ralink,group = "spi refclk"; + ralink,function = "spi refclk"; }; }; @@ -413,6 +417,13 @@ ralink,function = "pa"; }; }; + + sdhci_pins: sdhci { + sdhci { + ralink,group = "nd_sd"; + ralink,function = "sd"; + }; + }; }; rstctrl: rstctrl { @@ -492,6 +503,9 @@ interrupt-parent = <&intc>; interrupts = <14>; + pinctrl-names = "default"; + pinctrl-0 = <&sdhci_pins>; + status = "disabled"; }; @@ -551,13 +565,15 @@ status = "disabled"; - pcie-bridge { + pcie0: pcie@0,0 { reg = <0x0000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; + + ranges; }; }; diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi index 78d12a268..1a72e98f0 100644 --- a/target/linux/ramips/dts/mt7620n.dtsi +++ b/target/linux/ramips/dts/mt7620n.dtsi @@ -1,11 +1,15 @@ / { #address-cells = <1>; #size-cells = <1>; - compatible = "ralink,mtk7620n-soc"; + compatible = "ralink,mt7620n-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -13,7 +17,7 @@ bootargs = "console=ttyS0,57600"; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -97,7 +101,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -114,7 +118,7 @@ #gpio-cells = <2>; ralink,gpio-base = <24>; - ralink,num-gpios = <16>; + ralink,nr-gpio = <16>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -133,7 +137,7 @@ #gpio-cells = <2>; ralink,gpio-base = <40>; - ralink,num-gpios = <32>; + ralink,nr-gpio = <32>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -152,7 +156,7 @@ #gpio-cells = <2>; ralink,gpio-base = <72>; - ralink,num-gpios = <1>; + ralink,nr-gpio = <1>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -260,8 +264,8 @@ spi_cs1: spi1 { spi1 { - ralink,group = "spi_cs1"; - ralink,function = "spi_cs1"; + ralink,group = "spi refclk"; + ralink,function = "spi refclk"; }; }; diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index daca857f6..f3f47cdc9 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -6,16 +6,23 @@ compatible = "mediatek,mt7621-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + device_type = "cpu"; compatible = "mips,mips1004Kc"; + reg = <0>; }; cpu@1 { + device_type = "cpu"; compatible = "mips,mips1004Kc"; + reg = <1>; }; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -26,7 +33,7 @@ serial0 = &uartlite; }; - cpuclock: cpuclock@0 { + cpuclock: cpuclock { #clock-cells = <0>; compatible = "fixed-clock"; @@ -34,7 +41,7 @@ clock-frequency = <880000000>; }; - sysclock: sysclock@0 { + sysclock: sysclock { #clock-cells = <0>; compatible = "fixed-clock"; @@ -148,14 +155,14 @@ }; cpc: cpc@1fbf0000 { - compatible = "mtk,mt7621-cpc"; - reg = <0x1fbf0000 0x8000>; + compatible = "mtk,mt7621-cpc"; + reg = <0x1fbf0000 0x8000>; }; mc: mc@1fbf8000 { - compatible = "mtk,mt7621-mc"; - reg = <0x1fbf8000 0x8000>; - }; + compatible = "mtk,mt7621-mc"; + reg = <0x1fbf8000 0x8000>; + }; uartlite: uartlite@c00 { compatible = "ns16550a"; @@ -334,6 +341,9 @@ interrupt-parent = <&gic>; interrupts = ; + + pinctrl-names = "default"; + pinctrl-0 = <&sdhci_pins>; }; xhci: xhci@1E1C0000 { @@ -374,18 +384,6 @@ bank-width = <2>; reg = <0x1e003000 0x800 0x1e003800 0x800>; - #address-cells = <1>; - #size-cells = <1>; - }; - - hnat: hnat@1e100000 { - compatible = "mediatek,mt7623-hnat"; - reg = <0x1e100000 0x10000>; - mtketh-ppd = "eth0"; - mtketh-lan = "eth0"; - mtketh-wan = "eth0"; - resets = <&rstctrl 0>; - reset-names = "mtketh"; }; ethernet: ethernet@1e100000 { @@ -393,7 +391,7 @@ reg = <0x1e100000 0x10000>; #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; resets = <&rstctrl 6 &rstctrl 23>; reset-names = "fe", "eth"; @@ -412,6 +410,16 @@ phy-mode = "rgmii"; }; }; + + hnat: hnat@0 { + compatible = "mediatek,mt7623-hnat"; + reg = <0 0x10000>; + mtketh-ppd = "eth0"; + mtketh-lan = "eth0"; + mtketh-wan = "eth0"; + resets = <&rstctrl 0>; + reset-names = "mtketh"; + }; }; gsw: gsw@1e110000 { @@ -452,31 +460,31 @@ clocks = <&clkctrl 24 &clkctrl 25 &clkctrl 26>; clock-names = "pcie0", "pcie1", "pcie2"; - pcie0 { + pcie0: pcie@0,0 { reg = <0x0000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; - device_type = "pci"; + ranges; }; - pcie1 { + pcie1: pcie@1,0 { reg = <0x0800 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; - device_type = "pci"; + ranges; }; - pcie2 { + pcie2: pcie@2,0 { reg = <0x1000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; - device_type = "pci"; + ranges; }; }; }; diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi index 0afd9e323..43e201699 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -1,11 +1,15 @@ / { #address-cells = <1>; #size-cells = <1>; - compatible = "ralink,mtk7628an-soc"; + compatible = "mediatek,mt7628an-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -17,7 +21,7 @@ serial0 = &uartlite; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -469,13 +473,15 @@ 0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */ >; - pcie-bridge { + pcie0: pcie@0,0 { reg = <0x0000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; + + ranges; }; }; diff --git a/target/linux/ramips/dts/rt2880.dtsi b/target/linux/ramips/dts/rt2880.dtsi index 2d6230c7a..0d7a97faf 100644 --- a/target/linux/ramips/dts/rt2880.dtsi +++ b/target/linux/ramips/dts/rt2880.dtsi @@ -4,8 +4,12 @@ compatible = "ralink,rt2880-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -17,7 +21,7 @@ serial0 = &uartlite; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -76,7 +80,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -90,7 +94,7 @@ #gpio-cells = <2>; ralink,gpio-base = <24>; - ralink,num-gpios = <16>; + ralink,nr-gpio = <16>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -106,7 +110,7 @@ #gpio-cells = <2>; ralink,gpio-base = <40>; - ralink,num-gpios = <32>; + ralink,nr-gpio = <32>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; diff --git a/target/linux/ramips/dts/rt3050.dtsi b/target/linux/ramips/dts/rt3050.dtsi index bd51838ba..75f1229c9 100644 --- a/target/linux/ramips/dts/rt3050.dtsi +++ b/target/linux/ramips/dts/rt3050.dtsi @@ -4,8 +4,12 @@ compatible = "ralink,rt3050-soc", "ralink,rt3052-soc", "ralink,rt3350-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -18,7 +22,7 @@ serial0 = &uartlite; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -105,7 +109,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -125,7 +129,7 @@ #gpio-cells = <2>; ralink,gpio-base = <24>; - ralink,num-gpios = <16>; + ralink,nr-gpio = <16>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -141,7 +145,7 @@ #gpio-cells = <2>; ralink,gpio-base = <40>; - ralink,num-gpios = <12>; + ralink,nr-gpio = <12>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; diff --git a/target/linux/ramips/dts/rt3352.dtsi b/target/linux/ramips/dts/rt3352.dtsi index e6e49eeaf..a609afd73 100644 --- a/target/linux/ramips/dts/rt3352.dtsi +++ b/target/linux/ramips/dts/rt3352.dtsi @@ -4,8 +4,12 @@ compatible = "ralink,rt3352-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -13,7 +17,7 @@ bootargs = "console=ttyS0,57600"; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -103,7 +107,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -122,7 +126,7 @@ #gpio-cells = <2>; ralink,gpio-base = <24>; - ralink,num-gpios = <16>; + ralink,nr-gpio = <16>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -138,7 +142,7 @@ #gpio-cells = <2>; ralink,gpio-base = <40>; - ralink,num-gpios = <6>; + ralink,nr-gpio = <6>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; diff --git a/target/linux/ramips/dts/rt3883.dtsi b/target/linux/ramips/dts/rt3883.dtsi index 193a3ee1c..2a62327d8 100644 --- a/target/linux/ramips/dts/rt3883.dtsi +++ b/target/linux/ramips/dts/rt3883.dtsi @@ -4,8 +4,12 @@ compatible = "ralink,rt3883-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips74Kc"; + reg = <0>; }; }; @@ -19,7 +23,7 @@ serial0 = &uartlite; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -112,7 +116,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -126,7 +130,7 @@ #gpio-cells = <2>; ralink,gpio-base = <24>; - ralink,num-gpios = <16>; + ralink,nr-gpio = <16>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -142,7 +146,7 @@ #gpio-cells = <2>; ralink,gpio-base = <40>; - ralink,num-gpios = <32>; + ralink,nr-gpio = <32>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -158,7 +162,7 @@ #gpio-cells = <2>; ralink,gpio-base = <72>; - ralink,num-gpios = <24>; + ralink,nr-gpio = <24>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; @@ -291,8 +295,8 @@ spi_cs1: spi1 { spi1 { - ralink,group = "spi_cs1"; - ralink,function = "spi_cs1"; + ralink,group = "pci"; + ralink,function = "pci-func"; }; }; @@ -302,6 +306,13 @@ ralink,function = "uartlite"; }; }; + + pci_pins: pci { + pci { + ralink,group = "pci"; + ralink,function = "pci-host1"; + }; + }; }; ethernet: ethernet@10100000 { @@ -346,6 +357,9 @@ #size-cells = <1>; ranges; /* direct mapping */ + pinctrl-names = "default"; + pinctrl-0 = <&pci_pins>; + status = "disabled"; pciintc: interrupt-controller { @@ -357,7 +371,7 @@ interrupts = <4>; }; - host-bridge { + pci@0 { #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; @@ -384,7 +398,7 @@ 0x9000 0 0 4 &pciintc 19 >; - pci-bridge@1 { + pci1: pci@1 { reg = <0x0800 0 0 0 0>; device_type = "pci"; #interrupt-cells = <1>; @@ -393,33 +407,28 @@ status = "disabled"; - ralink,pci-slot = <1>; - interrupt-map-mask = <0x0 0 0 0>; interrupt-map = <0x0 0 0 0 &pciintc 20>; + + bus-range = <1 255>; + ranges; }; - pci-slot@17 { + pci17: pci@11,0 { reg = <0x8800 0 0 0 0>; - device_type = "pci"; #interrupt-cells = <1>; #address-cells = <3>; #size-cells = <2>; - ralink,pci-slot = <17>; - status = "disabled"; }; - pci-slot@18 { + pci18: pci@12,0 { reg = <0x9000 0 0 0 0>; - device_type = "pci"; #interrupt-cells = <1>; #address-cells = <3>; #size-cells = <2>; - ralink,pci-slot = <18>; - status = "disabled"; }; }; diff --git a/target/linux/ramips/dts/rt5350.dtsi b/target/linux/ramips/dts/rt5350.dtsi index 843ea3019..f14162a58 100644 --- a/target/linux/ramips/dts/rt5350.dtsi +++ b/target/linux/ramips/dts/rt5350.dtsi @@ -4,8 +4,12 @@ compatible = "ralink,rt5350-soc"; cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { compatible = "mips,mips24KEc"; + reg = <0>; }; }; @@ -13,7 +17,7 @@ bootargs = "console=ttyS0,57600"; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -112,7 +116,7 @@ #gpio-cells = <2>; ralink,gpio-base = <0>; - ralink,num-gpios = <22>; + ralink,nr-gpio = <22>; ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; @@ -129,7 +133,7 @@ #gpio-cells = <2>; ralink,gpio-base = <22>; - ralink,num-gpios = <6>; + ralink,nr-gpio = <6>; ralink,register-map = [ 00 04 08 0c 10 14 18 1c 20 24 ]; diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/Kconfig b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/Kconfig index a58b0f3dc..d23ed777f 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/Kconfig +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/Kconfig @@ -10,7 +10,3 @@ config MTK_MMC_CD_POLL bool "Card Detect with Polling" depends on MTK_MMC -config MTK_MMC_EMMC_8BIT - bool "eMMC 8-bit support" - depends on MTK_MMC && RALINK_MT7628 - diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h index 33bfc7b95..a7d82f321 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h @@ -36,27 +36,10 @@ #ifndef __ARCH_ARM_MACH_BOARD_H #define __ARCH_ARM_MACH_BOARD_H -#include -#include -/* --- chhung */ -// #include -// #include -/* end of chhung */ - -typedef void (*sdio_irq_handler_t)(void*); /* external irq handler */ -typedef void (*pm_callback_t)(pm_message_t state, void *data); - #define MSDC_CD_PIN_EN (1 << 0) /* card detection pin is wired */ #define MSDC_WP_PIN_EN (1 << 1) /* write protection pin is wired */ #define MSDC_RST_PIN_EN (1 << 2) /* emmc reset pin is wired */ -#define MSDC_SDIO_IRQ (1 << 3) /* use internal sdio irq (bus) */ -#define MSDC_EXT_SDIO_IRQ (1 << 4) /* use external sdio irq */ #define MSDC_REMOVABLE (1 << 5) /* removable slot */ -#define MSDC_SYS_SUSPEND (1 << 6) /* suspended by system */ -#define MSDC_HIGHSPEED (1 << 7) /* high-speed mode support */ -#define MSDC_UHS1 (1 << 8) /* uhs-1 mode support */ -#define MSDC_DDR (1 << 9) /* ddr mode support */ - #define MSDC_SMPL_RISING (0) #define MSDC_SMPL_FALLING (1) @@ -67,71 +50,14 @@ typedef void (*pm_callback_t)(pm_message_t state, void *data); #define MSDC_WP_PIN (3) #define MSDC_RST_PIN (4) -enum { - MSDC_CLKSRC_48MHZ = 0, -// MSDC_CLKSRC_26MHZ = 0, -// MSDC_CLKSRC_197MHZ = 1, -// MSDC_CLKSRC_208MHZ = 2 -}; - struct msdc_hw { - unsigned char clk_src; /* host clock source */ - unsigned char cmd_edge; /* command latch edge */ - unsigned char data_edge; /* data latch edge */ - unsigned char clk_drv; /* clock pad driving */ - unsigned char cmd_drv; /* command pad driving */ - unsigned char dat_drv; /* data pad driving */ - unsigned long flags; /* hardware capability flags */ - unsigned long data_pins; /* data pins */ - unsigned long data_offset; /* data address offset */ + unsigned char clk_src; /* host clock source */ + unsigned long flags; /* hardware capability flags */ - /* config gpio pull mode */ - void (*config_gpio_pin)(int type, int pull); - - /* external power control for card */ - void (*ext_power_on)(void); - void (*ext_power_off)(void); - - /* external sdio irq operations */ - void (*request_sdio_eirq)(sdio_irq_handler_t sdio_irq_handler, void *data); - void (*enable_sdio_eirq)(void); - void (*disable_sdio_eirq)(void); - - /* external cd irq operations */ - void (*request_cd_eirq)(sdio_irq_handler_t cd_irq_handler, void *data); - void (*enable_cd_eirq)(void); - void (*disable_cd_eirq)(void); - int (*get_cd_status)(void); - - /* power management callback for external module */ - void (*register_pm)(pm_callback_t pm_cb, void *data); + /* config gpio pull mode */ + void (*config_gpio_pin)(int type, int pull); }; extern struct msdc_hw msdc0_hw; -extern struct msdc_hw msdc1_hw; -extern struct msdc_hw msdc2_hw; -extern struct msdc_hw msdc3_hw; - -/*GPS driver*/ -#define GPS_FLAG_FORCE_OFF 0x0001 -struct mt3326_gps_hardware { - int (*ext_power_on)(int); - int (*ext_power_off)(int); -}; -extern struct mt3326_gps_hardware mt3326_gps_hw; - -/* NAND driver */ -struct mt6575_nand_host_hw { - unsigned int nfi_bus_width; /* NFI_BUS_WIDTH */ - unsigned int nfi_access_timing; /* NFI_ACCESS_TIMING */ - unsigned int nfi_cs_num; /* NFI_CS_NUM */ - unsigned int nand_sec_size; /* NAND_SECTOR_SIZE */ - unsigned int nand_sec_shift; /* NAND_SECTOR_SHIFT */ - unsigned int nand_ecc_size; - unsigned int nand_ecc_bytes; - unsigned int nand_ecc_mode; -}; -extern struct mt6575_nand_host_hw mt6575_nand_hw; #endif /* __ARCH_ARM_MACH_BOARD_H */ - diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c index ae4ef0fa5..d897b1216 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c @@ -32,7 +32,7 @@ * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ - + #include #include #include @@ -48,276 +48,239 @@ #include "mt6575_sd.h" #include -/* mode select */ -u32 dma_size[4]={ - 512, - 512, - 512, - 512 -}; -msdc_mode drv_mode[4]={ - MODE_SIZE_DEP, /* using DMA or not depend on the size */ - MODE_SIZE_DEP, - MODE_SIZE_DEP, - MODE_SIZE_DEP -}; - -#if defined (MT6575_SD_DEBUG) static char cmd_buf[256]; /* for debug zone */ -static unsigned int sd_debug_zone[4]={ +unsigned int sd_debug_zone[4] = { 0, 0, 0, 0 }; - +#if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) -u32 gpt_enable = 0; -u32 sdio_pro_enable = 0; /* make sure gpt is enabled */ -u32 sdio_pro_time = 0; /* no more than 30s */ -struct sdio_profile sdio_perfomance = {0}; +u32 gpt_enable; +u32 sdio_pro_enable; /* make sure gpt is enabled */ +u32 sdio_pro_time; /* no more than 30s */ +struct sdio_profile sdio_perfomance = {0}; #if 0 /* --- chhung */ void msdc_init_gpt(void) { - GPT_CONFIG config; - - config.num = GPT6; - config.mode = GPT_FREE_RUN; - config.clkSrc = GPT_CLK_SRC_SYS; - config.clkDiv = GPT_CLK_DIV_1; /* 13MHz GPT6 */ - - if (GPT_Config(config) == FALSE ) - return; - - GPT_Start(GPT6); + GPT_CONFIG config; + + config.num = GPT6; + config.mode = GPT_FREE_RUN; + config.clkSrc = GPT_CLK_SRC_SYS; + config.clkDiv = GPT_CLK_DIV_1; /* 13MHz GPT6 */ + + if (GPT_Config(config) == FALSE) + return; + + GPT_Start(GPT6); } #endif /* end of --- */ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32) { - u32 ret = 0; - - if (new_H32 == old_H32) { - ret = new_L32 - old_L32; - } else if(new_H32 == (old_H32 + 1)) { - if (new_L32 > old_L32) { - printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); - } - ret = (0xffffffff - old_L32); - ret += new_L32; - } else { - printk("msdc old_H<0x%x> new_H<0x%x>\n", old_H32, new_H32); - } + u32 ret = 0; - return ret; + if (new_H32 == old_H32) { + ret = new_L32 - old_L32; + } else if (new_H32 == (old_H32 + 1)) { + if (new_L32 > old_L32) + printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); + ret = (0xffffffff - old_L32); + ret += new_L32; + } else { + printk("msdc old_H<0x%x> new_H<0x%x>\n", old_H32, new_H32); + } + + return ret; } -void msdc_sdio_profile(struct sdio_profile* result) +void msdc_sdio_profile(struct sdio_profile *result) { - struct cmd_profile* cmd; - u32 i; - - printk("sdio === performance dump ===\n"); - printk("sdio === total execute tick<%d> time<%dms> Tx<%dB> Rx<%dB>\n", - result->total_tc, result->total_tc / TICKS_ONE_MS, - result->total_tx_bytes, result->total_rx_bytes); + struct cmd_profile *cmd; + u32 i; - /* CMD52 Dump */ - cmd = &result->cmd52_rx; - printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); - cmd = &result->cmd52_tx; - printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); - - /* CMD53 Rx bytes + block mode */ - for (i=0; i<512; i++) { - cmd = &result->cmd53_rx_byte[i]; - if (cmd->count) { - printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - for (i=0; i<100; i++) { - cmd = &result->cmd53_rx_blk[i]; - if (cmd->count) { - printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } + printk("sdio === performance dump ===\n"); + printk("sdio === total execute tick<%d> time<%dms> Tx<%dB> Rx<%dB>\n", + result->total_tc, result->total_tc / TICKS_ONE_MS, + result->total_tx_bytes, result->total_rx_bytes); - /* CMD53 Tx bytes + block mode */ - for (i=0; i<512; i++) { - cmd = &result->cmd53_tx_byte[i]; - if (cmd->count) { - printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - for (i=0; i<100; i++) { - cmd = &result->cmd53_tx_blk[i]; - if (cmd->count) { - printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - - printk("sdio === performance dump done ===\n"); + /* CMD52 Dump */ + cmd = &result->cmd52_rx; + printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count); + cmd = &result->cmd52_tx; + printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count); + + /* CMD53 Rx bytes + block mode */ + for (i = 0; i < 512; i++) { + cmd = &result->cmd53_rx_byte[i]; + if (cmd->count) { + printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); + } + } + for (i = 0; i < 100; i++) { + cmd = &result->cmd53_rx_blk[i]; + if (cmd->count) { + printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); + } + } + + /* CMD53 Tx bytes + block mode */ + for (i = 0; i < 512; i++) { + cmd = &result->cmd53_tx_byte[i]; + if (cmd->count) { + printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); + } + } + for (i = 0; i < 100; i++) { + cmd = &result->cmd53_tx_blk[i]; + if (cmd->count) { + printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); + } + } + + printk("sdio === performance dump done ===\n"); } //========= sdio command table =========== void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) { - struct sdio_profile* result = &sdio_perfomance; - struct cmd_profile* cmd; - u32 block; + struct sdio_profile *result = &sdio_perfomance; + struct cmd_profile *cmd; + u32 block; - if (sdio_pro_enable == 0) { - return; - } + if (sdio_pro_enable == 0) + return; - if (opcode == 52) { - cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; - } else if (opcode == 53) { - if (sizes < 512) { - cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; - } else { - block = sizes / 512; - if (block >= 99) { - printk("cmd53 error blocks\n"); - while(1); - } - cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; - } - } else { - return; - } - - /* update the members */ - if (ticks > cmd->max_tc){ - cmd->max_tc = ticks; - } - if (cmd->min_tc == 0 || ticks < cmd->min_tc) { - cmd->min_tc = ticks; - } - cmd->tot_tc += ticks; - cmd->tot_bytes += sizes; - cmd->count ++; - - if (bRx) { - result->total_rx_bytes += sizes; - } else { - result->total_tx_bytes += sizes; - } - result->total_tc += ticks; - - /* dump when total_tc > 30s */ - if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { - msdc_sdio_profile(result); - memset(result, 0 , sizeof(struct sdio_profile)); - } + if (opcode == 52) { + cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; + } else if (opcode == 53) { + if (sizes < 512) { + cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; + } else { + block = sizes / 512; + if (block >= 99) { + printk("cmd53 error blocks\n"); + while (1) + ; + } + cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; + } + } else { + return; + } + + /* update the members */ + if (ticks > cmd->max_tc) + cmd->max_tc = ticks; + if (cmd->min_tc == 0 || ticks < cmd->min_tc) + cmd->min_tc = ticks; + cmd->tot_tc += ticks; + cmd->tot_bytes += sizes; + cmd->count++; + + if (bRx) + result->total_rx_bytes += sizes; + else + result->total_tx_bytes += sizes; + result->total_tc += ticks; + + /* dump when total_tc > 30s */ + if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { + msdc_sdio_profile(result); + memset(result, 0, sizeof(struct sdio_profile)); + } } //========== driver proc interface =========== static int msdc_debug_proc_read(struct seq_file *s, void *p) { - seq_printf(s, "\n=========================================\n"); - seq_printf(s, "Index<0> + Id + Zone\n"); - seq_printf(s, "-> PWR<9> WRN<8> | FIO<7> OPS<6> FUN<5> CFG<4> | INT<3> RSP<2> CMD<1> DMA<0>\n"); - seq_printf(s, "-> echo 0 3 0x3ff >msdc_bebug -> host[3] debug zone set to 0x3ff\n"); + seq_puts(s, "\n=========================================\n"); + seq_puts(s, "Index<0> + Id + Zone\n"); + seq_puts(s, "-> PWR<9> WRN<8> | FIO<7> OPS<6> FUN<5> CFG<4> | INT<3> RSP<2> CMD<1> DMA<0>\n"); + seq_puts(s, "-> echo 0 3 0x3ff >msdc_bebug -> host[3] debug zone set to 0x3ff\n"); seq_printf(s, "-> MSDC[0] Zone: 0x%.8x\n", sd_debug_zone[0]); seq_printf(s, "-> MSDC[1] Zone: 0x%.8x\n", sd_debug_zone[1]); seq_printf(s, "-> MSDC[2] Zone: 0x%.8x\n", sd_debug_zone[2]); seq_printf(s, "-> MSDC[3] Zone: 0x%.8x\n", sd_debug_zone[3]); - seq_printf(s, "Index<1> + ID:4|Mode:4 + DMA_SIZE\n"); - seq_printf(s, "-> 0)PIO 1)DMA 2)SIZE\n"); - seq_printf(s, "-> echo 1 22 0x200 >msdc_bebug -> host[2] size mode, dma when >= 512\n"); - seq_printf(s, "-> MSDC[0] mode<%d> size<%d>\n", drv_mode[0], dma_size[0]); - seq_printf(s, "-> MSDC[1] mode<%d> size<%d>\n", drv_mode[1], dma_size[1]); - seq_printf(s, "-> MSDC[2] mode<%d> size<%d>\n", drv_mode[2], dma_size[2]); - seq_printf(s, "-> MSDC[3] mode<%d> size<%d>\n", drv_mode[3], dma_size[3]); - - seq_printf(s, "Index<3> + SDIO_PROFILE + TIME\n"); - seq_printf(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); + seq_puts(s, "Index<3> + SDIO_PROFILE + TIME\n"); + seq_puts(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); seq_printf(s, "-> SDIO_PROFILE<%d> TIME<%ds>\n", sdio_pro_enable, sdio_pro_time); - seq_printf(s, "=========================================\n\n"); + seq_puts(s, "=========================================\n\n"); return 0; } -static ssize_t msdc_debug_proc_write(struct file *file, - const char __user *buf, size_t count, loff_t *data) +static ssize_t msdc_debug_proc_write(struct file *file, + const char __user *buf, size_t count, loff_t *data) { int ret; - - int cmd, p1, p2; - int id, zone; - int mode, size; - - if (count == 0)return -1; - if(count > 255)count = 255; - ret = copy_from_user(cmd_buf, buf, count); - if (ret < 0)return -1; - + int cmd, p1, p2; + int id, zone; + int mode, size; + + if (count == 0) + return -1; + if (count > 255) + count = 255; + + if (copy_from_user(cmd_buf, buf, count)) + return -EFAULT; + cmd_buf[count] = '\0'; printk("msdc Write %s\n", cmd_buf); sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2); - - if(cmd == SD_TOOL_ZONE) { - id = p1; zone = p2; zone &= 0x3ff; + + if (cmd == SD_TOOL_ZONE) { + id = p1; + zone = p2; + zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); - if(id >=0 && id<=3){ + if (id >= 0 && id <= 3) { sd_debug_zone[id] = zone; - } - else if(id == 4){ + } else if (id == 4) { sd_debug_zone[0] = sd_debug_zone[1] = zone; sd_debug_zone[2] = sd_debug_zone[3] = zone; - } - else{ + } else { printk("msdc host_id error when set debug zone\n"); } - } else if (cmd == SD_TOOL_DMA_SIZE) { - id = p1>>4; mode = (p1&0xf); size = p2; - if(id >=0 && id<=3){ - drv_mode[id] = mode; - dma_size[id] = p2; - } - else if(id == 4){ - drv_mode[0] = drv_mode[1] = mode; - drv_mode[2] = drv_mode[3] = mode; - dma_size[0] = dma_size[1] = p2; - dma_size[2] = dma_size[3] = p2; - } - else{ - printk("msdc host_id error when select mode\n"); - } } else if (cmd == SD_TOOL_SDIO_PROFILE) { if (p1 == 1) { /* enable profile */ if (gpt_enable == 0) { // msdc_init_gpt(); /* --- by chhung */ gpt_enable = 1; - } + } sdio_pro_enable = 1; - if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; - sdio_pro_time = p2 ; - } else if (p1 == 0) { + if (p2 == 0) + p2 = 1; + if (p2 >= 30) + p2 = 30; + sdio_pro_time = p2; + } else if (p1 == 0) { /* todo */ sdio_pro_enable = 0; - } + } } - + return count; } @@ -327,22 +290,17 @@ static int msdc_debug_show(struct inode *inode, struct file *file) } static const struct file_operations msdc_debug_fops = { - .owner = THIS_MODULE, - .open = msdc_debug_show, - .read = seq_read, - .write = msdc_debug_proc_write, - .llseek = seq_lseek, - .release = single_release, + .owner = THIS_MODULE, + .open = msdc_debug_show, + .read = seq_read, + .write = msdc_debug_proc_write, + .llseek = seq_lseek, + .release = single_release, }; -int msdc_debug_proc_init(void) -{ - struct proc_dir_entry *de = proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); - - if (!de || IS_ERR(de)) - printk("!! Create MSDC debug PROC fail !!\n"); - - return 0 ; +void msdc_debug_proc_init(void) +{ + proc_create("msdc_debug", 0660, NULL, &msdc_debug_fops); } EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h index e58c43129..5a25a69b0 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h @@ -39,47 +39,45 @@ extern u32 sdio_pro_enable; /* for a type command, e.g. CMD53, 2 blocks */ struct cmd_profile { - u32 max_tc; /* Max tick count */ - u32 min_tc; - u32 tot_tc; /* total tick count */ - u32 tot_bytes; - u32 count; /* the counts of the command */ + u32 max_tc; /* Max tick count */ + u32 min_tc; + u32 tot_tc; /* total tick count */ + u32 tot_bytes; + u32 count; /* the counts of the command */ }; /* dump when total_tc and total_bytes */ struct sdio_profile { - u32 total_tc; /* total tick count of CMD52 and CMD53 */ - u32 total_tx_bytes; /* total bytes of CMD53 Tx */ - u32 total_rx_bytes; /* total bytes of CMD53 Rx */ - - /*CMD52*/ - struct cmd_profile cmd52_tx; - struct cmd_profile cmd52_rx; + u32 total_tc; /* total tick count of CMD52 and CMD53 */ + u32 total_tx_bytes; /* total bytes of CMD53 Tx */ + u32 total_rx_bytes; /* total bytes of CMD53 Rx */ - /*CMD53 in byte unit */ - struct cmd_profile cmd53_tx_byte[512]; - struct cmd_profile cmd53_rx_byte[512]; - - /*CMD53 in block unit */ - struct cmd_profile cmd53_tx_blk[100]; - struct cmd_profile cmd53_rx_blk[100]; + /*CMD52*/ + struct cmd_profile cmd52_tx; + struct cmd_profile cmd52_rx; + + /*CMD53 in byte unit */ + struct cmd_profile cmd53_tx_byte[512]; + struct cmd_profile cmd53_rx_byte[512]; + + /*CMD53 in block unit */ + struct cmd_profile cmd53_tx_blk[100]; + struct cmd_profile cmd53_rx_blk[100]; }; //========================== -typedef enum { - SD_TOOL_ZONE = 0, - SD_TOOL_DMA_SIZE = 1, - SD_TOOL_PM_ENABLE = 2, - SD_TOOL_SDIO_PROFILE = 3, -} msdc_dbg; +enum msdc_dbg { + SD_TOOL_ZONE = 0, + SD_TOOL_DMA_SIZE = 1, + SD_TOOL_PM_ENABLE = 2, + SD_TOOL_SDIO_PROFILE = 3, +}; -typedef enum { - MODE_PIO = 0, - MODE_DMA = 1, - MODE_SIZE_DEP = 2, -} msdc_mode; -extern msdc_mode drv_mode[4]; -extern u32 dma_size[4]; +enum msdc_mode { + MODE_PIO = 0, + MODE_DMA = 1, + MODE_SIZE_DEP = 2, +}; /* Debug message event */ #define DBG_EVT_NONE (0) /* No event */ @@ -104,9 +102,10 @@ extern unsigned int sd_debug_zone[4]; do { \ if (x) { \ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ - while(1); \ + while (1) \ + ; \ } \ -}while(0) +} while (0) #endif /* end of +++ */ #define N_MSG(evt, fmt, args...) @@ -121,36 +120,36 @@ do { \ #define ERR_MSG(fmt, args...) \ do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while(0); + printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ + host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ +} while (0); #if 1 -//defined CONFIG_MTK_MMC_CD_POLL +//defined CONFIG_MTK_MMC_CD_POLL #define INIT_MSG(fmt, args...) -#define IRQ_MSG(fmt, args...) +#define IRQ_MSG(fmt, args...) #else #define INIT_MSG(fmt, args...) \ do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while(0); + printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ + host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ +} while (0); /* PID in ISR in not corrent */ #define IRQ_MSG(fmt, args...) \ do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ - host->id, ##args , __FUNCTION__, __LINE__); \ -} while(0); + printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ + host->id, ##args, __FUNCTION__, __LINE__); \ +} while (0); #endif -int msdc_debug_proc_init(void); +void msdc_debug_proc_init(void); #if 0 /* --- chhung */ void msdc_init_gpt(void); extern void GPT_GetCounter64(UINT32 *cntL32, UINT32 *cntH32); #endif /* end of --- */ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32); -void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks); +void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks); #endif diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h index bb1f60ee5..33fa59a01 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h @@ -37,7 +37,6 @@ #define MT6575_SD_H #include -#include #include // #include /* --- by chhung */ @@ -45,7 +44,7 @@ /*--------------------------------------------------------------------------*/ /* Common Macro */ /*--------------------------------------------------------------------------*/ -#define REG_ADDR(x) ((volatile u32*)(base + OFFSET_##x)) +#define REG_ADDR(x) (base + OFFSET_##x) /*--------------------------------------------------------------------------*/ /* Common Definition */ @@ -89,15 +88,15 @@ #define MSDC_EMMC_BOOTMODE1 (1) /* Reset CMD mode */ enum { - RESP_NONE = 0, - RESP_R1, - RESP_R2, - RESP_R3, - RESP_R4, - RESP_R5, - RESP_R6, - RESP_R7, - RESP_R1B + RESP_NONE = 0, + RESP_R1, + RESP_R2, + RESP_R3, + RESP_R4, + RESP_R5, + RESP_R6, + RESP_R7, + RESP_R1B }; /*--------------------------------------------------------------------------*/ @@ -254,7 +253,7 @@ enum { #define MSDC_PS_CDDEBOUNCE (0xf << 12) /* RW */ #define MSDC_PS_DAT (0xff << 16) /* R */ #define MSDC_PS_CMD (0x1 << 24) /* R */ -#define MSDC_PS_WP (0x1UL<< 31) /* R */ +#define MSDC_PS_WP (0x1UL << 31) /* R */ /* MSDC_INT mask */ #define MSDC_INT_MMCIRQ (0x1 << 0) /* W1C */ @@ -295,14 +294,14 @@ enum { /* MSDC_FIFOCS mask */ #define MSDC_FIFOCS_RXCNT (0xff << 0) /* R */ #define MSDC_FIFOCS_TXCNT (0xff << 16) /* R */ -#define MSDC_FIFOCS_CLR (0x1UL<< 31) /* RW */ +#define MSDC_FIFOCS_CLR (0x1UL << 31) /* RW */ /* SDC_CFG mask */ #define SDC_CFG_SDIOINTWKUP (0x1 << 0) /* RW */ #define SDC_CFG_INSWKUP (0x1 << 1) /* RW */ #define SDC_CFG_BUSWIDTH (0x3 << 16) /* RW */ #define SDC_CFG_SDIO (0x1 << 19) /* RW */ -#define SDC_CFG_SDIOIDE (0x1 << 20) /* RW */ +#define SDC_CFG_SDIOIDE (0x1 << 20) /* RW */ #define SDC_CFG_INTATGAP (0x1 << 21) /* RW */ #define SDC_CFG_DTOC (0xffUL << 24) /* RW */ @@ -315,7 +314,7 @@ enum { #define SDC_CMD_RW (0x1 << 13) /* RW */ #define SDC_CMD_STOP (0x1 << 14) /* RW */ #define SDC_CMD_GOIRQ (0x1 << 15) /* RW */ -#define SDC_CMD_BLKLEN (0xfff<< 16) /* RW */ +#define SDC_CMD_BLKLEN (0xfff << 16) /* RW */ #define SDC_CMD_AUTOCMD (0x3 << 28) /* RW */ #define SDC_CMD_VOLSWTH (0x1 << 30) /* RW */ @@ -397,7 +396,7 @@ enum { #define MSDC_PAD_CTL0_CLKSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL0_CLKIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL0_CLKTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL0_CLKRDSEL (0xffUL<< 24) /* RW */ +#define MSDC_PAD_CTL0_CLKRDSEL (0xffUL << 24) /* RW */ /* MSDC_PAD_CTL1 mask */ #define MSDC_PAD_CTL1_CMDDRVN (0x7 << 0) /* RW */ @@ -408,7 +407,7 @@ enum { #define MSDC_PAD_CTL1_CMDSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL1_CMDIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL1_CMDTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL1_CMDRDSEL (0xffUL<< 24) /* RW */ +#define MSDC_PAD_CTL1_CMDRDSEL (0xffUL << 24) /* RW */ /* MSDC_PAD_CTL2 mask */ #define MSDC_PAD_CTL2_DATDRVN (0x7 << 0) /* RW */ @@ -419,7 +418,7 @@ enum { #define MSDC_PAD_CTL2_DATIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL2_DATSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL2_DATTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL2_DATRDSEL (0xffUL<< 24) /* RW */ +#define MSDC_PAD_CTL2_DATRDSEL (0xffUL << 24) /* RW */ /* MSDC_PAD_TUNE mask */ #define MSDC_PAD_TUNE_DATWRDLY (0x1F << 0) /* RW */ @@ -439,564 +438,549 @@ enum { #define MSDC_DAT_RDDLY1_D6 (0x1F << 16) /* RW */ #define MSDC_DAT_RDDLY1_D7 (0x1F << 24) /* RW */ -#define MSDC_CKGEN_MSDC_DLY_SEL (0x1F<<10) -#define MSDC_INT_DAT_LATCH_CK_SEL (0x7<<7) -#define MSDC_CKGEN_MSDC_CK_SEL (0x1<<6) -#define CARD_READY_FOR_DATA (1<<8) -#define CARD_CURRENT_STATE(x) ((x&0x00001E00)>>9) +#define MSDC_CKGEN_MSDC_DLY_SEL (0x1F << 10) +#define MSDC_INT_DAT_LATCH_CK_SEL (0x7 << 7) +#define MSDC_CKGEN_MSDC_CK_SEL (0x1 << 6) +#define CARD_READY_FOR_DATA (1 << 8) +#define CARD_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /*--------------------------------------------------------------------------*/ /* Descriptor Structure */ /*--------------------------------------------------------------------------*/ -typedef struct { - u32 hwo:1; /* could be changed by hw */ - u32 bdp:1; - u32 rsv0:6; - u32 chksum:8; - u32 intr:1; - u32 rsv1:15; - void *next; - void *ptr; - u32 buflen:16; - u32 extlen:8; - u32 rsv2:8; - u32 arg; - u32 blknum; - u32 cmd; -} gpd_t; +struct gpd { + u32 hwo:1; /* could be changed by hw */ + u32 bdp:1; + u32 rsv0:6; + u32 chksum:8; + u32 intr:1; + u32 rsv1:15; + void *next; + void *ptr; + u32 buflen:16; + u32 extlen:8; + u32 rsv2:8; + u32 arg; + u32 blknum; + u32 cmd; +}; -typedef struct { - u32 eol:1; - u32 rsv0:7; - u32 chksum:8; - u32 rsv1:1; - u32 blkpad:1; - u32 dwpad:1; - u32 rsv2:13; - void *next; - void *ptr; - u32 buflen:16; - u32 rsv3:16; -} bd_t; +struct bd { + u32 eol:1; + u32 rsv0:7; + u32 chksum:8; + u32 rsv1:1; + u32 blkpad:1; + u32 dwpad:1; + u32 rsv2:13; + void *next; + void *ptr; + u32 buflen:16; + u32 rsv3:16; +}; /*--------------------------------------------------------------------------*/ /* Register Debugging Structure */ /*--------------------------------------------------------------------------*/ -typedef struct { - u32 msdc:1; - u32 ckpwn:1; - u32 rst:1; - u32 pio:1; - u32 ckdrven:1; - u32 start18v:1; - u32 pass18v:1; - u32 ckstb:1; - u32 ckdiv:8; - u32 ckmod:2; - u32 pad:14; -} msdc_cfg_reg; -typedef struct { - u32 sdr104cksel:1; - u32 rsmpl:1; - u32 dsmpl:1; - u32 ddlysel:1; - u32 ddr50ckd:1; - u32 dsplsel:1; - u32 pad1:10; - u32 d0spl:1; - u32 d1spl:1; - u32 d2spl:1; - u32 d3spl:1; - u32 d4spl:1; - u32 d5spl:1; - u32 d6spl:1; - u32 d7spl:1; - u32 riscsz:1; - u32 pad2:7; -} msdc_iocon_reg; -typedef struct { - u32 cden:1; - u32 cdsts:1; - u32 pad1:10; - u32 cddebounce:4; - u32 dat:8; - u32 cmd:1; - u32 pad2:6; - u32 wp:1; -} msdc_ps_reg; -typedef struct { - u32 mmcirq:1; - u32 cdsc:1; - u32 pad1:1; - u32 atocmdrdy:1; - u32 atocmdtmo:1; - u32 atocmdcrc:1; - u32 dmaqempty:1; - u32 sdioirq:1; - u32 cmdrdy:1; - u32 cmdtmo:1; - u32 rspcrc:1; - u32 csta:1; - u32 xfercomp:1; - u32 dxferdone:1; - u32 dattmo:1; - u32 datcrc:1; - u32 atocmd19done:1; - u32 pad2:15; -} msdc_int_reg; -typedef struct { - u32 mmcirq:1; - u32 cdsc:1; - u32 pad1:1; - u32 atocmdrdy:1; - u32 atocmdtmo:1; - u32 atocmdcrc:1; - u32 dmaqempty:1; - u32 sdioirq:1; - u32 cmdrdy:1; - u32 cmdtmo:1; - u32 rspcrc:1; - u32 csta:1; - u32 xfercomp:1; - u32 dxferdone:1; - u32 dattmo:1; - u32 datcrc:1; - u32 atocmd19done:1; - u32 pad2:15; -} msdc_inten_reg; -typedef struct { - u32 rxcnt:8; - u32 pad1:8; - u32 txcnt:8; - u32 pad2:7; - u32 clr:1; -} msdc_fifocs_reg; -typedef struct { - u32 val; -} msdc_txdat_reg; -typedef struct { - u32 val; -} msdc_rxdat_reg; -typedef struct { - u32 sdiowkup:1; - u32 inswkup:1; - u32 pad1:14; - u32 buswidth:2; - u32 pad2:1; - u32 sdio:1; - u32 sdioide:1; - u32 intblkgap:1; - u32 pad4:2; - u32 dtoc:8; -} sdc_cfg_reg; -typedef struct { - u32 cmd:6; - u32 brk:1; - u32 rsptyp:3; - u32 pad1:1; - u32 dtype:2; - u32 rw:1; - u32 stop:1; - u32 goirq:1; - u32 blklen:12; - u32 atocmd:2; - u32 volswth:1; - u32 pad2:1; -} sdc_cmd_reg; -typedef struct { - u32 arg; -} sdc_arg_reg; -typedef struct { - u32 sdcbusy:1; - u32 cmdbusy:1; - u32 pad:29; - u32 swrcmpl:1; -} sdc_sts_reg; -typedef struct { - u32 val; -} sdc_resp0_reg; -typedef struct { - u32 val; -} sdc_resp1_reg; -typedef struct { - u32 val; -} sdc_resp2_reg; -typedef struct { - u32 val; -} sdc_resp3_reg; -typedef struct { - u32 num; -} sdc_blknum_reg; -typedef struct { - u32 sts; -} sdc_csts_reg; -typedef struct { - u32 sts; -} sdc_cstsen_reg; -typedef struct { - u32 datcrcsts:8; - u32 ddrcrcsts:4; - u32 pad:20; -} sdc_datcrcsts_reg; -typedef struct { - u32 bootstart:1; - u32 bootstop:1; - u32 bootmode:1; - u32 pad1:9; - u32 bootwaidly:3; - u32 bootsupp:1; - u32 pad2:16; -} emmc_cfg0_reg; -typedef struct { - u32 bootcrctmc:16; - u32 pad:4; - u32 bootacktmc:12; -} emmc_cfg1_reg; -typedef struct { - u32 bootcrcerr:1; - u32 bootackerr:1; - u32 bootdattmo:1; - u32 bootacktmo:1; - u32 bootupstate:1; - u32 bootackrcv:1; - u32 bootdatrcv:1; - u32 pad:25; -} emmc_sts_reg; -typedef struct { - u32 bootrst:1; - u32 pad:31; -} emmc_iocon_reg; -typedef struct { - u32 val; -} msdc_acmd_resp_reg; -typedef struct { - u32 tunesel:4; - u32 pad:28; -} msdc_acmd19_trg_reg; -typedef struct { - u32 val; -} msdc_acmd19_sts_reg; -typedef struct { - u32 addr; -} msdc_dma_sa_reg; -typedef struct { - u32 addr; -} msdc_dma_ca_reg; -typedef struct { - u32 start:1; - u32 stop:1; - u32 resume:1; - u32 pad1:5; - u32 mode:1; - u32 pad2:1; - u32 lastbuf:1; - u32 pad3:1; - u32 brustsz:3; - u32 pad4:1; - u32 xfersz:16; -} msdc_dma_ctrl_reg; -typedef struct { - u32 status:1; - u32 decsen:1; - u32 pad1:2; - u32 bdcsen:1; - u32 gpdcsen:1; - u32 pad2:26; -} msdc_dma_cfg_reg; -typedef struct { - u32 sel:16; - u32 pad2:16; -} msdc_dbg_sel_reg; -typedef struct { - u32 val; -} msdc_dbg_out_reg; -typedef struct { - u32 clkdrvn:3; - u32 rsv0:1; - u32 clkdrvp:3; - u32 rsv1:1; - u32 clksr:1; - u32 rsv2:7; - u32 clkpd:1; - u32 clkpu:1; - u32 clksmt:1; - u32 clkies:1; - u32 clktdsel:4; - u32 clkrdsel:8; -} msdc_pad_ctl0_reg; -typedef struct { - u32 cmddrvn:3; - u32 rsv0:1; - u32 cmddrvp:3; - u32 rsv1:1; - u32 cmdsr:1; - u32 rsv2:7; - u32 cmdpd:1; - u32 cmdpu:1; - u32 cmdsmt:1; - u32 cmdies:1; - u32 cmdtdsel:4; - u32 cmdrdsel:8; -} msdc_pad_ctl1_reg; -typedef struct { - u32 datdrvn:3; - u32 rsv0:1; - u32 datdrvp:3; - u32 rsv1:1; - u32 datsr:1; - u32 rsv2:7; - u32 datpd:1; - u32 datpu:1; - u32 datsmt:1; - u32 daties:1; - u32 dattdsel:4; - u32 datrdsel:8; -} msdc_pad_ctl2_reg; -typedef struct { - u32 wrrxdly:3; - u32 pad1:5; - u32 rdrxdly:8; - u32 pad2:16; -} msdc_pad_tune_reg; -typedef struct { - u32 dat0:5; - u32 rsv0:3; - u32 dat1:5; - u32 rsv1:3; - u32 dat2:5; - u32 rsv2:3; - u32 dat3:5; - u32 rsv3:3; -} msdc_dat_rddly0; -typedef struct { - u32 dat4:5; - u32 rsv4:3; - u32 dat5:5; - u32 rsv5:3; - u32 dat6:5; - u32 rsv6:3; - u32 dat7:5; - u32 rsv7:3; -} msdc_dat_rddly1; -typedef struct { - u32 dbg0sel:8; - u32 dbg1sel:6; - u32 pad1:2; - u32 dbg2sel:6; - u32 pad2:2; - u32 dbg3sel:6; - u32 pad3:2; -} msdc_hw_dbg_reg; -typedef struct { - u32 val; -} msdc_version_reg; -typedef struct { - u32 val; -} msdc_eco_ver_reg; +struct msdc_cfg_reg { + u32 msdc:1; + u32 ckpwn:1; + u32 rst:1; + u32 pio:1; + u32 ckdrven:1; + u32 start18v:1; + u32 pass18v:1; + u32 ckstb:1; + u32 ckdiv:8; + u32 ckmod:2; + u32 pad:14; +}; + +struct msdc_iocon_reg { + u32 sdr104cksel:1; + u32 rsmpl:1; + u32 dsmpl:1; + u32 ddlysel:1; + u32 ddr50ckd:1; + u32 dsplsel:1; + u32 pad1:10; + u32 d0spl:1; + u32 d1spl:1; + u32 d2spl:1; + u32 d3spl:1; + u32 d4spl:1; + u32 d5spl:1; + u32 d6spl:1; + u32 d7spl:1; + u32 riscsz:1; + u32 pad2:7; +}; + +struct msdc_ps_reg { + u32 cden:1; + u32 cdsts:1; + u32 pad1:10; + u32 cddebounce:4; + u32 dat:8; + u32 cmd:1; + u32 pad2:6; + u32 wp:1; +}; + +struct msdc_int_reg { + u32 mmcirq:1; + u32 cdsc:1; + u32 pad1:1; + u32 atocmdrdy:1; + u32 atocmdtmo:1; + u32 atocmdcrc:1; + u32 dmaqempty:1; + u32 sdioirq:1; + u32 cmdrdy:1; + u32 cmdtmo:1; + u32 rspcrc:1; + u32 csta:1; + u32 xfercomp:1; + u32 dxferdone:1; + u32 dattmo:1; + u32 datcrc:1; + u32 atocmd19done:1; + u32 pad2:15; +}; + +struct msdc_inten_reg { + u32 mmcirq:1; + u32 cdsc:1; + u32 pad1:1; + u32 atocmdrdy:1; + u32 atocmdtmo:1; + u32 atocmdcrc:1; + u32 dmaqempty:1; + u32 sdioirq:1; + u32 cmdrdy:1; + u32 cmdtmo:1; + u32 rspcrc:1; + u32 csta:1; + u32 xfercomp:1; + u32 dxferdone:1; + u32 dattmo:1; + u32 datcrc:1; + u32 atocmd19done:1; + u32 pad2:15; +}; + +struct msdc_fifocs_reg { + u32 rxcnt:8; + u32 pad1:8; + u32 txcnt:8; + u32 pad2:7; + u32 clr:1; +}; + +struct msdc_txdat_reg { + u32 val; +}; + +struct msdc_rxdat_reg { + u32 val; +}; + +struct sdc_cfg_reg { + u32 sdiowkup:1; + u32 inswkup:1; + u32 pad1:14; + u32 buswidth:2; + u32 pad2:1; + u32 sdio:1; + u32 sdioide:1; + u32 intblkgap:1; + u32 pad4:2; + u32 dtoc:8; +}; + +struct sdc_cmd_reg { + u32 cmd:6; + u32 brk:1; + u32 rsptyp:3; + u32 pad1:1; + u32 dtype:2; + u32 rw:1; + u32 stop:1; + u32 goirq:1; + u32 blklen:12; + u32 atocmd:2; + u32 volswth:1; + u32 pad2:1; +}; + +struct sdc_arg_reg { + u32 arg; +}; + +struct sdc_sts_reg { + u32 sdcbusy:1; + u32 cmdbusy:1; + u32 pad:29; + u32 swrcmpl:1; +}; + +struct sdc_resp0_reg { + u32 val; +}; + +struct sdc_resp1_reg { + u32 val; +}; + +struct sdc_resp2_reg { + u32 val; +}; + +struct sdc_resp3_reg { + u32 val; +}; + +struct sdc_blknum_reg { + u32 num; +}; + +struct sdc_csts_reg { + u32 sts; +}; + +struct sdc_cstsen_reg { + u32 sts; +}; + +struct sdc_datcrcsts_reg { + u32 datcrcsts:8; + u32 ddrcrcsts:4; + u32 pad:20; +}; + +struct emmc_cfg0_reg { + u32 bootstart:1; + u32 bootstop:1; + u32 bootmode:1; + u32 pad1:9; + u32 bootwaidly:3; + u32 bootsupp:1; + u32 pad2:16; +}; + +struct emmc_cfg1_reg { + u32 bootcrctmc:16; + u32 pad:4; + u32 bootacktmc:12; +}; + +struct emmc_sts_reg { + u32 bootcrcerr:1; + u32 bootackerr:1; + u32 bootdattmo:1; + u32 bootacktmo:1; + u32 bootupstate:1; + u32 bootackrcv:1; + u32 bootdatrcv:1; + u32 pad:25; +}; + +struct emmc_iocon_reg { + u32 bootrst:1; + u32 pad:31; +}; + +struct msdc_acmd_resp_reg { + u32 val; +}; + +struct msdc_acmd19_trg_reg { + u32 tunesel:4; + u32 pad:28; +}; + +struct msdc_acmd19_sts_reg { + u32 val; +}; + +struct msdc_dma_sa_reg { + u32 addr; +}; + +struct msdc_dma_ca_reg { + u32 addr; +}; + +struct msdc_dma_ctrl_reg { + u32 start:1; + u32 stop:1; + u32 resume:1; + u32 pad1:5; + u32 mode:1; + u32 pad2:1; + u32 lastbuf:1; + u32 pad3:1; + u32 brustsz:3; + u32 pad4:1; + u32 xfersz:16; +}; + +struct msdc_dma_cfg_reg { + u32 status:1; + u32 decsen:1; + u32 pad1:2; + u32 bdcsen:1; + u32 gpdcsen:1; + u32 pad2:26; +}; + +struct msdc_dbg_sel_reg { + u32 sel:16; + u32 pad2:16; +}; + +struct msdc_dbg_out_reg { + u32 val; +}; + +struct msdc_pad_ctl0_reg { + u32 clkdrvn:3; + u32 rsv0:1; + u32 clkdrvp:3; + u32 rsv1:1; + u32 clksr:1; + u32 rsv2:7; + u32 clkpd:1; + u32 clkpu:1; + u32 clksmt:1; + u32 clkies:1; + u32 clktdsel:4; + u32 clkrdsel:8; +}; + +struct msdc_pad_ctl1_reg { + u32 cmddrvn:3; + u32 rsv0:1; + u32 cmddrvp:3; + u32 rsv1:1; + u32 cmdsr:1; + u32 rsv2:7; + u32 cmdpd:1; + u32 cmdpu:1; + u32 cmdsmt:1; + u32 cmdies:1; + u32 cmdtdsel:4; + u32 cmdrdsel:8; +}; + +struct msdc_pad_ctl2_reg { + u32 datdrvn:3; + u32 rsv0:1; + u32 datdrvp:3; + u32 rsv1:1; + u32 datsr:1; + u32 rsv2:7; + u32 datpd:1; + u32 datpu:1; + u32 datsmt:1; + u32 daties:1; + u32 dattdsel:4; + u32 datrdsel:8; +}; + +struct msdc_pad_tune_reg { + u32 wrrxdly:3; + u32 pad1:5; + u32 rdrxdly:8; + u32 pad2:16; +}; + +struct msdc_dat_rddly0 { + u32 dat0:5; + u32 rsv0:3; + u32 dat1:5; + u32 rsv1:3; + u32 dat2:5; + u32 rsv2:3; + u32 dat3:5; + u32 rsv3:3; +}; + +struct msdc_dat_rddly1 { + u32 dat4:5; + u32 rsv4:3; + u32 dat5:5; + u32 rsv5:3; + u32 dat6:5; + u32 rsv6:3; + u32 dat7:5; + u32 rsv7:3; +}; + +struct msdc_hw_dbg_reg { + u32 dbg0sel:8; + u32 dbg1sel:6; + u32 pad1:2; + u32 dbg2sel:6; + u32 pad2:2; + u32 dbg3sel:6; + u32 pad3:2; +}; + +struct msdc_version_reg { + u32 val; +}; + +struct msdc_eco_ver_reg { + u32 val; +}; struct msdc_regs { - msdc_cfg_reg msdc_cfg; /* base+0x00h */ - msdc_iocon_reg msdc_iocon; /* base+0x04h */ - msdc_ps_reg msdc_ps; /* base+0x08h */ - msdc_int_reg msdc_int; /* base+0x0ch */ - msdc_inten_reg msdc_inten; /* base+0x10h */ - msdc_fifocs_reg msdc_fifocs; /* base+0x14h */ - msdc_txdat_reg msdc_txdat; /* base+0x18h */ - msdc_rxdat_reg msdc_rxdat; /* base+0x1ch */ - u32 rsv1[4]; - sdc_cfg_reg sdc_cfg; /* base+0x30h */ - sdc_cmd_reg sdc_cmd; /* base+0x34h */ - sdc_arg_reg sdc_arg; /* base+0x38h */ - sdc_sts_reg sdc_sts; /* base+0x3ch */ - sdc_resp0_reg sdc_resp0; /* base+0x40h */ - sdc_resp1_reg sdc_resp1; /* base+0x44h */ - sdc_resp2_reg sdc_resp2; /* base+0x48h */ - sdc_resp3_reg sdc_resp3; /* base+0x4ch */ - sdc_blknum_reg sdc_blknum; /* base+0x50h */ - u32 rsv2[1]; - sdc_csts_reg sdc_csts; /* base+0x58h */ - sdc_cstsen_reg sdc_cstsen; /* base+0x5ch */ - sdc_datcrcsts_reg sdc_dcrcsta; /* base+0x60h */ - u32 rsv3[3]; - emmc_cfg0_reg emmc_cfg0; /* base+0x70h */ - emmc_cfg1_reg emmc_cfg1; /* base+0x74h */ - emmc_sts_reg emmc_sts; /* base+0x78h */ - emmc_iocon_reg emmc_iocon; /* base+0x7ch */ - msdc_acmd_resp_reg acmd_resp; /* base+0x80h */ - msdc_acmd19_trg_reg acmd19_trg; /* base+0x84h */ - msdc_acmd19_sts_reg acmd19_sts; /* base+0x88h */ - u32 rsv4[1]; - msdc_dma_sa_reg dma_sa; /* base+0x90h */ - msdc_dma_ca_reg dma_ca; /* base+0x94h */ - msdc_dma_ctrl_reg dma_ctrl; /* base+0x98h */ - msdc_dma_cfg_reg dma_cfg; /* base+0x9ch */ - msdc_dbg_sel_reg dbg_sel; /* base+0xa0h */ - msdc_dbg_out_reg dbg_out; /* base+0xa4h */ - u32 rsv5[2]; - u32 patch0; /* base+0xb0h */ - u32 patch1; /* base+0xb4h */ - u32 rsv6[10]; - msdc_pad_ctl0_reg pad_ctl0; /* base+0xe0h */ - msdc_pad_ctl1_reg pad_ctl1; /* base+0xe4h */ - msdc_pad_ctl2_reg pad_ctl2; /* base+0xe8h */ - msdc_pad_tune_reg pad_tune; /* base+0xech */ - msdc_dat_rddly0 dat_rddly0; /* base+0xf0h */ - msdc_dat_rddly1 dat_rddly1; /* base+0xf4h */ - msdc_hw_dbg_reg hw_dbg; /* base+0xf8h */ - u32 rsv7[1]; - msdc_version_reg version; /* base+0x100h */ - msdc_eco_ver_reg eco_ver; /* base+0x104h */ + struct msdc_cfg_reg msdc_cfg; /* base+0x00h */ + struct msdc_iocon_reg msdc_iocon; /* base+0x04h */ + struct msdc_ps_reg msdc_ps; /* base+0x08h */ + struct msdc_int_reg msdc_int; /* base+0x0ch */ + struct msdc_inten_reg msdc_inten; /* base+0x10h */ + struct msdc_fifocs_reg msdc_fifocs; /* base+0x14h */ + struct msdc_txdat_reg msdc_txdat; /* base+0x18h */ + struct msdc_rxdat_reg msdc_rxdat; /* base+0x1ch */ + u32 rsv1[4]; + struct sdc_cfg_reg sdc_cfg; /* base+0x30h */ + struct sdc_cmd_reg sdc_cmd; /* base+0x34h */ + struct sdc_arg_reg sdc_arg; /* base+0x38h */ + struct sdc_sts_reg sdc_sts; /* base+0x3ch */ + struct sdc_resp0_reg sdc_resp0; /* base+0x40h */ + struct sdc_resp1_reg sdc_resp1; /* base+0x44h */ + struct sdc_resp2_reg sdc_resp2; /* base+0x48h */ + struct sdc_resp3_reg sdc_resp3; /* base+0x4ch */ + struct sdc_blknum_reg sdc_blknum; /* base+0x50h */ + u32 rsv2[1]; + struct sdc_csts_reg sdc_csts; /* base+0x58h */ + struct sdc_cstsen_reg sdc_cstsen; /* base+0x5ch */ + struct sdc_datcrcsts_reg sdc_dcrcsta; /* base+0x60h */ + u32 rsv3[3]; + struct emmc_cfg0_reg emmc_cfg0; /* base+0x70h */ + struct emmc_cfg1_reg emmc_cfg1; /* base+0x74h */ + struct emmc_sts_reg emmc_sts; /* base+0x78h */ + struct emmc_iocon_reg emmc_iocon; /* base+0x7ch */ + struct msdc_acmd_resp_reg acmd_resp; /* base+0x80h */ + struct msdc_acmd19_trg_reg acmd19_trg; /* base+0x84h */ + struct msdc_acmd19_sts_reg acmd19_sts; /* base+0x88h */ + u32 rsv4[1]; + struct msdc_dma_sa_reg dma_sa; /* base+0x90h */ + struct msdc_dma_ca_reg dma_ca; /* base+0x94h */ + struct msdc_dma_ctrl_reg dma_ctrl; /* base+0x98h */ + struct msdc_dma_cfg_reg dma_cfg; /* base+0x9ch */ + struct msdc_dbg_sel_reg dbg_sel; /* base+0xa0h */ + struct msdc_dbg_out_reg dbg_out; /* base+0xa4h */ + u32 rsv5[2]; + u32 patch0; /* base+0xb0h */ + u32 patch1; /* base+0xb4h */ + u32 rsv6[10]; + struct msdc_pad_ctl0_reg pad_ctl0; /* base+0xe0h */ + struct msdc_pad_ctl1_reg pad_ctl1; /* base+0xe4h */ + struct msdc_pad_ctl2_reg pad_ctl2; /* base+0xe8h */ + struct msdc_pad_tune_reg pad_tune; /* base+0xech */ + struct msdc_dat_rddly0 dat_rddly0; /* base+0xf0h */ + struct msdc_dat_rddly1 dat_rddly1; /* base+0xf4h */ + struct msdc_hw_dbg_reg hw_dbg; /* base+0xf8h */ + u32 rsv7[1]; + struct msdc_version_reg version; /* base+0x100h */ + struct msdc_eco_ver_reg eco_ver; /* base+0x104h */ }; -struct scatterlist_ex { - u32 cmd; - u32 arg; - u32 sglen; - struct scatterlist *sg; -}; - -#define DMA_FLAG_NONE (0x00000000) -#define DMA_FLAG_EN_CHKSUM (0x00000001) -#define DMA_FLAG_PAD_BLOCK (0x00000002) -#define DMA_FLAG_PAD_DWORD (0x00000004) - struct msdc_dma { - u32 flags; /* flags */ - u32 xfersz; /* xfer size in bytes */ - u32 sglen; /* size of scatter list */ - u32 blklen; /* block size */ - struct scatterlist *sg; /* I/O scatter list */ - struct scatterlist_ex *esg; /* extended I/O scatter list */ - u8 mode; /* dma mode */ - u8 burstsz; /* burst size */ - u8 intr; /* dma done interrupt */ - u8 padding; /* padding */ - u32 cmd; /* enhanced mode command */ - u32 arg; /* enhanced mode arg */ - u32 rsp; /* enhanced mode command response */ - u32 autorsp; /* auto command response */ + u32 sglen; /* size of scatter list */ + struct scatterlist *sg; /* I/O scatter list */ + u8 mode; /* dma mode */ - gpd_t *gpd; /* pointer to gpd array */ - bd_t *bd; /* pointer to bd array */ - dma_addr_t gpd_addr; /* the physical address of gpd array */ - dma_addr_t bd_addr; /* the physical address of bd array */ - u32 used_gpd; /* the number of used gpd elements */ - u32 used_bd; /* the number of used bd elements */ + struct gpd *gpd; /* pointer to gpd array */ + struct bd *bd; /* pointer to bd array */ + dma_addr_t gpd_addr; /* the physical address of gpd array */ + dma_addr_t bd_addr; /* the physical address of bd array */ }; -struct msdc_host -{ - struct msdc_hw *hw; +struct msdc_host { + struct msdc_hw *hw; - struct mmc_host *mmc; /* mmc structure */ - struct mmc_command *cmd; - struct mmc_data *data; - struct mmc_request *mrq; - int cmd_rsp; - int cmd_rsp_done; - int cmd_r1b_done; + struct mmc_host *mmc; /* mmc structure */ + struct mmc_command *cmd; + struct mmc_data *data; + struct mmc_request *mrq; + int cmd_rsp; - int error; - spinlock_t lock; /* mutex */ - struct semaphore sem; + int error; + spinlock_t lock; /* mutex */ + struct semaphore sem; - u32 blksz; /* host block size */ - u32 base; /* host base address */ - int id; /* host id */ - int pwr_ref; /* core power reference count */ + u32 blksz; /* host block size */ + void __iomem *base; /* host base address */ + int id; /* host id */ + int pwr_ref; /* core power reference count */ - u32 xfer_size; /* total transferred size */ + u32 xfer_size; /* total transferred size */ - struct msdc_dma dma; /* dma channel */ - u32 dma_addr; /* dma transfer address */ - u32 dma_left_size; /* dma transfer left size */ - u32 dma_xfer_size; /* dma transfer size in bytes */ - int dma_xfer; /* dma transfer mode */ + struct msdc_dma dma; /* dma channel */ + u32 dma_xfer_size; /* dma transfer size in bytes */ - u32 timeout_ns; /* data timeout ns */ - u32 timeout_clks; /* data timeout clks */ + u32 timeout_ns; /* data timeout ns */ + u32 timeout_clks; /* data timeout clks */ - atomic_t abort; /* abort transfer */ + int irq; /* host interrupt */ - int irq; /* host interrupt */ + struct delayed_work card_delaywork; - struct tasklet_struct card_tasklet; -#if 0 - struct work_struct card_workqueue; -#else - struct delayed_work card_delaywork; -#endif + struct completion cmd_done; + struct completion xfer_done; + struct pm_message pm_state; - struct completion cmd_done; - struct completion xfer_done; - struct pm_message pm_state; - - u32 mclk; /* mmc subsystem clock */ - u32 hclk; /* host clock speed */ - u32 sclk; /* SD/MS clock speed */ - u8 core_clkon; /* Host core clock on ? */ - u8 card_clkon; /* Card clock on ? */ - u8 core_power; /* core power */ - u8 power_mode; /* host power mode */ - u8 card_inserted; /* card inserted ? */ - u8 suspend; /* host suspended ? */ - u8 reserved; - u8 app_cmd; /* for app command */ - u32 app_cmd_arg; - u64 starttime; + u32 mclk; /* mmc subsystem clock */ + u32 hclk; /* host clock speed */ + u32 sclk; /* SD/MS clock speed */ + u8 core_clkon; /* Host core clock on ? */ + u8 card_clkon; /* Card clock on ? */ + u8 core_power; /* core power */ + u8 power_mode; /* host power mode */ + u8 card_inserted; /* card inserted ? */ + u8 suspend; /* host suspended ? */ + u8 app_cmd; /* for app command */ + u32 app_cmd_arg; }; -static inline unsigned int uffs(unsigned int x) -{ - unsigned int r = 1; +#define sdr_read8(reg) readb(reg) +#define sdr_read32(reg) readl(reg) +#define sdr_write8(reg, val) writeb(val, reg) +#define sdr_write32(reg, val) writel(val, reg) - if (!x) - return 0; - if (!(x & 0xffff)) { - x >>= 16; - r += 16; - } - if (!(x & 0xff)) { - x >>= 8; - r += 8; - } - if (!(x & 0xf)) { - x >>= 4; - r += 4; - } - if (!(x & 3)) { - x >>= 2; - r += 2; - } - if (!(x & 1)) { - x >>= 1; - r += 1; - } - return r; +static inline void sdr_set_bits(void __iomem *reg, u32 bs) +{ + u32 val = readl(reg); + + val |= bs; + writel(val, reg); } -#define sdr_read8(reg) __raw_readb(reg) -#define sdr_read16(reg) __raw_readw(reg) -#define sdr_read32(reg) __raw_readl(reg) -#define sdr_write8(reg,val) __raw_writeb(val,reg) -#define sdr_write16(reg,val) __raw_writew(val,reg) -#define sdr_write32(reg,val) __raw_writel(val,reg) -#define sdr_set_bits(reg,bs) ((*(volatile u32*)(reg)) |= (u32)(bs)) -#define sdr_clr_bits(reg,bs) ((*(volatile u32*)(reg)) &= ~((u32)(bs))) +static inline void sdr_clr_bits(void __iomem *reg, u32 bs) +{ + u32 val = readl(reg); -#define sdr_set_field(reg,field,val) \ - do { \ - volatile unsigned int tv = sdr_read32(reg); \ - tv &= ~(field); \ - tv |= ((val) << (uffs((unsigned int)field) - 1)); \ - sdr_write32(reg,tv); \ - } while(0) -#define sdr_get_field(reg,field,val) \ - do { \ - volatile unsigned int tv = sdr_read32(reg); \ - val = ((tv & (field)) >> (uffs((unsigned int)field) - 1)); \ - } while(0) + val &= ~bs; + writel(val, reg); +} + +static inline void sdr_set_field(void __iomem *reg, u32 field, u32 val) +{ + unsigned int tv = readl(reg); + + tv &= ~field; + tv |= ((val) << (ffs((unsigned int)field) - 1)); + writel(tv, reg); +} + +static inline void sdr_get_field(void __iomem *reg, u32 field, u32 *val) +{ + unsigned int tv = readl(reg); + *val = ((tv & field) >> (ffs((unsigned int)field) - 1)); +} #endif - diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c index d911e1a42..4ced4b660 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c @@ -34,38 +34,22 @@ */ #include -#include -#include +#include +#include #include -#include -#include -#include #include #include -#include -#include -#include + #include -#include -#include #include #include #include -#include -/* +++ by chhung */ -#include -#include -#include -#include -#include +#include -#define MSDC_SMPL_FALLING (1) -#define MSDC_CD_PIN_EN (1 << 0) /* card detection pin is wired */ -#define MSDC_WP_PIN_EN (1 << 1) /* write protection pin is wired */ -#define MSDC_REMOVABLE (1 << 5) /* removable slot */ -#define MSDC_SYS_SUSPEND (1 << 6) /* suspended by system */ -#define MSDC_HIGHSPEED (1 << 7) +#include "board.h" +#include "dbg.h" +#include "mt6575_sd.h" //#define IRQ_SDC 14 //MT7620 /*FIXME*/ #ifdef CONFIG_SOC_MT7621 @@ -77,46 +61,11 @@ #endif #define IRQ_SDC 22 /*FIXME*/ -#include -/* end of +++ */ - - -#include - -#if 0 /* --- by chhung */ -#include -#include -#include -#include -#include -//#include -//#include -//#include -#include -// #include -#endif /* end of --- */ - -#include "mt6575_sd.h" -#include "dbg.h" - -/* +++ by chhung */ -#include "board.h" -/* end of +++ */ - -#if 0 /* --- by chhung */ -#define isb() __asm__ __volatile__ ("" : : : "memory") -#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \ - : : "r" (0) : "memory") -#define dmb() __asm__ __volatile__ ("" : : : "memory") -#endif /* end of --- */ - #define DRV_NAME "mtk-sd" -#define HOST_MAX_NUM (1) /* +/- by chhung */ - -#if defined (CONFIG_SOC_MT7620) +#if defined(CONFIG_SOC_MT7620) #define HOST_MAX_MCLK (48000000) /* +/- by chhung */ -#elif defined (CONFIG_SOC_MT7621) +#elif defined(CONFIG_SOC_MT7621) #define HOST_MAX_MCLK (50000000) /* +/- by chhung */ #endif #define HOST_MIN_MCLK (260000) @@ -130,14 +79,14 @@ #if 0 /* --- by chhung */ #define MSDC_CLKSRC_REG (0xf100000C) -#define PDN_REG (0xF1000010) +#define PDN_REG (0xF1000010) #endif /* end of --- */ #define DEFAULT_DEBOUNCE (8) /* 8 cycles */ #define DEFAULT_DTOC (40) /* data timeout counter. 65536x40 sclk. */ -#define CMD_TIMEOUT (HZ/10) /* 100ms */ -#define DAT_TIMEOUT (HZ/2 * 5) /* 500ms x5 */ +#define CMD_TIMEOUT (HZ / 10) /* 100ms */ +#define DAT_TIMEOUT (HZ / 2 * 5) /* 500ms x5 */ #define MAX_DMA_CNT (64 * 1024 - 512) /* a single transaction for WIFI may be 50K*/ @@ -148,9 +97,7 @@ #define MAX_HW_SGMTS (MAX_BD_NUM) #define MAX_PHY_SGMTS (MAX_BD_NUM) #define MAX_SGMT_SZ (MAX_DMA_CNT) -#define MAX_REQ_SZ (MAX_SGMT_SZ * 8) - -static int mtk_sw_poll; +#define MAX_REQ_SZ (MAX_SGMT_SZ * 8) static int cd_active_low = 1; @@ -162,200 +109,147 @@ static int cd_active_low = 1; #if 0 /* --- by chhung */ /* gate means clock power down */ -static int g_clk_gate = 0; +static int g_clk_gate = 0; #define msdc_gate_clock(id) \ - do { \ - g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while(0) + do { \ + g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ + } while (0) /* not like power down register. 1 means clock on. */ #define msdc_ungate_clock(id) \ - do { \ - g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while(0) + do { \ + g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ + } while (0) -// do we need sync object or not -void msdc_clk_status(int * status) +// do we need sync object or not +void msdc_clk_status(int *status) { - *status = g_clk_gate; + *status = g_clk_gate; } #endif /* end of --- */ /* +++ by chhung */ struct msdc_hw msdc0_hw = { .clk_src = 0, - .cmd_edge = MSDC_SMPL_FALLING, - .data_edge = MSDC_SMPL_FALLING, - .clk_drv = 4, - .cmd_drv = 4, - .dat_drv = 4, - .data_pins = 4, - .data_offset = 0, - .flags = MSDC_SYS_SUSPEND | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED, -// .flags = MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE, + .flags = MSDC_CD_PIN_EN | MSDC_REMOVABLE, +// .flags = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE, }; -static struct resource mtk_sd_resources[] = { - [0] = { - .start = RALINK_MSDC_BASE, - .end = RALINK_MSDC_BASE+0x3fff, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = IRQ_SDC, /*FIXME*/ - .end = IRQ_SDC, /*FIXME*/ - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device mtk_sd_device = { - .name = "mtk-sd", - .id = 0, - .num_resources = ARRAY_SIZE(mtk_sd_resources), - .resource = mtk_sd_resources, -}; /* end of +++ */ static int msdc_rsp[] = { - 0, /* RESP_NONE */ - 1, /* RESP_R1 */ - 2, /* RESP_R2 */ - 3, /* RESP_R3 */ - 4, /* RESP_R4 */ - 1, /* RESP_R5 */ - 1, /* RESP_R6 */ - 1, /* RESP_R7 */ - 7, /* RESP_R1b */ + 0, /* RESP_NONE */ + 1, /* RESP_R1 */ + 2, /* RESP_R2 */ + 3, /* RESP_R3 */ + 4, /* RESP_R4 */ + 1, /* RESP_R5 */ + 1, /* RESP_R6 */ + 1, /* RESP_R7 */ + 7, /* RESP_R1b */ }; -/* For Inhanced DMA */ -#define msdc_init_gpd_ex(gpd,extlen,cmd,arg,blknum) \ - do { \ - ((gpd_t*)gpd)->extlen = extlen; \ - ((gpd_t*)gpd)->cmd = cmd; \ - ((gpd_t*)gpd)->arg = arg; \ - ((gpd_t*)gpd)->blknum = blknum; \ - }while(0) - -#define msdc_init_bd(bd, blkpad, dwpad, dptr, dlen) \ - do { \ - BUG_ON(dlen > 0xFFFFUL); \ - ((bd_t*)bd)->blkpad = blkpad; \ - ((bd_t*)bd)->dwpad = dwpad; \ - ((bd_t*)bd)->ptr = (void*)dptr; \ - ((bd_t*)bd)->buflen = dlen; \ - }while(0) - #define msdc_txfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_TXCNT) >> 16) #define msdc_rxfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_RXCNT) >> 0) #define msdc_fifo_write32(v) sdr_write32(MSDC_TXDATA, (v)) #define msdc_fifo_write8(v) sdr_write8(MSDC_TXDATA, (v)) #define msdc_fifo_read32() sdr_read32(MSDC_RXDATA) -#define msdc_fifo_read8() sdr_read8(MSDC_RXDATA) - +#define msdc_fifo_read8() sdr_read8(MSDC_RXDATA) #define msdc_dma_on() sdr_clr_bits(MSDC_CFG, MSDC_CFG_PIO) -#define msdc_dma_off() sdr_set_bits(MSDC_CFG, MSDC_CFG_PIO) -#define msdc_retry(expr,retry,cnt) \ - do { \ - int backup = cnt; \ - while (retry) { \ - if (!(expr)) break; \ - if (cnt-- == 0) { \ - retry--; mdelay(1); cnt = backup; \ - } \ - } \ - WARN_ON(retry == 0); \ - } while(0) +#define msdc_retry(expr, retry, cnt) \ + do { \ + int backup = cnt; \ + while (retry) { \ + if (!(expr)) \ + break; \ + if (cnt-- == 0) { \ + retry--; mdelay(1); cnt = backup; \ + } \ + } \ + WARN_ON(retry == 0); \ + } while (0) -#if 0 /* --- by chhung */ -#define msdc_reset() \ - do { \ - int retry = 3, cnt = 1000; \ - sdr_set_bits(MSDC_CFG, MSDC_CFG_RST); \ - dsb(); \ - msdc_retry(sdr_read32(MSDC_CFG) & MSDC_CFG_RST, retry, cnt); \ - } while(0) -#else -#define msdc_reset() \ - do { \ - int retry = 3, cnt = 1000; \ - sdr_set_bits(MSDC_CFG, MSDC_CFG_RST); \ - msdc_retry(sdr_read32(MSDC_CFG) & MSDC_CFG_RST, retry, cnt); \ - } while(0) -#endif /* end of +/- */ +static void msdc_reset_hw(struct msdc_host *host) +{ + void __iomem *base = host->base; + + sdr_set_bits(MSDC_CFG, MSDC_CFG_RST); + while (sdr_read32(MSDC_CFG) & MSDC_CFG_RST) + cpu_relax(); +} #define msdc_clr_int() \ - do { \ - volatile u32 val = sdr_read32(MSDC_INT); \ - sdr_write32(MSDC_INT, val); \ - } while(0) + do { \ + volatile u32 val = sdr_read32(MSDC_INT); \ + sdr_write32(MSDC_INT, val); \ + } while (0) #define msdc_clr_fifo() \ - do { \ - int retry = 3, cnt = 1000; \ - sdr_set_bits(MSDC_FIFOCS, MSDC_FIFOCS_CLR); \ - msdc_retry(sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_CLR, retry, cnt); \ - } while(0) + do { \ + int retry = 3, cnt = 1000; \ + sdr_set_bits(MSDC_FIFOCS, MSDC_FIFOCS_CLR); \ + msdc_retry(sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_CLR, retry, cnt); \ + } while (0) #define msdc_irq_save(val) \ - do { \ - val = sdr_read32(MSDC_INTEN); \ - sdr_clr_bits(MSDC_INTEN, val); \ - } while(0) - + do { \ + val = sdr_read32(MSDC_INTEN); \ + sdr_clr_bits(MSDC_INTEN, val); \ + } while (0) + #define msdc_irq_restore(val) \ - do { \ - sdr_set_bits(MSDC_INTEN, val); \ - } while(0) + do { \ + sdr_set_bits(MSDC_INTEN, val); \ + } while (0) /* clock source for host: global */ -#if defined (CONFIG_SOC_MT7620) +#if defined(CONFIG_SOC_MT7620) static u32 hclks[] = {48000000}; /* +/- by chhung */ -#elif defined (CONFIG_SOC_MT7621) +#elif defined(CONFIG_SOC_MT7621) static u32 hclks[] = {50000000}; /* +/- by chhung */ #endif //============================================ // the power for msdc host controller: global -// always keep the VMC on. +// always keep the VMC on. //============================================ #define msdc_vcore_on(host) \ - do { \ - INIT_MSG("[+]VMC ref. count<%d>", ++host->pwr_ref); \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"); \ - } while (0) + do { \ + INIT_MSG("[+]VMC ref. count<%d>", ++host->pwr_ref); \ + (void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"); \ + } while (0) #define msdc_vcore_off(host) \ - do { \ - INIT_MSG("[-]VMC ref. count<%d>", --host->pwr_ref); \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"); \ - } while (0) + do { \ + INIT_MSG("[-]VMC ref. count<%d>", --host->pwr_ref); \ + (void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"); \ + } while (0) //==================================== -// the vdd output for card: global -// always keep the VMCH on. -//==================================== +// the vdd output for card: global +// always keep the VMCH on. +//==================================== #define msdc_vdd_on(host) \ - do { \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"); \ - } while (0) + do { \ + (void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"); \ + } while (0) #define msdc_vdd_off(host) \ - do { \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \ - } while (0) + do { \ + (void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \ + } while (0) #define sdc_is_busy() (sdr_read32(SDC_STS) & SDC_STS_SDCBUSY) #define sdc_is_cmd_busy() (sdr_read32(SDC_STS) & SDC_STS_CMDBUSY) -#define sdc_send_cmd(cmd,arg) \ - do { \ - sdr_write32(SDC_ARG, (arg)); \ - sdr_write32(SDC_CMD, (cmd)); \ - } while(0) +#define sdc_send_cmd(cmd, arg) \ + do { \ + sdr_write32(SDC_ARG, (arg)); \ + sdr_write32(SDC_CMD, (cmd)); \ + } while (0) // can modify to read h/w register. //#define is_card_present(h) ((sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1); -#define is_card_present(h) (((struct msdc_host*)(h))->card_inserted) +#define is_card_present(h) (((struct msdc_host *)(h))->card_inserted) /* +++ by chhung */ #ifndef __ASSEMBLY__ @@ -364,2013 +258,1621 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */ #define PHYSADDR(a) ((a) & 0x1fffffff) #endif /* end of +++ */ -static unsigned int msdc_do_command(struct msdc_host *host, - struct mmc_command *cmd, - int tune, - unsigned long timeout); - -static int msdc_tune_cmdrsp(struct msdc_host*host,struct mmc_command *cmd); +static unsigned int msdc_do_command(struct msdc_host *host, + struct mmc_command *cmd, + int tune, + unsigned long timeout); + +static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd); #ifdef MT6575_SD_DEBUG static void msdc_dump_card_status(struct msdc_host *host, u32 status) { - static char *state[] = { - "Idle", /* 0 */ - "Ready", /* 1 */ - "Ident", /* 2 */ - "Stby", /* 3 */ - "Tran", /* 4 */ - "Data", /* 5 */ - "Rcv", /* 6 */ - "Prg", /* 7 */ - "Dis", /* 8 */ - "Reserved", /* 9 */ - "Reserved", /* 10 */ - "Reserved", /* 11 */ - "Reserved", /* 12 */ - "Reserved", /* 13 */ - "Reserved", /* 14 */ - "I/O mode", /* 15 */ - }; - if (status & R1_OUT_OF_RANGE) - N_MSG(RSP, "[CARD_STATUS] Out of Range"); - if (status & R1_ADDRESS_ERROR) - N_MSG(RSP, "[CARD_STATUS] Address Error"); - if (status & R1_BLOCK_LEN_ERROR) - N_MSG(RSP, "[CARD_STATUS] Block Len Error"); - if (status & R1_ERASE_SEQ_ERROR) - N_MSG(RSP, "[CARD_STATUS] Erase Seq Error"); - if (status & R1_ERASE_PARAM) - N_MSG(RSP, "[CARD_STATUS] Erase Param"); - if (status & R1_WP_VIOLATION) - N_MSG(RSP, "[CARD_STATUS] WP Violation"); - if (status & R1_CARD_IS_LOCKED) - N_MSG(RSP, "[CARD_STATUS] Card is Locked"); - if (status & R1_LOCK_UNLOCK_FAILED) - N_MSG(RSP, "[CARD_STATUS] Lock/Unlock Failed"); - if (status & R1_COM_CRC_ERROR) - N_MSG(RSP, "[CARD_STATUS] Command CRC Error"); - if (status & R1_ILLEGAL_COMMAND) - N_MSG(RSP, "[CARD_STATUS] Illegal Command"); - if (status & R1_CARD_ECC_FAILED) - N_MSG(RSP, "[CARD_STATUS] Card ECC Failed"); - if (status & R1_CC_ERROR) - N_MSG(RSP, "[CARD_STATUS] CC Error"); - if (status & R1_ERROR) - N_MSG(RSP, "[CARD_STATUS] Error"); - if (status & R1_UNDERRUN) - N_MSG(RSP, "[CARD_STATUS] Underrun"); - if (status & R1_OVERRUN) - N_MSG(RSP, "[CARD_STATUS] Overrun"); - if (status & R1_CID_CSD_OVERWRITE) - N_MSG(RSP, "[CARD_STATUS] CID/CSD Overwrite"); - if (status & R1_WP_ERASE_SKIP) - N_MSG(RSP, "[CARD_STATUS] WP Eraser Skip"); - if (status & R1_CARD_ECC_DISABLED) - N_MSG(RSP, "[CARD_STATUS] Card ECC Disabled"); - if (status & R1_ERASE_RESET) - N_MSG(RSP, "[CARD_STATUS] Erase Reset"); - if (status & R1_READY_FOR_DATA) - N_MSG(RSP, "[CARD_STATUS] Ready for Data"); - if (status & R1_SWITCH_ERROR) - N_MSG(RSP, "[CARD_STATUS] Switch error"); - if (status & R1_APP_CMD) - N_MSG(RSP, "[CARD_STATUS] App Command"); - - N_MSG(RSP, "[CARD_STATUS] '%s' State", state[R1_CURRENT_STATE(status)]); +/* N_MSG is currently a no-op */ +#if 0 + static char *state[] = { + "Idle", /* 0 */ + "Ready", /* 1 */ + "Ident", /* 2 */ + "Stby", /* 3 */ + "Tran", /* 4 */ + "Data", /* 5 */ + "Rcv", /* 6 */ + "Prg", /* 7 */ + "Dis", /* 8 */ + "Reserved", /* 9 */ + "Reserved", /* 10 */ + "Reserved", /* 11 */ + "Reserved", /* 12 */ + "Reserved", /* 13 */ + "Reserved", /* 14 */ + "I/O mode", /* 15 */ + }; +#endif + if (status & R1_OUT_OF_RANGE) + N_MSG(RSP, "[CARD_STATUS] Out of Range"); + if (status & R1_ADDRESS_ERROR) + N_MSG(RSP, "[CARD_STATUS] Address Error"); + if (status & R1_BLOCK_LEN_ERROR) + N_MSG(RSP, "[CARD_STATUS] Block Len Error"); + if (status & R1_ERASE_SEQ_ERROR) + N_MSG(RSP, "[CARD_STATUS] Erase Seq Error"); + if (status & R1_ERASE_PARAM) + N_MSG(RSP, "[CARD_STATUS] Erase Param"); + if (status & R1_WP_VIOLATION) + N_MSG(RSP, "[CARD_STATUS] WP Violation"); + if (status & R1_CARD_IS_LOCKED) + N_MSG(RSP, "[CARD_STATUS] Card is Locked"); + if (status & R1_LOCK_UNLOCK_FAILED) + N_MSG(RSP, "[CARD_STATUS] Lock/Unlock Failed"); + if (status & R1_COM_CRC_ERROR) + N_MSG(RSP, "[CARD_STATUS] Command CRC Error"); + if (status & R1_ILLEGAL_COMMAND) + N_MSG(RSP, "[CARD_STATUS] Illegal Command"); + if (status & R1_CARD_ECC_FAILED) + N_MSG(RSP, "[CARD_STATUS] Card ECC Failed"); + if (status & R1_CC_ERROR) + N_MSG(RSP, "[CARD_STATUS] CC Error"); + if (status & R1_ERROR) + N_MSG(RSP, "[CARD_STATUS] Error"); + if (status & R1_UNDERRUN) + N_MSG(RSP, "[CARD_STATUS] Underrun"); + if (status & R1_OVERRUN) + N_MSG(RSP, "[CARD_STATUS] Overrun"); + if (status & R1_CID_CSD_OVERWRITE) + N_MSG(RSP, "[CARD_STATUS] CID/CSD Overwrite"); + if (status & R1_WP_ERASE_SKIP) + N_MSG(RSP, "[CARD_STATUS] WP Eraser Skip"); + if (status & R1_CARD_ECC_DISABLED) + N_MSG(RSP, "[CARD_STATUS] Card ECC Disabled"); + if (status & R1_ERASE_RESET) + N_MSG(RSP, "[CARD_STATUS] Erase Reset"); + if (status & R1_READY_FOR_DATA) + N_MSG(RSP, "[CARD_STATUS] Ready for Data"); + if (status & R1_SWITCH_ERROR) + N_MSG(RSP, "[CARD_STATUS] Switch error"); + if (status & R1_APP_CMD) + N_MSG(RSP, "[CARD_STATUS] App Command"); + + N_MSG(RSP, "[CARD_STATUS] '%s' State", state[R1_CURRENT_STATE(status)]); } static void msdc_dump_ocr_reg(struct msdc_host *host, u32 resp) { - if (resp & (1 << 7)) - N_MSG(RSP, "[OCR] Low Voltage Range"); - if (resp & (1 << 15)) - N_MSG(RSP, "[OCR] 2.7-2.8 volt"); - if (resp & (1 << 16)) - N_MSG(RSP, "[OCR] 2.8-2.9 volt"); - if (resp & (1 << 17)) - N_MSG(RSP, "[OCR] 2.9-3.0 volt"); - if (resp & (1 << 18)) - N_MSG(RSP, "[OCR] 3.0-3.1 volt"); - if (resp & (1 << 19)) - N_MSG(RSP, "[OCR] 3.1-3.2 volt"); - if (resp & (1 << 20)) - N_MSG(RSP, "[OCR] 3.2-3.3 volt"); - if (resp & (1 << 21)) - N_MSG(RSP, "[OCR] 3.3-3.4 volt"); - if (resp & (1 << 22)) - N_MSG(RSP, "[OCR] 3.4-3.5 volt"); - if (resp & (1 << 23)) - N_MSG(RSP, "[OCR] 3.5-3.6 volt"); - if (resp & (1 << 24)) - N_MSG(RSP, "[OCR] Switching to 1.8V Accepted (S18A)"); - if (resp & (1 << 30)) - N_MSG(RSP, "[OCR] Card Capacity Status (CCS)"); - if (resp & (1 << 31)) - N_MSG(RSP, "[OCR] Card Power Up Status (Idle)"); - else - N_MSG(RSP, "[OCR] Card Power Up Status (Busy)"); + if (resp & (1 << 7)) + N_MSG(RSP, "[OCR] Low Voltage Range"); + if (resp & (1 << 15)) + N_MSG(RSP, "[OCR] 2.7-2.8 volt"); + if (resp & (1 << 16)) + N_MSG(RSP, "[OCR] 2.8-2.9 volt"); + if (resp & (1 << 17)) + N_MSG(RSP, "[OCR] 2.9-3.0 volt"); + if (resp & (1 << 18)) + N_MSG(RSP, "[OCR] 3.0-3.1 volt"); + if (resp & (1 << 19)) + N_MSG(RSP, "[OCR] 3.1-3.2 volt"); + if (resp & (1 << 20)) + N_MSG(RSP, "[OCR] 3.2-3.3 volt"); + if (resp & (1 << 21)) + N_MSG(RSP, "[OCR] 3.3-3.4 volt"); + if (resp & (1 << 22)) + N_MSG(RSP, "[OCR] 3.4-3.5 volt"); + if (resp & (1 << 23)) + N_MSG(RSP, "[OCR] 3.5-3.6 volt"); + if (resp & (1 << 24)) + N_MSG(RSP, "[OCR] Switching to 1.8V Accepted (S18A)"); + if (resp & (1 << 30)) + N_MSG(RSP, "[OCR] Card Capacity Status (CCS)"); + if (resp & (1 << 31)) + N_MSG(RSP, "[OCR] Card Power Up Status (Idle)"); + else + N_MSG(RSP, "[OCR] Card Power Up Status (Busy)"); } static void msdc_dump_rca_resp(struct msdc_host *host, u32 resp) { - u32 status = (((resp >> 15) & 0x1) << 23) | - (((resp >> 14) & 0x1) << 22) | - (((resp >> 13) & 0x1) << 19) | - (resp & 0x1fff); - - N_MSG(RSP, "[RCA] 0x%.4x", resp >> 16); - msdc_dump_card_status(host, status); + u32 status = (((resp >> 15) & 0x1) << 23) | + (((resp >> 14) & 0x1) << 22) | + (((resp >> 13) & 0x1) << 19) | + (resp & 0x1fff); + + N_MSG(RSP, "[RCA] 0x%.4x", resp >> 16); + msdc_dump_card_status(host, status); } static void msdc_dump_io_resp(struct msdc_host *host, u32 resp) { - u32 flags = (resp >> 8) & 0xFF; - char *state[] = {"DIS", "CMD", "TRN", "RFU"}; - - if (flags & (1 << 7)) - N_MSG(RSP, "[IO] COM_CRC_ERR"); - if (flags & (1 << 6)) - N_MSG(RSP, "[IO] Illgal command"); - if (flags & (1 << 3)) - N_MSG(RSP, "[IO] Error"); - if (flags & (1 << 2)) - N_MSG(RSP, "[IO] RFU"); - if (flags & (1 << 1)) - N_MSG(RSP, "[IO] Function number error"); - if (flags & (1 << 0)) - N_MSG(RSP, "[IO] Out of range"); + u32 flags = (resp >> 8) & 0xFF; +#if 0 + char *state[] = {"DIS", "CMD", "TRN", "RFU"}; +#endif + if (flags & (1 << 7)) + N_MSG(RSP, "[IO] COM_CRC_ERR"); + if (flags & (1 << 6)) + N_MSG(RSP, "[IO] Illgal command"); + if (flags & (1 << 3)) + N_MSG(RSP, "[IO] Error"); + if (flags & (1 << 2)) + N_MSG(RSP, "[IO] RFU"); + if (flags & (1 << 1)) + N_MSG(RSP, "[IO] Function number error"); + if (flags & (1 << 0)) + N_MSG(RSP, "[IO] Out of range"); - N_MSG(RSP, "[IO] State: %s, Data:0x%x", state[(resp >> 12) & 0x3], resp & 0xFF); + N_MSG(RSP, "[IO] State: %s, Data:0x%x", state[(resp >> 12) & 0x3], resp & 0xFF); } #endif static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks) { - u32 base = host->base; - u32 timeout, clk_ns; + void __iomem *base = host->base; + u32 timeout, clk_ns; - host->timeout_ns = ns; - host->timeout_clks = clks; + host->timeout_ns = ns; + host->timeout_clks = clks; - clk_ns = 1000000000UL / host->sclk; - timeout = ns / clk_ns + clks; - timeout = timeout >> 16; /* in 65536 sclk cycle unit */ - timeout = timeout > 1 ? timeout - 1 : 0; - timeout = timeout > 255 ? 255 : timeout; + clk_ns = 1000000000UL / host->sclk; + timeout = ns / clk_ns + clks; + timeout = timeout >> 16; /* in 65536 sclk cycle unit */ + timeout = timeout > 1 ? timeout - 1 : 0; + timeout = timeout > 255 ? 255 : timeout; - sdr_set_field(SDC_CFG, SDC_CFG_DTOC, timeout); + sdr_set_field(SDC_CFG, SDC_CFG_DTOC, timeout); - N_MSG(OPS, "Set read data timeout: %dns %dclks -> %d x 65536 cycles", - ns, clks, timeout + 1); + N_MSG(OPS, "Set read data timeout: %dns %dclks -> %d x 65536 cycles", + ns, clks, timeout + 1); } -/* msdc_eirq_sdio() will be called when EIRQ(for WIFI) */ -static void msdc_eirq_sdio(void *data) -{ - struct msdc_host *host = (struct msdc_host *)data; - - N_MSG(INT, "SDIO EINT"); - - mmc_signal_sdio_irq(host->mmc); -} - -/* msdc_eirq_cd will not be used! We not using EINT for card detection. */ -static void msdc_eirq_cd(void *data) -{ - struct msdc_host *host = (struct msdc_host *)data; - - N_MSG(INT, "CD EINT"); - -#if 0 - tasklet_hi_schedule(&host->card_tasklet); -#else - schedule_delayed_work(&host->card_delaywork, HZ); -#endif -} - -#if 0 -static void msdc_tasklet_card(unsigned long arg) -{ - struct msdc_host *host = (struct msdc_host *)arg; -#else static void msdc_tasklet_card(struct work_struct *work) { - struct msdc_host *host = (struct msdc_host *)container_of(work, - struct msdc_host, card_delaywork.work); -#endif - struct msdc_hw *hw = host->hw; - u32 base = host->base; - u32 inserted; - u32 status = 0; + struct msdc_host *host = (struct msdc_host *)container_of(work, + struct msdc_host, card_delaywork.work); + void __iomem *base = host->base; + u32 inserted; + u32 status = 0; //u32 change = 0; - spin_lock(&host->lock); + spin_lock(&host->lock); - if (hw->get_cd_status) { // NULL - inserted = hw->get_cd_status(); - } else { - status = sdr_read32(MSDC_PS); - if (cd_active_low) + status = sdr_read32(MSDC_PS); + if (cd_active_low) inserted = (status & MSDC_PS_CDSTS) ? 0 : 1; else - inserted = (status & MSDC_PS_CDSTS) ? 1 : 0; - } - if (host->mmc->caps & MMC_CAP_NEEDS_POLL) - inserted = 1; + inserted = (status & MSDC_PS_CDSTS) ? 1 : 0; #if 0 - change = host->card_inserted ^ inserted; - host->card_inserted = inserted; - - if (change && !host->suspend) { - if (inserted) { - host->mmc->f_max = HOST_MAX_MCLK; // work around - } - mmc_detect_change(host->mmc, msecs_to_jiffies(20)); - } + change = host->card_inserted ^ inserted; + host->card_inserted = inserted; + + if (change && !host->suspend) { + if (inserted) + host->mmc->f_max = HOST_MAX_MCLK; // work around + mmc_detect_change(host->mmc, msecs_to_jiffies(20)); + } #else /* Make sure: handle the last interrupt */ - host->card_inserted = inserted; - - if (!host->suspend) { - host->mmc->f_max = HOST_MAX_MCLK; - mmc_detect_change(host->mmc, msecs_to_jiffies(20)); - } - - IRQ_MSG("card found<%s>", inserted ? "inserted" : "removed"); + host->card_inserted = inserted; + + if (!host->suspend) { + host->mmc->f_max = HOST_MAX_MCLK; + mmc_detect_change(host->mmc, msecs_to_jiffies(20)); + } + + IRQ_MSG("card found<%s>", inserted ? "inserted" : "removed"); #endif - spin_unlock(&host->lock); + spin_unlock(&host->lock); } #if 0 /* --- by chhung */ /* For E2 only */ static u8 clk_src_bit[4] = { - 0, 3, 5, 7 + 0, 3, 5, 7 }; -static void msdc_select_clksrc(struct msdc_host* host, unsigned char clksrc) +static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc) { - u32 val; - u32 base = host->base; - - BUG_ON(clksrc > 3); - INIT_MSG("set clock source to <%d>", clksrc); + u32 val; + void __iomem *base = host->base; - val = sdr_read32(MSDC_CLKSRC_REG); - if (sdr_read32(MSDC_ECO_VER) >= 4) { - val &= ~(0x3 << clk_src_bit[host->id]); - val |= clksrc << clk_src_bit[host->id]; - } else { - val &= ~0x3; val |= clksrc; - } - sdr_write32(MSDC_CLKSRC_REG, val); - - host->hclk = hclks[clksrc]; - host->hw->clk_src = clksrc; + BUG_ON(clksrc > 3); + INIT_MSG("set clock source to <%d>", clksrc); + + val = sdr_read32(MSDC_CLKSRC_REG); + if (sdr_read32(MSDC_ECO_VER) >= 4) { + val &= ~(0x3 << clk_src_bit[host->id]); + val |= clksrc << clk_src_bit[host->id]; + } else { + val &= ~0x3; val |= clksrc; + } + sdr_write32(MSDC_CLKSRC_REG, val); + + host->hclk = hclks[clksrc]; + host->hw->clk_src = clksrc; } #endif /* end of --- */ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz) { - //struct msdc_hw *hw = host->hw; - u32 base = host->base; - u32 mode; - u32 flags; - u32 div; - u32 sclk; - u32 hclk = host->hclk; - //u8 clksrc = hw->clk_src; + //struct msdc_hw *hw = host->hw; + void __iomem *base = host->base; + u32 mode; + u32 flags; + u32 div; + u32 sclk; + u32 hclk = host->hclk; + //u8 clksrc = hw->clk_src; - if (!hz) { // set mmc system clock to 0 ? - //ERR_MSG("set mclk to 0!!!"); - msdc_reset(); - return; - } + if (!hz) { // set mmc system clock to 0 ? + //ERR_MSG("set mclk to 0!!!"); + msdc_reset_hw(host); + return; + } - msdc_irq_save(flags); - -#if defined (CONFIG_MT7621_FPGA) || defined (CONFIG_MT7628_FPGA) - mode = 0x0; /* use divisor */ - if (hz >= (hclk >> 1)) { - div = 0; /* mean div = 1/2 */ - sclk = hclk >> 1; /* sclk = clk / 2 */ - } else { - div = (hclk + ((hz << 2) - 1)) / (hz << 2); - sclk = (hclk >> 2) / div; - } -#else - if (ddr) { - mode = 0x2; /* ddr mode and use divisor */ - if (hz >= (hclk >> 2)) { - div = 1; /* mean div = 1/4 */ - sclk = hclk >> 2; /* sclk = clk / 4 */ - } else { - div = (hclk + ((hz << 2) - 1)) / (hz << 2); - sclk = (hclk >> 2) / div; - } - } else if (hz >= hclk) { /* bug fix */ - mode = 0x1; /* no divisor and divisor is ignored */ - div = 0; - sclk = hclk; - } else { - mode = 0x0; /* use divisor */ - if (hz >= (hclk >> 1)) { - div = 0; /* mean div = 1/2 */ - sclk = hclk >> 1; /* sclk = clk / 2 */ - } else { - div = (hclk + ((hz << 2) - 1)) / (hz << 2); - sclk = (hclk >> 2) / div; - } - } -#endif - /* set clock mode and divisor */ - sdr_set_field(MSDC_CFG, MSDC_CFG_CKMOD, mode); - sdr_set_field(MSDC_CFG, MSDC_CFG_CKDIV, div); - - /* wait clock stable */ - while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)); + msdc_irq_save(flags); - host->sclk = sclk; - host->mclk = hz; - msdc_set_timeout(host, host->timeout_ns, host->timeout_clks); // need? - - INIT_MSG("================"); - INIT_MSG("!!! Set<%dKHz> Source<%dKHz> -> sclk<%dKHz>", hz/1000, hclk/1000, sclk/1000); - INIT_MSG("================"); + if (ddr) { + mode = 0x2; /* ddr mode and use divisor */ + if (hz >= (hclk >> 2)) { + div = 1; /* mean div = 1/4 */ + sclk = hclk >> 2; /* sclk = clk / 4 */ + } else { + div = (hclk + ((hz << 2) - 1)) / (hz << 2); + sclk = (hclk >> 2) / div; + } + } else if (hz >= hclk) { /* bug fix */ + mode = 0x1; /* no divisor and divisor is ignored */ + div = 0; + sclk = hclk; + } else { + mode = 0x0; /* use divisor */ + if (hz >= (hclk >> 1)) { + div = 0; /* mean div = 1/2 */ + sclk = hclk >> 1; /* sclk = clk / 2 */ + } else { + div = (hclk + ((hz << 2) - 1)) / (hz << 2); + sclk = (hclk >> 2) / div; + } + } - msdc_irq_restore(flags); + /* set clock mode and divisor */ + sdr_set_field(MSDC_CFG, MSDC_CFG_CKMOD, mode); + sdr_set_field(MSDC_CFG, MSDC_CFG_CKDIV, div); + + /* wait clock stable */ + while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)) + cpu_relax(); + + host->sclk = sclk; + host->mclk = hz; + msdc_set_timeout(host, host->timeout_ns, host->timeout_clks); // need? + + INIT_MSG("================"); + INIT_MSG("!!! Set<%dKHz> Source<%dKHz> -> sclk<%dKHz>", hz / 1000, hclk / 1000, sclk / 1000); + INIT_MSG("================"); + + msdc_irq_restore(flags); } /* Fix me. when need to abort */ static void msdc_abort_data(struct msdc_host *host) { - u32 base = host->base; - struct mmc_command *stop = host->mrq->stop; + void __iomem *base = host->base; + struct mmc_command *stop = host->mrq->stop; - ERR_MSG("Need to Abort. dma<%d>", host->dma_xfer); - - msdc_reset(); - msdc_clr_fifo(); - msdc_clr_int(); + ERR_MSG("Need to Abort."); - // need to check FIFO count 0 ? - - if (stop) { /* try to stop, but may not success */ - ERR_MSG("stop when abort CMD<%d>", stop->opcode); - (void)msdc_do_command(host, stop, 0, CMD_TIMEOUT); - } - - //if (host->mclk >= 25000000) { - // msdc_set_mclk(host, 0, host->mclk >> 1); - //} + msdc_reset_hw(host); + msdc_clr_fifo(); + msdc_clr_int(); + + // need to check FIFO count 0 ? + + if (stop) { /* try to stop, but may not success */ + ERR_MSG("stop when abort CMD<%d>", stop->opcode); + (void)msdc_do_command(host, stop, 0, CMD_TIMEOUT); + } + + //if (host->mclk >= 25000000) { + // msdc_set_mclk(host, 0, host->mclk >> 1); + //} } #if 0 /* --- by chhung */ static void msdc_pin_config(struct msdc_host *host, int mode) { - struct msdc_hw *hw = host->hw; - u32 base = host->base; - int pull = (mode == MSDC_PIN_PULL_UP) ? GPIO_PULL_UP : GPIO_PULL_DOWN; + struct msdc_hw *hw = host->hw; + void __iomem *base = host->base; + int pull = (mode == MSDC_PIN_PULL_UP) ? GPIO_PULL_UP : GPIO_PULL_DOWN; - /* Config WP pin */ - if (hw->flags & MSDC_WP_PIN_EN) { - if (hw->config_gpio_pin) /* NULL */ - hw->config_gpio_pin(MSDC_WP_PIN, pull); - } + /* Config WP pin */ + if (hw->flags & MSDC_WP_PIN_EN) { + if (hw->config_gpio_pin) /* NULL */ + hw->config_gpio_pin(MSDC_WP_PIN, pull); + } - switch (mode) { - case MSDC_PIN_PULL_UP: - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 1); /* Check & FIXME */ - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 1); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 1); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); - break; - case MSDC_PIN_PULL_DOWN: - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 1); /* Check & FIXME */ - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 1); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 1); - break; - case MSDC_PIN_PULL_NONE: - default: - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); - break; - } - - N_MSG(CFG, "Pins mode(%d), down(%d), up(%d)", - mode, MSDC_PIN_PULL_DOWN, MSDC_PIN_PULL_UP); + switch (mode) { + case MSDC_PIN_PULL_UP: + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 1); /* Check & FIXME */ + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 1); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 1); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); + break; + case MSDC_PIN_PULL_DOWN: + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 1); /* Check & FIXME */ + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 1); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 1); + break; + case MSDC_PIN_PULL_NONE: + default: + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); + break; + } + + N_MSG(CFG, "Pins mode(%d), down(%d), up(%d)", + mode, MSDC_PIN_PULL_DOWN, MSDC_PIN_PULL_UP); } void msdc_pin_reset(struct msdc_host *host, int mode) { - struct msdc_hw *hw = (struct msdc_hw *)host->hw; - u32 base = host->base; - int pull = (mode == MSDC_PIN_PULL_UP) ? GPIO_PULL_UP : GPIO_PULL_DOWN; + struct msdc_hw *hw = (struct msdc_hw *)host->hw; + void __iomem *base = host->base; + int pull = (mode == MSDC_PIN_PULL_UP) ? GPIO_PULL_UP : GPIO_PULL_DOWN; - /* Config reset pin */ - if (hw->flags & MSDC_RST_PIN_EN) { - if (hw->config_gpio_pin) /* NULL */ - hw->config_gpio_pin(MSDC_RST_PIN, pull); + /* Config reset pin */ + if (hw->flags & MSDC_RST_PIN_EN) { + if (hw->config_gpio_pin) /* NULL */ + hw->config_gpio_pin(MSDC_RST_PIN, pull); - if (mode == MSDC_PIN_PULL_UP) { - sdr_clr_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); - } else { - sdr_set_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); - } - } + if (mode == MSDC_PIN_PULL_UP) + sdr_clr_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); + else + sdr_set_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); + } } static void msdc_core_power(struct msdc_host *host, int on) { - N_MSG(CFG, "Turn %s %s power (copower: %d -> %d)", - on ? "on" : "off", "core", host->core_power, on); + N_MSG(CFG, "Turn %s %s power (copower: %d -> %d)", + on ? "on" : "off", "core", host->core_power, on); - if (on && host->core_power == 0) { - msdc_vcore_on(host); - host->core_power = 1; - msleep(1); - } else if (!on && host->core_power == 1) { - msdc_vcore_off(host); - host->core_power = 0; - msleep(1); - } + if (on && host->core_power == 0) { + msdc_vcore_on(host); + host->core_power = 1; + msleep(1); + } else if (!on && host->core_power == 1) { + msdc_vcore_off(host); + host->core_power = 0; + msleep(1); + } } static void msdc_host_power(struct msdc_host *host, int on) { - N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "host"); + N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "host"); - if (on) { - //msdc_core_power(host, 1); // need do card detection. - msdc_pin_reset(host, MSDC_PIN_PULL_UP); - } else { - msdc_pin_reset(host, MSDC_PIN_PULL_DOWN); - //msdc_core_power(host, 0); - } + if (on) { + //msdc_core_power(host, 1); // need do card detection. + msdc_pin_reset(host, MSDC_PIN_PULL_UP); + } else { + msdc_pin_reset(host, MSDC_PIN_PULL_DOWN); + //msdc_core_power(host, 0); + } } static void msdc_card_power(struct msdc_host *host, int on) { - N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "card"); + N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "card"); - if (on) { - msdc_pin_config(host, MSDC_PIN_PULL_UP); - if (host->hw->ext_power_on) { - host->hw->ext_power_on(); - } else { - //msdc_vdd_on(host); // need todo card detection. - } - msleep(1); - } else { - if (host->hw->ext_power_off) { - host->hw->ext_power_off(); - } else { - //msdc_vdd_off(host); - } - msdc_pin_config(host, MSDC_PIN_PULL_DOWN); - msleep(1); - } + if (on) { + msdc_pin_config(host, MSDC_PIN_PULL_UP); + //msdc_vdd_on(host); // need todo card detection. + msleep(1); + } else { + //msdc_vdd_off(host); + msdc_pin_config(host, MSDC_PIN_PULL_DOWN); + msleep(1); + } } static void msdc_set_power_mode(struct msdc_host *host, u8 mode) { - N_MSG(CFG, "Set power mode(%d)", mode); + N_MSG(CFG, "Set power mode(%d)", mode); - if (host->power_mode == MMC_POWER_OFF && mode != MMC_POWER_OFF) { - msdc_host_power(host, 1); - msdc_card_power(host, 1); - } else if (host->power_mode != MMC_POWER_OFF && mode == MMC_POWER_OFF) { - msdc_card_power(host, 0); - msdc_host_power(host, 0); - } - host->power_mode = mode; + if (host->power_mode == MMC_POWER_OFF && mode != MMC_POWER_OFF) { + msdc_host_power(host, 1); + msdc_card_power(host, 1); + } else if (host->power_mode != MMC_POWER_OFF && mode == MMC_POWER_OFF) { + msdc_card_power(host, 0); + msdc_host_power(host, 0); + } + host->power_mode = mode; } #endif /* end of --- */ #ifdef CONFIG_PM /* - register as callback function of WIFI(combo_sdio_register_pm) . - can called by msdc_drv_suspend/resume too. + register as callback function of WIFI(combo_sdio_register_pm) . + can called by msdc_drv_suspend/resume too. */ static void msdc_pm(pm_message_t state, void *data) { - struct msdc_host *host = (struct msdc_host *)data; - int evt = state.event; + struct msdc_host *host = (struct msdc_host *)data; + int evt = state.event; - if (evt == PM_EVENT_USER_RESUME || evt == PM_EVENT_USER_SUSPEND) { - INIT_MSG("USR_%s: suspend<%d> power<%d>", - evt == PM_EVENT_USER_RESUME ? "EVENT_USER_RESUME" : "EVENT_USER_SUSPEND", - host->suspend, host->power_mode); - } + if (evt == PM_EVENT_USER_RESUME || evt == PM_EVENT_USER_SUSPEND) { + INIT_MSG("USR_%s: suspend<%d> power<%d>", + evt == PM_EVENT_USER_RESUME ? "EVENT_USER_RESUME" : "EVENT_USER_SUSPEND", + host->suspend, host->power_mode); + } - if (evt == PM_EVENT_SUSPEND || evt == PM_EVENT_USER_SUSPEND) { - if (host->suspend) /* already suspend */ /* default 0*/ - return; + if (evt == PM_EVENT_SUSPEND || evt == PM_EVENT_USER_SUSPEND) { + if (host->suspend) /* already suspend */ /* default 0*/ + return; - /* for memory card. already power off by mmc */ - if (evt == PM_EVENT_SUSPEND && host->power_mode == MMC_POWER_OFF) - return; + /* for memory card. already power off by mmc */ + if (evt == PM_EVENT_SUSPEND && host->power_mode == MMC_POWER_OFF) + return; - host->suspend = 1; - host->pm_state = state; /* default PMSG_RESUME */ - - INIT_MSG("%s Suspend", evt == PM_EVENT_SUSPEND ? "PM" : "USR"); - if(host->hw->flags & MSDC_SYS_SUSPEND) /* set for card */ - (void)mmc_suspend_host(host->mmc); - else { - // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* just for double confirm */ /* --- by chhung */ - mmc_remove_host(host->mmc); - } - } else if (evt == PM_EVENT_RESUME || evt == PM_EVENT_USER_RESUME) { - if (!host->suspend){ - //ERR_MSG("warning: already resume"); - return; - } + host->suspend = 1; + host->pm_state = state; /* default PMSG_RESUME */ - /* No PM resume when USR suspend */ - if (evt == PM_EVENT_RESUME && host->pm_state.event == PM_EVENT_USER_SUSPEND) { - ERR_MSG("PM Resume when in USR Suspend"); /* won't happen. */ - return; - } - - host->suspend = 0; - host->pm_state = state; - - INIT_MSG("%s Resume", evt == PM_EVENT_RESUME ? "PM" : "USR"); - if(host->hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ - (void)mmc_resume_host(host->mmc); - } - else { - // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* --- by chhung */ - mmc_add_host(host->mmc); - } - } + } else if (evt == PM_EVENT_RESUME || evt == PM_EVENT_USER_RESUME) { + if (!host->suspend) { + //ERR_MSG("warning: already resume"); + return; + } + + /* No PM resume when USR suspend */ + if (evt == PM_EVENT_RESUME && host->pm_state.event == PM_EVENT_USER_SUSPEND) { + ERR_MSG("PM Resume when in USR Suspend"); /* won't happen. */ + return; + } + + host->suspend = 0; + host->pm_state = state; + + } } #endif /*--------------------------------------------------------------------------*/ /* mmc_host_ops members */ /*--------------------------------------------------------------------------*/ -static unsigned int msdc_command_start(struct msdc_host *host, - struct mmc_command *cmd, - int tune, /* not used */ - unsigned long timeout) +static unsigned int msdc_command_start(struct msdc_host *host, + struct mmc_command *cmd, + int tune, /* not used */ + unsigned long timeout) { - u32 base = host->base; - u32 opcode = cmd->opcode; - u32 rawcmd; - u32 wints = MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | - MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | - MSDC_INT_ACMD19_DONE; - - u32 resp; - unsigned long tmo; + void __iomem *base = host->base; + u32 opcode = cmd->opcode; + u32 rawcmd; + u32 wints = MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | + MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | + MSDC_INT_ACMD19_DONE; - /* Protocol layer does not provide response type, but our hardware needs - * to know exact type, not just size! - */ - if (opcode == MMC_SEND_OP_COND || opcode == SD_APP_OP_COND) - resp = RESP_R3; - else if (opcode == MMC_SET_RELATIVE_ADDR || opcode == SD_SEND_RELATIVE_ADDR) - resp = (mmc_cmd_type(cmd) == MMC_CMD_BCR) ? RESP_R6 : RESP_R1; - else if (opcode == MMC_FAST_IO) - resp = RESP_R4; - else if (opcode == MMC_GO_IRQ_STATE) - resp = RESP_R5; - else if (opcode == MMC_SELECT_CARD) - resp = (cmd->arg != 0) ? RESP_R1B : RESP_NONE; - else if (opcode == SD_IO_RW_DIRECT || opcode == SD_IO_RW_EXTENDED) - resp = RESP_R1; /* SDIO workaround. */ - else if (opcode == SD_SEND_IF_COND && (mmc_cmd_type(cmd) == MMC_CMD_BCR)) - resp = RESP_R1; - else { - switch (mmc_resp_type(cmd)) { - case MMC_RSP_R1: - resp = RESP_R1; - break; - case MMC_RSP_R1B: - resp = RESP_R1B; - break; - case MMC_RSP_R2: - resp = RESP_R2; - break; - case MMC_RSP_R3: - resp = RESP_R3; - break; - case MMC_RSP_NONE: - default: - resp = RESP_NONE; - break; - } - } + u32 resp; + unsigned long tmo; - cmd->error = 0; - /* rawcmd : - * vol_swt << 30 | auto_cmd << 28 | blklen << 16 | go_irq << 15 | - * stop << 14 | rw << 13 | dtype << 11 | rsptyp << 7 | brk << 6 | opcode - */ - rawcmd = opcode | msdc_rsp[resp] << 7 | host->blksz << 16; - - if (opcode == MMC_READ_MULTIPLE_BLOCK) { - rawcmd |= (2 << 11); - } else if (opcode == MMC_READ_SINGLE_BLOCK) { - rawcmd |= (1 << 11); - } else if (opcode == MMC_WRITE_MULTIPLE_BLOCK) { - rawcmd |= ((2 << 11) | (1 << 13)); - } else if (opcode == MMC_WRITE_BLOCK) { - rawcmd |= ((1 << 11) | (1 << 13)); - } else if (opcode == SD_IO_RW_EXTENDED) { - if (cmd->data->flags & MMC_DATA_WRITE) - rawcmd |= (1 << 13); - if (cmd->data->blocks > 1) - rawcmd |= (2 << 11); - else - rawcmd |= (1 << 11); - } else if (opcode == SD_IO_RW_DIRECT && cmd->flags == (unsigned int)-1) { - rawcmd |= (1 << 14); - } else if ((opcode == SD_APP_SEND_SCR) || - (opcode == SD_APP_SEND_NUM_WR_BLKS) || - (opcode == SD_SWITCH && (mmc_cmd_type(cmd) == MMC_CMD_ADTC)) || - (opcode == SD_APP_SD_STATUS && (mmc_cmd_type(cmd) == MMC_CMD_ADTC)) || - (opcode == MMC_SEND_EXT_CSD && (mmc_cmd_type(cmd) == MMC_CMD_ADTC))) { - rawcmd |= (1 << 11); - } else if (opcode == MMC_STOP_TRANSMISSION) { - rawcmd |= (1 << 14); - rawcmd &= ~(0x0FFF << 16); - } + /* Protocol layer does not provide response type, but our hardware needs + * to know exact type, not just size! + */ + if (opcode == MMC_SEND_OP_COND || opcode == SD_APP_OP_COND) { + resp = RESP_R3; + } else if (opcode == MMC_SET_RELATIVE_ADDR) { + resp = (mmc_cmd_type(cmd) == MMC_CMD_BCR) ? RESP_R6 : RESP_R1; + } else if (opcode == MMC_FAST_IO) { + resp = RESP_R4; + } else if (opcode == MMC_GO_IRQ_STATE) { + resp = RESP_R5; + } else if (opcode == MMC_SELECT_CARD) { + resp = (cmd->arg != 0) ? RESP_R1B : RESP_NONE; + } else if (opcode == SD_IO_RW_DIRECT || opcode == SD_IO_RW_EXTENDED) { + resp = RESP_R1; /* SDIO workaround. */ + } else if (opcode == SD_SEND_IF_COND && (mmc_cmd_type(cmd) == MMC_CMD_BCR)) { + resp = RESP_R1; + } else { + switch (mmc_resp_type(cmd)) { + case MMC_RSP_R1: + resp = RESP_R1; + break; + case MMC_RSP_R1B: + resp = RESP_R1B; + break; + case MMC_RSP_R2: + resp = RESP_R2; + break; + case MMC_RSP_R3: + resp = RESP_R3; + break; + case MMC_RSP_NONE: + default: + resp = RESP_NONE; + break; + } + } - N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode , rawcmd, cmd->arg); + cmd->error = 0; + /* rawcmd : + * vol_swt << 30 | auto_cmd << 28 | blklen << 16 | go_irq << 15 | + * stop << 14 | rw << 13 | dtype << 11 | rsptyp << 7 | brk << 6 | opcode + */ + rawcmd = opcode | msdc_rsp[resp] << 7 | host->blksz << 16; - tmo = jiffies + timeout; + if (opcode == MMC_READ_MULTIPLE_BLOCK) { + rawcmd |= (2 << 11); + } else if (opcode == MMC_READ_SINGLE_BLOCK) { + rawcmd |= (1 << 11); + } else if (opcode == MMC_WRITE_MULTIPLE_BLOCK) { + rawcmd |= ((2 << 11) | (1 << 13)); + } else if (opcode == MMC_WRITE_BLOCK) { + rawcmd |= ((1 << 11) | (1 << 13)); + } else if (opcode == SD_IO_RW_EXTENDED) { + if (cmd->data->flags & MMC_DATA_WRITE) + rawcmd |= (1 << 13); + if (cmd->data->blocks > 1) + rawcmd |= (2 << 11); + else + rawcmd |= (1 << 11); + } else if (opcode == SD_IO_RW_DIRECT && cmd->flags == (unsigned int)-1) { + rawcmd |= (1 << 14); + } else if ((opcode == SD_APP_SEND_SCR) || + (opcode == SD_APP_SEND_NUM_WR_BLKS) || + (opcode == SD_SWITCH && (mmc_cmd_type(cmd) == MMC_CMD_ADTC)) || + (opcode == SD_APP_SD_STATUS && (mmc_cmd_type(cmd) == MMC_CMD_ADTC)) || + (opcode == MMC_SEND_EXT_CSD && (mmc_cmd_type(cmd) == MMC_CMD_ADTC))) { + rawcmd |= (1 << 11); + } else if (opcode == MMC_STOP_TRANSMISSION) { + rawcmd |= (1 << 14); + rawcmd &= ~(0x0FFF << 16); + } - if (opcode == MMC_SEND_STATUS) { - for (;;) { - if (!sdc_is_cmd_busy()) - break; - - if (time_after(jiffies, tmo)) { - ERR_MSG("XXX cmd_busy timeout: before CMD<%d>", opcode); - cmd->error = (unsigned int)-ETIMEDOUT; - msdc_reset(); - goto end; - } - } - }else { - for (;;) { - if (!sdc_is_busy()) - break; - if (time_after(jiffies, tmo)) { - ERR_MSG("XXX sdc_busy timeout: before CMD<%d>", opcode); - cmd->error = (unsigned int)-ETIMEDOUT; - msdc_reset(); - goto end; - } - } - } - - //BUG_ON(in_interrupt()); - host->cmd = cmd; - host->cmd_rsp = resp; - - init_completion(&host->cmd_done); + N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode, rawcmd, cmd->arg); - sdr_set_bits(MSDC_INTEN, wints); - sdc_send_cmd(rawcmd, cmd->arg); - -end: - return cmd->error; + tmo = jiffies + timeout; + + if (opcode == MMC_SEND_STATUS) { + for (;;) { + if (!sdc_is_cmd_busy()) + break; + + if (time_after(jiffies, tmo)) { + ERR_MSG("XXX cmd_busy timeout: before CMD<%d>", opcode); + cmd->error = -ETIMEDOUT; + msdc_reset_hw(host); + goto end; + } + } + } else { + for (;;) { + if (!sdc_is_busy()) + break; + if (time_after(jiffies, tmo)) { + ERR_MSG("XXX sdc_busy timeout: before CMD<%d>", opcode); + cmd->error = -ETIMEDOUT; + msdc_reset_hw(host); + goto end; + } + } + } + + //BUG_ON(in_interrupt()); + host->cmd = cmd; + host->cmd_rsp = resp; + + init_completion(&host->cmd_done); + + sdr_set_bits(MSDC_INTEN, wints); + sdc_send_cmd(rawcmd, cmd->arg); + +end: + return cmd->error; } -static unsigned int msdc_command_resp(struct msdc_host *host, - struct mmc_command *cmd, - int tune, - unsigned long timeout) +static unsigned int msdc_command_resp(struct msdc_host *host, + struct mmc_command *cmd, + int tune, + unsigned long timeout) + __must_hold(&host->lock) { - u32 base = host->base; - u32 opcode = cmd->opcode; - //u32 rawcmd; - u32 resp; - u32 wints = MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | - MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | - MSDC_INT_ACMD19_DONE; - - resp = host->cmd_rsp; + void __iomem *base = host->base; + u32 opcode = cmd->opcode; + //u32 rawcmd; + u32 resp; + u32 wints = MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | + MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | + MSDC_INT_ACMD19_DONE; - BUG_ON(in_interrupt()); - //init_completion(&host->cmd_done); - //sdr_set_bits(MSDC_INTEN, wints); - - spin_unlock(&host->lock); - if(!wait_for_completion_timeout(&host->cmd_done, 10*timeout)){ - ERR_MSG("XXX CMD<%d> wait_for_completion timeout ARG<0x%.8x>", opcode, cmd->arg); - cmd->error = (unsigned int)-ETIMEDOUT; - msdc_reset(); - } - spin_lock(&host->lock); + resp = host->cmd_rsp; - sdr_clr_bits(MSDC_INTEN, wints); - host->cmd = NULL; + BUG_ON(in_interrupt()); + //init_completion(&host->cmd_done); + //sdr_set_bits(MSDC_INTEN, wints); + + spin_unlock(&host->lock); + if (!wait_for_completion_timeout(&host->cmd_done, 10 * timeout)) { + ERR_MSG("XXX CMD<%d> wait_for_completion timeout ARG<0x%.8x>", opcode, cmd->arg); + cmd->error = -ETIMEDOUT; + msdc_reset_hw(host); + } + spin_lock(&host->lock); + + sdr_clr_bits(MSDC_INTEN, wints); + host->cmd = NULL; //end: #ifdef MT6575_SD_DEBUG - switch (resp) { - case RESP_NONE: - N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)", opcode, cmd->error, resp); - break; - case RESP_R2: - N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= %.8x %.8x %.8x %.8x", - opcode, cmd->error, resp, cmd->resp[0], cmd->resp[1], - cmd->resp[2], cmd->resp[3]); - break; - default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ - N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= 0x%.8x", - opcode, cmd->error, resp, cmd->resp[0]); - if (cmd->error == 0) { - switch (resp) { - case RESP_R1: - case RESP_R1B: - msdc_dump_card_status(host, cmd->resp[0]); - break; - case RESP_R3: - msdc_dump_ocr_reg(host, cmd->resp[0]); - break; - case RESP_R5: - msdc_dump_io_resp(host, cmd->resp[0]); - break; - case RESP_R6: - msdc_dump_rca_resp(host, cmd->resp[0]); - break; - } - } - break; - } + switch (resp) { + case RESP_NONE: + N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)", opcode, cmd->error, resp); + break; + case RESP_R2: + N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= %.8x %.8x %.8x %.8x", + opcode, cmd->error, resp, cmd->resp[0], cmd->resp[1], + cmd->resp[2], cmd->resp[3]); + break; + default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ + N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= 0x%.8x", + opcode, cmd->error, resp, cmd->resp[0]); + if (cmd->error == 0) { + switch (resp) { + case RESP_R1: + case RESP_R1B: + msdc_dump_card_status(host, cmd->resp[0]); + break; + case RESP_R3: + msdc_dump_ocr_reg(host, cmd->resp[0]); + break; + case RESP_R5: + msdc_dump_io_resp(host, cmd->resp[0]); + break; + case RESP_R6: + msdc_dump_rca_resp(host, cmd->resp[0]); + break; + } + } + break; + } #endif - /* do we need to save card's RCA when SD_SEND_RELATIVE_ADDR */ + /* do we need to save card's RCA when SD_SEND_RELATIVE_ADDR */ - if (!tune) { - return cmd->error; - } + if (!tune) + return cmd->error; - /* memory card CRC */ - if(host->hw->flags & MSDC_REMOVABLE && cmd->error == (unsigned int)(-EIO) ) { - if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ - msdc_abort_data(host); - } else { - /* do basic: reset*/ - msdc_reset(); - msdc_clr_fifo(); - msdc_clr_int(); - } - cmd->error = msdc_tune_cmdrsp(host,cmd); - } + /* memory card CRC */ + if (host->hw->flags & MSDC_REMOVABLE && cmd->error == -EIO) { + if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ + msdc_abort_data(host); + } else { + /* do basic: reset*/ + msdc_reset_hw(host); + msdc_clr_fifo(); + msdc_clr_int(); + } + cmd->error = msdc_tune_cmdrsp(host, cmd); + } - // check DAT0 - /* if (resp == RESP_R1B) { - while ((sdr_read32(MSDC_PS) & 0x10000) != 0x10000); - } */ - /* CMD12 Error Handle */ - - return cmd->error; -} + // check DAT0 + /* if (resp == RESP_R1B) { + while ((sdr_read32(MSDC_PS) & 0x10000) != 0x10000); + } */ + /* CMD12 Error Handle */ -static unsigned int msdc_do_command(struct msdc_host *host, - struct mmc_command *cmd, - int tune, - unsigned long timeout) -{ - if (msdc_command_start(host, cmd, tune, timeout)) - goto end; - - if (msdc_command_resp(host, cmd, tune, timeout)) - goto end; - -end: - - N_MSG(CMD, " return<%d> resp<0x%.8x>", cmd->error, cmd->resp[0]); - return cmd->error; -} - -/* The abort condition when PIO read/write - tmo: -*/ -static int msdc_pio_abort(struct msdc_host *host, struct mmc_data *data, unsigned long tmo) -{ - int ret = 0; - u32 base = host->base; - - if (atomic_read(&host->abort)) { - ret = 1; - } - - if (time_after(jiffies, tmo)) { - data->error = (unsigned int)-ETIMEDOUT; - ERR_MSG("XXX PIO Data Timeout: CMD<%d>", host->mrq->cmd->opcode); - ret = 1; - } - - if(ret) { - msdc_reset(); - msdc_clr_fifo(); - msdc_clr_int(); - ERR_MSG("msdc pio find abort"); - } - return ret; + return cmd->error; } -/* - Need to add a timeout, or WDT timeout, system reboot. -*/ -// pio mode data read/write -static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) +static unsigned int msdc_do_command(struct msdc_host *host, + struct mmc_command *cmd, + int tune, + unsigned long timeout) { - struct scatterlist *sg = data->sg; - u32 base = host->base; - u32 num = data->sg_len; - u32 *ptr; - u8 *u8ptr; - u32 left = 0; - u32 count, size = 0; - u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; - unsigned long tmo = jiffies + DAT_TIMEOUT; - - sdr_set_bits(MSDC_INTEN, wints); - while (num) { - left = sg_dma_len(sg); - ptr = sg_virt(sg); - while (left) { - if ((left >= MSDC_FIFO_THD) && (msdc_rxfifocnt() >= MSDC_FIFO_THD)) { - count = MSDC_FIFO_THD >> 2; - do { - *ptr++ = msdc_fifo_read32(); - } while (--count); - left -= MSDC_FIFO_THD; - } else if ((left < MSDC_FIFO_THD) && msdc_rxfifocnt() >= left) { - while (left > 3) { - *ptr++ = msdc_fifo_read32(); - left -= 4; - } - - u8ptr = (u8 *)ptr; - while(left) { - * u8ptr++ = msdc_fifo_read8(); - left--; - } - } - - if (msdc_pio_abort(host, data, tmo)) { - goto end; - } - } - size += sg_dma_len(sg); - sg = sg_next(sg); num--; - } + if (msdc_command_start(host, cmd, tune, timeout)) + goto end; + + if (msdc_command_resp(host, cmd, tune, timeout)) + goto end; + end: - data->bytes_xfered += size; - N_MSG(FIO, " PIO Read<%d>bytes", size); - - sdr_clr_bits(MSDC_INTEN, wints); - if(data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); - return data->error; -} -/* please make sure won't using PIO when size >= 512 - which means, memory card block read/write won't using pio - then don't need to handle the CMD12 when data error. -*/ -static int msdc_pio_write(struct msdc_host* host, struct mmc_data *data) -{ - u32 base = host->base; - struct scatterlist *sg = data->sg; - u32 num = data->sg_len; - u32 *ptr; - u8 *u8ptr; - u32 left; - u32 count, size = 0; - u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; - unsigned long tmo = jiffies + DAT_TIMEOUT; - - sdr_set_bits(MSDC_INTEN, wints); - while (num) { - left = sg_dma_len(sg); - ptr = sg_virt(sg); - - while (left) { - if (left >= MSDC_FIFO_SZ && msdc_txfifocnt() == 0) { - count = MSDC_FIFO_SZ >> 2; - do { - msdc_fifo_write32(*ptr); ptr++; - } while (--count); - left -= MSDC_FIFO_SZ; - } else if (left < MSDC_FIFO_SZ && msdc_txfifocnt() == 0) { - while (left > 3) { - msdc_fifo_write32(*ptr); ptr++; - left -= 4; - } - - u8ptr = (u8*)ptr; - while(left){ - msdc_fifo_write8(*u8ptr); u8ptr++; - left--; - } - } - - if (msdc_pio_abort(host, data, tmo)) { - goto end; - } - } - size += sg_dma_len(sg); - sg = sg_next(sg); num--; - } -end: - data->bytes_xfered += size; - N_MSG(FIO, " PIO Write<%d>bytes", size); - if(data->error) ERR_MSG("write pio data->error<%d>", data->error); - - sdr_clr_bits(MSDC_INTEN, wints); - return data->error; + N_MSG(CMD, " return<%d> resp<0x%.8x>", cmd->error, cmd->resp[0]); + return cmd->error; } #if 0 /* --- by chhung */ -// DMA resume / start / stop +// DMA resume / start / stop static void msdc_dma_resume(struct msdc_host *host) { - u32 base = host->base; + void __iomem *base = host->base; - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_RESUME, 1); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_RESUME, 1); - N_MSG(DMA, "DMA resume"); + N_MSG(DMA, "DMA resume"); } #endif /* end of --- */ static void msdc_dma_start(struct msdc_host *host) { - u32 base = host->base; - u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; - - sdr_set_bits(MSDC_INTEN, wints); - //dsb(); /* --- by chhung */ - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_START, 1); + void __iomem *base = host->base; + u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; - N_MSG(DMA, "DMA start"); + sdr_set_bits(MSDC_INTEN, wints); + //dsb(); /* --- by chhung */ + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_START, 1); + + N_MSG(DMA, "DMA start"); } static void msdc_dma_stop(struct msdc_host *host) { - u32 base = host->base; - //u32 retries=500; - u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; - - N_MSG(DMA, "DMA status: 0x%.8x",sdr_read32(MSDC_DMA_CFG)); - //while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); + void __iomem *base = host->base; + //u32 retries=500; + u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); - while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); + N_MSG(DMA, "DMA status: 0x%.8x", sdr_read32(MSDC_DMA_CFG)); + //while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); - //dsb(); /* --- by chhung */ - sdr_clr_bits(MSDC_INTEN, wints); /* Not just xfer_comp */ + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); + while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) + ; - N_MSG(DMA, "DMA stop"); + //dsb(); /* --- by chhung */ + sdr_clr_bits(MSDC_INTEN, wints); /* Not just xfer_comp */ + + N_MSG(DMA, "DMA stop"); } -#if 0 /* --- by chhung */ -/* dump a gpd list */ -static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) -{ - gpd_t *gpd = dma->gpd; - bd_t *bd = dma->bd; - bd_t *ptr; - int i = 0; - int p_to_v; - - if (dma->mode != MSDC_MODE_DMA_DESC) { - return; - } - - ERR_MSG("try to dump gpd and bd"); - - /* dump gpd */ - ERR_MSG(".gpd<0x%.8x> gpd_phy<0x%.8x>", (int)gpd, (int)dma->gpd_addr); - ERR_MSG("...hwo <%d>", gpd->hwo ); - ERR_MSG("...bdp <%d>", gpd->bdp ); - ERR_MSG("...chksum<0x%.8x>", gpd->chksum ); - //ERR_MSG("...intr <0x%.8x>", gpd->intr ); - ERR_MSG("...next <0x%.8x>", (int)gpd->next ); - ERR_MSG("...ptr <0x%.8x>", (int)gpd->ptr ); - ERR_MSG("...buflen<0x%.8x>", gpd->buflen ); - //ERR_MSG("...extlen<0x%.8x>", gpd->extlen ); - //ERR_MSG("...arg <0x%.8x>", gpd->arg ); - //ERR_MSG("...blknum<0x%.8x>", gpd->blknum ); - //ERR_MSG("...cmd <0x%.8x>", gpd->cmd ); - - /* dump bd */ - ERR_MSG(".bd<0x%.8x> bd_phy<0x%.8x> gpd_ptr<0x%.8x>", (int)bd, (int)dma->bd_addr, (int)gpd->ptr); - ptr = bd; - p_to_v = ((u32)bd - (u32)dma->bd_addr); - while (1) { - ERR_MSG(".bd[%d]", i); i++; - ERR_MSG("...eol <%d>", ptr->eol ); - ERR_MSG("...chksum<0x%.8x>", ptr->chksum ); - //ERR_MSG("...blkpad<0x%.8x>", ptr->blkpad ); - //ERR_MSG("...dwpad <0x%.8x>", ptr->dwpad ); - ERR_MSG("...next <0x%.8x>", (int)ptr->next ); - ERR_MSG("...ptr <0x%.8x>", (int)ptr->ptr ); - ERR_MSG("...buflen<0x%.8x>", (int)ptr->buflen ); - - if (ptr->eol == 1) { - break; - } - - /* find the next bd, virtual address of ptr->next */ - /* don't need to enable when use malloc */ - //BUG_ON( (ptr->next + p_to_v)!=(ptr+1) ); - //ERR_MSG(".next bd<0x%.8x><0x%.8x>", (ptr->next + p_to_v), (ptr+1)); - ptr++; - } - - ERR_MSG("dump gpd and bd finished"); -} -#endif /* end of --- */ - /* calc checksum */ static u8 msdc_dma_calcs(u8 *buf, u32 len) { - u32 i, sum = 0; - for (i = 0; i < len; i++) { - sum += buf[i]; - } - return 0xFF - (u8)sum; + u32 i, sum = 0; + + for (i = 0; i < len; i++) + sum += buf[i]; + return 0xFF - (u8)sum; } /* gpd bd setup + dma registers */ -static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) +static void msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) { - u32 base = host->base; - u32 sglen = dma->sglen; - //u32 i, j, num, bdlen, arg, xfersz; - u32 j, num, bdlen; - u8 blkpad, dwpad, chksum; - struct scatterlist *sg = dma->sg; - gpd_t *gpd; - bd_t *bd; + void __iomem *base = host->base; + //u32 i, j, num, bdlen, arg, xfersz; + u32 j, num; + struct scatterlist *sg; + struct gpd *gpd; + struct bd *bd; - switch (dma->mode) { - case MSDC_MODE_DMA_BASIC: - BUG_ON(dma->xfersz > 65535); - BUG_ON(dma->sglen != 1); - sdr_write32(MSDC_DMA_SA, PHYSADDR(sg_dma_address(sg))); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_LASTBUF, 1); + switch (dma->mode) { + case MSDC_MODE_DMA_BASIC: + BUG_ON(host->xfer_size > 65535); + BUG_ON(dma->sglen != 1); + sdr_write32(MSDC_DMA_SA, PHYSADDR(sg_dma_address(sg))); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_LASTBUF, 1); //#if defined (CONFIG_RALINK_MT7620) - if (ralink_soc == MT762X_SOC_MT7620A) - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_XFERSZ, sg_dma_len(sg)); + if (ralink_soc == MT762X_SOC_MT7620A) + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_XFERSZ, sg_dma_len(sg)); //#elif defined (CONFIG_RALINK_MT7621) || defined (CONFIG_RALINK_MT7628) - else - sdr_write32((volatile u32*)(RALINK_MSDC_BASE+0xa8), sg_dma_len(sg)); + else + sdr_write32((void __iomem *)(RALINK_MSDC_BASE + 0xa8), sg_dma_len(sg)); //#endif - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, dma->burstsz); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 0); - break; - case MSDC_MODE_DMA_DESC: - blkpad = (dma->flags & DMA_FLAG_PAD_BLOCK) ? 1 : 0; - dwpad = (dma->flags & DMA_FLAG_PAD_DWORD) ? 1 : 0; - chksum = (dma->flags & DMA_FLAG_EN_CHKSUM) ? 1 : 0; + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, + MSDC_BRUST_64B); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 0); + break; + case MSDC_MODE_DMA_DESC: - /* calculate the required number of gpd */ - num = (sglen + MAX_BD_PER_GPD - 1) / MAX_BD_PER_GPD; - BUG_ON(num !=1 ); - - gpd = dma->gpd; - bd = dma->bd; - bdlen = sglen; + /* calculate the required number of gpd */ + num = (dma->sglen + MAX_BD_PER_GPD - 1) / MAX_BD_PER_GPD; + BUG_ON(num != 1); - /* modify gpd*/ - //gpd->intr = 0; - gpd->hwo = 1; /* hw will clear it */ - gpd->bdp = 1; - gpd->chksum = 0; /* need to clear first. */ - gpd->chksum = (chksum ? msdc_dma_calcs((u8 *)gpd, 16) : 0); - - /* modify bd*/ - for (j = 0; j < bdlen; j++) { - msdc_init_bd(&bd[j], blkpad, dwpad, sg_dma_address(sg), sg_dma_len(sg)); - if(j == bdlen - 1) { - bd[j].eol = 1; /* the last bd */ - } else { - bd[j].eol = 0; - } - bd[j].chksum = 0; /* checksume need to clear first */ - bd[j].chksum = (chksum ? msdc_dma_calcs((u8 *)(&bd[j]), 16) : 0); - sg++; - } - - dma->used_gpd += 2; - dma->used_bd += bdlen; + gpd = dma->gpd; + bd = dma->bd; - sdr_set_field(MSDC_DMA_CFG, MSDC_DMA_CFG_DECSEN, chksum); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, dma->burstsz); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 1); + /* modify gpd*/ + //gpd->intr = 0; + gpd->hwo = 1; /* hw will clear it */ + gpd->bdp = 1; + gpd->chksum = 0; /* need to clear first. */ + gpd->chksum = msdc_dma_calcs((u8 *)gpd, 16); - sdr_write32(MSDC_DMA_SA, PHYSADDR((u32)dma->gpd_addr)); - break; + /* modify bd*/ + for_each_sg(dma->sg, sg, dma->sglen, j) { + bd[j].blkpad = 0; + bd[j].dwpad = 0; + bd[j].ptr = (void *)sg_dma_address(sg); + bd[j].buflen = sg_dma_len(sg); - default: - break; - } - - N_MSG(DMA, "DMA_CTRL = 0x%x", sdr_read32(MSDC_DMA_CTRL)); - N_MSG(DMA, "DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); - N_MSG(DMA, "DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); + if (j == dma->sglen - 1) + bd[j].eol = 1; /* the last bd */ + else + bd[j].eol = 0; - return 0; -} + bd[j].chksum = 0; /* checksume need to clear first */ + bd[j].chksum = msdc_dma_calcs((u8 *)(&bd[j]), 16); + } -static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, - struct scatterlist *sg, unsigned int sglen) -{ - BUG_ON(sglen > MAX_BD_NUM); /* not support currently */ + sdr_set_field(MSDC_DMA_CFG, MSDC_DMA_CFG_DECSEN, 1); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, + MSDC_BRUST_64B); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 1); - dma->sg = sg; - dma->flags = DMA_FLAG_EN_CHKSUM; - //dma->flags = DMA_FLAG_NONE; /* CHECKME */ - dma->sglen = sglen; - dma->xfersz = host->xfer_size; - dma->burstsz = MSDC_BRUST_64B; - - if (sglen == 1 && sg_dma_len(sg) <= MAX_DMA_CNT) - dma->mode = MSDC_MODE_DMA_BASIC; - else - dma->mode = MSDC_MODE_DMA_DESC; + sdr_write32(MSDC_DMA_SA, PHYSADDR((u32)dma->gpd_addr)); + break; - N_MSG(DMA, "DMA mode<%d> sglen<%d> xfersz<%d>", dma->mode, dma->sglen, dma->xfersz); + default: + break; + } + + N_MSG(DMA, "DMA_CTRL = 0x%x", sdr_read32(MSDC_DMA_CTRL)); + N_MSG(DMA, "DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); + N_MSG(DMA, "DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); - msdc_dma_config(host, dma); - - /*if (dma->mode == MSDC_MODE_DMA_DESC) { - //msdc_dma_dump(host, dma); - } */ } -/* set block number before send command */ -static void msdc_set_blknum(struct msdc_host *host, u32 blknum) +static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, + struct scatterlist *sg, unsigned int sglen) { - u32 base = host->base; + BUG_ON(sglen > MAX_BD_NUM); /* not support currently */ - sdr_write32(SDC_BLK_NUM, blknum); + dma->sg = sg; + dma->sglen = sglen; + + dma->mode = MSDC_MODE_DMA_DESC; + + N_MSG(DMA, "DMA mode<%d> sglen<%d> xfersz<%d>", dma->mode, dma->sglen, + host->xfer_size); + + msdc_dma_config(host, dma); } -static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) +static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) + __must_hold(&host->lock) { - struct msdc_host *host = mmc_priv(mmc); - struct mmc_command *cmd; - struct mmc_data *data; - u32 base = host->base; - //u32 intsts = 0; - unsigned int left=0; - int dma = 0, read = 1, dir = DMA_FROM_DEVICE, send_type=0; - - #define SND_DAT 0 - #define SND_CMD 1 + struct msdc_host *host = mmc_priv(mmc); + struct mmc_command *cmd; + struct mmc_data *data; + void __iomem *base = host->base; + //u32 intsts = 0; + int read = 1, send_type = 0; - BUG_ON(mmc == NULL); - BUG_ON(mrq == NULL); +#define SND_DAT 0 +#define SND_CMD 1 + + BUG_ON(mmc == NULL); + BUG_ON(mrq == NULL); + + host->error = 0; + + cmd = mrq->cmd; + data = mrq->cmd->data; - host->error = 0; - atomic_set(&host->abort, 0); - - cmd = mrq->cmd; - data = mrq->cmd->data; - #if 0 /* --- by chhung */ - //if(host->id ==1){ - N_MSG(OPS, "enable clock!"); - msdc_ungate_clock(host->id); - //} + //if(host->id ==1){ + N_MSG(OPS, "enable clock!"); + msdc_ungate_clock(host->id); + //} #endif /* end of --- */ - - if (!data) { - send_type=SND_CMD; - if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) { - goto done; - } - } else { - BUG_ON(data->blksz > HOST_MAX_BLKSZ); - send_type=SND_DAT; - data->error = 0; - read = data->flags & MMC_DATA_READ ? 1 : 0; - host->data = data; - host->xfer_size = data->blocks * data->blksz; - host->blksz = data->blksz; + if (!data) { + send_type = SND_CMD; + if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) + goto done; + } else { + BUG_ON(data->blksz > HOST_MAX_BLKSZ); + send_type = SND_DAT; - /* deside the transfer mode */ - if (drv_mode[host->id] == MODE_PIO) { - host->dma_xfer = dma = 0; - } else if (drv_mode[host->id] == MODE_DMA) { - host->dma_xfer = dma = 1; - } else if (drv_mode[host->id] == MODE_SIZE_DEP) { - host->dma_xfer = dma = ((host->xfer_size >= dma_size[host->id]) ? 1 : 0); - } + data->error = 0; + read = data->flags & MMC_DATA_READ ? 1 : 0; + host->data = data; + host->xfer_size = data->blocks * data->blksz; + host->blksz = data->blksz; - if (read) { - if ((host->timeout_ns != data->timeout_ns) || - (host->timeout_clks != data->timeout_clks)) { - msdc_set_timeout(host, data->timeout_ns, data->timeout_clks); - } - } - - msdc_set_blknum(host, data->blocks); - //msdc_clr_fifo(); /* no need */ + if (read) { + if ((host->timeout_ns != data->timeout_ns) || + (host->timeout_clks != data->timeout_clks)) { + msdc_set_timeout(host, data->timeout_ns, data->timeout_clks); + } + } - if (dma) { - msdc_dma_on(); /* enable DMA mode first!! */ - init_completion(&host->xfer_done); - - /* start the command first*/ - if (msdc_command_start(host, cmd, 1, CMD_TIMEOUT) != 0) - goto done; + sdr_write32(SDC_BLK_NUM, data->blocks); + //msdc_clr_fifo(); /* no need */ - dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE; - (void)dma_map_sg(mmc_dev(mmc), data->sg, data->sg_len, dir); - msdc_dma_setup(host, &host->dma, data->sg, data->sg_len); - - /* then wait command done */ - if (msdc_command_resp(host, cmd, 1, CMD_TIMEOUT) != 0) - goto done; + msdc_dma_on(); /* enable DMA mode first!! */ + init_completion(&host->xfer_done); - /* for read, the data coming too fast, then CRC error - start DMA no business with CRC. */ - //init_completion(&host->xfer_done); - msdc_dma_start(host); - - spin_unlock(&host->lock); - if(!wait_for_completion_timeout(&host->xfer_done, DAT_TIMEOUT)){ - ERR_MSG("XXX CMD<%d> wait xfer_done<%d> timeout!!", cmd->opcode, data->blocks * data->blksz); - ERR_MSG(" DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); - ERR_MSG(" DMA_CA = 0x%x", sdr_read32(MSDC_DMA_CA)); - ERR_MSG(" DMA_CTRL = 0x%x", sdr_read32(MSDC_DMA_CTRL)); - ERR_MSG(" DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); - data->error = (unsigned int)-ETIMEDOUT; - - msdc_reset(); - msdc_clr_fifo(); - msdc_clr_int(); - } - spin_lock(&host->lock); - msdc_dma_stop(host); - } else { - /* Firstly: send command */ - if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) { - goto done; - } - - /* Secondly: pio data phase */ - if (read) { - if (msdc_pio_read(host, data)){ - goto done; - } - } else { - if (msdc_pio_write(host, data)) { - goto done; - } - } + /* start the command first*/ + if (msdc_command_start(host, cmd, 1, CMD_TIMEOUT) != 0) + goto done; - /* For write case: make sure contents in fifo flushed to device */ - if (!read) { - while (1) { - left=msdc_txfifocnt(); - if (left == 0) { - break; - } - if (msdc_pio_abort(host, data, jiffies + DAT_TIMEOUT)) { - break; - /* Fix me: what about if data error, when stop ? how to? */ - } - } - } else { - /* Fix me: read case: need to check CRC error */ - } + data->sg_count = dma_map_sg(mmc_dev(mmc), data->sg, + data->sg_len, + mmc_get_dma_dir(data)); + msdc_dma_setup(host, &host->dma, data->sg, + data->sg_count); - /* For write case: SDCBUSY and Xfer_Comp will assert when DAT0 not busy. - For read case : SDCBUSY and Xfer_Comp will assert when last byte read out from FIFO. - */ - - /* try not to wait xfer_comp interrupt. - the next command will check SDC_BUSY. - SDC_BUSY means xfer_comp assert - */ - - } // PIO mode - - /* Last: stop transfer */ - if (data->stop){ - if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0) { - goto done; - } - } - } + /* then wait command done */ + if (msdc_command_resp(host, cmd, 1, CMD_TIMEOUT) != 0) + goto done; + + /* for read, the data coming too fast, then CRC error + start DMA no business with CRC. */ + //init_completion(&host->xfer_done); + msdc_dma_start(host); + + spin_unlock(&host->lock); + if (!wait_for_completion_timeout(&host->xfer_done, DAT_TIMEOUT)) { + ERR_MSG("XXX CMD<%d> wait xfer_done<%d> timeout!!", cmd->opcode, data->blocks * data->blksz); + ERR_MSG(" DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); + ERR_MSG(" DMA_CA = 0x%x", sdr_read32(MSDC_DMA_CA)); + ERR_MSG(" DMA_CTRL = 0x%x", sdr_read32(MSDC_DMA_CTRL)); + ERR_MSG(" DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); + data->error = -ETIMEDOUT; + + msdc_reset_hw(host); + msdc_clr_fifo(); + msdc_clr_int(); + } + spin_lock(&host->lock); + msdc_dma_stop(host); + + /* Last: stop transfer */ + if (data->stop) { + if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0) + goto done; + } + } done: - if (data != NULL) { - host->data = NULL; - host->dma_xfer = 0; - if (dma != 0) { - msdc_dma_off(); - host->dma.used_bd = 0; - host->dma.used_gpd = 0; - dma_unmap_sg(mmc_dev(mmc), data->sg, data->sg_len, dir); - } - host->blksz = 0; - -#if 0 // don't stop twice! - if(host->hw->flags & MSDC_REMOVABLE && data->error) { - msdc_abort_data(host); - /* reset in IRQ, stop command has issued. -> No need */ - } -#endif + if (data != NULL) { + host->data = NULL; + dma_unmap_sg(mmc_dev(mmc), data->sg, data->sg_len, + mmc_get_dma_dir(data)); + host->blksz = 0; - N_MSG(OPS, "CMD<%d> data<%s %s> blksz<%d> block<%d> error<%d>",cmd->opcode, (dma? "dma":"pio"), - (read ? "read ":"write") ,data->blksz, data->blocks, data->error); - } +#if 0 // don't stop twice! + if (host->hw->flags & MSDC_REMOVABLE && data->error) { + msdc_abort_data(host); + /* reset in IRQ, stop command has issued. -> No need */ + } +#endif + + N_MSG(OPS, "CMD<%d> data<%s %s> blksz<%d> block<%d> error<%d>", cmd->opcode, (dma ? "dma" : "pio"), + (read ? "read " : "write"), data->blksz, data->blocks, data->error); + } #if 0 /* --- by chhung */ -#if 1 - //if(host->id==1) { - if(send_type==SND_CMD) { - if(cmd->opcode == MMC_SEND_STATUS) { - if((cmd->resp[0] & CARD_READY_FOR_DATA) ||(CARD_CURRENT_STATE(cmd->resp[0]) != 7)){ - N_MSG(OPS,"disable clock, CMD13 IDLE"); - msdc_gate_clock(host->id); - } - } else { - N_MSG(OPS,"disable clock, CMD<%d>", cmd->opcode); - msdc_gate_clock(host->id); - } - } else { - if(read) { - N_MSG(OPS,"disable clock!!! Read CMD<%d>",cmd->opcode); - msdc_gate_clock(host->id); - } - } - //} +#if 1 + //if(host->id==1) { + if (send_type == SND_CMD) { + if (cmd->opcode == MMC_SEND_STATUS) { + if ((cmd->resp[0] & CARD_READY_FOR_DATA) || (CARD_CURRENT_STATE(cmd->resp[0]) != 7)) { + N_MSG(OPS, "disable clock, CMD13 IDLE"); + msdc_gate_clock(host->id); + } + } else { + N_MSG(OPS, "disable clock, CMD<%d>", cmd->opcode); + msdc_gate_clock(host->id); + } + } else { + if (read) { + N_MSG(OPS, "disable clock!!! Read CMD<%d>", cmd->opcode); + msdc_gate_clock(host->id); + } + } + //} #else - msdc_gate_clock(host->id); + msdc_gate_clock(host->id); #endif #endif /* end of --- */ - - if (mrq->cmd->error) host->error = 0x001; - if (mrq->data && mrq->data->error) host->error |= 0x010; - if (mrq->stop && mrq->stop->error) host->error |= 0x100; - //if (host->error) ERR_MSG("host->error<%d>", host->error); + if (mrq->cmd->error) + host->error = 0x001; + if (mrq->data && mrq->data->error) + host->error |= 0x010; + if (mrq->stop && mrq->stop->error) + host->error |= 0x100; - return host->error; + //if (host->error) ERR_MSG("host->error<%d>", host->error); + + return host->error; } static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host) { - struct mmc_command cmd; - struct mmc_request mrq; - u32 err; + struct mmc_command cmd; + struct mmc_request mrq; + u32 err; - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = MMC_APP_CMD; -#if 0 /* bug: we meet mmc->card is null when ACMD6 */ - cmd.arg = mmc->card->rca << 16; -#else - cmd.arg = host->app_cmd_arg; -#endif - cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; + memset(&cmd, 0, sizeof(struct mmc_command)); + cmd.opcode = MMC_APP_CMD; +#if 0 /* bug: we meet mmc->card is null when ACMD6 */ + cmd.arg = mmc->card->rca << 16; +#else + cmd.arg = host->app_cmd_arg; +#endif + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; - memset(&mrq, 0, sizeof(struct mmc_request)); - mrq.cmd = &cmd; cmd.mrq = &mrq; - cmd.data = NULL; + memset(&mrq, 0, sizeof(struct mmc_request)); + mrq.cmd = &cmd; cmd.mrq = &mrq; + cmd.data = NULL; - err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT); - return err; + err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT); + return err; } -static int msdc_tune_cmdrsp(struct msdc_host*host, struct mmc_command *cmd) +static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd) { - int result = -1; - u32 base = host->base; - u32 rsmpl, cur_rsmpl, orig_rsmpl; - u32 rrdly, cur_rrdly = 0xffffffff, orig_rrdly; - u32 skip = 1; - - /* ==== don't support 3.0 now ==== - 1: R_SMPL[1] - 2: PAD_CMD_RESP_RXDLY[26:22] - ==========================*/ + int result = -1; + void __iomem *base = host->base; + u32 rsmpl, cur_rsmpl, orig_rsmpl; + u32 rrdly, cur_rrdly = 0xffffffff, orig_rrdly; + u32 skip = 1; - // save the previous tune result - sdr_get_field(MSDC_IOCON, MSDC_IOCON_RSPL, orig_rsmpl); - sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, orig_rrdly); + /* ==== don't support 3.0 now ==== + 1: R_SMPL[1] + 2: PAD_CMD_RESP_RXDLY[26:22] + ==========================*/ - rrdly = 0; - do { - for (rsmpl = 0; rsmpl < 2; rsmpl++) { - /* Lv1: R_SMPL[1] */ - cur_rsmpl = (orig_rsmpl + rsmpl) % 2; - if (skip == 1) { - skip = 0; - continue; - } - sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, cur_rsmpl); + // save the previous tune result + sdr_get_field(MSDC_IOCON, MSDC_IOCON_RSPL, &orig_rsmpl); + sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, &orig_rrdly); - if (host->app_cmd) { - result = msdc_app_cmd(host->mmc, host); - if (result) { - ERR_MSG("TUNE_CMD app_cmd<%d> failed: RESP_RXDLY<%d>,R_SMPL<%d>", - host->mrq->cmd->opcode, cur_rrdly, cur_rsmpl); - continue; - } - } - result = msdc_do_command(host, cmd, 0, CMD_TIMEOUT); // not tune. - ERR_MSG("TUNE_CMD<%d> %s PAD_CMD_RESP_RXDLY[26:22]<%d> R_SMPL[1]<%d>", cmd->opcode, - (result == 0) ? "PASS" : "FAIL", cur_rrdly, cur_rsmpl); - - if (result == 0) { - return 0; - } - if (result != (unsigned int)(-EIO)) { - ERR_MSG("TUNE_CMD<%d> Error<%d> not -EIO", cmd->opcode, result); - return result; - } + rrdly = 0; + do { + for (rsmpl = 0; rsmpl < 2; rsmpl++) { + /* Lv1: R_SMPL[1] */ + cur_rsmpl = (orig_rsmpl + rsmpl) % 2; + if (skip == 1) { + skip = 0; + continue; + } + sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, cur_rsmpl); - /* should be EIO */ - if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ - msdc_abort_data(host); - } - } - - /* Lv2: PAD_CMD_RESP_RXDLY[26:22] */ - cur_rrdly = (orig_rrdly + rrdly + 1) % 32; - sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, cur_rrdly); - }while (++rrdly < 32); - - return result; + if (host->app_cmd) { + result = msdc_app_cmd(host->mmc, host); + if (result) { + ERR_MSG("TUNE_CMD app_cmd<%d> failed: RESP_RXDLY<%d>,R_SMPL<%d>", + host->mrq->cmd->opcode, cur_rrdly, cur_rsmpl); + continue; + } + } + result = msdc_do_command(host, cmd, 0, CMD_TIMEOUT); // not tune. + ERR_MSG("TUNE_CMD<%d> %s PAD_CMD_RESP_RXDLY[26:22]<%d> R_SMPL[1]<%d>", cmd->opcode, + (result == 0) ? "PASS" : "FAIL", cur_rrdly, cur_rsmpl); + + if (result == 0) + return 0; + if (result != -EIO) { + ERR_MSG("TUNE_CMD<%d> Error<%d> not -EIO", cmd->opcode, result); + return result; + } + + /* should be EIO */ + if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ + msdc_abort_data(host); + } + } + + /* Lv2: PAD_CMD_RESP_RXDLY[26:22] */ + cur_rrdly = (orig_rrdly + rrdly + 1) % 32; + sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, cur_rrdly); + } while (++rrdly < 32); + + return result; } /* Support SD2.0 Only */ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) { - struct msdc_host *host = mmc_priv(mmc); - u32 base = host->base; - u32 ddr=0; - u32 dcrc=0; - u32 rxdly, cur_rxdly0, cur_rxdly1; - u32 dsmpl, cur_dsmpl, orig_dsmpl; - u32 cur_dat0, cur_dat1, cur_dat2, cur_dat3; - u32 cur_dat4, cur_dat5, cur_dat6, cur_dat7; - u32 orig_dat0, orig_dat1, orig_dat2, orig_dat3; - u32 orig_dat4, orig_dat5, orig_dat6, orig_dat7; - int result = -1; - u32 skip = 1; + struct msdc_host *host = mmc_priv(mmc); + void __iomem *base = host->base; + u32 ddr = 0; + u32 dcrc = 0; + u32 rxdly, cur_rxdly0, cur_rxdly1; + u32 dsmpl, cur_dsmpl, orig_dsmpl; + u32 cur_dat0, cur_dat1, cur_dat2, cur_dat3; + u32 cur_dat4, cur_dat5, cur_dat6, cur_dat7; + u32 orig_dat0, orig_dat1, orig_dat2, orig_dat3; + u32 orig_dat4, orig_dat5, orig_dat6, orig_dat7; + int result = -1; + u32 skip = 1; - sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl); - - /* Tune Method 2. */ - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); + sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, &orig_dsmpl); - rxdly = 0; - do { - for (dsmpl = 0; dsmpl < 2; dsmpl++) { - cur_dsmpl = (orig_dsmpl + dsmpl) % 2; - if (skip == 1) { - skip = 0; - continue; - } - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, cur_dsmpl); + /* Tune Method 2. */ + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); - if (host->app_cmd) { - result = msdc_app_cmd(host->mmc, host); - if (result) { - ERR_MSG("TUNE_BREAD app_cmd<%d> failed", host->mrq->cmd->opcode); - continue; - } - } - result = msdc_do_request(mmc,mrq); - - sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS|SDC_DCRC_STS_NEG, dcrc); /* RO */ - if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; - ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", - (result == 0 && dcrc == 0) ? "PASS" : "FAIL", dcrc, - sdr_read32(MSDC_DAT_RDDLY0), sdr_read32(MSDC_DAT_RDDLY1), cur_dsmpl); + rxdly = 0; + do { + for (dsmpl = 0; dsmpl < 2; dsmpl++) { + cur_dsmpl = (orig_dsmpl + dsmpl) % 2; + if (skip == 1) { + skip = 0; + continue; + } + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, cur_dsmpl); - /* Fix me: result is 0, but dcrc is still exist */ - if (result == 0 && dcrc == 0) { - goto done; - } else { - /* there is a case: command timeout, and data phase not processed */ - if (mrq->data->error != 0 && mrq->data->error != (unsigned int)(-EIO)) { - ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", - result, mrq->cmd->error, mrq->data->error); - goto done; - } - } - } + if (host->app_cmd) { + result = msdc_app_cmd(host->mmc, host); + if (result) { + ERR_MSG("TUNE_BREAD app_cmd<%d> failed", host->mrq->cmd->opcode); + continue; + } + } + result = msdc_do_request(mmc, mrq); - cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); - cur_rxdly1 = sdr_read32(MSDC_DAT_RDDLY1); + sdr_get_field(SDC_DCRC_STS, + SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, + &dcrc); /* RO */ + if (!ddr) + dcrc &= ~SDC_DCRC_STS_NEG; + ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", + (result == 0 && dcrc == 0) ? "PASS" : "FAIL", dcrc, + sdr_read32(MSDC_DAT_RDDLY0), sdr_read32(MSDC_DAT_RDDLY1), cur_dsmpl); - /* E1 ECO. YD: Reverse */ - if (sdr_read32(MSDC_ECO_VER) >= 4) { - orig_dat0 = (cur_rxdly0 >> 24) & 0x1F; - orig_dat1 = (cur_rxdly0 >> 16) & 0x1F; - orig_dat2 = (cur_rxdly0 >> 8) & 0x1F; - orig_dat3 = (cur_rxdly0 >> 0) & 0x1F; - orig_dat4 = (cur_rxdly1 >> 24) & 0x1F; - orig_dat5 = (cur_rxdly1 >> 16) & 0x1F; - orig_dat6 = (cur_rxdly1 >> 8) & 0x1F; - orig_dat7 = (cur_rxdly1 >> 0) & 0x1F; - } else { - orig_dat0 = (cur_rxdly0 >> 0) & 0x1F; - orig_dat1 = (cur_rxdly0 >> 8) & 0x1F; - orig_dat2 = (cur_rxdly0 >> 16) & 0x1F; - orig_dat3 = (cur_rxdly0 >> 24) & 0x1F; - orig_dat4 = (cur_rxdly1 >> 0) & 0x1F; - orig_dat5 = (cur_rxdly1 >> 8) & 0x1F; - orig_dat6 = (cur_rxdly1 >> 16) & 0x1F; - orig_dat7 = (cur_rxdly1 >> 24) & 0x1F; - } - - if (ddr) { - cur_dat0 = (dcrc & (1 << 0) || dcrc & (1 << 8)) ? ((orig_dat0 + 1) % 32) : orig_dat0; - cur_dat1 = (dcrc & (1 << 1) || dcrc & (1 << 9)) ? ((orig_dat1 + 1) % 32) : orig_dat1; - cur_dat2 = (dcrc & (1 << 2) || dcrc & (1 << 10)) ? ((orig_dat2 + 1) % 32) : orig_dat2; - cur_dat3 = (dcrc & (1 << 3) || dcrc & (1 << 11)) ? ((orig_dat3 + 1) % 32) : orig_dat3; - } else { - cur_dat0 = (dcrc & (1 << 0)) ? ((orig_dat0 + 1) % 32) : orig_dat0; - cur_dat1 = (dcrc & (1 << 1)) ? ((orig_dat1 + 1) % 32) : orig_dat1; - cur_dat2 = (dcrc & (1 << 2)) ? ((orig_dat2 + 1) % 32) : orig_dat2; - cur_dat3 = (dcrc & (1 << 3)) ? ((orig_dat3 + 1) % 32) : orig_dat3; - } - cur_dat4 = (dcrc & (1 << 4)) ? ((orig_dat4 + 1) % 32) : orig_dat4; - cur_dat5 = (dcrc & (1 << 5)) ? ((orig_dat5 + 1) % 32) : orig_dat5; - cur_dat6 = (dcrc & (1 << 6)) ? ((orig_dat6 + 1) % 32) : orig_dat6; - cur_dat7 = (dcrc & (1 << 7)) ? ((orig_dat7 + 1) % 32) : orig_dat7; + /* Fix me: result is 0, but dcrc is still exist */ + if (result == 0 && dcrc == 0) { + goto done; + } else { + /* there is a case: command timeout, and data phase not processed */ + if (mrq->data->error != 0 && + mrq->data->error != -EIO) { + ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", + result, mrq->cmd->error, mrq->data->error); + goto done; + } + } + } - cur_rxdly0 = (cur_dat0 << 24) | (cur_dat1 << 16) | (cur_dat2 << 8) | (cur_dat3 << 0); - cur_rxdly1 = (cur_dat4 << 24) | (cur_dat5 << 16) | (cur_dat6 << 8) | (cur_dat7 << 0); + cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); + cur_rxdly1 = sdr_read32(MSDC_DAT_RDDLY1); - sdr_write32(MSDC_DAT_RDDLY0, cur_rxdly0); - sdr_write32(MSDC_DAT_RDDLY1, cur_rxdly1); + /* E1 ECO. YD: Reverse */ + if (sdr_read32(MSDC_ECO_VER) >= 4) { + orig_dat0 = (cur_rxdly0 >> 24) & 0x1F; + orig_dat1 = (cur_rxdly0 >> 16) & 0x1F; + orig_dat2 = (cur_rxdly0 >> 8) & 0x1F; + orig_dat3 = (cur_rxdly0 >> 0) & 0x1F; + orig_dat4 = (cur_rxdly1 >> 24) & 0x1F; + orig_dat5 = (cur_rxdly1 >> 16) & 0x1F; + orig_dat6 = (cur_rxdly1 >> 8) & 0x1F; + orig_dat7 = (cur_rxdly1 >> 0) & 0x1F; + } else { + orig_dat0 = (cur_rxdly0 >> 0) & 0x1F; + orig_dat1 = (cur_rxdly0 >> 8) & 0x1F; + orig_dat2 = (cur_rxdly0 >> 16) & 0x1F; + orig_dat3 = (cur_rxdly0 >> 24) & 0x1F; + orig_dat4 = (cur_rxdly1 >> 0) & 0x1F; + orig_dat5 = (cur_rxdly1 >> 8) & 0x1F; + orig_dat6 = (cur_rxdly1 >> 16) & 0x1F; + orig_dat7 = (cur_rxdly1 >> 24) & 0x1F; + } + + if (ddr) { + cur_dat0 = (dcrc & (1 << 0) || dcrc & (1 << 8)) ? ((orig_dat0 + 1) % 32) : orig_dat0; + cur_dat1 = (dcrc & (1 << 1) || dcrc & (1 << 9)) ? ((orig_dat1 + 1) % 32) : orig_dat1; + cur_dat2 = (dcrc & (1 << 2) || dcrc & (1 << 10)) ? ((orig_dat2 + 1) % 32) : orig_dat2; + cur_dat3 = (dcrc & (1 << 3) || dcrc & (1 << 11)) ? ((orig_dat3 + 1) % 32) : orig_dat3; + } else { + cur_dat0 = (dcrc & (1 << 0)) ? ((orig_dat0 + 1) % 32) : orig_dat0; + cur_dat1 = (dcrc & (1 << 1)) ? ((orig_dat1 + 1) % 32) : orig_dat1; + cur_dat2 = (dcrc & (1 << 2)) ? ((orig_dat2 + 1) % 32) : orig_dat2; + cur_dat3 = (dcrc & (1 << 3)) ? ((orig_dat3 + 1) % 32) : orig_dat3; + } + cur_dat4 = (dcrc & (1 << 4)) ? ((orig_dat4 + 1) % 32) : orig_dat4; + cur_dat5 = (dcrc & (1 << 5)) ? ((orig_dat5 + 1) % 32) : orig_dat5; + cur_dat6 = (dcrc & (1 << 6)) ? ((orig_dat6 + 1) % 32) : orig_dat6; + cur_dat7 = (dcrc & (1 << 7)) ? ((orig_dat7 + 1) % 32) : orig_dat7; + + cur_rxdly0 = (cur_dat0 << 24) | (cur_dat1 << 16) | (cur_dat2 << 8) | (cur_dat3 << 0); + cur_rxdly1 = (cur_dat4 << 24) | (cur_dat5 << 16) | (cur_dat6 << 8) | (cur_dat7 << 0); + + sdr_write32(MSDC_DAT_RDDLY0, cur_rxdly0); + sdr_write32(MSDC_DAT_RDDLY1, cur_rxdly1); + + } while (++rxdly < 32); - } while (++rxdly < 32); - done: - return result; + return result; } -static int msdc_tune_bwrite(struct mmc_host *mmc,struct mmc_request *mrq) +static int msdc_tune_bwrite(struct mmc_host *mmc, struct mmc_request *mrq) { - struct msdc_host *host = mmc_priv(mmc); - u32 base = host->base; + struct msdc_host *host = mmc_priv(mmc); + void __iomem *base = host->base; - u32 wrrdly, cur_wrrdly = 0xffffffff, orig_wrrdly; - u32 dsmpl, cur_dsmpl, orig_dsmpl; - u32 rxdly, cur_rxdly0; - u32 orig_dat0, orig_dat1, orig_dat2, orig_dat3; - u32 cur_dat0, cur_dat1, cur_dat2, cur_dat3; - int result = -1; - u32 skip = 1; + u32 wrrdly, cur_wrrdly = 0xffffffff, orig_wrrdly; + u32 dsmpl, cur_dsmpl, orig_dsmpl; + u32 rxdly, cur_rxdly0; + u32 orig_dat0, orig_dat1, orig_dat2, orig_dat3; + u32 cur_dat0, cur_dat1, cur_dat2, cur_dat3; + int result = -1; + u32 skip = 1; - // MSDC_IOCON_DDR50CKD need to check. [Fix me] - - sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, orig_wrrdly); - sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl ); + // MSDC_IOCON_DDR50CKD need to check. [Fix me] - /* Tune Method 2. just DAT0 */ - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); - cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); - - /* E1 ECO. YD: Reverse */ - if (sdr_read32(MSDC_ECO_VER) >= 4) { - orig_dat0 = (cur_rxdly0 >> 24) & 0x1F; - orig_dat1 = (cur_rxdly0 >> 16) & 0x1F; - orig_dat2 = (cur_rxdly0 >> 8) & 0x1F; - orig_dat3 = (cur_rxdly0 >> 0) & 0x1F; - } else { - orig_dat0 = (cur_rxdly0 >> 0) & 0x1F; - orig_dat1 = (cur_rxdly0 >> 8) & 0x1F; - orig_dat2 = (cur_rxdly0 >> 16) & 0x1F; - orig_dat3 = (cur_rxdly0 >> 24) & 0x1F; - } + sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, &orig_wrrdly); + sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, &orig_dsmpl); - rxdly = 0; - do { - wrrdly = 0; - do { - for (dsmpl = 0; dsmpl < 2; dsmpl++) { - cur_dsmpl = (orig_dsmpl + dsmpl) % 2; - if (skip == 1) { - skip = 0; - continue; - } - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, cur_dsmpl); - - if (host->app_cmd) { - result = msdc_app_cmd(host->mmc, host); - if (result) { - ERR_MSG("TUNE_BWRITE app_cmd<%d> failed", host->mrq->cmd->opcode); - continue; - } - } - result = msdc_do_request(mmc,mrq); - - ERR_MSG("TUNE_BWRITE<%s> DSPL<%d> DATWRDLY<%d> MSDC_DAT_RDDLY0<0x%x>", - result == 0 ? "PASS" : "FAIL", - cur_dsmpl, cur_wrrdly, cur_rxdly0); - - if (result == 0) { - goto done; - } - else { - /* there is a case: command timeout, and data phase not processed */ - if (mrq->data->error != (unsigned int)(-EIO)) { - ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", - result, mrq->cmd->error, mrq->data->error); - goto done; - } - } - } - cur_wrrdly = (orig_wrrdly + wrrdly + 1) % 32; - sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, cur_wrrdly); - } while (++wrrdly < 32); - - cur_dat0 = (orig_dat0 + rxdly) % 32; /* only adjust bit-1 for crc */ - cur_dat1 = orig_dat1; - cur_dat2 = orig_dat2; - cur_dat3 = orig_dat3; - - cur_rxdly0 = (cur_dat0 << 24) | (cur_dat1 << 16) | (cur_dat2 << 8) | (cur_dat3 << 0); - sdr_write32(MSDC_DAT_RDDLY0, cur_rxdly0); - } while (++rxdly < 32); + /* Tune Method 2. just DAT0 */ + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); + cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); + + /* E1 ECO. YD: Reverse */ + if (sdr_read32(MSDC_ECO_VER) >= 4) { + orig_dat0 = (cur_rxdly0 >> 24) & 0x1F; + orig_dat1 = (cur_rxdly0 >> 16) & 0x1F; + orig_dat2 = (cur_rxdly0 >> 8) & 0x1F; + orig_dat3 = (cur_rxdly0 >> 0) & 0x1F; + } else { + orig_dat0 = (cur_rxdly0 >> 0) & 0x1F; + orig_dat1 = (cur_rxdly0 >> 8) & 0x1F; + orig_dat2 = (cur_rxdly0 >> 16) & 0x1F; + orig_dat3 = (cur_rxdly0 >> 24) & 0x1F; + } + + rxdly = 0; + do { + wrrdly = 0; + do { + for (dsmpl = 0; dsmpl < 2; dsmpl++) { + cur_dsmpl = (orig_dsmpl + dsmpl) % 2; + if (skip == 1) { + skip = 0; + continue; + } + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, cur_dsmpl); + + if (host->app_cmd) { + result = msdc_app_cmd(host->mmc, host); + if (result) { + ERR_MSG("TUNE_BWRITE app_cmd<%d> failed", host->mrq->cmd->opcode); + continue; + } + } + result = msdc_do_request(mmc, mrq); + + ERR_MSG("TUNE_BWRITE<%s> DSPL<%d> DATWRDLY<%d> MSDC_DAT_RDDLY0<0x%x>", + result == 0 ? "PASS" : "FAIL", + cur_dsmpl, cur_wrrdly, cur_rxdly0); + + if (result == 0) { + goto done; + } else { + /* there is a case: command timeout, and data phase not processed */ + if (mrq->data->error != -EIO) { + ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", + result, mrq->cmd->error, mrq->data->error); + goto done; + } + } + } + cur_wrrdly = (orig_wrrdly + wrrdly + 1) % 32; + sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, cur_wrrdly); + } while (++wrrdly < 32); + + cur_dat0 = (orig_dat0 + rxdly) % 32; /* only adjust bit-1 for crc */ + cur_dat1 = orig_dat1; + cur_dat2 = orig_dat2; + cur_dat3 = orig_dat3; + + cur_rxdly0 = (cur_dat0 << 24) | (cur_dat1 << 16) | (cur_dat2 << 8) | (cur_dat3 << 0); + sdr_write32(MSDC_DAT_RDDLY0, cur_rxdly0); + } while (++rxdly < 32); done: - return result; + return result; } static int msdc_get_card_status(struct mmc_host *mmc, struct msdc_host *host, u32 *status) { - struct mmc_command cmd; - struct mmc_request mrq; - u32 err; + struct mmc_command cmd; + struct mmc_request mrq; + u32 err; - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = MMC_SEND_STATUS; - if (mmc->card) { - cmd.arg = mmc->card->rca << 16; - } else { - ERR_MSG("cmd13 mmc card is null"); - cmd.arg = host->app_cmd_arg; - } - cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; + memset(&cmd, 0, sizeof(struct mmc_command)); + cmd.opcode = MMC_SEND_STATUS; + if (mmc->card) { + cmd.arg = mmc->card->rca << 16; + } else { + ERR_MSG("cmd13 mmc card is null"); + cmd.arg = host->app_cmd_arg; + } + cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; - memset(&mrq, 0, sizeof(struct mmc_request)); - mrq.cmd = &cmd; cmd.mrq = &mrq; - cmd.data = NULL; + memset(&mrq, 0, sizeof(struct mmc_request)); + mrq.cmd = &cmd; cmd.mrq = &mrq; + cmd.data = NULL; - err = msdc_do_command(host, &cmd, 1, CMD_TIMEOUT); - - if (status) { - *status = cmd.resp[0]; - } - - return err; + err = msdc_do_command(host, &cmd, 1, CMD_TIMEOUT); + + if (status) + *status = cmd.resp[0]; + + return err; } static int msdc_check_busy(struct mmc_host *mmc, struct msdc_host *host) { - u32 err = 0; - u32 status = 0; - - do { - err = msdc_get_card_status(mmc, host, &status); - if (err) return err; - /* need cmd12? */ - ERR_MSG("cmd<13> resp<0x%x>", status); - } while (R1_CURRENT_STATE(status) == 7); - - return err; + u32 err = 0; + u32 status = 0; + + do { + err = msdc_get_card_status(mmc, host, &status); + if (err) + return err; + /* need cmd12? */ + ERR_MSG("cmd<13> resp<0x%x>", status); + } while (R1_CURRENT_STATE(status) == 7); + + return err; } /* failed when msdc_do_request */ static int msdc_tune_request(struct mmc_host *mmc, struct mmc_request *mrq) { - struct msdc_host *host = mmc_priv(mmc); - struct mmc_command *cmd; - struct mmc_data *data; - //u32 base = host->base; - int ret=0, read; - - cmd = mrq->cmd; - data = mrq->cmd->data; - - read = data->flags & MMC_DATA_READ ? 1 : 0; + struct msdc_host *host = mmc_priv(mmc); + struct mmc_command *cmd; + struct mmc_data *data; + //u32 base = host->base; + int ret = 0, read; - if (read) { - if (data->error == (unsigned int)(-EIO)) { - ret = msdc_tune_bread(mmc,mrq); - } - } else { - ret = msdc_check_busy(mmc, host); - if (ret){ - ERR_MSG("XXX cmd13 wait program done failed"); - return ret; - } - /* CRC and TO */ - /* Fix me: don't care card status? */ - ret = msdc_tune_bwrite(mmc,mrq); - } + cmd = mrq->cmd; + data = mrq->cmd->data; - return ret; + read = data->flags & MMC_DATA_READ ? 1 : 0; + + if (read) { + if (data->error == -EIO) + ret = msdc_tune_bread(mmc, mrq); + } else { + ret = msdc_check_busy(mmc, host); + if (ret) { + ERR_MSG("XXX cmd13 wait program done failed"); + return ret; + } + /* CRC and TO */ + /* Fix me: don't care card status? */ + ret = msdc_tune_bwrite(mmc, mrq); + } + + return ret; } /* ops.request */ -static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) -{ - struct msdc_host *host = mmc_priv(mmc); +static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) +{ + struct msdc_host *host = mmc_priv(mmc); - //=== for sdio profile === + //=== for sdio profile === #if 0 /* --- by chhung */ - u32 old_H32, old_L32, new_H32, new_L32; - u32 ticks = 0, opcode = 0, sizes = 0, bRx = 0; + u32 old_H32, old_L32, new_H32, new_L32; + u32 ticks = 0, opcode = 0, sizes = 0, bRx = 0; #endif /* end of --- */ - - if(host->mrq){ - ERR_MSG("XXX host->mrq<0x%.8x>", (int)host->mrq); - BUG(); - } - - if (!is_card_present(host) || host->power_mode == MMC_POWER_OFF) { - ERR_MSG("cmd<%d> card<%d> power<%d>", mrq->cmd->opcode, is_card_present(host), host->power_mode); - mrq->cmd->error = (unsigned int)-ENOMEDIUM; - -#if 1 - mrq->done(mrq); // call done directly. -#else - mrq->cmd->retries = 0; // please don't retry. - mmc_request_done(mmc, mrq); -#endif - return; - } - - /* start to process */ - spin_lock(&host->lock); + WARN_ON(host->mrq); + + /* start to process */ + spin_lock(&host->lock); #if 0 /* --- by chhung */ - if (sdio_pro_enable) { //=== for sdio profile === - if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) { - GPT_GetCounter64(&old_L32, &old_H32); - } - } + if (sdio_pro_enable) { //=== for sdio profile === + if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) + GPT_GetCounter64(&old_L32, &old_H32); + } #endif /* end of --- */ - - host->mrq = mrq; - if (msdc_do_request(mmc,mrq)) { - if(host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) { - msdc_tune_request(mmc,mrq); - } - } + host->mrq = mrq; - /* ==== when request done, check if app_cmd ==== */ - if (mrq->cmd->opcode == MMC_APP_CMD) { - host->app_cmd = 1; - host->app_cmd_arg = mrq->cmd->arg; /* save the RCA */ - } else { - host->app_cmd = 0; - //host->app_cmd_arg = 0; - } - - host->mrq = NULL; + if (msdc_do_request(mmc, mrq)) { + if (host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) + msdc_tune_request(mmc, mrq); + } + + /* ==== when request done, check if app_cmd ==== */ + if (mrq->cmd->opcode == MMC_APP_CMD) { + host->app_cmd = 1; + host->app_cmd_arg = mrq->cmd->arg; /* save the RCA */ + } else { + host->app_cmd = 0; + //host->app_cmd_arg = 0; + } + + host->mrq = NULL; #if 0 /* --- by chhung */ - //=== for sdio profile === - if (sdio_pro_enable) { - if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) { - GPT_GetCounter64(&new_L32, &new_H32); - ticks = msdc_time_calc(old_L32, old_H32, new_L32, new_H32); - - opcode = mrq->cmd->opcode; - if (mrq->cmd->data) { - sizes = mrq->cmd->data->blocks * mrq->cmd->data->blksz; - bRx = mrq->cmd->data->flags & MMC_DATA_READ ? 1 : 0 ; - } else { - bRx = mrq->cmd->arg & 0x80000000 ? 1 : 0; - } - - if (!mrq->cmd->error) { - msdc_performance(opcode, sizes, bRx, ticks); - } - } - } + //=== for sdio profile === + if (sdio_pro_enable) { + if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) { + GPT_GetCounter64(&new_L32, &new_H32); + ticks = msdc_time_calc(old_L32, old_H32, new_L32, new_H32); + + opcode = mrq->cmd->opcode; + if (mrq->cmd->data) { + sizes = mrq->cmd->data->blocks * mrq->cmd->data->blksz; + bRx = mrq->cmd->data->flags & MMC_DATA_READ ? 1 : 0; + } else { + bRx = mrq->cmd->arg & 0x80000000 ? 1 : 0; + } + + if (!mrq->cmd->error) + msdc_performance(opcode, sizes, bRx, ticks); + } + } #endif /* end of --- */ - spin_unlock(&host->lock); - - mmc_request_done(mmc, mrq); - - return; + spin_unlock(&host->lock); + + mmc_request_done(mmc, mrq); + + return; } /* called by ops.set_ios */ static void msdc_set_buswidth(struct msdc_host *host, u32 width) { - u32 base = host->base; - u32 val = sdr_read32(SDC_CFG); - - val &= ~SDC_CFG_BUSWIDTH; - - switch (width) { - default: - case MMC_BUS_WIDTH_1: - width = 1; - val |= (MSDC_BUS_1BITS << 16); - break; - case MMC_BUS_WIDTH_4: - val |= (MSDC_BUS_4BITS << 16); - break; - case MMC_BUS_WIDTH_8: - val |= (MSDC_BUS_8BITS << 16); - break; - } - - sdr_write32(SDC_CFG, val); + void __iomem *base = host->base; + u32 val = sdr_read32(SDC_CFG); - N_MSG(CFG, "Bus Width = %d", width); + val &= ~SDC_CFG_BUSWIDTH; + + switch (width) { + default: + case MMC_BUS_WIDTH_1: + width = 1; + val |= (MSDC_BUS_1BITS << 16); + break; + case MMC_BUS_WIDTH_4: + val |= (MSDC_BUS_4BITS << 16); + break; + case MMC_BUS_WIDTH_8: + val |= (MSDC_BUS_8BITS << 16); + break; + } + + sdr_write32(SDC_CFG, val); + + N_MSG(CFG, "Bus Width = %d", width); } /* ops.set_ios */ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { - struct msdc_host *host = mmc_priv(mmc); - struct msdc_hw *hw=host->hw; - u32 base = host->base; - u32 ddr = 0; + struct msdc_host *host = mmc_priv(mmc); + void __iomem *base = host->base; + u32 ddr = 0; #ifdef MT6575_SD_DEBUG - static char *vdd[] = { - "1.50v", "1.55v", "1.60v", "1.65v", "1.70v", "1.80v", "1.90v", - "2.00v", "2.10v", "2.20v", "2.30v", "2.40v", "2.50v", "2.60v", - "2.70v", "2.80v", "2.90v", "3.00v", "3.10v", "3.20v", "3.30v", - "3.40v", "3.50v", "3.60v" - }; - static char *power_mode[] = { - "OFF", "UP", "ON" - }; - static char *bus_mode[] = { - "UNKNOWN", "OPENDRAIN", "PUSHPULL" - }; - static char *timing[] = { - "LEGACY", "MMC_HS", "SD_HS" - }; + static char *vdd[] = { + "1.50v", "1.55v", "1.60v", "1.65v", "1.70v", "1.80v", "1.90v", + "2.00v", "2.10v", "2.20v", "2.30v", "2.40v", "2.50v", "2.60v", + "2.70v", "2.80v", "2.90v", "3.00v", "3.10v", "3.20v", "3.30v", + "3.40v", "3.50v", "3.60v" + }; + static char *power_mode[] = { + "OFF", "UP", "ON" + }; + static char *bus_mode[] = { + "UNKNOWN", "OPENDRAIN", "PUSHPULL" + }; + static char *timing[] = { + "LEGACY", "MMC_HS", "SD_HS" + }; - printk("SET_IOS: CLK(%dkHz), BUS(%s), BW(%u), PWR(%s), VDD(%s), TIMING(%s)", - ios->clock / 1000, bus_mode[ios->bus_mode], - (ios->bus_width == MMC_BUS_WIDTH_4) ? 4 : 1, - power_mode[ios->power_mode], vdd[ios->vdd], timing[ios->timing]); + printk("SET_IOS: CLK(%dkHz), BUS(%s), BW(%u), PWR(%s), VDD(%s), TIMING(%s)", + ios->clock / 1000, bus_mode[ios->bus_mode], + (ios->bus_width == MMC_BUS_WIDTH_4) ? 4 : 1, + power_mode[ios->power_mode], vdd[ios->vdd], timing[ios->timing]); #endif - msdc_set_buswidth(host, ios->bus_width); - - /* Power control ??? */ - switch (ios->power_mode) { - case MMC_POWER_OFF: - case MMC_POWER_UP: - // msdc_set_power_mode(host, ios->power_mode); /* --- by chhung */ - break; - case MMC_POWER_ON: - host->power_mode = MMC_POWER_ON; - break; - default: - break; - } + msdc_set_buswidth(host, ios->bus_width); - /* Clock control */ - if (host->mclk != ios->clock) { - if(ios->clock > 25000000) { - //if (!(host->hw->flags & MSDC_REMOVABLE)) { - INIT_MSG("SD data latch edge<%d>", hw->data_edge); - sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, hw->cmd_edge); - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, hw->data_edge); - //} /* for tuning debug */ - } else { /* default value */ - sdr_write32(MSDC_IOCON, 0x00000000); - // sdr_write32(MSDC_DAT_RDDLY0, 0x00000000); - sdr_write32(MSDC_DAT_RDDLY0, 0x10101010); // for MT7620 E2 and afterward - sdr_write32(MSDC_DAT_RDDLY1, 0x00000000); - // sdr_write32(MSDC_PAD_TUNE, 0x00000000); - sdr_write32(MSDC_PAD_TUNE, 0x84101010); // for MT7620 E2 and afterward - } - msdc_set_mclk(host, ddr, ios->clock); - } + /* Power control ??? */ + switch (ios->power_mode) { + case MMC_POWER_OFF: + case MMC_POWER_UP: + // msdc_set_power_mode(host, ios->power_mode); /* --- by chhung */ + break; + case MMC_POWER_ON: + host->power_mode = MMC_POWER_ON; + break; + default: + break; + } + + /* Clock control */ + if (host->mclk != ios->clock) { + if (ios->clock > 25000000) { + //if (!(host->hw->flags & MSDC_REMOVABLE)) { + INIT_MSG("SD data latch edge<%d>", MSDC_SMPL_FALLING); + sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, + MSDC_SMPL_FALLING); + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, + MSDC_SMPL_FALLING); + //} /* for tuning debug */ + } else { /* default value */ + sdr_write32(MSDC_IOCON, 0x00000000); + // sdr_write32(MSDC_DAT_RDDLY0, 0x00000000); + sdr_write32(MSDC_DAT_RDDLY0, 0x10101010); // for MT7620 E2 and afterward + sdr_write32(MSDC_DAT_RDDLY1, 0x00000000); + // sdr_write32(MSDC_PAD_TUNE, 0x00000000); + sdr_write32(MSDC_PAD_TUNE, 0x84101010); // for MT7620 E2 and afterward + } + msdc_set_mclk(host, ddr, ios->clock); + } } /* ops.get_ro */ static int msdc_ops_get_ro(struct mmc_host *mmc) { - struct msdc_host *host = mmc_priv(mmc); - u32 base = host->base; - unsigned long flags; - int ro = 0; + struct msdc_host *host = mmc_priv(mmc); + void __iomem *base = host->base; + unsigned long flags; + int ro = 0; - if (host->hw->flags & MSDC_WP_PIN_EN) { /* set for card */ - spin_lock_irqsave(&host->lock, flags); - ro = (sdr_read32(MSDC_PS) >> 31); - spin_unlock_irqrestore(&host->lock, flags); - } - return ro; + if (host->hw->flags & MSDC_WP_PIN_EN) { /* set for card */ + spin_lock_irqsave(&host->lock, flags); + ro = (sdr_read32(MSDC_PS) >> 31); + spin_unlock_irqrestore(&host->lock, flags); + } + return ro; } /* ops.get_cd */ static int msdc_ops_get_cd(struct mmc_host *mmc) { - struct msdc_host *host = mmc_priv(mmc); - u32 base = host->base; - unsigned long flags; - int present = 1; + struct msdc_host *host = mmc_priv(mmc); + void __iomem *base = host->base; + unsigned long flags; + int present = 1; - /* for sdio, MSDC_REMOVABLE not set, always return 1 */ - if (!(host->hw->flags & MSDC_REMOVABLE)) { - /* For sdio, read H/W always get<1>, but may timeout some times */ + /* for sdio, MSDC_REMOVABLE not set, always return 1 */ + if (!(host->hw->flags & MSDC_REMOVABLE)) { + /* For sdio, read H/W always get<1>, but may timeout some times */ #if 1 - host->card_inserted = 1; - return 1; + host->card_inserted = 1; + return 1; #else - host->card_inserted = (host->pm_state.event == PM_EVENT_USER_RESUME) ? 1 : 0; - INIT_MSG("sdio ops_get_cd<%d>", host->card_inserted); - return host->card_inserted; + host->card_inserted = (host->pm_state.event == PM_EVENT_USER_RESUME) ? 1 : 0; + INIT_MSG("sdio ops_get_cd<%d>", host->card_inserted); + return host->card_inserted; #endif - } + } - /* MSDC_CD_PIN_EN set for card */ - if (host->hw->flags & MSDC_CD_PIN_EN) { - spin_lock_irqsave(&host->lock, flags); -#if 0 - present = host->card_inserted; /* why not read from H/W: Fix me*/ + /* MSDC_CD_PIN_EN set for card */ + if (host->hw->flags & MSDC_CD_PIN_EN) { + spin_lock_irqsave(&host->lock, flags); +#if 0 + present = host->card_inserted; /* why not read from H/W: Fix me*/ #else - // CD - if (cd_active_low) - present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1; - else - present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 1 : 0; - if (host->mmc->caps & MMC_CAP_NEEDS_POLL) - present = 1; - host->card_inserted = present; -#endif - spin_unlock_irqrestore(&host->lock, flags); - } else { - present = 0; /* TODO? Check DAT3 pins for card detection */ - } + // CD + if (cd_active_low) + present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1; + else + present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 1 : 0; + host->card_inserted = present; +#endif + spin_unlock_irqrestore(&host->lock, flags); + } else { + present = 0; /* TODO? Check DAT3 pins for card detection */ + } - INIT_MSG("ops_get_cd return<%d>", present); - return present; -} - -/* ops.enable_sdio_irq */ -static void msdc_ops_enable_sdio_irq(struct mmc_host *mmc, int enable) -{ - struct msdc_host *host = mmc_priv(mmc); - struct msdc_hw *hw = host->hw; - u32 base = host->base; - u32 tmp; - - if (hw->flags & MSDC_EXT_SDIO_IRQ) { /* yes for sdio */ - if (enable) { - hw->enable_sdio_eirq(); /* combo_sdio_enable_eirq */ - } else { - hw->disable_sdio_eirq(); /* combo_sdio_disable_eirq */ - } - } else { - ERR_MSG("XXX "); /* so never enter here */ - tmp = sdr_read32(SDC_CFG); - /* FIXME. Need to interrupt gap detection */ - if (enable) { - tmp |= (SDC_CFG_SDIOIDE | SDC_CFG_SDIOINTWKUP); - } else { - tmp &= ~(SDC_CFG_SDIOIDE | SDC_CFG_SDIOINTWKUP); - } - sdr_write32(SDC_CFG, tmp); - } + INIT_MSG("ops_get_cd return<%d>", present); + return present; } static struct mmc_host_ops mt_msdc_ops = { - .request = msdc_ops_request, - .set_ios = msdc_ops_set_ios, - .get_ro = msdc_ops_get_ro, - .get_cd = msdc_ops_get_cd, - .enable_sdio_irq = msdc_ops_enable_sdio_irq, + .request = msdc_ops_request, + .set_ios = msdc_ops_set_ios, + .get_ro = msdc_ops_get_ro, + .get_cd = msdc_ops_get_cd, }; /*--------------------------------------------------------------------------*/ @@ -2378,150 +1880,135 @@ static struct mmc_host_ops mt_msdc_ops = { /*--------------------------------------------------------------------------*/ static irqreturn_t msdc_irq(int irq, void *dev_id) { - struct msdc_host *host = (struct msdc_host *)dev_id; - struct mmc_data *data = host->data; - struct mmc_command *cmd = host->cmd; - u32 base = host->base; - - u32 cmdsts = MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | MSDC_INT_CMDRDY | - MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | MSDC_INT_ACMDRDY | - MSDC_INT_ACMD19_DONE; - u32 datsts = MSDC_INT_DATCRCERR |MSDC_INT_DATTMO; + struct msdc_host *host = (struct msdc_host *)dev_id; + struct mmc_data *data = host->data; + struct mmc_command *cmd = host->cmd; + void __iomem *base = host->base; - u32 intsts = sdr_read32(MSDC_INT); - u32 inten = sdr_read32(MSDC_INTEN); inten &= intsts; + u32 cmdsts = MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | MSDC_INT_CMDRDY | + MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | MSDC_INT_ACMDRDY | + MSDC_INT_ACMD19_DONE; + u32 datsts = MSDC_INT_DATCRCERR | MSDC_INT_DATTMO; - sdr_write32(MSDC_INT, intsts); /* clear interrupts */ - /* MSG will cause fatal error */ - - /* card change interrupt */ - if (intsts & MSDC_INT_CDSC){ - if (mtk_sw_poll) - return IRQ_HANDLED; - IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts); -#if 0 /* ---/+++ by chhung: fix slot mechanical bounce issue */ - tasklet_hi_schedule(&host->card_tasklet); -#else - schedule_delayed_work(&host->card_delaywork, HZ); -#endif - /* tuning when plug card ? */ - } - - /* sdio interrupt */ - if (intsts & MSDC_INT_SDIOIRQ){ - IRQ_MSG("XXX MSDC_INT_SDIOIRQ"); /* seems not sdio irq */ - //mmc_signal_sdio_irq(host->mmc); - } + u32 intsts = sdr_read32(MSDC_INT); + u32 inten = sdr_read32(MSDC_INTEN); inten &= intsts; - /* transfer complete interrupt */ - if (data != NULL) { - if (inten & MSDC_INT_XFER_COMPL) { - data->bytes_xfered = host->dma.xfersz; - complete(&host->xfer_done); - } - - if (intsts & datsts) { - /* do basic reset, or stop command will sdc_busy */ - msdc_reset(); - msdc_clr_fifo(); - msdc_clr_int(); - atomic_set(&host->abort, 1); /* For PIO mode exit */ - - if (intsts & MSDC_INT_DATTMO){ - IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode); - data->error = (unsigned int)-ETIMEDOUT; - } - else if (intsts & MSDC_INT_DATCRCERR){ - IRQ_MSG("XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>", host->mrq->cmd->opcode, sdr_read32(SDC_DCRC_STS)); - data->error = (unsigned int)-EIO; - } - - //if(sdr_read32(MSDC_INTEN) & MSDC_INT_XFER_COMPL) { - if (host->dma_xfer) { - complete(&host->xfer_done); /* Read CRC come fast, XFER_COMPL not enabled */ - } /* PIO mode can't do complete, because not init */ - } - } + sdr_write32(MSDC_INT, intsts); /* clear interrupts */ + /* MSG will cause fatal error */ - /* command interrupts */ - if ((cmd != NULL) && (intsts & cmdsts)) { - if ((intsts & MSDC_INT_CMDRDY) || (intsts & MSDC_INT_ACMDRDY) || - (intsts & MSDC_INT_ACMD19_DONE)) { - u32 *rsp = &cmd->resp[0]; - - switch (host->cmd_rsp) { - case RESP_NONE: - break; - case RESP_R2: - *rsp++ = sdr_read32(SDC_RESP3); *rsp++ = sdr_read32(SDC_RESP2); - *rsp++ = sdr_read32(SDC_RESP1); *rsp++ = sdr_read32(SDC_RESP0); - break; - default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ - if ((intsts & MSDC_INT_ACMDRDY) || (intsts & MSDC_INT_ACMD19_DONE)) { - *rsp = sdr_read32(SDC_ACMD_RESP); - } else { - *rsp = sdr_read32(SDC_RESP0); - } - break; - } - } else if ((intsts & MSDC_INT_RSPCRCERR) || (intsts & MSDC_INT_ACMDCRCERR)) { - if(intsts & MSDC_INT_ACMDCRCERR){ - IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR",cmd->opcode); - } - else { - IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR",cmd->opcode); - } - cmd->error = (unsigned int)-EIO; - } else if ((intsts & MSDC_INT_CMDTMO) || (intsts & MSDC_INT_ACMDTMO)) { - if(intsts & MSDC_INT_ACMDTMO){ - IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO",cmd->opcode); - } - else { - IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO",cmd->opcode); - } - cmd->error = (unsigned int)-ETIMEDOUT; - msdc_reset(); - msdc_clr_fifo(); - msdc_clr_int(); - } - complete(&host->cmd_done); - } + /* card change interrupt */ + if (intsts & MSDC_INT_CDSC) { + if (host->mmc->caps & MMC_CAP_NEEDS_POLL) + return IRQ_HANDLED; + IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts); + schedule_delayed_work(&host->card_delaywork, HZ); + /* tuning when plug card ? */ + } + + /* sdio interrupt */ + if (intsts & MSDC_INT_SDIOIRQ) { + IRQ_MSG("XXX MSDC_INT_SDIOIRQ"); /* seems not sdio irq */ + //mmc_signal_sdio_irq(host->mmc); + } + + /* transfer complete interrupt */ + if (data != NULL) { + if (inten & MSDC_INT_XFER_COMPL) { + data->bytes_xfered = host->xfer_size; + complete(&host->xfer_done); + } + + if (intsts & datsts) { + /* do basic reset, or stop command will sdc_busy */ + msdc_reset_hw(host); + msdc_clr_fifo(); + msdc_clr_int(); + + if (intsts & MSDC_INT_DATTMO) { + IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode); + data->error = -ETIMEDOUT; + } else if (intsts & MSDC_INT_DATCRCERR) { + IRQ_MSG("XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>", host->mrq->cmd->opcode, sdr_read32(SDC_DCRC_STS)); + data->error = -EIO; + } + + //if(sdr_read32(MSDC_INTEN) & MSDC_INT_XFER_COMPL) { + complete(&host->xfer_done); /* Read CRC come fast, XFER_COMPL not enabled */ + } + } + + /* command interrupts */ + if ((cmd != NULL) && (intsts & cmdsts)) { + if ((intsts & MSDC_INT_CMDRDY) || (intsts & MSDC_INT_ACMDRDY) || + (intsts & MSDC_INT_ACMD19_DONE)) { + u32 *rsp = &cmd->resp[0]; + + switch (host->cmd_rsp) { + case RESP_NONE: + break; + case RESP_R2: + *rsp++ = sdr_read32(SDC_RESP3); *rsp++ = sdr_read32(SDC_RESP2); + *rsp++ = sdr_read32(SDC_RESP1); *rsp++ = sdr_read32(SDC_RESP0); + break; + default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ + if ((intsts & MSDC_INT_ACMDRDY) || (intsts & MSDC_INT_ACMD19_DONE)) + *rsp = sdr_read32(SDC_ACMD_RESP); + else + *rsp = sdr_read32(SDC_RESP0); + break; + } + } else if ((intsts & MSDC_INT_RSPCRCERR) || (intsts & MSDC_INT_ACMDCRCERR)) { + if (intsts & MSDC_INT_ACMDCRCERR) + IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR", cmd->opcode); + else + IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR", cmd->opcode); + cmd->error = -EIO; + } else if ((intsts & MSDC_INT_CMDTMO) || (intsts & MSDC_INT_ACMDTMO)) { + if (intsts & MSDC_INT_ACMDTMO) + IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO", cmd->opcode); + else + IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO", cmd->opcode); + cmd->error = -ETIMEDOUT; + msdc_reset_hw(host); + msdc_clr_fifo(); + msdc_clr_int(); + } + complete(&host->cmd_done); + } + + /* mmc irq interrupts */ + if (intsts & MSDC_INT_MMCIRQ) + printk(KERN_INFO "msdc[%d] MMCIRQ: SDC_CSTS=0x%.8x\r\n", host->id, sdr_read32(SDC_CSTS)); - /* mmc irq interrupts */ - if (intsts & MSDC_INT_MMCIRQ) { - printk(KERN_INFO "msdc[%d] MMCIRQ: SDC_CSTS=0x%.8x\r\n", host->id, sdr_read32(SDC_CSTS)); - } - #ifdef MT6575_SD_DEBUG - { - msdc_int_reg *int_reg = (msdc_int_reg*)&intsts; - N_MSG(INT, "IRQ_EVT(0x%x): MMCIRQ(%d) CDSC(%d), ACRDY(%d), ACTMO(%d), ACCRE(%d) AC19DN(%d)", - intsts, - int_reg->mmcirq, - int_reg->cdsc, - int_reg->atocmdrdy, - int_reg->atocmdtmo, - int_reg->atocmdcrc, - int_reg->atocmd19done); - N_MSG(INT, "IRQ_EVT(0x%x): SDIO(%d) CMDRDY(%d), CMDTMO(%d), RSPCRC(%d), CSTA(%d)", - intsts, - int_reg->sdioirq, - int_reg->cmdrdy, - int_reg->cmdtmo, - int_reg->rspcrc, - int_reg->csta); - N_MSG(INT, "IRQ_EVT(0x%x): XFCMP(%d) DXDONE(%d), DATTMO(%d), DATCRC(%d), DMAEMP(%d)", - intsts, - int_reg->xfercomp, - int_reg->dxferdone, - int_reg->dattmo, - int_reg->datcrc, - int_reg->dmaqempty); - - } + { +/* msdc_int_reg *int_reg = (msdc_int_reg*)&intsts;*/ + N_MSG(INT, "IRQ_EVT(0x%x): MMCIRQ(%d) CDSC(%d), ACRDY(%d), ACTMO(%d), ACCRE(%d) AC19DN(%d)", + intsts, + int_reg->mmcirq, + int_reg->cdsc, + int_reg->atocmdrdy, + int_reg->atocmdtmo, + int_reg->atocmdcrc, + int_reg->atocmd19done); + N_MSG(INT, "IRQ_EVT(0x%x): SDIO(%d) CMDRDY(%d), CMDTMO(%d), RSPCRC(%d), CSTA(%d)", + intsts, + int_reg->sdioirq, + int_reg->cmdrdy, + int_reg->cmdtmo, + int_reg->rspcrc, + int_reg->csta); + N_MSG(INT, "IRQ_EVT(0x%x): XFCMP(%d) DXDONE(%d), DATTMO(%d), DATCRC(%d), DMAEMP(%d)", + intsts, + int_reg->xfercomp, + int_reg->dxferdone, + int_reg->dattmo, + int_reg->datcrc, + int_reg->dmaqempty); + } #endif - - return IRQ_HANDLED; + + return IRQ_HANDLED; } /*--------------------------------------------------------------------------*/ @@ -2531,15 +2018,15 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) static void msdc_enable_cd_irq(struct msdc_host *host, int enable) { struct msdc_hw *hw = host->hw; - u32 base = host->base; + void __iomem *base = host->base; /* for sdio, not set */ if ((hw->flags & MSDC_CD_PIN_EN) == 0) { /* Pull down card detection pin since it is not avaiable */ /* - if (hw->config_gpio_pin) - hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN); - */ + if (hw->config_gpio_pin) + hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN); + */ sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); sdr_clr_bits(MSDC_INTEN, MSDC_INTEN_CDSC); sdr_clr_bits(SDC_CFG, SDC_CFG_INSWKUP); @@ -2549,452 +2036,378 @@ static void msdc_enable_cd_irq(struct msdc_host *host, int enable) N_MSG(CFG, "CD IRQ Eanable(%d)", enable); if (enable) { - if (hw->enable_cd_eirq) { /* not set, never enter */ - hw->enable_cd_eirq(); - } else { - /* card detection circuit relies on the core power so that the core power - * shouldn't be turned off. Here adds a reference count to keep - * the core power alive. - */ - //msdc_vcore_on(host); //did in msdc_init_hw() + /* card detection circuit relies on the core power so that the core power + * shouldn't be turned off. Here adds a reference count to keep + * the core power alive. + */ + //msdc_vcore_on(host); //did in msdc_init_hw() - if (hw->config_gpio_pin) /* NULL */ - hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_UP); + if (hw->config_gpio_pin) /* NULL */ + hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_UP); - sdr_set_field(MSDC_PS, MSDC_PS_CDDEBOUNCE, DEFAULT_DEBOUNCE); - sdr_set_bits(MSDC_PS, MSDC_PS_CDEN); - sdr_set_bits(MSDC_INTEN, MSDC_INTEN_CDSC); - sdr_set_bits(SDC_CFG, SDC_CFG_INSWKUP); /* not in document! Fix me */ - } - } else { - if (hw->disable_cd_eirq) { - hw->disable_cd_eirq(); - } else { - if (hw->config_gpio_pin) /* NULL */ - hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN); + sdr_set_field(MSDC_PS, MSDC_PS_CDDEBOUNCE, DEFAULT_DEBOUNCE); + sdr_set_bits(MSDC_PS, MSDC_PS_CDEN); + sdr_set_bits(MSDC_INTEN, MSDC_INTEN_CDSC); + sdr_set_bits(SDC_CFG, SDC_CFG_INSWKUP); /* not in document! Fix me */ + } else { + if (hw->config_gpio_pin) /* NULL */ + hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN); - sdr_clr_bits(SDC_CFG, SDC_CFG_INSWKUP); - sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); - sdr_clr_bits(MSDC_INTEN, MSDC_INTEN_CDSC); + sdr_clr_bits(SDC_CFG, SDC_CFG_INSWKUP); + sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); + sdr_clr_bits(MSDC_INTEN, MSDC_INTEN_CDSC); - /* Here decreases a reference count to core power since card - * detection circuit is shutdown. - */ - //msdc_vcore_off(host); - } - } + /* Here decreases a reference count to core power since card + * detection circuit is shutdown. + */ + //msdc_vcore_off(host); + } } /* called by msdc_drv_probe */ static void msdc_init_hw(struct msdc_host *host) { - u32 base = host->base; - struct msdc_hw *hw = host->hw; + void __iomem *base = host->base; - /* Power on */ + /* Power on */ #if 0 /* --- by chhung */ - msdc_vcore_on(host); - msdc_pin_reset(host, MSDC_PIN_PULL_UP); - msdc_select_clksrc(host, hw->clk_src); - enable_clock(PERI_MSDC0_PDN + host->id, "SD"); - msdc_vdd_on(host); + msdc_vcore_on(host); + msdc_pin_reset(host, MSDC_PIN_PULL_UP); + msdc_select_clksrc(host, hw->clk_src); + enable_clock(PERI_MSDC0_PDN + host->id, "SD"); + msdc_vdd_on(host); #endif /* end of --- */ - /* Configure to MMC/SD mode */ - sdr_set_field(MSDC_CFG, MSDC_CFG_MODE, MSDC_SDMMC); - - /* Reset */ - msdc_reset(); - msdc_clr_fifo(); + /* Configure to MMC/SD mode */ + sdr_set_field(MSDC_CFG, MSDC_CFG_MODE, MSDC_SDMMC); - /* Disable card detection */ - sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); + /* Reset */ + msdc_reset_hw(host); + msdc_clr_fifo(); + + /* Disable card detection */ + sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); + + /* Disable and clear all interrupts */ + sdr_clr_bits(MSDC_INTEN, sdr_read32(MSDC_INTEN)); + sdr_write32(MSDC_INT, sdr_read32(MSDC_INT)); - /* Disable and clear all interrupts */ - sdr_clr_bits(MSDC_INTEN, sdr_read32(MSDC_INTEN)); - sdr_write32(MSDC_INT, sdr_read32(MSDC_INT)); - #if 1 /* reset tuning parameter */ - sdr_write32(MSDC_PAD_CTL0, 0x00090000); - sdr_write32(MSDC_PAD_CTL1, 0x000A0000); - sdr_write32(MSDC_PAD_CTL2, 0x000A0000); - // sdr_write32(MSDC_PAD_TUNE, 0x00000000); - sdr_write32(MSDC_PAD_TUNE, 0x84101010); // for MT7620 E2 and afterward - // sdr_write32(MSDC_DAT_RDDLY0, 0x00000000); - sdr_write32(MSDC_DAT_RDDLY0, 0x10101010); // for MT7620 E2 and afterward - sdr_write32(MSDC_DAT_RDDLY1, 0x00000000); - sdr_write32(MSDC_IOCON, 0x00000000); + sdr_write32(MSDC_PAD_CTL0, 0x00090000); + sdr_write32(MSDC_PAD_CTL1, 0x000A0000); + sdr_write32(MSDC_PAD_CTL2, 0x000A0000); + // sdr_write32(MSDC_PAD_TUNE, 0x00000000); + sdr_write32(MSDC_PAD_TUNE, 0x84101010); // for MT7620 E2 and afterward + // sdr_write32(MSDC_DAT_RDDLY0, 0x00000000); + sdr_write32(MSDC_DAT_RDDLY0, 0x10101010); // for MT7620 E2 and afterward + sdr_write32(MSDC_DAT_RDDLY1, 0x00000000); + sdr_write32(MSDC_IOCON, 0x00000000); #if 0 // use MT7620 default value: 0x403c004f - sdr_write32(MSDC_PATCH_BIT0, 0x003C000F); /* bit0 modified: Rx Data Clock Source: 1 -> 2.0*/ + sdr_write32(MSDC_PATCH_BIT0, 0x003C000F); /* bit0 modified: Rx Data Clock Source: 1 -> 2.0*/ #endif - if (sdr_read32(MSDC_ECO_VER) >= 4) { - if (host->id == 1) { - sdr_set_field(MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_WRDAT_CRCS, 1); - sdr_set_field(MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_CMD_RSP, 1); - - /* internal clock: latch read data */ - sdr_set_bits(MSDC_PATCH_BIT0, MSDC_PATCH_BIT_CKGEN_CK); - } - } -#endif + if (sdr_read32(MSDC_ECO_VER) >= 4) { + if (host->id == 1) { + sdr_set_field(MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_WRDAT_CRCS, 1); + sdr_set_field(MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_CMD_RSP, 1); - /* for safety, should clear SDC_CFG.SDIO_INT_DET_EN & set SDC_CFG.SDIO in - pre-loader,uboot,kernel drivers. and SDC_CFG.SDIO_INT_DET_EN will be only - set when kernel driver wants to use SDIO bus interrupt */ - /* Configure to enable SDIO mode. it's must otherwise sdio cmd5 failed */ - sdr_set_bits(SDC_CFG, SDC_CFG_SDIO); + /* internal clock: latch read data */ + sdr_set_bits(MSDC_PATCH_BIT0, MSDC_PATCH_BIT_CKGEN_CK); + } + } +#endif - /* disable detect SDIO device interupt function */ - sdr_clr_bits(SDC_CFG, SDC_CFG_SDIOIDE); + /* for safety, should clear SDC_CFG.SDIO_INT_DET_EN & set SDC_CFG.SDIO in + pre-loader,uboot,kernel drivers. and SDC_CFG.SDIO_INT_DET_EN will be only + set when kernel driver wants to use SDIO bus interrupt */ + /* Configure to enable SDIO mode. it's must otherwise sdio cmd5 failed */ + sdr_set_bits(SDC_CFG, SDC_CFG_SDIO); - /* eneable SMT for glitch filter */ - sdr_set_bits(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKSMT); - sdr_set_bits(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDSMT); - sdr_set_bits(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATSMT); + /* disable detect SDIO device interupt function */ + sdr_clr_bits(SDC_CFG, SDC_CFG_SDIOIDE); + + /* eneable SMT for glitch filter */ + sdr_set_bits(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKSMT); + sdr_set_bits(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDSMT); + sdr_set_bits(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATSMT); #if 1 - /* set clk, cmd, dat pad driving */ - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, hw->clk_drv); - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, hw->clk_drv); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, hw->cmd_drv); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, hw->cmd_drv); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, hw->dat_drv); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, hw->dat_drv); -#else - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, 0); - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 0); + /* set clk, cmd, dat pad driving */ + sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, 4); + sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 4); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 4); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 4); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 4); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 4); +#else + sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, 0); + sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 0); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 0); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 0); #endif - /* set sampling edge */ + /* set sampling edge */ - /* write crc timeout detection */ - sdr_set_field(MSDC_PATCH_BIT0, 1 << 30, 1); + /* write crc timeout detection */ + sdr_set_field(MSDC_PATCH_BIT0, 1 << 30, 1); - /* Configure to default data timeout */ - sdr_set_field(SDC_CFG, SDC_CFG_DTOC, DEFAULT_DTOC); + /* Configure to default data timeout */ + sdr_set_field(SDC_CFG, SDC_CFG_DTOC, DEFAULT_DTOC); - msdc_set_buswidth(host, MMC_BUS_WIDTH_1); + msdc_set_buswidth(host, MMC_BUS_WIDTH_1); - N_MSG(FUC, "init hardware done!"); + N_MSG(FUC, "init hardware done!"); } /* called by msdc_drv_remove */ static void msdc_deinit_hw(struct msdc_host *host) { - u32 base = host->base; + void __iomem *base = host->base; - /* Disable and clear all interrupts */ - sdr_clr_bits(MSDC_INTEN, sdr_read32(MSDC_INTEN)); - sdr_write32(MSDC_INT, sdr_read32(MSDC_INT)); + /* Disable and clear all interrupts */ + sdr_clr_bits(MSDC_INTEN, sdr_read32(MSDC_INTEN)); + sdr_write32(MSDC_INT, sdr_read32(MSDC_INT)); - /* Disable card detection */ - msdc_enable_cd_irq(host, 0); - // msdc_set_power_mode(host, MMC_POWER_OFF); /* make sure power down */ /* --- by chhung */ + /* Disable card detection */ + msdc_enable_cd_irq(host, 0); + // msdc_set_power_mode(host, MMC_POWER_OFF); /* make sure power down */ /* --- by chhung */ } /* init gpd and bd list in msdc_drv_probe */ static void msdc_init_gpd_bd(struct msdc_host *host, struct msdc_dma *dma) { - gpd_t *gpd = dma->gpd; - bd_t *bd = dma->bd; - bd_t *ptr, *prev; - - /* we just support one gpd */ - int bdlen = MAX_BD_PER_GPD; + struct gpd *gpd = dma->gpd; + struct bd *bd = dma->bd; + int i; - /* init the 2 gpd */ - memset(gpd, 0, sizeof(gpd_t) * 2); - //gpd->next = (void *)virt_to_phys(gpd + 1); /* pointer to a null gpd, bug! kmalloc <-> virt_to_phys */ - //gpd->next = (dma->gpd_addr + 1); /* bug */ - gpd->next = (void *)((u32)dma->gpd_addr + sizeof(gpd_t)); + /* we just support one gpd, but gpd->next must be set for desc + * DMA. That's why we alloc 2 gpd structurs. + */ - //gpd->intr = 0; - gpd->bdp = 1; /* hwo, cs, bd pointer */ - //gpd->ptr = (void*)virt_to_phys(bd); - gpd->ptr = (void *)dma->bd_addr; /* physical address */ - - memset(bd, 0, sizeof(bd_t) * bdlen); - ptr = bd + bdlen - 1; - //ptr->eol = 1; /* 0 or 1 [Fix me]*/ - //ptr->next = 0; - - while (ptr != bd) { - prev = ptr - 1; - prev->next = (void *)(dma->bd_addr + sizeof(bd_t) *(ptr - bd)); - ptr = prev; - } + memset(gpd, 0, sizeof(struct gpd) * 2); + + gpd->bdp = 1; /* hwo, cs, bd pointer */ + gpd->ptr = (void *)dma->bd_addr; /* physical address */ + gpd->next = (void *)((u32)dma->gpd_addr + sizeof(struct gpd)); + + memset(bd, 0, sizeof(struct bd) * MAX_BD_NUM); + for (i = 0; i < (MAX_BD_NUM - 1); i++) + bd[i].next = (void *)(dma->bd_addr + sizeof(*bd) * (i + 1)); } static int msdc_drv_probe(struct platform_device *pdev) { - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - __iomem void *base; - struct mmc_host *mmc; - struct resource *mem; - struct msdc_host *host; - struct msdc_hw *hw; - int ret, irq; + struct resource *res; + __iomem void *base; + struct mmc_host *mmc; + struct msdc_host *host; + struct msdc_hw *hw; + int ret; u32 reg; - printk("MTK MSDC device init.\n"); - mtk_sd_device.dev.platform_data = &msdc0_hw; - if (ralink_soc == MT762X_SOC_MT7620A || ralink_soc == MT762X_SOC_MT7621AT) { - //#if defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3<<18); - //#if defined (CONFIG_RALINK_MT7620) - if (ralink_soc == MT762X_SOC_MT7620A) - reg |= 0x1<<18; - //#endif - } else { - //#elif defined (CONFIG_RALINK_MT7628) - /* TODO: maybe omitted when RAether already toggle AGPIO_CFG */ - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x3c)); + //FIXME: this should be done by pinconf and not by the sd driver + if (ralink_soc == MT762X_SOC_MT7688 || + ralink_soc == MT762X_SOC_MT7628AN) { + /* set EPHY pads to digital mode */ + reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c)); reg |= 0x1e << 16; - sdr_write32((volatile u32*)(RALINK_SYSCTL_BASE + 0x3c), reg); - - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3<<10); -#if defined (CONFIG_MTK_MMC_EMMC_8BIT) - reg |= 0x3<<26 | 0x3<<28 | 0x3<<30; - msdc0_hw.data_pins = 8, -#endif - //#endif + sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c), reg); } - sdr_write32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60), reg); - //platform_device_register(&mtk_sd_device); -/* end of +++ */ - - pdev->dev.platform_data = &msdc0_hw; - - if (of_property_read_bool(pdev->dev.of_node, "mtk,wp-en")) - msdc0_hw.flags |= MSDC_WP_PIN_EN; - - /* Allocate MMC host for this device */ - mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); - if (!mmc) return -ENOMEM; - hw = (struct msdc_hw*)pdev->dev.platform_data; - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - irq = platform_get_irq(pdev, 0); + hw = &msdc0_hw; - //BUG_ON((!hw) || (!mem) || (irq < 0)); /* --- by chhung */ - - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); + if (of_property_read_bool(pdev->dev.of_node, "mtk,wp-en")) + msdc0_hw.flags |= MSDC_WP_PIN_EN; - /* Set host parameters to mmc */ - mmc->ops = &mt_msdc_ops; - mmc->f_min = HOST_MIN_MCLK; - mmc->f_max = HOST_MAX_MCLK; - mmc->ocr_avail = MSDC_OCR_AVAIL; - - /* For sd card: MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED, - For sdio : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */ - if (hw->flags & MSDC_HIGHSPEED) { - mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; - } - if (hw->data_pins == 4) { /* current data_pins are all 4*/ - mmc->caps |= MMC_CAP_4_BIT_DATA; - } else if (hw->data_pins == 8) { - mmc->caps |= MMC_CAP_8_BIT_DATA; - } - if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ)) - mmc->caps |= MMC_CAP_SDIO_IRQ; /* yes for sdio */ + /* Allocate MMC host for this device */ + mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); + if (!mmc) + return -ENOMEM; - cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high"); - mtk_sw_poll = of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll"); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + goto host_free; + } - if (mtk_sw_poll) - mmc->caps |= MMC_CAP_NEEDS_POLL; + /* Set host parameters to mmc */ + mmc->ops = &mt_msdc_ops; + mmc->f_min = HOST_MIN_MCLK; + mmc->f_max = HOST_MAX_MCLK; + mmc->ocr_avail = MSDC_OCR_AVAIL; - /* MMC core transfer sizes tunable parameters */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,10,0) - mmc->max_segs = MAX_HW_SGMTS; -#else - mmc->max_hw_segs = MAX_HW_SGMTS; - mmc->max_phys_segs = MAX_PHY_SGMTS; -#endif - mmc->max_seg_size = MAX_SGMT_SZ; - mmc->max_blk_size = HOST_MAX_BLKSZ; - mmc->max_req_size = MAX_REQ_SZ; - mmc->max_blk_count = mmc->max_req_size; + mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; - host = mmc_priv(mmc); - host->hw = hw; - host->mmc = mmc; - host->id = 0; - host->error = 0; - host->irq = irq; - host->base = (unsigned long) base; - host->mclk = 0; /* mclk: the request clock of mmc sub-system */ - host->hclk = hclks[hw->clk_src]; /* hclk: clock of clock source to msdc controller */ - host->sclk = 0; /* sclk: the really clock after divition */ - host->pm_state = PMSG_RESUME; - host->suspend = 0; - host->core_clkon = 0; - host->card_clkon = 0; - host->core_power = 0; - host->power_mode = MMC_POWER_OFF; + //TODO: read this as bus-width from dt (via mmc_of_parse) + mmc->caps |= MMC_CAP_4_BIT_DATA; + + cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high"); + + if (of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll")) + mmc->caps |= MMC_CAP_NEEDS_POLL; + + /* MMC core transfer sizes tunable parameters */ + mmc->max_segs = MAX_HW_SGMTS; + + mmc->max_seg_size = MAX_SGMT_SZ; + mmc->max_blk_size = HOST_MAX_BLKSZ; + mmc->max_req_size = MAX_REQ_SZ; + mmc->max_blk_count = mmc->max_req_size; + + host = mmc_priv(mmc); + host->hw = hw; + host->mmc = mmc; + host->id = pdev->id; + if (host->id < 0 || host->id >= 4) + host->id = 0; + host->error = 0; + + host->irq = platform_get_irq(pdev, 0); + if (host->irq < 0) { + ret = -EINVAL; + goto host_free; + } + + host->base = base; + host->mclk = 0; /* mclk: the request clock of mmc sub-system */ + host->hclk = hclks[hw->clk_src]; /* hclk: clock of clock source to msdc controller */ + host->sclk = 0; /* sclk: the really clock after divition */ + host->pm_state = PMSG_RESUME; + host->suspend = 0; + host->core_clkon = 0; + host->card_clkon = 0; + host->core_power = 0; + host->power_mode = MMC_POWER_OFF; // host->card_inserted = hw->flags & MSDC_REMOVABLE ? 0 : 1; - host->timeout_ns = 0; - host->timeout_clks = DEFAULT_DTOC * 65536; - - host->mrq = NULL; - //init_MUTEX(&host->sem); /* we don't need to support multiple threads access */ - - host->dma.used_gpd = 0; - host->dma.used_bd = 0; - mmc_dev(mmc)->dma_mask = NULL; + host->timeout_ns = 0; + host->timeout_clks = DEFAULT_DTOC * 65536; - /* using dma_alloc_coherent*/ /* todo: using 1, for all 4 slots */ - host->dma.gpd = dma_alloc_coherent(NULL, MAX_GPD_NUM * sizeof(gpd_t), &host->dma.gpd_addr, GFP_KERNEL); - host->dma.bd = dma_alloc_coherent(NULL, MAX_BD_NUM * sizeof(bd_t), &host->dma.bd_addr, GFP_KERNEL); - BUG_ON((!host->dma.gpd) || (!host->dma.bd)); - msdc_init_gpd_bd(host, &host->dma); - -#if 0 - tasklet_init(&host->card_tasklet, msdc_tasklet_card, (ulong)host); -#else - INIT_DELAYED_WORK(&host->card_delaywork, msdc_tasklet_card); -#endif - spin_lock_init(&host->lock); - msdc_init_hw(host); + host->mrq = NULL; + //init_MUTEX(&host->sem); /* we don't need to support multiple threads access */ - if (ralink_soc == MT762X_SOC_MT7621AT) - ret = request_irq((unsigned int)irq, msdc_irq, 0, dev_name(&pdev->dev), host); - else - ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host); + mmc_dev(mmc)->dma_mask = NULL; - if (ret) goto release; - // mt65xx_irq_unmask(irq); /* --- by chhung */ - - if (hw->flags & MSDC_CD_PIN_EN) { /* not set for sdio */ - if (hw->request_cd_eirq) { /* not set for MT6575 */ - hw->request_cd_eirq(msdc_eirq_cd, (void*)host); /* msdc_eirq_cd will not be used! */ - } - } + /* using dma_alloc_coherent*/ /* todo: using 1, for all 4 slots */ + host->dma.gpd = dma_alloc_coherent(&pdev->dev, + MAX_GPD_NUM * sizeof(struct gpd), + &host->dma.gpd_addr, GFP_KERNEL); + host->dma.bd = dma_alloc_coherent(&pdev->dev, + MAX_BD_NUM * sizeof(struct bd), + &host->dma.bd_addr, GFP_KERNEL); + if (!host->dma.gpd || !host->dma.bd) { + ret = -ENOMEM; + goto release_mem; + } + msdc_init_gpd_bd(host, &host->dma); - if (hw->request_sdio_eirq) /* set to combo_sdio_request_eirq() for WIFI */ - hw->request_sdio_eirq(msdc_eirq_sdio, (void*)host); /* msdc_eirq_sdio() will be called when EIRQ */ + INIT_DELAYED_WORK(&host->card_delaywork, msdc_tasklet_card); + spin_lock_init(&host->lock); + msdc_init_hw(host); - if (hw->register_pm) {/* yes for sdio */ -#ifdef CONFIG_PM - hw->register_pm(msdc_pm, (void*)host); /* combo_sdio_register_pm() */ -#endif - if(hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ - ERR_MSG("MSDC_SYS_SUSPEND and register_pm both set"); - } - //mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* pm not controlled by system but by client. */ /* --- by chhung */ - } - - platform_set_drvdata(pdev, mmc); + /* TODO check weather flags 0 is correct, the mtk-sd driver uses + * IRQF_TRIGGER_LOW | IRQF_ONESHOT for flags + * + * for flags 0 the trigger polarity is determined by the + * device tree, but not the oneshot flag, but maybe it is also + * not needed because the soc could be oneshot safe. + */ + ret = devm_request_irq(&pdev->dev, host->irq, msdc_irq, 0, pdev->name, + host); + if (ret) + goto release; - ret = mmc_add_host(mmc); - if (ret) goto free_irq; + platform_set_drvdata(pdev, mmc); - /* Config card detection pin and enable interrupts */ - if (hw->flags & MSDC_CD_PIN_EN) { /* set for card */ - msdc_enable_cd_irq(host, 1); - } else { - msdc_enable_cd_irq(host, 0); - } + ret = mmc_add_host(mmc); + if (ret) + goto release; - return 0; + /* Config card detection pin and enable interrupts */ + if (hw->flags & MSDC_CD_PIN_EN) { /* set for card */ + msdc_enable_cd_irq(host, 1); + } else { + msdc_enable_cd_irq(host, 0); + } + + return 0; -free_irq: - free_irq(irq, host); release: - platform_set_drvdata(pdev, NULL); - msdc_deinit_hw(host); + platform_set_drvdata(pdev, NULL); + msdc_deinit_hw(host); + cancel_delayed_work_sync(&host->card_delaywork); -#if 0 - tasklet_kill(&host->card_tasklet); -#else - cancel_delayed_work_sync(&host->card_delaywork); -#endif +release_mem: + if (host->dma.gpd) + dma_free_coherent(&pdev->dev, MAX_GPD_NUM * sizeof(struct gpd), + host->dma.gpd, host->dma.gpd_addr); + if (host->dma.bd) + dma_free_coherent(&pdev->dev, MAX_BD_NUM * sizeof(struct bd), + host->dma.bd, host->dma.bd_addr); +host_free: + mmc_free_host(mmc); - if (mem) - release_mem_region(mem->start, mem->end - mem->start + 1); - - mmc_free_host(mmc); - - return ret; + return ret; } /* 4 device share one driver, using "drvdata" to show difference */ static int msdc_drv_remove(struct platform_device *pdev) { - struct mmc_host *mmc; - struct msdc_host *host; - struct resource *mem; + struct mmc_host *mmc; + struct msdc_host *host; - mmc = platform_get_drvdata(pdev); - BUG_ON(!mmc); - - host = mmc_priv(mmc); - BUG_ON(!host); + mmc = platform_get_drvdata(pdev); + BUG_ON(!mmc); - ERR_MSG("removed !!!"); + host = mmc_priv(mmc); + BUG_ON(!host); - platform_set_drvdata(pdev, NULL); - mmc_remove_host(host->mmc); - msdc_deinit_hw(host); + ERR_MSG("removed !!!"); -#if 0 - tasklet_kill(&host->card_tasklet); -#else - cancel_delayed_work_sync(&host->card_delaywork); -#endif - free_irq(host->irq, host); + platform_set_drvdata(pdev, NULL); + mmc_remove_host(host->mmc); + msdc_deinit_hw(host); - dma_free_coherent(NULL, MAX_GPD_NUM * sizeof(gpd_t), host->dma.gpd, host->dma.gpd_addr); - dma_free_coherent(NULL, MAX_BD_NUM * sizeof(bd_t), host->dma.bd, host->dma.bd_addr); + cancel_delayed_work_sync(&host->card_delaywork); - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + dma_free_coherent(&pdev->dev, MAX_GPD_NUM * sizeof(struct gpd), + host->dma.gpd, host->dma.gpd_addr); + dma_free_coherent(&pdev->dev, MAX_BD_NUM * sizeof(struct bd), + host->dma.bd, host->dma.bd_addr); - if (mem) - release_mem_region(mem->start, mem->end - mem->start + 1); + mmc_free_host(host->mmc); - mmc_free_host(host->mmc); - - return 0; + return 0; } /* Fix me: Power Flow */ #ifdef CONFIG_PM + +static void msdc_drv_pm(struct platform_device *pdev, pm_message_t state) +{ + struct mmc_host *mmc = platform_get_drvdata(pdev); + if (mmc) { + struct msdc_host *host = mmc_priv(mmc); + msdc_pm(state, (void *)host); + } +} + static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state) { - int ret = 0; - struct mmc_host *mmc = platform_get_drvdata(pdev); - struct msdc_host *host = mmc_priv(mmc); - - if (mmc && state.event == PM_EVENT_SUSPEND && (host->hw->flags & MSDC_SYS_SUSPEND)) { /* will set for card */ - msdc_pm(state, (void*)host); - } - - return ret; + if (state.event == PM_EVENT_SUSPEND) + msdc_drv_pm(pdev, state); + return 0; } static int msdc_drv_resume(struct platform_device *pdev) { - int ret = 0; - struct mmc_host *mmc = platform_get_drvdata(pdev); - struct msdc_host *host = mmc_priv(mmc); - struct pm_message state; + struct pm_message state; - state.event = PM_EVENT_RESUME; - if (mmc && (host->hw->flags & MSDC_SYS_SUSPEND)) {/* will set for card */ - msdc_pm(state, (void*)host); - } - - /* This mean WIFI not controller by PM */ - - return ret; + state.event = PM_EVENT_RESUME; + msdc_drv_pm(pdev, state); + return 0; } #endif @@ -3005,16 +2418,16 @@ static const struct of_device_id mt7620_sdhci_match[] = { MODULE_DEVICE_TABLE(of, mt7620_sdhci_match); static struct platform_driver mt_msdc_driver = { - .probe = msdc_drv_probe, - .remove = msdc_drv_remove, + .probe = msdc_drv_probe, + .remove = msdc_drv_remove, #ifdef CONFIG_PM - .suspend = msdc_drv_suspend, - .resume = msdc_drv_resume, + .suspend = msdc_drv_suspend, + .resume = msdc_drv_resume, #endif - .driver = { - .name = DRV_NAME, - .of_match_table = mt7620_sdhci_match, - }, + .driver = { + .name = DRV_NAME, + .of_match_table = mt7620_sdhci_match, + }, }; /*--------------------------------------------------------------------------*/ @@ -3022,27 +2435,27 @@ static struct platform_driver mt_msdc_driver = { /*--------------------------------------------------------------------------*/ static int __init mt_msdc_init(void) { - int ret; + int ret; - ret = platform_driver_register(&mt_msdc_driver); - if (ret) { - printk(KERN_ERR DRV_NAME ": Can't register driver"); - return ret; - } - printk(KERN_INFO DRV_NAME ": MediaTek MT6575 MSDC Driver\n"); + ret = platform_driver_register(&mt_msdc_driver); + if (ret) { + printk(KERN_ERR DRV_NAME ": Can't register driver"); + return ret; + } -#if defined (MT6575_SD_DEBUG) - msdc_debug_proc_init(); +#if defined(MT6575_SD_DEBUG) + msdc_debug_proc_init(); #endif - return 0; + return 0; } static void __exit mt_msdc_exit(void) { -// platform_device_unregister(&mtk_sd_device); - platform_driver_unregister(&mt_msdc_driver); + platform_driver_unregister(&mt_msdc_driver); } module_init(mt_msdc_init); module_exit(mt_msdc_exit); MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("MediaTek MT6575 SD/MMC Card Driver"); +MODULE_AUTHOR("Infinity Chen "); diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Kconfig b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Kconfig similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Kconfig rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Kconfig diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Makefile b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Makefile similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Makefile rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Makefile diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c similarity index 88% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c index a4602c458..ffcf70c45 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c @@ -60,8 +60,31 @@ static irqreturn_t gsw_interrupt_mt7620(int irq, void *_priv) return IRQ_HANDLED; } -static void mt7620_hw_init(struct mt7620_gsw *gsw, struct device_node *np) +static int mt7620_mdio_mode(struct device_node *eth_node) { + struct device_node *phy_node, *mdiobus_node; + const __be32 *id; + int ret = 0; + + mdiobus_node = of_get_child_by_name(eth_node, "mdio-bus"); + + if (mdiobus_node) { + for_each_child_of_node(mdiobus_node, phy_node) { + id = of_get_property(phy_node, "reg", NULL); + if (id && (be32_to_cpu(*id) == 0x1f)) + ret = 1; + } + + of_node_put(mdiobus_node); + } + + return ret; +} + +static void mt7620_hw_init(struct mt7620_gsw *gsw, int mdio_mode) +{ + u32 i; + u32 val; u32 is_BGA = (rt_sysc_r32(0x0c) >> 16) & 1; rt_sysc_w32(rt_sysc_r32(SYSC_REG_CFG1) | BIT(8), SYSC_REG_CFG1); @@ -70,7 +93,7 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, struct device_node *np) /* Enable MIB stats */ mtk_switch_w32(gsw, mtk_switch_r32(gsw, GSW_REG_MIB_CNT_EN) | (1 << 1), GSW_REG_MIB_CNT_EN); - if (of_property_read_bool(np, "mediatek,mt7530")) { + if (mdio_mode) { u32 val; /* turn off ephy and set phy base addr to 12 */ @@ -130,6 +153,13 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, struct device_node *np) /* global page 1 */ _mt7620_mii_write(gsw, 1, 31, 0x1000); _mt7620_mii_write(gsw, 1, 17, 0xe7f8); + + /* turn on all PHYs */ + for (i = 0; i <= 4; i++) { + val = _mt7620_mii_read(gsw, i, 0); + val &= ~BIT(11); + _mt7620_mii_write(gsw, i, 0, val); + } } /* global page 0 */ @@ -166,8 +196,13 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, struct device_node *np) _mt7620_mii_write(gsw, 4, 30, 0xa000); _mt7620_mii_write(gsw, 4, 4, 0x05e1); _mt7620_mii_write(gsw, 4, 16, 0x1313); - _mt7620_mii_write(gsw, 4, 0, 0x3100); pr_info("gsw: setting port4 to ephy mode\n"); + } else if (!mdio_mode) { + u32 val = rt_sysc_r32(SYSC_REG_CFG1); + + val &= ~(3 << 14); + rt_sysc_w32(val, SYSC_REG_CFG1); + pr_info("gsw: setting port4 to gmac mode\n"); } } @@ -192,7 +227,7 @@ int mtk_gsw_init(struct fe_priv *priv) gsw = platform_get_drvdata(pdev); priv->soc->swpriv = gsw; - mt7620_hw_init(gsw, np); + mt7620_hw_init(gsw, mt7620_mdio_mode(priv->dev->of_node)); if (gsw->irq) { request_irq(gsw->irq, gsw_interrupt_mt7620, 0, diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7621.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7621.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_mt7620.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_mt7620.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_mt7620.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_debugfs.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_debugfs.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_debugfs.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_debugfs.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c similarity index 91% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 6eae661ec..e0bc0ab81 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -317,24 +317,20 @@ no_rx_mem: static void fe_txd_unmap(struct device *dev, struct fe_tx_buf *tx_buf) { - if (tx_buf->flags & FE_TX_FLAGS_SINGLE0) { - dma_unmap_single(dev, - dma_unmap_addr(tx_buf, dma_addr0), - dma_unmap_len(tx_buf, dma_len0), - DMA_TO_DEVICE); - } else if (tx_buf->flags & FE_TX_FLAGS_PAGE0) { + if (dma_unmap_len(tx_buf, dma_len0)) dma_unmap_page(dev, dma_unmap_addr(tx_buf, dma_addr0), dma_unmap_len(tx_buf, dma_len0), DMA_TO_DEVICE); - } - if (tx_buf->flags & FE_TX_FLAGS_PAGE1) + + if (dma_unmap_len(tx_buf, dma_len1)) dma_unmap_page(dev, dma_unmap_addr(tx_buf, dma_addr1), dma_unmap_len(tx_buf, dma_len1), DMA_TO_DEVICE); - tx_buf->flags = 0; + dma_unmap_len_set(tx_buf, dma_addr0, 0); + dma_unmap_len_set(tx_buf, dma_addr1, 0); if (tx_buf->skb && (tx_buf->skb != (struct sk_buff *)DMA_DUMMY_DESC)) dev_kfree_skb_any(tx_buf->skb); tx_buf->skb = NULL; @@ -569,42 +565,129 @@ static inline u32 fe_empty_txd(struct fe_tx_ring *ring) (ring->tx_ring_size - 1))); } +struct fe_map_state { + struct device *dev; + struct fe_tx_dma txd; + u32 def_txd4; + int ring_idx; + int i; +}; + +static void fe_tx_dma_write_desc(struct fe_tx_ring *ring, struct fe_map_state *st) +{ + fe_set_txd(&st->txd, &ring->tx_dma[st->ring_idx]); + memset(&st->txd, 0, sizeof(st->txd)); + st->txd.txd4 = st->def_txd4; + st->ring_idx = NEXT_TX_DESP_IDX(st->ring_idx); +} + +static int __fe_tx_dma_map_page(struct fe_tx_ring *ring, struct fe_map_state *st, + struct page *page, size_t offset, size_t size) +{ + struct device *dev = st->dev; + struct fe_tx_buf *tx_buf; + dma_addr_t mapped_addr; + + mapped_addr = dma_map_page(dev, page, offset, size, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(dev, mapped_addr))) + return -EIO; + + if (st->i && !(st->i & 1)) + fe_tx_dma_write_desc(ring, st); + + tx_buf = &ring->tx_buf[st->ring_idx]; + if (st->i & 1) { + st->txd.txd3 = mapped_addr; + st->txd.txd2 |= TX_DMA_PLEN1(size); + dma_unmap_addr_set(tx_buf, dma_addr1, mapped_addr); + dma_unmap_len_set(tx_buf, dma_len1, size); + } else { + tx_buf->skb = (struct sk_buff *)DMA_DUMMY_DESC; + st->txd.txd1 = mapped_addr; + st->txd.txd2 = TX_DMA_PLEN0(size); + dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr); + dma_unmap_len_set(tx_buf, dma_len0, size); + } + st->i++; + + return 0; +} + +static int fe_tx_dma_map_page(struct fe_tx_ring *ring, struct fe_map_state *st, + struct page *page, size_t offset, size_t size) +{ + int cur_size; + int ret; + + while (size > 0) { + cur_size = min_t(size_t, size, TX_DMA_BUF_LEN); + + ret = __fe_tx_dma_map_page(ring, st, page, offset, cur_size); + if (ret) + return ret; + + size -= cur_size; + offset += cur_size; + } + + return 0; +} + +static int fe_tx_dma_map_skb(struct fe_tx_ring *ring, struct fe_map_state *st, + struct sk_buff *skb) +{ + struct page *page = virt_to_page(skb->data); + size_t offset = offset_in_page(skb->data); + size_t size = skb_headlen(skb); + + return fe_tx_dma_map_page(ring, st, page, offset, size); +} + +static inline struct sk_buff * +fe_next_frag(struct sk_buff *head, struct sk_buff *skb) +{ + if (skb != head) + return skb->next; + + if (skb_has_frag_list(skb)) + return skb_shinfo(skb)->frag_list; + + return NULL; +} + + static int fe_tx_map_dma(struct sk_buff *skb, struct net_device *dev, int tx_num, struct fe_tx_ring *ring) { struct fe_priv *priv = netdev_priv(dev); - struct skb_frag_struct *frag; - struct fe_tx_dma txd, *ptxd; + struct fe_map_state st = { + .dev = &dev->dev, + .ring_idx = ring->tx_next_idx, + }; + struct sk_buff *head = skb; struct fe_tx_buf *tx_buf; - dma_addr_t mapped_addr; unsigned int nr_frags; - u32 def_txd4; - int i, j, k, frag_size, frag_map_size, offset; - - tx_buf = &ring->tx_buf[ring->tx_next_idx]; - memset(tx_buf, 0, sizeof(*tx_buf)); - memset(&txd, 0, sizeof(txd)); - nr_frags = skb_shinfo(skb)->nr_frags; + int i, j; /* init tx descriptor */ if (priv->soc->tx_dma) - priv->soc->tx_dma(&txd); + priv->soc->tx_dma(&st.txd); else - txd.txd4 = TX_DMA_DESP4_DEF; - def_txd4 = txd.txd4; + st.txd.txd4 = TX_DMA_DESP4_DEF; + st.def_txd4 = st.txd.txd4; /* TX Checksum offload */ if (skb->ip_summed == CHECKSUM_PARTIAL) - txd.txd4 |= TX_DMA_CHKSUM; + st.txd.txd4 |= TX_DMA_CHKSUM; /* VLAN header offload */ if (skb_vlan_tag_present(skb)) { u16 tag = skb_vlan_tag_get(skb); if (IS_ENABLED(CONFIG_SOC_MT7621)) - txd.txd4 |= TX_DMA_INS_VLAN_MT7621 | tag; + st.txd.txd4 |= TX_DMA_INS_VLAN_MT7621 | tag; else - txd.txd4 |= TX_DMA_INS_VLAN | + st.txd.txd4 |= TX_DMA_INS_VLAN | ((tag >> VLAN_PRIO_SHIFT) << 4) | (tag & 0xF); } @@ -618,89 +701,46 @@ static int fe_tx_map_dma(struct sk_buff *skb, struct net_device *dev, } if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { - txd.txd4 |= TX_DMA_TSO; + st.txd.txd4 |= TX_DMA_TSO; tcp_hdr(skb)->check = htons(skb_shinfo(skb)->gso_size); } } - mapped_addr = dma_map_single(&dev->dev, skb->data, - skb_headlen(skb), DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(&dev->dev, mapped_addr))) - goto err_out; - txd.txd1 = mapped_addr; - txd.txd2 = TX_DMA_PLEN0(skb_headlen(skb)); - - tx_buf->flags |= FE_TX_FLAGS_SINGLE0; - dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr); - dma_unmap_len_set(tx_buf, dma_len0, skb_headlen(skb)); +next_frag: + if (skb_headlen(skb) && fe_tx_dma_map_skb(ring, &st, skb)) + goto err_dma; /* TX SG offload */ - j = ring->tx_next_idx; - k = 0; + nr_frags = skb_shinfo(skb)->nr_frags; for (i = 0; i < nr_frags; i++) { - offset = 0; + struct skb_frag_struct *frag; + frag = &skb_shinfo(skb)->frags[i]; - frag_size = skb_frag_size(frag); - - while (frag_size > 0) { - frag_map_size = min(frag_size, TX_DMA_BUF_LEN); - mapped_addr = skb_frag_dma_map(&dev->dev, frag, offset, - frag_map_size, - DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(&dev->dev, mapped_addr))) - goto err_dma; - - if (k & 0x1) { - j = NEXT_TX_DESP_IDX(j); - txd.txd1 = mapped_addr; - txd.txd2 = TX_DMA_PLEN0(frag_map_size); - txd.txd4 = def_txd4; - - tx_buf = &ring->tx_buf[j]; - memset(tx_buf, 0, sizeof(*tx_buf)); - - tx_buf->flags |= FE_TX_FLAGS_PAGE0; - dma_unmap_addr_set(tx_buf, dma_addr0, - mapped_addr); - dma_unmap_len_set(tx_buf, dma_len0, - frag_map_size); - } else { - txd.txd3 = mapped_addr; - txd.txd2 |= TX_DMA_PLEN1(frag_map_size); - - tx_buf->skb = (struct sk_buff *)DMA_DUMMY_DESC; - tx_buf->flags |= FE_TX_FLAGS_PAGE1; - dma_unmap_addr_set(tx_buf, dma_addr1, - mapped_addr); - dma_unmap_len_set(tx_buf, dma_len1, - frag_map_size); - - if (!((i == (nr_frags - 1)) && - (frag_map_size == frag_size))) { - fe_set_txd(&txd, &ring->tx_dma[j]); - memset(&txd, 0, sizeof(txd)); - } - } - frag_size -= frag_map_size; - offset += frag_map_size; - k++; - } + if (fe_tx_dma_map_page(ring, &st, skb_frag_page(frag), + frag->page_offset, skb_frag_size(frag))) + goto err_dma; } + skb = fe_next_frag(head, skb); + if (skb) + goto next_frag; + /* set last segment */ - if (k & 0x1) - txd.txd2 |= TX_DMA_LS1; + if (st.i & 0x1) + st.txd.txd2 |= TX_DMA_LS0; else - txd.txd2 |= TX_DMA_LS0; - fe_set_txd(&txd, &ring->tx_dma[j]); + st.txd.txd2 |= TX_DMA_LS1; /* store skb to cleanup */ - tx_buf->skb = skb; + tx_buf = &ring->tx_buf[st.ring_idx]; + tx_buf->skb = head; - netdev_sent_queue(dev, skb->len); - skb_tx_timestamp(skb); + netdev_sent_queue(dev, head->len); + skb_tx_timestamp(head); + + fe_tx_dma_write_desc(ring, &st); + ring->tx_next_idx = st.ring_idx; - ring->tx_next_idx = NEXT_TX_DESP_IDX(j); /* make sure that all changes to the dma ring are flushed before we * continue */ @@ -712,7 +752,7 @@ static int fe_tx_map_dma(struct sk_buff *skb, struct net_device *dev, netif_wake_queue(dev); } - if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more) + if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !head->xmit_more) fe_reg_w32(ring->tx_next_idx, FE_REG_TX_CTX_IDX0); return 0; @@ -720,13 +760,10 @@ static int fe_tx_map_dma(struct sk_buff *skb, struct net_device *dev, err_dma: j = ring->tx_next_idx; for (i = 0; i < tx_num; i++) { - ptxd = &ring->tx_dma[j]; - tx_buf = &ring->tx_buf[j]; - /* unmap dma */ - fe_txd_unmap(&dev->dev, tx_buf); + fe_txd_unmap(&dev->dev, &ring->tx_buf[j]); + ring->tx_dma[j].txd2 = TX_DMA_DESP2_DEF; - ptxd->txd2 = TX_DMA_DESP2_DEF; j = NEXT_TX_DESP_IDX(j); } /* make sure that all changes to the dma ring are flushed before we @@ -772,10 +809,12 @@ static inline int fe_skb_padto(struct sk_buff *skb, struct fe_priv *priv) static inline int fe_cal_txd_req(struct sk_buff *skb) { - int i, nfrags; + struct sk_buff *head = skb; + int i, nfrags = 0; struct skb_frag_struct *frag; - nfrags = 1; +next_frag: + nfrags++; if (skb_is_gso(skb)) { for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { frag = &skb_shinfo(skb)->frags[i]; @@ -785,6 +824,10 @@ static inline int fe_cal_txd_req(struct sk_buff *skb) nfrags += skb_shinfo(skb)->nr_frags; } + skb = fe_next_frag(head, skb); + if (skb) + goto next_frag; + return DIV_ROUND_UP(nfrags, 2); } @@ -1384,20 +1427,12 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu) int frag_size, old_mtu; u32 fwd_cfg; - if (!(priv->flags & FE_FLAG_JUMBO_FRAME)) - return eth_change_mtu(dev, new_mtu); - - if (IS_ENABLED(CONFIG_SOC_MT7621)) - if (new_mtu > 2048) - return -EINVAL; - - frag_size = fe_max_frag_size(new_mtu); - if (new_mtu < 68 || frag_size > PAGE_SIZE) - return -EINVAL; - old_mtu = dev->mtu; dev->mtu = new_mtu; + if (!(priv->flags & FE_FLAG_JUMBO_FRAME)) + return 0; + /* return early if the buffer sizes will not change */ if (old_mtu <= ETH_DATA_LEN && new_mtu <= ETH_DATA_LEN) return 0; @@ -1419,6 +1454,7 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu) if (new_mtu <= ETH_DATA_LEN) { fwd_cfg &= ~FE_GDM1_JMB_EN; } else { + frag_size = fe_max_frag_size(new_mtu); fwd_cfg &= ~(FE_GDM1_JMB_LEN_MASK << FE_GDM1_JMB_LEN_SHIFT); fwd_cfg |= (DIV_ROUND_UP(frag_size, 1024) << FE_GDM1_JMB_LEN_SHIFT) | FE_GDM1_JMB_EN; @@ -1552,6 +1588,9 @@ static int fe_probe(struct platform_device *pdev) netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_CTAG_TX; netdev->features |= netdev->hw_features; + if (IS_ENABLED(CONFIG_SOC_MT7621)) + netdev->max_mtu = 2048; + /* fake rx vlan filter func. to support tx vlan offload func */ if (fe_reg_table[FE_REG_FE_DMA_VID_BASE]) netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.h similarity index 98% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 5203f5cf5..c42126116 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.h +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -435,19 +435,12 @@ struct fe_hw_stats { #undef _FE }; -enum fe_tx_flags { - FE_TX_FLAGS_SINGLE0 = 0x01, - FE_TX_FLAGS_PAGE0 = 0x02, - FE_TX_FLAGS_PAGE1 = 0x04, -}; - struct fe_tx_buf { struct sk_buff *skb; - u32 flags; DEFINE_DMA_UNMAP_ADDR(dma_addr0); - DEFINE_DMA_UNMAP_LEN(dma_len0); DEFINE_DMA_UNMAP_ADDR(dma_addr1); - DEFINE_DMA_UNMAP_LEN(dma_len1); + u16 dma_len0; + u16 dma_len1; }; struct fe_tx_ring { diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7620.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7621.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7621.c similarity index 98% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7621.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7621.c index 00dd45e01..392e0ea2e 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7621.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7621.c @@ -143,7 +143,8 @@ static void mt7621_init_data(struct fe_soc_data *data, netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_SG | NETIF_F_TSO | - NETIF_F_TSO6 | NETIF_F_IPV6_CSUM; + NETIF_F_TSO6 | NETIF_F_IPV6_CSUM | + NETIF_F_TSO_MANGLEID; } static void mt7621_set_mac(struct fe_priv *priv, unsigned char *mac) diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt2880.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt2880.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt2880.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt2880.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3050.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3050.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3050.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3050.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3883.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3883.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3883.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3883.c diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index cd77ffe41..9cf64361a 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -31,7 +31,7 @@ loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000 KERNEL_LOADADDR := $(loadaddr-y) -KERNEL_DTB = kernel-bin | patch-dtb | lzma -d21 +KERNEL_DTB = kernel-bin | patch-dtb | lzma define Device/Default PROFILES = Default $$(DTS) KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts) @@ -108,11 +108,6 @@ define Build/poray-header mv $@.new $@ endef -define Build/senao-header - $(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new - mv $@.new $@ -endef - define Build/seama $(STAGING_DIR_HOST)/bin/seama -i $@ $(1) mv $@.seama $@ @@ -147,6 +142,10 @@ define Build/mkdlinkfw-factory mv $@.new $@ endef +define Build/zyimage + $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +endef + # # The real magic happens inside these templates # diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index b6499c880..c511a17ac 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -16,10 +16,6 @@ define Build/elecom-header -f $@ -C $(KDIR) v_0.0.0.bin v_0.0.0.md5 endef -define Build/zyimage - $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ -endef - define Device/ai-br100 DTS := AI-BR100 IMAGE_SIZE := 7936k @@ -168,6 +164,20 @@ define Device/dlink_dwr-116-a1 endef TARGET_DEVICES += dlink_dwr-116-a1 +define Device/dlink_dwr-118-a2 + DTS := DWR-118-A2 + DEVICE_TITLE := D-Link DWR-118 A2 + DEVICE_PACKAGES := kmod-usb2 jboot-tools kmod-mt76 + DLINK_ROM_ID := DLK6E3814001 + DLINK_FAMILY_MEMBER := 0x6E38 + DLINK_FIRMWARE_SIZE := 0xFE0000 + KERNEL := $(KERNEL_DTB) + IMAGES += factory.bin + IMAGE/sysupgrade.bin := mkdlinkfw | pad-rootfs | append-metadata + IMAGE/factory.bin := mkdlinkfw | pad-rootfs | mkdlinkfw-factory +endef +TARGET_DEVICES += dlink_dwr-118-a2 + define Device/dlink_dwr-921-c1 DTS := DWR-921-C1 IMAGE_SIZE := $(ralink_default_fw_size_16M) @@ -284,6 +294,13 @@ define Device/hc5861 endef TARGET_DEVICES += hc5861 +define Device/kimax_u35wf + DTS := U35WF + IMAGE_SIZE := 16064k + DEVICE_TITLE := Kimax U35WF +endef +TARGET_DEVICES += kimax_u35wf + define Device/kng_rc DTS := kng_rc IMAGE_SIZE := $(ralink_default_fw_size_16M) @@ -472,6 +489,30 @@ define Device/tiny-ac endef TARGET_DEVICES += tiny-ac +define Device/edimax_br-6478ac-v2 + DTS := BR-6478AC-V2 + DEVICE_TITLE := Edimax BR-6478AC V2 + BLOCKSIZE := 64k + IMAGE_SIZE := 7616k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + edimax-header -s CSYS -m RN68 -f 0x70000 -S 0x01100000 | pad-rootfs | \ + append-metadata | check-size $$$$(IMAGE_SIZE) + DEVICE_PACKAGES := kmod-mt76 kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += edimax_br-6478ac-v2 + +define Device/tplink_c2-v1 + $(Device/Archer) + DTS := ArcherC2-v1 + TPLINK_FLASHLAYOUT := 8Mmtk + TPLINK_HWID := 0xc7500001 + TPLINK_HWREV := 50 + IMAGES += factory.bin + DEVICE_TITLE := TP-Link Archer C2 v1 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-switch-rtl8366-smi kmod-switch-rtl8367b +endef +TARGET_DEVICES += tplink_c2-v1 + define Device/tplink_c20-v1 $(Device/Archer) DTS := ArcherC20v1 diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index e9e2d3ece..a4a0f3d29 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2,8 +2,22 @@ # MT7621 Profiles # +KERNEL_DTB += -d21 DEVICE_VARS += TPLINK_BOARD_ID TPLINK_HEADER_VERSION TPLINK_HWID TPLINK_HWREV +define Build/elecom-gst-factory + $(eval product=$(word 1,$(1))) + $(eval version=$(word 2,$(1))) + ( $(STAGING_DIR_HOST)/bin/mkhash md5 $@ | tr -d '\n' ) >> $@ + ( \ + echo -n "ELECOM $(product) v$(version)" | \ + dd bs=32 count=1 conv=sync; \ + dd if=$@; \ + ) > $@.new + mv $@.new $@ + echo -n "MT7621_ELECOM_$(product)" >> $@ +endef + define Build/elecom-wrc-factory $(eval product=$(word 1,$(1))) $(eval version=$(word 2,$(1))) @@ -16,6 +30,23 @@ define Build/elecom-wrc-factory mv $@.new $@ endef +define Build/iodata-factory + $(eval fw_size=$(word 1,$(1))) + $(eval fw_type=$(word 2,$(1))) + $(eval product=$(word 3,$(1))) + $(eval factory_bin=$(word 4,$(1))) + if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \ + $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \ + $(STAGING_DIR_HOST)/bin/mksenaofw \ + -r 0x30a -p $(product) -t $(fw_type) \ + -e $(factory_bin) -o $(factory_bin).new; \ + mv $(factory_bin).new $(factory_bin); \ + $(CP) $(factory_bin) $(BIN_DIR)/; \ + else \ + echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \ + fi +endef + define Build/ubnt-erx-factory-image if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \ echo '21001:6' > $(1).compat; \ @@ -87,6 +118,26 @@ define Device/elecom_wrc-1167ghbk2-s endef TARGET_DEVICES += elecom_wrc-1167ghbk2-s +define Device/elecom_wrc-2533gst + DTS := WRC-2533GST + IMAGE_SIZE := 11264k + DEVICE_TITLE := ELECOM WRC-2533GST + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) |\ + elecom-gst-factory WRC-2533GST 0.00 +endef +TARGET_DEVICES += elecom_wrc-2533gst + +define Device/elecom_wrc-1900gst + DTS := WRC-1900GST + IMAGE_SIZE := 11264k + DEVICE_TITLE := ELECOM WRC-1900GST + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) |\ + elecom-gst-factory WRC-1900GST 0.00 +endef +TARGET_DEVICES += elecom_wrc-1900gst + define Device/ew1200 DTS := EW1200 IMAGE_SIZE := $(ralink_default_fw_size_16M) @@ -136,6 +187,16 @@ define Device/hc5962 endef TARGET_DEVICES += hc5962 +define Device/iodata_wn-ax1167gr + DTS := WN-AX1167GR + IMAGE_SIZE := 15552k + KERNEL_INITRAMFS := $$(KERNEL) | \ + iodata-factory 7864320 4 0x1055 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin + DEVICE_TITLE := I-O DATA WN-AX1167GR + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 wpad-mini +endef +TARGET_DEVICES += iodata_wn-ax1167gr + define Device/iodata_wn-gx300gr DTS := WN-GX300GR IMAGE_SIZE := 7798784 @@ -233,11 +294,9 @@ define Device/rb750gr3 endef TARGET_DEVICES += rb750gr3 -define Device/mikrotik_rbm33g - DTS := RBM33G +define Device/MikroTik BLOCKSIZE := 64k IMAGE_SIZE := 16128k - DEVICE_TITLE := MikroTik RBM33G DEVICE_PACKAGES := kmod-usb3 LOADER_TYPE := elf PLATFORM := mt7621 @@ -245,8 +304,21 @@ define Device/mikrotik_rbm33g IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 | pad-to $$$$(BLOCKSIZE) | \ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) endef + +define Device/mikrotik_rbm33g + $(Device/MikroTik) + DTS := RBM33G + DEVICE_TITLE := MikroTik RouterBOARD M33G +endef TARGET_DEVICES += mikrotik_rbm33g +define Device/mikrotik_rbm11g + $(Device/MikroTik) + DTS := RBM11G + DEVICE_TITLE := MikroTik RouterBOARD M11G +endef +TARGET_DEVICES += mikrotik_rbm11g + define Device/re350-v1 DTS := RE350 DEVICE_TITLE := TP-LINK RE350 v1 @@ -256,7 +328,7 @@ define Device/re350-v1 TPLINK_HWREV := 0 TPLINK_HEADER_VERSION := 1 IMAGE_SIZE := 6016k - KERNEL := $(KERNEL_DTB) | tplink-v1-header -e + KERNEL := $(KERNEL_DTB) | tplink-v1-header -e -O IMAGES := sysupgrade.bin factory.bin IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | append-metadata | check-size $$$$(IMAGE_SIZE) IMAGE/factory.bin := append-rootfs | tplink-safeloader factory diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 21c5357a0..15bc1ee70 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -2,6 +2,17 @@ # MT76x8 Profiles # +DEVICE_VARS += SERCOMM_KERNEL_OFFSET SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER + +define Build/mksercommfw + $(STAGING_DIR_HOST)/bin/mksercommfw \ + $@ \ + $(SERCOMM_KERNEL_OFFSET) \ + $(SERCOMM_HWID) \ + $(SERCOMM_HWVER) \ + $(SERCOMM_SWVER) +endef + define Device/tplink TPLINK_FLASHLAYOUT := TPLINK_HWID := @@ -54,9 +65,17 @@ define Device/hc5661a DTS := HC5661A IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := HiWiFi HC5661A + DEVICE_PACKAGES := kmod-sdhci-mt7620 endef TARGET_DEVICES += hc5661a +define Device/hiwifi_hc5861b + DTS := HC5861B + IMAGE_SIZE := 15808k + DEVICE_TITLE := HiWiFi HC5861B +endef +TARGET_DEVICES += hiwifi_hc5861b + define Device/LinkIt7688 DTS := LINKIT7688 IMAGE_SIZE := $(ralink_default_fw_size_32M) @@ -90,6 +109,23 @@ define Device/mt7628 endef TARGET_DEVICES += mt7628 +define Device/netgear_r6120 + DTS := R6120 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := Netgear AC1200 R6120 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci + SERCOMM_KERNEL_OFFSET := 90000 + SERCOMM_HWID := CGQ + SERCOMM_HWVER := A001 + SERCOMM_SWVER := 0040 + IMAGES += factory.img + IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)| append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.img := $$(IMAGE/default) | mksercommfw +endef +TARGET_DEVICES += netgear_r6120 + define Device/omega2 DTS := OMEGA2 IMAGE_SIZE := $(ralink_default_fw_size_16M) @@ -114,6 +150,19 @@ define Device/pbr-d1 endef TARGET_DEVICES += pbr-d1 +define Device/tplink_tl-wa801nd-v5 + $(Device/tplink) + DTS := TL-WA801NDV5 + IMAGE_SIZE := 7808k + DEVICE_TITLE := TP-Link TL-WA801ND v5 + TPLINK_FLASHLAYOUT := 8Mmtk + TPLINK_HWID := 0x08010005 + TPLINK_HWREV := 0x1 + TPLINK_HWREVADD := 0x5 + TPLINK_HVERSION := 3 +endef +TARGET_DEVICES += tplink_tl-wa801nd-v5 + define Device/tl-wr840n-v4 $(Device/tplink) DTS := TL-WR840NV4 @@ -182,6 +231,20 @@ define Device/tplink_c50-v3 endef TARGET_DEVICES += tplink_c50-v3 +define Device/tplink_tl-mr3020-v3 + $(Device/tplink) + DTS := TL-MR3020V3 + IMAGE_SIZE := 7808k + DEVICE_TITLE := TP-Link TL-MR3020 v3 + TPLINK_FLASHLAYOUT := 8Mmtk + TPLINK_HWID := 0x30200003 + TPLINK_HWREV := 0x3 + TPLINK_HWREVADD := 0x3 + TPLINK_HVERSION := 3 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += tplink_tl-mr3020-v3 + define Device/tplink_tl-mr3420-v5 $(Device/tplink) DTS := TL-MR3420V5 @@ -312,3 +375,15 @@ define Device/zbtlink_zbt-we1226 DEVICE_TITLE := ZBTlink ZBT-WE1226 endef TARGET_DEVICES += zbtlink_zbt-we1226 + +define Device/zyxel_keenetic-extra-ii + DTS := ki_rb + IMAGE_SIZE := 14912k + BLOCKSIZE := 64k + DEVICE_TITLE := ZyXEL Keenetic Extra II + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport + IMAGES += factory.bin + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size $$$$(IMAGE_SIZE) | zyimage -d 6162 -v "ZyXEL Keenetic Extra II" +endef +TARGET_DEVICES += zyxel_keenetic-extra-ii diff --git a/target/linux/ramips/mt7620/config-4.14 b/target/linux/ramips/mt7620/config-4.14 index d60696b22..1162ed47b 100644 --- a/target/linux/ramips/mt7620/config-4.14 +++ b/target/linux/ramips/mt7620/config-4.14 @@ -22,8 +22,6 @@ CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKDEV_LOOKUP=y @@ -130,6 +128,7 @@ CONFIG_IRQ_INTC=y CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y CONFIG_LIBFDT=y +CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MFD_SYSCON=y diff --git a/target/linux/ramips/mt7621/config-4.14 b/target/linux/ramips/mt7621/config-4.14 index 2ea80a3ab..0e0602378 100644 --- a/target/linux/ramips/mt7621/config-4.14 +++ b/target/linux/ramips/mt7621/config-4.14 @@ -228,6 +228,8 @@ CONFIG_RCU_STALL_COMMON=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y diff --git a/target/linux/ramips/mt76x8/config-4.14 b/target/linux/ramips/mt76x8/config-4.14 index 614c366d1..81e084893 100644 --- a/target/linux/ramips/mt76x8/config-4.14 +++ b/target/linux/ramips/mt76x8/config-4.14 @@ -22,8 +22,6 @@ CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/patches-4.14/0001-MIPS-ralink-Add-rt3352-SPI_CS1-pinmux.patch b/target/linux/ramips/patches-4.14/0001-MIPS-ralink-Add-rt3352-SPI_CS1-pinmux.patch new file mode 100644 index 000000000..4f803dfd0 --- /dev/null +++ b/target/linux/ramips/patches-4.14/0001-MIPS-ralink-Add-rt3352-SPI_CS1-pinmux.patch @@ -0,0 +1,45 @@ +From 35d017947401d9f449a7e55e52506744e0c62577 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Wed, 22 Aug 2018 22:38:06 +0200 +Subject: [PATCH] MIPS: ralink: Add rt3352 SPI_CS1 pinmux + +The rt3352 has a pin that can be used as second spi chip select, +watchdog reset or GPIO. The pinmux setup was missing the definition of +said pin. + +The pin is configured via the same bit on rt5350, so reuse the existing +macro. + +Signed-off-by: Mathias Kresin +Signed-off-by: Paul Burton +Patchwork: https://patchwork.linux-mips.org/patch/20301/ +Cc: John Crispin +Cc: Ralf Baechle +Cc: James Hogan +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +--- + arch/mips/ralink/rt305x.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/mips/ralink/rt305x.c ++++ b/arch/mips/ralink/rt305x.c +@@ -49,6 +49,10 @@ static struct rt2880_pmx_func rgmii_func + static struct rt2880_pmx_func rt3352_lna_func[] = { FUNC("lna", 0, 36, 2) }; + static struct rt2880_pmx_func rt3352_pa_func[] = { FUNC("pa", 0, 38, 2) }; + static struct rt2880_pmx_func rt3352_led_func[] = { FUNC("led", 0, 40, 5) }; ++static struct rt2880_pmx_func rt3352_cs1_func[] = { ++ FUNC("spi_cs1", 0, 45, 1), ++ FUNC("wdg_cs1", 1, 45, 1), ++}; + + static struct rt2880_pmx_group rt3050_pinmux_data[] = { + GRP("i2c", i2c_func, 1, RT305X_GPIO_MODE_I2C), +@@ -75,6 +79,7 @@ static struct rt2880_pmx_group rt3352_pi + GRP("lna", rt3352_lna_func, 1, RT3352_GPIO_MODE_LNA), + GRP("pa", rt3352_pa_func, 1, RT3352_GPIO_MODE_PA), + GRP("led", rt3352_led_func, 1, RT5350_GPIO_MODE_PHY_LED), ++ GRP("spi_cs1", rt3352_cs1_func, 2, RT5350_GPIO_MODE_SPI_CS1), + { 0 } + }; + diff --git a/target/linux/ramips/patches-4.14/0024-GPIO-add-named-gpio-exports.patch b/target/linux/ramips/patches-4.14/0024-GPIO-add-named-gpio-exports.patch index 0c1bc7392..ea93538a4 100644 --- a/target/linux/ramips/patches-4.14/0024-GPIO-add-named-gpio-exports.patch +++ b/target/linux/ramips/patches-4.14/0024-GPIO-add-named-gpio-exports.patch @@ -22,7 +22,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" -@@ -506,3 +508,69 @@ void of_gpiochip_remove(struct gpio_chip +@@ -506,3 +508,68 @@ void of_gpiochip_remove(struct gpio_chip gpiochip_remove_pin_ranges(chip); of_node_put(chip->of_node); } @@ -32,7 +32,7 @@ Signed-off-by: John Crispin + { /* sentinel */ } +}; + -+static int __init of_gpio_export_probe(struct platform_device *pdev) ++static int of_gpio_export_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct device_node *cnp; @@ -56,6 +56,8 @@ Signed-off-by: John Crispin + enum of_gpio_flags of_flags; + + gpio = of_get_gpio_flags(cnp, i, &of_flags); ++ if (!gpio_is_valid(gpio)) ++ return gpio; + + if (of_flags == OF_GPIO_ACTIVE_LOW) + flags |= GPIOF_ACTIVE_LOW; @@ -85,13 +87,10 @@ Signed-off-by: John Crispin + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(gpio_export_ids), + }, ++ .probe = of_gpio_export_probe, +}; + -+static int __init of_gpio_export_init(void) -+{ -+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe); -+} -+device_initcall(of_gpio_export_init); ++module_platform_driver(gpio_export_driver); --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -553,7 +553,7 @@ static struct class gpio_class = { diff --git a/target/linux/ramips/patches-4.14/0025-pinctrl-ralink-add-pinctrl-driver.patch b/target/linux/ramips/patches-4.14/0025-pinctrl-ralink-add-pinctrl-driver.patch index 3e5dac537..e9a03d93d 100644 --- a/target/linux/ramips/patches-4.14/0025-pinctrl-ralink-add-pinctrl-driver.patch +++ b/target/linux/ramips/patches-4.14/0025-pinctrl-ralink-add-pinctrl-driver.patch @@ -482,7 +482,7 @@ Signed-off-by: John Crispin + if (!of_device_is_available(np)) + continue; + -+ ngpio = of_get_property(np, "ralink,num-gpios", NULL); ++ ngpio = of_get_property(np, "ralink,nr-gpio", NULL); + gpiobase = of_get_property(np, "ralink,gpio-base", NULL); + if (!ngpio || !gpiobase) { + dev_err(&pdev->dev, "failed to load chip info\n"); diff --git a/target/linux/ramips/patches-4.14/0026-DT-Add-documentation-for-gpio-ralink.patch b/target/linux/ramips/patches-4.14/0026-DT-Add-documentation-for-gpio-ralink.patch index 7d5f98f64..0bce0b433 100644 --- a/target/linux/ramips/patches-4.14/0026-DT-Add-documentation-for-gpio-ralink.patch +++ b/target/linux/ramips/patches-4.14/0026-DT-Add-documentation-for-gpio-ralink.patch @@ -29,7 +29,7 @@ Cc: linux-gpio@vger.kernel.org +- reg : Physical base address and length of the controller's registers +- interrupt-parent: phandle to the INTC device node +- interrupts : Specify the INTC interrupt number -+- ralink,num-gpios : Specify the number of GPIOs ++- ralink,nr-gpio : Specify the number of GPIOs +- ralink,register-map : The register layout depends on the GPIO bank and actual + SoC type. Register offsets need to be in this order. + [ INT, EDGE, RENA, FENA, DATA, DIR, POL, SET, RESET, TOGGLE ] @@ -51,7 +51,7 @@ Cc: linux-gpio@vger.kernel.org + interrupts = <6>; + + ralink,gpio-base = <0>; -+ ralink,num-gpios = <24>; ++ ralink,nr-gpio = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; diff --git a/target/linux/ramips/patches-4.14/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch b/target/linux/ramips/patches-4.14/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch index 35cedf61f..eaae0d3d0 100644 --- a/target/linux/ramips/patches-4.14/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch +++ b/target/linux/ramips/patches-4.14/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch @@ -371,7 +371,7 @@ Cc: linux-gpio@vger.kernel.org + return -EINVAL; + } + -+ ngpio = of_get_property(np, "ralink,num-gpios", NULL); ++ ngpio = of_get_property(np, "ralink,nr-gpio", NULL); + if (!ngpio) { + dev_err(&pdev->dev, "failed to read number of pins\n"); + return -EINVAL; diff --git a/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch b/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch index 7e120c531..185765624 100644 --- a/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch +++ b/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch @@ -18,7 +18,7 @@ Signed-off-by: John Crispin #include #include -@@ -5107,6 +5108,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso +@@ -5206,6 +5207,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso retval = -ENOMEM; diff --git a/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch b/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch index 2e7cc33c8..6ae9226d3 100644 --- a/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch +++ b/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); return ret; -@@ -1164,7 +1216,7 @@ static const struct flash_info spi_nor_i +@@ -1165,7 +1217,7 @@ static const struct flash_info spi_nor_i { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) }, -@@ -1224,6 +1276,9 @@ static int spi_nor_read(struct mtd_info +@@ -1225,6 +1277,9 @@ static int spi_nor_read(struct mtd_info if (ret) return ret; @@ -135,7 +135,7 @@ Signed-off-by: Felix Fietkau while (len) { loff_t addr = from; -@@ -1248,6 +1303,18 @@ static int spi_nor_read(struct mtd_info +@@ -1249,6 +1304,18 @@ static int spi_nor_read(struct mtd_info ret = 0; read_err: @@ -154,7 +154,7 @@ Signed-off-by: Felix Fietkau spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); return ret; } -@@ -1349,6 +1416,10 @@ static int spi_nor_write(struct mtd_info +@@ -1350,6 +1417,10 @@ static int spi_nor_write(struct mtd_info if (ret) return ret; @@ -165,7 +165,7 @@ Signed-off-by: Felix Fietkau for (i = 0; i < len; ) { ssize_t written; loff_t addr = to + i; -@@ -1389,6 +1460,7 @@ static int spi_nor_write(struct mtd_info +@@ -1390,6 +1461,7 @@ static int spi_nor_write(struct mtd_info } write_err: @@ -173,7 +173,7 @@ Signed-off-by: Felix Fietkau spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); return ret; } -@@ -2805,8 +2877,10 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -2806,8 +2878,10 @@ int spi_nor_scan(struct spi_nor *nor, co } else if (mtd->size > 0x1000000) { /* enable 4-byte addressing if the device exceeds 16MiB */ nor->addr_width = 4; diff --git a/target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch b/target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch new file mode 100644 index 000000000..568d61db9 --- /dev/null +++ b/target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch @@ -0,0 +1,73 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -142,20 +142,29 @@ static int read_fsr(struct spi_nor *nor) + * location. Return the configuration register value. + * Returns negative if error occurred. + */ +-static int read_cr(struct spi_nor *nor) ++static int _read_cr(struct spi_nor *nor, u8 reg) + { + int ret; + u8 val; + +- ret = nor->read_reg(nor, SPINOR_OP_RDCR, &val, 1); ++ ret = nor->read_reg(nor, reg, &val, 1); + if (ret < 0) { +- dev_err(nor->dev, "error %d reading CR\n", ret); ++ dev_err(nor->dev, "error %d reading %s\n", ret, ++ (reg==SPINOR_OP_RDCR)?"CR":"XCR"); + return ret; + } + + return val; + } + ++static inline int read_cr(struct spi_nor *nor) { ++ return _read_cr(nor, SPINOR_OP_RDCR); ++} ++ ++static inline int read_xcr(struct spi_nor *nor) { ++ return _read_cr(nor, SPINOR_OP_RDXCR); ++} ++ + /* + * Write status register 1 byte + * Returns negative if error occurred. +@@ -2878,9 +2887,16 @@ int spi_nor_scan(struct spi_nor *nor, co + } else if (mtd->size > 0x1000000) { + /* enable 4-byte addressing if the device exceeds 16MiB */ + nor->addr_width = 4; +- if (info->flags & SPI_NOR_4B_READ_OP) +- spi_nor_set_4byte_read(nor, info); +- else if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || ++ if (info->flags & SPI_NOR_4B_READ_OP) { ++ if (JEDEC_MFR(info) == SNOR_MFR_WINBOND) { ++ ret = read_xcr(nor); ++ if (!(ret > 0 && (ret & XCR_DEF_4B_ADDR_MODE))) ++ spi_nor_set_4byte_read(nor, info); ++ else ++ set_4byte(nor, info, 1); ++ } else ++ spi_nor_set_4byte_read(nor, info); ++ } else if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || + info->flags & SPI_NOR_4B_OPCODES) + spi_nor_set_4byte_opcodes(nor, info); + else +--- a/include/linux/mtd/spi-nor.h ++++ b/include/linux/mtd/spi-nor.h +@@ -103,6 +103,7 @@ + #define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */ + #define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */ + #define SPINOR_OP_WREAR 0xc5 /* Write extended address register */ ++#define SPINOR_OP_RDXCR 0x15 /* Read extended configuration register */ + + /* Used for Spansion flashes only. */ + #define SPINOR_OP_BRWR 0x17 /* Bank register write */ +@@ -135,6 +136,7 @@ + + /* Configuration Register bits. */ + #define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ ++#define XCR_DEF_4B_ADDR_MODE BIT(1) /* Winbond 4B mode default */ + + /* Status Register 2 bits. */ + #define SR2_QUAD_EN_BIT7 BIT(7) diff --git a/target/linux/ramips/patches-4.14/0090-ethernet.patch b/target/linux/ramips/patches-4.14/0090-ethernet.patch deleted file mode 100644 index 20f69fcc0..000000000 --- a/target/linux/ramips/patches-4.14/0090-ethernet.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b6f779ea9c329451b89404583b45b9eb00155b32 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Wed, 18 Nov 2015 03:58:26 +0100 -Subject: [PATCH 510/513] net-next: mediatek: add Kconfig and Makefile - -This patch adds the Makefile and Kconfig required to make the driver build. - -Signed-off-by: John Crispin -Signed-off-by: Felix Fietkau -Signed-off-by: Michael Lee ---- - drivers/net/ethernet/Kconfig | 1 + - drivers/net/ethernet/Makefile | 1 + - drivers/net/ethernet/mtk/Kconfig | 62 ++++++++++++++++++++++++++++++++ - drivers/net/ethernet/mtk/Makefile | 20 +++++++++++ - 4 files changed, 84 insertions(+) - create mode 100644 drivers/net/ethernet/mtk/Kconfig - create mode 100644 drivers/net/ethernet/mtk/Makefile - ---- a/drivers/net/ethernet/Kconfig -+++ b/drivers/net/ethernet/Kconfig -@@ -110,7 +110,7 @@ config LANTIQ_ETOP - Support for the MII0 inside the Lantiq SoC - - source "drivers/net/ethernet/marvell/Kconfig" --source "drivers/net/ethernet/mediatek/Kconfig" -+source "drivers/net/ethernet/mtk/Kconfig" - source "drivers/net/ethernet/mellanox/Kconfig" - source "drivers/net/ethernet/micrel/Kconfig" - source "drivers/net/ethernet/microchip/Kconfig" ---- a/drivers/net/ethernet/Makefile -+++ b/drivers/net/ethernet/Makefile -@@ -51,7 +51,7 @@ obj-$(CONFIG_JME) += jme.o - obj-$(CONFIG_KORINA) += korina.o - obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o - obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ --obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ -+obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mtk/ - obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ - obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/ - obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/ diff --git a/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch b/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch index 408fc13e7..7a42c78a4 100644 --- a/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch +++ b/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1050,6 +1050,11 @@ static const struct flash_info spi_nor_i +@@ -1060,6 +1060,11 @@ static const struct flash_info spi_nor_i SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, diff --git a/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch b/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch index ea8d83d98..7b2b280d3 100644 --- a/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch +++ b/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1083,7 +1083,7 @@ static const struct flash_info spi_nor_i +@@ -1093,7 +1093,7 @@ static const struct flash_info spi_nor_i { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) }, { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, diff --git a/target/linux/ramips/rt288x/config-4.14 b/target/linux/ramips/rt288x/config-4.14 index a4b49790a..de4dffe88 100644 --- a/target/linux/ramips/rt288x/config-4.14 +++ b/target/linux/ramips/rt288x/config-4.14 @@ -21,8 +21,6 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y # CONFIG_CEVT_SYSTICK_QUIRK is not set CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt288x/target.mk b/target/linux/ramips/rt288x/target.mk index 2ca5ecfbb..11b5a0b52 100644 --- a/target/linux/ramips/rt288x/target.mk +++ b/target/linux/ramips/rt288x/target.mk @@ -4,6 +4,7 @@ SUBTARGET:=rt288x BOARDNAME:=RT288x based boards +FEATURES+=small_flash CPU_TYPE:=24kc DEFAULT_PACKAGES += kmod-rt2800-soc wpad-mini diff --git a/target/linux/ramips/rt305x/config-4.14 b/target/linux/ramips/rt305x/config-4.14 index dadf88e03..346a8a881 100644 --- a/target/linux/ramips/rt305x/config-4.14 +++ b/target/linux/ramips/rt305x/config-4.14 @@ -12,8 +12,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt305x/target.mk b/target/linux/ramips/rt305x/target.mk index 300639fa3..e36fa637b 100644 --- a/target/linux/ramips/rt305x/target.mk +++ b/target/linux/ramips/rt305x/target.mk @@ -4,7 +4,7 @@ SUBTARGET:=rt305x BOARDNAME:=RT3x5x/RT5350 based boards -FEATURES+=usb ramdisk +FEATURES+=usb ramdisk small_flash CPU_TYPE:=24kc DEFAULT_PACKAGES += kmod-rt2800-soc wpad-mini diff --git a/target/linux/ramips/rt3883/config-4.14 b/target/linux/ramips/rt3883/config-4.14 index f663d4986..93d803e2e 100644 --- a/target/linux/ramips/rt3883/config-4.14 +++ b/target/linux/ramips/rt3883/config-4.14 @@ -22,8 +22,6 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y # CONFIG_CEVT_SYSTICK_QUIRK is not set CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt3883/target.mk b/target/linux/ramips/rt3883/target.mk index a2631d1ac..2cc19858e 100644 --- a/target/linux/ramips/rt3883/target.mk +++ b/target/linux/ramips/rt3883/target.mk @@ -4,7 +4,7 @@ SUBTARGET:=rt3883 BOARDNAME:=RT3662/RT3883 based boards -FEATURES+=usb pci +FEATURES+=usb pci small_flash CPU_TYPE:=74kc DEFAULT_PACKAGES += kmod-rt2800-pci kmod-rt2800-soc wpad-mini diff --git a/target/linux/rb532/config-4.9 b/target/linux/rb532/config-4.9 index 9290a1869..a02dc03bb 100644 --- a/target/linux/rb532/config-4.9 +++ b/target/linux/rb532/config-4.9 @@ -16,7 +16,6 @@ CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATA=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CPU_GENERIC_DUMP_TLB=y diff --git a/target/linux/samsung/Makefile b/target/linux/samsung/Makefile new file mode 100644 index 000000000..922750309 --- /dev/null +++ b/target/linux/samsung/Makefile @@ -0,0 +1,26 @@ +# +# Copyright (C) 2018 Jianhui Zhao +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=samsung +BOARDNAME:=Samsung s3c24xx/s5pv210 +SUBTARGETS:=s5pv210 +MAINTAINER:=Jianhui Zhao + +KERNEL_PATCHVER:=4.14 + +define Target/Description + Build firmware images for Samsung s3c24xx/s5pv210 based boards. +endef + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:=zImage dtbs + +$(eval $(call BuildTarget)) diff --git a/target/linux/samsung/dts/TQ210.dts b/target/linux/samsung/dts/TQ210.dts new file mode 100644 index 000000000..d32e3400f --- /dev/null +++ b/target/linux/samsung/dts/TQ210.dts @@ -0,0 +1,69 @@ +/* + * Samsung's S5PV210 SoC device tree source + * Copyright (C) 2018 Jianhui Zhao + * + * Board device tree source for TQ210 board. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/dts-v1/; +#include +#include +#include "s5pv210.dtsi" + +/ { + model = "Embedsky TQ210 based on S5PV210"; + compatible = "embedsky,tq210", "samsung,s5pv210"; + + chosen { + bootargs = "console=ttySAC0,115200n8"; + }; + + memory@20000000 { + device_type = "memory"; + reg = <0x20000000 0x40000000>; + }; + + ethernet@88000000 { + compatible = "davicom,dm9000"; + reg = <0x88000000 0x2 0x88000004 0x2>; + interrupt-parent = <&gph1>; + interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + local-mac-address = [00 00 de ad be ef]; + davicom,no-eeprom; + clocks = <&clocks CLK_SROMC>; + clock-names = "sromc"; + }; +}; + +&xxti { + clock-frequency = <24000000>; +}; + +&uart0 { + status = "okay"; +}; + +&nand { + status = "okay"; + nand-ecc-mode = "soft"; + + partition@0 { + label = "boot"; + reg = <0x0 0x40000>; /* 246KB */ + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x40000 0x300000>; /* 3MB */ + }; + + partition@340000 { + label = "rootfs"; + reg = <0x340000 0x3fcc0000>; /* 1020MB */ + }; +}; diff --git a/target/linux/samsung/files-4.14/drivers/mtd/nand/s5pxx_nand.c b/target/linux/samsung/files-4.14/drivers/mtd/nand/s5pxx_nand.c new file mode 100644 index 000000000..26ec75dd1 --- /dev/null +++ b/target/linux/samsung/files-4.14/drivers/mtd/nand/s5pxx_nand.c @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2018 Jianhui Zhao + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define S5P_NFCONF 0x00 +#define S5P_NFCONT 0x04 +#define S5P_NFCMD 0x08 +#define S5P_NFADDR 0x0c +#define S5P_NFDATA 0x10 +#define S5P_NFMECCDATA0 0x14 +#define S5P_NFMECCDATA1 0x18 +#define S5P_NFSECCDATA 0x1c +#define S5P_NFSBLK 0x20 +#define S5P_NFEBLK 0x24 +#define S5P_NFSTAT 0x28 +#define S5P_NFMECCERR0 0x2c +#define S5P_NFMECCERR1 0x30 +#define S5P_NFMECC0 0x34 +#define S5P_NFMECC1 0x38 +#define S5P_NFSECC 0x3c +#define S5P_NFMLCBITPT 0x40 +#define S5P_NF8ECCERR0 0x44 +#define S5P_NF8ECCERR1 0x48 +#define S5P_NF8ECCERR2 0x4C +#define S5P_NFM8ECC0 0x50 +#define S5P_NFM8ECC1 0x54 +#define S5P_NFM8ECC2 0x58 +#define S5P_NFM8ECC3 0x5C +#define S5P_NFMLC8BITPT0 0x60 +#define S5P_NFMLC8BITPT1 0x64 + +#define S5P_NFECCCONF 0x00 +#define S5P_NFECCCONT 0x20 +#define S5P_NFECCSTAT 0x30 +#define S5P_NFECCSECSTAT 0x40 +#define S5P_NFECCPRGECC 0x90 +#define S5P_NFECCERL 0xC0 +#define S5P_NFECCERP 0xF0 + +#define S5P_NFCONF_NANDBOOT (1 << 31) +#define S5P_NFCONF_ECCCLKCON (1 << 30) +#define S5P_NFCONF_ECC_MLC (1 << 24) +#define S5P_NFCONF_ECC_1BIT (0 << 23) +#define S5P_NFCONF_ECC_4BIT (2 << 23) +#define S5P_NFCONF_ECC_8BIT (1 << 23) +#define S5P_NFCONF_TACLS(x) ((x) << 12) +#define S5P_NFCONF_TWRPH0(x) ((x) << 8) +#define S5P_NFCONF_TWRPH1(x) ((x) << 4) +#define S5P_NFCONF_MLC (1 << 3) +#define S5P_NFCONF_PAGESIZE (1 << 2) +#define S5P_NFCONF_ADDRCYCLE (1 << 1) +#define S5P_NFCONF_BUSWIDTH (1 << 0) + +#define S5P_NFCONT_ECC_ENC (1 << 18) +#define S5P_NFCONT_LOCKTGHT (1 << 17) +#define S5P_NFCONT_LOCKSOFT (1 << 16) +#define S5P_NFCONT_MECCLOCK (1 << 7) +#define S5P_NFCONT_SECCLOCK (1 << 6) +#define S5P_NFCONT_INITMECC (1 << 5) +#define S5P_NFCONT_INITSECC (1 << 4) +#define S5P_NFCONT_nFCE1 (1 << 2) +#define S5P_NFCONT_nFCE0 (1 << 1) +#define S5P_NFCONT_MODE (1 << 0) + +#define S5P_NFSTAT_READY (1 << 0) + +#define S5P_NFECCCONT_MECCRESET (1 << 0) +#define S5P_NFECCCONT_MECCINIT (1 << 2) +#define S5P_NFECCCONT_ECCDIRWR (1 << 16) + +#define S5P_NFECCSTAT_ECCBUSY (1 << 31) + +enum s5p_cpu_type { + TYPE_S5PV210, +}; + +struct s5p_nand_host { + struct nand_chip nand_chip; + void __iomem *nf_base; + void __iomem *ecc_base; + struct clk *clk[2]; + enum s5p_cpu_type cpu_type; +}; + +/* + * See "S5PV210 iROM Application Note" for recommended ECC layout + * ECC layout for 8-bit ECC (13 bytes/page) + * Compatible with bl0 bootloader, see iROM appnote + */ +/* new oob placement block for use with hardware ecc generation + */ +static int s5pcxx_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *oobregion) +{ + if (section) + return -ERANGE; + + oobregion->offset = 12; + oobregion->length = 52; + + return 0; +} + +static int s5pcxx_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *oobregion) +{ + if (section) + return -ERANGE; + + oobregion->offset = 2; + oobregion->length = 10; + + return 0; +} + +static const struct mtd_ooblayout_ops s5pcxx_ooblayout_ops = { + .ecc = s5pcxx_ooblayout_ecc, + .free = s5pcxx_ooblayout_free, +}; + +static inline void rwl(void *reg, uint32_t rst, uint32_t set) +{ + uint32_t r; + r = readl(reg); + r &= ~rst; + r |= set; + writel(r, reg); +} + +/* + * Hardware specific access to control-lines function + */ +static void s5p_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl) +{ + struct nand_chip *nand_chip = mtd->priv; + struct s5p_nand_host *host = nand_chip->priv; + + if (dat == NAND_CMD_NONE) + return; + + if (ctrl & NAND_CLE) + writeb(dat, host->nf_base + S5P_NFCMD); + else + writeb(dat, host->nf_base + S5P_NFADDR); +} + +/* + * Function for checking device ready pin + */ +static int s5p_nand_device_ready(struct mtd_info *mtd) +{ + struct nand_chip *nand_chip = mtd->priv; + struct s5p_nand_host *host = nand_chip->priv; + + /* it's to check the RnB nand signal bit and + * return to device ready condition in nand_base.c + */ + return readl(host->nf_base + S5P_NFSTAT) & S5P_NFSTAT_READY; +} + +static void s3_nand_select_chip(struct mtd_info *mtd, int chip) +{ + struct nand_chip *nand_chip = mtd->priv; + struct s5p_nand_host *host = nand_chip->priv; + u32 value = readl(host->nf_base + S5P_NFCONT); + + if (chip == -1) + value |= S5P_NFCONT_nFCE0; /* deselect */ + else + value &= ~S5P_NFCONT_nFCE0; /* select */ + + writel(value, host->nf_base + S5P_NFCONT); +} + +static void s5pcxx_nand_enable_hwecc(struct mtd_info *mtd, int mode) +{ + struct nand_chip *chip = mtd->priv; + struct s5p_nand_host *host = chip->priv; + + uint32_t reg; + + /* Set ECC mode */ + reg = 3; /* 8-bit */ + reg |= (chip->ecc.size - 1) << 16; + writel(reg, host->ecc_base + S5P_NFECCCONF); + + /* Set ECC direction */ + rwl(host->ecc_base + S5P_NFECCCONT, S5P_NFECCCONT_ECCDIRWR, + (mode == NAND_ECC_WRITE) ? S5P_NFECCCONT_ECCDIRWR : 0); + + /* Reset status bits */ + rwl(host->ecc_base + S5P_NFECCSTAT, 0, (1 << 24) | (1 << 25)); + + /* Unlock ECC */ + rwl(host->nf_base + S5P_NFCONT, S5P_NFCONT_MECCLOCK, 0); + + /* Initialize ECC */ + rwl(host->ecc_base +S5P_NFECCCONT, 0, S5P_NFECCCONT_MECCINIT); +} + +static void readecc(void *eccbase, uint8_t *ecc_code, unsigned ecc_len) +{ + uint32_t i, j, reg; + + for (i = 0; i < ecc_len; i += 4) { + reg = readl(eccbase + i); + for (j = 0; (j < 4) && (i + j < ecc_len); ++j) { + ecc_code[i + j] = reg & 0xFF; + reg >>= 8; + } + } +} + +static int s5pcxx_nand_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code) +{ + struct nand_chip *chip = mtd->priv; + struct s5p_nand_host *host = chip->priv; + + /* Lock ECC */ + rwl(host->nf_base + S5P_NFCONT, 0, S5P_NFCONT_MECCLOCK); + + if (ecc_code) /* NAND_ECC_WRITE */ { + /* ECC encoding is completed */ + while (!(readl(host->ecc_base + S5P_NFECCSTAT) & (1 << 25))); + readecc(host->ecc_base + S5P_NFECCPRGECC, ecc_code, chip->ecc.bytes); + } else { /* NAND_ECC_READ */ + /* ECC decoding is completed */ + while (!(readl(host->ecc_base + S5P_NFECCSTAT) & (1 << 24))); + } + + return 0; +} + +static int s5pcxx_nand_correct_data(struct mtd_info *mtd, u8 *dat, + u8 *read_ecc, u8 *calc_ecc) +{ + int ret = 0; + u32 errNo; + u32 erl0, erl1, erl2, erl3, erp0, erp1; + struct nand_chip *chip = mtd->priv; + struct s5p_nand_host *host = chip->priv; + + /* Wait until the 8-bit ECC decoding engine is Idle */ + while (readl(host->ecc_base + S5P_NFECCSTAT) & (1 << 31)); + + errNo = readl(host->ecc_base + S5P_NFECCSECSTAT) & 0x1F; + erl0 = readl(host->ecc_base + S5P_NFECCERL); + erl1 = readl(host->ecc_base + S5P_NFECCERL + 0x04); + erl2 = readl(host->ecc_base + S5P_NFECCERL + 0x08); + erl3 = readl(host->ecc_base + S5P_NFECCERL + 0x0C); + + erp0 = readl(host->ecc_base + S5P_NFECCERP); + erp1 = readl(host->ecc_base + S5P_NFECCERP + 0x04); + + switch (errNo) { + case 8: + dat[(erl3 >> 16) & 0x3FF] ^= (erp1 >> 24) & 0xFF; + case 7: + dat[erl3 & 0x3FF] ^= (erp1 >> 16) & 0xFF; + case 6: + dat[(erl2 >> 16) & 0x3FF] ^= (erp1 >> 8) & 0xFF; + case 5: + dat[erl2 & 0x3FF] ^= erp1 & 0xFF; + case 4: + dat[(erl1 >> 16) & 0x3FF] ^= (erp0 >> 24) & 0xFF; + case 3: + dat[erl1 & 0x3FF] ^= (erp0 >> 16) & 0xFF; + case 2: + dat[(erl0 >> 16) & 0x3FF] ^= (erp0 >> 8) & 0xFF; + case 1: + dat[erl0 & 0x3FF] ^= erp0 & 0xFF; + case 0: + break; + default: + ret = -1; + printk("ECC uncorrectable error detected:%d\n", errNo); + break; + } + + return ret; +} + +static int s5pcxx_nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, + uint8_t *buf, int oob_required, int page) +{ + struct mtd_oob_region oobregion = { }; + int i, eccsize = chip->ecc.size; + int eccbytes = chip->ecc.bytes; + int eccsteps = chip->ecc.steps; + uint8_t *oobecc; + int col, stat; + + /* Read the OOB area first */ + chip->ecc.read_oob(mtd, chip, page); + mtd_ooblayout_ecc(mtd, 0, &oobregion); + oobecc = chip->oob_poi + oobregion.offset; + + for (i = 0, col = 0; eccsteps; eccsteps--, i += eccbytes, buf += eccsize, col += eccsize) { + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, col, -1); + chip->ecc.hwctl(mtd, NAND_ECC_READ); + chip->read_buf(mtd, buf, eccsize); + chip->write_buf(mtd, oobecc + i, eccbytes); + chip->ecc.calculate(mtd, NULL, NULL); + stat = chip->ecc.correct(mtd, buf, NULL, NULL); + if (stat < 0) + mtd->ecc_stats.failed++; + else + mtd->ecc_stats.corrected += stat; + } + return 0; +} + +static void s5p_nand_inithw_later(struct mtd_info *mtd) +{ + struct nand_chip *chip = mtd->priv; + struct s5p_nand_host *host = chip->priv; + u32 value; + + value = readl(host->nf_base + S5P_NFCONF); + + if (nand_is_slc(chip)) { + value &= ~S5P_NFCONF_MLC; + + if (mtd->writesize == 512) { + value |= S5P_NFCONF_PAGESIZE; + + } else { + value &= ~S5P_NFCONF_PAGESIZE; + } + } else { + value |= S5P_NFCONF_MLC; + + if (mtd->writesize == 4096) + value &= ~S5P_NFCONF_PAGESIZE; + else + value |= S5P_NFCONF_PAGESIZE; + } +} + +static void s5p_nand_inithw(struct s5p_nand_host *host) +{ + u32 value; + + /* Enable NAND Flash Controller */ + value = readl(host->nf_base + S5P_NFCONT); + writel(value | S5P_NFCONT_MODE, host->nf_base + S5P_NFCONT); +} + +static void s5p_nand_parse_dt(struct s5p_nand_host *host, struct device *dev) +{ + host->cpu_type = (enum s5p_cpu_type)of_device_get_match_data(dev); +} + +static int s5p_nand_probe(struct platform_device *pdev) +{ + int ret; + struct s5p_nand_host *host; + struct nand_chip *nand_chip; + struct mtd_info *mtd; + struct resource *mem; + + /* Allocate memory for the device structure (and zero it) */ + host = devm_kzalloc(&pdev->dev, sizeof(struct s5p_nand_host), GFP_KERNEL); + if (!host) + return -ENOMEM; + + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + host->nf_base = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(host->nf_base)) + return PTR_ERR(host->nf_base); + + mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); + host->ecc_base = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(host->ecc_base)) + return PTR_ERR(host->ecc_base); + + nand_chip = &host->nand_chip; + nand_chip->priv = host; + nand_set_flash_node(nand_chip, pdev->dev.of_node); + + mtd = nand_to_mtd(nand_chip); + mtd->dev.parent = &pdev->dev; + mtd->priv = nand_chip; + + /* Disable chip select and Enable NAND Flash Controller */ + writel((0x1 << 1) | (0x1 << 0), host->nf_base + S5P_NFCONT); + + /* Set address of NAND IO lines */ + nand_chip->IO_ADDR_R = host->nf_base + S5P_NFDATA; + nand_chip->IO_ADDR_W = host->nf_base + S5P_NFDATA; + + platform_set_drvdata(pdev, host); + + /* get the clock source and enable it */ + host->clk[0] = devm_clk_get(&pdev->dev, "nandxl"); + if (IS_ERR(host->clk[0])) { + dev_err(&pdev->dev, "cannot get clock of nandxl\n"); + return -ENOENT; + } + clk_prepare_enable(host->clk[0]); + + host->clk[1] = devm_clk_get(&pdev->dev, "nand"); + if (IS_ERR(host->clk[1])) { + dev_err(&pdev->dev, "cannot get clock of nand\n"); + return -ENOENT; + } + clk_prepare_enable(host->clk[1]); + + s5p_nand_parse_dt(host, &pdev->dev); + + nand_chip->select_chip = s3_nand_select_chip; + nand_chip->cmd_ctrl = s5p_cmd_ctrl; + nand_chip->dev_ready = s5p_nand_device_ready; + + s5p_nand_inithw(host); + + ret = nand_scan_ident(mtd, 1, NULL); + if (ret) + return ret; + + if (nand_chip->ecc.mode == NAND_ECC_HW) { + nand_chip->ecc.correct = s5pcxx_nand_correct_data; + nand_chip->ecc.calculate = s5pcxx_nand_calculate_ecc; + nand_chip->ecc.hwctl = s5pcxx_nand_enable_hwecc; + nand_chip->ecc.read_page = s5pcxx_nand_read_page_hwecc; + + nand_chip->ecc.size = 512; + nand_chip->ecc.bytes = 13; + + mtd_set_ooblayout(nand_to_mtd(nand_chip), &s5pcxx_ooblayout_ops); + } + + ret = nand_scan_tail(mtd); + if (ret) + return ret; + + /* After you get the actual hardware information */ + s5p_nand_inithw_later(mtd); + + return mtd_device_parse_register(mtd, NULL, NULL, NULL, 0); +} + +static int s5p_nand_remove(struct platform_device *pdev) +{ + struct s5p_nand_host *host = platform_get_drvdata(pdev); + struct mtd_info *mtd = nand_to_mtd(&host->nand_chip); + + nand_release(mtd); + clk_disable_unprepare(host->clk[0]); /* nandxl */ + clk_disable_unprepare(host->clk[1]); /* nand */ + + return 0; +} + +static const struct of_device_id s5p_nand_match[] = { + { .compatible = "samsung,s5pv210-nand", .data = TYPE_S5PV210 }, + {}, +}; +MODULE_DEVICE_TABLE(of, s5p_nand_match); + +static struct platform_driver s5p_nand_driver = { + .probe = s5p_nand_probe, + .remove = s5p_nand_remove, + .driver = { + .name = "s5p-nand", + .owner = THIS_MODULE, + .of_match_table = s5p_nand_match, + }, +}; +module_platform_driver(s5p_nand_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Jianhui Zhao "); +MODULE_DESCRIPTION("S5Pxx MTD NAND driver"); diff --git a/target/linux/samsung/image/Makefile b/target/linux/samsung/image/Makefile new file mode 100644 index 000000000..f0b1842ca --- /dev/null +++ b/target/linux/samsung/image/Makefile @@ -0,0 +1,25 @@ +# +# Copyright (C) 2018 Jianhui Zhao +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +KERNEL_LOADADDR := 0x20008000 + +define Device/Default + PROFILES = Default + KERNEL_NAME := zImage + KERNEL := kernel-bin | append-dtb | uImage none +endef + +define Device/tq210 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS := TQ210 + DEVICE_TITLE := TQ210 +endef +TARGET_DEVICES += tq210 + +$(eval $(call BuildImage)) diff --git a/target/linux/samsung/patches-4.14/001-s5pv210-nand.patch b/target/linux/samsung/patches-4.14/001-s5pv210-nand.patch new file mode 100644 index 000000000..3a35e26f3 --- /dev/null +++ b/target/linux/samsung/patches-4.14/001-s5pv210-nand.patch @@ -0,0 +1,44 @@ +--- a/arch/arm/boot/dts/s5pv210.dtsi ++++ b/arch/arm/boot/dts/s5pv210.dtsi +@@ -95,6 +95,16 @@ + status = "disabled"; + }; + ++ nand: nand@b0000000 { ++ compatible = "samsung,s5pv210-nand"; ++ reg = <0xb0e00000 0x40>, <0xb0e20000 0x200>; ++ clocks = <&clocks CLK_NANDXL>, <&clocks CLK_NFCON>; ++ clock-names = "nandxl", "nand"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ status = "disabled"; ++ }; ++ + chipid@e0000000 { + compatible = "samsung,s5pv210-chipid"; + reg = <0xe0000000 0x1000>; +--- a/drivers/mtd/nand/Kconfig ++++ b/drivers/mtd/nand/Kconfig +@@ -181,6 +181,12 @@ config MTD_NAND_S3C2410_CLKSTOP + when the is NAND chip selected or released, but will save + approximately 5mA of power when there is nothing happening. + ++config MTD_NAND_S5PXX ++ tristate "NAND Flash support for Samsung S5Pxx SoCs" ++ depends on ARCH_S5PV210 ++ help ++ This enables the NAND flash controller on the S5Pxx SoCs ++ + config MTD_NAND_TANGO + tristate "NAND Flash support for Tango chips" + depends on ARCH_TANGO || COMPILE_TEST +--- a/drivers/mtd/nand/Makefile ++++ b/drivers/mtd/nand/Makefile +@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_NAND_DENALI_DT) += dena + obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o + obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o + obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o ++obj-$(CONFIG_MTD_NAND_S5PXX) += s5pxx_nand.o + obj-$(CONFIG_MTD_NAND_TANGO) += tango_nand.o + obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o + obj-$(CONFIG_MTD_NAND_DISKONCHIP) += diskonchip.o diff --git a/target/linux/samsung/patches-4.14/002-dm9000-clk.patch b/target/linux/samsung/patches-4.14/002-dm9000-clk.patch new file mode 100644 index 000000000..1bf2a7ab2 --- /dev/null +++ b/target/linux/samsung/patches-4.14/002-dm9000-clk.patch @@ -0,0 +1,37 @@ +--- a/drivers/net/ethernet/davicom/dm9000.c ++++ b/drivers/net/ethernet/davicom/dm9000.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1436,6 +1437,7 @@ dm9000_probe(struct platform_device *pde + enum of_gpio_flags flags; + struct regulator *power; + bool inv_mac_addr = false; ++ const char *clk_name; + + power = devm_regulator_get(dev, "vcc"); + if (IS_ERR(power)) { +@@ -1573,6 +1575,18 @@ dm9000_probe(struct platform_device *pde + goto out; + } + ++ /* Enable clock if specified */ ++ if (!of_property_read_string(dev->of_node, "clock-names", &clk_name)) { ++ struct clk *clk = devm_clk_get(dev, clk_name); ++ if (IS_ERR(clk)) { ++ dev_err(dev, "cannot get clock of %s\n", clk_name); ++ ret = PTR_ERR(clk); ++ goto out; ++ } ++ clk_prepare_enable(clk); ++ dev_info(dev, "enable clock '%s'\n", clk_name); ++ } ++ + /* fill in parameters for net-dev structure */ + ndev->base_addr = (unsigned long)db->io_addr; + diff --git a/target/linux/samsung/s5pv210/config-4.14 b/target/linux/samsung/s5pv210/config-4.14 new file mode 100644 index 000000000..838d31314 --- /dev/null +++ b/target/linux/samsung/s5pv210/config-4.14 @@ -0,0 +1,414 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +CONFIG_ARCH_MULTI_V6_V7=y +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_NR_GPIO=512 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_S5PV210=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +# CONFIG_ARCH_WANTS_THP_SWAP is not set +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_APPENDED_DTB=y +# CONFIG_ARM_ATAG_DTB_COMPAT is not set +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_HEAVY_MB=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_L1_CACHE_SHIFT_6=y +# CONFIG_ARM_LPAE is not set +CONFIG_ARM_PATCH_IDIV=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +# CONFIG_ARM_SMMU is not set +CONFIG_ARM_THUMB=y +# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_UNWIND=y +CONFIG_ARM_VIC=y +CONFIG_ARM_VIC_NR=4 +CONFIG_ARM_VIRT_EXT=y +CONFIG_ATAGS=y +CONFIG_AUTO_ZRELADDR=y +# CONFIG_BLK_DEV is not set +# CONFIG_BPF_SYSCALL is not set +CONFIG_CACHE_L2X0=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_SAMSUNG_PWM=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_SAMSUNG=y +CONFIG_COMPACTION=y +CONFIG_COMPAT_BRK=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_COREDUMP=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_HAS_ASID=y +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_PM=y +CONFIG_CPU_S5PV210=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_V7=y +# CONFIG_CRASHLOG is not set +CONFIG_CRC16=y +# CONFIG_CRC32_SARWATE is not set +CONFIG_CRC32_SLICEBY8=y +CONFIG_CRC_CCITT=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_CRYPTO_ACOMP2=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_ALIGN_RODATA=y +CONFIG_DEBUG_ATOMIC_SLEEP=y +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_FS is not set +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +CONFIG_DEBUG_LL=y +CONFIG_DEBUG_LL_INCLUDE="debug/s5pv210.S" +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DEBUG_MUTEXES=y +CONFIG_DEBUG_RT_MUTEXES=y +CONFIG_DEBUG_S3C_UART=0 +CONFIG_DEBUG_S3C_UART0=y +# CONFIG_DEBUG_S3C_UART1 is not set +# CONFIG_DEBUG_S3C_UART2 is not set +# CONFIG_DEBUG_S3C_UART3 is not set +CONFIG_DEBUG_S5PV210_UART=y +CONFIG_DEBUG_SPINLOCK=y +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_DEBUG_UNCOMPRESS=y +CONFIG_DEBUG_USER=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_LZ4=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_DEFAULT_NOOP=y +CONFIG_DEVMEM=y +CONFIG_DM9000=y +# CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL is not set +# CONFIG_DMA_NOOP_OPS is not set +# CONFIG_DMA_VIRT_OPS is not set +CONFIG_DNOTIFY=y +# CONFIG_DRM_LIB_RANDOM is not set +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_EARLY_PRINTK=y +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +CONFIG_ELF_CORE=y +# CONFIG_EMBEDDED is not set +# CONFIG_ENABLE_DEFAULT_TRACERS is not set +CONFIG_ENABLE_MUST_CHECK=y +# CONFIG_EXPERT is not set +CONFIG_EXPORTFS=y +# CONFIG_EXYNOS_AUDSS_CLK_CON is not set +CONFIG_FHANDLE=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FREEZER=y +CONFIG_FS_POSIX_ACL=y +CONFIG_FTRACE=y +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_FUTEX_PI=y +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GPIOLIB=y +# CONFIG_GRO_CELLS is not set +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ARM_SMCCC=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_SMP=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_UID16=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +CONFIG_HZ_FIXED=0 +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +# CONFIG_INPUT_MISC is not set +CONFIG_IOMMU_HELPER=y +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_SUPPORT=y +# CONFIG_IOSCHED_DEADLINE is not set +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISDN is not set +# CONFIG_JFFS2_FS is not set +CONFIG_KALLSYMS=y +CONFIG_KALLSYMS_ALL=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_MODE_NEON is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_LBDAF is not set +CONFIG_LIBFDT=y +CONFIG_LOCALVERSION_AUTO=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_MANDATORY_FILE_LOCKING=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_MIGRATION=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MODULE_STRIPPED is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_S5PXX=y +# CONFIG_MTD_ROOTFS_ROOT_DEV is not set +CONFIG_MTD_SPLIT_FIRMWARE=y +# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_BLOCK=y +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MULTI_IRQ_HANDLER=y +CONFIG_NAMESPACES=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NEON=y +# CONFIG_NETWORK_FILESYSTEMS is not set +# CONFIG_NET_CADENCE is not set +CONFIG_NET_NS=y +# CONFIG_NEW_LEDS is not set +CONFIG_NLS=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NO_BOOTMEM=y +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_IOPORT_MAP=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_PAGE_OFFSET=0x80000000 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_PARTITION_ADVANCED is not set +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PID_NS=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_EXYNOS=y +CONFIG_PINCTRL_EXYNOS_ARM=y +CONFIG_PINCTRL_SAMSUNG=y +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PL310_ERRATA_588369 is not set +# CONFIG_PL310_ERRATA_727915 is not set +# CONFIG_PL310_ERRATA_753970 is not set +# CONFIG_PL310_ERRATA_769419 is not set +CONFIG_PLAT_SAMSUNG=y +CONFIG_PM=y +CONFIG_PM_CLK=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_RCU=y +# CONFIG_PROBE_EVENTS is not set +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_RATIONAL=y +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +# CONFIG_RCU_EXPERT is not set +CONFIG_RCU_NEED_SEGCBLIST=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RD_BZIP2=y +CONFIG_RD_GZIP=y +CONFIG_RD_LZ4=y +CONFIG_RD_LZMA=y +CONFIG_RD_LZO=y +CONFIG_RD_XZ=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SAMSUNG_ATAGS is not set +# CONFIG_SAMSUNG_PM_CHECK is not set +CONFIG_SCHED_DEBUG=y +# CONFIG_SCHED_INFO is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250_CONSOLE is not set +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_AMBA_PL011 is not set +CONFIG_SERIAL_SAMSUNG=y +CONFIG_SERIAL_SAMSUNG_CONSOLE=y +# CONFIG_SERIAL_SAMSUNG_DEBUG is not set +CONFIG_SERIAL_SAMSUNG_UARTS=4 +CONFIG_SERIAL_SAMSUNG_UARTS_4=y +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +CONFIG_SLUB_DEBUG=y +CONFIG_SPARSE_IRQ=y +# CONFIG_SQUASHFS is not set +CONFIG_SRCU=y +# CONFIG_STAGING is not set +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_SWIOTLB=y +# CONFIG_SWP_EMULATE is not set +CONFIG_SYSFS_DEPRECATED=y +CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSVIPC is not set +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TASKS_RCU=y +# CONFIG_TEXTSEARCH is not set +CONFIG_THIN_ARCHIVES=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TRACING_EVENTS_GPIO=y +CONFIG_TREE_SRCU=y +CONFIG_UBIFS_FS=y +# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNINLINE_SPIN_UNLOCK=y +# CONFIG_USERIO is not set +# CONFIG_USER_NS is not set +CONFIG_USE_OF=y +CONFIG_UTS_NS=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_3G is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_WATCHDOG is not set +# CONFIG_WIRELESS is not set +# CONFIG_WLAN is not set +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_X86=y +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/samsung/s5pv210/profiles/00-default.mk b/target/linux/samsung/s5pv210/profiles/00-default.mk new file mode 100644 index 000000000..5dd687976 --- /dev/null +++ b/target/linux/samsung/s5pv210/profiles/00-default.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2017 Lede +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Default + NAME:=Default Profile (all drivers) + PRIORITY := 1 +endef + +define Profile/Default/Description + Default profile with package set compatible with most boards. +endef +$(eval $(call Profile,Default)) diff --git a/target/linux/samsung/s5pv210/target.mk b/target/linux/samsung/s5pv210/target.mk new file mode 100644 index 000000000..a960a537d --- /dev/null +++ b/target/linux/samsung/s5pv210/target.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2018 Jianhui Zhao +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +SUBTARGET:=s5pv210 +BOARDNAME:=s5pv210 based boards +FEATURES+=fpu +CPU_TYPE:=cortex-a8 +CPU_SUBTYPE:=neon + +define Target/Description + Build firmware images for Samsung s5pv210 based boards. +endef + diff --git a/target/linux/sunxi/config-4.14 b/target/linux/sunxi/config-4.14 index 197e099ab..6e318250a 100644 --- a/target/linux/sunxi/config-4.14 +++ b/target/linux/sunxi/config-4.14 @@ -67,6 +67,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BACKLIGHT_PWM=y CONFIG_BINFMT_MISC=y CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_SD=y CONFIG_BLK_SCSI_REQUEST=y CONFIG_BOUNCE=y # CONFIG_BPF_SYSCALL is not set diff --git a/target/linux/sunxi/image/cortex-a53.mk b/target/linux/sunxi/image/cortex-a53.mk index 344071b94..e40f35cb3 100644 --- a/target/linux/sunxi/image/cortex-a53.mk +++ b/target/linux/sunxi/image/cortex-a53.mk @@ -48,4 +48,14 @@ endef TARGET_DEVICES += sun50i-h5-orangepi-zero-plus +define Device/sun50i-h5-orangepi-pc2 + DEVICE_TITLE:=Xunlong Orange Pi PC2 + SUPPORTED_DEVICES:=xunlong,orangepi-pc2 + SUNXI_DTS:=allwinner/sun50i-h5-orangepi-pc2 + KERNEL_NAME := Image + KERNEL := kernel-bin +endef + +TARGET_DEVICES += sun50i-h5-orangepi-pc2 + endif diff --git a/target/linux/sunxi/patches-4.14/301-orangepi_pc2_usb_otg_to_host_key_power.patch b/target/linux/sunxi/patches-4.14/301-orangepi_pc2_usb_otg_to_host_key_power.patch new file mode 100644 index 000000000..d8693374d --- /dev/null +++ b/target/linux/sunxi/patches-4.14/301-orangepi_pc2_usb_otg_to_host_key_power.patch @@ -0,0 +1,20 @@ +--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +@@ -87,7 +87,7 @@ + + sw4 { + label = "sw4"; +- linux,code = ; ++ linux,code = ; + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>; + }; + }; +@@ -203,7 +203,7 @@ + }; + + &usb_otg { +- dr_mode = "otg"; ++ dr_mode = "host"; + status = "okay"; + }; + diff --git a/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch b/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch index 7549d4995..22d62f096 100644 --- a/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch +++ b/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch @@ -770,7 +770,7 @@ }; --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c -@@ -380,8 +380,8 @@ static int socfpga_dwmac_resume(struct d +@@ -390,8 +390,8 @@ static int socfpga_dwmac_resume(struct d * control register 0, and can be modified by the phy driver * framework. */ diff --git a/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch b/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch index cd3e52a21..2ce23e2eb 100644 --- a/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch +++ b/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch @@ -597,7 +597,7 @@ { .compatible = "rockchip,rk3399-gmac", .data = &rk3399_ops }, --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c -@@ -341,7 +341,7 @@ static int socfpga_dwmac_probe(struct pl +@@ -351,7 +351,7 @@ static int socfpga_dwmac_probe(struct pl * mode. Create a copy of the core reset handle so it can be used by * the driver later. */ diff --git a/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch b/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch index d71821ad7..abdc618e6 100644 --- a/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch +++ b/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch @@ -47,7 +47,7 @@ struct mii_regs { --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c -@@ -269,7 +269,10 @@ static int socfpga_dwmac_set_phy_mode(st +@@ -270,7 +270,10 @@ static int socfpga_dwmac_set_phy_mode(st ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift); ctrl |= val << reg_shift; diff --git a/target/linux/xburst/Makefile b/target/linux/xburst/Makefile new file mode 100644 index 000000000..16d0b8b1b --- /dev/null +++ b/target/linux/xburst/Makefile @@ -0,0 +1,25 @@ +# +# Copyright (C) 2009-2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=mipsel +BOARD:=xburst +BOARDNAME:=Ingenic XBurst +FEATURES:=targz nand ubifs audio source-only +SUBTARGETS:=qi_lb60 + +KERNEL_PATCHVER:=3.18 + +DEVICE_TYPE:=other + +define Target/Description + Build firmware images for XBurst JZ47x0 based boards. +endef + +include $(INCLUDE_DIR)/target.mk + +$(eval $(call BuildTarget)) diff --git a/target/linux/xburst/base-files/etc/board.d/01_system b/target/linux/xburst/base-files/etc/board.d/01_system new file mode 100755 index 000000000..16f4987aa --- /dev/null +++ b/target/linux/xburst/base-files/etc/board.d/01_system @@ -0,0 +1,12 @@ +#!/bin/sh + +. /lib/functions/uci-defaults.sh + +board_config_update + +ucidef_set_hostname "BenNanoNote" +ucidef_set_ntpserver + +board_config_flush + +exit 0 diff --git a/target/linux/xburst/base-files/etc/config/fstab b/target/linux/xburst/base-files/etc/config/fstab new file mode 100644 index 000000000..522356112 --- /dev/null +++ b/target/linux/xburst/base-files/etc/config/fstab @@ -0,0 +1,6 @@ +config mount + option target /card + option device /dev/mmcblk0p1 + option fstype auto + option options rw,sync + option enabled 1 diff --git a/target/linux/xburst/base-files/etc/config/network b/target/linux/xburst/base-files/etc/config/network new file mode 100644 index 000000000..a086003e3 --- /dev/null +++ b/target/linux/xburst/base-files/etc/config/network @@ -0,0 +1,13 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname usb0 + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/target/linux/xburst/config-3.18 b/target/linux/xburst/config-3.18 new file mode 100644 index 000000000..099f5b0ed --- /dev/null +++ b/target/linux/xburst/config-3.18 @@ -0,0 +1,346 @@ +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_ARCH_HAS_SG_CHAIN is not set +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_BACKLIGHT_PWM is not set +CONFIG_BATTERY_JZ4740=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_CHARGER_GPIO=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CONFIGFS_FS=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +CONFIG_CPU_MIPSR1=y +CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_R4K_FPU=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CRC16=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_DMADEVICES=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_JZ4740=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DUMMY_CONSOLE=y +# CONFIG_DW_DMAC_CORE is not set +CONFIG_EARLY_PRINTK=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_EXT4_FS=y +CONFIG_FAT_FS=y +CONFIG_FB=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_JZ4740=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FONTS=y +# CONFIG_FONT_10x18 is not set +# CONFIG_FONT_6x10 is not set +CONFIG_FONT_6x11=y +# CONFIG_FONT_7x14 is not set +# CONFIG_FONT_8x16 is not set +# CONFIG_FONT_8x8 is not set +# CONFIG_FONT_ACORN_8x8 is not set +# CONFIG_FONT_MINI_4x6 is not set +# CONFIG_FONT_PEARL_8x8 is not set +# CONFIG_FONT_SUN12x22 is not set +# CONFIG_FONT_SUN8x16 is not set +CONFIG_FONT_SUPPORT=y +CONFIG_FORCE_MAX_ZONEORDER=12 +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FREEZER=y +CONFIG_FS_MBCACHE=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HW_CONSOLE=y +CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_KEYBOARD=y +CONFIG_INPUT_MATRIXKMAP=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_PWM_BEEPER=y +CONFIG_INPUT_UINPUT=y +CONFIG_IRQ_CPU=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_JZ4740_QI_LB60=y +CONFIG_KALLSYMS=y +CONFIG_KEXEC=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_MATRIX=y +# CONFIG_LCD_AMS369FG06 is not set +CONFIG_LCD_CLASS_DEVICE=y +CONFIG_LCD_ILI8960=y +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=2 +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACH_JZ4740=y +CONFIG_MFD_CORE=y +CONFIG_MFD_JZ4740_ADC=y +CONFIG_MIPS=y +# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_MACHINE is not set +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +# CONFIG_MMC_BLOCK_BOUNCE is not set +CONFIG_MMC_JZ4740=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +# CONFIG_MOUSE_PS2 is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_JZ4740=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_BLOCK is not set +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MUSB_PIO_ONLY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NLS=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_CODEPAGE_1250=y +CONFIG_NLS_CODEPAGE_1251=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_737=y +CONFIG_NLS_CODEPAGE_775=y +CONFIG_NLS_CODEPAGE_850=y +CONFIG_NLS_CODEPAGE_852=y +CONFIG_NLS_CODEPAGE_855=y +CONFIG_NLS_CODEPAGE_857=y +CONFIG_NLS_CODEPAGE_860=y +CONFIG_NLS_CODEPAGE_861=y +CONFIG_NLS_CODEPAGE_862=y +CONFIG_NLS_CODEPAGE_863=y +CONFIG_NLS_CODEPAGE_864=y +CONFIG_NLS_CODEPAGE_865=y +CONFIG_NLS_CODEPAGE_866=y +CONFIG_NLS_CODEPAGE_869=y +CONFIG_NLS_CODEPAGE_874=y +CONFIG_NLS_CODEPAGE_932=y +CONFIG_NLS_CODEPAGE_936=y +CONFIG_NLS_CODEPAGE_949=y +CONFIG_NLS_CODEPAGE_950=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_13=y +CONFIG_NLS_ISO8859_14=y +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_ISO8859_2=y +CONFIG_NLS_ISO8859_3=y +CONFIG_NLS_ISO8859_4=y +CONFIG_NLS_ISO8859_5=y +CONFIG_NLS_ISO8859_6=y +CONFIG_NLS_ISO8859_7=y +CONFIG_NLS_ISO8859_8=y +CONFIG_NLS_ISO8859_9=y +CONFIG_NLS_KOI8_R=y +CONFIG_NLS_KOI8_U=y +CONFIG_NLS_UTF8=y +CONFIG_NOP_USB_XCEIV=y +# CONFIG_NO_IOPORT_MAP is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PM=y +CONFIG_PM_CLK=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_POWER_SUPPLY=y +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_RCU=y +CONFIG_PRINTK_TIME=y +CONFIG_PWM=y +CONFIG_PWM_JZ4740=y +CONFIG_PWM_SYSFS=y +# CONFIG_RCU_BOOST is not set +CONFIG_RCU_CPU_STALL_VERBOSE=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_CMOS is not set +CONFIG_RTC_DRV_JZ4740=y +# CONFIG_SCSI_DMA is not set +CONFIG_SERIO=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SND=y +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_DMAENGINE_PCM=y +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_JACK=y +CONFIG_SND_JZ4740_SOC=y +CONFIG_SND_JZ4740_SOC_I2S=y +CONFIG_SND_JZ4740_SOC_QI_LB60=y +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +CONFIG_SND_PCM=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +CONFIG_SND_SOC=y +# CONFIG_SND_SOC_FSL_SSI is not set +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +CONFIG_SND_SOC_I2C_AND_SPI=y +# CONFIG_SND_SOC_IMX_AUDMUX is not set +CONFIG_SND_SOC_JZ4740_CODEC=y +CONFIG_SND_TIMER=y +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +# CONFIG_SQUASHFS is not set +# CONFIG_STAGING is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SYN_COOKIES is not set +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_ZBOOT=y +CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TREE_PREEMPT_RCU=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_USB=y +# CONFIG_USB_AUDIO is not set +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_ETH=y +# CONFIG_USB_ETH_EEM is not set +# CONFIG_USB_ETH_RNDIS is not set +CONFIG_USB_F_ECM=y +CONFIG_USB_F_SUBSET=y +CONFIG_USB_GADGET=y +CONFIG_USB_LIBCOMPOSITE=y +# CONFIG_USB_MUSB_DUAL_ROLE is not set +CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_MUSB_HDRC=y +# CONFIG_USB_MUSB_HOST is not set +CONFIG_USB_MUSB_JZ4740=y +# CONFIG_USB_MUSB_TUSB6010 is not set +# CONFIG_USB_MUSB_UX500 is not set +CONFIG_USB_OTG_BLACKLIST_HUB=y +CONFIG_USB_PHY=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_U_ETHER=y +CONFIG_VFAT_FS=y +# CONFIG_VGA_CONSOLE is not set +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_VT_HW_CONSOLE_BINDING=y +# CONFIG_WATCHDOG is not set +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/xburst/image/Makefile b/target/linux/xburst/image/Makefile new file mode 100644 index 000000000..ff25fbebc --- /dev/null +++ b/target/linux/xburst/image/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2009-2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +JFFS2_BLOCKSIZE=256k 512k + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +ifneq ($(CONFIG_TARGET_xburst_qi_lb60),) +UBI_OPTS = -m 4096 -p 512KiB +UBIFS_OPTS = -m 4096 -e 516096 -c 4095 +else +UBI_OPTS = -m 2048 -p 128KiB -s 512 +UBIFS_OPTS = -m 2048 -e 126KiB -c 4096 +endif + +UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage.bin + +define MkImageGzip + gzip -9n -c $(1) > $(1).gz + mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \ + -e 0x80010000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ + -d $(1).gz $(2) +endef + +define Image/Prepare + $(call MkImageGzip,$(KDIR)/vmlinux,$(KDIR)/uimage) +endef + +define Image/BuildKernel + cp $(KDIR)/uimage $(UIMAGE) +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) +endef + +define Image/Build + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/xburst/image/ubinize.cfg b/target/linux/xburst/image/ubinize.cfg new file mode 100644 index 000000000..49d55b984 --- /dev/null +++ b/target/linux/xburst/image/ubinize.cfg @@ -0,0 +1,14 @@ +[rootfs] +# Volume mode (other option is static) +mode=ubi +# Source image +image=root.ubifs +# Volume ID in UBI image +vol_id=0 +# Allow for dynamic resize +vol_type=dynamic +# Volume name +vol_name=rootfs +# Autoresize volume at first mount +vol_flags=autoresize + diff --git a/target/linux/xburst/modules.mk b/target/linux/xburst/modules.mk new file mode 100644 index 000000000..95cebdad6 --- /dev/null +++ b/target/linux/xburst/modules.mk @@ -0,0 +1,40 @@ + + +SOUND_MENU:=Sound Support + +define KernelPackage/sound-soc-jz4740 + SUBMENU:=$(SOUND_MENU) + DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN + TITLE:=JZ4740 SoC sound support + KCONFIG:=CONFIG_SND_JZ4740_SOC CONFIG_SND_JZ4740_SOC_I2S + FILES:= \ + $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740.ko \ + $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740-i2s.ko + AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740 snd-soc-jz4740-i2s) +endef + +define KernelPackage/sound-soc-jz4740-codec + SUBMENU:=$(SOUND_MENU) + DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN + TITLE:=JZ4740 SoC internal codec support + KCONFIG:=CONFIG_SND_SOC_JZ4740_CODEC + FILES:=$(LINUX_DIR)/sound/soc/codecs/snd-soc-jz4740-codec.ko + AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740-codec) +endef + +define KernelPackage/sound-soc-xburst/default + SUBMENU:=$(SOUND_MENU) + DEPENDS:=kmod-sound-soc-jz4740 kmod-sound-soc-jz4740-codec @TARGET_xburst_$(if $(4),$(4),$(3)) @BROKEN + TITLE:=$(1) sound support + KCONFIG:=CONFIG_SND_JZ4740_SOC_$(2) + FILES:=$(LINUX_DIR)/sound/soc/jz4740/snd-soc-$(3).ko + AUTOLOAD:=$(call AutoLoad,65,snd-soc-$(3)) +endef + +define KernelPackage/sound-soc-qilb60 +$(call KernelPackage/sound-soc-xburst/default,QI NanoNote,QI_LB60,qi-lb60,qi_lb60) +endef + +$(eval $(call KernelPackage,sound-soc-jz4740)) +$(eval $(call KernelPackage,sound-soc-jz4740-codec)) +$(eval $(call KernelPackage,sound-soc-qilb60)) diff --git a/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch b/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch new file mode 100644 index 000000000..93851d728 --- /dev/null +++ b/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch @@ -0,0 +1,20 @@ +From b0eb5175e0de3e5134a36a7da382d8811562af12 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Tue, 15 Mar 2011 12:49:15 +0100 +Subject: [PATCH 1/7] ubi: Read only the vid header instead of the whole page + +--- + drivers/mtd/ubi/io.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/ubi/io.c ++++ b/drivers/mtd/ubi/io.c +@@ -1014,7 +1014,7 @@ int ubi_io_read_vid_hdr(struct ubi_devic + + p = (char *)vid_hdr - ubi->vid_hdr_shift; + read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, +- ubi->vid_hdr_alsize); ++ UBI_VID_HDR_SIZE + ubi->vid_hdr_shift); + if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err)) + return read_err; + diff --git a/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch b/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch new file mode 100644 index 000000000..ce87452a1 --- /dev/null +++ b/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch @@ -0,0 +1,43 @@ +From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Sat, 26 Feb 2011 15:30:07 +0100 +Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read + +Avoid sending unnecessary READ commands to the chip. +--- + drivers/mtd/nand/nand_base.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -1365,9 +1365,16 @@ static int nand_read_page_hwecc_oob_firs + unsigned int max_bitflips = 0; + + /* Read the OOB area first */ +- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); +- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); +- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); ++ /* Read the OOB area first */ ++ if (mtd->writesize > 512) { ++ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1); ++ } else { ++ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); ++ } + + for (i = 0; i < chip->ecc.total; i++) + ecc_code[i] = chip->oob_poi[eccpos[i]]; +@@ -1580,7 +1587,9 @@ static int nand_do_read_ops(struct mtd_i + __func__, buf); + + read_retry: +- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); ++ if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) { ++ chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); ++ } + + /* + * Now read the page into the buffer. Absent an error, diff --git a/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch b/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch new file mode 100644 index 000000000..65e739d47 --- /dev/null +++ b/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch @@ -0,0 +1,104 @@ +From 6031a240816d1c9a10f596d0648e586f6b878809 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Tue, 15 Mar 2011 12:33:41 +0100 +Subject: [PATCH 3/7] NAND: Add support for subpage reads for + NAND_ECC_HW_OOB_FIRST + +--- + drivers/mtd/nand/nand_base.c | 77 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 76 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -1398,6 +1398,75 @@ static int nand_read_page_hwecc_oob_firs + } + + /** ++ * nand_read_subpage_hwecc_oob_first - [REPLACABLE] hw ecc based sub-page read function ++ * @mtd: mtd info structure ++ * @chip: nand chip info structure ++ * @data_offs: offset of requested data within the page ++ * @readlen: data length ++ * @bufpoi: buffer to store read data ++ * @page: page number to read ++ * ++ * Hardware ECC for large page chips, require OOB to be read first. ++ * For this ECC mode, the write_page method is re-used from ECC_HW. ++ * These methods read/write ECC from the OOB area, unlike the ++ * ECC_HW_SYNDROME support with multiple ECC steps, follows the ++ * "infix ECC" scheme and reads/writes ECC from the data area, by ++ * overwriting the NAND manufacturer bad block markings. ++ */ ++static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_chip *chip, ++ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi, int page) ++{ ++ int start_step, end_step, num_steps; ++ uint32_t *eccpos = chip->ecc.layout->eccpos; ++ uint8_t *p; ++ int data_col_addr; ++ int eccsize = chip->ecc.size; ++ int eccbytes = chip->ecc.bytes; ++ uint8_t *ecc_code = chip->buffers->ecccode; ++ uint8_t *ecc_calc = chip->buffers->ecccalc; ++ int i; ++ ++ /* Column address wihin the page aligned to ECC size */ ++ start_step = data_offs / chip->ecc.size; ++ end_step = (data_offs + readlen - 1) / chip->ecc.size; ++ num_steps = end_step - start_step + 1; ++ ++ data_col_addr = start_step * chip->ecc.size; ++ ++ /* Read the OOB area first */ ++ if (mtd->writesize > 512) { ++ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1); ++ } else { ++ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page); ++ } ++ ++ for (i = 0; i < chip->ecc.total; i++) ++ ecc_code[i] = chip->oob_poi[eccpos[i]]; ++ ++ p = bufpoi + data_col_addr; ++ ++ for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) { ++ int stat; ++ ++ chip->ecc.hwctl(mtd, NAND_ECC_READ); ++ chip->read_buf(mtd, p, eccsize); ++ chip->ecc.calculate(mtd, p, &ecc_calc[i]); ++ ++ stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL); ++ if (stat < 0) ++ mtd->ecc_stats.failed++; ++ else ++ mtd->ecc_stats.corrected += stat; ++ } ++ ++ return 0; ++} ++ ++/** + * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page read + * @mtd: mtd info structure + * @chip: nand chip info structure +@@ -3961,8 +4030,14 @@ int nand_scan_tail(struct mtd_info *mtd) + pr_warn("No ECC functions supplied; hardware ECC not possible\n"); + BUG(); + } +- if (!ecc->read_page) ++ ++ if (!ecc->read_page) { + ecc->read_page = nand_read_page_hwecc_oob_first; ++ if (!ecc->read_subpage) { ++ ecc->read_subpage = nand_read_subpage_hwecc_oob_first; ++ chip->options |= NAND_SUBPAGE_READ; ++ } ++ } + + case NAND_ECC_HW: + /* Use standard hwecc read page function? */ diff --git a/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch b/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch new file mode 100644 index 000000000..f2c26ade0 --- /dev/null +++ b/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch @@ -0,0 +1,33 @@ +From 1a1095927d224403af8ad57c354cc64521bf3081 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Sat, 16 Jun 2012 19:36:31 +0200 +Subject: [PATCH 4/7] ASoC: JZ4740: delay activation of the DAC to work around + a sound bug. + +A proper fix of that bug would require a big rewrite of the driver, +which (I hope) will be done eventually. +--- + sound/soc/codecs/jz4740.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/sound/soc/codecs/jz4740.c ++++ b/sound/soc/codecs/jz4740.c +@@ -249,12 +249,15 @@ static int jz4740_codec_set_bias_level(s + case SND_SOC_BIAS_ON: + break; + case SND_SOC_BIAS_PREPARE: +- mask = JZ4740_CODEC_1_VREF_DISABLE | +- JZ4740_CODEC_1_VREF_AMP_DISABLE | +- JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; ++ mask = JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; + value = 0; + + regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value); ++ ++ msleep(500); ++ mask = JZ4740_CODEC_1_VREF_DISABLE | ++ JZ4740_CODEC_1_VREF_AMP_DISABLE; ++ regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, 0); + break; + case SND_SOC_BIAS_STANDBY: + /* The only way to clear the suspend flag is to reset the codec */ diff --git a/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch b/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch new file mode 100644 index 000000000..f38483ab5 --- /dev/null +++ b/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch @@ -0,0 +1,55 @@ +From f05b1ecd7e4fde7e69320a4b7be461636e982991 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Thu, 13 Sep 2012 00:09:20 +0200 +Subject: [PATCH 5/7] RTC: JZ4740: Init the "regulator" register on startup. + +This register controls the accuracy of the RTC. uC/OS-II use +the RTC as a 100Hz clock, and writes a completely wrong value +on that register, that we have to overwrite if we want a working +real-time clock. + +Signed-off-by: Paul Cercueil +--- + drivers/rtc/rtc-jz4740.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/rtc/rtc-jz4740.c ++++ b/drivers/rtc/rtc-jz4740.c +@@ -15,6 +15,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -216,6 +217,7 @@ static int jz4740_rtc_probe(struct platf + struct jz4740_rtc *rtc; + uint32_t scratchpad; + struct resource *mem; ++ struct clk *rtc_clk; + + rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + if (!rtc) +@@ -263,6 +265,21 @@ static int jz4740_rtc_probe(struct platf + } + } + ++ rtc_clk = clk_get(&pdev->dev, "rtc"); ++ if (IS_ERR(rtc_clk)) { ++ dev_err(&pdev->dev, "Failed to get RTC clock\n"); ++ return PTR_ERR(rtc_clk); ++ } ++ ++ /* TODO: initialize the ADJC bits (25:16) to fine-tune ++ * the accuracy of the RTC */ ++ ret = jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR, ++ (clk_get_rate(rtc_clk) - 1) & 0xffff); ++ clk_put(rtc_clk); ++ ++ if (ret) ++ dev_warn(&pdev->dev, "Could not update RTC regulator register\n"); ++ + return 0; + } + diff --git a/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch b/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch new file mode 100644 index 000000000..dc12d9340 --- /dev/null +++ b/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch @@ -0,0 +1,309 @@ +From 8741ead92bc93e66740237e51b88b8690ebcbba3 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Sun, 1 Aug 2010 21:19:40 +0200 +Subject: [PATCH 6/7] Add ili8960 lcd driver + +Includes the following changes from the jz-3.5 branch: +- Use module_spi_driver +- Use devm_kzalloc +- Use kstrtoul + +Signed-off-by: Lars-Peter Clausen +--- + drivers/video/backlight/Kconfig | 7 + + drivers/video/backlight/Makefile | 1 + + drivers/video/backlight/ili8960.c | 262 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 270 insertions(+) + create mode 100644 drivers/video/backlight/ili8960.c + +--- a/drivers/video/backlight/Kconfig ++++ b/drivers/video/backlight/Kconfig +@@ -59,6 +59,13 @@ config LCD_LTV350QV + + The LTV350QV panel is present on all ATSTK1000 boards. + ++config LCD_ILI8960 ++ tristate "Ilitek ili8960 LCD driver" ++ depends on LCD_CLASS_DEVICE && SPI ++ default n ++ help ++ Driver for the Ilitek ili8960 LCD controller chip. ++ + config LCD_ILI922X + tristate "ILI Technology ILI9221/ILI9222 support" + depends on SPI +--- a/drivers/video/backlight/Makefile ++++ b/drivers/video/backlight/Makefile +@@ -5,6 +5,7 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o + obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o + obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o + obj-$(CONFIG_LCD_HX8357) += hx8357.o ++obj-$(CONFIG_LCD_ILI8960) += ili8960.o + obj-$(CONFIG_LCD_ILI922X) += ili922x.o + obj-$(CONFIG_LCD_ILI9320) += ili9320.o + obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o +--- /dev/null ++++ b/drivers/video/backlight/ili8960.c +@@ -0,0 +1,262 @@ ++/* ++ * Copyright (C) 2009-2010, Lars-Peter Clausen ++ * Driver for Ilitek ili8960 LCD ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++struct ili8960 { ++ struct spi_device *spi; ++ struct lcd_device *lcd; ++ bool enabled; ++ unsigned int brightness; ++}; ++ ++#define ILI8960_REG_BRIGHTNESS 0x03 ++#define ILI8960_REG_POWER 0x05 ++#define ILI8960_REG_CONTRAST 0x0d ++ ++static int ili8960_write_reg(struct spi_device *spi, uint8_t reg, ++ uint8_t data) ++{ ++ uint8_t buf[2]; ++ buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f); ++ buf[1] = data; ++ ++ return spi_write(spi, buf, sizeof(buf)); ++} ++ ++static int ili8960_programm_power(struct spi_device *spi, bool enabled) ++{ ++ int ret; ++ ++ if (enabled) ++ mdelay(20); ++ ++ ret = ili8960_write_reg(spi, ILI8960_REG_POWER, enabled ? 0xc7 : 0xc6); ++ ++ if (!enabled) ++ mdelay(20); ++ ++ return ret; ++} ++ ++static int ili8960_set_power(struct lcd_device *lcd, int power) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ ++ switch (power) { ++ case FB_BLANK_UNBLANK: ++ ili8960->enabled = true; ++ break; ++ default: ++ return 0; ++ } ++ ++ return ili8960_programm_power(ili8960->spi, ili8960->enabled); ++} ++ ++static int ili8960_early_set_power(struct lcd_device *lcd, int power) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ ++ switch (power) { ++ case FB_BLANK_UNBLANK: ++ return 0; ++ default: ++ ili8960->enabled = false; ++ break; ++ } ++ ++ return ili8960_programm_power(ili8960->spi, ili8960->enabled); ++} ++ ++static int ili8960_get_power(struct lcd_device *lcd) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ return ili8960->enabled ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; ++} ++ ++static int ili8960_set_contrast(struct lcd_device *lcd, int contrast) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ ++ return ili8960_write_reg(ili8960->spi, ILI8960_REG_CONTRAST, contrast); ++} ++ ++static int ili8960_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) ++{ ++ if (mode->xres != 320 && mode->yres != 240) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int ili8960_set_brightness(struct ili8960 *ili8960, int brightness) ++{ ++ int ret; ++ ++ ret = ili8960_write_reg(ili8960->spi, ILI8960_REG_BRIGHTNESS, brightness); ++ ++ if (ret == 0) ++ ili8960->brightness = brightness; ++ ++ return ret; ++} ++ ++static ssize_t ili8960_show_brightness(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct lcd_device *ld = to_lcd_device(dev); ++ struct ili8960 *ili8960 = lcd_get_data(ld); ++ ++ return sprintf(buf, "%u\n", ili8960->brightness); ++} ++ ++static ssize_t ili8960_store_brightness(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ struct lcd_device *ld = to_lcd_device(dev); ++ struct ili8960 *ili8960 = lcd_get_data(ld); ++ unsigned long brightness; ++ int ret; ++ ++ ret = kstrtoul(buf, 0, &brightness); ++ if (ret) ++ return ret; ++ ++ if (brightness > 255) ++ return -EINVAL; ++ ++ ili8960_set_brightness(ili8960, brightness); ++ ++ return count; ++} ++ ++ ++static DEVICE_ATTR(brightness, 0644, ili8960_show_brightness, ++ ili8960_store_brightness); ++ ++static struct lcd_ops ili8960_lcd_ops = { ++ .set_power = ili8960_set_power, ++ .early_set_power = ili8960_early_set_power, ++ .get_power = ili8960_get_power, ++ .set_contrast = ili8960_set_contrast, ++ .set_mode = ili8960_set_mode, ++}; ++ ++static int ili8960_probe(struct spi_device *spi) ++{ ++ int ret; ++ struct ili8960 *ili8960; ++ ++ ili8960 = devm_kzalloc(&spi->dev, sizeof(*ili8960), GFP_KERNEL); ++ if (!ili8960) ++ return -ENOMEM; ++ ++ spi->bits_per_word = 8; ++ spi->mode = SPI_MODE_3; ++ ++ ret = spi_setup(spi); ++ if (ret) { ++ dev_err(&spi->dev, "Failed to setup spi\n"); ++ return ret; ++ } ++ ++ ili8960->spi = spi; ++ ++ ili8960->lcd = lcd_device_register("ili8960-lcd", &spi->dev, ili8960, ++ &ili8960_lcd_ops); ++ ++ if (IS_ERR(ili8960->lcd)) { ++ ret = PTR_ERR(ili8960->lcd); ++ dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret); ++ return ret; ++ } ++ ++ ili8960->lcd->props.max_contrast = 255; ++ ++ ret = device_create_file(&ili8960->lcd->dev, &dev_attr_brightness); ++ if (ret) ++ goto err_unregister_lcd; ++ ++ ili8960_programm_power(ili8960->spi, true); ++ ili8960->enabled = true; ++ ++ spi_set_drvdata(spi, ili8960); ++ ++ ili8960_write_reg(spi, 0x13, 0x01); ++ ++ return 0; ++err_unregister_lcd: ++ lcd_device_unregister(ili8960->lcd); ++ return ret; ++} ++ ++static int ili8960_remove(struct spi_device *spi) ++{ ++ struct ili8960 *ili8960 = spi_get_drvdata(spi); ++ ++ device_remove_file(&ili8960->lcd->dev, &dev_attr_brightness); ++ lcd_device_unregister(ili8960->lcd); ++ ++ spi_set_drvdata(spi, NULL); ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++ ++static int ili8960_suspend(struct spi_device *spi, pm_message_t state) ++{ ++ struct ili8960 *ili8960 = spi_get_drvdata(spi); ++ ++ if (ili8960->enabled) ++ ili8960_programm_power(ili8960->spi, false); ++ ++ return 0; ++} ++ ++static int ili8960_resume(struct spi_device *spi) ++{ ++ struct ili8960 *ili8960 = spi_get_drvdata(spi); ++ ++ if (ili8960->enabled) ++ ili8960_programm_power(ili8960->spi, true); ++ ++ return 0; ++} ++ ++#else ++#define ili8960_suspend NULL ++#define ili8960_resume NULL ++#endif ++ ++static struct spi_driver ili8960_driver = { ++ .driver = { ++ .name = "ili8960", ++ .owner = THIS_MODULE, ++ }, ++ .probe = ili8960_probe, ++ .remove = ili8960_remove, ++ .suspend = ili8960_suspend, ++ .resume = ili8960_resume, ++}; ++module_spi_driver(ili8960_driver); ++ ++MODULE_AUTHOR("Lars-Peter Clausen"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("LCD driver for Ilitek ili8960"); ++MODULE_ALIAS("spi:ili8960"); diff --git a/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch b/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch new file mode 100644 index 000000000..fd89ad3bc --- /dev/null +++ b/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch @@ -0,0 +1,21 @@ +From 4371d60ae342c76708c4317e06fb7dcf0159c2f1 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Wed, 13 Oct 2010 01:17:24 +0200 +Subject: [PATCH 7/7] qi_lb60: Don't use 3-wire spi mode for the display for + now + +The spi_gpio driver does not support 3-wire mode. +--- + arch/mips/jz4740/board-qi_lb60.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/mips/jz4740/board-qi_lb60.c ++++ b/arch/mips/jz4740/board-qi_lb60.c +@@ -313,7 +313,6 @@ static struct spi_board_info qi_lb60_spi + .chip_select = 0, + .bus_num = 1, + .max_speed_hz = 30 * 1000, +- .mode = SPI_3WIRE, + }, + }; + diff --git a/target/linux/xburst/qi_lb60/config-default b/target/linux/xburst/qi_lb60/config-default new file mode 100644 index 000000000..1fd421b5f --- /dev/null +++ b/target/linux/xburst/qi_lb60/config-default @@ -0,0 +1,33 @@ +# CONFIG_BACKLIGHT_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_INPUT_MATRIXKMAP=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_MATRIX=y +CONFIG_LCD_CLASS_DEVICE=y +CONFIG_LCD_ILI8960=y +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +CONFIG_LOGO=y +# CONFIG_LOGO_LINUX_CLUT224 is not set +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_REGMAP_SPI=y +CONFIG_SND_HWDEP=y +CONFIG_SND_MIXER_OSS=y +CONFIG_SND_PCM_OSS=y +CONFIG_SND_SEQUENCER=y +# CONFIG_SND_SEQUENCER_OSS is not set +CONFIG_SND_SEQ_DUMMY=y +# CONFIG_SND_VIRMIDI is not set +CONFIG_SOUND_OSS_CORE=y +CONFIG_SOUND_OSS_CORE_PRECLAIM=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +# CONFIG_USB_FUSB300 is not set +CONFIG_USB_JZ4740=y diff --git a/target/linux/xburst/qi_lb60/target.mk b/target/linux/xburst/qi_lb60/target.mk new file mode 100644 index 000000000..8ae71bd9c --- /dev/null +++ b/target/linux/xburst/qi_lb60/target.mk @@ -0,0 +1 @@ +BOARDNAME:=QI Ben Nanonote (qi_lb60) diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile new file mode 100644 index 000000000..6c0ca921d --- /dev/null +++ b/target/linux/zynq/Makefile @@ -0,0 +1,31 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=zynq +BOARDNAME:=Xilinx Zynq 7000 SoCs +FEATURES:=fpu gpio rtc usb usbgadget ramdisk targz +CPU_TYPE:=cortex-a9 +CPU_SUBTYPE:=neon +MAINTAINER:=Jason Wu + +# future support SUBTARGETS: for both zynq and zynqmp + +define Target/Description + Build firmware image for Zynq 7000 SoC devices. +endef + +KERNEL_PATCHVER:=4.14 + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:=Image dtbs + +DEFAULT_PACKAGES += uboot-envtools + +$(eval $(call BuildTarget)) diff --git a/target/linux/zynq/base-files/etc/board.d/02_network b/target/linux/zynq/base-files/etc/board.d/02_network new file mode 100755 index 000000000..68ff80788 --- /dev/null +++ b/target/linux/zynq/base-files/etc/board.d/02_network @@ -0,0 +1,22 @@ +#!/bin/sh +# Copyright (C) 2015 OpenWrt.org + +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in +digilent,zynq-zybo | \ +digilent,zynq-zybo-z7 | \ +xlnx,zynq-zc702 | \ +xlnx,zynq-zed) + ucidef_set_interface_lan 'eth0' + ;; +*) + echo "Unsupported hardware. Network interfaces not intialized" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/zynq/base-files/etc/inittab b/target/linux/zynq/base-files/etc/inittab new file mode 100644 index 000000000..9820e7144 --- /dev/null +++ b/target/linux/zynq/base-files/etc/inittab @@ -0,0 +1,3 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +::askconsole:/usr/libexec/login.sh diff --git a/target/linux/zynq/config-4.14 b/target/linux/zynq/config-4.14 new file mode 100644 index 000000000..e7df040d6 --- /dev/null +++ b/target/linux/zynq/config-4.14 @@ -0,0 +1,722 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +CONFIG_ARCH_MULTI_V6_V7=y +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_NR_GPIO=1024 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_VEXPRESS=y +CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y +# CONFIG_ARCH_VEXPRESS_SPC is not set +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARCH_ZYNQ=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_CCI=y +CONFIG_ARM_CCI400_COMMON=y +CONFIG_ARM_CCI400_PMU=y +CONFIG_ARM_CCI_PMU=y +# CONFIG_ARM_CHARLCD is not set +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_ERRATA_643719=y +CONFIG_ARM_ERRATA_720789=y +CONFIG_ARM_ERRATA_754322=y +CONFIG_ARM_ERRATA_754327=y +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GLOBAL_TIMER=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_HEAVY_MB=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_L1_CACHE_SHIFT_6=y +# CONFIG_ARM_LPAE is not set +CONFIG_ARM_PATCH_IDIV=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_ARM_PMU=y +# CONFIG_ARM_SMMU is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +CONFIG_ARM_THUMB=y +# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_TIMER_SP804=y +CONFIG_ARM_UNWIND=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_ARM_ZYNQ_CPUIDLE=y +CONFIG_ATAGS=y +CONFIG_AUTO_ZRELADDR=y +# CONFIG_AXI_DMAC is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BOUNCE=y +CONFIG_BUILD_BIN2C=y +CONFIG_CACHE_L2X0=y +CONFIG_CADENCE_TTC_TIMER=y +CONFIG_CADENCE_WATCHDOG=y +CONFIG_CAN=y +# CONFIG_CAN_8DEV_USB is not set +CONFIG_CAN_BCM=y +CONFIG_CAN_CALC_BITTIMING=y +# CONFIG_CAN_CC770 is not set +# CONFIG_CAN_C_CAN is not set +CONFIG_CAN_DEV=y +# CONFIG_CAN_EMS_USB is not set +# CONFIG_CAN_ESD_USB2 is not set +# CONFIG_CAN_FLEXCAN is not set +# CONFIG_CAN_GRCAN is not set +CONFIG_CAN_GW=y +# CONFIG_CAN_KVASER_USB is not set +# CONFIG_CAN_LEDS is not set +# CONFIG_CAN_MCP251X is not set +# CONFIG_CAN_PEAK_USB is not set +CONFIG_CAN_RAW=y +# CONFIG_CAN_SJA1000 is not set +# CONFIG_CAN_SOFTING is not set +# CONFIG_CAN_TI_HECC is not set +CONFIG_CAN_XILINXCAN=y +CONFIG_CHR_DEV_SG=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLKSRC_VERSATILE=y +CONFIG_CLK_SP810=y +CONFIG_CLK_VEXPRESS_OSC=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMA=y +CONFIG_CMA_ALIGNMENT=8 +CONFIG_CMA_AREAS=7 +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_SIZE_MBYTES=16 +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/ram rw initrd=0x00800000,16M earlyprintk" +CONFIG_CMDLINE_FROM_BOOTLOADER=y +CONFIG_COMMON_CLK=y +# CONFIG_COMMON_CLK_AXI_CLKGEN is not set +CONFIG_COMMON_CLK_SI570=y +CONFIG_COMMON_CLK_VERSATILE=y +CONFIG_COMPAT_BRK=y +CONFIG_CONNECTOR=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_COREDUMP=y +# CONFIG_CPUFREQ_DT is not set +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +# CONFIG_CPU_BIG_ENDIAN is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_FREQ=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_HAS_ASID=y +# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_PM=y +CONFIG_CPU_RMAP=y +CONFIG_CPU_THERMAL=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_V7=y +CONFIG_CRC16=y +# CONFIG_CRC32_SARWATE is not set +CONFIG_CRC32_SLICEBY8=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +# CONFIG_DEBUG_USER is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_DMADEVICES=y +CONFIG_DMA_CMA=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DRM=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_FBDEV_OVERALLOC=100 +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_PANEL=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_E1000E=y +CONFIG_EDAC=y +CONFIG_EDAC_ATOMIC_SCRUB=y +# CONFIG_EDAC_DEBUG is not set +CONFIG_EDAC_LEGACY_SYSFS=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC_SYNOPSYS is not set +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +CONFIG_ELF_CORE=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_EXT4_FS=y +CONFIG_EXTCON=y +CONFIG_FAT_FS=y +CONFIG_FB=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA is not set +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_XILINX is not set +CONFIG_FHANDLE=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FREEZER=y +CONFIG_FS_MBCACHE=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GLOB=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_ZYNQ=y +# CONFIG_GRO_CELLS is not set +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ARM_SCU=y +CONFIG_HAVE_ARM_SMCCC=y +CONFIG_HAVE_ARM_TWD=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_PATA_PLATFORM=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_SMP=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_UID16=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HDMI=y +CONFIG_HID=y +CONFIG_HID_GENERIC=y +CONFIG_HID_MICROSOFT=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_HOTPLUG_CPU=y +CONFIG_HWMON=y +CONFIG_HW_CONSOLE=y +CONFIG_HZ_FIXED=0 +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CADENCE=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_ICST=y +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_TRIGGERED_BUFFER=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_KEYBOARD=y +# CONFIG_INPUT_MISC is not set +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_POLLDEV=y +CONFIG_INPUT_SPARSEKMAP=y +CONFIG_IOMMU_HELPER=y +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_IOSCHED_CFQ=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_RARP=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISDN is not set +CONFIG_JBD2=y +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_LZMA is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_MODE_NEON is not set +# CONFIG_KERNEL_XZ is not set +CONFIG_KEYBOARD_ATKBD=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +# CONFIG_LEDS_TRIGGER_NETDEV is not set +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LIBFDT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MACB=y +# CONFIG_MACB_PCI is not set +CONFIG_MACB_USE_HWSTAMP=y +CONFIG_MARVELL_PHY=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +# CONFIG_MDIO_GPIO is not set +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_CONTROLLER=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEMORY=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_MFD_CORE=y +CONFIG_MFD_SYSCON=y +CONFIG_MFD_VEXPRESS_SYSREG=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_TIFM_SD is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODULE_STRIPPED is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_BYD=y +CONFIG_MOUSE_PS2_CYPRESS=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +CONFIG_MOUSE_PS2_FOCALTECH=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SMBUS=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +CONFIG_MSDOS_FS=y +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_M25P80=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +# CONFIG_MTD_SPLIT is not set +CONFIG_MTD_SPLIT_FIRMWARE=y +# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set +CONFIG_MULTI_IRQ_HANDLER=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEON=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_PACKET_ENGINE=y +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_VIA is not set +CONFIG_NLS=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_NO_BOOTMEM=y +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_IOPORT_MAP=y +CONFIG_NR_CPUS=4 +CONFIG_NVMEM=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MDIO=y +CONFIG_OF_NET=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +# CONFIG_OVERLAY_FS is not set +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_PCI=y +CONFIG_PCIE_XILINX=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PCI_REALLOC_ENABLE_AUTO=y +CONFIG_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_ZYNQ=y +CONFIG_PL310_ERRATA_588369=y +CONFIG_PL310_ERRATA_727915=y +CONFIG_PL310_ERRATA_753970=y +CONFIG_PL310_ERRATA_769419=y +CONFIG_PL330_DMA=y +CONFIG_PLAT_VERSATILE=y +CONFIG_PM=y +CONFIG_PMBUS=y +CONFIG_PM_CLK=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_VEXPRESS=y +CONFIG_POWER_SUPPLY=y +CONFIG_PPS=y +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_RCU=y +CONFIG_PROC_EVENTS=y +# CONFIG_PROC_STRIPPED is not set +CONFIG_PTP_1588_CLOCK=y +CONFIG_R8169=y +CONFIG_RAS=y +CONFIG_RATIONAL=y +# CONFIG_RCU_BOOST is not set +CONFIG_RCU_NEED_SEGCBLIST=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VEXPRESS is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_ZYNQ=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_CMOS is not set +CONFIG_RTC_DRV_PCF8563=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SCHED_INFO is not set +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +CONFIG_SCSI=y +# CONFIG_SENSORS_ADM1275 is not set +# CONFIG_SENSORS_IBM_CFFPS is not set +# CONFIG_SENSORS_IR35221 is not set +# CONFIG_SENSORS_LM25066 is not set +# CONFIG_SENSORS_LTC2978 is not set +# CONFIG_SENSORS_LTC3815 is not set +# CONFIG_SENSORS_MAX16064 is not set +# CONFIG_SENSORS_MAX20751 is not set +# CONFIG_SENSORS_MAX34440 is not set +# CONFIG_SENSORS_MAX8688 is not set +CONFIG_SENSORS_PMBUS=y +# CONFIG_SENSORS_TPS40422 is not set +# CONFIG_SENSORS_TPS53679 is not set +CONFIG_SENSORS_UCD9000=y +CONFIG_SENSORS_UCD9200=y +# CONFIG_SENSORS_ZL6100 is not set +# CONFIG_SERIAL_8250 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +CONFIG_SERIO=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_SERPORT=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_SND=y +CONFIG_SND_ARM=y +# CONFIG_SND_ARMAACI is not set +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +CONFIG_SND_PCM=y +CONFIG_SND_SOC=y +CONFIG_SND_SOC_ADI=y +CONFIG_SND_SOC_ADI_AXI_I2S=y +CONFIG_SND_SOC_ADI_AXI_SPDIF=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +CONFIG_SND_SOC_I2C_AND_SPI=y +CONFIG_SND_SPI=y +CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SOC_BUS=y +CONFIG_SOUND=y +CONFIG_SOUND_OSS_CORE=y +CONFIG_SOUND_OSS_CORE_PRECLAIM=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_CADENCE=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_XILINX=y +CONFIG_SRAM=y +CONFIG_SRAM_EXEC=y +CONFIG_SRCU=y +# CONFIG_STAGING is not set +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_SWIOTLB=y +CONFIG_SWPHY=y +CONFIG_SWP_EMULATE=y +CONFIG_SYNC_FILE=y +# CONFIG_SYN_COOKIES is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_SYSFS_SYSCALL=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TASKS_RCU=y +# CONFIG_TCP_CONG_ADVANCED is not set +# CONFIG_TEXTSEARCH is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +# CONFIG_TMPFS_XATTR is not set +CONFIG_TREE_SRCU=y +CONFIG_UIO=y +# CONFIG_UIO_AEC is not set +# CONFIG_UIO_CIF is not set +# CONFIG_UIO_DMEM_GENIRQ is not set +# CONFIG_UIO_MF624 is not set +# CONFIG_UIO_NETX is not set +# CONFIG_UIO_PCI_GENERIC is not set +CONFIG_UIO_PDRV_GENIRQ=y +# CONFIG_UIO_PRUSS is not set +# CONFIG_UIO_SERCOS3 is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_USB=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_CHIPIDEA_OF=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_COMMON=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_XILINX=y +CONFIG_USB_HID=y +CONFIG_USB_NET_DRIVERS=y +CONFIG_USB_OTG=y +CONFIG_USB_OTG_FSM=y +CONFIG_USB_PHY=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_ULPI=y +CONFIG_USB_ULPI_VIEWPORT=y +CONFIG_USELIB=y +# CONFIG_USERIO is not set +CONFIG_USE_OF=y +# CONFIG_V4L_PLATFORM_DRIVERS is not set +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_VEXPRESS_CONFIG=y +CONFIG_VEXPRESS_SYSCFG=y +CONFIG_VFAT_FS=y +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +# CONFIG_VIDEO_AD5820 is not set +# CONFIG_VIDEO_ADP1653 is not set +# CONFIG_VIDEO_AS3645A is not set +CONFIG_VIDEO_DEV=y +# CONFIG_VIDEO_LM3560 is not set +# CONFIG_VIDEO_LM3646 is not set +CONFIG_VIDEO_V4L2=y +# CONFIG_VIDEO_V4L2_SUBDEV_API is not set +CONFIG_VITESSE_PHY=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_WATCHDOG_CORE=y +# CONFIG_WEXT_PRIV is not set +# CONFIG_WEXT_SPY is not set +# CONFIG_WIRELESS_EXT is not set +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XILINX_EMACLITE=y +CONFIG_XILINX_WATCHDOG=y +CONFIG_XILINX_XADC=y +CONFIG_XPS=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_X86=y +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile new file mode 100644 index 000000000..aa98f4bf3 --- /dev/null +++ b/target/linux/zynq/image/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +################################################# +# Default and templates +################################################# + +define Device/Default + PROFILES := Default + KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) + KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs + KERNEL_PREFIX := $$(IMAGE_PREFIX) + KERNEL_LOADADDR := 0x8000 +endef + +define Device/FitImageGzip + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := Image +endef + +################################################# +# Devices +################################################# + +define Device/digilent_zynq-zybo + $(call Device/FitImageGzip) + DEVICE_TITLE := ZYBO Development Board + DEVICE_DTS := zynq-zybo +endef +TARGET_DEVICES += digilent_zynq-zybo + +define Device/digilent_zynq-zybo-z7 + $(call Device/FitImageGzip) + DEVICE_TITLE := Digilent Zybo Z7 board + DEVICE_DTS := zynq-zybo-z7 +endef +TARGET_DEVICES += digilent_zynq-zybo-z7 + +define Device/xlnx_zynq-zc702 + $(call Device/FitImageGzip) + DEVICE_TITLE := ZC702 Development Board + DEVICE_DTS := zynq-zc702 +endef +TARGET_DEVICES += xlnx_zynq-zc702 + +define Device/xlnx_zynq-zed + $(call Device/FitImageGzip) + DEVICE_TITLE := Zed Development Board + DEVICE_DTS := zynq-zed +endef +TARGET_DEVICES += xlnx_zynq-zed + +$(eval $(call BuildImage)) diff --git a/target/linux/zynq/patches-4.14/020-v4.17-add-digilent-zybo-z7-board.patch b/target/linux/zynq/patches-4.14/020-v4.17-add-digilent-zybo-z7-board.patch new file mode 100644 index 000000000..7ff31e374 --- /dev/null +++ b/target/linux/zynq/patches-4.14/020-v4.17-add-digilent-zybo-z7-board.patch @@ -0,0 +1,94 @@ +From ba5c7a032c2ae66d5467820daab898e5f9048405 Mon Sep 17 00:00:00 2001 +From: Nobuhiro Iwamatsu +Date: Wed, 28 Feb 2018 11:25:52 +0900 +Subject: [PATCH] arm: dts: zynq: Add Digilent Zybo Z7 board + +This add a DTS for the Digilent Zybo Z7 board. +This board is the successor board of Zybo, these are almost the same except +for ps-clk-frequency specifications. + +Signed-off-by: Nobuhiro Iwamatsu +Reviewed-by: Rob Herring +Signed-off-by: Michal Simek +--- +Modifications: +- Removed changes to file Documentation/devicetree/bindings/arm/xilinx.txt +--- + arch/arm/boot/dts/Makefile | 3 +- + arch/arm/boot/dts/zynq-zybo-z7.dts | 58 +++++++++++++++++++ + 2 files changed, 60 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/zynq-zybo-z7.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1006,7 +1006,8 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \ + zynq-zc702.dtb \ + zynq-zc706.dtb \ + zynq-zed.dtb \ +- zynq-zybo.dtb ++ zynq-zybo.dtb \ ++ zynq-zybo-z7.dtb + dtb-$(CONFIG_MACH_ARMADA_370) += \ + armada-370-db.dtb \ + armada-370-dlink-dns327l.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/zynq-zybo-z7.dts +@@ -0,0 +1,58 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/dts-v1/; ++#include "zynq-7000.dtsi" ++ ++/ { ++ model = "Zynq ZYBO Z7 Development Board"; ++ compatible = "digilent,zynq-zybo-z7", "xlnx,zynq-7000"; ++ ++ aliases { ++ ethernet0 = &gem0; ++ serial0 = &uart1; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x20000000>; ++ }; ++ ++ chosen { ++ bootargs = ""; ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ usb_phy0: phy0 { ++ #phy-cells = <0>; ++ compatible = "usb-nop-xceiv"; ++ reset-gpios = <&gpio0 46 1>; ++ }; ++}; ++ ++&clkc { ++ ps-clk-frequency = <33333333>; ++}; ++ ++&gem0 { ++ status = "okay"; ++ phy-mode = "rgmii-id"; ++ phy-handle = <ðernet_phy>; ++ ++ ethernet_phy: ethernet-phy@0 { ++ reg = <0>; ++ device_type = "ethernet-phy"; ++ }; ++}; ++ ++&sdhci0 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ status = "okay"; ++}; ++ ++&usb0 { ++ status = "okay"; ++ dr_mode = "host"; ++ usb-phy = <&usb_phy0>; ++}; diff --git a/target/linux/zynq/patches-4.14/025-v4.19-update-digilent-zybo-z7-dts.patch b/target/linux/zynq/patches-4.14/025-v4.19-update-digilent-zybo-z7-dts.patch new file mode 100644 index 000000000..d4726498d --- /dev/null +++ b/target/linux/zynq/patches-4.14/025-v4.19-update-digilent-zybo-z7-dts.patch @@ -0,0 +1,52 @@ +From 7d90ca6f19199a54d3f8417c5f36c50dfa0accc8 Mon Sep 17 00:00:00 2001 +From: Luis Araneda +Date: Thu, 12 Jul 2018 01:50:46 -0400 +Subject: [PATCH] v4.19: Backport dts updates to the Digilent Zybo Z7 board + +- 7d90ca6: Fix memory size (512 MiB -> 1 GiB) +- edd62b9: Use GPIO constants +- a2b7baf: Add gpio-leds node + +Signed-off-by: Luis Araneda +--- + +--- a/arch/arm/boot/dts/zynq-zybo-z7.dts ++++ b/arch/arm/boot/dts/zynq-zybo-z7.dts +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0+ + /dts-v1/; + #include "zynq-7000.dtsi" ++#include + + / { + model = "Zynq ZYBO Z7 Development Board"; +@@ -13,7 +14,7 @@ + + memory@0 { + device_type = "memory"; +- reg = <0x0 0x20000000>; ++ reg = <0x0 0x40000000>; + }; + + chosen { +@@ -21,10 +22,19 @@ + stdout-path = "serial0:115200n8"; + }; + ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ ld4 { ++ label = "zynq-zybo-z7:green:ld4"; ++ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ + usb_phy0: phy0 { + #phy-cells = <0>; + compatible = "usb-nop-xceiv"; +- reset-gpios = <&gpio0 46 1>; ++ reset-gpios = <&gpio0 46 GPIO_ACTIVE_LOW>; + }; + }; + diff --git a/toolchain/Config.in b/toolchain/Config.in index 96acf1e5c..47e1c787d 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -224,13 +224,13 @@ comment "Compiler" source "toolchain/gcc/Config.in" -config YASM +config NASM bool depends on ( i386 || x86_64 ) - prompt "Build yasm" if TOOLCHAINOPTS + prompt "Build nasm" if TOOLCHAINOPTS default y help - Enable if you want to build yasm + Enable if you want to build nasm comment "C Library" depends on TOOLCHAINOPTS diff --git a/toolchain/Makefile b/toolchain/Makefile index 409955c23..9432990f4 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -29,7 +29,7 @@ curdir:=toolchain # subdirectories to descend into -$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_YASM),yasm) +$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_NASM),nasm) ifdef CONFIG_USE_UCLIBC $(curdir)/builddirs += $(LIBC)/utils endif diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 2922daed5..bf53288dc 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -2,16 +2,11 @@ choice prompt "Binutils Version" if TOOLCHAINOPTS - default BINUTILS_USE_VERSION_2_29_1 if !arc + default BINUTILS_USE_VERSION_2_30 if !arc default BINUTILS_USE_VERSION_2_29_ARC if arc help Select the version of binutils you wish to use. - config BINUTILS_USE_VERSION_2_27 - depends on !arc - bool "Binutils 2.27" - select BINUTILS_VERSION_2_27 - config BINUTILS_USE_VERSION_2_29_ARC depends on arc bool "ARC binutils 2.29" @@ -27,6 +22,11 @@ choice bool "Binutils 2.30" select BINUTILS_VERSION_2_30 + config BINUTILS_USE_VERSION_2_31_1 + depends on !arc + bool "Binutils 2.31.1" + select BINUTILS_VERSION_2_31_1 + endchoice config EXTRA_BINUTILS_CONFIG_OPTIONS diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index a81f20fea..5df52de47 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -1,20 +1,20 @@ -config BINUTILS_VERSION_2_27 - bool - config BINUTILS_VERSION_2_29_ARC default y if (!TOOLCHAINOPTS && arc) bool config BINUTILS_VERSION_2_29_1 - default y if (!TOOLCHAINOPTS && !arc) bool config BINUTILS_VERSION_2_30 + default y if (!TOOLCHAINOPTS && !arc) + bool + +config BINUTILS_VERSION_2_31_1 bool config BINUTILS_VERSION string - default "2.27" if BINUTILS_VERSION_2_27 default "2.29.1" if BINUTILS_VERSION_2_29_1 default "2.30" if BINUTILS_VERSION_2_30 + default "2.31.1" if BINUTILS_VERSION_2_31_1 default "arc-2017.09" if BINUTILS_VERSION_2_29_ARC diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index bb462cbf2..b98859819 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -15,11 +15,6 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz TAR_OPTIONS += --exclude='*.rej' -ifeq ($(PKG_VERSION),2.27) - PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 - PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88 -endif - ifeq ($(PKG_VERSION),2.29.1) PKG_HASH:=e7010a46969f9d3e53b650a518663f98a5dde3c3ae21b7d71e5e6803bc36b577 endif @@ -28,6 +23,10 @@ ifeq ($(PKG_VERSION),2.30) PKG_HASH:=6e46b8aeae2f727a36f0bd9505e405768a72218f1796f0d09757d45209871ae6 endif +ifeq ($(PKG_VERSION),2.31.1) + PKG_HASH:=5d20086ecf5752cc7d9134246e9588fa201740d540f7eb84d795b1f7a93bca86 +endif + ifneq ($(CONFIG_BINUTILS_VERSION_2_29_ARC),) PKG_REV:=arc-2017.09-release PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_REV)/ diff --git a/toolchain/binutils/patches/2.27/001-MIPS_BFD_Remove_EI_ABIVERSION_5.patch b/toolchain/binutils/patches/2.27/001-MIPS_BFD_Remove_EI_ABIVERSION_5.patch deleted file mode 100644 index 36e09b1bb..000000000 --- a/toolchain/binutils/patches/2.27/001-MIPS_BFD_Remove_EI_ABIVERSION_5.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 4d4f40e041ce7c8c7c8e50f957e0440b64ab7e95 Mon Sep 17 00:00:00 2001 -From: "Maciej W. Rozycki" -Date: Fri, 23 Dec 2016 20:03:36 +0000 -Subject: [PATCH] MIPS/BFD: Remove EI_ABIVERSION 5 allocation for PT_GNU_STACK - support - -Revert commit 17733f5be961 ("Increment the ABIVERSION to 5 for MIPS -objects with non-executable stacks.") and remove EI_ABIVERSION 5 -allocation for PT_GNU_STACK support, which has not made it to glibc -and will be reassigned. - - bfd/ - * bfd/elfxx-mips.c (_bfd_mips_post_process_headers): Revert - 2016-02-23 change and remove EI_ABIVERSION 5 support. ---- - bfd/ChangeLog | 5 +++++ - bfd/elfxx-mips.c | 3 --- - 2 files changed, 5 insertions(+), 3 deletions(-) - -diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c -index d649676..486607c 100644 ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -16358,9 +16358,6 @@ _bfd_mips_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) - if (mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64 - || mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64A) - i_ehdrp->e_ident[EI_ABIVERSION] = 3; -- -- if (elf_stack_flags (abfd) && !(elf_stack_flags (abfd) & PF_X)) -- i_ehdrp->e_ident[EI_ABIVERSION] = 5; - } - - int --- -2.9.3 - diff --git a/toolchain/binutils/patches/2.30/100-PR23254-ld.bfd-mishandles-file-pointers-while-scanni.patch b/toolchain/binutils/patches/2.30/100-PR23254-ld.bfd-mishandles-file-pointers-while-scanni.patch new file mode 100644 index 000000000..8a0b67553 --- /dev/null +++ b/toolchain/binutils/patches/2.30/100-PR23254-ld.bfd-mishandles-file-pointers-while-scanni.patch @@ -0,0 +1,112 @@ +From: Alan Modra +Date: Tue, 5 Jun 2018 21:04:00 +0930 +Subject: [PATCH] PR23254, ld.bfd mishandles file pointers while scanning + archive + +Best practice is to not mix lseek/read with fseek/fread on the same +underlying file descriptor, as not all stdio implementations will cope. +Since the plugin uses lseek/read while bfd uses fseek/fread this patch +reopens the file for exclusive use by the plugin rather than trying to +restore the file descriptor. That allows the plugin to read the file +after plugin_call_claim_file too. + +bfd/ + PR 23254 + * plugin.c (bfd_plugin_open_input): Allow for possibility of + nested archives. Open file again for plugin. + (try_claim): Don't save and restore file position. Close file + if not claimed. + * sysdep.h (O_BINARY): Define. +ld/ + PR 23254 + * plugin.c (plugin_call_claim_file): Revert 2016-07-19 patch. + (plugin_object_p): Don't dup file descriptor. +--- + +--- a/bfd/plugin.c ++++ b/bfd/plugin.c +@@ -165,14 +165,22 @@ bfd_plugin_open_input (bfd *ibfd, struct + bfd *iobfd; + + iobfd = ibfd; +- if (ibfd->my_archive && !bfd_is_thin_archive (ibfd->my_archive)) +- iobfd = ibfd->my_archive; ++ while (iobfd->my_archive ++ && !bfd_is_thin_archive (iobfd->my_archive)) ++ iobfd = iobfd->my_archive; + file->name = iobfd->filename; + + if (!iobfd->iostream && !bfd_open_file (iobfd)) + return 0; + +- file->fd = fileno ((FILE *) iobfd->iostream); ++ /* The plugin API expects that the file descriptor won't be closed ++ and reused as done by the bfd file cache. So open it again. ++ dup isn't good enough. plugin IO uses lseek/read while BFD uses ++ fseek/fread. It isn't wise to mix the unistd and stdio calls on ++ the same underlying file descriptor. */ ++ file->fd = open (file->name, O_RDONLY | O_BINARY); ++ if (file->fd < 0) ++ return 0; + + if (iobfd == ibfd) + { +@@ -196,12 +204,12 @@ try_claim (bfd *abfd) + int claimed = 0; + struct ld_plugin_input_file file; + ++ file.handle = abfd; + if (!bfd_plugin_open_input (abfd, &file)) + return 0; +- file.handle = abfd; +- off_t cur_offset = lseek (file.fd, 0, SEEK_CUR); + claim_file (&file, &claimed); +- lseek (file.fd, cur_offset, SEEK_SET); ++ if (!claimed) ++ close (file.fd); + return claimed; + } + +--- a/bfd/sysdep.h ++++ b/bfd/sysdep.h +@@ -108,6 +108,10 @@ extern char *strrchr (); + #ifndef O_ACCMODE + #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) + #endif ++/* Systems that don't already define this, don't need it. */ ++#ifndef O_BINARY ++#define O_BINARY 0 ++#endif + + #ifndef SEEK_SET + #define SEEK_SET 0 +--- a/ld/plugin.c ++++ b/ld/plugin.c +@@ -1053,14 +1053,10 @@ plugin_call_claim_file (const struct ld_ + { + if (curplug->claim_file_handler) + { +- off_t cur_offset; + enum ld_plugin_status rv; + + called_plugin = curplug; +- cur_offset = lseek (file->fd, 0, SEEK_CUR); + rv = (*curplug->claim_file_handler) (file, claimed); +- if (!*claimed) +- lseek (file->fd, cur_offset, SEEK_SET); + called_plugin = NULL; + if (rv != LDPS_OK) + set_plugin_error (curplug->name); +@@ -1126,12 +1122,6 @@ plugin_object_p (bfd *ibfd) + } + + file.handle = input; +- /* The plugin API expects that the file descriptor won't be closed +- and reused as done by the bfd file cache. So dup one. */ +- file.fd = dup (file.fd); +- if (file.fd < 0) +- return NULL; +- + input->abfd = abfd; + input->view_buffer.addr = NULL; + input->view_buffer.filesize = 0; diff --git a/toolchain/binutils/patches/2.27/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.31.1/300-001_ld_makefile_patch.patch similarity index 92% rename from toolchain/binutils/patches/2.27/300-001_ld_makefile_patch.patch rename to toolchain/binutils/patches/2.31.1/300-001_ld_makefile_patch.patch index e4cec7f69..7b8300efa 100644 --- a/toolchain/binutils/patches/2.27/300-001_ld_makefile_patch.patch +++ b/toolchain/binutils/patches/2.31.1/300-001_ld_makefile_patch.patch @@ -11,7 +11,7 @@ EMULATION_OFILES = @EMULATION_OFILES@ --- a/ld/Makefile.in +++ b/ld/Makefile.in -@@ -451,7 +451,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) +@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) # We put the scripts in the directory $(scriptdir)/ldscripts. # We can't put the scripts in $(datadir) because the SEARCH_DIR # directives need to be different for native and cross linkers. diff --git a/toolchain/binutils/patches/2.27/300-012_check_ldrunpath_length.patch b/toolchain/binutils/patches/2.31.1/300-012_check_ldrunpath_length.patch similarity index 55% rename from toolchain/binutils/patches/2.27/300-012_check_ldrunpath_length.patch rename to toolchain/binutils/patches/2.31.1/300-012_check_ldrunpath_length.patch index 95d3f75b8..58ee759de 100644 --- a/toolchain/binutils/patches/2.27/300-012_check_ldrunpath_length.patch +++ b/toolchain/binutils/patches/2.31.1/300-012_check_ldrunpath_length.patch @@ -1,15 +1,15 @@ --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em -@@ -1244,6 +1244,8 @@ fragment <collect, &bh))) -@@ -7725,6 +7726,7 @@ _bfd_mips_elf_create_dynamic_sections (b +@@ -7900,6 +7901,7 @@ _bfd_mips_elf_create_dynamic_sections (b if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; diff --git a/toolchain/binutils/patches/2.27/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.31.1/500-Change-default-emulation-for-mips64-linux.patch similarity index 92% rename from toolchain/binutils/patches/2.27/500-Change-default-emulation-for-mips64-linux.patch rename to toolchain/binutils/patches/2.31.1/500-Change-default-emulation-for-mips64-linux.patch index 7a8f0ae13..c6e123e88 100644 --- a/toolchain/binutils/patches/2.27/500-Change-default-emulation-for-mips64-linux.patch +++ b/toolchain/binutils/patches/2.31.1/500-Change-default-emulation-for-mips64-linux.patch @@ -1,6 +1,6 @@ --- a/bfd/config.bfd +++ b/bfd/config.bfd -@@ -1101,12 +1101,12 @@ case "${targ}" in +@@ -913,12 +913,12 @@ case "${targ}" in targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" ;; mips64*el-*-linux*) @@ -19,9 +19,9 @@ targ_defvec=mips_elf32_trad_le_vec --- a/ld/configure.tgt +++ b/ld/configure.tgt -@@ -513,11 +513,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmip +@@ -464,11 +464,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmip mips*-*-vxworks*) targ_emul=elf32ebmipvxworks - targ_extra_emuls="elf32elmipvxworks" ;; + targ_extra_emuls="elf32elmipvxworks" ;; mips*-*-windiss) targ_emul=elf32mipswindiss ;; -mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 - targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index 34db20d3a..c3208d372 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -16,14 +16,13 @@ choice bool "gcc 5.x" depends on !arc - config GCC_USE_VERSION_6 - bool "gcc 6.x" - depends on !arc - config GCC_USE_VERSION_7 bool "gcc 7.x" depends on !arc + config GCC_USE_VERSION_8 + bool "gcc 8.x" + depends on !arc endchoice config GCC_USE_GRAPHITE diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index 50da678a0..55a942660 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -6,9 +6,18 @@ config GCC_VERSION_5 default y if GCC_USE_VERSION_5 bool +config GCC_VERSION_8 + default y if GCC_USE_VERSION_8 + bool + +config GCC_USE_EMBEDDED_PATH_REMAP + default y if GCC_VERSION_8 + default n + bool + config GCC_VERSION string default "5.5.0" if GCC_VERSION_5 default "arc-2017.09-release" if GCC_VERSION_7_1_ARC - default "6.3.0" if GCC_USE_VERSION_6 + default "8.2.0" if GCC_VERSION_8 default "7.3.0" diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index fb60e57c7..b3e1d8edb 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -32,15 +32,14 @@ ifeq ($(PKG_VERSION),5.5.0) PKG_HASH:=530cea139d82fe542b358961130c69cfde8b3d14556370b65823d2f91f0ced87 endif -ifeq ($(PKG_VERSION),6.3.0) - PKG_HASH:=f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f - PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -endif - ifeq ($(PKG_VERSION),7.3.0) PKG_HASH:=832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c endif +ifeq ($(PKG_VERSION),8.2.0) + PKG_HASH:=196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080 +endif + ifneq ($(CONFIG_GCC_VERSION_7_1_ARC),) PKG_VERSION:=7.1.1 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/archive/$(GCC_VERSION) diff --git a/toolchain/gcc/patches/6.3.0/001-revert_register_mode_search.patch b/toolchain/gcc/patches/6.3.0/001-revert_register_mode_search.patch deleted file mode 100644 index bd6fbdb4a..000000000 --- a/toolchain/gcc/patches/6.3.0/001-revert_register_mode_search.patch +++ /dev/null @@ -1,65 +0,0 @@ -Revert of: - -commit 275035b56823b26d5fb7e90fad945b998648edf2 -Author: bergner -Date: Thu Sep 5 14:09:07 2013 +0000 - - PR target/58139 - * reginfo.c (choose_hard_reg_mode): Scan through all mode classes - looking for widest mode. - - - git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4 - - ---- a/gcc/reginfo.c -+++ b/gcc/reginfo.c -@@ -625,35 +625,40 @@ choose_hard_reg_mode (unsigned int regno - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - -+ if (found_mode != VOIDmode) -+ return found_mode; -+ - for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - -+ if (found_mode != VOIDmode) -+ return found_mode; -+ - for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - -+ if (found_mode != VOIDmode) -+ return found_mode; -+ - for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - - if (found_mode != VOIDmode) diff --git a/toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch b/toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch deleted file mode 100644 index df09e4f63..000000000 --- a/toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 450fb05e2a7510d37744f044009f8237d902f65c Mon Sep 17 00:00:00 2001 -From: nsz -Date: Tue, 30 Aug 2016 10:26:22 +0000 -Subject: [PATCH] disable ifunc on *-musl by default - -gcc/ - * config.gcc (*-*-*musl*): Disable gnu-indirect-function. - - - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239859 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/ChangeLog | 4 ++++ - gcc/config.gcc | 4 ++-- - 2 files changed, 6 insertions(+), 2 deletions(-) - ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -1495,7 +1495,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfree - extra_options="${extra_options} linux-android.opt" - # Assume modern glibc if not targeting Android nor uclibc. - case ${target} in -- *-*-*android*|*-*-*uclibc*) -+ *-*-*android*|*-*-*uclibc*|*-*-*musl*) - ;; - *) - default_gnu_indirect_function=yes -@@ -1564,7 +1564,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu - extra_options="${extra_options} linux-android.opt" - # Assume modern glibc if not targeting Android nor uclibc. - case ${target} in -- *-*-*android*|*-*-*uclibc*) -+ *-*-*android*|*-*-*uclibc*|*-*-*musl*) - ;; - *) - default_gnu_indirect_function=yes diff --git a/toolchain/gcc/patches/6.3.0/300-mips_Os_cpu_rtx_cost_model.patch b/toolchain/gcc/patches/6.3.0/300-mips_Os_cpu_rtx_cost_model.patch deleted file mode 100644 index d76bd8cb1..000000000 --- a/toolchain/gcc/patches/6.3.0/300-mips_Os_cpu_rtx_cost_model.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/gcc/config/mips/mips.c -+++ b/gcc/config/mips/mips.c -@@ -17928,7 +17928,7 @@ mips_option_override (void) - flag_pcc_struct_return = 0; - - /* Decide which rtx_costs structure to use. */ -- if (optimize_size) -+ if (0 && optimize_size) - mips_cost = &mips_rtx_cost_optimize_size; - else - mips_cost = &mips_rtx_cost_data[mips_tune]; diff --git a/toolchain/gcc/patches/6.3.0/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/6.3.0/830-arm_unbreak_armv4t.patch deleted file mode 100644 index 37f8f2a54..000000000 --- a/toolchain/gcc/patches/6.3.0/830-arm_unbreak_armv4t.patch +++ /dev/null @@ -1,13 +0,0 @@ -http://sourceware.org/ml/crossgcc/2008-05/msg00009.html - ---- a/gcc/config/arm/linux-eabi.h -+++ b/gcc/config/arm/linux-eabi.h -@@ -45,7 +45,7 @@ - The ARM10TDMI core is the default for armv5t, so set - SUBTARGET_CPU_DEFAULT to achieve this. */ - #undef SUBTARGET_CPU_DEFAULT --#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi -+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi - - /* TARGET_BIG_ENDIAN_DEFAULT is set in - config.gcc for big endian configurations. */ diff --git a/toolchain/gcc/patches/6.3.0/880-no_java_section.patch b/toolchain/gcc/patches/6.3.0/880-no_java_section.patch deleted file mode 100644 index 0fa9e627c..000000000 --- a/toolchain/gcc/patches/6.3.0/880-no_java_section.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/gcc/defaults.h -+++ b/gcc/defaults.h -@@ -395,7 +395,7 @@ see the files COPYING3 and COPYING.RUNTI - /* If we have named section and we support weak symbols, then use the - .jcr section for recording java classes which need to be registered - at program start-up time. */ --#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK -+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK - #ifndef JCR_SECTION_NAME - #define JCR_SECTION_NAME ".jcr" - #endif diff --git a/toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch b/toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch deleted file mode 100644 index 68e62865b..000000000 --- a/toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libstdc++-v3/include/Makefile.in -+++ b/libstdc++-v3/include/Makefile.in -@@ -1459,7 +1459,7 @@ stamp-bits: ${bits_headers} - @$(STAMP) stamp-bits - - stamp-bits-sup: stamp-bits ${bits_sup_headers} -- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null -+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null - @$(STAMP) stamp-bits-sup - - stamp-c_base: ${c_base_headers} diff --git a/toolchain/gcc/patches/6.3.0/950-cpp_file_path_translation.patch b/toolchain/gcc/patches/6.3.0/950-cpp_file_path_translation.patch deleted file mode 100644 index d467eb7c9..000000000 --- a/toolchain/gcc/patches/6.3.0/950-cpp_file_path_translation.patch +++ /dev/null @@ -1,182 +0,0 @@ -Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047 - ---- a/gcc/c-family/c-opts.c -+++ b/gcc/c-family/c-opts.c -@@ -574,6 +574,10 @@ c_common_handle_option (size_t scode, co - add_path (xstrdup (arg), SYSTEM, 0, true); - break; - -+ case OPT_iremap: -+ add_cpp_remap_path (arg); -+ break; -+ - case OPT_iwithprefix: - add_prefixed_path (arg, SYSTEM); - break; ---- a/gcc/c-family/c.opt -+++ b/gcc/c-family/c.opt -@@ -1632,6 +1632,10 @@ iquote - C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) - -iquote Add to the end of the quote include path. - -+iremap -+C ObjC C++ ObjC++ Joined Separate -+-iremap Convert to if it occurs as prefix in __FILE__. -+ - iwithprefix - C ObjC C++ ObjC++ Joined Separate - -iwithprefix Add to the end of the system include path. ---- a/gcc/doc/cpp.texi -+++ b/gcc/doc/cpp.texi -@@ -4444,6 +4444,7 @@ without notice. - @c man begin SYNOPSIS - cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] - [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}] -+ [@option{-iremap}@var{src}:@var{dst}] - [@option{-W}@var{warn}@dots{}] - [@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}] - [@option{-MP}] [@option{-MQ} @var{target}@dots{}] ---- a/gcc/doc/cppopts.texi -+++ b/gcc/doc/cppopts.texi -@@ -532,6 +532,12 @@ Search @var{dir} only for header files r - If @var{dir} begins with @code{=}, then the @code{=} will be replaced - by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. - -+@item -iremap @var{src}:@var{dst} -+@opindex iremap -+Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. -+This option can be specified more than once. Processing stops at the first -+match. -+ - @item -fdirectives-only - @opindex fdirectives-only - When preprocessing, handle directives, but do not expand macros. ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -476,8 +476,8 @@ Objective-C and Objective-C++ Dialects}. - @item Directory Options - @xref{Directory Options,,Options for Directory Search}. - @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol ---iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol ----sysroot=@var{dir} --no-sysroot-suffix} -+-iquote@var{dir} -iremap@var{src}:@var{dst} -L@var{dir} -no-canonical-prefixes @gol -+-I- --sysroot=@var{dir} --no-sysroot-suffix} - - @item Code Generation Options - @xref{Code Gen Options,,Options for Code Generation Conventions}. -@@ -10861,6 +10861,12 @@ be searched for header files only for th - "@var{file}"}; they are not searched for @code{#include <@var{file}>}, - otherwise just like @option{-I}. - -+@item -iremap @var{src}:@var{dst} -+@opindex iremap -+Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. -+This option can be specified more than once. Processing stops at the first -+match. -+ - @item -L@var{dir} - @opindex L - Add directory @var{dir} to the list of directories to be searched ---- a/libcpp/include/cpplib.h -+++ b/libcpp/include/cpplib.h -@@ -760,6 +760,9 @@ extern void cpp_set_lang (cpp_reader *, - /* Set the include paths. */ - extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); - -+/* Provide src:dst pair for __FILE__ remapping. */ -+extern void add_cpp_remap_path (const char *); -+ - /* Call these to get pointers to the options, callback, and deps - structures for a given reader. These pointers are good until you - call cpp_finish on that reader. You can either edit the callbacks ---- a/libcpp/macro.c -+++ b/libcpp/macro.c -@@ -227,6 +227,64 @@ static const char * const monthnames[] = - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - -+static size_t remap_pairs; -+static char **remap_src; -+static char **remap_dst; -+ -+void -+add_cpp_remap_path (const char *arg) -+{ -+ const char *arg_dst; -+ size_t len; -+ -+ arg_dst = strchr(arg, ':'); -+ if (arg_dst == NULL) -+ { -+ fprintf(stderr, "Invalid argument for -iremap\n"); -+ exit(1); -+ } -+ -+ len = arg_dst - arg; -+ ++arg_dst; -+ -+ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1)); -+ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1)); -+ -+ remap_src[remap_pairs] = (char *) xmalloc(len + 1); -+ memcpy(remap_src[remap_pairs], arg, len); -+ remap_src[remap_pairs][len] = '\0'; -+ remap_dst[remap_pairs] = xstrdup(arg_dst); -+ ++remap_pairs; -+} -+ -+static const char * -+cpp_remap_file (const char *arg, char **tmp_name) -+{ -+ char *result; -+ size_t i, len; -+ -+ for (i = 0; i < remap_pairs; ++i) -+ { -+ len = strlen (remap_src[i]); -+ if (strncmp (remap_src[i], arg, len)) -+ continue; -+ if (arg[len] == '\0') -+ return xstrdup (remap_dst[i]); -+ if (arg[len] != '/') -+ continue; -+ arg += len; -+ len = strlen (remap_dst[i]); -+ result = (char *) xmalloc (len + strlen (arg) + 1); -+ memcpy(result, remap_dst[i], len); -+ strcpy(result + len, arg); -+ *tmp_name = result; -+ -+ return result; -+ } -+ -+ return arg; -+} -+ - /* Helper function for builtin_macro. Returns the text generated by - a builtin macro. */ - const uchar * -@@ -290,6 +348,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi - { - unsigned int len; - const char *name; -+ char *tmp_name = NULL; - uchar *buf; - - if (node->value.builtin == BT_FILE) -@@ -301,6 +360,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi - if (!name) - abort (); - } -+ name = cpp_remap_file (name, &tmp_name); - len = strlen (name); - buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); - result = buf; -@@ -308,6 +368,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi - buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); - *buf++ = '"'; - *buf = '\0'; -+ free (tmp_name); - } - break; - diff --git a/toolchain/gcc/patches/6.3.0/960-fix-ubsan-defref.patch b/toolchain/gcc/patches/6.3.0/960-fix-ubsan-defref.patch deleted file mode 100644 index 72d86c149..000000000 --- a/toolchain/gcc/patches/6.3.0/960-fix-ubsan-defref.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/gcc/ubsan.c -+++ b/gcc/ubsan.c -@@ -1471,7 +1471,7 @@ ubsan_use_new_style_p (location_t loc) - - expanded_location xloc = expand_location (loc); - if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0 -- || xloc.file == '\0' || xloc.file[0] == '\xff' -+ || xloc.file[0] == '\0' || xloc.file[0] == '\xff' - || xloc.file[1] == '\xff') - return false; - diff --git a/toolchain/gcc/patches/6.3.0/002-case_insensitive.patch b/toolchain/gcc/patches/8.2.0/002-case_insensitive.patch similarity index 64% rename from toolchain/gcc/patches/6.3.0/002-case_insensitive.patch rename to toolchain/gcc/patches/8.2.0/002-case_insensitive.patch index b3d2dbe29..3442076d7 100644 --- a/toolchain/gcc/patches/6.3.0/002-case_insensitive.patch +++ b/toolchain/gcc/patches/8.2.0/002-case_insensitive.patch @@ -1,3 +1,13 @@ +commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e +Author: Felix Fietkau +Date: Sun Oct 19 21:45:51 2014 +0000 + + gcc: do not assume that the Mac OS X filesystem is case insensitive + + Signed-off-by: Felix Fietkau + + SVN-Revision: 42973 + --- a/include/filenames.h +++ b/include/filenames.h @@ -43,11 +43,6 @@ extern "C" { diff --git a/toolchain/gcc/patches/6.3.0/010-documentation.patch b/toolchain/gcc/patches/8.2.0/010-documentation.patch similarity index 65% rename from toolchain/gcc/patches/6.3.0/010-documentation.patch rename to toolchain/gcc/patches/8.2.0/010-documentation.patch index 2adb28c83..c3a6a1590 100644 --- a/toolchain/gcc/patches/6.3.0/010-documentation.patch +++ b/toolchain/gcc/patches/8.2.0/010-documentation.patch @@ -1,6 +1,18 @@ +commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2 +Author: Luka Perkov +Date: Tue Feb 26 16:16:33 2013 +0000 + + gcc: don't build documentation + + This closes #13039. + + Signed-off-by: Luka Perkov + + SVN-Revision: 35807 + --- a/gcc/Makefile.in +++ b/gcc/Makefile.in -@@ -3021,18 +3021,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) +@@ -3203,18 +3203,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) doc/gccint.info: $(TEXI_GCCINT_FILES) doc/cppinternals.info: $(TEXI_CPPINT_FILES) diff --git a/toolchain/gcc/patches/8.2.0/110-Fix-MIPS-PR-84790.patch b/toolchain/gcc/patches/8.2.0/110-Fix-MIPS-PR-84790.patch new file mode 100644 index 000000000..b89eca2fa --- /dev/null +++ b/toolchain/gcc/patches/8.2.0/110-Fix-MIPS-PR-84790.patch @@ -0,0 +1,20 @@ +Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790. +MIPS16 functions have a static assembler prologue which clobbers +registers v0 and v1. Add these register clobbers to function call +instructions. + +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -3102,6 +3102,12 @@ mips_emit_call_insn (rtx pattern, rtx or + emit_insn (gen_update_got_version ()); + } + ++ if (TARGET_MIPS16 && TARGET_USE_GOT) ++ { ++ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP); ++ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode)); ++ } ++ + if (TARGET_MIPS16 + && TARGET_EXPLICIT_RELOCS + && TARGET_CALL_CLOBBERED_GP) diff --git a/toolchain/gcc/patches/6.3.0/230-musl_libssp.patch b/toolchain/gcc/patches/8.2.0/230-musl_libssp.patch similarity index 85% rename from toolchain/gcc/patches/6.3.0/230-musl_libssp.patch rename to toolchain/gcc/patches/8.2.0/230-musl_libssp.patch index 8dfd1fc28..b3ab79caf 100644 --- a/toolchain/gcc/patches/6.3.0/230-musl_libssp.patch +++ b/toolchain/gcc/patches/8.2.0/230-musl_libssp.patch @@ -1,6 +1,6 @@ --- a/gcc/gcc.c +++ b/gcc/gcc.c -@@ -858,7 +858,9 @@ proper position among the other output f +@@ -868,7 +868,9 @@ proper position among the other output f #endif #ifndef LINK_SSP_SPEC diff --git a/toolchain/gcc/patches/8.2.0/300-mips_Os_cpu_rtx_cost_model.patch b/toolchain/gcc/patches/8.2.0/300-mips_Os_cpu_rtx_cost_model.patch new file mode 100644 index 000000000..6f97356ac --- /dev/null +++ b/toolchain/gcc/patches/8.2.0/300-mips_Os_cpu_rtx_cost_model.patch @@ -0,0 +1,21 @@ +commit ecf7671b769fe96f7b5134be442089f8bdba55d2 +Author: Felix Fietkau +Date: Thu Aug 4 20:29:45 2016 +0200 + +gcc: add a patch to generate better code with Os on mips + +Also happens to reduce compressed code size a bit + +Signed-off-by: Felix Fietkau + +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -19834,7 +19834,7 @@ mips_option_override (void) + flag_pcc_struct_return = 0; + + /* Decide which rtx_costs structure to use. */ +- if (optimize_size) ++ if (0 && optimize_size) + mips_cost = &mips_rtx_cost_optimize_size; + else + mips_cost = &mips_rtx_cost_data[mips_tune]; diff --git a/toolchain/gcc/patches/6.3.0/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches/8.2.0/800-arm_v5te_no_ldrd_strd.patch similarity index 85% rename from toolchain/gcc/patches/6.3.0/800-arm_v5te_no_ldrd_strd.patch rename to toolchain/gcc/patches/8.2.0/800-arm_v5te_no_ldrd_strd.patch index 2e7c23f85..172295f28 100644 --- a/toolchain/gcc/patches/6.3.0/800-arm_v5te_no_ldrd_strd.patch +++ b/toolchain/gcc/patches/8.2.0/800-arm_v5te_no_ldrd_strd.patch @@ -1,6 +1,6 @@ --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h -@@ -166,7 +166,7 @@ extern void (*arm_lang_output_object_att +@@ -155,7 +155,7 @@ extern tree arm_fp16_type_node; /* Thumb-1 only. */ #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) diff --git a/toolchain/gcc/patches/6.3.0/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/8.2.0/810-arm-softfloat-libgcc.patch similarity index 80% rename from toolchain/gcc/patches/6.3.0/810-arm-softfloat-libgcc.patch rename to toolchain/gcc/patches/8.2.0/810-arm-softfloat-libgcc.patch index 1d06f5b2e..5c9d86aea 100644 --- a/toolchain/gcc/patches/6.3.0/810-arm-softfloat-libgcc.patch +++ b/toolchain/gcc/patches/8.2.0/810-arm-softfloat-libgcc.patch @@ -1,3 +1,11 @@ +commit 8570c4be394cff7282f332f97da2ff569a927ddb +Author: Imre Kaloz +Date: Wed Feb 2 20:06:12 2011 +0000 + + fixup arm soft-float symbols + + SVN-Revision: 25325 + --- a/libgcc/config/arm/t-linux +++ b/libgcc/config/arm/t-linux @@ -1,6 +1,10 @@ @@ -14,7 +22,7 @@ # difference. --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h -@@ -60,8 +60,6 @@ +@@ -58,8 +58,6 @@ %{shared:-lc} \ %{!shared:%{profile:-lc_p}%{!profile:-lc}}" diff --git a/toolchain/gcc/patches/6.3.0/820-libgcc_pic.patch b/toolchain/gcc/patches/8.2.0/820-libgcc_pic.patch similarity index 71% rename from toolchain/gcc/patches/6.3.0/820-libgcc_pic.patch rename to toolchain/gcc/patches/8.2.0/820-libgcc_pic.patch index f925d96f6..1a9678d48 100644 --- a/toolchain/gcc/patches/6.3.0/820-libgcc_pic.patch +++ b/toolchain/gcc/patches/8.2.0/820-libgcc_pic.patch @@ -1,6 +1,14 @@ +commit c96312958c0621e72c9b32da5bc224ffe2161384 +Author: Felix Fietkau +Date: Mon Oct 19 23:26:09 2009 +0000 + + gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow) + + SVN-Revision: 18086 + --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in -@@ -888,11 +888,12 @@ $(libgcov-driver-objects): %$(objext): $ +@@ -923,11 +923,12 @@ $(libgcov-driver-objects): %$(objext): $ # Static libraries. libgcc.a: $(libgcc-objects) @@ -14,7 +22,7 @@ -rm -f $@ objects="$(objects)"; \ -@@ -913,7 +914,7 @@ all: libunwind.a +@@ -948,7 +949,7 @@ all: libunwind.a endif ifeq ($(enable_shared),yes) @@ -23,7 +31,7 @@ ifneq ($(LIBUNWIND),) all: libunwind$(SHLIB_EXT) libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) -@@ -1115,6 +1116,10 @@ install-shared: +@@ -1154,6 +1155,10 @@ install-shared: chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a diff --git a/toolchain/gcc/patches/6.3.0/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/8.2.0/840-armv4_pass_fix-v4bx_to_ld.patch similarity index 78% rename from toolchain/gcc/patches/6.3.0/840-armv4_pass_fix-v4bx_to_ld.patch rename to toolchain/gcc/patches/8.2.0/840-armv4_pass_fix-v4bx_to_ld.patch index cb1fb9823..b9c9b161a 100644 --- a/toolchain/gcc/patches/6.3.0/840-armv4_pass_fix-v4bx_to_ld.patch +++ b/toolchain/gcc/patches/8.2.0/840-armv4_pass_fix-v4bx_to_ld.patch @@ -1,6 +1,15 @@ +commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc +Author: Imre Kaloz +Date: Wed Feb 2 19:34:36 2011 +0000 + + add armv4 fixup patches + + SVN-Revision: 25322 + + --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h -@@ -94,10 +94,15 @@ +@@ -88,10 +88,15 @@ #define MUSL_DYNAMIC_LINKER \ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" diff --git a/toolchain/gcc/patches/6.3.0/850-use_shared_libgcc.patch b/toolchain/gcc/patches/8.2.0/850-use_shared_libgcc.patch similarity index 78% rename from toolchain/gcc/patches/6.3.0/850-use_shared_libgcc.patch rename to toolchain/gcc/patches/8.2.0/850-use_shared_libgcc.patch index cd20244c6..f619f0e6a 100644 --- a/toolchain/gcc/patches/6.3.0/850-use_shared_libgcc.patch +++ b/toolchain/gcc/patches/8.2.0/850-use_shared_libgcc.patch @@ -1,6 +1,13 @@ +commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd +Author: Felix Fietkau +Date: Sun Feb 12 20:25:47 2012 +0000 + + gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary + + SVN-Revision: 30486 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h -@@ -132,10 +132,6 @@ +@@ -126,10 +126,6 @@ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) @@ -26,7 +33,7 @@ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change --- a/libgcc/mkmap-symver.awk +++ b/libgcc/mkmap-symver.awk -@@ -132,5 +132,5 @@ function output(lib) { +@@ -136,5 +136,5 @@ function output(lib) { else if (inherit[lib]) printf("} %s;\n", inherit[lib]); else @@ -43,5 +50,5 @@ +#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc" + #undef LINK_SHLIB_SPEC - #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" - + #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \ + %{static-pie:-static -pie --no-dynamic-linker -z text}" diff --git a/toolchain/gcc/patches/6.3.0/851-libgcc_no_compat.patch b/toolchain/gcc/patches/8.2.0/851-libgcc_no_compat.patch similarity index 63% rename from toolchain/gcc/patches/6.3.0/851-libgcc_no_compat.patch rename to toolchain/gcc/patches/8.2.0/851-libgcc_no_compat.patch index 80c347684..d710e4071 100644 --- a/toolchain/gcc/patches/6.3.0/851-libgcc_no_compat.patch +++ b/toolchain/gcc/patches/8.2.0/851-libgcc_no_compat.patch @@ -1,3 +1,13 @@ +commit 64661de100da1ec1061ef3e5e400285dce115e6b +Author: Felix Fietkau +Date: Sun May 10 13:16:35 2015 +0000 + + gcc: add some size optimization patches + + Signed-off-by: Felix Fietkau + + SVN-Revision: 45664 + --- a/libgcc/config/t-libunwind +++ b/libgcc/config/t-libunwind @@ -2,8 +2,7 @@ diff --git a/toolchain/gcc/patches/6.3.0/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/8.2.0/870-ppc_no_crtsavres.patch similarity index 84% rename from toolchain/gcc/patches/6.3.0/870-ppc_no_crtsavres.patch rename to toolchain/gcc/patches/8.2.0/870-ppc_no_crtsavres.patch index 9e543a0fc..ecaf75a47 100644 --- a/toolchain/gcc/patches/6.3.0/870-ppc_no_crtsavres.patch +++ b/toolchain/gcc/patches/8.2.0/870-ppc_no_crtsavres.patch @@ -1,6 +1,6 @@ --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c -@@ -24171,7 +24171,7 @@ rs6000_savres_strategy (rs6000_stack_t * +@@ -24501,7 +24501,7 @@ rs6000_savres_strategy (rs6000_stack_t * /* Define cutoff for using out-of-line functions to save registers. */ if (DEFAULT_ABI == ABI_V4 || TARGET_ELF) { diff --git a/toolchain/gcc/patches/6.3.0/881-no_tm_section.patch b/toolchain/gcc/patches/8.2.0/881-no_tm_section.patch similarity index 100% rename from toolchain/gcc/patches/6.3.0/881-no_tm_section.patch rename to toolchain/gcc/patches/8.2.0/881-no_tm_section.patch diff --git a/toolchain/gcc/patches/6.3.0/900-bad-mips16-crt.patch b/toolchain/gcc/patches/8.2.0/900-bad-mips16-crt.patch similarity index 100% rename from toolchain/gcc/patches/6.3.0/900-bad-mips16-crt.patch rename to toolchain/gcc/patches/8.2.0/900-bad-mips16-crt.patch diff --git a/toolchain/gcc/patches/6.3.0/910-mbsd_multi.patch b/toolchain/gcc/patches/8.2.0/910-mbsd_multi.patch similarity index 50% rename from toolchain/gcc/patches/6.3.0/910-mbsd_multi.patch rename to toolchain/gcc/patches/8.2.0/910-mbsd_multi.patch index b747935f0..d9802b6d6 100644 --- a/toolchain/gcc/patches/6.3.0/910-mbsd_multi.patch +++ b/toolchain/gcc/patches/8.2.0/910-mbsd_multi.patch @@ -1,22 +1,23 @@ +commit 99368862e44740ff4fd33760893f04e14f9dbdf1 +Author: Felix Fietkau +Date: Tue Jul 31 00:52:27 2007 +0000 - This patch brings over a few features from MirBSD: + Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly + + SVN-Revision: 8256 + + This patch brings over a feature from MirBSD: * -fhonour-copts If this option is not given, it's warned (depending on environment variables). This is to catch errors of misbuilt packages which override CFLAGS themselves. - * -Werror-maybe-reset - Has the effect of -Wno-error if GCC_NO_WERROR is - set and not '0', a no-operation otherwise. This is - to be able to use -Werror in "make" but prevent - GNU autoconf generated configure scripts from - freaking out. This patch was authored by Thorsten Glaser with copyright assignment to the FSF in effect. --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c -@@ -107,6 +107,9 @@ static int class_dump_flags; +@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags; /* Whether any standard preincluded header has been preincluded. */ static bool done_preinclude; @@ -26,7 +27,7 @@ static void handle_OPT_d (const char *); static void set_std_cxx98 (int); static void set_std_cxx11 (int); -@@ -442,6 +445,12 @@ c_common_handle_option (size_t scode, co +@@ -459,6 +462,12 @@ c_common_handle_option (size_t scode, co flag_no_builtin = !value; break; @@ -39,7 +40,7 @@ case OPT_fconstant_string_class_: constant_string_class_name = arg; break; -@@ -1041,6 +1050,47 @@ c_common_init (void) +@@ -1125,6 +1134,47 @@ c_common_init (void) return false; } @@ -79,7 +80,7 @@ + } + } else if (evv == 0) { + if (honour_copts != 1) -+ inform (0, "someone does not honour COPTS correctly, passed %d times", ++ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times", + honour_copts); + } + } @@ -89,18 +90,7 @@ --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt -@@ -438,6 +438,10 @@ Wfloat-conversion - C ObjC C++ ObjC++ Var(warn_float_conversion) Warning LangEnabledBy(C ObjC C++ ObjC++,Wconversion) - Warn for implicit type conversions that cause loss of floating point precision. - -+Werror-maybe-reset -+C ObjC C++ ObjC++ -+; Documented in common.opt -+ - Wfloat-equal - C ObjC C++ ObjC++ Var(warn_float_equal) Warning - Warn if testing floating point numbers for equality. -@@ -1252,6 +1256,9 @@ C++ ObjC++ Optimization Alias(fexception +@@ -1469,6 +1469,9 @@ C++ ObjC++ Optimization Alias(fexception fhonor-std C++ ObjC++ Ignore Warn(switch %qs is no longer supported) @@ -112,18 +102,7 @@ Assume normal C execution environment. --- a/gcc/common.opt +++ b/gcc/common.opt -@@ -581,6 +581,10 @@ Werror= - Common Joined - Treat specified warning as error. - -+Werror-maybe-reset -+Common -+If environment variable GCC_NO_WERROR is set, act as -Wno-error -+ - Wextra - Common Var(extra_warnings) Warning - Print extra (possibly unwanted) warnings. -@@ -1432,6 +1436,9 @@ fguess-branch-probability +@@ -1551,6 +1551,9 @@ fguess-branch-probability Common Report Var(flag_guess_branch_prob) Optimization Enable guessing of branch probabilities. @@ -135,58 +114,22 @@ ; On SVR4 targets, it also controls whether or not to emit a --- a/gcc/opts.c +++ b/gcc/opts.c -@@ -1783,6 +1783,17 @@ common_handle_option (struct gcc_options +@@ -2056,6 +2056,9 @@ common_handle_option (struct gcc_options opts, opts_set, loc, dc); break; -+ case OPT_Werror_maybe_reset: -+ { -+ char *ev = getenv ("GCC_NO_WERROR"); -+ if ((ev != NULL) && (*ev != '0')) -+ warnings_are_errors = 0; -+ } -+ break; -+ + case OPT_fhonour_copts: + break; + case OPT_Wlarger_than_: opts->x_larger_than_size = value; opts->x_warn_larger_than = value != -1; ---- a/gcc/doc/cppopts.texi -+++ b/gcc/doc/cppopts.texi -@@ -163,6 +163,11 @@ in older programs. This warning is on b - Make all warnings into hard errors. Source code which triggers warnings - will be rejected. - -+@item -Werror-maybe-reset -+@opindex Werror-maybe-reset -+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment -+variable is set to anything other than 0 or empty. -+ - @item -Wsystem-headers - @opindex Wsystem-headers - Issue warnings for code in system headers. These are normally unhelpful --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -263,7 +263,7 @@ Objective-C and Objective-C++ Dialects}. - -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol - -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol - -Wempty-body -Wenum-compare -Wno-endif-labels @gol ---Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol -+-Werror -Werror=* -Werror-maybe-reset -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol - -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol - -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol - -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol -@@ -5737,6 +5737,22 @@ This option is only supported for C and +@@ -7012,6 +7012,17 @@ This option is only supported for C and @option{-Wall} and by @option{-Wpedantic}, which can be disabled with @option{-Wno-pointer-sign}. -+@item -Werror-maybe-reset -+@opindex Werror-maybe-reset -+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment -+variable is set to anything other than 0 or empty. -+ +@item -fhonour-copts +@opindex fhonour-copts +If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not @@ -201,22 +144,3 @@ @item -Wstack-protector @opindex Wstack-protector @opindex Wno-stack-protector -@@ -6605,7 +6621,7 @@ so, the first branch is redirected to ei - second branch or a point immediately following it, depending on whether - the condition is known to be true or false. - --Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. -+Enabled at levels @option{-O3}. - - @item -fsplit-wide-types - @opindex fsplit-wide-types ---- a/gcc/java/jvspec.c -+++ b/gcc/java/jvspec.c -@@ -629,6 +629,7 @@ lang_specific_pre_link (void) - class name. Append dummy `.c' that can be stripped by set_input so %b - is correct. */ - set_input (concat (main_class_name, "main.c", NULL)); -+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */ - err = do_spec (jvgenmain_spec); - if (err == 0) - { diff --git a/toolchain/gcc/patches/6.3.0/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/8.2.0/920-specs_nonfatal_getenv.patch similarity index 59% rename from toolchain/gcc/patches/6.3.0/920-specs_nonfatal_getenv.patch rename to toolchain/gcc/patches/8.2.0/920-specs_nonfatal_getenv.patch index dc0acb95a..c3836e63a 100644 --- a/toolchain/gcc/patches/6.3.0/920-specs_nonfatal_getenv.patch +++ b/toolchain/gcc/patches/8.2.0/920-specs_nonfatal_getenv.patch @@ -1,6 +1,13 @@ +Author: Jo-Philipp Wich +Date: Sat Apr 21 03:02:39 2012 +0000 + + gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset + + SVN-Revision: 31390 + --- a/gcc/gcc.c +++ b/gcc/gcc.c -@@ -9198,8 +9198,10 @@ getenv_spec_function (int argc, const ch +@@ -9347,8 +9347,10 @@ getenv_spec_function (int argc, const ch value = varname; if (!value) diff --git a/toolchain/gcc/patches/6.3.0/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/8.2.0/930-fix-mips-noexecstack.patch similarity index 95% rename from toolchain/gcc/patches/6.3.0/930-fix-mips-noexecstack.patch rename to toolchain/gcc/patches/8.2.0/930-fix-mips-noexecstack.patch index 2a99840b6..706d67f7c 100644 --- a/toolchain/gcc/patches/6.3.0/930-fix-mips-noexecstack.patch +++ b/toolchain/gcc/patches/8.2.0/930-fix-mips-noexecstack.patch @@ -48,9 +48,9 @@ sellcey@mips.com --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c -@@ -20228,6 +20228,9 @@ mips_promote_function_mode (const_tree t - #undef TARGET_HARD_REGNO_SCRATCH_OK - #define TARGET_HARD_REGNO_SCRATCH_OK mips_hard_regno_scratch_ok +@@ -22627,6 +22627,9 @@ mips_starting_frame_offset (void) + #undef TARGET_STARTING_FRAME_OFFSET + #define TARGET_STARTING_FRAME_OFFSET mips_starting_frame_offset +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack diff --git a/toolchain/gcc/patches/8.2.0/931-libffi-fix-MIPS-softfloat-build-issue.patch b/toolchain/gcc/patches/8.2.0/931-libffi-fix-MIPS-softfloat-build-issue.patch new file mode 100644 index 000000000..fb4cb1533 --- /dev/null +++ b/toolchain/gcc/patches/8.2.0/931-libffi-fix-MIPS-softfloat-build-issue.patch @@ -0,0 +1,168 @@ +From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001 +From: BangLang Huang +Date: Wed, 9 Nov 2016 10:36:49 +0800 +Subject: [PATCH] libffi: fix MIPS softfloat build issue + +Backported from github.com/libffi/libffi#272 + +Signed-off-by: BangLang Huang +Signed-off-by: Yousong Zhou +--- + libffi/src/mips/n32.S | 17 +++++++++++++++++ + libffi/src/mips/o32.S | 17 +++++++++++++++++ + 2 files changed, 34 insertions(+) + +--- a/libffi/src/mips/n32.S ++++ b/libffi/src/mips/n32.S +@@ -107,6 +107,16 @@ loadregs: + + REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. + ++#ifdef __mips_soft_float ++ REG_L a0, 0*FFI_SIZEOF_ARG(t9) ++ REG_L a1, 1*FFI_SIZEOF_ARG(t9) ++ REG_L a2, 2*FFI_SIZEOF_ARG(t9) ++ REG_L a3, 3*FFI_SIZEOF_ARG(t9) ++ REG_L a4, 4*FFI_SIZEOF_ARG(t9) ++ REG_L a5, 5*FFI_SIZEOF_ARG(t9) ++ REG_L a6, 6*FFI_SIZEOF_ARG(t9) ++ REG_L a7, 7*FFI_SIZEOF_ARG(t9) ++#else + and t4, t6, ((1< +Date: Fri, 4 May 2018 18:20:53 +0800 +Subject: [PATCH] gotools: fix compilation when making cross compiler + +libgo is "the runtime support library for the Go programming language. +This library is intended for use with the Go frontend." + +gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but +the linker will complain that it cannot find it. That's because shared libgcc +is not present in the install directory yet. libgo.so was made without problem +because gcc will emit -lgcc_s when compiled with -shared option. When gotools +were being made, it was supplied with -static-libgcc thus no link option was +provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec +for linking with libgo.so + +- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation +- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html + +When 3-pass GCC compilation is used, shared libgcc runtime libraries will be +available after gcc pass2 completed and will meet the gotools link requirement +at gcc pass3 +--- + gotools/Makefile.am | 4 +++- + gotools/Makefile.in | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +--- a/gotools/Makefile.am ++++ b/gotools/Makefile.am +@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd} + STAMP = echo timestamp > + + libgodir = ../$(target_noncanonical)/libgo ++libgccdir = ../$(target_noncanonical)/libgcc + LIBGODEP = $(libgodir)/libgo.la + + LIBGOTOOL = $(libgodir)/libgotool.a +@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET) + GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) + + AM_GOCFLAGS = -I $(libgodir) +-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs ++AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \ ++ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s + GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@ + + libgosrcdir = $(srcdir)/../libgo/go +--- a/gotools/Makefile.in ++++ b/gotools/Makefile.in +@@ -263,6 +263,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd + PWD_COMMAND = $${PWDCMD-pwd} + STAMP = echo timestamp > + libgodir = ../$(target_noncanonical)/libgo ++libgccdir = ../$(target_noncanonical)/libgcc + LIBGODEP = $(libgodir)/libgo.la + LIBGOTOOL = $(libgodir)/libgotool.a + @NATIVE_FALSE@GOCOMPILER = $(GOC) +@@ -271,7 +272,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a + @NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) + GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) + AM_GOCFLAGS = -I $(libgodir) +-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs ++AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \ ++ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s + GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@ + libgosrcdir = $(srcdir)/../libgo/go + cmdsrcdir = $(libgosrcdir)/cmd diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 5c80eef9a..69029332e 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -17,11 +17,11 @@ PKG_HASH:=7e3c2a763bf500a40c5c4591a7e22c591dafc1f214b1d514895c1096e85c883a GDB_DIR:=binutils-$(PKG_NAME)-$(PKG_VERSION) PATCH_DIR:=./patches-arc else -PKG_VERSION:=8.0.1 +PKG_VERSION:=8.1.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=3dbd5f93e36ba2815ad0efab030dcd0c7b211d7b353a40a53f4c02d7d56295e3 +PKG_HASH:=97dcc3169bd430270fc29adb65145846a58c1b55cdbb73382a4a89307bdad03c GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION) endif @@ -41,7 +41,7 @@ HOST_CONFIGURE_ARGS = \ --target=$(REAL_GNU_TARGET_NAME) \ --disable-werror \ --without-uiout \ - --disable-tui --disable-gdbtk --without-x \ + --enable-tui --disable-gdbtk --without-x \ --without-included-gettext \ --enable-threads \ --with-expat \ diff --git a/toolchain/gdb/patches/110-no_testsuite.patch b/toolchain/gdb/patches/110-no_testsuite.patch index e86ba6d0c..f87cdd2b7 100644 --- a/toolchain/gdb/patches/110-no_testsuite.patch +++ b/toolchain/gdb/patches/110-no_testsuite.patch @@ -1,6 +1,6 @@ --- a/gdb/configure +++ b/gdb/configure -@@ -869,8 +869,7 @@ MAKEINFOFLAGS +@@ -881,8 +881,7 @@ MAKEINFOFLAGS YACC YFLAGS XMKMF' @@ -10,7 +10,7 @@ multi-ice gdbserver' -@@ -6473,7 +6472,7 @@ $as_echo "$with_auto_load_safe_path" >&6 +@@ -6488,7 +6487,7 @@ $as_echo "$with_auto_load_safe_path" >&6 diff --git a/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch b/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch index 9ce91a024..7bb46aafc 100644 --- a/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch +++ b/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch @@ -1,6 +1,6 @@ --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure -@@ -2469,7 +2469,7 @@ $as_echo "$as_me: error: \`$ac_var' was +@@ -2470,7 +2470,7 @@ $as_echo "$as_me: error: \`$ac_var' was ac_cache_corrupted=: ;; ,);; *) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 2de9596dc..b9dd46a5e 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -11,8 +11,8 @@ PKG_VERSION:=2.26 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=af7519f7b35024224c163e32a89fb247b0c446fc -PKG_MIRROR_HASH:=7f4d0b9d55b5820b9e2feefed03206086b3d1ddef5f02358e587948f5bb9c516 +PKG_SOURCE_VERSION:=c9570bd2f54abb68e4e3c767aca3a54e05d2c7f6 +PKG_MIRROR_HASH:=32b77c2263a7f9b75a49633e5047c6a8e3ed19fe4bc5ac53e2328aa0dd852492 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz diff --git a/toolchain/glibc/patches/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/100-fix_cross_rpcgen.patch index 6a5e537b7..f10efcc5d 100644 --- a/toolchain/glibc/patches/100-fix_cross_rpcgen.patch +++ b/toolchain/glibc/patches/100-fix_cross_rpcgen.patch @@ -38,7 +38,7 @@ +++ b/sunrpc/rpc_main.c @@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd) abort (); - temp = rindex (cmd->infile, '.'); + temp = strrchr (cmd->infile, '.'); cp = stpcpy (mkfilename, "Makefile."); - if (temp != NULL) - *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0'; diff --git a/toolchain/glibc/patches/200-add-dl-search-paths.patch b/toolchain/glibc/patches/200-add-dl-search-paths.patch index 8f720cb9f..5bd58dc8d 100644 --- a/toolchain/glibc/patches/200-add-dl-search-paths.patch +++ b/toolchain/glibc/patches/200-add-dl-search-paths.patch @@ -2,7 +2,7 @@ add /usr/lib to default search path for the dynamic linker --- a/Makeconfig +++ b/Makeconfig -@@ -571,6 +571,9 @@ else +@@ -578,6 +578,9 @@ else default-rpath = $(libdir) endif diff --git a/toolchain/yasm/Makefile b/toolchain/nasm/Makefile similarity index 59% rename from toolchain/yasm/Makefile rename to toolchain/nasm/Makefile index e5cdac6fe..53b7848ca 100644 --- a/toolchain/yasm/Makefile +++ b/toolchain/nasm/Makefile @@ -1,34 +1,26 @@ # -# Copyright (C) 2016 Daniel Golle -# # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -PKG_NAME:=yasm -PKG_VERSION:=1.3.0 +PKG_NAME:=nasm +PKG_VERSION:=2.13.03 -PKG_SOURCE_URL:=http://www.tortall.net/projects/yasm/releases/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://www.nasm.us/pub/nasm/releasebuilds/$(PKG_VERSION)/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f +PKG_HASH:=812ecfb0dcbc5bd409aaa8f61c7de94c5b8752a7b00c632883d15b2ed6452573 HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/toolchain-build.mk -YASM_CONFIGURE:= \ - ./configure \ - --prefix=$(TOOLCHAIN_DIR) \ - --build=$(GNU_HOST_NAME) \ - --host=$(GNU_HOST_NAME) \ +HOST_CONFIGURE_ARGS+= \ --target=$(REAL_GNU_TARGET_NAME) \ --with-sysroot=$(TOOLCHAIN_DIR) \ - --disable-multilib \ + --disable-lto \ --disable-werror \ - --disable-nls \ - --disable-sim \ --disable-gdb \ $(SOFT_FLOAT_CONFIG_OPTION) \ @@ -40,16 +32,14 @@ endef define Host/Configure (cd $(HOST_BUILD_DIR); \ - $(YASM_CONFIGURE) \ + ./autogen.sh \ ); -endef - -define Host/Compile - +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all + $(call Host/Configure/Default) endef define Host/Install $(MAKE) -C $(HOST_BUILD_DIR) \ + $(HOST_MAKE_FLAGS) \ prefix=$(TOOLCHAIN_DIR) \ install endef diff --git a/toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch b/toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch new file mode 100644 index 000000000..a6c5027be --- /dev/null +++ b/toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch @@ -0,0 +1,15 @@ +--- a/include/nasmlib.h ++++ b/include/nasmlib.h +@@ -188,11 +188,9 @@ int64_t readnum(char *str, bool *error); + int64_t readstrnum(char *str, int length, bool *warn); + + /* +- * seg_init: Initialise the segment-number allocator. + * seg_alloc: allocate a hitherto unused segment number. + */ +-void pure_func seg_init(void); +-int32_t pure_func seg_alloc(void); ++int32_t seg_alloc(void); + + /* + * many output formats will be able to make use of this: a standard diff --git a/tools/Makefile b/tools/Makefile index d2b5daf18..9a354f6c7 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -30,7 +30,8 @@ tools-y += mtools dosfstools libressl tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-$(CONFIG_TARGET_x86) += qemu tools-$(CONFIG_TARGET_mxs) += elftosb sdimage -tools-$(CONFIG_TARGET_ar71xx) += lzma-old squashfs +tools-$(CONFIG_TARGET_ar71xx) += lzma-old +tools-$(CONFIG_TARGET_ar71xx)$(CONFIG_TARGET_ath79) += squashfs tools-$(CONFIG_USES_MINOR) += kernel2minor tools-y += lzma squashfs4 tools-$(BUILD_B43_TOOLS) += b43-tools diff --git a/tools/b43-tools/Makefile b/tools/b43-tools/Makefile index 4afaeae9c..a99b0c9e5 100644 --- a/tools/b43-tools/Makefile +++ b/tools/b43-tools/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=b43-tools -PKG_VERSION:=019 +PKG_DATE:=2017-09-13 PKG_SOURCE_URL:=https://github.com/mbuesch/b43-tools.git PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME) -PKG_SOURCE_VERSION:=8dce53297966b31b6c70a7a03c2433978dd9f288 -PKG_MIRROR_HASH:=247eb0297f14fbcc828685cc353150f30fa03bf886e7a477aadc4161d9c0458d +PKG_SOURCE_VERSION:=27892ef741e7f1d08cb939744f8b8f5dac7b04ae +PKG_MIRROR_HASH:=f914c36ac566e9e3b5a3a04de16ddb014fcad6a1cf25cdd8e4825c708d28d3f4 HOST_BUILD_DIR=$(BUILD_DIR_HOST)/$(PKG_NAME) include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 6fc06c10c..111bd91bb 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk PKG_NAME:=ccache -PKG_VERSION:=3.3.6 +PKG_VERSION:=3.4.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://download.samba.org/pub/ccache/ \ https://samba.org/ftp/ccache/ -PKG_HASH:=410a27fdaff64ead6df3fa57fa74bca0eca6b5f6ac77d7288af1256f6b12141d +PKG_HASH:=18a8b14367d63d3d37fb6c33cba60e1b7fcd7a63d608df97c9771ae0d234fee2 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index 7a17fcb75..1916d17c6 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,6 +1,6 @@ ---- a/ccache.c -+++ b/ccache.c -@@ -1803,6 +1803,7 @@ calculate_object_hash(struct args *args, +--- a/src/ccache.c ++++ b/src/ccache.c +@@ -1859,6 +1859,7 @@ calculate_object_hash(struct args *args, "CPLUS_INCLUDE_PATH", "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH", // clang diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index b6d628715..340c47cb0 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.11.1 +PKG_VERSION:=3.12.1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://cmake.org/files/v3.11/ \ +PKG_SOURCE_URL:=https://cmake.org/files/v3.12/ \ https://fossies.org/linux/misc/ -PKG_HASH:=57bebc6ca4d1d42c6385249d148d9216087e0fda57a47dc5c858790a70217d0c +PKG_HASH:=c53d5c2ce81d7a957ee83e3e635c8cda5dfe20c9d501a4828ee28e1615e57ab2 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/cmake/patches/100-disable_qt_tests.patch b/tools/cmake/patches/100-disable_qt_tests.patch index 46cdc9456..a354e1cac 100644 --- a/tools/cmake/patches/100-disable_qt_tests.patch +++ b/tools/cmake/patches/100-disable_qt_tests.patch @@ -1,6 +1,6 @@ --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt -@@ -284,15 +284,6 @@ add_RunCMake_test(no_install_prefix) +@@ -290,15 +290,6 @@ add_RunCMake_test(no_install_prefix) add_RunCMake_test(configure_file) add_RunCMake_test(CTestTimeoutAfterMatch) @@ -18,7 +18,7 @@ add_RunCMake_test(FindPkgConfig) --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt -@@ -422,13 +422,6 @@ if(BUILD_TESTING) +@@ -435,13 +435,6 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) diff --git a/tools/cmake/patches/120-curl-fix-libressl-linking.patch b/tools/cmake/patches/120-curl-fix-libressl-linking.patch index a345a8c16..20c5052cc 100644 --- a/tools/cmake/patches/120-curl-fix-libressl-linking.patch +++ b/tools/cmake/patches/120-curl-fix-libressl-linking.patch @@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich --- --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt -@@ -461,6 +461,14 @@ if(CMAKE_USE_OPENSSL) +@@ -452,6 +452,14 @@ if(CMAKE_USE_OPENSSL) set(USE_OPENSSL ON) set(HAVE_LIBCRYPTO ON) set(HAVE_LIBSSL ON) diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index de5137ee3..375bc5d97 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -1,6 +1,6 @@ --- a/bootstrap +++ b/bootstrap -@@ -1149,7 +1149,10 @@ int main(){ printf("1%c", (char)0x0a); r +@@ -1163,7 +1163,10 @@ int main(){ printf("1%c", (char)0x0a); r ' > "test.c" cmake_original_make_flags="${cmake_make_flags}" if [ "x${cmake_parallel_make}" != "x" ]; then diff --git a/tools/cmake/patches/140-curl-fix-libressl.patch b/tools/cmake/patches/140-curl-fix-libressl.patch deleted file mode 100644 index 9caed96f5..000000000 --- a/tools/cmake/patches/140-curl-fix-libressl.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 7c90c93c0b061da81f69fabdd57125b2783c15fb Mon Sep 17 00:00:00 2001 -From: Bernard Spil -Date: Mon, 2 Apr 2018 19:04:06 +0200 -Subject: [PATCH] openssl: fix build with LibreSSL 2.7 - - - LibreSSL 2.7 implements (most of) OpenSSL 1.1 API - -Fixes #2319 -Closes #2447 -Closes #2448 - -Signed-off-by: Bernard Spil ---- - lib/vtls/openssl.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - ---- a/Utilities/cmcurl/lib/vtls/openssl.c -+++ b/Utilities/cmcurl/lib/vtls/openssl.c -@@ -104,7 +104,8 @@ - #endif - - #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && /* OpenSSL 1.1.0+ */ \ -- !defined(LIBRESSL_VERSION_NUMBER) -+ !(defined(LIBRESSL_VERSION_NUMBER) && \ -+ LIBRESSL_VERSION_NUMBER < 0x20700000L) - #define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER - #define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */ - #define HAVE_OPAQUE_EVP_PKEY 1 /* since 1.1.0 -pre3 */ -@@ -128,7 +129,8 @@ static unsigned long OpenSSL_version_num - #endif - - #if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* 1.0.2 or later */ \ -- !defined(LIBRESSL_VERSION_NUMBER) -+ !(defined(LIBRESSL_VERSION_NUMBER) && \ -+ LIBRESSL_VERSION_NUMBER < 0x20700000L) - #define HAVE_X509_GET0_SIGNATURE 1 - #endif - -@@ -147,7 +149,7 @@ static unsigned long OpenSSL_version_num - * Whether SSL_CTX_set_keylog_callback is available. - * OpenSSL: supported since 1.1.1 https://github.com/openssl/openssl/pull/2287 - * BoringSSL: supported since d28f59c27bac (committed 2015-11-19) -- * LibreSSL: unsupported in at least 2.5.1 (explicitly check for it since it -+ * LibreSSL: unsupported in at least 2.7.2 (explicitly check for it since it - * lies and pretends to be OpenSSL 2.0.0). - */ - #if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \ -@@ -259,7 +261,9 @@ static void tap_ssl_key(const SSL *ssl, - if(!session || !keylog_file_fp) - return; - --#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ -+ !(defined(LIBRESSL_VERSION_NUMBER) && \ -+ LIBRESSL_VERSION_NUMBER < 0x20700000L) - /* ssl->s3 is not checked in openssl 1.1.0-pre6, but let's assume that - * we have a valid SSL context if we have a non-NULL session. */ - SSL_get_client_random(ssl, client_random, SSL3_RANDOM_SIZE); -@@ -2082,8 +2086,7 @@ static CURLcode ossl_connect_step1(struc - case CURL_SSLVERSION_TLSv1_2: - case CURL_SSLVERSION_TLSv1_3: - /* it will be handled later with the context options */ --#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \ -- !defined(LIBRESSL_VERSION_NUMBER) -+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) - req_method = TLS_client_method(); - #else - req_method = SSLv23_client_method(); diff --git a/tools/cmake/patches/150-libarchive-fix-libressl.patch b/tools/cmake/patches/140-libarchive-fix-libressl.patch similarity index 100% rename from tools/cmake/patches/150-libarchive-fix-libressl.patch rename to tools/cmake/patches/140-libarchive-fix-libressl.patch diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index f809df424..0e12cdd90 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs -PKG_VERSION:=1.44.1 -PKG_HASH:=0ca164c1c87724df904c918b2d7051ef989b51de725db66c67514dbe6dd2b9ef +PKG_VERSION:=1.44.3 +PKG_HASH:=5d899f7d30f481cc0c6a049ebe26ebe145f1b524182ea1ecde4086162d4e4bb6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 4b4af9990..00917c341 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -70,6 +70,7 @@ define Host/Compile $(call cc,fix-u-media-header cyg_crc32,-Wall) $(call cc,hcsmakeimage bcmalgo) $(call cc,mkporayfw, -Wall) + $(call cc,mkrasimage, --std=gnu99) $(call cc,mkhilinkfw, -lcrypto) $(call cc,mkdcs932, -Wall) $(call cc,mkheader_gemtek,-lz) @@ -84,6 +85,7 @@ define Host/Compile $(call cc,mkdhpimg buffalo-lib, -Wall) $(call cc,mkdlinkfw mkdlinkfw-lib, -lz -Wall --std=gnu99) $(call cc,dns313-header, -Wall) + $(call cc,mksercommfw, -Wall --std=gnu99) endef define Host/Install diff --git a/tools/firmware-utils/src/mkrasimage.c b/tools/firmware-utils/src/mkrasimage.c new file mode 100644 index 000000000..8eee29cc0 --- /dev/null +++ b/tools/firmware-utils/src/mkrasimage.c @@ -0,0 +1,459 @@ +/* + * --- ZyXEL header format --- + * Original Version by Benjamin Berg + * C implementation based on generation-script by Christian Lamparter + * + * The firmware image prefixed with a header (which is written into the MTD device). + * The header is one erase block (~64KiB) in size, but the checksum only convers the + * first 2KiB. Padding is 0xff. All integers are in big-endian. + * + * The checksum is always a 16-Bit System V checksum (sum -s) stored in a 32-Bit integer. + * + * 4 bytes: checksum of the rootfs image + * 4 bytes: length of the contained rootfs image file (big endian) + * 32 bytes: Firmware Version string (NUL terminated, 0xff padded) + * 4 bytes: checksum over the header partition (big endian - see below) + * 64 bytes: Model (e.g. "NBG6617", NUL termiated, 0xff padded) + * 4 bytes: checksum of the kernel partition + * 4 bytes: length of the contained kernel image file (big endian) + * rest: 0xff padding (To erase block size) + * + * The kernel partition checksum and length is not used for every device. + * If it's notused, pad those 8 bytes with 0xFF. + * + * The checksums are calculated by adding up all bytes and if a 16bit + * overflow occurs, one is added and the sum is masked to 16 bit: + * csum = csum + databyte; if (csum > 0xffff) { csum += 1; csum &= 0xffff }; + * Should the file have an odd number of bytes then the byte len-0x800 is + * used additionally. + * + * The checksum for the header is calculated over the first 2048 bytes with + * the rootfs image checksum as the placeholder during calculation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define VERSION_STRING_LEN 31 +#define ROOTFS_HEADER_LEN 40 + +#define KERNEL_HEADER_LEN 8 + +#define BOARD_NAME_LEN 64 +#define BOARD_HEADER_LEN 68 + +#define HEADER_PARTITION_CALC_LENGTH 2048 +#define HEADER_PARTITION_LENGTH 0x10000 + +struct file_info { + char *name; /* name of the file */ + char *data; /* file content */ + size_t size; /* length of the file */ +}; + +static char *progname; + +static char *board_name = 0; +static char *version_name = 0; +static unsigned int rootfs_size = 0; + +static struct file_info kernel = { NULL, NULL, 0 }; +static struct file_info rootfs = { NULL, NULL, 0 }; +static struct file_info rootfs_out = { NULL, NULL, 0 }; +static struct file_info out = { NULL, NULL, 0 }; + +#define ERR(fmt, ...) do { \ + fprintf(stderr, "[%s] *** error: " fmt "\n", \ + progname, ## __VA_ARGS__ ); \ +} while (0) + +void map_file(struct file_info *finfo) +{ + struct stat file_stat = {0}; + int fd; + + fd = open(finfo->name, O_RDONLY, (mode_t)0600); + if (fd == -1) { + ERR("Error while opening file %s.", finfo->name); + exit(EXIT_FAILURE); + } + + if (fstat(fd, &file_stat) == -1) { + ERR("Error getting file size for %s.", finfo->name); + exit(EXIT_FAILURE); + } + + finfo->size = file_stat.st_size; + finfo->data = mmap(0, finfo->size, PROT_READ, MAP_SHARED, fd, 0); + + if (finfo->data == MAP_FAILED) { + ERR("Error mapping file %s.", finfo->name); + exit(EXIT_FAILURE); + } + + close(fd); +} + +void unmap_file(struct file_info *finfo) +{ + if(munmap(finfo->data, finfo->size) == -1) { + ERR("Error unmapping file %s.", finfo->name); + exit(EXIT_FAILURE); + } +} + +void write_file(struct file_info *finfo) +{ + FILE *fout = fopen(finfo->name, "w"); + + fwrite(finfo->data, finfo->size, 1, fout); + + if (ferror(fout)) { + ERR("Wanted to write, but something went wrong."); + exit(EXIT_FAILURE); + } + + fclose(fout); +} + +void usage(int status) +{ + FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; + + fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); + fprintf(stream, + "\n" + "Options:\n" + " -k path for kernel image\n" + " -r path for rootfs image\n" + " -s size of output rootfs\n" + " -v version string\n" + " -b name of board to generate image for\n" + " -o name of output image\n" + " -h show this screen\n" + ); + + exit(status); +} + +static int sysv_chksm(const unsigned char *data, int size) +{ + int r; + int checksum; + unsigned int s = 0; /* The sum of all the input bytes, modulo (UINT_MAX + 1). */ + + + for (int i = 0; i < size; i++) { + s += data[i]; + } + + r = (s & 0xffff) + ((s & 0xffffffff) >> 16); + checksum = (r & 0xffff) + (r >> 16); + + return checksum; +} + +static int zyxel_chksm(const unsigned char *data, int size) +{ + return htonl(sysv_chksm(data, size)); +} + +char *generate_rootfs_header(struct file_info filesystem, char *version) +{ + size_t version_string_length; + unsigned int chksm, size; + char *rootfs_header; + size_t ptr = 0; + + rootfs_header = malloc(ROOTFS_HEADER_LEN); + if (!rootfs_header) { + ERR("Couldn't allocate memory for rootfs header!"); + exit(EXIT_FAILURE); + } + + /* Prepare padding for firmware-version string here */ + memset(rootfs_header, 0xff, ROOTFS_HEADER_LEN); + + chksm = zyxel_chksm((const unsigned char *)filesystem.data, filesystem.size); + size = htonl(filesystem.size); + + /* 4 bytes: checksum of the rootfs image */ + memcpy(rootfs_header + ptr, &chksm, 4); + ptr += 4; + + /* 4 bytes: length of the contained rootfs image file (big endian) */ + memcpy(rootfs_header + ptr, &size, 4); + ptr += 4; + + /* 32 bytes: Firmware Version string (NUL terminated, 0xff padded) */ + version_string_length = strlen(version) <= VERSION_STRING_LEN ? strlen(version) : VERSION_STRING_LEN; + memcpy(rootfs_header + ptr, version, version_string_length); + ptr += version_string_length; + /* Add null-terminator */ + rootfs_header[ptr] = 0x0; + + return rootfs_header; +} + +char *generate_kernel_header(struct file_info kernel) +{ + unsigned int chksm, size; + char *kernel_header; + size_t ptr = 0; + + kernel_header = malloc(KERNEL_HEADER_LEN); + if (!kernel_header) { + ERR("Couldn't allocate memory for kernel header!"); + exit(EXIT_FAILURE); + } + + chksm = zyxel_chksm((const unsigned char *)kernel.data, kernel.size); + size = htonl(kernel.size); + + /* 4 bytes: checksum of the kernel image */ + memcpy(kernel_header + ptr, &chksm, 4); + ptr += 4; + + /* 4 bytes: length of the contained kernel image file (big endian) */ + memcpy(kernel_header + ptr, &size, 4); + + return kernel_header; +} + +unsigned int generate_board_header_checksum(char *kernel_hdr, char *rootfs_hdr, char *boardname) +{ + char *board_hdr_tmp; + unsigned int sum; + size_t ptr = 0; + + /* + * The checksum of the board header is calculated over the first 2048 bytes of + * the header partition with the rootfs checksum used as a placeholder for then + * board checksum we calculate in this step. The checksum gained from this step + * is then used for the final board header partition. + */ + + board_hdr_tmp = malloc(HEADER_PARTITION_CALC_LENGTH); + if (!board_hdr_tmp) { + ERR("Couldn't allocate memory for temporary board header!"); + exit(EXIT_FAILURE); + } + memset(board_hdr_tmp, 0xff, HEADER_PARTITION_CALC_LENGTH); + + /* 40 bytes: RootFS header */ + memcpy(board_hdr_tmp, rootfs_hdr, ROOTFS_HEADER_LEN); + ptr += ROOTFS_HEADER_LEN; + + /* 4 bytes: RootFS checksum (BE) as placeholder for board-header checksum */ + memcpy(board_hdr_tmp + ptr, rootfs_hdr, 4); + ptr += 4; + + /* 32 bytes: Model (e.g. "NBG6617", NUL termiated, 0xff padded) */ + memcpy(board_hdr_tmp + ptr, boardname, strlen(boardname)); + ptr += strlen(boardname); + /* Add null-terminator */ + board_hdr_tmp[ptr] = 0x0; + ptr = ROOTFS_HEADER_LEN + 4 + BOARD_NAME_LEN; + + /* 8 bytes: Kernel header */ + if (kernel_hdr) + memcpy(board_hdr_tmp + ptr, kernel_hdr, 8); + + /* Calculate the checksum over the first 2048 bytes */ + sum = zyxel_chksm((const unsigned char *)board_hdr_tmp, HEADER_PARTITION_CALC_LENGTH); + free(board_hdr_tmp); + return sum; +} + +char *generate_board_header(char *kernel_hdr, char *rootfs_hdr, char *boardname) +{ + unsigned int board_checksum; + char *board_hdr; + + board_hdr = malloc(BOARD_HEADER_LEN); + if (!board_hdr) { + ERR("Couldn't allocate memory for board header!"); + exit(EXIT_FAILURE); + } + memset(board_hdr, 0xff, BOARD_HEADER_LEN); + + /* 4 bytes: checksum over the header partition (big endian) */ + board_checksum = generate_board_header_checksum(kernel_hdr, rootfs_hdr, boardname); + memcpy(board_hdr, &board_checksum, 4); + + /* 32 bytes: Model (e.g. "NBG6617", NUL termiated, 0xff padded) */ + memcpy(board_hdr + 4, boardname, strlen(boardname)); + board_hdr[4 + strlen(boardname)] = 0x0; + + return board_hdr; +} + +int build_image() +{ + char *rootfs_header = NULL; + char *kernel_header = NULL; + char *board_header = NULL; + + size_t ptr; + + /* Load files */ + if (kernel.name) + map_file(&kernel); + map_file(&rootfs); + + /* + * Allocate memory and copy input rootfs for temporary output rootfs. + * This is important as we have to generate the rootfs checksum over the + * entire rootfs partition. As we might have to pad the partition to allow + * for flashing via ZyXEL's Web-GUI, we prepare the rootfs partition for the + * output image here (and also use it for calculating the rootfs checksum). + * + * The roofs padding has to be done with 0x00. + */ + rootfs_out.data = calloc(rootfs_out.size, sizeof(char)); + memcpy(rootfs_out.data, rootfs.data, rootfs.size); + + /* Prepare headers */ + rootfs_header = generate_rootfs_header(rootfs_out, version_name); + if (kernel.name) + kernel_header = generate_kernel_header(kernel); + board_header = generate_board_header(kernel_header, rootfs_header, board_name); + + /* Prepare output file */ + out.size = HEADER_PARTITION_LENGTH + rootfs_out.size; + if (kernel.name) + out.size += kernel.size; + out.data = malloc(out.size); + memset(out.data, 0xFF, out.size); + + /* Build output image */ + memcpy(out.data, rootfs_header, ROOTFS_HEADER_LEN); + memcpy(out.data + ROOTFS_HEADER_LEN, board_header, BOARD_HEADER_LEN); + if (kernel.name) + memcpy(out.data + ROOTFS_HEADER_LEN + BOARD_HEADER_LEN, kernel_header, KERNEL_HEADER_LEN); + ptr = HEADER_PARTITION_LENGTH; + memcpy(out.data + ptr, rootfs_out.data, rootfs_out.size); + ptr += rootfs_out.size; + if (kernel.name) + memcpy(out.data + ptr, kernel.data, kernel.size); + + /* Write back output image */ + write_file(&out); + + /* Free allocated memory */ + if (kernel.name) + unmap_file(&kernel); + unmap_file(&rootfs); + free(out.data); + free(rootfs_out.data); + + free(rootfs_header); + if (kernel.name) + free(kernel_header); + free(board_header); + + return 0; +} + +int check_options() +{ + if (!rootfs.name) { + ERR("No rootfs filename supplied"); + return -2; + } + + if (!out.name) { + ERR("No output filename supplied"); + return -3; + } + + if (!board_name) { + ERR("No board-name supplied"); + return -4; + } + + if (!version_name) { + ERR("No version supplied"); + return -5; + } + + if (rootfs_size <= 0) { + ERR("Invalid rootfs size supplied"); + return -6; + } + + if (strlen(board_name) > 31) { + ERR("Board name is to long"); + return -7; + } + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret; + progname = basename(argv[0]); + while (1) { + int c; + + c = getopt(argc, argv, "b:k:o:r:s:v:h"); + if (c == -1) + break; + + switch (c) { + case 'b': + board_name = optarg; + break; + case 'h': + usage(EXIT_SUCCESS); + break; + case 'k': + kernel.name = optarg; + break; + case 'o': + out.name = optarg; + break; + case 'r': + rootfs.name = optarg; + break; + case 's': + sscanf(optarg, "%u", &rootfs_size); + break; + case 'v': + version_name = optarg; + break; + default: + usage(EXIT_FAILURE); + break; + } + } + + ret = check_options(); + if (ret) + usage(EXIT_FAILURE); + + /* As ZyXEL Web-GUI only accept images with a rootfs equal or larger than the first firmware shipped + * for the device, we need to pad rootfs partition to this size. To perform further calculations, we + * decide the size of this part here. In case the rootfs we want to integrate in our image is larger, + * take it's size, otherwise the supplied size. + * + * Be careful! We rely on assertion of correct size to be performed beforehand. It is unknown if images + * with a to large rootfs are accepted or not. + */ + rootfs_out.size = rootfs_size < rootfs.size ? rootfs.size : rootfs_size; + return build_image(); +} diff --git a/tools/firmware-utils/src/mksercommfw.c b/tools/firmware-utils/src/mksercommfw.c new file mode 100644 index 000000000..7f31d4f4c --- /dev/null +++ b/tools/firmware-utils/src/mksercommfw.c @@ -0,0 +1,255 @@ +#include +#include +#include +#include + +/* #define DEBUG 1 */ + +/* + * Fw Header Layout for Netgear / Sercomm devices + * */ +static const char *magic = "sErCoMm"; /* 7 */ +/* 7-11: version control/download control ? */ +unsigned char version[4] = {0x00, 0x01, 0x00, 0x00}; +char *hwID = ""; /* 11-43 , ASCII/HEX */ +char *hwVer = ""; /* 44-57 , ASCII/HEX */ +char *swVer = ""; /* 58-62 , ASCII/HEX */ +/* magic again. */ + +#define HEADER_SIZE 71 + +/* null bytes until 511 */ +u_int32_t checksum = 0xFF; /* checksum */ +/* 512 onwards -> ZIP containing rootfs with the same Header */ + + +/* appended on rootfs for the Header. */ +const int footer_size = 128; + +struct file_info { + char *file_name; /* name of the file */ + char *file_data; /* data of the file in memory */ + u_int32_t file_size; /* length of the file */ +}; + +u_int8_t getCheckSum(char *data, int len) +{ + + int32_t previous = 0; + u_int32_t new = 0; + + for (u_int32_t i = 0; i < len; i++) { + new = (data[i] + previous) % 256; + previous = new | previous & -256; + } + return (u_int8_t) new; +} + +void *bufferFile(struct file_info *finfo, int dontload) +{ + int fs = 0; + FILE *f = NULL; + +#ifdef DEBUG + printf("Opening file: %s\n", finfo->file_name); +#endif + f = fopen(finfo->file_name, "rb"); + if (f == NULL) { + perror("Error"); + exit(1); + } + + fseek(f, 0L, SEEK_END); + fs = ftell(f); + rewind(f); + +#ifdef DEBUG + printf("Filesize: %i .\n", fs); +#endif + + finfo->file_size = fs; + + if (dontload) { + return 0; + } + + char *data = malloc(fs); + finfo->file_data = data; + + int read = fread(data, fs, 1, f); + + if (read != 1) { + printf("Error reading file %s.", finfo->file_name); + exit(1); + } + +#ifdef DEBUG + printf("File: read successfully %i bytes.\n", read*fs); +#endif + fclose(f); +} + +void *writeFile(struct file_info *finfo) +{ + +#ifdef DEBUG + printf("Writing file: %s.\n", finfo->file_name); +#endif + + FILE *fout = fopen(finfo->file_name, "w"); + + if (!fwrite(finfo->file_data, finfo->file_size, 1, fout)) { + printf("Wanted to write, but something went wrong.\n"); + fclose(fout); + exit(1); + } + fclose(fout); +} + +void *rmFile(struct file_info *finfo) +{ + remove(finfo->file_name); + free(finfo->file_data); + finfo->file_size = 0; +} + +void *usage(char *argv[]) +{ + printf("Usage: %s \n" + "All are positional arguments ... \n" + " sysupgradefile: File with the kernel uimage at 0\n" + " kernel_offset: Offset in Hex where the kernel is located\n" + " HWID: Hardware ID, ASCII\n" + " HWVER: Hardware Version, ASCII\n" + " SWID: Software Version, Hex\n" + " \n" + " ", argv[0]); +} + +int main(int argc, char *argv[]) +{ + printf("Building fw image for sercomm devices.\n"); + + if (argc == 2) { + struct file_info myfile = {argv[1], 0, 0}; + bufferFile(&myfile, 0); + char chksum = getCheckSum(myfile.file_data, myfile.file_size); + printf("Checksum for File: %X.\n", chksum); + return 0; + } + + if (argc != 6) { + usage(argv); + return 1; + } + + /* Args */ + + struct file_info sysupgrade = {argv[1], 0, 0}; + bufferFile(&sysupgrade, 0); + + int kernel_offset = 0x90000; /* offset for the kernel inside the rootfs, default val */ + sscanf(argv[2], "%X", &kernel_offset); +#ifdef DEBUG + printf("Kernel_offset: at %X/%i bytes.\n", kernel_offset, kernel_offset); +#endif + char *hwID = argv[3]; + char *hwVer = argv[4]; + u_int32_t swVer = 0; + sscanf(argv[5],"%4X",&swVer); + swVer = bswap_32(swVer); + + char *rootfsname = malloc(2*strlen(sysupgrade.file_name) + 8); + sprintf(rootfsname, "%s.rootfs", sysupgrade.file_name); + + char *zipfsname = malloc(2*strlen(rootfsname) + 5); + sprintf(zipfsname, "%s.zip", rootfsname); + /* / Args */ + +#ifdef DEBUG + printf("Building header: %s %s %2X %s.\n", hwID , hwVer, swVer, magic); +#endif + /* Construct the firmware header/magic */ + struct file_info header = {0, 0, 0}; + header.file_size = HEADER_SIZE; + header.file_data = malloc(HEADER_SIZE); + bzero(header.file_data, header.file_size); + + char *tg = header.file_data; + strcpy(tg, magic); + memcpy(tg+7, version, 4*sizeof(char)); + strcpy(tg+11, hwID); + strcpy(tg+45, hwVer); + memcpy(tg+55, &swVer,sizeof(u_int32_t)); + strcpy(tg+63, magic); + +#ifdef DEBUG + printf("Header done, now creating rootfs."); +#endif + /* Construct a rootfs */ + struct file_info rootfs = {0, 0, 0}; + rootfs.file_size = sysupgrade.file_size + kernel_offset + footer_size; + rootfs.file_data = malloc(rootfs.file_size); + bzero(rootfs.file_data, rootfs.file_size); + rootfs.file_name = rootfsname; + + /* copy Owrt image to Kernel location */ + memcpy(rootfs.file_data+kernel_offset, sysupgrade.file_data, sysupgrade.file_size); + + /* 22 added to get away from sysup image, no other reason. + * updater searches for magic anyway */ + tg = rootfs.file_data + kernel_offset + sysupgrade.file_size+22; + + memcpy(tg, header.file_data, header.file_size); + writeFile(&rootfs); + +#ifdef DEBUG + printf("Preparing to zip.\n"); +#endif + /* now that we got the rootfs, repeat the whole thing again(sorta): + * 1. zip the rootfs */ + char *zipper = malloc(5 + 2*strlen(rootfs.file_name) + 4); + sprintf(zipper, "%s %s %s", "zip ", zipfsname, rootfs.file_name); + int ret = system(zipper); + + /* clear rootfs file */ + rmFile(&rootfs); + + /* and load zipped fs */ + struct file_info zippedfs = {zipfsname, 0, 0}; + bufferFile(&zippedfs, 0); + +#ifdef DEBUG + printf("Creating Image.\n"); +#endif + + /* 2. create new file 512+rootfs size */ + struct file_info image = {argv[1], 0, 0}; + image.file_data = malloc(zippedfs.file_size + 512); + image.file_size = zippedfs.file_size + 512; + + /* 3. copy zipfile at loc 512 */ + memcpy(image.file_data+512, zippedfs.file_data, zippedfs.file_size); + rmFile(&zippedfs); + + /* 4. add header to file */ + memcpy(image.file_data, header.file_data, header.file_size); + + /* 5. do a checksum run, and compute checksum */ + char chksum = getCheckSum(image.file_data, image.file_size); +#ifdef DEBUG + printf("Checksum for Image: %X.\n", chksum); +#endif + + /* 6. write the checksum invert into byte 511 to bring it to 0 */ + chksum = (chksum ^ 0xFF) + 1; + memcpy(image.file_data+511, &chksum, 1); + + chksum = getCheckSum(image.file_data, image.file_size); +#ifdef DEBUG + printf("Checksum for after fix: %X.\n", chksum); +#endif + /* 7. pray that the updater will accept the file */ + writeFile(&image); + return 0; +} diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c index ab5fd6d58..ce2acc20c 100644 --- a/tools/firmware-utils/src/mktplinkfw.c +++ b/tools/firmware-utils/src/mktplinkfw.c @@ -107,6 +107,7 @@ static uint32_t reserved_space; static struct file_info inspect_info; static int extract = 0; static bool endian_swap = false; +static bool rootfs_ofs_calc = false; static const char md5salt_normal[MD5SUM_LEN] = { 0xdc, 0xd7, 0x3a, 0xa5, 0xc3, 0x95, 0x98, 0xfb, @@ -202,6 +203,7 @@ static void usage(int status) " -r read rootfs image from the file \n" " -a align the rootfs start on an bytes boundary\n" " -R overwrite rootfs offset with (hexval prefixed with 0x)\n" +" -O calculate rootfs offset for combined images\n" " -o write output to the file \n" " -s strip padding from the end of the image\n" " -j add jffs2 end-of-filesystem markers\n" @@ -384,6 +386,10 @@ void fill_header(char *buf, int len) hdr->rootfs_len = htonl(rootfs_info.file_size); } + if (combined && rootfs_ofs_calc) { + hdr->rootfs_ofs = htonl(sizeof(struct fw_header) + kernel_len); + } + hdr->ver_hi = htons(fw_ver_hi); hdr->ver_mid = htons(fw_ver_mid); hdr->ver_lo = htons(fw_ver_lo); @@ -539,7 +545,7 @@ int main(int argc, char *argv[]) while ( 1 ) { int c; - c = getopt(argc, argv, "a:H:E:F:L:m:V:N:W:C:ci:k:r:R:o:xX:ehsjv:"); + c = getopt(argc, argv, "a:H:E:F:L:m:V:N:W:C:ci:k:r:R:o:OxX:ehsjv:"); if (c == -1) break; @@ -592,6 +598,9 @@ int main(int argc, char *argv[]) case 'o': ofname = optarg; break; + case 'O': + rootfs_ofs_calc = 1; + break; case 's': strip_padding = 1; break; diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index b2cc96bc3..78092bc53 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -65,7 +65,7 @@ struct image_partition_entry { /** A flash partition table entry */ struct flash_partition_entry { - const char *name; + char *name; uint32_t base; uint32_t size; }; @@ -77,7 +77,7 @@ struct device_info { const char *support_list; char support_trail; const char *soft_ver; - const struct flash_partition_entry partitions[MAX_PARTITIONS+1]; + struct flash_partition_entry partitions[MAX_PARTITIONS+1]; const char *first_sysupgrade_partition; const char *last_sysupgrade_partition; }; @@ -210,7 +210,17 @@ static struct device_info boards[] = { "CPE510(TP-LINK|EU|N300-5):1.1\r\n" "CPE520(TP-LINK|UN|N300-5):1.1\r\n" "CPE520(TP-LINK|US|N300-5):1.1\r\n" - "CPE520(TP-LINK|EU|N300-5):1.1\r\n", + "CPE520(TP-LINK|EU|N300-5):1.1\r\n" + "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n" + "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n" + "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n" + "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n" + "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n" + "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n" + "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n" + "CPE510(TP-LINK|UN|N300-5):2.0\r\n" + "CPE510(TP-LINK|EU|N300-5):2.0\r\n" + "CPE510(TP-LINK|US|N300-5):2.0\r\n", .support_trail = '\xff', .soft_ver = NULL, @@ -463,6 +473,46 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system", }, + /** Firmware layout for the C59v2 */ + { + .id = "ARCHER-C59-V2", + .vendor = "", + .support_list = + "SupportList:\r\n" + "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n" + "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n" + "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n", + .support_trail = '\x00', + .soft_ver = "soft_ver:2.0.0 Build 20161206 rel.7303\n", + + /** We're using a dynamic kernel/rootfs split here */ + .partitions = { + {"factory-boot", 0x00000, 0x20000}, + {"fs-uboot", 0x20000, 0x10000}, + {"default-mac", 0x30000, 0x00200}, + {"pin", 0x30200, 0x00200}, + {"device-id", 0x30400, 0x00100}, + {"product-info", 0x30500, 0x0fb00}, + {"firmware", 0x40000, 0xe10000}, + {"partition-table", 0xe50000, 0x10000}, + {"soft-version", 0xe60000, 0x10000}, + {"support-list", 0xe70000, 0x10000}, + {"profile", 0xe80000, 0x10000}, + {"default-config", 0xe90000, 0x10000}, + {"user-config", 0xea0000, 0x40000}, + {"usb-config", 0xee0000, 0x10000}, + {"certificate", 0xef0000, 0x10000}, + {"extra-para", 0xf00000, 0x10000}, + {"qos-db", 0xf10000, 0x30000}, + {"log", 0xfe0000, 0x10000}, + {"radio", 0xff0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system", + }, + /** Firmware layout for the C60v1 */ { .id = "ARCHER-C60-V1", @@ -860,15 +910,10 @@ static struct device_info boards[] = { .support_trail = '\x00', .soft_ver = NULL, - /** - We use a bigger os-image partition than the stock images (and thus - smaller file-system), as our kernel doesn't fit in the stock firmware's - 1MB os-image. - */ + /* We're using a dynamic kernel/rootfs split here */ .partitions = { {"fs-uboot", 0x00000, 0x20000}, - {"os-image", 0x20000, 0x180000}, - {"file-system", 0x1a0000, 0xdb0000}, + {"firmware", 0x20000, 0xf30000}, {"default-mac", 0xf50000, 0x00200}, {"pin", 0xf50200, 0x00200}, {"product-info", 0xf50400, 0x0fc00}, @@ -977,14 +1022,10 @@ static struct device_info boards[] = { .support_trail = '\x00', .soft_ver = NULL, - /** - The original os-image partition is too small, - so we enlarge it to 1.75M - */ + /** We're using a dynamic kernel/rootfs split here */ .partitions = { {"fs-uboot", 0x00000, 0x20000}, - {"os-image", 0x20000, 0x1c0000}, - {"file-system", 0x1e0000, 0x420000}, + {"firmware", 0x20000, 0x5e0000}, {"partition-table", 0x600000, 0x02000}, {"default-mac", 0x610000, 0x00020}, {"pin", 0x610100, 0x00020}, @@ -1088,6 +1129,46 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system" }, + /** Firmware layout for the RE450 v2 */ + { + .id = "RE450-V2", + .vendor = "", + .support_list = + "SupportList:\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n" + "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n", + .support_trail = '\x00', + .soft_ver = NULL, + + /* We're using a dynamic kernel/rootfs split here */ + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"firmware", 0x20000, 0x5e0000}, + {"partition-table", 0x600000, 0x02000}, + {"default-mac", 0x610000, 0x00020}, + {"pin", 0x610100, 0x00020}, + {"product-info", 0x611100, 0x01000}, + {"soft-version", 0x620000, 0x01000}, + {"support-list", 0x621000, 0x01000}, + {"profile", 0x622000, 0x08000}, + {"user-config", 0x630000, 0x10000}, + {"default-config", 0x640000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + {} }; @@ -1223,7 +1304,7 @@ static struct image_partition_entry make_soft_version_from_string(const char *so } /** Generates the support-list partition */ -static struct image_partition_entry make_support_list(const struct device_info *info) { +static struct image_partition_entry make_support_list(struct device_info *info) { size_t len = strlen(info->support_list); struct image_partition_entry entry = alloc_image_partition("support-list", len + 9); @@ -1236,7 +1317,7 @@ static struct image_partition_entry make_support_list(const struct device_info * } /** Creates a new image partition with an arbitrary name from a file */ -static struct image_partition_entry read_file(const char *part_name, const char *filename, bool add_jffs2_eof) { +static struct image_partition_entry read_file(const char *part_name, const char *filename, bool add_jffs2_eof, struct flash_partition_entry *file_system_partition) { struct stat statbuf; if (stat(filename, &statbuf) < 0) @@ -1245,7 +1326,10 @@ static struct image_partition_entry read_file(const char *part_name, const char size_t len = statbuf.st_size; if (add_jffs2_eof) - len = ALIGN(len, 0x10000) + sizeof(jffs2_eof_mark); + if (file_system_partition) + len = ALIGN(len + file_system_partition->base, 0x10000) + sizeof(jffs2_eof_mark) - file_system_partition->base; + else + len = ALIGN(len, 0x10000) + sizeof(jffs2_eof_mark); struct image_partition_entry entry = alloc_image_partition(part_name, len); @@ -1361,7 +1445,7 @@ static void put_md5(uint8_t *md5, uint8_t *buffer, unsigned int len) { 1014-1813 Image partition table (2048 bytes, padded with 0xff) 1814-xxxx Firmware partitions */ -static void * generate_factory_image(const struct device_info *info, const struct image_partition_entry *parts, size_t *len) { +static void * generate_factory_image(struct device_info *info, const struct image_partition_entry *parts, size_t *len) { *len = 0x1814; size_t i; @@ -1394,7 +1478,7 @@ static void * generate_factory_image(const struct device_info *info, const struc should be generalized when TP-LINK starts building its safeloader into hardware with different flash layouts. */ -static void * generate_sysupgrade_image(const struct device_info *info, const struct image_partition_entry *image_parts, size_t *len) { +static void * generate_sysupgrade_image(struct device_info *info, const struct image_partition_entry *image_parts, size_t *len) { size_t i, j; size_t flash_first_partition_index = 0; size_t flash_last_partition_index = 0; @@ -1457,10 +1541,53 @@ static void build_image(const char *output, uint32_t rev, bool add_jffs2_eof, bool sysupgrade, - const struct device_info *info) { + struct device_info *info) { + + size_t i; struct image_partition_entry parts[7] = {}; + struct flash_partition_entry *firmware_partition = NULL; + struct flash_partition_entry *os_image_partition = NULL; + struct flash_partition_entry *file_system_partition = NULL; + size_t firmware_partition_index = 0; + + for (i = 0; info->partitions[i].name; i++) { + if (!strcmp(info->partitions[i].name, "firmware")) + { + firmware_partition = &info->partitions[i]; + firmware_partition_index = i; + } + } + + if (firmware_partition) + { + os_image_partition = &info->partitions[firmware_partition_index]; + file_system_partition = &info->partitions[firmware_partition_index + 1]; + + struct stat kernel; + if (stat(kernel_image, &kernel) < 0) + error(1, errno, "unable to stat file `%s'", kernel_image); + + if (kernel.st_size > firmware_partition->size) + error(1, 0, "kernel overflowed firmware partition\n"); + + for (i = MAX_PARTITIONS-1; i >= firmware_partition_index + 1; i--) + info->partitions[i+1] = info->partitions[i]; + + file_system_partition->name = "file-system"; + file_system_partition->base = firmware_partition->base + kernel.st_size; + + /* Align partition start to erase blocks for factory images only */ + if (!sysupgrade) + file_system_partition->base = ALIGN(firmware_partition->base + kernel.st_size, 0x10000); + + file_system_partition->size = firmware_partition->size - file_system_partition->base; + + os_image_partition->name = "os-image"; + os_image_partition->size = kernel.st_size; + } + parts[0] = make_partition_table(info->partitions); if (info->soft_ver) parts[1] = make_soft_version_from_string(info->soft_ver); @@ -1468,11 +1595,12 @@ static void build_image(const char *output, parts[1] = make_soft_version(rev); parts[2] = make_support_list(info); - parts[3] = read_file("os-image", kernel_image, false); - parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); + parts[3] = read_file("os-image", kernel_image, false, NULL); + parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, file_system_partition); /* Some devices need the extra-para partition to accept the firmware */ if (strcasecmp(info->id, "ARCHER-C25-V1") == 0 || + strcasecmp(info->id, "ARCHER-C59-V2") == 0 || strcasecmp(info->id, "ARCHER-C60-V2") == 0 || strcasecmp(info->id, "TLWR1043NV5") == 0) { const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}; @@ -1500,7 +1628,6 @@ static void build_image(const char *output, free(image); - size_t i; for (i = 0; parts[i].name; i++) free_image_partition(parts[i]); } @@ -1530,7 +1657,7 @@ static void usage(const char *argv0) { }; -static const struct device_info *find_board(const char *id) +static struct device_info *find_board(const char *id) { struct device_info *board = NULL; @@ -1562,6 +1689,10 @@ static int add_flash_partition( } part_list->name = calloc(1, strlen(name) + 1); + if (!part_list->name) { + error(1, 0, "Unable to allocate memory"); + } + memcpy((char *)part_list->name, name, strlen(name)); part_list->base = base; part_list->size = size; @@ -1860,7 +1991,7 @@ int main(int argc, char *argv[]) { const char *extract_image = NULL, *output_directory = NULL, *convert_image = NULL; bool add_jffs2_eof = false, sysupgrade = false; unsigned rev = 0; - const struct device_info *info; + struct device_info *info; set_source_date_epoch(); while (true) { diff --git a/tools/kernel2minor/Makefile b/tools/kernel2minor/Makefile index 3e7d5147d..be730b4df 100644 --- a/tools/kernel2minor/Makefile +++ b/tools/kernel2minor/Makefile @@ -7,12 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=kernel2minor -PKG_VERSION:=0.24 -PKG_RELEASE:=3 +PKG_VERSION:=0.25 +PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/adron-s/kernel2minor.git +PKG_MIRROR_HASH:=6083c46c2fe0da37bacd04d5d5439c0e2a9d00e58ff47a63acfd5057d2aa2145 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=2cacb4dec6673a60a972a3a7f7629464a26a8492 +PKG_SOURCE_VERSION:=1e5a52c7941945f6d64807ebca4a5923ba5466bd PKG_HASH:=33ca413403a3341af0c9a8e6d9bb58f4ad080a5339e8a8729b83637d35bfaf1b include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/sdimage/Makefile b/tools/sdimage/Makefile index f2b82ca00..44d671414 100644 --- a/tools/sdimage/Makefile +++ b/tools/sdimage/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/mhei/fsl-imx-uuc.git -PKG_SOURCE_DATE:=2015-09-13 -PKG_SOURCE_VERSION:=2b99403b6dc60a22b07eb7a5cc0cb184abb89bdd -PKG_MIRROR_HASH:=b0edd55674cd60268c9b293b47df17db319fd58bd78fdbf26e77039f1a6cf681 +PKG_SOURCE_DATE:=2016-01-10 +PKG_SOURCE_VERSION:=d395b310b6c0f41ab1302242a639e7d0d7767207 +PKG_MIRROR_HASH:=d67ec9d509201511bc7cba9f7551baa729361817f97390f7c5cbb99b5a7b89b1 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=LICENSE diff --git a/tools/sparse/Makefile b/tools/sparse/Makefile index 2e8ad7c45..959016b13 100644 --- a/tools/sparse/Makefile +++ b/tools/sparse/Makefile @@ -6,11 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sparse -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/sparse/sparse.git -PKG_SOURCE_DATE:=2017-03-31 -PKG_SOURCE_VERSION:=14964df5373292af78b29529d4fc7e1a26b67a97 -PKG_MIRROR_HASH:=90110e8a4d7db099ea79dd3b99a12135e24580d81b8662bd9a86e9f81bce9df7 +PKG_VERSION:=0.5.2 +PKG_HASH:=4632b7b74af72214247f982f976ba44206933bab3a2717e09df166fb5b8abe7a +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/software/devel/sparse/dist/ PKG_BUILD_PARALLEL:=1