From 71a6d1298d2facc6fe909e934da9fee9daf5f271 Mon Sep 17 00:00:00 2001 From: RISCi_ATOM Date: Fri, 13 Jan 2017 05:17:15 -0500 Subject: [PATCH] Fresh pull from upstream --- Makefile | 6 + config/Config-build.in | 53 - config/Config-images.in | 3 +- config/Config-kernel.in | 22 + include/depends.mk | 2 +- include/download.mk | 132 +- include/host-build.mk | 39 +- include/image-commands.mk | 5 + include/image-legacy.mk | 6 +- include/image.mk | 16 +- include/kernel-build.mk | 2 +- include/kernel-defaults.mk | 2 +- include/kernel-version.mk | 12 +- include/kernel.mk | 11 +- include/netfilter.mk | 5 +- include/package-ipkg.mk | 9 + include/package.mk | 46 +- include/prereq-build.mk | 21 +- include/quilt.mk | 3 +- include/scan.mk | 4 +- include/shell.sh | 22 - include/subdir.mk | 2 +- include/toplevel.mk | 5 +- include/unpack.mk | 9 +- include/version.mk | 2 +- package/Makefile | 36 +- package/base-files/Makefile | 2 +- package/base-files/files/bin/config_generate | 2 +- package/base-files/files/etc/profile | 2 +- package/base-files/files/lib/functions.sh | 5 + .../base-files/files/lib/upgrade/common.sh | 93 +- package/base-files/image-config.in | 58 +- package/devel/binutils/Makefile | 2 +- package/devel/gdb-arc/Makefile | 2 +- package/devel/gdb/Makefile | 2 +- .../gdb/patches/002-remove-arguments.patch | 16 - package/devel/strace/Makefile | 4 +- ...00-workaround--pt-reg-collisions-ppc.patch | 4 +- package/devel/trace-cmd/Makefile | 4 +- package/devel/valgrind/Makefile | 2 +- package/kernel/hwmon-gsc/Makefile | 30 + package/kernel/hwmon-gsc/src/Makefile | 1 + package/kernel/hwmon-gsc/src/gsc.c | 308 + package/kernel/kmod-sched-cake/Makefile | 12 +- package/kernel/linux/Makefile | 3 +- package/kernel/linux/modules/block.mk | 19 - package/kernel/linux/modules/crypto.mk | 112 +- package/kernel/linux/modules/fs.mk | 6 +- package/kernel/linux/modules/hwmon.mk | 33 +- package/kernel/linux/modules/i2c.mk | 47 - package/kernel/linux/modules/lib.mk | 26 +- package/kernel/linux/modules/netdevices.mk | 84 +- package/kernel/linux/modules/netfilter.mk | 22 + package/kernel/linux/modules/other.mk | 141 +- package/kernel/linux/modules/pcmcia.mk | 55 +- package/kernel/linux/modules/spi.mk | 17 - package/kernel/linux/modules/usb.mk | 238 +- package/kernel/linux/modules/w1.mk | 2 +- package/kernel/mac80211/Makefile | 105 +- .../files/lib/netifd/wireless/mac80211.sh | 37 +- .../004-fix_duplicate_skcipher_backport.patch | 2 +- ..._hw-issue-external-reset-for-QCA955x.patch | 5 +- ...hw_gpio_get-to-return-0-or-1-on-succ.patch | 2 +- ...unlock-rcu-read-when-returning-early.patch | 65 + ...l_ht-move-supported-bitrate-mask-out.patch | 196 + ...l_ht-move-short-preamble-check-out-o.patch | 70 + ...l_ht-make-att_hist-and-succ_hist-u32.patch | 22 + ...or-MCS-in-ieee80211_duration-before-.patch | 34 + ...instrel-remove-cur_prob-from-debugfs.patch | 192 + ...80211-minstrel-reduce-MINSTREL_SCALE.patch | 22 + ...l-store-probability-variance-instead.patch | 186 + ...el-make-prob_ewma-u16-instead-of-u32.patch | 20 + ...l_ht-remove-obsolete-if-for-3-stream.patch | 80 + ...g80211-limit-scan-results-cache-size.patch | 150 + ...-warning-on-drv_set_key-with-unsuppo.patch | 23 + ...unction-checking-range-fit-to-util.c.patch | 101 + ...ort-ieee80211-freq-limit-DT-property.patch | 211 + ...periodic-and-nf-calibation-at-the-sa.patch | 26 + .../patches/400-ath_move_debug_code.patch | 5 +- .../patches/401-ath9k_blink_default.patch | 2 +- .../410-ath9k_allow_adhoc_and_ap.patch | 2 +- .../mac80211/patches/501-ath9k_ahb_init.patch | 2 +- .../patches/530-ath9k_extra_leds.patch | 2 +- .../patches/541-ath9k_rx_dma_stop_check.patch | 28 - .../patches/542-ath9k_debugfs_diag.patch | 4 +- .../patches/543-ath9k_entropy_from_adc.patch | 6 +- ...544-ath9k-ar933x-usb-hang-workaround.patch | 8 +- ...-EEPROM-fields-in-Little-Endian-form.patch | 50 +- package/kernel/mmc_over_gpio/Makefile | 77 - .../mmc_over_gpio/files/mmc_over_gpio.config | 8 - .../mmc_over_gpio/files/mmc_over_gpio.init | 83 - package/kernel/rtc-rv5c386a/Makefile | 33 + package/kernel/rtc-rv5c386a/src/Makefile | 18 + package/kernel/rtc-rv5c386a/src/rtc.c | 613 ++ package/libs/argp-standalone/Makefile | 2 +- package/libs/cyassl/Makefile | 7 +- package/libs/elfutils/Makefile | 8 +- .../elfutils/patches/004-memcpy_def.patch | 14 - .../elfutils/patches/006-libdw_LIBS.patch | 2 +- .../patches/007-fix_TEMP_FAILURE_RETRY.patch | 92 + .../elfutils/patches/100-musl-compat.patch | 281 +- .../libs/elfutils/patches/101-no-fts.patch | 4 +- package/libs/gettext-full/Makefile | 13 +- package/libs/gettext/Makefile | 8 +- package/libs/gmp/Makefile | 4 +- package/libs/libbsd/Makefile | 2 +- package/libs/libconfig/Makefile | 2 +- package/libs/libevent2/Makefile | 2 +- package/libs/libiconv-full/Makefile | 2 +- package/libs/libiconv/Makefile | 12 +- package/libs/libjson-c/Makefile | 2 +- package/libs/libmnl/Makefile | 2 +- package/libs/libnetfilter-conntrack/Makefile | 2 +- package/libs/libnetfilter-cthelper/Makefile | 2 +- package/libs/libnetfilter-cttimeout/Makefile | 2 +- package/libs/libnetfilter-log/Makefile | 2 +- package/libs/libnetfilter-queue/Makefile | 5 +- package/libs/libnfnetlink/Makefile | 2 +- package/libs/libnftnl/Makefile | 4 +- .../libnl-tiny/src/include/netlink-local.h | 2 + package/libs/libnl/Makefile | 6 +- 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 | 61 +- .../102-makefile_disable_manpages.patch | 4 +- .../103-makefile_flex_workaround.patch | 6 +- .../patches/201-space_optimization.patch | 137 +- .../libpcap/patches/202-protocol_api.patch | 56 +- .../patches/203-undef_iw_mode_monitor.patch | 2 +- .../libpcap/patches/204-usb-bus-path.patch | 13 + package/libs/libreadline/Makefile | 2 +- package/libs/libroxml/Makefile | 2 +- package/libs/librpc/Makefile | 8 +- package/libs/libtool/Makefile | 4 +- package/libs/libubox/Makefile | 8 +- package/libs/libunwind/Makefile | 2 +- package/libs/libusb-compat/Makefile | 2 +- package/libs/libusb/Makefile | 4 +- package/libs/lzo/Makefile | 2 +- package/libs/mbedtls/Makefile | 4 +- package/libs/mbedtls/patches/200-config.patch | 163 +- package/libs/ncurses/Makefile | 22 +- .../100-ncurses-5.6-20080112-urxvt.patch | 6 +- .../101-ncurses-5.6-20080628-kbs.patch | 32 +- .../patches/102-ncurses-5.9-gcc-5.patch | 2 +- .../103-fixup-pkg-config-handling.patch | 85 - package/libs/ncurses/patches/500-cross.patch | 8 +- .../libs/ncurses/patches/900-terminfo.patch | 2 +- package/libs/nettle/Makefile | 2 +- package/libs/openssl/Makefile | 2 +- package/libs/polarssl/Makefile | 2 +- package/libs/popt/Makefile | 2 +- package/libs/sysfsutils/Makefile | 2 +- package/libs/uclibc++/Makefile | 2 +- package/libs/uclient/Makefile | 10 +- package/libs/ustream-ssl/Makefile | 23 +- package/libs/zlib/Makefile | 6 +- package/luci/.buildpath | 5 + package/luci/.cproject | 221 + package/luci/.gitignore | 8 + package/luci/.project | 78 + package/luci/README.md | 34 + .../luasrc/model/cbi/adblock.lua | 60 +- .../luci-app-adblock/po/ja/adblock.po | 112 +- .../luci-app-adblock/po/sv/adblock.po | 63 +- .../luci-app-adblock/po/templates/adblock.pot | 54 +- .../luci-app-adblock/po/zh-cn/adblock.po | 89 +- .../luci-app-commands/po/ja/commands.po | 17 +- .../luasrc/model/cbi/firewall/custom.lua | 4 + .../luci-app-firewall/po/ca/firewall.po | 3 + .../luci-app-firewall/po/cs/firewall.po | 3 + .../luci-app-firewall/po/de/firewall.po | 3 + .../luci-app-firewall/po/el/firewall.po | 3 + .../luci-app-firewall/po/en/firewall.po | 3 + .../luci-app-firewall/po/es/firewall.po | 3 + .../luci-app-firewall/po/fr/firewall.po | 3 + .../luci-app-firewall/po/he/firewall.po | 3 + .../luci-app-firewall/po/hu/firewall.po | 3 + .../luci-app-firewall/po/it/firewall.po | 14 +- .../luci-app-firewall/po/ja/firewall.po | 56 +- .../luci-app-firewall/po/ms/firewall.po | 3 + .../luci-app-firewall/po/no/firewall.po | 3 + .../luci-app-firewall/po/pl/firewall.po | 3 + .../luci-app-firewall/po/pt-br/firewall.po | 3 + .../luci-app-firewall/po/pt/firewall.po | 3 + .../luci-app-firewall/po/ro/firewall.po | 3 + .../luci-app-firewall/po/ru/firewall.po | 3 + .../luci-app-firewall/po/sk/firewall.po | 3 + .../luci-app-firewall/po/sv/firewall.po | 3 + .../po/templates/firewall.pot | 3 + .../luci-app-firewall/po/tr/firewall.po | 3 + .../luci-app-firewall/po/uk/firewall.po | 3 + .../luci-app-firewall/po/vi/firewall.po | 3 + .../luci-app-firewall/po/zh-cn/firewall.po | 3 + .../luci-app-firewall/po/zh-tw/firewall.po | 3 + .../luasrc/model/cbi/fwknopd.lua | 14 +- .../luasrc/view/fwknopd-qr.htm | 3 +- .../luci-app-fwknopd/po/en/fwknopd.po | 15 +- .../luci-app-fwknopd/po/templates/fwknopd.pot | 9 +- .../root/etc/uci-defaults/40_luci-fwknopd | 1 + .../luci-app-fwknopd/root/usr/sbin/gen-qr.sh | 12 +- .../po/ja/mjpg-streamer.po | 171 + .../luci-app-olsr/luasrc/controller/olsr.lua | 8 +- .../luasrc/view/status-olsr/neighbors.htm | 8 +- .../luci-app-p910nd/po/ja/p910nd.po | 14 +- .../luci-app-privoxy/po/zh-cn/privoxy.po | 127 +- .../applications/luci-app-qos/po/ja/qos.po | 14 +- .../luci-app-shairplay/po/ja/shairplay.po | 54 + .../po/templates/shairplay.pot | 40 + .../statistics/rrdtool/definitions/df.lua | 1 - .../luci-app-statistics/po/ja/statistics.po | 289 +- .../luci-app-travelmate/po/ja/travelmate.po | 72 + .../luci-app-uhttpd/po/ja/uhttpd.po | 213 + .../luci-app-uhttpd/po/templates/uhttpd.pot | 186 + .../applications/luci-app-upnp/po/ja/upnp.po | 20 +- .../controller/wifischedule/wifi_schedule.lua | 28 +- .../model/cbi/wifischedule/wifi_schedule.lua | 96 +- .../po/ja/wifischedule.po | 112 + .../po/templates/wifischedule.pot | 101 + .../po/zh-cn/wifischedule.po | 101 + .../collections/luci-ssl-openssl/Makefile | 4 +- package/luci/collections/luci-ssl/Makefile | 4 +- .../files/etc/config/profile_berlin | 1 + package/luci/luci.mk | 1 + package/luci/modules/luci-base/Makefile | 4 +- .../luci-base/luasrc/sys/iptparser.lua | 36 +- .../luci-base/luasrc/tools/webadmin.lua | 2 +- package/luci/modules/luci-base/po/ca/base.po | 18 +- package/luci/modules/luci-base/po/cs/base.po | 26 +- package/luci/modules/luci-base/po/de/base.po | 18 +- package/luci/modules/luci-base/po/el/base.po | 18 +- package/luci/modules/luci-base/po/en/base.po | 18 +- package/luci/modules/luci-base/po/es/base.po | 18 +- package/luci/modules/luci-base/po/fr/base.po | 30 +- package/luci/modules/luci-base/po/he/base.po | 22 +- package/luci/modules/luci-base/po/hu/base.po | 21 +- package/luci/modules/luci-base/po/it/base.po | 24 +- package/luci/modules/luci-base/po/ja/base.po | 18 +- package/luci/modules/luci-base/po/ko/base.po | 3718 ++++++++++++ package/luci/modules/luci-base/po/ms/base.po | 18 +- package/luci/modules/luci-base/po/no/base.po | 22 +- package/luci/modules/luci-base/po/pl/base.po | 24 +- .../luci/modules/luci-base/po/pt-br/base.po | 22 +- package/luci/modules/luci-base/po/pt/base.po | 18 +- package/luci/modules/luci-base/po/ro/base.po | 18 +- package/luci/modules/luci-base/po/ru/base.po | 22 +- package/luci/modules/luci-base/po/sk/base.po | 18 +- package/luci/modules/luci-base/po/sv/base.po | 18 +- .../modules/luci-base/po/templates/base.pot | 18 +- package/luci/modules/luci-base/po/tr/base.po | 18 +- package/luci/modules/luci-base/po/uk/base.po | 28 +- package/luci/modules/luci-base/po/vi/base.po | 18 +- .../luci/modules/luci-base/po/zh-cn/base.po | 614 +- .../luci/modules/luci-base/po/zh-tw/base.po | 26 +- .../luci/modules/luci-base/src/mkversion.sh | 2 +- .../model/cbi/admin_network/wifi_add.lua | 2 +- .../luci/protocols/luci-proto-qmi/Makefile | 14 + .../model/cbi/admin_network/proto_qmi.lua | 45 + .../luasrc/model/network/proto_qmi.lua | 51 + .../htdocs/luci-static/bootstrap/cascade.css | 2 + package/network/config/firewall/Makefile | 10 +- package/network/config/gre/Makefile | 10 +- package/network/config/gre/files/gre.sh | 28 +- package/network/config/netifd/Makefile | 10 +- package/network/config/soloscli/Makefile | 2 +- package/network/config/swconfig/Makefile | 3 +- package/network/config/swconfig/src/Makefile | 7 +- package/network/config/vti/Makefile | 8 + package/network/ipv6/map/src/CMakeLists.txt | 3 + package/network/ipv6/odhcp6c/Makefile | 14 +- .../network/ipv6/odhcp6c/files/dhcpv6.script | 2 +- package/network/ipv6/odhcp6c/files/dhcpv6.sh | 7 +- package/network/ipv6/thc-ipv6/Makefile | 2 +- package/network/services/authsae/Makefile | 8 +- package/network/services/dnsmasq/Makefile | 4 +- .../services/dnsmasq/files/dnsmasq.init | 87 +- package/network/services/dropbear/Makefile | 8 +- .../patches/500-set-default-path.patch | 12 - package/network/services/hostapd/Config.in | 4 + package/network/services/hostapd/Makefile | 41 +- .../network/services/hostapd/files/netifd.sh | 35 +- ...connecting-client-on-connection-lost.patch | 25 - .../hostapd/patches/100-daemonize_fix.patch | 4 +- .../hostapd/patches/110-no_eapol_fix.patch | 2 +- ...emove-duplicated-check-in-nl80211_se.patch | 39 - .../hostapd/patches/200-multicall.patch | 50 +- .../services/hostapd/patches/300-noscan.patch | 4 +- .../patches/310-rescan_immediately.patch | 2 +- .../hostapd/patches/320-optional_rfkill.patch | 8 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 12 +- .../patches/360-ctrl_iface_reload.patch | 4 +- .../hostapd/patches/370-ap_sta_support.patch | 14 +- .../patches/380-disable_ctrl_iface_mib.patch | 36 +- .../patches/390-wpa_ie_cap_workaround.patch | 4 +- .../patches/430-hostapd_cli_ifdef.patch | 8 +- ...dd-new-config-params-to-be-used-with.patch | 14 +- ...-use-new-parameters-during-ibss-join.patch | 4 +- .../462-wpa_s-support-htmode-param.patch | 12 +- .../hostapd/patches/600-ubus_support.patch | 35 +- package/network/services/igmpproxy/Makefile | 2 +- package/network/services/ipset-dns/Makefile | 8 +- package/network/services/lldpd/Config.in | 4 + package/network/services/lldpd/Makefile | 12 +- .../network/services/lldpd/files/lldpd.config | 2 + .../network/services/lldpd/files/lldpd.init | 3 + package/network/services/mdns/Makefile | 10 +- package/network/services/odhcpd/Makefile | 10 +- .../services/odhcpd/files/odhcpd-update | 7 +- .../network/services/odhcpd/files/odhcpd.init | 2 +- package/network/services/omcproxy/Makefile | 6 +- .../services/openvpn-easy-rsa/Makefile | 9 +- .../{Config-polarssl.in => Config-mbedtls.in} | 36 +- .../network/services/openvpn/Config-nossl.in | 4 + .../services/openvpn/Config-openssl.in | 4 + package/network/services/openvpn/Makefile | 22 +- .../services/openvpn/files/openvpn.config | 11 +- .../services/openvpn/files/openvpn.init | 3 +- .../001-reproducible-remove_DATE.patch | 8 +- ...bedtls-disable-runtime-version-check.patch | 11 + ...larssl-disable-runtime-version-check.patch | 11 - ...ackport_upstream_polarssl_debug_call.patch | 33 - .../patches/200-small_build_enable_occ.patch | 2 +- .../210-build_always_use_internal_lz4.patch | 41 + .../openvpn/patches/220-disable_des.patch | 81 + package/network/services/ppp/Makefile | 5 +- package/network/services/relayd/Makefile | 10 +- .../services/relayd/files/relay.hotplug | 2 - .../network/services/relayd/files/relay.init | 4 +- package/network/services/samba36/Makefile | 2 +- package/network/services/uhttpd/Makefile | 47 +- package/network/utils/arptables/Makefile | 6 +- package/network/utils/comgt/Makefile | 4 +- package/network/utils/comgt/files/3g.sh | 2 + package/network/utils/comgt/files/directip.sh | 1 + .../utils/comgt/files/getcardinfo.gcom | 2 +- package/network/utils/comgt/files/ncm.json | 26 +- package/network/utils/comgt/files/ncm.sh | 79 +- .../network/utils/conntrack-tools/Makefile | 2 +- package/network/utils/curl/Config.in | 5 +- package/network/utils/curl/Makefile | 10 +- ...bedtls-disable-runtime-version-check.patch | 11 + ...larssl-disable-runtime-version-check.patch | 22 - package/network/utils/dante/Makefile | 2 +- package/network/utils/ebtables/Makefile | 2 +- package/network/utils/iftop/Makefile | 2 +- package/network/utils/iperf/Makefile | 2 +- package/network/utils/iperf3/Makefile | 2 +- package/network/utils/iproute2/Makefile | 4 +- .../iproute2/patches/950-add-cake-to-tc.patch | 136 +- package/network/utils/ipset/Makefile | 2 +- package/network/utils/iptables/Makefile | 4 +- .../patches/500-add-xt_id-match.patch | 69 - package/network/utils/iputils/Makefile | 2 +- package/network/utils/iw/Makefile | 2 +- package/network/utils/iwinfo/Makefile | 12 +- package/network/utils/linux-atm/Makefile | 2 +- package/network/utils/nftables/Makefile | 4 +- package/network/utils/tcpdump/Makefile | 10 +- .../patches/001-remove_pcap_debug.patch | 119 +- .../002-remove_static_libpcap_check.patch | 69 +- .../tcpdump/patches/100-tcpdump_mini.patch | 1088 ++-- package/network/utils/umbim/Makefile | 8 +- package/network/utils/uqmi/Makefile | 10 +- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 188 +- package/network/utils/wireless-tools/Makefile | 2 +- package/network/utils/wpan-tools/Makefile | 2 +- package/network/utils/xtables-addons/Makefile | 2 +- package/system/ca-certificates/Makefile | 4 +- package/system/fstools/Makefile | 11 +- package/system/lede-keyring/Makefile | 9 +- package/system/mountd/Makefile | 11 +- package/system/opkg/Makefile | 82 +- .../opkg/patches/070-use_external_gzip.patch | 719 +++ ...t.patch => 071-use_gzipped_pkg_list.patch} | 46 +- .../patches/220-drop-release-support.patch | 2 +- package/system/procd/Makefile | 13 +- package/system/procd/files/nand.sh | 11 +- package/system/procd/files/procd.sh | 20 +- package/system/rpcd/Makefile | 11 +- package/system/ubox/Makefile | 8 +- package/system/ubus/Makefile | 8 +- package/system/uci/Makefile | 12 +- package/system/usign/Makefile | 8 +- package/utils/adb/Makefile | 52 + .../adb/patches/001-create_Makefile.patch | 45 + package/utils/admswconfig/Makefile | 2 +- package/utils/bsdiff/Makefile | 8 +- package/utils/busybox/Makefile | 4 +- package/utils/bzip2/Makefile | 8 +- package/utils/ct-bugcheck/Makefile | 52 + package/utils/ct-bugcheck/src/bugcheck.initd | 16 + package/utils/ct-bugcheck/src/bugcheck.sh | 115 + package/utils/ct-bugcheck/src/bugchecker.sh | 29 + package/utils/e2fsprogs/Makefile | 2 +- package/utils/f2fs-tools/Makefile | 2 +- package/utils/fuse/Makefile | 2 +- package/utils/jsonfilter/Makefile | 8 +- package/utils/lua/Makefile | 6 +- package/utils/mdadm/Makefile | 2 +- package/utils/mtd-utils/Makefile | 9 +- package/utils/px5g-standalone/Makefile | 1 + package/utils/px5g/Makefile | 25 +- package/utils/px5g/px5g.c | 71 +- package/utils/ugps/Makefile | 8 +- package/utils/usbmode/Makefile | 10 +- package/utils/usbutils/Makefile | 17 +- package/utils/util-linux/Makefile | 2 +- package/utils/xfsprogs/Makefile | 2 +- rules.mk | 12 +- scripts/bundle-libraries.sh | 102 +- scripts/combined-ext-image.sh | 2 +- scripts/combined-image.sh | 2 +- scripts/download.pl | 41 +- scripts/fixup-makefile.pl | 135 + scripts/getver.sh | 2 +- scripts/ipkg-make-index.sh | 5 +- scripts/mkhash.c | 827 +++ scripts/om-fwupgradecfg-gen.sh | 10 +- scripts/update-package-md5sum | 38 - target/imagebuilder/Makefile | 12 +- .../ar71xx/base-files/etc/board.d/01_leds | 27 +- .../ar71xx/base-files/etc/board.d/02_network | 25 +- .../base-files/etc/board.d/03_gpio_switches | 4 +- target/linux/ar71xx/base-files/etc/diag.sh | 11 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 131 + .../uci-defaults/03_network-switchX-migration | 2 - target/linux/ar71xx/base-files/lib/ar71xx.sh | 62 +- .../lib/preinit/05_set_preinit_iface_ar71xx | 2 +- .../base-files/lib/preinit/82_patch_ath10k | 54 + .../ar71xx/base-files/lib/upgrade/platform.sh | 15 +- target/linux/ar71xx/config-4.4 | 12 +- .../files/arch/mips/ath79/Kconfig.openwrt | 90 +- .../ar71xx/files/arch/mips/ath79/Makefile | 9 +- .../ar71xx/files/arch/mips/ath79/dev-m25p80.c | 25 - .../ar71xx/files/arch/mips/ath79/dev-m25p80.h | 1 - .../files/arch/mips/ath79/mach-alfa-ap96.c | 19 - .../ar71xx/files/arch/mips/ath79/mach-ap113.c | 84 - .../ar71xx/files/arch/mips/ath79/mach-ap83.c | 275 - .../ar71xx/files/arch/mips/ath79/mach-c55.c | 2 +- .../ar71xx/files/arch/mips/ath79/mach-c60.c | 2 +- .../files/arch/mips/ath79/mach-cpe510.c | 59 +- .../files/arch/mips/ath79/mach-e2100l.c | 126 + .../files/arch/mips/ath79/mach-gl-ar300m.c | 16 - .../ar71xx/files/arch/mips/ath79/mach-pb92.c | 70 - .../ar71xx/files/arch/mips/ath79/mach-rb91x.c | 19 +- .../ar71xx/files/arch/mips/ath79/mach-re450.c | 187 + .../files/arch/mips/ath79/mach-sr3200.c | 187 + .../arch/mips/ath79/mach-tl-wr1043nd-v4.c | 190 + .../files/arch/mips/ath79/mach-tl-wr940n-v4.c | 149 + .../files/arch/mips/ath79/mach-wnr2000.c | 45 +- .../ar71xx/files/arch/mips/ath79/machtypes.h | 11 +- .../mips/include/asm/mach-ath79/rb4xx_cpld.h | 5 - .../files/drivers/mtd/nand/rb4xx_nand.c | 5 +- .../files/drivers/mtd/nand/rb750_nand.c | 1 + .../files/drivers/mtd/nand/rb91x_nand.c | 1 + .../linux/ar71xx/files/drivers/spi/spi-ap83.c | 283 - .../ar71xx/files/drivers/spi/spi-rb4xx-cpld.c | 107 +- .../ar71xx/files/drivers/spi/spi-rb4xx.c | 85 +- target/linux/ar71xx/files/net/dsa/mv88e6063.c | 294 - target/linux/ar71xx/image/Makefile | 1 + target/linux/ar71xx/image/generic.mk | 117 +- target/linux/ar71xx/image/legacy-devices.mk | 63 +- target/linux/ar71xx/image/legacy.mk | 13 +- target/linux/ar71xx/image/nand.mk | 16 + target/linux/ar71xx/image/tp-link.mk | 157 +- target/linux/ar71xx/image/ubnt.mk | 277 + target/linux/ar71xx/mikrotik/config-default | 7 +- target/linux/ar71xx/nand/config-default | 7 +- .../001-revert_spi_device_tree_support.patch | 83 - .../ar71xx/patches-4.4/001-spi-cs-gpio.patch | 20 + ...pport-multiple-internal-chip-select-.patch | 70 + ...e-gpio_set_value_cansleep-for-GPIO-c.patch | 19 + ...-make-chipselect-logic-more-flexible.patch | 199 - .../431-spi-add-various-flags.patch | 19 - .../434-spi-ap83_spi_controller.patch | 27 - .../patches-4.4/435-spi-vsc7385_driver.patch | 4 +- .../460-m25p80-spi-read-flash-check.patch | 15 + ...-spi-bitbang-export-spi_bitbang_bufs.patch | 28 - ...1-spi-add-type-field-to-spi_transfer.patch | 23 - .../461-spi-ath79-add-fast-flash-read.patch | 54 + ...462-mtd-m25p80-set-spi-transfer-type.patch | 15 - .../463-spi-ath79-add-fast-flash-read.patch | 185 - .../464-spi-ath79-fix-fast-flash-read.patch | 35 - ...-mac-argument-to-ath79_register_wmac.patch | 11 - ...MIPS-ath79-add-flash-acquire-release.patch | 37 - ...IPS-ath79-add-ath79_device_reset_get.patch | 14 +- .../604-MIPS-ath79-ap81-fixes.patch | 84 - .../605-MIPS-ath79-db120-fixes.patch | 2 +- .../606-MIPS-ath79-pb44-fixes.patch | 15 +- .../607-MIPS-ath79-ubnt-xm-fixes.patch | 2 +- ...8-MIPS-ath79-ubnt-xm-add-more-boards.patch | 2 +- ...IPS-ath79-ap83-remove-mtd-partitions.patch | 44 - ...PS-ath79-add-support-for-QCA953x-SoC.patch | 8 +- ...PS-ath79-add-support-for-QCA956x-SoC.patch | 10 +- ...40-MIPS-ath79-add-QCA955x-wmac-reset.patch | 2 +- .../700-MIPS-ath79-add-openwrt-Kconfig.patch | 2 +- .../910-unaligned_access_hacks.patch | 2 +- target/linux/generic/config-3.18 | 2 +- target/linux/generic/config-4.1 | 4821 ---------------- target/linux/generic/config-4.4 | 6 +- .../drivers/mtd/mtdsplit/mtdsplit_uimage.c | 2 + .../generic/files/drivers/net/phy/ar8216.c | 2 +- .../generic/files/fs/yaffs2/yaffs_mtdif.c | 2 +- .../linux/generic/files/fs/yaffs2/yaffs_vfs.c | 2 +- .../540-crypto-xz-decompression-support.patch | 146 - .../541-ubifs-xz-decompression-support.patch | 92 - .../615-netfilter_add_xt_id_match.patch | 95 - .../generic/patches-3.18/863-gpiommc.patch | 844 --- .../864-gpiommc_configfs_locking.patch | 58 - .../880-gateworks_system_controller.patch | 339 -- ...e-config.detected-into-OUTPUT-direct.patch | 54 - ...s-Fix-makefile-generation-under-dash.patch | 27 - .../patches-4.1/020-ssb-backport.patch | 686 --- .../generic/patches-4.1/021-ssb_sprom.patch | 32 - .../patches-4.1/022-bcma-from-4.2.patch | 86 - .../patches-4.1/023-bcma-from-4.4.patch | 26 - .../patches-4.1/024-bcma-from-4.5.patch | 49 - .../patches-4.1/025-bcma-from-4.6.patch | 716 --- .../030-backport_bcm47xx_nvram.patch | 37 - .../040-fs-overlay-fix-stacking.patch | 33 - ...nce-error-output-if-MS_SILENT-is-set.patch | 32 - ...ence-early-error-if-MS_SILENT-is-set.patch | 54 - .../050-backport_netfilter_rtcache.patch | 505 -- .../060-mips_decompressor_memmove.patch | 22 - ...fix-MAC-soft-reset-bit-for-corerev-4.patch | 24 - ...bgmac-reset-all-4-GMAC-cores-on-init.patch | 28 - ...ment-fix-headroom-tests-and-skb-leak.patch | 101 - ...ncrease-headroom-on-received-packets.patch | 54 - ...ore-Introduce-a-USB-port-LED-trigger.patch | 464 -- .../090-m25p80_spi-nor_update_to_4.4rc1.patch | 1129 ---- ...ility-of-linux-in.h-with-netinet-in..patch | 146 - ...ags-FOLL_WRITE-games-from-__get_user.patch | 90 - .../patches-4.1/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 - .../patches-4.1/132-mips_inline_dma_ops.patch | 697 --- ...-__arch_swab-16-32-64-when-using-MIP.patch | 53 - ...-generic-parsing-of-linux-part-probe.patch | 175 - ...or-disable-protection-for-Winbond-fl.patch | 35 - ...ude-mtd.h-header-for-struct-mtd_info.patch | 38 - ...limit-scanned-flash-area-on-BCM47XX-.patch | 33 - ...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 | 232 - ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 96 - .../patches-4.1/200-fix_localversion.patch | 11 - .../patches-4.1/201-extra_optimization.patch | 14 - .../patches-4.1/202-reduce_module_size.patch | 11 - .../203-kallsyms_uncompressed.patch | 108 - .../patches-4.1/204-module_strip.patch | 194 - .../205-backtrace_module_info.patch | 36 - .../210-darwin_scripts_include.patch | 3088 ---------- .../212-byteshift_portability.patch | 51 - .../214-spidev_h_portability.patch | 11 - .../generic/patches-4.1/220-gc_sections.patch | 536 -- .../patches-4.1/221-module_exports.patch | 88 - ...ld-Do-not-fail-on-missing-Build-file.patch | 57 - .../230-openwrt_lzma_options.patch | 58 - .../patches-4.1/250-netfilter_depends.patch | 18 - .../patches-4.1/251-sound_kconfig.patch | 18 - .../patches-4.1/252-mv_cesa_depends.patch | 10 - .../patches-4.1/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 - .../patches-4.1/259-regmap_dynamic.patch | 87 - .../260-crypto_test_dependencies.patch | 37 - ...libc-specific-inclusion-of-sysinfo.h.patch | 34 - ...bc-compat.h-do-not-rely-on-__GLIBC__.patch | 81 - ...prevent-redefinition-of-struct-ethhd.patch | 67 - .../300-mips_expose_boot_raw.patch | 39 - .../301-mips_image_cmdline_hack.patch | 28 - .../302-mips_no_branch_likely.patch | 11 - .../patches-4.1/304-mips_disable_fpu.patch | 106 - .../patches-4.1/305-mips_module_reloc.patch | 352 -- .../306-mips_mem_functions_performance.patch | 83 - .../patches-4.1/307-mips_highmem_offset.patch | 17 - .../310-arm_module_unresolved_weak_sym.patch | 13 - .../patches-4.1/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 | 146 - ...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 - ...rward-declaration-of-struct-mtd_info.patch | 18 - .../411-mtd-partial_eraseblock_write.patch | 142 - .../412-mtd-partial_eraseblock_unlock.patch | 18 - .../patches-4.1/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 - .../patches-4.1/440-block2mtd_init.patch | 108 - .../patches-4.1/441-block2mtd_probe.patch | 39 - ...-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 - ...25p80-mx-disable-software-protection.patch | 14 - .../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 - .../500-yaffs-Kbuild-integration.patch | 18 - .../502-yaffs-fix-compat-tags-handling.patch | 239 - ...3-yaffs-add-tags-9bytes-mount-option.patch | 115 - .../patches-4.1/504-yaffs-3.16-new-fops.patch | 29 - .../505-yaffs-3.19-f_dentry-remove.patch | 95 - .../530-jffs2_make_lzma_available.patch | 5142 ----------------- .../patches-4.1/531-debloat_lzma.patch | 1024 ---- .../patches-4.1/532-jffs2_eofdetect.patch | 56 - .../540-crypto-xz-decompression-support.patch | 146 - .../541-ubifs-xz-decompression-support.patch | 92 - ...fs-fix-default-compression-selection.patch | 29 - .../600-netfilter_conntrack_flush.patch | 86 - ...etfilter_match_bypass_default_checks.patch | 84 - ...netfilter_match_bypass_default_table.patch | 94 - ...netfilter_match_reduce_memory_access.patch | 16 - ...-netfilter_optional_tcp_window_check.patch | 36 - .../615-netfilter_add_xt_id_match.patch | 95 - .../616-net_optimize_xfrm_calls.patch | 12 - .../patches-4.1/630-packet_socket_type.patch | 134 - .../640-bridge_no_eap_forward.patch | 23 - .../641-bridge_always_accept_eap.patch | 17 - .../patches-4.1/642-bridge_port_isolate.patch | 107 - .../645-bridge_multicast_to_unicast.patch | 397 -- .../patches-4.1/650-pppoe_header_pad.patch | 20 - .../651-wireless_mesh_header.patch | 11 - .../653-disable_netlink_trim.patch | 30 - .../patches-4.1/655-increase_skb_pad.patch | 11 - .../656-skb_reduce_truesize-helper.patch | 41 - .../657-qdisc_reduce_truesize.patch | 63 - .../patches-4.1/660-fq_codel_defaults.patch | 13 - .../661-fq_codel_keep_dropped_stats.patch | 10 - .../662-use_fq_codel_by_default.patch | 75 - .../patches-4.1/663-remove_pfifo_fast.patch | 143 - .../patches-4.1/664-codel_fix_3_12.patch | 22 - ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 495 -- ...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/patches-4.1/700-swconfig.patch | 39 - .../patches-4.1/701-phy_extension.patch | 63 - .../702-phy_add_aneg_done_function.patch | 27 - ...detach-callback-to-struct-phy_driver.patch | 27 - .../704-phy-no-genphy-soft-reset.patch | 29 - ...710-phy-add-mdio_register_board_info.patch | 193 - .../generic/patches-4.1/720-phy_adm6996.patch | 26 - .../generic/patches-4.1/721-phy_packets.patch | 161 - .../patches-4.1/722-phy_mvswitch.patch | 23 - .../generic/patches-4.1/723-phy_ip175c.patch | 23 - .../generic/patches-4.1/724-phy_ar8216.patch | 24 - .../generic/patches-4.1/725-phy_rtl8306.patch | 23 - .../generic/patches-4.1/726-phy_rtl8366.patch | 45 - .../generic/patches-4.1/727-phy-rtl8367.patch | 23 - .../patches-4.1/728-phy-rtl8367b.patch | 23 - .../generic/patches-4.1/729-phy-tantos.patch | 21 - .../generic/patches-4.1/730-phy_b53.patch | 21 - .../732-phy-ar8216-led-support.patch | 13 - .../patches-4.1/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 -- .../761-8139cp-fixes-from-4.4.patch | 103 - .../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 - .../patches-4.1/831-ledtrig_netdev.patch | 21 - .../patches-4.1/834-ledtrig-libata.patch | 153 - .../generic/patches-4.1/840-rtc7301.patch | 250 - .../patches-4.1/841-rtc_pt7c4338.patch | 247 - .../861-04_spi_gpio_implement_spi_delay.patch | 58 - .../patches-4.1/862-gpio_spi_driver.patch | 373 -- .../generic/patches-4.1/863-gpiommc.patch | 844 --- .../864-gpiommc_configfs_locking.patch | 58 - .../patches-4.1/870-hifn795x_byteswap.patch | 17 - .../880-gateworks_system_controller.patch | 339 -- .../patches-4.1/890-8250_optional_sysrq.patch | 24 - .../patches-4.1/901-debloat_sock_diag.patch | 65 - .../patches-4.1/902-debloat_proc.patch | 385 -- .../patches-4.1/903-debloat_direct_io.patch | 80 - .../patches-4.1/904-debloat_dma_buf.patch | 44 - .../patches-4.1/910-kobject_uevent.patch | 21 - .../911-kobject_add_broadcast_uevent.patch | 65 - .../patches-4.1/921-use_preinit_as_init.patch | 12 - ...ays-create-console-node-in-initramfs.patch | 30 - .../generic/patches-4.1/930-crashlog.patch | 276 - ...e-filenames-from-deps_initramfs-list.patch | 29 - .../980-arm_openwrt_machtypes.patch | 32 - .../patches-4.1/995-mangle_bootargs.patch | 58 - .../patches-4.1/997-device_tree_cmdline.patch | 24 - ...able_wilink_platform_without_drivers.patch | 15 - ...imit-scanned-flash-area-on-BCM47XX-.patch} | 0 ...art-don-t-fail-because-of-bit-flips.patch} | 0 ...de-mtd.h-header-for-struct-mtd_info.patch} | 5 +- ...i-nor-backport-SPI_NOR_HAS_LOCK-flag.patch | 47 + ...imit-and-delta-fields-from-struct-ub.patch | 82 + ...writeback_interval-value-for-wbuf-ti.patch | 66 + ...ize-calc-when-avoiding-IPIs-for-smal.patch | 38 + ...98-usb-dwc2-Remove-unnecessary-kfree.patch | 24 + .../105-add-linux-spidev-compatible.patch | 15 + ..._value_cansleep-for-setting-chipsele.patch | 21 + ...move-TRX-parsing-code-to-separated-f.patch | 177 + ...support-layouts-with-multiple-TRX-pa.patch | 108 + ...support-for-ESMT_f25l32qa-and-ESMT_f.patch | 2 +- ...check-for-bad-blocks-when-calculatin.patch | 83 +- ...bcm47xxpart-detect-T_Meter-partition.patch | 4 +- ...25p80-mx-disable-software-protection.patch | 6 +- ...mtd-spi-nor-add-macronix-mx25u25635f.patch | 2 +- .../476-mtd-spi-nor-add-eon-en25q128.patch | 2 +- .../477-mtd-add-spi-nor-add-mx25u3235f.patch | 2 +- ...479-enable_mtd_has_lock_for_f25l32pa.patch | 22 + .../540-crypto-xz-decompression-support.patch | 146 - .../541-ubifs-xz-decompression-support.patch | 94 - .../615-netfilter_add_xt_id_match.patch | 95 - .../patches-4.4/630-packet_socket_type.patch | 4 +- .../653-disable_netlink_trim.patch | 2 +- ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 22 +- .../785-hso-support-0af0-9300.patch | 25 - .../generic/patches-4.4/863-gpiommc.patch | 844 --- .../864-gpiommc_configfs_locking.patch | 58 - .../patches-4.4/870-hifn795x_byteswap.patch | 17 - .../880-gateworks_system_controller.patch | 339 -- target/linux/ramips/Makefile | 26 + .../ramips/base-files/etc/board.d/01_leds | 391 ++ .../ramips/base-files/etc/board.d/02_network | 433 ++ target/linux/ramips/base-files/etc/diag.sh | 262 + .../etc/hotplug.d/firmware/10-rt2x00-eeprom | 56 + .../base-files/etc/hotplug.d/usb/10-motion | 1 + .../ramips/base-files/etc/init.d/bootcount | 12 + .../ramips/base-files/etc/init.d/enablemodem | 17 + target/linux/ramips/base-files/etc/inittab | 3 + .../etc/uci-defaults/09_fix-seama-header | 23 + .../lib/preinit/03_preinit_do_ramips.sh | 9 + .../lib/preinit/04_handle_checksumming | 56 + .../lib/preinit/07_set_preinit_iface_ramips | 29 + target/linux/ramips/base-files/lib/ramips.sh | 661 +++ .../ramips/base-files/lib/upgrade/platform.sh | 285 + .../ramips/base-files/lib/upgrade/ubnt.sh | 76 + .../ramips/base-files/sbin/fixup-mac-address | 80 + target/linux/ramips/dts/11ACNAS.dts | 26 + target/linux/ramips/dts/3G-6200N.dts | 111 + target/linux/ramips/dts/3G-6200NL.dts | 100 + target/linux/ramips/dts/3G150B.dts | 118 + target/linux/ramips/dts/3G300M.dts | 124 + target/linux/ramips/dts/A5-V11.dts | 124 + target/linux/ramips/dts/AC1200pro.dts | 15 + target/linux/ramips/dts/AI-BR100.dts | 109 + target/linux/ramips/dts/AIR3GII.dts | 98 + target/linux/ramips/dts/ALL0239-3G.dts | 118 + target/linux/ramips/dts/ALL0256N-4M.dts | 103 + target/linux/ramips/dts/ALL0256N-8M.dts | 103 + target/linux/ramips/dts/ALL5002.dts | 112 + target/linux/ramips/dts/ALL5003.dts | 112 + target/linux/ramips/dts/AR670W.dts | 105 + target/linux/ramips/dts/AR725W.dts | 115 + target/linux/ramips/dts/ASL26555-16M.dts | 156 + target/linux/ramips/dts/ASL26555-8M.dts | 150 + target/linux/ramips/dts/ATP-52B.dts | 99 + target/linux/ramips/dts/AWAPN2403.dts | 85 + target/linux/ramips/dts/AWM002-4M.dtsi | 11 + target/linux/ramips/dts/AWM002-8M.dtsi | 11 + target/linux/ramips/dts/AWM002-EVB-4M.dts | 55 + target/linux/ramips/dts/AWM002-EVB-8M.dts | 55 + target/linux/ramips/dts/AWM002.dtsi | 76 + target/linux/ramips/dts/AWM003-EVB.dts | 66 + target/linux/ramips/dts/ArcherC20i.dts | 154 + target/linux/ramips/dts/ArcherC50.dts | 187 + target/linux/ramips/dts/ArcherMR200.dts | 195 + target/linux/ramips/dts/BC2.dts | 89 + target/linux/ramips/dts/BR-6425.dts | 73 + target/linux/ramips/dts/BR-6475ND.dts | 178 + target/linux/ramips/dts/BROADWAY.dts | 94 + target/linux/ramips/dts/CARAMBOLA.dts | 75 + target/linux/ramips/dts/CF-WR800N.dts | 115 + target/linux/ramips/dts/CS-QR10.dts | 163 + target/linux/ramips/dts/CY-SWR1100.dts | 152 + target/linux/ramips/dts/D105.dts | 94 + target/linux/ramips/dts/DAP-1350.dts | 127 + target/linux/ramips/dts/DB-WRT01.dts | 100 + target/linux/ramips/dts/DCH-M225.dts | 186 + target/linux/ramips/dts/DCS-930.dts | 115 + target/linux/ramips/dts/DCS-930L-B1.dts | 108 + target/linux/ramips/dts/DIR-300-B1.dts | 111 + target/linux/ramips/dts/DIR-300-B7.dts | 103 + target/linux/ramips/dts/DIR-320-B1.dts | 131 + target/linux/ramips/dts/DIR-600-B1.dts | 111 + target/linux/ramips/dts/DIR-610-A1.dts | 104 + target/linux/ramips/dts/DIR-615-D.dts | 109 + target/linux/ramips/dts/DIR-615-H1.dts | 125 + target/linux/ramips/dts/DIR-620-A1.dts | 120 + target/linux/ramips/dts/DIR-620-D1.dts | 112 + target/linux/ramips/dts/DIR-645.dts | 142 + target/linux/ramips/dts/DIR-810L.dts | 136 + target/linux/ramips/dts/DIR-860L-B1.dts | 140 + target/linux/ramips/dts/DUZUN-DM06.dts | 157 + target/linux/ramips/dts/DWR-512-B.dts | 141 + target/linux/ramips/dts/E1700.dts | 154 + target/linux/ramips/dts/ESR-9753.dts | 96 + target/linux/ramips/dts/EX2700.dts | 147 + target/linux/ramips/dts/F5D8235_V1.dts | 170 + target/linux/ramips/dts/F5D8235_V2.dts | 118 + target/linux/ramips/dts/F7C027.dts | 133 + target/linux/ramips/dts/FIREWRT.dts | 121 + target/linux/ramips/dts/FONERA20N.dts | 136 + target/linux/ramips/dts/FREESTATION5.dts | 102 + target/linux/ramips/dts/GL-MT300A.dts | 164 + target/linux/ramips/dts/GL-MT300N.dts | 153 + target/linux/ramips/dts/GL-MT750.dts | 159 + target/linux/ramips/dts/HC5661.dts | 32 + target/linux/ramips/dts/HC5761.dts | 32 + target/linux/ramips/dts/HC5861.dts | 92 + target/linux/ramips/dts/HC5XXX.dtsi | 141 + target/linux/ramips/dts/HG255D.dts | 132 + target/linux/ramips/dts/HLKRM04.dts | 125 + target/linux/ramips/dts/HPM.dts | 149 + target/linux/ramips/dts/HT-TM02.dts | 114 + target/linux/ramips/dts/HW550-3G.dts | 116 + target/linux/ramips/dts/IP2202.dts | 90 + target/linux/ramips/dts/JHR-N805R.dts | 89 + target/linux/ramips/dts/JHR-N825R.dts | 83 + target/linux/ramips/dts/JHR-N926R.dts | 129 + target/linux/ramips/dts/LINKIT7688.dts | 184 + target/linux/ramips/dts/M2M.dts | 112 + target/linux/ramips/dts/M3.dts | 106 + target/linux/ramips/dts/M4-4M.dts | 94 + target/linux/ramips/dts/M4-8M.dts | 99 + target/linux/ramips/dts/MAC1200RV2.dts | 94 + target/linux/ramips/dts/MINIEMBPLUG.dts | 124 + target/linux/ramips/dts/MINIEMBWIFI.dts | 94 + target/linux/ramips/dts/MIWIFI-MINI.dts | 155 + target/linux/ramips/dts/MIWIFI-NANO.dts | 105 + target/linux/ramips/dts/MLW221.dts | 122 + target/linux/ramips/dts/MLWG2.dts | 122 + target/linux/ramips/dts/MOFI3500-3GN.dts | 113 + target/linux/ramips/dts/MPRA1.dts | 123 + target/linux/ramips/dts/MPRA2.dts | 120 + target/linux/ramips/dts/MR-102N.dts | 118 + target/linux/ramips/dts/MT7620a.dts | 127 + target/linux/ramips/dts/MT7620a_MT7530.dts | 117 + target/linux/ramips/dts/MT7620a_MT7610e.dts | 88 + target/linux/ramips/dts/MT7620a_V22SG.dts | 116 + target/linux/ramips/dts/MT7621.dts | 54 + target/linux/ramips/dts/MT7628.dts | 67 + target/linux/ramips/dts/MZK-750DHP.dts | 129 + target/linux/ramips/dts/MZK-DP150N.dts | 102 + target/linux/ramips/dts/MZK-EX300NP.dts | 132 + target/linux/ramips/dts/MZK-EX750NP.dts | 150 + target/linux/ramips/dts/MZK-W300NH2.dts | 113 + target/linux/ramips/dts/MZK-WDPR.dts | 86 + target/linux/ramips/dts/MicroWRT.dts | 109 + target/linux/ramips/dts/NA930.dts | 174 + target/linux/ramips/dts/NBG-419N.dts | 96 + target/linux/ramips/dts/NBG-419N2.dts | 119 + target/linux/ramips/dts/NCS601W.dts | 73 + target/linux/ramips/dts/NIXCORE-16M.dts | 43 + target/linux/ramips/dts/NIXCORE-8M.dts | 43 + target/linux/ramips/dts/NIXCORE.dtsi | 153 + target/linux/ramips/dts/NW718.dts | 109 + target/linux/ramips/dts/Newifi-D1.dts | 145 + target/linux/ramips/dts/OY-0001.dts | 124 + target/linux/ramips/dts/PBR-D1.dts | 161 + target/linux/ramips/dts/PBR-M1.dts | 177 + target/linux/ramips/dts/PSG1208.dts | 114 + target/linux/ramips/dts/PSG1218.dts | 120 + target/linux/ramips/dts/PSR-680W.dts | 93 + target/linux/ramips/dts/PWH2004.dts | 86 + target/linux/ramips/dts/PX-4885-4M.dts | 43 + target/linux/ramips/dts/PX-4885-8M.dts | 43 + target/linux/ramips/dts/PX-4885.dtsi | 55 + target/linux/ramips/dts/RB750Gr3.dts | 124 + target/linux/ramips/dts/RE6500.dts | 126 + target/linux/ramips/dts/RP-N53.dts | 166 + target/linux/ramips/dts/RT-G32-B1.dts | 86 + target/linux/ramips/dts/RT-N10-PLUS.dts | 82 + target/linux/ramips/dts/RT-N13U.dts | 100 + target/linux/ramips/dts/RT-N14U.dts | 128 + target/linux/ramips/dts/RT-N15.dts | 113 + target/linux/ramips/dts/RT-N56U.dts | 151 + .../ramips/dts/RT5350F-OLINUXINO-EVB.dts | 100 + target/linux/ramips/dts/RT5350F-OLINUXINO.dts | 78 + target/linux/ramips/dts/RUT5XX.dts | 93 + target/linux/ramips/dts/SAP-G3200U3.dts | 123 + target/linux/ramips/dts/SK-WB8.dts | 120 + target/linux/ramips/dts/SL-R7205.dts | 95 + target/linux/ramips/dts/TEW-691GR.dts | 114 + target/linux/ramips/dts/TEW-692GR.dts | 151 + target/linux/ramips/dts/TEW-714TRU.dts | 124 + target/linux/ramips/dts/TINY-AC.dts | 161 + target/linux/ramips/dts/Timecloud.dts | 108 + target/linux/ramips/dts/UBNT-ERX.dts | 107 + target/linux/ramips/dts/UR-326N4G.dts | 115 + target/linux/ramips/dts/UR-336UN.dts | 94 + target/linux/ramips/dts/V11STFE.dts | 85 + target/linux/ramips/dts/V22RW-2X2.dts | 96 + target/linux/ramips/dts/VOCORE-16M.dts | 43 + target/linux/ramips/dts/VOCORE-8M.dts | 43 + target/linux/ramips/dts/VOCORE.dtsi | 195 + target/linux/ramips/dts/VR500.dts | 85 + target/linux/ramips/dts/W150M.dts | 116 + target/linux/ramips/dts/W2914NSV2.dts | 26 + target/linux/ramips/dts/W2914NSV2.dtsi | 104 + target/linux/ramips/dts/W306R_V20.dts | 90 + target/linux/ramips/dts/W502U.dts | 104 + target/linux/ramips/dts/WCR150GN.dts | 100 + target/linux/ramips/dts/WF-2881.dts | 113 + target/linux/ramips/dts/WHR-1166D.dts | 172 + target/linux/ramips/dts/WHR-300HP2.dts | 150 + target/linux/ramips/dts/WHR-600D.dts | 158 + target/linux/ramips/dts/WHR-G300N.dts | 88 + target/linux/ramips/dts/WIDORA-NEO.dts | 171 + target/linux/ramips/dts/WITI.dts | 119 + target/linux/ramips/dts/WIZARD8800.dts | 81 + target/linux/ramips/dts/WIZFI630A.dts | 186 + target/linux/ramips/dts/WL-330N.dts | 100 + target/linux/ramips/dts/WL-330N3G.dts | 109 + target/linux/ramips/dts/WL-341V3.dts | 125 + target/linux/ramips/dts/WL-351.dts | 124 + target/linux/ramips/dts/WL-WN575A3.dts | 130 + target/linux/ramips/dts/WLI-TX4-AG300N.dts | 105 + target/linux/ramips/dts/WLR-6000.dts | 186 + target/linux/ramips/dts/WMR-300.dts | 106 + target/linux/ramips/dts/WNCE2001.dts | 139 + target/linux/ramips/dts/WNDR3700V5.dts | 139 + target/linux/ramips/dts/WR512-3GN-4M.dts | 111 + target/linux/ramips/dts/WR512-3GN-8M.dts | 111 + target/linux/ramips/dts/WR6202.dts | 115 + target/linux/ramips/dts/WRH-300CR.dts | 127 + target/linux/ramips/dts/WRTNODE.dts | 91 + target/linux/ramips/dts/WRTNODE2.dtsi | 91 + target/linux/ramips/dts/WRTNODE2P.dts | 26 + target/linux/ramips/dts/WRTNODE2R.dts | 26 + target/linux/ramips/dts/WSR-1166.dts | 189 + target/linux/ramips/dts/WSR-600.dts | 162 + target/linux/ramips/dts/WT1520-4M.dts | 43 + target/linux/ramips/dts/WT1520-8M.dts | 43 + target/linux/ramips/dts/WT1520.dtsi | 45 + target/linux/ramips/dts/WT3020-4M.dts | 102 + target/linux/ramips/dts/WT3020-8M.dts | 102 + target/linux/ramips/dts/WZR-AGL300NH.dts | 138 + target/linux/ramips/dts/X5.dts | 138 + target/linux/ramips/dts/X8.dts | 99 + target/linux/ramips/dts/XDXRN502J.dts | 94 + target/linux/ramips/dts/Y1.dts | 49 + target/linux/ramips/dts/Y1.dtsi | 109 + target/linux/ramips/dts/Y1S.dts | 106 + target/linux/ramips/dts/YOUKU-YK1.dts | 126 + target/linux/ramips/dts/ZBT-APE522II.dts | 145 + target/linux/ramips/dts/ZBT-CPE102.dts | 120 + target/linux/ramips/dts/ZBT-WA05.dts | 120 + target/linux/ramips/dts/ZBT-WE826.dts | 124 + target/linux/ramips/dts/ZBT-WG2626.dts | 121 + target/linux/ramips/dts/ZBT-WG3526.dts | 15 + target/linux/ramips/dts/ZBT-WG3526.dtsi | 116 + target/linux/ramips/dts/ZBT-WR8305RT.dts | 117 + target/linux/ramips/dts/ZTE-Q7.dts | 113 + target/linux/ramips/dts/kn_rc.dts | 120 + target/linux/ramips/dts/kn_rf.dts | 120 + target/linux/ramips/dts/kng_rc.dts | 154 + target/linux/ramips/dts/mt7620a.dtsi | 558 ++ target/linux/ramips/dts/mt7620n.dtsi | 344 ++ target/linux/ramips/dts/mt7621.dtsi | 458 ++ target/linux/ramips/dts/mt7628an.dtsi | 479 ++ target/linux/ramips/dts/rt2880.dtsi | 234 + target/linux/ramips/dts/rt3050.dtsi | 335 ++ target/linux/ramips/dts/rt3352.dtsi | 366 ++ target/linux/ramips/dts/rt3883.dtsi | 473 ++ target/linux/ramips/dts/rt5350.dtsi | 377 ++ target/linux/ramips/image/Makefile | 254 + .../linux/ramips/image/ex2700-fakeroot.uImage | Bin 0 -> 64 bytes .../linux/ramips/image/lzma-loader/Makefile | 65 + .../ramips/image/lzma-loader/src/LzmaDecode.c | 584 ++ .../ramips/image/lzma-loader/src/LzmaDecode.h | 113 + .../ramips/image/lzma-loader/src/LzmaTypes.h | 45 + .../ramips/image/lzma-loader/src/Makefile | 110 + .../image/lzma-loader/src/board-ralink.c | 42 + .../ramips/image/lzma-loader/src/cache.c | 43 + .../ramips/image/lzma-loader/src/cache.h | 17 + .../ramips/image/lzma-loader/src/cacheops.h | 85 + .../ramips/image/lzma-loader/src/config.h | 27 + .../ramips/image/lzma-loader/src/cp0regdef.h | 39 + .../linux/ramips/image/lzma-loader/src/head.S | 121 + .../ramips/image/lzma-loader/src/lantiq.mk | 1 + .../ramips/image/lzma-loader/src/loader.c | 263 + .../ramips/image/lzma-loader/src/loader.lds | 35 + .../ramips/image/lzma-loader/src/loader2.lds | 10 + .../image/lzma-loader/src/lzma-data.lds | 8 + .../ramips/image/lzma-loader/src/printf.c | 350 ++ .../ramips/image/lzma-loader/src/printf.h | 18 + .../ramips/image/lzma-loader/src/ralink.mk | 1 + target/linux/ramips/image/mt7628.mk | 48 + target/linux/ramips/image/mt7688.mk | 36 + target/linux/ramips/image/rt288x.mk | 71 + target/linux/ramips/image/rt305x-legacy.mk | 118 + target/linux/ramips/image/rt305x.mk | 845 +++ target/linux/ramips/image/rt3883.mk | 119 + target/linux/ramips/modules.mk | 136 + ...-arch-mips-ralink-add-mt7621-support.patch | 437 ++ ...002-MIPS-ralink-add-MT7621-defconfig.patch | 211 + ...4-MIPS-ralink-add-MT7621-pcie-driver.patch | 857 +++ ...e-to-enable-disable-the-cevt-r4k-irq.patch | 82 + ...IPS-ralink-add-cpu-frequency-scaling.patch | 93 + ...-the-commandline-from-the-devicetree.patch | 21 + ...09-PCI-MIPS-adds-mt7620a-pcie-driver.patch | 433 ++ ...MIPS-ralink-Add-a-few-missing-clocks.patch | 48 + ...013-owrt-hack-fix-mt7688-cache-issue.patch | 28 + .../0014-arch-mips-cleanup-cevt-rt3352.patch | 165 + ...-select-illegal-access-driver-by-def.patch | 25 + ...ink-add-mt7621-cpu-feature-overrides.patch | 79 + ...-ralink-Fix-vendor-string-for-mt7620.patch | 27 + .../0024-GPIO-add-named-gpio-exports.patch | 166 + ...25-pinctrl-ralink-add-pinctrl-driver.patch | 524 ++ ...DT-Add-documentation-for-gpio-ralink.patch | 59 + ...alink-add-gpio-driver-for-ralink-SoC.patch | 430 ++ ...IO-ralink-add-mt7621-gpio-controller.patch | 405 ++ .../0029-phy-usb-add-ralink-phy.patch | 293 + ...0031-uvc-add-iPassion-iP2970-support.patch | 246 + .../0032-USB-dwc2-add-device_reset.patch | 29 + ...tek-support-MTK-xHCI-host-controller.patch | 1517 +++++ .../0034-NET-multi-phy-support.patch | 53 + ...x-cfi-cmdset-0002-erase-status-check.patch | 29 + ...mtd-cfi-cmdset-0002-force-word-write.patch | 70 + ...38-mtd-ralink-add-mt7620-nand-driver.patch | 2408 ++++++++ .../0039-mtd-add-mt7621-nand-support.patch | 4417 ++++++++++++++ .../0040-nand-add-mtk-nand-hack-hook.patch | 157 + ...-DT-Add-documentation-for-spi-rt2880.patch | 44 + ...SPI-ralink-add-Ralink-SoC-spi-driver.patch | 574 ++ .../0043-spi-add-mt7621-support.patch | 524 ++ ...0044-i2c-MIPS-adds-ralink-I2C-driver.patch | 507 ++ .../0045-i2c-add-mt7621-driver.patch | 473 ++ ...IPS-ralink-add-sdhci-for-mt7620a-SoC.patch | 4830 ++++++++++++++++ ...047-DMA-ralink-add-rt2880-dma-engine.patch | 1756 ++++++ .../0048-asoc-add-mt7620-support.patch | 1046 ++++ .../0049-watchdog-add-MT7621-support.patch | 227 + ...erial-add-ugly-custom-baud-rate-hack.patch | 22 + .../0052-pwm-add-mediatek-support.patch | 217 + ...54-mtd-add-chunked-read-io-to-m25p80.patch | 123 + .../0059-correct-CPC_BASE_MASK.patch | 13 + ..._CMDEFTGT_MEM-according-to-datasheet.patch | 12 + .../patches-4.4/0064-add_clk_round_rate.patch | 15 + ...0065-MIPS-ralink-MT7688-pinmux-fixes.patch | 166 + .../0066-mt7621-enable-highmem.patch | 10 + .../patches-4.4/0067-enable-mt7621-xhci.patch | 14 + .../ramips/patches-4.4/0068-fix-ralink-prom.c | 30 + .../0069-awake-rt305x-dwc2-controller.patch | 15 + ...IPS-ralink-fix-USB-frequency-scaling.patch | 28 + ...k-Fix-invalid-assignment-of-SoC-type.patch | 25 + ...-MIPS-ralink-fix-MT7628-pinmux-typos.patch | 32 + ...alink-fix-MT7628-wled_an-pinmux-gpio.patch | 35 + ...-add-MT7628-EPHY-LEDs-pinmux-support.patch | 151 + .../ramips/patches-4.4/0085-pinmux-util.patch | 77 + .../ramips/patches-4.4/0086-usbphy.patch | 35 + .../patches-4.4/0103-MIPS-OWRTDTB.patch | 44 + .../0104-fix_bootargs_handling.patch | 40 + .../0105-set_mt7621_soc_type.patch | 11 + .../patches-4.4/0200-linkit_bootstrap.patch | 94 + ...-net-add-docs-for-ralink-mediatek-So.patch | 150 + ...-mediatek-add-the-drivers-core-files.patch | 2715 +++++++++ ...ediatek-add-switch-driver-for-rt3050.patch | 691 +++ ...ediatek-add-switch-driver-for-mt7620.patch | 394 ++ ...ediatek-add-switch-driver-for-mt7621.patch | 301 + ...next-mediatek-add-support-for-rt2880.patch | 351 ++ ...next-mediatek-add-support-for-rt3050.patch | 239 + ...next-mediatek-add-support-for-rt3883.patch | 94 + ...next-mediatek-add-support-for-mt7620.patch | 519 ++ ...next-mediatek-add-support-for-mt7621.patch | 209 + ...xt-mediatek-add-Kconfig-and-Makefile.patch | 127 + ...-support-for-the-multiphy-carrier-pa.patch | 80 + ...k-add-swconfig-driver-for-esw_rt3050.patch | 901 +++ ...k-add-swconfig-driver-for-gsw_mt762x.patch | 1181 ++++ .../0514-net-mediatek-fix_esw.patch | 48 + ...-multicast-icmpv6-for-the-rt3050-eth.patch | 26 + ...-net-mediatek-fix-documentation-for-.patch | 23 + ...-comment-in-rt3050-ethernet-switch-d.patch | 24 + ...-rt3050-ethernet-ports-to-be-disable.patch | 81 + .../ramips/patches-4.4/0519-gsw_mt7621.patch | 31 + .../ramips/patches-4.4/0520-esw-gmac.patch | 69 + ...diatke-add-phy_ethtool_ioctl-support.patch | 22 + .../0700-pinctrl-mt7620-mdio-as-refclk.patch | 42 + ...0720-arch-mips-ralink-add-i2c-clocks.patch | 67 + .../0721-asoc-enable-wm8960-kconfig.patch | 11 + .../0901-spansion_nand_id_fix.patch | 43 + .../100-mt7621-core-detect-hack.patch | 61 + target/linux/ramips/rt288x/config-4.4 | 204 + target/linux/ramips/rt288x/target.mk | 14 + target/linux/ramips/rt305x/config-4.4 | 195 + .../ramips/rt305x/profiles/00-default.mk | 19 + target/linux/ramips/rt305x/target.mk | 15 + target/linux/ramips/rt3883/config-4.4 | 203 + .../rt3883/profiles/00-default.mk} | 8 +- target/linux/ramips/rt3883/target.mk | 15 + target/linux/sunxi/Makefile | 3 +- .../sunxi/base-files/etc/board.d/02_network | 4 +- .../lib/preinit/01_preinit_sunxi.sh | 9 - .../base-files/lib/preinit/02_b53_hack.sh | 2 +- .../base-files/lib/preinit/79_move_config | 20 + target/linux/sunxi/base-files/lib/sunxi.sh | 140 - .../sunxi/base-files/lib/upgrade/platform.sh | 67 + target/linux/sunxi/config-4.4 | 18 + target/linux/sunxi/image/Makefile | 227 +- .../linux/sunxi/image/gen_sunxi_sdcard_img.sh | 3 +- target/linux/sunxi/profiles/00-default.mk | 28 + target/linux/sunxi/profiles/a10-olinuxino.mk | 19 - target/linux/sunxi/profiles/a13-olimex-som.mk | 18 - target/linux/sunxi/profiles/a13-olinuxino.mk | 18 - target/linux/sunxi/profiles/a20-olinuxino.mk | 33 - target/linux/sunxi/profiles/bananapi.mk | 18 - target/linux/sunxi/profiles/bananapro.mk | 19 - target/linux/sunxi/profiles/cubieboard.mk | 19 - target/linux/sunxi/profiles/cubieboard2.mk | 19 - target/linux/sunxi/profiles/cubietruck.mk | 19 - target/linux/sunxi/profiles/lamobo-r1.mk | 19 - target/linux/sunxi/profiles/mele_m9.mk | 18 - target/linux/sunxi/profiles/orangepi_plus.mk | 18 - target/linux/sunxi/profiles/pcduino.mk | 18 - target/linux/sunxi/profiles/pcduino3.mk | 19 - target/linux/x86/64/config-default | 36 +- .../x86/base-files/lib/preinit/79_move_config | 13 +- .../x86/base-files/lib/upgrade/platform.sh | 97 +- target/linux/x86/image/Makefile | 2 + target/linux/x86/image/grub-iso.cfg | 2 +- target/linux/x86/image/grub.cfg | 4 +- target/linux/x86/modules.mk | 21 + target/linux/x86/xen_domu/target.mk | 1 - target/linux/xburst/config-3.18 | 2 - target/sdk/Makefile | 4 + target/sdk/files/README.SDK | 4 +- toolchain/Makefile | 1 + toolchain/binutils/Makefile | 10 +- toolchain/fortify-headers/Makefile | 2 +- toolchain/gcc/Config.in | 7 +- toolchain/gcc/Config.version | 2 +- toolchain/gcc/common.mk | 14 +- .../gcc/patches/5.4.0/881-no_tm_section.patch | 11 + .../001-revert_register_mode_search.patch | 0 .../002-case_insensitive.patch | 0 .../{6.2.0 => 6.3.0}/010-documentation.patch | 0 .../{6.2.0 => 6.3.0}/100-uclibc-conf.patch | 0 .../{6.2.0 => 6.3.0}/230-musl_libssp.patch | 0 .../280-musl-disable-ifunc-by-default.patch | 6 +- .../300-mips_Os_cpu_rtx_cost_model.patch | 0 .../800-arm_v5te_no_ldrd_strd.patch | 0 .../810-arm-softfloat-libgcc.patch | 0 .../{6.2.0 => 6.3.0}/820-libgcc_pic.patch | 0 .../830-arm_unbreak_armv4t.patch | 0 .../840-armv4_pass_fix-v4bx_to_ld.patch | 0 .../850-use_shared_libgcc.patch | 0 .../851-libgcc_no_compat.patch | 0 .../870-ppc_no_crtsavres.patch | 2 +- .../880-no_java_section.patch | 0 .../gcc/patches/6.3.0/881-no_tm_section.patch | 11 + .../{6.2.0 => 6.3.0}/900-bad-mips16-crt.patch | 0 .../{6.2.0 => 6.3.0}/910-mbsd_multi.patch | 0 .../920-specs_nonfatal_getenv.patch | 0 .../930-fix-mips-noexecstack.patch | 0 .../940-no-clobber-stamp-bits.patch | 2 +- .../950-cpp_file_path_translation.patch | 0 toolchain/gdb/Makefile | 4 +- toolchain/glibc/common.mk | 4 +- toolchain/insight/Makefile | 2 +- toolchain/kernel-headers/Makefile | 2 +- toolchain/musl/common.mk | 2 +- ...ay-month-names-not-to-vary-by-locale.patch | 41 + ...ite-syscall-calling-convention-on-sh.patch | 71 + ...me-refers-to-the-same-file-as-the-fd.patch | 49 + ...5-fix-ffsync-by-changing-it-to-osync.patch | 25 + ...form-octal-zero-flag-and-field-width.patch | 31 + ..._data-and-ifcu_buf-types-in-net-if.h.patch | 35 + .../030-fix-if_indextoname-error-case.patch | 36 + ...csftime_l-prototypes-to-wchar-header.patch | 38 + ...-behavior-in-sched.h-cpu_set_t-usage.patch | 43 + ...rvby_r-result-pointer-value-on-error.patch | 41 + ...-fix-strftime-y-for-negative-tm_year.patch | 23 + ...-in-regexec-buffer-size-computations.patch | 72 + ...haystack-strings-longer-than-int_max.patch | 189 + ...-printf-needed-precision-computation.patch | 35 + ...nd-uncaught-eoverflow-in-printf-core.patch | 390 ++ .../048-math-fix-pow-signed-shift-ub.patch | 38 + .../049-fix-clock_nanosleep-error-case.patch | 30 + .../patches/050-add-pthread_setname_np.patch | 58 + ...rmatting-of-some-exact-halfway-cases.patch | 30 + ...ng_only-misinterpreting-as-an-option.patch | 24 + ...itous-undefined-behavior-in-strptime.patch | 33 + ...of-rounding-with-many-trailing-zeros.patch | 36 + ...ization-in-non-nearest-rounding-mode.patch | 38 + ...-overflow-of-tm_year-in-__secs_to_tm.patch | 39 + ...rnal-buffer-state-and-error-handling.patch | 36 + ...ion-on-archs-with-variable-page-size.patch | 32 + ...ibute-to-some-function-declarations.patch} | 0 toolchain/musl/patches/300-relative.patch | 2 +- toolchain/uClibc/common.mk | 2 +- toolchain/yasm/Makefile | 2 +- tools/Makefile | 55 +- tools/autoconf/Makefile | 2 +- tools/automake/Makefile | 2 +- tools/bc/Makefile | 2 +- tools/bison/Makefile | 2 +- tools/ccache/Makefile | 2 +- tools/cloog/Makefile | 41 - tools/cmake/Makefile | 7 +- ... 130-libarchive-fix-libressl-compat.patch} | 0 ...am-libarchive-openssl-compat-headers.patch | 190 - .../140-curl-fix-libressl-linking.patch | 32 + ...eam-libarchive-openssl-1.1.x-support.patch | 379 -- tools/coreutils/Makefile | 2 +- tools/dosfstools/Makefile | 2 +- tools/e2fsprogs/Makefile | 2 +- tools/elftosb/Makefile | 2 +- tools/expat/Makefile | 2 +- tools/findutils/Makefile | 2 +- tools/firmware-utils/Makefile | 1 + tools/firmware-utils/src/addpattern.c | 7 + tools/firmware-utils/src/mktplinkfw-kernel.c | 352 ++ tools/firmware-utils/src/mktplinkfw.c | 14 + tools/firmware-utils/src/mktplinkfw2.c | 13 + tools/firmware-utils/src/tplink-safeloader.c | 704 ++- tools/flex/Makefile | 2 +- tools/genext2fs/Makefile | 2 +- tools/gengetopt/Makefile | 2 +- tools/gmp/Makefile | 4 +- tools/isl/Makefile | 2 +- tools/kernel2minor/Makefile | 5 +- .../patches/100-portability.patch | 13 + .../patches/110-fix_endian_conv.patch | 33 + .../patches/120-fix_create_mode.patch | 11 + tools/libelf/Makefile | 2 +- tools/libressl/Makefile | 5 +- tools/libtool/Makefile | 2 +- tools/lzma-old/Makefile | 2 +- tools/lzma/Makefile | 2 +- tools/m4/Makefile | 2 +- tools/make-ext4fs/Makefile | 8 +- tools/mkimage/Makefile | 10 +- tools/mklibs/Makefile | 2 +- tools/mm-macros/Makefile | 2 +- tools/mpc/Makefile | 2 +- tools/mpfr/Makefile | 2 +- tools/mtd-utils/Makefile | 6 +- .../patches/136-mkfs.ubifs-xz-support.patch | 378 -- .../310-add-static-linking-option.patch | 8 +- tools/mtools/Makefile | 2 +- tools/patch/Makefile | 2 +- tools/patchelf/Makefile | 2 +- tools/pkg-config/Makefile | 2 +- tools/ppl/Makefile | 37 - .../patches/001-disable-serial-tests.patch | 44 - tools/qemu/Makefile | 2 +- tools/quilt/Makefile | 2 +- tools/scons/Makefile | 2 +- tools/sdimage/Makefile | 7 +- tools/sed/Makefile | 5 +- tools/sparse/Makefile | 6 +- tools/squashfs/Makefile | 2 +- tools/squashfs4/Makefile | 2 +- tools/tar/Makefile | 2 +- .../patches/100-symlink-force-root-name.patch | 22 + tools/upslug2/Makefile | 2 +- tools/upx/Makefile | 2 +- tools/xz/Makefile | 4 +- tools/yaffs2/Makefile | 39 - tools/yaffs2/patches/100-compile.patch | 125 - tools/yaffs2/patches/110-openbsd-compat.patch | 14 - 1273 files changed, 87571 insertions(+), 45623 deletions(-) delete mode 100644 package/devel/gdb/patches/002-remove-arguments.patch create mode 100644 package/kernel/hwmon-gsc/Makefile create mode 100644 package/kernel/hwmon-gsc/src/Makefile create mode 100644 package/kernel/hwmon-gsc/src/gsc.c create mode 100644 package/kernel/mac80211/patches/329-ath9k-unlock-rcu-read-when-returning-early.patch create mode 100644 package/kernel/mac80211/patches/334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch create mode 100644 package/kernel/mac80211/patches/335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch create mode 100644 package/kernel/mac80211/patches/336-mac80211-minstrel_ht-make-att_hist-and-succ_hist-u32.patch create mode 100644 package/kernel/mac80211/patches/337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch create mode 100644 package/kernel/mac80211/patches/338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch create mode 100644 package/kernel/mac80211/patches/339-mac80211-minstrel-reduce-MINSTREL_SCALE.patch create mode 100644 package/kernel/mac80211/patches/340-mac80211-minstrel-store-probability-variance-instead.patch create mode 100644 package/kernel/mac80211/patches/341-mac80211-minstrel-make-prob_ewma-u16-instead-of-u32.patch create mode 100644 package/kernel/mac80211/patches/342-mac80211-minstrel_ht-remove-obsolete-if-for-3-stream.patch create mode 100644 package/kernel/mac80211/patches/343-cfg80211-limit-scan-results-cache-size.patch create mode 100644 package/kernel/mac80211/patches/346-ath5k-drop-bogus-warning-on-drv_set_key-with-unsuppo.patch create mode 100644 package/kernel/mac80211/patches/347-0001-cfg80211-move-function-checking-range-fit-to-util.c.patch create mode 100644 package/kernel/mac80211/patches/347-0002-cfg80211-support-ieee80211-freq-limit-DT-property.patch create mode 100644 package/kernel/mac80211/patches/347-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch delete mode 100644 package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch delete mode 100644 package/kernel/mmc_over_gpio/Makefile delete mode 100644 package/kernel/mmc_over_gpio/files/mmc_over_gpio.config delete mode 100644 package/kernel/mmc_over_gpio/files/mmc_over_gpio.init create mode 100644 package/kernel/rtc-rv5c386a/Makefile create mode 100644 package/kernel/rtc-rv5c386a/src/Makefile create mode 100644 package/kernel/rtc-rv5c386a/src/rtc.c delete mode 100644 package/libs/elfutils/patches/004-memcpy_def.patch create mode 100644 package/libs/elfutils/patches/007-fix_TEMP_FAILURE_RETRY.patch create mode 100644 package/libs/libpcap/patches/001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch create mode 100644 package/libs/libpcap/patches/002-Add-missing-compiler_state_t-parameter.patch create mode 100644 package/libs/libpcap/patches/204-usb-bus-path.patch delete mode 100644 package/libs/ncurses/patches/103-fixup-pkg-config-handling.patch create mode 100644 package/luci/.buildpath create mode 100644 package/luci/.cproject create mode 100644 package/luci/.gitignore create mode 100644 package/luci/.project create mode 100644 package/luci/README.md create mode 100644 package/luci/applications/luci-app-mjpg-streamer/po/ja/mjpg-streamer.po create mode 100644 package/luci/applications/luci-app-shairplay/po/ja/shairplay.po create mode 100644 package/luci/applications/luci-app-shairplay/po/templates/shairplay.pot create mode 100644 package/luci/applications/luci-app-travelmate/po/ja/travelmate.po create mode 100644 package/luci/applications/luci-app-uhttpd/po/ja/uhttpd.po create mode 100644 package/luci/applications/luci-app-uhttpd/po/templates/uhttpd.pot create mode 100644 package/luci/applications/luci-app-wifischedule/po/ja/wifischedule.po create mode 100644 package/luci/applications/luci-app-wifischedule/po/templates/wifischedule.pot create mode 100644 package/luci/applications/luci-app-wifischedule/po/zh-cn/wifischedule.po create mode 100644 package/luci/modules/luci-base/po/ko/base.po create mode 100644 package/luci/protocols/luci-proto-qmi/Makefile create mode 100644 package/luci/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua create mode 100644 package/luci/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua delete mode 100644 package/network/services/dropbear/patches/500-set-default-path.patch delete mode 100644 package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch delete mode 100644 package/network/services/hostapd/patches/130-Revert-nl80211-Remove-duplicated-check-in-nl80211_se.patch rename package/network/services/openvpn/{Config-polarssl.in => Config-mbedtls.in} (58%) create mode 100644 package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch delete mode 100644 package/network/services/openvpn/patches/100-polarssl-disable-runtime-version-check.patch delete mode 100644 package/network/services/openvpn/patches/101-backport_upstream_polarssl_debug_call.patch create mode 100644 package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch create mode 100644 package/network/services/openvpn/patches/220-disable_des.patch delete mode 100644 package/network/services/relayd/files/relay.hotplug create mode 100644 package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch delete mode 100644 package/network/utils/curl/patches/310-polarssl-disable-runtime-version-check.patch delete mode 100644 package/network/utils/iptables/patches/500-add-xt_id-match.patch create mode 100644 package/system/opkg/patches/070-use_external_gzip.patch rename package/system/opkg/patches/{070-use_gzipped_pkg_list.patch => 071-use_gzipped_pkg_list.patch} (85%) create mode 100644 package/utils/adb/Makefile create mode 100644 package/utils/adb/patches/001-create_Makefile.patch create mode 100644 package/utils/ct-bugcheck/Makefile create mode 100644 package/utils/ct-bugcheck/src/bugcheck.initd create mode 100755 package/utils/ct-bugcheck/src/bugcheck.sh create mode 100755 package/utils/ct-bugcheck/src/bugchecker.sh create mode 100755 scripts/fixup-makefile.pl create mode 100644 scripts/mkhash.c delete mode 100755 scripts/update-package-md5sum create mode 100644 target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata create mode 100644 target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k delete mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-ap113.c delete mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-ap83.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-e2100l.c delete mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-pb92.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-re450.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-sr3200.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c delete mode 100644 target/linux/ar71xx/files/drivers/spi/spi-ap83.c delete mode 100644 target/linux/ar71xx/files/net/dsa/mv88e6063.c create mode 100644 target/linux/ar71xx/image/ubnt.mk delete mode 100644 target/linux/ar71xx/patches-4.4/001-revert_spi_device_tree_support.patch create mode 100644 target/linux/ar71xx/patches-4.4/001-spi-cs-gpio.patch create mode 100644 target/linux/ar71xx/patches-4.4/104-spi-spi-ath79-support-multiple-internal-chip-select-.patch create mode 100644 target/linux/ar71xx/patches-4.4/105-spi-spi-ath79-use-gpio_set_value_cansleep-for-GPIO-c.patch delete mode 100644 target/linux/ar71xx/patches-4.4/206-spi-ath79-make-chipselect-logic-more-flexible.patch delete mode 100644 target/linux/ar71xx/patches-4.4/431-spi-add-various-flags.patch delete mode 100644 target/linux/ar71xx/patches-4.4/434-spi-ap83_spi_controller.patch create mode 100644 target/linux/ar71xx/patches-4.4/460-m25p80-spi-read-flash-check.patch delete mode 100644 target/linux/ar71xx/patches-4.4/460-spi-bitbang-export-spi_bitbang_bufs.patch delete mode 100644 target/linux/ar71xx/patches-4.4/461-spi-add-type-field-to-spi_transfer.patch create mode 100644 target/linux/ar71xx/patches-4.4/461-spi-ath79-add-fast-flash-read.patch delete mode 100644 target/linux/ar71xx/patches-4.4/462-mtd-m25p80-set-spi-transfer-type.patch delete mode 100644 target/linux/ar71xx/patches-4.4/463-spi-ath79-add-fast-flash-read.patch delete mode 100644 target/linux/ar71xx/patches-4.4/464-spi-ath79-fix-fast-flash-read.patch delete mode 100644 target/linux/ar71xx/patches-4.4/503-MIPS-ath79-add-flash-acquire-release.patch delete mode 100644 target/linux/ar71xx/patches-4.4/604-MIPS-ath79-ap81-fixes.patch delete mode 100644 target/linux/ar71xx/patches-4.4/615-MIPS-ath79-ap83-remove-mtd-partitions.patch delete mode 100644 target/linux/generic/config-4.1 delete mode 100644 target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-3.18/615-netfilter_add_xt_id_match.patch delete mode 100644 target/linux/generic/patches-3.18/863-gpiommc.patch delete mode 100644 target/linux/generic/patches-3.18/864-gpiommc_configfs_locking.patch delete mode 100644 target/linux/generic/patches-3.18/880-gateworks_system_controller.patch delete mode 100644 target/linux/generic/patches-4.1/010-perf-tools-Create-config.detected-into-OUTPUT-direct.patch delete mode 100644 target/linux/generic/patches-4.1/011-perf-tools-Fix-makefile-generation-under-dash.patch delete mode 100644 target/linux/generic/patches-4.1/020-ssb-backport.patch delete mode 100644 target/linux/generic/patches-4.1/021-ssb_sprom.patch delete mode 100644 target/linux/generic/patches-4.1/022-bcma-from-4.2.patch delete mode 100644 target/linux/generic/patches-4.1/023-bcma-from-4.4.patch delete mode 100644 target/linux/generic/patches-4.1/024-bcma-from-4.5.patch delete mode 100644 target/linux/generic/patches-4.1/025-bcma-from-4.6.patch delete mode 100644 target/linux/generic/patches-4.1/030-backport_bcm47xx_nvram.patch delete mode 100644 target/linux/generic/patches-4.1/040-fs-overlay-fix-stacking.patch delete mode 100644 target/linux/generic/patches-4.1/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch delete mode 100644 target/linux/generic/patches-4.1/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch delete mode 100644 target/linux/generic/patches-4.1/050-backport_netfilter_rtcache.patch delete mode 100644 target/linux/generic/patches-4.1/060-mips_decompressor_memmove.patch delete mode 100644 target/linux/generic/patches-4.1/072-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch delete mode 100644 target/linux/generic/patches-4.1/072-14-bgmac-reset-all-4-GMAC-cores-on-init.patch delete mode 100644 target/linux/generic/patches-4.1/080-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch delete mode 100644 target/linux/generic/patches-4.1/081-solos-pci-Increase-headroom-on-received-packets.patch delete mode 100644 target/linux/generic/patches-4.1/082-usb-core-Introduce-a-USB-port-LED-trigger.patch delete mode 100644 target/linux/generic/patches-4.1/090-m25p80_spi-nor_update_to_4.4rc1.patch delete mode 100644 target/linux/generic/patches-4.1/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch delete mode 100644 target/linux/generic/patches-4.1/097-mm-remove-gup_flags-FOLL_WRITE-games-from-__get_user.patch delete mode 100644 target/linux/generic/patches-4.1/102-ehci_hcd_ignore_oc.patch delete mode 100644 target/linux/generic/patches-4.1/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch delete mode 100644 target/linux/generic/patches-4.1/111-jffs2-add-RENAME_EXCHANGE-support.patch delete mode 100644 target/linux/generic/patches-4.1/120-bridge_allow_receiption_on_disabled_port.patch delete mode 100644 target/linux/generic/patches-4.1/132-mips_inline_dma_ops.patch delete mode 100644 target/linux/generic/patches-4.1/133-MIPS-UAPI-Ignore-__arch_swab-16-32-64-when-using-MIP.patch delete mode 100644 target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch delete mode 100644 target/linux/generic/patches-4.1/141-Revert-mtd-spi-nor-disable-protection-for-Winbond-fl.patch delete mode 100644 target/linux/generic/patches-4.1/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch delete mode 100644 target/linux/generic/patches-4.1/143-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch delete mode 100644 target/linux/generic/patches-4.1/144-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch delete mode 100644 target/linux/generic/patches-4.1/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch delete mode 100644 target/linux/generic/patches-4.1/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch delete mode 100644 target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch delete mode 100644 target/linux/generic/patches-4.1/200-fix_localversion.patch delete mode 100644 target/linux/generic/patches-4.1/201-extra_optimization.patch delete mode 100644 target/linux/generic/patches-4.1/202-reduce_module_size.patch delete mode 100644 target/linux/generic/patches-4.1/203-kallsyms_uncompressed.patch delete mode 100644 target/linux/generic/patches-4.1/204-module_strip.patch delete mode 100644 target/linux/generic/patches-4.1/205-backtrace_module_info.patch delete mode 100644 target/linux/generic/patches-4.1/210-darwin_scripts_include.patch delete mode 100644 target/linux/generic/patches-4.1/212-byteshift_portability.patch delete mode 100644 target/linux/generic/patches-4.1/214-spidev_h_portability.patch delete mode 100644 target/linux/generic/patches-4.1/220-gc_sections.patch delete mode 100644 target/linux/generic/patches-4.1/221-module_exports.patch delete mode 100644 target/linux/generic/patches-4.1/222-perf-build-Do-not-fail-on-missing-Build-file.patch delete mode 100644 target/linux/generic/patches-4.1/230-openwrt_lzma_options.patch delete mode 100644 target/linux/generic/patches-4.1/250-netfilter_depends.patch delete mode 100644 target/linux/generic/patches-4.1/251-sound_kconfig.patch delete mode 100644 target/linux/generic/patches-4.1/252-mv_cesa_depends.patch delete mode 100644 target/linux/generic/patches-4.1/253-ssb_b43_default_on.patch delete mode 100644 target/linux/generic/patches-4.1/254-textsearch_kconfig_hacks.patch delete mode 100644 target/linux/generic/patches-4.1/255-lib80211_kconfig_hacks.patch delete mode 100644 target/linux/generic/patches-4.1/256-crypto_add_kconfig_prompts.patch delete mode 100644 target/linux/generic/patches-4.1/257-wireless_ext_kconfig_hack.patch delete mode 100644 target/linux/generic/patches-4.1/258-netfilter_netlink_kconfig_hack.patch delete mode 100644 target/linux/generic/patches-4.1/259-regmap_dynamic.patch delete mode 100644 target/linux/generic/patches-4.1/260-crypto_test_dependencies.patch delete mode 100644 target/linux/generic/patches-4.1/270-uapi-kernel.h-glibc-specific-inclusion-of-sysinfo.h.patch delete mode 100644 target/linux/generic/patches-4.1/271-uapi-libc-compat.h-do-not-rely-on-__GLIBC__.patch delete mode 100644 target/linux/generic/patches-4.1/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch delete mode 100644 target/linux/generic/patches-4.1/300-mips_expose_boot_raw.patch delete mode 100644 target/linux/generic/patches-4.1/301-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic/patches-4.1/302-mips_no_branch_likely.patch delete mode 100644 target/linux/generic/patches-4.1/304-mips_disable_fpu.patch delete mode 100644 target/linux/generic/patches-4.1/305-mips_module_reloc.patch delete mode 100644 target/linux/generic/patches-4.1/306-mips_mem_functions_performance.patch delete mode 100644 target/linux/generic/patches-4.1/307-mips_highmem_offset.patch delete mode 100644 target/linux/generic/patches-4.1/310-arm_module_unresolved_weak_sym.patch delete mode 100644 target/linux/generic/patches-4.1/320-ppc4xx_optimization.patch delete mode 100644 target/linux/generic/patches-4.1/321-powerpc_crtsavres_prereq.patch delete mode 100644 target/linux/generic/patches-4.1/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch delete mode 100644 target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch delete mode 100644 target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch delete mode 100644 target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch delete mode 100644 target/linux/generic/patches-4.1/403-mtd-hook-mtdsplit-to-Kbuild.patch delete mode 100644 target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch delete mode 100644 target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch delete mode 100644 target/linux/generic/patches-4.1/410-mtd-move-forward-declaration-of-struct-mtd_info.patch delete mode 100644 target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch delete mode 100644 target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch delete mode 100644 target/linux/generic/patches-4.1/420-mtd-redboot_space.patch delete mode 100644 target/linux/generic/patches-4.1/430-mtd-add-myloader-partition-parser.patch delete mode 100644 target/linux/generic/patches-4.1/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch delete mode 100644 target/linux/generic/patches-4.1/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch delete mode 100644 target/linux/generic/patches-4.1/440-block2mtd_init.patch delete mode 100644 target/linux/generic/patches-4.1/441-block2mtd_probe.patch delete mode 100644 target/linux/generic/patches-4.1/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch delete mode 100644 target/linux/generic/patches-4.1/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch delete mode 100644 target/linux/generic/patches-4.1/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch delete mode 100644 target/linux/generic/patches-4.1/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch delete mode 100644 target/linux/generic/patches-4.1/465-m25p80-mx-disable-software-protection.patch delete mode 100644 target/linux/generic/patches-4.1/480-mtd-set-rootfs-to-be-root-dev.patch delete mode 100644 target/linux/generic/patches-4.1/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch delete mode 100644 target/linux/generic/patches-4.1/491-ubi-auto-create-ubiblock-device-for-rootfs.patch delete mode 100644 target/linux/generic/patches-4.1/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch delete mode 100644 target/linux/generic/patches-4.1/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch delete mode 100644 target/linux/generic/patches-4.1/494-mtd-ubi-add-EOF-marker-support.patch delete mode 100644 target/linux/generic/patches-4.1/500-yaffs-Kbuild-integration.patch delete mode 100644 target/linux/generic/patches-4.1/502-yaffs-fix-compat-tags-handling.patch delete mode 100644 target/linux/generic/patches-4.1/503-yaffs-add-tags-9bytes-mount-option.patch delete mode 100644 target/linux/generic/patches-4.1/504-yaffs-3.16-new-fops.patch delete mode 100644 target/linux/generic/patches-4.1/505-yaffs-3.19-f_dentry-remove.patch delete mode 100644 target/linux/generic/patches-4.1/530-jffs2_make_lzma_available.patch delete mode 100644 target/linux/generic/patches-4.1/531-debloat_lzma.patch delete mode 100644 target/linux/generic/patches-4.1/532-jffs2_eofdetect.patch delete mode 100644 target/linux/generic/patches-4.1/540-crypto-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-4.1/551-ubifs-fix-default-compression-selection.patch delete mode 100644 target/linux/generic/patches-4.1/600-netfilter_conntrack_flush.patch delete mode 100644 target/linux/generic/patches-4.1/610-netfilter_match_bypass_default_checks.patch delete mode 100644 target/linux/generic/patches-4.1/611-netfilter_match_bypass_default_table.patch delete mode 100644 target/linux/generic/patches-4.1/612-netfilter_match_reduce_memory_access.patch delete mode 100644 target/linux/generic/patches-4.1/613-netfilter_optional_tcp_window_check.patch delete mode 100644 target/linux/generic/patches-4.1/615-netfilter_add_xt_id_match.patch delete mode 100644 target/linux/generic/patches-4.1/616-net_optimize_xfrm_calls.patch delete mode 100644 target/linux/generic/patches-4.1/630-packet_socket_type.patch delete mode 100644 target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch delete mode 100644 target/linux/generic/patches-4.1/641-bridge_always_accept_eap.patch delete mode 100644 target/linux/generic/patches-4.1/642-bridge_port_isolate.patch delete mode 100644 target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch delete mode 100644 target/linux/generic/patches-4.1/650-pppoe_header_pad.patch delete mode 100644 target/linux/generic/patches-4.1/651-wireless_mesh_header.patch delete mode 100644 target/linux/generic/patches-4.1/653-disable_netlink_trim.patch delete mode 100644 target/linux/generic/patches-4.1/655-increase_skb_pad.patch delete mode 100644 target/linux/generic/patches-4.1/656-skb_reduce_truesize-helper.patch delete mode 100644 target/linux/generic/patches-4.1/657-qdisc_reduce_truesize.patch delete mode 100644 target/linux/generic/patches-4.1/660-fq_codel_defaults.patch delete mode 100644 target/linux/generic/patches-4.1/661-fq_codel_keep_dropped_stats.patch delete mode 100644 target/linux/generic/patches-4.1/662-use_fq_codel_by_default.patch delete mode 100644 target/linux/generic/patches-4.1/663-remove_pfifo_fast.patch delete mode 100644 target/linux/generic/patches-4.1/664-codel_fix_3_12.patch delete mode 100644 target/linux/generic/patches-4.1/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch delete mode 100644 target/linux/generic/patches-4.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch delete mode 100644 target/linux/generic/patches-4.1/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch delete mode 100644 target/linux/generic/patches-4.1/680-NET-skip-GRO-for-foreign-MAC-addresses.patch delete mode 100644 target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch delete mode 100644 target/linux/generic/patches-4.1/700-swconfig.patch delete mode 100644 target/linux/generic/patches-4.1/701-phy_extension.patch delete mode 100644 target/linux/generic/patches-4.1/702-phy_add_aneg_done_function.patch delete mode 100644 target/linux/generic/patches-4.1/703-phy-add-detach-callback-to-struct-phy_driver.patch delete mode 100644 target/linux/generic/patches-4.1/704-phy-no-genphy-soft-reset.patch delete mode 100644 target/linux/generic/patches-4.1/710-phy-add-mdio_register_board_info.patch delete mode 100644 target/linux/generic/patches-4.1/720-phy_adm6996.patch delete mode 100644 target/linux/generic/patches-4.1/721-phy_packets.patch delete mode 100644 target/linux/generic/patches-4.1/722-phy_mvswitch.patch delete mode 100644 target/linux/generic/patches-4.1/723-phy_ip175c.patch delete mode 100644 target/linux/generic/patches-4.1/724-phy_ar8216.patch delete mode 100644 target/linux/generic/patches-4.1/725-phy_rtl8306.patch delete mode 100644 target/linux/generic/patches-4.1/726-phy_rtl8366.patch delete mode 100644 target/linux/generic/patches-4.1/727-phy-rtl8367.patch delete mode 100644 target/linux/generic/patches-4.1/728-phy-rtl8367b.patch delete mode 100644 target/linux/generic/patches-4.1/729-phy-tantos.patch delete mode 100644 target/linux/generic/patches-4.1/730-phy_b53.patch delete mode 100644 target/linux/generic/patches-4.1/732-phy-ar8216-led-support.patch delete mode 100644 target/linux/generic/patches-4.1/733-phy_mvsw61xx.patch delete mode 100644 target/linux/generic/patches-4.1/734-net-phy-at803x-allow-to-configure-via-pdata.patch delete mode 100644 target/linux/generic/patches-4.1/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch delete mode 100644 target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch delete mode 100644 target/linux/generic/patches-4.1/773-bgmac-add-srab-switch.patch delete mode 100644 target/linux/generic/patches-4.1/785-hso-support-0af0-9300.patch delete mode 100644 target/linux/generic/patches-4.1/810-pci_disable_common_quirks.patch delete mode 100644 target/linux/generic/patches-4.1/811-pci_disable_usb_common_quirks.patch delete mode 100644 target/linux/generic/patches-4.1/831-ledtrig_netdev.patch delete mode 100644 target/linux/generic/patches-4.1/834-ledtrig-libata.patch delete mode 100644 target/linux/generic/patches-4.1/840-rtc7301.patch delete mode 100644 target/linux/generic/patches-4.1/841-rtc_pt7c4338.patch delete mode 100644 target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch delete mode 100644 target/linux/generic/patches-4.1/862-gpio_spi_driver.patch delete mode 100644 target/linux/generic/patches-4.1/863-gpiommc.patch delete mode 100644 target/linux/generic/patches-4.1/864-gpiommc_configfs_locking.patch delete mode 100644 target/linux/generic/patches-4.1/870-hifn795x_byteswap.patch delete mode 100644 target/linux/generic/patches-4.1/880-gateworks_system_controller.patch delete mode 100644 target/linux/generic/patches-4.1/890-8250_optional_sysrq.patch delete mode 100644 target/linux/generic/patches-4.1/901-debloat_sock_diag.patch delete mode 100644 target/linux/generic/patches-4.1/902-debloat_proc.patch delete mode 100644 target/linux/generic/patches-4.1/903-debloat_direct_io.patch delete mode 100644 target/linux/generic/patches-4.1/904-debloat_dma_buf.patch delete mode 100644 target/linux/generic/patches-4.1/910-kobject_uevent.patch delete mode 100644 target/linux/generic/patches-4.1/911-kobject_add_broadcast_uevent.patch delete mode 100644 target/linux/generic/patches-4.1/921-use_preinit_as_init.patch delete mode 100644 target/linux/generic/patches-4.1/922-always-create-console-node-in-initramfs.patch delete mode 100644 target/linux/generic/patches-4.1/930-crashlog.patch delete mode 100644 target/linux/generic/patches-4.1/970-remove-unsane-filenames-from-deps_initramfs-list.patch delete mode 100644 target/linux/generic/patches-4.1/980-arm_openwrt_machtypes.patch delete mode 100644 target/linux/generic/patches-4.1/995-mangle_bootargs.patch delete mode 100644 target/linux/generic/patches-4.1/997-device_tree_cmdline.patch delete mode 100644 target/linux/generic/patches-4.1/998-enable_wilink_platform_without_drivers.patch rename target/linux/generic/patches-4.4/{040-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch => 040-0001-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch} (100%) rename target/linux/generic/patches-4.4/{041-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch => 040-0002-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch} (100%) rename target/linux/generic/patches-4.4/{142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch => 041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch} (87%) create mode 100644 target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch create mode 100644 target/linux/generic/patches-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch create mode 100644 target/linux/generic/patches-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch create mode 100644 target/linux/generic/patches-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch create mode 100644 target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch create mode 100644 target/linux/generic/patches-4.4/105-add-linux-spidev-compatible.patch create mode 100644 target/linux/generic/patches-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch create mode 100644 target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch create mode 100644 target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch create mode 100644 target/linux/generic/patches-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch delete mode 100644 target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-4.4/615-netfilter_add_xt_id_match.patch delete mode 100644 target/linux/generic/patches-4.4/785-hso-support-0af0-9300.patch delete mode 100644 target/linux/generic/patches-4.4/863-gpiommc.patch delete mode 100644 target/linux/generic/patches-4.4/864-gpiommc_configfs_locking.patch delete mode 100644 target/linux/generic/patches-4.4/870-hifn795x_byteswap.patch delete mode 100644 target/linux/generic/patches-4.4/880-gateworks_system_controller.patch create mode 100644 target/linux/ramips/Makefile create mode 100755 target/linux/ramips/base-files/etc/board.d/01_leds create mode 100755 target/linux/ramips/base-files/etc/board.d/02_network create mode 100644 target/linux/ramips/base-files/etc/diag.sh create mode 100644 target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom create mode 100644 target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion create mode 100755 target/linux/ramips/base-files/etc/init.d/bootcount create mode 100755 target/linux/ramips/base-files/etc/init.d/enablemodem create mode 100644 target/linux/ramips/base-files/etc/inittab create mode 100644 target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header create mode 100644 target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh create mode 100644 target/linux/ramips/base-files/lib/preinit/04_handle_checksumming create mode 100644 target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips create mode 100755 target/linux/ramips/base-files/lib/ramips.sh create mode 100755 target/linux/ramips/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/ramips/base-files/lib/upgrade/ubnt.sh create mode 100755 target/linux/ramips/base-files/sbin/fixup-mac-address create mode 100644 target/linux/ramips/dts/11ACNAS.dts create mode 100644 target/linux/ramips/dts/3G-6200N.dts create mode 100644 target/linux/ramips/dts/3G-6200NL.dts create mode 100644 target/linux/ramips/dts/3G150B.dts create mode 100644 target/linux/ramips/dts/3G300M.dts create mode 100644 target/linux/ramips/dts/A5-V11.dts create mode 100644 target/linux/ramips/dts/AC1200pro.dts create mode 100644 target/linux/ramips/dts/AI-BR100.dts create mode 100644 target/linux/ramips/dts/AIR3GII.dts create mode 100644 target/linux/ramips/dts/ALL0239-3G.dts create mode 100644 target/linux/ramips/dts/ALL0256N-4M.dts create mode 100644 target/linux/ramips/dts/ALL0256N-8M.dts create mode 100644 target/linux/ramips/dts/ALL5002.dts create mode 100644 target/linux/ramips/dts/ALL5003.dts create mode 100644 target/linux/ramips/dts/AR670W.dts create mode 100644 target/linux/ramips/dts/AR725W.dts create mode 100644 target/linux/ramips/dts/ASL26555-16M.dts create mode 100644 target/linux/ramips/dts/ASL26555-8M.dts create mode 100644 target/linux/ramips/dts/ATP-52B.dts create mode 100644 target/linux/ramips/dts/AWAPN2403.dts create mode 100644 target/linux/ramips/dts/AWM002-4M.dtsi create mode 100644 target/linux/ramips/dts/AWM002-8M.dtsi create mode 100644 target/linux/ramips/dts/AWM002-EVB-4M.dts create mode 100644 target/linux/ramips/dts/AWM002-EVB-8M.dts create mode 100644 target/linux/ramips/dts/AWM002.dtsi create mode 100644 target/linux/ramips/dts/AWM003-EVB.dts create mode 100644 target/linux/ramips/dts/ArcherC20i.dts create mode 100644 target/linux/ramips/dts/ArcherC50.dts create mode 100644 target/linux/ramips/dts/ArcherMR200.dts create mode 100644 target/linux/ramips/dts/BC2.dts create mode 100644 target/linux/ramips/dts/BR-6425.dts create mode 100644 target/linux/ramips/dts/BR-6475ND.dts create mode 100644 target/linux/ramips/dts/BROADWAY.dts create mode 100644 target/linux/ramips/dts/CARAMBOLA.dts create mode 100644 target/linux/ramips/dts/CF-WR800N.dts create mode 100644 target/linux/ramips/dts/CS-QR10.dts create mode 100644 target/linux/ramips/dts/CY-SWR1100.dts create mode 100644 target/linux/ramips/dts/D105.dts create mode 100644 target/linux/ramips/dts/DAP-1350.dts create mode 100644 target/linux/ramips/dts/DB-WRT01.dts create mode 100644 target/linux/ramips/dts/DCH-M225.dts create mode 100644 target/linux/ramips/dts/DCS-930.dts create mode 100644 target/linux/ramips/dts/DCS-930L-B1.dts create mode 100644 target/linux/ramips/dts/DIR-300-B1.dts create mode 100644 target/linux/ramips/dts/DIR-300-B7.dts create mode 100644 target/linux/ramips/dts/DIR-320-B1.dts create mode 100644 target/linux/ramips/dts/DIR-600-B1.dts create mode 100644 target/linux/ramips/dts/DIR-610-A1.dts create mode 100644 target/linux/ramips/dts/DIR-615-D.dts create mode 100644 target/linux/ramips/dts/DIR-615-H1.dts create mode 100644 target/linux/ramips/dts/DIR-620-A1.dts create mode 100644 target/linux/ramips/dts/DIR-620-D1.dts create mode 100644 target/linux/ramips/dts/DIR-645.dts create mode 100644 target/linux/ramips/dts/DIR-810L.dts create mode 100644 target/linux/ramips/dts/DIR-860L-B1.dts create mode 100644 target/linux/ramips/dts/DUZUN-DM06.dts create mode 100644 target/linux/ramips/dts/DWR-512-B.dts create mode 100644 target/linux/ramips/dts/E1700.dts create mode 100644 target/linux/ramips/dts/ESR-9753.dts create mode 100644 target/linux/ramips/dts/EX2700.dts create mode 100644 target/linux/ramips/dts/F5D8235_V1.dts create mode 100644 target/linux/ramips/dts/F5D8235_V2.dts create mode 100644 target/linux/ramips/dts/F7C027.dts create mode 100644 target/linux/ramips/dts/FIREWRT.dts create mode 100644 target/linux/ramips/dts/FONERA20N.dts create mode 100644 target/linux/ramips/dts/FREESTATION5.dts create mode 100644 target/linux/ramips/dts/GL-MT300A.dts create mode 100644 target/linux/ramips/dts/GL-MT300N.dts create mode 100644 target/linux/ramips/dts/GL-MT750.dts create mode 100644 target/linux/ramips/dts/HC5661.dts create mode 100644 target/linux/ramips/dts/HC5761.dts create mode 100644 target/linux/ramips/dts/HC5861.dts create mode 100644 target/linux/ramips/dts/HC5XXX.dtsi create mode 100644 target/linux/ramips/dts/HG255D.dts create mode 100644 target/linux/ramips/dts/HLKRM04.dts create mode 100644 target/linux/ramips/dts/HPM.dts create mode 100644 target/linux/ramips/dts/HT-TM02.dts create mode 100644 target/linux/ramips/dts/HW550-3G.dts create mode 100644 target/linux/ramips/dts/IP2202.dts create mode 100644 target/linux/ramips/dts/JHR-N805R.dts create mode 100644 target/linux/ramips/dts/JHR-N825R.dts create mode 100644 target/linux/ramips/dts/JHR-N926R.dts create mode 100644 target/linux/ramips/dts/LINKIT7688.dts create mode 100644 target/linux/ramips/dts/M2M.dts create mode 100644 target/linux/ramips/dts/M3.dts create mode 100644 target/linux/ramips/dts/M4-4M.dts create mode 100644 target/linux/ramips/dts/M4-8M.dts create mode 100644 target/linux/ramips/dts/MAC1200RV2.dts create mode 100644 target/linux/ramips/dts/MINIEMBPLUG.dts create mode 100644 target/linux/ramips/dts/MINIEMBWIFI.dts create mode 100644 target/linux/ramips/dts/MIWIFI-MINI.dts create mode 100644 target/linux/ramips/dts/MIWIFI-NANO.dts create mode 100644 target/linux/ramips/dts/MLW221.dts create mode 100644 target/linux/ramips/dts/MLWG2.dts create mode 100644 target/linux/ramips/dts/MOFI3500-3GN.dts create mode 100644 target/linux/ramips/dts/MPRA1.dts create mode 100644 target/linux/ramips/dts/MPRA2.dts create mode 100644 target/linux/ramips/dts/MR-102N.dts create mode 100644 target/linux/ramips/dts/MT7620a.dts create mode 100644 target/linux/ramips/dts/MT7620a_MT7530.dts create mode 100644 target/linux/ramips/dts/MT7620a_MT7610e.dts create mode 100644 target/linux/ramips/dts/MT7620a_V22SG.dts create mode 100644 target/linux/ramips/dts/MT7621.dts create mode 100644 target/linux/ramips/dts/MT7628.dts create mode 100644 target/linux/ramips/dts/MZK-750DHP.dts create mode 100644 target/linux/ramips/dts/MZK-DP150N.dts create mode 100644 target/linux/ramips/dts/MZK-EX300NP.dts create mode 100644 target/linux/ramips/dts/MZK-EX750NP.dts create mode 100644 target/linux/ramips/dts/MZK-W300NH2.dts create mode 100644 target/linux/ramips/dts/MZK-WDPR.dts create mode 100644 target/linux/ramips/dts/MicroWRT.dts create mode 100644 target/linux/ramips/dts/NA930.dts create mode 100644 target/linux/ramips/dts/NBG-419N.dts create mode 100644 target/linux/ramips/dts/NBG-419N2.dts create mode 100644 target/linux/ramips/dts/NCS601W.dts create mode 100644 target/linux/ramips/dts/NIXCORE-16M.dts create mode 100644 target/linux/ramips/dts/NIXCORE-8M.dts create mode 100644 target/linux/ramips/dts/NIXCORE.dtsi create mode 100644 target/linux/ramips/dts/NW718.dts create mode 100644 target/linux/ramips/dts/Newifi-D1.dts create mode 100644 target/linux/ramips/dts/OY-0001.dts create mode 100644 target/linux/ramips/dts/PBR-D1.dts create mode 100644 target/linux/ramips/dts/PBR-M1.dts create mode 100644 target/linux/ramips/dts/PSG1208.dts create mode 100644 target/linux/ramips/dts/PSG1218.dts create mode 100644 target/linux/ramips/dts/PSR-680W.dts create mode 100644 target/linux/ramips/dts/PWH2004.dts create mode 100644 target/linux/ramips/dts/PX-4885-4M.dts create mode 100644 target/linux/ramips/dts/PX-4885-8M.dts create mode 100644 target/linux/ramips/dts/PX-4885.dtsi create mode 100644 target/linux/ramips/dts/RB750Gr3.dts create mode 100644 target/linux/ramips/dts/RE6500.dts create mode 100644 target/linux/ramips/dts/RP-N53.dts create mode 100644 target/linux/ramips/dts/RT-G32-B1.dts create mode 100644 target/linux/ramips/dts/RT-N10-PLUS.dts create mode 100644 target/linux/ramips/dts/RT-N13U.dts create mode 100644 target/linux/ramips/dts/RT-N14U.dts create mode 100644 target/linux/ramips/dts/RT-N15.dts create mode 100644 target/linux/ramips/dts/RT-N56U.dts create mode 100644 target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts create mode 100644 target/linux/ramips/dts/RT5350F-OLINUXINO.dts create mode 100644 target/linux/ramips/dts/RUT5XX.dts create mode 100644 target/linux/ramips/dts/SAP-G3200U3.dts create mode 100644 target/linux/ramips/dts/SK-WB8.dts create mode 100644 target/linux/ramips/dts/SL-R7205.dts create mode 100644 target/linux/ramips/dts/TEW-691GR.dts create mode 100644 target/linux/ramips/dts/TEW-692GR.dts create mode 100644 target/linux/ramips/dts/TEW-714TRU.dts create mode 100644 target/linux/ramips/dts/TINY-AC.dts create mode 100644 target/linux/ramips/dts/Timecloud.dts create mode 100644 target/linux/ramips/dts/UBNT-ERX.dts create mode 100644 target/linux/ramips/dts/UR-326N4G.dts create mode 100644 target/linux/ramips/dts/UR-336UN.dts create mode 100644 target/linux/ramips/dts/V11STFE.dts create mode 100644 target/linux/ramips/dts/V22RW-2X2.dts create mode 100644 target/linux/ramips/dts/VOCORE-16M.dts create mode 100644 target/linux/ramips/dts/VOCORE-8M.dts create mode 100644 target/linux/ramips/dts/VOCORE.dtsi create mode 100644 target/linux/ramips/dts/VR500.dts create mode 100644 target/linux/ramips/dts/W150M.dts create mode 100644 target/linux/ramips/dts/W2914NSV2.dts create mode 100644 target/linux/ramips/dts/W2914NSV2.dtsi create mode 100644 target/linux/ramips/dts/W306R_V20.dts create mode 100644 target/linux/ramips/dts/W502U.dts create mode 100644 target/linux/ramips/dts/WCR150GN.dts create mode 100644 target/linux/ramips/dts/WF-2881.dts create mode 100644 target/linux/ramips/dts/WHR-1166D.dts create mode 100644 target/linux/ramips/dts/WHR-300HP2.dts create mode 100644 target/linux/ramips/dts/WHR-600D.dts create mode 100644 target/linux/ramips/dts/WHR-G300N.dts create mode 100644 target/linux/ramips/dts/WIDORA-NEO.dts create mode 100644 target/linux/ramips/dts/WITI.dts create mode 100644 target/linux/ramips/dts/WIZARD8800.dts create mode 100644 target/linux/ramips/dts/WIZFI630A.dts create mode 100644 target/linux/ramips/dts/WL-330N.dts create mode 100644 target/linux/ramips/dts/WL-330N3G.dts create mode 100644 target/linux/ramips/dts/WL-341V3.dts create mode 100644 target/linux/ramips/dts/WL-351.dts create mode 100644 target/linux/ramips/dts/WL-WN575A3.dts create mode 100644 target/linux/ramips/dts/WLI-TX4-AG300N.dts create mode 100644 target/linux/ramips/dts/WLR-6000.dts create mode 100644 target/linux/ramips/dts/WMR-300.dts create mode 100644 target/linux/ramips/dts/WNCE2001.dts create mode 100644 target/linux/ramips/dts/WNDR3700V5.dts create mode 100644 target/linux/ramips/dts/WR512-3GN-4M.dts create mode 100644 target/linux/ramips/dts/WR512-3GN-8M.dts create mode 100644 target/linux/ramips/dts/WR6202.dts create mode 100644 target/linux/ramips/dts/WRH-300CR.dts create mode 100644 target/linux/ramips/dts/WRTNODE.dts create mode 100644 target/linux/ramips/dts/WRTNODE2.dtsi create mode 100644 target/linux/ramips/dts/WRTNODE2P.dts create mode 100644 target/linux/ramips/dts/WRTNODE2R.dts create mode 100644 target/linux/ramips/dts/WSR-1166.dts create mode 100644 target/linux/ramips/dts/WSR-600.dts create mode 100644 target/linux/ramips/dts/WT1520-4M.dts create mode 100644 target/linux/ramips/dts/WT1520-8M.dts create mode 100644 target/linux/ramips/dts/WT1520.dtsi create mode 100644 target/linux/ramips/dts/WT3020-4M.dts create mode 100644 target/linux/ramips/dts/WT3020-8M.dts create mode 100644 target/linux/ramips/dts/WZR-AGL300NH.dts create mode 100644 target/linux/ramips/dts/X5.dts create mode 100644 target/linux/ramips/dts/X8.dts create mode 100644 target/linux/ramips/dts/XDXRN502J.dts create mode 100644 target/linux/ramips/dts/Y1.dts create mode 100644 target/linux/ramips/dts/Y1.dtsi create mode 100644 target/linux/ramips/dts/Y1S.dts create mode 100644 target/linux/ramips/dts/YOUKU-YK1.dts create mode 100644 target/linux/ramips/dts/ZBT-APE522II.dts create mode 100644 target/linux/ramips/dts/ZBT-CPE102.dts create mode 100644 target/linux/ramips/dts/ZBT-WA05.dts create mode 100644 target/linux/ramips/dts/ZBT-WE826.dts create mode 100644 target/linux/ramips/dts/ZBT-WG2626.dts create mode 100644 target/linux/ramips/dts/ZBT-WG3526.dts create mode 100644 target/linux/ramips/dts/ZBT-WG3526.dtsi create mode 100644 target/linux/ramips/dts/ZBT-WR8305RT.dts create mode 100644 target/linux/ramips/dts/ZTE-Q7.dts create mode 100644 target/linux/ramips/dts/kn_rc.dts create mode 100644 target/linux/ramips/dts/kn_rf.dts create mode 100644 target/linux/ramips/dts/kng_rc.dts create mode 100644 target/linux/ramips/dts/mt7620a.dtsi create mode 100644 target/linux/ramips/dts/mt7620n.dtsi create mode 100644 target/linux/ramips/dts/mt7621.dtsi create mode 100644 target/linux/ramips/dts/mt7628an.dtsi create mode 100644 target/linux/ramips/dts/rt2880.dtsi create mode 100644 target/linux/ramips/dts/rt3050.dtsi create mode 100644 target/linux/ramips/dts/rt3352.dtsi create mode 100644 target/linux/ramips/dts/rt3883.dtsi create mode 100644 target/linux/ramips/dts/rt5350.dtsi create mode 100644 target/linux/ramips/image/Makefile create mode 100644 target/linux/ramips/image/ex2700-fakeroot.uImage create mode 100644 target/linux/ramips/image/lzma-loader/Makefile create mode 100644 target/linux/ramips/image/lzma-loader/src/LzmaDecode.c create mode 100644 target/linux/ramips/image/lzma-loader/src/LzmaDecode.h create mode 100644 target/linux/ramips/image/lzma-loader/src/LzmaTypes.h create mode 100644 target/linux/ramips/image/lzma-loader/src/Makefile create mode 100644 target/linux/ramips/image/lzma-loader/src/board-ralink.c create mode 100644 target/linux/ramips/image/lzma-loader/src/cache.c create mode 100644 target/linux/ramips/image/lzma-loader/src/cache.h create mode 100644 target/linux/ramips/image/lzma-loader/src/cacheops.h create mode 100644 target/linux/ramips/image/lzma-loader/src/config.h create mode 100644 target/linux/ramips/image/lzma-loader/src/cp0regdef.h create mode 100644 target/linux/ramips/image/lzma-loader/src/head.S create mode 100644 target/linux/ramips/image/lzma-loader/src/lantiq.mk create mode 100644 target/linux/ramips/image/lzma-loader/src/loader.c create mode 100644 target/linux/ramips/image/lzma-loader/src/loader.lds create mode 100644 target/linux/ramips/image/lzma-loader/src/loader2.lds create mode 100644 target/linux/ramips/image/lzma-loader/src/lzma-data.lds create mode 100644 target/linux/ramips/image/lzma-loader/src/printf.c create mode 100644 target/linux/ramips/image/lzma-loader/src/printf.h create mode 100644 target/linux/ramips/image/lzma-loader/src/ralink.mk create mode 100644 target/linux/ramips/image/mt7628.mk create mode 100644 target/linux/ramips/image/mt7688.mk create mode 100644 target/linux/ramips/image/rt288x.mk create mode 100644 target/linux/ramips/image/rt305x-legacy.mk create mode 100644 target/linux/ramips/image/rt305x.mk create mode 100644 target/linux/ramips/image/rt3883.mk create mode 100644 target/linux/ramips/modules.mk create mode 100644 target/linux/ramips/patches-4.4/0001-arch-mips-ralink-add-mt7621-support.patch create mode 100644 target/linux/ramips/patches-4.4/0002-MIPS-ralink-add-MT7621-defconfig.patch create mode 100644 target/linux/ramips/patches-4.4/0004-MIPS-ralink-add-MT7621-pcie-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch create mode 100644 target/linux/ramips/patches-4.4/0006-MIPS-ralink-add-cpu-frequency-scaling.patch create mode 100644 target/linux/ramips/patches-4.4/0007-MIPS-ralink-copy-the-commandline-from-the-devicetree.patch create mode 100644 target/linux/ramips/patches-4.4/0009-PCI-MIPS-adds-mt7620a-pcie-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch create mode 100644 target/linux/ramips/patches-4.4/0013-owrt-hack-fix-mt7688-cache-issue.patch create mode 100644 target/linux/ramips/patches-4.4/0014-arch-mips-cleanup-cevt-rt3352.patch create mode 100644 target/linux/ramips/patches-4.4/0015-arch-mips-do-not-select-illegal-access-driver-by-def.patch create mode 100644 target/linux/ramips/patches-4.4/0019-arch-mips-ralink-add-mt7621-cpu-feature-overrides.patch create mode 100644 target/linux/ramips/patches-4.4/0022-MIPS-ralink-Fix-vendor-string-for-mt7620.patch create mode 100644 target/linux/ramips/patches-4.4/0024-GPIO-add-named-gpio-exports.patch create mode 100644 target/linux/ramips/patches-4.4/0025-pinctrl-ralink-add-pinctrl-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0026-DT-Add-documentation-for-gpio-ralink.patch create mode 100644 target/linux/ramips/patches-4.4/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch create mode 100644 target/linux/ramips/patches-4.4/0028-GPIO-ralink-add-mt7621-gpio-controller.patch create mode 100644 target/linux/ramips/patches-4.4/0029-phy-usb-add-ralink-phy.patch create mode 100644 target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch create mode 100644 target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch create mode 100644 target/linux/ramips/patches-4.4/0033-xhci-mediatek-support-MTK-xHCI-host-controller.patch create mode 100644 target/linux/ramips/patches-4.4/0034-NET-multi-phy-support.patch create mode 100644 target/linux/ramips/patches-4.4/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch create mode 100644 target/linux/ramips/patches-4.4/0037-mtd-cfi-cmdset-0002-force-word-write.patch create mode 100644 target/linux/ramips/patches-4.4/0038-mtd-ralink-add-mt7620-nand-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0039-mtd-add-mt7621-nand-support.patch create mode 100644 target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch create mode 100644 target/linux/ramips/patches-4.4/0041-DT-Add-documentation-for-spi-rt2880.patch create mode 100644 target/linux/ramips/patches-4.4/0042-SPI-ralink-add-Ralink-SoC-spi-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0043-spi-add-mt7621-support.patch create mode 100644 target/linux/ramips/patches-4.4/0044-i2c-MIPS-adds-ralink-I2C-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0045-i2c-add-mt7621-driver.patch create mode 100644 target/linux/ramips/patches-4.4/0046-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch create mode 100644 target/linux/ramips/patches-4.4/0047-DMA-ralink-add-rt2880-dma-engine.patch create mode 100644 target/linux/ramips/patches-4.4/0048-asoc-add-mt7620-support.patch create mode 100644 target/linux/ramips/patches-4.4/0049-watchdog-add-MT7621-support.patch create mode 100644 target/linux/ramips/patches-4.4/0051-serial-add-ugly-custom-baud-rate-hack.patch create mode 100644 target/linux/ramips/patches-4.4/0052-pwm-add-mediatek-support.patch create mode 100644 target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch create mode 100644 target/linux/ramips/patches-4.4/0059-correct-CPC_BASE_MASK.patch create mode 100644 target/linux/ramips/patches-4.4/0063-set-CM_GCR_BASE_CMDEFTGT_MEM-according-to-datasheet.patch create mode 100644 target/linux/ramips/patches-4.4/0064-add_clk_round_rate.patch create mode 100644 target/linux/ramips/patches-4.4/0065-MIPS-ralink-MT7688-pinmux-fixes.patch create mode 100644 target/linux/ramips/patches-4.4/0066-mt7621-enable-highmem.patch create mode 100644 target/linux/ramips/patches-4.4/0067-enable-mt7621-xhci.patch create mode 100644 target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c create mode 100644 target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch create mode 100644 target/linux/ramips/patches-4.4/0080-MIPS-ralink-fix-USB-frequency-scaling.patch create mode 100644 target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch create mode 100644 target/linux/ramips/patches-4.4/0082-MIPS-ralink-fix-MT7628-pinmux-typos.patch create mode 100644 target/linux/ramips/patches-4.4/0083-MIPS-ralink-fix-MT7628-wled_an-pinmux-gpio.patch create mode 100644 target/linux/ramips/patches-4.4/0084-MIPS-ralink-add-MT7628-EPHY-LEDs-pinmux-support.patch create mode 100644 target/linux/ramips/patches-4.4/0085-pinmux-util.patch create mode 100644 target/linux/ramips/patches-4.4/0086-usbphy.patch create mode 100644 target/linux/ramips/patches-4.4/0103-MIPS-OWRTDTB.patch create mode 100644 target/linux/ramips/patches-4.4/0104-fix_bootargs_handling.patch create mode 100644 target/linux/ramips/patches-4.4/0105-set_mt7621_soc_type.patch create mode 100644 target/linux/ramips/patches-4.4/0200-linkit_bootstrap.patch create mode 100644 target/linux/ramips/patches-4.4/0500-Documentation-DT-net-add-docs-for-ralink-mediatek-So.patch create mode 100644 target/linux/ramips/patches-4.4/0501-net-next-mediatek-add-the-drivers-core-files.patch create mode 100644 target/linux/ramips/patches-4.4/0502-net-next-mediatek-add-switch-driver-for-rt3050.patch create mode 100644 target/linux/ramips/patches-4.4/0503-net-next-mediatek-add-switch-driver-for-mt7620.patch create mode 100644 target/linux/ramips/patches-4.4/0504-net-next-mediatek-add-switch-driver-for-mt7621.patch create mode 100644 target/linux/ramips/patches-4.4/0505-net-next-mediatek-add-support-for-rt2880.patch create mode 100644 target/linux/ramips/patches-4.4/0506-net-next-mediatek-add-support-for-rt3050.patch create mode 100644 target/linux/ramips/patches-4.4/0507-net-next-mediatek-add-support-for-rt3883.patch create mode 100644 target/linux/ramips/patches-4.4/0508-net-next-mediatek-add-support-for-mt7620.patch create mode 100644 target/linux/ramips/patches-4.4/0509-net-next-mediatek-add-support-for-mt7621.patch create mode 100644 target/linux/ramips/patches-4.4/0510-net-next-mediatek-add-Kconfig-and-Makefile.patch create mode 100644 target/linux/ramips/patches-4.4/0511-net-mediatek-add-support-for-the-multiphy-carrier-pa.patch create mode 100644 target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch create mode 100644 target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch create mode 100644 target/linux/ramips/patches-4.4/0514-net-mediatek-fix_esw.patch create mode 100644 target/linux/ramips/patches-4.4/0515-net-mediatek-fix-multicast-icmpv6-for-the-rt3050-eth.patch create mode 100644 target/linux/ramips/patches-4.4/0516-Documentation-DT-net-mediatek-fix-documentation-for-.patch create mode 100644 target/linux/ramips/patches-4.4/0517-net-mediatek-fix-comment-in-rt3050-ethernet-switch-d.patch create mode 100644 target/linux/ramips/patches-4.4/0518-net-mediatek-get-rt3050-ethernet-ports-to-be-disable.patch create mode 100644 target/linux/ramips/patches-4.4/0519-gsw_mt7621.patch create mode 100644 target/linux/ramips/patches-4.4/0520-esw-gmac.patch create mode 100644 target/linux/ramips/patches-4.4/0601-net-mediatke-add-phy_ethtool_ioctl-support.patch create mode 100644 target/linux/ramips/patches-4.4/0700-pinctrl-mt7620-mdio-as-refclk.patch create mode 100644 target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch create mode 100644 target/linux/ramips/patches-4.4/0721-asoc-enable-wm8960-kconfig.patch create mode 100644 target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch create mode 100644 target/linux/ramips/patches-4.4/100-mt7621-core-detect-hack.patch create mode 100644 target/linux/ramips/rt288x/config-4.4 create mode 100644 target/linux/ramips/rt288x/target.mk create mode 100644 target/linux/ramips/rt305x/config-4.4 create mode 100644 target/linux/ramips/rt305x/profiles/00-default.mk create mode 100644 target/linux/ramips/rt305x/target.mk create mode 100644 target/linux/ramips/rt3883/config-4.4 rename target/linux/{sunxi/profiles/01-default.mk => ramips/rt3883/profiles/00-default.mk} (68%) create mode 100644 target/linux/ramips/rt3883/target.mk delete mode 100644 target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh create mode 100644 target/linux/sunxi/base-files/lib/preinit/79_move_config create mode 100644 target/linux/sunxi/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/sunxi/profiles/00-default.mk delete mode 100644 target/linux/sunxi/profiles/a10-olinuxino.mk delete mode 100644 target/linux/sunxi/profiles/a13-olimex-som.mk delete mode 100644 target/linux/sunxi/profiles/a13-olinuxino.mk delete mode 100644 target/linux/sunxi/profiles/a20-olinuxino.mk delete mode 100644 target/linux/sunxi/profiles/bananapi.mk delete mode 100644 target/linux/sunxi/profiles/bananapro.mk delete mode 100644 target/linux/sunxi/profiles/cubieboard.mk delete mode 100644 target/linux/sunxi/profiles/cubieboard2.mk delete mode 100644 target/linux/sunxi/profiles/cubietruck.mk delete mode 100644 target/linux/sunxi/profiles/lamobo-r1.mk delete mode 100644 target/linux/sunxi/profiles/mele_m9.mk delete mode 100644 target/linux/sunxi/profiles/orangepi_plus.mk delete mode 100644 target/linux/sunxi/profiles/pcduino.mk delete mode 100644 target/linux/sunxi/profiles/pcduino3.mk create mode 100644 target/linux/x86/modules.mk create mode 100644 toolchain/gcc/patches/5.4.0/881-no_tm_section.patch rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/001-revert_register_mode_search.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/002-case_insensitive.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/010-documentation.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/100-uclibc-conf.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/230-musl_libssp.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/280-musl-disable-ifunc-by-default.patch (81%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/300-mips_Os_cpu_rtx_cost_model.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/800-arm_v5te_no_ldrd_strd.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/810-arm-softfloat-libgcc.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/820-libgcc_pic.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/830-arm_unbreak_armv4t.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/840-armv4_pass_fix-v4bx_to_ld.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/850-use_shared_libgcc.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/851-libgcc_no_compat.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/870-ppc_no_crtsavres.patch (84%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/880-no_java_section.patch (100%) create mode 100644 toolchain/gcc/patches/6.3.0/881-no_tm_section.patch rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/900-bad-mips16-crt.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/910-mbsd_multi.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/920-specs_nonfatal_getenv.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/930-fix-mips-noexecstack.patch (100%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/940-no-clobber-stamp-bits.patch (87%) rename toolchain/gcc/patches/{6.2.0 => 6.3.0}/950-cpp_file_path_translation.patch (100%) create mode 100644 toolchain/musl/patches/005-fix-asctime-day-month-names-not-to-vary-by-locale.patch create mode 100644 toolchain/musl/patches/015-fix-pread-pwrite-syscall-calling-convention-on-sh.patch create mode 100644 toolchain/musl/patches/020-verify-that-ttyname-refers-to-the-same-file-as-the-fd.patch create mode 100644 toolchain/musl/patches/025-fix-ffsync-by-changing-it-to-osync.patch create mode 100644 toolchain/musl/patches/028-fix-printf-regression-with-alt-form-octal-zero-flag-and-field-width.patch create mode 100644 toolchain/musl/patches/029-fix-ifru_data-and-ifcu_buf-types-in-net-if.h.patch create mode 100644 toolchain/musl/patches/030-fix-if_indextoname-error-case.patch create mode 100644 toolchain/musl/patches/031-add-missing-unlocked-and-wcsftime_l-prototypes-to-wchar-header.patch create mode 100644 toolchain/musl/patches/033-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch create mode 100644 toolchain/musl/patches/035-fix-getservby_r-result-pointer-value-on-error.patch create mode 100644 toolchain/musl/patches/036-fix-strftime-y-for-negative-tm_year.patch create mode 100644 toolchain/musl/patches/037-fix-missing-integer-overflow-checks-in-regexec-buffer-size-computations.patch create mode 100644 toolchain/musl/patches/038-fix-regexec-with-haystack-strings-longer-than-int_max.patch create mode 100644 toolchain/musl/patches/039-fix-integer-overflow-in-float-printf-needed-precision-computation.patch create mode 100644 toolchain/musl/patches/040-fix-integer-overflows-and-uncaught-eoverflow-in-printf-core.patch create mode 100644 toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch create mode 100644 toolchain/musl/patches/049-fix-clock_nanosleep-error-case.patch create mode 100644 toolchain/musl/patches/050-add-pthread_setname_np.patch create mode 100644 toolchain/musl/patches/051-fix-float-formatting-of-some-exact-halfway-cases.patch create mode 100644 toolchain/musl/patches/052-fix-getopt_long_only-misinterpreting-as-an-option.patch create mode 100644 toolchain/musl/patches/053-fix-gratuitous-undefined-behavior-in-strptime.patch create mode 100644 toolchain/musl/patches/054-fix-strtod-and-strtof-rounding-with-many-trailing-zeros.patch create mode 100644 toolchain/musl/patches/055-fix-strtod-int-optimization-in-non-nearest-rounding-mode.patch create mode 100644 toolchain/musl/patches/065-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch create mode 100644 toolchain/musl/patches/066-fix-swprintf-internal-buffer-state-and-error-handling.patch create mode 100644 toolchain/musl/patches/071-fix-build-regression-on-archs-with-variable-page-size.patch rename toolchain/musl/patches/{040-Add-format-attribute-to-some-function-declarations.patch => 099-Add-format-attribute-to-some-function-declarations.patch} (100%) delete mode 100644 tools/cloog/Makefile rename tools/cmake/patches/{150-libarchive-fix-libressl-compat.patch => 130-libarchive-fix-libressl-compat.patch} (100%) delete mode 100644 tools/cmake/patches/130-upstream-libarchive-openssl-compat-headers.patch create mode 100644 tools/cmake/patches/140-curl-fix-libressl-linking.patch delete mode 100644 tools/cmake/patches/140-upstream-libarchive-openssl-1.1.x-support.patch create mode 100644 tools/firmware-utils/src/mktplinkfw-kernel.c create mode 100644 tools/kernel2minor/patches/100-portability.patch create mode 100644 tools/kernel2minor/patches/110-fix_endian_conv.patch create mode 100644 tools/kernel2minor/patches/120-fix_create_mode.patch delete mode 100644 tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch delete mode 100644 tools/ppl/Makefile delete mode 100644 tools/ppl/patches/001-disable-serial-tests.patch create mode 100644 tools/tar/patches/100-symlink-force-root-name.patch delete mode 100644 tools/yaffs2/Makefile delete mode 100644 tools/yaffs2/patches/100-compile.patch delete mode 100644 tools/yaffs2/patches/110-openbsd-compat.patch diff --git a/Makefile b/Makefile index febb1c8d15..5b7fdc963f 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUI $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-install): $(package/stamp-compile) $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) +check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check) printdb: @true @@ -86,9 +87,14 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages checksum: FORCE $(call sha256sums,$(BIN_DIR)) +diffconfig: FORCE + mkdir -p $(BIN_DIR) + $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed + prepare: .config $(tools/stamp-install) $(toolchain/stamp-install) world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE $(_SINGLE)$(SUBMAKE) -r package/index + $(_SINGLE)$(SUBMAKE) -r diffconfig $(_SINGLE)$(SUBMAKE) -r checksum .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean diff --git a/config/Config-build.in b/config/Config-build.in index 7c82e8b3b7..9b8e4b2283 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -87,59 +87,6 @@ menu "Global build settings" help Enables IPv6 support in kernel (builtin) and packages. - config PKG_BUILD_PARALLEL - bool - prompt "Compile certain packages parallelized" - default y - help - This adds a -jX option to certain packages that are known to behave well - for parallel build. By default, the package make processes use the main - jobserver, in which case this option only takes effect when you add -jX - to the make command. - - If you are unsure, select N. - - config PKG_BUILD_USE_JOBSERVER - bool - prompt "Use top-level make jobserver for packages" - depends on PKG_BUILD_PARALLEL - default y - help - This passes the main make process jobserver fds to package builds, - enabling full parallelization across different packages. - - Note that disabling this may overcommit CPU resources depending on the - -j level of the main make process, the number of package submake jobs - selected below and the number of actual CPUs present. - Example: If the main make is passed a -j4 and the submake -j - is also set to 4, we may end up with 16 parallel make processes - in the worst case. - - config PKG_BUILD_JOBS - int - prompt "Number of package submake jobs (2-512)" - range 2 512 - default 2 - depends on PKG_BUILD_PARALLEL && !PKG_BUILD_USE_JOBSERVER - help - The number of jobs (-jX) to pass to packages submake. - - config PKG_DEFAULT_PARALLEL - bool - prompt "Parallelize the default package build rule (May break build)" - depends on PKG_BUILD_PARALLEL - depends on BROKEN - default n - help - Always set the default package build rules to parallel build. - - WARNING: This may break build or kill your cat, as it builds packages - with multiple jobs that are probably not tested in a parallel build - environment. - - Only say Y if you don't mind fixing broken packages. Before reporting - build bugs, set this to N and re-run the build. - comment "Stripping options" choice diff --git a/config/Config-images.in b/config/Config-images.in index 3c76c6236e..8e295939d9 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -253,8 +253,7 @@ menu "Target Images" config TARGET_ROOTFS_PARTSIZE int "Root filesystem partition size (in MB)" depends on GRUB_IMAGES || TARGET_ROOTFS_EXT4FS || TARGET_rb532 || TARGET_mvebu || TARGET_uml - default 2048 if TARGET_x86 - default 256 if ! TARGET_x86 + default 256 help Select the root filesystem partition size. diff --git a/config/Config-kernel.in b/config/Config-kernel.in index d8ca76cf1d..3f30013845 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -190,6 +190,14 @@ config KERNEL_MAGIC_SYSRQ bool "Compile the kernel with SysRq support" default y +config KERNEL_DEBUG_PINCTRL + bool "Compile the kernel with pinctrl debugging" + select KERNEL_DEBUG_KERNEL + +config KERNEL_DEBUG_GPIO + bool "Compile the kernel with gpio debugging" + select KERNEL_DEBUG_KERNEL + config KERNEL_COREDUMP bool @@ -737,3 +745,17 @@ menu "Filesystem ACL and attr support options" default y if USE_FS_ACL_ATTR endmenu + +config KERNEL_DEVMEM + bool "/dev/mem virtual device support" + help + Say Y here if you want to support the /dev/mem device. + The /dev/mem device is used to access areas of physical + memory. + +config KERNEL_DEVKMEM + bool "/dev/kmem virtual device support" + help + 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. diff --git a/include/depends.mk b/include/depends.mk index 7135e52c0f..293409d8b7 100644 --- a/include/depends.mk +++ b/include/depends.mk @@ -13,7 +13,7 @@ DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -find_md5=$(SH_FUNC) find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | md5s +find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | mkhash md5 define rdep .PRECIOUS: $(2) diff --git a/include/download.mk b/include/download.mk index fccd83942f..1b981f14b1 100644 --- a/include/download.mk +++ b/include/download.mk @@ -9,6 +9,12 @@ OPENWRT_GIT = http://git.openwrt.org LEDE_GIT = https://git.lede-project.org +ifdef PKG_SOURCE_VERSION +PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION)) +PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz +endif + DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) # Try to guess the download method from the URL @@ -33,28 +39,94 @@ $(strip \ endef # code for creating tarballs from cvs/svn/git/bzr/hg/darcs checkouts - useful for mirror support -dl_pack/bz2=$(TAR) --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -cjf $(1) $(2) -dl_pack/gz=$(TAR) --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | gzip -nc > $(1) -dl_pack/xz=$(TAR) --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | xz -zc -7e > $(1) -dl_pack/unknown=echo "ERROR: Unknown pack format for file $(1)"; false +dl_pack/bz2=bzip2 -c > $(1) +dl_pack/gz=gzip -nc > $(1) +dl_pack/xz=xz -zc -7e > $(1) +dl_pack/unknown=$(error ERROR: Unknown pack format for file $(1)) define dl_pack $(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown)) endef +define dl_tar_pack + $(TAR) --numeric-owner --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1)) +endef + +ifdef CHECK +check_escape=$(subst ','\'',$(1)) +#') + +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) +else + check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix)) +endif + +gen_sha256sum = $(shell mkhash sha256 $(DL_DIR)/$(1)) + +ifdef FIXUP +F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) +F_hash_mismatch = $(F_hash_deprecated) +F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1)) +endif + +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)) + +check_hash = \ + $(if $(wildcard $(DL_DIR)/$(1)), \ + $(if $(filter-out x,$(2)), \ + $(if $(filter 64,$(shell printf '%s' '$(2)' | wc -c)), \ + $(if $(filter $(2),$(call gen_sha256sum,$(1))),, \ + $(call check_warn,hash_mismatch,$(1),$(2),$(3)) \ + ), \ + $(call check_warn,hash_deprecated,$(1),$(2),$(3)), \ + ), \ + $(call check_warn,hash_missing,$(1),$(2),$(3)) \ + ), \ + $(call check_warn,download_missing,$(1),$(2),$(3)) \ + ) + +ifdef FIXUP +F_md5_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile rename-var $(2) $(3) +endif + +C_md5_deprecated = Use of $(2) is deprecated, switch to $(3) + +# Skip MD5SUM check in feeds until OpenWrt is updated +ifneq ($(filter $(foreach dir,package tools toolchain, $(TOPDIR)/$(dir)/%),$(CURDIR)),) +check_md5 = \ + $(if $(filter-out x,$(1)), \ + $(call check_warn,md5_deprecated,$(1),$(2),$(3)) \ + ) +endif + +hash_var = $(if $(filter-out x,$(1)),MD5SUM,HASH) +endif define DownloadMethod/unknown @echo "ERROR: No download method available"; false endef define DownloadMethod/default - $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MD5SUM)" "$(URL_FILE)" $(foreach url,$(URL),"$(url)") + $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(HASH)" "$(URL_FILE)" $(foreach url,$(URL),"$(url)") \ + $(if $(filter check,$(1)), \ + $(call check_hash,$(FILE),$(HASH),$(2)$(call hash_var,$(MD5SUM))) \ + $(call check_md5,$(MD5SUM),$(2)MD5SUM,$(2)HASH) \ + ) endef define wrap_mirror -$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1)) +$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \ +$(if $(filter check,$(1)), \ + $(call check_hash,$(FILE),$(MIRROR_HASH),$(2)MIRROR_$(call hash_var,$(MIRROR_MD5SUM))) \ + $(call check_md5,$(MIRROR_MD5SUM),$(2)MIRROR_MD5SUM,$(2)MIRROR_HASH) \ +) endef define DownloadMethod/cvs - $(call wrap_mirror, \ + $(call wrap_mirror,$(1),$(2), \ echo "Checking out files from the cvs repository..."; \ mkdir -p $(TMP_DIR)/dl && \ cd $(TMP_DIR)/dl && \ @@ -62,14 +134,14 @@ define DownloadMethod/cvs [ \! -d $(SUBDIR) ] && \ cvs -d $(URL) export $(VERSION) $(SUBDIR) && \ echo "Packing checkout..." && \ - $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ rm -rf $(SUBDIR); \ ) endef define DownloadMethod/svn - $(call wrap_mirror, \ + $(call wrap_mirror,$(1),$(2), \ echo "Checking out files from the svn repository..."; \ mkdir -p $(TMP_DIR)/dl && \ cd $(TMP_DIR)/dl && \ @@ -80,14 +152,14 @@ define DownloadMethod/svn svn export --non-interactive -r$(VERSION) $(URL) $(SUBDIR) ) && \ echo "Packing checkout..." && \ export TAR_TIMESTAMP="" && \ - $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ rm -rf $(SUBDIR); \ ) endef define DownloadMethod/git - $(call wrap_mirror, \ + $(call wrap_mirror,$(1),$(2), \ echo "Checking out files from the git repository..."; \ mkdir -p $(TMP_DIR)/dl && \ cd $(TMP_DIR)/dl && \ @@ -99,14 +171,14 @@ define DownloadMethod/git echo "Packing checkout..." && \ export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \ rm -rf $(SUBDIR)/.git && \ - $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + $(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, \ + $(call wrap_mirror,$(1),$(2), \ echo "Checking out files from the bzr repository..."; \ mkdir -p $(TMP_DIR)/dl && \ cd $(TMP_DIR)/dl && \ @@ -115,14 +187,14 @@ define DownloadMethod/bzr bzr export --per-file-timestamps -r$(VERSION) $(SUBDIR) $(URL) && \ echo "Packing checkout..." && \ export TAR_TIMESTAMP="" && \ - $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ rm -rf $(SUBDIR); \ ) endef define DownloadMethod/hg - $(call wrap_mirror, \ + $(call wrap_mirror,$(1),$(2), \ echo "Checking out files from the hg repository..."; \ mkdir -p $(TMP_DIR)/dl && \ cd $(TMP_DIR)/dl && \ @@ -132,14 +204,14 @@ define DownloadMethod/hg export TAR_TIMESTAMP=`cd $(SUBDIR) && hg log --template '@{date}' -l 1` && \ find $(SUBDIR) -name .hg | xargs rm -rf && \ echo "Packing checkout..." && \ - $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ rm -rf $(SUBDIR); \ ) endef define DownloadMethod/darcs - $(call wrap_mirror, \ + $(call wrap_mirror, $(1), $(2), \ echo "Checking out files from the darcs repository..."; \ mkdir -p $(TMP_DIR)/dl && \ cd $(TMP_DIR)/dl && \ @@ -149,7 +221,7 @@ define DownloadMethod/darcs export TAR_TIMESTAMP=`cd $(SUBDIR) && LC_ALL=C darcs log --last 1 | sed -ne 's!^Date: \+!!p'` && \ find $(SUBDIR) -name _darcs | xargs rm -rf && \ echo "Packing checkout..." && \ - $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ + $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ rm -rf $(SUBDIR); \ ) @@ -167,14 +239,29 @@ define Download/Defaults FILE:= URL_FILE:= PROTO:= - MD5SUM:= + HASH=$$(MD5SUM) + MD5SUM:=x SUBDIR:= MIRROR:=1 + MIRROR_HASH=$$(MIRROR_MD5SUM) MIRROR_MD5SUM:=x VERSION:= OPTS:= endef +define Download/default + FILE:=$(PKG_SOURCE) + URL:=$(PKG_SOURCE_URL) + SUBDIR:=$(PKG_SOURCE_SUBDIR) + PROTO:=$(PKG_SOURCE_PROTO) + $(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR))) + $(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM)) + $(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH)) + VERSION:=$(PKG_SOURCE_VERSION) + $(if $(PKG_MD5SUM),MD5SUM:=$(PKG_MD5SUM)) + $(if $(PKG_HASH),HASH:=$(PKG_HASH)) +endef + define Download $(eval $(Download/Defaults)) $(eval $(Download/$(1))) @@ -191,6 +278,11 @@ define Download $(DL_DIR)/$(FILE): mkdir -p $(DL_DIR) - $(call locked,$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown)),$(FILE)) + $(call locked, \ + $(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))), \ + $(call DownloadMethod/$(call dl_method,$(URL),$(PROTO)),check,$(if $(filter default,$(1)),PKG_,Download/$(1):)), \ + $(DownloadMethod/unknown) \ + ),\ + $(FILE)) endef diff --git a/include/host-build.mk b/include/host-build.mk index d353c88b5c..5cfbdeba51 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -5,21 +5,18 @@ # See /LICENSE for more information. # +include $(INCLUDE_DIR)/download.mk + HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install HOST_BUILD_PARALLEL ?= -ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),) - HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) -else - HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS) -endif +HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) ifeq ($(strip $(HOST_BUILD_PARALLEL)),0) HOST_JOBS?=-j1 else -HOST_JOBS?=$(if $(HOST_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\ - $(if $(CONFIG_PKG_BUILD_PARALLEL),$(HOST_MAKE_J),-j1),-j1) +HOST_JOBS?=$(if $(HOST_BUILD_PARALLEL),$(HOST_MAKE_J),-j1) endif include $(INCLUDE_DIR)/host.mk @@ -35,7 +32,6 @@ HOST_STAMP_INSTALLED:=$(HOST_BUILD_PREFIX)/stamp/.$(PKG_NAME)_installed override MAKEFLAGS= -include $(INCLUDE_DIR)/download.mk include $(INCLUDE_DIR)/quilt.mk include $(INCLUDE_DIR)/autotools.mk @@ -52,17 +48,12 @@ define Host/Prepare $(call Host/Prepare/Default) endef -ifeq ($(HOST_OS),Darwin) - HOST_CFLAGS += -I/usr/local/opt/openssl/include - HOST_LDFLAGS += -L/usr/local/opt/openssl/lib -endif - HOST_CONFIGURE_VARS = \ CC="$(HOSTCC)" \ CFLAGS="$(HOST_CFLAGS)" \ CPPFLAGS="$(HOST_CPPFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \ - SHELL="$(SHELL)" + CONFIG_SHELL="$(SHELL)" HOST_CONFIGURE_ARGS = \ --target=$(GNU_HOST_NAME) \ @@ -84,9 +75,9 @@ define Host/Configure/Default $(if $(HOST_CONFIGURE_PARALLEL),+)(cd $(HOST_BUILD_DIR)/$(3); \ if [ -x configure ]; then \ $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/$(3)/ && \ + $(HOST_CONFIGURE_VARS) \ $(2) \ $(HOST_CONFIGURE_CMD) \ - $(HOST_CONFIGURE_VARS) \ $(HOST_CONFIGURE_ARGS) \ $(1); \ fi \ @@ -123,16 +114,6 @@ ifneq ($(if $(HOST_QUILT),,$(CONFIG_AUTOREBUILD)),) endef endif -define Download/default - FILE:=$(PKG_SOURCE) - URL:=$(PKG_SOURCE_URL) - PROTO:=$(PKG_SOURCE_PROTO) - SUBDIR:=$(PKG_SOURCE_SUBDIR) - VERSION:=$(PKG_SOURCE_VERSION) - MD5SUM:=$(PKG_MD5SUM) - MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM) -endef - define Host/Exports/Default $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-* $(if $(IS_PACKAGE_BUILD),$$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*)),-I $$(p)) $(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX) @@ -146,9 +127,8 @@ Host/Exports=$(Host/Exports/Default) .NOTPARALLEL: ifndef DUMP - define HostBuild + define HostBuild/Core $(if $(HOST_QUILT),$(Host/Quilt)) - $(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) $(if $(DUMP),,$(call HostHost/Autoclean)) $(HOST_STAMP_PREPARED): @@ -208,3 +188,8 @@ ifndef DUMP clean: endif + +define HostBuild + $(HostBuild/Core) + $(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) +endef diff --git a/include/image-commands.mk b/include/image-commands.mk index 083a389031..a7acd0ee67 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -190,3 +190,8 @@ metadata_json = \ define Build/append-metadata $(if $(SUPPORTED_DEVICES),echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) endef + +define Build/kernel2minor + kernel2minor -k $@ -r $@.new $(1) + mv $@.new $@ +endef diff --git a/include/image-legacy.mk b/include/image-legacy.mk index edbee4c831..1864d714e5 100644 --- a/include/image-legacy.mk +++ b/include/image-legacy.mk @@ -15,9 +15,9 @@ ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),) $(STAGING_DIR_HOST)/bin/mkfs.ubifs \ $(if $($(PROFILE)_UBIFS_OPTS),$($(PROFILE)_UBIFS_OPTS),$(UBIFS_OPTS)) \ $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \ + $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--compr=none) \ + $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--compr=lzo) \ + $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--compr=zlib) \ $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \ --squash-uids \ -o $(KDIR)/root.ubifs \ diff --git a/include/image.mk b/include/image.mk index d1dcdd6bad..3daee35c48 100644 --- a/include/image.mk +++ b/include/image.mk @@ -33,16 +33,18 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3)) param_mangle = $(subst $(space),_,$(strip $(1))) param_unmangle = $(subst _,$(space),$(1)) -mkfs_packages_id = $(shell echo $(sort $(1)) | md5sum | head -c 8) +mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | head -c 8) mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR)) KDIR=$(KERNEL_BUILD_DIR) KDIR_TMP=$(KDIR)/tmp DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts -EXTRA_NAME_SANITIZED=$(call sanitize,$(EXTRA_IMAGE_NAME)) +IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-) +IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-) +IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERSION_CODE))-) -IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) +IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt @@ -195,7 +197,7 @@ define Image/mkfs/squashfs $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \ -nopad -noappend -root-owned \ -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \ - -processors $(if $(CONFIG_PKG_BUILD_JOBS),$(CONFIG_PKG_BUILD_JOBS),1) \ + -processors 1 \ $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH)) endef @@ -231,9 +233,9 @@ define Image/mkfs/ubifs $(STAGING_DIR_HOST)/bin/mkfs.ubifs \ $(UBIFS_OPTS) $(call param_unmangle,$(call param_get,fs,$(1))) \ $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \ + $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--compr=none) \ + $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--compr=lzo) \ + $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--compr=zlib) \ $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \ --squash-uids \ -o $@ -d $(call mkfs_target_dir,$(1)) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 062c458ab7..2bf47b17e4 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -43,7 +43,7 @@ endef define Download/kernel URL:=$(LINUX_SITE) FILE:=$(LINUX_SOURCE) - MD5SUM:=$(LINUX_KERNEL_MD5SUM) + HASH:=$(LINUX_KERNEL_HASH) endef KERNEL_GIT_OPTS:= diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index a17b489c98..10bd67a571 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -125,7 +125,7 @@ define Kernel/Configure/Default cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ } $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install - $(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic + grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic endef define Kernel/Configure/Initramfs diff --git a/include/kernel-version.mk b/include/kernel-version.mk index f2fa0d0b04..5008ea8f98 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -3,12 +3,10 @@ LINUX_RELEASE?=1 LINUX_VERSION-3.18 = .43 -LINUX_VERSION-4.1 = .34 -LINUX_VERSION-4.4 = .36 +LINUX_VERSION-4.4 = .40 -LINUX_KERNEL_MD5SUM-3.18.43 = b1faeb4a2e1e70ffe061bdbb3452840a -LINUX_KERNEL_MD5SUM-4.1.34 = fba99f0f4765ebf01033e69518740a3c -LINUX_KERNEL_MD5SUM-4.4.36 = 505548da130599c866d92105a8b04758 +LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c +LINUX_KERNEL_HASH-4.4.40 = c381411888dd3a78ed86eefabc7b1e63f5c26aaa803184f3325ef4570d14c94e ifdef KERNEL_PATCHVER LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER))) @@ -21,5 +19,5 @@ KERNEL=$(call merge_version,$(wordlist 1,2,$(call split_version,$(KERNEL_BASE))) KERNEL_PATCHVER ?= $(KERNEL) # disable the md5sum check for unknown kernel versions -LINUX_KERNEL_MD5SUM:=$(LINUX_KERNEL_MD5SUM-$(strip $(LINUX_VERSION))) -LINUX_KERNEL_MD5SUM?=x +LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION))) +LINUX_KERNEL_HASH?=x diff --git a/include/kernel.mk b/include/kernel.mk index 54966da789..8c08a5d7d3 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -5,8 +5,15 @@ # See /LICENSE for more information. # +ifneq ($(filter check,$(MAKECMDGOALS)),) +CHECK:=1 +DUMP:=1 +endif + ifeq ($(__target_inc),) - include $(INCLUDE_DIR)/target.mk + ifndef CHECK + include $(INCLUDE_DIR)/target.mk + endif endif ifeq ($(DUMP),1) @@ -148,6 +155,7 @@ define KernelPackage $(eval $(call KernelPackage/Defaults)) $(eval $(call KernelPackage/$(1))) $(eval $(call KernelPackage/$(1)/$(BOARD))) + $(eval $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic))) define Package/kmod-$(1) TITLE:=$(TITLE) @@ -159,6 +167,7 @@ define KernelPackage PKGFLAGS:=$(PKGFLAGS) $(call KernelPackage/$(1)) $(call KernelPackage/$(1)/$(BOARD)) + $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)) endef ifdef KernelPackage/$(1)/conffiles diff --git a/include/netfilter.mk b/include/netfilter.mk index c793ce5ac1..c408ac68ca 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -39,13 +39,12 @@ $(eval $(if $(NF_KMOD),$(call nf_add,IPT_CORE,CONFIG_IP_NF_FILTER, $(P_V4)iptabl $(eval $(if $(NF_KMOD),$(call nf_add,IPT_CORE,CONFIG_IP_NF_MANGLE, $(P_V4)iptable_mangle),)) # userland only -$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_CORE,CONFIG_IP_NF_IPTABLES, xt_standard ipt_icmp xt_tcp xt_udp xt_comment xt_id xt_set xt_SET))) +$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_CORE,CONFIG_IP_NF_IPTABLES, xt_standard ipt_icmp xt_tcp xt_udp xt_comment xt_set xt_SET))) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_LIMIT, $(P_XT)xt_limit)) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_MAC, $(P_XT)xt_mac)) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_MULTIPORT, $(P_XT)xt_multiport)) $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_COMMENT, $(P_XT)xt_comment)) -$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_ID, $(P_XT)xt_id)) #cluster $(eval $(call nf_add,IPT_CLUSTER,CONFIG_NETFILTER_XT_MATCH_CLUSTER, $(P_XT)xt_cluster)) @@ -72,7 +71,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV4, $(P_V4) $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK_IPV4, $(P_V4)nf_conntrack_ipv4),)) $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_STATE, $(P_XT)xt_state)) -$(eval $(call nf_add,IPT_CONNTRACK,CONFIG_IP_NF_RAW, $(P_V4)iptable_raw)) $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_TARGET_CT, $(P_XT)xt_CT)) $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_CONNTRACK, $(P_XT)xt_conntrack)) @@ -151,7 +149,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK6,CONFIG_NF_CONNTRACK_IPV6, $(P $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_FILTER, $(P_V6)ip6table_filter),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_MANGLE, $(P_V6)ip6table_mangle),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_QUEUE, $(P_V6)ip6_queue),)) -$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_RAW, $(P_V6)ip6table_raw),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_NF_LOG_IPV6, $(P_V6)nf_log_ipv6),)) $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, ip6t_icmp6))) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index afd2d4ef7a..e168eb390f 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -96,7 +96,14 @@ ifeq ($(DUMP),) KEEP_$(1):=$(strip $(call Package/$(1)/conffiles)) ifeq ($(BUILD_VARIANT),$$(if $$(VARIANT),$$(VARIANT),$(BUILD_VARIANT))) + do_install= ifdef Package/$(1)/install + do_install=yes + endif + ifdef Package/$(1)/install-overlay + do_install=yes + endif + ifdef do_install ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),) IPKGS += $(1) compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed @@ -178,6 +185,8 @@ $(_endef) @rm -rf $$(IDIR_$(1)) $$(call opkg_package_files,$(1)) mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR) $(call Package/$(1)/install,$$(IDIR_$(1))) + $(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay) + $(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay) -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf @( \ find $$(IDIR_$(1)) -name lib\*.so\* -or -name \*.ko | awk -F/ '{ print $$$$NF }'; \ diff --git a/include/package.mk b/include/package.mk index 99e401e859..3248517657 100644 --- a/include/package.mk +++ b/include/package.mk @@ -7,26 +7,22 @@ __package_mk:=1 -all: $(if $(DUMP),dumpinfo,compile) +all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile)) + +include $(INCLUDE_DIR)/download.mk PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install -PKG_MD5SUM ?= unknown PKG_BUILD_PARALLEL ?= PKG_USE_MIPS16 ?= 1 PKG_IREMAP ?= 1 -ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),) - MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) -else - MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS) -endif +MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) PKG_JOBS?=-j1 else -PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\ - $(if $(CONFIG_PKG_BUILD_PARALLEL),$(MAKE_J),-j1),-j1) +PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1) endif ifdef CONFIG_USE_MIPS16 ifeq ($(strip $(PKG_USE_MIPS16)),1) @@ -93,7 +89,6 @@ endif PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install -include $(INCLUDE_DIR)/download.mk include $(INCLUDE_DIR)/quilt.mk include $(INCLUDE_DIR)/package-defaults.mk include $(INCLUDE_DIR)/package-dumpinfo.mk @@ -118,17 +113,6 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),) endif endif -define Download/default - FILE:=$(PKG_SOURCE) - URL:=$(PKG_SOURCE_URL) - SUBDIR:=$(PKG_SOURCE_SUBDIR) - PROTO:=$(PKG_SOURCE_PROTO) - $(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR))) - $(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM)) - VERSION:=$(PKG_SOURCE_VERSION) - MD5SUM:=$(PKG_MD5SUM) -endef - ifdef USE_GIT_TREE define Build/Prepare/Default mkdir -p $(PKG_BUILD_DIR) @@ -156,9 +140,8 @@ define Build/Exports/Default endef Build/Exports=$(Build/Exports/Default) -define Build/DefaultTargets +define Build/CoreTargets $(if $(QUILT),$(Build/Quilt)) - $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) $(call Build/Autoclean) download: @@ -223,15 +206,20 @@ define Build/DefaultTargets compile: $(STAMP_INSTALLED) endif - define Build/DefaultTargets - endef - prepare: $(STAMP_PREPARED) configure: $(STAMP_CONFIGURED) dist: $(STAMP_CONFIGURED) distcheck: $(STAMP_CONFIGURED) endef +define Build/DefaultTargets + $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) + $(if $(DUMP),,$(Build/CoreTargets)) + + define Build/DefaultTargets + endef +endef + define Build/IncludeOverlay $(eval -include $(wildcard $(TOPDIR)/overlay/*/$(PKG_DIR_NAME).mk)) define Build/IncludeOverlay @@ -263,14 +251,14 @@ endif ) $(if $(DUMP), \ - $(Dumpinfo/Package), \ + $(if $(CHECK),,$(Dumpinfo/Package)), \ $(foreach target, \ $(if $(Package/$(1)/targets),$(Package/$(1)/targets), \ $(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg) \ ), $(BuildTarget/$(target)) \ ) \ ) - $(if $(PKG_HOST_ONLY)$(DUMP),,$(call Build/DefaultTargets,$(1))) + $(if $(PKG_HOST_ONLY),,$(call Build/DefaultTargets,$(1))) endef define pkg_install_files @@ -298,7 +286,7 @@ prepare-package-install: $(PACKAGE_DIR): mkdir -p $@ - + dumpinfo: download: prepare: diff --git a/include/prereq-build.mk b/include/prereq-build.mk index ed652ca9a7..af4e8b5e14 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -75,14 +75,6 @@ $(eval $(call TestHostCommand,zlib, \ echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \ gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags))) -# Xcode deprecated openssl, MacPorts doesn't work nicely for other packages -ifneq ($(HOST_OS),Darwin) -$(eval $(call TestHostCommand,libssl, \ - Please install the openssl library (with development headers), \ - echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \ - gcc $(HOST_CFLAGS) -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl $(HOST_LDFLAGS))) -endif - $(eval $(call TestHostCommand,perl-thread-queue, \ Please install the Perl Thread::Queue module, \ perl -MThread::Queue -e 1)) @@ -135,11 +127,6 @@ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ gstat -c%s $(TMP_DIR)/.host.mk, \ stat -c%s $(TMP_DIR)/.host.mk)) -$(eval $(call SetupHostCommand,md5sum,, \ - gmd5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \ - md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \ - $(SCRIPT_DIR)/md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e)) - $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \ unzip 2>&1 | grep zipfile, \ unzip)) @@ -164,11 +151,11 @@ $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \ $(eval $(call SetupHostCommand,file,Please install the 'file' package, \ file --version 2>&1 | grep file)) -ifneq ($(HOST_OS),Darwin) -$(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \ - openssl version | grep '\(OpenSSL\|LibreSSL\)')) -endif +$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c + mkdir -p $(dir $@) + $(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $< +prereq: $(STAGING_DIR_HOST)/bin/mkhash # Install ldconfig stub $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \ diff --git a/include/quilt.mk b/include/quilt.mk index cd392a7c5d..796e7160c4 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -149,7 +149,8 @@ define Quilt/Template echo "The source directory contains no quilt patches."; \ false; \ } - @[ -n "$$$$(ls $(1)/patches/series)" -o "$$$$(cat $(1)/patches/series | md5sum)" = "$$(sort $(1)/patches/series | md5sum)" ] || { \ + @[ -n "$$$$(ls $(1)/patches/series)" -o \ + "$$$$(cat $(1)/patches/series | mkhash md5)" = "$$(sort $(1)/patches/series | mkhash md5)" ] || { \ echo "The patches are not sorted in the right order. Please fix."; \ false; \ } diff --git a/include/scan.mk b/include/scan.mk index e6bc0688b7..3a884fb5f5 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -51,7 +51,7 @@ $(OVERRIDELIST): ifeq ($(SCAN_NAME),target) GREP_STRING=BuildTarget else - GREP_STRING=(Build/DefaultTargets|BuildPackage|.+Package) + GREP_STRING=(Build/DefaultTargets|BuildPackage|KernelPackage) endif $(FILELIST): $(OVERRIDELIST) @@ -85,7 +85,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST) $(TARGET_STAMP):: +( \ $(NO_TRACE_MAKE) $(FILELIST); \ - MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | (md5sum || md5) 2>/dev/null | awk '{print $$1}'); \ + MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \ [ -f "$@.$$MD5SUM" ] || { \ rm -f $@.*; \ touch $@.$$MD5SUM; \ diff --git a/include/shell.sh b/include/shell.sh index 6389304c24..6ee0cf6030 100644 --- a/include/shell.sh +++ b/include/shell.sh @@ -13,25 +13,3 @@ isset() { eval "var=\"\${$1}\"" [ -n "$var" ] } - -trapret() {( - local retvals="$1"; shift - local cmd="$1"; shift - for retval in $(echo $retvals); do - local trap_$retval=1 - done - "$cmd" "$@" || { - local retval="$?" - eval "trapped=\${trap_$retval}" - [ -n "$trapped" ] || { - return $retval - } - } -)} - -md5s() { - cat "$@" | ( - md5sum 2>/dev/null || - md5 - ) | awk '{print $1}' -} diff --git a/include/subdir.mk b/include/subdir.mk index f4085f9df4..10476d3476 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -9,7 +9,7 @@ ifeq ($(MAKECMDGOALS),prereq) SUBTARGETS:=prereq PREREQ_ONLY:=1 else - SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure + SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check endif subtarget-default = $(filter-out ., \ diff --git a/include/toplevel.mk b/include/toplevel.mk index f31884d3fe..24e4ebf823 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -67,7 +67,7 @@ SUBMAKE:=umask 022; $(SUBMAKE) ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024; -prepare-mk: FORCE ; +prepare-mk: staging_dir/host/.prereq-build FORCE ; ifdef SDK IGNORE_PACKAGES = linux @@ -179,6 +179,9 @@ clean dirclean: .config prereq:: prepare-tmpinfo .config @+$(NO_TRACE_MAKE) -r -s $@ +check: .config FORCE + @+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s + WARN_PARALLEL_ERROR = $(if $(BUILD_LOG),,$(and $(filter -j,$(MAKEFLAGS)),$(findstring s,$(OPENWRT_VERBOSE)))) ifeq ($(SDK),1) diff --git a/include/unpack.mk b/include/unpack.mk index 3fabf46033..a139827490 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -5,14 +5,9 @@ # See /LICENSE for more information. # -# unpacking files with +s may break on some platforms. this typically emits error code 2 -ifneq ($(HOST_OS),Linux) - HOST_TAR:=trapret 2 $(TAR) -else - HOST_TAR:=$(TAR) -endif +HOST_TAR:=$(TAR) TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS) -UNZIP_CMD=unzip -d $(1)/.. $(DL_DIR)/$(PKG_SOURCE) +UNZIP_CMD=unzip -q -d $(1)/.. $(DL_DIR)/$(PKG_SOURCE) ifeq ($(PKG_SOURCE),) PKG_UNPACK ?= true diff --git a/include/version.mk b/include/version.mk index 2e89145fab..de801d0216 100644 --- a/include/version.mk +++ b/include/version.mk @@ -50,7 +50,7 @@ VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER)) VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC) VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL)) -VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org/librecmc) +VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org) VERSION_BUG_URL:=$(call qstrip_escape,$(CONFIG_VERSION_BUG_URL)) VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL)) diff --git a/package/Makefile b/package/Makefile index 8726e2eae9..3250e7b7d0 100644 --- a/package/Makefile +++ b/package/Makefile @@ -14,6 +14,10 @@ $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m)) $(curdir)/builddirs-install:=. $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m)) $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m)) +ifdef CHECK_ALL +$(curdir)/builddirs-check:=$($(curdir)/builddirs) +$(curdir)/builddirs-download:=$($(curdir)/builddirs) +endif ifneq ($(IGNORE_ERRORS),) package-y-filter := $(package-y) package-m-filter := $(filter-out $(package-y),$(package-m)) @@ -70,21 +74,13 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir $(call prepare_rootfs,$(TARGET_DIR)) -PASSOPT="" -PASSARG="" -ifndef CONFIG_OPKGSMIME_PASSPHRASE - ifneq ($(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)),) - PASSOPT="-passin" - PASSARG="file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE))" - endif -endif - $(curdir)/index: FORCE @echo Generating package index... @for d in $(PACKAGE_SUBDIRS); do ( \ mkdir -p $$d; \ cd $$d || continue; \ - $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \ + $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \ + grep -vE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages && \ gzip -9nc Packages > Packages.gz; \ ); done ifdef CONFIG_SIGNED_PACKAGES @@ -94,25 +90,6 @@ ifdef CONFIG_SIGNED_PACKAGES cd $$d || continue; \ $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \ ); done -else -ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_KEY)),) - @echo Signing key has not been configured -else -ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_CERT)),) - @echo Certificate has not been configured -else - @echo Signing package index... - @for d in $(PACKAGE_SUBDIRS); do ( \ - [ -d $$d ] && \ - cd $$d || continue; \ - openssl smime -binary -in Packages.gz \ - -out Packages.sig -outform PEM -sign \ - -signer $(CONFIG_OPKGSMIME_CERT) \ - -inkey $(CONFIG_OPKGSMIME_KEY) \ - $(PASSOPT) $(PASSARG); \ - ); done -endif -endif endif $(curdir)/preconfig: @@ -123,5 +100,6 @@ $(eval $(call stampfile,$(curdir),package,prereq,.config)) $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build)) +$(eval $(call stampfile,$(curdir),package,check,$(TMP_DIR)/.build)) $(eval $(call subdir,$(curdir))) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 5aadd6f833..2c81287bad 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -23,7 +23,7 @@ PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARG include $(INCLUDE_DIR)/package.mk ifneq ($(DUMP),1) - STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s) + STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) TARGET:=-$(BOARD) endif diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 63d3b8d60c..2f03e02409 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -401,7 +401,7 @@ generate_gpioswitch() { set system.$cfg='gpio_switch' set system.$cfg.name='$name' set system.$cfg.gpio_pin='$pin' - set system.$cfg.default='$default' + set system.$cfg.value='$default' EOF json_select .. json_select .. diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index bb69ffbd3e..3eda09b456 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -44,7 +44,7 @@ fi service() { [ -f "/etc/init.d/$1" ] || { - echo -n "$1 does not exist. the following services are available :" + echo "service "'"'"$1"'"'" not found, the following services are available:" ls "/etc/init.d" return 1 } diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index b3bf2213f4..b68db6b6bd 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -230,6 +230,11 @@ default_postinst() { ret=$? fi + if [ -d "$root/rootfs-overlay" ]; then + cp -R $root/rootfs-overlay/. $root/ + rm -fR $root/rootfs-overlay/ + fi + if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then . /lib/functions/system.sh [ -d /tmp/.uci ] || mkdir -p /tmp/.uci diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 4d0e6d5f17..e3519ca2cb 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -53,7 +53,8 @@ run_ramfs() { # [...] /bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump \ /bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \ /bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \ - /bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find + /bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \ + /bin/mknod install_bin /bin/uclient-fetch /bin/wget install_bin /sbin/mtd @@ -206,6 +207,96 @@ get_magic_long() { (get_image "$@" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null } +export_bootdevice() { + local cmdline uuid disk uevent + local MAJOR MINOR DEVNAME DEVTYPE + + if read cmdline < /proc/cmdline; then + case "$cmdline" in + *block2mtd=*) + disk="${cmdline##*block2mtd=}" + disk="${disk%%,*}" + ;; + *root=*) + disk="${cmdline##*root=}" + disk="${disk%% *}" + ;; + esac + + case "$disk" in + PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02) + uuid="${disk#PARTUUID=}" + uuid="${uuid%-02}" + for disk in $(find /dev -type b); do + set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') + if [ "$4$3$2$1" = "$uuid" ]; then + uevent="/sys/class/block/${disk##*/}/uevent" + break + fi + done + ;; + /dev/*) + uevent="/sys/class/block/${disk##*/}/uevent" + ;; + esac + + if [ -e "$uevent" ]; then + . "$uevent" + + export BOOTDEV_MAJOR=$MAJOR + export BOOTDEV_MINOR=$MINOR + return 0 + fi + fi + + return 1 +} + +export_partdevice() { + local var="$1" offset="$2" + local uevent MAJOR MINOR DEVNAME DEVTYPE + + for uevent in /sys/class/block/*/uevent; do + . "$uevent" + if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then + export "$var=$DEVNAME" + return 0 + fi + done + + return 1 +} + +get_partitions() { # + local disk="$1" + local filename="$2" + + if [ -b "$disk" -o -f "$disk" ]; then + v "Reading partition table from $filename..." + + local magic="$(hexdump -v -n 2 -s 0x1FE -e '1/2 "0x%04X"' "$disk")" + if [ "$magic" != 0xAA55 ]; then + v "Invalid partition table on $disk" + exit + fi + + rm -f "/tmp/partmap.$filename" + + local part + for part in 1 2 3 4; do + set -- $(hexdump -v -n 12 -s "$((0x1B2 + $part * 16))" -e '3/4 "0x%08X "' "$disk") + + local type="$(($1 % 256))" + local lba="$(($2))" + local num="$(($3))" + + [ $type -gt 0 ] || continue + + printf "%2d %5d %7d\n" $part $lba $num >> "/tmp/partmap.$filename" + done + fi +} + jffs2_copy_config() { if grep rootfs_data /proc/mtd >/dev/null; then # squashfs+jffs2 diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 5a7b068fe0..b621a5d661 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -158,7 +158,7 @@ if VERSIONOPT config VERSION_DIST string prompt "Release distribution" - default "Lede" + default "LEDE" help This is the name of the release distribution. If unspecified, it defaults to OpenWrt. @@ -175,8 +175,8 @@ if VERSIONOPT prompt "Release version number" help This is the release version number embedded in the image. - If unspecified, it defaults to CURRENT for the master branch - or to ##.##-CURRENT on release branches. + If unspecified, it defaults to SNAPSHOT for the master branch + or to ##.##-SNAPSHOT on release branches. config VERSION_CODE string @@ -195,8 +195,8 @@ if VERSIONOPT This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: %R .. Repository revision ID - %V .. Configured release version number or "CURRENT", uppercase - %v .. Configured release version number or "current", lowercase + %V .. Configured release version number or "SNAPSHOT", uppercase + %v .. Configured release version number or "snapshot", lowercase %C .. Configured release revision code or value of %R, uppercase %c .. Configured release revision code or value of %R, lowercase %N .. Release name, uppercase @@ -258,6 +258,15 @@ if VERSIONOPT help Enable this to include the version number in firmware image, SDK- and Image Builder archive file names + + config VERSION_CODE_FILENAMES + bool + prompt "Revision code in filenames" + default y + help + Enable this to include the revision identifier or the configured + version code into the firmware image, SDK- and Image Builder archive + file names endif @@ -283,42 +292,3 @@ menuconfig PER_FEED_REPO Add not enabled feeds as commented out source lines to opkg.conf. source "tmp/.config-feeds.in" - - -menuconfig SMIMEOPT - bool "Package signing options" if IMAGEOPT - default n - help - These options configure the signing key and certificate to - be used for signing and verifying packages. - - config OPKGSMIME_CERT - string - prompt "Path to certificate (PEM certificate format)" if SMIMEOPT - help - Path to the certificate to use for signature verification - - config OPKGSMIME_KEY - string - prompt "Path to signing key (PEM private key format)" if SMIMEOPT - help - Path to the key to use for signing packages - - config OPKGSMIME_PASSPHRASE - bool - default y - prompt "Wait for a passphrase when signing packages?" if SMIMEOPT - help - If this value is set, then the build will pause and request a passphrase - from the command line when signing packages. This SHOULD NOT be used with - automatic builds. If this value is not set, a file can be specified from - which the passphrase will be read. - - config OPKGSMIME_PASSFILE - string - prompt "Path to a file containing the passphrase" if SMIMEOPT - depends on !OPKGSMIME_PASSPHRASE - help - Path to a file containing the passphrase for the signing key. - If the signing key is not encrypted and does not require a passphrase, - this option may be left blank. diff --git a/package/devel/binutils/Makefile b/package/devel/binutils/Makefile index 7a24884a0e..222922df28 100644 --- a/package/devel/binutils/Makefile +++ b/package/devel/binutils/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=@GNU/binutils PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_VERSION:=$(PKG_VERSION) -PKG_MD5SUM:=2869c9bf3e60ee97c74ac2a6bf4e9d68 +PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88 PKG_FIXUP:=autoreconf PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl diff --git a/package/devel/gdb-arc/Makefile b/package/devel/gdb-arc/Makefile index c42b108150..b194437530 100644 --- a/package/devel/gdb-arc/Makefile +++ b/package/devel/gdb-arc/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=gdb-arc-2016.03-gdb.tar.gz PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_VERSION) -PKG_MD5SUM:=775caaf6385c16f20b6f53c0a2b95f79 +PKG_HASH:=6a91f86cc487c1548d3f5d4f29f7226d2019c0db8a63633aeabd5914a340f3f9 PKG_BUILD_DIR:=$(BUILD_DIR)/binutils-gdb-arc-2016.03-gdb diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index 92262d9c51..dc8df7c5a2 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_MD5SUM:=5aa71522e488e358243917967db87476 +PKG_HASH:=e9216da4e3755e9f414c1aa0026b626251dfc57ffe572a266e98da4f6988fc70 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 diff --git a/package/devel/gdb/patches/002-remove-arguments.patch b/package/devel/gdb/patches/002-remove-arguments.patch deleted file mode 100644 index a263cb396a..0000000000 --- a/package/devel/gdb/patches/002-remove-arguments.patch +++ /dev/null @@ -1,16 +0,0 @@ -# The additional warnings are causing compile errors on gcc version 4.1.2 as -# a host compiler. - ---- a/sim/igen/configure -+++ b/sim/igen/configure -@@ -4768,8 +4768,8 @@ build_warnings="-Wall -Wdeclaration-afte - -Wpointer-sign \ - -Wno-unused -Wunused-value -Wunused-function \ - -Wno-switch -Wno-char-subscripts -Wmissing-prototypes ---Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \ ---Wold-style-declaration -Wold-style-definition" -+-Wdeclaration-after-statement \ -+-Wold-style-definition" - - # Enable -Wno-format by default when using gcc on mingw since many - # GCC versions complain about %I64. diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index 3f50b41a0b..1a5364a039 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -10,9 +10,9 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=4.14 +PKG_VERSION:=4.15 PKG_RELEASE:=1 -PKG_MD5SUM:=1e39b5f7583256d7dc21170b9da529ae +PKG_HASH:=c0cdc094d6141fd9dbf6aaad605142d651ae10998b660fda57fc61f7ad583ca9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SF/$(PKG_NAME) 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 5dc1e6713f..d9807c318f 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,8 +1,6 @@ -diff --git a/ptrace.h b/ptrace.h -index ddb46cb..48a54b8 100644 --- a/ptrace.h +++ b/ptrace.h -@@ -55,7 +55,14 @@ extern long ptrace(int, int, char *, long); +@@ -55,7 +55,14 @@ extern long ptrace(int, int, char *, lon # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args #endif diff --git a/package/devel/trace-cmd/Makefile b/package/devel/trace-cmd/Makefile index 3571c1c2b7..3a2e0e2128 100644 --- a/package/devel/trace-cmd/Makefile +++ b/package/devel/trace-cmd/Makefile @@ -8,10 +8,8 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=\ https://kernel.googlesource.com/pub/scm/linux/kernel/git/rostedt/trace-cmd \ https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_VERSION:=9be5d74805830a291615f2f34a27c903f6a37b1e -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=735b69f61a8c627037dcc01361cdb8415e5ab0ec892fbd731236c444003b0c71 +PKG_MIRROR_HASH:=735b69f61a8c627037dcc01361cdb8415e5ab0ec892fbd731236c444003b0c71 PKG_INSTALL:=1 PKG_USE_MIPS16:=0 PKG_LICENSE:=GPL-2.0 diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index 7b19420529..34f10c7b0c 100644 --- a/package/devel/valgrind/Makefile +++ b/package/devel/valgrind/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://valgrind.org/downloads/ -PKG_MD5SUM:=67ca4395b2527247780f36148b084f5743a68ab0c850cb43e4a5b4b012cf76a1 +PKG_HASH:=67ca4395b2527247780f36148b084f5743a68ab0c850cb43e4a5b4b012cf76a1 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0+ diff --git a/package/kernel/hwmon-gsc/Makefile b/package/kernel/hwmon-gsc/Makefile new file mode 100644 index 0000000000..1892e027ca --- /dev/null +++ b/package/kernel/hwmon-gsc/Makefile @@ -0,0 +1,30 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=hwmon-gsc +PKG_RELEASE:=1 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/hwmon-gsc + SUBMENU:=Hardware Monitoring Support + DEPENDS:=@TARGET_imx6||TARGET_cns3xxx kmod-hwmon-core +kmod-i2c-core + TITLE:=Driver for the Gateworks System Controller + AUTOLOAD:=$(call AutoLoad,60,gsc) + FILES:=$(PKG_BUILD_DIR)/gsc.ko +endef + +define KernelPackage/hwmon-gsc/description + Kernel module for the Gateworks System Controller chips. +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(BUILDFLAGS)" \ + modules +endef + +$(eval $(call KernelPackage,hwmon-gsc)) diff --git a/package/kernel/hwmon-gsc/src/Makefile b/package/kernel/hwmon-gsc/src/Makefile new file mode 100644 index 0000000000..0e54aed2e3 --- /dev/null +++ b/package/kernel/hwmon-gsc/src/Makefile @@ -0,0 +1 @@ +obj-m := gsc.o diff --git a/package/kernel/hwmon-gsc/src/gsc.c b/package/kernel/hwmon-gsc/src/gsc.c new file mode 100644 index 0000000000..737cc599b4 --- /dev/null +++ b/package/kernel/hwmon-gsc/src/gsc.c @@ -0,0 +1,308 @@ +/* + * A hwmon driver for the Gateworks System Controller + * Copyright (C) 2009 Gateworks Corporation + * + * Author: Chris Lang + * + * 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. + */ + +#include +#include +#include +#include +#include +#include + +#define DRV_VERSION "0.2" + +enum chips { gsp }; + +/* AD7418 registers */ +#define GSP_REG_TEMP_IN 0x00 +#define GSP_REG_VIN 0x02 +#define GSP_REG_3P3 0x05 +#define GSP_REG_BAT 0x08 +#define GSP_REG_5P0 0x0b +#define GSP_REG_CORE 0x0e +#define GSP_REG_CPU1 0x11 +#define GSP_REG_CPU2 0x14 +#define GSP_REG_DRAM 0x17 +#define GSP_REG_EXT_BAT 0x1a +#define GSP_REG_IO1 0x1d +#define GSP_REG_IO2 0x20 +#define GSP_REG_PCIE 0x23 +#define GSP_REG_CURRENT 0x26 +#define GSP_FAN_0 0x2C +#define GSP_FAN_1 0x2E +#define GSP_FAN_2 0x30 +#define GSP_FAN_3 0x32 +#define GSP_FAN_4 0x34 +#define GSP_FAN_5 0x36 + +struct gsp_sensor_info { + const char* name; + int reg; +}; + +static const struct gsp_sensor_info gsp_sensors[] = { + {"temp", GSP_REG_TEMP_IN}, + {"vin", GSP_REG_VIN}, + {"3p3", GSP_REG_3P3}, + {"bat", GSP_REG_BAT}, + {"5p0", GSP_REG_5P0}, + {"core", GSP_REG_CORE}, + {"cpu1", GSP_REG_CPU1}, + {"cpu2", GSP_REG_CPU2}, + {"dram", GSP_REG_DRAM}, + {"ext_bat", GSP_REG_EXT_BAT}, + {"io1", GSP_REG_IO1}, + {"io2", GSP_REG_IO2}, + {"pci2", GSP_REG_PCIE}, + {"current", GSP_REG_CURRENT}, + {"fan_point0", GSP_FAN_0}, + {"fan_point1", GSP_FAN_1}, + {"fan_point2", GSP_FAN_2}, + {"fan_point3", GSP_FAN_3}, + {"fan_point4", GSP_FAN_4}, + {"fan_point5", GSP_FAN_5}, +}; + +struct gsp_data { + struct device *hwmon_dev; + struct attribute_group attrs; + enum chips type; +}; + +static int gsp_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int gsp_remove(struct i2c_client *client); + +static const struct i2c_device_id gsp_id[] = { + { "gsp", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, gsp_id); + +static struct i2c_driver gsp_driver = { + .driver = { + .name = "gsp", + }, + .probe = gsp_probe, + .remove = gsp_remove, + .id_table = gsp_id, +}; + +/* All registers are word-sized, except for the configuration registers. + * AD7418 uses a high-byte first convention. Do NOT use those functions to + * access the configuration registers CONF and CONF2, as they are byte-sized. + */ +static inline int gsp_read(struct i2c_client *client, u8 reg) +{ + unsigned int adc = 0; + if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT) + { + adc |= i2c_smbus_read_byte_data(client, reg); + adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; + return adc; + } + else + { + adc |= i2c_smbus_read_byte_data(client, reg); + adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; + adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16; + return adc; + } +} + +static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value) +{ + i2c_smbus_write_byte_data(client, reg, value & 0xff); + i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff)); + return 1; +} + +static ssize_t show_adc(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg)); +} + +static ssize_t show_label(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + + return sprintf(buf, "%s\n", gsp_sensors[attr->index].name); +} + +static ssize_t store_fan(struct device *dev, + struct device_attribute *devattr, const char *buf, size_t count) +{ + u16 val; + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + val = simple_strtoul(buf, NULL, 10); + gsp_write(client, gsp_sensors[attr->index].reg, val); + return count; +} + +static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0); +static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0); + +static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1); +static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2); +static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3); +static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3); +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4); +static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4); +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5); +static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5); +static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6); +static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6); +static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7); +static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7); +static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8); +static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8); +static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9); +static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9); +static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10); +static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10); +static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11); +static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11); +static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12); +static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12); +static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13); +static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13); + +static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14); +static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15); +static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16); +static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17); +static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18); +static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19); + +static struct attribute *gsp_attributes[] = { + &sensor_dev_attr_temp0_input.dev_attr.attr, + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_in5_input.dev_attr.attr, + &sensor_dev_attr_in6_input.dev_attr.attr, + &sensor_dev_attr_in7_input.dev_attr.attr, + &sensor_dev_attr_in8_input.dev_attr.attr, + &sensor_dev_attr_in9_input.dev_attr.attr, + &sensor_dev_attr_in10_input.dev_attr.attr, + &sensor_dev_attr_in11_input.dev_attr.attr, + &sensor_dev_attr_in12_input.dev_attr.attr, + + &sensor_dev_attr_temp0_label.dev_attr.attr, + &sensor_dev_attr_in0_label.dev_attr.attr, + &sensor_dev_attr_in1_label.dev_attr.attr, + &sensor_dev_attr_in2_label.dev_attr.attr, + &sensor_dev_attr_in3_label.dev_attr.attr, + &sensor_dev_attr_in4_label.dev_attr.attr, + &sensor_dev_attr_in5_label.dev_attr.attr, + &sensor_dev_attr_in6_label.dev_attr.attr, + &sensor_dev_attr_in7_label.dev_attr.attr, + &sensor_dev_attr_in8_label.dev_attr.attr, + &sensor_dev_attr_in9_label.dev_attr.attr, + &sensor_dev_attr_in10_label.dev_attr.attr, + &sensor_dev_attr_in11_label.dev_attr.attr, + &sensor_dev_attr_in12_label.dev_attr.attr, + + &sensor_dev_attr_fan0_point0.dev_attr.attr, + &sensor_dev_attr_fan0_point1.dev_attr.attr, + &sensor_dev_attr_fan0_point2.dev_attr.attr, + &sensor_dev_attr_fan0_point3.dev_attr.attr, + &sensor_dev_attr_fan0_point4.dev_attr.attr, + &sensor_dev_attr_fan0_point5.dev_attr.attr, + NULL +}; + + +static int gsp_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adapter = client->adapter; + struct gsp_data *data; + int err; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) { + err = -EOPNOTSUPP; + goto exit; + } + + if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + + data->type = id->driver_data; + + switch (data->type) { + case 0: + data->attrs.attrs = gsp_attributes; + break; + } + + dev_info(&client->dev, "%s chip found\n", client->name); + + /* Register sysfs hooks */ + if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + err = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &data->attrs); +exit_free: + kfree(data); +exit: + return err; +} + +static int gsp_remove(struct i2c_client *client) +{ + struct gsp_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->attrs); + kfree(data); + return 0; +} + +static int __init gsp_init(void) +{ + return i2c_add_driver(&gsp_driver); +} + +static void __exit gsp_exit(void) +{ + i2c_del_driver(&gsp_driver); +} + +module_init(gsp_init); +module_exit(gsp_exit); + +MODULE_AUTHOR("Chris Lang "); +MODULE_DESCRIPTION("GSC HWMON driver"); +MODULE_LICENSE("GPL"); +MODULE_VERSION(DRV_VERSION); + diff --git a/package/kernel/kmod-sched-cake/Makefile b/package/kernel/kmod-sched-cake/Makefile index b760c2a358..519278db1c 100644 --- a/package/kernel/kmod-sched-cake/Makefile +++ b/package/kernel/kmod-sched-cake/Makefile @@ -9,15 +9,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=sched-cake -PKG_SOURCE_VERSION:=4f62bd17fa34036cb3c8fd4800a709b2734c3de3 -PKG_VERSION:=2016-10-02-$(PKG_SOURCE_VERSION) PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_MIRROR_MD5SUM:=d6fd82607862c16ba5f1007ecfb251eba9e2cc82c55bb3f4aee2fbebf9fa6d2a +PKG_SOURCE_URL:=https://github.com/kdarbyshirebryant/sch_cake.git +PKG_SOURCE_DATE:=2016-12-19 +PKG_SOURCE_VERSION:=70c8eb766d5afcf3cf187594b7cd776da92bee3c +PKG_MIRROR_HASH:=16174db5dad0a5b5ba522d4cfc058cff9851ed013a3a05166b04eb127bb12a24 PKG_MAINTAINER:=Kevin Darbyshire-Bryant include $(INCLUDE_DIR)/package.mk @@ -28,7 +26,7 @@ define KernelPackage/sched-cake URL:=https://github.com/dtaht/sch_cake FILES:=$(PKG_BUILD_DIR)/sch_cake.ko AUTOLOAD:=$(call AutoLoad,75,sch_cake) - DEPENDS:=+kmod-ipt-conntrack + DEPENDS:=+kmod-ipt-conntrack @!LINUX_3_18 endef include $(INCLUDE_DIR)/kernel-defaults.mk diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile index 21381c7296..c2d10ec188 100644 --- a/package/kernel/linux/Makefile +++ b/package/kernel/linux/Makefile @@ -23,9 +23,8 @@ export SHELL:=/bin/sh include $(INCLUDE_DIR)/package.mk -STAMP_BUILT:=$(STAMP_BUILT)_$(firstword $(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | md5sum)) - ifeq ($(DUMP),) + STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | mkhash md5) -include $(LINUX_DIR)/.config endif diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index 4d34924649..508b3abd5d 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -90,25 +90,6 @@ endef $(eval $(call KernelPackage,ata-artop)) -define KernelPackage/ata-imx - TITLE:=Freescale i.MX AHCI SATA support - DEPENDS:=@TARGET_imx6 - KCONFIG:=\ - CONFIG_AHCI_IMX \ - CONFIG_SATA_AHCI_PLATFORM \ - CONFIG_PATA_IMX=n - FILES:=$(LINUX_DIR)/drivers/ata/ahci_imx.ko - AUTOLOAD:=$(call AutoLoad,41,ahci_imx,1) - $(call AddDepends/ata) -endef - -define KernelPackage/ata-imx/description - SATA support for the Freescale i.MX6 SoC's onboard AHCI SATA -endef - -$(eval $(call KernelPackage,ata-imx)) - - define KernelPackage/ata-marvell-sata TITLE:=Marvell Serial ATA support KCONFIG:=CONFIG_SATA_MV diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 0a88c3be12..67526024e5 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -158,32 +158,6 @@ endef $(eval $(call KernelPackage,crypto-seqiv)) -define KernelPackage/crypto-hw-caam - TITLE:=Freescale CAAM driver (SEC4) - DEPENDS:=@TARGET_imx6||TARGET_mpc85xx +kmod-crypto-aead +kmod-crypto-authenc +kmod-crypto-hash +kmod-random-core - KCONFIG:= \ - CONFIG_CRYPTO_HW=y \ - CONFIG_CRYPTO_DEV_FSL_CAAM \ - CONFIG_CRYPTO_DEV_FSL_CAAM_JR \ - CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API \ - CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API \ - CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API \ - CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 \ - CONFIG_CRYPTO_DEV_FSL_CAAM_INTC=n \ - CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG=n - FILES:= \ - $(LINUX_DIR)/drivers/crypto/caam/caam.ko \ - $(LINUX_DIR)/drivers/crypto/caam/caamalg.ko \ - $(LINUX_DIR)/drivers/crypto/caam/caamhash.ko \ - $(LINUX_DIR)/drivers/crypto/caam/caam_jr.ko \ - $(LINUX_DIR)/drivers/crypto/caam/caamrng.ko - AUTOLOAD:=$(call AutoLoad,09,caam caamalg caamhash caam_jr caamrng) - $(call AddDepends/crypto) -endef - -$(eval $(call KernelPackage,crypto-hw-caam)) - - define KernelPackage/crypto-hw-talitos TITLE:=Freescale integrated security engine (SEC) driver DEPENDS:=+kmod-crypto-manager +kmod-crypto-hash +kmod-random-core +kmod-crypto-authenc @@ -266,54 +240,6 @@ endef $(eval $(call KernelPackage,crypto-hw-hifn-795x)) -define KernelPackage/crypto-hw-ppc4xx - TITLE:=AMCC PPC4xx hardware crypto module - DEPENDS:=@TARGET_ppc40x||TARGET_ppc44x - KCONFIG:= \ - CONFIG_CRYPTO_HW=y \ - CONFIG_CRYPTO_DEV_PPC4XX - FILES:=$(LINUX_DIR)/drivers/crypto/amcc/crypto4xx.ko - AUTOLOAD:=$(call AutoLoad,90,crypto4xx) - $(call AddDepends/crypto,+kmod-crypto-manager +kmod-crypto-hash) -endef - -define KernelPackage/crypto-hw-ppc4xx/description - Kernel support for the AMCC PPC4xx HW crypto engine. -endef - -$(eval $(call KernelPackage,crypto-hw-ppc4xx)) - - -define KernelPackage/crypto-hw-omap - TITLE:=TI OMAP hardware crypto modules - DEPENDS:=@TARGET_omap - KCONFIG:= \ - CONFIG_CRYPTO_HW=y \ - CONFIG_CRYPTO_DEV_OMAP_AES \ - CONFIG_CRYPTO_DEV_OMAP_DES \ - CONFIG_CRYPTO_DEV_OMAP_SHAM -ifneq ($(wildcard $(LINUX_DIR)/drivers/crypto/omap-des.ko),) - FILES:= \ - $(LINUX_DIR)/drivers/crypto/omap-aes.ko \ - $(LINUX_DIR)/drivers/crypto/omap-des.ko \ - $(LINUX_DIR)/drivers/crypto/omap-sham.ko - AUTOLOAD:=$(call AutoLoad,90,omap-aes omap-des omap-sham) -else - FILES:= \ - $(LINUX_DIR)/drivers/crypto/omap-aes.ko \ - $(LINUX_DIR)/drivers/crypto/omap-sham.ko - AUTOLOAD:=$(call AutoLoad,90,omap-aes omap-sham) -endif - $(call AddDepends/crypto,+kmod-crypto-manager +kmod-crypto-hash) -endef - -define KernelPackage/crypto-hw-omap/description - Kernel support for the TI OMAP HW crypto engine. -endef - -$(eval $(call KernelPackage,crypto-hw-omap)) - - define KernelPackage/crypto-authenc TITLE:=Combined mode wrapper for IPsec DEPENDS:=+kmod-crypto-manager +LINUX_4_4:kmod-crypto-null @@ -394,7 +320,7 @@ $(eval $(call KernelPackage,crypto-des)) define KernelPackage/crypto-deflate TITLE:=Deflate compression CryptoAPI module - DEPENDS:=+kmod-lib-zlib + DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate KCONFIG:=CONFIG_CRYPTO_DEFLATE FILES:=$(LINUX_DIR)/crypto/deflate.ko AUTOLOAD:=$(call AutoLoad,09,deflate) @@ -533,7 +459,8 @@ define KernelPackage/crypto-sha1 DEPENDS:=+kmod-crypto-hash KCONFIG:= \ CONFIG_CRYPTO_SHA1 \ - CONFIG_CRYPTO_SHA1_OCTEON + CONFIG_CRYPTO_SHA1_OCTEON \ + CONFIG_CRYPTO_SHA1_SSSE3 FILES:=$(LINUX_DIR)/crypto/sha1_generic.ko AUTOLOAD:=$(call AutoLoad,09,sha1_generic) $(call AddDepends/crypto) @@ -544,6 +471,11 @@ define KernelPackage/crypto-sha1/octeon AUTOLOAD:=$(call AutoLoad,09,octeon-sha1) endef +define KernelPackage/crypto-sha1/x86/64 + FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko + AUTOLOAD:=$(call AutoLoad,09,sha1-ssse3) +endef + $(eval $(call KernelPackage,crypto-sha1)) @@ -552,7 +484,8 @@ define KernelPackage/crypto-sha256 DEPENDS:=+kmod-crypto-hash KCONFIG:= \ CONFIG_CRYPTO_SHA256 \ - CONFIG_CRYPTO_SHA256_OCTEON + CONFIG_CRYPTO_SHA256_OCTEON \ + CONFIG_CRYPTO_SHA256_SSSE3 FILES:=$(LINUX_DIR)/crypto/sha256_generic.ko AUTOLOAD:=$(call AutoLoad,09,sha256_generic) $(call AddDepends/crypto) @@ -563,6 +496,11 @@ define KernelPackage/crypto-sha256/octeon AUTOLOAD:=$(call AutoLoad,09,octeon-sha256) endef +define KernelPackage/crypto-sha256/x86/64 + FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko + AUTOLOAD:=$(call AutoLoad,09,sha256-ssse3) +endef + $(eval $(call KernelPackage,crypto-sha256)) @@ -571,7 +509,8 @@ define KernelPackage/crypto-sha512 DEPENDS:=+kmod-crypto-hash KCONFIG:= \ CONFIG_CRYPTO_SHA512 \ - CONFIG_CRYPTO_SHA512_OCTEON + CONFIG_CRYPTO_SHA512_OCTEON \ + CONFIG_CRYPTO_SHA512_SSSE3 FILES:=$(LINUX_DIR)/crypto/sha512_generic.ko AUTOLOAD:=$(call AutoLoad,09,sha512_generic) $(call AddDepends/crypto) @@ -582,6 +521,11 @@ define KernelPackage/crypto-sha512/octeon AUTOLOAD:=$(call AutoLoad,09,octeon-sha512) endef +define KernelPackage/crypto-sha512/x86/64 + FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko + AUTOLOAD:=$(call AutoLoad,09,sha512-ssse3) +endef + $(eval $(call KernelPackage,crypto-sha512)) @@ -661,15 +605,3 @@ define KernelPackage/crypto-xts endef $(eval $(call KernelPackage,crypto-xts)) - - -define KernelPackage/crypto-mv-cesa - TITLE:=Marvell crypto engine - DEPENDS:=+kmod-crypto-manager @TARGET_kirkwood||TARGET_orion - KCONFIG:=CONFIG_CRYPTO_DEV_MV_CESA - FILES:=$(LINUX_DIR)/drivers/crypto/mv_cesa.ko - AUTOLOAD:=$(call AutoLoad,09,mv_cesa) - $(call AddDepends/crypto) -endef - -$(eval $(call KernelPackage,crypto-mv-cesa)) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index ce2408cdc4..4d69d9b140 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -82,7 +82,7 @@ $(eval $(call KernelPackage,fs-autofs4)) define KernelPackage/fs-btrfs SUBMENU:=$(FS_MENU) TITLE:=BTRFS filesystem support - DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib +kmod-lib-raid6 +kmod-lib-xor + DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor KCONFIG:=\ CONFIG_BTRFS_FS \ CONFIG_BTRFS_FS_POSIX_ACL=n \ @@ -144,7 +144,7 @@ $(eval $(call KernelPackage,fs-configfs)) define KernelPackage/fs-cramfs SUBMENU:=$(FS_MENU) TITLE:=Compressed RAM/ROM filesystem support - DEPENDS:=+kmod-lib-zlib + DEPENDS:=+kmod-lib-zlib-inflate KCONFIG:= \ CONFIG_CRAMFS FILES:=$(LINUX_DIR)/fs/cramfs/cramfs.ko @@ -268,7 +268,7 @@ $(eval $(call KernelPackage,fs-hfsplus)) define KernelPackage/fs-isofs SUBMENU:=$(FS_MENU) TITLE:=ISO9660 filesystem support - DEPENDS:=+kmod-lib-zlib + DEPENDS:=+kmod-lib-zlib-inflate KCONFIG:=CONFIG_ISO9660_FS CONFIG_JOLIET=y CONFIG_ZISOFS=n FILES:=$(LINUX_DIR)/fs/isofs/isofs.ko AUTOLOAD:=$(call AutoLoad,30,isofs) diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index 56cd0ec995..e2962058aa 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -313,19 +313,34 @@ endef $(eval $(call KernelPackage,hwmon-w83793)) -define KernelPackage/hwmon-gsc - TITLE:=Gateworks GSC monitoring support - KCONFIG:=CONFIG_SENSORS_GSC - FILES:=$(LINUX_DIR)/drivers/hwmon/gsc.ko - AUTOLOAD:=$(call AutoLoad,60,gsc) - $(call AddDepends/hwmon,+kmod-i2c-core) +define KernelPackage/hwmon-tmp102 + TITLE:=Texas Instruments TMP102 monitoring support + KCONFIG:=CONFIG_SENSORS_TMP102 + FILES:=$(LINUX_DIR)/drivers/hwmon/tmp102.ko + AUTOLOAD:=$(call AutoProbe,tmp102) + $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal) +endef + +define KernelPackage/hwmon-tmp102/description + Kernel module for Texas Instruments TMP102 temperature sensors chip +endef + +$(eval $(call KernelPackage,hwmon-tmp102)) + + +define KernelPackage/hwmon-tmp103 + TITLE:=Texas Instruments TMP103 monitoring support + KCONFIG:=CONFIG_SENSORS_TMP103 + FILES:=$(LINUX_DIR)/drivers/hwmon/tmp103.ko + AUTOLOAD:=$(call AutoProbe,tmp103) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap) endef -define KernelPackage/hwmon-gsc/description - Kernel module for the Gateworks System Controller chips. +define KernelPackage/hwmon-tmp103/description + Kernel module for Texas Instruments TMP103 temperature sensors chip endef -$(eval $(call KernelPackage,hwmon-gsc)) +$(eval $(call KernelPackage,hwmon-tmp103)) define KernelPackage/hwmon-tmp421 diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk index e1c65d493e..7e85ef3d9d 100644 --- a/package/kernel/linux/modules/i2c.mk +++ b/package/kernel/linux/modules/i2c.mk @@ -104,53 +104,6 @@ endef $(eval $(call KernelPackage,i2c-gpio)) -I2C_MPC_MODULES:=\ - CONFIG_I2C_MPC:drivers/i2c/busses/i2c-mpc - -define KernelPackage/i2c-mpc - $(call i2c_defaults,$(I2C_MPC_MODULES),59) - TITLE:=MPC I2C accessors - DEPENDS:=@TARGET_mpc52xx||TARGET_mpc83xx||TARGET_mpc85xx +kmod-i2c-core -endef - -define KernelPackage/i2c-mpc/description - Kernel module for Freescale MPC52xx MPC83xx MPC85xx I2C accessors -endef - -$(eval $(call KernelPackage,i2c-mpc)) - -I2C_IBM_IIC_MODULES:=\ - CONFIG_I2C_IBM_IIC:drivers/i2c/busses/i2c-ibm_iic - -define KernelPackage/i2c-ibm-iic - $(call i2c_defaults,$(OF_I2C_MODULES),59) - TITLE:=IBM PPC 4xx on-chip I2C interface support - DEPENDS:=@TARGET_ppc40x||TARGET_ppc4xx +kmod-i2c-core -endef - -define KernelPackage/i2c-ibm-iic/description - Kernel module for IIC peripheral found on embedded IBM PPC4xx based systems -endef - -$(eval $(call KernelPackage,i2c-ibm-iic)) - -I2C_MV64XXX_MODULES:=\ - CONFIG_I2C_MV64XXX:drivers/i2c/busses/i2c-mv64xxx - -define KernelPackage/i2c-mv64xxx - $(call i2c_defaults,$(I2C_MV64XXX_MODULES),59) - TITLE:=Orion Platform I2C interface support - DEPENDS:=@TARGET_kirkwood||TARGET_orion +kmod-i2c-core -endef - -define KernelPackage/i2c-mv64xxx/description - Kernel module for I2C interface on the Kirkwood, Orion and Armada XP/370 - family processors -endef - -$(eval $(call KernelPackage,i2c-mv64xxx)) - - I2C_TINY_USB_MODULES:= \ CONFIG_I2C_TINY_USB:drivers/i2c/busses/i2c-tiny-usb diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index c5148ce487..72c5eff69c 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -195,20 +195,28 @@ endef $(eval $(call KernelPackage,lib-textsearch)) -define KernelPackage/lib-zlib +define KernelPackage/lib-zlib-inflate SUBMENU:=$(LIB_MENU) TITLE:=Zlib support HIDDEN:=1 - KCONFIG:= \ - CONFIG_ZLIB_DEFLATE \ - CONFIG_ZLIB_INFLATE - FILES:= \ - $(LINUX_DIR)/lib/zlib_deflate/zlib_deflate.ko \ - $(LINUX_DIR)/lib/zlib_inflate/zlib_inflate.ko - AUTOLOAD:=$(call AutoProbe,zlib_deflate zlib_inflate) + KCONFIG:=CONFIG_ZLIB_INFLATE + FILES:=$(LINUX_DIR)/lib/zlib_inflate/zlib_inflate.ko + AUTOLOAD:=$(call AutoProbe,zlib_inflate) +endef + +$(eval $(call KernelPackage,lib-zlib-inflate)) + + +define KernelPackage/lib-zlib-deflate + SUBMENU:=$(LIB_MENU) + TITLE:=Zlib support + HIDDEN:=1 + KCONFIG:=CONFIG_ZLIB_DEFLATE + FILES:=$(LINUX_DIR)/lib/zlib_deflate/zlib_deflate.ko + AUTOLOAD:=$(call AutoProbe,zlib_deflate) endef -$(eval $(call KernelPackage,lib-zlib)) +$(eval $(call KernelPackage,lib-zlib-deflate)) define KernelPackage/lib-cordic diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 83f3f910e2..bd9a1a10f2 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -130,24 +130,6 @@ endef $(eval $(call KernelPackage,et131x)) -define KernelPackage/gw16083 - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Gateworks Ventana Ethernet Expansion Mezzanine driver - URL:=http://www.gateworks.com - FILES:=$(LINUX_DIR)/drivers/net/phy/gw16083.ko - KCONFIG:=CONFIG_GATEWORKS_GW16083 - DEPENDS:=@TARGET_imx6 @PCI_SUPPORT +kmod-libphy +kmod-igb - AUTOLOAD:=$(call AutoLoad,36,gw16083) -endef - -define KernelPackage/gw16083/description - This package contains the gw16083 kernel module for supporting the Gateworks - Ventana Ethernet Expansion Mezzanine. -endef - -$(eval $(call KernelPackage,gw16083)) - - define KernelPackage/phylib-broadcom SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Broadcom Ethernet PHY library @@ -380,7 +362,7 @@ $(eval $(call KernelPackage,via-rhine)) define KernelPackage/via-velocity SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=VIA Velocity Gigabit Ethernet Adapter kernel support - DEPENDS:=@TARGET_ixp4xx||TARGET_mpc83xx||PCI_SUPPORT +kmod-lib-crc-ccitt + DEPENDS:=@PCI_SUPPORT +kmod-lib-crc-ccitt KCONFIG:=CONFIG_VIA_VELOCITY FILES:=$(LINUX_DIR)/drivers/net/ethernet/via/via-velocity.ko AUTOLOAD:=$(call AutoProbe,via-velocity) @@ -800,38 +782,6 @@ endef $(eval $(call KernelPackage,of-mdio)) -define KernelPackage/fsl-pq-mdio - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Freescale PQ MDIO bus support - DEPENDS:=@TARGET_mpc85xx +kmod-of-mdio - KCONFIG:=CONFIG_FSL_PQ_MDIO - FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fsl_pq_mdio.ko - AUTOLOAD:=$(call AutoLoad,42,fsl_pq_mdio) -endef - -define KernelPackage/fsl-pq-mdio/description - Kernel driver for the Freescale PQ MDIO bus -endef - -$(eval $(call KernelPackage,fsl-pq-mdio)) - - -define KernelPackage/gianfar - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Gianfar Ethernet support - DEPENDS:=@TARGET_mpc85xx +kmod-fsl-pq-mdio - KCONFIG:=CONFIG_GIANFAR - FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/gianfar_driver.ko - AUTOLOAD:=$(call AutoProbe,gianfar_driver) -endef - -define KernelPackage/gianfar/description - Kernel driver for Freescale Gianfar Ethernet support -endef - -$(eval $(call KernelPackage,gianfar)) - - define KernelPackage/vmxnet3 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=VMware VMXNET3 ethernet driver @@ -863,3 +813,35 @@ define KernelPackage/spi-ks8995/description endef $(eval $(call KernelPackage,spi-ks8995)) + + +define KernelPackage/ethoc + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Opencore.org ethoc driver + DEPENDS:=+kmod-libphy + FILES:=$(LINUX_DIR)/drivers/net/ethernet/ethoc.ko + KCONFIG:=CONFIG_ETHOC + AUTOLOAD:=$(call AutoProbe,ethoc) +endef + +define KernelPackage/ethoc/description + Kernel module for the Opencores.org ethernet adapter +endef + +$(eval $(call KernelPackage,ethoc)) + + +define KernelPackage/bnx2 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=BCM5706/5708/5709/5716 ethernet adapter driver + DEPENDS:=@PCI_SUPPORT +bnx2-firmware + FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnx2.ko + KCONFIG:=CONFIG_BNX2 + AUTOLOAD:=$(call AutoProbe,bnx2) +endef + +define KernelPackage/bnx2/description + Kernel module for the BCM5706/5708/5709/5716 ethernet adapter +endef + +$(eval $(call KernelPackage,bnx2)) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index c21f58d79b..bc2f349c76 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -289,6 +289,28 @@ endef $(eval $(call KernelPackage,ipt-nat)) +define KernelPackage/ipt-raw + TITLE:=Netfilter IPv4 raw table support + KCONFIG:=CONFIG_IP_NF_RAW + FILES:=$(LINUX_DIR)/net/ipv4/netfilter/iptable_raw.ko + AUTOLOAD:=$(call AutoProbe,iptable_raw) + $(call AddDepends/ipt) +endef + +$(eval $(call KernelPackage,ipt-raw)) + + +define KernelPackage/ipt-raw6 + TITLE:=Netfilter IPv6 raw table support + KCONFIG:=CONFIG_IP6_NF_RAW + FILES:=$(LINUX_DIR)/net/ipv6/netfilter/ip6table_raw.ko + AUTOLOAD:=$(call AutoProbe,ip6table_raw) + $(call AddDepends/ipt,+kmod-ip6tables) +endef + +$(eval $(call KernelPackage,ipt-raw6)) + + define KernelPackage/ipt-nat6 TITLE:=IPv6 NAT targets KCONFIG:=$(KCONFIG_IPT_NAT6) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index e1b1e16d1d..017a94c622 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -114,23 +114,8 @@ endef $(eval $(call KernelPackage,bluetooth_6lowpan)) -define KernelPackage/bluetooth-hci-h4p - SUBMENU:=$(OTHER_MENU) - TITLE:=HCI driver with H4 Nokia extensions - DEPENDS:=@TARGET_omap24xx +kmod-bluetooth - KCONFIG:=CONFIG_BT_HCIH4P - FILES:=$(LINUX_DIR)/drivers/bluetooth/hci_h4p/hci_h4p.ko - AUTOLOAD:=$(call AutoProbe,hci_h4p) -endef - -define KernelPackage/bluetooth-hci-h4p/description - HCI driver with H4 Nokia extensions -endef - -$(eval $(call KernelPackage,bluetooth-hci-h4p)) - - define KernelPackage/dma-buf + SUBMENU:=$(OTHER_MENU) TITLE:=DMA shared buffer support HIDDEN:=1 KCONFIG:=CONFIG_DMA_SHARED_BUFFER @@ -383,7 +368,7 @@ define KernelPackage/sdhci $(LINUX_DIR)/drivers/mmc/host/sdhci.ko \ $(LINUX_DIR)/drivers/mmc/host/sdhci-pltfm.ko - AUTOLOAD:=$(call AutoProbe,sdhci sdhci-pltfm,1) + AUTOLOAD:=$(call AutoProbe,sdhci-pltfm,1) endef define KernelPackage/sdhci/description @@ -481,38 +466,6 @@ endef $(eval $(call KernelPackage,bcma)) -define KernelPackage/wdt-omap - SUBMENU:=$(OTHER_MENU) - TITLE:=OMAP Watchdog timer - DEPENDS:=@(TARGET_omap24xx||TARGET_omap35xx) - KCONFIG:=CONFIG_OMAP_WATCHDOG - FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/omap_wdt.ko - AUTOLOAD:=$(call AutoLoad,50,omap_wdt,1) -endef - -define KernelPackage/wdt-omap/description - Kernel module for TI omap watchdog timer -endef - -$(eval $(call KernelPackage,wdt-omap)) - - -define KernelPackage/wdt-orion - SUBMENU:=$(OTHER_MENU) - TITLE:=Marvell Orion Watchdog timer - DEPENDS:=@TARGET_orion||TARGET_kirkwood - KCONFIG:=CONFIG_ORION_WATCHDOG - FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/orion_wdt.ko - AUTOLOAD:=$(call AutoLoad,50,orion_wdt,1) -endef - -define KernelPackage/wdt-orion/description - Kernel module for Marvell Orion, Kirkwood and Armada XP/370 watchdog timer -endef - -$(eval $(call KernelPackage,wdt-orion)) - - define KernelPackage/rtc-ds1307 SUBMENU:=$(OTHER_MENU) TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support @@ -583,23 +536,6 @@ endef $(eval $(call KernelPackage,rtc-isl1208)) -define KernelPackage/rtc-marvell - SUBMENU:=$(OTHER_MENU) - TITLE:=Marvell SoC built-in RTC support - DEPENDS:=@RTC_SUPPORT @TARGET_kirkwood||TARGET_orion - KCONFIG:=CONFIG_RTC_DRV_MV \ - CONFIG_RTC_CLASS=y - FILES:=$(LINUX_DIR)/drivers/rtc/rtc-mv.ko - AUTOLOAD:=$(call AutoProbe,rtc-mv) -endef - -define KernelPackage/rtc-marvell/description - Kernel module for Marvell SoC built-in RTC. -endef - -$(eval $(call KernelPackage,rtc-marvell)) - - define KernelPackage/rtc-pcf8563 SUBMENU:=$(OTHER_MENU) TITLE:=Philips PCF8563/Epson RTC8564 RTC support @@ -650,22 +586,6 @@ endef $(eval $(call KernelPackage,rtc-pt7c4338)) -define KernelPackage/rtc-snvs - SUBMENU:=$(OTHER_MENU) - TITLE:=Freescale SNVS RTC support - DEPENDS:=@TARGET_imx6 @RTC_SUPPORT - KCONFIG:=CONFIG_RTC_DRV_SNVS \ - CONFIG_RTC_CLASS=y - FILES:=$(LINUX_DIR)/drivers/rtc/rtc-snvs.ko - AUTOLOAD:=$(call AutoLoad,50,rtc-snvs,1) -endef - -define KernelPackage/rtc-snvs/description - Kernel module for Freescale SNVS RTC on chip module -endef - -$(eval $(call KernelPackage,rtc-snvs)) - define KernelPackage/rtc-rs5c372a SUBMENU:=$(OTHER_MENU) TITLE:=Ricoh R2025S/D, RS5C372A/B, RV5C386, RV5C387A @@ -791,22 +711,6 @@ endef $(eval $(call KernelPackage,zram)) -define KernelPackage/mvsdio - SUBMENU:=$(OTHER_MENU) - TITLE:=Marvell SDIO support - DEPENDS:=@TARGET_orion||TARGET_kirkwood +kmod-mmc - KCONFIG:=CONFIG_MMC_MVSDIO - FILES:=$(LINUX_DIR)/drivers/mmc/host/mvsdio.ko - AUTOLOAD:=$(call AutoProbe,mvsdio) -endef - -define KernelPackage/mvsdio/description - Kernel support for the Marvell SDIO controller -endef - -$(eval $(call KernelPackage,mvsdio)) - - define KernelPackage/pps SUBMENU:=$(OTHER_MENU) TITLE:=PPS support @@ -881,7 +785,7 @@ $(eval $(call KernelPackage,ptp)) define KernelPackage/ptp-gianfar SUBMENU:=$(OTHER_MENU) TITLE:=Freescale Gianfar PTP support - DEPENDS:=@TARGET_mpc85xx +kmod-gianfar +kmod-ptp + DEPENDS:=@TARGET_mpc85xx +kmod-ptp KCONFIG:=CONFIG_PTP_1588_CLOCK_GIANFAR FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/gianfar_ptp.ko AUTOLOAD:=$(call AutoProbe,gianfar_ptp) @@ -913,7 +817,7 @@ define KernelPackage/random-omap TITLE:=Hardware Random Number Generator OMAP support KCONFIG:=CONFIG_HW_RANDOM_OMAP FILES:=$(LINUX_DIR)/drivers/char/hw_random/omap-rng.ko - DEPENDS:=@(TARGET_omap24xx||TARGET_omap) +kmod-random-core + DEPENDS:=@TARGET_omap24xx +kmod-random-core AUTOLOAD:=$(call AutoProbe,random-omap) endef @@ -954,43 +858,6 @@ endef $(eval $(call KernelPackage,thermal)) -define KernelPackage/thermal-imx - SUBMENU:=$(OTHER_MENU) - TITLE:=Temperature sensor driver for Freescale i.MX SoCs - DEPENDS:=@TARGET_imx6 +kmod-thermal - KCONFIG:= \ - CONFIG_IMX_THERMAL - FILES:=$(LINUX_DIR)/drivers/thermal/imx_thermal.ko - AUTOLOAD:=$(call AutoProbe,imx_thermal) -endef - -define KernelPackage/thermal-imx/description - Support for Temperature Monitor (TEMPMON) found on Freescale i.MX SoCs. - It supports one critical trip point and one passive trip point. The - cpufreq is used as the cooling device to throttle CPUs when the - passive trip is crossed. -endef - -$(eval $(call KernelPackage,thermal-imx)) - - -define KernelPackage/thermal-kirkwood - SUBMENU:=$(OTHER_MENU) - TITLE:=Temperature sensor on Marvell Kirkwood SoCs - DEPENDS:=@TARGET_kirkwood +kmod-thermal - KCONFIG:=CONFIG_KIRKWOOD_THERMAL - FILES:=$(LINUX_DIR)/drivers/thermal/kirkwood_thermal.ko - AUTOLOAD:=$(call AutoProbe,kirkwood_thermal) -endef - -define KernelPackage/thermal-kirkwood/description - Support for the Kirkwood thermal sensor driver into the Linux thermal - framework. Only kirkwood 88F6282 and 88F6283 have this sensor. -endef - -$(eval $(call KernelPackage,thermal-kirkwood)) - - define KernelPackage/gpio-beeper SUBMENU:=$(OTHER_MENU) TITLE:=GPIO beeper support diff --git a/package/kernel/linux/modules/pcmcia.mk b/package/kernel/linux/modules/pcmcia.mk index 51668facf0..11c2106cb0 100644 --- a/package/kernel/linux/modules/pcmcia.mk +++ b/package/kernel/linux/modules/pcmcia.mk @@ -13,6 +13,7 @@ define KernelPackage/pcmcia-core DEPENDS:=@PCMCIA_SUPPORT KCONFIG:= \ CONFIG_PCMCIA \ + CONFIG_PCMCIA_LOAD_CIS=y \ CONFIG_CARDBUS \ CONFIG_PCCARD \ PCMCIA_DEBUG=n @@ -28,13 +29,19 @@ endef $(eval $(call KernelPackage,pcmcia-core)) -define KernelPackage/pcmcia-rsrc + +define AddDepends/pcmcia SUBMENU:=$(PCMCIA_MENU) + DEPENDS+=kmod-pcmcia-core $(1) +endef + + +define KernelPackage/pcmcia-rsrc TITLE:=PCMCIA resource support - DEPENDS:=kmod-pcmcia-core KCONFIG:=CONFIG_PCCARD_NONSTATIC=y FILES:=$(LINUX_DIR)/drivers/pcmcia/pcmcia_rsrc.ko AUTOLOAD:=$(call AutoLoad,26,pcmcia_rsrc) + $(call AddDepends/pcmcia) endef define KernelPackage/pcmcia-rsrc/description @@ -45,26 +52,26 @@ $(eval $(call KernelPackage,pcmcia-rsrc)) define KernelPackage/pcmcia-yenta - SUBMENU:=$(PCMCIA_MENU) TITLE:=yenta socket driver - DEPENDS:=kmod-pcmcia-rsrc KCONFIG:=CONFIG_YENTA FILES:=$(LINUX_DIR)/drivers/pcmcia/yenta_socket.ko - AUTOLOAD:=$(call AutoLoad,41,pcmcia_rsrc yenta_socket) + AUTOLOAD:=$(call AutoLoad,41,yenta_socket) + DEPENDS:=+kmod-pcmcia-rsrc + $(call AddDepends/pcmcia) endef $(eval $(call KernelPackage,pcmcia-yenta)) define KernelPackage/pcmcia-serial - SUBMENU:=$(PCMCIA_MENU) TITLE:=Serial devices support - DEPENDS:=kmod-pcmcia-core +kmod-serial-8250 KCONFIG:= \ CONFIG_PCMCIA_SERIAL_CS \ CONFIG_SERIAL_8250_CS - FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/serial_cs.ko + FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/serial_cs.ko AUTOLOAD:=$(call AutoLoad,45,serial_cs) + DEPENDS:=+kmod-serial-8250 + $(call AddDepends/pcmcia) endef define KernelPackage/pcmcia-serial/description @@ -72,3 +79,35 @@ define KernelPackage/pcmcia-serial/description endef $(eval $(call KernelPackage,pcmcia-serial)) + + +define KernelPackage/pcmcia-pd6729 + TITLE:=Cirrus PD6729 compatible bridge support + KCONFIG:=CONFIG_PD6729 + FILES:=$(LINUX_DIR)/drivers/pcmcia/pd6729.ko + AUTOLOAD:=$(call AutoLoad,41,pd6729) + DEPENDS:=+kmod-pcmcia-rsrc + $(call AddDepends/pcmcia) +endef + +define KernelPackage/pcmcia-pd6729/description + Kernel support for the Cirrus PD6729 PCI-to-PCMCIA bridge +endef + +$(eval $(call KernelPackage,pcmcia-pd6729)) + + +define KernelPackage/pcmcia-nozomi + TITLE:=Option Fusion+ card + KCONFIG:=CONFIG_NOZOMI + FILES:=$(LINUX_DIR)/drivers/tty/nozomi.ko + AUTOLOAD:=$(call AutoLoad,60,nozomi) + DEPENDS:=+kmod-pcmcia-rsrc + $(call AddDepends/pcmcia) +endef + +define KernelPackage/pcmcia-nozomi/description + Kernel support for Option Fusion+ card +endef + +$(eval $(call KernelPackage,pcmcia-nozomi)) diff --git a/package/kernel/linux/modules/spi.mk b/package/kernel/linux/modules/spi.mk index b16e26ef04..1c2a789fed 100644 --- a/package/kernel/linux/modules/spi.mk +++ b/package/kernel/linux/modules/spi.mk @@ -89,20 +89,3 @@ define KernelPackage/spi-dev/description endef $(eval $(call KernelPackage,spi-dev)) - -define KernelPackage/spi-omap-24xx - SUBMENU:=$(SPI_MENU) - TITLE:=SPI omap 24xx - DEPENDS:=@(TARGET_omap24xx||TARGET_omap) - KCONFIG:=CONFIG_SPI_OMAP24XX \ - CONFIG_SPI=y \ - CONFIG_SPI_MASTER=y - FILES:=$(LINUX_DIR)/drivers/spi/spi-omap2-mcspi.ko - AUTOLOAD:=$(call AutoProbe,spi-omap2-mcspi) -endef - -define KernelPackage/spi-dev/description - This package contains the user mode SPI device driver -endef - -$(eval $(call KernelPackage,spi-omap-24xx)) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 3574bec5f7..4fe17f56ec 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -55,69 +55,6 @@ endef $(eval $(call KernelPackage,usb-ledtrig-usbport)) -define KernelPackage/usb-musb-hdrc - TITLE:=Support for Mentor Graphics silicon dual role USB - KCONFIG:= \ - CONFIG_USB_MUSB_HDRC \ - CONFIG_USB_INVENTRA_DMA=n \ - CONFIG_USB_TI_CPPI41_DMA=n \ - CONFIG_MUSB_PIO_ONLY=y \ - CONFIG_USB_MUSB_DUAL_ROLE=y \ - CONFIG_USB_MUSB_GADGET=n \ - CONFIG_USB_MUSB_HOST=n \ - CONFIG_USB_MUSB_DEBUG=y - DEPENDS:= \ - @(TARGET_omap||TARGET_omap24xx) +kmod-usb-gadget \ - +TARGET_omap24xx:kmod-usb-musb-tusb6010 - FILES:=$(LINUX_DIR)/drivers/usb/musb/musb_hdrc.ko - AUTOLOAD:=$(call AutoLoad,46,musb_hdrc) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-musb-hdrc/description - Kernel support for Mentor Graphics silicon dual role USB device. -endef - -$(eval $(call KernelPackage,usb-musb-hdrc)) - - -define KernelPackage/usb-musb-platformglue - TITLE:=MUSB platform glue layer - KCONFIG:= \ - CONFIG_USB_MUSB_TUSB6010=n \ - CONFIG_USB_MUSB_OMAP2PLUS=n \ - CONFIG_USB_MUSB_AM35X=n \ - CONFIG_USB_MUSB_DSPS \ - CONFIG_USB_MUSB_UX500=n - DEPENDS:=@TARGET_omap +kmod-usb-phy-nop +kmod-usb-musb-hdrc +kmod-usb-phy-am335x - FILES:= \ - $(LINUX_DIR)/drivers/usb/musb/musb_dsps.ko \ - $(LINUX_DIR)/drivers/usb/musb/musb_am335x.ko - AUTOLOAD:=$(call AutoLoad,45,phy-omap-control musb_dsps musb_am335x) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-musb-platformglue/description - MUSB platform glue modules -endef - -$(eval $(call KernelPackage,usb-musb-platformglue)) - - -define KernelPackage/usb-musb-tusb6010 - TITLE:=Support for TUSB 6010 - KCONFIG:=CONFIG_USB_MUSB_TUSB6010 - DEPENDS:=@TARGET_omap24xx - $(call AddDepends/usb) -endef - -define KernelPackage/usb-musb-tusb6010/description - TUSB6010 support -endef - -$(eval $(call KernelPackage,usb-musb-tusb6010)) - - define KernelPackage/usb-phy-nop TITLE:=Support for USB NOP transceiver KCONFIG:=CONFIG_NOP_USB_XCEIV @@ -134,94 +71,6 @@ endef $(eval $(call KernelPackage,usb-phy-nop)) -define KernelPackage/usb-phy-am335x - TITLE:=Support for AM335x USB PHY - KCONFIG:= \ - CONFIG_AM335X_PHY_USB \ - CONFIG_AM335X_CONTROL_USB - DEPENDS:=@TARGET_omap +kmod-usb-phy-nop - FILES:= \ - $(LINUX_DIR)/drivers/usb/phy/phy-am335x.ko \ - $(LINUX_DIR)/drivers/usb/phy/phy-am335x-control.ko - AUTOLOAD:=$(call AutoLoad,44,phy-am335x) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-phy-am335x/description - Support for AM335x USB PHY -endef - -$(eval $(call KernelPackage,usb-phy-am335x)) - - -define KernelPackage/usb-phy-omap-usb2 - TITLE:=Support for OMAP2 USB PHY - KCONFIG:= \ - CONFIG_OMAP_USB2 \ - CONFIG_OMAP_CONTROL_PHY - DEPENDS:=@TARGET_omap - FILES:= \ - $(LINUX_DIR)/drivers/phy/phy-omap-usb2.ko \ - $(LINUX_DIR)/drivers/phy/phy-omap-control.ko - AUTOLOAD:=$(call AutoLoad,45,phy-omap-control phy-omap-usb2) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-phy-omap-usb2/description - Support for AM335x USB PHY -endef - -$(eval $(call KernelPackage,usb-phy-omap-usb2)) - - -define KernelPackage/usb-phy-omap-usb3 - TITLE:=Support for OMAP USB3 PHY - KCONFIG:=CONFIG_OMAP_USB3 - DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2 - FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-omap-usb3.ko - AUTOLOAD:=$(call AutoLoad,45,phy-omap-usb3) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-phy-omap-usb3/description - Support for OMAP USB3 PHY -endef - -$(eval $(call KernelPackage,usb-phy-omap-usb3)) - - -define KernelPackage/usb-phy-twl4030 - TITLE:=Support for TWL4030 OTG PHY - KCONFIG:=CONFIG_TWL4030_USB - DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2 +kmod-usb-musb-hdrc - FILES:=$(LINUX_DIR)/drivers/phy/phy-twl4030-usb.ko - AUTOLOAD:=$(call AutoLoad,45,phy-twl4030-usb) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-phy-twl4030/description - Support for TWL4030/TWL5030/TPS659x0 OTG PHY -endef - -$(eval $(call KernelPackage,usb-phy-twl4030)) - - -define KernelPackage/usb-phy-twl6030 - TITLE:=Support for TWL6030 OTG PHY - KCONFIG:=CONFIG_TWL6030_USB - DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2 +kmod-usb-musb-hdrc - FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-twl6030-usb.ko - AUTOLOAD:=$(call AutoLoad,45,phy-twl6030-usb) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-phy-twl6030/description - Support for TWL6030 OTG PHY -endef - -$(eval $(call KernelPackage,usb-phy-twl6030)) - - define KernelPackage/usb-gadget TITLE:=USB Gadget support KCONFIG:=CONFIG_USB_GADGET @@ -400,40 +249,6 @@ endef $(eval $(call KernelPackage,usb-ohci-pci)) -define KernelPackage/usb2-fsl - TITLE:=Support for Freescale USB2 controllers - DEPENDS:=@TARGET_mpc85xx - HIDDEN:=1 - KCONFIG:=CONFIG_USB_FSL_MPH_DR_OF - FILES:=$(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko - AUTOLOAD:=$(call AutoLoad,39,fsl-mph-dr-of,1) - $(call AddDepends/usb) -endef - -define KernelPackage/usb2-fsl/description - Kernel support for Freescale USB2 (EHCI) controllers -endef - -$(eval $(call KernelPackage,usb2-fsl)) - - -define KernelPackage/usb2-omap - TITLE:=Support for USB2 for OMAP - DEPENDS:=@TARGET_omap +kmod-usb-phy-nop +kmod-usb-phy-am335x +kmod-usb2 - KCONFIG:=\ - CONFIG_MFD_OMAP_USB_HOST=y \ - CONFIG_USB_EHCI_HCD_OMAP - FILES:=$(LINUX_DIR)/drivers/usb/host/ehci-omap.ko - AUTOLOAD:=$(call AutoLoad,39,ehci-omap) - $(call AddDepends/usb) -endef - -define KernelPackage/usb2-omap/description - Kernel support for OMAP USB2 (EHCI) controllers -endef - -$(eval $(call KernelPackage,usb2-omap)) - define KernelPackage/usb-bcma TITLE:=Support for BCMA USB controllers DEPENDS:=@USB_SUPPORT @TARGET_brcm47xx||TARGET_bcm53xx @@ -464,8 +279,7 @@ define KernelPackage/usb2 +TARGET_brcm47xx:kmod-usb-bcma \ +TARGET_brcm47xx:kmod-usb-ssb \ +TARGET_bcm53xx:kmod-usb-bcma \ - +TARGET_bcm53xx:kmod-phy-bcm-ns-usb2 \ - +TARGET_mpc85xx:kmod-usb2-fsl + +TARGET_bcm53xx:kmod-phy-bcm-ns-usb2 KCONFIG:=\ CONFIG_USB_EHCI_HCD \ CONFIG_USB_EHCI_ATH79=y \ @@ -486,10 +300,7 @@ define KernelPackage/usb2 ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko),) FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko endif - ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko),) - FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko - endif - AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel ehci-fsl,1) + AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel,1) $(call AddDepends/usb) endef @@ -518,7 +329,7 @@ $(eval $(call KernelPackage,usb2-pci)) define KernelPackage/usb-dwc2 TITLE:=DWC2 USB controller driver - DEPENDS:=+(TARGET_brcm2708||TARGET_at91||TARGET_brcm63xx||TARGET_mxs||TARGET_imx6||TARGET_omap):kmod-usb-gadget + DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget KCONFIG:= \ CONFIG_USB_DWC2 \ CONFIG_USB_DWC2_PCI \ @@ -1564,46 +1375,6 @@ endef $(eval $(call KernelPackage,usbip-server)) -define KernelPackage/usb-chipidea-imx - TITLE:=Support for ChipIdea controllers - DEPENDS:=@TARGET_imx6||TARGET_mxs +kmod-usb2 +USB_GADGET_SUPPORT:kmod-usb-gadget - KCONFIG:=\ - CONFIG_USB_CHIPIDEA \ - CONFIG_USB_CHIPIDEA_HOST=y \ - CONFIG_USB_CHIPIDEA_UDC=y \ - CONFIG_USB_CHIPIDEA_DEBUG=y - FILES:=\ - $(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \ - $(if $(CONFIG_OF),$(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc_imx.ko) \ - $(if $(CONFIG_OF),$(LINUX_DIR)/drivers/usb/chipidea/usbmisc_imx.ko) - AUTOLOAD:=$(call AutoLoad,51,ci_hdrc $(if $(CONFIG_OF),ci_hdrc_imx usbmisc_imx),1) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-chipidea-imx/description - Kernel support for USB ChipIdea controllers -endef - -$(eval $(call KernelPackage,usb-chipidea-imx,1)) - - -define KernelPackage/usb-mxs-phy - TITLE:=Support for Freescale MXS USB PHY - DEPENDS:=@TARGET_imx6||TARGET_mxs +TARGET_mxs:kmod-usb-chipidea-imx - KCONFIG:=CONFIG_USB_MXS_PHY - FILES:=\ - $(LINUX_DIR)/drivers/usb/phy/phy-mxs-usb.ko - AUTOLOAD:=$(call AutoLoad,52,phy-mxs-usb,1) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-mxs-phy/description - Kernel support for Freescale MXS USB PHY -endef - -$(eval $(call KernelPackage,usb-mxs-phy,1)) - - define KernelPackage/usbmon TITLE:=USB traffic monitor KCONFIG:=CONFIG_USB_MON @@ -1629,8 +1400,7 @@ define KernelPackage/usb3 TITLE:=Support for USB3 controllers DEPENDS:= \ +TARGET_bcm53xx:kmod-usb-bcma \ - +TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \ - +TARGET_omap:kmod-usb-phy-omap-usb3 + +TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 KCONFIG:= \ CONFIG_USB_XHCI_HCD \ CONFIG_USB_XHCI_PCI \ diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk index 196fe675dc..15b39207eb 100644 --- a/package/kernel/linux/modules/w1.mk +++ b/package/kernel/linux/modules/w1.mk @@ -82,7 +82,7 @@ $(eval $(call KernelPackage,w1-master-ds2490)) define KernelPackage/w1-master-mxc TITLE:=Freescale MXC 1-wire busmaster - DEPENDS:=@(TARGET_mxs||TARGET_imx6) + DEPENDS:=@TARGET_imx6 KCONFIG:=CONFIG_W1_MASTER_MXC FILES:=$(W1_MASTERS_DIR)/mxc_w1.ko AUTOLOAD:=$(call AutoProbe,mxc_w1) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 7738a097ca..9f04c4b73a 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -14,7 +14,7 @@ PKG_VERSION:=2016-10-08 PKG_RELEASE:=1 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources PKG_BACKPORT_VERSION:= -PKG_MD5SUM:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb +PKG_HASH:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) @@ -24,9 +24,10 @@ PKG_MAINTAINER:=Felix Fietkau PKG_DRIVERS = \ ath ath5k ath9k ath9k-common ath9k-htc \ + carl9170 \ lib80211 \ mac80211-hwsim \ - + rt2800-lib rt2800-mmio rt2800-soc \ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_kmod-mac80211 \ @@ -36,8 +37,6 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_MAC80211_TRACING \ CONFIG_PACKAGE_ATH_DEBUG \ CONFIG_PACKAGE_ATH_DFS \ - CONFIG_ATH9K_SUPPORT_PCOEM \ - CONFIG_ATH9K_TX99 \ CONFIG_ATH_USER_REGD \ include $(INCLUDE_DIR)/package.mk @@ -104,6 +103,26 @@ define KernelPackage/mac80211/description Generic IEEE 802.11 Networking Stack (mac80211) endef +define KernelPackage/adm8211 + $(call KernelPackage/mac80211/Default) + TITLE:=ADMTek 8211 support + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko + AUTOLOAD:=$(call AutoProbe,adm8211) +endef + +define KernelPackage/airo + $(call KernelPackage/mac80211/Default) + TITLE:=Cisco Aironet driver + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko + AUTOLOAD:=$(call AutoProbe,airo) +endef + +define KernelPackage/airo/description + Kernel support for Cisco Aironet cards +endef + define KernelPackage/ath/config if PACKAGE_kmod-ath config ATH_USER_REGD @@ -122,7 +141,7 @@ define KernelPackage/ath/config bool "Atheros wireless debugging" help Say Y, if you want to debug atheros wireless drivers. - Only ath9k & ath10k make use of this. + Only ath9k makes use of this. config PACKAGE_ATH_DFS bool "Enable DFS support" @@ -152,7 +171,7 @@ define KernelPackage/ath5k $(call KernelPackage/mac80211/Default) TITLE:=Atheros 5xxx wireless cards support URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath + DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath +@DRIVER_11W_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko AUTOLOAD:=$(call AutoProbe,ath5k) endef @@ -198,6 +217,11 @@ define KernelPackage/ath9k/config bool "Enable TX99 support" depends on PACKAGE_kmod-ath9k + config ATH9K_UBNTHSR + bool "Support for Ubiquiti UniFi Outdoor+ access point" + depends on PACKAGE_kmod-ath9k && TARGET_ar71xx_generic + default y + endef define KernelPackage/ath9k-htc @@ -215,6 +239,15 @@ This module adds support for wireless adapters based on Atheros USB AR9271 and AR7010 family of chipsets. endef +define KernelPackage/carl9170 + $(call KernelPackage/mac80211/Default) + TITLE:=Driver for Atheros AR9170 USB sticks + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +carl9170-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko + AUTOLOAD:=$(call AutoProbe,carl9170) +endef + + define KernelPackage/lib80211 $(call KernelPackage/mac80211/Default) TITLE:=802.11 Networking stack @@ -241,7 +274,6 @@ define KernelPackage/lib80211/description - lib80211_crytp_ccmp endef - define KernelPackage/mac80211-hwsim $(call KernelPackage/mac80211/Default) TITLE:=mac80211 HW simulation device @@ -250,6 +282,31 @@ define KernelPackage/mac80211-hwsim AUTOLOAD:=$(call AutoProbe,mac80211_hwsim) endef +define KernelPackage/rt2800-lib +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT + HIDDEN:=1 + TITLE+= (rt2800 LIB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko +endef + +define KernelPackage/rt2800-mmio +$(call KernelPackage/rt2x00/Default) + TITLE += (RT28xx/RT3xxx MMIO) + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio + HIDDEN:=1 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko +endef + +define KernelPackage/rt2800-soc +$(call KernelPackage/rt2x00/Default) + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib + TITLE += (RT28xx/RT3xxx SoC) + FILES := \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko + AUTOLOAD:=$(call AutoProbe,rt2800soc) +endef config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m) @@ -263,7 +320,19 @@ config-y:= \ MAC80211_RC_MINSTREL_HT \ MAC80211_RC_MINSTREL_VHT \ MAC80211_RC_DEFAULT_MINSTREL \ + WLAN_VENDOR_ADMTEK \ WLAN_VENDOR_ATH \ + WLAN_VENDOR_ATMEL \ + WLAN_VENDOR_INTEL \ + WLAN_VENDOR_INTERSIL \ + WLAN_VENDOR_MARVELL \ + WLAN_VENDOR_MEDIATEK \ + WLAN_VENDOR_RALINK \ + WLAN_VENDOR_REALTEK \ + WLAN_VENDOR_RSI \ + WLAN_VENDOR_ST \ + WLAN_VENDOR_TI \ + WLAN_VENDOR_ZYDAS \ config-$(call config_package,cfg80211) += CFG80211 @@ -281,7 +350,6 @@ endif ifdef CONFIG_PACKAGE_MAC80211_TRACING config-y += \ - ATH10K_TRACING \ ATH6KL_TRACING \ ATH_TRACEPOINTS \ WIL6210_TRACING \ @@ -291,9 +359,11 @@ endif config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP +config-$(call config_package,airo) += AIRO + config-$(call config_package,ath) += ATH_CARDS ATH_COMMON -config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS -config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED +config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH9K_STATION_STATISTICS +config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED config-$(call config_package,ath9k) += ATH9K config-$(call config_package,ath9k-common) += ATH9K_COMMON @@ -302,9 +372,9 @@ 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-$(call config_package,ath9k-htc) += ATH9K_HTC -config-$(call config_package,ath10k) += ATH10K ATH10K_PCI config-$(call config_package,ath5k) += ATH5K ifdef CONFIG_TARGET_ath25 @@ -317,6 +387,10 @@ config-$(call config_package,carl9170) += CARL9170 config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM +config-$(call config_package,rt2800-lib) += RT2800_LIB + +config-$(call config_package,rt2800-soc) += RT2800SOC + config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \ @@ -397,17 +471,26 @@ define Build/InstallDev rm -f $(1)/usr/include/mac80211-backport/linux/module.h endef + define KernelPackage/cfg80211/install $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless + $(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211 + $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/00-wifi-detect endef + $(eval $(call KernelPackage,ath)) $(eval $(call KernelPackage,ath5k)) $(eval $(call KernelPackage,ath9k)) $(eval $(call KernelPackage,ath9k-common)) +$(eval $(call KernelPackage,ath9k-htc)) +$(eval $(call KernelPackage,carl9170)) $(eval $(call KernelPackage,cfg80211)) $(eval $(call KernelPackage,lib80211)) $(eval $(call KernelPackage,mac80211)) $(eval $(call KernelPackage,mac80211-hwsim)) +$(eval $(call KernelPackage,rt2800-lib)) +$(eval $(call KernelPackage,rt2800-mmio)) +$(eval $(call KernelPackage,rt2800-soc)) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index e3d612e4b2..1fa39b8261 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -611,7 +611,42 @@ mac80211_setup_vif() { mcval= [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" - iw dev "$ifname" mesh join "$mesh_id" ${mcval:+mcast-rate $mcval} + case "$htmode" in + VHT20|HT20) mesh_htmode=HT20;; + HT40*|VHT40) + case "$hwmode" in + a) + case "$(( ($channel / 4) % 2 ))" in + 1) mesh_htmode="HT40+" ;; + 0) mesh_htmode="HT40-";; + esac + ;; + *) + case "$htmode" in + HT40+) mesh_htmode="HT40+";; + HT40-) mesh_htmode="HT40-";; + *) + if [ "$channel" -lt 7 ]; then + mesh_htmode="HT40+" + else + mesh_htmode="HT40-" + fi + ;; + esac + ;; + esac + ;; + VHT80) + mesh_htmode="80Mhz" + ;; + VHT160) + mesh_htmode="160Mhz" + ;; + *) mesh_htmode="NOHT" ;; + esac + + freq="$(get_freq "$phy" "$channel")" + iw dev "$ifname" mesh join "$mesh_id" freq $freq $mesh_htmode ${mcval:+mcast-rate $mcval} fi for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch index 22819f7ed2..38b31795a4 100644 --- a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch @@ -1,6 +1,6 @@ --- a/compat/Makefile +++ b/compat/Makefile -@@ -36,8 +36,6 @@ compat-$(CPTCFG_KERNEL_4_7) += backport- +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport- compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o diff --git a/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch index 6a958a4132..34d7d3b1cf 100644 --- a/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau return true; } -@@ -1356,24 +1373,23 @@ static bool ath9k_hw_set_reset(struct at +@@ -1356,24 +1373,24 @@ static bool ath9k_hw_set_reset(struct at rst_flags |= AR_RTC_RC_MAC_COLD; } @@ -115,7 +115,8 @@ Signed-off-by: Felix Fietkau - REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); } -+ ath9k_hw_external_reset(ah, type); ++ if (!AR_SREV_9100(ah)) ++ ath9k_hw_external_reset(ah, type); + + if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) + REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); diff --git a/package/kernel/mac80211/patches/325-ath9k-fix-ath9k_hw_gpio_get-to-return-0-or-1-on-succ.patch b/package/kernel/mac80211/patches/325-ath9k-fix-ath9k_hw_gpio_get-to-return-0-or-1-on-succ.patch index a966a1690f..012a49de9b 100644 --- a/package/kernel/mac80211/patches/325-ath9k-fix-ath9k_hw_gpio_get-to-return-0-or-1-on-succ.patch +++ b/package/kernel/mac80211/patches/325-ath9k-fix-ath9k_hw_gpio_get-to-return-0-or-1-on-succ.patch @@ -18,7 +18,7 @@ Signed-off-by: Matthias Schiffer --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2812,7 +2812,7 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, +@@ -2813,7 +2813,7 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, WARN_ON(1); } diff --git a/package/kernel/mac80211/patches/329-ath9k-unlock-rcu-read-when-returning-early.patch b/package/kernel/mac80211/patches/329-ath9k-unlock-rcu-read-when-returning-early.patch new file mode 100644 index 0000000000..b8ba355899 --- /dev/null +++ b/package/kernel/mac80211/patches/329-ath9k-unlock-rcu-read-when-returning-early.patch @@ -0,0 +1,65 @@ +From: Tobias Klausmann +Date: Mon, 12 Dec 2016 19:50:01 +0100 +Subject: [PATCH] ath9k: unlock rcu read when returning early + +Starting with ath9k: use ieee80211_tx_status_noskb where possible +[d94a461d7a7df68991fb9663531173f60ef89c68] the driver uses rcu_read_lock() && +rcu_read_unlock() yet on returning early in ath_tx_edma_tasklet() the unlock is +missing leading to stalls and suspicious RCU usage: + + =============================== + [ INFO: suspicious RCU usage. ] + 4.9.0-rc8 #11 Not tainted + ------------------------------- + kernel/rcu/tree.c:705 Illegal idle entry in RCU read-side critical section.! + + other info that might help us debug this: + + RCU used illegally from idle CPU! + rcu_scheduler_active = 1, debug_locks = 0 + RCU used illegally from extended quiescent state! + 1 lock held by swapper/7/0: + #0: + ( + rcu_read_lock + ){......} + , at: + [] ath_tx_edma_tasklet+0x0/0x450 [ath9k] + + stack backtrace: + CPU: 7 PID: 0 Comm: swapper/7 Not tainted 4.9.0-rc8 #11 + Hardware name: Acer Aspire V3-571G/VA50_HC_CR, BIOS V2.21 12/16/2013 + ffff88025efc3f38 ffffffff8132b1e5 ffff88017ede4540 0000000000000001 + ffff88025efc3f68 ffffffff810a25f7 ffff88025efcee60 ffff88017edebdd8 + ffff88025eeb5400 0000000000000091 ffff88025efc3f88 ffffffff810c3cd4 + Call Trace: + + [] dump_stack+0x68/0x93 + [] lockdep_rcu_suspicious+0xd7/0x110 + [] rcu_eqs_enter_common.constprop.85+0x154/0x200 + [] rcu_irq_exit+0x44/0xa0 + [] irq_exit+0x61/0xd0 + [] do_IRQ+0x65/0x110 + [] common_interrupt+0x89/0x89 + + [] ? cpuidle_enter_state+0x151/0x200 + [] cpuidle_enter+0x12/0x20 + [] call_cpuidle+0x1e/0x40 + [] cpu_startup_entry+0x146/0x220 + [] start_secondary+0x148/0x170 + +Signed-off-by: Tobias Klausmann +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -2757,7 +2757,7 @@ void ath_tx_edma_tasklet(struct ath_soft + fifo_list = &txq->txq_fifo[txq->txq_tailidx]; + if (list_empty(fifo_list)) { + ath_txq_unlock(sc, txq); +- return; ++ break; + } + + bf = list_first_entry(fifo_list, struct ath_buf, list); diff --git a/package/kernel/mac80211/patches/334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch b/package/kernel/mac80211/patches/334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch new file mode 100644 index 0000000000..5e5992e6b4 --- /dev/null +++ b/package/kernel/mac80211/patches/334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch @@ -0,0 +1,196 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 19:33:23 +0100 +Subject: [PATCH] mac80211: minstrel_ht: move supported bitrate mask out of + group data + +Improves dcache footprint by ensuring that fewer cache lines need to be +touched. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -301,7 +301,7 @@ minstrel_ht_get_stats(struct minstrel_pr + break; + + /* short preamble */ +- if (!(mi->groups[group].supported & BIT(idx))) ++ if (!(mi->supported[group] & BIT(idx))) + idx += 4; + } + return &mi->groups[group].rates[idx]; +@@ -486,7 +486,7 @@ minstrel_ht_prob_rate_reduce_streams(str + MCS_GROUP_RATES].streams; + for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { + mg = &mi->groups[group]; +- if (!mg->supported || group == MINSTREL_CCK_GROUP) ++ if (!mi->supported[group] || group == MINSTREL_CCK_GROUP) + continue; + + tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; +@@ -540,7 +540,7 @@ minstrel_ht_update_stats(struct minstrel + for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { + + mg = &mi->groups[group]; +- if (!mg->supported) ++ if (!mi->supported[group]) + continue; + + mi->sample_count++; +@@ -550,7 +550,7 @@ minstrel_ht_update_stats(struct minstrel + tmp_group_tp_rate[j] = group; + + for (i = 0; i < MCS_GROUP_RATES; i++) { +- if (!(mg->supported & BIT(i))) ++ if (!(mi->supported[group] & BIT(i))) + continue; + + index = MCS_GROUP_RATES * group + i; +@@ -636,7 +636,7 @@ minstrel_set_next_sample_idx(struct mins + mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups); + mg = &mi->groups[mi->sample_group]; + +- if (!mg->supported) ++ if (!mi->supported[mi->sample_group]) + continue; + + if (++mg->index >= MCS_GROUP_RATES) { +@@ -657,7 +657,7 @@ minstrel_downgrade_rate(struct minstrel_ + while (group > 0) { + group--; + +- if (!mi->groups[group].supported) ++ if (!mi->supported[group]) + continue; + + if (minstrel_mcs_groups[group].streams > +@@ -994,7 +994,7 @@ minstrel_get_sample_rate(struct minstrel + sample_idx = sample_table[mg->column][mg->index]; + minstrel_set_next_sample_idx(mi); + +- if (!(mg->supported & BIT(sample_idx))) ++ if (!(mi->supported[sample_group] & BIT(sample_idx))) + return -1; + + mrs = &mg->rates[sample_idx]; +@@ -1052,7 +1052,7 @@ static void + minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp, + struct minstrel_ht_sta *mi, bool val) + { +- u8 supported = mi->groups[MINSTREL_CCK_GROUP].supported; ++ u8 supported = mi->supported[MINSTREL_CCK_GROUP]; + + if (!supported || !mi->cck_supported_short) + return; +@@ -1061,7 +1061,7 @@ minstrel_ht_check_cck_shortpreamble(stru + return; + + supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4); +- mi->groups[MINSTREL_CCK_GROUP].supported = supported; ++ mi->supported[MINSTREL_CCK_GROUP] = supported; + } + + static void +@@ -1154,7 +1154,7 @@ minstrel_ht_update_cck(struct minstrel_p + mi->cck_supported_short |= BIT(i); + } + +- mi->groups[MINSTREL_CCK_GROUP].supported = mi->cck_supported; ++ mi->supported[MINSTREL_CCK_GROUP] = mi->cck_supported; + } + + static void +@@ -1233,7 +1233,7 @@ minstrel_ht_update_caps(void *priv, stru + u32 gflags = minstrel_mcs_groups[i].flags; + int bw, nss; + +- mi->groups[i].supported = 0; ++ mi->supported[i] = 0; + if (i == MINSTREL_CCK_GROUP) { + minstrel_ht_update_cck(mp, mi, sband, sta); + continue; +@@ -1265,8 +1265,8 @@ minstrel_ht_update_caps(void *priv, stru + if (use_vht && minstrel_vht_only) + continue; + #endif +- mi->groups[i].supported = mcs->rx_mask[nss - 1]; +- if (mi->groups[i].supported) ++ mi->supported[i] = mcs->rx_mask[nss - 1]; ++ if (mi->supported[i]) + n_supported++; + continue; + } +@@ -1292,10 +1292,10 @@ minstrel_ht_update_caps(void *priv, stru + else + bw = BW_20; + +- mi->groups[i].supported = minstrel_get_valid_vht_rates(bw, nss, ++ mi->supported[i] = minstrel_get_valid_vht_rates(bw, nss, + vht_cap->vht_mcs.tx_mcs_map); + +- if (mi->groups[i].supported) ++ if (mi->supported[i]) + n_supported++; + } + +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -52,9 +52,6 @@ struct minstrel_mcs_group_data { + u8 index; + u8 column; + +- /* bitfield of supported MCS rates of this group */ +- u16 supported; +- + /* sorted rate set within a MCS group*/ + u16 max_group_tp_rate[MAX_THR_RATES]; + u16 max_group_prob_rate; +@@ -101,6 +98,9 @@ struct minstrel_ht_sta { + u8 cck_supported; + u8 cck_supported_short; + ++ /* Bitfield of supported MCS rates of all groups */ ++ u16 supported[MINSTREL_GROUPS_NB]; ++ + /* MCS rate group info and statistics */ + struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB]; + }; +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -24,7 +24,7 @@ minstrel_ht_stats_dump(struct minstrel_h + char gimode = 'L'; + u32 gflags; + +- if (!mi->groups[i].supported) ++ if (!mi->supported[i]) + return p; + + mg = &minstrel_mcs_groups[i]; +@@ -42,7 +42,7 @@ minstrel_ht_stats_dump(struct minstrel_h + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; + +- if (!(mi->groups[i].supported & BIT(j))) ++ if (!(mi->supported[i] & BIT(j))) + continue; + + if (gflags & IEEE80211_TX_RC_MCS) { +@@ -170,7 +170,7 @@ minstrel_ht_stats_csv_dump(struct minstr + char gimode = 'L'; + u32 gflags; + +- if (!mi->groups[i].supported) ++ if (!mi->supported[i]) + return p; + + mg = &minstrel_mcs_groups[i]; +@@ -188,7 +188,7 @@ minstrel_ht_stats_csv_dump(struct minstr + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; + +- if (!(mi->groups[i].supported & BIT(j))) ++ if (!(mi->supported[i] & BIT(j))) + continue; + + if (gflags & IEEE80211_TX_RC_MCS) { diff --git a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch new file mode 100644 index 0000000000..7a6e8cdb91 --- /dev/null +++ b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch @@ -0,0 +1,70 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:06:08 +0100 +Subject: [PATCH] mac80211: minstrel_ht: move short preamble check out of + get_rate + +Test short preamble support in minstrel_ht_update_caps instead of +looking at the per-packet flag. Makes the code more efficient. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -14,6 +14,7 @@ + #include + #include + #include "rate.h" ++#include "sta_info.h" + #include "rc80211_minstrel.h" + #include "rc80211_minstrel_ht.h" + +@@ -1049,22 +1050,6 @@ minstrel_get_sample_rate(struct minstrel + } + + static void +-minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp, +- struct minstrel_ht_sta *mi, bool val) +-{ +- u8 supported = mi->supported[MINSTREL_CCK_GROUP]; +- +- if (!supported || !mi->cck_supported_short) +- return; +- +- if (supported & (mi->cck_supported_short << (val * 4))) +- return; +- +- supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4); +- mi->supported[MINSTREL_CCK_GROUP] = supported; +-} +- +-static void + minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, + struct ieee80211_tx_rate_control *txrc) + { +@@ -1087,7 +1072,6 @@ minstrel_ht_get_rate(void *priv, struct + minstrel_aggr_check(sta, txrc->skb); + + info->flags |= mi->tx_flags; +- minstrel_ht_check_cck_shortpreamble(mp, mi, txrc->short_preamble); + + #ifdef CPTCFG_MAC80211_DEBUGFS + if (mp->fixed_rate_idx != -1) +@@ -1168,6 +1152,7 @@ minstrel_ht_update_caps(void *priv, stru + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; + u16 ht_cap = sta->ht_cap.cap; + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; ++ struct sta_info *sinfo = container_of(sta, struct sta_info, sta); + int use_vht; + int n_supported = 0; + int ack_dur; +@@ -1302,6 +1287,9 @@ minstrel_ht_update_caps(void *priv, stru + if (!n_supported) + goto use_legacy; + ++ if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE)) ++ mi->cck_supported_short |= mi->cck_supported_short << 4; ++ + /* create an initial rate table with the lowest supported rates */ + minstrel_ht_update_stats(mp, mi); + minstrel_ht_update_rates(mp, mi); diff --git a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-make-att_hist-and-succ_hist-u32.patch b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-make-att_hist-and-succ_hist-u32.patch new file mode 100644 index 0000000000..40d03001c6 --- /dev/null +++ b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-make-att_hist-and-succ_hist-u32.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:09:14 +0100 +Subject: [PATCH] mac80211: minstrel_ht: make att_hist and succ_hist u32 + instead of u64 + +They are only used for debugging purposes and take a very long time to +overflow. Visibly reduces the size of the per-sta rate control data. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -59,7 +59,7 @@ struct minstrel_rate_stats { + u16 success, last_success; + + /* total attempts/success counters */ +- u64 att_hist, succ_hist; ++ u32 att_hist, succ_hist; + + /* statistis of packet delivery probability + * cur_prob - current prob within last update intervall diff --git a/package/kernel/mac80211/patches/337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch b/package/kernel/mac80211/patches/337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch new file mode 100644 index 0000000000..066e1d1445 --- /dev/null +++ b/package/kernel/mac80211/patches/337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch @@ -0,0 +1,34 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:12:25 +0100 +Subject: [PATCH] mac80211: check for MCS in ieee80211_duration before fetching + chanctx + +Makes the code a bit more efficient + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -63,6 +63,10 @@ static __le16 ieee80211_duration(struct + struct ieee80211_chanctx_conf *chanctx_conf; + u32 rate_flags = 0; + ++ /* assume HW handles this */ ++ if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS)) ++ return 0; ++ + rcu_read_lock(); + chanctx_conf = rcu_dereference(tx->sdata->vif.chanctx_conf); + if (chanctx_conf) { +@@ -71,10 +75,6 @@ static __le16 ieee80211_duration(struct + } + rcu_read_unlock(); + +- /* assume HW handles this */ +- if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS)) +- return 0; +- + /* uh huh? */ + if (WARN_ON_ONCE(tx->rate.idx < 0)) + return 0; diff --git a/package/kernel/mac80211/patches/338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch b/package/kernel/mac80211/patches/338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch new file mode 100644 index 0000000000..f25b0a8a8c --- /dev/null +++ b/package/kernel/mac80211/patches/338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch @@ -0,0 +1,192 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:13:58 +0100 +Subject: [PATCH] mac80211: minstrel: remove cur_prob from debugfs + +This field is redundant, because it is simply last success divided by +last attempt count. Removing it from the rate stats struct saves about +1.2 KiB per HT station. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -159,21 +159,23 @@ minstrel_update_rates(struct minstrel_pr + void + minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs) + { ++ unsigned int cur_prob; ++ + if (unlikely(mrs->attempts > 0)) { + mrs->sample_skipped = 0; +- mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); ++ cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); + if (unlikely(!mrs->att_hist)) { +- mrs->prob_ewma = mrs->cur_prob; ++ mrs->prob_ewma = cur_prob; + } else { + /* update exponential weighted moving variance */ + mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd, +- mrs->cur_prob, ++ cur_prob, + mrs->prob_ewma, + EWMA_LEVEL); + + /*update exponential weighted moving avarage */ + mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, +- mrs->cur_prob, ++ cur_prob, + EWMA_LEVEL); + } + mrs->att_hist += mrs->attempts; +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -62,10 +62,8 @@ struct minstrel_rate_stats { + u32 att_hist, succ_hist; + + /* statistis of packet delivery probability +- * cur_prob - current prob within last update intervall + * prob_ewma - exponential weighted moving average of prob + * prob_ewmsd - exp. weighted moving standard deviation of prob */ +- unsigned int cur_prob; + unsigned int prob_ewma; + u16 prob_ewmsd; + +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -75,7 +75,7 @@ minstrel_stats_open(struct inode *inode, + { + struct minstrel_sta_info *mi = inode->i_private; + struct minstrel_debugfs_info *ms; +- unsigned int i, tp_max, tp_avg, prob, eprob; ++ unsigned int i, tp_max, tp_avg, eprob; + char *p; + + ms = kmalloc(2048, GFP_KERNEL); +@@ -86,9 +86,9 @@ minstrel_stats_open(struct inode *inode, + p = ms->buf; + p += sprintf(p, "\n"); + p += sprintf(p, +- "best __________rate_________ ________statistics________ ________last_______ ______sum-of________\n"); ++ "best __________rate_________ ________statistics________ ____last_____ ______sum-of________\n"); + p += sprintf(p, +- "rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n"); ++ "rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n"); + + for (i = 0; i < mi->n_rates; i++) { + struct minstrel_rate *mr = &mi->r[i]; +@@ -107,17 +107,15 @@ minstrel_stats_open(struct inode *inode, + + tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); + tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); +- prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); + + p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" +- " %3u.%1u %3u %3u %-3u " ++ " %3u %3u %-3u " + "%9llu %-9llu\n", + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, + mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, +- prob / 10, prob % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, +@@ -148,7 +146,7 @@ minstrel_stats_csv_open(struct inode *in + { + struct minstrel_sta_info *mi = inode->i_private; + struct minstrel_debugfs_info *ms; +- unsigned int i, tp_max, tp_avg, prob, eprob; ++ unsigned int i, tp_max, tp_avg, eprob; + char *p; + + ms = kmalloc(2048, GFP_KERNEL); +@@ -175,16 +173,14 @@ minstrel_stats_csv_open(struct inode *in + + tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); + tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); +- prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); + +- p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," ++ p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," + "%llu,%llu,%d,%d\n", + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, + mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, +- prob / 10, prob % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -19,7 +19,7 @@ static char * + minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) + { + const struct mcs_group *mg; +- unsigned int j, tp_max, tp_avg, prob, eprob, tx_time; ++ unsigned int j, tp_max, tp_avg, eprob, tx_time; + char htmode = '2'; + char gimode = 'L'; + u32 gflags; +@@ -83,17 +83,15 @@ minstrel_ht_stats_dump(struct minstrel_h + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); +- prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); + + p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" +- " %3u.%1u %3u %3u %-3u " ++ " %3u %3u %-3u " + "%9llu %-9llu\n", + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, + mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, +- prob / 10, prob % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, +@@ -130,9 +128,9 @@ minstrel_ht_stats_open(struct inode *ino + + p += sprintf(p, "\n"); + p += sprintf(p, +- " best ____________rate__________ ________statistics________ ________last_______ ______sum-of________\n"); ++ " best ____________rate__________ ________statistics________ _____last____ ______sum-of________\n"); + p += sprintf(p, +- "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n"); ++ "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n"); + + p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p); + for (i = 0; i < MINSTREL_CCK_GROUP; i++) +@@ -165,7 +163,7 @@ static char * + minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p) + { + const struct mcs_group *mg; +- unsigned int j, tp_max, tp_avg, prob, eprob, tx_time; ++ unsigned int j, tp_max, tp_avg, eprob, tx_time; + char htmode = '2'; + char gimode = 'L'; + u32 gflags; +@@ -226,16 +224,14 @@ minstrel_ht_stats_csv_dump(struct minstr + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); +- prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); + +- p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," ++ p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," + "%u,%llu,%llu,", + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, + mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, +- prob / 10, prob % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, diff --git a/package/kernel/mac80211/patches/339-mac80211-minstrel-reduce-MINSTREL_SCALE.patch b/package/kernel/mac80211/patches/339-mac80211-minstrel-reduce-MINSTREL_SCALE.patch new file mode 100644 index 0000000000..0416cf5900 --- /dev/null +++ b/package/kernel/mac80211/patches/339-mac80211-minstrel-reduce-MINSTREL_SCALE.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:15:33 +0100 +Subject: [PATCH] mac80211: minstrel: reduce MINSTREL_SCALE + +The loss of a bit of extra precision does not hurt the calculation, 12 +bits is still enough to calculate probabilities well. Reducing the scale +makes it easier to avoid overflows + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -14,7 +14,7 @@ + #define SAMPLE_COLUMNS 10 /* number of columns in sample table */ + + /* scaled fraction values */ +-#define MINSTREL_SCALE 16 ++#define MINSTREL_SCALE 12 + #define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) + #define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) + diff --git a/package/kernel/mac80211/patches/340-mac80211-minstrel-store-probability-variance-instead.patch b/package/kernel/mac80211/patches/340-mac80211-minstrel-store-probability-variance-instead.patch new file mode 100644 index 0000000000..f679a43224 --- /dev/null +++ b/package/kernel/mac80211/patches/340-mac80211-minstrel-store-probability-variance-instead.patch @@ -0,0 +1,186 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:17:06 +0100 +Subject: [PATCH] mac80211: minstrel: store probability variance instead of + standard deviation + +This avoids the costly int_sqrt calls in the statistics update and moves +it to the debugfs code instead. +This also fixes an overflow in the previous standard deviation +calculation. + +Signed-off-by: Thomas Huehn +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -168,10 +168,10 @@ minstrel_calc_rate_stats(struct minstrel + mrs->prob_ewma = cur_prob; + } else { + /* update exponential weighted moving variance */ +- mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd, +- cur_prob, +- mrs->prob_ewma, +- EWMA_LEVEL); ++ mrs->prob_ewmv = minstrel_ewmv(mrs->prob_ewmv, ++ cur_prob, ++ mrs->prob_ewma, ++ EWMA_LEVEL); + + /*update exponential weighted moving avarage */ + mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -36,21 +36,16 @@ minstrel_ewma(int old, int new, int weig + } + + /* +- * Perform EWMSD (Exponentially Weighted Moving Standard Deviation) calculation ++ * Perform EWMV (Exponentially Weighted Moving Variance) calculation + */ + static inline int +-minstrel_ewmsd(int old_ewmsd, int cur_prob, int prob_ewma, int weight) ++minstrel_ewmv(int old_ewmv, int cur_prob, int prob_ewma, int weight) + { +- int diff, incr, tmp_var; ++ int diff, incr; + +- /* calculate exponential weighted moving variance */ +- diff = MINSTREL_TRUNC((cur_prob - prob_ewma) * 1000000); ++ diff = cur_prob - prob_ewma; + incr = (EWMA_DIV - weight) * diff / EWMA_DIV; +- tmp_var = old_ewmsd * old_ewmsd; +- tmp_var = weight * (tmp_var + diff * incr / 1000000) / EWMA_DIV; +- +- /* return standard deviation */ +- return (u16) int_sqrt(tmp_var); ++ return weight * (old_ewmv + MINSTREL_TRUNC(diff * incr)) / EWMA_DIV; + } + + struct minstrel_rate_stats { +@@ -65,7 +60,7 @@ struct minstrel_rate_stats { + * prob_ewma - exponential weighted moving average of prob + * prob_ewmsd - exp. weighted moving standard deviation of prob */ + unsigned int prob_ewma; +- u16 prob_ewmsd; ++ u16 prob_ewmv; + + /* maximum retry counts */ + u8 retry_count; +@@ -151,6 +146,14 @@ struct minstrel_debugfs_info { + char buf[]; + }; + ++/* Get EWMSD (Exponentially Weighted Moving Standard Deviation) * 10 */ ++static inline int ++minstrel_get_ewmsd10(struct minstrel_rate_stats *mrs) ++{ ++ unsigned int ewmv = mrs->prob_ewmv; ++ return int_sqrt(MINSTREL_TRUNC(ewmv * 1000 * 1000)); ++} ++ + extern const struct rate_control_ops mac80211_minstrel; + void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); + void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -93,6 +93,7 @@ minstrel_stats_open(struct inode *inode, + for (i = 0; i < mi->n_rates; i++) { + struct minstrel_rate *mr = &mi->r[i]; + struct minstrel_rate_stats *mrs = &mi->r[i].stats; ++ unsigned int prob_ewmsd; + + *(p++) = (i == mi->max_tp_rate[0]) ? 'A' : ' '; + *(p++) = (i == mi->max_tp_rate[1]) ? 'B' : ' '; +@@ -108,6 +109,7 @@ minstrel_stats_open(struct inode *inode, + tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); + tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" + " %3u %3u %-3u " +@@ -115,7 +117,7 @@ minstrel_stats_open(struct inode *inode, + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, +- mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, ++ prob_ewmsd / 10, prob_ewmsd % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, +@@ -159,6 +161,7 @@ minstrel_stats_csv_open(struct inode *in + for (i = 0; i < mi->n_rates; i++) { + struct minstrel_rate *mr = &mi->r[i]; + struct minstrel_rate_stats *mrs = &mi->r[i].stats; ++ unsigned int prob_ewmsd; + + p += sprintf(p, "%s" ,((i == mi->max_tp_rate[0]) ? "A" : "")); + p += sprintf(p, "%s" ,((i == mi->max_tp_rate[1]) ? "B" : "")); +@@ -174,13 +177,14 @@ minstrel_stats_csv_open(struct inode *in + tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); + tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," + "%llu,%llu,%d,%d\n", + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, +- mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, ++ prob_ewmsd / 10, prob_ewmsd % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -41,6 +41,7 @@ minstrel_ht_stats_dump(struct minstrel_h + struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; ++ unsigned int prob_ewmsd; + + if (!(mi->supported[i] & BIT(j))) + continue; +@@ -84,6 +85,7 @@ minstrel_ht_stats_dump(struct minstrel_h + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" + " %3u %3u %-3u " +@@ -91,7 +93,7 @@ minstrel_ht_stats_dump(struct minstrel_h + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, +- mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, ++ prob_ewmsd / 10, prob_ewmsd % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, +@@ -185,6 +187,7 @@ minstrel_ht_stats_csv_dump(struct minstr + struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; ++ unsigned int prob_ewmsd; + + if (!(mi->supported[i] & BIT(j))) + continue; +@@ -225,13 +228,14 @@ minstrel_ht_stats_csv_dump(struct minstr + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); + eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," + "%u,%llu,%llu,", + tp_max / 10, tp_max % 10, + tp_avg / 10, tp_avg % 10, + eprob / 10, eprob % 10, +- mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, ++ prob_ewmsd / 10, prob_ewmsd % 10, + mrs->retry_count, + mrs->last_success, + mrs->last_attempts, diff --git a/package/kernel/mac80211/patches/341-mac80211-minstrel-make-prob_ewma-u16-instead-of-u32.patch b/package/kernel/mac80211/patches/341-mac80211-minstrel-make-prob_ewma-u16-instead-of-u32.patch new file mode 100644 index 0000000000..570cd19ee4 --- /dev/null +++ b/package/kernel/mac80211/patches/341-mac80211-minstrel-make-prob_ewma-u16-instead-of-u32.patch @@ -0,0 +1,20 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:19:56 +0100 +Subject: [PATCH] mac80211: minstrel: make prob_ewma u16 instead of u32 + +Saves about 1.2 KiB memory per station + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -59,7 +59,7 @@ struct minstrel_rate_stats { + /* statistis of packet delivery probability + * prob_ewma - exponential weighted moving average of prob + * prob_ewmsd - exp. weighted moving standard deviation of prob */ +- unsigned int prob_ewma; ++ u16 prob_ewma; + u16 prob_ewmv; + + /* maximum retry counts */ diff --git a/package/kernel/mac80211/patches/342-mac80211-minstrel_ht-remove-obsolete-if-for-3-stream.patch b/package/kernel/mac80211/patches/342-mac80211-minstrel_ht-remove-obsolete-if-for-3-stream.patch new file mode 100644 index 0000000000..39d3c99e74 --- /dev/null +++ b/package/kernel/mac80211/patches/342-mac80211-minstrel_ht-remove-obsolete-if-for-3-stream.patch @@ -0,0 +1,80 @@ +From: Felix Fietkau +Date: Wed, 14 Dec 2016 20:23:29 +0100 +Subject: [PATCH] mac80211: minstrel_ht: remove obsolete #if for >= 3 streams + +This was added during early development when 3x3 hardware was not very +common yet. This is completely unnecessary now. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -155,67 +155,47 @@ MODULE_PARM_DESC(minstrel_vht_only, + const struct mcs_group minstrel_mcs_groups[] = { + MCS_GROUP(1, 0, BW_20), + MCS_GROUP(2, 0, BW_20), +-#if MINSTREL_MAX_STREAMS >= 3 + MCS_GROUP(3, 0, BW_20), +-#endif + + MCS_GROUP(1, 1, BW_20), + MCS_GROUP(2, 1, BW_20), +-#if MINSTREL_MAX_STREAMS >= 3 + MCS_GROUP(3, 1, BW_20), +-#endif + + MCS_GROUP(1, 0, BW_40), + MCS_GROUP(2, 0, BW_40), +-#if MINSTREL_MAX_STREAMS >= 3 + MCS_GROUP(3, 0, BW_40), +-#endif + + MCS_GROUP(1, 1, BW_40), + MCS_GROUP(2, 1, BW_40), +-#if MINSTREL_MAX_STREAMS >= 3 + MCS_GROUP(3, 1, BW_40), +-#endif + + CCK_GROUP, + + #ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + VHT_GROUP(1, 0, BW_20), + VHT_GROUP(2, 0, BW_20), +-#if MINSTREL_MAX_STREAMS >= 3 + VHT_GROUP(3, 0, BW_20), +-#endif + + VHT_GROUP(1, 1, BW_20), + VHT_GROUP(2, 1, BW_20), +-#if MINSTREL_MAX_STREAMS >= 3 + VHT_GROUP(3, 1, BW_20), +-#endif + + VHT_GROUP(1, 0, BW_40), + VHT_GROUP(2, 0, BW_40), +-#if MINSTREL_MAX_STREAMS >= 3 + VHT_GROUP(3, 0, BW_40), +-#endif + + VHT_GROUP(1, 1, BW_40), + VHT_GROUP(2, 1, BW_40), +-#if MINSTREL_MAX_STREAMS >= 3 + VHT_GROUP(3, 1, BW_40), +-#endif + + VHT_GROUP(1, 0, BW_80), + VHT_GROUP(2, 0, BW_80), +-#if MINSTREL_MAX_STREAMS >= 3 + VHT_GROUP(3, 0, BW_80), +-#endif + + VHT_GROUP(1, 1, BW_80), + VHT_GROUP(2, 1, BW_80), +-#if MINSTREL_MAX_STREAMS >= 3 + VHT_GROUP(3, 1, BW_80), + #endif +-#endif + }; + + static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; diff --git a/package/kernel/mac80211/patches/343-cfg80211-limit-scan-results-cache-size.patch b/package/kernel/mac80211/patches/343-cfg80211-limit-scan-results-cache-size.patch new file mode 100644 index 0000000000..f26548a3df --- /dev/null +++ b/package/kernel/mac80211/patches/343-cfg80211-limit-scan-results-cache-size.patch @@ -0,0 +1,150 @@ +From: Johannes Berg +Date: Tue, 15 Nov 2016 12:05:11 +0100 +Subject: [PATCH] cfg80211: limit scan results cache size + +It's possible to make scanning consume almost arbitrary amounts +of memory, e.g. by sending beacon frames with random BSSIDs at +high rates while somebody is scanning. + +Limit the number of BSS table entries we're willing to cache to +1000, limiting maximum memory usage to maybe 4-5MB, but lower +in practice - that would be the case for having both full-sized +beacon and probe response frames for each entry; this seems not +possible in practice, so a limit of 1000 entries will likely be +closer to 0.5 MB. + +Cc: stable@vger.kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -71,6 +71,7 @@ struct cfg80211_registered_device { + struct list_head bss_list; + struct rb_root bss_tree; + u32 bss_generation; ++ u32 bss_entries; + struct cfg80211_scan_request *scan_req; /* protected by RTNL */ + struct sk_buff *scan_msg; + struct cfg80211_sched_scan_request __rcu *sched_scan_req; +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -57,6 +57,19 @@ + * also linked into the probe response struct. + */ + ++/* ++ * Limit the number of BSS entries stored in mac80211. Each one is ++ * a bit over 4k at most, so this limits to roughly 4-5M of memory. ++ * If somebody wants to really attack this though, they'd likely ++ * use small beacons, and only one type of frame, limiting each of ++ * the entries to a much smaller size (in order to generate more ++ * entries in total, so overhead is bigger.) ++ */ ++static int bss_entries_limit = 1000; ++module_param(bss_entries_limit, int, 0644); ++MODULE_PARM_DESC(bss_entries_limit, ++ "limit to number of scan BSS entries (per wiphy, default 1000)"); ++ + #define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ) + + static void bss_free(struct cfg80211_internal_bss *bss) +@@ -137,6 +150,10 @@ static bool __cfg80211_unlink_bss(struct + + list_del_init(&bss->list); + rb_erase(&bss->rbn, &rdev->bss_tree); ++ rdev->bss_entries--; ++ WARN_ONCE((rdev->bss_entries == 0) ^ list_empty(&rdev->bss_list), ++ "rdev bss entries[%d]/list[empty:%d] corruption\n", ++ rdev->bss_entries, list_empty(&rdev->bss_list)); + bss_ref_put(rdev, bss); + return true; + } +@@ -163,6 +180,40 @@ static void __cfg80211_bss_expire(struct + rdev->bss_generation++; + } + ++static bool cfg80211_bss_expire_oldest(struct cfg80211_registered_device *rdev) ++{ ++ struct cfg80211_internal_bss *bss, *oldest = NULL; ++ bool ret; ++ ++ lockdep_assert_held(&rdev->bss_lock); ++ ++ list_for_each_entry(bss, &rdev->bss_list, list) { ++ if (atomic_read(&bss->hold)) ++ continue; ++ ++ if (!list_empty(&bss->hidden_list) && ++ !bss->pub.hidden_beacon_bss) ++ continue; ++ ++ if (oldest && time_before(oldest->ts, bss->ts)) ++ continue; ++ oldest = bss; ++ } ++ ++ if (WARN_ON(!oldest)) ++ return false; ++ ++ /* ++ * The callers make sure to increase rdev->bss_generation if anything ++ * gets removed (and a new entry added), so there's no need to also do ++ * it here. ++ */ ++ ++ ret = __cfg80211_unlink_bss(rdev, oldest); ++ WARN_ON(!ret); ++ return ret; ++} ++ + void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, + bool send_message) + { +@@ -689,6 +740,7 @@ static bool cfg80211_combine_bsses(struc + const u8 *ie; + int i, ssidlen; + u8 fold = 0; ++ u32 n_entries = 0; + + ies = rcu_access_pointer(new->pub.beacon_ies); + if (WARN_ON(!ies)) +@@ -712,6 +764,12 @@ static bool cfg80211_combine_bsses(struc + /* This is the bad part ... */ + + list_for_each_entry(bss, &rdev->bss_list, list) { ++ /* ++ * we're iterating all the entries anyway, so take the ++ * opportunity to validate the list length accounting ++ */ ++ n_entries++; ++ + if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) + continue; + if (bss->pub.channel != new->pub.channel) +@@ -740,6 +798,10 @@ static bool cfg80211_combine_bsses(struc + new->pub.beacon_ies); + } + ++ WARN_ONCE(n_entries != rdev->bss_entries, ++ "rdev bss entries[%d]/list[len:%d] corruption\n", ++ rdev->bss_entries, n_entries); ++ + return true; + } + +@@ -894,7 +956,14 @@ cfg80211_bss_update(struct cfg80211_regi + } + } + ++ if (rdev->bss_entries >= bss_entries_limit && ++ !cfg80211_bss_expire_oldest(rdev)) { ++ kfree(new); ++ goto drop; ++ } ++ + list_add_tail(&new->list, &rdev->bss_list); ++ rdev->bss_entries++; + rb_insert_bss(rdev, new); + found = new; + } diff --git a/package/kernel/mac80211/patches/346-ath5k-drop-bogus-warning-on-drv_set_key-with-unsuppo.patch b/package/kernel/mac80211/patches/346-ath5k-drop-bogus-warning-on-drv_set_key-with-unsuppo.patch new file mode 100644 index 0000000000..243907cb26 --- /dev/null +++ b/package/kernel/mac80211/patches/346-ath5k-drop-bogus-warning-on-drv_set_key-with-unsuppo.patch @@ -0,0 +1,23 @@ +From: Felix Fietkau +Date: Tue, 27 Dec 2016 12:15:14 +0100 +Subject: [PATCH] ath5k: drop bogus warning on drv_set_key with unsupported + cipher + +Simply return -EOPNOTSUPP instead. + +Cc: stable@vger.kernel.org +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c ++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c +@@ -502,8 +502,7 @@ ath5k_set_key(struct ieee80211_hw *hw, e + break; + return -EOPNOTSUPP; + default: +- WARN_ON(1); +- return -EINVAL; ++ return -EOPNOTSUPP; + } + + mutex_lock(&ah->lock); diff --git a/package/kernel/mac80211/patches/347-0001-cfg80211-move-function-checking-range-fit-to-util.c.patch b/package/kernel/mac80211/patches/347-0001-cfg80211-move-function-checking-range-fit-to-util.c.patch new file mode 100644 index 0000000000..4a50d37b2e --- /dev/null +++ b/package/kernel/mac80211/patches/347-0001-cfg80211-move-function-checking-range-fit-to-util.c.patch @@ -0,0 +1,101 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 4 Jan 2017 18:58:30 +0100 +Subject: [PATCH] cfg80211: move function checking range fit to util.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It is needed for another cfg80211 helper that will be out of reg.c so +move it to common util.c file and make it non-static. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Johannes Berg +--- + +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -429,6 +429,9 @@ int cfg80211_change_iface(struct cfg8021 + void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev); + void cfg80211_process_wdev_events(struct wireless_dev *wdev); + ++bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range, ++ u32 center_freq_khz, u32 bw_khz); ++ + /** + * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable + * @wiphy: the wiphy to validate against +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -748,21 +748,6 @@ static bool is_valid_rd(const struct iee + return true; + } + +-static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range, +- u32 center_freq_khz, u32 bw_khz) +-{ +- u32 start_freq_khz, end_freq_khz; +- +- start_freq_khz = center_freq_khz - (bw_khz/2); +- end_freq_khz = center_freq_khz + (bw_khz/2); +- +- if (start_freq_khz >= freq_range->start_freq_khz && +- end_freq_khz <= freq_range->end_freq_khz) +- return true; +- +- return false; +-} +- + /** + * freq_in_rule_band - tells us if a frequency is in a frequency band + * @freq_range: frequency rule we want to query +@@ -1070,7 +1055,7 @@ freq_reg_info_regd(u32 center_freq, + if (!band_rule_found) + band_rule_found = freq_in_rule_band(fr, center_freq); + +- bw_fits = reg_does_bw_fit(fr, center_freq, bw); ++ bw_fits = cfg80211_does_bw_fit_range(fr, center_freq, bw); + + if (band_rule_found && bw_fits) + return rr; +@@ -1138,11 +1123,13 @@ static uint32_t reg_rule_to_chan_bw_flag + max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); + + /* If we get a reg_rule we can assume that at least 5Mhz fit */ +- if (!reg_does_bw_fit(freq_range, MHZ_TO_KHZ(chan->center_freq), +- MHZ_TO_KHZ(10))) ++ if (!cfg80211_does_bw_fit_range(freq_range, ++ MHZ_TO_KHZ(chan->center_freq), ++ MHZ_TO_KHZ(10))) + bw_flags |= IEEE80211_CHAN_NO_10MHZ; +- if (!reg_does_bw_fit(freq_range, MHZ_TO_KHZ(chan->center_freq), +- MHZ_TO_KHZ(20))) ++ if (!cfg80211_does_bw_fit_range(freq_range, ++ MHZ_TO_KHZ(chan->center_freq), ++ MHZ_TO_KHZ(20))) + bw_flags |= IEEE80211_CHAN_NO_20MHZ; + + if (max_bandwidth_khz < MHZ_TO_KHZ(10)) +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -1788,6 +1788,21 @@ void cfg80211_free_nan_func(struct cfg80 + } + EXPORT_SYMBOL(cfg80211_free_nan_func); + ++bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range, ++ u32 center_freq_khz, u32 bw_khz) ++{ ++ u32 start_freq_khz, end_freq_khz; ++ ++ start_freq_khz = center_freq_khz - (bw_khz / 2); ++ end_freq_khz = center_freq_khz + (bw_khz / 2); ++ ++ if (start_freq_khz >= freq_range->start_freq_khz && ++ end_freq_khz <= freq_range->end_freq_khz) ++ return true; ++ ++ return false; ++} ++ + /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ + /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ + const unsigned char rfc1042_header[] __aligned(2) = diff --git a/package/kernel/mac80211/patches/347-0002-cfg80211-support-ieee80211-freq-limit-DT-property.patch b/package/kernel/mac80211/patches/347-0002-cfg80211-support-ieee80211-freq-limit-DT-property.patch new file mode 100644 index 0000000000..3e1aae72db --- /dev/null +++ b/package/kernel/mac80211/patches/347-0002-cfg80211-support-ieee80211-freq-limit-DT-property.patch @@ -0,0 +1,211 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 4 Jan 2017 18:58:31 +0100 +Subject: [PATCH] cfg80211: support ieee80211-freq-limit DT property +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds a helper for reading that new property and applying +limitations of supported channels specified this way. +It is used with devices that normally support a wide wireless band but +in a given config are limited to some part of it (usually due to board +design). For example a dual-band chipset may be able to support one band +only because of used antennas. +It's also common that tri-band routers have separated radios for lower +and higher part of 5 GHz band and it may be impossible to say which is +which without a DT info. + +Signed-off-by: Rafał Miłecki +[add new function to documentation, fix link] +Signed-off-by: Johannes Berg +--- + create mode 100644 net/wireless/of.c + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -311,6 +311,34 @@ struct ieee80211_supported_band { + struct ieee80211_sta_vht_cap vht_cap; + }; + ++/** ++ * wiphy_read_of_freq_limits - read frequency limits from device tree ++ * ++ * @wiphy: the wireless device to get extra limits for ++ * ++ * Some devices may have extra limitations specified in DT. This may be useful ++ * for chipsets that normally support more bands but are limited due to board ++ * design (e.g. by antennas or external power amplifier). ++ * ++ * This function reads info from DT and uses it to *modify* channels (disable ++ * unavailable ones). It's usually a *bad* idea to use it in drivers with ++ * shared channel data as DT limitations are device specific. You should make ++ * sure to call it only if channels in wiphy are copied and can be modified ++ * without affecting other devices. ++ * ++ * As this function access device node it has to be called after set_wiphy_dev. ++ * It also modifies channels so they have to be set first. ++ * If using this helper, call it before wiphy_register(). ++ */ ++#ifdef CONFIG_OF ++void wiphy_read_of_freq_limits(struct wiphy *wiphy); ++#else /* CONFIG_OF */ ++static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) ++{ ++} ++#endif /* !CONFIG_OF */ ++ ++ + /* + * Wireless hardware/device configuration structures and methods + */ +--- a/net/wireless/Makefile ++++ b/net/wireless/Makefile +@@ -11,6 +11,7 @@ obj-$(CONFIG_WEXT_PRIV) += wext-priv.o + + cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o + cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o ++cfg80211-$(CONFIG_OF) += of.o + cfg80211-$(CPTCFG_CFG80211_DEBUGFS) += debugfs.o + cfg80211-$(CPTCFG_CFG80211_WEXT) += wext-compat.o wext-sme.o + cfg80211-$(CPTCFG_CFG80211_INTERNAL_REGDB) += regdb.o +--- /dev/null ++++ b/net/wireless/of.c +@@ -0,0 +1,138 @@ ++/* ++ * Copyright (C) 2017 Rafał Miłecki ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++#include ++#include "core.h" ++ ++static bool wiphy_freq_limits_valid_chan(struct wiphy *wiphy, ++ struct ieee80211_freq_range *freq_limits, ++ unsigned int n_freq_limits, ++ struct ieee80211_channel *chan) ++{ ++ u32 bw = MHZ_TO_KHZ(20); ++ int i; ++ ++ for (i = 0; i < n_freq_limits; i++) { ++ struct ieee80211_freq_range *limit = &freq_limits[i]; ++ ++ if (cfg80211_does_bw_fit_range(limit, ++ MHZ_TO_KHZ(chan->center_freq), ++ bw)) ++ return true; ++ } ++ ++ return false; ++} ++ ++static void wiphy_freq_limits_apply(struct wiphy *wiphy, ++ struct ieee80211_freq_range *freq_limits, ++ unsigned int n_freq_limits) ++{ ++ enum nl80211_band band; ++ int i; ++ ++ if (WARN_ON(!n_freq_limits)) ++ return; ++ ++ for (band = 0; band < NUM_NL80211_BANDS; band++) { ++ struct ieee80211_supported_band *sband = wiphy->bands[band]; ++ ++ if (!sband) ++ continue; ++ ++ for (i = 0; i < sband->n_channels; i++) { ++ struct ieee80211_channel *chan = &sband->channels[i]; ++ ++ if (chan->flags & IEEE80211_CHAN_DISABLED) ++ continue; ++ ++ if (!wiphy_freq_limits_valid_chan(wiphy, freq_limits, ++ n_freq_limits, ++ chan)) { ++ pr_debug("Disabling freq %d MHz as it's out of OF limits\n", ++ chan->center_freq); ++ chan->flags |= IEEE80211_CHAN_DISABLED; ++ } ++ } ++ } ++} ++ ++void wiphy_read_of_freq_limits(struct wiphy *wiphy) ++{ ++ struct device *dev = wiphy_dev(wiphy); ++ struct device_node *np; ++ struct property *prop; ++ struct ieee80211_freq_range *freq_limits; ++ unsigned int n_freq_limits; ++ const __be32 *p; ++ int len, i; ++ int err = 0; ++ ++ if (!dev) ++ return; ++ np = dev_of_node(dev); ++ if (!np) ++ return; ++ ++ prop = of_find_property(np, "ieee80211-freq-limit", &len); ++ if (!prop) ++ return; ++ ++ if (!len || len % sizeof(u32) || len / sizeof(u32) % 2) { ++ dev_err(dev, "ieee80211-freq-limit wrong format"); ++ return; ++ } ++ n_freq_limits = len / sizeof(u32) / 2; ++ ++ freq_limits = kcalloc(n_freq_limits, sizeof(*freq_limits), GFP_KERNEL); ++ if (!freq_limits) { ++ err = -ENOMEM; ++ goto out_kfree; ++ } ++ ++ p = NULL; ++ for (i = 0; i < n_freq_limits; i++) { ++ struct ieee80211_freq_range *limit = &freq_limits[i]; ++ ++ p = of_prop_next_u32(prop, p, &limit->start_freq_khz); ++ if (!p) { ++ err = -EINVAL; ++ goto out_kfree; ++ } ++ ++ p = of_prop_next_u32(prop, p, &limit->end_freq_khz); ++ if (!p) { ++ err = -EINVAL; ++ goto out_kfree; ++ } ++ ++ if (!limit->start_freq_khz || ++ !limit->end_freq_khz || ++ limit->start_freq_khz >= limit->end_freq_khz) { ++ err = -EINVAL; ++ goto out_kfree; ++ } ++ } ++ ++ wiphy_freq_limits_apply(wiphy, freq_limits, n_freq_limits); ++ ++out_kfree: ++ kfree(freq_limits); ++ if (err) ++ dev_err(dev, "Failed to get limits: %d\n", err); ++} ++EXPORT_SYMBOL(wiphy_read_of_freq_limits); diff --git a/package/kernel/mac80211/patches/347-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch b/package/kernel/mac80211/patches/347-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch new file mode 100644 index 0000000000..529e1098b3 --- /dev/null +++ b/package/kernel/mac80211/patches/347-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch @@ -0,0 +1,26 @@ +From: Felix Fietkau +Date: Tue, 27 Dec 2016 23:16:23 +0100 +Subject: [PATCH] ath9k: don't run periodic and nf calibation at the same time + +The checks already prevents periodic cal from being started while noise +floor calibration runs. It is missing checks for the other way around. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c +@@ -676,10 +676,10 @@ static int ar9002_hw_calibrate(struct at + return 0; + + ah->cal_list_curr = currCal = currCal->calNext; +- if (currCal->calState == CAL_WAITING) { ++ if (currCal->calState == CAL_WAITING) + ath9k_hw_reset_calibration(ah, currCal); +- return 0; +- } ++ ++ return 0; + } + + /* Do NF cal only at longer intervals */ diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch index 72e9a41223..a5e1f067c5 100644 --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch @@ -14,7 +14,7 @@ ccflags-y += -D__CHECK_ENDIAN__ --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common, +@@ -318,14 +318,7 @@ void _ath_dbg(struct ath_common *common, #endif /* CPTCFG_ATH_DEBUG */ /** Returns string describing opmode, or NULL if unknown mode. */ @@ -27,4 +27,5 @@ -} -#endif - #endif /* ATH_H */ + extern const char *ath_bus_type_strings[]; + static inline const char *ath_bus_type_to_string(enum ath_bus_type bustype) diff --git a/package/kernel/mac80211/patches/401-ath9k_blink_default.patch b/package/kernel/mac80211/patches/401-ath9k_blink_default.patch index 4a997f1e0c..7405e594fe 100644 --- a/package/kernel/mac80211/patches/401-ath9k_blink_default.patch +++ b/package/kernel/mac80211/patches/401-ath9k_blink_default.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -45,7 +45,7 @@ int ath9k_modparam_nohwcrypt; +@@ -47,7 +47,7 @@ int ath9k_modparam_nohwcrypt; module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); diff --git a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch index f3f5e1d779..0fc30bb868 100644 --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -731,6 +731,7 @@ static const struct ieee80211_iface_limi +@@ -773,6 +773,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_AP) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) }, diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch index c42bba6b0d..4f52c12389 100644 --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1034,23 +1034,23 @@ static int __init ath9k_init(void) +@@ -1076,23 +1076,23 @@ static int __init ath9k_init(void) { int error; diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch index 46f1dea15b..3fbe316690 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -946,7 +946,7 @@ int ath9k_init_device(u16 devid, struct +@@ -988,7 +988,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ diff --git a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch deleted file mode 100644 index c2d2781559..0000000000 --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/mac.c -+++ b/drivers/net/wireless/ath/ath9k/mac.c -@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw - { - #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ - struct ath_common *common = ath9k_hw_common(ah); -- u32 mac_status, last_mac_status = 0; -+ u32 mac_status = 0, last_mac_status = 0; - int i; - - /* Enable access to the DMA observation bus */ -@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw - } - - if (i == 0) { -+ if (!AR_SREV_9300_20_OR_LATER(ah) && -+ (mac_status & 0x700) == 0) { -+ /* -+ * DMA is idle but the MAC is still stuck -+ * processing events -+ */ -+ *reset = true; -+ return true; -+ } -+ - ath_err(common, - "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n", - AH_RX_STOP_DMA_TIMEOUT / 1000, diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch index a820e16c88..08acc0e0c9 100644 --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1837,6 +1837,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1838,6 +1838,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2045,6 +2059,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2046,6 +2060,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch index a5977b7413..237c3217a1 100644 --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch @@ -55,7 +55,7 @@ ops->spectral_scan_config = ar9003_hw_spectral_scan_config; --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -719,7 +719,8 @@ static void ath9k_init_txpower_limits(st +@@ -761,7 +761,8 @@ static void ath9k_init_txpower_limits(st if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -906,6 +907,18 @@ static void ath9k_set_hw_capab(struct at +@@ -948,6 +949,18 @@ static void ath9k_set_hw_capab(struct at SET_IEEE80211_PERM_ADDR(hw, common->macaddr); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -951,6 +964,8 @@ int ath9k_init_device(u16 devid, struct +@@ -993,6 +1006,8 @@ int ath9k_init_device(u16 devid, struct ARRAY_SIZE(ath9k_tpt_blink)); #endif diff --git a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch index bb4c121af8..200a3a28f6 100644 --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch @@ -20,7 +20,7 @@ /******************/ /* Chip Revisions */ /******************/ -@@ -1413,6 +1426,9 @@ static bool ath9k_hw_set_reset(struct at +@@ -1414,6 +1427,9 @@ static bool ath9k_hw_set_reset(struct at udelay(50); } @@ -30,7 +30,7 @@ return true; } -@@ -1512,6 +1528,9 @@ static bool ath9k_hw_chip_reset(struct a +@@ -1513,6 +1529,9 @@ static bool ath9k_hw_chip_reset(struct a ar9003_hw_internal_regulator_apply(ah); ath9k_hw_init_pll(ah, chan); @@ -40,7 +40,7 @@ return true; } -@@ -1815,8 +1834,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1816,8 +1835,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2070,6 +2095,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2071,6 +2096,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch b/package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch index 04714f8169..292ea8a558 100644 --- a/package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch +++ b/package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch @@ -349,16 +349,6 @@ Signed-off-by: Martin Blumenstingl - - integer = swab32(eep->modalHeader.antCtrlCommon); - eep->modalHeader.antCtrlCommon = integer; -- -- for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) { -- integer = swab32(eep->modalHeader.antCtrlChain[i]); -- eep->modalHeader.antCtrlChain[i] = integer; -- } -- -- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { -- word = swab16(eep->modalHeader.spurChans[i].spurChan); -- eep->modalHeader.spurChans[i].spurChan = word; -- } + EEPROM_FIELD_SWAB16(eep->baseEepHeader.length); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.version); @@ -368,10 +358,18 @@ Signed-off-by: Martin Blumenstingl + EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap); + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon); -+ + +- for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) { +- integer = swab32(eep->modalHeader.antCtrlChain[i]); +- eep->modalHeader.antCtrlChain[i] = integer; +- } + for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]); -+ + +- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { +- word = swab16(eep->modalHeader.spurChans[i].spurChan); +- eep->modalHeader.spurChans[i].spurChan = word; +- } + for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) + EEPROM_FIELD_SWAB16( + eep->modalHeader.spurChans[i].spurChan); @@ -542,16 +540,6 @@ Signed-off-by: Martin Blumenstingl - - integer = swab32(eep->modalHeader.antCtrlCommon); - eep->modalHeader.antCtrlCommon = integer; -- -- for (i = 0; i < AR9287_MAX_CHAINS; i++) { -- integer = swab32(eep->modalHeader.antCtrlChain[i]); -- eep->modalHeader.antCtrlChain[i] = integer; -- } -- -- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { -- word = swab16(eep->modalHeader.spurChans[i].spurChan); -- eep->modalHeader.spurChans[i].spurChan = word; -- } + EEPROM_FIELD_SWAB16(eep->baseEepHeader.length); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.version); @@ -561,10 +549,18 @@ Signed-off-by: Martin Blumenstingl + EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap); + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon); -+ + +- for (i = 0; i < AR9287_MAX_CHAINS; i++) { +- integer = swab32(eep->modalHeader.antCtrlChain[i]); +- eep->modalHeader.antCtrlChain[i] = integer; +- } + for (i = 0; i < AR9287_MAX_CHAINS; i++) + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]); -+ + +- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { +- word = swab16(eep->modalHeader.spurChans[i].spurChan); +- eep->modalHeader.spurChans[i].spurChan = word; +- } + for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) + EEPROM_FIELD_SWAB16( + eep->modalHeader.spurChans[i].spurChan); @@ -716,8 +712,7 @@ Signed-off-by: Martin Blumenstingl if (need_swap) { - u32 integer, j; - u16 word; -+ u32 j; - +- - word = swab16(eep->baseEepHeader.length); - eep->baseEepHeader.length = word; - @@ -738,7 +733,8 @@ Signed-off-by: Martin Blumenstingl - - word = swab16(eep->baseEepHeader.blueToothOptions); - eep->baseEepHeader.blueToothOptions = word; -- ++ u32 j; + - word = swab16(eep->baseEepHeader.deviceCap); - eep->baseEepHeader.deviceCap = word; + EEPROM_FIELD_SWAB16(eep->baseEepHeader.length); diff --git a/package/kernel/mmc_over_gpio/Makefile b/package/kernel/mmc_over_gpio/Makefile deleted file mode 100644 index ada293da10..0000000000 --- a/package/kernel/mmc_over_gpio/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# Copyright (C) 2008 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)/kernel.mk - -PKG_NAME:=mmc-over-gpio -PKG_RELEASE:=4 - -include $(INCLUDE_DIR)/package.mk - - -define KernelPackage/mmc-over-gpio - SUBMENU:=Other modules - DEPENDS:=@GPIO_SUPPORT +kmod-mmc-spi +kmod-spi-gpio-old +kmod-fs-configfs @!LINUX_4_4 - KCONFIG:=CONFIG_GPIOMMC - TITLE:=MMC/SD card over GPIO support - FILES:=$(LINUX_DIR)/drivers/mmc/host/gpiommc.ko - AUTOLOAD:=$(call AutoProbe,gpiommc) - MENU:=1 -endef - -define Package/kmod-mmc-over-gpio/config - menu "Configuration" - depends on PACKAGE_kmod-mmc-over-gpio - - config KMOD_MMC_OVER_GPIO_DI_PIN - int "GPIO DI (Data-In) pin" - default 1 - - config KMOD_MMC_OVER_GPIO_DO_PIN - int "GPIO DO (Data-Out) pin" - default 3 - - config KMOD_MMC_OVER_GPIO_CLK_PIN - int "GPIO CLK (Clock) pin" - default 4 - - config KMOD_MMC_OVER_GPIO_CS_PIN - int "GPIO CS (Chip-Select) pin" - default 7 - - endmenu -endef - -define KernelPackage/mmc-over-gpio/description - Support for driving an MMC/SD card over GPIO pins via SPI. -endef - -define KernelPackage/mmc-over-gpio/conffiles -/etc/config/mmc_over_gpio -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) -endef - -define Build/Compile -endef - -define KernelPackage/mmc-over-gpio/install - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/mmc_over_gpio.config $(1)/etc/config/mmc_over_gpio - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/mmc_over_gpio.init $(1)/etc/init.d/mmc_over_gpio - - $(SED) 's,@GPIO_DI_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_DI_PIN),g' \ - -e 's,@GPIO_DO_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_DO_PIN),g' \ - -e 's,@GPIO_CLK_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_CLK_PIN),g' \ - -e 's,@GPIO_CS_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_CS_PIN),g' \ - $(1)/etc/config/mmc_over_gpio -endef - -$(eval $(call KernelPackage,mmc-over-gpio)) diff --git a/package/kernel/mmc_over_gpio/files/mmc_over_gpio.config b/package/kernel/mmc_over_gpio/files/mmc_over_gpio.config deleted file mode 100644 index 23f0084857..0000000000 --- a/package/kernel/mmc_over_gpio/files/mmc_over_gpio.config +++ /dev/null @@ -1,8 +0,0 @@ -config 'mmc_over_gpio' - option 'name' 'default' - option 'enabled' '0' - option 'DI_pin' '@GPIO_DI_PIN@' - option 'DO_pin' '@GPIO_DO_PIN@' - option 'CLK_pin' '@GPIO_CLK_PIN@' - option 'CS_pin' '@GPIO_CS_PIN@' - option 'mode' '0' diff --git a/package/kernel/mmc_over_gpio/files/mmc_over_gpio.init b/package/kernel/mmc_over_gpio/files/mmc_over_gpio.init deleted file mode 100644 index 121c80398c..0000000000 --- a/package/kernel/mmc_over_gpio/files/mmc_over_gpio.init +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008 OpenWrt.org -START=90 - -CONFIGFS_DIR="/config/gpiommc" - -# add_device(name, DI_pin, DO_pin, CLK_pin, CS_pin, mode) -add_device() { - local dir="$CONFIGFS_DIR/$1" - - mkdir -p $dir - [ $? -eq 0 ] || return 1 - echo $2 > $dir/gpio_data_in - [ $? -eq 0 ] || return 1 - echo $3 > $dir/gpio_data_out - [ $? -eq 0 ] || return 1 - echo $4 > $dir/gpio_clock - [ $? -eq 0 ] || return 1 - echo $5 > $dir/gpio_chipselect - [ $? -eq 0 ] || return 1 - echo $6 > $dir/spi_mode - [ $? -eq 0 ] || return 1 - # XXX We have more config options available. Use defaults for now. - - echo 1 > $dir/register - [ $? -eq 0 ] || return 1 - - return 0 -} - -# remove_device(name) -remove_device() { - local dir="$CONFIGFS_DIR/$1" - - rmdir $dir -} - -mount_configfs() { - # FIXME: This should probably be done somewhere else. - mount | grep configfs - if [ $? -eq 0 ]; then - # already mounted - return 0 - fi - mkdir -p /config - [ $? -eq 0 ] || return 1 - mount configfs -t configfs /config - [ $? -eq 0 ] || return 1 - - return 0 -} - -start_service() { - local section="$1" - config_get "name" "$section" "name" - config_get "DI_pin" "$section" "DI_pin" - config_get "DO_pin" "$section" "DO_pin" - config_get "CLK_pin" "$section" "CLK_pin" - config_get "CS_pin" "$section" "CS_pin" - config_get "mode" "$section" "mode" - config_get_bool "enabled" "$section" "enabled" '1' - [ "$enabled" -gt 0 ] && add_device "$name" $DI_pin $DO_pin $CLK_pin $CS_pin $mode & -} - -stop_service() { - local section="$1" - config_get "name" "$section" "name" - remove_device "$name" -} - -start() { - # Make sure configfs is mounted - mount_configfs - [ $? -eq 0 ] || return 1 - - config_load "mmc_over_gpio" - config_foreach start_service "mmc_over_gpio" -} - -stop() { - config_load "mmc_over_gpio" - config_foreach stop_service "mmc_over_gpio" -} diff --git a/package/kernel/rtc-rv5c386a/Makefile b/package/kernel/rtc-rv5c386a/Makefile new file mode 100644 index 0000000000..e970982070 --- /dev/null +++ b/package/kernel/rtc-rv5c386a/Makefile @@ -0,0 +1,33 @@ +# +# Copyright (C) 2006-2009 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)/kernel.mk + +PKG_NAME:=rtc-rv5c386a +PKG_RELEASE:=1 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/rtc-rv5c386a + SUBMENU:=Other modules + DEPENDS:=@TARGET_brcm47xx @!IN_SDK + TITLE:=Driver for RTC RV5C386A (used in WL-700gE and WL-HDD) + AUTOLOAD:=$(call AutoLoad,70,rtc) + FILES:=$(PKG_BUILD_DIR)/rtc.ko +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(BUILDFLAGS)" \ + modules +endef + +$(eval $(call KernelPackage,rtc-rv5c386a)) diff --git a/package/kernel/rtc-rv5c386a/src/Makefile b/package/kernel/rtc-rv5c386a/src/Makefile new file mode 100644 index 0000000000..eeb0430774 --- /dev/null +++ b/package/kernel/rtc-rv5c386a/src/Makefile @@ -0,0 +1,18 @@ +# $Id$ +# +# Makefile for Real Time Clock driver for WL-HDD +# +# Copyright (C) 2007 Andreas Engel +# +# 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. +# + +obj-m := rtc.o + +ifeq ($(MAKING_MODULES),1) + +-include $(TOPDIR)/Rules.make +endif diff --git a/package/kernel/rtc-rv5c386a/src/rtc.c b/package/kernel/rtc-rv5c386a/src/rtc.c new file mode 100644 index 0000000000..96dc56eb36 --- /dev/null +++ b/package/kernel/rtc-rv5c386a/src/rtc.c @@ -0,0 +1,613 @@ +/* + * Real Time Clock driver for WL-HDD + * + * Copyright (C) 2007 Andreas Engel + * + * Hacked together mostly by copying the relevant code parts from: + * drivers/i2c/i2c-bcm5365.c + * drivers/i2c/i2c-algo-bit.c + * drivers/char/rtc.c + * + * Note 1: + * This module uses the standard char device (10,135), while the Asus module + * rtcdrv.o uses (12,0). So, both can coexist which might be handy during + * development (but see the comment in rtc_open()). + * + * Note 2: + * You might need to set the clock once after loading the driver the first + * time because the driver switches the chip into 24h mode if it is running + * in 12h mode. + * + * Usage: + * For compatibility reasons with the original asus driver, the time can be + * read and set via the /dev/rtc device entry. The only accepted data format + * is "YYYY:MM:DD:W:HH:MM:SS\n". See OpenWrt wiki for a script which handles + * this format. + * + * In addition, this driver supports the standard ioctl() calls for setting + * and reading the hardware clock, so the ordinary hwclock utility can also + * be used. + * + * 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. + * + * TODO: + * - add a /proc/driver/rtc interface? + * - make the battery failure bit available through the /proc interface? + * + * $Id: rtc.c 7 2007-05-25 19:37:01Z ae $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) +#include +#endif + +#include +#include + +#define RTC_IS_OPEN 0x01 /* Means /dev/rtc is in use. */ + +/* Can be changed via a module parameter. */ +static int rtc_debug = 0; + +static unsigned long rtc_status = 0; /* Bitmapped status byte. */ + +/* These settings are platform dependents. */ +unsigned int sda_index = 0; +unsigned int scl_index = 0; + +#define I2C_READ_MASK 1 +#define I2C_WRITE_MASK 0 + +#define I2C_ACK 1 +#define I2C_NAK 0 + +#define RTC_EPOCH 1900 +#define RTC_I2C_ADDRESS (0x32 << 1) +#define RTC_24HOUR_MODE_MASK 0x20 +#define RTC_PM_MASK 0x20 +#define RTC_VDET_MASK 0x40 +#define RTC_Y2K_MASK 0x80 + +/* + * Delay in microseconds for generating the pulses on the I2C bus. We use + * a rather conservative setting here. See datasheet of the RTC chip. + */ +#define ADAP_DELAY 50 + +/* Avoid spurious compiler warnings. */ +#define UNUSED __attribute__((unused)) + +MODULE_AUTHOR("Andreas Engel"); +MODULE_LICENSE("GPL"); + +/* Test stolen from switch-adm.c. */ +module_param(rtc_debug, int, 0); + +static inline void sdalo(void) +{ + gpio_direction_output(sda_index, 1); + udelay(ADAP_DELAY); +} + +static inline void sdahi(void) +{ + gpio_direction_input(sda_index); + udelay(ADAP_DELAY); +} + +static inline void scllo(void) +{ + gpio_direction_output(scl_index, 1); + udelay(ADAP_DELAY); +} + +static inline int getscl(void) +{ + return (gpio_get_value(scl_index)); +} + +static inline int getsda(void) +{ + return (gpio_get_value(sda_index)); +} + +/* + * We shouldn't simply set the SCL pin to high. Like SDA, the SCL line is + * bidirectional too. According to the I2C spec, the slave is allowed to + * pull down the SCL line to slow down the clock, so we need to check this. + * Generally, we'd need a timeout here, but in our case, we just check the + * line, assuming the RTC chip behaves well. + */ +static int sclhi(void) +{ + gpio_direction_input(scl_index); + udelay(ADAP_DELAY); + if (!getscl()) { + printk(KERN_ERR "SCL pin should be low\n"); + return -ETIMEDOUT; + } + return 0; +} + +static void i2c_start(void) +{ + sdalo(); + scllo(); +} + +static void i2c_stop(void) +{ + sdalo(); + sclhi(); + sdahi(); +} + +static int i2c_outb(int c) +{ + int i; + int ack; + + /* assert: scl is low */ + for (i = 7; i >= 0; i--) { + if (c & ( 1 << i )) { + sdahi(); + } else { + sdalo(); + } + if (sclhi() < 0) { /* timed out */ + sdahi(); /* we don't want to block the net */ + return -ETIMEDOUT; + }; + scllo(); + } + sdahi(); + if (sclhi() < 0) { + return -ETIMEDOUT; + }; + /* read ack: SDA should be pulled down by slave */ + ack = getsda() == 0; /* ack: sda is pulled low ->success. */ + scllo(); + + if (rtc_debug) + printk(KERN_DEBUG "i2c_outb(0x%02x) -> %s\n", + c, ack ? "ACK": "NAK"); + + return ack; /* return 1 if device acked */ + /* assert: scl is low (sda undef) */ +} + +static int i2c_inb(int ack) +{ + int i; + unsigned int indata = 0; + + /* assert: scl is low */ + + sdahi(); + for (i = 0; i < 8; i++) { + if (sclhi() < 0) { + return -ETIMEDOUT; + }; + indata *= 2; + if (getsda()) + indata |= 0x01; + scllo(); + } + if (ack) { + sdalo(); + } else { + sdahi(); + } + + if (sclhi() < 0) { + sdahi(); + return -ETIMEDOUT; + } + scllo(); + sdahi(); + + if (rtc_debug) + printk(KERN_DEBUG "i2c_inb() -> 0x%02x\n", indata); + + /* assert: scl is low */ + return indata & 0xff; +} + +static void i2c_init(void) +{ + /* no gpio_control for EXTIF */ + // ssb_gpio_control(&ssb, sda_mask | scl_mask, 0); + + gpio_set_value(sda_index, 0); + gpio_set_value(scl_index, 0); + sdahi(); + sclhi(); +} + +static int rtc_open(UNUSED struct inode *inode, UNUSED struct file *filp) +{ + spin_lock_irq(&rtc_lock); + + if (rtc_status & RTC_IS_OPEN) { + spin_unlock_irq(&rtc_lock); + return -EBUSY; + } + + rtc_status |= RTC_IS_OPEN; + + /* + * The following call is only necessary if we use both this driver and + * the proprietary one from asus at the same time (which, b.t.w. only + * makes sense during development). Otherwise, each access via the asus + * driver will make access via this driver impossible. + */ + i2c_init(); + + spin_unlock_irq(&rtc_lock); + + return 0; +} + +static int rtc_release(UNUSED struct inode *inode, UNUSED struct file *filp) +{ + /* No need for locking here. */ + rtc_status &= ~RTC_IS_OPEN; + return 0; +} + +static int from_bcd(int bcdnum) +{ + int fac, num = 0; + + for (fac = 1; bcdnum; fac *= 10) { + num += (bcdnum % 16) * fac; + bcdnum /= 16; + } + + return num; +} + +static int to_bcd(int decnum) +{ + int fac, num = 0; + + for (fac = 1; decnum; fac *= 16) { + num += (decnum % 10) * fac; + decnum /= 10; + } + + return num; +} + +static void get_rtc_time(struct rtc_time *rtc_tm) +{ + int cr2; + + /* + * Read date and time from the RTC. We use read method (3). + */ + + spin_lock_irq(&rtc_lock); + i2c_start(); + i2c_outb(RTC_I2C_ADDRESS | I2C_READ_MASK); + cr2 = i2c_inb(I2C_ACK); + rtc_tm->tm_sec = i2c_inb(I2C_ACK); + rtc_tm->tm_min = i2c_inb(I2C_ACK); + rtc_tm->tm_hour = i2c_inb(I2C_ACK); + rtc_tm->tm_wday = i2c_inb(I2C_ACK); + rtc_tm->tm_mday = i2c_inb(I2C_ACK); + rtc_tm->tm_mon = i2c_inb(I2C_ACK); + rtc_tm->tm_year = i2c_inb(I2C_NAK); + i2c_stop(); + spin_unlock_irq(&rtc_lock); + + if (cr2 & RTC_VDET_MASK) { + printk(KERN_WARNING "***RTC BATTERY FAILURE***\n"); + } + + /* Handle century bit */ + if (rtc_tm->tm_mon & RTC_Y2K_MASK) { + rtc_tm->tm_mon &= ~RTC_Y2K_MASK; + rtc_tm->tm_year += 0x100; + } + + rtc_tm->tm_sec = from_bcd(rtc_tm->tm_sec); + rtc_tm->tm_min = from_bcd(rtc_tm->tm_min); + rtc_tm->tm_hour = from_bcd(rtc_tm->tm_hour); + rtc_tm->tm_mday = from_bcd(rtc_tm->tm_mday); + rtc_tm->tm_mon = from_bcd(rtc_tm->tm_mon) - 1; + rtc_tm->tm_year = from_bcd(rtc_tm->tm_year); + + rtc_tm->tm_isdst = -1; /* DST not known */ +} + +static void set_rtc_time(struct rtc_time *rtc_tm) +{ + rtc_tm->tm_sec = to_bcd(rtc_tm->tm_sec); + rtc_tm->tm_min = to_bcd(rtc_tm->tm_min); + rtc_tm->tm_hour = to_bcd(rtc_tm->tm_hour); + rtc_tm->tm_mday = to_bcd(rtc_tm->tm_mday); + rtc_tm->tm_mon = to_bcd(rtc_tm->tm_mon + 1); + rtc_tm->tm_year = to_bcd(rtc_tm->tm_year); + + if (rtc_tm->tm_year >= 0x100) { + rtc_tm->tm_year -= 0x100; + rtc_tm->tm_mon |= RTC_Y2K_MASK; + } + + spin_lock_irq(&rtc_lock); + i2c_start(); + i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK); + i2c_outb(0x00); /* set starting register to 0 (=seconds) */ + i2c_outb(rtc_tm->tm_sec); + i2c_outb(rtc_tm->tm_min); + i2c_outb(rtc_tm->tm_hour); + i2c_outb(rtc_tm->tm_wday); + i2c_outb(rtc_tm->tm_mday); + i2c_outb(rtc_tm->tm_mon); + i2c_outb(rtc_tm->tm_year); + i2c_stop(); + spin_unlock_irq(&rtc_lock); +} + +static ssize_t rtc_write(UNUSED struct file *filp, const char *buf, + size_t count, loff_t *ppos) +{ + struct rtc_time rtc_tm; + char buffer[23]; + char *p; + + if (!capable(CAP_SYS_TIME)) + return -EACCES; + + if (ppos != &filp->f_pos) + return -ESPIPE; + + /* + * For simplicity, the only acceptable format is: + * YYYY:MM:DD:W:HH:MM:SS\n + */ + + if (count != 22) + goto err_out; + + if (copy_from_user(buffer, buf, count)) + return -EFAULT; + + buffer[sizeof(buffer)-1] = '\0'; + + p = &buffer[0]; + + rtc_tm.tm_year = simple_strtoul(p, &p, 10); + if (*p++ != ':') goto err_out; + + rtc_tm.tm_mon = simple_strtoul(p, &p, 10) - 1; + if (*p++ != ':') goto err_out; + + rtc_tm.tm_mday = simple_strtoul(p, &p, 10); + if (*p++ != ':') goto err_out; + + rtc_tm.tm_wday = simple_strtoul(p, &p, 10); + if (*p++ != ':') goto err_out; + + rtc_tm.tm_hour = simple_strtoul(p, &p, 10); + if (*p++ != ':') goto err_out; + + rtc_tm.tm_min = simple_strtoul(p, &p, 10); + if (*p++ != ':') goto err_out; + + rtc_tm.tm_sec = simple_strtoul(p, &p, 10); + if (*p != '\n') goto err_out; + + rtc_tm.tm_year -= RTC_EPOCH; + + set_rtc_time(&rtc_tm); + + *ppos += count; + + return count; + + err_out: + printk(KERN_ERR "invalid format: use YYYY:MM:DD:W:HH:MM:SS\\n\n"); + return -EINVAL; +} + + +static ssize_t rtc_read(UNUSED struct file *filp, char *buf, size_t count, + loff_t *ppos) +{ + char wbuf[23]; + struct rtc_time tm; + ssize_t len; + + if (count == 0 || *ppos != 0) + return 0; + + get_rtc_time(&tm); + + len = sprintf(wbuf, "%04d:%02d:%02d:%d:%02d:%02d:%02d\n", + tm.tm_year + RTC_EPOCH, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_wday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec); + + if (len > (ssize_t)count) + len = count; + + if (copy_to_user(buf, wbuf, len)) + return -EFAULT; + + *ppos += len; + + return len; +} + +static int rtc_do_ioctl(unsigned int cmd, unsigned long arg) +{ + struct rtc_time rtc_tm; + + switch (cmd) { + case RTC_RD_TIME: + memset(&rtc_tm, 0, sizeof(struct rtc_time)); + get_rtc_time(&rtc_tm); + if (copy_to_user((void *)arg, &rtc_tm, sizeof(rtc_tm))) + return -EFAULT; + break; + + case RTC_SET_TIME: + if (!capable(CAP_SYS_TIME)) + return -EACCES; + + if (copy_from_user(&rtc_tm, (struct rtc_time *)arg, + sizeof(struct rtc_time))) + return -EFAULT; + + set_rtc_time(&rtc_tm); + break; + + default: + return -ENOTTY; + } + + return 0; +} + +static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + long ret; + ret = rtc_do_ioctl(cmd, arg); + return ret; +} + +static const struct file_operations rtc_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .read = rtc_read, + .write = rtc_write, + .unlocked_ioctl = rtc_ioctl, + .open = rtc_open, + .release = rtc_release, +}; + +static struct miscdevice rtc_dev = { + .minor = RTC_MINOR, + .name = "rtc", + .fops = &rtc_fops, +}; + +/* Savagely ripped from diag.c. */ +static inline int startswith (char *source, char *cmp) +{ + return !strncmp(source, cmp, strlen(cmp)); +} + +static void platform_detect(void) +{ + char buf[20]; + int et0phyaddr, et1phyaddr; + + /* Based on "model_no". */ + if (bcm47xx_nvram_getenv("model_no", buf, sizeof(buf)) >= 0) { + if (startswith(buf, "WL700")) { /* WL700* */ + sda_index = 2; + scl_index = 5; + return; + } + } + + if (bcm47xx_nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 ) + et0phyaddr = simple_strtoul(buf, NULL, 0); + if (bcm47xx_nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 ) + et1phyaddr = simple_strtoul(buf, NULL, 0); + + if (bcm47xx_nvram_getenv("hardware_version", buf, sizeof(buf)) >= 0) { + /* Either WL-300g or WL-HDD, do more extensive checks */ + if (startswith(buf, "WL300-") && et0phyaddr == 0 && et1phyaddr == 1) { + sda_index = 4; + scl_index = 5; + return; + } + } + /* not found */ +} + +static int __init rtc_init(void) +{ + int cr1; + + platform_detect(); + + if (sda_index == scl_index) { + printk(KERN_ERR "RTC-RV5C386A: unrecognized platform!\n"); + return -ENODEV; + } + + i2c_init(); + + /* + * Switch RTC to 24h mode + */ + spin_lock_irq(&rtc_lock); + i2c_start(); + i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK); + i2c_outb(0xE4); /* start at address 0xE, transmission mode 4 */ + cr1 = i2c_inb(I2C_NAK); + i2c_stop(); + spin_unlock_irq(&rtc_lock); + if ((cr1 & RTC_24HOUR_MODE_MASK) == 0) { + /* RTC is running in 12h mode */ + printk(KERN_INFO "rtc.o: switching to 24h mode\n"); + spin_lock_irq(&rtc_lock); + i2c_start(); + i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK); + i2c_outb(0xE0); + i2c_outb(cr1 | RTC_24HOUR_MODE_MASK); + i2c_stop(); + spin_unlock_irq(&rtc_lock); + } + + misc_register(&rtc_dev); + + printk(KERN_INFO "RV5C386A Real Time Clock Driver loaded\n"); + + return 0; +} + +static void __exit rtc_exit (void) +{ + misc_deregister(&rtc_dev); + printk(KERN_INFO "Successfully removed RTC RV5C386A driver\n"); +} + +module_init(rtc_init); +module_exit(rtc_exit); + +/* + * Local Variables: + * indent-tabs-mode:t + * c-basic-offset:8 + * End: + */ diff --git a/package/libs/argp-standalone/Makefile b/package/libs/argp-standalone/Makefile index 8cf23fec5e..8fad739d85 100644 --- a/package/libs/argp-standalone/Makefile +++ b/package/libs/argp-standalone/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.lysator.liu.se/~nisse/misc/ -PKG_MD5SUM:=720704bac078d067111b32444e24ba69 +PKG_HASH:=dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be PKG_MAINTAINER:=Ted Hess PKG_LICENSE:=LGPL-2.1 diff --git a/package/libs/cyassl/Makefile b/package/libs/cyassl/Makefile index 3cd8e4cfdf..68646d9b00 100644 --- a/package/libs/cyassl/Makefile +++ b/package/libs/cyassl/Makefile @@ -8,15 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=3.9.10 +PKG_VERSION:=3.10.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip PKG_SOURCE_URL:=https://www.wolfssl.com/ -PKG_MD5SUM:=793921c0db96248be4a369cbfdf0cb7b37ee2be715b8b775b6cd32efe66f494e +PKG_HASH:=66f7f2a8b8ee37d6b4beab3cb0dcb6a6980fd4674373bfd3bf1214b9d0d2c02e PKG_FIXUP:=libtool PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0+ @@ -42,8 +43,8 @@ endef TARGET_CFLAGS += $(FPIC) +# --enable-stunnel needed for OpenSSL API compatibility bits CONFIGURE_ARGS += \ - --enable-singlethreaded \ --enable-opensslextra \ --enable-sni \ --enable-stunnel \ diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index 46ad1b3d91..0645d4e1cb 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.167 +PKG_VERSION:=0.168 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=http://fedorahosted.org/releases/e/l/$(PKG_NAME)/$(PKG_VERSION) -PKG_MD5SUM:=efc6c2067dfad5646777e93e85222e8f +PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) +PKG_HASH:=b88d07893ba1373c7dd69a7855974706d05377766568a7d9002706d5de72c276 PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-3.0+ PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3 @@ -68,6 +68,8 @@ endif CONFIGURE_ARGS += \ --without-lzma +TARGET_CFLAGS += -D_GNU_SOURCE + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ diff --git a/package/libs/elfutils/patches/004-memcpy_def.patch b/package/libs/elfutils/patches/004-memcpy_def.patch deleted file mode 100644 index 3731592b14..0000000000 --- a/package/libs/elfutils/patches/004-memcpy_def.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/libelf/libelf.h -+++ b/libelf/libelf.h -@@ -108,6 +108,11 @@ typedef struct - size_t d_align; /* Alignment in section. */ - } Elf_Data; - -+#ifndef _LIBC -+#ifndef __mempcpy -+#define __mempcpy mempcpy -+#endif -+#endif - - /* Commands for `...'. */ - typedef enum diff --git a/package/libs/elfutils/patches/006-libdw_LIBS.patch b/package/libs/elfutils/patches/006-libdw_LIBS.patch index 80c20ad5f0..59967e1488 100644 --- a/package/libs/elfutils/patches/006-libdw_LIBS.patch +++ b/package/libs/elfutils/patches/006-libdw_LIBS.patch @@ -1,6 +1,6 @@ --- a/libdw/Makefile.in +++ b/libdw/Makefile.in -@@ -1002,7 +1002,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l +@@ -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\ diff --git a/package/libs/elfutils/patches/007-fix_TEMP_FAILURE_RETRY.patch b/package/libs/elfutils/patches/007-fix_TEMP_FAILURE_RETRY.patch new file mode 100644 index 0000000000..2a4c5c0e3e --- /dev/null +++ b/package/libs/elfutils/patches/007-fix_TEMP_FAILURE_RETRY.patch @@ -0,0 +1,92 @@ +From b853c091231a56cc36135323d2668775a3d3c435 Mon Sep 17 00:00:00 2001 +From: Luiz Angelo Daros de Luca +Date: Thu, 29 Dec 2016 20:51:41 -0200 +Subject: [PATCH] Fix TEMP_FAILURE_RETRY definition when not defined + +https://sourceware.org/bugzilla/show_bug.cgi?id=21001 + +Signed-off-by: Luiz Angelo Daros de Luca +--- + ChangeLog | 4 ++++ + lib/crc32_file.c | 1 + + lib/system.h | 2 +- + libdwfl/dwfl_build_id_find_elf.c | 1 + + libdwfl/dwfl_module_getdwarf.c | 1 + + libdwfl/libdwfl_crc32_file.c | 1 - + 6 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/ChangeLog b/ChangeLog +index bb2ec10..77a7db8 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,7 @@ ++2016-12-29 Luiz Angelo Daros de Luca ++ ++ * Fix TEMP_FAILURE_RETRY definition when not defined ++ + 2016-12-27 Mark Wielaard + + * configure.ac: Set version to 0.168. +diff --git a/lib/crc32_file.c b/lib/crc32_file.c +index a8434d4..57e4298 100644 +--- a/lib/crc32_file.c ++++ b/lib/crc32_file.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include "system.h" + + int + crc32_file (int fd, uint32_t *resp) +diff --git a/lib/system.h b/lib/system.h +index ccd99d6..dde7c4a 100644 +--- a/lib/system.h ++++ b/lib/system.h +@@ -81,7 +81,7 @@ + do \ + __res = expression; \ + while (__res == -1 && errno == EINTR); \ +- __res; }); ++ __res; }) + #endif + + static inline ssize_t __attribute__ ((unused)) +diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c +index 903e193..d4737c9 100644 +--- a/libdwfl/dwfl_build_id_find_elf.c ++++ b/libdwfl/dwfl_build_id_find_elf.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include "system.h" + + + int +diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c +index 0e8810b..46caece 100644 +--- a/libdwfl/dwfl_module_getdwarf.c ++++ b/libdwfl/dwfl_module_getdwarf.c +@@ -33,6 +33,7 @@ + #include + #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */ + #include "../libelf/libelfP.h" ++#include "system.h" + + static inline Dwfl_Error + open_elf_file (Elf **elf, int *fd, char **name) +diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c +index 6b6b7d3..f849128 100644 +--- a/libdwfl/libdwfl_crc32_file.c ++++ b/libdwfl/libdwfl_crc32_file.c +@@ -31,6 +31,5 @@ + + #define crc32_file attribute_hidden __libdwfl_crc32_file + #define crc32 __libdwfl_crc32 +-#define LIB_SYSTEM_H 1 + #include + #include "../lib/crc32_file.c" +-- +2.9.3 + diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch index f345c3a9a6..2b71b97055 100644 --- a/package/libs/elfutils/patches/100-musl-compat.patch +++ b/package/libs/elfutils/patches/100-musl-compat.patch @@ -1,619 +1,567 @@ +https://sourceware.org/bugzilla/show_bug.cgi?id=21002 + --- a/lib/system.h +++ b/lib/system.h -@@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t - - #define gettext_noop(Str) Str +@@ -140,6 +140,19 @@ pread_retry (int fd, void *buf, size_t l + return recvd; + } -+#ifndef TEMP_FAILURE_RETRY -+#define TEMP_FAILURE_RETRY(expression) \ -+ (__extension__ \ -+ ({ long int __result; \ -+ do __result = (long int) (expression); \ -+ while (__result == -1L && errno == EINTR); \ -+ __result; })) ++#ifdef HAVE_ERROR_H ++#include "error.h" ++#else ++#include "err.h" ++#define error(status, errno, ...) \ ++ fflush(stdout); \ ++ warn(__VA_ARGS__); \ ++ if (status) exit(status) +#endif + -+#define error(status, errno, ...) err(status, __VA_ARGS__) ++#ifndef __GLIBC__ ++#define canonicalize_file_name(name) realpath(name,NULL) ++#endif - static inline ssize_t __attribute__ ((unused)) - pwrite_retry (int fd, const void *buf, size_t len, off_t off) + /* We need define two variables, argp_program_version_hook and + argp_program_bug_address, in all programs. argp.h declares these --- a/lib/color.c +++ b/lib/color.c -@@ -32,7 +32,7 @@ +@@ -32,12 +32,12 @@ #endif #include -#include -+#include #include #include #include + #include + #include "libeu.h" ++#include "system.h" + + + /* Prototype for option handler. */ --- a/lib/xmalloc.c +++ b/lib/xmalloc.c -@@ -30,7 +30,7 @@ +@@ -30,7 +30,6 @@ # include #endif -#include -+#include #include #include #include --- a/src/addr2line.c +++ b/src/addr2line.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/ar.c +++ b/src/ar.c -@@ -22,7 +22,7 @@ +@@ -22,7 +22,6 @@ #include #include -#include -+#include #include #include #include --- a/src/arlib2.c +++ b/src/arlib2.c -@@ -20,7 +20,7 @@ +@@ -20,7 +20,6 @@ # include #endif -#include -+#include #include #include #include --- a/src/arlib.c +++ b/src/arlib.c -@@ -21,7 +21,7 @@ +@@ -21,7 +21,6 @@ #endif #include -#include -+#include #include + #include #include - #include --- a/src/elfcmp.c +++ b/src/elfcmp.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/elflint.c +++ b/src/elflint.c -@@ -24,7 +24,7 @@ +@@ -24,7 +24,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/findtextrel.c +++ b/src/findtextrel.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/nm.c +++ b/src/nm.c -@@ -26,7 +26,7 @@ +@@ -26,7 +26,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/objdump.c +++ b/src/objdump.c -@@ -21,7 +21,7 @@ +@@ -21,7 +21,6 @@ #endif #include -#include -+#include #include #include #include --- a/src/ranlib.c +++ b/src/ranlib.c -@@ -24,7 +24,7 @@ +@@ -24,7 +24,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/readelf.c +++ b/src/readelf.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/size.c +++ b/src/size.c -@@ -21,7 +21,7 @@ +@@ -21,7 +21,6 @@ #endif #include -#include -+#include #include #include #include --- a/src/stack.c +++ b/src/stack.c -@@ -18,7 +18,7 @@ +@@ -18,7 +18,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/strings.c +++ b/src/strings.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/strip.c +++ b/src/strip.c -@@ -24,7 +24,7 @@ +@@ -24,7 +24,6 @@ #include #include #include -#include -+#include #include #include #include --- a/src/unstrip.c +++ b/src/unstrip.c -@@ -31,7 +31,7 @@ +@@ -31,7 +31,6 @@ #include #include #include -#include -+#include #include #include #include --- a/tests/addrscopes.c +++ b/tests/addrscopes.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include --- a/tests/allregs.c +++ b/tests/allregs.c -@@ -21,7 +21,7 @@ +@@ -21,7 +21,6 @@ #include #include #include -#include -+#include #include #include #include --- a/tests/backtrace.c +++ b/tests/backtrace.c -@@ -24,7 +24,7 @@ +@@ -24,7 +24,6 @@ #include #include #include -#include -+#include #include #include #ifdef __linux__ --- a/tests/backtrace-data.c +++ b/tests/backtrace-data.c -@@ -27,7 +27,7 @@ +@@ -27,7 +27,6 @@ #include #include #include -#include -+#include #include #include #if defined(__x86_64__) && defined(__linux__) --- a/tests/buildid.c +++ b/tests/buildid.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include ELFUTILS_HEADER(elf) #include ELFUTILS_HEADER(dwelf) #include -#include -+#include #include #include #include --- a/tests/debugaltlink.c +++ b/tests/debugaltlink.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include ELFUTILS_HEADER(dw) #include ELFUTILS_HEADER(dwelf) #include -#include -+#include #include #include #include --- a/tests/debuglink.c +++ b/tests/debuglink.c -@@ -21,7 +21,7 @@ +@@ -21,7 +21,6 @@ #include #include ELFUTILS_HEADER(dwelf) #include -#include -+#include #include #include #include --- a/tests/dwfl-addr-sect.c +++ b/tests/dwfl-addr-sect.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include #include #include -#include -+#include #include #include #include ELFUTILS_HEADER(dwfl) --- a/tests/dwfl-bug-addr-overflow.c +++ b/tests/dwfl-bug-addr-overflow.c -@@ -20,7 +20,7 @@ +@@ -20,7 +20,6 @@ #include #include #include -#include -+#include #include #include ELFUTILS_HEADER(dwfl) --- a/tests/dwfl-bug-fd-leak.c +++ b/tests/dwfl-bug-fd-leak.c -@@ -24,7 +24,7 @@ +@@ -24,7 +24,6 @@ #include #include #include -#include -+#include #include #include --- a/tests/dwfl-bug-getmodules.c +++ b/tests/dwfl-bug-getmodules.c -@@ -18,7 +18,7 @@ +@@ -18,7 +18,6 @@ #include #include ELFUTILS_HEADER(dwfl) -#include -+#include static const Dwfl_Callbacks callbacks = { --- a/tests/dwfllines.c +++ b/tests/dwfllines.c -@@ -27,7 +27,7 @@ +@@ -27,7 +27,6 @@ #include #include #include -#include -+#include int main (int argc, char *argv[]) --- a/tests/dwflmodtest.c +++ b/tests/dwflmodtest.c -@@ -23,7 +23,7 @@ +@@ -23,7 +23,6 @@ #include #include #include -#include -+#include #include #include #include ELFUTILS_HEADER(dwfl) --- a/tests/dwfl-report-elf-align.c +++ b/tests/dwfl-report-elf-align.c -@@ -20,7 +20,7 @@ +@@ -20,7 +20,6 @@ #include #include #include -#include -+#include #include #include #include --- a/tests/dwflsyms.c +++ b/tests/dwflsyms.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include static const char * --- a/tests/early-offscn.c +++ b/tests/early-offscn.c -@@ -19,7 +19,7 @@ +@@ -19,7 +19,6 @@ #endif #include -#include -+#include #include #include #include --- a/tests/ecp.c +++ b/tests/ecp.c -@@ -20,7 +20,7 @@ +@@ -20,7 +20,6 @@ #endif #include -#include -+#include #include #include #include --- a/tests/find-prologues.c +++ b/tests/find-prologues.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include --- a/tests/funcretval.c +++ b/tests/funcretval.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include --- a/tests/funcscopes.c +++ b/tests/funcscopes.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include --- a/tests/line2addr.c +++ b/tests/line2addr.c -@@ -26,7 +26,7 @@ +@@ -26,7 +26,6 @@ #include #include #include -#include -+#include static void --- a/tests/low_high_pc.c +++ b/tests/low_high_pc.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include --- a/tests/md5-sha1-test.c +++ b/tests/md5-sha1-test.c -@@ -19,7 +19,7 @@ +@@ -19,7 +19,6 @@ #endif #include -#include -+#include #include "md5.h" #include "sha1.h" --- a/tests/rdwrmmap.c +++ b/tests/rdwrmmap.c -@@ -19,7 +19,7 @@ +@@ -19,7 +19,6 @@ #endif #include -#include -+#include #include #include #include --- a/tests/saridx.c +++ b/tests/saridx.c -@@ -17,7 +17,7 @@ +@@ -17,7 +17,6 @@ #include -#include -+#include #include #include #include --- a/tests/sectiondump.c +++ b/tests/sectiondump.c -@@ -18,7 +18,7 @@ +@@ -18,7 +18,6 @@ #include #include -#include -+#include #include #include #include --- a/tests/varlocs.c +++ b/tests/varlocs.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,6 @@ #include #include #include -#include -+#include #include #include #include ---- a/libelf/libelf.h -+++ b/libelf/libelf.h -@@ -29,6 +29,7 @@ - #ifndef _LIBELF_H - #define _LIBELF_H 1 - -+#include - #include - #include - --- a/libasm/asm_end.c +++ b/libasm/asm_end.c -@@ -32,7 +32,7 @@ +@@ -32,7 +32,6 @@ #endif #include -#include -+#include #include #include #include --- a/libasm/asm_newscn.c +++ b/libasm/asm_newscn.c -@@ -32,7 +32,7 @@ +@@ -32,7 +32,6 @@ #endif #include -#include -+#include #include #include #include --- a/libcpu/i386_gendis.c +++ b/libcpu/i386_gendis.c -@@ -31,7 +31,7 @@ +@@ -31,7 +31,6 @@ # include #endif -#include -+#include #include #include #include --- a/libcpu/i386_lex.c +++ b/libcpu/i386_lex.c -@@ -578,7 +578,7 @@ char *i386_text; +@@ -592,7 +592,6 @@ char *i386_text; #endif #include -#include -+#include #include - #include + #include --- a/libcpu/i386_lex.l +++ b/libcpu/i386_lex.l -@@ -31,7 +31,7 @@ +@@ -31,7 +31,6 @@ #endif #include -#include -+#include #include - #include + #include --- a/libcpu/i386_parse.c +++ b/libcpu/i386_parse.c -@@ -107,7 +107,7 @@ +@@ -107,7 +107,6 @@ #include #include #include -#include -+#include #include #include #include --- a/libdw/libdw_alloc.c +++ b/libdw/libdw_alloc.c -@@ -31,7 +31,7 @@ +@@ -31,7 +31,6 @@ # include #endif -#include -+#include #include #include - #include -@@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hid + #include "libdwP.h" +@@ -74,5 +73,5 @@ __attribute ((noreturn, visibility ("hid __libdw_oom (void) { while (1) - error (EXIT_FAILURE, ENOMEM, "libdw"); -+ err (EXIT_FAILURE, "libdw: out of memory"); ++ error (EXIT_FAILURE, errno, gettext ("cannot allocate memory")); } --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c -@@ -32,7 +32,7 @@ +@@ -32,7 +32,6 @@ #include #include -#include -+#include #include #include #include @@ -637,66 +585,3 @@ case OTHER_ERROR (LIBELF): return elf_errmsg (error & 0xffff); case OTHER_ERROR (LIBDW): ---- a/libdwfl/libdwfl.h -+++ b/libdwfl/libdwfl.h -@@ -31,6 +31,27 @@ - - #include "libdw.h" - #include -+#include -+#include -+#include -+ -+#ifndef TEMP_FAILURE_RETRY -+#define TEMP_FAILURE_RETRY(expression) \ -+ (__extension__ \ -+ ({ long int __result; \ -+ do __result = (long int) (expression); \ -+ while (__result == -1L && errno == EINTR); \ -+ __result; })) -+#endif -+ -+#ifndef strndupa -+#define strndupa(s, n) \ -+ (__extension__ ({const char *__in = (s); \ -+ size_t __len = strnlen (__in, (n)) + 1; \ -+ char *__out = (char *) alloca (__len); \ -+ __out[__len-1] = '\0'; \ -+ (char *) memcpy (__out, __in, __len-1);})) -+#endif - - /* Handle for a session using the library. */ - typedef struct Dwfl Dwfl; ---- a/libdwfl/find-debuginfo.c -+++ b/libdwfl/find-debuginfo.c -@@ -385,7 +385,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul - /* If FILE_NAME is a symlink, the debug file might be associated - with the symlink target name instead. */ - -- char *canon = canonicalize_file_name (file_name); -+ char *canon = realpath (file_name, NULL); - if (canon != NULL && strcmp (file_name, canon)) - fd = find_debuginfo_in_path (mod, canon, - debuglink_file, debuglink_crc, ---- a/libdwfl/dwfl_build_id_find_elf.c -+++ b/libdwfl/dwfl_build_id_find_elf.c -@@ -94,7 +94,7 @@ __libdwfl_open_by_build_id (Dwfl_Module - { - if (*file_name != NULL) - free (*file_name); -- *file_name = canonicalize_file_name (name); -+ *file_name = realpath (name, NULL); - if (*file_name == NULL) - { - *file_name = name; ---- a/libelf/elf_getarsym.c -+++ b/libelf/elf_getarsym.c -@@ -297,7 +297,7 @@ elf_getarsym (Elf *elf, size_t *ptr) - arsym[cnt].as_off = (*u32)[cnt]; - - arsym[cnt].as_hash = _dl_elf_hash (str_data); -- str_data = rawmemchr (str_data, '\0') + 1; -+ str_data = memchr (str_data, '\0', SIZE_MAX) + 1; - } - - /* At the end a special entry. */ diff --git a/package/libs/elfutils/patches/101-no-fts.patch b/package/libs/elfutils/patches/101-no-fts.patch index 124563c787..e6a672997d 100644 --- a/package/libs/elfutils/patches/101-no-fts.patch +++ b/package/libs/elfutils/patches/101-no-fts.patch @@ -90,7 +90,7 @@ dwfl_addrmodule.$(OBJEXT) dwfl_addrdwarf.$(OBJEXT) \ cu.$(OBJEXT) dwfl_module_nextcu.$(OBJEXT) \ dwfl_nextcu.$(OBJEXT) dwfl_cumodule.$(OBJEXT) \ -@@ -432,7 +432,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en +@@ -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 \ @@ -99,7 +99,7 @@ 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 \ -@@ -569,7 +569,6 @@ distclean-compile: +@@ -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@ diff --git a/package/libs/gettext-full/Makefile b/package/libs/gettext-full/Makefile index eb4236b774..deb4840109 100644 --- a/package/libs/gettext-full/Makefile +++ b/package/libs/gettext-full/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=gettext-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gettext -PKG_MD5SUM:=df3f5690eaa30fd228537b00cb7b7590 +PKG_HASH:=105556dbc5c3fbbc2aa0edb46d22d055748b6f5c7cd7a8d99f8e7eb84e938be4 PKG_BUILD_DIR:=$(BUILD_DIR)/gettext-$(PKG_VERSION) HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/gettext-$(PKG_VERSION) @@ -37,7 +37,7 @@ endef TARGET_CFLAGS += $(FPIC) ifneq ($(HOST_OS),Linux) - TARGET_CFLAGS += -I$(STAGING_DIR)/host/include + TARGET_CFLAGS += -I$(STAGING_DIR_HOSTPKG)/include endif ifdef CONFIG_USE_MUSL TARGET_CFLAGS += -D__UCLIBC__ @@ -59,6 +59,8 @@ CONFIGURE_ARGS += \ --without-emacs HOST_CONFIGURE_ARGS += \ + --disable-shared \ + --enable-static \ --disable-libasprintf \ --disable-rpath \ --disable-java \ @@ -69,7 +71,10 @@ HOST_CONFIGURE_ARGS += \ HOST_CONFIGURE_VARS += \ - EMACS="no" + EMACS="no" \ + am_cv_lib_iconv=no \ + am_cv_func_iconv=no \ + ac_cv_header_iconv_h=no \ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/libintl-full/include @@ -81,7 +86,7 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/share/aclocal $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/* $(1)/usr/share/aclocal/ - $(SED) '/read dummy/d' $(STAGING_DIR)/host/bin/gettextize + $(SED) '/read dummy/d' $(STAGING_DIR_HOSTPKG)/bin/gettextize endef define Package/libintl-full/install diff --git a/package/libs/gettext/Makefile b/package/libs/gettext/Makefile index b0233309e2..f37c4e4e74 100644 --- a/package/libs/gettext/Makefile +++ b/package/libs/gettext/Makefile @@ -47,11 +47,11 @@ define Host/Compile endef define Host/Install - $(INSTALL_DIR) $(STAGING_DIR)/host/include - $(INSTALL_DATA) ./src/include/libintl.h $(STAGING_DIR)/host/include/ + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/include + $(INSTALL_DATA) ./src/include/libintl.h $(STAGING_DIR_HOSTPKG)/include/ - $(INSTALL_DIR) $(STAGING_DIR)/host/share/aclocal - $(INSTALL_DATA) ./src/m4/* $(STAGING_DIR)/host/share/aclocal/ + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/share/aclocal + $(INSTALL_DATA) ./src/m4/* $(STAGING_DIR_HOSTPKG)/share/aclocal/ endef define Package/libintl/install diff --git a/package/libs/gmp/Makefile b/package/libs/gmp/Makefile index 5c2d96aa81..b5737505b7 100644 --- a/package/libs/gmp/Makefile +++ b/package/libs/gmp/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gmp -PKG_VERSION:=6.1.1 +PKG_VERSION:=6.1.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)$(PKG_REVISION).tar.xz PKG_SOURCE_URL:=@GNU/gmp/ -PKG_MD5SUM:=e70e183609244a332d80529e7e155a35 +PKG_HASH:=87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 diff --git a/package/libs/libbsd/Makefile b/package/libs/libbsd/Makefile index ca5e76179f..11232c7415 100644 --- a/package/libs/libbsd/Makefile +++ b/package/libs/libbsd/Makefile @@ -5,8 +5,8 @@ PKG_VERSION:=0.3.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_HASH:=fbf36ed40443e1d0d795adbae8d461952509e610c3ccf0866ae160b723f7fe38 PKG_SOURCE_URL:=http://libbsd.freedesktop.org/releases -#PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150 PKG_LICENSE:=BSD-4-Clause PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/libconfig/Makefile b/package/libs/libconfig/Makefile index 18325479cf..fea00e2ef4 100644 --- a/package/libs/libconfig/Makefile +++ b/package/libs/libconfig/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.hyperrealm.com/libconfig -PKG_MD5SUM:=e31daa390d8e4461c8830512fe2e13ba1a3d6a02a2305a02429eec61e68703f6 +PKG_HASH:=e31daa390d8e4461c8830512fe2e13ba1a3d6a02a2305a02429eec61e68703f6 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 375bc8c888..99034bb228 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/libevent-$(PKG_VERSION)-stable PKG_SOURCE:=libevent-$(PKG_VERSION)-stable.tar.gz PKG_SOURCE_URL:=@SF/levent -PKG_MD5SUM:=c4c56f986aa985677ca1db89630a2e11 +PKG_HASH:=71c2c49f0adadacfdbe6332a372c38cf9c8b7895bb73dabeaa53cdcc1d4e1fa3 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=BSD-3-Clause diff --git a/package/libs/libiconv-full/Makefile b/package/libs/libiconv-full/Makefile index 4327321e18..9776711a79 100644 --- a/package/libs/libiconv-full/Makefile +++ b/package/libs/libiconv-full/Makefile @@ -15,7 +15,7 @@ PKG_MAINTAINER:=Jo-Philipp Wich PKG_SOURCE:=libiconv-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/libiconv -PKG_MD5SUM:=d42b97f6ef5dd0ba4469d520ed732fed +PKG_HASH:=e78c347a1a0cb15f2648519e9799151f4b4a934b61ad9ee7424478efe2b8257f PKG_BUILD_DIR:=$(BUILD_DIR)/libiconv-$(PKG_VERSION) PKG_LICENSE:=LGPL-2.0 PKG_LICENSE_FILES:=COPYING.LIB diff --git a/package/libs/libiconv/Makefile b/package/libs/libiconv/Makefile index 0cb7cc7254..4d7dcd3498 100644 --- a/package/libs/libiconv/Makefile +++ b/package/libs/libiconv/Makefile @@ -65,14 +65,14 @@ define Host/Compile endef define Host/Install - $(INSTALL_DIR) $(STAGING_DIR)/host/lib - $(INSTALL_DATA) $(HOST_BUILD_DIR)/libiconv.a $(STAGING_DIR)/host/lib/ + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib + $(INSTALL_DATA) $(HOST_BUILD_DIR)/libiconv.a $(STAGING_DIR_HOSTPKG)/lib/ - $(INSTALL_DIR) $(STAGING_DIR)/host/include - $(INSTALL_DATA) ./src/include/iconv.h $(STAGING_DIR)/host/include/ + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/include + $(INSTALL_DATA) ./src/include/iconv.h $(STAGING_DIR_HOSTPKG)/include/ - $(INSTALL_DIR) $(STAGING_DIR)/host/share/aclocal - $(INSTALL_DATA) ./src/m4/* $(STAGING_DIR)/host/share/aclocal/ + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/share/aclocal + $(INSTALL_DATA) ./src/m4/* $(STAGING_DIR_HOSTPKG)/share/aclocal/ endef $(eval $(call HostBuild)) diff --git a/package/libs/libjson-c/Makefile b/package/libs/libjson-c/Makefile index 51cc645045..87dbc4708e 100644 --- a/package/libs/libjson-c/Makefile +++ b/package/libs/libjson-c/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/ -PKG_MD5SUM:=5b91ab230d9b6b0ee20fc19cf25094f5 +PKG_HASH:=5a617da9aade997938197ef0f8aabd7f97b670c216dc173977e1d56eef9e1291 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) diff --git a/package/libs/libmnl/Makefile b/package/libs/libmnl/Makefile index 9f8d9ac139..6d05e25440 100644 --- a/package/libs/libmnl/Makefile +++ b/package/libs/libmnl/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libmnl/files \ ftp://ftp.netfilter.org/pub/libmnl -PKG_MD5SUM:=171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81 +PKG_HASH:=171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81 PKG_MAINTAINER:=Jo-Philipp Wich diff --git a/package/libs/libnetfilter-conntrack/Makefile b/package/libs/libnetfilter-conntrack/Makefile index 96da6f9773..399aa6ce1d 100644 --- a/package/libs/libnetfilter-conntrack/Makefile +++ b/package/libs/libnetfilter-conntrack/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnetfilter_conntrack/files/ \ ftp://ftp.netfilter.org/pub/libnetfilter_conntrack/ -PKG_MD5SUM:=efcc08021284e75f4d96d3581c5155a11f08fd63316b1938cbcb269c87f37feb +PKG_HASH:=efcc08021284e75f4d96d3581c5155a11f08fd63316b1938cbcb269c87f37feb PKG_MAINTAINER:=Jo-Philipp Wich PKG_FIXUP:=autoreconf diff --git a/package/libs/libnetfilter-cthelper/Makefile b/package/libs/libnetfilter-cthelper/Makefile index 84a77645bd..a67296a1f2 100644 --- a/package/libs/libnetfilter-cthelper/Makefile +++ b/package/libs/libnetfilter-cthelper/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnetfilter_cthelper/files/ \ ftp://ftp.netfilter.org/pub/libnetfilter_cthelper/ -PKG_MD5SUM:=b2efab1a3a198a5add448960ba011acd +PKG_HASH:=07618e71c4d9a6b6b3dc1986540486ee310a9838ba754926c7d14a17d8fccf3d PKG_FIXUP:=autoreconf PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnetfilter-cttimeout/Makefile b/package/libs/libnetfilter-cttimeout/Makefile index d065d2631b..acd1b7b342 100644 --- a/package/libs/libnetfilter-cttimeout/Makefile +++ b/package/libs/libnetfilter-cttimeout/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnetfilter_cttimeout/files/ \ ftp://ftp.netfilter.org/pub/libnetfilter_cttimeout/ -PKG_MD5SUM:=7697437fc9ebb6f6b83df56a633db7f9 +PKG_HASH:=aeab12754f557cba3ce2950a2029963d817490df7edb49880008b34d7ff8feba PKG_FIXUP:=autoreconf PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnetfilter-log/Makefile b/package/libs/libnetfilter-log/Makefile index 51838fb6dd..c80c46f930 100644 --- a/package/libs/libnetfilter-log/Makefile +++ b/package/libs/libnetfilter-log/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnetfilter_log/files/ \ ftp://ftp.netfilter.org/pub/libnetfilter_log/ -PKG_MD5SUM:=2a4bb0654ae675a52d2e8d1c06090b94 +PKG_HASH:=74e0fe75753dba3ac114531b5e73240452c789a3f3adccf5c51217da1d933b21 PKG_MAINTAINER:=Yousong Zhou PKG_FIXUP:=autoreconf diff --git a/package/libs/libnetfilter-queue/Makefile b/package/libs/libnetfilter-queue/Makefile index fb54c86e5d..dd8fd9f09e 100644 --- a/package/libs/libnetfilter-queue/Makefile +++ b/package/libs/libnetfilter-queue/Makefile @@ -8,14 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnetfilter_queue -PKG_VERSION:=2016-07-03 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=http://git.netfilter.org/libnetfilter_queue -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-07-03 PKG_SOURCE_VERSION:=981025e103d887fb6a9c9bb49c74ec323108d098 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz +PKG_MIRROR_HASH:=85c124be0e19162e1ebd1aba6e7e86bb4106e9dab4267baaf66d3ccb48d56e3f PKG_FIXUP:=autoreconf PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnfnetlink/Makefile b/package/libs/libnfnetlink/Makefile index 6f4974f66d..6d931a4ddd 100644 --- a/package/libs/libnfnetlink/Makefile +++ b/package/libs/libnfnetlink/Makefile @@ -16,7 +16,7 @@ PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnfnetlink/files/ \ ftp://ftp.netfilter.org/pub/libnfnetlink/ \ http://mirrors.evolva.ro/netfilter.org/libnfnetlink/ -PKG_MD5SUM:=98927583d2016a9fb1936fed992e2c5e +PKG_HASH:=f270e19de9127642d2a11589ef2ec97ef90a649a74f56cf9a96306b04817b51a PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index be9500e423..5b541f4518 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -11,12 +11,10 @@ PKG_NAME:=libnftnl PKG_VERSION:=1.0.6 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=git://git.netfilter.org/libnftnl PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=libnftnl-1.0.6 -PKG_MIRROR_MD5SUM:=c9e066e3fd29951cbe96d2898b4d6cdcfe802b3a4f09f8273a508e7a0a20a357 +PKG_MIRROR_HASH:=c9e066e3fd29951cbe96d2898b4d6cdcfe802b3a4f09f8273a508e7a0a20a357 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnl-tiny/src/include/netlink-local.h b/package/libs/libnl-tiny/src/include/netlink-local.h index 330100e805..53da8ca97e 100644 --- a/package/libs/libnl-tiny/src/include/netlink-local.h +++ b/package/libs/libnl-tiny/src/include/netlink-local.h @@ -11,7 +11,9 @@ #ifndef NETLINK_LOCAL_H_ #define NETLINK_LOCAL_H_ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 86ef044a17..7916556c00 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.2.28 +PKG_VERSION:=3.2.29 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl3_2_28 -PKG_MD5SUM:=cd608992c656e8f6e3ab6c1391b162a5a51c49336b9219f7f390e61fc5437c41 +PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl3_2_29 +PKG_HASH:=0beb593dc6abfffa18a5c787b27884979c1b7e7f1fd468c801e3cc938a685922 PKG_LICENSE:=LGPL-2.1 include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index 08fab24fde..d3360d2dee 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=1.7.4 +PKG_VERSION:=1.8.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.tcpdump.org/release/ -PKG_MD5SUM:=b2e13142bbaba857ab1c6894aedaf547 +PKG_HASH:=673dbc69fdc3f5a86fb5759ab19899039a8e5e6c631749e48dcd9c6f0c83541e 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 new file mode 100644 index 0000000000..edb6ae5667 --- /dev/null +++ b/package/libs/libpcap/patches/001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch @@ -0,0 +1,41 @@ +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 new file mode 100644 index 0000000000..032b265f05 --- /dev/null +++ b/package/libs/libpcap/patches/002-Add-missing-compiler_state_t-parameter.patch @@ -0,0 +1,67 @@ +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 9ed6793f94..59d15e6602 100644 --- a/package/libs/libpcap/patches/100-debian_shared_lib.patch +++ b/package/libs/libpcap/patches/100-debian_shared_lib.patch @@ -3,13 +3,12 @@ build a shared library. --- a/Makefile.in +++ b/Makefile.in -@@ -38,6 +38,14 @@ mandir = @mandir@ +@@ -38,6 +38,13 @@ mandir = @mandir@ srcdir = @srcdir@ VPATH = @srcdir@ +# some defines for shared library compilation -+MAJ=1.3 -+LIBVERSION=$(MAJ).0 ++LIBVERSION=1 +LIBNAME=pcap +LIBRARY=lib$(LIBNAME).a +SOLIBRARY=lib$(LIBNAME).so @@ -18,30 +17,30 @@ build a shared library. # # You shouldn't need to edit anything below. # -@@ -62,7 +70,8 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ +@@ -62,7 +69,8 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ PROG=libpcap # Standard CFLAGS -FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) +FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS) -+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) ++CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -82,7 +91,11 @@ YACC = @V_YACC@ +@@ -77,7 +85,11 @@ YACC = @YACC@ # problem if you don't own the file but can write to the directory. .c.o: @rm -f $@ - $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c + $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c + -+%_pic.o: %.c ++%_pic.o: %.c %.o + @rm -f $@ + $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c - PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@ @DBUS_SRC@ - FSRC = fad-@V_FINDALLDEVS@.c -@@ -98,6 +111,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( + PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ + FSRC = @V_FINDALLDEVS@ +@@ -93,6 +105,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) @@ -49,7 +48,7 @@ build a shared library. PUBHDR = \ pcap.h \ pcap-bpf.h \ -@@ -153,7 +167,7 @@ TAGFILES = \ +@@ -157,7 +170,7 @@ TAGFILES = \ CLEANFILES = $(OBJ) libpcap.* $(TESTS) \ $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \ @@ -58,7 +57,7 @@ build a shared library. MAN1 = pcap-config.1 -@@ -365,7 +379,7 @@ libpcap.a: $(OBJ) +@@ -365,7 +378,7 @@ libpcap.a: $(OBJ) $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS) $(RANLIB) $@ @@ -67,33 +66,32 @@ build a shared library. libpcap.so: $(OBJ) @rm -f $@ -@@ -443,6 +457,13 @@ libpcap.shareda: $(OBJ) +@@ -443,6 +456,12 @@ libpcap.shareda: $(OBJ) # libpcap.none: +$(SHAREDLIB): $(OBJ_PIC) + -@rm -f $@ -+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) ++ -@rm -f $(SOLIBRARY) + $(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS) -+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) -+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) ++ ln -s $(SHAREDLIB) $(SOLIBRARY) + scanner.c: $(srcdir)/scanner.l - @rm -f $@ $@.bottom - $(srcdir)/runlex.sh $(LEX) -o$@ $< -@@ -453,6 +474,9 @@ scanner.c: $(srcdir)/scanner.l - scanner.o: scanner.c tokdefs.h + $(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $< + scanner.h: scanner.c +@@ -455,6 +474,9 @@ scanner.h: scanner.c + scanner.o: scanner.c grammar.h $(CC) $(FULL_CFLAGS) -c scanner.c -+scanner_pic.o: scanner.c tokdefs.h ++scanner_pic.o: scanner.c grammar.h + $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c + - pcap.o: version.h + pcap.o: pcap_version.h - tokdefs.h: grammar.c -@@ -466,9 +490,16 @@ grammar.o: grammar.c - @rm -f $@ - $(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c + grammar.c: $(srcdir)/grammar.y +@@ -472,9 +494,16 @@ grammar.o: 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 $@ @@ -108,7 +106,7 @@ build a shared library. snprintf.o: $(srcdir)/missing/snprintf.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c -@@ -506,6 +537,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt +@@ -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 @@ -118,7 +116,7 @@ build a shared library. # # Generate the pcap-config script. # -@@ -622,14 +656,12 @@ install: install-shared install-archive +@@ -623,14 +655,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) @@ -132,14 +130,13 @@ build a shared library. - ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \ - ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/ -+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ) -+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY) ++ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY) install-shared-dylib: libpcap.dylib [ -d $(DESTDIR)$(libdir) ] || \ (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -438,7 +438,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, +@@ -470,7 +470,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, esac ;; esac @@ -148,7 +145,7 @@ build a shared library. V_SONAME_OPT="-Wl,-soname," V_RPATH_OPT="-Wl,-rpath," ;; -@@ -501,7 +501,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, +@@ -533,7 +533,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, # # "cc" is GCC. # diff --git a/package/libs/libpcap/patches/102-makefile_disable_manpages.patch b/package/libs/libpcap/patches/102-makefile_disable_manpages.patch index 59b903c413..c2326b95be 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 -@@ -590,70 +590,12 @@ install: install-shared install-archive +@@ -589,70 +589,12 @@ 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) @@ -70,4 +70,4 @@ - $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done install-shared: install-shared-$(DYEXT) - install-shared-so: libpcap.so + install-shared-so: $(SHAREDLIB) diff --git a/package/libs/libpcap/patches/103-makefile_flex_workaround.patch b/package/libs/libpcap/patches/103-makefile_flex_workaround.patch index a7ab9ad054..5eb6d3fd42 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 -@@ -57,7 +57,7 @@ LN_S = @LN_S@ +@@ -56,7 +56,7 @@ LN_S = @LN_S@ MKDEP = @MKDEP@ CCOPT = @V_CCOPT@ INCLS = -I. @V_INCLS@ --DEFS = @DEFS@ @V_DEFS@ -+DEFS = -D_BSD_SOURCE @DEFS@ @V_DEFS@ +-DEFS = -DBUILDING_PCAP @DEFS@ @V_DEFS@ ++DEFS = -DBUILDING_PCAP -D_BSD_SOURCE @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 f331a18357..b0a91bb0ef 100644 --- a/package/libs/libpcap/patches/201-space_optimization.patch +++ b/package/libs/libpcap/patches/201-space_optimization.patch @@ -1,140 +1,7 @@ ---- a/gencode.c -+++ b/gencode.c -@@ -543,20 +543,6 @@ pcap_compile_nopcap(int snaplen_arg, int - } - - /* -- * Clean up a "struct bpf_program" by freeing all the memory allocated -- * in it. -- */ --void --pcap_freecode(struct bpf_program *program) --{ -- program->bf_len = 0; -- if (program->bf_insns != NULL) { -- free((char *)program->bf_insns); -- program->bf_insns = NULL; -- } --} -- --/* - * Backpatch the blocks in 'list' to 'target'. The 'sense' field indicates - * which of the jt and jf fields has been resolved and which is a pointer - * back to another unresolved block (or nil). At least one of the fields ---- a/pcap.c -+++ b/pcap.c -@@ -1087,6 +1087,59 @@ static const u_char charmap[] = { - (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377', - }; - -+/* -+ * Clean up a "struct bpf_program" by freeing all the memory allocated -+ * in it. -+ */ -+void -+pcap_freecode(struct bpf_program *program) -+{ -+ program->bf_len = 0; -+ if (program->bf_insns != NULL) { -+ free((char *)program->bf_insns); -+ program->bf_insns = NULL; -+ } -+} -+ -+/* -+ * Make a copy of a BPF program and put it in the "fcode" member of -+ * a "pcap_t". -+ * -+ * If we fail to allocate memory for the copy, fill in the "errbuf" -+ * member of the "pcap_t" with an error message, and return -1; -+ * otherwise, return 0. -+ */ -+int -+install_bpf_program(pcap_t *p, struct bpf_program *fp) -+{ -+ size_t prog_size; -+ -+ /* -+ * Validate the program. -+ */ -+ if (!bpf_validate(fp->bf_insns, fp->bf_len)) { -+ snprintf(p->errbuf, sizeof(p->errbuf), -+ "BPF program is not valid"); -+ return (-1); -+ } -+ -+ /* -+ * Free up any already installed program. -+ */ -+ pcap_freecode(&p->fcode); -+ -+ prog_size = sizeof(*fp->bf_insns) * fp->bf_len; -+ p->fcode.bf_len = fp->bf_len; -+ p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size); -+ if (p->fcode.bf_insns == NULL) { -+ snprintf(p->errbuf, sizeof(p->errbuf), -+ "malloc: %s", pcap_strerror(errno)); -+ return (-1); -+ } -+ memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size); -+ return (0); -+} -+ - int - pcap_strcasecmp(const char *s1, const char *s2) - { ---- a/optimize.c -+++ b/optimize.c -@@ -2203,45 +2203,6 @@ icode_to_fcode(struct block *root, u_int - return fp; - } - --/* -- * Make a copy of a BPF program and put it in the "fcode" member of -- * a "pcap_t". -- * -- * If we fail to allocate memory for the copy, fill in the "errbuf" -- * member of the "pcap_t" with an error message, and return -1; -- * otherwise, return 0. -- */ --int --install_bpf_program(pcap_t *p, struct bpf_program *fp) --{ -- size_t prog_size; -- -- /* -- * Validate the program. -- */ -- if (!bpf_validate(fp->bf_insns, fp->bf_len)) { -- snprintf(p->errbuf, sizeof(p->errbuf), -- "BPF program is not valid"); -- return (-1); -- } -- -- /* -- * Free up any already installed program. -- */ -- pcap_freecode(&p->fcode); -- -- prog_size = sizeof(*fp->bf_insns) * fp->bf_len; -- p->fcode.bf_len = fp->bf_len; -- p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size); -- if (p->fcode.bf_insns == NULL) { -- snprintf(p->errbuf, sizeof(p->errbuf), -- "malloc: %s", pcap_strerror(errno)); -- return (-1); -- } -- memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size); -- return (0); --} -- - #ifdef BDEBUG - static void - dot_dump_node(struct block *block, struct bpf_program *prog, FILE *out) --- a/pcap-common.c +++ b/pcap-common.c -@@ -1372,14 +1372,23 @@ swap_pseudo_headers(int linktype, struct - switch (linktype) { +@@ -1447,14 +1447,23 @@ swap_pseudo_headers(int linktype, struct + break; case DLT_USB_LINUX: +#ifndef PCAP_SUPPORT_USB diff --git a/package/libs/libpcap/patches/202-protocol_api.patch b/package/libs/libpcap/patches/202-protocol_api.patch index d0c32a5e22..711dc5ce99 100644 --- a/package/libs/libpcap/patches/202-protocol_api.patch +++ b/package/libs/libpcap/patches/202-protocol_api.patch @@ -1,6 +1,8 @@ +This API extension is used by ead (Emergency Access Daemon) + --- a/pcap-linux.c +++ b/pcap-linux.c -@@ -414,7 +414,7 @@ static int iface_get_id(int fd, const ch +@@ -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 @@ -9,16 +11,16 @@ #ifdef IW_MODE_MONITOR static int has_wext(int sock_fd, const char *device, char *ebuf); #endif /* IW_MODE_MONITOR */ -@@ -1028,7 +1028,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle) +@@ -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)snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + (void)pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); -@@ -1337,6 +1337,9 @@ pcap_activate_linux(pcap_t *handle) +@@ -1456,6 +1456,9 @@ pcap_activate_linux(pcap_t *handle) handle->read_op = pcap_read_linux; handle->stats_op = pcap_stats_linux; @@ -28,7 +30,7 @@ /* * The "any" device is a special device which causes us not * to bind to a particular device and thus to look at all -@@ -3160,8 +3163,8 @@ activate_new(pcap_t *handle) +@@ -3335,8 +3338,8 @@ activate_new(pcap_t *handle) * try a SOCK_RAW socket for the raw interface. */ sock_fd = is_any_device ? @@ -39,16 +41,16 @@ if (sock_fd == -1) { if (errno == EINVAL || errno == EAFNOSUPPORT) { -@@ -3279,7 +3282,7 @@ activate_new(pcap_t *handle) +@@ -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) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); -@@ -3343,7 +3346,7 @@ activate_new(pcap_t *handle) +@@ -3518,7 +3521,7 @@ activate_new(pcap_t *handle) } if ((err = iface_bind(sock_fd, handlep->ifindex, @@ -57,7 +59,7 @@ close(sock_fd); if (err < 0) return err; -@@ -5050,7 +5053,7 @@ iface_get_id(int fd, const char *device, +@@ -5271,7 +5274,7 @@ iface_get_id(int fd, const char *device, * or a PCAP_ERROR_ value on a hard error. */ static int @@ -66,7 +68,7 @@ { struct sockaddr_ll sll; int err; -@@ -5059,7 +5062,7 @@ iface_bind(int fd, int ifindex, char *eb +@@ -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; @@ -75,18 +77,18 @@ if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) { if (errno == ENETDOWN) { -@@ -6049,7 +6052,7 @@ activate_old(pcap_t *handle) +@@ -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) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); --- a/pcap.c +++ b/pcap.c -@@ -562,6 +562,7 @@ pcap_create_common(const char *source, 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; @@ -94,7 +96,7 @@ p->opt.tstamp_type = -1; /* default to not setting time stamp type */ p->opt.tstamp_precision = PCAP_TSTAMP_PRECISION_MICRO; -@@ -725,6 +726,15 @@ pcap_get_tstamp_precision(pcap_t *p) +@@ -771,6 +772,15 @@ pcap_get_tstamp_precision(pcap_t *p) } int @@ -112,7 +114,7 @@ int status; --- a/pcap/pcap.h +++ b/pcap/pcap.h -@@ -66,6 +66,7 @@ extern "C" { +@@ -68,6 +68,7 @@ extern "C" { #define PCAP_VERSION_MINOR 4 #define PCAP_ERRBUF_SIZE 256 @@ -120,21 +122,21 @@ /* * Compatibility for systems that have a bpf.h that -@@ -283,6 +284,7 @@ int pcap_set_timeout(pcap_t *, int); - int pcap_set_tstamp_type(pcap_t *, int); - int pcap_set_immediate_mode(pcap_t *, int); - int pcap_set_buffer_size(pcap_t *, int); -+int pcap_set_protocol(pcap_t *, unsigned short); - int pcap_set_tstamp_precision(pcap_t *, int); - int pcap_get_tstamp_precision(pcap_t *); - int pcap_activate(pcap_t *); +@@ -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 -@@ -109,6 +109,7 @@ struct pcap_opt { - char *source; +@@ -111,6 +111,7 @@ struct pcap_opt { + char *device; int timeout; /* timeout for buffering */ - int buffer_size; -+ int proto; /* protocol for packet socket (linux) */ + 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/203-undef_iw_mode_monitor.patch b/package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch index f847a5e754..53dd50137b 100644 --- a/package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch +++ b/package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch @@ -1,6 +1,6 @@ --- a/pcap-linux.c +++ b/pcap-linux.c -@@ -254,6 +254,8 @@ +@@ -263,6 +263,8 @@ typedef int socklen_t; #endif diff --git a/package/libs/libpcap/patches/204-usb-bus-path.patch b/package/libs/libpcap/patches/204-usb-bus-path.patch new file mode 100644 index 0000000000..d29734f0b6 --- /dev/null +++ b/package/libs/libpcap/patches/204-usb-bus-path.patch @@ -0,0 +1,13 @@ +Fix USB bus path; /proc/bus/usb is deprecated. + +--- a/pcap-usb-linux.c ++++ b/pcap-usb-linux.c +@@ -71,7 +71,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" +-#define PROC_USB_BUS_DIR "/proc/bus/usb" ++#define PROC_USB_BUS_DIR "/dev/bus/usb" + #define USB_LINE_LEN 4096 + + #if __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/package/libs/libreadline/Makefile b/package/libs/libreadline/Makefile index 5b0ca8314d..3c1b048fe8 100644 --- a/package/libs/libreadline/Makefile +++ b/package/libs/libreadline/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/readline -PKG_MD5SUM:=750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334 +PKG_HASH:=750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334 PKG_LICENSE:=GPL-3.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/libroxml/Makefile b/package/libs/libroxml/Makefile index dcbe610490..60d61716de 100644 --- a/package/libs/libroxml/Makefile +++ b/package/libs/libroxml/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://download.libroxml.net/pool/v2.x -PKG_MD5SUM:=a975f91be150f7a19168a45ce15769ca +PKG_HASH:=1da8f20b530eba4409f2b217587d2f1281ff5d9ba45b24aeac71b94c6c621b78 PKG_MAINTAINER:=Felix Fietkau PKG_INSTALL:=1 diff --git a/package/libs/librpc/Makefile b/package/libs/librpc/Makefile index b3dcd47c89..0330614c31 100644 --- a/package/libs/librpc/Makefile +++ b/package/libs/librpc/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=librpc -PKG_VERSION:=2015-11-04 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/librpc-uclibc.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2015-11-04 PKG_SOURCE_VERSION:=a921e3ded051746f9f7cd5e5a312fb6771716aac -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=d8da52536d34c6116ac8c261cbfc5999ae48b88e304ebf24a8cb14a43e53a3d9 +PKG_MIRROR_HASH:=22c8dc55e1c4e8e31635a37708a3ce622a6ca33ebd918a4321b0be6ffce89b21 CMAKE_INSTALL:=1 PKG_USE_MIPS16:=0 diff --git a/package/libs/libtool/Makefile b/package/libs/libtool/Makefile index 47b8907c23..2d5cedf786 100644 --- a/package/libs/libtool/Makefile +++ b/package/libs/libtool/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/libtool -PKG_MD5SUM:=afcce660d3dc54c63a0a5ba3cf05272239dc3c54bbeba20f6bad250f9dc007ae +PKG_HASH:=afcce660d3dc54c63a0a5ba3cf05272239dc3c54bbeba20f6bad250f9dc007ae PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING @@ -22,7 +22,7 @@ PKG_BUILD_PARALLEL:=0 include $(INCLUDE_DIR)/package.mk -CONFIGURE_PREFIX=$(STAGING_DIR)/host +CONFIGURE_PREFIX=$(STAGING_DIR_HOSTPKG) export GLOBAL_LIBDIR=$(STAGING_DIR)/usr/lib define Package/libltdl diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 4fe875184d..38dce1a714 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libubox -PKG_VERSION:=2016-11-29 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/libubox.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-11-29 PKG_SOURCE_VERSION:=77a629375d7387a33a59509d9d751a8798134cab -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=686a0078da3ada68fc9d39f62df07be52589afce79969ec4039f38f85ccedd3c +PKG_MIRROR_HASH:=b11c24d45cdf5a1909f0f97d185c3e1ba49602561a8cf3ad18f594ca0eaf4a64 CMAKE_INSTALL:=1 PKG_LICENSE:=ISC diff --git a/package/libs/libunwind/Makefile b/package/libs/libunwind/Makefile index 6cec8a7345..7d51f7487d 100644 --- a/package/libs/libunwind/Makefile +++ b/package/libs/libunwind/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME) -PKG_MD5SUM:=fb4ea2f6fbbe45bf032cd36e586883ce +PKG_HASH:=9dfe0fcae2a866de9d3942c66995e4b460230446887dbdab302d41a8aee8d09a PKG_FIXUP:=autoreconf PKG_INSTALL:=1 diff --git a/package/libs/libusb-compat/Makefile b/package/libs/libusb-compat/Makefile index fe92c3fd6d..59c5a80bd0 100644 --- a/package/libs/libusb-compat/Makefile +++ b/package/libs/libusb-compat/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/libusb -PKG_MD5SUM:=2ca521fffadd0c28fdf174e6ec73865b +PKG_HASH:=ed5bdd160c7b01ef767fb931a81b454f46226d1e2cf58502ced758d3e5a9fdc4 PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/libusb/Makefile b/package/libs/libusb/Makefile index 1b1edeef37..2d1d9c2b50 100644 --- a/package/libs/libusb/Makefile +++ b/package/libs/libusb/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libusb -PKG_VERSION:=1.0.20 +PKG_VERSION:=1.0.21 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/$(PKG_NAME) -PKG_MD5SUM:=1d4eb194eaaa2bcfbba28102768c7dbf +PKG_HASH:=7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=0 diff --git a/package/libs/lzo/Makefile b/package/libs/lzo/Makefile index d4e5e72bb5..e939616101 100644 --- a/package/libs/lzo/Makefile +++ b/package/libs/lzo/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/lzo/download/ -PKG_MD5SUM:=c7ffc9a103afe2d1bba0b015e7aa887f +PKG_HASH:=f294a7ced313063c057c504257f437c8335c41bfeed23531ee4e6a2b87bcb34c PKG_FIXUP:=autoreconf PKG_INSTALL:=1 diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 7b5096715d..990aabe066 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls PKG_VERSION:=2.4.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_USE_MIPS16:=0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz PKG_SOURCE_URL:=https://tls.mbed.org/download/ -PKG_MD5SUM:=80eff0e0028f969355d6e34ffdd3dbf4eb2a9367b07ff2f3f70e6d75beee9e3f +PKG_HASH:=80eff0e0028f969355d6e34ffdd3dbf4eb2a9367b07ff2f3f70e6d75beee9e3f PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/mbedtls/patches/200-config.patch b/package/libs/mbedtls/patches/200-config.patch index 8a3531f858..96d7c156a7 100644 --- a/package/libs/mbedtls/patches/200-config.patch +++ b/package/libs/mbedtls/patches/200-config.patch @@ -9,16 +9,7 @@ /* \} name SECTION: System support */ -@@ -347,7 +347,7 @@ - * - * Enable Cipher Feedback mode (CFB) for symmetric ciphers. - */ --#define MBEDTLS_CIPHER_MODE_CFB -+//#define MBEDTLS_CIPHER_MODE_CFB - - /** - * \def MBEDTLS_CIPHER_MODE_CTR -@@ -441,13 +441,13 @@ +@@ -441,17 +441,17 @@ * * Comment macros to disable the curve and functions for it */ @@ -28,14 +19,32 @@ +//#define MBEDTLS_ECP_DP_SECP224R1_ENABLED #define MBEDTLS_ECP_DP_SECP256R1_ENABLED #define MBEDTLS_ECP_DP_SECP384R1_ENABLED - #define MBEDTLS_ECP_DP_SECP521R1_ENABLED +-#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED ++//#define MBEDTLS_ECP_DP_SECP521R1_ENABLED +//#define MBEDTLS_ECP_DP_SECP192K1_ENABLED +//#define MBEDTLS_ECP_DP_SECP224K1_ENABLED #define MBEDTLS_ECP_DP_SECP256K1_ENABLED - #define MBEDTLS_ECP_DP_BP256R1_ENABLED - #define MBEDTLS_ECP_DP_BP384R1_ENABLED +-#define MBEDTLS_ECP_DP_BP256R1_ENABLED +-#define MBEDTLS_ECP_DP_BP384R1_ENABLED +-#define MBEDTLS_ECP_DP_BP512R1_ENABLED ++//#define MBEDTLS_ECP_DP_BP256R1_ENABLED ++//#define MBEDTLS_ECP_DP_BP384R1_ENABLED ++//#define MBEDTLS_ECP_DP_BP512R1_ENABLED + #define MBEDTLS_ECP_DP_CURVE25519_ENABLED + + /** +@@ -476,8 +476,8 @@ + * Requires: MBEDTLS_HMAC_DRBG_C + * + * Comment this macro to disable deterministic ECDSA. +- */ + #define MBEDTLS_ECDSA_DETERMINISTIC ++ */ + + /** + * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED @@ -523,7 +523,7 @@ * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA * MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA @@ -45,6 +54,16 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED +@@ -542,8 +542,8 @@ + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA +- */ + #define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ++ */ + + /** + * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED @@ -568,7 +568,7 @@ * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA @@ -54,15 +73,6 @@ /** * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -@@ -622,7 +622,7 @@ - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - */ --#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED -+//#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED - - /** - * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED @@ -695,7 +695,7 @@ * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 @@ -81,15 +91,15 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED -@@ -885,7 +885,7 @@ - * - * Comment this macro to disable support for external private RSA keys. +@@ -823,7 +823,7 @@ + * This option is only useful if both MBEDTLS_SHA256_C and + * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. */ --#define MBEDTLS_PK_RSA_ALT_SUPPORT -+//#define MBEDTLS_PK_RSA_ALT_SUPPORT +-//#define MBEDTLS_ENTROPY_FORCE_SHA256 ++#define MBEDTLS_ENTROPY_FORCE_SHA256 /** - * \def MBEDTLS_PKCS1_V15 + * \def MBEDTLS_ENTROPY_NV_SEED @@ -917,14 +917,14 @@ * Uncomment this macro to disable the use of CRT in RSA. * @@ -116,6 +126,26 @@ /** * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES +@@ -1059,8 +1059,8 @@ + * misuse/misunderstand. + * + * Comment this to disable support for renegotiation. +- */ + #define MBEDTLS_SSL_RENEGOTIATION ++ */ + + /** + * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO +@@ -1234,8 +1234,8 @@ + * callbacks are provided by MBEDTLS_SSL_TICKET_C. + * + * Comment this macro to disable support for SSL session tickets +- */ + #define MBEDTLS_SSL_SESSION_TICKETS ++ */ + + /** + * \def MBEDTLS_SSL_EXPORT_KEYS @@ -1265,7 +1265,7 @@ * * Comment this macro to disable support for truncated HMAC in SSL @@ -125,24 +155,16 @@ /** * \def MBEDTLS_THREADING_ALT -@@ -1501,7 +1501,7 @@ - * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA - * MBEDTLS_TLS_PSK_WITH_RC4_128_SHA - */ --#define MBEDTLS_ARC4_C -+//#define MBEDTLS_ARC4_C - - /** - * \def MBEDTLS_ASN1_PARSE_C -@@ -1566,7 +1566,7 @@ +@@ -1299,8 +1299,8 @@ + * Requires: MBEDTLS_VERSION_C * - * Module: library/blowfish.c - */ --#define MBEDTLS_BLOWFISH_C -+//#define MBEDTLS_BLOWFISH_C + * Comment this to disable run-time checking and save ROM space +- */ + #define MBEDTLS_VERSION_FEATURES ++ */ /** - * \def MBEDTLS_CAMELLIA_C + * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 @@ -1621,7 +1621,7 @@ * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 @@ -179,15 +201,26 @@ /** * \def MBEDTLS_DES_C -@@ -1740,7 +1740,7 @@ - * This module is used by the following key exchanges: - * DHE-RSA, DHE-PSK - */ --#define MBEDTLS_DHM_C -+//#define MBEDTLS_DHM_C +@@ -1725,8 +1725,8 @@ + * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA + * + * PEM_PARSE uses DES/3DES for decrypting encrypted keys. +- */ + #define MBEDTLS_DES_C ++ */ /** - * \def MBEDTLS_ECDH_C + * \def MBEDTLS_DHM_C +@@ -1880,8 +1880,8 @@ + * Requires: MBEDTLS_MD_C + * + * Uncomment to enable the HMAC_DRBG random number geerator. +- */ + #define MBEDTLS_HMAC_DRBG_C ++ */ + + /** + * \def MBEDTLS_MD_C @@ -2158,7 +2158,7 @@ * Caller: library/mbedtls_md.c * @@ -197,6 +230,36 @@ /** * \def MBEDTLS_RSA_C +@@ -2235,8 +2235,8 @@ + * Caller: + * + * Requires: MBEDTLS_SSL_CACHE_C +- */ + #define MBEDTLS_SSL_CACHE_C ++ */ + + /** + * \def MBEDTLS_SSL_COOKIE_C +@@ -2257,8 +2257,8 @@ + * Caller: + * + * Requires: MBEDTLS_CIPHER_C +- */ + #define MBEDTLS_SSL_TICKET_C ++ */ + + /** + * \def MBEDTLS_SSL_CLI_C +@@ -2357,8 +2357,8 @@ + * Module: library/version.c + * + * This module provides run-time version information. +- */ + #define MBEDTLS_VERSION_C ++ */ + + /** + * \def MBEDTLS_X509_USE_C @@ -2468,7 +2468,7 @@ * Module: library/xtea.c * Caller: diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index 3d869ea18a..88a31e299b 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses -PKG_VERSION:=5.9 -PKG_RELEASE:=4 +PKG_VERSION:=6.0 +PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/ncurses -PKG_MD5SUM:=8cb9c412e5f2d96bc6f459aa8c6282a1 +PKG_HASH:=f551c24b30ce8bfb6e96d9f59b42fbea30fa3a6123384172f9e7284bcf647260 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=README @@ -34,13 +34,14 @@ define Package/terminfo URL:=http://www.gnu.org/software/ncurses/ endef -define Package/libncursesw +define Package/libncurses SECTION:=libs CATEGORY:=Libraries TITLE:=Terminal handling library (Unicode) URL:=http://www.gnu.org/software/ncurses/ - PROVIDES:=libncurses + PROVIDES:=libncursesw DEPENDS:= +terminfo + ABI_VERSION:=$(PKG_VERSION) endef TARGET_CFLAGS += $(FPIC) @@ -63,6 +64,7 @@ CONFIGURE_ARGS += \ --with-shared \ --with-terminfo-dirs=/usr/share/terminfo \ --with-default-terminfo-dir=/usr/share/terminfo \ + --with-pkg-config-libdir=/usr/lib/pkgconfig \ --enable-widec \ --with-build-cppflags=-D_GNU_SOURCE @@ -114,7 +116,7 @@ ifneq ($(HOST_OS),FreeBSD) endif endef -define Package/libncursesw/install +define Package/libncurses/install $(INSTALL_DIR) $(1)/usr/lib for lib in ncurses panel menu form; do \ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$$$${lib}w.so* $(1)/usr/lib/; \ @@ -130,10 +132,10 @@ define Build/InstallDev ln -s . $(1)/usr/include/ncursesw $(TARGET_CROSS)ar rc $(1)/usr/lib/libtinfo.a $(INSTALL_DIR) $(2)/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw5-config $(2)/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw6-config $(2)/bin/ $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \ - $(2)/bin/ncursesw5-config - ln -sf $(STAGING_DIR)/host/bin/ncursesw5-config $(1)/usr/bin/ncursesw5-config + $(2)/bin/ncursesw6-config + ln -sf $(STAGING_DIR_HOSTPKG)/bin/ncursesw6-config $(1)/usr/bin/ncursesw6-config endef define Host/Compile @@ -147,4 +149,4 @@ endef $(eval $(call HostBuild)) $(eval $(call BuildPackage,terminfo)) -$(eval $(call BuildPackage,libncursesw)) +$(eval $(call BuildPackage,libncurses)) diff --git a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch index 20a6b43c15..49537b94ee 100644 --- a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch +++ b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch @@ -1,7 +1,7 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -4208,6 +4208,172 @@ rxvt-cygwin-native|rxvt terminal emulato - rxvt-16color|xterm with 16 colors like aixterm, +@@ -5214,6 +5214,172 @@ rxvt-cygwin-native|rxvt terminal emulato + rxvt-16color|rxvt with 16 colors like aixterm, ncv#32, use=ibm+16color, use=rxvt, +# rxvt-unicode @@ -170,6 +170,6 @@ + fsl=\007, + dsl=\E]2;\007, + + #### MRXVT # mrxvt 0.5.4 # - # mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which diff --git a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch index 779fa44bd2..394b6f9fde 100644 --- a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch +++ b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch @@ -1,14 +1,14 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -3274,6 +3274,7 @@ xterm-xfree86|xterm terminal emulator (X +@@ -3955,6 +3955,7 @@ xterm-xfree86|xterm terminal emulator (X # This version reflects the current xterm features. xterm-new|modern xterm terminal emulator, npc, + kbs=\177, - indn=\E[%p1%dS, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, - kIC=\E[2;2~, kNXT=\E[6;2~, kPRV=\E[5;2~, kb2=\EOE, - kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, -@@ -4061,6 +4062,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 + indn=\E[%p1%dS, kb2=\EOE, kcbt=\E[Z, kent=\EOM, + rin=\E[%p1%dT, use=xterm+pcfkeys, use=xterm+tmux, + use=xterm-basic, +@@ -5048,6 +5049,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 rxvt-basic|rxvt terminal base (X Window System), OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, cols#80, it#8, lines#24, @@ -16,7 +16,7 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, -@@ -4071,7 +4073,7 @@ rxvt-basic|rxvt terminal base (X Window +@@ -5058,7 +5060,7 @@ rxvt-basic|rxvt terminal base (X Window enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, @@ -25,7 +25,7 @@ kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, -@@ -4840,6 +4842,7 @@ eterm-color|Emacs term.el terminal emula +@@ -6118,6 +6120,7 @@ eterm-color|Emacs term.el terminal emula screen|VT 100/ANSI X3.64 virtual terminal, OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, @@ -33,16 +33,16 @@ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M, -@@ -4849,7 +4852,7 @@ screen|VT 100/ANSI X3.64 virtual termina - cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, - flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, -- il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcbt=\E[Z, -+ il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kcbt=\E[Z, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, +@@ -6128,7 +6131,7 @@ screen|VT 100/ANSI X3.64 virtual termina + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\Eg, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, +- kbs=^H, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, ++ kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -@@ -4955,6 +4958,7 @@ screen.xterm-r6|screen customized for X1 + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, +@@ -6252,6 +6255,7 @@ screen.xterm-r6|screen customized for X1 # on Solaris because Sun's curses implementation gets confused. screen.teraterm|disable ncv in teraterm, ncv#127, diff --git a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch index 5e33492bf5..0424b23781 100644 --- a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch +++ b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch @@ -15,7 +15,7 @@ Subject: [PATCH] ncurses 5.9 - patch 20141206 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh -@@ -437,11 +437,22 @@ sed -n -f $ED1 \ +@@ -491,11 +491,22 @@ sed -n -f $ED1 \ -e 's/gen_$//' \ -e 's/ / /g' >>$TMP diff --git a/package/libs/ncurses/patches/103-fixup-pkg-config-handling.patch b/package/libs/ncurses/patches/103-fixup-pkg-config-handling.patch deleted file mode 100644 index 85b2296ce4..0000000000 --- a/package/libs/ncurses/patches/103-fixup-pkg-config-handling.patch +++ /dev/null @@ -1,85 +0,0 @@ -Change handling of PKG_CONFIG_LIBDIR - -When PKG_CONFIG_LIBDIR was unset in the environment, the configure -script was deducing the PKG_CONFIG_LIBDIR from the location of the -pkg-config binary, which doesn't make a lot of sense, and isn't done -by other autotools based packages. - -Also, the configure script was checking that the directory really -exists. This forced to create the directory *and* provide an absolute -path in PKG_CONFIG_LIBDIR, which didn't play well with the fact that -at installation time, PKG_CONFIG_LIBDIR is suffixed to DESTDIR, which -means that we got two times the staging directory location. - -This patch fixes both of those issues. Also, since ncurses uses a fork -of autoconf 2.13, we can't simply use _AUTORECONF=YES, so we also fix -the configure script in this patch. - -Signed-off-by: Thomas Petazzoni - ---- a/configure -+++ b/configure -@@ -3623,27 +3623,20 @@ echo $ECHO_N "checking if we should inst - - # Leave this as something that can be overridden in the environment. - if test -z "$PKG_CONFIG_LIBDIR" ; then -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`/lib/pkgconfig -+ PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig" - fi -+ - PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'` -- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then - --# Check whether --enable-pc-files or --disable-pc-files was given. --if test "${enable_pc_files+set}" = set; then -- enableval="$enable_pc_files" -- enable_pc_files=$enableval --else -- enable_pc_files=no --fi; -- echo "$as_me:3638: result: $enable_pc_files" >&5 --echo "${ECHO_T}$enable_pc_files" >&6 -+ # Check whether --enable-pc-files or --disable-pc-files was given. -+ if test "${enable_pc_files+set}" = set; then -+ enableval="$enable_pc_files" -+ enable_pc_files=$enableval - else -- echo "$as_me:3641: result: no" >&5 --echo "${ECHO_T}no" >&6 -- { echo "$as_me:3643: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&5 --echo "$as_me: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&2;} -- enable_pc_files=no -- fi -+ enable_pc_files=no -+ fi; -+ echo "$as_me:3638: result: $enable_pc_files" >&5 -+ echo "${ECHO_T}$enable_pc_files" >&6 - fi - - echo "$as_me:3649: checking if we should assume mixed-case filenames" >&5 ---- a/configure.in -+++ b/configure.in -@@ -174,20 +174,14 @@ if test "$PKG_CONFIG" != no ; then - - # Leave this as something that can be overridden in the environment. - if test -z "$PKG_CONFIG_LIBDIR" ; then -- PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`/lib/pkgconfig -+ PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig" - fi - PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'` -- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then -- AC_ARG_ENABLE(pc-files, -+ AC_ARG_ENABLE(pc-files, - [ --enable-pc-files generate and install .pc files for pkg-config], - [enable_pc_files=$enableval], - [enable_pc_files=no]) -- AC_MSG_RESULT($enable_pc_files) -- else -- AC_MSG_RESULT(no) -- AC_MSG_WARN(did not find library $PKG_CONFIG_LIBDIR) -- enable_pc_files=no -- fi -+ AC_MSG_RESULT($enable_pc_files) - fi - AC_SUBST(PKG_CONFIG_LIBDIR) - diff --git a/package/libs/ncurses/patches/500-cross.patch b/package/libs/ncurses/patches/500-cross.patch index 976a3cba2a..590bddf68c 100644 --- a/package/libs/ncurses/patches/500-cross.patch +++ b/package/libs/ncurses/patches/500-cross.patch @@ -1,11 +1,11 @@ --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -5137,7 +5137,7 @@ CF_EOF - EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS" +@@ -5720,7 +5720,7 @@ CF_EOF + EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" fi CF_SHARED_SONAME - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname',-stats,$(LDFLAGS) -lc -o $[@]' ;; - openbsd[[2-9]].*) #(vi - if test "$DFT_LWR_MODEL" = "shared" ; then + (mingw*) + cf_cv_shlib_version=mingw diff --git a/package/libs/ncurses/patches/900-terminfo.patch b/package/libs/ncurses/patches/900-terminfo.patch index 487a341ba9..ab623b1973 100644 --- a/package/libs/ncurses/patches/900-terminfo.patch +++ b/package/libs/ncurses/patches/900-terminfo.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -3947,12 +3947,11 @@ konsole-xf3x|KDE console window with key +@@ -4919,12 +4919,11 @@ konsole-xf3x|KDE console window with key # The value for kbs reflects local customization rather than the settings used # for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile index 5a8c3b12eb..172b5b2563 100644 --- a/package/libs/nettle/Makefile +++ b/package/libs/nettle/Makefile @@ -14,7 +14,7 @@ PKG_USE_MIPS16:=0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/nettle -PKG_MD5SUM:=46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e +PKG_HASH:=46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index a09c148f7b..0d69d705c9 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -23,7 +23,7 @@ PKG_SOURCE_URL:=http://www.openssl.org/source/ \ http://www.openssl.org/source/old/$(PKG_BASE)/ \ ftp://ftp.funet.fi/pub/crypt/mirrors/ftp.openssl.org/source \ ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/ -PKG_MD5SUM:=e7aff292be21c259c6af26469c7a9b3ba26e9abaaffd325e3dccc9785256c431 +PKG_HASH:=e7aff292be21c259c6af26469c7a9b3ba26e9abaaffd325e3dccc9785256c431 PKG_LICENSE:=OpenSSL PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/polarssl/Makefile b/package/libs/polarssl/Makefile index 52c91dcca6..04a7107a95 100644 --- a/package/libs/polarssl/Makefile +++ b/package/libs/polarssl/Makefile @@ -15,7 +15,7 @@ PKG_USE_MIPS16:=0 PKG_SOURCE:=$(SRC_PKG_NAME)-$(PKG_VERSION)-gpl.tgz PKG_SOURCE_URL:=https://tls.mbed.org/download/ -PKG_MD5SUM:=a229217182e024847deba3cb70bdd17e5ff4ffd9ff306cbbccfdbdff41950ea1 +PKG_HASH:=a229217182e024847deba3cb70bdd17e5ff4ffd9ff306cbbccfdbdff41950ea1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(SRC_PKG_NAME)-$(PKG_VERSION) diff --git a/package/libs/popt/Makefile b/package/libs/popt/Makefile index 598f0778b6..7bd765f7d3 100644 --- a/package/libs/popt/Makefile +++ b/package/libs/popt/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://rpm5.org/files/popt/ -PKG_MD5SUM:=3743beefa3dd6247a73f8f7a32c14c33 +PKG_HASH:=e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8 PKG_LICENSE:=MIT PKG_FIXUP:=autoreconf diff --git a/package/libs/sysfsutils/Makefile b/package/libs/sysfsutils/Makefile index 67b43868ec..6265442ea8 100644 --- a/package/libs/sysfsutils/Makefile +++ b/package/libs/sysfsutils/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/linux-diag -PKG_MD5SUM:=14e7dcd0436d2f49aa403f67e1ef7ddc +PKG_HASH:=e865de2c1f559fff0d3fc936e660c0efaf7afe662064f2fb97ccad1ec28d208a PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=LGPL-2.1 diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile index c386550292..7133a7ef33 100644 --- a/package/libs/uclibc++/Makefile +++ b/package/libs/uclibc++/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=3 PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://cxx.uclibc.org/src/ -PKG_MD5SUM:=394c119363dd8b469fb898442a6764b8 +PKG_HASH:=be16fc6a6eb2e59df420ee41e7042f38e27ebaf5c2762d90e75803364a7b00db PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/uclient/Makefile b/package/libs/uclient/Makefile index d3af9e1c29..1fa089aee1 100644 --- a/package/libs/uclient/Makefile +++ b/package/libs/uclient/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uclient -PKG_VERSION:=2016-07-30 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/uclient.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=ccb314db2e99463de15eed9d7626360d82aec4d2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=8cbe8e34bbbd849b46b18f41629b8b3548d1eb3d2517fb473b7068c7b1fbe6da +PKG_SOURCE_DATE:=2016-12-09 +PKG_SOURCE_VERSION:=52d955fd802a4d990b7ff9116f02ff52aa63ffec +PKG_MIRROR_HASH:=b96f53ccaa62a229e818be836bb4fc85aa4a1ce257fd41fbdbf4e31a959c641f CMAKE_INSTALL:=1 PKG_BUILD_DEPENDS:=ustream-ssl diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index ba022b8fc7..ff6c4b7d01 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -1,18 +1,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ustream-ssl -PKG_VERSION:=2016-07-02 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/ustream-ssl.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-07-02 PKG_SOURCE_VERSION:=ec80adaa1b47f28d426fa19c692011ce60b992d6 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=701f8728b90d4fc141ca086bbd7802cfae42aaa64ace83debb8c27111b921a34 +PKG_MIRROR_HASH:=bfbad6b4e8c1e933f0bfaab43cbdd44a536c08128c3a779e6f2395a6a886aab7 CMAKE_INSTALL:=1 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) PKG_LICENSE:=ISC PKG_LICENSE_FILES:= @@ -44,14 +42,6 @@ define Package/libustream-cyassl VARIANT:=cyassl endef -define Package/libustream-polarssl - $(Package/libustream/default) - TITLE += (polarssl) - DEPENDS += +libpolarssl - VARIANT:=polarssl - DEFAULT_VARIANT:=1 -endef - define Package/libustream-mbedtls $(Package/libustream/default) TITLE += (mbedtls) @@ -64,9 +54,6 @@ ifeq ($(BUILD_VARIANT),cyassl) TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/cyassl -DHAVE_SNI CMAKE_OPTIONS += -DCYASSL=on endif -ifeq ($(BUILD_VARIANT),polarssl) - CMAKE_OPTIONS += -DPOLARSSL=on -endif ifeq ($(BUILD_VARIANT),mbedtls) CMAKE_OPTIONS += -DMBEDTLS=on endif @@ -78,10 +65,8 @@ endef Package/libustream-openssl/install = $(Package/libustream/default/install) Package/libustream-cyassl/install = $(Package/libustream/default/install) -Package/libustream-polarssl/install = $(Package/libustream/default/install) Package/libustream-mbedtls/install = $(Package/libustream/default/install) -$(eval $(call BuildPackage,libustream-polarssl)) $(eval $(call BuildPackage,libustream-mbedtls)) $(eval $(call BuildPackage,libustream-cyassl)) $(eval $(call BuildPackage,libustream-openssl)) diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile index 5993cbc29e..d6155b6d4e 100644 --- a/package/libs/zlib/Makefile +++ b/package/libs/zlib/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zlib -PKG_VERSION:=1.2.8 +PKG_VERSION:=1.2.10 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://www.zlib.net @SF/libpng -PKG_MD5SUM:=44d667c142d7cda120332623eab69f40 +PKG_HASH:=9612bf086047078ce3a1c154fc9052113fc1a2a97234a059da17a6299bd4dd32 PKG_LICENSE:=Zlib PKG_LICENSE_FILES:=README diff --git a/package/luci/.buildpath b/package/luci/.buildpath new file mode 100644 index 0000000000..81fa6469ec --- /dev/null +++ b/package/luci/.buildpath @@ -0,0 +1,5 @@ + + + + + diff --git a/package/luci/.cproject b/package/luci/.cproject new file mode 100644 index 0000000000..e1a4774106 --- /dev/null +++ b/package/luci/.cproject @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package/luci/.gitignore b/package/luci/.gitignore new file mode 100644 index 0000000000..07494e98ef --- /dev/null +++ b/package/luci/.gitignore @@ -0,0 +1,8 @@ +dist/ +/host +*.o +*.so +*.swp +*.po~ +/docs +modules/luci-base/src/po2lmo diff --git a/package/luci/.project b/package/luci/.project new file mode 100644 index 0000000000..11b398b269 --- /dev/null +++ b/package/luci/.project @@ -0,0 +1,78 @@ + + + luci + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.cnature + org.eclipse.dltk.lua.core.nature + + diff --git a/package/luci/README.md b/package/luci/README.md new file mode 100644 index 0000000000..48863a4591 --- /dev/null +++ b/package/luci/README.md @@ -0,0 +1,34 @@ +# OpenWrt luci feed + +## Description + +This is the OpenWrt "luci"-feed containing LuCI - OpenWrt Configuration Interface. + +## Usage + +This feed is enabled by default. Your feeds.conf.default (or feeds.conf) should contain a line like: +``` +src-git luci https://github.com/openwrt/luci.git +``` + +To install all its package definitions, run: +``` +./scripts/feeds update luci +./scripts/feeds install -a -p luci +``` + +## API Reference + +You can browse the generated API documentation [directly on Github](http://htmlpreview.github.io/?http://raw.githubusercontent.com/openwrt/luci/master/documentation/api/index.html). + +## Development + +Documentation for developing and extending LuCI can be found [in the Wiki](https://github.com/openwrt/luci/wiki) + +## License + +See [LICENSE](LICENSE) file. + +## Package Guidelines + +See [CONTRIBUTING.md](CONTRIBUTING.md) file. diff --git a/package/luci/applications/luci-app-adblock/luasrc/model/cbi/adblock.lua b/package/luci/applications/luci-app-adblock/luasrc/model/cbi/adblock.lua index 2cee302086..d80cb486e3 100644 --- a/package/luci/applications/luci-app-adblock/luasrc/model/cbi/adblock.lua +++ b/package/luci/applications/luci-app-adblock/luasrc/model/cbi/adblock.lua @@ -1,4 +1,4 @@ --- Copyright 2016 Openwrt.org +-- Copyright 2016 Hannu Nyman -- Licensed to the public under the Apache License 2.0. m = Map("adblock", translate("Adblock"), @@ -17,20 +17,6 @@ o3 = s:option(Value, "adb_whitelist", translate("Whitelist file"), o3.rmempty = false o3.datatype = "file" -fdns = s:option(Flag, "adb_forcedns", translate("Redirect all DNS queries to the local resolver"), - translate("When adblock is active, all DNS queries are redirected to the local resolver " .. - "in this server by default. You can disable that to allow queries to external DNS servers.")) -fdns.rmempty = false -fdns.default = fdns.enabled - --- Statistics - -t = m:section(NamedSection, "global", "adblock", translate("Statistics")) - -dat = t:option(DummyValue, "adb_lastrun", translate("Last update of the blocklists")) -tot = t:option(DummyValue, "adb_overall_count", translate("Total count of blocked domains")) -prc = t:option(DummyValue, "adb_percentage", translate("Percentage of blocked packets (before last update, IPv4/IPv6)")) - -- Blocklist options bl = m:section(TypedSection, "source", translate("Blocklist sources"), @@ -45,8 +31,6 @@ name = bl:option(Flag, "enabled", translate("Enabled")) name.rmempty = false des = bl:option(DummyValue, "adb_src_desc", translate("Description")) -cou = bl:option(DummyValue, "adb_src_count", translate("Count")) -upd = bl:option(DummyValue, "adb_src_timestamp", translate("List date/state")) -- Additional options @@ -65,39 +49,15 @@ o5.datatype = "directory" e = m:section(NamedSection, "global", "adblock", translate("Extra options"), translate("Options for further tweaking in case the defaults are not suitable for you.")) -a0 = e:option(Flag, "adb_restricted", translate("Do not write status info to flash"), - translate("Skip writing update status information to the config file. Status fields on this page will not be updated.")) -a0.default = 0 - -a1 = e:option(Value, "adb_nullport", translate("Port of the adblock uhttpd instance")) -a1.optional = true -a1.default = 65534 -a1.datatype = "port" - -a5 = e:option(Value, "adb_nullportssl", translate("Port of the adblock uhttpd instance for https links")) -a5.optional = true -a5.default = 65535 -a5.datatype = "port" - -a2 = e:option(Value, "adb_nullipv4", translate("IPv4 blackhole ip address")) -a2.optional = true -a2.default = "198.18.0.1" -a2.datatype = "ip4addr" - -a3 = e:option(Value, "adb_nullipv6", translate("IPv6 blackhole ip address")) -a3.optional = true -a3.default = "::ffff:c612:0001" -a3.datatype = "ip6addr" - -a4 = e:option(Value, "adb_fetchttl", translate("Timeout for blocklist fetch (seconds)")) -a4.optional = true -a4.default = 5 -a4.datatype = "range(2,60)" - -a7 = e:option(Value, "adb_lanif", translate("Name of the logical lan interface")) -a7.optional = true -a7.default = "lan" -a7.datatype = "network" +a = e:option(Flag, "adb_debug", translate("Enable verbose debug logging")) +a.default = a.disabled +a.rmempty = false + +a = e:option(Value, "adb_iface", translate("Restrict reload trigger to certain interface(s)"), + translate("Space separated list of wan interfaces that trigger reload action. " .. + "To disable reload trigger set it to 'false'. Default: empty")) +a.datatype = "network" +a.rmempty = true return m diff --git a/package/luci/applications/luci-app-adblock/po/ja/adblock.po b/package/luci/applications/luci-app-adblock/po/ja/adblock.po index 72f1c7ac31..a3c982f3d1 100644 --- a/package/luci/applications/luci-app-adblock/po/ja/adblock.po +++ b/package/luci/applications/luci-app-adblock/po/ja/adblock.po @@ -4,11 +4,12 @@ msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: \n" "PO-Revision-Date: \n" -"Last-Translator: musashino205 \n" +"Last-Translator: INAGAKI Hiroshi \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.5.7\n" +"X-Generator: Poedit 1.8.11\n" +"Language: ja\n" msgid "" "). Note that list URLs and Shallalist category selections are not " @@ -37,21 +38,18 @@ msgid "" msgstr "" "広告/不正ドメインをDNSを利用してブロックする、adblock パッケージの設定です。" -msgid "Count" -msgstr "カウント" - msgid "Description" msgstr "説明" -msgid "Do not write status info to flash" -msgstr "ステータス情報をフラッシュに書き込まない" - msgid "Enable adblock" msgstr "adblockの有効化" msgid "Enable blocklist backup" msgstr "ブロックリスト バックアップの有効化" +msgid "Enable verbose debug logging" +msgstr "詳細なデバッグ ログの有効化" + msgid "Enabled" msgstr "有効" @@ -68,64 +66,74 @@ msgstr "" msgid "Global options" msgstr "一般設定" -msgid "IPv4 blackhole ip address" -msgstr "" +msgid "" +"Options for further tweaking in case the defaults are not suitable for you." +msgstr "デフォルト設定が適切でない場合、追加で設定するためのオプションです。" -msgid "IPv6 blackhole ip address" +msgid "Restrict reload trigger to certain interface(s)" +msgstr "リロードトリガを特定のインターフェースに限定する" + +msgid "" +"Space separated list of wan interfaces that trigger reload action. To " +"disable reload trigger set it to 'false'. Default: empty" msgstr "" +"リロード実行のトリガとなる、スペースで区切られたWANインターフェースのリストで" +"す。リロードトリガを無効にするには、 false を設定します。デフォルト:(空)" -msgid "Last update of the blocklists" -msgstr "ブロックリストの最終更新日時" +msgid "Whitelist file" +msgstr "ホワイトリスト ファイル" -msgid "List date/state" -msgstr "リスト日時/状態" +msgid "see list details" +msgstr "リストの詳細を見る" -msgid "Name of the logical lan interface" -msgstr "論理LANインターフェース名" +#~ msgid "Count" +#~ msgstr "カウント" -msgid "" -"Options for further tweaking in case the defaults are not suitable for you." -msgstr "デフォルト設定が適切でない場合、追加で設定するためのオプションです。" +#~ msgid "Do not write status info to flash" +#~ msgstr "ステータス情報をフラッシュに書き込まない" -msgid "Percentage of blocked packets (before last update, IPv4/IPv6)" -msgstr "ブロック済みパケットの割合(最終更新以前、IPv4/IPv6)" +#~ msgid "Last update of the blocklists" +#~ msgstr "ブロックリストの最終更新日時" -msgid "Port of the adblock uhttpd instance" -msgstr "adblock uhttpdインスタンスのポート" +#~ msgid "List date/state" +#~ msgstr "リスト日時/状態" -msgid "Port of the adblock uhttpd instance for https links" -msgstr "httpsリンク用adblock uhttpdインスタンスのポート" +#~ msgid "Name of the logical lan interface" +#~ msgstr "論理LANインターフェース名" -msgid "Redirect all DNS queries to the local resolver" -msgstr "全てのDNSクエリをローカルリゾルバにリダイレクト" +#~ msgid "Percentage of blocked packets (before last update, IPv4/IPv6)" +#~ msgstr "ブロック済みパケットの割合(最終更新以前、IPv4/IPv6)" -msgid "" -"Skip writing update status information to the config file. Status fields on " -"this page will not be updated." -msgstr "" -"更新ステータス情報をコンフィグファイルに書き込まず、スキップします。このペー" -"ジのステータス画面は更新されなくなります。" +#~ msgid "Port of the adblock uhttpd instance" +#~ msgstr "adblock uhttpdインスタンスのポート" -msgid "Statistics" -msgstr "ステータス" +#~ msgid "Port of the adblock uhttpd instance for https links" +#~ msgstr "httpsリンク用adblock uhttpdインスタンスのポート" -msgid "Timeout for blocklist fetch (seconds)" -msgstr "ブロックリスト取得の制限時間(秒)" +#~ msgid "Redirect all DNS queries to the local resolver" +#~ msgstr "全てのDNSクエリをローカルリゾルバにリダイレクト" -msgid "Total count of blocked domains" -msgstr "ブロック済みドメインの合計" +#~ msgid "" +#~ "Skip writing update status information to the config file. Status fields " +#~ "on this page will not be updated." +#~ msgstr "" +#~ "更新ステータス情報をコンフィグファイルに書き込まず、スキップします。この" +#~ "ページのステータス画面は更新されなくなります。" -msgid "" -"When adblock is active, all DNS queries are redirected to the local resolver " -"in this server by default. You can disable that to allow queries to external " -"DNS servers." -msgstr "" -"adblockがアクティブである時、全てのDNSクエリは既定でこのサーバー上のリゾルバ" -"にリダイレクトされます。外部DNSサーバーへのクエリを許可する場合、この設定を無" -"効にすることもできます。" +#~ msgid "Statistics" +#~ msgstr "ステータス" -msgid "Whitelist file" -msgstr "ホワイトリスト ファイル" +#~ msgid "Timeout for blocklist fetch (seconds)" +#~ msgstr "ブロックリスト取得の制限時間(秒)" -msgid "see list details" -msgstr "リストの詳細を見る" +#~ msgid "Total count of blocked domains" +#~ msgstr "ブロック済みドメインの合計" + +#~ msgid "" +#~ "When adblock is active, all DNS queries are redirected to the local " +#~ "resolver in this server by default. You can disable that to allow queries " +#~ "to external DNS servers." +#~ msgstr "" +#~ "adblockがアクティブである時、全てのDNSクエリは既定でこのサーバー上のリゾル" +#~ "バにリダイレクトされます。外部DNSサーバーへのクエリを許可する場合、この設" +#~ "定を無効にすることもできます。" diff --git a/package/luci/applications/luci-app-adblock/po/sv/adblock.po b/package/luci/applications/luci-app-adblock/po/sv/adblock.po index 9c0ca21f17..22a30e9a10 100644 --- a/package/luci/applications/luci-app-adblock/po/sv/adblock.po +++ b/package/luci/applications/luci-app-adblock/po/sv/adblock.po @@ -27,21 +27,18 @@ msgstr "" "Konfiguration av paket adblock för att blockera annons/otillåtna domäner " "genom att användning DNS." -msgid "Count" -msgstr "Räkna" - msgid "Description" msgstr "Beskrivning" -msgid "Do not write status info to flash" -msgstr "Skriv inte status info till flash" - msgid "Enable adblock" msgstr "Aktivera abblock" msgid "Enable blocklist backup" msgstr "Aktivera säkerhetskopiering av blockeringslistan" +msgid "Enable verbose debug logging" +msgstr "" + msgid "Enabled" msgstr "Aktiverad" @@ -56,55 +53,16 @@ msgstr "" msgid "Global options" msgstr "Globala alternativ" -msgid "IPv4 blackhole ip address" -msgstr "" - -msgid "IPv6 blackhole ip address" -msgstr "" - -msgid "Last update of the blocklists" -msgstr "" - -msgid "List date/state" -msgstr "" - -msgid "Name of the logical lan interface" -msgstr "" - msgid "" "Options for further tweaking in case the defaults are not suitable for you." msgstr "" -msgid "Percentage of blocked packets (before last update, IPv4/IPv6)" -msgstr "" - -msgid "Port of the adblock uhttpd instance" +msgid "Restrict reload trigger to certain interface(s)" msgstr "" -msgid "Port of the adblock uhttpd instance for https links" -msgstr "" - -msgid "Redirect all DNS queries to the local resolver" -msgstr "Dirigera om alla DNS-förfrågning till den lokala resolvern" - msgid "" -"Skip writing update status information to the config file. Status fields on " -"this page will not be updated." -msgstr "" - -msgid "Statistics" -msgstr "" - -msgid "Timeout for blocklist fetch (seconds)" -msgstr "" - -msgid "Total count of blocked domains" -msgstr "" - -msgid "" -"When adblock is active, all DNS queries are redirected to the local resolver " -"in this server by default. You can disable that to allow queries to external " -"DNS servers." +"Space separated list of wan interfaces that trigger reload action. To " +"disable reload trigger set it to 'false'. Default: empty" msgstr "" msgid "Whitelist file" @@ -112,3 +70,12 @@ msgstr "Vitlista fil" msgid "see list details" msgstr "se listans detaljer" + +#~ msgid "Count" +#~ msgstr "Räkna" + +#~ msgid "Do not write status info to flash" +#~ msgstr "Skriv inte status info till flash" + +#~ msgid "Redirect all DNS queries to the local resolver" +#~ msgstr "Dirigera om alla DNS-förfrågning till den lokala resolvern" diff --git a/package/luci/applications/luci-app-adblock/po/templates/adblock.pot b/package/luci/applications/luci-app-adblock/po/templates/adblock.pot index eeb0d975b9..6b2dbd13b3 100644 --- a/package/luci/applications/luci-app-adblock/po/templates/adblock.pot +++ b/package/luci/applications/luci-app-adblock/po/templates/adblock.pot @@ -25,21 +25,18 @@ msgid "" "Configuration of the adblock package to block ad/abuse domains by using DNS." msgstr "" -msgid "Count" -msgstr "" - msgid "Description" msgstr "" -msgid "Do not write status info to flash" -msgstr "" - msgid "Enable adblock" msgstr "" msgid "Enable blocklist backup" msgstr "" +msgid "Enable verbose debug logging" +msgstr "" + msgid "Enabled" msgstr "" @@ -54,55 +51,16 @@ msgstr "" msgid "Global options" msgstr "" -msgid "IPv4 blackhole ip address" -msgstr "" - -msgid "IPv6 blackhole ip address" -msgstr "" - -msgid "Last update of the blocklists" -msgstr "" - -msgid "List date/state" -msgstr "" - -msgid "Name of the logical lan interface" -msgstr "" - msgid "" "Options for further tweaking in case the defaults are not suitable for you." msgstr "" -msgid "Percentage of blocked packets (before last update, IPv4/IPv6)" -msgstr "" - -msgid "Port of the adblock uhttpd instance" -msgstr "" - -msgid "Port of the adblock uhttpd instance for https links" -msgstr "" - -msgid "Redirect all DNS queries to the local resolver" -msgstr "" - -msgid "" -"Skip writing update status information to the config file. Status fields on " -"this page will not be updated." -msgstr "" - -msgid "Statistics" -msgstr "" - -msgid "Timeout for blocklist fetch (seconds)" -msgstr "" - -msgid "Total count of blocked domains" +msgid "Restrict reload trigger to certain interface(s)" msgstr "" msgid "" -"When adblock is active, all DNS queries are redirected to the local resolver " -"in this server by default. You can disable that to allow queries to external " -"DNS servers." +"Space separated list of wan interfaces that trigger reload action. To " +"disable reload trigger set it to 'false'. Default: empty" msgstr "" msgid "Whitelist file" diff --git a/package/luci/applications/luci-app-adblock/po/zh-cn/adblock.po b/package/luci/applications/luci-app-adblock/po/zh-cn/adblock.po index e57921daa8..2878d8afaf 100644 --- a/package/luci/applications/luci-app-adblock/po/zh-cn/adblock.po +++ b/package/luci/applications/luci-app-adblock/po/zh-cn/adblock.po @@ -36,21 +36,18 @@ msgid "" "Configuration of the adblock package to block ad/abuse domains by using DNS." msgstr "Adblock 配置工具,通过 DNS 来拦截广告和阻止域名。" -msgid "Count" -msgstr "数量" - msgid "Description" msgstr "描述" -msgid "Do not write status info to flash" -msgstr "" - msgid "Enable adblock" msgstr "启用Adblock" msgid "Enable blocklist backup" msgstr "启用拦截规则备份" +msgid "Enable verbose debug logging" +msgstr "" + msgid "Enabled" msgstr "启用" @@ -65,61 +62,55 @@ msgstr "允许的主机/域名列表" msgid "Global options" msgstr "全局选项" -msgid "IPv4 blackhole ip address" -msgstr "IPv4禁止列表" - -msgid "IPv6 blackhole ip address" -msgstr "IPv6禁止列表" - -msgid "Last update of the blocklists" -msgstr "" - -msgid "List date/state" -msgstr "列表日期/状态" - -msgid "Name of the logical lan interface" -msgstr "LAN接口名称" - msgid "" "Options for further tweaking in case the defaults are not suitable for you." msgstr "在默认设置并不适合你时的额外选项。" -msgid "Percentage of blocked packets (before last update, IPv4/IPv6)" +msgid "Restrict reload trigger to certain interface(s)" msgstr "" -msgid "Port of the adblock uhttpd instance" -msgstr "Adblock uhttpd端口" - -msgid "Port of the adblock uhttpd instance for https links" +msgid "" +"Space separated list of wan interfaces that trigger reload action. To " +"disable reload trigger set it to 'false'. Default: empty" msgstr "" -msgid "Redirect all DNS queries to the local resolver" -msgstr "将所有DNS查询都重定向到本地解析器" +msgid "Whitelist file" +msgstr "白名单文件" + +msgid "see list details" +msgstr "查看列表详情" -msgid "" -"Skip writing update status information to the config file. Status fields on " -"this page will not be updated." -msgstr "" +#~ msgid "Count" +#~ msgstr "数量" -msgid "Statistics" -msgstr "" +#~ msgid "IPv4 blackhole ip address" +#~ msgstr "IPv4禁止列表" -msgid "Timeout for blocklist fetch (seconds)" -msgstr "列表查询超时时间(秒)" +#~ msgid "IPv6 blackhole ip address" +#~ msgstr "IPv6禁止列表" -msgid "Total count of blocked domains" -msgstr "阻止域名总数" +#~ msgid "List date/state" +#~ msgstr "列表日期/状态" -msgid "" -"When adblock is active, all DNS queries are redirected to the local resolver " -"in this server by default. You can disable that to allow queries to external " -"DNS servers." -msgstr "" -"当Adblock处于活动状态时,默认情况下会将所有的DNS查询重定向到此服务器的本地解" -"析器。您可以禁用以允许查询外部DNS服务器。" +#~ msgid "Name of the logical lan interface" +#~ msgstr "LAN接口名称" -msgid "Whitelist file" -msgstr "白名单文件" +#~ msgid "Port of the adblock uhttpd instance" +#~ msgstr "Adblock uhttpd端口" -msgid "see list details" -msgstr "查看列表详情" +#~ msgid "Redirect all DNS queries to the local resolver" +#~ msgstr "将所有DNS查询都重定向到本地解析器" + +#~ msgid "Timeout for blocklist fetch (seconds)" +#~ msgstr "列表查询超时时间(秒)" + +#~ msgid "Total count of blocked domains" +#~ msgstr "阻止域名总数" + +#~ msgid "" +#~ "When adblock is active, all DNS queries are redirected to the local " +#~ "resolver in this server by default. You can disable that to allow queries " +#~ "to external DNS servers." +#~ msgstr "" +#~ "当Adblock处于活动状态时,默认情况下会将所有的DNS查询重定向到此服务器的本地" +#~ "解析器。您可以禁用以允许查询外部DNS服务器。" diff --git a/package/luci/applications/luci-app-commands/po/ja/commands.po b/package/luci/applications/luci-app-commands/po/ja/commands.po index 3b01a35cfd..99b5a452e8 100644 --- a/package/luci/applications/luci-app-commands/po/ja/commands.po +++ b/package/luci/applications/luci-app-commands/po/ja/commands.po @@ -1,26 +1,27 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2013-10-05 17:15+0200\n" -"Last-Translator: Kentaro \n" +"Project-Id-Version: \n" +"PO-Revision-Date: 2016-12-21 11:59+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Pootle 2.0.6\n" +"X-Generator: Poedit 1.8.11\n" +"POT-Creation-Date: \n" msgid "A short textual description of the configured command" msgstr "設定したコマンドの簡単な説明文を記載します" msgid "Access command with" -msgstr "" +msgstr "コマンドへのアクセス" msgid "" "Allow executing the command and downloading its output without prior " "authentication" -msgstr "" +msgstr "事前認証無しでのコマンドの実行と、結果出力のダウンロードを許可します。" msgid "Allow the user to provide additional command line arguments" msgstr "コマンドラインに対する引数の追記を許可するか設定します" @@ -88,7 +89,9 @@ msgstr "実行" msgid "" "This page allows you to configure custom shell commands which can be easily " "invoked from the web interface." -msgstr "このページでは、ウェブインターフェースから簡単にシェル・コマンドを実行することができます。" +msgstr "" +"このページでは、ウェブインターフェースから簡単にシェル・コマンドを実行するこ" +"とができます。" msgid "Waiting for command to complete..." msgstr "コマンド実行中です..." diff --git a/package/luci/applications/luci-app-firewall/luasrc/model/cbi/firewall/custom.lua b/package/luci/applications/luci-app-firewall/luasrc/model/cbi/firewall/custom.lua index 968ac3624f..2b3cee3283 100644 --- a/package/luci/applications/luci-app-firewall/luasrc/model/cbi/firewall/custom.lua +++ b/package/luci/applications/luci-app-firewall/luasrc/model/cbi/firewall/custom.lua @@ -22,6 +22,10 @@ end function o.write(self, section, value) value = value:gsub("\r\n?", "\n") fs.writefile("/etc/firewall.user", value) + require("luci.sys").call("/etc/init.d/firewall restart >/dev/null 2<&1") + require("nixio").syslog('info', 'Restarting firewall on custom /etc/firewall.user change') end +f.submit = translate("Restart Firewall") + return f diff --git a/package/luci/applications/luci-app-firewall/po/ca/firewall.po b/package/luci/applications/luci-app-firewall/po/ca/firewall.po index 5d62f02656..913fb759e4 100644 --- a/package/luci/applications/luci-app-firewall/po/ca/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/ca/firewall.po @@ -295,6 +295,9 @@ msgstr "Redirigeix trànsit entrant coincidit al port donat en el host intern" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Redirigeix trànsit entrant coincidit al host intern especificat" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Restringeix la mascarada a les subxarxes de destí donades" diff --git a/package/luci/applications/luci-app-firewall/po/cs/firewall.po b/package/luci/applications/luci-app-firewall/po/cs/firewall.po index 2d4b251d36..1ab1360f57 100644 --- a/package/luci/applications/luci-app-firewall/po/cs/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/cs/firewall.po @@ -292,6 +292,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Přesměrovat vybraný příchozí provoz na uvedeného vnitřního hostitele." +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Omezit maškarádování na uvedené cílové podsítě" diff --git a/package/luci/applications/luci-app-firewall/po/de/firewall.po b/package/luci/applications/luci-app-firewall/po/de/firewall.po index c9237d7d49..448f951fa0 100644 --- a/package/luci/applications/luci-app-firewall/po/de/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/de/firewall.po @@ -292,6 +292,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Gefilterte Verbindungen an den angegeben internen Host weiterleiten" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "NAT auf die angegebenen Ziel-Subnetze beschränken" diff --git a/package/luci/applications/luci-app-firewall/po/el/firewall.po b/package/luci/applications/luci-app-firewall/po/el/firewall.po index f54e3d6170..2229bf09f6 100644 --- a/package/luci/applications/luci-app-firewall/po/el/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/el/firewall.po @@ -285,6 +285,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/en/firewall.po b/package/luci/applications/luci-app-firewall/po/en/firewall.po index 6e3b9eb5ea..9dc277dbed 100644 --- a/package/luci/applications/luci-app-firewall/po/en/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/en/firewall.po @@ -285,6 +285,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Redirect matched incoming traffic to the specified internal host" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/es/firewall.po b/package/luci/applications/luci-app-firewall/po/es/firewall.po index 4a3e182267..670b4db6f6 100644 --- a/package/luci/applications/luci-app-firewall/po/es/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/es/firewall.po @@ -294,6 +294,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Redirigir el tráfico de entrada que coincida a la máquina interna" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Restringir enmascaramiento a las subredes destino" diff --git a/package/luci/applications/luci-app-firewall/po/fr/firewall.po b/package/luci/applications/luci-app-firewall/po/fr/firewall.po index 6d3111a28a..cdff282964 100644 --- a/package/luci/applications/luci-app-firewall/po/fr/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/fr/firewall.po @@ -290,6 +290,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Rediriger le trafic entrant correspondant vers l'hôte interne spécifié" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" "Restreindre la substitution d'adresses (Masquerade) à ces sous-réseaux " diff --git a/package/luci/applications/luci-app-firewall/po/he/firewall.po b/package/luci/applications/luci-app-firewall/po/he/firewall.po index 54316ad117..ce0ad04050 100644 --- a/package/luci/applications/luci-app-firewall/po/he/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/he/firewall.po @@ -275,6 +275,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/hu/firewall.po b/package/luci/applications/luci-app-firewall/po/hu/firewall.po index 78c4b2693e..c201e3da88 100644 --- a/package/luci/applications/luci-app-firewall/po/hu/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/hu/firewall.po @@ -296,6 +296,9 @@ msgstr "Átirányítja az egyező bejövő forgalmat a belső gép megadott port msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Átirányítja az egyező bejövő forgalmat a megadott belső géphez" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Álcázás korlátozása a megadott cél alhálózatokra" diff --git a/package/luci/applications/luci-app-firewall/po/it/firewall.po b/package/luci/applications/luci-app-firewall/po/it/firewall.po index 064f63d502..88535243be 100644 --- a/package/luci/applications/luci-app-firewall/po/it/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/it/firewall.po @@ -272,8 +272,10 @@ msgstr "" msgid "" "Port forwarding allows remote computers on the Internet to connect to a " "specific computer or service within the private LAN." -msgstr "L'inoltro delle porte permette ai computer in remoto su Internet di" -"connettersi a uno specifico computer o servizio presente nella tua LAN privata" +msgstr "" +"L'inoltro delle porte permette ai computer in remoto su Internet " +"diconnettersi a uno specifico computer o servizio presente nella tua LAN " +"privata" msgid "Protocol" msgstr "Protocollo" @@ -285,6 +287,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" @@ -380,8 +385,9 @@ msgstr "" msgid "" "The firewall creates zones over your network interfaces to control network " "traffic flow." -msgstr "Il firewall crea delle zone nelle tue interfacce di rete per controllare" -"il flusso del traffico." +msgstr "" +"Il firewall crea delle zone nelle tue interfacce di rete per controllareil " +"flusso del traffico." msgid "" "The options below control the forwarding policies between this zone (%s) and " diff --git a/package/luci/applications/luci-app-firewall/po/ja/firewall.po b/package/luci/applications/luci-app-firewall/po/ja/firewall.po index 4e88189eb0..0e8d71c6b3 100644 --- a/package/luci/applications/luci-app-firewall/po/ja/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/ja/firewall.po @@ -1,26 +1,26 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-30 17:00+0200\n" -"PO-Revision-Date: 2012-11-14 17:32+0200\n" -"Last-Translator: Kentaro \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2016-12-24 02:55+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Pootle 2.0.6\n" +"X-Generator: Poedit 1.8.11\n" +"Language-Team: \n" msgid "%s in %s" -msgstr "" +msgstr "%s (%s)" msgid "%s%s with %s" msgstr "%s%s ,%s" msgid "%s, %s in %s" -msgstr "" +msgstr "%s, %s (%s)" msgid "(Unnamed Entry)" msgstr "(名前設定の無いエントリー)" @@ -142,10 +142,10 @@ msgid "Forward" msgstr "転送" msgid "Forward to" -msgstr "" +msgstr "転送先" msgid "Friday" -msgstr "" +msgstr "金曜日" msgid "From %s in %s" msgstr "送信元 %s (%s)" @@ -199,7 +199,7 @@ msgid "Masquerading" msgstr "マスカレード" msgid "Match" -msgstr "" +msgstr "対象" msgid "Match ICMP type" msgstr "ICMPタイプの一致" @@ -224,10 +224,10 @@ msgstr "" "フィックと一致したトラフィックが対象になります。" msgid "Monday" -msgstr "" +msgstr "月曜日" msgid "Month Days" -msgstr "" +msgstr "月間" msgid "Name" msgstr "名前" @@ -301,6 +301,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "ルールに一致した受信トラフィックを、設定された内部ホストへ転送します" +msgid "Restart Firewall" +msgstr "ファイアウォールの再起動" + msgid "Restrict Masquerading to given destination subnets" msgstr "設定された宛先サブネットへのマスカレードを制限する" @@ -334,7 +337,7 @@ msgid "SNAT port" msgstr "SNAT ポート" msgid "Saturday" -msgstr "" +msgstr "土曜日" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Generated from applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua # @@ -394,19 +397,19 @@ msgid "Source zone" msgstr "送信元ゾーン" msgid "Start Date (yyyy-mm-dd)" -msgstr "" +msgstr "開始日 (yyyy-mm-dd)" msgid "Start Time (hh:mm:ss)" -msgstr "" +msgstr "開始時刻 (hh:mm:ss)" msgid "Stop Date (yyyy-mm-dd)" -msgstr "" +msgstr "停止日 (yyyy-mm-dd)" msgid "Stop Time (hh:mm:ss)" -msgstr "" +msgstr "停止時刻 (hh:mm:ss)" msgid "Sunday" -msgstr "" +msgstr "日曜日" msgid "" "The firewall creates zones over your network interfaces to control network " @@ -444,7 +447,6 @@ msgstr "" "このページでは、各トラフィックルールの送信元・宛先ホストの設定などの詳細設定" "を行うことができます。" -#, fuzzy msgid "" "This section defines common properties of %q. The input and " "output options set the default policies for traffic entering and " @@ -459,10 +461,10 @@ msgstr "" "のゾーンに属するかを設定します。" msgid "Thursday" -msgstr "" +msgstr "木曜日" msgid "Time in UTC" -msgstr "" +msgstr "UTC時刻を使用" msgid "To %s at %s on this device" msgstr "宛先 %s, %s (デバイス)" @@ -495,19 +497,19 @@ msgstr "" "設定することができます。" msgid "Tuesday" -msgstr "" +msgstr "火曜日" msgid "Via %s" -msgstr "" +msgstr "経由 %s" msgid "Via %s at %s" -msgstr "" +msgstr "経由 %s , %s" msgid "Wednesday" -msgstr "" +msgstr "水曜日" msgid "Week Days" -msgstr "" +msgstr "曜日" msgid "" "You may specify multiple by selecting \"-- custom --\" and then entering " @@ -550,4 +552,4 @@ msgid "reject" msgstr "拒否" msgid "traffic" -msgstr "" +msgstr "トラフィック" diff --git a/package/luci/applications/luci-app-firewall/po/ms/firewall.po b/package/luci/applications/luci-app-firewall/po/ms/firewall.po index 185aeb936b..b82e2c116f 100644 --- a/package/luci/applications/luci-app-firewall/po/ms/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/ms/firewall.po @@ -274,6 +274,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/no/firewall.po b/package/luci/applications/luci-app-firewall/po/no/firewall.po index e39eee7e43..59167db541 100644 --- a/package/luci/applications/luci-app-firewall/po/no/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/no/firewall.po @@ -291,6 +291,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Viderekoble matchet innkommende trafikk til den angitte interne vert" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Begrens Masquerading til oppgitt destinasjons subnett" diff --git a/package/luci/applications/luci-app-firewall/po/pl/firewall.po b/package/luci/applications/luci-app-firewall/po/pl/firewall.po index 7a598d8085..2eea8c31f8 100644 --- a/package/luci/applications/luci-app-firewall/po/pl/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/pl/firewall.po @@ -300,6 +300,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Przekieruj ruch przychodzący do wskazanego hosta w sieci wewnętrznej" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Ogranicz maskaradę do wskazanych sieci docelowych" diff --git a/package/luci/applications/luci-app-firewall/po/pt-br/firewall.po b/package/luci/applications/luci-app-firewall/po/pt-br/firewall.po index c1cfb4287d..2d601f8575 100644 --- a/package/luci/applications/luci-app-firewall/po/pt-br/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/pt-br/firewall.po @@ -295,6 +295,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Redireciona tráfego entrante para o computador interno especificado" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Restringe o mascaramento para uma subrede de destino específica" diff --git a/package/luci/applications/luci-app-firewall/po/pt/firewall.po b/package/luci/applications/luci-app-firewall/po/pt/firewall.po index 70bf2fa3ef..f552616714 100644 --- a/package/luci/applications/luci-app-firewall/po/pt/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/pt/firewall.po @@ -297,6 +297,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Redirecionar o tráfego de entrada correspondente para o host interno" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/ro/firewall.po b/package/luci/applications/luci-app-firewall/po/ro/firewall.po index 432a41b897..69b911e17f 100644 --- a/package/luci/applications/luci-app-firewall/po/ro/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/ro/firewall.po @@ -279,6 +279,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/ru/firewall.po b/package/luci/applications/luci-app-firewall/po/ru/firewall.po index 294d9db6d9..98bc92dd6b 100644 --- a/package/luci/applications/luci-app-firewall/po/ru/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/ru/firewall.po @@ -300,6 +300,9 @@ msgstr "Перенаправить входящий трафик на указа msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Перенаправить входящий трафик на указанный хост внутренней сети" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Использовать маскарадинг только для указанных подсетей-получателей" diff --git a/package/luci/applications/luci-app-firewall/po/sk/firewall.po b/package/luci/applications/luci-app-firewall/po/sk/firewall.po index 59613a89a7..f45e74b14f 100644 --- a/package/luci/applications/luci-app-firewall/po/sk/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/sk/firewall.po @@ -275,6 +275,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/sv/firewall.po b/package/luci/applications/luci-app-firewall/po/sv/firewall.po index 79af5a2e86..2e169fb927 100644 --- a/package/luci/applications/luci-app-firewall/po/sv/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/sv/firewall.po @@ -276,6 +276,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/templates/firewall.pot b/package/luci/applications/luci-app-firewall/po/templates/firewall.pot index 7ea06e0bb1..d1e8eeca16 100644 --- a/package/luci/applications/luci-app-firewall/po/templates/firewall.pot +++ b/package/luci/applications/luci-app-firewall/po/templates/firewall.pot @@ -268,6 +268,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/tr/firewall.po b/package/luci/applications/luci-app-firewall/po/tr/firewall.po index 89cbfe1520..1b5444f0f4 100644 --- a/package/luci/applications/luci-app-firewall/po/tr/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/tr/firewall.po @@ -275,6 +275,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/uk/firewall.po b/package/luci/applications/luci-app-firewall/po/uk/firewall.po index b946d6b955..1c4117f3f0 100644 --- a/package/luci/applications/luci-app-firewall/po/uk/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/uk/firewall.po @@ -295,6 +295,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "Переспрямувати відповідний вхідний трафік на заданий внутрішній вузол" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "Обмежити підміну заданими підмережами призначення" diff --git a/package/luci/applications/luci-app-firewall/po/vi/firewall.po b/package/luci/applications/luci-app-firewall/po/vi/firewall.po index 93d6d6658e..6c00a6f298 100644 --- a/package/luci/applications/luci-app-firewall/po/vi/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/vi/firewall.po @@ -285,6 +285,9 @@ msgstr "" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "" diff --git a/package/luci/applications/luci-app-firewall/po/zh-cn/firewall.po b/package/luci/applications/luci-app-firewall/po/zh-cn/firewall.po index 48d22b03e5..d36eeeaa6d 100644 --- a/package/luci/applications/luci-app-firewall/po/zh-cn/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/zh-cn/firewall.po @@ -282,6 +282,9 @@ msgstr "重定向匹配的入站流量到内部主机的端口" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "重定向匹配的入站流量到的内部主机" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "要限制IP动态伪装的目标子网" diff --git a/package/luci/applications/luci-app-firewall/po/zh-tw/firewall.po b/package/luci/applications/luci-app-firewall/po/zh-tw/firewall.po index b768d43b0f..b89cfab7fd 100644 --- a/package/luci/applications/luci-app-firewall/po/zh-tw/firewall.po +++ b/package/luci/applications/luci-app-firewall/po/zh-tw/firewall.po @@ -280,6 +280,9 @@ msgstr "重導向已匹配傳入流量到內部主機上的指定埠" msgid "Redirect matched incoming traffic to the specified internal host" msgstr "重導向已匹配傳入流量到內部主機上" +msgid "Restart Firewall" +msgstr "" + msgid "Restrict Masquerading to given destination subnets" msgstr "限制偽裝到已給予的目標子網路" diff --git a/package/luci/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua b/package/luci/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua index 096724f735..4358374440 100644 --- a/package/luci/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua +++ b/package/luci/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua @@ -1,19 +1,19 @@ -- Copyright 2015 Jonathan Bennett -- Licensed to the public under the GNU General Public License v2. - +tmp = 0 m = Map("fwknopd", translate("Firewall Knock Operator")) s = m:section(TypedSection, "global", translate("Enable Uci/Luci control")) -- Set uci control on or off s.anonymous=true s:option(Flag, "uci_enabled", translate("Enable config overwrite"), translate("When unchecked, the config files in /etc/fwknopd will be used as is, ignoring any settings here.")) -qr = s:option(DummyValue, "note0", "dummy") -qr.template = "fwknopd-qr" -qr:depends("uci_enabled", "1") s = m:section(TypedSection, "access", translate("access.conf stanzas")) -- set the access.conf settings s.anonymous=true s.addremove=true -s.dynamic=true +qr = s:option(DummyValue, "note0", "dummy") +qr.tmp = tmp +qr.template = "fwknopd-qr" +qr:depends("uci_enabled", "1") s:option(Value, "SOURCE", "SOURCE", translate("Use ANY for any source ip")) k1 = s:option(Value, "KEY", "KEY", translate("Define the symmetric key used for decrypting an incoming SPA packet that is encrypted by the fwknop client with Rijndael.")) k1:depends("keytype", translate("Normal Key")) @@ -40,15 +40,13 @@ s:option(Value, "REQUIRE_SOURCE_ADDRESS", "REQUIRE_SOURCE_ADDRESS", translate("F This makes it impossible to use the -s command line argument on the fwknop client command line, so either -R \ has to be used to automatically resolve the external address (if the client behind a NAT) or the client must \ know the external IP and set it via the -a argument.")) -s:option(DummyValue, "note1", translate("Enter custom access.conf variables below:")) s = m:section(TypedSection, "config", translate("fwknopd.conf config options")) s.anonymous=true -s.dynamic=true s:option(Value, "MAX_SPA_PACKET_AGE", "MAX_SPA_PACKET_AGE", translate("Maximum age in seconds that an SPA packet will be accepted. defaults to 120 seconds")) s:option(Value, "PCAP_INTF", "PCAP_INTF", translate("Specify the ethernet interface on which fwknopd will sniff packets.")) s:option(Value, "ENABLE_IPT_FORWARDING", "ENABLE_IPT_FORWARDING", translate("Allow SPA clients to request access to services through an iptables firewall instead of just to it.")) -s:option(DummyValue, "note2", translate("Enter custom fwknopd.conf variables below:")) +s:option(Value, "ENABLE_NAT_DNS", "ENABLE_NAT_DNS", translate("Allow SPA clients to request forwarding destination by DNS name.")) return m diff --git a/package/luci/applications/luci-app-fwknopd/luasrc/view/fwknopd-qr.htm b/package/luci/applications/luci-app-fwknopd/luasrc/view/fwknopd-qr.htm index 9e6e8185fa..5773f523e5 100644 --- a/package/luci/applications/luci-app-fwknopd/luasrc/view/fwknopd-qr.htm +++ b/package/luci/applications/luci-app-fwknopd/luasrc/view/fwknopd-qr.htm @@ -1 +1,2 @@ -<% print(luci.sys.exec("sh /usr/sbin/gen-qr.sh")) %> +<% print(luci.sys.exec("sh /usr/sbin/gen-qr.sh " .. self.tmp)) %> +<% self.tmp = self.tmp + 1 %> diff --git a/package/luci/applications/luci-app-fwknopd/po/en/fwknopd.po b/package/luci/applications/luci-app-fwknopd/po/en/fwknopd.po index d75c99d524..fbdd8d7532 100644 --- a/package/luci/applications/luci-app-fwknopd/po/en/fwknopd.po +++ b/package/luci/applications/luci-app-fwknopd/po/en/fwknopd.po @@ -17,6 +17,9 @@ msgstr "" "Allow SPA clients to request access to services through an iptables firewall " "instead of just to it." +msgid "Allow SPA clients to request forwarding destination by DNS name." +msgstr "" + msgid "Base 64 key" msgstr "Base 64 key" @@ -55,12 +58,6 @@ msgstr "Enable Uci/Luci control" msgid "Enable config overwrite" msgstr "Enable config overwrite" -msgid "Enter custom access.conf variables below:" -msgstr "Enter custom access.conf variables below:" - -msgid "Enter custom fwknopd.conf variables below:" -msgstr "Enter custom fwknopd.conf variables below:" - msgid "Firewall Knock Daemon" msgstr "Firewall Knock Daemon" @@ -111,3 +108,9 @@ msgstr "access.conf stanzas" msgid "fwknopd.conf config options" msgstr "fwknopd.conf config options" + +#~ msgid "Enter custom access.conf variables below:" +#~ msgstr "Enter custom access.conf variables below:" + +#~ msgid "Enter custom fwknopd.conf variables below:" +#~ msgstr "Enter custom fwknopd.conf variables below:" diff --git a/package/luci/applications/luci-app-fwknopd/po/templates/fwknopd.pot b/package/luci/applications/luci-app-fwknopd/po/templates/fwknopd.pot index 4fb616f25e..1010ba70e6 100644 --- a/package/luci/applications/luci-app-fwknopd/po/templates/fwknopd.pot +++ b/package/luci/applications/luci-app-fwknopd/po/templates/fwknopd.pot @@ -6,6 +6,9 @@ msgid "" "instead of just to it." msgstr "" +msgid "Allow SPA clients to request forwarding destination by DNS name." +msgstr "" + msgid "Base 64 key" msgstr "" @@ -34,12 +37,6 @@ msgstr "" msgid "Enable config overwrite" msgstr "" -msgid "Enter custom access.conf variables below:" -msgstr "" - -msgid "Enter custom fwknopd.conf variables below:" -msgstr "" - msgid "Firewall Knock Daemon" msgstr "" diff --git a/package/luci/applications/luci-app-fwknopd/root/etc/uci-defaults/40_luci-fwknopd b/package/luci/applications/luci-app-fwknopd/root/etc/uci-defaults/40_luci-fwknopd index 01b85de25f..65ef012450 100644 --- a/package/luci/applications/luci-app-fwknopd/root/etc/uci-defaults/40_luci-fwknopd +++ b/package/luci/applications/luci-app-fwknopd/root/etc/uci-defaults/40_luci-fwknopd @@ -16,6 +16,7 @@ uci set fwknopd.@access[0].hkeytype='Base 64 key' uci set fwknopd.@access[0].KEY_BASE64=`fwknopd --key-gen | awk '/^KEY/ {print $2;}'` uci set fwknopd.@access[0].HMAC_KEY_BASE64=`fwknopd --key-gen | awk '/^HMAC/ {print $2;}'` uci set fwknopd.@config[0].ENABLE_IPT_FORWARDING='y' +uci set fwknopd.@config[0].ENABLE_NAT_DNS='y' uci commit fwknopd rm -f /tmp/luci-indexcache diff --git a/package/luci/applications/luci-app-fwknopd/root/usr/sbin/gen-qr.sh b/package/luci/applications/luci-app-fwknopd/root/usr/sbin/gen-qr.sh index 97493dafed..abca5d3e5a 100644 --- a/package/luci/applications/luci-app-fwknopd/root/usr/sbin/gen-qr.sh +++ b/package/luci/applications/luci-app-fwknopd/root/usr/sbin/gen-qr.sh @@ -1,9 +1,13 @@ #!/bin/sh +entry_num=0 +if [ "$1" != "" ]; then +entry_num=$1 +fi -key_base64=$(uci get fwknopd.@access[0].KEY_BASE64) -key=$(uci get fwknopd.@access[0].KEY) -hmac_key_base64=$(uci get fwknopd.@access[0].HMAC_KEY_BASE64) -hmac_key=$(uci get fwknopd.@access[0].HMAC_KEY) +key_base64=$(uci get fwknopd.@access[$entry_num].KEY_BASE64) +key=$(uci get fwknopd.@access[$entry_num].KEY) +hmac_key_base64=$(uci get fwknopd.@access[$entry_num].HMAC_KEY_BASE64) +hmac_key=$(uci get fwknopd.@access[$entry_num].HMAC_KEY) if [ $key_base64 != "" ]; then qr="KEY_BASE64:$key_base64" diff --git a/package/luci/applications/luci-app-mjpg-streamer/po/ja/mjpg-streamer.po b/package/luci/applications/luci-app-mjpg-streamer/po/ja/mjpg-streamer.po new file mode 100644 index 0000000000..7da3444613 --- /dev/null +++ b/package/luci/applications/luci-app-mjpg-streamer/po/ja/mjpg-streamer.po @@ -0,0 +1,171 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: INAGAKI Hiroshi \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ja\n" +"X-Generator: Poedit 1.8.11\n" + +msgid "Allow ringbuffer to exceed limit by this amount" +msgstr "リングバッファーがこの量だけ制限を超過することを許可します。" + +msgid "Ask for username and password on connect" +msgstr "接続時にユーザー名とパスワードを確認します。" + +msgid "Authentication required" +msgstr "認証が必要" + +msgid "Auto" +msgstr "自動" + +msgid "Automatic disabling of MJPEG mode" +msgstr "MJPEGモードの自動無効化" + +msgid "Blink" +msgstr "点滅" + +msgid "Check to save the stream to an mjpeg file" +msgstr "MJPEGファイルに保存するにはチェックします。" + +msgid "Command to run" +msgstr "実行するコマンド" + +msgid "Device" +msgstr "デバイス" + +msgid "Do not initalize dynctrls of Linux-UVC driver" +msgstr "Linux-UVCドライバのdynctrlsを初期化しません。" + +msgid "Don't initalize dynctrls" +msgstr "dynctrlsを初期化しない" + +msgid "Drop frames smaller then this limit" +msgstr "この制限よりも小さいフレームをドロップする" + +msgid "Enable MJPG-streamer" +msgstr "MJPG-streamerを有効化します。" + +msgid "Enable YUYV format" +msgstr "YUYV形式を有効化" + +msgid "Enabled" +msgstr "有効" + +msgid "Exceed" +msgstr "超過" + +msgid "" +"Execute command after saving picture. Mjpg-streamer parse the filename as " +"first parameter to your script." +msgstr "" +"画像保存後にコマンドを実行します。Mjpg-streamerは、ファイル名をスクリプトの最" +"初の引数として解釈します。" + +msgid "File input" +msgstr "ファイル入力" + +msgid "File output" +msgstr "ファイル出力" + +msgid "Folder" +msgstr "フォルダー" + +msgid "Folder that contains webpages" +msgstr "ウェブページを含むフォルダー" + +msgid "Frames per second" +msgstr "1秒当たりのフレーム数" + +msgid "General" +msgstr "一般設定" + +msgid "HTTP output" +msgstr "HTTP 出力" + +msgid "Input plugin" +msgstr "入力プラグイン" + +msgid "Interval between saving pictures" +msgstr "画像の保存間隔" + +msgid "JPEG compression quality" +msgstr "JPEG 圧縮品質" + +msgid "Led control" +msgstr "LED 制御" + +msgid "MJPG-streamer" +msgstr "MJPG-streamer" + +msgid "Max. number of pictures to hold" +msgstr "保持する画像の最大数です。" + +msgid "Mjpeg output" +msgstr "MJPEG 出力" + +msgid "Off" +msgstr "消灯" + +msgid "On" +msgstr "点灯" + +msgid "Output plugin" +msgstr "出力プラグイン" + +msgid "Password" +msgstr "パスワード" + +msgid "Plugin settings" +msgstr "プラグイン設定" + +msgid "Port" +msgstr "ポート" + +msgid "Resolution" +msgstr "解像度" + +msgid "Ring buffer size" +msgstr "リングバッファー サイズ" + +msgid "Set folder to save pictures" +msgstr "画像を保存するフォルダーを設定します。" + +msgid "Set the inteval in millisecond" +msgstr "間隔をミリ秒で設定します。" + +msgid "" +"Set the minimum size if the webcam produces small-sized garbage frames. May " +"happen under low light conditions" +msgstr "" +"もしウェブカメラが小さなサイズの余分なフレームを生成する場合は、最小サイズを" +"設定します。光量の低い条件下で発生することがあります。" + +msgid "" +"Set the quality in percent. This setting activates YUYV format, disables " +"MJPEG" +msgstr "" +"品質をパーセントで設定します。この設定はYUYV形式を有効にし、MJPEGを無効にしま" +"す。" + +msgid "TCP port for this HTTP server" +msgstr "このHTTPサーバーのTCPポートです。" + +msgid "UVC input" +msgstr "UVC 入力" + +msgid "Username" +msgstr "ユーザー名" + +msgid "WWW folder" +msgstr "WWW フォルダー" + +msgid "" +"mjpg streamer is a streaming application for Linux-UVC compatible webcams" +msgstr "" +"Mjpg streamerは、Linux-UVC互換ウェブカメラのためのストリーミング アプリケー" +"ションです。" diff --git a/package/luci/applications/luci-app-olsr/luasrc/controller/olsr.lua b/package/luci/applications/luci-app-olsr/luasrc/controller/olsr.lua index 9a997bdc12..0564bd4ea7 100644 --- a/package/luci/applications/luci-app-olsr/luasrc/controller/olsr.lua +++ b/package/luci/applications/luci-app-olsr/luasrc/controller/olsr.lua @@ -87,8 +87,8 @@ function action_json() local v4_port = uci:get("olsrd", "olsrd_jsoninfo", "port") or 9090 local v6_port = uci:get("olsrd6", "olsrd_jsoninfo", "port") or 9090 - jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 " .. v4_port .. ") 2>/dev/null" ) - jsonreq6 = utl.exec("(echo /status | nc ::1 " .. v6_port .. ") 2>/dev/null") + jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 " .. v4_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null" ) + jsonreq6 = utl.exec("(echo /status | nc ::1 " .. v6_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null") http.prepare_content("application/json") if not jsonreq4 or jsonreq4 == "" then jsonreq4 = "{}" @@ -375,8 +375,8 @@ function fetch_jsoninfo(otable) local v4_port = uci:get("olsrd", "olsrd_jsoninfo", "port") or 9090 local v6_port = uci:get("olsrd6", "olsrd_jsoninfo", "port") or 9090 - jsonreq4 = utl.exec("(echo /" .. otable .. " | nc 127.0.0.1 " .. v4_port .. ") 2>/dev/null") - jsonreq6 = utl.exec("(echo /" .. otable .. " | nc ::1 " .. v6_port .. ") 2>/dev/null") + jsonreq4 = utl.exec("(echo /" .. otable .. " | nc 127.0.0.1 " .. v4_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null") + jsonreq6 = utl.exec("(echo /" .. otable .. " | nc ::1 " .. v6_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null") local jsondata4 = {} local jsondata6 = {} local data4 = {} diff --git a/package/luci/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm b/package/luci/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm index 31dd7d05ac..c077c20486 100644 --- a/package/luci/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm +++ b/package/luci/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm @@ -12,8 +12,8 @@ local i = 1 if luci.http.formvalue("status") == "1" then local rv = {} for k, link in ipairs(links) do - link.linkCost = tonumber(link.linkCost)/1024 or 0 - if link.linkCost == 4096 then + link.linkCost = tonumber(link.linkCost) or 0 + if link.linkCost == 4194304 then link.linkCost = 0 end local color = olsrtools.etx_color(link.linkCost) @@ -129,8 +129,8 @@ end <% local i = 1 for k, link in ipairs(links) do - link.linkCost = tonumber(link.linkCost)/1024 or 0 - if link.linkCost == 4096 then + link.linkCost = tonumber(link.linkCost) or 0 + if link.linkCost == 4194304 then link.linkCost = 0 end diff --git a/package/luci/applications/luci-app-p910nd/po/ja/p910nd.po b/package/luci/applications/luci-app-p910nd/po/ja/p910nd.po index 42335cefaf..28ffc38178 100644 --- a/package/luci/applications/luci-app-p910nd/po/ja/p910nd.po +++ b/package/luci/applications/luci-app-p910nd/po/ja/p910nd.po @@ -1,17 +1,17 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-05-19 19:36+0200\n" -"PO-Revision-Date: 2011-11-04 18:11+0200\n" -"Last-Translator: Kentaro \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2016-12-22 01:08+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Pootle 2.0.4\n" +"X-Generator: Poedit 1.8.11\n" +"Language-Team: \n" msgid "Bidirectional mode" msgstr "双方向モード" @@ -27,7 +27,7 @@ msgstr "" "るためのパッケージをインストールしてください。" msgid "Interface" -msgstr "" +msgstr "インターフェース" msgid "Port" msgstr "ポート番号" @@ -36,7 +36,7 @@ msgid "Settings" msgstr "設定" msgid "Specifies the interface to listen on." -msgstr "" +msgstr "待ち受けるインターフェースを指定します。" msgid "TCP listener port." msgstr "TCP接続待ちポート" diff --git a/package/luci/applications/luci-app-privoxy/po/zh-cn/privoxy.po b/package/luci/applications/luci-app-privoxy/po/zh-cn/privoxy.po index 75d1a921cf..778422b8bb 100644 --- a/package/luci/applications/luci-app-privoxy/po/zh-cn/privoxy.po +++ b/package/luci/applications/luci-app-privoxy/po/zh-cn/privoxy.po @@ -2,14 +2,14 @@ msgid "" msgstr "" "Project-Id-Version: luci-app-privoxy\n" "POT-Creation-Date: 2015-06-10 20:16+0100\n" -"PO-Revision-Date: 2015-06-10 20:16+0100\n" +"PO-Revision-Date: 2017-01-05 18:01+0800\n" "Last-Translator: maz-1 \n" "Language-Team: \n" -"Language: zh-cn\n" +"Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.5.4\n" +"X-Generator: Poedit 1.8.11\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SourceCharset: UTF-8\n" @@ -21,10 +21,10 @@ msgstr "当用户试图访问不受信任的页面时,错误页面所显示的 msgid "" "A URL to documentation about the local Privoxy setup, configuration or " "policies." -msgstr "指向Privoxy安装、设置和规则说明文档的URL" +msgstr "指向 Privoxy 安装、设置和规则说明文档的 URL" msgid "A directory where Privoxy can create temporary files." -msgstr "Privoxy存放临时文件的目录。" +msgstr "Privoxy 存放临时文件的目录。" msgid "Access Control" msgstr "访问控制" @@ -36,18 +36,18 @@ msgid "An alternative directory where the templates are loaded from." msgstr "可选的目录,放在里面的模板会被加载。" msgid "An email address to reach the Privoxy administrator." -msgstr "用于联系privoxy管理员的邮箱地址。" +msgstr "用于联系 Privoxy 管理员的邮箱地址。" msgid "" "Assumed server-side keep-alive timeout (in seconds) if not specified by the " "server." -msgstr "当服务端没有指定超时时间时假定的超时时间(单位秒)。" +msgstr "当服务端没有指定超时时间时假定的超时时间(单位:秒)。" msgid "Boot delay" -msgstr "" +msgstr "启动延时" msgid "CGI user interface" -msgstr "CGI用户界面" +msgstr "CGI 用户界面" msgid "Common Log Format" msgstr "通用日志格式" @@ -57,14 +57,14 @@ msgid "" "proxies. Note that parent proxies can severely decrease your privacy level. " "Also specified here are SOCKS proxies." msgstr "" -"在这里设置http请求所经过的多重代理链。注意父级代理可能严重降低你的隐私安全" -"度。在这里还可以设置SOCKS代理。" +"在这里设置 HTTP 请求所经过的多重代理链。注意:父级代理可能严重降低你的隐私安" +"全度。在这里还可以设置 SOCKS 代理。" msgid "Debug GIF de-animation" msgstr "GIF动画日志" msgid "Debug force feature" -msgstr "force feature日志" +msgstr "Force feature 日志" msgid "Debug redirects" msgstr "重定向日志" @@ -73,7 +73,7 @@ msgid "Debug regular expression filters" msgstr "正则表达式日志" msgid "Delay (in seconds) during system boot before Privoxy start" -msgstr "" +msgstr "Privoxy 自启动延迟时间(单位:秒)" msgid "Directory does not exist!" msgstr "目录不存在!" @@ -82,20 +82,20 @@ msgid "Disabled == Transparent Proxy Mode" msgstr "禁用 == 透明代理模式" msgid "Documentation" -msgstr "" +msgstr "记录信息" msgid "During delay ifup-events are not monitored !" -msgstr "" +msgstr "在延迟期间无法检测到 ifup 事件!" msgid "Enable proxy authentication forwarding" msgstr "允许转发代理认证" msgid "" "Enable/Disable autostart of Privoxy on system startup and interface events" -msgstr "开启/关闭Privoxy在系统启动或者设置界面更改时自动启动。" +msgstr "开启/关闭 Privoxy 在系统启动或接口事件时自动启动。" msgid "Enable/Disable filtering when Privoxy starts." -msgstr "Privoxy启动时开启/关闭过滤。" +msgstr "Privoxy 启动时开启/关闭过滤。" msgid "Enabled" msgstr "已开启" @@ -103,10 +103,10 @@ msgstr "已开启" msgid "" "Enabling this option is NOT recommended if there is no parent proxy that " "requires authentication!" -msgstr "父级代理不需要认证时不推荐开启这个选项!" +msgstr "如果没有需要认证的父级代理时,不推荐开启这个选项!" msgid "File '%s' not found inside Configuration Directory" -msgstr "文件 '%s' 没有在设置目录中找到!" +msgstr "在设置目录中未找到文件 '%S'!" msgid "File not found or empty" msgstr "文件不存在或为空" @@ -115,7 +115,7 @@ msgid "Files and Directories" msgstr "文件和目录" msgid "For help use link at the relevant option" -msgstr "在相应选项下的连接可获取帮助。" +msgstr "点击相应选项的连接可获取帮助。" msgid "Forwarding" msgstr "转发" @@ -123,15 +123,15 @@ msgstr "转发" msgid "" "If enabled, Privoxy hides the 'go there anyway' link. The user obviously " "should not be able to bypass any blocks." -msgstr "如果启用,Privoxy会隐藏'go there anyway'链接。用户显然不应能绕过屏蔽。" +msgstr "如果启用,Privoxy 会隐藏 'go there anyway' 链接,用户就不能绕过屏蔽。" msgid "" "If you intend to operate Privoxy for more users than just yourself, it might " "be a good idea to let them know how to reach you, what you block and why you " "do that, your policies, etc." msgstr "" -"如果除了你还有其他用户通过privoxy连接,让他们知道如何联系你、什么内容被屏蔽" -"了、你为什么要这么做、你所制定的规范等等是一个好主意。" +"如果除了你还有其他用户使用 Privoxy 连接,最好让他们知道如何联系你,你屏蔽什" +"么,你为什么这样做,你的政策等等。" msgid "Invalid email address" msgstr "邮箱地址无效" @@ -140,29 +140,29 @@ msgid "It is NOT recommended for the casual user." msgstr "不推荐新手使用。" msgid "Location of the Privoxy User Manual." -msgstr "Privoxy用户手册位置" +msgstr "Privoxy 用户手册位置" msgid "Log File Viewer" msgstr "日志查看器" msgid "Log all data read from the network" -msgstr "记录所有从网络接收的数据" +msgstr "记录所有接收的网络数据" msgid "Log all data written to the network" -msgstr "记录所有发送给网络的数据" +msgstr "记录所有发送的网络数据" msgid "Log the applying actions" -msgstr "记录被应用的规则" +msgstr "记录配置保存动作" msgid "" "Log the destination for each request Privoxy let through. See also 'Debug " "1024'." -msgstr "记录Privoxy所允许的所有请求。另请参考'Debug 1024'。" +msgstr "记录 Privoxy 允许的所有请求。另请参考 'Debug 1024'。" msgid "" "Log the destination for requests Privoxy didn't let through, and the reason " "why." -msgstr "记录被Privoxy拒绝的请求目标以及拒绝原因。" +msgstr "记录 Privoxy 拒绝的请求目标以及拒绝原因。" msgid "Logging" msgstr "日志" @@ -198,40 +198,40 @@ msgid "Maximum number of client connections that will be served." msgstr "客户端数量上限。" msgid "Maximum size (in KB) of the buffer for content filtering." -msgstr "内容过滤的最大缓冲(单位KB)。" +msgstr "内容过滤的最大缓冲(单位:KB)。" msgid "Miscellaneous" msgstr "杂项" msgid "NOT installed" -msgstr "" +msgstr "未安装" msgid "No trailing '/', please." -msgstr "路径结尾不要加'/' ." +msgstr "路径结尾不要加 '/' 。" msgid "Non-fatal errors - *we highly recommended enabling this*" -msgstr "非致命性错误 - * 建议开启 *" +msgstr "非致命性错误 - * 强烈建议开启 *" msgid "" "Number of seconds after which a socket times out if no data is received." -msgstr "socket连接未收到数据的超时时间。" +msgstr "Socket 连接未收到数据的超时时间。" msgid "" "Number of seconds after which an open connection will no longer be reused." -msgstr "一个开放的连接不再重复使用的超时时间。" +msgstr "开放的连接不再重复使用的超时时间。" msgid "" "Only when using 'external filters', Privoxy has to create temporary files." -msgstr "只有使用外置规则时,privoxy才需要创建临时文件。" +msgstr "只有使用外置规则时,Privoxy 才需要创建临时文件。" msgid "Please install current version !" -msgstr "" +msgstr "请安装当前版本!" msgid "Please press [Read] button" -msgstr "请点击[读取]按钮" +msgstr "请点击 [读取] 按钮" msgid "Please read Privoxy manual for details!" -msgstr "请阅读Privoxy手册以了解详情!" +msgstr "请阅读 Privoxy 手册以了解详情!" msgid "Please update to the current version!" msgstr "请升级到当前版本!" @@ -244,16 +244,16 @@ msgid "" "configuration, help and logging. This section of the configuration file " "tells Privoxy where to find those other files." msgstr "" -"Privoxy可以使用其他一些文件用于附加设置,帮助和日志。这个区域用来告诉Privoxy" -"从哪里找到这些文件。" +"Privoxy 可以使用其他一些文件用于附加设置,帮助和日志。这个区域用来告诉 " +"Privoxy 从哪里找到这些文件。" msgid "" "Privoxy is a non-caching web proxy with advanced filtering capabilities for " "enhancing privacy, modifying web page data and HTTP headers, controlling " "access, and removing ads and other obnoxious Internet junk." msgstr "" -"Privoxy是一个无缓存的网络代理,具有高级过滤功能,能够修改网页数据和HTTP头,控" -"制访问,移除广告等。" +"Privoxy 是一个无缓存的网络代理,具有高级过滤功能,能够修改网页数据和 HTTP 请" +"求头,控制访问,移除广告等。" msgid "Read / Reread log file" msgstr "读取/刷新日志文件" @@ -265,13 +265,13 @@ msgid "Show each connection status" msgstr "显示每个连接的状态" msgid "Show header parsing" -msgstr "Show header parsing" +msgstr "显示请求头 解析" msgid "Software package '%s' is not installed." -msgstr "" +msgstr "软件包 '%s' 未安装" msgid "Software package '%s' is outdated." -msgstr "" +msgstr "软件包 '%s' 已过时" msgid "Start" msgstr "启动" @@ -289,7 +289,7 @@ msgid "Syntax:" msgstr "格式:" msgid "Syntax: Client header names delimited by spaces." -msgstr "格式: Client header names delimited by spaces." +msgstr "格式: 由空格分隔的客户端请求头名称。" msgid "Syntax: target_pattern http_parent[:port]" msgstr "格式: target_pattern http_parent[:port]" @@ -298,7 +298,7 @@ msgid "Syntax: target_pattern socks_proxy[:port] http_parent[:port]" msgstr "格式: target_pattern socks_proxy[:port] http_parent[:port]" msgid "System" -msgstr "" +msgstr "系统" msgid "" "The actions file(s) to use. Multiple actionsfile lines are permitted, and " @@ -307,12 +307,12 @@ msgstr "所使用的规则文件。允许并且推荐使用多个规则文件。 msgid "" "The address and TCP port on which Privoxy will listen for client requests." -msgstr "Privoxy接收客户端请求时监听的地址和TCP端口。" +msgstr "Privoxy 接收客户端请求时监听的地址和 TCP 端口。" msgid "" "The compression level that is passed to the zlib library when compressing " "buffered content." -msgstr "使用zlib压缩缓冲内容时的压缩级别。" +msgstr "使用 zlib 压缩缓冲内容时的压缩级别。" msgid "" "The directory where all logging takes place (i.e. where the logfile is " @@ -334,14 +334,14 @@ msgid "The log file to use. File name, relative to log directory." msgstr "日志文件名称,与日志路径相对。" msgid "The order in which client headers are sorted before forwarding them." -msgstr "转发数据前,client headers的排序。" +msgstr "转发数据前,客户端请求头的排序。" msgid "" "The status code Privoxy returns for pages blocked with +handle-as-empty-" "document." msgstr "" -"当页面因为handle-as-empty-document规则被阻止时返回的状态码(选上为200 OK,不" -"选上为403 Forbidden)" +"当页面因为 handle-as-empty-document 规则被阻止时返回的状态码(选上为 200 OK," +"不选上为 403 Forbidden)" msgid "" "The trust mechanism is an experimental feature for building white-lists and " @@ -361,19 +361,20 @@ msgstr "这个选项仅用于调试,开启后会极大地降低性能。" msgid "" "This option will be removed in future releases as it has been obsoleted by " "the more general header taggers." -msgstr "这个选项在以后的版本中将被移除,因为它被header taggers所取代了。" +msgstr "这个选项在以后的版本中将被移除,因为它被 header taggers 所取代了。" msgid "" "This tab controls the security-relevant aspects of Privoxy's configuration." -msgstr "这个标签用于设置与安全相关的Privoxy选项。" +msgstr "这个标签用于设置与安全相关的 Privoxy 选项。" msgid "" "Through which SOCKS proxy (and optionally to which parent HTTP proxy) " "specific requests should be routed." -msgstr "指定的请求应该通过哪一个SOCKS代理(并且通过哪一个HTTP父代理,可选)" +msgstr "" +"指定的请求应该通过哪一个 SOCKS 代理(并且通过哪一个 HTTP 父代理,可选)" msgid "To which parent HTTP proxy specific requests should be routed." -msgstr "请求应转发至哪一个父级HTTP代理。" +msgstr "请求应转发至哪一个父级 HTTP 代理。" msgid "User customizations" msgstr "用户自定义" @@ -382,10 +383,10 @@ msgid "Value is not a number" msgstr "输入值不是数字" msgid "Value not between 0 and 300" -msgstr "" +msgstr "输入值不在0和300之间" msgid "Value not between 0 and 9" -msgstr "输入值不在0和9之间。" +msgstr "输入值不在0和9之间" msgid "Value not between 1 and 4096" msgstr "输入值不在1和4096之间" @@ -408,7 +409,7 @@ msgstr "被拦截的请求是否应被当作有效的。" msgid "" "Whether or not Privoxy recognizes special HTTP headers to change toggle " "state." -msgstr "Privoxy是否识别特殊的HTTP头以切换状态。" +msgstr "Privoxy 是否识别特殊的 HTTP 请求头以切换状态。" msgid "Whether or not buffered content is compressed before delivery." msgstr "缓冲内容在传递之前是否压缩。" @@ -422,7 +423,7 @@ msgid "Whether or not pipelined requests should be served." msgstr "是否处理管道化的请求。" msgid "Whether or not proxy authentication through Privoxy should work." -msgstr "是否可以通过Privoxy进行代理验证。" +msgstr "是否可以通过 Privoxy 进行代理验证。" msgid "Whether or not the web-based actions file editor may be used." msgstr "是否使用基于网页的规则编辑器。" @@ -431,11 +432,11 @@ msgid "Whether or not the web-based toggle feature may be used." msgstr "是否启用基于网页的切换功能。" msgid "Whether requests to Privoxy's CGI pages can be blocked or redirected." -msgstr "访问Privoxy CGI页面的请求是否可以被拦截或重定向。" +msgstr "访问 Privoxy CGI 页面的请求是否可以被拦截或重定向。" msgid "" "Whether the CGI interface should stay compatible with broken HTTP clients." -msgstr "CGI界面是否应兼容过时的HTTP客户端。" +msgstr "CGI 界面是否应兼容过时的HTTP客户端。" msgid "Whether to run only one server thread." msgstr "是否只运行一个服务线程。" diff --git a/package/luci/applications/luci-app-qos/po/ja/qos.po b/package/luci/applications/luci-app-qos/po/ja/qos.po index deeb23f60c..a81a6e1ade 100644 --- a/package/luci/applications/luci-app-qos/po/ja/qos.po +++ b/package/luci/applications/luci-app-qos/po/ja/qos.po @@ -1,17 +1,17 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-25 22:10+0100\n" -"PO-Revision-Date: 2011-10-28 11:02+0200\n" -"Last-Translator: Kentaro \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2016-12-22 01:54+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Pootle 2.0.4\n" +"X-Generator: Poedit 1.8.11\n" +"Language-Team: \n" msgid "Calculate overhead" msgstr "オーバーヘッドを考慮する" @@ -23,7 +23,7 @@ msgid "Classification group" msgstr "区分グループ" msgid "Comment" -msgstr "" +msgstr "コメント" msgid "Destination host" msgstr "宛先ホスト" @@ -50,7 +50,7 @@ msgid "Protocol" msgstr "プロトコル" msgid "QoS" -msgstr "" +msgstr "QoS" msgid "Quality of Service" msgstr "Quality of Service" diff --git a/package/luci/applications/luci-app-shairplay/po/ja/shairplay.po b/package/luci/applications/luci-app-shairplay/po/ja/shairplay.po new file mode 100644 index 0000000000..07fa7be6ec --- /dev/null +++ b/package/luci/applications/luci-app-shairplay/po/ja/shairplay.po @@ -0,0 +1,54 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2017-01-03 15:06+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" +"Language-Team: \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.11\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "AO Device ID" +msgstr "オーディオ出力 デバイスID" + +msgid "AO Device Name" +msgstr "オーディオ出力 デバイス名" + +msgid "AO Driver" +msgstr "オーディオ出力 デバイスドライバー" + +msgid "Airport Name" +msgstr "Airport名" + +msgid "Default" +msgstr "デフォルト" + +msgid "Enabled" +msgstr "有効" + +msgid "HW Address" +msgstr "ハードウェア アドレス" + +msgid "Password" +msgstr "パスワード" + +msgid "Port" +msgstr "ポート" + +msgid "Respawn" +msgstr "リスポーン" + +msgid "Shairplay" +msgstr "" + +msgid "" +"Shairplay is a simple AirPlay server implementation, here you can configure " +"the settings." +msgstr "" +"Shairplayは、シンプルなAirPlay サーバー実装です。ここでは、設定を行うことがで" +"きます。" diff --git a/package/luci/applications/luci-app-shairplay/po/templates/shairplay.pot b/package/luci/applications/luci-app-shairplay/po/templates/shairplay.pot new file mode 100644 index 0000000000..b3da99e0b3 --- /dev/null +++ b/package/luci/applications/luci-app-shairplay/po/templates/shairplay.pot @@ -0,0 +1,40 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "AO Device ID" +msgstr "" + +msgid "AO Device Name" +msgstr "" + +msgid "AO Driver" +msgstr "" + +msgid "Airport Name" +msgstr "" + +msgid "Default" +msgstr "" + +msgid "Enabled" +msgstr "" + +msgid "HW Address" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "Port" +msgstr "" + +msgid "Respawn" +msgstr "" + +msgid "Shairplay" +msgstr "" + +msgid "" +"Shairplay is a simple AirPlay server implementation, here you can configure " +"the settings." +msgstr "" diff --git a/package/luci/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua b/package/luci/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua index fbc3884b46..b5633c15ff 100644 --- a/package/luci/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua +++ b/package/luci/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua @@ -8,7 +8,6 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) return { title = "%H: Disk space usage on %pi", vlabel = "Bytes", - per_instance = true, number_format = "%5.1lf%sB", data = { diff --git a/package/luci/applications/luci-app-statistics/po/ja/statistics.po b/package/luci/applications/luci-app-statistics/po/ja/statistics.po index bc995a6fb4..218712b535 100644 --- a/package/luci/applications/luci-app-statistics/po/ja/statistics.po +++ b/package/luci/applications/luci-app-statistics/po/ja/statistics.po @@ -1,65 +1,65 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-05-19 19:36+0200\n" -"PO-Revision-Date: 2012-04-20 08:55+0200\n" -"Last-Translator: Kentaro \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2016-12-23 15:07+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Pootle 2.0.4\n" +"X-Generator: Poedit 1.8.11\n" +"Language-Team: \n" msgid "Action (target)" -msgstr "" +msgstr "アクション(対象)" msgid "Add command for reading values" -msgstr "" +msgstr "値読み取りコマンドの追加" msgid "Add matching rule" -msgstr "" +msgstr "マッチング規則の追加" msgid "Add multiple hosts separated by space." -msgstr "" +msgstr "スペースで区切られた複数のホストを追加します。" msgid "Add notification command" -msgstr "" +msgstr "通知コマンドの追加" msgid "Aggregate number of connected users" -msgstr "" +msgstr "接続ユーザー数の総計" msgid "Base Directory" msgstr "ベース・ディレクトリ" msgid "Basic monitoring" -msgstr "" +msgstr "基本モニタリング" msgid "CPU Frequency" -msgstr "" +msgstr "CPU 周波数" msgid "CPU Frequency Plugin Configuration" -msgstr "" +msgstr "CPU 周波数プラグイン設定" msgid "CPU Plugin Configuration" -msgstr "" +msgstr "CPU プラグイン設定" msgid "CSV Output" -msgstr "" +msgstr "CSV 出力" msgid "CSV Plugin Configuration" msgstr "CSV プラグイン設定" msgid "Cache collected data for" -msgstr "" +msgstr "収集されたデータをキャッシュする" msgid "Cache flush interval" msgstr "" msgid "Chain" -msgstr "" +msgstr "チェイン" msgid "CollectLinks" msgstr "" @@ -78,12 +78,14 @@ msgid "" "different plugins. On this page you can change general settings for the " "collectd daemon." msgstr "" +"Collectd は、様々なソースから別々のプラグインを通してデータを収集する軽量デー" +"モンです。" msgid "Conntrack" -msgstr "" +msgstr "Conntrack" msgid "Conntrack Plugin Configuration" -msgstr "" +msgstr "Conntrack プラグイン設定" msgid "DF Plugin Configuration" msgstr "DF プラグイン設定" @@ -92,7 +94,7 @@ msgid "DNS" msgstr "DNS" msgid "DNS Plugin Configuration" -msgstr "" +msgstr "DNS プラグイン設定" msgid "Data collection interval" msgstr "データの収集間隔" @@ -101,7 +103,7 @@ msgid "Datasets definition file" msgstr "データベース定義ファイル" msgid "Destination ip range" -msgstr "" +msgstr "対象IPの範囲" msgid "Directory for collectd plugins" msgstr "collectd プラグインディレクトリ" @@ -113,13 +115,13 @@ msgid "Disk Plugin Configuration" msgstr "ディスクプラグイン設定" msgid "Disk Space Usage" -msgstr "" +msgstr "ディスクスペース使用量" msgid "Disk Usage" -msgstr "" +msgstr "ディスクの使用" msgid "Display Host »" -msgstr "" +msgstr "ホストを表示 »" msgid "Display timespan »" msgstr "時間帯表示 »" @@ -131,22 +133,22 @@ msgid "Email" msgstr "Eメール" msgid "Empty value = monitor all" -msgstr "" +msgstr "空の値 = 全てをモニターする" msgid "Enable this plugin" msgstr "プラグイン設定を有効にする" msgid "Entropy" -msgstr "" +msgstr "エントロピー" msgid "Entropy Plugin Configuration" -msgstr "" +msgstr "エントロピー プラグイン設定" msgid "Exec" msgstr "" msgid "Exec Plugin Configuration" -msgstr "" +msgstr "Exec プラグイン設定" msgid "Filter class monitoring" msgstr "" @@ -164,10 +166,10 @@ msgid "Gather compression statistics" msgstr "" msgid "General plugins" -msgstr "" +msgstr "一般プラグイン" msgid "Generate a separate graph for each logged user" -msgstr "" +msgstr "ログインユーザーごとの分離されたグラフを生成します。" msgid "Graphs" msgstr "グラフ" @@ -179,23 +181,30 @@ msgid "" "Here you can define external commands which will be started by collectd in " "order to read certain values. The values will be read from stdout." msgstr "" +"ここでは、特定の値を読み込むためにcollectによって順番に開始される外部コマンド" +"を設定することができます。値は標準出力から読み込まれます。" msgid "" "Here you can define external commands which will be started by collectd when " "certain threshold values have been reached. The values leading to invokation " "will be feeded to the the called programs stdin." msgstr "" +"ここでは、特定の閾値に到達したときにcollectによって開始される外部コマンドを設" +"定することができます。呼び出しにつながる値は、呼び出されたプログラムの標準入" +"力に送られます。" msgid "" "Here you can define various criteria by which the monitored iptables rules " "are selected." msgstr "" +"ここでは、モニターするiptable規則が選択される様々な基準を設定することができま" +"す。" msgid "Hold Ctrl to select multiple items or to deselect entries." -msgstr "" +msgstr "複数の項目を選択または解除するには、Ctrlキーを押したままにします。" msgid "Host" -msgstr "" +msgstr "ホスト" msgid "Hostname" msgstr "ホスト名" @@ -210,96 +219,99 @@ msgid "Ignore source addresses" msgstr "" msgid "Incoming interface" -msgstr "" +msgstr "着信インターフェース" msgid "Interface Plugin Configuration" -msgstr "" +msgstr "インターフェース プラグイン設定" msgid "Interfaces" -msgstr "" +msgstr "インターフェース" msgid "Interrupts" -msgstr "" +msgstr "割込み" msgid "Interval for pings" -msgstr "" +msgstr "ping間隔" msgid "Iptables Plugin Configuration" -msgstr "" +msgstr "Iptables プラグイン設定" msgid "Leave unselected to automatically determine interfaces to monitor." msgstr "" +"モニターするインターフェースを自動的に決定するには、未選択のままにします。" msgid "Listen host" -msgstr "" +msgstr "待ち受けホスト" msgid "Listen port" -msgstr "" +msgstr "待ち受けポート" msgid "Listener interfaces" -msgstr "" +msgstr "待ち受けインターフェース" msgid "Load Plugin Configuration" -msgstr "" +msgstr "負荷プラグイン設定" msgid "" "Max values for a period can be used instead of averages when not using 'only " "average RRAs'" msgstr "" +"'RRAの平均のみ' を使用しないとき、平均値の代わりに一定期間の最大値を使用でき" +"ます。" msgid "Maximum allowed connections" -msgstr "" +msgstr "許可された最大接続数" msgid "Memory" -msgstr "" +msgstr "メモリー" msgid "Memory Plugin Configuration" -msgstr "" +msgstr "メモリー プラグイン設定" msgid "Monitor all except specified" msgstr "設定値以外の全てのインターフェースをモニターする" msgid "Monitor all local listen ports" -msgstr "" +msgstr "ローカルの全待ち受けポートをモニターする" msgid "Monitor all sensors" -msgstr "" +msgstr "全てのセンサーをモニターする" msgid "Monitor device(s) / thermal zone(s)" msgstr "" msgid "Monitor devices" -msgstr "" +msgstr "デバイスをモニターする" msgid "Monitor disks and partitions" -msgstr "" +msgstr "ディスクとパーティションをモニターする" msgid "Monitor filesystem types" -msgstr "" +msgstr "ファイルシステム タイプをモニターする" msgid "Monitor hosts" -msgstr "" +msgstr "ホストをモニターする" msgid "Monitor interfaces" msgstr "モニターするインターフェースの設定" msgid "Monitor interrupts" -msgstr "" +msgstr "割込みをモニターする" msgid "Monitor local ports" -msgstr "" +msgstr "ローカルのポートをモニターする" msgid "Monitor mount points" -msgstr "" +msgstr "マウントポイントをモニターする" msgid "Monitor processes" -msgstr "" +msgstr "プロセスをモニターする" msgid "Monitor remote ports" -msgstr "" +msgstr "リモートのポートをモニターする" msgid "Name of the rule" -msgstr "" +msgstr "ルール名" msgid "Netlink" msgstr "Netlink" @@ -332,19 +344,19 @@ msgid "Only create average RRAs" msgstr "平均値のRRAsのみ作成する" msgid "OpenVPN" -msgstr "" +msgstr "OpenVPN" msgid "OpenVPN Plugin Configuration" -msgstr "" +msgstr "OpenVPN プラグイン設定" msgid "OpenVPN status files" -msgstr "" +msgstr "OpenVPN ステータスファイル" msgid "Options" msgstr "オプション" msgid "Outgoing interface" -msgstr "" +msgstr "送信インターフェース" msgid "Output plugins" msgstr "出力プラグイン" @@ -359,28 +371,28 @@ msgid "Port" msgstr "ポート" msgid "Processes" -msgstr "" +msgstr "プロセス" msgid "Processes Plugin Configuration" -msgstr "" +msgstr "プロセス プラグイン設定" msgid "Processes to monitor separated by space" msgstr "" msgid "Processor" -msgstr "" +msgstr "プロセッサー" msgid "Qdisc monitoring" -msgstr "" +msgstr "Qdisc モニタリング" msgid "RRD XFiles Factor" msgstr "" msgid "RRD heart beat interval" -msgstr "" +msgstr "RRD ハートビート間隔" msgid "RRD step interval" -msgstr "" +msgstr "RRD stepインターバル" msgid "RRDTool" msgstr "RRDTool" @@ -398,46 +410,46 @@ msgid "Seconds" msgstr "秒" msgid "Sensor list" -msgstr "" +msgstr "センサー一覧" msgid "Sensors" -msgstr "" +msgstr "センサー" msgid "Sensors Plugin Configuration" -msgstr "" +msgstr "センサー プラグイン設定" msgid "Server host" -msgstr "" +msgstr "サーバー ホスト" msgid "Server port" -msgstr "" +msgstr "サーバー ポート" msgid "Setup" -msgstr "" +msgstr "設定" msgid "Shaping class monitoring" msgstr "" msgid "Show max values instead of averages" -msgstr "" +msgstr "平均値の代わりに最大値を表示する" msgid "Socket file" -msgstr "" +msgstr "ソケット ファイル" msgid "Socket group" -msgstr "" +msgstr "ソケット グループ" msgid "Socket permissions" -msgstr "" +msgstr "ソケット パーミッション" msgid "Source ip range" -msgstr "" +msgstr "ソースIPの範囲" msgid "Specifies what information to collect about links." -msgstr "" +msgstr "リンクについて、どのような情報を収集するか設定します。" msgid "Specifies what information to collect about routes." -msgstr "" +msgstr "ルートについて、どのような情報を収集するか設定します。" msgid "Specifies what information to collect about the global topology." msgstr "" @@ -449,40 +461,40 @@ msgid "Splash Leases Plugin Configuration" msgstr "" msgid "Statistics" -msgstr "" +msgstr "統計" msgid "Storage directory" msgstr "保存先ディレクトリ" msgid "Storage directory for the csv files" -msgstr "" +msgstr "CSVファイルの保存先ディレクトリ" msgid "Store data values as rates instead of absolute values" -msgstr "" +msgstr "データ値を絶対値の代わりにレートとして保存します。" msgid "Stored timespans" -msgstr "" +msgstr "保存する期間の範囲" msgid "System Load" -msgstr "" +msgstr "システム負荷" msgid "TCP Connections" -msgstr "" +msgstr "TCP 接続" msgid "TCPConns Plugin Configuration" -msgstr "" +msgstr "TCP接続プラグイン設定" msgid "TTL for network packets" -msgstr "" +msgstr "ネットワークパケットのTTL" msgid "TTL for ping packets" -msgstr "" +msgstr "pingパケットのTTL" msgid "Table" -msgstr "" +msgstr "テーブル" msgid "The NUT plugin reads information about Uninterruptible Power Supplies." -msgstr "" +msgstr "NUT プラグインは、無停電電源装置についての情報を読み取ります。" msgid "" "The OLSRd plugin reads information about meshed networks from the txtinfo " @@ -493,34 +505,43 @@ msgid "" "The OpenVPN plugin gathers information about the current vpn connection " "status." msgstr "" +"OpenVPN プラグインは、現在のVPN接続ステータスについての情報を収集します。" msgid "" "The conntrack plugin collects statistics about the number of tracked " "connections." -msgstr "" +msgstr "Conntrack プラグインは、追跡された接続の数についての統計を収集します。" msgid "The cpu plugin collects basic statistics about the processor usage." -msgstr "" +msgstr "CPU プラグインは、プロセッサー使用についての基本的な統計を収集します。" msgid "" "The csv plugin stores collected data in csv file format for further " "processing by external programs." msgstr "" +"CSV プラグインは、外部プログラムがさらに利用するために、収集されたデータをCSV" +"ファイル形式で保存します。" msgid "" "The df plugin collects statistics about the disk space usage on different " "devices, mount points or filesystem types." msgstr "" +"df プラグインは、個別のデバイスまたはマウントポイント、ファイルシステム形式の" +"ディスク使用量についての統計を収集します。" msgid "" "The disk plugin collects detailled usage statistics for selected partitions " "or whole disks." msgstr "" +"ディスク プラグインは、選択されたパーティションまたはディスク全体の詳細な使用" +"統計を収集します。" msgid "" "The dns plugin collects detailled statistics about dns related traffic on " "selected interfaces." msgstr "" +"DNS プラグインは、選択されたインターフェースでのDNSに関連したトラフィックにつ" +"いての詳細な統計を収集します。" msgid "" "The email plugin creates a unix socket which can be used to transmit email-" @@ -528,14 +549,21 @@ msgid "" "to be used in conjunction with Mail::SpamAssasin::Plugin::Collectd but can " "be used in other ways as well." msgstr "" +"Eメール プラグインは、実行中のcollectd デーモンへの電子メール統計の送信に利用" +"可能なUNIX ソケットを作成するプラグインです。このプラグインは、メール、" +"SpamAssasin、プラグイン、Collectdを一緒に使うことを主に意図していますが、ほか" +"の方法にも同様に使用することができます。" msgid "The entropy plugin collects statistics about the available entropy." msgstr "" +"エントロピー プラグインは、利用可能なエントロピーについての統計を収集します。" msgid "" "The exec plugin starts external commands to read values from or to notify " "external processes when certain threshold values have been reached." msgstr "" +"Exec プラグインは、特定の閾値に到達したときに外部プロセスから値の読み込み、も" +"しくは外部プロセスへ通知する外部コマンドを開始します。" msgid "" "The interface plugin collects traffic statistics on selected interfaces." @@ -547,11 +575,15 @@ msgid "" "The iptables plugin will monitor selected firewall rules and collect " "informations about processed bytes and packets per rule." msgstr "" +"iptables プラグインは、選択されたファイアウォール規をモニターし、規則ごとの処" +"理されたバイト数とパケット数についての情報を収集します。" msgid "" "The irq plugin will monitor the rate of issues per second for each selected " "interrupt. If no interrupt is selected then all interrupts are monitored." msgstr "" +"IRQ プラグインは、選択された割り込みごとに1秒当たりの発行レートをモニターしま" +"す。選択された割り込みが無い場合、すべての割り込みがモニターされます。" msgid "" "The iwinfo plugin collects statistics about wireless signal strength, noise " @@ -563,12 +595,14 @@ msgid "The load plugin collects statistics about the general system load." msgstr "負荷プラグインは、システム負荷の統計情報を収集します。" msgid "The memory plugin collects statistics about the memory usage." -msgstr "" +msgstr "メモリー プラグインは、メモリー使用についての統計を収集します。" msgid "" "The netlink plugin collects extended informations like qdisc-, class- and " "filter-statistics for selected interfaces." msgstr "" +"Netlink プラグインは、選択されたインターフェースの qdisc- や class- 、filter-" +"statistics のような拡張的な情報を収集します。" msgid "" "The network plugin provides network based communication between different " @@ -576,16 +610,25 @@ msgid "" "client mode locally collected data is transferred to a collectd server " "instance, in server mode the local instance receives data from other hosts." msgstr "" +"ネットワークプラグインは、異なるcollectd間のネットワークベースの通信を提供し" +"ます。collectdは、クライアントモードとサーバーモードの両方で動作することがで" +"きます。クライアントモードでは、ローカルの収集データはcollectdサーバーに転送" +"され、サーバーモードではローカルのインスタンスは他のホストからデータを受信し" +"ます。" msgid "" "The ping plugin will send icmp echo replies to selected hosts and measure " "the roundtrip time for each host." msgstr "" +"ping プラグインは、ICMP Echo Replyを選択されたホストに送信し、各ホストとの往" +"復時間を計測します。" msgid "" "The processes plugin collects informations like cpu time, page faults and " "memory usage of selected processes." msgstr "" +"プロセス プラグインは、選択されたプロセスのCPU時間やページフォルト、メモリー" +"使用率のような情報を収集します。" msgid "" "The rrdtool plugin stores the collected data in rrd database files, the " @@ -593,11 +636,17 @@ msgid "" "values will result in a very high memory consumption in the temporary " "directory. This can render the device unusable!" msgstr "" +"rrdtool プラグインは、収集したデータをrrd データベースファイルに保存します。" +"これが統計図の基礎です。

警告: 間違った値を設定すると、一" +"時的なディレクトリによってメモリー消費量が非常に高くなります。これはデバイス" +"を使用不能にする可能性があります!" msgid "" "The sensors plugin uses the Linux Sensors framework to gather environmental " "statistics." msgstr "" +"センサー プラグインは、環境統計の収集に Linux センサーフレームワークを使用し" +"ます。" msgid "" "The splash leases plugin uses libuci to collect statistics about splash " @@ -609,6 +658,9 @@ msgid "" "to gather data and RRDtool to " "render diagram images." msgstr "" +"statistics パッケージは、データの収集にCollectdを、統計図のレンダリングにRRDtoolを使用します。" msgid "" "The tcpconns plugin collects informations about open tcp connections on " @@ -619,57 +671,64 @@ msgid "" "The thermal plugin will monitor temperature of the system. Data is typically " "read from /sys/class/thermal/*/temp ( '*' denotes the thermal device to be " "read, e.g. thermal_zone1 )" -msgstr "" +msgstr "サーマル プラグインは、システムの温度をモニターします。" msgid "" "The unixsock plugin creates a unix socket which can be used to read " "collected data from a running collectd instance." msgstr "" +"unixsock プラグインは、実行中のcollectd インスタンスから収集データの読み取り" +"に使用可能なUNIX ソケットを作成します。" msgid "The uptime plugin collects statistics about the uptime of the system." -msgstr "" +msgstr "稼働時間 プラグインは、システムの稼働時間についての統計を収集します。" msgid "Thermal" -msgstr "" +msgstr "サーマル" msgid "Thermal Plugin Configuration" -msgstr "" +msgstr "サーマル プラグイン設定" msgid "This plugin collects statistics about the processor frequency scaling." msgstr "" +"このプラグインは、プロセッサー周波数スケーリングについての統計を収集します。" msgid "" "This section defines on which interfaces collectd will wait for incoming " "connections." msgstr "" +"このセクションでは、collectdが着信接続を待ち受けるインターフェースを設定しま" +"す。" msgid "" "This section defines to which servers the locally collected data is sent to." msgstr "" +"このセクションでは、ローカルに収集されたデータを送信するサーバーを設定しま" +"す。" msgid "Try to lookup fully qualified hostname" msgstr "" msgid "UPS" -msgstr "" +msgstr "UPS" msgid "UPS Plugin Configuration" -msgstr "" +msgstr "UPS プラグイン設定" msgid "UPS name in NUT ups@host format" -msgstr "" +msgstr "ups@host 形式のNUT内のUPS名" msgid "UnixSock" -msgstr "" +msgstr "UnixSock" msgid "Unixsock Plugin Configuration" -msgstr "" +msgstr "Unixsock プラグイン設定" msgid "Uptime" -msgstr "" +msgstr "稼働時間" msgid "Uptime Plugin Configuration" -msgstr "" +msgstr "稼働時間プラグイン設定" msgid "Use improved naming schema" msgstr "" @@ -678,13 +737,13 @@ msgid "Used PID file" msgstr "使用するPIDファイルの保存場所" msgid "User" -msgstr "" +msgstr "ユーザー" msgid "Verbose monitoring" -msgstr "" +msgstr "詳細モニタリング" msgid "Wireless" -msgstr "" +msgstr "無線" msgid "Wireless iwinfo Plugin Configuration" msgstr "無線LAN iwinfo プラグイン設定" @@ -692,18 +751,20 @@ msgstr "無線LAN iwinfo プラグイン設定" msgid "" "You can install additional collectd-mod-* plugins to enable more statistics." msgstr "" +"追加の collectd-mod-* プラグインをインストールすることで、より多くの統計を有" +"効にできます。" msgid "e.g. br-ff" -msgstr "" +msgstr "例: br-ff" msgid "e.g. br-lan" -msgstr "" +msgstr "例: br-lan" msgid "e.g. reject-with tcp-reset" -msgstr "" +msgstr "例: reject-with tcp-reset" msgid "max. 16 chars" -msgstr "" +msgstr "最大16文字" msgid "reduces rrd size" msgstr "rrdファイルのサイズを小さくします。" @@ -712,7 +773,7 @@ msgid "seconds; multiple separated by space" msgstr "" msgid "server interfaces" -msgstr "" +msgstr "サーバー インターフェース" #~ msgid "Collectd" #~ msgstr "Collectd" diff --git a/package/luci/applications/luci-app-travelmate/po/ja/travelmate.po b/package/luci/applications/luci-app-travelmate/po/ja/travelmate.po new file mode 100644 index 0000000000..986d7b32b6 --- /dev/null +++ b/package/luci/applications/luci-app-travelmate/po/ja/travelmate.po @@ -0,0 +1,72 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.11\n" +"Last-Translator: INAGAKI Hiroshi \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: ja\n" + +msgid "" +"Brief advice: Create a wwan interface, configure it to use dhcp and add it " +"to the wan zone in firewall. Create the wifi interfaces to be used ('client' " +"mode, assigned to wwan network, left as disabled). Travelmate will try to " +"connect to the known wifi client interfaces in the defined order." +msgstr "" +"簡単な解説: 予めWWANインターフェースを作成し、DHCPを使用するよう構成してファ" +"イアウォールのWANゾーンに追加します。また、使用される無線インターフェースを作" +"成しておきます(\"クライアント\" モード、WWANに割り当て、無効状態)。" +"Travelmateは、登録されている順序で既知の無線クライアント インターフェースへの" +"接続を試行します。" + +msgid "" +"Configuration of the Travelmate package to enable travel router " +"functionality." +msgstr "トラベル ルータ機能を有効にする、Travelmate パッケージの設定です。" + +msgid "Debug logging" +msgstr "デバッグ ログ" + +msgid "Default 3, range 0-10. Set to 0 to allow unlimited retries" +msgstr "既定値 3、範囲 0 - 10。再試行回数を制限しない場合、0 に設定します。" + +msgid "Default 30, range 5-60" +msgstr "既定値 30、範囲 5 - 60" + +msgid "Default: empty = use all radios." +msgstr "デフォルト:(空)= 全ての無線を使用" + +msgid "Disable this if you want to use iwinfo instead of iw" +msgstr "iw の代わりに iwinfo を使用したい場合、この設定を無効にします。" + +msgid "Enable Travelmate" +msgstr "Travelmateの有効化" + +msgid "Extra options" +msgstr "拡張オプション" + +msgid "Global options" +msgstr "全般オプション" + +msgid "Link to detailed advice" +msgstr "詳細な解説へのリンク" + +msgid "Loop timeout in seconds for wlan monitoring" +msgstr "無線LAN モニターのループ タイムアウト(秒)" + +msgid "Max. number of connection retries to an uplink" +msgstr "確立までの接続試行回数" + +msgid "Travelmate" +msgstr "Travelmate" + +msgid "Use iw for scanning" +msgstr "スキャンに iw を使用する" + +msgid "Use only one radio, e.g. 'radio0'" +msgstr "単一の無線のみ使用する 例: 'radio0'" diff --git a/package/luci/applications/luci-app-uhttpd/po/ja/uhttpd.po b/package/luci/applications/luci-app-uhttpd/po/ja/uhttpd.po new file mode 100644 index 0000000000..5729034046 --- /dev/null +++ b/package/luci/applications/luci-app-uhttpd/po/ja/uhttpd.po @@ -0,0 +1,213 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2017-01-01 18:11+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" +"Language-Team: \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.11\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "" +"(/old/path=/new/path) or (just /old/path which becomes /cgi-prefix/old/path)" +msgstr "" +"(/old/path=/new/path) または (just /old/path which becomes /cgi-prefix/old/" +"path)" + +msgid "404 Error" +msgstr "404 エラー" + +msgid "A lightweight single-threaded HTTP(S) server" +msgstr "軽量なシングル スレッド HTTP(S) サーバーです。" + +msgid "Advanced Settings" +msgstr "詳細設定" + +msgid "Aliases" +msgstr "エイリアス" + +msgid "Base directory for files to be served" +msgstr "サーバーがホストするファイルのベースディレクトリです。" + +msgid "Bind to specific interface:port (by specifying interface address" +msgstr "" +"インターフェースのアドレスを使用して、特定のインターフェースとポートに関連付" +"けます。" + +msgid "CGI filetype handler" +msgstr "CGIファイル形式 ハンドラー" + +msgid "CGI is disabled if not present." +msgstr "指定しない場合、CGIは無効になります。" + +msgid "Config file (e.g. for credentials for Basic Auth)" +msgstr "設定ファイル(例: 基本認証用の資格情報)" + +msgid "Connection reuse" +msgstr "接続の再使用" + +msgid "Country" +msgstr "国" + +msgid "Disable JSON-RPC authorization via ubus session API" +msgstr "ubus セッションAPI経由のJSON-RPC認証を無効にする" + +msgid "Do not follow symlinks outside document root" +msgstr "ドキュメント ルート外へのシンボリックリンクを追随しない" + +msgid "Do not generate directory listings." +msgstr "ディレクトリの待ち受けを生成しない" + +msgid "Document root" +msgstr "ドキュメント ルート" + +msgid "E.g specify with index.html and index.php when using PHP" +msgstr "index.html や、PHPを使用しているときは index.php を設定します。" + +msgid "Embedded Lua interpreter is disabled if not present." +msgstr "指定しない場合、組込みLua インタープリタは無効になります。" + +msgid "Enable JSON-RPC Cross-Origin Resource Support" +msgstr "" + +msgid "For settings primarily geared to serving more than the web UI" +msgstr "主に、Web UI以上のものを提供することを対象とした設定です。" + +msgid "Full Web Server Settings" +msgstr "完全なWebサーバー設定" + +msgid "Full real path to handler for Lua scripts" +msgstr "Lua スクリプトへの絶対パス" + +msgid "General Settings" +msgstr "一般設定" + +msgid "HTTP listeners (address:port)" +msgstr "HTTP 待ち受け(アドレス:ポート)" + +msgid "HTTPS Certificate (DER Encoded)" +msgstr "HTTPS 証明書(DER エンコード)" + +msgid "HTTPS Private Key (DER Encoded)" +msgstr "HTTPS 秘密鍵(DER エンコード)" + +msgid "HTTPS listener (address:port)" +msgstr "HTTPS 待ち受け(アドレス:ポート)" + +msgid "Ignore private IPs on public interface" +msgstr "公開側インターフェースでのプライベートIPを無視する" + +msgid "Index page(s)" +msgstr "インデックス ページ" + +msgid "" +"Interpreter to associate with file endings ('suffix=handler', e.g. '.php=/" +"usr/bin/php-cgi')" +msgstr "" +"ファイル拡張子に関連付けるインタープリタです。('suffix=handler'、例: '.php=/" +"usr/bin/php-cgi')" + +msgid "Length of key in bits" +msgstr "鍵のビット数" + +msgid "Location" +msgstr "場所" + +msgid "Maximum number of connections" +msgstr "最大接続数" + +msgid "Maximum number of script requests" +msgstr "スクリプトの最大リクエスト数" + +msgid "Maximum wait time for Lua, CGI, or ubus execution" +msgstr "LuaやCGI、ubus実行の最大待機時間" + +msgid "Maximum wait time for network activity" +msgstr "ネットワークアクティビティの最大待機時間" + +msgid "Override path for ubus socket" +msgstr "ubus ソケットのパスを上書きする" + +msgid "Path prefix for CGI scripts" +msgstr "CGI スクリプトのパスプレフィクス" + +msgid "" +"Prevent access from private (RFC1918) IPs on an interface if it has an " +"public IP address" +msgstr "" +"グローバル IPアドレスを持つインターフェースでは、プライベート IP (RFC1918) か" +"らのアクセスをブロックします。" + +msgid "Realm for Basic Auth" +msgstr "基本認証の領域名" + +msgid "Redirect all HTTP to HTTPS" +msgstr "全てのHTTPをHTTPSにリダイレクトする" + +msgid "Remove configuration for certificate and key" +msgstr "証明書と鍵の設定を削除する" + +msgid "Remove old certificate and key" +msgstr "古い証明書と鍵を削除する" + +msgid "Server Hostname" +msgstr "サーバー ホスト名" + +msgid "" +"Settings which are either rarely needed or which affect serving the WebUI" +msgstr "まれに必要とされる設定、またはWeb UIに影響する設定です。" + +msgid "State" +msgstr "ステータス" + +msgid "TCP Keepalive" +msgstr "TCP キープアライブ" + +msgid "This permanently deletes the cert, key, and configuration to use same." +msgstr "" + +msgid "Valid for # of Days" +msgstr "有効日数" + +msgid "" +"Virtual URL or CGI script to display on status '404 Not Found'. Must begin " +"with '/'" +msgstr "" + +msgid "Virtual path prefix for Lua scripts" +msgstr "Lua スクリプトへの仮想パスプレフィクス" + +msgid "Virtual path prefix for ubus via JSON-RPC integration" +msgstr "" + +msgid "Will not use HTTP authentication if not present" +msgstr "指定しない場合、HTTP 認証は使用されません。" + +msgid "a.k.a CommonName" +msgstr "共通名" + +msgid "uHTTPd" +msgstr "uHTTPd" + +msgid "uHTTPd Self-signed Certificate Parameters" +msgstr "uHTTPd 自己署名証明書 パラメーター" + +msgid "" +"uHTTPd will generate a new self-signed certificate using the configuration " +"shown below." +msgstr "uHTTPd は、以下に表示した設定で新しい自己署名証明書を生成します。" + +msgid "ubus integration is disabled if not present" +msgstr "" + +#~ msgid "" +#~ "Virtual URL or CGI script to display on status '404 Not Found'. Must " +#~ "begin with '/'" +#~ msgstr "" +#~ "'404 Not Found' ステータスを表示する、仮想URLまたはCGIスクリプトです。'/' " +#~ "から始まる必要があります。" diff --git a/package/luci/applications/luci-app-uhttpd/po/templates/uhttpd.pot b/package/luci/applications/luci-app-uhttpd/po/templates/uhttpd.pot new file mode 100644 index 0000000000..5503450e0a --- /dev/null +++ b/package/luci/applications/luci-app-uhttpd/po/templates/uhttpd.pot @@ -0,0 +1,186 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "" +"(/old/path=/new/path) or (just /old/path which becomes /cgi-prefix/old/path)" +msgstr "" + +msgid "404 Error" +msgstr "" + +msgid "A lightweight single-threaded HTTP(S) server" +msgstr "" + +msgid "Advanced Settings" +msgstr "" + +msgid "Aliases" +msgstr "" + +msgid "Base directory for files to be served" +msgstr "" + +msgid "Bind to specific interface:port (by specifying interface address" +msgstr "" + +msgid "CGI filetype handler" +msgstr "" + +msgid "CGI is disabled if not present." +msgstr "" + +msgid "Config file (e.g. for credentials for Basic Auth)" +msgstr "" + +msgid "Connection reuse" +msgstr "" + +msgid "Country" +msgstr "" + +msgid "Disable JSON-RPC authorization via ubus session API" +msgstr "" + +msgid "Do not follow symlinks outside document root" +msgstr "" + +msgid "Do not generate directory listings." +msgstr "" + +msgid "Document root" +msgstr "" + +msgid "E.g specify with index.html and index.php when using PHP" +msgstr "" + +msgid "Embedded Lua interpreter is disabled if not present." +msgstr "" + +msgid "Enable JSON-RPC Cross-Origin Resource Support" +msgstr "" + +msgid "For settings primarily geared to serving more than the web UI" +msgstr "" + +msgid "Full Web Server Settings" +msgstr "" + +msgid "Full real path to handler for Lua scripts" +msgstr "" + +msgid "General Settings" +msgstr "" + +msgid "HTTP listeners (address:port)" +msgstr "" + +msgid "HTTPS Certificate (DER Encoded)" +msgstr "" + +msgid "HTTPS Private Key (DER Encoded)" +msgstr "" + +msgid "HTTPS listener (address:port)" +msgstr "" + +msgid "Ignore private IPs on public interface" +msgstr "" + +msgid "Index page(s)" +msgstr "" + +msgid "" +"Interpreter to associate with file endings ('suffix=handler', e.g. '.php=/" +"usr/bin/php-cgi')" +msgstr "" + +msgid "Length of key in bits" +msgstr "" + +msgid "Location" +msgstr "" + +msgid "Maximum number of connections" +msgstr "" + +msgid "Maximum number of script requests" +msgstr "" + +msgid "Maximum wait time for Lua, CGI, or ubus execution" +msgstr "" + +msgid "Maximum wait time for network activity" +msgstr "" + +msgid "Override path for ubus socket" +msgstr "" + +msgid "Path prefix for CGI scripts" +msgstr "" + +msgid "" +"Prevent access from private (RFC1918) IPs on an interface if it has an " +"public IP address" +msgstr "" + +msgid "Realm for Basic Auth" +msgstr "" + +msgid "Redirect all HTTP to HTTPS" +msgstr "" + +msgid "Remove configuration for certificate and key" +msgstr "" + +msgid "Remove old certificate and key" +msgstr "" + +msgid "Server Hostname" +msgstr "" + +msgid "" +"Settings which are either rarely needed or which affect serving the WebUI" +msgstr "" + +msgid "State" +msgstr "" + +msgid "TCP Keepalive" +msgstr "" + +msgid "This permanently deletes the cert, key, and configuration to use same." +msgstr "" + +msgid "Valid for # of Days" +msgstr "" + +msgid "" +"Virtual URL or CGI script to display on status '404 Not Found'. Must begin " +"with '/'" +msgstr "" + +msgid "Virtual path prefix for Lua scripts" +msgstr "" + +msgid "Virtual path prefix for ubus via JSON-RPC integration" +msgstr "" + +msgid "Will not use HTTP authentication if not present" +msgstr "" + +msgid "a.k.a CommonName" +msgstr "" + +msgid "uHTTPd" +msgstr "" + +msgid "uHTTPd Self-signed Certificate Parameters" +msgstr "" + +msgid "" +"uHTTPd will generate a new self-signed certificate using the configuration " +"shown below." +msgstr "" + +msgid "ubus integration is disabled if not present" +msgstr "" diff --git a/package/luci/applications/luci-app-upnp/po/ja/upnp.po b/package/luci/applications/luci-app-upnp/po/ja/upnp.po index ec9208d257..f0aff7336a 100644 --- a/package/luci/applications/luci-app-upnp/po/ja/upnp.po +++ b/package/luci/applications/luci-app-upnp/po/ja/upnp.po @@ -1,17 +1,17 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-05-19 19:36+0200\n" -"PO-Revision-Date: 2013-10-05 17:27+0200\n" -"Last-Translator: Kentaro \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2016-12-24 19:55+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Pootle 2.0.6\n" +"X-Generator: Poedit 1.8.11\n" +"Language-Team: \n" msgid "" "ACLs specify which external ports may be redirected to which internal " @@ -30,7 +30,7 @@ msgid "Advanced Settings" msgstr "詳細設定" msgid "Allow adding forwards only to requesting ip addresses" -msgstr "" +msgstr "要求元IPアドレスへの転送のみ、追加を許可します。" msgid "Announced model number" msgstr "通知するモデル番号" @@ -136,18 +136,20 @@ msgid "UPnP lease file" msgstr "UPnP リースファイル" msgid "Universal Plug & Play" -msgstr "ユニバーサル プラグ & プレイ" +msgstr "ユニバーサル プラグ & プレイ" msgid "Uplink" msgstr "アップリンク" msgid "Value in KByte/s, informational only" -msgstr "" +msgstr "クライアントへの情報提供のみに使用される、KByte/sの値です。" #~ msgid "" #~ "UPNP allows clients in the local network to automatically configure the " #~ "router." -#~ msgstr "UPnPを使用することで、ローカルネットワーク内のクライアントが自動的にルータを構成することができます。" +#~ msgstr "" +#~ "UPnPを使用することで、ローカルネットワーク内のクライアントが自動的にルータ" +#~ "を構成することができます。" #~ msgid "enable" #~ msgstr "有効" diff --git a/package/luci/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua b/package/luci/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua index a33c7aab9a..261cf36d0f 100644 --- a/package/luci/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua +++ b/package/luci/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua @@ -12,21 +12,31 @@ -- -- Author: Nils Koenig -module("luci.controller.wifischedule.wifi_schedule", package.seeall) +module("luci.controller.wifischedule.wifi_schedule", package.seeall) + +local fs = require "nixio.fs" +local sys = require "luci.sys" +local template = require "luci.template" +local i18n = require "luci.i18n" function index() - entry({"admin", "wifi_schedule"}, firstchild(), "Wifi Schedule", 60).dependent=false - entry({"admin", "wifi_schedule", "tab_from_cbi"}, cbi("wifischedule/wifi_schedule"), "Schedule", 1) - entry({"admin", "wifi_schedule", "wifi_schedule"}, call("wifi_schedule_log"), "View Logfile", 2) - entry({"admin", "wifi_schedule", "cronjob"}, call("view_crontab"), "View Cron Jobs", 3) + if not nixio.fs.access("/etc/config/wifi_schedule") then + return + end + entry({"admin", "services", "wifi_schedule"}, firstchild(), _("Wifi Schedule"), 60).dependent=false + entry({"admin", "services", "wifi_schedule", "tab_from_cbi"}, cbi("wifischedule/wifi_schedule"), _("Schedule"), 1) + entry({"admin", "services", "wifi_schedule", "wifi_schedule"}, call("wifi_schedule_log"), _("View Logfile"), 2) + entry({"admin", "services", "wifi_schedule", "cronjob"}, call("view_crontab"), _("View Cron Jobs"), 3) end function wifi_schedule_log() - local logfile = luci.sys.exec("cat /tmp/log/wifi_schedule.log") - luci.template.render("wifischedule/file_viewer", {title="Wifi Schedule Logfile", content=logfile}) + local logfile = fs.readfile("/tmp/log/wifi_schedule.log") or "" + template.render("wifischedule/file_viewer", + {title = i18n.translate("Wifi Schedule Logfile"), content = logfile}) end function view_crontab() - local crontab = luci.sys.exec("cat /etc/crontabs/root") - luci.template.render("wifischedule/file_viewer", {title="Cron Jobs", content=crontab}) + local crontab = fs.readfile("/etc/crontabs/root") or "" + template.render("wifischedule/file_viewer", + {title = i18n.translate("Cron Jobs"), content = crontab}) end diff --git a/package/luci/applications/luci-app-wifischedule/luasrc/model/cbi/wifischedule/wifi_schedule.lua b/package/luci/applications/luci-app-wifischedule/luasrc/model/cbi/wifischedule/wifi_schedule.lua index 2cca476b4f..1d301219a8 100644 --- a/package/luci/applications/luci-app-wifischedule/luasrc/model/cbi/wifischedule/wifi_schedule.lua +++ b/package/luci/applications/luci-app-wifischedule/luasrc/model/cbi/wifischedule/wifi_schedule.lua @@ -12,15 +12,11 @@ -- -- Author: Nils Koenig -function file_exists(name) - local f=io.open(name,"r") - if f~=nil then io.close(f) return true else return false end -end - +local fs = require "nixio.fs" +local sys = require "luci.sys" function time_validator(self, value, desc) if value ~= nil then - h_str, m_str = string.match(value, "^(%d%d?):(%d%d?)$") h = tonumber(h_str) m = tonumber(m_str) @@ -32,21 +28,21 @@ function time_validator(self, value, desc) m <= 59) then return value end - end - return nil, translate("The value '" .. desc .. "' is invalid") + end + return nil, translatef("The value %s is invalid", desc) end -- ------------------------------------------------------------------------------------------------- -- BEGIN Map -m = Map("wifi_schedule", translate("Wifi Schedule"), translate("Defines a schedule when to turn on and off wifi.")) +m = Map("wifi_schedule", translate("Wifi Schedule"), translate("Defines a schedule when to turn on and off wifi.")) function m.on_commit(self) - luci.sys.exec("/usr/bin/wifi_schedule.sh cron") + sys.exec("/usr/bin/wifi_schedule.sh cron") end -- END Map -- BEGIN Global Section -global_section = m:section(TypedSection, "global", "Global Settings") +global_section = m:section(TypedSection, "global", translate("Global Settings")) global_section.optional = false global_section.rmempty = false global_section.anonymous = true @@ -54,13 +50,13 @@ global_section.anonymous = true -- BEGIN Global Enable Checkbox global_enable = global_section:option(Flag, "enabled", translate("Enable Wifi Schedule")) -global_enable.optional=false; -global_enable.rmempty = false; +global_enable.optional = false +global_enable.rmempty = false function global_enable.validate(self, value, global_section) if value == "1" then - if ( file_exists("/sbin/wifi") and - file_exists("/usr/bin/wifi_schedule.sh") )then + if ( fs.access("/sbin/wifi") and + fs.access("/usr/bin/wifi_schedule.sh") )then return value else return nil, translate("Could not find required /usr/bin/wifi_schedule.sh or /sbin/wifi") @@ -71,39 +67,38 @@ function global_enable.validate(self, value, global_section) end -- END Global Enable Checkbox - -- BEGIN Global Logging Checkbox global_logging = global_section:option(Flag, "logging", translate("Enable logging")) -global_logging.optional=false; -global_logging.rmempty = false; +global_logging.optional = false +global_logging.rmempty = false global_logging.default = 0 -- END Global Enable Checkbox -- BEGIN Global Activate WiFi Button enable_wifi = global_section:option(Button, "enable_wifi", translate("Activate wifi")) function enable_wifi.write() - luci.sys.exec("/usr/bin/wifi_schedule.sh start manual") + sys.exec("/usr/bin/wifi_schedule.sh start manual") end -- END Global Activate Wifi Button -- BEGIN Global Disable WiFi Gracefully Button disable_wifi_gracefully = global_section:option(Button, "disable_wifi_gracefully", translate("Disable wifi gracefully")) function disable_wifi_gracefully.write() - luci.sys.exec("/usr/bin/wifi_schedule.sh stop manual") + sys.exec("/usr/bin/wifi_schedule.sh stop manual") end --- END Global Disable Wifi Gracefully Button +-- END Global Disable Wifi Gracefully Button -- BEGIN Disable WiFi Forced Button disable_wifi_forced = global_section:option(Button, "disable_wifi_forced", translate("Disabled wifi forced")) function disable_wifi_forced.write() - luci.sys.exec("/usr/bin/wifi_schedule.sh forcestop manual") + sys.exec("/usr/bin/wifi_schedule.sh forcestop manual") end -- END Global Disable WiFi Forced Button -- BEGIN Global Unload Modules Checkbox global_unload_modules = global_section:option(Flag, "unload_modules", translate("Unload Modules (experimental; saves more power)")) -global_unload_modules.optional = false; -global_unload_modules.rmempty = false; +global_unload_modules.optional = false +global_unload_modules.rmempty = false global_unload_modules.default = 0 -- END Global Unload Modules Checkbox @@ -111,13 +106,13 @@ global_unload_modules.default = 0 -- BEGIN Modules modules = global_section:option(TextValue, "modules", "") modules:depends("unload_modules", global_unload_modules.enabled); -modules.wrap = "off" -modules.rows = 10 +modules.wrap = "off" +modules.rows = 10 function modules.cfgvalue(self, section) - mod=uci.get("wifi_schedule", section, "modules") + mod = uci.get("wifi_schedule", section, "modules") if mod == nil then - mod="" + mod = "" end return mod:gsub(" ", "\r\n") end @@ -131,45 +126,44 @@ function modules.write(self, section, value) end -- END Modules --- BEGIN Determine Modules +-- BEGIN Determine Modules determine_modules = global_section:option(Button, "determine_modules", translate("Determine Modules Automatically")) determine_modules:depends("unload_modules", global_unload_modules.enabled); function determine_modules.write(self, section) - output = luci.sys.exec("/usr/bin/wifi_schedule.sh getmodules") + output = sys.exec("/usr/bin/wifi_schedule.sh getmodules") modules:write(section, output) end -- END Determine Modules - -- BEGIN Section -d = m:section(TypedSection, "entry", "Schedule events") -d.addremove = true +d = m:section(TypedSection, "entry", translate("Schedule events")) +d.addremove = true --d.anonymous = true -- END Section -- BEGIN Enable Checkbox c = d:option(Flag, "enabled", translate("Enable")) -c.optional=false; c.rmempty = false; +c.optional = false +c.rmempty = false -- END Enable Checkbox - -- BEGIN Day(s) of Week dow = d:option(MultiValue, "daysofweek", translate("Day(s) of Week")) dow.optional = false dow.rmempty = false -dow:value("Monday") -dow:value("Tuesday") -dow:value("Wednesday") -dow:value("Thursday") -dow:value("Friday") -dow:value("Saturday") -dow:value("Sunday") +dow:value("Monday", translate("Monday")) +dow:value("Tuesday", translate("Tuesday")) +dow:value("Wednesday", translate("Wednesday")) +dow:value("Thursday", translate("Thursday")) +dow:value("Friday", translate("Friday")) +dow:value("Saturday", translate("Saturday")) +dow:value("Sunday", translate("Sunday")) -- END Day(s) of Weel -- BEGIN Start Wifi Dropdown starttime = d:option(Value, "starttime", translate("Start WiFi")) -starttime.optional=false; -starttime.rmempty = false; +starttime.optional = false +starttime.rmempty = false starttime:value("00:00") starttime:value("01:00") starttime:value("02:00") @@ -198,14 +192,12 @@ starttime:value("23:00") function starttime.validate(self, value, d) return time_validator(self, value, translate("Start Time")) end - -- END Start Wifi Dropdown - -- BEGIN Stop Wifi Dropdown -stoptime = d:option(Value, "stoptime", translate("Stop WiFi")) -stoptime.optional=false; -stoptime.rmempty = false; +stoptime = d:option(Value, "stoptime", translate("Stop WiFi")) +stoptime.optional = false +stoptime.rmempty = false stoptime:value("00:00") stoptime:value("01:00") stoptime:value("02:00") @@ -236,15 +228,14 @@ function stoptime.validate(self, value, d) end -- END Stop Wifi Dropdown - -- BEGIN Force Wifi Stop Checkbox force_wifi = d:option(Flag, "forcewifidown", translate("Force disabling wifi even if stations associated")) force_wifi.default = false -force_wifi.rmempty = false; +force_wifi.rmempty = false function force_wifi.validate(self, value, d) if value == "0" then - if file_exists("/usr/bin/iwinfo") then + if fs.access("/usr/bin/iwinfo") then return value else return nil, translate("Could not find required programm /usr/bin/iwinfo") @@ -255,5 +246,4 @@ function force_wifi.validate(self, value, d) end -- END Force Wifi Checkbox - return m diff --git a/package/luci/applications/luci-app-wifischedule/po/ja/wifischedule.po b/package/luci/applications/luci-app-wifischedule/po/ja/wifischedule.po new file mode 100644 index 0000000000..3bc7864ad7 --- /dev/null +++ b/package/luci/applications/luci-app-wifischedule/po/ja/wifischedule.po @@ -0,0 +1,112 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: INAGAKI Hiroshi \n" +"Language-Team: \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.11\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "Activate wifi" +msgstr "WiFiのアクティブ化" + +msgid "Could not find required /usr/bin/wifi_schedule.sh or /sbin/wifi" +msgstr "必須の /usr/bin/wifi_schedule.sh または /sbin/wifi が見つかりませんでした。" + +msgid "Could not find required programm /usr/bin/iwinfo" +msgstr "必須のプログラム /usr/bin/iwinfo が見つかりませんでした。" + +msgid "Cron Jobs" +msgstr "Cronジョブ" + +msgid "Day(s) of Week" +msgstr "曜日" + +msgid "Defines a schedule when to turn on and off wifi." +msgstr "WiFiのオンとオフを切り替えるスケジュールを設定します。" + +msgid "Determine Modules Automatically" +msgstr "モジュールを自動的に決定する" + +msgid "Disable wifi gracefully" +msgstr "WiFiの通常終了" + +msgid "Disabled wifi forced" +msgstr "WiFiの強制終了" + +msgid "Enable" +msgstr "有効" + +msgid "Enable Wifi Schedule" +msgstr "WiFi スケジュールの有効化" + +msgid "Enable logging" +msgstr "ログの有効化" + +msgid "Force disabling wifi even if stations associated" +msgstr "ステーションが関連付けられていてもWiFiを強制終了する" + +msgid "Friday" +msgstr "金曜日" + +msgid "Global Settings" +msgstr "全体設定" + +msgid "Monday" +msgstr "月曜日" + +msgid "Saturday" +msgstr "土曜日" + +msgid "Schedule" +msgstr "スケジュール" + +msgid "Schedule events" +msgstr "実行スケジュール" + +msgid "Start Time" +msgstr "開始時刻" + +msgid "Start WiFi" +msgstr "WiFiの開始" + +msgid "Stop Time" +msgstr "停止時刻" + +msgid "Stop WiFi" +msgstr "WiFiの停止" + +msgid "Sunday" +msgstr "日曜日" + +msgid "The value %s is invalid" +msgstr "%s の値が無効です" + +msgid "Thursday" +msgstr "木曜日" + +msgid "Tuesday" +msgstr "火曜日" + +msgid "Unload Modules (experimental; saves more power)" +msgstr "モジュールのアンロード(実験的、より省電力)" + +msgid "View Cron Jobs" +msgstr "Cronジョブの確認" + +msgid "View Logfile" +msgstr "ログファイルの確認" + +msgid "Wednesday" +msgstr "水曜日" + +msgid "Wifi Schedule" +msgstr "WiFi スケジュール" + +msgid "Wifi Schedule Logfile" +msgstr "WiFiスケジュール ログファイル" diff --git a/package/luci/applications/luci-app-wifischedule/po/templates/wifischedule.pot b/package/luci/applications/luci-app-wifischedule/po/templates/wifischedule.pot new file mode 100644 index 0000000000..639c432e5e --- /dev/null +++ b/package/luci/applications/luci-app-wifischedule/po/templates/wifischedule.pot @@ -0,0 +1,101 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "Activate wifi" +msgstr "" + +msgid "Could not find required /usr/bin/wifi_schedule.sh or /sbin/wifi" +msgstr "" + +msgid "Could not find required programm /usr/bin/iwinfo" +msgstr "" + +msgid "Cron Jobs" +msgstr "" + +msgid "Day(s) of Week" +msgstr "" + +msgid "Defines a schedule when to turn on and off wifi." +msgstr "" + +msgid "Determine Modules Automatically" +msgstr "" + +msgid "Disable wifi gracefully" +msgstr "" + +msgid "Disabled wifi forced" +msgstr "" + +msgid "Enable" +msgstr "" + +msgid "Enable Wifi Schedule" +msgstr "" + +msgid "Enable logging" +msgstr "" + +msgid "Force disabling wifi even if stations associated" +msgstr "" + +msgid "Friday" +msgstr "" + +msgid "Global Settings" +msgstr "" + +msgid "Monday" +msgstr "" + +msgid "Saturday" +msgstr "" + +msgid "Schedule" +msgstr "" + +msgid "Schedule events" +msgstr "" + +msgid "Start Time" +msgstr "" + +msgid "Start WiFi" +msgstr "" + +msgid "Stop Time" +msgstr "" + +msgid "Stop WiFi" +msgstr "" + +msgid "Sunday" +msgstr "" + +msgid "The value %s is invalid" +msgstr "" + +msgid "Thursday" +msgstr "" + +msgid "Tuesday" +msgstr "" + +msgid "Unload Modules (experimental; saves more power)" +msgstr "" + +msgid "View Cron Jobs" +msgstr "" + +msgid "View Logfile" +msgstr "" + +msgid "Wednesday" +msgstr "" + +msgid "Wifi Schedule" +msgstr "" + +msgid "Wifi Schedule Logfile" +msgstr "" diff --git a/package/luci/applications/luci-app-wifischedule/po/zh-cn/wifischedule.po b/package/luci/applications/luci-app-wifischedule/po/zh-cn/wifischedule.po new file mode 100644 index 0000000000..ab3a8d0bf3 --- /dev/null +++ b/package/luci/applications/luci-app-wifischedule/po/zh-cn/wifischedule.po @@ -0,0 +1,101 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "Activate wifi" +msgstr "激活 WiFi" + +msgid "Could not find required /usr/bin/wifi_schedule.sh or /sbin/wifi" +msgstr "无法找到必需的 /usr/bin/wifi_schedule.sh 或 /sbin/wifi" + +msgid "Could not find required programm /usr/bin/iwinfo" +msgstr "无法找到必需程序:/usr/bin/iwinfo" + +msgid "Cron Jobs" +msgstr "计划任务" + +msgid "Day(s) of Week" +msgstr "星期" + +msgid "Defines a schedule when to turn on and off wifi." +msgstr "定义自动打开和关闭 WiFi 的计划表" + +msgid "Determine Modules Automatically" +msgstr "自动确定模块" + +msgid "Disable wifi gracefully" +msgstr "正常关闭 WiFi" + +msgid "Disabled wifi forced" +msgstr "强制关闭 WiFi" + +msgid "Enable" +msgstr "启用" + +msgid "Enable Wifi Schedule" +msgstr "启用 WiFi 计划" + +msgid "Enable logging" +msgstr "启用日志" + +msgid "Force disabling wifi even if stations associated" +msgstr "即使有设备连接也强制关闭 WiFi" + +msgid "Friday" +msgstr "星期五" + +msgid "Global Settings" +msgstr "全局设置" + +msgid "Monday" +msgstr "星期一" + +msgid "Saturday" +msgstr "星期六" + +msgid "Schedule" +msgstr "计划表" + +msgid "Schedule events" +msgstr "计划事件" + +msgid "Start Time" +msgstr "启动时间" + +msgid "Start WiFi" +msgstr "启动 WiFi" + +msgid "Stop Time" +msgstr "关闭时间" + +msgid "Stop WiFi" +msgstr "关闭 WiFi" + +msgid "Sunday" +msgstr "星期日" + +msgid "The value %s is invalid" +msgstr "%s 的值无效" + +msgid "Thursday" +msgstr "星期四" + +msgid "Tuesday" +msgstr "星期二" + +msgid "Unload Modules (experimental; saves more power)" +msgstr "卸载模块(实验性的,节省更多电量)" + +msgid "View Cron Jobs" +msgstr "查看计划任务" + +msgid "View Logfile" +msgstr "查看日志文件" + +msgid "Wednesday" +msgstr "星期三" + +msgid "Wifi Schedule" +msgstr "WiFi 计划" + +msgid "Wifi Schedule Logfile" +msgstr "WiFi 计划日志文件" diff --git a/package/luci/collections/luci-ssl-openssl/Makefile b/package/luci/collections/luci-ssl-openssl/Makefile index 37442a37dc..b5f4b091b1 100644 --- a/package/luci/collections/luci-ssl-openssl/Makefile +++ b/package/luci/collections/luci-ssl-openssl/Makefile @@ -11,7 +11,9 @@ LUCI_BASENAME:=ssl-openssl LUCI_TITLE:=LuCI with HTTPS support (OpenSSL as SSL backend) LUCI_DESCRIPTION:=LuCI with OpenSSL as the SSL backend (libustream-openssl). \ - Note: px5g still requires libpolarssl + Note: px5g still requires libmbedtls (in LEDE) or libpolarssl (in Openwrt). \ + In LEDE it is also possible to replace px5g with openssl-util as uhttpd can \ + also generate keys with openssl commandline tools if px5g is not installed. LUCI_DEPENDS:=+luci +libustream-openssl +px5g include ../../luci.mk diff --git a/package/luci/collections/luci-ssl/Makefile b/package/luci/collections/luci-ssl/Makefile index f25e3112de..8fb8ff4627 100644 --- a/package/luci/collections/luci-ssl/Makefile +++ b/package/luci/collections/luci-ssl/Makefile @@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk LUCI_TYPE:=col LUCI_BASENAME:=ssl -LUCI_TITLE:=LuCI with HTTPS support (PolarSSL as SSL backend) -LUCI_DEPENDS:=+luci +libustream-polarssl +px5g +LUCI_TITLE:=LuCI with HTTPS support (mbedTLS as SSL backend) +LUCI_DEPENDS:=+luci +libustream-mbedtls +px5g include ../../luci.mk diff --git a/package/luci/contrib/package/community-profiles/files/etc/config/profile_berlin b/package/luci/contrib/package/community-profiles/files/etc/config/profile_berlin index 7fff870d41..1bfc8ed7d7 100644 --- a/package/luci/contrib/package/community-profiles/files/etc/config/profile_berlin +++ b/package/luci/contrib/package/community-profiles/files/etc/config/profile_berlin @@ -8,6 +8,7 @@ config 'community' 'profile' option 'splash_prefix' '27' option 'latitude' '52.52075' option 'longitude' '13.40948' + option 'owm_api' 'http://util.berlin.freifunk.net' config 'defaults' 'wifi_device' option 'channel' '13' diff --git a/package/luci/luci.mk b/package/luci/luci.mk index 2235cc5f05..69aecaa250 100644 --- a/package/luci/luci.mk +++ b/package/luci/luci.mk @@ -23,6 +23,7 @@ LUCI_LANG.he=עִבְרִית (Hebrew) LUCI_LANG.hu=Magyar (Hungarian) LUCI_LANG.it=Italiano (Italian) LUCI_LANG.ja=日本語 (Japanese) +LUCI_LANG.ko=한국어 (Korean) LUCI_LANG.ms=Bahasa Melayu (Malay) LUCI_LANG.no=Norsk (Norwegian) LUCI_LANG.pl=Polski (Polish) diff --git a/package/luci/modules/luci-base/Makefile b/package/luci/modules/luci-base/Makefile index ce7d40dac7..753ff259fa 100644 --- a/package/luci/modules/luci-base/Makefile +++ b/package/luci/modules/luci-base/Makefile @@ -15,8 +15,8 @@ LUCI_TITLE:=LuCI core libraries LUCI_DEPENDS:=+lua +libuci-lua +luci-lib-nixio +luci-lib-ip +rpcd +libubus-lua +luci-lib-jsonc PKG_SOURCE:=LuaSrcDiet-0.12.1.tar.bz2 -PKG_SOURCE_URL:=https://luasrcdiet.googlecode.com/files -PKG_MD5SUM:=8a0812701e29b6715e4d76f2f118264a +PKG_SOURCE_URL:=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/luasrcdiet +PKG_MD5SUM:=ed7680f2896269ae8633756e7edcf09050812f78c8f49e280e63c30d14f35aea HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/LuaSrcDiet-0.12.1 diff --git a/package/luci/modules/luci-base/luasrc/sys/iptparser.lua b/package/luci/modules/luci-base/luasrc/sys/iptparser.lua index a9dbc30826..7ff665e7af 100644 --- a/package/luci/modules/luci-base/luasrc/sys/iptparser.lua +++ b/package/luci/modules/luci-base/luasrc/sys/iptparser.lua @@ -31,29 +31,43 @@ function IptParser.__init__( self, family ) self._family = (tonumber(family) == 6) and 6 or 4 self._rules = { } self._chains = { } + self._tables = { } + + local t = self._tables + local s = self:_supported_tables(self._family) + + if s.filter then t[#t+1] = "filter" end + if s.nat then t[#t+1] = "nat" end + if s.mangle then t[#t+1] = "mangle" end + if s.raw then t[#t+1] = "raw" end if self._family == 4 then self._nulladdr = "0.0.0.0/0" - self._tables = { "filter", "nat", "mangle", "raw" } self._command = "iptables -t %s --line-numbers -nxvL" else self._nulladdr = "::/0" - self._tables = { "filter", "mangle", "raw" } - local ok, lines = pcall(io.lines, "/proc/net/ip6_tables_names") - if ok and lines then - local line - for line in lines do - if line == "nat" then - self._tables = { "filter", "nat", "mangle", "raw" } - end - end - end self._command = "ip6tables -t %s --line-numbers -nxvL" end self:_parse_rules() end +function IptParser._supported_tables( self, family ) + local tables = { } + local ok, lines = pcall(io.lines, + (family == 6) and "/proc/net/ip6_tables_names" + or "/proc/net/ip_tables_names") + + if ok and lines then + local line + for line in lines do + tables[line] = true + end + end + + return tables +end + -- search criteria as only argument. If args is nil or an empty table then all -- rules will be returned. -- diff --git a/package/luci/modules/luci-base/luasrc/tools/webadmin.lua b/package/luci/modules/luci-base/luasrc/tools/webadmin.lua index 8273175de7..106810aa03 100644 --- a/package/luci/modules/luci-base/luasrc/tools/webadmin.lua +++ b/package/luci/modules/luci-base/luasrc/tools/webadmin.lua @@ -96,7 +96,7 @@ function iface_get_network(iface) if net.l3_device == iface or net.device == iface then -- cross check with uci to filter out @name style aliases local uciname = cur:get("network", net.interface, "ifname") - if not uciname or uciname:sub(1, 1) ~= "@" then + if type(uciname) == "string" and uciname:sub(1,1) ~= "@" or uciname then return net.interface end end diff --git a/package/luci/modules/luci-base/po/ca/base.po b/package/luci/modules/luci-base/po/ca/base.po index 04d89d9dd0..044339bc0f 100644 --- a/package/luci/modules/luci-base/po/ca/base.po +++ b/package/luci/modules/luci-base/po/ca/base.po @@ -292,9 +292,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -402,6 +399,9 @@ msgstr "" msgid "Authentication" msgstr "Autenticació" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritzada" @@ -576,6 +576,9 @@ msgstr "Comprovació" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Suma de verificació" @@ -978,6 +981,9 @@ msgstr "Habilita l'STP" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Habilita negociació IPv6 en la enllaç PPP" @@ -2402,6 +2408,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Calidad" @@ -2617,6 +2626,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/cs/base.po b/package/luci/modules/luci-base/po/cs/base.po index 2fa177640b..8c850a26e8 100644 --- a/package/luci/modules/luci-base/po/cs/base.po +++ b/package/luci/modules/luci-base/po/cs/base.po @@ -292,9 +292,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -402,6 +399,9 @@ msgstr "" msgid "Authentication" msgstr "Autentizace" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritativní" @@ -575,6 +575,9 @@ msgstr "Kontrola" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Kontrolní součet" @@ -988,6 +991,9 @@ msgstr "Povolit STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Povolit dynamickou aktualizaci koncového bodu HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Na PPP spoji povolit vyjednání IPv6" @@ -2427,6 +2433,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Kvalita" @@ -2656,6 +2665,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2924,7 +2936,7 @@ msgid "" "configurations where only hosts with a corresponding lease are served." msgstr "" "Statické zápůjčky se používají pro přiřazení fixních IP adres a symbolických " -"jmen DHCP klientům. Jsou také vyžadvány pro nedynamické konfigurace " +"jmen DHCP klientům. Jsou také vyžadovány pro nedynamické konfigurace " "rozhraní, kde jsou povoleni pouze hosté s odpovídajícím nastavením." msgid "Status" @@ -2940,7 +2952,7 @@ msgid "Submit" msgstr "Odeslat" msgid "Suppress logging" -msgstr "" +msgstr "Potlačit logování" msgid "Suppress logging of the routine operation of these protocols" msgstr "" @@ -3227,8 +3239,8 @@ msgid "" "This is the only DHCP in the local network" msgstr "" -"Toto je jedný DHCPv mistní síti" +"Toto je jediný DHCP v mistní síti" msgid "This is the plain username for logging into the account" msgstr "" diff --git a/package/luci/modules/luci-base/po/de/base.po b/package/luci/modules/luci-base/po/de/base.po index d55c33fc2d..e44d8bb234 100644 --- a/package/luci/modules/luci-base/po/de/base.po +++ b/package/luci/modules/luci-base/po/de/base.po @@ -291,9 +291,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -401,6 +398,9 @@ msgstr "" msgid "Authentication" msgstr "Authentifizierung" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Authoritativ" @@ -575,6 +575,9 @@ msgstr "Prüfen" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Prüfsumme" @@ -983,6 +986,9 @@ msgstr "STP aktivieren" msgid "Enable HE.net dynamic endpoint update" msgstr "Dynamisches HE.net IP-Adress-Update aktivieren" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Aushandeln von IPv6-Adressen auf der PPP-Verbindung aktivieren" @@ -2432,6 +2438,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Qualität" @@ -2662,6 +2671,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/el/base.po b/package/luci/modules/luci-base/po/el/base.po index 5f9ea287e4..a196f5b08e 100644 --- a/package/luci/modules/luci-base/po/el/base.po +++ b/package/luci/modules/luci-base/po/el/base.po @@ -299,9 +299,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -409,6 +406,9 @@ msgstr "" msgid "Authentication" msgstr "Εξουσιοδότηση" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Κύριος" @@ -584,6 +584,9 @@ msgstr "Έλεγχος" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Άθροισμα Ελέγχου" @@ -1000,6 +1003,9 @@ msgstr "Ενεργοποίηση STPSTP" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2399,6 +2405,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2614,6 +2623,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/es/base.po b/package/luci/modules/luci-base/po/es/base.po index f05fee8d7d..da786b69d6 100644 --- a/package/luci/modules/luci-base/po/es/base.po +++ b/package/luci/modules/luci-base/po/es/base.po @@ -296,9 +296,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -406,6 +403,9 @@ msgstr "" msgid "Authentication" msgstr "Autentificación" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autorizado" @@ -580,6 +580,9 @@ msgstr "Comprobar" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Comprobación" @@ -994,6 +997,9 @@ msgstr "Activar STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Activar actualización dinámica de punto final HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Activar negociación IPv6 en el enlace PPP" @@ -2441,6 +2447,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Calidad" @@ -2668,6 +2677,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/fr/base.po b/package/luci/modules/luci-base/po/fr/base.po index b7fe5828ee..cce8ee20ad 100644 --- a/package/luci/modules/luci-base/po/fr/base.po +++ b/package/luci/modules/luci-base/po/fr/base.po @@ -302,9 +302,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -412,6 +409,9 @@ msgstr "" msgid "Authentication" msgstr "Authentification" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritaire" @@ -585,6 +585,9 @@ msgstr "Vérification" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Somme de contrôle" @@ -1004,6 +1007,9 @@ msgstr "Activer le protocole STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Activer la mise à jour dynamique de l'extrémité du tunnel chez HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Activer la négociation IPv6 sur le lien PPP" @@ -2454,6 +2460,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Qualitée" @@ -2681,6 +2690,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2869,9 +2881,9 @@ msgid "" "instructions." msgstr "" "Désolé, il n'y a pas de gestion de mise à jour disponible, une nouvelle " -"image du micrologiciel doit être écrite manuellement. Reportez-vous S.V." -"P. au wiki pour connaître les instructions d'installation spécifiques à " -"votre matériel." +"image du micrologiciel doit être écrite manuellement. Reportez-vous S.V.P. " +"au wiki pour connaître les instructions d'installation spécifiques à votre " +"matériel." msgid "Sort" msgstr "Trier" @@ -3429,9 +3441,9 @@ msgid "" "compatible firmware image)." msgstr "" "Envoyer ici une image compatible avec le système de mise à jour pour " -"remplacer le micrologiciel actuel. Cochez \"Garder la configuration\" " -"pour maintenir la configuration actuelle (nécessite une image de " -"micrologiciel compatible)." +"remplacer le micrologiciel actuel. Cochez \"Garder la configuration\" pour " +"maintenir la configuration actuelle (nécessite une image de micrologiciel " +"compatible)." msgid "Upload archive..." msgstr "Envoi de l'archive…" diff --git a/package/luci/modules/luci-base/po/he/base.po b/package/luci/modules/luci-base/po/he/base.po index a4920a19ba..0b11005ca0 100644 --- a/package/luci/modules/luci-base/po/he/base.po +++ b/package/luci/modules/luci-base/po/he/base.po @@ -289,9 +289,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -401,6 +398,9 @@ msgstr "" msgid "Authentication" msgstr "אימות" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "מוסמך" @@ -575,6 +575,9 @@ msgstr "לבדוק" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "" @@ -964,6 +967,9 @@ msgstr "אפשר STP" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2366,6 +2372,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2582,6 +2591,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2764,8 +2776,8 @@ msgid "" "flashed manually. Please refer to the wiki for device specific install " "instructions." msgstr "" -"סליחה, אין תמיכה בעדכון מערכת, ולכן קושחה חדשה חייבת להיצרב ידנית. אנא " -"פנה אל ה-wiki של OpenWrt/LEDE עבור הוראות ספציפיות למכשיר שלך." +"סליחה, אין תמיכה בעדכון מערכת, ולכן קושחה חדשה חייבת להיצרב ידנית. אנא פנה " +"אל ה-wiki של OpenWrt/LEDE עבור הוראות ספציפיות למכשיר שלך." msgid "Sort" msgstr "מיין" diff --git a/package/luci/modules/luci-base/po/hu/base.po b/package/luci/modules/luci-base/po/hu/base.po index a813f72060..2b85df15aa 100644 --- a/package/luci/modules/luci-base/po/hu/base.po +++ b/package/luci/modules/luci-base/po/hu/base.po @@ -295,9 +295,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -405,6 +402,9 @@ msgstr "" msgid "Authentication" msgstr "Hitelesítés" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Hiteles" @@ -580,6 +580,9 @@ msgstr "Ellenőrzés" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Ellenőrző összeg" @@ -997,6 +1000,9 @@ msgstr "STP engedélyezése" msgid "Enable HE.net dynamic endpoint update" msgstr "HE.net dinamikus végpont frissítésének engedélyezése" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "IPv6 egyeztetés engedélyezése a PPP linken" @@ -2444,6 +2450,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Minőség" @@ -2673,6 +2682,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -3418,8 +3430,7 @@ msgid "" msgstr "" "Itt tölthet fel egy új sysupgrade-kompatibilis képet a futó firmware " "lecseréléséhez. A jelenlegi beállítások megtartásához jelölje be a " -"\"Beállítások megtartása\" négyzetet (kompatibilis firmware kép " -"szükséges)." +"\"Beállítások megtartása\" négyzetet (kompatibilis firmware kép szükséges)." msgid "Upload archive..." msgstr "Archívum feltöltése..." diff --git a/package/luci/modules/luci-base/po/it/base.po b/package/luci/modules/luci-base/po/it/base.po index 6bd6f0c431..2f5350dd78 100644 --- a/package/luci/modules/luci-base/po/it/base.po +++ b/package/luci/modules/luci-base/po/it/base.po @@ -302,9 +302,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -412,6 +409,9 @@ msgstr "" msgid "Authentication" msgstr "Autenticazione PEAP" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritativo" @@ -585,6 +585,9 @@ msgstr "Verifica" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Checksum" @@ -998,6 +1001,9 @@ msgstr "Abilita STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Abilitazione aggiornamento endpoint dinamico HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Attiva la negoziazione IPv6 sul collegamento PPP" @@ -2438,6 +2444,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2656,6 +2665,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -3367,9 +3379,9 @@ msgid "" "Check \"Keep settings\" to retain the current configuration (requires a " "compatible firmware image)." msgstr "" -"Carica un'immagine sysupgrade compatibile quì per sostituire il firmware " -"in esecuzione. Attivare la spunta \"Mantieni Impostazioni\" per mantenere " -"la configurazione corrente (richiede un immagine del firmware compatibile)." +"Carica un'immagine sysupgrade compatibile quì per sostituire il firmware in " +"esecuzione. Attivare la spunta \"Mantieni Impostazioni\" per mantenere la " +"configurazione corrente (richiede un immagine del firmware compatibile)." msgid "Upload archive..." msgstr "Carica archivio..." diff --git a/package/luci/modules/luci-base/po/ja/base.po b/package/luci/modules/luci-base/po/ja/base.po index d961183e22..ed72412540 100644 --- a/package/luci/modules/luci-base/po/ja/base.po +++ b/package/luci/modules/luci-base/po/ja/base.po @@ -290,9 +290,6 @@ msgstr "" msgid "Always announce default router" msgstr "常にデフォルト ルーターとして通知する" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -402,6 +399,9 @@ msgstr "" msgid "Authentication" msgstr "認証" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Authoritative" @@ -578,6 +578,9 @@ msgstr "チェック" msgid "Check fileystems before mount" msgstr "マウント前にファイルシステムをチェックする" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "チェックサム" @@ -994,6 +997,9 @@ msgstr "STPを有効にする" msgid "Enable HE.net dynamic endpoint update" msgstr "HE.netの動的endpoint更新を有効にします" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "PPPリンクのIPv6ネゴシエーションを有効にする" @@ -2435,6 +2441,9 @@ msgstr "公開鍵" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "クオリティ" @@ -2664,6 +2673,9 @@ msgstr "ルートの準備" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/ko/base.po b/package/luci/modules/luci-base/po/ko/base.po new file mode 100644 index 0000000000..9a1a815785 --- /dev/null +++ b/package/luci/modules/luci-base/po/ko/base.po @@ -0,0 +1,3718 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-06-10 03:40+0200\n" +"PO-Revision-Date: 2012-04-03 08:44+0200\n" +"Last-Translator: Weongyo Jeong \n" +"Language-Team: LANGUAGE \n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.4\n" + +msgid "%s is untagged in multiple VLANs!" +msgstr "" + +msgid "(%d minute window, %d second interval)" +msgstr "(%d 분 window, %d 초 간격)" + +msgid "(%s available)" +msgstr "" + +msgid "(empty)" +msgstr "" + +msgid "(no interfaces attached)" +msgstr "" + +msgid "-- Additional Field --" +msgstr "" + +msgid "-- Please choose --" +msgstr "" + +msgid "-- custom --" +msgstr "" + +msgid "-- match by device --" +msgstr "" + +msgid "-- match by label --" +msgstr "" + +msgid "1 Minute Load:" +msgstr "1 분 부하:" + +msgid "15 Minute Load:" +msgstr "15 분 부하:" + +msgid "464XLAT (CLAT)" +msgstr "" + +msgid "5 Minute Load:" +msgstr "5 분 부하:" + +msgid "BSSID" +msgstr "" + +msgid "DNS query port" +msgstr "DNS query 포트" + +msgid "DNS server port" +msgstr "DNS 서버 포트" + +msgid "" +"DNS servers will be queried in the " +"order of the resolvfile" +msgstr "" + +msgid "ESSID" +msgstr "" + +msgid "IPv4-Address" +msgstr "IPv4-주소" + +msgid "IPv4-Gateway" +msgstr "" + +msgid "IPv4-Netmask" +msgstr "" + +msgid "" +"IPv6-Address or Network " +"(CIDR)" +msgstr "" + +msgid "IPv6-Gateway" +msgstr "" + +msgid "IPv6-Suffix (hex)" +msgstr "" + +msgid "LED Configuration" +msgstr "LED 설정" + +msgid "LED Name" +msgstr "LED 이름" + +msgid "MAC-Address" +msgstr "MAC-주소" + +msgid "" +"Max. DHCP leases" +msgstr "" +"최대 DHCP lease 수" + +msgid "" +"Max. EDNS0 packet size" +msgstr "" +"최대 EDNS0 패킷 크기" + +msgid "Max. concurrent queries" +msgstr "최대 동시 처리 query 수" + +msgid "%s - %s" +msgstr "" + +msgid "A43C + J43 + A43" +msgstr "" + +msgid "A43C + J43 + A43 + V43" +msgstr "" + +msgid "ADSL" +msgstr "" + +msgid "AICCU (SIXXS)" +msgstr "" + +msgid "ANSI T1.413" +msgstr "" + +msgid "APN" +msgstr "" + +msgid "AR Support" +msgstr "" + +msgid "ARP retry threshold" +msgstr "" + +msgid "ATM (Asynchronous Transfer Mode)" +msgstr "" + +msgid "ATM Bridges" +msgstr "" + +msgid "ATM Virtual Channel Identifier (VCI)" +msgstr "" + +msgid "ATM Virtual Path Identifier (VPI)" +msgstr "" + +msgid "" +"ATM bridges expose encapsulated ethernet in AAL5 connections as virtual " +"Linux network interfaces which can be used in conjunction with DHCP or PPP " +"to dial into the provider network." +msgstr "" + +msgid "ATM device number" +msgstr "" + +msgid "ATU-C System Vendor ID" +msgstr "" + +msgid "AYIYA" +msgstr "" + +msgid "Access Concentrator" +msgstr "" + +msgid "Access Point" +msgstr "" + +msgid "Action" +msgstr "" + +msgid "Actions" +msgstr "관리 도구" + +msgid "Activate this network" +msgstr "이 네트워를 활성화합니다" + +msgid "Active IPv4-Routes" +msgstr "" +"Active IPv4-Route 경로" + +msgid "Active IPv6-Routes" +msgstr "" +"Active IPv6-Route 경로" + +msgid "Active Connections" +msgstr "Active 연결수" + +msgid "Active DHCP Leases" +msgstr "Active DHCP 임대 목록" + +msgid "Active DHCPv6 Leases" +msgstr "Active DHCPv6 임대 목록" + +msgid "Ad-Hoc" +msgstr "" + +msgid "Add" +msgstr "추가" + +msgid "Add local domain suffix to names served from hosts files" +msgstr "" + +msgid "Add new interface..." +msgstr "새로운 인터페이스 추가..." + +msgid "Additional Hosts files" +msgstr "추가적인 Hosts 파일들" + +msgid "Additional servers file" +msgstr "" + +msgid "Address" +msgstr "주소" + +msgid "Address to access local relay bridge" +msgstr "" + +msgid "Administration" +msgstr "관리" + +msgid "Advanced Settings" +msgstr "고급 설정" + +msgid "Aggregate Transmit Power(ACTATP)" +msgstr "" + +msgid "Alert" +msgstr "" + +msgid "" +"Allocate IP addresses sequentially, starting from the lowest available " +"address" +msgstr "" + +msgid "Allocate IP sequentially" +msgstr "" + +msgid "Allow SSH password authentication" +msgstr "SSH 암호 인증을 허용합니다" + +msgid "Allow all except listed" +msgstr "" + +msgid "Allow listed only" +msgstr "" + +msgid "Allow localhost" +msgstr "" + +msgid "Allow remote hosts to connect to local SSH forwarded ports" +msgstr "" + +msgid "Allow root logins with password" +msgstr "암호를 이용한 root 접근 허용" + +msgid "Allow the root user to login with password" +msgstr "암호를 이용한 root 사용자 접근을 허용합니다" + +msgid "" +"Allow upstream responses in the 127.0.0.0/8 range, e.g. for RBL services" +msgstr "" + +msgid "Allowed IPs" +msgstr "" + +msgid "" +"Also see Tunneling Comparison on SIXXS" +msgstr "" + +msgid "Always announce default router" +msgstr "" + +msgid "Annex" +msgstr "" + +msgid "Annex A + L + M (all)" +msgstr "" + +msgid "Annex A G.992.1" +msgstr "" + +msgid "Annex A G.992.2" +msgstr "" + +msgid "Annex A G.992.3" +msgstr "" + +msgid "Annex A G.992.5" +msgstr "" + +msgid "Annex B (all)" +msgstr "" + +msgid "Annex B G.992.1" +msgstr "" + +msgid "Annex B G.992.3" +msgstr "" + +msgid "Annex B G.992.5" +msgstr "" + +msgid "Annex J (all)" +msgstr "" + +msgid "Annex L G.992.3 POTS 1" +msgstr "" + +msgid "Annex M (all)" +msgstr "" + +msgid "Annex M G.992.3" +msgstr "" + +msgid "Annex M G.992.5" +msgstr "" + +msgid "Announce as default router even if no public prefix is available." +msgstr "" + +msgid "Announced DNS domains" +msgstr "" + +msgid "Announced DNS servers" +msgstr "" + +msgid "Anonymous Identity" +msgstr "" + +msgid "Anonymous Mount" +msgstr "" + +msgid "Anonymous Swap" +msgstr "" + +msgid "Antenna 1" +msgstr "" + +msgid "Antenna 2" +msgstr "" + +msgid "Antenna Configuration" +msgstr "" + +msgid "Any zone" +msgstr "" + +msgid "Apply" +msgstr "적용" + +msgid "Applying changes" +msgstr "" + +msgid "" +"Assign a part of given length of every public IPv6-prefix to this interface" +msgstr "" + +msgid "Assign interfaces..." +msgstr "" + +msgid "" +"Assign prefix parts using this hexadecimal subprefix ID for this interface." +msgstr "" + +msgid "Associated Stations" +msgstr "연결된 station 들" + +msgid "Atheros 802.11%s Wireless Controller" +msgstr "" + +msgid "Auth Group" +msgstr "" + +msgid "AuthGroup" +msgstr "" + +msgid "Authentication" +msgstr "" + +msgid "Authentication Type" +msgstr "" + +msgid "Authoritative" +msgstr "" + +msgid "Authorization Required" +msgstr "인증이 필요합니다" + +msgid "Auto Refresh" +msgstr "자동 Refresh" + +msgid "Automatic" +msgstr "" + +msgid "Automatic Homenet (HNCP)" +msgstr "" + +msgid "Automatically check filesystem for errors before mounting" +msgstr "" + +msgid "Automatically mount filesystems on hotplug" +msgstr "" + +msgid "Automatically mount swap on hotplug" +msgstr "" + +msgid "Automount Filesystem" +msgstr "" + +msgid "Automount Swap" +msgstr "" + +msgid "Available" +msgstr "" + +msgid "Available packages" +msgstr "이용 가능한 패키지" + +msgid "Average:" +msgstr "평균:" + +msgid "B43 + B43C" +msgstr "" + +msgid "B43 + B43C + V43" +msgstr "" + +msgid "BR / DMR / AFTR" +msgstr "" + +msgid "BSSID" +msgstr "" + +msgid "Back" +msgstr "뒤로" + +msgid "Back to Overview" +msgstr "개요로 이동" + +msgid "Back to configuration" +msgstr "설정으로 돌아가기" + +msgid "Back to overview" +msgstr "" + +msgid "Back to scan results" +msgstr "" + +msgid "Background Scan" +msgstr "" + +msgid "Backup / Flash Firmware" +msgstr "Firmware 백업 / Flash" + +msgid "Backup / Restore" +msgstr "백업 / 복구" + +msgid "Backup file list" +msgstr "" + +msgid "Bad address specified!" +msgstr "" + +msgid "Band" +msgstr "" + +msgid "Behind NAT" +msgstr "" + +msgid "" +"Below is the determined list of files to backup. It consists of changed " +"configuration files marked by opkg, essential base files and the user " +"defined backup patterns." +msgstr "" +"아래는 백업할 파일 목록입니다. 이 목록은 opkg 이 수정되었다고 판단한 파일, " +"필수 기본 파일 그리고 사용자가 패턴 정의로 백업하도록 지정한 것로 이루어져 있" +"습니다." + +msgid "Bind interface" +msgstr "" + +msgid "Bind only to specific interfaces rather than wildcard address." +msgstr "" + +msgid "Bind the tunnel to this interface (optional)." +msgstr "" + +msgid "Bitrate" +msgstr "" + +msgid "Bogus NX Domain Override" +msgstr "" + +msgid "Bridge" +msgstr "" + +msgid "Bridge interfaces" +msgstr "Bridge 인터페이스" + +msgid "Bridge unit number" +msgstr "" + +msgid "Bring up on boot" +msgstr "부팅시 활성화" + +msgid "Broadcom 802.11%s Wireless Controller" +msgstr "" + +msgid "Broadcom BCM%04x 802.11 Wireless Controller" +msgstr "" + +msgid "Buffered" +msgstr "버퍼된 양" + +msgid "" +"Build/distribution specific feed definitions. This file will NOT be " +"preserved in any sysupgrade." +msgstr "" +"Build/distribution 지정 feed 목록입니다. 이 파일의 내용은 sysupgrade 시 초기" +"화됩니다." + +msgid "Buttons" +msgstr "" + +msgid "CA certificate; if empty it will be saved after the first connection." +msgstr "" + +msgid "CPU usage (%)" +msgstr "CPU 사용량 (%)" + +msgid "Cancel" +msgstr "" + +msgid "Category" +msgstr "" + +msgid "Chain" +msgstr "" + +msgid "Changes" +msgstr "변경 사항" + +msgid "Changes applied." +msgstr "" + +msgid "Changes the administrator password for accessing the device" +msgstr "장비 접근을 위한 관리자 암호를 변경합니다" + +msgid "Channel" +msgstr "" + +msgid "Check" +msgstr "" + +msgid "Check fileystems before mount" +msgstr "" + +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + +msgid "Checksum" +msgstr "" + +msgid "" +"Choose the firewall zone you want to assign to this interface. Select " +"unspecified to remove the interface from the associated zone or " +"fill out the create field to define a new zone and attach the " +"interface to it." +msgstr "" +"이 인터페이스에 할당하고자 하는 firewall zone 을 선택하세요. 연결된 zone 으로" +"부터 인터페이스를 제거하고 싶다면 unspecified 를 선택하세요. 새로" +"운 zone 을 정의하고 인터페이스 연결을 원한다면 create 항목을 입력하" +"세요." + +msgid "" +"Choose the network(s) you want to attach to this wireless interface or fill " +"out the create field to define a new network." +msgstr "" +"이 무선랜 인터페이스와 연결하고자 하는 네트워크(들)을 선택하세요. 혹은 새로" +"운 네트워크를 정의할려면 create 을 작성하세요." + +msgid "Cipher" +msgstr "" + +msgid "Cisco UDP encapsulation" +msgstr "" + +msgid "" +"Click \"Generate archive\" to download a tar archive of the current " +"configuration files. To reset the firmware to its initial state, click " +"\"Perform reset\" (only possible with squashfs images)." +msgstr "" +"현재 설정 파일에 대한 tar 아카이브 다운로드를 원한다면 \"아카이브 생성\" 버튼" +"을 클릭하세요. Firmware 의 초기 설정 reset 을 원한다면 \"Reset 하기\" 를 클" +"릭하세요. (squashfs 이미지들만 가능)." + +msgid "Client" +msgstr "" + +msgid "Client ID to send when requesting DHCP" +msgstr "DHCP 요청시 전송할 Client ID" + +msgid "" +"Close inactive connection after the given amount of seconds, use 0 to " +"persist connection" +msgstr "" + +msgid "Close list..." +msgstr "목록 닫기..." + +msgid "Collecting data..." +msgstr "Data 를 수집중입니다..." + +msgid "Command" +msgstr "명령어" + +msgid "Common Configuration" +msgstr "공통 설정" + +msgid "Compression" +msgstr "" + +msgid "Configuration" +msgstr "설정" + +msgid "Configuration applied." +msgstr "" + +msgid "Configuration files will be kept." +msgstr "" + +msgid "Confirmation" +msgstr "다시 확인" + +msgid "Connect" +msgstr "연결" + +msgid "Connected" +msgstr "연결 시간" + +msgid "Connection Limit" +msgstr "" + +msgid "Connection to server fails when TLS cannot be used" +msgstr "" + +msgid "Connections" +msgstr "연결" + +msgid "Country" +msgstr "" + +msgid "Country Code" +msgstr "" + +msgid "Cover the following interface" +msgstr "" + +msgid "Cover the following interfaces" +msgstr "" + +msgid "Create / Assign firewall-zone" +msgstr "Firewall-zone 생성 / 할당" + +msgid "Create Interface" +msgstr "" + +msgid "Create a bridge over multiple interfaces" +msgstr "" + +msgid "Critical" +msgstr "" + +msgid "Cron Log Level" +msgstr "" + +msgid "Custom Interface" +msgstr "임의의 인터페이스" + +msgid "Custom delegated IPv6-prefix" +msgstr "" + +msgid "" +"Custom feed definitions, e.g. private feeds. This file can be preserved in a " +"sysupgrade." +msgstr "" +"개인이 운영하는 feed 같은 정보를 입력할 수 있는 custom feed 목록입니다. 이 파" +"일은 sysupgrade 시 입력된 정보가 유지됩니다." + +msgid "Custom feeds" +msgstr "Custom feed 들" + +msgid "" +"Customizes the behaviour of the device LEDs if possible." +msgstr "" +"원한다면 장치에 부착된 LED 들의 " +"행동을 마음대로 변경할 수 있습니다." + +msgid "DHCP Leases" +msgstr "DHCP 임대 정보" + +msgid "DHCP Server" +msgstr "DHCP 서버" + +msgid "DHCP and DNS" +msgstr "DHCP 와 DNS" + +msgid "DHCP client" +msgstr "DHCP client" + +msgid "DHCP-Options" +msgstr "DHCP-옵션들" + +msgid "DHCPv6 Leases" +msgstr "DHCPv6 임대 정보" + +msgid "DHCPv6 client" +msgstr "" + +msgid "DHCPv6-Mode" +msgstr "" + +msgid "DHCPv6-Service" +msgstr "" + +msgid "DNS" +msgstr "" + +msgid "DNS forwardings" +msgstr "" + +msgid "DNS-Label / FQDN" +msgstr "" + +msgid "DNSSEC" +msgstr "" + +msgid "DNSSEC check unsigned" +msgstr "" + +msgid "DPD Idle Timeout" +msgstr "" + +msgid "DS-Lite AFTR address" +msgstr "" + +msgid "DSL" +msgstr "" + +msgid "DSL Status" +msgstr "" + +msgid "DSL line mode" +msgstr "" + +msgid "DUID" +msgstr "" + +msgid "Data Rate" +msgstr "" + +msgid "Debug" +msgstr "" + +msgid "Default %d" +msgstr "" + +msgid "Default gateway" +msgstr "" + +msgid "Default is stateless + stateful" +msgstr "" + +msgid "Default route" +msgstr "" + +msgid "Default state" +msgstr "기본 상태" + +msgid "Define a name for this network." +msgstr "" + +msgid "" +"Define additional DHCP options, for example " +"\"6,192.168.2.1,192.168.2.2\" which advertises different DNS " +"servers to clients." +msgstr "" +"추가적인 DHCP 옵션을 정의합니다. 예를 들어 " +"\"6,192.168.2.1,192.168.2.2\" 는 client 에게 다른 DNS 서버를 세" +"팅하도록 권고할 수 있습니다." + +msgid "Delete" +msgstr "삭제" + +msgid "Delete this network" +msgstr "이 네트워크를 삭제합니다" + +msgid "Description" +msgstr "설명" + +msgid "Design" +msgstr "디자인" + +msgid "Destination" +msgstr "" + +msgid "Device" +msgstr "" + +msgid "Device Configuration" +msgstr "장치 설정" + +msgid "Device is rebooting..." +msgstr "" + +msgid "Device unreachable" +msgstr "" + +msgid "Diagnostics" +msgstr "진단" + +msgid "Dial number" +msgstr "" + +msgid "Directory" +msgstr "" + +msgid "Disable" +msgstr "비활성화" + +msgid "" +"Disable DHCP for " +"this interface." +msgstr "" +"이 인터페이스에 대해 DHCP 기능을 비활성합니다." + +msgid "Disable DNS setup" +msgstr "" + +msgid "Disable Encryption" +msgstr "" + +msgid "Disable HW-Beacon timer" +msgstr "" + +msgid "Disabled" +msgstr "" + +msgid "Discard upstream RFC1918 responses" +msgstr "" + +msgid "Displaying only packages containing" +msgstr "" + +msgid "Distance Optimization" +msgstr "" + +msgid "Distance to farthest network member in meters." +msgstr "" + +msgid "Distribution feeds" +msgstr "Distribution feed 들" + +msgid "Diversity" +msgstr "" + +msgid "" +"Dnsmasq is a combined DHCP-Server and DNS-" +"Forwarder for NAT " +"firewalls" +msgstr "" +"Dnsmasq 는 NAT 방화벽을 위" +"한 DHCP-서버와 " +"DNS-Forwarder 기능을 제공합니다." + +msgid "Do not cache negative replies, e.g. for not existing domains" +msgstr "" + +msgid "Do not forward requests that cannot be answered by public name servers" +msgstr "" + +msgid "Do not forward reverse lookups for local networks" +msgstr "" + +msgid "Do not send probe responses" +msgstr "" + +msgid "Domain required" +msgstr "" + +msgid "Domain whitelist" +msgstr "" + +msgid "Don't Fragment" +msgstr "" + +msgid "" +"Don't forward DNS-Requests without " +"DNS-Name" +msgstr "" + +msgid "Download and install package" +msgstr "패키지 다운로드 후 설치" + +msgid "Download backup" +msgstr "백업 다운로드" + +msgid "Dropbear Instance" +msgstr "" + +msgid "" +"Dropbear offers SSH network shell access " +"and an integrated SCP server" +msgstr "" +"Dropbear 는 SSH network shell 접근과 " +"SCP 서버 기능을 제공합니다" + +msgid "Dual-Stack Lite (RFC6333)" +msgstr "" + +msgid "Dynamic DHCP" +msgstr "" + +msgid "Dynamic tunnel" +msgstr "" + +msgid "" +"Dynamically allocate DHCP addresses for clients. If disabled, only clients " +"having static leases will be served." +msgstr "" +"동적으로 DHCP 주소를 client 에게 할당합니다. 만약 비활성화시, static lease " +"가 설정된 client 만 주소 제공이 이루어집니다." + +msgid "EA-bits length" +msgstr "" + +msgid "EAP-Method" +msgstr "" + +msgid "Edit" +msgstr "수정" + +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + +msgid "Edit this interface" +msgstr "이 인터페이스를 수정합니다" + +msgid "Edit this network" +msgstr "이 네트워크를 수정합니다" + +msgid "Emergency" +msgstr "" + +msgid "Enable" +msgstr "활성화" + +msgid "Enable STP" +msgstr "STP 활성화" + +msgid "Enable HE.net dynamic endpoint update" +msgstr "" + +msgid "Enable IPv6 negotiation" +msgstr "" + +msgid "Enable IPv6 negotiation on the PPP link" +msgstr "" + +msgid "Enable Jumbo Frame passthrough" +msgstr "" + +msgid "Enable NTP client" +msgstr "NTP client 활성화" + +msgid "Enable Single DES" +msgstr "" + +msgid "Enable TFTP server" +msgstr "TFTP 서버 활성화" + +msgid "Enable VLAN functionality" +msgstr "VLAN 기능 활성화" + +msgid "Enable WPS pushbutton, requires WPA(2)-PSK" +msgstr "" + +msgid "Enable learning and aging" +msgstr "" + +msgid "Enable mirroring of incoming packets" +msgstr "" + +msgid "Enable mirroring of outgoing packets" +msgstr "" + +msgid "Enable the DF (Don't Fragment) flag of the encapsulating packets." +msgstr "" + +msgid "Enable this mount" +msgstr "" + +msgid "Enable this swap" +msgstr "" + +msgid "Enable/Disable" +msgstr "활성/비활성" + +msgid "Enabled" +msgstr "활성화됨" + +msgid "Enables the Spanning Tree Protocol on this bridge" +msgstr "이 bridge 에 Spanning Tree Protocol 활성화합니다" + +msgid "Encapsulation mode" +msgstr "" + +msgid "Encryption" +msgstr "암호화" + +msgid "Endpoint Host" +msgstr "" + +msgid "Endpoint Port" +msgstr "" + +msgid "Erasing..." +msgstr "" + +msgid "Error" +msgstr "" + +msgid "Errored seconds (ES)" +msgstr "" + +msgid "Ethernet Adapter" +msgstr "" + +msgid "Ethernet Switch" +msgstr "Ethernet 스위치" + +msgid "Exclude interfaces" +msgstr "" + +msgid "Expand hosts" +msgstr "" + +msgid "Expires" +msgstr "만료 시간" + +msgid "" +"Expiry time of leased addresses, minimum is 2 minutes (2m)." +msgstr "임대한 주소의 유효 시간. 최소값은 2 분 (2m) 입니다." + +msgid "External" +msgstr "" + +msgid "External system log server" +msgstr "외부 system log 서버" + +msgid "External system log server port" +msgstr "외부 system log 서버 포트" + +msgid "External system log server protocol" +msgstr "외부 system log 서버 프로토콜" + +msgid "Extra SSH command options" +msgstr "" + +msgid "Fast Frames" +msgstr "" + +msgid "File" +msgstr "" + +msgid "Filename of the boot image advertised to clients" +msgstr "" + +msgid "Filesystem" +msgstr "" + +msgid "Filter" +msgstr "필터" + +msgid "Filter private" +msgstr "" + +msgid "Filter useless" +msgstr "" + +msgid "" +"Find all currently attached filesystems and swap and replace configuration " +"with defaults based on what was detected" +msgstr "" + +msgid "Find and join network" +msgstr "네트워크 검색 및 연결합니다" + +msgid "Find package" +msgstr "패키지 찾기" + +msgid "Finish" +msgstr "" + +msgid "Firewall" +msgstr "방화벽" + +msgid "Firewall Settings" +msgstr "방화벽 설정" + +msgid "Firewall Status" +msgstr "방화벽 상태" + +msgid "Firmware File" +msgstr "" + +msgid "Firmware Version" +msgstr "Firmware 버전" + +msgid "Fixed source port for outbound DNS queries" +msgstr "" + +msgid "Flash Firmware" +msgstr "" + +msgid "Flash image..." +msgstr "이미지로 Flash..." + +msgid "Flash new firmware image" +msgstr "새로운 firmware 이미지로 flash" + +msgid "Flash operations" +msgstr "Flash 작업" + +msgid "Flashing..." +msgstr "" + +msgid "Force" +msgstr "강제하기" + +msgid "Force CCMP (AES)" +msgstr "" + +msgid "Force DHCP on this network even if another server is detected." +msgstr "다른 DHCP 서버가 탐지되더라도 이 네트워크에 DHCP 를 강제합니다." + +msgid "Force TKIP" +msgstr "" + +msgid "Force TKIP and CCMP (AES)" +msgstr "" + +msgid "Force use of NAT-T" +msgstr "" + +msgid "Form token mismatch" +msgstr "" + +msgid "Forward DHCP traffic" +msgstr "" + +msgid "Forward Error Correction Seconds (FECS)" +msgstr "" + +msgid "Forward broadcast traffic" +msgstr "" + +msgid "Forwarding mode" +msgstr "" + +msgid "Fragmentation Threshold" +msgstr "" + +msgid "Frame Bursting" +msgstr "" + +msgid "Free" +msgstr "이용 가능한 양" + +msgid "Free space" +msgstr "여유 공간" + +msgid "" +"Further information about WireGuard interfaces and peers at wireguard.io." +msgstr "" + +msgid "GHz" +msgstr "" + +msgid "GPRS only" +msgstr "" + +msgid "Gateway" +msgstr "" + +msgid "Gateway ports" +msgstr "" + +msgid "General Settings" +msgstr "기본 설정" + +msgid "General Setup" +msgstr "기본 설정" + +msgid "General options for opkg" +msgstr "opkg 명령의 기본 옵션들" + +msgid "Generate Config" +msgstr "" + +msgid "Generate archive" +msgstr "아카이브 생성" + +msgid "Generic 802.11%s Wireless Controller" +msgstr "" + +msgid "Given password confirmation did not match, password not changed!" +msgstr "" + +msgid "Global Settings" +msgstr "" + +msgid "Global network options" +msgstr "" + +msgid "Go to password configuration..." +msgstr "" + +msgid "Go to relevant configuration page" +msgstr "" + +msgid "Group Password" +msgstr "" + +msgid "Guest" +msgstr "" + +msgid "HE.net password" +msgstr "" + +msgid "HE.net username" +msgstr "" + +msgid "HT mode (802.11n)" +msgstr "" + +msgid "Handler" +msgstr "" + +msgid "Hang Up" +msgstr "" + +msgid "Header Error Code Errors (HEC)" +msgstr "" + +msgid "Heartbeat" +msgstr "" + +msgid "" +"Here you can configure the basic aspects of your device like its hostname or " +"the timezone." +msgstr "" +"여기서 호스트이름이나 시간대와 같은 기본적인 장비 설정을 할 수 있습니다." + +msgid "" +"Here you can paste public SSH-Keys (one per line) for SSH public-key " +"authentication." +msgstr "" +"아래에 SSH public-key 인증을 위한 공개 SSH-Key 들 (한 줄당 한개) 를 입력할 " +"수 있습니다." + +msgid "Hermes 802.11b Wireless Controller" +msgstr "" + +msgid "Hide ESSID" +msgstr "ESSID 숨기기" + +msgid "Host" +msgstr "호스트" + +msgid "Host entries" +msgstr "호스트 목록들" + +msgid "Host expiry timeout" +msgstr "" + +msgid "Host-IP or Network" +msgstr "Host-IP 혹은 Network" + +msgid "Hostname" +msgstr "호스트이름" + +msgid "Hostname to send when requesting DHCP" +msgstr "DHCP 요청시 전달할 호스트이름" + +msgid "Hostnames" +msgstr "호스트이름" + +msgid "Hybrid" +msgstr "" + +msgid "IKE DH Group" +msgstr "" + +msgid "IP address" +msgstr "IP 주소" + +msgid "IPv4" +msgstr "" + +msgid "IPv4 Firewall" +msgstr "IPv4 방화벽" + +msgid "IPv4 WAN Status" +msgstr "IPv4 WAN 상태" + +msgid "IPv4 address" +msgstr "IPv4 주소" + +msgid "IPv4 and IPv6" +msgstr "IPv4 와 IPv6" + +msgid "IPv4 assignment length" +msgstr "" + +msgid "IPv4 broadcast" +msgstr "" + +msgid "IPv4 gateway" +msgstr "" + +msgid "IPv4 netmask" +msgstr "" + +msgid "IPv4 only" +msgstr "" + +msgid "IPv4 prefix" +msgstr "" + +msgid "IPv4 prefix length" +msgstr "" + +msgid "IPv4-Address" +msgstr "IPv4-주소" + +msgid "IPv4-in-IPv4 (RFC2003)" +msgstr "" + +msgid "IPv6" +msgstr "IPv6" + +msgid "IPv6 Firewall" +msgstr "IPv6 방화벽" + +msgid "IPv6 Neighbours" +msgstr "IPv6 Neighbour 들" + +msgid "IPv6 Settings" +msgstr "IPv6 설정" + +msgid "IPv6 ULA-Prefix" +msgstr "" + +msgid "IPv6 WAN Status" +msgstr "IPv6 WAN 상태" + +msgid "IPv6 address" +msgstr "" + +msgid "IPv6 address delegated to the local tunnel endpoint (optional)" +msgstr "" + +msgid "IPv6 assignment hint" +msgstr "" + +msgid "IPv6 assignment length" +msgstr "" + +msgid "IPv6 gateway" +msgstr "" + +msgid "IPv6 only" +msgstr "" + +msgid "IPv6 prefix" +msgstr "" + +msgid "IPv6 prefix length" +msgstr "" + +msgid "IPv6 routed prefix" +msgstr "" + +msgid "IPv6-Address" +msgstr "IPv6-주소" + +msgid "IPv6-in-IPv4 (RFC4213)" +msgstr "" + +msgid "IPv6-over-IPv4 (6rd)" +msgstr "" + +msgid "IPv6-over-IPv4 (6to4)" +msgstr "" + +msgid "Identity" +msgstr "" + +msgid "If checked, 1DES is enaled" +msgstr "" + +msgid "If checked, encryption is disabled" +msgstr "" + +msgid "" +"If specified, mount the device by its UUID instead of a fixed device node" +msgstr "" + +msgid "" +"If specified, mount the device by the partition label instead of a fixed " +"device node" +msgstr "" + +msgid "If unchecked, no default route is configured" +msgstr "체크하지 않을 경우, 기본 route 가 설정되지 않습니다" + +msgid "If unchecked, the advertised DNS server addresses are ignored" +msgstr "체크하지 않을 경우, 사용하도록 권장된 DNS 주소는 무시됩니다" + +msgid "" +"If your physical memory is insufficient unused data can be temporarily " +"swapped to a swap-device resulting in a higher amount of usable RAM. Be aware that swapping data is a very " +"slow process as the swap-device cannot be accessed with the high datarates " +"of the RAM." +msgstr "" + +msgid "Ignore /etc/hosts" +msgstr "/etc/hosts 파일 무시" + +msgid "Ignore interface" +msgstr "인터페이스 무시" + +msgid "Ignore resolve file" +msgstr "resolve 파일 무시" + +msgid "Image" +msgstr "이미지" + +msgid "In" +msgstr "In" + +msgid "" +"In order to prevent unauthorized access to the system, your request has been " +"blocked. Click \"Continue »\" below to return to the previous page." +msgstr "" + +msgid "Inactivity timeout" +msgstr "" + +msgid "Inbound:" +msgstr "" + +msgid "Info" +msgstr "" + +msgid "Initscript" +msgstr "" + +msgid "Initscripts" +msgstr "Initscript 들" + +msgid "Install" +msgstr "설치" + +msgid "Install iputils-traceroute6 for IPv6 traceroute" +msgstr "" + +msgid "Install package %q" +msgstr "" + +msgid "Install protocol extensions..." +msgstr "" + +msgid "Installed packages" +msgstr "설치된 패키지" + +msgid "Interface" +msgstr "인터페이스" + +msgid "Interface Configuration" +msgstr "인터페이스 설정" + +msgid "Interface Overview" +msgstr "인터페이스 개요" + +msgid "Interface is reconnecting..." +msgstr "" + +msgid "Interface is shutting down..." +msgstr "" + +msgid "Interface name" +msgstr "인터페이스 이름" + +msgid "Interface not present or not connected yet." +msgstr "" + +msgid "Interface reconnected" +msgstr "" + +msgid "Interface shut down" +msgstr "" + +msgid "Interfaces" +msgstr "인터페이스" + +msgid "Internal" +msgstr "" + +msgid "Internal Server Error" +msgstr "" + +msgid "Invalid" +msgstr "" + +msgid "Invalid VLAN ID given! Only IDs between %d and %d are allowed." +msgstr "" + +msgid "Invalid VLAN ID given! Only unique IDs are allowed" +msgstr "" + +msgid "Invalid username and/or password! Please try again." +msgstr "" + +msgid "" +"It appears that you are trying to flash an image that does not fit into the " +"flash memory, please verify the image file!" +msgstr "" + +msgid "Java Script required!" +msgstr "" + +msgid "Join Network" +msgstr "네트워크 연결" + +msgid "Join Network: Wireless Scan" +msgstr "네트워크 연결: 무선랜 스캔 결과" + +msgid "Joining Network: %q" +msgstr "네트워크 연결중: %q" + +msgid "Keep settings" +msgstr "설정 유지" + +msgid "Kernel Log" +msgstr "Kernel 로그" + +msgid "Kernel Version" +msgstr "Kernel 버전" + +msgid "Key" +msgstr "" + +msgid "Key #%d" +msgstr "" + +msgid "Kill" +msgstr "" + +msgid "L2TP" +msgstr "" + +msgid "L2TP Server" +msgstr "" + +msgid "LCP echo failure threshold" +msgstr "" + +msgid "LCP echo interval" +msgstr "" + +msgid "LLC" +msgstr "" + +msgid "Label" +msgstr "" + +msgid "Language" +msgstr "언어" + +msgid "Language and Style" +msgstr "언어와 스타일" + +msgid "Latency" +msgstr "" + +msgid "Leaf" +msgstr "" + +msgid "Lease time" +msgstr "임대 시간" + +msgid "Lease validity time" +msgstr "" + +msgid "Leasefile" +msgstr "" + +msgid "Leasetime" +msgstr "임대 시간" + +msgid "Leasetime remaining" +msgstr "남아있는 임대 시간" + +msgid "Leave empty to autodetect" +msgstr "" + +msgid "Leave empty to use the current WAN address" +msgstr "" + +msgid "Legend:" +msgstr "" + +msgid "Limit" +msgstr "제한" + +msgid "Limit DNS service to subnets interfaces on which we are serving DNS." +msgstr "" +"DNS 를 제공하기로한 subnet 인터페이스들에 대해서만 DNS 서비스를 제공합니다." + +msgid "Limit listening to these interfaces, and loopback." +msgstr "" + +msgid "Line Attenuation (LATN)" +msgstr "" + +msgid "Line Mode" +msgstr "" + +msgid "Line State" +msgstr "" + +msgid "Line Uptime" +msgstr "" + +msgid "Link On" +msgstr "" + +msgid "" +"List of DNS servers to forward " +"requests to" +msgstr "" + +msgid "List of SSH key files for auth" +msgstr "" + +msgid "List of domains to allow RFC1918 responses for" +msgstr "" + +msgid "List of hosts that supply bogus NX domain results" +msgstr "" + +msgid "Listen Interfaces" +msgstr "" + +msgid "Listen Port" +msgstr "" + +msgid "Listen only on the given interface or, if unspecified, on all" +msgstr "" +"지정한 인터페이스에만 listening 하며 미지정시 모든 인터페이스에 적용됩니다" + +msgid "Listening port for inbound DNS queries" +msgstr "" + +msgid "Load" +msgstr "부하" + +msgid "Load Average" +msgstr "부하 평균" + +msgid "Loading" +msgstr "" + +msgid "Local IP address to assign" +msgstr "" + +msgid "Local IPv4 address" +msgstr "" + +msgid "Local IPv6 address" +msgstr "" + +msgid "Local Service Only" +msgstr "" + +msgid "Local Startup" +msgstr "Local 시작 프로그램" + +msgid "Local Time" +msgstr "지역 시간" + +msgid "Local domain" +msgstr "" + +msgid "" +"Local domain specification. Names matching this domain are never forwarded " +"and are resolved from DHCP or hosts files only" +msgstr "" + +msgid "Local domain suffix appended to DHCP names and hosts file entries" +msgstr "" + +msgid "Local server" +msgstr "" + +msgid "" +"Localise hostname depending on the requesting subnet if multiple IPs are " +"available" +msgstr "" + +msgid "Localise queries" +msgstr "" + +msgid "Locked to channel %s used by: %s" +msgstr "" + +msgid "Log output level" +msgstr "Log output 레벨" + +msgid "Log queries" +msgstr "" + +msgid "Logging" +msgstr "" + +msgid "Login" +msgstr "로그인" + +msgid "Logout" +msgstr "로그아웃" + +msgid "Loss of Signal Seconds (LOSS)" +msgstr "" + +msgid "Lowest leased address as offset from the network address." +msgstr "임대되는 주소의 최소 시작점. (네트워크 주소로 부터의 offset)" + +msgid "MAC-Address" +msgstr "MAC-주소" + +msgid "MAC-Address Filter" +msgstr "MAC-주소 필터" + +msgid "MAC-Filter" +msgstr "MAC-필터" + +msgid "MAC-List" +msgstr "" + +msgid "MAP / LW4over6" +msgstr "" + +msgid "MB/s" +msgstr "" + +msgid "MD5" +msgstr "" + +msgid "MHz" +msgstr "" + +msgid "MTU" +msgstr "" + +msgid "" +"Make sure to clone the root filesystem using something like the commands " +"below:" +msgstr "" + +msgid "Manual" +msgstr "" + +msgid "Max. Attainable Data Rate (ATTNDR)" +msgstr "" + +msgid "Maximum Rate" +msgstr "" + +msgid "Maximum allowed number of active DHCP leases" +msgstr "Active DHCP lease 건의 최대 허용 숫자" + +msgid "Maximum allowed number of concurrent DNS queries" +msgstr "허용되는 최대 동시 DNS query 수" + +msgid "Maximum allowed size of EDNS.0 UDP packets" +msgstr "허용된 최대 EDNS.0 UDP 패킷 크기" + +msgid "Maximum amount of seconds to wait for the modem to become ready" +msgstr "" + +msgid "Maximum hold time" +msgstr "" + +msgid "" +"Maximum length of the name is 15 characters including the automatic protocol/" +"bridge prefix (br-, 6in4-, pppoe- etc.)" +msgstr "" + +msgid "Maximum number of leased addresses." +msgstr "임대될 수 있는 주소의 최대 숫자." + +msgid "Mbit/s" +msgstr "" + +msgid "Memory" +msgstr "메모리" + +msgid "Memory usage (%)" +msgstr "메모리 사용량 (%)" + +msgid "Metric" +msgstr "" + +msgid "Minimum Rate" +msgstr "" + +msgid "Minimum hold time" +msgstr "" + +msgid "Mirror monitor port" +msgstr "" + +msgid "Mirror source port" +msgstr "" + +msgid "Missing protocol extension for proto %q" +msgstr "" + +msgid "Mode" +msgstr "" + +msgid "Model" +msgstr "모델" + +msgid "Modem device" +msgstr "" + +msgid "Modem init timeout" +msgstr "" + +msgid "Monitor" +msgstr "" + +msgid "Mount Entry" +msgstr "" + +msgid "Mount Point" +msgstr "" + +msgid "Mount Points" +msgstr "" + +msgid "Mount Points - Mount Entry" +msgstr "" + +msgid "Mount Points - Swap Entry" +msgstr "" + +msgid "" +"Mount Points define at which point a memory device will be attached to the " +"filesystem" +msgstr "" + +msgid "Mount filesystems not specifically configured" +msgstr "" + +msgid "Mount options" +msgstr "" + +msgid "Mount point" +msgstr "" + +msgid "Mount swap not specifically configured" +msgstr "" + +msgid "Mounted file systems" +msgstr "" + +msgid "Move down" +msgstr "" + +msgid "Move up" +msgstr "" + +msgid "Multicast Rate" +msgstr "" + +msgid "Multicast address" +msgstr "" + +msgid "NAS ID" +msgstr "" + +msgid "NAT-T Mode" +msgstr "" + +msgid "NAT64 Prefix" +msgstr "" + +msgid "NDP-Proxy" +msgstr "" + +msgid "NT Domain" +msgstr "" + +msgid "NTP server candidates" +msgstr "NTP 서버 목록" + +msgid "NTP sync time-out" +msgstr "" + +msgid "Name" +msgstr "이름" + +msgid "Name of the new interface" +msgstr "" + +msgid "Name of the new network" +msgstr "" + +msgid "Navigation" +msgstr "" + +msgid "Netmask" +msgstr "" + +msgid "Network" +msgstr "네트워크" + +msgid "Network Utilities" +msgstr "네트워크 유틸리티" + +msgid "Network boot image" +msgstr "네트워크 boot 이미지" + +msgid "Network without interfaces." +msgstr "" + +msgid "Next »" +msgstr "" + +msgid "No DHCP Server configured for this interface" +msgstr "" + +msgid "No NAT-T" +msgstr "" + +msgid "No chains in this table" +msgstr "이 table 에는 정의된 chain 이 없음" + +msgid "No files found" +msgstr "" + +msgid "No information available" +msgstr "이용 가능한 정보가 없습니다" + +msgid "No negative cache" +msgstr "" + +msgid "No network configured on this device" +msgstr "" + +msgid "No network name specified" +msgstr "" + +msgid "No package lists available" +msgstr "" + +msgid "No password set!" +msgstr "" + +msgid "No rules in this chain" +msgstr "" + +msgid "No zone assigned" +msgstr "" + +msgid "Noise" +msgstr "노이즈" + +msgid "Noise Margin (SNR)" +msgstr "" + +msgid "Noise:" +msgstr "" + +msgid "Non Pre-emtive CRC errors (CRC_P)" +msgstr "" + +msgid "Non-wildcard" +msgstr "" + +msgid "None" +msgstr "" + +msgid "Normal" +msgstr "" + +msgid "Not Found" +msgstr "" + +msgid "Not associated" +msgstr "" + +msgid "Not connected" +msgstr "연결되지 않음" + +msgid "Note: Configuration files will be erased." +msgstr "" + +msgid "Note: interface name length" +msgstr "" + +msgid "Notice" +msgstr "" + +msgid "Nslookup" +msgstr "" + +msgid "OK" +msgstr "" + +msgid "OPKG-Configuration" +msgstr "OPKG-설정" + +msgid "Obfuscated Group Password" +msgstr "" + +msgid "Obfuscated Password" +msgstr "" + +msgid "Off-State Delay" +msgstr "" + +msgid "" +"On this page you can configure the network interfaces. You can bridge " +"several interfaces by ticking the \"bridge interfaces\" field and enter the " +"names of several network interfaces separated by spaces. You can also use " +"VLAN notation " +"INTERFACE.VLANNR (e.g.: " +"eth0.1)." +msgstr "" +"이 페이지에서는 네트워크 인터페이스를 설정할 수 있습니다. \"Bridge 인터페이스" +"\" 항목을 클릭하고, 공백으로 구분된 네트워크 인터페이스들의 이름을 적는 방식" +"으로 여러 인터페이스들을 bridge 할 수 있습니다. 또한 VLAN 표기법인 INTERFACE.VLANNR " +"(예: eth0.1) 를 사용하실 수 " +"있습니다." + +msgid "On-State Delay" +msgstr "" + +msgid "One of hostname or mac address must be specified!" +msgstr "" + +msgid "One or more fields contain invalid values!" +msgstr "" + +msgid "One or more invalid/required values on tab" +msgstr "" + +msgid "One or more required fields have no value!" +msgstr "" + +msgid "Open list..." +msgstr "목록 열람..." + +msgid "OpenConnect (CISCO AnyConnect)" +msgstr "" + +msgid "Operating frequency" +msgstr "동작 주파수" + +msgid "Option changed" +msgstr "변경된 option" + +msgid "Option removed" +msgstr "삭제된 option" + +msgid "Optional, specify to override default server (tic.sixxs.net)" +msgstr "" + +msgid "Optional, use when the SIXXS account has more than one tunnel" +msgstr "" + +msgid "Optional." +msgstr "" + +msgid "" +"Optional. Adds in an additional layer of symmetric-key cryptography for post-" +"quantum resistance." +msgstr "" + +msgid "Optional. Create routes for Allowed IPs for this peer." +msgstr "" + +msgid "" +"Optional. Host of peer. Names are resolved prior to bringing up the " +"interface." +msgstr "" + +msgid "Optional. Maximum Transmission Unit of tunnel interface." +msgstr "" + +msgid "Optional. Port of peer." +msgstr "" + +msgid "" +"Optional. Seconds between keep alive messages. Default is 0 (disabled). " +"Recommended value if this device is behind a NAT is 25." +msgstr "" + +msgid "Optional. UDP port used for outgoing and incoming packets." +msgstr "" + +msgid "Options" +msgstr "" + +msgid "Other:" +msgstr "" + +msgid "Out" +msgstr "" + +msgid "Outbound:" +msgstr "" + +msgid "Outdoor Channels" +msgstr "" + +msgid "Output Interface" +msgstr "" + +msgid "Override MAC address" +msgstr "MAC 주소 덮어쓰기" + +msgid "Override MTU" +msgstr "MTU 덮어쓰기" + +msgid "Override TOS" +msgstr "" + +msgid "Override TTL" +msgstr "" + +msgid "Override default interface name" +msgstr "기본 인터페이스 이름을 덮어씁니다" + +msgid "Override the gateway in DHCP responses" +msgstr "" + +msgid "" +"Override the netmask sent to clients. Normally it is calculated from the " +"subnet that is served." +msgstr "" +"Client 에 전달될 netmask 를 덮어 쓸 수 있습니다. 보통 해당 값은 제공되는 " +"subnet 에 따라 자동 계산됩니다." + +msgid "Override the table used for internal routes" +msgstr "" + +msgid "Overview" +msgstr "개요" + +msgid "Owner" +msgstr "" + +msgid "PAP/CHAP password" +msgstr "" + +msgid "PAP/CHAP username" +msgstr "" + +msgid "PID" +msgstr "" + +msgid "PIN" +msgstr "" + +msgid "PPP" +msgstr "" + +msgid "PPPoA Encapsulation" +msgstr "" + +msgid "PPPoATM" +msgstr "" + +msgid "PPPoE" +msgstr "" + +msgid "PPPoSSH" +msgstr "" + +msgid "PPtP" +msgstr "" + +msgid "PSID offset" +msgstr "" + +msgid "PSID-bits length" +msgstr "" + +msgid "PTM/EFM (Packet Transfer Mode)" +msgstr "" + +msgid "Package libiwinfo required!" +msgstr "" + +msgid "Package lists are older than 24 hours" +msgstr "" + +msgid "Package name" +msgstr "패키지 이름" + +msgid "Packets" +msgstr "" + +msgid "Part of zone %q" +msgstr "" + +msgid "Password" +msgstr "암호" + +msgid "Password authentication" +msgstr "암호 인증" + +msgid "Password of Private Key" +msgstr "" + +msgid "Password of inner Private Key" +msgstr "" + +msgid "Password successfully changed!" +msgstr "" + +msgid "Path to CA-Certificate" +msgstr "" + +msgid "Path to Client-Certificate" +msgstr "" + +msgid "Path to Private Key" +msgstr "" + +msgid "Path to executable which handles the button event" +msgstr "" + +msgid "Path to inner CA-Certificate" +msgstr "" + +msgid "Path to inner Client-Certificate" +msgstr "" + +msgid "Path to inner Private Key" +msgstr "" + +msgid "Peak:" +msgstr "최고치:" + +msgid "Peer IP address to assign" +msgstr "" + +msgid "Peers" +msgstr "" + +msgid "Perfect Forward Secrecy" +msgstr "" + +msgid "Perform reboot" +msgstr "재부팅하기" + +msgid "Perform reset" +msgstr "Reset 하기" + +msgid "Persistent Keep Alive" +msgstr "" + +msgid "Phy Rate:" +msgstr "" + +msgid "Physical Settings" +msgstr "Physical 설정" + +msgid "Ping" +msgstr "" + +msgid "Pkts." +msgstr "Pkts." + +msgid "Please enter your username and password." +msgstr "사용자이름과 암호를 입력해 주세요." + +msgid "Policy" +msgstr "" + +msgid "Port" +msgstr "포트" + +msgid "Port status:" +msgstr "포트 상태:" + +msgid "Power Management Mode" +msgstr "" + +msgid "Pre-emtive CRC errors (CRCP_P)" +msgstr "" + +msgid "Preshared Key" +msgstr "" + +msgid "" +"Presume peer to be dead after given amount of LCP echo failures, use 0 to " +"ignore failures" +msgstr "" + +msgid "Prevent listening on these interfaces." +msgstr "" + +msgid "Prevents client-to-client communication" +msgstr "" + +msgid "Prism2/2.5/3 802.11b Wireless Controller" +msgstr "" + +msgid "Private Key" +msgstr "" + +msgid "Proceed" +msgstr "" + +msgid "Processes" +msgstr "프로세스" + +msgid "Profile" +msgstr "" + +msgid "Prot." +msgstr "Prot." + +msgid "Protocol" +msgstr "프로토콜" + +msgid "Protocol family" +msgstr "" + +msgid "Protocol of the new interface" +msgstr "" + +msgid "Protocol support is not installed" +msgstr "" + +msgid "Provide NTP server" +msgstr "" + +msgid "Provide new network" +msgstr "새로운 네트워크를 추가합니다" + +msgid "Pseudo Ad-Hoc (ahdemo)" +msgstr "" + +msgid "Public Key" +msgstr "" + +msgid "Public prefix routed to this device for distribution to clients." +msgstr "" + +msgid "QMI Cellular" +msgstr "" + +msgid "Quality" +msgstr "" + +msgid "RFC3947 NAT-T mode" +msgstr "" + +msgid "RTS/CTS Threshold" +msgstr "" + +msgid "RX" +msgstr "" + +msgid "RX Rate" +msgstr "" + +msgid "RaLink 802.11%s Wireless Controller" +msgstr "" + +msgid "Radius-Accounting-Port" +msgstr "" + +msgid "Radius-Accounting-Secret" +msgstr "" + +msgid "Radius-Accounting-Server" +msgstr "" + +msgid "Radius-Authentication-Port" +msgstr "" + +msgid "Radius-Authentication-Secret" +msgstr "" + +msgid "Radius-Authentication-Server" +msgstr "" + +msgid "" +"Read /etc/ethers to configure the DHCP-Server" +msgstr "" +"/etc/ethers 파일을 읽어 DHCP-서버를 설정합니다" + +msgid "" +"Really delete this interface? The deletion cannot be undone!\\nYou might " +"lose access to this device if you are connected via this interface." +msgstr "" + +msgid "" +"Really delete this wireless network? The deletion cannot be undone!\\nYou " +"might lose access to this device if you are connected via this network." +msgstr "" + +msgid "Really reset all changes?" +msgstr "" + +msgid "" +"Really shut down network?\\nYou might lose access to this device if you are " +"connected via this interface." +msgstr "" +"정말로 네트워크를 shutdown 하시겠습니까?\\n이 인터페이스를 통해 연결하였다면 " +"접속이 끊어질 수 있습니다." + +msgid "" +"Really shutdown interface \"%s\" ?\\nYou might lose access to this device if " +"you are connected via this interface." +msgstr "" + +msgid "Really switch protocol?" +msgstr "정말 프로토콜 변경을 원하세요?" + +msgid "Realtime Connections" +msgstr "실시간 연결수" + +msgid "Realtime Graphs" +msgstr "실시간 그래프" + +msgid "Realtime Load" +msgstr "실시간 부하" + +msgid "Realtime Traffic" +msgstr "실시간 트래픽" + +msgid "Realtime Wireless" +msgstr "" + +msgid "Rebind protection" +msgstr "" + +msgid "Reboot" +msgstr "재부팅" + +msgid "Rebooting..." +msgstr "" + +msgid "Reboots the operating system of your device" +msgstr "장치의 운영체제를 재부팅합니다" + +msgid "Receive" +msgstr "" + +msgid "Receiver Antenna" +msgstr "" + +msgid "Reconnect this interface" +msgstr "이 인터페이스를 재연결합니다" + +msgid "Reconnecting interface" +msgstr "인터페이스 재연결중입니다" + +msgid "References" +msgstr "" + +msgid "Regulatory Domain" +msgstr "" + +msgid "Relay" +msgstr "" + +msgid "Relay Bridge" +msgstr "" + +msgid "Relay between networks" +msgstr "" + +msgid "Relay bridge" +msgstr "" + +msgid "Remote IPv4 address" +msgstr "" + +msgid "Remote IPv4 address or FQDN" +msgstr "" + +msgid "Remove" +msgstr "제거" + +msgid "Repeat scan" +msgstr "" + +msgid "Replace entry" +msgstr "" + +msgid "Replace wireless configuration" +msgstr "" + +msgid "Request IPv6-address" +msgstr "" + +msgid "Request IPv6-prefix of length" +msgstr "" + +msgid "Require TLS" +msgstr "" + +msgid "Required for certain ISPs, e.g. Charter with DOCSIS 3" +msgstr "특정 ISP 들에 요구됨. 예: Charter (DOCSIS 3 기반)" + +msgid "Required. Base64-encoded private key for this interface." +msgstr "" + +msgid "" +"Required. IP addresses and prefixes that this peer is allowed to use inside " +"the tunnel. Usually the peer's tunnel IP addresses and the networks the peer " +"routes through the tunnel." +msgstr "" + +msgid "Required. Public key of peer." +msgstr "" + +msgid "" +"Requires upstream supports DNSSEC; verify unsigned domain responses really " +"come from unsigned domains" +msgstr "" + +msgid "Reset" +msgstr "초기화" + +msgid "Reset Counters" +msgstr "Counter 초기화" + +msgid "Reset to defaults" +msgstr "초기값으로 reset" + +msgid "Resolv and Hosts Files" +msgstr "Resolv 와 Hosts 파일" + +msgid "Resolve file" +msgstr "Resolve 파일" + +msgid "Restart" +msgstr "재시작" + +msgid "Restart Firewall" +msgstr "방화벽 재시작" + +msgid "Restore backup" +msgstr "백업 복구" + +msgid "Reveal/hide password" +msgstr "암호 보이기/숨기기" + +msgid "Revert" +msgstr "변경 취소" + +msgid "Root" +msgstr "" + +msgid "Root directory for files served via TFTP" +msgstr "TFTP 를 통해 제공되는 파일들의 root 디렉토리" + +msgid "Root preparation" +msgstr "" + +msgid "Route Allowed IPs" +msgstr "" + +msgid "Route type" +msgstr "" + +msgid "Routed IPv6 prefix for downstream interfaces" +msgstr "" + +msgid "Router Advertisement-Service" +msgstr "" + +msgid "Router Password" +msgstr "라우터 암호" + +msgid "Routes" +msgstr "Route 경로" + +msgid "" +"Routes specify over which interface and gateway a certain host or network " +"can be reached." +msgstr "" +"Route 경로는 특정 호스트 혹은 네트워크가 사용해야 할 인터페이스와 gateway 정" +"보를 나타냅니다." + +msgid "Run a filesystem check before mounting the device" +msgstr "" + +msgid "Run filesystem check" +msgstr "" + +msgid "SHA256" +msgstr "" + +msgid "" +"SIXXS supports TIC only, for static tunnels using IP protocol 41 (RFC4213) " +"use 6in4 instead" +msgstr "" + +msgid "SIXXS-handle[/Tunnel-ID]" +msgstr "" + +msgid "SNR" +msgstr "" + +msgid "SSH Access" +msgstr "" + +msgid "SSH server address" +msgstr "" + +msgid "SSH server port" +msgstr "" + +msgid "SSH username" +msgstr "" + +msgid "SSH-Keys" +msgstr "" + +msgid "SSID" +msgstr "SSID" + +msgid "Save" +msgstr "저장" + +msgid "Save & Apply" +msgstr "저장 & 적용" + +msgid "Save & Apply" +msgstr "저장 & 적용" + +msgid "Scan" +msgstr "Scan 하기" + +msgid "Scheduled Tasks" +msgstr "작업 관리" + +msgid "Section added" +msgstr "추가된 section" + +msgid "Section removed" +msgstr "삭제된 section" + +msgid "See \"mount\" manpage for details" +msgstr "" + +msgid "" +"Send LCP echo requests at the given interval in seconds, only effective in " +"conjunction with failure threshold" +msgstr "" + +msgid "Separate Clients" +msgstr "" + +msgid "Separate WDS" +msgstr "" + +msgid "Server Settings" +msgstr "서버 설정" + +msgid "Server password" +msgstr "" + +msgid "" +"Server password, enter the specific password of the tunnel when the username " +"contains the tunnel ID" +msgstr "" + +msgid "Server username" +msgstr "" + +msgid "Service Name" +msgstr "" + +msgid "Service Type" +msgstr "" + +msgid "Services" +msgstr "Services" + +msgid "Set up Time Synchronization" +msgstr "" + +msgid "Setup DHCP Server" +msgstr "" + +msgid "Severely Errored Seconds (SES)" +msgstr "" + +msgid "Short GI" +msgstr "" + +msgid "Show current backup file list" +msgstr "현재 백업 파일 목록 보기" + +msgid "Shutdown this interface" +msgstr "이 인터페이스를 정지합니다" + +msgid "Shutdown this network" +msgstr "이 네트워크를 shutdown 합니다" + +msgid "Signal" +msgstr "신호" + +msgid "Signal Attenuation (SATN)" +msgstr "" + +msgid "Signal:" +msgstr "" + +msgid "Size" +msgstr "Size" + +msgid "Size (.ipk)" +msgstr "크기 (.ipk)" + +msgid "Skip" +msgstr "" + +msgid "Skip to content" +msgstr "" + +msgid "Skip to navigation" +msgstr "" + +msgid "Slot time" +msgstr "" + +msgid "Software" +msgstr "소프트웨어" + +msgid "Software VLAN" +msgstr "" + +msgid "Some fields are invalid, cannot save values!" +msgstr "" + +msgid "Sorry, the object you requested was not found." +msgstr "" + +msgid "Sorry, the server encountered an unexpected error." +msgstr "" + +msgid "" +"Sorry, there is no sysupgrade support present; a new firmware image must be " +"flashed manually. Please refer to the wiki for device specific install " +"instructions." +msgstr "" + +msgid "Sort" +msgstr "순서" + +msgid "Source" +msgstr "" + +msgid "Source routing" +msgstr "" + +msgid "Specifies the button state to handle" +msgstr "" + +msgid "Specifies the directory the device is attached to" +msgstr "" + +msgid "Specifies the listening port of this Dropbear instance" +msgstr "Dropbear instance 의 listening 포트를 지정합니다" + +msgid "" +"Specifies the maximum amount of failed ARP requests until hosts are presumed " +"to be dead" +msgstr "" + +msgid "" +"Specifies the maximum amount of seconds after which hosts are presumed to be " +"dead" +msgstr "" + +msgid "Specify a TOS (Type of Service)." +msgstr "" + +msgid "" +"Specify a TTL (Time to Live) for the encapsulating packet other than the " +"default (64)." +msgstr "" + +msgid "" +"Specify an MTU (Maximum Transmission Unit) other than the default (1280 " +"bytes)." +msgstr "" + +msgid "Specify the secret encryption key here." +msgstr "" + +msgid "Start" +msgstr "시작" + +msgid "Start priority" +msgstr "시작 우선순위" + +msgid "Startup" +msgstr "시작 프로그램" + +msgid "Static IPv4 Routes" +msgstr "Static IPv4 Route 경로" + +msgid "Static IPv6 Routes" +msgstr "Static IPv6 Route 경로" + +msgid "Static Leases" +msgstr "Static Lease 들" + +msgid "Static Routes" +msgstr "Static Route 경로" + +msgid "Static WDS" +msgstr "" + +msgid "Static address" +msgstr "" + +msgid "" +"Static leases are used to assign fixed IP addresses and symbolic hostnames " +"to DHCP clients. They are also required for non-dynamic interface " +"configurations where only hosts with a corresponding lease are served." +msgstr "" +"Static Lease 는 DHCP client 에게 고정된 IP 주소와 symbolic hostname 을 할당" +"할 때 사용됩니다. 이 기능은 또한 지정된 host 에 대해서만 주소 임대를 하도록 " +"하는 non-dynamic 인터페이스 설정에도 사용됩니다." + +msgid "Status" +msgstr "상태" + +msgid "Stop" +msgstr "정지" + +msgid "Strict order" +msgstr "Strict order" + +msgid "Submit" +msgstr "제출하기" + +msgid "Suppress logging" +msgstr "" + +msgid "Suppress logging of the routine operation of these protocols" +msgstr "" + +msgid "Swap" +msgstr "" + +msgid "Swap Entry" +msgstr "" + +msgid "Switch" +msgstr "스위치" + +msgid "Switch %q" +msgstr "스위치 %q" + +msgid "Switch %q (%s)" +msgstr "스위치 %q (%s)" + +msgid "" +"Switch %q has an unknown topology - the VLAN settings might not be accurate." +msgstr "" + +msgid "Switch VLAN" +msgstr "스위치 VLAN" + +msgid "Switch protocol" +msgstr "프로토콜 변경" + +msgid "Sync with browser" +msgstr "브라우저 시간대로 동기화" + +msgid "Synchronizing..." +msgstr "" + +msgid "System" +msgstr "시스템" + +msgid "System Log" +msgstr "시스템 로그" + +msgid "System Properties" +msgstr "시스템 등록 정보" + +msgid "System log buffer size" +msgstr "System log 버퍼 크기" + +msgid "TCP:" +msgstr "" + +msgid "TFTP Settings" +msgstr "TFTP 설정" + +msgid "TFTP server root" +msgstr "TFTP 서버 root" + +msgid "TX" +msgstr "TX" + +msgid "TX Rate" +msgstr "" + +msgid "Table" +msgstr "" + +msgid "Target" +msgstr "" + +msgid "Target network" +msgstr "" + +msgid "Terminate" +msgstr "" + +msgid "" +"The Device Configuration section covers physical settings of the " +"radio hardware such as channel, transmit power or antenna selection which " +"are shared among all defined wireless networks (if the radio hardware is " +"multi-SSID capable). Per network settings like encryption or operation mode " +"are grouped in the Interface Configuration." +msgstr "" +"장치 설정 섹션은 channel, transmit power 혹은 antenna 선택과 같은 물" +"리적인 설정 내용을 다룹니다. 이 설정은 (만약 radio 하드웨어가 multi-SSID 지" +"원이 가능하다면) 정의된 모든 무선 네트워크에 공통적으로 적용됩니다. 암호화 혹" +"은 operation mode 와 같은 각 네트워크 설정들은 인터페이스 설정에서 " +"다루어집니다." + +msgid "" +"The libiwinfo-lua package is not installed. You must install this " +"component for working wireless configuration!" +msgstr "" + +msgid "" +"The HE.net endpoint update configuration changed, you must now use the plain " +"username instead of the user ID!" +msgstr "" + +msgid "" +"The IPv4 address or the fully-qualified domain name of the remote tunnel end." +msgstr "" + +msgid "" +"The IPv6 prefix assigned to the provider, usually ends with ::" +msgstr "" + +msgid "" +"The allowed characters are: A-Z, a-z, 0-9 and _" +msgstr "" + +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + +msgid "" +"The device file of the memory or partition (e.g." +" /dev/sda1)" +msgstr "" + +msgid "" +"The filesystem that was used to format the memory (e.g. ext3)" +msgstr "" + +msgid "" +"The flash image was uploaded. Below is the checksum and file size listed, " +"compare them with the original file to ensure data integrity.
Click " +"\"Proceed\" below to start the flash procedure." +msgstr "" + +msgid "The following changes have been committed" +msgstr "" + +msgid "The following changes have been reverted" +msgstr "다음의 변경 사항들이 취소되었습니다" + +msgid "The following rules are currently active on this system." +msgstr "다음의 rule 들이 현재 이 시스템에 적용 중입니다." + +msgid "The given network name is not unique" +msgstr "" + +msgid "" +"The hardware is not multi-SSID capable and the existing configuration will " +"be replaced if you proceed." +msgstr "" + +msgid "" +"The length of the IPv4 prefix in bits, the remainder is used in the IPv6 " +"addresses." +msgstr "" + +msgid "The length of the IPv6 prefix in bits" +msgstr "" + +msgid "The local IPv4 address over which the tunnel is created (optional)." +msgstr "" + +msgid "" +"The network ports on this device can be combined to several VLANs in which computers can " +"communicate directly with each other. VLANs are often used to separate different network " +"segments. Often there is by default one Uplink port for a connection to the " +"next greater network like the internet and other ports for a local network." +msgstr "" +"이 장치의 네트워크 포트들은 컴퓨터끼리 직접 통신을 할 수 있도록 여러 VLAN 으로 구성될 수 있습니다. " +"VLAN은 종종 다른 네트워크 " +"segment 들을 분리하는데 사용되기도 합니다. 한 개의 uplink 포트가 인터넷에 연" +"결되어 있고 나머지 포트들은 local 네트워크로 연결되는 구성에 자주 사용됩니다." + +msgid "The selected protocol needs a device assigned" +msgstr "" + +msgid "The submitted security token is invalid or already expired!" +msgstr "" + +msgid "" +"The system is erasing the configuration partition now and will reboot itself " +"when finished." +msgstr "" + +msgid "" +"The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a " +"few minutes before you try to reconnect. It might be necessary to renew the " +"address of your computer to reach the device again, depending on your " +"settings." +msgstr "" + +msgid "" +"The tunnel end-point is behind NAT, defaults to disabled and only applies to " +"AYIYA" +msgstr "" + +msgid "" +"The uploaded image file does not contain a supported format. Make sure that " +"you choose the generic image format for your platform." +msgstr "" + +msgid "There are no active leases." +msgstr "" + +msgid "There are no pending changes to apply!" +msgstr "" + +msgid "There are no pending changes to revert!" +msgstr "" + +msgid "There are no pending changes!" +msgstr "" + +msgid "" +"There is no device assigned yet, please attach a network device in the " +"\"Physical Settings\" tab" +msgstr "" + +msgid "" +"There is no password set on this router. Please configure a root password to " +"protect the web interface and enable SSH." +msgstr "" + +msgid "This IPv4 address of the relay" +msgstr "" + +msgid "" +"This file may contain lines like 'server=/domain/1.2.3.4' or " +"'server=1.2.3.4' fordomain-specific or full upstream DNS servers." +msgstr "" + +msgid "" +"This is a list of shell glob patterns for matching files and directories to " +"include during sysupgrade. Modified files in /etc/config/ and certain other " +"configurations are automatically preserved." +msgstr "" +"이것은 sysupgrade 시 유지되어야 하는 파일과 디렉토리 목록에 대한 shell glob " +"패턴들입니다. /etc/config/ 하위의 수정된 파일이나 특정 다른 설정들은 자동적" +"으로 변경 사항이 보존됩니다." + +msgid "" +"This is either the \"Update Key\" configured for the tunnel or the account " +"password if no update key has been configured" +msgstr "" + +msgid "" +"This is the content of /etc/rc.local. Insert your own commands here (in " +"front of 'exit 0') to execute them at the end of the boot process." +msgstr "" +"이것은 /etc/rc.local 파일의 내용입니다. 여기에 ('exit 0' 앞에) 부팅 절차가 " +"끝날 때 실행하고자 하는 명령들을 삽입하세요." + +msgid "" +"This is the local endpoint address assigned by the tunnel broker, it usually " +"ends with :2" +msgstr "" + +msgid "" +"This is the only DHCP in the local network" +msgstr "" + +msgid "This is the plain username for logging into the account" +msgstr "" + +msgid "" +"This is the prefix routed to you by the tunnel broker for use by clients" +msgstr "" + +msgid "This is the system crontab in which scheduled tasks can be defined." +msgstr "아래는 예정된 작업들이 정의된 시스템 crontab 내용입니다." + +msgid "" +"This is usually the address of the nearest PoP operated by the tunnel broker" +msgstr "" + +msgid "" +"This list gives an overview over currently running system processes and " +"their status." +msgstr "" +"이 목록은 현재 실행중인 시스템 프로세스와 해당 상태에 대한 개요를 보여줍니다." + +msgid "This page allows the configuration of custom button actions" +msgstr "" + +msgid "This page gives an overview over currently active network connections." +msgstr "이 페이지는 현재 active 상태인 네트워크 연결을 보여줍니다." + +msgid "This section contains no values yet" +msgstr "이 section 은 아직 입력된 값이 없습니다" + +msgid "Time Synchronization" +msgstr "시간 동기화" + +msgid "Time Synchronization is not configured yet." +msgstr "시간 동기화가 아직 설정되지 않았습니다." + +msgid "Timezone" +msgstr "시간대" + +msgid "" +"To restore configuration files, you can upload a previously generated backup " +"archive here." +msgstr "" +"설정 파일을 복구하고자 한다면 이전에 백업하신 아카이브 파일을 여기로 업로드" +"할 수 있습니다." + +msgid "Tone" +msgstr "" + +msgid "Total Available" +msgstr "총 이용 가능한 양" + +msgid "Traceroute" +msgstr "" + +msgid "Traffic" +msgstr "트래픽" + +msgid "Transfer" +msgstr "전송량" + +msgid "Transmission Rate" +msgstr "" + +msgid "Transmit" +msgstr "" + +msgid "Transmit Power" +msgstr "" + +msgid "Transmitter Antenna" +msgstr "" + +msgid "Trigger" +msgstr "" + +msgid "Trigger Mode" +msgstr "" + +msgid "Tunnel ID" +msgstr "" + +msgid "Tunnel Interface" +msgstr "" + +msgid "Tunnel Link" +msgstr "" + +msgid "Tunnel broker protocol" +msgstr "" + +msgid "Tunnel setup server" +msgstr "" + +msgid "Tunnel type" +msgstr "" + +msgid "Turbo Mode" +msgstr "" + +msgid "Tx-Power" +msgstr "" + +msgid "Type" +msgstr "유형" + +msgid "UDP:" +msgstr "" + +msgid "UMTS only" +msgstr "" + +msgid "UMTS/GPRS/EV-DO" +msgstr "" + +msgid "USB Device" +msgstr "" + +msgid "UUID" +msgstr "" + +msgid "Unable to dispatch" +msgstr "" + +msgid "Unavailable Seconds (UAS)" +msgstr "" + +msgid "Unknown" +msgstr "알수없음" + +msgid "Unknown Error, password not changed!" +msgstr "" + +msgid "Unmanaged" +msgstr "" + +msgid "Unmount" +msgstr "" + +msgid "Unsaved Changes" +msgstr "적용 안된 변경 사항" + +msgid "Unsupported protocol type." +msgstr "" + +msgid "Update lists" +msgstr "" + +msgid "" +"Upload a sysupgrade-compatible image here to replace the running firmware. " +"Check \"Keep settings\" to retain the current configuration (requires a " +"compatible firmware image)." +msgstr "" +"실행중인 firmware 변경을 하고자 한다면 여기에 sysupgrade 호환성이 유지되는 이" +"미지를 업로드하세요. 현재의 설정을 유지하고자 한다면 \"설정 유지\" 를 체크하" +"세요. (이를 지원하는 firmware 이미지 필요)" + +msgid "Upload archive..." +msgstr "아카이브 업로드..." + +msgid "Uploaded File" +msgstr "Uploaded File" + +msgid "Uptime" +msgstr "가동 시간" + +msgid "Use /etc/ethers" +msgstr "/etc/ethers 사용" + +msgid "Use DHCP gateway" +msgstr "" + +msgid "Use DNS servers advertised by peer" +msgstr "Peer 가 권장한 DNS 서버 사용" + +msgid "Use ISO/IEC 3166 alpha2 country codes." +msgstr "" + +msgid "Use MTU on tunnel interface" +msgstr "" + +msgid "Use TTL on tunnel interface" +msgstr "" + +msgid "Use as external overlay (/overlay)" +msgstr "" + +msgid "Use as root filesystem (/)" +msgstr "" + +msgid "Use broadcast flag" +msgstr "Broadcast flag 사용" + +msgid "Use builtin IPv6-management" +msgstr "자체 내장 IPv6-관리 기능 사용" + +msgid "Use custom DNS servers" +msgstr "임의의 DNS 서버 사용" + +msgid "Use default gateway" +msgstr "Default gateway 사용" + +msgid "Use gateway metric" +msgstr "Gateway metric 사용" + +msgid "Use routing table" +msgstr "Routing table 사용" + +msgid "" +"Use the Add Button to add a new lease entry. The MAC-Address indentifies the host, the IPv4-Address specifies to the fixed " +"address to use and the Hostname is assigned as symbolic name to the " +"requesting host. The optional Lease time can be used to set non-" +"standard host-specific lease time, e.g. 12h, 3d or infinite." +msgstr "" +"새로운 항목을 추가하기 위해서는 추가 버튼을 사용하세요. MAC-주소" +"는 host 를 나타내며, IPv4-주소는 사용할 고정 주소를 나타내고, " +"요청하는 host 에 대해 hostname 이 symbolic name 으로 부여됩니다. 선" +"택 사항인 임대 시간은 해당 host 에만 해당되는 시각을 설정하는데 사용" +"될 수 있습니다. 예를 들어 12h, 3d 혹은 infinite 값들이 가능합니다." + +msgid "Used" +msgstr "" + +msgid "Used Key Slot" +msgstr "" + +msgid "User certificate (PEM encoded)" +msgstr "" + +msgid "User key (PEM encoded)" +msgstr "" + +msgid "Username" +msgstr "사용자이름" + +msgid "VC-Mux" +msgstr "" + +msgid "VDSL" +msgstr "" + +msgid "VLANs on %q" +msgstr "" + +msgid "VLANs on %q (%s)" +msgstr "VLAN 설정: %q (%s)" + +msgid "VPN Local address" +msgstr "" + +msgid "VPN Local port" +msgstr "" + +msgid "VPN Server" +msgstr "" + +msgid "VPN Server port" +msgstr "" + +msgid "VPN Server's certificate SHA1 hash" +msgstr "" + +msgid "VPNC (CISCO 3000 (and others) VPN)" +msgstr "" + +msgid "Vendor" +msgstr "" + +msgid "Vendor Class to send when requesting DHCP" +msgstr "DHCP 요청시 전송할 Vendor Class" + +msgid "Verbose" +msgstr "" + +msgid "Verbose logging by aiccu daemon" +msgstr "" + +msgid "Verify" +msgstr "" + +msgid "Version" +msgstr "버전" + +msgid "WDS" +msgstr "WDS" + +msgid "WEP Open System" +msgstr "" + +msgid "WEP Shared Key" +msgstr "" + +msgid "WEP passphrase" +msgstr "" + +msgid "WMM Mode" +msgstr "WMM Mode" + +msgid "WPA passphrase" +msgstr "" + +msgid "" +"WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " +"and ad-hoc mode) to be installed." +msgstr "" + +msgid "" +"Wait for NTP sync that many seconds, seting to 0 disables waiting (optional)" +msgstr "" + +msgid "Waiting for changes to be applied..." +msgstr "변경 사항이 적용되기를 기다리는 중입니다..." + +msgid "Waiting for command to complete..." +msgstr "실행한 명령이 끝나기를 기다리는 중입니다..." + +msgid "Waiting for device..." +msgstr "" + +msgid "Warning" +msgstr "" + +msgid "Warning: There are unsaved changes that will get lost on reboot!" +msgstr "" + +msgid "Whether to create an IPv6 default route over the tunnel" +msgstr "" + +msgid "Whether to route only packets from delegated prefixes" +msgstr "" + +msgid "Width" +msgstr "" + +msgid "WireGuard VPN" +msgstr "" + +msgid "Wireless" +msgstr "무선" + +msgid "Wireless Adapter" +msgstr "" + +msgid "Wireless Network" +msgstr "무선랜 네트워크" + +msgid "Wireless Overview" +msgstr "무선랜 개요" + +msgid "Wireless Security" +msgstr "무선랜 보안" + +msgid "Wireless is disabled or not associated" +msgstr "무선이 비활성화되어 있거나 연결되어 있지 않습니다" + +msgid "Wireless is restarting..." +msgstr "무선랜이 재시작중입니다..." + +msgid "Wireless network is disabled" +msgstr "무선 네트워크가 꺼져 있음" + +msgid "Wireless network is enabled" +msgstr "무선 네트워크가 켜져 있음" + +msgid "Wireless restarted" +msgstr "무선랜이 재시작되었습니다" + +msgid "Wireless shut down" +msgstr "무선랜이 shutdown 되었습니다" + +msgid "Write received DNS requests to syslog" +msgstr "받은 DNS 요청 내용을 systlog 에 기록합니다" + +msgid "Write system log to file" +msgstr "System log 출력 파일 경로" + +msgid "XR Support" +msgstr "" + +msgid "" +"You can enable or disable installed init scripts here. Changes will applied " +"after a device reboot.
Warning: If you disable essential init " +"scripts like \"network\", your device might become inaccessible!" +msgstr "" +"이 메뉴에서 설치된 init script 를 활성화/비활성화 할 수 있습니다. 변경 사항" +"은 장치가 재부팅 될 때 적용되게 됩니다.
경고: 만약 \"network\" " +"와 같은 중요 init script 를 비활성화 할 경우, 장치에 접속을 못하실 수 있습니" +"다!" + +msgid "" +"You must enable Java Script in your browser or LuCI will not work properly." +msgstr "" + +msgid "" +"Your Internet Explorer is too old to display this page correctly. Please " +"upgrade it to at least version 7 or use another browser like Firefox, Opera " +"or Safari." +msgstr "" + +msgid "any" +msgstr "" + +msgid "auto" +msgstr "" + +msgid "automatic" +msgstr "" + +msgid "baseT" +msgstr "" + +msgid "bridged" +msgstr "" + +msgid "create:" +msgstr "" + +msgid "creates a bridge over specified interface(s)" +msgstr "지정한 인터페이스(들)로 구성된 bridge 를 생성합니다" + +msgid "dB" +msgstr "" + +msgid "dBm" +msgstr "" + +msgid "disable" +msgstr "" + +msgid "disabled" +msgstr "" + +msgid "expired" +msgstr "만료됨" + +msgid "" +"file where given DHCP-leases will be stored" +msgstr "" +"할당된 DHCP-lease " +"정보가 저장되는 파일" + +msgid "forward" +msgstr "" + +msgid "full-duplex" +msgstr "" + +msgid "half-duplex" +msgstr "" + +msgid "help" +msgstr "" + +msgid "hidden" +msgstr "" + +msgid "hybrid mode" +msgstr "" + +msgid "if target is a network" +msgstr "Target 이 네트워크일 경우" + +msgid "input" +msgstr "" + +msgid "kB" +msgstr "" + +msgid "kB/s" +msgstr "" + +msgid "kbit/s" +msgstr "" + +msgid "local DNS file" +msgstr "local DNS 파일" + +msgid "minimum 1280, maximum 1480" +msgstr "" + +msgid "navigation Navigation" +msgstr "" + +msgid "no" +msgstr "" + +msgid "no link" +msgstr "link 없음" + +msgid "none" +msgstr "" + +msgid "not present" +msgstr "" + +msgid "off" +msgstr "" + +msgid "on" +msgstr "" + +msgid "open" +msgstr "" + +msgid "overlay" +msgstr "" + +msgid "relay mode" +msgstr "" + +msgid "routed" +msgstr "" + +msgid "server mode" +msgstr "" + +msgid "skiplink1 Skip to navigation" +msgstr "" + +msgid "skiplink2 Skip to content" +msgstr "" + +msgid "stateful-only" +msgstr "" + +msgid "stateless" +msgstr "" + +msgid "stateless + stateful" +msgstr "" + +msgid "tagged" +msgstr "" + +msgid "unknown" +msgstr "" + +msgid "unlimited" +msgstr "" + +msgid "unspecified" +msgstr "" + +msgid "unspecified -or- create:" +msgstr "unspecified -혹은- create:" + +msgid "untagged" +msgstr "" + +msgid "yes" +msgstr "" + +msgid "« Back" +msgstr "" diff --git a/package/luci/modules/luci-base/po/ms/base.po b/package/luci/modules/luci-base/po/ms/base.po index 74f03cd7a0..8ba922f87f 100644 --- a/package/luci/modules/luci-base/po/ms/base.po +++ b/package/luci/modules/luci-base/po/ms/base.po @@ -279,9 +279,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -389,6 +386,9 @@ msgstr "" msgid "Authentication" msgstr "Authentifizierung" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Pengesahan" @@ -559,6 +559,9 @@ msgstr "" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Jumlah disemak " @@ -949,6 +952,9 @@ msgstr "Mengaktifkan STP" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2371,6 +2377,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2585,6 +2594,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/no/base.po b/package/luci/modules/luci-base/po/no/base.po index ed9d346e60..f9dad0a4e6 100644 --- a/package/luci/modules/luci-base/po/no/base.po +++ b/package/luci/modules/luci-base/po/no/base.po @@ -288,9 +288,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -398,6 +395,9 @@ msgstr "" msgid "Authentication" msgstr "Godkjenning" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritativ" @@ -571,6 +571,9 @@ msgstr "Kontroller" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Kontrollsum" @@ -984,6 +987,9 @@ msgstr "Aktiver STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Aktiver HE,net dynamisk endepunkt oppdatering" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Aktiver IPv6 pÃ¥ PPP lenke" @@ -2419,6 +2425,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Kvalitet" @@ -2646,6 +2655,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -3383,8 +3395,8 @@ msgid "" "compatible firmware image)." msgstr "" "Last her opp en sysupgrade-kompatibel firmware som skal erstatte den " -"kjørende firmware. Merk av \"Behold innstillinger\" for Ã¥ beholde " -"gjeldene konfigurasjon. (en kompatibel firmware er nødvendig)" +"kjørende firmware. Merk av \"Behold innstillinger\" for Ã¥ beholde gjeldene " +"konfigurasjon. (en kompatibel firmware er nødvendig)" msgid "Upload archive..." msgstr "Last opp arkiv..." diff --git a/package/luci/modules/luci-base/po/pl/base.po b/package/luci/modules/luci-base/po/pl/base.po index 4f15a37692..a78584cbbc 100644 --- a/package/luci/modules/luci-base/po/pl/base.po +++ b/package/luci/modules/luci-base/po/pl/base.po @@ -303,9 +303,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -413,6 +410,9 @@ msgstr "" msgid "Authentication" msgstr "Uwierzytelnianie" +msgid "Authentication Type" +msgstr "" + # Nawet M$ tego nie tłumaczy;) msgid "Authoritative" msgstr "Autorytatywny" @@ -589,6 +589,9 @@ msgstr "Sprawdź" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Suma kontrolna" @@ -1011,6 +1014,9 @@ msgstr "Włącz STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Włącz dynamiczną aktualizację punktu końcowego sieci HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Włącz negocjację IPv6 na łączu PPP" @@ -2467,6 +2473,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Jakość" @@ -2695,6 +2704,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2883,9 +2895,9 @@ msgid "" "flashed manually. Please refer to the wiki for device specific install " "instructions." msgstr "" -"Przepraszamy, ale nie ma wsparcia dla trybu sysupgrade. Nowy firmware " -"musi być wgrany ręcznie. Sprawdź stronę wiki, aby uzyskać instrukcję dla " -"danego urządzenia." +"Przepraszamy, ale nie ma wsparcia dla trybu sysupgrade. Nowy firmware musi " +"być wgrany ręcznie. Sprawdź stronę wiki, aby uzyskać instrukcję dla danego " +"urządzenia." msgid "Sort" msgstr "Posortuj" diff --git a/package/luci/modules/luci-base/po/pt-br/base.po b/package/luci/modules/luci-base/po/pt-br/base.po index c257abd1b6..0bcd6398d5 100644 --- a/package/luci/modules/luci-base/po/pt-br/base.po +++ b/package/luci/modules/luci-base/po/pt-br/base.po @@ -303,9 +303,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -413,6 +410,9 @@ msgstr "" msgid "Authentication" msgstr "Autenticação" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritário" @@ -586,6 +586,9 @@ msgstr "Verificar" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Soma de verificação" @@ -1007,6 +1010,9 @@ msgstr "Ativar STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Ativar a atualização de ponto final dinâmico HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Ativar a negociação de IPv6 no enlace PPP" @@ -2472,6 +2478,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Qualidade" @@ -2701,6 +2710,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2889,8 +2901,8 @@ msgid "" "instructions." msgstr "" "Sinto muito, não existe suporte para o sysupgrade. Uma nova imagem de " -"firmware deve ser gravada manualmente. Por favor, consulte a wiki " -"para instruções específicas da instalação deste dispositivo." +"firmware deve ser gravada manualmente. Por favor, consulte a wiki para " +"instruções específicas da instalação deste dispositivo." msgid "Sort" msgstr "Ordenar" diff --git a/package/luci/modules/luci-base/po/pt/base.po b/package/luci/modules/luci-base/po/pt/base.po index 0534198504..d8790dc1ff 100644 --- a/package/luci/modules/luci-base/po/pt/base.po +++ b/package/luci/modules/luci-base/po/pt/base.po @@ -301,9 +301,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -411,6 +408,9 @@ msgstr "" msgid "Authentication" msgstr "Autenticação" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritário" @@ -584,6 +584,9 @@ msgstr "Verificar" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Checksum" @@ -1000,6 +1003,9 @@ msgstr "Ativar STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Ativar a atualização dinâmica de ponto final HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Ativar a negociação IPv6 no link PPP" @@ -2439,6 +2445,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Qualidade" @@ -2665,6 +2674,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/ro/base.po b/package/luci/modules/luci-base/po/ro/base.po index d25774706d..4135c796a8 100644 --- a/package/luci/modules/luci-base/po/ro/base.po +++ b/package/luci/modules/luci-base/po/ro/base.po @@ -287,9 +287,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -397,6 +394,9 @@ msgstr "" msgid "Authentication" msgstr "Autentificare" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Autoritare" @@ -567,6 +567,9 @@ msgstr "Verificare" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Suma de verificare" @@ -955,6 +958,9 @@ msgstr "Activeaza STP" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2363,6 +2369,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Calitate" @@ -2578,6 +2587,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/ru/base.po b/package/luci/modules/luci-base/po/ru/base.po index 4ecad940e5..e7045884be 100644 --- a/package/luci/modules/luci-base/po/ru/base.po +++ b/package/luci/modules/luci-base/po/ru/base.po @@ -300,9 +300,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -410,6 +407,9 @@ msgstr "" msgid "Authentication" msgstr "Аутентификация" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Авторитетный" @@ -584,6 +584,9 @@ msgstr "Проверить" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Контрольная сумма" @@ -1001,6 +1004,9 @@ msgstr "Включить STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Включить динамическое обновление оконечной точки HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Включить IPv6-согласование на PPP-соединении" @@ -2449,6 +2455,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Качество" @@ -2676,6 +2685,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2863,8 +2875,8 @@ msgid "" "instructions." msgstr "" "К сожалению, автоматическое обновление не поддерживается, новая прошивка " -"должна быть установлена вручную. Обратитесь к вики для получения " -"конкретных инструкций для вашего устройства." +"должна быть установлена вручную. Обратитесь к вики для получения конкретных " +"инструкций для вашего устройства." msgid "Sort" msgstr "Сортировка" diff --git a/package/luci/modules/luci-base/po/sk/base.po b/package/luci/modules/luci-base/po/sk/base.po index a0a355fbba..f824029498 100644 --- a/package/luci/modules/luci-base/po/sk/base.po +++ b/package/luci/modules/luci-base/po/sk/base.po @@ -273,9 +273,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -383,6 +380,9 @@ msgstr "" msgid "Authentication" msgstr "" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "" @@ -553,6 +553,9 @@ msgstr "" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "" @@ -936,6 +939,9 @@ msgstr "" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2338,6 +2344,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2551,6 +2560,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/sv/base.po b/package/luci/modules/luci-base/po/sv/base.po index 785e90022e..4e228082e2 100644 --- a/package/luci/modules/luci-base/po/sv/base.po +++ b/package/luci/modules/luci-base/po/sv/base.po @@ -279,9 +279,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -389,6 +386,9 @@ msgstr "" msgid "Authentication" msgstr "" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "" @@ -559,6 +559,9 @@ msgstr "" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "" @@ -942,6 +945,9 @@ msgstr "" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2344,6 +2350,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2557,6 +2566,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/templates/base.pot b/package/luci/modules/luci-base/po/templates/base.pot index f29f1e320a..5a77cd2938 100644 --- a/package/luci/modules/luci-base/po/templates/base.pot +++ b/package/luci/modules/luci-base/po/templates/base.pot @@ -266,9 +266,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -376,6 +373,9 @@ msgstr "" msgid "Authentication" msgstr "" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "" @@ -546,6 +546,9 @@ msgstr "" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "" @@ -929,6 +932,9 @@ msgstr "" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2331,6 +2337,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2544,6 +2553,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/tr/base.po b/package/luci/modules/luci-base/po/tr/base.po index 3d881f500d..7f0ea7e166 100644 --- a/package/luci/modules/luci-base/po/tr/base.po +++ b/package/luci/modules/luci-base/po/tr/base.po @@ -286,9 +286,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -396,6 +393,9 @@ msgstr "" msgid "Authentication" msgstr "Kimlik doğrulama" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Yetkilendirme" @@ -566,6 +566,9 @@ msgstr "" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "" @@ -949,6 +952,9 @@ msgstr "" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2351,6 +2357,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2564,6 +2573,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/uk/base.po b/package/luci/modules/luci-base/po/uk/base.po index b5d28c20d9..29b1514e27 100644 --- a/package/luci/modules/luci-base/po/uk/base.po +++ b/package/luci/modules/luci-base/po/uk/base.po @@ -310,9 +310,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -420,6 +417,9 @@ msgstr "" msgid "Authentication" msgstr "Автентифікація" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Надійний" @@ -593,6 +593,9 @@ msgstr "Перевірити" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Контрольна сума" @@ -1010,6 +1013,9 @@ msgstr "Увімкнути STP" msgid "Enable HE.net dynamic endpoint update" msgstr "Увімкнути динамічне оновлення кінцевої точки HE.net" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "Увімкнути узгодження IPv6 для PPP-з'єднань" @@ -2460,6 +2466,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "Якість" @@ -2689,6 +2698,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2876,8 +2888,8 @@ msgid "" "instructions." msgstr "" "На жаль, автоматичне оновлення системи не підтримується. Новий образ " -"прошивки повинен бути залитий вручну. Зверніться до Wiki за " -"інструкцією з інсталяції для конкретного пристрою." +"прошивки повинен бути залитий вручну. Зверніться до Wiki за інструкцією з " +"інсталяції для конкретного пристрою." msgid "Sort" msgstr "Сортування" @@ -3433,9 +3445,9 @@ msgid "" "Check \"Keep settings\" to retain the current configuration (requires a " "compatible firmware image)." msgstr "" -"Відвантажити sysupgrade-сумісний образ, щоб замінити поточну прошивку. " -"Для збереження поточної конфігурації встановіть прапорець \"Зберегти " -"настройки\" (потрібен сумісний образ прошивки)." +"Відвантажити sysupgrade-сумісний образ, щоб замінити поточну прошивку. Для " +"збереження поточної конфігурації встановіть прапорець \"Зберегти настройки" +"\" (потрібен сумісний образ прошивки)." msgid "Upload archive..." msgstr "Відвантажити архів..." diff --git a/package/luci/modules/luci-base/po/vi/base.po b/package/luci/modules/luci-base/po/vi/base.po index cb5e401c61..0cc83bf5a1 100644 --- a/package/luci/modules/luci-base/po/vi/base.po +++ b/package/luci/modules/luci-base/po/vi/base.po @@ -280,9 +280,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -390,6 +387,9 @@ msgstr "" msgid "Authentication" msgstr "Xác thá»±c" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "Authoritative" @@ -560,6 +560,9 @@ msgstr "" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "Checksum" @@ -954,6 +957,9 @@ msgstr "Kích hoạt STP" msgid "Enable HE.net dynamic endpoint update" msgstr "" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "" @@ -2374,6 +2380,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "" @@ -2589,6 +2598,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" diff --git a/package/luci/modules/luci-base/po/zh-cn/base.po b/package/luci/modules/luci-base/po/zh-cn/base.po index bbcc7e7cf5..7c00f8ff88 100644 --- a/package/luci/modules/luci-base/po/zh-cn/base.po +++ b/package/luci/modules/luci-base/po/zh-cn/base.po @@ -3,21 +3,21 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-12-21 23:08+0200\n" -"PO-Revision-Date: 2015-12-20 13:14+0800\n" -"Last-Translator: GuoGuo \n" +"PO-Revision-Date: 2017-01-07 21:46+0800\n" +"Last-Translator: Hsing-Wang Liao \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 1.8.5\n" +"X-Generator: Poedit 1.8.11\n" "Language-Team: \n" msgid "%s is untagged in multiple VLANs!" -msgstr "" +msgstr "%s 在多个 VLAN 中未标记" msgid "(%d minute window, %d second interval)" -msgstr "(%d分钟信息,%d秒刷新)" +msgstr "(%d 分钟信息,%d 秒刷新)" msgid "(%s available)" msgstr "(%s 可用)" @@ -50,91 +50,89 @@ msgid "15 Minute Load:" msgstr "15分钟负载:" msgid "464XLAT (CLAT)" -msgstr "" +msgstr "464XLAT (CLAT)" msgid "5 Minute Load:" msgstr "5分钟负载:" msgid "BSSID" -msgstr "BSSID" +msgstr "BSSID" msgid "DNS query port" -msgstr "DNS 查询端口" +msgstr "DNS 查询端口" msgid "DNS server port" -msgstr "DNS 服务器端口" +msgstr "DNS 服务器端口" msgid "" "DNS servers will be queried in the " "order of the resolvfile" -msgstr "将会按照指定的顺序查询DNS" +msgstr "将会按照指定的顺序查询DNS" msgid "ESSID" -msgstr "ESSID" +msgstr "ESSID" msgid "IPv4-Address" -msgstr "IPv4-地址" +msgstr "IPv4-地址" msgid "IPv4-Gateway" -msgstr "IPv4-网关" +msgstr "IPv4-网关" msgid "IPv4-Netmask" -msgstr "IPv4-子网掩码" +msgstr "IPv4-子网掩码" msgid "" "IPv6-Address or Network " "(CIDR)" msgstr "" -"IPv6-地址或超网() (CIDR)" +"IPv6-地址或超网(CIDR)" msgid "IPv6-Gateway" -msgstr "IPv6-网关" +msgstr "IPv6-网关" msgid "IPv6-Suffix (hex)" -msgstr "" -"IPv6-后缀(十六进制)" +msgstr "IPv6-后缀(十六进制)" msgid "LED Configuration" -msgstr "LED配置" +msgstr "LED配置" msgid "LED Name" -msgstr "LED名称" +msgstr "LED名称" msgid "MAC-Address" -msgstr "MAC-地址" +msgstr "MAC-地址" msgid "" "Max. DHCP leases" -msgstr "" -"最大DHCP分配数量" +msgstr "最大DHCP分配数量" msgid "" "Max. EDNS0 packet size" -msgstr "最大EDNS0数据包大小" +msgstr "最大EDNS0数据包大小" msgid "Max. concurrent queries" -msgstr "最大并发查询数" +msgstr "最大并发查询数" msgid "%s - %s" msgstr "%s - %s" msgid "A43C + J43 + A43" -msgstr "" +msgstr "A43C + J43 + A43" msgid "A43C + J43 + A43 + V43" -msgstr "" +msgstr "A43C + J43 + A43 + V43" msgid "ADSL" msgstr "ADSL" msgid "AICCU (SIXXS)" -msgstr "" +msgstr "AICCU (SIXXS)" msgid "ANSI T1.413" -msgstr "" +msgstr "ANSI T1.413" msgid "APN" msgstr "APN" @@ -146,7 +144,7 @@ msgid "ARP retry threshold" msgstr "ARP重试阈值" msgid "ATM (Asynchronous Transfer Mode)" -msgstr "" +msgstr "ATM(异步传输模式)" msgid "ATM Bridges" msgstr "ATM桥接" @@ -169,10 +167,10 @@ msgid "ATM device number" msgstr "ATM设备号码" msgid "ATU-C System Vendor ID" -msgstr "" +msgstr "ATU-C系统供应商ID" msgid "AYIYA" -msgstr "" +msgstr "AYIYA" msgid "Access Concentrator" msgstr "接入集中器" @@ -190,10 +188,10 @@ msgid "Activate this network" msgstr "激活此网络" msgid "Active IPv4-Routes" -msgstr "活动的IPv4-链路" +msgstr "活动的IPv4-链路" msgid "Active IPv6-Routes" -msgstr "活动的IPv6-链路" +msgstr "活动的IPv6-链路" msgid "Active Connections" msgstr "活动连接" @@ -220,7 +218,7 @@ msgid "Additional Hosts files" msgstr "额外的HOSTS文件" msgid "Additional servers file" -msgstr "" +msgstr "额外的SERVERS文件" msgid "Address" msgstr "地址" @@ -235,7 +233,7 @@ msgid "Advanced Settings" msgstr "高级设置" msgid "Aggregate Transmit Power(ACTATP)" -msgstr "" +msgstr "总发射功率(ACTATP)" msgid "Alert" msgstr "警戒" @@ -243,13 +241,13 @@ msgstr "警戒" msgid "" "Allocate IP addresses sequentially, starting from the lowest available " "address" -msgstr "" +msgstr "从最低可用地址开始顺序分配IP地址" msgid "Allocate IP sequentially" -msgstr "" +msgstr "顺序分配IP" msgid "Allow SSH password authentication" -msgstr "允许SSH密码验证" +msgstr "允许SSH密码验证" msgid "Allow all except listed" msgstr "仅允许列表外" @@ -264,7 +262,7 @@ msgid "Allow remote hosts to connect to local SSH forwarded ports" msgstr "允许远程主机连接到本地SSH转发端口" msgid "Allow root logins with password" -msgstr "root权限登录" +msgstr "允许root用户凭密码登录" msgid "Allow the root user to login with password" msgstr "允许root用户凭密码登录" @@ -274,68 +272,65 @@ msgid "" msgstr "允许127.0.0.0/8回环范围内的上行响应,例如:RBL服务" msgid "Allowed IPs" -msgstr "" +msgstr "允许的IP" msgid "" "Also see Tunneling Comparison on SIXXS" msgstr "" "也请查看SIXXS上的Tunneling Comparison " +"faq=comparison\">隧道对比" msgid "Always announce default router" msgstr "总是广播默认路由" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" -msgstr "" +msgstr "Annex" msgid "Annex A + L + M (all)" -msgstr "" +msgstr "Annex A + L + M (全部)" msgid "Annex A G.992.1" -msgstr "" +msgstr "Annex A G.992.1" msgid "Annex A G.992.2" -msgstr "" +msgstr "Annex A G.992.2" msgid "Annex A G.992.3" -msgstr "" +msgstr "Annex A G.992.3" msgid "Annex A G.992.5" -msgstr "" +msgstr "Annex A G.992.5" msgid "Annex B (all)" -msgstr "" +msgstr "Annex B (全部)" msgid "Annex B G.992.1" -msgstr "" +msgstr "Annex B G.992.1" msgid "Annex B G.992.3" -msgstr "" +msgstr "Annex B G.992.3" msgid "Annex B G.992.5" -msgstr "" +msgstr "Annex B G.992.5" msgid "Annex J (all)" -msgstr "" +msgstr "Annex J (全部)" msgid "Annex L G.992.3 POTS 1" -msgstr "" +msgstr "Annex L G.992.3 POTS 1" msgid "Annex M (all)" -msgstr "" +msgstr "Annex M (全部)" msgid "Annex M G.992.3" -msgstr "" +msgstr "Annex M G.992.3" msgid "Annex M G.992.5" -msgstr "" +msgstr "Annex M G.992.5" msgid "Announce as default router even if no public prefix is available." -msgstr "即使没有可用的公共前缀也广播默认路由" +msgstr "即使没有可用的公共前缀也广播默认路由。" msgid "Announced DNS domains" msgstr "广播的DNS域名" @@ -344,7 +339,7 @@ msgid "Announced DNS servers" msgstr "广播的DNS服务器" msgid "Anonymous Identity" -msgstr "" +msgstr "匿名身份" msgid "Anonymous Mount" msgstr "自动挂载未配置的磁盘分区" @@ -379,7 +374,7 @@ msgstr "分配接口..." msgid "" "Assign prefix parts using this hexadecimal subprefix ID for this interface." -msgstr "" +msgstr "指定此接口使用的十六进制子ID前缀部分" msgid "Associated Stations" msgstr "已连接站点" @@ -388,7 +383,7 @@ msgid "Atheros 802.11%s Wireless Controller" msgstr "Qualcomm/Atheros 802.11%s 无线网卡" msgid "Auth Group" -msgstr "" +msgstr "认证组" msgid "AuthGroup" msgstr "认证组" @@ -396,6 +391,9 @@ msgstr "认证组" msgid "Authentication" msgstr "认证" +msgid "Authentication Type" +msgstr "认证类型" + msgid "Authoritative" msgstr "授权的唯一DHCP服务器" @@ -415,10 +413,10 @@ msgid "Automatically check filesystem for errors before mounting" msgstr "在挂载前自动检查文件系统错误" msgid "Automatically mount filesystems on hotplug" -msgstr "通过hotplug自动挂载磁盘" +msgstr "通过Hotplug自动挂载磁盘" msgid "Automatically mount swap on hotplug" -msgstr "通过hotplug自动挂载Swap分区" +msgstr "通过Hotplug自动挂载Swap分区" msgid "Automount Filesystem" msgstr "自动挂载磁盘" @@ -436,13 +434,13 @@ msgid "Average:" msgstr "平均:" msgid "B43 + B43C" -msgstr "" +msgstr "B43 + B43C" msgid "B43 + B43C + V43" -msgstr "" +msgstr "B43 + B43C + V43" msgid "BR / DMR / AFTR" -msgstr "" +msgstr "BR / DMR / AFTR" msgid "BSSID" msgstr "BSSID" @@ -492,13 +490,13 @@ msgstr "" "备份文件。" msgid "Bind interface" -msgstr "" +msgstr "绑定接口" msgid "Bind only to specific interfaces rather than wildcard address." -msgstr "" +msgstr "仅绑定到特定接口,而不是全部地址。" msgid "Bind the tunnel to this interface (optional)." -msgstr "" +msgstr "将隧道绑定到此接口(可选)。" msgid "Bitrate" msgstr "传输速率" @@ -536,7 +534,7 @@ msgid "Buttons" msgstr "按键" msgid "CA certificate; if empty it will be saved after the first connection." -msgstr "CA证书.如果留空的话证书将在第一次连接时被保存." +msgstr "CA证书,如果留空的话证书将在第一次连接时被保存。" msgid "CPU usage (%)" msgstr "CPU使用率(%)" @@ -568,6 +566,9 @@ msgstr "检查" msgid "Check fileystems before mount" msgstr "在挂载前检查文件系统" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "校验值" @@ -587,7 +588,7 @@ msgid "Cipher" msgstr "算法" msgid "Cisco UDP encapsulation" -msgstr "" +msgstr "Cisco UDP封装" msgid "" "Click \"Generate archive\" to download a tar archive of the current " @@ -693,7 +694,7 @@ msgstr "自定义的软件源" msgid "" "Customizes the behaviour of the device LEDs if possible." -msgstr "自定义LED的活动状态。" +msgstr "自定义LED的活动状态。" msgid "DHCP Leases" msgstr "DHCP分配" @@ -729,34 +730,34 @@ msgid "DNS forwardings" msgstr "DNS转发" msgid "DNS-Label / FQDN" -msgstr "" +msgstr "DNS-Label / FQDN" msgid "DNSSEC" -msgstr "" +msgstr "DNSSEC" msgid "DNSSEC check unsigned" -msgstr "" +msgstr "DNSSEC未签名检查" msgid "DPD Idle Timeout" -msgstr "" +msgstr "DPD空闲超时" msgid "DS-Lite AFTR address" -msgstr "" +msgstr "DS-Lite AFTR地址" msgid "DSL" -msgstr "" +msgstr "DSL" msgid "DSL Status" -msgstr "" +msgstr "DSL状态" msgid "DSL line mode" -msgstr "" +msgstr "DSL线路模式" msgid "DUID" -msgstr "DUID(DHCP唯一标识符)" +msgstr "DUID (DHCP唯一标识符)" msgid "Data Rate" -msgstr "" +msgstr "数据速率" msgid "Debug" msgstr "调试" @@ -768,7 +769,7 @@ msgid "Default gateway" msgstr "默认网关" msgid "Default is stateless + stateful" -msgstr "" +msgstr "默认是无状态 + 有状态" msgid "Default route" msgstr "默认路由" @@ -829,17 +830,16 @@ msgstr "禁用" msgid "" "Disable DHCP for " "this interface." -msgstr "" -"禁用本接口的DHCP。" +msgstr "禁用本接口的DHCP。" msgid "Disable DNS setup" msgstr "停用DNS设定" msgid "Disable Encryption" -msgstr "" +msgstr "禁用加密" msgid "Disable HW-Beacon timer" -msgstr "停用 HW-Beacon 计时器" +msgstr "停用HW-Beacon计时器" msgid "Disabled" msgstr "禁用" @@ -888,7 +888,7 @@ msgid "Domain whitelist" msgstr "域名白名单" msgid "Don't Fragment" -msgstr "" +msgstr "禁止碎片" msgid "" "Don't forward DNS-Requests without " @@ -908,14 +908,14 @@ msgid "" "Dropbear offers SSH network shell access " "and an integrated SCP server" msgstr "" -"Dropbear提供了集成的SCP服务器和基于SSH的shell访问" +"Dropbear提供了集成的SCP服务器和基于SSH的Shell访问" msgid "Dual-Stack Lite (RFC6333)" -msgstr "" +msgstr "Dual-Stack Lite (RFC6333)" msgid "Dynamic DHCP" -msgstr "动态DHCP" +msgstr "动态DHCP" msgid "Dynamic tunnel" msgstr "动态隧道" @@ -926,10 +926,10 @@ msgid "" msgstr "动态分配DHCP地址。如果禁用,则只能为静态租用表中的客户端提供网络服务。" msgid "EA-bits length" -msgstr "" +msgstr "EA位长度" msgid "EAP-Method" -msgstr "EAP-Method" +msgstr "EAP类型" msgid "Edit" msgstr "修改" @@ -952,11 +952,14 @@ msgid "Enable" msgstr "启用" msgid "Enable STP" -msgstr "开启STP" +msgstr "开启STP" msgid "Enable HE.net dynamic endpoint update" msgstr "启用HE.net动态终端更新" +msgid "Enable IPv6 negotiation" +msgstr "启用IPv6协商" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "在PPP链路上启用IPv6协商" @@ -967,7 +970,7 @@ msgid "Enable NTP client" msgstr "启用NTP客户端" msgid "Enable Single DES" -msgstr "" +msgstr "启用单个DES" msgid "Enable TFTP server" msgstr "启用TFTP服务器" @@ -976,7 +979,7 @@ msgid "Enable VLAN functionality" msgstr "启用VLAN" msgid "Enable WPS pushbutton, requires WPA(2)-PSK" -msgstr "启用WPS按键配置.要求使用WPA(2)-PSK" +msgstr "启用WPS按键配置,要求使用WPA(2)-PSK" msgid "Enable learning and aging" msgstr "启用智能交换学习" @@ -988,7 +991,7 @@ msgid "Enable mirroring of outgoing packets" msgstr "启用流出数据包镜像" msgid "Enable the DF (Don't Fragment) flag of the encapsulating packets." -msgstr "" +msgstr "启用封装数据包的DF(禁止碎片)标志。" msgid "Enable this mount" msgstr "启用挂载点" @@ -1012,10 +1015,10 @@ msgid "Encryption" msgstr "加密" msgid "Endpoint Host" -msgstr "" +msgstr "端点主机" msgid "Endpoint Port" -msgstr "" +msgstr "端点端口" msgid "Erasing..." msgstr "擦除中..." @@ -1024,7 +1027,7 @@ msgid "Error" msgstr "错误" msgid "Errored seconds (ES)" -msgstr "" +msgstr "错误秒数(ES)" msgid "Ethernet Adapter" msgstr "以太网适配器" @@ -1033,7 +1036,7 @@ msgid "Ethernet Switch" msgstr "以太网交换机" msgid "Exclude interfaces" -msgstr "" +msgstr "排除接口" msgid "Expand hosts" msgstr "扩展HOSTS文件中的主机后缀" @@ -1041,22 +1044,21 @@ msgstr "扩展HOSTS文件中的主机后缀" msgid "Expires" msgstr "到期时间" -#, fuzzy msgid "" "Expiry time of leased addresses, minimum is 2 minutes (2m)." -msgstr "地址租期,最小2分钟(2m)。" +msgstr "租用地址的到期时间,最短2分钟(2m)。" msgid "External" -msgstr "" +msgstr "远程" msgid "External system log server" -msgstr "远程log服务器" +msgstr "远程日志服务器" msgid "External system log server port" -msgstr "远程log服务器端口" +msgstr "远程日志服务器端口" msgid "External system log server protocol" -msgstr "" +msgstr "远程日志服务器协议" msgid "Extra SSH command options" msgstr "额外的SSH命令选项" @@ -1108,7 +1110,7 @@ msgid "Firewall Status" msgstr "防火墙状态" msgid "Firmware File" -msgstr "" +msgstr "固件文件" msgid "Firmware Version" msgstr "固件版本" @@ -1147,16 +1149,16 @@ msgid "Force TKIP and CCMP (AES)" msgstr "TKIP和CCMP(AES)混合加密" msgid "Force use of NAT-T" -msgstr "" +msgstr "强制使用NAT-T" msgid "Form token mismatch" -msgstr "" +msgstr "表单令牌不匹配" msgid "Forward DHCP traffic" msgstr "转发DHCP数据包" msgid "Forward Error Correction Seconds (FECS)" -msgstr "" +msgstr "前向纠错秒数(FECS)" msgid "Forward broadcast traffic" msgstr "转发广播数据包" @@ -1180,6 +1182,8 @@ msgid "" "Further information about WireGuard interfaces and peers at wireguard.io." msgstr "" +"有关WireGuard接口和Peer的更多信息:wireguard." +"io" msgid "GHz" msgstr "GHz" @@ -1200,7 +1204,7 @@ msgid "General Setup" msgstr "基本设置" msgid "General options for opkg" -msgstr "opkg基础配置" +msgstr "Opkg基础配置" msgid "Generate Config" msgstr "生成配置" @@ -1227,7 +1231,7 @@ msgid "Go to relevant configuration page" msgstr "跳转到相关的配置页面" msgid "Group Password" -msgstr "" +msgstr "组密码" msgid "Guest" msgstr "访客" @@ -1239,7 +1243,7 @@ msgid "HE.net username" msgstr "HE.net用户名" msgid "HT mode (802.11n)" -msgstr "" +msgstr "HT模式(802.11n)" msgid "Handler" msgstr "处理程序" @@ -1248,7 +1252,7 @@ msgid "Hang Up" msgstr "挂起" msgid "Header Error Code Errors (HEC)" -msgstr "" +msgstr "头错误代码错误(HEC)" msgid "Heartbeat" msgstr "心跳" @@ -1267,10 +1271,10 @@ msgid "Hermes 802.11b Wireless Controller" msgstr "Hermes 802.11b 无线网卡" msgid "Hide ESSID" -msgstr "隐藏ESSID" +msgstr "隐藏ESSID" msgid "Host" -msgstr "" +msgstr "主机" msgid "Host entries" msgstr "主机目录" @@ -1294,7 +1298,7 @@ msgid "Hybrid" msgstr "混合" msgid "IKE DH Group" -msgstr "" +msgstr "IKE DH组" msgid "IP address" msgstr "IP地址" @@ -1339,7 +1343,7 @@ msgid "IPv4-Address" msgstr "IPv4-地址" msgid "IPv4-in-IPv4 (RFC2003)" -msgstr "" +msgstr "IPv4-in-IPv4 (RFC2003)" msgid "IPv6" msgstr "IPv6" @@ -1366,7 +1370,7 @@ msgid "IPv6 address delegated to the local tunnel endpoint (optional)" msgstr "绑定到本地隧道终点的IPv6地址(可选)" msgid "IPv6 assignment hint" -msgstr "" +msgstr "IPv6分配提示" msgid "IPv6 assignment length" msgstr "IPv6分配长度" @@ -1402,10 +1406,10 @@ msgid "Identity" msgstr "鉴权" msgid "If checked, 1DES is enaled" -msgstr "" +msgstr "选中以启用1DES" msgid "If checked, encryption is disabled" -msgstr "" +msgstr "选中以禁用加密" msgid "" "If specified, mount the device by its UUID instead of a fixed device node" @@ -1449,12 +1453,14 @@ msgid "" "In order to prevent unauthorized access to the system, your request has been " "blocked. Click \"Continue »\" below to return to the previous page." msgstr "" +"为了防止对系统的未授权访问,您的请求已被阻止。点击下面的 “继续 »” 来返回上一" +"页。" msgid "Inactivity timeout" msgstr "活动超时" msgid "Inbound:" -msgstr "入站:" +msgstr "入站:" msgid "Info" msgstr "信息" @@ -1469,10 +1475,10 @@ msgid "Install" msgstr "安装" msgid "Install iputils-traceroute6 for IPv6 traceroute" -msgstr "安装iputils-traceroute6以进行IPv6 traceroute" +msgstr "安装 iputils-traceroute6 以进行IPv6 traceroute" msgid "Install package %q" -msgstr "安装软件包%q" +msgstr "安装软件包 %q" msgid "Install protocol extensions..." msgstr "安装扩展协议..." @@ -1496,10 +1502,10 @@ msgid "Interface is shutting down..." msgstr "正在关闭接口..." msgid "Interface name" -msgstr "" +msgstr "接口名称" msgid "Interface not present or not connected yet." -msgstr "接口不存在或未连接" +msgstr "接口不存在或未连接。" msgid "Interface reconnected" msgstr "接口已重新连接" @@ -1511,7 +1517,7 @@ msgid "Interfaces" msgstr "接口" msgid "Internal" -msgstr "" +msgstr "内部" msgid "Internal Server Error" msgstr "内部服务器错误" @@ -1520,19 +1526,18 @@ msgid "Invalid" msgstr "无效" msgid "Invalid VLAN ID given! Only IDs between %d and %d are allowed." -msgstr "无效的VLAN ID! 只有 %d 和 %d 之间的ID有效。" +msgstr "无效的VLAN ID!只有 %d 和 %d 之间的ID有效。" msgid "Invalid VLAN ID given! Only unique IDs are allowed" -msgstr "无效的VLAN ID! 只允许唯一的ID。" +msgstr "无效的VLAN ID!只允许唯一的ID。" msgid "Invalid username and/or password! Please try again." -msgstr "无效的用户名和/或密码! 请重试。" +msgstr "无效的用户名和/或密码!请重试。" -#, fuzzy msgid "" "It appears that you are trying to flash an image that does not fit into the " "flash memory, please verify the image file!" -msgstr "将要刷新的固件与本路由器不兼容,请重新验证固件文件。" +msgstr "你尝试刷写的固件与本路由器不兼容,请重新验证固件文件。" msgid "Java Script required!" msgstr "需要Java Script!" @@ -1541,10 +1546,10 @@ msgid "Join Network" msgstr "加入网络" msgid "Join Network: Wireless Scan" -msgstr "加入网络:搜索无线" +msgstr "加入网络:搜索无线" msgid "Joining Network: %q" -msgstr "" +msgstr "加入网络:%q" msgid "Keep settings" msgstr "保留配置" @@ -1589,13 +1594,13 @@ msgid "Language and Style" msgstr "语言和界面" msgid "Latency" -msgstr "" +msgstr "延迟" msgid "Leaf" -msgstr "叶子" +msgstr "叶状" msgid "Lease time" -msgstr "" +msgstr "租期" msgid "Lease validity time" msgstr "有效租期" @@ -1622,22 +1627,22 @@ msgid "Limit" msgstr "客户数" msgid "Limit DNS service to subnets interfaces on which we are serving DNS." -msgstr "" +msgstr "将DNS服务限制到我们提供DNS的子网接口。" msgid "Limit listening to these interfaces, and loopback." -msgstr "" +msgstr "仅监听这些接口和环回接口。" msgid "Line Attenuation (LATN)" -msgstr "" +msgstr "线路衰减(LATN)" msgid "Line Mode" -msgstr "" +msgstr "线路模式" msgid "Line State" msgstr "线路状态" msgid "Line Uptime" -msgstr "" +msgstr "线路运行时间" msgid "Link On" msgstr "活动链接" @@ -1648,7 +1653,7 @@ msgid "" msgstr "将指定的域名DNS解析转发到指定的DNS服务器(按照示例填写)" msgid "List of SSH key files for auth" -msgstr "" +msgstr "用于认证的SSH密钥文件列表" msgid "List of domains to allow RFC1918 responses for" msgstr "允许RFC1918响应的域名列表" @@ -1657,10 +1662,10 @@ msgid "List of hosts that supply bogus NX domain results" msgstr "允许虚假空域名响应的服务器列表" msgid "Listen Interfaces" -msgstr "" +msgstr "监听接口" msgid "Listen Port" -msgstr "" +msgstr "监听端口" msgid "Listen only on the given interface or, if unspecified, on all" msgstr "监听指定的接口;未指定则监听全部" @@ -1678,7 +1683,7 @@ msgid "Loading" msgstr "加载中" msgid "Local IP address to assign" -msgstr "" +msgstr "要分配的本地IP地址" msgid "Local IPv4 address" msgstr "本地IPv4地址" @@ -1687,7 +1692,7 @@ msgid "Local IPv6 address" msgstr "本地IPv6地址" msgid "Local Service Only" -msgstr "" +msgstr "仅本地服务" msgid "Local Startup" msgstr "本地启动脚本" @@ -1698,11 +1703,10 @@ msgstr "本地时间" msgid "Local domain" msgstr "本地域名" -#, fuzzy msgid "" "Local domain specification. Names matching this domain are never forwarded " "and are resolved from DHCP or hosts files only" -msgstr "本地域名规则。从不转发和处理只源自DHCP或HOSTS文件的本地域名数据" +msgstr "本地域名规则。与此域匹配的名称从不转发,仅从DHCP或HOSTS文件解析" msgid "Local domain suffix appended to DHCP names and hosts file entries" msgstr "本地域名后缀将添加到DHCP和HOSTS文件条目" @@ -1719,7 +1723,7 @@ msgid "Localise queries" msgstr "本地化查询" msgid "Locked to channel %s used by: %s" -msgstr "信道道已被锁定为 %s,因为该信道被 %s 使用" +msgstr "信道道已被锁定为 %s,因为该信道被 %s 使用" msgid "Log output level" msgstr "日志记录等级" @@ -1737,7 +1741,7 @@ msgid "Logout" msgstr "退出" msgid "Loss of Signal Seconds (LOSS)" -msgstr "" +msgstr "信号丢失秒数(LOSS)" msgid "Lowest leased address as offset from the network address." msgstr "网络地址的起始分配基址。" @@ -1755,13 +1759,13 @@ msgid "MAC-List" msgstr "MAC-列表" msgid "MAP / LW4over6" -msgstr "" +msgstr "MAP / LW4over6" msgid "MB/s" msgstr "MB/s" msgid "MD5" -msgstr "" +msgstr "MD5" msgid "MHz" msgstr "MHz" @@ -1772,13 +1776,13 @@ msgstr "MTU" msgid "" "Make sure to clone the root filesystem using something like the commands " "below:" -msgstr "请确认你已经复制过整个根文件系统,例如使用以下命令:" +msgstr "请确认你已经复制过整个根文件系统,例如使用以下命令:" msgid "Manual" -msgstr "" +msgstr "手动" msgid "Max. Attainable Data Rate (ATTNDR)" -msgstr "" +msgstr "最大可达数据速率(ATTNDR)" msgid "Maximum Rate" msgstr "最高速率" @@ -1790,7 +1794,7 @@ msgid "Maximum allowed number of concurrent DNS queries" msgstr "允许的最大并发DNS查询数" msgid "Maximum allowed size of EDNS.0 UDP packets" -msgstr "允许的最大EDNS.0 UDP报文大小" +msgstr "允许的最大EDNS.0 UDP数据包大小" msgid "Maximum amount of seconds to wait for the modem to become ready" msgstr "调制解调器就绪的最大等待时间(秒)" @@ -1802,6 +1806,7 @@ msgid "" "Maximum length of the name is 15 characters including the automatic protocol/" "bridge prefix (br-, 6in4-, pppoe- etc.)" msgstr "" +"名称的最大长度为15个字符,包括自动协议/网桥前缀(br-, 6in4-, pppoe- 等等)" msgid "Maximum number of leased addresses." msgstr "最大地址分配数量。" @@ -1831,7 +1836,7 @@ msgid "Mirror source port" msgstr "数据包镜像源端口" msgid "Missing protocol extension for proto %q" -msgstr "缺少协议%q的协议扩展" +msgstr "缺少协议 %q 的协议扩展" msgid "Mode" msgstr "模式" @@ -1899,16 +1904,16 @@ msgid "NAS ID" msgstr "NAS ID" msgid "NAT-T Mode" -msgstr "" +msgstr "NAT-T模式" msgid "NAT64 Prefix" -msgstr "" +msgstr "NAT64前缀" msgid "NDP-Proxy" msgstr "NDP-代理" msgid "NT Domain" -msgstr "" +msgstr "NT域" msgid "NTP server candidates" msgstr "候选NTP服务器" @@ -1950,7 +1955,7 @@ msgid "No DHCP Server configured for this interface" msgstr "本接口未配置DHCP服务器" msgid "No NAT-T" -msgstr "" +msgstr "无NAT-T" msgid "No chains in this table" msgstr "本表中没有链" @@ -1986,16 +1991,16 @@ msgid "Noise" msgstr "噪声" msgid "Noise Margin (SNR)" -msgstr "" +msgstr "噪声容限(SNR)" msgid "Noise:" msgstr "噪声:" msgid "Non Pre-emtive CRC errors (CRC_P)" -msgstr "" +msgstr "非抢占CRC错误(CRC_P)" msgid "Non-wildcard" -msgstr "" +msgstr "非通配符" msgid "None" msgstr "无" @@ -2016,7 +2021,7 @@ msgid "Note: Configuration files will be erased." msgstr "注意:配置文件将被删除。" msgid "Note: interface name length" -msgstr "" +msgstr "注意:接口名称长度" msgid "Notice" msgstr "注意" @@ -2025,7 +2030,7 @@ msgid "Nslookup" msgstr "Nslookup" msgid "OK" -msgstr "OK" +msgstr "确认" msgid "OPKG-Configuration" msgstr "OPKG-配置" @@ -2058,7 +2063,7 @@ msgid "One or more fields contain invalid values!" msgstr "一个或多个选项值有误!" msgid "One or more invalid/required values on tab" -msgstr "" +msgstr "选项卡上存在一个或多个无效/必需值" msgid "One or more required fields have no value!" msgstr "一个或多个必选项值为空!" @@ -2067,7 +2072,7 @@ msgid "Open list..." msgstr "打开列表..." msgid "OpenConnect (CISCO AnyConnect)" -msgstr "" +msgstr "开放连接(CISCO AnyConnect)" msgid "Operating frequency" msgstr "工作频率" @@ -2079,13 +2084,13 @@ msgid "Option removed" msgstr "移除的选项" msgid "Optional, specify to override default server (tic.sixxs.net)" -msgstr "可选,设置这个选项会覆盖默认设定的服务器(tic.sixxs.net)" +msgstr "可选,设置这个选项会覆盖默认设定的服务器(tic.sixxs.net)" msgid "Optional, use when the SIXXS account has more than one tunnel" -msgstr "可选,如果你的SIXXS账号拥有一个以上的隧道请设置此项." +msgstr "可选,如果你的SIXXS账号拥有一个以上的隧道请设置此项." msgid "Optional." -msgstr "" +msgstr "可选" msgid "" "Optional. Adds in an additional layer of symmetric-key cryptography for post-" @@ -2093,7 +2098,7 @@ msgid "" msgstr "" msgid "Optional. Create routes for Allowed IPs for this peer." -msgstr "" +msgstr "可选,为此Peer创建允许IP的路由。" msgid "" "Optional. Host of peer. Names are resolved prior to bringing up the " @@ -2101,30 +2106,32 @@ msgid "" msgstr "" msgid "Optional. Maximum Transmission Unit of tunnel interface." -msgstr "" +msgstr "可选,隧道接口的最大传输单元。" msgid "Optional. Port of peer." -msgstr "" +msgstr "可选,Peer的端口。" msgid "" "Optional. Seconds between keep alive messages. Default is 0 (disabled). " "Recommended value if this device is behind a NAT is 25." msgstr "" +"可选,Keep-Alive消息之间的秒数,默认为0(禁用)。如果此设备位于NAT之后,建议使" +"用的值为25。" msgid "Optional. UDP port used for outgoing and incoming packets." -msgstr "" +msgstr "可选,用于传出和传入数据包的UDP端口。" msgid "Options" msgstr "选项" msgid "Other:" -msgstr "其余:" +msgstr "其余:" msgid "Out" msgstr "出口" msgid "Outbound:" -msgstr "出站:" +msgstr "出站:" msgid "Outdoor Channels" msgstr "户外频道" @@ -2136,24 +2143,24 @@ msgid "Override MAC address" msgstr "克隆MAC地址" msgid "Override MTU" -msgstr "设置MTU" +msgstr "更新MTU" msgid "Override TOS" -msgstr "" +msgstr "更新TOS" msgid "Override TTL" -msgstr "" +msgstr "更新TTL" msgid "Override default interface name" -msgstr "" +msgstr "更新默认接口名称" msgid "Override the gateway in DHCP responses" -msgstr "更新网关" +msgstr "更新DHCP响应网关" msgid "" "Override the netmask sent to clients. Normally it is calculated from the " "subnet that is served." -msgstr "更新子网掩码。" +msgstr "更新发送到客户端的子网掩码。" msgid "Override the table used for internal routes" msgstr "更新内部路由表" @@ -2189,22 +2196,22 @@ msgid "PPPoE" msgstr "PPPoE" msgid "PPPoSSH" -msgstr "" +msgstr "PPPoSSH" msgid "PPtP" msgstr "PPtP" msgid "PSID offset" -msgstr "" +msgstr "PSID偏移" msgid "PSID-bits length" -msgstr "" +msgstr "PSID位长度" msgid "PTM/EFM (Packet Transfer Mode)" -msgstr "" +msgstr "PTM/EFM(分组传输模式)" msgid "Package libiwinfo required!" -msgstr "需要libiwinfo软件包!" +msgstr "需要 libiwinfo 软件包!" msgid "Package lists are older than 24 hours" msgstr "软件包列表已超过24小时未更新" @@ -2228,7 +2235,7 @@ msgid "Password of Private Key" msgstr "私有密钥" msgid "Password of inner Private Key" -msgstr "" +msgstr "内部私钥的密码" msgid "Password successfully changed!" msgstr "密码修改成功!" @@ -2246,25 +2253,25 @@ msgid "Path to executable which handles the button event" msgstr "处理按键动作的可执行文件路径" msgid "Path to inner CA-Certificate" -msgstr "" +msgstr "内部CA证书的路径" msgid "Path to inner Client-Certificate" -msgstr "" +msgstr "内部客户端证书的路径" msgid "Path to inner Private Key" -msgstr "" +msgstr "内部私钥的路径" msgid "Peak:" msgstr "峰值:" msgid "Peer IP address to assign" -msgstr "" +msgstr "要分配的Peer IP地址" msgid "Peers" -msgstr "" +msgstr "Peers" msgid "Perfect Forward Secrecy" -msgstr "" +msgstr "完全正向保密" msgid "Perform reboot" msgstr "执行重启" @@ -2273,7 +2280,7 @@ msgid "Perform reset" msgstr "执行复位" msgid "Persistent Keep Alive" -msgstr "" +msgstr "持续Keep-Alive" msgid "Phy Rate:" msgstr "物理速率:" @@ -2300,13 +2307,13 @@ msgid "Port status:" msgstr "端口状态:" msgid "Power Management Mode" -msgstr "" +msgstr "电源管理模式" msgid "Pre-emtive CRC errors (CRCP_P)" -msgstr "" +msgstr "抢占式CRC错误(CRCP_P)" msgid "Preshared Key" -msgstr "" +msgstr "预共享密钥" msgid "" "Presume peer to be dead after given amount of LCP echo failures, use 0 to " @@ -2314,7 +2321,7 @@ msgid "" msgstr "在指定数量的LCP响应故障后假定链路已断开,0为忽略故障" msgid "Prevent listening on these interfaces." -msgstr "" +msgstr "防止监听这些接口。" msgid "Prevents client-to-client communication" msgstr "禁止客户端间通信" @@ -2323,7 +2330,7 @@ msgid "Prism2/2.5/3 802.11b Wireless Controller" msgstr "Prism2/2.5/3 802.11b 无线网卡" msgid "Private Key" -msgstr "" +msgstr "私钥" msgid "Proceed" msgstr "执行" @@ -2332,7 +2339,7 @@ msgid "Processes" msgstr "系统进程" msgid "Profile" -msgstr "" +msgstr "配置文件" msgid "Prot." msgstr "协议" @@ -2359,16 +2366,19 @@ msgid "Pseudo Ad-Hoc (ahdemo)" msgstr "伪装Ad-Hoc(ahdemo)" msgid "Public Key" -msgstr "" +msgstr "公钥" msgid "Public prefix routed to this device for distribution to clients." -msgstr "" +msgstr "分配到此设备的公共前缀,用以分发到客户端。" + +msgid "QMI Cellular" +msgstr "QMI蜂窝" msgid "Quality" msgstr "质量" msgid "RFC3947 NAT-T mode" -msgstr "" +msgstr "RFC3947 NAT-T模式" msgid "RTS/CTS Threshold" msgstr "RTS/CTS阈值" @@ -2411,33 +2421,31 @@ msgid "" "Really delete this interface? The deletion cannot be undone!\\nYou might " "lose access to this device if you are connected via this interface." msgstr "" -"确定要删除此接口?删除操作无法撤销!\\\n" -"删除此接口,可能导致无法再访问路由器!" +"确定要删除此接口?删除操作无法撤销!\\n删除此接口,可能导致无法再访问路由器!" msgid "" "Really delete this wireless network? The deletion cannot be undone!\\nYou " "might lose access to this device if you are connected via this network." msgstr "" -"确定要删除此无线网络?删除操作无法撤销!\\\n" -"删除此无线网络,可能导致无法再访问路由器!" +"确定要删除此无线网络?删除操作无法撤销!\\n删除此无线网络,可能导致无法再访问" +"路由器!" msgid "Really reset all changes?" msgstr "确定要放弃所有更改?" -#, fuzzy msgid "" "Really shut down network?\\nYou might lose access to this device if you are " "connected via this interface." msgstr "" -"确定要关闭此网络?\\\n" -"关闭此网络,可能导致无法再访问路由器!" +"确定要关闭此网络?\\n如果你正在使用此接口连接路由器,关闭此网络可能导致连接断" +"开!" msgid "" "Really shutdown interface \"%s\" ?\\nYou might lose access to this device if " "you are connected via this interface." msgstr "" -"确定要关闭接口\"%s\" ?\\\n" -"删除此网络,可能导致无法再访问路由器!" +"确定要关闭接口 \"%s\"?\\n如果你正在使用此接口连接路由器,关闭此网络可能导致" +"连接断开!" msgid "Really switch protocol?" msgstr "确定要切换协议?" @@ -2503,7 +2511,7 @@ msgid "Remote IPv4 address" msgstr "远程IPv4地址" msgid "Remote IPv4 address or FQDN" -msgstr "" +msgstr "远程IPv4地址或FQDN" msgid "Remove" msgstr "移除" @@ -2527,24 +2535,26 @@ msgid "Require TLS" msgstr "必须使用TLS" msgid "Required for certain ISPs, e.g. Charter with DOCSIS 3" -msgstr "某些ISP需要,例如:同轴线网络DOCSIS 3" +msgstr "某些ISP需要,例如:同轴线网络DOCSIS 3" msgid "Required. Base64-encoded private key for this interface." -msgstr "" +msgstr "必须,此接口的Base64编码私钥。" msgid "" "Required. IP addresses and prefixes that this peer is allowed to use inside " "the tunnel. Usually the peer's tunnel IP addresses and the networks the peer " "routes through the tunnel." msgstr "" +"必须,允许该Peer在隧道中使用的IP地址和前缀,通常是该Peer的隧道IP地址和通过隧" +"道的路由网络。" msgid "Required. Public key of peer." -msgstr "" +msgstr "必须,Peer的公钥。" msgid "" "Requires upstream supports DNSSEC; verify unsigned domain responses really " "come from unsigned domains" -msgstr "" +msgstr "需要上级支持DNSSEC,验证未签名的域响应确实是来自未签名的域。" msgid "Reset" msgstr "复位" @@ -2586,13 +2596,16 @@ msgid "Root preparation" msgstr "" msgid "Route Allowed IPs" -msgstr "" +msgstr "路由允许的IP" + +msgid "Route type" +msgstr "路由类型" msgid "Routed IPv6 prefix for downstream interfaces" -msgstr "" +msgstr "下行接口的路由IPv6前缀" msgid "Router Advertisement-Service" -msgstr "" +msgstr "路由器广告服务" msgid "Router Password" msgstr "主机密码" @@ -2612,18 +2625,18 @@ msgid "Run filesystem check" msgstr "文件系统检查" msgid "SHA256" -msgstr "" +msgstr "SHA256" msgid "" "SIXXS supports TIC only, for static tunnels using IP protocol 41 (RFC4213) " "use 6in4 instead" -msgstr "" +msgstr "SIXXS仅支持TIC,对于使用IP协议41(RFC4213)的静态隧道,使用6in4" msgid "SIXXS-handle[/Tunnel-ID]" msgstr "" msgid "SNR" -msgstr "" +msgstr "SNR" msgid "SSH Access" msgstr "SSH访问" @@ -2665,7 +2678,7 @@ msgid "Section removed" msgstr "移除的区域" msgid "See \"mount\" manpage for details" -msgstr "详参\"mount\"联机帮助" +msgstr "详参 \"mount\" 联机帮助" msgid "" "Send LCP echo requests at the given interval in seconds, only effective in " @@ -2701,7 +2714,6 @@ msgstr "服务类型" msgid "Services" msgstr "服务" -#, fuzzy msgid "Set up Time Synchronization" msgstr "设置时间同步" @@ -2709,7 +2721,7 @@ msgid "Setup DHCP Server" msgstr "配置DHCP服务器" msgid "Severely Errored Seconds (SES)" -msgstr "" +msgstr "严重误码秒(SES)" msgid "Short GI" msgstr "" @@ -2727,7 +2739,7 @@ msgid "Signal" msgstr "信号" msgid "Signal Attenuation (SATN)" -msgstr "" +msgstr "信号衰减(SATN)" msgid "Signal:" msgstr "信号:" @@ -2736,7 +2748,7 @@ msgid "Size" msgstr "大小" msgid "Size (.ipk)" -msgstr "" +msgstr "大小(.ipk)" msgid "Skip" msgstr "跳过" @@ -2770,7 +2782,7 @@ msgid "" "flashed manually. Please refer to the wiki for device specific install " "instructions." msgstr "" -"抱歉,您的设备暂不支持sysupgrade升级,需手动更新固件。请参考Wiki中关于此设备" +"抱歉,您的设备暂不支持Sysupgrade升级,需手动更新固件。请参考Wiki中关于此设备" "的固件更新说明。" msgid "Sort" @@ -2802,17 +2814,17 @@ msgid "" msgstr "指定假设主机已丢失的最大时间(秒)" msgid "Specify a TOS (Type of Service)." -msgstr "" +msgstr "指定TOS(服务类型)。" msgid "" "Specify a TTL (Time to Live) for the encapsulating packet other than the " "default (64)." -msgstr "" +msgstr "为封装数据包设置TTL(生存时间),缺省值:64" msgid "" "Specify an MTU (Maximum Transmission Unit) other than the default (1280 " "bytes)." -msgstr "" +msgstr "设置MTU(最大传输单位),缺省值:1280 bytes" msgid "Specify the secret encryption key here." msgstr "在此指定密钥。" @@ -2866,10 +2878,10 @@ msgid "Submit" msgstr "提交" msgid "Suppress logging" -msgstr "" +msgstr "不记录日志" msgid "Suppress logging of the routine operation of these protocols" -msgstr "" +msgstr "不记录这些协议的常规操作日志。" msgid "Swap" msgstr "交换区" @@ -2884,14 +2896,14 @@ msgid "Switch %q" msgstr "交换机 %q" msgid "Switch %q (%s)" -msgstr "交换机%q (%s)" +msgstr "交换机 %q (%s)" msgid "" "Switch %q has an unknown topology - the VLAN settings might not be accurate." -msgstr "" +msgstr "交换机 %q 具有未知的拓扑结构 - VLAN设置可能不正确。" msgid "Switch VLAN" -msgstr "" +msgstr "VLAN交换机" msgid "Switch protocol" msgstr "切换协议" @@ -2936,7 +2948,7 @@ msgid "Target" msgstr "对象" msgid "Target network" -msgstr "" +msgstr "目标网络" msgid "Terminate" msgstr "关闭" @@ -2965,7 +2977,7 @@ msgstr "HE.net客户端更新设置已经被改变,您现在必须使用用户 msgid "" "The IPv4 address or the fully-qualified domain name of the remote tunnel end." -msgstr "" +msgstr "远程隧道端的IPv4地址或完整域名。" msgid "" "The IPv6 prefix assigned to the provider, usually ends with ::" @@ -2984,17 +2996,15 @@ msgstr "由于以下错误,配置文件无法被加载:" msgid "" "The device file of the memory or partition (e.g." " /dev/sda1)" -msgstr "" -"存储器或分区的设备节点,(例如 /dev/" -"sda1)" +msgstr "存储器或分区的设备节点,(例如:/dev/sda1)" msgid "" "The filesystem that was used to format the memory (e.g. ext3)" msgstr "" -"用于格式化存储器的文件系统,(例如 " -"ext4)" +"用于格式化存储器的文件系统,(例如:ext3)" msgid "" "The flash image was uploaded. Below is the checksum and file size listed, " @@ -3014,11 +3024,10 @@ msgstr "系统中的活跃连接。" msgid "The given network name is not unique" msgstr "给定的网络名重复" -#, fuzzy msgid "" "The hardware is not multi-SSID capable and the existing configuration will " "be replaced if you proceed." -msgstr "本机的硬件不支持多SSID,继续进行将会覆盖现有配置。" +msgstr "本机的硬件不支持多SSID,如果继续,现有配置将被替换。" msgid "" "The length of the IPv4 prefix in bits, the remainder is used in the IPv6 " @@ -3029,7 +3038,7 @@ msgid "The length of the IPv6 prefix in bits" msgstr "bit格式的IPv6前缀长度" msgid "The local IPv4 address over which the tunnel is created (optional)." -msgstr "" +msgstr "所创建隧道的本地IPv4地址(可选)。" msgid "" "The network ports on this device can be combined to several VLAN," -"并支持电脑间的直接通讯。VLAN也常用于分割不同网段。默认通常是一条上行端口连接ISP,其余端口为本地子" -"网。" +"本设备可以划分为多个VLAN,并支持电脑间的直" +"接通讯。VLAN也常用于分割不同网段。默认通常" +"是一条上行端口连接ISP,其余端口为本地子网。" msgid "The selected protocol needs a device assigned" msgstr "所选的协议需要分配设备" msgid "The submitted security token is invalid or already expired!" -msgstr "" +msgstr "提交的安全令牌无效或已过期!" msgid "" "The system is erasing the configuration partition now and will reboot itself " @@ -3067,7 +3075,7 @@ msgstr "" msgid "" "The tunnel end-point is behind NAT, defaults to disabled and only applies to " "AYIYA" -msgstr "" +msgstr "隧道端点在NAT之后,默认为禁用,仅适用于AYIYA" msgid "" "The uploaded image file does not contain a supported format. Make sure that " @@ -3089,7 +3097,7 @@ msgstr "没有待生效的更改!" msgid "" "There is no device assigned yet, please attach a network device in the " "\"Physical Settings\" tab" -msgstr "尚未分配设备,请在\"物理设置\"选项卡中选择网络设备" +msgstr "尚未分配设备,请在“物理设置”选项卡中选择网络设备" msgid "" "There is no password set on this router. Please configure a root password to " @@ -3104,6 +3112,8 @@ msgid "" "'server=1.2.3.4' fordomain-specific or full upstream DNS servers." msgstr "" +"此文件可能包含类似'server=/domain/1.2.3.4'或'server=1.2.3.4'的行,来解析特定" +"域名或指定上游DNS服务器。" msgid "" "This is a list of shell glob patterns for matching files and directories to " @@ -3116,7 +3126,7 @@ msgstr "" msgid "" "This is either the \"Update Key\" configured for the tunnel or the account " "password if no update key has been configured" -msgstr "如果更新密钥没有设置的话,隧道的\"更新密钥\"或者账户密码必须填写." +msgstr "如果更新密钥没有设置的话,隧道的“更新密钥”或者账户密码必须填写。" msgid "" "This is the content of /etc/rc.local. Insert your own commands here (in " @@ -3131,19 +3141,17 @@ msgstr "隧道代理分配的本地终端地址,通常以:2结尾 msgid "" "This is the only DHCP in the local network" -msgstr "" -"这是内网中唯一的DHCP服务器" +msgstr "这是内网中唯一的DHCP服务器" msgid "This is the plain username for logging into the account" msgstr "登录账户时填写的用户名" msgid "" "This is the prefix routed to you by the tunnel broker for use by clients" -msgstr "" +msgstr "这是隧道代理分配给你的路由前缀,供客户端使用" msgid "This is the system crontab in which scheduled tasks can be defined." -msgstr "自定义系统crontab中的计划任务。" +msgstr "自定义系统Crontab中的计划任务。" msgid "" "This is usually the address of the nearest PoP operated by the tunnel broker" @@ -3256,7 +3264,7 @@ msgid "Unable to dispatch" msgstr "无法调度" msgid "Unavailable Seconds (UAS)" -msgstr "" +msgstr "不可用秒数(UAS)" msgid "Unknown" msgstr "未知" @@ -3283,7 +3291,7 @@ msgid "" "Upload a sysupgrade-compatible image here to replace the running firmware. " "Check \"Keep settings\" to retain the current configuration (requires a " "compatible firmware image)." -msgstr "上传兼容的sysupgrade固件以刷新当前系统。" +msgstr "上传兼容的Sysupgrade固件以刷新当前系统。" msgid "Upload archive..." msgstr "上传备份..." @@ -3313,7 +3321,7 @@ msgid "Use TTL on tunnel interface" msgstr "隧道接口的TTL" msgid "Use as external overlay (/overlay)" -msgstr "作为外部overlay使用(/overlay)" +msgstr "作为外部Overlay使用(/overlay)" msgid "Use as root filesystem (/)" msgstr "作为跟文件系统使用(/)" @@ -3322,7 +3330,7 @@ msgid "Use broadcast flag" msgstr "使用广播标签" msgid "Use builtin IPv6-management" -msgstr "" +msgstr "使用内置的IPv6管理" msgid "Use custom DNS servers" msgstr "使用自定义的DNS服务器" @@ -3365,19 +3373,19 @@ msgid "VC-Mux" msgstr "VC-Mux" msgid "VDSL" -msgstr "" +msgstr "VDSL" msgid "VLANs on %q" -msgstr "%q上的VLAN" +msgstr "%q 上的VLAN" msgid "VLANs on %q (%s)" -msgstr "%q (%s)上的VLAN" +msgstr "%q (%s) 上的VLAN" msgid "VPN Local address" -msgstr "" +msgstr "VPN本地地址" msgid "VPN Local port" -msgstr "" +msgstr "VPN本地端口" msgid "VPN Server" msgstr "VPN服务器" @@ -3389,7 +3397,7 @@ msgid "VPN Server's certificate SHA1 hash" msgstr "VPN服务器证书的SHA1哈希值" msgid "VPNC (CISCO 3000 (and others) VPN)" -msgstr "" +msgstr "VPNC (CISCO 3000 和其他VPN)" msgid "Vendor" msgstr "" @@ -3398,10 +3406,10 @@ msgid "Vendor Class to send when requesting DHCP" msgstr "请求DHCP时发送的Vendor Class" msgid "Verbose" -msgstr "" +msgstr "详细" msgid "Verbose logging by aiccu daemon" -msgstr "" +msgstr "aiccu守护程序详细日志" msgid "Verify" msgstr "验证" @@ -3436,7 +3444,7 @@ msgstr "" msgid "" "Wait for NTP sync that many seconds, seting to 0 disables waiting (optional)" -msgstr "在NTP同步之前等待时间.设置为0表示同步之前不等待(可选)" +msgstr "在NTP同步之前等待时间,设置为0表示同步之前不等待(可选)" msgid "Waiting for changes to be applied..." msgstr "正在应用更改..." @@ -3454,10 +3462,10 @@ msgid "Warning: There are unsaved changes that will get lost on reboot!" msgstr "警告:有一些未保存的配置将在重启后丢失!" msgid "Whether to create an IPv6 default route over the tunnel" -msgstr "" +msgstr "是否通过隧道创建IPv6缺省路由" msgid "Whether to route only packets from delegated prefixes" -msgstr "" +msgstr "是否仅路由来自分发前缀的数据包" msgid "Width" msgstr "频宽" @@ -3502,7 +3510,7 @@ msgid "Write received DNS requests to syslog" msgstr "将收到的DNS请求写入系统日志" msgid "Write system log to file" -msgstr "" +msgstr "将系统日志写入文件" msgid "XR Support" msgstr "XR支持" @@ -3524,8 +3532,8 @@ msgid "" "upgrade it to at least version 7 or use another browser like Firefox, Opera " "or Safari." msgstr "" -"你的Internet Explorer已经老到无法正常显示这个页面了!请至少更新到IE7或者使用诸" -"如Firefox Opera Safari之类的浏览器." +"你的Internet Explorer已经老到无法正常显示这个页面了!请至少更新到IE7或者使用" +"诸如Firefox Opera Safari之类的浏览器。" msgid "any" msgstr "任意" @@ -3566,8 +3574,7 @@ msgstr "过期时间" msgid "" "file where given DHCP-leases will be stored" -msgstr "" -"存放DHCP租约的文件" +msgstr "存放DHCP租约的文件" msgid "forward" msgstr "转发" @@ -3603,16 +3610,16 @@ msgid "kbit/s" msgstr "kbit/s" msgid "local DNS file" -msgstr "本地DNS解析文件" +msgstr "本地DNS解析文件" msgid "minimum 1280, maximum 1480" -msgstr "最小值1280,最大值1480" +msgstr "最小值1280,最大值1480" msgid "navigation Navigation" -msgstr "" +msgstr "导航" msgid "no" -msgstr "no" +msgstr "" msgid "no link" msgstr "未连接" @@ -3621,7 +3628,7 @@ msgid "none" msgstr "无" msgid "not present" -msgstr "" +msgstr "不存在" msgid "off" msgstr "关" @@ -3633,7 +3640,7 @@ msgid "open" msgstr "开放式" msgid "overlay" -msgstr "" +msgstr "覆盖" msgid "relay mode" msgstr "中继模式" @@ -3645,19 +3652,19 @@ msgid "server mode" msgstr "服务器模式" msgid "skiplink1 Skip to navigation" -msgstr "" +msgstr "skiplink1 跳转到导航" msgid "skiplink2 Skip to content" -msgstr "" +msgstr "skiplink2 跳到内容" msgid "stateful-only" -msgstr "" +msgstr "有状态的" msgid "stateless" -msgstr "" +msgstr "无状态的" msgid "stateless + stateful" -msgstr "" +msgstr "有状态和无状态的" msgid "tagged" msgstr "关联" @@ -3672,7 +3679,7 @@ msgid "unspecified" msgstr "未指定" msgid "unspecified -or- create:" -msgstr "未指定 // 创建:" +msgstr "未指定或创建:" msgid "untagged" msgstr "不关联" @@ -3683,11 +3690,14 @@ msgstr "是" msgid "« Back" msgstr "« 后退" +#~ msgid "An additional network will be created if you leave this checked." +#~ msgstr "如果选中此复选框,则会创建一个附加网络。" + #~ msgid "An additional network will be created if you leave this unchecked." #~ msgstr "取消选中将会另外创建一个新网络,而不会覆盖当前网络设置" #~ msgid "Join Network: Settings" -#~ msgstr "加入网络:设置" +#~ msgstr "加入网络:设置" #~ msgid "CPU" #~ msgstr "CPU" diff --git a/package/luci/modules/luci-base/po/zh-tw/base.po b/package/luci/modules/luci-base/po/zh-tw/base.po index deed439b75..15ffafc2b4 100644 --- a/package/luci/modules/luci-base/po/zh-tw/base.po +++ b/package/luci/modules/luci-base/po/zh-tw/base.po @@ -283,9 +283,6 @@ msgstr "" msgid "Always announce default router" msgstr "" -msgid "An additional network will be created if you leave this checked." -msgstr "" - msgid "Annex" msgstr "" @@ -393,6 +390,9 @@ msgstr "" msgid "Authentication" msgstr "認證" +msgid "Authentication Type" +msgstr "" + msgid "Authoritative" msgstr "授權" @@ -565,6 +565,9 @@ msgstr "檢查" msgid "Check fileystems before mount" msgstr "" +msgid "Check this option to delete the existing networks from this radio." +msgstr "" + msgid "Checksum" msgstr "效驗碼" @@ -966,6 +969,9 @@ msgstr "啟用 STP" msgid "Enable HE.net dynamic endpoint update" msgstr "啟用HE.net服務代管動態更新" +msgid "Enable IPv6 negotiation" +msgstr "" + msgid "Enable IPv6 negotiation on the PPP link" msgstr "啟用PPP連結上的IPv6交涉" @@ -2379,6 +2385,9 @@ msgstr "" msgid "Public prefix routed to this device for distribution to clients." msgstr "" +msgid "QMI Cellular" +msgstr "" + msgid "Quality" msgstr "品質" @@ -2603,6 +2612,9 @@ msgstr "" msgid "Route Allowed IPs" msgstr "" +msgid "Route type" +msgstr "" + msgid "Routed IPv6 prefix for downstream interfaces" msgstr "" @@ -2785,8 +2797,8 @@ msgid "" "flashed manually. Please refer to the wiki for device specific install " "instructions." msgstr "" -"抱歉, 沒有sysupgrade支援出現, 新版韌體映像檔必須手動更新. 請回歸" -"wiki找尋特定設備安裝指引." +"抱歉, 沒有sysupgrade支援出現, 新版韌體映像檔必須手動更新. 請回歸wiki找尋特定" +"設備安裝指引." msgid "Sort" msgstr "分類" @@ -3307,8 +3319,8 @@ msgid "" "Check \"Keep settings\" to retain the current configuration (requires a " "compatible firmware image)." msgstr "" -"上傳一個sysupgrade-相容的映像檔在這以便替代正執行中的韌體. 勾選\"保持設定" -"\"以保留目前設定值(必須要是OpenWrt/LEDE相容性韌體映像檔)." +"上傳一個sysupgrade-相容的映像檔在這以便替代正執行中的韌體. 勾選\"保持設定\"以" +"保留目前設定值(必須要是OpenWrt/LEDE相容性韌體映像檔)." msgid "Upload archive..." msgstr "上傳壓縮檔..." diff --git a/package/luci/modules/luci-base/src/mkversion.sh b/package/luci/modules/luci-base/src/mkversion.sh index e2d02c1c74..229bee4952 100755 --- a/package/luci/modules/luci-base/src/mkversion.sh +++ b/package/luci/modules/luci-base/src/mkversion.sh @@ -15,7 +15,7 @@ if pcall(dofile, "/etc/openwrt_release") and _G.DISTRIB_DESCRIPTION then end end else - distname = "OpenWrt" + distname = "libreCMC" distversion = "Development Snapshot" end diff --git a/package/luci/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua b/package/luci/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua index 05b27a9f0c..7dd094d7ec 100644 --- a/package/luci/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua +++ b/package/luci/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua @@ -44,7 +44,7 @@ m.hidden = { if iw and iw.mbssid_support then replace = m:field(Flag, "replace", translate("Replace wireless configuration"), - translate("An additional network will be created if you leave this checked.")) + translate("Check this option to delete the existing networks from this radio.")) function replace.cfgvalue() return "0" end else diff --git a/package/luci/protocols/luci-proto-qmi/Makefile b/package/luci/protocols/luci-proto-qmi/Makefile new file mode 100644 index 0000000000..8b2b5e37eb --- /dev/null +++ b/package/luci/protocols/luci-proto-qmi/Makefile @@ -0,0 +1,14 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Support for QMI +LUCI_DEPENDS:=+uqmi + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/luci/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua b/package/luci/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua new file mode 100644 index 0000000000..e11201d213 --- /dev/null +++ b/package/luci/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua @@ -0,0 +1,45 @@ +-- Copyright 2016 David Thornley +-- Licensed to the public under the Apache License 2.0. + +local map, section, net = ... + +local device, apn, pincode, username, password +local auth, ipv6 + + +device = section:taboption("general", Value, "device", translate("Modem device")) +device.rmempty = false + +local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*") + +if device_suggestions then + local node + for node in device_suggestions do + device:value(node) + end +end + + +apn = section:taboption("general", Value, "apn", translate("APN")) + + +pincode = section:taboption("general", Value, "pincode", translate("PIN")) + + +username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) + + +password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) +password.password = true + +auth = section:taboption("general", Value, "auth", translate("Authentication Type")) +auth:value("", translate("-- Please choose --")) +auth:value("both", "PAP/CHAP (both)") +auth:value("pap", "PAP") +auth:value("chap", "CHAP") +auth:value("none", "NONE") + +if luci.model.network:has_ipv6() then + ipv6 = section:taboption("advanced", Flag, "ipv6", translate("Enable IPv6 negotiation")) + ipv6.default = ipv6.disabled +end diff --git a/package/luci/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua b/package/luci/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua new file mode 100644 index 0000000000..cca8af109e --- /dev/null +++ b/package/luci/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua @@ -0,0 +1,51 @@ +-- Copyright 2016 David Thornley +-- Licensed to the public under the Apache License 2.0. + +local netmod = luci.model.network +local interface = luci.model.network.interface +local proto = netmod:register_protocol("qmi") + +function proto.get_i18n(self) + return luci.i18n.translate("QMI Cellular") +end + +function proto.ifname(self) + local base = netmod._M.protocol + local ifname = base.ifname(self) -- call base class "protocol.ifname(self)" + + -- Note: ifname might be nil if the adapter could not be determined through ubus (default name to qmi-wan in this case) + if ifname == nil then + ifname = "qmi-" .. self.sid + end + return ifname +end + +function proto.get_interface(self) + return interface(self:ifname(), self) +end + +function proto.opkg_package(self) + return "uqmi" +end + +function proto.is_installed(self) + return nixio.fs.access("/lib/netifd/proto/qmi.sh") +end + +function proto.is_floating(self) + return true +end + +function proto.is_virtual(self) + return true +end + +function proto.get_interfaces(self) + return nil +end + +function proto.contains_interface(self, ifc) + return (netmod:ifnameof(ifc) == self:ifname()) +end + +netmod:register_pattern_virtual("^qmi-%w") diff --git a/package/luci/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/cascade.css b/package/luci/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/cascade.css index 1d712e4533..8d0c434a98 100644 --- a/package/luci/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/cascade.css +++ b/package/luci/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/cascade.css @@ -500,6 +500,8 @@ select, select { padding: initial; + background: #fff; + box-shadow: inset 0 -1px 3px rgba(0, 0, 0, 0.1); } input[type=checkbox], input[type=radio] { diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 24b2e05569..ee31d17b25 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -9,15 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=firewall -PKG_VERSION:=2016-11-07 -PKG_RELEASE:=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/firewall3.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=0367860636aa55e9ee064709ec2814906e1f246b -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=1a087c92c73c3736dd19445d2f470abc2c1eb623956ddd55284c2e6a733198ce +PKG_SOURCE_DATE:=2016-11-29 +PKG_SOURCE_VERSION:=13698aafb52c45817ee7815da3405e620657c8d0 +PKG_MIRROR_HASH:=6ba6e96a588dd3afd7e9db7e9246c5cc6c560aa95385592960c6b71b5a9c6395 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/network/config/gre/Makefile b/package/network/config/gre/Makefile index 2e05ffca6f..90f92d4da7 100644 --- a/package/network/config/gre/Makefile +++ b/package/network/config/gre/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gre PKG_VERSION:=1 -PKG_RELEASE:=4 +PKG_RELEASE:=6 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk @@ -60,6 +60,14 @@ define Package/gre/install $(INSTALL_BIN) ./files/gre.sh $(1)/lib/netifd/proto/gre.sh endef +define Package/grev4/install + : +endef + +define Package/grev6/install + : +endef + $(eval $(call BuildPackage,gre)) $(eval $(call BuildPackage,grev4)) $(eval $(call BuildPackage,grev6)) diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh index 3f472c4473..cd327ea2da 100755 --- a/package/network/config/gre/files/gre.sh +++ b/package/network/config/gre/files/gre.sh @@ -25,7 +25,7 @@ gre_generic_setup() { json_add_string mode "$mode" json_add_int mtu "${mtu:-1280}" [ -n "$df" ] && json_add_boolean df "$df" - json_add_int ttl "${ttl:-64}" + [ -n "ttl" ] && json_add_int ttl "$ttl" [ -n "$tos" ] && json_add_string tos "$tos" json_add_boolean multicast "$multicast" json_add_string local "$local" @@ -84,7 +84,14 @@ gre_setup() { [ -z "$df" ] && df="1" - gre_generic_setup $cfg $mode $ipaddr $peeraddr "gre-$cfg" + case "$mode" in + gretapip) + gre_generic_setup $cfg $mode $ipaddr $peeraddr "gre4t-$cfg" + ;; + *) + gre_generic_setup $cfg $mode $ipaddr $peeraddr "gre4-$cfg" + ;; + esac } proto_gre_setup() { @@ -102,7 +109,7 @@ proto_gretap_setup() { gre_setup $cfg "gretapip" json_init - json_add_string name "gre-$cfg" + json_add_string name "gre4t-$cfg" json_add_boolean link-ext 0 json_close_object @@ -155,7 +162,14 @@ grev6_setup() { fi } - gre_generic_setup $cfg $mode $ip6addr $peer6addr "grev6-$cfg" + case "$mode" in + gretapip6) + gre_generic_setup $cfg $mode $ip6addr $peer6addr "gre6t-$cfg" + ;; + *) + gre_generic_setup $cfg $mode $ip6addr $peer6addr "gre6-$cfg" + ;; + esac } proto_grev6_setup() { @@ -173,7 +187,7 @@ proto_grev6tap_setup() { grev6_setup $cfg "gretapip6" json_init - json_add_string name "grev6-$cfg" + json_add_string name "gre6t-$cfg" json_add_boolean link-ext 0 json_close_object @@ -203,7 +217,7 @@ proto_gre_teardown() { proto_gretap_teardown() { local cfg="$1" - gretap_generic_teardown "gre-$cfg" + gretap_generic_teardown "gre4t-$cfg" } proto_grev6_teardown() { @@ -213,7 +227,7 @@ proto_grev6_teardown() { proto_grev6tap_teardown() { local cfg="$1" - gretap_generic_teardown "grev6-$cfg" + gretap_generic_teardown "gre6t-$cfg" } gre_generic_init_config() { diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 0261bf3575..c0a354b881 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_VERSION:=2016-11-21 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/netifd.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=153a12143b9fef4b5d3c3a6597f6fe967a17c9d7 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=5d4126e26a88102bc06d36564b204a989a42a1e4aadf6b2776e123fd3f8883f7 +PKG_SOURCE_DATE:=2016-12-23 +PKG_SOURCE_VERSION:=64a655d8ffa9f0cea1bbdd35cac6b3b99b865270 +PKG_MIRROR_HASH:=1fa244a10f6d12d8bad2e60c054c0542d6f9ebe1cde319085f02289e8676612a PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/soloscli/Makefile b/package/network/config/soloscli/Makefile index 12bc15eaca..a27173aa85 100644 --- a/package/network/config/soloscli/Makefile +++ b/package/network/config/soloscli/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=solos-pci-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/openadsl -PKG_MD5SUM:=c398866de3c059b14eb953c89d698124 +PKG_HASH:=6379e6970a5c97fd5a223d024138ebb71b15d70e2ad1fe9da09edc5b2d760e1d PKG_LICENSE:=GPL-2.0 PKG_BUILD_DIR:=$(BUILD_DIR)/solos-pci-$(PKG_VERSION) diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile index d1c8fd7b5e..e4a00d6d63 100644 --- a/package/network/config/swconfig/Makefile +++ b/package/network/config/swconfig/Makefile @@ -42,13 +42,12 @@ define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libsw.so $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/libsw.a $(1)/usr/lib/ endef define Package/swconfig/install $(INSTALL_DIR) $(1)/sbin $(1)/lib/network $(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig - $(INSTALL_BIN) $(PKG_BUILD_DIR)/libsw.so $(1)/lib $(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/ endef diff --git a/package/network/config/swconfig/src/Makefile b/package/network/config/swconfig/src/Makefile index 1176bf0e40..e972a44397 100644 --- a/package/network/config/swconfig/src/Makefile +++ b/package/network/config/swconfig/src/Makefile @@ -8,8 +8,9 @@ all: swconfig %.o: %.c $(CC) $(CFLAGS) -fPIC -c -o $@ $^ -libsw.so: swlib.o - $(CC) $(CFLAGS) -fPIC -shared -o $@ swlib.o +libsw.a: swlib.o + $(AR) rcu $@ swlib.o + $(RANLIB) $@ -swconfig: libsw.so cli.o uci.o +swconfig: libsw.a cli.o uci.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -L./ -lsw diff --git a/package/network/config/vti/Makefile b/package/network/config/vti/Makefile index 7cf0ee913d..bda2a9ab17 100644 --- a/package/network/config/vti/Makefile +++ b/package/network/config/vti/Makefile @@ -60,6 +60,14 @@ define Package/vti/install $(INSTALL_BIN) ./files/vti.sh $(1)/lib/netifd/proto/vti.sh endef +define Package/vtiv4/install + : +endef + +define Package/vtiv6/install + : +endef + $(eval $(call BuildPackage,vti)) $(eval $(call BuildPackage,vtiv4)) $(eval $(call BuildPackage,vtiv6)) diff --git a/package/network/ipv6/map/src/CMakeLists.txt b/package/network/ipv6/map/src/CMakeLists.txt index 2cbeb2c261..a839373022 100644 --- a/package/network/ipv6/map/src/CMakeLists.txt +++ b/package/network/ipv6/map/src/CMakeLists.txt @@ -5,6 +5,9 @@ project(mapcalc C) set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=c99") +FIND_PATH(ubus_include_dir libubus.h) +INCLUDE_DIRECTORIES(${ubus_include_dir}) + add_definitions(-D_GNU_SOURCE -Wall -Wno-gnu -Wextra) add_executable(mapcalc mapcalc.c) diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile index 9b50e21e4d..60602f5554 100644 --- a/package/network/ipv6/odhcp6c/Makefile +++ b/package/network/ipv6/odhcp6c/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcp6c -PKG_VERSION:=2016-06-30 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_URL:=https://github.com/sbyx/odhcp6c.git +PKG_SOURCE_URL:=git://git.lede-project.org/project/odhcp6c.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=7533a6243dc3ac5a747cf6ccbc4d0539dafd3e07 -PKG_MIRROR_MD5SUM:=faaa26d09039c3133626f67a01b07b9922fea105e6566c44e78350fce51fa2b8 +PKG_SOURCE_DATE:=2017-01-07 +PKG_SOURCE_VERSION:=d420f49396c627ce1072b83170889baf0720bc8b +PKG_MIRROR_HASH:=a7c599b5600b6cca9aec221dd32fc7754e0e942b0192bd902f1e789f53345127 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0 @@ -31,7 +29,7 @@ define Package/odhcp6c SECTION:=net CATEGORY:=Network TITLE:=Embedded DHCPv6-client for OpenWrt - DEPENDS:=@IPV6 + DEPENDS:=@IPV6 +libubox endef define Package/odhcp6c/config diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script index 46980cb57d..1bb5e771b6 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.script +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script @@ -214,6 +214,6 @@ case "$2" in esac # user rules -[ -f /etc/odhcp6c.user ] && . /etc/odhcp6c.user +[ -f /etc/odhcp6c.user ] && . /etc/odhcp6c.user "@" exit 0 diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh index 6c47399916..9e3f669733 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh @@ -30,14 +30,15 @@ proto_dhcpv6_init_config() { proto_config_add_int "soltimeout" proto_config_add_boolean fakeroutes proto_config_add_boolean sourcefilter + proto_config_add_boolean keep_ra_dnslifetime } proto_dhcpv6_setup() { local config="$1" local iface="$2" - local reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter - json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter + local reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime + json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime # Configure @@ -61,6 +62,8 @@ proto_dhcpv6_setup() { [ -n "$userclass" ] && append opts "-u$userclass" + [ "$keep_ra_dnslifetime" = "1" ] && append opts "-L" + for opt in $reqopts; do append opts "-r$opt" done diff --git a/package/network/ipv6/thc-ipv6/Makefile b/package/network/ipv6/thc-ipv6/Makefile index 563afa4f81..df3a67c23b 100644 --- a/package/network/ipv6/thc-ipv6/Makefile +++ b/package/network/ipv6/thc-ipv6/Makefile @@ -14,7 +14,7 @@ PKG_LICENSE:=GPL-3.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://freeworld.thc.org/releases/ -PKG_MD5SUM:=2975dd54be35b68c140eb2a6b8ef5e59 +PKG_HASH:=440a3ae98b57100c397ec4f8634468dbbb0c3b48788c6b74af2a597a90544a96 PKG_MAINTAINER:=Jo-Philipp Wich diff --git a/package/network/services/authsae/Makefile b/package/network/services/authsae/Makefile index 8096107dc9..fd0e82ffd8 100644 --- a/package/network/services/authsae/Makefile +++ b/package/network/services/authsae/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=authsae -PKG_VERSION:=2014-06-09 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/cozybit/authsae.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2014-06-09 PKG_SOURCE_VERSION:=8531ab158910a525d4bcbb3ad02c08342f6987f2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=aa208688570fc6b8b16d9b70e3644208e851dbd3a90f52843aa44c9043b4fbbb +PKG_MIRROR_HASH:=a8fbed9eada17c552c70d834ee8f7c1e0987df59839bc113b3ec000500696715 PKG_BUILD_PARALLEL:=1 CMAKE_INSTALL:=1 diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 861cda7fbe..98333850af 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -9,11 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_VERSION:=2.76 -PKG_RELEASE:=5 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq -PKG_MD5SUM:=00f5ee66b4e4b7f14538bf62ae3c9461 +PKG_HASH:=4b92698dee19ca0cb2a8f2e48f1d2dffd01a21eb15d1fbed4cf085630c8c9f96 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index eebf5c76c8..87332a9081 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -8,6 +8,7 @@ PROG=/usr/sbin/dnsmasq ADD_LOCAL_DOMAIN=1 ADD_LOCAL_HOSTNAME=1 +ADD_WAN_HOSTNAME=0 BASECONFIGFILE="/var/etc/dnsmasq.conf" BASEHOSTFILE="/tmp/hosts/dhcp" @@ -23,22 +24,22 @@ xappend() { } hex_to_hostid() { - local var="$1" - local hex="${2#0x}" # strip optional "0x" prefix + local var="$1" + local hex="${2#0x}" # strip optional "0x" prefix - if [ -n "${hex//[0-9a-fA-F]/}" ]; then - # is invalid hex literal - return 1 - fi + if [ -n "${hex//[0-9a-fA-F]/}" ]; then + # is invalid hex literal + return 1 + fi - # convert into host id - export "$var=$( - printf "%0x:%0x" \ - $(((0x$hex >> 16) % 65536)) \ - $(( 0x$hex % 65536)) - )" + # convert into host id + export "$var=$( + printf "%0x:%0x" \ + $(((0x$hex >> 16) % 65536)) \ + $(( 0x$hex % 65536)) + )" - return 0 + return 0 } dhcp_calc() { @@ -278,6 +279,7 @@ dhcp_host_add() { config_get tag "$cfg" tag if [ "$DHCPv6CAPABLE" -eq 1 ]; then + config_get duid "$cfg" duid config_get hostid "$cfg" hostid if [ -n "$hostid" ]; then hex_to_hostid hostid "$hostid" @@ -289,7 +291,27 @@ dhcp_host_add() { config_get leasetime "$cfg" leasetime - xappend "--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip${hostid:+,[::$hostid]}}${name:+,$name}${leasetime:+,$leasetime}" + xappend "--dhcp-host=$macs${duid:+,id:$duid}${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip${hostid:+,[::$hostid]}}${name:+,$name}${leasetime:+,$leasetime}" +} + +dhcp_this_host_add() { + # TODO: case-in do/not short-host or FQDN; UCI already intended ... + local ifname="$1" + local do_enable="$2" + local routerstub routername ifdashname + + + if [ "$do_enable" -gt 0 ] ; then + # All IP addresses discovered by dnsmasq will be labeled robustly (except fe80::) + ifdashname="${ifname//./-}" + routerstub="$( md5sum /etc/os-release )" + routerstub="router-${routerstub// */}" + routername="$( uci_get system @system[0] hostname $routerstub )" + + xappend "--interface-name=$ifdashname.$routername.$DOMAIN,$ifname" + xappend "--interface-name=$routername.$DOMAIN,$ifname" + xappend "--interface-name=$routername,$ifname" + fi } dhcp_tag_add() { @@ -362,7 +384,11 @@ dhcp_add() { DNS_SERVERS="$DNS_SERVERS $dnsserver" } - append_bool "$cfg" ignore "--no-dhcp-interface=$ifname" && return 0 + append_bool "$cfg" ignore "--no-dhcp-interface=$ifname" && { + # Many ISP do not have useful names for DHCP customers (your WAN). + dhcp_this_host_add $ifname $ADD_WAN_HOSTNAME + return 0 + } # Do not support non-static interfaces for now [ static = "$proto" ] || return 0 @@ -380,6 +406,9 @@ dhcp_add() { config_get options "$cfg" options config_get_bool dynamicdhcp "$cfg" dynamicdhcp 1 + # Put the router host name on this DHCP served interface address(es) + dhcp_this_host_add $ifname $ADD_LOCAL_HOSTNAME + leasetime="${leasetime:-12h}" start="$(dhcp_calc "${start:-100}")" limit="${limit:-150}" @@ -573,6 +602,7 @@ dnsmasq_start() append_bool "$cfg" allservers "--all-servers" append_bool "$cfg" noping "--no-ping" + append_parm "$cfg" logfacility "--log-facility" append_parm "$cfg" dhcpscript "--dhcp-script" append_parm "$cfg" cachesize "--cache-size" append_parm "$cfg" dnsforwardmax "--dns-forward-max" @@ -603,6 +633,7 @@ dnsmasq_start() config_get_bool ADD_LOCAL_DOMAIN "$cfg" add_local_domain 1 config_get_bool ADD_LOCAL_HOSTNAME "$cfg" add_local_hostname 1 + config_get_bool ADD_WAN_HOSTNAME "$cfg" add_wan_hostname 0 config_get_bool readethers "$cfg" readethers [ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers @@ -670,7 +701,7 @@ dnsmasq_start() xappend "--dhcp-broadcast=tag:needs-broadcast" - xappend "--addn-hosts=$HOSTFILE" + xappend "--addn-hosts=$(dirname $HOSTFILE)" config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d" [ ! -d "$dnsmasqconfdir" ] && mkdir -p $dnsmasqconfdir @@ -700,27 +731,6 @@ dnsmasq_start() config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg" config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg" - # add own hostname - [ $ADD_LOCAL_HOSTNAME -eq 1 ] && { - local lanaddr lanaddr6 - local ulaprefix="$(uci_get network @globals[0] ula_prefix)" - local hostname="$(uci_get system @system[0] hostname Lede)" - - network_get_ipaddr lanaddr "lan" && { - dhcp_domain_add "" "$hostname" "$lanaddr" - } - - [ -n "$ulaprefix" ] && network_get_ipaddrs6 lanaddr6 "lan" && { - for lanaddr6 in $lanaddr6; do - case "$lanaddr6" in - "${ulaprefix%%:/*}"*) - dhcp_domain_add "" "$hostname" "$lanaddr6" - ;; - esac - done - } - } - echo >> $CONFIGFILE_TMP config_foreach filter_dnsmasq srvhost dhcp_srv_add "$cfg" config_foreach filter_dnsmasq mxhost dhcp_mx_add "$cfg" @@ -785,7 +795,7 @@ dnsmasq_stop() service_triggers() { - procd_add_reload_trigger "dhcp" "system" + procd_add_reload_trigger "dhcp" procd_add_raw_trigger "interface.*" 2000 /etc/init.d/dnsmasq reload } @@ -825,7 +835,6 @@ start_service() { reload_service() { rc_procd start_service "$@" - killall -HUP dnsmasq return 0 } diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 41c66dd43c..e6bae9f21f 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://matt.ucc.asn.au/dropbear/releases/ \ https://dropbear.nl/mirror/releases/ -PKG_MD5SUM:=9ad0172731e0f16623937804643b5bd8 +PKG_HASH:=2720ea54ed009af812701bcc290a2a601d5c107d12993e5d92c0f5f81f718891 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE @@ -28,7 +28,7 @@ PKG_CONFIG_DEPENDS:=CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ include $(INCLUDE_DIR)/package.mk ifneq ($(DUMP),1) - STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s) + STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) endif define Package/dropbear/Default @@ -77,13 +77,13 @@ CONFIGURE_ARGS += \ --disable-zlib \ --enable-bundled-libtom -TARGET_CFLAGS += -DDEFAULT_PATH=\\\"$(CONFIG_TARGET_INIT_PATH)\\\" -DARGTYPE=3 -ffunction-sections -fdata-sections +TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections TARGET_LDFLAGS += -Wl,--gc-sections define Build/Configure $(Build/Configure/Default) - $(SED) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(CONFIG_TARGET_INIT_PATH)",g' \ + $(SED) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(TARGET_INIT_PATH)",g' \ $(PKG_BUILD_DIR)/options.h awk 'BEGIN { rc = 1 } \ diff --git a/package/network/services/dropbear/patches/500-set-default-path.patch b/package/network/services/dropbear/patches/500-set-default-path.patch deleted file mode 100644 index da6b9ae0ce..0000000000 --- a/package/network/services/dropbear/patches/500-set-default-path.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/options.h -+++ b/options.h -@@ -352,7 +352,9 @@ be overridden at runtime with -I. 0 disa - #define DEFAULT_IDLE_TIMEOUT 0 - - /* The default path. This will often get replaced by the shell */ -+#ifndef DEFAULT_PATH - #define DEFAULT_PATH "/usr/bin:/bin" -+#endif - - /* Some other defines (that mostly should be left alone) are defined - * in sysoptions.h */ diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 645888e745..fea5ed3ba3 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -46,6 +46,10 @@ config DRIVER_11N_SUPPORT bool default n +config DRIVER_11AC_SUPPORT + bool + default n + config DRIVER_11W_SUPPORT bool default n diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 9570b2a8f5..207dfecebe 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,16 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=2016-09-05 PKG_RELEASE:=1 -PKG_REV:=fcd85d9a3f2d9d63d0fa57e93446ad467db75b23 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://w1.fi/hostap.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE_PROTO:=git -PKG_MIRROR_MD5SUM:=b1b690fedae8ff5c5801b4fb75508ea35c036aae86425ae324875fa57ef1a01b +PKG_SOURCE_DATE:=2016-12-19 +PKG_SOURCE_VERSION:=ad02e79d12fd70ed6bd5fbaf64001a2851e5bb7b +PKG_MIRROR_HASH:=7a0983f004b156d46911765c113754a4c00f56fb889430620bbd061b3b1fcf33 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -31,7 +28,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_hostapd-mini \ CONFIG_WPA_RFKILL_SUPPORT \ CONFIG_DRIVER_WEXT_SUPPORT \ - CONFIG_DRIVER_11N_SUPPORT + CONFIG_DRIVER_11N_SUPPORT \ + CONFIG_DRIVER_11AC_SUPPORT LOCAL_TYPE=$(strip \ $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \ @@ -52,7 +50,7 @@ ifneq ($(LOCAL_TYPE),hostapd) endif endif -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk @@ -62,10 +60,15 @@ ifneq ($(CONFIG_DRIVER_11N_SUPPORT),) HOSTAPD_IEEE80211N:=y endif +ifneq ($(CONFIG_DRIVER_11AC_SUPPORT),) + HOSTAPD_IEEE80211AC:=y +endif + DRIVER_MAKEOPTS= \ CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \ CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \ CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \ + CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \ ifeq ($(LOCAL_VARIANT),full) @@ -193,10 +196,6 @@ define Package/wpa-supplicant VARIANT:=supplicant-full endef -define Package/wpa-supplicant/Description - WPA Supplicant -endef - define Package/wpa-supplicant/config source "$(SOURCE)/Config.in" endef @@ -209,10 +208,6 @@ define Package/wpa-supplicant-p2p VARIANT:=supplicant-p2p endef -define Package/wpa-supplicant-p2p/Description - WPA Supplicant (with Wi-Fi P2P support) -endef - define Package/wpa-supplicant-mesh $(Package/wpa-supplicant) TITLE:=WPA Supplicant (with 802.11s and SAE) @@ -221,10 +216,6 @@ define Package/wpa-supplicant-mesh VARIANT:=supplicant-mesh endef -define Package/wpa-supplicant-mesh/Description - WPA Supplicant (variant with 802.11s and SAE support) -endef - define Package/wpa-supplicant-mini $(Package/wpa-supplicant) TITLE:=WPA Supplicant (minimal version) @@ -233,19 +224,11 @@ define Package/wpa-supplicant-mini VARIANT:=supplicant-mini endef -define Package/wpa-supplicant-mini/Description - WPA Supplicant (minimal version) -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 interface -endef - -define Package/wpa-cli/Description - WPA Supplicant control utility + TITLE:=WPA Supplicant command line control utility endef define Package/hostapd-common diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh index a24a5c30d5..fb23e52e67 100644 --- a/package/network/services/hostapd/files/netifd.sh +++ b/package/network/services/hostapd/files/netifd.sh @@ -36,6 +36,14 @@ hostapd_append_wep_key() { esac } +hostapd_append_wpa_key_mgmt() { + local auth_type="$(echo $auth_type | tr 'a-z' 'A-Z')" + + append wpa_key_mgmt "WPA-$auth_type" + [ "$ieee80211r" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type}" + [ "$ieee80211w" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type}-SHA256" +} + hostapd_add_log_config() { config_add_boolean \ log_80211 \ @@ -187,7 +195,7 @@ hostapd_set_bss_options() { wps_device_type wps_device_name wps_manufacturer wps_pin \ macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \ iapp_interface eapol_version acct_server acct_secret acct_port \ - dynamic_vlan + dynamic_vlan ieee80211w set_default isolate 0 set_default maxassoc 0 @@ -256,7 +264,6 @@ hostapd_set_bss_options() { [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N" wps_possible=1 - append wpa_key_mgmt "WPA-PSK" ;; eap) json_get_vars \ @@ -291,7 +298,6 @@ hostapd_set_bss_options() { [ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" append bss_conf "eapol_key_index_workaround=1" "$N" append bss_conf "ieee8021x=1" "$N" - append wpa_key_mgmt "WPA-EAP" [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N" ;; @@ -376,11 +382,9 @@ hostapd_set_bss_options() { for kh in $r1kh; do append bss_conf "r1kh=${kh//,/ }" "$N" done - - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP" - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK" fi + hostapd_append_wpa_key_mgmt [ -n "$wpa_key_mgmt" ] && append bss_conf "wpa_key_mgmt=$wpa_key_mgmt" "$N" fi @@ -397,7 +401,6 @@ hostapd_set_bss_options() { [ "$auth_cache" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N" # RSN -> allow management frame protection - json_get_var ieee80211w ieee80211w case "$ieee80211w" in [012]) json_get_vars ieee80211w_max_timeout ieee80211w_retry_timeout @@ -573,11 +576,8 @@ wpa_supplicant_add_network() { local network_data= local T=" " - local wpa_key_mgmt="WPA-PSK" local scan_ssid="scan_ssid=1" - local freq - - [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt" + local freq wpa_key_mgmt [[ "$_w_mode" = "adhoc" ]] && { append network_data "mode=1" "$N$T" @@ -589,7 +589,7 @@ wpa_supplicant_add_network() { scan_ssid="scan_ssid=0" - [ "$_w_driver" = "nl80211" ] || wpa_key_mgmt="WPA-NONE" + [ "$_w_driver" = "nl80211" ] || append wpa_key_mgmt "WPA-NONE" } [[ "$_w_mode" = "mesh" ]] && { @@ -601,7 +601,7 @@ wpa_supplicant_add_network() { freq="$(get_freq "$phy" "$channel")" append network_data "frequency=$freq" "$N$T" } - wpa_key_mgmt="SAE" + append wpa_key_mgmt "SAE" scan_ssid="" } @@ -617,7 +617,12 @@ wpa_supplicant_add_network() { psk) local passphrase + if [ "$_w_mode" != "mesh" ]; then + hostapd_append_wpa_key_mgmt + fi + key_mgmt="$wpa_key_mgmt" + if [ ${#key} -eq 64 ]; then passphrase="psk=${key}" else @@ -626,8 +631,8 @@ wpa_supplicant_add_network() { append network_data "$passphrase" "$N$T" ;; eap) - key_mgmt='WPA-EAP' - [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt" + hostapd_append_wpa_key_mgmt + key_mgmt="$wpa_key_mgmt" json_get_vars eap_type identity anonymous_identity ca_cert [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T" diff --git a/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch deleted file mode 100644 index 5c8b6622c9..0000000000 --- a/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Matthias May -Date: Tue, 5 Jul 2016 15:00:43 +0200 -Subject: [PATCH] 4addr: fix reconnecting client on connection lost - -When a 4addr client suddenly looses its connection (no deauth/deassoc) -the AP still thinks it is connected. -If the client reconnects before the AP timeoutes the client, traffic -cannot flow. - -Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags -when the client completes association. - -Signed-off-by: Matthias May ---- - ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta - new_assoc = 0; - sta->flags |= WLAN_STA_ASSOC; - sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE; -+ sta->flags &= ~WLAN_STA_WDS; - if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) || - sta->auth_alg == WLAN_AUTH_FT) { - /* diff --git a/package/network/services/hostapd/patches/100-daemonize_fix.patch b/package/network/services/hostapd/patches/100-daemonize_fix.patch index 0389406a98..fad84669a6 100644 --- a/package/network/services/hostapd/patches/100-daemonize_fix.patch +++ b/package/network/services/hostapd/patches/100-daemonize_fix.patch @@ -60,13 +60,13 @@ + if (chdir("/") < 0) return -1; - } - +- - return 0; -} -#else /* __APPLE__ */ -#define os_daemon daemon -#endif /* __APPLE__ */ -- + - -int os_daemonize(const char *pid_file) -{ 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 5aee3d07f1..5181721e3b 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 -@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout( +@@ -259,9 +259,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/130-Revert-nl80211-Remove-duplicated-check-in-nl80211_se.patch b/package/network/services/hostapd/patches/130-Revert-nl80211-Remove-duplicated-check-in-nl80211_se.patch deleted file mode 100644 index dda1fa5894..0000000000 --- a/package/network/services/hostapd/patches/130-Revert-nl80211-Remove-duplicated-check-in-nl80211_se.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 23dc11dfbd8e78a2450120e9afc83c1d32a8e683 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 12 Sep 2016 19:02:34 +0200 -Subject: [PATCH] Revert "nl80211: Remove duplicated check in - nl80211_setup_ap()" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reverts commit 647862eb60c324015ea31293cc052558b5185ca4. - -The second check of device_ap_sme looks like duplicated, but it isn't -actually. The trick is nl80211_create_monitor_interface may change that -variable value and the second evaluation may give a different result. - -This definitely isn't a very clear code, but that change caused a -regression for drivers that: -1) Don't report NL80211_ATTR_DEVICE_AP_SME -2) Don't support monitor mode -3) Don't support subscribing for PROBE_REQ and/or ACTION frames -like brcmfmac. With such drivers hostapd doesn't start anymore. - -Signed-off-by: Rafał Miłecki ---- - src/drivers/driver_nl80211.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -4434,7 +4434,8 @@ static int nl80211_setup_ap(struct i802_ - "nl80211: Failed to subscribe for mgmt frames from SME driver - trying to run without it"); - - if (!drv->device_ap_sme && drv->use_monitor && -- nl80211_create_monitor_interface(drv)) -+ nl80211_create_monitor_interface(drv) && -+ !drv->device_ap_sme) - return -1; - - if (drv->device_ap_sme && diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index aba9dafc5f..9ea3ef9c2d 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -8,7 +8,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -193,7 +194,8 @@ endif +@@ -198,7 +199,8 @@ endif ifdef CONFIG_NO_VLAN CFLAGS += -DCONFIG_NO_VLAN @@ -18,7 +18,7 @@ OBJS += ../src/ap/vlan_init.o OBJS += ../src/ap/vlan_ifconfig.o OBJS += ../src/ap/vlan.o -@@ -318,10 +320,14 @@ CFLAGS += -DCONFIG_MBO +@@ -330,10 +332,14 @@ CFLAGS += -DCONFIG_MBO OBJS += ../src/ap/mbo_ap.o endif @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1054,6 +1060,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1073,6 +1079,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 " $@ -@@ -1095,6 +1107,12 @@ HOBJS += ../src/crypto/aes-internal.o +@@ -1114,6 +1126,12 @@ HOBJS += ../src/crypto/aes-internal.o HOBJS += ../src/crypto/aes-internal-enc.o endif @@ -72,7 +72,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -313,7 +314,9 @@ endif +@@ -329,7 +330,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -82,7 +82,7 @@ OBJS += ibss_rsn.o endif -@@ -804,6 +807,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -820,6 +823,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -93,7 +93,7 @@ endif ifdef CONFIG_MACSEC -@@ -824,9 +831,11 @@ NEED_EAP_COMMON=y +@@ -840,9 +847,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -105,7 +105,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -899,10 +908,18 @@ endif +@@ -910,6 +919,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -117,6 +117,10 @@ + endif endif + ifdef CONFIG_MBO +@@ -918,7 +933,9 @@ CFLAGS += -DCONFIG_MBO + endif + ifdef NEED_RSN_AUTHENTICATOR +ifndef MULTICALL CFLAGS += -DCONFIG_NO_RADIUS @@ -124,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1685,6 +1702,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1706,6 +1723,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -137,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1787,6 +1810,12 @@ endif +@@ -1808,6 +1831,12 @@ endif -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@ @$(E) " sed" $< @@ -152,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4870,8 +4870,8 @@ union wpa_event_data { +@@ -4968,8 +4968,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -163,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -4883,7 +4883,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -4981,7 +4981,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -174,7 +178,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1164,8 +1164,8 @@ static void hostapd_event_dfs_cac_starte +@@ -1163,8 +1163,8 @@ static void hostapd_event_dfs_cac_starte #endif /* NEED_AP_MLME */ @@ -185,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -1374,7 +1374,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1373,7 +1373,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -196,7 +200,7 @@ struct hapd_interfaces *interfaces = ctx; --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c -@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st +@@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(st } @@ -207,7 +211,7 @@ { struct wpa_priv_interface *iface = ctx; -@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1101,7 +1101,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -216,7 +220,7 @@ union wpa_event_data *data) { struct wpa_priv_global *global = ctx; -@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[]) +@@ -1213,6 +1213,8 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -227,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -3398,8 +3398,8 @@ static void wpa_supplicant_event_assoc_a +@@ -3610,8 +3610,8 @@ static void wpa_supplicant_event_assoc_a } @@ -238,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -4074,7 +4074,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -4315,7 +4315,7 @@ void wpa_supplicant_event(void *ctx, enu #endif /* CONFIG_AP */ break; case EVENT_ACS_CHANNEL_SELECTED: @@ -247,7 +251,7 @@ if (!wpa_s->ap_iface) break; hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0], -@@ -4096,7 +4096,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -4337,7 +4337,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -258,7 +262,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5094,7 +5094,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -5136,7 +5136,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -266,7 +270,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -5131,6 +5130,11 @@ static int wpa_supplicant_match_existing +@@ -5173,6 +5172,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -278,7 +282,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -5386,6 +5390,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -5428,6 +5432,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 394769e370..9dc0f2c393 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 -@@ -2863,6 +2863,10 @@ static int hostapd_config_fill(struct ho +@@ -2953,6 +2953,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 -@@ -664,6 +664,8 @@ struct hostapd_config { +@@ -681,6 +681,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 684de0e922..ccc9781fa0 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 -@@ -3654,7 +3654,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -3696,7 +3696,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/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch index cf2a2c108b..bdc1764578 100644 --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch @@ -1,6 +1,6 @@ --- a/src/drivers/drivers.mak +++ b/src/drivers/drivers.mak -@@ -36,7 +36,6 @@ NEED_SME=y +@@ -49,7 +49,6 @@ NEED_SME=y NEED_AP_MLME=y NEED_NETLINK=y NEED_LINUX_IOCTL=y @@ -8,7 +8,7 @@ NEED_RADIOTAP=y ifdef CONFIG_LIBNL32 -@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT +@@ -136,7 +135,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT CONFIG_WIRELESS_EXTENSION=y NEED_NETLINK=y NEED_LINUX_IOCTL=y @@ -16,7 +16,7 @@ endif ifdef CONFIG_DRIVER_NDIS -@@ -149,7 +147,6 @@ endif +@@ -162,7 +160,6 @@ endif ifdef CONFIG_WIRELESS_EXTENSION DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION DRV_WPA_OBJS += ../src/drivers/driver_wext.o @@ -24,7 +24,7 @@ endif ifdef NEED_NETLINK -@@ -162,6 +159,7 @@ endif +@@ -175,6 +172,7 @@ endif ifdef NEED_RFKILL DRV_OBJS += ../src/drivers/rfkill.o diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index e955479bf8..ebb12f69ff 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -3864,7 +3864,7 @@ static int nl80211_set_channel(struct i8 +@@ -4104,7 +4104,7 @@ static int nl80211_set_channel(struct i8 freq->freq, freq->ht_enabled, freq->vht_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); 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 3a0820313e..be10a413e6 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 @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2398,13 +2398,18 @@ wpa_driver_nl80211_finish_drv_init(struc +@@ -2490,13 +2490,18 @@ wpa_driver_nl80211_finish_drv_init(struc } @@ -22,7 +22,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL); } -@@ -2456,7 +2461,7 @@ static void wpa_driver_nl80211_deinit(st +@@ -2548,7 +2553,7 @@ static void wpa_driver_nl80211_deinit(st nl80211_remove_monitor_interface(drv); if (is_ap_interface(drv->nlmode)) @@ -31,7 +31,7 @@ if (drv->eapol_sock >= 0) { eloop_unregister_read_sock(drv->eapol_sock); -@@ -4463,8 +4468,7 @@ static void nl80211_teardown_ap(struct i +@@ -4703,8 +4708,7 @@ static void nl80211_teardown_ap(struct i nl80211_remove_monitor_interface(drv); else nl80211_mgmt_unsubscribe(bss, "AP teardown"); @@ -41,7 +41,7 @@ } -@@ -6473,8 +6477,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -6728,8 +6732,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -50,7 +50,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -6836,8 +6838,7 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -7091,8 +7093,7 @@ static int wpa_driver_nl80211_deinit_ap( struct wpa_driver_nl80211_data *drv = bss->drv; if (!is_ap_interface(drv->nlmode)) return -1; @@ -60,7 +60,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -6856,8 +6857,7 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -7111,8 +7112,7 @@ static int wpa_driver_nl80211_stop_ap(vo struct wpa_driver_nl80211_data *drv = bss->drv; if (!is_ap_interface(drv->nlmode)) return -1; 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 8c46001c01..83bec2a25c 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 -@@ -2505,6 +2562,8 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2620,6 +2677,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 -@@ -601,7 +601,13 @@ int hostapd_parse_csa_settings(const cha +@@ -624,7 +624,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 c599311ba5..03819b3372 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -34,7 +34,7 @@ -include .config -include $(if $(MULTICALL),../hostapd/.config) -@@ -114,6 +118,8 @@ OBJS_c += ../src/utils/common.o +@@ -115,6 +119,8 @@ OBJS_c += ../src/utils/common.o OBJS_c += ../src/common/cli.o OBJS += wmm_ac.o @@ -101,7 +101,7 @@ /* Configure default/group WEP keys for static WEP */ int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { -@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa +@@ -819,8 +868,12 @@ void wpa_supplicant_set_state(struct wpa wpas_p2p_completed(wpa_s); sme_sched_obss_scan(wpa_s, 1); @@ -114,7 +114,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -4748,6 +4801,20 @@ static int wpa_supplicant_init_iface(str +@@ -4790,6 +4843,20 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -135,7 +135,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -5041,6 +5108,11 @@ static void wpa_supplicant_deinit_iface( +@@ -5083,6 +5150,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -157,7 +157,7 @@ #include "drivers/driver.h" #include "eap_peer/eap.h" #include "wpa_supplicant_i.h" -@@ -288,6 +289,10 @@ static void calculate_update_time(const +@@ -290,6 +291,10 @@ static void calculate_update_time(const static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, struct os_reltime *fetch_time) { @@ -168,7 +168,7 @@ dst->flags = src->flags; os_memcpy(dst->bssid, src->bssid, ETH_ALEN); dst->freq = src->freq; -@@ -300,6 +305,15 @@ static void wpa_bss_copy_res(struct wpa_ +@@ -302,6 +307,15 @@ static void wpa_bss_copy_res(struct wpa_ dst->est_throughput = src->est_throughput; dst->snr = src->snr; @@ -224,7 +224,7 @@ break; --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -79,6 +79,10 @@ struct wpa_bss { +@@ -80,6 +80,10 @@ struct wpa_bss { u8 ssid[SSID_MAX_LEN]; /** Length of SSID */ size_t ssid_len; 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 c6e7cd60fb..1403fe0f43 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 @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -215,6 +215,9 @@ endif +@@ -220,6 +220,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2364,6 +2364,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2471,6 +2471,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) { -@@ -2405,6 +2406,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2512,6 +2513,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); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -875,6 +875,9 @@ ifdef CONFIG_MBO +@@ -891,6 +891,9 @@ ifdef CONFIG_MBO OBJS += ../src/ap/mbo_ap.o endif ifdef CONFIG_CTRL_IFACE @@ -42,7 +42,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta +@@ -1907,7 +1907,7 @@ static int wpa_supplicant_ctrl_iface_sta pos += ret; } @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -8684,6 +8684,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9032,6 +9032,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) { -@@ -8691,6 +8692,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9039,6 +9040,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); -@@ -9161,6 +9163,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9517,6 +9519,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) { -@@ -9169,12 +9172,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9525,12 +9528,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); @@ -93,15 +93,15 @@ reply_len = -1; --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -24,6 +24,7 @@ - #include "ap_drv_ops.h" +@@ -25,6 +25,7 @@ #include "mbo_ap.h" + #include "taxonomy.h" +#ifdef CONFIG_CTRL_IFACE_MIB static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd, struct sta_info *sta, -@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -250,6 +251,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -111,7 +111,7 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2442,6 +2442,7 @@ static const char * bool_txt(Boolean val +@@ -2490,6 +2490,7 @@ static const char * bool_txt(Boolean val return val ? "TRUE" : "FALSE"; } @@ -119,7 +119,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2617,6 +2618,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2665,6 +2666,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -129,7 +129,7 @@ static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val +@@ -3544,6 +3544,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -137,7 +137,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -3688,7 +3689,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -148,7 +148,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2252,6 +2252,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -157,7 +157,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2335,6 +2337,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch index 33a17d0001..7f147aec1d 100644 --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -1246,6 +1246,31 @@ u32 wpa_akm_to_suite(int akm) +@@ -1445,6 +1445,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -1253,8 +1278,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -1452,8 +1477,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; 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 cc7747abe1..eba79d28c4 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,6 @@ --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -382,7 +382,6 @@ static int hostapd_cli_cmd_sa_query(stru +@@ -447,7 +447,6 @@ static int hostapd_cli_cmd_sa_query(stru #endif /* CONFIG_IEEE80211W */ @@ -8,7 +8,7 @@ static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -608,7 +607,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -673,7 +672,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -16,7 +16,7 @@ static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1275,7 +1273,6 @@ static const struct hostapd_cli_cmd host +@@ -1367,7 +1365,6 @@ static const struct hostapd_cli_cmd host { "sa_query", hostapd_cli_cmd_sa_query, NULL, " = send SA Query to a station" }, #endif /* CONFIG_IEEE80211W */ @@ -24,7 +24,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, -@@ -1300,7 +1297,6 @@ static const struct hostapd_cli_cmd host +@@ -1392,7 +1389,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 c6053f0953..1aeec5d053 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 @@ -21,8 +21,8 @@ Signed-hostap: Antonio Quartulli +#include "ap/sta_info.h" #include "common/defs.h" #include "common/ieee802_11_defs.h" - #include "utils/list.h" -@@ -587,6 +588,9 @@ struct wpa_driver_associate_params { + #ifdef CONFIG_MACSEC +@@ -605,6 +606,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -42,8 +42,8 @@ Signed-hostap: Antonio Quartulli #include "config.h" -@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi - #endif /* CONFIG_MESH */ +@@ -1891,6 +1892,97 @@ static char * wpa_config_write_mka_ckn(c + #endif /* CONFIG_MACSEC */ +static int wpa_config_parse_mcast_rate(const struct parse_data *data, @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2048,6 +2140,9 @@ static const struct parse_data ssid_fiel +@@ -2123,6 +2215,9 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -149,7 +149,7 @@ Signed-hostap: Antonio Quartulli + { FUNC(mcast_rate) }, #ifdef CONFIG_MACSEC { INT_RANGE(macsec_policy, 0, 1) }, - #endif /* CONFIG_MACSEC */ + { INT_RANGE(macsec_integ_only, 0, 1) }, --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -10,8 +10,10 @@ @@ -175,7 +175,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 -@@ -2527,6 +2527,13 @@ static void wpas_start_assoc_cb(struct w +@@ -2561,6 +2561,13 @@ 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/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index 591543b89c..6db61333e1 100644 --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4722,7 +4722,7 @@ static int wpa_driver_nl80211_ibss(struc +@@ -4962,7 +4962,7 @@ static int wpa_driver_nl80211_ibss(struc struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -4749,6 +4749,37 @@ retry: +@@ -4989,6 +4989,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch index 993b6de0b5..c4b48a938e 100644 --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch @@ -16,7 +16,7 @@ Signed-off-by: Antonio Quartulli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -590,6 +590,8 @@ struct wpa_driver_associate_params { +@@ -608,6 +608,8 @@ struct wpa_driver_associate_params { unsigned char rates[WLAN_SUPP_RATES_MAX]; int mcast_rate; @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli * bssid_hint - BSSID of a proposed AP --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4780,6 +4780,22 @@ retry: +@@ -5020,6 +5020,22 @@ retry: nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); } @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli goto fail; --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat +@@ -1923,6 +1923,71 @@ static char * wpa_config_write_mcast_rat } #endif /* NO_CONFIG_WRITE */ @@ -124,14 +124,14 @@ Signed-off-by: Antonio Quartulli static int wpa_config_parse_rates(const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) -@@ -2143,6 +2208,7 @@ static const struct parse_data ssid_fiel +@@ -2218,6 +2283,7 @@ static const struct parse_data ssid_fiel { INT_RANGE(fixed_freq, 0, 1) }, { FUNC(rates) }, { FUNC(mcast_rate) }, + { FUNC(htmode) }, #ifdef CONFIG_MACSEC { INT_RANGE(macsec_policy, 0, 1) }, - #endif /* CONFIG_MACSEC */ + { INT_RANGE(macsec_integ_only, 0, 1) }, --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -723,6 +723,8 @@ struct wpa_ssid { @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli /** --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2534,6 +2534,8 @@ static void wpas_start_assoc_cb(struct w +@@ -2568,6 +2568,8 @@ static void wpas_start_assoc_cb(struct w i++; } params.mcast_rate = ssid->mcast_rate; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index d64ab1e85f..e758afb17d 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -160,6 +160,11 @@ OBJS += ../src/common/hw_features_common +@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common OBJS += ../src/eapol_auth/eapol_auth_sm.o @@ -22,7 +22,7 @@ struct wpa_ctrl_dst; struct radius_server_data; -@@ -118,6 +119,7 @@ struct hostapd_data { +@@ -119,6 +120,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -30,7 +30,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -323,6 +325,8 @@ struct hostapd_iface { +@@ -328,6 +330,8 @@ struct hostapd_iface { struct hostapd_config *conf; char phy[16]; /* Name of the PHY (radio) */ @@ -49,7 +49,7 @@ iapp_deinit(hapd->iapp); hapd->iapp = NULL; accounting_deinit(hapd); -@@ -1140,6 +1141,8 @@ static int hostapd_setup_bss(struct host +@@ -1142,6 +1143,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 +66,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->conf->channel) { #ifdef NEED_AP_MLME -@@ -1845,6 +1849,7 @@ dfs_offload: +@@ -1844,6 +1848,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -74,7 +74,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); #ifdef CONFIG_FST -@@ -2279,6 +2284,7 @@ void hostapd_interface_deinit_free(struc +@@ -2292,6 +2297,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; @@ -84,7 +84,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta +@@ -1293,7 +1293,8 @@ void ieee802_11_finish_fils_auth(struct static void handle_auth(struct hostapd_data *hapd, @@ -94,7 +94,7 @@ { u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; -@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d +@@ -1309,6 +1310,11 @@ static void handle_auth(struct hostapd_d char *identity = NULL; char *radius_cui = NULL; u16 seq_ctrl; @@ -106,7 +106,7 @@ os_memset(&vlan_id, 0, sizeof(vlan_id)); -@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d +@@ -1466,6 +1472,14 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -121,7 +121,7 @@ if (res == HOSTAPD_ACL_PENDING) { wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR " waiting for an external authentication", -@@ -2052,13 +2066,18 @@ static u16 send_assoc_resp(struct hostap +@@ -2391,7 +2405,7 @@ static u16 send_assoc_resp(struct hostap static void handle_assoc(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -130,9 +130,10 @@ { u16 capab_info, listen_interval, seq_ctrl, fc; u16 resp = WLAN_STATUS_SUCCESS, reply_res; - const u8 *pos; +@@ -2399,6 +2413,11 @@ static void handle_assoc(struct hostapd_ int left, i; struct sta_info *sta; + u8 *tmp = NULL; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_ASSOC_REQ, + .mgmt_frame = mgmt, @@ -141,7 +142,7 @@ if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : sizeof(mgmt->u.assoc_req))) { -@@ -2178,6 +2197,13 @@ static void handle_assoc(struct hostapd_ +@@ -2518,6 +2537,13 @@ static void handle_assoc(struct hostapd_ } #endif /* CONFIG_MBO */ @@ -155,7 +156,7 @@ /* * sta->capability is used in check_assoc_ies() for RRM enabled * capability element. -@@ -2654,7 +2680,7 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -3023,7 +3049,7 @@ int ieee802_11_mgmt(struct hostapd_data if (stype == WLAN_FC_STYPE_PROBE_REQ) { @@ -164,7 +165,7 @@ return 1; } -@@ -2672,17 +2698,17 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -3041,17 +3067,17 @@ int ieee802_11_mgmt(struct hostapd_data switch (stype) { case WLAN_FC_STYPE_AUTH: wpa_printf(MSG_DEBUG, "mgmt::auth"); @@ -187,7 +188,7 @@ case WLAN_FC_STYPE_DISASSOC: --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface * +@@ -702,7 +702,7 @@ void sta_track_claim_taxonomy_info(struc void handle_probe_req(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -196,7 +197,7 @@ { u8 *resp; struct ieee802_11_elems elems; -@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat +@@ -711,9 +711,15 @@ void handle_probe_req(struct hostapd_dat size_t i, resp_len; int noack; enum ssid_match_result res; @@ -212,7 +213,7 @@ if (len < IEEE80211_HDRLEN) return; -@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat +@@ -880,6 +886,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ diff --git a/package/network/services/igmpproxy/Makefile b/package/network/services/igmpproxy/Makefile index 8d4da5ca9e..d07fe66998 100644 --- a/package/network/services/igmpproxy/Makefile +++ b/package/network/services/igmpproxy/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/igmpproxy -PKG_MD5SUM:=c56f41ec195bc1fe016369bf74efc5a1 +PKG_HASH:=ee18ff3d8c3ae3a29dccb7e5eedf332337330020168bd95a11cece8d7d7ee6ae PKG_MAINTAINER:=Felix Fietkau include $(INCLUDE_DIR)/package.mk diff --git a/package/network/services/ipset-dns/Makefile b/package/network/services/ipset-dns/Makefile index f24d6ef63a..2adc9fe031 100644 --- a/package/network/services/ipset-dns/Makefile +++ b/package/network/services/ipset-dns/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ipset-dns -PKG_VERSION:=2013-05-03 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=http://git.zx2c4.com/ipset-dns -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2013-05-03 PKG_SOURCE_VERSION:=6be3afd819a86136b51c5ae722ab48266187155b -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=9deca25a4602936938611d21d891f06685e109626b9eda7f84aa2f0af7aba092 +PKG_MIRROR_HASH:=4e34943b547babe705c2fad295ee24a5ee0c93ca03e2a9cdeaf323150f97e60b PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/lldpd/Config.in b/package/network/services/lldpd/Config.in index 93d84e29ea..ec6990a76c 100644 --- a/package/network/services/lldpd/Config.in +++ b/package/network/services/lldpd/Config.in @@ -51,4 +51,8 @@ config LLDPD_WITH_JSON prompt "Enable JSON output for the LLDP Command-Line Interface" default n +config LLDPD_WITH_SNMP + bool + default n + prompt "Enable the use of SNMP" endmenu diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index ff15057aa5..de7de03cc8 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://media.luffy.cx/files/lldpd -PKG_MD5SUM:=e9585c52f14808f03f6b6c3a9163c95b542a47b18abe002992b155d143a1a247 +PKG_HASH:=e9585c52f14808f03f6b6c3a9163c95b542a47b18abe002992b155d143a1a247 -PKG_MAINTAINER:=Jo-Philipp Wich +PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC PKG_FIXUP:=autoreconf @@ -31,7 +31,7 @@ define Package/lldpd SUBMENU:=Routing and Redirection TITLE:=Link Layer Discovery Protocol daemon URL:=https://github.com/vincentbernat/lldpd/wiki - DEPENDS:=+libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c + DEPENDS:=+libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c +LLDPD_WITH_SNMP:libnetsnmp USERID:=lldp=121:lldp=129 MENU:=1 endef @@ -78,6 +78,9 @@ endif ifneq ($(CONFIG_LLDPD_WITH_SONMP),y) sed -i -e '/sonmp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd endif +ifneq ($(CONFIG_LLDPD_WITH_SNMP),y) + sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd +endif endef define Package/lldpd/conffiles @@ -103,7 +106,8 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \ $(if $(CONFIG_LLDPD_WITH_CUSTOM),,--disable-custom) \ $(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \ - $(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c,--with-json=no) + $(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c,--with-json=no) \ + $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) $(eval $(call BuildPackage,lldpd)) diff --git a/package/network/services/lldpd/files/lldpd.config b/package/network/services/lldpd/files/lldpd.config index 92ab42116b..d2b3d15450 100644 --- a/package/network/services/lldpd/files/lldpd.config +++ b/package/network/services/lldpd/files/lldpd.config @@ -3,6 +3,8 @@ config lldpd config option enable_fdp 1 option enable_sonmp 1 option enable_edp 1 + + option agentxsocket /var/run/agentx.sock option lldp_class 4 option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4" diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 4e9efcae0d..4495551567 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -57,6 +57,7 @@ start_service() { local lldp_class local lldp_location local readonly_mode + local agentxsocket config_load 'lldpd' config_get_bool enable_cdp 'config' 'enable_cdp' 0 @@ -66,6 +67,7 @@ start_service() { config_get lldp_class 'config' 'lldp_class' config_get lldp_location 'config' 'lldp_location' config_get_bool readonly_mode 'config' 'readonly_mode' 0 + config_get agentxsocket 'config' 'agentxsocket' mkdir -p /var/run/lldp chown lldp:lldp /var/run/lldp @@ -83,6 +85,7 @@ start_service() { [ $enable_edp -gt 0 ] && procd_append_param command '-e' [ $readonly_mode -gt 0 ] && procd_append_param command '-r' [ -n "$lldp_class" ] && procd_append_param command -M "$lldp_class" + [ -n "$agentxsocket" ] && procd_append_param command -x -X "$agentxsocket" # set auto respawn behavior procd_set_param respawn diff --git a/package/network/services/mdns/Makefile b/package/network/services/mdns/Makefile index 319fc80398..b36176e1ae 100644 --- a/package/network/services/mdns/Makefile +++ b/package/network/services/mdns/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mdns -PKG_VERSION:=2016-05-23 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL=$(LEDE_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=8a70b2b47dd328f8180e5ecaa7bdc817f574a81b -PKG_MIRROR_MD5SUM:=f40f67c68ee62bd1967a5d32c3eb5601a7927c7ebd52da27029019c2fe9307d3 +PKG_SOURCE_DATE:=2016-12-19 +PKG_SOURCE_VERSION:=be8ae8d0b5f2e8651edf0cc8f35916fc4b71d1ac +PKG_MIRROR_HASH:=fd6e8b17407b9e6dc96f485c62f54e02a0ab27b5878c271f95749495970dacc2 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index f6ce26c150..6813a0fdef 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd -PKG_VERSION:=2016-11-21 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=git://git.lede-project.org/project/odhcpd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=5f425ed1e5f92397e27ec4f44820b6ef677b8134 -PKG_MIRROR_MD5SUM:=64ef09adbb88e1a419a689985dbc784c94003b247216d6e188e81b7f2807b032 +PKG_SOURCE_DATE:=2017-01-06 +PKG_SOURCE_VERSION:=ef3c5632c100fda0fa463a3ed56ff926f3f86b20 +PKG_MIRROR_HASH:=a870ae200dd4b0776f18f19051f75a6654108e8f25044d37c6d0856193c3ccf0 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/odhcpd/files/odhcpd-update b/package/network/services/odhcpd/files/odhcpd-update index e17cd0bfff..9bc7abcc1c 100755 --- a/package/network/services/odhcpd/files/odhcpd-update +++ b/package/network/services/odhcpd/files/odhcpd-update @@ -1,5 +1,6 @@ #!/bin/sh -# Make dnsmasq reread hostfile +# Make dnsmasq reread hostfile by sending SIGHUP signal -pid=$(pidof dnsmasq) -[ "$(readlink /proc/$pid/exe)" = "/usr/sbin/dnsmasq" ] && kill -SIGHUP $pid +. $IPKG_INSTROOT/lib/functions/procd.sh + +procd_send_signal dnsmasq diff --git a/package/network/services/odhcpd/files/odhcpd.init b/package/network/services/odhcpd/files/odhcpd.init index bbbec9c232..e05c3860c4 100644 --- a/package/network/services/odhcpd/files/odhcpd.init +++ b/package/network/services/odhcpd/files/odhcpd.init @@ -12,7 +12,7 @@ start_service() { } reload_service() { - killall -HUP odhcpd + procd_send_signal odhcpd } service_triggers() diff --git a/package/network/services/omcproxy/Makefile b/package/network/services/omcproxy/Makefile index aa1586a1d4..d20c73d60c 100644 --- a/package/network/services/omcproxy/Makefile +++ b/package/network/services/omcproxy/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=omcproxy -PKG_VERSION:=2015-08-24 PKG_RELEASE:=3 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/sbyx/omcproxy.git PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2015-08-24 PKG_SOURCE_VERSION:=8de9fa84e018e152e45c342f10b5b5140b63e4b1 -PKG_MIRROR_MD5SUM:=e79dacf493155ebf7e0d9954dd007bb485d48819907bef6be4cda21bab769443 +PKG_MIRROR_HASH:=2c9768170235f91a48252c83ef944e6ed925c167c8fe30c0dacf42c3daba86fc PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=Apache-2.0 diff --git a/package/network/services/openvpn-easy-rsa/Makefile b/package/network/services/openvpn-easy-rsa/Makefile index d0ef3ef555..5b7d9be213 100644 --- a/package/network/services/openvpn-easy-rsa/Makefile +++ b/package/network/services/openvpn-easy-rsa/Makefile @@ -9,16 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvpn-easy-rsa -PKG_REV:=ff5bfd1dd8e548cb24d302742af3894f893ef92f -PKG_VERSION:=2013-01-30 PKG_RELEASE=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/OpenVPN/easy-rsa.git -PKG_SOURCE_VERSION:=$(PKG_REV) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.xz -PKG_MIRROR_MD5SUM:=cdb0d3f1fb828e4026b6fb297303d5ccb9bc4e1faccbb6a7687518655b178875 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2013-01-30 +PKG_SOURCE_VERSION:=ff5bfd1dd8e548cb24d302742af3894f893ef92f +PKG_MIRROR_HASH:=c87704b3906a0c14f51c6677151a9389f698523c7ec07f7c75489ca31786f128 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/services/openvpn/Config-polarssl.in b/package/network/services/openvpn/Config-mbedtls.in similarity index 58% rename from package/network/services/openvpn/Config-polarssl.in rename to package/network/services/openvpn/Config-mbedtls.in index 26692ce04d..c1c8c7ac10 100644 --- a/package/network/services/openvpn/Config-polarssl.in +++ b/package/network/services/openvpn/Config-mbedtls.in @@ -1,62 +1,66 @@ -if PACKAGE_openvpn-polarssl +if PACKAGE_openvpn-mbedtls -config OPENVPN_polarssl_ENABLE_LZO +config OPENVPN_mbedtls_ENABLE_LZO bool "Enable LZO compression support" default y -config OPENVPN_polarssl_ENABLE_X509_ALT_USERNAME +config OPENVPN_mbedtls_ENABLE_LZ4 + bool "Enable LZ4 compression support" + default y + +config OPENVPN_mbedtls_ENABLE_X509_ALT_USERNAME bool "Enable the --x509-username-field feature" default n -config OPENVPN_polarssl_ENABLE_SERVER +config OPENVPN_mbedtls_ENABLE_SERVER bool "Enable server support (otherwise only client mode is support)" default y -#config OPENVPN_polarssl_ENABLE_EUREPHIA +#config OPENVPN_mbedtls_ENABLE_EUREPHIA # bool "Enable support for the eurephia plug-in" # default n -config OPENVPN_polarssl_ENABLE_MANAGEMENT +config OPENVPN_mbedtls_ENABLE_MANAGEMENT bool "Enable management server support" default n -#config OPENVPN_polarssl_ENABLE_PKCS11 +#config OPENVPN_mbedtls_ENABLE_PKCS11 # bool "Enable pkcs11 support" # default n -config OPENVPN_polarssl_ENABLE_HTTP +config OPENVPN_mbedtls_ENABLE_HTTP bool "Enable HTTP proxy support" default y -config OPENVPN_polarssl_ENABLE_SOCKS +config OPENVPN_mbedtls_ENABLE_SOCKS bool "Enable SOCKS proxy support" default y -config OPENVPN_polarssl_ENABLE_FRAGMENT +config OPENVPN_mbedtls_ENABLE_FRAGMENT bool "Enable internal fragmentation support (--fragment)" default y -config OPENVPN_polarssl_ENABLE_MULTIHOME +config OPENVPN_mbedtls_ENABLE_MULTIHOME bool "Enable multi-homed UDP server support (--multihome)" default y -config OPENVPN_polarssl_ENABLE_PORT_SHARE +config OPENVPN_mbedtls_ENABLE_PORT_SHARE bool "Enable TCP server port-share support (--port-share)" default y -config OPENVPN_polarssl_ENABLE_DEF_AUTH +config OPENVPN_mbedtls_ENABLE_DEF_AUTH bool "Enable deferred authentication" default y -config OPENVPN_polarssl_ENABLE_PF +config OPENVPN_mbedtls_ENABLE_PF bool "Enable internal packet filter" default y -config OPENVPN_polarssl_ENABLE_IPROUTE2 +config OPENVPN_mbedtls_ENABLE_IPROUTE2 bool "Enable support for iproute2" default n -config OPENVPN_polarssl_ENABLE_SMALL +config OPENVPN_mbedtls_ENABLE_SMALL bool "Enable size optimization" default y help diff --git a/package/network/services/openvpn/Config-nossl.in b/package/network/services/openvpn/Config-nossl.in index 3eaa228882..199cda0159 100644 --- a/package/network/services/openvpn/Config-nossl.in +++ b/package/network/services/openvpn/Config-nossl.in @@ -4,6 +4,10 @@ config OPENVPN_nossl_ENABLE_LZO bool "Enable LZO compression support" default y +config OPENVPN_nossl_ENABLE_LZ4 + bool "Enable LZ4 compression support" + default y + config OPENVPN_nossl_ENABLE_SERVER bool "Enable server support (otherwise only client mode is support)" default y diff --git a/package/network/services/openvpn/Config-openssl.in b/package/network/services/openvpn/Config-openssl.in index ac4c774b03..a2bc3de2a2 100644 --- a/package/network/services/openvpn/Config-openssl.in +++ b/package/network/services/openvpn/Config-openssl.in @@ -4,6 +4,10 @@ config OPENVPN_openssl_ENABLE_LZO bool "Enable LZO compression support" default y +config OPENVPN_openssl_ENABLE_LZ4 + bool "Enable LZ4 compression support" + default y + config OPENVPN_openssl_ENABLE_X509_ALT_USERNAME bool "Enable the --x509-username-field feature" default n diff --git a/package/network/services/openvpn/Makefile b/package/network/services/openvpn/Makefile index 05f56ad691..ab506d427c 100644 --- a/package/network/services/openvpn/Makefile +++ b/package/network/services/openvpn/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvpn -PKG_VERSION:=2.3.13 +PKG_VERSION:=2.4.0 PKG_RELEASE:=1 PKG_SOURCE_URL:=http://swupdate.openvpn.net/community/releases PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MD5SUM:=9cde0c8000fd32d5275adb55f8bb1d8ba429ff3de35f60a36e81f3859b7537e0 +PKG_HASH:=6f23ba49a1dbeb658f49c7ae17d9ea979de6d92c7357de3d55cd4525e1b2f87e PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) @@ -37,8 +37,8 @@ define Package/openvpn/Default MAINTAINER:=Mirko Vogt endef -Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+libopenssl) -Package/openvpn-polarssl=$(call Package/openvpn/Default,polarssl,PolarSSL,+libpolarssl) +Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl) +Package/openvpn-mbedtls=$(call Package/openvpn/Default,mbedtls,mbedTLS,+PACKAGE_openvpn-mbedtls:libmbedtls) Package/openvpn-nossl=$(call Package/openvpn/Default,nossl,plaintext (no SSL)) define Package/openvpn/config/Default @@ -46,11 +46,11 @@ define Package/openvpn/config/Default endef Package/openvpn-openssl/config=$(call Package/openvpn/config/Default,openssl) -Package/openvpn-polarssl/config=$(call Package/openvpn/config/Default,polarssl) +Package/openvpn-mbedtls/config=$(call Package/openvpn/config/Default,mbedtls) Package/openvpn-nossl/config=$(call Package/openvpn/config/Default,nossl) -ifeq ($(BUILD_VARIANT),polarssl) -CONFIG_OPENVPN_POLARSSL:=y +ifeq ($(BUILD_VARIANT),mbedtls) +CONFIG_OPENVPN_MBEDTLS:=y endif ifeq ($(BUILD_VARIANT),openssl) CONFIG_OPENVPN_OPENSSL:=y @@ -65,6 +65,9 @@ CONFIGURE_VARS += \ IPROUTE=/sbin/ip \ NETSTAT=/sbin/netstat +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_LDFLAGS += -Wl,--gc-sections + define Build/Configure $(call Build/Configure/Default, \ $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SMALL),--enable-small) \ @@ -74,6 +77,7 @@ define Build/Configure --disable-debug \ --disable-pkcs11 \ $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZO),--enable,--disable)-lzo \ + $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZ4),--enable,--disable)-lz4 \ $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_X509_ALT_USERNAME),enable,disable-x509-alt-username)-ssl \ $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SERVER),--enable,--disable)-server \ $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MANAGEMENT),--enable,--disable)-management \ @@ -86,7 +90,7 @@ define Build/Configure $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PF),--enable,--disable)-pf \ $(if $(CONFIG_OPENVPN_NOSSL),--disable-ssl --disable-crypto,--enable-ssl --enable-crypto) \ $(if $(CONFIG_OPENVPN_OPENSSL),--with-crypto-library=openssl) \ - $(if $(CONFIG_OPENVPN_POLARSSL),--with-crypto-library=polarssl) \ + $(if $(CONFIG_OPENVPN_MBEDTLS),--with-crypto-library=mbedtls) \ ) endef @@ -119,5 +123,5 @@ define Package/openvpn-$(BUILD_VARIANT)/install endef $(eval $(call BuildPackage,openvpn-openssl)) -$(eval $(call BuildPackage,openvpn-polarssl)) +$(eval $(call BuildPackage,openvpn-mbedtls)) $(eval $(call BuildPackage,openvpn-nossl)) diff --git a/package/network/services/openvpn/files/openvpn.config b/package/network/services/openvpn/files/openvpn.config index 3e053c36a9..1fd846f558 100644 --- a/package/network/services/openvpn/files/openvpn.config +++ b/package/network/services/openvpn/files/openvpn.config @@ -241,7 +241,11 @@ config openvpn sample_server # Enable compression on the VPN link. # If you enable it here, you must also # enable it in the client config file. - option comp_lzo yes + # LZ4 requires OpenVPN 2.4+ client and server +# option compress lz4 + # LZO is compatible with most OpenVPN versions + # (set "compress lzo" on 2.4+ clients, and "comp-lzo yes" on older clients) + option compress lzo # The maximum number of concurrently connected # clients we want to allow. @@ -391,7 +395,10 @@ config openvpn sample_client # Enable compression on the VPN link. # Don't enable this unless it is also # enabled in the server config file. - option comp_lzo yes + # LZ4 requires OpenVPN 2.4+ on server and client +# option compress lz4 + # LZO is compatible with most OpenVPN versions + option compress lzo # Set log file verbosity. option verb 3 diff --git a/package/network/services/openvpn/files/openvpn.init b/package/network/services/openvpn/files/openvpn.init index 4c8f77f92e..0fcdc7eea0 100644 --- a/package/network/services/openvpn/files/openvpn.init +++ b/package/network/services/openvpn/files/openvpn.init @@ -42,7 +42,8 @@ append_params() { config_get v "$s" "$p" IFS="$LIST_SEP" for v in $v; do - [ -n "$v" ] && append_param "$s" "$p" && echo " $v" >> "/var/etc/openvpn-$s.conf" + [ -n "$v" ] && [ "$p" != "push" ] && append_param "$s" "$p" && echo " $v" >> "/var/etc/openvpn-$s.conf" + [ -n "$v" ] && [ "$p" == "push" ] && append_param "$s" "$p" && echo " \"$v\"" >> "/var/etc/openvpn-$s.conf" done unset IFS done diff --git a/package/network/services/openvpn/patches/001-reproducible-remove_DATE.patch b/package/network/services/openvpn/patches/001-reproducible-remove_DATE.patch index 3ceef6f0ff..5f23994b5c 100644 --- a/package/network/services/openvpn/patches/001-reproducible-remove_DATE.patch +++ b/package/network/services/openvpn/patches/001-reproducible-remove_DATE.patch @@ -1,10 +1,10 @@ --- a/src/openvpn/options.c +++ b/src/openvpn/options.c -@@ -102,7 +102,6 @@ const char title_string[] = - " [MH]" +@@ -107,7 +107,6 @@ const char title_string[] = + #ifdef HAVE_AEAD_CIPHER_MODES + " [AEAD]" #endif - " [IPv6]" -- " built on " __DATE__ +- " built on " __DATE__ ; #ifndef ENABLE_SMALL diff --git a/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch b/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch new file mode 100644 index 0000000000..3b8248dd60 --- /dev/null +++ b/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch @@ -0,0 +1,11 @@ +--- a/src/openvpn/ssl_mbedtls.c ++++ b/src/openvpn/ssl_mbedtls.c +@@ -1333,7 +1333,7 @@ const char * + get_ssl_library_version(void) + { + static char mbedtls_version[30]; +- unsigned int pv = mbedtls_version_get_number(); ++ unsigned int pv = MBEDTLS_VERSION_NUMBER; + sprintf( mbedtls_version, "mbed TLS %d.%d.%d", + (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff ); + return mbedtls_version; diff --git a/package/network/services/openvpn/patches/100-polarssl-disable-runtime-version-check.patch b/package/network/services/openvpn/patches/100-polarssl-disable-runtime-version-check.patch deleted file mode 100644 index c7955c2460..0000000000 --- a/package/network/services/openvpn/patches/100-polarssl-disable-runtime-version-check.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/openvpn/ssl_polarssl.c -+++ b/src/openvpn/ssl_polarssl.c -@@ -1156,7 +1156,7 @@ const char * - get_ssl_library_version(void) - { - static char polar_version[30]; -- unsigned int pv = version_get_number(); -+ unsigned int pv = POLARSSL_VERSION_NUMBER; - sprintf( polar_version, "PolarSSL %d.%d.%d", - (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff ); - return polar_version; diff --git a/package/network/services/openvpn/patches/101-backport_upstream_polarssl_debug_call.patch b/package/network/services/openvpn/patches/101-backport_upstream_polarssl_debug_call.patch deleted file mode 100644 index 2155a4c79b..0000000000 --- a/package/network/services/openvpn/patches/101-backport_upstream_polarssl_debug_call.patch +++ /dev/null @@ -1,33 +0,0 @@ -openvpn: fix build without POLARSSL_DEBUG_C - -Backport of upstream master commit -b63f98633dbe2ca92cd43fc6f8597ab283a600bf. - -Signed-off-by: Magnus Kroken - -From b63f98633dbe2ca92cd43fc6f8597ab283a600bf Mon Sep 17 00:00:00 2001 -From: Steffan Karger -Date: Tue, 14 Jun 2016 22:00:03 +0200 -Subject: [PATCH] mbedtls: don't set debug threshold if compiled without - MBEDTLS_DEBUG_C - -For targets with space constraints, one might want to compile mbed TLS -without MBEDTLS_DEBUG_C defined, to save some tens of kilobytes. Make -sure OpenVPN still compiles if that is the case. - -Signed-off-by: Steffan Karger -Acked-by: Gert Doering -Message-Id: <1465934403-22226-1-git-send-email-steffan@karger.me> -URL: http://article.gmane.org/gmane.network.openvpn.devel/11922 -Signed-off-by: Gert Doering ---- a/src/openvpn/ssl_polarssl.c -+++ b/src/openvpn/ssl_polarssl.c -@@ -747,7 +747,9 @@ void key_state_ssl_init(struct key_state - if (polar_ok(ssl_init(ks_ssl->ctx))) - { - /* Initialise SSL context */ -+ #ifdef POLARSSL_DEBUG_C - debug_set_threshold(3); -+ #endif - ssl_set_dbg (ks_ssl->ctx, my_debug, NULL); - ssl_set_endpoint (ks_ssl->ctx, ssl_ctx->endpoint); diff --git a/package/network/services/openvpn/patches/200-small_build_enable_occ.patch b/package/network/services/openvpn/patches/200-small_build_enable_occ.patch index eef4da2d26..96276d4723 100644 --- a/package/network/services/openvpn/patches/200-small_build_enable_occ.patch +++ b/package/network/services/openvpn/patches/200-small_build_enable_occ.patch @@ -1,6 +1,6 @@ --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h -@@ -602,9 +602,7 @@ socket_defined (const socket_descriptor_ +@@ -589,9 +589,7 @@ socket_defined (const socket_descriptor_ /* * Should we include OCC (options consistency check) code? */ diff --git a/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch b/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch new file mode 100644 index 0000000000..67191076d5 --- /dev/null +++ b/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch @@ -0,0 +1,41 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -1014,37 +1014,14 @@ dnl + AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4]) + AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4]) + if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then +- AC_CHECKING([for LZ4 Library and Header files]) +- havelz4lib=1 + +- # if LZ4_LIBS is set, we assume it will work, otherwise test +- if test -z "${LZ4_LIBS}"; then +- AC_CHECK_LIB(lz4, LZ4_compress, +- [ LZ4_LIBS="-llz4" ], +- [ +- AC_MSG_RESULT([LZ4 library not found.]) +- havelz4lib=0 +- ]) +- fi ++ AC_MSG_RESULT([Using LZ4 library in src/compat/compat-lz4.*]) ++ AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/]) ++ LZ4_LIBS="" + +- saved_CFLAGS="${CFLAGS}" +- CFLAGS="${CFLAGS} ${LZ4_CFLAGS}" +- AC_CHECK_HEADERS(lz4.h, +- , +- [ +- AC_MSG_RESULT([LZ4 headers not found.]) +- havelz4lib=0 +- ]) +- +- if test $havelz4lib = 0 ; then +- AC_MSG_RESULT([LZ4 library or header not found, using version in src/compat/compat-lz4.*]) +- AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/]) +- LZ4_LIBS="" +- fi + OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}" + OPTIONAL_LZ4_LIBS="${LZ4_LIBS}" + AC_DEFINE(ENABLE_LZ4, 1, [Enable LZ4 compression library]) +- CFLAGS="${saved_CFLAGS}" + fi diff --git a/package/network/services/openvpn/patches/220-disable_des.patch b/package/network/services/openvpn/patches/220-disable_des.patch new file mode 100644 index 0000000000..cd930709cb --- /dev/null +++ b/package/network/services/openvpn/patches/220-disable_des.patch @@ -0,0 +1,81 @@ +--- a/src/openvpn/syshead.h ++++ b/src/openvpn/syshead.h +@@ -594,11 +594,11 @@ socket_defined(const socket_descriptor_t + /* + * Should we include NTLM proxy functionality + */ +-#if defined(ENABLE_CRYPTO) +-#define NTLM 1 +-#else ++//#if defined(ENABLE_CRYPTO) ++//#define NTLM 1 ++//#else + #define NTLM 0 +-#endif ++//#endif + + /* + * Should we include proxy digest auth functionality +--- a/src/openvpn/crypto_mbedtls.c ++++ b/src/openvpn/crypto_mbedtls.c +@@ -320,6 +320,7 @@ int + key_des_num_cblocks(const mbedtls_cipher_info_t *kt) + { + int ret = 0; ++#ifdef MBEDTLS_DES_C + if (kt->type == MBEDTLS_CIPHER_DES_CBC) + { + ret = 1; +@@ -332,6 +333,7 @@ key_des_num_cblocks(const mbedtls_cipher + { + ret = 3; + } ++#endif + + dmsg(D_CRYPTO_DEBUG, "CRYPTO INFO: n_DES_cblocks=%d", ret); + return ret; +@@ -340,6 +342,7 @@ key_des_num_cblocks(const mbedtls_cipher + bool + key_des_check(uint8_t *key, int key_len, int ndc) + { ++#ifdef MBEDTLS_DES_C + int i; + struct buffer b; + +@@ -368,11 +371,15 @@ key_des_check(uint8_t *key, int key_len, + + err: + return false; ++#else ++ return true; ++#endif + } + + void + key_des_fixup(uint8_t *key, int key_len, int ndc) + { ++#ifdef MBEDTLS_DES_C + int i; + struct buffer b; + +@@ -387,6 +394,7 @@ key_des_fixup(uint8_t *key, int key_len, + } + mbedtls_des_key_set_parity(key); + } ++#endif + } + + /* +@@ -698,10 +706,12 @@ cipher_des_encrypt_ecb(const unsigned ch + unsigned char *src, + unsigned char *dst) + { ++#ifdef MBEDTLS_DES_C + mbedtls_des_context ctx; + + ASSERT(mbed_ok(mbedtls_des_setkey_enc(&ctx, key))); + ASSERT(mbed_ok(mbedtls_des_crypt_ecb(&ctx, src, dst))); ++#endif + } + + diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 2b78761ea5..8b58c1c06f 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/ -PKG_MD5SUM:=78818f40e6d33a1d1de68a1551f6595a +PKG_HASH:=02e0a3dd3e4799e33103f70ec7df75348c8540966ee7c948e4ed8a42bbccfb30 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause @@ -172,6 +172,9 @@ $(call Build/Configure/Default,, \ $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ endef +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_LDFLAGS += -Wl,--gc-sections + MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \ PRECOMPILED_FILTER=1 \ STAGING_DIR="$(STAGING_DIR)" diff --git a/package/network/services/relayd/Makefile b/package/network/services/relayd/Makefile index e02c633cf8..25c56d49c6 100644 --- a/package/network/services/relayd/Makefile +++ b/package/network/services/relayd/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=relayd -PKG_VERSION:=2016-02-07 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL=$(LEDE_GIT)/project/relayd.git PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2016-02-07 PKG_SOURCE_VERSION:=ad0b25ad74345d367c62311e14b279f5ccb8ef13 -PKG_MIRROR_MD5SUM:=fb387d5edfecdaf8902bff37d02cb50d92110ab5987758fb98fc25a02257aee1 +PKG_MIRROR_HASH:=8818e9da8cc056961f21f1569e06e63b840965d1453dfcef70a8d84ea76f84d7 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 @@ -37,8 +35,6 @@ TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include define Package/relayd/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/relayd $(1)/usr/sbin/relayd - $(INSTALL_DIR) $(1)/etc/hotplug.d/iface - $(INSTALL_DATA) ./files/relay.hotplug $(1)/etc/hotplug.d/iface/30-relay $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/relay.init $(1)/etc/init.d/relayd endef diff --git a/package/network/services/relayd/files/relay.hotplug b/package/network/services/relayd/files/relay.hotplug deleted file mode 100644 index afffbfeab8..0000000000 --- a/package/network/services/relayd/files/relay.hotplug +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/etc/init.d/relayd enabled && /etc/init.d/relayd start diff --git a/package/network/services/relayd/files/relay.init b/package/network/services/relayd/files/relay.init index c6288637d1..028b61ea36 100644 --- a/package/network/services/relayd/files/relay.init +++ b/package/network/services/relayd/files/relay.init @@ -20,6 +20,7 @@ validate_proto_relayd() resolve_ifname() { grep -qs "^ *$1:" /proc/net/dev && { procd_append_param command -I "$1" + procd_append_param netdev "$1" append ifaces "$1" } } @@ -82,7 +83,7 @@ start_relay() { local expiry # = 30 config_get expiry "$cfg" expiry - [ -n "$expiry" ] && procd_append_param command "$expiry" + [ -n "$expiry" ] && procd_append_param command -t "$expiry" local retry # = 5 config_get retry "$cfg" retry @@ -106,6 +107,7 @@ start_relay() { service_triggers() { procd_add_reload_trigger "network" + procd_add_raw_trigger "interface.*" 2000 /etc/init.d/relayd reload } start_service() { diff --git a/package/network/services/samba36/Makefile b/package/network/services/samba36/Makefile index 2f0b5fa5f0..1311e09001 100644 --- a/package/network/services/samba36/Makefile +++ b/package/network/services/samba36/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=5 PKG_SOURCE_URL:=http://ftp.samba.org/pub/samba \ http://ftp.samba.org/pub/samba/stable PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MD5SUM:=76da2fa64edd94a0188531e7ecb27c4e +PKG_HASH:=8f2c8a7f2bd89b0dfd228ed917815852f7c625b2bc0936304ac3ed63aaf83751 PKG_LICENSE:=GPL-3.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 3600d80637..39e8894ebc 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_VERSION:=2016-10-25 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/uhttpd.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-10-25 PKG_SOURCE_VERSION:=1628fa4b34aa143187353f81e8001b9a15286bda -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=9d7ceef6ce40cb12f4065b41d99cf584fcd971dce4a5a13b6a92b04d663e4301 +PKG_MIRROR_HASH:=2ac4ba8dc0b349d72174aac9ff693a73a214295a9890fe3d2a8eedcad54d06e3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC @@ -51,40 +49,6 @@ define Package/uhttpd/config endef -define Package/uhttpd-mod-tls - $(Package/uhttpd/default) - TITLE+= (TLS plugin) - DEPENDS:=uhttpd \ - +PACKAGE_uhttpd-mod-tls_polarssl:libustream-polarssl \ - +PACKAGE_uhttpd-mod-tls_mbedtls:libustream-mbedtls \ - +PACKAGE_uhttpd-mod-tls_cyassl:libustream-cyassl \ - +PACKAGE_uhttpd-mod-tls_openssl:libustream-openssl -endef - -define Package/uhttpd-mod-tls/description - The TLS plugin adds HTTPS support to uHTTPd. -endef - -define Package/uhttpd-mod-tls/config - choice - depends on PACKAGE_uhttpd-mod-tls - prompt "TLS Provider" - default PACKAGE_uhttpd-mod-tls_polarssl - - config PACKAGE_uhttpd-mod-tls_mbedtls - bool "mbedTLS" - - config PACKAGE_uhttpd-mod-tls_polarssl - bool "PolarSSL" - - config PACKAGE_uhttpd-mod-tls_cyassl - bool "CyaSSL" - - config PACKAGE_uhttpd-mod-tls_openssl - bool "OpenSSL" - endchoice -endef - define Package/uhttpd-mod-lua $(Package/uhttpd/default) TITLE+= (Lua plugin) @@ -131,10 +95,6 @@ define Package/uhttpd/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd endef -define Package/uhttpd-mod-tls/install - true -endef - define Package/uhttpd-mod-lua/install $(INSTALL_DIR) $(1)/usr/lib $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_lua.so $(1)/usr/lib/ @@ -148,6 +108,5 @@ endef $(eval $(call BuildPackage,uhttpd)) -$(eval $(call BuildPackage,uhttpd-mod-tls)) $(eval $(call BuildPackage,uhttpd-mod-lua)) $(eval $(call BuildPackage,uhttpd-mod-ubus)) diff --git a/package/network/utils/arptables/Makefile b/package/network/utils/arptables/Makefile index 1ed0287ca2..d2fd2593a6 100644 --- a/package/network/utils/arptables/Makefile +++ b/package/network/utils/arptables/Makefile @@ -7,15 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=arptables -PKG_VERSION:=2015-05-20 PKG_RELEASE:=1 -PKG_MIRROR_MD5SUM:=736c2a88f99936811d80dd75d3016c3829ebb9dac8b28ced020a0bee149c2a31 PKG_SOURCE_URL:=git://git.netfilter.org/arptables PKG_SOURCE_PROTO:=git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2015-05-20 PKG_SOURCE_VERSION:=f4ab8f63f11a72f14687a6646d04ae1bae3fa45f -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz +PKG_MIRROR_HASH:=84bc660be4c9f70be91046acfd87785add930eceab7c543036058e1a9de2e9d9 PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/comgt/Makefile b/package/network/utils/comgt/Makefile index 9d99d640bc..9ddc61758f 100644 --- a/package/network/utils/comgt/Makefile +++ b/package/network/utils/comgt/Makefile @@ -9,11 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=comgt PKG_VERSION:=0.32 -PKG_RELEASE:=27 +PKG_RELEASE:=28 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz PKG_SOURCE_URL:=@SF/comgt -PKG_MD5SUM:=db2452680c3d953631299e331daf49ef +PKG_HASH:=0cedb2a5aa608510da66a99aab74df3db363df495032e57e791a2ff55f1d7913 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0+ diff --git a/package/network/utils/comgt/files/3g.sh b/package/network/utils/comgt/files/3g.sh index b0cdae234d..d438cb7a6d 100644 --- a/package/network/utils/comgt/files/3g.sh +++ b/package/network/utils/comgt/files/3g.sh @@ -31,6 +31,8 @@ proto_3g_setup() { json_get_var dialnumber dialnumber [ -n "$dat_device" ] && device=$dat_device + + device="$(readlink -f $device)" [ -e "$device" ] || { proto_set_available "$interface" 0 return 1 diff --git a/package/network/utils/comgt/files/directip.sh b/package/network/utils/comgt/files/directip.sh index 79b8c32c83..381bfb0000 100644 --- a/package/network/utils/comgt/files/directip.sh +++ b/package/network/utils/comgt/files/directip.sh @@ -27,6 +27,7 @@ proto_directip_setup() { [ -n "$ctl_device" ] && device=$ctl_device + device="$(readlink -f $device)" [ -e "$device" ] || { proto_notify_error "$interface" NO_DEVICE proto_set_available "$interface" 0 diff --git a/package/network/utils/comgt/files/getcardinfo.gcom b/package/network/utils/comgt/files/getcardinfo.gcom index 5c69a64604..f91665f72e 100644 --- a/package/network/utils/comgt/files/getcardinfo.gcom +++ b/package/network/utils/comgt/files/getcardinfo.gcom @@ -6,7 +6,7 @@ opengt flash 0.1 :start - send "ATI^m" + send "AT+CGMI^m" get 1 "" $s print $s diff --git a/package/network/utils/comgt/files/ncm.json b/package/network/utils/comgt/files/ncm.json index d1f869974a..8f74e173d1 100644 --- a/package/network/utils/comgt/files/ncm.json +++ b/package/network/utils/comgt/files/ncm.json @@ -7,7 +7,7 @@ "ATV1", "ATE1", "ATS0=0", - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\"" + "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}" ], "modes": { "preferlte": "AT^SYSCFGEX=\\\"030201\\\",3fffffff,2,4,7fffffffffffffff,,", @@ -17,8 +17,8 @@ "gsm": "AT^SYSCFGEX=\\\"01\\\",3fffffff,2,4,7fffffffffffffff,,", "auto": "AT^SYSCFGEX=\\\"00\\\",3fffffff,2,4,7fffffffffffffff,," }, - "connect": "AT^NDISDUP=1,1,\\\"${apn}\\\"${username:+,\\\"$username\\\"}${password:+,\\\"$password\\\"}${auth:+,$auth}", - "disconnect": "AT^NDISDUP=1,0" + "connect": "AT^NDISDUP=${profile},1${apn:+,\\\"$apn\\\"}${username:+,\\\"$username\\\"}${password:+,\\\"$password\\\"}${auth:+,$auth}", + "disconnect": "AT^NDISDUP=${profile},0" }, "samsung": { "initialize": [ @@ -26,7 +26,7 @@ "AT+CGREG=2", "AT+CFUN=5", "AT+MODESELECT=3", - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\"" + "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}" ], "modes": { "umts": "AT+CHANGEALLPATH=1" @@ -34,11 +34,11 @@ "connect": "AT+CGATT=1", "disconnect": "AT+CGATT=0" }, - "sierra wireless, incorporated": { + "sierra": { "initialize": [ "AT+CFUN=1", - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\"", - "AT$QCPDPP=1${auth:+,$auth}${password:+,\\\"$password\\\"}${username:+,\\\"$username\\\"}" + "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}", + "AT$QCPDPP=${profile},${auth:-0}${password:+,\\\"$password\\\"}${username:+,\\\"$username\\\"}" ], "modes": { "preferlte": "AT!SELRAT=07", @@ -48,20 +48,20 @@ "gsm": "AT!SELRAT=02", "auto": "AT!SELRAT=00" }, - "connect": "AT!SCACT=1,1", - "disconnect": "AT!SCACT=0,1" + "connect": "AT!SCACT=1,${profile}", + "disconnect": "AT!SCACT=0,${profile}" }, - "sony ericsson": { + "sony": { "initialize": [ "AT+CFUN=1", - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\"", - "AT*EIAAUW=1,1,\\\"${username}\\\",\\\"${password}\\\",${auth:-00111}" + "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}", + "AT*EIAAUW=${profile},1,\\\"${username}\\\",\\\"${password}\\\",${auth:-00111}" ], "modes": { "umts": "AT+CFUN=6", "gsm": "AT+CFUN=5" }, - "connect": "AT*ENAP=1,1", + "connect": "AT*ENAP=1,${profile}", "disconnect": "AT*ENAP=0" } } diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index 14b6347d3f..73d1e05e3f 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -18,7 +18,7 @@ proto_ncm_init_config() { proto_config_add_string delay proto_config_add_string mode proto_config_add_string pdptype - proto_config_add_boolean ipv6 + proto_config_add_int profile proto_config_add_defaults } @@ -27,22 +27,15 @@ proto_ncm_setup() { local manufacturer initialize setmode connect ifname devname devpath - local device apn auth username password pincode delay mode pdptype ipv6 $PROTO_DEFAULT_OPTIONS - json_get_vars device apn auth username password pincode delay mode pdptype ipv6 $PROTO_DEFAULT_OPTIONS - - if [ "$ipv6" = 0 ]; then - ipv6="" - else - ipv6=1 - fi - - [ -z "$pdptype" ] && { - if [ -n "$ipv6" ]; then - pdptype="IPV4V6" - else - pdptype="IP" - fi - } + local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS + json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS + + [ "$metric" = "" ] && metric="0" + + [ -n "$profile" ] || profile=1 + + pdptype=`echo "$pdptype" | awk '{print toupper($0)}'` + [ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP" [ -n "$ctl_device" ] && device=$ctl_device @@ -52,16 +45,13 @@ proto_ncm_setup() { proto_set_available "$interface" 0 return 1 } + + device="$(readlink -f $device)" [ -e "$device" ] || { echo "Control device not valid" proto_set_available "$interface" 0 return 1 } - [ -n "$apn" ] || { - echo "No APN specified" - proto_notify_error "$interface" NO_APN - return 1 - } devname="$(basename "$device")" case "$devname" in @@ -83,7 +73,7 @@ proto_ncm_setup() { [ -n "$delay" ] && sleep "$delay" - manufacturer=`gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk '/Manufacturer/ { print tolower($2) }'` + manufacturer=`gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }'` [ $? -ne 0 ] && { echo "Failed to get modem information" proto_notify_error "$interface" GETINFO_FAILED @@ -126,6 +116,7 @@ proto_ncm_setup() { json_select .. } + echo "Starting network $interface" json_get_vars connect eval COMMAND="$connect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || { echo "Failed to connect" @@ -133,19 +124,24 @@ proto_ncm_setup() { return 1 } - echo "Connected, starting DHCP on $ifname" + echo "Setting up $ifname" proto_init_update "$ifname" 1 + proto_add_data + json_add_string "manufacturer" "$manufacturer" + proto_close_data proto_send_update "$interface" - json_init - json_add_string name "${interface}_4" - json_add_string ifname "@$interface" - json_add_string proto "dhcp" - proto_add_dynamic_defaults - ubus call network add_dynamic "$(json_dump)" + [ "$pdptype" = "IP" -o "$pdptype" = "IPV4V6" ] && { + json_init + json_add_string name "${interface}_4" + json_add_string ifname "@$interface" + json_add_string proto "dhcp" + proto_add_dynamic_defaults + ubus call network add_dynamic "$(json_dump)" + } - [ -n "$ipv6" ] && { + [ "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] && { json_init json_add_string name "${interface}_6" json_add_string ifname "@$interface" @@ -161,17 +157,18 @@ proto_ncm_teardown() { local manufacturer disconnect - local device - json_get_vars device + local device profile + json_get_vars device profile - echo "Stopping network" + [ -n "$ctl_device" ] && device=$ctl_device - manufacturer=`gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk '/Manufacturer/ { print tolower($2) }'` - [ $? -ne 0 ] && { - echo "Failed to get modem information" - proto_notify_error "$interface" GETINFO_FAILED - return 1 - } + [ -n "$profile" ] || profile=1 + + echo "Stopping network $interface" + + json_load "$(ubus call network.interface.$interface status)" + json_select data + json_get_vars manufacturer json_load "$(cat /etc/gcom/ncm.json)" json_select "$manufacturer" || { @@ -181,7 +178,7 @@ proto_ncm_teardown() { } json_get_vars disconnect - COMMAND="$disconnect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || { + eval COMMAND="$disconnect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || { echo "Failed to disconnect" proto_notify_error "$interface" DISCONNECT_FAILED return 1 diff --git a/package/network/utils/conntrack-tools/Makefile b/package/network/utils/conntrack-tools/Makefile index 95257c6c67..128fa9e6f3 100644 --- a/package/network/utils/conntrack-tools/Makefile +++ b/package/network/utils/conntrack-tools/Makefile @@ -16,7 +16,7 @@ PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/conntrack-tools/files \ ftp://ftp.netfilter.org/pub/conntrack-tools \ http://mirrors.evolva.ro/netfilter.org/conntrack-tools -PKG_MD5SUM:=b7caf4fcc4c03575df57d25e5216584d597fd916c891f191dac616ce68bdba6c +PKG_HASH:=b7caf4fcc4c03575df57d25e5216584d597fd916c891f191dac616ce68bdba6c PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/curl/Config.in b/package/network/utils/curl/Config.in index 1e98b3a598..6fa10b6781 100644 --- a/package/network/utils/curl/Config.in +++ b/package/network/utils/curl/Config.in @@ -4,10 +4,7 @@ comment "SSL support" choice prompt "Selected SSL library" - default LIBCURL_POLARSSL - - config LIBCURL_POLARSSL - bool "PolarSSL" + default LIBCURL_MBEDTLS config LIBCURL_MBEDTLS bool "mbed TLS" diff --git a/package/network/utils/curl/Makefile b/package/network/utils/curl/Makefile index d1e8097602..950044a226 100644 --- a/package/network/utils/curl/Makefile +++ b/package/network/utils/curl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=curl -PKG_VERSION:=7.51.0 -PKG_RELEASE:=1 +PKG_VERSION:=7.52.1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://curl.haxx.se/download/ \ @@ -18,7 +18,7 @@ PKG_SOURCE_URL:=http://curl.haxx.se/download/ \ ftp://ftp.planetmirror.com/pub/curl/ \ http://www.mirrormonster.com/curl/download/ \ http://curl.mirrors.cyberservers.net/download/ -PKG_MD5SUM:=7f8240048907e5030f67be0a6129bc4b333783b9cca1391026d700835a788dde +PKG_HASH:=d16185a767cb2c1ba3d5b9096ec54e5ec198b213f45864a38b3bda4bbf87389b PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING @@ -32,7 +32,6 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_LIBCURL_CYASSL \ CONFIG_LIBCURL_GNUTLS \ CONFIG_LIBCURL_OPENSSL \ - CONFIG_LIBCURL_POLARSSL \ CONFIG_LIBCURL_MBEDTLS \ CONFIG_LIBCURL_NOSSL \ \ @@ -87,7 +86,7 @@ define Package/libcurl $(call Package/curl/Default) SECTION:=libs CATEGORY:=Libraries - DEPENDS:=+LIBCURL_POLARSSL:libpolarssl +LIBCURL_CYASSL:libcyassl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls + DEPENDS:= +LIBCURL_CYASSL:libcyassl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN:libidn +LIBCURL_SSH2:libssh2 TITLE:=A client-side URL transfer library MENU:=1 @@ -117,7 +116,6 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_LIBCURL_CYASSL),--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_POLARSSL),--with-polarssl="$(STAGING_DIR)/usr" --without-ca-bundle --with-ca-path=/etc/ssl/certs,--without-polarssl) \ $(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_LIBIDN),--with-libidn="$(STAGING_DIR)/usr",--without-libidn) \ diff --git a/package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch b/package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch new file mode 100644 index 0000000000..22b838daa0 --- /dev/null +++ b/package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch @@ -0,0 +1,11 @@ +--- a/lib/vtls/mbedtls.c ++++ b/lib/vtls/mbedtls.c +@@ -724,7 +724,7 @@ void Curl_mbedtls_session_free(void *ptr + + size_t Curl_mbedtls_version(char *buffer, size_t size) + { +- unsigned int version = mbedtls_version_get_number(); ++ unsigned int version = MBEDTLS_VERSION_NUMBER; + return snprintf(buffer, size, "mbedTLS/%d.%d.%d", version>>24, + (version>>16)&0xff, (version>>8)&0xff); + } diff --git a/package/network/utils/curl/patches/310-polarssl-disable-runtime-version-check.patch b/package/network/utils/curl/patches/310-polarssl-disable-runtime-version-check.patch deleted file mode 100644 index a26caa8571..0000000000 --- a/package/network/utils/curl/patches/310-polarssl-disable-runtime-version-check.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/lib/vtls/polarssl.c -+++ b/lib/vtls/polarssl.c -@@ -646,7 +646,7 @@ void Curl_polarssl_session_free(void *pt - - size_t Curl_polarssl_version(char *buffer, size_t size) - { -- unsigned int version = version_get_number(); -+ unsigned int version = POLARSSL_VERSION_NUMBER; - return snprintf(buffer, size, "%s/%d.%d.%d", - version >= 0x01030A00?"mbedTLS":"PolarSSL", - version>>24, (version>>16)&0xff, (version>>8)&0xff); ---- a/lib/vtls/mbedtls.c -+++ b/lib/vtls/mbedtls.c -@@ -712,7 +712,7 @@ void Curl_mbedtls_session_free(void *ptr - - size_t Curl_mbedtls_version(char *buffer, size_t size) - { -- unsigned int version = mbedtls_version_get_number(); -+ unsigned int version = MBEDTLS_VERSION_NUMBER; - return snprintf(buffer, size, "mbedTLS/%d.%d.%d", version>>24, - (version>>16)&0xff, (version>>8)&0xff); - } diff --git a/package/network/utils/dante/Makefile b/package/network/utils/dante/Makefile index a78c40dbde..6f821122b2 100644 --- a/package/network/utils/dante/Makefile +++ b/package/network/utils/dante/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.inet.no/dante/files/ -PKG_MD5SUM:=68c2ce12119e12cea11a90c7a80efa8f +PKG_HASH:=b6d232bd6fefc87d14bf97e447e4fcdeef4b28b16b048d804b50b48f261c4f53 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=BSD-4-Clause diff --git a/package/network/utils/ebtables/Makefile b/package/network/utils/ebtables/Makefile index 78b83b817b..93bb23e5ab 100644 --- a/package/network/utils/ebtables/Makefile +++ b/package/network/utils/ebtables/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/ebtables -PKG_MD5SUM:=506742a3d44b9925955425a659c1a8d0 +PKG_HASH:=dc6f7b484f207dc712bfca81645f45120cb6aee3380e77a1771e9c34a9a4455d PKG_BUILD_DIR:=$(BUILD_DIR)/ebtables-v$(PKG_VERSION) PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iftop/Makefile b/package/network/utils/iftop/Makefile index 5a4cd8b3d3..5bbee31fd7 100644 --- a/package/network/utils/iftop/Makefile +++ b/package/network/utils/iftop/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.ex-parrot.com/~pdw/iftop/download -PKG_MD5SUM:=7e6decb4958e8a4890cccac335239f24 +PKG_HASH:=f733eeea371a7577f8fe353d86dd88d16f5b2a2e702bd96f5ffb2c197d9b4f97 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iperf/Makefile b/package/network/utils/iperf/Makefile index b17ed0fc7b..ea8f026315 100644 --- a/package/network/utils/iperf/Makefile +++ b/package/network/utils/iperf/Makefile @@ -18,7 +18,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)$(PKG_VERSION_SUFFIX).tar.gz # conflicts with existing mirrored files. # PKG_SOURCE_URL:=@SF/iperf2 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources -PKG_MD5SUM:=db02911f35686e808ed247160dfa766e08ae3f59d1e7dcedef0ffb2a6643f0bf +PKG_HASH:=db02911f35686e808ed247160dfa766e08ae3f59d1e7dcedef0ffb2a6643f0bf PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/utils/iperf3/Makefile b/package/network/utils/iperf3/Makefile index 52838421f5..56782ea520 100644 --- a/package/network/utils/iperf3/Makefile +++ b/package/network/utils/iperf3/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.es.net/pub/iperf -PKG_MD5SUM:=db61d70ac62003ebe0bf15496bd8c4b3c4b728578a44d0a1a88fcf8afc0e8f76 +PKG_HASH:=db61d70ac62003ebe0bf15496bd8c4b3c4b728578a44d0a1a88fcf8afc0e8f76 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index ab38d0e6d3..620cce22a0 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -9,11 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 PKG_VERSION:=4.4.0 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_MD5SUM:=d762653ec3e1ab0d4a9689e169ca184f +PKG_HASH:=bc91c367288a19f78ef800cd6840363be1f22da8436fbae88e1a7250490d6514 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch b/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch index ffb3e63e13..6c73fbaf25 100644 --- a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch +++ b/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch @@ -1,6 +1,6 @@ --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h -@@ -850,4 +850,57 @@ struct tc_pie_xstats { +@@ -850,4 +850,59 @@ struct tc_pie_xstats { __u32 maxq; /* maximum queue size */ __u32 ecn_mark; /* packets marked with ecn*/ }; @@ -18,6 +18,8 @@ + TCA_CAKE_AUTORATE, + TCA_CAKE_MEMORY, + TCA_CAKE_NAT, ++ TCA_CAKE_ETHERNET, ++ TCA_CAKE_WASH, + __TCA_CAKE_MAX +}; +#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) @@ -70,7 +72,7 @@ --- /dev/null +++ b/tc/q_cake.c -@@ -0,0 +1,643 @@ +@@ -0,0 +1,663 @@ +/* + * Common Applications Kept Enhanced -- CAKE + * @@ -126,9 +128,10 @@ +{ + fprintf(stderr, "Usage: ... cake [ bandwidth RATE | unlimited* | autorate_ingress ]\n" + " [ rtt TIME | datacentre | lan | metro | regional | internet* | oceanic | satellite | interplanetary ]\n" -+ " [ besteffort | precedence | diffserv8 | diffserv4* ]\n" -+ " [ flowblind | srchost | dsthost | hosts | flows* | dual-srchost | dual-dsthost | triple-isolate ] [ nat | nonat* ]\n" ++ " [ besteffort | precedence | diffserv8 | diffserv4 | diffserv-llt | diffserv3* ]\n" ++ " [ flowblind | srchost | dsthost | hosts | flows | dual-srchost | dual-dsthost | triple-isolate* ] [ nat | nonat* ]\n" + " [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n" ++ " [ wash | nowash* ]\n" + " [ memlimit LIMIT ]\n" + " (* marks defaults)\n"); +} @@ -144,6 +147,8 @@ + unsigned memlimit = 0; + int overhead = 0; + bool overhead_set = false; ++ bool overhead_override = false; ++ int wash = -1; + int flowmode = -1; + int nat = -1; + int atm = -1; @@ -212,6 +217,13 @@ + diffserv = 4; + } else if (strcmp(*argv, "diffserv-llt") == 0) { + diffserv = 5; ++ } else if (strcmp(*argv, "diffserv3") == 0) { ++ diffserv = 6; ++ ++ } else if (strcmp(*argv, "nowash") == 0) { ++ wash = 0; ++ } else if (strcmp(*argv, "wash") == 0) { ++ wash = 1; + + } else if (strcmp(*argv, "flowblind") == 0) { + flowmode = 0; @@ -246,6 +258,7 @@ + atm = 0; + overhead = 0; + overhead_set = true; ++ overhead_override = true; + } else if (strcmp(*argv, "conservative") == 0) { + /* + * Deliberately over-estimate overhead: @@ -256,28 +269,6 @@ + overhead = 48; + overhead_set = true; + -+ /* -+ * DOCSIS overhead figures courtesy of Greg White @ CableLabs. -+ * The "-ip" versions include the Ethernet frame header, in case -+ * you are shaping an IP interface instead of an Ethernet one. -+ */ -+ } else if (strcmp(*argv, "docsis-downstream-ip") == 0) { -+ atm = 0; -+ overhead += 35; -+ overhead_set = true; -+ } else if (strcmp(*argv, "docsis-downstream") == 0) { -+ atm = 0; -+ overhead += 35 - 14; -+ overhead_set = true; -+ } else if (strcmp(*argv, "docsis-upstream-ip") == 0) { -+ atm = 0; -+ overhead += 28; -+ overhead_set = true; -+ } else if (strcmp(*argv, "docsis-upstream") == 0) { -+ atm = 0; -+ overhead += 28 - 14; -+ overhead_set = true; -+ + /* Various ADSL framing schemes, all over ATM cells */ + } else if (strcmp(*argv, "ipoa-vcmux") == 0) { + atm = 1; @@ -325,38 +316,38 @@ + + } else if (strcmp(*argv, "via-ethernet") == 0) { + /* -+ * The above overheads are relative to an IP packet, -+ * but Linux includes Ethernet framing overhead already -+ * if we are shaping an Ethernet interface rather than -+ * an IP interface. ++ * We used to use this flag to manually compensate for ++ * Linux including the Ethernet header on Ethernet-type ++ * interfaces, but not on IP-type interfaces. ++ * ++ * It is no longer needed, because Cake now adjusts for ++ * that automatically, and is thus ignored. ++ * ++ * It would be deleted entirely, but it appears in the ++ * stats output when the automatic compensation is active. + */ -+ overhead -= 14; -+ overhead_set = true; + -+ /* Additional Ethernet-related overheads used by some ISPs */ -+ } else if (strcmp(*argv, "ether-phy") == 0) { -+ /* ethernet pre-amble & interframe gap 20 bytes -+ * Linux will have already accounted for MACs & frame type 14 bytes -+ * you probably want to add an FCS as well*/ -+ overhead += 20; -+ overhead_set = true; -+ } else if (strcmp(*argv, "ether-all") == 0) { ++ } else if (strcmp(*argv, "ethernet") == 0) { + /* ethernet pre-amble & interframe gap & FCS -+ * Linux will have already accounted for MACs & frame type 14 bytes -+ * you may need to add vlan tag*/ -+ overhead += 24; ++ * you may need to add vlan tag */ ++ overhead += 38; + overhead_set = true; + -+ } else if (strcmp(*argv, "ether-fcs") == 0) { -+ /* Frame Check Sequence */ -+ /* we ignore the minimum frame size, because IP packets usually meet it */ -+ overhead += 4; -+ overhead_set = true; ++ /* Additional Ethernet-related overhead used by some ISPs */ + } else if (strcmp(*argv, "ether-vlan") == 0) { + /* 802.1q VLAN tag - may be repeated */ + overhead += 4; + overhead_set = true; + ++ /* ++ * DOCSIS cable shapers account for Ethernet frame with FCS, ++ * but not interframe gap nor preamble. ++ */ ++ } else if (strcmp(*argv, "docsis") == 0) { ++ atm = 0; ++ overhead += 18; ++ overhead_set = true; ++ + } else if (strcmp(*argv, "overhead") == 0) { + char* p = NULL; + NEXT_ARG(); @@ -397,6 +388,10 @@ + addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode, sizeof(flowmode)); + if (overhead_set) + addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead, sizeof(overhead)); ++ if (overhead_override) { ++ unsigned zero = 0; ++ addattr_l(n, 1024, TCA_CAKE_ETHERNET, &zero, sizeof(zero)); ++ } + if (interval) + addattr_l(n, 1024, TCA_CAKE_RTT, &interval, sizeof(interval)); + if (target) @@ -407,6 +402,8 @@ + addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit, sizeof(memlimit)); + if (nat != -1) + addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat)); ++ if (wash != -1) ++ addattr_l(n, 1024, TCA_CAKE_WASH, &wash, sizeof(wash)); + + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; + return 0; @@ -422,9 +419,11 @@ + unsigned interval = 0; + unsigned memlimit = 0; + int overhead = 0; ++ int ethernet = 0; + int atm = 0; + int nat = 0; + int autorate = 0; ++ int wash = 0; + SPRINT_BUF(b1); + SPRINT_BUF(b2); + @@ -468,6 +467,9 @@ + case 5: + fprintf(f, "diffserv-llt "); + break; ++ case 6: ++ fprintf(f, "diffserv3 "); ++ break; + default: + fprintf(f, "(?diffserv?) "); + break; @@ -511,6 +513,10 @@ + if(nat) + fprintf(f, "nat "); + } ++ if (tb[TCA_CAKE_WASH] && ++ RTA_PAYLOAD(tb[TCA_CAKE_WASH]) >= sizeof(__u32)) { ++ wash = rta_getattr_u32(tb[TCA_CAKE_WASH]); ++ } + if (tb[TCA_CAKE_ATM] && + RTA_PAYLOAD(tb[TCA_CAKE_ATM]) >= sizeof(__u32)) { + atm = rta_getattr_u32(tb[TCA_CAKE_ATM]); @@ -519,26 +525,38 @@ + RTA_PAYLOAD(tb[TCA_CAKE_OVERHEAD]) >= sizeof(__u32)) { + overhead = rta_getattr_u32(tb[TCA_CAKE_OVERHEAD]); + } ++ if (tb[TCA_CAKE_ETHERNET] && ++ RTA_PAYLOAD(tb[TCA_CAKE_ETHERNET]) >= sizeof(__u32)) { ++ ethernet = rta_getattr_u32(tb[TCA_CAKE_ETHERNET]); ++ } + if (tb[TCA_CAKE_RTT] && + RTA_PAYLOAD(tb[TCA_CAKE_RTT]) >= sizeof(__u32)) { + interval = rta_getattr_u32(tb[TCA_CAKE_RTT]); + } + ++ if (wash) ++ fprintf(f,"wash "); ++ + if (interval) + fprintf(f, "rtt %s ", sprint_time(interval, b2)); + -+ if (atm == 1) -+ fprintf(f, "atm "); -+ else if (atm == 2) -+ fprintf(f, "ptm "); -+ else if (overhead) -+ fprintf(f, "noatm "); ++ if (!atm && overhead == ethernet) { ++ fprintf(f, "raw "); ++ } else { ++ if (atm == 1) ++ fprintf(f, "atm "); ++ else if (atm == 2) ++ fprintf(f, "ptm "); ++ else ++ fprintf(f, "noatm "); + -+ if (overhead || atm) + fprintf(f, "overhead %d ", overhead); + -+ if (!atm && !overhead) -+ fprintf(f, "raw "); ++ // This is actually the *amount* of automatic compensation, but we only report ++ // its presence as a boolean for now. ++ if (ethernet) ++ fprintf(f, "via-ethernet "); ++ } + + if (memlimit) + fprintf(f, "memlimit %s", sprint_size(memlimit, b1)); @@ -601,6 +619,10 @@ + fprintf(f, " capacity estimate: %s\n", sprint_rate(stnc->capacity_estimate, b1)); + + switch(stnc->tin_cnt) { ++ case 3: ++ fprintf(f, " Bulk Best Effort Voice\n"); ++ break; ++ + case 4: + fprintf(f, " Bulk Best Effort Video Voice\n"); + break; diff --git a/package/network/utils/ipset/Makefile b/package/network/utils/ipset/Makefile index 13d1d3d649..5e6b6ba99b 100644 --- a/package/network/utils/ipset/Makefile +++ b/package/network/utils/ipset/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://ipset.netfilter.org -PKG_MD5SUM:=41c32e3b884ec714f0aac95e7675f9d1 +PKG_HASH:=65bfa43fec3d51a6b4012f3d7e4b93a748df9b71b6cd6c53adbec8083e804a31 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 6f7529c736..ac869f0385 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -17,7 +17,7 @@ PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \ ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \ ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \ ftp://ftp.no.netfilter.org/pub/netfilter/iptables/ -PKG_MD5SUM:=536d048c8e8eeebcd9757d0863ebb0c0 +PKG_HASH:=52004c68021da9a599feed27f65defcfb22128f7da2c0531c0f75de0f479d3e0 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 @@ -28,7 +28,7 @@ include $(INCLUDE_DIR)/package.mk ifeq ($(DUMP),) -include $(LINUX_DIR)/.config include $(INCLUDE_DIR)/netfilter.mk - STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep 'NETFILTER' $(LINUX_DIR)/.config | md5s) + STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | mkhash md5) endif diff --git a/package/network/utils/iptables/patches/500-add-xt_id-match.patch b/package/network/utils/iptables/patches/500-add-xt_id-match.patch deleted file mode 100644 index 0964f0175f..0000000000 --- a/package/network/utils/iptables/patches/500-add-xt_id-match.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- /dev/null -+++ b/extensions/libxt_id.c -@@ -0,0 +1,55 @@ -+/* Shared library add-on to iptables to add id match support. */ -+ -+#include -+#include -+#include -+ -+enum { -+ O_ID = 0, -+}; -+ -+static const struct xt_option_entry id_opts[] = { -+ { -+ .name = "id", -+ .id = O_ID, -+ .type = XTTYPE_UINT32, -+ .flags = XTOPT_MAND | XTOPT_PUT, -+ XTOPT_POINTER(struct xt_id_info, id) -+ }, -+ XTOPT_TABLEEND, -+}; -+ -+static void -+id_print(const void *ip, const struct xt_entry_match *match, int numeric) -+{ -+ struct xt_id_info *idinfo = (void *)match->data; -+ -+ printf(" ID:%08lx", idinfo->id); -+} -+ -+ -+/* Saves the union ipt_matchinfo in parsable form to stdout. */ -+static void -+id_save(const void *ip, const struct xt_entry_match *match) -+{ -+ struct xt_id_info *idinfo = (void *)match->data; -+ -+ printf(" --id 0x%lx", idinfo->id); -+} -+ -+static struct xtables_match id_match = { -+ .family = NFPROTO_UNSPEC, -+ .name = "id", -+ .version = XTABLES_VERSION, -+ .size = XT_ALIGN(sizeof(struct xt_id_info)), -+ .userspacesize = XT_ALIGN(sizeof(struct xt_id_info)), -+ .print = id_print, -+ .save = id_save, -+ .x6_parse = xtables_option_parse, -+ .x6_options = id_opts, -+}; -+ -+void _init(void) -+{ -+ xtables_register_match(&id_match); -+} ---- /dev/null -+++ b/include/linux/netfilter/xt_id.h -@@ -0,0 +1,8 @@ -+#ifndef _XT_ID_H -+#define _XT_ID_H -+ -+struct xt_id_info { -+ __u32 id; -+}; -+ -+#endif /* XT_ID_H */ diff --git a/package/network/utils/iputils/Makefile b/package/network/utils/iputils/Makefile index 11f3a7d2b7..b6799e68b5 100644 --- a/package/network/utils/iputils/Makefile +++ b/package/network/utils/iputils/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-s$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://www.skbuff.net/iputils -PKG_MD5SUM:=a36c25e9ec17e48be514dc0485e7376c +PKG_HASH:=fd3af46c80ebb99607c2ca1f2a3608b6fe828e25bbec6e54f2afd25f6ddb6ee7 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0+ diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index f84978ff25..a578ddc98c 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/iw -PKG_MD5SUM:=02d36655b45a0288feb0e87e461e365a +PKG_HASH:=324cc805fad52cba2c16b9ab569906889fb645cc962aac4cfda1db85d2de97ce PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 0ac9069f1f..00332b0357 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -7,15 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_VERSION:=2016-09-21 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/iwinfo.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-09-21 PKG_SOURCE_VERSION:=fd9e17be0c43bd6b8df5371f0b353747bc563874 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=fa2d47caf0927ca79a7c25fc9a480bdbc2f4330210f6aa0cb2e934a3355ce1b5 +PKG_MIRROR_HASH:=c58490d9b5c2179f6a3edc67aae2f00ae6007daee0d52fa7e5b4c0ea923f1e37 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 @@ -25,7 +23,6 @@ PKG_CONFIG_DEPENDS := \ CONFIG_PACKAGE_kmod-brcm-wl \ CONFIG_PACKAGE_kmod-brcm-wl-mini \ CONFIG_PACKAGE_kmod-brcm-wl-mimo \ - CONFIG_PACKAGE_kmod-madwifi \ CONFIG_PACKAGE_kmod-cfg80211 include $(INCLUDE_DIR)/package.mk @@ -41,7 +38,7 @@ endef define Package/libiwinfo/description Wireless information library with consistent interface for proprietary Broadcom, - madwifi, nl80211 and wext driver interfaces. + nl80211 and wext driver interfaces. endef @@ -78,7 +75,6 @@ IWINFO_BACKENDS := \ $(if $(CONFIG_PACKAGE_kmod-brcm-wl),wl) \ $(if $(CONFIG_PACKAGE_kmod-brcm-wl-mini),wl) \ $(if $(CONFIG_PACKAGE_kmod-brcm-wl-mimo),wl) \ - $(if $(CONFIG_PACKAGE_kmod-madwifi),madwifi) \ $(if $(CONFIG_PACKAGE_kmod-cfg80211),nl80211) TARGET_CFLAGS += \ diff --git a/package/network/utils/linux-atm/Makefile b/package/network/utils/linux-atm/Makefile index 62d71ea75d..3d36622647 100644 --- a/package/network/utils/linux-atm/Makefile +++ b/package/network/utils/linux-atm/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/$(PKG_NAME) -PKG_MD5SUM:=d49499368c3cf15f73a05d9bce8824a8 +PKG_HASH:=9645481a2b16476b59220aa2d6bc5bc41043f291326c9b37581018fbd16dd53a PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index ca212ad7fb..4fdd58265f 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -10,12 +10,10 @@ PKG_NAME:=nftables PKG_VERSION:=0.4+2015-04-09 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=git://git.netfilter.org/nftables PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=3ed296118a065caff5600e60d4f7ef18e137f9a0 -PKG_MIRROR_MD5SUM:=561d0e057e916289eaa1f1a688deb78d7de095b002c8bb0f478ce6e53ae220a4 +PKG_MIRROR_HASH:=7f6f6162592c848b8047e75374f01a93d2d269dabe013a0150767027049b1e41 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/tcpdump/Makefile b/package/network/utils/tcpdump/Makefile index d0a05e0618..ddc858defb 100644 --- a/package/network/utils/tcpdump/Makefile +++ b/package/network/utils/tcpdump/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tcpdump -PKG_VERSION:=4.5.1 -PKG_RELEASE:=4 +PKG_VERSION:=4.8.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.tcpdump.org/release/ \ - http://ftp.gwdg.de/pub/misc/tcpdump/ \ - http://www.at.tcpdump.org/ \ - http://www.br.tcpdump.org/ -PKG_MD5SUM:=973a2513d0076e34aa9da7e15ed98e1b + http://www.at.tcpdump.org/ +PKG_HASH:=20e4341ec48fcf72abcae312ea913e6ba6b958617b2f3fb496d51f0ae88d831c PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 diff --git a/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch b/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch index d2c724d509..310d50f3be 100644 --- a/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch +++ b/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch @@ -1,23 +1,100 @@ ---- a/tcpdump.c -+++ b/tcpdump.c -@@ -1095,20 +1095,6 @@ main(int argc, char **argv) - error("invalid data link type %s", gndo->ndo_dltname); - break; +--- a/configure ++++ b/configure +@@ -6260,97 +6260,6 @@ $as_echo "no" >&6; } + fi + fi --#if defined(HAVE_PCAP_DEBUG) || defined(HAVE_YYDEBUG) -- case 'Y': -- { -- /* Undocumented flag */ --#ifdef HAVE_PCAP_DEBUG -- extern int pcap_debug; -- pcap_debug = 1; --#else +-# +-# Check for special debugging functions +-# +-for ac_func in pcap_set_parser_debug +-do : +- ac_fn_c_check_func "$LINENO" "pcap_set_parser_debug" "ac_cv_func_pcap_set_parser_debug" +-if test "x$ac_cv_func_pcap_set_parser_debug" = xyes; then : +- cat >>confdefs.h <<_ACEOF +-#define HAVE_PCAP_SET_PARSER_DEBUG 1 +-_ACEOF +- +-fi +-done +- +-if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then +- # +- # OK, we don't have pcap_set_parser_debug() to set the libpcap +- # filter expression parser debug flag; can we directly set the +- # flag? +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pcap_debug is defined by libpcap" >&5 +-$as_echo_n "checking whether pcap_debug is defined by libpcap... " >&6; } +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-int +-main () +-{ +- +- extern int pcap_debug; +- +- return pcap_debug; +- +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- ac_lbl_cv_pcap_debug_defined=yes +-else +- ac_lbl_cv_pcap_debug_defined=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; } +- +-$as_echo "#define HAVE_PCAP_DEBUG 1" >>confdefs.h +- +- else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- # +- # OK, what about "yydebug"? +- # +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yydebug is defined by libpcap" >&5 +-$as_echo_n "checking whether yydebug is defined by libpcap... " >&6; } +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-int +-main () +-{ +- - extern int yydebug; -- yydebug = 1; --#endif -- } -- break; --#endif - case 'z': - if (optarg) { - zflag = strdup(optarg); +- +- return yydebug; +- +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- ac_lbl_cv_yydebug_defined=yes +-else +- ac_lbl_cv_yydebug_defined=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- if test "$ac_lbl_cv_yydebug_defined" = yes ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; } +- +-$as_echo "#define HAVE_YYDEBUG 1" >>confdefs.h +- +- else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- fi +- fi +-fi + for ac_func in pcap_set_optimizer_debug + do : + ac_fn_c_check_func "$LINENO" "pcap_set_optimizer_debug" "ac_cv_func_pcap_set_optimizer_debug" diff --git a/package/network/utils/tcpdump/patches/002-remove_static_libpcap_check.patch b/package/network/utils/tcpdump/patches/002-remove_static_libpcap_check.patch index c8bdf1499e..4855ec3872 100644 --- a/package/network/utils/tcpdump/patches/002-remove_static_libpcap_check.patch +++ b/package/network/utils/tcpdump/patches/002-remove_static_libpcap_check.patch @@ -1,35 +1,44 @@ --- a/configure +++ b/configure -@@ -5813,28 +5813,6 @@ $as_echo "Using $pfopen" >&6; } +@@ -5472,37 +5472,6 @@ $as_echo "Using $pfopen" >&6; } LIBS="$LIBS $pfopen" fi fi -- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local pcap library" >&5 +- libpcap=FAIL +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local pcap library" >&5 -$as_echo_n "checking for local pcap library... " >&6; } -- libpcap=FAIL -- lastdir=FAIL -- places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ -- egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'` -- for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do -- basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \ -- sed -e 's/-PRE-GIT$//' ` -- if test $lastdir = $basedir ; then -- continue; -- fi -- lastdir=$dir -- if test -r $dir/libpcap.a ; then -- libpcap=$dir/libpcap.a -- d=$dir -- fi -- done +- +-# Check whether --with-system-libpcap was given. +-if test "${with_system_libpcap+set}" = set; then : +- withval=$with_system_libpcap; +-fi +- +- if test "x$with_system_libpcap" != xyes ; then +- lastdir=FAIL +- places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ +- egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'` +- places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \ +- egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'` +- for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do +- basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \ +- sed -e 's/-PRE-GIT$//' ` +- if test $lastdir = $basedir ; then +- continue; +- fi +- lastdir=$dir +- if test -r $dir/libpcap.a ; then +- libpcap=$dir/libpcap.a +- d=$dir +- fi +- done +- fi - if test $libpcap = FAIL ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } -- + # # Look for pcap-config. - # -@@ -5989,41 +5967,6 @@ if test "x$ac_cv_lib_pcap_main" = xyes; +@@ -5658,51 +5627,6 @@ if test "x$ac_cv_lib_pcap_main" = xyes; libpcap="-lpcap" fi @@ -59,13 +68,23 @@ - V_PCAPDEP=$libpcap - places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ - egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'` +- places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \ +- egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'` +- pcapH=FAIL - if test -r $d/pcap.h; then -- V_INCLS="-I$d $V_INCLS" -- elif test -r $places/pcap.h; then -- V_INCLS="-I$places $V_INCLS" +- pcapH=$d - else -- as_fn_error see INSTALL "cannot find pcap.h" "$LINENO" 5 +- for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do +- if test -r $dir/pcap.h ; then +- pcapH=$dir +- fi +- done +- fi +- +- if test $pcapH = FAIL ; then +- as_fn_error $? "cannot find pcap.h: see INSTALL" "$LINENO" 5 - fi +- V_INCLS="-I$pcapH $V_INCLS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libpcap" >&5 -$as_echo "$libpcap" >&6; } # Extract the first word of "pcap-config", so it can be a program name with args. diff --git a/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch b/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch index 8d07be6b40..a39916e143 100644 --- a/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch +++ b/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch @@ -1,45 +1,113 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -71,6 +71,22 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ +@@ -70,6 +70,82 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ @rm -f $@ $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c +ifdef TCPDUMP_MINI + -+CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \ -+ nlpid.c l2vpn.c machdep.c parsenfsfh.c in_cksum.c \ -+ print-802_11.c print-aodv.c print-arp.c print-ascii.c \ -+ print-bgp.c print-bootp.c print-cdp.c print-domain.c print-eap.c print-ether.c \ -+ print-gre.c print-icmp.c print-igmp.c print-ip.c \ -+ print-l2tp.c print-lldp.c print-llc.c \ -+ print-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \ -+ print-ppp.c print-pppoe.c print-pptp.c print-radius.c print-raw.c print-rsvp.c \ -+ print-sctp.c print-sip.c print-sll.c print-snmp.c print-stp.c print-sunrpc.c \ -+ print-syslog.c print-tcp.c print-telnet.c print-tftp.c print-udp.c \ -+ setsignal.c tcpdump.c util.c signature.c print-ipnet.c print-forces.c ++CSRC=\ ++ tcpdump.c \ ++ util.c \ ++ setsignal.c \ ++ addrtoname.c \ ++ addrtostr.c \ ++ af.c \ ++ ascii_strcasecmp.c \ ++ checksum.c \ ++ cpack.c \ ++ gmpls.c \ ++ gmt2local.c \ ++ in_cksum.c \ ++ ipproto.c \ ++ l2vpn.c \ ++ machdep.c \ ++ nlpid.c \ ++ oui.c \ ++ parsenfsfh.c \ ++ print.c \ ++ print-802_11.c \ ++ print-aodv.c \ ++ print-arp.c \ ++ print-ascii.c \ ++ print-bootp.c \ ++ print-dhcp6.c \ ++ print-domain.c \ ++ print-eap.c \ ++ print-ether.c \ ++ print-ftp.c \ ++ print-gre.c \ ++ print-http.c \ ++ print-icmp.c \ ++ print-icmp6.c \ ++ print-igmp.c \ ++ print-ip.c \ ++ print-ip6.c \ ++ print-ip6opts.c \ ++ print-ipnet.c \ ++ print-l2tp.c \ ++ print-llc.c \ ++ print-lldp.c \ ++ print-loopback.c \ ++ print-nfs.c \ ++ print-ntp.c \ ++ print-null.c \ ++ print-olsr.c \ ++ print-ospf.c \ ++ print-ospf6.c \ ++ print-ppp.c \ ++ print-pppoe.c \ ++ print-pptp.c \ ++ print-radius.c \ ++ print-raw.c \ ++ print-rsvp.c \ ++ print-rt6.c \ ++ print-rtsp.c \ ++ print-sip.c \ ++ print-sll.c \ ++ print-smtp.c \ ++ print-snmp.c \ ++ print-stp.c \ ++ print-sunrpc.c \ ++ print-syslog.c \ ++ print-tcp.c \ ++ print-telnet.c \ ++ print-tftp.c \ ++ print-udp.c \ ++ signature.c \ ++ strtoaddr.c \ ++ util-print.c + +else + - CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \ - nlpid.c l2vpn.c machdep.c parsenfsfh.c in_cksum.c \ - print-802_11.c print-802_15_4.c print-ap1394.c print-ah.c \ -@@ -103,6 +119,8 @@ LIBNETDISSECT_SRC=print-isakmp.c - LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) - LIBNETDISSECT=libnetdissect.a + CSRC = setsignal.c tcpdump.c util.c + + LIBNETDISSECT_SRC=\ +@@ -236,12 +312,16 @@ LIBNETDISSECT_SRC=\ + strtoaddr.c \ + util-print.c +endif + LOCALSRC = @LOCALSRC@ GENSRC = version.c LIBOBJS = @LIBOBJS@ -@@ -286,10 +304,12 @@ $(PROG): $(OBJ) @V_PCAPDEP@ + ++ifndef TCPDUMP_MINI + LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS} + LIBNETDISSECT=libnetdissect.a ++endif + + + SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC) +@@ -367,10 +447,12 @@ $(PROG): $(OBJ) @V_PCAPDEP@ @rm -f $@ $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) +ifndef TCPDUMP_MINI $(LIBNETDISSECT): $(LIBNETDISSECT_OBJ) @rm -f $@ - $(AR) cr $@ $(LIBNETDISSECT_OBJ) + $(AR) cr $@ $(LIBNETDISSECT_OBJ) $(RANLIB) $@ +endif @@ -47,28 +115,26 @@ $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c --- a/addrtoname.c +++ b/addrtoname.c -@@ -556,10 +556,10 @@ linkaddr_string(const u_char *ep, const - +@@ -564,8 +564,10 @@ linkaddr_string(netdissect_options *ndo, if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) - return (etheraddr_string(ep)); -- + return (etheraddr_string(ndo, ep)); + +#ifndef TCPDUMP_MINI if (type == LINKADDR_FRELAY) - return (q922_string(ep)); -- + return (q922_string(ndo, ep, len)); +#endif - tp = lookup_bytestring(ep, len); + + tp = lookup_bytestring(ndo, ep, len); if (tp->e_name) - return (tp->e_name); -@@ -1159,6 +1159,7 @@ init_addrtoname(u_int32_t localnet, u_in - init_ipxsaparray(); +@@ -1200,6 +1202,7 @@ init_addrtoname(netdissect_options *ndo, + init_ipxsaparray(ndo); } +#ifndef TCPDUMP_MINI const char * - dnaddr_string(u_short dnaddr) + dnaddr_string(netdissect_options *ndo, u_short dnaddr) { -@@ -1178,6 +1179,7 @@ dnaddr_string(u_short dnaddr) +@@ -1219,6 +1222,7 @@ dnaddr_string(netdissect_options *ndo, u return(tp->name); } @@ -76,31 +142,118 @@ /* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */ struct hnamemem * +--- a/print.c ++++ b/print.c +@@ -48,6 +48,7 @@ static const struct printer printers[] = + #ifdef DLT_IPNET + { ipnet_if_print, DLT_IPNET }, + #endif ++#ifndef TCPDUMP_MINI + #ifdef DLT_IEEE802_15_4 + { ieee802_15_4_if_print, DLT_IEEE802_15_4 }, + #endif +@@ -57,12 +58,14 @@ static const struct printer printers[] = + #ifdef DLT_PPI + { ppi_if_print, DLT_PPI }, + #endif ++#endif + #ifdef DLT_NETANALYZER + { netanalyzer_if_print, DLT_NETANALYZER }, + #endif + #ifdef DLT_NETANALYZER_TRANSPARENT + { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT }, + #endif ++#ifndef TCPDUMP_MINI + #if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H) + { nflog_if_print, DLT_NFLOG}, + #endif +@@ -75,10 +78,12 @@ static const struct printer printers[] = + #ifdef DLT_IP_OVER_FC + { ipfc_if_print, DLT_IP_OVER_FC }, + #endif ++#endif + { null_if_print, DLT_NULL }, + #ifdef DLT_LOOP + { null_if_print, DLT_LOOP }, + #endif ++#ifndef TCPDUMP_MINI + #ifdef DLT_APPLE_IP_OVER_IEEE1394 + { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 }, + #endif +@@ -92,7 +97,9 @@ static const struct printer printers[] = + #ifdef DLT_ARCNET_LINUX + { arcnet_linux_if_print, DLT_ARCNET_LINUX }, + #endif ++#endif + { raw_if_print, DLT_RAW }, ++#ifndef TCPDUMP_MINI + #ifdef DLT_IPV4 + { raw_if_print, DLT_IPV4 }, + #endif +@@ -116,17 +123,21 @@ static const struct printer printers[] = + #ifdef DLT_HDLC + { chdlc_if_print, DLT_HDLC }, + #endif ++#endif + #ifdef DLT_PPP_ETHER + { pppoe_if_print, DLT_PPP_ETHER }, + #endif ++#ifndef TCPDUMP_MINI + #if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H) + { pflog_if_print, DLT_PFLOG }, + #endif + { token_if_print, DLT_IEEE802 }, + { fddi_if_print, DLT_FDDI }, ++#endif + #ifdef DLT_LINUX_SLL + { sll_if_print, DLT_LINUX_SLL }, + #endif ++#ifndef TCPDUMP_MINI + #ifdef DLT_FR + { fr_if_print, DLT_FR }, + #endif +@@ -198,6 +209,7 @@ static const struct printer printers[] = + #ifdef DLT_PKTAP + { pktap_if_print, DLT_PKTAP }, + #endif ++#endif + #ifdef DLT_IEEE802_11_RADIO + { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO }, + #endif +@@ -214,12 +226,14 @@ static const struct printer printers[] = + #ifdef DLT_PPP_WITHDIRECTION + { ppp_if_print, DLT_PPP_WITHDIRECTION }, + #endif ++#ifndef TCPDUMP_MINI + #ifdef DLT_PPP_BSDOS + { ppp_bsdos_if_print, DLT_PPP_BSDOS }, + #endif + #ifdef DLT_PPP_SERIAL + { ppp_hdlc_if_print, DLT_PPP_SERIAL }, + #endif ++#endif + { NULL, 0 }, + }; + --- a/print-ether.c +++ b/print-ether.c -@@ -342,6 +342,7 @@ ethertype_print(netdissect_options *ndo, - arp_print(ndo, p, length, caplen); +@@ -332,6 +332,7 @@ ethertype_print(netdissect_options *ndo, + arp_print(ndo, p, length, caplen); return (1); +#ifndef TCPDUMP_MINI case ETHERTYPE_DN: - decnet_print(/*ndo,*/p, length, caplen); - return (1); -@@ -360,10 +361,13 @@ ethertype_print(netdissect_options *ndo, - ND_PRINT((ndo, "(NOV-ETHII) ")); - ipx_print(/*ndo,*/p, length); + decnet_print(ndo, p, length, caplen); return (1); -+#endif - -+#ifndef TCPDUMP_MINI - case ETHERTYPE_ISO: - isoclns_print(/*ndo,*/p+1, length-1, length-1); - return(1); +@@ -354,6 +355,7 @@ ethertype_print(netdissect_options *ndo, + case ETHERTYPE_ISO: + isoclns_print(ndo, p + 1, length - 1, length - 1); + return(1); +#endif case ETHERTYPE_PPPOED: case ETHERTYPE_PPPOES: -@@ -376,9 +380,11 @@ ethertype_print(netdissect_options *ndo, +@@ -366,9 +368,11 @@ ethertype_print(netdissect_options *ndo, eap_print(ndo, p, length); return (1); @@ -112,348 +265,348 @@ case ETHERTYPE_PPP: if (length) { -@@ -387,6 +393,7 @@ ethertype_print(netdissect_options *ndo, +@@ -377,6 +381,7 @@ ethertype_print(netdissect_options *ndo, } return (1); +#ifndef TCPDUMP_MINI case ETHERTYPE_MPCP: - mpcp_print(/*ndo,*/p, length); + mpcp_print(ndo, p, length); return (1); -@@ -399,7 +406,7 @@ ethertype_print(netdissect_options *ndo, +@@ -389,6 +394,7 @@ ethertype_print(netdissect_options *ndo, case ETHERTYPE_CFM_OLD: - cfm_print(/*ndo,*/p, length); + cfm_print(ndo, p, length); return (1); -- +#endif + case ETHERTYPE_LLDP: - lldp_print(/*ndo,*/p, length); - return (1); -@@ -407,6 +414,7 @@ ethertype_print(netdissect_options *ndo, - case ETHERTYPE_LOOPBACK: + lldp_print(ndo, p, length); +@@ -398,6 +404,7 @@ ethertype_print(netdissect_options *ndo, + loopback_print(ndo, p, length); return (1); +#ifndef TCPDUMP_MINI case ETHERTYPE_MPLS: case ETHERTYPE_MPLS_MULTI: - mpls_print(/*ndo,*/p, length); -@@ -428,6 +436,7 @@ ethertype_print(netdissect_options *ndo, - case ETHERTYPE_CALM_FAST: - calm_fast_print(ndo, p-14, p, length); - return (1); + mpls_print(ndo, p, length); +@@ -427,6 +434,7 @@ ethertype_print(netdissect_options *ndo, + case ETHERTYPE_MEDSA: + medsa_print(ndo, p, length, caplen); + return (1); +#endif case ETHERTYPE_LAT: case ETHERTYPE_SCA: --- a/print-gre.c +++ b/print-gre.c -@@ -213,6 +213,7 @@ gre_print_0(const u_char *bp, u_int leng - ip6_print(gndo, bp, len); +@@ -203,6 +203,7 @@ gre_print_0(netdissect_options *ndo, con + case ETHERTYPE_IPV6: + ip6_print(ndo, bp, len); break; - #endif +#ifndef TCPDUMP_MINI case ETHERTYPE_MPLS: - mpls_print(bp, len); + mpls_print(ndo, bp, len); break; -@@ -228,6 +229,7 @@ gre_print_0(const u_char *bp, u_int leng +@@ -218,6 +219,7 @@ gre_print_0(netdissect_options *ndo, con case ETHERTYPE_TEB: - ether_print(gndo, bp, len, len, NULL, NULL); + ether_print(ndo, bp, len, len, NULL, NULL); break; +#endif default: - printf("gre-proto-0x%x", prot); + ND_PRINT((ndo, "gre-proto-0x%x", prot)); } --- a/print-igmp.c +++ b/print-igmp.c -@@ -309,6 +309,7 @@ igmp_print(register const u_char *bp, re - TCHECK2(bp[4], 4); - (void)printf("igmp leave %s", ipaddr_string(&bp[4])); +@@ -304,6 +304,7 @@ igmp_print(netdissect_options *ndo, + ND_TCHECK2(bp[4], 4); + ND_PRINT((ndo, "igmp leave %s", ipaddr_string(ndo, &bp[4]))); break; +#ifndef TCPDUMP_MINI case 0x13: - (void)printf("igmp dvmrp"); + ND_PRINT((ndo, "igmp dvmrp")); if (len < 8) -@@ -320,6 +321,7 @@ igmp_print(register const u_char *bp, re - (void)printf("igmp pimv1"); - pimv1_print(bp, len); +@@ -315,6 +316,7 @@ igmp_print(netdissect_options *ndo, + ND_PRINT((ndo, "igmp pimv1")); + pimv1_print(ndo, bp, len); break; +#endif case 0x1e: - print_mresp(bp, len); + print_mresp(ndo, bp, len); break; +--- a/print-ip6.c ++++ b/print-ip6.c +@@ -297,6 +297,7 @@ ip6_print(netdissect_options *ndo, const + advance = dstopt_print(ndo, cp); + nh = *cp; + break; ++#ifndef TCPDUMP_MINI + case IPPROTO_FRAGMENT: + advance = frag6_print(ndo, cp, (const u_char *)ip6); + if (ndo->ndo_snapend <= cp + advance) +@@ -318,16 +319,19 @@ ip6_print(netdissect_options *ndo, const + advance = mobility_print(ndo, cp, (const u_char *)ip6); + nh = *cp; + return; ++#endif + case IPPROTO_ROUTING: + advance = rt6_print(ndo, cp, (const u_char *)ip6); + nh = *cp; + break; ++#ifndef TCPDUMP_MINI + case IPPROTO_SCTP: + sctp_print(ndo, cp, (const u_char *)ip6, len); + return; + case IPPROTO_DCCP: + dccp_print(ndo, cp, (const u_char *)ip6, len); + return; ++#endif + case IPPROTO_TCP: + tcp_print(ndo, cp, len, (const u_char *)ip6, fragmented); + return; +@@ -337,6 +341,7 @@ ip6_print(netdissect_options *ndo, const + case IPPROTO_ICMPV6: + icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented); + return; ++#ifndef TCPDUMP_MINI + case IPPROTO_AH: + advance = ah_print(ndo, cp); + nh = *cp; +@@ -360,6 +365,7 @@ ip6_print(netdissect_options *ndo, const + case IPPROTO_PIM: + pim_print(ndo, cp, len, (const u_char *)ip6); + return; ++#endif + + case IPPROTO_OSPF: + ospf6_print(ndo, cp, len); +@@ -373,9 +379,11 @@ ip6_print(netdissect_options *ndo, const + ip_print(ndo, cp, len); + return; + ++#ifndef TCPDUMP_MINI + case IPPROTO_PGM: + pgm_print(ndo, cp, len, (const u_char *)ip6); + return; ++#endif + + case IPPROTO_GRE: + gre_print(ndo, cp, len); --- a/print-ip.c +++ b/print-ip.c -@@ -328,6 +328,7 @@ ip_print_demux(netdissect_options *ndo, +@@ -327,6 +327,7 @@ ip_print_demux(netdissect_options *ndo, again: switch (ipds->nh) { +#ifndef TCPDUMP_MINI case IPPROTO_AH: ipds->nh = *ipds->cp; - ipds->advance = ah_print(ipds->cp); -@@ -362,15 +363,15 @@ again: + ipds->advance = ah_print(ndo, ipds->cp); +@@ -361,7 +362,9 @@ again: ipds->nh = enh & 0xff; goto again; } -- +#endif + ++#ifndef TCPDUMP_MINI case IPPROTO_SCTP: - sctp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len); + sctp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len); break; -- -+#ifndef TCPDUMP_MINI +@@ -369,6 +372,7 @@ again: case IPPROTO_DCCP: - dccp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len); + dccp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len); break; -- +#endif + case IPPROTO_TCP: /* pass on the MF bit plus the offset to detect fragments */ - tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip, -@@ -388,7 +389,7 @@ again: - icmp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip, +@@ -388,6 +392,7 @@ again: ipds->off & (IP_MF|IP_OFFMASK)); break; -- + +#ifndef TCPDUMP_MINI case IPPROTO_PIGP: /* * XXX - the current IANA protocol number assignments -@@ -409,15 +410,15 @@ again: +@@ -408,14 +413,17 @@ again: case IPPROTO_EIGRP: - eigrp_print(ipds->cp, ipds->len); + eigrp_print(ndo, ipds->cp, ipds->len); break; -- +#endif + case IPPROTO_ND: ND_PRINT((ndo, " nd %d", ipds->len)); break; -- + +#ifndef TCPDUMP_MINI case IPPROTO_EGP: - egp_print(ipds->cp, ipds->len); + egp_print(ndo, ipds->cp, ipds->len); break; -- +#endif + case IPPROTO_OSPF: - ospf_print(ipds->cp, ipds->len, (const u_char *)ipds->ip); - break; -@@ -451,10 +452,10 @@ again: - gre_print(ipds->cp, ipds->len); + ospf_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip); +@@ -448,6 +456,7 @@ again: + gre_print(ndo, ipds->cp, ipds->len); break; +#ifndef TCPDUMP_MINI case IPPROTO_MOBILE: - mobile_print(ipds->cp, ipds->len); + mobile_print(ndo, ipds->cp, ipds->len); break; -- - case IPPROTO_PIM: - vec[0].ptr = ipds->cp; - vec[0].len = ipds->len; -@@ -480,7 +481,7 @@ again: +@@ -476,6 +485,7 @@ again: case IPPROTO_PGM: - pgm_print(ipds->cp, ipds->len, (const u_char *)ipds->ip); + pgm_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip); break; -- +#endif + default: if (ndo->ndo_nflag==0 && (proto = getprotobynumber(ipds->nh)) != NULL) - ND_PRINT((ndo, " %s", proto->p_name)); ---- a/print-ip6.c -+++ b/print-ip6.c -@@ -192,9 +192,11 @@ ip6_print(netdissect_options *ndo, const - case IPPROTO_SCTP: - sctp_print(cp, (const u_char *)ip6, len); - return; -+#ifndef TCPDUMP_MINI - case IPPROTO_DCCP: - dccp_print(cp, (const u_char *)ip6, len); - return; -+#endif - case IPPROTO_TCP: - tcp_print(cp, len, (const u_char *)ip6, fragmented); - return; -@@ -204,6 +206,7 @@ ip6_print(netdissect_options *ndo, const - case IPPROTO_ICMPV6: - icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented); - return; -+#ifndef TCPDUMP_MINI - case IPPROTO_AH: - advance = ah_print(cp); - nh = *cp; -@@ -228,7 +231,7 @@ ip6_print(netdissect_options *ndo, const - pim_print(cp, len, nextproto6_cksum(ip6, cp, len, - IPPROTO_PIM)); - return; -- -+#endif - case IPPROTO_OSPF: - ospf6_print(cp, len); - return; -@@ -240,11 +243,11 @@ ip6_print(netdissect_options *ndo, const - case IPPROTO_IPV4: - ip_print(ndo, cp, len); - return; -- -+#ifndef TCPDUMP_MINI - case IPPROTO_PGM: - pgm_print(cp, len, (const u_char *)ip6); - return; -- -+#endif - case IPPROTO_GRE: - gre_print(cp, len); - return; --- a/print-llc.c +++ b/print-llc.c -@@ -196,7 +196,7 @@ llc_print(const u_char *p, u_int length, - control = EXTRACT_LE_16BITS(p + 2); - is_u = 0; +@@ -204,6 +204,7 @@ llc_print(netdissect_options *ndo, const + hdrlen = 4; /* DSAP, SSAP, 2-byte control field */ } -- + +#ifndef TCPDUMP_MINI if (ssap_field == LLCSAP_GLOBAL && dsap_field == LLCSAP_GLOBAL) { /* * This is an Ethernet_802.3 IPX frame; it has an -@@ -219,6 +219,7 @@ llc_print(const u_char *p, u_int length, - ipx_print(p, length); - return (1); +@@ -226,6 +227,7 @@ llc_print(netdissect_options *ndo, const + ipx_print(ndo, p, length); + return (0); /* no LLC header */ } +#endif dsap = dsap_field & ~LLC_IG; ssap = ssap_field & ~LLC_GSAP; -@@ -251,6 +252,7 @@ llc_print(const u_char *p, u_int length, - return (1); +@@ -289,6 +291,7 @@ llc_print(netdissect_options *ndo, const + return (hdrlen); } +#ifndef TCPDUMP_MINI if (ssap == LLCSAP_IPX && dsap == LLCSAP_IPX && control == LLC_UI) { /* -@@ -266,6 +268,7 @@ llc_print(const u_char *p, u_int length, - ipx_print(p+3, length-3); - return (1); +@@ -302,6 +305,7 @@ llc_print(netdissect_options *ndo, const + ipx_print(ndo, p, length); + return (hdrlen); } +#endif - #ifdef TCPDUMP_DO_SMB + #ifdef ENABLE_SMB if (ssap == LLCSAP_NETBEUI && dsap == LLCSAP_NETBEUI -@@ -297,11 +300,13 @@ llc_print(const u_char *p, u_int length, - return (1); +@@ -320,11 +324,13 @@ llc_print(netdissect_options *ndo, const + return (hdrlen); } #endif +#ifndef TCPDUMP_MINI if (ssap == LLCSAP_ISONS && dsap == LLCSAP_ISONS && control == LLC_UI) { - isoclns_print(p + 3, length - 3, caplen - 3); - return (1); + isoclns_print(ndo, p, length, caplen); + return (hdrlen); } +#endif - if (ssap == LLCSAP_SNAP && dsap == LLCSAP_SNAP - && control == LLC_UI) { -@@ -444,6 +449,7 @@ snap_print(const u_char *p, u_int length - case PID_CISCO_CDP: - cdp_print(p, length, caplen); - return (1); + if (!ndo->ndo_eflag) { + if (ssap == dsap) { +@@ -458,6 +464,7 @@ snap_print(netdissect_options *ndo, cons + + case OUI_CISCO: + switch (et) { +#ifndef TCPDUMP_MINI - case PID_CISCO_DTP: - dtp_print(p, length); + case PID_CISCO_CDP: + cdp_print(ndo, p, length, caplen); return (1); -@@ -453,6 +459,7 @@ snap_print(const u_char *p, u_int length +@@ -470,6 +477,7 @@ snap_print(netdissect_options *ndo, cons case PID_CISCO_VTP: - vtp_print(p, length); + vtp_print(ndo, p, length); return (1); +#endif case PID_CISCO_PVST: case PID_CISCO_VLANBRIDGE: - stp_print(p, length); -@@ -484,6 +491,7 @@ snap_print(const u_char *p, u_int length - ether_print(gndo, p, length, caplen, NULL, NULL); - return (1); + stp_print(ndo, p, length); +@@ -482,6 +490,7 @@ snap_print(netdissect_options *ndo, cons + case OUI_RFC2684: + switch (et) { +#ifndef TCPDUMP_MINI - case PID_RFC2684_802_5_FCS: - case PID_RFC2684_802_5_NOFCS: + case PID_RFC2684_ETH_FCS: + case PID_RFC2684_ETH_NOFCS: /* -@@ -525,6 +533,7 @@ snap_print(const u_char *p, u_int length +@@ -543,6 +552,7 @@ snap_print(netdissect_options *ndo, cons */ - fddi_print(p, length, caplen); + fddi_print(ndo, p, length, caplen); return (1); +#endif case PID_RFC2684_BPDU: - stp_print(p, length); + stp_print(ndo, p, length); --- a/print-null.c +++ b/print-null.c -@@ -128,7 +128,7 @@ null_if_print(const struct pcap_pkthdr * - ip6_print(gndo, p, length); +@@ -114,6 +114,7 @@ null_if_print(netdissect_options *ndo, c + ip6_print(ndo, p, length); break; - #endif -- + +#ifndef TCPDUMP_MINI case BSD_AFNUM_ISO: - isoclns_print(p, length, caplen); + isoclns_print(ndo, p, length, caplen); break; -@@ -140,7 +140,7 @@ null_if_print(const struct pcap_pkthdr * +@@ -125,6 +126,7 @@ null_if_print(netdissect_options *ndo, c case BSD_AFNUM_IPX: - ipx_print(p, length); + ipx_print(ndo, p, length); break; -- +#endif + default: /* unknown AF_ value */ - if (!eflag) --- a/print-ppp.c +++ b/print-ppp.c -@@ -1262,7 +1262,7 @@ trunc: +@@ -1346,6 +1346,7 @@ trunc: return 0; } -- +#ifndef TCPDUMP_MINI static void - ppp_hdlc(const u_char *p, int length) - { -@@ -1327,17 +1327,19 @@ cleanup: + ppp_hdlc(netdissect_options *ndo, + const u_char *p, int length) +@@ -1424,6 +1425,7 @@ trunc: free(b); - return; + ND_PRINT((ndo, "[|ppp]")); } +#endif /* PPP */ - static void - handle_ppp(u_int proto, const u_char *p, int length) +@@ -1431,10 +1433,12 @@ static void + handle_ppp(netdissect_options *ndo, + u_int proto, const u_char *p, int length) { +#ifndef TCPDUMP_MINI - if ((proto & 0xff00) == 0x7e00) {/* is this an escape code ? */ - ppp_hdlc(p-1, length); - return; - } -- + if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */ + ppp_hdlc(ndo, p - 1, length); + return; + } +#endif + switch (proto) { case PPP_LCP: /* fall through */ - case PPP_IPCP: -@@ -1371,6 +1373,7 @@ handle_ppp(u_int proto, const u_char *p, - ip6_print(gndo, p, length); +@@ -1467,6 +1471,7 @@ handle_ppp(netdissect_options *ndo, + case PPP_IPV6: + ip6_print(ndo, p, length); break; - #endif +#ifndef TCPDUMP_MINI case ETHERTYPE_IPX: /*XXX*/ case PPP_IPX: - ipx_print(p, length); -@@ -1382,6 +1385,7 @@ handle_ppp(u_int proto, const u_char *p, + ipx_print(ndo, p, length); +@@ -1478,6 +1483,7 @@ handle_ppp(netdissect_options *ndo, case PPP_MPLS_MCAST: - mpls_print(p, length); + mpls_print(ndo, p, length); break; +#endif case PPP_COMP: - printf("compressed PPP data"); + ND_PRINT((ndo, "compressed PPP data")); break; -@@ -1520,6 +1524,7 @@ ppp_if_print(const struct pcap_pkthdr *h +@@ -1618,6 +1624,7 @@ ppp_if_print(netdissect_options *ndo, return (0); } @@ -461,384 +614,263 @@ /* * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547, -@@ -1747,7 +1752,7 @@ printx: +@@ -1840,6 +1847,7 @@ printx: #endif /* __bsdi__ */ return (hdrlength); } -- +#endif + /* - * Local Variables: +--- a/print-sll.c ++++ b/print-sll.c +@@ -236,12 +236,14 @@ recurse: + */ + switch (ether_type) { + ++#ifndef TCPDUMP_MINI + case LINUX_SLL_P_802_3: + /* + * Ethernet_802.3 IPX frame. + */ + ipx_print(ndo, p, length); + break; ++#endif + + case LINUX_SLL_P_802_2: + /* --- a/print-tcp.c +++ b/print-tcp.c -@@ -573,14 +573,14 @@ tcp_print(register const u_char *bp, reg - utoval >>= 1; - (void)printf(" %u", utoval); +@@ -565,12 +565,14 @@ tcp_print(netdissect_options *ndo, + ND_PRINT((ndo, " %u", utoval)); break; -- + +#ifndef TCPDUMP_MINI case TCPOPT_MPTCP: datalen = len - 2; LENCHECK(datalen); - if (!mptcp_print(cp-2, len, flags)) + if (!mptcp_print(ndo, cp-2, len, flags)) goto bad; break; -- +#endif - case TCPOPT_EXPERIMENT2: + + case TCPOPT_FASTOPEN: datalen = len - 2; - LENCHECK(datalen); -@@ -659,8 +659,8 @@ tcp_print(register const u_char *bp, reg - if ((flags & TH_RST) && vflag) { - print_tcp_rst_data(bp, length); +@@ -645,6 +647,7 @@ tcp_print(netdissect_options *ndo, return; -- } -- -+ } + } + +#ifndef TCPDUMP_MINI - if (packettype) { - switch (packettype) { + if (ndo->ndo_packettype) { + switch (ndo->ndo_packettype) { case PT_ZMTP1: -@@ -669,7 +669,7 @@ tcp_print(register const u_char *bp, reg +@@ -656,28 +659,36 @@ tcp_print(netdissect_options *ndo, } return; } -- -+#endif - if (sport == TELNET_PORT || dport == TELNET_PORT) { - if (!qflag && vflag) - telnet_print(bp, length); -@@ -683,10 +683,12 @@ tcp_print(register const u_char *bp, reg - else if (sport == SMB_PORT || dport == SMB_PORT) - smb_tcp_print(bp, length); ++#endif + + if (IS_SRC_OR_DST_PORT(TELNET_PORT)) { + telnet_print(ndo, bp, length); + } else if (IS_SRC_OR_DST_PORT(SMTP_PORT)) { + ND_PRINT((ndo, ": ")); + smtp_print(ndo, bp, length); +- } else if (IS_SRC_OR_DST_PORT(BGP_PORT)) ++ } ++#ifndef TCPDUMP_MINI ++ else if (IS_SRC_OR_DST_PORT(BGP_PORT)) + bgp_print(ndo, bp, length); ++#endif + else if (IS_SRC_OR_DST_PORT(PPTP_PORT)) + pptp_print(ndo, bp); ++#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(REDIS_PORT)) + resp_print(ndo, bp, length); ++#endif + #ifdef ENABLE_SMB + else if (IS_SRC_OR_DST_PORT(NETBIOS_SSN_PORT)) + nbt_tcp_print(ndo, bp, length); + else if (IS_SRC_OR_DST_PORT(SMB_PORT)) + smb_tcp_print(ndo, bp, length); #endif +#ifndef TCPDUMP_MINI - else if (sport == BEEP_PORT || dport == BEEP_PORT) - beep_print(bp, length); - else if (sport == OPENFLOW_PORT || dport == OPENFLOW_PORT) - openflow_print(bp, length); + else if (IS_SRC_OR_DST_PORT(BEEP_PORT)) + beep_print(ndo, bp, length); + else if (IS_SRC_OR_DST_PORT(OPENFLOW_PORT_OLD) || IS_SRC_OR_DST_PORT(OPENFLOW_PORT_IANA)) + openflow_print(ndo, bp, length); +#endif - else if (length > 2 && - (sport == NAMESERVER_PORT || dport == NAMESERVER_PORT || - sport == MULTICASTDNS_PORT || dport == MULTICASTDNS_PORT)) { -@@ -695,6 +697,7 @@ tcp_print(register const u_char *bp, reg + else if (IS_SRC_OR_DST_PORT(FTP_PORT)) { + ND_PRINT((ndo, ": ")); + ftp_print(ndo, bp, length); +@@ -694,6 +705,7 @@ tcp_print(netdissect_options *ndo, * XXX packet could be unaligned, it can go strange */ - ns_print(bp + 2, length - 2, 0); + ns_print(ndo, bp + 2, length - 2, 0); +#ifndef TCPDUMP_MINI - } else if (sport == MSDP_PORT || dport == MSDP_PORT) { - msdp_print(bp, length); - } else if (sport == RPKI_RTR_PORT || dport == RPKI_RTR_PORT) { -@@ -702,6 +705,7 @@ tcp_print(register const u_char *bp, reg + } else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) { + msdp_print(ndo, bp, length); + } else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) { +@@ -701,6 +713,7 @@ tcp_print(netdissect_options *ndo, } - else if (length > 0 && (sport == LDP_PORT || dport == LDP_PORT)) { - ldp_print(bp, length); + else if (length > 0 && (IS_SRC_OR_DST_PORT(LDP_PORT))) { + ldp_print(ndo, bp, length); +#endif } - else if ((sport == NFS_PORT || dport == NFS_PORT) && - length >= 4 && TTEST2(*bp, 4)) { + else if ((IS_SRC_OR_DST_PORT(NFS_PORT)) && + length >= 4 && ND_TTEST2(*bp, 4)) { --- a/print-udp.c +++ b/print-udp.c -@@ -418,11 +418,12 @@ udp_print(register const u_char *bp, u_i - vat_print((void *)(up + 1), up); +@@ -397,10 +397,12 @@ udp_print(netdissect_options *ndo, regis + vat_print(ndo, (const void *)(up + 1), up); break; +#ifndef TCPDUMP_MINI case PT_WB: - udpipaddr_print(ip, sport, dport); - wb_print((void *)(up + 1), length); + udpipaddr_print(ndo, ip, sport, dport); + wb_print(ndo, (const void *)(up + 1), length); break; -- +#endif + case PT_RPC: - rp = (struct sunrpc_msg *)(up + 1); - direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction); -@@ -450,11 +451,12 @@ udp_print(register const u_char *bp, u_i - snmp_print((const u_char *)(up + 1), length); + rp = (const struct sunrpc_msg *)(up + 1); +@@ -429,10 +431,12 @@ udp_print(netdissect_options *ndo, regis + snmp_print(ndo, (const u_char *)(up + 1), length); break; +#ifndef TCPDUMP_MINI case PT_CNFP: - udpipaddr_print(ip, sport, dport); - cnfp_print(cp, (const u_char *)ip); + udpipaddr_print(ndo, ip, sport, dport); + cnfp_print(ndo, cp); break; -- +#endif + case PT_TFTP: - udpipaddr_print(ip, sport, dport); - tftp_print(cp, length); -@@ -475,6 +477,7 @@ udp_print(register const u_char *bp, u_i - radius_print(cp, length); + udpipaddr_print(ndo, ip, sport, dport); +@@ -450,6 +454,7 @@ udp_print(netdissect_options *ndo, regis + radius_print(ndo, cp, length); break; +#ifndef TCPDUMP_MINI case PT_VXLAN: - udpipaddr_print(ip, sport, dport); - vxlan_print((const u_char *)(up + 1), length); -@@ -489,6 +492,7 @@ udp_print(register const u_char *bp, u_i - udpipaddr_print(ip, sport, dport); - lmp_print(cp, length); + udpipaddr_print(ndo, ip, sport, dport); + vxlan_print(ndo, (const u_char *)(up + 1), length); +@@ -464,6 +469,7 @@ udp_print(netdissect_options *ndo, regis + udpipaddr_print(ndo, ip, sport, dport); + lmp_print(ndo, cp, length); break; +#endif } return; } -@@ -517,6 +521,7 @@ udp_print(register const u_char *bp, u_i - } - #endif - } +@@ -541,31 +547,40 @@ udp_print(netdissect_options *ndo, regis + ns_print(ndo, (const u_char *)(up + 1), length, 0); + else if (IS_SRC_OR_DST_PORT(MULTICASTDNS_PORT)) + ns_print(ndo, (const u_char *)(up + 1), length, 1); +#ifndef TCPDUMP_MINI - if (TTEST(((struct LAP *)cp)->type) && - ((struct LAP *)cp)->type == lapDDP && - (atalk_port(sport) || atalk_port(dport))) { -@@ -525,6 +530,7 @@ udp_print(register const u_char *bp, u_i - llap_print(cp, length); - return; - } + else if (IS_SRC_OR_DST_PORT(TIMED_PORT)) + timed_print(ndo, (const u_char *)(up + 1)); +#endif - } - udpipaddr_print(ip, sport, dport); - -@@ -575,14 +581,18 @@ udp_print(register const u_char *bp, u_i - ns_print((const u_char *)(up + 1), length, 0); - else if (ISPORT(MULTICASTDNS_PORT)) - ns_print((const u_char *)(up + 1), length, 1); -+#ifndef TCPDUMP_MINI - else if (ISPORT(TIMED_PORT)) - timed_print((const u_char *)(up + 1)); -+#endif - else if (ISPORT(TFTP_PORT)) - tftp_print((const u_char *)(up + 1), length); - else if (ISPORT(IPPORT_BOOTPC) || ISPORT(IPPORT_BOOTPS)) - bootp_print((const u_char *)(up + 1), length); -+#ifndef TCPDUMP_MINI - else if (ISPORT(RIP_PORT)) - rip_print((const u_char *)(up + 1), length); -+#endif - else if (ISPORT(AODV_PORT)) - aodv_print((const u_char *)(up + 1), length, - #ifdef INET6 -@@ -590,6 +600,7 @@ udp_print(register const u_char *bp, u_i - #else - 0); - #endif + else if (IS_SRC_OR_DST_PORT(TFTP_PORT)) + tftp_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(BOOTPC_PORT) || IS_SRC_OR_DST_PORT(BOOTPS_PORT)) + bootp_print(ndo, (const u_char *)(up + 1), length); ++#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(RIP_PORT)) + rip_print(ndo, (const u_char *)(up + 1), length); ++#endif + else if (IS_SRC_OR_DST_PORT(AODV_PORT)) + aodv_print(ndo, (const u_char *)(up + 1), length, + ip6 != NULL); +#ifndef TCPDUMP_MINI - else if (ISPORT(ISAKMP_PORT)) - isakmp_print(gndo, (const u_char *)(up + 1), length, bp2); - else if (ISPORT(ISAKMP_PORT_NATT)) -@@ -598,12 +609,15 @@ udp_print(register const u_char *bp, u_i - else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2)) - isakmp_print(gndo, (const u_char *)(up + 1), length, bp2); + else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT)) + isakmp_print(ndo, (const u_char *)(up + 1), length, bp2); ++ + else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_NATT)) + isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2); + #if 1 /*???*/ + else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER1) || IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER2)) + isakmp_print(ndo, (const u_char *)(up + 1), length, bp2); #endif +#endif - else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT)) - snmp_print((const u_char *)(up + 1), length); - else if (ISPORT(NTP_PORT)) - ntp_print((const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(SNMP_PORT) || IS_SRC_OR_DST_PORT(SNMPTRAP_PORT)) + snmp_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(NTP_PORT)) + ntp_print(ndo, (const u_char *)(up + 1), length); +#ifndef TCPDUMP_MINI - else if (ISPORT(KERBEROS_PORT) || ISPORT(KERBEROS_SEC_PORT)) - krb_print((const void *)(up + 1)); + else if (IS_SRC_OR_DST_PORT(KERBEROS_PORT) || IS_SRC_OR_DST_PORT(KERBEROS_SEC_PORT)) + krb_print(ndo, (const void *)(up + 1)); +#endif - else if (ISPORT(L2TP_PORT)) - l2tp_print((const u_char *)(up + 1), length); - #ifdef TCPDUMP_DO_SMB -@@ -614,6 +628,7 @@ udp_print(register const u_char *bp, u_i + else if (IS_SRC_OR_DST_PORT(L2TP_PORT)) + l2tp_print(ndo, (const u_char *)(up + 1), length); + #ifdef ENABLE_SMB +@@ -576,6 +591,7 @@ udp_print(netdissect_options *ndo, regis #endif else if (dport == VAT_PORT) - vat_print((const void *)(up + 1), up); + vat_print(ndo, (const void *)(up + 1), up); +#ifndef TCPDUMP_MINI - else if (ISPORT(ZEPHYR_SRV_PORT) || ISPORT(ZEPHYR_CLT_PORT)) - zephyr_print((const void *)(up + 1), length); - /* -@@ -624,6 +639,7 @@ udp_print(register const u_char *bp, u_i - (dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH)) - rx_print((const void *)(up + 1), length, sport, dport, - (u_char *) ip); -+#endif - #ifdef INET6 - else if (ISPORT(RIPNG_PORT)) - ripng_print((const u_char *)(up + 1), length); -@@ -635,21 +651,25 @@ udp_print(register const u_char *bp, u_i + else if (IS_SRC_OR_DST_PORT(ZEPHYR_SRV_PORT) || IS_SRC_OR_DST_PORT(ZEPHYR_CLT_PORT)) + zephyr_print(ndo, (const void *)(up + 1), length); /* - * Kludge in test for whiteboard packets. - */ -+#ifndef TCPDUMP_MINI - else if (dport == WB_PORT) - wb_print((const void *)(up + 1), length); - else if (ISPORT(CISCO_AUTORP_PORT)) - cisco_autorp_print((const void *)(up + 1), length); +@@ -588,8 +604,11 @@ udp_print(netdissect_options *ndo, regis + (const u_char *) ip); + else if (IS_SRC_OR_DST_PORT(RIPNG_PORT)) + ripng_print(ndo, (const u_char *)(up + 1), length); +#endif - else if (ISPORT(RADIUS_PORT) || - ISPORT(RADIUS_NEW_PORT) || - ISPORT(RADIUS_ACCOUNTING_PORT) || - ISPORT(RADIUS_NEW_ACCOUNTING_PORT) ) - radius_print((const u_char *)(up+1), length); ++ + else if (IS_SRC_OR_DST_PORT(DHCP6_SERV_PORT) || IS_SRC_OR_DST_PORT(DHCP6_CLI_PORT)) + dhcp6_print(ndo, (const u_char *)(up + 1), length); ++#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(AHCP_PORT)) + ahcp_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(BABEL_PORT) || IS_SRC_OR_DST_PORT(BABEL_PORT_OLD)) +@@ -603,6 +622,7 @@ udp_print(netdissect_options *ndo, regis + wb_print(ndo, (const void *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(CISCO_AUTORP_PORT)) + cisco_autorp_print(ndo, (const void *)(up + 1), length); ++#endif + else if (IS_SRC_OR_DST_PORT(RADIUS_PORT) || + IS_SRC_OR_DST_PORT(RADIUS_NEW_PORT) || + IS_SRC_OR_DST_PORT(RADIUS_ACCOUNTING_PORT) || +@@ -610,15 +630,18 @@ udp_print(netdissect_options *ndo, regis + IS_SRC_OR_DST_PORT(RADIUS_CISCO_COA_PORT) || + IS_SRC_OR_DST_PORT(RADIUS_COA_PORT) ) + radius_print(ndo, (const u_char *)(up+1), length); +#ifndef TCPDUMP_MINI else if (dport == HSRP_PORT) - hsrp_print((const u_char *)(up + 1), length); - else if (ISPORT(LWRES_PORT)) - lwres_print((const u_char *)(up + 1), length); - else if (ISPORT(LDP_PORT)) - ldp_print((const u_char *)(up + 1), length); -+#endif - else if (ISPORT(OLSR_PORT)) - olsr_print((const u_char *)(up + 1), length, - #if INET6 -@@ -657,6 +677,7 @@ udp_print(register const u_char *bp, u_i - #else - 0); - #endif -+#ifndef TCPDUMP_MINI - else if (ISPORT(MPLS_LSP_PING_PORT)) - lspping_print((const u_char *)(up + 1), length); + hsrp_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(LWRES_PORT)) + lwres_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(LDP_PORT)) + ldp_print(ndo, (const u_char *)(up + 1), length); ++#endif + else if (IS_SRC_OR_DST_PORT(OLSR_PORT)) + olsr_print(ndo, (const u_char *)(up + 1), length, + (IP_V(ip) == 6) ? 1 : 0); ++#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT)) + lspping_print(ndo, (const u_char *)(up + 1), length); else if (dport == BFD_CONTROL_PORT || -@@ -674,14 +695,17 @@ udp_print(register const u_char *bp, u_i - lwapp_control_print((const u_char *)(up + 1), length, 0); - else if (ISPORT(LWAPP_DATA_PORT)) - lwapp_data_print((const u_char *)(up + 1), length); -+#endif - else if (ISPORT(SIP_PORT)) - sip_print((const u_char *)(up + 1), length); - else if (ISPORT(SYSLOG_PORT)) - syslog_print((const u_char *)(up + 1), length); -+#ifndef TCPDUMP_MINI - else if (ISPORT(OTV_PORT)) - otv_print((const u_char *)(up + 1), length); - else if (ISPORT(VXLAN_PORT)) - vxlan_print((const u_char *)(up + 1), length); -+#endif - else - (void)printf("UDP, length %u", - (u_int32_t)(ulen - sizeof(*up))); ---- a/tcpdump.c -+++ b/tcpdump.c -@@ -161,6 +161,7 @@ struct ndo_printer { - - - static struct printer printers[] = { -+#ifndef TCPDUMP_MINI - { arcnet_if_print, DLT_ARCNET }, - #ifdef DLT_ARCNET_LINUX - { arcnet_linux_if_print, DLT_ARCNET_LINUX }, -@@ -179,19 +180,23 @@ static struct printer printers[] = { - #ifdef DLT_SLIP_BSDOS - { sl_bsdos_if_print, DLT_SLIP_BSDOS }, - #endif -+#endif - { ppp_if_print, DLT_PPP }, - #ifdef DLT_PPP_WITHDIRECTION - { ppp_if_print, DLT_PPP_WITHDIRECTION }, - #endif -+#ifndef TCPDUMP_MINI - #ifdef DLT_PPP_BSDOS - { ppp_bsdos_if_print, DLT_PPP_BSDOS }, - #endif - { fddi_if_print, DLT_FDDI }, -+#endif - { null_if_print, DLT_NULL }, - #ifdef DLT_LOOP - { null_if_print, DLT_LOOP }, - #endif - { raw_if_print, DLT_RAW }, -+#ifndef TCPDUMP_MINI - { atm_if_print, DLT_ATM_RFC1483 }, - #ifdef DLT_C_HDLC - { chdlc_if_print, DLT_C_HDLC }, -@@ -202,6 +207,7 @@ static struct printer printers[] = { - #ifdef DLT_PPP_SERIAL - { ppp_hdlc_if_print, DLT_PPP_SERIAL }, - #endif -+#endif - #ifdef DLT_PPP_ETHER - { pppoe_if_print, DLT_PPP_ETHER }, - #endif -@@ -211,6 +217,7 @@ static struct printer printers[] = { - #ifdef DLT_IEEE802_11 - { ieee802_11_if_print, DLT_IEEE802_11}, - #endif -+#ifndef TCPDUMP_MINI - #ifdef DLT_LTALK - { ltalk_if_print, DLT_LTALK }, - #endif -@@ -229,12 +236,14 @@ static struct printer printers[] = { - #ifdef DLT_IP_OVER_FC - { ipfc_if_print, DLT_IP_OVER_FC }, - #endif -+#endif - #ifdef DLT_PRISM_HEADER - { prism_if_print, DLT_PRISM_HEADER }, - #endif - #ifdef DLT_IEEE802_11_RADIO - { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO }, - #endif -+#ifndef TCPDUMP_MINI - #ifdef DLT_ENC - { enc_if_print, DLT_ENC }, - #endif -@@ -244,9 +253,11 @@ static struct printer printers[] = { - #ifdef DLT_APPLE_IP_OVER_IEEE1394 - { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 }, - #endif -+#endif - #ifdef DLT_IEEE802_11_RADIO_AVS - { ieee802_11_radio_avs_if_print, DLT_IEEE802_11_RADIO_AVS }, - #endif -+#ifndef TCPDUMP_MINI - #ifdef DLT_JUNIPER_ATM1 - { juniper_atm1_print, DLT_JUNIPER_ATM1 }, - #endif -@@ -312,6 +323,7 @@ static struct printer printers[] = { - #ifdef DLT_IPV6 - { raw_if_print, DLT_IPV6 }, - #endif -+#endif - { NULL, 0 }, - }; - -@@ -320,6 +332,7 @@ static struct ndo_printer ndo_printers[] - #ifdef DLT_IPNET - { ipnet_if_print, DLT_IPNET }, - #endif -+#ifndef TCPDUMP_MINI - #ifdef DLT_IEEE802_15_4 - { ieee802_15_4_if_print, DLT_IEEE802_15_4 }, - #endif -@@ -329,15 +342,18 @@ static struct ndo_printer ndo_printers[] - #ifdef DLT_PPI - { ppi_if_print, DLT_PPI }, - #endif -+#endif - #ifdef DLT_NETANALYZER - { netanalyzer_if_print, DLT_NETANALYZER }, - #endif - #ifdef DLT_NETANALYZER_TRANSPARENT - { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT }, - #endif -+#ifndef TCPDUMP_MINI - #ifdef DLT_NFLOG - { nflog_if_print, DLT_NFLOG}, - #endif -+#endif - { NULL, 0 }, - }; - ---- a/print-sll.c -+++ b/print-sll.c -@@ -154,14 +154,14 @@ recurse: - * Yes - what type is it? - */ - switch (ether_type) { -- -+#ifndef TCPDUMP_MINI - case LINUX_SLL_P_802_3: - /* - * Ethernet_802.3 IPX frame. - */ - ipx_print(p, length); - break; -- -+#endif - case LINUX_SLL_P_802_2: - /* - * 802.2. +@@ -636,10 +659,12 @@ udp_print(netdissect_options *ndo, regis + lwapp_control_print(ndo, (const u_char *)(up + 1), length, 0); + else if (IS_SRC_OR_DST_PORT(LWAPP_DATA_PORT)) + lwapp_data_print(ndo, (const u_char *)(up + 1), length); ++#endif + else if (IS_SRC_OR_DST_PORT(SIP_PORT)) + sip_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(SYSLOG_PORT)) + syslog_print(ndo, (const u_char *)(up + 1), length); ++#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(OTV_PORT)) + otv_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(VXLAN_PORT)) +@@ -656,7 +681,9 @@ udp_print(netdissect_options *ndo, regis + if (ndo->ndo_vflag) + ND_PRINT((ndo, "kip ")); + llap_print(ndo, cp, length); +- } else { ++ } ++#endif ++ else { + if (ulen > length) + ND_PRINT((ndo, "UDP, bad length %u > %u", + ulen, length)); diff --git a/package/network/utils/umbim/Makefile b/package/network/utils/umbim/Makefile index f494bb6b0e..42d4b85eaa 100644 --- a/package/network/utils/umbim/Makefile +++ b/package/network/utils/umbim/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=umbim -PKG_VERSION:=2015-07-04 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/umbim.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2015-07-04 PKG_SOURCE_VERSION:=29aaf43b097ee57f7aa1bb24341db6cc4148cbf3 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=bc0e7dd3dc388bddf7a9536bebe8672f275adf9523c2e0aa87cbc64ccd3e8e2f +PKG_MIRROR_HASH:=56e612d9da1ac26de96c4929fbabd047862d725a13ceb904807a9d3d7db43a30 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 06d9ac2b2b..41db1e7671 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uqmi -PKG_VERSION:=2016-08-23 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/uqmi.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=eb1dec7d0dc283a7f61aa574a443a0ab61f8793f -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=e6273e6aee6fce419e13f84439c240d48c32020fce7f07b2dc123ae32742382c +PKG_SOURCE_DATE:=2016-12-19 +PKG_SOURCE_VERSION:=8ceeab690d8c6f1e3afbd4bcaee7bc2ba3fbe165 +PKG_MIRROR_HASH:=b3637ff04e51769137af1c5e173e73311e11c3c2dcc49eeaca6aa3520f61d247 PKG_MAINTAINER:=Matti Laakso PKG_LICENSE:=GPL-2.0 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 12356989a2..35de6c5ad5 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -15,24 +15,23 @@ proto_qmi_init_config() { proto_config_add_string username proto_config_add_string password proto_config_add_string pincode - proto_config_add_string delay + proto_config_add_int delay proto_config_add_string modes - proto_config_add_boolean ipv6 - proto_config_add_boolean dhcp + proto_config_add_string pdptype + proto_config_add_int profile + proto_config_add_boolean dhcpv6 + proto_config_add_boolean autoconnect + proto_config_add_int plmn proto_config_add_defaults } proto_qmi_setup() { local interface="$1" - local device apn auth username password pincode delay modes ipv6 dhcp $PROTO_DEFAULT_OPTIONS - local cid_4 pdh_4 cid_6 pdh_6 ipv4 - local ip subnet gateway dns1 dns2 ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 - json_get_vars device apn auth username password pincode delay modes ipv6 dhcp $PROTO_DEFAULT_OPTIONS - - ipv4=1 - - [ "$ipv6" = 1 ] || ipv6="" + local device apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn $PROTO_DEFAULT_OPTIONS + local cid_4 pdh_4 cid_6 pdh_6 + local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 + json_get_vars device apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn $PROTO_DEFAULT_OPTIONS [ "$metric" = "" ] && metric="0" @@ -44,6 +43,8 @@ proto_qmi_setup() { proto_set_available "$interface" 0 return 1 } + + device="$(readlink -f $device)" [ -c "$device" ] || { echo "The specified control device does not exist" proto_notify_error "$interface" NO_DEVICE @@ -76,20 +77,28 @@ proto_qmi_setup() { } } - [ -n "$apn" ] || { - echo "No APN specified" - proto_notify_error "$interface" NO_APN - return 1 + [ -n "$plmn" ] && { + local mcc mnc + if [ "$plmn" = 0 ]; then + mcc=0 + mnc=0 + echo "Setting PLMN to auto" + else + mcc=${plmn:0:3} + mnc=${plmn:3} + echo "Setting PLMN to $plmn" + fi + uqmi -s -d "$device" --set-plmn --mcc "$mcc" --mnc "$mnc" || { + echo "Unable to set PLMN" + proto_notify_error "$interface" PLMN_FAILED + proto_block_restart "$interface" + return 1 + } } - # try to clear previous autoconnect state - # do not reuse previous wds client id to prevent hangs caused by stale data - uqmi -s -d "$device" \ - --stop-network 0xffffffff \ - --autoconnect > /dev/null - uqmi -s -d "$device" --set-data-format 802.3 uqmi -s -d "$device" --wda-set-data-format 802.3 + uqmi -s -d "$device" --sync echo "Waiting for network registration" while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do @@ -98,68 +107,96 @@ proto_qmi_setup() { [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" - echo "Starting network $apn" + echo "Starting network $interface" - cid_4=`uqmi -s -d "$device" --get-client-id wds` - [ $? -ne 0 ] && { - echo "Unable to obtain client ID" - proto_notify_error "$interface" NO_CID - return 1 - } + pdptype=`echo "$pdptype" | awk '{print tolower($0)}'` + [ "$pdptype" = "ip" -o "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] || pdptype="ip" + + if [ "$pdptype" = "ip" ]; then + [ -z "$autoconnect" ] && autoconnect=1 + [ "$autoconnect" = 0 ] && autoconnect="" + else + [ "$autoconnect" = 1 ] || autoconnect="" + fi - pdh_4=`uqmi -s -d "$device" --set-client-id wds,"$cid_4" \ - --start-network "$apn" \ - ${auth:+--auth-type $auth} \ - ${username:+--username $username} \ - ${password:+--password $password} \ - --ip-family ipv4 \ - --autoconnect` - [ $? -ne 0 ] && { - echo "Unable to connect IPv4" - uqmi -s -d "$device" --set-client-id wds,"$cid_4" --release-client-id wds - ipv4="" + [ "$pdptype" = "ip" -o "$pdptype" = "ipv4v6" ] && { + cid_4=`uqmi -s -d "$device" --get-client-id wds` + [ $? -ne 0 ] && { + echo "Unable to obtain client ID" + proto_notify_error "$interface" NO_CID + return 1 + } + + uqmi -s -d "$device" --set-client-id wds,"$cid_4" --set-ip-family ipv4 > /dev/null + + # try to clear previous autoconnect state + uqmi -s -d "$device" --set-client-id wds,"$cid_4" \ + --stop-network 0xffffffff \ + --autoconnect > /dev/null + + pdh_4=`uqmi -s -d "$device" --set-client-id wds,"$cid_4" \ + --start-network \ + ${apn:+--apn $apn} \ + ${profile:+--profile $profile} \ + ${auth:+--auth-type $auth} \ + ${username:+--username $username} \ + ${password:+--password $password} \ + ${autoconnect:+--autoconnect}` + [ $? -ne 0 ] && { + echo "Unable to connect IPv4" + uqmi -s -d "$device" --set-client-id wds,"$cid_4" --release-client-id wds + proto_notify_error "$interface" CALL_FAILED + return 1 + } } - [ -n "$ipv6" ] && { + [ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && { cid_6=`uqmi -s -d "$device" --get-client-id wds` - if [ $? = 0 ]; then - pdh_6=`uqmi -s -d "$device" --set-client-id wds,"$cid_6" \ - --start-network "$apn" \ - ${auth:+--auth-type $auth} \ - ${username:+--username $username} \ - ${password:+--password $password} \ - --ip-family ipv6 --autoconnect` - [ $? -ne 0 ] && { - echo "Unable to connect IPv6" - uqmi -s -d "$device" --set-client-id wds,"$cid_6" --release-client-id wds - ipv6="" - } - else - echo "Unable to connect IPv6" - ipv6="" - fi - } + [ $? -ne 0 ] && { + echo "Unable to obtain client ID" + proto_notify_error "$interface" NO_CID + return 1 + } - [ -z "$ipv4" -a -z "$ipv6" ] && { - echo "Unable to connect" - proto_notify_error "$interface" CALL_FAILED - return 1 + uqmi -s -d "$device" --set-client-id wds,"$cid_6" --set-ip-family ipv6 > /dev/null + + # try to clear previous autoconnect state + uqmi -s -d "$device" --set-client-id wds,"$cid_6" \ + --stop-network 0xffffffff \ + --autoconnect > /dev/null + + pdh_6=`uqmi -s -d "$device" --set-client-id wds,"$cid_6" \ + --start-network \ + ${apn:+--apn $apn} \ + ${profile:+--profile $profile} \ + ${auth:+--auth-type $auth} \ + ${username:+--username $username} \ + ${password:+--password $password} \ + ${autoconnect:+--autoconnect}` + [ $? -ne 0 ] && { + echo "Unable to connect IPv6" + uqmi -s -d "$device" --set-client-id wds,"$cid_6" --release-client-id wds + proto_notify_error "$interface" CALL_FAILED + return 1 + } } echo "Setting up $ifname" proto_init_update "$ifname" 1 + proto_set_keep 1 proto_add_data - [ -n "$ipv4" ] && { + [ -n "$pdh_4" ] && { json_add_string "cid_4" "$cid_4" json_add_string "pdh_4" "$pdh_4" } - [ -n "$ipv6" ] && { + [ -n "$pdh_6" ] && { json_add_string "cid_6" "$cid_6" json_add_string "pdh_6" "$pdh_6" } - - [ -n "$ipv6" ] && { - if [ -z "$dhcp" -o "$dhcp" = 0 ]; then + proto_close_data + proto_send_update "$interface" + [ -n "$pdh_6" ] && { + if [ -z "$dhcpv6" -o "$dhcpv6" = 0 ]; then json_load "$(uqmi -s -d $device --set-client-id wds,$cid_6 --get-current-settings)" json_select ipv6 json_get_var ip_6 ip @@ -168,7 +205,8 @@ proto_qmi_setup() { json_get_var dns2_6 dns2 json_get_var ip_prefix_length ip-prefix-length - # RFC 7278: Extend an IPv6 /64 Prefix to LAN + proto_init_update "$ifname" 1 + proto_set_keep 1 proto_add_ipv6_address "$ip_6" "128" proto_add_ipv6_prefix "${ip_6}/${ip_prefix_length}" proto_add_ipv6_route "$gateway_6" "128" @@ -177,9 +215,7 @@ proto_qmi_setup() { proto_add_dns_server "$dns1_6" proto_add_dns_server "$dns2_6" } - proto_add_data - json_add_string "cid_6" "$cid_6" - json_add_string "pdh_6" "$pdh_6" + proto_send_update "$interface" else json_init json_add_string name "${interface}_6" @@ -193,10 +229,7 @@ proto_qmi_setup() { fi } - proto_close_data - proto_send_update "$interface" - - [ -n "$ipv4" ] && { + [ -n "$pdh_4" ] && { json_init json_add_string name "${interface}_4" json_add_string ifname "@$interface" @@ -213,8 +246,9 @@ qmi_wds_stop() { [ -n "$cid" ] || return - # disable previous autoconnect state using the global handle - uqmi -s -d "$device" --set-client-id wds,"$cid" --stop-network "0xffffffff" + uqmi -s -d "$device" --set-client-id wds,"$cid" \ + --stop-network 0xffffffff \ + --autoconnect > /dev/null [ -n "$pdh" ] && uqmi -s -d "$device" --set-client-id wds,"$cid" --stop-network "$pdh" uqmi -s -d "$device" --set-client-id wds,"$cid" --release-client-id wds @@ -228,7 +262,7 @@ proto_qmi_teardown() { [ -n "$ctl_device" ] && device=$ctl_device - echo "Stopping network" + echo "Stopping network $interface" json_load "$(ubus call network.interface.$interface status)" json_select data diff --git a/package/network/utils/wireless-tools/Makefile b/package/network/utils/wireless-tools/Makefile index df7f6be9d6..eac0573b43 100644 --- a/package/network/utils/wireless-tools/Makefile +++ b/package/network/utils/wireless-tools/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=5 PKG_SOURCE:=wireless_tools.$(PKG_VERSION)$(PKG_MINOR).tar.gz PKG_SOURCE_URL:=http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux -PKG_MD5SUM:=e06c222e186f7cc013fd272d023710cb +PKG_HASH:=6fb80935fe208538131ce2c4178221bab1078a1656306bce8909c19887e2e5a1 TAR_OPTIONS += || true PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/utils/wpan-tools/Makefile b/package/network/utils/wpan-tools/Makefile index 857a693f01..ff65375724 100644 --- a/package/network/utils/wpan-tools/Makefile +++ b/package/network/utils/wpan-tools/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=0.7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://wpan.cakelab.org/releases/ -PKG_MD5SUM:=c16de9d7861c2d9b6a4436a0fac730f9f545ee290b92bc770c538ec6a3f22309 +PKG_HASH:=c16de9d7861c2d9b6a4436a0fac730f9f545ee290b92bc770c538ec6a3f22309 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/utils/xtables-addons/Makefile b/package/network/utils/xtables-addons/Makefile index 014887d06b..50d1287ba1 100644 --- a/package/network/utils/xtables-addons/Makefile +++ b/package/network/utils/xtables-addons/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=xtables-addons PKG_VERSION:=2.11 PKG_RELEASE:=1 -PKG_MD5SUM:=9f3123295db81a9d1bc08dabf075d0d6 +PKG_HASH:=f14f8953a9d3a70157a82883886ff6ec866c61dbea1585edb421478107279921 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SF/xtables-addons diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index 980f61a4c1..415905b7d7 100644 --- a/package/system/ca-certificates/Makefile +++ b/package/system/ca-certificates/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ca-certificates -PKG_VERSION:=20161102 +PKG_VERSION:=20161130 PKG_MAINTAINER:=Christian Schoenebeck PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates -PKG_MD5SUM:=74642bd9b9e0a449fa55e6632070745f +PKG_HASH:=04bca9e142a90a834aca0311f7ced237368d71fee7bd5c9f68ef7f4611aee471 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) PKG_INSTALL:=1 diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 785d680bf8..cf9bd2119d 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -8,16 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fstools -PKG_VERSION:=2016-09-31 - -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/fstools.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=94a5b0ad8d53f024f036c3526b48c34ebbd66a2f -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=f9fca74463187f2ef07c45154ae5dea296bd7e6fcb734bdc5f8d452e8d6b9fa2 +PKG_SOURCE_DATE:=2016-12-04 +PKG_SOURCE_VERSION:=84b530a732b12cca1cd5ee9ba163b7ead7a83de3 +PKG_MIRROR_HASH:=b607138de1adbb7f49e53daebe28ac1352910fa2b29278365edeabafc5b46a91 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/system/lede-keyring/Makefile b/package/system/lede-keyring/Makefile index df14530c22..a84f84722f 100644 --- a/package/system/lede-keyring/Makefile +++ b/package/system/lede-keyring/Makefile @@ -3,16 +3,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lede-keyring -PKG_VERSION:=2016-04-30 - -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/keyring.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-04-30 PKG_SOURCE_VERSION:=5c7857eed3fa06a9005f96b9b029388c7f316e83 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=c5997bf1505042c857d5e19fec497c6516cc1d9e07fc19ff4c5b1a33da3cdf29 +PKG_MIRROR_HASH:=6119196dad6c92df22617c5f4a923728a657b591c6a6901dda21acadc63da51d PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 diff --git a/package/system/mountd/Makefile b/package/system/mountd/Makefile index fe9ecc7b43..6922f2f5a0 100644 --- a/package/system/mountd/Makefile +++ b/package/system/mountd/Makefile @@ -4,16 +4,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mountd -PKG_VERSION:=2016-09-30 - -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/mountd.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=3dd115bb4046521986abe78bc488dfd6b95e5a6e -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=40baff09ee09ab7b80ec4786c1e7c9ec69726c776f435244d225b765bd5992b7 +PKG_SOURCE_DATE:=2016-12-19 +PKG_SOURCE_VERSION:=dd5799c9f8cc7a01c0572c067bf907b37cdd7d04 +PKG_MIRROR_HASH:=cdc9f61bf4ad4b5d02b7cad435de1566b53306ed532fe39d099ed91eec6c405c CMAKE_INSTALL:=1 PKG_MAINTAINER:=John Crispin diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 2a04c4d247..898d769b2e 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -11,17 +11,14 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=opkg -PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d -PKG_VERSION:=$(PKG_REV) -PKG_RELEASE:=15 +PKG_RELEASE:=16 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=$(PKG_REV) -PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION) PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg -PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz -PKG_MIRROR_MD5SUM:=abba824695a7dd4acf2a6371c4e22142656b3d1f0fa93c04410116d2170ce1a9 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2011-04-08 +PKG_SOURCE_VERSION:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d +PKG_MIRROR_HASH:=55e05270f3eb2f3aff5d3791463ce3d13b8197ca7b301cd58e731a249552c48f +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) PKG_FIXUP:=autoreconf PKG_REMOVE_FILES = autogen.sh aclocal.m4 @@ -40,16 +37,16 @@ PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk -define Package/opkg/Default +define Package/opkg SECTION:=base CATEGORY:=Base system TITLE:=opkg package manager - DEPENDS:=+uclient-fetch + DEPENDS:=+uclient-fetch +libpthread URL:=http://wiki.openmoko.org/wiki/Opkg MENU:=1 endef -define Package/opkg/Default/description +define Package/opkg/description Lightweight package management system opkg is the opkg Package Management System, for handling installation and removal of packages on a system. It can @@ -69,47 +66,12 @@ config OPKG_SUPPORT_MD5 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha. endef -define Package/opkg - $(call Package/opkg/Default) - VARIANT:=unsigned -endef - -define Package/opkg/description - $(call Package/opkg/Default/description) -endef - define Package/opkg/conffiles /etc/opkg.conf /etc/opkg/keys/ /etc/opkg/customfeeds.conf endef - -define Package/opkg-smime - $(call Package/opkg/Default) - TITLE+= (with S/MIME signature support) - DEPENDS+=+PACKAGE_opkg-smime:libopenssl - VARIANT:=smime -endef - -define Package/opkg-smime/description - $(call Package/opkg/Default/description) - - This package allows the Package index to be verified with S/MIME. -endef - -define Package/opkg-smime/config -config OPKG_SMIME_SUPPORT_MD5 - bool - default n - depends on PACKAGE_opkg-smime - prompt "Support reading old md5 hashes." - help - Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha. -endef - -Package/opkg-smime/conffiles = $(Package/opkg/conffiles) - TARGET_CFLAGS += -ffunction-sections -fdata-sections EXTRA_CFLAGS += $(TARGET_CPPFLAGS) @@ -120,22 +82,13 @@ CONFIGURE_ARGS += \ --with-opkgetcdir=/etc \ --with-opkglockfile=/var/lock/opkg.lock -ifeq ($(BUILD_VARIANT),smime) - CONFIGURE_ARGS += --enable-openssl --disable-usign - ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y) - CONFIGURE_ARGS += --enable-md5 - else - CONFIGURE_ARGS += --disable-md5 - endif +ifndef CONFIG_SIGNED_PACKAGES + CONFIGURE_ARGS += --disable-usign +endif +ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y) + CONFIGURE_ARGS += --enable-md5 else - ifndef CONFIG_SIGNED_PACKAGES - CONFIGURE_ARGS += --disable-usign - endif - ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y) - CONFIGURE_ARGS += --enable-md5 - else - CONFIGURE_ARGS += --disable-md5 - endif + CONFIGURE_ARGS += --disable-md5 endif MAKE_FLAGS = \ @@ -166,12 +119,6 @@ define Package/opkg/install $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/ endef -define Package/opkg-smime/install - $(call Package/opkg/Default/install,$(1),-smime) - $(INSTALL_DIR) $(1)/etc/ssl/certs - $(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,) -endef - define Build/InstallDev mkdir -p $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/ @@ -194,5 +141,4 @@ define Host/Install endef $(eval $(call BuildPackage,opkg)) -$(eval $(call BuildPackage,opkg-smime)) $(eval $(call HostBuild)) diff --git a/package/system/opkg/patches/070-use_external_gzip.patch b/package/system/opkg/patches/070-use_external_gzip.patch new file mode 100644 index 0000000000..95873591de --- /dev/null +++ b/package/system/opkg/patches/070-use_external_gzip.patch @@ -0,0 +1,719 @@ +--- a/libbb/unarchive.c ++++ b/libbb/unarchive.c +@@ -28,6 +28,7 @@ + #include + + #include "libbb.h" ++#include "gzip.h" + + #define CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY 1 + #define CONFIG_FEATURE_TAR_GNU_EXTENSIONS +@@ -39,38 +40,15 @@ static char *linkname = NULL; + + off_t archive_offset; + +-#define SEEK_BUF 4096 + static ssize_t +-seek_by_read(FILE* fd, size_t len) +-{ +- ssize_t cc, total = 0; +- char buf[SEEK_BUF]; +- +- while (len) { +- cc = fread(buf, sizeof(buf[0]), +- len > SEEK_BUF ? SEEK_BUF : len, +- fd); +- +- total += cc; +- len -= cc; +- +- if(feof(fd) || ferror(fd)) +- break; +- } +- return total; +-} +- +-static void +-seek_sub_file(FILE *fd, const int count) ++seek_forward(struct gzip_handle *zh, ssize_t len) + { +- archive_offset += count; ++ ssize_t slen = gzip_seek(zh, len); + +- /* Do not use fseek() on a pipe. It may fail with ESPIPE, leaving the +- * stream at an undefined location. +- */ +- seek_by_read(fd, count); ++ if (slen == len) ++ archive_offset += len; + +- return; ++ return slen; + } + + +@@ -87,7 +65,7 @@ seek_sub_file(FILE *fd, const int count) + * trailing '/' or else the last dir will be assumed to be the file prefix + */ + static char * +-extract_archive(FILE *src_stream, FILE *out_stream, ++extract_archive(struct gzip_handle *src_stream, FILE *out_stream, + const file_header_t *file_entry, const int function, + const char *prefix, + int *err) +@@ -129,14 +107,14 @@ extract_archive(FILE *src_stream, FILE * + + if (function & extract_to_stream) { + if (S_ISREG(file_entry->mode)) { +- *err = copy_file_chunk(src_stream, out_stream, file_entry->size); ++ *err = gzip_copy(src_stream, out_stream, file_entry->size); + archive_offset += file_entry->size; + } + } + else if (function & extract_one_to_buffer) { + if (S_ISREG(file_entry->mode)) { + buffer = (char *) xmalloc(file_entry->size + 1); +- fread(buffer, 1, file_entry->size, src_stream); ++ gzip_read(src_stream, buffer, file_entry->size); + buffer[file_entry->size] = '\0'; + archive_offset += file_entry->size; + goto cleanup; +@@ -156,7 +134,7 @@ extract_archive(FILE *src_stream, FILE * + *err = -1; + error_msg("%s not created: newer or same age file exists", file_entry->name); + } +- seek_sub_file(src_stream, file_entry->size); ++ seek_forward(src_stream, file_entry->size); + goto cleanup; + } + } +@@ -185,11 +163,11 @@ extract_archive(FILE *src_stream, FILE * + } else { + if ((dst_stream = wfopen(full_name, "w")) == NULL) { + *err = -1; +- seek_sub_file(src_stream, file_entry->size); ++ seek_forward(src_stream, file_entry->size); + goto cleanup; + } + archive_offset += file_entry->size; +- *err = copy_file_chunk(src_stream, dst_stream, file_entry->size); ++ *err = gzip_copy(src_stream, dst_stream, file_entry->size); + fclose(dst_stream); + } + break; +@@ -250,7 +228,7 @@ extract_archive(FILE *src_stream, FILE * + /* If we arent extracting data we have to skip it, + * if data size is 0 then then just do it anyway + * (saves testing for it) */ +- seek_sub_file(src_stream, file_entry->size); ++ seek_forward(src_stream, file_entry->size); + } + + /* extract_list and extract_verbose_list can be used in conjunction +@@ -274,8 +252,8 @@ cleanup: + } + + static char * +-unarchive(FILE *src_stream, FILE *out_stream, +- file_header_t *(*get_headers)(FILE *), ++unarchive(struct gzip_handle *src_stream, FILE *out_stream, ++ file_header_t *(*get_headers)(struct gzip_handle *), + void (*free_headers)(file_header_t *), + const int extract_function, + const char *prefix, +@@ -329,7 +307,7 @@ unarchive(FILE *src_stream, FILE *out_st + } + } else { + /* seek past the data entry */ +- seek_sub_file(src_stream, file_entry->size); ++ seek_forward(src_stream, file_entry->size); + } + free_headers(file_entry); + } +@@ -337,108 +315,9 @@ unarchive(FILE *src_stream, FILE *out_st + return buffer; + } + +-static file_header_t * +-get_header_ar(FILE *src_stream) +-{ +- file_header_t *typed; +- union { +- char raw[60]; +- struct { +- char name[16]; +- char date[12]; +- char uid[6]; +- char gid[6]; +- char mode[8]; +- char size[10]; +- char magic[2]; +- } formated; +- } ar; +- static char *ar_long_names; +- +- if (fread(ar.raw, 1, 60, src_stream) != 60) { +- return(NULL); +- } +- archive_offset += 60; +- /* align the headers based on the header magic */ +- if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { +- /* some version of ar, have an extra '\n' after each data entry, +- * this puts the next header out by 1 */ +- if (ar.formated.magic[1] != '`') { +- error_msg("Invalid magic"); +- return(NULL); +- } +- /* read the next char out of what would be the data section, +- * if its a '\n' then it is a valid header offset by 1*/ +- archive_offset++; +- if (fgetc(src_stream) != '\n') { +- error_msg("Invalid magic"); +- return(NULL); +- } +- /* fix up the header, we started reading 1 byte too early */ +- /* raw_header[60] wont be '\n' as it should, but it doesnt matter */ +- memmove(ar.raw, &ar.raw[1], 59); +- } +- +- typed = (file_header_t *) xcalloc(1, sizeof(file_header_t)); +- +- typed->size = (size_t) atoi(ar.formated.size); +- /* long filenames have '/' as the first character */ +- if (ar.formated.name[0] == '/') { +- if (ar.formated.name[1] == '/') { +- /* If the second char is a '/' then this entries data section +- * stores long filename for multiple entries, they are stored +- * in static variable long_names for use in future entries */ +- ar_long_names = (char *) xrealloc(ar_long_names, typed->size); +- fread(ar_long_names, 1, typed->size, src_stream); +- archive_offset += typed->size; +- /* This ar entries data section only contained filenames for other records +- * they are stored in the static ar_long_names for future reference */ +- return (get_header_ar(src_stream)); /* Return next header */ +- } else if (ar.formated.name[1] == ' ') { +- /* This is the index of symbols in the file for compilers */ +- seek_sub_file(src_stream, typed->size); +- return (get_header_ar(src_stream)); /* Return next header */ +- } else { +- /* The number after the '/' indicates the offset in the ar data section +- (saved in variable long_name) that conatains the real filename */ +- if (!ar_long_names) { +- error_msg("Cannot resolve long file name"); +- return (NULL); +- } +- typed->name = xstrdup(ar_long_names + atoi(&ar.formated.name[1])); +- } +- } else { +- /* short filenames */ +- typed->name = xcalloc(1, 16); +- strncpy(typed->name, ar.formated.name, 16); +- } +- typed->name[strcspn(typed->name, " /")]='\0'; +- +- /* convert the rest of the now valid char header to its typed struct */ +- parse_mode(ar.formated.mode, &typed->mode); +- typed->mtime = atoi(ar.formated.date); +- typed->uid = atoi(ar.formated.uid); +- typed->gid = atoi(ar.formated.gid); +- +- return(typed); +-} +- +-static void +-free_header_ar(file_header_t *ar_entry) +-{ +- if (ar_entry == NULL) +- return; +- +- free(ar_entry->name); +- if (ar_entry->link_name) +- free(ar_entry->link_name); +- +- free(ar_entry); +-} +- + + static file_header_t * +-get_header_tar(FILE *tar_stream) ++get_header_tar(struct gzip_handle *tar_stream) + { + union { + unsigned char raw[512]; +@@ -467,10 +346,10 @@ get_header_tar(FILE *tar_stream) + long sum = 0; + + if (archive_offset % 512 != 0) { +- seek_sub_file(tar_stream, 512 - (archive_offset % 512)); ++ seek_forward(tar_stream, 512 - (archive_offset % 512)); + } + +- if (fread(tar.raw, 1, 512, tar_stream) != 512) { ++ if (gzip_read(tar_stream, tar.raw, 512) != 512) { + /* Unfortunately its common for tar files to have all sorts of + * trailing garbage, fail silently */ + // error_msg("Couldnt read header"); +@@ -557,7 +436,7 @@ get_header_tar(FILE *tar_stream) + # ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS + case 'L': { + longname = xmalloc(tar_entry->size + 1); +- if(fread(longname, tar_entry->size, 1, tar_stream) != 1) ++ if(gzip_read(tar_stream, longname, tar_entry->size) != tar_entry->size) + return NULL; + longname[tar_entry->size] = '\0'; + archive_offset += tar_entry->size; +@@ -566,7 +445,7 @@ get_header_tar(FILE *tar_stream) + } + case 'K': { + linkname = xmalloc(tar_entry->size + 1); +- if(fread(linkname, tar_entry->size, 1, tar_stream) != 1) ++ if(gzip_read(tar_stream, linkname, tar_entry->size) != tar_entry->size) + return NULL; + linkname[tar_entry->size] = '\0'; + archive_offset += tar_entry->size; +@@ -642,6 +521,9 @@ deb_extract(const char *package_filename + char *ared_file = NULL; + char ar_magic[8]; + int gz_err; ++ struct gzip_handle tar_outer, tar_inner; ++ file_header_t *tar_header; ++ ssize_t len; + + *err = 0; + +@@ -672,111 +554,44 @@ deb_extract(const char *package_filename + /* set the buffer size */ + setvbuf(deb_stream, NULL, _IOFBF, 0x8000); + +- /* check ar magic */ +- fread(ar_magic, 1, 8, deb_stream); +- +- if (strncmp(ar_magic,"!",7) == 0) { +- archive_offset = 8; ++ memset(&tar_outer, 0, sizeof(tar_outer)); ++ tar_outer.file = deb_stream; ++ gzip_exec(&tar_outer, NULL); + +- while ((ar_header = get_header_ar(deb_stream)) != NULL) { +- if (strcmp(ared_file, ar_header->name) == 0) { +- int gunzip_pid = 0; +- FILE *uncompressed_stream; +- /* open a stream of decompressed data */ +- uncompressed_stream = gz_open(deb_stream, &gunzip_pid); +- if (uncompressed_stream == NULL) { +- *err = -1; +- goto cleanup; +- } ++ /* walk through outer tar file to find ared_file */ ++ while ((tar_header = get_header_tar(&tar_outer)) != NULL) { ++ int name_offset = 0; ++ if (strncmp(tar_header->name, "./", 2) == 0) ++ name_offset = 2; + +- archive_offset = 0; +- output_buffer = unarchive(uncompressed_stream, +- out_stream, get_header_tar, +- free_header_tar, +- extract_function, prefix, +- file_list, err); +- fclose(uncompressed_stream); +- gz_err = gz_close(gunzip_pid); +- if (gz_err) +- *err = -1; +- free_header_ar(ar_header); +- break; +- } +- if (fseek(deb_stream, ar_header->size, SEEK_CUR) == -1) { +- opkg_perror(ERROR, "Couldn't fseek into %s", package_filename); +- *err = -1; +- free_header_ar(ar_header); +- goto cleanup; +- } +- free_header_ar(ar_header); +- } +- goto cleanup; +- } else if (strncmp(ar_magic, "\037\213", 2) == 0) { +- /* it's a gz file, let's assume it's an opkg */ +- int unzipped_opkg_pid; +- FILE *unzipped_opkg_stream; +- file_header_t *tar_header; +- archive_offset = 0; +- if (fseek(deb_stream, 0, SEEK_SET) == -1) { +- opkg_perror(ERROR, "Couldn't fseek into %s", package_filename); +- *err = -1; +- goto cleanup; +- } +- unzipped_opkg_stream = gz_open(deb_stream, &unzipped_opkg_pid); +- if (unzipped_opkg_stream == NULL) { +- *err = -1; +- goto cleanup; +- } ++ if (strcmp(ared_file, tar_header->name+name_offset) == 0) { ++ memset(&tar_inner, 0, sizeof(tar_inner)); ++ tar_inner.gzip = &tar_outer; ++ gzip_exec(&tar_inner, NULL); + +- /* walk through outer tar file to find ared_file */ +- while ((tar_header = get_header_tar(unzipped_opkg_stream)) != NULL) { +- int name_offset = 0; +- if (strncmp(tar_header->name, "./", 2) == 0) +- name_offset = 2; +- if (strcmp(ared_file, tar_header->name+name_offset) == 0) { +- int gunzip_pid = 0; +- FILE *uncompressed_stream; +- /* open a stream of decompressed data */ +- uncompressed_stream = gz_open(unzipped_opkg_stream, &gunzip_pid); +- if (uncompressed_stream == NULL) { +- *err = -1; +- goto cleanup; +- } +- archive_offset = 0; ++ archive_offset = 0; + +- output_buffer = unarchive(uncompressed_stream, +- out_stream, +- get_header_tar, +- free_header_tar, +- extract_function, +- prefix, +- file_list, +- err); ++ output_buffer = unarchive(&tar_inner, ++ out_stream, ++ get_header_tar, ++ free_header_tar, ++ extract_function, ++ prefix, ++ file_list, ++ err); + +- free_header_tar(tar_header); +- fclose(uncompressed_stream); +- gz_err = gz_close(gunzip_pid); +- if (gz_err) +- *err = -1; +- break; +- } +- seek_sub_file(unzipped_opkg_stream, tar_header->size); + free_header_tar(tar_header); ++ gzip_close(&tar_inner); ++ break; + } +- fclose(unzipped_opkg_stream); +- gz_err = gz_close(unzipped_opkg_pid); +- if (gz_err) +- *err = -1; + +- goto cleanup; +- } else { +- *err = -1; +- error_msg("%s: invalid magic", package_filename); ++ seek_forward(&tar_outer, tar_header->size); ++ free_header_tar(tar_header); + } + + cleanup: +- if (deb_stream) +- fclose(deb_stream); ++ gzip_close(&tar_outer); ++ + if (file_list) + free(file_list); + +--- /dev/null ++++ b/libbb/gzip.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (C) 2016 Jo-Philipp Wich ++ * ++ * Zlib decrompression utility routines. ++ * ++ * 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 Library 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 ++ ++struct gzip_handle { ++ FILE *file; ++ struct gzip_handle *gzip; ++ ++ pid_t pid; ++ int rfd, wfd; ++ struct sigaction pipe_sa; ++ pthread_t thread; ++}; ++ ++int gzip_exec(struct gzip_handle *zh, const char *filename); ++ssize_t gzip_read(struct gzip_handle *zh, char *buf, ssize_t len); ++ssize_t gzip_copy(struct gzip_handle *zh, FILE *out, ssize_t len); ++int gzip_close(struct gzip_handle *zh); ++FILE *gzip_fdopen(struct gzip_handle *zh, const char *filename); ++ ++#define gzip_seek(zh, len) gzip_copy(zh, NULL, len) +--- a/libbb/Makefile.am ++++ b/libbb/Makefile.am +@@ -4,9 +4,8 @@ ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\" + + noinst_LIBRARIES = libbb.a + +-libbb_a_SOURCES = gz_open.c \ ++libbb_a_SOURCES = \ + libbb.h \ +- unzip.c \ + wfopen.c \ + unarchive.c \ + copy_file.c \ +@@ -20,7 +19,8 @@ libbb_a_SOURCES = gz_open.c \ + parse_mode.c \ + time_string.c \ + all_read.c \ +- mode_string.c ++ mode_string.c \ ++ gzip.c + + libbb_la_CFLAGS = $(ALL_CFLAGS) + #libbb_la_LDFLAGS = -static +--- /dev/null ++++ b/libbb/gzip.c +@@ -0,0 +1,208 @@ ++/* ++ * Copyright (C) 2016 Jo-Philipp Wich ++ * Copyright (C) 2016 Felix Fietkau ++ * ++ * Zlib decrompression utility routines. ++ * ++ * 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 Library 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 "gzip.h" ++ ++static void ++to_devnull(int fd) ++{ ++ int devnull = open("/dev/null", fd ? O_WRONLY : O_RDONLY); ++ ++ if (devnull >= 0) ++ dup2(devnull, fd); ++ ++ if (devnull > STDERR_FILENO) ++ close(devnull); ++} ++ ++void * ++gzip_thread(void *ptr) ++{ ++ struct gzip_handle *zh = ptr; ++ char buf[4096]; ++ int len, ret; ++ ++ while (1) { ++ if (zh->file) ++ len = fread(buf, 1, sizeof(buf), zh->file); ++ else if (zh->gzip) ++ len = gzip_read(zh->gzip, buf, sizeof(buf)); ++ ++ if (len <= 0) ++ break; ++ ++ do { ++ ret = write(zh->wfd, buf, len); ++ } while (ret == -1 && errno == EINTR); ++ } ++ ++ close(zh->wfd); ++ zh->wfd = -1; ++} ++ ++int ++gzip_exec(struct gzip_handle *zh, const char *filename) ++{ ++ int rpipe[2] = { -1, -1 }, wpipe[2] = { -1, -1 }; ++ struct sigaction pipe_sa = { .sa_handler = SIG_IGN }; ++ ++ zh->rfd = -1; ++ zh->wfd = -1; ++ ++ if (sigaction(SIGPIPE, &pipe_sa, &zh->pipe_sa) < 0) ++ return -1; ++ ++ if (pipe(rpipe) < 0) ++ return -1; ++ ++ if (!filename && pipe(wpipe) < 0) { ++ close(rpipe[0]); ++ close(rpipe[1]); ++ return -1; ++ } ++ ++ zh->pid = vfork(); ++ ++ switch (zh->pid) { ++ case -1: ++ return -1; ++ ++ case 0: ++ to_devnull(STDERR_FILENO); ++ ++ if (filename) { ++ to_devnull(STDIN_FILENO); ++ } ++ else { ++ dup2(wpipe[0], STDIN_FILENO); ++ close(wpipe[0]); ++ close(wpipe[1]); ++ } ++ ++ dup2(rpipe[1], STDOUT_FILENO); ++ close(rpipe[0]); ++ close(rpipe[1]); ++ ++ execlp("gzip", "gzip", "-d", "-c", filename, NULL); ++ exit(-1); ++ ++ default: ++ zh->rfd = rpipe[0]; ++ zh->wfd = wpipe[1]; ++ ++ fcntl(zh->rfd, F_SETFD, fcntl(zh->rfd, F_GETFD) | FD_CLOEXEC); ++ close(rpipe[1]); ++ ++ if (zh->wfd >= 0) { ++ fcntl(zh->wfd, F_SETFD, fcntl(zh->wfd, F_GETFD) | FD_CLOEXEC); ++ close(wpipe[0]); ++ pthread_create(&zh->thread, NULL, gzip_thread, zh); ++ } ++ } ++ ++ return 0; ++} ++ ++ssize_t ++gzip_read(struct gzip_handle *zh, char *buf, ssize_t len) ++{ ++ ssize_t ret; ++ ++ do { ++ ret = read(zh->rfd, buf, len); ++ } while (ret == -1 && errno != EINTR); ++ ++ return ret; ++} ++ ++ssize_t ++gzip_copy(struct gzip_handle *zh, FILE *out, ssize_t len) ++{ ++ char buf[4096]; ++ ssize_t rlen, total = 0; ++ ++ while (len > 0) { ++ rlen = gzip_read(zh, buf, ++ (len > sizeof(buf)) ? sizeof(buf) : len); ++ ++ if (rlen <= 0) ++ break; ++ ++ if (out != NULL) { ++ if (fwrite(buf, 1, rlen, out) != rlen) ++ break; ++ } ++ ++ len -= rlen; ++ total += rlen; ++ } ++ ++ return total; ++} ++ ++FILE * ++gzip_fdopen(struct gzip_handle *zh, const char *filename) ++{ ++ memset(zh, 0, sizeof(*zh)); ++ ++ if (!filename || gzip_exec(zh, filename) < 0) ++ return NULL; ++ ++ fcntl(zh->rfd, F_SETFL, fcntl(zh->rfd, F_GETFL) & ~O_NONBLOCK); ++ ++ return fdopen(zh->rfd, "r"); ++} ++ ++int ++gzip_close(struct gzip_handle *zh) ++{ ++ int code = -1; ++ ++ if (zh->rfd >= 0) ++ close(zh->rfd); ++ ++ if (zh->wfd >= 0) ++ close(zh->wfd); ++ ++ if (zh->pid > 0) { ++ kill(zh->pid, SIGKILL); ++ waitpid(zh->pid, &code, 0); ++ } ++ ++ if (zh->file) ++ fclose(zh->file); ++ ++ if (zh->thread) ++ pthread_join(zh->thread, NULL); ++ ++ sigaction(SIGPIPE, &zh->pipe_sa, NULL); ++ ++ return WIFEXITED(code) ? WEXITSTATUS(code) : -1; ++} +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -3,4 +3,4 @@ bin_PROGRAMS = opkg-cl + + opkg_cl_SOURCES = opkg-cl.c + opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.a \ +- $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) ++ $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) -lpthread +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -16,7 +16,7 @@ noinst_PROGRAMS = libopkg_test + #opkg_active_list_test_SOURCES = opkg_active_list_test.c + #opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) + +-libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) ++libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) -lpthread + libopkg_test_SOURCE = libopkg_test.c + libopkg_test_LDFLAGS = -static + diff --git a/package/system/opkg/patches/070-use_gzipped_pkg_list.patch b/package/system/opkg/patches/071-use_gzipped_pkg_list.patch similarity index 85% rename from package/system/opkg/patches/070-use_gzipped_pkg_list.patch rename to package/system/opkg/patches/071-use_gzipped_pkg_list.patch index d32b519182..e102868d36 100644 --- a/package/system/opkg/patches/070-use_gzipped_pkg_list.patch +++ b/package/system/opkg/patches/071-use_gzipped_pkg_list.patch @@ -8,7 +8,7 @@ - FILE *in, *out; - struct _curl_cb_data cb_data; - char *tmp_file_name = NULL; - +- - sprintf_alloc(&tmp_file_name, "%s/%s.gz", tmp, - src->name); - @@ -26,7 +26,7 @@ - err = opkg_download(url, tmp_file_name, - (curl_progress_func) curl_progress_cb, - &cb_data, 0); -- + - if (err == 0) { - opkg_msg(INFO, "Inflating %s...\n", - tmp_file_name); @@ -87,34 +87,38 @@ opkg_msg(NOTICE, "Updated list of available packages in %s.\n", --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c -@@ -102,12 +102,18 @@ pkg_hash_add_from_file(const char *file_ - pkg_src_t *src, pkg_dest_t *dest, int is_status_file) - { - pkg_t *pkg; -- FILE *fp; -+ FILE *fp, *fp_c = NULL; +@@ -29,6 +29,7 @@ + #include "sprintf_alloc.h" + #include "file_util.h" + #include "libbb/libbb.h" ++#include "libbb/gzip.h" + + void + pkg_hash_init(void) +@@ -106,8 +107,15 @@ pkg_hash_add_from_file(const char *file_ char *buf; const size_t len = 4096; int ret = 0; -+ int pid; - - fp = fopen(file_name, "r"); -+ if (fp && src && src->gzip) { -+ fp_c = fp; -+ fp = gz_open(fp_c, &pid); -+ } ++ struct gzip_handle zh; + ++ if (src && src->gzip) { ++ fp = gzip_fdopen(&zh, file_name); ++ } ++ else { ++ fp = fopen(file_name, "r"); ++ } + +- fp = fopen(file_name, "r"); if (fp == NULL) { opkg_perror(ERROR, "Failed to open %s", file_name); return -1; -@@ -154,6 +160,10 @@ pkg_hash_add_from_file(const char *file_ - +@@ -155,6 +163,9 @@ pkg_hash_add_from_file(const char *file_ free(buf); fclose(fp); -+ if (fp_c) { -+ fclose(fp_c); -+ gz_close(pid); -+ } ++ if (src && src->gzip) ++ gzip_close(&zh); ++ return ret; } + diff --git a/package/system/opkg/patches/220-drop-release-support.patch b/package/system/opkg/patches/220-drop-release-support.patch index 131c2cba6b..b674e33a91 100644 --- a/package/system/opkg/patches/220-drop-release-support.patch +++ b/package/system/opkg/patches/220-drop-release-support.patch @@ -769,7 +769,7 @@ #include "pkg.h" #include "opkg_message.h" #include "pkg_vec.h" -@@ -183,40 +182,6 @@ pkg_hash_load_feeds(void) +@@ -184,40 +183,6 @@ pkg_hash_load_feeds(void) lists_dir = conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir; diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 8f3d57851c..b0e555e421 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -8,16 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=procd -PKG_VERSION:=2016-12-02 - -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=a07669704798cb0262485f69c5547033c64ade58 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=d6a6760133a8ceb78d717a851f426266a35e3957381876d91824e9877fa8c096 +PKG_SOURCE_DATE:=2017-01-10 +PKG_SOURCE_VERSION:=f7069032290a9720142b2ee2c6315d7e1f1a1bd3 +PKG_MIRROR_HASH:=3917269c1ed1f9b6d4a8f5559b2cdec6f91da3ad00ffe5375b5680f9e230b21d CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -36,7 +33,7 @@ include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk ifeq ($(DUMP),) - STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s) + STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) endif CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)" diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh index 70b9af559d..ebaaf2aa16 100644 --- a/package/system/procd/files/nand.sh +++ b/package/system/procd/files/nand.sh @@ -239,9 +239,18 @@ nand_upgrade_ubifs() { nand_do_upgrade_success } +nand_board_name() { + if type 'platform_nand_board_name' >/dev/null 2>/dev/null; then + platform_nand_board_name + return + fi + + cat /tmp/sysinfo/board_name +} + nand_upgrade_tar() { local tar_file="$1" - local board_name="$(cat /tmp/sysinfo/board_name)" + local board_name="$(nand_board_name)" local kernel_mtd="$(find_mtd_index $CI_KERNPART)" local kernel_length=`(tar xf $tar_file sysupgrade-$board_name/kernel -O | wc -c) 2> /dev/null` diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 290c90eb81..8f18cda70e 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -29,6 +29,9 @@ # procd_kill(service, [instance]): # Kill a service instance (or all instances) # +# procd_send_signal(service, [instance], [signal]) +# Send a signal to a service instance (or all instances) +# . $IPKG_INSTROOT/usr/share/libubox/jshn.sh @@ -210,7 +213,7 @@ _procd_set_param() { json_add_string "" "$@" json_close_array ;; - nice) + nice|reload_signal) json_add_int "$type" "$1" ;; pidfile|user|seccomp|capabilities) @@ -373,6 +376,18 @@ _procd_kill() { _procd_ubus_call delete } +_procd_send_signal() { + local service="$1" + local instance="$2" + local signal="$3" + + json_init + json_add_string name "$service" + [ -n "$instance" -a "$instance" != "*" ] && json_add_string instance "$instance" + [ -n "$signal" ] && json_add_int signal "$signal" + _procd_ubus_call signal +} + procd_open_data() { local name="$1" json_set_namespace procd __procd_old_cb @@ -457,4 +472,5 @@ _procd_wrapper \ procd_append_param \ procd_add_validation \ procd_set_config_changed \ - procd_kill + procd_kill \ + procd_send_signal diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index ef3f3c3c2f..9da7df85fb 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,21 +8,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_VERSION:=2016-06-30 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/rpcd.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME) -PKG_SOURCE_VERSION:=23417e94d25570e6d62542bac46edd51e8e0243a -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz +PKG_SOURCE_DATE:=2016-12-03 +PKG_SOURCE_VERSION:=0577cfc1acdbaf30c31090e75045ba58d6dd8a78 PKG_MAINTAINER:=Jo-Philipp Wich -PKG_MIRROR_MD5SUM:=a52ce026105ff6d944896686399d97960f34246b4f7e0c464ff6631ed33325c9 +PKG_MIRROR_HASH:=bbcd750df4867a57604e3b922e28f7a019cf940c3586d813d88001dc314e2a1c PKG_LICENSE:=ISC PKG_LICENSE_FILES:= -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile index fda9425612..8900c67803 100644 --- a/package/system/ubox/Makefile +++ b/package/system/ubox/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ubox -PKG_VERSION:=2016-09-26 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/ubox.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-09-26 PKG_SOURCE_VERSION:=5649c028c426060616e2bd4e7ea83271cd333d21 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=ee460ca724ff505966ca710a3363ac8d308f1a9a91de92b281d22d3d4df51de1 +PKG_MIRROR_HASH:=ae77504a4397f92173a7646fa3555e5b51abd7ff1dd1c419770223359e41937a CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index b2352f4f09..fadb436863 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ubus -PKG_VERSION:=2016-10-12 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/ubus.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-10-12 PKG_SOURCE_VERSION:=312448a5b147c221836827a7a641e76a4514db44 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=0d572863d46c9d6e89a573ed5db671f4eaff311df6fa5e8fa83b8f07e7dc928d +PKG_MIRROR_HASH:=adeeae238deaac2b6af77c2e4473febdcbc0f1c256734b2ff019c76b2f3f2aa6 CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 65cbf9d35c..b4d019cf39 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -8,20 +8,14 @@ include $(TOPDIR)/rules.mk -UCI_VERSION=2016-07-04 -UCI_RELEASE=1 - PKG_NAME:=uci -PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE)) PKG_RELEASE:=1 -PKG_REV:=e1bf4356e1b513e158e1b5049147087ed6342cfd -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL=$(LEDE_GIT)/project/uci.git -PKG_SOURCE_SUBDIR:=uci-$(PKG_VERSION) -PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE_PROTO:=git -PKG_MIRROR_MD5SUM:=1206aff4b41bc4aa78205c7537bc75886244c293cb5f08dc7ba3dc4def93a81c +PKG_SOURCE_DATE=2016-07-04 +PKG_SOURCE_VERSION:=e1bf4356e1b513e158e1b5049147087ed6342cfd +PKG_MIRROR_HASH:=4994a10a9e15f71312502f8babf045da7cea18c64227b387fc2dcf64f2252f19 PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= diff --git a/package/system/usign/Makefile b/package/system/usign/Makefile index cd14404d92..84adccb4a3 100644 --- a/package/system/usign/Makefile +++ b/package/system/usign/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=usign -PKG_VERSION:=2015-07-04 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/usign.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2015-07-04 PKG_SOURCE_VERSION:=ef6419142a3b0fbcddcccf536e3c1880302c6f89 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=8539292a3e8047bd7e94d4a5efc5c1228e100c7e6dfdc79670e869fb4aec3b70 +PKG_MIRROR_HASH:=9499ed7e40889b364e446a428e185c40986b75087888bd7e1496542457a6dbaa CMAKE_INSTALL:=1 PKG_CHECK_FORMAT_SECURITY:=1 PKG_USE_MIPS16:=0 diff --git a/package/utils/adb/Makefile b/package/utils/adb/Makefile new file mode 100644 index 0000000000..1e77bb7e8a --- /dev/null +++ b/package/utils/adb/Makefile @@ -0,0 +1,52 @@ +include $(TOPDIR)/rules.mk +#Based on adb package from AUR https://aur.archlinux.org/packages/adb/ , reused Makefile + +PKG_NAME:=adb +PKG_VERSION:=android.5.0.2_r1 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://android.googlesource.com/platform/system/core +PKG_SOURCE_VERSION:=6fe92d1a3fb17545d82d020a3c995f32e6b71f9d +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_MAINTAINER:=Henryk Heisig + +include $(INCLUDE_DIR)/package.mk + +ifeq ($(CONFIG_BIG_ENDIAN),y) +TARGET_CFLAGS+= -DHAVE_BIG_ENDIAN=1 +endif +TARGET_CFLAGS+= -D_GNU_SOURCE + +define Package/adb + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Android Debug Bridge CLI tool + URL:=http://tools.android.com/ + DEPENDS:=+zlib +libopenssl +libpthread +endef + +define Package/bridge/description + Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. +endef + +# Nothing just to be sure +#define Build/Configure +#endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/adb/ \ + $(TARGET_CONFIGURE_OPTS) \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" +endef + +define Package/adb/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/adb/adb $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,adb)) diff --git a/package/utils/adb/patches/001-create_Makefile.patch b/package/utils/adb/patches/001-create_Makefile.patch new file mode 100644 index 0000000000..be9f5f497a --- /dev/null +++ b/package/utils/adb/patches/001-create_Makefile.patch @@ -0,0 +1,45 @@ +--- /dev/null ++++ b/adb/Makefile 2016-10-19 15:28:03.421194137 +0200 +@@ -0,0 +1,42 @@ ++SRCS+= adb.c ++SRCS+= adb_auth_host.c ++SRCS+= adb_client.c ++SRCS+= commandline.c ++SRCS+= console.c ++SRCS+= fdevent.c ++SRCS+= file_sync_client.c ++SRCS+= get_my_path_linux.c ++SRCS+= services.c ++SRCS+= sockets.c ++SRCS+= transport.c ++SRCS+= transport_local.c ++SRCS+= transport_usb.c ++SRCS+= usb_linux.c ++ ++VPATH+= ../libcutils ++SRCS+= load_file.c ++SRCS+= socket_inaddr_any_server.c ++SRCS+= socket_local_client.c ++SRCS+= socket_local_server.c ++SRCS+= socket_loopback_client.c ++SRCS+= socket_loopback_server.c ++SRCS+= socket_network_client.c ++ ++VPATH+= ../libzipfile ++SRCS+= centraldir.c ++SRCS+= zipfile.c ++ ++CPPFLAGS+= -DADB_HOST=1 ++CPPFLAGS+= -DHAVE_FORKEXEC=1 ++CPPFLAGS+= -I. ++CPPFLAGS+= -I../include ++CPPFLAGS+= -D_FILE_OFFSET_BITS=64 ++ ++LIBS+= -lcrypto -lpthread -lz ++ ++OBJS= $(SRCS:.c=.o) ++ ++all: adb ++ ++adb: $(OBJS) ++ $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) diff --git a/package/utils/admswconfig/Makefile b/package/utils/admswconfig/Makefile index 6f4b6049e2..0524949dde 100644 --- a/package/utils/admswconfig/Makefile +++ b/package/utils/admswconfig/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.openwrt.org/sources -PKG_MD5SUM:=faafd4618f970119a665b11b21ac6a26 +PKG_HASH:=37b4409ea2105520b4a7327e53c3210251000ddf58f81a8e4c19e6ff9d615afe PKG_FLAGS:=nonshared diff --git a/package/utils/bsdiff/Makefile b/package/utils/bsdiff/Makefile index e5eef840b3..8589e77eae 100644 --- a/package/utils/bsdiff/Makefile +++ b/package/utils/bsdiff/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.daemonology.net/bsdiff/ -PKG_MD5SUM:=e6d812394f0e0ecc8d5df255aa1db22a +PKG_HASH:=18821588b2dc5bf159aa37d3bcb7b885d85ffd1e19f23a0c57a58723fea85f48 PKG_MAINTAINER:=Hauke Mehrtens HOST_BUILD_DEPENDS:=bzip2/host @@ -59,8 +59,8 @@ define Package/bspatch/install endef define Host/Install - $(INSTALL_DIR) $(STAGING_DIR)/host/bin/ - $(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR)/host/ install + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/ + $(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR_HOSTPKG)/ install endef define Host/Compile @@ -70,7 +70,7 @@ define Host/Compile endef define Host/Install - $(INSTALL_BIN) $(HOST_BUILD_DIR)/bsdiff $(STAGING_DIR)/host/bin/ + $(INSTALL_BIN) $(HOST_BUILD_DIR)/bsdiff $(STAGING_DIR_HOSTPKG)/bin/ endef $(eval $(call HostBuild)) diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index b2935defcf..e4f159ef83 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -15,7 +15,7 @@ PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_MD5SUM:=4f4c5de50b479b11ff636d7d8eb902a2 +PKG_HASH:=27667e0f2328fdbd79cfd622e4453e5c57e58f781c5da97c9be337d93aa2a02e PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 @@ -27,7 +27,7 @@ PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE include $(INCLUDE_DIR)/package.mk ifeq ($(DUMP),) - STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s) + STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5) endif ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) diff --git a/package/utils/bzip2/Makefile b/package/utils/bzip2/Makefile index 958b3c88c4..c17dee136b 100644 --- a/package/utils/bzip2/Makefile +++ b/package/utils/bzip2/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.bzip.org/$(PKG_VERSION) -PKG_MD5SUM:=00b516f4704d4a7cb50a1d97e6e8e15b +PKG_HASH:=a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=BZIP2 @@ -93,11 +93,11 @@ HOST_MAKE_FLAGS+= \ all HOST_CONFIGURE_ARGS+= \ - --prefix=$(STAGING_DIR)/host + --prefix=$(STAGING_DIR_HOSTPKG) define Host/Install - $(INSTALL_DIR) $(STAGING_DIR)/host/bin/ - $(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR)/host/ install + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/ + $(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR_HOSTPKG)/ install endef $(eval $(call HostBuild)) diff --git a/package/utils/ct-bugcheck/Makefile b/package/utils/ct-bugcheck/Makefile new file mode 100644 index 0000000000..5deb1e0d35 --- /dev/null +++ b/package/utils/ct-bugcheck/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2016 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)/kernel.mk + +PKG_NAME:=ct-bugcheck +PKG_RELEASE:=2016-07-21 + +include $(INCLUDE_DIR)/package.mk + +define Package/ct-bugcheck + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Bug checking and reporting utility + VERSION:=$(PKG_RELEASE) + MAINTAINER:=Ben Greear +endef + +define Package/ct-bugcheck/description + Scripts to check for bugs (like firmware crashes) and package them for reporting. + Currently this script only checks for ath10k firmware crashes. + Once installed, you can enable this tool by creating a file called + /etc/config/bugcheck with the following contents: + DO_BUGCHECK=1 + export DO_BUGCHECK + +endef + +define Build/Prepare + $(CP) src/bugcheck.sh $(PKG_BUILD_DIR)/ + $(CP) src/bugchecker.sh $(PKG_BUILD_DIR)/ + $(CP) src/bugcheck.initd $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + true +endef + +define Package/ct-bugcheck/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bugcheck.sh $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bugchecker.sh $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bugcheck.initd $(1)/etc/init.d/bugcheck +endef + +$(eval $(call BuildPackage,ct-bugcheck)) diff --git a/package/utils/ct-bugcheck/src/bugcheck.initd b/package/utils/ct-bugcheck/src/bugcheck.initd new file mode 100644 index 0000000000..b97a415bbf --- /dev/null +++ b/package/utils/ct-bugcheck/src/bugcheck.initd @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +START=99 + +USE_PROCD=1 +PROG=/usr/bin/bugchecker.sh + +# To actually make bugchecker.sh run, see comments +# at top of its file. + +start_service () { + procd_open_instance + procd_set_param command "$PROG" + procd_close_instance +} diff --git a/package/utils/ct-bugcheck/src/bugcheck.sh b/package/utils/ct-bugcheck/src/bugcheck.sh new file mode 100755 index 0000000000..85f70c5e79 --- /dev/null +++ b/package/utils/ct-bugcheck/src/bugcheck.sh @@ -0,0 +1,115 @@ +#!/bin/sh + +# Check for ath10k (and maybe other) bugs, package them up, +# and let user know what to do with them. + +TMPLOC=/tmp +CRASHDIR=$TMPLOC/bugcheck +FOUND_BUG=0 + +# set -x + +bugcheck_generic() +{ + echo "LEDE crashlog report" > $CRASHDIR/info.txt + date >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "uname" >> $CRASHDIR/info.txt + uname -a >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "os-release" >> $CRASHDIR/info.txt + cat /etc/os-release >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "os-release" >> $CRASHDIR/info.txt + cat /etc/os-release >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "dmesg output" >> $CRASHDIR/info.txt + dmesg >> $CRASHDIR/info.txt + if [ -x /usr/bin/lspci ] + then + echo >> $CRASHDIR/info.txt + echo "lspci" >> $CRASHDIR/info.txt + lspci >> $CRASHDIR/info.txt + fi + echo >> $CRASHDIR/info.txt + echo "cpuinfo" >> $CRASHDIR/info.txt + cat /proc/cpuinfo >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "meminfo" >> $CRASHDIR/info.txt + cat /proc/cpuinfo >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "cmdline" >> $CRASHDIR/info.txt + cat /proc/cmdline >> $CRASHDIR/info.txt + echo >> $CRASHDIR/info.txt + echo "lsmod" >> $CRASHDIR/info.txt + lsmod >> $CRASHDIR/info.txt +} + +roll_crashes() +{ + # Roll any existing crashes + if [ -d $CRASHDIR ] + then + if [ -d $CRASHDIR.1 ] + then + rm -fr $CRASHDIR.1 + fi + mv $CRASHDIR $CRASHDIR.1 + fi + + # Prepare location + mkdir -p $CRASHDIR +} + +# ath10k, check debugfs entries. +for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump +do + #echo "Checking $i" + if cat $i > $TMPLOC/ath10k_crash.bin 2>&1 + then + FOUND_BUG=1 + + #echo "Found ath10k crash data in $i" + roll_crashes + + ADIR=${i/fw_crash_dump/} + + CTFW=0 + if grep -- -ct- $TMPLOC/ath10k_crash.bin > /dev/null 2>&1 + then + CTFW=1 + fi + + echo "Send bug reports to:" > $CRASHDIR/report_to.txt + if [ -f $ADIR/ct_special -o $CTFW == "1" ] + then + # Looks like this is CT firmware or driver... + echo "greearb@candelatech.com" >> $CRASHDIR/report_to.txt + echo "and/or report or check for duplicates here:" >> $CRASHDIR/report_to.txt + echo "https://github.com/greearb/ath10k-ct/issues" >> $CRASHDIR/report_to.txt + else + # Not sure who would want these bug reports for upstream... + echo "https://www.lede-project.org/" >> $CRASHDIR/report_to.txt + fi + echo >> $CRASHDIR/report_to.txt + echo "Please attach all files in this directory to bug reports." >> $CRASHDIR/report_to.txt + + mv $TMPLOC/ath10k_crash.bin $CRASHDIR + + # Add any more ath10k specific stuff here. + + # And call generic bug reporting logic + bugcheck_generic + fi +done + +if [ $FOUND_BUG == "1" ] + then + # Notify LUCI somehow? + echo "bugcheck.sh found an issue to be reported" > /dev/kmsg + echo "See $CRASHDIR for details on how to report this" > /dev/kmsg + # Let calling code know something was wrong. + exit 1 +fi + +exit 0 diff --git a/package/utils/ct-bugcheck/src/bugchecker.sh b/package/utils/ct-bugcheck/src/bugchecker.sh new file mode 100755 index 0000000000..be305af390 --- /dev/null +++ b/package/utils/ct-bugcheck/src/bugchecker.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# Periodically call bugcheck.sh script + +CHECKER=bugcheck.sh +SLEEPFOR=60 + +DO_BUGCHECK=0 + +# So, to enable this, you create an /etc/config/bugcheck file +# with contents like: +# DO_BUGCHECK=1 +# export DO_BUGCHECK + +if [ -f /etc/config/bugcheck ] + then + . /etc/config/bugcheck +fi + +if [ $DO_BUGCHECK == 0 ] +then + exit 0 +fi + +while true + do + $CHECKER + sleep $SLEEPFOR +done diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index cf84c260c7..8c003639a8 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_VERSION:=1.43.3 -PKG_MD5SUM:=ce8ef1bbb0d4730f170167284fda156ac9d6bf18db2750eb94af619a81b19927 +PKG_HASH:=ce8ef1bbb0d4730f170167284fda156ac9d6bf18db2750eb94af619a81b19927 PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/package/utils/f2fs-tools/Makefile b/package/utils/f2fs-tools/Makefile index 8414052339..c0f4e3db64 100644 --- a/package/utils/f2fs-tools/Makefile +++ b/package/utils/f2fs-tools/Makefile @@ -15,7 +15,7 @@ PKG_LICENSE:=GPLv2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/ -PKG_MD5SUM:=9db22274264f0c88dbee012f257917b1 +PKG_HASH:=33d454c2e95aabef5659949c4fff15f6c9877b48349e64411de502bc62b0cbd4 PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/fuse/Makefile b/package/utils/fuse/Makefile index 19eba3c18d..d0cefff1ad 100644 --- a/package/utils/fuse/Makefile +++ b/package/utils/fuse/Makefile @@ -14,7 +14,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/libfuse/libfuse/releases/download/$(PKG_NAME)-$(PKG_VERSION) -PKG_MD5SUM:=9bd4ce8184745fd3d000ca2692adacdb +PKG_HASH:=832432d1ad4f833c20e13b57cf40ce5277a9d33e483205fc63c78111b3358874 PKG_LICENSE:=LGPLv2.1 GPLv2 PKG_LICENSE_FILES:=COPYING.LIB COPYING diff --git a/package/utils/jsonfilter/Makefile b/package/utils/jsonfilter/Makefile index d26370e939..b70928ba53 100644 --- a/package/utils/jsonfilter/Makefile +++ b/package/utils/jsonfilter/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=jsonfilter -PKG_VERSION:=2016-07-02 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/jsonpath.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2016-07-02 PKG_SOURCE_VERSION:=dea067ad67d977c247c300c06676a06adf21e0c7 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=44c6c1eeaf7adb5f08e6770d5f6c4dfd43b55e1590f90b972be64125a4ae5db0 +PKG_MIRROR_HASH:=6c0e30da3f0c82527f9b5285d7c6ae61406732f2b0543b93131fe115ffc2987a CMAKE_INSTALL:=1 PKG_MAINTAINER:=Jo-Philipp Wich diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index 4985452e4f..89b6a87117 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -16,7 +16,7 @@ PKG_SOURCE_URL:=http://www.lua.org/ftp/ \ http://ftp.gwdg.de/pub/languages/lua/ \ http://mirrors.dotsrc.org/lua/ \ http://www.tecgraf.puc-rio.br/lua/ftp/ -PKG_MD5SUM:=2e115fe26e435e33b0d5c022e4490567 +PKG_HASH:=2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=MIT @@ -111,7 +111,7 @@ define Build/Compile endef define Host/Configure - $(SED) 's,"/usr/local/","$(STAGING_DIR)/host/",' $(HOST_BUILD_DIR)/src/luaconf.h + $(SED) 's,"/usr/local/","$(STAGING_DIR_HOSTPKG)/",' $(HOST_BUILD_DIR)/src/luaconf.h endef ifeq ($(HOST_OS),Darwin) @@ -132,7 +132,7 @@ endef define Host/Install $(MAKE) -C $(HOST_BUILD_DIR) \ - INSTALL_TOP="$(STAGING_DIR)/host" \ + INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \ install endef diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index 8980b846b5..8f0fcf02b2 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MD5SUM:=2fd33dedcdb06f0d1461f50ddabb7e4a +PKG_HASH:=ec1d264e4126309aafe76d76067e8f3fd6649941cff6cb0242d467a1e66a01e0 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index 70706fb7e9..373f491002 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -8,19 +8,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_REV:=aea36417067dade75192bafa03af70b6eb2677b1 PKG_VERSION:=1.5.2 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=$(PKG_REV) -PKG_MIRROR_MD5SUM:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 +PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1 +PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 PKG_INSTALL:=1 +PKG_FLAGS:=nonshared + PKG_BUILD_DEPENDS:=util-linux liblzo zlib PKG_LICENSE:=GPLv2 diff --git a/package/utils/px5g-standalone/Makefile b/package/utils/px5g-standalone/Makefile index 9b878ae336..b8f68d7bf3 100644 --- a/package/utils/px5g-standalone/Makefile +++ b/package/utils/px5g-standalone/Makefile @@ -20,6 +20,7 @@ define Package/px5g-standalone SUBMENU:=Encryption TITLE:=X.509 certificate generator (standalone version) MAINTAINER:=Jo-Philipp Wich + PROVIDES:=px5g endef define Package/px5g-standalone/description diff --git a/package/utils/px5g/Makefile b/package/utils/px5g/Makefile index c5de03a02c..d33938173c 100644 --- a/package/utils/px5g/Makefile +++ b/package/utils/px5g/Makefile @@ -10,54 +10,41 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g PKG_RELEASE:=4 PKG_LICENSE:=LGPL-2.1 -PKG_BUILD_DIR:=$(BUILD_DIR)/px5g-$(BUILD_VARIANT) +PKG_BUILD_DIR:=$(BUILD_DIR)/px5g PKG_USE_MIPS16:=0 include $(INCLUDE_DIR)/package.mk -define Package/px5g/Template +define Package/px5g-mbedtls SECTION:=utils CATEGORY:=Utilities SUBMENU:=Encryption - TITLE:=X.509 certificate generator (using $(1)) + TITLE:=X.509 certificate generator (using mbedtls) MAINTAINER:=Jo-Philipp Wich - DEPENDS:=+lib$(1) + DEPENDS:=+libmbedtls PROVIDES:=px5g - VARIANT:=$(1) endef -define Package/px5g-polarssl/description +define Package/px5g-mbedtls/description Px5g is a tiny standalone X.509 certificate generator. It suitable to create key files and certificates in DER and PEM format for use with stunnel, uhttpd and others. endef -Package/px5g-mbedtls=$(call Package/px5g/Template,mbedtls) -Package/px5g-polarssl=$(call Package/px5g/Template,polarssl) -Package/px5g-mbedtls/description=$(Package/px5g-polarssl/description) - define Build/Prepare mkdir -p $(PKG_BUILD_DIR) endef -ifeq ($(BUILD_VARIANT),mbedtls) -TARGET_CFLAGS += -DMBEDTLS TARGET_LDFLAGS := -lmbedtls -lmbedx509 -lmbedcrypto -else -TARGET_LDFLAGS := -lpolarssl -endif define Build/Compile $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/px5g px5g.c $(TARGET_LDFLAGS) endef -define Package/px5g-polarssl/install +define Package/px5g-mbedtls/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/px5g $(1)/usr/sbin/px5g endef -Package/px5g-mbedtls/install=$(Package/px5g-polarssl/install) - -$(eval $(call BuildPackage,px5g-polarssl)) $(eval $(call BuildPackage,px5g-mbedtls)) diff --git a/package/utils/px5g/px5g.c b/package/utils/px5g/px5g.c index af8a5da87f..f0fe4dcfd3 100644 --- a/package/utils/px5g/px5g.c +++ b/package/utils/px5g/px5g.c @@ -30,20 +30,10 @@ #include #include -#ifdef MBEDTLS #include #include #include #include -#define lib_wrapper(x) mbedtls_##x -#define MD_SHA256 MBEDTLS_MD_SHA256 -#else -#include -#include -#include -#define lib_wrapper(x) x -#define MD_SHA256 POLARSSL_MD_SHA256 -#endif #define PX5G_VERSION "0.2" #define PX5G_COPY "Copyright (c) 2009 Steven Barth " @@ -83,15 +73,15 @@ static void write_file(const char *path, int len, bool pem) fclose(f); } -static void write_key(lib_wrapper(pk_context) *key, const char *path, bool pem) +static void write_key(mbedtls_pk_context *key, const char *path, bool pem) { int len = 0; if (pem) { - if (lib_wrapper(pk_write_key_pem(key, (void *) buf, sizeof(buf)) == 0)) + if (mbedtls_pk_write_key_pem(key, (void *) buf, sizeof(buf)) == 0) len = strlen(buf); } else { - len = lib_wrapper(pk_write_key_der(key, (void *) buf, sizeof(buf))); + len = mbedtls_pk_write_key_der(key, (void *) buf, sizeof(buf)); if (len < 0) len = 0; } @@ -99,17 +89,12 @@ static void write_key(lib_wrapper(pk_context) *key, const char *path, bool pem) write_file(path, len, pem); } -static void gen_key(lib_wrapper(pk_context) *key, int ksize, int exp, bool pem) +static void gen_key(mbedtls_pk_context *key, int ksize, int exp, bool pem) { - lib_wrapper(pk_init(key)); + mbedtls_pk_init(key); fprintf(stderr, "Generating RSA private key, %i bit long modulus\n", ksize); -#ifdef MBEDTLS mbedtls_pk_setup(key, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)); if (mbedtls_rsa_gen_key(mbedtls_pk_rsa(*key), _urandom, NULL, ksize, exp)) { -#else - pk_init_ctx(key, lib_wrapper(pk_info_from_type(POLARSSL_PK_RSA))); - if (rsa_gen_key(pk_rsa(*key), _urandom, NULL, ksize, exp)) { -#endif fprintf(stderr, "error: key generation failed\n"); exit(1); } @@ -117,7 +102,7 @@ static void gen_key(lib_wrapper(pk_context) *key, int ksize, int exp, bool pem) int rsakey(char **arg) { - lib_wrapper(pk_context) key; + mbedtls_pk_context key; unsigned int ksize = 512; int exp = 65537; char *path = NULL; @@ -141,16 +126,16 @@ int rsakey(char **arg) gen_key(&key, ksize, exp, pem); write_key(&key, path, pem); - lib_wrapper(pk_free(&key)); + mbedtls_pk_free(&key); return 0; } int selfsigned(char **arg) { - lib_wrapper(pk_context) key; - lib_wrapper(x509write_cert) cert; - lib_wrapper(mpi) serial; + mbedtls_pk_context key; + mbedtls_x509write_cert cert; + mbedtls_mpi serial; char *subject = ""; unsigned int ksize = 512; @@ -227,34 +212,34 @@ int selfsigned(char **arg) fprintf(stderr, "Generating selfsigned certificate with subject '%s'" " and validity %s-%s\n", subject, fstr, tstr); - lib_wrapper(x509write_crt_init(&cert)); - lib_wrapper(x509write_crt_set_md_alg(&cert, MD_SHA256)); - lib_wrapper(x509write_crt_set_issuer_key(&cert, &key)); - lib_wrapper(x509write_crt_set_subject_key(&cert, &key)); - lib_wrapper(x509write_crt_set_subject_name(&cert, subject)); - lib_wrapper(x509write_crt_set_issuer_name(&cert, subject)); - lib_wrapper(x509write_crt_set_validity(&cert, fstr, tstr)); - lib_wrapper(x509write_crt_set_basic_constraints(&cert, 0, -1)); - lib_wrapper(x509write_crt_set_subject_key_identifier(&cert)); - lib_wrapper(x509write_crt_set_authority_key_identifier(&cert)); + mbedtls_x509write_crt_init(&cert); + mbedtls_x509write_crt_set_md_alg(&cert, MBEDTLS_MD_SHA256); + mbedtls_x509write_crt_set_issuer_key(&cert, &key); + mbedtls_x509write_crt_set_subject_key(&cert, &key); + mbedtls_x509write_crt_set_subject_name(&cert, subject); + mbedtls_x509write_crt_set_issuer_name(&cert, subject); + mbedtls_x509write_crt_set_validity(&cert, fstr, tstr); + mbedtls_x509write_crt_set_basic_constraints(&cert, 0, -1); + mbedtls_x509write_crt_set_subject_key_identifier(&cert); + mbedtls_x509write_crt_set_authority_key_identifier(&cert); _urandom(NULL, buf, 8); for (len = 0; len < 8; len++) sprintf(sstr + len*2, "%02x", (unsigned char) buf[len]); - lib_wrapper(mpi_init(&serial)); - lib_wrapper(mpi_read_string(&serial, 16, sstr)); - lib_wrapper(x509write_crt_set_serial(&cert, &serial)); + mbedtls_mpi_init(&serial); + mbedtls_mpi_read_string(&serial, 16, sstr); + mbedtls_x509write_crt_set_serial(&cert, &serial); if (pem) { - if (lib_wrapper(x509write_crt_pem(&cert, (void *) buf, sizeof(buf), _urandom, NULL) < 0)) { + if (mbedtls_x509write_crt_pem(&cert, (void *) buf, sizeof(buf), _urandom, NULL) < 0) { fprintf(stderr, "Failed to generate certificate\n"); return 1; } len = strlen(buf); } else { - len = lib_wrapper(x509write_crt_der(&cert, (void *) buf, sizeof(buf), _urandom, NULL)); + len = mbedtls_x509write_crt_der(&cert, (void *) buf, sizeof(buf), _urandom, NULL); if (len < 0) { fprintf(stderr, "Failed to generate certificate: %d\n", len); return 1; @@ -262,9 +247,9 @@ int selfsigned(char **arg) } write_file(certpath, len, pem); - lib_wrapper(x509write_crt_free(&cert)); - lib_wrapper(mpi_free(&serial)); - lib_wrapper(pk_free(&key)); + mbedtls_x509write_crt_free(&cert); + mbedtls_mpi_free(&serial); + mbedtls_pk_free(&key); return 0; } diff --git a/package/utils/ugps/Makefile b/package/utils/ugps/Makefile index e85f9326c4..07769e1516 100644 --- a/package/utils/ugps/Makefile +++ b/package/utils/ugps/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ugps -PKG_VERSION:=2016-10-24 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL=$(LEDE_GIT)/project/ugps.git PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2016-10-24 PKG_SOURCE_VERSION:=32a6b2b702c3b9f8c425f3d9dc9f4273e276029c -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=a353c722c3fe490dec1b6180c215e6a1d502e843c780dd97d556d1b346e8fa49 +PKG_MIRROR_HASH:=41d24ef335e9b2847895b04cee4d1c7efa56fc207798f5858e7a1f229a33c5eb PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0+ diff --git a/package/utils/usbmode/Makefile b/package/utils/usbmode/Makefile index d835d373ba..d07b508647 100644 --- a/package/utils/usbmode/Makefile +++ b/package/utils/usbmode/Makefile @@ -1,15 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=usbmode -PKG_VERSION:=2014-08-26 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(LEDE_GIT)/project/usbmode.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2014-08-26 PKG_SOURCE_VERSION:=993a9a542791953c4804f7ddbb3a07756738e37a -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=4ba4ed629ef4530fd5a60b84cf5bf7a7194f60b69068882d47c1d3c55e06fc8c +PKG_MIRROR_HASH:=dc4daa80a0d51524b41c6bf67cb368ca51fcfba1217adedd6823b24a68be5bf4 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -28,7 +26,7 @@ include $(INCLUDE_DIR)/cmake.mk define Download/data FILE:=$(PKG_DATA_FILENAME) URL:=$(PKG_DATA_URL) - MD5SUM:=662bcd56a97e560ea974bc710822de51 + HASH:=90549f589835a68279369c3dc0d47eb7338ee3bad09d737e7b85e1ab15bd2d8b endef $(eval $(call Download,data)) diff --git a/package/utils/usbutils/Makefile b/package/utils/usbutils/Makefile index 482d4c4352..29b1f85e14 100644 --- a/package/utils/usbutils/Makefile +++ b/package/utils/usbutils/Makefile @@ -9,18 +9,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=usbutils PKG_VERSION:=007 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/usb/usbutils -PKG_MD5SUM:=7593a01724bbc0fd9fe48e62bc721ceb61c76654f1d7b231b3c65f6dfbbaefa4 +PKG_HASH:=7593a01724bbc0fd9fe48e62bc721ceb61c76654f1d7b231b3c65f6dfbbaefa4 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING -USB_IDS_VERSION:=2016-07-21 -USB_IDS_MD5SUM:=49214de0abe87ed2f1d854a38387d97ddda61bb0a4bd41b91b3deb72242dfa68 -USB_IDS_FILE:=usb.ids - PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 @@ -36,16 +32,19 @@ define Package/usbutils URL:=http://www.linux-usb.org/ endef +USB_IDS_REV:=ae25707c751fff79148328229a76fc44232abeae +USB_IDS_FILE:=usb.ids.$(USB_IDS_REV) define Download/usb_ids FILE:=$(USB_IDS_FILE) - URL:=@GITHUB/gentoo/hwids/83b7c8958d17329ee6c0224b38e41c0bc4c66bcd - MD5SUM:=$(USB_IDS_MD5SUM) + URL_FILE:=usb.ids + URL:=@GITHUB/gentoo/hwids/ae25707c751fff79148328229a76fc44232abeae + HASH:=eca5d4b4b2c72e61d5d6d67b5dc6f75e92b4ac9cf9cdf1344f06622e0f57d82f endef $(eval $(call Download,usb_ids)) define Build/Prepare $(Build/Prepare/Default) - $(CP) $(DL_DIR)/$(USB_IDS_FILE) $(PKG_BUILD_DIR) + $(CP) $(DL_DIR)/$(USB_IDS_FILE) $(PKG_BUILD_DIR)/usb.ids endef CONFIGURE_ARGS += \ diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 6d5f47c434..17f22e1ae4 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.28 -PKG_MD5SUM:=e534e6ccc49107e5d31c329af798ef7d +PKG_HASH:=395847e2a18a2c317170f238892751e73a57104565344f8644090c8b091014bb PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= COPYING \ diff --git a/package/utils/xfsprogs/Makefile b/package/utils/xfsprogs/Makefile index cd9d5f9d38..fb350993f2 100644 --- a/package/utils/xfsprogs/Makefile +++ b/package/utils/xfsprogs/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=xfsprogs PKG_RELEASE:=1 PKG_VERSION:=3.1.7 PKG_SOURCE_URL:=ftp://oss.sgi.com/projects/xfs/previous/ -PKG_MD5SUM:=049cf9873794ea49d0bb3f12d45748a4 +PKG_HASH:=e150914210ac5fd29c098ef0fd94bdec51d2fb231cf9faa765c16ec6d75c8eaa PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_INSTALL:=1 diff --git a/rules.mk b/rules.mk index d455f0d960..04fd936660 100644 --- a/rules.mk +++ b/rules.mk @@ -15,6 +15,11 @@ endif include $(TOPDIR)/include/debug.mk include $(TOPDIR)/include/verbose.mk +ifneq ($(filter check,$(MAKECMDGOALS)),) +CHECK:=1 +DUMP:=1 +endif + export TMP_DIR:=$(TOPDIR)/tmp qstrip=$(strip $(subst ",,$(1))) @@ -50,6 +55,8 @@ __tr_template = $(__tr_head)$$(1)$(__tr_tail) $(eval toupper = $(call __tr_template,$(chars_lower),$(chars_upper))) $(eval tolower = $(call __tr_template,$(chars_upper),$(chars_lower))) +version_abbrev = $(if $(if $(CHECK),,$(DUMP)),$(1),$(shell printf '%.8s' $(1))) + _SINGLE=export MAKEFLAGS=$(space); CFLAGS:= ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH))))) @@ -376,7 +383,7 @@ endef # $(1) => Input directory define sha256sums (cd $(1); find . -maxdepth 1 -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ - xargs openssl dgst -sha256 | sed -ne 's!^SHA256(\(.*\))= \(.*\)$$!\2 *\1!p' > sha256sums) + xargs -r $(STAGING_DIR_HOST)/bin/mkhash -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums) endef # file extension @@ -386,6 +393,9 @@ all: FORCE: ; .PHONY: FORCE +check: FORCE + @true + val.%: @$(if $(filter undefined,$(origin $*)),\ echo "$* undefined" >&2, \ diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh index aba1cd6268..dfc2b85a47 100755 --- a/scripts/bundle-libraries.sh +++ b/scripts/bundle-libraries.sh @@ -2,7 +2,7 @@ # # Script to install host system binaries along with required libraries. # -# Copyright (C) 2012-2013 Jo-Philipp Wich +# Copyright (C) 2012-2017 Jo-Philipp Wich # # 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 @@ -27,6 +27,13 @@ _cp() { } } +_mv() { + mv ${VERBOSE:+-v} "$1" "$2" || { + echo "mv($1 $2) failed" >&2 + exit 1 + } +} + _md() { mkdir ${VERBOSE:+-v} -p "$1" || { echo "mkdir($1) failed" >&2 @@ -41,6 +48,52 @@ _ln() { } } +_relpath() { + local base="$(readlink -f "$1")" + local dest="$(readlink -f "$2")" + local up + + [ -d "$base" ] || base="${base%/*}" + [ -d "$dest" ] || dest="${dest%/*}" + + while true; do + case "$base" + in "$dest"/*) + echo "$up/${base#$dest/}" + break + ;; + *) + dest="${dest%/*}" + up="${up:+$up/}.." + ;; + esac + done +} + +_wrapper() { + cat <<-EOT | ${CC:-gcc} -x c -o "$1" - + #include + #include + + int main(int argc, char **argv) { + const char *self = argv[0]; + const char *target = argv[1]; + + if (argc < 3) { + fprintf(stderr, "Usage: %s executable arg0 [args...]\n", self); + return 1; + } + + return execv(target, argv + 2); + } + EOT + + [ -x "$1" ] || { + echo "compiling wrapper failed" >&2 + exit 5 + } +} + for LDD in ${PATH//://ldd }/ldd; do "$LDD" --version >/dev/null 2>/dev/null && break LDD="" @@ -49,29 +102,31 @@ done [ -n "$LDD" -a -x "$LDD" ] || LDD= for BIN in "$@"; do - [ -n "$BIN" -a -x "$BIN" -a -n "$DIR" ] || { + [ -n "$BIN" -a -n "$DIR" ] || { echo "Usage: $0 ..." >&2 exit 1 } - [ ! -d "$DIR/bundled/lib" ] && { - _md "$DIR/bundled/lib" - _md "$DIR/bundled/usr" - _ln "../lib" "$DIR/bundled/usr/lib" + [ ! -d "$DIR/lib" ] && { + _md "$DIR/lib" + _md "$DIR/usr" + _ln "../lib" "$DIR/usr/lib" + } + + [ ! -x "$DIR/lib/runas" ] && { + _wrapper "$DIR/lib/runas" } LDSO="" - echo "Bundling ${BIN##*/}" - [ -n "$LDD" ] && { + [ -n "$LDD" ] && [ -x "$BIN" ] && file "$BIN" | grep -sqE "ELF.*executable" && { for token in $("$LDD" "$BIN" 2>/dev/null); do case "$token" in */*.so*) case "$token" in *ld-*.so*) LDSO="${token##*/}" ;; - *) echo " * lib: ${token##*/}" ;; esac - dest="$DIR/bundled/lib/${token##*/}" + dest="$DIR/lib/${token##*/}" ddir="${dest%/*}" [ -f "$token" -a ! -f "$dest" ] && { @@ -82,29 +137,22 @@ for BIN in "$@"; do done } - _md "$DIR" - # is a dynamically linked executable if [ -n "$LDSO" ]; then - _cp "$BIN" "$DIR/bundled/${BIN##*/}" + echo "Bundling ${BIN##*/}" + RUNDIR="$(readlink -f "$BIN")"; RUNDIR="${RUNDIR%/*}" RUN="${LDSO#ld-}"; RUN="run-${RUN%%.so*}.sh" + REL="$(_relpath "$DIR/lib" "$BIN")" - [ -x "$DIR/bundled/$RUN" ] || { - cat <<-EOF > "$DIR/bundled/$RUN" - #!/usr/bin/env bash - dir="\$(dirname "\$0")" - bin="\$(basename "\$0")" - exec -a "\$0" "\$dir/bundled/lib/$LDSO" --library-path "\$dir/bundled/lib" "\$dir/bundled/\$bin" "\$@" - EOF - chmod ${VERBOSE:+-v} 0755 "$DIR/bundled/$RUN" - } + _mv "$BIN" "$RUNDIR/.${BIN##*/}.bin" - _ln "./bundled/$RUN" "$DIR/${BIN##*/}" + cat <<-EOF > "$BIN" + #!/usr/bin/env bash + dir="\$(dirname "\$0")" + exec "\$dir/${REL:+$REL/}$LDSO" --library-path "\$dir/${REL:+$REL/}" "\$dir/${REL:+$REL/}runas" "\$dir/.${BIN##*/}.bin" "\$0" "\$@" + EOF - # is a static executable or non-elf binary - else - [ -n "$LDD" ] && echo " * not dynamically linked" - _cp "$BIN" "$DIR/${BIN##*/}" + chmod ${VERBOSE:+-v} 0755 "$BIN" fi done diff --git a/scripts/combined-ext-image.sh b/scripts/combined-ext-image.sh index 374fe6e344..0c7b1d993d 100755 --- a/scripts/combined-ext-image.sh +++ b/scripts/combined-ext-image.sh @@ -47,7 +47,7 @@ while [ "$#" -gt 1 ] [ ! -f "$file" ] && echo "$ME: Not a valid file: $file" && usage FILES="$FILES $file" - md5=$(cat "$file" | md5sum -) + md5=$(mkhash md5 "$file") printf "%-32s%08x%32s" "$filename" $(stat -c "%s" "$file") "${md5%% *}" >> $IMG_OUT shift 2 done diff --git a/scripts/combined-image.sh b/scripts/combined-image.sh index 5472b2cfd2..4e00cb89a2 100644 --- a/scripts/combined-image.sh +++ b/scripts/combined-image.sh @@ -16,7 +16,7 @@ dd if="$1" of="$kern" bs=$BLKSZ conv=sync 2>/dev/null dd if="$2" of="$root" bs=$BLKSZ conv=sync 2>/dev/null # Calculate md5sum over combined kernel and rootfs image. -md5=$(cat "$kern" "$root" | md5sum -) +md5=$(cat "$kern" "$root" | mkhash md5) # Write image header followed by kernel and rootfs image. # The header is padded to 64k, format is: diff --git a/scripts/download.pl b/scripts/download.pl index c8149800d3..bcac82ad10 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -11,6 +11,7 @@ use strict; use warnings; use File::Basename; use File::Copy; +use Text::ParseWords; @ARGV > 2 or die "Syntax: $0 [ ...]\n"; @@ -64,21 +65,33 @@ sub hash_cmd() { my $len = length($file_hash); my $cmd; - $len == 64 and return "openssl dgst -sha256 | sed -e 's,.*= ,,'"; - $len == 32 and do { - my $cmd = which("md5sum") || which("md5") || die 'no md5 checksum program found, please install md5 or md5sum'; - chomp $cmd; - return $cmd; - }; + $len == 64 and return "mkhash sha256"; + $len == 32 and return "mkhash md5"; return undef; } +sub download_cmd($) { + my $url = shift; + my $have_curl = 0; + + if (open CURL, '-|', 'curl', '--version') { + if (defined(my $line = readline CURL)) { + $have_curl = 1 if $line =~ /^curl /; + } + close CURL; + } + + return $have_curl + ? (qw(curl --connect-timeout 20 --retry 5 --location --insecure), shellwords($ENV{CURL_OPTIONS} || ''), $url) + : (qw(wget --tries=5 --timeout=20 --no-check-certificate --output-document=-), shellwords($ENV{WGET_OPTIONS} || ''), $url) + ; +} + my $hash_cmd = hash_cmd(); sub download { my $mirror = shift; - my $options = $ENV{WGET_OPTIONS} || ""; $mirror =~ s!/$!!; @@ -125,18 +138,19 @@ sub download } }; } else { - open WGET, "wget -t5 --timeout=20 --no-check-certificate $options -O- '$mirror/$url_filename' |" or die "Cannot launch wget.\n"; + my @cmd = download_cmd("$mirror/$url_filename"); + open(FETCH_FD, '-|', @cmd) or die "Cannot launch curl or wget.\n"; $hash_cmd and do { open MD5SUM, "| $hash_cmd > '$target/$filename.hash'" or die "Cannot launch $hash_cmd.\n"; }; open OUTPUT, "> $target/$filename.dl" or die "Cannot create file $target/$filename.dl: $!\n"; my $buffer; - while (read WGET, $buffer, 1048576) { + while (read FETCH_FD, $buffer, 1048576) { $hash_cmd and print MD5SUM $buffer; print OUTPUT $buffer; } $hash_cmd and close MD5SUM; - close WGET; + close FETCH_FD; close OUTPUT; if ($? >> 8) { @@ -226,7 +240,7 @@ foreach my $mirror (@ARGV) { push @mirrors, "ftp://ftp.riken.jp/Linux/kernel.org/$dir"; push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir"; } - } elsif ($mirror =~ /^\@KERNEL_LIBRE\/(.+)$/) { + } elsif ($mirror =~ /^\@KERNEL_LIBRE\/(.+)$/) { my @extra = ( $1 ); if ($filename =~ /linux-libre-\d+\.\d+(?:\.\d+)?-rc-gnu/) { push @extra, "$extra[0]/testing"; @@ -236,7 +250,7 @@ foreach my $mirror (@ARGV) { foreach my $dir (@extra) { push @mirrors, "http://linux-libre.fsfla.org/pub/linux-libre/releases/$dir"; } - } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { + } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { push @mirrors, "http://mirror.csclub.uwaterloo.ca/gnome/sources/$1"; push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1"; push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1"; @@ -256,12 +270,11 @@ push @mirrors, 'http://sources.lede-project.org'; push @mirrors, 'http://mirror2.openwrt.org/sources'; push @mirrors, 'http://downloads.openwrt.org/sources'; -while (!$ok) { +while (!-f "$target/$filename") { my $mirror = shift @mirrors; $mirror or die "No more mirrors to try - giving up.\n"; download($mirror); - -f "$target/$filename" and $ok = 1; } $SIG{INT} = \&cleanup; diff --git a/scripts/fixup-makefile.pl b/scripts/fixup-makefile.pl new file mode 100755 index 0000000000..9026ddcce4 --- /dev/null +++ b/scripts/fixup-makefile.pl @@ -0,0 +1,135 @@ +#!/usr/bin/env perl +use strict; + +my $error; +my %state; + +sub usage() { +die < [] + +Commands: +add-hash +fix-hash +rename-var + +EOF +} + +sub set_var($) { + my $var = shift; + + $state{var} = $var; + if ($var =~ /(.*):(.*)/) { + $state{template} = $1; + $state{var} = $2; + $state{related_var} = "URL"; + } else { + $state{context} = 1; + $state{related_var} = "PKG_SOURCE"; + } +} + +my %check_command = ( + "add-hash" => sub { + set_var($ARGV[0]); + + $state{value} = $ARGV[1]; + length($ARGV[1]) == 64 or die "Invalid hash value\n"; + }, + "fix-hash" => sub { + set_var($ARGV[0]); + + $state{value} = $ARGV[1]; + $state{prev_value} = $ARGV[2]; + + length($ARGV[1]) == 64 or die "Invalid hash value\n"; + }, + "rename-var" => sub { + set_var($ARGV[0]); + $state{new_var} = $ARGV[1]; + $state{new_var} =~ s/.*://g; + }, +); + +sub check_context($) { + my $line = shift; + return unless $state{template}; + + $state{next} and do { + $state{context} = 1; + undef $state{next}; + return; + }; + + if (not $state{context}) { + $line =~ /^\s*define\s+$state{template}/ and $state{next} = 1; + } else { + $line =~ /^\s*endef/ and do { + $state{done} = 1; + undef $state{context}; + } + } +} + +my %commands = ( + "add-hash" => sub { + my $line = shift; + check_context($line); + return $line unless $state{context}; + + # skip existing hash variable + return "" if $line =~ /^(\s*)$state{var}(\s*):?=(\s*)(.*)\n/; + + # insert md5sum after related variable + return $line unless $line =~ /^(\s*)$state{related_var}(\s*):?=(\s*)(.*)\n/; + return "$line$1$state{var}$2:=$3$state{value}\n"; + }, + "fix-hash" => sub { + my $line = shift; + check_context($line); + return $line unless $state{context}; + return $line unless $line =~ /^(\s*)$state{var}(\s*):?=(\s*)(.*)$state{prev_value}(.*)\n/; + $state{done} = 1; + $4 =~ /\$/ and do { + warn "$state{var} contains a reference to another variable, can't fix automatically\n"; + return $line; + }; + return "$1$state{var}$2:=$3$state{value}\n"; + }, + "rename-var" => sub { + my $line = shift; + check_context($line); + return $line unless $state{context}; + return $line unless $line =~ /^(\s*)$state{var}(\s*:?=.*)\n/; + return "$1$state{new_var}$2\n"; + }, +); + +my $file = shift @ARGV; +my $command = shift @ARGV; + +($file and $command and $check_command{$command}) or usage; +&{$check_command{$command}}(); + +-f $file or die "File $file not found\n"; + +open IN, "<${file}" or die "Cannot open input file\n"; +open OUT, ">${file}.new" or die "Cannot open output file\n"; + +my $cmd = $commands{$command}; +while (my $line = ) { + $line = &$cmd($line) unless $state{done}; + print OUT $line; + last if $error; +} + +close OUT; +close IN; + +$error and do { + unlink "${file}.new"; + exit 1; +}; + +rename "${file}.new", "$file"; diff --git a/scripts/getver.sh b/scripts/getver.sh index 60843be4f6..ecf048f4c1 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -12,7 +12,7 @@ try_version() { } try_git() { - REBOOT=375587f4b29039d86880030c6ab9a135e0342567 + REBOOT=ee53a240ac902dc83209008a2671e7fdcf55957a git rev-parse --git-dir >/dev/null 2>&1 || return 1 [ -n "$GET_REV" ] || GET_REV="HEAD" diff --git a/scripts/ipkg-make-index.sh b/scripts/ipkg-make-index.sh index 1822227413..dcd11ca191 100755 --- a/scripts/ipkg-make-index.sh +++ b/scripts/ipkg-make-index.sh @@ -8,7 +8,6 @@ if [ -z $pkg_dir ] || [ ! -d $pkg_dir ]; then exit 1 fi -which md5sum >/dev/null 2>&1 || alias md5sum=md5 empty=1 for pkg in `find $pkg_dir -name '*.ipk' | sort`; do @@ -19,13 +18,11 @@ for pkg in `find $pkg_dir -name '*.ipk' | sort`; do [[ "$name" = "libc" ]] && continue echo "Generating index for package $pkg" >&2 file_size=$(ls -l $pkg | awk '{print $5}') - md5sum=$(md5sum $pkg | awk '{print $1}') - sha256sum=$(openssl dgst -sha256 $pkg | awk '{print $2}') + sha256sum=$(mkhash sha256 $pkg) # Take pains to make variable value sed-safe sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'` tar -xzOf $pkg ./control.tar.gz | tar xzOf - ./control | sed -e "s/^Description:/Filename: $sed_safe_pkg\\ Size: $file_size\\ -MD5Sum: $md5sum\\ SHA256sum: $sha256sum\\ Description:/" echo "" diff --git a/scripts/mkhash.c b/scripts/mkhash.c new file mode 100644 index 0000000000..0f5815f242 --- /dev/null +++ b/scripts/mkhash.c @@ -0,0 +1,827 @@ +/* + * Copyright (C) 2016 Felix Fietkau + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * -- MD5 code: + * + * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. + * MD5 Message-Digest Algorithm (RFC 1321). + * + * Homepage: + * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 + * + * Author: + * Alexander Peslyak, better known as Solar Designer + * + * This software was written by Alexander Peslyak in 2001. No copyright is + * claimed, and the software is hereby placed in the public domain. + * In case this attempt to disclaim copyright and place the software in the + * public domain is deemed null and void, then the software is + * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the + * general public under the following terms: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * There's ABSOLUTELY NO WARRANTY, express or implied. + * + * (This is a heavily cut-down "BSD license".) + * + * This differs from Colin Plumb's older public domain implementation in that + * no exactly 32-bit integer data type is required (any 32-bit or wider + * unsigned integer data type will do), there's no compile-time endianness + * configuration, and the function prototypes match OpenSSL's. No code from + * Colin Plumb's implementation has been reused; this comment merely compares + * the properties of the two independent implementations. + * + * The primary goals of this implementation are portability and ease of use. + * It is meant to be fast, but not as fast as possible. Some known + * optimizations are not included to reduce source code size and avoid + * compile-time configuration. + * + * -- SHA256 Code: + * + * Copyright 2005 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + */ + + + +#include +#include +#include +#include +#include +#include + +#define ARRAY_SIZE(_n) (sizeof(_n) / sizeof((_n)[0])) + +static void +be32enc(void *buf, uint32_t u) +{ + uint8_t *p = buf; + + p[0] = ((uint8_t) ((u >> 24) & 0xff)); + p[1] = ((uint8_t) ((u >> 16) & 0xff)); + p[2] = ((uint8_t) ((u >> 8) & 0xff)); + p[3] = ((uint8_t) (u & 0xff)); +} + +static void +be64enc(void *buf, uint64_t u) +{ + uint8_t *p = buf; + + be32enc(p, ((uint32_t) (u >> 32))); + be32enc(p + 4, ((uint32_t) (u & 0xffffffffULL))); +} + + +static uint16_t +be16dec(const void *buf) +{ + const uint8_t *p = buf; + + return (((uint16_t) p[0]) << 8) | p[1]; +} + +static uint32_t +be32dec(const void *buf) +{ + const uint8_t *p = buf; + + return (((uint32_t) be16dec(p)) << 16) | be16dec(p + 2); +} + +#define MD5_DIGEST_LENGTH 16 + +typedef struct MD5_CTX { + uint32_t lo, hi; + uint32_t a, b, c, d; + unsigned char buffer[64]; +} MD5_CTX; + +/* + * The basic MD5 functions. + * + * F and G are optimized compared to their RFC 1321 definitions for + * architectures that lack an AND-NOT instruction, just like in Colin Plumb's + * implementation. + */ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) +#define H(x, y, z) (((x) ^ (y)) ^ (z)) +#define H2(x, y, z) ((x) ^ ((y) ^ (z))) +#define I(x, y, z) ((y) ^ ((x) | ~(z))) + +/* + * The MD5 transformation for all four rounds. + */ +#define STEP(f, a, b, c, d, x, t, s) \ + (a) += f((b), (c), (d)) + (x) + (t); \ + (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ + (a) += (b); + +/* + * SET reads 4 input bytes in little-endian byte order and stores them + * in a properly aligned word in host byte order. + */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define SET(n) \ + (*(uint32_t *)&ptr[(n) * 4]) +#define GET(n) \ + SET(n) +#else +#define SET(n) \ + (block[(n)] = \ + (uint32_t)ptr[(n) * 4] | \ + ((uint32_t)ptr[(n) * 4 + 1] << 8) | \ + ((uint32_t)ptr[(n) * 4 + 2] << 16) | \ + ((uint32_t)ptr[(n) * 4 + 3] << 24)) +#define GET(n) \ + (block[(n)]) +#endif + +/* + * This processes one or more 64-byte data blocks, but does NOT update + * the bit counters. There are no alignment requirements. + */ +static const void *MD5_body(MD5_CTX *ctx, const void *data, unsigned long size) +{ + const unsigned char *ptr; + uint32_t a, b, c, d; + uint32_t saved_a, saved_b, saved_c, saved_d; +#if __BYTE_ORDER != __LITTLE_ENDIAN + uint32_t block[16]; +#endif + + ptr = (const unsigned char *)data; + + a = ctx->a; + b = ctx->b; + c = ctx->c; + d = ctx->d; + + do { + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; + +/* Round 1 */ + STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) + STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) + STEP(F, c, d, a, b, SET(2), 0x242070db, 17) + STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) + STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) + STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) + STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) + STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) + STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) + STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) + STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) + STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) + STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) + STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) + STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) + STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) + +/* Round 2 */ + STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) + STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) + STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) + STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) + STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) + STEP(G, d, a, b, c, GET(10), 0x02441453, 9) + STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) + STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) + STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) + STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) + STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) + STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) + STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) + STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) + STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) + STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) + +/* Round 3 */ + STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) + STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) + STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) + STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) + STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) + STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) + STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) + STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) + STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) + STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) + STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) + STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) + STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) + STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) + STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) + STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) + +/* Round 4 */ + STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) + STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) + STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) + STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) + STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) + STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) + STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) + STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) + STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) + STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) + STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) + STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) + STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) + STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) + STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) + STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) + + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + + ptr += 64; + } while (size -= 64); + + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; + + return ptr; +} + +void MD5_begin(MD5_CTX *ctx) +{ + ctx->a = 0x67452301; + ctx->b = 0xefcdab89; + ctx->c = 0x98badcfe; + ctx->d = 0x10325476; + + ctx->lo = 0; + ctx->hi = 0; +} + +static void +MD5_hash(const void *data, size_t size, MD5_CTX *ctx) +{ + uint32_t saved_lo; + unsigned long used, available; + + saved_lo = ctx->lo; + if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) + ctx->hi++; + ctx->hi += size >> 29; + + used = saved_lo & 0x3f; + + if (used) { + available = 64 - used; + + if (size < available) { + memcpy(&ctx->buffer[used], data, size); + return; + } + + memcpy(&ctx->buffer[used], data, available); + data = (const unsigned char *)data + available; + size -= available; + MD5_body(ctx, ctx->buffer, 64); + } + + if (size >= 64) { + data = MD5_body(ctx, data, size & ~((size_t) 0x3f)); + size &= 0x3f; + } + + memcpy(ctx->buffer, data, size); +} + +static void +MD5_end(void *resbuf, MD5_CTX *ctx) +{ + unsigned char *result = resbuf; + unsigned long used, available; + + used = ctx->lo & 0x3f; + + ctx->buffer[used++] = 0x80; + + available = 64 - used; + + if (available < 8) { + memset(&ctx->buffer[used], 0, available); + MD5_body(ctx, ctx->buffer, 64); + used = 0; + available = 64; + } + + memset(&ctx->buffer[used], 0, available - 8); + + ctx->lo <<= 3; + ctx->buffer[56] = ctx->lo; + ctx->buffer[57] = ctx->lo >> 8; + ctx->buffer[58] = ctx->lo >> 16; + ctx->buffer[59] = ctx->lo >> 24; + ctx->buffer[60] = ctx->hi; + ctx->buffer[61] = ctx->hi >> 8; + ctx->buffer[62] = ctx->hi >> 16; + ctx->buffer[63] = ctx->hi >> 24; + + MD5_body(ctx, ctx->buffer, 64); + + result[0] = ctx->a; + result[1] = ctx->a >> 8; + result[2] = ctx->a >> 16; + result[3] = ctx->a >> 24; + result[4] = ctx->b; + result[5] = ctx->b >> 8; + result[6] = ctx->b >> 16; + result[7] = ctx->b >> 24; + result[8] = ctx->c; + result[9] = ctx->c >> 8; + result[10] = ctx->c >> 16; + result[11] = ctx->c >> 24; + result[12] = ctx->d; + result[13] = ctx->d >> 8; + result[14] = ctx->d >> 16; + result[15] = ctx->d >> 24; + + memset(ctx, 0, sizeof(*ctx)); +} + +#define SHA256_BLOCK_LENGTH 64 +#define SHA256_DIGEST_LENGTH 32 +#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) + +typedef struct SHA256Context { + uint32_t state[8]; + uint64_t count; + uint8_t buf[SHA256_BLOCK_LENGTH]; +} SHA256_CTX; + +#if BYTE_ORDER == BIG_ENDIAN + +/* Copy a vector of big-endian uint32_t into a vector of bytes */ +#define be32enc_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +/* Copy a vector of bytes into a vector of big-endian uint32_t */ +#define be32dec_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +#else /* BYTE_ORDER != BIG_ENDIAN */ + +/* + * Encode a length len/4 vector of (uint32_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 4. + */ +static void +be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + be32enc(dst + i * 4, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint32_t). Assumes len is a multiple of 4. + */ +static void +be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + dst[i] = be32dec(src + i * 4); +} + +#endif /* BYTE_ORDER != BIG_ENDIAN */ + + +/* Elementary functions used by SHA256 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define ROTR(x, n) ((x >> n) | (x << (32 - n))) + +/* + * SHA256 block compression function. The 256-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA256_Transform(uint32_t * state, const unsigned char block[64]) +{ + /* SHA256 round constants. */ + static const uint32_t K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 + }; + uint32_t W[64]; + uint32_t S[8]; + int i; + +#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ (x >> 3)) +#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ (x >> 10)) + +/* SHA256 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + h += S1(e) + Ch(e, f, g) + k; \ + d += h; \ + h += S0(a) + Maj(a, b, c); + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, ii) \ + RND(S[(64 - i) % 8], S[(65 - i) % 8], \ + S[(66 - i) % 8], S[(67 - i) % 8], \ + S[(68 - i) % 8], S[(69 - i) % 8], \ + S[(70 - i) % 8], S[(71 - i) % 8], \ + W[i + ii] + K[i + ii]) + +/* Message schedule computation */ +#define MSCH(W, ii, i) \ + W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii] + + /* 1. Prepare the first part of the message schedule W. */ + be32dec_vect(W, block, 64); + + /* 2. Initialize working variables. */ + memcpy(S, state, 32); + + /* 3. Mix. */ + for (i = 0; i < 64; i += 16) { + RNDr(S, W, 0, i); + RNDr(S, W, 1, i); + RNDr(S, W, 2, i); + RNDr(S, W, 3, i); + RNDr(S, W, 4, i); + RNDr(S, W, 5, i); + RNDr(S, W, 6, i); + RNDr(S, W, 7, i); + RNDr(S, W, 8, i); + RNDr(S, W, 9, i); + RNDr(S, W, 10, i); + RNDr(S, W, 11, i); + RNDr(S, W, 12, i); + RNDr(S, W, 13, i); + RNDr(S, W, 14, i); + RNDr(S, W, 15, i); + + if (i == 48) + break; + MSCH(W, 0, i); + MSCH(W, 1, i); + MSCH(W, 2, i); + MSCH(W, 3, i); + MSCH(W, 4, i); + MSCH(W, 5, i); + MSCH(W, 6, i); + MSCH(W, 7, i); + MSCH(W, 8, i); + MSCH(W, 9, i); + MSCH(W, 10, i); + MSCH(W, 11, i); + MSCH(W, 12, i); + MSCH(W, 13, i); + MSCH(W, 14, i); + MSCH(W, 15, i); + } + +#undef S0 +#undef s0 +#undef S1 +#undef s1 +#undef RND +#undef RNDr +#undef MSCH + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; +} + +static unsigned char PAD[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA256_Pad(SHA256_CTX * ctx) +{ + size_t r; + + /* Figure out how many bytes we have buffered. */ + r = (ctx->count >> 3) & 0x3f; + + /* Pad to 56 mod 64, transforming if we finish a block en route. */ + if (r < 56) { + /* Pad to 56 mod 64. */ + memcpy(&ctx->buf[r], PAD, 56 - r); + } else { + /* Finish the current block and mix. */ + memcpy(&ctx->buf[r], PAD, 64 - r); + SHA256_Transform(ctx->state, ctx->buf); + + /* The start of the final block is all zeroes. */ + memset(&ctx->buf[0], 0, 56); + } + + /* Add the terminating bit-count. */ + be64enc(&ctx->buf[56], ctx->count); + + /* Mix in the final block. */ + SHA256_Transform(ctx->state, ctx->buf); +} + +/* SHA-256 initialization. Begins a SHA-256 operation. */ +static void +SHA256_Init(SHA256_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6A09E667; + ctx->state[1] = 0xBB67AE85; + ctx->state[2] = 0x3C6EF372; + ctx->state[3] = 0xA54FF53A; + ctx->state[4] = 0x510E527F; + ctx->state[5] = 0x9B05688C; + ctx->state[6] = 0x1F83D9AB; + ctx->state[7] = 0x5BE0CD19; +} + +/* Add bytes into the hash */ +static void +SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len) +{ + uint64_t bitlen; + uint32_t r; + const unsigned char *src = in; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count >> 3) & 0x3f; + + /* Convert the length into a number of bits */ + bitlen = len << 3; + + /* Update number of bits */ + ctx->count += bitlen; + + /* Handle the case where we don't need to perform any transforms */ + if (len < 64 - r) { + memcpy(&ctx->buf[r], src, len); + return; + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, 64 - r); + SHA256_Transform(ctx->state, ctx->buf); + src += 64 - r; + len -= 64 - r; + + /* Perform complete blocks */ + while (len >= 64) { + SHA256_Transform(ctx->state, src); + src += 64; + len -= 64; + } + + /* Copy left over data into buffer */ + memcpy(ctx->buf, src, len); +} + +/* + * SHA-256 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +static void +SHA256_Final(unsigned char digest[static SHA256_DIGEST_LENGTH], SHA256_CTX *ctx) +{ + /* Add padding */ + SHA256_Pad(ctx); + + /* Write the hash */ + be32enc_vect(digest, ctx->state, SHA256_DIGEST_LENGTH); + + /* Clear the context state */ + memset(ctx, 0, sizeof(*ctx)); +} + +static void *hash_buf(FILE *f, int *len) +{ + static char buf[1024]; + + *len = fread(buf, 1, sizeof(buf), f); + + return *len > 0 ? buf : NULL; +} + +static char *hash_string(unsigned char *buf, int len) +{ + static char str[SHA256_DIGEST_LENGTH * 2 + 1]; + int i; + + if (len * 2 + 1 > sizeof(str)) + return NULL; + + for (i = 0; i < len; i++) + sprintf(&str[i * 2], "%02x", buf[i]); + + return str; +} + +static const char *md5_hash(FILE *f) +{ + MD5_CTX ctx; + unsigned char val[MD5_DIGEST_LENGTH]; + void *buf; + int len; + + MD5_begin(&ctx); + while ((buf = hash_buf(f, &len)) != NULL) + MD5_hash(buf, len, &ctx); + MD5_end(val, &ctx); + + return hash_string(val, MD5_DIGEST_LENGTH); +} + +static const char *sha256_hash(FILE *f) +{ + SHA256_CTX ctx; + unsigned char val[SHA256_DIGEST_LENGTH]; + void *buf; + int len; + + SHA256_Init(&ctx); + while ((buf = hash_buf(f, &len)) != NULL) + SHA256_Update(&ctx, buf, len); + SHA256_Final(val, &ctx); + + return hash_string(val, SHA256_DIGEST_LENGTH); +} + + +struct hash_type { + const char *name; + const char *(*func)(FILE *f); + int len; +}; + +struct hash_type types[] = { + { "md5", md5_hash, MD5_DIGEST_LENGTH }, + { "sha256", sha256_hash, SHA256_DIGEST_LENGTH }, +}; + + +static int usage(const char *progname) +{ + int i; + + fprintf(stderr, "Usage: %s [...]\n" + "Supported hash types:", progname); + + for (i = 0; i < ARRAY_SIZE(types); i++) + fprintf(stderr, "%s %s", i ? "," : "", types[i].name); + + fprintf(stderr, "\n"); + return 1; +} + +static struct hash_type *get_hash_type(const char *name) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(types); i++) { + struct hash_type *t = &types[i]; + + if (!strcmp(t->name, name)) + return t; + } + return NULL; +} + + +static int hash_file(struct hash_type *t, const char *filename, bool add_filename) +{ + const char *str; + + if (!filename || !strcmp(filename, "-")) { + str = t->func(stdin); + } else { + FILE *f = fopen(filename, "r"); + + if (!f) { + fprintf(stderr, "Failed to open '%s'\n", filename); + return 1; + } + str = t->func(f); + fclose(f); + } + + if (!str) { + fprintf(stderr, "Failed to generate hash\n"); + return 1; + } + + if (add_filename) + printf("%s %s\n", str, filename ? filename : "-"); + else + printf("%s\n", str); + return 0; +} + + +int main(int argc, char **argv) +{ + struct hash_type *t; + const char *progname = argv[0]; + int i, ch; + bool add_filename = false; + + while ((ch = getopt(argc, argv, "n")) != -1) { + switch (ch) { + case 'n': + add_filename = true; + break; + default: + return usage(progname); + } + } + + argc -= optind; + argv += optind; + + if (argc < 1) + return usage(progname); + + t = get_hash_type(argv[0]); + if (!t) + return usage(progname); + + if (argc < 2) + return hash_file(t, NULL, add_filename); + + for (i = 0; i < argc - 1; i++) + hash_file(t, argv[1 + i], add_filename); + + return 0; +} diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh index 6c3b74cc1c..bb30252aa0 100644 --- a/scripts/om-fwupgradecfg-gen.sh +++ b/scripts/om-fwupgradecfg-gen.sh @@ -41,16 +41,16 @@ esac CHECK_BS=65536 KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") -KERNEL_MD5=$(md5=$(md5sum $KERNEL_PATH); echo ${md5%% *}) -KERNEL_SHA256=$(openssl dgst -sha256 $KERNEL_PATH | awk '{print $2}') +KERNEL_MD5=$(mkhash md5 $KERNEL_PATH) +KERNEL_SHA256=$(mkhash sha256 $KERNEL_PATH) KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024))) ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr) ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS)) -ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *}) -ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *}) -ROOTFS_SHA256_FULL=$(openssl dgst -sha256 $ROOTFS_PATH | awk '{print $2}') +ROOTFS_MD5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | mkhash md5) +ROOTFS_MD5_FULL=$(mkhash md5 $ROOTFS_PATH) +ROOTFS_SHA256_FULL=$(mkhash sha256 $ROOTFS_PATH) ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) diff --git a/scripts/update-package-md5sum b/scripts/update-package-md5sum deleted file mode 100755 index 1cf17163e0..0000000000 --- a/scripts/update-package-md5sum +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env sh -# -# update-package-md5sum - Updates md5sum of OpenWrt packages -# -# update-package-md5sum will update the md5sum for all recusivly found OpenWrt packages -# in a given directory. -# -# Usage: scripts/update-package-md5sum -# -# Example: `scripts/update-package-md5sum feeds/packages/python` - -DL_FOLDER=`grep -Eo '^CONFIG_DOWNLOAD_FOLDER=".*"$' .config | \ - sed 's,^CONFIG_DOWNLOAD_FOLDER="\(.*\)"$,\1,'` -if test -z ${DL_FOLDER}; then - DL_FOLDER=./dl -fi - -if test -z "$1"; then - echo "Usage: $0 " - exit -fi - -for file in `find $1 -name Makefile`; do - if grep BuildPackage ${file} > /dev/null; then - source=`DUMP=1 TOPDIR=\`pwd\` make -f ${file} | grep -m 1 Source | cut -f 2 -d ' '` - if test -n "${source}"; then - if test ! -f "${DL_FOLDER}/${source}"; then - make package/`basename \`dirname ${file}\``/download - fi - sum=`md5sum ${DL_FOLDER}/${source} 2> /dev/null` || continue - echo Updating ${file}... - sum=`echo ${sum} | cut -d ' ' -f 1` - sed -i "s,^PKG_MD5SUM:=.*,PKG_MD5SUM:=${sum}," ${file} - else - echo No source for ${file} - fi - fi -done diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile index b43662b6ac..8a7c2093b9 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -66,16 +66,20 @@ endif $(PKG_BUILD_DIR)/target/linux/*/patches{,-*} -cp $(KERNEL_BUILD_DIR)/* $(IB_KDIR)/ # don't copy subdirectories here -cp $(LINUX_DIR)/.config $(IB_LDIR)/ - -$(SCRIPT_DIR)/bundle-libraries.sh $(IB_LDIR)/scripts/dtc \ - $(LINUX_DIR)/scripts/dtc/dtc + if [ -x $(LINUX_DIR)/scripts/dtc/dtc ]; then \ + $(INSTALL_DIR) $(IB_LDIR)/scripts/dtc; \ + $(INSTALL_BIN) $(LINUX_DIR)/scripts/dtc/dtc $(IB_LDIR)/scripts/dtc/dtc; \ + fi if [ -d $(LINUX_DIR)/arch/$(ARCH)/boot/dts ]; then \ $(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/* $(IB_DTSDIR); \ fi $(SED) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(PKG_BUILD_DIR)/include/version.mk find $(PKG_BUILD_DIR) -name CVS -o -name .git -o -name .svn \ | $(XARGS) rm -rf - find $(STAGING_DIR_HOST)/bin -maxdepth 1 -type f -perm -u=x \ - | $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(PKG_BUILD_DIR)/staging_dir/host/bin/ + $(INSTALL_DIR) $(PKG_BUILD_DIR)/staging_dir/host/bin + $(CP) $(STAGING_DIR_HOST)/bin/* $(PKG_BUILD_DIR)/staging_dir/host/bin/ + (cd $(PKG_BUILD_DIR); find staging_dir/host/bin/ $(IB_LDIR)/scripts/dtc/ -type f | \ + $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(PKG_BUILD_DIR)/staging_dir/host) STRIP=sstrip $(SCRIPT_DIR)/rstrip.sh $(PKG_BUILD_DIR)/staging_dir/host/bin/ $(TAR) -cf - -C $(BUILD_DIR) $(IB_NAME) | xz -zc -7e > $@ diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index a93ea1d578..5a2bf0cfc4 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -45,7 +45,6 @@ arduino-yun) ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt" ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1" ;; -ap113|\ db120) ucidef_set_led_usbdev "usb" "USB" "$board:green:usb" "1-1" ;; @@ -153,7 +152,9 @@ cf-e530n) ucidef_set_led_netdev "wan" "WAN" "$board:blue:wan" "eth1" ;; cpe210|\ -cpe510) +cpe510|\ +wbs210|\ +wbs510) ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20" ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" ucidef_set_rssimon "wlan0" "200000" "1" @@ -429,6 +430,12 @@ omy-x1) qihoo-c301) ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:red:status" "phy1tpt" ;; +re450) + ucidef_set_led_netdev "lan_data" "LAN Data" "$board:green:lan_data" "eth0" "tx rx" + ucidef_set_led_netdev "lan_link" "LAN Link" "$board:green:lan_link" "eth0" "link" + ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "$board:blue:wlan2g" "phy1tpt" + ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "$board:blue:wlan5g" "phy0tpt" + ;; smart-300) ucidef_set_led_netdev "wan" "WAN" "nc-link:green:wan" "eth0" ucidef_set_led_switch "lan1" "LAN1" "nc-link:green:lan1" "switch0" "0x04" @@ -444,6 +451,9 @@ som9331) ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt" ucidef_set_led_usbdev "usb" "USB" "$board:green:system" "1-1" ;; +sr3200) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt" + ;; tellstick-znet-lite) ucidef_set_led_netdev "lan_act" "LANACT" "tellstick:green:lan" "eth0" "tx rx" ucidef_set_led_netdev "lan_link" "LANLINK" "tellstick:orange:lan" "eth0" "link" @@ -597,6 +607,7 @@ tl-wpa8630) tl-wr802n-v1) ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:system" "phy0tpt" ;; +tl-wr940n-v4|\ tl-wr941nd-v6) ucidef_set_led_netdev "wan" "WAN" "tp-link:blue:wan" "eth0" ucidef_set_led_switch "lan1" "LAN1" "tp-link:blue:lan1" "switch0" "0x10" @@ -626,6 +637,15 @@ tl-wr1043nd-v2) ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1" ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt" ;; +tl-wr1043nd-v4) + ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1" + ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt" + ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x20" + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" + ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08" + ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04" + ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02" + ;; tl-wr2543n) ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1" ;; @@ -738,6 +758,9 @@ wzr-hp-g300nh) ucidef_set_led_netdev "router" "Router" "buffalo:green:router" "eth1" ucidef_set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1" ;; +xd3200) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:blue:wlan2g" "phy1tpt" + ;; z1) ucidef_set_led_netdev "wlan1" "WLAN1" "$board:blue:tricolor0" "wlan1" ;; diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index 949f161c9c..66274db15f 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -91,6 +91,7 @@ ar71xx_setup_interfaces() rb-912uag-5hpnd|\ rb-sxt2n|\ rb-sxt5n|\ + re450|\ rocket-m-xw|\ tl-mr10u|\ tl-mr11u|\ @@ -119,7 +120,6 @@ ar71xx_setup_interfaces() ;; alfa-ap96|\ alfa-nx|\ - ap83|\ gl-ar150|\ gl-ar300m|\ gl-domino|\ @@ -147,8 +147,6 @@ ar71xx_setup_interfaces() ubnt-unifi-outdoor) ucidef_set_interface_lan "eth0 eth1" ;; - ap113|\ - pb92|\ wzr-hp-g300nh2) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan" @@ -214,7 +212,9 @@ ar71xx_setup_interfaces() ucidef_set_interface_lan "eth0" "dhcp" ;; cpe210|\ - cpe510) + cpe510|\ + wbs210|\ + wbs510) ucidef_add_switch "switch0" \ "0@eth0" "5:lan" "4:wan" ;; @@ -230,6 +230,7 @@ ar71xx_setup_interfaces() dir-835-a1|\ esr900|\ mynet-n750|\ + sr3200|\ wndr3700v4|\ wndr4300) ucidef_add_switch "switch0" \ @@ -267,7 +268,7 @@ ar71xx_setup_interfaces() tl-mr3420-v2|\ tl-wdr6500-v2|\ tl-wr841n-v8|\ - tl-wr842n-v2|\ + tl-wr940n-v4|\ tl-wr941nd-v5|\ tl-wr941nd-v6|\ wnr1000-v2|\ @@ -301,7 +302,8 @@ ar71xx_setup_interfaces() ;; dir-869-a1|\ epg5000|\ - esr1750) + esr1750|\ + tl-wr1043nd-v4) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" ;; @@ -390,12 +392,18 @@ ar71xx_setup_interfaces() ucidef_set_interface_raw "eth" "eth0" ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; + tl-wr842n-v2) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ucidef_add_switch "switch0" \ + "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" + ;; uap-pro|\ wpj342) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:wan" ;; - unifiac-pro) + unifiac-pro|\ + xd3200) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:wan" ;; @@ -455,6 +463,9 @@ ar71xx_setup_macs() lan_mac=$(mtd_get_mac_binary caldata 0) wan_mac=$(mtd_get_mac_binary caldata 6) ;; + tl-wr1043nd-v4) + wan_mac=$(mtd_get_mac_binary config 0x1017c) + ;; esr900) wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr") ;; diff --git a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches index 5b95f155cf..da963bf64d 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches @@ -18,7 +18,9 @@ nanostation-m-xw) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "2" ;; cpe210|\ -cpe510) +cpe510|\ +wbs210|\ +wbs510) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "20" ;; rb-912uag-2hpnd|\ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 9b9aea8a77..d060ccf6e2 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -18,11 +18,12 @@ get_status_led() { antminer-s3|\ antminer-r1|\ minibox-v1|\ - som9331) + som9331|\ + sr3200|\ + xd3200) status_led="$board:green:system" ;; ap132|\ - ap81|\ db120|\ dr344|\ tew-632brp|\ @@ -40,7 +41,6 @@ get_status_led() { ap135-020) status_led="ap135:green:status" ;; - ap83|\ mr12|\ mr16|\ nbg6616|\ @@ -295,6 +295,9 @@ get_status_led() { rb-sxt5n) status_led="rb:green:power" ;; + re450) + status_led="$board:blue:power" + ;; routerstation|\ routerstation-pro) status_led="ubnt:green:rf" @@ -346,6 +349,7 @@ get_status_led() { tl-wr1041n-v2|\ tl-wr1043nd|\ tl-wr1043nd-v2|\ + tl-wr1043nd-v4|\ tl-wr741nd|\ tl-wr741nd-v4|\ tl-wa801nd-v3|\ @@ -372,6 +376,7 @@ get_status_led() { tl-wr720n-v3|\ tl-wr802n-v1|\ tl-wr810n|\ + tl-wr940n-v4|\ tl-wr941nd-v6) status_led="tp-link:blue:system" ;; diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata new file mode 100644 index 0000000000..a4f426e142 --- /dev/null +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -0,0 +1,131 @@ +#!/bin/sh + +ath10kcal_die() { + echo "ath10cal: " "$*" + exit 1 +} + +ath10kcal_from_file() { + local source=$1 + local offset=$2 + local count=$3 + + dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + ath10kcal_die "failed to extract calibration data from $source" +} + +ath10kcal_extract() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + + mtd=$(find_mtd_chardev $part) + [ -n "$mtd" ] || \ + ath10kcal_die "no mtd device found for partition $part" + + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + ath10kcal_die "failed to extract calibration data from $mtd" +} + +ath10kcal_patch_mac() { + local mac=$1 + + [ -z "$mac" ] && return + + macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6 +} + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/ar71xx.sh +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(ar71xx_board_name) + +case "$FIRMWARE" in +"ath10k/cal-pci-0000:00:00.0.bin") + case $board in + cf-e380ac-v1|\ + cf-e380ac-v2|\ + dlan-pro-1200-ac|\ + sr3200|\ + xd3200) + ath10kcal_extract "art" 20480 2116 + ;; + dap-2695-a1) + ath10kcal_extract "radiocfg" 20480 2116 + ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a) + ;; + dir-869-a1 | \ + qihoo-c301) + ath10kcal_extract "radiocfg" 20480 2116 + ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) + ;; + dw33d) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(mtd_get_mac_binary art 18) + ;; + epg5000 | \ + esr1750) + ath10kcal_extract "caldata" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) + ;; + mc-mac1200r) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1) + ;; + mr1750 | \ + mr1750v2 | \ + om5p-acv2) + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; + r6100) + ath10kcal_extract "caldata" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2) + ;; + re450) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) + ;; + tl-wdr6500-v2) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) + ;; + tl-wpa8630) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) + ;; + unifiac-lite | \ + unifiac-pro) + ath10kcal_extract "EEPROM" 20480 2116 + ;; + esac + ;; +"ath10k/cal-pci-0000:01:00.0.bin") + case $board in + archer-c5 | \ + archer-c7) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) + ;; + nbg6616 | \ + nbg6716) + ath10kcal_extract "RFdata" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) + ;; + om5p-ac) + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; + rb-911g-5hpacd) + ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 + ;; + esac + ;; +*) + exit 1 + ;; +esac diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration index c6b91b7737..f1b3ae1430 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration @@ -47,8 +47,6 @@ board=$(ar71xx_board_name) case "$board" in dir-825-c1|\ wzr-hp-g300nh2|\ -pb92|\ -ap113|\ tl-wdr4300|\ tl-wr1041n-v2|\ wrt160nl|\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 526d03344b..1b30f4d827 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -250,6 +250,9 @@ tplink_board_detect() { "090100"*) model="TP-Link TL-WA901N/ND" ;; + "094000"*) + model="TP-Link TL-WR940N" + ;; "094100"*) if [ "$hwid" = "09410002" -a "$mid" = "00420001" ]; then model="Rosewill RNX-N360RT" @@ -350,27 +353,10 @@ tplink_pharos_get_model_string() { tplink_pharos_board_detect() { local model_string="$(tplink_pharos_get_model_string | tr -d '\r')" local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS" - local model - case "$1" in - 'CPE210(TP-LINK|UN|N300-2)') - model='TP-Link CPE210' - ;; - 'CPE220(TP-LINK|UN|N300-2)') - model='TP-Link CPE220' - ;; - 'CPE510(TP-LINK|UN|N300-5)') - model='TP-Link CPE510' - ;; - 'CPE520(TP-LINK|UN|N300-5)') - model='TP-Link CPE520' - ;; - 'EAP120(TP-LINK|UN|N300-2)') - model='TP-Link EAP120' - ;; - esac + local model="${1%%\(*}" - [ -n "$model" ] && AR71XX_MODEL="$model v$2" + AR71XX_MODEL="TP-Link $model v$2" } gl_inet_board_detect() { @@ -435,9 +421,6 @@ ar71xx_board_detect() { *"Arduino Yun") name="arduino-yun" ;; - *AP113) - name="ap113" - ;; *"AP121 reference board") name="ap121" ;; @@ -465,12 +448,6 @@ ar71xx_board_detect() { *"AP152 reference board") name="ap152" ;; - *AP81) - name="ap81" - ;; - *AP83) - name="ap83" - ;; *AP90Q) name="ap90q" ;; @@ -533,6 +510,14 @@ ar71xx_board_detect() { *CPE870) name="cpe870" ;; + *WBS210) + name="wbs210" + tplink_pharos_board_detect + ;; + *WBS510) + name="wbs510" + tplink_pharos_board_detect + ;; *CR3000) name="cr3000" ;; @@ -603,6 +588,9 @@ ar71xx_board_detect() { *"DW33D") name="dw33d" ;; + *E2100L) + name="e2100l" + ;; *"EAP120") name="eap120" tplink_pharos_board_detect @@ -787,12 +775,12 @@ ar71xx_board_detect() { *"PB44 reference board") name="pb44" ;; - *PB92) - name="pb92" - ;; *"Qihoo 360 C301") name="qihoo-c301" ;; + *"RE450") + name="re450" + ;; *"RouterBOARD 411/A/AH") name="rb-411" ;; @@ -905,6 +893,9 @@ ar71xx_board_detect() { *SOM9331) name="som9331" ;; + *SR3200) + name="sr3200" + ;; *TEW-632BRP) name="tew-632brp" ;; @@ -929,6 +920,9 @@ ar71xx_board_detect() { *"TL-WR1043ND v2") name="tl-wr1043nd-v2" ;; + *"TL-WR1043ND v4") + name="tl-wr1043nd-v4" + ;; *TL-WR2543N*) name="tl-wr2543n" ;; @@ -1052,6 +1046,9 @@ ar71xx_board_detect() { *"TL-WR941N/ND v6") name="tl-wr941nd-v6" ;; + *"TL-WR940N v4") + name="tl-wr940n-v4" + ;; *"TL-WR703N v1") name="tl-wr703n" ;; @@ -1190,6 +1187,9 @@ ar71xx_board_detect() { *WHR-HP-G300N) name="whr-hp-g300n" ;; + *XD3200) + name="xd3200" + ;; *Z1) name="z1" ;; diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx index e2a70b82dd..d677599d8c 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx +++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx @@ -13,7 +13,6 @@ set_preinit_iface() { ap135-020 |\ ap136-020 |\ ap147-010 |\ - ap83 |\ archer-c5 |\ archer-c7 |\ bhr-4grv2 |\ @@ -38,6 +37,7 @@ set_preinit_iface() { tl-wr841n-v8 |\ tl-wr842n-v2 |\ tl-wr941nd-v6 |\ + tl-wr940n-v4 |\ wnr2000-v3 |\ wnr2200 |\ wnr612-v2 |\ diff --git a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k new file mode 100644 index 0000000000..b6af921449 --- /dev/null +++ b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k @@ -0,0 +1,54 @@ +#!/bin/sh + +. /lib/functions/system.sh +. /lib/ar71xx.sh + + +do_patch_ath10k_firmware() { + local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin" + + # bail out if firmware does not exist + [ -f "$firmware_file" ] || { + return + } + + local mac_offset=276 + local mac_length=6 + local default_mac="00:03:07:12:34:56" + local current_mac="$(hexdump -v -n $mac_length -s $mac_offset -e '5/1 "%02x:" 1/1 "%02x"' $firmware_file 2>/dev/null)" + + # check if mac address was already patched + [ "$default_mac" = "$current_mac" ] || { + return + } + + # some boards have bogus mac in otp (= directly in the PCIe card's EEPROM). + # we have to patch the default mac in the firmware because we cannot change + # the otp. + case $(ar71xx_board_name) in + dgl-5500-a1 | tew-823dru) + local mac + mac=$(mtd_get_mac_ascii nvram wlan1_mac) + + cp $firmware_file /tmp/ath10k-firmware.bin + macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \ + conv=notrunc bs=1 seek=$mac_offset count=$mac_length + + ;; + esac + [ -f /tmp/ath10k-firmware.bin ] || { + return + } + cp /tmp/ath10k-firmware.bin $firmware_file + rm /tmp/ath10k-firmware.bin +} + +check_patch_ath10k_firmware() { + case $(ar71xx_board_name) in + dgl-5500-a1 | tew-823dru) + do_patch_ath10k_firmware + ;; + esac +} + +boot_hook_add preinit_main check_patch_ath10k_firmware diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 5f4375da6a..6341a31791 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -176,8 +176,6 @@ platform_check_image() { airgateway|\ airrouter|\ ap132|\ - ap81|\ - ap83|\ ap90q|\ bullet-m|\ c-55|\ @@ -228,6 +226,7 @@ platform_check_image() { rocket-m-xw|\ rocket-m|\ rw2458n|\ + sr3200|\ tew-632brp|\ tew-712br|\ tew-732br|\ @@ -251,7 +250,8 @@ platform_check_image() { wzr-hp-ag300h|\ wzr-hp-g300nh2|\ wzr-hp-g300nh|\ - wzr-hp-g450h) + wzr-hp-g450h|\ + xd3200) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 @@ -261,7 +261,6 @@ platform_check_image() { ;; alfa-ap96|\ alfa-nx|\ - ap113|\ ap121-mini|\ ap121|\ ap135-020|\ @@ -344,6 +343,7 @@ platform_check_image() { omy-x1|\ onion-omega|\ oolite|\ + re450|\ smart-300|\ som9331|\ tellstick-znet-lite|\ @@ -379,6 +379,7 @@ platform_check_image() { tl-wpa8630|\ tl-wr1041n-v2|\ tl-wr1043nd-v2|\ + tl-wr1043nd-v4|\ tl-wr1043nd|\ tl-wr2543n|\ tl-wr703n|\ @@ -397,6 +398,7 @@ platform_check_image() { tl-wr842n-v3|\ tl-wr941nd-v5|\ tl-wr941nd-v6|\ + tl-wr940n-v4|\ tl-wr941nd) local magic_ver="0100" @@ -451,7 +453,9 @@ platform_check_image() { ;; cpe210|\ cpe510|\ - eap120) + eap120|\ + wbs210|\ + wbs510) tplink_pharos_check_image "$1" && return 0 return 1 ;; @@ -496,6 +500,7 @@ platform_check_image() { return 0 ;; + e2100l|\ mynet-rext|\ wrt160nl) cybertan_check_image "$1" && return 0 diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index c6a757a7eb..4b2f736a86 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -40,15 +40,13 @@ CONFIG_ATH79_MACH_ALL0315N=y CONFIG_ATH79_MACH_ANTMINER_S1=y CONFIG_ATH79_MACH_ANTMINER_S3=y CONFIG_ATH79_MACH_ANTROUTER_R1=y -CONFIG_ATH79_MACH_AP113=y CONFIG_ATH79_MACH_AP121=y CONFIG_ATH79_MACH_AP132=y CONFIG_ATH79_MACH_AP136=y CONFIG_ATH79_MACH_AP143=y CONFIG_ATH79_MACH_AP147=y CONFIG_ATH79_MACH_AP152=y -CONFIG_ATH79_MACH_AP81=y -CONFIG_ATH79_MACH_AP83=y +# CONFIG_ATH79_MACH_AP81 is not set CONFIG_ATH79_MACH_AP90Q=y CONFIG_ATH79_MACH_AP96=y CONFIG_ATH79_MACH_ARCHER_C7=y @@ -91,6 +89,7 @@ CONFIG_ATH79_MACH_DOMYWIFI_DW33D=y CONFIG_ATH79_MACH_DR344=y CONFIG_ATH79_MACH_DR531=y CONFIG_ATH79_MACH_DRAGINO2=y +CONFIG_ATH79_MACH_E2100L=y CONFIG_ATH79_MACH_EAP120=y CONFIG_ATH79_MACH_EAP300V2=y CONFIG_ATH79_MACH_EAP7660D=y @@ -137,7 +136,6 @@ CONFIG_ATH79_MACH_OMY_X1=y CONFIG_ATH79_MACH_ONION_OMEGA=y CONFIG_ATH79_MACH_PB42=y CONFIG_ATH79_MACH_PB44=y -CONFIG_ATH79_MACH_PB92=y CONFIG_ATH79_MACH_QIHOO_C301=y CONFIG_ATH79_MACH_R6100=y # CONFIG_ATH79_MACH_RB2011 is not set @@ -147,9 +145,11 @@ CONFIG_ATH79_MACH_R6100=y # CONFIG_ATH79_MACH_RB922 is not set # CONFIG_ATH79_MACH_RB95X is not set # CONFIG_ATH79_MACH_RBSXTLITE is not set +CONFIG_ATH79_MACH_RE450=y CONFIG_ATH79_MACH_RW2458N=y CONFIG_ATH79_MACH_SMART_300=y CONFIG_ATH79_MACH_SOM9331=y +CONFIG_ATH79_MACH_SR3200=y CONFIG_ATH79_MACH_TELLSTICK_ZNET_LITE=y CONFIG_ATH79_MACH_TEW_632BRP=y CONFIG_ATH79_MACH_TEW_673GRU=y @@ -176,6 +176,7 @@ CONFIG_ATH79_MACH_TL_WPA8630=y CONFIG_ATH79_MACH_TL_WR1041N_V2=y CONFIG_ATH79_MACH_TL_WR1043ND=y CONFIG_ATH79_MACH_TL_WR1043ND_V2=y +CONFIG_ATH79_MACH_TL_WR1043ND_V4=y CONFIG_ATH79_MACH_TL_WR2543N=y CONFIG_ATH79_MACH_TL_WR703N=y CONFIG_ATH79_MACH_TL_WR720N_V3=y @@ -188,6 +189,7 @@ CONFIG_ATH79_MACH_TL_WR841N_V8=y CONFIG_ATH79_MACH_TL_WR841N_V9=y CONFIG_ATH79_MACH_TL_WR941ND=y CONFIG_ATH79_MACH_TL_WR941ND_V6=y +CONFIG_ATH79_MACH_TL_WR940N_V4=y CONFIG_ATH79_MACH_TUBE2H=y CONFIG_ATH79_MACH_UBNT=y CONFIG_ATH79_MACH_UBNT_UNIFIAC=y @@ -217,6 +219,7 @@ CONFIG_ATH79_MACH_WZR_HP_AG300H=y CONFIG_ATH79_MACH_WZR_HP_G300NH=y CONFIG_ATH79_MACH_WZR_HP_G300NH2=y CONFIG_ATH79_MACH_WZR_HP_G450H=y +CONFIG_ATH79_MACH_XD3200=y CONFIG_ATH79_MACH_Z1=y CONFIG_ATH79_MACH_ZBT_WE1526=y CONFIG_ATH79_MACH_ZCN_1523H=y @@ -420,7 +423,6 @@ CONFIG_SOC_QCA953X=y CONFIG_SOC_QCA955X=y CONFIG_SOC_QCA956X=y CONFIG_SPI=y -CONFIG_SPI_AP83=y CONFIG_SPI_ATH79=y CONFIG_SPI_BITBANG=y CONFIG_SPI_MASTER=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index f1bfcb80a4..21d6b51897 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -103,16 +103,6 @@ config ATH79_MACH_ARDUINO_YUN Say 'Y' here if you want your kernel to support the Arduino Yun. -config ATH79_MACH_AP113 - bool "Atheros AP113 board support" - select SOC_AR724X - select ATH79_DEV_M25P80 - select ATH79_DEV_PB9X_PCI if PCI - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_USB - select ATH79_DEV_ETH - config ATH79_MACH_AP132 bool "Atheros AP132 reference board" select SOC_QCA955X @@ -166,14 +156,6 @@ config ATH79_MACH_AP152 QCA AP152 reference boards. -config ATH79_MACH_AP83 - bool "Atheros AP83 board support" - select SOC_AR913X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_USB - select ATH79_DEV_WMAC - config ATH79_MACH_AP90Q bool "YunCore AP90Q support" select SOC_QCA953X @@ -200,15 +182,6 @@ config ATH79_MACH_PB42 select ATH79_DEV_GPIO_BUTTONS select ATH79_DEV_M25P80 -config ATH79_MACH_PB92 - bool "Atheros PB92 board support" - select SOC_AR724X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_PB9X_PCI if PCI - select ATH79_DEV_USB - config ATH79_MACH_C55 bool "AirTight Networks C-55 support" select SOC_AR934X @@ -280,6 +253,17 @@ config ATH79_MACH_SOM9331 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_SR3200 + bool "YunCore SR3200 support" + select SOC_QCA956X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC + config ATH79_MACH_BHR_4GRV2 bool "Buffalo BHR-4GRV2 board support" select SOC_QCA955X @@ -425,6 +409,16 @@ config ATH79_MACH_WPJ558 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_XD3200 + bool "YunCore XD3200 support" + select SOC_QCA956X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + config ATH79_MACH_DGL_5500_A1 bool "D-Link DGL-5500 A1 support" select SOC_QCA955X @@ -593,6 +587,17 @@ config ATH79_MACH_DRAGINO2 select ATH79_DEV_ETH select ATH79_DEV_USB +config ATH79_MACH_E2100L + bool "Linksys E2100L board support" + select SOC_AR913X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC + select ATH79_NVRAM + config ATH79_MACH_ESR900 bool "EnGenius ESR900 board support" select SOC_QCA955X @@ -1098,6 +1103,16 @@ config ATH79_MACH_MZK_W300NH select ATH79_DEV_M25P80 select ATH79_DEV_WMAC +config ATH79_MACH_RE450 + bool "TP-LINK RE450 board support" + select SOC_QCA955X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + config ATH79_MACH_RW2458N bool "Redwave RW2458N board support" select SOC_AR724X @@ -1487,6 +1502,15 @@ config ATH79_MACH_TL_WR941ND_V6 select ATH79_DEV_M25P80 select ATH79_DEV_WMAC +config ATH79_MACH_TL_WR940N_V4 + bool "TP-LINK TL-WR940N v4 support" + select SOC_QCA956X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + config ATH79_MACH_TL_WR1041N_V2 bool "TP-LINK TL-WR1041N v2 support" select SOC_AR934X @@ -1518,6 +1542,17 @@ config ATH79_MACH_TL_WR1043ND_V2 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_TL_WR1043ND_V4 + bool "TP-LINK TL-WR1043ND v4 support" + select SOC_QCA956X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC + config ATH79_MACH_TL_WR2543N bool "TP-LINK TL-WR2543N/ND support" select SOC_AR724X @@ -1800,4 +1835,3 @@ config ATH79_MACH_TL_WPA8630 select ATH79_DEV_LEDS_GPIO select ATH79_DEV_M25P80 select ATH79_DEV_WMAC - diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index ac2dbbb23f..6384c0604c 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -46,15 +46,12 @@ obj-$(CONFIG_ATH79_MACH_ALL0315N) += mach-all0315n.o obj-$(CONFIG_ATH79_MACH_ANTMINER_S1) += mach-antminer-s1.o obj-$(CONFIG_ATH79_MACH_ANTMINER_S3) += mach-antminer-s3.o obj-$(CONFIG_ATH79_MACH_ANTROUTER_R1) += mach-antrouter-r1.o -obj-$(CONFIG_ATH79_MACH_AP113) += mach-ap113.o obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o obj-$(CONFIG_ATH79_MACH_AP132) += mach-ap132.o obj-$(CONFIG_ATH79_MACH_AP136) += mach-ap136.o obj-$(CONFIG_ATH79_MACH_AP143) += mach-ap143.o obj-$(CONFIG_ATH79_MACH_AP147) += mach-ap147.o obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o -obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o -obj-$(CONFIG_ATH79_MACH_AP83) += mach-ap83.o obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o @@ -143,7 +140,6 @@ obj-$(CONFIG_ATH79_MACH_OMY_X1) += mach-omy-x1.o obj-$(CONFIG_ATH79_MACH_ONION_OMEGA) += mach-onion-omega.o obj-$(CONFIG_ATH79_MACH_PB42) += mach-pb42.o obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o -obj-$(CONFIG_ATH79_MACH_PB92) += mach-pb92.o obj-$(CONFIG_ATH79_MACH_QIHOO_C301) += mach-qihoo-c301.o obj-$(CONFIG_ATH79_MACH_R6100) += mach-r6100.o obj-$(CONFIG_ATH79_MACH_RB2011) += mach-rb2011.o @@ -153,9 +149,11 @@ obj-$(CONFIG_ATH79_MACH_RB91X) += mach-rb91x.o obj-$(CONFIG_ATH79_MACH_RB922) += mach-rb922.o obj-$(CONFIG_ATH79_MACH_RB95X) += mach-rb95x.o obj-$(CONFIG_ATH79_MACH_RBSXTLITE) += mach-rbsxtlite.o +obj-$(CONFIG_ATH79_MACH_RE450) += mach-re450.o obj-$(CONFIG_ATH79_MACH_RW2458N) += mach-rw2458n.o obj-$(CONFIG_ATH79_MACH_SMART_300) += mach-smart-300.o obj-$(CONFIG_ATH79_MACH_SOM9331) += mach-som9331.o +obj-$(CONFIG_ATH79_MACH_SR3200) += mach-sr3200.o obj-$(CONFIG_ATH79_MACH_TELLSTICK_ZNET_LITE) += mach-tellstick-znet-lite.o obj-$(CONFIG_ATH79_MACH_TEW_632BRP) += mach-tew-632brp.o obj-$(CONFIG_ATH79_MACH_TEW_673GRU) += mach-tew-673gru.o @@ -182,6 +180,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WPA8630) += mach-tl-wpa8630.o obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2) += mach-tl-wr1041n-v2.o obj-$(CONFIG_ATH79_MACH_TL_WR1043ND) += mach-tl-wr1043nd.o obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V2) += mach-tl-wr1043nd-v2.o +obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V4) += mach-tl-wr1043nd-v4.o obj-$(CONFIG_ATH79_MACH_TL_WR2543N) += mach-tl-wr2543n.o obj-$(CONFIG_ATH79_MACH_TL_WR703N) += mach-tl-wr703n.o obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3) += mach-tl-wr720n-v3.o @@ -194,6 +193,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR841N_V8) += mach-tl-wr841n-v8.o obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += mach-tl-wr841n-v9.o obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o obj-$(CONFIG_ATH79_MACH_TL_WR941ND_V6) += mach-tl-wr941nd-v6.o +obj-$(CONFIG_ATH79_MACH_TL_WR940N_V4) += mach-tl-wr940n-v4.o obj-$(CONFIG_ATH79_MACH_TUBE2H) += mach-tube2h.o obj-$(CONFIG_ATH79_MACH_UBNT) += mach-ubnt.o obj-$(CONFIG_ATH79_MACH_UBNT_UNIFIAC) += mach-ubnt-unifiac.o @@ -223,6 +223,7 @@ obj-$(CONFIG_ATH79_MACH_WZR_HP_AG300H) += mach-wzr-hp-ag300h.o obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH) += mach-wzr-hp-g300nh.o obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH2) += mach-wzr-hp-g300nh2.o obj-$(CONFIG_ATH79_MACH_WZR_HP_G450H) += mach-wzr-hp-g450h.o +obj-$(CONFIG_ATH79_MACH_XD3200) += mach-sr3200.o obj-$(CONFIG_ATH79_MACH_Z1) += mach-z1.o obj-$(CONFIG_ATH79_MACH_ZBT_WE1526) += mach-zbt-we1526.o obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.c index e5831d4883..e53d97dcbf 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.c @@ -16,32 +16,18 @@ #include "dev-spi.h" #include "dev-m25p80.h" -static struct ath79_spi_controller_data ath79_spi0_cdata = -{ - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .cs_line = 0, -}; - -static struct ath79_spi_controller_data ath79_spi1_cdata = -{ - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .cs_line = 1, -}; - static struct spi_board_info ath79_spi_info[] = { { .bus_num = 0, .chip_select = 0, .max_speed_hz = 25000000, .modalias = "m25p80", - .controller_data = &ath79_spi0_cdata, }, { .bus_num = 0, .chip_select = 1, .max_speed_hz = 25000000, .modalias = "m25p80", - .controller_data = &ath79_spi1_cdata, } }; @@ -51,7 +37,6 @@ void __init ath79_register_m25p80(struct flash_platform_data *pdata) { ath79_spi_data.bus_num = 0; ath79_spi_data.num_chipselect = 1; - ath79_spi0_cdata.is_flash = true; ath79_spi_info[0].platform_data = pdata; ath79_register_spi(&ath79_spi_data, ath79_spi_info, 1); } @@ -106,21 +91,11 @@ static void add_mtd_concat_notifier(void) register_mtd_user(¬); } -void __init ath79_register_m25p80_large(struct flash_platform_data *pdata) -{ - ath79_spi_data.bus_num = 0; - ath79_spi_data.num_chipselect = 1; - ath79_spi0_cdata.is_flash = false; - ath79_spi_info[0].platform_data = pdata; - ath79_register_spi(&ath79_spi_data, ath79_spi_info, 1); -} - void __init ath79_register_m25p80_multi(struct flash_platform_data *pdata) { multi_pdata = pdata; add_mtd_concat_notifier(); ath79_spi_data.bus_num = 0; ath79_spi_data.num_chipselect = 2; - ath79_spi0_cdata.is_flash = true; ath79_register_spi(&ath79_spi_data, ath79_spi_info, 2); } diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.h index 5e66016301..637b41a7d8 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.h @@ -12,7 +12,6 @@ #include void ath79_register_m25p80(struct flash_platform_data *pdata) __init; -void ath79_register_m25p80_large(struct flash_platform_data *pdata) __init; void ath79_register_m25p80_multi(struct flash_platform_data *pdata) __init; #endif /* _ATH79_DEV_M25P80_H */ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap96.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap96.c index f7cd6aedfd..531e5fb18e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap96.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap96.c @@ -56,42 +56,23 @@ static struct mmc_spi_platform_data alfa_ap96_mmc_data = { .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, }; -static struct ath79_spi_controller_data ap96_spi0_cdata = { - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .cs_line = 0, - .is_flash = true, -}; - -static struct ath79_spi_controller_data ap96_spi1_cdata = { - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .cs_line = 1, -}; - -static struct ath79_spi_controller_data ap96_spi2_cdata = { - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .cs_line = 2, -}; - static struct spi_board_info alfa_ap96_spi_info[] = { { .bus_num = 0, .chip_select = 0, .max_speed_hz = 25000000, .modalias = "m25p80", - .controller_data = &ap96_spi0_cdata }, { .bus_num = 0, .chip_select = 1, .max_speed_hz = 25000000, .modalias = "mmc_spi", .platform_data = &alfa_ap96_mmc_data, - .controller_data = &ap96_spi1_cdata }, { .bus_num = 0, .chip_select = 2, .max_speed_hz = 6250000, .modalias = "rtc-pcf2123", - .controller_data = &ap96_spi2_cdata }, }; diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ap113.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap113.c deleted file mode 100644 index 9b38faa47c..0000000000 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ap113.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Atheros AP113 board support - * - * Copyright (C) 2011 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 "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "pci.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define AP113_GPIO_LED_USB 0 -#define AP113_GPIO_LED_STATUS 1 -#define AP113_GPIO_LED_ST 11 - -#define AP113_GPIO_BTN_JUMPSTART 12 - -#define AP113_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP113_KEYS_DEBOUNCE_INTERVAL (3 * AP113_KEYS_POLL_INTERVAL) - -static struct gpio_led ap113_leds_gpio[] __initdata = { - { - .name = "ap113:green:usb", - .gpio = AP113_GPIO_LED_USB, - .active_low = 1, - }, - { - .name = "ap113:green:status", - .gpio = AP113_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "ap113:green:st", - .gpio = AP113_GPIO_LED_ST, - .active_low = 1, - } -}; - -static struct gpio_keys_button ap113_gpio_keys[] __initdata = { - { - .desc = "jumpstart button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP113_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP113_GPIO_BTN_JUMPSTART, - .active_low = 1, - }, -}; - -static void __init ap113_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, ~BIT(0)); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - - ath79_register_eth(0); - - ath79_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap113_gpio_keys), - ap113_gpio_keys); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio), - ap113_leds_gpio); - - ath79_register_pci(); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_AP113, "AP113", "Atheros AP113", - ap113_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ap83.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap83.c deleted file mode 100644 index 8519a9d9a6..0000000000 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ap83.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Atheros AP83 board support - * - * Copyright (C) 2008-2012 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define AP83_GPIO_LED_WLAN 6 -#define AP83_GPIO_LED_POWER 14 -#define AP83_GPIO_LED_JUMPSTART 15 -#define AP83_GPIO_BTN_JUMPSTART 12 -#define AP83_GPIO_BTN_RESET 21 - -#define AP83_050_GPIO_VSC7385_CS 1 -#define AP83_050_GPIO_VSC7385_MISO 3 -#define AP83_050_GPIO_VSC7385_MOSI 16 -#define AP83_050_GPIO_VSC7385_SCK 17 - -#define AP83_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP83_KEYS_DEBOUNCE_INTERVAL (3 * AP83_KEYS_POLL_INTERVAL) - -static struct mtd_partition ap83_flash_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x040000, - .size = 0x020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "kernel", - .offset = 0x060000, - .size = 0x140000, - }, { - .name = "rootfs", - .offset = 0x1a0000, - .size = 0x650000, - }, { - .name = "art", - .offset = 0x7f0000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x060000, - .size = 0x790000, - } -}; - -static struct physmap_flash_data ap83_flash_data = { - .width = 2, - .parts = ap83_flash_partitions, - .nr_parts = ARRAY_SIZE(ap83_flash_partitions), -}; - -static struct resource ap83_flash_resources[] = { - [0] = { - .start = AR71XX_SPI_BASE, - .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device ap83_flash_device = { - .name = "ar91xx-flash", - .id = -1, - .resource = ap83_flash_resources, - .num_resources = ARRAY_SIZE(ap83_flash_resources), - .dev = { - .platform_data = &ap83_flash_data, - } -}; - -static struct gpio_led ap83_leds_gpio[] __initdata = { - { - .name = "ap83:green:jumpstart", - .gpio = AP83_GPIO_LED_JUMPSTART, - .active_low = 0, - }, { - .name = "ap83:green:power", - .gpio = AP83_GPIO_LED_POWER, - .active_low = 0, - }, { - .name = "ap83:green:wlan", - .gpio = AP83_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ap83_gpio_keys[] __initdata = { - { - .desc = "soft_reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP83_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP83_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "jumpstart", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP83_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP83_GPIO_BTN_JUMPSTART, - .active_low = 1, - } -}; - -static struct resource ap83_040_spi_resources[] = { - [0] = { - .start = AR71XX_SPI_BASE, - .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device ap83_040_spi_device = { - .name = "ap83-spi", - .id = 0, - .resource = ap83_040_spi_resources, - .num_resources = ARRAY_SIZE(ap83_040_spi_resources), -}; - -static struct spi_gpio_platform_data ap83_050_spi_data = { - .miso = AP83_050_GPIO_VSC7385_MISO, - .mosi = AP83_050_GPIO_VSC7385_MOSI, - .sck = AP83_050_GPIO_VSC7385_SCK, - .num_chipselect = 1, -}; - -static struct platform_device ap83_050_spi_device = { - .name = "spi_gpio", - .id = 0, - .dev = { - .platform_data = &ap83_050_spi_data, - } -}; - -static void ap83_vsc7385_reset(void) -{ - ath79_device_reset_set(AR71XX_RESET_GE1_PHY); - udelay(10); - ath79_device_reset_clear(AR71XX_RESET_GE1_PHY); - mdelay(50); -} - -static struct vsc7385_platform_data ap83_vsc7385_data = { - .reset = ap83_vsc7385_reset, - .ucode_name = "vsc7385_ucode_ap83.bin", - .mac_cfg = { - .tx_ipg = 6, - .bit2 = 0, - .clk_sel = 3, - }, -}; - -static struct spi_board_info ap83_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "spi-vsc7385", - .platform_data = &ap83_vsc7385_data, - .controller_data = (void *) AP83_050_GPIO_VSC7385_CS, - } -}; - -static void __init ap83_generic_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_mdio(0, 0xfffffffe); - - ath79_init_mac(ath79_eth0_data.mac_addr, eeprom, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = 0x1; - - ath79_register_eth(0); - - ath79_init_mac(ath79_eth1_data.mac_addr, eeprom, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_eth1_pll_data.pll_1000 = 0x1f000000; - - ath79_register_eth(1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap83_leds_gpio), - ap83_leds_gpio); - - ath79_register_gpio_keys_polled(-1, AP83_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap83_gpio_keys), - ap83_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(eeprom, NULL); - - platform_device_register(&ap83_flash_device); - - spi_register_board_info(ap83_spi_info, ARRAY_SIZE(ap83_spi_info)); -} - -static void ap83_040_flash_lock(struct platform_device *pdev) -{ - ath79_flash_acquire(); -} - -static void ap83_040_flash_unlock(struct platform_device *pdev) -{ - ath79_flash_release(); -} - -static void __init ap83_040_setup(void) -{ - ap83_flash_data.lock = ap83_040_flash_lock; - ap83_flash_data.unlock = ap83_040_flash_unlock; - ap83_generic_setup(); - platform_device_register(&ap83_040_spi_device); -} - -static void __init ap83_050_setup(void) -{ - ap83_generic_setup(); - platform_device_register(&ap83_050_spi_device); -} - -static void __init ap83_setup(void) -{ - u8 *board_id = (u8 *) KSEG1ADDR(0x1fff1244); - unsigned int board_version; - - board_version = (unsigned int)(board_id[0] - '0'); - board_version += ((unsigned int)(board_id[1] - '0')) * 10; - - switch (board_version) { - case 40: - ap83_040_setup(); - break; - case 50: - ap83_050_setup(); - break; - default: - printk(KERN_WARNING "AP83-%03u board is not yet supported\n", - board_version); - } -} - -MIPS_MACHINE(ATH79_MACH_AP83, "AP83", "Atheros AP83", ap83_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-c55.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-c55.c index cbee18e395..8aa5ecb6a8 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-c55.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-c55.c @@ -96,7 +96,7 @@ static struct gpio_keys_button c55_gpio_keys[] __initdata = { static void __init c55_setup(void) { /* SPI Storage*/ - ath79_register_m25p80_large(NULL); + ath79_register_m25p80(NULL); /* MDIO Interface */ ath79_register_mdio(0, 0x0); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c index 2a9e7211b5..e78e311d2e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c @@ -160,7 +160,7 @@ static void __init c60_setup(void) ath79_register_nfc(); /* SPI Storage*/ - ath79_register_m25p80_large(NULL); + ath79_register_m25p80(NULL); /* AR8327 Switch Ethernet */ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c index 74daf434e6..d2dbed1fe2 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c @@ -30,6 +30,9 @@ #define CPE510_GPIO_LED_L3 15 #define CPE510_GPIO_LED_L4 16 +/* All LEDs/button except for link4 are the same for CPE and WBS series */ +#define WBS510_GPIO_LED_L4 2 + #define CPE510_GPIO_EXTERNAL_LNA0 18 #define CPE510_GPIO_EXTERNAL_LNA1 19 @@ -67,6 +70,34 @@ static struct gpio_led cpe510_leds_gpio[] __initdata = { }, }; +static struct gpio_led wbs510_leds_gpio[] __initdata = { + { + .name = "tp-link:green:lan0", + .gpio = CPE510_GPIO_LED_LAN0, + .active_low = 1, + }, { + .name = "tp-link:green:lan1", + .gpio = CPE510_GPIO_LED_LAN1, + .active_low = 1, + }, { + .name = "tp-link:green:link1", + .gpio = CPE510_GPIO_LED_L1, + .active_low = 1, + }, { + .name = "tp-link:green:link2", + .gpio = CPE510_GPIO_LED_L2, + .active_low = 1, + }, { + .name = "tp-link:green:link3", + .gpio = CPE510_GPIO_LED_L3, + .active_low = 1, + }, { + .name = "tp-link:green:link4", + .gpio = WBS510_GPIO_LED_L4, + .active_low = 1, + }, +}; + static struct gpio_keys_button cpe510_gpio_keys[] __initdata = { { .desc = "Reset button", @@ -85,9 +116,6 @@ static void __init cpe_setup(u8 *mac) ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, AR934X_GPIO_FUNC_CLK_OBS4_EN); - ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio), - cpe510_leds_gpio); - ath79_register_gpio_keys_polled(1, CPE510_KEYS_POLL_INTERVAL, ARRAY_SIZE(cpe510_gpio_keys), cpe510_gpio_keys); @@ -109,6 +137,9 @@ static void __init cpe210_setup(void) u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio), + cpe510_leds_gpio); + cpe_setup(mac); ath79_register_wmac(ee, mac); @@ -119,6 +150,22 @@ static void __init cpe510_setup(void) u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio), + cpe510_leds_gpio); + + cpe_setup(mac); + + ath79_register_wmac(ee, mac); +} + +static void __init wbs_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(wbs510_leds_gpio), + wbs510_leds_gpio); + cpe_setup(mac); ath79_register_wmac(ee, mac); @@ -129,3 +176,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220", MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520", cpe510_setup); + +MIPS_MACHINE(ATH79_MACH_WBS210, "WBS210", "TP-LINK WBS210", + wbs_setup); + +MIPS_MACHINE(ATH79_MACH_WBS510, "WBS510", "TP-LINK WBS510", + wbs_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-e2100l.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e2100l.c new file mode 100644 index 0000000000..c09083460e --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-e2100l.c @@ -0,0 +1,126 @@ +/* + * Linksys E2100L board support + * + * Copyright (C) 2009-2012 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 "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "nvram.h" +#include "machtypes.h" + +#define E2100L_GPIO_LED_POWER 14 +#define E2100L_GPIO_LED_WPS_AMBER 9 +#define E2100L_GPIO_LED_WPS_BLUE 8 +#define E2100L_GPIO_LED_WLAN 6 + +#define E2100L_GPIO_BTN_WPS 7 +#define E2100L_GPIO_BTN_RESET 21 + +#define E2100L_KEYS_POLL_INTERVAL 20 /* msecs */ +#define E2100L_KEYS_DEBOUNCE_INTERVAL (3 * E2100L_KEYS_POLL_INTERVAL) + +#define E2100L_NVRAM_ADDR 0x1f7e0000 +#define E2100L_NVRAM_SIZE 0x10000 + +static const char *e2100l_part_probes[] = { + "cybertan", + NULL, +}; + +static struct flash_platform_data e2100l_flash_data = { + .part_probes = e2100l_part_probes, +}; + +static struct gpio_led e2100l_leds_gpio[] __initdata = { + { + .name = "e2100l:blue:power", + .gpio = E2100L_GPIO_LED_POWER, + .active_low = 1, + .default_trigger = "default-on", + }, { + .name = "e2100l:amber:wps", + .gpio = E2100L_GPIO_LED_WPS_AMBER, + .active_low = 1, + }, { + .name = "e2100l:blue:wps", + .gpio = E2100L_GPIO_LED_WPS_BLUE, + .active_low = 1, + }, { + .name = "e2100l:blue:wlan", + .gpio = E2100L_GPIO_LED_WLAN, + .active_low = 1, + } +}; + +static struct gpio_keys_button e2100l_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = E2100L_KEYS_DEBOUNCE_INTERVAL, + .gpio = E2100L_GPIO_BTN_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = E2100L_KEYS_DEBOUNCE_INTERVAL, + .gpio = E2100L_GPIO_BTN_WPS, + .active_low = 1, + } +}; + +static void __init e2100l_setup(void) +{ + const char *nvram = (char *) KSEG1ADDR(E2100L_NVRAM_ADDR); + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); + u8 mac[6]; + + if (ath79_nvram_parse_mac_addr(nvram, E2100L_NVRAM_SIZE, + "lan_hwaddr=", mac) == 0) { + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); + } + + ath79_register_mdio(0, 0x0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; + ath79_eth0_data.phy_mask = 0x01; + + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; + ath79_eth1_data.phy_mask = 0x10; + + ath79_register_eth(0); + ath79_register_eth(1); + + ath79_register_m25p80(&e2100l_flash_data); + + ath79_register_usb(); + + if (ath79_nvram_parse_mac_addr(nvram, E2100L_NVRAM_SIZE, + "wl0_hwaddr=", mac) == 0) + ath79_register_wmac(eeprom, mac); + else + ath79_register_wmac(eeprom, NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(e2100l_leds_gpio), + e2100l_leds_gpio); + + ath79_register_gpio_keys_polled(-1, E2100L_KEYS_POLL_INTERVAL, + ARRAY_SIZE(e2100l_gpio_keys), + e2100l_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_E2100L, "E2100L", "Linksys E2100L", + e2100l_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c index d0f993c032..62906a1922 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c @@ -97,27 +97,12 @@ static struct gpio_keys_button gl_ar300m_gpio_keys[] __initdata = { }, }; -static struct ath79_spi_controller_data gl_ar300m_spi0_cdata = -{ - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .is_flash = true, - .cs_line = 0, -}; - -static struct ath79_spi_controller_data gl_ar300m_spi1_cdata = -{ - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .is_flash = false, - .cs_line = 1, -}; - static struct spi_board_info gl_ar300m_spi_info[] = { { .bus_num = 0, .chip_select = 0, .max_speed_hz = 25000000, .modalias = "m25p80", - .controller_data = &gl_ar300m_spi0_cdata, .platform_data = NULL, }, { @@ -125,7 +110,6 @@ static struct spi_board_info gl_ar300m_spi_info[] = { .chip_select = 1, .max_speed_hz = 25000000, .modalias = "ath79-spinand", - .controller_data = &gl_ar300m_spi1_cdata, .platform_data = NULL, } }; diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-pb92.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-pb92.c deleted file mode 100644 index 2440f0b6d3..0000000000 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-pb92.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Atheros PB92 board support - * - * Copyright (C) 2010 Felix Fietkau - * Copyright (C) 2008-2009 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. - */ - -#include - -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define PB92_KEYS_POLL_INTERVAL 20 /* msecs */ -#define PB92_KEYS_DEBOUNCE_INTERVAL (3 * PB92_KEYS_POLL_INTERVAL) - -#define PB92_GPIO_BTN_SW4 8 -#define PB92_GPIO_BTN_SW5 3 - -static struct gpio_keys_button pb92_gpio_keys[] __initdata = { - { - .desc = "sw4", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = PB92_KEYS_DEBOUNCE_INTERVAL, - .gpio = PB92_GPIO_BTN_SW4, - .active_low = 1, - }, { - .desc = "sw5", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = PB92_KEYS_DEBOUNCE_INTERVAL, - .gpio = PB92_GPIO_BTN_SW5, - .active_low = 1, - } -}; - -static void __init pb92_init(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, ~BIT(0)); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - - ath79_register_eth(0); - - ath79_register_gpio_keys_polled(-1, PB92_KEYS_POLL_INTERVAL, - ARRAY_SIZE(pb92_gpio_keys), - pb92_gpio_keys); - - ath79_register_usb(); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_PB92, "PB92", "Atheros PB92", pb92_init); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c index 9ef5c4455e..e37b73fd00 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c @@ -152,17 +152,6 @@ static struct gen_74x164_chip_platform_data rb711gr100_ssr_data = { .init_data = rb711gr100_ssr_initdata, }; -static struct ath79_spi_controller_data rb711gr100_spi0_cdata = { - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, - .cs_line = 0, - .is_flash = true, -}; - -static struct ath79_spi_controller_data rb711gr100_spi1_cdata = { - .cs_type = ATH79_SPI_CS_TYPE_GPIO, - .cs_line = RB91X_GPIO_SSR_STROBE, -}; - static struct spi_board_info rb711gr100_spi_info[] = { { .bus_num = 0, @@ -170,20 +159,24 @@ static struct spi_board_info rb711gr100_spi_info[] = { .max_speed_hz = 25000000, .modalias = "m25p80", .platform_data = &rb711gr100_spi_flash_data, - .controller_data = &rb711gr100_spi0_cdata }, { .bus_num = 0, .chip_select = 1, .max_speed_hz = 10000000, .modalias = "74x164", .platform_data = &rb711gr100_ssr_data, - .controller_data = &rb711gr100_spi1_cdata } }; +static int rb711gr100_spi_cs_gpios[2] = { + -ENOENT, + RB91X_GPIO_SSR_STROBE, +}; + static struct ath79_spi_platform_data rb711gr100_spi_data __initdata = { .bus_num = 0, .num_chipselect = 2, + .cs_gpios = rb711gr100_spi_cs_gpios, }; static struct gpio_led rb711gr100_leds[] __initdata = { diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-re450.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-re450.c new file mode 100644 index 0000000000..25de6e729f --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-re450.c @@ -0,0 +1,187 @@ +/* + * TP-LINK Archer RE450 board support + * + * Copyright (c) 2013 Gabor Juhos + * Copyright (c) 2016 Tal Keren + * + * Based on the Qualcomm Atheros AP135/AP136 reference board support code + * Copyright (c) 2012 Qualcomm Atheros + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-wmac.h" +#include "machtypes.h" +#include "pci.h" + +#define RE450_GPIO_LED_SYSTEM 12 +#define RE450_GPIO_LED_WLAN2G 13 +#define RE450_GPIO_LED_WLAN5G 14 +#define RE450_GPIO_LED_LAN_DATA 17 +#define RE450_GPIO_LED_JUMPSTART 21 +#define RE450_GPIO_LED_JUMPSTART_RED 22 +#define RE450_GPIO_LED_LAN_LINK 23 + +#define RE450_GPIO_BTN_RESET 18 +#define RE450_GPIO_BTN_LED 19 +#define RE450_GPIO_BTN_JUMPSTART 20 + +#define RE450_GPIO_SMI_MDIO 1 +#define RE450_GPIO_SMI_MDC 3 + +#define RE450_LAN_PHYADDR 4 + +#define RE450_KEYS_POLL_INTERVAL 20 /* msecs */ +#define RE450_KEYS_DEBOUNCE_INTERVAL (3 * RE450_KEYS_POLL_INTERVAL) + +#define RE450_WMAC_CALDATA_OFFSET 0x1000 + +static const char *tl_re450_part_probes[] = { + "cmdlinepart", + NULL, +}; + +static struct flash_platform_data tl_re450_flash_data = { + .part_probes = tl_re450_part_probes, +}; + +static struct gpio_led re450_leds_gpio[] __initdata = { + { + .name = "re450:blue:power", + .gpio = RE450_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "re450:blue:wlan2g", + .gpio = RE450_GPIO_LED_WLAN2G, + .active_low = 1, + }, + { + .name = "re450:blue:wlan5g", + .gpio = RE450_GPIO_LED_WLAN5G, + .active_low = 1, + }, + { + .name = "re450:blue:wps", + .gpio = RE450_GPIO_LED_JUMPSTART, + }, + { + .name = "re450:red:wps", + .gpio = RE450_GPIO_LED_JUMPSTART_RED, + }, + { + .name = "re450:green:lan_data", + .gpio = RE450_GPIO_LED_LAN_DATA, + .active_low = 1, + }, + { + .name = "re450:green:lan_link", + .gpio = RE450_GPIO_LED_LAN_LINK, + .active_low = 1, + }, +}; + +static struct gpio_keys_button re450_gpio_keys[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = RE450_KEYS_DEBOUNCE_INTERVAL, + .gpio = RE450_GPIO_BTN_RESET, + .active_low = 1, + }, + { + .desc = "WPS button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = RE450_KEYS_DEBOUNCE_INTERVAL, + .gpio = RE450_GPIO_BTN_JUMPSTART, + .active_low = 1, + }, + { + .desc = "Control LED button", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = RE450_KEYS_DEBOUNCE_INTERVAL, + .gpio = RE450_GPIO_BTN_LED, + .active_low = 1, + }, +}; + +static struct mdio_gpio_platform_data re450_mdio = { + .mdc = RE450_GPIO_SMI_MDC, + .mdio = RE450_GPIO_SMI_MDIO, + .phy_mask = ~BIT(RE450_LAN_PHYADDR), +}; + +static struct platform_device re450_phy_device = { + .name = "mdio-gpio", + .id = 0, + .dev = { + .platform_data = &re450_mdio, + }, +}; + +static void __init re450_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f610008); + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + u8 tmpmac[ETH_ALEN]; + + ath79_register_m25p80(&tl_re450_flash_data); + ath79_register_leds_gpio(-1, ARRAY_SIZE(re450_leds_gpio), + re450_leds_gpio); + ath79_register_gpio_keys_polled(-1, RE450_KEYS_POLL_INTERVAL, + ARRAY_SIZE(re450_gpio_keys), + re450_gpio_keys); + + ath79_init_mac(tmpmac, mac, -1); + ath79_register_wmac(art + RE450_WMAC_CALDATA_OFFSET, tmpmac); + + ath79_register_pci(); + + /* MDIO Interface */ + platform_device_register(&re450_phy_device); + + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + + /* GMAC0 is connected to the RGMII interface to an Atheros AR8035-A */ + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_eth0_data.mii_bus_dev = &re450_phy_device.dev; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = BIT(RE450_LAN_PHYADDR); + ath79_eth0_pll_data.pll_1000 = 0xa6000000; + ath79_eth0_pll_data.pll_100 = 0xa0000101; + ath79_eth0_pll_data.pll_10 = 0x80001313; + ath79_register_eth(0); +} + +MIPS_MACHINE(ATH79_MACH_RE450, "RE450", "TP-LINK RE450", + re450_setup) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-sr3200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sr3200.c new file mode 100644 index 0000000000..51fcccfaca --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-sr3200.c @@ -0,0 +1,187 @@ +/* + * Support for YunCore SR3200 and XD3200 boards + * + * Copyright (C) 2016 Piotr Dymacz + * + * 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 "common.h" +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define SR3200_XD3200_GPIO_LED_SYSTEM 1 +#define SR3200_XD3200_GPIO_LED_WLAN2G 19 + +#define SR3200_XD3200_GPIO_BTN_RESET 2 + +#define SR3200_XD3200_KEYS_POLL_INTERVAL 20 +#define SR3200_XD3200_KEYS_DEBOUNCE_INTERVAL \ + (3 * SR3200_XD3200_KEYS_POLL_INTERVAL) + +static struct gpio_led xd3200_leds_gpio[] __initdata = { + { + .name = "xd3200:green:system", + .gpio = SR3200_XD3200_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "xd3200:blue:wlan2g", + .gpio = SR3200_XD3200_GPIO_LED_WLAN2G, + .active_low = 1, + }, +}; + +static struct gpio_led sr3200_leds_gpio[] __initdata = { + { + .name = "sr3200:green:system", + .gpio = SR3200_XD3200_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "sr3200:green:wlan2g", + .gpio = SR3200_XD3200_GPIO_LED_WLAN2G, + .active_low = 1, + }, +}; + +static struct gpio_keys_button sr3200_xd3200_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = SR3200_XD3200_KEYS_DEBOUNCE_INTERVAL, + .gpio = SR3200_XD3200_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static const struct ar8327_led_info sr3200_leds_qca833x[] = { + AR8327_LED_INFO(PHY0_0, HW, "sr3200:green:lan1"), + AR8327_LED_INFO(PHY1_0, HW, "sr3200:green:lan2"), + AR8327_LED_INFO(PHY2_0, HW, "sr3200:green:lan3"), + AR8327_LED_INFO(PHY3_0, HW, "sr3200:green:lan4"), + AR8327_LED_INFO(PHY4_0, HW, "sr3200:green:wan"), +}; + +static const struct ar8327_led_info xd3200_leds_qca833x[] = { + AR8327_LED_INFO(PHY1_0, HW, "xd3200:green:lan"), + AR8327_LED_INFO(PHY2_0, HW, "xd3200:green:wan"), +}; + +/* Blink rate: 1 Gbps -> 8 hz, 100 Mbs -> 4 Hz, 10 Mbps -> 2 Hz */ +static struct ar8327_led_cfg sr3200_xd3200_qca833x_led_cfg = { + .led_ctrl0 = 0xcf37cf37, + .led_ctrl1 = 0xcf37cf37, + .led_ctrl2 = 0xcf37cf37, + .led_ctrl3 = 0x0, + .open_drain = true, +}; + +static struct ar8327_pad_cfg sr3200_xd3200_qca833x_pad0_cfg = { + .mode = AR8327_PAD_MAC_SGMII, + .sgmii_delay_en = true, +}; + +static struct ar8327_platform_data sr3200_xd3200_qca833x_data = { + .pad0_cfg = &sr3200_xd3200_qca833x_pad0_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .led_cfg = &sr3200_xd3200_qca833x_led_cfg, +}; + +static struct mdio_board_info sr3200_xd3200_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &sr3200_xd3200_qca833x_data, + }, +}; + +static void __init sr3200_xd3200_common_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(NULL); + + ath79_register_mdio(0, 0x0); + mdiobus_register_board_info(sr3200_xd3200_mdio0_info, + ARRAY_SIZE(sr3200_xd3200_mdio0_info)); + + /* GMAC0 is connected to QCA8334/QCA8337N switch */ + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.phy_mask = BIT(0); + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_register_eth(0); + + ath79_register_wmac(mac + 0x1000, NULL); + + ap91_pci_init(mac + 0x5000, NULL); + + ath79_gpio_direction_select(SR3200_XD3200_GPIO_LED_SYSTEM, true); + ath79_gpio_direction_select(SR3200_XD3200_GPIO_LED_WLAN2G, true); + + /* Mute LEDs on boot */ + gpio_set_value(SR3200_XD3200_GPIO_LED_SYSTEM, 1); + gpio_set_value(SR3200_XD3200_GPIO_LED_WLAN2G, 1); + + ath79_gpio_output_select(SR3200_XD3200_GPIO_LED_SYSTEM, 0); + ath79_gpio_output_select(SR3200_XD3200_GPIO_LED_WLAN2G, 0); + + ath79_register_gpio_keys_polled(-1, SR3200_XD3200_KEYS_POLL_INTERVAL, + ARRAY_SIZE(sr3200_xd3200_gpio_keys), + sr3200_xd3200_gpio_keys); +} + +static void __init sr3200_setup(void) +{ + sr3200_xd3200_qca833x_data.leds = sr3200_leds_qca833x; + sr3200_xd3200_qca833x_data.num_leds = ARRAY_SIZE(sr3200_leds_qca833x); + + sr3200_xd3200_common_setup(); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(sr3200_leds_gpio), + sr3200_leds_gpio); + + ath79_register_usb(); +} + +MIPS_MACHINE(ATH79_MACH_SR3200, "SR3200", "YunCore SR3200", sr3200_setup); + +static void __init xd3200_setup(void) +{ + sr3200_xd3200_qca833x_data.leds = xd3200_leds_qca833x; + sr3200_xd3200_qca833x_data.num_leds = ARRAY_SIZE(xd3200_leds_qca833x); + + sr3200_xd3200_common_setup(); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(xd3200_leds_gpio), + xd3200_leds_gpio); +} + +MIPS_MACHINE(ATH79_MACH_XD3200, "XD3200", "YunCore XD3200", xd3200_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c new file mode 100644 index 0000000000..cb224f4611 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c @@ -0,0 +1,190 @@ +/* + * TP-LINK WR1043 V4 support + * + * Copyright (C) 2015-2016 P. Wassi + * Copyright (C) 2016 Matthias Schiffer + * Copyright (C) 2016 Andreas Ziegler + * Copyright (C) 2016 Ludwig Thomeczek + * + * Derived from: mach-dir-869-a1.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 + +#include +#include +#include + +#include +#include + +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-wmac.h" +#include "dev-usb.h" +#include "machtypes.h" +#include "nvram.h" + +#define TL_WR1043_V4_GPIO_BTN_RESET 2 +#define TL_WR1043_V4_GPIO_BTN_RFKILL 5 + +#define TL_WR1043_V4_GPIO_LED_WLAN 19 +#define TL_WR1043_V4_GPIO_LED_USB 7 +#define TL_WR1043_V4_GPIO_LED_WPS 1 +#define TL_WR1043_V4_GPIO_LED_SYSTEM 6 + +#define TL_WR1043_V4_GPIO_USB_POWER 8 + +#define TL_WR1043_V4_GPIO_LED_WAN 15 +#define TL_WR1043_V4_GPIO_LED_LAN1 9 +#define TL_WR1043_V4_GPIO_LED_LAN2 14 +#define TL_WR1043_V4_GPIO_LED_LAN3 21 +#define TL_WR1043_V4_GPIO_LED_LAN4 20 + +#define TL_WR1043_V4_KEYS_POLL_INTERVAL 20 /* msecs */ +#define TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043_V4_KEYS_POLL_INTERVAL) + +#define TL_WR1043_V4_MAC_LOCATION 0x1ff80174 + +#define TL_WR1043_V4_EEPROM_ADDR 0x1fff0000 +#define TL_WR1043_V4_WMAC_CALDATA_OFFSET 0x1000 + +static struct gpio_led tl_wr1043nd_v4_leds_gpio[] __initdata = { + { + .name = "tp-link:green:wps", + .gpio = TL_WR1043_V4_GPIO_LED_WPS, + .active_low = 1, + }, + { + .name = "tp-link:green:system", + .gpio = TL_WR1043_V4_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "tp-link:green:wlan", + .gpio = TL_WR1043_V4_GPIO_LED_WLAN, + .active_low = 1, + }, + { + .name = "tp-link:green:usb", + .gpio = TL_WR1043_V4_GPIO_LED_USB, + .active_low = 1, + }, + { + .name = "tp-link:green:wan", + .gpio = TL_WR1043_V4_GPIO_LED_WAN, + .active_low = 1, + }, + { + .name = "tp-link:green:lan1", + .gpio = TL_WR1043_V4_GPIO_LED_LAN1, + .active_low = 1, + }, + { + .name = "tp-link:green:lan2", + .gpio = TL_WR1043_V4_GPIO_LED_LAN2, + .active_low = 1, + }, + { + .name = "tp-link:green:lan3", + .gpio = TL_WR1043_V4_GPIO_LED_LAN3, + .active_low = 1, + }, + { + .name = "tp-link:green:lan4", + .gpio = TL_WR1043_V4_GPIO_LED_LAN4, + .active_low = 1, + }, +}; + +static struct gpio_keys_button tl_wr1043nd_v4_gpio_keys[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL, + .gpio = TL_WR1043_V4_GPIO_BTN_RESET, + .active_low = 1, + }, + { + .desc = "RFKILL button", + .type = EV_KEY, + .code = KEY_RFKILL, + .debounce_interval = TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL, + .gpio = TL_WR1043_V4_GPIO_BTN_RFKILL, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg tl_wr1043nd_v4_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_SGMII, + .sgmii_delay_en = true, +}; + +static struct ar8327_platform_data tl_wr1043nd_v4_ar8327_data = { + .pad0_cfg = &tl_wr1043nd_v4_ar8327_pad0_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, +}; + +static struct mdio_board_info tl_wr1043nd_v4_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &tl_wr1043nd_v4_ar8327_data, + }, +}; + +static void __init tl_wr1043nd_v4_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043_V4_MAC_LOCATION); + u8 *eeprom = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR); + + ath79_register_m25p80(NULL); + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_mask = BIT(0); + + mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info, + ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info)); + + ath79_register_usb(); + ath79_register_mdio(0, 0); + ath79_register_eth(0); + + ath79_register_wmac(eeprom + TL_WR1043_V4_WMAC_CALDATA_OFFSET, mac); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_v4_leds_gpio), + tl_wr1043nd_v4_leds_gpio); + + ath79_register_gpio_keys_polled(-1, TL_WR1043_V4_KEYS_POLL_INTERVAL, + ARRAY_SIZE(tl_wr1043nd_v4_gpio_keys), + tl_wr1043nd_v4_gpio_keys); + + gpio_request_one(TL_WR1043_V4_GPIO_USB_POWER, + GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, + "USB power"); +} + +MIPS_MACHINE(ATH79_MACH_TL_WR1043ND_V4, "TL-WR1043ND-v4", + "TP-LINK TL-WR1043ND v4", tl_wr1043nd_v4_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c new file mode 100644 index 0000000000..d693b947c8 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c @@ -0,0 +1,149 @@ +/* + * TP-LINK TL-WR940N v4 board support + * + * Copyright (C) 2016 David Lutz + * + * 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 "common.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-wmac.h" +#include "machtypes.h" + + +#define TL_WR940N_V4_GPIO_LED_QSS 3 +#define TL_WR940N_V4_GPIO_LED_WAN 14 +#define TL_WR940N_V4_GPIO_LED_WAN_RED 15 +#define TL_WR940N_V4_GPIO_LED_LAN4 4 +#define TL_WR940N_V4_GPIO_LED_LAN3 18 +#define TL_WR940N_V4_GPIO_LED_LAN2 6 +#define TL_WR940N_V4_GPIO_LED_LAN1 8 +#define TL_WR940N_V4_GPIO_LED_WLAN 7 +#define TL_WR940N_V4_GPIO_LED_SYSTEM 5 + +#define TL_WR940N_V4_GPIO_BTN_RESET 1 +#define TL_WR940N_V4_GPIO_BTN_RFKILL 2 + +#define TL_WR940N_V4_KEYS_POLL_INTERVAL 20 +#define TL_WR940N_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR940N_V4_KEYS_POLL_INTERVAL) + + +static struct gpio_led tl_wr940n_v4_leds_gpio[] __initdata = { + { + .name = "tp-link:blue:qss", + .gpio = TL_WR940N_V4_GPIO_LED_QSS, + .active_low = 1, + }, + { + .name = "tp-link:blue:wan", + .gpio = TL_WR940N_V4_GPIO_LED_WAN, + .active_low = 1, + }, + { + .name = "tp-link:red:wan", + .gpio = TL_WR940N_V4_GPIO_LED_WAN_RED, + .active_low = 0, + }, + { + .name = "tp-link:blue:lan1", + .gpio = TL_WR940N_V4_GPIO_LED_LAN1, + .active_low = 1, + }, + { + .name = "tp-link:blue:lan2", + .gpio = TL_WR940N_V4_GPIO_LED_LAN2, + .active_low = 1, + }, + { + .name = "tp-link:blue:lan3", + .gpio = TL_WR940N_V4_GPIO_LED_LAN3, + .active_low = 1, + }, + { + .name = "tp-link:blue:lan4", + .gpio = TL_WR940N_V4_GPIO_LED_LAN4, + .active_low = 1, + }, + { + .name = "tp-link:blue:wlan", + .gpio = TL_WR940N_V4_GPIO_LED_WLAN, + .active_low = 1, + }, + { + .name = "tp-link:blue:system", + .gpio = TL_WR940N_V4_GPIO_LED_SYSTEM, + .active_low = 1, + }, +}; + +static struct gpio_keys_button tl_wr940n_v4_gpio_keys[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = TL_WR940N_V4_KEYS_DEBOUNCE_INTERVAL, + .gpio = TL_WR940N_V4_GPIO_BTN_RESET, + .active_low = 1, + }, { + .desc = "RFKILL button", + .type = EV_KEY, + .code = KEY_RFKILL, + .debounce_interval = TL_WR940N_V4_KEYS_DEBOUNCE_INTERVAL, + .gpio = TL_WR940N_V4_GPIO_BTN_RFKILL, + .active_low = 1, + } +}; + + +static const char *tl_wr940n_v4_part_probes[] = { + "tp-link", + NULL, +}; + +static struct flash_platform_data tl_wr940n_v4_flash_data = { + .part_probes = tl_wr940n_v4_part_probes, +}; + + +static void __init tl_wr940n_v4_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + ath79_register_m25p80(&tl_wr940n_v4_flash_data); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr940n_v4_leds_gpio), + tl_wr940n_v4_leds_gpio); + + ath79_register_gpio_keys_polled(-1, TL_WR940N_V4_KEYS_POLL_INTERVAL, + ARRAY_SIZE(tl_wr940n_v4_gpio_keys), + tl_wr940n_v4_gpio_keys); + + ath79_register_mdio(0, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); + ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); + + ath79_switch_data.phy4_mii_en = 1; + + ath79_register_eth(0); + ath79_register_eth(1); + + ath79_register_wmac(ee, mac); + +} + +MIPS_MACHINE(ATH79_MACH_TL_WR940N_V4, "TL-WR940N-v4", "TP-LINK TL-WR940N v4", + tl_wr940n_v4_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000.c index b4da7ece32..6e3becab3a 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000.c @@ -32,49 +32,6 @@ #define WNR2000_KEYS_POLL_INTERVAL 20 /* msecs */ #define WNR2000_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000_KEYS_POLL_INTERVAL) -static struct mtd_partition wnr2000_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x040000, - .size = 0x010000, - }, { - .name = "rootfs", - .offset = 0x050000, - .size = 0x240000, - }, { - .name = "user-config", - .offset = 0x290000, - .size = 0x010000, - }, { - .name = "uImage", - .offset = 0x2a0000, - .size = 0x120000, - }, { - .name = "language_table", - .offset = 0x3c0000, - .size = 0x020000, - }, { - .name = "rootfs_checksum", - .offset = 0x3e0000, - .size = 0x010000, - }, { - .name = "art", - .offset = 0x3f0000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - } -}; - -static struct flash_platform_data wnr2000_flash_data = { - .parts = wnr2000_partitions, - .nr_parts = ARRAY_SIZE(wnr2000_partitions), -}; - static struct gpio_led wnr2000_leds_gpio[] __initdata = { { .name = "netgear:green:power", @@ -130,7 +87,7 @@ static void __init wnr2000_setup(void) ath79_register_eth(0); ath79_register_eth(1); - ath79_register_m25p80(&wnr2000_flash_data); + ath79_register_m25p80(NULL); ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000_leds_gpio), wnr2000_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 9a8da22f65..9402185b9c 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -26,7 +26,6 @@ enum ath79_mach_type { ATH79_MACH_ANTMINER_S1, /* Antminer S1 */ ATH79_MACH_ANTMINER_S3, /* Antminer S3 */ ATH79_MACH_ANTROUTER_R1, /* Antrouter R1 */ - ATH79_MACH_AP113, /* Atheros AP113 reference board */ ATH79_MACH_AP121, /* Atheros AP121 reference board */ ATH79_MACH_AP121_MINI, /* Atheros AP121-MINI reference board */ ATH79_MACH_AP132, /* Atheros AP132 reference board */ @@ -36,8 +35,6 @@ enum ath79_mach_type { ATH79_MACH_AP143, /* Atheros AP143 reference board */ ATH79_MACH_AP147_010, /* Atheros AP147-010 reference board */ ATH79_MACH_AP152, /* Atheros AP152 reference board */ - ATH79_MACH_AP81, /* Atheros AP81 reference board */ - ATH79_MACH_AP83, /* Atheros AP83 */ ATH79_MACH_AP90Q, /* YunCore AP90Q */ ATH79_MACH_AP96, /* Atheros AP96 */ ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */ @@ -144,7 +141,6 @@ enum ath79_mach_type { ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ ATH79_MACH_PB42, /* Atheros PB42 */ ATH79_MACH_PB44, /* Atheros PB44 reference board */ - ATH79_MACH_PB92, /* Atheros PB92 */ ATH79_MACH_QIHOO_C301, /* Qihoo 360 C301 */ ATH79_MACH_R6100, /* NETGEAR R6100 */ ATH79_MACH_RB_2011G, /* Mikrotik RouterBOARD 2011UAS-2HnD */ @@ -170,9 +166,11 @@ enum ath79_mach_type { ATH79_MACH_RB_951U, /* Mikrotik RouterBOARD 951Ui-2HnD */ ATH79_MACH_RB_SXTLITE2ND, /* Mikrotik RouterBOARD SXT Lite 2nD */ ATH79_MACH_RB_SXTLITE5ND, /* Mikrotik RouterBOARD SXT Lite 5nD */ + ATH79_MACH_RE450, /* TP-LINK RE450 */ ATH79_MACH_RW2458N, /* Redwave RW2458N */ ATH79_MACH_SMART_300, /* NC-LINK SMART-300 */ ATH79_MACH_SOM9331, /* OpenEmbed SOM9331 */ + ATH79_MACH_SR3200, /* YunCore SR3200 */ ATH79_MACH_TELLSTICK_ZNET_LITE, /* TellStick ZNet Lite */ ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */ ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */ @@ -211,6 +209,7 @@ enum ath79_mach_type { ATH79_MACH_TL_WR1041N_V2, /* TP-LINK TL-WR1041N v2 */ ATH79_MACH_TL_WR1043ND, /* TP-LINK TL-WR1043ND */ ATH79_MACH_TL_WR1043ND_V2, /* TP-LINK TL-WR1043ND v2 */ + ATH79_MACH_TL_WR1043ND_V4, /* TP-LINK TL-WR1043ND v4 */ ATH79_MACH_TL_WR2543N, /* TP-LINK TL-WR2543N/ND */ ATH79_MACH_TL_WR703N, /* TP-LINK TL-WR703N */ ATH79_MACH_TL_WR710N, /* TP-LINK TL-WR710N */ @@ -229,6 +228,7 @@ enum ath79_mach_type { ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */ ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */ ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */ + ATH79_MACH_TL_WR940N_V4, /* TP-LINK TL-WR940N v4 */ ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */ ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */ ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */ @@ -251,6 +251,8 @@ enum ath79_mach_type { ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ + ATH79_MACH_WBS210, /* TP-LINK WBS210 */ + ATH79_MACH_WBS510, /* TP-LINK WBS510 */ ATH79_MACH_WEIO, /* WeIO board */ ATH79_MACH_WHR_G301N, /* Buffalo WHR-G301N */ ATH79_MACH_WHR_HP_G300N, /* Buffalo WHR-HP-G300N */ @@ -282,6 +284,7 @@ enum ath79_mach_type { ATH79_MACH_WZR_HP_G300NH, /* Buffalo WZR-HP-G300NH */ ATH79_MACH_WZR_HP_G300NH2, /* Buffalo WZR-HP-G300NH2 */ ATH79_MACH_WZR_HP_G450H, /* Buffalo WZR-HP-G450H */ + ATH79_MACH_XD3200, /* YunCore XD3200 */ ATH79_MACH_Z1, /* Cisco Meraki Z1 */ ATH79_MACH_ZBT_WE1526, /* Zbtlink ZBT-WE1526 */ ATH79_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */ diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h index 5b17e94b64..37512ba1a1 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h @@ -39,10 +39,5 @@ struct rb4xx_cpld_platform_data { extern int rb4xx_cpld_change_cfg(unsigned mask, unsigned value); extern int rb4xx_cpld_read(unsigned char *rx_buf, - const unsigned char *verify_buf, unsigned cnt); -extern int rb4xx_cpld_read_from(unsigned addr, - unsigned char *rx_buf, - const unsigned char *verify_buf, - unsigned cnt); extern int rb4xx_cpld_write(const unsigned char *buf, unsigned count); diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c index 5b9841b76b..f2b430ec4b 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c @@ -107,7 +107,7 @@ static unsigned char rb4xx_nand_read_byte(struct mtd_info *mtd) unsigned char data = 0; int err; - err = rb4xx_cpld_read(&data, NULL, 1); + err = rb4xx_cpld_read(&data, 1); if (err) { pr_err("rb4xx_nand: read data failed, err=%d\n", err); data = 0xff; @@ -131,7 +131,7 @@ static void rb4xx_nand_read_buf(struct mtd_info *mtd, unsigned char *buf, { int err; - err = rb4xx_cpld_read(buf, NULL, len); + err = rb4xx_cpld_read(buf, len); if (err) pr_err("rb4xx_nand: read buf failed, err=%d\n", err); } @@ -218,6 +218,7 @@ static int rb4xx_nand_probe(struct platform_device *pdev) info->chip.chip_delay = 25; info->chip.ecc.mode = NAND_ECC_SOFT; + info->chip.options = NAND_NO_SUBPAGE_WRITE; platform_set_drvdata(pdev, info); diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c index a20409b108..a9b287be10 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c @@ -277,6 +277,7 @@ static int rb750_nand_probe(struct platform_device *pdev) info->chip.chip_delay = 25; info->chip.ecc.mode = NAND_ECC_SOFT; + info->chip.options = NAND_NO_SUBPAGE_WRITE; info->pdata = pdata; diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c index f0aa3c3e79..bfc5d4dca0 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c @@ -321,6 +321,7 @@ static int rb91x_nand_probe(struct platform_device *pdev) rbni->chip.chip_delay = 25; rbni->chip.ecc.mode = NAND_ECC_SOFT; + rbni->chip.options = NAND_NO_SUBPAGE_WRITE; platform_set_drvdata(pdev, rbni); diff --git a/target/linux/ar71xx/files/drivers/spi/spi-ap83.c b/target/linux/ar71xx/files/drivers/spi/spi-ap83.c deleted file mode 100644 index 33843a6daa..0000000000 --- a/target/linux/ar71xx/files/drivers/spi/spi-ap83.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Atheros AP83 board specific SPI Controller driver - * - * 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 -#include -#include -#include - -#include - -#define DRV_DESC "Atheros AP83 board SPI Controller driver" -#define DRV_VERSION "0.1.0" -#define DRV_NAME "ap83-spi" - -#define AP83_SPI_CLK_HIGH (1 << 23) -#define AP83_SPI_CLK_LOW 0 -#define AP83_SPI_MOSI_HIGH (1 << 22) -#define AP83_SPI_MOSI_LOW 0 - -#define AP83_SPI_GPIO_CS 1 -#define AP83_SPI_GPIO_MISO 3 - -struct ap83_spi { - struct spi_bitbang bitbang; - void __iomem *base; - u32 addr; - - struct platform_device *pdev; -}; - -static inline u32 ap83_spi_rr(struct ap83_spi *sp, u32 reg) -{ - return __raw_readl(sp->base + reg); -} - -static inline struct ap83_spi *spidev_to_sp(struct spi_device *spi) -{ - return spi_master_get_devdata(spi->master); -} - -static inline void setsck(struct spi_device *spi, int val) -{ - struct ap83_spi *sp = spidev_to_sp(spi); - - if (val) - sp->addr |= AP83_SPI_CLK_HIGH; - else - sp->addr &= ~AP83_SPI_CLK_HIGH; - - dev_dbg(&spi->dev, "addr=%08x, SCK set to %s\n", - sp->addr, (val) ? "HIGH" : "LOW"); - - ap83_spi_rr(sp, sp->addr); -} - -static inline void setmosi(struct spi_device *spi, int val) -{ - struct ap83_spi *sp = spidev_to_sp(spi); - - if (val) - sp->addr |= AP83_SPI_MOSI_HIGH; - else - sp->addr &= ~AP83_SPI_MOSI_HIGH; - - dev_dbg(&spi->dev, "addr=%08x, MOSI set to %s\n", - sp->addr, (val) ? "HIGH" : "LOW"); - - ap83_spi_rr(sp, sp->addr); -} - -static inline u32 getmiso(struct spi_device *spi) -{ - u32 ret; - - ret = gpio_get_value(AP83_SPI_GPIO_MISO) ? 1 : 0; - dev_dbg(&spi->dev, "get MISO: %d\n", ret); - - return ret; -} - -static inline void do_spidelay(struct spi_device *spi, unsigned nsecs) -{ - ndelay(nsecs); -} - -static void ap83_spi_chipselect(struct spi_device *spi, int on) -{ - struct ap83_spi *sp = spidev_to_sp(spi); - - dev_dbg(&spi->dev, "set CS to %d\n", (on) ? 0 : 1); - - if (on) { - ath79_flash_acquire(); - - sp->addr = 0; - ap83_spi_rr(sp, sp->addr); - - gpio_set_value(AP83_SPI_GPIO_CS, 0); - } else { - gpio_set_value(AP83_SPI_GPIO_CS, 1); - ath79_flash_release(); - } -} - -#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 -#include "spi-bitbang-txrx.h" - -static u32 ap83_spi_txrx_mode0(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - dev_dbg(&spi->dev, "TXRX0 word=%08x, bits=%u\n", word, bits); - return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); -} - -static u32 ap83_spi_txrx_mode1(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - dev_dbg(&spi->dev, "TXRX1 word=%08x, bits=%u\n", word, bits); - return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits); -} - -static u32 ap83_spi_txrx_mode2(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - dev_dbg(&spi->dev, "TXRX2 word=%08x, bits=%u\n", word, bits); - return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits); -} - -static u32 ap83_spi_txrx_mode3(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - dev_dbg(&spi->dev, "TXRX3 word=%08x, bits=%u\n", word, bits); - return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits); -} - -static int ap83_spi_probe(struct platform_device *pdev) -{ - struct spi_master *master; - struct ap83_spi *sp; - struct ap83_spi_platform_data *pdata; - struct resource *r; - int ret; - - ret = gpio_request(AP83_SPI_GPIO_MISO, "spi-miso"); - if (ret) { - dev_err(&pdev->dev, "gpio request failed for MISO\n"); - return ret; - } - - ret = gpio_request(AP83_SPI_GPIO_CS, "spi-cs"); - if (ret) { - dev_err(&pdev->dev, "gpio request failed for CS\n"); - goto err_free_miso; - } - - ret = gpio_direction_input(AP83_SPI_GPIO_MISO); - if (ret) { - dev_err(&pdev->dev, "unable to set direction of MISO\n"); - goto err_free_cs; - } - - ret = gpio_direction_output(AP83_SPI_GPIO_CS, 0); - if (ret) { - dev_err(&pdev->dev, "unable to set direction of CS\n"); - goto err_free_cs; - } - - master = spi_alloc_master(&pdev->dev, sizeof(*sp)); - if (master == NULL) { - dev_err(&pdev->dev, "failed to allocate spi master\n"); - return -ENOMEM; - } - - sp = spi_master_get_devdata(master); - platform_set_drvdata(pdev, sp); - - pdata = pdev->dev.platform_data; - - sp->bitbang.master = spi_master_get(master); - sp->bitbang.chipselect = ap83_spi_chipselect; - sp->bitbang.txrx_word[SPI_MODE_0] = ap83_spi_txrx_mode0; - sp->bitbang.txrx_word[SPI_MODE_1] = ap83_spi_txrx_mode1; - sp->bitbang.txrx_word[SPI_MODE_2] = ap83_spi_txrx_mode2; - sp->bitbang.txrx_word[SPI_MODE_3] = ap83_spi_txrx_mode3; - - sp->bitbang.master->bus_num = pdev->id; - sp->bitbang.master->num_chipselect = 1; - - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (r == NULL) { - ret = -ENOENT; - goto err_spi_put; - } - - sp->base = ioremap_nocache(r->start, r->end - r->start + 1); - if (!sp->base) { - ret = -ENXIO; - goto err_spi_put; - } - - ret = spi_bitbang_start(&sp->bitbang); - if (!ret) - goto err_unmap; - - dev_info(&pdev->dev, "AP83 SPI adapter at %08x\n", r->start); - - return 0; - -err_unmap: - iounmap(sp->base); -err_spi_put: - platform_set_drvdata(pdev, NULL); - spi_master_put(sp->bitbang.master); - -err_free_cs: - gpio_free(AP83_SPI_GPIO_CS); -err_free_miso: - gpio_free(AP83_SPI_GPIO_MISO); - return ret; -} - -static int ap83_spi_remove(struct platform_device *pdev) -{ - struct ap83_spi *sp = platform_get_drvdata(pdev); - - spi_bitbang_stop(&sp->bitbang); - iounmap(sp->base); - platform_set_drvdata(pdev, NULL); - spi_master_put(sp->bitbang.master); - - return 0; -} - -static struct platform_driver ap83_spi_drv = { - .probe = ap83_spi_probe, - .remove = ap83_spi_remove, - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init ap83_spi_init(void) -{ - return platform_driver_register(&ap83_spi_drv); -} -module_init(ap83_spi_init); - -static void __exit ap83_spi_exit(void) -{ - platform_driver_unregister(&ap83_spi_drv); -} -module_exit(ap83_spi_exit); - -MODULE_ALIAS("platform:" DRV_NAME); -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files/drivers/spi/spi-rb4xx-cpld.c b/target/linux/ar71xx/files/drivers/spi/spi-rb4xx-cpld.c index a8d52825eb..0534c7c374 100644 --- a/target/linux/ar71xx/files/drivers/spi/spi-rb4xx-cpld.c +++ b/target/linux/ar71xx/files/drivers/spi/spi-rb4xx-cpld.c @@ -131,73 +131,7 @@ int rb4xx_cpld_change_cfg(unsigned mask, unsigned value) } EXPORT_SYMBOL_GPL(rb4xx_cpld_change_cfg); -int rb4xx_cpld_read_from(unsigned addr, unsigned char *rx_buf, - const unsigned char *verify_buf, unsigned count) -{ - const unsigned char cmd[5] = { - CPLD_CMD_READ_FAST, - (addr >> 16) & 0xff, - (addr >> 8) & 0xff, - addr & 0xff, - 0 - }; - struct spi_transfer t[2] = { - { - .tx_buf = &cmd, - .len = 5, - }, - { - .tx_buf = verify_buf, - .rx_buf = rx_buf, - .len = count, - .verify = (verify_buf != NULL), - }, - }; - struct spi_message m; - - if (rb4xx_cpld == NULL) - return -ENODEV; - - spi_message_init(&m); - m.fast_read = 1; - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - return spi_sync(rb4xx_cpld->spi, &m); -} -EXPORT_SYMBOL_GPL(rb4xx_cpld_read_from); - -#if 0 -int rb4xx_cpld_read(unsigned char *buf, unsigned char *verify_buf, - unsigned count) -{ - struct spi_transfer t[2]; - struct spi_message m; - unsigned char cmd[2]; - - if (rb4xx_cpld == NULL) - return -ENODEV; - - spi_message_init(&m); - memset(&t, 0, sizeof(t)); - - /* send command */ - t[0].tx_buf = cmd; - t[0].len = sizeof(cmd); - spi_message_add_tail(&t[0], &m); - - cmd[0] = CPLD_CMD_READ_NAND; - cmd[1] = 0; - - /* read data */ - t[1].rx_buf = buf; - t[1].len = count; - spi_message_add_tail(&t[1], &m); - - return spi_sync(rb4xx_cpld->spi, &m); -} -#else -int rb4xx_cpld_read(unsigned char *rx_buf, const unsigned char *verify_buf, - unsigned count) +int rb4xx_cpld_read(unsigned char *rx_buf, unsigned count) { static const unsigned char cmd[2] = { CPLD_CMD_READ_NAND, 0 }; struct spi_transfer t[2] = { @@ -205,10 +139,8 @@ int rb4xx_cpld_read(unsigned char *rx_buf, const unsigned char *verify_buf, .tx_buf = &cmd, .len = 2, }, { - .tx_buf = verify_buf, .rx_buf = rx_buf, .len = count, - .verify = (verify_buf != NULL), }, }; struct spi_message m; @@ -221,40 +153,10 @@ int rb4xx_cpld_read(unsigned char *rx_buf, const unsigned char *verify_buf, spi_message_add_tail(&t[1], &m); return spi_sync(rb4xx_cpld->spi, &m); } -#endif EXPORT_SYMBOL_GPL(rb4xx_cpld_read); int rb4xx_cpld_write(const unsigned char *buf, unsigned count) { -#if 0 - struct spi_transfer t[3]; - struct spi_message m; - unsigned char cmd[1]; - - if (rb4xx_cpld == NULL) - return -ENODEV; - - memset(&t, 0, sizeof(t)); - spi_message_init(&m); - - /* send command */ - t[0].tx_buf = cmd; - t[0].len = sizeof(cmd); - spi_message_add_tail(&t[0], &m); - - cmd[0] = CPLD_CMD_WRITE_NAND; - - /* write data */ - t[1].tx_buf = buf; - t[1].len = count; - spi_message_add_tail(&t[1], &m); - - /* send idle */ - t[2].len = 1; - spi_message_add_tail(&t[2], &m); - - return spi_sync(rb4xx_cpld->spi, &m); -#else static const unsigned char cmd = CPLD_CMD_WRITE_NAND; struct spi_transfer t[3] = { { @@ -263,10 +165,10 @@ int rb4xx_cpld_write(const unsigned char *buf, unsigned count) }, { .tx_buf = buf, .len = count, - .fast_write = 1, + .tx_nbits = SPI_NBITS_DUAL, }, { .len = 1, - .fast_write = 1, + .tx_nbits = SPI_NBITS_DUAL, }, }; struct spi_message m; @@ -279,7 +181,6 @@ int rb4xx_cpld_write(const unsigned char *buf, unsigned count) spi_message_add_tail(&t[1], &m); spi_message_add_tail(&t[2], &m); return spi_sync(rb4xx_cpld->spi, &m); -#endif } EXPORT_SYMBOL_GPL(rb4xx_cpld_write); @@ -378,7 +279,7 @@ static int rb4xx_cpld_probe(struct spi_device *spi) cpld->spi = spi_dev_get(spi); dev_set_drvdata(&spi->dev, cpld); - spi->mode = SPI_MODE_0; + spi->mode = SPI_MODE_0 | SPI_TX_DUAL; spi->bits_per_word = 8; err = spi_setup(spi); if (err) { diff --git a/target/linux/ar71xx/files/drivers/spi/spi-rb4xx.c b/target/linux/ar71xx/files/drivers/spi/spi-rb4xx.c index 357fd41708..9175fc7ae3 100644 --- a/target/linux/ar71xx/files/drivers/spi/spi-rb4xx.c +++ b/target/linux/ar71xx/files/drivers/spi/spi-rb4xx.c @@ -135,7 +135,6 @@ static void do_spi_byte_fast(void __iomem *base, unsigned char byte) static int rb4xx_spi_txrx(void __iomem *base, struct spi_transfer *t) { - const unsigned char *rxv_ptr = NULL; const unsigned char *tx_ptr = t->tx_buf; unsigned char *rx_ptr = t->rx_buf; unsigned i; @@ -145,94 +144,21 @@ static int rb4xx_spi_txrx(void __iomem *base, struct spi_transfer *t) (t->tx_buf ? 1 : 0), (t->rx_buf ? 1 : 0)); - if (t->verify) { - rxv_ptr = tx_ptr; - tx_ptr = NULL; - } - for (i = 0; i < t->len; ++i) { unsigned char sdata = tx_ptr ? tx_ptr[i] : 0; - if (t->fast_write) + if (t->tx_nbits == SPI_NBITS_DUAL) do_spi_byte_fast(base, sdata); else do_spi_byte(base, sdata); - if (rx_ptr) { + if (rx_ptr) rx_ptr[i] = __raw_readl(base + AR71XX_SPI_REG_RDS) & 0xff; - } else if (rxv_ptr) { - unsigned char c = __raw_readl(base + AR71XX_SPI_REG_RDS); - if (rxv_ptr[i] != c) - return i; - } } return i; } -static int rb4xx_spi_read_fast(struct rb4xx_spi *rbspi, - struct spi_message *m) -{ - struct spi_transfer *t; - const unsigned char *tx_ptr; - unsigned addr; - void __iomem *base = rbspi->base; - - /* check for exactly two transfers */ - if (list_empty(&m->transfers) || - list_is_last(m->transfers.next, &m->transfers) || - !list_is_last(m->transfers.next->next, &m->transfers)) { - return -1; - } - - /* first transfer contains command and address */ - t = list_entry(m->transfers.next, - struct spi_transfer, transfer_list); - - if (t->len != 5 || t->tx_buf == NULL) - return -1; - - tx_ptr = t->tx_buf; - if (tx_ptr[0] != CPLD_CMD_READ_FAST) - return -1; - - addr = tx_ptr[1]; - addr = tx_ptr[2] | (addr << 8); - addr = tx_ptr[3] | (addr << 8); - addr += (unsigned) base; - - m->actual_length += t->len; - - /* second transfer contains data itself */ - t = list_entry(m->transfers.next->next, - struct spi_transfer, transfer_list); - - if (t->tx_buf && !t->verify) - return -1; - - __raw_writel(AR71XX_SPI_FS_GPIO, base + AR71XX_SPI_REG_FS); - __raw_writel(rbspi->spi_ctrl_fread, base + AR71XX_SPI_REG_CTRL); - __raw_writel(0, base + AR71XX_SPI_REG_FS); - - if (t->rx_buf) { - memcpy(t->rx_buf, (const void *)addr, t->len); - } else if (t->tx_buf) { - unsigned char buf[t->len]; - memcpy(buf, (const void *)addr, t->len); - if (memcmp(t->tx_buf, buf, t->len) != 0) - m->status = -EMSGSIZE; - } - m->actual_length += t->len; - - if (rbspi->spi_ctrl_flash != rbspi->spi_ctrl_fread) { - __raw_writel(AR71XX_SPI_FS_GPIO, base + AR71XX_SPI_REG_FS); - __raw_writel(rbspi->spi_ctrl_flash, base + AR71XX_SPI_REG_CTRL); - __raw_writel(0, base + AR71XX_SPI_REG_FS); - } - - return 0; -} - static int rb4xx_spi_msg(struct rb4xx_spi *rbspi, struct spi_message *m) { struct spi_transfer *t = NULL; @@ -242,10 +168,6 @@ static int rb4xx_spi_msg(struct rb4xx_spi *rbspi, struct spi_message *m) if (list_empty(&m->transfers)) return -1; - if (m->fast_read) - if (rb4xx_spi_read_fast(rbspi, m) == 0) - return -1; - __raw_writel(AR71XX_SPI_FS_GPIO, base + AR71XX_SPI_REG_FS); __raw_writel(SPI_CTRL_FASTEST, base + AR71XX_SPI_REG_CTRL); do_spi_init(m->spi); @@ -339,7 +261,7 @@ static int rb4xx_spi_setup(struct spi_device *spi) struct rb4xx_spi *rbspi = spi_master_get_devdata(spi->master); unsigned long flags; - if (spi->mode & ~(SPI_CS_HIGH)) { + if (spi->mode & ~(SPI_CS_HIGH | SPI_TX_DUAL)) { dev_err(&spi->dev, "mode %x not supported\n", (unsigned) spi->mode); return -EINVAL; @@ -402,6 +324,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev) master->bus_num = 0; master->num_chipselect = 3; + master->mode_bits = SPI_TX_DUAL; master->setup = rb4xx_spi_setup; master->transfer = rb4xx_spi_transfer; diff --git a/target/linux/ar71xx/files/net/dsa/mv88e6063.c b/target/linux/ar71xx/files/net/dsa/mv88e6063.c deleted file mode 100644 index 5638a9fe94..0000000000 --- a/target/linux/ar71xx/files/net/dsa/mv88e6063.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * net/dsa/mv88e6063.c - Driver for Marvell 88e6063 switch chips - * Copyright (c) 2009 Gabor Juhos - * - * This driver was base on: net/dsa/mv88e6060.c - * net/dsa/mv88e6063.c - Driver for Marvell 88e6060 switch chips - * Copyright (c) 2008-2009 Marvell Semiconductor - * - * 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 "dsa_priv.h" - -#define REG_BASE 0x10 -#define REG_PHY(p) (REG_BASE + (p)) -#define REG_PORT(p) (REG_BASE + 8 + (p)) -#define REG_GLOBAL (REG_BASE + 0x0f) -#define NUM_PORTS 7 - -static int reg_read(struct dsa_switch *ds, int addr, int reg) -{ - return mdiobus_read(ds->master_mii_bus, addr, reg); -} - -#define REG_READ(addr, reg) \ - ({ \ - int __ret; \ - \ - __ret = reg_read(ds, addr, reg); \ - if (__ret < 0) \ - return __ret; \ - __ret; \ - }) - - -static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val) -{ - return mdiobus_write(ds->master_mii_bus, addr, reg, val); -} - -#define REG_WRITE(addr, reg, val) \ - ({ \ - int __ret; \ - \ - __ret = reg_write(ds, addr, reg, val); \ - if (__ret < 0) \ - return __ret; \ - }) - -static char *mv88e6063_probe(struct mii_bus *bus, int sw_addr) -{ - int ret; - - ret = mdiobus_read(bus, REG_PORT(0), 0x03); - if (ret >= 0) { - ret &= 0xfff0; - if (ret == 0x1530) - return "Marvell 88E6063"; - } - - return NULL; -} - -static int mv88e6063_switch_reset(struct dsa_switch *ds) -{ - int i; - int ret; - - /* - * Set all ports to the disabled state. - */ - for (i = 0; i < NUM_PORTS; i++) { - ret = REG_READ(REG_PORT(i), 0x04); - REG_WRITE(REG_PORT(i), 0x04, ret & 0xfffc); - } - - /* - * Wait for transmit queues to drain. - */ - msleep(2); - - /* - * Reset the switch. - */ - REG_WRITE(REG_GLOBAL, 0x0a, 0xa130); - - /* - * Wait up to one second for reset to complete. - */ - for (i = 0; i < 1000; i++) { - ret = REG_READ(REG_GLOBAL, 0x00); - if ((ret & 0x8000) == 0x0000) - break; - - msleep(1); - } - if (i == 1000) - return -ETIMEDOUT; - - return 0; -} - -static int mv88e6063_setup_global(struct dsa_switch *ds) -{ - /* - * Disable discarding of frames with excessive collisions, - * set the maximum frame size to 1536 bytes, and mask all - * interrupt sources. - */ - REG_WRITE(REG_GLOBAL, 0x04, 0x0800); - - /* - * Enable automatic address learning, set the address - * database size to 1024 entries, and set the default aging - * time to 5 minutes. - */ - REG_WRITE(REG_GLOBAL, 0x0a, 0x2130); - - return 0; -} - -static int mv88e6063_setup_port(struct dsa_switch *ds, int p) -{ - int addr = REG_PORT(p); - - /* - * Do not force flow control, disable Ingress and Egress - * Header tagging, disable VLAN tunneling, and set the port - * state to Forwarding. Additionally, if this is the CPU - * port, enable Ingress and Egress Trailer tagging mode. - */ - REG_WRITE(addr, 0x04, dsa_is_cpu_port(ds, p) ? 0x4103 : 0x0003); - - /* - * Port based VLAN map: give each port its own address - * database, allow the CPU port to talk to each of the 'real' - * ports, and allow each of the 'real' ports to only talk to - * the CPU port. - */ - REG_WRITE(addr, 0x06, - ((p & 0xf) << 12) | - (dsa_is_cpu_port(ds, p) ? - ds->phys_port_mask : - (1 << ds->dst->cpu_port))); - - /* - * Port Association Vector: when learning source addresses - * of packets, add the address to the address database using - * a port bitmap that has only the bit for this port set and - * the other bits clear. - */ - REG_WRITE(addr, 0x0b, 1 << p); - - return 0; -} - -static int mv88e6063_setup(struct dsa_switch *ds) -{ - int i; - int ret; - - ret = mv88e6063_switch_reset(ds); - if (ret < 0) - return ret; - - /* @@@ initialise atu */ - - ret = mv88e6063_setup_global(ds); - if (ret < 0) - return ret; - - for (i = 0; i < NUM_PORTS; i++) { - ret = mv88e6063_setup_port(ds, i); - if (ret < 0) - return ret; - } - - return 0; -} - -static int mv88e6063_set_addr(struct dsa_switch *ds, u8 *addr) -{ - REG_WRITE(REG_GLOBAL, 0x01, (addr[0] << 8) | addr[1]); - REG_WRITE(REG_GLOBAL, 0x02, (addr[2] << 8) | addr[3]); - REG_WRITE(REG_GLOBAL, 0x03, (addr[4] << 8) | addr[5]); - - return 0; -} - -static int mv88e6063_port_to_phy_addr(int port) -{ - if (port >= 0 && port <= NUM_PORTS) - return REG_PHY(port); - return -1; -} - -static int mv88e6063_phy_read(struct dsa_switch *ds, int port, int regnum) -{ - int addr; - - addr = mv88e6063_port_to_phy_addr(port); - if (addr == -1) - return 0xffff; - - return reg_read(ds, addr, regnum); -} - -static int -mv88e6063_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val) -{ - int addr; - - addr = mv88e6063_port_to_phy_addr(port); - if (addr == -1) - return 0xffff; - - return reg_write(ds, addr, regnum, val); -} - -static void mv88e6063_poll_link(struct dsa_switch *ds) -{ - int i; - - for (i = 0; i < DSA_MAX_PORTS; i++) { - struct net_device *dev; - int uninitialized_var(port_status); - int link; - int speed; - int duplex; - int fc; - - dev = ds->ports[i]; - if (dev == NULL) - continue; - - link = 0; - if (dev->flags & IFF_UP) { - port_status = reg_read(ds, REG_PORT(i), 0x00); - if (port_status < 0) - continue; - - link = !!(port_status & 0x1000); - } - - if (!link) { - if (netif_carrier_ok(dev)) { - printk(KERN_INFO "%s: link down\n", dev->name); - netif_carrier_off(dev); - } - continue; - } - - speed = (port_status & 0x0100) ? 100 : 10; - duplex = (port_status & 0x0200) ? 1 : 0; - fc = ((port_status & 0xc000) == 0xc000) ? 1 : 0; - - if (!netif_carrier_ok(dev)) { - printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, " - "flow control %sabled\n", dev->name, - speed, duplex ? "full" : "half", - fc ? "en" : "dis"); - netif_carrier_on(dev); - } - } -} - -static struct dsa_switch_driver mv88e6063_switch_driver = { - .tag_protocol = htons(ETH_P_TRAILER), - .probe = mv88e6063_probe, - .setup = mv88e6063_setup, - .set_addr = mv88e6063_set_addr, - .phy_read = mv88e6063_phy_read, - .phy_write = mv88e6063_phy_write, - .poll_link = mv88e6063_poll_link, -}; - -static int __init mv88e6063_init(void) -{ - register_switch_driver(&mv88e6063_switch_driver); - return 0; -} -module_init(mv88e6063_init); - -static void __exit mv88e6063_cleanup(void) -{ - unregister_switch_driver(&mv88e6063_switch_driver); -} -module_exit(mv88e6063_cleanup); diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index a87811362b..b9c3fc350f 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -14,6 +14,7 @@ DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD_ID NETGEAR_HW_ID CMDLINE CONSO ifeq ($(SUBTARGET),generic) include ./tp-link.mk +include ./ubnt.mk include ./generic.mk include ./legacy-devices.mk endif diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 16a4001a29..e2867e6c40 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -44,6 +44,16 @@ define Device/cf-e320n-v2 endef TARGET_DEVICES += cf-e320n-v2 +define Device/cf-e380ac-v1 + DEVICE_TITLE := COMFAST CF-E380AC v1 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = CF-E380AC-V1 + IMAGE_SIZE = 16128k + CONSOLE = ttyS0,115200 + MTDPARTS = spi0.0:128k(u-boot)ro,64k(art)ro,16128k(firmware),64k(art-backup)ro +endef +TARGET_DEVICES += cf-e380ac-v1 + define Device/cf-e380ac-v2 $(Device/cf-e380ac-v1) DEVICE_TITLE := COMFAST CF-E380AC v2 @@ -404,6 +414,16 @@ define Device/rnx-n360rt endef TARGET_DEVICES += rnx-n360rt +define Device/mc-mac1200r + $(Device/tplink-8mlzma) + DEVICE_TITLE := MERCURY MAC1200R + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := MC-MAC1200R + DEVICE_PROFILE := MAC1200R + TPLINK_HWID := 0x12000001 +endef +TARGET_DEVICES += mc-mac1200r + define Device/minibox-v1 $(Device/tplink-16mlzma) DEVICE_TITLE := Gainstrong MiniBox V1.0 @@ -464,6 +484,24 @@ define Device/som9331 endef TARGET_DEVICES += som9331 +define Device/sr3200 + DEVICE_TITLE := YunCore SR3200 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = SR3200 + IMAGE_SIZE = 16000k + CONSOLE = ttyS0,115200 + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro +endef +TARGET_DEVICES += sr3200 + +define Device/xd3200 + $(Device/sr3200) + DEVICE_TITLE := YunCore XD3200 + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = XD3200 +endef +TARGET_DEVICES += xd3200 + define Device/tellstick-znet-lite $(Device/tplink-16mlzma) DEVICE_TITLE := TellStick ZNet Lite @@ -487,6 +525,42 @@ endef TARGET_DEVICES += oolite +define Device/NBG6616 + DEVICE_TITLE := ZyXEL NBG6616 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-rtc-pcf8563 kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = NBG6616 + KERNEL_SIZE = 2048k + IMAGE_SIZE = 15323k + MTDPARTS = spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware) + CMDLINE += mem=128M + IMAGES := sysupgrade.bin + KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage + IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) + # We cannot currently build a factory image. It is the sysupgrade image + # prefixed with a header (which is actually written into the MTD device). + # The header is 2kiB and is filled with 0xff. The format seems to be: + # 2 bytes: 0x0000 + # 2 bytes: checksum of the data partition (big endian) + # 4 bytes: length of the contained image file (big endian) + # 32 bytes: Firmware Version string (NUL terminated, 0xff padded) + # 2 bytes: 0x0000 + # 2 bytes: checksum over the header partition (big endian) + # 32 bytes: Model (e.g. "NBG6616", NUL termiated, 0xff padded) + # rest: 0xff padding + # + # 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 calcualted over the first 2048 bytes with + # the firmware checksum as the placeholder during calculation. + # + # The header is padded with 0xff to the erase block size of the device. +endef + +TARGET_DEVICES += NBG6616 + define Device/c-55 DEVICE_TITLE := AirTight Networks C-55 DEVICE_PACKAGES := kmod-ath9k @@ -556,6 +630,20 @@ define Device/seama DEVICE_VARS += SEAMA_SIGNATURE endef +define Device/dir-869-a1 +$(Device/seama) + DEVICE_TITLE := D-Link DIR-869 rev. A1 + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = DIR-869-A1 + IMAGE_SIZE = 15872k + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro + SEAMA_SIGNATURE := wrgac54_dlink.2015_dir869 + IMAGE/factory.bin := \ + $$(IMAGE/default) | pad-rootfs -x 64 | \ + seama | seama-seal -m "signature=$$$$(SEAMA_SIGNATURE)" | \ + check-size $$$$(IMAGE_SIZE) +endef + define Device/mynet-n600 $(Device/seama) DEVICE_TITLE := Western Digital My Net N600 @@ -576,7 +664,17 @@ $(Device/seama) SEAMA_SIGNATURE := wrgnd13_wd_av endef -TARGET_DEVICES += dir-869-a1 mynet-n600 mynet-n750 +define Device/qihoo-c301 +$(Device/seama) + DEVICE_TITLE := Qihoo C301 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = QIHOO-C301 + IMAGE_SIZE = 15744k + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata) + SEAMA_SIGNATURE := wrgac26_qihoo360_360rg +endef + +TARGET_DEVICES += dir-869-a1 mynet-n600 mynet-n750 qihoo-c301 define Build/mkwrggimg $(STAGING_DIR_HOST)/bin/mkwrggimg -b \ @@ -590,6 +688,23 @@ define Build/wrgg-pad-rootfs $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@ endef +define Device/dap-2695-a1 + DEVICE_TITLE := D-Link DAP-2695 rev. A1 + DEVICE_PACKAGES := ath10k-firmware-qca988x kmod-ath10k uboot-envtools + BOARDNAME = DAP-2695-A1 + IMAGES := factory.img sysupgrade.bin + IMAGE_SIZE = 15360k + IMAGE/factory.img = append-kernel | pad-offset 65536 160 | append-rootfs | wrgg-pad-rootfs | mkwrggimg | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel | pad-offset 65536 160 | mkwrggimg | append-rootfs | wrgg-pad-rootfs | check-size $$$$(IMAGE_SIZE) + KERNEL := kernel-bin | patch-cmdline | relocate-kernel | lzma + KERNEL_INITRAMFS := $$(KERNEL) | mkwrggimg + MTDPARTS = spi0.0:256k(bootloader)ro,64k(bdcfg)ro,64k(rgdb)ro,64k(langpack)ro,15360k(firmware),448k(captival)ro,64k(certificate)ro,64k(radiocfg)ro + DAP_SIGNATURE := wapac02_dkbs_dap2695 + DEVICE_VARS += DAP_SIGNATURE +endef + +TARGET_DEVICES += dap-2695-a1 + define Build/mkbuffaloimg $(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \ -R $$(($(subst k, * 1024,$(ROOTFS_SIZE)))) \ diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk index 36a6d8d2c8..3f865da43f 100644 --- a/target/linux/ar71xx/image/legacy-devices.mk +++ b/target/linux/ar71xx/image/legacy-devices.mk @@ -14,19 +14,6 @@ define LegacyDevice/TUBE2H8M endef LEGACY_DEVICES += TUBE2H8M -define LegacyDevice/AP81 - DEVICE_TITLE := Atheros AP81 reference board - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -endef -LEGACY_DEVICES += AP81 - -define LegacyDevice/AP83 - DEVICE_TITLE := Atheros AP83 reference board - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 \ - vsc7385-ucode-ap83 vsc7395-ucode-ap83 -endef -LEGACY_DEVICES += AP83 - define LegacyDevice/AP96 DEVICE_TITLE := Atheros AP96 reference board DEVICE_PACKAGES := kmod-usb-core kmod-usb2 @@ -216,6 +203,13 @@ define LegacyDevice/YUN_16M endef LEGACY_DEVICES += YUN_16M +define LegacyDevice/F9K1115V2 + DEVICE_TITLE := Belkin AC1750DB (F9K1115V2) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb3 kmod-usb-ledtrig-usbport \ + kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += F9K1115V2 + define LegacyDevice/DIR600A1 DEVICE_TITLE := D-Link DIR-600 rev. A1 endef @@ -294,10 +288,16 @@ LEGACY_DEVICES += DIR505A1 define LegacyDevice/DGL5500A1 DEVICE_TITLE := D-Link DGL-5500 rev. A1 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x endef LEGACY_DEVICES += DGL5500A1 +define LegacyDevice/TEW823DRU + DEVICE_TITLE := TRENDNet TEW-823DRU + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += TEW823DRU + define LegacyDevice/DHP1565A1 DEVICE_TITLE := D-Link DHP-1565 rev. A1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 @@ -361,12 +361,30 @@ define LegacyDevice/dLAN_pro_500_wp endef LEGACY_DEVICES += dLAN_pro_500_wp +define LegacyDevice/dLAN_pro_1200_ac + DEVICE_TITLE := devolo dLAN pro 1200+ WiFi ac + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += dLAN_pro_1200_ac + define LegacyDevice/ESR900 DEVICE_TITLE := EnGenius ESR900 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport endef LEGACY_DEVICES += ESR900 +define LegacyDevice/ESR1750 + DEVICE_TITLE := EnGenius ESR1750 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += ESR1750 + +define LegacyDevice/EPG5000 + DEVICE_TITLE := EnGenius EPG5000 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += EPG5000 + define LegacyDevice/WP543_4M DEVICE_TITLE := Compex WP543/WPJ543 (4MB flash) DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 @@ -403,6 +421,11 @@ define LegacyDevice/WPE72_16M endef LEGACY_DEVICES += WPE72_16M +define LegacyDevice/WNR2000 + DEVICE_TITLE := NETGEAR WNR2000V1 +endef +LEGACY_DEVICES += WNR2000 + define LegacyDevice/WNR2000V3 DEVICE_TITLE := NETGEAR WNR2000V3 endef @@ -457,6 +480,12 @@ define LegacyDevice/OM5P endef LEGACY_DEVICES += OM5P +define LegacyDevice/OM5PAC + DEVICE_TITLE := OpenMesh OM5P-AC/OM5P-ACv2 + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x om-watchdog +endef +LEGACY_DEVICES += OM5PAC + define LegacyDevice/MR600 DEVICE_TITLE := OpenMesh MR600 DEVICE_PACKAGES := om-watchdog @@ -469,6 +498,12 @@ define LegacyDevice/MR900 endef LEGACY_DEVICES += MR900 +define LegacyDevice/MR1750 + DEVICE_TITLE := OpenMesh MR1750/MR1750v2 + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += MR1750 + define LegacyDevice/ALL0305 DEVICE_TITLE := Allnet ALL0305 DEVICE_PACKAGES := fconfig kmod-ath5k -kmod-ath9k diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk index e0e7be1a88..f80b700be8 100644 --- a/target/linux/ar71xx/image/legacy.mk +++ b/target/linux/ar71xx/image/legacy.mk @@ -199,7 +199,7 @@ define Image/BuildLoader LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \ LOADER_DATA="$(KDIR)/vmlinux$(5).bin.lzma" BOARD="$(1)" \ compile loader.$(2) - -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2) + -$(if $(5),$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)) endef # @@ -227,8 +227,6 @@ alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs) alfa_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15936k(firmware),64k(nvram),64k(art)ro all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)ro all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),13568k(firmware),2048k(failsafe),256k(art)ro -ap81_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,5120k(rootfs),2688k(kernel),64k(art)ro,7808k@0x50000(firmware) -ap83_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,4096k(rootfs),3648k(kernel),64k(art)ro,7744k@0x60000(firmware) ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware) ap121_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware) ap121_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,10944k(rootfs),4992k(kernel),64k(nvram),64k(art)ro,15936k@0x50000(firmware) @@ -278,6 +276,7 @@ wpj531_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro wpj558_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware) wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro +wnr2000_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro wnr2000v4_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata)ro,256k(caldata-backup),512k(config),512k(pot),2048k(kernel),122240k(ubi),25600k@0x1a0000(firmware),2048k(language),3072k(traffic_meter) @@ -688,6 +687,10 @@ define Image/Build/Netgear -o $(call imgname,$(1),$(2))-factory$$dashr.img; \ done; \ fi + if [ "$2" = "wnr2000" ]; then \ + dd if=$(KDIR)/root.$(1) \ + of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \ + fi endef @@ -880,8 +883,6 @@ $(eval $(call SingleProfile,ALFA,64k,ALFANX,alfa-nx,ALFA-NX,ttyS0,115200,$$(alfa $(eval $(call SingleProfile,ALFA,64k,HORNETUB,hornet-ub,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel_image,rootfs_image)) $(eval $(call SingleProfile,ALFA,64k,TUBE2H8M,tube2h-8M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel.image,rootfs.image)) -$(eval $(call SingleProfile,AthGzip,64k,AP81,ap81,AP81,ttyS0,115200,$$(ap81_mtdlayout),RKuImage)) -$(eval $(call SingleProfile,AthGzip,64k,AP83,ap83,AP83,ttyS0,115200,$$(ap83_mtdlayout),RKuImage)) $(eval $(call SingleProfile,AthGzip,64k,AP96,ap96,AP96,ttyS0,115200,$$(ap96_mtdlayout),RKuImage)) $(eval $(call SingleProfile,AthGzip,64k,WNDAP360,wndap360,WNDAP360,ttyS0,9600,$$(wndap360_mtdlayout),KRuImage)) @@ -949,6 +950,7 @@ $(eval $(call SingleProfile,CameoDB120,64kraw,DIR835A1,dir-835-a1,DIR-835-A1,tty $(eval $(call SingleProfile,CameoDB120_8M,64kraw,TEW732BR,tew-732br,TEW-732BR,ttyS0,115200,"00DB120AR9341-RT-120906-NA")) +$(eval $(call SingleProfile,CyberTANGZIP,64k,E2100L,e2100l,E2100L,ttyS0,115200,,1.00.01)) $(eval $(call SingleProfile,CyberTANGZIP,64k,WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,,1.00.01)) $(eval $(call SingleProfile,CyberTANLZMA,64k,MYNETREXT,mynet-rext,MYNET-REXT,ttyS0,115200,$$(mynet_rext_mtdlayout) root=31:2,1.00.01)) @@ -974,6 +976,7 @@ $(eval $(call SingleProfile,MyLoader,64k,WPE72_16M,wpe72,,ttyS0,115200,0x1000000 $(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,"" NA,-H 29763551+04+32)) $(eval $(call SingleProfile,NetgearLzma,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"" NA,)) +$(eval $(call SingleProfile,Netgear,64kraw,WNR2000,wnr2000,WNR2000,ttyS0,115200,$$(wnr2000_mtdlayout),0x32303031,WNR2000,"" NA,)) $(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,wnr2200,"" NA,)) $(eval $(call SingleProfile,Netgear,64kraw,REALWNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,WNR612V2,"",)) $(eval $(call SingleProfile,Netgear,64kraw,N150R,n150r,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,N150R,"",)) diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk index b02b896435..e66014e663 100644 --- a/target/linux/ar71xx/image/nand.mk +++ b/target/linux/ar71xx/image/nand.mk @@ -13,6 +13,17 @@ endef TARGET_DEVICES += c-60 +define Device/domywifi-dw33d + DEVICE_TITLE := DomyWifi DW33D + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME = DW33D + IMAGE_SIZE = 16000k + CONSOLE = ttyS0,115200 + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware);ar934x-nfc:96m(rootfs_data),32m(backup)ro + IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to 14528k | append-kernel | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += domywifi-dw33d + define Build/MerakiNAND -$(STAGING_DIR_HOST)/bin/mkmerakifw \ -B $(BOARDNAME) -s \ @@ -76,3 +87,8 @@ define LegacyDevice/WNDR4300V1 endef LEGACY_DEVICES += WNDR4300V1 +define LegacyDevice/NBG6716 + DEVICE_TITLE := Zyxel NBG 6716 + DEVICE_PACKAGES := kmod-rtc-pcf8563 kmod-ath10k ath10k-firmware-qca988x +endef +LEGACY_DEVICES += NBG6716 diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk index c96ffd58ad..480d9ad39d 100644 --- a/target/linux/ar71xx/image/tp-link.mk +++ b/target/linux/ar71xx/image/tp-link.mk @@ -21,10 +21,10 @@ define Build/mktplinkfw $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@ endef -# mktplinkfw-initramfs +# mktplinkfw-combined # # -c combined image -define Build/mktplinkfw-initramfs +define Build/mktplinkfw-combined $(STAGING_DIR_HOST)/bin/mktplinkfw \ -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $(1) \ -m $(TPLINK_HEADER_VERSION) \ @@ -35,12 +35,22 @@ define Build/mktplinkfw-initramfs @mv $@.new $@ endef +# add RE450 and similar header to the kernel image +define Build/mktplinkfw-kernel + $(STAGING_DIR_HOST)/bin/mktplinkfw-kernel \ + -H $(TPLINK_HWID) -N OpenWrt -V $(REVISION) \ + -L $(KERNEL_LOADADDR) -E $(KERNEL_LOADADDR) \ + -k $@ \ + -o $@.new + @mv $@.new $@ +endef + define Device/tplink TPLINK_HWREV := 0x1 TPLINK_HEADER_VERSION := 1 LOADER_TYPE := gz KERNEL := kernel-bin | patch-cmdline | lzma - KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-initramfs + KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-combined IMAGES := sysupgrade.bin factory.bin IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade IMAGE/factory.bin := append-rootfs | mktplinkfw factory @@ -52,7 +62,7 @@ $(Device/tplink) COMPILE := loader-$(1).gz COMPILE/loader-$(1).gz := loader-okli-compile KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) - KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel-cmdline | mktplinkfw-initramfs + KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel-cmdline | mktplinkfw-combined endef define Device/tplink-4m @@ -107,7 +117,39 @@ $(Device/cpe510-520) BOARDNAME := CPE210 TPLINK_BOARD_NAME := CPE210 endef -TARGET_DEVICES += cpe210-220 cpe510-520 + +define Device/wbs210 +$(Device/cpe510-520) + DEVICE_TITLE := TP-LINK WBS210 + DEVICE_PACKAGES := rssileds + BOARDNAME := WBS210 + TPLINK_BOARD_NAME := WBS210 +endef + +define Device/wbs510 +$(Device/cpe510-520) + DEVICE_TITLE := TP-LINK WBS510 + DEVICE_PACKAGES := rssileds + BOARDNAME := WBS510 + TPLINK_BOARD_NAME := WBS510 +endef +TARGET_DEVICES += cpe210-220 cpe510-520 wbs210 wbs510 + +define Device/re450 + DEVICE_TITLE := TP-LINK RE450 + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x + MTDPARTS := spi0.0:128k(u-boot)ro,1344k(kernel),4672k(rootfs),64k(pation-table)ro,64k(product-info)ro,1856k(config)ro,64k(art)ro,6016k@0x20000(firmware) + IMAGE_SIZE := 7936k + BOARDNAME := RE450 + TPLINK_BOARD_NAME := RE450 + DEVICE_PROFILE := RE450 + LOADER_TYPE := elf + KERNEL := kernel-bin | patch-cmdline | lzma | mktplinkfw-kernel + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade + IMAGE/factory.bin := append-rootfs | tplink-safeloader factory +endef +TARGET_DEVICES += re450 define Device/eap120 DEVICE_TITLE := TP-LINK EAP120 @@ -178,6 +220,19 @@ $(Device/tl-wdr4300-v1) endef TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1 +define Device/tl-wdr6500-v2 +$(Device/tplink-8mlzma) + DEVICE_TITLE := TP-LINK TL-WDR6500v2 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma + KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | mktplinkfw-combined + BOARDNAME = TL-WDR6500-v2 + DEVICE_PROFILE = TLWDR6500V2 + TPLINK_HWID := 0x65000002 + TPLINK_HEADER_VERSION := 2 +endef +TARGET_DEVICES += tl-wdr6500-v2 + define Device/tl-wdr3320-v2 $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WDR3320v2 @@ -189,6 +244,56 @@ $(Device/tplink-4mlzma) endef TARGET_DEVICES += tl-wdr3320-v2 +define Device/archer-c5-v1 + $(Device/tplink-16mlzma) + DEVICE_TITLE := TP-LINK Archer C5 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := ARCHER-C5 + DEVICE_PROFILE := ARCHERC7 + TPLINK_HWID := 0xc5000001 +endef + +define Device/archer-c7-v1 + $(Device/tplink-8mlzma) + DEVICE_TITLE := TP-LINK Archer C7 v1 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := ARCHER-C7 + DEVICE_PROFILE := ARCHERC7 + TPLINK_HWID := 0x75000001 +endef + +define Device/archer-c7-v2 + $(Device/tplink-16mlzma) + DEVICE_TITLE := TP-LINK Archer C7 v2 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := ARCHER-C7-V2 + DEVICE_PROFILE := ARCHERC7 + TPLINK_HWID := 0xc7000002 + IMAGES := sysupgrade.bin factory.bin factory-us.bin factory-eu.bin + IMAGE/factory-us.bin := append-rootfs | mktplinkfw factory -C US + IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU +endef + +define Device/archer-c7-v2-il + $(Device/tplink-16mlzma) + DEVICE_TITLE := TP-LINK Archer C7 v2 IL + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := ARCHER-C7-V2 + DEVICE_PROFILE := ARCHERC7 + TPLINK_HWID := 0xc7000002 + TPLINK_HWREV := 0x494c0001 +endef + +define Device/tl-wdr7500-v3 + $(Device/tplink-8mlzma) + DEVICE_TITLE := TP-LINK Archer C7 v3 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := ARCHER-C7 + DEVICE_PROFILE := ARCHERC7 + TPLINK_HWID := 0x75000003 +endef +TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 archer-c7-v2-il tl-wdr7500-v3 + define Device/tl-mr10u-v1 $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR10U @@ -308,6 +413,16 @@ define Device/tl-mr3420-v2 endef TARGET_DEVICES += tl-mr3020-v1 tl-mr3040-v1 tl-mr3040-v2 tl-mr3220-v1 tl-mr3220-v2 tl-mr3420-v1 tl-mr3420-v2 +define Device/tl-wpa8630 + $(Device/tplink-8mlzma) + DEVICE_TITLE := TP-LINK TL-WPA8630 + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := TL-WPA8630 + DEVICE_PROFILE := TL-WPA8630 + TPLINK_HWID := 0x86300001 +endef +TARGET_DEVICES += tl-wpa8630 + define Device/tl-wr703n-v1 $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR703N @@ -639,6 +754,17 @@ define Device/tl-wr941nd-v6 TPLINK_HWID := 0x09410006 endef +define Device/tl-wr940n-v4 + $(Device/tplink-4mlzma) + DEVICE_TITLE := TP-LINK TL-WR940N v4 + BOARDNAME := TL-WR940N-v4 + DEVICE_PROFILE := TLWR941 + TPLINK_HWID := 0x09400004 + IMAGES += factory-us.bin factory-eu.bin + IMAGE/factory-us.bin := append-rootfs | mktplinkfw factory -C US + IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU +endef + # Chinese version (unlike European) is similar to the TL-WDR3500 define Device/tl-wr941nd-v6-cn $(Device/tplink-4mlzma) @@ -647,7 +773,7 @@ define Device/tl-wr941nd-v6-cn DEVICE_PROFILE := TLWR941 TPLINK_HWID := 0x09410006 endef -TARGET_DEVICES += tl-wr941nd-v2 tl-wr941nd-v3 tl-wr941nd-v4 tl-wr941nd-v5 tl-wr941nd-v6 tl-wr941nd-v6-cn +TARGET_DEVICES += tl-wr941nd-v2 tl-wr941nd-v3 tl-wr941nd-v4 tl-wr941nd-v5 tl-wr941nd-v6 tl-wr941nd-v6-cn tl-wr940n-v4 define Device/tl-wr1041n-v2 $(Device/tplink-4mlzma) @@ -684,7 +810,24 @@ define Device/tl-wr1043nd-v3 DEVICE_PROFILE := TLWR1043 TPLINK_HWID := 0x10430003 endef -TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 + +define Device/tl-wr1043nd-v4 + $(Device/tplink) + DEVICE_TITLE := TP-LINK TL-WR1043N/ND v4 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport + BOARDNAME := TL-WR1043ND-v4 + DEVICE_PROFILE := TLWR1043 + TPLINK_HWID := 0x10430004 + TPLINK_FLASHLAYOUT := 16Msafeloader + MTDPARTS := spi0.0:128k(u-boot)ro,1536k(kernel),14016k(rootfs),128k(product-info)ro,320k(config)ro,64k(partition-table)ro,128k(logs)ro,64k(ART)ro,15552k@0x20000(firmware) + IMAGE_SIZE := 15552k + TPLINK_BOARD_NAME := TLWR1043NDV4 + KERNEL := kernel-bin | patch-cmdline | lzma | mktplinkfw-combined + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade + IMAGE/factory.bin := append-rootfs | tplink-safeloader factory +endef +TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 tl-wr1043nd-v4 define Device/tl-wr2543-v1 $(Device/tplink-8mlzma) diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk new file mode 100644 index 0000000000..68fe8ad301 --- /dev/null +++ b/target/linux/ar71xx/image/ubnt.mk @@ -0,0 +1,277 @@ +# UBNT_BOARD e.g. one of (XS2, XS5, RS, XM) +# UBNT_TYPE e.g. one of (BZ, XM, XW) +# UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x) + +# mkubntimage is using the kernel image direct +# routerboard creates partitions out of the ubnt header +define Build/mkubntimage + -$(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \ + -k $(IMAGE_KERNEL) \ + -r $@ \ + -o $@ +endef + +# all UBNT XM device expect the kernel image to have 1024k while flash, when +# booting the image, the size doesn't matter. +define Build/mkubntimage-split + -[ -f $@ ] && ( \ + dd if=$@ of=$@.old1 bs=1024k count=1; \ + dd if=$@ of=$@.old2 bs=1024k skip=1; \ + $(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \ + -k $@.old1 \ + -r $@.old2 \ + -o $@; \ + rm $@.old1 $@.old2 ) +endef + +define Build/mkubntimage2 + -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \ + -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \ + -p jffs2:0x50000:0xf60000:0:0:$@ \ + -o $@.new + @mv $@.new $@ +endef + +DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE + +# UBNT_BOARD e.g. one of (XS2, XS5, RS, XM) +# UBNT_TYPE e.g. one of (BZ, XM, XW) +# UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x) +define Device/ubnt-xm + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7552k + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro + UBNT_TYPE := XM + UBNT_BOARD := XM + UBNT_CHIP := ar7240 + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split + IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) +endef + +define Device/ubnt-xw + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7552k + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro + UBNT_TYPE := XW + UBNT_BOARD := XM + UBNT_CHIP := ar934x + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split + IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) +endef + +define Device/ubnt-bz + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7552k + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro + UBNT_TYPE := BZ + UBNT_BOARD := XM + UBNT_CHIP := ar934x + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split + IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) +endef + +define Device/ubnt-unifiac + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7744k + MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) +endef + +define Device/rw2458n + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti RW2458N + BOARDNAME := RW2458N +endef + +define Device/ubnt-airrouter + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti AirRouter + BOARDNAME := UBNT-AR +endef + +define Device/ubnt-bullet-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Bullet-M + BOARDNAME := UBNT-BM +endef + +define Device/ubnt-rocket-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Rocket-M + BOARDNAME := UBNT-RM +endef + +define Device/ubnt-nano-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Nano-M + BOARDNAME := UBNT-NM +endef +TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m + +define Device/ubnt-unifi + $(Device/ubnt-bz) + DEVICE_TITLE := Ubiquiti UniFi + BOARDNAME := UBNT-UF + DEVICE_PROFILE := UBNT UBNTUNIFI +endef + +define Device/ubnt-unifiac-lite + $(Device/ubnt-unifiac) + DEVICE_TITLE := Ubiquiti UniFi AC-Lite + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x + DEVICE_PROFILE := UBNT UBNTUNIFIACLITE + BOARDNAME := UBNT-UF-AC-LITE +endef + +define Device/ubnt-unifiac-pro + $(Device/ubnt-unifiac) + DEVICE_TITLE := Ubiquiti UniFi AC-Pro + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2 + DEVICE_PROFILE := UBNT UBNTUNIFIACPRO + BOARDNAME := UBNT-UF-AC-PRO +endef + +define Device/ubnt-unifi-outdoor + $(Device/ubnt-bz) + DEVICE_TITLE := Ubiquiti UniFi Outdoor + BOARDNAME := UBNT-U20 + DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR +endef +TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-pro ubnt-unifi-outdoor + +define Device/ubnt-nano-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Nano M XW + BOARDNAME := UBNT-NM-XW +endef + +define Device/ubnt-loco-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Loco XW + BOARDNAME := UBNT-LOCO-XW +endef + +define Device/ubnt-rocket-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Rocket M XW + BOARDNAME := UBNT-RM-XW +endef + +define Device/ubnt-rocket-m-ti + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Rocket M TI + BOARDNAME := UBNT-RM-TI + UBNT_TYPE := TI + UBNT_BOARD := XM +endef +TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti + +define Device/ubnt-air-gateway + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Air Gateway + BOARDNAME := UBNT-AGW + UBNT_BOARD := XM + UBNT_TYPE := AirGW + UBNT_CHIP := ar933x + CONSOLE = ttyATH0,115200 +endef +TARGET_DEVICES += ubnt-air-gateway + +define Device/ubnt-air-gateway-pro + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Air Gateway Pro + BOARDNAME := UBNT-AGWP + UBNT_TYPE := AirGWP + UBNT_CHIP := ar934x + CONSOLE = ttyS0,115200 +endef +TARGET_DEVICES += ubnt-air-gateway-pro + +define Device/ubdev01 + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti ubDEV01 + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro + BOARDNAME := UBNT-UF + UBNT_BOARD := UBDEV01 + UBNT_TYPE := XM + UBNT_CHIP := ar7240 +endef + +TARGET_DEVICES += ubdev01 + +define Device/ubnt-routerstation + DEVICE_TITLE := Ubiquiti RouterStation + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 + IMAGE_SIZE := 16128k + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage + IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) + KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE) +endef + +define Device/ubnt-rs +$(Device/ubnt-routerstation) + DEVICE_TITLE := Ubiquiti RouterStation + BOARDNAME := UBNT-RS + DEVICE_PROFILE := UBNT UBNTRS + UBNT_BOARD := RS + UBNT_TYPE := RSx + UBNT_CHIP := ar7100 +endef + +define Device/ubnt-rspro +$(Device/ubnt-routerstation) + DEVICE_TITLE := Ubiquiti RouterStation Pro + BOARDNAME := UBNT-RSPRO + DEVICE_PROFILE := UBNT UBNTRSPRO + UBNT_BOARD := RSPRO + UBNT_TYPE := RSPRO + UBNT_CHIP := ar7100pro +endef + +define Device/ubnt-ls-sr71 +$(Device/ubnt-routerstation) + DEVICE_TITLE := Ubiquiti LS-SR71 + BOARDNAME := UBNT-LS-SR71 + DEVICE_PROFILE := UBNT + UBNT_BOARD := LS-SR71 + UBNT_TYPE := LS-SR71 + UBNT_CHIP := ar7100 +endef + +TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71 + +define Device/ubnt-uap-pro + DEVICE_TITLE := Ubiquiti UAP Pro + KERNEL_SIZE := 1536k + IMAGE_SIZE := 15744k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware) + UBNT_TYPE := BZ + UBNT_CHIP := ar934x + BOARDNAME := UAP-PRO + DEVICE_PROFILE := UBNT UAPPRO + KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0 + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2 +endef + +define Device/ubnt-unifi-outdoor-plus +$(Device/ubnt-uap-pro) + DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus + UBNT_CHIP := ar7240 + BOARDNAME := UBNT-UOP + DEVICE_PROFILE := UBNT +endef + +TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index e17b16635e..3e7cfd5f27 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -4,13 +4,10 @@ # CONFIG_ATH79_MACH_ALL0258N is not set # CONFIG_ATH79_MACH_ALL0315N is not set # CONFIG_ATH79_MACH_ANTMINER_S1 is not set -# CONFIG_ATH79_MACH_AP113 is not set # CONFIG_ATH79_MACH_AP121 is not set # CONFIG_ATH79_MACH_AP132 is not set # CONFIG_ATH79_MACH_AP136 is not set # CONFIG_ATH79_MACH_AP147 is not set -# CONFIG_ATH79_MACH_AP81 is not set -# CONFIG_ATH79_MACH_AP83 is not set # CONFIG_ATH79_MACH_AP96 is not set # CONFIG_ATH79_MACH_ARCHER_C7 is not set # CONFIG_ATH79_MACH_AW_NR580 is not set @@ -62,7 +59,6 @@ # CONFIG_ATH79_MACH_OM5P is not set # CONFIG_ATH79_MACH_PB42 is not set # CONFIG_ATH79_MACH_PB44 is not set -# CONFIG_ATH79_MACH_PB92 is not set # CONFIG_ATH79_MACH_QIHOO_C301 is not set # CONFIG_ATH79_MACH_R6100 is not set CONFIG_ATH79_MACH_RB2011=y @@ -72,6 +68,7 @@ CONFIG_ATH79_MACH_RB91X=y CONFIG_ATH79_MACH_RB922=y CONFIG_ATH79_MACH_RB95X=y CONFIG_ATH79_MACH_RBSXTLITE=y +# CONFIG_ATH79_MACH_RE450 is not set # CONFIG_ATH79_MACH_RW2458N is not set # CONFIG_ATH79_MACH_SMART_300 is not set # CONFIG_ATH79_MACH_TEW_632BRP is not set @@ -93,6 +90,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y # CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set # CONFIG_ATH79_MACH_TL_WR1043ND is not set # CONFIG_ATH79_MACH_TL_WR1043ND_V2 is not set +# CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set # CONFIG_ATH79_MACH_TL_WR2543N is not set # CONFIG_ATH79_MACH_TL_WR703N is not set # CONFIG_ATH79_MACH_TL_WR720N_V3 is not set @@ -103,6 +101,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y # CONFIG_ATH79_MACH_TL_WR841N_V8 is not set # CONFIG_ATH79_MACH_TL_WR841N_V9 is not set # CONFIG_ATH79_MACH_TL_WR941ND is not set +# CONFIG_ATH79_MACH_TL_WR940N_V4 is not set # CONFIG_ATH79_MACH_TUBE2H is not set # CONFIG_ATH79_MACH_UBNT is not set # CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default index 7f94781b8c..515266b0f8 100644 --- a/target/linux/ar71xx/nand/config-default +++ b/target/linux/ar71xx/nand/config-default @@ -3,13 +3,10 @@ # CONFIG_ATH79_MACH_ALFA_NX is not set # CONFIG_ATH79_MACH_ALL0258N is not set # CONFIG_ATH79_MACH_ALL0315N is not set -# CONFIG_ATH79_MACH_AP113 is not set # CONFIG_ATH79_MACH_AP121 is not set # CONFIG_ATH79_MACH_AP132 is not set # CONFIG_ATH79_MACH_AP136 is not set # CONFIG_ATH79_MACH_AP147 is not set -# CONFIG_ATH79_MACH_AP81 is not set -# CONFIG_ATH79_MACH_AP83 is not set # CONFIG_ATH79_MACH_AP96 is not set # CONFIG_ATH79_MACH_ARCHER_C7 is not set # CONFIG_ATH79_MACH_AW_NR580 is not set @@ -38,7 +35,7 @@ # CONFIG_ATH79_MACH_OM2P is not set # CONFIG_ATH79_MACH_PB42 is not set # CONFIG_ATH79_MACH_PB44 is not set -# CONFIG_ATH79_MACH_PB92 is not set +# CONFIG_ATH79_MACH_RE450 is not set # CONFIG_ATH79_MACH_RW2458N is not set # CONFIG_ATH79_MACH_TEW_632BRP is not set # CONFIG_ATH79_MACH_TEW_673GRU is not set @@ -54,6 +51,7 @@ # CONFIG_ATH79_MACH_TL_WDR4300 is not set # CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set # CONFIG_ATH79_MACH_TL_WR1043ND is not set +# CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set # CONFIG_ATH79_MACH_TL_WR2543N is not set # CONFIG_ATH79_MACH_TL_WR703N is not set # CONFIG_ATH79_MACH_TL_WR720N_V3 is not set @@ -62,6 +60,7 @@ # CONFIG_ATH79_MACH_TL_WR841N_V1 is not set # CONFIG_ATH79_MACH_TL_WR841N_V8 is not set # CONFIG_ATH79_MACH_TL_WR941ND is not set +# CONFIG_ATH79_MACH_TL_WR940N_V4 is not set # CONFIG_ATH79_MACH_UBNT is not set # CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set # CONFIG_ATH79_MACH_UBNT_XM is not set diff --git a/target/linux/ar71xx/patches-4.4/001-revert_spi_device_tree_support.patch b/target/linux/ar71xx/patches-4.4/001-revert_spi_device_tree_support.patch deleted file mode 100644 index 9821eb7a85..0000000000 --- a/target/linux/ar71xx/patches-4.4/001-revert_spi_device_tree_support.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h -+++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h -@@ -16,4 +16,8 @@ struct ath79_spi_platform_data { - unsigned num_chipselect; - }; - -+struct ath79_spi_controller_data { -+ unsigned gpio; -+}; -+ - #endif /* _ATH79_SPI_PLATFORM_H */ ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -79,8 +79,10 @@ static void ath79_spi_chipselect(struct - } - - if (spi->chip_select) { -+ struct ath79_spi_controller_data *cdata = spi->controller_data; -+ - /* SPI is normally active-low */ -- gpio_set_value(spi->cs_gpio, cs_high); -+ gpio_set_value(cdata->gpio, cs_high); - } else { - if (cs_high) - sp->ioc_base |= AR71XX_SPI_IOC_CS0; -@@ -116,9 +118,10 @@ static void ath79_spi_disable(struct ath - static int ath79_spi_setup_cs(struct spi_device *spi) - { - struct ath79_spi *sp = ath79_spidev_to_sp(spi); -+ struct ath79_spi_controller_data *cdata = spi->controller_data; - int status; - -- if (spi->chip_select && !gpio_is_valid(spi->cs_gpio)) -+ if (spi->chip_select && (!cdata || !gpio_is_valid(cdata->gpio))) - return -EINVAL; - - status = 0; -@@ -131,7 +134,7 @@ static int ath79_spi_setup_cs(struct spi - else - flags |= GPIOF_INIT_HIGH; - -- status = gpio_request_one(spi->cs_gpio, flags, -+ status = gpio_request_one(cdata->gpio, flags, - dev_name(&spi->dev)); - } else { - if (spi->mode & SPI_CS_HIGH) -@@ -148,7 +151,8 @@ static int ath79_spi_setup_cs(struct spi - static void ath79_spi_cleanup_cs(struct spi_device *spi) - { - if (spi->chip_select) { -- gpio_free(spi->cs_gpio); -+ struct ath79_spi_controller_data *cdata = spi->controller_data; -+ gpio_free(cdata->gpio); - } - } - -@@ -220,7 +224,6 @@ static int ath79_spi_probe(struct platfo - } - - sp = spi_master_get_devdata(master); -- master->dev.of_node = pdev->dev.of_node; - platform_set_drvdata(pdev, sp); - - pdata = dev_get_platdata(&pdev->dev); -@@ -300,18 +303,12 @@ static void ath79_spi_shutdown(struct pl - ath79_spi_remove(pdev); - } - --static const struct of_device_id ath79_spi_of_match[] = { -- { .compatible = "qca,ar7100-spi", }, -- { }, --}; -- - static struct platform_driver ath79_spi_driver = { - .probe = ath79_spi_probe, - .remove = ath79_spi_remove, - .shutdown = ath79_spi_shutdown, - .driver = { - .name = DRV_NAME, -- .of_match_table = ath79_spi_of_match, - }, - }; - module_platform_driver(ath79_spi_driver); diff --git a/target/linux/ar71xx/patches-4.4/001-spi-cs-gpio.patch b/target/linux/ar71xx/patches-4.4/001-spi-cs-gpio.patch new file mode 100644 index 0000000000..7a0b669e43 --- /dev/null +++ b/target/linux/ar71xx/patches-4.4/001-spi-cs-gpio.patch @@ -0,0 +1,20 @@ +--- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h ++++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h +@@ -14,6 +14,7 @@ + struct ath79_spi_platform_data { + unsigned bus_num; + unsigned num_chipselect; ++ int *cs_gpios; + }; + + #endif /* _ATH79_SPI_PLATFORM_H */ +--- a/drivers/spi/spi-ath79.c ++++ b/drivers/spi/spi-ath79.c +@@ -231,6 +231,7 @@ static int ath79_spi_probe(struct platfo + if (pdata) { + master->bus_num = pdata->bus_num; + master->num_chipselect = pdata->num_chipselect; ++ master->cs_gpios = pdata->cs_gpios; + } + + sp->bitbang.master = master; diff --git a/target/linux/ar71xx/patches-4.4/104-spi-spi-ath79-support-multiple-internal-chip-select-.patch b/target/linux/ar71xx/patches-4.4/104-spi-spi-ath79-support-multiple-internal-chip-select-.patch new file mode 100644 index 0000000000..3c355cd21c --- /dev/null +++ b/target/linux/ar71xx/patches-4.4/104-spi-spi-ath79-support-multiple-internal-chip-select-.patch @@ -0,0 +1,70 @@ +From: Felix Fietkau +Date: Fri, 9 Dec 2016 20:09:16 +0100 +Subject: [PATCH] spi: spi-ath79: support multiple internal chip select + lines + +Several devices with multiple flash chips use the internal chip select +lines. Don't assume that chip select 1 and above are GPIO lines. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/spi/spi-ath79.c ++++ b/drivers/spi/spi-ath79.c +@@ -78,14 +78,16 @@ static void ath79_spi_chipselect(struct + ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); + } + +- if (spi->chip_select) { ++ if (gpio_is_valid(spi->cs_gpio)) { + /* SPI is normally active-low */ + gpio_set_value(spi->cs_gpio, cs_high); + } else { ++ u32 cs_bit = AR71XX_SPI_IOC_CS(spi->chip_select); ++ + if (cs_high) +- sp->ioc_base |= AR71XX_SPI_IOC_CS0; ++ sp->ioc_base |= cs_bit; + else +- sp->ioc_base &= ~AR71XX_SPI_IOC_CS0; ++ sp->ioc_base &= ~cs_bit; + + ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); + } +@@ -118,11 +120,8 @@ static int ath79_spi_setup_cs(struct spi + struct ath79_spi *sp = ath79_spidev_to_sp(spi); + int status; + +- if (spi->chip_select && !gpio_is_valid(spi->cs_gpio)) +- return -EINVAL; +- + status = 0; +- if (spi->chip_select) { ++ if (gpio_is_valid(spi->cs_gpio)) { + unsigned long flags; + + flags = GPIOF_DIR_OUT; +@@ -134,10 +133,12 @@ static int ath79_spi_setup_cs(struct spi + status = gpio_request_one(spi->cs_gpio, flags, + dev_name(&spi->dev)); + } else { ++ u32 cs_bit = AR71XX_SPI_IOC_CS(spi->chip_select); ++ + if (spi->mode & SPI_CS_HIGH) +- sp->ioc_base &= ~AR71XX_SPI_IOC_CS0; ++ sp->ioc_base &= ~cs_bit; + else +- sp->ioc_base |= AR71XX_SPI_IOC_CS0; ++ sp->ioc_base |= cs_bit; + + ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); + } +@@ -147,7 +148,7 @@ static int ath79_spi_setup_cs(struct spi + + static void ath79_spi_cleanup_cs(struct spi_device *spi) + { +- if (spi->chip_select) { ++ if (gpio_is_valid(spi->cs_gpio)) { + gpio_free(spi->cs_gpio); + } + } diff --git a/target/linux/ar71xx/patches-4.4/105-spi-spi-ath79-use-gpio_set_value_cansleep-for-GPIO-c.patch b/target/linux/ar71xx/patches-4.4/105-spi-spi-ath79-use-gpio_set_value_cansleep-for-GPIO-c.patch new file mode 100644 index 0000000000..11b6a83104 --- /dev/null +++ b/target/linux/ar71xx/patches-4.4/105-spi-spi-ath79-use-gpio_set_value_cansleep-for-GPIO-c.patch @@ -0,0 +1,19 @@ +From: Felix Fietkau +Date: Fri, 9 Dec 2016 20:11:35 +0100 +Subject: [PATCH] spi: spi-ath79: use gpio_set_value_cansleep for GPIO chip + select + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/spi/spi-ath79.c ++++ b/drivers/spi/spi-ath79.c +@@ -80,7 +80,7 @@ static void ath79_spi_chipselect(struct + + if (gpio_is_valid(spi->cs_gpio)) { + /* SPI is normally active-low */ +- gpio_set_value(spi->cs_gpio, cs_high); ++ gpio_set_value_cansleep(spi->cs_gpio, cs_high); + } else { + u32 cs_bit = AR71XX_SPI_IOC_CS(spi->chip_select); + diff --git a/target/linux/ar71xx/patches-4.4/206-spi-ath79-make-chipselect-logic-more-flexible.patch b/target/linux/ar71xx/patches-4.4/206-spi-ath79-make-chipselect-logic-more-flexible.patch deleted file mode 100644 index e0863a4a02..0000000000 --- a/target/linux/ar71xx/patches-4.4/206-spi-ath79-make-chipselect-logic-more-flexible.patch +++ /dev/null @@ -1,199 +0,0 @@ -From 7008284716403237f6bc7d7590b3ed073555bd56 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 11 Jan 2012 22:25:11 +0100 -Subject: [PATCH 34/34] spi/ath79: make chipselect logic more flexible - -Signed-off-by: Gabor Juhos ---- - arch/mips/ath79/mach-pb44.c | 6 ++ - .../include/asm/mach-ath79/ath79_spi_platform.h | 8 ++- - drivers/spi/spi-ath79.c | 67 +++++++++++++------- - 8 files changed, 88 insertions(+), 23 deletions(-) - ---- a/arch/mips/ath79/mach-pb44.c -+++ b/arch/mips/ath79/mach-pb44.c -@@ -87,12 +87,18 @@ static struct gpio_keys_button pb44_gpio - } - }; - -+static struct ath79_spi_controller_data pb44_spi0_data = { -+ .cs_type = ATH79_SPI_CS_TYPE_INTERNAL, -+ .cs_line = 0, -+}; -+ - static struct spi_board_info pb44_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p64", -+ .controller_data = &pb44_spi0_data, - }, - }; - ---- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h -+++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h -@@ -16,8 +16,14 @@ struct ath79_spi_platform_data { - unsigned num_chipselect; - }; - -+enum ath79_spi_cs_type { -+ ATH79_SPI_CS_TYPE_INTERNAL, -+ ATH79_SPI_CS_TYPE_GPIO, -+}; -+ - struct ath79_spi_controller_data { -- unsigned gpio; -+ enum ath79_spi_cs_type cs_type; -+ unsigned cs_line; - }; - - #endif /* _ATH79_SPI_PLATFORM_H */ ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -33,6 +33,8 @@ - #define ATH79_SPI_RRW_DELAY_FACTOR 12000 - #define MHZ (1000 * 1000) - -+#define ATH79_SPI_CS_LINE_MAX 2 -+ - struct ath79_spi { - struct spi_bitbang bitbang; - u32 ioc_base; -@@ -67,6 +69,7 @@ static void ath79_spi_chipselect(struct - { - struct ath79_spi *sp = ath79_spidev_to_sp(spi); - int cs_high = (spi->mode & SPI_CS_HIGH) ? is_active : !is_active; -+ struct ath79_spi_controller_data *cdata = spi->controller_data; - - if (is_active) { - /* set initial clock polarity */ -@@ -78,20 +81,24 @@ static void ath79_spi_chipselect(struct - ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); - } - -- if (spi->chip_select) { -- struct ath79_spi_controller_data *cdata = spi->controller_data; -- -- /* SPI is normally active-low */ -- gpio_set_value(cdata->gpio, cs_high); -- } else { -+ switch (cdata->cs_type) { -+ case ATH79_SPI_CS_TYPE_INTERNAL: - if (cs_high) -- sp->ioc_base |= AR71XX_SPI_IOC_CS0; -+ sp->ioc_base |= AR71XX_SPI_IOC_CS(cdata->cs_line); - else -- sp->ioc_base &= ~AR71XX_SPI_IOC_CS0; -+ sp->ioc_base &= ~AR71XX_SPI_IOC_CS(cdata->cs_line); - - ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); -- } -+ break; - -+ case ATH79_SPI_CS_TYPE_GPIO: -+ /* SPI is normally active-low */ -+ if (gpio_cansleep(cdata->cs_line)) -+ gpio_set_value_cansleep(cdata->cs_line, cs_high); -+ else -+ gpio_set_value(cdata->cs_line, cs_high); -+ break; -+ } - } - - static void ath79_spi_enable(struct ath79_spi *sp) -@@ -119,14 +126,15 @@ static int ath79_spi_setup_cs(struct spi - { - struct ath79_spi *sp = ath79_spidev_to_sp(spi); - struct ath79_spi_controller_data *cdata = spi->controller_data; -+ unsigned long flags; - int status; - -- if (spi->chip_select && (!cdata || !gpio_is_valid(cdata->gpio))) -+ if (!cdata) - return -EINVAL; - - status = 0; -- if (spi->chip_select) { -- unsigned long flags; -+ switch (cdata->cs_type) { -+ case ATH79_SPI_CS_TYPE_GPIO: - - flags = GPIOF_DIR_OUT; - if (spi->mode & SPI_CS_HIGH) -@@ -134,15 +142,21 @@ static int ath79_spi_setup_cs(struct spi - else - flags |= GPIOF_INIT_HIGH; - -- status = gpio_request_one(cdata->gpio, flags, -+ status = gpio_request_one(cdata->cs_line, flags, - dev_name(&spi->dev)); -- } else { -+ break; -+ case ATH79_SPI_CS_TYPE_INTERNAL: -+ if (cdata->cs_line > ATH79_SPI_CS_LINE_MAX) -+ status = -EINVAL; -+ break; -+ - if (spi->mode & SPI_CS_HIGH) - sp->ioc_base &= ~AR71XX_SPI_IOC_CS0; - else - sp->ioc_base |= AR71XX_SPI_IOC_CS0; - - ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); -+ break; - } - - return status; -@@ -150,9 +164,19 @@ static int ath79_spi_setup_cs(struct spi - - static void ath79_spi_cleanup_cs(struct spi_device *spi) - { -- if (spi->chip_select) { -- struct ath79_spi_controller_data *cdata = spi->controller_data; -- gpio_free(cdata->gpio); -+ struct ath79_spi_controller_data *cdata; -+ -+ cdata = spi->controller_data; -+ if (!cdata) -+ return; -+ -+ switch (cdata->cs_type) { -+ case ATH79_SPI_CS_TYPE_INTERNAL: -+ /* nothing to do */ -+ break; -+ case ATH79_SPI_CS_TYPE_GPIO: -+ gpio_free(cdata->cs_line); -+ break; - } - } - -@@ -217,6 +241,10 @@ static int ath79_spi_probe(struct platfo - unsigned long rate; - int ret; - -+ pdata = pdev->dev.platform_data; -+ if (!pdata) -+ return -EINVAL; -+ - master = spi_alloc_master(&pdev->dev, sizeof(*sp)); - if (master == NULL) { - dev_err(&pdev->dev, "failed to allocate spi master\n"); -@@ -226,15 +254,11 @@ static int ath79_spi_probe(struct platfo - sp = spi_master_get_devdata(master); - 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; -- } -+ 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/ar71xx/patches-4.4/431-spi-add-various-flags.patch b/target/linux/ar71xx/patches-4.4/431-spi-add-various-flags.patch deleted file mode 100644 index bf5aff5c7e..0000000000 --- a/target/linux/ar71xx/patches-4.4/431-spi-add-various-flags.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -695,6 +695,8 @@ struct spi_transfer { - unsigned cs_change:1; - unsigned tx_nbits:3; - unsigned rx_nbits:3; -+ unsigned verify:1; -+ unsigned fast_write:1; - #define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */ - #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ - #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ -@@ -740,6 +742,7 @@ struct spi_message { - struct spi_device *spi; - - unsigned is_dma_mapped:1; -+ unsigned fast_read:1; - - /* REVISIT: we might want a flag affecting the behavior of the - * last transfer ... allowing things like "read 16 bit length L" diff --git a/target/linux/ar71xx/patches-4.4/434-spi-ap83_spi_controller.patch b/target/linux/ar71xx/patches-4.4/434-spi-ap83_spi_controller.patch deleted file mode 100644 index a67e8084a2..0000000000 --- a/target/linux/ar71xx/patches-4.4/434-spi-ap83_spi_controller.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -12,6 +12,7 @@ obj-$(CONFIG_SPI_SPIDEV) += spidev.o - # SPI master controller drivers (bus) - obj-$(CONFIG_SPI_ALTERA) += spi-altera.o - obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o -+obj-$(CONFIG_SPI_AP83) += spi-ap83.o - obj-$(CONFIG_SPI_ATH79) += spi-ath79.o - obj-$(CONFIG_SPI_AU1550) += spi-au1550.o - obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -59,6 +59,14 @@ config SPI_ALTERA - help - This is the driver for the Altera SPI Controller. - -+config SPI_AP83 -+ tristate "Atheros AP83 specific SPI Controller" -+ depends on SPI_MASTER && ATH79_MACH_AP83 -+ select SPI_BITBANG -+ help -+ This is a specific SPI controller driver for the Atheros AP83 -+ reference board. -+ - config SPI_ATH79 - tristate "Atheros AR71XX/AR724X/AR913X SPI controller driver" - depends on ATH79 && GPIOLIB diff --git a/target/linux/ar71xx/patches-4.4/435-spi-vsc7385_driver.patch b/target/linux/ar71xx/patches-4.4/435-spi-vsc7385_driver.patch index 78318f8e25..880c088c56 100644 --- a/target/linux/ar71xx/patches-4.4/435-spi-vsc7385_driver.patch +++ b/target/linux/ar71xx/patches-4.4/435-spi-vsc7385_driver.patch @@ -1,6 +1,6 @@ --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig -@@ -728,6 +728,11 @@ config SPI_RB4XX_CPLD +@@ -720,6 +720,11 @@ config SPI_RB4XX_CPLD SPI driver for the Xilinx CPLD chip present on the MikroTik RB4xx boards. @@ -14,7 +14,7 @@ # --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile -@@ -92,6 +92,7 @@ obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi- +@@ -91,6 +91,7 @@ obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi- obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o obj-$(CONFIG_SPI_TXX9) += spi-txx9.o diff --git a/target/linux/ar71xx/patches-4.4/460-m25p80-spi-read-flash-check.patch b/target/linux/ar71xx/patches-4.4/460-m25p80-spi-read-flash-check.patch new file mode 100644 index 0000000000..a34b38398d --- /dev/null +++ b/target/linux/ar71xx/patches-4.4/460-m25p80-spi-read-flash-check.patch @@ -0,0 +1,15 @@ +--- a/drivers/mtd/devices/m25p80.c ++++ b/drivers/mtd/devices/m25p80.c +@@ -149,8 +149,10 @@ static int m25p80_read(struct spi_nor *n + msg.data_nbits = m25p80_rx_nbits(nor); + + ret = spi_flash_read(spi, &msg); +- *retlen = msg.retlen; +- return ret; ++ if (!ret) { ++ *retlen = msg.retlen; ++ return 0; ++ } + } + + spi_message_init(&m); diff --git a/target/linux/ar71xx/patches-4.4/460-spi-bitbang-export-spi_bitbang_bufs.patch b/target/linux/ar71xx/patches-4.4/460-spi-bitbang-export-spi_bitbang_bufs.patch deleted file mode 100644 index 2a8d7af1bb..0000000000 --- a/target/linux/ar71xx/patches-4.4/460-spi-bitbang-export-spi_bitbang_bufs.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/spi/spi-bitbang.c -+++ b/drivers/spi/spi-bitbang.c -@@ -231,13 +231,14 @@ void spi_bitbang_cleanup(struct spi_devi - } - EXPORT_SYMBOL_GPL(spi_bitbang_cleanup); - --static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) -+int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) - { - struct spi_bitbang_cs *cs = spi->controller_state; - unsigned nsecs = cs->nsecs; - - return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t); - } -+EXPORT_SYMBOL_GPL(spi_bitbang_bufs); - - /*----------------------------------------------------------------------*/ - ---- a/include/linux/spi/spi_bitbang.h -+++ b/include/linux/spi/spi_bitbang.h -@@ -39,6 +39,7 @@ extern int spi_bitbang_setup(struct spi_ - extern void spi_bitbang_cleanup(struct spi_device *spi); - extern int spi_bitbang_setup_transfer(struct spi_device *spi, - struct spi_transfer *t); -+extern int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t); - - /* start or stop queue processing */ - extern int spi_bitbang_start(struct spi_bitbang *spi); diff --git a/target/linux/ar71xx/patches-4.4/461-spi-add-type-field-to-spi_transfer.patch b/target/linux/ar71xx/patches-4.4/461-spi-add-type-field-to-spi_transfer.patch deleted file mode 100644 index 6ccb632ecc..0000000000 --- a/target/linux/ar71xx/patches-4.4/461-spi-add-type-field-to-spi_transfer.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -583,6 +583,12 @@ extern struct spi_master *spi_busnum_to_ - - /*---------------------------------------------------------------------------*/ - -+enum spi_transfer_type { -+ SPI_TRANSFER_GENERIC = 0, -+ SPI_TRANSFER_FLASH_READ_CMD, -+ SPI_TRANSFER_FLASH_READ_DATA, -+}; -+ - /* - * I/O INTERFACE between SPI controller and protocol drivers - * -@@ -703,6 +709,7 @@ struct spi_transfer { - u8 bits_per_word; - u16 delay_usecs; - u32 speed_hz; -+ enum spi_transfer_type type; - - struct list_head transfer_list; - }; diff --git a/target/linux/ar71xx/patches-4.4/461-spi-ath79-add-fast-flash-read.patch b/target/linux/ar71xx/patches-4.4/461-spi-ath79-add-fast-flash-read.patch new file mode 100644 index 0000000000..0dc73a8b5b --- /dev/null +++ b/target/linux/ar71xx/patches-4.4/461-spi-ath79-add-fast-flash-read.patch @@ -0,0 +1,54 @@ +--- a/drivers/spi/spi-ath79.c ++++ b/drivers/spi/spi-ath79.c +@@ -102,9 +102,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); +- +- /* TODO: setup speed? */ +- ath79_spi_wr(sp, AR71XX_SPI_REG_CTRL, 0x43); + } + + static void ath79_spi_disable(struct ath79_spi *sp) +@@ -205,6 +202,33 @@ static u32 ath79_spi_txrx_mode0(struct s + return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); + } + ++static int ath79_spi_read_flash_data(struct spi_device *spi, ++ struct spi_flash_read_message *msg) ++{ ++ struct ath79_spi *sp = ath79_spidev_to_sp(spi); ++ ++ if (msg->addr_width > 3) ++ return -EOPNOTSUPP; ++ ++ if (spi->chip_select || gpio_is_valid(spi->cs_gpio)) ++ return -EOPNOTSUPP; ++ ++ /* disable GPIO mode */ ++ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); ++ ++ memcpy_fromio(msg->buf, sp->base + msg->from, msg->len); ++ ++ /* enable GPIO mode */ ++ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO); ++ ++ /* restore IOC register */ ++ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); ++ ++ msg->retlen = msg->len; ++ ++ return 0; ++} ++ + static int ath79_spi_probe(struct platform_device *pdev) + { + struct spi_master *master; +@@ -234,6 +258,7 @@ static int ath79_spi_probe(struct platfo + master->num_chipselect = pdata->num_chipselect; + master->cs_gpios = pdata->cs_gpios; + } ++ master->spi_flash_read = ath79_spi_read_flash_data; + + sp->bitbang.master = master; + sp->bitbang.chipselect = ath79_spi_chipselect; diff --git a/target/linux/ar71xx/patches-4.4/462-mtd-m25p80-set-spi-transfer-type.patch b/target/linux/ar71xx/patches-4.4/462-mtd-m25p80-set-spi-transfer-type.patch deleted file mode 100644 index f949235966..0000000000 --- a/target/linux/ar71xx/patches-4.4/462-mtd-m25p80-set-spi-transfer-type.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -159,10 +159,12 @@ static int m25p80_read(struct spi_nor *n - flash->command[0] = nor->read_opcode; - m25p_addr2cmd(nor, from, flash->command); - -+ t[0].type = SPI_TRANSFER_FLASH_READ_CMD; - t[0].tx_buf = flash->command; - t[0].len = m25p_cmdsz(nor) + dummy; - spi_message_add_tail(&t[0], &m); - -+ t[1].type = SPI_TRANSFER_FLASH_READ_DATA; - t[1].rx_buf = buf; - t[1].rx_nbits = m25p80_rx_nbits(nor); - t[1].len = len; diff --git a/target/linux/ar71xx/patches-4.4/463-spi-ath79-add-fast-flash-read.patch b/target/linux/ar71xx/patches-4.4/463-spi-ath79-add-fast-flash-read.patch deleted file mode 100644 index 408ce653e9..0000000000 --- a/target/linux/ar71xx/patches-4.4/463-spi-ath79-add-fast-flash-read.patch +++ /dev/null @@ -1,185 +0,0 @@ ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -35,6 +35,11 @@ - - #define ATH79_SPI_CS_LINE_MAX 2 - -+enum ath79_spi_state { -+ ATH79_SPI_STATE_WAIT_CMD = 0, -+ ATH79_SPI_STATE_WAIT_READ, -+}; -+ - struct ath79_spi { - struct spi_bitbang bitbang; - u32 ioc_base; -@@ -42,6 +47,11 @@ struct ath79_spi { - void __iomem *base; - struct clk *clk; - unsigned rrw_delay; -+ -+ enum ath79_spi_state state; -+ u32 clk_div; -+ unsigned long read_addr; -+ unsigned long ahb_rate; - }; - - static inline u32 ath79_spi_rr(struct ath79_spi *sp, unsigned reg) -@@ -109,9 +119,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); -- -- /* TODO: setup speed? */ -- ath79_spi_wr(sp, AR71XX_SPI_REG_CTRL, 0x43); - } - - static void ath79_spi_disable(struct ath79_spi *sp) -@@ -232,6 +239,110 @@ static u32 ath79_spi_txrx_mode0(struct s - return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); - } - -+static int ath79_spi_do_read_flash_data(struct spi_device *spi, -+ struct spi_transfer *t) -+{ -+ struct ath79_spi *sp = ath79_spidev_to_sp(spi); -+ -+ /* disable GPIO mode */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); -+ -+ memcpy_fromio(t->rx_buf, sp->base + sp->read_addr, t->len); -+ -+ /* enable GPIO mode */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO); -+ -+ /* restore IOC register */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); -+ -+ return t->len; -+} -+ -+static int ath79_spi_do_read_flash_cmd(struct spi_device *spi, -+ struct spi_transfer *t) -+{ -+ struct ath79_spi *sp = ath79_spidev_to_sp(spi); -+ int len; -+ const u8 *p; -+ -+ sp->read_addr = 0; -+ -+ len = t->len - 1; -+ p = t->tx_buf; -+ -+ while (len--) { -+ p++; -+ sp->read_addr <<= 8; -+ sp->read_addr |= *p; -+ } -+ -+ return t->len; -+} -+ -+static bool ath79_spi_is_read_cmd(struct spi_device *spi, -+ struct spi_transfer *t) -+{ -+ return t->type == SPI_TRANSFER_FLASH_READ_CMD; -+} -+ -+static bool ath79_spi_is_data_read(struct spi_device *spi, -+ struct spi_transfer *t) -+{ -+ return t->type == SPI_TRANSFER_FLASH_READ_DATA; -+} -+ -+static int ath79_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) -+{ -+ struct ath79_spi *sp = ath79_spidev_to_sp(spi); -+ int ret; -+ -+ switch (sp->state) { -+ case ATH79_SPI_STATE_WAIT_CMD: -+ if (ath79_spi_is_read_cmd(spi, t)) { -+ ret = ath79_spi_do_read_flash_cmd(spi, t); -+ sp->state = ATH79_SPI_STATE_WAIT_READ; -+ } else { -+ ret = spi_bitbang_bufs(spi, t); -+ } -+ break; -+ -+ case ATH79_SPI_STATE_WAIT_READ: -+ if (ath79_spi_is_data_read(spi, t)) { -+ ret = ath79_spi_do_read_flash_data(spi, t); -+ } else { -+ dev_warn(&spi->dev, "flash data read expected\n"); -+ ret = -EIO; -+ } -+ sp->state = ATH79_SPI_STATE_WAIT_CMD; -+ break; -+ -+ default: -+ BUG(); -+ } -+ -+ return ret; -+} -+ -+static int ath79_spi_setup_transfer(struct spi_device *spi, -+ struct spi_transfer *t) -+{ -+ struct ath79_spi *sp = ath79_spidev_to_sp(spi); -+ struct ath79_spi_controller_data *cdata; -+ int ret; -+ -+ ret = spi_bitbang_setup_transfer(spi, t); -+ if (ret) -+ return ret; -+ -+ cdata = spi->controller_data; -+ if (cdata->is_flash) -+ sp->bitbang.txrx_bufs = ath79_spi_txrx_bufs; -+ else -+ sp->bitbang.txrx_bufs = spi_bitbang_bufs; -+ -+ return ret; -+} -+ - static int ath79_spi_probe(struct platform_device *pdev) - { - struct spi_master *master; -@@ -254,6 +365,8 @@ static int ath79_spi_probe(struct platfo - sp = spi_master_get_devdata(master); - platform_set_drvdata(pdev, sp); - -+ sp->state = ATH79_SPI_STATE_WAIT_CMD; -+ - master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); - master->setup = ath79_spi_setup; - master->cleanup = ath79_spi_cleanup; -@@ -263,7 +376,7 @@ static int ath79_spi_probe(struct platfo - sp->bitbang.master = master; - sp->bitbang.chipselect = ath79_spi_chipselect; - sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0; -- sp->bitbang.setup_transfer = spi_bitbang_setup_transfer; -+ sp->bitbang.setup_transfer = ath79_spi_setup_transfer; - sp->bitbang.flags = SPI_CS_HIGH; - - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -283,7 +396,8 @@ static int ath79_spi_probe(struct platfo - if (ret) - goto err_put_master; - -- rate = DIV_ROUND_UP(clk_get_rate(sp->clk), MHZ); -+ sp->ahb_rate = clk_get_rate(sp->clk); -+ rate = DIV_ROUND_UP(sp->ahb_rate, MHZ); - if (!rate) { - ret = -EINVAL; - goto err_clk_disable; ---- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h -+++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h -@@ -24,6 +24,7 @@ enum ath79_spi_cs_type { - struct ath79_spi_controller_data { - enum ath79_spi_cs_type cs_type; - unsigned cs_line; -+ bool is_flash; - }; - - #endif /* _ATH79_SPI_PLATFORM_H */ diff --git a/target/linux/ar71xx/patches-4.4/464-spi-ath79-fix-fast-flash-read.patch b/target/linux/ar71xx/patches-4.4/464-spi-ath79-fix-fast-flash-read.patch deleted file mode 100644 index 03483e82a6..0000000000 --- a/target/linux/ar71xx/patches-4.4/464-spi-ath79-fix-fast-flash-read.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -159,6 +159,9 @@ static int m25p80_read(struct spi_nor *n - flash->command[0] = nor->read_opcode; - m25p_addr2cmd(nor, from, flash->command); - -+ if (dummy == 1) -+ t[0].dummy = true; -+ - t[0].type = SPI_TRANSFER_FLASH_READ_CMD; - t[0].tx_buf = flash->command; - t[0].len = m25p_cmdsz(nor) + dummy; ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -268,6 +268,10 @@ static int ath79_spi_do_read_flash_cmd(s - sp->read_addr = 0; - - len = t->len - 1; -+ -+ if (t->dummy) -+ len -= 1; -+ - p = t->tx_buf; - - while (len--) { ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -710,6 +710,7 @@ struct spi_transfer { - u16 delay_usecs; - u32 speed_hz; - enum spi_transfer_type type; -+ bool dummy; - - struct list_head transfer_list; - }; diff --git a/target/linux/ar71xx/patches-4.4/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch b/target/linux/ar71xx/patches-4.4/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch index fdf353c2e6..1f330cf729 100644 --- a/target/linux/ar71xx/patches-4.4/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch +++ b/target/linux/ar71xx/patches-4.4/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch @@ -46,17 +46,6 @@ +void ath79_register_wmac(u8 *cal_data, u8 *mac_addr); #endif /* _ATH79_DEV_WMAC_H */ ---- a/arch/mips/ath79/mach-ap81.c -+++ b/arch/mips/ath79/mach-ap81.c -@@ -92,7 +92,7 @@ static void __init ap81_setup(void) - ap81_gpio_keys); - ath79_register_spi(&ap81_spi_data, ap81_spi_info, - ARRAY_SIZE(ap81_spi_info)); -- ath79_register_wmac(cal_data); -+ ath79_register_wmac(cal_data, NULL); - ath79_register_usb(); - } - --- a/arch/mips/ath79/mach-db120.c +++ b/arch/mips/ath79/mach-db120.c @@ -128,7 +128,7 @@ static void __init db120_setup(void) diff --git a/target/linux/ar71xx/patches-4.4/503-MIPS-ath79-add-flash-acquire-release.patch b/target/linux/ar71xx/patches-4.4/503-MIPS-ath79-add-flash-acquire-release.patch deleted file mode 100644 index 82235ce22c..0000000000 --- a/target/linux/ar71xx/patches-4.4/503-MIPS-ath79-add-flash-acquire-release.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -22,6 +22,7 @@ - #include "common.h" - - static DEFINE_SPINLOCK(ath79_device_reset_lock); -+static DEFINE_MUTEX(ath79_flash_mutex); - - u32 ath79_cpu_freq; - EXPORT_SYMBOL_GPL(ath79_cpu_freq); -@@ -142,3 +143,16 @@ void ath79_device_reset_clear(u32 mask) - spin_unlock_irqrestore(&ath79_device_reset_lock, flags); - } - EXPORT_SYMBOL_GPL(ath79_device_reset_clear); -+ -+void ath79_flash_acquire(void) -+{ -+ mutex_lock(&ath79_flash_mutex); -+} -+EXPORT_SYMBOL_GPL(ath79_flash_acquire); -+ -+void ath79_flash_release(void) -+{ -+ mutex_unlock(&ath79_flash_mutex); -+} -+EXPORT_SYMBOL_GPL(ath79_flash_release); -+ ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -145,4 +145,7 @@ static inline u32 ath79_reset_rr(unsigne - void ath79_device_reset_set(u32 mask); - void ath79_device_reset_clear(u32 mask); - -+void ath79_flash_acquire(void); -+void ath79_flash_release(void); -+ - #endif /* __ASM_MACH_ATH79_H */ diff --git a/target/linux/ar71xx/patches-4.4/504-MIPS-ath79-add-ath79_device_reset_get.patch b/target/linux/ar71xx/patches-4.4/504-MIPS-ath79-add-ath79_device_reset_get.patch index 38d426e014..4f79136abe 100644 --- a/target/linux/ar71xx/patches-4.4/504-MIPS-ath79-add-ath79_device_reset_get.patch +++ b/target/linux/ar71xx/patches-4.4/504-MIPS-ath79-add-ath79_device_reset_get.patch @@ -1,19 +1,19 @@ --- a/arch/mips/include/asm/mach-ath79/ath79.h +++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -144,6 +144,7 @@ static inline u32 ath79_reset_rr(unsigne +@@ -144,5 +144,6 @@ static inline u32 ath79_reset_rr(unsigne void ath79_device_reset_set(u32 mask); void ath79_device_reset_clear(u32 mask); +u32 ath79_device_reset_get(u32 mask); - void ath79_flash_acquire(void); - void ath79_flash_release(void); + #endif /* __ASM_MACH_ATH79_H */ --- a/arch/mips/ath79/common.c +++ b/arch/mips/ath79/common.c -@@ -144,6 +144,32 @@ void ath79_device_reset_clear(u32 mask) +@@ -142,3 +142,29 @@ void ath79_device_reset_clear(u32 mask) + spin_unlock_irqrestore(&ath79_device_reset_lock, flags); } EXPORT_SYMBOL_GPL(ath79_device_reset_clear); - ++ +u32 ath79_device_reset_get(u32 mask) +{ + unsigned long flags; @@ -39,7 +39,3 @@ + return ret; +} +EXPORT_SYMBOL_GPL(ath79_device_reset_get); -+ - void ath79_flash_acquire(void) - { - mutex_lock(&ath79_flash_mutex); diff --git a/target/linux/ar71xx/patches-4.4/604-MIPS-ath79-ap81-fixes.patch b/target/linux/ar71xx/patches-4.4/604-MIPS-ath79-ap81-fixes.patch deleted file mode 100644 index 3112eab6bb..0000000000 --- a/target/linux/ar71xx/patches-4.4/604-MIPS-ath79-ap81-fixes.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- a/arch/mips/ath79/mach-ap81.c -+++ b/arch/mips/ath79/mach-ap81.c -@@ -9,12 +9,16 @@ - * by the Free Software Foundation. - */ - --#include "machtypes.h" --#include "dev-wmac.h" -+#include -+#include -+ -+#include "dev-eth.h" - #include "dev-gpio-buttons.h" - #include "dev-leds-gpio.h" --#include "dev-spi.h" -+#include "dev-m25p80.h" - #include "dev-usb.h" -+#include "dev-wmac.h" -+#include "machtypes.h" - - #define AP81_GPIO_LED_STATUS 1 - #define AP81_GPIO_LED_AOSS 3 -@@ -67,20 +71,6 @@ static struct gpio_keys_button ap81_gpio - } - }; - --static struct spi_board_info ap81_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "m25p64", -- } --}; -- --static struct ath79_spi_platform_data ap81_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, --}; -- - static void __init ap81_setup(void) - { - u8 *cal_data = (u8 *) KSEG1ADDR(AP81_CAL_DATA_ADDR); -@@ -90,10 +80,24 @@ static void __init ap81_setup(void) - ath79_register_gpio_keys_polled(-1, AP81_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap81_gpio_keys), - ap81_gpio_keys); -- ath79_register_spi(&ap81_spi_data, ap81_spi_info, -- ARRAY_SIZE(ap81_spi_info)); -+ ath79_register_m25p80(NULL); - ath79_register_wmac(cal_data, NULL); - ath79_register_usb(); -+ -+ ath79_register_mdio(0, 0x0); -+ -+ ath79_init_mac(ath79_eth0_data.mac_addr, cal_data, 0); -+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; -+ ath79_eth0_data.speed = SPEED_100; -+ ath79_eth0_data.duplex = DUPLEX_FULL; -+ ath79_eth0_data.has_ar8216 = 1; -+ -+ ath79_init_mac(ath79_eth1_data.mac_addr, cal_data, 1); -+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; -+ ath79_eth1_data.phy_mask = 0x10; -+ -+ ath79_register_eth(0); -+ ath79_register_eth(1); - } - - MIPS_MACHINE(ATH79_MACH_AP81, "AP81", "Atheros AP81 reference board", ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -30,9 +30,10 @@ config ATH79_MACH_AP136 - config ATH79_MACH_AP81 - bool "Atheros AP81 reference board" - select SOC_AR913X -+ select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -+ select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - help diff --git a/target/linux/ar71xx/patches-4.4/605-MIPS-ath79-db120-fixes.patch b/target/linux/ar71xx/patches-4.4/605-MIPS-ath79-db120-fixes.patch index 080165a802..1029d43669 100644 --- a/target/linux/ar71xx/patches-4.4/605-MIPS-ath79-db120-fixes.patch +++ b/target/linux/ar71xx/patches-4.4/605-MIPS-ath79-db120-fixes.patch @@ -188,7 +188,7 @@ MIPS_MACHINE(ATH79_MACH_DB120, "DB120", "Atheros DB120 reference board", --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -43,9 +43,12 @@ config ATH79_MACH_AP81 +@@ -42,9 +42,12 @@ config ATH79_MACH_AP81 config ATH79_MACH_DB120 bool "Atheros DB120 reference board" select SOC_AR934X diff --git a/target/linux/ar71xx/patches-4.4/606-MIPS-ath79-pb44-fixes.patch b/target/linux/ar71xx/patches-4.4/606-MIPS-ath79-pb44-fixes.patch index f9ec7753f1..f2943d0836 100644 --- a/target/linux/ar71xx/patches-4.4/606-MIPS-ath79-pb44-fixes.patch +++ b/target/linux/ar71xx/patches-4.4/606-MIPS-ath79-pb44-fixes.patch @@ -50,15 +50,10 @@ #define PB44_GPIO_SW_RESET (PB44_GPIO_EXP_BASE + 6) #define PB44_GPIO_SW_JUMP (PB44_GPIO_EXP_BASE + 8) #define PB44_GPIO_LED_JUMP1 (PB44_GPIO_EXP_BASE + 9) -@@ -92,21 +117,66 @@ static struct ath79_spi_controller_data - .cs_line = 0, +@@ -87,20 +112,59 @@ static struct gpio_keys_button pb44_gpio + } }; -+static struct ath79_spi_controller_data pb44_spi1_data = { -+ .cs_type = ATH79_SPI_CS_TYPE_GPIO, -+ .cs_line = PB44_GPIO_VSC7395_CS, -+}; -+ +static void pb44_vsc7395_reset(void) +{ + ath79_device_reset_set(AR71XX_RESET_GE1_PHY); @@ -93,7 +88,6 @@ .max_speed_hz = 25000000, .modalias = "m25p64", + .platform_data = &pb44_flash_data, - .controller_data = &pb44_spi0_data, }, + { + .bus_num = 0, @@ -101,7 +95,6 @@ + .max_speed_hz = 25000000, + .modalias = "spi-vsc7385", + .platform_data = &pb44_vsc7395_data, -+ .controller_data = &pb44_spi1_data, + } }; @@ -118,7 +111,7 @@ static void __init pb44_init(void) { i2c_register_board_info(0, pb44_i2c_board_info, -@@ -122,6 +192,22 @@ static void __init pb44_init(void) +@@ -116,6 +180,22 @@ static void __init pb44_init(void) ARRAY_SIZE(pb44_spi_info)); ath79_register_usb(); ath79_register_pci(); @@ -143,7 +136,7 @@ MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board", --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -58,6 +58,7 @@ config ATH79_MACH_DB120 +@@ -57,6 +57,7 @@ config ATH79_MACH_DB120 config ATH79_MACH_PB44 bool "Atheros PB44 reference board" select SOC_AR71XX diff --git a/target/linux/ar71xx/patches-4.4/607-MIPS-ath79-ubnt-xm-fixes.patch b/target/linux/ar71xx/patches-4.4/607-MIPS-ath79-ubnt-xm-fixes.patch index 4699c82746..d667215a15 100644 --- a/target/linux/ar71xx/patches-4.4/607-MIPS-ath79-ubnt-xm-fixes.patch +++ b/target/linux/ar71xx/patches-4.4/607-MIPS-ath79-ubnt-xm-fixes.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -70,9 +70,10 @@ config ATH79_MACH_PB44 +@@ -69,9 +69,10 @@ config ATH79_MACH_PB44 config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM (rev 1.0) board" select SOC_AR724X diff --git a/target/linux/ar71xx/patches-4.4/608-MIPS-ath79-ubnt-xm-add-more-boards.patch b/target/linux/ar71xx/patches-4.4/608-MIPS-ath79-ubnt-xm-add-more-boards.patch index b33db4dd0d..536c28d1ca 100644 --- a/target/linux/ar71xx/patches-4.4/608-MIPS-ath79-ubnt-xm-add-more-boards.patch +++ b/target/linux/ar71xx/patches-4.4/608-MIPS-ath79-ubnt-xm-add-more-boards.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -68,12 +68,16 @@ config ATH79_MACH_PB44 +@@ -67,12 +67,16 @@ config ATH79_MACH_PB44 Atheros PB44 reference board. config ATH79_MACH_UBNT_XM diff --git a/target/linux/ar71xx/patches-4.4/615-MIPS-ath79-ap83-remove-mtd-partitions.patch b/target/linux/ar71xx/patches-4.4/615-MIPS-ath79-ap83-remove-mtd-partitions.patch deleted file mode 100644 index 60872ae0a6..0000000000 --- a/target/linux/ar71xx/patches-4.4/615-MIPS-ath79-ap83-remove-mtd-partitions.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/ath79/mach-ap83.c -+++ b/arch/mips/ath79/mach-ap83.c -@@ -42,41 +42,8 @@ - #define AP83_KEYS_POLL_INTERVAL 20 /* msecs */ - #define AP83_KEYS_DEBOUNCE_INTERVAL (3 * AP83_KEYS_POLL_INTERVAL) - --static struct mtd_partition ap83_flash_partitions[] = { -- { -- .name = "u-boot", -- .offset = 0, -- .size = 0x040000, -- .mask_flags = MTD_WRITEABLE, -- }, { -- .name = "u-boot-env", -- .offset = 0x040000, -- .size = 0x020000, -- .mask_flags = MTD_WRITEABLE, -- }, { -- .name = "kernel", -- .offset = 0x060000, -- .size = 0x140000, -- }, { -- .name = "rootfs", -- .offset = 0x1a0000, -- .size = 0x650000, -- }, { -- .name = "art", -- .offset = 0x7f0000, -- .size = 0x010000, -- .mask_flags = MTD_WRITEABLE, -- }, { -- .name = "firmware", -- .offset = 0x060000, -- .size = 0x790000, -- } --}; -- - static struct physmap_flash_data ap83_flash_data = { - .width = 2, -- .parts = ap83_flash_partitions, -- .nr_parts = ARRAY_SIZE(ap83_flash_partitions), - }; - - static struct resource ap83_flash_resources[] = { diff --git a/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch b/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch index 08a684becd..777f7b2c88 100644 --- a/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch +++ b/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch @@ -22,7 +22,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -117,6 +117,10 @@ config SOC_AR934X +@@ -116,6 +116,10 @@ config SOC_AR934X select PCI_AR724X if PCI def_bool n @@ -33,7 +33,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. config SOC_QCA955X select HW_HAS_PCI select PCI_AR724X if PCI -@@ -156,7 +160,7 @@ config ATH79_DEV_USB +@@ -155,7 +159,7 @@ config ATH79_DEV_USB def_bool n config ATH79_DEV_WMAC @@ -147,7 +147,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. else --- a/arch/mips/ath79/common.c +++ b/arch/mips/ath79/common.c -@@ -104,6 +104,8 @@ void ath79_device_reset_set(u32 mask) +@@ -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; @@ -156,7 +156,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. else if (soc_is_qca955x()) reg = QCA955X_RESET_REG_RESET_MODULE; else -@@ -132,6 +134,8 @@ void ath79_device_reset_clear(u32 mask) +@@ -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; diff --git a/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch index 116c2b675f..ed90c40d88 100644 --- a/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch +++ b/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -126,6 +126,12 @@ config SOC_QCA955X +@@ -125,6 +125,12 @@ config SOC_QCA955X select PCI_AR724X if PCI def_bool n @@ -13,7 +13,7 @@ config ATH79_DEV_M25P80 select ATH79_DEV_SPI def_bool n -@@ -160,7 +166,7 @@ config ATH79_DEV_USB +@@ -159,7 +165,7 @@ config ATH79_DEV_USB def_bool n config ATH79_DEV_WMAC @@ -136,7 +136,7 @@ --- a/arch/mips/ath79/common.c +++ b/arch/mips/ath79/common.c -@@ -108,6 +108,8 @@ void ath79_device_reset_set(u32 mask) +@@ -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; @@ -145,7 +145,7 @@ else panic("Reset register not defined for this SOC"); -@@ -138,6 +140,8 @@ void ath79_device_reset_clear(u32 mask) +@@ -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; @@ -154,7 +154,7 @@ else panic("Reset register not defined for this SOC"); -@@ -164,6 +168,8 @@ u32 ath79_device_reset_get(u32 mask) +@@ -163,6 +167,8 @@ u32 ath79_device_reset_get(u32 mask) reg = AR933X_RESET_REG_RESET_MODULE; else if (soc_is_ar934x()) reg = AR934X_RESET_REG_RESET_MODULE; diff --git a/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch b/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch index 8c2e6051cb..add2992186 100644 --- a/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch +++ b/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/common.c +++ b/arch/mips/ath79/common.c -@@ -39,7 +39,7 @@ unsigned int ath79_soc_rev; +@@ -38,7 +38,7 @@ unsigned int ath79_soc_rev; void __iomem *ath79_pll_base; void __iomem *ath79_reset_base; EXPORT_SYMBOL_GPL(ath79_reset_base); diff --git a/target/linux/ar71xx/patches-4.4/700-MIPS-ath79-add-openwrt-Kconfig.patch b/target/linux/ar71xx/patches-4.4/700-MIPS-ath79-add-openwrt-Kconfig.patch index c2bd2ea2b7..23162053ca 100644 --- a/target/linux/ar71xx/patches-4.4/700-MIPS-ath79-add-openwrt-Kconfig.patch +++ b/target/linux/ar71xx/patches-4.4/700-MIPS-ath79-add-openwrt-Kconfig.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -95,6 +95,8 @@ choice +@@ -94,6 +94,8 @@ choice select SOC_AR913X endchoice diff --git a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch index fc006f0f4d..21cad91161 100644 --- a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch @@ -310,7 +310,7 @@ if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c -@@ -1388,7 +1388,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str +@@ -1397,7 +1397,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str dsfield = ipv6_get_dsfield(ipv6h); if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 index c61a4b35b4..1f7cd5ca59 100644 --- a/target/linux/generic/config-3.18 +++ b/target/linux/generic/config-3.18 @@ -790,7 +790,6 @@ CONFIG_CRYPTO_PCRYPT=y # CONFIG_CRYPTO_WP512 is not set # CONFIG_CRYPTO_XCBC is not set # CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_XZ is not set # CONFIG_CRYPTO_ZLIB is not set # CONFIG_CRYSTALHD is not set # CONFIG_CS5535_MFGPT is not set @@ -4217,6 +4216,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=2 # 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 diff --git a/target/linux/generic/config-4.1 b/target/linux/generic/config-4.1 deleted file mode 100644 index 4fae342366..0000000000 --- a/target/linux/generic/config-4.1 +++ /dev/null @@ -1,4821 +0,0 @@ -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 is not set -# 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_MBOX is not set -# 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_XGBE is not set -# CONFIG_AMD_XGBE_PHY is not set -# CONFIG_AMD_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_ALPINE 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_DIGICOLOR 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_CCI400_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_ARM_CRYPTO is not set -CONFIG_ARM_CPU_TOPOLOGY=y -# CONFIG_ARM_CPUIDLE is not set -# CONFIG_ARM_CRYPTO is not set -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_KERNMEM_PERMS is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -# CONFIG_ARM_KPROBES_TEST is not set -# CONFIG_ARM_MHU 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_ASM9260_TIMER is not set -# CONFIG_ASUS_LAPTOP 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_ATH25 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_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_AXP288_ADC is not set -# CONFIG_AXP288_FUEL_GAUGE is not set -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_B44 is not set -# CONFIG_SWCONFIG_B53 is not set -# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 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_RPI 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_GAUGE_LTC2941 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_BCM3384 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_PMEM 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_BMIPS_GENERIC is not set -# CONFIG_BMP085 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_BMP280 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_BREDR is not set -# 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_LE is not set -# CONFIG_BT_MRVL is not set -# CONFIG_BT_RFCOMM is not set -# CONFIG_BUILD_BIN2C is not set -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_SCO=y -# CONFIG_BT_SELFTEST is not set -CONFIG_BUG=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -# 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_CC10001_ADC is not set -# 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 -# 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_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_CLK_QORIQ is not set -# CONFIG_CLKSRC_VERSATILE is not set -# CONFIG_CLOCK_THERMAL is not set -CONFIG_CLS_U32_MARK=y -# CONFIG_CLS_U32_PERF is not set -# CONFIG_CM32181 is not set -# CONFIG_CM3232 is not set -# CONFIG_CM3323 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_CDCE706 is not set -# CONFIG_COMMON_CLK_DEBUG is not set -# CONFIG_COMMON_CLK_PWM 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_COMMON_CLK_XLNX_CLKWZRD 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_CORESIGHT 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_IMGTEC_HASH 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_HASH 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_AEAD is not set -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_RNG 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_XZ 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_PI_LIST is not set -# CONFIG_DEBUG_PINCTRL 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_TIMEKEEPING 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_DEVMEM 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_DIRECT_IO 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_DW_DMAC is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_DWC3_HOST_USB3_LPM_ENABLE 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_GATEWORKS_GW16083 is not set -# CONFIG_GDB_SCRIPTS is not set -# CONFIG_GLOB_SELFTEST is not set -# CONFIG_GS_FPGABOOT 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_ENCRYPTION 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_F2FS_IO_TRACE 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_SM750 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_TFT 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_DAX is not set -# 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_GCOV is not set -# CONFIG_GCOV_KERNEL is not set -# CONFIG_GENEVE 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_GENWQE is not set -# CONFIG_GFS2_FS is not set -# CONFIG_GIGASET_CAPI is not set -# CONFIG_GIGASET_DEBUG is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_GPIOLIB is not set -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ALTERA 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_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GREENASIA_FF 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_BATTERY_STRENGTH is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_BETOP_FF 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_PLANTRONICS 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_HIP04_ETH is not set -# 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_HSU_DMA_PCI 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_IPROC_RNG200 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_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_BCM_IPROC 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_IMG 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_SLAVE 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_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_SSP_SENSORHUB 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_IMGPDC_WDT 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_INIT_FALLBACK is not set -# 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_E3X0_BUTTON 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_REGULATOR_HAPTIC 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_IPVLAN 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=y -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_IGORPLUGUSB 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_JSA1212 is not set -# 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_BCM is not set -# CONFIG_KEYBOARD_CAP1106 is not set -# CONFIG_KEYBOARD_GPIO 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_KEYBOARD_CAP11XX 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_KMX61 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_AMS369FG06 is not set -# CONFIG_LCD_HX8357 is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 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_CLASS_FLASH is not set -# 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_LP8860 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_PM8941_WLED is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR 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_LTR501 is not set -# CONFIG_LTPC is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_LXT_PHY is not set -# CONFIG_LZ4_COMPRESS is not set -# CONFIG_LZ4_DECOMPRESS is not set -# CONFIG_LZ4HC_COMPRESS 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_ASM9260 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_PISTACHIO 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_MEMTEST 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_ATMEL_HLCDC 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_DA9150 is not set -# CONFIG_MFD_DLN2 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_MAX77843 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_MT6397 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_RT5033 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_SKY81452 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_CDMM 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_PLATFORM_DEVICES 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_MMA9551 is not set -# CONFIG_MMA9553 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_IPROC 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_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_TOSHIBA_PCI 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_MPLS is not set -# CONFIG_MS5611 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_HISI504 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_PARTITIONED_MASTER 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_SLRAM is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -# CONFIG_MTD_SPI_NOR is not set -# CONFIG_MTD_SPINAND_MT29F 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_LZMA_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_TRX_FW is not set -# CONFIG_MTD_SPLIT_TPLINK_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_MULTIUSER=y -# CONFIG_MUTEX_SPIN_ON_OWNER is not set -# CONFIG_MV643XX_ETH is not set -# CONFIG_MVMDIO is not set -# CONFIG_MVSW61XX_PHY is not set -# CONFIG_MVSW6171_PHY is not set -# CONFIG_MVSWITCH_PHY is not set -# CONFIG_MWAVE 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_BPF 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_ACT_VLAN 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_MV88E6352 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_FOU_IP_TUNNELS 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_SWITCHDEV 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_ROCKER=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_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_OVERLAY is not set -# CONFIG_OF_SELFTEST is not set -# CONFIG_OF_UNITTEST 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_EXTENSION is not set -# CONFIG_PAGE_OWNER 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_PCIE_IPROC 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_LAYERSCAPE 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_SAMSUNG_USB2 is not set -# CONFIG_PHY_QCOM_DWC3 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_AMD 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_PL320_MBOX is not set -# 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_GPIO is not set -# CONFIG_POWER_RESET_GPIO_RESTART is not set -# CONFIG_POWER_RESET_LTC2952 is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF 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_PROVE_RCU_REPEATEDLY 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_FSL_FTM 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_QORIQ_CPUFREQ 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_EXPEDITE_BOOT is not set -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_KTHREAD_PRIO=0 -# CONFIG_RCU_NOCB_CPU is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY=3 -# 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_DEBUG 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_PWM 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_USERSPACE_CONSUMER 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_ROCKER 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_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_ARMADA38X 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_DS1685_FAMILY 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_AM53C974 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_SCSI_WD719X 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 is not set -# 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_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_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 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_PWM_FAN 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_BCM63XX is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR 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_APBPS2 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_SERIO_SUN4I_PS2 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_SI7020 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_SE6X 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_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SND is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42L51_I2C 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_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_QCOM is not set -# CONFIG_SND_SOC_RT5631 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_STA32X 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_TFA9879 is not set -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI 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_TS3A227E 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_I2C is not set -# CONFIG_SND_SOC_WM8804_SPI 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_SOC_XTFPGA_I2S 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_POD is not set -# CONFIG_SND_USB_PODHD is not set -# CONFIG_SND_USB_TONEPORT 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_USB_VARIAX 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_IMG_SPFI 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_OC_TINY is not set -# CONFIG_SPI_OCTEON 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_SPMI is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -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 is not set -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_SQUASHFS_LZ4 is not set -# 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_HOST_SOC is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -CONFIG_STACKTRACE_SUPPORT=y -# CONFIG_STACKTRACE is not set -# 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_PLATFORM is not set -# CONFIG_STMMAC_PCI 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_LEDS is not set -# CONFIG_SX9500 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_TPM 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_AHB is not set -# CONFIG_TEGRA_HOST1X is not set -# CONFIG_TEHUTI is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_HEXDUMP 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_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_THINKPAD_ACPI 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_CPSW_ALE 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_TOPSTAR_LAPTOP is not set -# 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_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_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_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX 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_SX8654 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_TRACE_ENUM_MAP_FILE 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_ENUM_MAP_FILE 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_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_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_UPROBE_EVENT is not set -# CONFIG_UPROBES 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_BDC_UDC 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_CHAOSKEY 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_QCOM is not set -# CONFIG_USB_DWC3_PCI is not set -# CONFIG_USB_DWC3_KEYSTONE 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_TOUPTEK 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 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_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_LEDS_TRIGGER_USBPORT 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_VDSO 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_OV2659 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_INPUT 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_YAFFS_DISABLE_BAD_BLOCK_MARKING is not set -# CONFIG_YAFFS_FS 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_ZPOOL is not set -CONFIG_ZONE_DMA=y -CONFIG_ZONE_DMA_FLAG=1 -# CONFIG_ZRAM is not set -# CONFIG_ZSMALLOC is not set diff --git a/target/linux/generic/config-4.4 b/target/linux/generic/config-4.4 index 8ce316b426..4711fd7f5b 100644 --- a/target/linux/generic/config-4.4 +++ b/target/linux/generic/config-4.4 @@ -90,6 +90,7 @@ CONFIG_AEABI=y # CONFIG_AF_RXRPC is not set # CONFIG_AGP is not set # CONFIG_AHCI_CEVA is not set +# CONFIG_AHCI_IMX is not set # CONFIG_AHCI_MVEBU is not set # CONFIG_AHCI_QORIQ is not set CONFIG_AIO=y @@ -754,6 +755,7 @@ CONFIG_CRYPTO_BLKCIPHER2=y # CONFIG_CRYPTO_DEV_IMGTEC_HASH is not set # CONFIG_CRYPTO_DEV_MARVELL_CESA is not set # CONFIG_CRYPTO_DEV_MV_CESA is not set +# CONFIG_CRYPTO_DEV_MXS_DCP is not set # CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set # CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set # CONFIG_CRYPTO_DEV_QCE is not set @@ -823,7 +825,6 @@ CONFIG_CRYPTO_PCRYPT=y # CONFIG_CRYPTO_WP512 is not set # CONFIG_CRYPTO_XCBC is not set # CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_XZ is not set # CONFIG_CRYPTO_ZLIB is not set # CONFIG_CS5535_MFGPT is not set # CONFIG_CS89x0 is not set @@ -1094,6 +1095,7 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_FB_NEOMAGIC is not set # CONFIG_FB_NVIDIA is not set # CONFIG_FB_OF is not set +# CONFIG_FB_OMAP2 is not set # CONFIG_FB_OPENCORES is not set # CONFIG_FB_PM2 is not set # CONFIG_FB_PM3 is not set @@ -2854,6 +2856,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PATA_HPT37X is not set # CONFIG_PATA_HPT3X2N is not set # CONFIG_PATA_HPT3X3 is not set +# CONFIG_PATA_IMX is not set # CONFIG_PATA_ISAPNP is not set # CONFIG_PATA_IT8213 is not set # CONFIG_PATA_IT821X is not set @@ -4423,6 +4426,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=2 # 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 diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c index 26cb66ac7f..41a1b3746d 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c @@ -246,6 +246,7 @@ static struct mtd_part_parser uimage_generic_parser = { .type = MTD_PARSER_TYPE_FIRMWARE, }; +#define FW_MAGIC_WNR2000V1 0x32303031 #define FW_MAGIC_WNR2000V3 0x32303033 #define FW_MAGIC_WNR2000V4 0x32303034 #define FW_MAGIC_WNR2200 0x32323030 @@ -265,6 +266,7 @@ static ssize_t uimage_verify_wndr3700(u_char *buf, size_t len) case FW_MAGIC_WNR612V2: case FW_MAGIC_WNR1000V2: case FW_MAGIC_WNR1000V2_VC: + case FW_MAGIC_WNR2000V1: case FW_MAGIC_WNR2000V3: case FW_MAGIC_WNR2200: case FW_MAGIC_WNDR3700: diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 746d8e6c3d..27b062bc47 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -975,7 +975,7 @@ ar8xxx_sw_set_vid(struct switch_dev *dev, const struct switch_attr *attr, { struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev); - if (val->port_vlan >= AR8X16_MAX_PORTS) + if (val->port_vlan >= AR8X16_MAX_VLANS) return -EINVAL; priv->vlan_id[val->port_vlan] = val->value.i; diff --git a/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c b/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c index 7c01461ab9..d15c660638 100644 --- a/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c +++ b/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c @@ -259,7 +259,7 @@ struct mtd_info * yaffs_get_mtd_device(dev_t sdev) return NULL; /* This isn't an mtd device */ /* Check it's NAND */ - if (mtd->type != MTD_NANDFLASH) { + if (mtd->type != MTD_NANDFLASH && mtd->type != MTD_MLCNANDFLASH) { yaffs_trace(YAFFS_TRACE_ALWAYS, "yaffs: MTD device is not NAND it's type %d", mtd->type); diff --git a/target/linux/generic/files/fs/yaffs2/yaffs_vfs.c b/target/linux/generic/files/fs/yaffs2/yaffs_vfs.c index 864a5dc185..73dcc3ca8c 100644 --- a/target/linux/generic/files/fs/yaffs2/yaffs_vfs.c +++ b/target/linux/generic/files/fs/yaffs2/yaffs_vfs.c @@ -2598,7 +2598,7 @@ static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data) } /* Check it's NAND */ - if (mtd->type != MTD_NANDFLASH) { + if (mtd->type != MTD_NANDFLASH && mtd->type != MTD_MLCNANDFLASH) { yaffs_trace(YAFFS_TRACE_ALWAYS, "MTD device is not NAND it's type %d", mtd->type); diff --git a/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch deleted file mode 100644 index 00b0b7cadd..0000000000 --- a/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -1437,6 +1437,13 @@ config CRYPTO_LZ4HC - help - This is the LZ4 high compression mode algorithm. - -+config CRYPTO_XZ -+ tristate "XZ compression algorithm" -+ select CRYPTO_ALGAPI -+ select XZ_DEC -+ help -+ This is the XZ algorithm. Only decompression is supported for now. -+ - comment "Random Number Generation" - - config CRYPTO_ANSI_CPRNG ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -89,6 +89,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc. - obj-$(CONFIG_CRYPTO_LZO) += lzo.o - obj-$(CONFIG_CRYPTO_LZ4) += lz4.o - obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o -+obj-$(CONFIG_CRYPTO_XZ) += xz.o - obj-$(CONFIG_CRYPTO_842) += 842.o - obj-$(CONFIG_CRYPTO_RNG2) += rng.o - obj-$(CONFIG_CRYPTO_RNG2) += krng.o ---- /dev/null -+++ b/crypto/xz.c -@@ -0,0 +1,117 @@ -+/* -+ * Cryptographic API. -+ * -+ * XZ decompression support. -+ * -+ * Copyright (c) 2012 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 -+ -+struct xz_comp_ctx { -+ struct xz_dec *decomp_state; -+ struct xz_buf decomp_buf; -+}; -+ -+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx) -+{ -+ ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0); -+ if (!ctx->decomp_state) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx) -+{ -+ xz_dec_end(ctx->decomp_state); -+} -+ -+static int crypto_xz_init(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ return crypto_xz_decomp_init(ctx); -+} -+ -+static void crypto_xz_exit(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ crypto_xz_decomp_exit(ctx); -+} -+ -+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ return -EOPNOTSUPP; -+} -+ -+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm); -+ struct xz_buf *xz_buf = &dctx->decomp_buf; -+ int ret; -+ -+ memset(xz_buf, '\0', sizeof(struct xz_buf)); -+ -+ xz_buf->in = (u8 *) src; -+ xz_buf->in_pos = 0; -+ xz_buf->in_size = slen; -+ xz_buf->out = (u8 *) dst; -+ xz_buf->out_pos = 0; -+ xz_buf->out_size = *dlen; -+ -+ ret = xz_dec_run(dctx->decomp_state, xz_buf); -+ if (ret != XZ_STREAM_END) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ *dlen = xz_buf->out_pos; -+ ret = 0; -+ -+out: -+ return ret; -+} -+ -+static struct crypto_alg crypto_xz_alg = { -+ .cra_name = "xz", -+ .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, -+ .cra_ctxsize = sizeof(struct xz_comp_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_list = LIST_HEAD_INIT(crypto_xz_alg.cra_list), -+ .cra_init = crypto_xz_init, -+ .cra_exit = crypto_xz_exit, -+ .cra_u = { .compress = { -+ .coa_compress = crypto_xz_compress, -+ .coa_decompress = crypto_xz_decompress } } -+}; -+ -+static int __init crypto_xz_mod_init(void) -+{ -+ return crypto_register_alg(&crypto_xz_alg); -+} -+ -+static void __exit crypto_xz_mod_exit(void) -+{ -+ crypto_unregister_alg(&crypto_xz_alg); -+} -+ -+module_init(crypto_xz_mod_init); -+module_exit(crypto_xz_mod_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Crypto XZ decompression support"); -+MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch deleted file mode 100644 index f85689c586..0000000000 --- a/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- a/fs/ubifs/Kconfig -+++ b/fs/ubifs/Kconfig -@@ -5,8 +5,10 @@ config UBIFS_FS - select CRYPTO if UBIFS_FS_ADVANCED_COMPR - select CRYPTO if UBIFS_FS_LZO - select CRYPTO if UBIFS_FS_ZLIB -+ select CRYPTO if UBIFS_FS_XZ - select CRYPTO_LZO if UBIFS_FS_LZO - select CRYPTO_DEFLATE if UBIFS_FS_ZLIB -+ select CRYPTO_XZ if UBIFS_FS_XZ - depends on MTD_UBI - help - UBIFS is a file system for flash devices which works on top of UBI. -@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB - default y - help - Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. -+ -+config UBIFS_FS_XZ -+ bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR -+ depends on UBIFS_FS -+ default y -+ help -+ XZ compresses better the ZLIB but it is slower.. -+ Say 'Y' if unsure. -+ ---- a/fs/ubifs/compress.c -+++ b/fs/ubifs/compress.c -@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp - }; - #endif - -+#ifdef CONFIG_UBIFS_FS_XZ -+static DEFINE_MUTEX(xz_enc_mutex); -+static DEFINE_MUTEX(xz_dec_mutex); -+ -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .comp_mutex = &xz_enc_mutex, -+ .decomp_mutex = &xz_dec_mutex, -+ .name = "xz", -+ .capi_name = "xz", -+}; -+#else -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .name = "xz", -+}; -+#endif -+ - /* All UBIFS compressors */ - struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; - -@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void) - if (err) - goto out_lzo; - -+ err = compr_init(&xz_compr); -+ if (err) -+ goto out_zlib; -+ - ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr; - return 0; - -+out_zlib: -+ compr_exit(&zlib_compr); - out_lzo: - compr_exit(&lzo_compr); - return err; -@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void) - { - compr_exit(&lzo_compr); - compr_exit(&zlib_compr); -+ compr_exit(&xz_compr); - } ---- a/fs/ubifs/ubifs-media.h -+++ b/fs/ubifs/ubifs-media.h -@@ -332,12 +332,14 @@ enum { - * UBIFS_COMPR_NONE: no compression - * UBIFS_COMPR_LZO: LZO compression - * UBIFS_COMPR_ZLIB: ZLIB compression -+ * UBIFS_COMPR_XZ: XZ compression - * UBIFS_COMPR_TYPES_CNT: count of supported compression types - */ - enum { - UBIFS_COMPR_NONE, - UBIFS_COMPR_LZO, - UBIFS_COMPR_ZLIB, -+ UBIFS_COMPR_XZ, - UBIFS_COMPR_TYPES_CNT, - }; - diff --git a/target/linux/generic/patches-3.18/615-netfilter_add_xt_id_match.patch b/target/linux/generic/patches-3.18/615-netfilter_add_xt_id_match.patch deleted file mode 100644 index e9dae74d8d..0000000000 --- a/target/linux/generic/patches-3.18/615-netfilter_add_xt_id_match.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/include/uapi/linux/netfilter/Kbuild -+++ b/include/uapi/linux/netfilter/Kbuild -@@ -55,6 +55,7 @@ header-y += xt_ecn.h - header-y += xt_esp.h - header-y += xt_hashlimit.h - header-y += xt_helper.h -+header-y += xt_id.h - header-y += xt_ipcomp.h - header-y += xt_iprange.h - header-y += xt_ipvs.h ---- /dev/null -+++ b/include/uapi/linux/netfilter/xt_id.h -@@ -0,0 +1,8 @@ -+#ifndef _XT_ID_H -+#define _XT_ID_H -+ -+struct xt_id_info { -+ u32 id; -+}; -+ -+#endif /* XT_ID_H */ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -1157,6 +1157,13 @@ config NETFILTER_XT_MATCH_IPCOMP - - To compile it as a module, choose M here. If unsure, say N. - -+config NETFILTER_XT_MATCH_ID -+ tristate '"id" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option adds a `id' dummy-match, which allows you to put -+ numeric IDs into your iptables ruleset. -+ - config NETFILTER_XT_MATCH_IPRANGE - tristate '"iprange" address range match support' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -143,6 +143,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += - obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o - obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o - obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o -+obj-$(CONFIG_NETFILTER_XT_MATCH_ID) += xt_id.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPCOMP) += xt_ipcomp.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o ---- /dev/null -+++ b/net/netfilter/xt_id.c -@@ -0,0 +1,45 @@ -+/* -+ * Implements a dummy match to allow attaching IDs to rules -+ * -+ * 2014-08-01 Jo-Philipp Wich -+ */ -+ -+#include -+#include -+#include -+#include -+ -+MODULE_AUTHOR("Jo-Philipp Wich "); -+MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a 32bit ID"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("ipt_id"); -+MODULE_ALIAS("ip6t_id"); -+ -+static bool -+id_mt(const struct sk_buff *skb, struct xt_action_param *par) -+{ -+ /* We always match */ -+ return true; -+} -+ -+static struct xt_match id_mt_reg __read_mostly = { -+ .name = "id", -+ .revision = 0, -+ .family = NFPROTO_UNSPEC, -+ .match = id_mt, -+ .matchsize = sizeof(struct xt_id_info), -+ .me = THIS_MODULE, -+}; -+ -+static int __init id_mt_init(void) -+{ -+ return xt_register_match(&id_mt_reg); -+} -+ -+static void __exit id_mt_exit(void) -+{ -+ xt_unregister_match(&id_mt_reg); -+} -+ -+module_init(id_mt_init); -+module_exit(id_mt_exit); diff --git a/target/linux/generic/patches-3.18/863-gpiommc.patch b/target/linux/generic/patches-3.18/863-gpiommc.patch deleted file mode 100644 index 3ed4d34fc6..0000000000 --- a/target/linux/generic/patches-3.18/863-gpiommc.patch +++ /dev/null @@ -1,844 +0,0 @@ ---- /dev/null -+++ b/drivers/mmc/host/gpiommc.c -@@ -0,0 +1,609 @@ -+/* -+ * Driver an MMC/SD card on a bitbanging GPIO SPI bus. -+ * This module hooks up the mmc_spi and spi_gpio modules and also -+ * provides a configfs interface. -+ * -+ * Copyright 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+#define PFX "gpio-mmc: " -+ -+ -+struct gpiommc_device { -+ struct platform_device *pdev; -+ struct platform_device *spi_pdev; -+ struct spi_board_info boardinfo; -+}; -+ -+ -+MODULE_DESCRIPTION("GPIO based MMC driver"); -+MODULE_AUTHOR("Michael Buesch"); -+MODULE_LICENSE("GPL"); -+ -+ -+static int gpiommc_boardinfo_setup(struct spi_board_info *bi, -+ struct spi_master *master, -+ void *data) -+{ -+ struct gpiommc_device *d = data; -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ /* Bind the SPI master to the MMC-SPI host driver. */ -+ strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias)); -+ -+ bi->max_speed_hz = pdata->max_bus_speed; -+ bi->bus_num = master->bus_num; -+ bi->mode = pdata->mode; -+ -+ return 0; -+} -+ -+static int gpiommc_probe(struct platform_device *pdev) -+{ -+ struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data; -+ struct spi_gpio_platform_data spi_pdata; -+ struct gpiommc_device *d; -+ int err; -+ -+ err = -ENXIO; -+ if (!mmc_pdata) -+ goto error; -+ -+#ifdef CONFIG_MMC_SPI_MODULE -+ err = request_module("mmc_spi"); -+ if (err) { -+ printk(KERN_WARNING PFX -+ "Failed to request mmc_spi module.\n"); -+ } -+#endif /* CONFIG_MMC_SPI_MODULE */ -+ -+ /* Allocate the GPIO-MMC device */ -+ err = -ENOMEM; -+ d = kzalloc(sizeof(*d), GFP_KERNEL); -+ if (!d) -+ goto error; -+ d->pdev = pdev; -+ -+ /* Create the SPI-GPIO device */ -+ d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME, -+ spi_gpio_next_id()); -+ if (!d->spi_pdev) -+ goto err_free_d; -+ -+ memset(&spi_pdata, 0, sizeof(spi_pdata)); -+ spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk; -+ spi_pdata.pin_miso = mmc_pdata->pins.gpio_do; -+ spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di; -+ spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs; -+ spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow; -+ spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay; -+ spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup; -+ spi_pdata.boardinfo_setup_data = d; -+ -+ err = platform_device_add_data(d->spi_pdev, &spi_pdata, -+ sizeof(spi_pdata)); -+ if (err) -+ goto err_free_pdev; -+ err = platform_device_add(d->spi_pdev); -+ if (err) -+ goto err_free_pdata; -+ platform_set_drvdata(pdev, d); -+ -+ printk(KERN_INFO PFX "MMC-Card \"%s\" " -+ "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n", -+ mmc_pdata->name, mmc_pdata->pins.gpio_di, -+ mmc_pdata->pins.gpio_do, -+ mmc_pdata->pins.gpio_clk, -+ mmc_pdata->pins.gpio_cs); -+ -+ return 0; -+ -+err_free_pdata: -+ kfree(d->spi_pdev->dev.platform_data); -+ d->spi_pdev->dev.platform_data = NULL; -+err_free_pdev: -+ platform_device_put(d->spi_pdev); -+err_free_d: -+ kfree(d); -+error: -+ return err; -+} -+ -+static int gpiommc_remove(struct platform_device *pdev) -+{ -+ struct gpiommc_device *d = platform_get_drvdata(pdev); -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ platform_device_unregister(d->spi_pdev); -+ printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n", -+ pdata->name); -+ platform_device_put(d->spi_pdev); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ -+/* A device that was created through configfs */ -+struct gpiommc_configfs_device { -+ struct config_item item; -+ /* The platform device, after registration. */ -+ struct platform_device *pdev; -+ /* The configuration */ -+ struct gpiommc_platform_data pdata; -+}; -+ -+#define GPIO_INVALID -1 -+ -+static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev) -+{ -+ return (dev->pdev != NULL); -+} -+ -+static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item) -+{ -+ return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL; -+} -+ -+static struct configfs_attribute gpiommc_attr_DI = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_in", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_DO = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_out", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CLK = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_clock", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS_activelow = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect_activelow", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spimode = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_mode", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spidelay = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_delay", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_max_bus_speed = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "max_bus_speed", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_register = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "register", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute *gpiommc_config_attrs[] = { -+ &gpiommc_attr_DI, -+ &gpiommc_attr_DO, -+ &gpiommc_attr_CLK, -+ &gpiommc_attr_CS, -+ &gpiommc_attr_CS_activelow, -+ &gpiommc_attr_spimode, -+ &gpiommc_attr_spidelay, -+ &gpiommc_attr_max_bus_speed, -+ &gpiommc_attr_register, -+ NULL, -+}; -+ -+static ssize_t gpiommc_config_attr_show(struct config_item *item, -+ struct configfs_attribute *attr, -+ char *page) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ ssize_t count = 0; -+ unsigned int gpio; -+ int err = 0; -+ -+ if (attr == &gpiommc_attr_DI) { -+ gpio = dev->pdata.pins.gpio_di; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ gpio = dev->pdata.pins.gpio_do; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ gpio = dev->pdata.pins.gpio_clk; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ gpio = dev->pdata.pins.gpio_cs; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.pins.cs_activelow); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.mode); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ !dev->pdata.no_spi_delay); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.max_bus_speed); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_register) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ gpiommc_is_registered(dev)); -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static int gpiommc_do_register(struct gpiommc_configfs_device *dev, -+ const char *name) -+{ -+ int err; -+ -+ if (gpiommc_is_registered(dev)) -+ return 0; -+ -+ if (!gpio_is_valid(dev->pdata.pins.gpio_di) || -+ !gpio_is_valid(dev->pdata.pins.gpio_do) || -+ !gpio_is_valid(dev->pdata.pins.gpio_clk) || -+ !gpio_is_valid(dev->pdata.pins.gpio_cs)) { -+ printk(KERN_ERR PFX -+ "configfs: Invalid GPIO pin number(s)\n"); -+ return -EINVAL; -+ } -+ -+ strlcpy(dev->pdata.name, name, -+ sizeof(dev->pdata.name)); -+ -+ dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, -+ gpiommc_next_id()); -+ if (!dev->pdev) -+ return -ENOMEM; -+ err = platform_device_add_data(dev->pdev, &dev->pdata, -+ sizeof(dev->pdata)); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ err = platform_device_add(dev->pdev); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev) -+{ -+ if (!gpiommc_is_registered(dev)) -+ return; -+ -+ platform_device_unregister(dev->pdev); -+ dev->pdev = NULL; -+} -+ -+static ssize_t gpiommc_config_attr_store(struct config_item *item, -+ struct configfs_attribute *attr, -+ const char *page, size_t count) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ int err = -EINVAL; -+ unsigned long data; -+ -+ if (attr == &gpiommc_attr_register) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data == 1) -+ err = gpiommc_do_register(dev, item->ci_name); -+ if (data == 0) { -+ gpiommc_do_unregister(dev); -+ err = 0; -+ } -+ goto out; -+ } -+ -+ if (gpiommc_is_registered(dev)) { -+ /* The rest of the config parameters can only be set -+ * as long as the device is not registered, yet. */ -+ err = -EBUSY; -+ goto out; -+ } -+ -+ if (attr == &gpiommc_attr_DI) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_di = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_do = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_clk = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_cs = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.pins.cs_activelow = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ switch (data) { -+ case 0: -+ dev->pdata.mode = SPI_MODE_0; -+ break; -+ case 1: -+ dev->pdata.mode = SPI_MODE_1; -+ break; -+ case 2: -+ dev->pdata.mode = SPI_MODE_2; -+ break; -+ case 3: -+ dev->pdata.mode = SPI_MODE_3; -+ break; -+ default: -+ goto out; -+ } -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.no_spi_delay = !data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data > UINT_MAX) -+ goto out; -+ dev->pdata.max_bus_speed = data; -+ err = 0; -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static void gpiommc_config_item_release(struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ kfree(dev); -+} -+ -+static struct configfs_item_operations gpiommc_config_item_ops = { -+ .release = gpiommc_config_item_release, -+ .show_attribute = gpiommc_config_attr_show, -+ .store_attribute = gpiommc_config_attr_store, -+}; -+ -+static struct config_item_type gpiommc_dev_ci_type = { -+ .ct_item_ops = &gpiommc_config_item_ops, -+ .ct_attrs = gpiommc_config_attrs, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct config_item *gpiommc_make_item(struct config_group *group, -+ const char *name) -+{ -+ struct gpiommc_configfs_device *dev; -+ -+ if (strlen(name) > GPIOMMC_MAX_NAMELEN) { -+ printk(KERN_ERR PFX "configfs: device name too long\n"); -+ return NULL; -+ } -+ -+ dev = kzalloc(sizeof(*dev), GFP_KERNEL); -+ if (!dev) -+ return NULL; -+ -+ config_item_init_type_name(&dev->item, name, -+ &gpiommc_dev_ci_type); -+ -+ /* Assign default configuration */ -+ dev->pdata.pins.gpio_di = GPIO_INVALID; -+ dev->pdata.pins.gpio_do = GPIO_INVALID; -+ dev->pdata.pins.gpio_clk = GPIO_INVALID; -+ dev->pdata.pins.gpio_cs = GPIO_INVALID; -+ dev->pdata.pins.cs_activelow = 1; -+ dev->pdata.mode = SPI_MODE_0; -+ dev->pdata.no_spi_delay = 0; -+ dev->pdata.max_bus_speed = 5000000; /* 5 MHz */ -+ -+ return &(dev->item); -+} -+ -+static void gpiommc_drop_item(struct config_group *group, -+ struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ gpiommc_do_unregister(dev); -+ kfree(dev); -+} -+ -+static struct configfs_group_operations gpiommc_ct_group_ops = { -+ .make_item = gpiommc_make_item, -+ .drop_item = gpiommc_drop_item, -+}; -+ -+static struct config_item_type gpiommc_ci_type = { -+ .ct_group_ops = &gpiommc_ct_group_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct configfs_subsystem gpiommc_subsys = { -+ .su_group = { -+ .cg_item = { -+ .ci_namebuf = GPIOMMC_PLATDEV_NAME, -+ .ci_type = &gpiommc_ci_type, -+ }, -+ }, -+ .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex), -+}; -+ -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+static struct platform_driver gpiommc_plat_driver = { -+ .probe = gpiommc_probe, -+ .remove = gpiommc_remove, -+ .driver = { -+ .name = GPIOMMC_PLATDEV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+int gpiommc_next_id(void) -+{ -+ static atomic_t counter = ATOMIC_INIT(-1); -+ -+ return atomic_inc_return(&counter); -+} -+EXPORT_SYMBOL(gpiommc_next_id); -+ -+static int __init gpiommc_modinit(void) -+{ -+ int err; -+ -+ err = platform_driver_register(&gpiommc_plat_driver); -+ if (err) -+ return err; -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ config_group_init(&gpiommc_subsys.su_group); -+ err = configfs_register_subsystem(&gpiommc_subsys); -+ if (err) { -+ platform_driver_unregister(&gpiommc_plat_driver); -+ return err; -+ } -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+ return 0; -+} -+module_init(gpiommc_modinit); -+ -+static void __exit gpiommc_modexit(void) -+{ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ configfs_unregister_subsystem(&gpiommc_subsys); -+#endif -+ platform_driver_unregister(&gpiommc_plat_driver); -+} -+module_exit(gpiommc_modexit); ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -534,6 +534,31 @@ config MMC_SDHI - This provides support for the SDHI SD/SDIO controller found in - SuperH and ARM SH-Mobile SoCs - -+config GPIOMMC -+ tristate "MMC/SD over GPIO-based SPI" -+ depends on MMC && MMC_SPI && SPI_GPIO_OLD -+ help -+ This driver hooks up the mmc_spi and spi_gpio modules so that -+ MMC/SD cards can be used on a GPIO based bus by bitbanging -+ the SPI protocol in software. -+ -+ This driver provides a configfs interface to dynamically create -+ and destroy GPIO-based MMC/SD card devices. It also provides -+ a platform device interface API. -+ See Documentation/gpiommc.txt for details. -+ -+ The module will be called gpiommc. -+ -+ If unsure, say N. -+ -+config GPIOMMC_CONFIGFS -+ bool -+ depends on GPIOMMC && CONFIGFS_FS -+ default y -+ help -+ This option automatically enables configfs support for gpiommc -+ if configfs is available. -+ - config MMC_CB710 - tristate "ENE CB710 MMC/SD Interface support" - depends on PCI ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -40,6 +40,7 @@ tmio_mmc_core-$(subst m,y,$(CONFIG_MMC_S - obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o - obj-$(CONFIG_MMC_CB710) += cb710-mmc.o - obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o -+obj-$(CONFIG_GPIOMMC) += gpiommc.o - obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o - obj-$(CONFIG_MMC_DW) += dw_mmc.o - obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o ---- /dev/null -+++ b/include/linux/mmc/gpiommc.h -@@ -0,0 +1,71 @@ -+/* -+ * Device driver for MMC/SD cards driven over a GPIO bus. -+ * -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL version 2. -+ */ -+#ifndef LINUX_GPIOMMC_H_ -+#define LINUX_GPIOMMC_H_ -+ -+#include -+ -+ -+#define GPIOMMC_MAX_NAMELEN 15 -+#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN) -+ -+/** -+ * struct gpiommc_pins - Hardware pin assignments -+ * -+ * @gpio_di: The GPIO number of the DATA IN pin -+ * @gpio_do: The GPIO number of the DATA OUT pin -+ * @gpio_clk: The GPIO number of the CLOCK pin -+ * @gpio_cs: The GPIO number of the CHIPSELECT pin -+ * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low. -+ */ -+struct gpiommc_pins { -+ unsigned int gpio_di; -+ unsigned int gpio_do; -+ unsigned int gpio_clk; -+ unsigned int gpio_cs; -+ bool cs_activelow; -+}; -+ -+/** -+ * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device. -+ * -+ * @name: The unique name string of the device. -+ * @pins: The hardware pin assignments. -+ * @mode: The hardware mode. This is either SPI_MODE_0, -+ * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation. -+ * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code. -+ * This is not standards compliant, but may be required for some -+ * embedded machines to gain reasonable speed. -+ * @max_bus_speed: The maximum speed of the SPI bus, in Hertz. -+ */ -+struct gpiommc_platform_data { -+ char name[GPIOMMC_MAX_NAMELEN + 1]; -+ struct gpiommc_pins pins; -+ u8 mode; -+ bool no_spi_delay; -+ unsigned int max_bus_speed; -+}; -+ -+/** -+ * GPIOMMC_PLATDEV_NAME - The platform device name string. -+ * -+ * The name string that has to be used for platform_device_alloc -+ * when allocating a gpiommc device. -+ */ -+#define GPIOMMC_PLATDEV_NAME "gpiommc" -+ -+/** -+ * gpiommc_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 gpiommc_next_id(void); -+ -+#endif /* LINUX_GPIOMMC_H_ */ ---- /dev/null -+++ b/Documentation/gpiommc.txt -@@ -0,0 +1,97 @@ -+GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus -+================================================================ -+ -+The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an -+MMC or SD card on GPIO pins. -+ -+Two interfaces for registering a new MMC/SD card device are provided: -+A static platform-device based mechanism and a dynamic configfs based interface. -+ -+ -+Registering devices via platform-device -+======================================= -+ -+The platform-device interface is used for registering MMC/SD devices that are -+part of the hardware platform. This is most useful only for embedded machines -+with MMC/SD devices statically connected to the platform GPIO bus. -+ -+The data structures are declared in . -+ -+To register a new device, define an instance of struct gpiommc_platform_data. -+This structure holds any information about how the device is hooked up to the -+GPIO pins and what hardware modes the device supports. See the docbook-style -+documentation in the header file for more information on the struct fields. -+ -+Then allocate a new instance of a platform device by doing: -+ -+ pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id()); -+ -+This will allocate the platform device data structures and hook it up to the -+gpiommc driver. -+Then add the gpiommc_platform_data to the platform device. -+ -+ err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data)); -+ -+You may free the local instance of struct gpiommc_platform_data now. (So the -+struct may be allocated on the stack, too). -+Now simply register the platform device. -+ -+ err = platform_device_add(pdev); -+ -+Done. The gpiommc probe routine will be invoked now and you should see a kernel -+log message for the added device. -+ -+ -+Registering devices via configfs -+================================ -+ -+MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example -+selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded -+hardware are a common situation. -+So we provide a dynamic interface to conveniently handle adding and removing -+devices from userspace, without the need to recompile the kernel. -+ -+The "gpiommc" subdirectory at the configfs mountpoint is used for handling -+the dynamic configuration. -+ -+To create a new device, it must first be allocated with mkdir. -+The following command will allocate a device named "my_mmc": -+ mkdir /config/gpiommc/my_mmc -+ -+There are several configuration files available in the new -+/config/gpiommc/my_mmc/ directory: -+ -+gpio_data_in = The SPI data-IN GPIO pin number. -+gpio_data_out = The SPI data-OUT GPIO pin number. -+gpio_clock = The SPI Clock GPIO pin number. -+gpio_chipselect = The SPI Chipselect GPIO pin number. -+gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH. -+ If 1, Chipselect is active-LOW. -+spi_mode = The SPI data mode. Can be 0-3. -+spi_delay = Enable all delays in the lowlevel bitbanging. -+max_bus_speed = The maximum SPI bus speed. In Hertz. -+ -+register = Not a configuration parameter. -+ Used to register the configured card -+ with the kernel. -+ -+The device must first get configured and then registered by writing "1" to -+the "register" file. -+The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock" -+and "gpio_chipselect" are essential and _must_ be configured before writing -+"1" to the "register" file. The registration will fail, otherwise. -+ -+The default values for the other parameters are: -+gpio_chipselect_activelow = 1 (CS active-LOW) -+spi_mode = 0 (SPI_MODE_0) -+spi_delay = 1 (enabled) -+max_bus_speed = 5000000 (5 Mhz) -+ -+Configuration values can not be changed after registration. To unregister -+the device, write a "0" to the "register" file. The configuration can be -+changed again after unregistering. -+ -+To completely remove the device, simply rmdir the directory -+(/config/gpiommc/my_mmc in this example). -+There's no need to first unregister the device before removing it. That will -+be done automatically. ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -4289,6 +4289,11 @@ T: git git://linuxtv.org/anttip/media_tr - S: Maintained - F: drivers/media/usb/hackrf/ - -+GPIOMMC DRIVER -+P: Michael Buesch -+M: mb@bu3sch.de -+S: Maintained -+ - HARDWARE MONITORING - M: Jean Delvare - M: Guenter Roeck diff --git a/target/linux/generic/patches-3.18/864-gpiommc_configfs_locking.patch b/target/linux/generic/patches-3.18/864-gpiommc_configfs_locking.patch deleted file mode 100644 index 92815d91f4..0000000000 --- a/target/linux/generic/patches-3.18/864-gpiommc_configfs_locking.patch +++ /dev/null @@ -1,58 +0,0 @@ -The gpiommc configfs context structure needs locking, as configfs -does not lock access between files. - ---- a/drivers/mmc/host/gpiommc.c -+++ b/drivers/mmc/host/gpiommc.c -@@ -144,6 +144,8 @@ struct gpiommc_configfs_device { - struct platform_device *pdev; - /* The configuration */ - struct gpiommc_platform_data pdata; -+ /* Mutex to protect this structure */ -+ struct mutex mutex; - }; - - #define GPIO_INVALID -1 -@@ -234,6 +236,8 @@ static ssize_t gpiommc_config_attr_show( - unsigned int gpio; - int err = 0; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_DI) { - gpio = dev->pdata.pins.gpio_di; - if (gpio == GPIO_INVALID) -@@ -294,6 +298,8 @@ static ssize_t gpiommc_config_attr_show( - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -353,6 +359,8 @@ static ssize_t gpiommc_config_attr_store - int err = -EINVAL; - unsigned long data; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_register) { - err = kstrtoul(page, 10, &data); - if (err) -@@ -478,6 +486,8 @@ static ssize_t gpiommc_config_attr_store - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -514,6 +524,7 @@ static struct config_item *gpiommc_make_ - if (!dev) - return NULL; - -+ mutex_init(&dev->mutex); - config_item_init_type_name(&dev->item, name, - &gpiommc_dev_ci_type); - diff --git a/target/linux/generic/patches-3.18/880-gateworks_system_controller.patch b/target/linux/generic/patches-3.18/880-gateworks_system_controller.patch deleted file mode 100644 index 55e95be706..0000000000 --- a/target/linux/generic/patches-3.18/880-gateworks_system_controller.patch +++ /dev/null @@ -1,339 +0,0 @@ ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -507,6 +507,15 @@ config SENSORS_G762 - This driver can also be built as a module. If so, the module - will be called g762. - -+config SENSORS_GSC -+ tristate "Gateworks System Controller" -+ depends on I2C -+ help -+ If you say yes here you get support for the Gateworks System Controller. -+ -+ This driver can also be built as a module. If so, the module -+ will be called gsc. -+ - config SENSORS_GPIO_FAN - tristate "GPIO fan" - depends on GPIOLIB ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -153,6 +153,7 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l7 - obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o - obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o - obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o -+obj-$(CONFIG_SENSORS_GSC) += gsc.o - - obj-$(CONFIG_PMBUS) += pmbus/ - ---- /dev/null -+++ b/drivers/hwmon/gsc.c -@@ -0,0 +1,308 @@ -+/* -+ * A hwmon driver for the Gateworks System Controller -+ * Copyright (C) 2009 Gateworks Corporation -+ * -+ * Author: Chris Lang -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRV_VERSION "0.2" -+ -+enum chips { gsp }; -+ -+/* AD7418 registers */ -+#define GSP_REG_TEMP_IN 0x00 -+#define GSP_REG_VIN 0x02 -+#define GSP_REG_3P3 0x05 -+#define GSP_REG_BAT 0x08 -+#define GSP_REG_5P0 0x0b -+#define GSP_REG_CORE 0x0e -+#define GSP_REG_CPU1 0x11 -+#define GSP_REG_CPU2 0x14 -+#define GSP_REG_DRAM 0x17 -+#define GSP_REG_EXT_BAT 0x1a -+#define GSP_REG_IO1 0x1d -+#define GSP_REG_IO2 0x20 -+#define GSP_REG_PCIE 0x23 -+#define GSP_REG_CURRENT 0x26 -+#define GSP_FAN_0 0x2C -+#define GSP_FAN_1 0x2E -+#define GSP_FAN_2 0x30 -+#define GSP_FAN_3 0x32 -+#define GSP_FAN_4 0x34 -+#define GSP_FAN_5 0x36 -+ -+struct gsp_sensor_info { -+ const char* name; -+ int reg; -+}; -+ -+static const struct gsp_sensor_info gsp_sensors[] = { -+ {"temp", GSP_REG_TEMP_IN}, -+ {"vin", GSP_REG_VIN}, -+ {"3p3", GSP_REG_3P3}, -+ {"bat", GSP_REG_BAT}, -+ {"5p0", GSP_REG_5P0}, -+ {"core", GSP_REG_CORE}, -+ {"cpu1", GSP_REG_CPU1}, -+ {"cpu2", GSP_REG_CPU2}, -+ {"dram", GSP_REG_DRAM}, -+ {"ext_bat", GSP_REG_EXT_BAT}, -+ {"io1", GSP_REG_IO1}, -+ {"io2", GSP_REG_IO2}, -+ {"pci2", GSP_REG_PCIE}, -+ {"current", GSP_REG_CURRENT}, -+ {"fan_point0", GSP_FAN_0}, -+ {"fan_point1", GSP_FAN_1}, -+ {"fan_point2", GSP_FAN_2}, -+ {"fan_point3", GSP_FAN_3}, -+ {"fan_point4", GSP_FAN_4}, -+ {"fan_point5", GSP_FAN_5}, -+}; -+ -+struct gsp_data { -+ struct device *hwmon_dev; -+ struct attribute_group attrs; -+ enum chips type; -+}; -+ -+static int gsp_probe(struct i2c_client *client, -+ const struct i2c_device_id *id); -+static int gsp_remove(struct i2c_client *client); -+ -+static const struct i2c_device_id gsp_id[] = { -+ { "gsp", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, gsp_id); -+ -+static struct i2c_driver gsp_driver = { -+ .driver = { -+ .name = "gsp", -+ }, -+ .probe = gsp_probe, -+ .remove = gsp_remove, -+ .id_table = gsp_id, -+}; -+ -+/* All registers are word-sized, except for the configuration registers. -+ * AD7418 uses a high-byte first convention. Do NOT use those functions to -+ * access the configuration registers CONF and CONF2, as they are byte-sized. -+ */ -+static inline int gsp_read(struct i2c_client *client, u8 reg) -+{ -+ unsigned int adc = 0; -+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT) -+ { -+ adc |= i2c_smbus_read_byte_data(client, reg); -+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; -+ return adc; -+ } -+ else -+ { -+ adc |= i2c_smbus_read_byte_data(client, reg); -+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; -+ adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16; -+ return adc; -+ } -+} -+ -+static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value) -+{ -+ i2c_smbus_write_byte_data(client, reg, value & 0xff); -+ i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff)); -+ return 1; -+} -+ -+static ssize_t show_adc(struct device *dev, struct device_attribute *devattr, -+ char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct i2c_client *client = to_i2c_client(dev); -+ return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg)); -+} -+ -+static ssize_t show_label(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ -+ return sprintf(buf, "%s\n", gsp_sensors[attr->index].name); -+} -+ -+static ssize_t store_fan(struct device *dev, -+ struct device_attribute *devattr, const char *buf, size_t count) -+{ -+ u16 val; -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct i2c_client *client = to_i2c_client(dev); -+ val = simple_strtoul(buf, NULL, 10); -+ gsp_write(client, gsp_sensors[attr->index].reg, val); -+ return count; -+} -+ -+static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0); -+static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0); -+ -+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1); -+static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1); -+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2); -+static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2); -+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3); -+static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3); -+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4); -+static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4); -+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5); -+static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5); -+static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6); -+static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6); -+static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7); -+static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7); -+static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8); -+static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8); -+static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9); -+static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9); -+static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10); -+static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10); -+static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11); -+static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11); -+static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12); -+static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12); -+static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13); -+static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13); -+ -+static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14); -+static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15); -+static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16); -+static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17); -+static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18); -+static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19); -+ -+static struct attribute *gsp_attributes[] = { -+ &sensor_dev_attr_temp0_input.dev_attr.attr, -+ &sensor_dev_attr_in0_input.dev_attr.attr, -+ &sensor_dev_attr_in1_input.dev_attr.attr, -+ &sensor_dev_attr_in2_input.dev_attr.attr, -+ &sensor_dev_attr_in3_input.dev_attr.attr, -+ &sensor_dev_attr_in4_input.dev_attr.attr, -+ &sensor_dev_attr_in5_input.dev_attr.attr, -+ &sensor_dev_attr_in6_input.dev_attr.attr, -+ &sensor_dev_attr_in7_input.dev_attr.attr, -+ &sensor_dev_attr_in8_input.dev_attr.attr, -+ &sensor_dev_attr_in9_input.dev_attr.attr, -+ &sensor_dev_attr_in10_input.dev_attr.attr, -+ &sensor_dev_attr_in11_input.dev_attr.attr, -+ &sensor_dev_attr_in12_input.dev_attr.attr, -+ -+ &sensor_dev_attr_temp0_label.dev_attr.attr, -+ &sensor_dev_attr_in0_label.dev_attr.attr, -+ &sensor_dev_attr_in1_label.dev_attr.attr, -+ &sensor_dev_attr_in2_label.dev_attr.attr, -+ &sensor_dev_attr_in3_label.dev_attr.attr, -+ &sensor_dev_attr_in4_label.dev_attr.attr, -+ &sensor_dev_attr_in5_label.dev_attr.attr, -+ &sensor_dev_attr_in6_label.dev_attr.attr, -+ &sensor_dev_attr_in7_label.dev_attr.attr, -+ &sensor_dev_attr_in8_label.dev_attr.attr, -+ &sensor_dev_attr_in9_label.dev_attr.attr, -+ &sensor_dev_attr_in10_label.dev_attr.attr, -+ &sensor_dev_attr_in11_label.dev_attr.attr, -+ &sensor_dev_attr_in12_label.dev_attr.attr, -+ -+ &sensor_dev_attr_fan0_point0.dev_attr.attr, -+ &sensor_dev_attr_fan0_point1.dev_attr.attr, -+ &sensor_dev_attr_fan0_point2.dev_attr.attr, -+ &sensor_dev_attr_fan0_point3.dev_attr.attr, -+ &sensor_dev_attr_fan0_point4.dev_attr.attr, -+ &sensor_dev_attr_fan0_point5.dev_attr.attr, -+ NULL -+}; -+ -+ -+static int gsp_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct i2c_adapter *adapter = client->adapter; -+ struct gsp_data *data; -+ int err; -+ -+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | -+ I2C_FUNC_SMBUS_WORD_DATA)) { -+ err = -EOPNOTSUPP; -+ goto exit; -+ } -+ -+ if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) { -+ err = -ENOMEM; -+ goto exit; -+ } -+ -+ i2c_set_clientdata(client, data); -+ -+ data->type = id->driver_data; -+ -+ switch (data->type) { -+ case 0: -+ data->attrs.attrs = gsp_attributes; -+ break; -+ } -+ -+ dev_info(&client->dev, "%s chip found\n", client->name); -+ -+ /* Register sysfs hooks */ -+ if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) -+ goto exit_free; -+ -+ data->hwmon_dev = hwmon_device_register(&client->dev); -+ if (IS_ERR(data->hwmon_dev)) { -+ err = PTR_ERR(data->hwmon_dev); -+ goto exit_remove; -+ } -+ -+ return 0; -+ -+exit_remove: -+ sysfs_remove_group(&client->dev.kobj, &data->attrs); -+exit_free: -+ kfree(data); -+exit: -+ return err; -+} -+ -+static int gsp_remove(struct i2c_client *client) -+{ -+ struct gsp_data *data = i2c_get_clientdata(client); -+ hwmon_device_unregister(data->hwmon_dev); -+ sysfs_remove_group(&client->dev.kobj, &data->attrs); -+ kfree(data); -+ return 0; -+} -+ -+static int __init gsp_init(void) -+{ -+ return i2c_add_driver(&gsp_driver); -+} -+ -+static void __exit gsp_exit(void) -+{ -+ i2c_del_driver(&gsp_driver); -+} -+ -+module_init(gsp_init); -+module_exit(gsp_exit); -+ -+MODULE_AUTHOR("Chris Lang "); -+MODULE_DESCRIPTION("GSC HWMON driver"); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION(DRV_VERSION); -+ diff --git a/target/linux/generic/patches-4.1/010-perf-tools-Create-config.detected-into-OUTPUT-direct.patch b/target/linux/generic/patches-4.1/010-perf-tools-Create-config.detected-into-OUTPUT-direct.patch deleted file mode 100644 index f2c1cdd343..0000000000 --- a/target/linux/generic/patches-4.1/010-perf-tools-Create-config.detected-into-OUTPUT-direct.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Aaro Koskinen -Date: Wed, 1 Jul 2015 14:54:42 +0300 -Subject: [PATCH] perf tools: Create config.detected into OUTPUT directory - -Create config.detected into OUTPUT directory instead of source -directory. - -This fixes parallel builds that share the same source directory. - -Signed-off-by: Aaro Koskinen -Acked-by: Jiri Olsa -Cc: Paul Mackerras -Cc: Peter Zijlstra -Link: http://lkml.kernel.org/r/1435751683-18500-1-git-send-email-aaro.koskinen@nokia.com -Signed-off-by: Arnaldo Carvalho de Melo ---- - ---- a/tools/build/Makefile.build -+++ b/tools/build/Makefile.build -@@ -25,7 +25,7 @@ build-dir := $(srctree)/tools/build - include $(build-dir)/Build.include - - # do not force detected configuration ---include .config-detected -+-include $(OUTPUT).config-detected - - # Init all relevant variables used in build files so - # 1) they have correct type ---- a/tools/perf/Makefile.perf -+++ b/tools/perf/Makefile.perf -@@ -528,7 +528,7 @@ config-clean: - clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean - $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) - $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete -- $(Q)$(RM) .config-detected -+ $(Q)$(RM) $(OUTPUT).config-detected - $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 - $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* - $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean ---- a/tools/perf/config/Makefile -+++ b/tools/perf/config/Makefile -@@ -11,9 +11,9 @@ ifneq ($(obj-perf),) - obj-perf := $(abspath $(obj-perf))/ - endif - --$(shell echo -n > .config-detected) --detected = $(shell echo "$(1)=y" >> .config-detected) --detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected) -+$(shell echo -n > $(OUTPUT).config-detected) -+detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) -+detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) - - CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) - diff --git a/target/linux/generic/patches-4.1/011-perf-tools-Fix-makefile-generation-under-dash.patch b/target/linux/generic/patches-4.1/011-perf-tools-Fix-makefile-generation-under-dash.patch deleted file mode 100644 index 45ea1a04f2..0000000000 --- a/target/linux/generic/patches-4.1/011-perf-tools-Fix-makefile-generation-under-dash.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Sergei Trofimovich -Date: Sun, 19 Jul 2015 10:30:05 +0100 -Subject: [PATCH] perf tools: Fix makefile generation under dash - -Under dash 'echo -n' yields '-n' to stdout. Use printf "" instead. - -Signed-off-by: Sergei Trofimovich -Acked-by: Ingo Molnar -Acked-by: Jiri Olsa -Cc: Adrian Hunter -Cc: Namhyung Kim -Cc: Peter Zijlstra -Link: http://lkml.kernel.org/r/1437298205-29305-1-git-send-email-siarheit@google.com -Signed-off-by: Arnaldo Carvalho de Melo ---- - ---- a/tools/perf/config/Makefile -+++ b/tools/perf/config/Makefile -@@ -11,7 +11,7 @@ ifneq ($(obj-perf),) - obj-perf := $(abspath $(obj-perf))/ - endif - --$(shell echo -n > $(OUTPUT).config-detected) -+$(shell printf "" > $(OUTPUT).config-detected) - detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) - detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) - diff --git a/target/linux/generic/patches-4.1/020-ssb-backport.patch b/target/linux/generic/patches-4.1/020-ssb-backport.patch deleted file mode 100644 index e96480b021..0000000000 --- a/target/linux/generic/patches-4.1/020-ssb-backport.patch +++ /dev/null @@ -1,686 +0,0 @@ ---- a/arch/mips/bcm47xx/Kconfig -+++ b/arch/mips/bcm47xx/Kconfig -@@ -4,6 +4,7 @@ config BCM47XX_SSB - bool "SSB Support for Broadcom BCM47XX" - select SYS_HAS_CPU_BMIPS32_3300 - select SSB -+ select SSB_HOST_SOC - select SSB_DRIVER_MIPS - select SSB_DRIVER_EXTIF - select SSB_EMBEDDED ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -80,6 +80,15 @@ config SSB_SDIOHOST - - If unsure, say N - -+config SSB_HOST_SOC -+ bool "Support for SSB bus on SoC" -+ depends on SSB -+ help -+ Host interface for a SSB directly mapped into memory. This is -+ for some Broadcom SoCs from the BCM47xx and BCM53xx lines. -+ -+ If unsure, say N -+ - config SSB_SILENT - bool "No SSB kernel messages" - depends on SSB && EXPERT ---- a/drivers/ssb/Makefile -+++ b/drivers/ssb/Makefile -@@ -5,8 +5,9 @@ ssb-$(CONFIG_SSB_SPROM) += sprom.o - - # host support - ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o --ssb-$(CONFIG_SSB_PCMCIAHOST) += pcmcia.o -+ssb-$(CONFIG_SSB_PCMCIAHOST) += pcmcia.o bridge_pcmcia_80211.o - ssb-$(CONFIG_SSB_SDIOHOST) += sdio.o -+ssb-$(CONFIG_SSB_HOST_SOC) += host_soc.o - - # built-in drivers - ssb-y += driver_chipcommon.o ---- /dev/null -+++ b/drivers/ssb/bridge_pcmcia_80211.c -@@ -0,0 +1,128 @@ -+/* -+ * Broadcom 43xx PCMCIA-SSB bridge module -+ * -+ * Copyright (c) 2007 Michael Buesch -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "ssb_private.h" -+ -+static const struct pcmcia_device_id ssb_host_pcmcia_tbl[] = { -+ PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), -+ PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476), -+ PCMCIA_DEVICE_NULL, -+}; -+ -+MODULE_DEVICE_TABLE(pcmcia, ssb_host_pcmcia_tbl); -+ -+static int ssb_host_pcmcia_probe(struct pcmcia_device *dev) -+{ -+ struct ssb_bus *ssb; -+ int err = -ENOMEM; -+ int res = 0; -+ -+ ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); -+ if (!ssb) -+ goto out_error; -+ -+ err = -ENODEV; -+ -+ dev->config_flags |= CONF_ENABLE_IRQ; -+ -+ dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | -+ WIN_USE_WAIT; -+ dev->resource[2]->start = 0; -+ dev->resource[2]->end = SSB_CORE_SIZE; -+ res = pcmcia_request_window(dev, dev->resource[2], 250); -+ if (res != 0) -+ goto err_kfree_ssb; -+ -+ res = pcmcia_map_mem_page(dev, dev->resource[2], 0); -+ if (res != 0) -+ goto err_disable; -+ -+ if (!dev->irq) -+ goto err_disable; -+ -+ res = pcmcia_enable_device(dev); -+ if (res != 0) -+ goto err_disable; -+ -+ err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); -+ if (err) -+ goto err_disable; -+ dev->priv = ssb; -+ -+ return 0; -+ -+err_disable: -+ pcmcia_disable_device(dev); -+err_kfree_ssb: -+ kfree(ssb); -+out_error: -+ ssb_err("Initialization failed (%d, %d)\n", res, err); -+ return err; -+} -+ -+static void ssb_host_pcmcia_remove(struct pcmcia_device *dev) -+{ -+ struct ssb_bus *ssb = dev->priv; -+ -+ ssb_bus_unregister(ssb); -+ pcmcia_disable_device(dev); -+ kfree(ssb); -+ dev->priv = NULL; -+} -+ -+#ifdef CONFIG_PM -+static int ssb_host_pcmcia_suspend(struct pcmcia_device *dev) -+{ -+ struct ssb_bus *ssb = dev->priv; -+ -+ return ssb_bus_suspend(ssb); -+} -+ -+static int ssb_host_pcmcia_resume(struct pcmcia_device *dev) -+{ -+ struct ssb_bus *ssb = dev->priv; -+ -+ return ssb_bus_resume(ssb); -+} -+#else /* CONFIG_PM */ -+# define ssb_host_pcmcia_suspend NULL -+# define ssb_host_pcmcia_resume NULL -+#endif /* CONFIG_PM */ -+ -+static struct pcmcia_driver ssb_host_pcmcia_driver = { -+ .owner = THIS_MODULE, -+ .name = "ssb-pcmcia", -+ .id_table = ssb_host_pcmcia_tbl, -+ .probe = ssb_host_pcmcia_probe, -+ .remove = ssb_host_pcmcia_remove, -+ .suspend = ssb_host_pcmcia_suspend, -+ .resume = ssb_host_pcmcia_resume, -+}; -+ -+/* -+ * These are not module init/exit functions! -+ * The module_pcmcia_driver() helper cannot be used here. -+ */ -+int ssb_host_pcmcia_init(void) -+{ -+ return pcmcia_register_driver(&ssb_host_pcmcia_driver); -+} -+ -+void ssb_host_pcmcia_exit(void) -+{ -+ pcmcia_unregister_driver(&ssb_host_pcmcia_driver); -+} ---- /dev/null -+++ b/drivers/ssb/host_soc.c -@@ -0,0 +1,173 @@ -+/* -+ * Sonics Silicon Backplane SoC host related functions. -+ * Subsystem core -+ * -+ * Copyright 2005, Broadcom Corporation -+ * Copyright 2006, 2007, Michael Buesch -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+ -+#include "ssb_private.h" -+ -+static u8 ssb_host_soc_read8(struct ssb_device *dev, u16 offset) -+{ -+ struct ssb_bus *bus = dev->bus; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ return readb(bus->mmio + offset); -+} -+ -+static u16 ssb_host_soc_read16(struct ssb_device *dev, u16 offset) -+{ -+ struct ssb_bus *bus = dev->bus; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ return readw(bus->mmio + offset); -+} -+ -+static u32 ssb_host_soc_read32(struct ssb_device *dev, u16 offset) -+{ -+ struct ssb_bus *bus = dev->bus; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ return readl(bus->mmio + offset); -+} -+ -+#ifdef CONFIG_SSB_BLOCKIO -+static void ssb_host_soc_block_read(struct ssb_device *dev, void *buffer, -+ size_t count, u16 offset, u8 reg_width) -+{ -+ struct ssb_bus *bus = dev->bus; -+ void __iomem *addr; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ addr = bus->mmio + offset; -+ -+ switch (reg_width) { -+ case sizeof(u8): { -+ u8 *buf = buffer; -+ -+ while (count) { -+ *buf = __raw_readb(addr); -+ buf++; -+ count--; -+ } -+ break; -+ } -+ case sizeof(u16): { -+ __le16 *buf = buffer; -+ -+ SSB_WARN_ON(count & 1); -+ while (count) { -+ *buf = (__force __le16)__raw_readw(addr); -+ buf++; -+ count -= 2; -+ } -+ break; -+ } -+ case sizeof(u32): { -+ __le32 *buf = buffer; -+ -+ SSB_WARN_ON(count & 3); -+ while (count) { -+ *buf = (__force __le32)__raw_readl(addr); -+ buf++; -+ count -= 4; -+ } -+ break; -+ } -+ default: -+ SSB_WARN_ON(1); -+ } -+} -+#endif /* CONFIG_SSB_BLOCKIO */ -+ -+static void ssb_host_soc_write8(struct ssb_device *dev, u16 offset, u8 value) -+{ -+ struct ssb_bus *bus = dev->bus; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ writeb(value, bus->mmio + offset); -+} -+ -+static void ssb_host_soc_write16(struct ssb_device *dev, u16 offset, u16 value) -+{ -+ struct ssb_bus *bus = dev->bus; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ writew(value, bus->mmio + offset); -+} -+ -+static void ssb_host_soc_write32(struct ssb_device *dev, u16 offset, u32 value) -+{ -+ struct ssb_bus *bus = dev->bus; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ writel(value, bus->mmio + offset); -+} -+ -+#ifdef CONFIG_SSB_BLOCKIO -+static void ssb_host_soc_block_write(struct ssb_device *dev, const void *buffer, -+ size_t count, u16 offset, u8 reg_width) -+{ -+ struct ssb_bus *bus = dev->bus; -+ void __iomem *addr; -+ -+ offset += dev->core_index * SSB_CORE_SIZE; -+ addr = bus->mmio + offset; -+ -+ switch (reg_width) { -+ case sizeof(u8): { -+ const u8 *buf = buffer; -+ -+ while (count) { -+ __raw_writeb(*buf, addr); -+ buf++; -+ count--; -+ } -+ break; -+ } -+ case sizeof(u16): { -+ const __le16 *buf = buffer; -+ -+ SSB_WARN_ON(count & 1); -+ while (count) { -+ __raw_writew((__force u16)(*buf), addr); -+ buf++; -+ count -= 2; -+ } -+ break; -+ } -+ case sizeof(u32): { -+ const __le32 *buf = buffer; -+ -+ SSB_WARN_ON(count & 3); -+ while (count) { -+ __raw_writel((__force u32)(*buf), addr); -+ buf++; -+ count -= 4; -+ } -+ break; -+ } -+ default: -+ SSB_WARN_ON(1); -+ } -+} -+#endif /* CONFIG_SSB_BLOCKIO */ -+ -+/* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */ -+const struct ssb_bus_ops ssb_host_soc_ops = { -+ .read8 = ssb_host_soc_read8, -+ .read16 = ssb_host_soc_read16, -+ .read32 = ssb_host_soc_read32, -+ .write8 = ssb_host_soc_write8, -+ .write16 = ssb_host_soc_write16, -+ .write32 = ssb_host_soc_write32, -+#ifdef CONFIG_SSB_BLOCKIO -+ .block_read = ssb_host_soc_block_read, -+ .block_write = ssb_host_soc_block_write, -+#endif -+}; ---- a/drivers/ssb/main.c -+++ b/drivers/ssb/main.c -@@ -596,166 +596,6 @@ error: - return err; - } - --static u8 ssb_ssb_read8(struct ssb_device *dev, u16 offset) --{ -- struct ssb_bus *bus = dev->bus; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- return readb(bus->mmio + offset); --} -- --static u16 ssb_ssb_read16(struct ssb_device *dev, u16 offset) --{ -- struct ssb_bus *bus = dev->bus; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- return readw(bus->mmio + offset); --} -- --static u32 ssb_ssb_read32(struct ssb_device *dev, u16 offset) --{ -- struct ssb_bus *bus = dev->bus; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- return readl(bus->mmio + offset); --} -- --#ifdef CONFIG_SSB_BLOCKIO --static void ssb_ssb_block_read(struct ssb_device *dev, void *buffer, -- size_t count, u16 offset, u8 reg_width) --{ -- struct ssb_bus *bus = dev->bus; -- void __iomem *addr; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- addr = bus->mmio + offset; -- -- switch (reg_width) { -- case sizeof(u8): { -- u8 *buf = buffer; -- -- while (count) { -- *buf = __raw_readb(addr); -- buf++; -- count--; -- } -- break; -- } -- case sizeof(u16): { -- __le16 *buf = buffer; -- -- SSB_WARN_ON(count & 1); -- while (count) { -- *buf = (__force __le16)__raw_readw(addr); -- buf++; -- count -= 2; -- } -- break; -- } -- case sizeof(u32): { -- __le32 *buf = buffer; -- -- SSB_WARN_ON(count & 3); -- while (count) { -- *buf = (__force __le32)__raw_readl(addr); -- buf++; -- count -= 4; -- } -- break; -- } -- default: -- SSB_WARN_ON(1); -- } --} --#endif /* CONFIG_SSB_BLOCKIO */ -- --static void ssb_ssb_write8(struct ssb_device *dev, u16 offset, u8 value) --{ -- struct ssb_bus *bus = dev->bus; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- writeb(value, bus->mmio + offset); --} -- --static void ssb_ssb_write16(struct ssb_device *dev, u16 offset, u16 value) --{ -- struct ssb_bus *bus = dev->bus; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- writew(value, bus->mmio + offset); --} -- --static void ssb_ssb_write32(struct ssb_device *dev, u16 offset, u32 value) --{ -- struct ssb_bus *bus = dev->bus; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- writel(value, bus->mmio + offset); --} -- --#ifdef CONFIG_SSB_BLOCKIO --static void ssb_ssb_block_write(struct ssb_device *dev, const void *buffer, -- size_t count, u16 offset, u8 reg_width) --{ -- struct ssb_bus *bus = dev->bus; -- void __iomem *addr; -- -- offset += dev->core_index * SSB_CORE_SIZE; -- addr = bus->mmio + offset; -- -- switch (reg_width) { -- case sizeof(u8): { -- const u8 *buf = buffer; -- -- while (count) { -- __raw_writeb(*buf, addr); -- buf++; -- count--; -- } -- break; -- } -- case sizeof(u16): { -- const __le16 *buf = buffer; -- -- SSB_WARN_ON(count & 1); -- while (count) { -- __raw_writew((__force u16)(*buf), addr); -- buf++; -- count -= 2; -- } -- break; -- } -- case sizeof(u32): { -- const __le32 *buf = buffer; -- -- SSB_WARN_ON(count & 3); -- while (count) { -- __raw_writel((__force u32)(*buf), addr); -- buf++; -- count -= 4; -- } -- break; -- } -- default: -- SSB_WARN_ON(1); -- } --} --#endif /* CONFIG_SSB_BLOCKIO */ -- --/* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */ --static const struct ssb_bus_ops ssb_ssb_ops = { -- .read8 = ssb_ssb_read8, -- .read16 = ssb_ssb_read16, -- .read32 = ssb_ssb_read32, -- .write8 = ssb_ssb_write8, -- .write16 = ssb_ssb_write16, -- .write32 = ssb_ssb_write32, --#ifdef CONFIG_SSB_BLOCKIO -- .block_read = ssb_ssb_block_read, -- .block_write = ssb_ssb_block_write, --#endif --}; -- - static int ssb_fetch_invariants(struct ssb_bus *bus, - ssb_invariants_func_t get_invariants) - { -@@ -876,7 +716,6 @@ int ssb_bus_pcibus_register(struct ssb_b - - return err; - } --EXPORT_SYMBOL(ssb_bus_pcibus_register); - #endif /* CONFIG_SSB_PCIHOST */ - - #ifdef CONFIG_SSB_PCMCIAHOST -@@ -898,7 +737,6 @@ int ssb_bus_pcmciabus_register(struct ss - - return err; - } --EXPORT_SYMBOL(ssb_bus_pcmciabus_register); - #endif /* CONFIG_SSB_PCMCIAHOST */ - - #ifdef CONFIG_SSB_SDIOHOST -@@ -923,13 +761,14 @@ int ssb_bus_sdiobus_register(struct ssb_ - EXPORT_SYMBOL(ssb_bus_sdiobus_register); - #endif /* CONFIG_SSB_PCMCIAHOST */ - -+#ifdef CONFIG_SSB_HOST_SOC - int ssb_bus_ssbbus_register(struct ssb_bus *bus, unsigned long baseaddr, - ssb_invariants_func_t get_invariants) - { - int err; - - bus->bustype = SSB_BUSTYPE_SSB; -- bus->ops = &ssb_ssb_ops; -+ bus->ops = &ssb_host_soc_ops; - - err = ssb_bus_register(bus, get_invariants, baseaddr); - if (!err) { -@@ -939,6 +778,7 @@ int ssb_bus_ssbbus_register(struct ssb_b - - return err; - } -+#endif - - int __ssb_driver_register(struct ssb_driver *drv, struct module *owner) - { -@@ -1465,6 +1305,12 @@ static int __init ssb_modinit(void) - /* don't fail SSB init because of this */ - err = 0; - } -+ err = ssb_host_pcmcia_init(); -+ if (err) { -+ ssb_err("PCMCIA host initialization failed\n"); -+ /* don't fail SSB init because of this */ -+ err = 0; -+ } - err = ssb_gige_init(); - if (err) { - ssb_err("SSB Broadcom Gigabit Ethernet driver initialization failed\n"); -@@ -1482,6 +1328,7 @@ fs_initcall(ssb_modinit); - static void __exit ssb_modexit(void) - { - ssb_gige_exit(); -+ ssb_host_pcmcia_exit(); - b43_pci_ssb_bridge_exit(); - bus_unregister(&ssb_bustype); - } ---- a/drivers/ssb/pcmcia.c -+++ b/drivers/ssb/pcmcia.c -@@ -147,8 +147,7 @@ error: - return err; - } - --int ssb_pcmcia_switch_core(struct ssb_bus *bus, -- struct ssb_device *dev) -+static int ssb_pcmcia_switch_core(struct ssb_bus *bus, struct ssb_device *dev) - { - int err; - ---- a/drivers/ssb/sdio.c -+++ b/drivers/ssb/sdio.c -@@ -200,7 +200,7 @@ out: - } - - /* host must be already claimed */ --int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev) -+static int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev) - { - u8 coreidx = dev->core_index; - u32 sbaddr; ---- a/drivers/ssb/ssb_private.h -+++ b/drivers/ssb/ssb_private.h -@@ -85,8 +85,6 @@ static inline int ssb_pci_init(struct ss - - /* pcmcia.c */ - #ifdef CONFIG_SSB_PCMCIAHOST --extern int ssb_pcmcia_switch_core(struct ssb_bus *bus, -- struct ssb_device *dev); - extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, - u8 coreidx); - extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus, -@@ -96,13 +94,10 @@ extern int ssb_pcmcia_get_invariants(str - extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus); - extern void ssb_pcmcia_exit(struct ssb_bus *bus); - extern int ssb_pcmcia_init(struct ssb_bus *bus); -+extern int ssb_host_pcmcia_init(void); -+extern void ssb_host_pcmcia_exit(void); - extern const struct ssb_bus_ops ssb_pcmcia_ops; - #else /* CONFIG_SSB_PCMCIAHOST */ --static inline int ssb_pcmcia_switch_core(struct ssb_bus *bus, -- struct ssb_device *dev) --{ -- return 0; --} - static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, - u8 coreidx) - { -@@ -124,6 +119,13 @@ static inline int ssb_pcmcia_init(struct - { - return 0; - } -+static inline int ssb_host_pcmcia_init(void) -+{ -+ return 0; -+} -+static inline void ssb_host_pcmcia_exit(void) -+{ -+} - #endif /* CONFIG_SSB_PCMCIAHOST */ - - /* sdio.c */ -@@ -132,9 +134,7 @@ extern int ssb_sdio_get_invariants(struc - struct ssb_init_invariants *iv); - - extern u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset); --extern int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev); - extern int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx); --extern int ssb_sdio_hardware_setup(struct ssb_bus *bus); - extern void ssb_sdio_exit(struct ssb_bus *bus); - extern int ssb_sdio_init(struct ssb_bus *bus); - -@@ -144,19 +144,10 @@ static inline u32 ssb_sdio_scan_read32(s - { - return 0; - } --static inline int ssb_sdio_switch_core(struct ssb_bus *bus, -- struct ssb_device *dev) --{ -- return 0; --} - static inline int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx) - { - return 0; - } --static inline int ssb_sdio_hardware_setup(struct ssb_bus *bus) --{ -- return 0; --} - static inline void ssb_sdio_exit(struct ssb_bus *bus) - { - } -@@ -166,6 +157,13 @@ static inline int ssb_sdio_init(struct s - } - #endif /* CONFIG_SSB_SDIOHOST */ - -+/************************************************** -+ * host_soc.c -+ **************************************************/ -+ -+#ifdef CONFIG_SSB_HOST_SOC -+extern const struct ssb_bus_ops ssb_host_soc_ops; -+#endif - - /* scan.c */ - extern const char *ssb_core_name(u16 coreid); diff --git a/target/linux/generic/patches-4.1/021-ssb_sprom.patch b/target/linux/generic/patches-4.1/021-ssb_sprom.patch deleted file mode 100644 index 52d8080dfe..0000000000 --- a/target/linux/generic/patches-4.1/021-ssb_sprom.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- 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/patches-4.1/022-bcma-from-4.2.patch b/target/linux/generic/patches-4.1/022-bcma-from-4.2.patch deleted file mode 100644 index ba3df18bdd..0000000000 --- a/target/linux/generic/patches-4.1/022-bcma-from-4.2.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- 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/patches-4.1/023-bcma-from-4.4.patch b/target/linux/generic/patches-4.1/023-bcma-from-4.4.patch deleted file mode 100644 index 5704081ee4..0000000000 --- a/target/linux/generic/patches-4.1/023-bcma-from-4.4.patch +++ /dev/null @@ -1,26 +0,0 @@ -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/patches-4.1/024-bcma-from-4.5.patch b/target/linux/generic/patches-4.1/024-bcma-from-4.5.patch deleted file mode 100644 index 171395dcec..0000000000 --- a/target/linux/generic/patches-4.1/024-bcma-from-4.5.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- 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/patches-4.1/025-bcma-from-4.6.patch b/target/linux/generic/patches-4.1/025-bcma-from-4.6.patch deleted file mode 100644 index c0504ac55c..0000000000 --- a/target/linux/generic/patches-4.1/025-bcma-from-4.6.patch +++ /dev/null @@ -1,716 +0,0 @@ ---- 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 -@@ -32,26 +30,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) - { -@@ -272,48 +250,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) { -@@ -337,13 +278,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/patches-4.1/030-backport_bcm47xx_nvram.patch b/target/linux/generic/patches-4.1/030-backport_bcm47xx_nvram.patch deleted file mode 100644 index c20f05e079..0000000000 --- a/target/linux/generic/patches-4.1/030-backport_bcm47xx_nvram.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/include/linux/bcm47xx_nvram.h -+++ b/include/linux/bcm47xx_nvram.h -@@ -10,11 +10,17 @@ - - #include - #include -+#include - --#ifdef CONFIG_BCM47XX -+#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) - { -@@ -29,6 +35,15 @@ static inline int bcm47xx_nvram_gpio_pin - { - 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/patches-4.1/040-fs-overlay-fix-stacking.patch b/target/linux/generic/patches-4.1/040-fs-overlay-fix-stacking.patch deleted file mode 100644 index 6474da6ebf..0000000000 --- a/target/linux/generic/patches-4.1/040-fs-overlay-fix-stacking.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1c8a47df36d72ace8cf78eb6c228aa0f8027d3c2 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Mon, 12 Oct 2015 15:56:20 +0200 -Subject: ovl: fix open in stacked overlay - -If two overlayfs filesystems are stacked on top of each other, then we need -recursion in ovl_d_select_inode(). - -I guess d_backing_inode() is supposed to do that. But currently it doesn't -and that functionality is open coded in vfs_open(). This is now copied -into ovl_d_select_inode() to fix this regression. - -Reported-by: Alban Crequy -Signed-off-by: Miklos Szeredi -Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...") -Cc: David Howells -Cc: # v4.2+ ---- - fs/overlayfs/inode.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/fs/overlayfs/inode.c -+++ b/fs/overlayfs/inode.c -@@ -383,6 +383,9 @@ struct inode *ovl_d_select_inode(struct - ovl_path_upper(dentry, &realpath); - } - -+ if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE) -+ return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags); -+ - return d_backing_inode(realpath.dentry); - } - diff --git a/target/linux/generic/patches-4.1/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch b/target/linux/generic/patches-4.1/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch deleted file mode 100644 index 0b02fff39b..0000000000 --- a/target/linux/generic/patches-4.1/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 1ae92642e5900316011736072b4fa91710840620 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 18 Jun 2016 17:53:45 +0200 -Subject: [PATCH] ubifs: Silence error output if MS_SILENT is set - -This change completes commit -90bea5a3f0 ("UBIFS: respect MS_SILENT mount flag") -which already implements support for MS_SILENT except for that one -error message which is still being displayed despite MS_SILENT being -set. Suppress that error message as well in case MS_SILENT is set. - -Signed-off-by: Daniel Golle -[rw: massaged commit message] -Signed-off-by: Richard Weinberger ---- - fs/ubifs/super.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/fs/ubifs/super.c -+++ b/fs/ubifs/super.c -@@ -2104,8 +2104,9 @@ static struct dentry *ubifs_mount(struct - */ - ubi = open_ubi(name, UBI_READONLY); - if (IS_ERR(ubi)) { -- pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d", -- current->pid, name, (int)PTR_ERR(ubi)); -+ if (!(flags & MS_SILENT)) -+ pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d", -+ current->pid, name, (int)PTR_ERR(ubi)); - return ERR_CAST(ubi); - } - diff --git a/target/linux/generic/patches-4.1/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch b/target/linux/generic/patches-4.1/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch deleted file mode 100644 index cbcacd43eb..0000000000 --- a/target/linux/generic/patches-4.1/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch +++ /dev/null @@ -1,54 +0,0 @@ -From dccbc9197d2c3614f2fd6811874e1d982e4415f0 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Tue, 19 Jul 2016 00:26:55 +0200 -Subject: [PATCH] ubifs: Silence early error messages if MS_SILENT is set - -Probe-mounting a volume too small for UBIFS results in kernel log -polution which might irritate users. -Address this by silencing errors which may happen during boot if the -rootfs is e.g. squashfs (and thus rather small) stored on a UBI volume. - -Signed-off-by: Daniel Golle -Signed-off-by: Richard Weinberger ---- - fs/ubifs/super.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - ---- a/fs/ubifs/super.c -+++ b/fs/ubifs/super.c -@@ -516,19 +516,19 @@ static int init_constants_early(struct u - c->max_write_shift = fls(c->max_write_size) - 1; - - if (c->leb_size < UBIFS_MIN_LEB_SZ) { -- ubifs_err(c, "too small LEBs (%d bytes), min. is %d bytes", -- c->leb_size, UBIFS_MIN_LEB_SZ); -+ ubifs_errc(c, "too small LEBs (%d bytes), min. is %d bytes", -+ c->leb_size, UBIFS_MIN_LEB_SZ); - return -EINVAL; - } - - if (c->leb_cnt < UBIFS_MIN_LEB_CNT) { -- ubifs_err(c, "too few LEBs (%d), min. is %d", -- c->leb_cnt, UBIFS_MIN_LEB_CNT); -+ ubifs_errc(c, "too few LEBs (%d), min. is %d", -+ c->leb_cnt, UBIFS_MIN_LEB_CNT); - return -EINVAL; - } - - if (!is_power_of_2(c->min_io_size)) { -- ubifs_err(c, "bad min. I/O size %d", c->min_io_size); -+ ubifs_errc(c, "bad min. I/O size %d", c->min_io_size); - return -EINVAL; - } - -@@ -539,8 +539,8 @@ static int init_constants_early(struct u - if (c->max_write_size < c->min_io_size || - c->max_write_size % c->min_io_size || - !is_power_of_2(c->max_write_size)) { -- ubifs_err(c, "bad write buffer size %d for %d min. I/O unit", -- c->max_write_size, c->min_io_size); -+ ubifs_errc(c, "bad write buffer size %d for %d min. I/O unit", -+ c->max_write_size, c->min_io_size); - return -EINVAL; - } - diff --git a/target/linux/generic/patches-4.1/050-backport_netfilter_rtcache.patch b/target/linux/generic/patches-4.1/050-backport_netfilter_rtcache.patch deleted file mode 100644 index 9a6d837de8..0000000000 --- a/target/linux/generic/patches-4.1/050-backport_netfilter_rtcache.patch +++ /dev/null @@ -1,505 +0,0 @@ -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,387 @@ -+/* 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 nf_hook_state *state) -+{ -+ 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 (state->in->ifindex != iif) { -+ pr_debug("ct %p, iif %d, cached iif %d, skip cached entry\n", -+ ct, iif, state->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(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 nf_hook_state *state) -+{ -+ 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, state->in->ifindex); -+ if (likely(state->in->ifindex == iif)) -+ return NF_ACCEPT; -+ -+ nf_conn_rtcache_dst_set(ops->pf, rtc, skb_dst(skb), dir, state->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/patches-4.1/060-mips_decompressor_memmove.patch b/target/linux/generic/patches-4.1/060-mips_decompressor_memmove.patch deleted file mode 100644 index d215b80ab2..0000000000 --- a/target/linux/generic/patches-4.1/060-mips_decompressor_memmove.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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/patches-4.1/072-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/patches-4.1/072-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch deleted file mode 100644 index 512df943e9..0000000000 --- a/target/linux/generic/patches-4.1/072-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Mon, 13 Apr 2015 15:54:04 +0200 -Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4 - -Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0 - -Signed-off-by: Felix Fietkau ---- - ---- 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/patches-4.1/072-14-bgmac-reset-all-4-GMAC-cores-on-init.patch b/target/linux/generic/patches-4.1/072-14-bgmac-reset-all-4-GMAC-cores-on-init.patch deleted file mode 100644 index ddba71d430..0000000000 --- a/target/linux/generic/patches-4.1/072-14-bgmac-reset-all-4-GMAC-cores-on-init.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Felix Fietkau -Date: Mon, 13 Apr 2015 15:56:26 +0200 -Subject: [PATCH] bgmac: reset all 4 GMAC cores on init - -On a BCM4709 based device, I found that GMAC cores may be enabled at -probe time, but only become usable after a full reset. -Disable cores before re-enabling them to ensure that they are properly -reset. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1623,8 +1623,11 @@ static int bgmac_probe(struct bcma_devic - ns_core = bcma_find_core_unit(core->bus, - BCMA_CORE_MAC_GBIT, - ns_gmac); -- if (ns_core && !bcma_core_is_enabled(ns_core)) -- bcma_core_enable(ns_core, 0); -+ if (!ns_core) -+ continue; -+ -+ bcma_core_disable(ns_core, 0); -+ bcma_core_enable(ns_core, 0); - } - } - diff --git a/target/linux/generic/patches-4.1/080-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch b/target/linux/generic/patches-4.1/080-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch deleted file mode 100644 index 629731c2c2..0000000000 --- a/target/linux/generic/patches-4.1/080-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch +++ /dev/null @@ -1,101 +0,0 @@ -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 -@@ -587,20 +587,22 @@ int ip6_fragment(struct sock *sk, struct - } - 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? */ -@@ -617,8 +619,6 @@ int ip6_fragment(struct sock *sk, struct - - err = 0; - offset = 0; -- frag = skb_shinfo(skb)->frag_list; -- skb_frag_list_init(skb); - /* BUILD HEADER */ - - *prevhdr = NEXTHDR_FRAGMENT; -@@ -626,8 +626,11 @@ int ip6_fragment(struct sock *sk, struct - 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)); -@@ -725,7 +728,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/patches-4.1/081-solos-pci-Increase-headroom-on-received-packets.patch b/target/linux/generic/patches-4.1/081-solos-pci-Increase-headroom-on-received-packets.patch deleted file mode 100644 index 605f57a6ce..0000000000 --- a/target/linux/generic/patches-4.1/081-solos-pci-Increase-headroom-on-received-packets.patch +++ /dev/null @@ -1,54 +0,0 @@ -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 = - dma_map_single(&card->dev->dev, skb->data, diff --git a/target/linux/generic/patches-4.1/082-usb-core-Introduce-a-USB-port-LED-trigger.patch b/target/linux/generic/patches-4.1/082-usb-core-Introduce-a-USB-port-LED-trigger.patch deleted file mode 100644 index ade7f9c8bb..0000000000 --- a/target/linux/generic/patches-4.1/082-usb-core-Introduce-a-USB-port-LED-trigger.patch +++ /dev/null @@ -1,464 +0,0 @@ -From 0f247626cbbfa2010d2b86fdee652605e084e248 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 16 Sep 2016 16:13:48 +0200 -Subject: [PATCH] usb: core: Introduce a USB port LED trigger -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This commit adds a new trigger responsible for turning on LED when USB -device gets connected to the selected USB port. This can can useful for -various home routers that have USB port(s) and a proper LED telling user -a device is connected. - -The trigger gets its documentation file but basically it just requires -enabling it and selecting USB ports (e.g. echo 1 > ports/usb1-1). - -There was a long discussion on design of this driver. Its current state -is a result of picking them most adjustable solution as others couldn't -handle all cases. - -1) It wasn't possible for the driver to register separated trigger for - each USB port. Some physical USB ports are handled by more than one - controller and so by more than one USB port. E.g. USB 2.0 physical - port may be handled by OHCI's port and EHCI's port. - It's also not possible to assign more than 1 trigger to a single LED - and implementing such feature would be tricky due to syncing triggers - and sysfs conflicts with old triggers. - -2) Another idea was to register trigger per USB hub. This wouldn't allow - handling devices with multiple USB LEDs and controllers (hubs) - controlling more than 1 physical port. It's common for hubs to have - few ports and each may have its own LED. - -This final trigger is highly flexible. It allows selecting any USB ports -for any LED. It was also modified (comparing to the initial version) to -allow choosing ports rather than having user /guess/ proper names. It -was successfully tested on SmartRG SR400ac which has 3 USB LEDs, -2 physical ports and 3 controllers. - -It was noted USB subsystem already has usb-gadget and usb-host triggers -but they are pretty trivial ones. They indicate activity only and can't -have ports specified. - -In future it may be good idea to consider adding activity support to -usbport as well. This should allow switching to this more generic driver -and maybe marking old ones as obsolete. -This can be implemented with another sysfs file for setting mode. The -default mode wouldn't change so there won't be ABI breakage and so such -feature can be safely implemented later. - -There was also an idea of supporting other devices (PCI, SDIO, etc.) but -as this driver already contains some USB specific code (and will get -more) these should be probably separated drivers (triggers). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Greg Kroah-Hartman ---- - .../ABI/testing/sysfs-class-led-trigger-usbport | 12 + - Documentation/leds/ledtrig-usbport.txt | 41 +++ - drivers/usb/core/Kconfig | 8 + - drivers/usb/core/Makefile | 2 + - drivers/usb/core/ledtrig-usbport.c | 314 +++++++++++++++++++++ - 5 files changed, 377 insertions(+) - create mode 100644 Documentation/ABI/testing/sysfs-class-led-trigger-usbport - create mode 100644 Documentation/leds/ledtrig-usbport.txt - create mode 100644 drivers/usb/core/ledtrig-usbport.c - ---- /dev/null -+++ b/Documentation/ABI/testing/sysfs-class-led-trigger-usbport -@@ -0,0 +1,12 @@ -+What: /sys/class/leds//ports/ -+Date: September 2016 -+KernelVersion: 4.9 -+Contact: linux-leds@vger.kernel.org -+ linux-usb@vger.kernel.org -+Description: -+ Every dir entry represents a single USB port that can be -+ selected for the USB port trigger. Selecting ports makes trigger -+ observing them for any connected devices and lighting on LED if -+ there are any. -+ Echoing "1" value selects USB port. Echoing "0" unselects it. -+ Current state can be also read. ---- /dev/null -+++ b/Documentation/leds/ledtrig-usbport.txt -@@ -0,0 +1,41 @@ -+USB port LED trigger -+==================== -+ -+This LED trigger can be used for signalling to the user a presence of USB device -+in a given port. It simply turns on LED when device appears and turns it off -+when it disappears. -+ -+It requires selecting USB ports that should be observed. All available ones are -+listed as separated entries in a "ports" subdirectory. Selecting is handled by -+echoing "1" to a chosen port. -+ -+Please note that this trigger allows selecting multiple USB ports for a single -+LED. This can be useful in two cases: -+ -+1) Device with single USB LED and few physical ports -+ -+In such a case LED will be turned on as long as there is at least one connected -+USB device. -+ -+2) Device with a physical port handled by few controllers -+ -+Some devices may have one controller per PHY standard. E.g. USB 3.0 physical -+port may be handled by ohci-platform, ehci-platform and xhci-hcd. If there is -+only one LED user will most likely want to assign ports from all 3 hubs. -+ -+ -+This trigger can be activated from user space on led class devices as shown -+below: -+ -+ echo usbport > trigger -+ -+This adds sysfs attributes to the LED that are documented in: -+Documentation/ABI/testing/sysfs-class-led-trigger-usbport -+ -+Example use-case: -+ -+ echo usbport > trigger -+ echo 1 > ports/usb1-port1 -+ echo 1 > ports/usb2-port1 -+ cat ports/usb1-port1 -+ echo 0 > ports/usb1-port1 ---- a/drivers/usb/core/Kconfig -+++ b/drivers/usb/core/Kconfig -@@ -84,3 +84,10 @@ config USB_OTG_FSM - Implements OTG Finite State Machine as specified in On-The-Go - and Embedded Host Supplement to the USB Revision 2.0 Specification. - -+config USB_LEDS_TRIGGER_USBPORT -+ tristate "USB port LED trigger" -+ depends on USB && LEDS_TRIGGERS -+ help -+ This driver allows LEDs to be controlled by USB events. Enabling this -+ trigger allows specifying list of USB ports that should turn on LED -+ when some USB device gets connected. ---- a/drivers/usb/core/Makefile -+++ b/drivers/usb/core/Makefile -@@ -11,3 +11,5 @@ usbcore-$(CONFIG_PCI) += hcd-pci.o - usbcore-$(CONFIG_ACPI) += usb-acpi.o - - obj-$(CONFIG_USB) += usbcore.o -+ -+obj-$(CONFIG_USB_LEDS_TRIGGER_USBPORT) += ledtrig-usbport.o ---- /dev/null -+++ b/drivers/usb/core/ledtrig-usbport.c -@@ -0,0 +1,314 @@ -+/* -+ * USB port LED trigger -+ * -+ * Copyright (C) 2016 Rafał Miłecki -+ * -+ * 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 -+ -+struct usbport_trig_data { -+ struct led_classdev *led_cdev; -+ struct list_head ports; -+ struct notifier_block nb; -+ int count; /* Amount of connected matching devices */ -+}; -+ -+struct usbport_trig_port { -+ struct usbport_trig_data *data; -+ struct usb_device *hub; -+ int portnum; -+ char *port_name; -+ bool observed; -+ struct device_attribute attr; -+ struct list_head list; -+}; -+ -+/*************************************** -+ * Helpers -+ ***************************************/ -+ -+/** -+ * usbport_trig_usb_dev_observed - Check if dev is connected to observed port -+ */ -+static bool usbport_trig_usb_dev_observed(struct usbport_trig_data *usbport_data, -+ struct usb_device *usb_dev) -+{ -+ struct usbport_trig_port *port; -+ -+ if (!usb_dev->parent) -+ return false; -+ -+ list_for_each_entry(port, &usbport_data->ports, list) { -+ if (usb_dev->parent == port->hub && -+ usb_dev->portnum == port->portnum) -+ return port->observed; -+ } -+ -+ return false; -+} -+ -+static int usbport_trig_usb_dev_check(struct usb_device *usb_dev, void *data) -+{ -+ struct usbport_trig_data *usbport_data = data; -+ -+ if (usbport_trig_usb_dev_observed(usbport_data, usb_dev)) -+ usbport_data->count++; -+ -+ return 0; -+} -+ -+/** -+ * usbport_trig_update_count - Recalculate amount of connected matching devices -+ */ -+static void usbport_trig_update_count(struct usbport_trig_data *usbport_data) -+{ -+ struct led_classdev *led_cdev = usbport_data->led_cdev; -+ -+ usbport_data->count = 0; -+ usb_for_each_dev(usbport_data, usbport_trig_usb_dev_check); -+ led_cdev->brightness_set(led_cdev, -+ usbport_data->count ? LED_FULL : LED_OFF); -+} -+ -+/*************************************** -+ * Device attr -+ ***************************************/ -+ -+static ssize_t usbport_trig_port_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct usbport_trig_port *port = container_of(attr, -+ struct usbport_trig_port, -+ attr); -+ -+ return sprintf(buf, "%d\n", port->observed) + 1; -+} -+ -+static ssize_t usbport_trig_port_store(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t size) -+{ -+ struct usbport_trig_port *port = container_of(attr, -+ struct usbport_trig_port, -+ attr); -+ -+ if (!strcmp(buf, "0") || !strcmp(buf, "0\n")) -+ port->observed = 0; -+ else if (!strcmp(buf, "1") || !strcmp(buf, "1\n")) -+ port->observed = 1; -+ else -+ return -EINVAL; -+ -+ usbport_trig_update_count(port->data); -+ -+ return size; -+} -+ -+static struct attribute *ports_attrs[] = { -+ NULL, -+}; -+static const struct attribute_group ports_group = { -+ .name = "ports", -+ .attrs = ports_attrs, -+}; -+ -+/*************************************** -+ * Adding & removing ports -+ ***************************************/ -+ -+static int usbport_trig_add_port(struct usbport_trig_data *usbport_data, -+ struct usb_device *usb_dev, -+ const char *hub_name, int portnum) -+{ -+ struct led_classdev *led_cdev = usbport_data->led_cdev; -+ struct usbport_trig_port *port; -+ size_t len; -+ int err; -+ -+ port = kzalloc(sizeof(*port), GFP_KERNEL); -+ if (!port) { -+ err = -ENOMEM; -+ goto err_out; -+ } -+ -+ port->data = usbport_data; -+ port->hub = usb_dev; -+ port->portnum = portnum; -+ -+ len = strlen(hub_name) + 8; -+ port->port_name = kzalloc(len, GFP_KERNEL); -+ if (!port->port_name) { -+ err = -ENOMEM; -+ goto err_free_port; -+ } -+ snprintf(port->port_name, len, "%s-port%d", hub_name, portnum); -+ -+ port->attr.attr.name = port->port_name; -+ port->attr.attr.mode = S_IRUSR | S_IWUSR; -+ port->attr.show = usbport_trig_port_show; -+ port->attr.store = usbport_trig_port_store; -+ -+ err = sysfs_add_file_to_group(&led_cdev->dev->kobj, &port->attr.attr, -+ ports_group.name); -+ if (err) -+ goto err_free_port_name; -+ -+ list_add_tail(&port->list, &usbport_data->ports); -+ -+ return 0; -+ -+err_free_port_name: -+ kfree(port->port_name); -+err_free_port: -+ kfree(port); -+err_out: -+ return err; -+} -+ -+static int usbport_trig_add_usb_dev_ports(struct usb_device *usb_dev, -+ void *data) -+{ -+ struct usbport_trig_data *usbport_data = data; -+ int i; -+ -+ for (i = 1; i <= usb_dev->maxchild; i++) -+ usbport_trig_add_port(usbport_data, usb_dev, -+ dev_name(&usb_dev->dev), i); -+ -+ return 0; -+} -+ -+static void usbport_trig_remove_port(struct usbport_trig_data *usbport_data, -+ struct usbport_trig_port *port) -+{ -+ struct led_classdev *led_cdev = usbport_data->led_cdev; -+ -+ list_del(&port->list); -+ sysfs_remove_file_from_group(&led_cdev->dev->kobj, &port->attr.attr, -+ ports_group.name); -+ kfree(port->port_name); -+ kfree(port); -+} -+ -+static void usbport_trig_remove_usb_dev_ports(struct usbport_trig_data *usbport_data, -+ struct usb_device *usb_dev) -+{ -+ struct usbport_trig_port *port, *tmp; -+ -+ list_for_each_entry_safe(port, tmp, &usbport_data->ports, list) { -+ if (port->hub == usb_dev) -+ usbport_trig_remove_port(usbport_data, port); -+ } -+} -+ -+/*************************************** -+ * Init, exit, etc. -+ ***************************************/ -+ -+static int usbport_trig_notify(struct notifier_block *nb, unsigned long action, -+ void *data) -+{ -+ struct usbport_trig_data *usbport_data = -+ container_of(nb, struct usbport_trig_data, nb); -+ struct led_classdev *led_cdev = usbport_data->led_cdev; -+ struct usb_device *usb_dev = data; -+ bool observed; -+ -+ observed = usbport_trig_usb_dev_observed(usbport_data, usb_dev); -+ -+ switch (action) { -+ case USB_DEVICE_ADD: -+ usbport_trig_add_usb_dev_ports(usb_dev, usbport_data); -+ if (observed && usbport_data->count++ == 0) -+ led_cdev->brightness_set(led_cdev, LED_FULL); -+ return NOTIFY_OK; -+ case USB_DEVICE_REMOVE: -+ usbport_trig_remove_usb_dev_ports(usbport_data, usb_dev); -+ if (observed && --usbport_data->count == 0) -+ led_cdev->brightness_set(led_cdev, LED_OFF); -+ return NOTIFY_OK; -+ } -+ -+ return NOTIFY_DONE; -+} -+ -+static void usbport_trig_activate(struct led_classdev *led_cdev) -+{ -+ struct usbport_trig_data *usbport_data; -+ int err; -+ -+ usbport_data = kzalloc(sizeof(*usbport_data), GFP_KERNEL); -+ if (!usbport_data) -+ return; -+ usbport_data->led_cdev = led_cdev; -+ -+ /* List of ports */ -+ INIT_LIST_HEAD(&usbport_data->ports); -+ err = sysfs_create_group(&led_cdev->dev->kobj, &ports_group); -+ if (err) -+ goto err_free; -+ usb_for_each_dev(usbport_data, usbport_trig_add_usb_dev_ports); -+ -+ /* Notifications */ -+ usbport_data->nb.notifier_call = usbport_trig_notify, -+ led_cdev->trigger_data = usbport_data; -+ usb_register_notify(&usbport_data->nb); -+ -+ led_cdev->activated = true; -+ return; -+ -+err_free: -+ kfree(usbport_data); -+} -+ -+static void usbport_trig_deactivate(struct led_classdev *led_cdev) -+{ -+ struct usbport_trig_data *usbport_data = led_cdev->trigger_data; -+ struct usbport_trig_port *port, *tmp; -+ -+ if (!led_cdev->activated) -+ return; -+ -+ list_for_each_entry_safe(port, tmp, &usbport_data->ports, list) { -+ usbport_trig_remove_port(usbport_data, port); -+ } -+ -+ usb_unregister_notify(&usbport_data->nb); -+ -+ sysfs_remove_group(&led_cdev->dev->kobj, &ports_group); -+ -+ kfree(usbport_data); -+ -+ led_cdev->activated = false; -+} -+ -+static struct led_trigger usbport_led_trigger = { -+ .name = "usbport", -+ .activate = usbport_trig_activate, -+ .deactivate = usbport_trig_deactivate, -+}; -+ -+static int __init usbport_trig_init(void) -+{ -+ return led_trigger_register(&usbport_led_trigger); -+} -+ -+static void __exit usbport_trig_exit(void) -+{ -+ led_trigger_unregister(&usbport_led_trigger); -+} -+ -+module_init(usbport_trig_init); -+module_exit(usbport_trig_exit); -+ -+MODULE_AUTHOR("Rafał Miłecki "); -+MODULE_DESCRIPTION("USB port trigger"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/patches-4.1/090-m25p80_spi-nor_update_to_4.4rc1.patch b/target/linux/generic/patches-4.1/090-m25p80_spi-nor_update_to_4.4rc1.patch deleted file mode 100644 index b640706587..0000000000 --- a/target/linux/generic/patches-4.1/090-m25p80_spi-nor_update_to_4.4rc1.patch +++ /dev/null @@ -1,1129 +0,0 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -31,7 +31,6 @@ - struct m25p { - struct spi_device *spi; - struct spi_nor spi_nor; -- struct mtd_info mtd; - u8 command[MAX_CMD_SIZE]; - }; - -@@ -62,8 +61,7 @@ static int m25p_cmdsz(struct spi_nor *no - return 1 + nor->addr_width; - } - --static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len, -- int wr_en) -+static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) - { - struct m25p *flash = nor->priv; - struct spi_device *spi = flash->spi; -@@ -159,7 +157,7 @@ static int m25p80_erase(struct spi_nor * - struct m25p *flash = nor->priv; - - dev_dbg(nor->dev, "%dKiB at 0x%08x\n", -- flash->mtd.erasesize / 1024, (u32)offset); -+ flash->spi_nor.mtd.erasesize / 1024, (u32)offset); - - /* Set up command buffer. */ - flash->command[0] = nor->erase_opcode; -@@ -201,11 +199,10 @@ static int m25p_probe(struct spi_device - nor->read_reg = m25p80_read_reg; - - nor->dev = &spi->dev; -- nor->mtd = &flash->mtd; -+ nor->flash_node = spi->dev.of_node; - nor->priv = flash; - - spi_set_drvdata(spi, flash); -- flash->mtd.priv = nor; - flash->spi = spi; - - if (spi->mode & SPI_RX_QUAD) -@@ -214,7 +211,7 @@ static int m25p_probe(struct spi_device - mode = SPI_NOR_DUAL; - - if (data && data->name) -- flash->mtd.name = data->name; -+ nor->mtd.name = data->name; - - /* For some (historical?) reason many platforms provide two different - * names in flash_platform_data: "name" and "type". Quite often name is -@@ -223,8 +220,6 @@ static int m25p_probe(struct spi_device - */ - if (data && data->type) - flash_name = data->type; -- else if (!strcmp(spi->modalias, "spi-nor")) -- flash_name = NULL; /* auto-detect */ - else - flash_name = spi->modalias; - -@@ -234,7 +229,7 @@ static int m25p_probe(struct spi_device - - ppdata.of_node = spi->dev.of_node; - -- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, -+ return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, - data ? data->parts : NULL, - data ? data->nr_parts : 0); - } -@@ -245,7 +240,7 @@ static int m25p_remove(struct spi_device - struct m25p *flash = spi_get_drvdata(spi); - - /* Clean up MTD stuff. */ -- return mtd_device_unregister(&flash->mtd); -+ return mtd_device_unregister(&flash->spi_nor.mtd); - } - - /* -@@ -261,59 +256,52 @@ static int m25p_remove(struct spi_device - * keep them available as module aliases for existing platforms. - */ - static const struct spi_device_id m25p_ids[] = { -- {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"}, -- {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"}, -- {"at26df321"}, {"at45db081d"}, -- {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"}, -- {"en25q64"}, {"en25qh128"}, {"en25qh256"}, -- {"f25l32pa"}, -- {"mr25h256"}, {"mr25h10"}, -- {"gd25q32"}, {"gd25q64"}, -- {"160s33b"}, {"320s33b"}, {"640s33b"}, -- {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"}, -- {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"}, -- {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"}, -- {"mx66l1g55g"}, -- {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"}, -- {"n25q512a"}, {"n25q512ax3"}, {"n25q00"}, -- {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"}, -- {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"}, -- {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"}, -- {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"}, -- {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"}, -- {"s25fl016k"}, {"s25fl064k"}, {"s25fl132k"}, -- {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"}, -- {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"}, -- {"sst25wf040"}, -- {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"}, -- {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"}, -- {"m25p128"}, {"n25q032"}, -+ /* -+ * Entries not used in DTs that should be safe to drop after replacing -+ * them with "nor-jedec" in platform data. -+ */ -+ {"s25sl064a"}, {"w25x16"}, {"m25p10"}, {"m25px64"}, -+ -+ /* -+ * Entries that were used in DTs without "nor-jedec" fallback and should -+ * be kept for backward compatibility. -+ */ -+ {"at25df321a"}, {"at25df641"}, {"at26df081a"}, -+ {"mr25h256"}, -+ {"mx25l4005a"}, {"mx25l1606e"}, {"mx25l6405d"}, {"mx25l12805d"}, -+ {"mx25l25635e"},{"mx66l51235l"}, -+ {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q512a"}, -+ {"s25fl256s1"}, {"s25fl512s"}, {"s25sl12801"}, {"s25fl008k"}, -+ {"s25fl064k"}, -+ {"sst25vf040b"},{"sst25vf016b"},{"sst25vf032b"},{"sst25wf040"}, -+ {"m25p40"}, {"m25p80"}, {"m25p16"}, {"m25p32"}, -+ {"m25p64"}, {"m25p128"}, -+ {"w25x80"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, -+ {"w25q80bl"}, {"w25q128"}, {"w25q256"}, -+ -+ /* Flashes that can't be detected using JEDEC */ - {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"}, - {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"}, - {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"}, -- {"m45pe10"}, {"m45pe80"}, {"m45pe16"}, -- {"m25pe20"}, {"m25pe80"}, {"m25pe16"}, -- {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"}, -- {"m25px64"}, {"m25px80"}, -- {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"}, -- {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, -- {"w25x64"}, {"w25q64"}, {"w25q80"}, {"w25q80bl"}, -- {"w25q128"}, {"w25q256"}, {"cat25c11"}, -- {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"}, - -- /* -- * Generic support for SPI NOR that can be identified by the JEDEC READ -- * ID opcode (0x9F). Use this, if possible. -- */ -- {"spi-nor"}, - { }, - }; - 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 -@@ -16,19 +16,32 @@ - #include - #include - #include -+#include - --#include - #include - #include - #include - #include - - /* Define max times to check status register before we give up. */ --#define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */ -+ -+/* -+ * For everything but full-chip erase; probably could be much smaller, but kept -+ * around for safety for now -+ */ -+#define DEFAULT_READY_WAIT_JIFFIES (40UL * HZ) -+ -+/* -+ * For full-chip erase, calibrated to a 2MB flash (M25P16); should be scaled up -+ * for larger flash -+ */ -+#define CHIP_ERASE_2MB_READY_WAIT_JIFFIES (40UL * HZ) - - #define SPI_NOR_MAX_ID_LEN 6 - - struct flash_info { -+ char *name; -+ - /* - * This array stores the ID bytes. - * The first three bytes are the JEDIC ID. -@@ -59,7 +72,7 @@ struct flash_info { - - #define JEDEC_MFR(info) ((info)->id[0]) - --static const struct spi_device_id *spi_nor_match_id(const char *name); -+static const struct flash_info *spi_nor_match_id(const char *name); - - /* - * Read the status register, returning its value in the location -@@ -143,7 +156,7 @@ static inline int spi_nor_read_dummy_cyc - static inline int write_sr(struct spi_nor *nor, u8 val) - { - nor->cmd_buf[0] = val; -- return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); -+ return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1); - } - - /* -@@ -152,7 +165,7 @@ static inline int write_sr(struct spi_no - */ - static inline int write_enable(struct spi_nor *nor) - { -- return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); -+ return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0); - } - - /* -@@ -160,7 +173,7 @@ static inline int write_enable(struct sp - */ - static inline int write_disable(struct spi_nor *nor) - { -- return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0, 0); -+ return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0); - } - - static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd) -@@ -169,7 +182,7 @@ static inline struct spi_nor *mtd_to_spi - } - - /* Enable/disable 4-byte addressing mode. */ --static inline int set_4byte(struct spi_nor *nor, struct flash_info *info, -+static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info, - int enable) - { - int status; -@@ -177,16 +190,16 @@ static inline int set_4byte(struct spi_n - u8 cmd; - - switch (JEDEC_MFR(info)) { -- case CFI_MFR_ST: /* Micron, actually */ -+ case SNOR_MFR_MICRON: - /* Some Micron need WREN command; all will accept it */ - need_wren = true; -- case CFI_MFR_MACRONIX: -- case 0xEF /* winbond */: -+ case SNOR_MFR_MACRONIX: -+ case SNOR_MFR_WINBOND: - if (need_wren) - write_enable(nor); - - cmd = enable ? SPINOR_OP_EN4B : SPINOR_OP_EX4B; -- status = nor->write_reg(nor, cmd, NULL, 0, 0); -+ status = nor->write_reg(nor, cmd, NULL, 0); - if (need_wren) - write_disable(nor); - -@@ -194,7 +207,7 @@ static inline int set_4byte(struct spi_n - default: - /* Spansion style */ - nor->cmd_buf[0] = enable << 7; -- return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1, 0); -+ return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1); - } - } - static inline int spi_nor_sr_ready(struct spi_nor *nor) -@@ -231,12 +244,13 @@ static int spi_nor_ready(struct spi_nor - * Service routine to read status register until ready, or timeout occurs. - * Returns non-zero if error. - */ --static int spi_nor_wait_till_ready(struct spi_nor *nor) -+static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, -+ unsigned long timeout_jiffies) - { - unsigned long deadline; - int timeout = 0, ret; - -- deadline = jiffies + MAX_READY_WAIT_JIFFIES; -+ deadline = jiffies + timeout_jiffies; - - while (!timeout) { - if (time_after_eq(jiffies, deadline)) -@@ -256,6 +270,12 @@ static int spi_nor_wait_till_ready(struc - return -ETIMEDOUT; - } - -+static int spi_nor_wait_till_ready(struct spi_nor *nor) -+{ -+ return spi_nor_wait_till_ready_with_timeout(nor, -+ DEFAULT_READY_WAIT_JIFFIES); -+} -+ - /* - * Erase the whole flash memory - * -@@ -263,9 +283,9 @@ static int spi_nor_wait_till_ready(struc - */ - static int erase_chip(struct spi_nor *nor) - { -- dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd->size >> 10)); -+ dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10)); - -- return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0, 0); -+ return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0); - } - - static int spi_nor_lock_and_prep(struct spi_nor *nor, enum spi_nor_ops ops) -@@ -319,6 +339,8 @@ static int spi_nor_erase(struct mtd_info - - /* whole-chip erase? */ - if (len == mtd->size) { -+ unsigned long timeout; -+ - write_enable(nor); - - if (erase_chip(nor)) { -@@ -326,7 +348,16 @@ static int spi_nor_erase(struct mtd_info - goto erase_err; - } - -- ret = spi_nor_wait_till_ready(nor); -+ /* -+ * Scale the timeout linearly with the size of the flash, with -+ * a minimum calibrated to an old 2MB flash. We could try to -+ * pull these from CFI/SFDP, but these values should be good -+ * enough for now. -+ */ -+ timeout = max(CHIP_ERASE_2MB_READY_WAIT_JIFFIES, -+ CHIP_ERASE_2MB_READY_WAIT_JIFFIES * -+ (unsigned long)(mtd->size / SZ_2M)); -+ ret = spi_nor_wait_till_ready_with_timeout(nor, timeout); - if (ret) - goto erase_err; - -@@ -369,72 +400,171 @@ erase_err: - return ret; - } - -+static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs, -+ uint64_t *len) -+{ -+ struct mtd_info *mtd = &nor->mtd; -+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; -+ int shift = ffs(mask) - 1; -+ int pow; -+ -+ if (!(sr & mask)) { -+ /* No protection */ -+ *ofs = 0; -+ *len = 0; -+ } else { -+ pow = ((sr & mask) ^ mask) >> shift; -+ *len = mtd->size >> pow; -+ *ofs = mtd->size - *len; -+ } -+} -+ -+/* -+ * Return 1 if the entire region is locked, 0 otherwise -+ */ -+static int stm_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, -+ u8 sr) -+{ -+ loff_t lock_offs; -+ uint64_t lock_len; -+ -+ stm_get_locked_range(nor, sr, &lock_offs, &lock_len); -+ -+ return (ofs + len <= lock_offs + lock_len) && (ofs >= lock_offs); -+} -+ -+/* -+ * Lock a region of the flash. Compatible with ST Micro and similar flash. -+ * Supports only the block protection bits BP{0,1,2} in the status register -+ * (SR). Does not support these features found in newer SR bitfields: -+ * - TB: top/bottom protect - only handle TB=0 (top protect) -+ * - SEC: sector/block protect - only handle SEC=0 (block protect) -+ * - CMP: complement protect - only support CMP=0 (range is not complemented) -+ * -+ * Sample table portion for 8MB flash (Winbond w25q64fw): -+ * -+ * SEC | TB | BP2 | BP1 | BP0 | Prot Length | Protected Portion -+ * -------------------------------------------------------------------------- -+ * X | X | 0 | 0 | 0 | NONE | NONE -+ * 0 | 0 | 0 | 0 | 1 | 128 KB | Upper 1/64 -+ * 0 | 0 | 0 | 1 | 0 | 256 KB | Upper 1/32 -+ * 0 | 0 | 0 | 1 | 1 | 512 KB | Upper 1/16 -+ * 0 | 0 | 1 | 0 | 0 | 1 MB | Upper 1/8 -+ * 0 | 0 | 1 | 0 | 1 | 2 MB | Upper 1/4 -+ * 0 | 0 | 1 | 1 | 0 | 4 MB | Upper 1/2 -+ * X | X | 1 | 1 | 1 | 8 MB | ALL -+ * -+ * Returns negative on errors, 0 on success. -+ */ - static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) - { -- struct mtd_info *mtd = nor->mtd; -- uint32_t offset = ofs; -- uint8_t status_old, status_new; -- int ret = 0; -+ struct mtd_info *mtd = &nor->mtd; -+ u8 status_old, status_new; -+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; -+ u8 shift = ffs(mask) - 1, pow, val; - - status_old = read_sr(nor); - -- if (offset < mtd->size - (mtd->size / 2)) -- status_new = status_old | SR_BP2 | SR_BP1 | SR_BP0; -- else if (offset < mtd->size - (mtd->size / 4)) -- status_new = (status_old & ~SR_BP0) | SR_BP2 | SR_BP1; -- else if (offset < mtd->size - (mtd->size / 8)) -- status_new = (status_old & ~SR_BP1) | SR_BP2 | SR_BP0; -- else if (offset < mtd->size - (mtd->size / 16)) -- status_new = (status_old & ~(SR_BP0 | SR_BP1)) | SR_BP2; -- else if (offset < mtd->size - (mtd->size / 32)) -- status_new = (status_old & ~SR_BP2) | SR_BP1 | SR_BP0; -- else if (offset < mtd->size - (mtd->size / 64)) -- status_new = (status_old & ~(SR_BP2 | SR_BP0)) | SR_BP1; -- else -- status_new = (status_old & ~(SR_BP2 | SR_BP1)) | SR_BP0; -+ /* SPI NOR always locks to the end */ -+ if (ofs + len != mtd->size) { -+ /* Does combined region extend to end? */ -+ if (!stm_is_locked_sr(nor, ofs + len, mtd->size - ofs - len, -+ status_old)) -+ return -EINVAL; -+ len = mtd->size - ofs; -+ } -+ -+ /* -+ * Need smallest pow such that: -+ * -+ * 1 / (2^pow) <= (len / size) -+ * -+ * so (assuming power-of-2 size) we do: -+ * -+ * pow = ceil(log2(size / len)) = log2(size) - floor(log2(len)) -+ */ -+ pow = ilog2(mtd->size) - ilog2(len); -+ val = mask - (pow << shift); -+ if (val & ~mask) -+ return -EINVAL; -+ /* Don't "lock" with no region! */ -+ if (!(val & mask)) -+ return -EINVAL; -+ -+ status_new = (status_old & ~mask) | val; - - /* Only modify protection if it will not unlock other areas */ -- if ((status_new & (SR_BP2 | SR_BP1 | SR_BP0)) > -- (status_old & (SR_BP2 | SR_BP1 | SR_BP0))) { -- write_enable(nor); -- ret = write_sr(nor, status_new); -- } -+ if ((status_new & mask) <= (status_old & mask)) -+ return -EINVAL; - -- return ret; -+ write_enable(nor); -+ return write_sr(nor, status_new); - } - -+/* -+ * Unlock a region of the flash. See stm_lock() for more info -+ * -+ * Returns negative on errors, 0 on success. -+ */ - static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) - { -- struct mtd_info *mtd = nor->mtd; -- uint32_t offset = ofs; -+ struct mtd_info *mtd = &nor->mtd; - uint8_t status_old, status_new; -- int ret = 0; -+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; -+ u8 shift = ffs(mask) - 1, pow, val; - - status_old = read_sr(nor); - -- if (offset+len > mtd->size - (mtd->size / 64)) -- status_new = status_old & ~(SR_BP2 | SR_BP1 | SR_BP0); -- else if (offset+len > mtd->size - (mtd->size / 32)) -- status_new = (status_old & ~(SR_BP2 | SR_BP1)) | SR_BP0; -- else if (offset+len > mtd->size - (mtd->size / 16)) -- status_new = (status_old & ~(SR_BP2 | SR_BP0)) | SR_BP1; -- else if (offset+len > mtd->size - (mtd->size / 8)) -- status_new = (status_old & ~SR_BP2) | SR_BP1 | SR_BP0; -- else if (offset+len > mtd->size - (mtd->size / 4)) -- status_new = (status_old & ~(SR_BP0 | SR_BP1)) | SR_BP2; -- else if (offset+len > mtd->size - (mtd->size / 2)) -- status_new = (status_old & ~SR_BP1) | SR_BP2 | SR_BP0; -- else -- status_new = (status_old & ~SR_BP0) | SR_BP2 | SR_BP1; -+ /* Cannot unlock; would unlock larger region than requested */ -+ if (stm_is_locked_sr(nor, status_old, ofs - mtd->erasesize, -+ mtd->erasesize)) -+ return -EINVAL; - -- /* Only modify protection if it will not lock other areas */ -- if ((status_new & (SR_BP2 | SR_BP1 | SR_BP0)) < -- (status_old & (SR_BP2 | SR_BP1 | SR_BP0))) { -- write_enable(nor); -- ret = write_sr(nor, status_new); -+ /* -+ * Need largest pow such that: -+ * -+ * 1 / (2^pow) >= (len / size) -+ * -+ * so (assuming power-of-2 size) we do: -+ * -+ * pow = floor(log2(size / len)) = log2(size) - ceil(log2(len)) -+ */ -+ pow = ilog2(mtd->size) - order_base_2(mtd->size - (ofs + len)); -+ if (ofs + len == mtd->size) { -+ val = 0; /* fully unlocked */ -+ } else { -+ val = mask - (pow << shift); -+ /* Some power-of-two sizes are not supported */ -+ if (val & ~mask) -+ return -EINVAL; - } - -- return ret; -+ status_new = (status_old & ~mask) | val; -+ -+ /* Only modify protection if it will not lock other areas */ -+ if ((status_new & mask) >= (status_old & mask)) -+ return -EINVAL; -+ -+ write_enable(nor); -+ return write_sr(nor, status_new); -+} -+ -+/* -+ * Check if a region of the flash is (completely) locked. See stm_lock() for -+ * more info. -+ * -+ * Returns 1 if entire region is locked, 0 if any portion is unlocked, and -+ * negative on errors. -+ */ -+static int stm_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) -+{ -+ int status; -+ -+ status = read_sr(nor); -+ if (status < 0) -+ return status; -+ -+ return stm_is_locked_sr(nor, ofs, len, status); - } - - static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) -@@ -467,9 +597,23 @@ static int spi_nor_unlock(struct mtd_inf - return ret; - } - -+static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) -+{ -+ struct spi_nor *nor = mtd_to_spi_nor(mtd); -+ int ret; -+ -+ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); -+ if (ret) -+ return ret; -+ -+ ret = nor->flash_is_locked(nor, ofs, len); -+ -+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); -+ return ret; -+} -+ - /* Used when the "_ext_id" is two bytes at most */ - #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ -- ((kernel_ulong_t)&(struct flash_info) { \ - .id = { \ - ((_jedec_id) >> 16) & 0xff, \ - ((_jedec_id) >> 8) & 0xff, \ -@@ -481,11 +625,9 @@ static int spi_nor_unlock(struct mtd_inf - .sector_size = (_sector_size), \ - .n_sectors = (_n_sectors), \ - .page_size = 256, \ -- .flags = (_flags), \ -- }) -+ .flags = (_flags), - - #define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ -- ((kernel_ulong_t)&(struct flash_info) { \ - .id = { \ - ((_jedec_id) >> 16) & 0xff, \ - ((_jedec_id) >> 8) & 0xff, \ -@@ -498,23 +640,27 @@ static int spi_nor_unlock(struct mtd_inf - .sector_size = (_sector_size), \ - .n_sectors = (_n_sectors), \ - .page_size = 256, \ -- .flags = (_flags), \ -- }) -+ .flags = (_flags), - - #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags) \ -- ((kernel_ulong_t)&(struct flash_info) { \ - .sector_size = (_sector_size), \ - .n_sectors = (_n_sectors), \ - .page_size = (_page_size), \ - .addr_width = (_addr_width), \ -- .flags = (_flags), \ -- }) -+ .flags = (_flags), - - /* NOTE: double check command sets and memory organization when you add - * more nor chips. This current list focusses on newer chips, which - * have been converging on command sets which including JEDEC ID. -+ * -+ * All newly added entries should describe *hardware* and should use SECT_4K -+ * (or SECT_4K_PMC) if hardware supports erasing 4 KiB sectors. For usage -+ * scenarios excluding small sectors there is config option that can be -+ * disabled: CONFIG_MTD_SPI_NOR_USE_4K_SECTORS. -+ * For historical (and compatibility) reasons (before we got above config) some -+ * old entries may be missing 4K flag. - */ --static const struct spi_device_id spi_nor_ids[] = { -+static const struct flash_info spi_nor_ids[] = { - /* Atmel -- some are (confusingly) marketed as "DataFlash" */ - { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, - { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, -@@ -538,7 +684,7 @@ static const struct spi_device_id spi_no - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, -- { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, 0) }, -+ { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, - - /* ESMT */ - { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, -@@ -560,7 +706,11 @@ 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) }, - { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, - { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, -@@ -578,7 +728,9 @@ static const struct spi_device_id spi_no - - /* Micron */ - { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, -- { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SPI_NOR_QUAD_READ) }, -+ { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, -+ { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, -+ { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, - { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, - { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, - { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, -@@ -595,25 +747,28 @@ static const struct spi_device_id spi_no - * for the chips listed here (without boot sectors). - */ - { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, -- { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, 0) }, -+ { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) }, - { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, - { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, - { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, -- { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, -- { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) }, -- { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) }, -+ { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, -+ { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, -+ { "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) }, - { "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32, 0) }, - { "s25sl032a", INFO(0x010215, 0, 64 * 1024, 64, 0) }, - { "s25sl064a", INFO(0x010216, 0, 64 * 1024, 128, 0) }, -- { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, -- { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) }, -+ { "s25fl004k", INFO(0xef4013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, -+ { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, -+ { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, -- { "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, 0) }, -+ { "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, SECT_4K) }, -+ { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ) }, - - /* SST -- large erase sizes are "overlays", "sectors" are 4K */ - { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, -@@ -624,6 +779,8 @@ static const struct spi_device_id spi_no - { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE) }, - { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE) }, - { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE) }, -+ { "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4, SECT_4K) }, -+ { "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8, SECT_4K) }, - { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, - { "sst25wf080", INFO(0xbf2505, 0, 64 * 1024, 16, SECT_4K | SST_WRITE) }, - -@@ -672,10 +829,11 @@ static const struct spi_device_id spi_no - { "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) }, - { "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) }, - { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, -- { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K) }, -+ { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) }, - { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, -- { "w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, -+ { "w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "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) }, -@@ -690,11 +848,11 @@ static const struct spi_device_id spi_no - { }, - }; - --static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) -+static const struct flash_info *spi_nor_read_id(struct spi_nor *nor) - { - int tmp; - u8 id[SPI_NOR_MAX_ID_LEN]; -- struct flash_info *info; -+ const struct flash_info *info; - - tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN); - if (tmp < 0) { -@@ -703,7 +861,7 @@ static const struct spi_device_id *spi_n - } - - for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) { -- info = (void *)spi_nor_ids[tmp].driver_data; -+ info = &spi_nor_ids[tmp]; - if (info->id_len) { - if (!memcmp(info->id, id, info->id_len)) - return &spi_nor_ids[tmp]; -@@ -857,8 +1015,7 @@ static int macronix_quad_enable(struct s - val = read_sr(nor); - write_enable(nor); - -- nor->cmd_buf[0] = val | SR_QUAD_EN_MX; -- nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); -+ write_sr(nor, val | SR_QUAD_EN_MX); - - if (spi_nor_wait_till_ready(nor)) - return 1; -@@ -883,7 +1040,7 @@ static int write_sr_cr(struct spi_nor *n - nor->cmd_buf[0] = val & 0xff; - nor->cmd_buf[1] = (val >> 8); - -- return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2, 0); -+ return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2); - } - - static int spansion_quad_enable(struct spi_nor *nor) -@@ -925,7 +1082,7 @@ static int micron_quad_enable(struct spi - - /* set EVCR, enable quad I/O */ - nor->cmd_buf[0] = val & ~EVCR_QUAD_EN_MICRON; -- ret = nor->write_reg(nor, SPINOR_OP_WD_EVCR, nor->cmd_buf, 1, 0); -+ ret = nor->write_reg(nor, SPINOR_OP_WD_EVCR, nor->cmd_buf, 1); - if (ret < 0) { - dev_err(nor->dev, "error while writing EVCR register\n"); - return ret; -@@ -949,19 +1106,19 @@ static int micron_quad_enable(struct spi - return 0; - } - --static int set_quad_mode(struct spi_nor *nor, struct flash_info *info) -+static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) - { - int status; - - switch (JEDEC_MFR(info)) { -- case CFI_MFR_MACRONIX: -+ case SNOR_MFR_MACRONIX: - status = macronix_quad_enable(nor); - if (status) { - dev_err(nor->dev, "Macronix quad-read not enabled\n"); - return -EINVAL; - } - return status; -- case CFI_MFR_ST: -+ case SNOR_MFR_MICRON: - status = micron_quad_enable(nor); - if (status) { - dev_err(nor->dev, "Micron quad-read not enabled\n"); -@@ -991,11 +1148,10 @@ static int spi_nor_check(struct spi_nor - - int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) - { -- const struct spi_device_id *id = NULL; -- struct flash_info *info; -+ const struct flash_info *info = NULL; - struct device *dev = nor->dev; -- struct mtd_info *mtd = nor->mtd; -- struct device_node *np = dev->of_node; -+ struct mtd_info *mtd = &nor->mtd; -+ struct device_node *np = nor->flash_node; - int ret; - int i; - -@@ -1003,27 +1159,25 @@ int spi_nor_scan(struct spi_nor *nor, co - if (ret) - return ret; - -- /* Try to auto-detect if chip name wasn't specified */ -- if (!name) -- id = spi_nor_read_id(nor); -- else -- id = spi_nor_match_id(name); -- if (IS_ERR_OR_NULL(id)) -+ if (name) -+ info = spi_nor_match_id(name); -+ /* Try to auto-detect if chip name wasn't specified or not found */ -+ if (!info) -+ info = spi_nor_read_id(nor); -+ if (IS_ERR_OR_NULL(info)) - return -ENOENT; - -- info = (void *)id->driver_data; -- - /* - * If caller has specified name of flash model that can normally be - * detected using JEDEC, let's verify it. - */ - if (name && info->id_len) { -- const struct spi_device_id *jid; -+ const struct flash_info *jinfo; - -- jid = spi_nor_read_id(nor); -- if (IS_ERR(jid)) { -- return PTR_ERR(jid); -- } else if (jid != id) { -+ jinfo = spi_nor_read_id(nor); -+ if (IS_ERR(jinfo)) { -+ return PTR_ERR(jinfo); -+ } else if (jinfo != info) { - /* - * JEDEC knows better, so overwrite platform ID. We - * can't trust partitions any longer, but we'll let -@@ -1032,28 +1186,29 @@ int spi_nor_scan(struct spi_nor *nor, co - * information, even if it's not 100% accurate. - */ - dev_warn(dev, "found %s, expected %s\n", -- jid->name, id->name); -- id = jid; -- info = (void *)jid->driver_data; -+ jinfo->name, info->name); -+ info = jinfo; - } - } - - mutex_init(&nor->lock); - - /* -- * Atmel, SST and Intel/Numonyx serial nor tend to power -- * up with the software protection bits set -+ * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up -+ * with the software protection bits set - */ - -- if (JEDEC_MFR(info) == CFI_MFR_ATMEL || -- JEDEC_MFR(info) == CFI_MFR_INTEL || -- JEDEC_MFR(info) == CFI_MFR_SST) { -+ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || -+ JEDEC_MFR(info) == SNOR_MFR_INTEL || -+ JEDEC_MFR(info) == SNOR_MFR_SST || -+ JEDEC_MFR(info) == SNOR_MFR_WINBOND) { - write_enable(nor); - write_sr(nor, 0); - } - - if (!mtd->name) - mtd->name = dev_name(dev); -+ mtd->priv = nor; - mtd->type = MTD_NORFLASH; - mtd->writesize = 1; - mtd->flags = MTD_CAP_NORFLASH; -@@ -1061,15 +1216,18 @@ int spi_nor_scan(struct spi_nor *nor, co - mtd->_erase = spi_nor_erase; - mtd->_read = spi_nor_read; - -- /* nor protection support for STmicro chips */ -- if (JEDEC_MFR(info) == CFI_MFR_ST) { -+ /* NOR protection support for STmicro/Micron chips and similar */ -+ if (JEDEC_MFR(info) == SNOR_MFR_MICRON || -+ JEDEC_MFR(info) == SNOR_MFR_WINBOND) { - nor->flash_lock = stm_lock; - nor->flash_unlock = stm_unlock; -+ nor->flash_is_locked = stm_is_locked; - } - -- if (nor->flash_lock && nor->flash_unlock) { -+ if (nor->flash_lock && nor->flash_unlock && nor->flash_is_locked) { - mtd->_lock = spi_nor_lock; - mtd->_unlock = spi_nor_unlock; -+ mtd->_is_locked = spi_nor_is_locked; - } - - /* sst nor chips use AAI word program */ -@@ -1156,7 +1314,7 @@ 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 (JEDEC_MFR(info) == CFI_MFR_AMD) { -+ if (JEDEC_MFR(info) == SNOR_MFR_SPANSION) { - /* Dedicated 4-byte command set */ - switch (nor->flash_read) { - case SPI_NOR_QUAD: -@@ -1184,7 +1342,7 @@ int spi_nor_scan(struct spi_nor *nor, co - - nor->read_dummy = spi_nor_read_dummy_cycles(nor); - -- dev_info(dev, "%s (%lld Kbytes)\n", id->name, -+ dev_info(dev, "%s (%lld Kbytes)\n", info->name, - (long long)mtd->size >> 10); - - dev_dbg(dev, -@@ -1207,11 +1365,11 @@ int spi_nor_scan(struct spi_nor *nor, co - } - EXPORT_SYMBOL_GPL(spi_nor_scan); - --static const struct spi_device_id *spi_nor_match_id(const char *name) -+static const struct flash_info *spi_nor_match_id(const char *name) - { -- const struct spi_device_id *id = spi_nor_ids; -+ const struct flash_info *id = spi_nor_ids; - -- while (id->name[0]) { -+ while (id->name) { - if (!strcmp(name, id->name)) - return id; - id++; ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -10,6 +10,23 @@ - #ifndef __LINUX_MTD_SPI_NOR_H - #define __LINUX_MTD_SPI_NOR_H - -+#include -+#include -+ -+/* -+ * Manufacturer IDs -+ * -+ * The first byte returned from the flash after sending opcode SPINOR_OP_RDID. -+ * Sometimes these are the same as CFI IDs, but sometimes they aren't. -+ */ -+#define SNOR_MFR_ATMEL CFI_MFR_ATMEL -+#define SNOR_MFR_INTEL CFI_MFR_INTEL -+#define SNOR_MFR_MICRON CFI_MFR_ST /* ST Micro <--> Micron */ -+#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX -+#define SNOR_MFR_SPANSION CFI_MFR_AMD -+#define SNOR_MFR_SST CFI_MFR_SST -+#define SNOR_MFR_WINBOND 0xef -+ - /* - * Note on opcode nomenclature: some opcodes have a format like - * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number -@@ -61,24 +78,24 @@ - #define SPINOR_OP_WD_EVCR 0x61 /* Write EVCR register */ - - /* Status Register bits. */ --#define SR_WIP 1 /* Write in progress */ --#define SR_WEL 2 /* Write enable latch */ -+#define SR_WIP BIT(0) /* Write in progress */ -+#define SR_WEL BIT(1) /* Write enable latch */ - /* meaning of other SR_* bits may differ between vendors */ --#define SR_BP0 4 /* Block protect 0 */ --#define SR_BP1 8 /* Block protect 1 */ --#define SR_BP2 0x10 /* Block protect 2 */ --#define SR_SRWD 0x80 /* SR write protect */ -+#define SR_BP0 BIT(2) /* Block protect 0 */ -+#define SR_BP1 BIT(3) /* Block protect 1 */ -+#define SR_BP2 BIT(4) /* Block protect 2 */ -+#define SR_SRWD BIT(7) /* SR write protect */ - --#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ -+#define SR_QUAD_EN_MX BIT(6) /* Macronix Quad I/O */ - - /* Enhanced Volatile Configuration Register bits */ --#define EVCR_QUAD_EN_MICRON 0x80 /* Micron Quad I/O */ -+#define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ - - /* Flag Status Register bits */ --#define FSR_READY 0x80 -+#define FSR_READY BIT(7) - - /* Configuration Register bits. */ --#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ -+#define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ - - enum read_mode { - SPI_NOR_NORMAL = 0, -@@ -87,33 +104,6 @@ enum read_mode { - SPI_NOR_QUAD, - }; - --/** -- * struct spi_nor_xfer_cfg - Structure for defining a Serial Flash transfer -- * @wren: command for "Write Enable", or 0x00 for not required -- * @cmd: command for operation -- * @cmd_pins: number of pins to send @cmd (1, 2, 4) -- * @addr: address for operation -- * @addr_pins: number of pins to send @addr (1, 2, 4) -- * @addr_width: number of address bytes -- * (3,4, or 0 for address not required) -- * @mode: mode data -- * @mode_pins: number of pins to send @mode (1, 2, 4) -- * @mode_cycles: number of mode cycles (0 for mode not required) -- * @dummy_cycles: number of dummy cycles (0 for dummy not required) -- */ --struct spi_nor_xfer_cfg { -- u8 wren; -- u8 cmd; -- u8 cmd_pins; -- u32 addr; -- u8 addr_pins; -- u8 addr_width; -- u8 mode; -- u8 mode_pins; -- u8 mode_cycles; -- u8 dummy_cycles; --}; -- - #define SPI_NOR_MAX_CMD_SIZE 8 - enum spi_nor_ops { - SPI_NOR_OPS_READ = 0, -@@ -127,11 +117,14 @@ enum spi_nor_option_flags { - SNOR_F_USE_FSR = BIT(0), - }; - -+struct mtd_info; -+ - /** - * struct spi_nor - Structure for defining a the SPI NOR layer - * @mtd: point to a mtd_info structure - * @lock: the lock for the read/write/erase/lock/unlock operations - * @dev: point to a spi device, or a spi nor controller device. -+ * @flash_node: point to a device node describing this flash instance. - * @page_size: the page size of the SPI NOR - * @addr_width: number of address bytes - * @erase_opcode: the opcode for erasing a sector -@@ -141,28 +134,28 @@ enum spi_nor_option_flags { - * @flash_read: the mode of the read - * @sst_write_second: used by the SST write operation - * @flags: flag options for the current SPI-NOR (SNOR_F_*) -- * @cfg: used by the read_xfer/write_xfer - * @cmd_buf: used by the write_reg - * @prepare: [OPTIONAL] do some preparations for the - * read/write/erase/lock/unlock operations - * @unprepare: [OPTIONAL] do some post work after the - * read/write/erase/lock/unlock operations -- * @read_xfer: [OPTIONAL] the read fundamental primitive -- * @write_xfer: [OPTIONAL] the writefundamental primitive - * @read_reg: [DRIVER-SPECIFIC] read out the register - * @write_reg: [DRIVER-SPECIFIC] write data to the register - * @read: [DRIVER-SPECIFIC] read data from the SPI NOR - * @write: [DRIVER-SPECIFIC] write data to the SPI NOR - * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR - * at the offset @offs -- * @lock: [FLASH-SPECIFIC] lock a region of the SPI NOR -- * @unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR -+ * @flash_lock: [FLASH-SPECIFIC] lock a region of the SPI NOR -+ * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR -+ * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is -+ * completely locked - * @priv: the private data - */ - struct spi_nor { -- struct mtd_info *mtd; -+ struct mtd_info mtd; - struct mutex lock; - struct device *dev; -+ struct device_node *flash_node; - u32 page_size; - u8 addr_width; - u8 erase_opcode; -@@ -172,18 +165,12 @@ struct spi_nor { - enum read_mode flash_read; - bool sst_write_second; - u32 flags; -- struct spi_nor_xfer_cfg cfg; - u8 cmd_buf[SPI_NOR_MAX_CMD_SIZE]; - - int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); - void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops); -- int (*read_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg, -- u8 *buf, size_t len); -- int (*write_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg, -- u8 *buf, size_t len); - int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); -- int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len, -- int write_enable); -+ int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); - - int (*read)(struct spi_nor *nor, loff_t from, - size_t len, size_t *retlen, u_char *read_buf); -@@ -193,6 +180,7 @@ struct spi_nor { - - int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); - int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); -+ int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); - - void *priv; - }; diff --git a/target/linux/generic/patches-4.1/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch b/target/linux/generic/patches-4.1/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch deleted file mode 100644 index d0bea944ac..0000000000 --- a/target/linux/generic/patches-4.1/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch +++ /dev/null @@ -1,146 +0,0 @@ -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 -@@ -155,6 +159,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 */ -@@ -206,14 +211,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 */ -@@ -225,8 +234,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 -@@ -277,7 +287,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 -@@ -78,6 +85,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. */ -@@ -103,6 +117,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/patches-4.1/097-mm-remove-gup_flags-FOLL_WRITE-games-from-__get_user.patch b/target/linux/generic/patches-4.1/097-mm-remove-gup_flags-FOLL_WRITE-games-from-__get_user.patch deleted file mode 100644 index 4800ee2ea2..0000000000 --- a/target/linux/generic/patches-4.1/097-mm-remove-gup_flags-FOLL_WRITE-games-from-__get_user.patch +++ /dev/null @@ -1,90 +0,0 @@ -From c865f98df72112a3997b219bf711bc46c1e90706 Mon Sep 17 00:00:00 2001 -From: Linus Torvalds -Date: Thu, 13 Oct 2016 13:07:36 -0700 -Subject: [PATCH] mm: remove gup_flags FOLL_WRITE games from __get_user_pages() - -[ Upstream commit 19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619 ] - -This is an ancient bug that was actually attempted to be fixed once -(badly) by me eleven years ago in commit 4ceb5db9757a ("Fix -get_user_pages() race for write access") but that was then undone due to -problems on s390 by commit f33ea7f404e5 ("fix get_user_pages bug"). - -In the meantime, the s390 situation has long been fixed, and we can now -fix it by checking the pte_dirty() bit properly (and do it better). The -s390 dirty bit was implemented in abf09bed3cce ("s390/mm: implement -software dirty bits") which made it into v3.9. Earlier kernels will -have to look at the page state itself. - -Also, the VM has become more scalable, and what used a purely -theoretical race back then has become easier to trigger. - -To fix it, we introduce a new internal FOLL_COW flag to mark the "yes, -we already did a COW" rather than play racy games with FOLL_WRITE that -is very fundamental, and then use the pte dirty flag to validate that -the FOLL_COW flag is still valid. - -Reported-and-tested-by: Phil "not Paul" Oester -Acked-by: Hugh Dickins -Reviewed-by: Michal Hocko -Cc: Andy Lutomirski -Cc: Kees Cook -Cc: Oleg Nesterov -Cc: Willy Tarreau -Cc: Nick Piggin -Cc: Greg Thelen -Cc: stable@vger.kernel.org -Signed-off-by: Linus Torvalds -Signed-off-by: Sasha Levin ---- - include/linux/mm.h | 1 + - mm/gup.c | 14 ++++++++++++-- - 2 files changed, 13 insertions(+), 2 deletions(-) - ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -2064,6 +2064,7 @@ static inline struct page *follow_page(s - #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ - #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ - #define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ -+#define FOLL_COW 0x4000 /* internal GUP flag */ - - typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, - void *data); ---- a/mm/gup.c -+++ b/mm/gup.c -@@ -32,6 +32,16 @@ static struct page *no_page_table(struct - return NULL; - } - -+/* -+ * FOLL_FORCE can write to even unwritable pte's, but only -+ * after we've gone through a COW cycle and they are dirty. -+ */ -+static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) -+{ -+ return pte_write(pte) || -+ ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); -+} -+ - static struct page *follow_page_pte(struct vm_area_struct *vma, - unsigned long address, pmd_t *pmd, unsigned int flags) - { -@@ -66,7 +76,7 @@ retry: - } - if ((flags & FOLL_NUMA) && pte_protnone(pte)) - goto no_page; -- if ((flags & FOLL_WRITE) && !pte_write(pte)) { -+ if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) { - pte_unmap_unlock(ptep, ptl); - return NULL; - } -@@ -315,7 +325,7 @@ static int faultin_page(struct task_stru - * reCOWed by userspace write). - */ - if ((ret & VM_FAULT_WRITE) && !(vma->vm_flags & VM_WRITE)) -- *flags &= ~FOLL_WRITE; -+ *flags |= FOLL_COW; - return 0; - } - diff --git a/target/linux/generic/patches-4.1/102-ehci_hcd_ignore_oc.patch b/target/linux/generic/patches-4.1/102-ehci_hcd_ignore_oc.patch deleted file mode 100644 index 4da579cedc..0000000000 --- a/target/linux/generic/patches-4.1/102-ehci_hcd_ignore_oc.patch +++ /dev/null @@ -1,82 +0,0 @@ -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 -@@ -638,7 +638,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 -@@ -633,7 +633,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 -@@ -264,6 +264,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 -@@ -49,6 +49,7 @@ struct usb_ehci_pdata { - unsigned no_io_watchdog:1; - unsigned reset_on_resume:1; - unsigned dma_mask_64:1; -+ unsigned ignore_oc:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); diff --git a/target/linux/generic/patches-4.1/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/patches-4.1/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch deleted file mode 100644 index c5d8321b85..0000000000 --- a/target/linux/generic/patches-4.1/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch +++ /dev/null @@ -1,86 +0,0 @@ -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, -@@ -756,8 +756,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); -@@ -765,6 +784,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 -@@ -828,9 +850,14 @@ static int jffs2_rename (struct inode *o - if (d_is_dir(old_dentry) && !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/patches-4.1/111-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/patches-4.1/111-jffs2-add-RENAME_EXCHANGE-support.patch deleted file mode 100644 index e1f1b29e1e..0000000000 --- a/target/linux/generic/patches-4.1/111-jffs2-add-RENAME_EXCHANGE-support.patch +++ /dev/null @@ -1,58 +0,0 @@ -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 -@@ -784,7 +784,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 -@@ -792,7 +792,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 (d_really_is_positive(new_dentry)) { -+ if (d_really_is_positive(new_dentry) && !(flags & RENAME_EXCHANGE)) { - victim_f = JFFS2_INODE_INFO(d_inode(new_dentry)); - if (d_is_dir(new_dentry)) { - struct jffs2_full_dirent *fd; -@@ -827,7 +827,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 (d_is_dir(new_dentry)) - clear_nlink(d_inode(new_dentry)); -@@ -853,6 +853,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), -+ d_inode(new_dentry)->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), -@@ -884,7 +890,7 @@ static int jffs2_rename (struct inode *o - return ret; - } - -- if (d_is_dir(old_dentry)) -+ if (d_is_dir(old_dentry) && !(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/patches-4.1/120-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/patches-4.1/120-bridge_allow_receiption_on_disabled_port.patch deleted file mode 100644 index 41e322850f..0000000000 --- a/target/linux/generic/patches-4.1/120-bridge_allow_receiption_on_disabled_port.patch +++ /dev/null @@ -1,54 +0,0 @@ -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 -@@ -211,11 +211,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish - static int br_handle_local_finish(struct sock *sk, 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 */ - } - -@@ -289,6 +291,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, NULL, 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/patches-4.1/132-mips_inline_dma_ops.patch b/target/linux/generic/patches-4.1/132-mips_inline_dma_ops.patch deleted file mode 100644 index 0b38d9c699..0000000000 --- a/target/linux/generic/patches-4.1/132-mips_inline_dma_ops.patch +++ /dev/null @@ -1,697 +0,0 @@ -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 -@@ -1571,6 +1571,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 -@@ -1866,6 +1867,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,306 @@ 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_post_dma_flush(dev); -+ 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); -+ plat_post_dma_flush(dev); -+ 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); -+ } -+ plat_post_dma_flush(dev); -+ 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 +380,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 +393,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 +413,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 +432,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,35 +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. -- * -- * Note that the R14000 and R16000 should also be checked for in this -- * condition. However this function is only called on non-I/O-coherent -- * systems and only the R10000 and R12000 are used in such systems, the -- * SGI IP28 Indigo² rsp. SGI IP32 aka O2. -- */ --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; -@@ -130,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; -@@ -162,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, -@@ -172,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); -@@ -193,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) -@@ -221,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; - -@@ -251,110 +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_post_dma_flush(dev); -- 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); -- plat_post_dma_flush(dev); --} -- --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); -- plat_post_dma_flush(dev); --} -- --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) -@@ -367,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/patches-4.1/133-MIPS-UAPI-Ignore-__arch_swab-16-32-64-when-using-MIP.patch b/target/linux/generic/patches-4.1/133-MIPS-UAPI-Ignore-__arch_swab-16-32-64-when-using-MIP.patch deleted file mode 100644 index ebbe1bbaee..0000000000 --- a/target/linux/generic/patches-4.1/133-MIPS-UAPI-Ignore-__arch_swab-16-32-64-when-using-MIP.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 71a0a72456b48de972d7ed613b06a22a3aa9057f Mon Sep 17 00:00:00 2001 -From: Yousong Zhou -Date: Sat, 26 Sep 2015 13:41:43 +0800 -Subject: [PATCH] MIPS: UAPI: Ignore __arch_swab{16,32,64} when using MIPS16 - -Some GCC versions (e.g. 4.8.3) can incorrectly inline a function with -MIPS32 instructions into another function with MIPS16 code [1], causing -the assembler to genereate incorrect binary code or fail right away -complaining about unrecognized opcode. - -In the case of __arch_swab{16,32}, when inlined by the compiler with -flags `-mips32r2 -mips16 -Os', the assembler can fail with the following -error. - - {standard input}:79: Error: unrecognized opcode `wsbh $2,$2' - -For performance concerns and to workaround the issue already existing in -older compilers, just ignore these 2 functions when compiling with -mips16 enabled. - - [1] Inlining nomips16 function into mips16 function can result in - undefined builtins, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55777 - -Signed-off-by: Yousong Zhou -Cc: Maciej W. Rozycki -Cc: linux-mips@linux-mips.org -Patchwork: https://patchwork.linux-mips.org/patch/11241/ -Signed-off-by: Ralf Baechle ---- - arch/mips/include/uapi/asm/swab.h | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/arch/mips/include/uapi/asm/swab.h -+++ b/arch/mips/include/uapi/asm/swab.h -@@ -13,8 +13,9 @@ - - #define __SWAB_64_THRU_32__ - --#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ -- defined(_MIPS_ARCH_LOONGSON3A) -+#if !defined(__mips16) && \ -+ ((defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ -+ defined(_MIPS_ARCH_LOONGSON3A)) - - static inline __attribute_const__ __u16 __arch_swab16(__u16 x) - { -@@ -65,5 +66,5 @@ static inline __attribute_const__ __u64 - } - #define __arch_swab64 __arch_swab64 - #endif /* __mips64 */ --#endif /* MIPS R2 or newer or Loongson 3A */ -+#endif /* (not __mips16) and (MIPS R2 or newer or Loongson 3A) */ - #endif /* _ASM_SWAB_H */ diff --git a/target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch deleted file mode 100644 index 18ec833f70..0000000000 --- a/target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ /dev/null @@ -1,175 +0,0 @@ -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 -@@ -112,45 +112,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; -@@ -310,10 +274,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 - -@@ -719,6 +720,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! - */ -@@ -754,6 +789,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; -@@ -772,6 +814,7 @@ int parse_mtd_partitions(struct mtd_info - break; - } - } -+ kfree(types_of); - return ret; - } - diff --git a/target/linux/generic/patches-4.1/141-Revert-mtd-spi-nor-disable-protection-for-Winbond-fl.patch b/target/linux/generic/patches-4.1/141-Revert-mtd-spi-nor-disable-protection-for-Winbond-fl.patch deleted file mode 100644 index 3d4b64ea6f..0000000000 --- a/target/linux/generic/patches-4.1/141-Revert-mtd-spi-nor-disable-protection-for-Winbond-fl.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Felix Fietkau -Date: Thu, 26 Nov 2015 17:03:46 +0100 -Subject: [PATCH] Revert "mtd: spi-nor: disable protection for Winbond flash at - startup" - -This reverts commit c6fc2171b249e73745c497b578b417a2946f1b2f. - -This commit is breaking read access on at least s25fl064k, but also -possibly other Spansion flash chips. - -Any mtd read seems to succeed, but simply returns a zero-filled buffer. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1194,14 +1194,13 @@ int spi_nor_scan(struct spi_nor *nor, co - mutex_init(&nor->lock); - - /* -- * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up -- * with the software protection bits set -+ * Atmel, SST and Intel/Numonyx serial nor tend to power -+ * up with the software protection bits set - */ - - if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || - JEDEC_MFR(info) == SNOR_MFR_INTEL || -- JEDEC_MFR(info) == SNOR_MFR_SST || -- JEDEC_MFR(info) == SNOR_MFR_WINBOND) { -+ JEDEC_MFR(info) == SNOR_MFR_SST) { - write_enable(nor); - write_sr(nor, 0); - } diff --git a/target/linux/generic/patches-4.1/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch b/target/linux/generic/patches-4.1/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch deleted file mode 100644 index b0a064fb4e..0000000000 --- a/target/linux/generic/patches-4.1/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 72fc448c4c970bdbba604ab340f16080b4f3bb17 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 26 Nov 2015 08:52:09 +0100 -Subject: [PATCH] mtd: spi-nor: include mtd.h header for struct mtd_info - definition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So far struct spi_nor was using just a pointer to struct mtd_info so it -wasn't needed to have it fully defined there. After recent change we -embed whole struct so we need to include a proper header. - -Fixes: 1976367173a4 ("mtd: spi-nor: embed struct mtd_info within struct spi_nor") -Signed-off-by: Rafał Miłecki ---- - include/linux/mtd/spi-nor.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -12,6 +12,7 @@ - - #include - #include -+#include - - /* - * Manufacturer IDs -@@ -117,8 +118,6 @@ enum spi_nor_option_flags { - SNOR_F_USE_FSR = BIT(0), - }; - --struct mtd_info; -- - /** - * struct spi_nor - Structure for defining a the SPI NOR layer - * @mtd: point to a mtd_info structure diff --git a/target/linux/generic/patches-4.1/143-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch b/target/linux/generic/patches-4.1/143-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch deleted file mode 100644 index 761cff316d..0000000000 --- a/target/linux/generic/patches-4.1/143-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sat, 5 Dec 2015 02:03:32 +0100 -Subject: [PATCH] mtd: bcm47xxpart: limit scanned flash area on BCM47XX (MIPS) - only -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We allowed using bcm47xxpart on BCM5301X arch with commit: -9e3afa5f5c7 ("mtd: bcm47xxpart: allow enabling on ARCH_BCM_5301X") - -BCM5301X devices may contain some partitions in higher memory, e.g. -Netgear R8000 has board_data at 0x2600000. To detect them we should -use size limit on MIPS only. - -Signed-off-by: Rafał Miłecki ---- - drivers/mtd/bcm47xxpart.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -118,8 +118,8 @@ static int bcm47xxpart_parse(struct mtd_ - /* Parse block by block looking for magics */ - for (offset = 0; offset <= master->size - blocksize; - offset += blocksize) { -- /* Nothing more in higher memory */ -- if (offset >= 0x2000000) -+ /* Nothing more in higher memory on BCM47XX (MIPS) */ -+ if (config_enabled(CONFIG_BCM47XX) && offset >= 0x2000000) - break; - - if (curr_part >= BCM47XXPART_MAX_PARTS) { diff --git a/target/linux/generic/patches-4.1/144-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch b/target/linux/generic/patches-4.1/144-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch deleted file mode 100644 index 9073f795e2..0000000000 --- a/target/linux/generic/patches-4.1/144-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch +++ /dev/null @@ -1,92 +0,0 @@ -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; - } - -@@ -254,10 +258,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; - } - -@@ -277,10 +282,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/patches-4.1/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch b/target/linux/generic/patches-4.1/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch deleted file mode 100644 index a17e39800c..0000000000 --- a/target/linux/generic/patches-4.1/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch +++ /dev/null @@ -1,41 +0,0 @@ -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/patches-4.1/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch b/target/linux/generic/patches-4.1/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch deleted file mode 100644 index 02644d0583..0000000000 --- a/target/linux/generic/patches-4.1/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch +++ /dev/null @@ -1,232 +0,0 @@ -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 -@@ -685,6 +685,8 @@ static void cdc_ncm_free(struct cdc_ncm_ - ctx->tx_curr_skb = NULL; - } - -+ kfree(ctx->delayed_ndp16); -+ - kfree(ctx); - } - -@@ -715,7 +717,7 @@ static const struct net_device_ops cdc_n - .ndo_validate_addr = eth_validate_addr, - }; - --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; -@@ -894,6 +896,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; - -@@ -996,8 +1009,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 */ -- ret = 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. -+ */ -+ ret = cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM, 0); - - /* - * We should get an event when network connection is "connected" or -@@ -1028,6 +1044,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); -@@ -1037,7 +1061,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) -@@ -1050,7 +1075,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; -@@ -1065,6 +1094,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) { -@@ -1119,7 +1157,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); -@@ -1192,6 +1230,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; -@@ -134,7 +139,7 @@ struct cdc_ncm_ctx { - - u8 cdc_ncm_select_altsetting(struct usb_interface *intf); - int cdc_ncm_change_mtu(struct net_device *net, int new_mtu); --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/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch deleted file mode 100644 index c7bf45a2a8..0000000000 --- a/target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch +++ /dev/null @@ -1,96 +0,0 @@ -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 -@@ -824,6 +824,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) */ -@@ -855,10 +856,24 @@ 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) - { - struct usb_device_id *id = (struct usb_device_id *)prod; -+ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; - - /* Workaround to enable dynamic IDs. This disables usbnet - * blacklisting functionality. Which, if required, can be -@@ -870,6 +885,12 @@ static int qmi_wwan_probe(struct usb_int - id->driver_info = (unsigned long)&qmi_wwan_info; - } - -+ /* 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/patches-4.1/200-fix_localversion.patch b/target/linux/generic/patches-4.1/200-fix_localversion.patch deleted file mode 100644 index 70228bb5f4..0000000000 --- a/target/linux/generic/patches-4.1/200-fix_localversion.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches-4.1/201-extra_optimization.patch b/target/linux/generic/patches-4.1/201-extra_optimization.patch deleted file mode 100644 index 34ded8c7eb..0000000000 --- a/target/linux/generic/patches-4.1/201-extra_optimization.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -612,9 +612,9 @@ include arch/$(SRCARCH)/Makefile - KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) - - 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/patches-4.1/202-reduce_module_size.patch b/target/linux/generic/patches-4.1/202-reduce_module_size.patch deleted file mode 100644 index 60ea5c2085..0000000000 --- a/target/linux/generic/patches-4.1/202-reduce_module_size.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches-4.1/203-kallsyms_uncompressed.patch b/target/linux/generic/patches-4.1/203-kallsyms_uncompressed.patch deleted file mode 100644 index 10cfc83d78..0000000000 --- a/target/linux/generic/patches-4.1/203-kallsyms_uncompressed.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- 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; -@@ -403,6 +404,9 @@ static void write_src(void) - - free(markers); - -+ if (uncompressed) -+ return; -+ - output_label("kallsyms_token_table"); - off = 0; - for (i = 0; i < 256; i++) { -@@ -461,6 +465,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]; -@@ -533,6 +540,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--) { -@@ -703,7 +713,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 -@@ -1334,6 +1334,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/patches-4.1/204-module_strip.patch b/target/linux/generic/patches-4.1/204-module_strip.patch deleted file mode 100644 index 4f5f6474ee..0000000000 --- a/target/linux/generic/patches-4.1/204-module_strip.patch +++ /dev/null @@ -1,194 +0,0 @@ -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,9 +84,10 @@ 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) -+#define MODULE_ALIAS(_alias) MODULE_INFO_STRIP(alias, _alias) - - /* Soft module dependencies. See man modprobe.d for details. - * Example: MODULE_SOFTDEP("pre: module-foo module-bar post: module-baz") -@@ -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 -@@ -1998,6 +1998,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 -@@ -2709,6 +2709,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; - -@@ -2734,6 +2735,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 -@@ -1959,7 +1959,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)) -@@ -2103,7 +2105,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"); -@@ -2120,16 +2124,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 - } - - /** -@@ -2222,11 +2230,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) -@@ -2457,7 +2467,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/patches-4.1/205-backtrace_module_info.patch b/target/linux/generic/patches-4.1/205-backtrace_module_info.patch deleted file mode 100644 index 48b2204ab4..0000000000 --- a/target/linux/generic/patches-4.1/205-backtrace_module_info.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/lib/vsprintf.c -+++ b/lib/vsprintf.c -@@ -617,8 +617,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') -@@ -632,15 +634,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/patches-4.1/210-darwin_scripts_include.patch b/target/linux/generic/patches-4.1/210-darwin_scripts_include.patch deleted file mode 100644 index ef548c730d..0000000000 --- a/target/linux/generic/patches-4.1/210-darwin_scripts_include.patch +++ /dev/null @@ -1,3088 +0,0 @@ ---- 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 -@@ -149,6 +149,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/patches-4.1/212-byteshift_portability.patch b/target/linux/generic/patches-4.1/212-byteshift_portability.patch deleted file mode 100644 index 0f23ba9be9..0000000000 --- a/target/linux/generic/patches-4.1/212-byteshift_portability.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- 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/patches-4.1/214-spidev_h_portability.patch b/target/linux/generic/patches-4.1/214-spidev_h_portability.patch deleted file mode 100644 index dbee090547..0000000000 --- a/target/linux/generic/patches-4.1/214-spidev_h_portability.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/uapi/linux/spi/spidev.h -+++ b/include/uapi/linux/spi/spidev.h -@@ -111,7 +111,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/patches-4.1/220-gc_sections.patch b/target/linux/generic/patches-4.1/220-gc_sections.patch deleted file mode 100644 index d18fabafbc..0000000000 --- a/target/linux/generic/patches-4.1/220-gc_sections.patch +++ /dev/null @@ -1,536 +0,0 @@ -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,10 +123,10 @@ - #ifdef CONFIG_EVENT_TRACING - #define FTRACE_EVENTS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_ftrace_events) = .; \ -- *(_ftrace_events) \ -+ KEEP(*(_ftrace_events)) \ - VMLINUX_SYMBOL(__stop_ftrace_events) = .; \ - VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \ -- *(_ftrace_enum_map) \ -+ KEEP(*(_ftrace_enum_map)) \ - VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .; - #else - #define FTRACE_EVENTS() -@@ -134,7 +134,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 */ \ -@@ -147,7 +147,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() -@@ -169,8 +169,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) -@@ -184,7 +184,7 @@ - #define KERNEL_DTB() \ - STRUCT_ALIGN(); \ - VMLINUX_SYMBOL(__dtb_start) = .; \ -- *(.dtb.init.rodata) \ -+ KEEP(*(.dtb.init.rodata)) \ - VMLINUX_SYMBOL(__dtb_end) = .; - - /* .data section */ -@@ -200,16 +200,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 -@@ -263,35 +264,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) = .; \ - } \ - \ -@@ -300,49 +301,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) = .; \ - } \ - \ -@@ -356,14 +357,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) = .; \ - } \ - \ -@@ -382,14 +383,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) = .; \ -@@ -445,7 +446,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 -@@ -473,7 +474,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) = .; \ - } - -@@ -489,9 +490,9 @@ - #ifdef CONFIG_CONSTRUCTORS - #define KERNEL_CTORS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__ctors_start) = .; \ -- *(.ctors) \ -+ KEEP(*(.ctors)) \ - *(SORT(.init_array.*)) \ -- *(.init_array) \ -+ KEEP(*(.init_array)) \ - VMLINUX_SYMBOL(__ctors_end) = .; - #else - #define KERNEL_CTORS() -@@ -546,7 +547,7 @@ - #define SBSS(sbss_align) \ - . = ALIGN(sbss_align); \ - .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ -- *(.sbss) \ -+ *(.sbss .sbss.*) \ - *(.scommon) \ - } - -@@ -564,7 +565,7 @@ - BSS_FIRST_SECTIONS \ - *(.bss..page_aligned) \ - *(.dynbss) \ -- *(.bss) \ -+ *(.bss .bss.*) \ - *(COMMON) \ - } - -@@ -613,7 +614,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 -@@ -625,7 +626,7 @@ - . = ALIGN(4); \ - .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__tracedata_start) = .; \ -- *(.tracedata) \ -+ KEEP(*(.tracedata)) \ - VMLINUX_SYMBOL(__tracedata_end) = .; \ - } - #else -@@ -642,17 +643,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) \ -@@ -666,21 +667,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 -@@ -15,13 +15,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(PAGE_SIZE); \ - VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ -@@ -102,7 +102,7 @@ SECTIONS - _stext = .; /* Text and read-only data */ - IDMAP_TEXT - __exception_text_start = .; -- *(.exception.text) -+ KEEP(*(.exception.text)) - __exception_text_end = .; - IRQENTRY_TEXT - TEXT_TEXT -@@ -126,7 +126,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 = .; - } -@@ -138,12 +138,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 -@@ -166,14 +166,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 = .; -@@ -187,24 +187,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 -@@ -107,6 +107,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/patches-4.1/221-module_exports.patch b/target/linux/generic/patches-4.1/221-module_exports.patch deleted file mode 100644 index 38ea10a47f..0000000000 --- a/target/linux/generic/patches-4.1/221-module_exports.patch +++ /dev/null @@ -1,88 +0,0 @@ ---- 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. */ -@@ -301,14 +311,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) = .; \ - } \ - \ -@@ -370,7 +380,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- *(__ksymtab_strings) \ -+ *(__ksymtab_strings+*) \ - } \ - \ - /* __*init sections */ \ -@@ -700,6 +710,8 @@ - EXIT_TEXT \ - EXIT_DATA \ - EXIT_CALL \ -+ SYMTAB_DISCARD \ -+ SYMTAB_DISCARD_GPL \ - *(.discard) \ - *(.discard.*) \ - } ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -299,7 +299,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/patches-4.1/222-perf-build-Do-not-fail-on-missing-Build-file.patch b/target/linux/generic/patches-4.1/222-perf-build-Do-not-fail-on-missing-Build-file.patch deleted file mode 100644 index 2026e4da8d..0000000000 --- a/target/linux/generic/patches-4.1/222-perf-build-Do-not-fail-on-missing-Build-file.patch +++ /dev/null @@ -1,57 +0,0 @@ -From d7a3d85e08477a979933a2bb3b525a8de99543c2 Mon Sep 17 00:00:00 2001 -From: Jiri Olsa -Date: Fri, 29 May 2015 17:42:58 +0200 -Subject: [PATCH] perf build: Do not fail on missing Build file - -Allow nesting into directories without Build file. Currently we force -include of the Build file, which fails the build when the Build file is -missing. - -We already support empty *-in.o' objects if there's nothing in the -directory to be compiled, so we can just use it for missing Build file -cases. - -Also adding this case under tests. - -Reported-by: Rabin Vincent -Signed-off-by: Jiri Olsa -Cc: David Ahern -Cc: Namhyung Kim -Cc: Paul Mackerras -Cc: Peter Zijlstra -Cc: Rabin Vincent -Link: http://lkml.kernel.org/r/1432914178-24086-1-git-send-email-jolsa@kernel.org -Signed-off-by: Arnaldo Carvalho de Melo ---- - tools/build/Makefile.build | 2 +- - tools/build/tests/ex/Build | 1 + - tools/build/tests/ex/empty2/README | 2 ++ - 3 files changed, 4 insertions(+), 1 deletion(-) - create mode 100644 tools/build/tests/ex/empty2/README - ---- a/tools/build/Makefile.build -+++ b/tools/build/Makefile.build -@@ -37,7 +37,7 @@ subdir-obj-y := - - # Build definitions - build-file := $(dir)/Build --include $(build-file) -+-include $(build-file) - - quiet_cmd_flex = FLEX $@ - quiet_cmd_bison = BISON $@ ---- a/tools/build/tests/ex/Build -+++ b/tools/build/tests/ex/Build -@@ -2,6 +2,7 @@ ex-y += ex.o - ex-y += a.o - ex-y += b.o - ex-y += empty/ -+ex-y += empty2/ - - libex-y += c.o - libex-y += d.o ---- /dev/null -+++ b/tools/build/tests/ex/empty2/README -@@ -0,0 +1,2 @@ -+This directory is left intentionally without Build file -+to test proper nesting into Build-less directories. diff --git a/target/linux/generic/patches-4.1/230-openwrt_lzma_options.patch b/target/linux/generic/patches-4.1/230-openwrt_lzma_options.patch deleted file mode 100644 index d5bbb19cfe..0000000000 --- a/target/linux/generic/patches-4.1/230-openwrt_lzma_options.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -324,7 +324,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 - { {0x1f, 0x9e}, "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/patches-4.1/250-netfilter_depends.patch b/target/linux/generic/patches-4.1/250-netfilter_depends.patch deleted file mode 100644 index 2b0815dbfb..0000000000 --- a/target/linux/generic/patches-4.1/250-netfilter_depends.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- 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 -@@ -914,7 +913,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/patches-4.1/251-sound_kconfig.patch b/target/linux/generic/patches-4.1/251-sound_kconfig.patch deleted file mode 100644 index c2ebacecd1..0000000000 --- a/target/linux/generic/patches-4.1/251-sound_kconfig.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- 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/patches-4.1/252-mv_cesa_depends.patch b/target/linux/generic/patches-4.1/252-mv_cesa_depends.patch deleted file mode 100644 index fee28db120..0000000000 --- a/target/linux/generic/patches-4.1/252-mv_cesa_depends.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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/patches-4.1/253-ssb_b43_default_on.patch b/target/linux/generic/patches-4.1/253-ssb_b43_default_on.patch deleted file mode 100644 index 29d2a41a3b..0000000000 --- a/target/linux/generic/patches-4.1/253-ssb_b43_default_on.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- 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/patches-4.1/254-textsearch_kconfig_hacks.patch b/target/linux/generic/patches-4.1/254-textsearch_kconfig_hacks.patch deleted file mode 100644 index d682d4e65e..0000000000 --- a/target/linux/generic/patches-4.1/254-textsearch_kconfig_hacks.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -328,16 +328,16 @@ config BCH_CONST_T - # Textsearch support is select'ed if needed - # - config TEXTSEARCH -- bool -+ 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 - bool diff --git a/target/linux/generic/patches-4.1/255-lib80211_kconfig_hacks.patch b/target/linux/generic/patches-4.1/255-lib80211_kconfig_hacks.patch deleted file mode 100644 index 8064b0212b..0000000000 --- a/target/linux/generic/patches-4.1/255-lib80211_kconfig_hacks.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -191,7 +191,7 @@ config CFG80211_WEXT_EXPORT - wext compatibility symbols to be exported. - - config LIB80211 -- tristate -+ tristate "LIB80211" - default n - help - This options enables a library of common routines used -@@ -200,13 +200,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/patches-4.1/256-crypto_add_kconfig_prompts.patch b/target/linux/generic/patches-4.1/256-crypto_add_kconfig_prompts.patch deleted file mode 100644 index f9f6c0ea7b..0000000000 --- a/target/linux/generic/patches-4.1/256-crypto_add_kconfig_prompts.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- 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/patches-4.1/257-wireless_ext_kconfig_hack.patch b/target/linux/generic/patches-4.1/257-wireless_ext_kconfig_hack.patch deleted file mode 100644 index daac5898ae..0000000000 --- a/target/linux/generic/patches-4.1/257-wireless_ext_kconfig_hack.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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/patches-4.1/258-netfilter_netlink_kconfig_hack.patch b/target/linux/generic/patches-4.1/258-netfilter_netlink_kconfig_hack.patch deleted file mode 100644 index 9d827c253b..0000000000 --- a/target/linux/generic/patches-4.1/258-netfilter_netlink_kconfig_hack.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches-4.1/259-regmap_dynamic.patch b/target/linux/generic/patches-4.1/259-regmap_dynamic.patch deleted file mode 100644 index a4bdae6aec..0000000000 --- a/target/linux/generic/patches-4.1/259-regmap_dynamic.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -3,29 +3,35 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) - select LZO_COMPRESS - select LZO_DECOMPRESS - select IRQ_DOMAIN if REGMAP_IRQ -- bool -+ tristate "Regmap" - - config REGMAP_AC97 -+ select REGMAP - tristate - - 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 -@@ -50,7 +50,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,9 +1,11 @@ - # For include/trace/define_trace.h to include trace.h - CFLAGS_regmap.o := -I$(src) - --obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o --obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-lzo.o regcache-flat.o -+ifdef CONFIG_DEBUG_FS -+regmap-core-objs += regmap-debugfs.o -+endif -+obj-$(CONFIG_REGMAP) += regmap-core.o - obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2631,3 +2632,5 @@ static int __init regmap_initcall(void) - return 0; - } - postcore_initcall(regmap_initcall); -+ -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/patches-4.1/260-crypto_test_dependencies.patch b/target/linux/generic/patches-4.1/260-crypto_test_dependencies.patch deleted file mode 100644 index 8a96fd9da7..0000000000 --- a/target/linux/generic/patches-4.1/260-crypto_test_dependencies.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- 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/patches-4.1/270-uapi-kernel.h-glibc-specific-inclusion-of-sysinfo.h.patch b/target/linux/generic/patches-4.1/270-uapi-kernel.h-glibc-specific-inclusion-of-sysinfo.h.patch deleted file mode 100644 index 762f4989b6..0000000000 --- a/target/linux/generic/patches-4.1/270-uapi-kernel.h-glibc-specific-inclusion-of-sysinfo.h.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8b05e325824d3b38e52a7748b3b5dc34dc1c0f6d Mon Sep 17 00:00:00 2001 -From: David Heidelberger -Date: Mon, 29 Jun 2015 14:37:54 +0200 -Subject: [PATCH 1/3] uapi/kernel.h: glibc specific inclusion of sysinfo.h - -including sysinfo.h from kernel.h makes no sense whatsoever, -but removing it breaks glibc's userspace header, -which includes kernel.h instead of sysinfo.h from their sys/sysinfo.h. -this seems to be a historical mistake. -on musl, including any header that uses kernel.h directly or indirectly -plus sys/sysinfo.h will produce a compile error due to redefinition of -struct sysinfo from sys/sysinfo.h. -so for now, only include it on glibc or when including from kernel -in order not to break their headers. - -Signed-off-by: John Spencer -Signed-off-by: David Heidelberger -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/kernel.h | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/include/uapi/linux/kernel.h -+++ b/include/uapi/linux/kernel.h -@@ -1,7 +1,9 @@ - #ifndef _UAPI_LINUX_KERNEL_H - #define _UAPI_LINUX_KERNEL_H - -+#if defined(__KERNEL__) || defined( __GLIBC__) - #include -+#endif - - /* - * 'kernel.h' contains some often-used function prototypes etc diff --git a/target/linux/generic/patches-4.1/271-uapi-libc-compat.h-do-not-rely-on-__GLIBC__.patch b/target/linux/generic/patches-4.1/271-uapi-libc-compat.h-do-not-rely-on-__GLIBC__.patch deleted file mode 100644 index 61d3873c01..0000000000 --- a/target/linux/generic/patches-4.1/271-uapi-libc-compat.h-do-not-rely-on-__GLIBC__.patch +++ /dev/null @@ -1,81 +0,0 @@ -From f972afc2509eebcb00d370256c55b112a3b5ffca Mon Sep 17 00:00:00 2001 -From: David Heidelberger -Date: Mon, 29 Jun 2015 16:50:40 +0200 -Subject: [PATCH 2/3] uapi/libc-compat.h: do not rely on __GLIBC__ - -Musl provides the same structs as glibc, but does not provide a define to -allow its detection. Since the absence of __GLIBC__ also can mean that it -is included from the kernel, change the __GLIBC__ detection to -!__KERNEL__, which should always be true when included from userspace. - -Signed-off-by: John Spencer -Tested-by: David Heidelberger -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/libc-compat.h | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -48,13 +48,13 @@ - #ifndef _UAPI_LIBC_COMPAT_H - #define _UAPI_LIBC_COMPAT_H - --/* We have included glibc headers... */ --#if defined(__GLIBC__) -+/* We have included libc headers... */ -+#if !defined(__KERNEL__) - --/* Coordinate with glibc netinet/in.h header. */ -+/* Coordinate with libc netinet/in.h header. */ - #if defined(_NETINET_IN_H) - --/* GLIBC headers included first so don't define anything -+/* LIBC 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 -@@ -68,7 +68,7 @@ - * if the glibc code didn't define them. This guard matches - * the guard in glibc/inet/netinet/in.h which defines the - * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */ --#if defined(__USE_MISC) || defined (__USE_GNU) -+#if !defined(__GLIBC__) || defined(__USE_MISC) || defined (__USE_GNU) - #define __UAPI_DEF_IN6_ADDR_ALT 0 - #else - #define __UAPI_DEF_IN6_ADDR_ALT 1 -@@ -83,7 +83,7 @@ - #else - - /* Linux headers included first, and we must define everything -- * we need. The expectation is that glibc will check the -+ * we need. The expectation is that the libc will check the - * __UAPI_DEF_* defines and adjust appropriately. */ - #define __UAPI_DEF_IN_ADDR 1 - #define __UAPI_DEF_IN_IPPROTO 1 -@@ -93,7 +93,7 @@ - #define __UAPI_DEF_IN_CLASS 1 - - #define __UAPI_DEF_IN6_ADDR 1 --/* We unconditionally define the in6_addr macros and glibc must -+/* We unconditionally define the in6_addr macros and the libc must - * coordinate. */ - #define __UAPI_DEF_IN6_ADDR_ALT 1 - #define __UAPI_DEF_SOCKADDR_IN6 1 -@@ -115,7 +115,7 @@ - /* 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. */ --#else /* !defined(__GLIBC__) */ -+#else /* defined(__KERNEL__) */ - - /* Definitions for in.h */ - #define __UAPI_DEF_IN_ADDR 1 -@@ -138,6 +138,6 @@ - /* Definitions for xattr.h */ - #define __UAPI_DEF_XATTR 1 - --#endif /* __GLIBC__ */ -+#endif /* __KERNEL__ */ - - #endif /* _UAPI_LIBC_COMPAT_H */ diff --git a/target/linux/generic/patches-4.1/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch b/target/linux/generic/patches-4.1/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch deleted file mode 100644 index 257c9d7e99..0000000000 --- a/target/linux/generic/patches-4.1/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch +++ /dev/null @@ -1,67 +0,0 @@ -From fcbb6fed85ea9ff4feb4f1ebd4f0f235fdaf06b6 Mon Sep 17 00:00:00 2001 -From: David Heidelberger -Date: Mon, 29 Jun 2015 16:53:03 +0200 -Subject: [PATCH 3/3] 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. - -Signed-off-by: John Spencer -Tested-by: David Heidelberger -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/if_ether.h | 3 +++ - include/uapi/linux/libc-compat.h | 11 +++++++++++ - 2 files changed, 14 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 -@@ -134,11 +135,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 -@@ -51,6 +51,14 @@ - /* We have included libc headers... */ - #if !defined(__KERNEL__) - -+/* musl defines the ethhdr struct itself in its netinet/if_ether.h. -+ * Glibc just includes the kernel header and uses a different guard. */ -+#if defined(_NETINET_IF_ETHER_H) -+#define __UAPI_DEF_ETHHDR 0 -+#else -+#define __UAPI_DEF_ETHHDR 1 -+#endif -+ - /* Coordinate with libc netinet/in.h header. */ - #if defined(_NETINET_IN_H) - -@@ -117,6 +125,9 @@ - * that we need. */ - #else /* defined(__KERNEL__) */ - -+/* Definitions for if_ether.h */ -+#define __UAPI_DEF_ETHHDR 1 -+ - /* Definitions for in.h */ - #define __UAPI_DEF_IN_ADDR 1 - #define __UAPI_DEF_IN_IPPROTO 1 diff --git a/target/linux/generic/patches-4.1/300-mips_expose_boot_raw.patch b/target/linux/generic/patches-4.1/300-mips_expose_boot_raw.patch deleted file mode 100644 index b9cf5ba25a..0000000000 --- a/target/linux/generic/patches-4.1/300-mips_expose_boot_raw.patch +++ /dev/null @@ -1,39 +0,0 @@ -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 -@@ -984,9 +984,6 @@ config FW_ARC - config ARCH_MAY_HAVE_PC_FDC - bool - --config BOOT_RAW -- bool -- - config CEVT_BCM1480 - bool - -@@ -2677,6 +2674,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/patches-4.1/301-mips_image_cmdline_hack.patch b/target/linux/generic/patches-4.1/301-mips_image_cmdline_hack.patch deleted file mode 100644 index f85310401d..0000000000 --- a/target/linux/generic/patches-4.1/301-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1073,6 +1073,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/patches-4.1/302-mips_no_branch_likely.patch b/target/linux/generic/patches-4.1/302-mips_no_branch_likely.patch deleted file mode 100644 index 44c6b04fcf..0000000000 --- a/target/linux/generic/patches-4.1/302-mips_no_branch_likely.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches-4.1/304-mips_disable_fpu.patch b/target/linux/generic/patches-4.1/304-mips_disable_fpu.patch deleted file mode 100644 index 646fe53ad1..0000000000 --- a/target/linux/generic/patches-4.1/304-mips_disable_fpu.patch +++ /dev/null @@ -1,106 +0,0 @@ -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 -@@ -2669,6 +2669,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 -@@ -292,7 +292,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 -@@ -218,8 +218,10 @@ static inline int init_fpu(void) - /* Restore FRE */ - write_c0_config5(config5); - enable_fpu_hazard(); -- } 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 { -@@ -66,6 +67,21 @@ 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) -+{ -+ *fault_addr = NULL; -+ return SIGILL; /* we don't speak MIPS FPU */ -+} -+#endif /* CONFIG_MIPS_FPU_EMULATOR */ -+ - int process_fpemu_return(int sig, void __user *fault_addr, - unsigned long fcr31); - int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, diff --git a/target/linux/generic/patches-4.1/305-mips_module_reloc.patch b/target/linux/generic/patches-4.1/305-mips_module_reloc.patch deleted file mode 100644 index 8b3975fe09..0000000000 --- a/target/linux/generic/patches-4.1/305-mips_module_reloc.patch +++ /dev/null @@ -1,352 +0,0 @@ ---- 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,221 @@ 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); -+ -+ /* mark all pages except for the last one */ -+ for (p = page; p + 1 < page + (size >> PAGE_SHIFT); ++p) -+ set_bit(PG_owner_priv_1, &p->flags); -+ -+ 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) -+{ -+ struct page *page; -+ bool free; -+ -+ page = virt_to_page(ptr); -+ do { -+ free = test_and_clear_bit(PG_owner_priv_1, &page->flags); -+ __free_page(page); -+ page++; -+ } while (free); -+} -+ -+ - void *module_alloc(unsigned long size) - { -+#ifdef MODULE_START - return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, - GFP_KERNEL, PAGE_KERNEL, 0, 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_memfree(void *module_region) -+{ -+ if (is_phys_addr(module_region)) -+ free_phys(module_region); -+ 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 +271,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 +311,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 +528,33 @@ 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->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/patches-4.1/306-mips_mem_functions_performance.patch b/target/linux/generic/patches-4.1/306-mips_mem_functions_performance.patch deleted file mode 100644 index 9818677425..0000000000 --- a/target/linux/generic/patches-4.1/306-mips_mem_functions_performance.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- 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/patches-4.1/307-mips_highmem_offset.patch b/target/linux/generic/patches-4.1/307-mips_highmem_offset.patch deleted file mode 100644 index 5a7dc9cee9..0000000000 --- a/target/linux/generic/patches-4.1/307-mips_highmem_offset.patch +++ /dev/null @@ -1,17 +0,0 @@ -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/patches-4.1/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/patches-4.1/310-arm_module_unresolved_weak_sym.patch deleted file mode 100644 index 9210c1d2d3..0000000000 --- a/target/linux/generic/patches-4.1/310-arm_module_unresolved_weak_sym.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 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/patches-4.1/320-ppc4xx_optimization.patch b/target/linux/generic/patches-4.1/320-ppc4xx_optimization.patch deleted file mode 100644 index 7ea4479c20..0000000000 --- a/target/linux/generic/patches-4.1/320-ppc4xx_optimization.patch +++ /dev/null @@ -1,31 +0,0 @@ -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 -@@ -48,10 +48,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/patches-4.1/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/patches-4.1/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index ab6ea7beb2..0000000000 --- a/target/linux/generic/patches-4.1/321-powerpc_crtsavres_prereq.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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/patches-4.1/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/patches-4.1/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch deleted file mode 100644 index a69d197e62..0000000000 --- a/target/linux/generic/patches-4.1/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch +++ /dev/null @@ -1,298 +0,0 @@ -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/patches-4.1/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch deleted file mode 100644 index ba64e093a9..0000000000 --- a/target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- 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 -@@ -29,11 +29,13 @@ - #include - #include - #include -+#include - #include - #include - #include - - #include "mtdcore.h" -+#include "mtdsplit/mtdsplit.h" - - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); -@@ -47,13 +49,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. -@@ -579,8 +582,10 @@ static int mtd_add_partition_attrs(struc - return ret; - } - --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 *new; -@@ -612,6 +617,7 @@ int mtd_add_partition(struct mtd_info *m - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&new->mtd); -+ mtd_partition_split(master, new); - - mtd_add_partition_attrs(new); - -@@ -619,6 +625,12 @@ int mtd_add_partition(struct mtd_info *m - } - 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; -@@ -644,6 +656,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 -@@ -673,6 +714,7 @@ int add_mtd_partitions(struct mtd_info * - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&slave->mtd); -+ mtd_partition_split(master, slave); - mtd_add_partition_attrs(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/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch deleted file mode 100644 index 31dee98efd..0000000000 --- a/target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch +++ /dev/null @@ -1,113 +0,0 @@ -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 -@@ -745,6 +745,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); -@@ -860,6 +884,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/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch deleted file mode 100644 index 725dbe8b4d..0000000000 --- a/target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -656,6 +656,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 -@@ -664,6 +695,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, -@@ -678,6 +710,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/patches-4.1/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/patches-4.1/403-mtd-hook-mtdsplit-to-Kbuild.patch deleted file mode 100644 index 0cf1c38555..0000000000 --- a/target/linux/generic/patches-4.1/403-mtd-hook-mtdsplit-to-Kbuild.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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/patches-4.1/404-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch deleted file mode 100644 index 42e5cfdd45..0000000000 --- a/target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -453,14 +453,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; -@@ -687,6 +685,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 -@@ -971,6 +980,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 -@@ -334,6 +334,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/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch b/target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch deleted file mode 100644 index 430fd6f025..0000000000 --- a/target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- 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 -@@ -696,6 +696,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 -@@ -704,7 +735,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/patches-4.1/410-mtd-move-forward-declaration-of-struct-mtd_info.patch b/target/linux/generic/patches-4.1/410-mtd-move-forward-declaration-of-struct-mtd_info.patch deleted file mode 100644 index 78ebbf88ca..0000000000 --- a/target/linux/generic/patches-4.1/410-mtd-move-forward-declaration-of-struct-mtd_info.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- 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/patches-4.1/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch deleted file mode 100644 index e6e809cf3c..0000000000 --- a/target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -37,6 +37,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); -@@ -235,13 +237,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; - } - -@@ -249,7 +299,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; -@@ -522,17 +590,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/patches-4.1/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch deleted file mode 100644 index b7964e25b8..0000000000 --- a/target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -336,7 +336,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/patches-4.1/420-mtd-redboot_space.patch b/target/linux/generic/patches-4.1/420-mtd-redboot_space.patch deleted file mode 100644 index f74affcef7..0000000000 --- a/target/linux/generic/patches-4.1/420-mtd-redboot_space.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- 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/patches-4.1/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/patches-4.1/430-mtd-add-myloader-partition-parser.patch deleted file mode 100644 index fe74ad5927..0000000000 --- a/target/linux/generic/patches-4.1/430-mtd-add-myloader-partition-parser.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -179,6 +179,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/patches-4.1/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/patches-4.1/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch deleted file mode 100644 index 5ad82f1f51..0000000000 --- a/target/linux/generic/patches-4.1/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ /dev/null @@ -1,100 +0,0 @@ -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/patches-4.1/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/patches-4.1/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch deleted file mode 100644 index 9e5ca91e55..0000000000 --- a/target/linux/generic/patches-4.1/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ /dev/null @@ -1,42 +0,0 @@ -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/patches-4.1/440-block2mtd_init.patch b/target/linux/generic/patches-4.1/440-block2mtd_init.patch deleted file mode 100644 index eddb593c11..0000000000 --- a/target/linux/generic/patches-4.1/440-block2mtd_init.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -218,7 +219,7 @@ static void block2mtd_free_device(struct - - - static struct block2mtd_dev *add_device(char *devname, int erase_size, -- int timeout) -+ const char *mtdname, int timeout) - { - #ifndef MODULE - int i; -@@ -226,6 +227,7 @@ static struct block2mtd_dev *add_device( - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; - struct block_device *bdev = ERR_PTR(-ENODEV); - struct block2mtd_dev *dev; -+ struct mtd_partition *part; - char *name; - - if (!devname) -@@ -282,13 +284,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; -@@ -301,7 +306,11 @@ 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; - } -@@ -309,8 +318,7 @@ static struct block2mtd_dev *add_device( - 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: -@@ -383,7 +391,7 @@ static int block2mtd_setup2(const char * - /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char buf[80 + 12 + 80 + 8]; - char *str = buf; -- char *token[2]; -+ char *token[3]; - char *name; - size_t erase_size = PAGE_SIZE; - unsigned long timeout = MTD_DEFAULT_TIMEOUT; -@@ -397,7 +405,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) { -@@ -423,8 +431,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, timeout); -+ add_device(name, erase_size, token[2], timeout); - - return 0; - } -@@ -458,7 +468,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/patches-4.1/441-block2mtd_probe.patch b/target/linux/generic/patches-4.1/441-block2mtd_probe.patch deleted file mode 100644 index f78e80aefb..0000000000 --- a/target/linux/generic/patches-4.1/441-block2mtd_probe.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -391,7 +391,7 @@ static int block2mtd_setup2(const char * - /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char buf[80 + 12 + 80 + 8]; - char *str = buf; -- char *token[3]; -+ char *token[4]; - char *name; - size_t erase_size = PAGE_SIZE; - unsigned long timeout = MTD_DEFAULT_TIMEOUT; -@@ -405,7 +405,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) { -@@ -434,6 +434,9 @@ static int block2mtd_setup2(const char * - if (token[2] && (strlen(token[2]) + 1 > 80)) - pr_err("mtd device name too long\n"); - -+ if (token[3] && kstrtoul(token[3], 0, &timeout)) -+ pr_err("invalid timeout\n"); -+ - add_device(name, erase_size, token[2], timeout); - - return 0; -@@ -468,7 +471,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/patches-4.1/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch b/target/linux/generic/patches-4.1/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch deleted file mode 100644 index ffaf70696e..0000000000 --- a/target/linux/generic/patches-4.1/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- - 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 -@@ -865,6 +865,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/patches-4.1/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch b/target/linux/generic/patches-4.1/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch deleted file mode 100644 index 6a2092ce20..0000000000 --- a/target/linux/generic/patches-4.1/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches-4.1/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/patches-4.1/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch deleted file mode 100644 index 68fbd12466..0000000000 --- a/target/linux/generic/patches-4.1/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches-4.1/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/patches-4.1/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch deleted file mode 100644 index c437a140f0..0000000000 --- a/target/linux/generic/patches-4.1/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch +++ /dev/null @@ -1,18 +0,0 @@ -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 -@@ -1830,6 +1830,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/patches-4.1/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-4.1/465-m25p80-mx-disable-software-protection.patch deleted file mode 100644 index 1d62b4f718..0000000000 --- a/target/linux/generic/patches-4.1/465-m25p80-mx-disable-software-protection.patch +++ /dev/null @@ -1,14 +0,0 @@ -Disable software protection bits for Macronix flashes. - -Signed-off-by: Felix Fietkau - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1200,6 +1200,7 @@ int spi_nor_scan(struct spi_nor *nor, co - - if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || - JEDEC_MFR(info) == SNOR_MFR_INTEL || -+ JEDEC_MFR(info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(info) == SNOR_MFR_SST) { - write_enable(nor); - write_sr(nor, 0); diff --git a/target/linux/generic/patches-4.1/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/patches-4.1/480-mtd-set-rootfs-to-be-root-dev.patch deleted file mode 100644 index 8d3a1f4fff..0000000000 --- a/target/linux/generic/patches-4.1/480-mtd-set-rootfs-to-be-root-dev.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -448,6 +449,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/patches-4.1/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/patches-4.1/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch deleted file mode 100644 index 7afc1386b1..0000000000 --- a/target/linux/generic/patches-4.1/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ /dev/null @@ -1,76 +0,0 @@ -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 -@@ -1221,6 +1221,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)) { -+ pr_err("UBI error: 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); -+ pr_notice("UBI: 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) { -+ pr_err("UBI error: cannot attach mtd%d", mtd->index); -+ put_mtd_device(mtd); -+ } -+ } -+ } -+} -+ - static int __init ubi_init(void) - { - int err, i, k; -@@ -1313,6 +1356,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) { - pr_err("UBI error: block: cannot initialize, error %d", err); diff --git a/target/linux/generic/patches-4.1/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/patches-4.1/491-ubi-auto-create-ubiblock-device-for-rootfs.patch deleted file mode 100644 index 433d77b6c1..0000000000 --- a/target/linux/generic/patches-4.1/491-ubi-auto-create-ubiblock-device-for-rootfs.patch +++ /dev/null @@ -1,69 +0,0 @@ -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 -@@ -616,6 +616,44 @@ static void __init ubiblock_create_from_ - } - } - -+#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) -+ pr_err("UBI error: 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; -@@ -646,6 +684,10 @@ int __init ubiblock_init(void) - */ - ubiblock_create_from_param(); - -+ /* 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/patches-4.1/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/patches-4.1/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch deleted file mode 100644 index c4a672c964..0000000000 --- a/target/linux/generic/patches-4.1/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch +++ /dev/null @@ -1,54 +0,0 @@ -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 -@@ -438,7 +438,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 -@@ -532,6 +553,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/patches-4.1/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/patches-4.1/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch deleted file mode 100644 index 18737524e8..0000000000 --- a/target/linux/generic/patches-4.1/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch +++ /dev/null @@ -1,37 +0,0 @@ -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 -@@ -49,6 +49,7 @@ - #include - #include - #include -+#include - - #include "ubi-media.h" - #include "ubi.h" -@@ -439,6 +440,15 @@ int ubiblock_create(struct ubi_volume_in - add_disk(dev->gd); - dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)", - 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/patches-4.1/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/patches-4.1/494-mtd-ubi-add-EOF-marker-support.patch deleted file mode 100644 index dd5ee306ef..0000000000 --- a/target/linux/generic/patches-4.1/494-mtd-ubi-add-EOF-marker-support.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/mtd/ubi/attach.c -+++ b/drivers/mtd/ubi/attach.c -@@ -803,6 +803,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 -@@ -833,9 +840,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)) { -+ pr_notice("UBI: 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 -@@ -741,6 +741,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/patches-4.1/500-yaffs-Kbuild-integration.patch b/target/linux/generic/patches-4.1/500-yaffs-Kbuild-integration.patch deleted file mode 100644 index 2754c1a13d..0000000000 --- a/target/linux/generic/patches-4.1/500-yaffs-Kbuild-integration.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -33,6 +33,7 @@ source "fs/ocfs2/Kconfig" - source "fs/btrfs/Kconfig" - source "fs/nilfs2/Kconfig" - source "fs/f2fs/Kconfig" -+source "fs/yaffs2/Kconfig" - - config FS_DAX - bool "Direct Access (DAX) support" ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -127,3 +127,5 @@ obj-y += exofs/ # Multiple modules - obj-$(CONFIG_CEPH_FS) += ceph/ - obj-$(CONFIG_PSTORE) += pstore/ - obj-$(CONFIG_EFIVAR_FS) += efivarfs/ -+obj-$(CONFIG_YAFFS_FS) += yaffs2/ -+ diff --git a/target/linux/generic/patches-4.1/502-yaffs-fix-compat-tags-handling.patch b/target/linux/generic/patches-4.1/502-yaffs-fix-compat-tags-handling.patch deleted file mode 100644 index a18cf6fd7b..0000000000 --- a/target/linux/generic/patches-4.1/502-yaffs-fix-compat-tags-handling.patch +++ /dev/null @@ -1,239 +0,0 @@ -Subject: yaffs: fix compat tags handling - -Signed-off-by: Gabor Juhos ---- ---- a/fs/yaffs2/yaffs_tagscompat.c -+++ b/fs/yaffs2/yaffs_tagscompat.c -@@ -17,7 +17,9 @@ - #include "yaffs_getblockinfo.h" - #include "yaffs_trace.h" - -+#if 0 - static void yaffs_handle_rd_data_error(struct yaffs_dev *dev, int nand_chunk); -+#endif - - - /********** Tags ECC calculations *********/ -@@ -71,6 +73,7 @@ int yaffs_check_tags_ecc(struct yaffs_ta - return 0; - } - -+#if 0 - /********** Tags **********/ - - static void yaffs_load_tags_to_spare(struct yaffs_spare *spare_ptr, -@@ -379,3 +382,214 @@ void yaffs_tags_compat_install(struct ya - if(!dev->tagger.mark_bad_fn) - dev->tagger.mark_bad_fn = yaffs_tags_compat_mark_bad; - } -+#else -+ -+#include "yaffs_packedtags1.h" -+ -+static int yaffs_tags_compat_write(struct yaffs_dev *dev, -+ int nand_chunk, -+ const u8 *data, -+ const struct yaffs_ext_tags *tags) -+{ -+ struct yaffs_packed_tags1 pt1; -+ u8 tag_buf[9]; -+ int retval; -+ -+ /* we assume that yaffs_packed_tags1 and yaffs_tags are compatible */ -+ compile_time_assertion(sizeof(struct yaffs_packed_tags1) == 12); -+ compile_time_assertion(sizeof(struct yaffs_tags) == 8); -+ -+ yaffs_pack_tags1(&pt1, tags); -+ yaffs_calc_tags_ecc((struct yaffs_tags *)&pt1); -+ -+ /* When deleting a chunk, the upper layer provides only skeletal -+ * tags, one with is_deleted set. However, we need to update the -+ * tags, not erase them completely. So we use the NAND write property -+ * that only zeroed-bits stick and set tag bytes to all-ones and -+ * zero just the (not) deleted bit. -+ */ -+ if (!dev->param.tags_9bytes) { -+ if (tags->is_deleted) { -+ memset(&pt1, 0xff, 8); -+ /* clear delete status bit to indicate deleted */ -+ pt1.deleted = 0; -+ } -+ memcpy(tag_buf, &pt1, 8); -+ } else { -+ if (tags->is_deleted) { -+ memset(tag_buf, 0xff, 8); -+ tag_buf[8] = 0; -+ } else { -+ memcpy(tag_buf, &pt1, 8); -+ tag_buf[8] = 0xff; -+ } -+ } -+ -+ retval = dev->drv.drv_write_chunk_fn(dev, nand_chunk, -+ data, -+ (data) ? dev->data_bytes_per_chunk : 0, -+ tag_buf, -+ (dev->param.tags_9bytes) ? 9 : 8); -+ -+ return retval; -+} -+ -+/* Return with empty extended tags but add ecc_result. -+ */ -+static int return_empty_tags(struct yaffs_ext_tags *tags, -+ enum yaffs_ecc_result ecc_result, -+ int retval) -+{ -+ if (tags) { -+ memset(tags, 0, sizeof(*tags)); -+ tags->ecc_result = ecc_result; -+ } -+ -+ return retval; -+} -+ -+static int yaffs_tags_compat_read(struct yaffs_dev *dev, -+ int nand_chunk, -+ u8 *data, -+ struct yaffs_ext_tags *tags) -+{ -+ struct yaffs_packed_tags1 pt1; -+ enum yaffs_ecc_result ecc_result; -+ int retval; -+ int deleted; -+ u8 tag_buf[9]; -+ -+ retval = dev->drv.drv_read_chunk_fn(dev, nand_chunk, -+ data, dev->param.total_bytes_per_chunk, -+ tag_buf, -+ (dev->param.tags_9bytes) ? 9 : 8, -+ &ecc_result); -+ -+ switch (ecc_result) { -+ case YAFFS_ECC_RESULT_NO_ERROR: -+ case YAFFS_ECC_RESULT_FIXED: -+ break; -+ -+ case YAFFS_ECC_RESULT_UNFIXED: -+ default: -+ return_empty_tags(tags, YAFFS_ECC_RESULT_UNFIXED, 0); -+ tags->block_bad = dev->drv.drv_check_bad_fn(dev, nand_chunk); -+ return YAFFS_FAIL; -+ } -+ -+ /* Check for a blank/erased chunk. */ -+ if (yaffs_check_ff(tag_buf, 8)) { -+ /* when blank, upper layers want ecc_result to be <= NO_ERROR */ -+ return return_empty_tags(tags, YAFFS_ECC_RESULT_NO_ERROR, -+ YAFFS_OK); -+ } -+ -+ memcpy(&pt1, tag_buf, 8); -+ -+ if (!dev->param.tags_9bytes) { -+ /* Read deleted status (bit) then return it to it's non-deleted -+ * state before performing tags mini-ECC check. pt1.deleted is -+ * inverted. -+ */ -+ deleted = !pt1.deleted; -+ pt1.deleted = 1; -+ } else { -+ deleted = (hweight8(tag_buf[8]) < 7) ? 1 : 0; -+ } -+ -+ /* Check the packed tags mini-ECC and correct if necessary/possible. */ -+ retval = yaffs_check_tags_ecc((struct yaffs_tags *)&pt1); -+ switch (retval) { -+ case 0: -+ /* no tags error, use MTD result */ -+ break; -+ case 1: -+ /* recovered tags-ECC error */ -+ dev->n_tags_ecc_fixed++; -+ if (ecc_result == YAFFS_ECC_RESULT_NO_ERROR) -+ ecc_result = YAFFS_ECC_RESULT_FIXED; -+ break; -+ default: -+ /* unrecovered tags-ECC error */ -+ dev->n_tags_ecc_unfixed++; -+ return return_empty_tags(tags, YAFFS_ECC_RESULT_UNFIXED, -+ YAFFS_FAIL); -+ } -+ -+ /* Unpack the tags to extended form and set ECC result. -+ * [set should_be_ff just to keep yaffs_unpack_tags1 happy] -+ */ -+ pt1.should_be_ff = 0xffffffff; -+ yaffs_unpack_tags1(tags, &pt1); -+ tags->ecc_result = ecc_result; -+ -+ /* Set deleted state */ -+ tags->is_deleted = deleted; -+ return YAFFS_OK; -+} -+ -+static int yaffs_tags_compat_mark_bad(struct yaffs_dev *dev, int block_no) -+{ -+ return dev->drv.drv_mark_bad_fn(dev, block_no); -+} -+ -+static int yaffs_tags_compat_query_block(struct yaffs_dev *dev, -+ int block_no, -+ enum yaffs_block_state *state, -+ u32 *seq_number) -+{ -+ struct yaffs_ext_tags tags; -+ int retval; -+ -+ yaffs_trace(YAFFS_TRACE_MTD, "%s %d", __func__, block_no); -+ -+ *seq_number = 0; -+ -+ retval = dev->drv.drv_check_bad_fn(dev, block_no); -+ if (retval == YAFFS_FAIL) { -+ *state = YAFFS_BLOCK_STATE_DEAD; -+ goto out; -+ } -+ -+ yaffs_tags_compat_read(dev, block_no * dev->param.chunks_per_block, -+ NULL, &tags); -+ -+ if (tags.ecc_result != YAFFS_ECC_RESULT_NO_ERROR) { -+ yaffs_trace(YAFFS_TRACE_MTD, "block %d is marked bad", -+ block_no); -+ *state = YAFFS_BLOCK_STATE_NEEDS_SCAN; -+ } else if (tags.chunk_used) { -+ *seq_number = tags.seq_number; -+ *state = YAFFS_BLOCK_STATE_NEEDS_SCAN; -+ } else { -+ *state = YAFFS_BLOCK_STATE_EMPTY; -+ } -+ -+ retval = YAFFS_OK; -+ -+out: -+ yaffs_trace(YAFFS_TRACE_MTD, -+ "block query returns seq %u state %d", -+ *seq_number, *state); -+ -+ return retval; -+} -+ -+void yaffs_tags_compat_install(struct yaffs_dev *dev) -+{ -+ if (dev->param.is_yaffs2) -+ return; -+ -+ if (!dev->tagger.write_chunk_tags_fn) -+ dev->tagger.write_chunk_tags_fn = yaffs_tags_compat_write; -+ -+ if (!dev->tagger.read_chunk_tags_fn) -+ dev->tagger.read_chunk_tags_fn = yaffs_tags_compat_read; -+ -+ if (!dev->tagger.query_block_fn) -+ dev->tagger.query_block_fn = yaffs_tags_compat_query_block; -+ -+ if (!dev->tagger.mark_bad_fn) -+ dev->tagger.mark_bad_fn = yaffs_tags_compat_mark_bad; -+} -+#endif diff --git a/target/linux/generic/patches-4.1/503-yaffs-add-tags-9bytes-mount-option.patch b/target/linux/generic/patches-4.1/503-yaffs-add-tags-9bytes-mount-option.patch deleted file mode 100644 index 3f51bafc11..0000000000 --- a/target/linux/generic/patches-4.1/503-yaffs-add-tags-9bytes-mount-option.patch +++ /dev/null @@ -1,115 +0,0 @@ -Subject: yaffs: add support for tags-9bytes mount option - -Signed-off-by: Gabor Juhos ---- ---- a/fs/yaffs2/yaffs_vfs.c -+++ b/fs/yaffs2/yaffs_vfs.c -@@ -2644,6 +2644,7 @@ static const struct super_operations yaf - - struct yaffs_options { - int inband_tags; -+ int tags_9bytes; - int skip_checkpoint_read; - int skip_checkpoint_write; - int no_cache; -@@ -2683,6 +2684,8 @@ static int yaffs_parse_options(struct ya - - if (!strcmp(cur_opt, "inband-tags")) { - options->inband_tags = 1; -+ } else if (!strcmp(cur_opt, "tags-9bytes")) { -+ options->tags_9bytes = 1; - } else if (!strcmp(cur_opt, "tags-ecc-off")) { - options->tags_ecc_on = 0; - options->tags_ecc_overridden = 1; -@@ -2756,7 +2759,6 @@ static struct super_block *yaffs_interna - struct yaffs_param *param; - - int read_only = 0; -- int inband_tags = 0; - - struct yaffs_options options; - -@@ -2796,6 +2798,9 @@ static struct super_block *yaffs_interna - - memset(&options, 0, sizeof(options)); - -+ if (IS_ENABLED(CONFIG_YAFFS_9BYTE_TAGS)) -+ options.tags_9bytes = 1; -+ - if (yaffs_parse_options(&options, data_str)) { - /* Option parsing failed */ - return NULL; -@@ -2829,17 +2834,22 @@ static struct super_block *yaffs_interna - } - - /* Added NCB 26/5/2006 for completeness */ -- if (yaffs_version == 2 && !options.inband_tags -- && WRITE_SIZE(mtd) == 512) { -+ if (yaffs_version == 2 && -+ (!options.inband_tags || options.tags_9bytes) && -+ WRITE_SIZE(mtd) == 512) { - yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs1"); - yaffs_version = 1; - } - -- if (mtd->oobavail < sizeof(struct yaffs_packed_tags2) || -- options.inband_tags) -- inband_tags = 1; -+ if (yaffs_version == 2 && -+ mtd->oobavail < sizeof(struct yaffs_packed_tags2)) { -+ yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting inband tags"); -+ options.inband_tags = 1; -+ } - -- if(yaffs_verify_mtd(mtd, yaffs_version, inband_tags) < 0) -+ err = yaffs_verify_mtd(mtd, yaffs_version, options.inband_tags, -+ options.tags_9bytes); -+ if (err < 0) - return NULL; - - /* OK, so if we got here, we have an MTD that's NAND and looks -@@ -2896,7 +2906,8 @@ static struct super_block *yaffs_interna - - param->n_reserved_blocks = 5; - param->n_caches = (options.no_cache) ? 0 : 10; -- param->inband_tags = inband_tags; -+ param->inband_tags = options.inband_tags; -+ param->tags_9bytes = options.tags_9bytes; - - param->enable_xattr = 1; - if (options.lazy_loading_overridden) ---- a/fs/yaffs2/yaffs_mtdif.c -+++ b/fs/yaffs2/yaffs_mtdif.c -@@ -278,7 +278,8 @@ struct mtd_info * yaffs_get_mtd_device(d - return mtd; - } - --int yaffs_verify_mtd(struct mtd_info *mtd, int yaffs_version, int inband_tags) -+int yaffs_verify_mtd(struct mtd_info *mtd, int yaffs_version, int inband_tags, -+ int tags_9bytes) - { - if (yaffs_version == 2) { - if ((WRITE_SIZE(mtd) < YAFFS_MIN_YAFFS2_CHUNK_SIZE || -@@ -297,6 +298,12 @@ int yaffs_verify_mtd(struct mtd_info *mt - ); - return -1; - } -+ -+ if (tags_9bytes && mtd->oobavail < 9) { -+ yaffs_trace(YAFFS_TRACE_ALWAYS, -+ "MTD device does not support 9-byte tags"); -+ return -1; -+ } - } - - return 0; ---- a/fs/yaffs2/yaffs_mtdif.h -+++ b/fs/yaffs2/yaffs_mtdif.h -@@ -21,5 +21,6 @@ - void yaffs_mtd_drv_install(struct yaffs_dev *dev); - struct mtd_info * yaffs_get_mtd_device(dev_t sdev); - void yaffs_put_mtd_device(struct mtd_info *mtd); --int yaffs_verify_mtd(struct mtd_info *mtd, int yaffs_version, int inband_tags); -+int yaffs_verify_mtd(struct mtd_info *mtd, int yaffs_version, int inband_tags, -+ int tags_9bytes); - #endif diff --git a/target/linux/generic/patches-4.1/504-yaffs-3.16-new-fops.patch b/target/linux/generic/patches-4.1/504-yaffs-3.16-new-fops.patch deleted file mode 100644 index 32b4fdfa39..0000000000 --- a/target/linux/generic/patches-4.1/504-yaffs-3.16-new-fops.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs.c -+++ b/fs/yaffs2/yaffs_vfs.c -@@ -774,7 +774,25 @@ static int yaffs_sync_object(struct file - } - - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) -+static const struct file_operations yaffs_file_operations = { -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) -+ .read = new_sync_read, -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) */ -+ .read_iter = generic_file_read_iter, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) -+ .write = new_sync_write, -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) */ -+ .write_iter = generic_file_write_iter, -+ .mmap = generic_file_mmap, -+ .flush = yaffs_file_flush, -+ .fsync = yaffs_sync_object, -+ .splice_read = generic_file_splice_read, -+ .splice_write = iter_file_splice_write, -+ .llseek = generic_file_llseek, -+}; -+ -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) - static const struct file_operations yaffs_file_operations = { - .read = do_sync_read, - .write = do_sync_write, diff --git a/target/linux/generic/patches-4.1/505-yaffs-3.19-f_dentry-remove.patch b/target/linux/generic/patches-4.1/505-yaffs-3.19-f_dentry-remove.patch deleted file mode 100644 index 0d4b6bf04f..0000000000 --- a/target/linux/generic/patches-4.1/505-yaffs-3.19-f_dentry-remove.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs.c -+++ b/fs/yaffs2/yaffs_vfs.c -@@ -283,7 +283,7 @@ static int yaffs_readpage_nolock(struct - (long long)pos, - (unsigned)PAGE_CACHE_SIZE); - -- obj = yaffs_dentry_to_obj(f->f_dentry); -+ obj = yaffs_dentry_to_obj(f->f_path.dentry); - - dev = obj->my_dev; - -@@ -481,7 +481,7 @@ static ssize_t yaffs_hold_space(struct f - - int n_free_chunks; - -- obj = yaffs_dentry_to_obj(f->f_dentry); -+ obj = yaffs_dentry_to_obj(f->f_path.dentry); - - dev = obj->my_dev; - -@@ -499,7 +499,7 @@ static void yaffs_release_space(struct f - struct yaffs_obj *obj; - struct yaffs_dev *dev; - -- obj = yaffs_dentry_to_obj(f->f_dentry); -+ obj = yaffs_dentry_to_obj(f->f_path.dentry); - - dev = obj->my_dev; - -@@ -591,7 +591,7 @@ static ssize_t yaffs_file_write(struct f - struct inode *inode; - struct yaffs_dev *dev; - -- obj = yaffs_dentry_to_obj(f->f_dentry); -+ obj = yaffs_dentry_to_obj(f->f_path.dentry); - - if (!obj) { - yaffs_trace(YAFFS_TRACE_OS, -@@ -603,7 +603,7 @@ static ssize_t yaffs_file_write(struct f - - yaffs_gross_lock(dev); - -- inode = f->f_dentry->d_inode; -+ inode = f->f_path.dentry->d_inode; - - if (!S_ISBLK(inode->i_mode) && f->f_flags & O_APPEND) - ipos = inode->i_size; -@@ -727,7 +727,7 @@ static int yaffs_file_flush(struct file - static int yaffs_file_flush(struct file *file) - #endif - { -- struct yaffs_obj *obj = yaffs_dentry_to_obj(file->f_dentry); -+ struct yaffs_obj *obj = yaffs_dentry_to_obj(file->f_path.dentry); - - struct yaffs_dev *dev = obj->my_dev; - -@@ -1734,7 +1734,7 @@ static int yaffs_iterate(struct file *f, - - char name[YAFFS_MAX_NAME_LENGTH + 1]; - -- obj = yaffs_dentry_to_obj(f->f_dentry); -+ obj = yaffs_dentry_to_obj(f->f_path.dentry); - dev = obj->my_dev; - - yaffs_gross_lock(dev); -@@ -1798,14 +1798,14 @@ static int yaffs_readdir(struct file *f, - struct yaffs_obj *obj; - struct yaffs_dev *dev; - struct yaffs_search_context *sc; -- struct inode *inode = f->f_dentry->d_inode; -+ struct inode *inode = f->f_path.dentry->d_inode; - unsigned long offset, curoffs; - struct yaffs_obj *l; - int ret_val = 0; - - char name[YAFFS_MAX_NAME_LENGTH + 1]; - -- obj = yaffs_dentry_to_obj(f->f_dentry); -+ obj = yaffs_dentry_to_obj(f->f_path.dentry); - dev = obj->my_dev; - - yaffs_gross_lock(dev); -@@ -1839,10 +1839,10 @@ static int yaffs_readdir(struct file *f, - if (offset == 1) { - yaffs_trace(YAFFS_TRACE_OS, - "yaffs_readdir: entry .. ino %d", -- (int)f->f_dentry->d_parent->d_inode->i_ino); -+ (int)f->f_path.dentry->d_parent->d_inode->i_ino); - yaffs_gross_unlock(dev); - if (filldir(dirent, "..", 2, offset, -- f->f_dentry->d_parent->d_inode->i_ino, -+ f->f_path.dentry->d_parent->d_inode->i_ino, - DT_DIR) < 0) { - yaffs_gross_lock(dev); - goto out; diff --git a/target/linux/generic/patches-4.1/530-jffs2_make_lzma_available.patch b/target/linux/generic/patches-4.1/530-jffs2_make_lzma_available.patch deleted file mode 100644 index c8301f00c8..0000000000 --- a/target/linux/generic/patches-4.1/530-jffs2_make_lzma_available.patch +++ /dev/null @@ -1,5142 +0,0 @@ ---- 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 -@@ -235,6 +235,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 $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) -@@ -89,6 +99,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/patches-4.1/531-debloat_lzma.patch b/target/linux/generic/patches-4.1/531-debloat_lzma.patch deleted file mode 100644 index aa3c498016..0000000000 --- a/target/linux/generic/patches-4.1/531-debloat_lzma.patch +++ /dev/null @@ -1,1024 +0,0 @@ ---- 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/patches-4.1/532-jffs2_eofdetect.patch b/target/linux/generic/patches-4.1/532-jffs2_eofdetect.patch deleted file mode 100644 index 8ce53d8bed..0000000000 --- a/target/linux/generic/patches-4.1/532-jffs2_eofdetect.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- 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/patches-4.1/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-4.1/540-crypto-xz-decompression-support.patch deleted file mode 100644 index c250e9f024..0000000000 --- a/target/linux/generic/patches-4.1/540-crypto-xz-decompression-support.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -1435,6 +1435,13 @@ config CRYPTO_LZ4HC - help - This is the LZ4 high compression mode algorithm. - -+config CRYPTO_XZ -+ tristate "XZ compression algorithm" -+ select CRYPTO_ALGAPI -+ select XZ_DEC -+ help -+ This is the XZ algorithm. Only decompression is supported for now. -+ - comment "Random Number Generation" - - config CRYPTO_ANSI_CPRNG ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -89,6 +89,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc. - obj-$(CONFIG_CRYPTO_LZO) += lzo.o - obj-$(CONFIG_CRYPTO_LZ4) += lz4.o - obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o -+obj-$(CONFIG_CRYPTO_XZ) += xz.o - obj-$(CONFIG_CRYPTO_842) += 842.o - obj-$(CONFIG_CRYPTO_RNG2) += rng.o - obj-$(CONFIG_CRYPTO_RNG2) += krng.o ---- /dev/null -+++ b/crypto/xz.c -@@ -0,0 +1,117 @@ -+/* -+ * Cryptographic API. -+ * -+ * XZ decompression support. -+ * -+ * Copyright (c) 2012 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 -+ -+struct xz_comp_ctx { -+ struct xz_dec *decomp_state; -+ struct xz_buf decomp_buf; -+}; -+ -+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx) -+{ -+ ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0); -+ if (!ctx->decomp_state) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx) -+{ -+ xz_dec_end(ctx->decomp_state); -+} -+ -+static int crypto_xz_init(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ return crypto_xz_decomp_init(ctx); -+} -+ -+static void crypto_xz_exit(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ crypto_xz_decomp_exit(ctx); -+} -+ -+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ return -EOPNOTSUPP; -+} -+ -+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm); -+ struct xz_buf *xz_buf = &dctx->decomp_buf; -+ int ret; -+ -+ memset(xz_buf, '\0', sizeof(struct xz_buf)); -+ -+ xz_buf->in = (u8 *) src; -+ xz_buf->in_pos = 0; -+ xz_buf->in_size = slen; -+ xz_buf->out = (u8 *) dst; -+ xz_buf->out_pos = 0; -+ xz_buf->out_size = *dlen; -+ -+ ret = xz_dec_run(dctx->decomp_state, xz_buf); -+ if (ret != XZ_STREAM_END) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ *dlen = xz_buf->out_pos; -+ ret = 0; -+ -+out: -+ return ret; -+} -+ -+static struct crypto_alg crypto_xz_alg = { -+ .cra_name = "xz", -+ .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, -+ .cra_ctxsize = sizeof(struct xz_comp_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_list = LIST_HEAD_INIT(crypto_xz_alg.cra_list), -+ .cra_init = crypto_xz_init, -+ .cra_exit = crypto_xz_exit, -+ .cra_u = { .compress = { -+ .coa_compress = crypto_xz_compress, -+ .coa_decompress = crypto_xz_decompress } } -+}; -+ -+static int __init crypto_xz_mod_init(void) -+{ -+ return crypto_register_alg(&crypto_xz_alg); -+} -+ -+static void __exit crypto_xz_mod_exit(void) -+{ -+ crypto_unregister_alg(&crypto_xz_alg); -+} -+ -+module_init(crypto_xz_mod_init); -+module_exit(crypto_xz_mod_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Crypto XZ decompression support"); -+MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch deleted file mode 100644 index f85689c586..0000000000 --- a/target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- a/fs/ubifs/Kconfig -+++ b/fs/ubifs/Kconfig -@@ -5,8 +5,10 @@ config UBIFS_FS - select CRYPTO if UBIFS_FS_ADVANCED_COMPR - select CRYPTO if UBIFS_FS_LZO - select CRYPTO if UBIFS_FS_ZLIB -+ select CRYPTO if UBIFS_FS_XZ - select CRYPTO_LZO if UBIFS_FS_LZO - select CRYPTO_DEFLATE if UBIFS_FS_ZLIB -+ select CRYPTO_XZ if UBIFS_FS_XZ - depends on MTD_UBI - help - UBIFS is a file system for flash devices which works on top of UBI. -@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB - default y - help - Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. -+ -+config UBIFS_FS_XZ -+ bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR -+ depends on UBIFS_FS -+ default y -+ help -+ XZ compresses better the ZLIB but it is slower.. -+ Say 'Y' if unsure. -+ ---- a/fs/ubifs/compress.c -+++ b/fs/ubifs/compress.c -@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp - }; - #endif - -+#ifdef CONFIG_UBIFS_FS_XZ -+static DEFINE_MUTEX(xz_enc_mutex); -+static DEFINE_MUTEX(xz_dec_mutex); -+ -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .comp_mutex = &xz_enc_mutex, -+ .decomp_mutex = &xz_dec_mutex, -+ .name = "xz", -+ .capi_name = "xz", -+}; -+#else -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .name = "xz", -+}; -+#endif -+ - /* All UBIFS compressors */ - struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; - -@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void) - if (err) - goto out_lzo; - -+ err = compr_init(&xz_compr); -+ if (err) -+ goto out_zlib; -+ - ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr; - return 0; - -+out_zlib: -+ compr_exit(&zlib_compr); - out_lzo: - compr_exit(&lzo_compr); - return err; -@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void) - { - compr_exit(&lzo_compr); - compr_exit(&zlib_compr); -+ compr_exit(&xz_compr); - } ---- a/fs/ubifs/ubifs-media.h -+++ b/fs/ubifs/ubifs-media.h -@@ -332,12 +332,14 @@ enum { - * UBIFS_COMPR_NONE: no compression - * UBIFS_COMPR_LZO: LZO compression - * UBIFS_COMPR_ZLIB: ZLIB compression -+ * UBIFS_COMPR_XZ: XZ compression - * UBIFS_COMPR_TYPES_CNT: count of supported compression types - */ - enum { - UBIFS_COMPR_NONE, - UBIFS_COMPR_LZO, - UBIFS_COMPR_ZLIB, -+ UBIFS_COMPR_XZ, - UBIFS_COMPR_TYPES_CNT, - }; - diff --git a/target/linux/generic/patches-4.1/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/patches-4.1/551-ubifs-fix-default-compression-selection.patch deleted file mode 100644 index 1b0f30718c..0000000000 --- a/target/linux/generic/patches-4.1/551-ubifs-fix-default-compression-selection.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- 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/patches-4.1/600-netfilter_conntrack_flush.patch b/target/linux/generic/patches-4.1/600-netfilter_conntrack_flush.patch deleted file mode 100644 index bd7a7ffdef..0000000000 --- a/target/linux/generic/patches-4.1/600-netfilter_conntrack_flush.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- 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 -@@ -259,10 +260,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, - }; -@@ -364,7 +421,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/patches-4.1/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/patches-4.1/610-netfilter_match_bypass_default_checks.patch deleted file mode 100644 index 1187845879..0000000000 --- a/target/linux/generic/patches-4.1/610-netfilter_match_bypass_default_checks.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- 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) - { -@@ -649,6 +675,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; - mtpar.net = net; - mtpar.table = name; -@@ -941,6 +969,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)) -@@ -971,6 +1000,14 @@ copy_entries_to_user(unsigned int total_ - ret = -EFAULT; - 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; diff --git a/target/linux/generic/patches-4.1/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/patches-4.1/611-netfilter_match_bypass_default_table.patch deleted file mode 100644 index 9e2290d7d6..0000000000 --- a/target/linux/generic/patches-4.1/611-netfilter_match_bypass_default_table.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- 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, -@@ -330,9 +357,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 = state->in ? state->in->name : nulldevname; - outdev = state->out ? state->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 -@@ -347,23 +398,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/patches-4.1/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/patches-4.1/612-netfilter_match_reduce_memory_access.patch deleted file mode 100644 index 72172d8bb4..0000000000 --- a/target/linux/generic/patches-4.1/612-netfilter_match_reduce_memory_access.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- 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/patches-4.1/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/patches-4.1/613-netfilter_optional_tcp_window_check.patch deleted file mode 100644 index 3740dd74e5..0000000000 --- a/target/linux/generic/patches-4.1/613-netfilter_optional_tcp_window_check.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- 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. - */ -@@ -1481,6 +1487,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/patches-4.1/615-netfilter_add_xt_id_match.patch b/target/linux/generic/patches-4.1/615-netfilter_add_xt_id_match.patch deleted file mode 100644 index 7d0fe27e98..0000000000 --- a/target/linux/generic/patches-4.1/615-netfilter_add_xt_id_match.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/include/uapi/linux/netfilter/Kbuild -+++ b/include/uapi/linux/netfilter/Kbuild -@@ -55,6 +55,7 @@ header-y += xt_ecn.h - header-y += xt_esp.h - header-y += xt_hashlimit.h - header-y += xt_helper.h -+header-y += xt_id.h - header-y += xt_ipcomp.h - header-y += xt_iprange.h - header-y += xt_ipvs.h ---- /dev/null -+++ b/include/uapi/linux/netfilter/xt_id.h -@@ -0,0 +1,8 @@ -+#ifndef _XT_ID_H -+#define _XT_ID_H -+ -+struct xt_id_info { -+ u32 id; -+}; -+ -+#endif /* XT_ID_H */ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -1164,6 +1164,13 @@ config NETFILTER_XT_MATCH_IPCOMP - - To compile it as a module, choose M here. If unsure, say N. - -+config NETFILTER_XT_MATCH_ID -+ tristate '"id" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option adds a `id' dummy-match, which allows you to put -+ numeric IDs into your iptables ruleset. -+ - config NETFILTER_XT_MATCH_IPRANGE - tristate '"iprange" address range match support' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -145,6 +145,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += - obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o - obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o - obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o -+obj-$(CONFIG_NETFILTER_XT_MATCH_ID) += xt_id.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPCOMP) += xt_ipcomp.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o ---- /dev/null -+++ b/net/netfilter/xt_id.c -@@ -0,0 +1,45 @@ -+/* -+ * Implements a dummy match to allow attaching IDs to rules -+ * -+ * 2014-08-01 Jo-Philipp Wich -+ */ -+ -+#include -+#include -+#include -+#include -+ -+MODULE_AUTHOR("Jo-Philipp Wich "); -+MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a 32bit ID"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("ipt_id"); -+MODULE_ALIAS("ip6t_id"); -+ -+static bool -+id_mt(const struct sk_buff *skb, struct xt_action_param *par) -+{ -+ /* We always match */ -+ return true; -+} -+ -+static struct xt_match id_mt_reg __read_mostly = { -+ .name = "id", -+ .revision = 0, -+ .family = NFPROTO_UNSPEC, -+ .match = id_mt, -+ .matchsize = sizeof(struct xt_id_info), -+ .me = THIS_MODULE, -+}; -+ -+static int __init id_mt_init(void) -+{ -+ return xt_register_match(&id_mt_reg); -+} -+ -+static void __exit id_mt_exit(void) -+{ -+ xt_unregister_match(&id_mt_reg); -+} -+ -+module_init(id_mt_init); -+module_exit(id_mt_exit); diff --git a/target/linux/generic/patches-4.1/616-net_optimize_xfrm_calls.patch b/target/linux/generic/patches-4.1/616-net_optimize_xfrm_calls.patch deleted file mode 100644 index 2a64d5420a..0000000000 --- a/target/linux/generic/patches-4.1/616-net_optimize_xfrm_calls.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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/patches-4.1/630-packet_socket_type.patch b/target/linux/generic/patches-4.1/630-packet_socket_type.patch deleted file mode 100644 index a59cba33d6..0000000000 --- a/target/linux/generic/patches-4.1/630-packet_socket_type.patch +++ /dev/null @@ -1,134 +0,0 @@ -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 -@@ -1547,6 +1547,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 -@@ -1554,6 +1555,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 -@@ -1566,7 +1568,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; - -@@ -2866,6 +2868,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; -@@ -3472,6 +3475,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; - } -@@ -3523,6 +3536,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 -@@ -115,6 +115,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/patches-4.1/640-bridge_no_eap_forward.patch b/target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch deleted file mode 100644 index 2b55f13bbc..0000000000 --- a/target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch +++ /dev/null @@ -1,23 +0,0 @@ -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 -@@ -162,7 +162,11 @@ int br_handle_frame_finish(struct sock * - if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) - br_do_proxy_arp(skb, br, vid, p); - -- 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/patches-4.1/641-bridge_always_accept_eap.patch b/target/linux/generic/patches-4.1/641-bridge_always_accept_eap.patch deleted file mode 100644 index a4b3ed48a3..0000000000 --- a/target/linux/generic/patches-4.1/641-bridge_always_accept_eap.patch +++ /dev/null @@ -1,17 +0,0 @@ -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 -@@ -146,7 +146,7 @@ int br_handle_frame_finish(struct sock * - 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/patches-4.1/642-bridge_port_isolate.patch b/target/linux/generic/patches-4.1/642-bridge_port_isolate.patch deleted file mode 100644 index d7ae041b25..0000000000 --- a/target/linux/generic/patches-4.1/642-bridge_port_isolate.patch +++ /dev/null @@ -1,107 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: port isolate - -Isolating individual bridge ports ---- ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -45,6 +45,7 @@ struct br_ip_list { - #define BR_PROXYARP BIT(8) - #define BR_LEARNING_SYNC BIT(9) - #define BR_PROXYARP_WIFI BIT(10) -+#define BR_ISOLATE_MODE BIT(11) - - extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); - ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -173,6 +173,22 @@ BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD - BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); - BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); - -+static ssize_t show_isolate_mode(struct net_bridge_port *p, char *buf) -+{ -+ int isolate_mode = (p->flags & BR_ISOLATE_MODE) ? 1 : 0; -+ return sprintf(buf, "%d\n", isolate_mode); -+} -+static ssize_t store_isolate_mode(struct net_bridge_port *p, unsigned long v) -+{ -+ if (v) -+ p->flags |= BR_ISOLATE_MODE; -+ else -+ p->flags &= ~BR_ISOLATE_MODE; -+ return 0; -+} -+static BRPORT_ATTR(isolate_mode, S_IRUGO | S_IWUSR, -+ show_isolate_mode, store_isolate_mode); -+ - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) - { -@@ -217,6 +233,7 @@ static const struct brport_attribute *br - #endif - &brport_attr_proxyarp, - &brport_attr_proxyarp_wifi, -+ &brport_attr_isolate_mode, - NULL - }; - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -185,8 +185,8 @@ int br_handle_frame_finish(struct sock * - - 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 -@@ -119,7 +119,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 -@@ -175,7 +175,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; -@@ -183,6 +183,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; -@@ -217,14 +219,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/patches-4.1/645-bridge_multicast_to_unicast.patch b/target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch deleted file mode 100644 index 1361b92183..0000000000 --- a/target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch +++ /dev/null @@ -1,397 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: multicast to unicast - -Implement optinal multicast->unicast conversion for igmp snooping ---- ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -46,6 +46,7 @@ struct br_ip_list { - #define BR_LEARNING_SYNC BIT(9) - #define BR_PROXYARP_WIFI BIT(10) - #define BR_ISOLATE_MODE BIT(11) -+#define BR_MULTICAST_TO_UCAST BIT(12) - - extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); - ---- 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 - -@@ -966,6 +988,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; -@@ -1009,7 +1032,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; - } -@@ -1023,6 +1047,7 @@ static int br_ip6_multicast_mld2_report( - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src = eth_hdr(skb)->h_source; - struct icmp6hdr *icmp6h; - struct mld2_grec *grec; - int i; -@@ -1071,7 +1096,7 @@ static int br_ip6_multicast_mld2_report( - } - - err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, -- vid); -+ vid, src); - if (err) - break; - } -@@ -1407,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; -@@ -1457,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); -@@ -1491,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) && -@@ -1509,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; -@@ -1525,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; -@@ -1547,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 - -@@ -1556,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; -@@ -1624,12 +1651,13 @@ static int br_multicast_ipv4_rcv(struct - - BR_INPUT_SKB_CB(skb)->igmp = 1; - ih = igmp_hdr(skb2); -+ src = eth_hdr(skb)->h_source; - - switch (ih->type) { - 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); -+ 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); -@@ -1638,7 +1666,7 @@ 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); -+ br_ip4_multicast_leave_group(br, port, ih->group, vid, src); - break; - } - -@@ -1656,6 +1684,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; -@@ -1763,9 +1792,11 @@ static int br_multicast_ipv6_rcv(struct - err = -EINVAL; - goto out; - } -+ src = eth_hdr(skb)->h_source; - 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); -+ err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid, -+ src); - break; - } - case ICMPV6_MLD2_REPORT: -@@ -1781,8 +1812,9 @@ static int br_multicast_ipv6_rcv(struct - err = -EINVAL; - goto out; - } -+ src = eth_hdr(skb)->h_source; - mld = (struct mld_msg *)skb_transport_header(skb2); -- br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid); -+ br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid, src); - } - } - ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -113,6 +113,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 -@@ -481,7 +484,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 -@@ -343,7 +343,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 -@@ -170,6 +170,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, -@@ -242,6 +270,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; -@@ -252,10 +281,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 -@@ -204,6 +204,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[] = { -@@ -230,6 +231,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_proxyarp, - &brport_attr_proxyarp_wifi, diff --git a/target/linux/generic/patches-4.1/650-pppoe_header_pad.patch b/target/linux/generic/patches-4.1/650-pppoe_header_pad.patch deleted file mode 100644 index 409de58c28..0000000000 --- a/target/linux/generic/patches-4.1/650-pppoe_header_pad.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -879,7 +879,7 @@ static int pppoe_sendmsg(struct socket * - goto end; - - -- skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32, -+ skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32 + NET_SKB_PAD, - 0, GFP_KERNEL); - if (!skb) { - error = -ENOMEM; -@@ -887,7 +887,7 @@ static int pppoe_sendmsg(struct socket * - } - - /* Reserve space for headers. */ -- skb_reserve(skb, dev->hard_header_len); -+ skb_reserve(skb, dev->hard_header_len + NET_SKB_PAD); - skb_reset_network_header(skb); - - skb->dev = dev; diff --git a/target/linux/generic/patches-4.1/651-wireless_mesh_header.patch b/target/linux/generic/patches-4.1/651-wireless_mesh_header.patch deleted file mode 100644 index 17bcb6d24d..0000000000 --- a/target/linux/generic/patches-4.1/651-wireless_mesh_header.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -133,7 +133,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/patches-4.1/653-disable_netlink_trim.patch b/target/linux/generic/patches-4.1/653-disable_netlink_trim.patch deleted file mode 100644 index be8bf7eede..0000000000 --- a/target/linux/generic/patches-4.1/653-disable_netlink_trim.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -1776,27 +1776,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); -- if (netlink_skb_is_mmaped(skb)) -- return skb; -- -- 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/patches-4.1/655-increase_skb_pad.patch b/target/linux/generic/patches-4.1/655-increase_skb_pad.patch deleted file mode 100644 index dfc93efad3..0000000000 --- a/target/linux/generic/patches-4.1/655-increase_skb_pad.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2052,7 +2052,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/patches-4.1/656-skb_reduce_truesize-helper.patch b/target/linux/generic/patches-4.1/656-skb_reduce_truesize-helper.patch deleted file mode 100644 index 6baee5220b..0000000000 --- a/target/linux/generic/patches-4.1/656-skb_reduce_truesize-helper.patch +++ /dev/null @@ -1,41 +0,0 @@ -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 -@@ -2097,6 +2097,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/patches-4.1/657-qdisc_reduce_truesize.patch b/target/linux/generic/patches-4.1/657-qdisc_reduce_truesize.patch deleted file mode 100644 index 410e0b763d..0000000000 --- a/target/linux/generic/patches-4.1/657-qdisc_reduce_truesize.patch +++ /dev/null @@ -1,63 +0,0 @@ -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/patches-4.1/660-fq_codel_defaults.patch b/target/linux/generic/patches-4.1/660-fq_codel_defaults.patch deleted file mode 100644 index 8a870cccc1..0000000000 --- a/target/linux/generic/patches-4.1/660-fq_codel_defaults.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 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/patches-4.1/661-fq_codel_keep_dropped_stats.patch b/target/linux/generic/patches-4.1/661-fq_codel_keep_dropped_stats.patch deleted file mode 100644 index 45a8d68367..0000000000 --- a/target/linux/generic/patches-4.1/661-fq_codel_keep_dropped_stats.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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/patches-4.1/662-use_fq_codel_by_default.patch b/target/linux/generic/patches-4.1/662-use_fq_codel_by_default.patch deleted file mode 100644 index cb80c3f54c..0000000000 --- a/target/linux/generic/patches-4.1/662-use_fq_codel_by_default.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- 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 -@@ -343,6 +343,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 -@@ -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) { diff --git a/target/linux/generic/patches-4.1/663-remove_pfifo_fast.patch b/target/linux/generic/patches-4.1/663-remove_pfifo_fast.patch deleted file mode 100644 index 50b90b375f..0000000000 --- a/target/linux/generic/patches-4.1/663-remove_pfifo_fast.patch +++ /dev/null @@ -1,143 +0,0 @@ ---- 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/patches-4.1/664-codel_fix_3_12.patch b/target/linux/generic/patches-4.1/664-codel_fix_3_12.patch deleted file mode 100644 index d17acd02ed..0000000000 --- a/target/linux/generic/patches-4.1/664-codel_fix_3_12.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -1962,7 +1962,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); ---- 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. */ diff --git a/target/linux/generic/patches-4.1/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/patches-4.1/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch deleted file mode 100644 index b990f50608..0000000000 --- a/target/linux/generic/patches-4.1/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ /dev/null @@ -1,495 +0,0 @@ -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 -@@ -71,11 +73,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); -@@ -174,27 +174,36 @@ 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 in6_addr any; -+ 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; -+ } - } - - memset(&any, 0, sizeof(any)); -- hash = HASH(&any, local); -+ hash = HASH(local); - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { - if (ipv6_addr_equal(local, &t->parms.laddr) && - (t->dev->flags & IFF_UP)) - return t; - } - -- hash = HASH(remote, &any); -+ hash = HASH(&any); - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { - if (ipv6_addr_equal(remote, &t->parms.raddr) && - (t->dev->flags & IFF_UP)) -@@ -229,7 +238,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]; - } -@@ -399,6 +408,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 -@@ -785,6 +800,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 -@@ -830,6 +947,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 && -+ !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); - -@@ -1168,6 +1305,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str - __u32 mtu; - u8 tproto; - int err; -+ struct __ip6_tnl_fmr *fmr; - - tproto = ACCESS_ONCE(t->parms.proto); - if ((tproto != IPPROTO_IPV6 && tproto != 0) || -@@ -1198,6 +1336,18 @@ ip6ip6_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(ip_hdr(skb)->daddr) >> mshift) -+ break; -+ } -+ -+ /* change dstaddr according to FMR */ -+ if (fmr) -+ ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, true); -+ - err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); - if (err != 0) { - if (err == -EMSGSIZE) -@@ -1312,6 +1462,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; -@@ -1350,6 +1508,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)); - } - -@@ -1636,6 +1795,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) - { -@@ -1667,6 +1835,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, -@@ -1719,6 +1927,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) + -@@ -1736,6 +1950,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; - } - -@@ -1743,6 +1975,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_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) || -@@ -1751,8 +1986,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: -@@ -1776,6 +2030,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/patches-4.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/patches-4.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch deleted file mode 100644 index 2892109837..0000000000 --- a/target/linux/generic/patches-4.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ /dev/null @@ -1,249 +0,0 @@ -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 -@@ -61,6 +61,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 -@@ -210,6 +210,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 -@@ -2348,6 +2348,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 -@@ -182,6 +182,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 -@@ -167,6 +167,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); -@@ -281,6 +283,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), -@@ -1632,6 +1649,11 @@ int ip6_route_info_create(struct fib6_co - 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 -@@ -2223,6 +2245,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. - */ -@@ -2449,7 +2482,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) -@@ -2791,6 +2825,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; -@@ -3048,6 +3085,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 -@@ -3264,6 +3303,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; -@@ -3282,6 +3332,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: -@@ -3299,6 +3351,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); - } -@@ -3395,6 +3448,9 @@ int __init ip6_route_init(void) - 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 - ret = fib6_init(); - if (ret) diff --git a/target/linux/generic/patches-4.1/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/patches-4.1/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch deleted file mode 100644 index dafb56cd8b..0000000000 --- a/target/linux/generic/patches-4.1/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch +++ /dev/null @@ -1,53 +0,0 @@ -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 -@@ -214,6 +214,8 @@ enum { - __RTN_MAX - }; - -+#define RTN_FAILED_POLICY RTN_POLICY_FAILED -+ - #define RTN_MAX (__RTN_MAX - 1) - - diff --git a/target/linux/generic/patches-4.1/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/patches-4.1/680-NET-skip-GRO-for-foreign-MAC-addresses.patch deleted file mode 100644 index 98abfacb85..0000000000 --- a/target/linux/generic/patches-4.1/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ /dev/null @@ -1,160 +0,0 @@ -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 -@@ -4041,6 +4041,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; - -@@ -5190,6 +5193,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) -@@ -5250,6 +5295,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; - -@@ -5367,6 +5413,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); - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev); - } - EXPORT_SYMBOL(netdev_upper_dev_unlink); -@@ -5906,6 +5953,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 -@@ -1603,6 +1603,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 -@@ -616,7 +616,8 @@ struct sk_buff { - __u8 ipvs_property:1; - __u8 inner_protocol_type:1; - __u8 remcsum_offload:1; -- /* 3 or 5 bit hole */ -+ __u8 gro_skip:1; -+ /* 2 or 4 bit hole */ - - #ifdef CONFIG_NET_SCHED - __u16 tc_index; /* traffic control index */ ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -139,6 +139,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 -@@ -166,8 +178,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/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch deleted file mode 100644 index 688cf6e44a..0000000000 --- a/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch +++ /dev/null @@ -1,88 +0,0 @@ -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 -@@ -80,3 +81,45 @@ const void *of_get_mac_address(struct de - return of_get_mac_addr(np, "address"); - } - 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 -@@ -13,6 +13,14 @@ - struct net_device; - 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 - extern struct net_device *of_find_net_device_by_node(struct device_node *np); - #else - static inline int of_get_phy_mode(struct device_node *np) diff --git a/target/linux/generic/patches-4.1/700-swconfig.patch b/target/linux/generic/patches-4.1/700-swconfig.patch deleted file mode 100644 index cdce89e239..0000000000 --- a/target/linux/generic/patches-4.1/700-swconfig.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- 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 -@@ -380,6 +380,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/patches-4.1/701-phy_extension.patch b/target/linux/generic/patches-4.1/701-phy_extension.patch deleted file mode 100644 index 55b37bacb9..0000000000 --- a/target/linux/generic/patches-4.1/701-phy_extension.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -357,6 +357,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 -@@ -762,6 +762,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/patches-4.1/702-phy_add_aneg_done_function.patch b/target/linux/generic/patches-4.1/702-phy_add_aneg_done_function.patch deleted file mode 100644 index c743cefc5a..0000000000 --- a/target/linux/generic/patches-4.1/702-phy_add_aneg_done_function.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -489,6 +489,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 -@@ -929,6 +929,9 @@ int genphy_update_link(struct phy_device - { - int status; - -+ if (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/patches-4.1/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/patches-4.1/703-phy-add-detach-callback-to-struct-phy_driver.patch deleted file mode 100644 index 85888f7c24..0000000000 --- a/target/linux/generic/patches-4.1/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- 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 -@@ -507,6 +507,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/patches-4.1/704-phy-no-genphy-soft-reset.patch b/target/linux/generic/patches-4.1/704-phy-no-genphy-soft-reset.patch deleted file mode 100644 index 41a6d91588..0000000000 --- a/target/linux/generic/patches-4.1/704-phy-no-genphy-soft-reset.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -1147,7 +1147,7 @@ int genphy_config_init(struct phy_device - return 0; - } - --static int gen10g_soft_reset(struct phy_device *phydev) -+static int no_soft_reset(struct phy_device *phydev) - { - /* Do nothing for now */ - return 0; -@@ -1361,7 +1361,7 @@ static struct phy_driver genphy_driver[] - .phy_id = 0xffffffff, - .phy_id_mask = 0xffffffff, - .name = "Generic PHY", -- .soft_reset = genphy_soft_reset, -+ .soft_reset = no_soft_reset, - .config_init = genphy_config_init, - .features = PHY_GBIT_FEATURES | SUPPORTED_MII | - SUPPORTED_AUI | SUPPORTED_FIBRE | -@@ -1376,7 +1376,7 @@ static struct phy_driver genphy_driver[] - .phy_id = 0xffffffff, - .phy_id_mask = 0xffffffff, - .name = "Generic 10G PHY", -- .soft_reset = gen10g_soft_reset, -+ .soft_reset = no_soft_reset, - .config_init = gen10g_config_init, - .features = 0, - .config_aneg = gen10g_config_aneg, diff --git a/target/linux/generic/patches-4.1/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/patches-4.1/710-phy-add-mdio_register_board_info.patch deleted file mode 100644 index 2bc91d5d72..0000000000 --- a/target/linux/generic/patches-4.1/710-phy-add-mdio_register_board_info.patch +++ /dev/null @@ -1,193 +0,0 @@ ---- 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 -@@ -800,6 +800,23 @@ 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 -+ - /** - * module_phy_driver() - Helper macro for registering PHY drivers - * @__phy_drivers: array of PHY drivers to register ---- 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 -@@ -16,7 +16,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/patches-4.1/720-phy_adm6996.patch b/target/linux/generic/patches-4.1/720-phy_adm6996.patch deleted file mode 100644 index 7107316dc4..0000000000 --- a/target/linux/generic/patches-4.1/720-phy_adm6996.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -133,6 +133,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 - tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB ---- 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_phy.o diff --git a/target/linux/generic/patches-4.1/721-phy_packets.patch b/target/linux/generic/patches-4.1/721-phy_packets.patch deleted file mode 100644 index ecf1851dfb..0000000000 --- a/target/linux/generic/patches-4.1/721-phy_packets.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1271,6 +1271,7 @@ enum netdev_priv_flags { - IFF_XMIT_DST_RELEASE_PERM = 1<<22, - IFF_IPVLAN_MASTER = 1<<23, - IFF_IPVLAN_SLAVE = 1<<24, -+ IFF_NO_IP_ALIGN = 1<<25, - }; - - #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1298,6 +1299,7 @@ enum netdev_priv_flags { - #define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM - #define IFF_IPVLAN_MASTER IFF_IPVLAN_MASTER - #define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE -+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN - - /** - * struct net_device - The DEVICE structure. -@@ -1568,6 +1570,11 @@ struct net_device { - const struct swdev_ops *swdev_ops; - #endif - -+#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; -@@ -1634,6 +1641,10 @@ struct net_device { - struct mpls_dev __rcu *mpls_ptr; - #endif - -+#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 -@@ -2083,6 +2083,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 -@@ -2209,16 +2213,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 -@@ -2650,10 +2650,20 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all) || !list_empty(&dev->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 -@@ -570,6 +571,22 @@ struct sk_buff *__napi_alloc_skb(struct - } - EXPORT_SYMBOL(__napi_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 -@@ -167,6 +167,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/patches-4.1/722-phy_mvswitch.patch b/target/linux/generic/patches-4.1/722-phy_mvswitch.patch deleted file mode 100644 index 209c5003ff..0000000000 --- a/target/linux/generic/patches-4.1/722-phy_mvswitch.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -140,6 +140,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 - tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB ---- 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_phy.o diff --git a/target/linux/generic/patches-4.1/723-phy_ip175c.patch b/target/linux/generic/patches-4.1/723-phy_ip175c.patch deleted file mode 100644 index 2293ca5ba7..0000000000 --- a/target/linux/generic/patches-4.1/723-phy_ip175c.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -144,6 +144,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 - tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB ---- 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_phy.o diff --git a/target/linux/generic/patches-4.1/724-phy_ar8216.patch b/target/linux/generic/patches-4.1/724-phy_ar8216.patch deleted file mode 100644 index 3a669bad67..0000000000 --- a/target/linux/generic/patches-4.1/724-phy_ar8216.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -148,6 +148,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 - tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB ---- 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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/patches-4.1/725-phy_rtl8306.patch b/target/linux/generic/patches-4.1/725-phy_rtl8306.patch deleted file mode 100644 index 5d4ce7c5be..0000000000 --- a/target/linux/generic/patches-4.1/725-phy_rtl8306.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -153,6 +153,10 @@ config AR8216_PHY - select ETHERNET_PACKET_MANGLE - select SWCONFIG - -+config RTL8306_PHY -+ tristate "Driver for Realtek RTL8306S switches" -+ select SWCONFIG -+ - config FIXED_PHY - tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB ---- 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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/patches-4.1/726-phy_rtl8366.patch b/target/linux/generic/patches-4.1/726-phy_rtl8366.patch deleted file mode 100644 index 83c7c4e222..0000000000 --- a/target/linux/generic/patches-4.1/726-phy_rtl8366.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -251,6 +251,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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/patches-4.1/727-phy-rtl8367.patch b/target/linux/generic/patches-4.1/727-phy-rtl8367.patch deleted file mode 100644 index 7e6b0359aa..0000000000 --- a/target/linux/generic/patches-4.1/727-phy-rtl8367.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -273,6 +273,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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/patches-4.1/728-phy-rtl8367b.patch b/target/linux/generic/patches-4.1/728-phy-rtl8367b.patch deleted file mode 100644 index 670168ee8c..0000000000 --- a/target/linux/generic/patches-4.1/728-phy-rtl8367b.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -277,6 +277,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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/patches-4.1/729-phy-tantos.patch b/target/linux/generic/patches-4.1/729-phy-tantos.patch deleted file mode 100644 index 67b879f2d8..0000000000 --- a/target/linux/generic/patches-4.1/729-phy-tantos.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -288,3 +288,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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/patches-4.1/730-phy_b53.patch b/target/linux/generic/patches-4.1/730-phy_b53.patch deleted file mode 100644 index ff166890d4..0000000000 --- a/target/linux/generic/patches-4.1/730-phy_b53.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -283,6 +283,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_phy.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/patches-4.1/732-phy-ar8216-led-support.patch b/target/linux/generic/patches-4.1/732-phy-ar8216-led-support.patch deleted file mode 100644 index e38cf7806e..0000000000 --- a/target/linux/generic/patches-4.1/732-phy-ar8216-led-support.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -153,6 +153,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/patches-4.1/733-phy_mvsw61xx.patch b/target/linux/generic/patches-4.1/733-phy_mvsw61xx.patch deleted file mode 100644 index b70326b082..0000000000 --- a/target/linux/generic/patches-4.1/733-phy_mvsw61xx.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -144,6 +144,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/patches-4.1/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/patches-4.1/734-net-phy-at803x-allow-to-configure-via-pdata.patch deleted file mode 100644 index 53abcc33ed..0000000000 --- a/target/linux/generic/patches-4.1/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ /dev/null @@ -1,180 +0,0 @@ ---- 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) -@@ -209,8 +257,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); -@@ -228,6 +284,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; - } - -@@ -259,6 +335,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 -@@ -289,6 +367,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/patches-4.1/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/patches-4.1/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 117f15d634..0000000000 --- a/target/linux/generic/patches-4.1/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ /dev/null @@ -1,96 +0,0 @@ ---- 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"); -@@ -268,6 +272,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) -@@ -394,7 +419,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, -@@ -413,7 +438,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, -@@ -431,8 +456,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, -@@ -454,9 +479,9 @@ static struct phy_driver at803x_driver[] - module_phy_driver(at803x_driver); - - 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/patches-4.1/760-8139cp-fixes-from-4.3.patch b/target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch deleted file mode 100644 index 832e425632..0000000000 --- a/target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch +++ /dev/null @@ -1,365 +0,0 @@ -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_irqoff(&cp->napi); - - spin_unlock_irqrestore(&cp->lock, flags); - } diff --git a/target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch b/target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch deleted file mode 100644 index 8fdf5f382f..0000000000 --- a/target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch +++ /dev/null @@ -1,103 +0,0 @@ -commit 8b7a7048220f86547db31de0abe1ea6dd2cfa892 -Author: David Woodhouse -Date: Thu Sep 24 11:38:22 2015 +0100 - - 8139cp: Fix GSO MSS handling - - When fixing the TSO support I noticed we just mask ->gso_size with the - MSSMask value and don't care about the consequences. - - Provide a .ndo_features_check() method which drops the NETIF_F_TSO - feature for any skb which would exceed the maximum, and thus forces it - to be segmented by software. - - Then we can stop the masking in cp_start_xmit(), and just WARN if the - maximum is exceeded, which should now never happen. - - Finally, Francois Romieu noticed that we didn't even have the right - value for MSSMask anyway; it should be 0x7ff (11 bits) not 0xfff. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit 5a58f227790faded5a3ef6075f3ddd65093e0f86 -Author: David Woodhouse -Date: Wed Sep 23 09:46:09 2015 +0100 - - 8139cp: Enable offload features by default - - I fixed TSO. Hardware checksum and scatter/gather also appear to be - working correctly both on real hardware and in QEMU's emulation. - - Let's enable them by default and see if anyone screams... - - 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 -@@ -175,7 +175,7 @@ enum { - LastFrag = (1 << 28), /* Final segment of a packet */ - LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ - MSSShift = 16, /* MSS value position */ -- MSSMask = 0xfff, /* MSS value: 11 bits */ -+ MSSMask = 0x7ff, /* MSS value: 11 bits */ - TxError = (1 << 23), /* Tx error summary */ - RxError = (1 << 20), /* Rx error summary */ - IPCS = (1 << 18), /* Calculate IP checksum */ -@@ -754,10 +754,16 @@ static netdev_tx_t cp_start_xmit (struct - eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; - mss = skb_shinfo(skb)->gso_size; - -+ if (mss > MSSMask) { -+ WARN_ONCE(1, "Net bug: GSO size %d too large for 8139CP\n", -+ mss); -+ goto out_dma_error; -+ } -+ - opts2 = cpu_to_le32(cp_tx_vlan_tag(skb)); - opts1 = DescOwn; - if (mss) -- opts1 |= LargeSend | ((mss & MSSMask) << MSSShift); -+ opts1 |= LargeSend | (mss << MSSShift); - else if (skb->ip_summed == CHECKSUM_PARTIAL) { - const struct iphdr *ip = ip_hdr(skb); - if (ip->protocol == IPPROTO_TCP) -@@ -1852,6 +1858,15 @@ static void cp_set_d3_state (struct cp_p - pci_set_power_state (cp->pdev, PCI_D3hot); - } - -+static netdev_features_t cp_features_check(struct sk_buff *skb, -+ struct net_device *dev, -+ netdev_features_t features) -+{ -+ if (skb_shinfo(skb)->gso_size > MSSMask) -+ features &= ~NETIF_F_TSO; -+ -+ return vlan_features_check(skb, features); -+} - static const struct net_device_ops cp_netdev_ops = { - .ndo_open = cp_open, - .ndo_stop = cp_close, -@@ -1864,6 +1879,7 @@ static const struct net_device_ops cp_ne - .ndo_tx_timeout = cp_tx_timeout, - .ndo_set_features = cp_set_features, - .ndo_change_mtu = cp_change_mtu, -+ .ndo_features_check = cp_features_check, - - #ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = cp_poll_controller, -@@ -1983,12 +1999,12 @@ static int cp_init_one (struct pci_dev * - dev->ethtool_ops = &cp_ethtool_ops; - dev->watchdog_timeo = TX_TIMEOUT; - -- dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; -+ dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | -+ NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; - - if (pci_using_dac) - dev->features |= NETIF_F_HIGHDMA; - -- /* disabled by default until verified */ - dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; - dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | diff --git a/target/linux/generic/patches-4.1/773-bgmac-add-srab-switch.patch b/target/linux/generic/patches-4.1/773-bgmac-add-srab-switch.patch deleted file mode 100644 index ae7cb1c92b..0000000000 --- a/target/linux/generic/patches-4.1/773-bgmac-add-srab-switch.patch +++ /dev/null @@ -1,72 +0,0 @@ -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 - **************************************************/ -@@ -1664,6 +1676,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"); -@@ -1690,6 +1712,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/patches-4.1/785-hso-support-0af0-9300.patch b/target/linux/generic/patches-4.1/785-hso-support-0af0-9300.patch deleted file mode 100644 index 621d08f4f1..0000000000 --- a/target/linux/generic/patches-4.1/785-hso-support-0af0-9300.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -466,6 +466,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/patches-4.1/810-pci_disable_common_quirks.patch b/target/linux/generic/patches-4.1/810-pci_disable_common_quirks.patch deleted file mode 100644 index 742618b03a..0000000000 --- a/target/linux/generic/patches-4.1/810-pci_disable_common_quirks.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/pci/Kconfig -+++ b/drivers/pci/Kconfig -@@ -68,6 +68,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. -@@ -2977,6 +2978,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 -@@ -3033,6 +3035,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). -@@ -3067,6 +3071,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/patches-4.1/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/patches-4.1/811-pci_disable_usb_common_quirks.patch deleted file mode 100644 index e078b4e8aa..0000000000 --- a/target/linux/generic/patches-4.1/811-pci_disable_usb_common_quirks.patch +++ /dev/null @@ -1,101 +0,0 @@ - ---- a/drivers/usb/host/pci-quirks.c -+++ b/drivers/usb/host/pci-quirks.c -@@ -97,6 +97,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; -@@ -450,6 +452,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. -@@ -529,8 +535,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; -@@ -1095,3 +1110,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 -@@ -448,7 +448,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/patches-4.1/831-ledtrig_netdev.patch b/target/linux/generic/patches-4.1/831-ledtrig_netdev.patch deleted file mode 100644 index f6f1f51b93..0000000000 --- a/target/linux/generic/patches-4.1/831-ledtrig_netdev.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- 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 -@@ -65,3 +65,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/patches-4.1/834-ledtrig-libata.patch b/target/linux/generic/patches-4.1/834-ledtrig-libata.patch deleted file mode 100644 index 41b7d9aa30..0000000000 --- a/target/linux/generic/patches-4.1/834-ledtrig-libata.patch +++ /dev/null @@ -1,153 +0,0 @@ -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 -@@ -728,6 +728,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 -@@ -4779,6 +4792,9 @@ struct ata_queued_cmd *ata_qc_new_init(s - if (tag < 0) - return NULL; - } -+#ifdef CONFIG_ATA_LEDS -+ ata_led_act(ap); -+#endif - - qc = __ata_qc_from_tag(ap, tag); - qc->tag = tag; -@@ -5676,6 +5692,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; -@@ -5697,6 +5716,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; - } -@@ -6143,7 +6168,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 -@@ -876,6 +879,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/patches-4.1/840-rtc7301.patch b/target/linux/generic/patches-4.1/840-rtc7301.patch deleted file mode 100644 index 148ccaa9d7..0000000000 --- a/target/linux/generic/patches-4.1/840-rtc7301.patch +++ /dev/null @@ -1,250 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -1109,6 +1109,15 @@ config RTC_DRV_OPAL - This driver can also be built as a module. If so, the module - will be called rtc-opal. - -+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 -@@ -121,6 +121,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/patches-4.1/841-rtc_pt7c4338.patch b/target/linux/generic/patches-4.1/841-rtc_pt7c4338.patch deleted file mode 100644 index 5de1b874b3..0000000000 --- a/target/linux/generic/patches-4.1/841-rtc_pt7c4338.patch +++ /dev/null @@ -1,247 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -596,6 +596,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 -@@ -112,6 +112,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/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch b/target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch deleted file mode 100644 index fc1b40c035..0000000000 --- a/target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch +++ /dev/null @@ -1,58 +0,0 @@ -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 -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -69,6 +70,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" - */ - -@@ -76,6 +78,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) -@@ -126,12 +129,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/patches-4.1/862-gpio_spi_driver.patch b/target/linux/generic/patches-4.1/862-gpio_spi_driver.patch deleted file mode 100644 index be059383f3..0000000000 --- a/target/linux/generic/patches-4.1/862-gpio_spi_driver.patch +++ /dev/null @@ -1,373 +0,0 @@ -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 -@@ -242,6 +242,15 @@ config SPI_IMG_SPFI - This enables support for the SPFI master controller found on - IMG SoCs. - -+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 -@@ -41,6 +41,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_IMG_SPFI) += spi-img-spfi.o - obj-$(CONFIG_SPI_IMX) += spi-imx.o - obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o diff --git a/target/linux/generic/patches-4.1/863-gpiommc.patch b/target/linux/generic/patches-4.1/863-gpiommc.patch deleted file mode 100644 index a8a8ec6502..0000000000 --- a/target/linux/generic/patches-4.1/863-gpiommc.patch +++ /dev/null @@ -1,844 +0,0 @@ ---- /dev/null -+++ b/drivers/mmc/host/gpiommc.c -@@ -0,0 +1,609 @@ -+/* -+ * Driver an MMC/SD card on a bitbanging GPIO SPI bus. -+ * This module hooks up the mmc_spi and spi_gpio modules and also -+ * provides a configfs interface. -+ * -+ * Copyright 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+#define PFX "gpio-mmc: " -+ -+ -+struct gpiommc_device { -+ struct platform_device *pdev; -+ struct platform_device *spi_pdev; -+ struct spi_board_info boardinfo; -+}; -+ -+ -+MODULE_DESCRIPTION("GPIO based MMC driver"); -+MODULE_AUTHOR("Michael Buesch"); -+MODULE_LICENSE("GPL"); -+ -+ -+static int gpiommc_boardinfo_setup(struct spi_board_info *bi, -+ struct spi_master *master, -+ void *data) -+{ -+ struct gpiommc_device *d = data; -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ /* Bind the SPI master to the MMC-SPI host driver. */ -+ strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias)); -+ -+ bi->max_speed_hz = pdata->max_bus_speed; -+ bi->bus_num = master->bus_num; -+ bi->mode = pdata->mode; -+ -+ return 0; -+} -+ -+static int gpiommc_probe(struct platform_device *pdev) -+{ -+ struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data; -+ struct spi_gpio_platform_data spi_pdata; -+ struct gpiommc_device *d; -+ int err; -+ -+ err = -ENXIO; -+ if (!mmc_pdata) -+ goto error; -+ -+#ifdef CONFIG_MMC_SPI_MODULE -+ err = request_module("mmc_spi"); -+ if (err) { -+ printk(KERN_WARNING PFX -+ "Failed to request mmc_spi module.\n"); -+ } -+#endif /* CONFIG_MMC_SPI_MODULE */ -+ -+ /* Allocate the GPIO-MMC device */ -+ err = -ENOMEM; -+ d = kzalloc(sizeof(*d), GFP_KERNEL); -+ if (!d) -+ goto error; -+ d->pdev = pdev; -+ -+ /* Create the SPI-GPIO device */ -+ d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME, -+ spi_gpio_next_id()); -+ if (!d->spi_pdev) -+ goto err_free_d; -+ -+ memset(&spi_pdata, 0, sizeof(spi_pdata)); -+ spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk; -+ spi_pdata.pin_miso = mmc_pdata->pins.gpio_do; -+ spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di; -+ spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs; -+ spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow; -+ spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay; -+ spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup; -+ spi_pdata.boardinfo_setup_data = d; -+ -+ err = platform_device_add_data(d->spi_pdev, &spi_pdata, -+ sizeof(spi_pdata)); -+ if (err) -+ goto err_free_pdev; -+ err = platform_device_add(d->spi_pdev); -+ if (err) -+ goto err_free_pdata; -+ platform_set_drvdata(pdev, d); -+ -+ printk(KERN_INFO PFX "MMC-Card \"%s\" " -+ "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n", -+ mmc_pdata->name, mmc_pdata->pins.gpio_di, -+ mmc_pdata->pins.gpio_do, -+ mmc_pdata->pins.gpio_clk, -+ mmc_pdata->pins.gpio_cs); -+ -+ return 0; -+ -+err_free_pdata: -+ kfree(d->spi_pdev->dev.platform_data); -+ d->spi_pdev->dev.platform_data = NULL; -+err_free_pdev: -+ platform_device_put(d->spi_pdev); -+err_free_d: -+ kfree(d); -+error: -+ return err; -+} -+ -+static int gpiommc_remove(struct platform_device *pdev) -+{ -+ struct gpiommc_device *d = platform_get_drvdata(pdev); -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ platform_device_unregister(d->spi_pdev); -+ printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n", -+ pdata->name); -+ platform_device_put(d->spi_pdev); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ -+/* A device that was created through configfs */ -+struct gpiommc_configfs_device { -+ struct config_item item; -+ /* The platform device, after registration. */ -+ struct platform_device *pdev; -+ /* The configuration */ -+ struct gpiommc_platform_data pdata; -+}; -+ -+#define GPIO_INVALID -1 -+ -+static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev) -+{ -+ return (dev->pdev != NULL); -+} -+ -+static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item) -+{ -+ return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL; -+} -+ -+static struct configfs_attribute gpiommc_attr_DI = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_in", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_DO = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_out", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CLK = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_clock", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS_activelow = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect_activelow", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spimode = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_mode", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spidelay = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_delay", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_max_bus_speed = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "max_bus_speed", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_register = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "register", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute *gpiommc_config_attrs[] = { -+ &gpiommc_attr_DI, -+ &gpiommc_attr_DO, -+ &gpiommc_attr_CLK, -+ &gpiommc_attr_CS, -+ &gpiommc_attr_CS_activelow, -+ &gpiommc_attr_spimode, -+ &gpiommc_attr_spidelay, -+ &gpiommc_attr_max_bus_speed, -+ &gpiommc_attr_register, -+ NULL, -+}; -+ -+static ssize_t gpiommc_config_attr_show(struct config_item *item, -+ struct configfs_attribute *attr, -+ char *page) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ ssize_t count = 0; -+ unsigned int gpio; -+ int err = 0; -+ -+ if (attr == &gpiommc_attr_DI) { -+ gpio = dev->pdata.pins.gpio_di; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ gpio = dev->pdata.pins.gpio_do; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ gpio = dev->pdata.pins.gpio_clk; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ gpio = dev->pdata.pins.gpio_cs; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.pins.cs_activelow); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.mode); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ !dev->pdata.no_spi_delay); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.max_bus_speed); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_register) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ gpiommc_is_registered(dev)); -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static int gpiommc_do_register(struct gpiommc_configfs_device *dev, -+ const char *name) -+{ -+ int err; -+ -+ if (gpiommc_is_registered(dev)) -+ return 0; -+ -+ if (!gpio_is_valid(dev->pdata.pins.gpio_di) || -+ !gpio_is_valid(dev->pdata.pins.gpio_do) || -+ !gpio_is_valid(dev->pdata.pins.gpio_clk) || -+ !gpio_is_valid(dev->pdata.pins.gpio_cs)) { -+ printk(KERN_ERR PFX -+ "configfs: Invalid GPIO pin number(s)\n"); -+ return -EINVAL; -+ } -+ -+ strlcpy(dev->pdata.name, name, -+ sizeof(dev->pdata.name)); -+ -+ dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, -+ gpiommc_next_id()); -+ if (!dev->pdev) -+ return -ENOMEM; -+ err = platform_device_add_data(dev->pdev, &dev->pdata, -+ sizeof(dev->pdata)); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ err = platform_device_add(dev->pdev); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev) -+{ -+ if (!gpiommc_is_registered(dev)) -+ return; -+ -+ platform_device_unregister(dev->pdev); -+ dev->pdev = NULL; -+} -+ -+static ssize_t gpiommc_config_attr_store(struct config_item *item, -+ struct configfs_attribute *attr, -+ const char *page, size_t count) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ int err = -EINVAL; -+ unsigned long data; -+ -+ if (attr == &gpiommc_attr_register) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data == 1) -+ err = gpiommc_do_register(dev, item->ci_name); -+ if (data == 0) { -+ gpiommc_do_unregister(dev); -+ err = 0; -+ } -+ goto out; -+ } -+ -+ if (gpiommc_is_registered(dev)) { -+ /* The rest of the config parameters can only be set -+ * as long as the device is not registered, yet. */ -+ err = -EBUSY; -+ goto out; -+ } -+ -+ if (attr == &gpiommc_attr_DI) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_di = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_do = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_clk = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_cs = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.pins.cs_activelow = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ switch (data) { -+ case 0: -+ dev->pdata.mode = SPI_MODE_0; -+ break; -+ case 1: -+ dev->pdata.mode = SPI_MODE_1; -+ break; -+ case 2: -+ dev->pdata.mode = SPI_MODE_2; -+ break; -+ case 3: -+ dev->pdata.mode = SPI_MODE_3; -+ break; -+ default: -+ goto out; -+ } -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.no_spi_delay = !data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data > UINT_MAX) -+ goto out; -+ dev->pdata.max_bus_speed = data; -+ err = 0; -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static void gpiommc_config_item_release(struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ kfree(dev); -+} -+ -+static struct configfs_item_operations gpiommc_config_item_ops = { -+ .release = gpiommc_config_item_release, -+ .show_attribute = gpiommc_config_attr_show, -+ .store_attribute = gpiommc_config_attr_store, -+}; -+ -+static struct config_item_type gpiommc_dev_ci_type = { -+ .ct_item_ops = &gpiommc_config_item_ops, -+ .ct_attrs = gpiommc_config_attrs, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct config_item *gpiommc_make_item(struct config_group *group, -+ const char *name) -+{ -+ struct gpiommc_configfs_device *dev; -+ -+ if (strlen(name) > GPIOMMC_MAX_NAMELEN) { -+ printk(KERN_ERR PFX "configfs: device name too long\n"); -+ return NULL; -+ } -+ -+ dev = kzalloc(sizeof(*dev), GFP_KERNEL); -+ if (!dev) -+ return NULL; -+ -+ config_item_init_type_name(&dev->item, name, -+ &gpiommc_dev_ci_type); -+ -+ /* Assign default configuration */ -+ dev->pdata.pins.gpio_di = GPIO_INVALID; -+ dev->pdata.pins.gpio_do = GPIO_INVALID; -+ dev->pdata.pins.gpio_clk = GPIO_INVALID; -+ dev->pdata.pins.gpio_cs = GPIO_INVALID; -+ dev->pdata.pins.cs_activelow = 1; -+ dev->pdata.mode = SPI_MODE_0; -+ dev->pdata.no_spi_delay = 0; -+ dev->pdata.max_bus_speed = 5000000; /* 5 MHz */ -+ -+ return &(dev->item); -+} -+ -+static void gpiommc_drop_item(struct config_group *group, -+ struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ gpiommc_do_unregister(dev); -+ kfree(dev); -+} -+ -+static struct configfs_group_operations gpiommc_ct_group_ops = { -+ .make_item = gpiommc_make_item, -+ .drop_item = gpiommc_drop_item, -+}; -+ -+static struct config_item_type gpiommc_ci_type = { -+ .ct_group_ops = &gpiommc_ct_group_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct configfs_subsystem gpiommc_subsys = { -+ .su_group = { -+ .cg_item = { -+ .ci_namebuf = GPIOMMC_PLATDEV_NAME, -+ .ci_type = &gpiommc_ci_type, -+ }, -+ }, -+ .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex), -+}; -+ -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+static struct platform_driver gpiommc_plat_driver = { -+ .probe = gpiommc_probe, -+ .remove = gpiommc_remove, -+ .driver = { -+ .name = GPIOMMC_PLATDEV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+int gpiommc_next_id(void) -+{ -+ static atomic_t counter = ATOMIC_INIT(-1); -+ -+ return atomic_inc_return(&counter); -+} -+EXPORT_SYMBOL(gpiommc_next_id); -+ -+static int __init gpiommc_modinit(void) -+{ -+ int err; -+ -+ err = platform_driver_register(&gpiommc_plat_driver); -+ if (err) -+ return err; -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ config_group_init(&gpiommc_subsys.su_group); -+ err = configfs_register_subsystem(&gpiommc_subsys); -+ if (err) { -+ platform_driver_unregister(&gpiommc_plat_driver); -+ return err; -+ } -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+ return 0; -+} -+module_init(gpiommc_modinit); -+ -+static void __exit gpiommc_modexit(void) -+{ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ configfs_unregister_subsystem(&gpiommc_subsys); -+#endif -+ platform_driver_unregister(&gpiommc_plat_driver); -+} -+module_exit(gpiommc_modexit); ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -556,6 +556,31 @@ config MMC_SDHI - This provides support for the SDHI SD/SDIO controller found in - SuperH and ARM SH-Mobile SoCs - -+config GPIOMMC -+ tristate "MMC/SD over GPIO-based SPI" -+ depends on MMC && MMC_SPI && SPI_GPIO_OLD -+ help -+ This driver hooks up the mmc_spi and spi_gpio modules so that -+ MMC/SD cards can be used on a GPIO based bus by bitbanging -+ the SPI protocol in software. -+ -+ This driver provides a configfs interface to dynamically create -+ and destroy GPIO-based MMC/SD card devices. It also provides -+ a platform device interface API. -+ See Documentation/gpiommc.txt for details. -+ -+ The module will be called gpiommc. -+ -+ If unsure, say N. -+ -+config GPIOMMC_CONFIGFS -+ bool -+ depends on GPIOMMC && CONFIGFS_FS -+ default y -+ help -+ This option automatically enables configfs support for gpiommc -+ if configfs is available. -+ - config MMC_CB710 - tristate "ENE CB710 MMC/SD Interface support" - depends on PCI ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -40,6 +40,7 @@ tmio_mmc_core-$(subst m,y,$(CONFIG_MMC_S - obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o - obj-$(CONFIG_MMC_CB710) += cb710-mmc.o - obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o -+obj-$(CONFIG_GPIOMMC) += gpiommc.o - obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o - obj-$(CONFIG_MMC_DW) += dw_mmc.o - obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o ---- /dev/null -+++ b/include/linux/mmc/gpiommc.h -@@ -0,0 +1,71 @@ -+/* -+ * Device driver for MMC/SD cards driven over a GPIO bus. -+ * -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL version 2. -+ */ -+#ifndef LINUX_GPIOMMC_H_ -+#define LINUX_GPIOMMC_H_ -+ -+#include -+ -+ -+#define GPIOMMC_MAX_NAMELEN 15 -+#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN) -+ -+/** -+ * struct gpiommc_pins - Hardware pin assignments -+ * -+ * @gpio_di: The GPIO number of the DATA IN pin -+ * @gpio_do: The GPIO number of the DATA OUT pin -+ * @gpio_clk: The GPIO number of the CLOCK pin -+ * @gpio_cs: The GPIO number of the CHIPSELECT pin -+ * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low. -+ */ -+struct gpiommc_pins { -+ unsigned int gpio_di; -+ unsigned int gpio_do; -+ unsigned int gpio_clk; -+ unsigned int gpio_cs; -+ bool cs_activelow; -+}; -+ -+/** -+ * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device. -+ * -+ * @name: The unique name string of the device. -+ * @pins: The hardware pin assignments. -+ * @mode: The hardware mode. This is either SPI_MODE_0, -+ * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation. -+ * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code. -+ * This is not standards compliant, but may be required for some -+ * embedded machines to gain reasonable speed. -+ * @max_bus_speed: The maximum speed of the SPI bus, in Hertz. -+ */ -+struct gpiommc_platform_data { -+ char name[GPIOMMC_MAX_NAMELEN + 1]; -+ struct gpiommc_pins pins; -+ u8 mode; -+ bool no_spi_delay; -+ unsigned int max_bus_speed; -+}; -+ -+/** -+ * GPIOMMC_PLATDEV_NAME - The platform device name string. -+ * -+ * The name string that has to be used for platform_device_alloc -+ * when allocating a gpiommc device. -+ */ -+#define GPIOMMC_PLATDEV_NAME "gpiommc" -+ -+/** -+ * gpiommc_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 gpiommc_next_id(void); -+ -+#endif /* LINUX_GPIOMMC_H_ */ ---- /dev/null -+++ b/Documentation/gpiommc.txt -@@ -0,0 +1,97 @@ -+GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus -+================================================================ -+ -+The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an -+MMC or SD card on GPIO pins. -+ -+Two interfaces for registering a new MMC/SD card device are provided: -+A static platform-device based mechanism and a dynamic configfs based interface. -+ -+ -+Registering devices via platform-device -+======================================= -+ -+The platform-device interface is used for registering MMC/SD devices that are -+part of the hardware platform. This is most useful only for embedded machines -+with MMC/SD devices statically connected to the platform GPIO bus. -+ -+The data structures are declared in . -+ -+To register a new device, define an instance of struct gpiommc_platform_data. -+This structure holds any information about how the device is hooked up to the -+GPIO pins and what hardware modes the device supports. See the docbook-style -+documentation in the header file for more information on the struct fields. -+ -+Then allocate a new instance of a platform device by doing: -+ -+ pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id()); -+ -+This will allocate the platform device data structures and hook it up to the -+gpiommc driver. -+Then add the gpiommc_platform_data to the platform device. -+ -+ err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data)); -+ -+You may free the local instance of struct gpiommc_platform_data now. (So the -+struct may be allocated on the stack, too). -+Now simply register the platform device. -+ -+ err = platform_device_add(pdev); -+ -+Done. The gpiommc probe routine will be invoked now and you should see a kernel -+log message for the added device. -+ -+ -+Registering devices via configfs -+================================ -+ -+MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example -+selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded -+hardware are a common situation. -+So we provide a dynamic interface to conveniently handle adding and removing -+devices from userspace, without the need to recompile the kernel. -+ -+The "gpiommc" subdirectory at the configfs mountpoint is used for handling -+the dynamic configuration. -+ -+To create a new device, it must first be allocated with mkdir. -+The following command will allocate a device named "my_mmc": -+ mkdir /config/gpiommc/my_mmc -+ -+There are several configuration files available in the new -+/config/gpiommc/my_mmc/ directory: -+ -+gpio_data_in = The SPI data-IN GPIO pin number. -+gpio_data_out = The SPI data-OUT GPIO pin number. -+gpio_clock = The SPI Clock GPIO pin number. -+gpio_chipselect = The SPI Chipselect GPIO pin number. -+gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH. -+ If 1, Chipselect is active-LOW. -+spi_mode = The SPI data mode. Can be 0-3. -+spi_delay = Enable all delays in the lowlevel bitbanging. -+max_bus_speed = The maximum SPI bus speed. In Hertz. -+ -+register = Not a configuration parameter. -+ Used to register the configured card -+ with the kernel. -+ -+The device must first get configured and then registered by writing "1" to -+the "register" file. -+The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock" -+and "gpio_chipselect" are essential and _must_ be configured before writing -+"1" to the "register" file. The registration will fail, otherwise. -+ -+The default values for the other parameters are: -+gpio_chipselect_activelow = 1 (CS active-LOW) -+spi_mode = 0 (SPI_MODE_0) -+spi_delay = 1 (enabled) -+max_bus_speed = 5000000 (5 Mhz) -+ -+Configuration values can not be changed after registration. To unregister -+the device, write a "0" to the "register" file. The configuration can be -+changed again after unregistering. -+ -+To completely remove the device, simply rmdir the directory -+(/config/gpiommc/my_mmc in this example). -+There's no need to first unregister the device before removing it. That will -+be done automatically. ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -4541,6 +4541,11 @@ T: git git://linuxtv.org/anttip/media_tr - S: Maintained - F: drivers/media/usb/hackrf/ - -+GPIOMMC DRIVER -+P: Michael Buesch -+M: mb@bu3sch.de -+S: Maintained -+ - HARDWARE MONITORING - M: Jean Delvare - M: Guenter Roeck diff --git a/target/linux/generic/patches-4.1/864-gpiommc_configfs_locking.patch b/target/linux/generic/patches-4.1/864-gpiommc_configfs_locking.patch deleted file mode 100644 index 92815d91f4..0000000000 --- a/target/linux/generic/patches-4.1/864-gpiommc_configfs_locking.patch +++ /dev/null @@ -1,58 +0,0 @@ -The gpiommc configfs context structure needs locking, as configfs -does not lock access between files. - ---- a/drivers/mmc/host/gpiommc.c -+++ b/drivers/mmc/host/gpiommc.c -@@ -144,6 +144,8 @@ struct gpiommc_configfs_device { - struct platform_device *pdev; - /* The configuration */ - struct gpiommc_platform_data pdata; -+ /* Mutex to protect this structure */ -+ struct mutex mutex; - }; - - #define GPIO_INVALID -1 -@@ -234,6 +236,8 @@ static ssize_t gpiommc_config_attr_show( - unsigned int gpio; - int err = 0; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_DI) { - gpio = dev->pdata.pins.gpio_di; - if (gpio == GPIO_INVALID) -@@ -294,6 +298,8 @@ static ssize_t gpiommc_config_attr_show( - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -353,6 +359,8 @@ static ssize_t gpiommc_config_attr_store - int err = -EINVAL; - unsigned long data; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_register) { - err = kstrtoul(page, 10, &data); - if (err) -@@ -478,6 +486,8 @@ static ssize_t gpiommc_config_attr_store - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -514,6 +524,7 @@ static struct config_item *gpiommc_make_ - if (!dev) - return NULL; - -+ mutex_init(&dev->mutex); - config_item_init_type_name(&dev->item, name, - &gpiommc_dev_ci_type); - diff --git a/target/linux/generic/patches-4.1/870-hifn795x_byteswap.patch b/target/linux/generic/patches-4.1/870-hifn795x_byteswap.patch deleted file mode 100644 index 3a37c951ec..0000000000 --- a/target/linux/generic/patches-4.1/870-hifn795x_byteswap.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- 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/patches-4.1/880-gateworks_system_controller.patch b/target/linux/generic/patches-4.1/880-gateworks_system_controller.patch deleted file mode 100644 index 265772309b..0000000000 --- a/target/linux/generic/patches-4.1/880-gateworks_system_controller.patch +++ /dev/null @@ -1,339 +0,0 @@ ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -507,6 +507,15 @@ config SENSORS_G762 - This driver can also be built as a module. If so, the module - will be called g762. - -+config SENSORS_GSC -+ tristate "Gateworks System Controller" -+ depends on I2C -+ help -+ If you say yes here you get support for the Gateworks System Controller. -+ -+ This driver can also be built as a module. If so, the module -+ will be called gsc. -+ - config SENSORS_GPIO_FAN - tristate "GPIO fan" - depends on GPIOLIB ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -156,6 +156,7 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l7 - obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o - obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o - obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o -+obj-$(CONFIG_SENSORS_GSC) += gsc.o - - obj-$(CONFIG_PMBUS) += pmbus/ - ---- /dev/null -+++ b/drivers/hwmon/gsc.c -@@ -0,0 +1,308 @@ -+/* -+ * A hwmon driver for the Gateworks System Controller -+ * Copyright (C) 2009 Gateworks Corporation -+ * -+ * Author: Chris Lang -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRV_VERSION "0.2" -+ -+enum chips { gsp }; -+ -+/* AD7418 registers */ -+#define GSP_REG_TEMP_IN 0x00 -+#define GSP_REG_VIN 0x02 -+#define GSP_REG_3P3 0x05 -+#define GSP_REG_BAT 0x08 -+#define GSP_REG_5P0 0x0b -+#define GSP_REG_CORE 0x0e -+#define GSP_REG_CPU1 0x11 -+#define GSP_REG_CPU2 0x14 -+#define GSP_REG_DRAM 0x17 -+#define GSP_REG_EXT_BAT 0x1a -+#define GSP_REG_IO1 0x1d -+#define GSP_REG_IO2 0x20 -+#define GSP_REG_PCIE 0x23 -+#define GSP_REG_CURRENT 0x26 -+#define GSP_FAN_0 0x2C -+#define GSP_FAN_1 0x2E -+#define GSP_FAN_2 0x30 -+#define GSP_FAN_3 0x32 -+#define GSP_FAN_4 0x34 -+#define GSP_FAN_5 0x36 -+ -+struct gsp_sensor_info { -+ const char* name; -+ int reg; -+}; -+ -+static const struct gsp_sensor_info gsp_sensors[] = { -+ {"temp", GSP_REG_TEMP_IN}, -+ {"vin", GSP_REG_VIN}, -+ {"3p3", GSP_REG_3P3}, -+ {"bat", GSP_REG_BAT}, -+ {"5p0", GSP_REG_5P0}, -+ {"core", GSP_REG_CORE}, -+ {"cpu1", GSP_REG_CPU1}, -+ {"cpu2", GSP_REG_CPU2}, -+ {"dram", GSP_REG_DRAM}, -+ {"ext_bat", GSP_REG_EXT_BAT}, -+ {"io1", GSP_REG_IO1}, -+ {"io2", GSP_REG_IO2}, -+ {"pci2", GSP_REG_PCIE}, -+ {"current", GSP_REG_CURRENT}, -+ {"fan_point0", GSP_FAN_0}, -+ {"fan_point1", GSP_FAN_1}, -+ {"fan_point2", GSP_FAN_2}, -+ {"fan_point3", GSP_FAN_3}, -+ {"fan_point4", GSP_FAN_4}, -+ {"fan_point5", GSP_FAN_5}, -+}; -+ -+struct gsp_data { -+ struct device *hwmon_dev; -+ struct attribute_group attrs; -+ enum chips type; -+}; -+ -+static int gsp_probe(struct i2c_client *client, -+ const struct i2c_device_id *id); -+static int gsp_remove(struct i2c_client *client); -+ -+static const struct i2c_device_id gsp_id[] = { -+ { "gsp", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, gsp_id); -+ -+static struct i2c_driver gsp_driver = { -+ .driver = { -+ .name = "gsp", -+ }, -+ .probe = gsp_probe, -+ .remove = gsp_remove, -+ .id_table = gsp_id, -+}; -+ -+/* All registers are word-sized, except for the configuration registers. -+ * AD7418 uses a high-byte first convention. Do NOT use those functions to -+ * access the configuration registers CONF and CONF2, as they are byte-sized. -+ */ -+static inline int gsp_read(struct i2c_client *client, u8 reg) -+{ -+ unsigned int adc = 0; -+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT) -+ { -+ adc |= i2c_smbus_read_byte_data(client, reg); -+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; -+ return adc; -+ } -+ else -+ { -+ adc |= i2c_smbus_read_byte_data(client, reg); -+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; -+ adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16; -+ return adc; -+ } -+} -+ -+static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value) -+{ -+ i2c_smbus_write_byte_data(client, reg, value & 0xff); -+ i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff)); -+ return 1; -+} -+ -+static ssize_t show_adc(struct device *dev, struct device_attribute *devattr, -+ char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct i2c_client *client = to_i2c_client(dev); -+ return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg)); -+} -+ -+static ssize_t show_label(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ -+ return sprintf(buf, "%s\n", gsp_sensors[attr->index].name); -+} -+ -+static ssize_t store_fan(struct device *dev, -+ struct device_attribute *devattr, const char *buf, size_t count) -+{ -+ u16 val; -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct i2c_client *client = to_i2c_client(dev); -+ val = simple_strtoul(buf, NULL, 10); -+ gsp_write(client, gsp_sensors[attr->index].reg, val); -+ return count; -+} -+ -+static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0); -+static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0); -+ -+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1); -+static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1); -+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2); -+static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2); -+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3); -+static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3); -+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4); -+static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4); -+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5); -+static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5); -+static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6); -+static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6); -+static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7); -+static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7); -+static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8); -+static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8); -+static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9); -+static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9); -+static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10); -+static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10); -+static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11); -+static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11); -+static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12); -+static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12); -+static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13); -+static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13); -+ -+static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14); -+static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15); -+static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16); -+static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17); -+static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18); -+static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19); -+ -+static struct attribute *gsp_attributes[] = { -+ &sensor_dev_attr_temp0_input.dev_attr.attr, -+ &sensor_dev_attr_in0_input.dev_attr.attr, -+ &sensor_dev_attr_in1_input.dev_attr.attr, -+ &sensor_dev_attr_in2_input.dev_attr.attr, -+ &sensor_dev_attr_in3_input.dev_attr.attr, -+ &sensor_dev_attr_in4_input.dev_attr.attr, -+ &sensor_dev_attr_in5_input.dev_attr.attr, -+ &sensor_dev_attr_in6_input.dev_attr.attr, -+ &sensor_dev_attr_in7_input.dev_attr.attr, -+ &sensor_dev_attr_in8_input.dev_attr.attr, -+ &sensor_dev_attr_in9_input.dev_attr.attr, -+ &sensor_dev_attr_in10_input.dev_attr.attr, -+ &sensor_dev_attr_in11_input.dev_attr.attr, -+ &sensor_dev_attr_in12_input.dev_attr.attr, -+ -+ &sensor_dev_attr_temp0_label.dev_attr.attr, -+ &sensor_dev_attr_in0_label.dev_attr.attr, -+ &sensor_dev_attr_in1_label.dev_attr.attr, -+ &sensor_dev_attr_in2_label.dev_attr.attr, -+ &sensor_dev_attr_in3_label.dev_attr.attr, -+ &sensor_dev_attr_in4_label.dev_attr.attr, -+ &sensor_dev_attr_in5_label.dev_attr.attr, -+ &sensor_dev_attr_in6_label.dev_attr.attr, -+ &sensor_dev_attr_in7_label.dev_attr.attr, -+ &sensor_dev_attr_in8_label.dev_attr.attr, -+ &sensor_dev_attr_in9_label.dev_attr.attr, -+ &sensor_dev_attr_in10_label.dev_attr.attr, -+ &sensor_dev_attr_in11_label.dev_attr.attr, -+ &sensor_dev_attr_in12_label.dev_attr.attr, -+ -+ &sensor_dev_attr_fan0_point0.dev_attr.attr, -+ &sensor_dev_attr_fan0_point1.dev_attr.attr, -+ &sensor_dev_attr_fan0_point2.dev_attr.attr, -+ &sensor_dev_attr_fan0_point3.dev_attr.attr, -+ &sensor_dev_attr_fan0_point4.dev_attr.attr, -+ &sensor_dev_attr_fan0_point5.dev_attr.attr, -+ NULL -+}; -+ -+ -+static int gsp_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct i2c_adapter *adapter = client->adapter; -+ struct gsp_data *data; -+ int err; -+ -+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | -+ I2C_FUNC_SMBUS_WORD_DATA)) { -+ err = -EOPNOTSUPP; -+ goto exit; -+ } -+ -+ if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) { -+ err = -ENOMEM; -+ goto exit; -+ } -+ -+ i2c_set_clientdata(client, data); -+ -+ data->type = id->driver_data; -+ -+ switch (data->type) { -+ case 0: -+ data->attrs.attrs = gsp_attributes; -+ break; -+ } -+ -+ dev_info(&client->dev, "%s chip found\n", client->name); -+ -+ /* Register sysfs hooks */ -+ if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) -+ goto exit_free; -+ -+ data->hwmon_dev = hwmon_device_register(&client->dev); -+ if (IS_ERR(data->hwmon_dev)) { -+ err = PTR_ERR(data->hwmon_dev); -+ goto exit_remove; -+ } -+ -+ return 0; -+ -+exit_remove: -+ sysfs_remove_group(&client->dev.kobj, &data->attrs); -+exit_free: -+ kfree(data); -+exit: -+ return err; -+} -+ -+static int gsp_remove(struct i2c_client *client) -+{ -+ struct gsp_data *data = i2c_get_clientdata(client); -+ hwmon_device_unregister(data->hwmon_dev); -+ sysfs_remove_group(&client->dev.kobj, &data->attrs); -+ kfree(data); -+ return 0; -+} -+ -+static int __init gsp_init(void) -+{ -+ return i2c_add_driver(&gsp_driver); -+} -+ -+static void __exit gsp_exit(void) -+{ -+ i2c_del_driver(&gsp_driver); -+} -+ -+module_init(gsp_init); -+module_exit(gsp_exit); -+ -+MODULE_AUTHOR("Chris Lang "); -+MODULE_DESCRIPTION("GSC HWMON driver"); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION(DRV_VERSION); -+ diff --git a/target/linux/generic/patches-4.1/890-8250_optional_sysrq.patch b/target/linux/generic/patches-4.1/890-8250_optional_sysrq.patch deleted file mode 100644 index 8815e4c644..0000000000 --- a/target/linux/generic/patches-4.1/890-8250_optional_sysrq.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- 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/patches-4.1/901-debloat_sock_diag.patch b/target/linux/generic/patches-4.1/901-debloat_sock_diag.patch deleted file mode 100644 index 071616942f..0000000000 --- a/target/linux/generic/patches-4.1/901-debloat_sock_diag.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- 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 -@@ -428,6 +428,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 -@@ -13,6 +13,7 @@ config NETLINK_MMAP - - 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/patches-4.1/902-debloat_proc.patch b/target/linux/generic/patches-4.1/902-debloat_proc.patch deleted file mode 100644 index b0dce818b5..0000000000 --- a/target/linux/generic/patches-4.1/902-debloat_proc.patch +++ /dev/null @@ -1,385 +0,0 @@ ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2683,6 +2683,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 -@@ -143,7 +143,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; -@@ -160,6 +163,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; -@@ -174,6 +180,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 -@@ -41,6 +41,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 -@@ -327,6 +327,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; - -@@ -376,6 +379,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 -@@ -411,6 +417,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 -@@ -388,6 +388,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 -@@ -2683,6 +2683,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 -@@ -1528,10 +1528,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 -@@ -2970,6 +2970,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 -@@ -2626,10 +2626,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; - -@@ -2639,17 +2641,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 -@@ -535,6 +535,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 -@@ -416,6 +416,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 -@@ -1040,6 +1040,9 @@ void __init msg_init(void) - { - msg_init_ns(&init_ipc_ns); - -+ 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 -@@ -121,6 +121,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); - } - ---- a/include/net/snmp.h -+++ b/include/net/snmp.h -@@ -123,6 +123,30 @@ struct linux_xfrm_mib { - #define DECLARE_SNMP_STAT(type, name) \ - extern __typeof__(type) __percpu *name - -+#ifdef CONFIG_PROC_STRIPPED -+#define SNMP_INC_STATS_BH(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_INC_STATS_USER(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_INC_STATS(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_DEC_STATS(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_ADD_STATS_BH(mib, field, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_ADD_STATS_USER(mib, field, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_ADD_STATS(mib, field, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+ -+#else -+ - #define SNMP_INC_STATS_BH(mib, field) \ - __this_cpu_inc(mib->mibs[field]) - -@@ -159,8 +183,9 @@ struct linux_xfrm_mib { - __this_cpu_add(ptr[basefield##OCTETS], addend); \ - } while (0) - -+#endif - --#if BITS_PER_LONG==32 -+#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED) - - #define SNMP_ADD_STATS64_BH(mib, field, addend) \ - do { \ diff --git a/target/linux/generic/patches-4.1/903-debloat_direct_io.patch b/target/linux/generic/patches-4.1/903-debloat_direct_io.patch deleted file mode 100644 index 92e36f0bb1..0000000000 --- a/target/linux/generic/patches-4.1/903-debloat_direct_io.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -71,6 +71,11 @@ config FILE_LOCKING - for filesystems like NFS and for the flock() system - call. Disabling this option saves about 11k. - -+config DIRECT_IO -+ bool "Enable O_DIRECT support" if EXPERT -+ depends on BLOCK -+ default y -+ - source "fs/notify/Kconfig" - - source "fs/quota/Kconfig" ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -14,7 +14,8 @@ obj-y := open.o read_write.o file_table. - stack.o fs_struct.o statfs.o fs_pin.o nsfs.o - - ifeq ($(CONFIG_BLOCK),y) --obj-y += buffer.o block_dev.o direct-io.o mpage.o -+obj-y += buffer.o block_dev.o mpage.o -+obj-$(CONFIG_DIRECT_IO) += direct-io.o - else - obj-y += no-block.o - endif ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -2659,6 +2659,7 @@ enum { - DIO_SKIP_DIO_COUNT = 0x08, - }; - -+#ifdef CONFIG_DIRECT_IO - void dio_end_io(struct bio *bio, int error); - - ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, -@@ -2666,6 +2667,18 @@ ssize_t __blockdev_direct_IO(struct kioc - loff_t offset, get_block_t get_block, - dio_iodone_t end_io, dio_submit_t submit_io, - int flags); -+#else -+static inline void dio_end_io(struct bio *bio, int error) -+{ -+} -+static inline ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, -+ struct block_device *bdev, struct iov_iter *iter, loff_t offset, -+ get_block_t get_block, dio_iodone_t end_io, -+ dio_submit_t submit_io, int flags) -+{ -+ return -EOPNOTSUPP; -+} -+#endif - - static inline ssize_t blockdev_direct_IO(struct kiocb *iocb, - struct inode *inode, ---- a/fs/fcntl.c -+++ b/fs/fcntl.c -@@ -52,8 +52,10 @@ static int setfl(int fd, struct file * f - arg |= O_NONBLOCK; - - if (arg & O_DIRECT) { -+#ifdef CONFIG_DIRECT_IO - if (!filp->f_mapping || !filp->f_mapping->a_ops || - !filp->f_mapping->a_ops->direct_IO) -+#endif - return -EINVAL; - } - ---- a/fs/open.c -+++ b/fs/open.c -@@ -671,7 +671,9 @@ int open_check_o_direct(struct file *f) - { - /* NB: we're sure to have correct a_ops only after f_op->open */ - if (f->f_flags & O_DIRECT) { -+#ifdef CONFIG_DIRECT_IO - if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO) -+#endif - return -EINVAL; - } - return 0; diff --git a/target/linux/generic/patches-4.1/904-debloat_dma_buf.patch b/target/linux/generic/patches-4.1/904-debloat_dma_buf.patch deleted file mode 100644 index 8aca297377..0000000000 --- a/target/linux/generic/patches-4.1/904-debloat_dma_buf.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- 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 *); - -@@ -901,4 +902,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 -@@ -1790,6 +1790,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/patches-4.1/910-kobject_uevent.patch b/target/linux/generic/patches-4.1/910-kobject_uevent.patch deleted file mode 100644 index a2c935f26b..0000000000 --- a/target/linux/generic/patches-4.1/910-kobject_uevent.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -52,6 +52,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/patches-4.1/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/patches-4.1/911-kobject_add_broadcast_uevent.patch deleted file mode 100644 index 3afaac1efe..0000000000 --- a/target/linux/generic/patches-4.1/911-kobject_add_broadcast_uevent.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- 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 -@@ -423,6 +423,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/patches-4.1/921-use_preinit_as_init.patch b/target/linux/generic/patches-4.1/921-use_preinit_as_init.patch deleted file mode 100644 index 73da5b3a54..0000000000 --- a/target/linux/generic/patches-4.1/921-use_preinit_as_init.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -960,7 +960,8 @@ static int __ref kernel_init(void *unuse - panic("Requested init %s failed (error %d).", - 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/patches-4.1/922-always-create-console-node-in-initramfs.patch b/target/linux/generic/patches-4.1/922-always-create-console-node-in-initramfs.patch deleted file mode 100644 index 988de35ce0..0000000000 --- a/target/linux/generic/patches-4.1/922-always-create-console-node-in-initramfs.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- 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/patches-4.1/930-crashlog.patch b/target/linux/generic/patches-4.1/930-crashlog.patch deleted file mode 100644 index ca6cf11064..0000000000 --- a/target/linux/generic/patches-4.1/930-crashlog.patch +++ /dev/null @@ -1,276 +0,0 @@ ---- /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 -@@ -1275,6 +1275,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 -@@ -98,6 +98,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 -@@ -104,6 +104,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/patches-4.1/970-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/patches-4.1/970-remove-unsane-filenames-from-deps_initramfs-list.patch deleted file mode 100644 index ac13c9e673..0000000000 --- a/target/linux/generic/patches-4.1/970-remove-unsane-filenames-from-deps_initramfs-list.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- 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/patches-4.1/980-arm_openwrt_machtypes.patch b/target/linux/generic/patches-4.1/980-arm_openwrt_machtypes.patch deleted file mode 100644 index 60ca07e1a2..0000000000 --- a/target/linux/generic/patches-4.1/980-arm_openwrt_machtypes.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/arch/arm/tools/mach-types -+++ b/arch/arm/tools/mach-types -@@ -1006,3 +1006,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/patches-4.1/995-mangle_bootargs.patch b/target/linux/generic/patches-4.1/995-mangle_bootargs.patch deleted file mode 100644 index 1062a694a3..0000000000 --- a/target/linux/generic/patches-4.1/995-mangle_bootargs.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -352,6 +352,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 -@@ -522,6 +545,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 -@@ -1607,6 +1607,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/patches-4.1/997-device_tree_cmdline.patch b/target/linux/generic/patches-4.1/997-device_tree_cmdline.patch deleted file mode 100644 index 076cb6d709..0000000000 --- a/target/linux/generic/patches-4.1/997-device_tree_cmdline.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/of/fdt.c -+++ b/drivers/of/fdt.c -@@ -935,6 +935,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 -@@ -50,6 +50,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/patches-4.1/998-enable_wilink_platform_without_drivers.patch b/target/linux/generic/patches-4.1/998-enable_wilink_platform_without_drivers.patch deleted file mode 100644 index d317de1102..0000000000 --- a/target/linux/generic/patches-4.1/998-enable_wilink_platform_without_drivers.patch +++ /dev/null @@ -1,15 +0,0 @@ -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/patches-4.4/040-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch b/target/linux/generic/patches-4.4/040-0001-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch similarity index 100% rename from target/linux/generic/patches-4.4/040-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch rename to target/linux/generic/patches-4.4/040-0001-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch diff --git a/target/linux/generic/patches-4.4/041-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch b/target/linux/generic/patches-4.4/040-0002-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch similarity index 100% rename from target/linux/generic/patches-4.4/041-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch rename to target/linux/generic/patches-4.4/040-0002-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch diff --git a/target/linux/generic/patches-4.4/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch b/target/linux/generic/patches-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch similarity index 87% rename from target/linux/generic/patches-4.4/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch rename to target/linux/generic/patches-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch index b0a064fb4e..8214013c56 100644 --- a/target/linux/generic/patches-4.4/142-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch +++ b/target/linux/generic/patches-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch @@ -1,6 +1,6 @@ -From 72fc448c4c970bdbba604ab340f16080b4f3bb17 Mon Sep 17 00:00:00 2001 +From 2c81de771f38e54324ede3f24118f4852570b384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 26 Nov 2015 08:52:09 +0100 +Date: Thu, 26 Nov 2015 09:05:04 +0100 Subject: [PATCH] mtd: spi-nor: include mtd.h header for struct mtd_info definition MIME-Version: 1.0 @@ -13,6 +13,7 @@ embed whole struct so we need to include a proper header. Fixes: 1976367173a4 ("mtd: spi-nor: embed struct mtd_info within struct spi_nor") Signed-off-by: Rafał Miłecki +Signed-off-by: Brian Norris --- include/linux/mtd/spi-nor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch b/target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch new file mode 100644 index 0000000000..5048bcca7d --- /dev/null +++ b/target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch @@ -0,0 +1,47 @@ +From 76a4707de5e18dc32d9cb4e990686140c5664a15 Mon Sep 17 00:00:00 2001 +From: Brian Norris +Date: Fri, 29 Jan 2016 11:25:35 -0800 +Subject: [PATCH] mtd: spi-nor: add SPI_NOR_HAS_LOCK flag + +We can't determine this purely by manufacturer type (see commit +67b9bcd36906 ("mtd: spi-nor: fix Spansion regressions (aliased with +Winbond)")), and it's not autodetectable by anything like SFDP. So make +a new flag for it. + +Signed-off-by: Brian Norris +Reviewed-by: Ezequiel Garcia +Tested-by: Ezequiel Garcia +--- + drivers/mtd/spi-nor/spi-nor.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -68,6 +68,7 @@ struct flash_info { + #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ + #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ + #define USE_FSR 0x80 /* use flag status register */ ++#define SPI_NOR_HAS_LOCK 0x100 /* Flash supports lock/unlock via SR */ + }; + + #define JEDEC_MFR(info) ((info)->id[0]) +@@ -1156,7 +1157,8 @@ int spi_nor_scan(struct spi_nor *nor, co + + if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || + JEDEC_MFR(info) == SNOR_MFR_INTEL || +- JEDEC_MFR(info) == SNOR_MFR_SST) { ++ JEDEC_MFR(info) == SNOR_MFR_SST || ++ info->flags & SPI_NOR_HAS_LOCK) { + write_enable(nor); + write_sr(nor, 0); + } +@@ -1172,7 +1174,8 @@ int spi_nor_scan(struct spi_nor *nor, co + mtd->_read = spi_nor_read; + + /* NOR protection support for STmicro/Micron chips and similar */ +- if (JEDEC_MFR(info) == SNOR_MFR_MICRON) { ++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON || ++ info->flags & SPI_NOR_HAS_LOCK) { + nor->flash_lock = stm_lock; + nor->flash_unlock = stm_unlock; + nor->flash_is_locked = stm_is_locked; diff --git a/target/linux/generic/patches-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch b/target/linux/generic/patches-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch new file mode 100644 index 0000000000..662584ca61 --- /dev/null +++ b/target/linux/generic/patches-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch @@ -0,0 +1,82 @@ +From 854826c9d526fd81077742c3b000e3f7fcaef3ce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 20 Sep 2016 10:36:14 +0200 +Subject: [PATCH] ubifs: Drop softlimit and delta fields from struct ubifs_wbuf +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Values of these fields are set during init and never modified. They are +used (read) in a single function only. There isn't really any reason to +keep them in a struct. It only makes struct just a bit bigger without +any visible gain. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Boris Brezillon +Signed-off-by: Richard Weinberger +--- + fs/ubifs/io.c | 18 ++++++++++-------- + fs/ubifs/ubifs.h | 5 ----- + 2 files changed, 10 insertions(+), 13 deletions(-) + +--- a/fs/ubifs/io.c ++++ b/fs/ubifs/io.c +@@ -452,16 +452,22 @@ static enum hrtimer_restart wbuf_timer_c + */ + static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) + { ++ ktime_t softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); ++ unsigned long long delta; ++ ++ delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; ++ delta *= 1000000000ULL; ++ + ubifs_assert(!hrtimer_active(&wbuf->timer)); ++ ubifs_assert(delta <= ULONG_MAX); + + if (wbuf->no_timer) + return; + dbg_io("set timer for jhead %s, %llu-%llu millisecs", + dbg_jhead(wbuf->jhead), +- div_u64(ktime_to_ns(wbuf->softlimit), USEC_PER_SEC), +- div_u64(ktime_to_ns(wbuf->softlimit) + wbuf->delta, +- USEC_PER_SEC)); +- hrtimer_start_range_ns(&wbuf->timer, wbuf->softlimit, wbuf->delta, ++ div_u64(ktime_to_ns(softlimit), USEC_PER_SEC), ++ div_u64(ktime_to_ns(softlimit) + delta, USEC_PER_SEC)); ++ hrtimer_start_range_ns(&wbuf->timer, softlimit, delta, + HRTIMER_MODE_REL); + } + +@@ -1059,10 +1065,6 @@ int ubifs_wbuf_init(struct ubifs_info *c + + hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + wbuf->timer.function = wbuf_timer_callback_nolock; +- wbuf->softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); +- wbuf->delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; +- wbuf->delta *= 1000000000ULL; +- ubifs_assert(wbuf->delta <= ULONG_MAX); + return 0; + } + +--- a/fs/ubifs/ubifs.h ++++ b/fs/ubifs/ubifs.h +@@ -668,9 +668,6 @@ typedef int (*ubifs_lpt_scan_callback)(s + * @io_mutex: serializes write-buffer I/O + * @lock: serializes @buf, @lnum, @offs, @avail, @used, @next_ino and @inodes + * fields +- * @softlimit: soft write-buffer timeout interval +- * @delta: hard and soft timeouts delta (the timer expire interval is @softlimit +- * and @softlimit + @delta) + * @timer: write-buffer timer + * @no_timer: non-zero if this write-buffer does not have a timer + * @need_sync: non-zero if the timer expired and the wbuf needs sync'ing +@@ -699,8 +696,6 @@ struct ubifs_wbuf { + int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); + struct mutex io_mutex; + spinlock_t lock; +- ktime_t softlimit; +- unsigned long long delta; + struct hrtimer timer; + unsigned int no_timer:1; + unsigned int need_sync:1; diff --git a/target/linux/generic/patches-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch b/target/linux/generic/patches-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch new file mode 100644 index 0000000000..9313cd557e --- /dev/null +++ b/target/linux/generic/patches-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch @@ -0,0 +1,66 @@ +From 1b7fc2c0069f3864a3dda15430b7aded31c0bfcc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 20 Sep 2016 10:36:15 +0200 +Subject: [PATCH] ubifs: Use dirty_writeback_interval value for wbuf timer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Right now wbuf timer has hardcoded timeouts and there is no place for +manual adjustments. Some projects / cases many need that though. Few +file systems allow doing that by respecting dirty_writeback_interval +that can be set using sysctl (dirty_writeback_centisecs). + +Lowering dirty_writeback_interval could be some way of dealing with user +space apps lacking proper fsyncs. This is definitely *not* a perfect +solution but we don't have ideal (user space) world. There were already +advanced discussions on this matter, mostly when ext4 was introduced and +it wasn't behaving as ext3. Anyway, the final decision was to add some +hacks to the ext4, as trying to fix whole user space or adding new API +was pointless. + +We can't (and shouldn't?) just follow ext4. We can't e.g. sync on close +as this would cause too many commits and flash wearing. On the other +hand we still should allow some trade-off between -o sync and default +wbuf timeout. Respecting dirty_writeback_interval should allow some sane +cutomizations if used warily. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Boris Brezillon +Signed-off-by: Richard Weinberger +--- + fs/ubifs/io.c | 8 ++++---- + fs/ubifs/ubifs.h | 4 ---- + 2 files changed, 4 insertions(+), 8 deletions(-) + +--- a/fs/ubifs/io.c ++++ b/fs/ubifs/io.c +@@ -452,11 +452,11 @@ static enum hrtimer_restart wbuf_timer_c + */ + static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) + { +- ktime_t softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); +- unsigned long long delta; ++ ktime_t softlimit = ms_to_ktime(dirty_writeback_interval * 10); ++ unsigned long long delta = dirty_writeback_interval; + +- delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; +- delta *= 1000000000ULL; ++ /* centi to milli, milli to nano, then 10% */ ++ delta *= 10ULL * NSEC_PER_MSEC / 10ULL; + + ubifs_assert(!hrtimer_active(&wbuf->timer)); + ubifs_assert(delta <= ULONG_MAX); +--- a/fs/ubifs/ubifs.h ++++ b/fs/ubifs/ubifs.h +@@ -106,10 +106,6 @@ + */ + #define BGT_NAME_PATTERN "ubifs_bgt%d_%d" + +-/* Write-buffer synchronization timeout interval in seconds */ +-#define WBUF_TIMEOUT_SOFTLIMIT 3 +-#define WBUF_TIMEOUT_HARDLIMIT 5 +- + /* Maximum possible inode number (only 32-bit inodes are supported now) */ + #define MAX_INUM 0xFFFFFFFF + diff --git a/target/linux/generic/patches-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch b/target/linux/generic/patches-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch new file mode 100644 index 0000000000..733d9c77b3 --- /dev/null +++ b/target/linux/generic/patches-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch @@ -0,0 +1,38 @@ +From: Paul Burton +Date: Mon, 5 Sep 2016 15:24:54 +0100 +Subject: [PATCH] MIPS: c-r4k: Fix size calc when avoiding IPIs for small + icache flushes + +Commit f70ddc07b637 ("MIPS: c-r4k: Avoid small flush_icache_range SMP +calls") adds checks to force use of hit-type cache ops for small icache +flushes where they are globalised & index-type cache ops aren't, in +order to avoid the overhead of IPIs in those cases. However it +calculated the size of the region being flushed incorrectly, subtracting +the end address from the start address rather than the reverse. This +would have led to an overflow with size wrapping round to some large +value, and likely to the special case for avoiding IPIs not actually +being hit. + +Signed-off-by: Paul Burton +Cc: James Hogan +Fixes: f70ddc07b637 ("MIPS: c-r4k: Avoid small flush_icache_range SMP calls") +Reviewed-by: James Hogan +Reviewed-by: Florian Fainelli +Cc: Huacai Chen +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/14211/ +Signed-off-by: Ralf Baechle +--- + +--- a/arch/mips/mm/c-r4k.c ++++ b/arch/mips/mm/c-r4k.c +@@ -781,7 +781,7 @@ static void r4k_flush_icache_range(unsig + * If address-based cache ops are globalized, then we may be + * able to avoid the IPI for small flushes. + */ +- size = start - end; ++ size = end - start; + cache_size = icache_size; + if (!cpu_has_ic_fills_f_dc) { + size *= 2; diff --git a/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch b/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch new file mode 100644 index 0000000000..3a27feac8f --- /dev/null +++ b/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch @@ -0,0 +1,24 @@ +From cd4b1e34655d46950c065d9284b596cd8d7b28cd Mon Sep 17 00:00:00 2001 +From: John Youn +Date: Thu, 3 Nov 2016 17:55:45 -0700 +Subject: [PATCH] usb: dwc2: Remove unnecessary kfree + +This shouldn't be freed by the HCD as it is owned by the core and +allocated with devm_kzalloc. + +Signed-off-by: John Youn +Signed-off-by: Felipe Balbi +--- + drivers/usb/dwc2/hcd.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -3160,7 +3160,6 @@ error3: + error2: + usb_put_hcd(hcd); + error1: +- kfree(hsotg->core_params); + + #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS + kfree(hsotg->last_frame_num_array); diff --git a/target/linux/generic/patches-4.4/105-add-linux-spidev-compatible.patch b/target/linux/generic/patches-4.4/105-add-linux-spidev-compatible.patch new file mode 100644 index 0000000000..cae20a532a --- /dev/null +++ b/target/linux/generic/patches-4.4/105-add-linux-spidev-compatible.patch @@ -0,0 +1,15 @@ +Add the linux,spidev compatible in spidev +Several device in ramips have this binding in the dts + +Signed-off-by: Giuseppe Lippolis +--- +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -695,6 +695,7 @@ static struct class *spidev_class; + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, + { .compatible = "lineartechnology,ltc2488" }, ++ { .compatible = "siliconlabs,si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/patches-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch b/target/linux/generic/patches-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch new file mode 100644 index 0000000000..57c9475359 --- /dev/null +++ b/target/linux/generic/patches-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch @@ -0,0 +1,21 @@ +From: Felix Fietkau +Date: Fri, 30 Dec 2016 14:53:45 +0100 +Subject: [PATCH] spi: use gpio_set_value_cansleep for setting chipselect GPIO + +Sleeping is safe inside spi_transfer_one_message, and some GPIO chips +need to sleep for setting values + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -674,7 +674,7 @@ static void spi_set_cs(struct spi_device + enable = !enable; + + if (gpio_is_valid(spi->cs_gpio)) +- gpio_set_value(spi->cs_gpio, !enable); ++ gpio_set_value_cansleep(spi->cs_gpio, !enable); + else if (spi->master->set_cs) + spi->master->set_cs(spi, !enable); + } diff --git a/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch b/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch new file mode 100644 index 0000000000..a204fe6625 --- /dev/null +++ b/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch @@ -0,0 +1,177 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Subject: [PATCH 1/2] mtd: bcm47xxpart: move TRX parsing code to separated + function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change simplifies main parsing loop logic a bit. In future it may +be useful for moving TRX support to separated module / parser (if we +implement support for them at some point). +Finally parsing TRX at the end puts us in a better position as we have +better flash layout knowledge. It may be useful e.g. if it appears there +is more than 1 TRX partition. + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/bcm47xxpart.c | 121 ++++++++++++++++++++++++++++------------------ + 1 file changed, 74 insertions(+), 47 deletions(-) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -83,6 +83,67 @@ out_default: + return "rootfs"; + } + ++static int bcm47xxpart_parse_trx(struct mtd_info *master, ++ struct mtd_partition *trx, ++ struct mtd_partition *parts, ++ size_t parts_len) ++{ ++ struct trx_header header; ++ size_t bytes_read; ++ int curr_part = 0; ++ int i, err; ++ ++ if (parts_len < 3) { ++ pr_warn("No enough space to add TRX partitions!\n"); ++ return -ENOMEM; ++ } ++ ++ err = mtd_read(master, trx->offset, sizeof(header), &bytes_read, ++ (uint8_t *)&header); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("mtd_read error while reading TRX header: %d\n", err); ++ return err; ++ } ++ ++ i = 0; ++ ++ /* We have LZMA loader if offset[2] points to sth */ ++ if (header.offset[2]) { ++ bcm47xxpart_add_part(&parts[curr_part++], "loader", ++ trx->offset + header.offset[i], 0); ++ i++; ++ } ++ ++ if (header.offset[i]) { ++ bcm47xxpart_add_part(&parts[curr_part++], "linux", ++ trx->offset + header.offset[i], 0); ++ i++; ++ } ++ ++ if (header.offset[i]) { ++ size_t offset = trx->offset + header.offset[i]; ++ const char *name = bcm47xxpart_trx_data_part_name(master, ++ offset); ++ ++ bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0); ++ i++; ++ } ++ ++ /* ++ * Assume that every partition ends at the beginning of the one it is ++ * followed by. ++ */ ++ for (i = 0; i < curr_part; i++) { ++ u64 next_part_offset = (i < curr_part - 1) ? ++ parts[i + 1].offset : ++ trx->offset + trx->size; ++ ++ parts[i].size = next_part_offset - parts[i].offset; ++ } ++ ++ return curr_part; ++} ++ + static int bcm47xxpart_parse(struct mtd_info *master, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +@@ -93,9 +154,7 @@ static int bcm47xxpart_parse(struct mtd_ + size_t bytes_read; + uint32_t offset; + uint32_t blocksize = master->erasesize; +- struct trx_header *trx; + int trx_part = -1; +- int last_trx_part = -1; + int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; + int err; + +@@ -182,54 +241,14 @@ static int bcm47xxpart_parse(struct mtd_ + + /* TRX */ + if (buf[0x000 / 4] == TRX_MAGIC) { +- if (BCM47XXPART_MAX_PARTS - curr_part < 4) { +- pr_warn("Not enough partitions left to register trx, scanning stopped!\n"); +- break; +- } +- +- trx = (struct trx_header *)buf; ++ struct trx_header *trx; + + trx_part = curr_part; + bcm47xxpart_add_part(&parts[curr_part++], "firmware", + offset, 0); + +- i = 0; +- /* We have LZMA loader if offset[2] points to sth */ +- if (trx->offset[2]) { +- bcm47xxpart_add_part(&parts[curr_part++], +- "loader", +- 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. +- */ +- if (trx->offset[i]) { +- const char *name; +- +- name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); +- bcm47xxpart_add_part(&parts[curr_part++], +- name, +- offset + trx->offset[i], +- 0); +- i++; +- } +- +- last_trx_part = curr_part - 1; +- + /* Jump to the end of TRX */ ++ trx = (struct trx_header *)buf; + offset = roundup(offset + trx->length, blocksize); + /* Next loop iteration will increase the offset */ + offset -= blocksize; +@@ -307,9 +326,17 @@ static int bcm47xxpart_parse(struct mtd_ + parts[i + 1].offset : master->size; + + parts[i].size = next_part_offset - parts[i].offset; +- if (i == last_trx_part && trx_part >= 0) +- parts[trx_part].size = next_part_offset - +- parts[trx_part].offset; ++ } ++ ++ /* If there was TRX parse it now */ ++ if (trx_part >= 0) { ++ int num_parts; ++ ++ num_parts = bcm47xxpart_parse_trx(master, &parts[trx_part], ++ parts + curr_part, ++ BCM47XXPART_MAX_PARTS - curr_part); ++ if (num_parts > 0) ++ curr_part += num_parts; + } + + *pparts = parts; diff --git a/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch b/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch new file mode 100644 index 0000000000..2d97be7508 --- /dev/null +++ b/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch @@ -0,0 +1,108 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Subject: [PATCH 2/2] mtd: bcm47xxpart: support layouts with multiple TRX + partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some devices may have an extra TRX partition used as failsafe one. If +we detect such partition we should set a proper name for it and don't +parse it. + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/bcm47xxpart.c | 56 ++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 46 insertions(+), 10 deletions(-) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -9,6 +9,7 @@ + * + */ + ++#include + #include + #include + #include +@@ -144,6 +145,30 @@ static int bcm47xxpart_parse_trx(struct + return curr_part; + } + ++/** ++ * bcm47xxpart_bootpartition - gets index of TRX partition used by bootloader ++ * ++ * Some devices may have more than one TRX partition. In such case one of them ++ * is the main one and another a failsafe one. Bootloader may fallback to the ++ * failsafe firmware if it detects corruption of the main image. ++ * ++ * This function provides info about currently used TRX partition. It's the one ++ * containing kernel started by the bootloader. ++ */ ++static int bcm47xxpart_bootpartition(void) ++{ ++ char buf[4]; ++ int bootpartition; ++ ++ /* Check CFE environment variable */ ++ if (bcm47xx_nvram_getenv("bootpartition", buf, sizeof(buf)) > 0) { ++ if (!kstrtoint(buf, 0, &bootpartition)) ++ return bootpartition; ++ } ++ ++ return 0; ++} ++ + static int bcm47xxpart_parse(struct mtd_info *master, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +@@ -154,7 +179,8 @@ static int bcm47xxpart_parse(struct mtd_ + size_t bytes_read; + uint32_t offset; + uint32_t blocksize = master->erasesize; +- int trx_part = -1; ++ int trx_parts[2]; /* Array with indexes of TRX partitions */ ++ int trx_num = 0; /* Number of found TRX partitions */ + int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; + int err; + +@@ -243,7 +269,11 @@ static int bcm47xxpart_parse(struct mtd_ + if (buf[0x000 / 4] == TRX_MAGIC) { + struct trx_header *trx; + +- trx_part = curr_part; ++ if (trx_num >= ARRAY_SIZE(trx_parts)) ++ pr_warn("No enough space to store another TRX found at 0x%X\n", ++ offset); ++ else ++ trx_parts[trx_num++] = curr_part; + bcm47xxpart_add_part(&parts[curr_part++], "firmware", + offset, 0); + +@@ -329,14 +359,20 @@ static int bcm47xxpart_parse(struct mtd_ + } + + /* If there was TRX parse it now */ +- if (trx_part >= 0) { +- int num_parts; ++ for (i = 0; i < trx_num; i++) { ++ struct mtd_partition *trx = &parts[trx_parts[i]]; + +- num_parts = bcm47xxpart_parse_trx(master, &parts[trx_part], +- parts + curr_part, +- BCM47XXPART_MAX_PARTS - curr_part); +- if (num_parts > 0) +- curr_part += num_parts; ++ if (i == bcm47xxpart_bootpartition()) { ++ int num_parts; ++ ++ num_parts = bcm47xxpart_parse_trx(master, trx, ++ parts + curr_part, ++ BCM47XXPART_MAX_PARTS - curr_part); ++ if (num_parts > 0) ++ curr_part += num_parts; ++ } else { ++ trx->name = "failsafe"; ++ } + } + + *pparts = parts; diff --git a/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch b/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch index 65f1b708a1..d6e577be8c 100644 --- a/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch +++ b/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch @@ -10,7 +10,7 @@ Signed-off-by: L. D. Pinney --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -688,6 +688,8 @@ static const struct flash_info spi_nor_i +@@ -689,6 +689,8 @@ static const struct flash_info spi_nor_i /* ESMT */ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, diff --git a/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch index 5ad82f1f51..379e551b7f 100644 --- a/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ b/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -61,6 +61,34 @@ static void bcm47xxpart_add_part(struct +@@ -62,6 +62,34 @@ static void bcm47xxpart_add_part(struct part->mask_flags = mask_flags; } @@ -48,53 +48,44 @@ Signed-off-by: Rafał Miłecki 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_ +@@ -91,6 +119,7 @@ static int bcm47xxpart_parse_trx(struct + { + struct trx_header header; + size_t bytes_read; ++ size_t offset; + int curr_part = 0; + int i, err; - /* 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++; - } +@@ -110,21 +139,25 @@ static int bcm47xxpart_parse_trx(struct - 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++; - } + /* We have LZMA loader if offset[2] points to sth */ + if (header.offset[2]) { +- bcm47xxpart_add_part(&parts[curr_part++], "loader", +- trx->offset + header.offset[i], 0); ++ offset = bcm47xxpart_real_offset(master, trx->offset, ++ header.offset[i]); ++ bcm47xxpart_add_part(&parts[curr_part++], "loader", offset, 0); + i++; + } -@@ -219,11 +249,11 @@ static int bcm47xxpart_parse(struct mtd_ - if (trx->offset[i]) { - const char *name; + if (header.offset[i]) { +- bcm47xxpart_add_part(&parts[curr_part++], "linux", +- trx->offset + header.offset[i], 0); ++ offset = bcm47xxpart_real_offset(master, trx->offset, ++ header.offset[i]); ++ bcm47xxpart_add_part(&parts[curr_part++], "linux", offset, 0); + i++; + } -- 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++; - } + if (header.offset[i]) { +- size_t offset = trx->offset + header.offset[i]; +- const char *name = bcm47xxpart_trx_data_part_name(master, +- offset); ++ const char *name; ++ ++ offset = bcm47xxpart_real_offset(master, trx->offset, ++ header.offset[i]); ++ name = bcm47xxpart_trx_data_part_name(master, offset); + bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0); + i++; diff --git a/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch index 9e5ca91e55..a19e943efe 100644 --- a/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ b/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch @@ -16,7 +16,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -38,6 +38,7 @@ +@@ -39,6 +39,7 @@ #define NVRAM_HEADER 0x48534C46 /* FLSH */ #define POT_MAGIC1 0x54544f50 /* POTT */ #define POT_MAGIC2 0x504f /* OP */ @@ -24,7 +24,7 @@ Signed-off-by: Rafał Miłecki #define ML_MAGIC1 0x39685a42 #define ML_MAGIC2 0x26594131 #define TRX_MAGIC 0x30524448 -@@ -207,6 +208,15 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -297,6 +298,15 @@ static int bcm47xxpart_parse(struct mtd_ MTD_WRITEABLE); continue; } diff --git a/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch index 070f4c6023..89bafa8387 100644 --- a/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch +++ b/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch @@ -4,11 +4,11 @@ Signed-off-by: Felix Fietkau --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1158,6 +1158,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1159,6 +1159,7 @@ int spi_nor_scan(struct spi_nor *nor, co if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || JEDEC_MFR(info) == SNOR_MFR_INTEL || + JEDEC_MFR(info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(info) == SNOR_MFR_SST) { + JEDEC_MFR(info) == SNOR_MFR_SST || + info->flags & SPI_NOR_HAS_LOCK) { write_enable(nor); - write_sr(nor, 0); diff --git a/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch b/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch index 3db4a41968..d868a7da25 100644 --- a/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch +++ b/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -724,6 +724,7 @@ static const struct flash_info spi_nor_i +@@ -725,6 +725,7 @@ static const struct flash_info spi_nor_i { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, diff --git a/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch index 38f3255b14..ab805b71d0 100644 --- a/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch +++ b/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -682,6 +682,7 @@ static const struct flash_info spi_nor_i +@@ -683,6 +683,7 @@ static const struct flash_info spi_nor_i { "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) }, diff --git a/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch b/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch index eb99b28a55..fa1ab3fa06 100644 --- a/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch +++ b/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -721,6 +721,7 @@ static const struct flash_info spi_nor_i +@@ -722,6 +722,7 @@ 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) }, diff --git a/target/linux/generic/patches-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch b/target/linux/generic/patches-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch new file mode 100644 index 0000000000..ec67056c65 --- /dev/null +++ b/target/linux/generic/patches-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch @@ -0,0 +1,22 @@ +mtd: spi-nor: Add lock/unlock support for f25l32pa + +This chip has write protection enabled on power-up, +so this flag is necessary to support write operations. + +Signed-off-by: Victor Shyba +Acked-by: Marek Vasut +--- + drivers/mtd/spi-nor/spi-nor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -689,7 +689,7 @@ static const struct flash_info spi_nor_i + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, + + /* ESMT */ +- { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, ++ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "f25l32qa", INFO(0x8c4116, 0, 64 * 1024, 64, SECT_4K) }, + { "f25l64qa", INFO(0x8c4117, 0, 64 * 1024, 128, SECT_4K) }, + diff --git a/target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch deleted file mode 100644 index 86017b5660..0000000000 --- a/target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -1544,6 +1544,13 @@ config CRYPTO_LZ4HC - help - This is the LZ4 high compression mode algorithm. - -+config CRYPTO_XZ -+ tristate "XZ compression algorithm" -+ select CRYPTO_ALGAPI -+ select XZ_DEC -+ help -+ This is the XZ algorithm. Only decompression is supported for now. -+ - comment "Random Number Generation" - - config CRYPTO_ANSI_CPRNG ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -107,6 +107,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc. - obj-$(CONFIG_CRYPTO_LZO) += lzo.o - obj-$(CONFIG_CRYPTO_LZ4) += lz4.o - obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o -+obj-$(CONFIG_CRYPTO_XZ) += xz.o - obj-$(CONFIG_CRYPTO_842) += 842.o - obj-$(CONFIG_CRYPTO_RNG2) += rng.o - obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o ---- /dev/null -+++ b/crypto/xz.c -@@ -0,0 +1,117 @@ -+/* -+ * Cryptographic API. -+ * -+ * XZ decompression support. -+ * -+ * Copyright (c) 2012 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 -+ -+struct xz_comp_ctx { -+ struct xz_dec *decomp_state; -+ struct xz_buf decomp_buf; -+}; -+ -+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx) -+{ -+ ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0); -+ if (!ctx->decomp_state) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx) -+{ -+ xz_dec_end(ctx->decomp_state); -+} -+ -+static int crypto_xz_init(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ return crypto_xz_decomp_init(ctx); -+} -+ -+static void crypto_xz_exit(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ crypto_xz_decomp_exit(ctx); -+} -+ -+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ return -EOPNOTSUPP; -+} -+ -+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm); -+ struct xz_buf *xz_buf = &dctx->decomp_buf; -+ int ret; -+ -+ memset(xz_buf, '\0', sizeof(struct xz_buf)); -+ -+ xz_buf->in = (u8 *) src; -+ xz_buf->in_pos = 0; -+ xz_buf->in_size = slen; -+ xz_buf->out = (u8 *) dst; -+ xz_buf->out_pos = 0; -+ xz_buf->out_size = *dlen; -+ -+ ret = xz_dec_run(dctx->decomp_state, xz_buf); -+ if (ret != XZ_STREAM_END) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ *dlen = xz_buf->out_pos; -+ ret = 0; -+ -+out: -+ return ret; -+} -+ -+static struct crypto_alg crypto_xz_alg = { -+ .cra_name = "xz", -+ .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, -+ .cra_ctxsize = sizeof(struct xz_comp_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_list = LIST_HEAD_INIT(crypto_xz_alg.cra_list), -+ .cra_init = crypto_xz_init, -+ .cra_exit = crypto_xz_exit, -+ .cra_u = { .compress = { -+ .coa_compress = crypto_xz_compress, -+ .coa_decompress = crypto_xz_decompress } } -+}; -+ -+static int __init crypto_xz_mod_init(void) -+{ -+ return crypto_register_alg(&crypto_xz_alg); -+} -+ -+static void __exit crypto_xz_mod_exit(void) -+{ -+ crypto_unregister_alg(&crypto_xz_alg); -+} -+ -+module_init(crypto_xz_mod_init); -+module_exit(crypto_xz_mod_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Crypto XZ decompression support"); -+MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch deleted file mode 100644 index 277d91507b..0000000000 --- a/target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- a/fs/ubifs/Kconfig -+++ b/fs/ubifs/Kconfig -@@ -5,8 +5,10 @@ config UBIFS_FS - select CRYPTO if UBIFS_FS_ADVANCED_COMPR - select CRYPTO if UBIFS_FS_LZO - select CRYPTO if UBIFS_FS_ZLIB -+ select CRYPTO if UBIFS_FS_XZ - select CRYPTO_LZO if UBIFS_FS_LZO - select CRYPTO_DEFLATE if UBIFS_FS_ZLIB -+ select CRYPTO_XZ if UBIFS_FS_XZ - depends on MTD_UBI - help - UBIFS is a file system for flash devices which works on top of UBI. -@@ -36,6 +38,14 @@ config UBIFS_FS_ZLIB - help - Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. - -+config UBIFS_FS_XZ -+ bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR -+ depends on UBIFS_FS -+ default y -+ help -+ XZ compresses better the ZLIB but it is slower.. -+ Say 'Y' if unsure. -+ - config UBIFS_ATIME_SUPPORT - bool "Access time support" if UBIFS_FS - depends on UBIFS_FS ---- a/fs/ubifs/compress.c -+++ b/fs/ubifs/compress.c -@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp - }; - #endif - -+#ifdef CONFIG_UBIFS_FS_XZ -+static DEFINE_MUTEX(xz_enc_mutex); -+static DEFINE_MUTEX(xz_dec_mutex); -+ -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .comp_mutex = &xz_enc_mutex, -+ .decomp_mutex = &xz_dec_mutex, -+ .name = "xz", -+ .capi_name = "xz", -+}; -+#else -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .name = "xz", -+}; -+#endif -+ - /* All UBIFS compressors */ - struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; - -@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void) - if (err) - goto out_lzo; - -+ err = compr_init(&xz_compr); -+ if (err) -+ goto out_zlib; -+ - ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr; - return 0; - -+out_zlib: -+ compr_exit(&zlib_compr); - out_lzo: - compr_exit(&lzo_compr); - return err; -@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void) - { - compr_exit(&lzo_compr); - compr_exit(&zlib_compr); -+ compr_exit(&xz_compr); - } ---- a/fs/ubifs/ubifs-media.h -+++ b/fs/ubifs/ubifs-media.h -@@ -332,12 +332,14 @@ enum { - * UBIFS_COMPR_NONE: no compression - * UBIFS_COMPR_LZO: LZO compression - * UBIFS_COMPR_ZLIB: ZLIB compression -+ * UBIFS_COMPR_XZ: XZ compression - * UBIFS_COMPR_TYPES_CNT: count of supported compression types - */ - enum { - UBIFS_COMPR_NONE, - UBIFS_COMPR_LZO, - UBIFS_COMPR_ZLIB, -+ UBIFS_COMPR_XZ, - UBIFS_COMPR_TYPES_CNT, - }; - diff --git a/target/linux/generic/patches-4.4/615-netfilter_add_xt_id_match.patch b/target/linux/generic/patches-4.4/615-netfilter_add_xt_id_match.patch deleted file mode 100644 index b403c79a07..0000000000 --- a/target/linux/generic/patches-4.4/615-netfilter_add_xt_id_match.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/include/uapi/linux/netfilter/Kbuild -+++ b/include/uapi/linux/netfilter/Kbuild -@@ -55,6 +55,7 @@ header-y += xt_ecn.h - header-y += xt_esp.h - header-y += xt_hashlimit.h - header-y += xt_helper.h -+header-y += xt_id.h - header-y += xt_ipcomp.h - header-y += xt_iprange.h - header-y += xt_ipvs.h ---- /dev/null -+++ b/include/uapi/linux/netfilter/xt_id.h -@@ -0,0 +1,8 @@ -+#ifndef _XT_ID_H -+#define _XT_ID_H -+ -+struct xt_id_info { -+ u32 id; -+}; -+ -+#endif /* XT_ID_H */ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -1180,6 +1180,13 @@ config NETFILTER_XT_MATCH_IPCOMP - - To compile it as a module, choose M here. If unsure, say N. - -+config NETFILTER_XT_MATCH_ID -+ tristate '"id" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option adds a `id' dummy-match, which allows you to put -+ numeric IDs into your iptables ruleset. -+ - config NETFILTER_XT_MATCH_IPRANGE - tristate '"iprange" address range match support' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -144,6 +144,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += - obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o - obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o - obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o -+obj-$(CONFIG_NETFILTER_XT_MATCH_ID) += xt_id.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPCOMP) += xt_ipcomp.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o - obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o ---- /dev/null -+++ b/net/netfilter/xt_id.c -@@ -0,0 +1,45 @@ -+/* -+ * Implements a dummy match to allow attaching IDs to rules -+ * -+ * 2014-08-01 Jo-Philipp Wich -+ */ -+ -+#include -+#include -+#include -+#include -+ -+MODULE_AUTHOR("Jo-Philipp Wich "); -+MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a 32bit ID"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("ipt_id"); -+MODULE_ALIAS("ip6t_id"); -+ -+static bool -+id_mt(const struct sk_buff *skb, struct xt_action_param *par) -+{ -+ /* We always match */ -+ return true; -+} -+ -+static struct xt_match id_mt_reg __read_mostly = { -+ .name = "id", -+ .revision = 0, -+ .family = NFPROTO_UNSPEC, -+ .match = id_mt, -+ .matchsize = sizeof(struct xt_id_info), -+ .me = THIS_MODULE, -+}; -+ -+static int __init id_mt_init(void) -+{ -+ return xt_register_match(&id_mt_reg); -+} -+ -+static void __exit id_mt_exit(void) -+{ -+ xt_unregister_match(&id_mt_reg); -+} -+ -+module_init(id_mt_init); -+module_exit(id_mt_exit); diff --git a/target/linux/generic/patches-4.4/630-packet_socket_type.patch b/target/linux/generic/patches-4.4/630-packet_socket_type.patch index b14afdde69..eb79b2dd37 100644 --- a/target/linux/generic/patches-4.4/630-packet_socket_type.patch +++ b/target/linux/generic/patches-4.4/630-packet_socket_type.patch @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3707,6 +3710,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3713,6 +3716,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -108,7 +108,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3759,6 +3772,13 @@ static int packet_getsockopt(struct sock +@@ -3765,6 +3778,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch b/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch index 2f64696c5d..073550c29f 100644 --- a/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch +++ b/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch @@ -1,6 +1,6 @@ --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c -@@ -1795,27 +1795,7 @@ void netlink_detachskb(struct sock *sk, +@@ -1812,27 +1812,7 @@ void netlink_detachskb(struct sock *sk, static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation) { diff --git a/target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch index c4e1904183..c86f4c7169 100644 --- a/target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ b/target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch @@ -296,7 +296,7 @@ Signed-off-by: Steven Barth __skb_tunnel_rx(skb, t->dev, t->net); -@@ -1226,6 +1363,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str +@@ -1235,6 +1372,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str __u32 mtu; u8 tproto; int err; @@ -304,7 +304,7 @@ Signed-off-by: Steven Barth tproto = ACCESS_ONCE(t->parms.proto); if ((tproto != IPPROTO_IPV6 && tproto != 0) || -@@ -1256,6 +1394,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str +@@ -1265,6 +1403,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) fl6.flowi6_mark = skb->mark; @@ -323,7 +323,7 @@ Signed-off-by: Steven Barth err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); if (err != 0) { if (err == -EMSGSIZE) -@@ -1370,6 +1520,14 @@ ip6_tnl_change(struct ip6_tnl *t, const +@@ -1379,6 +1529,14 @@ ip6_tnl_change(struct ip6_tnl *t, const t->parms.flowinfo = p->flowinfo; t->parms.link = p->link; t->parms.proto = p->proto; @@ -338,7 +338,7 @@ Signed-off-by: Steven Barth ip6_tnl_dst_reset(t); ip6_tnl_link_config(t); return 0; -@@ -1408,6 +1566,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ +@@ -1417,6 +1575,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ p->flowinfo = u->flowinfo; p->link = u->link; p->proto = u->proto; @@ -346,7 +346,7 @@ Signed-off-by: Steven Barth memcpy(p->name, u->name, sizeof(u->name)); } -@@ -1703,6 +1862,15 @@ static int ip6_tnl_validate(struct nlatt +@@ -1712,6 +1871,15 @@ static int ip6_tnl_validate(struct nlatt return 0; } @@ -362,7 +362,7 @@ Signed-off-by: Steven Barth static void ip6_tnl_netlink_parms(struct nlattr *data[], struct __ip6_tnl_parm *parms) { -@@ -1734,6 +1902,46 @@ static void ip6_tnl_netlink_parms(struct +@@ -1743,6 +1911,46 @@ static void ip6_tnl_netlink_parms(struct if (data[IFLA_IPTUN_PROTO]) parms->proto = nla_get_u8(data[IFLA_IPTUN_PROTO]); @@ -409,7 +409,7 @@ Signed-off-by: Steven Barth } static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev, -@@ -1786,6 +1994,12 @@ static void ip6_tnl_dellink(struct net_d +@@ -1795,6 +2003,12 @@ static void ip6_tnl_dellink(struct net_d static size_t ip6_tnl_get_size(const struct net_device *dev) { @@ -422,7 +422,7 @@ Signed-off-by: Steven Barth return /* IFLA_IPTUN_LINK */ nla_total_size(4) + -@@ -1803,6 +2017,24 @@ static size_t ip6_tnl_get_size(const str +@@ -1812,6 +2026,24 @@ static size_t ip6_tnl_get_size(const str nla_total_size(4) + /* IFLA_IPTUN_PROTO */ nla_total_size(1) + @@ -447,7 +447,7 @@ Signed-off-by: Steven Barth 0; } -@@ -1810,6 +2042,9 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -1819,6 +2051,9 @@ static int ip6_tnl_fill_info(struct sk_b { struct ip6_tnl *tunnel = netdev_priv(dev); struct __ip6_tnl_parm *parm = &tunnel->parms; @@ -457,7 +457,7 @@ Signed-off-by: Steven Barth if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) || -@@ -1818,8 +2053,27 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -1827,8 +2062,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) || @@ -486,7 +486,7 @@ Signed-off-by: Steven Barth return 0; nla_put_failure: -@@ -1843,6 +2097,7 @@ static const struct nla_policy ip6_tnl_p +@@ -1852,6 +2106,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 }, diff --git a/target/linux/generic/patches-4.4/785-hso-support-0af0-9300.patch b/target/linux/generic/patches-4.4/785-hso-support-0af0-9300.patch deleted file mode 100644 index 621d08f4f1..0000000000 --- a/target/linux/generic/patches-4.4/785-hso-support-0af0-9300.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -466,6 +466,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/patches-4.4/863-gpiommc.patch b/target/linux/generic/patches-4.4/863-gpiommc.patch deleted file mode 100644 index ea3599ea0d..0000000000 --- a/target/linux/generic/patches-4.4/863-gpiommc.patch +++ /dev/null @@ -1,844 +0,0 @@ ---- /dev/null -+++ b/drivers/mmc/host/gpiommc.c -@@ -0,0 +1,609 @@ -+/* -+ * Driver an MMC/SD card on a bitbanging GPIO SPI bus. -+ * This module hooks up the mmc_spi and spi_gpio modules and also -+ * provides a configfs interface. -+ * -+ * Copyright 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+#define PFX "gpio-mmc: " -+ -+ -+struct gpiommc_device { -+ struct platform_device *pdev; -+ struct platform_device *spi_pdev; -+ struct spi_board_info boardinfo; -+}; -+ -+ -+MODULE_DESCRIPTION("GPIO based MMC driver"); -+MODULE_AUTHOR("Michael Buesch"); -+MODULE_LICENSE("GPL"); -+ -+ -+static int gpiommc_boardinfo_setup(struct spi_board_info *bi, -+ struct spi_master *master, -+ void *data) -+{ -+ struct gpiommc_device *d = data; -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ /* Bind the SPI master to the MMC-SPI host driver. */ -+ strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias)); -+ -+ bi->max_speed_hz = pdata->max_bus_speed; -+ bi->bus_num = master->bus_num; -+ bi->mode = pdata->mode; -+ -+ return 0; -+} -+ -+static int gpiommc_probe(struct platform_device *pdev) -+{ -+ struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data; -+ struct spi_gpio_platform_data spi_pdata; -+ struct gpiommc_device *d; -+ int err; -+ -+ err = -ENXIO; -+ if (!mmc_pdata) -+ goto error; -+ -+#ifdef CONFIG_MMC_SPI_MODULE -+ err = request_module("mmc_spi"); -+ if (err) { -+ printk(KERN_WARNING PFX -+ "Failed to request mmc_spi module.\n"); -+ } -+#endif /* CONFIG_MMC_SPI_MODULE */ -+ -+ /* Allocate the GPIO-MMC device */ -+ err = -ENOMEM; -+ d = kzalloc(sizeof(*d), GFP_KERNEL); -+ if (!d) -+ goto error; -+ d->pdev = pdev; -+ -+ /* Create the SPI-GPIO device */ -+ d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME, -+ spi_gpio_next_id()); -+ if (!d->spi_pdev) -+ goto err_free_d; -+ -+ memset(&spi_pdata, 0, sizeof(spi_pdata)); -+ spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk; -+ spi_pdata.pin_miso = mmc_pdata->pins.gpio_do; -+ spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di; -+ spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs; -+ spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow; -+ spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay; -+ spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup; -+ spi_pdata.boardinfo_setup_data = d; -+ -+ err = platform_device_add_data(d->spi_pdev, &spi_pdata, -+ sizeof(spi_pdata)); -+ if (err) -+ goto err_free_pdev; -+ err = platform_device_add(d->spi_pdev); -+ if (err) -+ goto err_free_pdata; -+ platform_set_drvdata(pdev, d); -+ -+ printk(KERN_INFO PFX "MMC-Card \"%s\" " -+ "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n", -+ mmc_pdata->name, mmc_pdata->pins.gpio_di, -+ mmc_pdata->pins.gpio_do, -+ mmc_pdata->pins.gpio_clk, -+ mmc_pdata->pins.gpio_cs); -+ -+ return 0; -+ -+err_free_pdata: -+ kfree(d->spi_pdev->dev.platform_data); -+ d->spi_pdev->dev.platform_data = NULL; -+err_free_pdev: -+ platform_device_put(d->spi_pdev); -+err_free_d: -+ kfree(d); -+error: -+ return err; -+} -+ -+static int gpiommc_remove(struct platform_device *pdev) -+{ -+ struct gpiommc_device *d = platform_get_drvdata(pdev); -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ platform_device_unregister(d->spi_pdev); -+ printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n", -+ pdata->name); -+ platform_device_put(d->spi_pdev); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ -+/* A device that was created through configfs */ -+struct gpiommc_configfs_device { -+ struct config_item item; -+ /* The platform device, after registration. */ -+ struct platform_device *pdev; -+ /* The configuration */ -+ struct gpiommc_platform_data pdata; -+}; -+ -+#define GPIO_INVALID -1 -+ -+static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev) -+{ -+ return (dev->pdev != NULL); -+} -+ -+static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item) -+{ -+ return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL; -+} -+ -+static struct configfs_attribute gpiommc_attr_DI = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_in", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_DO = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_out", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CLK = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_clock", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS_activelow = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect_activelow", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spimode = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_mode", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spidelay = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_delay", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_max_bus_speed = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "max_bus_speed", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_register = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "register", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute *gpiommc_config_attrs[] = { -+ &gpiommc_attr_DI, -+ &gpiommc_attr_DO, -+ &gpiommc_attr_CLK, -+ &gpiommc_attr_CS, -+ &gpiommc_attr_CS_activelow, -+ &gpiommc_attr_spimode, -+ &gpiommc_attr_spidelay, -+ &gpiommc_attr_max_bus_speed, -+ &gpiommc_attr_register, -+ NULL, -+}; -+ -+static ssize_t gpiommc_config_attr_show(struct config_item *item, -+ struct configfs_attribute *attr, -+ char *page) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ ssize_t count = 0; -+ unsigned int gpio; -+ int err = 0; -+ -+ if (attr == &gpiommc_attr_DI) { -+ gpio = dev->pdata.pins.gpio_di; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ gpio = dev->pdata.pins.gpio_do; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ gpio = dev->pdata.pins.gpio_clk; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ gpio = dev->pdata.pins.gpio_cs; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.pins.cs_activelow); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.mode); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ !dev->pdata.no_spi_delay); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.max_bus_speed); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_register) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ gpiommc_is_registered(dev)); -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static int gpiommc_do_register(struct gpiommc_configfs_device *dev, -+ const char *name) -+{ -+ int err; -+ -+ if (gpiommc_is_registered(dev)) -+ return 0; -+ -+ if (!gpio_is_valid(dev->pdata.pins.gpio_di) || -+ !gpio_is_valid(dev->pdata.pins.gpio_do) || -+ !gpio_is_valid(dev->pdata.pins.gpio_clk) || -+ !gpio_is_valid(dev->pdata.pins.gpio_cs)) { -+ printk(KERN_ERR PFX -+ "configfs: Invalid GPIO pin number(s)\n"); -+ return -EINVAL; -+ } -+ -+ strlcpy(dev->pdata.name, name, -+ sizeof(dev->pdata.name)); -+ -+ dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, -+ gpiommc_next_id()); -+ if (!dev->pdev) -+ return -ENOMEM; -+ err = platform_device_add_data(dev->pdev, &dev->pdata, -+ sizeof(dev->pdata)); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ err = platform_device_add(dev->pdev); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev) -+{ -+ if (!gpiommc_is_registered(dev)) -+ return; -+ -+ platform_device_unregister(dev->pdev); -+ dev->pdev = NULL; -+} -+ -+static ssize_t gpiommc_config_attr_store(struct config_item *item, -+ struct configfs_attribute *attr, -+ const char *page, size_t count) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ int err = -EINVAL; -+ unsigned long data; -+ -+ if (attr == &gpiommc_attr_register) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data == 1) -+ err = gpiommc_do_register(dev, item->ci_name); -+ if (data == 0) { -+ gpiommc_do_unregister(dev); -+ err = 0; -+ } -+ goto out; -+ } -+ -+ if (gpiommc_is_registered(dev)) { -+ /* The rest of the config parameters can only be set -+ * as long as the device is not registered, yet. */ -+ err = -EBUSY; -+ goto out; -+ } -+ -+ if (attr == &gpiommc_attr_DI) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_di = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_do = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_clk = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_cs = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.pins.cs_activelow = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ switch (data) { -+ case 0: -+ dev->pdata.mode = SPI_MODE_0; -+ break; -+ case 1: -+ dev->pdata.mode = SPI_MODE_1; -+ break; -+ case 2: -+ dev->pdata.mode = SPI_MODE_2; -+ break; -+ case 3: -+ dev->pdata.mode = SPI_MODE_3; -+ break; -+ default: -+ goto out; -+ } -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.no_spi_delay = !data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ err = kstrtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data > UINT_MAX) -+ goto out; -+ dev->pdata.max_bus_speed = data; -+ err = 0; -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static void gpiommc_config_item_release(struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ kfree(dev); -+} -+ -+static struct configfs_item_operations gpiommc_config_item_ops = { -+ .release = gpiommc_config_item_release, -+ .show_attribute = gpiommc_config_attr_show, -+ .store_attribute = gpiommc_config_attr_store, -+}; -+ -+static struct config_item_type gpiommc_dev_ci_type = { -+ .ct_item_ops = &gpiommc_config_item_ops, -+ .ct_attrs = gpiommc_config_attrs, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct config_item *gpiommc_make_item(struct config_group *group, -+ const char *name) -+{ -+ struct gpiommc_configfs_device *dev; -+ -+ if (strlen(name) > GPIOMMC_MAX_NAMELEN) { -+ printk(KERN_ERR PFX "configfs: device name too long\n"); -+ return NULL; -+ } -+ -+ dev = kzalloc(sizeof(*dev), GFP_KERNEL); -+ if (!dev) -+ return NULL; -+ -+ config_item_init_type_name(&dev->item, name, -+ &gpiommc_dev_ci_type); -+ -+ /* Assign default configuration */ -+ dev->pdata.pins.gpio_di = GPIO_INVALID; -+ dev->pdata.pins.gpio_do = GPIO_INVALID; -+ dev->pdata.pins.gpio_clk = GPIO_INVALID; -+ dev->pdata.pins.gpio_cs = GPIO_INVALID; -+ dev->pdata.pins.cs_activelow = 1; -+ dev->pdata.mode = SPI_MODE_0; -+ dev->pdata.no_spi_delay = 0; -+ dev->pdata.max_bus_speed = 5000000; /* 5 MHz */ -+ -+ return &(dev->item); -+} -+ -+static void gpiommc_drop_item(struct config_group *group, -+ struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ gpiommc_do_unregister(dev); -+ kfree(dev); -+} -+ -+static struct configfs_group_operations gpiommc_ct_group_ops = { -+ .make_item = gpiommc_make_item, -+ .drop_item = gpiommc_drop_item, -+}; -+ -+static struct config_item_type gpiommc_ci_type = { -+ .ct_group_ops = &gpiommc_ct_group_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct configfs_subsystem gpiommc_subsys = { -+ .su_group = { -+ .cg_item = { -+ .ci_namebuf = GPIOMMC_PLATDEV_NAME, -+ .ci_type = &gpiommc_ci_type, -+ }, -+ }, -+ .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex), -+}; -+ -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+static struct platform_driver gpiommc_plat_driver = { -+ .probe = gpiommc_probe, -+ .remove = gpiommc_remove, -+ .driver = { -+ .name = GPIOMMC_PLATDEV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+int gpiommc_next_id(void) -+{ -+ static atomic_t counter = ATOMIC_INIT(-1); -+ -+ return atomic_inc_return(&counter); -+} -+EXPORT_SYMBOL(gpiommc_next_id); -+ -+static int __init gpiommc_modinit(void) -+{ -+ int err; -+ -+ err = platform_driver_register(&gpiommc_plat_driver); -+ if (err) -+ return err; -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ config_group_init(&gpiommc_subsys.su_group); -+ err = configfs_register_subsystem(&gpiommc_subsys); -+ if (err) { -+ platform_driver_unregister(&gpiommc_plat_driver); -+ return err; -+ } -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+ return 0; -+} -+module_init(gpiommc_modinit); -+ -+static void __exit gpiommc_modexit(void) -+{ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ configfs_unregister_subsystem(&gpiommc_subsys); -+#endif -+ platform_driver_unregister(&gpiommc_plat_driver); -+} -+module_exit(gpiommc_modexit); ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -567,6 +567,31 @@ config MMC_SDHI - This provides support for the SDHI SD/SDIO controller found in - SuperH and ARM SH-Mobile SoCs - -+config GPIOMMC -+ tristate "MMC/SD over GPIO-based SPI" -+ depends on MMC && MMC_SPI && SPI_GPIO_OLD -+ help -+ This driver hooks up the mmc_spi and spi_gpio modules so that -+ MMC/SD cards can be used on a GPIO based bus by bitbanging -+ the SPI protocol in software. -+ -+ This driver provides a configfs interface to dynamically create -+ and destroy GPIO-based MMC/SD card devices. It also provides -+ a platform device interface API. -+ See Documentation/gpiommc.txt for details. -+ -+ The module will be called gpiommc. -+ -+ If unsure, say N. -+ -+config GPIOMMC_CONFIGFS -+ bool -+ depends on GPIOMMC && CONFIGFS_FS -+ default y -+ help -+ This option automatically enables configfs support for gpiommc -+ if configfs is available. -+ - config MMC_CB710 - tristate "ENE CB710 MMC/SD Interface support" - depends on PCI ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -41,6 +41,7 @@ tmio_mmc_core-$(subst m,y,$(CONFIG_MMC_S - obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o - obj-$(CONFIG_MMC_CB710) += cb710-mmc.o - obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o -+obj-$(CONFIG_GPIOMMC) += gpiommc.o - obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o - obj-$(CONFIG_MMC_DW) += dw_mmc.o - obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o ---- /dev/null -+++ b/include/linux/mmc/gpiommc.h -@@ -0,0 +1,71 @@ -+/* -+ * Device driver for MMC/SD cards driven over a GPIO bus. -+ * -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL version 2. -+ */ -+#ifndef LINUX_GPIOMMC_H_ -+#define LINUX_GPIOMMC_H_ -+ -+#include -+ -+ -+#define GPIOMMC_MAX_NAMELEN 15 -+#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN) -+ -+/** -+ * struct gpiommc_pins - Hardware pin assignments -+ * -+ * @gpio_di: The GPIO number of the DATA IN pin -+ * @gpio_do: The GPIO number of the DATA OUT pin -+ * @gpio_clk: The GPIO number of the CLOCK pin -+ * @gpio_cs: The GPIO number of the CHIPSELECT pin -+ * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low. -+ */ -+struct gpiommc_pins { -+ unsigned int gpio_di; -+ unsigned int gpio_do; -+ unsigned int gpio_clk; -+ unsigned int gpio_cs; -+ bool cs_activelow; -+}; -+ -+/** -+ * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device. -+ * -+ * @name: The unique name string of the device. -+ * @pins: The hardware pin assignments. -+ * @mode: The hardware mode. This is either SPI_MODE_0, -+ * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation. -+ * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code. -+ * This is not standards compliant, but may be required for some -+ * embedded machines to gain reasonable speed. -+ * @max_bus_speed: The maximum speed of the SPI bus, in Hertz. -+ */ -+struct gpiommc_platform_data { -+ char name[GPIOMMC_MAX_NAMELEN + 1]; -+ struct gpiommc_pins pins; -+ u8 mode; -+ bool no_spi_delay; -+ unsigned int max_bus_speed; -+}; -+ -+/** -+ * GPIOMMC_PLATDEV_NAME - The platform device name string. -+ * -+ * The name string that has to be used for platform_device_alloc -+ * when allocating a gpiommc device. -+ */ -+#define GPIOMMC_PLATDEV_NAME "gpiommc" -+ -+/** -+ * gpiommc_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 gpiommc_next_id(void); -+ -+#endif /* LINUX_GPIOMMC_H_ */ ---- /dev/null -+++ b/Documentation/gpiommc.txt -@@ -0,0 +1,97 @@ -+GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus -+================================================================ -+ -+The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an -+MMC or SD card on GPIO pins. -+ -+Two interfaces for registering a new MMC/SD card device are provided: -+A static platform-device based mechanism and a dynamic configfs based interface. -+ -+ -+Registering devices via platform-device -+======================================= -+ -+The platform-device interface is used for registering MMC/SD devices that are -+part of the hardware platform. This is most useful only for embedded machines -+with MMC/SD devices statically connected to the platform GPIO bus. -+ -+The data structures are declared in . -+ -+To register a new device, define an instance of struct gpiommc_platform_data. -+This structure holds any information about how the device is hooked up to the -+GPIO pins and what hardware modes the device supports. See the docbook-style -+documentation in the header file for more information on the struct fields. -+ -+Then allocate a new instance of a platform device by doing: -+ -+ pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id()); -+ -+This will allocate the platform device data structures and hook it up to the -+gpiommc driver. -+Then add the gpiommc_platform_data to the platform device. -+ -+ err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data)); -+ -+You may free the local instance of struct gpiommc_platform_data now. (So the -+struct may be allocated on the stack, too). -+Now simply register the platform device. -+ -+ err = platform_device_add(pdev); -+ -+Done. The gpiommc probe routine will be invoked now and you should see a kernel -+log message for the added device. -+ -+ -+Registering devices via configfs -+================================ -+ -+MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example -+selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded -+hardware are a common situation. -+So we provide a dynamic interface to conveniently handle adding and removing -+devices from userspace, without the need to recompile the kernel. -+ -+The "gpiommc" subdirectory at the configfs mountpoint is used for handling -+the dynamic configuration. -+ -+To create a new device, it must first be allocated with mkdir. -+The following command will allocate a device named "my_mmc": -+ mkdir /config/gpiommc/my_mmc -+ -+There are several configuration files available in the new -+/config/gpiommc/my_mmc/ directory: -+ -+gpio_data_in = The SPI data-IN GPIO pin number. -+gpio_data_out = The SPI data-OUT GPIO pin number. -+gpio_clock = The SPI Clock GPIO pin number. -+gpio_chipselect = The SPI Chipselect GPIO pin number. -+gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH. -+ If 1, Chipselect is active-LOW. -+spi_mode = The SPI data mode. Can be 0-3. -+spi_delay = Enable all delays in the lowlevel bitbanging. -+max_bus_speed = The maximum SPI bus speed. In Hertz. -+ -+register = Not a configuration parameter. -+ Used to register the configured card -+ with the kernel. -+ -+The device must first get configured and then registered by writing "1" to -+the "register" file. -+The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock" -+and "gpio_chipselect" are essential and _must_ be configured before writing -+"1" to the "register" file. The registration will fail, otherwise. -+ -+The default values for the other parameters are: -+gpio_chipselect_activelow = 1 (CS active-LOW) -+spi_mode = 0 (SPI_MODE_0) -+spi_delay = 1 (enabled) -+max_bus_speed = 5000000 (5 Mhz) -+ -+Configuration values can not be changed after registration. To unregister -+the device, write a "0" to the "register" file. The configuration can be -+changed again after unregistering. -+ -+To completely remove the device, simply rmdir the directory -+(/config/gpiommc/my_mmc in this example). -+There's no need to first unregister the device before removing it. That will -+be done automatically. ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -4880,6 +4880,11 @@ T: git git://linuxtv.org/anttip/media_tr - S: Maintained - F: drivers/media/usb/hackrf/ - -+GPIOMMC DRIVER -+P: Michael Buesch -+M: mb@bu3sch.de -+S: Maintained -+ - HARDWARE MONITORING - M: Jean Delvare - M: Guenter Roeck diff --git a/target/linux/generic/patches-4.4/864-gpiommc_configfs_locking.patch b/target/linux/generic/patches-4.4/864-gpiommc_configfs_locking.patch deleted file mode 100644 index 92815d91f4..0000000000 --- a/target/linux/generic/patches-4.4/864-gpiommc_configfs_locking.patch +++ /dev/null @@ -1,58 +0,0 @@ -The gpiommc configfs context structure needs locking, as configfs -does not lock access between files. - ---- a/drivers/mmc/host/gpiommc.c -+++ b/drivers/mmc/host/gpiommc.c -@@ -144,6 +144,8 @@ struct gpiommc_configfs_device { - struct platform_device *pdev; - /* The configuration */ - struct gpiommc_platform_data pdata; -+ /* Mutex to protect this structure */ -+ struct mutex mutex; - }; - - #define GPIO_INVALID -1 -@@ -234,6 +236,8 @@ static ssize_t gpiommc_config_attr_show( - unsigned int gpio; - int err = 0; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_DI) { - gpio = dev->pdata.pins.gpio_di; - if (gpio == GPIO_INVALID) -@@ -294,6 +298,8 @@ static ssize_t gpiommc_config_attr_show( - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -353,6 +359,8 @@ static ssize_t gpiommc_config_attr_store - int err = -EINVAL; - unsigned long data; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_register) { - err = kstrtoul(page, 10, &data); - if (err) -@@ -478,6 +486,8 @@ static ssize_t gpiommc_config_attr_store - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -514,6 +524,7 @@ static struct config_item *gpiommc_make_ - if (!dev) - return NULL; - -+ mutex_init(&dev->mutex); - config_item_init_type_name(&dev->item, name, - &gpiommc_dev_ci_type); - diff --git a/target/linux/generic/patches-4.4/870-hifn795x_byteswap.patch b/target/linux/generic/patches-4.4/870-hifn795x_byteswap.patch deleted file mode 100644 index 956b78902e..0000000000 --- a/target/linux/generic/patches-4.4/870-hifn795x_byteswap.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/drivers/crypto/hifn_795x.c -+++ b/drivers/crypto/hifn_795x.c -@@ -680,12 +680,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/patches-4.4/880-gateworks_system_controller.patch b/target/linux/generic/patches-4.4/880-gateworks_system_controller.patch deleted file mode 100644 index a19f30082e..0000000000 --- a/target/linux/generic/patches-4.4/880-gateworks_system_controller.patch +++ /dev/null @@ -1,339 +0,0 @@ ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -527,6 +527,15 @@ config SENSORS_G762 - This driver can also be built as a module. If so, the module - will be called g762. - -+config SENSORS_GSC -+ tristate "Gateworks System Controller" -+ depends on I2C -+ help -+ If you say yes here you get support for the Gateworks System Controller. -+ -+ This driver can also be built as a module. If so, the module -+ will be called gsc. -+ - config SENSORS_GPIO_FAN - tristate "GPIO fan" - depends on GPIOLIB || COMPILE_TEST ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -160,6 +160,7 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l7 - obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o - obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o - obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o -+obj-$(CONFIG_SENSORS_GSC) += gsc.o - - obj-$(CONFIG_PMBUS) += pmbus/ - ---- /dev/null -+++ b/drivers/hwmon/gsc.c -@@ -0,0 +1,308 @@ -+/* -+ * A hwmon driver for the Gateworks System Controller -+ * Copyright (C) 2009 Gateworks Corporation -+ * -+ * Author: Chris Lang -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRV_VERSION "0.2" -+ -+enum chips { gsp }; -+ -+/* AD7418 registers */ -+#define GSP_REG_TEMP_IN 0x00 -+#define GSP_REG_VIN 0x02 -+#define GSP_REG_3P3 0x05 -+#define GSP_REG_BAT 0x08 -+#define GSP_REG_5P0 0x0b -+#define GSP_REG_CORE 0x0e -+#define GSP_REG_CPU1 0x11 -+#define GSP_REG_CPU2 0x14 -+#define GSP_REG_DRAM 0x17 -+#define GSP_REG_EXT_BAT 0x1a -+#define GSP_REG_IO1 0x1d -+#define GSP_REG_IO2 0x20 -+#define GSP_REG_PCIE 0x23 -+#define GSP_REG_CURRENT 0x26 -+#define GSP_FAN_0 0x2C -+#define GSP_FAN_1 0x2E -+#define GSP_FAN_2 0x30 -+#define GSP_FAN_3 0x32 -+#define GSP_FAN_4 0x34 -+#define GSP_FAN_5 0x36 -+ -+struct gsp_sensor_info { -+ const char* name; -+ int reg; -+}; -+ -+static const struct gsp_sensor_info gsp_sensors[] = { -+ {"temp", GSP_REG_TEMP_IN}, -+ {"vin", GSP_REG_VIN}, -+ {"3p3", GSP_REG_3P3}, -+ {"bat", GSP_REG_BAT}, -+ {"5p0", GSP_REG_5P0}, -+ {"core", GSP_REG_CORE}, -+ {"cpu1", GSP_REG_CPU1}, -+ {"cpu2", GSP_REG_CPU2}, -+ {"dram", GSP_REG_DRAM}, -+ {"ext_bat", GSP_REG_EXT_BAT}, -+ {"io1", GSP_REG_IO1}, -+ {"io2", GSP_REG_IO2}, -+ {"pci2", GSP_REG_PCIE}, -+ {"current", GSP_REG_CURRENT}, -+ {"fan_point0", GSP_FAN_0}, -+ {"fan_point1", GSP_FAN_1}, -+ {"fan_point2", GSP_FAN_2}, -+ {"fan_point3", GSP_FAN_3}, -+ {"fan_point4", GSP_FAN_4}, -+ {"fan_point5", GSP_FAN_5}, -+}; -+ -+struct gsp_data { -+ struct device *hwmon_dev; -+ struct attribute_group attrs; -+ enum chips type; -+}; -+ -+static int gsp_probe(struct i2c_client *client, -+ const struct i2c_device_id *id); -+static int gsp_remove(struct i2c_client *client); -+ -+static const struct i2c_device_id gsp_id[] = { -+ { "gsp", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, gsp_id); -+ -+static struct i2c_driver gsp_driver = { -+ .driver = { -+ .name = "gsp", -+ }, -+ .probe = gsp_probe, -+ .remove = gsp_remove, -+ .id_table = gsp_id, -+}; -+ -+/* All registers are word-sized, except for the configuration registers. -+ * AD7418 uses a high-byte first convention. Do NOT use those functions to -+ * access the configuration registers CONF and CONF2, as they are byte-sized. -+ */ -+static inline int gsp_read(struct i2c_client *client, u8 reg) -+{ -+ unsigned int adc = 0; -+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT) -+ { -+ adc |= i2c_smbus_read_byte_data(client, reg); -+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; -+ return adc; -+ } -+ else -+ { -+ adc |= i2c_smbus_read_byte_data(client, reg); -+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8; -+ adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16; -+ return adc; -+ } -+} -+ -+static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value) -+{ -+ i2c_smbus_write_byte_data(client, reg, value & 0xff); -+ i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff)); -+ return 1; -+} -+ -+static ssize_t show_adc(struct device *dev, struct device_attribute *devattr, -+ char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct i2c_client *client = to_i2c_client(dev); -+ return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg)); -+} -+ -+static ssize_t show_label(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ -+ return sprintf(buf, "%s\n", gsp_sensors[attr->index].name); -+} -+ -+static ssize_t store_fan(struct device *dev, -+ struct device_attribute *devattr, const char *buf, size_t count) -+{ -+ u16 val; -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct i2c_client *client = to_i2c_client(dev); -+ val = simple_strtoul(buf, NULL, 10); -+ gsp_write(client, gsp_sensors[attr->index].reg, val); -+ return count; -+} -+ -+static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0); -+static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0); -+ -+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1); -+static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1); -+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2); -+static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2); -+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3); -+static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3); -+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4); -+static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4); -+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5); -+static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5); -+static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6); -+static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6); -+static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7); -+static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7); -+static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8); -+static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8); -+static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9); -+static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9); -+static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10); -+static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10); -+static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11); -+static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11); -+static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12); -+static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12); -+static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13); -+static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13); -+ -+static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14); -+static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15); -+static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16); -+static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17); -+static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18); -+static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19); -+ -+static struct attribute *gsp_attributes[] = { -+ &sensor_dev_attr_temp0_input.dev_attr.attr, -+ &sensor_dev_attr_in0_input.dev_attr.attr, -+ &sensor_dev_attr_in1_input.dev_attr.attr, -+ &sensor_dev_attr_in2_input.dev_attr.attr, -+ &sensor_dev_attr_in3_input.dev_attr.attr, -+ &sensor_dev_attr_in4_input.dev_attr.attr, -+ &sensor_dev_attr_in5_input.dev_attr.attr, -+ &sensor_dev_attr_in6_input.dev_attr.attr, -+ &sensor_dev_attr_in7_input.dev_attr.attr, -+ &sensor_dev_attr_in8_input.dev_attr.attr, -+ &sensor_dev_attr_in9_input.dev_attr.attr, -+ &sensor_dev_attr_in10_input.dev_attr.attr, -+ &sensor_dev_attr_in11_input.dev_attr.attr, -+ &sensor_dev_attr_in12_input.dev_attr.attr, -+ -+ &sensor_dev_attr_temp0_label.dev_attr.attr, -+ &sensor_dev_attr_in0_label.dev_attr.attr, -+ &sensor_dev_attr_in1_label.dev_attr.attr, -+ &sensor_dev_attr_in2_label.dev_attr.attr, -+ &sensor_dev_attr_in3_label.dev_attr.attr, -+ &sensor_dev_attr_in4_label.dev_attr.attr, -+ &sensor_dev_attr_in5_label.dev_attr.attr, -+ &sensor_dev_attr_in6_label.dev_attr.attr, -+ &sensor_dev_attr_in7_label.dev_attr.attr, -+ &sensor_dev_attr_in8_label.dev_attr.attr, -+ &sensor_dev_attr_in9_label.dev_attr.attr, -+ &sensor_dev_attr_in10_label.dev_attr.attr, -+ &sensor_dev_attr_in11_label.dev_attr.attr, -+ &sensor_dev_attr_in12_label.dev_attr.attr, -+ -+ &sensor_dev_attr_fan0_point0.dev_attr.attr, -+ &sensor_dev_attr_fan0_point1.dev_attr.attr, -+ &sensor_dev_attr_fan0_point2.dev_attr.attr, -+ &sensor_dev_attr_fan0_point3.dev_attr.attr, -+ &sensor_dev_attr_fan0_point4.dev_attr.attr, -+ &sensor_dev_attr_fan0_point5.dev_attr.attr, -+ NULL -+}; -+ -+ -+static int gsp_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct i2c_adapter *adapter = client->adapter; -+ struct gsp_data *data; -+ int err; -+ -+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | -+ I2C_FUNC_SMBUS_WORD_DATA)) { -+ err = -EOPNOTSUPP; -+ goto exit; -+ } -+ -+ if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) { -+ err = -ENOMEM; -+ goto exit; -+ } -+ -+ i2c_set_clientdata(client, data); -+ -+ data->type = id->driver_data; -+ -+ switch (data->type) { -+ case 0: -+ data->attrs.attrs = gsp_attributes; -+ break; -+ } -+ -+ dev_info(&client->dev, "%s chip found\n", client->name); -+ -+ /* Register sysfs hooks */ -+ if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) -+ goto exit_free; -+ -+ data->hwmon_dev = hwmon_device_register(&client->dev); -+ if (IS_ERR(data->hwmon_dev)) { -+ err = PTR_ERR(data->hwmon_dev); -+ goto exit_remove; -+ } -+ -+ return 0; -+ -+exit_remove: -+ sysfs_remove_group(&client->dev.kobj, &data->attrs); -+exit_free: -+ kfree(data); -+exit: -+ return err; -+} -+ -+static int gsp_remove(struct i2c_client *client) -+{ -+ struct gsp_data *data = i2c_get_clientdata(client); -+ hwmon_device_unregister(data->hwmon_dev); -+ sysfs_remove_group(&client->dev.kobj, &data->attrs); -+ kfree(data); -+ return 0; -+} -+ -+static int __init gsp_init(void) -+{ -+ return i2c_add_driver(&gsp_driver); -+} -+ -+static void __exit gsp_exit(void) -+{ -+ i2c_del_driver(&gsp_driver); -+} -+ -+module_init(gsp_init); -+module_exit(gsp_exit); -+ -+MODULE_AUTHOR("Chris Lang "); -+MODULE_DESCRIPTION("GSC HWMON driver"); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION(DRV_VERSION); -+ diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile new file mode 100644 index 0000000000..51cd8f3e06 --- /dev/null +++ b/target/linux/ramips/Makefile @@ -0,0 +1,26 @@ +# +# Copyright (C) 2008-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:=ramips +BOARDNAME:=MediaTek Ralink MIPS +SUBTARGETS:=rt305x mt7620 mt7621 mt7628 mt7688 rt3883 rt288x +FEATURES:=squashfs gpio mips16 +MAINTAINER:=John Crispin + +KERNEL_PATCHVER:=4.4 + +define Target/Description + Build firmware images for Ralink RT288x/RT3xxx based boards. +endef + +include $(INCLUDE_DIR)/target.mk +DEFAULT_PACKAGES += \ + kmod-leds-gpio kmod-gpio-button-hotplug wpad-mini swconfig + +$(eval $(call BuildTarget)) diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..0ebf471802 --- /dev/null +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -0,0 +1,391 @@ +#!/bin/sh + +. /lib/functions/uci-defaults.sh +. /lib/ramips.sh + +set_usb_led() { + ucidef_set_led_usbdev "usb" "USB" "${1}" "${2:-1-1}" +} + +set_wifi_led() { + ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}" +} + + +board=$(ramips_board_name) + +board_config_update + +case $board in +11acnas|\ +all0239-3g|\ +hw550-3g|\ +mofi3500-3gn|\ +sap-g3200u3|\ +sk-wb8|\ +w2914nsv2|\ +wf-2881) + set_usb_led "$board:green:usb" + ;; +3g150b|\ +3g300m) + set_usb_led "$board:blue:3g" + ;; +3g-6200n) + set_wifi_led "$board:amber:wlan" + set_usb_led "$board:blue:3g" + ;; +3g-6200nl|\ +wnce2001) + set_wifi_led "$board:green:wlan" + ;; +br-6475nd|\ +mzk-w300nh2) + set_wifi_led "$board:amber:wlan" + ;; +a5-v11|\ +cs-qr10) + ucidef_set_led_default "power" "POWER" "$board:red:power" "1" + ;; +ai-br100) + ucidef_set_led_netdev "wan" "wan" "$board:blue:wan" "eth0.2" + set_wifi_led "$board:blue:wlan" + ;; +air3gii) + set_wifi_led "$board:green:wlan" + set_usb_led "$board:green:mobile" + ;; +all0256n) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "$board:green:rssilow" "wlan0" "1" "40" "0" "6" + ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$board:green:rssimed" "wlan0" "30" "80" "-29" "5" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$board:green:rssihigh" "wlan0" "70" "100" "-69" "8" + set_wifi_led "rt2800pci-phy0::radio" + ;; +ar670w|\ +ar725w|\ +awapn2403) + set_wifi_led "rt2800soc-phy0::radio" + ;; +asl26555) + ucidef_set_led_default "power" "POWER" "$board:green:power" "1" + ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0" + set_wifi_led "$board:green:wlan" + set_usb_led "$board:green:3g" + ;; +bc2) + set_usb_led "$board:blue:usb" + ;; +br-6425) + set_wifi_led "$board:orange:wlan" + ;; +broadway) + set_usb_led "$board:red:diskmounted" + set_wifi_led "$board:red:wps_active" + ;; +c20i) + ucidef_set_led_switch "lan" "lan" "$board:blue:lan" "switch0" "0x1e" + ucidef_set_led_switch "wan" "wan" "$board:blue:wan" "switch0" "0x01" + set_usb_led "$board:blue:usb" "2-1" + ucidef_set_led_wlan "wlan" "wlan" "$board:blue:wlan" "phy0radio" + ;; +c50) + ucidef_set_led_default "power" "power" "$board:green:power" "0" + ucidef_set_led_switch "lan" "lan" "$board:green:lan" "switch0" "0x1e" + ucidef_set_led_switch "wan" "wan" "$board:green:wan" "switch0" "0x01" + set_usb_led "$board:green:usb" + ucidef_set_led_netdev "wlan2g" "wlan2g" "$board:green:wlan2g" wlan1 + set_wifi_led "$board:green:wlan5g" + ;; +cf-wr800n) + ucidef_set_led_netdev "lan" "lan" "$board:white:ethernet" eth0.1 + set_wifi_led "$board:white:wifi" + ;; +cy-swr1100) + ucidef_set_led_default "wps" "WPS" "$board:blue:wps" "0" + set_usb_led "$board:blue:usb" + ;; +d105) + ucidef_set_led_default "power" "POWER" "$board:red:power" "1" + set_usb_led "$board:green:usb" + ;; +db-wrt01) + ucidef_set_led_default "power" "power" "$board: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" "$board:red:power" "1" + ucidef_set_led_netdev "wifi" "WiFi" "$board:blue:wps" + ;; +dir-300-b1|\ +dir-600-b1|\ +dir-620-a1) + ucidef_set_led_default "wan" "WAN LED (amber)" "$board:amber:wan" "1" + set_wifi_led "rt2800pci-phy0::radio" + ;; +dir-300-b7|\ +dir-320-b1|\ +dir-610-a1|\ +esr-9753|\ +hlk-rm04|\ +sl-r7205|\ +v11st-fe|\ +w306r-v20|\ +wt1520) + set_wifi_led "rt2800pci-phy0::radio" + ;; +dir-615-d|\ +dir-615-h1) + ucidef_set_led_default "status" "Status LED (amber)" "$board:amber:status" "0" + set_wifi_led "rt2800pci-phy0::radio" + ;; +dir-620-d1|\ +mzk-ex300np) + set_wifi_led "$board:green:wifi" + ;; +dir-810l|\ +mzk-750dhp|\ +mzk-dp150n|\ +vr500) + ucidef_set_led_default "power" "power" "$board:green:power" "1" + ;; +dir-860l-b1) + ucidef_set_led_netdev "wan" "wan" "$board:green:net" "eth0.2" + ;; +ex2700) + ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0" + set_wifi_led "$board:green:router" + ;; +f5d8235-v1) + ucidef_set_led_default "lan" "lan" "$board:blue:wired" "0" + set_usb_led "$board:blue:storage" + set_wifi_led "$board:blue:wireless" + ;; +f5d8235-v2) + set_usb_led "$board:blue:storage" + ;; +fonera20n) + set_usb_led "$board:orange:usb" + set_wifi_led "$board:orange:wifi" + ;; +gl-mt300a|\ +gl-mt300n|\ +gl-mt750) + set_wifi_led "$board:wlan" + ;; +hc5661) + ucidef_set_led_default "system" "system" "$board:blue:system" "1" + ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" "eth0.2" + set_wifi_led "$board:blue:wlan2g" + ;; +hc5761) + ucidef_set_led_default "system" "system" "$board:blue:system" "1" + ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" "eth0.2" + set_wifi_led "$board:blue:wlan2g" + ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan5g" "rai0" + ;; +hc5861) + ucidef_set_led_default "system" "system" "$board:blue:system" "1" + ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" "eth0.2" + set_wifi_led "$board:blue:wlan2g" + ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan5g" "rai0" + ucidef_set_led_default "turbo" "turbo" "$board:blue:turbo" "0" + ;; +hg255d) + set_wifi_led "$board:green:wlan" + set_usb_led "$board:green:usb" + ucidef_set_led_netdev "internet" "internet" "$board:green:internet" "eth0.2" + ;; +hpm) + ucidef_set_led_default "power" "POWER" "$board:orange:power" "1" + ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0" + set_wifi_led "$board:green:wifi" + ;; +ht-tm02) + ucidef_set_led_netdev "eth" "Ethernet" "$board:green:lan" "eth0" + set_wifi_led "$board:blue:wlan" + ;; +kn_rc|\ +kn_rf|\ +kng_rc) + set_usb_led "$board:green:usb" + set_wifi_led "$board:green:wifi" + ;; +m2m) + set_wifi_led "$board:blue:wifi" + ucidef_set_led_netdev "eth" "Ethernet" "$board:green:wan" "eth0" + ;; +miniembplug) + set_wifi_led "$board:red:wlan" + set_usb_led "$board:green:mobile" + ;; +miwifi-mini) + ucidef_set_led_default "power" "power" "$board:red:status" "1" + ;; +mlw221|\ +mlwg2) + set_wifi_led "$board:blue:wifi" + ucidef_set_led_default "system" "system" "$board:blue:system" "1" + ;; +mpr-a1|\ +mpr-a2) + set_wifi_led "$board:blue:system" + ;; +mr-102n) + set_wifi_led "$board:green:wlan" + set_usb_led "$board:green:usb" + ;; +mr200) + ucidef_set_led_default "power" "power" "$board:white:power" "1" + ucidef_set_led_netdev "lan" "lan" "$board:white:lan" "eth0.1" + ucidef_set_led_netdev "wan" "wan" "$board:white:wan" "usb0" + set_wifi_led "$board:white:wlan" + ;; +mzk-ex750np) + ucidef_set_led_default "power" "power" "$board:red:power" "1" + set_wifi_led "$board:red:wifi" + ;; +na930) + set_usb_led "$board:blue:status" + ;; +nbg-419n2) + set_usb_led "$board:green:usb" + set_wifi_led "rt2800pci-phy0::radio" + ;; +newifi-d1) + set_usb_led "$board:red:status" + ;; +nw718) + set_usb_led "$board:amber:usb" + ;; +oy-0001) + ucidef_set_led_default "power" "power" "$board:green:power" "1" + set_wifi_led "$board:green:wifi" + ;; +pbr-d1) + set_usb_led "$board:orange:usb" + ;; +pbr-m1) + ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" "eth0.2" + ucidef_set_led_default "power" "power" "$board:blue:power" "1" + ucidef_set_led_default "sys" "sys" "$board:blue:sys" "1" + ;; +psg1208) + set_wifi_led "$board:white:wlan2g" + ;; +psg1218) + ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0" + ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0" + ;; +px-4885) + set_wifi_led "$board:orange:wifi" + set_usb_led "$board:blue:storage" + ;; +re6500) + ucidef_set_led_default "power" "power" "$board:white:power" "1" + ucidef_set_led_default "wifi" "wifi" "$board:orange:wifi" "1" + ;; +rp-n53) + ucidef_set_led_netdev "eth" "Network" "$board:white:back" "eth0" + set_wifi_led "$board:blue:wifi" + ;; +rt-n14u) + ucidef_set_led_default "power" "power" "$board:blue:power" "1" + ucidef_set_led_netdev "lan" "lan" "$board:blue:lan" eth0.1 + ucidef_set_led_netdev "wan" "wan" "$board:blue:wan" eth0.2 + set_wifi_led "$board:blue:air" + set_usb_led "$board:blue:usb" + ;; +tew-714tru) + set_usb_led "$board:red:usb" + set_wifi_led "$board:green:wifi" + ;; +tiny-ac) + set_wifi_led "$board:orange:wifi" + set_usb_led "$board:green:usb" + ;; +vocore) + ucidef_set_led_netdev "eth" "ETH" "$board:orange:eth" "eth0" + set_wifi_led "$board:green:status" + ;; +w502u) + set_usb_led "$board:blue:usb" + set_wifi_led "rt2800pci-phy0::radio" + ;; +wcr-150gn) + set_usb_led "$board:amber:user" + ;; +whr-1166d|\ +whr-300hp2|\ +whr-600d) + ucidef_set_led_default "power" "power" "$board:green:power" "1" + ucidef_set_led_default "router" "router" "$board:green:router" "1" + ;; +wl-wn575a3) + ucidef_set_rssimon "wlan1" "200000" "1" + ucidef_set_led_rssi "wifi-low" "wifi-low" "$board:green:wifi-low" "wlan1" "1" "49" "0" "1" + ucidef_set_led_rssi "wifi-med" "wifi-med" "$board:green:wifi-med" "wlan1" "50" "84" "0" "1" + ucidef_set_led_rssi "wifi-high" "wifi-high" "$board:green:wifi-high" "wlan1" "85" "100" "0" "1" + ;; +wrh-300cr) + set_wifi_led "$board:green:wlan" + ucidef_set_led_netdev "lan" "lan" "$board:green:ethernet" "eth0" + ;; +wndr3700v5) + ucidef_set_led_default "power" "POWER" "$board:green:power" "0" + ;; +wt3020) + ucidef_set_led_default "power" "power" "$board:blue:power" "0" + ;; +y1) + set_usb_led "$board:blue:usb" + ucidef_set_led_netdev "wifi" "WIFI" "$board:blue:wifi" "wlan1" + ucidef_set_led_netdev "wifi5g" "WIFI5G" "$board:blue:wifi5g" "wlan0" + ucidef_set_led_netdev "lan" "LAN" "$board:blue:lan" "eth0.1" "tx rx" + ucidef_set_led_netdev "wan" "WAN" "$board:blue:internet" "eth0.2" "tx rx" + ;; +y1s) + set_usb_led "$board:blue:usb" + ucidef_set_led_netdev "wifi" "WIFI" "$board:yellow:wifi" "wlan1" + ucidef_set_led_netdev "wifi5g" "WIFI5G" "$board:blue:wifi" "wlan0" + ucidef_set_led_netdev "wan" "WAN" "$board:blue:internet" "eth0.2" "tx rx" + ;; +zbt-ape522ii) + ucidef_set_led_netdev "wlan2g4" "wlan1-link" "$board:green:wlan2g4" "wlan1" + ucidef_set_led_netdev "sys1" "wlan1" "$board:green:sys1" "wlan1" "tx rx" + ucidef_set_led_netdev "sys2" "wlan0" "$board:green:sys2" "wlan0" "tx rx" + ;; +zbt-cpe102) + ucidef_set_led_default "power" "power" "$board:green:4g-0" "0" + ;; +zbt-wa05) + ucidef_set_led_default "power" "power" "$board:blue:power" "1" + set_wifi_led "$board:blue:air" + set_usb_led "$board:blue:usb" + ;; +zbt-we826) + ucidef_set_led_default "power" "power" "$board:green:power" "1" + set_wifi_led "$board:green:wifi" + set_usb_led "$board:green:usb" + ;; +zbt-wr8305rt) + ucidef_set_led_default "power" "power" "$board:green:sys" "1" + set_usb_led "$board:green:usb" + set_wifi_led "$board:green:wifi" + ;; +zte-q7) + set_wifi_led "$board:blue:status" + ;; +youku-yk1) + ucidef_set_led_default "power" "power" "$board:blue:power" "1" + set_wifi_led "$board:blue:air" + set_usb_led "$board:blue:usb" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..daf9b33a74 --- /dev/null +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -0,0 +1,433 @@ +#!/bin/sh + +. /lib/functions.sh +. /lib/ramips.sh +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh + +ramips_setup_rt3x5x_vlans() +{ + if [ ! -x /sbin/swconfig ]; then + # legacy default + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + return + fi + local wanports="" + local lanports="" + for port in 5 4 3 2 1 0; do + if [ `swconfig dev rt305x port $port get disable` = "1" ]; then + continue + fi + if [ `swconfig dev rt305x port $port get lan` = "0" ]; then + wanports="$port:wan $wanports" + else + lanports="$port:lan $lanports" + fi + done + ucidef_add_switch "rt305x" $lanports $wanports "6t@eth0" +} + +ramips_setup_interfaces() +{ + local board="$1" + + case $board in + 11acnas|\ + w2914nsv2) + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0" + ;; + 3g150b|\ + 3g300m|\ + a5-v11|\ + all0256n|\ + all5002|\ + all5003|\ + broadway|\ + dcs-930|\ + dcs-930l-b1|\ + ht-tm02|\ + linkits7688 | \ + linkits7688d | \ + m2m|\ + microwrt|\ + mpr-a2|\ + ncs601w|\ + timecloud|\ + w150m|\ + widora-neo|\ + wnce2001|\ + zbt-cpe102|\ + zte-q7) + ucidef_add_switch "switch0" + ucidef_add_switch_attr "switch0" "enable" "false" + ucidef_set_interface_lan "eth0" + ;; + mlw221|\ + mr-102n) + ucidef_set_interface_lan "eth0.2" + ;; + 3g-6200n|\ + ac1200pro|\ + ai-br100|\ + db-wrt01|\ + dir-300-b7|\ + dir-320-b1|\ + dir-610-a1|\ + dir-615-h1|\ + firewrt|\ + hlk-rm04|\ + mac1200rv2|\ + miwifi-mini|\ + miwifi-nano|\ + mt7621|\ + mt7628|\ + mzk-750dhp|\ + mzk-w300nh2|\ + nixcore|\ + oy-0001|\ + pbr-m1|\ + psg1208|\ + psg1218|\ + sap-g3200u3|\ + sk-wb8|\ + vr500|\ + wf-2881|\ + witi|\ + wl-wn575a3|\ + wndr3700v5|\ + wt1520|\ + y1|\ + youku-yk1|\ + zbt-ape522ii|\ + zbt-we826|\ + zbt-wg2626|\ + zbt-wg3526|\ + zbt-wr8305rt) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" + ;; + whr-300hp2|\ + whr-600d|\ + wsr-1166|\ + wsr-600) + ucidef_add_switch "switch0" \ + "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan:5" "6@eth0" + ;; + ar670w|\ + ar725w|\ + rt-n15|\ + wl-351) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" + ;; + asl26555|\ + re6500|\ + rp-n53) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" + ;; + atp-52b|\ + awm002-evb|\ + awm003-evb|\ + c20i|\ + c50|\ + dir-645|\ + dir-860l-b1|\ + f5d8235-v2|\ + gl-mt300a|\ + gl-mt300n|\ + gl-mt750|\ + hg255d|\ + jhr-n805r|\ + jhr-n825r|\ + jhr-n926r|\ + mzk-wdpr|\ + rb750gr3|\ + rt-n14u|\ + ubnt-erx|\ + ur-326n4g|\ + wrtnode|\ + wrtnode2p | \ + wrtnode2r | \ + wt3020|\ + zbt-wa05) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" + ;; + awapn2403) + ucidef_add_switch "switch0" \ + "0:lan" "1:wan" "6@eth0" + ;; + b2c|\ + nw718|\ + psr-680w|\ + sl-r7205|\ + ur-336un|\ + w502u|\ + wr6202) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ;; + br-6475nd) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0" + ;; + cf-wr800n|\ + ex2700) + ucidef_add_switch "switch0" \ + "4:lan" "6t@eth0" + ;; + cy-swr1100) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0" + ;; + cs-qr10|\ + d105|\ + dch-m225|\ + hpm|\ + mzk-ex300np|\ + mzk-ex750np|\ + na930|\ + pbr-d1|\ + wli-tx4-ag300n|\ + wmr-300|\ + wrh-300cr) + ucidef_set_interface_lan "eth0" + ;; + duzun-dm06) + ucidef_add_switch "switch0" \ + "1:lan" "0:wan" "6@eth0" + ;; + e1700|\ + mt7620a_mt7530) + ucidef_add_switch "switch1" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" + ;; + hc5*61|\ + y1s) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0" + ;; + kn_rc|\ + kn_rf) + ucidef_add_switch "switch" \ + "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0" + ;; + kng_rc) + ucidef_add_switch "switch1" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t@eth0" + ;; + mlwg2|\ + wizard8800|\ + wl-330n) + ucidef_set_interface_lan "eth0.1" + ;; + mr200) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0" + ucidef_set_interface_wan "usb0" + ;; + mzk-dp150n|\ + vocore) + ucidef_add_switch "switch0" \ + "0:lan" "4:lan" "6t@eth0" + ;; + newifi-d1) + ucidef_set_interface_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6t@eth0" "7t@eth0" + ucidef_add_switch "switch1" \ + "4:lan" "6t@eth0" "7t@eth0" + ;; + rt-n56u) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0" + ;; + tew-691gr|\ + tew-692gr|\ + wlr-6000) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" + ;; + f5d8235-v1|\ + tew-714tru|\ + v11st-fe|\ + wzr-agl300nh) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" + ;; + wcr-150gn) + ucidef_add_switch "switch0" \ + "0:lan" "6t@eth0" + ;; + whr-1166d) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0" + ;; + wizfi630a) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "0:wan" "6@eth0" + ;; + *) + RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"` + if [ -n "${RT3X5X}" ]; then + ramips_setup_rt3x5x_vlans + else + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + fi + ;; + esac +} + +ramips_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + + case $board in + a5-v11|\ + ht-tm02) + lan_mac=$(cat /sys/class/net/eth0/address) + ;; + all0239-3g|\ + carambola|\ + freestation5|\ + w502u|\ + wnce2001) + wan_mac=$(mtd_get_mac_binary factory 46) + ;; + bc2|\ + broadway|\ + d105|\ + dir-300-b7|\ + dir-320-b1|\ + dir-620-a1|\ + esr-9753|\ + freestation5|\ + hlk-rm04|\ + mpr-a1|\ + psr-680w|\ + sl-r7205|\ + y1|\ + y1s) + lan_mac=$(cat /sys/class/net/eth0/address) + lan_mac=$(macaddr_setbit_la "$lan_mac") + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + br-6475nd) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(mtd_get_mac_binary devdata 7) + ;; + cy-swr1100|\ + dch-m225) + lan_mac=$(mtd_get_mac_ascii factory lanmac) + ;; + dir-645) + lan_mac=$(mtd_get_mac_ascii nvram lanmac) + wan_mac=$(mtd_get_mac_ascii nvram wanmac) + ;; + dir-860l-b1) + lan_mac=$(mtd_get_mac_ascii factory lanmac) + wan_mac=$(mtd_get_mac_ascii factory wanmac) + ;; + e1700) + wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR) + ;; + hc5*61) + 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) + ;; + kng_rc) + wan_mac=$(mtd_get_mac_binary factory 28) + ;; + linkits7688 | \ + linkits7688d) + wan_mac=$(mtd_get_mac_binary factory 4) + lan_mac=$(mtd_get_mac_binary factory 46) + ;; + mac1200rv2) + lan_mac=$(mtd_get_mac_binary factory_info 13) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + m3|\ + m4|\ + x5|\ + x8) + lan_mac=$(cat /sys/class/net/eth0/address) + lan_mac=$(macaddr_add "$lan_mac" -2) + ;; + newifi-d1) + lan_mac=$(cat /sys/class/net/eth0/address) + lan_mac=$(macaddr_add "$lan_mac" 2) + ;; + oy-0001) + lan_mac=$(mtd_get_mac_binary factory 40) + wan_mac=$(mtd_get_mac_binary factory 46) + ;; + rt-n56u) + lan_mac=$(cat /sys/class/net/eth0/address) + lan_mac=$(macaddr_setbit_la "$lan_mac") + wan_mac=$(mtd_get_mac_binary factory 32772) + ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; + tew-691gr) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 4)" 3) + ;; + tew-692gr) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 4)" 1) + ;; + tiny-ac) + lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR) + wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR) + ;; + vr500) + lan_mac=$(mtd_get_mac_binary factory 57344) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; + w306r-v20) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(macaddr_add "$lan_mac" 5) + ;; + wcr-150gn) + wan_mac=$(mtd_get_mac_binary factory 40) + ;; + whr-1166d|\ + whr-300hp2|\ + whr-600d|\ + wsr-600) + wan_mac=$(mtd_get_mac_binary factory 4) + lan_mac=$wan_mac + ;; + wizfi630a) + lan_mac=$(mtd_get_mac_binary factory 4) + wan_mac=$(mtd_get_mac_binary factory 40) + ;; + wlr-6000) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 32772)" 2) + ;; + wsr-1166) + local index="$(find_mtd_index "board_data")" + wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)" + lan_mac=$wan_mac + ;; + *) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac +} + +board_config_update +board=$(ramips_board_name) +ramips_setup_interfaces $board +ramips_setup_macs $board +board_config_flush + +exit 0 diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh new file mode 100644 index 0000000000..a22be5e3d4 --- /dev/null +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -0,0 +1,262 @@ +#!/bin/sh +# Copyright (C) 2010-2013 OpenWrt.org + +. /lib/functions/leds.sh +. /lib/ramips.sh + +get_status_led() { + board=$(ramips_board_name) + + case $board in + 3g150b|\ + 3g300m|\ + w150m) + status_led="$board:blue:ap" + ;; + 3g-6200n|\ + ar670w|\ + ar725w|\ + asl26555|\ + br-6425|\ + br-6475nd|\ + c50|\ + dch-m225|\ + dir-860l-b1|\ + e1700|\ + fonera20n|\ + kn_rc|\ + kn_rf|\ + kng_rc|\ + mzk-750dhp|\ + mzk-dp150n|\ + mzk-w300nh2|\ + nbg-419n|\ + nbg-419n2|\ + pwh2004|\ + vr500|\ + wnce2001|\ + wndr3700v5|\ + x5|\ + x8|\ + xdxrn502j) + status_led="$board:green:power" + ;; + 3g-6200nl) + status_led="$board:green:internet" + ;; + a5-v11|\ + cs-qr10|\ + d105|\ + dcs-930l-b1|\ + ex2700|\ + hlk-rm04|\ + jhr-n825r|\ + mpr-a1|\ + mpr-a2|\ + mzk-ex750np) + status_led="$board:red:power" + ;; + ac1200pro|\ + 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|\ + hpm|\ + hw550-3g|\ + mac1200rv2|\ + miniembwifi|\ + mofi3500-3gn|\ + rut5xx|\ + v11st-fe|\ + vocore|\ + wmr-300|\ + zbt-wg2626|\ + zbt-wg3526) + status_led="$board:green:status" + ;; + ai-br100|\ + ht-tm02) + status_led="$board:blue:wlan" + ;; + atp-52b|\ + ip2202) + status_led="$board:green:run" + ;; + awapn2403|\ + dir-645|\ + sk-wb8|\ + wrh-300cr) + status_led="$board:green:wps" + ;; + cf-wr800n|\ + psg1208) + status_led="$board:white:wps" + ;; + psg1218) + status_led="$board:yellow:status" + ;; + cy-swr1100|\ + w502u) + status_led="$board:blue:wps" + ;; + dap-1350|\ + na930|\ + pbr-m1|\ + rt-n13u|\ + rt-n14u|\ + rt-n15|\ + rt-n56u|\ + wl-330n|\ + wl-330n3g|\ + wli-tx4-ag300n|\ + wt3020|\ + y1|\ + y1s) + status_led="$board:blue:power" + ;; + db-wrt01|\ + esr-9753|\ + pbr-d1) + status_led="$board:orange:power" + ;; + f5d8235-v1) + status_led="$board:blue:wired" + ;; + f5d8235-v2) + status_led="$board:blue:router" + ;; + f7c027|\ + timecloud) + status_led="$board:orange:status" + ;; + hc5*61|\ + jhr-n805r|\ + jhr-n926r|\ + mlw221|\ + mlwg2) + status_led="$board:blue:system" + ;; + linkits7688| \ + linkits7688d) + [ "$1" = "upgrade" ] && status_led="mediatek:orange:wifi" + ;; + m2m) + status_led="$board:blue:wifi" + ;; + m3|\ + m4|\ + miwifi-nano) + status_led="$board:blue:status" + ;; + miwifi-mini|\ + zte-q7) + status_led="$board:red:status" + ;; + mr-102n) + status_led="$board:amber:status" + ;; + mr200) + status_led="$board:white:power" + ;; + nw718) + status_led="$board:amber:cpu" + ;; + newifi-d1) + status_led="$board:blue:status" + ;; + oy-0001|\ + sl-r7205|\ + zbt-we826) + status_led="$board:green:wifi" + ;; + psr-680w) + status_led="$board:red:wan" + ;; + px-4885|\ + re6500|\ + whr-1166d|\ + whr-600d|\ + widora-neo) + status_led="$board:orange:wifi" + ;; + mzk-ex300np|\ + rt-n10-plus|\ + tew-691gr|\ + tew-692gr|\ + ur-326n4g|\ + ur-336un|\ + wf-2881|\ + wr512-3gn) + status_led="$board:green:wps" + ;; + rb750gr3) + status_led="$board:blue:pwr" + ;; + sap-g3200u3) + status_led="$board:green:usb" + ;; + v22rw-2x2) + status_led="$board:green:security" + ;; + w306r-v20|\ + witi|\ + zbt-wr8305rt) + status_led="$board:green:sys" + ;; + wcr-150gn|\ + wl-351) + status_led="$board:amber:power" + ;; + whr-g300n|\ + wlr-6000) + status_led="$board:red:power" + ;; + wzr-agl300nh) + status_led="$board:green:router" + ;; + wizfi630a) + status_led="$board::run" + ;; + whr-300hp2|\ + wsr-1166|\ + wsr-600) + status_led="$board:green:power" + ;; + wrtnode2r | \ + wrtnode2p | \ + wrtnode) + status_led="wrtnode:blue:indicator" + ;; + zbt-cpe102) + status_led="$board:green:4g-0" + ;; + esac +} + +set_state() { + get_status_led $1 + + case "$1" in + preinit) + status_led_blink_preinit + ;; + failsafe) + status_led_blink_failsafe + ;; + upgrade | \ + preinit_regular) + status_led_blink_preinit_regular + ;; + done) + status_led_on + ;; + esac +} 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 new file mode 100644 index 0000000000..b44bae90bb --- /dev/null +++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -0,0 +1,56 @@ +#!/bin/sh + +rt2x00_eeprom_die() { + echo "rt2x00 eeprom: " "$*" + exit 1 +} + +rt2x00_eeprom_extract() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + + . /lib/functions.sh + + mtd=$(find_mtd_part $part) + [ -n "$mtd" ] || \ + rt2x00_eeprom_die "no mtd device found for partition $part" + + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + rt2x00_eeprom_die "failed to extract from $mtd" +} + +rt2x00_eeprom_set_macaddr() { + local macaddr=$1 + + [ -n "$macaddr" ] || \ + rt2x00_eeprom_die "invalid wlan mac address" + + macaddr_2bin $macaddr | dd of=/lib/firmware/$FIRMWARE \ + conv=notrunc bs=1 seek=4 count=6 2>/dev/null || \ + rt2x00_eeprom_die "failed to write mac address to eeprom file" +} + +FW="/lib/firmware/$FIRMWARE" +[ -e "$FW" ] && exit 0 + +. /lib/ramips.sh +. /lib/functions/system.sh + +board=$(ramips_board_name) + +case "$FIRMWARE" in +"soc_wmac.eeprom") + case $board in + tiny-ac) + wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR) + rt2x00_eeprom_extract "factory" 0 512 + rt2x00_eeprom_set_macaddr $wifi_mac + ;; + *) + rt2x00_eeprom_die "Please define mtd-eeprom in $board DTS file!" + ;; + esac + ;; +esac diff --git a/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion b/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion new file mode 100644 index 0000000000..e96acc8501 --- /dev/null +++ b/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion @@ -0,0 +1 @@ +[ "$ACTION" = "motion" ] && logger webcam motion event diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount new file mode 100755 index 0000000000..a9fdd666c3 --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/bootcount @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common + +START=99 + +start() { + . /lib/ramips.sh + + local board=$(ramips_board_name) + if [ $board = "sk-wb8" ]; then + fw_setenv bootcount 0 + fi +} diff --git a/target/linux/ramips/base-files/etc/init.d/enablemodem b/target/linux/ramips/base-files/etc/init.d/enablemodem new file mode 100755 index 0000000000..ba54cc4e6a --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/enablemodem @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common + +START=99 + +start() { + . /lib/ramips.sh + + local board=$(ramips_board_name) + if [ $board = "mr200" ]; then + adb wait-for-device + adb shell chmod +x /WEBSERVER/www/cgi-bin/* + adb shell httpd -h /WEBSERVER/www/ & + echo "2357 000d" > /sys/bus/usb-serial/drivers/option1/new_id + sleep 2 + adb kill-server + fi +} diff --git a/target/linux/ramips/base-files/etc/inittab b/target/linux/ramips/base-files/etc/inittab new file mode 100644 index 0000000000..9820e7144b --- /dev/null +++ b/target/linux/ramips/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/ramips/base-files/etc/uci-defaults/09_fix-seama-header b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header new file mode 100644 index 0000000000..f8d408deda --- /dev/null +++ b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Copyright (C) 2012 OpenWrt.org +# + +. /lib/ramips.sh + +fix_seama_header() { + local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd) + + [ "$kernel_size" ] && mtd -c 0x$kernel_size fixseama firmware +} + +board=$(ramips_board_name) + +case "$board" in +cy-swr1100 | \ +dch-m225 | \ +dir-645 | \ +dir-860l-b1) + fix_seama_header + ;; +esac diff --git a/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh b/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh new file mode 100644 index 0000000000..31ef5f8146 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +do_ramips() { + . /lib/ramips.sh + + ramips_board_detect +} + +boot_hook_add preinit_main do_ramips diff --git a/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming b/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming new file mode 100644 index 0000000000..057fe45444 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming @@ -0,0 +1,56 @@ +#!/bin/sh + +# Netgear WNCE2001 has does a checksum check on boot and goes into recovery +# tftp mode when the check fails. Initializing the JFFS2 partition triggers +# this, so we make sure to zero checksum and size to be checksummed before +# that happens, so this needs to run very early during boot. + +do_checksumming_disable() { + . /lib/ramips.sh + + local board=$(ramips_board_name) + + case "$board" in + wnce2001) + echo "Board is WNCE2001, updating checksum partition..." + local zeroes=/dev/zero + local tmpfile=/tmp/wnce2001_checksum + local partname=checksum + local mtd=$(find_mtd_part $partname) + dd if=$mtd of=$tmpfile bs=80 count=1 2>/dev/null + signature=$(dd if=$tmpfile bs=1 skip=24 count=20 2>/dev/null) + checksum=$(dd if=$tmpfile bs=1 count=4 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"') + if [ "$signature" != "RT3052-AP-WNCE2001-3" ]; then + echo "Signature of checksum partition is wrong, bailing." + return 0 + fi + if [ "$checksum" != "00000000" ]; then + echo "Checksum is set, zeroing." + # zero out checksum + dd if=$zeroes of=$tmpfile conv=notrunc bs=1 seek=0 count=4 2>/dev/null + # zero out bytecount to be checksummed + dd if=$zeroes of=$tmpfile conv=notrunc bs=1 seek=60 count=4 2>/dev/null + mtd write $tmpfile $partname + else + echo "Checksum is already zero, nothing to do." + fi + ;; + rt-n56u) + echo "Board is ASUS RT-N56U, replacing uImage header..." + local firmware_mtd=$(find_mtd_part firmware) + local rootfs_mtd=$(find_mtd_part rootfs) + local rootfs_data_mtd=$(find_mtd_part rootfs_data) + local rootfs_len=$(grep \"rootfs\" /proc/mtd | awk -F' ' '{print "0x"$2}') + local rootfs_data_len=$(grep \"rootfs_data\" /proc/mtd | awk -F' ' '{print "0x"$2}') + local offset=$(echo "$rootfs_len $rootfs_data_len 0x40" | awk -F' ' '{printf "%i",$1-$2-$3}') + local signature=$(dd if=$rootfs_mtd skip=$offset bs=1 count=4 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"') + if [ "$signature" = "27051956" ]; then + dd conv=notrunc if=$rootfs_mtd skip=$offset of=$firmware_mtd bs=1 count=64 2>/dev/null + fi + ;; + esac + + return 0 +} + +boot_hook_add preinit_main do_checksumming_disable diff --git a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips new file mode 100644 index 0000000000..452b1b203f --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (C) 2013 OpenWrt.org +# + +. /lib/ramips.sh + +ramips_set_preinit_iface() { + RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688|MT7620)"` + + if [ -n "${RT3X5X}" ]; then + # The ethernet switch driver enables VLAN by default, but + # failsafe uses eth0, making the device unreachable: + # https://dev.openwrt.org/ticket/18768 + ralink_switchdev=rt305x + case "${RT3X5X}" in + *MT7620*) + ralink_switchdev=mt7620 + ;; + esac + swconfig dev $ralink_switchdev set reset 1 + swconfig dev $ralink_switchdev set enable_vlan 0 + swconfig dev $ralink_switchdev set apply 1 + fi + + ifname=eth0 +} + +boot_hook_add preinit_main ramips_set_preinit_iface diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh new file mode 100755 index 0000000000..9b82b2a5c1 --- /dev/null +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -0,0 +1,661 @@ +#!/bin/sh +# +# Copyright (C) 2010-2013 OpenWrt.org +# + +RAMIPS_BOARD_NAME= +RAMIPS_MODEL= + +ramips_board_detect() { + local machine + local name + + machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo) + + case "$machine" in + *"11AC NAS Router") + name="11acnas" + ;; + *"3G150B") + name="3g150b" + ;; + *"3G300M") + name="3g300m" + ;; + *"3g-6200n") + name="3g-6200n" + ;; + *"3g-6200nl") + name="3g-6200nl" + ;; + *"A5-V11") + name="a5-v11" + ;; + *"Ai-BR100") + name="ai-br100" + ;; + *"Air3GII") + name="air3gii" + ;; + *"ALL0239-3G") + name="all0239-3g" + ;; + *"ALL0256N (4M)") + name="all0256n-4M" + ;; + *"ALL0256N (8M)") + name="all0256n-8M" + ;; + *"ALL5002") + name="all5002" + ;; + *"ALL5003") + name="all5003" + ;; + *"AR670W") + name="ar670w" + ;; + *"AR725W") + name="ar725w" + ;; + *"ASL26555 (8M)") + name="asl26555-8M" + ;; + *"ASL26555 (16M)") + name="asl26555-16M" + ;; + *"ATP-52B") + name="atp-52b" + ;; + *"AWAPN2403") + name="awapn2403" + ;; + *"AWM002 EVB (4M)") + name="awm002-evb-4M" + ;; + *"AWM002 EVB (8M)") + name="awm002-evb-8M" + ;; + *"AWM003 EVB") + name="awm003-evb" + ;; + *"BC2") + name="bc2" + ;; + *"BR-6425") + name="br-6425" + ;; + *"BR-6475nD") + name="br-6475nd" + ;; + *"Broadway") + name="broadway" + ;; + *"C20i") + name="c20i" + ;; + *"C50") + name="c50" + ;; + *"Carambola") + name="carambola" + ;; + *"CF-WR800N") + name="cf-wr800n" + ;; + *"CS-QR10") + name="cs-qr10" + ;; + *"CY-SWR1100") + name="cy-swr1100" + ;; + *"D105") + name="d105" + ;; + *"DAP-1350") + name="dap-1350" + ;; + *"DB-WRT01") + name="db-wrt01" + ;; + *"DCH-M225") + name="dch-m225" + ;; + *"DCS-930") + name="dcs-930" + ;; + *"DCS-930L B1") + name="dcs-930l-b1" + ;; + *"Digineo AC1200 Pro") + name="ac1200pro" + ;; + *"DIR-300 B1") + name="dir-300-b1" + ;; + *"DIR-300 B7") + name="dir-300-b7" + ;; + *"DIR-320 B1") + name="dir-320-b1" + ;; + *"DIR-600 B1") + name="dir-600-b1" + ;; + *"DIR-610 A1") + name="dir-610-a1" + ;; + *"DIR-615 D") + name="dir-615-d" + ;; + *"DIR-615 H1") + name="dir-615-h1" + ;; + *"DIR-620 A1") + name="dir-620-a1" + ;; + *"DIR-620 D1") + name="dir-620-d1" + ;; + *"DIR-645") + name="dir-645" + ;; + *"DIR-810L") + name="dir-810l" + ;; + *"DIR-860L B1") + name="dir-860l-b1" + ;; + *"Dovado Tiny AC") + name="tiny-ac" + ;; + *"DuZun DM06") + name="duzun-dm06" + ;; + *"DWR-512 B") + name="dwr-512-b" + ;; + *"E1700") + name="e1700" + ;; + *"ESR-9753") + name="esr-9753" + ;; + *"EX2700") + name="ex2700"; + ;; + *"F5D8235 v1") + name="f5d8235-v1" + ;; + *"F5D8235 v2") + name="f5d8235-v2" + ;; + *"F7C027") + name="f7c027" + ;; + *"FireWRT") + name="firewrt" + ;; + *"Fonera 2.0N") + name="fonera20n" + ;; + *"FreeStation5") + name="freestation5" + ;; + *"GL-MT300A") + name="gl-mt300a" + ;; + *"GL-MT300N") + name="gl-mt300n" + ;; + *"GL-MT750") + name="gl-mt750" + ;; + *"HC5661") + name="hc5661" + ;; + *"HC5761") + name="hc5761" + ;; + *"HC5861") + name="hc5861" + ;; + *"HG255D") + name="hg255d" + ;; + *"HLK-RM04") + name="hlk-rm04" + ;; + *"HPM") + name="hpm" + ;; + *"HT-TM02") + name="ht-tm02" + ;; + *"HW550-3G") + name="hw550-3g" + ;; + *"IP2202") + name="ip2202" + ;; + *"JHR-N805R") + name="jhr-n805r" + ;; + *"JHR-N825R") + name="jhr-n825r" + ;; + *"JHR-N926R") + name="jhr-n926r" + ;; + *"M3") + name="m3" + ;; + *"M4 (4M)") + name="m4-4M" + ;; + *"M4 (8M)") + name="m4-8M" + ;; + *"MediaTek LinkIt Smart 7688") + linkit="$(dd bs=1 skip=1024 count=12 if=/dev/mtd2 2> /dev/null)" + if [ "${linkit}" = "LINKITS7688D" ]; then + name="linkits7688d" + RAMIPS_MODEL="${machine} DUO" + else + name="linkits7688" + fi + ;; + *"Memory 2 Move") + name="m2m" + ;; + *"Mercury MAC1200R v2") + name="mac1200r-v2" + ;; + *"MicroWRT") + name="microwrt" + ;; + *"MiniEMBPlug") + name="miniembplug" + ;; + *"MiniEMBWiFi") + name="miniembwifi" + ;; + *"MiWiFi Mini") + name="miwifi-mini" + ;; + *"MiWiFi Nano") + name="miwifi-nano" + ;; + *"MLW221") + name="mlw221" + ;; + *"MLWG2") + name="mlwg2" + ;; + *"MOFI3500-3GN") + name="mofi3500-3gn" + ;; + *"MPR-A1") + name="mpr-a1" + ;; + *"MPR-A2") + name="mpr-a2" + ;; + *"MR-102N") + name="mr-102n" + ;; + *"MR200") + name="mr200" + ;; + *"MT7620a + MT7530 evaluation"*) + name="mt7620a_mt7530" + ;; + *"MT7620a V22SG"*) + name="mt7620a_v22sg" + ;; + *"MT7621 evaluation"*) + name="mt7621" + ;; + *"MT7628AN evaluation"*) + name="mt7628" + ;; + *"MT7688 evaluation"*) + name="mt7688" + ;; + *"MZK-750DHP") + name="mzk-750dhp" + ;; + *"MZK-DP150N") + name="mzk-dp150n" + ;; + *"MZK-EX300NP") + name="mzk-ex300np" + ;; + *"MZK-EX750NP") + name="mzk-ex750np" + ;; + *"MZK-W300NH2"*) + name="mzk-w300nh2" + ;; + *"MZK-WDPR"*) + name="mzk-wdpr" + ;; + *"NA930") + name="na930" + ;; + *"NBG-419N") + name="nbg-419n" + ;; + *"NBG-419N v2") + name="nbg-419n2" + ;; + *"Newifi-D1") + name="newifi-d1" + ;; + *"NCS601W") + name="ncs601w" + ;; + *"NixcoreX1 (8M)") + name="nixcore-x1-8M" + ;; + *"NixcoreX1 (16M)") + name="nixcore-x1-16M" + ;; + *"NW718") + name="nw718" + ;; + *"OY-0001") + name="oy-0001" + ;; + *"PBR-D1") + name="pbr-d1" + ;; + *"PBR-M1") + name="pbr-m1" + ;; + *"PSG1208") + name="psg1208" + ;; + *"PSG1218") + name="psg1218" + ;; + *"PSR-680W"*) + name="psr-680w" + ;; + *"PWH2004") + name="pwh2004" + ;; + *"PX-4885 (4M)") + name="px-4885-4M" + ;; + *"PX-4885 (8M)") + name="px-4885-8M" + ;; + *"Q7") + name="zte-q7" + ;; + *"RB750Gr3") + name="rb750gr3" + ;; + *"RE6500") + name="re6500" + ;; + *"RN502J") + name="xdxrn502j" + ;; + *"RP-N53") + name="rp-n53" + ;; + *"RT5350F-OLinuXino") + name="rt5350f-olinuxino" + ;; + *"RT5350F-OLinuXino-EVB") + name="rt5350f-olinuxino-evb" + ;; + *"RT-G32 B1") + name="rt-g32-b1" + ;; + *"RT-N10+") + name="rt-n10-plus" + ;; + *"RT-N13U") + name="rt-n13u" + ;; + *"RT-N14U") + name="rt-n14u" + ;; + *"RT-N15") + name="rt-n15" + ;; + *"RT-N56U") + name="rt-n56u" + ;; + *"RUT5XX") + name="rut5xx" + ;; + *"SamKnows Whitebox 8") + name="sk-wb8" + ;; + *"SAP-G3200U3") + name="sap-g3200u3" + ;; + *"SL-R7205"*) + name="sl-r7205" + ;; + *"TEW-691GR") + name="tew-691gr" + ;; + *"TEW-692GR") + name="tew-692gr" + ;; + *"TEW-714TRU") + name="tew-714tru" + ;; + *"Timecloud") + name="timecloud" + ;; + *"UBNT-ERX") + name="ubnt-erx" + ;; + *"UR-326N4G") + name="ur-326n4g" + ;; + *"UR-336UN") + name="ur-336un" + ;; + *"V11ST-FE") + name="v11st-fe" + ;; + *"V22RW-2X2") + name="v22rw-2x2" + ;; + *"VoCore (8M)") + name="vocore-8M" + ;; + *"VoCore (16M)") + name="vocore-16M" + ;; + *"VR500") + name="vr500" + ;; + *"W150M") + name="w150m" + ;; + *"W2914NS v2") + name="w2914nsv2" + ;; + *"W306R V2.0") + name="w306r-v20" + ;; + *"W502U") + name="w502u" + ;; + *"WCR-150GN") + name="wcr-150gn" + ;; + *"WF-2881") + name="wf-2881" + ;; + *"WHR-1166D") + name="whr-1166d" + ;; + *"WHR-300HP2") + name="whr-300hp2" + ;; + *"WHR-600D") + name="whr-600d" + ;; + *"WHR-G300N") + name="whr-g300n" + ;; + *"Widora-NEO") + name="widora-neo" + ;; + *"WiTi") + name="witi" + ;; + *"WIZARD 8800") + name="wizard8800" + ;; + *"WizFi630A") + name="wizfi630a" + ;; + *"WL-330N") + name="wl-330n" + ;; + *"WL-330N3G") + name="wl-330n3g" + ;; + *"WL-341 v3") + name="wl-341v3" + ;; + *"WL-351 v1 002") + name="wl-351" + ;; + *"WL-WN575A3") + name="wl-wn575a3" + ;; + *"WLI-TX4-AG300N") + name="wli-tx4-ag300n" + ;; + *"WLR-6000") + name="wlr-6000" + ;; + *"WMR-300") + name="wmr-300" + ;; + *"WNCE2001") + name="wnce2001" + ;; + *"WNDR3700v5") + name="wndr3700v5" + ;; + *"WR512-3GN (4M)") + name="wr512-3gn-4M" + ;; + *"WR512-3GN (8M)") + name="wr512-3gn-8M" + ;; + *"WR6202") + name="wr6202" + ;; + *"WRH-300CR") + name="wrh-300cr" + ;; + *"WRTNODE") + name="wrtnode" + ;; + *"WRTnode2R") + name="wrtnode2r" + ;; + *"WRTnode2P") + name="wrtnode2p" + ;; + *"WSR-1166DHP") + name="wsr-1166" + ;; + *"WSR-600DHP") + name="wsr-600" + ;; + *"WT1520 (4M)") + name="wt1520-4M" + ;; + *"WT1520 (8M)") + name="wt1520-8M" + ;; + *"WT3020 (4M)") + name="wt3020-4M" + ;; + *"WT3020 (8M)") + name="wt3020-8M" + ;; + *"WZR-AGL300NH") + name="wzr-agl300nh" + ;; + *"X5") + name="x5" + ;; + *"X8") + name="x8" + ;; + *"Y1") + name="y1" + ;; + *"Y1S") + name="y1s" + ;; + *"ZBT-APE522II") + name="zbt-ape522ii" + ;; + *"ZBT-CPE102") + name="zbt-cpe102" + ;; + *"ZBT-WA05") + name="zbt-wa05" + ;; + *"ZBT-WE826") + name="zbt-we826" + ;; + *"ZBT-WG2626") + name="zbt-wg2626" + ;; + *"ZBT-WG3526") + name="zbt-wg3526" + ;; + *"ZBT-WR8305RT") + name="zbt-wr8305rt" + ;; + *"ZyXEL Keenetic Omni") + name="kn_rc" + ;; + *"ZyXEL Keenetic Omni II") + name="kn_rf" + ;; + *"ZyXEL Keenetic Viva") + name="kng_rc" + ;; + *"YK1") + name="youku-yk1" + ;; + *) + name="generic" + ;; + esac + + [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name" + [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$RAMIPS_MODEL" > /tmp/sysinfo/model +} + +ramips_board_name() { + local name + + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "${name%-[0-9]*M}" +} diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..c097cfa218 --- /dev/null +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -0,0 +1,285 @@ +# +# Copyright (C) 2010 OpenWrt.org +# + +. /lib/ramips.sh + +PART_NAME=firmware +RAMFS_COPY_DATA=/lib/ramips.sh + +platform_check_image() { + local board=$(ramips_board_name) + local magic="$(get_magic_long "$1")" + + [ "$#" -gt 1 ] && return 1 + + case "$board" in + 3g150b|\ + 3g300m|\ + a5-v11|\ + ac1200pro|\ + ai-br100|\ + air3gii|\ + all0239-3g|\ + all0256n|\ + all5002|\ + all5003|\ + ar725w|\ + asl26555|\ + awapn2403|\ + awm002-evb|\ + awm003-evb|\ + bc2|\ + broadway|\ + carambola|\ + cf-wr800n|\ + cs-qr10|\ + d105|\ + dap-1350|\ + db-wrt01|\ + dcs-930|\ + dcs-930l-b1|\ + dir-300-b1|\ + dir-300-b7|\ + dir-320-b1|\ + dir-600-b1|\ + dir-615-d|\ + dir-615-h1|\ + dir-620-a1|\ + dir-620-d1|\ + dir-810l|\ + duzun-dm06|\ + dwr-512-b|\ + e1700|\ + esr-9753|\ + ex2700|\ + f7c027|\ + firewrt|\ + fonera20n|\ + freestation5|\ + gl-mt300a|\ + gl-mt300n|\ + gl-mt750|\ + hc5*61|\ + hg255d|\ + hlk-rm04|\ + hpm|\ + ht-tm02|\ + hw550-3g|\ + ip2202|\ + jhr-n805r|\ + jhr-n825r|\ + jhr-n926r|\ + kn_rc|\ + kn_rf|\ + kng_rc|\ + linkits7688|\ + linkits7688d|\ + m2m|\ + m3|\ + m4|\ + mac1200rv2|\ + microwrt|\ + miniembplug|\ + miniembwifi|\ + miwifi-mini|\ + miwifi-nano|\ + mlw221|\ + mlwg2|\ + mofi3500-3gn|\ + mpr-a1|\ + mpr-a2|\ + mr-102n|\ + mt7628|\ + mzk-750dhp|\ + mzk-dp150n|\ + mzk-ex300np|\ + mzk-ex750np|\ + mzk-w300nh2|\ + mzk-wdpr|\ + nbg-419n|\ + nbg-419n2|\ + newifi-d1|\ + nixcore|\ + nw718|\ + oy-0001|\ + pbr-d1|\ + pbr-m1|\ + psg1208|\ + psg1218|\ + psr-680w|\ + px-4885|\ + rb750gr3|\ + re6500|\ + rp-n53|\ + rt5350f-olinuxino|\ + rt5350f-olinuxino-evb|\ + rt-g32-b1|\ + rt-n10-plus|\ + rt-n13u|\ + rt-n14u|\ + rt-n15|\ + rt-n56u|\ + rut5xx|\ + sap-g3200u3|\ + sk-wb8|\ + sl-r7205|\ + tew-691gr|\ + tew-692gr|\ + tew-714tru|\ + timecloud|\ + tiny-ac|\ + ur-326n4g|\ + ur-336un|\ + v22rw-2x2|\ + vocore|\ + vr500|\ + w150m|\ + w2914nsv2|\ + w306r-v20|\ + w502u|\ + wf-2881|\ + whr-1166d|\ + whr-300hp2|\ + whr-600d|\ + whr-g300n|\ + widora-neo|\ + witi|\ + wizfi630a|\ + wl-330n|\ + wl-330n3g|\ + wl-341v3|\ + wl-351|\ + wl-wn575a3|\ + wli-tx4-ag300n|\ + wlr-6000|\ + wmr-300|\ + wnce2001|\ + wndr3700v5|\ + wr512-3gn|\ + wr6202|\ + wrh-300cr|\ + wrtnode|\ + wrtnode2r |\ + wrtnode2p |\ + wsr-600|\ + wt1520|\ + wt3020|\ + wzr-agl300nh|\ + x5|\ + x8|\ + y1|\ + y1s|\ + zbt-ape522ii|\ + zbt-cpe102|\ + zbt-wa05|\ + zbt-we826|\ + zbt-wg2626|\ + zbt-wg3526|\ + zbt-wr8305rt|\ + zte-q7|\ + youku-yk1) + [ "$magic" != "27051956" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + 3g-6200n|\ + 3g-6200nl|\ + br-6475nd) + [ "$magic" != "43535953" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + + ar670w) + [ "$magic" != "6d000080" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + c20i|\ + c50|\ + mr200) + [ "$magic" != "03000000" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + cy-swr1100|\ + dch-m225|\ + dir-610-a1|\ + dir-645|\ + dir-860l-b1) + [ "$magic" != "5ea3a417" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + wsr-1166) + [ "$magic" != "48445230" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + ubnt-erx) + nand_do_platform_check "$board" "$1" + return $?; + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_nand_pre_upgrade() { + local board=$(ramips_board_name) + + case "$board" in + ubnt-erx) + platform_upgrade_ubnt_erx "$ARGV" + ;; + esac +} + +platform_pre_upgrade() { + local board=$(ramips_board_name) + + case "$board" in + ubnt-erx) + nand_do_upgrade "$ARGV" + ;; + esac +} + +platform_do_upgrade() { + local board=$(ramips_board_name) + + case "$board" in + *) + default_do_upgrade "$ARGV" + ;; + esac +} + +disable_watchdog() { + killall watchdog + ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && { + echo 'Could not disable watchdog' + return 1 + } +} + +blink_led() { + . /etc/diag.sh; set_state upgrade +} + +append sysupgrade_pre_upgrade disable_watchdog +append sysupgrade_pre_upgrade blink_led diff --git a/target/linux/ramips/base-files/lib/upgrade/ubnt.sh b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh new file mode 100644 index 0000000000..316a70444f --- /dev/null +++ b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh @@ -0,0 +1,76 @@ +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions.sh +#Note: this code also uses some functions from nand.sh, but it is expected to be run by nand.sh, so we are not +#sourcing it explicitly here + +UBNT_ERX_KERNEL_INDEX_OFFSET=160 + +ubnt_get_target_kernel() { + local factory_mtd=$1 + local current_kernel_index=$(hexdump -s $UBNT_ERX_KERNEL_INDEX_OFFSET -n 1 -e '/1 "%X "' ${factory_mtd}) + + if [ $current_kernel_index == "0" ]; then + echo 'kernel2' + elif [ $current_kernel_index == "1" ]; then + echo 'kernel1' + fi +} + +ubnt_update_target_kernel() { + local factory_mtd=$1 + local kernel_part=$2 + + local new_kernel_index + if [ $kernel_part == "kernel1" ]; then + new_kernel_index="\x00" + elif [ $kernel_part == "kernel2" ]; then + new_kernel_index="\x01" + else + echo 'Unknown kernel image index' >&2 + return 1 + fi + + if ! (echo -e $new_kernel_index | dd of=${factory_mtd} bs=1 count=1 seek=$UBNT_ERX_KERNEL_INDEX_OFFSET); then + echo 'Failed to update kernel bootup index' >&2 + return 1 + fi +} + +platform_upgrade_ubnt_erx() { + local factory_mtd=$(find_mtd_part factory) + if [ -z "$factory_mtd" ]; then + echo "cannot find factory partition" >&2 + exit 1 + fi + + local kernel_part="$(ubnt_get_target_kernel ${factory_mtd})" + if [ -z "$kernel_part" ]; then + echo "cannot find factory partition" >&2 + exit 1 + fi + + # This is a global defined in nand.sh, sets partition kernel will be flashed into + CI_KERNPART=${kernel_part} + + #Remove volume possibly left over from stock firmware + local ubidev="$( nand_find_ubi "$CI_UBIPART" )" + if [ -z "$ubidev" ]; then + local mtdnum="$( find_mtd_index "$CI_UBIPART" )" + if [ -z "$mtdnum" ]; then + echo "cannot find ubi mtd partition $CI_UBIPART" >&2 + exit 1 + fi + ubiattach -m "$mtdnum" + sync + ubidev="$( nand_find_ubi "$CI_UBIPART" )" + fi + if [ -n "$ubidev" ]; then + local troot_ubivol="$( nand_find_volume $ubidev troot )" + [ -n "$troot_ubivol" ] && ubirmvol /dev/$ubidev -N troot || true + fi + + ubnt_update_target_kernel ${factory_mtd} ${kernel_part} || exit 1 +} diff --git a/target/linux/ramips/base-files/sbin/fixup-mac-address b/target/linux/ramips/base-files/sbin/fixup-mac-address new file mode 100755 index 0000000000..3fd8fcb97a --- /dev/null +++ b/target/linux/ramips/base-files/sbin/fixup-mac-address @@ -0,0 +1,80 @@ +#!/bin/sh +. /lib/functions.sh +. /lib/functions/system.sh + +partname="" +offset="" +NEW_MAC= +YES= + +board=$(ramips_board_name) +case $board in + witi) + partname=factory + offset=$((0xe000)) + ;; + *) + echo "Unsupported board" + exit 1 + ;; +esac + +while [ -n "$1" ]; do + case "$1" in + ??:??:??:??:??:??) NEW_MAC="$1";; + -y) YES=1;; + *) + cat <] +EOF + exit 1 + ;; + esac + shift +done + +ask_bool() { + local message="$1" + local default="$((! ${2:-0}))" + [ -n "$YES" ] && return 0 + echo -n "$message " + read opt + case "$opt" in + y|Y) return 0;; + n|N) return 1;; + *) return $default;; + esac +} + +convert_hex() { + hexdump -e '/1 "%02x "' +} + +gen_mac() { + dd if=/dev/urandom bs=6 count=1 2>/dev/null +} + +mac="$(mtd_get_mac_binary $partname $offset)" +case "$mac" in + 00:00:00:00:00:00);; + ff:ff:ff:ff:ff:ff);; + *) + echo "Current MAC address: $mac" + ask_bool "Overwrite (y/N)?" 0 || exit + ;; +esac + +if [ -n "$NEW_MAC" ]; then + set -- $(echo "$NEW_MAC" | sed 's,:, ,g') +else + set -- $(gen_mac | convert_hex) + set -- $(printf %02x $(( (0x$1 & 0xfe) | 0x02 ))) $2 $3 $4 $5 $6 +fi +echo "New MAC address: $1:$2:$3:$4:$5:$6" +ask_bool "Write to EEPROM (y/N)?" || exit + +part=$(find_mtd_part "$partname") +[ -n "$part" ] || exit +echo -ne "\x$1\x$2\x$3\x$4\x$5\x$6" | dd of=$part conv=notrunc bs=1 count=6 seek=$offset 2>/dev/null +echo "Done" diff --git a/target/linux/ramips/dts/11ACNAS.dts b/target/linux/ramips/dts/11ACNAS.dts new file mode 100644 index 0000000000..8be9869db9 --- /dev/null +++ b/target/linux/ramips/dts/11ACNAS.dts @@ -0,0 +1,26 @@ +/dts-v1/; + +#include "W2914NSV2.dtsi" + +/ { + model = "WeVO 11AC NAS Router"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + 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 new file mode 100644 index 0000000000..502020e5d1 --- /dev/null +++ b/target/linux/ramips/dts/3G-6200N.dts @@ -0,0 +1,111 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "3G-6200N", "ralink,rt3050-soc"; + model = "Edimax 3g-6200n"; + + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@3e0000 { + label = "cimage"; + reg = <0x3e0000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x390000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "3g-6200n:green:power"; + gpios = <&gpio0 9 1>; + }; + + wlan { + label = "3g-6200n:amber:wlan"; + gpios = <&gpio0 14 1>; + }; + + 3g { + label = "3g-6200n:blue:3g"; + gpios = <&gpio0 7 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + rfkill { + label = "wlanswitch"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/3G-6200NL.dts b/target/linux/ramips/dts/3G-6200NL.dts new file mode 100644 index 0000000000..111fef314f --- /dev/null +++ b/target/linux/ramips/dts/3G-6200NL.dts @@ -0,0 +1,100 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "3G-6200NL", "ralink,rt3050-soc"; + model = "Edimax 3g-6200nl"; + + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@3e0000 { + label = "cimage"; + reg = <0x3e0000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x390000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + internet { + label = "3g-6200nl:green:internet"; + gpios = <&gpio0 9 1>; + }; + + wlan { + label = "3g-6200nl:green:wlan"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portdisable = <0x37>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/3G150B.dts b/target/linux/ramips/dts/3G150B.dts new file mode 100644 index 0000000000..b64f940367 --- /dev/null +++ b/target/linux/ramips/dts/3G150B.dts @@ -0,0 +1,118 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "3G150B", "ralink,rt5350-soc"; + model = "Tenda 3G150B"; + + gpio-leds { + compatible = "gpio-leds"; + + ap { + label = "3g150b:blue:ap"; + gpios = <&gpio0 7 1>; + }; + + 3g { + label = "3g150b:blue:3g"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 13 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf", "led"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/3G300M.dts b/target/linux/ramips/dts/3G300M.dts new file mode 100644 index 0000000000..4d19bca6da --- /dev/null +++ b/target/linux/ramips/dts/3G300M.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "3G300M", "ralink,rt3052-soc"; + model = "Tenda 3G300M"; + + gpio-leds { + compatible = "gpio-leds"; + + 3grouter { + label = "3g300m:blue:3grouter"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "3g300m:blue:ap"; + gpios = <&gpio0 12 1>; + }; + + wisprouter { + label = "3g300m:blue:wisprouter"; + gpios = <&gpio0 9 1>; + }; + + wirelessrouter { + label = "3g300m:blue:wirelessrouter"; + gpios = <&gpio0 13 1>; + }; + + 3g { + label = "3g300m:blue:3g"; + gpios = <&gpio0 7 1>; + }; + + wpsreset { + label = "3g300m:blue:wpsreset"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/A5-V11.dts b/target/linux/ramips/dts/A5-V11.dts new file mode 100644 index 0000000000..748e1edac7 --- /dev/null +++ b/target/linux/ramips/dts/A5-V11.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "A5-V11", "ralink,rt5350-soc"; + model = "A5-V11"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "a5-v11:blue:system"; + gpios = <&gpio0 20 1>; + }; + + power { + label = "a5-v11:red:power"; + gpios = <&gpio0 17 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 7 0>; + }; + + root_hub { + gpio-export,name = "root_hub"; + gpio-export,output = <1>; + gpios = <&gpio0 12 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "pm25lq032"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf", "led"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x1>; + mediatek,portdisable = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/AC1200pro.dts b/target/linux/ramips/dts/AC1200pro.dts new file mode 100644 index 0000000000..fbec818440 --- /dev/null +++ b/target/linux/ramips/dts/AC1200pro.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include "ZBT-WG3526.dtsi" + +/ { + model = "Digineo AC1200 Pro"; +}; + +&firmware { + reg = <0x50000 0x1fb0000>; +}; + +&status_led { + label = "ac1200pro:green:status"; +}; diff --git a/target/linux/ramips/dts/AI-BR100.dts b/target/linux/ramips/dts/AI-BR100.dts new file mode 100644 index 0000000000..2405ae700f --- /dev/null +++ b/target/linux/ramips/dts/AI-BR100.dts @@ -0,0 +1,109 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "AI-BR100", "ralink,mt7620a-soc"; + model = "Aigale Ai-BR100"; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "ai-br100:blue:wan"; + gpios = <&gpio2 4 1>; + }; + + wlan { + label = "ai-br100:blue:wlan"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0 0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "u-boot-env"; + reg = <0x20000 0x10000>; + read-only; + }; + + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7c0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/AIR3GII.dts b/target/linux/ramips/dts/AIR3GII.dts new file mode 100644 index 0000000000..4d9a3b5432 --- /dev/null +++ b/target/linux/ramips/dts/AIR3GII.dts @@ -0,0 +1,98 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "AIR3GII", "ralink,rt5350-soc"; + model = "AirLive Air3GII"; + + gpio-leds { + compatible = "gpio-leds"; + + wlan { + label = "air3gii:green:wlan"; + gpios = <&gpio0 8 0>; + }; + + mobile { + label = "air3gii:green:mobile"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q32b"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/ALL0239-3G.dts b/target/linux/ramips/dts/ALL0239-3G.dts new file mode 100644 index 0000000000..7957bad2f9 --- /dev/null +++ b/target/linux/ramips/dts/ALL0239-3G.dts @@ -0,0 +1,118 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ALL0239-3G", "ralink,rt3052-soc"; + model = "Allnet ALL0239-3G"; + + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "all0239-3g:green:usb"; + gpios = <&gpio0 8 1>; + }; + + 3g { + label = "all0239-3g:green:3g"; + gpios = <&gpio0 11 1>; + }; + + status { + label = "all0239-3g:green:status"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "all0239-3g:green:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + connect { + label = "connect"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + status = "okay"; + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/ALL0256N-4M.dts b/target/linux/ramips/dts/ALL0256N-4M.dts new file mode 100644 index 0000000000..abe43d124a --- /dev/null +++ b/target/linux/ramips/dts/ALL0256N-4M.dts @@ -0,0 +1,103 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ALL0256N", "ralink,rt3050-soc"; + model = "Allnet ALL0256N (4M)"; + + gpio-leds { + compatible = "gpio-leds"; + + rssilow { + label = "all0256n:green:rssilow"; + gpios = <&gpio0 14 1>; + }; + + rssimed { + label = "all0256n:green:rssimed"; + gpios = <&gpio0 12 1>; + }; + + rssihigh { + label = "all0256n:green:rssihigh"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3c8000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/ALL0256N-8M.dts b/target/linux/ramips/dts/ALL0256N-8M.dts new file mode 100644 index 0000000000..45c5d3376d --- /dev/null +++ b/target/linux/ramips/dts/ALL0256N-8M.dts @@ -0,0 +1,103 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ALL0256N", "ralink,rt3050-soc"; + model = "Allnet ALL0256N (8M)"; + + gpio-leds { + compatible = "gpio-leds"; + + rssilow { + label = "all0256n:green:rssilow"; + gpios = <&gpio0 14 1>; + }; + + rssimed { + label = "all0256n:green:rssimed"; + gpios = <&gpio0 12 1>; + }; + + rssihigh { + label = "all0256n:green:rssihigh"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/ALL5002.dts b/target/linux/ramips/dts/ALL5002.dts new file mode 100644 index 0000000000..66ed0179a3 --- /dev/null +++ b/target/linux/ramips/dts/ALL5002.dts @@ -0,0 +1,112 @@ +/dts-v1/; + +#include "rt3352.dtsi" + +/ { + compatible = "ALL5002", "ralink,rt3352-soc"; + model = "Allnet ALL5002"; + + i2c-gpio { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "i2c-gpio"; + gpios = <&gpio0 1 0 &gpio0 2 0>; + i2c-gpio,delay-us = <10>; + + pcf0: iexp@38 { + #gpio-cells = <2>; + compatible = "inxp,pcf8574a"; + reg = <0x38>; + gpio-controller; + }; + + hwmon@4b { + compatible = "national,lm92"; + reg = <0x4b>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + ld1 { + label = "all5002:green:ld1"; + gpios = <&pcf0 0 1>; + }; + + ld2 { + label = "all5002:green:ld2"; + gpios = <&pcf0 1 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l25635e"; + spi-max-frequency = <10000000>; + + 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 0x1fb0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/ALL5003.dts b/target/linux/ramips/dts/ALL5003.dts new file mode 100644 index 0000000000..dfb97e6d9b --- /dev/null +++ b/target/linux/ramips/dts/ALL5003.dts @@ -0,0 +1,112 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +/ { + compatible = "ALL5003", "ralink,rt5350-soc"; + model = "Allnet ALL5003"; + + i2c-gpio { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "i2c-gpio"; + gpios = <&gpio0 1 0 &gpio0 2 0>; + i2c-gpio,delay-us = <10>; + + pcf0: iexp@38 { + #gpio-cells = <2>; + compatible = "inxp,pcf8574a"; + reg = <0x38>; + gpio-controller; + }; + + hwmon@4b { + compatible = "national,lm92"; + reg = <0x4b>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + ld1 { + label = "all5003:green:ld1"; + gpios = <&pcf0 0 1>; + }; + + ld2 { + label = "all5003:green:ld2"; + gpios = <&pcf0 1 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l25635e"; + spi-max-frequency = <10000000>; + + 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 0x1fb0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/AR670W.dts b/target/linux/ramips/dts/AR670W.dts new file mode 100644 index 0000000000..3d26c3b6ff --- /dev/null +++ b/target/linux/ramips/dts/AR670W.dts @@ -0,0 +1,105 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include + +/ { + compatible = "AR670W", "ralink,rt2880-soc"; + model = "Airlink101 AR670W"; + + 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; + }; + + factory: factory@30000 { + reg = <0x30000 0x10000>; + label = "factory"; + read-only; + }; + + firmware@40000 { + reg = <0x40000 0x3c0000>; + label = "firmware"; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "ar670w:green:power"; + gpios = <&gpio0 7 1>; + }; + + wpsblue { + label = "ar670w:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 9 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "uartlite"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x2004>; + + port@0 { + phy-handle = <&phy0>; + phy-mode = "mii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + phy-mode = "mii"; + reg = <0>; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0x2000>; +}; diff --git a/target/linux/ramips/dts/AR725W.dts b/target/linux/ramips/dts/AR725W.dts new file mode 100644 index 0000000000..3a2003e8a3 --- /dev/null +++ b/target/linux/ramips/dts/AR725W.dts @@ -0,0 +1,115 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include + +/ { + compatible = "AR725W", "ralink,rt2880-soc"; + model = "Airlink101 AR725W"; + + 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; + }; + + u-boot-env@30000 { + reg = <0x30000 0x10000>; + label = "u-boot-env"; + }; + + factory: factory@40000 { + reg = <0x40000 0x10000>; + label = "factory"; + read-only; + }; + + firmware@50000 { + reg = <0x50000 0x3B0000>; + label = "firmware"; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "ar725w:green:power"; + gpios = <&gpio0 7 0>; + }; + + wpsred { + label = "ar725w:red:wps"; + gpios = <&gpio0 8 1>; + }; + + wpsblue { + label = "ar725w:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 9 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "uartlite"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + + port@0 { + phy-handle = <&phy0>; + phy-mode = "mii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + phy-mode = "mii"; + reg = <0>; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/ASL26555-16M.dts b/target/linux/ramips/dts/ASL26555-16M.dts new file mode 100644 index 0000000000..460fe05efa --- /dev/null +++ b/target/linux/ramips/dts/ASL26555-16M.dts @@ -0,0 +1,156 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ASL26555", "ralink,rt3050-soc"; + model = "Alpha ASL26555 (16M)"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 0>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 12 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + eth { + label = "asl26555:green:eth"; + gpios = <&gpio0 0 1>; + }; + + wan-red { + label = "asl26555:red:wan"; + gpios = <&gpio0 1 0>; + }; + + wan-green { + label = "asl26555:green:wan"; + gpios = <&gpio0 2 0>; + }; + + wlan { + label = "asl26555:green:wlan"; + gpios = <&gpio0 7 0>; + }; + + power-green { + label = "asl26555:green:power"; + gpios = <&gpio0 8 0>; + }; + + power-red { + label = "asl26555:red:power"; + gpios = <&gpio0 9 0>; + }; + + 3g-green { + label = "asl26555:green:3g"; + gpios = <&gpio0 14 1>; + }; + + 3g-red { + label = "asl26555:red:3g"; + gpios = <&gpio0 17 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25sl12801"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@fd0000 { + label = "cert"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "langpack"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + devdata: partition@ff0000 { + label = "devdata"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devdata 0x4004>; +}; + +&esw { + mediatek,portmap = <0x1e>; +}; + +&wmac { + ralink,mtd-eeprom = <&devdata 0x4000>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/ASL26555-8M.dts b/target/linux/ramips/dts/ASL26555-8M.dts new file mode 100644 index 0000000000..288f5552a8 --- /dev/null +++ b/target/linux/ramips/dts/ASL26555-8M.dts @@ -0,0 +1,150 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ASL26555", "ralink,rt3050-soc"; + model = "Alpha ASL26555 (8M)"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 0>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 12 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + eth { + label = "asl26555:green:eth"; + gpios = <&gpio0 0 1>; + }; + + wan-red { + label = "asl26555:red:wan"; + gpios = <&gpio0 1 0>; + }; + + wan-green { + label = "asl26555:green:wan"; + gpios = <&gpio0 2 0>; + }; + + wlan { + label = "asl26555:green:wlan"; + gpios = <&gpio0 7 0>; + }; + + power-green { + label = "asl26555:green:power"; + gpios = <&gpio0 8 0>; + }; + + power-red { + label = "asl26555:red:power"; + gpios = <&gpio0 9 0>; + }; + + 3g-green { + label = "asl26555:green:3g"; + gpios = <&gpio0 14 1>; + }; + + 3g-red { + label = "asl26555:red:3g"; + gpios = <&gpio0 17 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25sl064p"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + ubootenv: partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "rgdb"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; + + partition@7e0000 { + label = "cert"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "langpack"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&ubootenv 0x4004>; +}; + +&esw { + mediatek,portmap = <0x1e>; +}; + +&wmac { + ralink,mtd-eeprom = <&ubootenv 0x4000>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/ATP-52B.dts b/target/linux/ramips/dts/ATP-52B.dts new file mode 100644 index 0000000000..7e872985dd --- /dev/null +++ b/target/linux/ramips/dts/ATP-52B.dts @@ -0,0 +1,99 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ATP-52B", "ralink,rt3052-soc"; + model = "Argus ATP-52B"; + + 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; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7a0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + run { + label = "atp-52b:green:run"; + gpios = <&gpio0 9 1>; + }; + + net { + label = "atp-52b:amber:net"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/AWAPN2403.dts b/target/linux/ramips/dts/AWAPN2403.dts new file mode 100644 index 0000000000..a1b5b217b2 --- /dev/null +++ b/target/linux/ramips/dts/AWAPN2403.dts @@ -0,0 +1,85 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "AWAPN2403", "ralink,rt3052-soc"; + model = "AsiaRF AWAPN2403"; + + gpio-leds { + compatible = "gpio-leds"; + + link { + label = "awapn2403:green:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/AWM002-4M.dtsi b/target/linux/ramips/dts/AWM002-4M.dtsi new file mode 100644 index 0000000000..69d25bb5d4 --- /dev/null +++ b/target/linux/ramips/dts/AWM002-4M.dtsi @@ -0,0 +1,11 @@ +#include "AWM002.dtsi" + +/ { + compatible = "AWM002", "ralink,rt5350-soc"; + model = "AsiaRF AWM002"; +}; + +&m25p80 { + compatible = "jedec,spi-nor"; + linux,modalias = "m25p80", "mx25l3205d"; +}; diff --git a/target/linux/ramips/dts/AWM002-8M.dtsi b/target/linux/ramips/dts/AWM002-8M.dtsi new file mode 100644 index 0000000000..1e6970ddec --- /dev/null +++ b/target/linux/ramips/dts/AWM002-8M.dtsi @@ -0,0 +1,11 @@ +#include "AWM002.dtsi" + +/ { + compatible = "AWM002", "ralink,rt5350-soc"; + model = "AsiaRF AWM002"; +}; + +&m25p80 { + compatible = "jedec,spi-nor"; + linux,modalias = "m25p80", "mx25l6405d"; +}; diff --git a/target/linux/ramips/dts/AWM002-EVB-4M.dts b/target/linux/ramips/dts/AWM002-EVB-4M.dts new file mode 100644 index 0000000000..a8afab80e4 --- /dev/null +++ b/target/linux/ramips/dts/AWM002-EVB-4M.dts @@ -0,0 +1,55 @@ +/dts-v1/; + +#include "AWM002-4M.dtsi" + +#include + +/ { + model = "AsiaRF AWM002 EVB (4M)"; + + gpio-leds { + compatible = "gpio-leds"; + + tx { + label = "awm002-evb:green:tx"; + gpios = <&gpio0 15 1>; + }; + + rx { + label = "awm002-evb:green:rx"; + gpios = <&gpio0 16 1>; + }; + + wps { + label = "awm002-evb:green:wps"; + gpios = <&gpio0 21 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 20 1>; + linux,code = ; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/AWM002-EVB-8M.dts b/target/linux/ramips/dts/AWM002-EVB-8M.dts new file mode 100644 index 0000000000..19b78aab02 --- /dev/null +++ b/target/linux/ramips/dts/AWM002-EVB-8M.dts @@ -0,0 +1,55 @@ +/dts-v1/; + +#include "AWM002-8M.dtsi" + +#include + +/ { + model = "AsiaRF AWM002 EVB (8M)"; + + gpio-leds { + compatible = "gpio-leds"; + + tx { + label = "awm002-evb:green:tx"; + gpios = <&gpio0 15 1>; + }; + + rx { + label = "awm002-evb:green:rx"; + gpios = <&gpio0 16 1>; + }; + + wps { + label = "awm002-evb:green:wps"; + gpios = <&gpio0 21 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 20 1>; + linux,code = ; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/AWM002.dtsi b/target/linux/ramips/dts/AWM002.dtsi new file mode 100644 index 0000000000..9ff64917ea --- /dev/null +++ b/target/linux/ramips/dts/AWM002.dtsi @@ -0,0 +1,76 @@ +#include "rt5350.dtsi" + +/ { + compatible = "AWM002", "ralink,rt5350-soc"; + model = "AsiaRF AWM002"; + + gpio-leds { + compatible = "gpio-leds"; + + ld1 { + label = "awm002:green:ld1"; + gpios = <&gpio0 0 1>; + }; + + ld2 { + label = "awm002:green:ld2"; + gpios = <&gpio0 1 1>; + }; + }; +}; + +&spi0 { + 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; + }; + + 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 0x1fb0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/AWM003-EVB.dts b/target/linux/ramips/dts/AWM003-EVB.dts new file mode 100644 index 0000000000..b42d77ed2f --- /dev/null +++ b/target/linux/ramips/dts/AWM003-EVB.dts @@ -0,0 +1,66 @@ +/dts-v1/; + +#include "AWM002-8M.dtsi" + +#include + +/ { + compatible = "AWM003", "ralink,rt5350-soc"; + model = "AsiaRF AWM003 EVB"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + tx { + label = "awm003-evb:green:tx"; + gpios = <&gpio0 15 1>; + }; + + rx { + label = "awm003-evb:green:rx"; + gpios = <&gpio0 16 1>; + }; + + wps { + label = "awm003-evb:green:wps"; + gpios = <&gpio0 21 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 20 1>; + linux,code = ; + }; + }; +}; + +&m25p80 { + compatible = "jedec,spi-nor"; + linux,modalias = "m25p80", "mx25l6405d"; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/ArcherC20i.dts b/target/linux/ramips/dts/ArcherC20i.dts new file mode 100644 index 0000000000..711274e625 --- /dev/null +++ b/target/linux/ramips/dts/ArcherC20i.dts @@ -0,0 +1,154 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "TP-Link Archer C20i"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + lan { + label = "c20i:blue:lan"; + gpios = <&gpio0 1 1>; + }; + usb { + label = "c20i:blue:usb"; + gpios = <&gpio0 11 1>; + }; + wps { + label = "c20i:blue:wps"; + gpios = <&gpio1 15 1>; + }; + wan { + label = "c20i:blue:wan"; + gpios = <&gpio2 0 1>; + }; + wlan { + label = "c20i:blue:wlan"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + rfkill { + label = "rfkill"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7a0000>; + }; + + partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x10000>; + }; + + rom: partition@7d0000 { + label = "rom"; + reg = <0x7d0000 0x10000>; + }; + + partition@7e0000 { + label = "romfile"; + reg = <0x7e0000 0x10000>; + }; + + radio: partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd", "ephy", "spi refclk"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + mtd-mac-address = <&rom 0xf100>; + mediatek,portmap = "wllll"; + }; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&radio 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&radio 32768>; + mediatek,2ghz = <0>; + }; + }; +}; diff --git a/target/linux/ramips/dts/ArcherC50.dts b/target/linux/ramips/dts/ArcherC50.dts new file mode 100644 index 0000000000..3924cc41fa --- /dev/null +++ b/target/linux/ramips/dts/ArcherC50.dts @@ -0,0 +1,187 @@ +/dts-v1/; +#include +#include + +#include "mt7620a.dtsi" + +/ { + compatible = "ralink,mt7620a-soc"; + model = "TP-Link Archer C50"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan { + label = "c50:green:lan"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; + + power { + label = "c50:green:power"; + gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + }; + + usb { + label = "c50:green:usb"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "c50:green:wan"; + gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>; + }; + + wan_orange { + label = "c50:orange:wan"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + }; + + wlan5g { + label = "c50:green:wlan5g"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "c50:green:wlan2g"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "c50:green:wps"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "ephy", "spi refclk", "mdio", "wdt", "nd_sd"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + mtd-mac-address = <&rom 0xf100>; + mediatek,portmap = "wllll"; + }; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&radio 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&radio 32768>; + mediatek,2ghz = <0>; + mtd-mac-address = <&rom 0xf100>; + mtd-mac-address-increment = <(-1)>; + }; + }; +}; diff --git a/target/linux/ramips/dts/ArcherMR200.dts b/target/linux/ramips/dts/ArcherMR200.dts new file mode 100644 index 0000000000..93fb048d49 --- /dev/null +++ b/target/linux/ramips/dts/ArcherMR200.dts @@ -0,0 +1,195 @@ +/dts-v1/; + +#include "mt7620a.dtsi" +#include +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "TP-Link Archer MR200"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan { + label = "mr200:white:lan"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "mr200:white:wan"; + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; + + power { + label = "mr200:white:power"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + + 4g { + label = "mr200:white:4g"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "mr200:white:wps"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + + signal1 { + label = "mr200:white:signal1"; + gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + }; + + signal2 { + label = "mr200:white:signal2"; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + }; + + signal3 { + label = "mr200:white:signal3"; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + }; + + signal4 { + label = "mr200:white:signal4"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "mr200:white:wlan"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + reset { + label = "reset"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + power_usb { + gpio-export,name = "power_usb1"; + gpio-export,output = <1>; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + }; + +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7b0000>; + }; + + 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; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd", "ephy", "spi refclk"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&rom 0xf100>; + mediatek,portmap = "llll"; + }; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&radio 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&radio 32768>; + mediatek,2ghz = <0>; + }; + }; +}; diff --git a/target/linux/ramips/dts/BC2.dts b/target/linux/ramips/dts/BC2.dts new file mode 100644 index 0000000000..55cf8964f3 --- /dev/null +++ b/target/linux/ramips/dts/BC2.dts @@ -0,0 +1,89 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "BC2", "ralink,rt3052-soc"; + model = "NexAira BC2"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "bc2:blue:usb"; + gpios = <&gpio0 20 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 17 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/BR-6425.dts b/target/linux/ramips/dts/BR-6425.dts new file mode 100644 index 0000000000..1e13c97ada --- /dev/null +++ b/target/linux/ramips/dts/BR-6425.dts @@ -0,0 +1,73 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "BR-6425", "ralink,rt3052-soc"; + model = "Edimax BR-6425"; + + cfi@1f000000 { + compatible = "cfi-flash"; + reg = <0x1f000000 0x800000>; + bank-width = <2>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "br-6425:green:power"; + gpios = <&gpio0 9 1>; + }; + + wlan { + label = "br-6425:orange:wlan"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + rfkill { + label = "RFKILL switch"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { +/* mtd-mac-address = <&factory 0x4>; */ +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { +/* ralink,mtd-eeprom = <&factory 0>; */ +}; diff --git a/target/linux/ramips/dts/BR-6475ND.dts b/target/linux/ramips/dts/BR-6475ND.dts new file mode 100644 index 0000000000..a93b8177be --- /dev/null +++ b/target/linux/ramips/dts/BR-6475ND.dts @@ -0,0 +1,178 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "BR-6475ND", "ralink,rt3883-soc"; + model = "Edimax BR-6475nD"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 9 1>; + linux,input-type = ; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "br-6475nd:green:power"; + gpios = <&gpio0 10 1>; + }; + + wlan { + label = "br-6475nd:amber:wlan"; + gpios = <&gpio0 11 1>; + }; + + wlan_5ghz { + label = "br-6475nd:amber:wlan_5ghz"; + gpios = <&gpio0 14 1>; + }; + }; + + nor-flash@1c000000 { + 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; + }; + + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "nvram"; + read-only; + }; + + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + devdata: partition@50000 { + reg = <0x00050000 0x00020000>; + label = "devdata"; + read-only; + }; + + partition@70000 { + reg = <0x00070000 0x00790000>; + label = "firmware"; + }; + }; + + rtl8367 { + compatible = "realtek,rtl8367"; + gpio-sda = <&gpio0 5 0>; + gpio-sck = <&gpio0 4 0>; + 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. */ + /* + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name="usb"; + gpio-export,output=<0>; + gpios = <&gpio0 19 0>; + }; + }; + */ +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&timer { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&uartlite { + status = "okay"; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&devdata 0x0d>; + + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0>; +}; + +&pci { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pci_pins>; + + pci_pins: pci { + pci { + ralink,group = "pci"; + ralink,function = "pci-fnc"; + }; + }; + + 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>; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/BROADWAY.dts b/target/linux/ramips/dts/BROADWAY.dts new file mode 100644 index 0000000000..6cfac0f988 --- /dev/null +++ b/target/linux/ramips/dts/BROADWAY.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "BROADWAY", "ralink,rt3052-soc"; + model = "Hauppauge Broadway"; + + 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; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + diskmounted { + label = "broadway:red:diskmounted"; + gpios = <&gpio0 9 1>; + }; + + wps_active { + label = "broadway:red:wps_active"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + factory { + label = "Factory Reset button"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/CARAMBOLA.dts b/target/linux/ramips/dts/CARAMBOLA.dts new file mode 100644 index 0000000000..e38c49f957 --- /dev/null +++ b/target/linux/ramips/dts/CARAMBOLA.dts @@ -0,0 +1,75 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +/ { + compatible = "CARAMBOLA", "ralink,rt3050-soc"; + model = "8devices Carambola"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + i2c-gpio { + compatible = "i2c-gpio"; + gpios = <&gpio0 1 0 &gpio0 2 0>; + i2c-gpio,delay-us = <10>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/CF-WR800N.dts b/target/linux/ramips/dts/CF-WR800N.dts new file mode 100644 index 0000000000..6ce4b27301 --- /dev/null +++ b/target/linux/ramips/dts/CF-WR800N.dts @@ -0,0 +1,115 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "cf-wr800n", "ralink,mt7620n-soc"; + model = "Comfast CF-WR800N"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + ethernet { + label = "cf-wr800n:white:ethernet"; + gpios = <&gpio2 4 1>; + }; + + wifi { + label = "cf-wr800n:white:wifi"; + gpios = <&gpio3 0 1>; + }; + + wps { + label = "cf-wr800n:white:wps"; + gpios = <&gpio1 15 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "wled", "spi refclk", "i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/CS-QR10.dts b/target/linux/ramips/dts/CS-QR10.dts new file mode 100644 index 0000000000..bdd828fe8f --- /dev/null +++ b/target/linux/ramips/dts/CS-QR10.dts @@ -0,0 +1,163 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Planex CS-QR10"; + + sound { + compatible = "mediatek,mt7620-audio-wm8960"; + model = "mt7620-wm8960"; + i2s-controller = <&i2s>; + audio-routing = + "Ext Spk", "SPK_LP", + "Ext Spk", "SPK_LN", + "Ext Spk", "SPK_RP", + "Ext Spk", "SPK_RN"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "cs-qr10:red:power"; + gpios = <&gpio1 4 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + s1 { + label = "reset"; + gpios = <&gpio1 1 1>; + linux,code = ; + }; + + s2 { + label = "wps"; + gpios = <&gpio1 3 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +&i2s { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pcm_i2s_pins>; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pcm { + status = "okay"; +}; + +&gdma { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi refclk", "rgmii1"; + ralink,function = "gpio"; + }; + wdt { + ralink,group = "wdt"; + ralink,function = "wdt refclk"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&gsw { + ralink,port4 = "ephy"; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/CY-SWR1100.dts b/target/linux/ramips/dts/CY-SWR1100.dts new file mode 100644 index 0000000000..e772279525 --- /dev/null +++ b/target/linux/ramips/dts/CY-SWR1100.dts @@ -0,0 +1,152 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "CY-SWR1100", "ralink,rt3883-soc"; + model = "Samsung CY-SWR1100"; + + 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; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x4000>; + read-only; + }; + + factory: partition@34000 { + label = "factory"; + reg = <0x34000 0x4000>; + read-only; + }; + + partition@38000 { + label = "nvram"; + reg = <0x38000 0x8000>; + read-only; + }; + + partition@40000 { + label = "devdata"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + + rtl8367 { + compatible = "realtek,rtl8367"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + realtek,extif0 = <1 0 1 1 1 1 1 1 2>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio0 6 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 3 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "cy-swr1100:blue:wps"; + gpios = <&gpio0 0 1>; + }; + + usb { + label = "cy-swr1100:blue:usb"; + gpios = <&gpio1 1 1>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + phy-mode = "rgmii"; + }; +}; + +&pci { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pci_pins>; + + pci_pins: pci { + pci { + ralink,group = "pci"; + ralink,function = "pci-fnc"; + }; + }; + + 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>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,2ghz = <0>; + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/D105.dts b/target/linux/ramips/dts/D105.dts new file mode 100644 index 0000000000..f7ace49f62 --- /dev/null +++ b/target/linux/ramips/dts/D105.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "D105", "ralink,rt3050-soc"; + model = "Huawei D105"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "d105:red:power"; + gpios = <&gpio0 0 1>; + }; + + wps { + label = "d105:green:usb"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DAP-1350.dts b/target/linux/ramips/dts/DAP-1350.dts new file mode 100644 index 0000000000..c3225db952 --- /dev/null +++ b/target/linux/ramips/dts/DAP-1350.dts @@ -0,0 +1,127 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "DAP-1350", "ralink,rt3052-soc"; + model = "D-Link DAP-1350"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + 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; + }; + + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "devconf"; + reg = <0x40000 0x30000>; + read-only; + }; + + partition@70000 { + label = "devlang"; + reg = <0x70000 0x40000>; + read-only; + }; + + partition@b0000 { + label = "firmware"; + reg = <0xb0000 0x750000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "dap-1350:blue:power"; + gpios = <&gpio0 8 1>; + }; + + power2 { + label = "dap-1350:red:power"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "dap-1350:blue:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + rt { + label = "rt"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + ap { + label = "ap"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devdata 0x2e>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&devdata 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DB-WRT01.dts b/target/linux/ramips/dts/DB-WRT01.dts new file mode 100644 index 0000000000..400c5ef51b --- /dev/null +++ b/target/linux/ramips/dts/DB-WRT01.dts @@ -0,0 +1,100 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Planex DB-WRT01"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "db-wrt01:orange:power"; + gpios = <&gpio1 1 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + s1 { + label = "wps"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi refclk", "rgmii1"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DCH-M225.dts b/target/linux/ramips/dts/DCH-M225.dts new file mode 100644 index 0000000000..21133a9b88 --- /dev/null +++ b/target/linux/ramips/dts/DCH-M225.dts @@ -0,0 +1,186 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "dlink,dch-m225", "ralink,mt7620a-soc"; + model = "D-Link DCH-M225"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio1 2 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "dch-m225:green:power"; + gpios = <&gpio1 5 1>; + }; + + status { + label = "dch-m225:red:status"; + gpios = <&gpio1 0 1>; + }; + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "Audio-I2S"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&dailink0_master>; + simple-audio-card,frame-master = <&dailink0_master>; + simple-audio-card,widgets = + "Headphone", "Headphones"; + simple-audio-card,routing = + "Headphones", "HP_L", + "Headphones", "HP_R"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio0 14 1>; + + simple-audio-card,cpu { + sound-dai = <&i2s>; + }; + + dailink0_master: simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c { + status = "okay"; + + codec: wm8960@1a { + #sound-dai-cells = <0>; + compatible = "wlf,wm8960"; + reg = <0x1a>; + + wlf,shared-lrclk; + }; +}; + +&i2s { + #sound-dai-cells = <0>; + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_i2s_pins>, <&wm8960_mclk_pins>; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <80000000>; + m25p,fast-read; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x4000>; + read-only; + }; + + factory: partition@34000 { + label = "factory"; + reg = <0x34000 0x4000>; + read-only; + }; + + nvram: partition@38000 { + label = "nvram"; + reg = <0x38000 0x8000>; + read-only; + }; + + partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "upgrade_rec"; + reg = <0x50000 0x100000>; + read-only; + }; + + partition@150000 { + label = "firmware"; + reg = <0x150000 0x6b0000>; + }; + }; +}; + +&gdma { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii1"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + + wm8960_mclk_pins: wm8960_mclk { + wm8960_mclk { + ralink,group = "mdio"; + ralink,function = "refclk"; + }; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&gsw { + ralink,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + diff --git a/target/linux/ramips/dts/DCS-930.dts b/target/linux/ramips/dts/DCS-930.dts new file mode 100644 index 0000000000..d57682ec7b --- /dev/null +++ b/target/linux/ramips/dts/DCS-930.dts @@ -0,0 +1,115 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "DCS-930", "ralink,rt3050-soc"; + model = "D-Link DCS-930"; + + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "kernel"; + reg = <0x50000 0x150000>; + }; + + partition@150000 { + label = "rootfs"; + reg = <0x150000 0x2b0000>; + }; + + partition { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "dcs-930:red:alert"; + gpios = <&gpio0 8 1>; + }; + + power { + label = "dcs-930:green:status"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "dcs-930:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "jtag", "mdio", "rgmii", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DCS-930L-B1.dts b/target/linux/ramips/dts/DCS-930L-B1.dts new file mode 100644 index 0000000000..17996d2358 --- /dev/null +++ b/target/linux/ramips/dts/DCS-930L-B1.dts @@ -0,0 +1,108 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "DCS-930L-B1", "ralink,rt5350-soc"; + model = "D-Link DCS-930L B1"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "dcs-930l-b1:red:power"; + gpios = <&gpio0 17 1>; + }; + + wps { + label = "dcs-930l-b1:blue:wps"; + gpios = <&gpio0 19 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 20 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf", "led"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DIR-300-B1.dts b/target/linux/ramips/dts/DIR-300-B1.dts new file mode 100644 index 0000000000..2ba6ae64c6 --- /dev/null +++ b/target/linux/ramips/dts/DIR-300-B1.dts @@ -0,0 +1,111 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "DIR-300-B1", "ralink,rt3050-soc"; + model = "D-Link DIR-300 B1"; + + 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; + }; + + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-300-b1:amber:status"; + gpios = <&gpio0 8 1>; + }; + + status2 { + label = "dir-300-b1:green:status"; + gpios = <&gpio0 9 1>; + }; + + wan { + label = "dir-300-b1:amber:wan"; + gpios = <&gpio0 14 1>; + }; + + wan2 { + label = "dir-300-b1:green:wan"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "dir-300-b1:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "jtag", "mdio", "rgmii", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devdata 0x4004>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&devdata 0x4000>; +}; diff --git a/target/linux/ramips/dts/DIR-300-B7.dts b/target/linux/ramips/dts/DIR-300-B7.dts new file mode 100644 index 0000000000..fb93f5d646 --- /dev/null +++ b/target/linux/ramips/dts/DIR-300-B7.dts @@ -0,0 +1,103 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "DIR-300-B7", "ralink,rt5350-soc"; + model = "D-Link DIR-300 B7"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-300-b7:green:status"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "dir-300-b7:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <0x17>; +}; + +&wmac { + status = "okay"; + ralink,led-polarity = <1>; + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/DIR-320-B1.dts b/target/linux/ramips/dts/DIR-320-B1.dts new file mode 100644 index 0000000000..2335c9a391 --- /dev/null +++ b/target/linux/ramips/dts/DIR-320-B1.dts @@ -0,0 +1,131 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "DIR-320-B1", "ralink,rt5350-soc"; + model = "D-Link DIR-320 B1"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-320-b1:green:status"; + gpios = <&gpio0 9 1>; + }; + + usb { + label = "dir-320-b1:green:usb"; + gpios = <&gpio0 14 1>; + }; + + wps { + label = "dir-320-b1:green:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 7 0>; + }; + + root_hub { + gpio-export,name = "root_hub"; + gpio-export,output = <1>; + gpios = <&gpio0 12 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <0x17>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DIR-600-B1.dts b/target/linux/ramips/dts/DIR-600-B1.dts new file mode 100644 index 0000000000..493d49bb73 --- /dev/null +++ b/target/linux/ramips/dts/DIR-600-B1.dts @@ -0,0 +1,111 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "DIR-600-B1", "ralink,rt3050-soc"; + model = "D-Link DIR-600 B1"; + + 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; + }; + + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-600-b1:amber:status"; + gpios = <&gpio0 8 1>; + }; + + status2 { + label = "dir-600-b1:green:status"; + gpios = <&gpio0 9 1>; + }; + + wan { + label = "dir-600-b1:amber:wan"; + gpios = <&gpio0 14 1>; + }; + + wan2 { + label = "dir-600-b1:green:wan"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "dir-600-b1:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "jtag", "mdio", "rgmii", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devdata 0x4004>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&devdata 0x4000>; +}; diff --git a/target/linux/ramips/dts/DIR-610-A1.dts b/target/linux/ramips/dts/DIR-610-A1.dts new file mode 100644 index 0000000000..e69997f474 --- /dev/null +++ b/target/linux/ramips/dts/DIR-610-A1.dts @@ -0,0 +1,104 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "DIR-610-A1", "ralink,rt5350-soc"; + model = "D-Link DIR-610 A1"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-610-a1:green:status"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "dir-610-a1:green:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devdata 0x4004>; +}; + +&esw { + status = "okay"; + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <0x17>; +}; + +&wmac { + status = "okay"; + ralink,led-polarity = <1>; + ralink,mtd-eeprom = <&devdata 0x4000>; +}; diff --git a/target/linux/ramips/dts/DIR-615-D.dts b/target/linux/ramips/dts/DIR-615-D.dts new file mode 100644 index 0000000000..67705fe3ce --- /dev/null +++ b/target/linux/ramips/dts/DIR-615-D.dts @@ -0,0 +1,109 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "DIR-615-D", "ralink,rt3050-soc"; + model = "D-Link DIR-615 D"; + + 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; + }; + + devdata: partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-615-d:amber:status"; + gpios = <&gpio0 8 1>; + }; + + status2 { + label = "dir-615-d:green:status"; + gpios = <&gpio0 9 1>; + }; + + wan { + label = "dir-615-d:amber:wan"; + gpios = <&gpio0 14 1>; + }; + + wan2 { + label = "dir-615-d:green:wan"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "dir-615-d:blue:wps"; + gpios = <&gpio0 13 1>; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&devdata 0x4000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "jtag", "mdio", "rgmii", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + + diff --git a/target/linux/ramips/dts/DIR-615-H1.dts b/target/linux/ramips/dts/DIR-615-H1.dts new file mode 100644 index 0000000000..9fbd7356c4 --- /dev/null +++ b/target/linux/ramips/dts/DIR-615-H1.dts @@ -0,0 +1,125 @@ +/dts-v1/; + +#include "rt3352.dtsi" + +#include + +/ { + compatible = "DIR-615-H1", "ralink,rt3352-soc"; + model = "D-Link DIR-615 H1"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-615-h1:amber:status"; + gpios = <&gpio0 7 0>; + }; + + status2 { + label = "dir-615-h1:green:status"; + gpios = <&gpio0 9 0>; + }; + + wan { + label = "dir-615-h1:amber:wan"; + gpios = <&gpio0 12 1>; + }; + + wan2 { + label = "dir-615-h1:green:wan"; + gpios = <&gpio0 13 1>; + }; + + wps { + label = "dir-615-h1:blue:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + + rgmii { + ralink,group = "rgmii"; + ralink,function = "rgmii"; + }; + + mdio { + ralink,group = "mdio"; + ralink,function = "mdio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/DIR-620-A1.dts b/target/linux/ramips/dts/DIR-620-A1.dts new file mode 100644 index 0000000000..50967b29c2 --- /dev/null +++ b/target/linux/ramips/dts/DIR-620-A1.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "DIR-620-A1", "ralink,rt3050-soc"; + model = "D-Link DIR-620 A1"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-620-a1:amber:status"; + gpios = <&gpio0 8 1>; + }; + + status2 { + label = "dir-620-a1:green:status"; + gpios = <&gpio0 9 1>; + }; + + wan { + label = "dir-620-a1:amber:wan"; + gpios = <&gpio0 14 1>; + }; + + wan2 { + label = "dir-620-a1:green:wan"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "dir-620-a1:blue:wps"; + gpios = <&gpio0 13 0>; + }; + + wps2 { + label = "dir-620-a1:amber:wps"; + gpios = <&gpio0 11 0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DIR-620-D1.dts b/target/linux/ramips/dts/DIR-620-D1.dts new file mode 100644 index 0000000000..1bdcaffb4a --- /dev/null +++ b/target/linux/ramips/dts/DIR-620-D1.dts @@ -0,0 +1,112 @@ +/dts-v1/; + +#include "rt3352.dtsi" + +#include + +/ { + compatible = "DIR-620-D1", "ralink,rt3352-soc"; + model = "D-Link DIR-620 D1"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "dir-620-d1:green:status"; + gpios = <&gpio0 9 1>; + }; + + wifi { + label = "dir-620-d1:green:wifi"; + gpios = <&gpio0 17 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + + rgmii { + ralink,group = "rgmii"; + ralink,function = "rgmii"; + }; + + mdio { + ralink,group = "mdio"; + ralink,function = "mdio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DIR-645.dts b/target/linux/ramips/dts/DIR-645.dts new file mode 100644 index 0000000000..30eccaf5f5 --- /dev/null +++ b/target/linux/ramips/dts/DIR-645.dts @@ -0,0 +1,142 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "DIR-645", "ralink,rt3883-soc"; + model = "D-Link DIR-645"; + + rtl8367b { + compatible = "realtek,rtl8367b"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + realtek,extif1 = <1 0 1 1 1 1 1 1 2>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio0 9 0>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 14 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + inet { + label = "dir-645:green:inet"; + gpios = <&gpio0 0 1>; + }; + + wps { + label = "dir-645:green:wps"; + gpios = <&gpio1 2 0>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio1 6 0>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <25000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x4000>; + read-only; + }; + + factory: partition@34000 { + label = "factory"; + reg = <0x34000 0x4000>; + read-only; + }; + + partition@38000 { + label = "nvram"; + reg = <0x38000 0x8000>; + read-only; + }; + + partition@40000 { + label = "devdata"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + + port@0 { + mediatek,fixed-link = <1000 1 1 0>; + }; +}; + +&wmac { + ralink,5ghz = <0>; + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/DIR-810L.dts b/target/linux/ramips/dts/DIR-810L.dts new file mode 100644 index 0000000000..4ccea0d45b --- /dev/null +++ b/target/linux/ramips/dts/DIR-810L.dts @@ -0,0 +1,136 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "dlink,dir-810l", "ralink,mt7620a-soc"; + model = "D-Link DIR-810L"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "dir-810l:green:power"; + gpios = <&gpio0 9 0>; + }; + + wan { + label = "dir-810l:orange:wan"; + gpios = <&gpio0 12 0>; + }; + + status { + label = "dir-810l:orange:power"; + gpios = <&gpio0 13 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + 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; + }; + + factory5g: partition@50000 { + label = "factory5g"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "Wolf_Config"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "MyDlink"; + reg = <0x70000 0x80000>; + read-only; + }; + + partition@e0000 { + label = "Jffs2"; + reg = <0xe0000 0x80000>; + read-only; + }; + + partition@170000 { + label = "firmware"; + reg = <0x170000 0x690000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "mdio", "rgmii1", "i2c", "wled", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; +}; + +&pcie { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/DIR-860L-B1.dts b/target/linux/ramips/dts/DIR-860L-B1.dts new file mode 100644 index 0000000000..98c9d8a0bb --- /dev/null +++ b/target/linux/ramips/dts/DIR-860L-B1.dts @@ -0,0 +1,140 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "D-Link DIR-860L B1"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "dir-860l-b1:orange:power"; + gpios = <&gpio0 13 1>; + }; + + power2 { + label = "dir-860l-b1:green:power"; + gpios = <&gpio0 15 1>; + }; + + net { + label = "dir-860l-b1:orange:net"; + gpios = <&gpio0 14 1>; + }; + + net2 { + label = "dir-860l-b1:green:net"; + gpios = <&gpio0 16 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + }; +}; + +&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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x4000>; + read-only; + }; + + radio: partition@34000 { + label = "radio"; + reg = <0x34000 0x4000>; + read-only; + }; + + factory: partition@38000 { + label = "factory"; + reg = <0x38000 0x8000>; + read-only; + }; + + 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>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&radio 0>; + mediatek,5ghz = <0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/DUZUN-DM06.dts b/target/linux/ramips/dts/DUZUN-DM06.dts new file mode 100644 index 0000000000..5715791a68 --- /dev/null +++ b/target/linux/ramips/dts/DUZUN-DM06.dts @@ -0,0 +1,157 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include + +/ { + compatible = "duzun,dm06-mt7628an", "mediatek,mt7628an-soc"; + model = "DuZun DM06"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio1 14 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 6 1>; + linux,code = ; + }; + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "Audio-I2S"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&dailink0_master>; + simple-audio-card,frame-master = <&dailink0_master>; + simple-audio-card,widgets = + "Headphone", "Headphones"; + simple-audio-card,routing = + "Headphones", "HP_L", + "Headphones", "HP_R"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s>; + }; + + dailink0_master: simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "uart1"; + ralink,function = "gpio"; + }; + }; + + i2s_pins: i2s { + i2s { + ralink,group = "i2s"; + ralink,function = "i2s"; + }; + }; + + wm8960_mclk_pins: wm8960_mclk { + wm8960_mclk { + ralink,group = "refclk"; + ralink,function = "reclk"; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c { + status = "okay"; + + codec: wm8960@1a { + #sound-dai-cells = <0>; + compatible = "wlf,wm8960"; + reg = <0x1a>; + + wlf,shared-lrclk; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3>; + mediatek,portdisable = <0x3c>; +}; + +&i2s { + #sound-dai-cells = <0>; + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_pins>, <&wm8960_mclk_pins>; +}; + +&sdhci { + status = "okay"; +}; + +&gdma { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <60000000>; + m25p,chunked-io = <32>; + m25p,fast-read; + + 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 0x7b0000>; + }; + }; +}; diff --git a/target/linux/ramips/dts/DWR-512-B.dts b/target/linux/ramips/dts/DWR-512-B.dts new file mode 100644 index 0000000000..29e8eaf410 --- /dev/null +++ b/target/linux/ramips/dts/DWR-512-B.dts @@ -0,0 +1,141 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include +#include + +/ { + compatible = "ralink,rt5350-soc"; + model = "D-Link DWR-512 B"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + sms { + label = "dwr-512-b:green:sms"; + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; + status { + label = "dwr-512-b:green:status"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + }; + 2g { + label = "dwr-512-b:green:2g"; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + }; + 3g { + label = "dwr-512-b:green:3g"; + gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; + }; + sstrengthr { + label = "dwr-512-b:red:sigstrength"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + }; + sstrengthg { + label = "dwr-512-b:green:sigstrength"; + gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + modem3g_enable { + gpio-export,name = "modem3g_enable"; + gpio-export,output = <1>; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + 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 = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7a0000>; + }; + + config: partition@7f0000 { + label = "config"; + reg = <0x7f0000 0x10000>; + }; + }; +}; + +&spi1 { + status = "okay"; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "siliconlabs,si3210"; + + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +ðernet { + mtd-mac-address = <&config 0xe07e>; +}; + +&wmac { + ralink,mtd-eeprom = <&config 0xe08a>; + ralink,led-polarity = <1>; + mtd-mac-address = <&config 0xe07e>; +}; diff --git a/target/linux/ramips/dts/E1700.dts b/target/linux/ramips/dts/E1700.dts new file mode 100644 index 0000000000..050303a413 --- /dev/null +++ b/target/linux/ramips/dts/E1700.dts @@ -0,0 +1,154 @@ +/* + * Device Tree file for the Linksys E1700 + * + * Copyright (C) 2014 Imre Kaloz + * + * 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 + +/ { + compatible = "linksys,e1700", "ralink,mt7620a-soc"; + model = "Linksys E1700"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 0>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "e1700:green:power"; + gpios = <&gpio0 10 1>; + }; + + wan { + label = "e1700:green:wps"; + gpios = <&gpio0 12 1>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x28>; + 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"; + }; + + 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"; + mediatek,mt7530 = <1>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/ESR-9753.dts b/target/linux/ramips/dts/ESR-9753.dts new file mode 100644 index 0000000000..59a961d699 --- /dev/null +++ b/target/linux/ramips/dts/ESR-9753.dts @@ -0,0 +1,96 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "ESR-9753", "ralink,rt3052-soc"; + model = "Senao / EnGenius ESR-9753"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "esr-9753:orange:power"; + gpios = <&gpio0 8 1>; + }; + + wps { + label = "esr-9753:orange:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/EX2700.dts b/target/linux/ramips/dts/EX2700.dts new file mode 100644 index 0000000000..348ca789d1 --- /dev/null +++ b/target/linux/ramips/dts/EX2700.dts @@ -0,0 +1,147 @@ +/* + * Device Tree file for the Netgear EX2700 + * + * Copyright (C) 2016 Joseph C. Lehner + * + * 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 + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Netgear EX2700"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_g { + label = "ex2700:green:power"; + gpios = <&gpio0 9 1>; + default-state = "on"; + }; + + power_r { + label = "ex2700:red:power"; + gpios = <&gpio0 11 1>; + }; + + device_g { + label = "ex2700:green:device"; + gpios = <&gpio0 13 1>; + }; + + device_r { + label = "ex2700:red:device"; + gpios = <&gpio0 10 1>; + }; + + router_g { + label = "ex2700:green:router"; + gpios = <&gpio0 12 1>; + }; + + router_r { + label = "ex2700:red:router"; + gpios = <&gpio0 14 1>; + }; + + wps { + label = "ex2700:green:wps"; + gpios = <&gpio1 15 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x3b0000>; + }; + + art: partition@3f0000 { + label = "art"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; +}; + +ðernet { + mtd-mac-address = <&art 0x0>; +}; + +&wmac { + ralink,mtd-eeprom = <&art 0x1000>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + // spi refclk: pins 37, 38, 39 + // uartf: pins 8, 9, 10, 11, 12, 13, 14 + // i2c: pins 1, 2 + ralink,group = "i2c", "uartf", "spi refclk"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/F5D8235_V1.dts b/target/linux/ramips/dts/F5D8235_V1.dts new file mode 100644 index 0000000000..8fcf1f0a62 --- /dev/null +++ b/target/linux/ramips/dts/F5D8235_V1.dts @@ -0,0 +1,170 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "F5D8235_V1", "ralink,rt2880-soc"; + model = "Belkin F5D8235 v1"; + + pci@440000 { + status = "ok"; + }; + + cfi@1f000000 { + 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; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + + rtl8366s { + compatible = "realtek,rtl8366s"; + gpio-sda = <&gpio0 1 GPIO_ACTIVE_HIGH>; + gpio-sck = <&gpio0 2 GPIO_ACTIVE_HIGH>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + internet { + label = "f5d8235-v1:blue:internet"; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + }; + + internet2 { + label = "f5d8235-v1:amber:internet"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + }; + + modem { + label = "f5d8235-v1:blue:modem"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + }; + + modem2 { + label = "f5d8235-v1:amber:modem"; + gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + }; + + router { + label = "f5d8235-v1:blue:router"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + }; + + storage { + label = "f5d8235-v1:blue:storage"; + gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + }; + + storage2 { + label = "f5d8235-v1:amber:storage"; + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; + + security { + label = "f5d8235-v1:blue:security"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + }; + + security2 { + label = "f5d8235-v1:amber:security"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + + wired { + label = "f5d8235-v1:blue:wired"; + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + }; + + wired2 { + label = "f5d8235-v1:amber:wired"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + }; + + wireless { + label = "f5d8235-v1:blue:wireless"; + gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; + }; + + wireless2 { + label = "f5d8235-v1:amber:wireless"; + gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "mdio", "uartlite"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + }; +}; + +&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 new file mode 100644 index 0000000000..084ca0f25a --- /dev/null +++ b/target/linux/ramips/dts/F5D8235_V2.dts @@ -0,0 +1,118 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +/ { + compatible = "F5D8235_V2", "ralink,rt3052-soc"; + model = "Belkin F5D8235 v2"; + + 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; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x790000>; + }; + + partition@7e0000 { + label = "nvram"; + reg = <0x7e0000 0x10000>; + }; + + factory: partition@7f0000 { + label = "factory"; + reg = <0x7f0000 0x10000>; + }; + }; + + rtl8366rb { + compatible = "rtl8366rb"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + internet { + label = "f5d8235-v2:blue:internet"; + gpios = <&gpio0 5 1>; + }; + + internet2 { + label = "f5d8235-v2:amber:internet"; + gpios = <&gpio0 6 1>; + }; + + modem { + label = "f5d8235-v2:blue:modem"; + gpios = <&gpio0 11 1>; + }; + + modem2 { + label = "f5d8235-v2:amber:modem"; + gpios = <&gpio0 8 1>; + }; + + router { + label = "f5d8235-v2:blue:router"; + gpios = <&gpio0 9 1>; + }; + + storage { + label = "f5d8235-v2:blue:storage"; + gpios = <&gpio0 23 1>; + }; + + storage2 { + label = "f5d8235-v2:amber:storage"; + gpios = <&gpio0 22 1>; + }; + + security { + label = "f5d8235-v2:blue:security"; + gpios = <&gpio0 13 1>; + }; + + security2 { + label = "f5d8235-v2:amber:security"; + gpios = <&gpio0 12 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&uboot 0x40004>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&uboot 0x40000>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/F7C027.dts b/target/linux/ramips/dts/F7C027.dts new file mode 100644 index 0000000000..d6a150a4a7 --- /dev/null +++ b/target/linux/ramips/dts/F7C027.dts @@ -0,0 +1,133 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "F7C027", "ralink,rt5350-soc"; + model = "Belkin F7C027"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "f7c027:blue:status"; + gpios = <&gpio0 7 1>; + }; + + power { + label = "f7c027:blue:power"; + gpios = <&gpio0 9 1>; + }; + + orange { + label = "f7c027:orange:status"; + gpios = <&gpio0 11 1>; + }; + + relay { + label = "f7c027:device:relay"; + gpios = <&gpio0 13 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + top { + label = "restore"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + power { + label = "power"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + sensor { + label = "sensor"; + gpios = <&gpio0 14 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l12805d"; + spi-max-frequency = <10000000>; + + 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 0x770000>; + }; + + partition@7c0000 { + label = "firmware2"; + reg = <0x7c0000 0x770000>; + }; + + partition@f30000 { + label = "belkin_settings"; + reg = <0xf30000 0xa0000>; + }; + + partition@fd0000 { + label = "unknown"; + reg = <0xfd0000 0x10000>; + }; + + partition@fe0000 { + label = "nvram"; + reg = <0xfe0000 0x10000>; + }; + + partition@ff0000 { + label = "user_factory"; + reg = <0xff0000 0x10000>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/FIREWRT.dts b/target/linux/ramips/dts/FIREWRT.dts new file mode 100644 index 0000000000..1871de99be --- /dev/null +++ b/target/linux/ramips/dts/FIREWRT.dts @@ -0,0 +1,121 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Firefly FireWRT"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "firewrt:green:power"; + gpios = <&gpio0 22 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + + power { + label = "power"; + gpios = <&gpio0 23 1>; + linux,code = ; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&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; + }; + + 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>; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/FONERA20N.dts b/target/linux/ramips/dts/FONERA20N.dts new file mode 100644 index 0000000000..c409f9b01d --- /dev/null +++ b/target/linux/ramips/dts/FONERA20N.dts @@ -0,0 +1,136 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "FONERA20N", "ralink,rt3052-soc"; + model = "La Fonera 2.0N"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "fonera20n:orange:wifi"; + gpios = <&gpio0 7 1>; + }; + + power { + label = "fonera20n:green:power"; + gpios = <&gpio0 9 1>; + }; + + usb { + label = "fonera20n:orange:usb"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + switch { + label = "switch"; + gpios = <&gpio0 13 1>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi", "jtag", "mdio", "rgmii", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; + + port@0 { + compatible = "swconfig,port"; + swconfig,segment = "lan"; + swconfig,portmap = <0 4>; + }; + + port@1 { + compatible = "swconfig,port"; + swconfig,segment = "lan"; + swconfig,portmap = <1 3>; + }; + + port@2 { + compatible = "swconfig,port"; + swconfig,segment = "lan"; + swconfig,portmap = <2 2>; + }; + + port@3 { + compatible = "swconfig,port"; + swconfig,segment = "lan"; + swconfig,portmap = <3 1>; + }; + + port@4 { + compatible = "swconfig,port"; + swconfig,segment = "wan"; + swconfig,portmap = <4 0>; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/FREESTATION5.dts b/target/linux/ramips/dts/FREESTATION5.dts new file mode 100644 index 0000000000..425eb2adbe --- /dev/null +++ b/target/linux/ramips/dts/FREESTATION5.dts @@ -0,0 +1,102 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +/ { + compatible = "FREESTATION5", "ralink,rt3050-soc"; + model = "ARC FreeStation5"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + 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; + }; + + 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 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. + poe { + gpio-export,name = "poe-passthrough"; + gpio-export,output = <1>; // OUT_INIT_HIGH + gpios = <&gpio0 11 1>; // GPIO 11, ACTIVE_LOW + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + // 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 1>; + }; + + powerg { + label = "freestation5:unknown:powerg"; + gpios = <&gpio0 9 1>; + }; + + usb { + label = "freestation5:unknown:usb"; + gpios = <&gpio0 14 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x01>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/GL-MT300A.dts b/target/linux/ramips/dts/GL-MT300A.dts new file mode 100644 index 0000000000..6922b958db --- /dev/null +++ b/target/linux/ramips/dts/GL-MT300A.dts @@ -0,0 +1,164 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "GL-MT300A", "ralink,mt7620a-soc"; + model = "GL-MT300A"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "gl-mt300a:wan"; + gpios = <&gpio2 0 1>; + }; + + lan { + label = "gl-mt300a:lan"; + gpios = <&gpio2 1 1>; + }; + + wlan { + label = "gl-mt300a:wlan"; + gpios = <&gpio3 0 1>; + }; + + usb { + label = "gl-mt300a:usb"; + gpios = <&gpio0 7 1>; + }; + + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + + BTN_0 { + label = "BTN_0"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + BTN_1 { + label = "BTN_1"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q128"; + reg = <0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + 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 0xf80000>; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4000>; + ralink,port-map = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wled","ephy","uartf","i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/GL-MT300N.dts b/target/linux/ramips/dts/GL-MT300N.dts new file mode 100644 index 0000000000..c6feb96f89 --- /dev/null +++ b/target/linux/ramips/dts/GL-MT300N.dts @@ -0,0 +1,153 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "GL-MT300N", "ralink,mt7620a-soc"; + model = "GL-MT300N"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "gl-mt300n:wan"; + gpios = <&gpio2 0 1>; + }; + + lan { + label = "gl-mt300n:lan"; + gpios = <&gpio2 1 1>; + }; + + wlan { + label = "gl-mt300n:wlan"; + gpios = <&gpio3 0 1>; + }; + + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + BTN_0 { + label = "BTN_0"; + gpios = <&gpio2 2 1>; + linux,code = ; + }; + + BTN_1 { + label = "BTN_1"; + gpios = <&gpio2 3 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q128"; + reg = <0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + 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 0xf80000>; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4000>; + ralink,port-map = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wled","ephy","i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/GL-MT750.dts b/target/linux/ramips/dts/GL-MT750.dts new file mode 100644 index 0000000000..46679842bc --- /dev/null +++ b/target/linux/ramips/dts/GL-MT750.dts @@ -0,0 +1,159 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "GL-MT750", "ralink,mt7620a-soc"; + model = "GL-MT750"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "gl-mt750:wan"; + gpios = <&gpio2 0 1>; + }; + + lan { + label = "gl-mt750:lan"; + gpios = <&gpio2 1 1>; + }; + + wlan { + label = "gl-mt750:wlan"; + gpios = <&gpio3 0 1>; + }; + + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + + BTN_0 { + label = "BTN_0"; + gpios = <&gpio2 2 1>; + linux,code = ; + }; + + BTN_1 { + label = "BTN_1"; + gpios = <&gpio2 3 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q128"; + reg = <0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + 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 0xf80000>; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4000>; + ralink,port-map = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wled","ephy","uartf"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/HC5661.dts b/target/linux/ramips/dts/HC5661.dts new file mode 100644 index 0000000000..eb1df345ed --- /dev/null +++ b/target/linux/ramips/dts/HC5661.dts @@ -0,0 +1,32 @@ +/dts-v1/; + +#include "HC5XXX.dtsi" + +/ { + compatible = "HC5661", "ralink,mt7620a-soc"; + model = "HiWiFi HC5661"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "hc5661:blue:system"; + gpios = <&gpio0 9 1>; + }; + + internet { + label = "hc5661:blue:internet"; + gpios = <&gpio0 11 1>; + }; + + wlan2g { + label = "hc5661:blue:wlan2g"; + gpios = <&gpio3 0 1>; + }; + + wlan5g { + label = "hc5661:blue:wlan5g"; + gpios = <&gpio0 7 1>; + }; + }; +}; diff --git a/target/linux/ramips/dts/HC5761.dts b/target/linux/ramips/dts/HC5761.dts new file mode 100644 index 0000000000..6b0554a054 --- /dev/null +++ b/target/linux/ramips/dts/HC5761.dts @@ -0,0 +1,32 @@ +/dts-v1/; + +#include "HC5XXX.dtsi" + +/ { + compatible = "HC5761", "ralink,mt7620a-soc"; + model = "HiWiFi HC5761"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "hc5761:blue:system"; + gpios = <&gpio0 9 1>; + }; + + internet { + label = "hc5761:blue:internet"; + gpios = <&gpio0 11 1>; + }; + + wlan2g { + label = "hc5761:blue:wlan2g"; + gpios = <&gpio3 0 1>; + }; + + wlan5g { + label = "hc5761:blue:wlan5g"; + gpios = <&gpio0 7 1>; + }; + }; +}; diff --git a/target/linux/ramips/dts/HC5861.dts b/target/linux/ramips/dts/HC5861.dts new file mode 100644 index 0000000000..3e812f691d --- /dev/null +++ b/target/linux/ramips/dts/HC5861.dts @@ -0,0 +1,92 @@ +/dts-v1/; + +#include "HC5XXX.dtsi" + +/ { + compatible = "HC5861", "ralink,mt7620a-soc"; + model = "HiWiFi HC5861"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "hc5861:blue:system"; + gpios = <&gpio0 9 1>; + }; + + wlan2g { + label = "hc5861:blue:wlan2g"; + gpios = <&gpio0 11 1>; + }; + + internet { + label = "hc5861:blue:internet"; + gpios = <&gpio3 0 1>; + }; + + wlan5g { + label = "hc5861:blue:wlan5g"; + gpios = <&gpio0 7 1>; + }; + + turbo { + label = "hc5861:blue:turbo"; + gpios = <&gpio0 10 1>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <0>; + gpios = <&gpio0 13 0>; + }; + + sdpower { + gpio-export,name = "sdpower"; + gpio-export,output = <0>; + gpios = <&gpio0 8 0>; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "wllll"; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; diff --git a/target/linux/ramips/dts/HC5XXX.dtsi b/target/linux/ramips/dts/HC5XXX.dtsi new file mode 100644 index 0000000000..54bf40936e --- /dev/null +++ b/target/linux/ramips/dts/HC5XXX.dtsi @@ -0,0 +1,141 @@ +#include "mt7620a.dtsi" + +#include + +/ { + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio0 13 0>; + }; + }; +}; + +&sysc { + ralink,gpiomux = "i2c", "jtag"; + ralink,uartmux = "gpio"; + ralink,wdtmux = <1>; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + 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>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@fd0000 { + label = "hwf_config"; + reg = <0xfd0000 0x10000>; + }; + + bdinfo: partition@fe0000 { + label = "bdinfo"; + reg = <0xfe0000 0x10000>; + }; + + partition@ff0000 { + label = "backup"; + reg = <0xff0000 0x10000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&sdhci { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uartf", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; diff --git a/target/linux/ramips/dts/HG255D.dts b/target/linux/ramips/dts/HG255D.dts new file mode 100644 index 0000000000..91426db3c9 --- /dev/null +++ b/target/linux/ramips/dts/HG255D.dts @@ -0,0 +1,132 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "HG255D", "ralink,rt3052-soc"; + model = "HuaWei HG255D"; + + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x40000 0x20000>; + read-only; + }; + + factory: partition@60000 { + label = "factory"; + reg = <0x60000 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 { + label = "hg255d:green:power"; + gpios = <&gpio0 8 1>; + }; + + internet { + label = "hg255d:green:internet"; + gpios = <&gpio0 13 1>; + }; + + wifi { + label = "hg255d:green:wlan"; + gpios = <&gpio0 14 1>; + }; + + usb { + label = "hg255d:green:usb"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "hg255d:green:wps"; + gpios = <&gpio0 12 1>; + }; + + voice { + label = "hg255d:green:voice"; + gpios = <&gpio0 5 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <10>; + + reset { + label = "reset"; + gpios = <&gpio0 4 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/HLKRM04.dts b/target/linux/ramips/dts/HLKRM04.dts new file mode 100644 index 0000000000..cbd860967a --- /dev/null +++ b/target/linux/ramips/dts/HLKRM04.dts @@ -0,0 +1,125 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "HLKRM04", "ralink,rt5350-soc"; + model = "HILINK HLK-RM04"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x1000000>; + }; + + chosen { + bootargs = "console=ttyS1,57600"; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + /* I2C */ + gpio1 { + /* I2C_I2C_SD */ + gpio-export,name = "hlk-rm04:gpio0"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 1 0>; + }; + gpio2 { + /* I2C_I2C_SCLK */ + gpio-export,name = "hlk-rm04:gpio1"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 2 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio0 14 1>; + linux,code = ; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag"; + ralink,function = "gpio"; + }; + + uartf_gpio { + ralink,group = "uartf"; + ralink,function = "gpio uartf"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/HPM.dts b/target/linux/ramips/dts/HPM.dts new file mode 100644 index 0000000000..ada12c1cf4 --- /dev/null +++ b/target/linux/ramips/dts/HPM.dts @@ -0,0 +1,149 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "HPM", "ralink,rt3883-soc"; + model = "Omnima HPM"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio0 14 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "hpm:orange:power"; + gpios = <&gpio0 7 1>; + }; + + status { + label = "hpm:green:status"; + gpios = <&gpio0 21 1>; + }; + + eth { + label = "hpm:green:eth"; + gpios = <&gpio0 20 1>; + }; + + eth2 { + label = "hpm:red:eth"; + gpios = <&gpio0 18 1>; + }; + + wifi { + label = "hpm:green:wifi"; + gpios = <&gpio0 17 1>; + }; + + wifi2 { + label = "hpm:red:wifi"; + gpios = <&gpio0 19 1>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + /* gpio 12 and 13 handle the OC input */ + + usb0 { + gpio-export,name = "usb0"; + gpio-export,output = <1>; + gpios = <&gpio0 2 0>; + }; + + usb1 { + gpio-export,name = "usb1"; + gpio-export,output = <1>; + gpios = <&gpio0 1 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + 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; + }; + + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "config"; + read-only; + }; + + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x00fb0000>; + label = "firmware"; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + phy-handle = <&phy0>; + phy-mode = "rgmii"; + mtd-mac-address = <&factory 0x28>; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@4 { + reg = <4>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/HT-TM02.dts b/target/linux/ramips/dts/HT-TM02.dts new file mode 100644 index 0000000000..8dc2dbc524 --- /dev/null +++ b/target/linux/ramips/dts/HT-TM02.dts @@ -0,0 +1,114 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "HT-TM02", "ralink,rt5350-soc"; + model = "HooToo HT-TM02"; + + gpio-leds { + compatible = "gpio-leds"; + + wlan { + label = "ht-tm02:blue:wlan"; + gpios = <&gpio0 7 1>; + }; + + lan { + label = "ht-tm02:green:lan"; + gpios = <&gpio0 12 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + modeswitch { + label = "modeswitch"; + gpios = <&gpio0 14 1>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x10>; + mediatek,portdisable = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/HW550-3G.dts b/target/linux/ramips/dts/HW550-3G.dts new file mode 100644 index 0000000000..d5bca44f94 --- /dev/null +++ b/target/linux/ramips/dts/HW550-3G.dts @@ -0,0 +1,116 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "HW550-3G", "ralink,rt3052-soc"; + model = "Aztech HW550-3G"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "hw550-3g:green:usb"; + gpios = <&gpio0 8 1>; + }; + + 3g { + label = "hw550-3g:green:3g"; + gpios = <&gpio0 11 1>; + }; + + status { + label = "hw550-3g:green:status"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "hw550-3g:green:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + connect { + label = "connect"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/IP2202.dts b/target/linux/ramips/dts/IP2202.dts new file mode 100644 index 0000000000..6f26f3b50a --- /dev/null +++ b/target/linux/ramips/dts/IP2202.dts @@ -0,0 +1,90 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "IP2202", "ralink,rt3052-soc"; + model = "Poray IP2202"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + run { + label = "ip2202:green:run"; + gpios = <&gpio0 9 1>; + }; + + net { + label = "ip2202:amber:net"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/JHR-N805R.dts b/target/linux/ramips/dts/JHR-N805R.dts new file mode 100644 index 0000000000..20cdb84876 --- /dev/null +++ b/target/linux/ramips/dts/JHR-N805R.dts @@ -0,0 +1,89 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "JHR-N805R", "ralink,rt3050-soc"; + model = "JCG JHR-N805R"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "jhr-n805r:blue:system"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/JHR-N825R.dts b/target/linux/ramips/dts/JHR-N825R.dts new file mode 100644 index 0000000000..4eab893265 --- /dev/null +++ b/target/linux/ramips/dts/JHR-N825R.dts @@ -0,0 +1,83 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "JHR-N825R", "ralink,rt3052-soc"; + model = "JCG JHR-N825R"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + system { + label = "jhr-n825r:red:power"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/JHR-N926R.dts b/target/linux/ramips/dts/JHR-N926R.dts new file mode 100644 index 0000000000..e5b64c5b96 --- /dev/null +++ b/target/linux/ramips/dts/JHR-N926R.dts @@ -0,0 +1,129 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "JHR-N926R", "ralink,rt3052-soc"; + model = "JCG JHR-N926R"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wlan1 { + label = "jhr-n926r:red:wlan"; + gpios = <&gpio0 20 1>; + }; + + wlan2 { + label = "jhr-n926r:yellow:wlan"; + gpios = <&gpio0 19 1>; + }; + + wlan3 { + label = "jhr-n926r:green:wlan"; + gpios = <&gpio0 17 1>; + }; + + system { + label = "jhr-n926r:blue:system"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + display_data { + gpio-export,name = "display_data"; + gpio-export,output = <1>; + gpios = <&gpio0 7 1>; + }; + + display_clock { + gpio-export,name = "display_clock"; + gpio-export,output = <1>; + gpios = <&gpio0 8 0>; + }; + + display_blank { + gpio-export,name = "display_blank"; + gpio-export,output = <1>; + gpios = <&gpio0 11 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wlan { + label = "wlan"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/LINKIT7688.dts b/target/linux/ramips/dts/LINKIT7688.dts new file mode 100644 index 0000000000..210d4d0b8d --- /dev/null +++ b/target/linux/ramips/dts/LINKIT7688.dts @@ -0,0 +1,184 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include + +/ { + compatible = "mediatek,linkit", "mediatek,mt7628an-soc"; + model = "MediaTek LinkIt Smart 7688"; + + chosen { + bootargs = "console=ttyS2,57600"; + }; + + aliases { + serial0 = &uart2; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + bootstrap { + compatible = "mediatek,linkit"; + + status = "okay"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "mediatek:orange:wifi"; + gpios = <&wgpio 0 0>; + default-state = "on"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "reset"; + gpios = <&gpio1 6 1>; + linux,code = ; + }; + }; + + wgpio: gpio-wifi { + compatible = "mediatek,gpio-wifi"; + #address-cells = <1>; + #size-cells = <0>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "gpio"; + ralink,function = "gpio"; + }; + + perst { + ralink,group = "perst"; + ralink,function = "gpio"; + }; + + refclk { + ralink,group = "refclk"; + ralink,function = "gpio"; + }; + + i2s { + ralink,group = "i2s"; + ralink,function = "gpio"; + }; + + spis { + ralink,group = "spis"; + ralink,function = "gpio"; + }; + + wled_kn { + ralink,group = "wled_kn"; + ralink,function = "gpio"; + }; + + wled_an { + ralink,group = "wled_an"; + ralink,function = "wled_an"; + }; + + wdt { + ralink,group = "wdt"; + ralink,function = "gpio"; + }; + }; +}; + +&wmac { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l25635e"; + spi-max-frequency = <40000000>; + m25p,chunked-io = <31>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "linux,spidev"; + reg = <1>; + spi-max-frequency = <40000000>; + }; +}; + +&i2c { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&sdhci { + status = "okay"; + mediatek,cd-high; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/M2M.dts b/target/linux/ramips/dts/M2M.dts new file mode 100644 index 0000000000..99e7b6a44b --- /dev/null +++ b/target/linux/ramips/dts/M2M.dts @@ -0,0 +1,112 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "M2M", "ralink,rt5350-soc"; + model = "Intenso Memory 2 Move"; + + chosen { + bootargs = "console=ttyS0,57600n8 root=/dev/mtdblock5"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "m2m:blue:wifi"; + gpios = <&gpio0 7 1>; + }; + + wan { + label = "m2m:green:wan"; + gpios = <&gpio0 12 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + power { + label = "power"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/ramips/dts/M3.dts b/target/linux/ramips/dts/M3.dts new file mode 100644 index 0000000000..f4169c779c --- /dev/null +++ b/target/linux/ramips/dts/M3.dts @@ -0,0 +1,106 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "M3", "ralink,rt5350-soc"; + model = "Poray M3"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "m3:blue:status"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 17 1>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q32"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <1>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/M4-4M.dts b/target/linux/ramips/dts/M4-4M.dts new file mode 100644 index 0000000000..c6ed683909 --- /dev/null +++ b/target/linux/ramips/dts/M4-4M.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "M4", "ralink,rt5350-soc"; + model = "Poray M4 (4M)"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "m4:blue:status"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "pm25lq032"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <1>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/M4-8M.dts b/target/linux/ramips/dts/M4-8M.dts new file mode 100644 index 0000000000..75c7e53388 --- /dev/null +++ b/target/linux/ramips/dts/M4-8M.dts @@ -0,0 +1,99 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "M4", "ralink,rt5350-soc"; + model = "Poray M4 (8M)"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "m4:blue:status"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "gd25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <1>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MAC1200RV2.dts b/target/linux/ramips/dts/MAC1200RV2.dts new file mode 100644 index 0000000000..f52be3c51c --- /dev/null +++ b/target/linux/ramips/dts/MAC1200RV2.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +/ { + compatible = "mercury,mac1200rv2", "mediatek,mt7628an-soc"; + model = "Mercury MAC1200R v2"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x2000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + status { + label = "mac1200rv2:green:status"; + gpios = <&gpio0 11 1>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q128"; + reg = <0 0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x1d800>; + }; + + factory: partition@0x1d800 { + label = "factory_info"; + reg = <0x1d800 0x800>; + read-only; + }; + + art: partition@0x1e000 { + label = "art"; + reg = <0x1e000 0x2000>; + read-only; + }; + + partition@20000 { + label = "config"; + reg = <0x20000 0x10000>; + }; + + partition@30000 { + label = "u-boot2"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7c0000>; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + mtd-mac-address = <&factory 0xd>; + ralink,port-map = "llllw"; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&art 0x0>; +}; + +&pcie { + status = "okay"; + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&art 0x1000>; + mediatek,2ghz = <0>; + }; + }; +}; diff --git a/target/linux/ramips/dts/MINIEMBPLUG.dts b/target/linux/ramips/dts/MINIEMBPLUG.dts new file mode 100644 index 0000000000..5f1cfe93cb --- /dev/null +++ b/target/linux/ramips/dts/MINIEMBPLUG.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "MINIEMBPLUG", "ralink,rt5350-soc"; + model = "Omnima MiniEMBPlug"; + + gpio-leds { + compatible = "gpio-leds"; + + wlan { + label = "miniembplug:red:wlan"; + gpios = <&gpio0 9 0>; + }; + + mobile { + label = "miniembplug:green:mobile"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode-one { + label = "mode1"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + mode-two { + label = "mode2"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MINIEMBWIFI.dts b/target/linux/ramips/dts/MINIEMBWIFI.dts new file mode 100644 index 0000000000..ccdd40f801 --- /dev/null +++ b/target/linux/ramips/dts/MINIEMBWIFI.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "MINIEMBWIFI", "ralink,rt3052-soc"; + model = "Omnima MiniEMBWiFi"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "miniembwifi:green:status"; + gpios = <&gpio0 9 1>; + }; + + wlan { + label = "miniembwifi:green:wlan"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; + + 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; + }; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MIWIFI-MINI.dts b/target/linux/ramips/dts/MIWIFI-MINI.dts new file mode 100644 index 0000000000..0cd511c4fa --- /dev/null +++ b/target/linux/ramips/dts/MIWIFI-MINI.dts @@ -0,0 +1,155 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "xiaomi,miwifi-mini", "ralink,mt7620a-soc"; + model = "Xiaomi MiWiFi Mini"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + blue { + label = "miwifi-mini:blue:status"; + gpios = <&gpio1 0 1>; + }; + + yellow { + label = "miwifi-mini:yellow:status"; + gpios = <&gpio1 2 1>; + }; + + red { + label = "miwifi-mini:red:status"; + gpios = <&gpio1 5 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 0>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + 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>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + 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 0xf80000>; + }; + + partition@fd0000 { + label = "crash"; + reg = <0xfd0000 0x10000>; + }; + + partition@fe0000 { + label = "reserved"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "Bdata"; + reg = <0xff0000 0x10000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "rgmii1"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; diff --git a/target/linux/ramips/dts/MIWIFI-NANO.dts b/target/linux/ramips/dts/MIWIFI-NANO.dts new file mode 100644 index 0000000000..dfe9ef5707 --- /dev/null +++ b/target/linux/ramips/dts/MIWIFI-NANO.dts @@ -0,0 +1,105 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "xiaomi,MiWifi Nano", "mediatek,mt7628an-soc"; + model = "MiWiFi Nano"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status_blue { + label = "miwifi-nano:blue:status"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + status_red { + label = "miwifi-nano:red:status"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + status_amber { + label = "miwifi-nano:amber:status"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "refclk", "wled_an", "gpio"; + ralink,function = "gpio"; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0x4>; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + 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 0x7b0000>; + }; + }; +}; diff --git a/target/linux/ramips/dts/MLW221.dts b/target/linux/ramips/dts/MLW221.dts new file mode 100644 index 0000000000..05d7dfff8a --- /dev/null +++ b/target/linux/ramips/dts/MLW221.dts @@ -0,0 +1,122 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "mlw221", "ralink,mt7620n-soc"; + model = "Kingston MLW221"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "mlw221:blue:system"; + gpios = <&gpio2 3 1>; + }; + + wifi { + label = "mlw221:blue:wifi"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + system { + label = "system"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl129p1"; + spi-max-frequency = <10000000>; + + 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 0xf60000>; + }; + + partition@fb0000 { + label = "user-config"; + reg = <0xfb0000 0x50000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "ephy", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/MLWG2.dts b/target/linux/ramips/dts/MLWG2.dts new file mode 100644 index 0000000000..9c71c91c1c --- /dev/null +++ b/target/linux/ramips/dts/MLWG2.dts @@ -0,0 +1,122 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "mlwg2", "ralink,mt7620n-soc"; + model = "Kingston MLWG2"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "mlwg2:blue:system"; + gpios = <&gpio2 3 1>; + }; + + wifi { + label = "mlwg2:blue:wifi"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + system { + label = "system"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + 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 0xf60000>; + }; + + partition@fb0000 { + label = "user-config"; + reg = <0xfb0000 0x50000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "ephy", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/MOFI3500-3GN.dts b/target/linux/ramips/dts/MOFI3500-3GN.dts new file mode 100644 index 0000000000..23596e0f34 --- /dev/null +++ b/target/linux/ramips/dts/MOFI3500-3GN.dts @@ -0,0 +1,113 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "MOFI3500-3GN", "ralink,rt3052-soc"; + model = "MoFi Network MOFI3500-3GN"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "mofi3500-3gn:green:usb"; + gpios = <&gpio0 8 1>; + }; + + 3g { + label = "mofi3500-3gn:green:3g"; + gpios = <&gpio0 11 1>; + }; + + status { + label = "mofi3500-3gn:green:status"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "mofi3500-3gn:green:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + connect { + label = "connect"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MPRA1.dts b/target/linux/ramips/dts/MPRA1.dts new file mode 100644 index 0000000000..e97e60ca59 --- /dev/null +++ b/target/linux/ramips/dts/MPRA1.dts @@ -0,0 +1,123 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "MPRA1", "ralink,rt5350-soc"; + model = "HAME MPR-A1"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "mpr-a1:blue:system"; + gpios = <&gpio0 20 1>; + }; + + power { + label = "mpr-a1:red:power"; + gpios = <&gpio0 17 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 7 0>; + }; + + root_hub { + gpio-export,name = "root_hub"; + gpio-export,output = <1>; + gpios = <&gpio0 12 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf", "led"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MPRA2.dts b/target/linux/ramips/dts/MPRA2.dts new file mode 100644 index 0000000000..72ee8768b6 --- /dev/null +++ b/target/linux/ramips/dts/MPRA2.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "MPRA2", "ralink,rt5350-soc"; + model = "HAME MPR-A2"; + + gpio-leds { + compatible = "gpio-leds"; + + system { + label = "mpr-a2:blue:system"; + gpios = <&gpio0 20 1>; + }; + + power { + label = "mpr-a2:red:power"; + gpios = <&gpio0 17 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 7 0>; + }; + + root_hub { + gpio-export,name = "root_hub"; + gpio-export,output = <1>; + gpios = <&gpio0 12 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x1>; + mediatek,portdisable = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MR-102N.dts b/target/linux/ramips/dts/MR-102N.dts new file mode 100644 index 0000000000..a28deb79ed --- /dev/null +++ b/target/linux/ramips/dts/MR-102N.dts @@ -0,0 +1,118 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "MR-102N", "ralink,rt3052-soc"; + model = "AXIMCom MR-102N"; + + 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; + }; + + 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 0x790000>; + }; + + partition@7e0000 { + label = "nvram"; + reg = <0x7e0000 0x10000>; + }; + + partition@7f0000 { + label = "nvram_backup"; + reg = <0x7f0000 0x10000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "mr-102n:green:usb"; + gpios = <&gpio0 8 1>; + }; + + status { + label = "mr-102n:amber:status"; + gpios = <&gpio0 9 1>; + }; + + wlan { + label = "mr-102n:green:wlan"; + gpios = <&gpio0 11 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + status = "okay"; + #mediatek,portmap = <0x3e>; + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MT7620a.dts b/target/linux/ramips/dts/MT7620a.dts new file mode 100644 index 0000000000..8f1b6d9521 --- /dev/null +++ b/target/linux/ramips/dts/MT7620a.dts @@ -0,0 +1,127 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc"; + model = "Ralink MT7620a + MT7610e evaluation board"; + + gpio-keys-polled { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + s2 { + label = "S2"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + s3 { + label = "S3"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; + + port@4 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&phy4>; + }; + + port@5 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; + +&sdhci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MT7620a_MT7530.dts b/target/linux/ramips/dts/MT7620a_MT7530.dts new file mode 100644 index 0000000000..5885ed045d --- /dev/null +++ b/target/linux/ramips/dts/MT7620a_MT7530.dts @@ -0,0 +1,117 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +/ { + compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc"; + model = "Ralink MT7620a + MT7530 evaluation board"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; + + 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"; + mediatek,mt7530 = <1>; +}; + +&pcie { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MT7620a_MT7610e.dts b/target/linux/ramips/dts/MT7620a_MT7610e.dts new file mode 100644 index 0000000000..da241a4253 --- /dev/null +++ b/target/linux/ramips/dts/MT7620a_MT7610e.dts @@ -0,0 +1,88 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc"; + model = "Ralink MT7620A evaluation board"; + + gpio-keys-polled { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <1000000>; + + 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 0x7b0000>; + }; + }; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&sdhci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MT7620a_V22SG.dts b/target/linux/ramips/dts/MT7620a_V22SG.dts new file mode 100644 index 0000000000..ea17512082 --- /dev/null +++ b/target/linux/ramips/dts/MT7620a_V22SG.dts @@ -0,0 +1,116 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc"; + model = "Ralink MT7620a V22SG High Power evaluation board"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; + + nand { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mtk,mt7620-nand"; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x20000>; + read-only; + }; + + factory: partition@60000 { + label = "factory"; + reg = <0x60000 0x20000>; + read-only; + }; + + partition@80000 { + label = "firmware"; + reg = <0x80000 0x7f80000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "spi"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; + +&pcie { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MT7621.dts b/target/linux/ramips/dts/MT7621.dts new file mode 100644 index 0000000000..83d0c86c18 --- /dev/null +++ b/target/linux/ramips/dts/MT7621.dts @@ -0,0 +1,54 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +/ { + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc"; + model = "Mediatek MT7621 evaluation board"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x2000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; +}; + +&nand { + status = "okay"; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x80000>; /* 64 KB */ + }; + + partition@80000 { + label = "uboot_env"; + reg = <0x80000 0x80000>; /* 64 KB */ + }; + + partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "rootfs"; + reg = <0x140000 0xec0000>; + }; +}; + +&sdhci { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/MT7628.dts b/target/linux/ramips/dts/MT7628.dts new file mode 100644 index 0000000000..a4b066cfd5 --- /dev/null +++ b/target/linux/ramips/dts/MT7628.dts @@ -0,0 +1,67 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +/ { + compatible = "mediatek,mt7628an-eval-board", "mediatek,mt7628an-soc"; + model = "Mediatek MT7628AN evaluation board"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x2000000>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag"; + ralink,function = "gpio"; + }; + }; +}; + +&wmac { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + 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 0x7b0000>; + }; + }; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MZK-750DHP.dts b/target/linux/ramips/dts/MZK-750DHP.dts new file mode 100644 index 0000000000..589b19e52c --- /dev/null +++ b/target/linux/ramips/dts/MZK-750DHP.dts @@ -0,0 +1,129 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Planex MZK-750DHP"; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "mzk-750dhp:green:wps"; + gpios = <&gpio2 15 1>; + }; + + power { + label = "mzk-750dhp:green:power"; + gpios = <&gpio1 15 1>; + }; + + wlan5g { + label = "mzk-750dhp:green:wlan5g"; + gpios = <&gpio1 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + s1 { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + s2 { + label = "wps"; + gpios = <&gpio2 19 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi refclk", "rgmii1", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; diff --git a/target/linux/ramips/dts/MZK-DP150N.dts b/target/linux/ramips/dts/MZK-DP150N.dts new file mode 100644 index 0000000000..7fa8ef4ab9 --- /dev/null +++ b/target/linux/ramips/dts/MZK-DP150N.dts @@ -0,0 +1,102 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "MZK-DP150N", "ralink,rt5350-soc"; + model = "Planex MZK-DP150N"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "mzk-dp150n:green:power"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; +}; + +&spi1 { + spidev@0 { + compatible = "linux,spidev"; + spi-max-frequency = <10000000>; + reg = <0>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag", "uartf", "led"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x17>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; +}; diff --git a/target/linux/ramips/dts/MZK-EX300NP.dts b/target/linux/ramips/dts/MZK-EX300NP.dts new file mode 100644 index 0000000000..569d0a951c --- /dev/null +++ b/target/linux/ramips/dts/MZK-EX300NP.dts @@ -0,0 +1,132 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Planex MZK-EX300NP"; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "mzk-ex300np:green:wifi"; + gpios = <&gpio3 0 1>; + }; + + wps { + label = "mzk-ex300np:green:wps"; + gpios = <&gpio1 5 1>; + }; + + rep { + label = "mzk-ex300np:blue:rep"; + gpios = <&gpio1 4 1>; + }; + + wifi1 { + label = "mzk-ex300np:blue:wifi1"; + gpios = <&gpio1 1 1>; + }; + + wifi2 { + label = "mzk-ex300np:blue:wifi2"; + gpios = <&gpio1 2 1>; + }; + + wifi3 { + label = "mzk-ex300np:blue:wifi3"; + gpios = <&gpio1 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 3 0>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q64"; + spi-max-frequency = <10000000>; + + 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 0x730000>; + }; + + partition@780000 { + label = "Udata"; + reg = <0x780000 0x80000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "spi refclk", "rgmii1", "wled"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/MZK-EX750NP.dts b/target/linux/ramips/dts/MZK-EX750NP.dts new file mode 100644 index 0000000000..ec2ca5fc4b --- /dev/null +++ b/target/linux/ramips/dts/MZK-EX750NP.dts @@ -0,0 +1,150 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Planex MZK-EX750NP"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "mzk-ex750np:red:power"; + gpios = <&gpio0 14 1>; + }; + + wifi { + label = "mzk-ex750np:red:wifi"; + gpios = <&gpio3 0 1>; + }; + + wps { + label = "mzk-ex750np:green:wps"; + gpios = <&gpio0 10 1>; + }; + + rep { + label = "mzk-ex750np:blue:rep"; + gpios = <&gpio2 16 1>; + }; + + wifi1 { + label = "mzk-ex750np:blue:wifi1"; + gpios = <&gpio2 19 1>; + }; + + wifi2 { + label = "mzk-ex750np:blue:wifi2"; + gpios = <&gpio2 18 1>; + }; + + wifi3 { + label = "mzk-ex750np:blue:wifi3"; + gpios = <&gpio2 17 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 9 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 13 0>; + linux,code = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q64"; + spi-max-frequency = <10000000>; + + 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 0x730000>; + }; + + partition@780000 { + label = "Udata"; + reg = <0x780000 0x80000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uartf", "nd_sd", "rgmii2", "wled"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; diff --git a/target/linux/ramips/dts/MZK-W300NH2.dts b/target/linux/ramips/dts/MZK-W300NH2.dts new file mode 100644 index 0000000000..4b002b7c20 --- /dev/null +++ b/target/linux/ramips/dts/MZK-W300NH2.dts @@ -0,0 +1,113 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "MZK-W300NH2", "ralink,rt3052-soc"; + model = "Planex MZK-W300NH2"; + + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@3e0000 { + label = "cimage"; + reg = <0x3e0000 0x20000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x390000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "mzk-w300nh2:green:power"; + gpios = <&gpio0 9 1>; + }; + + wlan { + label = "mzk-w300nh2:amber:wlan"; + gpios = <&gpio0 14 1>; + }; + + wps { + label = "mzk-w300nh2:amber:wps"; + gpios = <&gpio0 11 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + rt { + label = "rt"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/MZK-WDPR.dts b/target/linux/ramips/dts/MZK-WDPR.dts new file mode 100644 index 0000000000..ff26b153b6 --- /dev/null +++ b/target/linux/ramips/dts/MZK-WDPR.dts @@ -0,0 +1,86 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +/ { + compatible = "MZK-WDPR", "ralink,rt3052-soc"; + model = "Planex MZK-WDPR"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "Data3G"; + reg = <0x7f0000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x680000>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + lcd_ctrl1 { + gpio-export,name = "lcd_ctrl1"; + gpio-export,output = <0>; + gpios = <&gpio0 1 0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/MicroWRT.dts b/target/linux/ramips/dts/MicroWRT.dts new file mode 100644 index 0000000000..c8558c6326 --- /dev/null +++ b/target/linux/ramips/dts/MicroWRT.dts @@ -0,0 +1,109 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "microwrt", "ralink,mt7620a-soc"; + model = "Microduino MicroWRT"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + 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>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "u-boot-env"; + reg = <0x20000 0x10000>; + read-only; + }; + + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0xfc0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "wled", "i2c", "wdt", "uartf"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/NA930.dts b/target/linux/ramips/dts/NA930.dts new file mode 100644 index 0000000000..522bc75855 --- /dev/null +++ b/target/linux/ramips/dts/NA930.dts @@ -0,0 +1,174 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc"; + model = "Sercomm NA930"; + + 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; + }; + + partition@200000 { + label = "factory"; + reg = <0x200000 0x40000>; + read-only; + }; + + 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 { + label = "reset"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + zwave { + label = "zwave"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 14 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + zwave { + label = "na930:blue:zwave"; + gpios = <&gpio2 0 1>; + }; + + status { + label = "na930:blue:status"; + gpios = <&gpio2 26 1>; + }; + + service { + label = "na930:blue:service"; + gpios = <&gpio2 28 1>; + }; + + power { + label = "na930:blue:power"; + gpios = <&gpio2 29 1>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + telit { + gpio-export,name = "telit"; + gpio-export,output = <1>; + gpios = <&gpio0 13 0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "rgmii2", "spi", "ephy"; + ralink,function = "gpio"; + }; + + uartf_gpio { + ralink,group = "uartf"; + ralink,function = "gpio uartf"; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &mdio_pins>; + mediatek,portmap = "llllw"; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/NBG-419N.dts b/target/linux/ramips/dts/NBG-419N.dts new file mode 100644 index 0000000000..e19ce34b5c --- /dev/null +++ b/target/linux/ramips/dts/NBG-419N.dts @@ -0,0 +1,96 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "NBG-419N", "ralink,rt3052-soc"; + model = "ZyXEL NBG-419N"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "nbg-419n:green:power"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "nbg-419n:green:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/NBG-419N2.dts b/target/linux/ramips/dts/NBG-419N2.dts new file mode 100644 index 0000000000..8bb0cc5280 --- /dev/null +++ b/target/linux/ramips/dts/NBG-419N2.dts @@ -0,0 +1,119 @@ +/dts-v1/; + +#include "rt3352.dtsi" + +#include + +/ { + compatible = "NBG-419N2", "ralink,rt3352-soc"; + model = "ZyXEL NBG-419N v2"; + + palmbus@10000000 { + spi@b00 { + status = "okay"; + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mx25l6405d"; + reg = <0 0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "nbg-419n2:green:power"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "nbg-419n2:green:wps"; + gpios = <&gpio0 14 1>; + }; + + usb { + label = "nbg-419n2:green:usb"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + rfkill { + label = "rfkill"; + linux,input-type = ; + gpios = <&gpio0 12 0>; + linux,code = ; + }; + }; + +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + ralink,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/NCS601W.dts b/target/linux/ramips/dts/NCS601W.dts new file mode 100644 index 0000000000..1942b0f908 --- /dev/null +++ b/target/linux/ramips/dts/NCS601W.dts @@ -0,0 +1,73 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +/ { + compatible = "NCS601W", "ralink,rt5350-soc"; + model = "Wansview NCS601W"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/NIXCORE-16M.dts b/target/linux/ramips/dts/NIXCORE-16M.dts new file mode 100644 index 0000000000..b97c425364 --- /dev/null +++ b/target/linux/ramips/dts/NIXCORE-16M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "NIXCORE.dtsi" + +/ { + model = "NixcoreX1 (16M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 new file mode 100644 index 0000000000..55457d9dde --- /dev/null +++ b/target/linux/ramips/dts/NIXCORE-8M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "NIXCORE.dtsi" + +/ { + model = "NixcoreX1 (8M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 new file mode 100644 index 0000000000..a827b31408 --- /dev/null +++ b/target/linux/ramips/dts/NIXCORE.dtsi @@ -0,0 +1,153 @@ +#include "rt5350.dtsi" + +/ { + compatible = "Nixcore", "ralink,rt5350-soc"; + + chosen { + bootargs = "console=ttyS1,57600"; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio0 { + gpio-export,name = "gpio0"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 0 0>; + }; + + gpio1 { + gpio-export,name = "gpio1"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 0 0>; + }; + + /* GPIOs 1-6 are I2C,SPI */ + /* GPIO 7-14 are uart1 */ + /* GPIOs 15 & 16 are uart2 */ + /* JTAG */ + + gpio17 { + /* JTAG_TDO */ + gpio-export,name = "gpio17"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 17 0>; + }; + + gpio18 { + /* JTAG_TDI */ + gpio-export,name = "gpio18"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 18 0>; + }; + + gpio19 { + /* JTAG_TMS */ + gpio-export,name = "gpio19"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 19 0>; + }; + + gpio20 { + /* JTAG_TCLK */ + gpio-export,name = "gpio20"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 20 0>; + }; + + gpio21 { + /* JTAG_TRST_N */ + gpio-export,name = "gpio21"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 21 0>; + }; + + /* ETH LEDs */ + /* + gpio22 { + gpio-export,name = "gpio22"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 0 0>; + }; + + gpio23 { + gpio-export,name = "gpio23"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 1 0>; + }; + + gpio24 { + gpio-export,name = "gpio24"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 2 0>; + }; + + gpio25 { + gpio-export,name = "gpio25"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 3 0>; + }; + + */ + gpio26 { + /* ETH4_LED */ + gpio-export,name = "gpio26"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 4 0>; + }; + + gpio27 { + /* spi_cs1 */ + gpio-export,name = "gpio27"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 5 0>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +&uart { + status = "okay"; + reset-names = "gpio uartf"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag", "led", "spi_cs1"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x17>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/NW718.dts b/target/linux/ramips/dts/NW718.dts new file mode 100644 index 0000000000..372bff6e7f --- /dev/null +++ b/target/linux/ramips/dts/NW718.dts @@ -0,0 +1,109 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "NW718", "ralink,rt3050-soc"; + model = "Netcore NW718"; + + gpio-leds { + compatible = "gpio-leds"; + + cpu { + label = "nw718:amber:cpu"; + gpios = <&gpio0 13 1>; + }; + + usb { + label = "nw718:amber:usb"; + gpios = <&gpio0 8 1>; + }; + + wps { + label = "nw718:amber:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <25000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x20000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0x3a0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/Newifi-D1.dts b/target/linux/ramips/dts/Newifi-D1.dts new file mode 100644 index 0000000000..2d128ac6d2 --- /dev/null +++ b/target/linux/ramips/dts/Newifi-D1.dts @@ -0,0 +1,145 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Newifi-D1"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status-red { + label = "newifi-d1:red:status"; + gpios = <&gpio0 14 1>; + }; + + status-green { + label = "newifi-d1:green:status"; + gpios = <&gpio0 13 1>; + }; + + statys-blue { + label = "newifi-d1:blue:status"; + gpios = <&gpio0 16 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 15 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb2power { + gpio-export,name = "usb2power"; + gpio-export,output = <1>; + gpios = <&gpio0 9 0>; + }; + + usb3power { + gpio-export,name = "usb3power"; + gpio-export,output = <1>; + gpios = <&gpio0 11 0>; + }; + }; +}; + +&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; + }; + + 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 0x2000000>; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "jtag", "uart2", "uart3", "i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/OY-0001.dts b/target/linux/ramips/dts/OY-0001.dts new file mode 100644 index 0000000000..932d379b70 --- /dev/null +++ b/target/linux/ramips/dts/OY-0001.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "OY-0001"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + powerled { + label = "oy-0001:green:power"; + gpios = <&gpio0 9 1>; + }; + + wifiled { + label = "oy-0001:green:wifi"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + s1 { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + 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>; + + 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>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/PBR-D1.dts b/target/linux/ramips/dts/PBR-D1.dts new file mode 100644 index 0000000000..3d4e987c48 --- /dev/null +++ b/target/linux/ramips/dts/PBR-D1.dts @@ -0,0 +1,161 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include + +/ { + compatible = "mediatek,pbr-d1", "mediatek,mt7628an-soc"; + model = "PBR-D1"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + serial0 = &uart2; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "pbr-d1:orange:usb"; + gpios = <&gpio0 0 1>; + default-state = "off"; + }; + + power { + label = "pbr-d1:orange:power"; + gpios = <&gpio0 14 1>; + default-state = "on"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 38 1>; + linux,code = ; + }; + }; + + wgpio: gpio-wifi { + compatible = "mediatek,gpio-wifi"; + #address-cells = <1>; + #size-cells = <0>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "gpio"; + ralink,function = "gpio"; + }; + + i2c { + ralink,group = "i2c"; + ralink,function = "gpio"; + }; + + i2s { + ralink,group = "i2s"; + ralink,function = "gpio"; + }; + + spis { + ralink,group = "spis"; + ralink,function = "gpio"; + }; + + wdt { + ralink,group = "wdt"; + ralink,function = "gpio"; + }; + }; +}; + +&spi0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <40000000>; + m25p,chunked-io = <31>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x0fb0000>; + }; + }; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "linux,spidev"; + reg = <1>; + spi-max-frequency = <40000000>; + }; +}; + +&i2c { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&sdhci { + status = "okay"; + mediatek,cd-high; +}; diff --git a/target/linux/ramips/dts/PBR-M1.dts b/target/linux/ramips/dts/PBR-M1.dts new file mode 100644 index 0000000000..9a0c713daa --- /dev/null +++ b/target/linux/ramips/dts/PBR-M1.dts @@ -0,0 +1,177 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "PBR-M1"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + palmbus: palmbus@1E000000 { + i2c: i2c@900 { + status = "okay"; + + pcf8563: rtc@51 { + status = "okay"; + compatible = "nxp,pcf8563"; + reg = <0x51>; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "pbr-m1:blue:power"; + gpios = <&gpio0 31 1>; + }; + + sys { + label = "pbr-m1:blue:sys"; + gpios = <&gpio1 0 1>; + }; + + internet { + label = "pbr-m1:blue:internet"; + gpios = <&gpio0 29 1>; + }; + + wlan2g { + label = "pbr-m1:blue:wlan2g"; + gpios = <&gpio1 1 1>; + }; + + wlan5g { + label = "pbr-m1:blue:wlan5g"; + gpios = <&gpio0 28 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + power_usb2 { + gpio-export,name = "power_usb2"; + gpio-export,output = <1>; + gpios = <&gpio0 22 0>; + }; + + power_usb3 { + gpio-export,name = "power_usb3"; + gpio-export,output = <1>; + gpios = <&gpio0 25 0>; + }; + + power_sata { + gpio-export,name = "power_sata"; + gpio-export,output = <1>; + gpios = <&gpio0 27 0>; + }; + }; + + beeper: beeper { + compatible = "gpio-beeper"; + gpios = <&gpio0 26 1>; + }; +}; + +&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; + }; + + 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>; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "jtag", "mdio"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/PSG1208.dts b/target/linux/ramips/dts/PSG1208.dts new file mode 100644 index 0000000000..e9b66395df --- /dev/null +++ b/target/linux/ramips/dts/PSG1208.dts @@ -0,0 +1,114 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "PSG1208", "ralink,mt7620a-soc"; + model = "Phicomm PSG1208"; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "psg1208:white:wps"; + gpios = <&gpio1 15 1>; + }; + + wlan { + label = "psg1208:white:wlan2g"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@20000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@30000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/PSG1218.dts b/target/linux/ramips/dts/PSG1218.dts new file mode 100644 index 0000000000..b777c9b1f2 --- /dev/null +++ b/target/linux/ramips/dts/PSG1218.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "PSG1218", "ralink,mt7620a-soc"; + model = "Phicomm PSG1218"; + + gpio-leds { + compatible = "gpio-leds"; + + blue { + label = "psg1218:blue:status"; + gpios = <&gpio0 10 1>; + }; + + yellow { + label = "psg1218:yellow:status"; + gpios = <&gpio0 11 1>; + }; + + red { + label = "psg1218:red:status"; + gpios = <&gpio0 8 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@20000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@30000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/PSR-680W.dts b/target/linux/ramips/dts/PSR-680W.dts new file mode 100644 index 0000000000..f749a4e589 --- /dev/null +++ b/target/linux/ramips/dts/PSR-680W.dts @@ -0,0 +1,93 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "PSR-680W", "ralink,rt3052-soc"; + model = "Petatel PSR-680W Wireless 3G Router"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "psr-680w:red:wan"; + gpios = <&gpio0 19 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/PWH2004.dts b/target/linux/ramips/dts/PWH2004.dts new file mode 100644 index 0000000000..18ee7426f4 --- /dev/null +++ b/target/linux/ramips/dts/PWH2004.dts @@ -0,0 +1,86 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "PWH2004", "ralink,rt3052-soc"; + model = "Prolink PWH2004"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "pwh2004:red:wifi"; + gpios = <&gpio0 14 1>; + }; + + power { + label = "pwh2004:green:power"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/PX-4885-4M.dts b/target/linux/ramips/dts/PX-4885-4M.dts new file mode 100644 index 0000000000..398a4a90dc --- /dev/null +++ b/target/linux/ramips/dts/PX-4885-4M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "PX-4885.dtsi" + +/ { + model = "7Links PX-4885 (4M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "devdata"; + reg = <0x20000 0x20000>; + read-only; + }; + + 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 new file mode 100644 index 0000000000..d6e694ed58 --- /dev/null +++ b/target/linux/ramips/dts/PX-4885-8M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "PX-4885.dtsi" + +/ { + model = "7Links PX-4885 (8M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "devdata"; + reg = <0x20000 0x20000>; + read-only; + }; + + 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 new file mode 100644 index 0000000000..cb9586d556 --- /dev/null +++ b/target/linux/ramips/dts/PX-4885.dtsi @@ -0,0 +1,55 @@ +#include "rt5350.dtsi" + +#include + +/ { + compatible = "PX-4885", "ralink,rt5350-soc"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + orange { + label = "px-4885:orange:wifi"; + gpios = <&gpio0 18 1>; + }; + + blue { + label = "px-4885:blue:storage"; + gpios = <&gpio0 19 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/RB750Gr3.dts b/target/linux/ramips/dts/RB750Gr3.dts new file mode 100644 index 0000000000..756010a550 --- /dev/null +++ b/target/linux/ramips/dts/RB750Gr3.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + model = "MikroTik RB750Gr3"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + pwr { + label = "rb750gr3:blue:pwr"; + gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + }; + + usr { + label = "rb750gr3:green:usr"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + mode { + label = "mode"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + res { + label = "res"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + buzzer { + gpio-export,name = "buzzer"; + gpio-export,output = <0>; + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + }; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&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; + }; + + 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>; + }; + + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; + mtd-mac-address-increment = <1>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "pcie", "rgmii2", "jtag"; + ralink,function = "gpio"; + }; + }; +}; + +&sdhci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RE6500.dts b/target/linux/ramips/dts/RE6500.dts new file mode 100644 index 0000000000..3fe875db12 --- /dev/null +++ b/target/linux/ramips/dts/RE6500.dts @@ -0,0 +1,126 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Linksys RE6500"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "re6500:orange:wifi"; + gpios = <&gpio0 0 0>; + }; + + power { + label = "re6500:white:power"; + gpios = <&gpio0 9 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 11 0>; + linux,code = ; + }; + }; +}; + +&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; + }; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/RP-N53.dts b/target/linux/ramips/dts/RP-N53.dts new file mode 100644 index 0000000000..514481b382 --- /dev/null +++ b/target/linux/ramips/dts/RP-N53.dts @@ -0,0 +1,166 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "asus,rp-n53", "ralink,mt7620a-soc"; + model = "Asus RP-N53"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + touch { + label = "touch"; + gpios = <&gpio1 0 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 1 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio1 2 1>; + linux,code = ; + }; + + audio { + label = "audio"; + gpios = <&gpio1 3 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + backlight { + label = "rp-n53:white:back"; + gpios = <&gpio1 4 1>; + }; + + wifi0 { + label = "rp-n53:blue:5g3"; + gpios = <&gpio1 5 1>; + }; + + wifi1 { + label = "rp-n53:blue:5g2"; + gpios = <&gpio1 6 1>; + }; + + wifi2 { + label = "rp-n53:blue:5g1"; + gpios = <&gpio1 7 1>; + }; + + wifi3 { + label = "rp-n53:blue:wifi"; + gpios = <&gpio1 8 1>; + }; + + wifi4 { + label = "rp-n53:blue:2g1"; + gpios = <&gpio1 9 1>; + }; + + wifi5 { + label = "rp-n53:blue:2g2"; + gpios = <&gpio1 10 1>; + }; + + wifi6 { + label = "rp-n53:blue:2g3"; + gpios = <&gpio1 11 1>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +&i2s { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pcm_i2s_pins>; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pcm { + status = "okay"; +}; + +&gdma { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "mdio", "rgmii1"; + ralink,function = "gpio"; + }; + }; +}; + +&gsw { + mediatek,port4 = "ephy"; + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RT-G32-B1.dts b/target/linux/ramips/dts/RT-G32-B1.dts new file mode 100644 index 0000000000..d392bb3545 --- /dev/null +++ b/target/linux/ramips/dts/RT-G32-B1.dts @@ -0,0 +1,86 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "RT-G32-B1", "ralink,rt3050-soc"; + model = "Asus RT-G32 B1"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + devconf: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devconf 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&devconf 0>; +}; diff --git a/target/linux/ramips/dts/RT-N10-PLUS.dts b/target/linux/ramips/dts/RT-N10-PLUS.dts new file mode 100644 index 0000000000..cb5a13618d --- /dev/null +++ b/target/linux/ramips/dts/RT-N10-PLUS.dts @@ -0,0 +1,82 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "RT-N10-PLUS", "ralink,rt3050-soc"; + model = "Asus RT-N10+"; + + 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; + }; + + partition@30000 { + label = "devdata"; + reg = <0x30000 0x10000>; + read-only; + }; + + devconf: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "rt-n10-plus:green:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +ðernet { + mtd-mac-address = <&devconf 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&devconf 0>; +}; diff --git a/target/linux/ramips/dts/RT-N13U.dts b/target/linux/ramips/dts/RT-N13U.dts new file mode 100644 index 0000000000..9625415b73 --- /dev/null +++ b/target/linux/ramips/dts/RT-N13U.dts @@ -0,0 +1,100 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "RT-N13U", "ralink,rt3052-soc"; + model = "Asus RT-N13U"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "rt-n13u:blue:power"; + gpios = <&gpio0 7 1>; + }; + + wifi { + label = "rt-n13u:blue:wifi"; + gpios = <&gpio0 8 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <10>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RT-N14U.dts b/target/linux/ramips/dts/RT-N14U.dts new file mode 100644 index 0000000000..22dd7b818b --- /dev/null +++ b/target/linux/ramips/dts/RT-N14U.dts @@ -0,0 +1,128 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "asus,rt-n14u", "ralink,mt7620n-soc"; + model = "Asus RT-N14U"; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "rt-n14u:blue:wan"; + gpios = <&gpio2 0 1>; + }; + + lan { + label = "rt-n14u:blue:lan"; + gpios = <&gpio2 1 1>; + }; + + usb { + label = "rt-n14u:blue:usb"; + gpios = <&gpio2 2 1>; + }; + + power { + label = "rt-n14u:blue:power"; + gpios = <&gpio2 3 1>; + }; + + air { + label = "rt-n14u:blue:air"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + 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>; + + 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>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "wled", "i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/RT-N15.dts b/target/linux/ramips/dts/RT-N15.dts new file mode 100644 index 0000000000..704d3130c8 --- /dev/null +++ b/target/linux/ramips/dts/RT-N15.dts @@ -0,0 +1,113 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "RT-N15", "ralink,rt2880-soc"; + model = "Asus RT-N15"; + + 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; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; + + rtl8366s { + compatible = "realtek,rtl8366s"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 0 0>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 12 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "rt-n15:blue:power"; + gpios = <&gpio0 11 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartlite", "mdio"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + phy-mode = "mii"; + reg = <0>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/RT-N56U.dts b/target/linux/ramips/dts/RT-N56U.dts new file mode 100644 index 0000000000..d101ece83c --- /dev/null +++ b/target/linux/ramips/dts/RT-N56U.dts @@ -0,0 +1,151 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "RT-N56U", "ralink,rt3883-soc"; + model = "Asus RT-N56U"; + + 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; + }; + + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; + + factory: partition@40000 { + reg = <0x00040000 0x00010000>; + label = "factory"; + read-only; + }; + + partition@50000 { + reg = <0x00050000 0x007b0000>; + label = "firmware"; + }; + }; + + rtl8367 { + compatible = "realtek,rtl8367"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + realtek,extif1 = <1 0 1 1 1 1 1 1 2>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 2 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "rt-n56u:blue:power"; + gpios = <&gpio0 0 1>; + }; + + lan { + label = "rt-n56u:blue:lan"; + gpios = <&gpio0 19 1>; + }; + + wan { + label = "rt-n56u:blue:wan"; + gpios = <&gpio1 3 1>; + }; + + usb { + label = "rt-n56u:blue:usb"; + gpios = <&gpio1 0 1>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + }; +}; + +&pci { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pci_pins>; + + pci_pins: pci { + pci { + ralink,group = "pci"; + ralink,function = "pci-fnc"; + }; + }; + + host-bridge { + pci-bridge@1 { + status = "okay"; + + wifi@1814,3091 { + compatible = "pci1814,3091"; + reg = <0x10000 0 0 0 0>; + ralink,mtd-eeprom = <&factory 0x8000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,2ghz = <0>; + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts b/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts new file mode 100644 index 0000000000..bda918b44b --- /dev/null +++ b/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts @@ -0,0 +1,100 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +/ { + compatible = "RT5350F-OLINUXINO-EVB", "ralink,rt5350-soc"; + model = "Olimex RT5350F-OLinuXino-EVB"; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + relay1 { + gpio-export,name = "relay1"; + gpio-export,output = <0>; + gpios = <&gpio0 14 0>; + }; + + relay2 { + gpio-export,name = "relay2"; + gpio-export,output = <0>; + gpios = <&gpio0 12 0>; + }; + + button { + gpio-export,name = "button"; + gpios = <&gpio0 0 1>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <0x17>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO.dts b/target/linux/ramips/dts/RT5350F-OLINUXINO.dts new file mode 100644 index 0000000000..0d28e10d95 --- /dev/null +++ b/target/linux/ramips/dts/RT5350F-OLINUXINO.dts @@ -0,0 +1,78 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +/ { + compatible = "RT5350F-OLINUXINO", "ralink,rt5350-soc"; + model = "Olimex RT5350F-OLinuXino"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <0x17>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/RUT5XX.dts b/target/linux/ramips/dts/RUT5XX.dts new file mode 100644 index 0000000000..76cf49bab2 --- /dev/null +++ b/target/linux/ramips/dts/RUT5XX.dts @@ -0,0 +1,93 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "RUT5XX", "ralink,rt3050-soc"; + model = "Teltonika RUT5XX"; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "rut5xx:green:status"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "n25q128a13"; + spi-max-frequency = <10000000>; + + 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>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/SAP-G3200U3.dts b/target/linux/ramips/dts/SAP-G3200U3.dts new file mode 100644 index 0000000000..7be6e033c7 --- /dev/null +++ b/target/linux/ramips/dts/SAP-G3200U3.dts @@ -0,0 +1,123 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "STORYLiNK SAP-G3200U3"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "sap-g3200u3:green:usb"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 16 1>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 14 1>; + linux,code = ; + }; + }; +}; + +&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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + read-only; + }; + + partition@31000 { + label = "config"; + reg = <0x31000 0xf000>; + read-only; + }; + + 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>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe006>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart3", "jtag"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/SK-WB8.dts b/target/linux/ramips/dts/SK-WB8.dts new file mode 100644 index 0000000000..87adc9ae1d --- /dev/null +++ b/target/linux/ramips/dts/SK-WB8.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "mt7621.dtsi" +#include +#include + +/ { + model = "SamKnows Whitebox 8"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "sk-wb8:green:wps"; + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "sk-wb8:green:usb"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + wps { + label = "wps"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + 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>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/SL-R7205.dts b/target/linux/ramips/dts/SL-R7205.dts new file mode 100644 index 0000000000..7b6dc990e2 --- /dev/null +++ b/target/linux/ramips/dts/SL-R7205.dts @@ -0,0 +1,95 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "SL-R7205", "ralink,rt3052-soc"; + model = "Skyline SL-R7205 Wireless 3G 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "sl-r7205:green:wifi"; + gpios = <&gpio0 7 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/TEW-691GR.dts b/target/linux/ramips/dts/TEW-691GR.dts new file mode 100644 index 0000000000..af910798f5 --- /dev/null +++ b/target/linux/ramips/dts/TEW-691GR.dts @@ -0,0 +1,114 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "TEW-691GR", "ralink,rt3883-soc"; + model = "TRENDnet TEW-691GR"; + + 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; + }; + + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; + + 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 { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 2 1>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "tew-691gr:green:wps"; + gpios = <&gpio0 9 1>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + + port@0 { + phy-handle = <&phy0>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0x0>; + ralink,5ghz = <0>; + mtd-mac-address = <&factory 0x4>; + mtd-mac-address-increment = <1>; +}; diff --git a/target/linux/ramips/dts/TEW-692GR.dts b/target/linux/ramips/dts/TEW-692GR.dts new file mode 100644 index 0000000000..b9c7006406 --- /dev/null +++ b/target/linux/ramips/dts/TEW-692GR.dts @@ -0,0 +1,151 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include + +/ { + compatible = "TEW-692GR", "ralink,rt3883-soc"; + model = "TRENDnet TEW-692GR"; + + 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; + }; + + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; + + 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 { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 2 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "tew-692gr:orange:wps"; + gpios = <&gpio0 9 1>; + }; + + wps2 { + label = "tew-692gr:green:wps"; + gpios = <&gpio1 4 1>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + + port@0 { + phy-handle = <&phy0>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PORT0 PAD MODE CTRL */ + 0x0c 0x07600000 /* PORT6 PAD MODE CTRL */ + 0x10 0x40000000 /* Power-on Strapping: 176-pin interface configuration */ + 0x50 0xc437c437 /* LED Control Register 0 */ + 0x54 0xc337c337 /* LED Control Register 1 */ + 0x58 0x00000000 /* LED Control Register 2 */ + 0x5c 0x03ffff00 /* LED Control Register 3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6 STATUS */ + >; + }; + }; +}; + +&pci { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pci_pins>; + + pci_pins: pci { + pci { + ralink,group = "pci"; + ralink,function = "pci-fnc"; + }; + }; + + host-bridge { + pci-bridge@1 { + status = "okay"; + + wifi@0,0 { + compatible = "pci0,0"; + reg = < 0x10000 0 0 0 0 >; + ralink,2ghz = <0>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0x0>; + ralink,5ghz = <0>; + mtd-mac-address = <&factory 0x4>; + mtd-mac-address-increment = <3>; +}; diff --git a/target/linux/ramips/dts/TEW-714TRU.dts b/target/linux/ramips/dts/TEW-714TRU.dts new file mode 100644 index 0000000000..79b30d1bfd --- /dev/null +++ b/target/linux/ramips/dts/TEW-714TRU.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "TEW-714TRU", "ralink,rt5350-soc"; + model = "TRENDnet TEW714TRU"; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "tew-714tru:red:usb"; + gpios = <&gpio0 9 1>; + }; + + wifi { + label = "tew-714tru:green:wifi"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + repeater { + gpio-export,name = "repeater_switch"; + gpios = <&gpio0 7 0>; + }; + + wisp { + gpio-export,name = "wisp_switch"; + gpios = <&gpio0 12 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x1>; + mediatek,portdisable = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/TINY-AC.dts b/target/linux/ramips/dts/TINY-AC.dts new file mode 100644 index 0000000000..356c44d511 --- /dev/null +++ b/target/linux/ramips/dts/TINY-AC.dts @@ -0,0 +1,161 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "TINY-AC", "ralink,mt7620a-soc"; + model = "Dovado Tiny AC"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "tiny-ac:green:usb"; + gpios = <&gpio0 11 1>; + }; + + wifi { + label = "tiny-ac:orange:wifi"; + gpios = <&gpio3 0 1>; + }; + + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio2 5 0>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; + + port@4 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&phy4>; + }; + + port@5 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; + mediatek,mt7530 = <1>; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uartf", "nd_sd", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/Timecloud.dts b/target/linux/ramips/dts/Timecloud.dts new file mode 100644 index 0000000000..535469a8a0 --- /dev/null +++ b/target/linux/ramips/dts/Timecloud.dts @@ -0,0 +1,108 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Thunder Timecloud"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + statw { + label = "timecloud:white:status"; + gpios = <&gpio0 7 0>; + }; + + stato { + label = "timecloud:orange:status"; + gpios = <&gpio0 8 0>; + }; + + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 13 1>; + linux,code = ; + }; + + BTN_0 { + label = "BTN_0"; + gpios = <&gpio0 4 1>; + linux,code = ; + }; + }; +}; + +&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; + }; + + 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>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "jtag"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/UBNT-ERX.dts b/target/linux/ramips/dts/UBNT-ERX.dts new file mode 100644 index 0000000000..0b2da95b30 --- /dev/null +++ b/target/linux/ramips/dts/UBNT-ERX.dts @@ -0,0 +1,107 @@ +#include + +/dts-v1/; + +#include "mt7621.dtsi" + +/ { + model = "UBNT-ERX"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x22>; +}; + +&nand { + status = "okay"; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x60000>; + read-only; + }; + + factory: partition@e0000 { + label = "factory"; + reg = <0xe0000 0x60000>; + }; + + partition@140000 { + label = "kernel1"; + reg = <0x140000 0x300000>; + }; + + partition@440000 { + label = "kernel2"; + reg = <0x440000 0x300000>; + }; + + partition@740000 { + label = "ubi"; + reg = <0x740000 0xf7c0000>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart2", "uart3", "i2c", "pcie", "rgmii2", "jtag"; + ralink,function = "gpio"; + }; + }; +}; + +&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 */ + 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; + }; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/UR-326N4G.dts b/target/linux/ramips/dts/UR-326N4G.dts new file mode 100644 index 0000000000..4246fa4f37 --- /dev/null +++ b/target/linux/ramips/dts/UR-326N4G.dts @@ -0,0 +1,115 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "UR-326N4G", "ralink,rt3052-soc"; + model = "UPVEL UR-326N4G"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 3g { + label = "ur-326n4g:green:3g"; + gpios = <&gpio0 9 1>; + }; + + gateway { + label = "ur-326n4g:green:gateway"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "ur-326n4g:green:ap"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "ur-326n4g:green:wps"; + gpios = <&gpio0 14 1>; + }; + + station { + label = "ur-326n4g:green:station"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4004>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/UR-336UN.dts b/target/linux/ramips/dts/UR-336UN.dts new file mode 100644 index 0000000000..67def7ce7c --- /dev/null +++ b/target/linux/ramips/dts/UR-336UN.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "UR-336UN", "ralink,rt3052-soc"; + model = "UPVEL UR-336UN"; + + cfi@1f000000 { + compatible = "cfi-flash"; + reg = <0x1f000000 0x800000>; + bank-width = <2>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 3g { + label = "ur-336un:green:3g"; + gpios = <&gpio0 9 1>; + }; + + gateway { + label = "ur-336un:green:gateway"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "ur-336un:green:ap"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "ur-336un:green:wps"; + gpios = <&gpio0 14 1>; + }; + + station { + label = "ur-336un:green:station"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +/* FIXME: no partitions defined */ +/*ðernet { + mtd-mac-address = <&factory 0x4004>; +}; +*/ +&esw { + mediatek,portmap = <0x2f>; +}; + +/* FIXME: no partitions defined */ +/*&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; +*/ +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/V11STFE.dts b/target/linux/ramips/dts/V11STFE.dts new file mode 100644 index 0000000000..c4867d8f1c --- /dev/null +++ b/target/linux/ramips/dts/V11STFE.dts @@ -0,0 +1,85 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include + +/ { + compatible = "V11ST-FE", "ralink,rt2880-soc"; + model = "Ralink V11ST-FE"; + + pci@440000 { + status = "okay"; + + host-bridge { + pci-bridge@1 { + status = "okay"; + }; + }; + }; + + 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; + }; + + partition@30000 { + reg = <0x00030000 0x00010000>; + label = "u-boot-env"; + read-only; + }; + + 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 { + label = "wps"; + gpios = <&gpio0 0 0>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "v11st-fe:green:status"; + gpios = <&gpio0 12 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +ðernet { + 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 new file mode 100644 index 0000000000..29d14c2e5f --- /dev/null +++ b/target/linux/ramips/dts/V22RW-2X2.dts @@ -0,0 +1,96 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "V22RW-2X2", "ralink,rt3052-soc"; + model = "Ralink AP-RT3052-V22RW-2X2"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + security { + label = "v22rw-2x2:green:security"; + gpios = <&gpio0 13 1>; + }; + + wps { + label = "v22rw-2x2:red:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/VOCORE-16M.dts b/target/linux/ramips/dts/VOCORE-16M.dts new file mode 100644 index 0000000000..dd10784bf1 --- /dev/null +++ b/target/linux/ramips/dts/VOCORE-16M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "VOCORE.dtsi" + +/ { + model = "VoCore (16M)"; +}; + +&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>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 new file mode 100644 index 0000000000..e3647244f9 --- /dev/null +++ b/target/linux/ramips/dts/VOCORE-8M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "VOCORE.dtsi" + +/ { + model = "VoCore (8M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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 new file mode 100644 index 0000000000..36f784a389 --- /dev/null +++ b/target/linux/ramips/dts/VOCORE.dtsi @@ -0,0 +1,195 @@ +#include "rt5350.dtsi" + +/ { + compatible = "VoCore", "ralink,rt5350-soc"; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio0 { + gpio-export,name = "gpio0"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 0 0>; + }; + + /* UARTF */ + gpio7 { + /* UARTF_RTS_N */ + gpio-export,name = "gpio7"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 7 0>; + }; + + gpio8 { + /* UARTF_TXD */ + gpio-export,name = "gpio8"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 8 0>; + }; + + gpio9 { + /* UARTF_CTS_N */ + gpio-export,name = "gpio9"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 9 0>; + }; + + gpio12 { + /* UARTF_DCD_N */ + gpio-export,name = "gpio12"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 12 0>; + }; + + gpio13 { + /* UARTF_DSR_N */ + gpio-export,name = "gpio13"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 13 0>; + }; + + gpio14 { + /* UARTF_RIN */ + gpio-export,name = "gpio14"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 14 0>; + }; + + /* JTAG */ + gpio17 { + /* JTAG_TDO */ + gpio-export,name = "gpio17"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 17 0>; + }; + + gpio18 { + /* JTAG_TDI */ + gpio-export,name = "gpio18"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 18 0>; + }; + + gpio19 { + /* JTAG_TMS */ + gpio-export,name = "gpio19"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 19 0>; + }; + + gpio20 { + /* JTAG_TCLK */ + gpio-export,name = "gpio20"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 20 0>; + }; + + gpio21 { + /* JTAG_TRST_N */ + gpio-export,name = "gpio21"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio0 21 0>; + }; + + /* ETH LEDs */ + gpio22 { + /* ETH0_LED */ + gpio-export,name = "gpio22"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 0 0>; + }; + + gpio23 { + /* ETH1_LED */ + gpio-export,name = "gpio23"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 1 0>; + }; + + gpio24 { + /* ETH2_LED */ + gpio-export,name = "gpio24"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 2 0>; + }; + + gpio25 { + /* ETH3_LED */ + gpio-export,name = "gpio25"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 3 0>; + }; + + gpio26 { + /* ETH4_LED */ + gpio-export,name = "gpio26"; + gpio-export,direction_may_change = <1>; + gpios = <&gpio1 4 0>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + /* UARTF_RXD */ + label = "vocore:green:status"; + gpios = <&gpio0 10 0>; + }; + + eth { + /* UARTF_DTR_N */ + label = "vocore:orange:eth"; + gpios = <&gpio0 11 0>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag", "uartf", "led"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x11>; + mediatek,portdisable = <0x2e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&spi1 { + status = "okay"; + + spidev@0 { + compatible = "linux,spidev"; + spi-max-frequency = <10000000>; + reg = <0>; + }; +}; diff --git a/target/linux/ramips/dts/VR500.dts b/target/linux/ramips/dts/VR500.dts new file mode 100644 index 0000000000..24bb188706 --- /dev/null +++ b/target/linux/ramips/dts/VR500.dts @@ -0,0 +1,85 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Planex VR500"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "vr500:green:power"; + gpios = <&gpio1 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 15 1>; + linux,code = ; + }; + }; +}; + +&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; + }; + + 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 0x3fb0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/W150M.dts b/target/linux/ramips/dts/W150M.dts new file mode 100644 index 0000000000..9ac84a0f4b --- /dev/null +++ b/target/linux/ramips/dts/W150M.dts @@ -0,0 +1,116 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "W150M", "ralink,rt3050-soc"; + model = "Tenda W150M"; + + 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; + }; + + 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 0x3c8000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 3grouter { + label = "w150m:blue:3grouter"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "w150m:blue:ap"; + gpios = <&gpio0 12 1>; + }; + + wisprouter { + label = "w150m:blue:wisprouter"; + gpios = <&gpio0 9 1>; + }; + + wirelessrouter { + label = "w150m:blue:wirelessrouter"; + gpios = <&gpio0 13 1>; + }; + + 3g { + label = "w150m:blue:3g"; + gpios = <&gpio0 7 1>; + }; + + wpsreset { + label = "w150m:blue:wpsreset"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/W2914NSV2.dts b/target/linux/ramips/dts/W2914NSV2.dts new file mode 100644 index 0000000000..ac26dbe75d --- /dev/null +++ b/target/linux/ramips/dts/W2914NSV2.dts @@ -0,0 +1,26 @@ +/dts-v1/; + +#include "W2914NSV2.dtsi" + +/ { + model = "WeVO W2914NS v2"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + 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 new file mode 100644 index 0000000000..7b11a0f6a2 --- /dev/null +++ b/target/linux/ramips/dts/W2914NSV2.dtsi @@ -0,0 +1,104 @@ +#include "mt7621.dtsi" + +#include +#include + +/ { + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&xhci { + status = "okay"; +}; + +&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; + }; + + 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>; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + wifi@14c3,7662 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; + + pcie1 { + wifi@14c3,7603 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "jtag", "mdio"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/W306R_V20.dts b/target/linux/ramips/dts/W306R_V20.dts new file mode 100644 index 0000000000..ff5ca59ad6 --- /dev/null +++ b/target/linux/ramips/dts/W306R_V20.dts @@ -0,0 +1,90 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "W306R_V20", "ralink,rt3052-soc"; + model = "Tenda W306R V2.0"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + sys { + label = "w306r-v20:green:sys"; + gpios = <&gpio0 9 1>; + }; + + wps { + label = "w306r-v20:green:wps"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "RESET/WPS"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/W502U.dts b/target/linux/ramips/dts/W502U.dts new file mode 100644 index 0000000000..1de6ffa337 --- /dev/null +++ b/target/linux/ramips/dts/W502U.dts @@ -0,0 +1,104 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "W502U", "ralink,rt3052-soc"; + model = "ALFA Networks W502U"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "w502u:blue:usb"; + gpios = <&gpio0 13 1>; + }; + + wps { + label = "w502u:blue:wps"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WCR150GN.dts b/target/linux/ramips/dts/WCR150GN.dts new file mode 100644 index 0000000000..b47dd8b4af --- /dev/null +++ b/target/linux/ramips/dts/WCR150GN.dts @@ -0,0 +1,100 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WCR150GN", "ralink,rt3050-soc"; + model = "Sparklan WCR-150GN"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + user { + label = "wcr-150gn:amber:user"; + gpios = <&gpio0 12 1>; + }; + + power { + label = "wcr-150gn:amber:power"; + gpios = <&gpio0 8 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WF-2881.dts b/target/linux/ramips/dts/WF-2881.dts new file mode 100644 index 0000000000..84a14e4e01 --- /dev/null +++ b/target/linux/ramips/dts/WF-2881.dts @@ -0,0 +1,113 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "NETIS WF-2881"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "wf-2881:green:usb"; + gpios = <&gpio0 6 1>; + }; + + wps { + label = "wf-2881:green:wps"; + gpios = <&gpio0 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = ; + }; + }; +}; + +&nand { + status = "okay"; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + 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>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe006>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart3", "jtag"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WHR-1166D.dts b/target/linux/ramips/dts/WHR-1166D.dts new file mode 100644 index 0000000000..c3b85da2b3 --- /dev/null +++ b/target/linux/ramips/dts/WHR-1166D.dts @@ -0,0 +1,172 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Buffalo WHR-1166D"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "whr-1166d:red:power"; + gpios = <&gpio0 7 1>; + }; + + wifi { + label = "whr-1166d:green:wifi"; + gpios = <&gpio0 8 1>; + }; + + power2 { + label = "whr-1166d:green:power"; + gpios = <&gpio0 9 1>; + }; + + wifi2 { + label = "whr-1166d:orange:wifi"; + gpios = <&gpio0 10 1>; + }; + + internet { + label = "whr-1166d:green:internet"; + gpios = <&gpio2 17 1>; + }; + + router { + label = "whr-1166d:orange:router"; + gpios = <&gpio2 18 1>; + }; + + router2 { + label = "whr-1166d:green:router"; + gpios = <&gpio2 19 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio2 12 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio2 13 1>; + linux,code = ; + }; + + ap { + label = "ap"; + gpios = <&gpio2 14 1>; + linux,code = ; + linux,input-type = ; + }; + + bridge { + label = "bridge"; + gpios = <&gpio2 15 1>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &mdio_pins>; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; diff --git a/target/linux/ramips/dts/WHR-300HP2.dts b/target/linux/ramips/dts/WHR-300HP2.dts new file mode 100644 index 0000000000..3958217082 --- /dev/null +++ b/target/linux/ramips/dts/WHR-300HP2.dts @@ -0,0 +1,150 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Buffalo WHR-300HP2"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "whr-300hp2:red:power"; + gpios = <&gpio0 7 1>; + }; + + wifi { + label = "whr-300hp2:green:wifi"; + gpios = <&gpio0 8 1>; + }; + + power2 { + label = "whr-300hp2:green:power"; + gpios = <&gpio0 9 1>; + }; + + wifi2 { + label = "whr-300hp2:orange:wifi"; + gpios = <&gpio0 10 1>; + }; + + internet { + label = "whr-300hp2:green:internet"; + gpios = <&gpio2 17 1>; + }; + + router { + label = "whr-300hp2:green:router"; + gpios = <&gpio2 18 1>; + }; + + router2 { + label = "whr-300hp2:orange:router"; + gpios = <&gpio2 19 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio2 12 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio2 13 1>; + linux,code = ; + }; + + ap { + label = "ap"; + gpios = <&gpio2 14 1>; + linux,code = ; + linux,input-type = ; + }; + + bridge { + label = "bridge"; + gpios = <&gpio2 15 1>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/WHR-600D.dts b/target/linux/ramips/dts/WHR-600D.dts new file mode 100644 index 0000000000..bea67a9a90 --- /dev/null +++ b/target/linux/ramips/dts/WHR-600D.dts @@ -0,0 +1,158 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ralink,mt7620a-soc"; + model = "Buffalo WHR-600D"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "whr-600d:red:power"; + gpios = <&gpio0 7 1>; + }; + + wifi { + label = "whr-600d:green:wifi"; + gpios = <&gpio0 8 1>; + }; + + power2 { + label = "whr-600d:green:power"; + gpios = <&gpio0 9 1>; + }; + + wifi2 { + label = "whr-600d:orange:wifi"; + gpios = <&gpio0 10 1>; + }; + + internet { + label = "whr-600d:green:internet"; + gpios = <&gpio2 17 1>; + }; + + router { + label = "whr-600d:green:router"; + gpios = <&gpio2 18 1>; + }; + + router2 { + label = "whr-600d:orange:router"; + gpios = <&gpio2 19 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio2 12 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio2 13 1>; + linux,code = ; + }; + + ap { + label = "ap"; + gpios = <&gpio2 14 1>; + linux,code = ; + linux,input-type = ; + }; + + bridge { + label = "bridge"; + gpios = <&gpio2 15 1>; + linux,code = ; + linux,input-type = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l6405d"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + wifi@1814,3091 { + compatible = "pci1814,3091"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + }; + }; +}; diff --git a/target/linux/ramips/dts/WHR-G300N.dts b/target/linux/ramips/dts/WHR-G300N.dts new file mode 100644 index 0000000000..c0779e25bd --- /dev/null +++ b/target/linux/ramips/dts/WHR-G300N.dts @@ -0,0 +1,88 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WHR-G300N", "ralink,rt3052-soc"; + model = "Buffalo WHR-G300N"; + + cfi@1f000000 { + compatible = "cfi-flash"; + reg = <0x1f000000 0x800000>; + bank-width = <2>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + diag { + label = "whr-g300n:red:diag"; + gpios = <&gpio0 7 1>; + }; + + router { + label = "whr-g300n:green:router"; + gpios = <&gpio0 9 1>; + }; + + security { + label = "whr-g300n:amber:security"; + gpios = <&gpio0 14 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + router-off { + label = "router-off"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + router-on { + label = "router-on"; + gpios = <&gpio0 8 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +/* FIXME: no partitions defined */ +/*&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; +*/ diff --git a/target/linux/ramips/dts/WIDORA-NEO.dts b/target/linux/ramips/dts/WIDORA-NEO.dts new file mode 100644 index 0000000000..f6b8f1d52c --- /dev/null +++ b/target/linux/ramips/dts/WIDORA-NEO.dts @@ -0,0 +1,171 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +#include + +/ { + compatible = "mediatek,widora-neo", "mediatek,mt7628an-soc"; + model = "Widora-NEO"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "widora:orange:wifi"; + gpios = <&wgpio 0 0>; + default-state = "on"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "reset"; + gpios = <&gpio1 6 1>; + linux,code = ; + }; + }; + + wgpio: gpio-wifi { + compatible = "mediatek,gpio-wifi"; + #address-cells = <1>; + #size-cells = <0>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "gpio"; + ralink,function = "gpio"; + }; + + perst { + ralink,group = "perst"; + ralink,function = "gpio"; + }; + + refclk { + ralink,group = "refclk"; + ralink,function = "gpio"; + }; + + i2s { + ralink,group = "i2s"; + ralink,function = "gpio"; + }; + + spis { + ralink,group = "spis"; + ralink,function = "gpio"; + }; + + wled_kn { + ralink,group = "wled_kn"; + ralink,function = "gpio"; + }; + + wled_an { + ralink,group = "wled_an"; + ralink,function = "wled_an"; + }; + + wdt { + ralink,group = "wdt"; + ralink,function = "gpio"; + }; + }; +}; + + +&spi0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <40000000>; + m25p,chunked-io = <31>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x0fb0000>; + }; + }; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "linux,spidev"; + reg = <1>; + spi-max-frequency = <40000000>; + }; +}; + +&i2c { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&sdhci { + status = "okay"; + mediatek,cd-low; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WITI.dts b/target/linux/ramips/dts/WITI.dts new file mode 100644 index 0000000000..de0c517d0c --- /dev/null +++ b/target/linux/ramips/dts/WITI.dts @@ -0,0 +1,119 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "MQmaker WiTi"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1E000000 { + i2c@900 { + status = "okay"; + + pcf8563: rtc@51 { + status = "okay"; + compatible = "nxp,pcf8563"; + reg = <0x51>; + }; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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>; + mediatek,2ghz = <0>; + mtd-mac-address = <&factory 0xe000>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + mtd-mac-address = <&factory 0xe000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "jtag", "mdio"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WIZARD8800.dts b/target/linux/ramips/dts/WIZARD8800.dts new file mode 100644 index 0000000000..bbfa61085d --- /dev/null +++ b/target/linux/ramips/dts/WIZARD8800.dts @@ -0,0 +1,81 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +/ { + compatible = "WIZARD8800", "ralink,rt5350-soc"; + model = "EASYACC WI-STOR WIZARD 8800"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q32"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/WIZFI630A.dts b/target/linux/ramips/dts/WIZFI630A.dts new file mode 100644 index 0000000000..78891c24b6 --- /dev/null +++ b/target/linux/ramips/dts/WIZFI630A.dts @@ -0,0 +1,186 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "wizfi630a", "ralink,rt5350-soc"; + model = "WIZnet WizFi630A"; + + chosen { + bootargs = "console=ttyS1,115200"; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + run { + label = "wizfi630a::run"; + gpios = <&gpio0 1 1>; + }; + + wps { + label = "wizfi630a::wps"; + gpios = <&gpio0 20 1>; + }; + + uart1 { + label = "wizfi630a::uart1"; + gpios = <&gpio0 18 1>; + }; + + uart2 { + label = "wizfi630a::uart2"; + gpios = <&gpio0 21 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 17 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + scm1 { + label = "SCM1"; + gpios = <&gpio0 19 1>; + linux,code = ; + }; + + scm2 { + label = "SCM2"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + 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>; + + partition@0 { + #size-cells = <1>; + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + #size-cells = <1>; + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + #size-cells = <1>; + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + #size-cells = <1>; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; +}; + +&uart { + compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0x500 0x100>; + resets = <&rstctrl 12>; + reset-names = "uart"; + interrupt-parent = <&intc>; + interrupts = <5>; + reg-shift = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&uartf_pins>; + status = "okay"; +}; + +&uartlite { + compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + resets = <&rstctrl 19>; + reset-names = "uartl"; + interrupt-parent = <&intc>; + interrupts = <12>; + reg-shift = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag" ; + ralink,function = "gpio"; + }; + }; + + uartf_gpio_pins: uartf_gpio { + uartf_gpio { + ralink,group = "uartf"; + ralink,function = "uartf"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x17>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WL-330N.dts b/target/linux/ramips/dts/WL-330N.dts new file mode 100644 index 0000000000..1cf1712dfa --- /dev/null +++ b/target/linux/ramips/dts/WL-330N.dts @@ -0,0 +1,100 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WL-330N", "ralink,rt3050-soc"; + model = "Asus WL-330N"; + + gpio-leds { + compatible = "gpio-leds"; + + link { + label = "wl-330n:blue:link"; + gpios = <&gpio0 9 1>; + }; + + power { + label = "wl-330n:blue:power"; + gpios = <&gpio0 11 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/WL-330N3G.dts b/target/linux/ramips/dts/WL-330N3G.dts new file mode 100644 index 0000000000..fe703ba5b3 --- /dev/null +++ b/target/linux/ramips/dts/WL-330N3G.dts @@ -0,0 +1,109 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WL-330N3G", "ralink,rt3050-soc"; + model = "Asus WL-330N3G"; + + gpio-leds { + compatible = "gpio-leds"; + + 3g { + label = "wl-330n3g:blue:3g"; + gpios = <&gpio0 9 1>; + }; + + 3g2 { + label = "wl-330n3g:red:3g"; + gpios = <&gpio0 13 1>; + }; + + power { + label = "wl-330n3g:blue:power"; + gpios = <&gpio0 11 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WL-341V3.dts b/target/linux/ramips/dts/WL-341V3.dts new file mode 100644 index 0000000000..e8b6d689de --- /dev/null +++ b/target/linux/ramips/dts/WL-341V3.dts @@ -0,0 +1,125 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WL-341V3", "ralink,rt3052-soc"; + model = "Sitecom WL-341 v3"; + + 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 0x20000>; + read-only; + }; + + boardnvram: partition@20000 { + label = "board-nvram"; + reg = <0x20000 0x10000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + first { + label = "wl-341v3:amber:first"; + gpios = <&gpio0 9 1>; + }; + + first2 { + label = "wl-341v3:blue:first"; + gpios = <&gpio0 13 1>; + }; + + third { + label = "wl-341v3:amber:third"; + gpios = <&gpio0 11 1>; + }; + + third2 { + label = "wl-341v3:blue:third"; + gpios = <&gpio0 14 1>; + }; + + fourth { + label = "wl-341v3:blue:fourth"; + gpios = <&gpio0 10 1>; + }; + + fifth { + label = "wl-341v3:amber:fifth"; + gpios = <&gpio0 12 1>; + }; + + fifth2 { + label = "wl-341v3:blue:fifth"; + gpios = <&gpio0 8 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 5 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&boardnvram 0xffa0>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&boardnvram 0xfd70>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WL-351.dts b/target/linux/ramips/dts/WL-351.dts new file mode 100644 index 0000000000..91e71c657a --- /dev/null +++ b/target/linux/ramips/dts/WL-351.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WL-351", "ralink,rt3052-soc"; + model = "Sitecom WL-351 v1 002"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "wl-351:amber:power"; + gpios = <&gpio0 8 1>; + }; + + unpopulated { + label = "wl-351:amber:unpopulated"; + gpios = <&gpio0 12 1>; + }; + + unpopulated2 { + label = "wl-351:blue:unpopulated"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + rtl8366rb { + compatible = "rtl8366rb"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "mdio", "uartf"; + ralink,function = "gpio"; + }; + rgmii { + ralink,group = "rgmii"; + ralink,function = "rgmii"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + ralink,rgmii = <1>; + mediatek,portmap = <0x3f>; + ralink,fct2 = <0x0002500c>; + /* + * ext phy base addr 31, rx/tx clock skew 0, + * turbo mii off, rgmi 3.3v off, port 5 polling off + * port5: enabled, gige, full-duplex, rx/tx-flow-control + * port6: enabled, gige, full-duplex, rx/tx-flow-control + */ + ralink,fpa2 = <0x1f003fff>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WL-WN575A3.dts b/target/linux/ramips/dts/WL-WN575A3.dts new file mode 100644 index 0000000000..267482407f --- /dev/null +++ b/target/linux/ramips/dts/WL-WN575A3.dts @@ -0,0 +1,130 @@ +/dts-v1/; +#include +#include + +#include "mt7628an.dtsi" + +/ { + compatible = "wavlink,wl-wn575a3", "mediatek,mt7628an-soc"; + model = "Wavlink WL-WN575A3"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi-high { + label = "wl-wn575a3:green:wifi-high"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + + wifi-med { + label = "wl-wn575a3:green:wifi-med"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + wifi-low { + label = "wl-wn575a3:green:wifi-low"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wl-wn575a3:green:wps"; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + 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 0x7b0000>; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0x4>; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; + ralink,port-map = "llllw"; +}; diff --git a/target/linux/ramips/dts/WLI-TX4-AG300N.dts b/target/linux/ramips/dts/WLI-TX4-AG300N.dts new file mode 100644 index 0000000000..9d9b222bd7 --- /dev/null +++ b/target/linux/ramips/dts/WLI-TX4-AG300N.dts @@ -0,0 +1,105 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "WLI-TX4-AG300N", "ralink,rt2880-soc"; + model = "Buffalo WLI-TX4-AG300N"; + + 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; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "linux"; + reg = <0x50000 0x3b0000>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + bandwidth { + label = "bandwidth"; + gpios = <&gpio0 8 0>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 9 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + diag { + label = "wli-tx4-ag300n:red:diag"; + gpios = <&gpio0 10 1>; + }; + + power { + label = "wli-tx4-ag300n:blue:power"; + gpios = <&gpio0 12 1>; + }; + + security { + label = "wli-tx4-ag300n:blue:security"; + gpios = <&gpio0 13 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/WLR-6000.dts b/target/linux/ramips/dts/WLR-6000.dts new file mode 100644 index 0000000000..ff3096907e --- /dev/null +++ b/target/linux/ramips/dts/WLR-6000.dts @@ -0,0 +1,186 @@ +/dts-v1/; + +#include "rt3883.dtsi" + +#include +#include + +/ { + model = "Sitecom WLR-6000"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "wlr-6000:red:power"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; + + ops { + label = "wlr-6000:white:ops"; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x8004>; + mtd-mac-address-increment = <1>; + + port@0 { + phy-handle = <&phy0>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PORT0 PAD MODE CTRL */ + 0x0c 0x07600000 /* PORT6 PAD MODE CTRL */ + 0x10 0x40000000 /* Power-on Strapping: 176-pin interface configuration */ + 0x50 0xc437c437 /* LED Control Register 0 */ + 0x54 0xc337c337 /* LED Control Register 1 */ + 0x58 0x00000000 /* LED Control Register 2 */ + 0x5c 0x03ffff00 /* LED Control Register 3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6 STATUS */ + >; + }; + }; +}; + +&spi0 { + 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; + }; + + 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 0x713000>; + }; + + partition@763000 { + label = "manufacture"; + reg = <0x763000 0x7D000>; + 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"; + }; + }; + + host-bridge { + pci-bridge@1 { + status = "okay"; + + wifi@1814,3091 { + compatible = "pci1814,3091"; + reg = <0x10000 0 0 0 0>; + ralink,mtd-eeprom = <&factory 0x8000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + ralink,2ghz = <0>; + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WMR-300.dts b/target/linux/ramips/dts/WMR-300.dts new file mode 100644 index 0000000000..faa867b723 --- /dev/null +++ b/target/linux/ramips/dts/WMR-300.dts @@ -0,0 +1,106 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "buffalo,wmr-300", "ralink,mt7620n-soc"; + model = "Buffalo WMR-300"; + + gpio-leds { + compatible = "gpio-leds"; + + aoss1 { + label = "wmr-300:red:aoss"; + gpios = <&gpio2 1 1>; + }; + + aoss2 { + label = "wmr-300:green:aoss"; + gpios = <&gpio2 2 1>; + }; + + power { + label = "wmr-300:green:status"; + gpios = <&gpio2 4 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "ephy"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WNCE2001.dts b/target/linux/ramips/dts/WNCE2001.dts new file mode 100644 index 0000000000..92d03defdc --- /dev/null +++ b/target/linux/ramips/dts/WNCE2001.dts @@ -0,0 +1,139 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WNCE2001", "ralink,rt3052-soc"; + model = "Netgear WNCE2001"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power-green { + label = "wnce2001:green:power"; + gpios = <&gpio0 8 1>; + }; + + power-red { + label = "wnce2001:red:power"; + gpios = <&gpio0 9 1>; + }; + + wlan-green { + label = "wnce2001:green:wlan"; + gpios = <&gpio0 12 0>; + }; + + wlan-red { + label = "wnce2001:red:wlan"; + gpios = <&gpio0 13 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + rt { + label = "rt"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + ap { + label = "ap"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l3205d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + factory: partition@30000 { + label = "factory"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "config"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "language"; + reg = <0x60000 0x30000>; + read-only; + }; + + partition@90000 { + label = "pot"; + reg = <0x90000 0x10000>; + read-only; + }; + + partition@a0000 { + label = "checksum"; + reg = <0xa0000 0x10000>; + }; + + partition@b0000 { + label = "firmware"; + reg = <0xb0000 0x350000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/WNDR3700V5.dts b/target/linux/ramips/dts/WNDR3700V5.dts new file mode 100644 index 0000000000..bb879a1441 --- /dev/null +++ b/target/linux/ramips/dts/WNDR3700V5.dts @@ -0,0 +1,139 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Netgear WNDR3700v5"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600 maxcpus=2"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "wndr3700v5:green:wps"; + gpios = <&gpio0 12 1>; + }; + + power { + label = "wndr3700v5:green:power"; + gpios = <&gpio0 18 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wndr3700v5:wps"; + gpios = <&gpio0 7 0>; + linux,code = ; + }; + + wifi { + label = "wndr3700v5:wifi"; + gpios = <&gpio0 8 0>; + linux,code = ; + }; + + reset { + label = "wndr3700v5:reset"; + gpios = <&gpio0 14 0>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio0 10 1>; + }; + }; +}; + +&spi0 { + 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x0000000c>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "rgmii2", "mdio", "wdt"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WR512-3GN-4M.dts b/target/linux/ramips/dts/WR512-3GN-4M.dts new file mode 100644 index 0000000000..966faf2fd5 --- /dev/null +++ b/target/linux/ramips/dts/WR512-3GN-4M.dts @@ -0,0 +1,111 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WR512-3GN", "ralink,rt3052-soc"; + model = "WR512-3GN (4M)"; + + 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; + }; + + 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 0x3c8000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 3g { + label = "wr512-3gn:green:3g"; + gpios = <&gpio0 9 1>; + }; + + gateway { + label = "wr512-3gn:green:gateway"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "wr512-3gn:green:ap"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "wr512-3gn:green:wps"; + gpios = <&gpio0 14 1>; + }; + + station { + label = "wr512-3gn:green:station"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WR512-3GN-8M.dts b/target/linux/ramips/dts/WR512-3GN-8M.dts new file mode 100644 index 0000000000..b376a67b58 --- /dev/null +++ b/target/linux/ramips/dts/WR512-3GN-8M.dts @@ -0,0 +1,111 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WR512-3GN", "ralink,rt3052-soc"; + model = "WR512-3GN (8M)"; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 3g { + label = "wr512-3gn:green:3g"; + gpios = <&gpio0 9 1>; + }; + + gateway { + label = "wr512-3gn:green:gateway"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "wr512-3gn:green:ap"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "wr512-3gn:green:wps"; + gpios = <&gpio0 14 1>; + }; + + station { + label = "wr512-3gn:green:station"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 7 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WR6202.dts b/target/linux/ramips/dts/WR6202.dts new file mode 100644 index 0000000000..1740b188fb --- /dev/null +++ b/target/linux/ramips/dts/WR6202.dts @@ -0,0 +1,115 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "WR6202", "ralink,rt3052-soc"; + model = "AWB WR6202"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "wr6202:blue:wps"; + gpios = <&gpio0 14 1>; + }; + + 3g { + label = "wr6202:blue:3g"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + }; + + 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; + }; + + 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 0x7b0000>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <0>; + gpios = <&gpio0 11 0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WRH-300CR.dts b/target/linux/ramips/dts/WRH-300CR.dts new file mode 100644 index 0000000000..f7ef9335f1 --- /dev/null +++ b/target/linux/ramips/dts/WRH-300CR.dts @@ -0,0 +1,127 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "elecom,wrh-300cr", "ralink,mt7620n-soc"; + model = "ELECOM WRH-300CR"; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "wrh-300cr:green:wps"; + gpios = <&gpio2 0 1>; + }; + + ethernet { + label = "wrh-300cr:green:ethernet"; + gpios = <&gpio2 3 1>; + }; + + wlan { + label = "wrh-300cr:green:wlan"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l12805d"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "recover"; + reg = <0x50000 0x1c0000>; + read-only; + }; + + partition@210000 { + label = "firmware"; + reg = <0x210000 0xdf0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "ephy", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WRTNODE.dts b/target/linux/ramips/dts/WRTNODE.dts new file mode 100644 index 0000000000..04f5836d0a --- /dev/null +++ b/target/linux/ramips/dts/WRTNODE.dts @@ -0,0 +1,91 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +/ { + compatible = "wrtnode", "ralink,mt7620n-soc"; + model = "WRTNODE"; + + gpio-leds { + compatible = "gpio-leds"; + + indicator { + label = "wrtnode:blue:indicator"; + gpios = <&gpio1 14 1>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + 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>; + + 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>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf", "spi refclk"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WRTNODE2.dtsi b/target/linux/ramips/dts/WRTNODE2.dtsi new file mode 100644 index 0000000000..294616c0f7 --- /dev/null +++ b/target/linux/ramips/dts/WRTNODE2.dtsi @@ -0,0 +1,91 @@ +#include "mt7628an.dtsi" + +#include + +/ { + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 5 1>; + linux,code = ; + }; + }; +}; + +&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; + }; + + 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 0x1fb0000>; + }; + }; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "linux,spidev"; + reg = <1>; + spi-max-frequency = <10000000>; + }; +}; + +&uart1 { + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + ralink,port-map = "llllw"; +}; + +&sdhci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WRTNODE2P.dts b/target/linux/ramips/dts/WRTNODE2P.dts new file mode 100644 index 0000000000..94c21a4249 --- /dev/null +++ b/target/linux/ramips/dts/WRTNODE2P.dts @@ -0,0 +1,26 @@ +/dts-v1/; + +#include "WRTNODE2.dtsi" + +/ { + compatible = "mediatek,wrtnode2p", "mediatek,mt7628an-soc"; + model = "WRTnode2P"; + + gpio-leds { + compatible = "gpio-leds"; + + indicator { + label = "wrtnode:blue:indicator"; + gpios = <&gpio1 9 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "gpio", "jtag"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WRTNODE2R.dts b/target/linux/ramips/dts/WRTNODE2R.dts new file mode 100644 index 0000000000..1c25770e76 --- /dev/null +++ b/target/linux/ramips/dts/WRTNODE2R.dts @@ -0,0 +1,26 @@ +/dts-v1/; + +#include "WRTNODE2.dtsi" + +/ { + compatible = "mediatek,wrtnode2r", "mediatek,mt7628an-soc"; + model = "WRTnode2R"; + + gpio-leds { + compatible = "gpio-leds"; + + indicator { + label = "wrtnode:blue:indicator"; + gpios = <&gpio1 12 1>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "gpio", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WSR-1166.dts b/target/linux/ramips/dts/WSR-1166.dts new file mode 100644 index 0000000000..ab6a9a4e3f --- /dev/null +++ b/target/linux/ramips/dts/WSR-1166.dts @@ -0,0 +1,189 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Buffalo WSR-1166DHP"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + internet_g { + label = "wsr-1166:green:internet"; + gpios = <&gpio1 9 1>; + }; + + router_g { + label = "wsr-1166:green:router"; + gpios = <&gpio1 10 1>; + }; + + router_o { + label = "wsr-1166:orange:router"; + gpios = <&gpio1 11 1>; + }; + + internet_o { + label = "wsr-1166:orange:internet"; + gpios = <&gpio1 12 1>; + }; + + wifi_o { + label = "wsr-1166:orange:wifi"; + gpios = <&gpio1 13 1>; + }; + + power { + label = "wsr-1166:green:power"; + gpios = <&gpio1 14 1>; + }; + + diag { + label = "wsr-1166:orange:diag"; + gpios = <&gpio1 15 1>; + }; + + wifi_g { + label = "wsr-1166:green:wifi"; + gpios = <&gpio1 16 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + power { + label = "power"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 3 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio0 6 1>; + linux,code = ; + }; + + auto { + label = "mode"; + gpios = <&gpio0 7 0>; + linux,code = ; + linux,input-type = ; + }; + + ap { + label = "ap"; + gpios = <&gpio0 10 0>; + linux,code = ; + linux,input-type = ; + }; + + router { + label = "router"; + gpios = <&gpio0 12 0>; + linux,code = ; + linux,input-type = ; + }; + }; + + gpio_poweroff { + compatible = "gpio-poweroff"; + gpios = <&gpio0 0 1>; + }; +}; + +&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; + }; + + 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 0xf90000>; + }; + + partition@fe0000 { + label = "board_data"; + reg = <0xfe0000 0x20000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/WSR-600.dts b/target/linux/ramips/dts/WSR-600.dts new file mode 100644 index 0000000000..d5439fa4c1 --- /dev/null +++ b/target/linux/ramips/dts/WSR-600.dts @@ -0,0 +1,162 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "Buffalo WSR-600DHP"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "wsr-600:green:power"; + gpios = <&gpio0 12 1>; + }; + + wifi_o { + label = "wsr-600:orange:wifi"; + gpios = <&gpio1 9 1>; + }; + + diag { + label = "wsr-600:orange:diag"; + gpios = <&gpio1 10 1>; + }; + + wifi_g { + label = "wsr-600:green:wifi"; + gpios = <&gpio1 12 1>; + }; + + router_o { + label = "wsr-600:orange:router"; + gpios = <&gpio1 13 1>; + }; + + router_g { + label = "wsr-600:green:router"; + gpios = <&gpio1 14 1>; + }; + + internet_o { + label = "wsr-600:orange:internet"; + gpios = <&gpio1 15 1>; + }; + + internet_g { + label = "wsr-600:green:internet"; + gpios = <&gpio1 16 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + power { + label = "power"; + gpios = <&gpio0 8 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + + aoss { + label = "aoss"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + + auto { + label = "mode"; + gpios = <&gpio0 7 0>; + linux,code = ; + linux,input-type = ; + }; + + ap { + label = "ap"; + gpios = <&gpio0 6 0>; + linux,code = ; + linux,input-type = ; + }; + + router { + label = "router"; + gpios = <&gpio0 10 0>; + linux,code = ; + linux,input-type = ; + }; + }; + + gpio_poweroff { + compatible = "gpio-poweroff"; + gpios = <&gpio1 11 1>; + }; +}; + +&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; + }; + + 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>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/WT1520-4M.dts b/target/linux/ramips/dts/WT1520-4M.dts new file mode 100644 index 0000000000..26e01f1043 --- /dev/null +++ b/target/linux/ramips/dts/WT1520-4M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "WT1520.dtsi" + +/ { + model = "Nexx WT1520 (4M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; diff --git a/target/linux/ramips/dts/WT1520-8M.dts b/target/linux/ramips/dts/WT1520-8M.dts new file mode 100644 index 0000000000..86c9297970 --- /dev/null +++ b/target/linux/ramips/dts/WT1520-8M.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +#include "WT1520.dtsi" + +/ { + model = "Nexx WT1520 (8M)"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "s25fl064k"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; diff --git a/target/linux/ramips/dts/WT1520.dtsi b/target/linux/ramips/dts/WT1520.dtsi new file mode 100644 index 0000000000..4c889d1d1d --- /dev/null +++ b/target/linux/ramips/dts/WT1520.dtsi @@ -0,0 +1,45 @@ +#include "rt5350.dtsi" + +/ { + compatible = "NEXXWT1520", "ralink,rt5350-soc"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x2000000>; + }; + + chosen { + bootargs = "console=ttyS1,57600"; + }; +}; + +&uart { + pinctrl-names = "default"; + pinctrl-0 = <&uartf_pins>; + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/WT3020-4M.dts b/target/linux/ramips/dts/WT3020-4M.dts new file mode 100644 index 0000000000..6e40d5a869 --- /dev/null +++ b/target/linux/ramips/dts/WT3020-4M.dts @@ -0,0 +1,102 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "wt3020", "ralink,mt7620n-soc"; + model = "Nexx WT3020 (4M)"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "wt3020:blue:power"; + gpios = <&gpio3 0 0>; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q32"; + spi-max-frequency = <10000000>; + + 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 0x3b0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WT3020-8M.dts b/target/linux/ramips/dts/WT3020-8M.dts new file mode 100644 index 0000000000..4ef48cb14e --- /dev/null +++ b/target/linux/ramips/dts/WT3020-8M.dts @@ -0,0 +1,102 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "wt3020", "ralink,mt7620n-soc"; + model = "Nexx WT3020 (8M)"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "wt3020:blue:power"; + gpios = <&gpio3 0 0>; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/WZR-AGL300NH.dts b/target/linux/ramips/dts/WZR-AGL300NH.dts new file mode 100644 index 0000000000..c644df4794 --- /dev/null +++ b/target/linux/ramips/dts/WZR-AGL300NH.dts @@ -0,0 +1,138 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "WZR-AGL300NH", "ralink,rt2880-soc"; + model = "Buffalo WZR-AGL300NH"; + + pci@440000 { + status = "ok"; + }; + + 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; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x3b0000>; + }; + }; + + rtl8366s { + compatible = "realtek,rtl8366s"; + gpio-sda = <&gpio0 1 0>; + gpio-sck = <&gpio0 2 0>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio0 0 1>; + linux,code = ; + }; + + router { + label = "router_switch"; + gpios = <&gpio0 7 0>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 9 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + router { + label = "wzr-agl300nh:green:router"; + gpios = <&gpio0 8 1>; + }; + + diag { + label = "wzr-agl300nh:red:diag"; + gpios = <&gpio0 12 1>; + }; + + security_g { + label = "wzr-agl300nh:orange:security_g"; + gpios = <&gpio0 11 1>; + }; + + security_n { + label = "wzr-agl300nh:orange:security_n"; + gpios = <&gpio0 13 1>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartlite", "mdio"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + + port@0 { + mediatek,fixed-link = <1000 1 1 1>; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + phy-mode = "mii"; + reg = <0>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; diff --git a/target/linux/ramips/dts/X5.dts b/target/linux/ramips/dts/X5.dts new file mode 100644 index 0000000000..efb9d77d71 --- /dev/null +++ b/target/linux/ramips/dts/X5.dts @@ -0,0 +1,138 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "X5", "ralink,rt5350-soc"; + model = "Poray X5"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "x5:green:power"; + gpios = <&gpio0 13 1>; + }; + + 20 { + label = "x5:green:20"; + gpios = <&gpio0 12 1>; + }; + + 50 { + label = "x5:green:50"; + gpios = <&gpio0 11 1>; + }; + + 80 { + label = "x5:green:80"; + gpios = <&gpio0 7 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + bat { + label = "bat"; + gpios = <&gpio0 9 1>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&gpio0 14 1>; + linux,code = ; + linux,input-type = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb-mode { + gpio-export,name = "usb-mode"; + gpio-export,output = <0>; + gpios = <&gpio0 18 0>; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "gd25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <1>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/X8.dts b/target/linux/ramips/dts/X8.dts new file mode 100644 index 0000000000..db8eec56c5 --- /dev/null +++ b/target/linux/ramips/dts/X8.dts @@ -0,0 +1,99 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include + +/ { + compatible = "X8", "ralink,rt5350-soc"; + model = "Poray X8"; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "x8:green:power"; + gpios = <&gpio0 13 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "gd25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "jtag", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&esw { + mediatek,portmap = <0x2f>; + mediatek,led_polarity = <1>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/XDXRN502J.dts b/target/linux/ramips/dts/XDXRN502J.dts new file mode 100644 index 0000000000..304da9cf6e --- /dev/null +++ b/target/linux/ramips/dts/XDXRN502J.dts @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt3050.dtsi" + +#include + +/ { + compatible = "XDXRN502J", "ralink,rt3052-soc"; + model = "XDX RN502J"; + + 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; + }; + + 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 0x3b0000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi { + label = "xdxrn502j:green:wifi"; + gpios = <&gpio0 7 1>; + }; + + power { + label = "xdxrn502j:green:power"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&otg { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/Y1.dts b/target/linux/ramips/dts/Y1.dts new file mode 100644 index 0000000000..ac9b7d56c0 --- /dev/null +++ b/target/linux/ramips/dts/Y1.dts @@ -0,0 +1,49 @@ +/dts-v1/; + +#include "Y1.dtsi" + +/ { + compatible = "lenovo,Y1", "ralink,mt7620a-soc"; + model = "Lenovo Y1"; + + gpio-leds { + compatible = "gpio-leds"; + + power1 { + label = "y1:blue:power"; + gpios = <&gpio0 9 1>; + }; + + wlan1 { + label = "y1:blue:wifi"; + gpios = <&gpio3 0 1>; + }; + + wlan2 { + label = "y1:blue:wifi5g"; + gpios = <&gpio2 10 1>; + }; + + usb { + label = "y1:blue:usb"; + gpios = <&gpio2 12 1>; + }; + + lan { + label = "y1:blue:lan"; + gpios = <&gpio2 15 1>; + }; + + internet { + label = "y1:blue:internet"; + gpios = <&gpio2 11 1>; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; diff --git a/target/linux/ramips/dts/Y1.dtsi b/target/linux/ramips/dts/Y1.dtsi new file mode 100644 index 0000000000..1d5f1ef074 --- /dev/null +++ b/target/linux/ramips/dts/Y1.dtsi @@ -0,0 +1,109 @@ +#include "mt7620a.dtsi" + +#include + +/ { + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 11 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + 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>; + + 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"; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uartf", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; diff --git a/target/linux/ramips/dts/Y1S.dts b/target/linux/ramips/dts/Y1S.dts new file mode 100644 index 0000000000..cfa5e2123a --- /dev/null +++ b/target/linux/ramips/dts/Y1S.dts @@ -0,0 +1,106 @@ +/dts-v1/; + +#include "Y1.dtsi" + +/ { + compatible = "lenovo,Y1S", "ralink,mt7620a-soc"; + model = "Lenovo Y1S"; + + 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 0>; // GPIO2:40+14=GPIO 54 + }; + usb1 { + gpio-export,name = "usb1"; + gpio-export,output = <1>; + gpios = <&gpio2 15 0>; + }; + usb2 { + gpio-export,name = "usb2"; + gpio-export,output = <1>; + gpios = <&gpio2 16 0>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power1 { + label = "y1s:yellow:power"; + gpios = <&gpio0 14 1>; + }; + + power2 { + label = "y1s:blue:power"; + gpios = <&gpio0 9 1>; + }; + + wlan1 { + label = "y1s:yellow:wifi"; + gpios = <&gpio3 0 1>; + }; + + wlan2 { + label = "y1s:blue:wifi"; + gpios = <&gpio2 10 1>; + }; + + usb1 { + label = "y1s:yellow:usb"; + gpios = <&gpio2 13 1>; + }; + + usb2 { + label = "y1s:blue:usb"; + gpios = <&gpio2 12 1>; + }; + + internet { + label = "y1s:blue:internet"; + gpios = <&gpio2 11 1>; + }; + }; +}; + +ðernet { + status = "okay"; + mtd-mac-address = <&factory 0x4>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "wllll"; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts b/target/linux/ramips/dts/YOUKU-YK1.dts new file mode 100644 index 0000000000..1746f6c674 --- /dev/null +++ b/target/linux/ramips/dts/YOUKU-YK1.dts @@ -0,0 +1,126 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "YOUKU-YK1", "ralink,mt7620a-soc"; + model = "YOUKU YK1"; + + gpio-leds { + compatible = "gpio-leds"; + wan { + label = "youku-yk1:blue:wan"; + gpios = <&gpio2 4 1>; + }; + air { + label = "youku-yk1:blue:air"; + gpios = <&gpio3 0 1>; + }; + usb { + label = "youku-yk1:blue:usb"; + gpios = <&gpio1 11 1>; + }; + power { + label = "youku-yk1:blue:power"; + gpios = <&gpio1 5 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q256"; + spi-max-frequency = <10000000>; + + 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 0x1fb0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/ZBT-APE522II.dts b/target/linux/ramips/dts/ZBT-APE522II.dts new file mode 100644 index 0000000000..f570129977 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-APE522II.dts @@ -0,0 +1,145 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "zbtlink,zbt-ape522ii", "ralink,mt7620a-soc"; + model = "ZBT-APE522II"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + sys1 { + label = "zbt-ape522ii:green:sys1"; + gpios = <&gpio0 11 1>; + }; + + sys2 { + label = "zbt-ape522ii:green:sys2"; + gpios = <&gpio0 12 1>; + }; + + sys3 { + label = "zbt-ape522ii:green:sys3"; + gpios = <&gpio0 9 1>; + }; + + sys4 { + label = "zbt-ape522ii:green:sys4"; + gpios = <&gpio0 14 1>; + }; + + wlan2g4 { + label = "zbt-ape522ii:green:wlan2g4"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 2 0>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q64"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + 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 0xf80000>; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wled", "i2c", "uartf", "wdt"; + ralink,function = "gpio"; + }; + + pa { + ralink,group = "pa"; + ralink,function = "pa"; + }; + }; +}; diff --git a/target/linux/ramips/dts/ZBT-CPE102.dts b/target/linux/ramips/dts/ZBT-CPE102.dts new file mode 100644 index 0000000000..abfe0c0229 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-CPE102.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "zbtlink,zbt-cpe102", "ralink,mt7620n-soc"; + model = "Zbtlink ZBT-CPE102"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 4g-0 { + label = "zbt-cpe102:green:4g-0"; + gpios = <&gpio1 14 1>; + }; + + 4g-1 { + label = "zbt-cpe102:green:4g-1"; + gpios = <&gpio0 2 1>; + }; + + 4g-2 { + label = "zbt-cpe102:green:4g-2"; + gpios = <&gpio1 15 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + en25q64@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + 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 0x760000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "spi refclk", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/ZBT-WA05.dts b/target/linux/ramips/dts/ZBT-WA05.dts new file mode 100644 index 0000000000..43f08f5139 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-WA05.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "zbtlink,zbt-wa05", "ralink,mt7620n-soc"; + model = "Zbtlink ZBT-WA05"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "zbt-wa05:blue:power"; + gpios = <&gpio1 14 1>; + }; + + usb { + label = "zbt-wa05:blue:usb"; + gpios = <&gpio1 15 0>; + }; + + air { + label = "zbt-wa05:blue:air"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + en25q64@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + 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 0x760000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "spi refclk", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/ZBT-WE826.dts b/target/linux/ramips/dts/ZBT-WE826.dts new file mode 100644 index 0000000000..1eb03189d1 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-WE826.dts @@ -0,0 +1,124 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "zbtlink,zbt-we826", "ralink,mt7620a-soc"; + model = "ZBT-WE826"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + power { + label = "zbt-we826:green:power"; + gpios = <&gpio1 14 0>; + }; + usb { + label = "zbt-we826:green:usb"; + gpios = <&gpio1 15 0>; + }; + air { + label = "zbt-we826:green:wifi"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + en25q128@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q128"; + reg = <0>; + linux,modalias = "m25p80"; + spi-max-frequency = <10000000>; + + 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>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + ralink,port-map = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/ZBT-WG2626.dts b/target/linux/ramips/dts/ZBT-WG2626.dts new file mode 100644 index 0000000000..a75ca89aa8 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-WG2626.dts @@ -0,0 +1,121 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include + +/ { + model = "ZBT-WG2626"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + palmbus: palmbus@1E000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "zbt-wg2626:green:status"; + gpios = <&gpio0 24 1>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&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; + }; + + 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>; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "wdt rst", "jtag", "mdio"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/ZBT-WG3526.dts b/target/linux/ramips/dts/ZBT-WG3526.dts new file mode 100644 index 0000000000..c361bdd827 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-WG3526.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include "ZBT-WG3526.dtsi" + +/ { + model = "ZBT-WG3526"; +}; + +&firmware { + reg = <0x50000 0xfb0000>; +}; + +&status_led { + label = "zbt-wg3526:green:status"; +}; diff --git a/target/linux/ramips/dts/ZBT-WG3526.dtsi b/target/linux/ramips/dts/ZBT-WG3526.dtsi new file mode 100644 index 0000000000..e48ef3a25b --- /dev/null +++ b/target/linux/ramips/dts/ZBT-WG3526.dtsi @@ -0,0 +1,116 @@ +#include "mt7621.dtsi" + +#include +#include + +/ { + memory@0 { + device_type = "memory"; + reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + palmbus: palmbus@1E000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status_led: status { + gpios = <&gpio0 24 1>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + 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>; + mediatek,5ghz = <0>; + }; + }; + + pcie1 { + wifi@14c3,7662 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "wdt rst", "jtag", "mdio"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/ZBT-WR8305RT.dts b/target/linux/ramips/dts/ZBT-WR8305RT.dts new file mode 100644 index 0000000000..edc820f790 --- /dev/null +++ b/target/linux/ramips/dts/ZBT-WR8305RT.dts @@ -0,0 +1,117 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include + +/ { + compatible = "zbtlink,zbt-wr8305rt", "ralink,mt7620n-soc"; + model = "Zbtlink ZBT-WR8305RT"; + + gpio-leds { + compatible = "gpio-leds"; + + sys { + label = "zbt-wr8305rt:green:sys"; + gpios = <&gpio1 14 1>; + }; + + lan { + label = "zbt-wr8305rt:green:usb"; + gpios = <&gpio1 15 1>; + }; + + wifi { + label = "zbt-wr8305rt:green:wifi"; + gpios = <&gpio3 0 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 1>; + linux,code = ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + ephy { + ralink,group = "ephy"; + ralink,function = "ephy"; + }; + + default { + ralink,group = "i2c", "uartf", "spi refclk", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/ZTE-Q7.dts b/target/linux/ramips/dts/ZTE-Q7.dts new file mode 100644 index 0000000000..44bed871aa --- /dev/null +++ b/target/linux/ramips/dts/ZTE-Q7.dts @@ -0,0 +1,113 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include + +/ { + compatible = "ZTE-Q7", "ralink,mt7620a-soc"; + model = "ZTE Q7"; + + gpio-leds { + compatible = "gpio-leds"; + + statred { + label = "zte-q7:red:status"; + gpios = <&gpio0 13 1>; + }; + + statblue { + label = "zte-q7:blue:status"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 2 1>; + linux,code = ; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "en25q64"; + spi-max-frequency = <10000000>; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/kn_rc.dts b/target/linux/ramips/dts/kn_rc.dts new file mode 100644 index 0000000000..c63c1a3914 --- /dev/null +++ b/target/linux/ramips/dts/kn_rc.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include +#include + +/ { + model = "ZyXEL Keenetic Omni"; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "kn_rc:green:wan"; + gpios = <&gpio0 38 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "kn_rc:green:usb"; + gpios = <&gpio0 39 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "kn_rc:green:wifi"; + gpios = <&gpio0 72 GPIO_ACTIVE_LOW>; + }; + + power { + label = "kn_rc:green:power"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn { + label = "fn"; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&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; + }; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "wdt", "pa", "spi refclk", "wled"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + ralink,port-map = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/kn_rf.dts b/target/linux/ramips/dts/kn_rf.dts new file mode 100644 index 0000000000..22b16b05cc --- /dev/null +++ b/target/linux/ramips/dts/kn_rf.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "mt7620n.dtsi" + +#include +#include + +/ { + model = "ZyXEL Keenetic Omni II"; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "kn_rc:green:wan"; + gpios = <&gpio0 38 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "kn_rc:green:usb"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "kn_rc:green:wifi"; + gpios = <&gpio0 72 GPIO_ACTIVE_LOW>; + }; + + power { + label = "kn_rc:green:power"; + gpios = <&gpio0 39 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn { + label = "fn"; + gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&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; + }; + + 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 0x7b0000>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "wdt", "pa", "spi refclk", "wled"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + ralink,port-map = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/kng_rc.dts b/target/linux/ramips/dts/kng_rc.dts new file mode 100644 index 0000000000..fefa1b7d8d --- /dev/null +++ b/target/linux/ramips/dts/kng_rc.dts @@ -0,0 +1,154 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + model = "ZyXEL Keenetic Viva"; + + gpio-leds { + compatible = "gpio-leds"; + + wan { + label = "kng_rc:green:wan"; + gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "kng_rc:green:usb"; + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; + + power_alert { + label = "kng_rc:red:power"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "kng_rc:green:wifi"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + power { + label = "kng_rc:green:power"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn { + label = "fn"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + rtl8367rb { + compatible = "realtek,rtl8367b"; + cpu_port = <7>; + realtek,extif2 = <1 0 1 1 1 1 1 1 2>; + mdio = <&mdio0>; + }; +}; + +&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; + }; + + 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>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii2_pins &mdio_pins>; + mtd-mac-address = <&factory 0x00004>; + + port@4 { + status = "okay"; + mediatek,fixed-link = <1000 1 1 1>; + phy-mode = "rgmii"; + phy-handle = <&phy4>; + }; + + mdio0: mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4 = "gmac"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi new file mode 100644 index 0000000000..96966b4647 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a.dtsi @@ -0,0 +1,558 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,mtk7620a-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + spi0 = &spi0; + spi1 = &spi1; + serial0 = &uartlite; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,mt7620a-sysc", "ralink,rt3050-sysc"; + reg = <0x0 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,mt7620a-timer", "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,mt7620a-wdt", "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + intc: intc@200 { + compatible = "ralink,mt7620a-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + resets = <&rstctrl 19>; + reset-names = "intc"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,mt7620a-memc", "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + uart: uart@500 { + compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0x500 0x100>; + + resets = <&rstctrl 12>; + reset-names = "uart"; + + interrupt-parent = <&intc>; + interrupts = <5>; + + reg-shift = <2>; + + status = "disabled"; + }; + + gpio0: gpio@600 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + resets = <&rstctrl 13>; + reset-names = "pio"; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + }; + + gpio1: gpio@638 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x638 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <24>; + ralink,num-gpios = <16>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio2: gpio@660 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <40>; + ralink,num-gpios = <32>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio3: gpio@688 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x688 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <72>; + ralink,num-gpios = <1>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + i2c: i2c@900 { + compatible = "ralink,rt2880-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + i2s: i2s@a00 { + compatible = "mediatek,mt7620-i2s"; + reg = <0xa00 0x100>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&intc>; + interrupts = <10>; + + txdma-req = <2>; + rxdma-req = <3>; + + dmas = <&gdma 4>, + <&gdma 6>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,mt7620a-spi", "ralink,rt2880-spi"; + reg = <0xb00 0x40>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + }; + + spi1: spi@b40 { + compatible = "ralink,rt2880-spi"; + reg = <0xb40 0x60>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_cs1>; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + resets = <&rstctrl 19>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <12>; + + reg-shift = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; + }; + + systick: systick@d00 { + compatible = "ralink,mt7620a-systick", "ralink,cevt-systick"; + reg = <0xd00 0x10>; + + resets = <&rstctrl 28>; + reset-names = "intc"; + + interrupt-parent = <&cpuintc>; + interrupts = <7>; + }; + + pcm: pcm@2000 { + compatible = "ralink,mt7620a-pcm"; + reg = <0x2000 0x800>; + + resets = <&rstctrl 11>; + reset-names = "pcm"; + + interrupt-parent = <&intc>; + interrupts = <4>; + + status = "disabled"; + }; + + gdma: gdma@2800 { + compatible = "ralink,mt7620a-gdma", "ralink,rt3883-gdma"; + reg = <0x2800 0x800>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&intc>; + interrupts = <7>; + + #dma-cells = <1>; + #dma-channels = <16>; + #dma-requests = <16>; + + status = "disabled"; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + pcm_i2s_pins: pcm_i2s { + pcm_i2s { + ralink,group = "uartf"; + ralink,function = "pcm i2s"; + }; + }; + + uartf_gpio_pins: uartf_gpio { + uartf_gpio { + ralink,group = "uartf"; + ralink,function = "gpio uartf"; + }; + }; + + gpio_i2s_pins: gpio_i2s { + gpio_i2s { + ralink,group = "uartf"; + ralink,function = "gpio i2s"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + spi_cs1: spi1 { + spi1 { + ralink,group = "spi_cs1"; + ralink,function = "spi_cs1"; + }; + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + + mdio_pins: mdio { + mdio { + ralink,group = "mdio"; + ralink,function = "mdio"; + }; + }; + + ephy_pins: ephy { + ephy { + ralink,group = "ephy"; + ralink,function = "ephy"; + }; + }; + + wled_pins: wled { + wled { + ralink,group = "wled"; + ralink,function = "wled"; + }; + }; + + rgmii1_pins: rgmii1 { + rgmii1 { + ralink,group = "rgmii1"; + ralink,function = "rgmii1"; + }; + }; + + rgmii2_pins: rgmii2 { + rgmii2 { + ralink,group = "rgmii2"; + ralink,function = "rgmii2"; + }; + }; + + pcie_pins: pcie { + pcie { + ralink,group = "pcie"; + ralink,function = "pcie rst"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,mt7620a-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + usbphy: usbphy { + compatible = "mediatek,mt7620-usbphy"; + #phy-cells = <1>; + + resets = <&rstctrl 22 &rstctrl 25>; + reset-names = "host", "device"; + + clocks = <&clkctrl 22 &clkctrl 25>; + clock-names = "host", "device"; + }; + + ethernet: ethernet@10100000 { + compatible = "mediatek,mt7620-eth"; + reg = <0x10100000 0x10000>; + + #address-cells = <1>; + #size-cells = <0>; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + resets = <&rstctrl 21 &rstctrl 23>; + reset-names = "fe", "esw"; + + mediatek,switch = <&gsw>; + + port@4 { + compatible = "mediatek,mt7620a-gsw-port", "mediatek,eth-port"; + reg = <4>; + + status = "disabled"; + }; + + port@5 { + compatible = "mediatek,mt7620a-gsw-port", "mediatek,eth-port"; + reg = <5>; + + status = "disabled"; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + }; + + gsw: gsw@10110000 { + compatible = "mediatek,mt7620-gsw"; + reg = <0x10110000 0x8000>; + + resets = <&rstctrl 23>; + reset-names = "esw"; + + interrupt-parent = <&intc>; + interrupts = <17>; + }; + + sdhci: sdhci@10130000 { + compatible = "ralink,mt7620-sdhci"; + reg = <0x10130000 0x4000>; + + interrupt-parent = <&intc>; + interrupts = <14>; + + status = "disabled"; + }; + + ehci: ehci@101c0000 { + compatible = "generic-ehci"; + reg = <0x101c0000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <18>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + status = "disabled"; + }; + + ohci: ohci@101c1000 { + compatible = "generic-ohci"; + reg = <0x101c1000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <18>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + status = "disabled"; + }; + + pcie: pcie@10140000 { + compatible = "mediatek,mt7620-pci"; + reg = <0x10140000 0x100 + 0x10142000 0x100>; + + #address-cells = <3>; + #size-cells = <2>; + + resets = <&rstctrl 26>; + reset-names = "pcie0"; + + clocks = <&clkctrl 26>; + clock-names = "pcie0"; + + interrupt-parent = <&cpuintc>; + interrupts = <4>; + + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + + device_type = "pci"; + + bus-range = <0 255>; + ranges = < + 0x02000000 0 0x00000000 0x20000000 0 0x10000000 /* pci memory */ + 0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */ + >; + + status = "disabled"; + + pcie-bridge { + reg = <0x0000 0 0 0 0>; + + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + }; + }; + + wmac: wmac@10180000 { + compatible = "ralink,rt7620-wmac", "ralink,rt2880-wmac"; + reg = <0x10180000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; +}; diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi new file mode 100644 index 0000000000..f1593acd93 --- /dev/null +++ b/target/linux/ramips/dts/mt7620n.dtsi @@ -0,0 +1,344 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,mtk7620n-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + spi0 = &spi0; + spi1 = &spi1; + serial0 = &uartlite; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,mt7620a-sysc", "ralink,rt3050-sysc"; + reg = <0x0 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,mt7620a-timer", "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,mt7620a-wdt", "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + intc: intc@200 { + compatible = "ralink,mt7620a-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + resets = <&rstctrl 19>; + reset-names = "intc"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,mt7620a-memc", "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + gpio0: gpio@600 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + resets = <&rstctrl 13>; + reset-names = "pio"; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + }; + + gpio1: gpio@638 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x638 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <24>; + ralink,num-gpios = <16>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio2: gpio@660 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <40>; + ralink,num-gpios = <32>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio3: gpio@688 { + compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio"; + reg = <0x688 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <72>; + ralink,num-gpios = <1>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,mt7620a-spi", "ralink,rt2880-spi"; + reg = <0xb00 0x40>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + }; + + spi1: spi@b40 { + compatible = "ralink,rt2880-spi"; + reg = <0xb40 0x60>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_cs1>; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + resets = <&rstctrl 19>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <12>; + + reg-shift = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; + }; + + systick: systick@d00 { + compatible = "ralink,mt7620a-systick", "ralink,cevt-systick"; + reg = <0xd00 0x10>; + + resets = <&rstctrl 28>; + reset-names = "intc"; + + interrupt-parent = <&cpuintc>; + interrupts = <7>; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + spi_cs1: spi1 { + spi1 { + ralink,group = "spi_cs1"; + ralink,function = "spi_cs1"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,mt7620a-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + usbphy: usbphy { + compatible = "mediatek,mt7620-usbphy"; + #phy-cells = <1>; + + resets = <&rstctrl 22 &rstctrl 25>; + reset-names = "host", "device"; + + clocks = <&clkctrl 22 &clkctrl 25>; + clock-names = "host", "device"; + }; + + ethernet: ethernet@10100000 { + compatible = "mediatek,mt7620-eth"; + reg = <0x10100000 0x10000>; + + #address-cells = <1>; + #size-cells = <0>; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + resets = <&rstctrl 21 &rstctrl 23>; + reset-names = "fe", "esw"; + + mediatek,switch = <&gsw>; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + }; + + gsw: gsw@10110000 { + compatible = "mediatek,mt7620-gsw"; + reg = <0x10110000 0x8000>; + + resets = <&rstctrl 23>; + reset-names = "esw"; + + interrupt-parent = <&intc>; + interrupts = <17>; + mediatek,port4 = "gmac"; + }; + + ehci: ehci@101c0000 { + compatible = "generic-ehci"; + reg = <0x101c0000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <18>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + status = "disabled"; + }; + + ohci: ohci@101c1000 { + compatible = "generic-ohci"; + reg = <0x101c1000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + + status = "disabled"; + }; + + wmac: wmac@10180000 { + compatible = "ralink,rt7620-wmac", "ralink,rt2880-wmac"; + reg = <0x10180000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi new file mode 100644 index 0000000000..6b95c54bef --- /dev/null +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -0,0 +1,458 @@ +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mediatek,mt7621-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips1004Kc"; + }; + + cpu@1 { + compatible = "mips,mips1004Kc"; + }; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + serial0 = &uartlite; + }; + + cpuclock: cpuclock@0 { + #clock-cells = <0>; + compatible = "fixed-clock"; + + /* FIXME: there should be way to detect this */ + clock-frequency = <880000000>; + }; + + sysclock: sysclock@0 { + #clock-cells = <0>; + compatible = "fixed-clock"; + + /* FIXME: there should be way to detect this */ + clock-frequency = <50000000>; + }; + + palmbus: palmbus@1E000000 { + compatible = "palmbus"; + reg = <0x1E000000 0x100000>; + ranges = <0x0 0x1E000000 0x0FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "mtk,mt7621-sysc"; + reg = <0x0 0x100>; + }; + + wdt: wdt@100 { + compatible = "mtk,mt7621-wdt"; + reg = <0x100 0x100>; + }; + + gpio@600 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "mtk,mt7621-gpio"; + reg = <0x600 0x100>; + + gpio0: bank@0 { + reg = <0>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio1: bank@1 { + reg = <1>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio2: bank@2 { + reg = <2>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + }; + + i2c: i2c@900 { + compatible = "mediatek,mt7621-i2c"; + reg = <0x900 0x100>; + + clocks = <&sysclock>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + i2s: i2s@a00 { + compatible = "mediatek,mt7621-i2s"; + reg = <0xa00 0x100>; + + clocks = <&sysclock>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&gic>; + interrupts = ; + + txdma-req = <2>; + rxdma-req = <3>; + + dmas = <&gdma 4>, + <&gdma 6>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + + memc: memc@5000 { + compatible = "mtk,mt7621-memc"; + reg = <0x300 0x100>; + }; + + cpc: cpc@1fbf0000 { + compatible = "mtk,mt7621-cpc"; + reg = <0x1fbf0000 0x8000>; + }; + + mc: mc@1fbf8000 { + compatible = "mtk,mt7621-mc"; + reg = <0x1fbf8000 0x8000>; + }; + + uartlite: uartlite@c00 { + compatible = "ns16550a"; + reg = <0xc00 0x100>; + + clocks = <&sysclock>; + clock-frequency = <50000000>; + + interrupt-parent = <&gic>; + interrupts = ; + + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test; + }; + + spi0: spi@b00 { + status = "disabled"; + + compatible = "ralink,mt7621-spi"; + reg = <0xb00 0x100>; + + clocks = <&sysclock>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + }; + + gdma: gdma@2800 { + compatible = "ralink,rt3883-gdma"; + reg = <0x2800 0x800>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&gic>; + interrupts = <0 13 4>; + + #dma-cells = <1>; + #dma-channels = <16>; + #dma-requests = <16>; + + status = "disabled"; + }; + + hsdma: hsdma@7000 { + compatible = "mediatek,mt7621-hsdma"; + reg = <0x7000 0x1000>; + + resets = <&rstctrl 5>; + reset-names = "hsdma"; + + interrupt-parent = <&gic>; + interrupts = <0 11 4>; + + #dma-cells = <1>; + #dma-channels = <1>; + #dma-requests = <1>; + + status = "disabled"; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + uart1_pins: uart1 { + uart1 { + ralink,group = "uart1"; + ralink,function = "uart1"; + }; + }; + + uart2_pins: uart2 { + uart2 { + ralink,group = "uart2"; + ralink,function = "uart2"; + }; + }; + + uart3_pins: uart3 { + uart3 { + ralink,group = "uart3"; + ralink,function = "uart3"; + }; + }; + + rgmii1_pins: rgmii1 { + rgmii1 { + ralink,group = "rgmii1"; + ralink,function = "rgmii1"; + }; + }; + + rgmii2_pins: rgmii2 { + rgmii2 { + ralink,group = "rgmii2"; + ralink,function = "rgmii2"; + }; + }; + + mdio_pins: mdio { + mdio { + ralink,group = "mdio"; + ralink,function = "mdio"; + }; + }; + + pcie_pins: pcie { + pcie { + ralink,group = "pcie"; + ralink,function = "pcie rst"; + }; + }; + + nand_pins: nand { + spi-nand { + ralink,group = "spi"; + ralink,function = "nand1"; + }; + + sdhci-nand { + ralink,group = "sdhci"; + ralink,function = "nand2"; + }; + }; + + sdhci_pins: sdhci { + sdhci { + ralink,group = "sdhci"; + ralink,function = "sdhci"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + sdhci: sdhci@1E130000 { + status = "disabled"; + + compatible = "ralink,mt7620-sdhci"; + reg = <0x1E130000 0x4000>; + + interrupt-parent = <&gic>; + interrupts = ; + }; + + xhci: xhci@1E1C0000 { + status = "okay"; + + compatible = "mediatek,mt8173-xhci"; + reg = <0x1e1c0000 0x1000 + 0x1e1d0700 0x0100>; + + clocks = <&sysclock>; + clock-names = "sys_ck"; + + interrupt-parent = <&gic>; + interrupts = ; + }; + + gic: interrupt-controller@1fbc0000 { + compatible = "mti,gic"; + reg = <0x1fbc0000 0x2000>; + + interrupt-controller; + #interrupt-cells = <3>; + + mti,reserved-cpu-vectors = <7>; + + timer { + compatible = "mti,gic-timer"; + interrupts = ; + clocks = <&cpuclock>; + }; + }; + + nand: nand@1e003000 { + status = "disabled"; + + compatible = "mtk,mt7621-nand"; + bank-width = <2>; + reg = <0x1e003000 0x800 + 0x1e003800 0x800>; + #address-cells = <1>; + #size-cells = <1>; + }; + + ethernet: ethernet@1e100000 { + compatible = "mediatek,mt7621-eth"; + reg = <0x1e100000 0x10000>; + + #address-cells = <1>; + #size-cells = <0>; + + resets = <&rstctrl 6 &rstctrl 23>; + reset-names = "fe", "eth"; + + interrupt-parent = <&gic>; + interrupts = ; + + mediatek,switch = <&gsw>; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy1f: ethernet-phy@1f { + reg = <0x1f>; + phy-mode = "rgmii"; + }; + }; + }; + + gsw: gsw@1e110000 { + compatible = "mediatek,mt7621-gsw"; + reg = <0x1e110000 0x8000>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + pcie: pcie@1e140000 { + compatible = "mediatek,mt7621-pci"; + reg = <0x1e140000 0x100 + 0x1e142000 0x100>; + + #address-cells = <3>; + #size-cells = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + + device_type = "pci"; + + bus-range = <0 255>; + ranges = < + 0x02000000 0 0x00000000 0x60000000 0 0x10000000 /* pci memory */ + 0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */ + >; + + interrupt-parent = <&gic>; + interrupts = ; + + status = "disabled"; + + resets = <&rstctrl 24 &rstctrl 25 &rstctrl 26>; + reset-names = "pcie0", "pcie1", "pcie2"; + clocks = <&clkctrl 24 &clkctrl 25 &clkctrl 26>; + clock-names = "pcie0", "pcie1", "pcie2"; + + pcie0 { + reg = <0x0000 0 0 0 0>; + + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + }; + + pcie1 { + reg = <0x0800 0 0 0 0>; + + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + }; + + pcie2 { + reg = <0x1000 0 0 0 0>; + + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi new file mode 100644 index 0000000000..dc3ba9e323 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -0,0 +1,479 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,mtk7628an-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + aliases { + serial0 = &uartlite; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,mt7620a-sysc"; + reg = <0x0 0x100>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,mt7628an-wdt", "mtk,mt7621-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <24>; + }; + + intc: intc@200 { + compatible = "ralink,mt7628an-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + resets = <&rstctrl 9>; + reset-names = "intc"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + + ralink,intc-registers = <0x9c 0xa0 + 0x6c 0xa4 + 0x80 0x78>; + }; + + memc: memc@300 { + compatible = "ralink,mt7620a-memc", "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + gpio@600 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "mtk,mt7628-gpio", "mtk,mt7621-gpio"; + reg = <0x600 0x100>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio0: bank@0 { + reg = <0>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio1: bank@1 { + reg = <1>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio2: bank@2 { + reg = <2>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + }; + + i2c: i2c@900 { + compatible = "mediatek,mt7621-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + i2s: i2s@a00 { + compatible = "mediatek,mt7628-i2s"; + reg = <0xa00 0x100>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&intc>; + interrupts = <10>; + + txdma-req = <2>; + rxdma-req = <3>; + + dmas = <&gdma 4>, + <&gdma 6>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,mt7621-spi"; + reg = <0xb00 0x100>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + + status = "disabled"; + }; + + uartlite: uartlite@c00 { + compatible = "ns16550a"; + reg = <0xc00 0x100>; + + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test; + + clock-frequency = <40000000>; + + resets = <&rstctrl 12>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <20>; + + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + }; + + uart1: uart1@d00 { + compatible = "ns16550a"; + reg = <0xd00 0x100>; + + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test; + + clock-frequency = <40000000>; + + resets = <&rstctrl 19>; + reset-names = "uart1"; + + interrupt-parent = <&intc>; + interrupts = <21>; + + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + + status = "disabled"; + }; + + uart2: uart2@e00 { + compatible = "ns16550a"; + reg = <0xe00 0x100>; + + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test; + + clock-frequency = <40000000>; + + resets = <&rstctrl 20>; + reset-names = "uart2"; + + interrupt-parent = <&intc>; + interrupts = <22>; + + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + + status = "disabled"; + }; + + pwm: pwm@5000 { + compatible = "mediatek,mt7628-pwm"; + reg = <0x5000 0x1000>; + + resets = <&rstctrl 31>; + reset-names = "pwm"; + + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pins>, <&pwm1_pins>; + + status = "disabled"; + }; + + pcm: pcm@2000 { + compatible = "ralink,mt7620a-pcm"; + reg = <0x2000 0x800>; + + resets = <&rstctrl 11>; + reset-names = "pcm"; + + interrupt-parent = <&intc>; + interrupts = <4>; + + status = "disabled"; + }; + + gdma: gdma@2800 { + compatible = "ralink,rt3883-gdma"; + reg = <0x2800 0x800>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&intc>; + interrupts = <7>; + + #dma-cells = <1>; + #dma-channels = <16>; + #dma-requests = <16>; + + status = "disabled"; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + spi_cs1_pins: spi_cs1 { + spi_cs1 { + ralink,group = "spi cs1"; + ralink,function = "spi cs1"; + }; + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + uart0_pins: uartlite { + uartlite { + ralink,group = "uart0"; + ralink,function = "uart0"; + }; + }; + + uart1_pins: uart1 { + uart1 { + ralink,group = "uart1"; + ralink,function = "uart1"; + }; + }; + + uart2_pins: uart2 { + uart2 { + ralink,group = "uart2"; + ralink,function = "uart2"; + }; + }; + + sdxc_pins: sdxc { + sdxc { + ralink,group = "sdmode"; + ralink,function = "sdxc"; + }; + }; + + pwm0_pins: pwm0 { + pwm0 { + ralink,group = "pwm0"; + ralink,function = "pwm0"; + }; + }; + + pwm1_pins: pwm1 { + pwm1 { + ralink,group = "pwm1"; + ralink,function = "pwm1"; + }; + }; + + pcm_i2s_pins: i2s { + i2s { + ralink,group = "i2s"; + ralink,function = "pcm"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,mt7620a-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + usbphy: usbphy@10120000 { + compatible = "ralink,mt7628an-usbphy", "mediatek,mt7620-usbphy"; + reg = <0x10120000 0x1000>; + #phy-cells = <1>; + + resets = <&rstctrl 22 &rstctrl 25>; + reset-names = "host", "device"; + clocks = <&clkctrl 22 &clkctrl 25>; + clock-names = "host", "device"; + }; + + sdhci: sdhci@10130000 { + compatible = "ralink,mt7620-sdhci"; + reg = <0x10130000 0x4000>; + + interrupt-parent = <&intc>; + interrupts = <14>; + + pinctrl-names = "default"; + pinctrl-0 = <&sdxc_pins>; + + status = "disabled"; + }; + + ehci: ehci@101c0000 { + compatible = "generic-ehci"; + reg = <0x101c0000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + }; + + ohci: ohci@101c1000 { + compatible = "generic-ohci"; + reg = <0x101c1000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + }; + + ethernet: ethernet@10100000 { + compatible = "ralink,rt5350-eth"; + reg = <0x10100000 0x10000>; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + resets = <&rstctrl 21 &rstctrl 23>; + reset-names = "fe", "esw"; + + mediatek,switch = <&esw>; + }; + + esw: esw@10110000 { + compatible = "mediatek,mt7628-esw", "ralink,rt3050-esw"; + reg = <0x10110000 0x8000>; + + resets = <&rstctrl 23>; + reset-names = "esw"; + + interrupt-parent = <&intc>; + interrupts = <17>; + }; + + pcie: pcie@10140000 { + compatible = "mediatek,mt7620-pci"; + reg = <0x10140000 0x100 + 0x10142000 0x100>; + + #address-cells = <3>; + #size-cells = <2>; + + interrupt-parent = <&cpuintc>; + interrupts = <4>; + + resets = <&rstctrl 26 &rstctrl 27>; + reset-names = "pcie0", "pcie1"; + clocks = <&clkctrl 26 &clkctrl 27>; + clock-names = "pcie0", "pcie1"; + + status = "disabled"; + + device_type = "pci"; + + bus-range = <0 255>; + ranges = < + 0x02000000 0 0x00000000 0x20000000 0 0x10000000 /* pci memory */ + 0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */ + >; + + pcie-bridge { + reg = <0x0000 0 0 0 0>; + + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + }; + }; + + wmac: wmac@10300000 { + compatible = "mediatek,mt7628-wmac"; + reg = <0x10300000 0x100000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + status = "disabled"; + + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,5ghz = <0>; + }; +}; diff --git a/target/linux/ramips/dts/rt2880.dtsi b/target/linux/ramips/dts/rt2880.dtsi new file mode 100644 index 0000000000..2d6230c7ad --- /dev/null +++ b/target/linux/ramips/dts/rt2880.dtsi @@ -0,0 +1,234 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,rt2880-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + aliases { + serial0 = &uartlite; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + palmbus: palmbus@300000 { + compatible = "palmbus"; + reg = <0x300000 0x200000>; + ranges = <0x0 0x300000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,rt2880-sysc"; + reg = <0x000 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + + status = "disabled"; + }; + + watchdog: watchdog@120 { + compatible = "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + }; + + intc: intc@200 { + compatible = "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,rt2880-memc"; + reg = <0x300 0x100>; + }; + + gpio0: gpio@600 { + compatible = "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + }; + + gpio1: gpio@638 { + compatible = "ralink,rt2880-gpio"; + reg = <0x638 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <24>; + ralink,num-gpios = <16>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio2: gpio@660 { + compatible = "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <40>; + ralink,num-gpios = <32>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + i2c: i2c@900 { + compatible = "ralink,rt2880-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 9>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + interrupt-parent = <&intc>; + interrupts = <8>; + + reg-shift = <2>; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + sdram { + ralink,group = "sdram"; + ralink,function = "sdram"; + }; + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + pci: pci@440000 { + compatible = "ralink,rt288x-pci"; + reg = <0x00440000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + }; + + ethernet: ethernet@400000 { + compatible = "ralink,rt2880-eth"; + reg = <0x00400000 0x10000>; + + #address-cells = <1>; + #size-cells = <0>; + + resets = <&rstctrl 18>; + reset-names = "fe"; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + status = "disabled"; + + port@0 { + compatible = "ralink,rt2880-port", "mediatek,eth-port"; + reg = <0>; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + }; + + wmac: wmac@480000 { + compatible = "ralink,rt2880-wmac"; + reg = <0x480000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; +}; diff --git a/target/linux/ramips/dts/rt3050.dtsi b/target/linux/ramips/dts/rt3050.dtsi new file mode 100644 index 0000000000..23da1c43ef --- /dev/null +++ b/target/linux/ramips/dts/rt3050.dtsi @@ -0,0 +1,335 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,rt3050-soc", "ralink,rt3052-soc", "ralink,rt3350-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + aliases { + spi0 = &spi0; + serial0 = &uartlite; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,rt3050-sysc"; + reg = <0x0 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,rt3050-timer", "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,rt3050-wdt", "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + intc: intc@200 { + compatible = "ralink,rt3050-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + resets = <&rstctrl 19>; + reset-names = "intc"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + uart: uart@500 { + compatible = "ralink,rt3050-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0x500 0x100>; + + resets = <&rstctrl 12>; + reset-names = "uart"; + + interrupt-parent = <&intc>; + interrupts = <5>; + + reg-shift = <2>; + + status = "disabled"; + }; + + gpio0: gpio@600 { + compatible = "ralink,rt3050-gpio", "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + + resets = <&rstctrl 13>; + reset-names = "pio"; + + interrupt-parent = <&intc>; + interrupts = <6>; + }; + + gpio1: gpio@638 { + compatible = "ralink,rt3050-gpio", "ralink,rt2880-gpio"; + reg = <0x638 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <24>; + ralink,num-gpios = <16>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio2: gpio@660 { + compatible = "ralink,rt3050-gpio", "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <40>; + ralink,num-gpios = <12>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gdma: gdma@700 { + compatible = "ralink,rt305x-gdma"; + reg = <0x700 0x100>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&intc>; + interrupts = <7>; + + #dma-cells = <1>; + #dma-channels = <8>; + #dma-requests = <8>; + + status = "disabled"; + }; + + i2c@900 { + compatible = "ralink,rt2880-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + i2s@a00 { + compatible = "ralink,rt3050-i2s"; + reg = <0xa00 0x100>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&intc>; + interrupts = <10>; + + txdma-req = <2>; + + dmas = <&gdma 4>; + dma-names = "tx"; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,rt3050-spi", "ralink,rt2880-spi"; + reg = <0xb00 0x100>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + + status = "disabled"; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,rt3050-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + resets = <&rstctrl 19>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <12>; + + reg-shift = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + sdram { + ralink,group = "sdram"; + ralink,function = "sdram"; + }; + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,rt3050-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + usbphy: usbphy { + compatible = "ralink,rt3050-usbphy"; + resets = <&rstctrl 22>; + reset-names = "host"; + clocks = <&clkctrl 18>; + clock-names = "host"; + }; + + ethernet: ethernet@10100000 { + compatible = "ralink,rt3050-eth"; + reg = <0x10100000 0x10000>; + + resets = <&rstctrl 21>; + reset-names = "fe"; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + mediatek,switch = <&esw>; + }; + + esw: esw@10110000 { + compatible = "ralink,rt3050-esw"; + reg = <0x10110000 0x8000>; + + resets = <&rstctrl 23>; + reset-names = "esw"; + + interrupt-parent = <&intc>; + interrupts = <17>; + }; + + wmac: wmac@10180000 { + compatible = "ralink,rt3050-wmac", "ralink,rt2880-wmac"; + reg = <0x10180000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; + + otg: otg@101c0000 { + compatible = "ralink,rt3050-otg", "snps,dwc2"; + reg = <0x101c0000 0x40000>; + + interrupt-parent = <&intc>; + interrupts = <18>; + + resets = <&rstctrl 22>; + reset-names = "otg"; + + status = "disabled"; + }; +}; diff --git a/target/linux/ramips/dts/rt3352.dtsi b/target/linux/ramips/dts/rt3352.dtsi new file mode 100644 index 0000000000..a617281b75 --- /dev/null +++ b/target/linux/ramips/dts/rt3352.dtsi @@ -0,0 +1,366 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,rt3352-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + spi0 = &spi0; + spi1 = &spi1; + serial0 = &uartlite; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,rt3352-sysc", "ralink,rt3050-sysc"; + reg = <0x0 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,rt3352-timer", "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,rt3352-wdt", "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + intc: intc@200 { + compatible = "ralink,rt3352-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,rt3352-memc", "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + uart: uart@500 { + compatible = "ralink,rt3352-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0x500 0x100>; + + resets = <&rstctrl 12>; + reset-names = "uart"; + + interrupt-parent = <&intc>; + interrupts = <5>; + + reg-shift = <2>; + + status = "disabled"; + }; + + gpio0: gpio@600 { + compatible = "ralink,rt3352-gpio", "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + resets = <&rstctrl 13>; + reset-names = "pio"; + + interrupt-parent = <&intc>; + interrupts = <6>; + }; + + gpio1: gpio@638 { + compatible = "ralink,rt3352-gpio", "ralink,rt2880-gpio"; + reg = <0x638 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <24>; + ralink,num-gpios = <16>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio2: gpio@660 { + compatible = "ralink,rt3352-gpio", "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <40>; + ralink,num-gpios = <6>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + i2c@900 { + compatible = "ralink,rt2880-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + i2s@a00 { + compatible = "ralink,rt3352-i2s"; + reg = <0xa00 0x100>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&intc>; + interrupts = <10>; + + txdma-req = <2>; + rxdma-req = <3>; + + dmas = <&gdma 4>, + <&gdma 6>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,rt3352-spi", "ralink,rt2880-spi"; + reg = <0xb00 0x40>; + #address-cells = <1>; + #size-cells = <0>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + + status = "disabled"; + }; + + spi1: spi@b40 { + compatible = "ralink,rt3352-spi", "ralink,rt2880-spi"; + reg = <0xb40 0x60>; + #address-cells = <1>; + #size-cells = <0>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_cs1>; + + status = "disabled"; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,rt3352-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + resets = <&rstctrl 19>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <12>; + + reg-shift = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; + }; + + gdma: gdma@2800 { + compatible = "ralink,rt3883-gdma"; + reg = <0x2800 0x800>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&intc>; + interrupts = <7>; + + #dma-cells = <1>; + #dma-channels = <16>; + #dma-requests = <16>; + + status = "disabled"; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + spi_cs1: spi1 { + spi1 { + ralink,group = "spi_cs1"; + ralink,function = "spi_cs1"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,rt3352-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + ethernet: ethernet@10100000 { + compatible = "ralink,rt3352-eth", "ralink,rt3050-eth"; + reg = <0x10100000 0x10000>; + + resets = <&rstctrl 21>; + reset-names = "fe"; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + mediatek,switch = <&esw>; + }; + + esw: esw@10110000 { + compatible = "ralink,rt3352-esw", "ralink,rt3050-esw"; + reg = <0x10110000 0x8000>; + + resets = <&rstctrl 23>; + reset-names = "esw"; + + interrupt-parent = <&intc>; + interrupts = <17>; + }; + + usbphy: usbphy { + compatible = "ralink,rt3352-usbphy"; + #phy-cells = <1>; + + resets = <&rstctrl 22 &rstctrl 25>; + reset-names = "host", "device"; + clocks = <&clkctrl 18 &clkctrl 20>; + clock-names = "host", "device"; + }; + + wmac: wmac@10180000 { + compatible = "ralink,rt3352-wmac", "ralink,rt2880-wmac"; + reg = <0x10180000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; + + ehci: ehci@101c0000 { + compatible = "generic-ehci"; + reg = <0x101c0000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + + status = "disabled"; + }; + + ohci: ohci@101c1000 { + compatible = "generic-ohci"; + reg = <0x101c1000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + + status = "disabled"; + }; +}; diff --git a/target/linux/ramips/dts/rt3883.dtsi b/target/linux/ramips/dts/rt3883.dtsi new file mode 100644 index 0000000000..64bc56b4a9 --- /dev/null +++ b/target/linux/ramips/dts/rt3883.dtsi @@ -0,0 +1,473 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,rt3883-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips74Kc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + aliases { + spi0 = &spi0; + spi1 = &spi1; + serial0 = &uartlite; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,rt3883-sysc", "ralink,rt3050-sysc"; + reg = <0x0 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,rt3883-timer", "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,rt3883-wdt", "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + intc: intc@200 { + compatible = "ralink,rt3883-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + resets = <&rstctrl 19>; + reset-names = "intc"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,rt3883-memc", "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + uart: uart@500 { + compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0x500 0x100>; + + resets = <&rstctrl 12>; + reset-names = "uart"; + + interrupt-parent = <&intc>; + interrupts = <5>; + + reg-shift = <2>; + + status = "disabled"; + }; + + gpio0: gpio@600 { + compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + resets = <&rstctrl 13>; + reset-names = "pio"; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + }; + + gpio1: gpio@638 { + compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio"; + reg = <0x638 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <24>; + ralink,num-gpios = <16>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio2: gpio@660 { + compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <40>; + ralink,num-gpios = <32>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + gpio3: gpio@688 { + compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio"; + reg = <0x688 0x24>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <72>; + ralink,num-gpios = <24>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + i2c@900 { + compatible = "ralink,rt2880-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + i2s@a00 { + compatible = "ralink,rt3883-i2s"; + reg = <0xa00 0x100>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&intc>; + interrupts = <10>; + + txdma-req = <2>; + rxdma-req = <3>; + + dmas = <&gdma 4>, + <&gdma 6>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,rt3883-spi", "ralink,rt2880-spi"; + reg = <0xb00 0x40>; + #address-cells = <1>; + #size-cells = <0>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + + status = "disabled"; + }; + + spi1: spi@b40 { + compatible = "ralink,rt3883-spi", "ralink,rt2880-spi"; + reg = <0xb40 0x60>; + #address-cells = <1>; + #size-cells = <0>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_cs1>; + + status = "disabled"; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + resets = <&rstctrl 19>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <12>; + + reg-shift = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; + }; + + gdma: gdma@2800 { + compatible = "ralink,rt3883-gdma"; + reg = <0x2800 0x800>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&intc>; + interrupts = <7>; + + #dma-cells = <1>; + #dma-channels = <16>; + #dma-requests = <16>; + + status = "disabled"; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + spi_cs1: spi1 { + spi1 { + ralink,group = "spi_cs1"; + ralink,function = "spi_cs1"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + }; + + ethernet: ethernet@10100000 { + compatible = "ralink,rt3883-eth"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x10100000 0x10000>; + + resets = <&rstctrl 21>; + reset-names = "fe"; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + port@0 { + compatible = "ralink,rt3883-port", "mediatek,eth-port"; + reg = <0>; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,rt3883-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + pci: pci@10140000 { + compatible = "ralink,rt3883-pci"; + reg = <0x10140000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; + ranges; /* direct mapping */ + + status = "disabled"; + + pciintc: interrupt-controller { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <4>; + }; + + host-bridge { + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + + device_type = "pci"; + + bus-range = <0 255>; + ranges = < + 0x02000000 0 0x00000000 0x20000000 0 0x10000000 /* pci memory */ + 0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */ + >; + + interrupt-map-mask = <0xf800 0 0 7>; + interrupt-map = < + /* IDSEL 17 */ + 0x8800 0 0 1 &pciintc 18 + 0x8800 0 0 2 &pciintc 18 + 0x8800 0 0 3 &pciintc 18 + 0x8800 0 0 4 &pciintc 18 + /* IDSEL 18 */ + 0x9000 0 0 1 &pciintc 19 + 0x9000 0 0 2 &pciintc 19 + 0x9000 0 0 3 &pciintc 19 + 0x9000 0 0 4 &pciintc 19 + >; + + pci-bridge@1 { + reg = <0x0800 0 0 0 0>; + device_type = "pci"; + #interrupt-cells = <1>; + #address-cells = <3>; + #size-cells = <2>; + + status = "disabled"; + + ralink,pci-slot = <1>; + + interrupt-map-mask = <0x0 0 0 0>; + interrupt-map = <0x0 0 0 0 &pciintc 20>; + }; + + pci-slot@17 { + 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 { + reg = <0x9000 0 0 0 0>; + device_type = "pci"; + #interrupt-cells = <1>; + #address-cells = <3>; + #size-cells = <2>; + + ralink,pci-slot = <18>; + + status = "disabled"; + }; + }; + }; + + usbphy: usbphy { + compatible = "ralink,rt3352-usbphy"; + #phy-cells = <1>; + + resets = <&rstctrl 22 &rstctrl 25>; + reset-names = "host", "device"; + clocks = <&clkctrl 22 &clkctrl 25>; + clock-names = "host", "device"; + }; + + wmac: wmac@10180000 { + compatible = "ralink,rt3883-wmac", "ralink,rt2880-wmac"; + reg = <0x10180000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; + + ehci: ehci@101c0000 { + compatible = "generic-ehci"; + reg = <0x101c0000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + + status = "disabled"; + }; + + ohci: ohci@101c1000 { + compatible = "generic-ohci"; + reg = <0x101c1000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + + status = "disabled"; + }; +}; diff --git a/target/linux/ramips/dts/rt5350.dtsi b/target/linux/ramips/dts/rt5350.dtsi new file mode 100644 index 0000000000..5310ce8227 --- /dev/null +++ b/target/linux/ramips/dts/rt5350.dtsi @@ -0,0 +1,377 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ralink,rt5350-soc"; + + cpus { + cpu@0 { + compatible = "mips,mips24KEc"; + }; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + spi0 = &spi0; + spi1 = &spi1; + serial0 = &uartlite; + }; + + palmbus: palmbus@10000000 { + compatible = "palmbus"; + reg = <0x10000000 0x200000>; + ranges = <0x0 0x10000000 0x1FFFFF>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: sysc@0 { + compatible = "ralink,rt5350-sysc", "ralink,rt3050-sysc"; + reg = <0x0 0x100>; + }; + + timer: timer@100 { + compatible = "ralink,rt5350-timer", "ralink,rt2880-timer"; + reg = <0x100 0x20>; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + watchdog: watchdog@120 { + compatible = "ralink,rt5350-wdt", "ralink,rt2880-wdt"; + reg = <0x120 0x10>; + + resets = <&rstctrl 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <1>; + }; + + intc: intc@200 { + compatible = "ralink,rt5350-intc", "ralink,rt2880-intc"; + reg = <0x200 0x100>; + + resets = <&rstctrl 19>; + reset-names = "intc"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + memc: memc@300 { + compatible = "ralink,rt5350-memc", "ralink,rt3050-memc"; + reg = <0x300 0x100>; + + resets = <&rstctrl 20>; + reset-names = "mc"; + + interrupt-parent = <&intc>; + interrupts = <3>; + }; + + uart: uart@500 { + compatible = "ralink,rt5350-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0x500 0x100>; + + resets = <&rstctrl 12>; + reset-names = "uart"; + + interrupt-parent = <&intc>; + interrupts = <5>; + + reg-shift = <2>; + + status = "disabled"; + }; + + gpio0: gpio@600 { + compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio"; + reg = <0x600 0x34>; + + resets = <&rstctrl 13>; + reset-names = "pio"; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <0>; + ralink,num-gpios = <22>; + ralink,register-map = [ 00 04 08 0c + 20 24 28 2c + 30 34 ]; + }; + + gpio1: gpio@660 { + compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio"; + reg = <0x660 0x24>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio-controller; + #gpio-cells = <2>; + + ralink,gpio-base = <22>; + ralink,num-gpios = <6>; + ralink,register-map = [ 00 04 08 0c + 10 14 18 1c + 20 24 ]; + + status = "disabled"; + }; + + i2c: i2c@900 { + compatible = "ralink,rt2880-i2c"; + reg = <0x900 0x100>; + + resets = <&rstctrl 16>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + + status = "disabled"; + }; + + i2s: i2s@a00 { + compatible = "ralink,rt3352-i2s"; + reg = <0xa00 0x100>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + interrupt-parent = <&intc>; + interrupts = <10>; + + txdma-req = <2>; + rxdma-req = <3>; + + dmas = <&gdma 4>, + <&gdma 6>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + + spi0: spi@b00 { + compatible = "ralink,rt5350-spi", "ralink,rt2880-spi"; + reg = <0xb00 0x40>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + + status = "disabled"; + }; + + spi1: spi@b40 { + compatible = "ralink,rt5350-spi", "ralink,rt2880-spi"; + reg = <0xb40 0x60>; + + resets = <&rstctrl 18>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_cs1>; + + status = "disabled"; + }; + + uartlite: uartlite@c00 { + compatible = "ralink,rt5350-uart", "ralink,rt2880-uart", "ns16550a"; + reg = <0xc00 0x100>; + + resets = <&rstctrl 19>; + reset-names = "uartl"; + + interrupt-parent = <&intc>; + interrupts = <12>; + + pinctrl-names = "default"; + pinctrl-0 = <&uartlite_pins>; + + reg-shift = <2>; + }; + + systick: systick@d00 { + compatible = "ralink,rt5350-systick", "ralink,cevt-systick"; + reg = <0xd00 0x10>; + + interrupt-parent = <&cpuintc>; + interrupts = <7>; + }; + + gdma: gdma@2800 { + compatible = "ralink,rt3883-gdma"; + reg = <0x2800 0x800>; + + resets = <&rstctrl 14>; + reset-names = "dma"; + + interrupt-parent = <&intc>; + interrupts = <7>; + + #dma-cells = <1>; + #dma-channels = <16>; + #dma-requests = <16>; + + status = "disabled"; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + }; + + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + + spi_pins: spi { + spi { + ralink,group = "spi"; + ralink,function = "spi"; + }; + }; + + phy_led_pins: phy_led { + phy_led { + ralink,group = "led"; + ralink,function = "led"; + }; + }; + + uartlite_pins: uartlite { + uart { + ralink,group = "uartlite"; + ralink,function = "uartlite"; + }; + }; + + uartf_pins: uartf { + uartf { + ralink,group = "uartf"; + ralink,function = "uartf"; + }; + }; + + spi_cs1: spi1 { + spi1 { + ralink,group = "spi_cs1"; + ralink,function = "spi_cs1"; + }; + }; + }; + + rstctrl: rstctrl { + compatible = "ralink,rt5350-reset", "ralink,rt2880-reset"; + #reset-cells = <1>; + }; + + clkctrl: clkctrl { + compatible = "ralink,rt2880-clock"; + #clock-cells = <1>; + }; + + usbphy: usbphy { + compatible = "ralink,rt3352-usbphy"; + #phy-cells = <1>; + + resets = <&rstctrl 22 &rstctrl 25>; + reset-names = "host", "device"; + clocks = <&clkctrl 18>; + clock-names = "host"; + }; + + ethernet: ethernet@10100000 { + compatible = "ralink,rt5350-eth"; + reg = <0x10100000 0x10000>; + + resets = <&rstctrl 21 &rstctrl 23>; + reset-names = "fe", "esw"; + + interrupt-parent = <&cpuintc>; + interrupts = <5>; + + mediatek,switch = <&esw>; + }; + + esw: esw@10110000 { + compatible = "ralink,rt5350-esw", "ralink,rt3050-esw"; + reg = <0x10110000 0x8000>; + + resets = <&rstctrl 23>; + reset-names = "esw"; + + interrupt-parent = <&intc>; + interrupts = <17>; + }; + + wmac: wmac@10180000 { + compatible = "ralink,rt5350-wmac", "ralink,rt2880-wmac"; + reg = <0x10180000 0x40000>; + + interrupt-parent = <&cpuintc>; + interrupts = <6>; + + ralink,eeprom = "soc_wmac.eeprom"; + }; + + ehci: ehci@101c0000 { + compatible = "generic-ehci"; + reg = <0x101c0000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + }; + + ohci: ohci@101c1000 { + compatible = "generic-ohci"; + reg = <0x101c1000 0x1000>; + + phys = <&usbphy 1>; + phy-names = "usb"; + + interrupt-parent = <&intc>; + interrupts = <18>; + }; +}; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile new file mode 100644 index 0000000000..255aa8c5e6 --- /dev/null +++ b/target/linux/ramips/image/Makefile @@ -0,0 +1,254 @@ +# +# Copyright (C) 2008-2011 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 + +define imgname +$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1) +endef + +define sysupname +$(call imgname,$(1),$(2))-sysupgrade.bin +endef + +VMLINUX:=$(IMG_PREFIX)-vmlinux +UIMAGE:=$(IMG_PREFIX)-uImage + +define Image/Build/Initramfs + $(call Image/Build/Profile/$(PROFILE),initramfs) +endef + +DEVICE_VARS += DTS IMAGE_SIZE + +loadaddr-y := 0x80000000 +loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000 +loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000 + +KERNEL_LOADADDR := $(loadaddr-y) + +KERNEL_DTB = kernel-bin | patch-dtb | lzma +define Device/Default + PROFILES = Default $$(DTS) + KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts) + KERNEL := $(KERNEL_DTB) | uImage lzma + IMAGES := sysupgrade.bin + IMAGE_SIZE := $(ralink_default_fw_size_8M) + SUPPORTED_DEVICES = $(1) + sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) +endef + +define Build/patch-dtb + $(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb) + $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb +endef + +define Build/trx + $(STAGING_DIR_HOST)/bin/trx \ + -o $@ \ + -m $(IMAGE_SIZE) \ + -f $(IMAGE_KERNEL) \ + -a 4 -f $(IMAGE_ROOTFS) +endef + +define Build/relocate-kernel + ( \ + dd if=$(KDIR)/loader.bin bs=32 conv=sync && \ + perl -e '@s = stat("$@"); print pack("V", @s[7])' && \ + cat $@ \ + ) > $@.new + mv $@.new $@ +endef + +define MkCombineduImage + $(call PatchKernelLzma,$(2),$(3)) + if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \ + echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big" >&2; \ + else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \ + echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \ + else \ + ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=`expr $(4) - 64` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.lzma.combined ; \ + fi ; fi + $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.combined,$(call sysupname,$(1),$(2)),$(6)) +endef + +define Build/umedia-header + fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@ +endef + +define Build/edimax-header + $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) + @mv $@.new $@ +endef + +define Build/poray-header + $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new + 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 $@ +endef + +define Build/seama-seal + $(call Build/seama,-s $@.seama $(1)) +endef + +define Build/wrg-header + mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new + mv $@.new $@ +endef + +# +# The real magic happens inside these templates +# +# $(1), compression method +# $(2), filename of image data +# $(3), output filename +define MkImage + $(eval imagename=$(if $(4),$(4),MIPS OpenWrt Linux-$(LINUX_VERSION))) + -mkimage -A mips -O linux -T kernel -C $(1) -a $(loadaddr-y) -e $(loadaddr-y) \ + -n "$(imagename)" \ + -d $(2) $(3) +endef + +define CompressLzma + $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2) +endef + +define MkImageSysupgrade/squashfs + $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin) + cat $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) > $(KDIR)/$(output_name) + $(call prepare_generic_squashfs,$(KDIR)/$(output_name)) + if [ `stat -c%s "$(KDIR)/$(output_name)"` -gt $(3) ]; then \ + echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \ + else \ + $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \ + fi +endef + +# $(1), lowercase board name like "mt7620a_v22sg" +# $(2), DTS filename without .dts extension +# $(3), optional filename suffix, e.g. "-initramfs" +define PatchKernelLzmaDtb + cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3) + $(call Image/BuildDTB,../dts/$(2).dts,$(KDIR)/$(2).dtb) + $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb + $(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma) +endef + +# $(1), lowercase board name +# $(2), DTS filename without .dts extension +# $(3), ih_name field of uImage header +# $(4), optional filename suffix, e.g. "-initramfs" +define MkImageLzmaDtb + $(call PatchKernelLzmaDtb,$(1),$(2),$(4)) + $(call MkImage,lzma,$(KDIR)/vmlinux-$(1)$(4).bin.lzma,$(KDIR)/vmlinux-$(1)$(4).uImage,$(3)) +endef + +# $(1), Rootfs type, e.g. squashfs +# $(2), lowercase board name +# $(3), DTS filename without .dts extension +# $(4), maximum size of sysupgrade image +# $(5), uImage header's ih_name field +define BuildFirmware/OF + $(call MkImageLzmaDtb,$(2),$(3),$(5)) + $(call MkImageSysupgrade/$(1),$(1),$(2),$(4),$(6)) +endef + +# $(1), squashfs/initramfs +# $(2), lowercase board name +# $(3), DTS filename without .dts extension +# $(4), ih_name field of uImage header +define BuildFirmware/OF/initramfs + $(call MkImageLzmaDtb,$(2),$(3),$(4),-initramfs) + $(CP) $(KDIR)/vmlinux-$(2)-initramfs.uImage $(call imgname,$(1),$(2))-uImage.bin +endef + +# Build images for default ralink layout for 4MB flash +# kernel + roots = 0x3b0000 +# $(1) = squashfs/initramfs +# $(2) = lowercase board name +# $(3) = dts file +ralink_default_fw_size_4M=3866624 +BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M),$(4)) +BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4)) + +ralink_default_fw_size_8M=8060928 +ralink_default_fw_size_16M=16121856 +ralink_default_fw_size_32M=33226752 + + +ifeq ($(SUBTARGET),rt288x) +include rt288x.mk +endif + +ifeq ($(SUBTARGET),rt305x) +include rt305x.mk +include rt305x-legacy.mk +endif + +ifeq ($(SUBTARGET),rt3883) +include rt3883.mk +endif + +ifeq ($(SUBTARGET),mt7620) +include mt7620.mk +endif + +ifeq ($(SUBTARGET),mt7621) +include mt7621.mk +endif + +ifeq ($(SUBTARGET),mt7628) +include mt7628.mk +endif + +ifeq ($(SUBTARGET),mt7688) +include mt7688.mk +endif + +ifdef LEGACY_DEVICES +# +# Generic Targets - only needed for legacy image building code +# +define Image/BuildKernel + cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf + cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin + $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma) + $(call MkImage,lzma,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma) + cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(UIMAGE).bin +endef + +define Image/BuildKernel/Initramfs + cp $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(VMLINUX)-initramfs.elf + cp $(KDIR)/vmlinux-initramfs $(BIN_DIR)/$(VMLINUX)-initramfs.bin + $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma) + $(call MkImage,lzma,$(KDIR)/vmlinux-initramfs.bin.lzma,$(KDIR)/uImage-initramfs.lzma) + cp $(KDIR)/uImage-initramfs.lzma $(BIN_DIR)/$(UIMAGE)-initramfs.bin + $(call Image/Build/Initramfs) +endef + +define Image/Build + $(call Image/Build/$(1)) + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync +endef + +define Image/Build/Profile + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Image/Build/Profile/$(1),initramfs)) + $(call Image/Build/Profile/$(1),$(2)) +endef + +endif + +$(eval $(call BuildImage)) diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage b/target/linux/ramips/image/ex2700-fakeroot.uImage new file mode 100644 index 0000000000000000000000000000000000000000..9a534b63502d5e7cdf1d7a7fe644a5025651387c GIT binary patch literal 64 lcmY#ql? +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +LZMA_TEXT_START := 0x80a00000 +LOADER := loader.bin +LOADER_NAME := $(basename $(notdir $(LOADER))) +LOADER_DATA := +TARGET_DIR := +FLASH_OFFS := +FLASH_MAX := +BOARD := + +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 + +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_TEXT_START=$(LZMA_TEXT_START) \ + LOADER_DATA=$(LOADER_DATA) \ + FLASH_OFFS=$(FLASH_OFFS) \ + FLASH_MAX=$(FLASH_MAX) \ + BOARD="$(BOARD)" \ + PLATFORM="ralink" \ + 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/ramips/image/lzma-loader/src/LzmaDecode.c b/target/linux/ramips/image/lzma-loader/src/LzmaDecode.c new file mode 100644 index 0000000000..cb8345377e --- /dev/null +++ b/target/linux/ramips/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/ramips/image/lzma-loader/src/LzmaDecode.h b/target/linux/ramips/image/lzma-loader/src/LzmaDecode.h new file mode 100644 index 0000000000..2870eeb9c9 --- /dev/null +++ b/target/linux/ramips/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/ramips/image/lzma-loader/src/LzmaTypes.h b/target/linux/ramips/image/lzma-loader/src/LzmaTypes.h new file mode 100644 index 0000000000..9c27290757 --- /dev/null +++ b/target/linux/ramips/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/ramips/image/lzma-loader/src/Makefile b/target/linux/ramips/image/lzma-loader/src/Makefile new file mode 100644 index 0000000000..f861666e62 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/Makefile @@ -0,0 +1,110 @@ +# +# Makefile for the LZMA compressed kernel loader for +# Atheros AR7XXX/AR9XXX based boards +# +# Copyright (C) 2011 Gabor Juhos +# +# Some parts of this file was based on the OpenWrt specific lzma-loader +# for the BCM47xx and ADM5120 based boards: +# Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org) +# Copyright (C) 2005 Mineharu Takahara +# 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 version 2 as published +# by the Free Software Foundation. +# + +LOADADDR := +LZMA_TEXT_START := 0x80a00000 +LOADER_DATA := +BOARD := +FLASH_OFFS := +FLASH_MAX := +PLATFORM := + +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=mips32r2 \ + -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap +CFLAGS += -D_LZMA_PROB32 -DARCH=$(PLATFORM) + +ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +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 loader.o cache.o board-$(PLATFORM).o printf.o LzmaDecode.o + +include $(PLATFORM).mk +CFLAGS+=$(CACHE_FLAGS) +ASFLAGS+=$(CACHE_FLAGS) + +ifneq ($(strip $(LOADER_DATA)),) +OBJECTS += data.o +CFLAGS += -DLZMA_WRAPPER=1 -DLOADADDR=$(LOADADDR) +endif + +ifneq ($(strip $(KERNEL_CMDLINE)),) +CFLAGS += -DCONFIG_KERNEL_CMDLINE='"$(KERNEL_CMDLINE)"' +endif + +ifneq ($(strip $(FLASH_OFFS)),) +CFLAGS += -DCONFIG_FLASH_OFFS=$(FLASH_OFFS) +endif + +ifneq ($(strip $(FLASH_MAX)),) +CFLAGS += -DCONFIG_FLASH_MAX=$(FLASH_MAX) +endif + +BOARD_DEF := $(shell echo $(strip $(BOARD)) | tr a-z A-Z | tr - _) +ifneq ($(BOARD_DEF),) +CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF) +endif + +all: loader.elf + +# 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: $(OBJECTS) + $(LD) $(LDFLAGS) -o $@ $(OBJECTS) + +loader.bin: loader + $(OBJCOPY) $(BIN_FLAGS) $< $@ + +loader2.o: loader.bin + $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $< + +loader.elf: loader2.o + $(LD) -e startup -T loader2.lds -Ttext $(LOADADDR) -o $@ $< + +mrproper: clean + +clean: + rm -f loader *.elf *.bin *.o + + + diff --git a/target/linux/ramips/image/lzma-loader/src/board-ralink.c b/target/linux/ramips/image/lzma-loader/src/board-ralink.c new file mode 100644 index 0000000000..7c947ec6eb --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/board-ralink.c @@ -0,0 +1,42 @@ +/* + * Arch specific code for Ralink based boards + * + * Copyright (C) 2013 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 "config.h" + +#define READREG(r) *(volatile unsigned int *)(r) +#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v + +#define KSEG1ADDR(_x) (((_x) & 0x1fffffff) | 0xa0000000) + +#ifdef CONFIG_SOC_RT288X +#define UART_BASE 0xb0300c00 +#else +#define UART_BASE 0xb0000c00 +#endif + +#define UART_TX 1 +#define UART_LSR 7 + +#define UART_LSR_THRE 0x20 + +#define UART_READ(r) READREG(UART_BASE + 4 * (r)) +#define UART_WRITE(r,v) WRITEREG(UART_BASE + 4 * (r), (v)) + +void board_putc(int ch) +{ + while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0); + UART_WRITE(UART_TX, ch); + while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0); +} + +void board_init(void) +{ +} diff --git a/target/linux/ramips/image/lzma-loader/src/cache.c b/target/linux/ramips/image/lzma-loader/src/cache.c new file mode 100644 index 0000000000..28cc848333 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/cache.c @@ -0,0 +1,43 @@ +/* + * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards + * + * Copyright (C) 2011 Gabor Juhos + * + * The cache manipulation routine has been taken from the U-Boot project. + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, + * + * 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 "cache.h" +#include "cacheops.h" +#include "config.h" + +#define cache_op(op,addr) \ + __asm__ __volatile__( \ + " .set push \n" \ + " .set noreorder \n" \ + " .set mips3\n\t \n" \ + " cache %0, %1 \n" \ + " .set pop \n" \ + : \ + : "i" (op), "R" (*(unsigned char *)(addr))) + +void flush_cache(unsigned long start_addr, unsigned long size) +{ + unsigned long lsize = CONFIG_CACHELINE_SIZE; + unsigned long addr = start_addr & ~(lsize - 1); + unsigned long aend = (start_addr + size - 1) & ~(lsize - 1); + + while (1) { + cache_op(Hit_Writeback_Inv_D, addr); + cache_op(Hit_Invalidate_I, addr); + if (addr == aend) + break; + addr += lsize; + } +} diff --git a/target/linux/ramips/image/lzma-loader/src/cache.h b/target/linux/ramips/image/lzma-loader/src/cache.h new file mode 100644 index 0000000000..506a235884 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/cache.h @@ -0,0 +1,17 @@ +/* + * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards + * + * Copyright (C) 2011 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 __CACHE_H +#define __CACHE_H + +void flush_cache(unsigned long start_addr, unsigned long size); + +#endif /* __CACHE_H */ diff --git a/target/linux/ramips/image/lzma-loader/src/cacheops.h b/target/linux/ramips/image/lzma-loader/src/cacheops.h new file mode 100644 index 0000000000..70bcad7694 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/cacheops.h @@ -0,0 +1,85 @@ +/* + * Cache operations for the cache instruction. + * + * 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. + * + * (C) Copyright 1996, 97, 99, 2002, 03 Ralf Baechle + * (C) Copyright 1999 Silicon Graphics, Inc. + */ +#ifndef __ASM_CACHEOPS_H +#define __ASM_CACHEOPS_H + +/* + * Cache Operations available on all MIPS processors with R4000-style caches + */ +#define Index_Invalidate_I 0x00 +#define Index_Writeback_Inv_D 0x01 +#define Index_Load_Tag_I 0x04 +#define Index_Load_Tag_D 0x05 +#define Index_Store_Tag_I 0x08 +#define Index_Store_Tag_D 0x09 +#if defined(CONFIG_CPU_LOONGSON2) +#define Hit_Invalidate_I 0x00 +#else +#define Hit_Invalidate_I 0x10 +#endif +#define Hit_Invalidate_D 0x11 +#define Hit_Writeback_Inv_D 0x15 + +/* + * R4000-specific cacheops + */ +#define Create_Dirty_Excl_D 0x0d +#define Fill 0x14 +#define Hit_Writeback_I 0x18 +#define Hit_Writeback_D 0x19 + +/* + * R4000SC and R4400SC-specific cacheops + */ +#define Index_Invalidate_SI 0x02 +#define Index_Writeback_Inv_SD 0x03 +#define Index_Load_Tag_SI 0x06 +#define Index_Load_Tag_SD 0x07 +#define Index_Store_Tag_SI 0x0A +#define Index_Store_Tag_SD 0x0B +#define Create_Dirty_Excl_SD 0x0f +#define Hit_Invalidate_SI 0x12 +#define Hit_Invalidate_SD 0x13 +#define Hit_Writeback_Inv_SD 0x17 +#define Hit_Writeback_SD 0x1b +#define Hit_Set_Virtual_SI 0x1e +#define Hit_Set_Virtual_SD 0x1f + +/* + * R5000-specific cacheops + */ +#define R5K_Page_Invalidate_S 0x17 + +/* + * RM7000-specific cacheops + */ +#define Page_Invalidate_T 0x16 + +/* + * R10000-specific cacheops + * + * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused. + * Most of the _S cacheops are identical to the R4000SC _SD cacheops. + */ +#define Index_Writeback_Inv_S 0x03 +#define Index_Load_Tag_S 0x07 +#define Index_Store_Tag_S 0x0B +#define Hit_Invalidate_S 0x13 +#define Cache_Barrier 0x14 +#define Hit_Writeback_Inv_S 0x17 +#define Index_Load_Data_I 0x18 +#define Index_Load_Data_D 0x19 +#define Index_Load_Data_S 0x1b +#define Index_Store_Data_I 0x1c +#define Index_Store_Data_D 0x1d +#define Index_Store_Data_S 0x1f + +#endif /* __ASM_CACHEOPS_H */ diff --git a/target/linux/ramips/image/lzma-loader/src/config.h b/target/linux/ramips/image/lzma-loader/src/config.h new file mode 100644 index 0000000000..b7719e9ca8 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/config.h @@ -0,0 +1,27 @@ +/* + * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards + * + * Copyright (C) 2011 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 _CONFIG_H_ +#define _CONFIG_H_ + +#ifndef CONFIG_FLASH_OFFS +#define CONFIG_FLASH_OFFS 0 +#endif + +#ifndef CONFIG_FLASH_MAX +#define CONFIG_FLASH_MAX 0 +#endif + +#ifndef CONFIG_FLASH_STEP +#define CONFIG_FLASH_STEP 0x1000 +#endif + +#endif /* _CONFIG_H_ */ diff --git a/target/linux/ramips/image/lzma-loader/src/cp0regdef.h b/target/linux/ramips/image/lzma-loader/src/cp0regdef.h new file mode 100644 index 0000000000..c1188ad8c8 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/cp0regdef.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001 by Ralf Baechle + * + * Copyright (C) 2001, Monta Vista Software + * Author: jsun@mvista.com or jsun@junsun.net + */ +#ifndef _cp0regdef_h_ +#define _cp0regdef_h_ + +#define CP0_INDEX $0 +#define CP0_RANDOM $1 +#define CP0_ENTRYLO0 $2 +#define CP0_ENTRYLO1 $3 +#define CP0_CONTEXT $4 +#define CP0_PAGEMASK $5 +#define CP0_WIRED $6 +#define CP0_BADVADDR $8 +#define CP0_COUNT $9 +#define CP0_ENTRYHI $10 +#define CP0_COMPARE $11 +#define CP0_STATUS $12 +#define CP0_CAUSE $13 +#define CP0_EPC $14 +#define CP0_PRID $15 +#define CP0_CONFIG $16 +#define CP0_LLADDR $17 +#define CP0_WATCHLO $18 +#define CP0_WATCHHI $19 +#define CP0_XCONTEXT $20 +#define CP0_FRAMEMASK $21 +#define CP0_DIAGNOSTIC $22 +#define CP0_PERFORMANCE $25 +#define CP0_ECC $26 +#define CP0_CACHEERR $27 +#define CP0_TAGLO $28 +#define CP0_TAGHI $29 +#define CP0_ERROREPC $30 + +#endif diff --git a/target/linux/ramips/image/lzma-loader/src/head.S b/target/linux/ramips/image/lzma-loader/src/head.S new file mode 100644 index 0000000000..47a7c9bd63 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/head.S @@ -0,0 +1,121 @@ +/* + * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards + * + * Copyright (C) 2011 Gabor Juhos + * + * Some parts of this code was based on the OpenWrt specific lzma-loader + * for the BCM47xx and ADM5120 based boards: + * Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org) + * 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 version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include "cp0regdef.h" +#include "cacheops.h" +#include "config.h" + +#define KSEG0 0x80000000 + + .macro ehb + sll zero, 3 + .endm + + .text + +LEAF(startup) + .set noreorder + .set mips32 + + mtc0 zero, CP0_WATCHLO # clear watch registers + mtc0 zero, CP0_WATCHHI + mtc0 zero, CP0_CAUSE # clear before writing status register + + mfc0 t0, CP0_STATUS + li t1, 0x1000001f + or t0, t1 + xori t0, 0x1f + mtc0 t0, CP0_STATUS + ehb + + mtc0 zero, CP0_COUNT + mtc0 zero, CP0_COMPARE + ehb + + 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 + + beqz t0, __reloc_done # 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 + + /* flush cache */ + la t0, _code_start + la t1, _code_end + + li t2, ~(CONFIG_CACHELINE_SIZE - 1) + and t0, t2 + and t1, t2 + li t2, CONFIG_CACHELINE_SIZE + + b __flush_check + nop + +__flush_line: + cache Hit_Writeback_Inv_D, 0(t0) + cache Hit_Invalidate_I, 0(t0) + add t0, t2 + +__flush_check: + bne t0, t1, __flush_line + nop + + sync + +__reloc_done: + + /* clear bss */ + la t0, _bss_start + la t1, _bss_end + b __bss_check + nop + +__bss_fill: + sw zero, 0(t0) + addi t0, 4 + +__bss_check: + bne t0, t1, __bss_fill + nop + + /* Setup new "C" stack */ + la sp, _stack + + /* reserve stack space for a0-a3 registers */ + subu sp, 16 + + /* jump to the decompressor routine */ + la t0, loader_main + jr t0 + nop + + .set reorder +END(startup) diff --git a/target/linux/ramips/image/lzma-loader/src/lantiq.mk b/target/linux/ramips/image/lzma-loader/src/lantiq.mk new file mode 100644 index 0000000000..413764593b --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/lantiq.mk @@ -0,0 +1 @@ +CACHE_FLAGS+=-DCONFIG_ICACHE_SIZE="(32 * 1024)" -DCONFIG_DCACHE_SIZE="(32 * 1024)" -DCONFIG_CACHELINE_SIZE=32 diff --git a/target/linux/ramips/image/lzma-loader/src/loader.c b/target/linux/ramips/image/lzma-loader/src/loader.c new file mode 100644 index 0000000000..1d42bfa2f7 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/loader.c @@ -0,0 +1,263 @@ +/* + * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards + * + * Copyright (C) 2011 Gabor Juhos + * + * Some parts of this code was based on the OpenWrt specific lzma-loader + * for the BCM47xx and ADM5120 based boards: + * Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org) + * Copyright (C) 2005 Mineharu Takahara + * Copyright (C) 2005 by Oleg I. Vdovikin + * + * The image_header structure has been taken from the U-Boot project. + * (C) Copyright 2008 Semihalf + * (C) Copyright 2000-2005 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * 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 "config.h" +#include "cache.h" +#include "printf.h" +#include "LzmaDecode.h" + +#define AR71XX_FLASH_START 0x1f000000 +#define AR71XX_FLASH_END 0x1fe00000 + +#define KSEG0 0x80000000 +#define KSEG1 0xa0000000 + +#define KSEG1ADDR(a) ((((unsigned)(a)) & 0x1fffffffU) | KSEG1) + +#undef LZMA_DEBUG + +#ifdef LZMA_DEBUG +# define DBG(f, a...) printf(f, ## a) +#else +# define DBG(f, a...) do {} while (0) +#endif + +#define IH_MAGIC_OKLI 0x4f4b4c49 /* 'OKLI' */ + +#define IH_NMLEN 32 /* Image Name Length */ + +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 */ + uint8_t ih_name[IH_NMLEN]; /* Image Name */ +} image_header_t; + +/* beyond the image end, size not known in advance */ +extern unsigned char workspace[]; +extern void board_init(void); + +static CLzmaDecoderState lzma_state; +static unsigned char *lzma_data; +static unsigned long lzma_datasize; +static unsigned long lzma_outsize; +static unsigned long kernel_la; + +#ifdef CONFIG_KERNEL_CMDLINE +#define kernel_argc 1 +static const char kernel_cmdline[] = CONFIG_KERNEL_CMDLINE; +static const char *kernel_argv[] = { + kernel_cmdline, + NULL, +}; +#endif /* CONFIG_KERNEL_CMDLINE */ + +static void halt(void) +{ + printf("\nSystem halted!\n"); + for(;;); +} + +static __inline__ unsigned long get_be32(void *buf) +{ + unsigned char *p = buf; + + return (((unsigned long) p[0] << 24) + + ((unsigned long) p[1] << 16) + + ((unsigned long) p[2] << 8) + + (unsigned long) p[3]); +} + +static __inline__ unsigned char lzma_get_byte(void) +{ + unsigned char c; + + lzma_datasize--; + c = *lzma_data++; + + return c; +} + +static int lzma_init_props(void) +{ + unsigned char props[LZMA_PROPERTIES_SIZE]; + int res; + int i; + + /* read lzma properties */ + for (i = 0; i < LZMA_PROPERTIES_SIZE; i++) + props[i] = lzma_get_byte(); + + /* read the lower half of uncompressed size in the header */ + lzma_outsize = ((SizeT) lzma_get_byte()) + + ((SizeT) lzma_get_byte() << 8) + + ((SizeT) lzma_get_byte() << 16) + + ((SizeT) lzma_get_byte() << 24); + + /* skip rest of the header (upper half of uncompressed size) */ + for (i = 0; i < 4; i++) + lzma_get_byte(); + + res = LzmaDecodeProperties(&lzma_state.Properties, props, + LZMA_PROPERTIES_SIZE); + return res; +} + +static int lzma_decompress(unsigned char *outStream) +{ + SizeT ip, op; + int ret; + + lzma_state.Probs = (CProb *) workspace; + + ret = LzmaDecode(&lzma_state, lzma_data, lzma_datasize, &ip, outStream, + lzma_outsize, &op); + + if (ret != LZMA_RESULT_OK) { + int i; + + DBG("LzmaDecode error %d at %08x, osize:%d ip:%d op:%d\n", + ret, lzma_data + ip, lzma_outsize, ip, op); + + for (i = 0; i < 16; i++) + DBG("%02x ", lzma_data[ip + i]); + + DBG("\n"); + } + + return ret; +} + +#if (LZMA_WRAPPER) +static void lzma_init_data(void) +{ + extern unsigned char _lzma_data_start[]; + extern unsigned char _lzma_data_end[]; + + kernel_la = LOADADDR; + lzma_data = _lzma_data_start; + lzma_datasize = _lzma_data_end - _lzma_data_start; +} +#else +static void lzma_init_data(void) +{ + struct image_header *hdr = NULL; + unsigned char *flash_base; + unsigned long flash_ofs; + unsigned long kernel_ofs; + unsigned long kernel_size; + + flash_base = (unsigned char *) KSEG1ADDR(AR71XX_FLASH_START); + + printf("Looking for OpenWrt image... "); + + for (flash_ofs = CONFIG_FLASH_OFFS; + flash_ofs <= (CONFIG_FLASH_OFFS + CONFIG_FLASH_MAX); + flash_ofs += CONFIG_FLASH_STEP) { + unsigned long magic; + unsigned char *p; + + p = flash_base + flash_ofs; + magic = get_be32(p); + if (magic == IH_MAGIC_OKLI) { + hdr = (struct image_header *) p; + break; + } + } + + if (hdr == NULL) { + printf("not found!\n"); + halt(); + } + + printf("found at 0x%08x\n", flash_base + flash_ofs); + + kernel_ofs = sizeof(struct image_header); + kernel_size = get_be32(&hdr->ih_size); + kernel_la = get_be32(&hdr->ih_load); + + lzma_data = flash_base + flash_ofs + kernel_ofs; + lzma_datasize = kernel_size; +} +#endif /* (LZMA_WRAPPER) */ + +void loader_main(unsigned long reg_a0, unsigned long reg_a1, + unsigned long reg_a2, unsigned long reg_a3) +{ + void (*kernel_entry) (unsigned long, unsigned long, unsigned long, + unsigned long); + int res; + + board_init(); + + printf("\n\nOpenWrt kernel loader for MIPS based SoC\n"); + printf("Copyright (C) 2011 Gabor Juhos \n"); + + lzma_init_data(); + + res = lzma_init_props(); + if (res != LZMA_RESULT_OK) { + printf("Incorrect LZMA stream properties!\n"); + halt(); + } + + printf("Decompressing kernel... "); + + res = lzma_decompress((unsigned char *) kernel_la); + 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"); + } + + flush_cache(kernel_la, lzma_outsize); + + printf("Starting kernel at %08x...\n\n", kernel_la); + +#ifdef CONFIG_KERNEL_CMDLINE + reg_a0 = kernel_argc; + reg_a1 = (unsigned long) kernel_argv; + reg_a2 = 0; + reg_a3 = 0; +#endif + + kernel_entry = (void *) kernel_la; + kernel_entry(reg_a0, reg_a1, reg_a2, reg_a3); +} diff --git a/target/linux/ramips/image/lzma-loader/src/loader.lds b/target/linux/ramips/image/lzma-loader/src/loader.lds new file mode 100644 index 0000000000..80cc7ca3ec --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/loader.lds @@ -0,0 +1,35 @@ +OUTPUT_ARCH(mips) +SECTIONS { + .text : { + _code_start = .; + *(.text) + *(.text.*) + *(.rodata) + *(.rodata.*) + *(.data.lzma) + } + + . = ALIGN(32); + .data : { + *(.data) + *(.data.*) + . = . + 524288; /* workaround for buggy bootloaders */ + } + + . = ALIGN(32); + _code_end = .; + + _bss_start = .; + .bss : { + *(.bss) + *(.bss.*) + } + + . = ALIGN(32); + _bss_end = .; + + . = . + 8192; + _stack = .; + + workspace = .; +} diff --git a/target/linux/ramips/image/lzma-loader/src/loader2.lds b/target/linux/ramips/image/lzma-loader/src/loader2.lds new file mode 100644 index 0000000000..db0bb46424 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/loader2.lds @@ -0,0 +1,10 @@ +OUTPUT_ARCH(mips) +SECTIONS { + .text : { + startup = .; + *(.text) + *(.text.*) + *(.data) + *(.data.*) + } +} diff --git a/target/linux/ramips/image/lzma-loader/src/lzma-data.lds b/target/linux/ramips/image/lzma-loader/src/lzma-data.lds new file mode 100644 index 0000000000..abf756ba13 --- /dev/null +++ b/target/linux/ramips/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/ramips/image/lzma-loader/src/printf.c b/target/linux/ramips/image/lzma-loader/src/printf.c new file mode 100644 index 0000000000..7bb5a86e18 --- /dev/null +++ b/target/linux/ramips/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/ramips/image/lzma-loader/src/printf.h b/target/linux/ramips/image/lzma-loader/src/printf.h new file mode 100644 index 0000000000..9b1c1df232 --- /dev/null +++ b/target/linux/ramips/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/ramips/image/lzma-loader/src/ralink.mk b/target/linux/ramips/image/lzma-loader/src/ralink.mk new file mode 100644 index 0000000000..3ff5fddf98 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/ralink.mk @@ -0,0 +1 @@ +CACHE_FLAGS+=-DCONFIG_ICACHE_SIZE="(32 * 1024)" -DCONFIG_DCACHE_SIZE="(16 * 1024)" -DCONFIG_CACHELINE_SIZE=32 diff --git a/target/linux/ramips/image/mt7628.mk b/target/linux/ramips/image/mt7628.mk new file mode 100644 index 0000000000..7a7ddce3c9 --- /dev/null +++ b/target/linux/ramips/image/mt7628.mk @@ -0,0 +1,48 @@ +# +# MT7628 Profiles +# + +define Device/mt7628 + DTS := MT7628 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := MediaTek MT7628 EVB + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += mt7628 + +define Device/miwifi-nano + DTS := MIWIFI-NANO + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := Xiaomi MiWiFi Nano + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += miwifi-nano + +define Device/wl-wn575a3 + DTS := WL-WN575A3 + IMAGE_SIZE := $(ralink_default_fw_size_8M) + DEVICE_TITLE := Wavlink WL-WN575A3 +endef +TARGET_DEVICES += wl-wn575a3 + +define Device/wrtnode2p + DTS := WRTNODE2P + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := WRTnode 2P + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += wrtnode2p + +define Device/duzun-dm06 + DTS := DUZUN-DM06 + DEVICE_TITLE := DuZun DM06 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += duzun-dm06 + +define Device/mac1200r-v2 + DTS := MAC1200RV2 + DEVICE_TITLE := Mercury MAC1200R v2.0 +endef +TARGET_DEVICES += mac1200r-v2 diff --git a/target/linux/ramips/image/mt7688.mk b/target/linux/ramips/image/mt7688.mk new file mode 100644 index 0000000000..f117102e71 --- /dev/null +++ b/target/linux/ramips/image/mt7688.mk @@ -0,0 +1,36 @@ +# +# MT7688 Profiles +# + +define Device/LinkIt7688 + DTS := LINKIT7688 + IMAGE_SIZE := $(ralink_default_fw_size_32M) + SUPPORTED_DEVICES := linkits7688 linkits7688d + DEVICE_TITLE := MediaTek LinkIt Smart 7688 + DEVICE_PACKAGES:= kmod-usb2 kmod-usb-ohci uboot-envtools +endef +TARGET_DEVICES += LinkIt7688 + +define Device/pbr-d1 + DTS := PBR-D1 + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := PBR-D1 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += pbr-d1 + +define Device/wrtnode2r + DTS := WRTNODE2R + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := WRTnode 2R + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += wrtnode2r + +define Device/widora-neo + DTS := WIDORA-NEO + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := Widora-NEO + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += widora-neo diff --git a/target/linux/ramips/image/rt288x.mk b/target/linux/ramips/image/rt288x.mk new file mode 100644 index 0000000000..3312d0ed17 --- /dev/null +++ b/target/linux/ramips/image/rt288x.mk @@ -0,0 +1,71 @@ +# +# RT288X Profiles +# + +define Build/gemtek-header + mkheader_gemtek $@ $@.new $(1) && mv $@.new $@ +endef + +define Device/ar670w + DTS := AR670W + BLOCKSIZE := 64k + DEVICE_TITLE := Airlink AR670W + IMAGE_SIZE := $(ralink_default_fw_size_4M) + KERNEL := $(KERNEL_DTB) + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + wrg-header wrgn16a_airlink_ar670w +endef +TARGET_DEVICES += ar670w + +define Device/ar725w + DTS := AR725W + DEVICE_TITLE := Gemtek AR725W + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + gemtek-header ar725w +endef +TARGET_DEVICES += ar725w + +define Device/f5d8235-v1 + DTS := F5D8235_V1 + IMAGE_SIZE := 7744k + DEVICE_TITLE := Belkin F5D8235 V1 + DEVICE_PACKAGES := kmod-switch-rtl8366s kmod-usb-core kmod-usb-ohci \ + kmod-usb-ohci-pci kmod-usb2 kmod-usb2-pci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += f5d8235-v1 + +define Device/rt-n15 + DTS := RT-N15 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Asus RT-N15 + DEVICE_PACKAGES := kmod-switch-rtl8366s +endef +TARGET_DEVICES += rt-n15 + +define Device/v11st-fe + DTS := V11STFE + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Ralink V11ST-FE +endef +TARGET_DEVICES += v11st-fe + +define Device/wli-tx4-ag300n + DTS := WLI-TX4-AG300N + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Buffalo WLI-TX4-AG300N +endef +TARGET_DEVICES += wli-tx4-ag300n + +define Device/wzr-agl300nh + DTS := WZR-AGL300NH + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Buffalo WZR-AGL300NH + DEVICE_PACKAGES := kmod-switch-rtl8366s +endef +TARGET_DEVICES += wzr-agl300nh diff --git a/target/linux/ramips/image/rt305x-legacy.mk b/target/linux/ramips/image/rt305x-legacy.mk new file mode 100644 index 0000000000..173739b073 --- /dev/null +++ b/target/linux/ramips/image/rt305x-legacy.mk @@ -0,0 +1,118 @@ +# +# RT305X Profiles +# +define BuildFirmware/DCS930/squashfs + $(call BuildFirmware/Default4M/squashfs,squashfs,$(2),$(3)) + dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/image.$(2).combined bs=1048512 count=1 conv=sync + cat $(KDIR)/root.squashfs >> $(KDIR)/image.$(2).combined + $(call MkImage,lzma,$(KDIR)/image.$(2).combined,$(KDIR)/image.$(2)) + $(call prepare_generic_squashfs,$(KDIR)/image.$(2)) + if [ `stat -c%s "$(KDIR)/image.$(2)"` -gt $(ralink_default_fw_size_4M) ]; then \ + echo "Warning: $(KDIR)/image.$(2) is too big" >&2; \ + else \ + dd if=$(KDIR)/image.$(2) of=$(KDIR)/dcs.tmp bs=64K count=5 conv=sync ;\ + cat $(KDIR)/image.$(2) >> $(KDIR)/dcs.tmp ; \ + dd if=$(KDIR)/dcs.tmp of=$(call imgname,$(1),$(2))-factory.bin bs=4096k count=1 conv=sync ;\ + $(STAGING_DIR_HOST)/bin/mkdcs932 $(call imgname,$(1),$(2))-factory.bin ; \ + fi +endef +BuildFirmware/DCS930/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3)) + +# sign Buffalo images +define BuildFirmware/Buffalo + if [ -e "$(call sysupname,$(1),$(2))" ]; then \ + buffalo-enc -p $(3) -v 1.76 \ + -i $(KDIR)/vmlinux-$(2).uImage \ + -o $(KDIR)/vmlinux-$(2).uImage.enc; \ + buffalo-enc -p $(3) -v 1.76 \ + -i $(KDIR)/root.$(1) \ + -o $(KDIR)/root.$(2).enc; \ + buffalo-tag -b $(3) -p $(3) -a ram -v 1.76 -m 1.01 \ + -l mlang8 -f 1 -r EU \ + -i $(KDIR)/vmlinux-$(2).uImage.enc \ + -i $(KDIR)/root.$(2).enc \ + -o $(call imgname,$(1),$(2))-factory-EU.bin; \ + fi +endef + +# FIXME: this looks broken +buffalo_whrg300n_mtd_size=3801088 +define BuildFirmware/WHRG300N/squashfs + $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N) + # the following line has a bad argument 3 ... the old Makefile was already broken + $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n) + if [ -e "$(call sysupname,$(1),$(2))" ]; then \ + ( \ + echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \ + dd bs=512 count=1 conv=sync; \ + dd if=$(call sysupname,$(1),whr-g300n); \ + ) > $(KDIR)/whr-g300n-tftp.tmp && \ + buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \ + -o $(call imgname,$(1),whr-g300n)-tftp.bin; \ + fi +endef +BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N) + +kernel_size_wl341v3=917504 +rootfs_size_wl341v3=2949120 +define BuildFirmware/WL-341V3/squashfs + $(call BuildFirmware/Default4M/$(1),$(1),wl-341v3,WL-341V3) + # This code looks broken and really needs to be converted to C + if [ -e "$(call sysupname,$(1),$(2))" ]; then \ + ( \ + dd if=/dev/zero bs=195936 count=1; \ + echo "1.01"; \ + dd if=/dev/zero bs=581 count=1; \ + echo -n -e "\x73\x45\x72\x43\x6F\x4D\x6D\x00\x01\x00\x00\x59\x4E\x37\x95\x58\x10\x00\x20\x00\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x03\x00\x00\x80\x00\x00\x00\x00\x03\x00\x00\x10\x12\x00\x00\x00\x10\x73\x45\x72\x43\x6F\x4D\x6D"; \ + dd if=/dev/zero bs=65552 count=1; \ + dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(kernel_size_wl341v3) conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ + dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(kernel_size_wl341v3) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \ + echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \ + ) > $(call imgname,$(1),$(2))-factory.bin; \ + fi +endef +BuildFirmware/WL-341V3/initramfs=$(call BuildFirmware/OF/initramfs,$(1),wl-341v3,WL-341V3) + +define BuildFirmware/UIMAGE_8M + $(call MkCombineduImage,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M),$(7)) +endef +define Image/Build/Profile/ALL02393G + $(call Image/Build/Template/$(image_type)/$(1),UIMAGE_8M,all0239-3g,ALL0239-3G,ttyS1,57600,phys) +endef + +Image/Build/Profile/DCS930=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930,DCS-930) +Image/Build/Profile/DCS930LB1=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930l-b1,DCS-930L-B1) +Image/Build/Profile/WL-341V3=$(call BuildFirmware/WL-341V3/$(1),$(1)) +Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1)) + +define LegacyDevice/ALL02393G + DEVICE_TITLE := Allnet ALL0239-3G + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +LEGACY_DEVICES += ALL02393G + + +define LegacyDevice/DCS930 + DEVICE_TITLE := D-Link DCS-930 + DEVICE_PACKAGES := kmod-video-core kmod-video-uvc kmod-sound-core kmod-usb-audio kmod-usb-core kmod-usb-dwc2 +endef +LEGACY_DEVICES += DCS930 + + +define LegacyDevice/DCS930LB1 + DEVICE_TITLE := D-Link DCS-930L B1 + DEVICE_PACKAGES := kmod-video-core kmod-video-uvc kmod-sound-core kmod-usb-audio kmod-usb-core kmod-usb-ohci kmod-usb2 +endef +LEGACY_DEVICES += DCS930LB1 + +define LegacyDevice/WL-341V3 + DEVICE_TITLE := Sitecom WL-341 v3 +endef +LEGACY_DEVICES += WL-341V3 + + +define LegacyDevice/WHRG300N + DEVICE_TITLE := Buffalo WHR-G300N +endef +LEGACY_DEVICES += WHRG300N diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk new file mode 100644 index 0000000000..529094d49b --- /dev/null +++ b/target/linux/ramips/image/rt305x.mk @@ -0,0 +1,845 @@ +# +# RT305X Profiles +# +define Build/dap-header + $(STAGING_DIR_HOST)/bin/mkdapimg $(1) -i $@ -o $@.new + mv $@.new $@ +endef + +define Build/hilink-header + $(STAGING_DIR_HOST)/bin/mkhilinkfw -e -i $@ -o $@.new + mv $@.new $@ +endef + +define Build/jcg-header + $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) -u $@ -o $@.new + mv $@.new $@ +endef + + +define Device/3g150b + DTS := 3G150B + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + UIMAGE_NAME:= Linux Kernel Image + DEVICE_TITLE := Tenda 3G150B + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += 3g150b + +define Device/3g300m + DTS := 3G300M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + UIMAGE_NAME := 3G150M_SPI Kernel Image + DEVICE_TITLE := Tenda 3G300M + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += 3g300m + +define Device/3g-6200n + DTS := 3G-6200N + IMAGE_SIZE := 3648k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + edimax-header -s CSYS -m 3G62 -f 0x50000 -S 0x01100000 | pad-rootfs | \ + append-metadata | check-size $$$$(IMAGE_SIZE) + DEVICE_TITLE := Edimax 3g-6200n +endef +TARGET_DEVICES += 3g-6200n + +define Device/3g-6200nl + DTS := 3G-6200NL + IMAGE_SIZE := 3648k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + edimax-header -s CSYS -m 3G62 -f 0x50000 -S 0x01100000 | pad-rootfs | \ + append-metadata | check-size $$$$(IMAGE_SIZE) + DEVICE_TITLE := Edimax 3g-6200nl +endef +TARGET_DEVICES += 3g-6200nl + +define Device/a5-v11 + DTS := A5-V11 + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B A5-V11 -F 4M + DEVICE_TITLE := A5-V11 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 +endef +TARGET_DEVICES += a5-v11 + +define Device/air3gii + DTS := AIR3GII + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := AirLive Air3GII +endef +TARGET_DEVICES += air3gii + +define Device/all0256n-4M + DTS := ALL0256N-4M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Allnet ALL0256N (4MB) + DEVICE_PACKAGES := rssileds +endef +TARGET_DEVICES += all0256n-4M + +define Device/all0256n-8M + DTS := ALL0256N-8M + DEVICE_TITLE := Allnet ALL0256N (8MB) + DEVICE_PACKAGES := rssileds +endef +TARGET_DEVICES += all0256n-8M + +define Device/all5002 + DTS := ALL5002 + IMAGE_SIZE := 32448k + DEVICE_TITLE := Allnet ALL5002 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ + kmod-i2c-core kmod-i2c-gpio kmod-hwmon-lm92 kmod-gpio-pcf857x +endef +TARGET_DEVICES += all5002 + +define Device/all5003 + DTS := ALL5003 + IMAGE_SIZE := 32448k + DEVICE_TITLE := Allnet ALL5003 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ + kmod-i2c-core kmod-i2c-gpio kmod-hwmon-lm92 kmod-gpio-pcf857x +endef +TARGET_DEVICES += all5003 + +define Device/asl26555-8M + DTS := ASL26555-8M + IMAGE_SIZE := 7744k + DEVICE_TITLE := Alpha ASL26555 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += asl26555-8M + +define Device/asl26555-16M + DTS := ASL26555-16M + IMAGE_SIZE := 15872k + DEVICE_TITLE := Alpha ASL26555 16M + DEVICE_PACKAGES := +endef +TARGET_DEVICES += asl26555-16M + +define Device/atp-52b + DTS := ATP-52B + IMAGE_SIZE := 7808k + DEVICE_TITLE := Argus ATP-52B +endef +TARGET_DEVICES += atp-52b + +define Device/awm002-evb-4M + DTS := AWM002-EVB-4M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := AsiaRF AWM002-EVB (4M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ + kmod-i2c-core kmod-i2c-gpio +endef +TARGET_DEVICES += awm002-evb-4M + +define Device/awm002-evb-8M + DTS := AWM002-EVB-8M + DEVICE_TITLE := AsiaRF AWM002-EVB (8M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ + kmod-i2c-core kmod-i2c-gpio +endef +TARGET_DEVICES += awm002-evb-8M + +define Device/awm003-evb + DTS := AWM003-EVB + DEVICE_TITLE := AsiaRF AWM003 EVB +endef +TARGET_DEVICES += awm003-evb + +define Device/awapn2403 + DTS := AWAPN2403 + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := AsiaRF AWAPN2403 +endef +TARGET_DEVICES += awapn2403 + +define Device/bc2 + DTS := BC2 + DEVICE_TITLE := NexAira BC2 +endef +TARGET_DEVICES += bc2 + +define Device/broadway + DTS := BROADWAY + IMAGE_SIZE := 7744k + UIMAGE_NAME:= Broadway Kernel Image + DEVICE_TITLE := Hauppauge Broadway + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += broadway + +define Device/carambola + DTS := CARAMBOLA + DEVICE_TITLE := 8devices Carambola + DEVICE_PACKAGES := +endef +TARGET_DEVICES += carambola + +define Device/d105 + DTS := D105 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Huawei D105 +endef +TARGET_DEVICES += d105 + +define Device/dap-1350 + DTS := DAP-1350 + IMAGES += factory.bin factory-NA.bin + IMAGE_SIZE := 7488k + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + dap-header -s RT3052-AP-DAP1350WW-3 + IMAGE/factory-NA.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + dap-header -s RT3052-AP-DAP1350-3 + DEVICE_TITLE := D-Link DAP-1350 +endef +TARGET_DEVICES += dap-1350 + +define Device/dir-300-b1 + DTS := DIR-300-B1 + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | wrg-header wrgn23_dlwbr_dir300b + DEVICE_TITLE := D-Link DIR-300 B1 +endef +TARGET_DEVICES += dir-300-b1 + +define Device/dir-300-b7 + DTS := DIR-300-B7 + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := D-Link DIR-300 B7 +endef +TARGET_DEVICES += dir-300-b7 + +define Device/dir-320-b1 + DTS := DIR-320-B1 + DEVICE_TITLE := D-Link DIR-320 B1 +endef +TARGET_DEVICES += dir-320-b1 + +define Device/dir-600-b1 + DTS := DIR-600-B1 + IMAGE_SIZE := $(ralink_default_fw_size_4M) + SUPPORTED_DEVICES := dir-600-b1 dir-600-b2 + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | wrg-header wrgn23_dlwbr_dir600b + DEVICE_TITLE := D-Link DIR-600 B1/B2 +endef +TARGET_DEVICES += dir-600-b1 + +define Device/dir-610-a1 + DTS := DIR-610-A1 + BLOCKSIZE := 4k + IMAGES += factory.bin + KERNEL := $(KERNEL_DTB) + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGE/sysupgrade.bin := \ + append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \ + seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \ + pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin := \ + append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ + append-rootfs | pad-rootfs -x 64 | \ + seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \ + seama-seal -m "signature=wrgn59_dlob.hans_dir610" | \ + check-size $$$$(IMAGE_SIZE) + DEVICE_TITLE := D-Link DIR-610 A1 + DEVICE_PACKAGES := kmod-ledtrig-netdev kmod-ledtrig-timer +endef +TARGET_DEVICES += dir-610-a1 + +define Device/dir-615-d + DTS := DIR-615-D + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | wrg-header wrgn23_dlwbr_dir615d + DEVICE_TITLE := D-Link DIR-615 D +endef +TARGET_DEVICES += dir-615-d + + +define Device/dir-615-h1 + DTS := DIR-615-H1 + BLOCKSIZE := 4k + IMAGES += factory.bin + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | senao-header -r 0x218 -p 0x30 -t 3 + DEVICE_TITLE := D-Link DIR-615 H1 +endef +TARGET_DEVICES += dir-615-h1 + +define Device/dir-620-a1 + DTS := DIR-620-A1 + DEVICE_TITLE := D-Link DIR-620 A1 +endef +TARGET_DEVICES += dir-620-a1 + +define Device/dir-620-d1 + DTS := DIR-620-D1 + DEVICE_TITLE := D-Link DIR-620 D1 +endef +TARGET_DEVICES += dir-620-d1 + +define Device/dwr-512-b + DTS := DWR-512-B + DEVICE_TITLE := D-Link DWR-512 B + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-i2c-core kmod-i2c-ralink kmod-spi-dev \ + kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan comgt +endef +TARGET_DEVICES += dwr-512-b + +define Device/esr-9753 + DTS := ESR-9753 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := EnGenius ESR-9753 +endef +TARGET_DEVICES += esr-9753 + +define Device/f5d8235-v2 + DTS := F5D8235_V2 + IMAGE_SIZE := 7744k + DEVICE_TITLE := Belkin F5D8235 v2 +endef +TARGET_DEVICES += f5d8235-v2 + +define Device/f7c027 + DTS := F7C027 + IMAGE_SIZE := 7616k + DEVICE_TITLE := Belkin F7C027 + DEVICE_PACKAGES := -kmod-usb-core -kmod-usb-dwc2 -kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += f7c027 + +define Device/fonera20n + DTS := FONERA20N + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | \ + edimax-header -s RSDK -m NL1T -f 0x50000 -S 0xc0000 + DEVICE_TITLE := Fonera 2.0N + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += fonera20n + +define Device/freestation5 + DTS := FREESTATION5 + DEVICE_TITLE := ARC Wireless FreeStation + DEVICE_PACKAGES := kmod-usb-dwc2 kmod-rt2500-usb kmod-rt2800-usb kmod-rt2x00-usb +endef +TARGET_DEVICES += freestation5 + +define Device/hlk-rm04 + DTS := HLKRM04 + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | hilink-header + DEVICE_TITLE := Hi-Link HLK-RM04 +endef +TARGET_DEVICES += hlk-rm04 + +define Device/ht-tm02 + DTS := HT-TM02 + DEVICE_TITLE := HooToo HT-TM02 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += ht-tm02 + +define Device/hw550-3g + DTS := HW550-3G + DEVICE_TITLE := Aztech HW550-3G + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += hw550-3g + +define Device/ip2202 + DTS := IP2202 + DEVICE_TITLE := Poray IP2202 +endef +TARGET_DEVICES += ip2202 + +define Device/jhr-n805r + DTS := JHR-N805R + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | jcg-header 29.24 + DEVICE_TITLE := JCG JHR-N805R +endef +TARGET_DEVICES += jhr-n805r + +define Device/jhr-n825r + DTS := JHR-N825R + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | jcg-header 23.24 + DEVICE_TITLE := JCG JHR-N825R +endef +TARGET_DEVICES += jhr-n825r + +define Device/jhr-n926r + DTS := JHR-N926R + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | jcg-header 25.24 + DEVICE_TITLE := JCG JHR-N926R +endef +TARGET_DEVICES += jhr-n926r + +define Device/m2m + DTS := M2M + UIMAGE_NAME:= Linux Kernel Image + DEVICE_TITLE := Intenso Memory 2 Move + DEVICE_PACKAGES := kmod-ledtrig-netdev kmod-ledtrig-timer \ + kmod-usb-core kmod-usb2 kmod-usb-storage kmod-scsi-core \ + kmod-fs-ext4 kmod-fs-vfat block-mount +endef +TARGET_DEVICES += m2m + +define Device/m3 + DTS := M3 + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B M3 -F 4M + DEVICE_TITLE := Poray M3 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev \ + kmod-ledtrig-timer +endef +TARGET_DEVICES += m3 + +define Device/m4-4M + DTS := M4-4M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B M4 -F 4M + DEVICE_TITLE := Poray M4 (4MB) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev \ + kmod-ledtrig-timer +endef +TARGET_DEVICES += m4-4M + +define Device/m4-8M + DTS := M4-8M + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B M4 -F 8M + DEVICE_TITLE := Poray M4 (8MB) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer +endef +TARGET_DEVICES += m4-8M + +define Device/miniembplug + DTS := MINIEMBPLUG + DEVICE_TITLE := Omnima MiniEMBPlug +endef +TARGET_DEVICES += miniembplug + +define Device/miniembwifi + DEVICE_TITLE := Omnima MiniEMBWiFi +endef +TARGET_DEVICES += miniembwifi + +define Device/mofi3500-3gn + DTS := MOFI3500-3GN + DEVICE_TITLE := MoFi Network MOFI3500-3GN +endef +TARGET_DEVICES += mofi3500-3gn + +define Device/mpr-a1 + DTS := MPRA1 + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + UIMAGE_NAME:= Linux Kernel Image + DEVICE_TITLE := HAME MPR-A1 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-netdev +endef +TARGET_DEVICES += mpr-a1 + +define Device/mpr-a2 + DTS := MPRA2 + UIMAGE_NAME:= Linux Kernel Image + DEVICE_TITLE := HAME MPR-A2 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-netdev +endef +TARGET_DEVICES += mpr-a2 + +define Device/mr-102n + DTS := MR-102N + DEVICE_TITLE := AXIMCom MR-102N +endef +TARGET_DEVICES += mr-102n + +define Device/mzk-dp150n + DTS := MZK-DP150N + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Planex MZK-DP150N + DEVICE_PACKAGES := kmod-spi-dev +endef +TARGET_DEVICES += mzk-dp150n + +define Device/mzk-w300nh2 + DTS := MZK-W300NH2 + IMAGE_SIZE := 3648k + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | \ + edimax-header -s CSYS -m RN52 -f 0x50000 -S 0xc0000 + DEVICE_TITLE := Planex MZK-W300NH2 +endef +TARGET_DEVICES += mzk-w300nh2 + +define Device/mzk-wdpr + DTS := MZK-WDPR + DEVICE_TITLE := Planex MZK-WDPR +endef +TARGET_DEVICES += mzk-wdpr + +define Device/nbg-419n + DTS := NBG-419N + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := ZyXEL NBG-419N +endef +TARGET_DEVICES += nbg-419n + +define Device/nbg-419n2 + DTS := NBG-419N2 + IMAGE_SIZE := $(ralink_default_fw_size_8M) + DEVICE_TITLE := ZyXEL NBG-419N2 +endef +TARGET_DEVICES += nbg-419n2 + +define Device/ncs601w + DTS := NCS601W + DEVICE_TITLE := Wansview NCS601W + DEVICE_PACKAGES := kmod-video-core kmod-video-uvc \ + kmod-usb-core kmod-usb-ohci +endef +TARGET_DEVICES += ncs601w + +define Device/nixcore-x1-8M + DTS := NIXCORE-8M + IMAGE_SIZE := 7872k + DEVICE_TITLE := NixcoreX1 (8M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-i2c-core kmod-i2c-ralink kmod-spi-dev +endef +TARGET_DEVICES += nixcore-x1-8M + +define Device/nixcore-x1-16M + DTS := NIXCORE-16M + IMAGE_SIZE := 16064k + DEVICE_TITLE := NixcoreX1 (16M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-i2c-core kmod-i2c-ralink kmod-spi-dev +endef +TARGET_DEVICES += nixcore-x1-16M + +define Device/nw718 + DTS := NW718 + IMAGE_SIZE := 3712k + UIMAGE_NAME:= ARA1B4NCRNW718;1 + DEVICE_TITLE := Netcore NW718 +endef +TARGET_DEVICES += nw718 + +define Device/psr-680w + DTS := PSR-680W + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Petatel PSR-680W Wireless 3G Router +endef +TARGET_DEVICES += psr-680w + +define Device/pwh2004 + DTS := PWH2004 + DEVICE_TITLE := Prolink PWH2004 + DEVICE_PACKAGES := +endef +TARGET_DEVICES += pwh2004 + +define Device/px-4885-4M + DTS := PX-4885-4M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := 7Links PX-4885 (4M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-ohci \ + kmod-usb-ledtrig-usbport kmod-leds-gpio +endef +TARGET_DEVICES += px-4885-4M + +define Device/px-4885-8M + DTS := PX-4885-8M + DEVICE_TITLE := 7Links PX-4885 (8M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-ohci \ + kmod-usb-ledtrig-usbport kmod-leds-gpio +endef +TARGET_DEVICES += px-4885-8M + +define Device/rt5350f-olinuxino + DTS := RT5350F-OLINUXINO + DEVICE_TITLE := RT5350F-OLinuXino + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 \ + kmod-i2c-core kmod-i2c-ralink \ + kmod-spi-dev +endef +TARGET_DEVICES += rt5350f-olinuxino + +define Device/rt5350f-olinuxino-evb + DTS := RT5350F-OLINUXINO-EVB + DEVICE_TITLE := RT5350F-OLinuXino-EVB + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 \ + kmod-i2c-core kmod-i2c-ralink \ + kmod-spi-dev +endef +TARGET_DEVICES += rt5350f-olinuxino-evb + +define Device/rt-g32-b1 + DTS := RT-G32-B1 + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Asus RT-G32 B1 +endef +TARGET_DEVICES += rt-g32-b1 + +define Device/rt-n10-plus + DTS := RT-N10-PLUS + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Asus RT-N10+ +endef +TARGET_DEVICES += rt-n10-plus + +define Device/rt-n13u + DTS := RT-N13U + DEVICE_TITLE := Asus RT-N13U + DEVICE_PACKAGES := kmod-leds-gpio kmod-rt2800-pci wpad-mini kmod-usb-dwc2 +endef +TARGET_DEVICES += rt-n13u + +define Device/rut5xx + DTS := RUT5XX + DEVICE_TITLE := Teltonika RUT5XX +endef +TARGET_DEVICES += rut5xx + +define Device/sl-r7205 + DTS := SL-R7205 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Skyline SL-R7205 Wireless 3G Router +endef +TARGET_DEVICES += sl-r7205 + +define Device/tew-714tru + DTS := TEW-714TRU + DEVICE_TITLE := TRENDnet TEW-714TRU +endef +TARGET_DEVICES += tew-714tru + +define Device/ur-326n4g + DTS := UR-326N4G + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := UPVEL UR-326N4G + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += ur-326n4g + +define Device/ur-336un + DTS := UR-336UN + DEVICE_TITLE := UPVEL UR-336UN + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += ur-336un + +define Device/v22rw-2x2 + DTS := V22RW-2X2 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Ralink AP-RT3052-V22RW-2X2 +endef +TARGET_DEVICES += v22rw-2x2 + +define Device/vocore-8M + DTS := VOCORE-8M + IMAGE_SIZE := 7872k + DEVICE_TITLE := VoCore (8M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 \ + kmod-i2c-core kmod-i2c-ralink \ + kmod-spi-dev +endef +TARGET_DEVICES += vocore-8M + +define Device/vocore-16M + DTS := VOCORE-16M + IMAGE_SIZE := 16064k + DEVICE_TITLE := VoCore (16M) + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 \ + kmod-i2c-core kmod-i2c-ralink \ + kmod-spi-dev +endef +TARGET_DEVICES += vocore-16M + +define Device/w150m + DTS := W150M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + UIMAGE_NAME:= W150M Kernel Image + DEVICE_TITLE := Tenda W150M +endef +TARGET_DEVICES += w150m + +define Device/w306r-v20 + DTS := W306R_V20 + IMAGE_SIZE := $(ralink_default_fw_size_4M) + UIMAGE_NAME:= linkn Kernel Image + DEVICE_TITLE := Tenda W306R V2.0 +endef +TARGET_DEVICES += w306r-v20 + +define Device/w502u + DTS := W502U + DEVICE_TITLE := ALFA Networks W502U +endef +TARGET_DEVICES += w502u + +define Device/wcr-150gn + DTS := WCR150GN + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Sparklan WCR-150GN +endef +TARGET_DEVICES += wcr-150gn + +define Device/wizard8800 + DTS := WIZARD8800 + UIMAGE_NAME:= Linux Kernel Image + DEVICE_TITLE := EasyAcc WIZARD 8800 +endef +TARGET_DEVICES += wizard8800 + +define Device/wizfi630a + DTS := WIZFI630A + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := WIZnet WizFi630A +endef +TARGET_DEVICES += wizfi630a + +define Device/wl-330n + DTS := WL-330N + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Asus WL-330N +endef +TARGET_DEVICES += wl-330n + +define Device/wl-330n3g + DTS := WL-330N3G + BLOCKSIZE := 4k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Asus WL-330N3G + DEVICE_PACKAGES := +endef +TARGET_DEVICES += wl-330n3g + +define Device/wl-351 + DTS := WL-351 + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := Sitecom WL-351 v1 + DEVICE_PACKAGES := kmod-switch-rtl8366rb kmod-swconfig swconfig +endef +TARGET_DEVICES += wl-351 + +define Device/wnce2001 + DTS := WNCE2001 + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin factory-NA.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + dap-header -s RT3052-AP-WNCE2001-3 -r WW -v 1.0.0.99 + IMAGE/factory-NA.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + dap-header -s RT3052-AP-WNCE2001-3 -r NA -v 1.0.0.99 + DEVICE_TITLE := Netgear WNCE2001 +endef +TARGET_DEVICES += wnce2001 + +define Device/wr512-3gn-4M + DTS := WR512-3GN-4M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := WR512-3GN (4M) +endef +TARGET_DEVICES += wr512-3gn-4M + +define Device/wr512-3gn-8M + DTS := WR512-3GN-8M + DEVICE_TITLE := WR512-3GN (8M) +endef +TARGET_DEVICES += wr512-3gn-8M + +define Device/wr6202 + DTS := WR6202 + DEVICE_TITLE := AWB WR6202 +endef +TARGET_DEVICES += wr6202 + +define Device/wt1520-4M + DTS := WT1520-4M + IMAGE_SIZE := $(ralink_default_fw_size_4M) + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B WT1520 -F 4M + DEVICE_TITLE := Nexx WT1520 (4MB) +endef +TARGET_DEVICES += wt1520-4M + +define Device/wt1520-8M + DTS := WT1520-8M + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B WT1520 -F 8M + DEVICE_TITLE := Nexx WT1520 (8MB) +endef +TARGET_DEVICES += wt1520-8M + +define Device/x5 + DTS := X5 + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B X5 -F 8M + DEVICE_TITLE := Poray X5/X6 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer +endef +TARGET_DEVICES += x5 + + +define Device/x8 + DTS := X8 + IMAGES += factory.bin + IMAGE/factory.bin := \ + $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | poray-header -B X8 -F 8M + DEVICE_TITLE := Poray X8 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer +endef +TARGET_DEVICES += x8 + +define Device/xdxrn502j + DTS := XDXRN502J + BLOCKSIZE := 64k + IMAGE_SIZE := $(ralink_default_fw_size_4M) + DEVICE_TITLE := XDX RN502J +endef +TARGET_DEVICES += xdxrn502j diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk new file mode 100644 index 0000000000..58026891e4 --- /dev/null +++ b/target/linux/ramips/image/rt3883.mk @@ -0,0 +1,119 @@ +# +# RT3662/RT3883 Profiles +# +define Build/mkrtn56uimg + $(STAGING_DIR_HOST)/bin/mkrtn56uimg $(1) $@ +endef + +define Device/br-6475nd + DTS := BR-6475ND + BLOCKSIZE := 64k + IMAGE_SIZE := 7744k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + edimax-header -s CSYS -m RN54 -f 0x70000 -S 0x01100000 | pad-rootfs | \ + append-metadata | check-size $$$$(IMAGE_SIZE) + DEVICE_TITLE := Edimax BR-6475nD + DEVICE_PACKAGES := swconfig +endef +TARGET_DEVICES += br-6475nd + +define Device/cy-swr1100 + DTS := CY-SWR1100 + BLOCKSIZE := 64k + KERNEL := $(KERNEL_DTB) + IMAGES += factory.bin + IMAGE/sysupgrade.bin := \ + append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \ + seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \ + pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin := \ + append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ + append-rootfs | pad-rootfs -x 64 | \ + seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \ + seama-seal -m "signature=wrgnd10_samsung_ss815" | \ + check-size $$$$(IMAGE_SIZE) + DEVICE_TITLE := Samsung CY-SWR1100 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig +endef +TARGET_DEVICES += cy-swr1100 + + +define Device/dir-645 + DTS := DIR-645 + BLOCKSIZE := 4k + KERNEL := $(KERNEL_DTB) + IMAGES += factory.bin + IMAGE/sysupgrade.bin := \ + append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \ + seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \ + pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin := \ + append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ + append-rootfs | pad-rootfs -x 64 | \ + seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \ + seama-seal -m "signature=wrgn39_dlob.hans_dir645" | \ + check-size $$$$(IMAGE_SIZE) + DEVICE_TITLE := D-Link DIR-645 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig +endef +TARGET_DEVICES += dir-645 + + +define Device/hpm + DTS := HPM + BLOCKSIZE := 64k + IMAGE_SIZE := 16064k + DEVICE_TITLE := Omnima HPM + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 +endef +TARGET_DEVICES += hpm + + +define Device/rt-n56u + DTS := RT-N56U + BLOCKSIZE := 64k + IMAGES += factory.bin + IMAGE/sysupgrade.bin += | mkrtn56uimg -s + IMAGE/factory.bin := $$(sysupgrade_bin) | \ + check-size $$$$(IMAGE_SIZE) | mkrtn56uimg -f + DEVICE_TITLE := Asus RT-N56U + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig +endef +TARGET_DEVICES += rt-n56u + + +define Device/tew-691gr + DTS := TEW-691GR + BLOCKSIZE := 64k + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + umedia-header 0x026910 + DEVICE_TITLE := TRENDnet TEW-691GR + DEVICE_PACKAGES := swconfig +endef +TARGET_DEVICES += tew-691gr + + +define Device/tew-692gr + DTS := TEW-692GR + BLOCKSIZE := 64k + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + umedia-header 0x026920 + DEVICE_TITLE := TRENDnet TEW-692GR + DEVICE_PACKAGES := swconfig +endef +TARGET_DEVICES += tew-692gr + + +define Device/wlr-6000 + DTS := WLR-6000 + BLOCKSIZE := 4k + IMAGE_SIZE := 7244k + IMAGES += factory.dlf + IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ + senao-header -r 0x0202 -p 0x41 -t 2 + DEVICE_TITLE := Sitecom WLR-6000 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig +endef +TARGET_DEVICES += wlr-6000 diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk new file mode 100644 index 0000000000..99c5a9d0fc --- /dev/null +++ b/target/linux/ramips/modules.mk @@ -0,0 +1,136 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +OTHER_MENU:=Other modules + +define KernelPackage/pwm-mediatek + SUBMENU:=Other modules + TITLE:=MT7628 PWM + DEPENDS:=@(TARGET_ramips_mt7628||TARGET_ramips_mt7688) + KCONFIG:= \ + CONFIG_PWM=y \ + CONFIG_PWM_MEDIATEK \ + CONFIG_PWM_SYSFS=y + FILES:= \ + $(LINUX_DIR)/drivers/pwm/pwm-mediatek.ko + AUTOLOAD:=$(call AutoProbe,pwm-mediatek) +endef + +define KernelPackage/pwm-mediatek/description + Kernel modules for MediaTek Pulse Width Modulator +endef + +$(eval $(call KernelPackage,pwm-mediatek)) + +define KernelPackage/sdhci-mt7620 + SUBMENU:=Other modules + TITLE:=MT7620 SDCI + DEPENDS:=@(TARGET_ramips_mt7620||TARGET_ramips_mt7628||TARGET_ramips_mt7621||TARGET_ramips_mt7688) +kmod-sdhci + KCONFIG:= \ + CONFIG_MTK_MMC \ + CONFIG_MTK_AEE_KDUMP=n \ + CONFIG_MTK_MMC_CD_POLL=n + FILES:= \ + $(LINUX_DIR)/drivers/mmc/host/mtk-mmc/mtk_sd.ko + AUTOLOAD:=$(call AutoProbe,mtk_sd,1) +endef + +$(eval $(call KernelPackage,sdhci-mt7620)) + +I2C_RALINK_MODULES:= \ + CONFIG_I2C_RALINK:drivers/i2c/busses/i2c-ralink + +define KernelPackage/i2c-ralink + $(call i2c_defaults,$(I2C_RALINK_MODULES),59) + TITLE:=Ralink I2C Controller + DEPENDS:=kmod-i2c-core @TARGET_ramips \ + @!(TARGET_ramips_mt7621||TARGET_ramips_mt7628||TARGET_ramips_mt7688) +endef + +define KernelPackage/i2c-ralink/description + Kernel modules for enable ralink i2c controller. +endef + +$(eval $(call KernelPackage,i2c-ralink)) + + +I2C_MT7621_MODULES:= \ + CONFIG_I2C_MT7621:drivers/i2c/busses/i2c-mt7621 + +define KernelPackage/i2c-mt7621 + $(call i2c_defaults,$(I2C_MT7621_MODULES),59) + TITLE:=MT7621 I2C Controller + DEPENDS:=kmod-i2c-core \ + @(TARGET_ramips_mt7621||TARGET_ramips_mt7628||TARGET_ramips_mt7688) +endef + +define KernelPackage/i2c-mt7621/description + Kernel modules for enable mt7621 i2c controller. +endef + +$(eval $(call KernelPackage,i2c-mt7621)) + +define KernelPackage/dma-ralink + SUBMENU:=Other modules + TITLE:=Ralink GDMA Engine + DEPENDS:=@TARGET_ramips + KCONFIG:= \ + CONFIG_DMADEVICES=y \ + CONFIG_DW_DMAC_PCI=n \ + CONFIG_DMA_RALINK + FILES:= \ + $(LINUX_DIR)/drivers/dma/virt-dma.ko \ + $(LINUX_DIR)/drivers/dma/ralink-gdma.ko + AUTOLOAD:=$(call AutoLoad,52,ralink-gdma) +endef + +define KernelPackage/dma-ralink/description + Kernel modules for enable ralink dma engine. +endef + +$(eval $(call KernelPackage,dma-ralink)) + +define KernelPackage/hsdma-mtk + SUBMENU:=Other modules + TITLE:=MediaTek HSDMA Engine + DEPENDS:=@TARGET_ramips @TARGET_ramips_mt7621 + KCONFIG:= \ + CONFIG_DMADEVICES=y \ + CONFIG_DW_DMAC_PCI=n \ + CONFIG_MTK_HSDMA + FILES:= \ + $(LINUX_DIR)/drivers/dma/virt-dma.ko \ + $(LINUX_DIR)/drivers/dma/mtk-hsdma.ko + AUTOLOAD:=$(call AutoLoad,53,mtk-hsdma) +endef + +define KernelPackage/hsdma-mtk/description + Kernel modules for enable MediaTek hsdma engine. +endef + +$(eval $(call KernelPackage,hsdma-mtk)) + +define KernelPackage/sound-mt7620 + TITLE:=MT7620 PCM/I2S Alsa Driver + DEPENDS:=@TARGET_ramips +kmod-sound-soc-core +kmod-regmap +kmod-dma-ralink @!TARGET_ramips_rt288x + KCONFIG:= \ + CONFIG_SND_RALINK_SOC_I2S \ + CONFIG_SND_SIMPLE_CARD \ + CONFIG_SND_SOC_WM8960 + FILES:= \ + $(LINUX_DIR)/sound/soc/ralink/snd-soc-ralink-i2s.ko \ + $(LINUX_DIR)/sound/soc/generic/snd-soc-simple-card.ko \ + $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8960.ko + AUTOLOAD:=$(call AutoLoad,90,snd-soc-wm8960 snd-soc-ralink-i2s snd-soc-simple-card) + $(call AddDepends/sound) +endef + +define KernelPackage/sound-mt7620/description + Alsa modules for ralink i2s controller. +endef + +$(eval $(call KernelPackage,sound-mt7620)) diff --git a/target/linux/ramips/patches-4.4/0001-arch-mips-ralink-add-mt7621-support.patch b/target/linux/ramips/patches-4.4/0001-arch-mips-ralink-add-mt7621-support.patch new file mode 100644 index 0000000000..9f3d24178b --- /dev/null +++ b/target/linux/ramips/patches-4.4/0001-arch-mips-ralink-add-mt7621-support.patch @@ -0,0 +1,437 @@ +From 450b6e8257e22708173d0c1c86d34394fba0c5eb Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:08:31 +0100 +Subject: [PATCH 01/53] arch: mips: ralink: add mt7621 support + +Signed-off-by: John Crispin +--- + arch/mips/include/asm/mach-ralink/irq.h | 9 + + arch/mips/include/asm/mach-ralink/mt7621.h | 39 ++++ + arch/mips/kernel/mips-cm.c | 4 +- + arch/mips/kernel/vmlinux.lds.S | 1 + + arch/mips/ralink/Kconfig | 18 ++ + arch/mips/ralink/Makefile | 7 +- + arch/mips/ralink/Platform | 5 + + arch/mips/ralink/irq-gic.c | 268 ++++++++++++++++++++++++++++ + arch/mips/ralink/malta-amon.c | 81 +++++++++ + arch/mips/ralink/mt7621.c | 209 ++++++++++++++++++++++ + 10 files changed, 638 insertions(+), 3 deletions(-) + create mode 100644 arch/mips/include/asm/mach-ralink/irq.h + create mode 100644 arch/mips/include/asm/mach-ralink/mt7621.h + create mode 100644 arch/mips/ralink/irq-gic.c + create mode 100644 arch/mips/ralink/malta-amon.c + create mode 100644 arch/mips/ralink/mt7621.c + +--- /dev/null ++++ b/arch/mips/include/asm/mach-ralink/irq.h +@@ -0,0 +1,9 @@ ++#ifndef __ASM_MACH_RALINK_IRQ_H ++#define __ASM_MACH_RALINK_IRQ_H ++ ++#define GIC_NUM_INTRS 64 ++#define NR_IRQS 256 ++ ++#include_next ++ ++#endif +--- /dev/null ++++ b/arch/mips/include/asm/mach-ralink/mt7621.h +@@ -0,0 +1,42 @@ ++/* ++ * 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. ++ * ++ * Parts of this file are based on Ralink's 2.6.21 BSP ++ * ++ * Copyright (C) 2008-2011 Gabor Juhos ++ * Copyright (C) 2008 Imre Kaloz ++ * Copyright (C) 2013 John Crispin ++ */ ++ ++#ifndef _MT7621_REGS_H_ ++#define _MT7621_REGS_H_ ++ ++#define MT7621_PALMBUS_BASE 0x1C000000 ++#define MT7621_PALMBUS_SIZE 0x03FFFFFF ++ ++#define MT7621_SYSC_BASE 0x1E000000 ++ ++#define SYSC_REG_CHIP_NAME0 0x00 ++#define SYSC_REG_CHIP_NAME1 0x04 ++#define SYSC_REG_CHIP_REV 0x0c ++#define SYSC_REG_SYSTEM_CONFIG0 0x10 ++#define SYSC_REG_SYSTEM_CONFIG1 0x14 ++ ++#define CHIP_REV_PKG_MASK 0x1 ++#define CHIP_REV_PKG_SHIFT 16 ++#define CHIP_REV_VER_MASK 0xf ++#define CHIP_REV_VER_SHIFT 8 ++#define CHIP_REV_ECO_MASK 0xf ++ ++#define MT7621_DRAM_BASE 0x0 ++#define MT7621_DDR2_SIZE_MIN 32 ++#define MT7621_DDR2_SIZE_MAX 256 ++ ++#define MT7621_CHIP_NAME0 0x3637544D ++#define MT7621_CHIP_NAME1 0x20203132 ++ ++#define MIPS_GIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8) ++ ++#endif +--- a/arch/mips/kernel/vmlinux.lds.S ++++ b/arch/mips/kernel/vmlinux.lds.S +@@ -53,6 +53,7 @@ SECTIONS + /* read-only */ + _text = .; /* Text and read-only data */ + .text : { ++ /*. = . + 0x8000; */ + TEXT_TEXT + SCHED_TEXT + LOCK_TEXT +--- a/arch/mips/ralink/Kconfig ++++ b/arch/mips/ralink/Kconfig +@@ -12,6 +12,11 @@ config RALINK_ILL_ACC + depends on SOC_RT305X + default y + ++config IRQ_INTC ++ bool ++ default y ++ depends on !SOC_MT7621 ++ + choice + prompt "Ralink SoC selection" + default SOC_RT305X +@@ -34,6 +39,16 @@ choice + config SOC_MT7620 + bool "MT7620/8" + ++ config SOC_MT7621 ++ bool "MT7621" ++ select MIPS_CPU_SCACHE ++ select SYS_SUPPORTS_MULTITHREADING ++ select SYS_SUPPORTS_SMP ++ select SYS_SUPPORTS_MIPS_CPS ++ select MIPS_GIC ++ select COMMON_CLK ++ select CLKSRC_MIPS_GIC ++ select HW_HAS_PCI + endchoice + + choice +@@ -65,6 +80,10 @@ choice + depends on SOC_MT7620 + select BUILTIN_DTB + ++ config DTB_MT7621_EVAL ++ bool "MT7621 eval kit" ++ depends on SOC_MT7621 ++ + endchoice + + endif +--- a/arch/mips/ralink/Makefile ++++ b/arch/mips/ralink/Makefile +@@ -6,16 +6,24 @@ + # Copyright (C) 2009-2011 Gabor Juhos + # Copyright (C) 2013 John Crispin + +-obj-y := prom.o of.o reset.o clk.o irq.o timer.o ++obj-y := prom.o of.o reset.o ++ ++ifndef CONFIG_MIPS_GIC ++ obj-y += clk.o timer.o ++endif + + obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o + + obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o + ++obj-$(CONFIG_IRQ_INTC) += irq.o ++obj-$(CONFIG_MIPS_GIC) += irq-gic.o timer-gic.o ++ + obj-$(CONFIG_SOC_RT288X) += rt288x.o + obj-$(CONFIG_SOC_RT305X) += rt305x.o + obj-$(CONFIG_SOC_RT3883) += rt3883.o + obj-$(CONFIG_SOC_MT7620) += mt7620.o ++obj-$(CONFIG_SOC_MT7621) += mt7621.o + + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + +--- a/arch/mips/ralink/Platform ++++ b/arch/mips/ralink/Platform +@@ -27,3 +27,8 @@ cflags-$(CONFIG_SOC_RT3883) += -I$(srctr + # + load-$(CONFIG_SOC_MT7620) += 0xffffffff80000000 + cflags-$(CONFIG_SOC_MT7620) += -I$(srctree)/arch/mips/include/asm/mach-ralink/mt7620 ++ ++# Ralink MT7621 ++# ++load-$(CONFIG_SOC_MT7621) += 0xffffffff80001000 ++cflags-$(CONFIG_SOC_MT7621) += -I$(srctree)/arch/mips/include/asm/mach-ralink/mt7621 +--- /dev/null ++++ b/arch/mips/ralink/irq-gic.c +@@ -0,0 +1,18 @@ ++#include ++ ++#include ++#include ++#include ++ ++int get_c0_perfcount_int(void) ++{ ++ return gic_get_c0_perfcount_int(); ++} ++EXPORT_SYMBOL_GPL(get_c0_perfcount_int); ++ ++void __init ++arch_init_irq(void) ++{ ++ irqchip_init(); ++} ++ +--- /dev/null ++++ b/arch/mips/ralink/mt7621.c +@@ -0,0 +1,223 @@ ++/* ++ * 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. ++ * ++ * Parts of this file are based on Ralink's 2.6.21 BSP ++ * ++ * Copyright (C) 2008-2011 Gabor Juhos ++ * Copyright (C) 2008 Imre Kaloz ++ * Copyright (C) 2013 John Crispin ++ */ ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "common.h" ++ ++#define SYSC_REG_SYSCFG 0x10 ++#define SYSC_REG_CPLL_CLKCFG0 0x2c ++#define SYSC_REG_CUR_CLK_STS 0x44 ++#define CPU_CLK_SEL (BIT(30) | BIT(31)) ++ ++#define MT7621_GPIO_MODE_UART1 1 ++#define MT7621_GPIO_MODE_I2C 2 ++#define MT7621_GPIO_MODE_UART3_MASK 0x3 ++#define MT7621_GPIO_MODE_UART3_SHIFT 3 ++#define MT7621_GPIO_MODE_UART3_GPIO 1 ++#define MT7621_GPIO_MODE_UART2_MASK 0x3 ++#define MT7621_GPIO_MODE_UART2_SHIFT 5 ++#define MT7621_GPIO_MODE_UART2_GPIO 1 ++#define MT7621_GPIO_MODE_JTAG 7 ++#define MT7621_GPIO_MODE_WDT_MASK 0x3 ++#define MT7621_GPIO_MODE_WDT_SHIFT 8 ++#define MT7621_GPIO_MODE_WDT_GPIO 1 ++#define MT7621_GPIO_MODE_PCIE_RST 0 ++#define MT7621_GPIO_MODE_PCIE_REF 2 ++#define MT7621_GPIO_MODE_PCIE_MASK 0x3 ++#define MT7621_GPIO_MODE_PCIE_SHIFT 10 ++#define MT7621_GPIO_MODE_PCIE_GPIO 1 ++#define MT7621_GPIO_MODE_MDIO_MASK 0x3 ++#define MT7621_GPIO_MODE_MDIO_SHIFT 12 ++#define MT7621_GPIO_MODE_MDIO_GPIO 1 ++#define MT7621_GPIO_MODE_RGMII1 14 ++#define MT7621_GPIO_MODE_RGMII2 15 ++#define MT7621_GPIO_MODE_SPI_MASK 0x3 ++#define MT7621_GPIO_MODE_SPI_SHIFT 16 ++#define MT7621_GPIO_MODE_SPI_GPIO 1 ++#define MT7621_GPIO_MODE_SDHCI_MASK 0x3 ++#define MT7621_GPIO_MODE_SDHCI_SHIFT 18 ++#define MT7621_GPIO_MODE_SDHCI_GPIO 1 ++ ++static struct rt2880_pmx_func uart1_grp[] = { FUNC("uart1", 0, 1, 2) }; ++static struct rt2880_pmx_func i2c_grp[] = { FUNC("i2c", 0, 3, 2) }; ++static struct rt2880_pmx_func uart3_grp[] = { ++ FUNC("uart3", 0, 5, 4), ++ FUNC("i2s", 2, 5, 4), ++ FUNC("spdif3", 3, 5, 4), ++}; ++static struct rt2880_pmx_func uart2_grp[] = { ++ FUNC("uart2", 0, 9, 4), ++ FUNC("pcm", 2, 9, 4), ++ FUNC("spdif2", 3, 9, 4), ++}; ++static struct rt2880_pmx_func jtag_grp[] = { FUNC("jtag", 0, 13, 5) }; ++static struct rt2880_pmx_func wdt_grp[] = { ++ FUNC("wdt rst", 0, 18, 1), ++ FUNC("wdt refclk", 2, 18, 1), ++}; ++static struct rt2880_pmx_func pcie_rst_grp[] = { ++ FUNC("pcie rst", MT7621_GPIO_MODE_PCIE_RST, 19, 1), ++ FUNC("pcie refclk", MT7621_GPIO_MODE_PCIE_REF, 19, 1) ++}; ++static struct rt2880_pmx_func mdio_grp[] = { FUNC("mdio", 0, 20, 2) }; ++static struct rt2880_pmx_func rgmii2_grp[] = { FUNC("rgmii2", 0, 22, 12) }; ++static struct rt2880_pmx_func spi_grp[] = { ++ FUNC("spi", 0, 34, 7), ++ FUNC("nand1", 2, 34, 7), ++}; ++static struct rt2880_pmx_func sdhci_grp[] = { ++ FUNC("sdhci", 0, 41, 8), ++ FUNC("nand2", 2, 41, 8), ++}; ++static struct rt2880_pmx_func rgmii1_grp[] = { FUNC("rgmii1", 0, 49, 12) }; ++ ++static struct rt2880_pmx_group mt7621_pinmux_data[] = { ++ GRP("uart1", uart1_grp, 1, MT7621_GPIO_MODE_UART1), ++ GRP("i2c", i2c_grp, 1, MT7621_GPIO_MODE_I2C), ++ GRP_G("uart3", uart3_grp, MT7621_GPIO_MODE_UART3_MASK, ++ MT7621_GPIO_MODE_UART3_GPIO, MT7621_GPIO_MODE_UART3_SHIFT), ++ GRP_G("uart2", uart2_grp, MT7621_GPIO_MODE_UART2_MASK, ++ MT7621_GPIO_MODE_UART2_GPIO, MT7621_GPIO_MODE_UART2_SHIFT), ++ GRP("jtag", jtag_grp, 1, MT7621_GPIO_MODE_JTAG), ++ GRP_G("wdt", wdt_grp, MT7621_GPIO_MODE_WDT_MASK, ++ MT7621_GPIO_MODE_WDT_GPIO, MT7621_GPIO_MODE_WDT_SHIFT), ++ GRP_G("pcie", pcie_rst_grp, MT7621_GPIO_MODE_PCIE_MASK, ++ MT7621_GPIO_MODE_PCIE_GPIO, MT7621_GPIO_MODE_PCIE_SHIFT), ++ GRP_G("mdio", mdio_grp, MT7621_GPIO_MODE_MDIO_MASK, ++ MT7621_GPIO_MODE_MDIO_GPIO, MT7621_GPIO_MODE_MDIO_SHIFT), ++ GRP("rgmii2", rgmii2_grp, 1, MT7621_GPIO_MODE_RGMII2), ++ GRP_G("spi", spi_grp, MT7621_GPIO_MODE_SPI_MASK, ++ MT7621_GPIO_MODE_SPI_GPIO, MT7621_GPIO_MODE_SPI_SHIFT), ++ GRP_G("sdhci", sdhci_grp, MT7621_GPIO_MODE_SDHCI_MASK, ++ MT7621_GPIO_MODE_SDHCI_GPIO, MT7621_GPIO_MODE_SDHCI_SHIFT), ++ GRP("rgmii1", rgmii1_grp, 1, MT7621_GPIO_MODE_RGMII1), ++ { 0 } ++}; ++ ++phys_addr_t mips_cpc_default_phys_base() { ++ panic("Cannot detect cpc address"); ++} ++ ++void __init ralink_clk_init(void) ++{ ++ int cpu_fdiv = 0; ++ int cpu_ffrac = 0; ++ int fbdiv = 0; ++ u32 clk_sts, syscfg; ++ u8 clk_sel = 0, xtal_mode; ++ u32 cpu_clk; ++ ++ if ((rt_sysc_r32(SYSC_REG_CPLL_CLKCFG0) & CPU_CLK_SEL) != 0) ++ clk_sel = 1; ++ ++ switch (clk_sel) { ++ case 0: ++ clk_sts = rt_sysc_r32(SYSC_REG_CUR_CLK_STS); ++ cpu_fdiv = ((clk_sts >> 8) & 0x1F); ++ cpu_ffrac = (clk_sts & 0x1F); ++ cpu_clk = (500 * cpu_ffrac / cpu_fdiv) * 1000 * 1000; ++ break; ++ ++ case 1: ++ fbdiv = ((rt_sysc_r32(0x648) >> 4) & 0x7F) + 1; ++ syscfg = rt_sysc_r32(SYSC_REG_SYSCFG); ++ xtal_mode = (syscfg >> 6) & 0x7; ++ if(xtal_mode >= 6) { //25Mhz Xtal ++ cpu_clk = 25 * fbdiv * 1000 * 1000; ++ } else if(xtal_mode >=3) { //40Mhz Xtal ++ cpu_clk = 40 * fbdiv * 1000 * 1000; ++ } else { // 20Mhz Xtal ++ cpu_clk = 20 * fbdiv * 1000 * 1000; ++ } ++ break; ++ } ++} ++ ++void __init ralink_of_remap(void) ++{ ++ rt_sysc_membase = plat_of_remap_node("mtk,mt7621-sysc"); ++ rt_memc_membase = plat_of_remap_node("mtk,mt7621-memc"); ++ ++ if (!rt_sysc_membase || !rt_memc_membase) ++ panic("Failed to remap core resources"); ++} ++ ++void prom_soc_init(struct ralink_soc_info *soc_info) ++{ ++ void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE); ++ unsigned char *name = NULL; ++ u32 n0; ++ u32 n1; ++ u32 rev; ++ ++ n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); ++ n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); ++ ++ if (n0 == MT7621_CHIP_NAME0 && n1 == MT7621_CHIP_NAME1) { ++ name = "MT7621"; ++ soc_info->compatible = "mtk,mt7621-soc"; ++ } else { ++ panic("mt7621: unknown SoC, n0:%08x n1:%08x\n", n0, n1); ++ } ++ ++ rev = __raw_readl(sysc + SYSC_REG_CHIP_REV); ++ ++ snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, ++ "MediaTek %s ver:%u eco:%u", ++ name, ++ (rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK, ++ (rev & CHIP_REV_ECO_MASK)); ++ ++ soc_info->mem_size_min = MT7621_DDR2_SIZE_MIN; ++ soc_info->mem_size_max = MT7621_DDR2_SIZE_MAX; ++ soc_info->mem_base = MT7621_DRAM_BASE; ++ ++ rt2880_pinmux_data = mt7621_pinmux_data; ++ ++ /* Early detection of CMP support */ ++ mips_cm_probe(); ++ mips_cpc_probe(); ++ ++ if (mips_cm_numiocu()) { ++ /* mips_cm_probe() wipes out bootloader ++ config for CM regions and we have to configure them ++ again. This SoC cannot talk to pamlbus devices ++ witout proper iocu region set up. ++ ++ FIXME: it would be better to do this with values ++ from DT, but we need this very early because ++ without this we cannot talk to pretty much anything ++ including serial. ++ */ ++ write_gcr_reg0_base(MT7621_PALMBUS_BASE); ++ write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE | CM_GCR_REGn_MASK_CMTGT_IOCU0); ++ } ++ ++ if (!register_cps_smp_ops()) ++ return; ++ if (!register_cmp_smp_ops()) ++ return; ++ if (!register_vsmp_smp_ops()) ++ return; ++} +--- /dev/null ++++ b/arch/mips/ralink/timer-gic.c +@@ -0,0 +1,15 @@ ++#include ++ ++#include ++#include ++#include ++ ++#include "common.h" ++ ++void __init plat_time_init(void) ++{ ++ ralink_of_remap(); ++ ++ of_clk_init(NULL); ++ clocksource_probe(); ++} diff --git a/target/linux/ramips/patches-4.4/0002-MIPS-ralink-add-MT7621-defconfig.patch b/target/linux/ramips/patches-4.4/0002-MIPS-ralink-add-MT7621-defconfig.patch new file mode 100644 index 0000000000..d788f2f076 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0002-MIPS-ralink-add-MT7621-defconfig.patch @@ -0,0 +1,211 @@ +From c96f2cc4d5f6e1bb11f3e7e04a7e21503a214d7c Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 27 Jan 2014 13:12:41 +0000 +Subject: [PATCH 02/53] MIPS: ralink: add MT7621 defconfig + +Signed-off-by: John Crispin +--- + arch/mips/configs/mt7621_defconfig | 197 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 197 insertions(+) + create mode 100644 arch/mips/configs/mt7621_defconfig + +--- /dev/null ++++ b/arch/mips/configs/mt7621_defconfig +@@ -0,0 +1,197 @@ ++# CONFIG_LOCALVERSION_AUTO is not set ++CONFIG_SYSVIPC=y ++CONFIG_HIGH_RES_TIMERS=y ++CONFIG_RCU_FANOUT=32 ++CONFIG_UIDGID_STRICT_TYPE_CHECKS=y ++CONFIG_BLK_DEV_INITRD=y ++CONFIG_INITRAMFS_SOURCE="/openwrt/trunk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/root-ramips /openwrt/trunk/target/linux/generic/image/initramfs-base-files.txt" ++CONFIG_INITRAMFS_ROOT_UID=1000 ++CONFIG_INITRAMFS_ROOT_GID=1000 ++# CONFIG_RD_GZIP is not set ++CONFIG_CC_OPTIMIZE_FOR_SIZE=y ++# CONFIG_AIO is not set ++CONFIG_EMBEDDED=y ++# CONFIG_VM_EVENT_COUNTERS is not set ++# CONFIG_SLUB_DEBUG is not set ++# CONFIG_COMPAT_BRK is not set ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++# CONFIG_BLK_DEV_BSG is not set ++CONFIG_PARTITION_ADVANCED=y ++# CONFIG_IOSCHED_CFQ is not set ++CONFIG_SMP=y ++CONFIG_NR_CPUS=4 ++CONFIG_SCHED_SMT=y ++# CONFIG_COMPACTION is not set ++# CONFIG_CROSS_MEMORY_ATTACH is not set ++# CONFIG_SECCOMP is not set ++CONFIG_HZ_100=y ++CONFIG_CMDLINE_BOOL=y ++CONFIG_CMDLINE="rootfstype=squashfs,jffs2" ++# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set ++CONFIG_NET=y ++CONFIG_PACKET=y ++CONFIG_UNIX=y ++CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_ARPD=y ++CONFIG_SYN_COOKIES=y ++# CONFIG_INET_XFRM_MODE_TRANSPORT is not set ++# CONFIG_INET_XFRM_MODE_TUNNEL is not set ++# CONFIG_INET_XFRM_MODE_BEET is not set ++# CONFIG_INET_LRO is not set ++# CONFIG_INET_DIAG is not set ++CONFIG_TCP_CONG_ADVANCED=y ++# CONFIG_TCP_CONG_BIC is not set ++# CONFIG_TCP_CONG_WESTWOOD is not set ++# CONFIG_TCP_CONG_HTCP is not set ++CONFIG_IPV6_PRIVACY=y ++# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set ++# CONFIG_INET6_XFRM_MODE_TUNNEL is not set ++# CONFIG_INET6_XFRM_MODE_BEET is not set ++# CONFIG_IPV6_SIT is not set ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_SUBTREES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_NETFILTER=y ++# CONFIG_BRIDGE_NETFILTER is not set ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NETFILTER_XT_MARK=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NF_CONNTRACK_IPV4=m ++# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_NF_NAT_IPV4=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_RAW=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_BRIDGE=m ++# CONFIG_BRIDGE_IGMP_SNOOPING is not set ++CONFIG_VLAN_8021Q=y ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_FQ_CODEL=y ++CONFIG_HAMRADIO=y ++CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" ++# CONFIG_FIRMWARE_IN_KERNEL is not set ++CONFIG_MTD=y ++CONFIG_MTD_CMDLINE_PARTS=y ++CONFIG_MTD_BLOCK=y ++CONFIG_MTD_CFI=y ++CONFIG_MTD_CFI_AMDSTD=y ++CONFIG_MTD_COMPLEX_MAPPINGS=y ++CONFIG_MTD_PHYSMAP=y ++CONFIG_MTD_M25P80=y ++CONFIG_EEPROM_93CX6=m ++CONFIG_SCSI=y ++CONFIG_BLK_DEV_SD=y ++CONFIG_NETDEVICES=y ++# CONFIG_NET_PACKET_ENGINE is not set ++# CONFIG_NET_VENDOR_WIZNET is not set ++CONFIG_PHYLIB=y ++CONFIG_SWCONFIG=y ++CONFIG_PPP=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOE=m ++CONFIG_PPP_ASYNC=m ++CONFIG_ISDN=y ++# CONFIG_INPUT is not set ++# CONFIG_SERIO is not set ++# CONFIG_VT is not set ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_DEVKMEM is not set ++CONFIG_SERIAL_8250=y ++# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set ++CONFIG_SERIAL_8250_CONSOLE=y ++# CONFIG_SERIAL_8250_PCI is not set ++CONFIG_SERIAL_8250_RUNTIME_UARTS=2 ++CONFIG_SPI=y ++CONFIG_GPIOLIB=y ++CONFIG_GPIO_SYSFS=y ++# CONFIG_HWMON is not set ++CONFIG_WATCHDOG=y ++CONFIG_WATCHDOG_CORE=y ++# CONFIG_VGA_ARB is not set ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_PLATFORM=y ++CONFIG_USB_MT7621_XHCI_PLATFORM=y ++CONFIG_USB_STORAGE=y ++CONFIG_USB_PHY=y ++CONFIG_NEW_LEDS=y ++CONFIG_LEDS_CLASS=y ++CONFIG_LEDS_GPIO=m ++CONFIG_LEDS_TRIGGERS=y ++CONFIG_LEDS_TRIGGER_TIMER=y ++CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ++CONFIG_STAGING=y ++CONFIG_USB_DWC2=m ++# CONFIG_IOMMU_SUPPORT is not set ++CONFIG_RESET_CONTROLLER=y ++# CONFIG_FIRMWARE_MEMMAP is not set ++# CONFIG_DNOTIFY is not set ++# CONFIG_PROC_PAGE_MONITOR is not set ++CONFIG_TMPFS=y ++CONFIG_TMPFS_XATTR=y ++CONFIG_JFFS2_FS=y ++CONFIG_JFFS2_SUMMARY=y ++CONFIG_JFFS2_FS_XATTR=y ++# CONFIG_JFFS2_FS_POSIX_ACL is not set ++# CONFIG_JFFS2_FS_SECURITY is not set ++CONFIG_JFFS2_COMPRESSION_OPTIONS=y ++# CONFIG_JFFS2_ZLIB is not set ++CONFIG_SQUASHFS=y ++# CONFIG_SQUASHFS_ZLIB is not set ++CONFIG_SQUASHFS_XZ=y ++CONFIG_PRINTK_TIME=y ++# CONFIG_ENABLE_MUST_CHECK is not set ++CONFIG_FRAME_WARN=1024 ++CONFIG_MAGIC_SYSRQ=y ++CONFIG_STRIP_ASM_SYMS=y ++# CONFIG_UNUSED_SYMBOLS is not set ++CONFIG_DEBUG_FS=y ++# CONFIG_SCHED_DEBUG is not set ++CONFIG_DEBUG_INFO=y ++CONFIG_DEBUG_INFO_REDUCED=y ++CONFIG_RCU_CPU_STALL_TIMEOUT=60 ++# CONFIG_FTRACE is not set ++CONFIG_CRYPTO_ARC4=m ++# CONFIG_CRYPTO_ANSI_CPRNG is not set ++# CONFIG_VIRTUALIZATION is not set ++CONFIG_CRC_ITU_T=m ++CONFIG_CRC32_SARWATE=y ++# CONFIG_XZ_DEC_X86 is not set ++CONFIG_AVERAGE=y diff --git a/target/linux/ramips/patches-4.4/0004-MIPS-ralink-add-MT7621-pcie-driver.patch b/target/linux/ramips/patches-4.4/0004-MIPS-ralink-add-MT7621-pcie-driver.patch new file mode 100644 index 0000000000..d4c1506cf7 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0004-MIPS-ralink-add-MT7621-pcie-driver.patch @@ -0,0 +1,857 @@ +From fec11d4e8dc5cc79bcd7c8fd55038ac21ac39965 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 16 Mar 2014 05:22:39 +0000 +Subject: [PATCH 04/53] MIPS: ralink: add MT7621 pcie driver + +Signed-off-by: John Crispin +--- + arch/mips/pci/Makefile | 1 + + arch/mips/pci/pci-mt7621.c | 813 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 814 insertions(+) + create mode 100644 arch/mips/pci/pci-mt7621.c + +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -43,6 +43,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1 + obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o + obj-$(CONFIG_LANTIQ) += fixup-lantiq.o + obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o ++obj-$(CONFIG_SOC_MT7621) += pci-mt7621.o + obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o + obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o + obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o +--- /dev/null ++++ b/arch/mips/pci/pci-mt7621.c +@@ -0,0 +1,832 @@ ++/************************************************************************** ++ * ++ * BRIEF MODULE DESCRIPTION ++ * PCI init for Ralink RT2880 solution ++ * ++ * Copyright 2007 Ralink Inc. (bruce_chang@ralinktech.com.tw) ++ * ++ * 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. ++ * ++ * ++ ************************************************************************** ++ * May 2007 Bruce Chang ++ * Initial Release ++ * ++ * May 2009 Bruce Chang ++ * support RT2880/RT3883 PCIe ++ * ++ * May 2011 Bruce Chang ++ * support RT6855/MT7620 PCIe ++ * ++ ************************************************************************** ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++extern void pcie_phy_init(void); ++extern void chk_phy_pll(void); ++ ++/* ++ * These functions and structures provide the BIOS scan and mapping of the PCI ++ * devices. ++ */ ++ ++#define CONFIG_PCIE_PORT0 ++#define CONFIG_PCIE_PORT1 ++#define CONFIG_PCIE_PORT2 ++#define RALINK_PCIE0_CLK_EN (1<<24) ++#define RALINK_PCIE1_CLK_EN (1<<25) ++#define RALINK_PCIE2_CLK_EN (1<<26) ++ ++#define RALINK_PCI_CONFIG_ADDR 0x20 ++#define RALINK_PCI_CONFIG_DATA_VIRTUAL_REG 0x24 ++#define SURFBOARDINT_PCIE0 11 /* PCIE0 */ ++#define RALINK_INT_PCIE0 SURFBOARDINT_PCIE0 ++#define RALINK_INT_PCIE1 SURFBOARDINT_PCIE1 ++#define RALINK_INT_PCIE2 SURFBOARDINT_PCIE2 ++#define SURFBOARDINT_PCIE1 31 /* PCIE1 */ ++#define SURFBOARDINT_PCIE2 32 /* PCIE2 */ ++#define RALINK_PCI_MEMBASE *(volatile u32 *)(RALINK_PCI_BASE + 0x0028) ++#define RALINK_PCI_IOBASE *(volatile u32 *)(RALINK_PCI_BASE + 0x002C) ++#define RALINK_PCIE0_RST (1<<24) ++#define RALINK_PCIE1_RST (1<<25) ++#define RALINK_PCIE2_RST (1<<26) ++#define RALINK_SYSCTL_BASE 0xBE000000 ++ ++#define RALINK_PCI_PCICFG_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 0x0000) ++#define RALINK_PCI_PCIMSK_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 0x000C) ++#define RALINK_PCI_BASE 0xBE140000 ++ ++#define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000) ++#define RT6855_PCIE0_OFFSET 0x2000 ++#define RT6855_PCIE1_OFFSET 0x3000 ++#define RT6855_PCIE2_OFFSET 0x4000 ++ ++#define RALINK_PCI0_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0010) ++#define RALINK_PCI0_IMBASEBAR0_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0018) ++#define RALINK_PCI0_ID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0030) ++#define RALINK_PCI0_CLASS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0034) ++#define RALINK_PCI0_SUBID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0038) ++#define RALINK_PCI0_STATUS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0050) ++#define RALINK_PCI0_DERR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0060) ++#define RALINK_PCI0_ECRC *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0064) ++ ++#define RALINK_PCI1_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0010) ++#define RALINK_PCI1_IMBASEBAR0_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0018) ++#define RALINK_PCI1_ID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0030) ++#define RALINK_PCI1_CLASS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0034) ++#define RALINK_PCI1_SUBID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0038) ++#define RALINK_PCI1_STATUS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0050) ++#define RALINK_PCI1_DERR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0060) ++#define RALINK_PCI1_ECRC *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0064) ++ ++#define RALINK_PCI2_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0010) ++#define RALINK_PCI2_IMBASEBAR0_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0018) ++#define RALINK_PCI2_ID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0030) ++#define RALINK_PCI2_CLASS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0034) ++#define RALINK_PCI2_SUBID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0038) ++#define RALINK_PCI2_STATUS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0050) ++#define RALINK_PCI2_DERR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0060) ++#define RALINK_PCI2_ECRC *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0064) ++ ++#define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000) ++#define RALINK_PCIEPHY_P2_CTL_OFFSET (RALINK_PCI_BASE + 0xA000) ++ ++ ++#define MV_WRITE(ofs, data) \ ++ *(volatile u32 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le32(data) ++#define MV_READ(ofs, data) \ ++ *(data) = le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs))) ++#define MV_READ_DATA(ofs) \ ++ le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs))) ++ ++#define MV_WRITE_16(ofs, data) \ ++ *(volatile u16 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le16(data) ++#define MV_READ_16(ofs, data) \ ++ *(data) = le16_to_cpu(*(volatile u16 *)(RALINK_PCI_BASE+(ofs))) ++ ++#define MV_WRITE_8(ofs, data) \ ++ *(volatile u8 *)(RALINK_PCI_BASE+(ofs)) = data ++#define MV_READ_8(ofs, data) \ ++ *(data) = *(volatile u8 *)(RALINK_PCI_BASE+(ofs)) ++ ++ ++ ++#define RALINK_PCI_MM_MAP_BASE 0x60000000 ++#define RALINK_PCI_IO_MAP_BASE 0x1e160000 ++ ++#define RALINK_SYSTEM_CONTROL_BASE 0xbe000000 ++#define GPIO_PERST ++#define ASSERT_SYSRST_PCIE(val) do { \ ++ if (*(unsigned int *)(0xbe00000c) == 0x00030101) \ ++ RALINK_RSTCTRL |= val; \ ++ else \ ++ RALINK_RSTCTRL &= ~val; \ ++ } while(0) ++#define DEASSERT_SYSRST_PCIE(val) do { \ ++ if (*(unsigned int *)(0xbe00000c) == 0x00030101) \ ++ RALINK_RSTCTRL &= ~val; \ ++ else \ ++ RALINK_RSTCTRL |= val; \ ++ } while(0) ++#define RALINK_SYSCFG1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x14) ++#define RALINK_CLKCFG1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x30) ++#define RALINK_RSTCTRL *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x34) ++#define RALINK_GPIOMODE *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x60) ++#define RALINK_PCIE_CLK_GEN *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x7c) ++#define RALINK_PCIE_CLK_GEN1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x80) ++#define PPLL_CFG1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x9c) ++#define PPLL_DRV *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0xa0) ++//RALINK_SYSCFG1 bit ++#define RALINK_PCI_HOST_MODE_EN (1<<7) ++#define RALINK_PCIE_RC_MODE_EN (1<<8) ++//RALINK_RSTCTRL bit ++#define RALINK_PCIE_RST (1<<23) ++#define RALINK_PCI_RST (1<<24) ++//RALINK_CLKCFG1 bit ++#define RALINK_PCI_CLK_EN (1<<19) ++#define RALINK_PCIE_CLK_EN (1<<21) ++//RALINK_GPIOMODE bit ++#define PCI_SLOTx2 (1<<11) ++#define PCI_SLOTx1 (2<<11) ++//MTK PCIE PLL bit ++#define PDRV_SW_SET (1<<31) ++#define LC_CKDRVPD_ (1<<19) ++ ++#define MEMORY_BASE 0x0 ++static int pcie_link_status = 0; ++ ++#define PCI_ACCESS_READ_1 0 ++#define PCI_ACCESS_READ_2 1 ++#define PCI_ACCESS_READ_4 2 ++#define PCI_ACCESS_WRITE_1 3 ++#define PCI_ACCESS_WRITE_2 4 ++#define PCI_ACCESS_WRITE_4 5 ++ ++static int config_access(unsigned char access_type, struct pci_bus *bus, ++ unsigned int devfn, unsigned int where, u32 * data) ++{ ++ unsigned int slot = PCI_SLOT(devfn); ++ u8 func = PCI_FUNC(devfn); ++ uint32_t address_reg, data_reg; ++ unsigned int address; ++ ++ address_reg = RALINK_PCI_CONFIG_ADDR; ++ data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG; ++ ++ address = (((where&0xF00)>>8)<<24) |(bus->number << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | 0x80000000; ++ MV_WRITE(address_reg, address); ++ ++ switch(access_type) { ++ case PCI_ACCESS_WRITE_1: ++ MV_WRITE_8(data_reg+(where&0x3), *data); ++ break; ++ case PCI_ACCESS_WRITE_2: ++ MV_WRITE_16(data_reg+(where&0x3), *data); ++ break; ++ case PCI_ACCESS_WRITE_4: ++ MV_WRITE(data_reg, *data); ++ break; ++ case PCI_ACCESS_READ_1: ++ MV_READ_8( data_reg+(where&0x3), data); ++ break; ++ case PCI_ACCESS_READ_2: ++ MV_READ_16(data_reg+(where&0x3), data); ++ break; ++ case PCI_ACCESS_READ_4: ++ MV_READ(data_reg, data); ++ break; ++ default: ++ printk("no specify access type\n"); ++ break; ++ } ++ return 0; ++} ++ ++static int ++read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 * val) ++{ ++ return config_access(PCI_ACCESS_READ_1, bus, devfn, (unsigned int)where, (u32 *)val); ++} ++ ++static int ++read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 * val) ++{ ++ return config_access(PCI_ACCESS_READ_2, bus, devfn, (unsigned int)where, (u32 *)val); ++} ++ ++static int ++read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 * val) ++{ ++ return config_access(PCI_ACCESS_READ_4, bus, devfn, (unsigned int)where, (u32 *)val); ++} ++ ++static int ++write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val) ++{ ++ if (config_access(PCI_ACCESS_WRITE_1, bus, devfn, (unsigned int)where, (u32 *)&val)) ++ return -1; ++ ++ return PCIBIOS_SUCCESSFUL; ++} ++ ++static int ++write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val) ++{ ++ if (config_access(PCI_ACCESS_WRITE_2, bus, devfn, where, (u32 *)&val)) ++ return -1; ++ ++ return PCIBIOS_SUCCESSFUL; ++} ++ ++static int ++write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val) ++{ ++ if (config_access(PCI_ACCESS_WRITE_4, bus, devfn, where, &val)) ++ return -1; ++ ++ return PCIBIOS_SUCCESSFUL; ++} ++ ++ ++static int ++pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * val) ++{ ++ switch (size) { ++ case 1: ++ return read_config_byte(bus, devfn, where, (u8 *) val); ++ case 2: ++ return read_config_word(bus, devfn, where, (u16 *) val); ++ default: ++ return read_config_dword(bus, devfn, where, val); ++ } ++} ++ ++static int ++pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) ++{ ++ switch (size) { ++ case 1: ++ return write_config_byte(bus, devfn, where, (u8) val); ++ case 2: ++ return write_config_word(bus, devfn, where, (u16) val); ++ default: ++ return write_config_dword(bus, devfn, where, val); ++ } ++} ++ ++struct pci_ops mt7621_pci_ops= { ++ .read = pci_config_read, ++ .write = pci_config_write, ++}; ++ ++static struct resource mt7621_res_pci_mem1 = { ++ .name = "PCI MEM1", ++ .start = RALINK_PCI_MM_MAP_BASE, ++ .end = (u32)((RALINK_PCI_MM_MAP_BASE + (unsigned char *)0x0fffffff)), ++ .flags = IORESOURCE_MEM, ++}; ++static struct resource mt7621_res_pci_io1 = { ++ .name = "PCI I/O1", ++ .start = RALINK_PCI_IO_MAP_BASE, ++ .end = (u32)((RALINK_PCI_IO_MAP_BASE + (unsigned char *)0x0ffff)), ++ .flags = IORESOURCE_IO, ++}; ++ ++static struct pci_controller mt7621_controller = { ++ .pci_ops = &mt7621_pci_ops, ++ .mem_resource = &mt7621_res_pci_mem1, ++ .io_resource = &mt7621_res_pci_io1, ++ .mem_offset = 0x00000000UL, ++ .io_offset = 0x00000000UL, ++ .io_map_base = 0xa0000000, ++}; ++ ++static void ++read_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned long *val) ++{ ++ unsigned int address_reg, data_reg, address; ++ ++ address_reg = RALINK_PCI_CONFIG_ADDR; ++ data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG; ++ address = (((reg & 0xF00)>>8)<<24) | (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | 0x80000000 ; ++ MV_WRITE(address_reg, address); ++ MV_READ(data_reg, val); ++ return; ++} ++ ++static void ++write_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned long val) ++{ ++ unsigned int address_reg, data_reg, address; ++ ++ address_reg = RALINK_PCI_CONFIG_ADDR; ++ data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG; ++ address = (((reg & 0xF00)>>8)<<24) | (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | 0x80000000 ; ++ MV_WRITE(address_reg, address); ++ MV_WRITE(data_reg, val); ++ return; ++} ++ ++ ++int __init ++pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ u16 cmd; ++ u32 val; ++ int irq = 0; ++ ++ if ((dev->bus->number == 0) && (slot == 0)) { ++ write_config(0, 0, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE); ++ read_config(0, 0, 0, PCI_BASE_ADDRESS_0, (unsigned long *)&val); ++ printk("BAR0 at slot 0 = %x\n", val); ++ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot); ++ } else if((dev->bus->number == 0) && (slot == 0x1)) { ++ write_config(0, 1, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE); ++ read_config(0, 1, 0, PCI_BASE_ADDRESS_0, (unsigned long *)&val); ++ printk("BAR0 at slot 1 = %x\n", val); ++ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot); ++ } else if((dev->bus->number == 0) && (slot == 0x2)) { ++ write_config(0, 2, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE); ++ read_config(0, 2, 0, PCI_BASE_ADDRESS_0, (unsigned long *)&val); ++ printk("BAR0 at slot 2 = %x\n", val); ++ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot); ++ } else if ((dev->bus->number == 1) && (slot == 0x0)) { ++ switch (pcie_link_status) { ++ case 2: ++ case 6: ++ irq = RALINK_INT_PCIE1; ++ break; ++ case 4: ++ irq = RALINK_INT_PCIE2; ++ break; ++ default: ++ irq = RALINK_INT_PCIE0; ++ } ++ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq); ++ } else if ((dev->bus->number == 2) && (slot == 0x0)) { ++ switch (pcie_link_status) { ++ case 5: ++ case 6: ++ irq = RALINK_INT_PCIE2; ++ break; ++ default: ++ irq = RALINK_INT_PCIE1; ++ } ++ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq); ++ } else if ((dev->bus->number == 2) && (slot == 0x1)) { ++ switch (pcie_link_status) { ++ case 5: ++ case 6: ++ irq = RALINK_INT_PCIE2; ++ break; ++ default: ++ irq = RALINK_INT_PCIE1; ++ } ++ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq); ++ } else if ((dev->bus->number ==3) && (slot == 0x0)) { ++ irq = RALINK_INT_PCIE2; ++ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq); ++ } else if ((dev->bus->number ==3) && (slot == 0x1)) { ++ irq = RALINK_INT_PCIE2; ++ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq); ++ } else if ((dev->bus->number ==3) && (slot == 0x2)) { ++ irq = RALINK_INT_PCIE2; ++ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq); ++ } else { ++ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot); ++ return 0; ++ } ++ ++ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x14); //configure cache line size 0x14 ++ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xFF); //configure latency timer 0x10 ++ pci_read_config_word(dev, PCI_COMMAND, &cmd); ++ cmd = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY; ++ pci_write_config_word(dev, PCI_COMMAND, cmd); ++ pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); ++ return irq; ++} ++ ++void ++set_pcie_phy(u32 *addr, int start_b, int bits, int val) ++{ ++// printk("0x%p:", addr); ++// printk(" %x", *addr); ++ *(unsigned int *)(addr) &= ~(((1< %x\n", *addr); ++} ++ ++void ++bypass_pipe_rst(void) ++{ ++#if defined (CONFIG_PCIE_PORT0) ++ /* PCIe Port 0 */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x02c), 12, 1, 0x01); // rg_pe1_pipe_rst_b ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x02c), 4, 1, 0x01); // rg_pe1_pipe_cmd_frc[4] ++#endif ++#if defined (CONFIG_PCIE_PORT1) ++ /* PCIe Port 1 */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x12c), 12, 1, 0x01); // rg_pe1_pipe_rst_b ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x12c), 4, 1, 0x01); // rg_pe1_pipe_cmd_frc[4] ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ /* PCIe Port 2 */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x02c), 12, 1, 0x01); // rg_pe1_pipe_rst_b ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x02c), 4, 1, 0x01); // rg_pe1_pipe_cmd_frc[4] ++#endif ++} ++ ++void ++set_phy_for_ssc(void) ++{ ++ unsigned long reg = (*(volatile u32 *)(RALINK_SYSCTL_BASE + 0x10)); ++ ++ reg = (reg >> 6) & 0x7; ++#if defined (CONFIG_PCIE_PORT0) || defined (CONFIG_PCIE_PORT1) ++ /* Set PCIe Port0 & Port1 PHY to disable SSC */ ++ /* Debug Xtal Type */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400), 8, 1, 0x01); // rg_pe1_frc_h_xtal_type ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400), 9, 2, 0x00); // rg_pe1_h_xtal_type ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 4, 1, 0x01); // rg_pe1_frc_phy_en //Force Port 0 enable control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 4, 1, 0x01); // rg_pe1_frc_phy_en //Force Port 1 enable control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 5, 1, 0x00); // rg_pe1_phy_en //Port 0 disable ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 5, 1, 0x00); // rg_pe1_phy_en //Port 1 disable ++ if(reg <= 5 && reg >= 3) { // 40MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 6, 2, 0x01); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode) ++ printk("***** Xtal 40MHz *****\n"); ++ } else { // 25MHz | 20MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 6, 2, 0x00); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode) ++ if (reg >= 6) { ++ printk("***** Xtal 25MHz *****\n"); ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4bc), 4, 2, 0x01); // RG_PE1_H_PLL_FBKSEL //Feedback clock select ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x49c), 0,31, 0x18000000); // RG_PE1_H_LCDDS_PCW_NCPO //DDS NCPO PCW (for host mode) ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a4), 0,16, 0x18d); // RG_PE1_H_LCDDS_SSC_PRD //DDS SSC dither period control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a8), 0,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither amplitude control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a8), 16,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA1 //DDS SSC dither amplitude control for initial ++ } else { ++ printk("***** Xtal 20MHz *****\n"); ++ } ++ } ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a0), 5, 1, 0x01); // RG_PE1_LCDDS_CLK_PH_INV //DDS clock inversion ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 22, 2, 0x02); // RG_PE1_H_PLL_BC ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 18, 4, 0x06); // RG_PE1_H_PLL_BP ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 12, 4, 0x02); // RG_PE1_H_PLL_IR ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 8, 4, 0x01); // RG_PE1_H_PLL_IC ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4ac), 16, 3, 0x00); // RG_PE1_H_PLL_BR ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 1, 3, 0x02); // RG_PE1_PLL_DIVEN ++ if(reg <= 5 && reg >= 3) { // 40MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x414), 6, 2, 0x01); // rg_pe1_mstckdiv //value of da_pe1_mstckdiv when force mode enable ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x414), 5, 1, 0x01); // rg_pe1_frc_mstckdiv //force mode enable of da_pe1_mstckdiv ++ } ++ /* Enable PHY and disable force mode */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 5, 1, 0x01); // rg_pe1_phy_en //Port 0 enable ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 5, 1, 0x01); // rg_pe1_phy_en //Port 1 enable ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 4, 1, 0x00); // rg_pe1_frc_phy_en //Force Port 0 disable control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 4, 1, 0x00); // rg_pe1_frc_phy_en //Force Port 1 disable control ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ /* Set PCIe Port2 PHY to disable SSC */ ++ /* Debug Xtal Type */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x400), 8, 1, 0x01); // rg_pe1_frc_h_xtal_type ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x400), 9, 2, 0x00); // rg_pe1_h_xtal_type ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 4, 1, 0x01); // rg_pe1_frc_phy_en //Force Port 0 enable control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 5, 1, 0x00); // rg_pe1_phy_en //Port 0 disable ++ if(reg <= 5 && reg >= 3) { // 40MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 6, 2, 0x01); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode) ++ } else { // 25MHz | 20MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 6, 2, 0x00); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode) ++ if (reg >= 6) { // 25MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4bc), 4, 2, 0x01); // RG_PE1_H_PLL_FBKSEL //Feedback clock select ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x49c), 0,31, 0x18000000); // RG_PE1_H_LCDDS_PCW_NCPO //DDS NCPO PCW (for host mode) ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a4), 0,16, 0x18d); // RG_PE1_H_LCDDS_SSC_PRD //DDS SSC dither period control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a8), 0,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither amplitude control ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a8), 16,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA1 //DDS SSC dither amplitude control for initial ++ } ++ } ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a0), 5, 1, 0x01); // RG_PE1_LCDDS_CLK_PH_INV //DDS clock inversion ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 22, 2, 0x02); // RG_PE1_H_PLL_BC ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 18, 4, 0x06); // RG_PE1_H_PLL_BP ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 12, 4, 0x02); // RG_PE1_H_PLL_IR ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 8, 4, 0x01); // RG_PE1_H_PLL_IC ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4ac), 16, 3, 0x00); // RG_PE1_H_PLL_BR ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 1, 3, 0x02); // RG_PE1_PLL_DIVEN ++ if(reg <= 5 && reg >= 3) { // 40MHz Xtal ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x414), 6, 2, 0x01); // rg_pe1_mstckdiv //value of da_pe1_mstckdiv when force mode enable ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x414), 5, 1, 0x01); // rg_pe1_frc_mstckdiv //force mode enable of da_pe1_mstckdiv ++ } ++ /* Enable PHY and disable force mode */ ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 5, 1, 0x01); // rg_pe1_phy_en //Port 0 enable ++ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 4, 1, 0x00); // rg_pe1_frc_phy_en //Force Port 0 disable control ++#endif ++} ++ ++void setup_cm_memory_region(struct resource *mem_resource) ++{ ++ resource_size_t mask; ++ if (mips_cm_numiocu()) { ++ /* FIXME: hardware doesn't accept mask values with 1s after ++ 0s (e.g. 0xffef), so it would be great to warn if that's ++ about to happen */ ++ mask = ~(mem_resource->end - mem_resource->start); ++ ++ write_gcr_reg1_base(mem_resource->start); ++ write_gcr_reg1_mask(mask | CM_GCR_REGn_MASK_CMTGT_IOCU0); ++ printk("PCI coherence region base: 0x%08lx, mask/settings: 0x%08lx\n", ++ read_gcr_reg1_base(), ++ read_gcr_reg1_mask()); ++ } ++} ++ ++static int mt7621_pci_probe(struct platform_device *pdev) ++{ ++ unsigned long val = 0; ++ ++ iomem_resource.start = 0; ++ iomem_resource.end= ~0; ++ ioport_resource.start= 0; ++ ioport_resource.end = ~0; ++ ++#if defined (CONFIG_PCIE_PORT0) ++ val = RALINK_PCIE0_RST; ++#endif ++#if defined (CONFIG_PCIE_PORT1) ++ val |= RALINK_PCIE1_RST; ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ val |= RALINK_PCIE2_RST; ++#endif ++ ASSERT_SYSRST_PCIE(RALINK_PCIE0_RST | RALINK_PCIE1_RST | RALINK_PCIE2_RST); ++ printk("pull PCIe RST: RALINK_RSTCTRL = %x\n", RALINK_RSTCTRL); ++#if defined GPIO_PERST /* add GPIO control instead of PERST_N */ /*chhung*/ ++ *(unsigned int *)(0xbe000060) &= ~(0x3<<10 | 0x3<<3); ++ *(unsigned int *)(0xbe000060) |= 0x1<<10 | 0x1<<3; ++ mdelay(100); ++ *(unsigned int *)(0xbe000600) |= 0x1<<19 | 0x1<<8 | 0x1<<7; // use GPIO19/GPIO8/GPIO7 (PERST_N/UART_RXD3/UART_TXD3) ++ mdelay(100); ++ *(unsigned int *)(0xbe000620) &= ~(0x1<<19 | 0x1<<8 | 0x1<<7); // clear DATA ++ ++ mdelay(100); ++#else ++ *(unsigned int *)(0xbe000060) &= ~0x00000c00; ++#endif ++#if defined (CONFIG_PCIE_PORT0) ++ val = RALINK_PCIE0_RST; ++#endif ++#if defined (CONFIG_PCIE_PORT1) ++ val |= RALINK_PCIE1_RST; ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ val |= RALINK_PCIE2_RST; ++#endif ++ DEASSERT_SYSRST_PCIE(val); ++ printk("release PCIe RST: RALINK_RSTCTRL = %x\n", RALINK_RSTCTRL); ++ ++ if ((*(unsigned int *)(0xbe00000c)&0xFFFF) == 0x0101) // MT7621 E2 ++ bypass_pipe_rst(); ++ set_phy_for_ssc(); ++ printk("release PCIe RST: RALINK_RSTCTRL = %x\n", RALINK_RSTCTRL); ++ ++#if defined (CONFIG_PCIE_PORT0) ++ read_config(0, 0, 0, 0x70c, &val); ++ printk("Port 0 N_FTS = %x\n", (unsigned int)val); ++#endif ++#if defined (CONFIG_PCIE_PORT1) ++ read_config(0, 1, 0, 0x70c, &val); ++ printk("Port 1 N_FTS = %x\n", (unsigned int)val); ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ read_config(0, 2, 0, 0x70c, &val); ++ printk("Port 2 N_FTS = %x\n", (unsigned int)val); ++#endif ++ ++ RALINK_RSTCTRL = (RALINK_RSTCTRL | RALINK_PCIE_RST); ++ RALINK_SYSCFG1 &= ~(0x30); ++ RALINK_SYSCFG1 |= (2<<4); ++ RALINK_PCIE_CLK_GEN &= 0x7fffffff; ++ RALINK_PCIE_CLK_GEN1 &= 0x80ffffff; ++ RALINK_PCIE_CLK_GEN1 |= 0xa << 24; ++ RALINK_PCIE_CLK_GEN |= 0x80000000; ++ mdelay(50); ++ RALINK_RSTCTRL = (RALINK_RSTCTRL & ~RALINK_PCIE_RST); ++ ++ ++#if defined GPIO_PERST /* add GPIO control instead of PERST_N */ /*chhung*/ ++ *(unsigned int *)(0xbe000620) |= 0x1<<19 | 0x1<<8 | 0x1<<7; // set DATA ++ mdelay(100); ++#else ++ RALINK_PCI_PCICFG_ADDR &= ~(1<<1); //de-assert PERST ++#endif ++ mdelay(500); ++ ++ ++ mdelay(500); ++#if defined (CONFIG_PCIE_PORT0) ++ if(( RALINK_PCI0_STATUS & 0x1) == 0) ++ { ++ printk("PCIE0 no card, disable it(RST&CLK)\n"); ++ ASSERT_SYSRST_PCIE(RALINK_PCIE0_RST); ++ RALINK_CLKCFG1 = (RALINK_CLKCFG1 & ~RALINK_PCIE0_CLK_EN); ++ pcie_link_status &= ~(1<<0); ++ } else { ++ pcie_link_status |= 1<<0; ++ RALINK_PCI_PCIMSK_ADDR |= (1<<20); // enable pcie1 interrupt ++ } ++#endif ++#if defined (CONFIG_PCIE_PORT1) ++ if(( RALINK_PCI1_STATUS & 0x1) == 0) ++ { ++ printk("PCIE1 no card, disable it(RST&CLK)\n"); ++ ASSERT_SYSRST_PCIE(RALINK_PCIE1_RST); ++ RALINK_CLKCFG1 = (RALINK_CLKCFG1 & ~RALINK_PCIE1_CLK_EN); ++ pcie_link_status &= ~(1<<1); ++ } else { ++ pcie_link_status |= 1<<1; ++ RALINK_PCI_PCIMSK_ADDR |= (1<<21); // enable pcie1 interrupt ++ } ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ if (( RALINK_PCI2_STATUS & 0x1) == 0) { ++ printk("PCIE2 no card, disable it(RST&CLK)\n"); ++ ASSERT_SYSRST_PCIE(RALINK_PCIE2_RST); ++ RALINK_CLKCFG1 = (RALINK_CLKCFG1 & ~RALINK_PCIE2_CLK_EN); ++ pcie_link_status &= ~(1<<2); ++ } else { ++ pcie_link_status |= 1<<2; ++ RALINK_PCI_PCIMSK_ADDR |= (1<<22); // enable pcie2 interrupt ++ } ++#endif ++ if (pcie_link_status == 0) ++ return 0; ++ ++/* ++pcie(2/1/0) link status pcie2_num pcie1_num pcie0_num ++3'b000 x x x ++3'b001 x x 0 ++3'b010 x 0 x ++3'b011 x 1 0 ++3'b100 0 x x ++3'b101 1 x 0 ++3'b110 1 0 x ++3'b111 2 1 0 ++*/ ++ switch(pcie_link_status) { ++ case 2: ++ RALINK_PCI_PCICFG_ADDR &= ~0x00ff0000; ++ RALINK_PCI_PCICFG_ADDR |= 0x1 << 16; //port0 ++ RALINK_PCI_PCICFG_ADDR |= 0x0 << 20; //port1 ++ break; ++ case 4: ++ RALINK_PCI_PCICFG_ADDR &= ~0x0fff0000; ++ RALINK_PCI_PCICFG_ADDR |= 0x1 << 16; //port0 ++ RALINK_PCI_PCICFG_ADDR |= 0x2 << 20; //port1 ++ RALINK_PCI_PCICFG_ADDR |= 0x0 << 24; //port2 ++ break; ++ case 5: ++ RALINK_PCI_PCICFG_ADDR &= ~0x0fff0000; ++ RALINK_PCI_PCICFG_ADDR |= 0x0 << 16; //port0 ++ RALINK_PCI_PCICFG_ADDR |= 0x2 << 20; //port1 ++ RALINK_PCI_PCICFG_ADDR |= 0x1 << 24; //port2 ++ break; ++ case 6: ++ RALINK_PCI_PCICFG_ADDR &= ~0x0fff0000; ++ RALINK_PCI_PCICFG_ADDR |= 0x2 << 16; //port0 ++ RALINK_PCI_PCICFG_ADDR |= 0x0 << 20; //port1 ++ RALINK_PCI_PCICFG_ADDR |= 0x1 << 24; //port2 ++ break; ++ } ++ printk(" -> %x\n", RALINK_PCI_PCICFG_ADDR); ++ //printk(" RALINK_PCI_ARBCTL = %x\n", RALINK_PCI_ARBCTL); ++ ++/* ++ ioport_resource.start = mt7621_res_pci_io1.start; ++ ioport_resource.end = mt7621_res_pci_io1.end; ++*/ ++ ++ RALINK_PCI_MEMBASE = 0xffffffff; //RALINK_PCI_MM_MAP_BASE; ++ RALINK_PCI_IOBASE = RALINK_PCI_IO_MAP_BASE; ++ ++#if defined (CONFIG_PCIE_PORT0) ++ //PCIe0 ++ if((pcie_link_status & 0x1) != 0) { ++ RALINK_PCI0_BAR0SETUP_ADDR = 0x7FFF0001; //open 7FFF:2G; ENABLE ++ RALINK_PCI0_IMBASEBAR0_ADDR = MEMORY_BASE; ++ RALINK_PCI0_CLASS = 0x06040001; ++ printk("PCIE0 enabled\n"); ++ } ++#endif ++#if defined (CONFIG_PCIE_PORT1) ++ //PCIe1 ++ if ((pcie_link_status & 0x2) != 0) { ++ RALINK_PCI1_BAR0SETUP_ADDR = 0x7FFF0001; //open 7FFF:2G; ENABLE ++ RALINK_PCI1_IMBASEBAR0_ADDR = MEMORY_BASE; ++ RALINK_PCI1_CLASS = 0x06040001; ++ printk("PCIE1 enabled\n"); ++ } ++#endif ++#if defined (CONFIG_PCIE_PORT2) ++ //PCIe2 ++ if ((pcie_link_status & 0x4) != 0) { ++ RALINK_PCI2_BAR0SETUP_ADDR = 0x7FFF0001; //open 7FFF:2G; ENABLE ++ RALINK_PCI2_IMBASEBAR0_ADDR = MEMORY_BASE; ++ RALINK_PCI2_CLASS = 0x06040001; ++ printk("PCIE2 enabled\n"); ++ } ++#endif ++ ++ ++ switch(pcie_link_status) { ++ case 7: ++ read_config(0, 2, 0, 0x4, &val); ++ write_config(0, 2, 0, 0x4, val|0x4); ++ // write_config(0, 1, 0, 0x4, val|0x7); ++ read_config(0, 2, 0, 0x70c, &val); ++ val &= ~(0xff)<<8; ++ val |= 0x50<<8; ++ write_config(0, 2, 0, 0x70c, val); ++ case 3: ++ case 5: ++ case 6: ++ read_config(0, 1, 0, 0x4, &val); ++ write_config(0, 1, 0, 0x4, val|0x4); ++ // write_config(0, 1, 0, 0x4, val|0x7); ++ read_config(0, 1, 0, 0x70c, &val); ++ val &= ~(0xff)<<8; ++ val |= 0x50<<8; ++ write_config(0, 1, 0, 0x70c, val); ++ default: ++ read_config(0, 0, 0, 0x4, &val); ++ write_config(0, 0, 0, 0x4, val|0x4); //bus master enable ++ // write_config(0, 0, 0, 0x4, val|0x7); //bus master enable ++ read_config(0, 0, 0, 0x70c, &val); ++ val &= ~(0xff)<<8; ++ val |= 0x50<<8; ++ write_config(0, 0, 0, 0x70c, val); ++ } ++ ++ pci_load_of_ranges(&mt7621_controller, pdev->dev.of_node); ++ setup_cm_memory_region(mt7621_controller.mem_resource); ++ register_pci_controller(&mt7621_controller); ++ return 0; ++ ++} ++ ++int pcibios_plat_dev_init(struct pci_dev *dev) ++{ ++ return 0; ++} ++ ++static const struct of_device_id mt7621_pci_ids[] = { ++ { .compatible = "mediatek,mt7621-pci" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mt7621_pci_ids); ++ ++static struct platform_driver mt7621_pci_driver = { ++ .probe = mt7621_pci_probe, ++ .driver = { ++ .name = "mt7621-pci", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(mt7621_pci_ids), ++ }, ++}; ++ ++static int __init mt7621_pci_init(void) ++{ ++ return platform_driver_register(&mt7621_pci_driver); ++} ++ ++arch_initcall(mt7621_pci_init); diff --git a/target/linux/ramips/patches-4.4/0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch b/target/linux/ramips/patches-4.4/0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch new file mode 100644 index 0000000000..248357a8a9 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch @@ -0,0 +1,82 @@ +From ce3d4a4111a5f7e6b4e74bceae5faa6ce388e8ec Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 14 Jul 2013 23:08:11 +0200 +Subject: [PATCH 05/53] MIPS: use set_mode() to enable/disable the cevt-r4k + irq + +Signed-off-by: John Crispin +--- + arch/mips/ralink/Kconfig | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/mips/ralink/Kconfig ++++ b/arch/mips/ralink/Kconfig +@@ -1,11 +1,16 @@ + if RALINK + ++config CEVT_SYSTICK_QUIRK ++ bool ++ default n ++ + config CLKEVT_RT3352 + bool + depends on SOC_RT305X || SOC_MT7620 + default y + select CLKSRC_OF + select CLKSRC_MMIO ++ select CEVT_SYSTICK_QUIRK + + config RALINK_ILL_ACC + bool +--- a/arch/mips/kernel/cevt-r4k.c ++++ b/arch/mips/kernel/cevt-r4k.c +@@ -15,6 +15,26 @@ + #include + #include + ++static int mips_state_oneshot(struct clock_event_device *evt) ++{ ++ if (!cp0_timer_irq_installed) { ++ cp0_timer_irq_installed = 1; ++ setup_irq(evt->irq, &c0_compare_irqaction); ++ } ++ ++ return 0; ++} ++ ++static int mips_state_shutdown(struct clock_event_device *evt) ++{ ++ if (cp0_timer_irq_installed) { ++ cp0_timer_irq_installed = 0; ++ remove_irq(evt->irq, &c0_compare_irqaction); ++ } ++ ++ return 0; ++} ++ + static int mips_next_event(unsigned long delta, + struct clock_event_device *evt) + { +@@ -208,18 +228,21 @@ int r4k_clockevent_init(void) + cd->rating = 300; + cd->irq = irq; + cd->cpumask = cpumask_of(cpu); ++ cd->set_state_shutdown = mips_state_shutdown; ++ cd->set_state_oneshot = mips_state_oneshot; + cd->set_next_event = mips_next_event; + cd->event_handler = mips_event_handler; + + clockevents_register_device(cd); + ++#ifndef CONFIG_CEVT_SYSTICK_QUIRK + if (cp0_timer_irq_installed) + return 0; + + cp0_timer_irq_installed = 1; + + setup_irq(irq, &c0_compare_irqaction); +- ++#endif + return 0; + } + diff --git a/target/linux/ramips/patches-4.4/0006-MIPS-ralink-add-cpu-frequency-scaling.patch b/target/linux/ramips/patches-4.4/0006-MIPS-ralink-add-cpu-frequency-scaling.patch new file mode 100644 index 0000000000..f953aee9ff --- /dev/null +++ b/target/linux/ramips/patches-4.4/0006-MIPS-ralink-add-cpu-frequency-scaling.patch @@ -0,0 +1,93 @@ +From bd30f19a006fb52bac80c6463c49dd2f4159f4ac Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 28 Jul 2013 16:26:41 +0200 +Subject: [PATCH 06/53] MIPS: ralink: add cpu frequency scaling + +This feature will break udelay() and cause the delay loop to have longer delays +when the frequency is scaled causing a performance hit. + +Signed-off-by: John Crispin +--- + arch/mips/ralink/cevt-rt3352.c | 38 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +--- a/arch/mips/ralink/cevt-rt3352.c ++++ b/arch/mips/ralink/cevt-rt3352.c +@@ -29,6 +29,10 @@ + /* enable the counter */ + #define CFG_CNT_EN 0x1 + ++/* mt7620 frequency scaling defines */ ++#define CLK_LUT_CFG 0x40 ++#define SLEEP_EN BIT(31) ++ + struct systick_device { + void __iomem *membase; + struct clock_event_device dev; +@@ -36,9 +40,26 @@ struct systick_device { + int freq_scale; + }; + ++static void (*systick_freq_scaling)(struct systick_device *sdev, int status); ++ + static int systick_set_oneshot(struct clock_event_device *evt); + static int systick_shutdown(struct clock_event_device *evt); + ++static inline void mt7620_freq_scaling(struct systick_device *sdev, int status) ++{ ++ if (sdev->freq_scale == status) ++ return; ++ ++ sdev->freq_scale = status; ++ ++ pr_info("%s: %s autosleep mode\n", systick.dev.name, ++ (status) ? ("enable") : ("disable")); ++ if (status) ++ rt_sysc_w32(rt_sysc_r32(CLK_LUT_CFG) | SLEEP_EN, CLK_LUT_CFG); ++ else ++ rt_sysc_w32(rt_sysc_r32(CLK_LUT_CFG) & ~SLEEP_EN, CLK_LUT_CFG); ++} ++ + static int systick_next_event(unsigned long delta, + struct clock_event_device *evt) + { +@@ -99,6 +120,9 @@ static int systick_shutdown(struct clock + sdev->irq_requested = 0; + iowrite32(0, systick.membase + SYSTICK_CONFIG); + ++ if (systick_freq_scaling) ++ systick_freq_scaling(sdev, 0); ++ + return 0; + } + +@@ -114,15 +138,29 @@ static int systick_set_oneshot(struct cl + iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN, + systick.membase + SYSTICK_CONFIG); + ++ if (systick_freq_scaling) ++ systick_freq_scaling(sdev, 1); ++ + return 0; + } + ++static const struct of_device_id systick_match[] = { ++ { .compatible = "ralink,mt7620-systick", .data = mt7620_freq_scaling}, ++ {}, ++}; ++ + static void __init ralink_systick_init(struct device_node *np) + { ++ const struct of_device_id *match; ++ + systick.membase = of_iomap(np, 0); + if (!systick.membase) + return; + ++ match = of_match_node(systick_match, np); ++ if (match) ++ systick_freq_scaling = match->data; ++ + systick_irqaction.name = np->name; + systick.dev.name = np->name; + clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60); diff --git a/target/linux/ramips/patches-4.4/0007-MIPS-ralink-copy-the-commandline-from-the-devicetree.patch b/target/linux/ramips/patches-4.4/0007-MIPS-ralink-copy-the-commandline-from-the-devicetree.patch new file mode 100644 index 0000000000..4035a14373 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0007-MIPS-ralink-copy-the-commandline-from-the-devicetree.patch @@ -0,0 +1,21 @@ +From 67b7bff0fd364c194e653f69baa623ba2141bd4c Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Aug 2014 18:46:02 +0200 +Subject: [PATCH 07/53] MIPS: ralink: copy the commandline from the devicetree + +Signed-off-by: John Crispin +--- + arch/mips/ralink/of.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/mips/ralink/of.c ++++ b/arch/mips/ralink/of.c +@@ -74,6 +74,8 @@ void __init plat_mem_setup(void) + */ + __dt_setup_arch(__dtb_start); + ++ strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); ++ + of_scan_flat_dt(early_init_dt_find_memory, NULL); + if (memory_dtb) + of_scan_flat_dt(early_init_dt_scan_memory, NULL); diff --git a/target/linux/ramips/patches-4.4/0009-PCI-MIPS-adds-mt7620a-pcie-driver.patch b/target/linux/ramips/patches-4.4/0009-PCI-MIPS-adds-mt7620a-pcie-driver.patch new file mode 100644 index 0000000000..96bf9d0fb0 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0009-PCI-MIPS-adds-mt7620a-pcie-driver.patch @@ -0,0 +1,433 @@ +From 41aa7fc236fdb1f4c9b8b10df9b71f0d248cb36b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:11:12 +0100 +Subject: [PATCH 09/53] PCI: MIPS: adds mt7620a pcie driver + +Signed-off-by: John Crispin +--- + arch/mips/include/asm/mach-ralink/mt7620.h | 1 + + arch/mips/pci/Makefile | 1 + + arch/mips/pci/pci-mt7620.c | 396 ++++++++++++++++++++++++++++ + arch/mips/ralink/Kconfig | 1 + + 4 files changed, 399 insertions(+) + create mode 100644 arch/mips/pci/pci-mt7620.c + +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -43,6 +43,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1 + obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o + obj-$(CONFIG_LANTIQ) += fixup-lantiq.o + obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o ++obj-$(CONFIG_SOC_MT7620) += pci-mt7620.o + obj-$(CONFIG_SOC_MT7621) += pci-mt7621.o + obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o + obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o +--- /dev/null ++++ b/arch/mips/pci/pci-mt7620.c +@@ -0,0 +1,396 @@ ++/* ++ * Ralink MT7620A SoC PCI support ++ * ++ * Copyright (C) 2007-2013 Bruce Chang ++ * Copyright (C) 2013 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#define RALINK_PCI_MM_MAP_BASE 0x20000000 ++#define RALINK_PCI_IO_MAP_BASE 0x10160000 ++ ++#define RALINK_INT_PCIE0 4 ++#define RALINK_SYSCFG1 0x14 ++#define RALINK_CLKCFG1 0x30 ++#define RALINK_GPIOMODE 0x60 ++#define RALINK_PCIE_CLK_GEN 0x7c ++#define RALINK_PCIE_CLK_GEN1 0x80 ++#define PCIEPHY0_CFG 0x90 ++#define PPLL_CFG1 0x9c ++#define PPLL_DRV 0xa0 ++#define PDRV_SW_SET (1<<31) ++#define LC_CKDRVPD_ (1<<19) ++ ++#define RALINK_PCI_CONFIG_ADDR 0x20 ++#define RALINK_PCI_CONFIG_DATA_VIRT_REG 0x24 ++#define MEMORY_BASE 0x0 ++#define RALINK_PCIE0_RST (1<<26) ++#define RALINK_PCI_BASE 0xB0140000 ++#define RALINK_PCI_MEMBASE 0x28 ++#define RALINK_PCI_IOBASE 0x2C ++ ++#define RT6855_PCIE0_OFFSET 0x2000 ++ ++#define RALINK_PCI_PCICFG_ADDR 0x00 ++#define RALINK_PCI0_BAR0SETUP_ADDR 0x10 ++#define RALINK_PCI0_IMBASEBAR0_ADDR 0x18 ++#define RALINK_PCI0_ID 0x30 ++#define RALINK_PCI0_CLASS 0x34 ++#define RALINK_PCI0_SUBID 0x38 ++#define RALINK_PCI0_STATUS 0x50 ++#define RALINK_PCI_PCIMSK_ADDR 0x0C ++ ++#define RALINK_PCIEPHY_P0_CTL_OFFSET 0x7498 ++#define RALINK_PCIE0_CLK_EN (1 << 26) ++ ++#define BUSY 0x80000000 ++#define WAITRETRY_MAX 10 ++#define WRITE_MODE (1UL << 23) ++#define DATA_SHIFT 0 ++#define ADDR_SHIFT 8 ++ ++static void __iomem *bridge_base; ++static void __iomem *pcie_base; ++ ++static struct reset_control *rstpcie0; ++ ++static inline void bridge_w32(u32 val, unsigned reg) ++{ ++ iowrite32(val, bridge_base + reg); ++} ++ ++static inline u32 bridge_r32(unsigned reg) ++{ ++ return ioread32(bridge_base + reg); ++} ++ ++static inline void pcie_w32(u32 val, unsigned reg) ++{ ++ iowrite32(val, pcie_base + reg); ++} ++ ++static inline u32 pcie_r32(unsigned reg) ++{ ++ return ioread32(pcie_base + reg); ++} ++ ++static inline void pcie_m32(u32 clr, u32 set, unsigned reg) ++{ ++ u32 val = pcie_r32(reg); ++ ++ val &= ~clr; ++ val |= set; ++ pcie_w32(val, reg); ++} ++ ++static int wait_pciephy_busy(void) ++{ ++ unsigned long reg_value = 0x0, retry = 0; ++ ++ while (1) { ++ reg_value = pcie_r32(PCIEPHY0_CFG); ++ ++ if (reg_value & BUSY) ++ mdelay(100); ++ else ++ break; ++ if (retry++ > WAITRETRY_MAX){ ++ printk("PCIE-PHY retry failed.\n"); ++ return -1; ++ } ++ } ++ return 0; ++} ++ ++static void pcie_phy(unsigned long addr, unsigned long val) ++{ ++ wait_pciephy_busy(); ++ pcie_w32(WRITE_MODE | (val << DATA_SHIFT) | (addr << ADDR_SHIFT), PCIEPHY0_CFG); ++ mdelay(1); ++ wait_pciephy_busy(); ++} ++ ++static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * val) ++{ ++ unsigned int slot = PCI_SLOT(devfn); ++ u8 func = PCI_FUNC(devfn); ++ u32 address; ++ u32 data; ++ u32 num = 0; ++ ++ if (bus) ++ num = bus->number; ++ ++ address = (((where & 0xF00) >> 8) << 24) | (num << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | 0x80000000; ++ bridge_w32(address, RALINK_PCI_CONFIG_ADDR); ++ data = bridge_r32(RALINK_PCI_CONFIG_DATA_VIRT_REG); ++ ++ switch (size) { ++ case 1: ++ *val = (data >> ((where & 3) << 3)) & 0xff; ++ break; ++ case 2: ++ *val = (data >> ((where & 3) << 3)) & 0xffff; ++ break; ++ case 4: ++ *val = data; ++ break; ++ } ++ ++ return PCIBIOS_SUCCESSFUL; ++} ++ ++static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) ++{ ++ unsigned int slot = PCI_SLOT(devfn); ++ u8 func = PCI_FUNC(devfn); ++ u32 address; ++ u32 data; ++ u32 num = 0; ++ ++ if (bus) ++ num = bus->number; ++ ++ address = (((where & 0xF00) >> 8) << 24) | (num << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | 0x80000000; ++ bridge_w32(address, RALINK_PCI_CONFIG_ADDR); ++ data = bridge_r32(RALINK_PCI_CONFIG_DATA_VIRT_REG); ++ ++ switch (size) { ++ case 1: ++ data = (data & ~(0xff << ((where & 3) << 3))) | ++ (val << ((where & 3) << 3)); ++ break; ++ case 2: ++ data = (data & ~(0xffff << ((where & 3) << 3))) | ++ (val << ((where & 3) << 3)); ++ break; ++ case 4: ++ data = val; ++ break; ++ } ++ ++ bridge_w32(data, RALINK_PCI_CONFIG_DATA_VIRT_REG); ++ ++ return PCIBIOS_SUCCESSFUL; ++} ++ ++struct pci_ops mt7620_pci_ops= { ++ .read = pci_config_read, ++ .write = pci_config_write, ++}; ++ ++static struct resource mt7620_res_pci_mem1; ++static struct resource mt7620_res_pci_io1; ++struct pci_controller mt7620_controller = { ++ .pci_ops = &mt7620_pci_ops, ++ .mem_resource = &mt7620_res_pci_mem1, ++ .mem_offset = 0x00000000UL, ++ .io_resource = &mt7620_res_pci_io1, ++ .io_offset = 0x00000000UL, ++ .io_map_base = 0xa0000000, ++}; ++ ++static int mt7620_pci_hw_init(struct platform_device *pdev) { ++ /* PCIE: bypass PCIe DLL */ ++ pcie_phy(0x0, 0x80); ++ pcie_phy(0x1, 0x04); ++ ++ /* PCIE: Elastic buffer control */ ++ pcie_phy(0x68, 0xB4); ++ ++ pcie_m32(0, BIT(1), RALINK_PCI_PCICFG_ADDR); ++ ++ reset_control_assert(rstpcie0); ++ ++ rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1); ++ rt_sysc_m32(BIT(19), BIT(31), PPLL_DRV); ++ ++ reset_control_deassert(rstpcie0); ++ rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1); ++ ++ mdelay(100); ++ ++ if (!(rt_sysc_r32(PPLL_CFG1) & BIT(23))) { ++ dev_err(&pdev->dev, "MT7620 PPLL unlock\n"); ++ reset_control_assert(rstpcie0); ++ rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1); ++ return -1; ++ } ++ rt_sysc_m32(BIT(18) | BIT(17), BIT(19) | BIT(31), PPLL_DRV); ++ ++ return 0; ++} ++ ++static int mt7628_pci_hw_init(struct platform_device *pdev) { ++ u32 val = 0; ++ ++ rt_sysc_m32(BIT(16), 0, RALINK_GPIOMODE); ++ reset_control_deassert(rstpcie0); ++ rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1); ++ mdelay(100); ++ ++ pcie_m32(~0xff, 0x5, RALINK_PCIEPHY_P0_CTL_OFFSET); ++ ++ pci_config_read(NULL, 0, 0x70c, 4, &val); ++ val &= ~(0xff) << 8; ++ val |= 0x50 << 8; ++ pci_config_write(NULL, 0, 0x70c, 4, val); ++ ++ pci_config_read(NULL, 0, 0x70c, 4, &val); ++ dev_err(&pdev->dev, "Port 0 N_FTS = %x\n", (unsigned int) val); ++ ++ return 0; ++} ++ ++static int mt7620_pci_probe(struct platform_device *pdev) ++{ ++ struct resource *bridge_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ struct resource *pcie_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ u32 val = 0; ++ ++ rstpcie0 = devm_reset_control_get(&pdev->dev, "pcie0"); ++ if (IS_ERR(rstpcie0)) ++ return PTR_ERR(rstpcie0); ++ ++ bridge_base = devm_ioremap_resource(&pdev->dev, bridge_res); ++ if (!bridge_base) ++ return -ENOMEM; ++ ++ pcie_base = devm_ioremap_resource(&pdev->dev, pcie_res); ++ if (!pcie_base) ++ return -ENOMEM; ++ ++ iomem_resource.start = 0; ++ iomem_resource.end = ~0; ++ ioport_resource.start = 0; ++ ioport_resource.end = ~0; ++ ++ /* bring up the pci core */ ++ switch (ralink_soc) { ++ case MT762X_SOC_MT7620A: ++ if (mt7620_pci_hw_init(pdev)) ++ return -1; ++ break; ++ ++ case MT762X_SOC_MT7628AN: ++ if (mt7628_pci_hw_init(pdev)) ++ return -1; ++ break; ++ ++ default: ++ dev_err(&pdev->dev, "pcie is not supported on this hardware\n"); ++ return -1; ++ } ++ mdelay(50); ++ ++ /* enable write access */ ++ pcie_m32(BIT(1), 0, RALINK_PCI_PCICFG_ADDR); ++ mdelay(100); ++ ++ /* check if there is a card present */ ++ if ((pcie_r32(RALINK_PCI0_STATUS) & 0x1) == 0) { ++ reset_control_assert(rstpcie0); ++ rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1); ++ if (ralink_soc == MT762X_SOC_MT7620A) ++ rt_sysc_m32(LC_CKDRVPD_, PDRV_SW_SET, PPLL_DRV); ++ dev_err(&pdev->dev, "PCIE0 no card, disable it(RST&CLK)\n"); ++ return -1; ++ } ++ ++ /* setup ranges */ ++ bridge_w32(0xffffffff, RALINK_PCI_MEMBASE); ++ bridge_w32(RALINK_PCI_IO_MAP_BASE, RALINK_PCI_IOBASE); ++ ++ pcie_w32(0x7FFF0001, RALINK_PCI0_BAR0SETUP_ADDR); ++ pcie_w32(MEMORY_BASE, RALINK_PCI0_IMBASEBAR0_ADDR); ++ pcie_w32(0x06040001, RALINK_PCI0_CLASS); ++ ++ /* enable interrupts */ ++ pcie_m32(0, BIT(20), RALINK_PCI_PCIMSK_ADDR); ++ ++ /* voodoo from the SDK driver */ ++ pci_config_read(NULL, 0, 4, 4, &val); ++ pci_config_write(NULL, 0, 4, 4, val | 0x7); ++ ++ pci_load_of_ranges(&mt7620_controller, pdev->dev.of_node); ++ register_pci_controller(&mt7620_controller); ++ ++ return 0; ++} ++ ++int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ u16 cmd; ++ u32 val; ++ int irq = 0; ++ ++ if ((dev->bus->number == 0) && (slot == 0)) { ++ pcie_w32(0x7FFF0001, RALINK_PCI0_BAR0SETUP_ADDR); //open 7FFF:2G; ENABLE ++ pci_config_write(dev->bus, 0, PCI_BASE_ADDRESS_0, 4, MEMORY_BASE); ++ pci_config_read(dev->bus, 0, PCI_BASE_ADDRESS_0, 4, &val); ++ } else if ((dev->bus->number == 1) && (slot == 0x0)) { ++ irq = RALINK_INT_PCIE0; ++ } else { ++ dev_err(&dev->dev, "no irq found - bus=0x%x, slot = 0x%x\n", dev->bus->number, slot); ++ return 0; ++ } ++ dev_err(&dev->dev, "card - bus=0x%x, slot = 0x%x irq=%d\n", dev->bus->number, slot, irq); ++ ++ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x14); //configure cache line size 0x14 ++ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xFF); //configure latency timer 0x10 ++ pci_read_config_word(dev, PCI_COMMAND, &cmd); ++ ++ // FIXME ++ cmd = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY; ++ pci_write_config_word(dev, PCI_COMMAND, cmd); ++ pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); ++ //pci_write_config_byte(dev, PCI_INTERRUPT_PIN, dev->irq); ++ ++ return irq; ++} ++ ++int pcibios_plat_dev_init(struct pci_dev *dev) ++{ ++ return 0; ++} ++ ++static const struct of_device_id mt7620_pci_ids[] = { ++ { .compatible = "mediatek,mt7620-pci" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mt7620_pci_ids); ++ ++static struct platform_driver mt7620_pci_driver = { ++ .probe = mt7620_pci_probe, ++ .driver = { ++ .name = "mt7620-pci", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(mt7620_pci_ids), ++ }, ++}; ++ ++static int __init mt7620_pci_init(void) ++{ ++ return platform_driver_register(&mt7620_pci_driver); ++} ++ ++arch_initcall(mt7620_pci_init); +--- a/arch/mips/ralink/Kconfig ++++ b/arch/mips/ralink/Kconfig +@@ -43,6 +43,7 @@ choice + + config SOC_MT7620 + bool "MT7620/8" ++ select HW_HAS_PCI + + config SOC_MT7621 + bool "MT7621" diff --git a/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch b/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch new file mode 100644 index 0000000000..56bca7838b --- /dev/null +++ b/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch @@ -0,0 +1,48 @@ +From 3b2e7c7c83873f4c073d501c2fff80518e264240 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Jan 2016 20:24:00 +0100 +Subject: [PATCH] MIPS: ralink: Add a few missing clocks + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/11995/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 3 +++ + arch/mips/ralink/rt305x.c | 1 + + arch/mips/ralink/rt3883.c | 1 + + 3 files changed, 5 insertions(+) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -436,7 +436,10 @@ void __init ralink_clk_init(void) + ralink_clk_add("10000100.timer", periph_rate); + ralink_clk_add("10000120.watchdog", periph_rate); + ralink_clk_add("10000b00.spi", sys_rate); ++ ralink_clk_add("10000b40.spi", sys_rate); + ralink_clk_add("10000c00.uartlite", periph_rate); ++ ralink_clk_add("10000d00.uart1", periph_rate); ++ ralink_clk_add("10000e00.uart2", periph_rate); + ralink_clk_add("10180000.wmac", xtal_rate); + + if (IS_ENABLED(CONFIG_USB) && is_mt76x8()) { +--- a/arch/mips/ralink/rt305x.c ++++ b/arch/mips/ralink/rt305x.c +@@ -201,6 +201,7 @@ void __init ralink_clk_init(void) + ralink_clk_add("cpu", cpu_rate); + ralink_clk_add("sys", sys_rate); + ralink_clk_add("10000b00.spi", sys_rate); ++ ralink_clk_add("10000b40.spi", sys_rate); + ralink_clk_add("10000100.timer", wdt_rate); + ralink_clk_add("10000120.watchdog", wdt_rate); + ralink_clk_add("10000500.uart", uart_rate); +--- a/arch/mips/ralink/rt3883.c ++++ b/arch/mips/ralink/rt3883.c +@@ -109,6 +109,7 @@ void __init ralink_clk_init(void) + ralink_clk_add("10000120.watchdog", sys_rate); + ralink_clk_add("10000500.uart", 40000000); + ralink_clk_add("10000b00.spi", sys_rate); ++ ralink_clk_add("10000b40.spi", sys_rate); + ralink_clk_add("10000c00.uartlite", 40000000); + ralink_clk_add("10100000.ethernet", sys_rate); + ralink_clk_add("10180000.wmac", 40000000); diff --git a/target/linux/ramips/patches-4.4/0013-owrt-hack-fix-mt7688-cache-issue.patch b/target/linux/ramips/patches-4.4/0013-owrt-hack-fix-mt7688-cache-issue.patch new file mode 100644 index 0000000000..c9bba2a9dd --- /dev/null +++ b/target/linux/ramips/patches-4.4/0013-owrt-hack-fix-mt7688-cache-issue.patch @@ -0,0 +1,28 @@ +From 5ede027f6c4a57ed25da872420508b7f1168b36b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:15:32 +0100 +Subject: [PATCH 13/53] owrt: hack: fix mt7688 cache issue + +Signed-off-by: John Crispin +--- + arch/mips/kernel/setup.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/kernel/setup.c ++++ b/arch/mips/kernel/setup.c +@@ -696,7 +696,6 @@ static void __init arch_mem_init(char ** + crashk_res.end - crashk_res.start + 1, + BOOTMEM_DEFAULT); + #endif +- device_tree_init(); + sparse_init(); + plat_swiotlb_setup(); + paging_init(); +@@ -809,6 +808,7 @@ void __init setup_arch(char **cmdline_p) + prefill_possible_map(); + + cpu_cache_init(); ++ device_tree_init(); + } + + unsigned long kernelsp[NR_CPUS]; diff --git a/target/linux/ramips/patches-4.4/0014-arch-mips-cleanup-cevt-rt3352.patch b/target/linux/ramips/patches-4.4/0014-arch-mips-cleanup-cevt-rt3352.patch new file mode 100644 index 0000000000..50b3dc8318 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0014-arch-mips-cleanup-cevt-rt3352.patch @@ -0,0 +1,165 @@ +From e6ed424c36458aff8738fb1fbb0141196678058a Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:17:23 +0100 +Subject: [PATCH 14/53] arch: mips: cleanup cevt-rt3352 + +Signed-off-by: John Crispin +--- + arch/mips/ralink/cevt-rt3352.c | 85 ++++++++++++++++++++++++++-------------- + 1 file changed, 56 insertions(+), 29 deletions(-) + +--- a/arch/mips/ralink/cevt-rt3352.c ++++ b/arch/mips/ralink/cevt-rt3352.c +@@ -52,7 +52,7 @@ static inline void mt7620_freq_scaling(s + + sdev->freq_scale = status; + +- pr_info("%s: %s autosleep mode\n", systick.dev.name, ++ pr_info("%s: %s autosleep mode\n", sdev->dev.name, + (status) ? ("enable") : ("disable")); + if (status) + rt_sysc_w32(rt_sysc_r32(CLK_LUT_CFG) | SLEEP_EN, CLK_LUT_CFG); +@@ -60,18 +60,33 @@ static inline void mt7620_freq_scaling(s + rt_sysc_w32(rt_sysc_r32(CLK_LUT_CFG) & ~SLEEP_EN, CLK_LUT_CFG); + } + ++static inline unsigned int read_count(struct systick_device *sdev) ++{ ++ return ioread32(sdev->membase + SYSTICK_COUNT); ++} ++ ++static inline unsigned int read_compare(struct systick_device *sdev) ++{ ++ return ioread32(sdev->membase + SYSTICK_COMPARE); ++} ++ ++static inline void write_compare(struct systick_device *sdev, unsigned int val) ++{ ++ iowrite32(val, sdev->membase + SYSTICK_COMPARE); ++} ++ + static int systick_next_event(unsigned long delta, + struct clock_event_device *evt) + { + struct systick_device *sdev; +- u32 count; ++ int res; + + sdev = container_of(evt, struct systick_device, dev); +- count = ioread32(sdev->membase + SYSTICK_COUNT); +- count = (count + delta) % SYSTICK_FREQ; +- iowrite32(count, sdev->membase + SYSTICK_COMPARE); ++ delta += read_count(sdev); ++ write_compare(sdev, delta); ++ res = ((int)(read_count(sdev) - delta) >= 0) ? -ETIME : 0; + +- return 0; ++ return res; + } + + static void systick_event_handler(struct clock_event_device *dev) +@@ -81,20 +96,25 @@ static void systick_event_handler(struct + + static irqreturn_t systick_interrupt(int irq, void *dev_id) + { +- struct clock_event_device *dev = (struct clock_event_device *) dev_id; ++ int ret = 0; ++ struct clock_event_device *cdev; ++ struct systick_device *sdev; + +- dev->event_handler(dev); ++ if (read_c0_cause() & STATUSF_IP7) { ++ cdev = (struct clock_event_device *) dev_id; ++ sdev = container_of(cdev, struct systick_device, dev); ++ ++ /* Clear Count/Compare Interrupt */ ++ write_compare(sdev, read_compare(sdev)); ++ cdev->event_handler(cdev); ++ ret = 1; ++ } + +- return IRQ_HANDLED; ++ return IRQ_RETVAL(ret); + } + + static struct systick_device systick = { + .dev = { +- /* +- * cevt-r4k uses 300, make sure systick +- * gets used if available +- */ +- .rating = 310, + .features = CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = systick_next_event, + .set_state_shutdown = systick_shutdown, +@@ -116,9 +136,9 @@ static int systick_shutdown(struct clock + sdev = container_of(evt, struct systick_device, dev); + + if (sdev->irq_requested) +- free_irq(systick.dev.irq, &systick_irqaction); ++ remove_irq(systick.dev.irq, &systick_irqaction); + sdev->irq_requested = 0; +- iowrite32(0, systick.membase + SYSTICK_CONFIG); ++ iowrite32(CFG_CNT_EN, systick.membase + SYSTICK_CONFIG); + + if (systick_freq_scaling) + systick_freq_scaling(sdev, 0); +@@ -145,38 +165,45 @@ static int systick_set_oneshot(struct cl + } + + static const struct of_device_id systick_match[] = { +- { .compatible = "ralink,mt7620-systick", .data = mt7620_freq_scaling}, ++ { .compatible = "ralink,mt7620a-systick", .data = mt7620_freq_scaling}, + {}, + }; + + static void __init ralink_systick_init(struct device_node *np) + { + const struct of_device_id *match; ++ int rating = 200; + + systick.membase = of_iomap(np, 0); + if (!systick.membase) + return; + + match = of_match_node(systick_match, np); +- if (match) ++ if (match) { + systick_freq_scaling = match->data; ++ /* ++ * cevt-r4k uses 300, make sure systick ++ * gets used if available ++ */ ++ rating = 310; ++ } + +- systick_irqaction.name = np->name; +- systick.dev.name = np->name; +- clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60); +- systick.dev.max_delta_ns = clockevent_delta2ns(0x7fff, &systick.dev); +- systick.dev.min_delta_ns = clockevent_delta2ns(0x3, &systick.dev); ++ /* enable counter than register clock source */ ++ iowrite32(CFG_CNT_EN, systick.membase + SYSTICK_CONFIG); ++ clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, ++ SYSTICK_FREQ, rating, 16, clocksource_mmio_readl_up); ++ ++ /* register clock event */ + systick.dev.irq = irq_of_parse_and_map(np, 0); + if (!systick.dev.irq) { + pr_err("%s: request_irq failed", np->name); + return; + } +- +- clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, +- SYSTICK_FREQ, 301, 16, clocksource_mmio_readl_up); +- +- clockevents_register_device(&systick.dev); +- ++ systick_irqaction.name = np->name; ++ systick.dev.name = np->name; ++ systick.dev.rating = rating; ++ systick.dev.cpumask = cpumask_of(0); ++ clockevents_config_and_register(&systick.dev, SYSTICK_FREQ, 0x3, 0x7fff); + pr_info("%s: running - mult: %d, shift: %d\n", + np->name, systick.dev.mult, systick.dev.shift); + } diff --git a/target/linux/ramips/patches-4.4/0015-arch-mips-do-not-select-illegal-access-driver-by-def.patch b/target/linux/ramips/patches-4.4/0015-arch-mips-do-not-select-illegal-access-driver-by-def.patch new file mode 100644 index 0000000000..6f5a6f4b94 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0015-arch-mips-do-not-select-illegal-access-driver-by-def.patch @@ -0,0 +1,25 @@ +From 9e6ce539092a1dd605a20bf73c655a9de58d8641 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:18:05 +0100 +Subject: [PATCH 15/53] arch: mips: do not select illegal access driver by + default + +Signed-off-by: John Crispin +--- + arch/mips/ralink/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/ralink/Kconfig ++++ b/arch/mips/ralink/Kconfig +@@ -13,9 +13,9 @@ config CLKEVT_RT3352 + select CEVT_SYSTICK_QUIRK + + config RALINK_ILL_ACC +- bool ++ bool "illegal access irq" + depends on SOC_RT305X +- default y ++ default n + + config IRQ_INTC + bool diff --git a/target/linux/ramips/patches-4.4/0019-arch-mips-ralink-add-mt7621-cpu-feature-overrides.patch b/target/linux/ramips/patches-4.4/0019-arch-mips-ralink-add-mt7621-cpu-feature-overrides.patch new file mode 100644 index 0000000000..a30e2f9a17 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0019-arch-mips-ralink-add-mt7621-cpu-feature-overrides.patch @@ -0,0 +1,79 @@ +From 43372c2be9fcf68bc40c322039c75893ce4e982c Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:20:47 +0100 +Subject: [PATCH 19/53] arch: mips: ralink: add mt7621 cpu-feature-overrides + +Signed-off-by: John Crispin +--- + .../asm/mach-ralink/mt7621/cpu-feature-overrides.h | 65 ++++++++++++++++++++ + 1 file changed, 65 insertions(+) + create mode 100644 arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h + +--- /dev/null ++++ b/arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h +@@ -0,0 +1,65 @@ ++/* ++ * Ralink MT7621 specific CPU feature overrides ++ * ++ * Copyright (C) 2008-2009 Gabor Juhos ++ * Copyright (C) 2008 Imre Kaloz ++ * Copyright (C) 2015 Felix Fietkau ++ * ++ * 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 _MT7621_CPU_FEATURE_OVERRIDES_H ++#define _MT7621_CPU_FEATURE_OVERRIDES_H ++ ++#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_prefetch 1 ++#define cpu_has_ejtag 1 ++#define cpu_has_llsc 1 ++ ++#define cpu_has_mips16 1 ++#define cpu_has_mdmx 0 ++#define cpu_has_mips3d 0 ++#define cpu_has_smartmips 0 ++ ++#define cpu_has_mips32r1 1 ++#define cpu_has_mips32r2 1 ++#define cpu_has_mips64r1 0 ++#define cpu_has_mips64r2 0 ++ ++#define cpu_has_dsp 1 ++#define cpu_has_dsp2 0 ++#define cpu_has_mipsmt 1 ++ ++#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_dcache_line_size() 32 ++#define cpu_icache_line_size() 32 ++ ++#define cpu_has_dc_aliases 0 ++#define cpu_has_vtag_icache 0 ++ ++#define cpu_has_rixi 0 ++#define cpu_has_tlbinv 0 ++#define cpu_has_userlocal 1 ++ ++#endif /* _MT7621_CPU_FEATURE_OVERRIDES_H */ diff --git a/target/linux/ramips/patches-4.4/0022-MIPS-ralink-Fix-vendor-string-for-mt7620.patch b/target/linux/ramips/patches-4.4/0022-MIPS-ralink-Fix-vendor-string-for-mt7620.patch new file mode 100644 index 0000000000..05017b1bff --- /dev/null +++ b/target/linux/ramips/patches-4.4/0022-MIPS-ralink-Fix-vendor-string-for-mt7620.patch @@ -0,0 +1,27 @@ +From 3bca798b859c75063b3b4e65f6b019c7a4bd53ef Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Jan 2016 20:23:59 +0100 +Subject: [PATCH] MIPS: ralink: Fix vendor string for mt7620 + +Ralink was acquired by Mediatek. Represent this in the cpuinfo. It +apparently confused people. + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/11994/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -555,7 +555,7 @@ void prom_soc_init(struct ralink_soc_inf + } + + snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, +- "Ralink %s ver:%u eco:%u", ++ "MediaTek %s ver:%u eco:%u", + name, + (rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK, + (rev & CHIP_REV_ECO_MASK)); diff --git a/target/linux/ramips/patches-4.4/0024-GPIO-add-named-gpio-exports.patch b/target/linux/ramips/patches-4.4/0024-GPIO-add-named-gpio-exports.patch new file mode 100644 index 0000000000..cfdab760a5 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0024-GPIO-add-named-gpio-exports.patch @@ -0,0 +1,166 @@ +From 4267880319bc1a2270d352e0ded6d6386242a7ef Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 12 Aug 2014 20:49:27 +0200 +Subject: [PATCH 24/53] 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" + +@@ -450,3 +452,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 +@@ -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 gpiod_data *data; +@@ -604,6 +604,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, chip->dev, + MKDEV(0, 0), data, gpio_groups, +@@ -625,6 +627,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 +@@ -122,6 +122,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) + { diff --git a/target/linux/ramips/patches-4.4/0025-pinctrl-ralink-add-pinctrl-driver.patch b/target/linux/ramips/patches-4.4/0025-pinctrl-ralink-add-pinctrl-driver.patch new file mode 100644 index 0000000000..315d9563bc --- /dev/null +++ b/target/linux/ramips/patches-4.4/0025-pinctrl-ralink-add-pinctrl-driver.patch @@ -0,0 +1,524 @@ +From 7adbe9a88c33c6e362a10b109d963b5500a21f00 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:34:05 +0100 +Subject: [PATCH 25/53] pinctrl: ralink: add pinctrl driver + +Signed-off-by: John Crispin +--- + arch/mips/Kconfig | 2 + + drivers/pinctrl/Kconfig | 5 + + drivers/pinctrl/Makefile | 1 + + drivers/pinctrl/pinctrl-rt2880.c | 474 ++++++++++++++++++++++++++++++++++++++ + 4 files changed, 482 insertions(+) + create mode 100644 drivers/pinctrl/pinctrl-rt2880.c + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -585,6 +585,8 @@ config RALINK + select CLKDEV_LOOKUP + select ARCH_HAS_RESET_CONTROLLER + select RESET_CONTROLLER ++ select PINCTRL ++ select PINCTRL_RT2880 + + config SGI_IP22 + bool "SGI IP22 (Indy/Indigo2)" +--- a/drivers/pinctrl/Kconfig ++++ b/drivers/pinctrl/Kconfig +@@ -114,6 +114,11 @@ config PINCTRL_LPC18XX + help + Pinctrl driver for NXP LPC18xx/43xx System Control Unit (SCU). + ++config PINCTRL_RT2880 ++ bool ++ depends on RALINK ++ select PINMUX ++ + config PINCTRL_FALCON + bool + depends on SOC_FALCON +--- a/drivers/pinctrl/Makefile ++++ b/drivers/pinctrl/Makefile +@@ -20,6 +20,7 @@ obj-$(CONFIG_PINCTRL_MESON) += meson/ + obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o + obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o + obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o ++obj-$(CONFIG_PINCTRL_RT2880) += pinctrl-rt2880.o + obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o + obj-$(CONFIG_PINCTRL_SIRF) += sirf/ + obj-$(CONFIG_PINCTRL_TEGRA) += pinctrl-tegra.o +--- /dev/null ++++ b/drivers/pinctrl/pinctrl-rt2880.c +@@ -0,0 +1,472 @@ ++/* ++ * linux/drivers/pinctrl/pinctrl-rt2880.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 ++ * publishhed by the Free Software Foundation. ++ * ++ * Copyright (C) 2013 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include "core.h" ++ ++#define SYSC_REG_GPIO_MODE 0x60 ++#define SYSC_REG_GPIO_MODE2 0x64 ++ ++struct rt2880_priv { ++ struct device *dev; ++ ++ struct pinctrl_pin_desc *pads; ++ struct pinctrl_desc *desc; ++ ++ struct rt2880_pmx_func **func; ++ int func_count; ++ ++ struct rt2880_pmx_group *groups; ++ const char **group_names; ++ int group_count; ++ ++ uint8_t *gpio; ++ int max_pins; ++}; ++ ++static int rt2880_get_group_count(struct pinctrl_dev *pctrldev) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ return p->group_count; ++} ++ ++static const char *rt2880_get_group_name(struct pinctrl_dev *pctrldev, ++ unsigned group) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ if (group >= p->group_count) ++ return NULL; ++ ++ return p->group_names[group]; ++} ++ ++static int rt2880_get_group_pins(struct pinctrl_dev *pctrldev, ++ unsigned group, ++ const unsigned **pins, ++ unsigned *num_pins) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ if (group >= p->group_count) ++ return -EINVAL; ++ ++ *pins = p->groups[group].func[0].pins; ++ *num_pins = p->groups[group].func[0].pin_count; ++ ++ return 0; ++} ++ ++static void rt2880_pinctrl_dt_free_map(struct pinctrl_dev *pctrldev, ++ struct pinctrl_map *map, unsigned num_maps) ++{ ++ int i; ++ ++ for (i = 0; i < num_maps; i++) ++ if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN || ++ map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP) ++ kfree(map[i].data.configs.configs); ++ kfree(map); ++} ++ ++static void rt2880_pinctrl_pin_dbg_show(struct pinctrl_dev *pctrldev, ++ struct seq_file *s, ++ unsigned offset) ++{ ++ seq_printf(s, "ralink pio"); ++} ++ ++static void rt2880_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctrldev, ++ struct device_node *np, ++ struct pinctrl_map **map) ++{ ++ const char *function; ++ int func = of_property_read_string(np, "ralink,function", &function); ++ int grps = of_property_count_strings(np, "ralink,group"); ++ int i; ++ ++ if (func || !grps) ++ return; ++ ++ for (i = 0; i < grps; i++) { ++ const char *group; ++ ++ of_property_read_string_index(np, "ralink,group", i, &group); ++ ++ (*map)->type = PIN_MAP_TYPE_MUX_GROUP; ++ (*map)->name = function; ++ (*map)->data.mux.group = group; ++ (*map)->data.mux.function = function; ++ (*map)++; ++ } ++} ++ ++static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev, ++ struct device_node *np_config, ++ struct pinctrl_map **map, ++ unsigned *num_maps) ++{ ++ int max_maps = 0; ++ struct pinctrl_map *tmp; ++ struct device_node *np; ++ ++ for_each_child_of_node(np_config, np) { ++ int ret = of_property_count_strings(np, "ralink,group"); ++ ++ if (ret >= 0) ++ max_maps += ret; ++ } ++ ++ if (!max_maps) ++ return max_maps; ++ ++ *map = kzalloc(max_maps * sizeof(struct pinctrl_map), GFP_KERNEL); ++ if (!*map) ++ return -ENOMEM; ++ ++ tmp = *map; ++ ++ for_each_child_of_node(np_config, np) ++ rt2880_pinctrl_dt_subnode_to_map(pctrldev, np, &tmp); ++ *num_maps = max_maps; ++ ++ return 0; ++} ++ ++static const struct pinctrl_ops rt2880_pctrl_ops = { ++ .get_groups_count = rt2880_get_group_count, ++ .get_group_name = rt2880_get_group_name, ++ .get_group_pins = rt2880_get_group_pins, ++ .pin_dbg_show = rt2880_pinctrl_pin_dbg_show, ++ .dt_node_to_map = rt2880_pinctrl_dt_node_to_map, ++ .dt_free_map = rt2880_pinctrl_dt_free_map, ++}; ++ ++static int rt2880_pmx_func_count(struct pinctrl_dev *pctrldev) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ return p->func_count; ++} ++ ++static const char *rt2880_pmx_func_name(struct pinctrl_dev *pctrldev, ++ unsigned func) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ return p->func[func]->name; ++} ++ ++static int rt2880_pmx_group_get_groups(struct pinctrl_dev *pctrldev, ++ unsigned func, ++ const char * const **groups, ++ unsigned * const num_groups) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ if (p->func[func]->group_count == 1) ++ *groups = &p->group_names[p->func[func]->groups[0]]; ++ else ++ *groups = p->group_names; ++ ++ *num_groups = p->func[func]->group_count; ++ ++ return 0; ++} ++ ++static int rt2880_pmx_group_enable(struct pinctrl_dev *pctrldev, ++ unsigned func, ++ unsigned group) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ u32 mode = 0; ++ u32 reg = SYSC_REG_GPIO_MODE; ++ int i; ++ int shift; ++ ++ /* dont allow double use */ ++ if (p->groups[group].enabled) { ++ dev_err(p->dev, "%s is already enabled\n", p->groups[group].name); ++ return -EBUSY; ++ } ++ ++ p->groups[group].enabled = 1; ++ p->func[func]->enabled = 1; ++ ++ shift = p->groups[group].shift; ++ if (shift >= 32) { ++ shift -= 32; ++ reg = SYSC_REG_GPIO_MODE2; ++ } ++ mode = rt_sysc_r32(reg); ++ mode &= ~(p->groups[group].mask << shift); ++ ++ /* mark the pins as gpio */ ++ for (i = 0; i < p->groups[group].func[0].pin_count; i++) ++ p->gpio[p->groups[group].func[0].pins[i]] = 1; ++ ++ /* function 0 is gpio and needs special handling */ ++ if (func == 0) { ++ mode |= p->groups[group].gpio << shift; ++ } else { ++ for (i = 0; i < p->func[func]->pin_count; i++) ++ p->gpio[p->func[func]->pins[i]] = 0; ++ mode |= p->func[func]->value << shift; ++ } ++ rt_sysc_w32(mode, reg); ++ ++ return 0; ++} ++ ++static int rt2880_pmx_group_gpio_request_enable(struct pinctrl_dev *pctrldev, ++ struct pinctrl_gpio_range *range, ++ unsigned pin) ++{ ++ struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); ++ ++ if (!p->gpio[pin]) { ++ dev_err(p->dev, "pin %d is not set to gpio mux\n", pin); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static const struct pinmux_ops rt2880_pmx_group_ops = { ++ .get_functions_count = rt2880_pmx_func_count, ++ .get_function_name = rt2880_pmx_func_name, ++ .get_function_groups = rt2880_pmx_group_get_groups, ++ .set_mux = rt2880_pmx_group_enable, ++ .gpio_request_enable = rt2880_pmx_group_gpio_request_enable, ++}; ++ ++static struct pinctrl_desc rt2880_pctrl_desc = { ++ .owner = THIS_MODULE, ++ .name = "rt2880-pinmux", ++ .pctlops = &rt2880_pctrl_ops, ++ .pmxops = &rt2880_pmx_group_ops, ++}; ++ ++static struct rt2880_pmx_func gpio_func = { ++ .name = "gpio", ++}; ++ ++static int rt2880_pinmux_index(struct rt2880_priv *p) ++{ ++ struct rt2880_pmx_func **f; ++ struct rt2880_pmx_group *mux = p->groups; ++ int i, j, c = 0; ++ ++ /* count the mux functions */ ++ while (mux->name) { ++ p->group_count++; ++ mux++; ++ } ++ ++ /* allocate the group names array needed by the gpio function */ ++ p->group_names = devm_kzalloc(p->dev, sizeof(char *) * p->group_count, GFP_KERNEL); ++ if (!p->group_names) ++ return -1; ++ ++ for (i = 0; i < p->group_count; i++) { ++ p->group_names[i] = p->groups[i].name; ++ p->func_count += p->groups[i].func_count; ++ } ++ ++ /* we have a dummy function[0] for gpio */ ++ p->func_count++; ++ ++ /* allocate our function and group mapping index buffers */ ++ f = p->func = devm_kzalloc(p->dev, sizeof(struct rt2880_pmx_func) * p->func_count, GFP_KERNEL); ++ gpio_func.groups = devm_kzalloc(p->dev, sizeof(int) * p->group_count, GFP_KERNEL); ++ if (!f || !gpio_func.groups) ++ return -1; ++ ++ /* add a backpointer to the function so it knows its group */ ++ gpio_func.group_count = p->group_count; ++ for (i = 0; i < gpio_func.group_count; i++) ++ gpio_func.groups[i] = i; ++ ++ f[c] = &gpio_func; ++ c++; ++ ++ /* add remaining functions */ ++ for (i = 0; i < p->group_count; i++) { ++ for (j = 0; j < p->groups[i].func_count; j++) { ++ f[c] = &p->groups[i].func[j]; ++ f[c]->groups = devm_kzalloc(p->dev, sizeof(int), GFP_KERNEL); ++ f[c]->groups[0] = i; ++ f[c]->group_count = 1; ++ c++; ++ } ++ } ++ return 0; ++} ++ ++static int rt2880_pinmux_pins(struct rt2880_priv *p) ++{ ++ int i, j; ++ ++ /* loop over the functions and initialize the pins array. also work out the highest pin used */ ++ for (i = 0; i < p->func_count; i++) { ++ int pin; ++ ++ if (!p->func[i]->pin_count) ++ continue; ++ ++ p->func[i]->pins = devm_kzalloc(p->dev, sizeof(int) * p->func[i]->pin_count, GFP_KERNEL); ++ for (j = 0; j < p->func[i]->pin_count; j++) ++ p->func[i]->pins[j] = p->func[i]->pin_first + j; ++ ++ pin = p->func[i]->pin_first + p->func[i]->pin_count; ++ if (pin > p->max_pins) ++ p->max_pins = pin; ++ } ++ ++ /* the buffer that tells us which pins are gpio */ ++ p->gpio = devm_kzalloc(p->dev,sizeof(uint8_t) * p->max_pins, ++ GFP_KERNEL); ++ /* the pads needed to tell pinctrl about our pins */ ++ p->pads = devm_kzalloc(p->dev, ++ sizeof(struct pinctrl_pin_desc) * p->max_pins, ++ GFP_KERNEL); ++ if (!p->pads || !p->gpio ) { ++ dev_err(p->dev, "Failed to allocate gpio data\n"); ++ return -ENOMEM; ++ } ++ ++ memset(p->gpio, 1, sizeof(uint8_t) * p->max_pins); ++ for (i = 0; i < p->func_count; i++) { ++ if (!p->func[i]->pin_count) ++ continue; ++ ++ for (j = 0; j < p->func[i]->pin_count; j++) ++ p->gpio[p->func[i]->pins[j]] = 0; ++ } ++ ++ /* pin 0 is always a gpio */ ++ p->gpio[0] = 1; ++ ++ /* set the pads */ ++ for (i = 0; i < p->max_pins; i++) { ++ /* strlen("ioXY") + 1 = 5 */ ++ char *name = devm_kzalloc(p->dev, 5, GFP_KERNEL); ++ ++ if (!name) { ++ dev_err(p->dev, "Failed to allocate pad name\n"); ++ return -ENOMEM; ++ } ++ snprintf(name, 5, "io%d", i); ++ p->pads[i].number = i; ++ p->pads[i].name = name; ++ } ++ p->desc->pins = p->pads; ++ p->desc->npins = p->max_pins; ++ ++ return 0; ++} ++ ++static int rt2880_pinmux_probe(struct platform_device *pdev) ++{ ++ struct rt2880_priv *p; ++ struct pinctrl_dev *dev; ++ struct device_node *np; ++ ++ if (!rt2880_pinmux_data) ++ return -ENOSYS; ++ ++ /* setup the private data */ ++ p = devm_kzalloc(&pdev->dev, sizeof(struct rt2880_priv), GFP_KERNEL); ++ if (!p) ++ return -ENOMEM; ++ ++ p->dev = &pdev->dev; ++ p->desc = &rt2880_pctrl_desc; ++ p->groups = rt2880_pinmux_data; ++ platform_set_drvdata(pdev, p); ++ ++ /* init the device */ ++ if (rt2880_pinmux_index(p)) { ++ dev_err(&pdev->dev, "failed to load index\n"); ++ return -EINVAL; ++ } ++ if (rt2880_pinmux_pins(p)) { ++ dev_err(&pdev->dev, "failed to load pins\n"); ++ return -EINVAL; ++ } ++ dev = pinctrl_register(p->desc, &pdev->dev, p); ++ if (IS_ERR(dev)) ++ return PTR_ERR(dev); ++ ++ /* finalize by adding gpio ranges for enables gpio controllers */ ++ for_each_compatible_node(np, NULL, "ralink,rt2880-gpio") { ++ const __be32 *ngpio, *gpiobase; ++ struct pinctrl_gpio_range *range; ++ char *name; ++ ++ if (!of_device_is_available(np)) ++ continue; ++ ++ ngpio = of_get_property(np, "ralink,num-gpios", NULL); ++ gpiobase = of_get_property(np, "ralink,gpio-base", NULL); ++ if (!ngpio || !gpiobase) { ++ dev_err(&pdev->dev, "failed to load chip info\n"); ++ return -EINVAL; ++ } ++ ++ range = devm_kzalloc(p->dev, sizeof(struct pinctrl_gpio_range) + 4, GFP_KERNEL); ++ range->name = name = (char *) &range[1]; ++ sprintf(name, "pio"); ++ range->npins = __be32_to_cpu(*ngpio); ++ range->base = __be32_to_cpu(*gpiobase); ++ range->pin_base = range->base; ++ pinctrl_add_gpio_range(dev, range); ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id rt2880_pinmux_match[] = { ++ { .compatible = "ralink,rt2880-pinmux" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rt2880_pinmux_match); ++ ++static struct platform_driver rt2880_pinmux_driver = { ++ .probe = rt2880_pinmux_probe, ++ .driver = { ++ .name = "rt2880-pinmux", ++ .owner = THIS_MODULE, ++ .of_match_table = rt2880_pinmux_match, ++ }, ++}; ++ ++int __init rt2880_pinmux_init(void) ++{ ++ return platform_driver_register(&rt2880_pinmux_driver); ++} ++ ++core_initcall_sync(rt2880_pinmux_init); diff --git a/target/linux/ramips/patches-4.4/0026-DT-Add-documentation-for-gpio-ralink.patch b/target/linux/ramips/patches-4.4/0026-DT-Add-documentation-for-gpio-ralink.patch new file mode 100644 index 0000000000..7d5f98f647 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0026-DT-Add-documentation-for-gpio-ralink.patch @@ -0,0 +1,59 @@ +From d410e5478c622c01fcf31427533df5f433df9146 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 28 Jul 2013 19:45:30 +0200 +Subject: [PATCH 26/53] DT: Add documentation for gpio-ralink + +Describe gpio-ralink binding. + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Cc: devicetree@vger.kernel.org +Cc: linux-gpio@vger.kernel.org +--- + .../devicetree/bindings/gpio/gpio-ralink.txt | 40 ++++++++++++++++++++ + 1 file changed, 40 insertions(+) + create mode 100644 Documentation/devicetree/bindings/gpio/gpio-ralink.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt +@@ -0,0 +1,40 @@ ++Ralink SoC GPIO controller bindings ++ ++Required properties: ++- compatible: ++ - "ralink,rt2880-gpio" for Ralink controllers ++- #gpio-cells : Should be two. ++ - first cell is the pin number ++ - second cell is used to specify optional parameters (unused) ++- gpio-controller : Marks the device node as a GPIO controller ++- 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,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 ] ++ ++Optional properties: ++- ralink,gpio-base : Specify the GPIO chips base number ++ ++Example: ++ ++ gpio0: gpio@600 { ++ compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio"; ++ ++ #gpio-cells = <2>; ++ gpio-controller; ++ ++ reg = <0x600 0x34>; ++ ++ interrupt-parent = <&intc>; ++ interrupts = <6>; ++ ++ ralink,gpio-base = <0>; ++ ralink,num-gpios = <24>; ++ ralink,register-map = [ 00 04 08 0c ++ 20 24 28 2c ++ 30 34 ]; ++ ++ }; diff --git a/target/linux/ramips/patches-4.4/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch b/target/linux/ramips/patches-4.4/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch new file mode 100644 index 0000000000..a49793f8cd --- /dev/null +++ b/target/linux/ramips/patches-4.4/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch @@ -0,0 +1,430 @@ +From 69fdd2c4f937796b934e89c33acde9d082e27bfd Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Aug 2014 20:36:29 +0200 +Subject: [PATCH 27/53] GPIO: MIPS: ralink: add gpio driver for ralink SoC + +Add gpio driver for Ralink SoC. This driver makes the gpio core on +RT2880, RT305x, rt3352, rt3662, rt3883, rt5350 and mt7620 work. + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Cc: linux-gpio@vger.kernel.org +--- + arch/mips/include/asm/mach-ralink/gpio.h | 24 ++ + drivers/gpio/Kconfig | 6 + + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-ralink.c | 355 ++++++++++++++++++++++++++++++ + 4 files changed, 386 insertions(+) + create mode 100644 arch/mips/include/asm/mach-ralink/gpio.h + create mode 100644 drivers/gpio/gpio-ralink.c + +--- /dev/null ++++ b/arch/mips/include/asm/mach-ralink/gpio.h +@@ -0,0 +1,24 @@ ++/* ++ * Ralink SoC GPIO API support ++ * ++ * Copyright (C) 2008-2009 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 __ASM_MACH_RALINK_GPIO_H ++#define __ASM_MACH_RALINK_GPIO_H ++ ++#define ARCH_NR_GPIOS 128 ++#include ++ ++#define gpio_get_value __gpio_get_value ++#define gpio_set_value __gpio_set_value ++#define gpio_cansleep __gpio_cansleep ++#define gpio_to_irq __gpio_to_irq ++ ++#endif /* __ASM_MACH_RALINK_GPIO_H */ +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -352,6 +352,12 @@ config GPIO_SAMSUNG + Legacy GPIO support. Use only for platforms without support for + pinctrl. + ++config GPIO_RALINK ++ bool "Ralink GPIO Support" ++ depends on RALINK ++ help ++ Say yes here to support the Ralink SoC GPIO device ++ + config GPIO_SPEAR_SPICS + bool "ST SPEAr13xx SPI Chip Select as GPIO support" + depends on PLAT_SPEAR +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -76,6 +76,7 @@ obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf85 + obj-$(CONFIG_GPIO_PCH) += gpio-pch.o + obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o + obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o ++obj-$(CONFIG_GPIO_RALINK) += gpio-ralink.o + obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o + obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o + obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o +--- /dev/null ++++ b/drivers/gpio/gpio-ralink.c +@@ -0,0 +1,355 @@ ++/* ++ * 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-2011 Gabor Juhos ++ * Copyright (C) 2013 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++enum ralink_gpio_reg { ++ GPIO_REG_INT = 0, ++ GPIO_REG_EDGE, ++ GPIO_REG_RENA, ++ GPIO_REG_FENA, ++ GPIO_REG_DATA, ++ GPIO_REG_DIR, ++ GPIO_REG_POL, ++ GPIO_REG_SET, ++ GPIO_REG_RESET, ++ GPIO_REG_TOGGLE, ++ GPIO_REG_MAX ++}; ++ ++struct ralink_gpio_chip { ++ struct gpio_chip chip; ++ u8 regs[GPIO_REG_MAX]; ++ ++ spinlock_t lock; ++ void __iomem *membase; ++ struct irq_domain *domain; ++ int irq; ++ ++ u32 rising; ++ u32 falling; ++}; ++ ++#define MAP_MAX 4 ++static struct irq_domain *irq_map[MAP_MAX]; ++static int irq_map_count; ++static atomic_t irq_refcount = ATOMIC_INIT(0); ++ ++static inline struct ralink_gpio_chip *to_ralink_gpio(struct gpio_chip *chip) ++{ ++ struct ralink_gpio_chip *rg; ++ ++ rg = container_of(chip, struct ralink_gpio_chip, chip); ++ ++ return rg; ++} ++ ++static inline void rt_gpio_w32(struct ralink_gpio_chip *rg, u8 reg, u32 val) ++{ ++ iowrite32(val, rg->membase + rg->regs[reg]); ++} ++ ++static inline u32 rt_gpio_r32(struct ralink_gpio_chip *rg, u8 reg) ++{ ++ return ioread32(rg->membase + rg->regs[reg]); ++} ++ ++static void ralink_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ++{ ++ struct ralink_gpio_chip *rg = to_ralink_gpio(chip); ++ ++ rt_gpio_w32(rg, (value) ? GPIO_REG_SET : GPIO_REG_RESET, BIT(offset)); ++} ++ ++static int ralink_gpio_get(struct gpio_chip *chip, unsigned offset) ++{ ++ struct ralink_gpio_chip *rg = to_ralink_gpio(chip); ++ ++ return !!(rt_gpio_r32(rg, GPIO_REG_DATA) & BIT(offset)); ++} ++ ++static int ralink_gpio_direction_input(struct gpio_chip *chip, unsigned offset) ++{ ++ struct ralink_gpio_chip *rg = to_ralink_gpio(chip); ++ unsigned long flags; ++ u32 t; ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ t = rt_gpio_r32(rg, GPIO_REG_DIR); ++ t &= ~BIT(offset); ++ rt_gpio_w32(rg, GPIO_REG_DIR, t); ++ spin_unlock_irqrestore(&rg->lock, flags); ++ ++ return 0; ++} ++ ++static int ralink_gpio_direction_output(struct gpio_chip *chip, ++ unsigned offset, int value) ++{ ++ struct ralink_gpio_chip *rg = to_ralink_gpio(chip); ++ unsigned long flags; ++ u32 t; ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ ralink_gpio_set(chip, offset, value); ++ t = rt_gpio_r32(rg, GPIO_REG_DIR); ++ t |= BIT(offset); ++ rt_gpio_w32(rg, GPIO_REG_DIR, t); ++ spin_unlock_irqrestore(&rg->lock, flags); ++ ++ return 0; ++} ++ ++static int ralink_gpio_to_irq(struct gpio_chip *chip, unsigned pin) ++{ ++ struct ralink_gpio_chip *rg = to_ralink_gpio(chip); ++ ++ if (rg->irq < 1) ++ return -1; ++ ++ return irq_create_mapping(rg->domain, pin); ++} ++ ++static void ralink_gpio_irq_handler(struct irq_desc *desc) ++{ ++ int i; ++ ++ for (i = 0; i < irq_map_count; i++) { ++ struct irq_domain *domain = irq_map[i]; ++ struct ralink_gpio_chip *rg; ++ unsigned long pending; ++ int bit; ++ ++ rg = (struct ralink_gpio_chip *) domain->host_data; ++ pending = rt_gpio_r32(rg, GPIO_REG_INT); ++ ++ for_each_set_bit(bit, &pending, rg->chip.ngpio) { ++ u32 map = irq_find_mapping(domain, bit); ++ generic_handle_irq(map); ++ rt_gpio_w32(rg, GPIO_REG_INT, BIT(bit)); ++ } ++ } ++} ++ ++static void ralink_gpio_irq_unmask(struct irq_data *d) ++{ ++ struct ralink_gpio_chip *rg; ++ unsigned long flags; ++ u32 rise, fall; ++ ++ rg = (struct ralink_gpio_chip *) d->domain->host_data; ++ rise = rt_gpio_r32(rg, GPIO_REG_RENA); ++ fall = rt_gpio_r32(rg, GPIO_REG_FENA); ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ rt_gpio_w32(rg, GPIO_REG_RENA, rise | (BIT(d->hwirq) & rg->rising)); ++ rt_gpio_w32(rg, GPIO_REG_FENA, fall | (BIT(d->hwirq) & rg->falling)); ++ spin_unlock_irqrestore(&rg->lock, flags); ++} ++ ++static void ralink_gpio_irq_mask(struct irq_data *d) ++{ ++ struct ralink_gpio_chip *rg; ++ unsigned long flags; ++ u32 rise, fall; ++ ++ rg = (struct ralink_gpio_chip *) d->domain->host_data; ++ rise = rt_gpio_r32(rg, GPIO_REG_RENA); ++ fall = rt_gpio_r32(rg, GPIO_REG_FENA); ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ rt_gpio_w32(rg, GPIO_REG_FENA, fall & ~BIT(d->hwirq)); ++ rt_gpio_w32(rg, GPIO_REG_RENA, rise & ~BIT(d->hwirq)); ++ spin_unlock_irqrestore(&rg->lock, flags); ++} ++ ++static int ralink_gpio_irq_type(struct irq_data *d, unsigned int type) ++{ ++ struct ralink_gpio_chip *rg; ++ u32 mask = BIT(d->hwirq); ++ ++ rg = (struct ralink_gpio_chip *) d->domain->host_data; ++ ++ if (type == IRQ_TYPE_PROBE) { ++ if ((rg->rising | rg->falling) & mask) ++ return 0; ++ ++ type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; ++ } ++ ++ if (type & IRQ_TYPE_EDGE_RISING) ++ rg->rising |= mask; ++ else ++ rg->rising &= ~mask; ++ ++ if (type & IRQ_TYPE_EDGE_FALLING) ++ rg->falling |= mask; ++ else ++ rg->falling &= ~mask; ++ ++ return 0; ++} ++ ++static struct irq_chip ralink_gpio_irq_chip = { ++ .name = "GPIO", ++ .irq_unmask = ralink_gpio_irq_unmask, ++ .irq_mask = ralink_gpio_irq_mask, ++ .irq_mask_ack = ralink_gpio_irq_mask, ++ .irq_set_type = ralink_gpio_irq_type, ++}; ++ ++static int gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) ++{ ++ irq_set_chip_and_handler(irq, &ralink_gpio_irq_chip, handle_level_irq); ++ irq_set_handler_data(irq, d); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops irq_domain_ops = { ++ .xlate = irq_domain_xlate_onecell, ++ .map = gpio_map, ++}; ++ ++static void ralink_gpio_irq_init(struct device_node *np, ++ struct ralink_gpio_chip *rg) ++{ ++ if (irq_map_count >= MAP_MAX) ++ return; ++ ++ rg->irq = irq_of_parse_and_map(np, 0); ++ if (!rg->irq) ++ return; ++ ++ rg->domain = irq_domain_add_linear(np, rg->chip.ngpio, ++ &irq_domain_ops, rg); ++ if (!rg->domain) { ++ dev_err(rg->chip.dev, "irq_domain_add_linear failed\n"); ++ return; ++ } ++ ++ irq_map[irq_map_count++] = rg->domain; ++ ++ rt_gpio_w32(rg, GPIO_REG_RENA, 0x0); ++ rt_gpio_w32(rg, GPIO_REG_FENA, 0x0); ++ ++ if (!atomic_read(&irq_refcount)) ++ irq_set_chained_handler(rg->irq, ralink_gpio_irq_handler); ++ atomic_inc(&irq_refcount); ++ ++ dev_info(rg->chip.dev, "registering %d irq handlers\n", rg->chip.ngpio); ++} ++ ++static int ralink_gpio_request(struct gpio_chip *chip, unsigned offset) ++{ ++ int gpio = chip->base + offset; ++ ++ return pinctrl_request_gpio(gpio); ++} ++ ++static void ralink_gpio_free(struct gpio_chip *chip, unsigned offset) ++{ ++ int gpio = chip->base + offset; ++ ++ pinctrl_free_gpio(gpio); ++} ++ ++static int ralink_gpio_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ struct ralink_gpio_chip *rg; ++ const __be32 *ngpio, *gpiobase; ++ ++ if (!res) { ++ dev_err(&pdev->dev, "failed to find resource\n"); ++ return -ENOMEM; ++ } ++ ++ rg = devm_kzalloc(&pdev->dev, ++ sizeof(struct ralink_gpio_chip), GFP_KERNEL); ++ if (!rg) ++ return -ENOMEM; ++ ++ rg->membase = devm_ioremap_resource(&pdev->dev, res); ++ if (!rg->membase) { ++ dev_err(&pdev->dev, "cannot remap I/O memory region\n"); ++ return -ENOMEM; ++ } ++ ++ if (of_property_read_u8_array(np, "ralink,register-map", ++ rg->regs, GPIO_REG_MAX)) { ++ dev_err(&pdev->dev, "failed to read register definition\n"); ++ return -EINVAL; ++ } ++ ++ ngpio = of_get_property(np, "ralink,num-gpios", NULL); ++ if (!ngpio) { ++ dev_err(&pdev->dev, "failed to read number of pins\n"); ++ return -EINVAL; ++ } ++ ++ gpiobase = of_get_property(np, "ralink,gpio-base", NULL); ++ if (gpiobase) ++ rg->chip.base = be32_to_cpu(*gpiobase); ++ else ++ rg->chip.base = -1; ++ ++ spin_lock_init(&rg->lock); ++ ++ rg->chip.dev = &pdev->dev; ++ rg->chip.label = dev_name(&pdev->dev); ++ rg->chip.of_node = np; ++ rg->chip.ngpio = be32_to_cpu(*ngpio); ++ rg->chip.direction_input = ralink_gpio_direction_input; ++ rg->chip.direction_output = ralink_gpio_direction_output; ++ rg->chip.get = ralink_gpio_get; ++ rg->chip.set = ralink_gpio_set; ++ rg->chip.request = ralink_gpio_request; ++ rg->chip.to_irq = ralink_gpio_to_irq; ++ rg->chip.free = ralink_gpio_free; ++ ++ /* set polarity to low for all lines */ ++ rt_gpio_w32(rg, GPIO_REG_POL, 0); ++ ++ dev_info(&pdev->dev, "registering %d gpios\n", rg->chip.ngpio); ++ ++ ralink_gpio_irq_init(np, rg); ++ ++ return gpiochip_add(&rg->chip); ++} ++ ++static const struct of_device_id ralink_gpio_match[] = { ++ { .compatible = "ralink,rt2880-gpio" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ralink_gpio_match); ++ ++static struct platform_driver ralink_gpio_driver = { ++ .probe = ralink_gpio_probe, ++ .driver = { ++ .name = "rt2880_gpio", ++ .owner = THIS_MODULE, ++ .of_match_table = ralink_gpio_match, ++ }, ++}; ++ ++static int __init ralink_gpio_init(void) ++{ ++ return platform_driver_register(&ralink_gpio_driver); ++} ++ ++subsys_initcall(ralink_gpio_init); diff --git a/target/linux/ramips/patches-4.4/0028-GPIO-ralink-add-mt7621-gpio-controller.patch b/target/linux/ramips/patches-4.4/0028-GPIO-ralink-add-mt7621-gpio-controller.patch new file mode 100644 index 0000000000..46a1d9ec79 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0028-GPIO-ralink-add-mt7621-gpio-controller.patch @@ -0,0 +1,405 @@ +From 61ac7d9b4228de8c332900902c2b93189b042eab Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 11:00:32 +0100 +Subject: [PATCH 28/53] GPIO: ralink: add mt7621 gpio controller + +Signed-off-by: John Crispin +--- + arch/mips/Kconfig | 3 + + drivers/gpio/Kconfig | 6 + + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-mt7621.c | 354 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 364 insertions(+) + create mode 100644 drivers/gpio/gpio-mt7621.c + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -587,6 +587,9 @@ config RALINK + select RESET_CONTROLLER + select PINCTRL + select PINCTRL_RT2880 ++ select ARCH_HAS_RESET_CONTROLLER ++ select RESET_CONTROLLER ++ select ARCH_REQUIRE_GPIOLIB + + config SGI_IP22 + bool "SGI IP22 (Indy/Indigo2)" +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -261,6 +261,12 @@ config GPIO_MB86S7X + help + Say yes here to support the GPIO controller in Fujitsu MB86S70 SoCs. + ++config GPIO_MT7621 ++ bool "Mediatek GPIO Support" ++ depends on SOC_MT7620 || SOC_MT7621 ++ help ++ Say yes here to support the Mediatek SoC GPIO device ++ + config GPIO_MM_LANTIQ + bool "Lantiq Memory mapped GPIOs" + depends on LANTIQ && SOC_XWAY +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -120,3 +120,4 @@ obj-$(CONFIG_GPIO_XTENSA) += gpio-xtensa + obj-$(CONFIG_GPIO_ZEVIO) += gpio-zevio.o + obj-$(CONFIG_GPIO_ZYNQ) += gpio-zynq.o + obj-$(CONFIG_GPIO_ZX) += gpio-zx.o ++obj-$(CONFIG_GPIO_MT7621) += gpio-mt7621.o +--- /dev/null ++++ b/drivers/gpio/gpio-mt7621.c +@@ -0,0 +1,354 @@ ++/* ++ * 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-2011 Gabor Juhos ++ * Copyright (C) 2013 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MTK_MAX_BANK 3 ++#define MTK_BANK_WIDTH 32 ++ ++enum mediatek_gpio_reg { ++ GPIO_REG_CTRL = 0, ++ GPIO_REG_POL, ++ GPIO_REG_DATA, ++ GPIO_REG_DSET, ++ GPIO_REG_DCLR, ++ GPIO_REG_REDGE, ++ GPIO_REG_FEDGE, ++ GPIO_REG_HLVL, ++ GPIO_REG_LLVL, ++ GPIO_REG_STAT, ++ GPIO_REG_EDGE, ++}; ++ ++static void __iomem *mediatek_gpio_membase; ++static int mediatek_gpio_irq; ++static struct irq_domain *mediatek_gpio_irq_domain; ++static atomic_t irq_refcount = ATOMIC_INIT(0); ++ ++struct mtk_gc { ++ struct gpio_chip chip; ++ spinlock_t lock; ++ int bank; ++ u32 rising; ++ u32 falling; ++} *gc_map[MTK_MAX_BANK]; ++ ++static inline struct mtk_gc ++*to_mediatek_gpio(struct gpio_chip *chip) ++{ ++ struct mtk_gc *mgc; ++ ++ mgc = container_of(chip, struct mtk_gc, chip); ++ ++ return mgc; ++} ++ ++static inline void ++mtk_gpio_w32(struct mtk_gc *rg, u8 reg, u32 val) ++{ ++ iowrite32(val, mediatek_gpio_membase + (reg * 0x10) + (rg->bank * 0x4)); ++} ++ ++static inline u32 ++mtk_gpio_r32(struct mtk_gc *rg, u8 reg) ++{ ++ return ioread32(mediatek_gpio_membase + (reg * 0x10) + (rg->bank * 0x4)); ++} ++ ++static void ++mediatek_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ++{ ++ struct mtk_gc *rg = to_mediatek_gpio(chip); ++ ++ mtk_gpio_w32(rg, (value) ? GPIO_REG_DSET : GPIO_REG_DCLR, BIT(offset)); ++} ++ ++static int ++mediatek_gpio_get(struct gpio_chip *chip, unsigned offset) ++{ ++ struct mtk_gc *rg = to_mediatek_gpio(chip); ++ ++ return !!(mtk_gpio_r32(rg, GPIO_REG_DATA) & BIT(offset)); ++} ++ ++static int ++mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned offset) ++{ ++ struct mtk_gc *rg = to_mediatek_gpio(chip); ++ unsigned long flags; ++ u32 t; ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ t = mtk_gpio_r32(rg, GPIO_REG_CTRL); ++ t &= ~BIT(offset); ++ mtk_gpio_w32(rg, GPIO_REG_CTRL, t); ++ spin_unlock_irqrestore(&rg->lock, flags); ++ ++ return 0; ++} ++ ++static int ++mediatek_gpio_direction_output(struct gpio_chip *chip, ++ unsigned offset, int value) ++{ ++ struct mtk_gc *rg = to_mediatek_gpio(chip); ++ unsigned long flags; ++ u32 t; ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ t = mtk_gpio_r32(rg, GPIO_REG_CTRL); ++ t |= BIT(offset); ++ mtk_gpio_w32(rg, GPIO_REG_CTRL, t); ++ mediatek_gpio_set(chip, offset, value); ++ spin_unlock_irqrestore(&rg->lock, flags); ++ ++ return 0; ++} ++ ++static int ++mediatek_gpio_get_direction(struct gpio_chip *chip, unsigned offset) ++{ ++ struct mtk_gc *rg = to_mediatek_gpio(chip); ++ unsigned long flags; ++ u32 t; ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ t = mtk_gpio_r32(rg, GPIO_REG_CTRL); ++ spin_unlock_irqrestore(&rg->lock, flags); ++ ++ if (t & BIT(offset)) ++ return 0; ++ ++ return 1; ++} ++ ++static int ++mediatek_gpio_to_irq(struct gpio_chip *chip, unsigned pin) ++{ ++ struct mtk_gc *rg = to_mediatek_gpio(chip); ++ ++ return irq_create_mapping(mediatek_gpio_irq_domain, pin + (rg->bank * MTK_BANK_WIDTH)); ++} ++ ++static int ++mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node *bank) ++{ ++ const __be32 *id = of_get_property(bank, "reg", NULL); ++ struct mtk_gc *rg = devm_kzalloc(&pdev->dev, ++ sizeof(struct mtk_gc), GFP_KERNEL); ++ ++ if (!rg || !id || be32_to_cpu(*id) > MTK_MAX_BANK) ++ return -ENOMEM; ++ ++ gc_map[be32_to_cpu(*id)] = rg; ++ ++ memset(rg, 0, sizeof(struct mtk_gc)); ++ ++ spin_lock_init(&rg->lock); ++ ++ rg->chip.dev = &pdev->dev; ++ rg->chip.label = dev_name(&pdev->dev); ++ rg->chip.of_node = bank; ++ rg->chip.base = MTK_BANK_WIDTH * be32_to_cpu(*id); ++ rg->chip.ngpio = MTK_BANK_WIDTH; ++ rg->chip.direction_input = mediatek_gpio_direction_input; ++ rg->chip.direction_output = mediatek_gpio_direction_output; ++ rg->chip.get_direction = mediatek_gpio_get_direction; ++ rg->chip.get = mediatek_gpio_get; ++ rg->chip.set = mediatek_gpio_set; ++ if (mediatek_gpio_irq_domain) ++ rg->chip.to_irq = mediatek_gpio_to_irq; ++ rg->bank = be32_to_cpu(*id); ++ ++ /* set polarity to low for all gpios */ ++ mtk_gpio_w32(rg, GPIO_REG_POL, 0); ++ ++ dev_info(&pdev->dev, "registering %d gpios\n", rg->chip.ngpio); ++ ++ return gpiochip_add(&rg->chip); ++} ++ ++static void ++mediatek_gpio_irq_handler(struct irq_desc *desc) ++{ ++ int i; ++ ++ for (i = 0; i < MTK_MAX_BANK; i++) { ++ struct mtk_gc *rg = gc_map[i]; ++ unsigned long pending; ++ int bit; ++ ++ if (!rg) ++ continue; ++ ++ pending = mtk_gpio_r32(rg, GPIO_REG_STAT); ++ ++ for_each_set_bit(bit, &pending, MTK_BANK_WIDTH) { ++ u32 map = irq_find_mapping(mediatek_gpio_irq_domain, (MTK_BANK_WIDTH * i) + bit); ++ ++ generic_handle_irq(map); ++ mtk_gpio_w32(rg, GPIO_REG_STAT, BIT(bit)); ++ } ++ } ++} ++ ++static void ++mediatek_gpio_irq_unmask(struct irq_data *d) ++{ ++ int pin = d->hwirq; ++ int bank = pin / 32; ++ struct mtk_gc *rg = gc_map[bank]; ++ unsigned long flags; ++ u32 rise, fall; ++ ++ if (!rg) ++ return; ++ ++ rise = mtk_gpio_r32(rg, GPIO_REG_REDGE); ++ fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE); ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (BIT(d->hwirq) & rg->rising)); ++ mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (BIT(d->hwirq) & rg->falling)); ++ spin_unlock_irqrestore(&rg->lock, flags); ++} ++ ++static void ++mediatek_gpio_irq_mask(struct irq_data *d) ++{ ++ int pin = d->hwirq; ++ int bank = pin / 32; ++ struct mtk_gc *rg = gc_map[bank]; ++ unsigned long flags; ++ u32 rise, fall; ++ ++ if (!rg) ++ return; ++ ++ rise = mtk_gpio_r32(rg, GPIO_REG_REDGE); ++ fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE); ++ ++ spin_lock_irqsave(&rg->lock, flags); ++ mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~BIT(d->hwirq)); ++ mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~BIT(d->hwirq)); ++ spin_unlock_irqrestore(&rg->lock, flags); ++} ++ ++static int ++mediatek_gpio_irq_type(struct irq_data *d, unsigned int type) ++{ ++ int pin = d->hwirq; ++ int bank = pin / 32; ++ struct mtk_gc *rg = gc_map[bank]; ++ u32 mask = BIT(d->hwirq); ++ ++ if (!rg) ++ return -1; ++ ++ if (type == IRQ_TYPE_PROBE) { ++ if ((rg->rising | rg->falling) & mask) ++ return 0; ++ ++ type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; ++ } ++ ++ if (type & IRQ_TYPE_EDGE_RISING) ++ rg->rising |= mask; ++ else ++ rg->rising &= ~mask; ++ ++ if (type & IRQ_TYPE_EDGE_FALLING) ++ rg->falling |= mask; ++ else ++ rg->falling &= ~mask; ++ ++ return 0; ++} ++ ++static struct irq_chip mediatek_gpio_irq_chip = { ++ .name = "GPIO", ++ .irq_unmask = mediatek_gpio_irq_unmask, ++ .irq_mask = mediatek_gpio_irq_mask, ++ .irq_mask_ack = mediatek_gpio_irq_mask, ++ .irq_set_type = mediatek_gpio_irq_type, ++}; ++ ++static int ++mediatek_gpio_gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) ++{ ++ irq_set_chip_and_handler(irq, &mediatek_gpio_irq_chip, handle_level_irq); ++ irq_set_handler_data(irq, d); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops irq_domain_ops = { ++ .xlate = irq_domain_xlate_onecell, ++ .map = mediatek_gpio_gpio_map, ++}; ++ ++static int ++mediatek_gpio_probe(struct platform_device *pdev) ++{ ++ struct device_node *bank, *np = pdev->dev.of_node; ++ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ ++ mediatek_gpio_membase = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(mediatek_gpio_membase)) ++ return PTR_ERR(mediatek_gpio_membase); ++ ++ mediatek_gpio_irq = irq_of_parse_and_map(np, 0); ++ if (mediatek_gpio_irq) { ++ mediatek_gpio_irq_domain = irq_domain_add_linear(np, ++ MTK_MAX_BANK * MTK_BANK_WIDTH, ++ &irq_domain_ops, NULL); ++ if (!mediatek_gpio_irq_domain) ++ dev_err(&pdev->dev, "irq_domain_add_linear failed\n"); ++ } ++ ++ for_each_child_of_node(np, bank) ++ if (of_device_is_compatible(bank, "mtk,mt7621-gpio-bank")) ++ mediatek_gpio_bank_probe(pdev, bank); ++ ++ if (mediatek_gpio_irq_domain) ++ irq_set_chained_handler(mediatek_gpio_irq, mediatek_gpio_irq_handler); ++ ++ return 0; ++} ++ ++static const struct of_device_id mediatek_gpio_match[] = { ++ { .compatible = "mtk,mt7621-gpio" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mediatek_gpio_match); ++ ++static struct platform_driver mediatek_gpio_driver = { ++ .probe = mediatek_gpio_probe, ++ .driver = { ++ .name = "mt7621_gpio", ++ .owner = THIS_MODULE, ++ .of_match_table = mediatek_gpio_match, ++ }, ++}; ++ ++static int __init ++mediatek_gpio_init(void) ++{ ++ return platform_driver_register(&mediatek_gpio_driver); ++} ++ ++subsys_initcall(mediatek_gpio_init); diff --git a/target/linux/ramips/patches-4.4/0029-phy-usb-add-ralink-phy.patch b/target/linux/ramips/patches-4.4/0029-phy-usb-add-ralink-phy.patch new file mode 100644 index 0000000000..4068e9a2a5 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0029-phy-usb-add-ralink-phy.patch @@ -0,0 +1,293 @@ +From b00b5eafa7e8d059bd0ce844e66f648916953270 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 3 Jan 2016 19:11:22 +0100 +Subject: [PATCH 2/3] phy: ralink-usb: add driver for Mediatek/Ralink + +Add a driver to setup the USB phy on Mediatek/Ralink SoCs. +The driver is trivial and only sets up power and host mode. + +Signed-off-by: John Crispin +--- + .../devicetree/bindings/phy/ralink-usb-phy.txt | 17 ++ + drivers/phy/Kconfig | 8 + + drivers/phy/Makefile | 1 + + drivers/phy/phy-ralink-usb.c | 171 ++++++++++++++++++++ + 4 files changed, 197 insertions(+) + create mode 100644 Documentation/devicetree/bindings/phy/ralink-usb-phy.txt + create mode 100644 drivers/phy/phy-ralink-usb.c + +--- /dev/null ++++ b/Documentation/devicetree/bindings/phy/ralink-usb-phy.txt +@@ -0,0 +1,17 @@ ++Mediatek/Ralink USB PHY ++ ++Required properties: ++ - compatible: ralink,rt3352-usbphy or mediatek,mt7620-usbphy ++ - #phy-cells: should be 0 ++ - resets: the two reset controllers for host and device ++ - reset-names: the names of the 2 reset controllers ++ ++Example: ++ ++usbphy: phy { ++ compatible = "mediatek,mt7620-usbphy"; ++ #phy-cells = <0>; ++ ++ resets = <&rstctrl 22 &rstctrl 25>; ++ reset-names = "host", "device"; ++}; +--- a/drivers/phy/Kconfig ++++ b/drivers/phy/Kconfig +@@ -341,6 +341,14 @@ config PHY_XGENE + help + This option enables support for APM X-Gene SoC multi-purpose PHY. + ++config PHY_RALINK_USB ++ tristate "Ralink USB PHY driver" ++ select GENERIC_PHY ++ depends on RALINK ++ help ++ This option enables support for the Ralink USB PHY found inside ++ RT3352 and MT7620. ++ + config PHY_STIH407_USB + tristate "STMicroelectronics USB2 picoPHY driver for STiH407 family" + depends on RESET_CONTROLLER +--- a/drivers/phy/Makefile ++++ b/drivers/phy/Makefile +@@ -48,3 +48,4 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1 + obj-$(CONFIG_PHY_BRCMSTB_SATA) += phy-brcmstb-sata.o + obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o + obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o ++obj-$(CONFIG_PHY_RALINK_USB) += phy-ralink-usb.o +--- /dev/null ++++ b/drivers/phy/phy-ralink-usb.c +@@ -0,0 +1,228 @@ ++/* ++ * Allwinner ralink USB phy driver ++ * ++ * Copyright (C) 2016 John Crispin ++ * ++ * Based on code from ++ * Allwinner Technology Co., Ltd. ++ * ++ * 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define RT_SYSC_REG_SYSCFG1 0x014 ++#define RT_SYSC_REG_CLKCFG1 0x030 ++#define RT_SYSC_REG_USB_PHY_CFG 0x05c ++ ++#define OFS_U2_PHY_AC0 0x00 ++#define OFS_U2_PHY_AC1 0x04 ++#define OFS_U2_PHY_AC2 0x08 ++#define OFS_U2_PHY_ACR0 0x10 ++#define OFS_U2_PHY_ACR1 0x14 ++#define OFS_U2_PHY_ACR2 0x18 ++#define OFS_U2_PHY_ACR3 0x1C ++#define OFS_U2_PHY_ACR4 0x20 ++#define OFS_U2_PHY_AMON0 0x24 ++#define OFS_U2_PHY_DCR0 0x60 ++#define OFS_U2_PHY_DCR1 0x64 ++#define OFS_U2_PHY_DTM0 0x68 ++#define OFS_U2_PHY_DTM1 0x6C ++ ++#define RT_RSTCTRL_UDEV BIT(25) ++#define RT_RSTCTRL_UHST BIT(22) ++#define RT_SYSCFG1_USB0_HOST_MODE BIT(10) ++ ++#define MT7620_CLKCFG1_UPHY0_CLK_EN BIT(25) ++#define MT7620_CLKCFG1_UPHY1_CLK_EN BIT(22) ++#define RT_CLKCFG1_UPHY1_CLK_EN BIT(20) ++#define RT_CLKCFG1_UPHY0_CLK_EN BIT(18) ++ ++#define USB_PHY_UTMI_8B60M BIT(1) ++#define UDEV_WAKEUP BIT(0) ++ ++struct ralink_usb_phy { ++ struct reset_control *rstdev; ++ struct reset_control *rsthost; ++ u32 clk; ++ struct phy *phy; ++ void __iomem *base; ++}; ++ ++static void u2_phy_w32(struct ralink_usb_phy *phy, u32 val, u32 reg) ++{ ++ iowrite32(val, phy->base + reg); ++} ++ ++static u32 u2_phy_r32(struct ralink_usb_phy *phy, u32 reg) ++{ ++ return ioread32(phy->base + reg); ++} ++ ++static void ++u2_phy_init(struct ralink_usb_phy *phy) ++{ ++ u2_phy_r32(phy, OFS_U2_PHY_AC2); ++ u2_phy_r32(phy, OFS_U2_PHY_ACR0); ++ u2_phy_r32(phy, OFS_U2_PHY_DCR0); ++ ++ u2_phy_w32(phy, 0x00ffff02, OFS_U2_PHY_DCR0); ++ u2_phy_r32(phy, OFS_U2_PHY_DCR0); ++ u2_phy_w32(phy, 0x00555502, OFS_U2_PHY_DCR0); ++ u2_phy_r32(phy, OFS_U2_PHY_DCR0); ++ u2_phy_w32(phy, 0x00aaaa02, OFS_U2_PHY_DCR0); ++ u2_phy_r32(phy, OFS_U2_PHY_DCR0); ++ u2_phy_w32(phy, 0x00000402, OFS_U2_PHY_DCR0); ++ u2_phy_r32(phy, OFS_U2_PHY_DCR0); ++ u2_phy_w32(phy, 0x0048086a, OFS_U2_PHY_AC0); ++ u2_phy_w32(phy, 0x4400001c, OFS_U2_PHY_AC1); ++ u2_phy_w32(phy, 0xc0200000, OFS_U2_PHY_ACR3); ++ u2_phy_w32(phy, 0x02000000, OFS_U2_PHY_DTM0); ++} ++ ++static int ralink_usb_phy_power_on(struct phy *_phy) ++{ ++ struct ralink_usb_phy *phy = phy_get_drvdata(_phy); ++ u32 t; ++ ++ /* enable the phy */ ++ rt_sysc_m32(0, phy->clk, RT_SYSC_REG_CLKCFG1); ++ ++ /* setup host mode */ ++ rt_sysc_m32(0, RT_SYSCFG1_USB0_HOST_MODE, RT_SYSC_REG_SYSCFG1); ++ ++ /* deassert the reset lines */ ++ reset_control_deassert(phy->rsthost); ++ reset_control_deassert(phy->rstdev); ++ ++ /* ++ * The SDK kernel had a delay of 100ms. however on device ++ * testing showed that 10ms is enough ++ */ ++ mdelay(10); ++ ++ if (!IS_ERR(phy->base)) ++ u2_phy_init(phy); ++ ++ /* print some status info */ ++ t = rt_sysc_r32(RT_SYSC_REG_USB_PHY_CFG); ++ dev_info(&phy->phy->dev, "remote usb device wakeup %s\n", ++ (t & UDEV_WAKEUP) ? ("enabled") : ("disabled")); ++ if (t & USB_PHY_UTMI_8B60M) ++ dev_info(&phy->phy->dev, "UTMI 8bit 60MHz\n"); ++ else ++ dev_info(&phy->phy->dev, "UTMI 16bit 30MHz\n"); ++ ++ return 0; ++} ++ ++static int ralink_usb_phy_power_off(struct phy *_phy) ++{ ++ struct ralink_usb_phy *phy = phy_get_drvdata(_phy); ++ ++ /* assert the reset lines */ ++ reset_control_assert(phy->rstdev); ++ reset_control_assert(phy->rsthost); ++ ++ /* disable the phy */ ++ rt_sysc_m32(phy->clk, 0, RT_SYSC_REG_CLKCFG1); ++ ++ return 0; ++} ++ ++static struct phy_ops ralink_usb_phy_ops = { ++ .power_on = ralink_usb_phy_power_on, ++ .power_off = ralink_usb_phy_power_off, ++ .owner = THIS_MODULE, ++}; ++ ++static const struct of_device_id ralink_usb_phy_of_match[] = { ++ { ++ .compatible = "ralink,rt3352-usbphy", ++ .data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN | ++ RT_CLKCFG1_UPHY0_CLK_EN) ++ }, ++ { ++ .compatible = "mediatek,mt7620-usbphy", ++ .data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN | ++ MT7620_CLKCFG1_UPHY0_CLK_EN) }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, ralink_usb_phy_of_match); ++ ++static int ralink_usb_phy_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ struct device *dev = &pdev->dev; ++ struct phy_provider *phy_provider; ++ const struct of_device_id *match; ++ struct ralink_usb_phy *phy; ++ ++ phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); ++ if (!phy) ++ return -ENOMEM; ++ ++ match = of_match_device(ralink_usb_phy_of_match, &pdev->dev); ++ if (!match) ++ return -ENODEV; ++ ++ phy->clk = (int) match->data; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ phy->base = devm_ioremap_resource(&pdev->dev, res); ++ ++ phy->rsthost = devm_reset_control_get(&pdev->dev, "host"); ++ if (IS_ERR(phy->rsthost)) { ++ dev_err(dev, "host reset is missing\n"); ++ return PTR_ERR(phy->rsthost); ++ } ++ ++ phy->rstdev = devm_reset_control_get(&pdev->dev, "device"); ++ if (IS_ERR(phy->rstdev)) { ++ dev_err(dev, "device reset is missing\n"); ++ return PTR_ERR(phy->rstdev); ++ } ++ ++ phy->phy = devm_phy_create(dev, NULL, &ralink_usb_phy_ops); ++ if (IS_ERR(phy->phy)) { ++ dev_err(dev, "failed to create PHY\n"); ++ return PTR_ERR(phy->phy); ++ } ++ phy_set_drvdata(phy->phy, phy); ++ ++ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); ++ ++ return PTR_ERR_OR_ZERO(phy_provider); ++} ++ ++static struct platform_driver ralink_usb_phy_driver = { ++ .probe = ralink_usb_phy_probe, ++ .driver = { ++ .of_match_table = ralink_usb_phy_of_match, ++ .name = "ralink-usb-phy", ++ } ++}; ++module_platform_driver(ralink_usb_phy_driver); ++ ++MODULE_DESCRIPTION("Ralink USB phy driver"); ++MODULE_AUTHOR("John Crispin "); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch new file mode 100644 index 0000000000..c6a837d76c --- /dev/null +++ b/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch @@ -0,0 +1,246 @@ +From 975e76214cd2516eb6cfff4c3eec581872645e88 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 19 Sep 2013 01:50:59 +0200 +Subject: [PATCH 31/53] uvc: add iPassion iP2970 support + +Signed-off-by: John Crispin +--- + drivers/media/usb/uvc/uvc_driver.c | 12 +++ + drivers/media/usb/uvc/uvc_status.c | 2 + + drivers/media/usb/uvc/uvc_video.c | 147 ++++++++++++++++++++++++++++++++++++ + drivers/media/usb/uvc/uvcvideo.h | 5 +- + 4 files changed, 165 insertions(+), 1 deletion(-) + +--- a/drivers/media/usb/uvc/uvc_driver.c ++++ b/drivers/media/usb/uvc/uvc_driver.c +@@ -2559,6 +2559,18 @@ static struct usb_device_id uvc_ids[] = + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_QUIRK_FORCE_Y8 }, ++ /* iPassion iP2970 */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x1B3B, ++ .idProduct = 0x2970, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_QUIRK_PROBE_MINMAX ++ | UVC_QUIRK_STREAM_NO_FID ++ | UVC_QUIRK_MOTION ++ | UVC_QUIRK_SINGLE_ISO }, + /* Generic USB Video Class */ + { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) }, + {} +--- a/drivers/media/usb/uvc/uvc_status.c ++++ b/drivers/media/usb/uvc/uvc_status.c +@@ -139,6 +139,7 @@ static void uvc_status_complete(struct u + switch (dev->status[0] & 0x0f) { + case UVC_STATUS_TYPE_CONTROL: + uvc_event_control(dev, dev->status, len); ++ dev->motion = 1; + break; + + case UVC_STATUS_TYPE_STREAMING: +@@ -182,6 +183,7 @@ int uvc_status_init(struct uvc_device *d + } + + pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress); ++ dev->motion = 0; + + /* For high-speed interrupt endpoints, the bInterval value is used as + * an exponent of two. Some developers forgot about it. +--- a/drivers/media/usb/uvc/uvc_video.c ++++ b/drivers/media/usb/uvc/uvc_video.c +@@ -21,6 +21,11 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include + + #include + +@@ -1092,9 +1097,149 @@ static void uvc_video_decode_data(struct + } + } + ++struct bh_priv { ++ unsigned long seen; ++}; ++ ++struct bh_event { ++ const char *name; ++ struct sk_buff *skb; ++ struct work_struct work; ++}; ++ ++#define BH_ERR(fmt, args...) printk(KERN_ERR "%s: " fmt, "webcam", ##args ) ++#define BH_DBG(fmt, args...) do {} while (0) ++#define BH_SKB_SIZE 2048 ++ ++extern u64 uevent_next_seqnum(void); ++static int seen = 0; ++ ++static int bh_event_add_var(struct bh_event *event, int argv, ++ const char *format, ...) ++{ ++ static char buf[128]; ++ char *s; ++ va_list args; ++ int len; ++ ++ if (argv) ++ return 0; ++ ++ va_start(args, format); ++ len = vsnprintf(buf, sizeof(buf), format, args); ++ va_end(args); ++ ++ if (len >= sizeof(buf)) { ++ BH_ERR("buffer size too small\n"); ++ WARN_ON(1); ++ return -ENOMEM; ++ } ++ ++ s = skb_put(event->skb, len + 1); ++ strcpy(s, buf); ++ ++ BH_DBG("added variable '%s'\n", s); ++ ++ return 0; ++} ++ ++static int motion_hotplug_fill_event(struct bh_event *event) ++{ ++ int s = jiffies; ++ int ret; ++ ++ if (!seen) ++ seen = jiffies; ++ ++ ret = bh_event_add_var(event, 0, "HOME=%s", "/"); ++ if (ret) ++ return ret; ++ ++ ret = bh_event_add_var(event, 0, "PATH=%s", ++ "/sbin:/bin:/usr/sbin:/usr/bin"); ++ if (ret) ++ return ret; ++ ++ ret = bh_event_add_var(event, 0, "SUBSYSTEM=usb"); ++ if (ret) ++ return ret; ++ ++ ret = bh_event_add_var(event, 0, "ACTION=motion"); ++ if (ret) ++ return ret; ++ ++ ret = bh_event_add_var(event, 0, "SEEN=%d", s - seen); ++ if (ret) ++ return ret; ++ seen = s; ++ ++ ret = bh_event_add_var(event, 0, "SEQNUM=%llu", uevent_next_seqnum()); ++ ++ return ret; ++} ++ ++static void motion_hotplug_work(struct work_struct *work) ++{ ++ struct bh_event *event = container_of(work, struct bh_event, work); ++ int ret = 0; ++ ++ event->skb = alloc_skb(BH_SKB_SIZE, GFP_KERNEL); ++ if (!event->skb) ++ goto out_free_event; ++ ++ ret = bh_event_add_var(event, 0, "%s@", "add"); ++ if (ret) ++ goto out_free_skb; ++ ++ ret = motion_hotplug_fill_event(event); ++ if (ret) ++ goto out_free_skb; ++ ++ NETLINK_CB(event->skb).dst_group = 1; ++ broadcast_uevent(event->skb, 0, 1, GFP_KERNEL); ++ ++out_free_skb: ++ if (ret) { ++ BH_ERR("work error %d\n", ret); ++ kfree_skb(event->skb); ++ } ++out_free_event: ++ kfree(event); ++} ++ ++static int motion_hotplug_create_event(void) ++{ ++ struct bh_event *event; ++ ++ event = kzalloc(sizeof(*event), GFP_KERNEL); ++ if (!event) ++ return -ENOMEM; ++ ++ event->name = "motion"; ++ ++ INIT_WORK(&event->work, (void *)(void *)motion_hotplug_work); ++ schedule_work(&event->work); ++ ++ return 0; ++} ++ ++#define MOTION_FLAG_OFFSET 4 + static void uvc_video_decode_end(struct uvc_streaming *stream, + struct uvc_buffer *buf, const __u8 *data, int len) + { ++ if ((stream->dev->quirks & UVC_QUIRK_MOTION) && ++ (data[len - 2] == 0xff) && (data[len - 1] == 0xd9)) { ++ u8 *mem; ++ buf->state = UVC_BUF_STATE_READY; ++ mem = (u8 *) (buf->mem + MOTION_FLAG_OFFSET); ++ if ( stream->dev->motion ) { ++ stream->dev->motion = 0; ++ motion_hotplug_create_event(); ++ } else { ++ *mem &= 0x7f; ++ } ++ } ++ + /* Mark the buffer as done if the EOF marker is set. */ + if (data[1] & UVC_STREAM_EOF && buf->bytesused != 0) { + uvc_trace(UVC_TRACE_FRAME, "Frame complete (EOF found).\n"); +@@ -1507,6 +1652,8 @@ static int uvc_init_video_isoc(struct uv + if (npackets == 0) + return -ENOMEM; + ++ if (stream->dev->quirks & UVC_QUIRK_SINGLE_ISO) ++ npackets = 1; + size = npackets * psize; + + for (i = 0; i < UVC_URBS; ++i) { +--- a/drivers/media/usb/uvc/uvcvideo.h ++++ b/drivers/media/usb/uvc/uvcvideo.h +@@ -164,7 +164,9 @@ + #define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200 + #define UVC_QUIRK_RESTORE_CTRLS_ON_INIT 0x00000400 + #define UVC_QUIRK_FORCE_Y8 0x00000800 +- ++#define UVC_QUIRK_MOTION 0x00001000 ++#define UVC_QUIRK_SINGLE_ISO 0x00002000 ++ + /* Format flags */ + #define UVC_FMT_FLAG_COMPRESSED 0x00000001 + #define UVC_FMT_FLAG_STREAM 0x00000002 +@@ -562,6 +564,7 @@ struct uvc_device { + __u8 *status; + struct input_dev *input; + char input_phys[64]; ++ int motion; + }; + + enum uvc_handle_state { diff --git a/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch b/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch new file mode 100644 index 0000000000..e77e02f677 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch @@ -0,0 +1,29 @@ +From a758e0870c6d1e4b0272f6e7f9efa9face5534bb Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:49:07 +0100 +Subject: [PATCH 32/53] USB: dwc2: add device_reset() + +Signed-off-by: John Crispin +--- + drivers/usb/dwc2/hcd.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -47,6 +47,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -3002,6 +3003,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso + + retval = -ENOMEM; + ++ device_reset(hsotg->dev); ++ + hcfg = dwc2_readl(hsotg->regs + HCFG); + dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg); + diff --git a/target/linux/ramips/patches-4.4/0033-xhci-mediatek-support-MTK-xHCI-host-controller.patch b/target/linux/ramips/patches-4.4/0033-xhci-mediatek-support-MTK-xHCI-host-controller.patch new file mode 100644 index 0000000000..1bd29747b8 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0033-xhci-mediatek-support-MTK-xHCI-host-controller.patch @@ -0,0 +1,1517 @@ +From: Chunfeng Yun +Date: Tue, 24 Nov 2015 13:09:55 +0200 +Subject: [PATCH] xhci: mediatek: support MTK xHCI host controller + +There some vendor quirks for MTK xhci host controller: +1. It defines some extra SW scheduling parameters for HW + to minimize the scheduling effort for synchronous and + interrupt endpoints. The parameters are put into reseved + DWs of slot context and endpoint context. +2. Its IMODI unit for Interrupter Moderation register is + 8 times as much as that defined in xHCI spec. +3. Its TDS in Normal TRB defines a number of packets that + remains to be transferred for a TD after processing all + Max packets in all previous TRBs. + +Signed-off-by: Chunfeng Yun +Tested-by: Daniel Thompson +Reviewed-by: Daniel Thompson +Signed-off-by: Mathias Nyman +Signed-off-by: Greg Kroah-Hartman +--- + create mode 100644 drivers/usb/host/xhci-mtk-sch.c + create mode 100644 drivers/usb/host/xhci-mtk.c + create mode 100644 drivers/usb/host/xhci-mtk.h + +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -41,6 +41,15 @@ config USB_XHCI_PLATFORM + + If unsure, say N. + ++config USB_XHCI_MTK ++ tristate "xHCI support for Mediatek MT65xx" ++ select MFD_SYSCON ++ depends on ARCH_MEDIATEK || COMPILE_TEST ++ ---help--- ++ Say 'Y' to enable the support for the xHCI host controller ++ found in Mediatek MT65xx SoCs. ++ If unsure, say N. ++ + config USB_XHCI_MVEBU + tristate "xHCI support for Marvell Armada 375/38x" + select USB_XHCI_PLATFORM +--- a/drivers/usb/host/Makefile ++++ b/drivers/usb/host/Makefile +@@ -13,6 +13,9 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o + xhci-hcd-y := xhci.o xhci-mem.o + xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o + xhci-hcd-y += xhci-trace.o ++ifneq ($(CONFIG_USB_XHCI_MTK), ) ++ xhci-hcd-y += xhci-mtk-sch.o ++endif + + xhci-plat-hcd-y := xhci-plat.o + ifneq ($(CONFIG_USB_XHCI_MVEBU), ) +@@ -64,6 +67,7 @@ obj-$(CONFIG_USB_FHCI_HCD) += fhci.o + obj-$(CONFIG_USB_XHCI_HCD) += xhci-hcd.o + obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o + obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o ++obj-$(CONFIG_USB_XHCI_MTK) += xhci-mtk.o + obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o + obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o + obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o +--- /dev/null ++++ b/drivers/usb/host/xhci-mtk-sch.c +@@ -0,0 +1,415 @@ ++/* ++ * Copyright (c) 2015 MediaTek Inc. ++ * Author: ++ * Zhigang.Wei ++ * Chunfeng.Yun ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * 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. ++ * ++ */ ++ ++#include ++#include ++#include ++ ++#include "xhci.h" ++#include "xhci-mtk.h" ++ ++#define SS_BW_BOUNDARY 51000 ++/* table 5-5. High-speed Isoc Transaction Limits in usb_20 spec */ ++#define HS_BW_BOUNDARY 6144 ++/* usb2 spec section11.18.1: at most 188 FS bytes per microframe */ ++#define FS_PAYLOAD_MAX 188 ++ ++/* mtk scheduler bitmasks */ ++#define EP_BPKTS(p) ((p) & 0x3f) ++#define EP_BCSCOUNT(p) (((p) & 0x7) << 8) ++#define EP_BBM(p) ((p) << 11) ++#define EP_BOFFSET(p) ((p) & 0x3fff) ++#define EP_BREPEAT(p) (((p) & 0x7fff) << 16) ++ ++static int is_fs_or_ls(enum usb_device_speed speed) ++{ ++ return speed == USB_SPEED_FULL || speed == USB_SPEED_LOW; ++} ++ ++/* ++* get the index of bandwidth domains array which @ep belongs to. ++* ++* the bandwidth domain array is saved to @sch_array of struct xhci_hcd_mtk, ++* each HS root port is treated as a single bandwidth domain, ++* but each SS root port is treated as two bandwidth domains, one for IN eps, ++* one for OUT eps. ++* @real_port value is defined as follow according to xHCI spec: ++* 1 for SSport0, ..., N+1 for SSportN, N+2 for HSport0, N+3 for HSport1, etc ++* so the bandwidth domain array is organized as follow for simplification: ++* SSport0-OUT, SSport0-IN, ..., SSportX-OUT, SSportX-IN, HSport0, ..., HSportY ++*/ ++static int get_bw_index(struct xhci_hcd *xhci, struct usb_device *udev, ++ struct usb_host_endpoint *ep) ++{ ++ struct xhci_virt_device *virt_dev; ++ int bw_index; ++ ++ virt_dev = xhci->devs[udev->slot_id]; ++ ++ if (udev->speed == USB_SPEED_SUPER) { ++ if (usb_endpoint_dir_out(&ep->desc)) ++ bw_index = (virt_dev->real_port - 1) * 2; ++ else ++ bw_index = (virt_dev->real_port - 1) * 2 + 1; ++ } else { ++ /* add one more for each SS port */ ++ bw_index = virt_dev->real_port + xhci->num_usb3_ports - 1; ++ } ++ ++ return bw_index; ++} ++ ++static void setup_sch_info(struct usb_device *udev, ++ struct xhci_ep_ctx *ep_ctx, struct mu3h_sch_ep_info *sch_ep) ++{ ++ u32 ep_type; ++ u32 ep_interval; ++ u32 max_packet_size; ++ u32 max_burst; ++ u32 mult; ++ u32 esit_pkts; ++ ++ ep_type = CTX_TO_EP_TYPE(le32_to_cpu(ep_ctx->ep_info2)); ++ ep_interval = CTX_TO_EP_INTERVAL(le32_to_cpu(ep_ctx->ep_info)); ++ max_packet_size = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx->ep_info2)); ++ max_burst = CTX_TO_MAX_BURST(le32_to_cpu(ep_ctx->ep_info2)); ++ mult = CTX_TO_EP_MULT(le32_to_cpu(ep_ctx->ep_info)); ++ ++ sch_ep->esit = 1 << ep_interval; ++ sch_ep->offset = 0; ++ sch_ep->burst_mode = 0; ++ ++ if (udev->speed == USB_SPEED_HIGH) { ++ sch_ep->cs_count = 0; ++ ++ /* ++ * usb_20 spec section5.9 ++ * a single microframe is enough for HS synchromous endpoints ++ * in a interval ++ */ ++ sch_ep->num_budget_microframes = 1; ++ sch_ep->repeat = 0; ++ ++ /* ++ * xHCI spec section6.2.3.4 ++ * @max_burst is the number of additional transactions ++ * opportunities per microframe ++ */ ++ sch_ep->pkts = max_burst + 1; ++ sch_ep->bw_cost_per_microframe = max_packet_size * sch_ep->pkts; ++ } else if (udev->speed == USB_SPEED_SUPER) { ++ /* usb3_r1 spec section4.4.7 & 4.4.8 */ ++ sch_ep->cs_count = 0; ++ esit_pkts = (mult + 1) * (max_burst + 1); ++ if (ep_type == INT_IN_EP || ep_type == INT_OUT_EP) { ++ sch_ep->pkts = esit_pkts; ++ sch_ep->num_budget_microframes = 1; ++ sch_ep->repeat = 0; ++ } ++ ++ if (ep_type == ISOC_IN_EP || ep_type == ISOC_OUT_EP) { ++ if (esit_pkts <= sch_ep->esit) ++ sch_ep->pkts = 1; ++ else ++ sch_ep->pkts = roundup_pow_of_two(esit_pkts) ++ / sch_ep->esit; ++ ++ sch_ep->num_budget_microframes = ++ DIV_ROUND_UP(esit_pkts, sch_ep->pkts); ++ ++ if (sch_ep->num_budget_microframes > 1) ++ sch_ep->repeat = 1; ++ else ++ sch_ep->repeat = 0; ++ } ++ sch_ep->bw_cost_per_microframe = max_packet_size * sch_ep->pkts; ++ } else if (is_fs_or_ls(udev->speed)) { ++ ++ /* ++ * usb_20 spec section11.18.4 ++ * assume worst cases ++ */ ++ sch_ep->repeat = 0; ++ sch_ep->pkts = 1; /* at most one packet for each microframe */ ++ if (ep_type == INT_IN_EP || ep_type == INT_OUT_EP) { ++ sch_ep->cs_count = 3; /* at most need 3 CS*/ ++ /* one for SS and one for budgeted transaction */ ++ sch_ep->num_budget_microframes = sch_ep->cs_count + 2; ++ sch_ep->bw_cost_per_microframe = max_packet_size; ++ } ++ if (ep_type == ISOC_OUT_EP) { ++ ++ /* ++ * the best case FS budget assumes that 188 FS bytes ++ * occur in each microframe ++ */ ++ sch_ep->num_budget_microframes = DIV_ROUND_UP( ++ max_packet_size, FS_PAYLOAD_MAX); ++ sch_ep->bw_cost_per_microframe = FS_PAYLOAD_MAX; ++ sch_ep->cs_count = sch_ep->num_budget_microframes; ++ } ++ if (ep_type == ISOC_IN_EP) { ++ /* at most need additional two CS. */ ++ sch_ep->cs_count = DIV_ROUND_UP( ++ max_packet_size, FS_PAYLOAD_MAX) + 2; ++ sch_ep->num_budget_microframes = sch_ep->cs_count + 2; ++ sch_ep->bw_cost_per_microframe = FS_PAYLOAD_MAX; ++ } ++ } ++} ++ ++/* Get maximum bandwidth when we schedule at offset slot. */ ++static u32 get_max_bw(struct mu3h_sch_bw_info *sch_bw, ++ struct mu3h_sch_ep_info *sch_ep, u32 offset) ++{ ++ u32 num_esit; ++ u32 max_bw = 0; ++ int i; ++ int j; ++ ++ num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit; ++ for (i = 0; i < num_esit; i++) { ++ u32 base = offset + i * sch_ep->esit; ++ ++ for (j = 0; j < sch_ep->num_budget_microframes; j++) { ++ if (sch_bw->bus_bw[base + j] > max_bw) ++ max_bw = sch_bw->bus_bw[base + j]; ++ } ++ } ++ return max_bw; ++} ++ ++static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw, ++ struct mu3h_sch_ep_info *sch_ep, int bw_cost) ++{ ++ u32 num_esit; ++ u32 base; ++ int i; ++ int j; ++ ++ num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit; ++ for (i = 0; i < num_esit; i++) { ++ base = sch_ep->offset + i * sch_ep->esit; ++ for (j = 0; j < sch_ep->num_budget_microframes; j++) ++ sch_bw->bus_bw[base + j] += bw_cost; ++ } ++} ++ ++static int check_sch_bw(struct usb_device *udev, ++ struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) ++{ ++ u32 offset; ++ u32 esit; ++ u32 num_budget_microframes; ++ u32 min_bw; ++ u32 min_index; ++ u32 worst_bw; ++ u32 bw_boundary; ++ ++ if (sch_ep->esit > XHCI_MTK_MAX_ESIT) ++ sch_ep->esit = XHCI_MTK_MAX_ESIT; ++ ++ esit = sch_ep->esit; ++ num_budget_microframes = sch_ep->num_budget_microframes; ++ ++ /* ++ * Search through all possible schedule microframes. ++ * and find a microframe where its worst bandwidth is minimum. ++ */ ++ min_bw = ~0; ++ min_index = 0; ++ for (offset = 0; offset < esit; offset++) { ++ if ((offset + num_budget_microframes) > sch_ep->esit) ++ break; ++ ++ /* ++ * usb_20 spec section11.18: ++ * must never schedule Start-Split in Y6 ++ */ ++ if (is_fs_or_ls(udev->speed) && (offset % 8 == 6)) ++ continue; ++ ++ worst_bw = get_max_bw(sch_bw, sch_ep, offset); ++ if (min_bw > worst_bw) { ++ min_bw = worst_bw; ++ min_index = offset; ++ } ++ if (min_bw == 0) ++ break; ++ } ++ sch_ep->offset = min_index; ++ ++ bw_boundary = (udev->speed == USB_SPEED_SUPER) ++ ? SS_BW_BOUNDARY : HS_BW_BOUNDARY; ++ ++ /* check bandwidth */ ++ if (min_bw + sch_ep->bw_cost_per_microframe > bw_boundary) ++ return -ERANGE; ++ ++ /* update bus bandwidth info */ ++ update_bus_bw(sch_bw, sch_ep, sch_ep->bw_cost_per_microframe); ++ ++ return 0; ++} ++ ++static bool need_bw_sch(struct usb_host_endpoint *ep, ++ enum usb_device_speed speed, int has_tt) ++{ ++ /* only for periodic endpoints */ ++ if (usb_endpoint_xfer_control(&ep->desc) ++ || usb_endpoint_xfer_bulk(&ep->desc)) ++ return false; ++ ++ /* ++ * for LS & FS periodic endpoints which its device don't attach ++ * to TT are also ignored, root-hub will schedule them directly ++ */ ++ if (is_fs_or_ls(speed) && !has_tt) ++ return false; ++ ++ return true; ++} ++ ++int xhci_mtk_sch_init(struct xhci_hcd_mtk *mtk) ++{ ++ struct mu3h_sch_bw_info *sch_array; ++ int num_usb_bus; ++ int i; ++ ++ /* ss IN and OUT are separated */ ++ num_usb_bus = mtk->num_u3_ports * 2 + mtk->num_u2_ports; ++ ++ sch_array = kcalloc(num_usb_bus, sizeof(*sch_array), GFP_KERNEL); ++ if (sch_array == NULL) ++ return -ENOMEM; ++ ++ for (i = 0; i < num_usb_bus; i++) ++ INIT_LIST_HEAD(&sch_array[i].bw_ep_list); ++ ++ mtk->sch_array = sch_array; ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(xhci_mtk_sch_init); ++ ++void xhci_mtk_sch_exit(struct xhci_hcd_mtk *mtk) ++{ ++ kfree(mtk->sch_array); ++} ++EXPORT_SYMBOL_GPL(xhci_mtk_sch_exit); ++ ++int xhci_mtk_add_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev, ++ struct usb_host_endpoint *ep) ++{ ++ struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd); ++ struct xhci_hcd *xhci; ++ struct xhci_ep_ctx *ep_ctx; ++ struct xhci_slot_ctx *slot_ctx; ++ struct xhci_virt_device *virt_dev; ++ struct mu3h_sch_bw_info *sch_bw; ++ struct mu3h_sch_ep_info *sch_ep; ++ struct mu3h_sch_bw_info *sch_array; ++ unsigned int ep_index; ++ int bw_index; ++ int ret = 0; ++ ++ xhci = hcd_to_xhci(hcd); ++ virt_dev = xhci->devs[udev->slot_id]; ++ ep_index = xhci_get_endpoint_index(&ep->desc); ++ slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx); ++ ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); ++ sch_array = mtk->sch_array; ++ ++ xhci_dbg(xhci, "%s() type:%d, speed:%d, mpkt:%d, dir:%d, ep:%p\n", ++ __func__, usb_endpoint_type(&ep->desc), udev->speed, ++ GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc)), ++ usb_endpoint_dir_in(&ep->desc), ep); ++ ++ if (!need_bw_sch(ep, udev->speed, slot_ctx->tt_info & TT_SLOT)) ++ return 0; ++ ++ bw_index = get_bw_index(xhci, udev, ep); ++ sch_bw = &sch_array[bw_index]; ++ ++ sch_ep = kzalloc(sizeof(struct mu3h_sch_ep_info), GFP_NOIO); ++ if (!sch_ep) ++ return -ENOMEM; ++ ++ setup_sch_info(udev, ep_ctx, sch_ep); ++ ++ ret = check_sch_bw(udev, sch_bw, sch_ep); ++ if (ret) { ++ xhci_err(xhci, "Not enough bandwidth!\n"); ++ kfree(sch_ep); ++ return -ENOSPC; ++ } ++ ++ list_add_tail(&sch_ep->endpoint, &sch_bw->bw_ep_list); ++ sch_ep->ep = ep; ++ ++ ep_ctx->reserved[0] |= cpu_to_le32(EP_BPKTS(sch_ep->pkts) ++ | EP_BCSCOUNT(sch_ep->cs_count) | EP_BBM(sch_ep->burst_mode)); ++ ep_ctx->reserved[1] |= cpu_to_le32(EP_BOFFSET(sch_ep->offset) ++ | EP_BREPEAT(sch_ep->repeat)); ++ ++ xhci_dbg(xhci, " PKTS:%x, CSCOUNT:%x, BM:%x, OFFSET:%x, REPEAT:%x\n", ++ sch_ep->pkts, sch_ep->cs_count, sch_ep->burst_mode, ++ sch_ep->offset, sch_ep->repeat); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(xhci_mtk_add_ep_quirk); ++ ++void xhci_mtk_drop_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev, ++ struct usb_host_endpoint *ep) ++{ ++ struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd); ++ struct xhci_hcd *xhci; ++ struct xhci_slot_ctx *slot_ctx; ++ struct xhci_virt_device *virt_dev; ++ struct mu3h_sch_bw_info *sch_array; ++ struct mu3h_sch_bw_info *sch_bw; ++ struct mu3h_sch_ep_info *sch_ep; ++ int bw_index; ++ ++ xhci = hcd_to_xhci(hcd); ++ virt_dev = xhci->devs[udev->slot_id]; ++ slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx); ++ sch_array = mtk->sch_array; ++ ++ xhci_dbg(xhci, "%s() type:%d, speed:%d, mpks:%d, dir:%d, ep:%p\n", ++ __func__, usb_endpoint_type(&ep->desc), udev->speed, ++ GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc)), ++ usb_endpoint_dir_in(&ep->desc), ep); ++ ++ if (!need_bw_sch(ep, udev->speed, slot_ctx->tt_info & TT_SLOT)) ++ return; ++ ++ bw_index = get_bw_index(xhci, udev, ep); ++ sch_bw = &sch_array[bw_index]; ++ ++ list_for_each_entry(sch_ep, &sch_bw->bw_ep_list, endpoint) { ++ if (sch_ep->ep == ep) { ++ update_bus_bw(sch_bw, sch_ep, ++ -sch_ep->bw_cost_per_microframe); ++ list_del(&sch_ep->endpoint); ++ kfree(sch_ep); ++ break; ++ } ++ } ++} ++EXPORT_SYMBOL_GPL(xhci_mtk_drop_ep_quirk); +--- /dev/null ++++ b/drivers/usb/host/xhci-mtk.c +@@ -0,0 +1,763 @@ ++/* ++ * MediaTek xHCI Host Controller Driver ++ * ++ * Copyright (c) 2015 MediaTek Inc. ++ * Author: ++ * Chunfeng Yun ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * 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. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "xhci.h" ++#include "xhci-mtk.h" ++ ++/* ip_pw_ctrl0 register */ ++#define CTRL0_IP_SW_RST BIT(0) ++ ++/* ip_pw_ctrl1 register */ ++#define CTRL1_IP_HOST_PDN BIT(0) ++ ++/* ip_pw_ctrl2 register */ ++#define CTRL2_IP_DEV_PDN BIT(0) ++ ++/* ip_pw_sts1 register */ ++#define STS1_IP_SLEEP_STS BIT(30) ++#define STS1_XHCI_RST BIT(11) ++#define STS1_SYS125_RST BIT(10) ++#define STS1_REF_RST BIT(8) ++#define STS1_SYSPLL_STABLE BIT(0) ++ ++/* ip_xhci_cap register */ ++#define CAP_U3_PORT_NUM(p) ((p) & 0xff) ++#define CAP_U2_PORT_NUM(p) (((p) >> 8) & 0xff) ++ ++/* u3_ctrl_p register */ ++#define CTRL_U3_PORT_HOST_SEL BIT(2) ++#define CTRL_U3_PORT_PDN BIT(1) ++#define CTRL_U3_PORT_DIS BIT(0) ++ ++/* u2_ctrl_p register */ ++#define CTRL_U2_PORT_HOST_SEL BIT(2) ++#define CTRL_U2_PORT_PDN BIT(1) ++#define CTRL_U2_PORT_DIS BIT(0) ++ ++/* u2_phy_pll register */ ++#define CTRL_U2_FORCE_PLL_STB BIT(28) ++ ++#define PERI_WK_CTRL0 0x400 ++#define UWK_CTR0_0P_LS_PE BIT(8) /* posedge */ ++#define UWK_CTR0_0P_LS_NE BIT(7) /* negedge for 0p linestate*/ ++#define UWK_CTL1_1P_LS_C(x) (((x) & 0xf) << 1) ++#define UWK_CTL1_1P_LS_E BIT(0) ++ ++#define PERI_WK_CTRL1 0x404 ++#define UWK_CTL1_IS_C(x) (((x) & 0xf) << 26) ++#define UWK_CTL1_IS_E BIT(25) ++#define UWK_CTL1_0P_LS_C(x) (((x) & 0xf) << 21) ++#define UWK_CTL1_0P_LS_E BIT(20) ++#define UWK_CTL1_IDDIG_C(x) (((x) & 0xf) << 11) /* cycle debounce */ ++#define UWK_CTL1_IDDIG_E BIT(10) /* enable debounce */ ++#define UWK_CTL1_IDDIG_P BIT(9) /* polarity */ ++#define UWK_CTL1_0P_LS_P BIT(7) ++#define UWK_CTL1_IS_P BIT(6) /* polarity for ip sleep */ ++ ++enum ssusb_wakeup_src { ++ SSUSB_WK_IP_SLEEP = 1, ++ SSUSB_WK_LINE_STATE = 2, ++}; ++ ++static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk) ++{ ++ struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs; ++ u32 value, check_val; ++ int ret; ++ int i; ++ ++ /* power on host ip */ ++ value = readl(&ippc->ip_pw_ctr1); ++ value &= ~CTRL1_IP_HOST_PDN; ++ writel(value, &ippc->ip_pw_ctr1); ++ ++ /* power on and enable all u3 ports */ ++ for (i = 0; i < mtk->num_u3_ports; i++) { ++ value = readl(&ippc->u3_ctrl_p[i]); ++ value &= ~(CTRL_U3_PORT_PDN | CTRL_U3_PORT_DIS); ++ value |= CTRL_U3_PORT_HOST_SEL; ++ writel(value, &ippc->u3_ctrl_p[i]); ++ } ++ ++ /* power on and enable all u2 ports */ ++ for (i = 0; i < mtk->num_u2_ports; i++) { ++ value = readl(&ippc->u2_ctrl_p[i]); ++ value &= ~(CTRL_U2_PORT_PDN | CTRL_U2_PORT_DIS); ++ value |= CTRL_U2_PORT_HOST_SEL; ++ writel(value, &ippc->u2_ctrl_p[i]); ++ } ++ ++ /* ++ * wait for clocks to be stable, and clock domains reset to ++ * be inactive after power on and enable ports ++ */ ++ check_val = STS1_SYSPLL_STABLE | STS1_REF_RST | ++ STS1_SYS125_RST | STS1_XHCI_RST; ++ ++ ret = readl_poll_timeout(&ippc->ip_pw_sts1, value, ++ (check_val == (value & check_val)), 100, 20000); ++ if (ret) { ++ dev_err(mtk->dev, "clocks are not stable (0x%x)\n", value); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int xhci_mtk_host_disable(struct xhci_hcd_mtk *mtk) ++{ ++ struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs; ++ u32 value; ++ int ret; ++ int i; ++ ++ /* power down all u3 ports */ ++ for (i = 0; i < mtk->num_u3_ports; i++) { ++ value = readl(&ippc->u3_ctrl_p[i]); ++ value |= CTRL_U3_PORT_PDN; ++ writel(value, &ippc->u3_ctrl_p[i]); ++ } ++ ++ /* power down all u2 ports */ ++ for (i = 0; i < mtk->num_u2_ports; i++) { ++ value = readl(&ippc->u2_ctrl_p[i]); ++ value |= CTRL_U2_PORT_PDN; ++ writel(value, &ippc->u2_ctrl_p[i]); ++ } ++ ++ /* power down host ip */ ++ value = readl(&ippc->ip_pw_ctr1); ++ value |= CTRL1_IP_HOST_PDN; ++ writel(value, &ippc->ip_pw_ctr1); ++ ++ /* wait for host ip to sleep */ ++ ret = readl_poll_timeout(&ippc->ip_pw_sts1, value, ++ (value & STS1_IP_SLEEP_STS), 100, 100000); ++ if (ret) { ++ dev_err(mtk->dev, "ip sleep failed!!!\n"); ++ return ret; ++ } ++ return 0; ++} ++ ++static int xhci_mtk_ssusb_config(struct xhci_hcd_mtk *mtk) ++{ ++ struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs; ++ u32 value; ++ ++ /* reset whole ip */ ++ value = readl(&ippc->ip_pw_ctr0); ++ value |= CTRL0_IP_SW_RST; ++ writel(value, &ippc->ip_pw_ctr0); ++ udelay(1); ++ value = readl(&ippc->ip_pw_ctr0); ++ value &= ~CTRL0_IP_SW_RST; ++ writel(value, &ippc->ip_pw_ctr0); ++ ++ /* ++ * device ip is default power-on in fact ++ * power down device ip, otherwise ip-sleep will fail ++ */ ++ value = readl(&ippc->ip_pw_ctr2); ++ value |= CTRL2_IP_DEV_PDN; ++ writel(value, &ippc->ip_pw_ctr2); ++ ++ value = readl(&ippc->ip_xhci_cap); ++ mtk->num_u3_ports = CAP_U3_PORT_NUM(value); ++ mtk->num_u2_ports = CAP_U2_PORT_NUM(value); ++ dev_dbg(mtk->dev, "%s u2p:%d, u3p:%d\n", __func__, ++ mtk->num_u2_ports, mtk->num_u3_ports); ++ ++ return xhci_mtk_host_enable(mtk); ++} ++ ++static int xhci_mtk_clks_enable(struct xhci_hcd_mtk *mtk) ++{ ++ int ret; ++ ++ ret = clk_prepare_enable(mtk->sys_clk); ++ if (ret) { ++ dev_err(mtk->dev, "failed to enable sys_clk\n"); ++ goto sys_clk_err; ++ } ++ ++ if (mtk->wakeup_src) { ++ ret = clk_prepare_enable(mtk->wk_deb_p0); ++ if (ret) { ++ dev_err(mtk->dev, "failed to enable wk_deb_p0\n"); ++ goto usb_p0_err; ++ } ++ ++ ret = clk_prepare_enable(mtk->wk_deb_p1); ++ if (ret) { ++ dev_err(mtk->dev, "failed to enable wk_deb_p1\n"); ++ goto usb_p1_err; ++ } ++ } ++ return 0; ++ ++usb_p1_err: ++ clk_disable_unprepare(mtk->wk_deb_p0); ++usb_p0_err: ++ clk_disable_unprepare(mtk->sys_clk); ++sys_clk_err: ++ return -EINVAL; ++} ++ ++static void xhci_mtk_clks_disable(struct xhci_hcd_mtk *mtk) ++{ ++ if (mtk->wakeup_src) { ++ clk_disable_unprepare(mtk->wk_deb_p1); ++ clk_disable_unprepare(mtk->wk_deb_p0); ++ } ++ clk_disable_unprepare(mtk->sys_clk); ++} ++ ++/* only clocks can be turn off for ip-sleep wakeup mode */ ++static void usb_wakeup_ip_sleep_en(struct xhci_hcd_mtk *mtk) ++{ ++ u32 tmp; ++ struct regmap *pericfg = mtk->pericfg; ++ ++ regmap_read(pericfg, PERI_WK_CTRL1, &tmp); ++ tmp &= ~UWK_CTL1_IS_P; ++ tmp &= ~(UWK_CTL1_IS_C(0xf)); ++ tmp |= UWK_CTL1_IS_C(0x8); ++ regmap_write(pericfg, PERI_WK_CTRL1, tmp); ++ regmap_write(pericfg, PERI_WK_CTRL1, tmp | UWK_CTL1_IS_E); ++ ++ regmap_read(pericfg, PERI_WK_CTRL1, &tmp); ++ dev_dbg(mtk->dev, "%s(): WK_CTRL1[P6,E25,C26:29]=%#x\n", ++ __func__, tmp); ++} ++ ++static void usb_wakeup_ip_sleep_dis(struct xhci_hcd_mtk *mtk) ++{ ++ u32 tmp; ++ ++ regmap_read(mtk->pericfg, PERI_WK_CTRL1, &tmp); ++ tmp &= ~UWK_CTL1_IS_E; ++ regmap_write(mtk->pericfg, PERI_WK_CTRL1, tmp); ++} ++ ++/* ++* for line-state wakeup mode, phy's power should not power-down ++* and only support cable plug in/out ++*/ ++static void usb_wakeup_line_state_en(struct xhci_hcd_mtk *mtk) ++{ ++ u32 tmp; ++ struct regmap *pericfg = mtk->pericfg; ++ ++ /* line-state of u2-port0 */ ++ regmap_read(pericfg, PERI_WK_CTRL1, &tmp); ++ tmp &= ~UWK_CTL1_0P_LS_P; ++ tmp &= ~(UWK_CTL1_0P_LS_C(0xf)); ++ tmp |= UWK_CTL1_0P_LS_C(0x8); ++ regmap_write(pericfg, PERI_WK_CTRL1, tmp); ++ regmap_read(pericfg, PERI_WK_CTRL1, &tmp); ++ regmap_write(pericfg, PERI_WK_CTRL1, tmp | UWK_CTL1_0P_LS_E); ++ ++ /* line-state of u2-port1 */ ++ regmap_read(pericfg, PERI_WK_CTRL0, &tmp); ++ tmp &= ~(UWK_CTL1_1P_LS_C(0xf)); ++ tmp |= UWK_CTL1_1P_LS_C(0x8); ++ regmap_write(pericfg, PERI_WK_CTRL0, tmp); ++ regmap_write(pericfg, PERI_WK_CTRL0, tmp | UWK_CTL1_1P_LS_E); ++} ++ ++static void usb_wakeup_line_state_dis(struct xhci_hcd_mtk *mtk) ++{ ++ u32 tmp; ++ struct regmap *pericfg = mtk->pericfg; ++ ++ /* line-state of u2-port0 */ ++ regmap_read(pericfg, PERI_WK_CTRL1, &tmp); ++ tmp &= ~UWK_CTL1_0P_LS_E; ++ regmap_write(pericfg, PERI_WK_CTRL1, tmp); ++ ++ /* line-state of u2-port1 */ ++ regmap_read(pericfg, PERI_WK_CTRL0, &tmp); ++ tmp &= ~UWK_CTL1_1P_LS_E; ++ regmap_write(pericfg, PERI_WK_CTRL0, tmp); ++} ++ ++static void usb_wakeup_enable(struct xhci_hcd_mtk *mtk) ++{ ++ if (mtk->wakeup_src == SSUSB_WK_IP_SLEEP) ++ usb_wakeup_ip_sleep_en(mtk); ++ else if (mtk->wakeup_src == SSUSB_WK_LINE_STATE) ++ usb_wakeup_line_state_en(mtk); ++} ++ ++static void usb_wakeup_disable(struct xhci_hcd_mtk *mtk) ++{ ++ if (mtk->wakeup_src == SSUSB_WK_IP_SLEEP) ++ usb_wakeup_ip_sleep_dis(mtk); ++ else if (mtk->wakeup_src == SSUSB_WK_LINE_STATE) ++ usb_wakeup_line_state_dis(mtk); ++} ++ ++static int usb_wakeup_of_property_parse(struct xhci_hcd_mtk *mtk, ++ struct device_node *dn) ++{ ++ struct device *dev = mtk->dev; ++ ++ /* ++ * wakeup function is optional, so it is not an error if this property ++ * does not exist, and in such case, no need to get relative ++ * properties anymore. ++ */ ++ of_property_read_u32(dn, "mediatek,wakeup-src", &mtk->wakeup_src); ++ if (!mtk->wakeup_src) ++ return 0; ++ ++ mtk->wk_deb_p0 = devm_clk_get(dev, "wakeup_deb_p0"); ++ if (IS_ERR(mtk->wk_deb_p0)) { ++ dev_err(dev, "fail to get wakeup_deb_p0\n"); ++ return PTR_ERR(mtk->wk_deb_p0); ++ } ++ ++ mtk->wk_deb_p1 = devm_clk_get(dev, "wakeup_deb_p1"); ++ if (IS_ERR(mtk->wk_deb_p1)) { ++ dev_err(dev, "fail to get wakeup_deb_p1\n"); ++ return PTR_ERR(mtk->wk_deb_p1); ++ } ++ ++ mtk->pericfg = syscon_regmap_lookup_by_phandle(dn, ++ "mediatek,syscon-wakeup"); ++ if (IS_ERR(mtk->pericfg)) { ++ dev_err(dev, "fail to get pericfg regs\n"); ++ return PTR_ERR(mtk->pericfg); ++ } ++ ++ return 0; ++} ++ ++static int xhci_mtk_setup(struct usb_hcd *hcd); ++static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = { ++ .extra_priv_size = sizeof(struct xhci_hcd), ++ .reset = xhci_mtk_setup, ++}; ++ ++static struct hc_driver __read_mostly xhci_mtk_hc_driver; ++ ++static int xhci_mtk_phy_init(struct xhci_hcd_mtk *mtk) ++{ ++ int i; ++ int ret; ++ ++ for (i = 0; i < mtk->num_phys; i++) { ++ ret = phy_init(mtk->phys[i]); ++ if (ret) ++ goto exit_phy; ++ } ++ return 0; ++ ++exit_phy: ++ for (; i > 0; i--) ++ phy_exit(mtk->phys[i - 1]); ++ ++ return ret; ++} ++ ++static int xhci_mtk_phy_exit(struct xhci_hcd_mtk *mtk) ++{ ++ int i; ++ ++ for (i = 0; i < mtk->num_phys; i++) ++ phy_exit(mtk->phys[i]); ++ ++ return 0; ++} ++ ++static int xhci_mtk_phy_power_on(struct xhci_hcd_mtk *mtk) ++{ ++ int i; ++ int ret; ++ ++ for (i = 0; i < mtk->num_phys; i++) { ++ ret = phy_power_on(mtk->phys[i]); ++ if (ret) ++ goto power_off_phy; ++ } ++ return 0; ++ ++power_off_phy: ++ for (; i > 0; i--) ++ phy_power_off(mtk->phys[i - 1]); ++ ++ return ret; ++} ++ ++static void xhci_mtk_phy_power_off(struct xhci_hcd_mtk *mtk) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < mtk->num_phys; i++) ++ phy_power_off(mtk->phys[i]); ++} ++ ++static int xhci_mtk_ldos_enable(struct xhci_hcd_mtk *mtk) ++{ ++ int ret; ++ ++ ret = regulator_enable(mtk->vbus); ++ if (ret) { ++ dev_err(mtk->dev, "failed to enable vbus\n"); ++ return ret; ++ } ++ ++ ret = regulator_enable(mtk->vusb33); ++ if (ret) { ++ dev_err(mtk->dev, "failed to enable vusb33\n"); ++ regulator_disable(mtk->vbus); ++ return ret; ++ } ++ return 0; ++} ++ ++static void xhci_mtk_ldos_disable(struct xhci_hcd_mtk *mtk) ++{ ++ regulator_disable(mtk->vbus); ++ regulator_disable(mtk->vusb33); ++} ++ ++static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) ++{ ++ struct usb_hcd *hcd = xhci_to_hcd(xhci); ++ struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd); ++ ++ /* ++ * As of now platform drivers don't provide MSI support so we ensure ++ * here that the generic code does not try to make a pci_dev from our ++ * dev struct in order to setup MSI ++ */ ++ xhci->quirks |= XHCI_PLAT; ++ xhci->quirks |= XHCI_MTK_HOST; ++ /* ++ * MTK host controller gives a spurious successful event after a ++ * short transfer. Ignore it. ++ */ ++ xhci->quirks |= XHCI_SPURIOUS_SUCCESS; ++ if (mtk->lpm_support) ++ xhci->quirks |= XHCI_LPM_SUPPORT; ++} ++ ++/* called during probe() after chip reset completes */ ++static int xhci_mtk_setup(struct usb_hcd *hcd) ++{ ++ struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd); ++ int ret; ++ ++ if (usb_hcd_is_primary_hcd(hcd)) { ++ ret = xhci_mtk_ssusb_config(mtk); ++ if (ret) ++ return ret; ++ ret = xhci_mtk_sch_init(mtk); ++ if (ret) ++ return ret; ++ } ++ ++ return xhci_gen_setup(hcd, xhci_mtk_quirks); ++} ++ ++static int xhci_mtk_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *node = dev->of_node; ++ struct xhci_hcd_mtk *mtk; ++ const struct hc_driver *driver; ++ struct xhci_hcd *xhci; ++ struct resource *res; ++ struct usb_hcd *hcd; ++ struct phy *phy; ++ int phy_num; ++ int ret = -ENODEV; ++ int irq; ++ ++ if (usb_disabled()) ++ return -ENODEV; ++ ++ driver = &xhci_mtk_hc_driver; ++ mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); ++ if (!mtk) ++ return -ENOMEM; ++ ++ mtk->dev = dev; ++ mtk->vbus = devm_regulator_get(dev, "vbus"); ++ if (IS_ERR(mtk->vbus)) { ++ dev_err(dev, "fail to get vbus\n"); ++ return PTR_ERR(mtk->vbus); ++ } ++ ++ mtk->vusb33 = devm_regulator_get(dev, "vusb33"); ++ if (IS_ERR(mtk->vusb33)) { ++ dev_err(dev, "fail to get vusb33\n"); ++ return PTR_ERR(mtk->vusb33); ++ } ++ ++ mtk->sys_clk = devm_clk_get(dev, "sys_ck"); ++ if (IS_ERR(mtk->sys_clk)) { ++ dev_err(dev, "fail to get sys_ck\n"); ++ return PTR_ERR(mtk->sys_clk); ++ } ++ ++ mtk->lpm_support = of_property_read_bool(node, "usb3-lpm-capable"); ++ ++ ret = usb_wakeup_of_property_parse(mtk, node); ++ if (ret) ++ return ret; ++ ++ mtk->num_phys = of_count_phandle_with_args(node, ++ "phys", "#phy-cells"); ++ if (mtk->num_phys > 0) { ++ mtk->phys = devm_kcalloc(dev, mtk->num_phys, ++ sizeof(*mtk->phys), GFP_KERNEL); ++ if (!mtk->phys) ++ return -ENOMEM; ++ } else { ++ mtk->num_phys = 0; ++ } ++ pm_runtime_enable(dev); ++ pm_runtime_get_sync(dev); ++ device_enable_async_suspend(dev); ++ ++ ret = xhci_mtk_ldos_enable(mtk); ++ if (ret) ++ goto disable_pm; ++ ++ ret = xhci_mtk_clks_enable(mtk); ++ if (ret) ++ goto disable_ldos; ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) ++ goto disable_clk; ++ ++ /* Initialize dma_mask and coherent_dma_mask to 32-bits */ ++ ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); ++ if (ret) ++ goto disable_clk; ++ ++ if (!dev->dma_mask) ++ dev->dma_mask = &dev->coherent_dma_mask; ++ else ++ dma_set_mask(dev, DMA_BIT_MASK(32)); ++ ++ hcd = usb_create_hcd(driver, dev, dev_name(dev)); ++ if (!hcd) { ++ ret = -ENOMEM; ++ goto disable_clk; ++ } ++ ++ /* ++ * USB 2.0 roothub is stored in the platform_device. ++ * Swap it with mtk HCD. ++ */ ++ mtk->hcd = platform_get_drvdata(pdev); ++ platform_set_drvdata(pdev, mtk); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ hcd->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(hcd->regs)) { ++ ret = PTR_ERR(hcd->regs); ++ goto put_usb2_hcd; ++ } ++ hcd->rsrc_start = res->start; ++ hcd->rsrc_len = resource_size(res); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ mtk->ippc_regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(mtk->ippc_regs)) { ++ ret = PTR_ERR(mtk->ippc_regs); ++ goto put_usb2_hcd; ++ } ++ ++ for (phy_num = 0; phy_num < mtk->num_phys; phy_num++) { ++ phy = devm_of_phy_get_by_index(dev, node, phy_num); ++ if (IS_ERR(phy)) { ++ ret = PTR_ERR(phy); ++ goto put_usb2_hcd; ++ } ++ mtk->phys[phy_num] = phy; ++ } ++ ++ ret = xhci_mtk_phy_init(mtk); ++ if (ret) ++ goto put_usb2_hcd; ++ ++ ret = xhci_mtk_phy_power_on(mtk); ++ if (ret) ++ goto exit_phys; ++ ++ device_init_wakeup(dev, true); ++ ++ xhci = hcd_to_xhci(hcd); ++ xhci->main_hcd = hcd; ++ xhci->shared_hcd = usb_create_shared_hcd(driver, dev, ++ dev_name(dev), hcd); ++ if (!xhci->shared_hcd) { ++ ret = -ENOMEM; ++ goto power_off_phys; ++ } ++ ++ if (HCC_MAX_PSA(xhci->hcc_params) >= 4) ++ xhci->shared_hcd->can_do_streams = 1; ++ ++ ret = usb_add_hcd(hcd, irq, IRQF_SHARED); ++ if (ret) ++ goto put_usb3_hcd; ++ ++ ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); ++ if (ret) ++ goto dealloc_usb2_hcd; ++ ++ return 0; ++ ++dealloc_usb2_hcd: ++ usb_remove_hcd(hcd); ++ ++put_usb3_hcd: ++ xhci_mtk_sch_exit(mtk); ++ usb_put_hcd(xhci->shared_hcd); ++ ++power_off_phys: ++ xhci_mtk_phy_power_off(mtk); ++ device_init_wakeup(dev, false); ++ ++exit_phys: ++ xhci_mtk_phy_exit(mtk); ++ ++put_usb2_hcd: ++ usb_put_hcd(hcd); ++ ++disable_clk: ++ xhci_mtk_clks_disable(mtk); ++ ++disable_ldos: ++ xhci_mtk_ldos_disable(mtk); ++ ++disable_pm: ++ pm_runtime_put_sync(dev); ++ pm_runtime_disable(dev); ++ return ret; ++} ++ ++static int xhci_mtk_remove(struct platform_device *dev) ++{ ++ struct xhci_hcd_mtk *mtk = platform_get_drvdata(dev); ++ struct usb_hcd *hcd = mtk->hcd; ++ struct xhci_hcd *xhci = hcd_to_xhci(hcd); ++ ++ usb_remove_hcd(xhci->shared_hcd); ++ xhci_mtk_phy_power_off(mtk); ++ xhci_mtk_phy_exit(mtk); ++ device_init_wakeup(&dev->dev, false); ++ ++ usb_remove_hcd(hcd); ++ usb_put_hcd(xhci->shared_hcd); ++ usb_put_hcd(hcd); ++ xhci_mtk_sch_exit(mtk); ++ xhci_mtk_clks_disable(mtk); ++ xhci_mtk_ldos_disable(mtk); ++ pm_runtime_put_sync(&dev->dev); ++ pm_runtime_disable(&dev->dev); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM_SLEEP ++static int xhci_mtk_suspend(struct device *dev) ++{ ++ struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev); ++ ++ xhci_mtk_host_disable(mtk); ++ xhci_mtk_phy_power_off(mtk); ++ xhci_mtk_clks_disable(mtk); ++ usb_wakeup_enable(mtk); ++ return 0; ++} ++ ++static int xhci_mtk_resume(struct device *dev) ++{ ++ struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev); ++ ++ usb_wakeup_disable(mtk); ++ xhci_mtk_clks_enable(mtk); ++ xhci_mtk_phy_power_on(mtk); ++ xhci_mtk_host_enable(mtk); ++ return 0; ++} ++ ++static const struct dev_pm_ops xhci_mtk_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(xhci_mtk_suspend, xhci_mtk_resume) ++}; ++#define DEV_PM_OPS (&xhci_mtk_pm_ops) ++#else ++#define DEV_PM_OPS NULL ++#endif /* CONFIG_PM */ ++ ++#ifdef CONFIG_OF ++static const struct of_device_id mtk_xhci_of_match[] = { ++ { .compatible = "mediatek,mt8173-xhci"}, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, mtk_xhci_of_match); ++#endif ++ ++static struct platform_driver mtk_xhci_driver = { ++ .probe = xhci_mtk_probe, ++ .remove = xhci_mtk_remove, ++ .driver = { ++ .name = "xhci-mtk", ++ .pm = DEV_PM_OPS, ++ .of_match_table = of_match_ptr(mtk_xhci_of_match), ++ }, ++}; ++MODULE_ALIAS("platform:xhci-mtk"); ++ ++static int __init xhci_mtk_init(void) ++{ ++ xhci_init_driver(&xhci_mtk_hc_driver, &xhci_mtk_overrides); ++ return platform_driver_register(&mtk_xhci_driver); ++} ++module_init(xhci_mtk_init); ++ ++static void __exit xhci_mtk_exit(void) ++{ ++ platform_driver_unregister(&mtk_xhci_driver); ++} ++module_exit(xhci_mtk_exit); ++ ++MODULE_AUTHOR("Chunfeng Yun "); ++MODULE_DESCRIPTION("MediaTek xHCI Host Controller Driver"); ++MODULE_LICENSE("GPL v2"); +--- /dev/null ++++ b/drivers/usb/host/xhci-mtk.h +@@ -0,0 +1,162 @@ ++/* ++ * Copyright (c) 2015 MediaTek Inc. ++ * Author: ++ * Zhigang.Wei ++ * Chunfeng.Yun ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef _XHCI_MTK_H_ ++#define _XHCI_MTK_H_ ++ ++#include "xhci.h" ++ ++/** ++ * To simplify scheduler algorithm, set a upper limit for ESIT, ++ * if a synchromous ep's ESIT is larger than @XHCI_MTK_MAX_ESIT, ++ * round down to the limit value, that means allocating more ++ * bandwidth to it. ++ */ ++#define XHCI_MTK_MAX_ESIT 64 ++ ++/** ++ * struct mu3h_sch_bw_info: schedule information for bandwidth domain ++ * ++ * @bus_bw: array to keep track of bandwidth already used at each uframes ++ * @bw_ep_list: eps in the bandwidth domain ++ * ++ * treat a HS root port as a bandwidth domain, but treat a SS root port as ++ * two bandwidth domains, one for IN eps and another for OUT eps. ++ */ ++struct mu3h_sch_bw_info { ++ u32 bus_bw[XHCI_MTK_MAX_ESIT]; ++ struct list_head bw_ep_list; ++}; ++ ++/** ++ * struct mu3h_sch_ep_info: schedule information for endpoint ++ * ++ * @esit: unit is 125us, equal to 2 << Interval field in ep-context ++ * @num_budget_microframes: number of continuous uframes ++ * (@repeat==1) scheduled within the interval ++ * @bw_cost_per_microframe: bandwidth cost per microframe ++ * @endpoint: linked into bandwidth domain which it belongs to ++ * @ep: address of usb_host_endpoint struct ++ * @offset: which uframe of the interval that transfer should be ++ * scheduled first time within the interval ++ * @repeat: the time gap between two uframes that transfers are ++ * scheduled within a interval. in the simple algorithm, only ++ * assign 0 or 1 to it; 0 means using only one uframe in a ++ * interval, and 1 means using @num_budget_microframes ++ * continuous uframes ++ * @pkts: number of packets to be transferred in the scheduled uframes ++ * @cs_count: number of CS that host will trigger ++ * @burst_mode: burst mode for scheduling. 0: normal burst mode, ++ * distribute the bMaxBurst+1 packets for a single burst ++ * according to @pkts and @repeat, repeate the burst multiple ++ * times; 1: distribute the (bMaxBurst+1)*(Mult+1) packets ++ * according to @pkts and @repeat. normal mode is used by ++ * default ++ */ ++struct mu3h_sch_ep_info { ++ u32 esit; ++ u32 num_budget_microframes; ++ u32 bw_cost_per_microframe; ++ struct list_head endpoint; ++ void *ep; ++ /* ++ * mtk xHCI scheduling information put into reserved DWs ++ * in ep context ++ */ ++ u32 offset; ++ u32 repeat; ++ u32 pkts; ++ u32 cs_count; ++ u32 burst_mode; ++}; ++ ++#define MU3C_U3_PORT_MAX 4 ++#define MU3C_U2_PORT_MAX 5 ++ ++/** ++ * struct mu3c_ippc_regs: MTK ssusb ip port control registers ++ * @ip_pw_ctr0~3: ip power and clock control registers ++ * @ip_pw_sts1~2: ip power and clock status registers ++ * @ip_xhci_cap: ip xHCI capability register ++ * @u3_ctrl_p[x]: ip usb3 port x control register, only low 4bytes are used ++ * @u2_ctrl_p[x]: ip usb2 port x control register, only low 4bytes are used ++ * @u2_phy_pll: usb2 phy pll control register ++ */ ++struct mu3c_ippc_regs { ++ __le32 ip_pw_ctr0; ++ __le32 ip_pw_ctr1; ++ __le32 ip_pw_ctr2; ++ __le32 ip_pw_ctr3; ++ __le32 ip_pw_sts1; ++ __le32 ip_pw_sts2; ++ __le32 reserved0[3]; ++ __le32 ip_xhci_cap; ++ __le32 reserved1[2]; ++ __le64 u3_ctrl_p[MU3C_U3_PORT_MAX]; ++ __le64 u2_ctrl_p[MU3C_U2_PORT_MAX]; ++ __le32 reserved2; ++ __le32 u2_phy_pll; ++ __le32 reserved3[33]; /* 0x80 ~ 0xff */ ++}; ++ ++struct xhci_hcd_mtk { ++ struct device *dev; ++ struct usb_hcd *hcd; ++ struct mu3h_sch_bw_info *sch_array; ++ struct mu3c_ippc_regs __iomem *ippc_regs; ++ int num_u2_ports; ++ int num_u3_ports; ++ struct regulator *vusb33; ++ struct regulator *vbus; ++ struct clk *sys_clk; /* sys and mac clock */ ++ struct clk *wk_deb_p0; /* port0's wakeup debounce clock */ ++ struct clk *wk_deb_p1; ++ struct regmap *pericfg; ++ struct phy **phys; ++ int num_phys; ++ int wakeup_src; ++ bool lpm_support; ++}; ++ ++static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd) ++{ ++ return dev_get_drvdata(hcd->self.controller); ++} ++ ++#if IS_ENABLED(CONFIG_USB_XHCI_MTK) ++int xhci_mtk_sch_init(struct xhci_hcd_mtk *mtk); ++void xhci_mtk_sch_exit(struct xhci_hcd_mtk *mtk); ++int xhci_mtk_add_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev, ++ struct usb_host_endpoint *ep); ++void xhci_mtk_drop_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev, ++ struct usb_host_endpoint *ep); ++ ++#else ++static inline int xhci_mtk_add_ep_quirk(struct usb_hcd *hcd, ++ struct usb_device *udev, struct usb_host_endpoint *ep) ++{ ++ return 0; ++} ++ ++static inline void xhci_mtk_drop_ep_quirk(struct usb_hcd *hcd, ++ struct usb_device *udev, struct usb_host_endpoint *ep) ++{ ++} ++ ++#endif ++ ++#endif /* _XHCI_MTK_H_ */ +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -68,6 +68,7 @@ + #include + #include "xhci.h" + #include "xhci-trace.h" ++#include "xhci-mtk.h" + + /* + * Returns zero if the TRB isn't in this segment, otherwise it returns the DMA +@@ -3088,17 +3089,22 @@ static u32 xhci_td_remainder(struct xhci + { + u32 maxp, total_packet_count; + +- if (xhci->hci_version < 0x100) ++ /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */ ++ if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST)) + return ((td_total_len - transferred) >> 10); + +- maxp = GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); +- total_packet_count = DIV_ROUND_UP(td_total_len, maxp); +- + /* One TRB with a zero-length data packet. */ + if (num_trbs_left == 0 || (transferred == 0 && trb_buff_len == 0) || + trb_buff_len == td_total_len) + return 0; + ++ /* for MTK xHCI, TD size doesn't include this TRB */ ++ if (xhci->quirks & XHCI_MTK_HOST) ++ trb_buff_len = 0; ++ ++ maxp = GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); ++ total_packet_count = DIV_ROUND_UP(td_total_len, maxp); ++ + /* Queueing functions don't count the current TRB into transferred */ + return (total_packet_count - ((transferred + trb_buff_len) / maxp)); + } +@@ -3486,7 +3492,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * + field |= 0x1; + + /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */ +- if (xhci->hci_version >= 0x100) { ++ if ((xhci->hci_version >= 0x100) || (xhci->quirks & XHCI_MTK_HOST)) { + if (urb->transfer_buffer_length > 0) { + if (setup->bRequestType & USB_DIR_IN) + field |= TRB_TX_TYPE(TRB_DATA_IN); +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -31,6 +31,7 @@ + + #include "xhci.h" + #include "xhci-trace.h" ++#include "xhci-mtk.h" + + #define DRIVER_AUTHOR "Sarah Sharp" + #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" +@@ -635,7 +636,11 @@ int xhci_run(struct usb_hcd *hcd) + "// Set the interrupt modulation register"); + temp = readl(&xhci->ir_set->irq_control); + temp &= ~ER_IRQ_INTERVAL_MASK; +- temp |= (u32) 160; ++ /* ++ * the increment interval is 8 times as much as that defined ++ * in xHCI spec on MTK's controller ++ */ ++ temp |= (u32) ((xhci->quirks & XHCI_MTK_HOST) ? 20 : 160); + writel(temp, &xhci->ir_set->irq_control); + + /* Set the HCD state before we enable the irqs */ +@@ -1704,6 +1709,9 @@ int xhci_drop_endpoint(struct usb_hcd *h + + xhci_endpoint_zero(xhci, xhci->devs[udev->slot_id], ep); + ++ if (xhci->quirks & XHCI_MTK_HOST) ++ xhci_mtk_drop_ep_quirk(hcd, udev, ep); ++ + xhci_dbg(xhci, "drop ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n", + (unsigned int) ep->desc.bEndpointAddress, + udev->slot_id, +@@ -1799,6 +1807,15 @@ int xhci_add_endpoint(struct usb_hcd *hc + return -ENOMEM; + } + ++ if (xhci->quirks & XHCI_MTK_HOST) { ++ ret = xhci_mtk_add_ep_quirk(hcd, udev, ep); ++ if (ret < 0) { ++ xhci_free_or_cache_endpoint_ring(xhci, ++ virt_dev, ep_index); ++ return ret; ++ } ++ } ++ + ctrl_ctx->add_flags |= cpu_to_le32(added_ctxs); + new_add_flags = le32_to_cpu(ctrl_ctx->add_flags); + +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -1631,6 +1631,7 @@ struct xhci_hcd { + /* For controllers with a broken beyond repair streams implementation */ + #define XHCI_BROKEN_STREAMS (1 << 19) + #define XHCI_PME_STUCK_QUIRK (1 << 20) ++#define XHCI_MTK_HOST (1 << 21) + unsigned int num_active_eps; + unsigned int limit_active_eps; + /* There are two roothubs to keep track of bus suspend info for */ diff --git a/target/linux/ramips/patches-4.4/0034-NET-multi-phy-support.patch b/target/linux/ramips/patches-4.4/0034-NET-multi-phy-support.patch new file mode 100644 index 0000000000..f49660a56e --- /dev/null +++ b/target/linux/ramips/patches-4.4/0034-NET-multi-phy-support.patch @@ -0,0 +1,53 @@ +From 0b6eb1e68290243d439ee330ea8d0b239a5aec69 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:38:50 +0100 +Subject: [PATCH 34/53] 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 +@@ -890,7 +890,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; + } +@@ -973,7 +974,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); +@@ -985,7 +987,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 +@@ -377,6 +377,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/ramips/patches-4.4/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch b/target/linux/ramips/patches-4.4/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch new file mode 100644 index 0000000000..b6189fe096 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch @@ -0,0 +1,29 @@ +From 8e72a3a1be8f6328bd7ef491332ba541547b6086 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 15 Jul 2013 00:38:51 +0200 +Subject: [PATCH 36/53] mtd: fix cfi cmdset 0002 erase status check + +--- + drivers/mtd/chips/cfi_cmdset_0002.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -2291,7 +2291,7 @@ static int __xipram do_erase_chip(struct + chip->erase_suspended = 0; + } + +- if (chip_ready(map, adr)) ++ if (chip_good(map, adr, map_word_ff(map))) + break; + + if (time_after(jiffies, timeo)) { +@@ -2380,7 +2380,7 @@ static int __xipram do_erase_oneblock(st + chip->erase_suspended = 0; + } + +- if (chip_ready(map, adr)) { ++ if (chip_good(map, adr, map_word_ff(map))) { + xip_enable(map, chip, adr); + break; + } diff --git a/target/linux/ramips/patches-4.4/0037-mtd-cfi-cmdset-0002-force-word-write.patch b/target/linux/ramips/patches-4.4/0037-mtd-cfi-cmdset-0002-force-word-write.patch new file mode 100644 index 0000000000..8f274bca15 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0037-mtd-cfi-cmdset-0002-force-word-write.patch @@ -0,0 +1,70 @@ +From ee9081b2726a5ca8cde5497afdc5425e21ff8f8b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 15 Jul 2013 00:39:21 +0200 +Subject: [PATCH 37/53] mtd: cfi cmdset 0002 force word write + +--- + drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -40,7 +40,7 @@ + #include + + #define AMD_BOOTLOC_BUG +-#define FORCE_WORD_WRITE 0 ++#define FORCE_WORD_WRITE 1 + + #define MAX_WORD_RETRIES 3 + +@@ -51,7 +51,9 @@ + + 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 *); ++#if !FORCE_WORD_WRITE + static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); ++#endif + static int cfi_amdstd_erase_chip(struct mtd_info *, struct erase_info *); + static int cfi_amdstd_erase_varsize(struct mtd_info *, struct erase_info *); + static void cfi_amdstd_sync (struct mtd_info *); +@@ -202,6 +204,7 @@ static void fixup_amd_bootblock(struct m + } + #endif + ++#if !FORCE_WORD_WRITE + static void fixup_use_write_buffers(struct mtd_info *mtd) + { + struct map_info *map = mtd->priv; +@@ -211,6 +214,7 @@ static void fixup_use_write_buffers(stru + mtd->_write = cfi_amdstd_write_buffers; + } + } ++#endif /* !FORCE_WORD_WRITE */ + + /* Atmel chips don't use the same PRI format as AMD chips */ + static void fixup_convert_atmel_pri(struct mtd_info *mtd) +@@ -1789,6 +1793,7 @@ static int cfi_amdstd_write_words(struct + /* + * FIXME: interleaved mode not tested, and probably not supported! + */ ++#if !FORCE_WORD_WRITE + static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, + unsigned long adr, const u_char *buf, + int len) +@@ -1917,7 +1922,6 @@ static int __xipram do_write_buffer(stru + return ret; + } + +- + static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, + size_t *retlen, const u_char *buf) + { +@@ -1992,6 +1996,7 @@ static int cfi_amdstd_write_buffers(stru + + return 0; + } ++#endif /* !FORCE_WORD_WRITE */ + + /* + * Wait for the flash chip to become ready to write data diff --git a/target/linux/ramips/patches-4.4/0038-mtd-ralink-add-mt7620-nand-driver.patch b/target/linux/ramips/patches-4.4/0038-mtd-ralink-add-mt7620-nand-driver.patch new file mode 100644 index 0000000000..0bf9043168 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0038-mtd-ralink-add-mt7620-nand-driver.patch @@ -0,0 +1,2408 @@ +From fb6e1578cd73d7d81f675e75247a676423f32412 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 17 Nov 2013 17:41:46 +0100 +Subject: [PATCH 38/53] mtd: ralink: add mt7620 nand driver + +Signed-off-by: John Crispin +--- + drivers/mtd/maps/Kconfig | 4 + + drivers/mtd/maps/Makefile | 2 + + drivers/mtd/maps/ralink_nand.c | 2136 ++++++++++++++++++++++++++++++++++++++++ + drivers/mtd/maps/ralink_nand.h | 232 +++++ + 4 files changed, 2374 insertions(+) + create mode 100644 drivers/mtd/maps/ralink_nand.c + create mode 100644 drivers/mtd/maps/ralink_nand.h + +--- 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_NAND_MT7620 ++ tristate "Support for NAND on Mediatek MT7620" ++ depends on RALINK && SOC_MT7620 ++ + endmenu +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -43,3 +43,5 @@ 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_NAND_MT7620) += ralink_nand.o ++ +--- /dev/null ++++ b/drivers/mtd/maps/ralink_nand.c +@@ -0,0 +1,2136 @@ ++#define DEBUG ++#include ++#undef DEBUG ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "ralink_nand.h" ++#ifdef RANDOM_GEN_BAD_BLOCK ++#include ++#endif ++ ++#define LARGE_MTD_BOOT_PART_SIZE (CFG_BLOCKSIZE<<2) ++#define LARGE_MTD_CONFIG_PART_SIZE (CFG_BLOCKSIZE<<2) ++#define LARGE_MTD_FACTORY_PART_SIZE (CFG_BLOCKSIZE<<1) ++ ++ ++#define BLOCK_ALIGNED(a) ((a) & (CFG_BLOCKSIZE - 1)) ++ ++#define READ_STATUS_RETRY 1000 ++ ++struct mtd_info *ranfc_mtd = NULL; ++ ++int skipbbt = 0; ++int ranfc_debug = 1; ++static int ranfc_bbt = 1; ++#if defined (WORKAROUND_RX_BUF_OV) ++static int ranfc_verify = 1; ++#endif ++static u32 nand_addrlen; ++ ++#if 0 ++module_param(ranfc_debug, int, 0644); ++module_param(ranfc_bbt, int, 0644); ++module_param(ranfc_verify, int, 0644); ++#endif ++ ++#if 0 ++#define ra_dbg(args...) do { if (ranfc_debug) printk(args); } while(0) ++#else ++#define ra_dbg(args...) ++#endif ++ ++#define CLEAR_INT_STATUS() ra_outl(NFC_INT_ST, ra_inl(NFC_INT_ST)) ++#define NFC_TRANS_DONE() (ra_inl(NFC_INT_ST) & INT_ST_ND_DONE) ++ ++int is_nand_page_2048 = 0; ++const unsigned int nand_size_map[2][3] = {{25, 30, 30}, {20, 27, 30}}; ++ ++static int nfc_wait_ready(int snooze_ms); ++ ++static const char * const mtk_probe_types[] = { "cmdlinepart", "ofpart", NULL }; ++ ++/** ++ * reset nand chip ++ */ ++static int nfc_chip_reset(void) ++{ ++ int status; ++ ++ //ra_dbg("%s:\n", __func__); ++ ++ // reset nand flash ++ ra_outl(NFC_CMD1, 0x0); ++ ra_outl(NFC_CMD2, 0xff); ++ ra_outl(NFC_ADDR, 0x0); ++ ra_outl(NFC_CONF, 0x0411); ++ ++ status = nfc_wait_ready(5); //erase wait 5us ++ if (status & NAND_STATUS_FAIL) { ++ printk("%s: fail \n", __func__); ++ } ++ ++ return (int)(status & NAND_STATUS_FAIL); ++ ++} ++ ++ ++ ++/** ++ * clear NFC and flash chip. ++ */ ++static int nfc_all_reset(void) ++{ ++ int retry; ++ ++ ra_dbg("%s: \n", __func__); ++ ++ // reset controller ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) | 0x02); //clear data buffer ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) & ~0x02); //clear data buffer ++ ++ CLEAR_INT_STATUS(); ++ ++ retry = READ_STATUS_RETRY; ++ while ((ra_inl(NFC_INT_ST) & 0x02) != 0x02 && retry--); ++ if (retry <= 0) { ++ printk("nfc_all_reset: clean buffer fail \n"); ++ return -1; ++ } ++ ++ retry = READ_STATUS_RETRY; ++ while ((ra_inl(NFC_STATUS) & 0x1) != 0x0 && retry--) { //fixme, controller is busy ? ++ udelay(1); ++ } ++ ++ nfc_chip_reset(); ++ ++ return 0; ++} ++ ++/** NOTICE: only called by nfc_wait_ready(). ++ * @return -1, nfc can not get transction done ++ * @return 0, ok. ++ */ ++static int _nfc_read_status(char *status) ++{ ++ unsigned long cmd1, conf; ++ int int_st, nfc_st; ++ int retry; ++ ++ cmd1 = 0x70; ++ conf = 0x000101 | (1 << 20); ++ ++ //fixme, should we check nfc status? ++ CLEAR_INT_STATUS(); ++ ++ ra_outl(NFC_CMD1, cmd1); ++ ra_outl(NFC_CONF, conf); ++ ++ /* FIXME, ++ * 1. since we have no wired ready signal, directly ++ * calling this function is not gurantee to read right status under ready state. ++ * 2. the other side, we can not determine how long to become ready, this timeout retry is nonsense. ++ * 3. SUGGESTION: call nfc_read_status() from nfc_wait_ready(), ++ * that is aware about caller (in sementics) and has snooze plused nfc ND_DONE. ++ */ ++ retry = READ_STATUS_RETRY; ++ do { ++ nfc_st = ra_inl(NFC_STATUS); ++ int_st = ra_inl(NFC_INT_ST); ++ ++ ndelay(10); ++ } while (!(int_st & INT_ST_RX_BUF_RDY) && retry--); ++ ++ if (!(int_st & INT_ST_RX_BUF_RDY)) { ++ printk("nfc_read_status: NFC fail, int_st(%x), retry:%x. nfc:%x, reset nfc and flash. \n", ++ int_st, retry, nfc_st); ++ nfc_all_reset(); ++ *status = NAND_STATUS_FAIL; ++ return -1; ++ } ++ ++ *status = (char)(le32_to_cpu(ra_inl(NFC_DATA)) & 0x0ff); ++ return 0; ++} ++ ++/** ++ * @return !0, chip protect. ++ * @return 0, chip not protected. ++ */ ++static int nfc_check_wp(void) ++{ ++ /* Check the WP bit */ ++#if !defined CONFIG_NOT_SUPPORT_WP ++ return !!(ra_inl(NFC_CTRL) & 0x01); ++#else ++ char result = 0; ++ int ret; ++ ++ ret = _nfc_read_status(&result); ++ //FIXME, if ret < 0 ++ ++ return !(result & NAND_STATUS_WP); ++#endif ++} ++ ++#if !defined CONFIG_NOT_SUPPORT_RB ++/* ++ * @return !0, chip ready. ++ * @return 0, chip busy. ++ */ ++static int nfc_device_ready(void) ++{ ++ /* Check the ready */ ++ return !!(ra_inl(NFC_STATUS) & 0x04); ++} ++#endif ++ ++ ++/** ++ * generic function to get data from flash. ++ * @return data length reading from flash. ++ */ ++static int _ra_nand_pull_data(char *buf, int len, int use_gdma) ++{ ++#ifdef RW_DATA_BY_BYTE ++ char *p = buf; ++#else ++ __u32 *p = (__u32 *)buf; ++#endif ++ int retry, int_st; ++ unsigned int ret_data; ++ int ret_size; ++ ++ // receive data by use_gdma ++ if (use_gdma) { ++ //if (_ra_nand_dma_pull((unsigned long)p, len)) { ++ if (1) { ++ printk("%s: fail \n", __func__); ++ len = -1; //return error ++ } ++ ++ return len; ++ } ++ ++ //fixme: retry count size? ++ retry = READ_STATUS_RETRY; ++ // no gdma ++ while (len > 0) { ++ int_st = ra_inl(NFC_INT_ST); ++ if (int_st & INT_ST_RX_BUF_RDY) { ++ ++ ret_data = ra_inl(NFC_DATA); ++ ra_outl(NFC_INT_ST, INT_ST_RX_BUF_RDY); ++#ifdef RW_DATA_BY_BYTE ++ ret_size = sizeof(unsigned int); ++ ret_size = min(ret_size, len); ++ len -= ret_size; ++ while (ret_size-- > 0) { ++ //nfc is little endian ++ *p++ = ret_data & 0x0ff; ++ ret_data >>= 8; ++ } ++#else ++ ret_size = min(len, 4); ++ len -= ret_size; ++ if (ret_size == 4) ++ *p++ = ret_data; ++ else { ++ __u8 *q = (__u8 *)p; ++ while (ret_size-- > 0) { ++ *q++ = ret_data & 0x0ff; ++ ret_data >>= 8; ++ } ++ p = (__u32 *)q; ++ } ++#endif ++ retry = READ_STATUS_RETRY; ++ } ++ else if (int_st & INT_ST_ND_DONE) { ++ break; ++ } ++ else { ++ udelay(1); ++ if (retry-- < 0) ++ break; ++ } ++ } ++ ++#ifdef RW_DATA_BY_BYTE ++ return (int)(p - buf); ++#else ++ return ((int)p - (int)buf); ++#endif ++} ++ ++/** ++ * generic function to put data into flash. ++ * @return data length writing into flash. ++ */ ++static int _ra_nand_push_data(char *buf, int len, int use_gdma) ++{ ++#ifdef RW_DATA_BY_BYTE ++ char *p = buf; ++#else ++ __u32 *p = (__u32 *)buf; ++#endif ++ int retry, int_st; ++ unsigned int tx_data = 0; ++ int tx_size, iter = 0; ++ ++ // receive data by use_gdma ++ if (use_gdma) { ++ //if (_ra_nand_dma_push((unsigned long)p, len)) ++ if (1) ++ len = 0; ++ printk("%s: fail \n", __func__); ++ return len; ++ } ++ ++ // no gdma ++ retry = READ_STATUS_RETRY; ++ while (len > 0) { ++ int_st = ra_inl(NFC_INT_ST); ++ if (int_st & INT_ST_TX_BUF_RDY) { ++#ifdef RW_DATA_BY_BYTE ++ tx_size = min(len, (int)sizeof(unsigned long)); ++ for (iter = 0; iter < tx_size; iter++) { ++ tx_data |= (*p++ << (8*iter)); ++ } ++#else ++ tx_size = min(len, 4); ++ if (tx_size == 4) ++ tx_data = (*p++); ++ else { ++ __u8 *q = (__u8 *)p; ++ for (iter = 0; iter < tx_size; iter++) ++ tx_data |= (*q++ << (8*iter)); ++ p = (__u32 *)q; ++ } ++#endif ++ ra_outl(NFC_INT_ST, INT_ST_TX_BUF_RDY); ++ ra_outl(NFC_DATA, tx_data); ++ len -= tx_size; ++ retry = READ_STATUS_RETRY; ++ } ++ else if (int_st & INT_ST_ND_DONE) { ++ break; ++ } ++ else { ++ udelay(1); ++ if (retry-- < 0) { ++ ra_dbg("%s p:%p buf:%p \n", __func__, p, buf); ++ break; ++ } ++ } ++ } ++ ++ ++#ifdef RW_DATA_BY_BYTE ++ return (int)(p - buf); ++#else ++ return ((int)p - (int)buf); ++#endif ++ ++} ++ ++static int nfc_select_chip(struct ra_nand_chip *ra, int chipnr) ++{ ++#if (CONFIG_NUMCHIPS == 1) ++ if (!(chipnr < CONFIG_NUMCHIPS)) ++ return -1; ++ return 0; ++#else ++ BUG(); ++#endif ++} ++ ++/** @return -1: chip_select fail ++ * 0 : both CE and WP==0 are OK ++ * 1 : CE OK and WP==1 ++ */ ++static int nfc_enable_chip(struct ra_nand_chip *ra, unsigned int offs, int read_only) ++{ ++ int chipnr = offs >> ra->chip_shift; ++ ++ ra_dbg("%s: offs:%x read_only:%x \n", __func__, offs, read_only); ++ ++ chipnr = nfc_select_chip(ra, chipnr); ++ if (chipnr < 0) { ++ printk("%s: chip select error, offs(%x)\n", __func__, offs); ++ return -1; ++ } ++ ++ if (!read_only) ++ return nfc_check_wp(); ++ ++ return 0; ++} ++ ++/** wait nand chip becomeing ready and return queried status. ++ * @param snooze: sleep time in ms unit before polling device ready. ++ * @return status of nand chip ++ * @return NAN_STATUS_FAIL if something unexpected. ++ */ ++static int nfc_wait_ready(int snooze_ms) ++{ ++ int retry; ++ char status; ++ ++ // wait nfc idle, ++ if (snooze_ms == 0) ++ snooze_ms = 1; ++ else ++ schedule_timeout(snooze_ms * HZ / 1000); ++ ++ snooze_ms = retry = snooze_ms *1000000 / 100 ; // ndelay(100) ++ ++ while (!NFC_TRANS_DONE() && retry--) { ++ if (!cond_resched()) ++ ndelay(100); ++ } ++ ++ if (!NFC_TRANS_DONE()) { ++ printk("nfc_wait_ready: no transaction done \n"); ++ return NAND_STATUS_FAIL; ++ } ++ ++#if !defined (CONFIG_NOT_SUPPORT_RB) ++ //fixme ++ while(!(status = nfc_device_ready()) && retry--) { ++ ndelay(100); ++ } ++ ++ if (status == 0) { ++ printk("nfc_wait_ready: no device ready. \n"); ++ return NAND_STATUS_FAIL; ++ } ++ ++ _nfc_read_status(&status); ++ return status; ++#else ++ ++ while(retry--) { ++ _nfc_read_status(&status); ++ if (status & NAND_STATUS_READY) ++ break; ++ ndelay(100); ++ } ++ if (retry<0) ++ printk("nfc_wait_ready 2: no device ready, status(%x). \n", status); ++ ++ return status; ++#endif ++} ++ ++/** ++ * return 0: erase OK ++ * return -EIO: fail ++ */ ++int nfc_erase_block(struct ra_nand_chip *ra, int row_addr) ++{ ++ unsigned long cmd1, cmd2, bus_addr, conf; ++ char status; ++ ++ cmd1 = 0x60; ++ cmd2 = 0xd0; ++ bus_addr = row_addr; ++ conf = 0x00511 | ((CFG_ROW_ADDR_CYCLE)<<16); ++ ++ // set NFC ++ ra_dbg("%s: cmd1: %lx, cmd2:%lx bus_addr: %lx, conf: %lx \n", ++ __func__, cmd1, cmd2, bus_addr, conf); ++ ++ //fixme, should we check nfc status? ++ CLEAR_INT_STATUS(); ++ ++ ra_outl(NFC_CMD1, cmd1); ++ ra_outl(NFC_CMD2, cmd2); ++ ra_outl(NFC_ADDR, bus_addr); ++ ra_outl(NFC_CONF, conf); ++ ++ status = nfc_wait_ready(3); //erase wait 3ms ++ if (status & NAND_STATUS_FAIL) { ++ printk("%s: fail \n", __func__); ++ return -EIO; ++ } ++ ++ return 0; ++ ++} ++ ++static inline int _nfc_read_raw_data(int cmd1, int cmd2, int bus_addr, int bus_addr2, int conf, char *buf, int len, int flags) ++{ ++ int ret; ++ ++ CLEAR_INT_STATUS(); ++ ra_outl(NFC_CMD1, cmd1); ++ ra_outl(NFC_CMD2, cmd2); ++ ra_outl(NFC_ADDR, bus_addr); ++#if defined (CONFIG_RALINK_RT6855) || defined (CONFIG_RALINK_RT6855A) || \ ++ defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) ++ ra_outl(NFC_ADDR2, bus_addr2); ++#endif ++ ra_outl(NFC_CONF, conf); ++ ++ ret = _ra_nand_pull_data(buf, len, 0); ++ if (ret != len) { ++ ra_dbg("%s: ret:%x (%x) \n", __func__, ret, len); ++ return NAND_STATUS_FAIL; ++ } ++ ++ //FIXME, this section is not necessary ++ ret = nfc_wait_ready(0); //wait ready ++ /* to prevent the DATA FIFO 's old data from next operation */ ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) | 0x02); //clear data buffer ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) & ~0x02); //clear data buffer ++ ++ if (ret & NAND_STATUS_FAIL) { ++ printk("%s: fail \n", __func__); ++ return NAND_STATUS_FAIL; ++ } ++ ++ return 0; ++} ++ ++static inline int _nfc_write_raw_data(int cmd1, int cmd3, int bus_addr, int bus_addr2, int conf, char *buf, int len, int flags) ++{ ++ int ret; ++ ++ CLEAR_INT_STATUS(); ++ ra_outl(NFC_CMD1, cmd1); ++ ra_outl(NFC_CMD3, cmd3); ++ ra_outl(NFC_ADDR, bus_addr); ++#if defined (CONFIG_RALINK_RT6855) || defined (CONFIG_RALINK_RT6855A) || \ ++ defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) ++ ra_outl(NFC_ADDR2, bus_addr2); ++#endif ++ ra_outl(NFC_CONF, conf); ++ ++ ret = _ra_nand_push_data(buf, len, 0); ++ if (ret != len) { ++ ra_dbg("%s: ret:%x (%x) \n", __func__, ret, len); ++ return NAND_STATUS_FAIL; ++ } ++ ++ ret = nfc_wait_ready(1); //write wait 1ms ++ /* to prevent the DATA FIFO 's old data from next operation */ ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) | 0x02); //clear data buffer ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) & ~0x02); //clear data buffer ++ ++ if (ret & NAND_STATUS_FAIL) { ++ printk("%s: fail \n", __func__); ++ return NAND_STATUS_FAIL; ++ } ++ ++ return 0; ++} ++ ++/** ++ * @return !0: fail ++ * @return 0: OK ++ */ ++int nfc_read_oob(struct ra_nand_chip *ra, int page, unsigned int offs, char *buf, int len, int flags) ++{ ++ unsigned int cmd1 = 0, cmd2 = 0, conf = 0; ++ unsigned int bus_addr = 0, bus_addr2 = 0; ++ unsigned int ecc_en; ++ int use_gdma; ++ int status; ++ ++ int pages_perblock = 1<<(ra->erase_shift - ra->page_shift); ++ // constrain of nfc read function ++ ++#if defined (WORKAROUND_RX_BUF_OV) ++ BUG_ON (len > 60); //problem of rx-buffer overrun ++#endif ++ BUG_ON (offs >> ra->oob_shift); //page boundry ++ BUG_ON ((unsigned int)(((offs + len) >> ra->oob_shift) + page) > ++ ((page + pages_perblock) & ~(pages_perblock-1))); //block boundry ++ ++ use_gdma = flags & FLAG_USE_GDMA; ++ ecc_en = flags & FLAG_ECC_EN; ++ bus_addr = (page << (CFG_COLUMN_ADDR_CYCLE*8)) | (offs & ((1<> (CFG_COLUMN_ADDR_CYCLE*8); ++ cmd1 = 0x0; ++ cmd2 = 0x30; ++ conf = 0x000511| ((CFG_ADDR_CYCLE)<<16) | (len << 20); ++ } ++ else { ++ cmd1 = 0x50; ++ conf = 0x000141| ((CFG_ADDR_CYCLE)<<16) | (len << 20); ++ } ++ if (ecc_en) ++ conf |= (1<<3); ++ if (use_gdma) ++ conf |= (1<<2); ++ ++ ra_dbg("%s: cmd1:%x, bus_addr:%x, conf:%x, len:%x, flag:%x\n", ++ __func__, cmd1, bus_addr, conf, len, flags); ++ ++ status = _nfc_read_raw_data(cmd1, cmd2, bus_addr, bus_addr2, conf, buf, len, flags); ++ if (status & NAND_STATUS_FAIL) { ++ printk("%s: fail\n", __func__); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++/** ++ * @return !0: fail ++ * @return 0: OK ++ */ ++int nfc_write_oob(struct ra_nand_chip *ra, int page, unsigned int offs, char *buf, int len, int flags) ++{ ++ unsigned int cmd1 = 0, cmd3=0, conf = 0; ++ unsigned int bus_addr = 0, bus_addr2 = 0; ++ int use_gdma; ++ int status; ++ ++ int pages_perblock = 1<<(ra->erase_shift - ra->page_shift); ++ // constrain of nfc read function ++ ++ BUG_ON (offs >> ra->oob_shift); //page boundry ++ BUG_ON ((unsigned int)(((offs + len) >> ra->oob_shift) + page) > ++ ((page + pages_perblock) & ~(pages_perblock-1))); //block boundry ++ ++ use_gdma = flags & FLAG_USE_GDMA; ++ bus_addr = (page << (CFG_COLUMN_ADDR_CYCLE*8)) | (offs & ((1<> (CFG_COLUMN_ADDR_CYCLE*8); ++ conf = 0x001123 | ((CFG_ADDR_CYCLE)<<16) | ((len) << 20); ++ } ++ else { ++ cmd1 = 0x08050; ++ cmd3 = 0x10; ++ conf = 0x001223 | ((CFG_ADDR_CYCLE)<<16) | ((len) << 20); ++ } ++ if (use_gdma) ++ conf |= (1<<2); ++ ++ // set NFC ++ ra_dbg("%s: cmd1: %x, cmd3: %x bus_addr: %x, conf: %x, len:%x\n", ++ __func__, cmd1, cmd3, bus_addr, conf, len); ++ ++ status = _nfc_write_raw_data(cmd1, cmd3, bus_addr, bus_addr2, conf, buf, len, flags); ++ if (status & NAND_STATUS_FAIL) { ++ printk("%s: fail \n", __func__); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++ ++int nfc_read_page(struct ra_nand_chip *ra, char *buf, int page, int flags); ++int nfc_write_page(struct ra_nand_chip *ra, char *buf, int page, int flags); ++ ++ ++#if !defined (WORKAROUND_RX_BUF_OV) ++static int one_bit_correction(char *ecc, char *expected, int *bytes, int *bits); ++int nfc_ecc_verify(struct ra_nand_chip *ra, char *buf, int page, int mode) ++{ ++ int ret, i; ++ char *p, *e; ++ int ecc; ++ ++ //ra_dbg("%s, page:%x mode:%d\n", __func__, page, mode); ++ ++ if (mode == FL_WRITING) { ++ int len = CFG_PAGESIZE + CFG_PAGE_OOBSIZE; ++ int conf = 0x000141| ((CFG_ADDR_CYCLE)<<16) | (len << 20); ++ conf |= (1<<3); //(ecc_en) ++ //conf |= (1<<2); // (use_gdma) ++ ++ p = ra->readback_buffers; ++ ret = nfc_read_page(ra, ra->readback_buffers, page, FLAG_ECC_EN); ++ if (ret == 0) ++ goto ecc_check; ++ ++ //FIXME, double comfirm ++ printk("%s: read back fail, try again \n",__func__); ++ ret = nfc_read_page(ra, ra->readback_buffers, page, FLAG_ECC_EN); ++ if (ret != 0) { ++ printk("\t%s: read back fail agian \n",__func__); ++ goto bad_block; ++ } ++ } ++ else if (mode == FL_READING) { ++ p = buf; ++ } ++ else ++ return -2; ++ ++ecc_check: ++ p += CFG_PAGESIZE; ++ if (!is_nand_page_2048) { ++ ecc = ra_inl(NFC_ECC); ++ if (ecc == 0) //clean page. ++ return 0; ++ e = (char*)&ecc; ++ for (i=0; ireadback_buffers, page, FLAG_NONE); ++ if (ret != 0) //double comfirm ++ ret = nfc_read_page(ra, ra->readback_buffers, page, FLAG_NONE); ++ ++ if (ret != 0) { ++ printk("%s: mode:%x read back fail \n", __func__, mode); ++ return -1; ++ } ++ return memcmp(buf, ra->readback_buffers, 1<page_shift); ++ } ++ ++ if (mode == FL_READING) { ++#if 0 ++ if (ra->sandbox_page == 0) ++ return 0; ++ ++ ret = nfc_write_page(ra, buf, ra->sandbox_page, FLAG_USE_GDMA | FLAG_ECC_EN); ++ if (ret != 0) { ++ printk("%s, fail write sandbox_page \n", __func__); ++ return -1; ++ } ++#else ++ /** @note: ++ * The following command is actually not 'write' command to drive NFC to write flash. ++ * However, it can make NFC to calculate ECC, that will be used to compare with original ones. ++ * --YT ++ */ ++ unsigned int conf = 0x001223| (CFG_ADDR_CYCLE<<16) | (0x200 << 20) | (1<<3) | (1<<2); ++ _nfc_write_raw_data(0xff, 0xff, ra->sandbox_page<page_shift, conf, buf, 0x200, FLAG_USE_GDMA); ++#endif ++ ++ ecc = ra_inl(NFC_ECC); ++ if (ecc == 0) //clean page. ++ return 0; ++ e = (char*)&ecc; ++ p = buf + (1<page_shift); ++ for (i=0; i 0) { ++ int len; ++#if defined (WORKAROUND_RX_BUF_OV) ++ len = min(60, size); ++#else ++ len = size; ++#endif ++ bus_addr = (page << (CFG_COLUMN_ADDR_CYCLE*8)) | (offs & ((1<> (CFG_COLUMN_ADDR_CYCLE*8); ++ cmd1 = 0x0; ++ cmd2 = 0x30; ++ conf = 0x000511| ((CFG_ADDR_CYCLE)<<16) | (len << 20); ++ } ++ else { ++ if (offs & ~(CFG_PAGESIZE-1)) ++ cmd1 = 0x50; ++ else if (offs & ~((1<buffers_page = -1; //cached ++ } ++ ++ return 0; ++} ++ ++ ++/** ++ * @return -EIO, fail to write ++ * @return 0, OK ++ */ ++int nfc_write_page(struct ra_nand_chip *ra, char *buf, int page, int flags) ++{ ++ unsigned int cmd1 = 0, cmd3, conf = 0; ++ unsigned int bus_addr = 0, bus_addr2 = 0; ++ unsigned int ecc_en; ++ int use_gdma; ++ int size; ++ char status; ++ uint8_t *oob = buf + (1<page_shift); ++ ++ use_gdma = flags & FLAG_USE_GDMA; ++ ecc_en = flags & FLAG_ECC_EN; ++ ++ oob[ra->badblockpos] = 0xff; //tag as good block. ++ ra->buffers_page = -1; //cached ++ ++ page = page & (CFG_CHIPSIZE-1); //chip boundary ++ size = CFG_PAGESIZE + CFG_PAGE_OOBSIZE; //add oobsize ++ bus_addr = (page << (CFG_COLUMN_ADDR_CYCLE*8)); //write_page always write from offset 0. ++ ++ if (is_nand_page_2048) { ++ bus_addr2 = page >> (CFG_COLUMN_ADDR_CYCLE*8); ++ cmd1 = 0x80; ++ cmd3 = 0x10; ++ conf = 0x001123| ((CFG_ADDR_CYCLE)<<16) | (size << 20); ++ } ++ else { ++ cmd1 = 0x8000; ++ cmd3 = 0x10; ++ conf = 0x001223| ((CFG_ADDR_CYCLE)<<16) | (size << 20); ++} ++ if (ecc_en) ++ conf |= (1<<3); //enable ecc ++ if (use_gdma) ++ conf |= (1<<2); ++ ++ // set NFC ++ ra_dbg("nfc_write_page: cmd1: %x, cmd3: %x bus_addr: %x, conf: %x, len:%x\n", ++ cmd1, cmd3, bus_addr, conf, size); ++ ++ status = _nfc_write_raw_data(cmd1, cmd3, bus_addr, bus_addr2, conf, buf, size, flags); ++ if (status & NAND_STATUS_FAIL) { ++ printk("%s: fail \n", __func__); ++ return -EIO; ++ } ++ ++ ++ if (flags & FLAG_VERIFY) { // verify and correct ecc ++ status = nfc_ecc_verify(ra, buf, page, FL_WRITING); ++ ++#ifdef RANDOM_GEN_BAD_BLOCK ++ if (((random32() & 0x1ff) == 0x0) && (page >= 0x100)) // randomly create bad block ++ { ++ printk("hmm... create a bad block at page %x\n", (bus_addr >> 16)); ++ status = -1; ++ } ++#endif ++ ++ if (status != 0) { ++ printk("%s: ecc_verify fail: ret:%x \n", __func__, status); ++ oob[ra->badblockpos] = 0x33; ++ page -= page % (CFG_BLOCKSIZE/CFG_PAGESIZE); ++ printk("create a bad block at page %x\n", page); ++ if (!is_nand_page_2048) ++ status = nfc_write_oob(ra, page, ra->badblockpos, oob+ra->badblockpos, 1, flags); ++ else ++ { ++ status = _nfc_write_raw_data(cmd1, cmd3, bus_addr, bus_addr2, conf, buf, size, flags); ++ nfc_write_oob(ra, page, 0, oob, 16, FLAG_NONE); ++ } ++ return -EBADMSG; ++ } ++ } ++ ++ ++ ra->buffers_page = page; //cached ++ return 0; ++} ++ ++ ++ ++/************************************************************* ++ * nand internal process ++ *************************************************************/ ++ ++/** ++ * nand_release_device - [GENERIC] release chip ++ * @mtd: MTD device structure ++ * ++ * Deselect, release chip lock and wake up anyone waiting on the device ++ */ ++static void nand_release_device(struct ra_nand_chip *ra) ++{ ++ /* De-select the NAND device */ ++ nfc_select_chip(ra, -1); ++ ++ /* Release the controller and the chip */ ++ ra->state = FL_READY; ++ ++ mutex_unlock(ra->controller); ++} ++ ++/** ++ * nand_get_device - [GENERIC] Get chip for selected access ++ * @chip: the nand chip descriptor ++ * @mtd: MTD device structure ++ * @new_state: the state which is requested ++ * ++ * Get the device and lock it for exclusive access ++ */ ++static int ++nand_get_device(struct ra_nand_chip *ra, int new_state) ++{ ++ int ret = 0; ++ ++ ret = mutex_lock_interruptible(ra->controller); ++ if (!ret) ++ ra->state = new_state; ++ ++ return ret; ++ ++} ++ ++ ++ ++/************************************************************* ++ * nand internal process ++ *************************************************************/ ++ ++int nand_bbt_get(struct ra_nand_chip *ra, int block) ++{ ++ int byte, bits; ++ bits = block * BBTTAG_BITS; ++ ++ byte = bits / 8; ++ bits = bits % 8; ++ ++ return (ra->bbt[byte] >> bits) & BBTTAG_BITS_MASK; ++} ++ ++int nand_bbt_set(struct ra_nand_chip *ra, int block, int tag) ++{ ++ int byte, bits; ++ bits = block * BBTTAG_BITS; ++ ++ byte = bits / 8; ++ bits = bits % 8; ++ ++ // If previous tag is bad, dont overwrite it ++ if (((ra->bbt[byte] >> bits) & BBTTAG_BITS_MASK) == BBT_TAG_BAD) ++ { ++ return BBT_TAG_BAD; ++ } ++ ++ ra->bbt[byte] = (ra->bbt[byte] & ~(BBTTAG_BITS_MASK << bits)) | ((tag & BBTTAG_BITS_MASK) << bits); ++ ++ return tag; ++} ++ ++/** ++ * nand_block_checkbad - [GENERIC] Check if a block is marked bad ++ * @mtd: MTD device structure ++ * @ofs: offset from device start ++ * ++ * Check, if the block is bad. Either by reading the bad block table or ++ * calling of the scan function. ++ */ ++int nand_block_checkbad(struct ra_nand_chip *ra, loff_t offs) ++{ ++ int page, block; ++ int ret = 4; ++ unsigned int tag; ++ char *str[]= {"UNK", "RES", "BAD", "GOOD"}; ++ ++ if (ranfc_bbt == 0) ++ return 0; ++ ++ { ++ // align with chip ++ ++ offs = offs & ((1<chip_shift) -1); ++ ++ page = offs >> ra->page_shift; ++ block = offs >> ra->erase_shift; ++ } ++ ++ tag = nand_bbt_get(ra, block); ++ ++ if (tag == BBT_TAG_UNKNOWN) { ++ ret = nfc_read_oob(ra, page, ra->badblockpos, (char*)&tag, 1, FLAG_NONE); ++ if (ret == 0) ++ tag = ((le32_to_cpu(tag) & 0x0ff) == 0x0ff) ? BBT_TAG_GOOD : BBT_TAG_BAD; ++ else ++ tag = BBT_TAG_BAD; ++ ++ nand_bbt_set(ra, block, tag); ++ } ++ ++ if (tag != BBT_TAG_GOOD) { ++ printk("%s: offs:%x tag: %s \n", __func__, (unsigned int)offs, str[tag]); ++ return 1; ++ } ++ else ++ return 0; ++ ++} ++ ++ ++ ++/** ++ * nand_block_markbad - ++ */ ++int nand_block_markbad(struct ra_nand_chip *ra, loff_t offs) ++{ ++ int page, block; ++ int ret = 4; ++ unsigned int tag; ++ char *ecc; ++ ++ // align with chip ++ ra_dbg("%s offs: %x \n", __func__, (int)offs); ++ ++ offs = offs & ((1<chip_shift) -1); ++ ++ page = offs >> ra->page_shift; ++ block = offs >> ra->erase_shift; ++ ++ tag = nand_bbt_get(ra, block); ++ ++ if (tag == BBT_TAG_BAD) { ++ printk("%s: mark repeatedly \n", __func__); ++ return 0; ++ } ++ ++ // new tag as bad ++ tag =BBT_TAG_BAD; ++ ret = nfc_read_page(ra, ra->buffers, page, FLAG_NONE); ++ if (ret != 0) { ++ printk("%s: fail to read bad block tag \n", __func__); ++ goto tag_bbt; ++ } ++ ++ ecc = &ra->buffers[(1<page_shift)+ra->badblockpos]; ++ if (*ecc == (char)0x0ff) { ++ //tag into flash ++ *ecc = (char)tag; ++ ret = nfc_write_page(ra, ra->buffers, page, FLAG_USE_GDMA); ++ if (ret) ++ printk("%s: fail to write bad block tag \n", __func__); ++ ++ } ++ ++tag_bbt: ++ //update bbt ++ nand_bbt_set(ra, block, tag); ++ ++ return 0; ++} ++ ++ ++#if defined (WORKAROUND_RX_BUF_OV) ++/** ++ * to find a bad block for ecc verify of read_page ++ */ ++unsigned int nand_bbt_find_sandbox(struct ra_nand_chip *ra) ++{ ++ loff_t offs = 0; ++ int chipsize = 1 << ra->chip_shift; ++ int blocksize = 1 << ra->erase_shift; ++ ++ ++ while (offs < chipsize) { ++ if (nand_block_checkbad(ra, offs)) //scan and verify the unknown tag ++ break; ++ offs += blocksize; ++ } ++ ++ if (offs >= chipsize) { ++ offs = chipsize - blocksize; ++ } ++ ++ nand_bbt_set(ra, (unsigned int)offs>>ra->erase_shift, BBT_TAG_RES); // tag bbt only, instead of update badblockpos of flash. ++ return (offs >> ra->page_shift); ++} ++#endif ++ ++ ++ ++/** ++ * nand_erase_nand - [Internal] erase block(s) ++ * @mtd: MTD device structure ++ * @instr: erase instruction ++ * @allowbbt: allow erasing the bbt area ++ * ++ * Erase one ore more blocks ++ */ ++int _nand_erase_nand(struct ra_nand_chip *ra, struct erase_info *instr) ++{ ++ int page, len, status, ret; ++ unsigned int addr, blocksize = 1<erase_shift; ++ ++ ra_dbg("%s: start:%x, len:%x \n", __func__, ++ (unsigned int)instr->addr, (unsigned int)instr->len); ++ ++//#define BLOCK_ALIGNED(a) ((a) & (blocksize - 1)) // already defined ++ ++ if (BLOCK_ALIGNED(instr->addr) || BLOCK_ALIGNED(instr->len)) { ++ ra_dbg("%s: erase block not aligned, addr:%x len:%x\n", __func__, instr->addr, instr->len); ++ return -EINVAL; ++ } ++ ++ instr->fail_addr = 0xffffffff; ++ ++ len = instr->len; ++ addr = instr->addr; ++ instr->state = MTD_ERASING; ++ ++ while (len) { ++ ++ page = (int)(addr >> ra->page_shift); ++ ++ /* select device and check wp */ ++ if (nfc_enable_chip(ra, addr, 0)) { ++ printk("%s: nand is write protected \n", __func__); ++ instr->state = MTD_ERASE_FAILED; ++ goto erase_exit; ++ } ++ ++ /* if we have a bad block, we do not erase bad blocks */ ++ if (nand_block_checkbad(ra, addr)) { ++ printk(KERN_WARNING "nand_erase: attempt to erase a " ++ "bad block at 0x%08x\n", addr); ++ instr->state = MTD_ERASE_FAILED; ++ goto erase_exit; ++ } ++ ++ /* ++ * Invalidate the page cache, if we erase the block which ++ * contains the current cached page ++ */ ++ if (BLOCK_ALIGNED(addr) == BLOCK_ALIGNED(ra->buffers_page << ra->page_shift)) ++ ra->buffers_page = -1; ++ ++ status = nfc_erase_block(ra, page); ++ /* See if block erase succeeded */ ++ if (status) { ++ printk("%s: failed erase, page 0x%08x\n", __func__, page); ++ instr->state = MTD_ERASE_FAILED; ++ instr->fail_addr = (page << ra->page_shift); ++ goto erase_exit; ++ } ++ ++ ++ /* Increment page address and decrement length */ ++ len -= blocksize; ++ addr += blocksize; ++ ++ } ++ instr->state = MTD_ERASE_DONE; ++ ++erase_exit: ++ ++ ret = ((instr->state == MTD_ERASE_DONE) ? 0 : -EIO); ++ /* Do call back function */ ++ if (!ret) ++ mtd_erase_callback(instr); ++ ++ if (ret) { ++ nand_bbt_set(ra, addr >> ra->erase_shift, BBT_TAG_BAD); ++ } ++ ++ /* Return more or less happy */ ++ return ret; ++} ++ ++static int ++nand_write_oob_buf(struct ra_nand_chip *ra, uint8_t *buf, uint8_t *oob, size_t size, ++ int mode, int ooboffs) ++{ ++ size_t oobsize = 1<oob_shift; ++ struct nand_oobfree *free; ++ uint32_t woffs = ooboffs; ++ int retsize = 0; ++ ++ ra_dbg("%s: size:%x, mode:%x, offs:%x \n", __func__, size, mode, ooboffs); ++ ++ switch(mode) { ++ case MTD_OPS_PLACE_OOB: ++ case MTD_OPS_RAW: ++ if (ooboffs > oobsize) ++ return -1; ++ ++ size = min(size, oobsize - ooboffs); ++ memcpy(buf + ooboffs, oob, size); ++ retsize = size; ++ break; ++ ++ case MTD_OPS_AUTO_OOB: ++ if (ooboffs > ra->oob->oobavail) ++ return -1; ++ ++ while (size) { ++ for(free = ra->oob->oobfree; free->length && size; free++) { ++ int wlen = free->length - woffs; ++ int bytes = 0; ++ ++ /* Write request not from offset 0 ? */ ++ if (wlen <= 0) { ++ woffs = -wlen; ++ continue; ++ } ++ ++ bytes = min_t(size_t, size, wlen); ++ memcpy (buf + free->offset + woffs, oob, bytes); ++ woffs = 0; ++ oob += bytes; ++ size -= bytes; ++ retsize += bytes; ++ } ++ buf += oobsize; ++ } ++ break; ++ ++ default: ++ BUG(); ++ } ++ ++ return retsize; ++} ++ ++static int nand_read_oob_buf(struct ra_nand_chip *ra, uint8_t *oob, size_t size, ++ int mode, int ooboffs) ++{ ++ size_t oobsize = 1<oob_shift; ++ uint8_t *buf = ra->buffers + (1<page_shift); ++ int retsize=0; ++ ++ ra_dbg("%s: size:%x, mode:%x, offs:%x \n", __func__, size, mode, ooboffs); ++ ++ switch(mode) { ++ case MTD_OPS_PLACE_OOB: ++ case MTD_OPS_RAW: ++ if (ooboffs > oobsize) ++ return -1; ++ ++ size = min(size, oobsize - ooboffs); ++ memcpy(oob, buf + ooboffs, size); ++ return size; ++ ++ case MTD_OPS_AUTO_OOB: { ++ struct nand_oobfree *free; ++ uint32_t woffs = ooboffs; ++ ++ if (ooboffs > ra->oob->oobavail) ++ return -1; ++ ++ size = min(size, ra->oob->oobavail - ooboffs); ++ for(free = ra->oob->oobfree; free->length && size; free++) { ++ int wlen = free->length - woffs; ++ int bytes = 0; ++ ++ /* Write request not from offset 0 ? */ ++ if (wlen <= 0) { ++ woffs = -wlen; ++ continue; ++ } ++ ++ bytes = min_t(size_t, size, wlen); ++ memcpy (oob, buf + free->offset + woffs, bytes); ++ woffs = 0; ++ oob += bytes; ++ size -= bytes; ++ retsize += bytes; ++ } ++ return retsize; ++ } ++ default: ++ BUG(); ++ } ++ ++ return -1; ++} ++ ++/** ++ * nand_do_write_ops - [Internal] NAND write with ECC ++ * @mtd: MTD device structure ++ * @to: offset to write to ++ * @ops: oob operations description structure ++ * ++ * NAND write with ECC ++ */ ++static int nand_do_write_ops(struct ra_nand_chip *ra, loff_t to, ++ struct mtd_oob_ops *ops) ++{ ++ int page; ++ uint32_t datalen = ops->len; ++ uint32_t ooblen = ops->ooblen; ++ uint8_t *oob = ops->oobbuf; ++ uint8_t *data = ops->datbuf; ++ int pagesize = (1<page_shift); ++ int pagemask = (pagesize -1); ++ int oobsize = 1<oob_shift; ++ loff_t addr = to; ++ //int i = 0; //for ra_dbg only ++ ++ ra_dbg("%s: to:%x, ops data:%p, oob:%p datalen:%x ooblen:%x, ooboffs:%x oobmode:%x \n", ++ __func__, (unsigned int)to, data, oob, datalen, ooblen, ops->ooboffs, ops->mode); ++ ++ ops->retlen = 0; ++ ops->oobretlen = 0; ++ ++ ++ /* Invalidate the page cache, when we write to the cached page */ ++ ra->buffers_page = -1; ++ ++ ++ if (data ==0) ++ datalen = 0; ++ ++ // oob sequential (burst) write ++ if (datalen == 0 && ooblen) { ++ int len = ((ooblen + ops->ooboffs) + (ra->oob->oobavail - 1)) / ra->oob->oobavail * oobsize; ++ ++ /* select chip, and check if it is write protected */ ++ if (nfc_enable_chip(ra, addr, 0)) ++ return -EIO; ++ ++ //FIXME, need sanity check of block boundary ++ page = (int)((to & ((1<chip_shift)-1)) >> ra->page_shift); //chip boundary ++ memset(ra->buffers, 0x0ff, pagesize); ++ //fixme, should we reserve the original content? ++ if (ops->mode == MTD_OPS_AUTO_OOB) { ++ nfc_read_oob(ra, page, 0, ra->buffers, len, FLAG_NONE); ++ } ++ //prepare buffers ++ if (ooblen != 8) ++ { ++ nand_write_oob_buf(ra, ra->buffers, oob, ooblen, ops->mode, ops->ooboffs); ++ // write out buffer to chip ++ nfc_write_oob(ra, page, 0, ra->buffers, len, FLAG_USE_GDMA); ++ } ++ ++ ops->oobretlen = ooblen; ++ ooblen = 0; ++ } ++ ++ // data sequential (burst) write ++ if (datalen && ooblen == 0) { ++ // ranfc can not support write_data_burst, since hw-ecc and fifo constraints.. ++ } ++ ++ // page write ++ while(datalen || ooblen) { ++ int len; ++ int ret; ++ int offs; ++ int ecc_en = 0; ++ ++ ra_dbg("%s (%d): addr:%x, ops data:%p, oob:%p datalen:%x ooblen:%x, ooboffs:%x \n", ++ __func__, i++, (unsigned int)addr, data, oob, datalen, ooblen, ops->ooboffs); ++ ++ page = (int)((addr & ((1<chip_shift)-1)) >> ra->page_shift); //chip boundary ++ ++ /* select chip, and check if it is write protected */ ++ if (nfc_enable_chip(ra, addr, 0)) ++ return -EIO; ++ ++ // oob write ++ if (ops->mode == MTD_OPS_AUTO_OOB) { ++ //fixme, this path is not yet varified ++ nfc_read_oob(ra, page, 0, ra->buffers + pagesize, oobsize, FLAG_NONE); ++ } ++ if (oob && ooblen > 0) { ++ len = nand_write_oob_buf(ra, ra->buffers + pagesize, oob, ooblen, ops->mode, ops->ooboffs); ++ if (len < 0) ++ return -EINVAL; ++ ++ oob += len; ++ ops->oobretlen += len; ++ ooblen -= len; ++ } ++ ++ // data write ++ offs = addr & pagemask; ++ len = min_t(size_t, datalen, pagesize - offs); ++ if (data && len > 0) { ++ memcpy(ra->buffers + offs, data, len); // we can not sure ops->buf wether is DMA-able. ++ ++ data += len; ++ datalen -= len; ++ ops->retlen += len; ++ ++ ecc_en = FLAG_ECC_EN; ++ } ++ ret = nfc_write_page(ra, ra->buffers, page, FLAG_USE_GDMA | FLAG_VERIFY | ++ ((ops->mode == MTD_OPS_RAW || ops->mode == MTD_OPS_PLACE_OOB) ? 0 : ecc_en )); ++ if (ret) { ++ nand_bbt_set(ra, addr >> ra->erase_shift, BBT_TAG_BAD); ++ return ret; ++ } ++ ++ nand_bbt_set(ra, addr >> ra->erase_shift, BBT_TAG_GOOD); ++ ++ addr = (page+1) << ra->page_shift; ++ ++ } ++ return 0; ++} ++ ++/** ++ * nand_do_read_ops - [Internal] Read data with ECC ++ * ++ * @mtd: MTD device structure ++ * @from: offset to read from ++ * @ops: oob ops structure ++ * ++ * Internal function. Called with chip held. ++ */ ++static int nand_do_read_ops(struct ra_nand_chip *ra, loff_t from, ++ struct mtd_oob_ops *ops) ++{ ++ int page; ++ uint32_t datalen = ops->len; ++ uint32_t ooblen = ops->ooblen; ++ uint8_t *oob = ops->oobbuf; ++ uint8_t *data = ops->datbuf; ++ int pagesize = (1<page_shift); ++ int pagemask = (pagesize -1); ++ loff_t addr = from; ++ //int i = 0; //for ra_dbg only ++ ++ ra_dbg("%s: addr:%x, ops data:%p, oob:%p datalen:%x ooblen:%x, ooboffs:%x \n", ++ __func__, (unsigned int)addr, data, oob, datalen, ooblen, ops->ooboffs); ++ ++ ops->retlen = 0; ++ ops->oobretlen = 0; ++ if (data == 0) ++ datalen = 0; ++ ++ ++ while(datalen || ooblen) { ++ int len; ++ int ret; ++ int offs; ++ ++ ra_dbg("%s (%d): addr:%x, ops data:%p, oob:%p datalen:%x ooblen:%x, ooboffs:%x \n", ++ __func__, i++, (unsigned int)addr, data, oob, datalen, ooblen, ops->ooboffs); ++ /* select chip */ ++ if (nfc_enable_chip(ra, addr, 1) < 0) ++ return -EIO; ++ ++ page = (int)((addr & ((1<chip_shift)-1)) >> ra->page_shift); ++ ++ ret = nfc_read_page(ra, ra->buffers, page, FLAG_VERIFY | ++ ((ops->mode == MTD_OPS_RAW || ops->mode == MTD_OPS_PLACE_OOB) ? 0: FLAG_ECC_EN )); ++ //FIXME, something strange here, some page needs 2 more tries to guarantee read success. ++ if (ret) { ++ printk("read again:\n"); ++ ret = nfc_read_page(ra, ra->buffers, page, FLAG_VERIFY | ++ ((ops->mode == MTD_OPS_RAW || ops->mode == MTD_OPS_PLACE_OOB) ? 0: FLAG_ECC_EN )); ++ ++ if (ret) { ++ printk("read again fail \n"); ++ nand_bbt_set(ra, addr >> ra->erase_shift, BBT_TAG_BAD); ++ if ((ret != -EUCLEAN) && (ret != -EBADMSG)) { ++ return ret; ++ } ++ else { ++ /* ecc verification fail, but data need to be returned. */ ++ } ++ } ++ else { ++ printk(" read agian susccess \n"); ++ } ++ } ++ ++ // oob read ++ if (oob && ooblen > 0) { ++ len = nand_read_oob_buf(ra, oob, ooblen, ops->mode, ops->ooboffs); ++ if (len < 0) { ++ printk("nand_read_oob_buf: fail return %x \n", len); ++ return -EINVAL; ++ } ++ ++ oob += len; ++ ops->oobretlen += len; ++ ooblen -= len; ++ } ++ ++ // data read ++ offs = addr & pagemask; ++ len = min_t(size_t, datalen, pagesize - offs); ++ if (data && len > 0) { ++ memcpy(data, ra->buffers + offs, len); // we can not sure ops->buf wether is DMA-able. ++ ++ data += len; ++ datalen -= len; ++ ops->retlen += len; ++ if (ret) ++ return ret; ++ } ++ ++ ++ nand_bbt_set(ra, addr >> ra->erase_shift, BBT_TAG_GOOD); ++ // address go further to next page, instead of increasing of length of write. This avoids some special cases wrong. ++ addr = (page+1) << ra->page_shift; ++ } ++ return 0; ++} ++ ++static int ++ramtd_nand_erase(struct mtd_info *mtd, struct erase_info *instr) ++{ ++ struct ra_nand_chip *ra = (struct ra_nand_chip *)mtd->priv; ++ int ret; ++ ++ ra_dbg("%s: start:%x, len:%x \n", __func__, ++ (unsigned int)instr->addr, (unsigned int)instr->len); ++ ++ nand_get_device(ra, FL_ERASING); ++ ret = _nand_erase_nand((struct ra_nand_chip *)mtd->priv, instr); ++ nand_release_device(ra); ++ ++ return ret; ++} ++ ++static int ++ramtd_nand_write(struct mtd_info *mtd, loff_t to, size_t len, ++ size_t *retlen, const uint8_t *buf) ++{ ++ struct ra_nand_chip *ra = mtd->priv; ++ struct mtd_oob_ops ops; ++ int ret; ++ ++ ra_dbg("%s: to 0x%x len=0x%x\n", __func__, to, len); ++ ++ if ((to + len) > mtd->size) ++ return -EINVAL; ++ ++ if (!len) ++ return 0; ++ ++ nand_get_device(ra, FL_WRITING); ++ ++ memset(&ops, 0, sizeof(ops)); ++ ops.len = len; ++ ops.datbuf = (uint8_t *)buf; ++ ops.oobbuf = NULL; ++ ops.mode = MTD_OPS_AUTO_OOB; ++ ++ ret = nand_do_write_ops(ra, to, &ops); ++ ++ *retlen = ops.retlen; ++ ++ nand_release_device(ra); ++ ++ return ret; ++} ++ ++static int ++ramtd_nand_read(struct mtd_info *mtd, loff_t from, size_t len, ++ size_t *retlen, uint8_t *buf) ++{ ++ ++ struct ra_nand_chip *ra = mtd->priv; ++ int ret; ++ struct mtd_oob_ops ops; ++ ++ ra_dbg("%s: mtd:%p from:%x, len:%x, buf:%p \n", __func__, mtd, (unsigned int)from, len, buf); ++ ++ /* Do not allow reads past end of device */ ++ if ((from + len) > mtd->size) ++ return -EINVAL; ++ if (!len) ++ return 0; ++ ++ nand_get_device(ra, FL_READING); ++ ++ memset(&ops, 0, sizeof(ops)); ++ ops.len = len; ++ ops.datbuf = buf; ++ ops.oobbuf = NULL; ++ ops.mode = MTD_OPS_AUTO_OOB; ++ ++ ret = nand_do_read_ops(ra, from, &ops); ++ ++ *retlen = ops.retlen; ++ ++ nand_release_device(ra); ++ ++ return ret; ++ ++} ++ ++static int ++ramtd_nand_readoob(struct mtd_info *mtd, loff_t from, ++ struct mtd_oob_ops *ops) ++{ ++ struct ra_nand_chip *ra = mtd->priv; ++ int ret; ++ ++ ra_dbg("%s: \n", __func__); ++ ++ nand_get_device(ra, FL_READING); ++ ++ ret = nand_do_read_ops(ra, from, ops); ++ ++ nand_release_device(ra); ++ ++ return ret; ++} ++ ++static int ++ramtd_nand_writeoob(struct mtd_info *mtd, loff_t to, ++ struct mtd_oob_ops *ops) ++{ ++ struct ra_nand_chip *ra = mtd->priv; ++ int ret; ++ ++ nand_get_device(ra, FL_READING); ++ ret = nand_do_write_ops(ra, to, ops); ++ nand_release_device(ra); ++ ++ return ret; ++} ++ ++static int ++ramtd_nand_block_isbad(struct mtd_info *mtd, loff_t offs) ++{ ++ if (offs > mtd->size) ++ return -EINVAL; ++ ++ return nand_block_checkbad((struct ra_nand_chip *)mtd->priv, offs); ++} ++ ++static int ++ramtd_nand_block_markbad(struct mtd_info *mtd, loff_t ofs) ++{ ++ struct ra_nand_chip *ra = mtd->priv; ++ int ret; ++ ++ ra_dbg("%s: \n", __func__); ++ nand_get_device(ra, FL_WRITING); ++ ret = nand_block_markbad(ra, ofs); ++ nand_release_device(ra); ++ ++ return ret; ++} ++ ++// 1-bit error detection ++static int one_bit_correction(char *ecc1, char *ecc2, int *bytes, int *bits) ++{ ++ // check if ecc and expected are all valid ++ char *p, nibble, crumb; ++ int i, xor, iecc1 = 0, iecc2 = 0; ++ ++ printk("correction : %x %x %x\n", ecc1[0], ecc1[1], ecc1[2]); ++ printk("correction : %x %x %x\n", ecc2[0], ecc2[1], ecc2[2]); ++ ++ p = (char *)ecc1; ++ for (i = 0; i < CONFIG_ECC_BYTES; i++) ++ { ++ nibble = *(p+i) & 0xf; ++ if ((nibble != 0x0) && (nibble != 0xf) && (nibble != 0x3) && (nibble != 0xc) && ++ (nibble != 0x5) && (nibble != 0xa) && (nibble != 0x6) && (nibble != 0x9)) ++ return -1; ++ nibble = ((*(p+i)) >> 4) & 0xf; ++ if ((nibble != 0x0) && (nibble != 0xf) && (nibble != 0x3) && (nibble != 0xc) && ++ (nibble != 0x5) && (nibble != 0xa) && (nibble != 0x6) && (nibble != 0x9)) ++ return -1; ++ } ++ ++ p = (char *)ecc2; ++ for (i = 0; i < CONFIG_ECC_BYTES; i++) ++ { ++ nibble = *(p+i) & 0xf; ++ if ((nibble != 0x0) && (nibble != 0xf) && (nibble != 0x3) && (nibble != 0xc) && ++ (nibble != 0x5) && (nibble != 0xa) && (nibble != 0x6) && (nibble != 0x9)) ++ return -1; ++ nibble = ((*(p+i)) >> 4) & 0xf; ++ if ((nibble != 0x0) && (nibble != 0xf) && (nibble != 0x3) && (nibble != 0xc) && ++ (nibble != 0x5) && (nibble != 0xa) && (nibble != 0x6) && (nibble != 0x9)) ++ return -1; ++ } ++ ++ memcpy(&iecc1, ecc1, 3); ++ memcpy(&iecc2, ecc2, 3); ++ ++ xor = iecc1 ^ iecc2; ++ printk("xor = %x (%x %x)\n", xor, iecc1, iecc2); ++ ++ *bytes = 0; ++ for (i = 0; i < 9; i++) ++ { ++ crumb = (xor >> (2*i)) & 0x3; ++ if ((crumb == 0x0) || (crumb == 0x3)) ++ return -1; ++ if (crumb == 0x2) ++ *bytes += (1 << i); ++ } ++ ++ *bits = 0; ++ for (i = 0; i < 3; i++) ++ { ++ crumb = (xor >> (18 + 2*i)) & 0x3; ++ if ((crumb == 0x0) || (crumb == 0x3)) ++ return -1; ++ if (crumb == 0x2) ++ *bits += (1 << i); ++ } ++ ++ return 0; ++} ++ ++ ++ ++/************************************************************ ++ * the init/exit section. ++ */ ++ ++static struct nand_ecclayout ra_oob_layout = { ++ .eccbytes = CONFIG_ECC_BYTES, ++ .eccpos = {5, 6, 7}, ++ .oobfree = { ++ {.offset = 0, .length = 4}, ++ {.offset = 8, .length = 8}, ++ {.offset = 0, .length = 0} ++ }, ++#define RA_CHIP_OOB_AVAIL (4+8) ++ .oobavail = RA_CHIP_OOB_AVAIL, ++ // 5th byte is bad-block flag. ++}; ++ ++static int ++mtk_nand_probe(struct platform_device *pdev) ++{ ++ struct mtd_part_parser_data ppdata; ++ struct ra_nand_chip *ra; ++ int alloc_size, bbt_size, buffers_size, reg, err; ++ unsigned char chip_mode = 12; ++ ++/* if(ra_check_flash_type()!=BOOT_FROM_NAND) { ++ return 0; ++ }*/ ++ ++ //FIXME: config 512 or 2048-byte page according to HWCONF ++#if defined (CONFIG_RALINK_RT6855A) ++ reg = ra_inl(RALINK_SYSCTL_BASE+0x8c); ++ chip_mode = ((reg>>28) & 0x3)|(((reg>>22) & 0x3)<<2); ++ if (chip_mode == 1) { ++ printk("! nand 2048\n"); ++ ra_or(NFC_CONF1, 1); ++ is_nand_page_2048 = 1; ++ nand_addrlen = 5; ++ } ++ else { ++ printk("! nand 512\n"); ++ ra_and(NFC_CONF1, ~1); ++ is_nand_page_2048 = 0; ++ nand_addrlen = 4; ++ } ++#elif (defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_RT6855)) ++ ra_outl(RALINK_SYSCTL_BASE+0x60, ra_inl(RALINK_SYSCTL_BASE+0x60) & ~(0x3<<18)); ++ reg = ra_inl(RALINK_SYSCTL_BASE+0x10); ++ chip_mode = (reg & 0x0F); ++ if((chip_mode==1)||(chip_mode==11)) { ++ ra_or(NFC_CONF1, 1); ++ is_nand_page_2048 = 1; ++ nand_addrlen = ((chip_mode!=11) ? 4 : 5); ++ printk("!!! nand page size = 2048, addr len=%d\n", nand_addrlen); ++ } ++ else { ++ ra_and(NFC_CONF1, ~1); ++ is_nand_page_2048 = 0; ++ nand_addrlen = ((chip_mode!=10) ? 3 : 4); ++ printk("!!! nand page size = 512, addr len=%d\n", nand_addrlen); ++ } ++#else ++ is_nand_page_2048 = 0; ++ nand_addrlen = 3; ++ printk("!!! nand page size = 512, addr len=%d\n", nand_addrlen); ++#endif ++ ++#if defined (CONFIG_RALINK_RT6855A) || defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_RT6855) ++ //config ECC location ++ ra_and(NFC_CONF1, 0xfff000ff); ++ ra_or(NFC_CONF1, ((CONFIG_ECC_OFFSET + 2) << 16) + ++ ((CONFIG_ECC_OFFSET + 1) << 12) + ++ (CONFIG_ECC_OFFSET << 8)); ++#endif ++ ++#define ALIGNE_16(a) (((unsigned long)(a)+15) & ~15) ++ buffers_size = ALIGNE_16((1<buffers ++ bbt_size = BBTTAG_BITS * (1<<(CONFIG_CHIP_SIZE_BIT - (CONFIG_PAGE_SIZE_BIT + CONFIG_NUMPAGE_PER_BLOCK_BIT))) / 8; //ra->bbt ++ bbt_size = ALIGNE_16(bbt_size); ++ ++ alloc_size = buffers_size + bbt_size; ++ alloc_size += buffers_size; //for ra->readback_buffers ++ alloc_size += sizeof(*ra); ++ alloc_size += sizeof(*ranfc_mtd); ++ ++ //make sure gpio-0 is input ++ ra_outl(RALINK_PIO_BASE+0x24, ra_inl(RALINK_PIO_BASE+0x24) & ~0x01); ++ ++ ra = (struct ra_nand_chip *)kzalloc(alloc_size, GFP_KERNEL | GFP_DMA); ++ if (!ra) { ++ printk("%s: mem alloc fail \n", __func__); ++ return -ENOMEM; ++ } ++ memset(ra, 0, alloc_size); ++ ++ //dynamic ++ ra->buffers = (char *)((char *)ra + sizeof(*ra)); ++ ra->readback_buffers = ra->buffers + buffers_size; ++ ra->bbt = ra->readback_buffers + buffers_size; ++ ranfc_mtd = (struct mtd_info *)(ra->bbt + bbt_size); ++ ++ //static ++ ra->numchips = CONFIG_NUMCHIPS; ++ ra->chip_shift = CONFIG_CHIP_SIZE_BIT; ++ ra->page_shift = CONFIG_PAGE_SIZE_BIT; ++ ra->oob_shift = CONFIG_OOBSIZE_PER_PAGE_BIT; ++ ra->erase_shift = (CONFIG_PAGE_SIZE_BIT + CONFIG_NUMPAGE_PER_BLOCK_BIT); ++ ra->badblockpos = CONFIG_BAD_BLOCK_POS; ++ ra_oob_layout.eccpos[0] = CONFIG_ECC_OFFSET; ++ ra_oob_layout.eccpos[1] = CONFIG_ECC_OFFSET + 1; ++ ra_oob_layout.eccpos[2] = CONFIG_ECC_OFFSET + 2; ++ ra->oob = &ra_oob_layout; ++ ra->buffers_page = -1; ++ ++#if defined (WORKAROUND_RX_BUF_OV) ++ if (ranfc_verify) { ++ ra->sandbox_page = nand_bbt_find_sandbox(ra); ++ } ++#endif ++ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) | 0x01); //set wp to high ++ nfc_all_reset(); ++ ++ ranfc_mtd->type = MTD_NANDFLASH; ++ ranfc_mtd->flags = MTD_CAP_NANDFLASH; ++ ranfc_mtd->size = CONFIG_NUMCHIPS * CFG_CHIPSIZE; ++ ranfc_mtd->erasesize = CFG_BLOCKSIZE; ++ ranfc_mtd->writesize = CFG_PAGESIZE; ++ ranfc_mtd->oobsize = CFG_PAGE_OOBSIZE; ++ ranfc_mtd->oobavail = RA_CHIP_OOB_AVAIL; ++ ranfc_mtd->name = "ra_nfc"; ++ //ranfc_mtd->index ++ ranfc_mtd->ecclayout = &ra_oob_layout; ++ //ranfc_mtd->numberaseregions ++ //ranfc_mtd->eraseregions ++ //ranfc_mtd->bansize ++ ranfc_mtd->_erase = ramtd_nand_erase; ++ //ranfc_mtd->point ++ //ranfc_mtd->unpoint ++ ranfc_mtd->_read = ramtd_nand_read; ++ ranfc_mtd->_write = ramtd_nand_write; ++ ranfc_mtd->_read_oob = ramtd_nand_readoob; ++ ranfc_mtd->_write_oob = ramtd_nand_writeoob; ++ //ranfc_mtd->get_fact_prot_info; ranfc_mtd->read_fact_prot_reg; ++ //ranfc_mtd->get_user_prot_info; ranfc_mtd->read_user_prot_reg; ++ //ranfc_mtd->write_user_prot_reg; ranfc_mtd->lock_user_prot_reg; ++ //ranfc_mtd->writev; ranfc_mtd->sync; ranfc_mtd->lock; ranfc_mtd->unlock; ranfc_mtd->suspend; ranfc_mtd->resume; ++ ranfc_mtd->_block_isbad = ramtd_nand_block_isbad; ++ ranfc_mtd->_block_markbad = ramtd_nand_block_markbad; ++ //ranfc_mtd->reboot_notifier ++ //ranfc_mtd->ecc_stats; ++ // subpage_sht; ++ ++ //ranfc_mtd->get_device; ranfc_mtd->put_device ++ ranfc_mtd->priv = ra; ++ ++ ranfc_mtd->owner = THIS_MODULE; ++ ra->controller = &ra->hwcontrol; ++ mutex_init(ra->controller); ++ ++ printk("%s: alloc %x, at %p , btt(%p, %x), ranfc_mtd:%p\n", ++ __func__ , alloc_size, ra, ra->bbt, bbt_size, ranfc_mtd); ++ ++ ppdata.of_node = pdev->dev.of_node; ++ err = mtd_device_parse_register(ranfc_mtd, mtk_probe_types, ++ &ppdata, NULL, 0); ++ ++ return err; ++} ++ ++static int ++mtk_nand_remove(struct platform_device *pdev) ++{ ++ struct ra_nand_chip *ra; ++ ++ if (ranfc_mtd) { ++ ra = (struct ra_nand_chip *)ranfc_mtd->priv; ++ ++ /* Deregister partitions */ ++ //del_mtd_partitions(ranfc_mtd); ++ kfree(ra); ++ } ++ return 0; ++} ++ ++static const struct of_device_id mtk_nand_match[] = { ++ { .compatible = "mtk,mt7620-nand" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mtk_nand_match); ++ ++static struct platform_driver mtk_nand_driver = { ++ .probe = mtk_nand_probe, ++ .remove = mtk_nand_remove, ++ .driver = { ++ .name = "mt7620_nand", ++ .owner = THIS_MODULE, ++ .of_match_table = mtk_nand_match, ++ }, ++}; ++ ++module_platform_driver(mtk_nand_driver); ++ ++ ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/mtd/maps/ralink_nand.h +@@ -0,0 +1,232 @@ ++#ifndef RT2880_NAND_H ++#define RT2880_NAND_H ++ ++#include ++ ++//#include "gdma.h" ++ ++#define RALINK_SYSCTL_BASE 0xB0000000 ++#define RALINK_PIO_BASE 0xB0000600 ++#define RALINK_NAND_CTRL_BASE 0xB0000810 ++#define CONFIG_RALINK_MT7620 ++ ++#define SKIP_BAD_BLOCK ++//#define RANDOM_GEN_BAD_BLOCK ++ ++#define ra_inl(addr) (*(volatile unsigned int *)(addr)) ++#define ra_outl(addr, value) (*(volatile unsigned int *)(addr) = (value)) ++#define ra_aor(addr, a_mask, o_value) ra_outl(addr, (ra_inl(addr) & (a_mask)) | (o_value)) ++#define ra_and(addr, a_mask) ra_aor(addr, a_mask, 0) ++#define ra_or(addr, o_value) ra_aor(addr, -1, o_value) ++ ++ ++#define CONFIG_NUMCHIPS 1 ++#define CONFIG_NOT_SUPPORT_WP //rt3052 has no WP signal for chip. ++//#define CONFIG_NOT_SUPPORT_RB ++ ++extern int is_nand_page_2048; ++extern const unsigned int nand_size_map[2][3]; ++ ++//chip ++// chip geometry: SAMSUNG small size 32MB. ++#define CONFIG_CHIP_SIZE_BIT (nand_size_map[is_nand_page_2048][nand_addrlen-3]) //! (1<=32)? 31 : CONFIG_CHIP_SIZE_BIT)) ++//#define CFG_CHIPSIZE (1 << CONFIG_CHIP_SIZE_BIT) ++#define CFG_PAGESIZE (1 << CONFIG_PAGE_SIZE_BIT) ++#define CFG_BLOCKSIZE (CFG_PAGESIZE << CONFIG_NUMPAGE_PER_BLOCK_BIT) ++#define CFG_NUMPAGE (1 << (CONFIG_CHIP_SIZE_BIT - CONFIG_PAGE_SIZE_BIT)) ++#define CFG_NUMBLOCK (CFG_NUMPAGE >> CONFIG_NUMPAGE_PER_BLOCK_BIT) ++#define CFG_BLOCK_OOBSIZE (1 << (CONFIG_OOBSIZE_PER_PAGE_BIT + CONFIG_NUMPAGE_PER_BLOCK_BIT)) ++#define CFG_PAGE_OOBSIZE (1 << CONFIG_OOBSIZE_PER_PAGE_BIT) ++ ++#define NAND_BLOCK_ALIGN(addr) ((addr) & (CFG_BLOCKSIZE-1)) ++#define NAND_PAGE_ALIGN(addr) ((addr) & (CFG_PAGESIZE-1)) ++ ++ ++#define NFC_BASE RALINK_NAND_CTRL_BASE ++#define NFC_CTRL (NFC_BASE + 0x0) ++#define NFC_CONF (NFC_BASE + 0x4) ++#define NFC_CMD1 (NFC_BASE + 0x8) ++#define NFC_CMD2 (NFC_BASE + 0xc) ++#define NFC_CMD3 (NFC_BASE + 0x10) ++#define NFC_ADDR (NFC_BASE + 0x14) ++#define NFC_DATA (NFC_BASE + 0x18) ++#if defined (CONFIG_RALINK_RT6855) || defined (CONFIG_RALINK_RT6855A) || \ ++ defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) ++#define NFC_ECC (NFC_BASE + 0x30) ++#else ++#define NFC_ECC (NFC_BASE + 0x1c) ++#endif ++#define NFC_STATUS (NFC_BASE + 0x20) ++#define NFC_INT_EN (NFC_BASE + 0x24) ++#define NFC_INT_ST (NFC_BASE + 0x28) ++#if defined (CONFIG_RALINK_RT6855) || defined (CONFIG_RALINK_RT6855A) || \ ++ defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) ++#define NFC_CONF1 (NFC_BASE + 0x2c) ++#define NFC_ECC_P1 (NFC_BASE + 0x30) ++#define NFC_ECC_P2 (NFC_BASE + 0x34) ++#define NFC_ECC_P3 (NFC_BASE + 0x38) ++#define NFC_ECC_P4 (NFC_BASE + 0x3c) ++#define NFC_ECC_ERR1 (NFC_BASE + 0x40) ++#define NFC_ECC_ERR2 (NFC_BASE + 0x44) ++#define NFC_ECC_ERR3 (NFC_BASE + 0x48) ++#define NFC_ECC_ERR4 (NFC_BASE + 0x4c) ++#define NFC_ADDR2 (NFC_BASE + 0x50) ++#endif ++ ++enum _int_stat { ++ INT_ST_ND_DONE = 1<<0, ++ INT_ST_TX_BUF_RDY = 1<<1, ++ INT_ST_RX_BUF_RDY = 1<<2, ++ INT_ST_ECC_ERR = 1<<3, ++ INT_ST_TX_TRAS_ERR = 1<<4, ++ INT_ST_RX_TRAS_ERR = 1<<5, ++ INT_ST_TX_KICK_ERR = 1<<6, ++ INT_ST_RX_KICK_ERR = 1<<7 ++}; ++ ++ ++//#define WORKAROUND_RX_BUF_OV 1 ++ ++ ++/************************************************************* ++ * stolen from nand.h ++ *************************************************************/ ++ ++/* ++ * Standard NAND flash commands ++ */ ++#define NAND_CMD_READ0 0 ++#define NAND_CMD_READ1 1 ++#define NAND_CMD_RNDOUT 5 ++#define NAND_CMD_PAGEPROG 0x10 ++#define NAND_CMD_READOOB 0x50 ++#define NAND_CMD_ERASE1 0x60 ++#define NAND_CMD_STATUS 0x70 ++#define NAND_CMD_STATUS_MULTI 0x71 ++#define NAND_CMD_SEQIN 0x80 ++#define NAND_CMD_RNDIN 0x85 ++#define NAND_CMD_READID 0x90 ++#define NAND_CMD_ERASE2 0xd0 ++#define NAND_CMD_RESET 0xff ++ ++/* Extended commands for large page devices */ ++#define NAND_CMD_READSTART 0x30 ++#define NAND_CMD_RNDOUTSTART 0xE0 ++#define NAND_CMD_CACHEDPROG 0x15 ++ ++/* Extended commands for AG-AND device */ ++/* ++ * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but ++ * there is no way to distinguish that from NAND_CMD_READ0 ++ * until the remaining sequence of commands has been completed ++ * so add a high order bit and mask it off in the command. ++ */ ++#define NAND_CMD_DEPLETE1 0x100 ++#define NAND_CMD_DEPLETE2 0x38 ++#define NAND_CMD_STATUS_MULTI 0x71 ++#define NAND_CMD_STATUS_ERROR 0x72 ++/* multi-bank error status (banks 0-3) */ ++#define NAND_CMD_STATUS_ERROR0 0x73 ++#define NAND_CMD_STATUS_ERROR1 0x74 ++#define NAND_CMD_STATUS_ERROR2 0x75 ++#define NAND_CMD_STATUS_ERROR3 0x76 ++#define NAND_CMD_STATUS_RESET 0x7f ++#define NAND_CMD_STATUS_CLEAR 0xff ++ ++#define NAND_CMD_NONE -1 ++ ++/* Status bits */ ++#define NAND_STATUS_FAIL 0x01 ++#define NAND_STATUS_FAIL_N1 0x02 ++#define NAND_STATUS_TRUE_READY 0x20 ++#define NAND_STATUS_READY 0x40 ++#define NAND_STATUS_WP 0x80 ++ ++typedef enum { ++ FL_READY, ++ FL_READING, ++ FL_WRITING, ++ FL_ERASING, ++ FL_SYNCING, ++ FL_CACHEDPRG, ++ FL_PM_SUSPENDED, ++} nand_state_t; ++ ++/*************************************************************/ ++ ++ ++ ++typedef enum _ra_flags { ++ FLAG_NONE = 0, ++ FLAG_ECC_EN = (1<<0), ++ FLAG_USE_GDMA = (1<<1), ++ FLAG_VERIFY = (1<<2), ++} RA_FLAGS; ++ ++ ++#define BBTTAG_BITS 2 ++#define BBTTAG_BITS_MASK ((1< +Date: Sun, 27 Jul 2014 11:05:17 +0100 +Subject: [PATCH 39/53] mtd: add mt7621 nand support + +Signed-off-by: John Crispin +--- + drivers/mtd/nand/Kconfig | 6 + + drivers/mtd/nand/Makefile | 1 + + drivers/mtd/nand/bmt.c | 750 ++++++++++++ + drivers/mtd/nand/bmt.h | 80 ++ + drivers/mtd/nand/dev-nand.c | 63 + + drivers/mtd/nand/mt6575_typedefs.h | 340 ++++++ + drivers/mtd/nand/mtk_nand.c | 2304 +++++++++++++++++++++++++++++++++++ + drivers/mtd/nand/mtk_nand.h | 452 +++++++ + drivers/mtd/nand/nand_base.c | 6 +- + drivers/mtd/nand/nand_bbt.c | 19 + + drivers/mtd/nand/nand_def.h | 123 ++ + drivers/mtd/nand/nand_device_list.h | 55 + + drivers/mtd/nand/partition.h | 115 ++ + 13 files changed, 4311 insertions(+), 3 deletions(-) + create mode 100644 drivers/mtd/nand/bmt.c + create mode 100644 drivers/mtd/nand/bmt.h + create mode 100644 drivers/mtd/nand/dev-nand.c + create mode 100644 drivers/mtd/nand/mt6575_typedefs.h + create mode 100644 drivers/mtd/nand/mtk_nand.c + create mode 100644 drivers/mtd/nand/mtk_nand.h + create mode 100644 drivers/mtd/nand/nand_def.h + create mode 100644 drivers/mtd/nand/nand_device_list.h + create mode 100644 drivers/mtd/nand/partition.h + +--- a/drivers/mtd/nand/Kconfig ++++ b/drivers/mtd/nand/Kconfig +@@ -546,4 +546,10 @@ config MTD_NAND_HISI504 + help + Enables support for NAND controller on Hisilicon SoC Hip04. + ++config MTK_MTD_NAND ++ tristate "Support for MTK SoC NAND controller" ++ depends on SOC_MT7621 ++ select MTD_NAND_IDS ++ select MTD_NAND_ECC ++ + endif # MTD_NAND +--- a/drivers/mtd/nand/Makefile ++++ b/drivers/mtd/nand/Makefile +@@ -55,5 +55,6 @@ obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH) += + obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o + obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o + obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/ ++obj-$(CONFIG_MTK_MTD_NAND) += mtk_nand.o bmt.o + + nand-objs := nand_base.o nand_bbt.o nand_timings.o +--- /dev/null ++++ b/drivers/mtd/nand/bmt.c +@@ -0,0 +1,750 @@ ++#include "bmt.h" ++ ++typedef struct ++{ ++ char signature[3]; ++ u8 version; ++ u8 bad_count; // bad block count in pool ++ u8 mapped_count; // mapped block count in pool ++ u8 checksum; ++ u8 reseverd[13]; ++} phys_bmt_header; ++ ++typedef struct ++{ ++ phys_bmt_header header; ++ bmt_entry table[MAX_BMT_SIZE]; ++} phys_bmt_struct; ++ ++typedef struct ++{ ++ char signature[3]; ++} bmt_oob_data; ++ ++static char MAIN_SIGNATURE[] = "BMT"; ++static char OOB_SIGNATURE[] = "bmt"; ++#define SIGNATURE_SIZE (3) ++ ++#define MAX_DAT_SIZE 0x1000 ++#define MAX_OOB_SIZE 0x80 ++ ++static struct mtd_info *mtd_bmt; ++static struct nand_chip *nand_chip_bmt; ++#define BLOCK_SIZE_BMT (1 << nand_chip_bmt->phys_erase_shift) ++#define PAGE_SIZE_BMT (1 << nand_chip_bmt->page_shift) ++ ++#define OFFSET(block) ((block) * BLOCK_SIZE_BMT) ++#define PAGE_ADDR(block) ((block) * BLOCK_SIZE_BMT / PAGE_SIZE_BMT) ++ ++/********************************************************************* ++* Flash is splited into 2 parts, system part is for normal system * ++* system usage, size is system_block_count, another is replace pool * ++* +-------------------------------------------------+ * ++* | system_block_count | bmt_block_count | * ++* +-------------------------------------------------+ * ++*********************************************************************/ ++static u32 total_block_count; // block number in flash ++static u32 system_block_count; ++static int bmt_block_count; // bmt table size ++// static int bmt_count; // block used in bmt ++static int page_per_block; // page per count ++ ++static u32 bmt_block_index; // bmt block index ++static bmt_struct bmt; // dynamic created global bmt table ++ ++static u8 dat_buf[MAX_DAT_SIZE]; ++static u8 oob_buf[MAX_OOB_SIZE]; ++static bool pool_erased; ++ ++/*************************************************************** ++* ++* Interface adaptor for preloader/uboot/kernel ++* These interfaces operate on physical address, read/write ++* physical data. ++* ++***************************************************************/ ++int nand_read_page_bmt(u32 page, u8 * dat, u8 * oob) ++{ ++ return mtk_nand_exec_read_page(mtd_bmt, page, PAGE_SIZE_BMT, dat, oob); ++} ++ ++bool nand_block_bad_bmt(u32 offset) ++{ ++ return mtk_nand_block_bad_hw(mtd_bmt, offset); ++} ++ ++bool nand_erase_bmt(u32 offset) ++{ ++ int status; ++ if (offset < 0x20000) ++ { ++ MSG(INIT, "erase offset: 0x%x\n", offset); ++ } ++ ++ status = mtk_nand_erase_hw(mtd_bmt, offset / PAGE_SIZE_BMT); // as nand_chip structure doesn't have a erase function defined ++ if (status & NAND_STATUS_FAIL) ++ return false; ++ else ++ return true; ++} ++ ++int mark_block_bad_bmt(u32 offset) ++{ ++ return mtk_nand_block_markbad_hw(mtd_bmt, offset); //mark_block_bad_hw(offset); ++} ++ ++bool nand_write_page_bmt(u32 page, u8 * dat, u8 * oob) ++{ ++ if (mtk_nand_exec_write_page(mtd_bmt, page, PAGE_SIZE_BMT, dat, oob)) ++ return false; ++ else ++ return true; ++} ++ ++/*************************************************************** ++* * ++* static internal function * ++* * ++***************************************************************/ ++static void dump_bmt_info(bmt_struct * bmt) ++{ ++ int i; ++ ++ MSG(INIT, "BMT v%d. total %d mapping:\n", bmt->version, bmt->mapped_count); ++ for (i = 0; i < bmt->mapped_count; i++) ++ { ++ MSG(INIT, "\t0x%x -> 0x%x\n", bmt->table[i].bad_index, bmt->table[i].mapped_index); ++ } ++} ++ ++static bool match_bmt_signature(u8 * dat, u8 * oob) ++{ ++ ++ if (memcmp(dat + MAIN_SIGNATURE_OFFSET, MAIN_SIGNATURE, SIGNATURE_SIZE)) ++ { ++ return false; ++ } ++ ++ if (memcmp(oob + OOB_SIGNATURE_OFFSET, OOB_SIGNATURE, SIGNATURE_SIZE)) ++ { ++ MSG(INIT, "main signature match, oob signature doesn't match, but ignore\n"); ++ } ++ return true; ++} ++ ++static u8 cal_bmt_checksum(phys_bmt_struct * phys_table, int bmt_size) ++{ ++ int i; ++ u8 checksum = 0; ++ u8 *dat = (u8 *) phys_table; ++ ++ checksum += phys_table->header.version; ++ checksum += phys_table->header.mapped_count; ++ ++ dat += sizeof(phys_bmt_header); ++ for (i = 0; i < bmt_size * sizeof(bmt_entry); i++) ++ { ++ checksum += dat[i]; ++ } ++ ++ return checksum; ++} ++ ++ ++static int is_block_mapped(int index) ++{ ++ int i; ++ for (i = 0; i < bmt.mapped_count; i++) ++ { ++ if (index == bmt.table[i].mapped_index) ++ return i; ++ } ++ return -1; ++} ++ ++static bool is_page_used(u8 * dat, u8 * oob) ++{ ++ return ((oob[OOB_INDEX_OFFSET] != 0xFF) || (oob[OOB_INDEX_OFFSET + 1] != 0xFF)); ++} ++ ++static bool valid_bmt_data(phys_bmt_struct * phys_table) ++{ ++ int i; ++ u8 checksum = cal_bmt_checksum(phys_table, bmt_block_count); ++ ++ // checksum correct? ++ if (phys_table->header.checksum != checksum) ++ { ++ MSG(INIT, "BMT Data checksum error: %x %x\n", phys_table->header.checksum, checksum); ++ return false; ++ } ++ ++ MSG(INIT, "BMT Checksum is: 0x%x\n", phys_table->header.checksum); ++ ++ // block index correct? ++ for (i = 0; i < phys_table->header.mapped_count; i++) ++ { ++ if (phys_table->table[i].bad_index >= total_block_count || phys_table->table[i].mapped_index >= total_block_count || phys_table->table[i].mapped_index < system_block_count) ++ { ++ MSG(INIT, "index error: bad_index: %d, mapped_index: %d\n", phys_table->table[i].bad_index, phys_table->table[i].mapped_index); ++ return false; ++ } ++ } ++ ++ // pass check, valid bmt. ++ MSG(INIT, "Valid BMT, version v%d\n", phys_table->header.version); ++ return true; ++} ++ ++static void fill_nand_bmt_buffer(bmt_struct * bmt, u8 * dat, u8 * oob) ++{ ++ phys_bmt_struct phys_bmt; ++ ++ dump_bmt_info(bmt); ++ ++ // fill phys_bmt_struct structure with bmt_struct ++ memset(&phys_bmt, 0xFF, sizeof(phys_bmt)); ++ ++ memcpy(phys_bmt.header.signature, MAIN_SIGNATURE, SIGNATURE_SIZE); ++ phys_bmt.header.version = BMT_VERSION; ++ // phys_bmt.header.bad_count = bmt->bad_count; ++ phys_bmt.header.mapped_count = bmt->mapped_count; ++ memcpy(phys_bmt.table, bmt->table, sizeof(bmt_entry) * bmt_block_count); ++ ++ phys_bmt.header.checksum = cal_bmt_checksum(&phys_bmt, bmt_block_count); ++ ++ memcpy(dat + MAIN_SIGNATURE_OFFSET, &phys_bmt, sizeof(phys_bmt)); ++ memcpy(oob + OOB_SIGNATURE_OFFSET, OOB_SIGNATURE, SIGNATURE_SIZE); ++} ++ ++// return valid index if found BMT, else return 0 ++static int load_bmt_data(int start, int pool_size) ++{ ++ int bmt_index = start + pool_size - 1; // find from the end ++ phys_bmt_struct phys_table; ++ int i; ++ ++ MSG(INIT, "[%s]: begin to search BMT from block 0x%x\n", __FUNCTION__, bmt_index); ++ ++ for (bmt_index = start + pool_size - 1; bmt_index >= start; bmt_index--) ++ { ++ if (nand_block_bad_bmt(OFFSET(bmt_index))) ++ { ++ MSG(INIT, "Skip bad block: %d\n", bmt_index); ++ continue; ++ } ++ ++ if (!nand_read_page_bmt(PAGE_ADDR(bmt_index), dat_buf, oob_buf)) ++ { ++ MSG(INIT, "Error found when read block %d\n", bmt_index); ++ continue; ++ } ++ ++ if (!match_bmt_signature(dat_buf, oob_buf)) ++ { ++ continue; ++ } ++ ++ MSG(INIT, "Match bmt signature @ block: 0x%x\n", bmt_index); ++ ++ memcpy(&phys_table, dat_buf + MAIN_SIGNATURE_OFFSET, sizeof(phys_table)); ++ ++ if (!valid_bmt_data(&phys_table)) ++ { ++ MSG(INIT, "BMT data is not correct %d\n", bmt_index); ++ continue; ++ } else ++ { ++ bmt.mapped_count = phys_table.header.mapped_count; ++ bmt.version = phys_table.header.version; ++ // bmt.bad_count = phys_table.header.bad_count; ++ memcpy(bmt.table, phys_table.table, bmt.mapped_count * sizeof(bmt_entry)); ++ ++ MSG(INIT, "bmt found at block: %d, mapped block: %d\n", bmt_index, bmt.mapped_count); ++ ++ for (i = 0; i < bmt.mapped_count; i++) ++ { ++ if (!nand_block_bad_bmt(OFFSET(bmt.table[i].bad_index))) ++ { ++ MSG(INIT, "block 0x%x is not mark bad, should be power lost last time\n", bmt.table[i].bad_index); ++ mark_block_bad_bmt(OFFSET(bmt.table[i].bad_index)); ++ } ++ } ++ ++ return bmt_index; ++ } ++ } ++ ++ MSG(INIT, "bmt block not found!\n"); ++ return 0; ++} ++ ++/************************************************************************* ++* Find an available block and erase. * ++* start_from_end: if true, find available block from end of flash. * ++* else, find from the beginning of the pool * ++* need_erase: if true, all unmapped blocks in the pool will be erased * ++*************************************************************************/ ++static int find_available_block(bool start_from_end) ++{ ++ int i; // , j; ++ int block = system_block_count; ++ int direction; ++ // int avail_index = 0; ++ MSG(INIT, "Try to find_available_block, pool_erase: %d\n", pool_erased); ++ ++ // erase all un-mapped blocks in pool when finding avaliable block ++ if (!pool_erased) ++ { ++ MSG(INIT, "Erase all un-mapped blocks in pool\n"); ++ for (i = 0; i < bmt_block_count; i++) ++ { ++ if (block == bmt_block_index) ++ { ++ MSG(INIT, "Skip bmt block 0x%x\n", block); ++ continue; ++ } ++ ++ if (nand_block_bad_bmt(OFFSET(block + i))) ++ { ++ MSG(INIT, "Skip bad block 0x%x\n", block + i); ++ continue; ++ } ++//if(block==4095) ++//{ ++// continue; ++//} ++ ++ if (is_block_mapped(block + i) >= 0) ++ { ++ MSG(INIT, "Skip mapped block 0x%x\n", block + i); ++ continue; ++ } ++ ++ if (!nand_erase_bmt(OFFSET(block + i))) ++ { ++ MSG(INIT, "Erase block 0x%x failed\n", block + i); ++ mark_block_bad_bmt(OFFSET(block + i)); ++ } ++ } ++ ++ pool_erased = 1; ++ } ++ ++ if (start_from_end) ++ { ++ block = total_block_count - 1; ++ direction = -1; ++ } else ++ { ++ block = system_block_count; ++ direction = 1; ++ } ++ ++ for (i = 0; i < bmt_block_count; i++, block += direction) ++ { ++ if (block == bmt_block_index) ++ { ++ MSG(INIT, "Skip bmt block 0x%x\n", block); ++ continue; ++ } ++ ++ if (nand_block_bad_bmt(OFFSET(block))) ++ { ++ MSG(INIT, "Skip bad block 0x%x\n", block); ++ continue; ++ } ++ ++ if (is_block_mapped(block) >= 0) ++ { ++ MSG(INIT, "Skip mapped block 0x%x\n", block); ++ continue; ++ } ++ ++ MSG(INIT, "Find block 0x%x available\n", block); ++ return block; ++ } ++ ++ return 0; ++} ++ ++static unsigned short get_bad_index_from_oob(u8 * oob_buf) ++{ ++ unsigned short index; ++ memcpy(&index, oob_buf + OOB_INDEX_OFFSET, OOB_INDEX_SIZE); ++ ++ return index; ++} ++ ++void set_bad_index_to_oob(u8 * oob, u16 index) ++{ ++ memcpy(oob + OOB_INDEX_OFFSET, &index, sizeof(index)); ++} ++ ++static int migrate_from_bad(int offset, u8 * write_dat, u8 * write_oob) ++{ ++ int page; ++ int error_block = offset / BLOCK_SIZE_BMT; ++ int error_page = (offset / PAGE_SIZE_BMT) % page_per_block; ++ int to_index; ++ ++ memcpy(oob_buf, write_oob, MAX_OOB_SIZE); ++ ++ to_index = find_available_block(false); ++ ++ if (!to_index) ++ { ++ MSG(INIT, "Cannot find an available block for BMT\n"); ++ return 0; ++ } ++ ++ { // migrate error page first ++ MSG(INIT, "Write error page: 0x%x\n", error_page); ++ if (!write_dat) ++ { ++ nand_read_page_bmt(PAGE_ADDR(error_block) + error_page, dat_buf, NULL); ++ write_dat = dat_buf; ++ } ++ // memcpy(oob_buf, write_oob, MAX_OOB_SIZE); ++ ++ if (error_block < system_block_count) ++ set_bad_index_to_oob(oob_buf, error_block); // if error_block is already a mapped block, original mapping index is in OOB. ++ ++ if (!nand_write_page_bmt(PAGE_ADDR(to_index) + error_page, write_dat, oob_buf)) ++ { ++ MSG(INIT, "Write to page 0x%x fail\n", PAGE_ADDR(to_index) + error_page); ++ mark_block_bad_bmt(to_index); ++ return migrate_from_bad(offset, write_dat, write_oob); ++ } ++ } ++ ++ for (page = 0; page < page_per_block; page++) ++ { ++ if (page != error_page) ++ { ++ nand_read_page_bmt(PAGE_ADDR(error_block) + page, dat_buf, oob_buf); ++ if (is_page_used(dat_buf, oob_buf)) ++ { ++ if (error_block < system_block_count) ++ { ++ set_bad_index_to_oob(oob_buf, error_block); ++ } ++ MSG(INIT, "\tmigrate page 0x%x to page 0x%x\n", PAGE_ADDR(error_block) + page, PAGE_ADDR(to_index) + page); ++ if (!nand_write_page_bmt(PAGE_ADDR(to_index) + page, dat_buf, oob_buf)) ++ { ++ MSG(INIT, "Write to page 0x%x fail\n", PAGE_ADDR(to_index) + page); ++ mark_block_bad_bmt(to_index); ++ return migrate_from_bad(offset, write_dat, write_oob); ++ } ++ } ++ } ++ } ++ ++ MSG(INIT, "Migrate from 0x%x to 0x%x done!\n", error_block, to_index); ++ ++ return to_index; ++} ++ ++static bool write_bmt_to_flash(u8 * dat, u8 * oob) ++{ ++ bool need_erase = true; ++ MSG(INIT, "Try to write BMT\n"); ++ ++ if (bmt_block_index == 0) ++ { ++ // if we don't have index, we don't need to erase found block as it has been erased in find_available_block() ++ need_erase = false; ++ if (!(bmt_block_index = find_available_block(true))) ++ { ++ MSG(INIT, "Cannot find an available block for BMT\n"); ++ return false; ++ } ++ } ++ ++ MSG(INIT, "Find BMT block: 0x%x\n", bmt_block_index); ++ ++ // write bmt to flash ++ if (need_erase) ++ { ++ if (!nand_erase_bmt(OFFSET(bmt_block_index))) ++ { ++ MSG(INIT, "BMT block erase fail, mark bad: 0x%x\n", bmt_block_index); ++ mark_block_bad_bmt(OFFSET(bmt_block_index)); ++ // bmt.bad_count++; ++ ++ bmt_block_index = 0; ++ return write_bmt_to_flash(dat, oob); // recursive call ++ } ++ } ++ ++ if (!nand_write_page_bmt(PAGE_ADDR(bmt_block_index), dat, oob)) ++ { ++ MSG(INIT, "Write BMT data fail, need to write again\n"); ++ mark_block_bad_bmt(OFFSET(bmt_block_index)); ++ // bmt.bad_count++; ++ ++ bmt_block_index = 0; ++ return write_bmt_to_flash(dat, oob); // recursive call ++ } ++ ++ MSG(INIT, "Write BMT data to block 0x%x success\n", bmt_block_index); ++ return true; ++} ++ ++/******************************************************************* ++* Reconstruct bmt, called when found bmt info doesn't match bad ++* block info in flash. ++* ++* Return NULL for failure ++*******************************************************************/ ++bmt_struct *reconstruct_bmt(bmt_struct * bmt) ++{ ++ int i; ++ int index = system_block_count; ++ unsigned short bad_index; ++ int mapped; ++ ++ // init everything in BMT struct ++ bmt->version = BMT_VERSION; ++ bmt->bad_count = 0; ++ bmt->mapped_count = 0; ++ ++ memset(bmt->table, 0, bmt_block_count * sizeof(bmt_entry)); ++ ++ for (i = 0; i < bmt_block_count; i++, index++) ++ { ++ if (nand_block_bad_bmt(OFFSET(index))) ++ { ++ MSG(INIT, "Skip bad block: 0x%x\n", index); ++ // bmt->bad_count++; ++ continue; ++ } ++ ++ MSG(INIT, "read page: 0x%x\n", PAGE_ADDR(index)); ++ nand_read_page_bmt(PAGE_ADDR(index), dat_buf, oob_buf); ++ /* if (mtk_nand_read_page_hw(PAGE_ADDR(index), dat_buf)) ++ { ++ MSG(INIT, "Error when read block %d\n", bmt_block_index); ++ continue; ++ } */ ++ ++ if ((bad_index = get_bad_index_from_oob(oob_buf)) >= system_block_count) ++ { ++ MSG(INIT, "get bad index: 0x%x\n", bad_index); ++ if (bad_index != 0xFFFF) ++ MSG(INIT, "Invalid bad index found in block 0x%x, bad index 0x%x\n", index, bad_index); ++ continue; ++ } ++ ++ MSG(INIT, "Block 0x%x is mapped to bad block: 0x%x\n", index, bad_index); ++ ++ if (!nand_block_bad_bmt(OFFSET(bad_index))) ++ { ++ MSG(INIT, "\tbut block 0x%x is not marked as bad, invalid mapping\n", bad_index); ++ continue; // no need to erase here, it will be erased later when trying to write BMT ++ } ++ ++ if ((mapped = is_block_mapped(bad_index)) >= 0) ++ { ++ MSG(INIT, "bad block 0x%x is mapped to 0x%x, should be caused by power lost, replace with one\n", bmt->table[mapped].bad_index, bmt->table[mapped].mapped_index); ++ bmt->table[mapped].mapped_index = index; // use new one instead. ++ } else ++ { ++ // add mapping to BMT ++ bmt->table[bmt->mapped_count].bad_index = bad_index; ++ bmt->table[bmt->mapped_count].mapped_index = index; ++ bmt->mapped_count++; ++ } ++ ++ MSG(INIT, "Add mapping: 0x%x -> 0x%x to BMT\n", bad_index, index); ++ ++ } ++ ++ MSG(INIT, "Scan replace pool done, mapped block: %d\n", bmt->mapped_count); ++ // dump_bmt_info(bmt); ++ ++ // fill NAND BMT buffer ++ memset(oob_buf, 0xFF, sizeof(oob_buf)); ++ fill_nand_bmt_buffer(bmt, dat_buf, oob_buf); ++ ++ // write BMT back ++ if (!write_bmt_to_flash(dat_buf, oob_buf)) ++ { ++ MSG(INIT, "TRAGEDY: cannot find a place to write BMT!!!!\n"); ++ } ++ ++ return bmt; ++} ++ ++/******************************************************************* ++* [BMT Interface] ++* ++* Description: ++* Init bmt from nand. Reconstruct if not found or data error ++* ++* Parameter: ++* size: size of bmt and replace pool ++* ++* Return: ++* NULL for failure, and a bmt struct for success ++*******************************************************************/ ++bmt_struct *init_bmt(struct nand_chip * chip, int size) ++{ ++ struct mtk_nand_host *host; ++ ++ if (size > 0 && size < MAX_BMT_SIZE) ++ { ++ MSG(INIT, "Init bmt table, size: %d\n", size); ++ bmt_block_count = size; ++ } else ++ { ++ MSG(INIT, "Invalid bmt table size: %d\n", size); ++ return NULL; ++ } ++ nand_chip_bmt = chip; ++ system_block_count = chip->chipsize >> chip->phys_erase_shift; ++ total_block_count = bmt_block_count + system_block_count; ++ page_per_block = BLOCK_SIZE_BMT / PAGE_SIZE_BMT; ++ host = (struct mtk_nand_host *)chip->priv; ++ mtd_bmt = &host->mtd; ++ ++ MSG(INIT, "mtd_bmt: %p, nand_chip_bmt: %p\n", mtd_bmt, nand_chip_bmt); ++ MSG(INIT, "bmt count: %d, system count: %d\n", bmt_block_count, system_block_count); ++ ++ // set this flag, and unmapped block in pool will be erased. ++ pool_erased = 0; ++ memset(bmt.table, 0, size * sizeof(bmt_entry)); ++ if ((bmt_block_index = load_bmt_data(system_block_count, size))) ++ { ++ MSG(INIT, "Load bmt data success @ block 0x%x\n", bmt_block_index); ++ dump_bmt_info(&bmt); ++ return &bmt; ++ } else ++ { ++ MSG(INIT, "Load bmt data fail, need re-construct!\n"); ++#ifndef __UBOOT_NAND__ // BMT is not re-constructed in UBOOT. ++ if (reconstruct_bmt(&bmt)) ++ return &bmt; ++ else ++#endif ++ return NULL; ++ } ++} ++ ++/******************************************************************* ++* [BMT Interface] ++* ++* Description: ++* Update BMT. ++* ++* Parameter: ++* offset: update block/page offset. ++* reason: update reason, see update_reason_t for reason. ++* dat/oob: data and oob buffer for write fail. ++* ++* Return: ++* Return true for success, and false for failure. ++*******************************************************************/ ++bool update_bmt(u32 offset, update_reason_t reason, u8 * dat, u8 * oob) ++{ ++ int map_index; ++ int orig_bad_block = -1; ++ // int bmt_update_index; ++ int i; ++ int bad_index = offset / BLOCK_SIZE_BMT; ++ ++#ifndef MTK_NAND_BMT ++ return false; ++#endif ++ if (reason == UPDATE_WRITE_FAIL) ++ { ++ MSG(INIT, "Write fail, need to migrate\n"); ++ if (!(map_index = migrate_from_bad(offset, dat, oob))) ++ { ++ MSG(INIT, "migrate fail\n"); ++ return false; ++ } ++ } else ++ { ++ if (!(map_index = find_available_block(false))) ++ { ++ MSG(INIT, "Cannot find block in pool\n"); ++ return false; ++ } ++ } ++ ++ // now let's update BMT ++ if (bad_index >= system_block_count) // mapped block become bad, find original bad block ++ { ++ for (i = 0; i < bmt_block_count; i++) ++ { ++ if (bmt.table[i].mapped_index == bad_index) ++ { ++ orig_bad_block = bmt.table[i].bad_index; ++ break; ++ } ++ } ++ // bmt.bad_count++; ++ MSG(INIT, "Mapped block becomes bad, orig bad block is 0x%x\n", orig_bad_block); ++ ++ bmt.table[i].mapped_index = map_index; ++ } else ++ { ++ bmt.table[bmt.mapped_count].mapped_index = map_index; ++ bmt.table[bmt.mapped_count].bad_index = bad_index; ++ bmt.mapped_count++; ++ } ++ ++ memset(oob_buf, 0xFF, sizeof(oob_buf)); ++ fill_nand_bmt_buffer(&bmt, dat_buf, oob_buf); ++ if (!write_bmt_to_flash(dat_buf, oob_buf)) ++ return false; ++ ++ mark_block_bad_bmt(offset); ++ ++ return true; ++} ++ ++/******************************************************************* ++* [BMT Interface] ++* ++* Description: ++* Given an block index, return mapped index if it's mapped, else ++* return given index. ++* ++* Parameter: ++* index: given an block index. This value cannot exceed ++* system_block_count. ++* ++* Return NULL for failure ++*******************************************************************/ ++u16 get_mapping_block_index(int index) ++{ ++ int i; ++#ifndef MTK_NAND_BMT ++ return index; ++#endif ++ if (index > system_block_count) ++ { ++ return index; ++ } ++ ++ for (i = 0; i < bmt.mapped_count; i++) ++ { ++ if (bmt.table[i].bad_index == index) ++ { ++ return bmt.table[i].mapped_index; ++ } ++ } ++ ++ return index; ++} ++#ifdef __KERNEL_NAND__ ++EXPORT_SYMBOL_GPL(init_bmt); ++EXPORT_SYMBOL_GPL(update_bmt); ++EXPORT_SYMBOL_GPL(get_mapping_block_index); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("MediaTek"); ++MODULE_DESCRIPTION("Bad Block mapping management for MediaTek NAND Flash Driver"); ++#endif +--- /dev/null ++++ b/drivers/mtd/nand/bmt.h +@@ -0,0 +1,80 @@ ++#ifndef __BMT_H__ ++#define __BMT_H__ ++ ++#include "nand_def.h" ++ ++#if defined(__PRELOADER_NAND__) ++ ++#include "nand.h" ++ ++#elif defined(__UBOOT_NAND__) ++ ++#include ++#include "mtk_nand.h" ++ ++#elif defined(__KERNEL_NAND__) ++ ++#include ++#include ++#include ++#include "mtk_nand.h" ++ ++#endif ++ ++ ++#define MAX_BMT_SIZE (0x80) ++#define BMT_VERSION (1) // initial version ++ ++#define MAIN_SIGNATURE_OFFSET (0) ++#define OOB_SIGNATURE_OFFSET (1) ++#define OOB_INDEX_OFFSET (29) ++#define OOB_INDEX_SIZE (2) ++#define FAKE_INDEX (0xAAAA) ++ ++typedef struct _bmt_entry_ ++{ ++ u16 bad_index; // bad block index ++ u16 mapped_index; // mapping block index in the replace pool ++} bmt_entry; ++ ++typedef enum ++{ ++ UPDATE_ERASE_FAIL, ++ UPDATE_WRITE_FAIL, ++ UPDATE_UNMAPPED_BLOCK, ++ UPDATE_REASON_COUNT, ++} update_reason_t; ++ ++typedef struct ++{ ++ bmt_entry table[MAX_BMT_SIZE]; ++ u8 version; ++ u8 mapped_count; // mapped block count in pool ++ u8 bad_count; // bad block count in pool. Not used in V1 ++} bmt_struct; ++ ++/*************************************************************** ++* * ++* Interface BMT need to use * ++* * ++***************************************************************/ ++extern bool mtk_nand_exec_read_page(struct mtd_info *mtd, u32 row, u32 page_size, u8 * dat, u8 * oob); ++extern int mtk_nand_block_bad_hw(struct mtd_info *mtd, loff_t ofs); ++extern int mtk_nand_erase_hw(struct mtd_info *mtd, int page); ++extern int mtk_nand_block_markbad_hw(struct mtd_info *mtd, loff_t ofs); ++extern int mtk_nand_exec_write_page(struct mtd_info *mtd, u32 row, u32 page_size, u8 * dat, u8 * oob); ++ ++ ++/*************************************************************** ++* * ++* Different function interface for preloader/uboot/kernel * ++* * ++***************************************************************/ ++void set_bad_index_to_oob(u8 * oob, u16 index); ++ ++ ++bmt_struct *init_bmt(struct nand_chip *nand, int size); ++bool update_bmt(u32 offset, update_reason_t reason, u8 * dat, u8 * oob); ++unsigned short get_mapping_block_index(int index); ++ ++#endif // #ifndef __BMT_H__ +--- /dev/null ++++ b/drivers/mtd/nand/dev-nand.c +@@ -0,0 +1,63 @@ ++#include ++#include ++#include ++ ++#include "mt6575_typedefs.h" ++ ++#define RALINK_NAND_CTRL_BASE 0xBE003000 ++#define NFI_base RALINK_NAND_CTRL_BASE ++#define RALINK_NANDECC_CTRL_BASE 0xBE003800 ++#define NFIECC_base RALINK_NANDECC_CTRL_BASE ++#define MT7621_NFI_IRQ_ID SURFBOARDINT_NAND ++#define MT7621_NFIECC_IRQ_ID SURFBOARDINT_NAND_ECC ++ ++#define SURFBOARDINT_NAND 22 ++#define SURFBOARDINT_NAND_ECC 23 ++ ++static struct resource MT7621_resource_nand[] = { ++ { ++ .start = NFI_base, ++ .end = NFI_base + 0x1A0, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = NFIECC_base, ++ .end = NFIECC_base + 0x150, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = MT7621_NFI_IRQ_ID, ++ .flags = IORESOURCE_IRQ, ++ }, ++ { ++ .start = MT7621_NFIECC_IRQ_ID, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct platform_device MT7621_nand_dev = { ++ .name = "MT7621-NAND", ++ .id = 0, ++ .num_resources = ARRAY_SIZE(MT7621_resource_nand), ++ .resource = MT7621_resource_nand, ++ .dev = { ++ .platform_data = &mt7621_nand_hw, ++ }, ++}; ++ ++ ++int __init mtk_nand_register(void) ++{ ++ ++ int retval = 0; ++ ++ retval = platform_device_register(&MT7621_nand_dev); ++ if (retval != 0) { ++ printk(KERN_ERR "register nand device fail\n"); ++ return retval; ++ } ++ ++ ++ return retval; ++} ++arch_initcall(mtk_nand_register); +--- /dev/null ++++ b/drivers/mtd/nand/mt6575_typedefs.h +@@ -0,0 +1,340 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ */ ++/* MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++/***************************************************************************** ++* Copyright Statement: ++* -------------------- ++* This software is protected by Copyright and the information contained ++* herein is confidential. The software may not be copied and the information ++* contained herein may not be used or disclosed except with the written ++* permission of MediaTek Inc. (C) 2008 ++* ++* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON ++* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH ++* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO ++* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S ++* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. ++* ++* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE ++* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO ++* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++* ++* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE ++* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF ++* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND ++* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER ++* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). ++* ++*****************************************************************************/ ++ ++#ifndef _MT6575_TYPEDEFS_H ++#define _MT6575_TYPEDEFS_H ++ ++#if defined (__KERNEL_NAND__) ++#include ++#else ++#define true 1 ++#define false 0 ++#define bool u8 ++#endif ++ ++// --------------------------------------------------------------------------- ++// Basic Type Definitions ++// --------------------------------------------------------------------------- ++ ++typedef volatile unsigned char *P_kal_uint8; ++typedef volatile unsigned short *P_kal_uint16; ++typedef volatile unsigned int *P_kal_uint32; ++ ++typedef long LONG; ++typedef unsigned char UBYTE; ++typedef short SHORT; ++ ++typedef signed char kal_int8; ++typedef signed short kal_int16; ++typedef signed int kal_int32; ++typedef long long kal_int64; ++typedef unsigned char kal_uint8; ++typedef unsigned short kal_uint16; ++typedef unsigned int kal_uint32; ++typedef unsigned long long kal_uint64; ++typedef char kal_char; ++ ++typedef unsigned int *UINT32P; ++typedef volatile unsigned short *UINT16P; ++typedef volatile unsigned char *UINT8P; ++typedef unsigned char *U8P; ++ ++typedef volatile unsigned char *P_U8; ++typedef volatile signed char *P_S8; ++typedef volatile unsigned short *P_U16; ++typedef volatile signed short *P_S16; ++typedef volatile unsigned int *P_U32; ++typedef volatile signed int *P_S32; ++typedef unsigned long long *P_U64; ++typedef signed long long *P_S64; ++ ++typedef unsigned char U8; ++typedef signed char S8; ++typedef unsigned short U16; ++typedef signed short S16; ++typedef unsigned int U32; ++typedef signed int S32; ++typedef unsigned long long U64; ++typedef signed long long S64; ++//typedef unsigned char bool; ++ ++typedef unsigned char UINT8; ++typedef unsigned short UINT16; ++typedef unsigned int UINT32; ++typedef unsigned short USHORT; ++typedef signed char INT8; ++typedef signed short INT16; ++typedef signed int INT32; ++typedef unsigned int DWORD; ++typedef void VOID; ++typedef unsigned char BYTE; ++typedef float FLOAT; ++ ++typedef char *LPCSTR; ++typedef short *LPWSTR; ++ ++ ++// --------------------------------------------------------------------------- ++// Constants ++// --------------------------------------------------------------------------- ++ ++#define IMPORT EXTERN ++#ifndef __cplusplus ++ #define EXTERN extern ++#else ++ #define EXTERN extern "C" ++#endif ++#define LOCAL static ++#define GLOBAL ++#define EXPORT GLOBAL ++ ++#define EQ == ++#define NEQ != ++#define AND && ++#define OR || ++#define XOR(A,B) ((!(A) AND (B)) OR ((A) AND !(B))) ++ ++#ifndef FALSE ++ #define FALSE (0) ++#endif ++ ++#ifndef TRUE ++ #define TRUE (1) ++#endif ++ ++#ifndef NULL ++ #define NULL (0) ++#endif ++ ++//enum boolean {false, true}; ++enum {RX, TX, NONE}; ++ ++#ifndef BOOL ++typedef unsigned char BOOL; ++#endif ++ ++typedef enum { ++ KAL_FALSE = 0, ++ KAL_TRUE = 1, ++} kal_bool; ++ ++ ++// --------------------------------------------------------------------------- ++// Type Casting ++// --------------------------------------------------------------------------- ++ ++#define AS_INT32(x) (*(INT32 *)((void*)x)) ++#define AS_INT16(x) (*(INT16 *)((void*)x)) ++#define AS_INT8(x) (*(INT8 *)((void*)x)) ++ ++#define AS_UINT32(x) (*(UINT32 *)((void*)x)) ++#define AS_UINT16(x) (*(UINT16 *)((void*)x)) ++#define AS_UINT8(x) (*(UINT8 *)((void*)x)) ++ ++ ++// --------------------------------------------------------------------------- ++// Register Manipulations ++// --------------------------------------------------------------------------- ++ ++#define READ_REGISTER_UINT32(reg) \ ++ (*(volatile UINT32 * const)(reg)) ++ ++#define WRITE_REGISTER_UINT32(reg, val) \ ++ (*(volatile UINT32 * const)(reg)) = (val) ++ ++#define READ_REGISTER_UINT16(reg) \ ++ (*(volatile UINT16 * const)(reg)) ++ ++#define WRITE_REGISTER_UINT16(reg, val) \ ++ (*(volatile UINT16 * const)(reg)) = (val) ++ ++#define READ_REGISTER_UINT8(reg) \ ++ (*(volatile UINT8 * const)(reg)) ++ ++#define WRITE_REGISTER_UINT8(reg, val) \ ++ (*(volatile UINT8 * const)(reg)) = (val) ++ ++#define INREG8(x) READ_REGISTER_UINT8((UINT8*)((void*)(x))) ++#define OUTREG8(x, y) WRITE_REGISTER_UINT8((UINT8*)((void*)(x)), (UINT8)(y)) ++#define SETREG8(x, y) OUTREG8(x, INREG8(x)|(y)) ++#define CLRREG8(x, y) OUTREG8(x, INREG8(x)&~(y)) ++#define MASKREG8(x, y, z) OUTREG8(x, (INREG8(x)&~(y))|(z)) ++ ++#define INREG16(x) READ_REGISTER_UINT16((UINT16*)((void*)(x))) ++#define OUTREG16(x, y) WRITE_REGISTER_UINT16((UINT16*)((void*)(x)),(UINT16)(y)) ++#define SETREG16(x, y) OUTREG16(x, INREG16(x)|(y)) ++#define CLRREG16(x, y) OUTREG16(x, INREG16(x)&~(y)) ++#define MASKREG16(x, y, z) OUTREG16(x, (INREG16(x)&~(y))|(z)) ++ ++#define INREG32(x) READ_REGISTER_UINT32((UINT32*)((void*)(x))) ++#define OUTREG32(x, y) WRITE_REGISTER_UINT32((UINT32*)((void*)(x)), (UINT32)(y)) ++#define SETREG32(x, y) OUTREG32(x, INREG32(x)|(y)) ++#define CLRREG32(x, y) OUTREG32(x, INREG32(x)&~(y)) ++#define MASKREG32(x, y, z) OUTREG32(x, (INREG32(x)&~(y))|(z)) ++ ++ ++#define DRV_Reg8(addr) INREG8(addr) ++#define DRV_WriteReg8(addr, data) OUTREG8(addr, data) ++#define DRV_SetReg8(addr, data) SETREG8(addr, data) ++#define DRV_ClrReg8(addr, data) CLRREG8(addr, data) ++ ++#define DRV_Reg16(addr) INREG16(addr) ++#define DRV_WriteReg16(addr, data) OUTREG16(addr, data) ++#define DRV_SetReg16(addr, data) SETREG16(addr, data) ++#define DRV_ClrReg16(addr, data) CLRREG16(addr, data) ++ ++#define DRV_Reg32(addr) INREG32(addr) ++#define DRV_WriteReg32(addr, data) OUTREG32(addr, data) ++#define DRV_SetReg32(addr, data) SETREG32(addr, data) ++#define DRV_ClrReg32(addr, data) CLRREG32(addr, data) ++ ++// !!! DEPRECATED, WILL BE REMOVED LATER !!! ++#define DRV_Reg(addr) DRV_Reg16(addr) ++#define DRV_WriteReg(addr, data) DRV_WriteReg16(addr, data) ++#define DRV_SetReg(addr, data) DRV_SetReg16(addr, data) ++#define DRV_ClrReg(addr, data) DRV_ClrReg16(addr, data) ++ ++ ++// --------------------------------------------------------------------------- ++// Compiler Time Deduction Macros ++// --------------------------------------------------------------------------- ++ ++#define _MASK_OFFSET_1(x, n) ((x) & 0x1) ? (n) : ++#define _MASK_OFFSET_2(x, n) _MASK_OFFSET_1((x), (n)) _MASK_OFFSET_1((x) >> 1, (n) + 1) ++#define _MASK_OFFSET_4(x, n) _MASK_OFFSET_2((x), (n)) _MASK_OFFSET_2((x) >> 2, (n) + 2) ++#define _MASK_OFFSET_8(x, n) _MASK_OFFSET_4((x), (n)) _MASK_OFFSET_4((x) >> 4, (n) + 4) ++#define _MASK_OFFSET_16(x, n) _MASK_OFFSET_8((x), (n)) _MASK_OFFSET_8((x) >> 8, (n) + 8) ++#define _MASK_OFFSET_32(x, n) _MASK_OFFSET_16((x), (n)) _MASK_OFFSET_16((x) >> 16, (n) + 16) ++ ++#define MASK_OFFSET_ERROR (0xFFFFFFFF) ++ ++#define MASK_OFFSET(x) (_MASK_OFFSET_32(x, 0) MASK_OFFSET_ERROR) ++ ++ ++// --------------------------------------------------------------------------- ++// Assertions ++// --------------------------------------------------------------------------- ++ ++#ifndef ASSERT ++ #define ASSERT(expr) BUG_ON(!(expr)) ++#endif ++ ++#ifndef NOT_IMPLEMENTED ++ #define NOT_IMPLEMENTED() BUG_ON(1) ++#endif ++ ++#define STATIC_ASSERT(pred) STATIC_ASSERT_X(pred, __LINE__) ++#define STATIC_ASSERT_X(pred, line) STATIC_ASSERT_XX(pred, line) ++#define STATIC_ASSERT_XX(pred, line) \ ++ extern char assertion_failed_at_##line[(pred) ? 1 : -1] ++ ++// --------------------------------------------------------------------------- ++// Resolve Compiler Warnings ++// --------------------------------------------------------------------------- ++ ++#define NOT_REFERENCED(x) { (x) = (x); } ++ ++ ++// --------------------------------------------------------------------------- ++// Utilities ++// --------------------------------------------------------------------------- ++ ++#define MAXIMUM(A,B) (((A)>(B))?(A):(B)) ++#define MINIMUM(A,B) (((A)<(B))?(A):(B)) ++ ++#define ARY_SIZE(x) (sizeof((x)) / sizeof((x[0]))) ++#define DVT_DELAYMACRO(u4Num) \ ++{ \ ++ UINT32 u4Count = 0 ; \ ++ for (u4Count = 0; u4Count < u4Num; u4Count++ ); \ ++} \ ++ ++#define A68351B 0 ++#define B68351B 1 ++#define B68351D 2 ++#define B68351E 3 ++#define UNKNOWN_IC_VERSION 0xFF ++ ++/* NAND driver */ ++struct mtk_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 mtk_nand_host_hw mt7621_nand_hw; ++extern unsigned int CFG_BLOCKSIZE; ++ ++#endif // _MT6575_TYPEDEFS_H ++ +--- /dev/null ++++ b/drivers/mtd/nand/mtk_nand.c +@@ -0,0 +1,2304 @@ ++/****************************************************************************** ++* mtk_nand.c - MTK NAND Flash Device Driver ++ * ++* Copyright 2009-2012 MediaTek Co.,Ltd. ++ * ++* DESCRIPTION: ++* This file provid the other drivers nand relative functions ++ * ++* modification history ++* ---------------------------------------- ++* v3.0, 11 Feb 2010, mtk ++* ---------------------------------------- ++******************************************************************************/ ++#include "nand_def.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "mtk_nand.h" ++#include "nand_device_list.h" ++ ++#include "bmt.h" ++#include "partition.h" ++ ++unsigned int CFG_BLOCKSIZE; ++ ++static int shift_on_bbt = 0; ++extern void nand_bbt_set(struct mtd_info *mtd, int page, int flag); ++extern int nand_bbt_get(struct mtd_info *mtd, int page); ++int mtk_nand_read_oob_hw(struct mtd_info *mtd, struct nand_chip *chip, int page); ++ ++static const char * const probe_types[] = { "cmdlinepart", "ofpart", NULL }; ++ ++#define NAND_CMD_STATUS_MULTI 0x71 ++ ++void show_stack(struct task_struct *tsk, unsigned long *sp); ++extern void mt_irq_set_sens(unsigned int irq, unsigned int sens); ++extern void mt_irq_set_polarity(unsigned int irq,unsigned int polarity); ++ ++struct mtk_nand_host mtk_nand_host; /* include mtd_info and nand_chip structs */ ++struct mtk_nand_host_hw mt7621_nand_hw = { ++ .nfi_bus_width = 8, ++ .nfi_access_timing = NFI_DEFAULT_ACCESS_TIMING, ++ .nfi_cs_num = NFI_CS_NUM, ++ .nand_sec_size = 512, ++ .nand_sec_shift = 9, ++ .nand_ecc_size = 2048, ++ .nand_ecc_bytes = 32, ++ .nand_ecc_mode = NAND_ECC_HW, ++}; ++ ++ ++/******************************************************************************* ++ * Gloable Varible Definition ++ *******************************************************************************/ ++ ++#define NFI_ISSUE_COMMAND(cmd, col_addr, row_addr, col_num, row_num) \ ++ do { \ ++ DRV_WriteReg(NFI_CMD_REG16,cmd);\ ++ while (DRV_Reg32(NFI_STA_REG32) & STA_CMD_STATE);\ ++ DRV_WriteReg32(NFI_COLADDR_REG32, col_addr);\ ++ DRV_WriteReg32(NFI_ROWADDR_REG32, row_addr);\ ++ DRV_WriteReg(NFI_ADDRNOB_REG16, col_num | (row_num<mm) { ++ printk(KERN_ERR "[nand_virt_to_phys_add] ERROR current->mm is NULL! tgid=0x%x, name=%s \n", current->tgid, current->comm); ++ return 0; ++ } ++ ++ pgd = pgd_offset(current->mm, va); /* what is tsk->mm */ ++ if (pgd_none(*pgd) || pgd_bad(*pgd)) { ++ printk(KERN_ERR "[nand_virt_to_phys_add] ERROR, va=0x%x, pgd invalid! \n", va); ++ return 0; ++ } ++ ++ pmd = pmd_offset((pud_t *)pgd, va); ++ if (pmd_none(*pmd) || pmd_bad(*pmd)) { ++ printk(KERN_ERR "[nand_virt_to_phys_add] ERROR, va=0x%x, pmd invalid! \n", va); ++ return 0; ++ } ++ ++ pte = pte_offset_map(pmd, va); ++ if (pte_present(*pte)) { ++ pa = (pte_val(*pte) & (PAGE_MASK)) | pageOffset; ++ return pa; ++ } ++ ++ printk(KERN_ERR "[nand_virt_to_phys_add] ERROR va=0x%x, pte invalid! \n", va); ++ return 0; ++} ++EXPORT_SYMBOL(nand_virt_to_phys_add); ++ ++bool ++get_device_info(u16 id, u32 ext_id, flashdev_info * pdevinfo) ++{ ++ u32 index; ++ for (index = 0; gen_FlashTable[index].id != 0; index++) { ++ if (id == gen_FlashTable[index].id && ext_id == gen_FlashTable[index].ext_id) { ++ pdevinfo->id = gen_FlashTable[index].id; ++ pdevinfo->ext_id = gen_FlashTable[index].ext_id; ++ pdevinfo->blocksize = gen_FlashTable[index].blocksize; ++ pdevinfo->addr_cycle = gen_FlashTable[index].addr_cycle; ++ pdevinfo->iowidth = gen_FlashTable[index].iowidth; ++ pdevinfo->timmingsetting = gen_FlashTable[index].timmingsetting; ++ pdevinfo->advancedmode = gen_FlashTable[index].advancedmode; ++ pdevinfo->pagesize = gen_FlashTable[index].pagesize; ++ pdevinfo->sparesize = gen_FlashTable[index].sparesize; ++ pdevinfo->totalsize = gen_FlashTable[index].totalsize; ++ memcpy(pdevinfo->devciename, gen_FlashTable[index].devciename, sizeof(pdevinfo->devciename)); ++ printk(KERN_INFO "Device found in MTK table, ID: %x, EXT_ID: %x\n", id, ext_id); ++ ++ goto find; ++ } ++ } ++ ++find: ++ if (0 == pdevinfo->id) { ++ printk(KERN_INFO "Device not found, ID: %x\n", id); ++ return false; ++ } else { ++ return true; ++ } ++} ++ ++static void ++ECC_Config(struct mtk_nand_host_hw *hw,u32 ecc_bit) ++{ ++ u32 u4ENCODESize; ++ u32 u4DECODESize; ++ u32 ecc_bit_cfg = ECC_CNFG_ECC4; ++ ++ switch(ecc_bit){ ++ case 4: ++ ecc_bit_cfg = ECC_CNFG_ECC4; ++ break; ++ case 8: ++ ecc_bit_cfg = ECC_CNFG_ECC8; ++ break; ++ case 10: ++ ecc_bit_cfg = ECC_CNFG_ECC10; ++ break; ++ case 12: ++ ecc_bit_cfg = ECC_CNFG_ECC12; ++ break; ++ default: ++ break; ++ } ++ DRV_WriteReg16(ECC_DECCON_REG16, DEC_DE); ++ do { ++ } while (!DRV_Reg16(ECC_DECIDLE_REG16)); ++ ++ DRV_WriteReg16(ECC_ENCCON_REG16, ENC_DE); ++ do { ++ } while (!DRV_Reg32(ECC_ENCIDLE_REG32)); ++ ++ /* setup FDM register base */ ++ DRV_WriteReg32(ECC_FDMADDR_REG32, NFI_FDM0L_REG32); ++ ++ /* Sector + FDM */ ++ u4ENCODESize = (hw->nand_sec_size + 8) << 3; ++ /* Sector + FDM + YAFFS2 meta data bits */ ++ u4DECODESize = ((hw->nand_sec_size + 8) << 3) + ecc_bit * 13; ++ ++ /* configure ECC decoder && encoder */ ++ DRV_WriteReg32(ECC_DECCNFG_REG32, ecc_bit_cfg | DEC_CNFG_NFI | DEC_CNFG_EMPTY_EN | (u4DECODESize << DEC_CNFG_CODE_SHIFT)); ++ ++ DRV_WriteReg32(ECC_ENCCNFG_REG32, ecc_bit_cfg | ENC_CNFG_NFI | (u4ENCODESize << ENC_CNFG_MSG_SHIFT)); ++ NFI_SET_REG32(ECC_DECCNFG_REG32, DEC_CNFG_EL); ++} ++ ++static void ++ECC_Decode_Start(void) ++{ ++ while (!(DRV_Reg16(ECC_DECIDLE_REG16) & DEC_IDLE)) ++ ; ++ DRV_WriteReg16(ECC_DECCON_REG16, DEC_EN); ++} ++ ++static void ++ECC_Decode_End(void) ++{ ++ while (!(DRV_Reg16(ECC_DECIDLE_REG16) & DEC_IDLE)) ++ ; ++ DRV_WriteReg16(ECC_DECCON_REG16, DEC_DE); ++} ++ ++static void ++ECC_Encode_Start(void) ++{ ++ while (!(DRV_Reg32(ECC_ENCIDLE_REG32) & ENC_IDLE)) ++ ; ++ mb(); ++ DRV_WriteReg16(ECC_ENCCON_REG16, ENC_EN); ++} ++ ++static void ++ECC_Encode_End(void) ++{ ++ /* wait for device returning idle */ ++ while (!(DRV_Reg32(ECC_ENCIDLE_REG32) & ENC_IDLE)) ; ++ mb(); ++ DRV_WriteReg16(ECC_ENCCON_REG16, ENC_DE); ++} ++ ++static bool ++mtk_nand_check_bch_error(struct mtd_info *mtd, u8 * pDataBuf, u32 u4SecIndex, u32 u4PageAddr) ++{ ++ bool bRet = true; ++ u16 u2SectorDoneMask = 1 << u4SecIndex; ++ u32 u4ErrorNumDebug, i, u4ErrNum; ++ u32 timeout = 0xFFFF; ++ // int el; ++ u32 au4ErrBitLoc[6]; ++ u32 u4ErrByteLoc, u4BitOffset; ++ u32 u4ErrBitLoc1th, u4ErrBitLoc2nd; ++ ++ //4 // Wait for Decode Done ++ while (0 == (u2SectorDoneMask & DRV_Reg16(ECC_DECDONE_REG16))) { ++ timeout--; ++ if (0 == timeout) ++ return false; ++ } ++ /* We will manually correct the error bits in the last sector, not all the sectors of the page! */ ++ memset(au4ErrBitLoc, 0x0, sizeof(au4ErrBitLoc)); ++ u4ErrorNumDebug = DRV_Reg32(ECC_DECENUM_REG32); ++ u4ErrNum = DRV_Reg32(ECC_DECENUM_REG32) >> (u4SecIndex << 2); ++ u4ErrNum &= 0xF; ++ ++ if (u4ErrNum) { ++ if (0xF == u4ErrNum) { ++ mtd->ecc_stats.failed++; ++ bRet = false; ++ //printk(KERN_ERR"UnCorrectable at PageAddr=%d\n", u4PageAddr); ++ } else { ++ for (i = 0; i < ((u4ErrNum + 1) >> 1); ++i) { ++ au4ErrBitLoc[i] = DRV_Reg32(ECC_DECEL0_REG32 + i); ++ u4ErrBitLoc1th = au4ErrBitLoc[i] & 0x1FFF; ++ if (u4ErrBitLoc1th < 0x1000) { ++ u4ErrByteLoc = u4ErrBitLoc1th / 8; ++ u4BitOffset = u4ErrBitLoc1th % 8; ++ pDataBuf[u4ErrByteLoc] = pDataBuf[u4ErrByteLoc] ^ (1 << u4BitOffset); ++ mtd->ecc_stats.corrected++; ++ } else { ++ mtd->ecc_stats.failed++; ++ } ++ u4ErrBitLoc2nd = (au4ErrBitLoc[i] >> 16) & 0x1FFF; ++ if (0 != u4ErrBitLoc2nd) { ++ if (u4ErrBitLoc2nd < 0x1000) { ++ u4ErrByteLoc = u4ErrBitLoc2nd / 8; ++ u4BitOffset = u4ErrBitLoc2nd % 8; ++ pDataBuf[u4ErrByteLoc] = pDataBuf[u4ErrByteLoc] ^ (1 << u4BitOffset); ++ mtd->ecc_stats.corrected++; ++ } else { ++ mtd->ecc_stats.failed++; ++ //printk(KERN_ERR"UnCorrectable High ErrLoc=%d\n", au4ErrBitLoc[i]); ++ } ++ } ++ } ++ } ++ if (0 == (DRV_Reg16(ECC_DECFER_REG16) & (1 << u4SecIndex))) ++ bRet = false; ++ } ++ return bRet; ++} ++ ++static bool ++mtk_nand_RFIFOValidSize(u16 u2Size) ++{ ++ u32 timeout = 0xFFFF; ++ while (FIFO_RD_REMAIN(DRV_Reg16(NFI_FIFOSTA_REG16)) < u2Size) { ++ timeout--; ++ if (0 == timeout) ++ return false; ++ } ++ return true; ++} ++ ++static bool ++mtk_nand_WFIFOValidSize(u16 u2Size) ++{ ++ u32 timeout = 0xFFFF; ++ ++ while (FIFO_WR_REMAIN(DRV_Reg16(NFI_FIFOSTA_REG16)) > u2Size) { ++ timeout--; ++ if (0 == timeout) ++ return false; ++ } ++ return true; ++} ++ ++static bool ++mtk_nand_status_ready(u32 u4Status) ++{ ++ u32 timeout = 0xFFFF; ++ ++ while ((DRV_Reg32(NFI_STA_REG32) & u4Status) != 0) { ++ timeout--; ++ if (0 == timeout) ++ return false; ++ } ++ return true; ++} ++ ++static bool ++mtk_nand_reset(void) ++{ ++ int timeout = 0xFFFF; ++ if (DRV_Reg16(NFI_MASTERSTA_REG16)) { ++ mb(); ++ DRV_WriteReg16(NFI_CON_REG16, CON_FIFO_FLUSH | CON_NFI_RST); ++ while (DRV_Reg16(NFI_MASTERSTA_REG16)) { ++ timeout--; ++ if (!timeout) ++ MSG(INIT, "Wait for NFI_MASTERSTA timeout\n"); ++ } ++ } ++ /* issue reset operation */ ++ mb(); ++ DRV_WriteReg16(NFI_CON_REG16, CON_FIFO_FLUSH | CON_NFI_RST); ++ ++ return mtk_nand_status_ready(STA_NFI_FSM_MASK | STA_NAND_BUSY) && mtk_nand_RFIFOValidSize(0) && mtk_nand_WFIFOValidSize(0); ++} ++ ++static void ++mtk_nand_set_mode(u16 u2OpMode) ++{ ++ u16 u2Mode = DRV_Reg16(NFI_CNFG_REG16); ++ u2Mode &= ~CNFG_OP_MODE_MASK; ++ u2Mode |= u2OpMode; ++ DRV_WriteReg16(NFI_CNFG_REG16, u2Mode); ++} ++ ++static void ++mtk_nand_set_autoformat(bool bEnable) ++{ ++ if (bEnable) ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_AUTO_FMT_EN); ++ else ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AUTO_FMT_EN); ++} ++ ++static void ++mtk_nand_configure_fdm(u16 u2FDMSize) ++{ ++ NFI_CLN_REG16(NFI_PAGEFMT_REG16, PAGEFMT_FDM_MASK | PAGEFMT_FDM_ECC_MASK); ++ NFI_SET_REG16(NFI_PAGEFMT_REG16, u2FDMSize << PAGEFMT_FDM_SHIFT); ++ NFI_SET_REG16(NFI_PAGEFMT_REG16, u2FDMSize << PAGEFMT_FDM_ECC_SHIFT); ++} ++ ++static void ++mtk_nand_configure_lock(void) ++{ ++ u32 u4WriteColNOB = 2; ++ u32 u4WriteRowNOB = 3; ++ u32 u4EraseColNOB = 0; ++ u32 u4EraseRowNOB = 3; ++ DRV_WriteReg16(NFI_LOCKANOB_REG16, ++ (u4WriteColNOB << PROG_CADD_NOB_SHIFT) | (u4WriteRowNOB << PROG_RADD_NOB_SHIFT) | (u4EraseColNOB << ERASE_CADD_NOB_SHIFT) | (u4EraseRowNOB << ERASE_RADD_NOB_SHIFT)); ++ ++ if (CHIPVER_ECO_1 == g_u4ChipVer) { ++ int i; ++ for (i = 0; i < 16; ++i) { ++ DRV_WriteReg32(NFI_LOCK00ADD_REG32 + (i << 1), 0xFFFFFFFF); ++ DRV_WriteReg32(NFI_LOCK00FMT_REG32 + (i << 1), 0xFFFFFFFF); ++ } ++ //DRV_WriteReg16(NFI_LOCKANOB_REG16, 0x0); ++ DRV_WriteReg32(NFI_LOCKCON_REG32, 0xFFFFFFFF); ++ DRV_WriteReg16(NFI_LOCK_REG16, NFI_LOCK_ON); ++ } ++} ++ ++static bool ++mtk_nand_pio_ready(void) ++{ ++ int count = 0; ++ while (!(DRV_Reg16(NFI_PIO_DIRDY_REG16) & 1)) { ++ count++; ++ if (count > 0xffff) { ++ printk("PIO_DIRDY timeout\n"); ++ return false; ++ } ++ } ++ ++ return true; ++} ++ ++static bool ++mtk_nand_set_command(u16 command) ++{ ++ mb(); ++ DRV_WriteReg16(NFI_CMD_REG16, command); ++ return mtk_nand_status_ready(STA_CMD_STATE); ++} ++ ++static bool ++mtk_nand_set_address(u32 u4ColAddr, u32 u4RowAddr, u16 u2ColNOB, u16 u2RowNOB) ++{ ++ mb(); ++ DRV_WriteReg32(NFI_COLADDR_REG32, u4ColAddr); ++ DRV_WriteReg32(NFI_ROWADDR_REG32, u4RowAddr); ++ DRV_WriteReg16(NFI_ADDRNOB_REG16, u2ColNOB | (u2RowNOB << ADDR_ROW_NOB_SHIFT)); ++ return mtk_nand_status_ready(STA_ADDR_STATE); ++} ++ ++static bool ++mtk_nand_check_RW_count(u16 u2WriteSize) ++{ ++ u32 timeout = 0xFFFF; ++ u16 u2SecNum = u2WriteSize >> 9; ++ ++ while (ADDRCNTR_CNTR(DRV_Reg16(NFI_ADDRCNTR_REG16)) < u2SecNum) { ++ timeout--; ++ if (0 == timeout) { ++ printk(KERN_INFO "[%s] timeout\n", __FUNCTION__); ++ return false; ++ } ++ } ++ return true; ++} ++ ++static bool ++mtk_nand_ready_for_read(struct nand_chip *nand, u32 u4RowAddr, u32 u4ColAddr, bool full, u8 * buf) ++{ ++ /* Reset NFI HW internal state machine and flush NFI in/out FIFO */ ++ bool bRet = false; ++ u16 sec_num = 1 << (nand->page_shift - 9); ++ u32 col_addr = u4ColAddr; ++ u32 colnob = 2, rownob = devinfo.addr_cycle - 2; ++ if (nand->options & NAND_BUSWIDTH_16) ++ col_addr /= 2; ++ ++ if (!mtk_nand_reset()) ++ goto cleanup; ++ if (g_bHwEcc) { ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ } else { ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ } ++ ++ mtk_nand_set_mode(CNFG_OP_READ); ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_READ_EN); ++ DRV_WriteReg16(NFI_CON_REG16, sec_num << CON_NFI_SEC_SHIFT); ++ ++ if (full) { ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ ++ if (g_bHwEcc) ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ else ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ } else { ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ } ++ ++ mtk_nand_set_autoformat(full); ++ if (full) ++ if (g_bHwEcc) ++ ECC_Decode_Start(); ++ if (!mtk_nand_set_command(NAND_CMD_READ0)) ++ goto cleanup; ++ if (!mtk_nand_set_address(col_addr, u4RowAddr, colnob, rownob)) ++ goto cleanup; ++ if (!mtk_nand_set_command(NAND_CMD_READSTART)) ++ goto cleanup; ++ if (!mtk_nand_status_ready(STA_NAND_BUSY)) ++ goto cleanup; ++ ++ bRet = true; ++ ++cleanup: ++ return bRet; ++} ++ ++static bool ++mtk_nand_ready_for_write(struct nand_chip *nand, u32 u4RowAddr, u32 col_addr, bool full, u8 * buf) ++{ ++ bool bRet = false; ++ u32 sec_num = 1 << (nand->page_shift - 9); ++ u32 colnob = 2, rownob = devinfo.addr_cycle - 2; ++ if (nand->options & NAND_BUSWIDTH_16) ++ col_addr /= 2; ++ ++ /* Reset NFI HW internal state machine and flush NFI in/out FIFO */ ++ if (!mtk_nand_reset()) ++ return false; ++ ++ mtk_nand_set_mode(CNFG_OP_PRGM); ++ ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_READ_EN); ++ ++ DRV_WriteReg16(NFI_CON_REG16, sec_num << CON_NFI_SEC_SHIFT); ++ ++ if (full) { ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ if (g_bHwEcc) ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ else ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ } else { ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ } ++ ++ mtk_nand_set_autoformat(full); ++ ++ if (full) ++ if (g_bHwEcc) ++ ECC_Encode_Start(); ++ ++ if (!mtk_nand_set_command(NAND_CMD_SEQIN)) ++ goto cleanup; ++ //1 FIXED ME: For Any Kind of AddrCycle ++ if (!mtk_nand_set_address(col_addr, u4RowAddr, colnob, rownob)) ++ goto cleanup; ++ ++ if (!mtk_nand_status_ready(STA_NAND_BUSY)) ++ goto cleanup; ++ ++ bRet = true; ++ ++cleanup: ++ return bRet; ++} ++ ++static bool ++mtk_nand_check_dececc_done(u32 u4SecNum) ++{ ++ u32 timeout, dec_mask; ++ ++ timeout = 0xffff; ++ dec_mask = (1 << u4SecNum) - 1; ++ while ((dec_mask != DRV_Reg(ECC_DECDONE_REG16)) && timeout > 0) ++ timeout--; ++ if (timeout == 0) { ++ MSG(VERIFY, "ECC_DECDONE: timeout\n"); ++ return false; ++ } ++ return true; ++} ++ ++static bool ++mtk_nand_mcu_read_data(u8 * buf, u32 length) ++{ ++ int timeout = 0xffff; ++ u32 i; ++ u32 *buf32 = (u32 *) buf; ++ if ((u32) buf % 4 || length % 4) ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_BYTE_RW); ++ else ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_BYTE_RW); ++ ++ //DRV_WriteReg32(NFI_STRADDR_REG32, 0); ++ mb(); ++ NFI_SET_REG16(NFI_CON_REG16, CON_NFI_BRD); ++ ++ if ((u32) buf % 4 || length % 4) { ++ for (i = 0; (i < (length)) && (timeout > 0);) { ++ if (DRV_Reg16(NFI_PIO_DIRDY_REG16) & 1) { ++ *buf++ = (u8) DRV_Reg32(NFI_DATAR_REG32); ++ i++; ++ } else { ++ timeout--; ++ } ++ if (0 == timeout) { ++ printk(KERN_ERR "[%s] timeout\n", __FUNCTION__); ++ dump_nfi(); ++ return false; ++ } ++ } ++ } else { ++ for (i = 0; (i < (length >> 2)) && (timeout > 0);) { ++ if (DRV_Reg16(NFI_PIO_DIRDY_REG16) & 1) { ++ *buf32++ = DRV_Reg32(NFI_DATAR_REG32); ++ i++; ++ } else { ++ timeout--; ++ } ++ if (0 == timeout) { ++ printk(KERN_ERR "[%s] timeout\n", __FUNCTION__); ++ dump_nfi(); ++ return false; ++ } ++ } ++ } ++ return true; ++} ++ ++static bool ++mtk_nand_read_page_data(struct mtd_info *mtd, u8 * pDataBuf, u32 u4Size) ++{ ++ return mtk_nand_mcu_read_data(pDataBuf, u4Size); ++} ++ ++static bool ++mtk_nand_mcu_write_data(struct mtd_info *mtd, const u8 * buf, u32 length) ++{ ++ u32 timeout = 0xFFFF; ++ u32 i; ++ u32 *pBuf32; ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_BYTE_RW); ++ mb(); ++ NFI_SET_REG16(NFI_CON_REG16, CON_NFI_BWR); ++ pBuf32 = (u32 *) buf; ++ ++ if ((u32) buf % 4 || length % 4) ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_BYTE_RW); ++ else ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_BYTE_RW); ++ ++ if ((u32) buf % 4 || length % 4) { ++ for (i = 0; (i < (length)) && (timeout > 0);) { ++ if (DRV_Reg16(NFI_PIO_DIRDY_REG16) & 1) { ++ DRV_WriteReg32(NFI_DATAW_REG32, *buf++); ++ i++; ++ } else { ++ timeout--; ++ } ++ if (0 == timeout) { ++ printk(KERN_ERR "[%s] timeout\n", __FUNCTION__); ++ dump_nfi(); ++ return false; ++ } ++ } ++ } else { ++ for (i = 0; (i < (length >> 2)) && (timeout > 0);) { ++ if (DRV_Reg16(NFI_PIO_DIRDY_REG16) & 1) { ++ DRV_WriteReg32(NFI_DATAW_REG32, *pBuf32++); ++ i++; ++ } else { ++ timeout--; ++ } ++ if (0 == timeout) { ++ printk(KERN_ERR "[%s] timeout\n", __FUNCTION__); ++ dump_nfi(); ++ return false; ++ } ++ } ++ } ++ ++ return true; ++} ++ ++static bool ++mtk_nand_write_page_data(struct mtd_info *mtd, u8 * buf, u32 size) ++{ ++ return mtk_nand_mcu_write_data(mtd, buf, size); ++} ++ ++static void ++mtk_nand_read_fdm_data(u8 * pDataBuf, u32 u4SecNum) ++{ ++ u32 i; ++ u32 *pBuf32 = (u32 *) pDataBuf; ++ ++ if (pBuf32) { ++ for (i = 0; i < u4SecNum; ++i) { ++ *pBuf32++ = DRV_Reg32(NFI_FDM0L_REG32 + (i << 1)); ++ *pBuf32++ = DRV_Reg32(NFI_FDM0M_REG32 + (i << 1)); ++ } ++ } ++} ++ ++static u8 fdm_buf[64]; ++static void ++mtk_nand_write_fdm_data(struct nand_chip *chip, u8 * pDataBuf, u32 u4SecNum) ++{ ++ u32 i, j; ++ u8 checksum = 0; ++ bool empty = true; ++ struct nand_oobfree *free_entry; ++ u32 *pBuf32; ++ ++ memcpy(fdm_buf, pDataBuf, u4SecNum * 8); ++ ++ free_entry = chip->ecc.layout->oobfree; ++ for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free_entry[i].length; i++) { ++ for (j = 0; j < free_entry[i].length; j++) { ++ if (pDataBuf[free_entry[i].offset + j] != 0xFF) ++ empty = false; ++ checksum ^= pDataBuf[free_entry[i].offset + j]; ++ } ++ } ++ ++ if (!empty) { ++ fdm_buf[free_entry[i - 1].offset + free_entry[i - 1].length] = checksum; ++ } ++ ++ pBuf32 = (u32 *) fdm_buf; ++ for (i = 0; i < u4SecNum; ++i) { ++ DRV_WriteReg32(NFI_FDM0L_REG32 + (i << 1), *pBuf32++); ++ DRV_WriteReg32(NFI_FDM0M_REG32 + (i << 1), *pBuf32++); ++ } ++} ++ ++static void ++mtk_nand_stop_read(void) ++{ ++ NFI_CLN_REG16(NFI_CON_REG16, CON_NFI_BRD); ++ mtk_nand_reset(); ++ if (g_bHwEcc) ++ ECC_Decode_End(); ++ DRV_WriteReg16(NFI_INTR_EN_REG16, 0); ++} ++ ++static void ++mtk_nand_stop_write(void) ++{ ++ NFI_CLN_REG16(NFI_CON_REG16, CON_NFI_BWR); ++ if (g_bHwEcc) ++ ECC_Encode_End(); ++ DRV_WriteReg16(NFI_INTR_EN_REG16, 0); ++} ++ ++bool ++mtk_nand_exec_read_page(struct mtd_info *mtd, u32 u4RowAddr, u32 u4PageSize, u8 * pPageBuf, u8 * pFDMBuf) ++{ ++ u8 *buf; ++ bool bRet = true; ++ struct nand_chip *nand = mtd->priv; ++ u32 u4SecNum = u4PageSize >> 9; ++ ++ if (((u32) pPageBuf % 16) && local_buffer_16_align) ++ buf = local_buffer_16_align; ++ else ++ buf = pPageBuf; ++ if (mtk_nand_ready_for_read(nand, u4RowAddr, 0, true, buf)) { ++ int j; ++ for (j = 0 ; j < u4SecNum; j++) { ++ if (!mtk_nand_read_page_data(mtd, buf+j*512, 512)) ++ bRet = false; ++ if(g_bHwEcc && !mtk_nand_check_dececc_done(j+1)) ++ bRet = false; ++ if(g_bHwEcc && !mtk_nand_check_bch_error(mtd, buf+j*512, j, u4RowAddr)) ++ bRet = false; ++ } ++ if (!mtk_nand_status_ready(STA_NAND_BUSY)) ++ bRet = false; ++ ++ mtk_nand_read_fdm_data(pFDMBuf, u4SecNum); ++ mtk_nand_stop_read(); ++ } ++ ++ if (buf == local_buffer_16_align) ++ memcpy(pPageBuf, buf, u4PageSize); ++ ++ return bRet; ++} ++ ++int ++mtk_nand_exec_write_page(struct mtd_info *mtd, u32 u4RowAddr, u32 u4PageSize, u8 * pPageBuf, u8 * pFDMBuf) ++{ ++ struct nand_chip *chip = mtd->priv; ++ u32 u4SecNum = u4PageSize >> 9; ++ u8 *buf; ++ u8 status; ++ ++ MSG(WRITE, "mtk_nand_exec_write_page, page: 0x%x\n", u4RowAddr); ++ ++ if (((u32) pPageBuf % 16) && local_buffer_16_align) { ++ printk(KERN_INFO "Data buffer not 16 bytes aligned: %p\n", pPageBuf); ++ memcpy(local_buffer_16_align, pPageBuf, mtd->writesize); ++ buf = local_buffer_16_align; ++ } else ++ buf = pPageBuf; ++ ++ if (mtk_nand_ready_for_write(chip, u4RowAddr, 0, true, buf)) { ++ mtk_nand_write_fdm_data(chip, pFDMBuf, u4SecNum); ++ (void)mtk_nand_write_page_data(mtd, buf, u4PageSize); ++ (void)mtk_nand_check_RW_count(u4PageSize); ++ mtk_nand_stop_write(); ++ (void)mtk_nand_set_command(NAND_CMD_PAGEPROG); ++ while (DRV_Reg32(NFI_STA_REG32) & STA_NAND_BUSY) ; ++ } ++ ++ status = chip->waitfunc(mtd, chip); ++ if (status & NAND_STATUS_FAIL) ++ return -EIO; ++ return 0; ++} ++ ++static int ++get_start_end_block(struct mtd_info *mtd, int block, int *start_blk, int *end_blk) ++{ ++ struct nand_chip *chip = mtd->priv; ++ int i; ++ ++ *start_blk = 0; ++ for (i = 0; i <= part_num; i++) ++ { ++ if (i == part_num) ++ { ++ // try the last reset partition ++ *end_blk = (chip->chipsize >> chip->phys_erase_shift) - 1; ++ if (*start_blk <= *end_blk) ++ { ++ if ((block >= *start_blk) && (block <= *end_blk)) ++ break; ++ } ++ } ++ // skip All partition entry ++ else if (g_pasStatic_Partition[i].size == MTDPART_SIZ_FULL) ++ { ++ continue; ++ } ++ *end_blk = *start_blk + (g_pasStatic_Partition[i].size >> chip->phys_erase_shift) - 1; ++ if ((block >= *start_blk) && (block <= *end_blk)) ++ break; ++ *start_blk = *end_blk + 1; ++ } ++ if (*start_blk > *end_blk) ++ { ++ return -1; ++ } ++ return 0; ++} ++ ++static int ++block_remap(struct mtd_info *mtd, int block) ++{ ++ struct nand_chip *chip = mtd->priv; ++ int start_blk, end_blk; ++ int j, block_offset; ++ int bad_block = 0; ++ ++ if (chip->bbt == NULL) { ++ printk("ERROR!! no bbt table for block_remap\n"); ++ return -1; ++ } ++ ++ if (get_start_end_block(mtd, block, &start_blk, &end_blk) < 0) { ++ printk("ERROR!! can not find start_blk and end_blk\n"); ++ return -1; ++ } ++ ++ block_offset = block - start_blk; ++ for (j = start_blk; j <= end_blk;j++) { ++ if (((chip->bbt[j >> 2] >> ((j<<1) & 0x6)) & 0x3) == 0x0) { ++ if (!block_offset) ++ break; ++ block_offset--; ++ } else { ++ bad_block++; ++ } ++ } ++ if (j <= end_blk) { ++ return j; ++ } else { ++ // remap to the bad block ++ for (j = end_blk; bad_block > 0; j--) ++ { ++ if (((chip->bbt[j >> 2] >> ((j<<1) & 0x6)) & 0x3) != 0x0) ++ { ++ bad_block--; ++ if (bad_block <= block_offset) ++ return j; ++ } ++ } ++ } ++ ++ printk("Error!! block_remap error\n"); ++ return -1; ++} ++ ++int ++check_block_remap(struct mtd_info *mtd, int block) ++{ ++ if (shift_on_bbt) ++ return block_remap(mtd, block); ++ else ++ return block; ++} ++EXPORT_SYMBOL(check_block_remap); ++ ++ ++static int ++write_next_on_fail(struct mtd_info *mtd, char *write_buf, int page, int * to_blk) ++{ ++ struct nand_chip *chip = mtd->priv; ++ int i, j, to_page = 0, first_page; ++ char *buf, *oob; ++ int start_blk = 0, end_blk; ++ int mapped_block; ++ int page_per_block_bit = chip->phys_erase_shift - chip->page_shift; ++ int block = page >> page_per_block_bit; ++ ++ // find next available block in the same MTD partition ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ ++ get_start_end_block(mtd, block, &start_blk, &end_blk); ++ ++ buf = kzalloc(mtd->writesize + mtd->oobsize, GFP_KERNEL | GFP_DMA); ++ if (buf == NULL) ++ return -1; ++ ++ oob = buf + mtd->writesize; ++ for ((*to_blk) = block + 1; (*to_blk) <= end_blk ; (*to_blk)++) { ++ if (nand_bbt_get(mtd, (*to_blk) << page_per_block_bit) == 0) { ++ int status; ++ status = mtk_nand_erase_hw(mtd, (*to_blk) << page_per_block_bit); ++ if (status & NAND_STATUS_FAIL) { ++ mtk_nand_block_markbad_hw(mtd, (*to_blk) << chip->phys_erase_shift); ++ nand_bbt_set(mtd, (*to_blk) << page_per_block_bit, 0x3); ++ } else { ++ /* good block */ ++ to_page = (*to_blk) << page_per_block_bit; ++ break; ++ } ++ } ++ } ++ ++ if (!to_page) { ++ kfree(buf); ++ return -1; ++ } ++ ++ first_page = (page >> page_per_block_bit) << page_per_block_bit; ++ for (i = 0; i < (1 << page_per_block_bit); i++) { ++ if ((first_page + i) != page) { ++ mtk_nand_read_oob_hw(mtd, chip, (first_page+i)); ++ for (j = 0; j < mtd->oobsize; j++) ++ if (chip->oob_poi[j] != (unsigned char)0xff) ++ break; ++ if (j < mtd->oobsize) { ++ mtk_nand_exec_read_page(mtd, (first_page+i), mtd->writesize, buf, oob); ++ memset(oob, 0xff, mtd->oobsize); ++ if (mtk_nand_exec_write_page(mtd, to_page + i, mtd->writesize, (u8 *)buf, oob) != 0) { ++ int ret, new_blk = 0; ++ nand_bbt_set(mtd, to_page, 0x3); ++ ret = write_next_on_fail(mtd, buf, to_page + i, &new_blk); ++ if (ret) { ++ kfree(buf); ++ mtk_nand_block_markbad_hw(mtd, to_page << chip->page_shift); ++ return ret; ++ } ++ mtk_nand_block_markbad_hw(mtd, to_page << chip->page_shift); ++ *to_blk = new_blk; ++ to_page = ((*to_blk) << page_per_block_bit); ++ } ++ } ++ } else { ++ memset(chip->oob_poi, 0xff, mtd->oobsize); ++ if (mtk_nand_exec_write_page(mtd, to_page + i, mtd->writesize, (u8 *)write_buf, chip->oob_poi) != 0) { ++ int ret, new_blk = 0; ++ nand_bbt_set(mtd, to_page, 0x3); ++ ret = write_next_on_fail(mtd, write_buf, to_page + i, &new_blk); ++ if (ret) { ++ kfree(buf); ++ mtk_nand_block_markbad_hw(mtd, to_page << chip->page_shift); ++ return ret; ++ } ++ mtk_nand_block_markbad_hw(mtd, to_page << chip->page_shift); ++ *to_blk = new_blk; ++ to_page = ((*to_blk) << page_per_block_bit); ++ } ++ } ++ } ++ ++ kfree(buf); ++ ++ return 0; ++} ++ ++static int ++mtk_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, uint32_t offset, ++ int data_len, const u8 * buf, int oob_required, int page, int cached, int raw) ++{ ++ int page_per_block = 1 << (chip->phys_erase_shift - chip->page_shift); ++ int block = page / page_per_block; ++ u16 page_in_block = page % page_per_block; ++ int mapped_block = block; ++ ++#if defined(MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++ // write bad index into oob ++ if (mapped_block != block) ++ set_bad_index_to_oob(chip->oob_poi, block); ++ else ++ set_bad_index_to_oob(chip->oob_poi, FAKE_INDEX); ++#else ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ if (nand_bbt_get(mtd, mapped_block << (chip->phys_erase_shift - chip->page_shift)) != 0x0) ++ return NAND_STATUS_FAIL; ++ } ++#endif ++ do { ++ if (mtk_nand_exec_write_page(mtd, page_in_block + mapped_block * page_per_block, mtd->writesize, (u8 *)buf, chip->oob_poi)) { ++ MSG(INIT, "write fail at block: 0x%x, page: 0x%x\n", mapped_block, page_in_block); ++#if defined(MTK_NAND_BMT) ++ if (update_bmt((page_in_block + mapped_block * page_per_block) << chip->page_shift, UPDATE_WRITE_FAIL, (u8 *) buf, chip->oob_poi)) { ++ MSG(INIT, "Update BMT success\n"); ++ return 0; ++ } else { ++ MSG(INIT, "Update BMT fail\n"); ++ return -EIO; ++ } ++#else ++ { ++ int new_blk; ++ nand_bbt_set(mtd, page_in_block + mapped_block * page_per_block, 0x3); ++ if (write_next_on_fail(mtd, (char *)buf, page_in_block + mapped_block * page_per_block, &new_blk) != 0) ++ { ++ mtk_nand_block_markbad_hw(mtd, (page_in_block + mapped_block * page_per_block) << chip->page_shift); ++ return NAND_STATUS_FAIL; ++ } ++ mtk_nand_block_markbad_hw(mtd, (page_in_block + mapped_block * page_per_block) << chip->page_shift); ++ break; ++ } ++#endif ++ } else ++ break; ++ } while(1); ++ ++ return 0; ++} ++ ++static void ++mtk_nand_command_bp(struct mtd_info *mtd, unsigned int command, int column, int page_addr) ++{ ++ struct nand_chip *nand = mtd->priv; ++ ++ switch (command) { ++ case NAND_CMD_SEQIN: ++ memset(g_kCMD.au1OOB, 0xFF, sizeof(g_kCMD.au1OOB)); ++ g_kCMD.pDataBuf = NULL; ++ g_kCMD.u4RowAddr = page_addr; ++ g_kCMD.u4ColAddr = column; ++ break; ++ ++ case NAND_CMD_PAGEPROG: ++ if (g_kCMD.pDataBuf || (0xFF != g_kCMD.au1OOB[nand_badblock_offset])) { ++ u8 *pDataBuf = g_kCMD.pDataBuf ? g_kCMD.pDataBuf : nand->buffers->databuf; ++ mtk_nand_exec_write_page(mtd, g_kCMD.u4RowAddr, mtd->writesize, pDataBuf, g_kCMD.au1OOB); ++ g_kCMD.u4RowAddr = (u32) - 1; ++ g_kCMD.u4OOBRowAddr = (u32) - 1; ++ } ++ break; ++ ++ case NAND_CMD_READOOB: ++ g_kCMD.u4RowAddr = page_addr; ++ g_kCMD.u4ColAddr = column + mtd->writesize; ++ break; ++ ++ case NAND_CMD_READ0: ++ g_kCMD.u4RowAddr = page_addr; ++ g_kCMD.u4ColAddr = column; ++ break; ++ ++ case NAND_CMD_ERASE1: ++ nand->state=FL_ERASING; ++ (void)mtk_nand_reset(); ++ mtk_nand_set_mode(CNFG_OP_ERASE); ++ (void)mtk_nand_set_command(NAND_CMD_ERASE1); ++ (void)mtk_nand_set_address(0, page_addr, 0, devinfo.addr_cycle - 2); ++ break; ++ ++ case NAND_CMD_ERASE2: ++ (void)mtk_nand_set_command(NAND_CMD_ERASE2); ++ while (DRV_Reg32(NFI_STA_REG32) & STA_NAND_BUSY) ++ ; ++ break; ++ ++ case NAND_CMD_STATUS: ++ (void)mtk_nand_reset(); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_BYTE_RW); ++ mtk_nand_set_mode(CNFG_OP_SRD); ++ mtk_nand_set_mode(CNFG_READ_EN); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ (void)mtk_nand_set_command(NAND_CMD_STATUS); ++ NFI_CLN_REG16(NFI_CON_REG16, CON_NFI_NOB_MASK); ++ mb(); ++ DRV_WriteReg16(NFI_CON_REG16, CON_NFI_SRD | (1 << CON_NFI_NOB_SHIFT)); ++ g_bcmdstatus = true; ++ break; ++ ++ case NAND_CMD_RESET: ++ (void)mtk_nand_reset(); ++ DRV_WriteReg16(NFI_INTR_EN_REG16, INTR_RST_DONE_EN); ++ (void)mtk_nand_set_command(NAND_CMD_RESET); ++ DRV_WriteReg16(NFI_BASE+0x44, 0xF1); ++ while(!(DRV_Reg16(NFI_INTR_REG16)&INTR_RST_DONE_EN)) ++ ; ++ break; ++ ++ case NAND_CMD_READID: ++ mtk_nand_reset(); ++ /* Disable HW ECC */ ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_READ_EN | CNFG_BYTE_RW); ++ (void)mtk_nand_reset(); ++ mb(); ++ mtk_nand_set_mode(CNFG_OP_SRD); ++ (void)mtk_nand_set_command(NAND_CMD_READID); ++ (void)mtk_nand_set_address(0, 0, 1, 0); ++ DRV_WriteReg16(NFI_CON_REG16, CON_NFI_SRD); ++ while (DRV_Reg32(NFI_STA_REG32) & STA_DATAR_STATE) ++ ; ++ break; ++ ++ default: ++ BUG(); ++ break; ++ } ++} ++ ++static void ++mtk_nand_select_chip(struct mtd_info *mtd, int chip) ++{ ++ if ((chip == -1) && (false == g_bInitDone)) { ++ struct nand_chip *nand = mtd->priv; ++ struct mtk_nand_host *host = nand->priv; ++ struct mtk_nand_host_hw *hw = host->hw; ++ u32 spare_per_sector = mtd->oobsize / (mtd->writesize / 512); ++ u32 ecc_bit = 4; ++ u32 spare_bit = PAGEFMT_SPARE_16; ++ ++ if (spare_per_sector >= 28) { ++ spare_bit = PAGEFMT_SPARE_28; ++ ecc_bit = 12; ++ spare_per_sector = 28; ++ } else if (spare_per_sector >= 27) { ++ spare_bit = PAGEFMT_SPARE_27; ++ ecc_bit = 8; ++ spare_per_sector = 27; ++ } else if (spare_per_sector >= 26) { ++ spare_bit = PAGEFMT_SPARE_26; ++ ecc_bit = 8; ++ spare_per_sector = 26; ++ } else if (spare_per_sector >= 16) { ++ spare_bit = PAGEFMT_SPARE_16; ++ ecc_bit = 4; ++ spare_per_sector = 16; ++ } else { ++ MSG(INIT, "[NAND]: NFI not support oobsize: %x\n", spare_per_sector); ++ ASSERT(0); ++ } ++ mtd->oobsize = spare_per_sector*(mtd->writesize/512); ++ MSG(INIT, "[NAND]select ecc bit:%d, sparesize :%d spare_per_sector=%d\n",ecc_bit,mtd->oobsize,spare_per_sector); ++ /* Setup PageFormat */ ++ if (4096 == mtd->writesize) { ++ NFI_SET_REG16(NFI_PAGEFMT_REG16, (spare_bit << PAGEFMT_SPARE_SHIFT) | PAGEFMT_4K); ++ nand->cmdfunc = mtk_nand_command_bp; ++ } else if (2048 == mtd->writesize) { ++ NFI_SET_REG16(NFI_PAGEFMT_REG16, (spare_bit << PAGEFMT_SPARE_SHIFT) | PAGEFMT_2K); ++ nand->cmdfunc = mtk_nand_command_bp; ++ } ++ ECC_Config(hw,ecc_bit); ++ g_bInitDone = true; ++ } ++ switch (chip) { ++ case -1: ++ break; ++ case 0: ++ case 1: ++ /* Jun Shen, 2011.04.13 */ ++ /* Note: MT6577 EVB NAND is mounted on CS0, but FPGA is CS1 */ ++ DRV_WriteReg16(NFI_CSEL_REG16, chip); ++ /* Jun Shen, 2011.04.13 */ ++ break; ++ } ++} ++ ++static uint8_t ++mtk_nand_read_byte(struct mtd_info *mtd) ++{ ++ uint8_t retval = 0; ++ ++ if (!mtk_nand_pio_ready()) { ++ printk("pio ready timeout\n"); ++ retval = false; ++ } ++ ++ if (g_bcmdstatus) { ++ retval = DRV_Reg8(NFI_DATAR_REG32); ++ NFI_CLN_REG16(NFI_CON_REG16, CON_NFI_NOB_MASK); ++ mtk_nand_reset(); ++ if (g_bHwEcc) { ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ } else { ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ } ++ g_bcmdstatus = false; ++ } else ++ retval = DRV_Reg8(NFI_DATAR_REG32); ++ ++ return retval; ++} ++ ++static void ++mtk_nand_read_buf(struct mtd_info *mtd, uint8_t * buf, int len) ++{ ++ struct nand_chip *nand = (struct nand_chip *)mtd->priv; ++ struct NAND_CMD *pkCMD = &g_kCMD; ++ u32 u4ColAddr = pkCMD->u4ColAddr; ++ u32 u4PageSize = mtd->writesize; ++ ++ if (u4ColAddr < u4PageSize) { ++ if ((u4ColAddr == 0) && (len >= u4PageSize)) { ++ mtk_nand_exec_read_page(mtd, pkCMD->u4RowAddr, u4PageSize, buf, pkCMD->au1OOB); ++ if (len > u4PageSize) { ++ u32 u4Size = min(len - u4PageSize, sizeof(pkCMD->au1OOB)); ++ memcpy(buf + u4PageSize, pkCMD->au1OOB, u4Size); ++ } ++ } else { ++ mtk_nand_exec_read_page(mtd, pkCMD->u4RowAddr, u4PageSize, nand->buffers->databuf, pkCMD->au1OOB); ++ memcpy(buf, nand->buffers->databuf + u4ColAddr, len); ++ } ++ pkCMD->u4OOBRowAddr = pkCMD->u4RowAddr; ++ } else { ++ u32 u4Offset = u4ColAddr - u4PageSize; ++ u32 u4Size = min(len - u4Offset, sizeof(pkCMD->au1OOB)); ++ if (pkCMD->u4OOBRowAddr != pkCMD->u4RowAddr) { ++ mtk_nand_exec_read_page(mtd, pkCMD->u4RowAddr, u4PageSize, nand->buffers->databuf, pkCMD->au1OOB); ++ pkCMD->u4OOBRowAddr = pkCMD->u4RowAddr; ++ } ++ memcpy(buf, pkCMD->au1OOB + u4Offset, u4Size); ++ } ++ pkCMD->u4ColAddr += len; ++} ++ ++static void ++mtk_nand_write_buf(struct mtd_info *mtd, const uint8_t * buf, int len) ++{ ++ struct NAND_CMD *pkCMD = &g_kCMD; ++ u32 u4ColAddr = pkCMD->u4ColAddr; ++ u32 u4PageSize = mtd->writesize; ++ int i4Size, i; ++ ++ if (u4ColAddr >= u4PageSize) { ++ u32 u4Offset = u4ColAddr - u4PageSize; ++ u8 *pOOB = pkCMD->au1OOB + u4Offset; ++ i4Size = min(len, (int)(sizeof(pkCMD->au1OOB) - u4Offset)); ++ for (i = 0; i < i4Size; i++) { ++ pOOB[i] &= buf[i]; ++ } ++ } else { ++ pkCMD->pDataBuf = (u8 *) buf; ++ } ++ ++ pkCMD->u4ColAddr += len; ++} ++ ++static int ++mtk_nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t * buf, int oob_required) ++{ ++ mtk_nand_write_buf(mtd, buf, mtd->writesize); ++ mtk_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize); ++ return 0; ++} ++ ++static int ++mtk_nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, uint8_t * buf, int oob_required, int page) ++{ ++ struct NAND_CMD *pkCMD = &g_kCMD; ++ u32 u4ColAddr = pkCMD->u4ColAddr; ++ u32 u4PageSize = mtd->writesize; ++ ++ if (u4ColAddr == 0) { ++ mtk_nand_exec_read_page(mtd, pkCMD->u4RowAddr, u4PageSize, buf, chip->oob_poi); ++ pkCMD->u4ColAddr += u4PageSize + mtd->oobsize; ++ } ++ ++ return 0; ++} ++ ++static int ++mtk_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, u8 * buf, int page) ++{ ++ int page_per_block = 1 << (chip->phys_erase_shift - chip->page_shift); ++ int block = page / page_per_block; ++ u16 page_in_block = page % page_per_block; ++ int mapped_block = block; ++ ++#if defined (MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++ if (mtk_nand_exec_read_page(mtd, page_in_block + mapped_block * page_per_block, ++ mtd->writesize, buf, chip->oob_poi)) ++ return 0; ++#else ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ if (nand_bbt_get(mtd, mapped_block << (chip->phys_erase_shift - chip->page_shift)) != 0x0) ++ return NAND_STATUS_FAIL; ++ } ++ ++ if (mtk_nand_exec_read_page(mtd, page_in_block + mapped_block * page_per_block, mtd->writesize, buf, chip->oob_poi)) ++ return 0; ++ else ++ return -EIO; ++#endif ++} ++ ++int ++mtk_nand_erase_hw(struct mtd_info *mtd, int page) ++{ ++ struct nand_chip *chip = (struct nand_chip *)mtd->priv; ++ ++ chip->erase_cmd(mtd, page); ++ ++ return chip->waitfunc(mtd, chip); ++} ++ ++static int ++mtk_nand_erase(struct mtd_info *mtd, int page) ++{ ++ // get mapping ++ struct nand_chip *chip = mtd->priv; ++ int page_per_block = 1 << (chip->phys_erase_shift - chip->page_shift); ++ int page_in_block = page % page_per_block; ++ int block = page / page_per_block; ++ int mapped_block = block; ++ ++#if defined(MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++#else ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ if (nand_bbt_get(mtd, mapped_block << (chip->phys_erase_shift - chip->page_shift)) != 0x0) ++ return NAND_STATUS_FAIL; ++ } ++#endif ++ ++ do { ++ int status = mtk_nand_erase_hw(mtd, page_in_block + page_per_block * mapped_block); ++ ++ if (status & NAND_STATUS_FAIL) { ++#if defined (MTK_NAND_BMT) ++ if (update_bmt( (page_in_block + mapped_block * page_per_block) << chip->page_shift, ++ UPDATE_ERASE_FAIL, NULL, NULL)) ++ { ++ MSG(INIT, "Erase fail at block: 0x%x, update BMT success\n", mapped_block); ++ return 0; ++ } else { ++ MSG(INIT, "Erase fail at block: 0x%x, update BMT fail\n", mapped_block); ++ return NAND_STATUS_FAIL; ++ } ++#else ++ mtk_nand_block_markbad_hw(mtd, (page_in_block + mapped_block * page_per_block) << chip->page_shift); ++ nand_bbt_set(mtd, page_in_block + mapped_block * page_per_block, 0x3); ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ if (nand_bbt_get(mtd, mapped_block << (chip->phys_erase_shift - chip->page_shift)) != 0x0) ++ return NAND_STATUS_FAIL; ++ } else ++ return NAND_STATUS_FAIL; ++#endif ++ } else ++ break; ++ } while(1); ++ ++ return 0; ++} ++ ++static int ++mtk_nand_read_oob_raw(struct mtd_info *mtd, uint8_t * buf, int page_addr, int len) ++{ ++ struct nand_chip *chip = (struct nand_chip *)mtd->priv; ++ u32 col_addr = 0; ++ u32 sector = 0; ++ int res = 0; ++ u32 colnob = 2, rawnob = devinfo.addr_cycle - 2; ++ int randomread = 0; ++ int read_len = 0; ++ int sec_num = 1<<(chip->page_shift-9); ++ int spare_per_sector = mtd->oobsize/sec_num; ++ ++ if (len > NAND_MAX_OOBSIZE || len % OOB_AVAI_PER_SECTOR || !buf) { ++ printk(KERN_WARNING "[%s] invalid parameter, len: %d, buf: %p\n", __FUNCTION__, len, buf); ++ return -EINVAL; ++ } ++ if (len > spare_per_sector) ++ randomread = 1; ++ if (!randomread || !(devinfo.advancedmode & RAMDOM_READ)) { ++ while (len > 0) { ++ read_len = min(len, spare_per_sector); ++ col_addr = NAND_SECTOR_SIZE + sector * (NAND_SECTOR_SIZE + spare_per_sector); // TODO: Fix this hard-code 16 ++ if (!mtk_nand_ready_for_read(chip, page_addr, col_addr, false, NULL)) { ++ printk(KERN_WARNING "mtk_nand_ready_for_read return failed\n"); ++ res = -EIO; ++ goto error; ++ } ++ if (!mtk_nand_mcu_read_data(buf + spare_per_sector * sector, read_len)) { ++ printk(KERN_WARNING "mtk_nand_mcu_read_data return failed\n"); ++ res = -EIO; ++ goto error; ++ } ++ mtk_nand_check_RW_count(read_len); ++ mtk_nand_stop_read(); ++ sector++; ++ len -= read_len; ++ } ++ } else { ++ col_addr = NAND_SECTOR_SIZE; ++ if (chip->options & NAND_BUSWIDTH_16) ++ col_addr /= 2; ++ if (!mtk_nand_reset()) ++ goto error; ++ mtk_nand_set_mode(0x6000); ++ NFI_SET_REG16(NFI_CNFG_REG16, CNFG_READ_EN); ++ DRV_WriteReg16(NFI_CON_REG16, 4 << CON_NFI_SEC_SHIFT); ++ ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_AHB); ++ NFI_CLN_REG16(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ ++ mtk_nand_set_autoformat(false); ++ ++ if (!mtk_nand_set_command(NAND_CMD_READ0)) ++ goto error; ++ //1 FIXED ME: For Any Kind of AddrCycle ++ if (!mtk_nand_set_address(col_addr, page_addr, colnob, rawnob)) ++ goto error; ++ if (!mtk_nand_set_command(NAND_CMD_READSTART)) ++ goto error; ++ if (!mtk_nand_status_ready(STA_NAND_BUSY)) ++ goto error; ++ read_len = min(len, spare_per_sector); ++ if (!mtk_nand_mcu_read_data(buf + spare_per_sector * sector, read_len)) { ++ printk(KERN_WARNING "mtk_nand_mcu_read_data return failed first 16\n"); ++ res = -EIO; ++ goto error; ++ } ++ sector++; ++ len -= read_len; ++ mtk_nand_stop_read(); ++ while (len > 0) { ++ read_len = min(len, spare_per_sector); ++ if (!mtk_nand_set_command(0x05)) ++ goto error; ++ col_addr = NAND_SECTOR_SIZE + sector * (NAND_SECTOR_SIZE + spare_per_sector); ++ if (chip->options & NAND_BUSWIDTH_16) ++ col_addr /= 2; ++ DRV_WriteReg32(NFI_COLADDR_REG32, col_addr); ++ DRV_WriteReg16(NFI_ADDRNOB_REG16, 2); ++ DRV_WriteReg16(NFI_CON_REG16, 4 << CON_NFI_SEC_SHIFT); ++ if (!mtk_nand_status_ready(STA_ADDR_STATE)) ++ goto error; ++ if (!mtk_nand_set_command(0xE0)) ++ goto error; ++ if (!mtk_nand_status_ready(STA_NAND_BUSY)) ++ goto error; ++ if (!mtk_nand_mcu_read_data(buf + spare_per_sector * sector, read_len)) { ++ printk(KERN_WARNING "mtk_nand_mcu_read_data return failed first 16\n"); ++ res = -EIO; ++ goto error; ++ } ++ mtk_nand_stop_read(); ++ sector++; ++ len -= read_len; ++ } ++ } ++error: ++ NFI_CLN_REG16(NFI_CON_REG16, CON_NFI_BRD); ++ return res; ++} ++ ++static int ++mtk_nand_write_oob_raw(struct mtd_info *mtd, const uint8_t * buf, int page_addr, int len) ++{ ++ struct nand_chip *chip = mtd->priv; ++ u32 col_addr = 0; ++ u32 sector = 0; ++ int write_len = 0; ++ int status; ++ int sec_num = 1<<(chip->page_shift-9); ++ int spare_per_sector = mtd->oobsize/sec_num; ++ ++ if (len > NAND_MAX_OOBSIZE || len % OOB_AVAI_PER_SECTOR || !buf) { ++ printk(KERN_WARNING "[%s] invalid parameter, len: %d, buf: %p\n", __FUNCTION__, len, buf); ++ return -EINVAL; ++ } ++ ++ while (len > 0) { ++ write_len = min(len, spare_per_sector); ++ col_addr = sector * (NAND_SECTOR_SIZE + spare_per_sector) + NAND_SECTOR_SIZE; ++ if (!mtk_nand_ready_for_write(chip, page_addr, col_addr, false, NULL)) ++ return -EIO; ++ if (!mtk_nand_mcu_write_data(mtd, buf + sector * spare_per_sector, write_len)) ++ return -EIO; ++ (void)mtk_nand_check_RW_count(write_len); ++ NFI_CLN_REG16(NFI_CON_REG16, CON_NFI_BWR); ++ (void)mtk_nand_set_command(NAND_CMD_PAGEPROG); ++ while (DRV_Reg32(NFI_STA_REG32) & STA_NAND_BUSY) ++ ; ++ status = chip->waitfunc(mtd, chip); ++ if (status & NAND_STATUS_FAIL) { ++ printk(KERN_INFO "status: %d\n", status); ++ return -EIO; ++ } ++ len -= write_len; ++ sector++; ++ } ++ ++ return 0; ++} ++ ++static int ++mtk_nand_write_oob_hw(struct mtd_info *mtd, struct nand_chip *chip, int page) ++{ ++ int i, iter; ++ int sec_num = 1<<(chip->page_shift-9); ++ int spare_per_sector = mtd->oobsize/sec_num; ++ ++ memcpy(local_oob_buf, chip->oob_poi, mtd->oobsize); ++ ++ // copy ecc data ++ for (i = 0; i < chip->ecc.layout->eccbytes; i++) { ++ iter = (i / (spare_per_sector-OOB_AVAI_PER_SECTOR)) * spare_per_sector + OOB_AVAI_PER_SECTOR + i % (spare_per_sector-OOB_AVAI_PER_SECTOR); ++ local_oob_buf[iter] = chip->oob_poi[chip->ecc.layout->eccpos[i]]; ++ } ++ ++ // copy FDM data ++ for (i = 0; i < sec_num; i++) ++ memcpy(&local_oob_buf[i * spare_per_sector], &chip->oob_poi[i * OOB_AVAI_PER_SECTOR], OOB_AVAI_PER_SECTOR); ++ ++ return mtk_nand_write_oob_raw(mtd, local_oob_buf, page, mtd->oobsize); ++} ++ ++static int mtk_nand_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) ++{ ++ int page_per_block = 1 << (chip->phys_erase_shift - chip->page_shift); ++ int block = page / page_per_block; ++ u16 page_in_block = page % page_per_block; ++ int mapped_block = block; ++ ++#if defined(MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++ // write bad index into oob ++ if (mapped_block != block) ++ set_bad_index_to_oob(chip->oob_poi, block); ++ else ++ set_bad_index_to_oob(chip->oob_poi, FAKE_INDEX); ++#else ++ if (shift_on_bbt) ++ { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ if (nand_bbt_get(mtd, mapped_block << (chip->phys_erase_shift - chip->page_shift)) != 0x0) ++ return NAND_STATUS_FAIL; ++ } ++#endif ++ do { ++ if (mtk_nand_write_oob_hw(mtd, chip, page_in_block + mapped_block * page_per_block /* page */)) { ++ MSG(INIT, "write oob fail at block: 0x%x, page: 0x%x\n", mapped_block, page_in_block); ++#if defined(MTK_NAND_BMT) ++ if (update_bmt((page_in_block + mapped_block * page_per_block) << chip->page_shift, ++ UPDATE_WRITE_FAIL, NULL, chip->oob_poi)) ++ { ++ MSG(INIT, "Update BMT success\n"); ++ return 0; ++ } else { ++ MSG(INIT, "Update BMT fail\n"); ++ return -EIO; ++ } ++#else ++ mtk_nand_block_markbad_hw(mtd, (page_in_block + mapped_block * page_per_block) << chip->page_shift); ++ nand_bbt_set(mtd, page_in_block + mapped_block * page_per_block, 0x3); ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, mapped_block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ if (nand_bbt_get(mtd, mapped_block << (chip->phys_erase_shift - chip->page_shift)) != 0x0) ++ return NAND_STATUS_FAIL; ++ } else { ++ return NAND_STATUS_FAIL; ++ } ++#endif ++ } else ++ break; ++ } while (1); ++ ++ return 0; ++} ++ ++int ++mtk_nand_block_markbad_hw(struct mtd_info *mtd, loff_t offset) ++{ ++ struct nand_chip *chip = mtd->priv; ++ int block = (int)offset >> chip->phys_erase_shift; ++ int page = block * (1 << (chip->phys_erase_shift - chip->page_shift)); ++ u8 buf[8]; ++ ++ memset(buf, 0xFF, 8); ++ buf[0] = 0; ++ return mtk_nand_write_oob_raw(mtd, buf, page, 8); ++} ++ ++static int ++mtk_nand_block_markbad(struct mtd_info *mtd, loff_t offset) ++{ ++ struct nand_chip *chip = mtd->priv; ++ int block = (int)offset >> chip->phys_erase_shift; ++ int ret; ++ int mapped_block = block; ++ ++ nand_get_device(chip, mtd, FL_WRITING); ++ ++#if defined(MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++ ret = mtk_nand_block_markbad_hw(mtd, mapped_block << chip->phys_erase_shift); ++#else ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) { ++ printk("NAND mark bad failed\n"); ++ nand_release_device(mtd); ++ return NAND_STATUS_FAIL; ++ } ++ } ++ ret = mtk_nand_block_markbad_hw(mtd, mapped_block << chip->phys_erase_shift); ++#endif ++ nand_release_device(mtd); ++ ++ return ret; ++} ++ ++int ++mtk_nand_read_oob_hw(struct mtd_info *mtd, struct nand_chip *chip, int page) ++{ ++ int i; ++ u8 iter = 0; ++ ++ int sec_num = 1<<(chip->page_shift-9); ++ int spare_per_sector = mtd->oobsize/sec_num; ++ ++ if (mtk_nand_read_oob_raw(mtd, chip->oob_poi, page, mtd->oobsize)) { ++ printk(KERN_ERR "[%s]mtk_nand_read_oob_raw return failed\n", __FUNCTION__); ++ return -EIO; ++ } ++ ++ // adjust to ecc physical layout to memory layout ++ /*********************************************************/ ++ /* FDM0 | ECC0 | FDM1 | ECC1 | FDM2 | ECC2 | FDM3 | ECC3 */ ++ /* 8B | 8B | 8B | 8B | 8B | 8B | 8B | 8B */ ++ /*********************************************************/ ++ ++ memcpy(local_oob_buf, chip->oob_poi, mtd->oobsize); ++ // copy ecc data ++ for (i = 0; i < chip->ecc.layout->eccbytes; i++) { ++ iter = (i / (spare_per_sector-OOB_AVAI_PER_SECTOR)) * spare_per_sector + OOB_AVAI_PER_SECTOR + i % (spare_per_sector-OOB_AVAI_PER_SECTOR); ++ chip->oob_poi[chip->ecc.layout->eccpos[i]] = local_oob_buf[iter]; ++ } ++ ++ // copy FDM data ++ for (i = 0; i < sec_num; i++) { ++ memcpy(&chip->oob_poi[i * OOB_AVAI_PER_SECTOR], &local_oob_buf[i * spare_per_sector], OOB_AVAI_PER_SECTOR); ++ } ++ ++ return 0; ++} ++ ++static int ++mtk_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) ++{ ++ int page_per_block = 1 << (chip->phys_erase_shift - chip->page_shift); ++ int block = page / page_per_block; ++ u16 page_in_block = page % page_per_block; ++ int mapped_block = block; ++ ++#if defined (MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++ mtk_nand_read_oob_hw(mtd, chip, page_in_block + mapped_block * page_per_block); ++#else ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) ++ return NAND_STATUS_FAIL; ++ // allow to read oob even if the block is bad ++ } ++ if (mtk_nand_read_oob_hw(mtd, chip, page_in_block + mapped_block * page_per_block)!=0) ++ return -1; ++#endif ++ return 0; ++} ++ ++int ++mtk_nand_block_bad_hw(struct mtd_info *mtd, loff_t ofs) ++{ ++ struct nand_chip *chip = (struct nand_chip *)mtd->priv; ++ int page_addr = (int)(ofs >> chip->page_shift); ++ unsigned int page_per_block = 1 << (chip->phys_erase_shift - chip->page_shift); ++ unsigned char oob_buf[8]; ++ ++ page_addr &= ~(page_per_block - 1); ++ if (mtk_nand_read_oob_raw(mtd, oob_buf, page_addr, sizeof(oob_buf))) { ++ printk(KERN_WARNING "mtk_nand_read_oob_raw return error\n"); ++ return 1; ++ } ++ ++ if (oob_buf[0] != 0xff) { ++ printk(KERN_WARNING "Bad block detected at 0x%x, oob_buf[0] is 0x%x\n", page_addr, oob_buf[0]); ++ // dump_nfi(); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++static int ++mtk_nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) ++{ ++ int chipnr = 0; ++ struct nand_chip *chip = (struct nand_chip *)mtd->priv; ++ int block = (int)ofs >> chip->phys_erase_shift; ++ int mapped_block = block; ++ int ret; ++ ++ if (getchip) { ++ chipnr = (int)(ofs >> chip->chip_shift); ++ nand_get_device(chip, mtd, FL_READING); ++ /* Select the NAND device */ ++ chip->select_chip(mtd, chipnr); ++ } ++ ++#if defined(MTK_NAND_BMT) ++ mapped_block = get_mapping_block_index(block); ++#else ++ if (shift_on_bbt) { ++ mapped_block = block_remap(mtd, block); ++ if (mapped_block == -1) { ++ if (getchip) ++ nand_release_device(mtd); ++ return NAND_STATUS_FAIL; ++ } ++ } ++#endif ++ ++ ret = mtk_nand_block_bad_hw(mtd, mapped_block << chip->phys_erase_shift); ++#if defined (MTK_NAND_BMT) ++ if (ret) { ++ MSG(INIT, "Unmapped bad block: 0x%x\n", mapped_block); ++ if (update_bmt(mapped_block << chip->phys_erase_shift, UPDATE_UNMAPPED_BLOCK, NULL, NULL)) { ++ MSG(INIT, "Update BMT success\n"); ++ ret = 0; ++ } else { ++ MSG(INIT, "Update BMT fail\n"); ++ ret = 1; ++ } ++ } ++#endif ++ ++ if (getchip) ++ nand_release_device(mtd); ++ ++ return ret; ++} ++ ++#ifdef CONFIG_MTD_NAND_VERIFY_WRITE ++char gacBuf[4096 + 288]; ++ ++static int ++mtk_nand_verify_buf(struct mtd_info *mtd, const uint8_t * buf, int len) ++{ ++ struct nand_chip *chip = (struct nand_chip *)mtd->priv; ++ struct NAND_CMD *pkCMD = &g_kCMD; ++ u32 u4PageSize = mtd->writesize; ++ u32 *pSrc, *pDst; ++ int i; ++ ++ mtk_nand_exec_read_page(mtd, pkCMD->u4RowAddr, u4PageSize, gacBuf, gacBuf + u4PageSize); ++ ++ pSrc = (u32 *) buf; ++ pDst = (u32 *) gacBuf; ++ len = len / sizeof(u32); ++ for (i = 0; i < len; ++i) { ++ if (*pSrc != *pDst) { ++ MSG(VERIFY, "mtk_nand_verify_buf page fail at page %d\n", pkCMD->u4RowAddr); ++ return -1; ++ } ++ pSrc++; ++ pDst++; ++ } ++ ++ pSrc = (u32 *) chip->oob_poi; ++ pDst = (u32 *) (gacBuf + u4PageSize); ++ ++ if ((pSrc[0] != pDst[0]) || (pSrc[1] != pDst[1]) || (pSrc[2] != pDst[2]) || (pSrc[3] != pDst[3]) || (pSrc[4] != pDst[4]) || (pSrc[5] != pDst[5])) { ++ // TODO: Ask Designer Why? ++ //(pSrc[6] != pDst[6]) || (pSrc[7] != pDst[7])) ++ MSG(VERIFY, "mtk_nand_verify_buf oob fail at page %d\n", pkCMD->u4RowAddr); ++ MSG(VERIFY, "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", pSrc[0], pSrc[1], pSrc[2], pSrc[3], pSrc[4], pSrc[5], pSrc[6], pSrc[7]); ++ MSG(VERIFY, "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", pDst[0], pDst[1], pDst[2], pDst[3], pDst[4], pDst[5], pDst[6], pDst[7]); ++ return -1; ++ } ++ return 0; ++} ++#endif ++ ++static void ++mtk_nand_init_hw(struct mtk_nand_host *host) { ++ struct mtk_nand_host_hw *hw = host->hw; ++ u32 data; ++ ++ data = DRV_Reg32(RALINK_SYSCTL_BASE+0x60); ++ data &= ~((0x3<<18)|(0x3<<16)); ++ data |= ((0x2<<18) |(0x2<<16)); ++ DRV_WriteReg32(RALINK_SYSCTL_BASE+0x60, data); ++ ++ MSG(INIT, "Enable NFI Clock\n"); ++ nand_enable_clock(); ++ ++ g_bInitDone = false; ++ g_kCMD.u4OOBRowAddr = (u32) - 1; ++ ++ /* Set default NFI access timing control */ ++ DRV_WriteReg32(NFI_ACCCON_REG32, hw->nfi_access_timing); ++ DRV_WriteReg16(NFI_CNFG_REG16, 0); ++ DRV_WriteReg16(NFI_PAGEFMT_REG16, 0); ++ ++ /* Reset the state machine and data FIFO, because flushing FIFO */ ++ (void)mtk_nand_reset(); ++ ++ /* Set the ECC engine */ ++ if (hw->nand_ecc_mode == NAND_ECC_HW) { ++ MSG(INIT, "%s : Use HW ECC\n", MODULE_NAME); ++ if (g_bHwEcc) ++ NFI_SET_REG32(NFI_CNFG_REG16, CNFG_HW_ECC_EN); ++ ECC_Config(host->hw,4); ++ mtk_nand_configure_fdm(8); ++ mtk_nand_configure_lock(); ++ } ++ ++ NFI_SET_REG16(NFI_IOCON_REG16, 0x47); ++} ++ ++static int mtk_nand_dev_ready(struct mtd_info *mtd) ++{ ++ return !(DRV_Reg32(NFI_STA_REG32) & STA_NAND_BUSY); ++} ++ ++#define FACT_BBT_BLOCK_NUM 32 // use the latest 32 BLOCK for factory bbt table ++#define FACT_BBT_OOB_SIGNATURE 1 ++#define FACT_BBT_SIGNATURE_LEN 7 ++const u8 oob_signature[] = "mtknand"; ++static u8 *fact_bbt = 0; ++static u32 bbt_size = 0; ++ ++static int ++read_fact_bbt(struct mtd_info *mtd, unsigned int page) ++{ ++ struct nand_chip *chip = mtd->priv; ++ ++ // read oob ++ if (mtk_nand_read_oob_hw(mtd, chip, page)==0) ++ { ++ if (chip->oob_poi[nand_badblock_offset] != 0xFF) ++ { ++ printk("Bad Block on Page %x\n", page); ++ return -1; ++ } ++ if (memcmp(&chip->oob_poi[FACT_BBT_OOB_SIGNATURE], oob_signature, FACT_BBT_SIGNATURE_LEN) != 0) ++ { ++ printk("compare signature failed %x\n", page); ++ return -1; ++ } ++ if (mtk_nand_exec_read_page(mtd, page, mtd->writesize, chip->buffers->databuf, chip->oob_poi)) ++ { ++ printk("Signature matched and data read!\n"); ++ memcpy(fact_bbt, chip->buffers->databuf, (bbt_size <= mtd->writesize)? bbt_size:mtd->writesize); ++ return 0; ++ } ++ ++ } ++ printk("failed at page %x\n", page); ++ return -1; ++} ++ ++static int ++load_fact_bbt(struct mtd_info *mtd) ++{ ++ struct nand_chip *chip = mtd->priv; ++ int i; ++ u32 total_block; ++ ++ total_block = 1 << (chip->chip_shift - chip->phys_erase_shift); ++ bbt_size = total_block >> 2; ++ ++ if ((!fact_bbt) && (bbt_size)) ++ fact_bbt = (u8 *)kmalloc(bbt_size, GFP_KERNEL); ++ if (!fact_bbt) ++ return -1; ++ ++ for (i = total_block - 1; i >= (total_block - FACT_BBT_BLOCK_NUM); i--) ++ { ++ if (read_fact_bbt(mtd, i << (chip->phys_erase_shift - chip->page_shift)) == 0) ++ { ++ printk("load_fact_bbt success %d\n", i); ++ return 0; ++ } ++ ++ } ++ printk("load_fact_bbt failed\n"); ++ return -1; ++} ++ ++static int ++mtk_nand_probe(struct platform_device *pdev) ++{ ++ struct mtd_part_parser_data ppdata; ++ struct mtk_nand_host_hw *hw; ++ struct mtd_info *mtd; ++ struct nand_chip *nand_chip; ++ u8 ext_id1, ext_id2, ext_id3; ++ int err = 0; ++ int id; ++ u32 ext_id; ++ int i; ++ u32 data; ++ ++ data = DRV_Reg32(RALINK_SYSCTL_BASE+0x60); ++ data &= ~((0x3<<18)|(0x3<<16)); ++ data |= ((0x2<<18) |(0x2<<16)); ++ DRV_WriteReg32(RALINK_SYSCTL_BASE+0x60, data); ++ ++ hw = &mt7621_nand_hw, ++ BUG_ON(!hw); ++ /* Allocate memory for the device structure (and zero it) */ ++ host = kzalloc(sizeof(struct mtk_nand_host), GFP_KERNEL); ++ if (!host) { ++ MSG(INIT, "mtk_nand: failed to allocate device structure.\n"); ++ return -ENOMEM; ++ } ++ ++ /* Allocate memory for 16 byte aligned buffer */ ++ local_buffer_16_align = local_buffer + 16 - ((u32) local_buffer % 16); ++ printk(KERN_INFO "Allocate 16 byte aligned buffer: %p\n", local_buffer_16_align); ++ host->hw = hw; ++ ++ /* init mtd data structure */ ++ nand_chip = &host->nand_chip; ++ nand_chip->priv = host; /* link the private data structures */ ++ ++ mtd = &host->mtd; ++ mtd->priv = nand_chip; ++ mtd->owner = THIS_MODULE; ++ mtd->name = "MT7621-NAND"; ++ ++ hw->nand_ecc_mode = NAND_ECC_HW; ++ ++ /* Set address of NAND IO lines */ ++ nand_chip->IO_ADDR_R = (void __iomem *)NFI_DATAR_REG32; ++ nand_chip->IO_ADDR_W = (void __iomem *)NFI_DATAW_REG32; ++ nand_chip->chip_delay = 20; /* 20us command delay time */ ++ nand_chip->ecc.mode = hw->nand_ecc_mode; /* enable ECC */ ++ nand_chip->ecc.strength = 1; ++ nand_chip->read_byte = mtk_nand_read_byte; ++ nand_chip->read_buf = mtk_nand_read_buf; ++ nand_chip->write_buf = mtk_nand_write_buf; ++#ifdef CONFIG_MTD_NAND_VERIFY_WRITE ++ nand_chip->verify_buf = mtk_nand_verify_buf; ++#endif ++ nand_chip->select_chip = mtk_nand_select_chip; ++ nand_chip->dev_ready = mtk_nand_dev_ready; ++ nand_chip->cmdfunc = mtk_nand_command_bp; ++ nand_chip->ecc.read_page = mtk_nand_read_page_hwecc; ++ nand_chip->ecc.write_page = mtk_nand_write_page_hwecc; ++ ++ nand_chip->ecc.layout = &nand_oob_64; ++ nand_chip->ecc.size = hw->nand_ecc_size; //2048 ++ nand_chip->ecc.bytes = hw->nand_ecc_bytes; //32 ++ ++ // For BMT, we need to revise driver architecture ++ nand_chip->write_page = mtk_nand_write_page; ++ nand_chip->ecc.write_oob = mtk_nand_write_oob; ++ nand_chip->block_markbad = mtk_nand_block_markbad; // need to add nand_get_device()/nand_release_device(). ++ // nand_chip->erase = mtk_nand_erase; ++ // nand_chip->read_page = mtk_nand_read_page; ++ nand_chip->ecc.read_oob = mtk_nand_read_oob; ++ nand_chip->block_bad = mtk_nand_block_bad; ++ ++ //Qwert:Add for Uboot ++ mtk_nand_init_hw(host); ++ /* Select the device */ ++ nand_chip->select_chip(mtd, NFI_DEFAULT_CS); ++ ++ /* ++ * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx) ++ * after power-up ++ */ ++ nand_chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); ++ ++ memset(&devinfo, 0 , sizeof(flashdev_info)); ++ ++ /* Send the command for reading device ID */ ++ ++ nand_chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); ++ ++ /* Read manufacturer and device IDs */ ++ manu_id = nand_chip->read_byte(mtd); ++ dev_id = nand_chip->read_byte(mtd); ++ id = dev_id | (manu_id << 8); ++ ext_id1 = nand_chip->read_byte(mtd); ++ ext_id2 = nand_chip->read_byte(mtd); ++ ext_id3 = nand_chip->read_byte(mtd); ++ ext_id = ext_id1 << 16 | ext_id2 << 8 | ext_id3; ++ if (!get_device_info(id, ext_id, &devinfo)) { ++ u32 chip_mode = RALINK_REG(RALINK_SYSCTL_BASE+0x010)&0x0F; ++ MSG(INIT, "Not Support this Device! \r\n"); ++ memset(&devinfo, 0 , sizeof(flashdev_info)); ++ MSG(INIT, "chip_mode=%08X\n",chip_mode); ++ ++ /* apply bootstrap first */ ++ devinfo.addr_cycle = 5; ++ devinfo.iowidth = 8; ++ ++ switch (chip_mode) { ++ case 10: ++ devinfo.pagesize = 2048; ++ devinfo.sparesize = 128; ++ devinfo.totalsize = 128; ++ devinfo.blocksize = 128; ++ break; ++ case 11: ++ devinfo.pagesize = 4096; ++ devinfo.sparesize = 128; ++ devinfo.totalsize = 1024; ++ devinfo.blocksize = 256; ++ break; ++ case 12: ++ devinfo.pagesize = 4096; ++ devinfo.sparesize = 224; ++ devinfo.totalsize = 2048; ++ devinfo.blocksize = 512; ++ break; ++ default: ++ case 1: ++ devinfo.pagesize = 2048; ++ devinfo.sparesize = 64; ++ devinfo.totalsize = 128; ++ devinfo.blocksize = 128; ++ break; ++ } ++ ++ devinfo.timmingsetting = NFI_DEFAULT_ACCESS_TIMING; ++ devinfo.devciename[0] = 'U'; ++ devinfo.advancedmode = 0; ++ } ++ mtd->writesize = devinfo.pagesize; ++ mtd->erasesize = (devinfo.blocksize<<10); ++ mtd->oobsize = devinfo.sparesize; ++ ++ nand_chip->chipsize = (devinfo.totalsize<<20); ++ nand_chip->page_shift = ffs(mtd->writesize) - 1; ++ nand_chip->pagemask = (nand_chip->chipsize >> nand_chip->page_shift) - 1; ++ nand_chip->phys_erase_shift = ffs(mtd->erasesize) - 1; ++ nand_chip->chip_shift = ffs(nand_chip->chipsize) - 1;//0x1C;//ffs(nand_chip->chipsize) - 1; ++ nand_chip->oob_poi = nand_chip->buffers->databuf + mtd->writesize; ++ nand_chip->badblockpos = 0; ++ ++ if (devinfo.pagesize == 4096) ++ nand_chip->ecc.layout = &nand_oob_128; ++ else if (devinfo.pagesize == 2048) ++ nand_chip->ecc.layout = &nand_oob_64; ++ else if (devinfo.pagesize == 512) ++ nand_chip->ecc.layout = &nand_oob_16; ++ ++ nand_chip->ecc.layout->eccbytes = devinfo.sparesize-OOB_AVAI_PER_SECTOR*(devinfo.pagesize/NAND_SECTOR_SIZE); ++ for (i = 0; i < nand_chip->ecc.layout->eccbytes; i++) ++ nand_chip->ecc.layout->eccpos[i]=OOB_AVAI_PER_SECTOR*(devinfo.pagesize/NAND_SECTOR_SIZE)+i; ++ ++ MSG(INIT, "Support this Device in MTK table! %x \r\n", id); ++ hw->nfi_bus_width = devinfo.iowidth; ++ DRV_WriteReg32(NFI_ACCCON_REG32, devinfo.timmingsetting); ++ ++ /* 16-bit bus width */ ++ if (hw->nfi_bus_width == 16) { ++ MSG(INIT, "%s : Set the 16-bit I/O settings!\n", MODULE_NAME); ++ nand_chip->options |= NAND_BUSWIDTH_16; ++ } ++ mtd->oobsize = devinfo.sparesize; ++ hw->nfi_cs_num = 1; ++ ++ /* Scan to find existance of the device */ ++ if (nand_scan(mtd, hw->nfi_cs_num)) { ++ MSG(INIT, "%s : nand_scan fail.\n", MODULE_NAME); ++ err = -ENXIO; ++ goto out; ++ } ++ ++ g_page_size = mtd->writesize; ++ platform_set_drvdata(pdev, host); ++ if (hw->nfi_bus_width == 16) { ++ NFI_SET_REG16(NFI_PAGEFMT_REG16, PAGEFMT_DBYTE_EN); ++ } ++ ++ nand_chip->select_chip(mtd, 0); ++#if defined(MTK_NAND_BMT) ++ nand_chip->chipsize -= (BMT_POOL_SIZE) << nand_chip->phys_erase_shift; ++#endif ++ mtd->size = nand_chip->chipsize; ++ ++ CFG_BLOCKSIZE = mtd->erasesize; ++ ++#if defined(MTK_NAND_BMT) ++ if (!g_bmt) { ++ if (!(g_bmt = init_bmt(nand_chip, BMT_POOL_SIZE))) { ++ MSG(INIT, "Error: init bmt failed\n"); ++ return 0; ++ } ++ } ++#endif ++ ++ ppdata.of_node = pdev->dev.of_node; ++ err = mtd_device_parse_register(mtd, probe_types, &ppdata, ++ NULL, 0); ++ if (!err) { ++ MSG(INIT, "[mtk_nand] probe successfully!\n"); ++ nand_disable_clock(); ++ shift_on_bbt = 1; ++ if (load_fact_bbt(mtd) == 0) { ++ int i; ++ for (i = 0; i < 0x100; i++) ++ nand_chip->bbt[i] |= fact_bbt[i]; ++ } ++ ++ return err; ++ } ++ ++out: ++ MSG(INIT, "[NFI] mtk_nand_probe fail, err = %d!\n", err); ++ nand_release(mtd); ++ platform_set_drvdata(pdev, NULL); ++ kfree(host); ++ nand_disable_clock(); ++ return err; ++} ++ ++static int ++mtk_nand_remove(struct platform_device *pdev) ++{ ++ struct mtk_nand_host *host = platform_get_drvdata(pdev); ++ struct mtd_info *mtd = &host->mtd; ++ ++ nand_release(mtd); ++ kfree(host); ++ nand_disable_clock(); ++ ++ return 0; ++} ++ ++static const struct of_device_id mt7621_nand_match[] = { ++ { .compatible = "mtk,mt7621-nand" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mt7621_nand_match); ++ ++static struct platform_driver mtk_nand_driver = { ++ .probe = mtk_nand_probe, ++ .remove = mtk_nand_remove, ++ .driver = { ++ .name = "MT7621-NAND", ++ .owner = THIS_MODULE, ++ .of_match_table = mt7621_nand_match, ++ }, ++}; ++ ++static int __init ++mtk_nand_init(void) ++{ ++ printk("MediaTek Nand driver init, version %s\n", VERSION); ++ ++ return platform_driver_register(&mtk_nand_driver); ++} ++ ++static void __exit ++mtk_nand_exit(void) ++{ ++ platform_driver_unregister(&mtk_nand_driver); ++} ++ ++module_init(mtk_nand_init); ++module_exit(mtk_nand_exit); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/mtd/nand/mtk_nand.h +@@ -0,0 +1,452 @@ ++#ifndef __MTK_NAND_H ++#define __MTK_NAND_H ++ ++#define RALINK_NAND_CTRL_BASE 0xBE003000 ++#define RALINK_SYSCTL_BASE 0xBE000000 ++#define RALINK_NANDECC_CTRL_BASE 0xBE003800 ++/******************************************************************************* ++ * NFI Register Definition ++ *******************************************************************************/ ++ ++#define NFI_CNFG_REG16 ((volatile P_U16)(NFI_BASE+0x0000)) ++#define NFI_PAGEFMT_REG16 ((volatile P_U16)(NFI_BASE+0x0004)) ++#define NFI_CON_REG16 ((volatile P_U16)(NFI_BASE+0x0008)) ++#define NFI_ACCCON_REG32 ((volatile P_U32)(NFI_BASE+0x000C)) ++#define NFI_INTR_EN_REG16 ((volatile P_U16)(NFI_BASE+0x0010)) ++#define NFI_INTR_REG16 ((volatile P_U16)(NFI_BASE+0x0014)) ++ ++#define NFI_CMD_REG16 ((volatile P_U16)(NFI_BASE+0x0020)) ++ ++#define NFI_ADDRNOB_REG16 ((volatile P_U16)(NFI_BASE+0x0030)) ++#define NFI_COLADDR_REG32 ((volatile P_U32)(NFI_BASE+0x0034)) ++#define NFI_ROWADDR_REG32 ((volatile P_U32)(NFI_BASE+0x0038)) ++ ++#define NFI_STRDATA_REG16 ((volatile P_U16)(NFI_BASE+0x0040)) ++ ++#define NFI_DATAW_REG32 ((volatile P_U32)(NFI_BASE+0x0050)) ++#define NFI_DATAR_REG32 ((volatile P_U32)(NFI_BASE+0x0054)) ++#define NFI_PIO_DIRDY_REG16 ((volatile P_U16)(NFI_BASE+0x0058)) ++ ++#define NFI_STA_REG32 ((volatile P_U32)(NFI_BASE+0x0060)) ++#define NFI_FIFOSTA_REG16 ((volatile P_U16)(NFI_BASE+0x0064)) ++#define NFI_LOCKSTA_REG16 ((volatile P_U16)(NFI_BASE+0x0068)) ++ ++#define NFI_ADDRCNTR_REG16 ((volatile P_U16)(NFI_BASE+0x0070)) ++ ++#define NFI_STRADDR_REG32 ((volatile P_U32)(NFI_BASE+0x0080)) ++#define NFI_BYTELEN_REG16 ((volatile P_U16)(NFI_BASE+0x0084)) ++ ++#define NFI_CSEL_REG16 ((volatile P_U16)(NFI_BASE+0x0090)) ++#define NFI_IOCON_REG16 ((volatile P_U16)(NFI_BASE+0x0094)) ++ ++#define NFI_FDM0L_REG32 ((volatile P_U32)(NFI_BASE+0x00A0)) ++#define NFI_FDM0M_REG32 ((volatile P_U32)(NFI_BASE+0x00A4)) ++ ++#define NFI_LOCK_REG16 ((volatile P_U16)(NFI_BASE+0x0100)) ++#define NFI_LOCKCON_REG32 ((volatile P_U32)(NFI_BASE+0x0104)) ++#define NFI_LOCKANOB_REG16 ((volatile P_U16)(NFI_BASE+0x0108)) ++#define NFI_LOCK00ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0110)) ++#define NFI_LOCK00FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0114)) ++#define NFI_LOCK01ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0118)) ++#define NFI_LOCK01FMT_REG32 ((volatile P_U32)(NFI_BASE+0x011C)) ++#define NFI_LOCK02ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0120)) ++#define NFI_LOCK02FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0124)) ++#define NFI_LOCK03ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0128)) ++#define NFI_LOCK03FMT_REG32 ((volatile P_U32)(NFI_BASE+0x012C)) ++#define NFI_LOCK04ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0130)) ++#define NFI_LOCK04FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0134)) ++#define NFI_LOCK05ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0138)) ++#define NFI_LOCK05FMT_REG32 ((volatile P_U32)(NFI_BASE+0x013C)) ++#define NFI_LOCK06ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0140)) ++#define NFI_LOCK06FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0144)) ++#define NFI_LOCK07ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0148)) ++#define NFI_LOCK07FMT_REG32 ((volatile P_U32)(NFI_BASE+0x014C)) ++#define NFI_LOCK08ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0150)) ++#define NFI_LOCK08FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0154)) ++#define NFI_LOCK09ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0158)) ++#define NFI_LOCK09FMT_REG32 ((volatile P_U32)(NFI_BASE+0x015C)) ++#define NFI_LOCK10ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0160)) ++#define NFI_LOCK10FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0164)) ++#define NFI_LOCK11ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0168)) ++#define NFI_LOCK11FMT_REG32 ((volatile P_U32)(NFI_BASE+0x016C)) ++#define NFI_LOCK12ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0170)) ++#define NFI_LOCK12FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0174)) ++#define NFI_LOCK13ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0178)) ++#define NFI_LOCK13FMT_REG32 ((volatile P_U32)(NFI_BASE+0x017C)) ++#define NFI_LOCK14ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0180)) ++#define NFI_LOCK14FMT_REG32 ((volatile P_U32)(NFI_BASE+0x0184)) ++#define NFI_LOCK15ADD_REG32 ((volatile P_U32)(NFI_BASE+0x0188)) ++#define NFI_LOCK15FMT_REG32 ((volatile P_U32)(NFI_BASE+0x018C)) ++ ++#define NFI_FIFODATA0_REG32 ((volatile P_U32)(NFI_BASE+0x0190)) ++#define NFI_FIFODATA1_REG32 ((volatile P_U32)(NFI_BASE+0x0194)) ++#define NFI_FIFODATA2_REG32 ((volatile P_U32)(NFI_BASE+0x0198)) ++#define NFI_FIFODATA3_REG32 ((volatile P_U32)(NFI_BASE+0x019C)) ++#define NFI_MASTERSTA_REG16 ((volatile P_U16)(NFI_BASE+0x0210)) ++ ++ ++/******************************************************************************* ++ * NFI Register Field Definition ++ *******************************************************************************/ ++ ++/* NFI_CNFG */ ++#define CNFG_AHB (0x0001) ++#define CNFG_READ_EN (0x0002) ++#define CNFG_DMA_BURST_EN (0x0004) ++#define CNFG_BYTE_RW (0x0040) ++#define CNFG_HW_ECC_EN (0x0100) ++#define CNFG_AUTO_FMT_EN (0x0200) ++#define CNFG_OP_IDLE (0x0000) ++#define CNFG_OP_READ (0x1000) ++#define CNFG_OP_SRD (0x2000) ++#define CNFG_OP_PRGM (0x3000) ++#define CNFG_OP_ERASE (0x4000) ++#define CNFG_OP_RESET (0x5000) ++#define CNFG_OP_CUST (0x6000) ++#define CNFG_OP_MODE_MASK (0x7000) ++#define CNFG_OP_MODE_SHIFT (12) ++ ++/* NFI_PAGEFMT */ ++#define PAGEFMT_512 (0x0000) ++#define PAGEFMT_2K (0x0001) ++#define PAGEFMT_4K (0x0002) ++ ++#define PAGEFMT_PAGE_MASK (0x0003) ++ ++#define PAGEFMT_DBYTE_EN (0x0008) ++ ++#define PAGEFMT_SPARE_16 (0x0000) ++#define PAGEFMT_SPARE_26 (0x0001) ++#define PAGEFMT_SPARE_27 (0x0002) ++#define PAGEFMT_SPARE_28 (0x0003) ++#define PAGEFMT_SPARE_MASK (0x0030) ++#define PAGEFMT_SPARE_SHIFT (4) ++ ++#define PAGEFMT_FDM_MASK (0x0F00) ++#define PAGEFMT_FDM_SHIFT (8) ++ ++#define PAGEFMT_FDM_ECC_MASK (0xF000) ++#define PAGEFMT_FDM_ECC_SHIFT (12) ++ ++/* NFI_CON */ ++#define CON_FIFO_FLUSH (0x0001) ++#define CON_NFI_RST (0x0002) ++#define CON_NFI_SRD (0x0010) ++ ++#define CON_NFI_NOB_MASK (0x0060) ++#define CON_NFI_NOB_SHIFT (5) ++ ++#define CON_NFI_BRD (0x0100) ++#define CON_NFI_BWR (0x0200) ++ ++#define CON_NFI_SEC_MASK (0xF000) ++#define CON_NFI_SEC_SHIFT (12) ++ ++/* NFI_ACCCON */ ++#define ACCCON_SETTING () ++ ++/* NFI_INTR_EN */ ++#define INTR_RD_DONE_EN (0x0001) ++#define INTR_WR_DONE_EN (0x0002) ++#define INTR_RST_DONE_EN (0x0004) ++#define INTR_ERASE_DONE_EN (0x0008) ++#define INTR_BSY_RTN_EN (0x0010) ++#define INTR_ACC_LOCK_EN (0x0020) ++#define INTR_AHB_DONE_EN (0x0040) ++#define INTR_ALL_INTR_DE (0x0000) ++#define INTR_ALL_INTR_EN (0x007F) ++ ++/* NFI_INTR */ ++#define INTR_RD_DONE (0x0001) ++#define INTR_WR_DONE (0x0002) ++#define INTR_RST_DONE (0x0004) ++#define INTR_ERASE_DONE (0x0008) ++#define INTR_BSY_RTN (0x0010) ++#define INTR_ACC_LOCK (0x0020) ++#define INTR_AHB_DONE (0x0040) ++ ++/* NFI_ADDRNOB */ ++#define ADDR_COL_NOB_MASK (0x0003) ++#define ADDR_COL_NOB_SHIFT (0) ++#define ADDR_ROW_NOB_MASK (0x0030) ++#define ADDR_ROW_NOB_SHIFT (4) ++ ++/* NFI_STA */ ++#define STA_READ_EMPTY (0x00001000) ++#define STA_ACC_LOCK (0x00000010) ++#define STA_CMD_STATE (0x00000001) ++#define STA_ADDR_STATE (0x00000002) ++#define STA_DATAR_STATE (0x00000004) ++#define STA_DATAW_STATE (0x00000008) ++ ++#define STA_NAND_FSM_MASK (0x1F000000) ++#define STA_NAND_BUSY (0x00000100) ++#define STA_NAND_BUSY_RETURN (0x00000200) ++#define STA_NFI_FSM_MASK (0x000F0000) ++#define STA_NFI_OP_MASK (0x0000000F) ++ ++/* NFI_FIFOSTA */ ++#define FIFO_RD_EMPTY (0x0040) ++#define FIFO_RD_FULL (0x0080) ++#define FIFO_WR_FULL (0x8000) ++#define FIFO_WR_EMPTY (0x4000) ++#define FIFO_RD_REMAIN(x) (0x1F&(x)) ++#define FIFO_WR_REMAIN(x) ((0x1F00&(x))>>8) ++ ++/* NFI_ADDRCNTR */ ++#define ADDRCNTR_CNTR(x) ((0xF000&(x))>>12) ++#define ADDRCNTR_OFFSET(x) (0x03FF&(x)) ++ ++/* NFI_LOCK */ ++#define NFI_LOCK_ON (0x0001) ++ ++/* NFI_LOCKANOB */ ++#define PROG_RADD_NOB_MASK (0x7000) ++#define PROG_RADD_NOB_SHIFT (12) ++#define PROG_CADD_NOB_MASK (0x0300) ++#define PROG_CADD_NOB_SHIFT (8) ++#define ERASE_RADD_NOB_MASK (0x0070) ++#define ERASE_RADD_NOB_SHIFT (4) ++#define ERASE_CADD_NOB_MASK (0x0007) ++#define ERASE_CADD_NOB_SHIFT (0) ++ ++/******************************************************************************* ++ * ECC Register Definition ++ *******************************************************************************/ ++ ++#define ECC_ENCCON_REG16 ((volatile P_U16)(NFIECC_BASE+0x0000)) ++#define ECC_ENCCNFG_REG32 ((volatile P_U32)(NFIECC_BASE+0x0004)) ++#define ECC_ENCDIADDR_REG32 ((volatile P_U32)(NFIECC_BASE+0x0008)) ++#define ECC_ENCIDLE_REG32 ((volatile P_U32)(NFIECC_BASE+0x000C)) ++#define ECC_ENCPAR0_REG32 ((volatile P_U32)(NFIECC_BASE+0x0010)) ++#define ECC_ENCPAR1_REG32 ((volatile P_U32)(NFIECC_BASE+0x0014)) ++#define ECC_ENCPAR2_REG32 ((volatile P_U32)(NFIECC_BASE+0x0018)) ++#define ECC_ENCPAR3_REG32 ((volatile P_U32)(NFIECC_BASE+0x001C)) ++#define ECC_ENCPAR4_REG32 ((volatile P_U32)(NFIECC_BASE+0x0020)) ++#define ECC_ENCSTA_REG32 ((volatile P_U32)(NFIECC_BASE+0x0024)) ++#define ECC_ENCIRQEN_REG16 ((volatile P_U16)(NFIECC_BASE+0x0028)) ++#define ECC_ENCIRQSTA_REG16 ((volatile P_U16)(NFIECC_BASE+0x002C)) ++ ++#define ECC_DECCON_REG16 ((volatile P_U16)(NFIECC_BASE+0x0100)) ++#define ECC_DECCNFG_REG32 ((volatile P_U32)(NFIECC_BASE+0x0104)) ++#define ECC_DECDIADDR_REG32 ((volatile P_U32)(NFIECC_BASE+0x0108)) ++#define ECC_DECIDLE_REG16 ((volatile P_U16)(NFIECC_BASE+0x010C)) ++#define ECC_DECFER_REG16 ((volatile P_U16)(NFIECC_BASE+0x0110)) ++#define ECC_DECENUM_REG32 ((volatile P_U32)(NFIECC_BASE+0x0114)) ++#define ECC_DECDONE_REG16 ((volatile P_U16)(NFIECC_BASE+0x0118)) ++#define ECC_DECEL0_REG32 ((volatile P_U32)(NFIECC_BASE+0x011C)) ++#define ECC_DECEL1_REG32 ((volatile P_U32)(NFIECC_BASE+0x0120)) ++#define ECC_DECEL2_REG32 ((volatile P_U32)(NFIECC_BASE+0x0124)) ++#define ECC_DECEL3_REG32 ((volatile P_U32)(NFIECC_BASE+0x0128)) ++#define ECC_DECEL4_REG32 ((volatile P_U32)(NFIECC_BASE+0x012C)) ++#define ECC_DECEL5_REG32 ((volatile P_U32)(NFIECC_BASE+0x0130)) ++#define ECC_DECIRQEN_REG16 ((volatile P_U16)(NFIECC_BASE+0x0134)) ++#define ECC_DECIRQSTA_REG16 ((volatile P_U16)(NFIECC_BASE+0x0138)) ++#define ECC_FDMADDR_REG32 ((volatile P_U32)(NFIECC_BASE+0x013C)) ++#define ECC_DECFSM_REG32 ((volatile P_U32)(NFIECC_BASE+0x0140)) ++#define ECC_SYNSTA_REG32 ((volatile P_U32)(NFIECC_BASE+0x0144)) ++#define ECC_DECNFIDI_REG32 ((volatile P_U32)(NFIECC_BASE+0x0148)) ++#define ECC_SYN0_REG32 ((volatile P_U32)(NFIECC_BASE+0x014C)) ++ ++/******************************************************************************* ++ * ECC register definition ++ *******************************************************************************/ ++/* ECC_ENCON */ ++#define ENC_EN (0x0001) ++#define ENC_DE (0x0000) ++ ++/* ECC_ENCCNFG */ ++#define ECC_CNFG_ECC4 (0x0000) ++#define ECC_CNFG_ECC6 (0x0001) ++#define ECC_CNFG_ECC8 (0x0002) ++#define ECC_CNFG_ECC10 (0x0003) ++#define ECC_CNFG_ECC12 (0x0004) ++#define ECC_CNFG_ECC_MASK (0x00000007) ++ ++#define ENC_CNFG_NFI (0x0010) ++#define ENC_CNFG_MODE_MASK (0x0010) ++ ++#define ENC_CNFG_META6 (0x10300000) ++#define ENC_CNFG_META8 (0x10400000) ++ ++#define ENC_CNFG_MSG_MASK (0x1FFF0000) ++#define ENC_CNFG_MSG_SHIFT (0x10) ++ ++/* ECC_ENCIDLE */ ++#define ENC_IDLE (0x0001) ++ ++/* ECC_ENCSTA */ ++#define STA_FSM (0x001F) ++#define STA_COUNT_PS (0xFF10) ++#define STA_COUNT_MS (0x3FFF0000) ++ ++/* ECC_ENCIRQEN */ ++#define ENC_IRQEN (0x0001) ++ ++/* ECC_ENCIRQSTA */ ++#define ENC_IRQSTA (0x0001) ++ ++/* ECC_DECCON */ ++#define DEC_EN (0x0001) ++#define DEC_DE (0x0000) ++ ++/* ECC_ENCCNFG */ ++#define DEC_CNFG_ECC4 (0x0000) ++//#define DEC_CNFG_ECC6 (0x0001) ++//#define DEC_CNFG_ECC12 (0x0002) ++#define DEC_CNFG_NFI (0x0010) ++//#define DEC_CNFG_META6 (0x10300000) ++//#define DEC_CNFG_META8 (0x10400000) ++ ++#define DEC_CNFG_FER (0x01000) ++#define DEC_CNFG_EL (0x02000) ++#define DEC_CNFG_CORRECT (0x03000) ++#define DEC_CNFG_TYPE_MASK (0x03000) ++ ++#define DEC_CNFG_EMPTY_EN (0x80000000) ++ ++#define DEC_CNFG_CODE_MASK (0x1FFF0000) ++#define DEC_CNFG_CODE_SHIFT (0x10) ++ ++/* ECC_DECIDLE */ ++#define DEC_IDLE (0x0001) ++ ++/* ECC_DECFER */ ++#define DEC_FER0 (0x0001) ++#define DEC_FER1 (0x0002) ++#define DEC_FER2 (0x0004) ++#define DEC_FER3 (0x0008) ++#define DEC_FER4 (0x0010) ++#define DEC_FER5 (0x0020) ++#define DEC_FER6 (0x0040) ++#define DEC_FER7 (0x0080) ++ ++/* ECC_DECENUM */ ++#define ERR_NUM0 (0x0000000F) ++#define ERR_NUM1 (0x000000F0) ++#define ERR_NUM2 (0x00000F00) ++#define ERR_NUM3 (0x0000F000) ++#define ERR_NUM4 (0x000F0000) ++#define ERR_NUM5 (0x00F00000) ++#define ERR_NUM6 (0x0F000000) ++#define ERR_NUM7 (0xF0000000) ++ ++/* ECC_DECDONE */ ++#define DEC_DONE0 (0x0001) ++#define DEC_DONE1 (0x0002) ++#define DEC_DONE2 (0x0004) ++#define DEC_DONE3 (0x0008) ++#define DEC_DONE4 (0x0010) ++#define DEC_DONE5 (0x0020) ++#define DEC_DONE6 (0x0040) ++#define DEC_DONE7 (0x0080) ++ ++/* ECC_DECIRQEN */ ++#define DEC_IRQEN (0x0001) ++ ++/* ECC_DECIRQSTA */ ++#define DEC_IRQSTA (0x0001) ++ ++#define CHIPVER_ECO_1 (0x8a00) ++#define CHIPVER_ECO_2 (0x8a01) ++ ++//#define NAND_PFM ++ ++/******************************************************************************* ++ * Data Structure Definition ++ *******************************************************************************/ ++struct mtk_nand_host ++{ ++ struct nand_chip nand_chip; ++ struct mtd_info mtd; ++ struct mtk_nand_host_hw *hw; ++}; ++ ++struct NAND_CMD ++{ ++ u32 u4ColAddr; ++ u32 u4RowAddr; ++ u32 u4OOBRowAddr; ++ u8 au1OOB[288]; ++ u8* pDataBuf; ++#ifdef NAND_PFM ++ u32 pureReadOOB; ++ u32 pureReadOOBNum; ++#endif ++}; ++ ++/* ++ * ECC layout control structure. Exported to userspace for ++ * diagnosis and to allow creation of raw images ++struct nand_ecclayout { ++ uint32_t eccbytes; ++ uint32_t eccpos[64]; ++ uint32_t oobavail; ++ struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; ++}; ++*/ ++#define __DEBUG_NAND 1 /* Debug information on/off */ ++ ++/* Debug message event */ ++#define DBG_EVT_NONE 0x00000000 /* No event */ ++#define DBG_EVT_INIT 0x00000001 /* Initial related event */ ++#define DBG_EVT_VERIFY 0x00000002 /* Verify buffer related event */ ++#define DBG_EVT_PERFORMANCE 0x00000004 /* Performance related event */ ++#define DBG_EVT_READ 0x00000008 /* Read related event */ ++#define DBG_EVT_WRITE 0x00000010 /* Write related event */ ++#define DBG_EVT_ERASE 0x00000020 /* Erase related event */ ++#define DBG_EVT_BADBLOCK 0x00000040 /* Badblock related event */ ++#define DBG_EVT_POWERCTL 0x00000080 /* Suspend/Resume related event */ ++ ++#define DBG_EVT_ALL 0xffffffff ++ ++#define DBG_EVT_MASK (DBG_EVT_INIT) ++ ++#if __DEBUG_NAND ++#define MSG(evt, fmt, args...) \ ++do { \ ++ if ((DBG_EVT_##evt) & DBG_EVT_MASK) { \ ++ printk(fmt, ##args); \ ++ } \ ++} while(0) ++ ++#define MSG_FUNC_ENTRY(f) MSG(FUC, ": %s\n", __FUNCTION__) ++#else ++#define MSG(evt, fmt, args...) do{}while(0) ++#define MSG_FUNC_ENTRY(f) do{}while(0) ++#endif ++ ++#define RAMDOM_READ 1<<0 ++#define CACHE_READ 1<<1 ++ ++typedef struct ++{ ++ u16 id; //deviceid+menuid ++ u32 ext_id; ++ u8 addr_cycle; ++ u8 iowidth; ++ u16 totalsize; ++ u16 blocksize; ++ u16 pagesize; ++ u16 sparesize; ++ u32 timmingsetting; ++ char devciename[14]; ++ u32 advancedmode; // ++}flashdev_info,*pflashdev_info; ++ ++/* NAND driver */ ++#if 0 ++struct mtk_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 mtk_nand_host_hw mt7621_nand_hw; ++extern u32 CFG_BLOCKSIZE; ++#endif ++#endif +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -92,7 +92,7 @@ static struct nand_ecclayout nand_oob_12 + .length = 78} } + }; + +-static int nand_get_device(struct mtd_info *mtd, int new_state); ++int nand_get_device(struct mtd_info *mtd, int new_state); + + static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, + struct mtd_oob_ops *ops); +@@ -130,7 +130,7 @@ static int check_offs_len(struct mtd_inf + * + * Release chip lock and wake up anyone waiting on the device. + */ +-static void nand_release_device(struct mtd_info *mtd) ++void nand_release_device(struct mtd_info *mtd) + { + struct nand_chip *chip = mtd->priv; + +@@ -829,7 +829,7 @@ static void panic_nand_get_device(struct + * + * Get the device and lock it for exclusive access + */ +-static int ++int + nand_get_device(struct mtd_info *mtd, int new_state) + { + struct nand_chip *chip = mtd->priv; +--- a/drivers/mtd/nand/nand_bbt.c ++++ b/drivers/mtd/nand/nand_bbt.c +@@ -1374,4 +1374,23 @@ int nand_markbad_bbt(struct mtd_info *mt + return ret; + } + ++void nand_bbt_set(struct mtd_info *mtd, int page, int flag) ++{ ++ struct nand_chip *this = mtd->priv; ++ int block; ++ ++ block = (int)(page >> (this->bbt_erase_shift - this->page_shift - 1)); ++ this->bbt[block >> 3] &= ~(0x03 << (block & 0x6)); ++ this->bbt[block >> 3] |= (flag & 0x3) << (block & 0x6); ++} ++ ++int nand_bbt_get(struct mtd_info *mtd, int page) ++{ ++ struct nand_chip *this = mtd->priv; ++ int block; ++ ++ block = (int)(page >> (this->bbt_erase_shift - this->page_shift - 1)); ++ return (this->bbt[block >> 3] >> (block & 0x06)) & 0x03; ++} ++ + EXPORT_SYMBOL(nand_scan_bbt); +--- /dev/null ++++ b/drivers/mtd/nand/nand_def.h +@@ -0,0 +1,123 @@ ++#ifndef __NAND_DEF_H__ ++#define __NAND_DEF_H__ ++ ++#define VERSION "v2.1 Fix AHB virt2phys error" ++#define MODULE_NAME "# MTK NAND #" ++#define PROCNAME "driver/nand" ++ ++#undef TESTTIME ++//#define __UBOOT_NAND__ 1 ++#define __KERNEL_NAND__ 1 ++//#define __PRELOADER_NAND__ 1 ++//#define PMT 1 ++//#define _MTK_NAND_DUMMY_DRIVER ++//#define CONFIG_BADBLOCK_CHECK 1 ++//#ifdef CONFIG_BADBLOCK_CHECK ++//#define MTK_NAND_BMT 1 ++//#endif ++#define ECC_ENABLE 1 ++#define MANUAL_CORRECT 1 ++//#define __INTERNAL_USE_AHB_MODE__ (0) ++#define SKIP_BAD_BLOCK ++#define FACT_BBT ++ ++#ifndef NAND_OTP_SUPPORT ++#define NAND_OTP_SUPPORT 0 ++#endif ++ ++/******************************************************************************* ++ * Macro definition ++ *******************************************************************************/ ++//#define NFI_SET_REG32(reg, value) (DRV_WriteReg32(reg, DRV_Reg32(reg) | (value))) ++//#define NFI_SET_REG16(reg, value) (DRV_WriteReg16(reg, DRV_Reg16(reg) | (value))) ++//#define NFI_CLN_REG32(reg, value) (DRV_WriteReg32(reg, DRV_Reg32(reg) & (~(value)))) ++//#define NFI_CLN_REG16(reg, value) (DRV_WriteReg16(reg, DRV_Reg16(reg) & (~(value)))) ++ ++#if defined (__KERNEL_NAND__) ++#define NFI_SET_REG32(reg, value) \ ++do { \ ++ g_value = (DRV_Reg32(reg) | (value));\ ++ DRV_WriteReg32(reg, g_value); \ ++} while(0) ++ ++#define NFI_SET_REG16(reg, value) \ ++do { \ ++ g_value = (DRV_Reg16(reg) | (value));\ ++ DRV_WriteReg16(reg, g_value); \ ++} while(0) ++ ++#define NFI_CLN_REG32(reg, value) \ ++do { \ ++ g_value = (DRV_Reg32(reg) & (~(value)));\ ++ DRV_WriteReg32(reg, g_value); \ ++} while(0) ++ ++#define NFI_CLN_REG16(reg, value) \ ++do { \ ++ g_value = (DRV_Reg16(reg) & (~(value)));\ ++ DRV_WriteReg16(reg, g_value); \ ++} while(0) ++#endif ++ ++#define NFI_WAIT_STATE_DONE(state) do{;}while (__raw_readl(NFI_STA_REG32) & state) ++#define NFI_WAIT_TO_READY() do{;}while (!(__raw_readl(NFI_STA_REG32) & STA_BUSY2READY)) ++ ++ ++#define NAND_SECTOR_SIZE (512) ++#define OOB_PER_SECTOR (16) ++#define OOB_AVAI_PER_SECTOR (8) ++ ++#ifndef PART_SIZE_BMTPOOL ++#define BMT_POOL_SIZE (80) ++#else ++#define BMT_POOL_SIZE (PART_SIZE_BMTPOOL) ++#endif ++ ++#define PMT_POOL_SIZE (2) ++ ++#define TIMEOUT_1 0x1fff ++#define TIMEOUT_2 0x8ff ++#define TIMEOUT_3 0xffff ++#define TIMEOUT_4 0xffff//5000 //PIO ++ ++ ++/* temporarity definiation */ ++#if !defined (__KERNEL_NAND__) ++#define KERN_INFO ++#define KERN_WARNING ++#define KERN_ERR ++#define PAGE_SIZE (4096) ++#endif ++#define AddStorageTrace //AddStorageTrace ++#define STORAGE_LOGGER_MSG_NAND 0 ++#define NFI_BASE RALINK_NAND_CTRL_BASE ++#define NFIECC_BASE RALINK_NANDECC_CTRL_BASE ++ ++#ifdef __INTERNAL_USE_AHB_MODE__ ++#define MT65xx_POLARITY_LOW 0 ++#define MT65XX_PDN_PERI_NFI 0 ++#define MT65xx_EDGE_SENSITIVE 0 ++#define MT6575_NFI_IRQ_ID (58) ++#endif ++ ++#if defined (__KERNEL_NAND__) ++#define RALINK_REG(x) (*((volatile u32 *)(x))) ++#define __virt_to_phys(x) virt_to_phys((volatile void*)x) ++#else ++#define CONFIG_MTD_NAND_VERIFY_WRITE (1) ++#define printk printf ++#define ra_dbg printf ++#define BUG() //BUG() ++#define BUG_ON(x) //BUG_ON() ++#define NUM_PARTITIONS 1 ++#endif ++ ++#define NFI_DEFAULT_ACCESS_TIMING (0x30C77fff) //(0x44333) ++ ++//uboot only support 1 cs ++#define NFI_CS_NUM (1) ++#define NFI_DEFAULT_CS (0) ++ ++#include "mt6575_typedefs.h" ++ ++#endif /* __NAND_DEF_H__ */ +--- /dev/null ++++ b/drivers/mtd/nand/nand_device_list.h +@@ -0,0 +1,55 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ */ ++/* MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++#ifndef __NAND_DEVICE_LIST_H__ ++#define __NAND_DEVICE_LIST_H__ ++ ++static const flashdev_info gen_FlashTable[]={ ++ {0x20BC, 0x105554, 5, 16, 512, 128, 2048, 64, 0x1123, "EHD013151MA_5", 0}, ++ {0xECBC, 0x005554, 5, 16, 512, 128, 2048, 64, 0x1123, "K524G2GACB_A0", 0}, ++ {0x2CBC, 0x905556, 5, 16, 512, 128, 2048, 64, 0x21044333, "MT29C4G96MAZA", 0}, ++ {0xADBC, 0x905554, 5, 16, 512, 128, 2048, 64, 0x10801011, "H9DA4GH4JJAMC", 0}, ++ {0x01F1, 0x801D01, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "S34ML01G100TF", 0}, ++ {0x92F1, 0x8095FF, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "F59L1G81A", 0}, ++ {0xECD3, 0x519558, 5, 8, 1024, 128, 2048, 64, 0x44333, "K9K8G8000", 0}, ++ {0xC2F1, 0x801DC2, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G08AA", 0}, ++ {0x98D3, 0x902676, 5, 8, 1024, 256, 4096, 224, 0x00C25332, "TC58NVG3S0F", 0}, ++ {0x01DA, 0x909546, 5, 8, 256, 128, 2048, 128, 0x30C77fff, "S34ML02G200TF", 0}, ++ {0x01DC, 0x909556, 5, 8, 512, 128, 2048, 128, 0x30C77fff, "S34ML04G200TF", 0}, ++ {0x0000, 0x000000, 0, 0, 0, 0, 0, 0, 0, "xxxxxxxxxx", 0}, ++}; ++ ++ ++#endif +--- /dev/null ++++ b/drivers/mtd/nand/partition.h +@@ -0,0 +1,115 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ */ ++/* MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++#include ++#include ++#include ++ ++#define RECONFIG_PARTITION_SIZE 1 ++ ++#define MTD_BOOT_PART_SIZE 0x80000 ++#define MTD_CONFIG_PART_SIZE 0x20000 ++#define MTD_FACTORY_PART_SIZE 0x20000 ++ ++extern unsigned int CFG_BLOCKSIZE; ++#define LARGE_MTD_BOOT_PART_SIZE (CFG_BLOCKSIZE<<2) ++#define LARGE_MTD_CONFIG_PART_SIZE (CFG_BLOCKSIZE<<2) ++#define LARGE_MTD_FACTORY_PART_SIZE (CFG_BLOCKSIZE<<1) ++ ++/*=======================================================================*/ ++/* NAND PARTITION Mapping */ ++/*=======================================================================*/ ++//#ifdef CONFIG_MTD_PARTITIONS ++static struct mtd_partition g_pasStatic_Partition[] = { ++ { ++ name: "ALL", ++ size: MTDPART_SIZ_FULL, ++ offset: 0, ++ }, ++ /* Put your own partition definitions here */ ++ { ++ name: "Bootloader", ++ size: MTD_BOOT_PART_SIZE, ++ offset: 0, ++ }, { ++ name: "Config", ++ size: MTD_CONFIG_PART_SIZE, ++ offset: MTDPART_OFS_APPEND ++ }, { ++ name: "Factory", ++ size: MTD_FACTORY_PART_SIZE, ++ offset: MTDPART_OFS_APPEND ++#ifdef CONFIG_RT2880_ROOTFS_IN_FLASH ++ }, { ++ name: "Kernel", ++ size: MTD_KERN_PART_SIZE, ++ offset: MTDPART_OFS_APPEND, ++ }, { ++ name: "RootFS", ++ size: MTD_ROOTFS_PART_SIZE, ++ offset: MTDPART_OFS_APPEND, ++#ifdef CONFIG_ROOTFS_IN_FLASH_NO_PADDING ++ }, { ++ name: "Kernel_RootFS", ++ size: MTD_KERN_PART_SIZE + MTD_ROOTFS_PART_SIZE, ++ offset: MTD_BOOT_PART_SIZE + MTD_CONFIG_PART_SIZE + MTD_FACTORY_PART_SIZE, ++#endif ++#else //CONFIG_RT2880_ROOTFS_IN_RAM ++ }, { ++ name: "Kernel", ++ size: 0x10000, ++ offset: MTDPART_OFS_APPEND, ++#endif ++#ifdef CONFIG_DUAL_IMAGE ++ }, { ++ name: "Kernel2", ++ size: MTD_KERN2_PART_SIZE, ++ offset: MTD_KERN2_PART_OFFSET, ++#ifdef CONFIG_RT2880_ROOTFS_IN_FLASH ++ }, { ++ name: "RootFS2", ++ size: MTD_ROOTFS2_PART_SIZE, ++ offset: MTD_ROOTFS2_PART_OFFSET, ++#endif ++#endif ++ } ++ ++}; ++ ++#define NUM_PARTITIONS ARRAY_SIZE(g_pasStatic_Partition) ++extern int part_num; // = NUM_PARTITIONS; ++//#endif ++#undef RECONFIG_PARTITION_SIZE ++ diff --git a/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch b/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch new file mode 100644 index 0000000000..254bf5286a --- /dev/null +++ b/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch @@ -0,0 +1,157 @@ +From 61e17c2f864698033f4661e1fc7ba63d4d982491 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:21:55 +0100 +Subject: [PATCH 40/53] nand: add mtk-nand hack/hook + +Signed-off-by: John Crispin +--- + drivers/mtd/nand/mtk_nand.c | 34 ++++++++++++++++++++++++++++++---- + drivers/mtd/nand/nand_base.c | 9 ++++++++- + drivers/mtd/nand/nand_device_list.h | 2 ++ + include/linux/mtd/nand.h | 4 ++++ + 4 files changed, 44 insertions(+), 5 deletions(-) + +--- a/drivers/mtd/nand/mtk_nand.c ++++ b/drivers/mtd/nand/mtk_nand.c +@@ -110,6 +110,10 @@ int part_num = NUM_PARTITIONS; + int manu_id; + int dev_id; + ++/* this constant was taken from linux/nand/nand.h v 3.14 ++ * in later versions it seems it was removed in order to save a bit of space ++ */ ++#define NAND_MAX_OOBSIZE 774 + static u8 local_oob_buf[NAND_MAX_OOBSIZE]; + + static u8 nand_badblock_offset = 0; +@@ -348,7 +352,7 @@ mtk_nand_check_bch_error(struct mtd_info + if (0xF == u4ErrNum) { + mtd->ecc_stats.failed++; + bRet = false; +- //printk(KERN_ERR"UnCorrectable at PageAddr=%d\n", u4PageAddr); ++ printk(KERN_ERR"mtk_nand: UnCorrectable at PageAddr=%d\n", u4PageAddr); + } else { + for (i = 0; i < ((u4ErrNum + 1) >> 1); ++i) { + au4ErrBitLoc[i] = DRV_Reg32(ECC_DECEL0_REG32 + i); +@@ -1422,7 +1426,7 @@ mtk_nand_erase_hw(struct mtd_info *mtd, + { + struct nand_chip *chip = (struct nand_chip *)mtd->priv; + +- chip->erase_cmd(mtd, page); ++ chip->erase(mtd, page); + + return chip->waitfunc(mtd, chip); + } +@@ -2094,8 +2098,8 @@ mtk_nand_probe(struct platform_device *p + nand_chip->write_page = mtk_nand_write_page; + nand_chip->ecc.write_oob = mtk_nand_write_oob; + nand_chip->block_markbad = mtk_nand_block_markbad; // need to add nand_get_device()/nand_release_device(). +- // nand_chip->erase = mtk_nand_erase; +- // nand_chip->read_page = mtk_nand_read_page; ++ nand_chip->erase_mtk = mtk_nand_erase; ++ nand_chip->read_page = mtk_nand_read_page; + nand_chip->ecc.read_oob = mtk_nand_read_oob; + nand_chip->block_bad = mtk_nand_block_bad; + +@@ -2175,6 +2179,21 @@ mtk_nand_probe(struct platform_device *p + nand_chip->pagemask = (nand_chip->chipsize >> nand_chip->page_shift) - 1; + nand_chip->phys_erase_shift = ffs(mtd->erasesize) - 1; + nand_chip->chip_shift = ffs(nand_chip->chipsize) - 1;//0x1C;//ffs(nand_chip->chipsize) - 1; ++ ++ /* allocate buffers or call select_chip here or a bit earlier*/ ++ { ++ struct nand_buffers *nbuf = kzalloc(sizeof(*nbuf) + mtd->writesize + mtd->oobsize * 3, GFP_KERNEL); ++ if (!nbuf) { ++ return -ENOMEM; ++ } ++ nbuf->ecccalc = (uint8_t *)(nbuf + 1); ++ nbuf->ecccode = nbuf->ecccalc + mtd->oobsize; ++ nbuf->databuf = nbuf->ecccode + mtd->oobsize; ++ ++ nand_chip->buffers = nbuf; ++ nand_chip->options |= NAND_OWN_BUFFERS; ++ } ++ + nand_chip->oob_poi = nand_chip->buffers->databuf + mtd->writesize; + nand_chip->badblockpos = 0; + +@@ -2251,6 +2270,9 @@ out: + MSG(INIT, "[NFI] mtk_nand_probe fail, err = %d!\n", err); + nand_release(mtd); + platform_set_drvdata(pdev, NULL); ++ if ( NULL != nand_chip->buffers) { ++ kfree(nand_chip->buffers); ++ } + kfree(host); + nand_disable_clock(); + return err; +@@ -2261,8 +2283,12 @@ mtk_nand_remove(struct platform_device * + { + struct mtk_nand_host *host = platform_get_drvdata(pdev); + struct mtd_info *mtd = &host->mtd; ++ struct nand_chip *nand_chip = &host->nand_chip; + + nand_release(mtd); ++ if ( NULL != nand_chip->buffers) { ++ kfree(nand_chip->buffers); ++ } + kfree(host); + nand_disable_clock(); + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -1727,6 +1727,9 @@ static int nand_do_read_ops(struct mtd_i + __func__, buf); + + read_retry: ++#ifdef CONFIG_MTK_MTD_NAND ++ ret = chip->read_page(mtd, chip, bufpoi, page); ++#else + chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); + + /* +@@ -1745,6 +1748,7 @@ read_retry: + else + ret = chip->ecc.read_page(mtd, chip, bufpoi, + oob_required, page); ++#endif /* CONFIG_MTK_MTD_NAND */ + if (ret < 0) { + if (use_bufpoi) + /* Invalidate page cache */ +@@ -2932,8 +2936,11 @@ int nand_erase_nand(struct mtd_info *mtd + if (page <= chip->pagebuf && chip->pagebuf < + (page + pages_per_block)) + chip->pagebuf = -1; +- ++#ifdef CONFIG_MTK_MTD_NAND ++ status = chip->erase_mtk(mtd, page & chip->pagemask); ++#else + status = chip->erase(mtd, page & chip->pagemask); ++#endif /* CONFIG_MTK_MTD_NAND */ + + /* + * See if operation failed and additional status checks are +--- a/drivers/mtd/nand/nand_device_list.h ++++ b/drivers/mtd/nand/nand_device_list.h +@@ -43,6 +43,8 @@ static const flashdev_info gen_FlashTabl + {0xADBC, 0x905554, 5, 16, 512, 128, 2048, 64, 0x10801011, "H9DA4GH4JJAMC", 0}, + {0x01F1, 0x801D01, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "S34ML01G100TF", 0}, + {0x92F1, 0x8095FF, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "F59L1G81A", 0}, ++ {0xC8DA, 0x909544, 5, 8, 256, 128, 2048, 64, 0x30C77fff, "F59L2G81A", 0}, ++ {0xC8DC, 0x909554, 5, 8, 512, 128, 2048, 64, 0x30C77fff, "F59L4G81A", 0}, + {0xECD3, 0x519558, 5, 8, 1024, 128, 2048, 64, 0x44333, "K9K8G8000", 0}, + {0xC2F1, 0x801DC2, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G08AA", 0}, + {0x98D3, 0x902676, 5, 8, 1024, 256, 4096, 224, 0x00C25332, "TC58NVG3S0F", 0}, +--- a/include/linux/mtd/nand.h ++++ b/include/linux/mtd/nand.h +@@ -665,6 +665,10 @@ struct nand_chip { + int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, + uint32_t offset, int data_len, const uint8_t *buf, + int oob_required, int page, int cached, int raw); ++#ifdef CONFIG_MTK_MTD_NAND ++ int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int page); ++ int (*erase_mtk)(struct mtd_info *mtd, int page); ++#endif /* CONFIG_MTK_MTD_NAND */ + int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, + int feature_addr, uint8_t *subfeature_para); + int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, diff --git a/target/linux/ramips/patches-4.4/0041-DT-Add-documentation-for-spi-rt2880.patch b/target/linux/ramips/patches-4.4/0041-DT-Add-documentation-for-spi-rt2880.patch new file mode 100644 index 0000000000..e2643e3f25 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0041-DT-Add-documentation-for-spi-rt2880.patch @@ -0,0 +1,44 @@ +From da6015e7f19d749f135f7ac55c4ec47b06faa868 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Fri, 9 Aug 2013 20:12:59 +0200 +Subject: [PATCH 41/53] DT: Add documentation for spi-rt2880 + +Describe the SPI master found on the MIPS based Ralink RT2880 SoC. + +Signed-off-by: John Crispin +--- + .../devicetree/bindings/spi/spi-rt2880.txt | 28 ++++++++++++++++++++ + 1 file changed, 28 insertions(+) + create mode 100644 Documentation/devicetree/bindings/spi/spi-rt2880.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/spi/spi-rt2880.txt +@@ -0,0 +1,28 @@ ++Ralink SoC RT2880 SPI master controller. ++ ++This SPI controller is found on most wireless SoCs made by ralink. ++ ++Required properties: ++- compatible : "ralink,rt2880-spi" ++- reg : The register base for the controller. ++- #address-cells : <1>, as required by generic SPI binding. ++- #size-cells : <0>, also as required by generic SPI binding. ++ ++Child nodes as per the generic SPI binding. ++ ++Example: ++ ++ spi@b00 { ++ compatible = "ralink,rt2880-spi"; ++ reg = <0xb00 0x100>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ m25p80@0 { ++ compatible = "m25p80"; ++ reg = <0>; ++ spi-max-frequency = <10000000>; ++ }; ++ }; ++ diff --git a/target/linux/ramips/patches-4.4/0042-SPI-ralink-add-Ralink-SoC-spi-driver.patch b/target/linux/ramips/patches-4.4/0042-SPI-ralink-add-Ralink-SoC-spi-driver.patch new file mode 100644 index 0000000000..642632628b --- /dev/null +++ b/target/linux/ramips/patches-4.4/0042-SPI-ralink-add-Ralink-SoC-spi-driver.patch @@ -0,0 +1,574 @@ +From 683af4ebb91a1600df1946ac4769d916b8a1be65 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 11:15:12 +0100 +Subject: [PATCH 42/53] SPI: ralink: add Ralink SoC spi driver + +Add the driver needed to make SPI work on Ralink SoC. + +Signed-off-by: Gabor Juhos +Acked-by: John Crispin +--- + drivers/spi/Kconfig | 6 + + drivers/spi/Makefile | 1 + + drivers/spi/spi-rt2880.c | 530 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 537 insertions(+) + create mode 100644 drivers/spi/spi-rt2880.c + +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -477,6 +477,12 @@ config SPI_QUP + This driver can also be built as a module. If so, the module + will be called spi_qup. + ++config SPI_RT2880 ++ tristate "Ralink RT288x SPI Controller" ++ depends on RALINK ++ help ++ This selects a driver for the Ralink RT288x/RT305x SPI Controller. ++ + config SPI_S3C24XX + tristate "Samsung S3C24XX series SPI" + depends on ARCH_S3C24XX +--- a/drivers/spi/Makefile ++++ b/drivers/spi/Makefile +@@ -70,6 +70,7 @@ obj-$(CONFIG_SPI_QUP) += spi-qup.o + obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o + obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o + obj-$(CONFIG_SPI_RSPI) += spi-rspi.o ++obj-$(CONFIG_SPI_RT2880) += spi-rt2880.o + obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o + spi-s3c24xx-hw-y := spi-s3c24xx.o + spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o +--- /dev/null ++++ b/drivers/spi/spi-rt2880.c +@@ -0,0 +1,530 @@ ++/* ++ * spi-rt2880.c -- Ralink RT288x/RT305x SPI controller driver ++ * ++ * Copyright (C) 2011 Sergiy ++ * Copyright (C) 2011-2013 Gabor Juhos ++ * ++ * Some parts are based on spi-orion.c: ++ * Author: Shadi Ammouri ++ * Copyright (C) 2007-2008 Marvell 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "spi-rt2880" ++ ++#define RAMIPS_SPI_STAT 0x00 ++#define RAMIPS_SPI_CFG 0x10 ++#define RAMIPS_SPI_CTL 0x14 ++#define RAMIPS_SPI_DATA 0x20 ++#define RAMIPS_SPI_ADDR 0x24 ++#define RAMIPS_SPI_BS 0x28 ++#define RAMIPS_SPI_USER 0x2C ++#define RAMIPS_SPI_TXFIFO 0x30 ++#define RAMIPS_SPI_RXFIFO 0x34 ++#define RAMIPS_SPI_FIFO_STAT 0x38 ++#define RAMIPS_SPI_MODE 0x3C ++#define RAMIPS_SPI_DEV_OFFSET 0x40 ++#define RAMIPS_SPI_DMA 0x80 ++#define RAMIPS_SPI_DMASTAT 0x84 ++#define RAMIPS_SPI_ARBITER 0xF0 ++ ++/* SPISTAT register bit field */ ++#define SPISTAT_BUSY BIT(0) ++ ++/* SPICFG register bit field */ ++#define SPICFG_ADDRMODE BIT(12) ++#define SPICFG_RXENVDIS BIT(11) ++#define SPICFG_RXCAP BIT(10) ++#define SPICFG_SPIENMODE BIT(9) ++#define SPICFG_MSBFIRST BIT(8) ++#define SPICFG_SPICLKPOL BIT(6) ++#define SPICFG_RXCLKEDGE_FALLING BIT(5) ++#define SPICFG_TXCLKEDGE_FALLING BIT(4) ++#define SPICFG_HIZSPI BIT(3) ++#define SPICFG_SPICLK_PRESCALE_MASK 0x7 ++#define SPICFG_SPICLK_DIV2 0 ++#define SPICFG_SPICLK_DIV4 1 ++#define SPICFG_SPICLK_DIV8 2 ++#define SPICFG_SPICLK_DIV16 3 ++#define SPICFG_SPICLK_DIV32 4 ++#define SPICFG_SPICLK_DIV64 5 ++#define SPICFG_SPICLK_DIV128 6 ++#define SPICFG_SPICLK_DISABLE 7 ++ ++/* SPICTL register bit field */ ++#define SPICTL_START BIT(4) ++#define SPICTL_HIZSDO BIT(3) ++#define SPICTL_STARTWR BIT(2) ++#define SPICTL_STARTRD BIT(1) ++#define SPICTL_SPIENA BIT(0) ++ ++/* SPIUSER register bit field */ ++#define SPIUSER_USERMODE BIT(21) ++#define SPIUSER_INSTR_PHASE BIT(20) ++#define SPIUSER_ADDR_PHASE_MASK 0x7 ++#define SPIUSER_ADDR_PHASE_OFFSET 17 ++#define SPIUSER_MODE_PHASE BIT(16) ++#define SPIUSER_DUMMY_PHASE_MASK 0x3 ++#define SPIUSER_DUMMY_PHASE_OFFSET 14 ++#define SPIUSER_DATA_PHASE_MASK 0x3 ++#define SPIUSER_DATA_PHASE_OFFSET 12 ++#define SPIUSER_DATA_READ (BIT(0) << SPIUSER_DATA_PHASE_OFFSET) ++#define SPIUSER_DATA_WRITE (BIT(1) << SPIUSER_DATA_PHASE_OFFSET) ++#define SPIUSER_ADDR_TYPE_OFFSET 9 ++#define SPIUSER_MODE_TYPE_OFFSET 6 ++#define SPIUSER_DUMMY_TYPE_OFFSET 3 ++#define SPIUSER_DATA_TYPE_OFFSET 0 ++#define SPIUSER_TRANSFER_MASK 0x7 ++#define SPIUSER_TRANSFER_SINGLE BIT(0) ++#define SPIUSER_TRANSFER_DUAL BIT(1) ++#define SPIUSER_TRANSFER_QUAD BIT(2) ++ ++#define SPIUSER_TRANSFER_TYPE(type) ( \ ++ (type << SPIUSER_ADDR_TYPE_OFFSET) | \ ++ (type << SPIUSER_MODE_TYPE_OFFSET) | \ ++ (type << SPIUSER_DUMMY_TYPE_OFFSET) | \ ++ (type << SPIUSER_DATA_TYPE_OFFSET) \ ++) ++ ++/* SPIFIFOSTAT register bit field */ ++#define SPIFIFOSTAT_TXEMPTY BIT(19) ++#define SPIFIFOSTAT_RXEMPTY BIT(18) ++#define SPIFIFOSTAT_TXFULL BIT(17) ++#define SPIFIFOSTAT_RXFULL BIT(16) ++#define SPIFIFOSTAT_FIFO_MASK 0xff ++#define SPIFIFOSTAT_TX_OFFSET 8 ++#define SPIFIFOSTAT_RX_OFFSET 0 ++ ++#define SPI_FIFO_DEPTH 16 ++ ++/* SPIMODE register bit field */ ++#define SPIMODE_MODE_OFFSET 24 ++#define SPIMODE_DUMMY_OFFSET 0 ++ ++/* SPIARB register bit field */ ++#define SPICTL_ARB_EN BIT(31) ++#define SPICTL_CSCTL1 BIT(16) ++#define SPI1_POR BIT(1) ++#define SPI0_POR BIT(0) ++ ++#define RT2880_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | \ ++ SPI_CS_HIGH) ++ ++static atomic_t hw_reset_count = ATOMIC_INIT(0); ++ ++struct rt2880_spi { ++ struct spi_master *master; ++ void __iomem *base; ++ u32 speed; ++ u16 wait_loops; ++ u16 mode; ++ struct clk *clk; ++}; ++ ++static inline struct rt2880_spi *spidev_to_rt2880_spi(struct spi_device *spi) ++{ ++ return spi_master_get_devdata(spi->master); ++} ++ ++static inline u32 rt2880_spi_read(struct rt2880_spi *rs, u32 reg) ++{ ++ return ioread32(rs->base + reg); ++} ++ ++static inline void rt2880_spi_write(struct rt2880_spi *rs, u32 reg, ++ const u32 val) ++{ ++ iowrite32(val, rs->base + reg); ++} ++ ++static inline void rt2880_spi_setbits(struct rt2880_spi *rs, u32 reg, u32 mask) ++{ ++ void __iomem *addr = rs->base + reg; ++ ++ iowrite32((ioread32(addr) | mask), addr); ++} ++ ++static inline void rt2880_spi_clrbits(struct rt2880_spi *rs, u32 reg, u32 mask) ++{ ++ void __iomem *addr = rs->base + reg; ++ ++ iowrite32((ioread32(addr) & ~mask), addr); ++} ++ ++static u32 rt2880_spi_baudrate_get(struct spi_device *spi, unsigned int speed) ++{ ++ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi); ++ u32 rate; ++ u32 prescale; ++ ++ /* ++ * the supported rates are: 2, 4, 8, ... 128 ++ * round up as we look for equal or less speed ++ */ ++ rate = DIV_ROUND_UP(clk_get_rate(rs->clk), speed); ++ rate = roundup_pow_of_two(rate); ++ ++ /* Convert the rate to SPI clock divisor value. */ ++ prescale = ilog2(rate / 2); ++ ++ /* some tolerance. double and add 100 */ ++ rs->wait_loops = (8 * HZ * loops_per_jiffy) / ++ (clk_get_rate(rs->clk) / rate); ++ rs->wait_loops = (rs->wait_loops << 1) + 100; ++ rs->speed = speed; ++ ++ dev_dbg(&spi->dev, "speed: %lu/%u, rate: %u, prescal: %u, loops: %hu\n", ++ clk_get_rate(rs->clk) / rate, speed, rate, prescale, ++ rs->wait_loops); ++ ++ return prescale; ++} ++ ++static u32 get_arbiter_offset(struct spi_master *master) ++{ ++ u32 offset; ++ ++ offset = RAMIPS_SPI_ARBITER; ++ if (master->bus_num == 1) ++ offset -= RAMIPS_SPI_DEV_OFFSET; ++ ++ return offset; ++} ++ ++static void rt2880_spi_set_cs(struct spi_device *spi, bool enable) ++{ ++ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi); ++ ++ if (enable) ++ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA); ++ else ++ rt2880_spi_clrbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA); ++} ++ ++static int rt2880_spi_wait_ready(struct rt2880_spi *rs, int len) ++{ ++ int loop = rs->wait_loops * len; ++ ++ while ((rt2880_spi_read(rs, RAMIPS_SPI_STAT) & SPISTAT_BUSY) && --loop) ++ cpu_relax(); ++ ++ if (loop) ++ return 0; ++ ++ return -ETIMEDOUT; ++} ++ ++static void rt2880_dump_reg(struct spi_master *master) ++{ ++ struct rt2880_spi *rs = spi_master_get_devdata(master); ++ ++ dev_dbg(&master->dev, "stat: %08x, cfg: %08x, ctl: %08x, " \ ++ "data: %08x, arb: %08x\n", ++ rt2880_spi_read(rs, RAMIPS_SPI_STAT), ++ rt2880_spi_read(rs, RAMIPS_SPI_CFG), ++ rt2880_spi_read(rs, RAMIPS_SPI_CTL), ++ rt2880_spi_read(rs, RAMIPS_SPI_DATA), ++ rt2880_spi_read(rs, get_arbiter_offset(master))); ++} ++ ++static int rt2880_spi_transfer_one(struct spi_master *master, ++ struct spi_device *spi, struct spi_transfer *xfer) ++{ ++ struct rt2880_spi *rs = spi_master_get_devdata(master); ++ unsigned len; ++ const u8 *tx = xfer->tx_buf; ++ u8 *rx = xfer->rx_buf; ++ int err = 0; ++ ++ /* change clock speed */ ++ if (unlikely(rs->speed != xfer->speed_hz)) { ++ u32 reg; ++ reg = rt2880_spi_read(rs, RAMIPS_SPI_CFG); ++ reg &= ~SPICFG_SPICLK_PRESCALE_MASK; ++ reg |= rt2880_spi_baudrate_get(spi, xfer->speed_hz); ++ rt2880_spi_write(rs, RAMIPS_SPI_CFG, reg); ++ } ++ ++ if (tx) { ++ len = xfer->len; ++ while (len-- > 0) { ++ rt2880_spi_write(rs, RAMIPS_SPI_DATA, *tx++); ++ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_STARTWR); ++ err = rt2880_spi_wait_ready(rs, 1); ++ if (err) { ++ dev_err(&spi->dev, "TX failed, err=%d\n", err); ++ goto out; ++ } ++ } ++ } ++ ++ if (rx) { ++ len = xfer->len; ++ while (len-- > 0) { ++ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_STARTRD); ++ err = rt2880_spi_wait_ready(rs, 1); ++ if (err) { ++ dev_err(&spi->dev, "RX failed, err=%d\n", err); ++ goto out; ++ } ++ *rx++ = (u8) rt2880_spi_read(rs, RAMIPS_SPI_DATA); ++ } ++ } ++ ++out: ++ return err; ++} ++ ++/* copy from spi.c */ ++static void spi_set_cs(struct spi_device *spi, bool enable) ++{ ++ if (spi->mode & SPI_CS_HIGH) ++ enable = !enable; ++ ++ if (spi->cs_gpio >= 0) ++ gpio_set_value(spi->cs_gpio, !enable); ++ else if (spi->master->set_cs) ++ spi->master->set_cs(spi, !enable); ++} ++ ++static int rt2880_spi_setup(struct spi_device *spi) ++{ ++ struct spi_master *master = spi->master; ++ struct rt2880_spi *rs = spi_master_get_devdata(master); ++ u32 reg, old_reg, arbit_off; ++ ++ if ((spi->max_speed_hz > master->max_speed_hz) || ++ (spi->max_speed_hz < master->min_speed_hz)) { ++ dev_err(&spi->dev, "invalide requested speed %d Hz\n", ++ spi->max_speed_hz); ++ return -EINVAL; ++ } ++ ++ if (!(master->bits_per_word_mask & ++ BIT(spi->bits_per_word - 1))) { ++ dev_err(&spi->dev, "invalide bits_per_word %d\n", ++ spi->bits_per_word); ++ return -EINVAL; ++ } ++ ++ /* the hardware seems can't work on mode0 force it to mode3 */ ++ if ((spi->mode & (SPI_CPOL | SPI_CPHA)) == SPI_MODE_0) { ++ dev_warn(&spi->dev, "force spi mode3\n"); ++ spi->mode |= SPI_MODE_3; ++ } ++ ++ /* chip polarity */ ++ arbit_off = get_arbiter_offset(master); ++ reg = old_reg = rt2880_spi_read(rs, arbit_off); ++ if (spi->mode & SPI_CS_HIGH) { ++ switch (master->bus_num) { ++ case 1: ++ reg |= SPI1_POR; ++ break; ++ default: ++ reg |= SPI0_POR; ++ break; ++ } ++ } else { ++ switch (master->bus_num) { ++ case 1: ++ reg &= ~SPI1_POR; ++ break; ++ default: ++ reg &= ~SPI0_POR; ++ break; ++ } ++ } ++ ++ /* enable spi1 */ ++ if (master->bus_num == 1) ++ reg |= SPICTL_ARB_EN; ++ ++ if (reg != old_reg) ++ rt2880_spi_write(rs, arbit_off, reg); ++ ++ /* deselected the spi device */ ++ spi_set_cs(spi, false); ++ ++ rt2880_dump_reg(master); ++ ++ return 0; ++} ++ ++static int rt2880_spi_prepare_message(struct spi_master *master, ++ struct spi_message *msg) ++{ ++ struct rt2880_spi *rs = spi_master_get_devdata(master); ++ struct spi_device *spi = msg->spi; ++ u32 reg; ++ ++ if ((rs->mode == spi->mode) && (rs->speed == spi->max_speed_hz)) ++ return 0; ++ ++#if 0 ++ /* set spido to tri-state */ ++ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_HIZSDO); ++#endif ++ ++ reg = rt2880_spi_read(rs, RAMIPS_SPI_CFG); ++ ++ reg &= ~(SPICFG_MSBFIRST | SPICFG_SPICLKPOL | ++ SPICFG_RXCLKEDGE_FALLING | ++ SPICFG_TXCLKEDGE_FALLING | ++ SPICFG_SPICLK_PRESCALE_MASK); ++ ++ /* MSB */ ++ if (!(spi->mode & SPI_LSB_FIRST)) ++ reg |= SPICFG_MSBFIRST; ++ ++ /* spi mode */ ++ switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { ++ case SPI_MODE_0: ++ reg |= SPICFG_TXCLKEDGE_FALLING; ++ break; ++ case SPI_MODE_1: ++ reg |= SPICFG_RXCLKEDGE_FALLING; ++ break; ++ case SPI_MODE_2: ++ reg |= SPICFG_SPICLKPOL | SPICFG_RXCLKEDGE_FALLING; ++ break; ++ case SPI_MODE_3: ++ reg |= SPICFG_SPICLKPOL | SPICFG_TXCLKEDGE_FALLING; ++ break; ++ } ++ rs->mode = spi->mode; ++ ++#if 0 ++ /* set spiclk and spiena to tri-state */ ++ reg |= SPICFG_HIZSPI; ++#endif ++ ++ /* clock divide */ ++ reg |= rt2880_spi_baudrate_get(spi, spi->max_speed_hz); ++ ++ rt2880_spi_write(rs, RAMIPS_SPI_CFG, reg); ++ ++ return 0; ++} ++ ++static int rt2880_spi_probe(struct platform_device *pdev) ++{ ++ struct spi_master *master; ++ struct rt2880_spi *rs; ++ void __iomem *base; ++ struct resource *r; ++ struct clk *clk; ++ int ret; ++ ++ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, r); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(&pdev->dev, "unable to get SYS clock\n"); ++ return PTR_ERR(clk); ++ } ++ ++ ret = clk_prepare_enable(clk); ++ if (ret) ++ goto err_clk; ++ ++ master = spi_alloc_master(&pdev->dev, sizeof(*rs)); ++ if (master == NULL) { ++ dev_dbg(&pdev->dev, "master allocation failed\n"); ++ ret = -ENOMEM; ++ goto err_clk; ++ } ++ ++ master->dev.of_node = pdev->dev.of_node; ++ master->mode_bits = RT2880_SPI_MODE_BITS; ++ master->bits_per_word_mask = SPI_BPW_MASK(8); ++ master->min_speed_hz = clk_get_rate(clk) / 128; ++ master->max_speed_hz = clk_get_rate(clk) / 2; ++ master->flags = SPI_MASTER_HALF_DUPLEX; ++ master->setup = rt2880_spi_setup; ++ master->prepare_message = rt2880_spi_prepare_message; ++ master->set_cs = rt2880_spi_set_cs; ++ master->transfer_one = rt2880_spi_transfer_one, ++ ++ dev_set_drvdata(&pdev->dev, master); ++ ++ rs = spi_master_get_devdata(master); ++ rs->master = master; ++ rs->base = base; ++ rs->clk = clk; ++ ++ if (atomic_inc_return(&hw_reset_count) == 1) ++ device_reset(&pdev->dev); ++ ++ ret = devm_spi_register_master(&pdev->dev, master); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "devm_spi_register_master error.\n"); ++ goto err_master; ++ } ++ ++ return ret; ++ ++err_master: ++ spi_master_put(master); ++ kfree(master); ++err_clk: ++ clk_disable_unprepare(clk); ++ ++ return ret; ++} ++ ++static int rt2880_spi_remove(struct platform_device *pdev) ++{ ++ struct spi_master *master; ++ struct rt2880_spi *rs; ++ ++ master = dev_get_drvdata(&pdev->dev); ++ rs = spi_master_get_devdata(master); ++ ++ clk_disable_unprepare(rs->clk); ++ atomic_dec(&hw_reset_count); ++ ++ return 0; ++} ++ ++MODULE_ALIAS("platform:" DRIVER_NAME); ++ ++static const struct of_device_id rt2880_spi_match[] = { ++ { .compatible = "ralink,rt2880-spi" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rt2880_spi_match); ++ ++static struct platform_driver rt2880_spi_driver = { ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = rt2880_spi_match, ++ }, ++ .probe = rt2880_spi_probe, ++ .remove = rt2880_spi_remove, ++}; ++ ++module_platform_driver(rt2880_spi_driver); ++ ++MODULE_DESCRIPTION("Ralink SPI driver"); ++MODULE_AUTHOR("Sergiy "); ++MODULE_AUTHOR("Gabor Juhos "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/ramips/patches-4.4/0043-spi-add-mt7621-support.patch b/target/linux/ramips/patches-4.4/0043-spi-add-mt7621-support.patch new file mode 100644 index 0000000000..8a78bda840 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0043-spi-add-mt7621-support.patch @@ -0,0 +1,524 @@ +From 87a5fcd57c577cd94b5b080deb98885077c13a42 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:49:07 +0100 +Subject: [PATCH 43/53] spi: add mt7621 support + +Signed-off-by: John Crispin +--- + drivers/spi/Kconfig | 6 + + drivers/spi/Makefile | 1 + + drivers/spi/spi-mt7621.c | 480 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 487 insertions(+) + create mode 100644 drivers/spi/spi-mt7621.c + +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -483,6 +483,12 @@ config SPI_RT2880 + help + This selects a driver for the Ralink RT288x/RT305x SPI Controller. + ++config SPI_MT7621 ++ tristate "MediaTek MT7621 SPI Controller" ++ depends on RALINK ++ help ++ This selects a driver for the MediaTek MT7621 SPI Controller. ++ + config SPI_S3C24XX + tristate "Samsung S3C24XX series SPI" + depends on ARCH_S3C24XX +--- a/drivers/spi/Makefile ++++ b/drivers/spi/Makefile +@@ -51,6 +51,7 @@ obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mp + obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o + obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o + obj-$(CONFIG_SPI_MT65XX) += spi-mt65xx.o ++obj-$(CONFIG_SPI_MT7621) += spi-mt7621.o + obj-$(CONFIG_SPI_MXS) += spi-mxs.o + obj-$(CONFIG_SPI_NUC900) += spi-nuc900.o + obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o +--- /dev/null ++++ b/drivers/spi/spi-mt7621.c +@@ -0,0 +1,483 @@ ++/* ++ * spi-mt7621.c -- MediaTek MT7621 SPI controller driver ++ * ++ * Copyright (C) 2011 Sergiy ++ * Copyright (C) 2011-2013 Gabor Juhos ++ * Copyright (C) 2014-2015 Felix Fietkau ++ * ++ * Some parts are based on spi-orion.c: ++ * Author: Shadi Ammouri ++ * Copyright (C) 2007-2008 Marvell 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define SPI_BPW_MASK(bits) BIT((bits) - 1) ++ ++#define DRIVER_NAME "spi-mt7621" ++/* in usec */ ++#define RALINK_SPI_WAIT_MAX_LOOP 2000 ++ ++/* SPISTAT register bit field */ ++#define SPISTAT_BUSY BIT(0) ++ ++#define MT7621_SPI_TRANS 0x00 ++#define SPITRANS_BUSY BIT(16) ++ ++#define MT7621_SPI_OPCODE 0x04 ++#define MT7621_SPI_DATA0 0x08 ++#define MT7621_SPI_DATA4 0x18 ++#define SPI_CTL_TX_RX_CNT_MASK 0xff ++#define SPI_CTL_START BIT(8) ++ ++#define MT7621_SPI_POLAR 0x38 ++#define MT7621_SPI_MASTER 0x28 ++#define MT7621_SPI_MOREBUF 0x2c ++#define MT7621_SPI_SPACE 0x3c ++ ++#define MT7621_CPHA BIT(5) ++#define MT7621_CPOL BIT(4) ++#define MT7621_LSB_FIRST BIT(3) ++ ++#define RT2880_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH) ++ ++struct mt7621_spi; ++ ++struct mt7621_spi { ++ struct spi_master *master; ++ void __iomem *base; ++ unsigned int sys_freq; ++ unsigned int speed; ++ struct clk *clk; ++ spinlock_t lock; ++ ++ struct mt7621_spi_ops *ops; ++}; ++ ++static inline struct mt7621_spi *spidev_to_mt7621_spi(struct spi_device *spi) ++{ ++ return spi_master_get_devdata(spi->master); ++} ++ ++static inline u32 mt7621_spi_read(struct mt7621_spi *rs, u32 reg) ++{ ++ return ioread32(rs->base + reg); ++} ++ ++static inline void mt7621_spi_write(struct mt7621_spi *rs, u32 reg, u32 val) ++{ ++ iowrite32(val, rs->base + reg); ++} ++ ++static void mt7621_spi_reset(struct mt7621_spi *rs, int duplex) ++{ ++ u32 master = mt7621_spi_read(rs, MT7621_SPI_MASTER); ++ ++ master |= 7 << 29; ++ master |= 1 << 2; ++ if (duplex) ++ master |= 1 << 10; ++ else ++ master &= ~(1 << 10); ++ ++ mt7621_spi_write(rs, MT7621_SPI_MASTER, master); ++} ++ ++static void mt7621_spi_set_cs(struct spi_device *spi, int enable) ++{ ++ struct mt7621_spi *rs = spidev_to_mt7621_spi(spi); ++ int cs = spi->chip_select; ++ u32 polar = 0; ++ ++ mt7621_spi_reset(rs, cs); ++ if (enable) ++ polar = BIT(cs); ++ mt7621_spi_write(rs, MT7621_SPI_POLAR, polar); ++} ++ ++static int mt7621_spi_prepare(struct spi_device *spi, unsigned int speed) ++{ ++ struct mt7621_spi *rs = spidev_to_mt7621_spi(spi); ++ u32 rate; ++ u32 reg; ++ ++ dev_dbg(&spi->dev, "speed:%u\n", speed); ++ ++ rate = DIV_ROUND_UP(rs->sys_freq, speed); ++ dev_dbg(&spi->dev, "rate-1:%u\n", rate); ++ ++ if (rate > 4097) ++ return -EINVAL; ++ ++ if (rate < 2) ++ rate = 2; ++ ++ reg = mt7621_spi_read(rs, MT7621_SPI_MASTER); ++ reg &= ~(0xfff << 16); ++ reg |= (rate - 2) << 16; ++ rs->speed = speed; ++ ++ reg &= ~MT7621_LSB_FIRST; ++ if (spi->mode & SPI_LSB_FIRST) ++ reg |= MT7621_LSB_FIRST; ++ ++ reg &= ~(MT7621_CPHA | MT7621_CPOL); ++ switch(spi->mode & (SPI_CPOL | SPI_CPHA)) { ++ case SPI_MODE_0: ++ break; ++ case SPI_MODE_1: ++ reg |= MT7621_CPHA; ++ break; ++ case SPI_MODE_2: ++ reg |= MT7621_CPOL; ++ break; ++ case SPI_MODE_3: ++ reg |= MT7621_CPOL | MT7621_CPHA; ++ break; ++ } ++ mt7621_spi_write(rs, MT7621_SPI_MASTER, reg); ++ ++ return 0; ++} ++ ++static inline int mt7621_spi_wait_till_ready(struct spi_device *spi) ++{ ++ struct mt7621_spi *rs = spidev_to_mt7621_spi(spi); ++ int i; ++ ++ for (i = 0; i < RALINK_SPI_WAIT_MAX_LOOP; i++) { ++ u32 status; ++ ++ status = mt7621_spi_read(rs, MT7621_SPI_TRANS); ++ if ((status & SPITRANS_BUSY) == 0) { ++ return 0; ++ } ++ cpu_relax(); ++ udelay(1); ++ } ++ ++ return -ETIMEDOUT; ++} ++ ++static int mt7621_spi_transfer_half_duplex(struct spi_master *master, ++ struct spi_message *m) ++{ ++ struct mt7621_spi *rs = spi_master_get_devdata(master); ++ struct spi_device *spi = m->spi; ++ unsigned int speed = spi->max_speed_hz; ++ struct spi_transfer *t = NULL; ++ int status = 0; ++ int i, len = 0; ++ int rx_len = 0; ++ u32 data[9] = { 0 }; ++ u32 val; ++ ++ mt7621_spi_wait_till_ready(spi); ++ ++ list_for_each_entry(t, &m->transfers, transfer_list) { ++ const u8 *buf = t->tx_buf; ++ ++ if (t->rx_buf) ++ rx_len += t->len; ++ ++ if (!buf) ++ continue; ++ ++ if (t->speed_hz < speed) ++ speed = t->speed_hz; ++ ++ if (WARN_ON(len + t->len > 36)) { ++ status = -EIO; ++ goto msg_done; ++ } ++ ++ for (i = 0; i < t->len; i++, len++) ++ data[len / 4] |= buf[i] << (8 * (len & 3)); ++ } ++ ++ if (WARN_ON(rx_len > 32)) { ++ status = -EIO; ++ goto msg_done; ++ } ++ ++ if (mt7621_spi_prepare(spi, speed)) { ++ status = -EIO; ++ goto msg_done; ++ } ++ data[0] = swab32(data[0]); ++ if (len < 4) ++ data[0] >>= (4 - len) * 8; ++ ++ for (i = 0; i < len; i += 4) ++ mt7621_spi_write(rs, MT7621_SPI_OPCODE + i, data[i / 4]); ++ ++ val = (min_t(int, len, 4) * 8) << 24; ++ if (len > 4) ++ val |= (len - 4) * 8; ++ val |= (rx_len * 8) << 12; ++ mt7621_spi_write(rs, MT7621_SPI_MOREBUF, val); ++ ++ mt7621_spi_set_cs(spi, 1); ++ ++ val = mt7621_spi_read(rs, MT7621_SPI_TRANS); ++ val |= SPI_CTL_START; ++ mt7621_spi_write(rs, MT7621_SPI_TRANS, val); ++ ++ mt7621_spi_wait_till_ready(spi); ++ ++ mt7621_spi_set_cs(spi, 0); ++ ++ for (i = 0; i < rx_len; i += 4) ++ data[i / 4] = mt7621_spi_read(rs, MT7621_SPI_DATA0 + i); ++ ++ m->actual_length = len + rx_len; ++ ++ len = 0; ++ list_for_each_entry(t, &m->transfers, transfer_list) { ++ u8 *buf = t->rx_buf; ++ ++ if (!buf) ++ continue; ++ ++ for (i = 0; i < t->len; i++, len++) ++ buf[i] = data[len / 4] >> (8 * (len & 3)); ++ } ++ ++msg_done: ++ m->status = status; ++ spi_finalize_current_message(master); ++ ++ return 0; ++} ++ ++static int mt7621_spi_transfer_full_duplex(struct spi_master *master, ++ struct spi_message *m) ++{ ++ struct mt7621_spi *rs = spi_master_get_devdata(master); ++ struct spi_device *spi = m->spi; ++ unsigned int speed = spi->max_speed_hz; ++ struct spi_transfer *t = NULL; ++ int status = 0; ++ int i, len = 0; ++ int rx_len = 0; ++ u32 data[9] = { 0 }; ++ u32 val = 0; ++ ++ mt7621_spi_wait_till_ready(spi); ++ ++ list_for_each_entry(t, &m->transfers, transfer_list) { ++ const u8 *buf = t->tx_buf; ++ ++ if (t->rx_buf) ++ rx_len += t->len; ++ ++ if (!buf) ++ continue; ++ ++ if (WARN_ON(len + t->len > 16)) { ++ status = -EIO; ++ goto msg_done; ++ } ++ ++ for (i = 0; i < t->len; i++, len++) ++ data[len / 4] |= buf[i] << (8 * (len & 3)); ++ if (speed > t->speed_hz) ++ speed = t->speed_hz; ++ } ++ ++ if (WARN_ON(rx_len > 16)) { ++ status = -EIO; ++ goto msg_done; ++ } ++ ++ if (mt7621_spi_prepare(spi, speed)) { ++ status = -EIO; ++ goto msg_done; ++ } ++ ++ for (i = 0; i < len; i += 4) ++ mt7621_spi_write(rs, MT7621_SPI_DATA0 + i, data[i / 4]); ++ ++ val |= len * 8; ++ val |= (rx_len * 8) << 12; ++ mt7621_spi_write(rs, MT7621_SPI_MOREBUF, val); ++ ++ mt7621_spi_set_cs(spi, 1); ++ ++ val = mt7621_spi_read(rs, MT7621_SPI_TRANS); ++ val |= SPI_CTL_START; ++ mt7621_spi_write(rs, MT7621_SPI_TRANS, val); ++ ++ mt7621_spi_wait_till_ready(spi); ++ ++ mt7621_spi_set_cs(spi, 0); ++ ++ for (i = 0; i < rx_len; i += 4) ++ data[i / 4] = mt7621_spi_read(rs, MT7621_SPI_DATA4 + i); ++ ++ m->actual_length = rx_len; ++ ++ len = 0; ++ list_for_each_entry(t, &m->transfers, transfer_list) { ++ u8 *buf = t->rx_buf; ++ ++ if (!buf) ++ continue; ++ ++ for (i = 0; i < t->len; i++, len++) ++ buf[i] = data[len / 4] >> (8 * (len & 3)); ++ } ++ ++msg_done: ++ m->status = status; ++ spi_finalize_current_message(master); ++ ++ return 0; ++} ++ ++static int mt7621_spi_transfer_one_message(struct spi_master *master, ++ struct spi_message *m) ++{ ++ struct spi_device *spi = m->spi; ++ int cs = spi->chip_select; ++ ++ if (cs) ++ return mt7621_spi_transfer_full_duplex(master, m); ++ return mt7621_spi_transfer_half_duplex(master, m); ++} ++ ++static int mt7621_spi_setup(struct spi_device *spi) ++{ ++ struct mt7621_spi *rs = spidev_to_mt7621_spi(spi); ++ ++ if ((spi->max_speed_hz == 0) || ++ (spi->max_speed_hz > (rs->sys_freq / 2))) ++ spi->max_speed_hz = (rs->sys_freq / 2); ++ ++ if (spi->max_speed_hz < (rs->sys_freq / 4097)) { ++ dev_err(&spi->dev, "setup: requested speed is too low %d Hz\n", ++ spi->max_speed_hz); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id mt7621_spi_match[] = { ++ { .compatible = "ralink,mt7621-spi" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mt7621_spi_match); ++ ++static int mt7621_spi_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *match; ++ struct spi_master *master; ++ struct mt7621_spi *rs; ++ unsigned long flags; ++ void __iomem *base; ++ struct resource *r; ++ int status = 0; ++ struct clk *clk; ++ struct mt7621_spi_ops *ops; ++ ++ match = of_match_device(mt7621_spi_match, &pdev->dev); ++ if (!match) ++ return -EINVAL; ++ ops = (struct mt7621_spi_ops *)match->data; ++ ++ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, r); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(clk)) { ++ dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n", ++ status); ++ return PTR_ERR(clk); ++ } ++ ++ status = clk_prepare_enable(clk); ++ if (status) ++ return status; ++ ++ master = spi_alloc_master(&pdev->dev, sizeof(*rs)); ++ if (master == NULL) { ++ dev_info(&pdev->dev, "master allocation failed\n"); ++ return -ENOMEM; ++ } ++ ++ master->mode_bits = RT2880_SPI_MODE_BITS; ++ ++ master->setup = mt7621_spi_setup; ++ master->transfer_one_message = mt7621_spi_transfer_one_message; ++ master->bits_per_word_mask = SPI_BPW_MASK(8); ++ master->dev.of_node = pdev->dev.of_node; ++ master->num_chipselect = 2; ++ ++ dev_set_drvdata(&pdev->dev, master); ++ ++ rs = spi_master_get_devdata(master); ++ rs->base = base; ++ rs->clk = clk; ++ rs->master = master; ++ rs->sys_freq = clk_get_rate(rs->clk); ++ rs->ops = ops; ++ dev_info(&pdev->dev, "sys_freq: %u\n", rs->sys_freq); ++ spin_lock_irqsave(&rs->lock, flags); ++ ++ device_reset(&pdev->dev); ++ ++ mt7621_spi_reset(rs, 0); ++ ++ return spi_register_master(master); ++} ++ ++static int mt7621_spi_remove(struct platform_device *pdev) ++{ ++ struct spi_master *master; ++ struct mt7621_spi *rs; ++ ++ master = dev_get_drvdata(&pdev->dev); ++ rs = spi_master_get_devdata(master); ++ ++ clk_disable(rs->clk); ++ spi_unregister_master(master); ++ ++ return 0; ++} ++ ++MODULE_ALIAS("platform:" DRIVER_NAME); ++ ++static struct platform_driver mt7621_spi_driver = { ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = mt7621_spi_match, ++ }, ++ .probe = mt7621_spi_probe, ++ .remove = mt7621_spi_remove, ++}; ++ ++module_platform_driver(mt7621_spi_driver); ++ ++MODULE_DESCRIPTION("MT7621 SPI driver"); ++MODULE_AUTHOR("Felix Fietkau "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/ramips/patches-4.4/0044-i2c-MIPS-adds-ralink-I2C-driver.patch b/target/linux/ramips/patches-4.4/0044-i2c-MIPS-adds-ralink-I2C-driver.patch new file mode 100644 index 0000000000..21872082dd --- /dev/null +++ b/target/linux/ramips/patches-4.4/0044-i2c-MIPS-adds-ralink-I2C-driver.patch @@ -0,0 +1,507 @@ +From 723b8beaabf3c3c4b1ce69480141f1e926f3f3b2 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:52:56 +0100 +Subject: [PATCH 44/53] i2c: MIPS: adds ralink I2C driver + +Signed-off-by: John Crispin +--- + .../devicetree/bindings/i2c/i2c-ralink.txt | 27 ++ + drivers/i2c/busses/Kconfig | 4 + + drivers/i2c/busses/Makefile | 1 + + drivers/i2c/busses/i2c-ralink.c | 327 ++++++++++++++++++++ + 4 files changed, 359 insertions(+) + create mode 100644 Documentation/devicetree/bindings/i2c/i2c-ralink.txt + create mode 100644 drivers/i2c/busses/i2c-ralink.c + +--- /dev/null ++++ b/Documentation/devicetree/bindings/i2c/i2c-ralink.txt +@@ -0,0 +1,27 @@ ++I2C for Ralink platforms ++ ++Required properties : ++- compatible : Must be "link,rt3052-i2c" ++- reg: physical base address of the controller and length of memory mapped ++ region. ++- #address-cells = <1>; ++- #size-cells = <0>; ++ ++Optional properties: ++- Child nodes conforming to i2c bus binding ++ ++Example : ++ ++palmbus@10000000 { ++ i2c@900 { ++ compatible = "link,rt3052-i2c"; ++ reg = <0x900 0x100>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hwmon@4b { ++ compatible = "national,lm92"; ++ reg = <0x4b>; ++ }; ++ }; ++}; +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -806,6 +806,11 @@ config I2C_RK3X + This driver can also be built as a module. If so, the module will + be called i2c-rk3x. + ++config I2C_RALINK ++ tristate "Ralink I2C Controller" ++ depends on RALINK && !SOC_MT7621 ++ select OF_I2C ++ + config HAVE_S3C2410_I2C + bool + help +--- a/drivers/i2c/busses/Makefile ++++ b/drivers/i2c/busses/Makefile +@@ -75,6 +75,7 @@ obj-$(CONFIG_I2C_PNX) += i2c-pnx.o + obj-$(CONFIG_I2C_PUV3) += i2c-puv3.o + obj-$(CONFIG_I2C_PXA) += i2c-pxa.o + obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o ++obj-$(CONFIG_I2C_RALINK) += i2c-ralink.o + obj-$(CONFIG_I2C_QUP) += i2c-qup.o + obj-$(CONFIG_I2C_RIIC) += i2c-riic.o + obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o +--- /dev/null ++++ b/drivers/i2c/busses/i2c-ralink.c +@@ -0,0 +1,435 @@ ++/* ++ * drivers/i2c/busses/i2c-ralink.c ++ * ++ * Copyright (C) 2013 Steven Liu ++ * Copyright (C) 2016 Michael Lee ++ * ++ * Improve driver for i2cdetect from i2c-tools to detect i2c devices on the bus. ++ * (C) 2014 Sittisak ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * 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. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define REG_CONFIG_REG 0x00 ++#define REG_CLKDIV_REG 0x04 ++#define REG_DEVADDR_REG 0x08 ++#define REG_ADDR_REG 0x0C ++#define REG_DATAOUT_REG 0x10 ++#define REG_DATAIN_REG 0x14 ++#define REG_STATUS_REG 0x18 ++#define REG_STARTXFR_REG 0x1C ++#define REG_BYTECNT_REG 0x20 ++ ++/* REG_CONFIG_REG */ ++#define I2C_ADDRLEN_OFFSET 5 ++#define I2C_DEVADLEN_OFFSET 2 ++#define I2C_ADDRLEN_MASK 0x3 ++#define I2C_ADDR_DIS BIT(1) ++#define I2C_DEVADDR_DIS BIT(0) ++#define I2C_ADDRLEN_8 (7 << I2C_ADDRLEN_OFFSET) ++#define I2C_DEVADLEN_7 (6 << I2C_DEVADLEN_OFFSET) ++#define I2C_CONF_DEFAULT (I2C_ADDRLEN_8 | I2C_DEVADLEN_7) ++ ++/* REG_CLKDIV_REG */ ++#define I2C_CLKDIV_MASK 0xffff ++ ++/* REG_DEVADDR_REG */ ++#define I2C_DEVADDR_MASK 0x7f ++ ++/* REG_ADDR_REG */ ++#define I2C_ADDR_MASK 0xff ++ ++/* REG_STATUS_REG */ ++#define I2C_STARTERR BIT(4) ++#define I2C_ACKERR BIT(3) ++#define I2C_DATARDY BIT(2) ++#define I2C_SDOEMPTY BIT(1) ++#define I2C_BUSY BIT(0) ++ ++/* REG_STARTXFR_REG */ ++#define NOSTOP_CMD BIT(2) ++#define NODATA_CMD BIT(1) ++#define READ_CMD BIT(0) ++ ++/* REG_BYTECNT_REG */ ++#define BYTECNT_MAX 64 ++#define SET_BYTECNT(x) (x - 1) ++ ++/* timeout waiting for I2C devices to respond (clock streching) */ ++#define TIMEOUT_MS 1000 ++#define DELAY_INTERVAL_US 100 ++ ++struct rt_i2c { ++ void __iomem *base; ++ struct clk *clk; ++ struct device *dev; ++ struct i2c_adapter adap; ++ u32 cur_clk; ++ u32 clk_div; ++ u32 flags; ++}; ++ ++static void rt_i2c_w32(struct rt_i2c *i2c, u32 val, unsigned reg) ++{ ++ iowrite32(val, i2c->base + reg); ++} ++ ++static u32 rt_i2c_r32(struct rt_i2c *i2c, unsigned reg) ++{ ++ return ioread32(i2c->base + reg); ++} ++ ++static int poll_down_timeout(void __iomem *addr, u32 mask) ++{ ++ unsigned long timeout = jiffies + msecs_to_jiffies(TIMEOUT_MS); ++ ++ do { ++ if (!(readl_relaxed(addr) & mask)) ++ return 0; ++ ++ usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); ++ } while (time_before(jiffies, timeout)); ++ ++ return (readl_relaxed(addr) & mask) ? -EAGAIN : 0; ++} ++ ++static int rt_i2c_wait_idle(struct rt_i2c *i2c) ++{ ++ int ret; ++ ++ ret = poll_down_timeout(i2c->base + REG_STATUS_REG, I2C_BUSY); ++ if (ret < 0) ++ dev_dbg(i2c->dev, "idle err(%d)\n", ret); ++ ++ return ret; ++} ++ ++static int poll_up_timeout(void __iomem *addr, u32 mask) ++{ ++ unsigned long timeout = jiffies + msecs_to_jiffies(TIMEOUT_MS); ++ u32 status; ++ ++ do { ++ status = readl_relaxed(addr); ++ ++ /* check error status */ ++ if (status & I2C_STARTERR) ++ return -EAGAIN; ++ else if (status & I2C_ACKERR) ++ return -ENXIO; ++ else if (status & mask) ++ return 0; ++ ++ usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); ++ } while (time_before(jiffies, timeout)); ++ ++ return -ETIMEDOUT; ++} ++ ++static int rt_i2c_wait_rx_done(struct rt_i2c *i2c) ++{ ++ int ret; ++ ++ ret = poll_up_timeout(i2c->base + REG_STATUS_REG, I2C_DATARDY); ++ if (ret < 0) ++ dev_dbg(i2c->dev, "rx err(%d)\n", ret); ++ ++ return ret; ++} ++ ++static int rt_i2c_wait_tx_done(struct rt_i2c *i2c) ++{ ++ int ret; ++ ++ ret = poll_up_timeout(i2c->base + REG_STATUS_REG, I2C_SDOEMPTY); ++ if (ret < 0) ++ dev_dbg(i2c->dev, "tx err(%d)\n", ret); ++ ++ return ret; ++} ++ ++static void rt_i2c_reset(struct rt_i2c *i2c) ++{ ++ device_reset(i2c->adap.dev.parent); ++ barrier(); ++ rt_i2c_w32(i2c, i2c->clk_div, REG_CLKDIV_REG); ++} ++ ++static void rt_i2c_dump_reg(struct rt_i2c *i2c) ++{ ++ dev_dbg(i2c->dev, "conf %08x, clkdiv %08x, devaddr %08x, " \ ++ "addr %08x, dataout %08x, datain %08x, " \ ++ "status %08x, startxfr %08x, bytecnt %08x\n", ++ rt_i2c_r32(i2c, REG_CONFIG_REG), ++ rt_i2c_r32(i2c, REG_CLKDIV_REG), ++ rt_i2c_r32(i2c, REG_DEVADDR_REG), ++ rt_i2c_r32(i2c, REG_ADDR_REG), ++ rt_i2c_r32(i2c, REG_DATAOUT_REG), ++ rt_i2c_r32(i2c, REG_DATAIN_REG), ++ rt_i2c_r32(i2c, REG_STATUS_REG), ++ rt_i2c_r32(i2c, REG_STARTXFR_REG), ++ rt_i2c_r32(i2c, REG_BYTECNT_REG)); ++} ++ ++static int rt_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, ++ int num) ++{ ++ struct rt_i2c *i2c; ++ struct i2c_msg *pmsg; ++ unsigned char addr; ++ int i, j, ret; ++ u32 cmd; ++ ++ i2c = i2c_get_adapdata(adap); ++ ++ for (i = 0; i < num; i++) { ++ pmsg = &msgs[i]; ++ if (i == (num - 1)) ++ cmd = 0; ++ else ++ cmd = NOSTOP_CMD; ++ ++ dev_dbg(i2c->dev, "addr: 0x%x, len: %d, flags: 0x%x, stop: %d\n", ++ pmsg->addr, pmsg->len, pmsg->flags, ++ (cmd == 0)? 1 : 0); ++ ++ /* wait hardware idle */ ++ if ((ret = rt_i2c_wait_idle(i2c))) ++ goto err_timeout; ++ ++ if (pmsg->flags & I2C_M_TEN) { ++ rt_i2c_w32(i2c, I2C_CONF_DEFAULT, REG_CONFIG_REG); ++ /* 10 bits address */ ++ addr = 0x78 | ((pmsg->addr >> 8) & 0x03); ++ rt_i2c_w32(i2c, addr & I2C_DEVADDR_MASK, ++ REG_DEVADDR_REG); ++ rt_i2c_w32(i2c, pmsg->addr & I2C_ADDR_MASK, ++ REG_ADDR_REG); ++ } else { ++ rt_i2c_w32(i2c, I2C_CONF_DEFAULT | I2C_ADDR_DIS, ++ REG_CONFIG_REG); ++ /* 7 bits address */ ++ rt_i2c_w32(i2c, pmsg->addr & I2C_DEVADDR_MASK, ++ REG_DEVADDR_REG); ++ } ++ ++ /* buffer length */ ++ if (pmsg->len == 0) ++ cmd |= NODATA_CMD; ++ else ++ rt_i2c_w32(i2c, SET_BYTECNT(pmsg->len), ++ REG_BYTECNT_REG); ++ ++ j = 0; ++ if (pmsg->flags & I2C_M_RD) { ++ cmd |= READ_CMD; ++ /* start transfer */ ++ barrier(); ++ rt_i2c_w32(i2c, cmd, REG_STARTXFR_REG); ++ do { ++ /* wait */ ++ if ((ret = rt_i2c_wait_rx_done(i2c))) ++ goto err_timeout; ++ /* read data */ ++ if (pmsg->len) ++ pmsg->buf[j] = rt_i2c_r32(i2c, ++ REG_DATAIN_REG); ++ j++; ++ } while (j < pmsg->len); ++ } else { ++ do { ++ /* write data */ ++ if (pmsg->len) ++ rt_i2c_w32(i2c, pmsg->buf[j], ++ REG_DATAOUT_REG); ++ /* start transfer */ ++ if (j == 0) { ++ barrier(); ++ rt_i2c_w32(i2c, cmd, REG_STARTXFR_REG); ++ } ++ /* wait */ ++ if ((ret = rt_i2c_wait_tx_done(i2c))) ++ goto err_timeout; ++ j++; ++ } while (j < pmsg->len); ++ } ++ } ++ /* the return value is number of executed messages */ ++ ret = i; ++ ++ return ret; ++ ++err_timeout: ++ rt_i2c_dump_reg(i2c); ++ rt_i2c_reset(i2c); ++ return ret; ++} ++ ++static u32 rt_i2c_func(struct i2c_adapter *a) ++{ ++ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; ++} ++ ++static const struct i2c_algorithm rt_i2c_algo = { ++ .master_xfer = rt_i2c_master_xfer, ++ .functionality = rt_i2c_func, ++}; ++ ++static const struct of_device_id i2c_rt_dt_ids[] = { ++ { .compatible = "ralink,rt2880-i2c" }, ++ { /* sentinel */ } ++}; ++ ++MODULE_DEVICE_TABLE(of, i2c_rt_dt_ids); ++ ++static struct i2c_adapter_quirks rt_i2c_quirks = { ++ .max_write_len = BYTECNT_MAX, ++ .max_read_len = BYTECNT_MAX, ++}; ++ ++static int rt_i2c_init(struct rt_i2c *i2c) ++{ ++ u32 reg; ++ ++ /* i2c_sclk = periph_clk / ((2 * clk_div) + 5) */ ++ i2c->clk_div = (clk_get_rate(i2c->clk) - (5 * i2c->cur_clk)) / ++ (2 * i2c->cur_clk); ++ if (i2c->clk_div < 8) ++ i2c->clk_div = 8; ++ if (i2c->clk_div > I2C_CLKDIV_MASK) ++ i2c->clk_div = I2C_CLKDIV_MASK; ++ ++ /* check support combinde/repeated start message */ ++ rt_i2c_w32(i2c, NOSTOP_CMD, REG_STARTXFR_REG); ++ reg = rt_i2c_r32(i2c, REG_STARTXFR_REG) & NOSTOP_CMD; ++ ++ rt_i2c_reset(i2c); ++ ++ return reg; ++} ++ ++static int rt_i2c_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ struct rt_i2c *i2c; ++ struct i2c_adapter *adap; ++ const struct of_device_id *match; ++ int ret, restart; ++ ++ match = of_match_device(i2c_rt_dt_ids, &pdev->dev); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ dev_err(&pdev->dev, "no memory resource found\n"); ++ return -ENODEV; ++ } ++ ++ i2c = devm_kzalloc(&pdev->dev, sizeof(struct rt_i2c), GFP_KERNEL); ++ if (!i2c) { ++ dev_err(&pdev->dev, "failed to allocate i2c_adapter\n"); ++ return -ENOMEM; ++ } ++ ++ i2c->base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(i2c->base)) ++ return PTR_ERR(i2c->base); ++ ++ i2c->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(i2c->clk)) { ++ dev_err(&pdev->dev, "no clock defined\n"); ++ return -ENODEV; ++ } ++ clk_prepare_enable(i2c->clk); ++ i2c->dev = &pdev->dev; ++ ++ if (of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &i2c->cur_clk)) ++ i2c->cur_clk = 100000; ++ ++ adap = &i2c->adap; ++ adap->owner = THIS_MODULE; ++ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; ++ adap->algo = &rt_i2c_algo; ++ adap->retries = 3; ++ adap->dev.parent = &pdev->dev; ++ i2c_set_adapdata(adap, i2c); ++ adap->dev.of_node = pdev->dev.of_node; ++ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); ++ adap->quirks = &rt_i2c_quirks; ++ ++ platform_set_drvdata(pdev, i2c); ++ ++ restart = rt_i2c_init(i2c); ++ ++ ret = i2c_add_adapter(adap); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "failed to add adapter\n"); ++ clk_disable_unprepare(i2c->clk); ++ return ret; ++ } ++ ++ dev_info(&pdev->dev, "clock %uKHz, re-start %ssupport\n", ++ i2c->cur_clk/1000, restart ? "" : "not "); ++ ++ return ret; ++} ++ ++static int rt_i2c_remove(struct platform_device *pdev) ++{ ++ struct rt_i2c *i2c = platform_get_drvdata(pdev); ++ ++ i2c_del_adapter(&i2c->adap); ++ clk_disable_unprepare(i2c->clk); ++ ++ return 0; ++} ++ ++static struct platform_driver rt_i2c_driver = { ++ .probe = rt_i2c_probe, ++ .remove = rt_i2c_remove, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "i2c-ralink", ++ .of_match_table = i2c_rt_dt_ids, ++ }, ++}; ++ ++static int __init i2c_rt_init (void) ++{ ++ return platform_driver_register(&rt_i2c_driver); ++} ++subsys_initcall(i2c_rt_init); ++ ++static void __exit i2c_rt_exit (void) ++{ ++ platform_driver_unregister(&rt_i2c_driver); ++} ++module_exit(i2c_rt_exit); ++ ++MODULE_AUTHOR("Steven Liu "); ++MODULE_DESCRIPTION("Ralink I2c host driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:Ralink-I2C"); diff --git a/target/linux/ramips/patches-4.4/0045-i2c-add-mt7621-driver.patch b/target/linux/ramips/patches-4.4/0045-i2c-add-mt7621-driver.patch new file mode 100644 index 0000000000..df8b3a4431 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0045-i2c-add-mt7621-driver.patch @@ -0,0 +1,473 @@ +From d5c54ff3d1db0a4348fa04d8e78f3bf6063e3afc Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:21:27 +0100 +Subject: [PATCH 45/53] i2c: add mt7621 driver + +Signed-off-by: John Crispin +--- + drivers/i2c/busses/Kconfig | 4 + + drivers/i2c/busses/Makefile | 1 + + drivers/i2c/busses/i2c-mt7621.c | 303 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 308 insertions(+) + create mode 100644 drivers/i2c/busses/i2c-mt7621.c + +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -811,6 +811,11 @@ config I2C_RALINK + depends on RALINK && !SOC_MT7621 + select OF_I2C + ++config I2C_MT7621 ++ tristate "MT7621/MT7628 I2C Controller" ++ depends on RALINK && (SOC_MT7620 || SOC_MT7621) ++ select OF_I2C ++ + config HAVE_S3C2410_I2C + bool + help +--- a/drivers/i2c/busses/Makefile ++++ b/drivers/i2c/busses/Makefile +@@ -76,6 +76,7 @@ obj-$(CONFIG_I2C_PUV3) += i2c-puv3.o + obj-$(CONFIG_I2C_PXA) += i2c-pxa.o + obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o + obj-$(CONFIG_I2C_RALINK) += i2c-ralink.o ++obj-$(CONFIG_I2C_MT7621) += i2c-mt7621.o + obj-$(CONFIG_I2C_QUP) += i2c-qup.o + obj-$(CONFIG_I2C_RIIC) += i2c-riic.o + obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o +--- /dev/null ++++ b/drivers/i2c/busses/i2c-mt7621.c +@@ -0,0 +1,433 @@ ++/* ++ * drivers/i2c/busses/i2c-mt7621.c ++ * ++ * Copyright (C) 2013 Steven Liu ++ * Copyright (C) 2016 Michael Lee ++ * ++ * Improve driver for i2cdetect from i2c-tools to detect i2c devices on the bus. ++ * (C) 2014 Sittisak ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * 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. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define REG_SM0CFG0 0x08 ++#define REG_SM0DOUT 0x10 ++#define REG_SM0DIN 0x14 ++#define REG_SM0ST 0x18 ++#define REG_SM0AUTO 0x1C ++#define REG_SM0CFG1 0x20 ++#define REG_SM0CFG2 0x28 ++#define REG_SM0CTL0 0x40 ++#define REG_SM0CTL1 0x44 ++#define REG_SM0D0 0x50 ++#define REG_SM0D1 0x54 ++#define REG_PINTEN 0x5C ++#define REG_PINTST 0x60 ++#define REG_PINTCL 0x64 ++ ++/* REG_SM0CFG0 */ ++#define I2C_DEVADDR_MASK 0x7f ++ ++/* REG_SM0ST */ ++#define I2C_DATARDY BIT(2) ++#define I2C_SDOEMPTY BIT(1) ++#define I2C_BUSY BIT(0) ++ ++/* REG_SM0AUTO */ ++#define READ_CMD BIT(0) ++ ++/* REG_SM0CFG1 */ ++#define BYTECNT_MAX 64 ++#define SET_BYTECNT(x) (x - 1) ++ ++/* REG_SM0CFG2 */ ++#define AUTOMODE_EN BIT(0) ++ ++/* REG_SM0CTL0 */ ++#define ODRAIN_HIGH_SM0 BIT(31) ++#define VSYNC_SHIFT 28 ++#define VSYNC_MASK 0x3 ++#define VSYNC_PULSE (0x1 << VSYNC_SHIFT) ++#define VSYNC_RISING (0x2 << VSYNC_SHIFT) ++#define CLK_DIV_SHIFT 16 ++#define CLK_DIV_MASK 0xfff ++#define DEG_CNT_SHIFT 8 ++#define DEG_CNT_MASK 0xff ++#define WAIT_HIGH BIT(6) ++#define DEG_EN BIT(5) ++#define CS_STATUA BIT(4) ++#define SCL_STATUS BIT(3) ++#define SDA_STATUS BIT(2) ++#define SM0_EN BIT(1) ++#define SCL_STRECH BIT(0) ++ ++/* REG_SM0CTL1 */ ++#define ACK_SHIFT 16 ++#define ACK_MASK 0xff ++#define PGLEN_SHIFT 8 ++#define PGLEN_MASK 0x7 ++#define SM0_MODE_SHIFT 4 ++#define SM0_MODE_MASK 0x7 ++#define SM0_MODE_START 0x1 ++#define SM0_MODE_WRITE 0x2 ++#define SM0_MODE_STOP 0x3 ++#define SM0_MODE_READ_NACK 0x4 ++#define SM0_MODE_READ_ACK 0x5 ++#define SM0_TRI_BUSY BIT(0) ++ ++/* timeout waiting for I2C devices to respond (clock streching) */ ++#define TIMEOUT_MS 1000 ++#define DELAY_INTERVAL_US 100 ++ ++struct mtk_i2c { ++ void __iomem *base; ++ struct clk *clk; ++ struct device *dev; ++ struct i2c_adapter adap; ++ u32 cur_clk; ++ u32 clk_div; ++ u32 flags; ++}; ++ ++static void mtk_i2c_w32(struct mtk_i2c *i2c, u32 val, unsigned reg) ++{ ++ iowrite32(val, i2c->base + reg); ++} ++ ++static u32 mtk_i2c_r32(struct mtk_i2c *i2c, unsigned reg) ++{ ++ return ioread32(i2c->base + reg); ++} ++ ++static int poll_down_timeout(void __iomem *addr, u32 mask) ++{ ++ unsigned long timeout = jiffies + msecs_to_jiffies(TIMEOUT_MS); ++ ++ do { ++ if (!(readl_relaxed(addr) & mask)) ++ return 0; ++ ++ usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); ++ } while (time_before(jiffies, timeout)); ++ ++ return (readl_relaxed(addr) & mask) ? -EAGAIN : 0; ++} ++ ++static int mtk_i2c_wait_idle(struct mtk_i2c *i2c) ++{ ++ int ret; ++ ++ ret = poll_down_timeout(i2c->base + REG_SM0ST, I2C_BUSY); ++ if (ret < 0) ++ dev_dbg(i2c->dev, "idle err(%d)\n", ret); ++ ++ return ret; ++} ++ ++static int poll_up_timeout(void __iomem *addr, u32 mask) ++{ ++ unsigned long timeout = jiffies + msecs_to_jiffies(TIMEOUT_MS); ++ u32 status; ++ ++ do { ++ status = readl_relaxed(addr); ++ if (status & mask) ++ return 0; ++ usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); ++ } while (time_before(jiffies, timeout)); ++ ++ return -ETIMEDOUT; ++} ++ ++static int mtk_i2c_wait_rx_done(struct mtk_i2c *i2c) ++{ ++ int ret; ++ ++ ret = poll_up_timeout(i2c->base + REG_SM0ST, I2C_DATARDY); ++ if (ret < 0) ++ dev_dbg(i2c->dev, "rx err(%d)\n", ret); ++ ++ return ret; ++} ++ ++static int mtk_i2c_wait_tx_done(struct mtk_i2c *i2c) ++{ ++ int ret; ++ ++ ret = poll_up_timeout(i2c->base + REG_SM0ST, I2C_SDOEMPTY); ++ if (ret < 0) ++ dev_dbg(i2c->dev, "tx err(%d)\n", ret); ++ ++ return ret; ++} ++ ++static void mtk_i2c_reset(struct mtk_i2c *i2c) ++{ ++ u32 reg; ++ device_reset(i2c->adap.dev.parent); ++ barrier(); ++ ++ /* ctrl0 */ ++ reg = ODRAIN_HIGH_SM0 | VSYNC_PULSE | (i2c->clk_div << CLK_DIV_SHIFT) | ++ WAIT_HIGH | SM0_EN; ++ mtk_i2c_w32(i2c, reg, REG_SM0CTL0); ++ ++ /* auto mode */ ++ mtk_i2c_w32(i2c, AUTOMODE_EN, REG_SM0CFG2); ++} ++ ++static void mtk_i2c_dump_reg(struct mtk_i2c *i2c) ++{ ++ dev_dbg(i2c->dev, "cfg0 %08x, dout %08x, din %08x, " \ ++ "status %08x, auto %08x, cfg1 %08x, " \ ++ "cfg2 %08x, ctl0 %08x, ctl1 %08x\n", ++ mtk_i2c_r32(i2c, REG_SM0CFG0), ++ mtk_i2c_r32(i2c, REG_SM0DOUT), ++ mtk_i2c_r32(i2c, REG_SM0DIN), ++ mtk_i2c_r32(i2c, REG_SM0ST), ++ mtk_i2c_r32(i2c, REG_SM0AUTO), ++ mtk_i2c_r32(i2c, REG_SM0CFG1), ++ mtk_i2c_r32(i2c, REG_SM0CFG2), ++ mtk_i2c_r32(i2c, REG_SM0CTL0), ++ mtk_i2c_r32(i2c, REG_SM0CTL1)); ++} ++ ++static int mtk_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, ++ int num) ++{ ++ struct mtk_i2c *i2c; ++ struct i2c_msg *pmsg; ++ int i, j, ret; ++ u32 cmd; ++ ++ i2c = i2c_get_adapdata(adap); ++ ++ for (i = 0; i < num; i++) { ++ pmsg = &msgs[i]; ++ cmd = 0; ++ ++ dev_dbg(i2c->dev, "addr: 0x%x, len: %d, flags: 0x%x\n", ++ pmsg->addr, pmsg->len, pmsg->flags); ++ ++ /* wait hardware idle */ ++ if ((ret = mtk_i2c_wait_idle(i2c))) ++ goto err_timeout; ++ ++ if (pmsg->flags & I2C_M_TEN) { ++ dev_dbg(i2c->dev, "10 bits addr not supported\n"); ++ return -EINVAL; ++ } else { ++ /* 7 bits address */ ++ mtk_i2c_w32(i2c, pmsg->addr & I2C_DEVADDR_MASK, ++ REG_SM0CFG0); ++ } ++ ++ /* buffer length */ ++ if (pmsg->len == 0) { ++ dev_dbg(i2c->dev, "length is 0\n"); ++ return -EINVAL; ++ } else ++ mtk_i2c_w32(i2c, SET_BYTECNT(pmsg->len), ++ REG_SM0CFG1); ++ ++ j = 0; ++ if (pmsg->flags & I2C_M_RD) { ++ cmd |= READ_CMD; ++ /* start transfer */ ++ barrier(); ++ mtk_i2c_w32(i2c, cmd, REG_SM0AUTO); ++ do { ++ /* wait */ ++ if ((ret = mtk_i2c_wait_rx_done(i2c))) ++ goto err_timeout; ++ /* read data */ ++ if (pmsg->len) ++ pmsg->buf[j] = mtk_i2c_r32(i2c, ++ REG_SM0DIN); ++ j++; ++ } while (j < pmsg->len); ++ } else { ++ do { ++ /* write data */ ++ if (pmsg->len) ++ mtk_i2c_w32(i2c, pmsg->buf[j], ++ REG_SM0DOUT); ++ /* start transfer */ ++ if (j == 0) { ++ barrier(); ++ mtk_i2c_w32(i2c, cmd, REG_SM0AUTO); ++ } ++ /* wait */ ++ if ((ret = mtk_i2c_wait_tx_done(i2c))) ++ goto err_timeout; ++ j++; ++ } while (j < pmsg->len); ++ } ++ } ++ /* the return value is number of executed messages */ ++ ret = i; ++ ++ return ret; ++ ++err_timeout: ++ mtk_i2c_dump_reg(i2c); ++ mtk_i2c_reset(i2c); ++ return ret; ++} ++ ++static u32 mtk_i2c_func(struct i2c_adapter *a) ++{ ++ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; ++} ++ ++static const struct i2c_algorithm mtk_i2c_algo = { ++ .master_xfer = mtk_i2c_master_xfer, ++ .functionality = mtk_i2c_func, ++}; ++ ++static const struct of_device_id i2c_mtk_dt_ids[] = { ++ { .compatible = "mediatek,mt7621-i2c" }, ++ { /* sentinel */ } ++}; ++ ++MODULE_DEVICE_TABLE(of, i2c_mtk_dt_ids); ++ ++static struct i2c_adapter_quirks mtk_i2c_quirks = { ++ .max_write_len = BYTECNT_MAX, ++ .max_read_len = BYTECNT_MAX, ++}; ++ ++static void mtk_i2c_init(struct mtk_i2c *i2c) ++{ ++ i2c->clk_div = clk_get_rate(i2c->clk) / i2c->cur_clk; ++ if (i2c->clk_div > CLK_DIV_MASK) ++ i2c->clk_div = CLK_DIV_MASK; ++ ++ mtk_i2c_reset(i2c); ++} ++ ++static int mtk_i2c_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ struct mtk_i2c *i2c; ++ struct i2c_adapter *adap; ++ const struct of_device_id *match; ++ int ret; ++ ++ match = of_match_device(i2c_mtk_dt_ids, &pdev->dev); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ dev_err(&pdev->dev, "no memory resource found\n"); ++ return -ENODEV; ++ } ++ ++ i2c = devm_kzalloc(&pdev->dev, sizeof(struct mtk_i2c), GFP_KERNEL); ++ if (!i2c) { ++ dev_err(&pdev->dev, "failed to allocate i2c_adapter\n"); ++ return -ENOMEM; ++ } ++ ++ i2c->base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(i2c->base)) ++ return PTR_ERR(i2c->base); ++ ++ i2c->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(i2c->clk)) { ++ dev_err(&pdev->dev, "no clock defined\n"); ++ return -ENODEV; ++ } ++ clk_prepare_enable(i2c->clk); ++ i2c->dev = &pdev->dev; ++ ++ if (of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &i2c->cur_clk)) ++ i2c->cur_clk = 100000; ++ ++ adap = &i2c->adap; ++ adap->owner = THIS_MODULE; ++ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; ++ adap->algo = &mtk_i2c_algo; ++ adap->retries = 3; ++ adap->dev.parent = &pdev->dev; ++ i2c_set_adapdata(adap, i2c); ++ adap->dev.of_node = pdev->dev.of_node; ++ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); ++ adap->quirks = &mtk_i2c_quirks; ++ ++ platform_set_drvdata(pdev, i2c); ++ ++ mtk_i2c_init(i2c); ++ ++ ret = i2c_add_adapter(adap); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "failed to add adapter\n"); ++ clk_disable_unprepare(i2c->clk); ++ return ret; ++ } ++ ++ dev_info(&pdev->dev, "clock %uKHz, re-start not support\n", ++ i2c->cur_clk/1000); ++ ++ return ret; ++} ++ ++static int mtk_i2c_remove(struct platform_device *pdev) ++{ ++ struct mtk_i2c *i2c = platform_get_drvdata(pdev); ++ ++ i2c_del_adapter(&i2c->adap); ++ clk_disable_unprepare(i2c->clk); ++ ++ return 0; ++} ++ ++static struct platform_driver mtk_i2c_driver = { ++ .probe = mtk_i2c_probe, ++ .remove = mtk_i2c_remove, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "i2c-mt7621", ++ .of_match_table = i2c_mtk_dt_ids, ++ }, ++}; ++ ++static int __init i2c_mtk_init (void) ++{ ++ return platform_driver_register(&mtk_i2c_driver); ++} ++subsys_initcall(i2c_mtk_init); ++ ++static void __exit i2c_mtk_exit (void) ++{ ++ platform_driver_unregister(&mtk_i2c_driver); ++} ++module_exit(i2c_mtk_exit); ++ ++MODULE_AUTHOR("Steven Liu "); ++MODULE_DESCRIPTION("MT7621 I2c host driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:MT7621-I2C"); diff --git a/target/linux/ramips/patches-4.4/0046-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch b/target/linux/ramips/patches-4.4/0046-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch new file mode 100644 index 0000000000..67c0b29898 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0046-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch @@ -0,0 +1,4830 @@ +From 23147af14531cbdada194b94120ef8774f46292d Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 13 Nov 2014 19:08:40 +0100 +Subject: [PATCH 46/53] mmc: MIPS: ralink: add sdhci for mt7620a SoC + +Signed-off-by: John Crispin +--- + drivers/mmc/host/Kconfig | 2 + + drivers/mmc/host/Makefile | 1 + + drivers/mmc/host/mtk-mmc/Kconfig | 16 + + drivers/mmc/host/mtk-mmc/Makefile | 42 + + drivers/mmc/host/mtk-mmc/board.h | 137 ++ + drivers/mmc/host/mtk-mmc/dbg.c | 347 ++++ + drivers/mmc/host/mtk-mmc/dbg.h | 156 ++ + drivers/mmc/host/mtk-mmc/mt6575_sd.h | 1001 +++++++++++ + drivers/mmc/host/mtk-mmc/sd.c | 3060 ++++++++++++++++++++++++++++++++++ + 9 files changed, 4762 insertions(+) + create mode 100644 drivers/mmc/host/mtk-mmc/Kconfig + create mode 100644 drivers/mmc/host/mtk-mmc/Makefile + create mode 100644 drivers/mmc/host/mtk-mmc/board.h + create mode 100644 drivers/mmc/host/mtk-mmc/dbg.c + create mode 100644 drivers/mmc/host/mtk-mmc/dbg.h + create mode 100644 drivers/mmc/host/mtk-mmc/mt6575_sd.h + create mode 100644 drivers/mmc/host/mtk-mmc/sd.c + +--- a/drivers/mmc/host/Kconfig ++++ b/drivers/mmc/host/Kconfig +@@ -811,3 +811,5 @@ config MMC_MTK + If you have a machine with a integrated SD/MMC card reader, say Y or M here. + This is needed if support for any SD/SDIO/MMC devices is required. + If unsure, say N. ++ ++source "drivers/mmc/host/mtk-mmc/Kconfig" +--- a/drivers/mmc/host/Makefile ++++ b/drivers/mmc/host/Makefile +@@ -2,6 +2,7 @@ + # Makefile for MMC/SD host controller drivers + # + ++obj-$(CONFIG_MTK_MMC) += mtk-mmc/ + obj-$(CONFIG_MMC_ARMMMCI) += mmci.o + obj-$(CONFIG_MMC_QCOM_DML) += mmci_qcom_dml.o + obj-$(CONFIG_MMC_PXA) += pxamci.o +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/Kconfig +@@ -0,0 +1,16 @@ ++config MTK_MMC ++ tristate "MTK SD/MMC" ++ depends on !MTD_NAND_RALINK ++ ++config MTK_AEE_KDUMP ++ bool "MTK AEE KDUMP" ++ depends on MTK_MMC ++ ++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 ++ +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/Makefile +@@ -0,0 +1,42 @@ ++# Copyright Statement: ++# ++# This software/firmware and related documentation ("MediaTek Software") are ++# protected under relevant copyright laws. The information contained herein ++# is confidential and proprietary to MediaTek Inc. and/or its licensors. ++# Without the prior written permission of MediaTek inc. and/or its licensors, ++# any reproduction, modification, use or disclosure of MediaTek Software, ++# and information contained herein, in whole or in part, shall be strictly prohibited. ++# ++# MediaTek Inc. (C) 2010. All rights reserved. ++# ++# BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++# THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++# RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++# AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++# NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++# SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++# SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++# THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++# THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++# CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++# SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++# STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++# CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++# AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++# OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++# MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++# ++# The following software/firmware and/or related documentation ("MediaTek Software") ++# have been modified by MediaTek Inc. All revisions are subject to any receiver's ++# applicable license agreements with MediaTek Inc. ++ ++obj-$(CONFIG_MTK_MMC) += mtk_sd.o ++mtk_sd-objs := sd.o dbg.o ++ifeq ($(CONFIG_MTK_AEE_KDUMP),y) ++EXTRA_CFLAGS += -DMT6575_SD_DEBUG ++endif ++ ++clean: ++ @rm -f *.o modules.order .*.cmd +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/board.h +@@ -0,0 +1,137 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ */ ++/* MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++#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) ++ ++#define MSDC_CMD_PIN (0) ++#define MSDC_DAT_PIN (1) ++#define MSDC_CD_PIN (2) ++#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 */ ++ ++ /* 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); ++}; ++ ++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 */ ++ +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/dbg.c +@@ -0,0 +1,347 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ * ++ * MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++// #include /* --- by chhung */ ++#include "dbg.h" ++#include "mt6575_sd.h" ++#include ++ ++static char cmd_buf[256]; ++ ++/* for debug zone */ ++unsigned int sd_debug_zone[4]={ ++ 0, ++ 0, ++ 0, ++ 0 ++}; ++ ++/* 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) ++/* 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}; ++ ++#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); ++} ++#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); ++ } ++ ++ return ret; ++} ++ ++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); ++ ++ /* 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; ++ ++ 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)); ++ } ++} ++ ++//========== 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_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_printf(s, "-> SDIO_PROFILE<%d> TIME<%ds>\n", sdio_pro_enable, sdio_pro_time); ++ seq_printf(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) ++{ ++ 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; ++ ++ 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; ++ printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); ++ if(id >=0 && id<=3){ ++ sd_debug_zone[id] = zone; ++ } ++ else if(id == 4){ ++ sd_debug_zone[0] = sd_debug_zone[1] = zone; ++ sd_debug_zone[2] = sd_debug_zone[3] = zone; ++ } ++ 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) { ++ /* todo */ ++ sdio_pro_enable = 0; ++ } ++ } ++ ++ return count; ++} ++ ++static int msdc_debug_show(struct inode *inode, struct file *file) ++{ ++ return single_open(file, msdc_debug_proc_read, NULL); ++} ++ ++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, ++}; ++ ++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 ; ++} ++EXPORT_SYMBOL_GPL(msdc_debug_proc_init); ++#endif +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/dbg.h +@@ -0,0 +1,156 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ * ++ * MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++#ifndef __MT_MSDC_DEUBG__ ++#define __MT_MSDC_DEUBG__ ++ ++//========================== ++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 */ ++}; ++ ++/* 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; ++ ++ /*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; ++ ++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]; ++ ++/* Debug message event */ ++#define DBG_EVT_NONE (0) /* No event */ ++#define DBG_EVT_DMA (1 << 0) /* DMA related event */ ++#define DBG_EVT_CMD (1 << 1) /* MSDC CMD related event */ ++#define DBG_EVT_RSP (1 << 2) /* MSDC CMD RSP related event */ ++#define DBG_EVT_INT (1 << 3) /* MSDC INT event */ ++#define DBG_EVT_CFG (1 << 4) /* MSDC CFG event */ ++#define DBG_EVT_FUC (1 << 5) /* Function event */ ++#define DBG_EVT_OPS (1 << 6) /* Read/Write operation event */ ++#define DBG_EVT_FIO (1 << 7) /* FIFO operation event */ ++#define DBG_EVT_WRN (1 << 8) /* Warning event */ ++#define DBG_EVT_PWR (1 << 9) /* Power event */ ++#define DBG_EVT_ALL (0xffffffff) ++ ++#define DBG_EVT_MASK (DBG_EVT_ALL) ++ ++extern unsigned int sd_debug_zone[4]; ++#define TAG "msdc" ++#if 0 /* +++ chhung */ ++#define BUG_ON(x) \ ++do { \ ++ if (x) { \ ++ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ ++ while(1); \ ++ } \ ++}while(0) ++#endif /* end of +++ */ ++ ++#define N_MSG(evt, fmt, args...) ++/* ++do { \ ++ if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ ++ 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) ++*/ ++ ++#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); ++ ++#if 1 ++//defined CONFIG_MTK_MMC_CD_POLL ++#define INIT_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); ++ ++/* 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); ++#endif ++ ++int 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); ++ ++#endif +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/mt6575_sd.h +@@ -0,0 +1,1001 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ */ ++/* MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++#ifndef MT6575_SD_H ++#define MT6575_SD_H ++ ++#include ++#include ++ ++// #include /* --- by chhung */ ++ ++/*--------------------------------------------------------------------------*/ ++/* Common Macro */ ++/*--------------------------------------------------------------------------*/ ++#define REG_ADDR(x) ((volatile u32*)(base + OFFSET_##x)) ++ ++/*--------------------------------------------------------------------------*/ ++/* Common Definition */ ++/*--------------------------------------------------------------------------*/ ++#define MSDC_FIFO_SZ (128) ++#define MSDC_FIFO_THD (64) // (128) ++#define MSDC_NUM (4) ++ ++#define MSDC_MS (0) ++#define MSDC_SDMMC (1) ++ ++#define MSDC_MODE_UNKNOWN (0) ++#define MSDC_MODE_PIO (1) ++#define MSDC_MODE_DMA_BASIC (2) ++#define MSDC_MODE_DMA_DESC (3) ++#define MSDC_MODE_DMA_ENHANCED (4) ++#define MSDC_MODE_MMC_STREAM (5) ++ ++#define MSDC_BUS_1BITS (0) ++#define MSDC_BUS_4BITS (1) ++#define MSDC_BUS_8BITS (2) ++ ++#define MSDC_BRUST_8B (3) ++#define MSDC_BRUST_16B (4) ++#define MSDC_BRUST_32B (5) ++#define MSDC_BRUST_64B (6) ++ ++#define MSDC_PIN_PULL_NONE (0) ++#define MSDC_PIN_PULL_DOWN (1) ++#define MSDC_PIN_PULL_UP (2) ++#define MSDC_PIN_KEEP (3) ++ ++#define MSDC_MAX_SCLK (48000000) /* +/- by chhung */ ++#define MSDC_MIN_SCLK (260000) ++ ++#define MSDC_AUTOCMD12 (0x0001) ++#define MSDC_AUTOCMD23 (0x0002) ++#define MSDC_AUTOCMD19 (0x0003) ++ ++#define MSDC_EMMC_BOOTMODE0 (0) /* Pull low CMD mode */ ++#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 ++}; ++ ++/*--------------------------------------------------------------------------*/ ++/* Register Offset */ ++/*--------------------------------------------------------------------------*/ ++#define OFFSET_MSDC_CFG (0x0) ++#define OFFSET_MSDC_IOCON (0x04) ++#define OFFSET_MSDC_PS (0x08) ++#define OFFSET_MSDC_INT (0x0c) ++#define OFFSET_MSDC_INTEN (0x10) ++#define OFFSET_MSDC_FIFOCS (0x14) ++#define OFFSET_MSDC_TXDATA (0x18) ++#define OFFSET_MSDC_RXDATA (0x1c) ++#define OFFSET_SDC_CFG (0x30) ++#define OFFSET_SDC_CMD (0x34) ++#define OFFSET_SDC_ARG (0x38) ++#define OFFSET_SDC_STS (0x3c) ++#define OFFSET_SDC_RESP0 (0x40) ++#define OFFSET_SDC_RESP1 (0x44) ++#define OFFSET_SDC_RESP2 (0x48) ++#define OFFSET_SDC_RESP3 (0x4c) ++#define OFFSET_SDC_BLK_NUM (0x50) ++#define OFFSET_SDC_CSTS (0x58) ++#define OFFSET_SDC_CSTS_EN (0x5c) ++#define OFFSET_SDC_DCRC_STS (0x60) ++#define OFFSET_EMMC_CFG0 (0x70) ++#define OFFSET_EMMC_CFG1 (0x74) ++#define OFFSET_EMMC_STS (0x78) ++#define OFFSET_EMMC_IOCON (0x7c) ++#define OFFSET_SDC_ACMD_RESP (0x80) ++#define OFFSET_SDC_ACMD19_TRG (0x84) ++#define OFFSET_SDC_ACMD19_STS (0x88) ++#define OFFSET_MSDC_DMA_SA (0x90) ++#define OFFSET_MSDC_DMA_CA (0x94) ++#define OFFSET_MSDC_DMA_CTRL (0x98) ++#define OFFSET_MSDC_DMA_CFG (0x9c) ++#define OFFSET_MSDC_DBG_SEL (0xa0) ++#define OFFSET_MSDC_DBG_OUT (0xa4) ++#define OFFSET_MSDC_PATCH_BIT (0xb0) ++#define OFFSET_MSDC_PATCH_BIT1 (0xb4) ++#define OFFSET_MSDC_PAD_CTL0 (0xe0) ++#define OFFSET_MSDC_PAD_CTL1 (0xe4) ++#define OFFSET_MSDC_PAD_CTL2 (0xe8) ++#define OFFSET_MSDC_PAD_TUNE (0xec) ++#define OFFSET_MSDC_DAT_RDDLY0 (0xf0) ++#define OFFSET_MSDC_DAT_RDDLY1 (0xf4) ++#define OFFSET_MSDC_HW_DBG (0xf8) ++#define OFFSET_MSDC_VERSION (0x100) ++#define OFFSET_MSDC_ECO_VER (0x104) ++ ++/*--------------------------------------------------------------------------*/ ++/* Register Address */ ++/*--------------------------------------------------------------------------*/ ++ ++/* common register */ ++#define MSDC_CFG REG_ADDR(MSDC_CFG) ++#define MSDC_IOCON REG_ADDR(MSDC_IOCON) ++#define MSDC_PS REG_ADDR(MSDC_PS) ++#define MSDC_INT REG_ADDR(MSDC_INT) ++#define MSDC_INTEN REG_ADDR(MSDC_INTEN) ++#define MSDC_FIFOCS REG_ADDR(MSDC_FIFOCS) ++#define MSDC_TXDATA REG_ADDR(MSDC_TXDATA) ++#define MSDC_RXDATA REG_ADDR(MSDC_RXDATA) ++#define MSDC_PATCH_BIT0 REG_ADDR(MSDC_PATCH_BIT) ++ ++/* sdmmc register */ ++#define SDC_CFG REG_ADDR(SDC_CFG) ++#define SDC_CMD REG_ADDR(SDC_CMD) ++#define SDC_ARG REG_ADDR(SDC_ARG) ++#define SDC_STS REG_ADDR(SDC_STS) ++#define SDC_RESP0 REG_ADDR(SDC_RESP0) ++#define SDC_RESP1 REG_ADDR(SDC_RESP1) ++#define SDC_RESP2 REG_ADDR(SDC_RESP2) ++#define SDC_RESP3 REG_ADDR(SDC_RESP3) ++#define SDC_BLK_NUM REG_ADDR(SDC_BLK_NUM) ++#define SDC_CSTS REG_ADDR(SDC_CSTS) ++#define SDC_CSTS_EN REG_ADDR(SDC_CSTS_EN) ++#define SDC_DCRC_STS REG_ADDR(SDC_DCRC_STS) ++ ++/* emmc register*/ ++#define EMMC_CFG0 REG_ADDR(EMMC_CFG0) ++#define EMMC_CFG1 REG_ADDR(EMMC_CFG1) ++#define EMMC_STS REG_ADDR(EMMC_STS) ++#define EMMC_IOCON REG_ADDR(EMMC_IOCON) ++ ++/* auto command register */ ++#define SDC_ACMD_RESP REG_ADDR(SDC_ACMD_RESP) ++#define SDC_ACMD19_TRG REG_ADDR(SDC_ACMD19_TRG) ++#define SDC_ACMD19_STS REG_ADDR(SDC_ACMD19_STS) ++ ++/* dma register */ ++#define MSDC_DMA_SA REG_ADDR(MSDC_DMA_SA) ++#define MSDC_DMA_CA REG_ADDR(MSDC_DMA_CA) ++#define MSDC_DMA_CTRL REG_ADDR(MSDC_DMA_CTRL) ++#define MSDC_DMA_CFG REG_ADDR(MSDC_DMA_CFG) ++ ++/* pad ctrl register */ ++#define MSDC_PAD_CTL0 REG_ADDR(MSDC_PAD_CTL0) ++#define MSDC_PAD_CTL1 REG_ADDR(MSDC_PAD_CTL1) ++#define MSDC_PAD_CTL2 REG_ADDR(MSDC_PAD_CTL2) ++ ++/* data read delay */ ++#define MSDC_DAT_RDDLY0 REG_ADDR(MSDC_DAT_RDDLY0) ++#define MSDC_DAT_RDDLY1 REG_ADDR(MSDC_DAT_RDDLY1) ++ ++/* debug register */ ++#define MSDC_DBG_SEL REG_ADDR(MSDC_DBG_SEL) ++#define MSDC_DBG_OUT REG_ADDR(MSDC_DBG_OUT) ++ ++/* misc register */ ++#define MSDC_PATCH_BIT REG_ADDR(MSDC_PATCH_BIT) ++#define MSDC_PATCH_BIT1 REG_ADDR(MSDC_PATCH_BIT1) ++#define MSDC_PAD_TUNE REG_ADDR(MSDC_PAD_TUNE) ++#define MSDC_HW_DBG REG_ADDR(MSDC_HW_DBG) ++#define MSDC_VERSION REG_ADDR(MSDC_VERSION) ++#define MSDC_ECO_VER REG_ADDR(MSDC_ECO_VER) /* ECO Version */ ++ ++/*--------------------------------------------------------------------------*/ ++/* Register Mask */ ++/*--------------------------------------------------------------------------*/ ++ ++/* MSDC_CFG mask */ ++#define MSDC_CFG_MODE (0x1 << 0) /* RW */ ++#define MSDC_CFG_CKPDN (0x1 << 1) /* RW */ ++#define MSDC_CFG_RST (0x1 << 2) /* RW */ ++#define MSDC_CFG_PIO (0x1 << 3) /* RW */ ++#define MSDC_CFG_CKDRVEN (0x1 << 4) /* RW */ ++#define MSDC_CFG_BV18SDT (0x1 << 5) /* RW */ ++#define MSDC_CFG_BV18PSS (0x1 << 6) /* R */ ++#define MSDC_CFG_CKSTB (0x1 << 7) /* R */ ++#define MSDC_CFG_CKDIV (0xff << 8) /* RW */ ++#define MSDC_CFG_CKMOD (0x3 << 16) /* RW */ ++ ++/* MSDC_IOCON mask */ ++#define MSDC_IOCON_SDR104CKS (0x1 << 0) /* RW */ ++#define MSDC_IOCON_RSPL (0x1 << 1) /* RW */ ++#define MSDC_IOCON_DSPL (0x1 << 2) /* RW */ ++#define MSDC_IOCON_DDLSEL (0x1 << 3) /* RW */ ++#define MSDC_IOCON_DDR50CKD (0x1 << 4) /* RW */ ++#define MSDC_IOCON_DSPLSEL (0x1 << 5) /* RW */ ++#define MSDC_IOCON_D0SPL (0x1 << 16) /* RW */ ++#define MSDC_IOCON_D1SPL (0x1 << 17) /* RW */ ++#define MSDC_IOCON_D2SPL (0x1 << 18) /* RW */ ++#define MSDC_IOCON_D3SPL (0x1 << 19) /* RW */ ++#define MSDC_IOCON_D4SPL (0x1 << 20) /* RW */ ++#define MSDC_IOCON_D5SPL (0x1 << 21) /* RW */ ++#define MSDC_IOCON_D6SPL (0x1 << 22) /* RW */ ++#define MSDC_IOCON_D7SPL (0x1 << 23) /* RW */ ++#define MSDC_IOCON_RISCSZ (0x3 << 24) /* RW */ ++ ++/* MSDC_PS mask */ ++#define MSDC_PS_CDEN (0x1 << 0) /* RW */ ++#define MSDC_PS_CDSTS (0x1 << 1) /* R */ ++#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 */ ++ ++/* MSDC_INT mask */ ++#define MSDC_INT_MMCIRQ (0x1 << 0) /* W1C */ ++#define MSDC_INT_CDSC (0x1 << 1) /* W1C */ ++#define MSDC_INT_ACMDRDY (0x1 << 3) /* W1C */ ++#define MSDC_INT_ACMDTMO (0x1 << 4) /* W1C */ ++#define MSDC_INT_ACMDCRCERR (0x1 << 5) /* W1C */ ++#define MSDC_INT_DMAQ_EMPTY (0x1 << 6) /* W1C */ ++#define MSDC_INT_SDIOIRQ (0x1 << 7) /* W1C */ ++#define MSDC_INT_CMDRDY (0x1 << 8) /* W1C */ ++#define MSDC_INT_CMDTMO (0x1 << 9) /* W1C */ ++#define MSDC_INT_RSPCRCERR (0x1 << 10) /* W1C */ ++#define MSDC_INT_CSTA (0x1 << 11) /* R */ ++#define MSDC_INT_XFER_COMPL (0x1 << 12) /* W1C */ ++#define MSDC_INT_DXFER_DONE (0x1 << 13) /* W1C */ ++#define MSDC_INT_DATTMO (0x1 << 14) /* W1C */ ++#define MSDC_INT_DATCRCERR (0x1 << 15) /* W1C */ ++#define MSDC_INT_ACMD19_DONE (0x1 << 16) /* W1C */ ++ ++/* MSDC_INTEN mask */ ++#define MSDC_INTEN_MMCIRQ (0x1 << 0) /* RW */ ++#define MSDC_INTEN_CDSC (0x1 << 1) /* RW */ ++#define MSDC_INTEN_ACMDRDY (0x1 << 3) /* RW */ ++#define MSDC_INTEN_ACMDTMO (0x1 << 4) /* RW */ ++#define MSDC_INTEN_ACMDCRCERR (0x1 << 5) /* RW */ ++#define MSDC_INTEN_DMAQ_EMPTY (0x1 << 6) /* RW */ ++#define MSDC_INTEN_SDIOIRQ (0x1 << 7) /* RW */ ++#define MSDC_INTEN_CMDRDY (0x1 << 8) /* RW */ ++#define MSDC_INTEN_CMDTMO (0x1 << 9) /* RW */ ++#define MSDC_INTEN_RSPCRCERR (0x1 << 10) /* RW */ ++#define MSDC_INTEN_CSTA (0x1 << 11) /* RW */ ++#define MSDC_INTEN_XFER_COMPL (0x1 << 12) /* RW */ ++#define MSDC_INTEN_DXFER_DONE (0x1 << 13) /* RW */ ++#define MSDC_INTEN_DATTMO (0x1 << 14) /* RW */ ++#define MSDC_INTEN_DATCRCERR (0x1 << 15) /* RW */ ++#define MSDC_INTEN_ACMD19_DONE (0x1 << 16) /* RW */ ++ ++/* MSDC_FIFOCS mask */ ++#define MSDC_FIFOCS_RXCNT (0xff << 0) /* R */ ++#define MSDC_FIFOCS_TXCNT (0xff << 16) /* R */ ++#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_INTATGAP (0x1 << 21) /* RW */ ++#define SDC_CFG_DTOC (0xffUL << 24) /* RW */ ++ ++/* SDC_CMD mask */ ++#define SDC_CMD_OPC (0x3f << 0) /* RW */ ++#define SDC_CMD_BRK (0x1 << 6) /* RW */ ++#define SDC_CMD_RSPTYP (0x7 << 7) /* RW */ ++#define SDC_CMD_DTYP (0x3 << 11) /* RW */ ++#define SDC_CMD_DTYP (0x3 << 11) /* RW */ ++#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_AUTOCMD (0x3 << 28) /* RW */ ++#define SDC_CMD_VOLSWTH (0x1 << 30) /* RW */ ++ ++/* SDC_STS mask */ ++#define SDC_STS_SDCBUSY (0x1 << 0) /* RW */ ++#define SDC_STS_CMDBUSY (0x1 << 1) /* RW */ ++#define SDC_STS_SWR_COMPL (0x1 << 31) /* RW */ ++ ++/* SDC_DCRC_STS mask */ ++#define SDC_DCRC_STS_NEG (0xf << 8) /* RO */ ++#define SDC_DCRC_STS_POS (0xff << 0) /* RO */ ++ ++/* EMMC_CFG0 mask */ ++#define EMMC_CFG0_BOOTSTART (0x1 << 0) /* W */ ++#define EMMC_CFG0_BOOTSTOP (0x1 << 1) /* W */ ++#define EMMC_CFG0_BOOTMODE (0x1 << 2) /* RW */ ++#define EMMC_CFG0_BOOTACKDIS (0x1 << 3) /* RW */ ++#define EMMC_CFG0_BOOTWDLY (0x7 << 12) /* RW */ ++#define EMMC_CFG0_BOOTSUPP (0x1 << 15) /* RW */ ++ ++/* EMMC_CFG1 mask */ ++#define EMMC_CFG1_BOOTDATTMC (0xfffff << 0) /* RW */ ++#define EMMC_CFG1_BOOTACKTMC (0xfffUL << 20) /* RW */ ++ ++/* EMMC_STS mask */ ++#define EMMC_STS_BOOTCRCERR (0x1 << 0) /* W1C */ ++#define EMMC_STS_BOOTACKERR (0x1 << 1) /* W1C */ ++#define EMMC_STS_BOOTDATTMO (0x1 << 2) /* W1C */ ++#define EMMC_STS_BOOTACKTMO (0x1 << 3) /* W1C */ ++#define EMMC_STS_BOOTUPSTATE (0x1 << 4) /* R */ ++#define EMMC_STS_BOOTACKRCV (0x1 << 5) /* W1C */ ++#define EMMC_STS_BOOTDATRCV (0x1 << 6) /* R */ ++ ++/* EMMC_IOCON mask */ ++#define EMMC_IOCON_BOOTRST (0x1 << 0) /* RW */ ++ ++/* SDC_ACMD19_TRG mask */ ++#define SDC_ACMD19_TRG_TUNESEL (0xf << 0) /* RW */ ++ ++/* MSDC_DMA_CTRL mask */ ++#define MSDC_DMA_CTRL_START (0x1 << 0) /* W */ ++#define MSDC_DMA_CTRL_STOP (0x1 << 1) /* W */ ++#define MSDC_DMA_CTRL_RESUME (0x1 << 2) /* W */ ++#define MSDC_DMA_CTRL_MODE (0x1 << 8) /* RW */ ++#define MSDC_DMA_CTRL_LASTBUF (0x1 << 10) /* RW */ ++#define MSDC_DMA_CTRL_BRUSTSZ (0x7 << 12) /* RW */ ++#define MSDC_DMA_CTRL_XFERSZ (0xffffUL << 16)/* RW */ ++ ++/* MSDC_DMA_CFG mask */ ++#define MSDC_DMA_CFG_STS (0x1 << 0) /* R */ ++#define MSDC_DMA_CFG_DECSEN (0x1 << 1) /* RW */ ++#define MSDC_DMA_CFG_BDCSERR (0x1 << 4) /* R */ ++#define MSDC_DMA_CFG_GPDCSERR (0x1 << 5) /* R */ ++ ++/* MSDC_PATCH_BIT mask */ ++#define MSDC_PATCH_BIT_WFLSMODE (0x1 << 0) /* RW */ ++#define MSDC_PATCH_BIT_ODDSUPP (0x1 << 1) /* RW */ ++#define MSDC_PATCH_BIT_CKGEN_CK (0x1 << 6) /* E2: Fixed to 1 */ ++#define MSDC_PATCH_BIT_IODSSEL (0x1 << 16) /* RW */ ++#define MSDC_PATCH_BIT_IOINTSEL (0x1 << 17) /* RW */ ++#define MSDC_PATCH_BIT_BUSYDLY (0xf << 18) /* RW */ ++#define MSDC_PATCH_BIT_WDOD (0xf << 22) /* RW */ ++#define MSDC_PATCH_BIT_IDRTSEL (0x1 << 26) /* RW */ ++#define MSDC_PATCH_BIT_CMDFSEL (0x1 << 27) /* RW */ ++#define MSDC_PATCH_BIT_INTDLSEL (0x1 << 28) /* RW */ ++#define MSDC_PATCH_BIT_SPCPUSH (0x1 << 29) /* RW */ ++#define MSDC_PATCH_BIT_DECRCTMO (0x1 << 30) /* RW */ ++ ++/* MSDC_PATCH_BIT1 mask */ ++#define MSDC_PATCH_BIT1_WRDAT_CRCS (0x7 << 3) ++#define MSDC_PATCH_BIT1_CMD_RSP (0x7 << 0) ++ ++/* MSDC_PAD_CTL0 mask */ ++#define MSDC_PAD_CTL0_CLKDRVN (0x7 << 0) /* RW */ ++#define MSDC_PAD_CTL0_CLKDRVP (0x7 << 4) /* RW */ ++#define MSDC_PAD_CTL0_CLKSR (0x1 << 8) /* RW */ ++#define MSDC_PAD_CTL0_CLKPD (0x1 << 16) /* RW */ ++#define MSDC_PAD_CTL0_CLKPU (0x1 << 17) /* RW */ ++#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 */ ++ ++/* MSDC_PAD_CTL1 mask */ ++#define MSDC_PAD_CTL1_CMDDRVN (0x7 << 0) /* RW */ ++#define MSDC_PAD_CTL1_CMDDRVP (0x7 << 4) /* RW */ ++#define MSDC_PAD_CTL1_CMDSR (0x1 << 8) /* RW */ ++#define MSDC_PAD_CTL1_CMDPD (0x1 << 16) /* RW */ ++#define MSDC_PAD_CTL1_CMDPU (0x1 << 17) /* RW */ ++#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 */ ++ ++/* MSDC_PAD_CTL2 mask */ ++#define MSDC_PAD_CTL2_DATDRVN (0x7 << 0) /* RW */ ++#define MSDC_PAD_CTL2_DATDRVP (0x7 << 4) /* RW */ ++#define MSDC_PAD_CTL2_DATSR (0x1 << 8) /* RW */ ++#define MSDC_PAD_CTL2_DATPD (0x1 << 16) /* RW */ ++#define MSDC_PAD_CTL2_DATPU (0x1 << 17) /* RW */ ++#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 */ ++ ++/* MSDC_PAD_TUNE mask */ ++#define MSDC_PAD_TUNE_DATWRDLY (0x1F << 0) /* RW */ ++#define MSDC_PAD_TUNE_DATRRDLY (0x1F << 8) /* RW */ ++#define MSDC_PAD_TUNE_CMDRDLY (0x1F << 16) /* RW */ ++#define MSDC_PAD_TUNE_CMDRRDLY (0x1FUL << 22) /* RW */ ++#define MSDC_PAD_TUNE_CLKTXDLY (0x1FUL << 27) /* RW */ ++ ++/* MSDC_DAT_RDDLY0/1 mask */ ++#define MSDC_DAT_RDDLY0_D0 (0x1F << 0) /* RW */ ++#define MSDC_DAT_RDDLY0_D1 (0x1F << 8) /* RW */ ++#define MSDC_DAT_RDDLY0_D2 (0x1F << 16) /* RW */ ++#define MSDC_DAT_RDDLY0_D3 (0x1F << 24) /* RW */ ++ ++#define MSDC_DAT_RDDLY1_D4 (0x1F << 0) /* RW */ ++#define MSDC_DAT_RDDLY1_D5 (0x1F << 8) /* RW */ ++#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) ++ ++/*--------------------------------------------------------------------------*/ ++/* 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; ++ ++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; ++ ++/*--------------------------------------------------------------------------*/ ++/* 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_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 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 */ ++ ++ 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 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; ++ ++ 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 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 */ ++ ++ u32 timeout_ns; /* data timeout ns */ ++ u32 timeout_clks; /* data timeout clks */ ++ ++ atomic_t abort; /* abort transfer */ ++ ++ int irq; /* host interrupt */ ++ ++ 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; ++ ++ 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; ++}; ++ ++static inline unsigned int uffs(unsigned int x) ++{ ++ unsigned int r = 1; ++ ++ 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; ++} ++#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))) ++ ++#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) ++ ++#endif ++ +--- /dev/null ++++ b/drivers/mmc/host/mtk-mmc/sd.c +@@ -0,0 +1,3067 @@ ++/* Copyright Statement: ++ * ++ * This software/firmware and related documentation ("MediaTek Software") are ++ * protected under relevant copyright laws. The information contained herein ++ * is confidential and proprietary to MediaTek Inc. and/or its licensors. ++ * Without the prior written permission of MediaTek inc. and/or its licensors, ++ * any reproduction, modification, use or disclosure of MediaTek Software, ++ * and information contained herein, in whole or in part, shall be strictly prohibited. ++ * ++ * MediaTek Inc. (C) 2010. All rights reserved. ++ * ++ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES ++ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") ++ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON ++ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. ++ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ++ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR ++ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH ++ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES ++ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES ++ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK ++ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR ++ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND ++ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, ++ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, ++ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO ++ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. ++ * ++ * The following software/firmware and/or related documentation ("MediaTek Software") ++ * have been modified by MediaTek Inc. All revisions are subject to any receiver's ++ * applicable license agreements with MediaTek Inc. ++ */ ++ ++#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 ++ ++#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) ++ ++//#define IRQ_SDC 14 //MT7620 /*FIXME*/ ++#ifdef CONFIG_SOC_MT7621 ++#define RALINK_SYSCTL_BASE 0xbe000000 ++#define RALINK_MSDC_BASE 0xbe130000 ++#else ++#define RALINK_SYSCTL_BASE 0xb0000000 ++#define RALINK_MSDC_BASE 0xb0130000 ++#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) ++#define HOST_MAX_MCLK (48000000) /* +/- by chhung */ ++#elif defined (CONFIG_SOC_MT7621) ++#define HOST_MAX_MCLK (50000000) /* +/- by chhung */ ++#endif ++#define HOST_MIN_MCLK (260000) ++ ++#define HOST_MAX_BLKSZ (2048) ++ ++#define MSDC_OCR_AVAIL (MMC_VDD_28_29 | MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33) ++ ++#define GPIO_PULL_DOWN (0) ++#define GPIO_PULL_UP (1) ++ ++#if 0 /* --- by chhung */ ++#define MSDC_CLKSRC_REG (0xf100000C) ++#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 MAX_DMA_CNT (64 * 1024 - 512) /* a single transaction for WIFI may be 50K*/ ++ ++#define MAX_GPD_NUM (1 + 1) /* one null gpd */ ++#define MAX_BD_NUM (1024) ++#define MAX_BD_PER_GPD (MAX_BD_NUM) ++ ++#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) ++ ++#ifdef MT6575_SD_DEBUG ++static struct msdc_regs *msdc_reg[HOST_MAX_NUM]; ++#endif ++ ++static int mtk_sw_poll; ++ ++static int cd_active_low = 1; ++ ++//================================= ++#define PERI_MSDC0_PDN (15) ++//#define PERI_MSDC1_PDN (16) ++//#define PERI_MSDC2_PDN (17) ++//#define PERI_MSDC3_PDN (18) ++ ++struct msdc_host *msdc_6575_host[] = {NULL,NULL,NULL,NULL}; ++#if 0 /* --- by chhung */ ++/* gate means clock power down */ ++static int g_clk_gate = 0; ++#define msdc_gate_clock(id) \ ++ 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 we need sync object or not ++void msdc_clk_status(int * status) ++{ ++ *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, ++}; ++ ++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 */ ++}; ++ ++/* 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_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) ++ ++#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 +/- */ ++ ++#define msdc_clr_int() \ ++ 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) ++ ++#define msdc_irq_save(val) \ ++ 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) ++ ++/* clock source for host: global */ ++#if defined (CONFIG_SOC_MT7620) ++static u32 hclks[] = {48000000}; /* +/- by chhung */ ++#elif defined (CONFIG_SOC_MT7621) ++static u32 hclks[] = {50000000}; /* +/- by chhung */ ++#endif ++ ++//============================================ ++// the power for msdc host controller: global ++// 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) ++#define msdc_vcore_off(host) \ ++ 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. ++//==================================== ++#define msdc_vdd_on(host) \ ++ 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) ++ ++#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) ++ ++// 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) ++ ++/* +++ by chhung */ ++#ifndef __ASSEMBLY__ ++#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff) ++#else ++#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); ++ ++#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)]); ++} ++ ++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)"); ++} ++ ++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); ++} ++ ++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"); ++ ++ 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; ++ ++ 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; ++ ++ 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); ++} ++ ++/* 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; ++ //u32 change = 0; ++ ++ 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) ++ inserted = (status & MSDC_PS_CDSTS) ? 0 : 1; ++ else ++ 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)); ++ } ++#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"); ++#endif ++ ++ spin_unlock(&host->lock); ++} ++ ++#if 0 /* --- by chhung */ ++/* For E2 only */ ++static u8 clk_src_bit[4] = { ++ 0, 3, 5, 7 ++}; ++ ++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); ++ ++ 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; ++ ++ if (!hz) { // set mmc system clock to 0 ? ++ //ERR_MSG("set mclk to 0!!!"); ++ msdc_reset(); ++ 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)); ++ ++ 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; ++ ++ ERR_MSG("Need to Abort. dma<%d>", host->dma_xfer); ++ ++ msdc_reset(); ++ 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; ++ ++ /* 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); ++} ++ ++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; ++ ++ /* 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); ++ } ++ } ++} ++ ++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); ++ ++ 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"); ++ ++ 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"); ++ ++ 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); ++ } ++} ++ ++static void msdc_set_power_mode(struct msdc_host *host, u8 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; ++} ++#endif /* end of --- */ ++ ++#ifdef CONFIG_PM ++/* ++ 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; ++ ++ 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; ++ ++ /* 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; ++ } ++ ++ /* 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); ++ } ++ } ++} ++#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) ++{ ++ 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; ++ ++ /* 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; ++ } ++ } ++ ++ 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); ++ } ++ ++ N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode , rawcmd, cmd->arg); ++ ++ 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 = (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); ++ ++ 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) ++{ ++ 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; ++ ++ 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); ++ ++ 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; ++ } ++#endif ++ ++ /* do we need to save card's RCA when SD_SEND_RELATIVE_ADDR */ ++ ++ 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); ++ } ++ ++ // check DAT0 ++ /* if (resp == RESP_R1B) { ++ while ((sdr_read32(MSDC_PS) & 0x10000) != 0x10000); ++ } */ ++ /* CMD12 Error Handle */ ++ ++ return cmd->error; ++} ++ ++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; ++} ++ ++/* ++ 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) ++{ ++ 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--; ++ } ++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; ++} ++ ++#if 0 /* --- by chhung */ ++// DMA resume / start / stop ++static void msdc_dma_resume(struct msdc_host *host) ++{ ++ u32 base = host->base; ++ ++ sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_RESUME, 1); ++ ++ 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); ++ ++ 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); ++ ++ sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); ++ while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); ++ ++ //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; ++} ++ ++/* gpd bd setup + dma registers */ ++static int 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; ++ ++ 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); ++//#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)); ++//#elif defined (CONFIG_RALINK_MT7621) || defined (CONFIG_RALINK_MT7628) ++ else ++ sdr_write32((volatile u32*)(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; ++ ++ /* 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; ++ ++ /* 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; ++ ++ 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); ++ ++ sdr_write32(MSDC_DMA_SA, PHYSADDR((u32)dma->gpd_addr)); ++ break; ++ ++ 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)); ++ ++ return 0; ++} ++ ++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 */ ++ ++ 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; ++ ++ N_MSG(DMA, "DMA mode<%d> sglen<%d> xfersz<%d>", dma->mode, dma->sglen, dma->xfersz); ++ ++ 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) ++{ ++ u32 base = host->base; ++ ++ sdr_write32(SDC_BLK_NUM, blknum); ++} ++ ++static int msdc_do_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; ++ //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 ++ ++ BUG_ON(mmc == NULL); ++ BUG_ON(mrq == NULL); ++ ++ 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); ++ //} ++#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; ++ ++ /* 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); ++ } ++ ++ 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 (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; ++ ++ 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; ++ ++ /* 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; ++ } ++ } ++ ++ /* 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 */ ++ } ++ ++ /* 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; ++ } ++ } ++ } ++ ++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 ++ ++ 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); ++ } ++ } ++ //} ++#else ++ 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); ++ ++ 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; ++ ++ 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; ++ ++ err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT); ++ return err; ++} ++ ++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] ++ ==========================*/ ++ ++ // 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); ++ ++ 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); ++ ++ 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; ++ } ++ ++ /* 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; ++ ++ sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl); ++ ++ /* Tune Method 2. */ ++ sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); ++ ++ 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); ++ ++ 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); ++ ++ /* 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; ++ } ++ } ++ } ++ ++ cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); ++ cur_rxdly1 = sdr_read32(MSDC_DAT_RDDLY1); ++ ++ /* 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); ++ ++done: ++ return result; ++} ++ ++static int msdc_tune_bwrite(struct mmc_host *mmc,struct mmc_request *mrq) ++{ ++ struct msdc_host *host = mmc_priv(mmc); ++ u32 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; ++ ++ // 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 ); ++ ++ /* 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 != (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); ++ ++done: ++ 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; ++ ++ 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; ++ ++ 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; ++} ++ ++/* 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; ++ ++ 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); ++ } ++ ++ return ret; ++} ++ ++/* ops.request */ ++static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) ++{ ++ struct msdc_host *host = mmc_priv(mmc); ++ ++ //=== 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; ++#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); ++#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); ++ } ++ } ++#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); ++ } ++ } ++ ++ /* ==== 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); ++ } ++ } ++ } ++#endif /* end of --- */ ++ 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); ++ ++ 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; ++ ++#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" ++ }; ++ ++ 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; ++ } ++ ++ /* 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); ++ } ++} ++ ++/* 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; ++ ++ 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; ++ ++ /* 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; ++#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; ++#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*/ ++#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; ++ 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); ++ } ++} ++ ++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, ++}; ++ ++/*--------------------------------------------------------------------------*/ ++/* interrupt handler */ ++/*--------------------------------------------------------------------------*/ ++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; ++ ++ u32 intsts = sdr_read32(MSDC_INT); ++ u32 inten = sdr_read32(MSDC_INTEN); inten &= intsts; ++ ++ 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); ++ } ++ ++ /* 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 */ ++ } ++ } ++ ++ /* 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); ++ } ++ ++ /* 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); ++ ++ } ++#endif ++ ++ return IRQ_HANDLED; ++} ++ ++/*--------------------------------------------------------------------------*/ ++/* platform_driver members */ ++/*--------------------------------------------------------------------------*/ ++/* called by msdc_drv_probe/remove */ ++static void msdc_enable_cd_irq(struct msdc_host *host, int enable) ++{ ++ struct msdc_hw *hw = host->hw; ++ u32 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); ++ */ ++ sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); ++ sdr_clr_bits(MSDC_INTEN, MSDC_INTEN_CDSC); ++ sdr_clr_bits(SDC_CFG, SDC_CFG_INSWKUP); ++ return; ++ } ++ ++ 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() ++ ++ 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_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); ++ } ++ } ++} ++ ++/* called by msdc_drv_probe */ ++static void msdc_init_hw(struct msdc_host *host) ++{ ++ u32 base = host->base; ++ struct msdc_hw *hw = host->hw; ++ ++#ifdef MT6575_SD_DEBUG ++ msdc_reg[host->id] = (struct msdc_regs *)host->base; ++#endif ++ ++ /* 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); ++#endif /* end of --- */ ++ /* Configure to MMC/SD mode */ ++ sdr_set_field(MSDC_CFG, MSDC_CFG_MODE, MSDC_SDMMC); ++ ++ /* Reset */ ++ msdc_reset(); ++ 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)); ++ ++#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); ++#if 0 // use MT7620 default value: 0x403c004f ++ 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 ++ ++ /* 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); ++ ++ /* 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); ++#endif ++ ++ /* set sampling edge */ ++ ++ /* 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); ++ ++ msdc_set_buswidth(host, MMC_BUS_WIDTH_1); ++ ++ N_MSG(FUC, "init hardware done!"); ++} ++ ++/* called by msdc_drv_remove */ ++static void msdc_deinit_hw(struct msdc_host *host) ++{ ++ u32 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 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; ++ ++ /* 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)); ++ ++ //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; ++ } ++} ++ ++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; ++ ++ 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); ++ ++ //BUG_ON((!hw) || (!mem) || (irq < 0)); /* --- by chhung */ ++ ++ base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ /* 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 */ ++ ++ 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"); ++ ++ if (mtk_sw_poll) ++ mmc->caps |= MMC_CAP_NEEDS_POLL; ++ ++ /* 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; ++ ++ host = mmc_priv(mmc); ++ host->hw = hw; ++ host->mmc = mmc; ++ host->id = pdev->id; ++ 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; ++// 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; ++ ++ /* 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); ++ /*for emmc*/ ++ msdc_6575_host[pdev->id] = host; ++ ++#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); ++ ++ 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); ++ ++ 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! */ ++ } ++ } ++ ++ 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 */ ++ ++ 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); ++ ++ ret = mmc_add_host(mmc); ++ if (ret) goto free_irq; ++ ++ /* 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); ++ ++#if 0 ++ tasklet_kill(&host->card_tasklet); ++#else ++ cancel_delayed_work_sync(&host->card_delaywork); ++#endif ++ ++ if (mem) ++ release_mem_region(mem->start, mem->end - mem->start + 1); ++ ++ mmc_free_host(mmc); ++ ++ 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; ++ ++ mmc = platform_get_drvdata(pdev); ++ BUG_ON(!mmc); ++ ++ host = mmc_priv(mmc); ++ BUG_ON(!host); ++ ++ ERR_MSG("removed !!!"); ++ ++ platform_set_drvdata(pdev, NULL); ++ mmc_remove_host(host->mmc); ++ msdc_deinit_hw(host); ++ ++#if 0 ++ tasklet_kill(&host->card_tasklet); ++#else ++ cancel_delayed_work_sync(&host->card_delaywork); ++#endif ++ free_irq(host->irq, 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); ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ ++ if (mem) ++ release_mem_region(mem->start, mem->end - mem->start + 1); ++ ++ mmc_free_host(host->mmc); ++ ++ return 0; ++} ++ ++/* Fix me: Power Flow */ ++#ifdef CONFIG_PM ++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; ++} ++ ++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; ++ ++ 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; ++} ++#endif ++ ++static const struct of_device_id mt7620_sdhci_match[] = { ++ { .compatible = "ralink,mt7620-sdhci" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rt288x_wdt_match); ++ ++static struct platform_driver mt_msdc_driver = { ++ .probe = msdc_drv_probe, ++ .remove = msdc_drv_remove, ++#ifdef CONFIG_PM ++ .suspend = msdc_drv_suspend, ++ .resume = msdc_drv_resume, ++#endif ++ .driver = { ++ .name = DRV_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = mt7620_sdhci_match, ++ }, ++}; ++ ++/*--------------------------------------------------------------------------*/ ++/* module init/exit */ ++/*--------------------------------------------------------------------------*/ ++static int __init mt_msdc_init(void) ++{ ++ int ret; ++/* +++ by chhung */ ++ u32 reg; ++ ++#if defined (CONFIG_MTD_ANY_RALINK) ++ extern int ra_check_flash_type(void); ++ if(ra_check_flash_type() == 2) { /* NAND */ ++ printk("%s: !!!!! SDXC Module Initialize Fail !!!!!", __func__); ++ return 0; ++ } ++#endif ++ 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)); ++ 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((volatile u32*)(RALINK_SYSCTL_BASE + 0x60), reg); ++ //platform_device_register(&mtk_sd_device); ++/* end of +++ */ ++ ++ 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"); ++ ++#if defined (MT6575_SD_DEBUG) ++ msdc_debug_proc_init(); ++#endif ++ return 0; ++} ++ ++static void __exit mt_msdc_exit(void) ++{ ++// platform_device_unregister(&mtk_sd_device); ++ 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 "); ++ ++EXPORT_SYMBOL(msdc_6575_host); diff --git a/target/linux/ramips/patches-4.4/0047-DMA-ralink-add-rt2880-dma-engine.patch b/target/linux/ramips/patches-4.4/0047-DMA-ralink-add-rt2880-dma-engine.patch new file mode 100644 index 0000000000..d100a082e7 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0047-DMA-ralink-add-rt2880-dma-engine.patch @@ -0,0 +1,1756 @@ +From f1c4d9e622c800e1f38b3818f933ec7597d1ccfb Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:29:51 +0100 +Subject: [PATCH 47/53] DMA: ralink: add rt2880 dma engine + +Signed-off-by: John Crispin +--- + drivers/dma/Kconfig | 6 + + drivers/dma/Makefile | 1 + + drivers/dma/ralink-gdma.c | 577 +++++++++++++++++++++++++++++++++++++++++++++ + include/linux/dmaengine.h | 1 + + 4 files changed, 585 insertions(+) + create mode 100644 drivers/dma/ralink-gdma.c + +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -40,6 +40,18 @@ config ASYNC_TX_ENABLE_CHANNEL_SWITCH + config ARCH_HAS_ASYNC_TX_FIND_CHANNEL + bool + ++config DMA_RALINK ++ tristate "RALINK DMA support" ++ depends on RALINK && !SOC_RT288X ++ select DMA_ENGINE ++ select DMA_VIRTUAL_CHANNELS ++ ++config MTK_HSDMA ++ tristate "MTK HSDMA support" ++ depends on RALINK && SOC_MT7621 ++ select DMA_ENGINE ++ select DMA_VIRTUAL_CHANNELS ++ + config DMA_ENGINE + bool + +--- a/drivers/dma/Makefile ++++ b/drivers/dma/Makefile +@@ -65,5 +65,7 @@ obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma- + obj-$(CONFIG_TI_EDMA) += edma.o + obj-$(CONFIG_XGENE_DMA) += xgene-dma.o + obj-$(CONFIG_ZX_DMA) += zx296702_dma.o ++obj-$(CONFIG_DMA_RALINK) += ralink-gdma.o ++obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o + + obj-y += xilinx/ +--- /dev/null ++++ b/drivers/dma/ralink-gdma.c +@@ -0,0 +1,928 @@ ++/* ++ * Copyright (C) 2013, Lars-Peter Clausen ++ * GDMA4740 DMAC support ++ * ++ * 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 "virt-dma.h" ++ ++#define GDMA_REG_SRC_ADDR(x) (0x00 + (x) * 0x10) ++#define GDMA_REG_DST_ADDR(x) (0x04 + (x) * 0x10) ++ ++#define GDMA_REG_CTRL0(x) (0x08 + (x) * 0x10) ++#define GDMA_REG_CTRL0_TX_MASK 0xffff ++#define GDMA_REG_CTRL0_TX_SHIFT 16 ++#define GDMA_REG_CTRL0_CURR_MASK 0xff ++#define GDMA_REG_CTRL0_CURR_SHIFT 8 ++#define GDMA_REG_CTRL0_SRC_ADDR_FIXED BIT(7) ++#define GDMA_REG_CTRL0_DST_ADDR_FIXED BIT(6) ++#define GDMA_REG_CTRL0_BURST_MASK 0x7 ++#define GDMA_REG_CTRL0_BURST_SHIFT 3 ++#define GDMA_REG_CTRL0_DONE_INT BIT(2) ++#define GDMA_REG_CTRL0_ENABLE BIT(1) ++#define GDMA_REG_CTRL0_SW_MODE BIT(0) ++ ++#define GDMA_REG_CTRL1(x) (0x0c + (x) * 0x10) ++#define GDMA_REG_CTRL1_SEG_MASK 0xf ++#define GDMA_REG_CTRL1_SEG_SHIFT 22 ++#define GDMA_REG_CTRL1_REQ_MASK 0x3f ++#define GDMA_REG_CTRL1_SRC_REQ_SHIFT 16 ++#define GDMA_REG_CTRL1_DST_REQ_SHIFT 8 ++#define GDMA_REG_CTRL1_CONTINOUS BIT(14) ++#define GDMA_REG_CTRL1_NEXT_MASK 0x1f ++#define GDMA_REG_CTRL1_NEXT_SHIFT 3 ++#define GDMA_REG_CTRL1_COHERENT BIT(2) ++#define GDMA_REG_CTRL1_FAIL BIT(1) ++#define GDMA_REG_CTRL1_MASK BIT(0) ++ ++#define GDMA_REG_UNMASK_INT 0x200 ++#define GDMA_REG_DONE_INT 0x204 ++ ++#define GDMA_REG_GCT 0x220 ++#define GDMA_REG_GCT_CHAN_MASK 0x3 ++#define GDMA_REG_GCT_CHAN_SHIFT 3 ++#define GDMA_REG_GCT_VER_MASK 0x3 ++#define GDMA_REG_GCT_VER_SHIFT 1 ++#define GDMA_REG_GCT_ARBIT_RR BIT(0) ++ ++#define GDMA_REG_REQSTS 0x2a0 ++#define GDMA_REG_ACKSTS 0x2a4 ++#define GDMA_REG_FINSTS 0x2a8 ++ ++/* for RT305X gdma registers */ ++#define GDMA_RT305X_CTRL0_REQ_MASK 0xf ++#define GDMA_RT305X_CTRL0_SRC_REQ_SHIFT 12 ++#define GDMA_RT305X_CTRL0_DST_REQ_SHIFT 8 ++ ++#define GDMA_RT305X_CTRL1_FAIL BIT(4) ++#define GDMA_RT305X_CTRL1_NEXT_MASK 0x7 ++#define GDMA_RT305X_CTRL1_NEXT_SHIFT 1 ++ ++#define GDMA_RT305X_STATUS_INT 0x80 ++#define GDMA_RT305X_STATUS_SIGNAL 0x84 ++#define GDMA_RT305X_GCT 0x88 ++ ++/* for MT7621 gdma registers */ ++#define GDMA_REG_PERF_START(x) (0x230 + (x) * 0x8) ++#define GDMA_REG_PERF_END(x) (0x234 + (x) * 0x8) ++ ++enum gdma_dma_transfer_size { ++ GDMA_TRANSFER_SIZE_4BYTE = 0, ++ GDMA_TRANSFER_SIZE_8BYTE = 1, ++ GDMA_TRANSFER_SIZE_16BYTE = 2, ++ GDMA_TRANSFER_SIZE_32BYTE = 3, ++ GDMA_TRANSFER_SIZE_64BYTE = 4, ++}; ++ ++struct gdma_dma_sg { ++ dma_addr_t src_addr; ++ dma_addr_t dst_addr; ++ u32 len; ++}; ++ ++struct gdma_dma_desc { ++ struct virt_dma_desc vdesc; ++ ++ enum dma_transfer_direction direction; ++ bool cyclic; ++ ++ u32 residue; ++ unsigned int num_sgs; ++ struct gdma_dma_sg sg[]; ++}; ++ ++struct gdma_dmaengine_chan { ++ struct virt_dma_chan vchan; ++ unsigned int id; ++ unsigned int slave_id; ++ ++ dma_addr_t fifo_addr; ++ enum gdma_dma_transfer_size burst_size; ++ ++ struct gdma_dma_desc *desc; ++ unsigned int next_sg; ++}; ++ ++struct gdma_dma_dev { ++ struct dma_device ddev; ++ struct device_dma_parameters dma_parms; ++ struct gdma_data *data; ++ void __iomem *base; ++ struct tasklet_struct task; ++ volatile unsigned long chan_issued; ++ atomic_t cnt; ++ ++ struct gdma_dmaengine_chan chan[]; ++}; ++ ++struct gdma_data ++{ ++ int chancnt; ++ u32 done_int_reg; ++ void (*init)(struct gdma_dma_dev *dma_dev); ++ int (*start_transfer)(struct gdma_dmaengine_chan *chan); ++}; ++ ++static struct gdma_dma_dev *gdma_dma_chan_get_dev( ++ struct gdma_dmaengine_chan *chan) ++{ ++ return container_of(chan->vchan.chan.device, struct gdma_dma_dev, ++ ddev); ++} ++ ++static struct gdma_dmaengine_chan *to_gdma_dma_chan(struct dma_chan *c) ++{ ++ return container_of(c, struct gdma_dmaengine_chan, vchan.chan); ++} ++ ++static struct gdma_dma_desc *to_gdma_dma_desc(struct virt_dma_desc *vdesc) ++{ ++ return container_of(vdesc, struct gdma_dma_desc, vdesc); ++} ++ ++static inline uint32_t gdma_dma_read(struct gdma_dma_dev *dma_dev, ++ unsigned int reg) ++{ ++ return readl(dma_dev->base + reg); ++} ++ ++static inline void gdma_dma_write(struct gdma_dma_dev *dma_dev, ++ unsigned reg, uint32_t val) ++{ ++ writel(val, dma_dev->base + reg); ++} ++ ++static struct gdma_dma_desc *gdma_dma_alloc_desc(unsigned int num_sgs) ++{ ++ return kzalloc(sizeof(struct gdma_dma_desc) + ++ sizeof(struct gdma_dma_sg) * num_sgs, GFP_ATOMIC); ++} ++ ++static enum gdma_dma_transfer_size gdma_dma_maxburst(u32 maxburst) ++{ ++ if (maxburst < 2) ++ return GDMA_TRANSFER_SIZE_4BYTE; ++ else if (maxburst < 4) ++ return GDMA_TRANSFER_SIZE_8BYTE; ++ else if (maxburst < 8) ++ return GDMA_TRANSFER_SIZE_16BYTE; ++ else if (maxburst < 16) ++ return GDMA_TRANSFER_SIZE_32BYTE; ++ else ++ return GDMA_TRANSFER_SIZE_64BYTE; ++} ++ ++static int gdma_dma_config(struct dma_chan *c, ++ struct dma_slave_config *config) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); ++ ++ if (config->device_fc) { ++ dev_err(dma_dev->ddev.dev, "not support flow controller\n"); ++ return -EINVAL; ++ } ++ ++ switch (config->direction) { ++ case DMA_MEM_TO_DEV: ++ if (config->dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES) { ++ dev_err(dma_dev->ddev.dev, "only support 4 byte buswidth\n"); ++ return -EINVAL; ++ } ++ chan->slave_id = config->slave_id; ++ chan->fifo_addr = config->dst_addr; ++ chan->burst_size = gdma_dma_maxburst(config->dst_maxburst); ++ break; ++ case DMA_DEV_TO_MEM: ++ if (config->src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES) { ++ dev_err(dma_dev->ddev.dev, "only support 4 byte buswidth\n"); ++ return -EINVAL; ++ } ++ chan->slave_id = config->slave_id; ++ chan->fifo_addr = config->src_addr; ++ chan->burst_size = gdma_dma_maxburst(config->src_maxburst); ++ break; ++ default: ++ dev_err(dma_dev->ddev.dev, "direction type %d error\n", ++ config->direction); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int gdma_dma_terminate_all(struct dma_chan *c) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); ++ unsigned long flags, timeout; ++ LIST_HEAD(head); ++ int i = 0; ++ ++ spin_lock_irqsave(&chan->vchan.lock, flags); ++ chan->desc = NULL; ++ clear_bit(chan->id, &dma_dev->chan_issued); ++ vchan_get_all_descriptors(&chan->vchan, &head); ++ spin_unlock_irqrestore(&chan->vchan.lock, flags); ++ ++ vchan_dma_desc_free_list(&chan->vchan, &head); ++ ++ /* wait dma transfer complete */ ++ timeout = jiffies + msecs_to_jiffies(5000); ++ while (gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id)) & ++ GDMA_REG_CTRL0_ENABLE) { ++ if (time_after_eq(jiffies, timeout)) { ++ dev_err(dma_dev->ddev.dev, "chan %d wait timeout\n", ++ chan->id); ++ /* restore to init value */ ++ gdma_dma_write(dma_dev, GDMA_REG_CTRL0(chan->id), 0); ++ break; ++ } ++ cpu_relax(); ++ i++; ++ } ++ ++ if (i) ++ dev_dbg(dma_dev->ddev.dev, "terminate chan %d loops %d\n", ++ chan->id, i); ++ ++ return 0; ++} ++ ++static void rt305x_dump_reg(struct gdma_dma_dev *dma_dev, int id) ++{ ++ dev_dbg(dma_dev->ddev.dev, "chan %d, src %08x, dst %08x, ctr0 %08x, " \ ++ "ctr1 %08x, intr %08x, signal %08x\n", id, ++ gdma_dma_read(dma_dev, GDMA_REG_SRC_ADDR(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_DST_ADDR(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_CTRL0(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_CTRL1(id)), ++ gdma_dma_read(dma_dev, GDMA_RT305X_STATUS_INT), ++ gdma_dma_read(dma_dev, GDMA_RT305X_STATUS_SIGNAL)); ++} ++ ++static int rt305x_gdma_start_transfer(struct gdma_dmaengine_chan *chan) ++{ ++ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); ++ dma_addr_t src_addr, dst_addr; ++ struct gdma_dma_sg *sg; ++ uint32_t ctrl0, ctrl1; ++ ++ /* verify chan is already stopped */ ++ ctrl0 = gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id)); ++ if (unlikely(ctrl0 & GDMA_REG_CTRL0_ENABLE)) { ++ dev_err(dma_dev->ddev.dev, "chan %d is start(%08x).\n", ++ chan->id, ctrl0); ++ rt305x_dump_reg(dma_dev, chan->id); ++ return -EINVAL; ++ } ++ ++ sg = &chan->desc->sg[chan->next_sg]; ++ if (chan->desc->direction == DMA_MEM_TO_DEV) { ++ src_addr = sg->src_addr; ++ dst_addr = chan->fifo_addr; ++ ctrl0 = GDMA_REG_CTRL0_DST_ADDR_FIXED | \ ++ (8 << GDMA_RT305X_CTRL0_SRC_REQ_SHIFT) | \ ++ (chan->slave_id << GDMA_RT305X_CTRL0_DST_REQ_SHIFT); ++ } else if (chan->desc->direction == DMA_DEV_TO_MEM) { ++ src_addr = chan->fifo_addr; ++ dst_addr = sg->dst_addr; ++ ctrl0 = GDMA_REG_CTRL0_SRC_ADDR_FIXED | \ ++ (chan->slave_id << GDMA_RT305X_CTRL0_SRC_REQ_SHIFT) | \ ++ (8 << GDMA_RT305X_CTRL0_DST_REQ_SHIFT); ++ } else if (chan->desc->direction == DMA_MEM_TO_MEM) { ++ /* ++ * TODO: memcpy function have bugs. sometime it will copy ++ * more 8 bytes data when using dmatest verify. ++ */ ++ src_addr = sg->src_addr; ++ dst_addr = sg->dst_addr; ++ ctrl0 = GDMA_REG_CTRL0_SW_MODE | \ ++ (8 << GDMA_REG_CTRL1_SRC_REQ_SHIFT) | \ ++ (8 << GDMA_REG_CTRL1_DST_REQ_SHIFT); ++ } else { ++ dev_err(dma_dev->ddev.dev, "direction type %d error\n", ++ chan->desc->direction); ++ return -EINVAL; ++ } ++ ++ ctrl0 |= (sg->len << GDMA_REG_CTRL0_TX_SHIFT) | \ ++ (chan->burst_size << GDMA_REG_CTRL0_BURST_SHIFT) | \ ++ GDMA_REG_CTRL0_DONE_INT | GDMA_REG_CTRL0_ENABLE; ++ ctrl1 = chan->id << GDMA_REG_CTRL1_NEXT_SHIFT; ++ ++ chan->next_sg++; ++ gdma_dma_write(dma_dev, GDMA_REG_SRC_ADDR(chan->id), src_addr); ++ gdma_dma_write(dma_dev, GDMA_REG_DST_ADDR(chan->id), dst_addr); ++ gdma_dma_write(dma_dev, GDMA_REG_CTRL1(chan->id), ctrl1); ++ ++ /* make sure next_sg is update */ ++ wmb(); ++ gdma_dma_write(dma_dev, GDMA_REG_CTRL0(chan->id), ctrl0); ++ ++ return 0; ++} ++ ++static void rt3883_dump_reg(struct gdma_dma_dev *dma_dev, int id) ++{ ++ dev_dbg(dma_dev->ddev.dev, "chan %d, src %08x, dst %08x, ctr0 %08x, " \ ++ "ctr1 %08x, unmask %08x, done %08x, " \ ++ "req %08x, ack %08x, fin %08x\n", id, ++ gdma_dma_read(dma_dev, GDMA_REG_SRC_ADDR(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_DST_ADDR(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_CTRL0(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_CTRL1(id)), ++ gdma_dma_read(dma_dev, GDMA_REG_UNMASK_INT), ++ gdma_dma_read(dma_dev, GDMA_REG_DONE_INT), ++ gdma_dma_read(dma_dev, GDMA_REG_REQSTS), ++ gdma_dma_read(dma_dev, GDMA_REG_ACKSTS), ++ gdma_dma_read(dma_dev, GDMA_REG_FINSTS)); ++} ++ ++static int rt3883_gdma_start_transfer(struct gdma_dmaengine_chan *chan) ++{ ++ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); ++ dma_addr_t src_addr, dst_addr; ++ struct gdma_dma_sg *sg; ++ uint32_t ctrl0, ctrl1; ++ ++ /* verify chan is already stopped */ ++ ctrl0 = gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id)); ++ if (unlikely(ctrl0 & GDMA_REG_CTRL0_ENABLE)) { ++ dev_err(dma_dev->ddev.dev, "chan %d is start(%08x).\n", ++ chan->id, ctrl0); ++ rt3883_dump_reg(dma_dev, chan->id); ++ return -EINVAL; ++ } ++ ++ sg = &chan->desc->sg[chan->next_sg]; ++ if (chan->desc->direction == DMA_MEM_TO_DEV) { ++ src_addr = sg->src_addr; ++ dst_addr = chan->fifo_addr; ++ ctrl0 = GDMA_REG_CTRL0_DST_ADDR_FIXED; ++ ctrl1 = (32 << GDMA_REG_CTRL1_SRC_REQ_SHIFT) | \ ++ (chan->slave_id << GDMA_REG_CTRL1_DST_REQ_SHIFT); ++ } else if (chan->desc->direction == DMA_DEV_TO_MEM) { ++ src_addr = chan->fifo_addr; ++ dst_addr = sg->dst_addr; ++ ctrl0 = GDMA_REG_CTRL0_SRC_ADDR_FIXED; ++ ctrl1 = (chan->slave_id << GDMA_REG_CTRL1_SRC_REQ_SHIFT) | \ ++ (32 << GDMA_REG_CTRL1_DST_REQ_SHIFT) | \ ++ GDMA_REG_CTRL1_COHERENT; ++ } else if (chan->desc->direction == DMA_MEM_TO_MEM) { ++ src_addr = sg->src_addr; ++ dst_addr = sg->dst_addr; ++ ctrl0 = GDMA_REG_CTRL0_SW_MODE; ++ ctrl1 = (32 << GDMA_REG_CTRL1_SRC_REQ_SHIFT) | \ ++ (32 << GDMA_REG_CTRL1_DST_REQ_SHIFT) | \ ++ GDMA_REG_CTRL1_COHERENT; ++ } else { ++ dev_err(dma_dev->ddev.dev, "direction type %d error\n", ++ chan->desc->direction); ++ return -EINVAL; ++ } ++ ++ ctrl0 |= (sg->len << GDMA_REG_CTRL0_TX_SHIFT) | \ ++ (chan->burst_size << GDMA_REG_CTRL0_BURST_SHIFT) | \ ++ GDMA_REG_CTRL0_DONE_INT | GDMA_REG_CTRL0_ENABLE; ++ ctrl1 |= chan->id << GDMA_REG_CTRL1_NEXT_SHIFT; ++ ++ chan->next_sg++; ++ gdma_dma_write(dma_dev, GDMA_REG_SRC_ADDR(chan->id), src_addr); ++ gdma_dma_write(dma_dev, GDMA_REG_DST_ADDR(chan->id), dst_addr); ++ gdma_dma_write(dma_dev, GDMA_REG_CTRL1(chan->id), ctrl1); ++ ++ /* make sure next_sg is update */ ++ wmb(); ++ gdma_dma_write(dma_dev, GDMA_REG_CTRL0(chan->id), ctrl0); ++ ++ return 0; ++} ++ ++static inline int gdma_start_transfer(struct gdma_dma_dev *dma_dev, ++ struct gdma_dmaengine_chan *chan) ++{ ++ return dma_dev->data->start_transfer(chan); ++} ++ ++static int gdma_next_desc(struct gdma_dmaengine_chan *chan) ++{ ++ struct virt_dma_desc *vdesc; ++ ++ vdesc = vchan_next_desc(&chan->vchan); ++ if (!vdesc) { ++ chan->desc = NULL; ++ return 0; ++ } ++ chan->desc = to_gdma_dma_desc(vdesc); ++ chan->next_sg = 0; ++ ++ return 1; ++} ++ ++static void gdma_dma_chan_irq(struct gdma_dma_dev *dma_dev, ++ struct gdma_dmaengine_chan *chan) ++{ ++ struct gdma_dma_desc *desc; ++ unsigned long flags; ++ int chan_issued; ++ ++ chan_issued = 0; ++ spin_lock_irqsave(&chan->vchan.lock, flags); ++ desc = chan->desc; ++ if (desc) { ++ if (desc->cyclic) { ++ vchan_cyclic_callback(&desc->vdesc); ++ if (chan->next_sg == desc->num_sgs) ++ chan->next_sg = 0; ++ chan_issued = 1; ++ } else { ++ desc->residue -= desc->sg[chan->next_sg - 1].len; ++ if (chan->next_sg == desc->num_sgs) { ++ list_del(&desc->vdesc.node); ++ vchan_cookie_complete(&desc->vdesc); ++ chan_issued = gdma_next_desc(chan); ++ } else ++ chan_issued = 1; ++ } ++ } else ++ dev_dbg(dma_dev->ddev.dev, "chan %d no desc to complete\n", ++ chan->id); ++ if (chan_issued) ++ set_bit(chan->id, &dma_dev->chan_issued); ++ spin_unlock_irqrestore(&chan->vchan.lock, flags); ++} ++ ++static irqreturn_t gdma_dma_irq(int irq, void *devid) ++{ ++ struct gdma_dma_dev *dma_dev = devid; ++ u32 done, done_reg; ++ unsigned int i; ++ ++ done_reg = dma_dev->data->done_int_reg; ++ done = gdma_dma_read(dma_dev, done_reg); ++ if (unlikely(!done)) ++ return IRQ_NONE; ++ ++ /* clean done bits */ ++ gdma_dma_write(dma_dev, done_reg, done); ++ ++ i = 0; ++ while (done) { ++ if (done & 0x1) { ++ gdma_dma_chan_irq(dma_dev, &dma_dev->chan[i]); ++ atomic_dec(&dma_dev->cnt); ++ } ++ done >>= 1; ++ i++; ++ } ++ ++ /* start only have work to do */ ++ if (dma_dev->chan_issued) ++ tasklet_schedule(&dma_dev->task); ++ ++ return IRQ_HANDLED; ++} ++ ++static void gdma_dma_issue_pending(struct dma_chan *c) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&chan->vchan.lock, flags); ++ if (vchan_issue_pending(&chan->vchan) && !chan->desc) { ++ if (gdma_next_desc(chan)) { ++ set_bit(chan->id, &dma_dev->chan_issued); ++ tasklet_schedule(&dma_dev->task); ++ } else ++ dev_dbg(dma_dev->ddev.dev, "chan %d no desc to issue\n", ++ chan->id); ++ } ++ spin_unlock_irqrestore(&chan->vchan.lock, flags); ++} ++ ++static struct dma_async_tx_descriptor *gdma_dma_prep_slave_sg( ++ struct dma_chan *c, struct scatterlist *sgl, ++ unsigned int sg_len, enum dma_transfer_direction direction, ++ unsigned long flags, void *context) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct gdma_dma_desc *desc; ++ struct scatterlist *sg; ++ unsigned int i; ++ ++ desc = gdma_dma_alloc_desc(sg_len); ++ if (!desc) { ++ dev_err(c->device->dev, "alloc sg decs error\n"); ++ return NULL; ++ } ++ desc->residue = 0; ++ ++ for_each_sg(sgl, sg, sg_len, i) { ++ if (direction == DMA_MEM_TO_DEV) ++ desc->sg[i].src_addr = sg_dma_address(sg); ++ else if (direction == DMA_DEV_TO_MEM) ++ desc->sg[i].dst_addr = sg_dma_address(sg); ++ else { ++ dev_err(c->device->dev, "direction type %d error\n", ++ direction); ++ goto free_desc; ++ } ++ ++ if (unlikely(sg_dma_len(sg) > GDMA_REG_CTRL0_TX_MASK)) { ++ dev_err(c->device->dev, "sg len too large %d\n", ++ sg_dma_len(sg)); ++ goto free_desc; ++ } ++ desc->sg[i].len = sg_dma_len(sg); ++ desc->residue += sg_dma_len(sg); ++ } ++ ++ desc->num_sgs = sg_len; ++ desc->direction = direction; ++ desc->cyclic = false; ++ ++ return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); ++ ++free_desc: ++ kfree(desc); ++ return NULL; ++} ++ ++static struct dma_async_tx_descriptor * gdma_dma_prep_dma_memcpy( ++ struct dma_chan *c, dma_addr_t dest, dma_addr_t src, ++ size_t len, unsigned long flags) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct gdma_dma_desc *desc; ++ unsigned int num_periods, i; ++ size_t xfer_count; ++ ++ if (len <= 0) ++ return NULL; ++ ++ chan->burst_size = gdma_dma_maxburst(len >> 2); ++ ++ xfer_count = GDMA_REG_CTRL0_TX_MASK; ++ num_periods = DIV_ROUND_UP(len, xfer_count); ++ ++ desc = gdma_dma_alloc_desc(num_periods); ++ if (!desc) { ++ dev_err(c->device->dev, "alloc memcpy decs error\n"); ++ return NULL; ++ } ++ desc->residue = len; ++ ++ for (i = 0; i < num_periods; i++) { ++ desc->sg[i].src_addr = src; ++ desc->sg[i].dst_addr = dest; ++ if (len > xfer_count) { ++ desc->sg[i].len = xfer_count; ++ } else { ++ desc->sg[i].len = len; ++ } ++ src += desc->sg[i].len; ++ dest += desc->sg[i].len; ++ len -= desc->sg[i].len; ++ } ++ ++ desc->num_sgs = num_periods; ++ desc->direction = DMA_MEM_TO_MEM; ++ desc->cyclic = false; ++ ++ return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); ++} ++ ++static struct dma_async_tx_descriptor *gdma_dma_prep_dma_cyclic( ++ struct dma_chan *c, dma_addr_t buf_addr, size_t buf_len, ++ size_t period_len, enum dma_transfer_direction direction, ++ unsigned long flags) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct gdma_dma_desc *desc; ++ unsigned int num_periods, i; ++ ++ if (buf_len % period_len) ++ return NULL; ++ ++ if (period_len > GDMA_REG_CTRL0_TX_MASK) { ++ dev_err(c->device->dev, "cyclic len too large %d\n", ++ period_len); ++ return NULL; ++ } ++ ++ num_periods = buf_len / period_len; ++ desc = gdma_dma_alloc_desc(num_periods); ++ if (!desc) { ++ dev_err(c->device->dev, "alloc cyclic decs error\n"); ++ return NULL; ++ } ++ desc->residue = buf_len; ++ ++ for (i = 0; i < num_periods; i++) { ++ if (direction == DMA_MEM_TO_DEV) ++ desc->sg[i].src_addr = buf_addr; ++ else if (direction == DMA_DEV_TO_MEM) ++ desc->sg[i].dst_addr = buf_addr; ++ else { ++ dev_err(c->device->dev, "direction type %d error\n", ++ direction); ++ goto free_desc; ++ } ++ desc->sg[i].len = period_len; ++ buf_addr += period_len; ++ } ++ ++ desc->num_sgs = num_periods; ++ desc->direction = direction; ++ desc->cyclic = true; ++ ++ return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); ++ ++free_desc: ++ kfree(desc); ++ return NULL; ++} ++ ++static enum dma_status gdma_dma_tx_status(struct dma_chan *c, ++ dma_cookie_t cookie, struct dma_tx_state *state) ++{ ++ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c); ++ struct virt_dma_desc *vdesc; ++ enum dma_status status; ++ unsigned long flags; ++ struct gdma_dma_desc *desc; ++ ++ status = dma_cookie_status(c, cookie, state); ++ if (status == DMA_COMPLETE || !state) ++ return status; ++ ++ spin_lock_irqsave(&chan->vchan.lock, flags); ++ desc = chan->desc; ++ if (desc && (cookie == desc->vdesc.tx.cookie)) { ++ /* ++ * We never update edesc->residue in the cyclic case, so we ++ * can tell the remaining room to the end of the circular ++ * buffer. ++ */ ++ if (desc->cyclic) ++ state->residue = desc->residue - ++ ((chan->next_sg - 1) * desc->sg[0].len); ++ else ++ state->residue = desc->residue; ++ } else if ((vdesc = vchan_find_desc(&chan->vchan, cookie))) ++ state->residue = to_gdma_dma_desc(vdesc)->residue; ++ spin_unlock_irqrestore(&chan->vchan.lock, flags); ++ ++ dev_dbg(c->device->dev, "tx residue %d bytes\n", state->residue); ++ ++ return status; ++} ++ ++static void gdma_dma_free_chan_resources(struct dma_chan *c) ++{ ++ vchan_free_chan_resources(to_virt_chan(c)); ++} ++ ++static void gdma_dma_desc_free(struct virt_dma_desc *vdesc) ++{ ++ kfree(container_of(vdesc, struct gdma_dma_desc, vdesc)); ++} ++ ++static void gdma_dma_tasklet(unsigned long arg) ++{ ++ struct gdma_dma_dev *dma_dev = (struct gdma_dma_dev *)arg; ++ struct gdma_dmaengine_chan *chan; ++ static unsigned int last_chan; ++ unsigned int i, chan_mask; ++ ++ /* record last chan to round robin all chans */ ++ i = last_chan; ++ chan_mask = dma_dev->data->chancnt - 1; ++ do { ++ /* ++ * on mt7621. when verify with dmatest with all ++ * channel is enable. we need to limit only two ++ * channel is working at the same time. otherwise the ++ * data will have problem. ++ */ ++ if (atomic_read(&dma_dev->cnt) >= 2) { ++ last_chan = i; ++ break; ++ } ++ ++ if (test_and_clear_bit(i, &dma_dev->chan_issued)) { ++ chan = &dma_dev->chan[i]; ++ if (chan->desc) { ++ atomic_inc(&dma_dev->cnt); ++ gdma_start_transfer(dma_dev, chan); ++ } else ++ dev_dbg(dma_dev->ddev.dev, "chan %d no desc to issue\n", chan->id); ++ ++ if (!dma_dev->chan_issued) ++ break; ++ } ++ ++ i = (i + 1) & chan_mask; ++ } while (i != last_chan); ++} ++ ++static void rt305x_gdma_init(struct gdma_dma_dev *dma_dev) ++{ ++ uint32_t gct; ++ ++ /* all chans round robin */ ++ gdma_dma_write(dma_dev, GDMA_RT305X_GCT, GDMA_REG_GCT_ARBIT_RR); ++ ++ gct = gdma_dma_read(dma_dev, GDMA_RT305X_GCT); ++ dev_info(dma_dev->ddev.dev, "revision: %d, channels: %d\n", ++ (gct >> GDMA_REG_GCT_VER_SHIFT) & GDMA_REG_GCT_VER_MASK, ++ 8 << ((gct >> GDMA_REG_GCT_CHAN_SHIFT) & ++ GDMA_REG_GCT_CHAN_MASK)); ++} ++ ++static void rt3883_gdma_init(struct gdma_dma_dev *dma_dev) ++{ ++ uint32_t gct; ++ ++ /* all chans round robin */ ++ gdma_dma_write(dma_dev, GDMA_REG_GCT, GDMA_REG_GCT_ARBIT_RR); ++ ++ gct = gdma_dma_read(dma_dev, GDMA_REG_GCT); ++ dev_info(dma_dev->ddev.dev, "revision: %d, channels: %d\n", ++ (gct >> GDMA_REG_GCT_VER_SHIFT) & GDMA_REG_GCT_VER_MASK, ++ 8 << ((gct >> GDMA_REG_GCT_CHAN_SHIFT) & ++ GDMA_REG_GCT_CHAN_MASK)); ++} ++ ++static struct gdma_data rt305x_gdma_data = { ++ .chancnt = 8, ++ .done_int_reg = GDMA_RT305X_STATUS_INT, ++ .init = rt305x_gdma_init, ++ .start_transfer = rt305x_gdma_start_transfer, ++}; ++ ++static struct gdma_data rt3883_gdma_data = { ++ .chancnt = 16, ++ .done_int_reg = GDMA_REG_DONE_INT, ++ .init = rt3883_gdma_init, ++ .start_transfer = rt3883_gdma_start_transfer, ++}; ++ ++static const struct of_device_id gdma_of_match_table[] = { ++ { .compatible = "ralink,rt305x-gdma", .data = &rt305x_gdma_data }, ++ { .compatible = "ralink,rt3883-gdma", .data = &rt3883_gdma_data }, ++ { }, ++}; ++ ++static int gdma_dma_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *match; ++ struct gdma_dmaengine_chan *chan; ++ struct gdma_dma_dev *dma_dev; ++ struct dma_device *dd; ++ unsigned int i; ++ struct resource *res; ++ int ret; ++ int irq; ++ void __iomem *base; ++ struct gdma_data *data; ++ ++ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); ++ if (ret) ++ return ret; ++ ++ match = of_match_device(gdma_of_match_table, &pdev->dev); ++ if (!match) ++ return -EINVAL; ++ data = (struct gdma_data *) match->data; ++ ++ dma_dev = devm_kzalloc(&pdev->dev, sizeof(*dma_dev) + ++ (sizeof(struct gdma_dmaengine_chan) * data->chancnt), ++ GFP_KERNEL); ++ if (!dma_dev) { ++ dev_err(&pdev->dev, "alloc dma device failed\n"); ++ return -EINVAL; ++ } ++ dma_dev->data = data; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ dma_dev->base = base; ++ tasklet_init(&dma_dev->task, gdma_dma_tasklet, (unsigned long)dma_dev); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ dev_err(&pdev->dev, "failed to get irq\n"); ++ return -EINVAL; ++ } ++ ret = devm_request_irq(&pdev->dev, irq, gdma_dma_irq, ++ 0, dev_name(&pdev->dev), dma_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to request irq\n"); ++ return ret; ++ } ++ ++ device_reset(&pdev->dev); ++ ++ dd = &dma_dev->ddev; ++ dma_cap_set(DMA_MEMCPY, dd->cap_mask); ++ dma_cap_set(DMA_SLAVE, dd->cap_mask); ++ dma_cap_set(DMA_CYCLIC, dd->cap_mask); ++ dd->device_free_chan_resources = gdma_dma_free_chan_resources; ++ dd->device_prep_dma_memcpy = gdma_dma_prep_dma_memcpy; ++ dd->device_prep_slave_sg = gdma_dma_prep_slave_sg; ++ dd->device_prep_dma_cyclic = gdma_dma_prep_dma_cyclic; ++ dd->device_config = gdma_dma_config; ++ dd->device_terminate_all = gdma_dma_terminate_all; ++ dd->device_tx_status = gdma_dma_tx_status; ++ dd->device_issue_pending = gdma_dma_issue_pending; ++ ++ dd->src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); ++ dd->dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); ++ dd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ dd->residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; ++ ++ dd->dev = &pdev->dev; ++ dd->dev->dma_parms = &dma_dev->dma_parms; ++ dma_set_max_seg_size(dd->dev, GDMA_REG_CTRL0_TX_MASK); ++ INIT_LIST_HEAD(&dd->channels); ++ ++ for (i = 0; i < data->chancnt; i++) { ++ chan = &dma_dev->chan[i]; ++ chan->id = i; ++ chan->vchan.desc_free = gdma_dma_desc_free; ++ vchan_init(&chan->vchan, dd); ++ } ++ ++ /* init hardware */ ++ data->init(dma_dev); ++ ++ ret = dma_async_device_register(dd); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to register dma device\n"); ++ return ret; ++ } ++ ++ ret = of_dma_controller_register(pdev->dev.of_node, ++ of_dma_xlate_by_chan_id, dma_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to register of dma controller\n"); ++ goto err_unregister; ++ } ++ ++ platform_set_drvdata(pdev, dma_dev); ++ ++ return 0; ++ ++err_unregister: ++ dma_async_device_unregister(dd); ++ return ret; ++} ++ ++static int gdma_dma_remove(struct platform_device *pdev) ++{ ++ struct gdma_dma_dev *dma_dev = platform_get_drvdata(pdev); ++ ++ tasklet_kill(&dma_dev->task); ++ of_dma_controller_free(pdev->dev.of_node); ++ dma_async_device_unregister(&dma_dev->ddev); ++ ++ return 0; ++} ++ ++static struct platform_driver gdma_dma_driver = { ++ .probe = gdma_dma_probe, ++ .remove = gdma_dma_remove, ++ .driver = { ++ .name = "gdma-rt2880", ++ .of_match_table = gdma_of_match_table, ++ }, ++}; ++module_platform_driver(gdma_dma_driver); ++ ++MODULE_AUTHOR("Lars-Peter Clausen "); ++MODULE_DESCRIPTION("Ralink/MTK DMA driver"); ++MODULE_LICENSE("GPL v2"); +--- a/include/linux/dmaengine.h ++++ b/include/linux/dmaengine.h +@@ -496,6 +496,7 @@ static inline void dma_set_unmap(struct + struct dmaengine_unmap_data * + dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags); + void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap); ++struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); + #else + static inline void dma_set_unmap(struct dma_async_tx_descriptor *tx, + struct dmaengine_unmap_data *unmap) +--- /dev/null ++++ b/drivers/dma/mtk-hsdma.c +@@ -0,0 +1,767 @@ ++/* ++ * Copyright (C) 2015, Michael Lee ++ * MTK HSDMA support ++ * ++ * 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 "virt-dma.h" ++ ++#define HSDMA_BASE_OFFSET 0x800 ++ ++#define HSDMA_REG_TX_BASE 0x00 ++#define HSDMA_REG_TX_CNT 0x04 ++#define HSDMA_REG_TX_CTX 0x08 ++#define HSDMA_REG_TX_DTX 0x0c ++#define HSDMA_REG_RX_BASE 0x100 ++#define HSDMA_REG_RX_CNT 0x104 ++#define HSDMA_REG_RX_CRX 0x108 ++#define HSDMA_REG_RX_DRX 0x10c ++#define HSDMA_REG_INFO 0x200 ++#define HSDMA_REG_GLO_CFG 0x204 ++#define HSDMA_REG_RST_CFG 0x208 ++#define HSDMA_REG_DELAY_INT 0x20c ++#define HSDMA_REG_FREEQ_THRES 0x210 ++#define HSDMA_REG_INT_STATUS 0x220 ++#define HSDMA_REG_INT_MASK 0x228 ++#define HSDMA_REG_SCH_Q01 0x280 ++#define HSDMA_REG_SCH_Q23 0x284 ++ ++#define HSDMA_DESCS_MAX 0xfff ++#define HSDMA_DESCS_NUM 8 ++#define HSDMA_DESCS_MASK (HSDMA_DESCS_NUM - 1) ++#define HSDMA_NEXT_DESC(x) (((x) + 1) & HSDMA_DESCS_MASK) ++ ++/* HSDMA_REG_INFO */ ++#define HSDMA_INFO_INDEX_MASK 0xf ++#define HSDMA_INFO_INDEX_SHIFT 24 ++#define HSDMA_INFO_BASE_MASK 0xff ++#define HSDMA_INFO_BASE_SHIFT 16 ++#define HSDMA_INFO_RX_MASK 0xff ++#define HSDMA_INFO_RX_SHIFT 8 ++#define HSDMA_INFO_TX_MASK 0xff ++#define HSDMA_INFO_TX_SHIFT 0 ++ ++/* HSDMA_REG_GLO_CFG */ ++#define HSDMA_GLO_TX_2B_OFFSET BIT(31) ++#define HSDMA_GLO_CLK_GATE BIT(30) ++#define HSDMA_GLO_BYTE_SWAP BIT(29) ++#define HSDMA_GLO_MULTI_DMA BIT(10) ++#define HSDMA_GLO_TWO_BUF BIT(9) ++#define HSDMA_GLO_32B_DESC BIT(8) ++#define HSDMA_GLO_BIG_ENDIAN BIT(7) ++#define HSDMA_GLO_TX_DONE BIT(6) ++#define HSDMA_GLO_BT_MASK 0x3 ++#define HSDMA_GLO_BT_SHIFT 4 ++#define HSDMA_GLO_RX_BUSY BIT(3) ++#define HSDMA_GLO_RX_DMA BIT(2) ++#define HSDMA_GLO_TX_BUSY BIT(1) ++#define HSDMA_GLO_TX_DMA BIT(0) ++ ++#define HSDMA_BT_SIZE_16BYTES (0 << HSDMA_GLO_BT_SHIFT) ++#define HSDMA_BT_SIZE_32BYTES (1 << HSDMA_GLO_BT_SHIFT) ++#define HSDMA_BT_SIZE_64BYTES (2 << HSDMA_GLO_BT_SHIFT) ++#define HSDMA_BT_SIZE_128BYTES (3 << HSDMA_GLO_BT_SHIFT) ++ ++#define HSDMA_GLO_DEFAULT (HSDMA_GLO_MULTI_DMA | \ ++ HSDMA_GLO_RX_DMA | HSDMA_GLO_TX_DMA | HSDMA_BT_SIZE_32BYTES) ++ ++/* HSDMA_REG_RST_CFG */ ++#define HSDMA_RST_RX_SHIFT 16 ++#define HSDMA_RST_TX_SHIFT 0 ++ ++/* HSDMA_REG_DELAY_INT */ ++#define HSDMA_DELAY_INT_EN BIT(15) ++#define HSDMA_DELAY_PEND_OFFSET 8 ++#define HSDMA_DELAY_TIME_OFFSET 0 ++#define HSDMA_DELAY_TX_OFFSET 16 ++#define HSDMA_DELAY_RX_OFFSET 0 ++ ++#define HSDMA_DELAY_INIT(x) (HSDMA_DELAY_INT_EN | \ ++ ((x) << HSDMA_DELAY_PEND_OFFSET)) ++#define HSDMA_DELAY(x) ((HSDMA_DELAY_INIT(x) << \ ++ HSDMA_DELAY_TX_OFFSET) | HSDMA_DELAY_INIT(x)) ++ ++/* HSDMA_REG_INT_STATUS */ ++#define HSDMA_INT_DELAY_RX_COH BIT(31) ++#define HSDMA_INT_DELAY_RX_INT BIT(30) ++#define HSDMA_INT_DELAY_TX_COH BIT(29) ++#define HSDMA_INT_DELAY_TX_INT BIT(28) ++#define HSDMA_INT_RX_MASK 0x3 ++#define HSDMA_INT_RX_SHIFT 16 ++#define HSDMA_INT_RX_Q0 BIT(16) ++#define HSDMA_INT_TX_MASK 0xf ++#define HSDMA_INT_TX_SHIFT 0 ++#define HSDMA_INT_TX_Q0 BIT(0) ++ ++/* tx/rx dma desc flags */ ++#define HSDMA_PLEN_MASK 0x3fff ++#define HSDMA_DESC_DONE BIT(31) ++#define HSDMA_DESC_LS0 BIT(30) ++#define HSDMA_DESC_PLEN0(_x) (((_x) & HSDMA_PLEN_MASK) << 16) ++#define HSDMA_DESC_TAG BIT(15) ++#define HSDMA_DESC_LS1 BIT(14) ++#define HSDMA_DESC_PLEN1(_x) ((_x) & HSDMA_PLEN_MASK) ++ ++/* align 4 bytes */ ++#define HSDMA_ALIGN_SIZE 3 ++/* align size 128bytes */ ++#define HSDMA_MAX_PLEN 0x3f80 ++ ++struct hsdma_desc { ++ u32 addr0; ++ u32 flags; ++ u32 addr1; ++ u32 unused; ++}; ++ ++struct mtk_hsdma_sg { ++ dma_addr_t src_addr; ++ dma_addr_t dst_addr; ++ u32 len; ++}; ++ ++struct mtk_hsdma_desc { ++ struct virt_dma_desc vdesc; ++ unsigned int num_sgs; ++ struct mtk_hsdma_sg sg[1]; ++}; ++ ++struct mtk_hsdma_chan { ++ struct virt_dma_chan vchan; ++ unsigned int id; ++ dma_addr_t desc_addr; ++ int tx_idx; ++ int rx_idx; ++ struct hsdma_desc *tx_ring; ++ struct hsdma_desc *rx_ring; ++ struct mtk_hsdma_desc *desc; ++ unsigned int next_sg; ++}; ++ ++struct mtk_hsdam_engine { ++ struct dma_device ddev; ++ struct device_dma_parameters dma_parms; ++ void __iomem *base; ++ struct tasklet_struct task; ++ volatile unsigned long chan_issued; ++ ++ struct mtk_hsdma_chan chan[1]; ++}; ++ ++static inline struct mtk_hsdam_engine *mtk_hsdma_chan_get_dev( ++ struct mtk_hsdma_chan *chan) ++{ ++ return container_of(chan->vchan.chan.device, struct mtk_hsdam_engine, ++ ddev); ++} ++ ++static inline struct mtk_hsdma_chan *to_mtk_hsdma_chan(struct dma_chan *c) ++{ ++ return container_of(c, struct mtk_hsdma_chan, vchan.chan); ++} ++ ++static inline struct mtk_hsdma_desc *to_mtk_hsdma_desc( ++ struct virt_dma_desc *vdesc) ++{ ++ return container_of(vdesc, struct mtk_hsdma_desc, vdesc); ++} ++ ++static inline u32 mtk_hsdma_read(struct mtk_hsdam_engine *hsdma, u32 reg) ++{ ++ return readl(hsdma->base + reg); ++} ++ ++static inline void mtk_hsdma_write(struct mtk_hsdam_engine *hsdma, ++ unsigned reg, u32 val) ++{ ++ writel(val, hsdma->base + reg); ++} ++ ++static void mtk_hsdma_reset_chan(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ chan->tx_idx = 0; ++ chan->rx_idx = HSDMA_DESCS_NUM - 1; ++ ++ mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx); ++ mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx); ++ ++ mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG, ++ 0x1 << (chan->id + HSDMA_RST_TX_SHIFT)); ++ mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG, ++ 0x1 << (chan->id + HSDMA_RST_RX_SHIFT)); ++} ++ ++static void hsdma_dump_reg(struct mtk_hsdam_engine *hsdma) ++{ ++ dev_dbg(hsdma->ddev.dev, "tbase %08x, tcnt %08x, " \ ++ "tctx %08x, tdtx: %08x, rbase %08x, " \ ++ "rcnt %08x, rctx %08x, rdtx %08x\n", ++ mtk_hsdma_read(hsdma, HSDMA_REG_TX_BASE), ++ mtk_hsdma_read(hsdma, HSDMA_REG_TX_CNT), ++ mtk_hsdma_read(hsdma, HSDMA_REG_TX_CTX), ++ mtk_hsdma_read(hsdma, HSDMA_REG_TX_DTX), ++ mtk_hsdma_read(hsdma, HSDMA_REG_RX_BASE), ++ mtk_hsdma_read(hsdma, HSDMA_REG_RX_CNT), ++ mtk_hsdma_read(hsdma, HSDMA_REG_RX_CRX), ++ mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX)); ++ ++ dev_dbg(hsdma->ddev.dev, "info %08x, glo %08x, delay %08x, " \ ++ "intr_stat %08x, intr_mask %08x\n", ++ mtk_hsdma_read(hsdma, HSDMA_REG_INFO), ++ mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG), ++ mtk_hsdma_read(hsdma, HSDMA_REG_DELAY_INT), ++ mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS), ++ mtk_hsdma_read(hsdma, HSDMA_REG_INT_MASK)); ++} ++ ++static void hsdma_dump_desc(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ struct hsdma_desc *tx_desc; ++ struct hsdma_desc *rx_desc; ++ int i; ++ ++ dev_dbg(hsdma->ddev.dev, "tx idx: %d, rx idx: %d\n", ++ chan->tx_idx, chan->rx_idx); ++ ++ for (i = 0; i < HSDMA_DESCS_NUM; i++) { ++ tx_desc = &chan->tx_ring[i]; ++ rx_desc = &chan->rx_ring[i]; ++ ++ dev_dbg(hsdma->ddev.dev, "%d tx addr0: %08x, flags %08x, " \ ++ "tx addr1: %08x, rx addr0 %08x, flags %08x\n", ++ i, tx_desc->addr0, tx_desc->flags, \ ++ tx_desc->addr1, rx_desc->addr0, rx_desc->flags); ++ } ++} ++ ++static void mtk_hsdma_reset(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ int i; ++ ++ /* disable dma */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0); ++ ++ /* disable intr */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0); ++ ++ /* init desc value */ ++ for (i = 0; i < HSDMA_DESCS_NUM; i++) { ++ chan->tx_ring[i].addr0 = 0; ++ chan->tx_ring[i].flags = HSDMA_DESC_LS0 | ++ HSDMA_DESC_DONE; ++ } ++ for (i = 0; i < HSDMA_DESCS_NUM; i++) { ++ chan->rx_ring[i].addr0 = 0; ++ chan->rx_ring[i].flags = 0; ++ } ++ ++ /* reset */ ++ mtk_hsdma_reset_chan(hsdma, chan); ++ ++ /* enable intr */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0); ++ ++ /* enable dma */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT); ++} ++ ++static int mtk_hsdma_terminate_all(struct dma_chan *c) ++{ ++ struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c); ++ struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan); ++ unsigned long timeout; ++ LIST_HEAD(head); ++ ++ spin_lock_bh(&chan->vchan.lock); ++ chan->desc = NULL; ++ clear_bit(chan->id, &hsdma->chan_issued); ++ vchan_get_all_descriptors(&chan->vchan, &head); ++ spin_unlock_bh(&chan->vchan.lock); ++ ++ vchan_dma_desc_free_list(&chan->vchan, &head); ++ ++ /* wait dma transfer complete */ ++ timeout = jiffies + msecs_to_jiffies(2000); ++ while (mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG) & ++ (HSDMA_GLO_RX_BUSY | HSDMA_GLO_TX_BUSY)) { ++ if (time_after_eq(jiffies, timeout)) { ++ hsdma_dump_desc(hsdma, chan); ++ mtk_hsdma_reset(hsdma, chan); ++ dev_err(hsdma->ddev.dev, "timeout, reset it\n"); ++ break; ++ } ++ cpu_relax(); ++ } ++ ++ return 0; ++} ++ ++static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ dma_addr_t src, dst; ++ size_t len, tlen; ++ struct hsdma_desc *tx_desc, *rx_desc; ++ struct mtk_hsdma_sg *sg; ++ unsigned int i; ++ int rx_idx; ++ ++ sg = &chan->desc->sg[0]; ++ len = sg->len; ++ chan->desc->num_sgs = DIV_ROUND_UP(len, HSDMA_MAX_PLEN); ++ ++ /* tx desc */ ++ src = sg->src_addr; ++ for (i = 0; i < chan->desc->num_sgs; i++) { ++ if (len > HSDMA_MAX_PLEN) ++ tlen = HSDMA_MAX_PLEN; ++ else ++ tlen = len; ++ ++ if (i & 0x1) { ++ tx_desc->addr1 = src; ++ tx_desc->flags |= HSDMA_DESC_PLEN1(tlen); ++ } else { ++ tx_desc = &chan->tx_ring[chan->tx_idx]; ++ tx_desc->addr0 = src; ++ tx_desc->flags = HSDMA_DESC_PLEN0(tlen); ++ ++ /* update index */ ++ chan->tx_idx = HSDMA_NEXT_DESC(chan->tx_idx); ++ } ++ ++ src += tlen; ++ len -= tlen; ++ } ++ if (i & 0x1) ++ tx_desc->flags |= HSDMA_DESC_LS0; ++ else ++ tx_desc->flags |= HSDMA_DESC_LS1; ++ ++ /* rx desc */ ++ rx_idx = HSDMA_NEXT_DESC(chan->rx_idx); ++ len = sg->len; ++ dst = sg->dst_addr; ++ for (i = 0; i < chan->desc->num_sgs; i++) { ++ rx_desc = &chan->rx_ring[rx_idx]; ++ if (len > HSDMA_MAX_PLEN) ++ tlen = HSDMA_MAX_PLEN; ++ else ++ tlen = len; ++ ++ rx_desc->addr0 = dst; ++ rx_desc->flags = HSDMA_DESC_PLEN0(tlen); ++ ++ dst += tlen; ++ len -= tlen; ++ ++ /* update index */ ++ rx_idx = HSDMA_NEXT_DESC(rx_idx); ++ } ++ ++ /* make sure desc and index all up to date */ ++ wmb(); ++ mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx); ++ ++ return 0; ++} ++ ++static int gdma_next_desc(struct mtk_hsdma_chan *chan) ++{ ++ struct virt_dma_desc *vdesc; ++ ++ vdesc = vchan_next_desc(&chan->vchan); ++ if (!vdesc) { ++ chan->desc = NULL; ++ return 0; ++ } ++ chan->desc = to_mtk_hsdma_desc(vdesc); ++ chan->next_sg = 0; ++ ++ return 1; ++} ++ ++static void mtk_hsdma_chan_done(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ struct mtk_hsdma_desc *desc; ++ int chan_issued; ++ ++ chan_issued = 0; ++ spin_lock_bh(&chan->vchan.lock); ++ desc = chan->desc; ++ if (likely(desc)) { ++ if (chan->next_sg == desc->num_sgs) { ++ list_del(&desc->vdesc.node); ++ vchan_cookie_complete(&desc->vdesc); ++ chan_issued = gdma_next_desc(chan); ++ } ++ } else ++ dev_dbg(hsdma->ddev.dev, "no desc to complete\n"); ++ ++ if (chan_issued) ++ set_bit(chan->id, &hsdma->chan_issued); ++ spin_unlock_bh(&chan->vchan.lock); ++} ++ ++static irqreturn_t mtk_hsdma_irq(int irq, void *devid) ++{ ++ struct mtk_hsdam_engine *hsdma = devid; ++ u32 status; ++ ++ status = mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS); ++ if (unlikely(!status)) ++ return IRQ_NONE; ++ ++ if (likely(status & HSDMA_INT_RX_Q0)) ++ tasklet_schedule(&hsdma->task); ++ else ++ dev_dbg(hsdma->ddev.dev, "unhandle irq status %08x\n", ++ status); ++ /* clean intr bits */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_INT_STATUS, status); ++ ++ return IRQ_HANDLED; ++} ++ ++static void mtk_hsdma_issue_pending(struct dma_chan *c) ++{ ++ struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c); ++ struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan); ++ ++ spin_lock_bh(&chan->vchan.lock); ++ if (vchan_issue_pending(&chan->vchan) && !chan->desc) { ++ if (gdma_next_desc(chan)) { ++ set_bit(chan->id, &hsdma->chan_issued); ++ tasklet_schedule(&hsdma->task); ++ } else ++ dev_dbg(hsdma->ddev.dev, "no desc to issue\n"); ++ } ++ spin_unlock_bh(&chan->vchan.lock); ++} ++ ++static struct dma_async_tx_descriptor * mtk_hsdma_prep_dma_memcpy( ++ struct dma_chan *c, dma_addr_t dest, dma_addr_t src, ++ size_t len, unsigned long flags) ++{ ++ struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c); ++ struct mtk_hsdma_desc *desc; ++ ++ if (len <= 0) ++ return NULL; ++ ++ desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC); ++ if (!desc) { ++ dev_err(c->device->dev, "alloc memcpy decs error\n"); ++ return NULL; ++ } ++ ++ desc->sg[0].src_addr = src; ++ desc->sg[0].dst_addr = dest; ++ desc->sg[0].len = len; ++ ++ return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); ++} ++ ++static enum dma_status mtk_hsdma_tx_status(struct dma_chan *c, ++ dma_cookie_t cookie, struct dma_tx_state *state) ++{ ++ return dma_cookie_status(c, cookie, state); ++} ++ ++static void mtk_hsdma_free_chan_resources(struct dma_chan *c) ++{ ++ vchan_free_chan_resources(to_virt_chan(c)); ++} ++ ++static void mtk_hsdma_desc_free(struct virt_dma_desc *vdesc) ++{ ++ kfree(container_of(vdesc, struct mtk_hsdma_desc, vdesc)); ++} ++ ++static void mtk_hsdma_tx(struct mtk_hsdam_engine *hsdma) ++{ ++ struct mtk_hsdma_chan *chan; ++ ++ if (test_and_clear_bit(0, &hsdma->chan_issued)) { ++ chan = &hsdma->chan[0]; ++ if (chan->desc) { ++ mtk_hsdma_start_transfer(hsdma, chan); ++ } else ++ dev_dbg(hsdma->ddev.dev,"chan 0 no desc to issue\n"); ++ } ++} ++ ++static void mtk_hsdma_rx(struct mtk_hsdam_engine *hsdma) ++{ ++ struct mtk_hsdma_chan *chan; ++ int next_idx, drx_idx, cnt; ++ ++ chan = &hsdma->chan[0]; ++ next_idx = HSDMA_NEXT_DESC(chan->rx_idx); ++ drx_idx = mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX); ++ ++ cnt = (drx_idx - next_idx) & HSDMA_DESCS_MASK; ++ if (!cnt) ++ return; ++ ++ chan->next_sg += cnt; ++ chan->rx_idx = (chan->rx_idx + cnt) & HSDMA_DESCS_MASK; ++ ++ /* update rx crx */ ++ wmb(); ++ mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx); ++ ++ mtk_hsdma_chan_done(hsdma, chan); ++} ++ ++static void mtk_hsdma_tasklet(unsigned long arg) ++{ ++ struct mtk_hsdam_engine *hsdma = (struct mtk_hsdam_engine *)arg; ++ ++ mtk_hsdma_rx(hsdma); ++ mtk_hsdma_tx(hsdma); ++} ++ ++static int mtk_hsdam_alloc_desc(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ int i; ++ ++ chan->tx_ring = dma_alloc_coherent(hsdma->ddev.dev, ++ 2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring), ++ &chan->desc_addr, GFP_ATOMIC | __GFP_ZERO); ++ if (!chan->tx_ring) ++ goto no_mem; ++ ++ chan->rx_ring = &chan->tx_ring[HSDMA_DESCS_NUM]; ++ ++ /* init tx ring value */ ++ for (i = 0; i < HSDMA_DESCS_NUM; i++) ++ chan->tx_ring[i].flags = HSDMA_DESC_LS0 | HSDMA_DESC_DONE; ++ ++ return 0; ++no_mem: ++ return -ENOMEM; ++} ++ ++static void mtk_hsdam_free_desc(struct mtk_hsdam_engine *hsdma, ++ struct mtk_hsdma_chan *chan) ++{ ++ if (chan->tx_ring) { ++ dma_free_coherent(hsdma->ddev.dev, ++ 2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring), ++ chan->tx_ring, chan->desc_addr); ++ chan->tx_ring = NULL; ++ chan->rx_ring = NULL; ++ } ++} ++ ++static int mtk_hsdma_init(struct mtk_hsdam_engine *hsdma) ++{ ++ struct mtk_hsdma_chan *chan; ++ int ret; ++ u32 reg; ++ ++ /* init desc */ ++ chan = &hsdma->chan[0]; ++ ret = mtk_hsdam_alloc_desc(hsdma, chan); ++ if (ret) ++ return ret; ++ ++ /* tx */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, chan->desc_addr); ++ mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, HSDMA_DESCS_NUM); ++ /* rx */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, chan->desc_addr + ++ (sizeof(struct hsdma_desc) * HSDMA_DESCS_NUM)); ++ mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, HSDMA_DESCS_NUM); ++ /* reset */ ++ mtk_hsdma_reset_chan(hsdma, chan); ++ ++ /* enable rx intr */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0); ++ ++ /* enable dma */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT); ++ ++ /* hardware info */ ++ reg = mtk_hsdma_read(hsdma, HSDMA_REG_INFO); ++ dev_info(hsdma->ddev.dev, "rx: %d, tx: %d\n", ++ (reg >> HSDMA_INFO_RX_SHIFT) & HSDMA_INFO_RX_MASK, ++ (reg >> HSDMA_INFO_TX_SHIFT) & HSDMA_INFO_TX_MASK); ++ ++ hsdma_dump_reg(hsdma); ++ ++ return ret; ++} ++ ++static void mtk_hsdma_uninit(struct mtk_hsdam_engine *hsdma) ++{ ++ struct mtk_hsdma_chan *chan; ++ ++ /* disable dma */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0); ++ ++ /* disable intr */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0); ++ ++ /* free desc */ ++ chan = &hsdma->chan[0]; ++ mtk_hsdam_free_desc(hsdma, chan); ++ ++ /* tx */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, 0); ++ mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, 0); ++ /* rx */ ++ mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, 0); ++ mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, 0); ++ /* reset */ ++ mtk_hsdma_reset_chan(hsdma, chan); ++} ++ ++static const struct of_device_id mtk_hsdma_of_match[] = { ++ { .compatible = "mediatek,mt7621-hsdma" }, ++ { }, ++}; ++ ++static int mtk_hsdma_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *match; ++ struct mtk_hsdma_chan *chan; ++ struct mtk_hsdam_engine *hsdma; ++ struct dma_device *dd; ++ struct resource *res; ++ int ret; ++ int irq; ++ void __iomem *base; ++ ++ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); ++ if (ret) ++ return ret; ++ ++ match = of_match_device(mtk_hsdma_of_match, &pdev->dev); ++ if (!match) ++ return -EINVAL; ++ ++ hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL); ++ if (!hsdma) { ++ dev_err(&pdev->dev, "alloc dma device failed\n"); ++ return -EINVAL; ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ hsdma->base = base + HSDMA_BASE_OFFSET; ++ tasklet_init(&hsdma->task, mtk_hsdma_tasklet, (unsigned long)hsdma); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ dev_err(&pdev->dev, "failed to get irq\n"); ++ return -EINVAL; ++ } ++ ret = devm_request_irq(&pdev->dev, irq, mtk_hsdma_irq, ++ 0, dev_name(&pdev->dev), hsdma); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to request irq\n"); ++ return ret; ++ } ++ ++ device_reset(&pdev->dev); ++ ++ dd = &hsdma->ddev; ++ dma_cap_set(DMA_MEMCPY, dd->cap_mask); ++ dd->copy_align = HSDMA_ALIGN_SIZE; ++ dd->device_free_chan_resources = mtk_hsdma_free_chan_resources; ++ dd->device_prep_dma_memcpy = mtk_hsdma_prep_dma_memcpy; ++ dd->device_terminate_all = mtk_hsdma_terminate_all; ++ dd->device_tx_status = mtk_hsdma_tx_status; ++ dd->device_issue_pending = mtk_hsdma_issue_pending; ++ dd->dev = &pdev->dev; ++ dd->dev->dma_parms = &hsdma->dma_parms; ++ dma_set_max_seg_size(dd->dev, HSDMA_MAX_PLEN); ++ INIT_LIST_HEAD(&dd->channels); ++ ++ chan = &hsdma->chan[0]; ++ chan->id = 0; ++ chan->vchan.desc_free = mtk_hsdma_desc_free; ++ vchan_init(&chan->vchan, dd); ++ ++ /* init hardware */ ++ ret = mtk_hsdma_init(hsdma); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to alloc ring descs\n"); ++ return ret; ++ } ++ ++ ret = dma_async_device_register(dd); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to register dma device\n"); ++ return ret; ++ } ++ ++ ret = of_dma_controller_register(pdev->dev.of_node, ++ of_dma_xlate_by_chan_id, hsdma); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to register of dma controller\n"); ++ goto err_unregister; ++ } ++ ++ platform_set_drvdata(pdev, hsdma); ++ ++ return 0; ++ ++err_unregister: ++ dma_async_device_unregister(dd); ++ return ret; ++} ++ ++static int mtk_hsdma_remove(struct platform_device *pdev) ++{ ++ struct mtk_hsdam_engine *hsdma = platform_get_drvdata(pdev); ++ ++ mtk_hsdma_uninit(hsdma); ++ ++ of_dma_controller_free(pdev->dev.of_node); ++ dma_async_device_unregister(&hsdma->ddev); ++ ++ return 0; ++} ++ ++static struct platform_driver mtk_hsdma_driver = { ++ .probe = mtk_hsdma_probe, ++ .remove = mtk_hsdma_remove, ++ .driver = { ++ .name = "hsdma-mt7621", ++ .of_match_table = mtk_hsdma_of_match, ++ }, ++}; ++module_platform_driver(mtk_hsdma_driver); ++ ++MODULE_AUTHOR("Michael Lee "); ++MODULE_DESCRIPTION("MTK HSDMA driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ramips/patches-4.4/0048-asoc-add-mt7620-support.patch b/target/linux/ramips/patches-4.4/0048-asoc-add-mt7620-support.patch new file mode 100644 index 0000000000..bc1800efe4 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0048-asoc-add-mt7620-support.patch @@ -0,0 +1,1046 @@ +From 7f29222b1731e8182ba94a331531dec18865a1e4 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:31:47 +0100 +Subject: [PATCH 48/53] asoc: add mt7620 support + +Signed-off-by: John Crispin +--- + arch/mips/ralink/of.c | 2 + + sound/soc/Kconfig | 1 + + sound/soc/Makefile | 1 + + sound/soc/ralink/Kconfig | 15 ++ + sound/soc/ralink/Makefile | 11 + + sound/soc/ralink/mt7620-i2s.c | 436 ++++++++++++++++++++++++++++++++++++++ + sound/soc/ralink/mt7620-wm8960.c | 233 ++++++++++++++++++++ + 7 files changed, 699 insertions(+) + create mode 100644 sound/soc/ralink/Kconfig + create mode 100644 sound/soc/ralink/Makefile + create mode 100644 sound/soc/ralink/mt7620-i2s.c + create mode 100644 sound/soc/ralink/mt7620-wm8960.c + +--- a/arch/mips/ralink/of.c ++++ b/arch/mips/ralink/of.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -26,6 +27,7 @@ + #include "common.h" + + __iomem void *rt_sysc_membase; ++EXPORT_SYMBOL(rt_sysc_membase); + __iomem void *rt_memc_membase; + + __iomem void *plat_of_remap_node(const char *node) +--- a/sound/soc/Kconfig ++++ b/sound/soc/Kconfig +@@ -56,6 +56,7 @@ source "sound/soc/mxs/Kconfig" + source "sound/soc/pxa/Kconfig" + source "sound/soc/qcom/Kconfig" + source "sound/soc/rockchip/Kconfig" ++source "sound/soc/ralink/Kconfig" + source "sound/soc/samsung/Kconfig" + source "sound/soc/sh/Kconfig" + source "sound/soc/sirf/Kconfig" +--- a/sound/soc/Makefile ++++ b/sound/soc/Makefile +@@ -36,6 +36,7 @@ obj-$(CONFIG_SND_SOC) += kirkwood/ + obj-$(CONFIG_SND_SOC) += pxa/ + obj-$(CONFIG_SND_SOC) += qcom/ + obj-$(CONFIG_SND_SOC) += rockchip/ ++obj-$(CONFIG_SND_SOC) += ralink/ + obj-$(CONFIG_SND_SOC) += samsung/ + obj-$(CONFIG_SND_SOC) += sh/ + obj-$(CONFIG_SND_SOC) += sirf/ +--- /dev/null ++++ b/sound/soc/ralink/Kconfig +@@ -0,0 +1,8 @@ ++config SND_RALINK_SOC_I2S ++ depends on RALINK && SND_SOC && !SOC_RT288X ++ select SND_SOC_GENERIC_DMAENGINE_PCM ++ select REGMAP_MMIO ++ tristate "SoC Audio (I2S protocol) for Ralink SoC" ++ help ++ Say Y if you want to use I2S protocol and I2S codec on Ralink/MediaTek ++ based boards. +--- /dev/null ++++ b/sound/soc/ralink/Makefile +@@ -0,0 +1,6 @@ ++# ++# Ralink/MediaTek Platform Support ++# ++snd-soc-ralink-i2s-objs := ralink-i2s.o ++ ++obj-$(CONFIG_SND_RALINK_SOC_I2S) += snd-soc-ralink-i2s.o +--- /dev/null ++++ b/sound/soc/ralink/ralink-i2s.c +@@ -0,0 +1,965 @@ ++/* ++ * Copyright (C) 2010, Lars-Peter Clausen ++ * Copyright (C) 2016 Michael Lee ++ * ++ * 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 ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define DRV_NAME "ralink-i2s" ++ ++#define I2S_REG_CFG0 0x00 ++#define I2S_REG_INT_STATUS 0x04 ++#define I2S_REG_INT_EN 0x08 ++#define I2S_REG_FF_STATUS 0x0c ++#define I2S_REG_WREG 0x10 ++#define I2S_REG_RREG 0x14 ++#define I2S_REG_CFG1 0x18 ++#define I2S_REG_DIVCMP 0x20 ++#define I2S_REG_DIVINT 0x24 ++ ++/* I2S_REG_CFG0 */ ++#define I2S_REG_CFG0_EN BIT(31) ++#define I2S_REG_CFG0_DMA_EN BIT(30) ++#define I2S_REG_CFG0_BYTE_SWAP BIT(28) ++#define I2S_REG_CFG0_TX_EN BIT(24) ++#define I2S_REG_CFG0_RX_EN BIT(20) ++#define I2S_REG_CFG0_SLAVE BIT(16) ++#define I2S_REG_CFG0_RX_THRES 12 ++#define I2S_REG_CFG0_TX_THRES 4 ++#define I2S_REG_CFG0_THRES_MASK (0xf << I2S_REG_CFG0_RX_THRES) | \ ++ (4 << I2S_REG_CFG0_TX_THRES) ++#define I2S_REG_CFG0_DFT_THRES (4 << I2S_REG_CFG0_RX_THRES) | \ ++ (4 << I2S_REG_CFG0_TX_THRES) ++/* RT305x */ ++#define I2S_REG_CFG0_CLK_DIS BIT(8) ++#define I2S_REG_CFG0_TXCH_SWAP BIT(3) ++#define I2S_REG_CFG0_TXCH1_OFF BIT(2) ++#define I2S_REG_CFG0_TXCH0_OFF BIT(1) ++#define I2S_REG_CFG0_SLAVE_EN BIT(0) ++/* RT3883 */ ++#define I2S_REG_CFG0_RXCH_SWAP BIT(11) ++#define I2S_REG_CFG0_RXCH1_OFF BIT(10) ++#define I2S_REG_CFG0_RXCH0_OFF BIT(9) ++#define I2S_REG_CFG0_WS_INV BIT(0) ++/* MT7628 */ ++#define I2S_REG_CFG0_FMT_LE BIT(29) ++#define I2S_REG_CFG0_SYS_BE BIT(28) ++#define I2S_REG_CFG0_NORM_24 BIT(18) ++#define I2S_REG_CFG0_DATA_24 BIT(17) ++ ++/* I2S_REG_INT_STATUS */ ++#define I2S_REG_INT_RX_FAULT BIT(7) ++#define I2S_REG_INT_RX_OVRUN BIT(6) ++#define I2S_REG_INT_RX_UNRUN BIT(5) ++#define I2S_REG_INT_RX_THRES BIT(4) ++#define I2S_REG_INT_TX_FAULT BIT(3) ++#define I2S_REG_INT_TX_OVRUN BIT(2) ++#define I2S_REG_INT_TX_UNRUN BIT(1) ++#define I2S_REG_INT_TX_THRES BIT(0) ++#define I2S_REG_INT_TX_MASK 0xf ++#define I2S_REG_INT_RX_MASK 0xf0 ++ ++/* I2S_REG_INT_STATUS */ ++#define I2S_RX_AVCNT(x) ((x >> 4) & 0xf) ++#define I2S_TX_AVCNT(x) (x & 0xf) ++/* MT7628 */ ++#define MT7628_I2S_RX_AVCNT(x) ((x >> 8) & 0x1f) ++#define MT7628_I2S_TX_AVCNT(x) (x & 0x1f) ++ ++/* I2S_REG_CFG1 */ ++#define I2S_REG_CFG1_LBK BIT(31) ++#define I2S_REG_CFG1_EXTLBK BIT(30) ++/* RT3883 */ ++#define I2S_REG_CFG1_LEFT_J BIT(0) ++#define I2S_REG_CFG1_RIGHT_J BIT(1) ++#define I2S_REG_CFG1_FMT_MASK 0x3 ++ ++/* I2S_REG_DIVCMP */ ++#define I2S_REG_DIVCMP_CLKEN BIT(31) ++#define I2S_REG_DIVCMP_DIVCOMP_MASK 0x1ff ++ ++/* I2S_REG_DIVINT */ ++#define I2S_REG_DIVINT_MASK 0x3ff ++ ++/* BCLK dividers */ ++#define RALINK_I2S_DIVCMP 0 ++#define RALINK_I2S_DIVINT 1 ++ ++/* FIFO */ ++#define RALINK_I2S_FIFO_SIZE 32 ++ ++/* feature flags */ ++#define RALINK_FLAGS_TXONLY BIT(0) ++#define RALINK_FLAGS_LEFT_J BIT(1) ++#define RALINK_FLAGS_RIGHT_J BIT(2) ++#define RALINK_FLAGS_ENDIAN BIT(3) ++#define RALINK_FLAGS_24BIT BIT(4) ++ ++#define RALINK_I2S_INT_EN 0 ++ ++struct ralink_i2s_stats { ++ u32 dmafault; ++ u32 overrun; ++ u32 underrun; ++ u32 belowthres; ++}; ++ ++struct ralink_i2s { ++ struct device *dev; ++ void __iomem *regs; ++ struct clk *clk; ++ struct regmap *regmap; ++ u32 flags; ++ unsigned int fmt; ++ u16 txdma_req; ++ u16 rxdma_req; ++ ++ struct snd_dmaengine_dai_dma_data playback_dma_data; ++ struct snd_dmaengine_dai_dma_data capture_dma_data; ++ ++ struct dentry *dbg_dir; ++ struct dentry *dbg_stats; ++ struct ralink_i2s_stats txstats; ++ struct ralink_i2s_stats rxstats; ++}; ++ ++static void ralink_i2s_dump_regs(struct ralink_i2s *i2s) ++{ ++ u32 buf[10]; ++ int ret; ++ ++ ret = regmap_bulk_read(i2s->regmap, I2S_REG_CFG0, ++ buf, ARRAY_SIZE(buf)); ++ ++ dev_dbg(i2s->dev, "CFG0: %08x, INTSTAT: %08x, INTEN: %08x, " \ ++ "FFSTAT: %08x, WREG: %08x, RREG: %08x, " \ ++ "CFG1: %08x, DIVCMP: %08x, DIVINT: %08x\n", ++ buf[0], buf[1], buf[2], buf[3], buf[4], ++ buf[5], buf[6], buf[8], buf[9]); ++} ++ ++static int ralink_i2s_set_sysclk(struct snd_soc_dai *dai, ++ int clk_id, unsigned int freq, int dir) ++{ ++ return 0; ++} ++ ++static int ralink_i2s_set_sys_bclk(struct snd_soc_dai *dai, int width, int rate) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ unsigned long clk = clk_get_rate(i2s->clk); ++ int div; ++ uint32_t data; ++ ++ /* disable clock at slave mode */ ++ if ((i2s->fmt & SND_SOC_DAIFMT_MASTER_MASK) == ++ SND_SOC_DAIFMT_CBM_CFM) { ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_CLK_DIS, ++ I2S_REG_CFG0_CLK_DIS); ++ return 0; ++ } ++ ++ /* FREQOUT = FREQIN / (I2S_CLK_DIV + 1) */ ++ div = (clk / rate ) - 1; ++ ++ data = rt_sysc_r32(0x30); ++ data &= (0xff << 8); ++ data |= (0x1 << 15) | (div << 8); ++ rt_sysc_w32(data, 0x30); ++ ++ /* enable clock */ ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, I2S_REG_CFG0_CLK_DIS, 0); ++ ++ dev_dbg(i2s->dev, "clk: %lu, rate: %u, div: %d\n", ++ clk, rate, div); ++ ++ return 0; ++} ++ ++static int ralink_i2s_set_bclk(struct snd_soc_dai *dai, int width, int rate) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ unsigned long clk = clk_get_rate(i2s->clk); ++ int divint, divcomp; ++ ++ /* disable clock at slave mode */ ++ if ((i2s->fmt & SND_SOC_DAIFMT_MASTER_MASK) == ++ SND_SOC_DAIFMT_CBM_CFM) { ++ regmap_update_bits(i2s->regmap, I2S_REG_DIVCMP, ++ I2S_REG_DIVCMP_CLKEN, 0); ++ return 0; ++ } ++ ++ /* FREQOUT = FREQIN * (1/2) * (1/(DIVINT + DIVCOMP/512)) */ ++ clk = clk / (2 * 2 * width); ++ divint = clk / rate; ++ divcomp = ((clk % rate) * 512) / rate; ++ ++ if ((divint > I2S_REG_DIVINT_MASK) || ++ (divcomp > I2S_REG_DIVCMP_DIVCOMP_MASK)) ++ return -EINVAL; ++ ++ regmap_update_bits(i2s->regmap, I2S_REG_DIVINT, ++ I2S_REG_DIVINT_MASK, divint); ++ regmap_update_bits(i2s->regmap, I2S_REG_DIVCMP, ++ I2S_REG_DIVCMP_DIVCOMP_MASK, divcomp); ++ ++ /* enable clock */ ++ regmap_update_bits(i2s->regmap, I2S_REG_DIVCMP, I2S_REG_DIVCMP_CLKEN, ++ I2S_REG_DIVCMP_CLKEN); ++ ++ dev_dbg(i2s->dev, "clk: %lu, rate: %u, int: %d, comp: %d\n", ++ clk_get_rate(i2s->clk), rate, divint, divcomp); ++ ++ return 0; ++} ++ ++static int ralink_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ unsigned int cfg0 = 0, cfg1 = 0; ++ ++ /* set master/slave audio interface */ ++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBM_CFM: ++ if (i2s->flags & RALINK_FLAGS_TXONLY) ++ cfg0 |= I2S_REG_CFG0_SLAVE_EN; ++ else ++ cfg0 |= I2S_REG_CFG0_SLAVE; ++ break; ++ case SND_SOC_DAIFMT_CBS_CFS: ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ /* interface format */ ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_I2S: ++ break; ++ case SND_SOC_DAIFMT_RIGHT_J: ++ if (i2s->flags & RALINK_FLAGS_RIGHT_J) { ++ cfg1 |= I2S_REG_CFG1_RIGHT_J; ++ break; ++ } ++ return -EINVAL; ++ case SND_SOC_DAIFMT_LEFT_J: ++ if (i2s->flags & RALINK_FLAGS_LEFT_J) { ++ cfg1 |= I2S_REG_CFG1_LEFT_J; ++ break; ++ } ++ return -EINVAL; ++ default: ++ return -EINVAL; ++ } ++ ++ /* clock inversion */ ++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { ++ case SND_SOC_DAIFMT_NB_NF: ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (i2s->flags & RALINK_FLAGS_TXONLY) { ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_SLAVE_EN, cfg0); ++ } else { ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_SLAVE, cfg0); ++ } ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG1, ++ I2S_REG_CFG1_FMT_MASK, cfg1); ++ i2s->fmt = fmt; ++ ++ return 0; ++} ++ ++static int ralink_i2s_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ ++ if (dai->active) ++ return 0; ++ ++ /* setup status interrupt */ ++#if (RALINK_I2S_INT_EN) ++ regmap_write(i2s->regmap, I2S_REG_INT_EN, 0xff); ++#else ++ regmap_write(i2s->regmap, I2S_REG_INT_EN, 0x0); ++#endif ++ ++ /* enable */ ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_EN | I2S_REG_CFG0_DMA_EN | ++ I2S_REG_CFG0_THRES_MASK, ++ I2S_REG_CFG0_EN | I2S_REG_CFG0_DMA_EN | ++ I2S_REG_CFG0_DFT_THRES); ++ ++ return 0; ++} ++ ++static void ralink_i2s_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ ++ /* If both streams are stopped, disable module and clock */ ++ if (dai->active) ++ return; ++ ++ /* ++ * datasheet mention when disable all control regs are cleared ++ * to initial values. need reinit at startup. ++ */ ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, I2S_REG_CFG0_EN, 0); ++} ++ ++static int ralink_i2s_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ int width; ++ int ret; ++ ++ width = params_width(params); ++ switch (width) { ++ case 16: ++ if (i2s->flags & RALINK_FLAGS_24BIT) ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_DATA_24, 0); ++ break; ++ case 24: ++ if (i2s->flags & RALINK_FLAGS_24BIT) { ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_DATA_24, ++ I2S_REG_CFG0_DATA_24); ++ break; ++ } ++ return -EINVAL; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (params_channels(params)) { ++ case 2: ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (i2s->flags & RALINK_FLAGS_ENDIAN) { ++ /* system endian */ ++#ifdef SNDRV_LITTLE_ENDIAN ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_SYS_BE, 0); ++#else ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_SYS_BE, ++ I2S_REG_CFG0_SYS_BE); ++#endif ++ ++ /* data endian */ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ case SNDRV_PCM_FORMAT_S24_LE: ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_FMT_LE, ++ I2S_REG_CFG0_FMT_LE); ++ break; ++ case SNDRV_PCM_FORMAT_S16_BE: ++ case SNDRV_PCM_FORMAT_S24_BE: ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, ++ I2S_REG_CFG0_FMT_LE, 0); ++ break; ++ default: ++ return -EINVAL; ++ } ++ } ++ ++ /* setup bclk rate */ ++ if (i2s->flags & RALINK_FLAGS_TXONLY) ++ ret = ralink_i2s_set_sys_bclk(dai, width, params_rate(params)); ++ else ++ ret = ralink_i2s_set_bclk(dai, width, params_rate(params)); ++ ++ return ret; ++} ++ ++static int ralink_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ unsigned int mask, val; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ mask = I2S_REG_CFG0_TX_EN; ++ else ++ mask = I2S_REG_CFG0_RX_EN; ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ val = mask; ++ break; ++ case SNDRV_PCM_TRIGGER_STOP: ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ val = 0; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ regmap_update_bits(i2s->regmap, I2S_REG_CFG0, mask, val); ++ ++ return 0; ++} ++ ++static void ralink_i2s_init_dma_data(struct ralink_i2s *i2s, ++ struct resource *res) ++{ ++ struct snd_dmaengine_dai_dma_data *dma_data; ++ ++ /* Playback */ ++ dma_data = &i2s->playback_dma_data; ++ dma_data->addr = res->start + I2S_REG_WREG; ++ dma_data->addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ dma_data->maxburst = 1; ++ dma_data->slave_id = i2s->txdma_req; ++ ++ if (i2s->flags & RALINK_FLAGS_TXONLY) ++ return; ++ ++ /* Capture */ ++ dma_data = &i2s->capture_dma_data; ++ dma_data->addr = res->start + I2S_REG_RREG; ++ dma_data->addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ dma_data->maxburst = 1; ++ dma_data->slave_id = i2s->rxdma_req; ++} ++ ++static int ralink_i2s_dai_probe(struct snd_soc_dai *dai) ++{ ++ struct ralink_i2s *i2s = snd_soc_dai_get_drvdata(dai); ++ ++ snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data, ++ &i2s->capture_dma_data); ++ ++ return 0; ++} ++ ++static int ralink_i2s_dai_remove(struct snd_soc_dai *dai) ++{ ++ return 0; ++} ++ ++static const struct snd_soc_dai_ops ralink_i2s_dai_ops = { ++ .set_sysclk = ralink_i2s_set_sysclk, ++ .set_fmt = ralink_i2s_set_fmt, ++ .startup = ralink_i2s_startup, ++ .shutdown = ralink_i2s_shutdown, ++ .hw_params = ralink_i2s_hw_params, ++ .trigger = ralink_i2s_trigger, ++}; ++ ++static struct snd_soc_dai_driver ralink_i2s_dai = { ++ .name = DRV_NAME, ++ .probe = ralink_i2s_dai_probe, ++ .remove = ralink_i2s_dai_remove, ++ .ops = &ralink_i2s_dai_ops, ++ .capture = { ++ .stream_name = "I2S Capture", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rate_min = 5512, ++ .rate_max = 192000, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ }, ++ .playback = { ++ .stream_name = "I2S Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rate_min = 5512, ++ .rate_max = 192000, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ }, ++ .symmetric_rates = 1, ++}; ++ ++static struct snd_pcm_hardware ralink_pcm_hardware = { ++ .info = SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID | ++ SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_BLOCK_TRANSFER, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels_min = 2, ++ .channels_max = 2, ++ .period_bytes_min = PAGE_SIZE, ++ .period_bytes_max = PAGE_SIZE * 2, ++ .periods_min = 2, ++ .periods_max = 128, ++ .buffer_bytes_max = 128 * 1024, ++ .fifo_size = RALINK_I2S_FIFO_SIZE, ++}; ++ ++static const struct snd_dmaengine_pcm_config ralink_dmaengine_pcm_config = { ++ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, ++ .pcm_hardware = &ralink_pcm_hardware, ++ .prealloc_buffer_size = 256 * PAGE_SIZE, ++}; ++ ++static const struct snd_soc_component_driver ralink_i2s_component = { ++ .name = DRV_NAME, ++}; ++ ++static bool ralink_i2s_readable_reg(struct device *dev, unsigned int reg) ++{ ++ return true; ++} ++ ++static bool ralink_i2s_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case I2S_REG_INT_STATUS: ++ case I2S_REG_FF_STATUS: ++ return true; ++ } ++ return false; ++} ++ ++static bool ralink_i2s_writeable_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case I2S_REG_FF_STATUS: ++ case I2S_REG_RREG: ++ return false; ++ } ++ return true; ++} ++ ++static const struct regmap_config ralink_i2s_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .writeable_reg = ralink_i2s_writeable_reg, ++ .readable_reg = ralink_i2s_readable_reg, ++ .volatile_reg = ralink_i2s_volatile_reg, ++ .max_register = I2S_REG_DIVINT, ++}; ++ ++#if (RALINK_I2S_INT_EN) ++static irqreturn_t ralink_i2s_irq(int irq, void *devid) ++{ ++ struct ralink_i2s *i2s = devid; ++ u32 status; ++ ++ regmap_read(i2s->regmap, I2S_REG_INT_STATUS, &status); ++ if (unlikely(!status)) ++ return IRQ_NONE; ++ ++ /* tx stats */ ++ if (status & I2S_REG_INT_TX_MASK) { ++ if (status & I2S_REG_INT_TX_THRES) ++ i2s->txstats.belowthres++; ++ if (status & I2S_REG_INT_TX_UNRUN) ++ i2s->txstats.underrun++; ++ if (status & I2S_REG_INT_TX_OVRUN) ++ i2s->txstats.overrun++; ++ if (status & I2S_REG_INT_TX_FAULT) ++ i2s->txstats.dmafault++; ++ } ++ ++ /* rx stats */ ++ if (status & I2S_REG_INT_RX_MASK) { ++ if (status & I2S_REG_INT_RX_THRES) ++ i2s->rxstats.belowthres++; ++ if (status & I2S_REG_INT_RX_UNRUN) ++ i2s->rxstats.underrun++; ++ if (status & I2S_REG_INT_RX_OVRUN) ++ i2s->rxstats.overrun++; ++ if (status & I2S_REG_INT_RX_FAULT) ++ i2s->rxstats.dmafault++; ++ } ++ ++ /* clean status bits */ ++ regmap_write(i2s->regmap, I2S_REG_INT_STATUS, status); ++ ++ return IRQ_HANDLED; ++} ++#endif ++ ++#if IS_ENABLED(CONFIG_DEBUG_FS) ++static int ralink_i2s_stats_show(struct seq_file *s, void *unused) ++{ ++ struct ralink_i2s *i2s = s->private; ++ ++ seq_printf(s, "tx stats\n"); ++ seq_printf(s, "\tbelow threshold\t%u\n", i2s->txstats.belowthres); ++ seq_printf(s, "\tunder run\t%u\n", i2s->txstats.underrun); ++ seq_printf(s, "\tover run\t%u\n", i2s->txstats.overrun); ++ seq_printf(s, "\tdma fault\t%u\n", i2s->txstats.dmafault); ++ ++ seq_printf(s, "rx stats\n"); ++ seq_printf(s, "\tbelow threshold\t%u\n", i2s->rxstats.belowthres); ++ seq_printf(s, "\tunder run\t%u\n", i2s->rxstats.underrun); ++ seq_printf(s, "\tover run\t%u\n", i2s->rxstats.overrun); ++ seq_printf(s, "\tdma fault\t%u\n", i2s->rxstats.dmafault); ++ ++ ralink_i2s_dump_regs(i2s); ++ ++ return 0; ++} ++ ++static int ralink_i2s_stats_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ralink_i2s_stats_show, inode->i_private); ++} ++ ++static const struct file_operations ralink_i2s_stats_ops = { ++ .open = ralink_i2s_stats_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static inline int ralink_i2s_debugfs_create(struct ralink_i2s *i2s) ++{ ++ i2s->dbg_dir = debugfs_create_dir(dev_name(i2s->dev), NULL); ++ if (!i2s->dbg_dir) ++ return -ENOMEM; ++ ++ i2s->dbg_stats = debugfs_create_file("stats", S_IRUGO, ++ i2s->dbg_dir, i2s, &ralink_i2s_stats_ops); ++ if (!i2s->dbg_stats) { ++ debugfs_remove(i2s->dbg_dir); ++ return -ENOMEM; ++ } ++ ++ return 0; ++} ++ ++static inline void ralink_i2s_debugfs_remove(struct ralink_i2s *i2s) ++{ ++ debugfs_remove(i2s->dbg_stats); ++ debugfs_remove(i2s->dbg_dir); ++} ++#else ++static inline int ralink_i2s_debugfs_create(struct ralink_i2s *i2s) ++{ ++ return 0; ++} ++ ++static inline void ralink_i2s_debugfs_remove(struct fsl_ssi_dbg *ssi_dbg) ++{ ++} ++#endif ++ ++/* ++ * TODO: these refclk setup functions should use ++ * clock framework instead. hardcode it now. ++ */ ++static void rt3350_refclk_setup(void) ++{ ++ uint32_t data; ++ ++ /* set refclk output 12Mhz clock */ ++ data = rt_sysc_r32(0x2c); ++ data |= (0x1 << 8); ++ rt_sysc_w32(data, 0x2c); ++} ++ ++static void rt3883_refclk_setup(void) ++{ ++ uint32_t data; ++ ++ /* set refclk output 12Mhz clock */ ++ data = rt_sysc_r32(0x2c); ++ data &= ~(0x3 << 13); ++ data |= (0x1 << 13); ++ rt_sysc_w32(data, 0x2c); ++} ++ ++static void rt3552_refclk_setup(void) ++{ ++ uint32_t data; ++ ++ /* set refclk output 12Mhz clock */ ++ data = rt_sysc_r32(0x2c); ++ data &= ~(0xf << 8); ++ data |= (0x3 << 8); ++ rt_sysc_w32(data, 0x2c); ++} ++ ++static void mt7620_refclk_setup(void) ++{ ++ uint32_t data; ++ ++ /* set refclk output 12Mhz clock */ ++ data = rt_sysc_r32(0x2c); ++ data &= ~(0x7 << 9); ++ data |= 0x1 << 9; ++ rt_sysc_w32(data, 0x2c); ++} ++ ++static void mt7621_refclk_setup(void) ++{ ++ uint32_t data; ++ ++ /* set refclk output 12Mhz clock */ ++ data = rt_sysc_r32(0x2c); ++ data &= ~(0x1f << 18); ++ data |= (0x19 << 18); ++ data &= ~(0x1f << 12); ++ data |= (0x1 << 12); ++ data &= ~(0x7 << 9); ++ data |= (0x5 << 9); ++ rt_sysc_w32(data, 0x2c); ++} ++ ++static void mt7628_refclk_setup(void) ++{ ++ uint32_t data; ++ ++ /* set i2s and refclk digital pad */ ++ data = rt_sysc_r32(0x3c); ++ data |= 0x1f; ++ rt_sysc_w32(data, 0x3c); ++ ++ /* Adjust REFCLK0's driving strength */ ++ data = rt_sysc_r32(0x1354); ++ data &= ~(0x1 << 5); ++ rt_sysc_w32(data, 0x1354); ++ data = rt_sysc_r32(0x1364); ++ data |= ~(0x1 << 5); ++ rt_sysc_w32(data, 0x1364); ++ ++ /* set refclk output 12Mhz clock */ ++ data = rt_sysc_r32(0x2c); ++ data &= ~(0x7 << 9); ++ data |= 0x1 << 9; ++ rt_sysc_w32(data, 0x2c); ++} ++ ++struct rt_i2s_data { ++ u32 flags; ++ void (*refclk_setup)(void); ++}; ++ ++struct rt_i2s_data rt3050_i2s_data = { .flags = RALINK_FLAGS_TXONLY }; ++struct rt_i2s_data rt3350_i2s_data = { .flags = RALINK_FLAGS_TXONLY, ++ .refclk_setup = rt3350_refclk_setup }; ++struct rt_i2s_data rt3883_i2s_data = { ++ .flags = (RALINK_FLAGS_LEFT_J | RALINK_FLAGS_RIGHT_J), ++ .refclk_setup = rt3883_refclk_setup }; ++struct rt_i2s_data rt3352_i2s_data = { .refclk_setup = rt3552_refclk_setup}; ++struct rt_i2s_data mt7620_i2s_data = { .refclk_setup = mt7620_refclk_setup}; ++struct rt_i2s_data mt7621_i2s_data = { .refclk_setup = mt7621_refclk_setup}; ++struct rt_i2s_data mt7628_i2s_data = { ++ .flags = (RALINK_FLAGS_ENDIAN | RALINK_FLAGS_24BIT | ++ RALINK_FLAGS_LEFT_J), ++ .refclk_setup = mt7628_refclk_setup}; ++ ++static const struct of_device_id ralink_i2s_match_table[] = { ++ { .compatible = "ralink,rt3050-i2s", ++ .data = (void *)&rt3050_i2s_data }, ++ { .compatible = "ralink,rt3350-i2s", ++ .data = (void *)&rt3350_i2s_data }, ++ { .compatible = "ralink,rt3883-i2s", ++ .data = (void *)&rt3883_i2s_data }, ++ { .compatible = "ralink,rt3352-i2s", ++ .data = (void *)&rt3352_i2s_data }, ++ { .compatible = "mediatek,mt7620-i2s", ++ .data = (void *)&mt7620_i2s_data }, ++ { .compatible = "mediatek,mt7621-i2s", ++ .data = (void *)&mt7621_i2s_data }, ++ { .compatible = "mediatek,mt7628-i2s", ++ .data = (void *)&mt7628_i2s_data }, ++}; ++MODULE_DEVICE_TABLE(of, ralink_i2s_match_table); ++ ++static int ralink_i2s_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *match; ++ struct device_node *np = pdev->dev.of_node; ++ struct ralink_i2s *i2s; ++ struct resource *res; ++ int irq, ret; ++ u32 dma_req; ++ struct rt_i2s_data *data; ++ ++ i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); ++ if (!i2s) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, i2s); ++ i2s->dev = &pdev->dev; ++ ++ match = of_match_device(ralink_i2s_match_table, &pdev->dev); ++ if (!match) ++ return -EINVAL; ++ data = (struct rt_i2s_data *)match->data; ++ i2s->flags = data->flags; ++ /* setup out 12Mhz refclk to codec as mclk */ ++ if (data->refclk_setup) ++ data->refclk_setup(); ++ ++ if (of_property_read_u32(np, "txdma-req", &dma_req)) { ++ dev_err(&pdev->dev, "no txdma-req define\n"); ++ return -EINVAL; ++ } ++ i2s->txdma_req = (u16)dma_req; ++ if (!(i2s->flags & RALINK_FLAGS_TXONLY)) { ++ if (of_property_read_u32(np, "rxdma-req", &dma_req)) { ++ dev_err(&pdev->dev, "no rxdma-req define\n"); ++ return -EINVAL; ++ } ++ i2s->rxdma_req = (u16)dma_req; ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ i2s->regs = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(i2s->regs)) ++ return PTR_ERR(i2s->regs); ++ ++ i2s->regmap = devm_regmap_init_mmio(&pdev->dev, i2s->regs, ++ &ralink_i2s_regmap_config); ++ if (IS_ERR(i2s->regmap)) { ++ dev_err(&pdev->dev, "regmap init failed\n"); ++ return PTR_ERR(i2s->regmap); ++ } ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ dev_err(&pdev->dev, "failed to get irq\n"); ++ return -EINVAL; ++ } ++ ++#if (RALINK_I2S_INT_EN) ++ ret = devm_request_irq(&pdev->dev, irq, ralink_i2s_irq, ++ 0, dev_name(&pdev->dev), i2s); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to request irq\n"); ++ return ret; ++ } ++#endif ++ ++ i2s->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(i2s->clk)) { ++ dev_err(&pdev->dev, "no clock defined\n"); ++ return PTR_ERR(i2s->clk); ++ } ++ ++ ret = clk_prepare_enable(i2s->clk); ++ if (ret) ++ return ret; ++ ++ ralink_i2s_init_dma_data(i2s, res); ++ ++ device_reset(&pdev->dev); ++ ++ ret = ralink_i2s_debugfs_create(i2s); ++ if (ret) { ++ dev_err(&pdev->dev, "create debugfs failed\n"); ++ goto err_clk_disable; ++ } ++ ++ /* enable 24bits support */ ++ if (i2s->flags & RALINK_FLAGS_24BIT) { ++ ralink_i2s_dai.capture.formats |= SNDRV_PCM_FMTBIT_S24_LE; ++ ralink_i2s_dai.playback.formats |= SNDRV_PCM_FMTBIT_S24_LE; ++ } ++ ++ /* enable big endian support */ ++ if (i2s->flags & RALINK_FLAGS_ENDIAN) { ++ ralink_i2s_dai.capture.formats |= SNDRV_PCM_FMTBIT_S16_BE; ++ ralink_i2s_dai.playback.formats |= SNDRV_PCM_FMTBIT_S16_BE; ++ ralink_pcm_hardware.formats |= SNDRV_PCM_FMTBIT_S16_BE; ++ if (i2s->flags & RALINK_FLAGS_24BIT) { ++ ralink_i2s_dai.capture.formats |= ++ SNDRV_PCM_FMTBIT_S24_BE; ++ ralink_i2s_dai.playback.formats |= ++ SNDRV_PCM_FMTBIT_S24_BE; ++ ralink_pcm_hardware.formats |= ++ SNDRV_PCM_FMTBIT_S24_BE; ++ } ++ } ++ ++ /* disable capture support */ ++ if (i2s->flags & RALINK_FLAGS_TXONLY) ++ memset(&ralink_i2s_dai.capture, sizeof(ralink_i2s_dai.capture), ++ 0); ++ ++ ret = devm_snd_soc_register_component(&pdev->dev, &ralink_i2s_component, ++ &ralink_i2s_dai, 1); ++ if (ret) ++ goto err_debugfs; ++ ++ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, ++ &ralink_dmaengine_pcm_config, ++ SND_DMAENGINE_PCM_FLAG_COMPAT); ++ if (ret) ++ goto err_debugfs; ++ ++ dev_info(i2s->dev, "mclk %luKHz\n", clk_get_rate(i2s->clk) / 1000000); ++ ++ return 0; ++ ++err_debugfs: ++ ralink_i2s_debugfs_remove(i2s); ++ ++err_clk_disable: ++ clk_disable_unprepare(i2s->clk); ++ ++ return ret; ++} ++ ++static int ralink_i2s_remove(struct platform_device *pdev) ++{ ++ struct ralink_i2s *i2s = platform_get_drvdata(pdev); ++ ++ ralink_i2s_debugfs_remove(i2s); ++ clk_disable_unprepare(i2s->clk); ++ ++ return 0; ++} ++ ++static struct platform_driver ralink_i2s_driver = { ++ .probe = ralink_i2s_probe, ++ .remove = ralink_i2s_remove, ++ .driver = { ++ .name = DRV_NAME, ++ .of_match_table = ralink_i2s_match_table, ++ }, ++}; ++module_platform_driver(ralink_i2s_driver); ++ ++MODULE_AUTHOR("Lars-Peter Clausen, "); ++MODULE_DESCRIPTION("Ralink/MediaTek I2S driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:" DRV_NAME); diff --git a/target/linux/ramips/patches-4.4/0049-watchdog-add-MT7621-support.patch b/target/linux/ramips/patches-4.4/0049-watchdog-add-MT7621-support.patch new file mode 100644 index 0000000000..529a801dc5 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0049-watchdog-add-MT7621-support.patch @@ -0,0 +1,227 @@ +From 77fe64de72317c0e090d82056e7a6a073f2972b4 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 16 Mar 2014 05:24:42 +0000 +Subject: [PATCH 49/53] watchdog: add MT7621 support + +Signed-off-by: John Crispin +--- + drivers/watchdog/Kconfig | 7 ++ + drivers/watchdog/Makefile | 1 + + drivers/watchdog/mt7621_wdt.c | 185 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 193 insertions(+) + create mode 100644 drivers/watchdog/mt7621_wdt.c + +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1345,6 +1345,13 @@ config RALINK_WDT + help + Hardware driver for the Ralink SoC Watchdog Timer. + ++config MT7621_WDT ++ tristate "Mediatek SoC watchdog" ++ select WATCHDOG_CORE ++ depends on SOC_MT7620 || SOC_MT7621 ++ help ++ Hardware driver for the Ralink SoC Watchdog Timer. ++ + # PARISC Architecture + + # POWERPC Architecture +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -69,6 +69,7 @@ obj-$(CONFIG_MEDIATEK_WATCHDOG) += mtk_w + obj-$(CONFIG_DIGICOLOR_WATCHDOG) += digicolor_wdt.o + obj-$(CONFIG_LPC18XX_WATCHDOG) += lpc18xx_wdt.o + obj-$(CONFIG_BCM7038_WDT) += bcm7038_wdt.o ++obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o + + # AVR32 Architecture + obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o +--- /dev/null ++++ b/drivers/watchdog/mt7621_wdt.c +@@ -0,0 +1,185 @@ ++/* ++ * Ralink RT288x/RT3xxx/MT76xx built-in hardware watchdog timer ++ * ++ * Copyright (C) 2011 Gabor Juhos ++ * Copyright (C) 2013 John Crispin ++ * ++ * This driver was based on: drivers/watchdog/softdog.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 ++#include ++#include ++#include ++ ++#include ++ ++#define SYSC_RSTSTAT 0x38 ++#define WDT_RST_CAUSE BIT(1) ++ ++#define RALINK_WDT_TIMEOUT 30 ++ ++#define TIMER_REG_TMRSTAT 0x00 ++#define TIMER_REG_TMR1LOAD 0x24 ++#define TIMER_REG_TMR1CTL 0x20 ++ ++#define TMR1CTL_ENABLE BIT(7) ++#define TMR1CTL_RESTART BIT(9) ++ ++static void __iomem *mt762x_wdt_base; ++ ++static bool nowayout = WATCHDOG_NOWAYOUT; ++module_param(nowayout, bool, 0); ++MODULE_PARM_DESC(nowayout, ++ "Watchdog cannot be stopped once started (default=" ++ __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); ++ ++static inline void rt_wdt_w32(unsigned reg, u32 val) ++{ ++ iowrite32(val, mt762x_wdt_base + reg); ++} ++ ++static inline u32 rt_wdt_r32(unsigned reg) ++{ ++ return ioread32(mt762x_wdt_base + reg); ++} ++ ++static int mt762x_wdt_ping(struct watchdog_device *w) ++{ ++ rt_wdt_w32(TIMER_REG_TMRSTAT, TMR1CTL_RESTART); ++ ++ return 0; ++} ++ ++static int mt762x_wdt_set_timeout(struct watchdog_device *w, unsigned int t) ++{ ++ w->timeout = t; ++ rt_wdt_w32(TIMER_REG_TMR1LOAD, t * 1000); ++ mt762x_wdt_ping(w); ++ ++ return 0; ++} ++ ++static int mt762x_wdt_start(struct watchdog_device *w) ++{ ++ u32 t; ++ ++ rt_wdt_w32(TIMER_REG_TMR1CTL, 1000 << 16); ++ mt762x_wdt_set_timeout(w, w->timeout); ++ ++ t = rt_wdt_r32(TIMER_REG_TMR1CTL); ++ t |= TMR1CTL_ENABLE; ++ rt_wdt_w32(TIMER_REG_TMR1CTL, t); ++ ++ return 0; ++} ++ ++static int mt762x_wdt_stop(struct watchdog_device *w) ++{ ++ u32 t; ++ ++ mt762x_wdt_ping(w); ++ ++ t = rt_wdt_r32(TIMER_REG_TMR1CTL); ++ t &= ~TMR1CTL_ENABLE; ++ rt_wdt_w32(TIMER_REG_TMR1CTL, t); ++ ++ return 0; ++} ++ ++static int mt762x_wdt_bootcause(void) ++{ ++ if (rt_sysc_r32(SYSC_RSTSTAT) & WDT_RST_CAUSE) ++ return WDIOF_CARDRESET; ++ ++ return 0; ++} ++ ++static struct watchdog_info mt762x_wdt_info = { ++ .identity = "Mediatek Watchdog", ++ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, ++}; ++ ++static struct watchdog_ops mt762x_wdt_ops = { ++ .owner = THIS_MODULE, ++ .start = mt762x_wdt_start, ++ .stop = mt762x_wdt_stop, ++ .ping = mt762x_wdt_ping, ++ .set_timeout = mt762x_wdt_set_timeout, ++}; ++ ++static struct watchdog_device mt762x_wdt_dev = { ++ .info = &mt762x_wdt_info, ++ .ops = &mt762x_wdt_ops, ++ .min_timeout = 1, ++}; ++ ++static int mt762x_wdt_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ int ret; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mt762x_wdt_base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(mt762x_wdt_base)) ++ return PTR_ERR(mt762x_wdt_base); ++ ++ device_reset(&pdev->dev); ++ ++ mt762x_wdt_dev.dev = &pdev->dev; ++ mt762x_wdt_dev.bootstatus = mt762x_wdt_bootcause(); ++ mt762x_wdt_dev.max_timeout = (0xfffful / 1000); ++ mt762x_wdt_dev.timeout = mt762x_wdt_dev.max_timeout; ++ ++ watchdog_set_nowayout(&mt762x_wdt_dev, nowayout); ++ ++ ret = watchdog_register_device(&mt762x_wdt_dev); ++ if (!ret) ++ dev_info(&pdev->dev, "Initialized\n"); ++ ++ return 0; ++} ++ ++static int mt762x_wdt_remove(struct platform_device *pdev) ++{ ++ watchdog_unregister_device(&mt762x_wdt_dev); ++ ++ return 0; ++} ++ ++static void mt762x_wdt_shutdown(struct platform_device *pdev) ++{ ++ mt762x_wdt_stop(&mt762x_wdt_dev); ++} ++ ++static const struct of_device_id mt762x_wdt_match[] = { ++ { .compatible = "mtk,mt7621-wdt" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mt762x_wdt_match); ++ ++static struct platform_driver mt762x_wdt_driver = { ++ .probe = mt762x_wdt_probe, ++ .remove = mt762x_wdt_remove, ++ .shutdown = mt762x_wdt_shutdown, ++ .driver = { ++ .name = KBUILD_MODNAME, ++ .owner = THIS_MODULE, ++ .of_match_table = mt762x_wdt_match, ++ }, ++}; ++ ++module_platform_driver(mt762x_wdt_driver); ++ ++MODULE_DESCRIPTION("MediaTek MT762x hardware watchdog driver"); ++MODULE_AUTHOR("John Crispin +Date: Mon, 7 Dec 2015 17:31:08 +0100 +Subject: [PATCH 51/53] serial: add ugly custom baud rate hack + +Signed-off-by: John Crispin +--- + drivers/tty/serial/serial_core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -359,6 +359,9 @@ uart_get_baud_rate(struct uart_port *por + break; + } + ++ if (tty_termios_baud_rate(termios) == 2500000) ++ return 250000; ++ + for (try = 0; try < 2; try++) { + baud = tty_termios_baud_rate(termios); + diff --git a/target/linux/ramips/patches-4.4/0052-pwm-add-mediatek-support.patch b/target/linux/ramips/patches-4.4/0052-pwm-add-mediatek-support.patch new file mode 100644 index 0000000000..d15f38c631 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0052-pwm-add-mediatek-support.patch @@ -0,0 +1,217 @@ +From fc8f96309c21c1bc3276427309cd7d361347d66e Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 7 Dec 2015 17:16:50 +0100 +Subject: [PATCH 52/53] pwm: add mediatek support + +Signed-off-by: John Crispin +--- + drivers/pwm/Kconfig | 9 +++ + drivers/pwm/Makefile | 1 + + drivers/pwm/pwm-mediatek.c | 173 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 183 insertions(+) + create mode 100644 drivers/pwm/pwm-mediatek.c + +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -260,6 +260,15 @@ config PWM_MTK_DISP + To compile this driver as a module, choose M here: the module + will be called pwm-mtk-disp. + ++config PWM_MEDIATEK ++ tristate "Mediatek PWM support" ++ depends on RALINK && OF ++ help ++ Generic PWM framework driver for Mediatek ARM SoC. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called pwm-mxs. ++ + config PWM_MXS + tristate "Freescale MXS PWM support" + depends on ARCH_MXS && OF +--- a/drivers/pwm/Makefile ++++ b/drivers/pwm/Makefile +@@ -22,6 +22,7 @@ obj-$(CONFIG_PWM_LPC32XX) += pwm-lpc32xx + obj-$(CONFIG_PWM_LPSS) += pwm-lpss.o + obj-$(CONFIG_PWM_LPSS_PCI) += pwm-lpss-pci.o + obj-$(CONFIG_PWM_LPSS_PLATFORM) += pwm-lpss-platform.o ++obj-$(CONFIG_PWM_MEDIATEK) += pwm-mediatek.o + obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o + obj-$(CONFIG_PWM_MXS) += pwm-mxs.o + obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o +--- /dev/null ++++ b/drivers/pwm/pwm-mediatek.c +@@ -0,0 +1,173 @@ ++/* ++ * Mediatek Pulse Width Modulator driver ++ * ++ * Copyright (C) 2015 John Crispin ++ * ++ * 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 ++ ++#define NUM_PWM 4 ++ ++/* PWM registers and bits definitions */ ++#define PWMCON 0x00 ++#define PWMHDUR 0x04 ++#define PWMLDUR 0x08 ++#define PWMGDUR 0x0c ++#define PWMWAVENUM 0x28 ++#define PWMDWIDTH 0x2c ++#define PWMTHRES 0x30 ++ ++/** ++ * struct mtk_pwm_chip - struct representing pwm chip ++ * ++ * @mmio_base: base address of pwm chip ++ * @chip: linux pwm chip representation ++ */ ++struct mtk_pwm_chip { ++ void __iomem *mmio_base; ++ struct pwm_chip chip; ++}; ++ ++static inline struct mtk_pwm_chip *to_mtk_pwm_chip(struct pwm_chip *chip) ++{ ++ return container_of(chip, struct mtk_pwm_chip, chip); ++} ++ ++static inline u32 mtk_pwm_readl(struct mtk_pwm_chip *chip, unsigned int num, ++ unsigned long offset) ++{ ++ return ioread32(chip->mmio_base + 0x10 + (num * 0x40) + offset); ++} ++ ++static inline void mtk_pwm_writel(struct mtk_pwm_chip *chip, ++ unsigned int num, unsigned long offset, ++ unsigned long val) ++{ ++ iowrite32(val, chip->mmio_base + 0x10 + (num * 0x40) + offset); ++} ++ ++static int mtk_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ++ int duty_ns, int period_ns) ++{ ++ struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip); ++ u32 resolution = 100 / 4; ++ u32 clkdiv = 0; ++ ++ while (period_ns / resolution > 8191) { ++ clkdiv++; ++ resolution *= 2; ++ } ++ ++ if (clkdiv > 7) ++ return -1; ++ ++ mtk_pwm_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | BIT(3) | clkdiv); ++ mtk_pwm_writel(pc, pwm->hwpwm, PWMDWIDTH, period_ns / resolution); ++ mtk_pwm_writel(pc, pwm->hwpwm, PWMTHRES, duty_ns / resolution); ++ return 0; ++} ++ ++static int mtk_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ++{ ++ struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip); ++ u32 val; ++ ++ val = ioread32(pc->mmio_base); ++ val |= BIT(pwm->hwpwm); ++ iowrite32(val, pc->mmio_base); ++ ++ return 0; ++} ++ ++static void mtk_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) ++{ ++ struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip); ++ u32 val; ++ ++ val = ioread32(pc->mmio_base); ++ val &= ~BIT(pwm->hwpwm); ++ iowrite32(val, pc->mmio_base); ++} ++ ++static const struct pwm_ops mtk_pwm_ops = { ++ .config = mtk_pwm_config, ++ .enable = mtk_pwm_enable, ++ .disable = mtk_pwm_disable, ++ .owner = THIS_MODULE, ++}; ++ ++static int mtk_pwm_probe(struct platform_device *pdev) ++{ ++ struct mtk_pwm_chip *pc; ++ struct resource *r; ++ int ret; ++ ++ pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); ++ if (!pc) ++ return -ENOMEM; ++ ++ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ pc->mmio_base = devm_ioremap_resource(&pdev->dev, r); ++ if (IS_ERR(pc->mmio_base)) ++ return PTR_ERR(pc->mmio_base); ++ ++ platform_set_drvdata(pdev, pc); ++ ++ pc->chip.dev = &pdev->dev; ++ pc->chip.ops = &mtk_pwm_ops; ++ pc->chip.base = -1; ++ pc->chip.npwm = NUM_PWM; ++ ++ ret = pwmchip_add(&pc->chip); ++ if (ret < 0) ++ dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); ++ ++ return ret; ++} ++ ++static int mtk_pwm_remove(struct platform_device *pdev) ++{ ++ struct mtk_pwm_chip *pc = platform_get_drvdata(pdev); ++ int i; ++ ++ for (i = 0; i < NUM_PWM; i++) ++ pwm_disable(&pc->chip.pwms[i]); ++ ++ return pwmchip_remove(&pc->chip); ++} ++ ++static const struct of_device_id mtk_pwm_of_match[] = { ++ { .compatible = "mediatek,mt7628-pwm" }, ++ { } ++}; ++ ++MODULE_DEVICE_TABLE(of, mtk_pwm_of_match); ++ ++static struct platform_driver mtk_pwm_driver = { ++ .driver = { ++ .name = "mtk-pwm", ++ .owner = THIS_MODULE, ++ .of_match_table = mtk_pwm_of_match, ++ }, ++ .probe = mtk_pwm_probe, ++ .remove = mtk_pwm_remove, ++}; ++ ++module_platform_driver(mtk_pwm_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("John Crispin "); ++MODULE_ALIAS("platform:mtk-pwm"); diff --git a/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch new file mode 100644 index 0000000000..8eef3affed --- /dev/null +++ b/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch @@ -0,0 +1,123 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -1014,6 +1014,66 @@ write_err: + return ret; + } + ++static int spi_nor_chunked_write(struct mtd_info *mtd, loff_t _to, size_t _len, ++ size_t *_retlen, const u_char *_buf) ++{ ++ struct spi_nor *nor = mtd_to_spi_nor(mtd); ++ int chunk_size; ++ int retlen = 0; ++ int ret; ++ ++ chunk_size = nor->chunk_size; ++ if (!chunk_size) ++ chunk_size = _len; ++ ++ if (nor->addr_width > 3) ++ chunk_size -= nor->addr_width - 3; ++ ++ while (retlen < _len) { ++ size_t len = min_t(int, chunk_size, _len - retlen); ++ const u_char *buf = _buf + retlen; ++ loff_t to = _to + retlen; ++ ++ if (nor->flags & SNOR_F_SST) ++ ret = sst_write(mtd, to, len, &retlen, buf); ++ else ++ ret = spi_nor_write(mtd, to, len, &retlen, buf); ++ if (ret) ++ return ret; ++ } ++ ++ *_retlen += retlen; ++ return 0; ++} ++ ++static int spi_nor_chunked_read(struct mtd_info *mtd, loff_t _from, size_t _len, ++ size_t *_retlen, u_char *_buf) ++{ ++ struct spi_nor *nor = mtd_to_spi_nor(mtd); ++ int chunk_size; ++ int ret; ++ ++ chunk_size = nor->chunk_size; ++ if (!chunk_size) ++ chunk_size = _len; ++ ++ *_retlen = 0; ++ while (*_retlen < _len) { ++ size_t len = min_t(int, chunk_size, _len - *_retlen); ++ u_char *buf = _buf + *_retlen; ++ loff_t from = _from + *_retlen; ++ int retlen = 0; ++ ++ ret = spi_nor_read(mtd, from, len, &retlen, buf); ++ if (ret) ++ return ret; ++ ++ *_retlen += retlen; ++ } ++ ++ return 0; ++} ++ + static int macronix_quad_enable(struct spi_nor *nor) + { + int ret, val; +@@ -1194,10 +1254,12 @@ int spi_nor_scan(struct spi_nor *nor, co + } + + /* sst nor chips use AAI word program */ +- if (info->flags & SST_WRITE) ++ if (info->flags & SST_WRITE) { + mtd->_write = sst_write; +- else ++ nor->flags |= SNOR_F_SST; ++ } else { + mtd->_write = spi_nor_write; ++ } + + if (info->flags & USE_FSR) + nor->flags |= SNOR_F_USE_FSR; +@@ -1225,11 +1287,20 @@ int spi_nor_scan(struct spi_nor *nor, co + mtd->writebufsize = nor->page_size; + + if (np) { ++ u32 val; ++ + /* If we were instantiated by DT, use it */ + if (of_property_read_bool(np, "m25p,fast-read")) + nor->flash_read = SPI_NOR_FAST; + else + nor->flash_read = SPI_NOR_NORMAL; ++ ++ if (!of_property_read_u32(np, "m25p,chunked-io", &val)) { ++ dev_info(dev, "using chunked io (size=%d)\n", val); ++ mtd->_read = spi_nor_chunked_read; ++ mtd->_write = spi_nor_chunked_write; ++ nor->chunk_size = val; ++ } + } else { + /* If we weren't instantiated by DT, default to fast-read */ + nor->flash_read = SPI_NOR_FAST; +--- a/include/linux/mtd/spi-nor.h ++++ b/include/linux/mtd/spi-nor.h +@@ -116,6 +116,7 @@ enum spi_nor_ops { + + enum spi_nor_option_flags { + SNOR_F_USE_FSR = BIT(0), ++ SNOR_F_SST = BIT(1), + }; + + /** +@@ -156,6 +157,7 @@ struct spi_nor { + struct device *dev; + struct device_node *flash_node; + u32 page_size; ++ u16 chunk_size; + u8 addr_width; + u8 erase_opcode; + u8 read_opcode; diff --git a/target/linux/ramips/patches-4.4/0059-correct-CPC_BASE_MASK.patch b/target/linux/ramips/patches-4.4/0059-correct-CPC_BASE_MASK.patch new file mode 100644 index 0000000000..11157bd4b2 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0059-correct-CPC_BASE_MASK.patch @@ -0,0 +1,13 @@ +--- a/arch/mips/include/asm/mips-cm.h ++++ b/arch/mips/include/asm/mips-cm.h +@@ -286,8 +286,8 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) + #define CM_GCR_GIC_BASE_GICEN_MSK (_ULCAST_(0x1) << 0) + + /* GCR_CPC_BASE register fields */ +-#define CM_GCR_CPC_BASE_CPCBASE_SHF 17 +-#define CM_GCR_CPC_BASE_CPCBASE_MSK (_ULCAST_(0x7fff) << 17) ++#define CM_GCR_CPC_BASE_CPCBASE_SHF 15 ++#define CM_GCR_CPC_BASE_CPCBASE_MSK (_ULCAST_(0x1ffff) << 15) + #define CM_GCR_CPC_BASE_CPCEN_SHF 0 + #define CM_GCR_CPC_BASE_CPCEN_MSK (_ULCAST_(0x1) << 0) + diff --git a/target/linux/ramips/patches-4.4/0063-set-CM_GCR_BASE_CMDEFTGT_MEM-according-to-datasheet.patch b/target/linux/ramips/patches-4.4/0063-set-CM_GCR_BASE_CMDEFTGT_MEM-according-to-datasheet.patch new file mode 100644 index 0000000000..55fd70131d --- /dev/null +++ b/target/linux/ramips/patches-4.4/0063-set-CM_GCR_BASE_CMDEFTGT_MEM-according-to-datasheet.patch @@ -0,0 +1,12 @@ +--- a/arch/mips/include/asm/mips-cm.h ++++ b/arch/mips/include/asm/mips-cm.h +@@ -238,8 +238,7 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) + #define CM_GCR_BASE_GCRBASE_MSK (_ULCAST_(0x1ffff) << 15) + #define CM_GCR_BASE_CMDEFTGT_SHF 0 + #define CM_GCR_BASE_CMDEFTGT_MSK (_ULCAST_(0x3) << 0) +-#define CM_GCR_BASE_CMDEFTGT_DISABLED 0 +-#define CM_GCR_BASE_CMDEFTGT_MEM 1 ++#define CM_GCR_BASE_CMDEFTGT_MEM 0 + #define CM_GCR_BASE_CMDEFTGT_IOCU0 2 + #define CM_GCR_BASE_CMDEFTGT_IOCU1 3 + diff --git a/target/linux/ramips/patches-4.4/0064-add_clk_round_rate.patch b/target/linux/ramips/patches-4.4/0064-add_clk_round_rate.patch new file mode 100644 index 0000000000..86d98b087c --- /dev/null +++ b/target/linux/ramips/patches-4.4/0064-add_clk_round_rate.patch @@ -0,0 +1,15 @@ +--- a/arch/mips/ralink/clk.c ++++ b/arch/mips/ralink/clk.c +@@ -62,6 +62,12 @@ int clk_set_rate(struct clk *clk, unsign + } + EXPORT_SYMBOL_GPL(clk_set_rate); + ++long clk_round_rate(struct clk *clk, unsigned long rate) ++{ ++ return -1; ++} ++EXPORT_SYMBOL_GPL(clk_round_rate); ++ + void __init plat_time_init(void) + { + struct clk *clk; diff --git a/target/linux/ramips/patches-4.4/0065-MIPS-ralink-MT7688-pinmux-fixes.patch b/target/linux/ramips/patches-4.4/0065-MIPS-ralink-MT7688-pinmux-fixes.patch new file mode 100644 index 0000000000..18571e6928 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0065-MIPS-ralink-MT7688-pinmux-fixes.patch @@ -0,0 +1,166 @@ +From e906a5f67e5a3337d696ec848e9c28fc68b39aa3 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Jan 2016 20:23:56 +0100 +Subject: [PATCH] MIPS: ralink: MT7688 pinmux fixes + +A few fixes to the pinmux data, 2 new muxes and a minor whitespace +cleanup. + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/11991/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 80 +++++++++++++++++++++++++++++------------------ + 1 file changed, 50 insertions(+), 30 deletions(-) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -107,31 +107,31 @@ static struct rt2880_pmx_group mt7620a_p + }; + + static struct rt2880_pmx_func pwm1_grp_mt7628[] = { +- FUNC("sdcx", 3, 19, 1), ++ FUNC("sdxc d6", 3, 19, 1), + FUNC("utif", 2, 19, 1), + FUNC("gpio", 1, 19, 1), +- FUNC("pwm", 0, 19, 1), ++ FUNC("pwm1", 0, 19, 1), + }; + + static struct rt2880_pmx_func pwm0_grp_mt7628[] = { +- FUNC("sdcx", 3, 18, 1), ++ FUNC("sdxc d7", 3, 18, 1), + FUNC("utif", 2, 18, 1), + FUNC("gpio", 1, 18, 1), +- FUNC("pwm", 0, 18, 1), ++ FUNC("pwm0", 0, 18, 1), + }; + + static struct rt2880_pmx_func uart2_grp_mt7628[] = { +- FUNC("sdcx", 3, 20, 2), ++ FUNC("sdxc d5 d4", 3, 20, 2), + FUNC("pwm", 2, 20, 2), + FUNC("gpio", 1, 20, 2), +- FUNC("uart", 0, 20, 2), ++ FUNC("uart2", 0, 20, 2), + }; + + static struct rt2880_pmx_func uart1_grp_mt7628[] = { +- FUNC("sdcx", 3, 45, 2), ++ FUNC("sw_r", 3, 45, 2), + FUNC("pwm", 2, 45, 2), + FUNC("gpio", 1, 45, 2), +- FUNC("uart", 0, 45, 2), ++ FUNC("uart1", 0, 45, 2), + }; + + static struct rt2880_pmx_func i2c_grp_mt7628[] = { +@@ -143,21 +143,21 @@ static struct rt2880_pmx_func i2c_grp_mt + + static struct rt2880_pmx_func refclk_grp_mt7628[] = { FUNC("reclk", 0, 36, 1) }; + static struct rt2880_pmx_func perst_grp_mt7628[] = { FUNC("perst", 0, 37, 1) }; +-static struct rt2880_pmx_func wdt_grp_mt7628[] = { FUNC("wdt", 0, 15, 38) }; ++static struct rt2880_pmx_func wdt_grp_mt7628[] = { FUNC("wdt", 0, 38, 1) }; + static struct rt2880_pmx_func spi_grp_mt7628[] = { FUNC("spi", 0, 7, 4) }; + + static struct rt2880_pmx_func sd_mode_grp_mt7628[] = { + FUNC("jtag", 3, 22, 8), + FUNC("utif", 2, 22, 8), + FUNC("gpio", 1, 22, 8), +- FUNC("sdcx", 0, 22, 8), ++ FUNC("sdxc", 0, 22, 8), + }; + + static struct rt2880_pmx_func uart0_grp_mt7628[] = { + FUNC("-", 3, 12, 2), + FUNC("-", 2, 12, 2), + FUNC("gpio", 1, 12, 2), +- FUNC("uart", 0, 12, 2), ++ FUNC("uart0", 0, 12, 2), + }; + + static struct rt2880_pmx_func i2s_grp_mt7628[] = { +@@ -171,7 +171,7 @@ static struct rt2880_pmx_func spi_cs1_gr + FUNC("-", 3, 6, 1), + FUNC("refclk", 2, 6, 1), + FUNC("gpio", 1, 6, 1), +- FUNC("spi", 0, 6, 1), ++ FUNC("spi cs1", 0, 6, 1), + }; + + static struct rt2880_pmx_func spis_grp_mt7628[] = { +@@ -188,28 +188,44 @@ static struct rt2880_pmx_func gpio_grp_m + FUNC("gpio", 0, 11, 1), + }; + +-#define MT7628_GPIO_MODE_MASK 0x3 +- +-#define MT7628_GPIO_MODE_PWM1 30 +-#define MT7628_GPIO_MODE_PWM0 28 +-#define MT7628_GPIO_MODE_UART2 26 +-#define MT7628_GPIO_MODE_UART1 24 +-#define MT7628_GPIO_MODE_I2C 20 +-#define MT7628_GPIO_MODE_REFCLK 18 +-#define MT7628_GPIO_MODE_PERST 16 +-#define MT7628_GPIO_MODE_WDT 14 +-#define MT7628_GPIO_MODE_SPI 12 +-#define MT7628_GPIO_MODE_SDMODE 10 +-#define MT7628_GPIO_MODE_UART0 8 +-#define MT7628_GPIO_MODE_I2S 6 +-#define MT7628_GPIO_MODE_CS1 4 +-#define MT7628_GPIO_MODE_SPIS 2 +-#define MT7628_GPIO_MODE_GPIO 0 ++static struct rt2880_pmx_func wled_kn_grp_mt7628[] = { ++ FUNC("rsvd", 3, 35, 1), ++ FUNC("rsvd", 2, 35, 1), ++ FUNC("gpio", 1, 35, 1), ++ FUNC("wled_kn", 0, 35, 1), ++}; ++ ++static struct rt2880_pmx_func wled_an_grp_mt7628[] = { ++ FUNC("rsvd", 3, 35, 1), ++ FUNC("rsvd", 2, 35, 1), ++ FUNC("gpio", 1, 35, 1), ++ FUNC("wled_an", 0, 35, 1), ++}; ++ ++#define MT7628_GPIO_MODE_MASK 0x3 ++ ++#define MT7628_GPIO_MODE_WLED_KN 48 ++#define MT7628_GPIO_MODE_WLED_AN 32 ++#define MT7628_GPIO_MODE_PWM1 30 ++#define MT7628_GPIO_MODE_PWM0 28 ++#define MT7628_GPIO_MODE_UART2 26 ++#define MT7628_GPIO_MODE_UART1 24 ++#define MT7628_GPIO_MODE_I2C 20 ++#define MT7628_GPIO_MODE_REFCLK 18 ++#define MT7628_GPIO_MODE_PERST 16 ++#define MT7628_GPIO_MODE_WDT 14 ++#define MT7628_GPIO_MODE_SPI 12 ++#define MT7628_GPIO_MODE_SDMODE 10 ++#define MT7628_GPIO_MODE_UART0 8 ++#define MT7628_GPIO_MODE_I2S 6 ++#define MT7628_GPIO_MODE_CS1 4 ++#define MT7628_GPIO_MODE_SPIS 2 ++#define MT7628_GPIO_MODE_GPIO 0 + + static struct rt2880_pmx_group mt7628an_pinmux_data[] = { + GRP_G("pmw1", pwm1_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_PWM1), +- GRP_G("pmw1", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ GRP_G("pmw0", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_PWM0), + GRP_G("uart2", uart2_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_UART2), +@@ -233,6 +249,10 @@ static struct rt2880_pmx_group mt7628an_ + 1, MT7628_GPIO_MODE_SPIS), + GRP_G("gpio", gpio_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_GPIO), ++ GRP_G("wled_an", wled_an_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_WLED_AN), ++ GRP_G("wled_kn", wled_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_WLED_KN), + { 0 } + }; + diff --git a/target/linux/ramips/patches-4.4/0066-mt7621-enable-highmem.patch b/target/linux/ramips/patches-4.4/0066-mt7621-enable-highmem.patch new file mode 100644 index 0000000000..50f32da629 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0066-mt7621-enable-highmem.patch @@ -0,0 +1,10 @@ +--- a/arch/mips/ralink/Kconfig ++++ b/arch/mips/ralink/Kconfig +@@ -51,6 +51,7 @@ choice + select SYS_SUPPORTS_MULTITHREADING + select SYS_SUPPORTS_SMP + select SYS_SUPPORTS_MIPS_CPS ++ select SYS_SUPPORTS_HIGHMEM + select MIPS_GIC + select COMMON_CLK + select CLKSRC_MIPS_GIC diff --git a/target/linux/ramips/patches-4.4/0067-enable-mt7621-xhci.patch b/target/linux/ramips/patches-4.4/0067-enable-mt7621-xhci.patch new file mode 100644 index 0000000000..57ca218a42 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0067-enable-mt7621-xhci.patch @@ -0,0 +1,14 @@ +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -42,9 +42,9 @@ config USB_XHCI_PLATFORM + If unsure, say N. + + config USB_XHCI_MTK +- tristate "xHCI support for Mediatek MT65xx" ++ tristate "xHCI support for Mediatek MT65xx/MT7621" + select MFD_SYSCON +- depends on ARCH_MEDIATEK || COMPILE_TEST ++ depends on SOC_MT7621 || ARCH_MEDIATEK || COMPILE_TEST + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in Mediatek MT65xx SoCs. diff --git a/target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c b/target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c new file mode 100644 index 0000000000..728ce6f852 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c @@ -0,0 +1,30 @@ +--- a/arch/mips/ralink/prom.c ++++ b/arch/mips/ralink/prom.c +@@ -30,8 +30,10 @@ const char *get_system_type(void) + return soc_info.sys_type; + } + +-static __init void prom_init_cmdline(int argc, char **argv) ++static __init void prom_init_cmdline(void) + { ++ int argc; ++ char **argv; + int i; + + pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n", +@@ -60,14 +62,11 @@ static __init void prom_init_cmdline(int + + void __init prom_init(void) + { +- int argc; +- char **argv; +- + prom_soc_init(&soc_info); + + pr_info("SoC Type: %s\n", get_system_type()); + +- prom_init_cmdline(argc, argv); ++ prom_init_cmdline(); + } + + void __init prom_free_prom_memory(void) diff --git a/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch b/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch new file mode 100644 index 0000000000..cef05ad53d --- /dev/null +++ b/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch @@ -0,0 +1,15 @@ +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -375,6 +375,12 @@ static int dwc2_driver_probe(struct plat + dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n", + (unsigned long)res->start, hsotg->regs); + ++ /* Enable USB port before any regs access */ ++ if (dwc2_readl(hsotg->regs + PCGCTL) & 0x0f) { ++ dwc2_writel(0x00, hsotg->regs + PCGCTL); ++ /* TODO: mdelay(25) here? vendor driver don't use it */ ++ } ++ + hsotg->dr_mode = usb_get_dr_mode(&dev->dev); + if (IS_ENABLED(CONFIG_USB_DWC2_HOST) && + hsotg->dr_mode != USB_DR_MODE_HOST) { diff --git a/target/linux/ramips/patches-4.4/0080-MIPS-ralink-fix-USB-frequency-scaling.patch b/target/linux/ramips/patches-4.4/0080-MIPS-ralink-fix-USB-frequency-scaling.patch new file mode 100644 index 0000000000..c7eec6ecf2 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0080-MIPS-ralink-fix-USB-frequency-scaling.patch @@ -0,0 +1,28 @@ +From ae28413b3b8901ea00af3571e1c90d0228976e16 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Jan 2016 20:23:57 +0100 +Subject: [PATCH 80/81] MIPS: ralink: fix USB frequency scaling + +Commit 418d29c87061 ("MIPS: ralink: Unify SoC id handling") was not fully +correct. The logic for the SoC check got inverted. We need to check if it +is not a MT76x8. + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/11992/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -462,7 +462,7 @@ void __init ralink_clk_init(void) + ralink_clk_add("10000e00.uart2", periph_rate); + ralink_clk_add("10180000.wmac", xtal_rate); + +- if (IS_ENABLED(CONFIG_USB) && is_mt76x8()) { ++ if (IS_ENABLED(CONFIG_USB) && !is_mt76x8()) { + /* + * When the CPU goes into sleep mode, the BUS clock will be + * too low for USB to function properly. Adjust the busses diff --git a/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch b/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch new file mode 100644 index 0000000000..2c149cc9e2 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch @@ -0,0 +1,25 @@ +From 0af3a40f09a2a85089037a0b5b51471fa48b229e Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 4 Jan 2016 20:23:58 +0100 +Subject: [PATCH] MIPS: ralink: Fix invalid assignment of SoC type + +Commit 418d29c87061 ("MIPS: ralink: Unify SoC id handling") introduced +broken code. We obviously need to assign the value. + +Signed-off-by: John Crispin +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/11993/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/rt288x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/ralink/rt288x.c ++++ b/arch/mips/ralink/rt288x.c +@@ -119,5 +119,5 @@ void prom_soc_init(struct ralink_soc_inf + soc_info->mem_size_max = RT2880_MEM_SIZE_MAX; + + rt2880_pinmux_data = rt2880_pinmux_data_act; +- ralink_soc == RT2880_SOC; ++ ralink_soc = RT2880_SOC; + } diff --git a/target/linux/ramips/patches-4.4/0082-MIPS-ralink-fix-MT7628-pinmux-typos.patch b/target/linux/ramips/patches-4.4/0082-MIPS-ralink-fix-MT7628-pinmux-typos.patch new file mode 100644 index 0000000000..12bd1ea851 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0082-MIPS-ralink-fix-MT7628-pinmux-typos.patch @@ -0,0 +1,32 @@ +From d7146829c9da24e285cb1b1f2156b5b3e2d40c07 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Thu, 19 May 2016 22:07:34 +0200 +Subject: [PATCH] MIPS: ralink: fix MT7628 pinmux typos +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Álvaro Fernández Rojas +Cc: john@phrozen.org +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/13306/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -223,9 +223,9 @@ static struct rt2880_pmx_func wled_an_gr + #define MT7628_GPIO_MODE_GPIO 0 + + static struct rt2880_pmx_group mt7628an_pinmux_data[] = { +- GRP_G("pmw1", pwm1_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ GRP_G("pwm1", pwm1_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_PWM1), +- GRP_G("pmw0", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ GRP_G("pwm0", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_PWM0), + GRP_G("uart2", uart2_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_UART2), diff --git a/target/linux/ramips/patches-4.4/0083-MIPS-ralink-fix-MT7628-wled_an-pinmux-gpio.patch b/target/linux/ramips/patches-4.4/0083-MIPS-ralink-fix-MT7628-wled_an-pinmux-gpio.patch new file mode 100644 index 0000000000..544ac75d50 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0083-MIPS-ralink-fix-MT7628-wled_an-pinmux-gpio.patch @@ -0,0 +1,35 @@ +From 07b50db6e685172a41b9978aebffb2438166d9b6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Thu, 19 May 2016 22:07:35 +0200 +Subject: [PATCH] MIPS: ralink: fix MT7628 wled_an pinmux gpio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Álvaro Fernández Rojas +Cc: john@phrozen.org +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/13307/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -196,10 +196,10 @@ static struct rt2880_pmx_func wled_kn_gr + }; + + static struct rt2880_pmx_func wled_an_grp_mt7628[] = { +- FUNC("rsvd", 3, 35, 1), +- FUNC("rsvd", 2, 35, 1), +- FUNC("gpio", 1, 35, 1), +- FUNC("wled_an", 0, 35, 1), ++ FUNC("rsvd", 3, 44, 1), ++ FUNC("rsvd", 2, 44, 1), ++ FUNC("gpio", 1, 44, 1), ++ FUNC("wled_an", 0, 44, 1), + }; + + #define MT7628_GPIO_MODE_MASK 0x3 diff --git a/target/linux/ramips/patches-4.4/0084-MIPS-ralink-add-MT7628-EPHY-LEDs-pinmux-support.patch b/target/linux/ramips/patches-4.4/0084-MIPS-ralink-add-MT7628-EPHY-LEDs-pinmux-support.patch new file mode 100644 index 0000000000..2e7dd24415 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0084-MIPS-ralink-add-MT7628-EPHY-LEDs-pinmux-support.patch @@ -0,0 +1,151 @@ +From 2b436a351803f38d0c8ca9c26103472c8aaeb599 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Thu, 19 May 2016 22:07:36 +0200 +Subject: [PATCH] MIPS: ralink: add MT7628 EPHY LEDs pinmux support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Álvaro Fernández Rojas +Cc: john@phrozen.org +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/13308/ +Signed-off-by: Ralf Baechle +--- + arch/mips/ralink/mt7620.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 100 insertions(+) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -188,6 +188,41 @@ static struct rt2880_pmx_func gpio_grp_m + FUNC("gpio", 0, 11, 1), + }; + ++static struct rt2880_pmx_func p4led_kn_grp_mt7628[] = { ++ FUNC("jtag", 3, 30, 1), ++ FUNC("util", 2, 30, 1), ++ FUNC("gpio", 1, 30, 1), ++ FUNC("p4led_kn", 0, 30, 1), ++}; ++ ++static struct rt2880_pmx_func p3led_kn_grp_mt7628[] = { ++ FUNC("jtag", 3, 31, 1), ++ FUNC("util", 2, 31, 1), ++ FUNC("gpio", 1, 31, 1), ++ FUNC("p3led_kn", 0, 31, 1), ++}; ++ ++static struct rt2880_pmx_func p2led_kn_grp_mt7628[] = { ++ FUNC("jtag", 3, 32, 1), ++ FUNC("util", 2, 32, 1), ++ FUNC("gpio", 1, 32, 1), ++ FUNC("p2led_kn", 0, 32, 1), ++}; ++ ++static struct rt2880_pmx_func p1led_kn_grp_mt7628[] = { ++ FUNC("jtag", 3, 33, 1), ++ FUNC("util", 2, 33, 1), ++ FUNC("gpio", 1, 33, 1), ++ FUNC("p1led_kn", 0, 33, 1), ++}; ++ ++static struct rt2880_pmx_func p0led_kn_grp_mt7628[] = { ++ FUNC("jtag", 3, 34, 1), ++ FUNC("rsvd", 2, 34, 1), ++ FUNC("gpio", 1, 34, 1), ++ FUNC("p0led_kn", 0, 34, 1), ++}; ++ + static struct rt2880_pmx_func wled_kn_grp_mt7628[] = { + FUNC("rsvd", 3, 35, 1), + FUNC("rsvd", 2, 35, 1), +@@ -195,6 +230,41 @@ static struct rt2880_pmx_func wled_kn_gr + FUNC("wled_kn", 0, 35, 1), + }; + ++static struct rt2880_pmx_func p4led_an_grp_mt7628[] = { ++ FUNC("jtag", 3, 39, 1), ++ FUNC("util", 2, 39, 1), ++ FUNC("gpio", 1, 39, 1), ++ FUNC("p4led_an", 0, 39, 1), ++}; ++ ++static struct rt2880_pmx_func p3led_an_grp_mt7628[] = { ++ FUNC("jtag", 3, 40, 1), ++ FUNC("util", 2, 40, 1), ++ FUNC("gpio", 1, 40, 1), ++ FUNC("p3led_an", 0, 40, 1), ++}; ++ ++static struct rt2880_pmx_func p2led_an_grp_mt7628[] = { ++ FUNC("jtag", 3, 41, 1), ++ FUNC("util", 2, 41, 1), ++ FUNC("gpio", 1, 41, 1), ++ FUNC("p2led_an", 0, 41, 1), ++}; ++ ++static struct rt2880_pmx_func p1led_an_grp_mt7628[] = { ++ FUNC("jtag", 3, 42, 1), ++ FUNC("util", 2, 42, 1), ++ FUNC("gpio", 1, 42, 1), ++ FUNC("p1led_an", 0, 42, 1), ++}; ++ ++static struct rt2880_pmx_func p0led_an_grp_mt7628[] = { ++ FUNC("jtag", 3, 43, 1), ++ FUNC("rsvd", 2, 43, 1), ++ FUNC("gpio", 1, 43, 1), ++ FUNC("p0led_an", 0, 43, 1), ++}; ++ + static struct rt2880_pmx_func wled_an_grp_mt7628[] = { + FUNC("rsvd", 3, 44, 1), + FUNC("rsvd", 2, 44, 1), +@@ -204,7 +274,17 @@ static struct rt2880_pmx_func wled_an_gr + + #define MT7628_GPIO_MODE_MASK 0x3 + ++#define MT7628_GPIO_MODE_P4LED_KN 58 ++#define MT7628_GPIO_MODE_P3LED_KN 56 ++#define MT7628_GPIO_MODE_P2LED_KN 54 ++#define MT7628_GPIO_MODE_P1LED_KN 52 ++#define MT7628_GPIO_MODE_P0LED_KN 50 + #define MT7628_GPIO_MODE_WLED_KN 48 ++#define MT7628_GPIO_MODE_P4LED_AN 42 ++#define MT7628_GPIO_MODE_P3LED_AN 40 ++#define MT7628_GPIO_MODE_P2LED_AN 38 ++#define MT7628_GPIO_MODE_P1LED_AN 36 ++#define MT7628_GPIO_MODE_P0LED_AN 34 + #define MT7628_GPIO_MODE_WLED_AN 32 + #define MT7628_GPIO_MODE_PWM1 30 + #define MT7628_GPIO_MODE_PWM0 28 +@@ -251,8 +331,28 @@ static struct rt2880_pmx_group mt7628an_ + 1, MT7628_GPIO_MODE_GPIO), + GRP_G("wled_an", wled_an_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_WLED_AN), ++ GRP_G("p0led_an", p0led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P0LED_AN), ++ GRP_G("p1led_an", p1led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P1LED_AN), ++ GRP_G("p2led_an", p2led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P2LED_AN), ++ GRP_G("p3led_an", p3led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P3LED_AN), ++ GRP_G("p4led_an", p4led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P4LED_AN), + GRP_G("wled_kn", wled_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, + 1, MT7628_GPIO_MODE_WLED_KN), ++ GRP_G("p0led_kn", p0led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P0LED_KN), ++ GRP_G("p1led_kn", p1led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P1LED_KN), ++ GRP_G("p2led_kn", p2led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P2LED_KN), ++ GRP_G("p3led_kn", p3led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P3LED_KN), ++ GRP_G("p4led_kn", p4led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, ++ 1, MT7628_GPIO_MODE_P4LED_KN), + { 0 } + }; + diff --git a/target/linux/ramips/patches-4.4/0085-pinmux-util.patch b/target/linux/ramips/patches-4.4/0085-pinmux-util.patch new file mode 100644 index 0000000000..e2f1d60051 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0085-pinmux-util.patch @@ -0,0 +1,77 @@ +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -176,7 +176,7 @@ static struct rt2880_pmx_func spi_cs1_gr + + static struct rt2880_pmx_func spis_grp_mt7628[] = { + FUNC("pwm", 3, 14, 4), +- FUNC("util", 2, 14, 4), ++ FUNC("utif", 2, 14, 4), + FUNC("gpio", 1, 14, 4), + FUNC("spis", 0, 14, 4), + }; +@@ -190,28 +190,28 @@ static struct rt2880_pmx_func gpio_grp_m + + static struct rt2880_pmx_func p4led_kn_grp_mt7628[] = { + FUNC("jtag", 3, 30, 1), +- FUNC("util", 2, 30, 1), ++ FUNC("utif", 2, 30, 1), + FUNC("gpio", 1, 30, 1), + FUNC("p4led_kn", 0, 30, 1), + }; + + static struct rt2880_pmx_func p3led_kn_grp_mt7628[] = { + FUNC("jtag", 3, 31, 1), +- FUNC("util", 2, 31, 1), ++ FUNC("utif", 2, 31, 1), + FUNC("gpio", 1, 31, 1), + FUNC("p3led_kn", 0, 31, 1), + }; + + static struct rt2880_pmx_func p2led_kn_grp_mt7628[] = { + FUNC("jtag", 3, 32, 1), +- FUNC("util", 2, 32, 1), ++ FUNC("utif", 2, 32, 1), + FUNC("gpio", 1, 32, 1), + FUNC("p2led_kn", 0, 32, 1), + }; + + static struct rt2880_pmx_func p1led_kn_grp_mt7628[] = { + FUNC("jtag", 3, 33, 1), +- FUNC("util", 2, 33, 1), ++ FUNC("utif", 2, 33, 1), + FUNC("gpio", 1, 33, 1), + FUNC("p1led_kn", 0, 33, 1), + }; +@@ -232,28 +232,28 @@ static struct rt2880_pmx_func wled_kn_gr + + static struct rt2880_pmx_func p4led_an_grp_mt7628[] = { + FUNC("jtag", 3, 39, 1), +- FUNC("util", 2, 39, 1), ++ FUNC("utif", 2, 39, 1), + FUNC("gpio", 1, 39, 1), + FUNC("p4led_an", 0, 39, 1), + }; + + static struct rt2880_pmx_func p3led_an_grp_mt7628[] = { + FUNC("jtag", 3, 40, 1), +- FUNC("util", 2, 40, 1), ++ FUNC("utif", 2, 40, 1), + FUNC("gpio", 1, 40, 1), + FUNC("p3led_an", 0, 40, 1), + }; + + static struct rt2880_pmx_func p2led_an_grp_mt7628[] = { + FUNC("jtag", 3, 41, 1), +- FUNC("util", 2, 41, 1), ++ FUNC("utif", 2, 41, 1), + FUNC("gpio", 1, 41, 1), + FUNC("p2led_an", 0, 41, 1), + }; + + static struct rt2880_pmx_func p1led_an_grp_mt7628[] = { + FUNC("jtag", 3, 42, 1), +- FUNC("util", 2, 42, 1), ++ FUNC("utif", 2, 42, 1), + FUNC("gpio", 1, 42, 1), + FUNC("p1led_an", 0, 42, 1), + }; diff --git a/target/linux/ramips/patches-4.4/0086-usbphy.patch b/target/linux/ramips/patches-4.4/0086-usbphy.patch new file mode 100644 index 0000000000..92265e6a5d --- /dev/null +++ b/target/linux/ramips/patches-4.4/0086-usbphy.patch @@ -0,0 +1,35 @@ +--- a/drivers/phy/phy-ralink-usb.c ++++ b/drivers/phy/phy-ralink-usb.c +@@ -34,19 +34,19 @@ + #define RT_SYSC_REG_CLKCFG1 0x030 + #define RT_SYSC_REG_USB_PHY_CFG 0x05c + +-#define OFS_U2_PHY_AC0 0x00 +-#define OFS_U2_PHY_AC1 0x04 +-#define OFS_U2_PHY_AC2 0x08 +-#define OFS_U2_PHY_ACR0 0x10 +-#define OFS_U2_PHY_ACR1 0x14 +-#define OFS_U2_PHY_ACR2 0x18 +-#define OFS_U2_PHY_ACR3 0x1C +-#define OFS_U2_PHY_ACR4 0x20 +-#define OFS_U2_PHY_AMON0 0x24 +-#define OFS_U2_PHY_DCR0 0x60 +-#define OFS_U2_PHY_DCR1 0x64 +-#define OFS_U2_PHY_DTM0 0x68 +-#define OFS_U2_PHY_DTM1 0x6C ++#define OFS_U2_PHY_AC0 0x800 ++#define OFS_U2_PHY_AC1 0x804 ++#define OFS_U2_PHY_AC2 0x808 ++#define OFS_U2_PHY_ACR0 0x810 ++#define OFS_U2_PHY_ACR1 0x814 ++#define OFS_U2_PHY_ACR2 0x818 ++#define OFS_U2_PHY_ACR3 0x81C ++#define OFS_U2_PHY_ACR4 0x820 ++#define OFS_U2_PHY_AMON0 0x824 ++#define OFS_U2_PHY_DCR0 0x860 ++#define OFS_U2_PHY_DCR1 0x864 ++#define OFS_U2_PHY_DTM0 0x868 ++#define OFS_U2_PHY_DTM1 0x86C + + #define RT_RSTCTRL_UDEV BIT(25) + #define RT_RSTCTRL_UHST BIT(22) diff --git a/target/linux/ramips/patches-4.4/0103-MIPS-OWRTDTB.patch b/target/linux/ramips/patches-4.4/0103-MIPS-OWRTDTB.patch new file mode 100644 index 0000000000..b90138317b --- /dev/null +++ b/target/linux/ramips/patches-4.4/0103-MIPS-OWRTDTB.patch @@ -0,0 +1,44 @@ +From c174d2250e402399ad7dbdd57d51883d8804bba0 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 15 Jul 2013 00:40:37 +0200 +Subject: [PATCH 31/33] owrt: MIPS: add OWRTDTB secion + +Signed-off-by: John Crispin +--- + arch/mips/kernel/head.S | 3 +++ + arch/mips/ralink/Makefile | 2 +- + arch/mips/ralink/of.c | 4 +++- + 3 files changed, 7 insertions(+), 2 deletions(-) + +--- a/arch/mips/kernel/head.S ++++ b/arch/mips/kernel/head.S +@@ -86,6 +86,9 @@ EXPORT(__image_cmdline) + .fill 0x400 + #endif /* CONFIG_IMAGE_CMDLINE_HACK */ + ++ .ascii "OWRTDTB:" ++ EXPORT(__image_dtb) ++ .fill 0x4000 + __REF + + NESTED(kernel_entry, 16, sp) # kernel entry point +--- a/arch/mips/ralink/of.c ++++ b/arch/mips/ralink/of.c +@@ -66,6 +66,8 @@ static int __init early_init_dt_find_mem + return 0; + } + ++extern struct boot_param_header __image_dtb; ++ + void __init plat_mem_setup(void) + { + set_io_port_base(KSEG1); +@@ -74,7 +76,7 @@ void __init plat_mem_setup(void) + * Load the builtin devicetree. This causes the chosen node to be + * parsed resulting in our memory appearing + */ +- __dt_setup_arch(__dtb_start); ++ __dt_setup_arch(&__image_dtb); + + strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); + diff --git a/target/linux/ramips/patches-4.4/0104-fix_bootargs_handling.patch b/target/linux/ramips/patches-4.4/0104-fix_bootargs_handling.patch new file mode 100644 index 0000000000..9f76aa1f5b --- /dev/null +++ b/target/linux/ramips/patches-4.4/0104-fix_bootargs_handling.patch @@ -0,0 +1,40 @@ +--- a/arch/mips/ralink/of.c ++++ b/arch/mips/ralink/of.c +@@ -3,7 +3,7 @@ + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * +- * Copyright (C) 2008 Imre Kaloz ++ * Copyright (C) 2008-2014 Imre Kaloz + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2013 John Crispin + */ +@@ -66,6 +66,17 @@ static int __init early_init_dt_find_mem + return 0; + } + ++static int chosen_dtb; ++ ++static int __init early_init_dt_find_chosen(unsigned long node, const char *uname, ++ int depth, void *data) ++{ ++ if (depth == 1 && !strcmp(uname, "chosen")) ++ chosen_dtb = 1; ++ ++ return 0; ++} ++ + extern struct boot_param_header __image_dtb; + + void __init plat_mem_setup(void) +@@ -78,7 +89,9 @@ void __init plat_mem_setup(void) + */ + __dt_setup_arch(&__image_dtb); + +- strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); ++ of_scan_flat_dt(early_init_dt_find_chosen, NULL); ++ if (chosen_dtb) ++ strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); + + of_scan_flat_dt(early_init_dt_find_memory, NULL); + if (memory_dtb) diff --git a/target/linux/ramips/patches-4.4/0105-set_mt7621_soc_type.patch b/target/linux/ramips/patches-4.4/0105-set_mt7621_soc_type.patch new file mode 100644 index 0000000000..9896ebb1d2 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0105-set_mt7621_soc_type.patch @@ -0,0 +1,11 @@ +--- a/arch/mips/ralink/mt7621.c ++++ b/arch/mips/ralink/mt7621.c +@@ -180,7 +180,7 @@ void prom_soc_init(struct ralink_soc_inf + } else { + panic("mt7621: unknown SoC, n0:%08x n1:%08x\n", n0, n1); + } +- ++ ralink_soc = MT762X_SOC_MT7621AT; + rev = __raw_readl(sysc + SYSC_REG_CHIP_REV); + + snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, diff --git a/target/linux/ramips/patches-4.4/0200-linkit_bootstrap.patch b/target/linux/ramips/patches-4.4/0200-linkit_bootstrap.patch new file mode 100644 index 0000000000..6e11075d54 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0200-linkit_bootstrap.patch @@ -0,0 +1,94 @@ +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -57,3 +57,4 @@ obj-$(CONFIG_GENWQE) += genwqe/ + obj-$(CONFIG_ECHO) += echo/ + obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o + obj-$(CONFIG_CXL_BASE) += cxl/ ++obj-$(CONFIG_SOC_MT7620) += linkit.o +--- /dev/null ++++ b/drivers/misc/linkit.c +@@ -0,0 +1,84 @@ ++/* ++ * 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 ++ * publishhed by the Free Software Foundation. ++ * ++ * Copyright (C) 2015 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define LINKIT_LATCH_GPIO 11 ++ ++struct linkit_hw_data { ++ char board[16]; ++ char rev[16]; ++}; ++ ++static void sanify_string(char *s) ++{ ++ int i; ++ ++ for (i = 0; i < 15; i++) ++ if (s[i] <= 0x20) ++ s[i] = '\0'; ++ s[15] = '\0'; ++} ++ ++static int linkit_probe(struct platform_device *pdev) ++{ ++ struct linkit_hw_data hw; ++ struct mtd_info *mtd; ++ size_t retlen; ++ int ret; ++ ++ mtd = get_mtd_device_nm("factory"); ++ if (IS_ERR(mtd)) ++ return PTR_ERR(mtd); ++ ++ ret = mtd_read(mtd, 0x400, sizeof(hw), &retlen, (u_char *) &hw); ++ put_mtd_device(mtd); ++ ++ sanify_string(hw.board); ++ sanify_string(hw.rev); ++ ++ dev_info(&pdev->dev, "Version : %s\n", hw.board); ++ dev_info(&pdev->dev, "Revision : %s\n", hw.rev); ++ ++ if (!strcmp(hw.board, "LINKITS7688")) { ++ dev_info(&pdev->dev, "setting up bootstrap latch\n"); ++ ++ if (devm_gpio_request(&pdev->dev, LINKIT_LATCH_GPIO, "bootstrap")) { ++ dev_err(&pdev->dev, "failed to setup bootstrap gpio\n"); ++ return -1; ++ } ++ gpio_direction_output(LINKIT_LATCH_GPIO, 0); ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id linkit_match[] = { ++ { .compatible = "mediatek,linkit" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, linkit_match); ++ ++static struct platform_driver linkit_driver = { ++ .probe = linkit_probe, ++ .driver = { ++ .name = "mtk-linkit", ++ .owner = THIS_MODULE, ++ .of_match_table = linkit_match, ++ }, ++}; ++ ++int __init linkit_init(void) ++{ ++ return platform_driver_register(&linkit_driver); ++} ++late_initcall_sync(linkit_init); diff --git a/target/linux/ramips/patches-4.4/0500-Documentation-DT-net-add-docs-for-ralink-mediatek-So.patch b/target/linux/ramips/patches-4.4/0500-Documentation-DT-net-add-docs-for-ralink-mediatek-So.patch new file mode 100644 index 0000000000..7534c09b8b --- /dev/null +++ b/target/linux/ramips/patches-4.4/0500-Documentation-DT-net-add-docs-for-ralink-mediatek-So.patch @@ -0,0 +1,150 @@ +From 9c2487f148ee38807d86beaf12dc2b818a764a99 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 17 Nov 2015 00:20:07 +0100 +Subject: [PATCH 500/513] Documentation: DT: net: add docs for ralink/mediatek + SoC ethernet binding + +Add three files. ralink,rt2880-net.txt descibes the actual frame engine +and the other two describe the switch forntend bindings. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +Cc: devicetree@vger.kernel.org +--- + .../bindings/net/mediatek,mt7620-gsw.txt | 26 +++++++++ + .../devicetree/bindings/net/ralink,rt2880-net.txt | 61 ++++++++++++++++++++ + .../devicetree/bindings/net/ralink,rt3050-esw.txt | 32 ++++++++++ + 3 files changed, 119 insertions(+) + create mode 100644 Documentation/devicetree/bindings/net/mediatek,mt7620-gsw.txt + create mode 100644 Documentation/devicetree/bindings/net/ralink,rt2880-net.txt + create mode 100644 Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/net/mediatek,mt7620-gsw.txt +@@ -0,0 +1,26 @@ ++Mediatek Gigabit Switch ++======================= ++ ++The mediatek gigabit switch can be found on Mediatek SoCs (mt7620, mt7621). ++ ++Required properties: ++- compatible: Should be "mediatek,mt7620-gsw" ++- reg: Address and length of the register set for the device ++- interrupt-parent: Should be the phandle for the interrupt controller ++ that services interrupts for this device ++- interrupts: Should contain the gigabit switches interrupt ++- resets: Should contain the gigabit switches resets ++- reset-names: Should contain the reset names "gsw" ++ ++Example: ++ ++gsw@10110000 { ++ compatible = "ralink,mt7620-gsw"; ++ reg = <0x10110000 8000>; ++ ++ resets = <&rstctrl 23>; ++ reset-names = "gsw"; ++ ++ interrupt-parent = <&intc>; ++ interrupts = <17>; ++}; +--- /dev/null ++++ b/Documentation/devicetree/bindings/net/ralink,rt2880-net.txt +@@ -0,0 +1,61 @@ ++Ralink Frame Engine Ethernet controller ++======================================= ++ ++The Ralink frame engine ethernet controller can be found on Ralink and ++Mediatek SoCs (RT288x, RT3x5x, RT366x, RT388x, rt5350, mt7620, mt7621, mt76x8). ++ ++Depending on the SoC, there is a number of ports connected to the CPU port ++directly and/or via a (gigabit-)switch. ++ ++* Ethernet controller node ++ ++Required properties: ++- compatible: Should be one of "ralink,rt2880-eth", "ralink,rt3050-eth", ++ "ralink,rt3050-eth", "ralink,rt3883-eth", "ralink,rt5350-eth", ++ "mediatek,mt7620-eth", "mediatek,mt7621-eth" ++- reg: Address and length of the register set for the device ++- interrupt-parent: Should be the phandle for the interrupt controller ++ that services interrupts for this device ++- interrupts: Should contain the frame engines interrupt ++- resets: Should contain the frame engines resets ++- reset-names: Should contain the reset names "fe". If a switch is present ++ "esw" is also required. ++ ++ ++* Ethernet port node ++ ++Required properties: ++- compatible: Should be "ralink,eth-port" ++- reg: The number of the physical port ++- phy-handle: reference to the node describing the phy ++ ++Example: ++ ++mdio-bus { ++ ... ++ phy0: ethernet-phy@0 { ++ phy-mode = "mii"; ++ reg = <0>; ++ }; ++}; ++ ++ethernet@400000 { ++ compatible = "ralink,rt2880-eth"; ++ reg = <0x00400000 10000>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ resets = <&rstctrl 18>; ++ reset-names = "fe"; ++ ++ interrupt-parent = <&cpuintc>; ++ interrupts = <5>; ++ ++ port@0 { ++ compatible = "ralink,eth-port"; ++ reg = <0>; ++ phy-handle = <&phy0>; ++ }; ++ ++}; +--- /dev/null ++++ b/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt +@@ -0,0 +1,32 @@ ++Ralink Fast Ethernet Embedded Switch ++==================================== ++ ++The ralink fast ethernet embedded switch can be found on Ralink and Mediatek ++SoCs (RT3x5x, rt5350, mt76x8). ++ ++Required properties: ++- compatible: Should be "ralink,rt3050-esw" ++- reg: Address and length of the register set for the device ++- interrupt-parent: Should be the phandle for the interrupt controller ++ that services interrupts for this device ++- interrupts: Should contain the embedded switches interrupt ++- resets: Should contain the embedded switches resets ++- reset-names: Should contain the reset names "esw" ++ ++Optional properties: ++- ralink,portmap: can be used to choose if the default switch setup is ++ llllw or wllll ++- ralink,led_polarity: override the active high/low settings of the leds ++ ++Example: ++ ++esw@10110000 { ++ compatible = "ralink,rt3050-esw"; ++ reg = <0x10110000 8000>; ++ ++ resets = <&rstctrl 23>; ++ reset-names = "esw"; ++ ++ interrupt-parent = <&intc>; ++ interrupts = <17>; ++}; diff --git a/target/linux/ramips/patches-4.4/0501-net-next-mediatek-add-the-drivers-core-files.patch b/target/linux/ramips/patches-4.4/0501-net-next-mediatek-add-the-drivers-core-files.patch new file mode 100644 index 0000000000..cc4c2a152d --- /dev/null +++ b/target/linux/ramips/patches-4.4/0501-net-next-mediatek-add-the-drivers-core-files.patch @@ -0,0 +1,2715 @@ +From 2abe91b53ca4d2528ef1fc9c44c6e69f8c805776 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 18 Nov 2015 03:12:19 +0100 +Subject: [PATCH 501/513] net-next: mediatek: add the drivers core files + +This patch adds the main chunk of the driver. The ethernet core is used in all +of the Mediatek/Ralink Wireless SoCs. Over the years we have seen verious +changes to + +* the register layout +* the type of ports (single/dual gbit, internal FE/Gbit switch) +* dma engine + +and new offloading features were added, such as + +* checksum +* vlan tx/rx +* gso +* lro + +However the core functionality has remained the sama allowing us to use the +same core for all SoCs. + +The abstraction for the various SoCs uses the typical ops struct pattern which +allows us to extend or override the cores functionality depending on which SoC +we are on. The code to bring up the switches and external ports has also been +split into separate files. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/mediatek/ethtool.c | 235 ++++ + drivers/net/ethernet/mediatek/ethtool.h | 22 + + drivers/net/ethernet/mediatek/mdio.c | 258 +++++ + drivers/net/ethernet/mediatek/mdio.h | 27 + + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1607 +++++++++++++++++++++++++++ + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 522 +++++++++ + 6 files changed, 2671 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/ethtool.c + create mode 100644 drivers/net/ethernet/mediatek/ethtool.h + create mode 100644 drivers/net/ethernet/mediatek/mdio.c + create mode 100644 drivers/net/ethernet/mediatek/mdio.h + create mode 100644 drivers/net/ethernet/mediatek/mtk_eth_soc.c + create mode 100644 drivers/net/ethernet/mediatek/mtk_eth_soc.h + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/ethtool.c +@@ -0,0 +1,235 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include "mtk_eth_soc.h" ++ ++static const char fe_gdma_str[][ETH_GSTRING_LEN] = { ++#define _FE(x...) # x, ++FE_STAT_REG_DECLARE ++#undef _FE ++}; ++ ++static int fe_get_settings(struct net_device *dev, ++ struct ethtool_cmd *cmd) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ int err; ++ ++ if (!priv->phy_dev) ++ goto out_gset; ++ ++ if (priv->phy_flags == FE_PHY_FLAG_ATTACH) { ++ err = phy_read_status(priv->phy_dev); ++ if (err) ++ goto out_gset; ++ } ++ ++ return phy_ethtool_gset(priv->phy_dev, cmd); ++ ++out_gset: ++ return -ENODEV; ++} ++ ++static int fe_set_settings(struct net_device *dev, ++ struct ethtool_cmd *cmd) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ if (!priv->phy_dev) ++ goto out_sset; ++ ++ if (cmd->phy_address != priv->phy_dev->addr) { ++ if (priv->phy->phy_node[cmd->phy_address]) { ++ priv->phy_dev = priv->phy->phy[cmd->phy_address]; ++ priv->phy_flags = FE_PHY_FLAG_PORT; ++ } else if (priv->mii_bus && ++ priv->mii_bus->phy_map[cmd->phy_address]) { ++ priv->phy_dev = ++ priv->mii_bus->phy_map[cmd->phy_address]; ++ priv->phy_flags = FE_PHY_FLAG_ATTACH; ++ } else { ++ goto out_sset; ++ } ++ } ++ ++ return phy_ethtool_sset(priv->phy_dev, cmd); ++ ++out_sset: ++ return -ENODEV; ++} ++ ++static void fe_get_drvinfo(struct net_device *dev, ++ struct ethtool_drvinfo *info) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ struct fe_soc_data *soc = priv->soc; ++ ++ strlcpy(info->driver, priv->device->driver->name, sizeof(info->driver)); ++ strlcpy(info->version, MTK_FE_DRV_VERSION, sizeof(info->version)); ++ strlcpy(info->bus_info, dev_name(priv->device), sizeof(info->bus_info)); ++ ++ if (soc->reg_table[FE_REG_FE_COUNTER_BASE]) ++ info->n_stats = ARRAY_SIZE(fe_gdma_str); ++} ++ ++static u32 fe_get_msglevel(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ return priv->msg_enable; ++} ++ ++static void fe_set_msglevel(struct net_device *dev, u32 value) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ priv->msg_enable = value; ++} ++ ++static int fe_nway_reset(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ if (!priv->phy_dev) ++ goto out_nway_reset; ++ ++ return genphy_restart_aneg(priv->phy_dev); ++ ++out_nway_reset: ++ return -EOPNOTSUPP; ++} ++ ++static u32 fe_get_link(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ int err; ++ ++ if (!priv->phy_dev) ++ goto out_get_link; ++ ++ if (priv->phy_flags == FE_PHY_FLAG_ATTACH) { ++ err = genphy_update_link(priv->phy_dev); ++ if (err) ++ goto out_get_link; ++ } ++ ++ return priv->phy_dev->link; ++ ++out_get_link: ++ return ethtool_op_get_link(dev); ++} ++ ++static int fe_set_ringparam(struct net_device *dev, ++ struct ethtool_ringparam *ring) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ if ((ring->tx_pending < 2) || ++ (ring->rx_pending < 2) || ++ (ring->rx_pending > MAX_DMA_DESC) || ++ (ring->tx_pending > MAX_DMA_DESC)) ++ return -EINVAL; ++ ++ dev->netdev_ops->ndo_stop(dev); ++ ++ priv->tx_ring.tx_ring_size = BIT(fls(ring->tx_pending) - 1); ++ priv->rx_ring.rx_ring_size = BIT(fls(ring->rx_pending) - 1); ++ ++ dev->netdev_ops->ndo_open(dev); ++ ++ return 0; ++} ++ ++static void fe_get_ringparam(struct net_device *dev, ++ struct ethtool_ringparam *ring) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ ring->rx_max_pending = MAX_DMA_DESC; ++ ring->tx_max_pending = MAX_DMA_DESC; ++ ring->rx_pending = priv->rx_ring.rx_ring_size; ++ ring->tx_pending = priv->tx_ring.tx_ring_size; ++} ++ ++static void fe_get_strings(struct net_device *dev, u32 stringset, u8 *data) ++{ ++ switch (stringset) { ++ case ETH_SS_STATS: ++ memcpy(data, *fe_gdma_str, sizeof(fe_gdma_str)); ++ break; ++ } ++} ++ ++static int fe_get_sset_count(struct net_device *dev, int sset) ++{ ++ switch (sset) { ++ case ETH_SS_STATS: ++ return ARRAY_SIZE(fe_gdma_str); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static void fe_get_ethtool_stats(struct net_device *dev, ++ struct ethtool_stats *stats, u64 *data) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ struct fe_hw_stats *hwstats = priv->hw_stats; ++ u64 *data_src, *data_dst; ++ unsigned int start; ++ int i; ++ ++ if (netif_running(dev) && netif_device_present(dev)) { ++ if (spin_trylock(&hwstats->stats_lock)) { ++ fe_stats_update(priv); ++ spin_unlock(&hwstats->stats_lock); ++ } ++ } ++ ++ do { ++ data_src = &hwstats->tx_bytes; ++ data_dst = data; ++ start = u64_stats_fetch_begin_irq(&hwstats->syncp); ++ ++ for (i = 0; i < ARRAY_SIZE(fe_gdma_str); i++) ++ *data_dst++ = *data_src++; ++ ++ } while (u64_stats_fetch_retry_irq(&hwstats->syncp, start)); ++} ++ ++static struct ethtool_ops fe_ethtool_ops = { ++ .get_settings = fe_get_settings, ++ .set_settings = fe_set_settings, ++ .get_drvinfo = fe_get_drvinfo, ++ .get_msglevel = fe_get_msglevel, ++ .set_msglevel = fe_set_msglevel, ++ .nway_reset = fe_nway_reset, ++ .get_link = fe_get_link, ++ .set_ringparam = fe_set_ringparam, ++ .get_ringparam = fe_get_ringparam, ++}; ++ ++void fe_set_ethtool_ops(struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ struct fe_soc_data *soc = priv->soc; ++ ++ if (soc->reg_table[FE_REG_FE_COUNTER_BASE]) { ++ fe_ethtool_ops.get_strings = fe_get_strings; ++ fe_ethtool_ops.get_sset_count = fe_get_sset_count; ++ fe_ethtool_ops.get_ethtool_stats = fe_get_ethtool_stats; ++ } ++ ++ netdev->ethtool_ops = &fe_ethtool_ops; ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/ethtool.h +@@ -0,0 +1,22 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#ifndef FE_ETHTOOL_H ++#define FE_ETHTOOL_H ++ ++#include ++ ++void fe_set_ethtool_ops(struct net_device *netdev); ++ ++#endif /* FE_ETHTOOL_H */ +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mdio.c +@@ -0,0 +1,258 @@ ++/* 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 ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "mtk_eth_soc.h" ++#include "mdio.h" ++ ++static int fe_mdio_reset(struct mii_bus *bus) ++{ ++ /* TODO */ ++ return 0; ++} ++ ++static void fe_phy_link_adjust(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ unsigned long flags; ++ int i; ++ ++ spin_lock_irqsave(&priv->phy->lock, flags); ++ for (i = 0; i < 8; i++) { ++ if (priv->phy->phy_node[i]) { ++ struct phy_device *phydev = priv->phy->phy[i]; ++ int status_change = 0; ++ ++ if (phydev->link) ++ if (priv->phy->duplex[i] != phydev->duplex || ++ priv->phy->speed[i] != phydev->speed) ++ status_change = 1; ++ ++ if (phydev->link != priv->link[i]) ++ status_change = 1; ++ ++ switch (phydev->speed) { ++ case SPEED_1000: ++ case SPEED_100: ++ case SPEED_10: ++ priv->link[i] = phydev->link; ++ priv->phy->duplex[i] = phydev->duplex; ++ priv->phy->speed[i] = phydev->speed; ++ ++ if (status_change && ++ priv->soc->mdio_adjust_link) ++ priv->soc->mdio_adjust_link(priv, i); ++ break; ++ } ++ } ++ } ++} ++ ++int fe_connect_phy_node(struct fe_priv *priv, struct device_node *phy_node) ++{ ++ const __be32 *_port = NULL; ++ struct phy_device *phydev; ++ int phy_mode, port; ++ ++ _port = of_get_property(phy_node, "reg", NULL); ++ ++ if (!_port || (be32_to_cpu(*_port) >= 0x20)) { ++ pr_err("%s: invalid port id\n", phy_node->name); ++ return -EINVAL; ++ } ++ port = be32_to_cpu(*_port); ++ phy_mode = of_get_phy_mode(phy_node); ++ if (phy_mode < 0) { ++ dev_err(priv->device, "incorrect phy-mode %d\n", phy_mode); ++ priv->phy->phy_node[port] = NULL; ++ return -EINVAL; ++ } ++ ++ phydev = of_phy_connect(priv->netdev, phy_node, fe_phy_link_adjust, ++ 0, phy_mode); ++ if (IS_ERR(phydev)) { ++ dev_err(priv->device, "could not connect to PHY\n"); ++ priv->phy->phy_node[port] = NULL; ++ return PTR_ERR(phydev); ++ } ++ ++ phydev->supported &= PHY_GBIT_FEATURES; ++ phydev->advertising = phydev->supported; ++ ++ dev_info(priv->device, ++ "connected port %d to PHY at %s [uid=%08x, driver=%s]\n", ++ port, dev_name(&phydev->dev), phydev->phy_id, ++ phydev->drv->name); ++ ++ priv->phy->phy[port] = phydev; ++ priv->link[port] = 0; ++ ++ return 0; ++} ++ ++static void phy_init(struct fe_priv *priv, struct phy_device *phy) ++{ ++ phy_attach(priv->netdev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII); ++ ++ phy->autoneg = AUTONEG_ENABLE; ++ phy->speed = 0; ++ phy->duplex = 0; ++ phy->supported &= PHY_BASIC_FEATURES; ++ phy->advertising = phy->supported | ADVERTISED_Autoneg; ++ ++ phy_start_aneg(phy); ++} ++ ++static int fe_phy_connect(struct fe_priv *priv) ++{ ++ int i; ++ ++ for (i = 0; i < 8; i++) { ++ if (priv->phy->phy_node[i]) { ++ if (!priv->phy_dev) { ++ priv->phy_dev = priv->phy->phy[i]; ++ priv->phy_flags = FE_PHY_FLAG_PORT; ++ } ++ } else if (priv->mii_bus && priv->mii_bus->phy_map[i]) { ++ phy_init(priv, priv->mii_bus->phy_map[i]); ++ if (!priv->phy_dev) { ++ priv->phy_dev = priv->mii_bus->phy_map[i]; ++ priv->phy_flags = FE_PHY_FLAG_ATTACH; ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++static void fe_phy_disconnect(struct fe_priv *priv) ++{ ++ unsigned long flags; ++ int i; ++ ++ for (i = 0; i < 8; i++) ++ if (priv->phy->phy_fixed[i]) { ++ spin_lock_irqsave(&priv->phy->lock, flags); ++ priv->link[i] = 0; ++ if (priv->soc->mdio_adjust_link) ++ priv->soc->mdio_adjust_link(priv, i); ++ spin_unlock_irqrestore(&priv->phy->lock, flags); ++ } else if (priv->phy->phy[i]) { ++ phy_disconnect(priv->phy->phy[i]); ++ } else if (priv->mii_bus && priv->mii_bus->phy_map[i]) { ++ phy_detach(priv->mii_bus->phy_map[i]); ++ } ++} ++ ++static void fe_phy_start(struct fe_priv *priv) ++{ ++ unsigned long flags; ++ int i; ++ ++ for (i = 0; i < 8; i++) { ++ if (priv->phy->phy_fixed[i]) { ++ spin_lock_irqsave(&priv->phy->lock, flags); ++ priv->link[i] = 1; ++ if (priv->soc->mdio_adjust_link) ++ priv->soc->mdio_adjust_link(priv, i); ++ spin_unlock_irqrestore(&priv->phy->lock, flags); ++ } else if (priv->phy->phy[i]) { ++ phy_start(priv->phy->phy[i]); ++ } ++ } ++} ++ ++static void fe_phy_stop(struct fe_priv *priv) ++{ ++ unsigned long flags; ++ int i; ++ ++ for (i = 0; i < 8; i++) ++ if (priv->phy->phy_fixed[i]) { ++ spin_lock_irqsave(&priv->phy->lock, flags); ++ priv->link[i] = 0; ++ if (priv->soc->mdio_adjust_link) ++ priv->soc->mdio_adjust_link(priv, i); ++ spin_unlock_irqrestore(&priv->phy->lock, flags); ++ } else if (priv->phy->phy[i]) { ++ phy_stop(priv->phy->phy[i]); ++ } ++} ++ ++static struct fe_phy phy_ralink = { ++ .connect = fe_phy_connect, ++ .disconnect = fe_phy_disconnect, ++ .start = fe_phy_start, ++ .stop = fe_phy_stop, ++}; ++ ++int fe_mdio_init(struct fe_priv *priv) ++{ ++ struct device_node *mii_np; ++ int err; ++ ++ if (!priv->soc->mdio_read || !priv->soc->mdio_write) ++ return 0; ++ ++ spin_lock_init(&phy_ralink.lock); ++ priv->phy = &phy_ralink; ++ ++ mii_np = of_get_child_by_name(priv->device->of_node, "mdio-bus"); ++ if (!mii_np) { ++ dev_err(priv->device, "no %s child node found", "mdio-bus"); ++ return -ENODEV; ++ } ++ ++ if (!of_device_is_available(mii_np)) { ++ err = 0; ++ goto err_put_node; ++ } ++ ++ priv->mii_bus = mdiobus_alloc(); ++ if (!priv->mii_bus) { ++ err = -ENOMEM; ++ goto err_put_node; ++ } ++ ++ priv->mii_bus->name = "mdio"; ++ priv->mii_bus->read = priv->soc->mdio_read; ++ priv->mii_bus->write = priv->soc->mdio_write; ++ priv->mii_bus->reset = fe_mdio_reset; ++ priv->mii_bus->priv = priv; ++ priv->mii_bus->parent = priv->device; ++ ++ snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); ++ err = of_mdiobus_register(priv->mii_bus, mii_np); ++ if (err) ++ goto err_free_bus; ++ ++ return 0; ++ ++err_free_bus: ++ kfree(priv->mii_bus); ++err_put_node: ++ of_node_put(mii_np); ++ priv->mii_bus = NULL; ++ return err; ++} ++ ++void fe_mdio_cleanup(struct fe_priv *priv) ++{ ++ if (!priv->mii_bus) ++ return; ++ ++ mdiobus_unregister(priv->mii_bus); ++ of_node_put(priv->mii_bus->dev.of_node); ++ kfree(priv->mii_bus); ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mdio.h +@@ -0,0 +1,27 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#ifndef _RALINK_MDIO_H__ ++#define _RALINK_MDIO_H__ ++ ++#ifdef CONFIG_NET_MEDIATEK_MDIO ++int fe_mdio_init(struct fe_priv *priv); ++void fe_mdio_cleanup(struct fe_priv *priv); ++int fe_connect_phy_node(struct fe_priv *priv, ++ struct device_node *phy_node); ++#else ++static inline int fe_mdio_init(struct fe_priv *priv) { return 0; } ++static inline void fe_mdio_cleanup(struct fe_priv *priv) {} ++#endif ++#endif +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -0,0 +1,1587 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "mdio.h" ++#include "ethtool.h" ++ ++#define MAX_RX_LENGTH 1536 ++#define FE_RX_ETH_HLEN (VLAN_ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN) ++#define FE_RX_HLEN (NET_SKB_PAD + FE_RX_ETH_HLEN + NET_IP_ALIGN) ++#define DMA_DUMMY_DESC 0xffffffff ++#define FE_DEFAULT_MSG_ENABLE \ ++ (NETIF_MSG_DRV | \ ++ NETIF_MSG_PROBE | \ ++ NETIF_MSG_LINK | \ ++ NETIF_MSG_TIMER | \ ++ NETIF_MSG_IFDOWN | \ ++ NETIF_MSG_IFUP | \ ++ NETIF_MSG_RX_ERR | \ ++ NETIF_MSG_TX_ERR) ++ ++#define TX_DMA_DESP2_DEF (TX_DMA_LS0 | TX_DMA_DONE) ++#define TX_DMA_DESP4_DEF (TX_DMA_QN(3) | TX_DMA_PN(1)) ++#define NEXT_TX_DESP_IDX(X) (((X) + 1) & (ring->tx_ring_size - 1)) ++#define NEXT_RX_DESP_IDX(X) (((X) + 1) & (ring->rx_ring_size - 1)) ++ ++#define SYSC_REG_RSTCTRL 0x34 ++ ++static int fe_msg_level = -1; ++module_param_named(msg_level, fe_msg_level, int, 0); ++MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)"); ++ ++static const u16 fe_reg_table_default[FE_REG_COUNT] = { ++ [FE_REG_PDMA_GLO_CFG] = FE_PDMA_GLO_CFG, ++ [FE_REG_PDMA_RST_CFG] = FE_PDMA_RST_CFG, ++ [FE_REG_DLY_INT_CFG] = FE_DLY_INT_CFG, ++ [FE_REG_TX_BASE_PTR0] = FE_TX_BASE_PTR0, ++ [FE_REG_TX_MAX_CNT0] = FE_TX_MAX_CNT0, ++ [FE_REG_TX_CTX_IDX0] = FE_TX_CTX_IDX0, ++ [FE_REG_TX_DTX_IDX0] = FE_TX_DTX_IDX0, ++ [FE_REG_RX_BASE_PTR0] = FE_RX_BASE_PTR0, ++ [FE_REG_RX_MAX_CNT0] = FE_RX_MAX_CNT0, ++ [FE_REG_RX_CALC_IDX0] = FE_RX_CALC_IDX0, ++ [FE_REG_RX_DRX_IDX0] = FE_RX_DRX_IDX0, ++ [FE_REG_FE_INT_ENABLE] = FE_FE_INT_ENABLE, ++ [FE_REG_FE_INT_STATUS] = FE_FE_INT_STATUS, ++ [FE_REG_FE_DMA_VID_BASE] = FE_DMA_VID0, ++ [FE_REG_FE_COUNTER_BASE] = FE_GDMA1_TX_GBCNT, ++ [FE_REG_FE_RST_GL] = FE_FE_RST_GL, ++}; ++ ++static const u16 *fe_reg_table = fe_reg_table_default; ++ ++struct fe_work_t { ++ int bitnr; ++ void (*action)(struct fe_priv *); ++}; ++ ++static void __iomem *fe_base; ++ ++void fe_w32(u32 val, unsigned reg) ++{ ++ __raw_writel(val, fe_base + reg); ++} ++ ++u32 fe_r32(unsigned reg) ++{ ++ return __raw_readl(fe_base + reg); ++} ++ ++void fe_reg_w32(u32 val, enum fe_reg reg) ++{ ++ fe_w32(val, fe_reg_table[reg]); ++} ++ ++u32 fe_reg_r32(enum fe_reg reg) ++{ ++ return fe_r32(fe_reg_table[reg]); ++} ++ ++void fe_reset(u32 reset_bits) ++{ ++ u32 t; ++ ++ t = rt_sysc_r32(SYSC_REG_RSTCTRL); ++ t |= reset_bits; ++ rt_sysc_w32(t, SYSC_REG_RSTCTRL); ++ usleep_range(10, 20); ++ ++ t &= ~reset_bits; ++ rt_sysc_w32(t, SYSC_REG_RSTCTRL); ++ usleep_range(10, 20); ++} ++ ++static inline void fe_int_disable(u32 mask) ++{ ++ fe_reg_w32(fe_reg_r32(FE_REG_FE_INT_ENABLE) & ~mask, ++ FE_REG_FE_INT_ENABLE); ++ /* flush write */ ++ fe_reg_r32(FE_REG_FE_INT_ENABLE); ++} ++ ++static inline void fe_int_enable(u32 mask) ++{ ++ fe_reg_w32(fe_reg_r32(FE_REG_FE_INT_ENABLE) | mask, ++ FE_REG_FE_INT_ENABLE); ++ /* flush write */ ++ fe_reg_r32(FE_REG_FE_INT_ENABLE); ++} ++ ++static inline void fe_hw_set_macaddr(struct fe_priv *priv, unsigned char *mac) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&priv->page_lock, flags); ++ fe_w32((mac[0] << 8) | mac[1], FE_GDMA1_MAC_ADRH); ++ fe_w32((mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | mac[5], ++ FE_GDMA1_MAC_ADRL); ++ spin_unlock_irqrestore(&priv->page_lock, flags); ++} ++ ++static int fe_set_mac_address(struct net_device *dev, void *p) ++{ ++ int ret = eth_mac_addr(dev, p); ++ ++ if (!ret) { ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ if (priv->soc->set_mac) ++ priv->soc->set_mac(priv, dev->dev_addr); ++ else ++ fe_hw_set_macaddr(priv, p); ++ } ++ ++ return ret; ++} ++ ++static inline int fe_max_frag_size(int mtu) ++{ ++ /* make sure buf_size will be at least MAX_RX_LENGTH */ ++ if (mtu + FE_RX_ETH_HLEN < MAX_RX_LENGTH) ++ mtu = MAX_RX_LENGTH - FE_RX_ETH_HLEN; ++ ++ return SKB_DATA_ALIGN(FE_RX_HLEN + mtu) + ++ SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); ++} ++ ++static inline int fe_max_buf_size(int frag_size) ++{ ++ int buf_size = frag_size - NET_SKB_PAD - NET_IP_ALIGN - ++ SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); ++ ++ BUG_ON(buf_size < MAX_RX_LENGTH); ++ return buf_size; ++} ++ ++static inline void fe_get_rxd(struct fe_rx_dma *rxd, struct fe_rx_dma *dma_rxd) ++{ ++ rxd->rxd1 = dma_rxd->rxd1; ++ rxd->rxd2 = dma_rxd->rxd2; ++ rxd->rxd3 = dma_rxd->rxd3; ++ rxd->rxd4 = dma_rxd->rxd4; ++} ++ ++static inline void fe_set_txd(struct fe_tx_dma *txd, struct fe_tx_dma *dma_txd) ++{ ++ dma_txd->txd1 = txd->txd1; ++ dma_txd->txd3 = txd->txd3; ++ dma_txd->txd4 = txd->txd4; ++ /* clean dma done flag last */ ++ dma_txd->txd2 = txd->txd2; ++} ++ ++static void fe_clean_rx(struct fe_priv *priv) ++{ ++ int i; ++ struct fe_rx_ring *ring = &priv->rx_ring; ++ ++ if (ring->rx_data) { ++ for (i = 0; i < ring->rx_ring_size; i++) ++ if (ring->rx_data[i]) { ++ if (ring->rx_dma && ring->rx_dma[i].rxd1) ++ dma_unmap_single(&priv->netdev->dev, ++ ring->rx_dma[i].rxd1, ++ ring->rx_buf_size, ++ DMA_FROM_DEVICE); ++ put_page(virt_to_head_page(ring->rx_data[i])); ++ } ++ ++ kfree(ring->rx_data); ++ ring->rx_data = NULL; ++ } ++ ++ if (ring->rx_dma) { ++ dma_free_coherent(&priv->netdev->dev, ++ ring->rx_ring_size * sizeof(*ring->rx_dma), ++ ring->rx_dma, ++ ring->rx_phys); ++ ring->rx_dma = NULL; ++ } ++} ++ ++static int fe_alloc_rx(struct fe_priv *priv) ++{ ++ struct net_device *netdev = priv->netdev; ++ struct fe_rx_ring *ring = &priv->rx_ring; ++ int i, pad; ++ ++ ring->rx_data = kcalloc(ring->rx_ring_size, sizeof(*ring->rx_data), ++ GFP_KERNEL); ++ if (!ring->rx_data) ++ goto no_rx_mem; ++ ++ for (i = 0; i < ring->rx_ring_size; i++) { ++ ring->rx_data[i] = netdev_alloc_frag(ring->frag_size); ++ if (!ring->rx_data[i]) ++ goto no_rx_mem; ++ } ++ ++ ring->rx_dma = dma_alloc_coherent(&netdev->dev, ++ ring->rx_ring_size * sizeof(*ring->rx_dma), ++ &ring->rx_phys, ++ GFP_ATOMIC | __GFP_ZERO); ++ if (!ring->rx_dma) ++ goto no_rx_mem; ++ ++ if (priv->flags & FE_FLAG_RX_2B_OFFSET) ++ pad = 0; ++ else ++ pad = NET_IP_ALIGN; ++ for (i = 0; i < ring->rx_ring_size; i++) { ++ dma_addr_t dma_addr = dma_map_single(&netdev->dev, ++ ring->rx_data[i] + NET_SKB_PAD + pad, ++ ring->rx_buf_size, ++ DMA_FROM_DEVICE); ++ if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) ++ goto no_rx_mem; ++ ring->rx_dma[i].rxd1 = (unsigned int)dma_addr; ++ ++ if (priv->flags & FE_FLAG_RX_SG_DMA) ++ ring->rx_dma[i].rxd2 = RX_DMA_PLEN0(ring->rx_buf_size); ++ else ++ ring->rx_dma[i].rxd2 = RX_DMA_LSO; ++ } ++ ring->rx_calc_idx = ring->rx_ring_size - 1; ++ /* make sure that all changes to the dma ring are flushed before we ++ * continue ++ */ ++ wmb(); ++ ++ fe_reg_w32(ring->rx_phys, FE_REG_RX_BASE_PTR0); ++ fe_reg_w32(ring->rx_ring_size, FE_REG_RX_MAX_CNT0); ++ fe_reg_w32(ring->rx_calc_idx, FE_REG_RX_CALC_IDX0); ++ fe_reg_w32(FE_PST_DRX_IDX0, FE_REG_PDMA_RST_CFG); ++ ++ return 0; ++ ++no_rx_mem: ++ return -ENOMEM; ++} ++ ++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) { ++ 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) ++ 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; ++ if (tx_buf->skb && (tx_buf->skb != (struct sk_buff *)DMA_DUMMY_DESC)) ++ dev_kfree_skb_any(tx_buf->skb); ++ tx_buf->skb = NULL; ++} ++ ++static void fe_clean_tx(struct fe_priv *priv) ++{ ++ int i; ++ struct device *dev = &priv->netdev->dev; ++ struct fe_tx_ring *ring = &priv->tx_ring; ++ ++ if (ring->tx_buf) { ++ for (i = 0; i < ring->tx_ring_size; i++) ++ fe_txd_unmap(dev, &ring->tx_buf[i]); ++ kfree(ring->tx_buf); ++ ring->tx_buf = NULL; ++ } ++ ++ if (ring->tx_dma) { ++ dma_free_coherent(dev, ++ ring->tx_ring_size * sizeof(*ring->tx_dma), ++ ring->tx_dma, ++ ring->tx_phys); ++ ring->tx_dma = NULL; ++ } ++ ++ netdev_reset_queue(priv->netdev); ++} ++ ++static int fe_alloc_tx(struct fe_priv *priv) ++{ ++ int i; ++ struct fe_tx_ring *ring = &priv->tx_ring; ++ ++ ring->tx_free_idx = 0; ++ ring->tx_next_idx = 0; ++ ring->tx_thresh = max((unsigned long)ring->tx_ring_size >> 2, ++ MAX_SKB_FRAGS); ++ ++ ring->tx_buf = kcalloc(ring->tx_ring_size, sizeof(*ring->tx_buf), ++ GFP_KERNEL); ++ if (!ring->tx_buf) ++ goto no_tx_mem; ++ ++ ring->tx_dma = dma_alloc_coherent(&priv->netdev->dev, ++ ring->tx_ring_size * sizeof(*ring->tx_dma), ++ &ring->tx_phys, ++ GFP_ATOMIC | __GFP_ZERO); ++ if (!ring->tx_dma) ++ goto no_tx_mem; ++ ++ for (i = 0; i < ring->tx_ring_size; i++) { ++ if (priv->soc->tx_dma) ++ priv->soc->tx_dma(&ring->tx_dma[i]); ++ ring->tx_dma[i].txd2 = TX_DMA_DESP2_DEF; ++ } ++ /* make sure that all changes to the dma ring are flushed before we ++ * continue ++ */ ++ wmb(); ++ ++ fe_reg_w32(ring->tx_phys, FE_REG_TX_BASE_PTR0); ++ fe_reg_w32(ring->tx_ring_size, FE_REG_TX_MAX_CNT0); ++ fe_reg_w32(0, FE_REG_TX_CTX_IDX0); ++ fe_reg_w32(FE_PST_DTX_IDX0, FE_REG_PDMA_RST_CFG); ++ ++ return 0; ++ ++no_tx_mem: ++ return -ENOMEM; ++} ++ ++static int fe_init_dma(struct fe_priv *priv) ++{ ++ int err; ++ ++ err = fe_alloc_tx(priv); ++ if (err) ++ return err; ++ ++ err = fe_alloc_rx(priv); ++ if (err) ++ return err; ++ ++ return 0; ++} ++ ++static void fe_free_dma(struct fe_priv *priv) ++{ ++ fe_clean_tx(priv); ++ fe_clean_rx(priv); ++} ++ ++void fe_stats_update(struct fe_priv *priv) ++{ ++ struct fe_hw_stats *hwstats = priv->hw_stats; ++ unsigned int base = fe_reg_table[FE_REG_FE_COUNTER_BASE]; ++ u64 stats; ++ ++ u64_stats_update_begin(&hwstats->syncp); ++ ++ if (IS_ENABLED(CONFIG_SOC_MT7621)) { ++ hwstats->rx_bytes += fe_r32(base); ++ stats = fe_r32(base + 0x04); ++ if (stats) ++ hwstats->rx_bytes += (stats << 32); ++ hwstats->rx_packets += fe_r32(base + 0x08); ++ hwstats->rx_overflow += fe_r32(base + 0x10); ++ hwstats->rx_fcs_errors += fe_r32(base + 0x14); ++ hwstats->rx_short_errors += fe_r32(base + 0x18); ++ hwstats->rx_long_errors += fe_r32(base + 0x1c); ++ hwstats->rx_checksum_errors += fe_r32(base + 0x20); ++ hwstats->rx_flow_control_packets += fe_r32(base + 0x24); ++ hwstats->tx_skip += fe_r32(base + 0x28); ++ hwstats->tx_collisions += fe_r32(base + 0x2c); ++ hwstats->tx_bytes += fe_r32(base + 0x30); ++ stats = fe_r32(base + 0x34); ++ if (stats) ++ hwstats->tx_bytes += (stats << 32); ++ hwstats->tx_packets += fe_r32(base + 0x38); ++ } else { ++ hwstats->tx_bytes += fe_r32(base); ++ hwstats->tx_packets += fe_r32(base + 0x04); ++ hwstats->tx_skip += fe_r32(base + 0x08); ++ hwstats->tx_collisions += fe_r32(base + 0x0c); ++ hwstats->rx_bytes += fe_r32(base + 0x20); ++ hwstats->rx_packets += fe_r32(base + 0x24); ++ hwstats->rx_overflow += fe_r32(base + 0x28); ++ hwstats->rx_fcs_errors += fe_r32(base + 0x2c); ++ hwstats->rx_short_errors += fe_r32(base + 0x30); ++ hwstats->rx_long_errors += fe_r32(base + 0x34); ++ hwstats->rx_checksum_errors += fe_r32(base + 0x38); ++ hwstats->rx_flow_control_packets += fe_r32(base + 0x3c); ++ } ++ ++ u64_stats_update_end(&hwstats->syncp); ++} ++ ++static struct rtnl_link_stats64 *fe_get_stats64(struct net_device *dev, ++ struct rtnl_link_stats64 *storage) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ struct fe_hw_stats *hwstats = priv->hw_stats; ++ unsigned int base = fe_reg_table[FE_REG_FE_COUNTER_BASE]; ++ unsigned int start; ++ ++ if (!base) { ++ netdev_stats_to_stats64(storage, &dev->stats); ++ return storage; ++ } ++ ++ if (netif_running(dev) && netif_device_present(dev)) { ++ if (spin_trylock(&hwstats->stats_lock)) { ++ fe_stats_update(priv); ++ spin_unlock(&hwstats->stats_lock); ++ } ++ } ++ ++ do { ++ start = u64_stats_fetch_begin_irq(&hwstats->syncp); ++ storage->rx_packets = hwstats->rx_packets; ++ storage->tx_packets = hwstats->tx_packets; ++ storage->rx_bytes = hwstats->rx_bytes; ++ storage->tx_bytes = hwstats->tx_bytes; ++ storage->collisions = hwstats->tx_collisions; ++ storage->rx_length_errors = hwstats->rx_short_errors + ++ hwstats->rx_long_errors; ++ storage->rx_over_errors = hwstats->rx_overflow; ++ storage->rx_crc_errors = hwstats->rx_fcs_errors; ++ storage->rx_errors = hwstats->rx_checksum_errors; ++ storage->tx_aborted_errors = hwstats->tx_skip; ++ } while (u64_stats_fetch_retry_irq(&hwstats->syncp, start)); ++ ++ storage->tx_errors = priv->netdev->stats.tx_errors; ++ storage->rx_dropped = priv->netdev->stats.rx_dropped; ++ storage->tx_dropped = priv->netdev->stats.tx_dropped; ++ ++ return storage; ++} ++ ++static int fe_vlan_rx_add_vid(struct net_device *dev, ++ __be16 proto, u16 vid) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ u32 idx = (vid & 0xf); ++ u32 vlan_cfg; ++ ++ if (!((fe_reg_table[FE_REG_FE_DMA_VID_BASE]) && ++ (dev->features & NETIF_F_HW_VLAN_CTAG_TX))) ++ return 0; ++ ++ if (test_bit(idx, &priv->vlan_map)) { ++ netdev_warn(dev, "disable tx vlan offload\n"); ++ dev->wanted_features &= ~NETIF_F_HW_VLAN_CTAG_TX; ++ netdev_update_features(dev); ++ } else { ++ vlan_cfg = fe_r32(fe_reg_table[FE_REG_FE_DMA_VID_BASE] + ++ ((idx >> 1) << 2)); ++ if (idx & 0x1) { ++ vlan_cfg &= 0xffff; ++ vlan_cfg |= (vid << 16); ++ } else { ++ vlan_cfg &= 0xffff0000; ++ vlan_cfg |= vid; ++ } ++ fe_w32(vlan_cfg, fe_reg_table[FE_REG_FE_DMA_VID_BASE] + ++ ((idx >> 1) << 2)); ++ set_bit(idx, &priv->vlan_map); ++ } ++ ++ return 0; ++} ++ ++static int fe_vlan_rx_kill_vid(struct net_device *dev, ++ __be16 proto, u16 vid) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ u32 idx = (vid & 0xf); ++ ++ if (!((fe_reg_table[FE_REG_FE_DMA_VID_BASE]) && ++ (dev->features & NETIF_F_HW_VLAN_CTAG_TX))) ++ return 0; ++ ++ clear_bit(idx, &priv->vlan_map); ++ ++ return 0; ++} ++ ++static inline u32 fe_empty_txd(struct fe_tx_ring *ring) ++{ ++ barrier(); ++ return (u32)(ring->tx_ring_size - ++ ((ring->tx_next_idx - ring->tx_free_idx) & ++ (ring->tx_ring_size - 1))); ++} ++ ++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_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; ++ ++ /* init tx descriptor */ ++ if (priv->soc->tx_dma) ++ priv->soc->tx_dma(&txd); ++ else ++ txd.txd4 = TX_DMA_DESP4_DEF; ++ def_txd4 = txd.txd4; ++ ++ /* TX Checksum offload */ ++ if (skb->ip_summed == CHECKSUM_PARTIAL) ++ 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; ++ else ++ txd.txd4 |= TX_DMA_INS_VLAN | ++ ((tag >> VLAN_PRIO_SHIFT) << 4) | ++ (tag & 0xF); ++ } ++ ++ /* TSO: fill MSS info in tcp checksum field */ ++ if (skb_is_gso(skb)) { ++ if (skb_cow_head(skb, 0)) { ++ netif_warn(priv, tx_err, dev, ++ "GSO expand head fail.\n"); ++ goto err_out; ++ } ++ if (skb_shinfo(skb)->gso_type & ++ (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { ++ 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)); ++ ++ /* TX SG offload */ ++ j = ring->tx_next_idx; ++ k = 0; ++ for (i = 0; i < nr_frags; i++) { ++ offset = 0; ++ 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++; ++ } ++ } ++ ++ /* set last segment */ ++ if (k & 0x1) ++ txd.txd2 |= TX_DMA_LS1; ++ else ++ txd.txd2 |= TX_DMA_LS0; ++ fe_set_txd(&txd, &ring->tx_dma[j]); ++ ++ /* store skb to cleanup */ ++ tx_buf->skb = skb; ++ ++ netdev_sent_queue(dev, skb->len); ++ skb_tx_timestamp(skb); ++ ++ ring->tx_next_idx = NEXT_TX_DESP_IDX(j); ++ /* make sure that all changes to the dma ring are flushed before we ++ * continue ++ */ ++ wmb(); ++ if (unlikely(fe_empty_txd(ring) <= ring->tx_thresh)) { ++ netif_stop_queue(dev); ++ smp_mb(); ++ if (unlikely(fe_empty_txd(ring) > ring->tx_thresh)) ++ netif_wake_queue(dev); ++ } ++ ++ if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more) ++ fe_reg_w32(ring->tx_next_idx, FE_REG_TX_CTX_IDX0); ++ ++ return 0; ++ ++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); ++ ++ 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 ++ * continue ++ */ ++ wmb(); ++ ++err_out: ++ return -1; ++} ++ ++static inline int fe_skb_padto(struct sk_buff *skb, struct fe_priv *priv) ++{ ++ unsigned int len; ++ int ret; ++ ++ ret = 0; ++ if (unlikely(skb->len < VLAN_ETH_ZLEN)) { ++ if ((priv->flags & FE_FLAG_PADDING_64B) && ++ !(priv->flags & FE_FLAG_PADDING_BUG)) ++ return ret; ++ ++ if (skb_vlan_tag_present(skb)) ++ len = ETH_ZLEN; ++ else if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) ++ len = VLAN_ETH_ZLEN; ++ else if (!(priv->flags & FE_FLAG_PADDING_64B)) ++ len = ETH_ZLEN; ++ else ++ return ret; ++ ++ if (skb->len < len) { ++ ret = skb_pad(skb, len - skb->len); ++ if (ret < 0) ++ return ret; ++ skb->len = len; ++ skb_set_tail_pointer(skb, len); ++ } ++ } ++ ++ return ret; ++} ++ ++static inline int fe_cal_txd_req(struct sk_buff *skb) ++{ ++ int i, nfrags; ++ struct skb_frag_struct *frag; ++ ++ nfrags = 1; ++ if (skb_is_gso(skb)) { ++ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { ++ frag = &skb_shinfo(skb)->frags[i]; ++ nfrags += DIV_ROUND_UP(frag->size, TX_DMA_BUF_LEN); ++ } ++ } else { ++ nfrags += skb_shinfo(skb)->nr_frags; ++ } ++ ++ return DIV_ROUND_UP(nfrags, 2); ++} ++ ++static int fe_start_xmit(struct sk_buff *skb, struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ struct fe_tx_ring *ring = &priv->tx_ring; ++ struct net_device_stats *stats = &dev->stats; ++ int tx_num; ++ int len = skb->len; ++ ++ if (fe_skb_padto(skb, priv)) { ++ netif_warn(priv, tx_err, dev, "tx padding failed!\n"); ++ return NETDEV_TX_OK; ++ } ++ ++ tx_num = fe_cal_txd_req(skb); ++ if (unlikely(fe_empty_txd(ring) <= tx_num)) { ++ netif_stop_queue(dev); ++ netif_err(priv, tx_queued, dev, ++ "Tx Ring full when queue awake!\n"); ++ return NETDEV_TX_BUSY; ++ } ++ ++ if (fe_tx_map_dma(skb, dev, tx_num, ring) < 0) { ++ stats->tx_dropped++; ++ } else { ++ stats->tx_packets++; ++ stats->tx_bytes += len; ++ } ++ ++ return NETDEV_TX_OK; ++} ++ ++static int fe_poll_rx(struct napi_struct *napi, int budget, ++ struct fe_priv *priv, u32 rx_intr) ++{ ++ struct net_device *netdev = priv->netdev; ++ struct net_device_stats *stats = &netdev->stats; ++ struct fe_soc_data *soc = priv->soc; ++ struct fe_rx_ring *ring = &priv->rx_ring; ++ int idx = ring->rx_calc_idx; ++ u32 checksum_bit; ++ struct sk_buff *skb; ++ u8 *data, *new_data; ++ struct fe_rx_dma *rxd, trxd; ++ int done = 0, pad; ++ ++ if (netdev->features & NETIF_F_RXCSUM) ++ checksum_bit = soc->checksum_bit; ++ else ++ checksum_bit = 0; ++ ++ if (priv->flags & FE_FLAG_RX_2B_OFFSET) ++ pad = 0; ++ else ++ pad = NET_IP_ALIGN; ++ ++ while (done < budget) { ++ unsigned int pktlen; ++ dma_addr_t dma_addr; ++ ++ idx = NEXT_RX_DESP_IDX(idx); ++ rxd = &ring->rx_dma[idx]; ++ data = ring->rx_data[idx]; ++ ++ fe_get_rxd(&trxd, rxd); ++ if (!(trxd.rxd2 & RX_DMA_DONE)) ++ break; ++ ++ /* alloc new buffer */ ++ new_data = netdev_alloc_frag(ring->frag_size); ++ if (unlikely(!new_data)) { ++ stats->rx_dropped++; ++ goto release_desc; ++ } ++ dma_addr = dma_map_single(&netdev->dev, ++ new_data + NET_SKB_PAD + pad, ++ ring->rx_buf_size, ++ DMA_FROM_DEVICE); ++ if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) { ++ put_page(virt_to_head_page(new_data)); ++ goto release_desc; ++ } ++ ++ /* receive data */ ++ skb = build_skb(data, ring->frag_size); ++ if (unlikely(!skb)) { ++ put_page(virt_to_head_page(new_data)); ++ goto release_desc; ++ } ++ skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN); ++ ++ dma_unmap_single(&netdev->dev, trxd.rxd1, ++ ring->rx_buf_size, DMA_FROM_DEVICE); ++ pktlen = RX_DMA_GET_PLEN0(trxd.rxd2); ++ skb->dev = netdev; ++ skb_put(skb, pktlen); ++ if (trxd.rxd4 & checksum_bit) ++ skb->ip_summed = CHECKSUM_UNNECESSARY; ++ else ++ skb_checksum_none_assert(skb); ++ skb->protocol = eth_type_trans(skb, netdev); ++ ++ stats->rx_packets++; ++ stats->rx_bytes += pktlen; ++ ++ napi_gro_receive(napi, skb); ++ ++ ring->rx_data[idx] = new_data; ++ rxd->rxd1 = (unsigned int)dma_addr; ++ ++release_desc: ++ if (priv->flags & FE_FLAG_RX_SG_DMA) ++ rxd->rxd2 = RX_DMA_PLEN0(ring->rx_buf_size); ++ else ++ rxd->rxd2 = RX_DMA_LSO; ++ ++ ring->rx_calc_idx = idx; ++ /* make sure that all changes to the dma ring are flushed before ++ * we continue ++ */ ++ wmb(); ++ fe_reg_w32(ring->rx_calc_idx, FE_REG_RX_CALC_IDX0); ++ done++; ++ } ++ ++ if (done < budget) ++ fe_reg_w32(rx_intr, FE_REG_FE_INT_STATUS); ++ ++ return done; ++} ++ ++static int fe_poll_tx(struct fe_priv *priv, int budget, u32 tx_intr, ++ int *tx_again) ++{ ++ struct net_device *netdev = priv->netdev; ++ struct device *dev = &netdev->dev; ++ unsigned int bytes_compl = 0; ++ struct sk_buff *skb; ++ struct fe_tx_buf *tx_buf; ++ int done = 0; ++ u32 idx, hwidx; ++ struct fe_tx_ring *ring = &priv->tx_ring; ++ ++ idx = ring->tx_free_idx; ++ hwidx = fe_reg_r32(FE_REG_TX_DTX_IDX0); ++ ++ while ((idx != hwidx) && budget) { ++ tx_buf = &ring->tx_buf[idx]; ++ skb = tx_buf->skb; ++ ++ if (!skb) ++ break; ++ ++ if (skb != (struct sk_buff *)DMA_DUMMY_DESC) { ++ bytes_compl += skb->len; ++ done++; ++ budget--; ++ } ++ fe_txd_unmap(dev, tx_buf); ++ idx = NEXT_TX_DESP_IDX(idx); ++ } ++ ring->tx_free_idx = idx; ++ ++ if (idx == hwidx) { ++ /* read hw index again make sure no new tx packet */ ++ hwidx = fe_reg_r32(FE_REG_TX_DTX_IDX0); ++ if (idx == hwidx) ++ fe_reg_w32(tx_intr, FE_REG_FE_INT_STATUS); ++ else ++ *tx_again = 1; ++ } else { ++ *tx_again = 1; ++ } ++ ++ if (done) { ++ netdev_completed_queue(netdev, done, bytes_compl); ++ smp_mb(); ++ if (unlikely(netif_queue_stopped(netdev) && ++ (fe_empty_txd(ring) > ring->tx_thresh))) ++ netif_wake_queue(netdev); ++ } ++ ++ return done; ++} ++ ++static int fe_poll(struct napi_struct *napi, int budget) ++{ ++ struct fe_priv *priv = container_of(napi, struct fe_priv, rx_napi); ++ struct fe_hw_stats *hwstat = priv->hw_stats; ++ int tx_done, rx_done, tx_again; ++ u32 status, fe_status, status_reg, mask; ++ u32 tx_intr, rx_intr, status_intr; ++ ++ status = fe_reg_r32(FE_REG_FE_INT_STATUS); ++ fe_status = status; ++ tx_intr = priv->soc->tx_int; ++ rx_intr = priv->soc->rx_int; ++ status_intr = priv->soc->status_int; ++ tx_done = 0; ++ rx_done = 0; ++ tx_again = 0; ++ ++ if (fe_reg_table[FE_REG_FE_INT_STATUS2]) { ++ fe_status = fe_reg_r32(FE_REG_FE_INT_STATUS2); ++ status_reg = FE_REG_FE_INT_STATUS2; ++ } else { ++ status_reg = FE_REG_FE_INT_STATUS; ++ } ++ ++ if (status & tx_intr) ++ tx_done = fe_poll_tx(priv, budget, tx_intr, &tx_again); ++ ++ if (status & rx_intr) ++ rx_done = fe_poll_rx(napi, budget, priv, rx_intr); ++ ++ if (unlikely(fe_status & status_intr)) { ++ if (hwstat && spin_trylock(&hwstat->stats_lock)) { ++ fe_stats_update(priv); ++ spin_unlock(&hwstat->stats_lock); ++ } ++ fe_reg_w32(status_intr, status_reg); ++ } ++ ++ if (unlikely(netif_msg_intr(priv))) { ++ mask = fe_reg_r32(FE_REG_FE_INT_ENABLE); ++ netdev_info(priv->netdev, ++ "done tx %d, rx %d, intr 0x%08x/0x%x\n", ++ tx_done, rx_done, status, mask); ++ } ++ ++ if (!tx_again && (rx_done < budget)) { ++ status = fe_reg_r32(FE_REG_FE_INT_STATUS); ++ if (status & (tx_intr | rx_intr)) { ++ /* let napi poll again */ ++ rx_done = budget; ++ goto poll_again; ++ } ++ ++ napi_complete(napi); ++ fe_int_enable(tx_intr | rx_intr); ++ } else { ++ rx_done = budget; ++ } ++ ++poll_again: ++ return rx_done; ++} ++ ++static void fe_tx_timeout(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ struct fe_tx_ring *ring = &priv->tx_ring; ++ ++ priv->netdev->stats.tx_errors++; ++ netif_err(priv, tx_err, dev, ++ "transmit timed out\n"); ++ netif_info(priv, drv, dev, "dma_cfg:%08x\n", ++ fe_reg_r32(FE_REG_PDMA_GLO_CFG)); ++ netif_info(priv, drv, dev, "tx_ring=%d, " ++ "base=%08x, max=%u, ctx=%u, dtx=%u, fdx=%hu, next=%hu\n", ++ 0, fe_reg_r32(FE_REG_TX_BASE_PTR0), ++ fe_reg_r32(FE_REG_TX_MAX_CNT0), ++ fe_reg_r32(FE_REG_TX_CTX_IDX0), ++ fe_reg_r32(FE_REG_TX_DTX_IDX0), ++ ring->tx_free_idx, ++ ring->tx_next_idx); ++ netif_info(priv, drv, dev, ++ "rx_ring=%d, base=%08x, max=%u, calc=%u, drx=%u\n", ++ 0, fe_reg_r32(FE_REG_RX_BASE_PTR0), ++ fe_reg_r32(FE_REG_RX_MAX_CNT0), ++ fe_reg_r32(FE_REG_RX_CALC_IDX0), ++ fe_reg_r32(FE_REG_RX_DRX_IDX0)); ++ ++ if (!test_and_set_bit(FE_FLAG_RESET_PENDING, priv->pending_flags)) ++ schedule_work(&priv->pending_work); ++} ++ ++static irqreturn_t fe_handle_irq(int irq, void *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ u32 status, int_mask; ++ ++ status = fe_reg_r32(FE_REG_FE_INT_STATUS); ++ ++ if (unlikely(!status)) ++ return IRQ_NONE; ++ ++ int_mask = (priv->soc->rx_int | priv->soc->tx_int); ++ if (likely(status & int_mask)) { ++ if (likely(napi_schedule_prep(&priv->rx_napi))) { ++ fe_int_disable(int_mask); ++ __napi_schedule(&priv->rx_napi); ++ } ++ } else { ++ fe_reg_w32(status, FE_REG_FE_INT_STATUS); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++#ifdef CONFIG_NET_POLL_CONTROLLER ++static void fe_poll_controller(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ u32 int_mask = priv->soc->tx_int | priv->soc->rx_int; ++ ++ fe_int_disable(int_mask); ++ fe_handle_irq(dev->irq, dev); ++ fe_int_enable(int_mask); ++} ++#endif ++ ++int fe_set_clock_cycle(struct fe_priv *priv) ++{ ++ unsigned long sysclk = priv->sysclk; ++ ++ sysclk /= FE_US_CYC_CNT_DIVISOR; ++ sysclk <<= FE_US_CYC_CNT_SHIFT; ++ ++ fe_w32((fe_r32(FE_FE_GLO_CFG) & ++ ~(FE_US_CYC_CNT_MASK << FE_US_CYC_CNT_SHIFT)) | ++ sysclk, ++ FE_FE_GLO_CFG); ++ return 0; ++} ++ ++void fe_fwd_config(struct fe_priv *priv) ++{ ++ u32 fwd_cfg; ++ ++ fwd_cfg = fe_r32(FE_GDMA1_FWD_CFG); ++ ++ /* disable jumbo frame */ ++ if (priv->flags & FE_FLAG_JUMBO_FRAME) ++ fwd_cfg &= ~FE_GDM1_JMB_EN; ++ ++ /* set unicast/multicast/broadcast frame to cpu */ ++ fwd_cfg &= ~0xffff; ++ ++ fe_w32(fwd_cfg, FE_GDMA1_FWD_CFG); ++} ++ ++static void fe_rxcsum_config(bool enable) ++{ ++ if (enable) ++ fe_w32(fe_r32(FE_GDMA1_FWD_CFG) | (FE_GDM1_ICS_EN | ++ FE_GDM1_TCS_EN | FE_GDM1_UCS_EN), ++ FE_GDMA1_FWD_CFG); ++ else ++ fe_w32(fe_r32(FE_GDMA1_FWD_CFG) & ~(FE_GDM1_ICS_EN | ++ FE_GDM1_TCS_EN | FE_GDM1_UCS_EN), ++ FE_GDMA1_FWD_CFG); ++} ++ ++static void fe_txcsum_config(bool enable) ++{ ++ if (enable) ++ fe_w32(fe_r32(FE_CDMA_CSG_CFG) | (FE_ICS_GEN_EN | ++ FE_TCS_GEN_EN | FE_UCS_GEN_EN), ++ FE_CDMA_CSG_CFG); ++ else ++ fe_w32(fe_r32(FE_CDMA_CSG_CFG) & ~(FE_ICS_GEN_EN | ++ FE_TCS_GEN_EN | FE_UCS_GEN_EN), ++ FE_CDMA_CSG_CFG); ++} ++ ++void fe_csum_config(struct fe_priv *priv) ++{ ++ struct net_device *dev = priv_netdev(priv); ++ ++ fe_txcsum_config((dev->features & NETIF_F_IP_CSUM)); ++ fe_rxcsum_config((dev->features & NETIF_F_RXCSUM)); ++} ++ ++static int fe_hw_init(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ int i, err; ++ ++ err = devm_request_irq(priv->device, dev->irq, fe_handle_irq, 0, ++ dev_name(priv->device), dev); ++ if (err) ++ return err; ++ ++ if (priv->soc->set_mac) ++ priv->soc->set_mac(priv, dev->dev_addr); ++ else ++ fe_hw_set_macaddr(priv, dev->dev_addr); ++ ++ /* disable delay interrupt */ ++ fe_reg_w32(0, FE_REG_DLY_INT_CFG); ++ ++ fe_int_disable(priv->soc->tx_int | priv->soc->rx_int); ++ ++ /* frame engine will push VLAN tag regarding to VIDX feild in Tx desc */ ++ if (fe_reg_table[FE_REG_FE_DMA_VID_BASE]) ++ for (i = 0; i < 16; i += 2) ++ fe_w32(((i + 1) << 16) + i, ++ fe_reg_table[FE_REG_FE_DMA_VID_BASE] + ++ (i * 2)); ++ ++ if (priv->soc->fwd_config(priv)) ++ netdev_err(dev, "unable to get clock\n"); ++ ++ if (fe_reg_table[FE_REG_FE_RST_GL]) { ++ fe_reg_w32(1, FE_REG_FE_RST_GL); ++ fe_reg_w32(0, FE_REG_FE_RST_GL); ++ } ++ ++ return 0; ++} ++ ++static int fe_open(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ unsigned long flags; ++ u32 val; ++ int err; ++ ++ err = fe_init_dma(priv); ++ if (err) { ++ fe_free_dma(priv); ++ return err; ++ } ++ ++ spin_lock_irqsave(&priv->page_lock, flags); ++ ++ val = FE_TX_WB_DDONE | FE_RX_DMA_EN | FE_TX_DMA_EN; ++ if (priv->flags & FE_FLAG_RX_2B_OFFSET) ++ val |= FE_RX_2B_OFFSET; ++ val |= priv->soc->pdma_glo_cfg; ++ fe_reg_w32(val, FE_REG_PDMA_GLO_CFG); ++ ++ spin_unlock_irqrestore(&priv->page_lock, flags); ++ ++ if (priv->phy) ++ priv->phy->start(priv); ++ ++ if (priv->soc->has_carrier && priv->soc->has_carrier(priv)) ++ netif_carrier_on(dev); ++ ++ napi_enable(&priv->rx_napi); ++ fe_int_enable(priv->soc->tx_int | priv->soc->rx_int); ++ netif_start_queue(dev); ++ ++ return 0; ++} ++ ++static int fe_stop(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ unsigned long flags; ++ int i; ++ ++ netif_tx_disable(dev); ++ fe_int_disable(priv->soc->tx_int | priv->soc->rx_int); ++ napi_disable(&priv->rx_napi); ++ ++ if (priv->phy) ++ priv->phy->stop(priv); ++ ++ spin_lock_irqsave(&priv->page_lock, flags); ++ ++ fe_reg_w32(fe_reg_r32(FE_REG_PDMA_GLO_CFG) & ++ ~(FE_TX_WB_DDONE | FE_RX_DMA_EN | FE_TX_DMA_EN), ++ FE_REG_PDMA_GLO_CFG); ++ spin_unlock_irqrestore(&priv->page_lock, flags); ++ ++ /* wait dma stop */ ++ for (i = 0; i < 10; i++) { ++ if (fe_reg_r32(FE_REG_PDMA_GLO_CFG) & ++ (FE_TX_DMA_BUSY | FE_RX_DMA_BUSY)) { ++ msleep(20); ++ continue; ++ } ++ break; ++ } ++ ++ fe_free_dma(priv); ++ ++ return 0; ++} ++ ++static int __init fe_init(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ struct device_node *port; ++ const char *mac_addr; ++ int err; ++ ++ priv->soc->reset_fe(); ++ ++ if (priv->soc->switch_init) ++ if (priv->soc->switch_init(priv)) { ++ netdev_err(dev, "failed to initialize switch core\n"); ++ return -ENODEV; ++ } ++ ++ mac_addr = of_get_mac_address(priv->device->of_node); ++ if (mac_addr) ++ ether_addr_copy(dev->dev_addr, mac_addr); ++ ++ /* If the mac address is invalid, use random mac address */ ++ if (!is_valid_ether_addr(dev->dev_addr)) { ++ random_ether_addr(dev->dev_addr); ++ dev_err(priv->device, "generated random MAC address %pM\n", ++ dev->dev_addr); ++ } ++ ++ err = fe_mdio_init(priv); ++ if (err) ++ return err; ++ ++ if (priv->soc->port_init) ++ for_each_child_of_node(priv->device->of_node, port) ++ if (of_device_is_compatible(port, "mediatek,eth-port") && ++ of_device_is_available(port)) ++ priv->soc->port_init(priv, port); ++ ++ if (priv->phy) { ++ err = priv->phy->connect(priv); ++ if (err) ++ goto err_phy_disconnect; ++ } ++ ++ err = fe_hw_init(dev); ++ if (!err) ++ return 0; ++ ++err_phy_disconnect: ++ if (priv->phy) ++ priv->phy->disconnect(priv); ++ fe_mdio_cleanup(priv); ++ ++ return err; ++} ++ ++static void fe_uninit(struct net_device *dev) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ if (priv->phy) ++ priv->phy->disconnect(priv); ++ fe_mdio_cleanup(priv); ++ ++ fe_reg_w32(0, FE_REG_FE_INT_ENABLE); ++ free_irq(dev->irq, dev); ++} ++ ++static int fe_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ if (!priv->phy_dev) ++ return -ENODEV; ++ ++ switch (cmd) { ++ case SIOCGMIIPHY: ++ case SIOCGMIIREG: ++ case SIOCSMIIREG: ++ return phy_mii_ioctl(priv->phy_dev, ifr, cmd); ++ default: ++ break; ++ } ++ ++ return -EOPNOTSUPP; ++} ++ ++static int fe_change_mtu(struct net_device *dev, int new_mtu) ++{ ++ struct fe_priv *priv = netdev_priv(dev); ++ int frag_size, old_mtu; ++ u32 fwd_cfg; ++ ++ if (!(priv->flags & FE_FLAG_JUMBO_FRAME)) ++ return eth_change_mtu(dev, new_mtu); ++ ++ 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; ++ ++ /* return early if the buffer sizes will not change */ ++ if (old_mtu <= ETH_DATA_LEN && new_mtu <= ETH_DATA_LEN) ++ return 0; ++ if (old_mtu > ETH_DATA_LEN && new_mtu > ETH_DATA_LEN) ++ return 0; ++ ++ if (new_mtu <= ETH_DATA_LEN) ++ priv->rx_ring.frag_size = fe_max_frag_size(ETH_DATA_LEN); ++ else ++ priv->rx_ring.frag_size = PAGE_SIZE; ++ priv->rx_ring.rx_buf_size = fe_max_buf_size(priv->rx_ring.frag_size); ++ ++ if (!netif_running(dev)) ++ return 0; ++ ++ fe_stop(dev); ++ fwd_cfg = fe_r32(FE_GDMA1_FWD_CFG); ++ if (new_mtu <= ETH_DATA_LEN) { ++ fwd_cfg &= ~FE_GDM1_JMB_EN; ++ } else { ++ 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; ++ } ++ fe_w32(fwd_cfg, FE_GDMA1_FWD_CFG); ++ ++ return fe_open(dev); ++} ++ ++static const struct net_device_ops fe_netdev_ops = { ++ .ndo_init = fe_init, ++ .ndo_uninit = fe_uninit, ++ .ndo_open = fe_open, ++ .ndo_stop = fe_stop, ++ .ndo_start_xmit = fe_start_xmit, ++ .ndo_set_mac_address = fe_set_mac_address, ++ .ndo_validate_addr = eth_validate_addr, ++ .ndo_do_ioctl = fe_do_ioctl, ++ .ndo_change_mtu = fe_change_mtu, ++ .ndo_tx_timeout = fe_tx_timeout, ++ .ndo_get_stats64 = fe_get_stats64, ++ .ndo_vlan_rx_add_vid = fe_vlan_rx_add_vid, ++ .ndo_vlan_rx_kill_vid = fe_vlan_rx_kill_vid, ++#ifdef CONFIG_NET_POLL_CONTROLLER ++ .ndo_poll_controller = fe_poll_controller, ++#endif ++}; ++ ++static void fe_reset_pending(struct fe_priv *priv) ++{ ++ struct net_device *dev = priv->netdev; ++ int err; ++ ++ rtnl_lock(); ++ fe_stop(dev); ++ ++ err = fe_open(dev); ++ if (err) { ++ netif_alert(priv, ifup, dev, ++ "Driver up/down cycle failed, closing device.\n"); ++ dev_close(dev); ++ } ++ rtnl_unlock(); ++} ++ ++static const struct fe_work_t fe_work[] = { ++ {FE_FLAG_RESET_PENDING, fe_reset_pending}, ++}; ++ ++static void fe_pending_work(struct work_struct *work) ++{ ++ struct fe_priv *priv = container_of(work, struct fe_priv, pending_work); ++ int i; ++ bool pending; ++ ++ for (i = 0; i < ARRAY_SIZE(fe_work); i++) { ++ pending = test_and_clear_bit(fe_work[i].bitnr, ++ priv->pending_flags); ++ if (pending) ++ fe_work[i].action(priv); ++ } ++} ++ ++static int fe_probe(struct platform_device *pdev) ++{ ++ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ const struct of_device_id *match; ++ struct fe_soc_data *soc; ++ struct net_device *netdev; ++ struct fe_priv *priv; ++ struct clk *sysclk; ++ int err, napi_weight; ++ ++ device_reset(&pdev->dev); ++ ++ match = of_match_device(of_fe_match, &pdev->dev); ++ soc = (struct fe_soc_data *)match->data; ++ ++ if (soc->reg_table) ++ fe_reg_table = soc->reg_table; ++ else ++ soc->reg_table = fe_reg_table; ++ ++ fe_base = devm_ioremap_resource(&pdev->dev, res); ++ if (!fe_base) { ++ err = -EADDRNOTAVAIL; ++ goto err_out; ++ } ++ ++ netdev = alloc_etherdev(sizeof(*priv)); ++ if (!netdev) { ++ dev_err(&pdev->dev, "alloc_etherdev failed\n"); ++ err = -ENOMEM; ++ goto err_iounmap; ++ } ++ ++ SET_NETDEV_DEV(netdev, &pdev->dev); ++ netdev->netdev_ops = &fe_netdev_ops; ++ netdev->base_addr = (unsigned long)fe_base; ++ ++ netdev->irq = platform_get_irq(pdev, 0); ++ if (netdev->irq < 0) { ++ dev_err(&pdev->dev, "no IRQ resource found\n"); ++ err = -ENXIO; ++ goto err_free_dev; ++ } ++ ++ if (soc->init_data) ++ soc->init_data(soc, netdev); ++ netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_CTAG_TX; ++ netdev->features |= netdev->hw_features; ++ ++ /* 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; ++ ++ priv = netdev_priv(netdev); ++ spin_lock_init(&priv->page_lock); ++ if (fe_reg_table[FE_REG_FE_COUNTER_BASE]) { ++ priv->hw_stats = kzalloc(sizeof(*priv->hw_stats), GFP_KERNEL); ++ if (!priv->hw_stats) { ++ err = -ENOMEM; ++ goto err_free_dev; ++ } ++ spin_lock_init(&priv->hw_stats->stats_lock); ++ } ++ ++ sysclk = devm_clk_get(&pdev->dev, NULL); ++ if (!IS_ERR(sysclk)) { ++ priv->sysclk = clk_get_rate(sysclk); ++ } else if ((priv->flags & FE_FLAG_CALIBRATE_CLK)) { ++ dev_err(&pdev->dev, "this soc needs a clk for calibration\n"); ++ err = -ENXIO; ++ goto err_free_dev; ++ } ++ ++ priv->switch_np = of_parse_phandle(pdev->dev.of_node, "mediatek,switch", 0); ++ if ((priv->flags & FE_FLAG_HAS_SWITCH) && !priv->switch_np) { ++ dev_err(&pdev->dev, "failed to read switch phandle\n"); ++ err = -ENODEV; ++ goto err_free_dev; ++ } ++ ++ priv->netdev = netdev; ++ priv->device = &pdev->dev; ++ priv->soc = soc; ++ priv->msg_enable = netif_msg_init(fe_msg_level, FE_DEFAULT_MSG_ENABLE); ++ priv->rx_ring.frag_size = fe_max_frag_size(ETH_DATA_LEN); ++ priv->rx_ring.rx_buf_size = fe_max_buf_size(priv->rx_ring.frag_size); ++ priv->tx_ring.tx_ring_size = NUM_DMA_DESC; ++ priv->rx_ring.rx_ring_size = NUM_DMA_DESC; ++ INIT_WORK(&priv->pending_work, fe_pending_work); ++ ++ napi_weight = 32; ++ if (priv->flags & FE_FLAG_NAPI_WEIGHT) { ++ napi_weight *= 4; ++ priv->tx_ring.tx_ring_size *= 4; ++ priv->rx_ring.rx_ring_size *= 4; ++ } ++ netif_napi_add(netdev, &priv->rx_napi, fe_poll, napi_weight); ++ fe_set_ethtool_ops(netdev); ++ ++ err = register_netdev(netdev); ++ if (err) { ++ dev_err(&pdev->dev, "error bringing up device\n"); ++ goto err_free_dev; ++ } ++ ++ platform_set_drvdata(pdev, netdev); ++ ++ netif_info(priv, probe, netdev, "mediatek frame engine at 0x%08lx, irq %d\n", ++ netdev->base_addr, netdev->irq); ++ ++ return 0; ++ ++err_free_dev: ++ free_netdev(netdev); ++err_iounmap: ++ devm_iounmap(&pdev->dev, fe_base); ++err_out: ++ return err; ++} ++ ++static int fe_remove(struct platform_device *pdev) ++{ ++ struct net_device *dev = platform_get_drvdata(pdev); ++ struct fe_priv *priv = netdev_priv(dev); ++ ++ netif_napi_del(&priv->rx_napi); ++ kfree(priv->hw_stats); ++ ++ cancel_work_sync(&priv->pending_work); ++ ++ unregister_netdev(dev); ++ free_netdev(dev); ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++static struct platform_driver fe_driver = { ++ .probe = fe_probe, ++ .remove = fe_remove, ++ .driver = { ++ .name = "mtk_soc_eth", ++ .owner = THIS_MODULE, ++ .of_match_table = of_fe_match, ++ }, ++}; ++ ++module_platform_driver(fe_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("John Crispin "); ++MODULE_DESCRIPTION("Ethernet driver for Ralink SoC"); ++MODULE_VERSION(MTK_FE_DRV_VERSION); +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -0,0 +1,522 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#ifndef FE_ETH_H ++#define FE_ETH_H ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++enum fe_reg { ++ FE_REG_PDMA_GLO_CFG = 0, ++ FE_REG_PDMA_RST_CFG, ++ FE_REG_DLY_INT_CFG, ++ FE_REG_TX_BASE_PTR0, ++ FE_REG_TX_MAX_CNT0, ++ FE_REG_TX_CTX_IDX0, ++ FE_REG_TX_DTX_IDX0, ++ FE_REG_RX_BASE_PTR0, ++ FE_REG_RX_MAX_CNT0, ++ FE_REG_RX_CALC_IDX0, ++ FE_REG_RX_DRX_IDX0, ++ FE_REG_FE_INT_ENABLE, ++ FE_REG_FE_INT_STATUS, ++ FE_REG_FE_DMA_VID_BASE, ++ FE_REG_FE_COUNTER_BASE, ++ FE_REG_FE_RST_GL, ++ FE_REG_FE_INT_STATUS2, ++ FE_REG_COUNT ++}; ++ ++enum fe_work_flag { ++ FE_FLAG_RESET_PENDING, ++ FE_FLAG_MAX ++}; ++ ++#define MTK_FE_DRV_VERSION "0.1.2" ++ ++/* power of 2 to let NEXT_TX_DESP_IDX work */ ++#define NUM_DMA_DESC BIT(7) ++#define MAX_DMA_DESC 0xfff ++ ++#define FE_DELAY_EN_INT 0x80 ++#define FE_DELAY_MAX_INT 0x04 ++#define FE_DELAY_MAX_TOUT 0x04 ++#define FE_DELAY_TIME 20 ++#define FE_DELAY_CHAN (((FE_DELAY_EN_INT | FE_DELAY_MAX_INT) << 8) | \ ++ FE_DELAY_MAX_TOUT) ++#define FE_DELAY_INIT ((FE_DELAY_CHAN << 16) | FE_DELAY_CHAN) ++#define FE_PSE_FQFC_CFG_INIT 0x80504000 ++#define FE_PSE_FQFC_CFG_256Q 0xff908000 ++ ++/* interrupt bits */ ++#define FE_CNT_PPE_AF BIT(31) ++#define FE_CNT_GDM_AF BIT(29) ++#define FE_PSE_P2_FC BIT(26) ++#define FE_PSE_BUF_DROP BIT(24) ++#define FE_GDM_OTHER_DROP BIT(23) ++#define FE_PSE_P1_FC BIT(22) ++#define FE_PSE_P0_FC BIT(21) ++#define FE_PSE_FQ_EMPTY BIT(20) ++#define FE_GE1_STA_CHG BIT(18) ++#define FE_TX_COHERENT BIT(17) ++#define FE_RX_COHERENT BIT(16) ++#define FE_TX_DONE_INT3 BIT(11) ++#define FE_TX_DONE_INT2 BIT(10) ++#define FE_TX_DONE_INT1 BIT(9) ++#define FE_TX_DONE_INT0 BIT(8) ++#define FE_RX_DONE_INT0 BIT(2) ++#define FE_TX_DLY_INT BIT(1) ++#define FE_RX_DLY_INT BIT(0) ++ ++#define FE_RX_DONE_INT FE_RX_DONE_INT0 ++#define FE_TX_DONE_INT (FE_TX_DONE_INT0 | FE_TX_DONE_INT1 | \ ++ FE_TX_DONE_INT2 | FE_TX_DONE_INT3) ++ ++#define RT5350_RX_DLY_INT BIT(30) ++#define RT5350_TX_DLY_INT BIT(28) ++#define RT5350_RX_DONE_INT1 BIT(17) ++#define RT5350_RX_DONE_INT0 BIT(16) ++#define RT5350_TX_DONE_INT3 BIT(3) ++#define RT5350_TX_DONE_INT2 BIT(2) ++#define RT5350_TX_DONE_INT1 BIT(1) ++#define RT5350_TX_DONE_INT0 BIT(0) ++ ++#define RT5350_RX_DONE_INT (RT5350_RX_DONE_INT0 | RT5350_RX_DONE_INT1) ++#define RT5350_TX_DONE_INT (RT5350_TX_DONE_INT0 | RT5350_TX_DONE_INT1 | \ ++ RT5350_TX_DONE_INT2 | RT5350_TX_DONE_INT3) ++ ++/* registers */ ++#define FE_FE_OFFSET 0x0000 ++#define FE_GDMA_OFFSET 0x0020 ++#define FE_PSE_OFFSET 0x0040 ++#define FE_GDMA2_OFFSET 0x0060 ++#define FE_CDMA_OFFSET 0x0080 ++#define FE_DMA_VID0 0x00a8 ++#define FE_PDMA_OFFSET 0x0100 ++#define FE_PPE_OFFSET 0x0200 ++#define FE_CMTABLE_OFFSET 0x0400 ++#define FE_POLICYTABLE_OFFSET 0x1000 ++ ++#define RT5350_PDMA_OFFSET 0x0800 ++#define RT5350_SDM_OFFSET 0x0c00 ++ ++#define FE_MDIO_ACCESS (FE_FE_OFFSET + 0x00) ++#define FE_MDIO_CFG (FE_FE_OFFSET + 0x04) ++#define FE_FE_GLO_CFG (FE_FE_OFFSET + 0x08) ++#define FE_FE_RST_GL (FE_FE_OFFSET + 0x0C) ++#define FE_FE_INT_STATUS (FE_FE_OFFSET + 0x10) ++#define FE_FE_INT_ENABLE (FE_FE_OFFSET + 0x14) ++#define FE_MDIO_CFG2 (FE_FE_OFFSET + 0x18) ++#define FE_FOC_TS_T (FE_FE_OFFSET + 0x1C) ++ ++#define FE_GDMA1_FWD_CFG (FE_GDMA_OFFSET + 0x00) ++#define FE_GDMA1_SCH_CFG (FE_GDMA_OFFSET + 0x04) ++#define FE_GDMA1_SHPR_CFG (FE_GDMA_OFFSET + 0x08) ++#define FE_GDMA1_MAC_ADRL (FE_GDMA_OFFSET + 0x0C) ++#define FE_GDMA1_MAC_ADRH (FE_GDMA_OFFSET + 0x10) ++ ++#define FE_GDMA2_FWD_CFG (FE_GDMA2_OFFSET + 0x00) ++#define FE_GDMA2_SCH_CFG (FE_GDMA2_OFFSET + 0x04) ++#define FE_GDMA2_SHPR_CFG (FE_GDMA2_OFFSET + 0x08) ++#define FE_GDMA2_MAC_ADRL (FE_GDMA2_OFFSET + 0x0C) ++#define FE_GDMA2_MAC_ADRH (FE_GDMA2_OFFSET + 0x10) ++ ++#define FE_PSE_FQ_CFG (FE_PSE_OFFSET + 0x00) ++#define FE_CDMA_FC_CFG (FE_PSE_OFFSET + 0x04) ++#define FE_GDMA1_FC_CFG (FE_PSE_OFFSET + 0x08) ++#define FE_GDMA2_FC_CFG (FE_PSE_OFFSET + 0x0C) ++ ++#define FE_CDMA_CSG_CFG (FE_CDMA_OFFSET + 0x00) ++#define FE_CDMA_SCH_CFG (FE_CDMA_OFFSET + 0x04) ++ ++#ifdef CONFIG_SOC_MT7621 ++#define MT7620A_GDMA_OFFSET 0x0500 ++#else ++#define MT7620A_GDMA_OFFSET 0x0600 ++#endif ++#define MT7620A_GDMA1_FWD_CFG (MT7620A_GDMA_OFFSET + 0x00) ++#define MT7620A_FE_GDMA1_SCH_CFG (MT7620A_GDMA_OFFSET + 0x04) ++#define MT7620A_FE_GDMA1_SHPR_CFG (MT7620A_GDMA_OFFSET + 0x08) ++#define MT7620A_FE_GDMA1_MAC_ADRL (MT7620A_GDMA_OFFSET + 0x0C) ++#define MT7620A_FE_GDMA1_MAC_ADRH (MT7620A_GDMA_OFFSET + 0x10) ++ ++#define RT5350_TX_BASE_PTR0 (RT5350_PDMA_OFFSET + 0x00) ++#define RT5350_TX_MAX_CNT0 (RT5350_PDMA_OFFSET + 0x04) ++#define RT5350_TX_CTX_IDX0 (RT5350_PDMA_OFFSET + 0x08) ++#define RT5350_TX_DTX_IDX0 (RT5350_PDMA_OFFSET + 0x0C) ++#define RT5350_TX_BASE_PTR1 (RT5350_PDMA_OFFSET + 0x10) ++#define RT5350_TX_MAX_CNT1 (RT5350_PDMA_OFFSET + 0x14) ++#define RT5350_TX_CTX_IDX1 (RT5350_PDMA_OFFSET + 0x18) ++#define RT5350_TX_DTX_IDX1 (RT5350_PDMA_OFFSET + 0x1C) ++#define RT5350_TX_BASE_PTR2 (RT5350_PDMA_OFFSET + 0x20) ++#define RT5350_TX_MAX_CNT2 (RT5350_PDMA_OFFSET + 0x24) ++#define RT5350_TX_CTX_IDX2 (RT5350_PDMA_OFFSET + 0x28) ++#define RT5350_TX_DTX_IDX2 (RT5350_PDMA_OFFSET + 0x2C) ++#define RT5350_TX_BASE_PTR3 (RT5350_PDMA_OFFSET + 0x30) ++#define RT5350_TX_MAX_CNT3 (RT5350_PDMA_OFFSET + 0x34) ++#define RT5350_TX_CTX_IDX3 (RT5350_PDMA_OFFSET + 0x38) ++#define RT5350_TX_DTX_IDX3 (RT5350_PDMA_OFFSET + 0x3C) ++#define RT5350_RX_BASE_PTR0 (RT5350_PDMA_OFFSET + 0x100) ++#define RT5350_RX_MAX_CNT0 (RT5350_PDMA_OFFSET + 0x104) ++#define RT5350_RX_CALC_IDX0 (RT5350_PDMA_OFFSET + 0x108) ++#define RT5350_RX_DRX_IDX0 (RT5350_PDMA_OFFSET + 0x10C) ++#define RT5350_RX_BASE_PTR1 (RT5350_PDMA_OFFSET + 0x110) ++#define RT5350_RX_MAX_CNT1 (RT5350_PDMA_OFFSET + 0x114) ++#define RT5350_RX_CALC_IDX1 (RT5350_PDMA_OFFSET + 0x118) ++#define RT5350_RX_DRX_IDX1 (RT5350_PDMA_OFFSET + 0x11C) ++#define RT5350_PDMA_GLO_CFG (RT5350_PDMA_OFFSET + 0x204) ++#define RT5350_PDMA_RST_CFG (RT5350_PDMA_OFFSET + 0x208) ++#define RT5350_DLY_INT_CFG (RT5350_PDMA_OFFSET + 0x20c) ++#define RT5350_FE_INT_STATUS (RT5350_PDMA_OFFSET + 0x220) ++#define RT5350_FE_INT_ENABLE (RT5350_PDMA_OFFSET + 0x228) ++#define RT5350_PDMA_SCH_CFG (RT5350_PDMA_OFFSET + 0x280) ++ ++#define FE_PDMA_GLO_CFG (FE_PDMA_OFFSET + 0x00) ++#define FE_PDMA_RST_CFG (FE_PDMA_OFFSET + 0x04) ++#define FE_PDMA_SCH_CFG (FE_PDMA_OFFSET + 0x08) ++#define FE_DLY_INT_CFG (FE_PDMA_OFFSET + 0x0C) ++#define FE_TX_BASE_PTR0 (FE_PDMA_OFFSET + 0x10) ++#define FE_TX_MAX_CNT0 (FE_PDMA_OFFSET + 0x14) ++#define FE_TX_CTX_IDX0 (FE_PDMA_OFFSET + 0x18) ++#define FE_TX_DTX_IDX0 (FE_PDMA_OFFSET + 0x1C) ++#define FE_TX_BASE_PTR1 (FE_PDMA_OFFSET + 0x20) ++#define FE_TX_MAX_CNT1 (FE_PDMA_OFFSET + 0x24) ++#define FE_TX_CTX_IDX1 (FE_PDMA_OFFSET + 0x28) ++#define FE_TX_DTX_IDX1 (FE_PDMA_OFFSET + 0x2C) ++#define FE_RX_BASE_PTR0 (FE_PDMA_OFFSET + 0x30) ++#define FE_RX_MAX_CNT0 (FE_PDMA_OFFSET + 0x34) ++#define FE_RX_CALC_IDX0 (FE_PDMA_OFFSET + 0x38) ++#define FE_RX_DRX_IDX0 (FE_PDMA_OFFSET + 0x3C) ++#define FE_TX_BASE_PTR2 (FE_PDMA_OFFSET + 0x40) ++#define FE_TX_MAX_CNT2 (FE_PDMA_OFFSET + 0x44) ++#define FE_TX_CTX_IDX2 (FE_PDMA_OFFSET + 0x48) ++#define FE_TX_DTX_IDX2 (FE_PDMA_OFFSET + 0x4C) ++#define FE_TX_BASE_PTR3 (FE_PDMA_OFFSET + 0x50) ++#define FE_TX_MAX_CNT3 (FE_PDMA_OFFSET + 0x54) ++#define FE_TX_CTX_IDX3 (FE_PDMA_OFFSET + 0x58) ++#define FE_TX_DTX_IDX3 (FE_PDMA_OFFSET + 0x5C) ++#define FE_RX_BASE_PTR1 (FE_PDMA_OFFSET + 0x60) ++#define FE_RX_MAX_CNT1 (FE_PDMA_OFFSET + 0x64) ++#define FE_RX_CALC_IDX1 (FE_PDMA_OFFSET + 0x68) ++#define FE_RX_DRX_IDX1 (FE_PDMA_OFFSET + 0x6C) ++ ++/* Switch DMA configuration */ ++#define RT5350_SDM_CFG (RT5350_SDM_OFFSET + 0x00) ++#define RT5350_SDM_RRING (RT5350_SDM_OFFSET + 0x04) ++#define RT5350_SDM_TRING (RT5350_SDM_OFFSET + 0x08) ++#define RT5350_SDM_MAC_ADRL (RT5350_SDM_OFFSET + 0x0C) ++#define RT5350_SDM_MAC_ADRH (RT5350_SDM_OFFSET + 0x10) ++#define RT5350_SDM_TPCNT (RT5350_SDM_OFFSET + 0x100) ++#define RT5350_SDM_TBCNT (RT5350_SDM_OFFSET + 0x104) ++#define RT5350_SDM_RPCNT (RT5350_SDM_OFFSET + 0x108) ++#define RT5350_SDM_RBCNT (RT5350_SDM_OFFSET + 0x10C) ++#define RT5350_SDM_CS_ERR (RT5350_SDM_OFFSET + 0x110) ++ ++#define RT5350_SDM_ICS_EN BIT(16) ++#define RT5350_SDM_TCS_EN BIT(17) ++#define RT5350_SDM_UCS_EN BIT(18) ++ ++/* MDIO_CFG register bits */ ++#define FE_MDIO_CFG_AUTO_POLL_EN BIT(29) ++#define FE_MDIO_CFG_GP1_BP_EN BIT(16) ++#define FE_MDIO_CFG_GP1_FRC_EN BIT(15) ++#define FE_MDIO_CFG_GP1_SPEED_10 (0 << 13) ++#define FE_MDIO_CFG_GP1_SPEED_100 (1 << 13) ++#define FE_MDIO_CFG_GP1_SPEED_1000 (2 << 13) ++#define FE_MDIO_CFG_GP1_DUPLEX BIT(12) ++#define FE_MDIO_CFG_GP1_FC_TX BIT(11) ++#define FE_MDIO_CFG_GP1_FC_RX BIT(10) ++#define FE_MDIO_CFG_GP1_LNK_DWN BIT(9) ++#define FE_MDIO_CFG_GP1_AN_FAIL BIT(8) ++#define FE_MDIO_CFG_MDC_CLK_DIV_1 (0 << 6) ++#define FE_MDIO_CFG_MDC_CLK_DIV_2 (1 << 6) ++#define FE_MDIO_CFG_MDC_CLK_DIV_4 (2 << 6) ++#define FE_MDIO_CFG_MDC_CLK_DIV_8 (3 << 6) ++#define FE_MDIO_CFG_TURBO_MII_FREQ BIT(5) ++#define FE_MDIO_CFG_TURBO_MII_MODE BIT(4) ++#define FE_MDIO_CFG_RX_CLK_SKEW_0 (0 << 2) ++#define FE_MDIO_CFG_RX_CLK_SKEW_200 (1 << 2) ++#define FE_MDIO_CFG_RX_CLK_SKEW_400 (2 << 2) ++#define FE_MDIO_CFG_RX_CLK_SKEW_INV (3 << 2) ++#define FE_MDIO_CFG_TX_CLK_SKEW_0 0 ++#define FE_MDIO_CFG_TX_CLK_SKEW_200 1 ++#define FE_MDIO_CFG_TX_CLK_SKEW_400 2 ++#define FE_MDIO_CFG_TX_CLK_SKEW_INV 3 ++ ++/* uni-cast port */ ++#define FE_GDM1_JMB_LEN_MASK 0xf ++#define FE_GDM1_JMB_LEN_SHIFT 28 ++#define FE_GDM1_ICS_EN BIT(22) ++#define FE_GDM1_TCS_EN BIT(21) ++#define FE_GDM1_UCS_EN BIT(20) ++#define FE_GDM1_JMB_EN BIT(19) ++#define FE_GDM1_STRPCRC BIT(16) ++#define FE_GDM1_UFRC_P_CPU (0 << 12) ++#define FE_GDM1_UFRC_P_GDMA1 (1 << 12) ++#define FE_GDM1_UFRC_P_PPE (6 << 12) ++ ++/* checksums */ ++#define FE_ICS_GEN_EN BIT(2) ++#define FE_UCS_GEN_EN BIT(1) ++#define FE_TCS_GEN_EN BIT(0) ++ ++/* dma ring */ ++#define FE_PST_DRX_IDX0 BIT(16) ++#define FE_PST_DTX_IDX3 BIT(3) ++#define FE_PST_DTX_IDX2 BIT(2) ++#define FE_PST_DTX_IDX1 BIT(1) ++#define FE_PST_DTX_IDX0 BIT(0) ++ ++#define FE_RX_2B_OFFSET BIT(31) ++#define FE_TX_WB_DDONE BIT(6) ++#define FE_RX_DMA_BUSY BIT(3) ++#define FE_TX_DMA_BUSY BIT(1) ++#define FE_RX_DMA_EN BIT(2) ++#define FE_TX_DMA_EN BIT(0) ++ ++#define FE_PDMA_SIZE_4DWORDS (0 << 4) ++#define FE_PDMA_SIZE_8DWORDS (1 << 4) ++#define FE_PDMA_SIZE_16DWORDS (2 << 4) ++ ++#define FE_US_CYC_CNT_MASK 0xff ++#define FE_US_CYC_CNT_SHIFT 0x8 ++#define FE_US_CYC_CNT_DIVISOR 1000000 ++ ++/* rxd2 */ ++#define RX_DMA_DONE BIT(31) ++#define RX_DMA_LSO BIT(30) ++#define RX_DMA_PLEN0(_x) (((_x) & 0x3fff) << 16) ++#define RX_DMA_GET_PLEN0(_x) (((_x) >> 16) & 0x3fff) ++#define RX_DMA_TAG BIT(15) ++/* rxd3 */ ++#define RX_DMA_TPID(_x) (((_x) >> 16) & 0xffff) ++#define RX_DMA_VID(_x) ((_x) & 0xffff) ++/* rxd4 */ ++#define RX_DMA_L4VALID BIT(30) ++ ++struct fe_rx_dma { ++ unsigned int rxd1; ++ unsigned int rxd2; ++ unsigned int rxd3; ++ unsigned int rxd4; ++} __packed __aligned(4); ++ ++#define TX_DMA_BUF_LEN 0x3fff ++#define TX_DMA_PLEN0_MASK (TX_DMA_BUF_LEN << 16) ++#define TX_DMA_PLEN0(_x) (((_x) & TX_DMA_BUF_LEN) << 16) ++#define TX_DMA_PLEN1(_x) ((_x) & TX_DMA_BUF_LEN) ++#define TX_DMA_GET_PLEN0(_x) (((_x) >> 16) & TX_DMA_BUF_LEN) ++#define TX_DMA_GET_PLEN1(_x) ((_x) & TX_DMA_BUF_LEN) ++#define TX_DMA_LS1 BIT(14) ++#define TX_DMA_LS0 BIT(30) ++#define TX_DMA_DONE BIT(31) ++ ++#define TX_DMA_INS_VLAN_MT7621 BIT(16) ++#define TX_DMA_INS_VLAN BIT(7) ++#define TX_DMA_INS_PPPOE BIT(12) ++#define TX_DMA_QN(_x) ((_x) << 16) ++#define TX_DMA_PN(_x) ((_x) << 24) ++#define TX_DMA_QN_MASK TX_DMA_QN(0x7) ++#define TX_DMA_PN_MASK TX_DMA_PN(0x7) ++#define TX_DMA_UDF BIT(20) ++#define TX_DMA_CHKSUM (0x7 << 29) ++#define TX_DMA_TSO BIT(28) ++ ++/* frame engine counters */ ++#define FE_PPE_AC_BCNT0 (FE_CMTABLE_OFFSET + 0x00) ++#define FE_GDMA1_TX_GBCNT (FE_CMTABLE_OFFSET + 0x300) ++#define FE_GDMA2_TX_GBCNT (FE_GDMA1_TX_GBCNT + 0x40) ++ ++/* phy device flags */ ++#define FE_PHY_FLAG_PORT BIT(0) ++#define FE_PHY_FLAG_ATTACH BIT(1) ++ ++struct fe_tx_dma { ++ unsigned int txd1; ++ unsigned int txd2; ++ unsigned int txd3; ++ unsigned int txd4; ++} __packed __aligned(4); ++ ++struct fe_priv; ++ ++struct fe_phy { ++ /* make sure that phy operations are atomic */ ++ spinlock_t lock; ++ ++ struct phy_device *phy[8]; ++ struct device_node *phy_node[8]; ++ const __be32 *phy_fixed[8]; ++ int duplex[8]; ++ int speed[8]; ++ int tx_fc[8]; ++ int rx_fc[8]; ++ int (*connect)(struct fe_priv *priv); ++ void (*disconnect)(struct fe_priv *priv); ++ void (*start)(struct fe_priv *priv); ++ void (*stop)(struct fe_priv *priv); ++}; ++ ++struct fe_soc_data { ++ const u16 *reg_table; ++ ++ void (*init_data)(struct fe_soc_data *data, struct net_device *netdev); ++ void (*reset_fe)(void); ++ void (*set_mac)(struct fe_priv *priv, unsigned char *mac); ++ int (*fwd_config)(struct fe_priv *priv); ++ void (*tx_dma)(struct fe_tx_dma *txd); ++ int (*switch_init)(struct fe_priv *priv); ++ void (*port_init)(struct fe_priv *priv, struct device_node *port); ++ int (*has_carrier)(struct fe_priv *priv); ++ int (*mdio_init)(struct fe_priv *priv); ++ void (*mdio_cleanup)(struct fe_priv *priv); ++ int (*mdio_write)(struct mii_bus *bus, int phy_addr, int phy_reg, ++ u16 val); ++ int (*mdio_read)(struct mii_bus *bus, int phy_addr, int phy_reg); ++ void (*mdio_adjust_link)(struct fe_priv *priv, int port); ++ ++ void *swpriv; ++ u32 pdma_glo_cfg; ++ u32 rx_int; ++ u32 tx_int; ++ u32 status_int; ++ u32 checksum_bit; ++}; ++ ++#define FE_FLAG_PADDING_64B BIT(0) ++#define FE_FLAG_PADDING_BUG BIT(1) ++#define FE_FLAG_JUMBO_FRAME BIT(2) ++#define FE_FLAG_RX_2B_OFFSET BIT(3) ++#define FE_FLAG_RX_SG_DMA BIT(4) ++#define FE_FLAG_RX_VLAN_CTAG BIT(5) ++#define FE_FLAG_NAPI_WEIGHT BIT(6) ++#define FE_FLAG_CALIBRATE_CLK BIT(7) ++#define FE_FLAG_HAS_SWITCH BIT(8) ++ ++#define FE_STAT_REG_DECLARE \ ++ _FE(tx_bytes) \ ++ _FE(tx_packets) \ ++ _FE(tx_skip) \ ++ _FE(tx_collisions) \ ++ _FE(rx_bytes) \ ++ _FE(rx_packets) \ ++ _FE(rx_overflow) \ ++ _FE(rx_fcs_errors) \ ++ _FE(rx_short_errors) \ ++ _FE(rx_long_errors) \ ++ _FE(rx_checksum_errors) \ ++ _FE(rx_flow_control_packets) ++ ++struct fe_hw_stats { ++ /* make sure that stats operations are atomic */ ++ spinlock_t stats_lock; ++ ++ struct u64_stats_sync syncp; ++#define _FE(x) u64 x; ++ FE_STAT_REG_DECLARE ++#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); ++}; ++ ++struct fe_tx_ring { ++ struct fe_tx_dma *tx_dma; ++ struct fe_tx_buf *tx_buf; ++ dma_addr_t tx_phys; ++ u16 tx_ring_size; ++ u16 tx_free_idx; ++ u16 tx_next_idx; ++ u16 tx_thresh; ++}; ++ ++struct fe_rx_ring { ++ struct fe_rx_dma *rx_dma; ++ u8 **rx_data; ++ dma_addr_t rx_phys; ++ u16 rx_ring_size; ++ u16 frag_size; ++ u16 rx_buf_size; ++ u16 rx_calc_idx; ++}; ++ ++struct fe_priv { ++ /* make sure that register operations are atomic */ ++ spinlock_t page_lock; ++ ++ struct fe_soc_data *soc; ++ struct net_device *netdev; ++ struct device_node *switch_np; ++ u32 msg_enable; ++ u32 flags; ++ ++ struct device *device; ++ unsigned long sysclk; ++ ++ struct fe_rx_ring rx_ring; ++ struct napi_struct rx_napi; ++ ++ struct fe_tx_ring tx_ring; ++ ++ struct fe_phy *phy; ++ struct mii_bus *mii_bus; ++ struct phy_device *phy_dev; ++ u32 phy_flags; ++ ++ int link[8]; ++ ++ struct fe_hw_stats *hw_stats; ++ unsigned long vlan_map; ++ struct work_struct pending_work; ++ DECLARE_BITMAP(pending_flags, FE_FLAG_MAX); ++}; ++ ++extern const struct of_device_id of_fe_match[]; ++ ++void fe_w32(u32 val, unsigned reg); ++u32 fe_r32(unsigned reg); ++ ++int fe_set_clock_cycle(struct fe_priv *priv); ++void fe_csum_config(struct fe_priv *priv); ++void fe_stats_update(struct fe_priv *priv); ++void fe_fwd_config(struct fe_priv *priv); ++void fe_reg_w32(u32 val, enum fe_reg reg); ++u32 fe_reg_r32(enum fe_reg reg); ++ ++void fe_reset(u32 reset_bits); ++ ++static inline void *priv_netdev(struct fe_priv *priv) ++{ ++ return (char *)priv - ALIGN(sizeof(struct net_device), NETDEV_ALIGN); ++} ++ ++#endif /* FE_ETH_H */ diff --git a/target/linux/ramips/patches-4.4/0502-net-next-mediatek-add-switch-driver-for-rt3050.patch b/target/linux/ramips/patches-4.4/0502-net-next-mediatek-add-switch-driver-for-rt3050.patch new file mode 100644 index 0000000000..d13bda7a08 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0502-net-next-mediatek-add-switch-driver-for-rt3050.patch @@ -0,0 +1,691 @@ +From 2c39ddc83452c34fedc86261ed1f96d7537adfd1 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 21:28:10 +0100 +Subject: [PATCH 502/513] net-next: mediatek: add switch driver for rt3050 + +This driver is very basic and only provides basic init and irq support. +Switchdev support for this device will follow. + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/esw_rt3050.c | 640 ++++++++++++++++++++++++++++ + drivers/net/ethernet/mediatek/esw_rt3050.h | 29 ++ + 2 files changed, 669 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/esw_rt3050.c + create mode 100644 drivers/net/ethernet/mediatek/esw_rt3050.h + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -0,0 +1,640 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++ ++#include ++#include ++ ++#include ++ ++/* HW limitations for this switch: ++ * - No large frame support (PKT_MAX_LEN at most 1536) ++ * - Can't have untagged vlan and tagged vlan on one port at the same time, ++ * though this might be possible using the undocumented PPE. ++ */ ++ ++#define RT305X_ESW_REG_ISR 0x00 ++#define RT305X_ESW_REG_IMR 0x04 ++#define RT305X_ESW_REG_FCT0 0x08 ++#define RT305X_ESW_REG_PFC1 0x14 ++#define RT305X_ESW_REG_ATS 0x24 ++#define RT305X_ESW_REG_ATS0 0x28 ++#define RT305X_ESW_REG_ATS1 0x2c ++#define RT305X_ESW_REG_ATS2 0x30 ++#define RT305X_ESW_REG_PVIDC(_n) (0x40 + 4 * (_n)) ++#define RT305X_ESW_REG_VLANI(_n) (0x50 + 4 * (_n)) ++#define RT305X_ESW_REG_VMSC(_n) (0x70 + 4 * (_n)) ++#define RT305X_ESW_REG_POA 0x80 ++#define RT305X_ESW_REG_FPA 0x84 ++#define RT305X_ESW_REG_SOCPC 0x8c ++#define RT305X_ESW_REG_POC0 0x90 ++#define RT305X_ESW_REG_POC1 0x94 ++#define RT305X_ESW_REG_POC2 0x98 ++#define RT305X_ESW_REG_SGC 0x9c ++#define RT305X_ESW_REG_STRT 0xa0 ++#define RT305X_ESW_REG_PCR0 0xc0 ++#define RT305X_ESW_REG_PCR1 0xc4 ++#define RT305X_ESW_REG_FPA2 0xc8 ++#define RT305X_ESW_REG_FCT2 0xcc ++#define RT305X_ESW_REG_SGC2 0xe4 ++#define RT305X_ESW_REG_P0LED 0xa4 ++#define RT305X_ESW_REG_P1LED 0xa8 ++#define RT305X_ESW_REG_P2LED 0xac ++#define RT305X_ESW_REG_P3LED 0xb0 ++#define RT305X_ESW_REG_P4LED 0xb4 ++#define RT305X_ESW_REG_PXPC(_x) (0xe8 + (4 * _x)) ++#define RT305X_ESW_REG_P1PC 0xec ++#define RT305X_ESW_REG_P2PC 0xf0 ++#define RT305X_ESW_REG_P3PC 0xf4 ++#define RT305X_ESW_REG_P4PC 0xf8 ++#define RT305X_ESW_REG_P5PC 0xfc ++ ++#define RT305X_ESW_LED_LINK 0 ++#define RT305X_ESW_LED_100M 1 ++#define RT305X_ESW_LED_DUPLEX 2 ++#define RT305X_ESW_LED_ACTIVITY 3 ++#define RT305X_ESW_LED_COLLISION 4 ++#define RT305X_ESW_LED_LINKACT 5 ++#define RT305X_ESW_LED_DUPLCOLL 6 ++#define RT305X_ESW_LED_10MACT 7 ++#define RT305X_ESW_LED_100MACT 8 ++/* Additional led states not in datasheet: */ ++#define RT305X_ESW_LED_BLINK 10 ++#define RT305X_ESW_LED_ON 12 ++ ++#define RT305X_ESW_LINK_S 25 ++#define RT305X_ESW_DUPLEX_S 9 ++#define RT305X_ESW_SPD_S 0 ++ ++#define RT305X_ESW_PCR0_WT_NWAY_DATA_S 16 ++#define RT305X_ESW_PCR0_WT_PHY_CMD BIT(13) ++#define RT305X_ESW_PCR0_CPU_PHY_REG_S 8 ++ ++#define RT305X_ESW_PCR1_WT_DONE BIT(0) ++ ++#define RT305X_ESW_ATS_TIMEOUT (5 * HZ) ++#define RT305X_ESW_PHY_TIMEOUT (5 * HZ) ++ ++#define RT305X_ESW_PVIDC_PVID_M 0xfff ++#define RT305X_ESW_PVIDC_PVID_S 12 ++ ++#define RT305X_ESW_VLANI_VID_M 0xfff ++#define RT305X_ESW_VLANI_VID_S 12 ++ ++#define RT305X_ESW_VMSC_MSC_M 0xff ++#define RT305X_ESW_VMSC_MSC_S 8 ++ ++#define RT305X_ESW_SOCPC_DISUN2CPU_S 0 ++#define RT305X_ESW_SOCPC_DISMC2CPU_S 8 ++#define RT305X_ESW_SOCPC_DISBC2CPU_S 16 ++#define RT305X_ESW_SOCPC_CRC_PADDING BIT(25) ++ ++#define RT305X_ESW_POC0_EN_BP_S 0 ++#define RT305X_ESW_POC0_EN_FC_S 8 ++#define RT305X_ESW_POC0_DIS_RMC2CPU_S 16 ++#define RT305X_ESW_POC0_DIS_PORT_M 0x7f ++#define RT305X_ESW_POC0_DIS_PORT_S 23 ++ ++#define RT305X_ESW_POC2_UNTAG_EN_M 0xff ++#define RT305X_ESW_POC2_UNTAG_EN_S 0 ++#define RT305X_ESW_POC2_ENAGING_S 8 ++#define RT305X_ESW_POC2_DIS_UC_PAUSE_S 16 ++ ++#define RT305X_ESW_SGC2_DOUBLE_TAG_M 0x7f ++#define RT305X_ESW_SGC2_DOUBLE_TAG_S 0 ++#define RT305X_ESW_SGC2_LAN_PMAP_M 0x3f ++#define RT305X_ESW_SGC2_LAN_PMAP_S 24 ++ ++#define RT305X_ESW_PFC1_EN_VLAN_M 0xff ++#define RT305X_ESW_PFC1_EN_VLAN_S 16 ++#define RT305X_ESW_PFC1_EN_TOS_S 24 ++ ++#define RT305X_ESW_VLAN_NONE 0xfff ++ ++#define RT305X_ESW_GSC_BC_STROM_MASK 0x3 ++#define RT305X_ESW_GSC_BC_STROM_SHIFT 4 ++ ++#define RT305X_ESW_GSC_LED_FREQ_MASK 0x3 ++#define RT305X_ESW_GSC_LED_FREQ_SHIFT 23 ++ ++#define RT305X_ESW_POA_LINK_MASK 0x1f ++#define RT305X_ESW_POA_LINK_SHIFT 25 ++ ++#define RT305X_ESW_PORT_ST_CHG BIT(26) ++#define RT305X_ESW_PORT0 0 ++#define RT305X_ESW_PORT1 1 ++#define RT305X_ESW_PORT2 2 ++#define RT305X_ESW_PORT3 3 ++#define RT305X_ESW_PORT4 4 ++#define RT305X_ESW_PORT5 5 ++#define RT305X_ESW_PORT6 6 ++ ++#define RT305X_ESW_PMAP_LLLLLL 0x3f ++#define RT305X_ESW_PMAP_LLLLWL 0x2f ++#define RT305X_ESW_PMAP_WLLLLL 0x3e ++ ++#define RT305X_ESW_PORTS_INTERNAL \ ++ (BIT(RT305X_ESW_PORT0) | BIT(RT305X_ESW_PORT1) | \ ++ BIT(RT305X_ESW_PORT2) | BIT(RT305X_ESW_PORT3) | \ ++ BIT(RT305X_ESW_PORT4)) ++ ++#define RT305X_ESW_PORTS_NOCPU \ ++ (RT305X_ESW_PORTS_INTERNAL | BIT(RT305X_ESW_PORT5)) ++ ++#define RT305X_ESW_PORTS_CPU BIT(RT305X_ESW_PORT6) ++ ++#define RT305X_ESW_PORTS_ALL \ ++ (RT305X_ESW_PORTS_NOCPU | RT305X_ESW_PORTS_CPU) ++ ++#define RT305X_ESW_NUM_PORTS 7 ++#define RT305X_ESW_NUM_LEDS 5 ++ ++#define RT5350_EWS_REG_LED_POLARITY 0x168 ++#define RT5350_RESET_EPHY BIT(24) ++ ++struct esw_port { ++ bool disable; ++ u8 led; ++}; ++ ++struct rt305x_esw { ++ struct device *dev; ++ void __iomem *base; ++ int irq; ++ ++ /* Protects against concurrent register r/w operations. */ ++ spinlock_t reg_rw_lock; ++ ++ unsigned char port_map; ++ unsigned int reg_led_polarity; ++ ++ struct esw_port ports[RT305X_ESW_NUM_PORTS]; ++ ++}; ++ ++static inline void esw_w32(struct rt305x_esw *esw, u32 val, unsigned reg) ++{ ++ __raw_writel(val, esw->base + reg); ++} ++ ++static inline u32 esw_r32(struct rt305x_esw *esw, unsigned reg) ++{ ++ return __raw_readl(esw->base + reg); ++} ++ ++static inline void esw_rmw_raw(struct rt305x_esw *esw, unsigned reg, ++ unsigned long mask, unsigned long val) ++{ ++ unsigned long t; ++ ++ t = __raw_readl(esw->base + reg) & ~mask; ++ __raw_writel(t | val, esw->base + reg); ++} ++ ++static void esw_rmw(struct rt305x_esw *esw, unsigned reg, ++ unsigned long mask, unsigned long val) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&esw->reg_rw_lock, flags); ++ esw_rmw_raw(esw, reg, mask, val); ++ spin_unlock_irqrestore(&esw->reg_rw_lock, flags); ++} ++ ++static u32 rt305x_mii_write(struct rt305x_esw *esw, u32 phy_addr, ++ u32 phy_register, u32 write_data) ++{ ++ unsigned long t_start = jiffies; ++ int ret = 0; ++ ++ while (1) { ++ if (!(esw_r32(esw, RT305X_ESW_REG_PCR1) & ++ RT305X_ESW_PCR1_WT_DONE)) ++ break; ++ if (time_after(jiffies, t_start + RT305X_ESW_PHY_TIMEOUT)) { ++ ret = 1; ++ goto out; ++ } ++ } ++ ++ write_data &= 0xffff; ++ esw_w32(esw, (write_data << RT305X_ESW_PCR0_WT_NWAY_DATA_S) | ++ (phy_register << RT305X_ESW_PCR0_CPU_PHY_REG_S) | ++ (phy_addr) | RT305X_ESW_PCR0_WT_PHY_CMD, ++ RT305X_ESW_REG_PCR0); ++ ++ t_start = jiffies; ++ while (1) { ++ if (esw_r32(esw, RT305X_ESW_REG_PCR1) & ++ RT305X_ESW_PCR1_WT_DONE) ++ break; ++ ++ if (time_after(jiffies, t_start + RT305X_ESW_PHY_TIMEOUT)) { ++ ret = 1; ++ break; ++ } ++ } ++out: ++ if (ret) ++ dev_err(esw->dev, "ramips_eth: MDIO timeout\n"); ++ return ret; ++} ++ ++static unsigned esw_get_port_disable(struct rt305x_esw *esw) ++{ ++ unsigned reg; ++ ++ reg = esw_r32(esw, RT305X_ESW_REG_POC0); ++ return (reg >> RT305X_ESW_POC0_DIS_PORT_S) & ++ RT305X_ESW_POC0_DIS_PORT_M; ++} ++ ++static void esw_hw_init(struct rt305x_esw *esw) ++{ ++ int i; ++ u8 port_disable = 0; ++ u8 port_map = RT305X_ESW_PMAP_LLLLLL; ++ ++ /* vodoo from original driver */ ++ esw_w32(esw, 0xC8A07850, RT305X_ESW_REG_FCT0); ++ esw_w32(esw, 0x00000000, RT305X_ESW_REG_SGC2); ++ /* Port priority 1 for all ports, vlan enabled. */ ++ esw_w32(esw, 0x00005555 | ++ (RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S), ++ RT305X_ESW_REG_PFC1); ++ ++ /* Enable Back Pressure, and Flow Control */ ++ esw_w32(esw, ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) | ++ (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)), ++ RT305X_ESW_REG_POC0); ++ ++ /* Enable Aging, and VLAN TAG removal */ ++ esw_w32(esw, ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC2_ENAGING_S) | ++ (RT305X_ESW_PORTS_NOCPU << RT305X_ESW_POC2_UNTAG_EN_S)), ++ RT305X_ESW_REG_POC2); ++ ++ esw_w32(esw, 0x00d6500c, RT305X_ESW_REG_FCT2); ++ ++ /* 300s aging timer, max packet len 1536, broadcast storm prevention ++ * disabled, disable collision abort, mac xor48 hash, 10 packet back ++ * pressure jam, GMII disable was_transmit, back pressure disabled, ++ * 30ms led flash, unmatched IGMP as broadcast, rmc tb fault to all ++ * ports. ++ */ ++ esw_w32(esw, 0x0008a301, RT305X_ESW_REG_SGC); ++ ++ /* Setup SoC Port control register */ ++ esw_w32(esw, ++ (RT305X_ESW_SOCPC_CRC_PADDING | ++ (RT305X_ESW_PORTS_CPU << RT305X_ESW_SOCPC_DISUN2CPU_S) | ++ (RT305X_ESW_PORTS_CPU << RT305X_ESW_SOCPC_DISMC2CPU_S) | ++ (RT305X_ESW_PORTS_CPU << RT305X_ESW_SOCPC_DISBC2CPU_S)), ++ RT305X_ESW_REG_SOCPC); ++ ++ /* ext phy base addr 31, enable port 5 polling, rx/tx clock skew 1, ++ * turbo mii off, rgmi 3.3v off ++ * port5: disabled ++ * port6: enabled, gige, full-duplex, rx/tx-flow-control ++ */ ++ esw_w32(esw, 0x3f502b28, RT305X_ESW_REG_FPA2); ++ esw_w32(esw, 0x00000000, RT305X_ESW_REG_FPA); ++ ++ /* Force Link/Activity on ports */ ++ esw_w32(esw, 0x00000005, RT305X_ESW_REG_P0LED); ++ esw_w32(esw, 0x00000005, RT305X_ESW_REG_P1LED); ++ esw_w32(esw, 0x00000005, RT305X_ESW_REG_P2LED); ++ esw_w32(esw, 0x00000005, RT305X_ESW_REG_P3LED); ++ esw_w32(esw, 0x00000005, RT305X_ESW_REG_P4LED); ++ ++ /* Copy disabled port configuration from bootloader setup */ ++ port_disable = esw_get_port_disable(esw); ++ for (i = 0; i < 6; i++) ++ esw->ports[i].disable = (port_disable & (1 << i)) != 0; ++ ++ if (ralink_soc == RT305X_SOC_RT3352) { ++ /* reset EPHY */ ++ fe_reset(RT5350_RESET_EPHY); ++ ++ rt305x_mii_write(esw, 0, 31, 0x8000); ++ for (i = 0; i < 5; i++) { ++ if (esw->ports[i].disable) { ++ rt305x_mii_write(esw, i, MII_BMCR, BMCR_PDOWN); ++ } else { ++ rt305x_mii_write(esw, i, MII_BMCR, ++ BMCR_FULLDPLX | ++ BMCR_ANENABLE | ++ BMCR_SPEED100); ++ } ++ /* TX10 waveform coefficient LSB=0 disable PHY */ ++ rt305x_mii_write(esw, i, 26, 0x1601); ++ /* TX100/TX10 AD/DA current bias */ ++ rt305x_mii_write(esw, i, 29, 0x7016); ++ /* TX100 slew rate control */ ++ rt305x_mii_write(esw, i, 30, 0x0038); ++ } ++ ++ /* select global register */ ++ rt305x_mii_write(esw, 0, 31, 0x0); ++ /* enlarge agcsel threshold 3 and threshold 2 */ ++ rt305x_mii_write(esw, 0, 1, 0x4a40); ++ /* enlarge agcsel threshold 5 and threshold 4 */ ++ rt305x_mii_write(esw, 0, 2, 0x6254); ++ /* enlarge agcsel threshold */ ++ rt305x_mii_write(esw, 0, 3, 0xa17f); ++ rt305x_mii_write(esw, 0, 12, 0x7eaa); ++ /* longer TP_IDL tail length */ ++ rt305x_mii_write(esw, 0, 14, 0x65); ++ /* increased squelch pulse count threshold. */ ++ rt305x_mii_write(esw, 0, 16, 0x0684); ++ /* set TX10 signal amplitude threshold to minimum */ ++ rt305x_mii_write(esw, 0, 17, 0x0fe0); ++ /* set squelch amplitude to higher threshold */ ++ rt305x_mii_write(esw, 0, 18, 0x40ba); ++ /* tune TP_IDL tail and head waveform, enable power ++ * down slew rate control ++ */ ++ rt305x_mii_write(esw, 0, 22, 0x253f); ++ /* set PLL/Receive bias current are calibrated */ ++ rt305x_mii_write(esw, 0, 27, 0x2fda); ++ /* change PLL/Receive bias current to internal(RT3350) */ ++ rt305x_mii_write(esw, 0, 28, 0xc410); ++ /* change PLL bias current to internal(RT3052_MP3) */ ++ rt305x_mii_write(esw, 0, 29, 0x598b); ++ /* select local register */ ++ rt305x_mii_write(esw, 0, 31, 0x8000); ++ } else if (ralink_soc == RT305X_SOC_RT5350) { ++ /* reset EPHY */ ++ fe_reset(RT5350_RESET_EPHY); ++ ++ /* set the led polarity */ ++ esw_w32(esw, esw->reg_led_polarity & 0x1F, ++ RT5350_EWS_REG_LED_POLARITY); ++ ++ /* local registers */ ++ rt305x_mii_write(esw, 0, 31, 0x8000); ++ for (i = 0; i < 5; i++) { ++ if (esw->ports[i].disable) { ++ rt305x_mii_write(esw, i, MII_BMCR, BMCR_PDOWN); ++ } else { ++ rt305x_mii_write(esw, i, MII_BMCR, ++ BMCR_FULLDPLX | ++ BMCR_ANENABLE | ++ BMCR_SPEED100); ++ } ++ /* TX10 waveform coefficient LSB=0 disable PHY */ ++ rt305x_mii_write(esw, i, 26, 0x1601); ++ /* TX100/TX10 AD/DA current bias */ ++ rt305x_mii_write(esw, i, 29, 0x7015); ++ /* TX100 slew rate control */ ++ rt305x_mii_write(esw, i, 30, 0x0038); ++ } ++ ++ /* global registers */ ++ rt305x_mii_write(esw, 0, 31, 0x0); ++ /* enlarge agcsel threshold 3 and threshold 2 */ ++ rt305x_mii_write(esw, 0, 1, 0x4a40); ++ /* enlarge agcsel threshold 5 and threshold 4 */ ++ rt305x_mii_write(esw, 0, 2, 0x6254); ++ /* enlarge agcsel threshold 6 */ ++ rt305x_mii_write(esw, 0, 3, 0xa17f); ++ rt305x_mii_write(esw, 0, 12, 0x7eaa); ++ /* longer TP_IDL tail length */ ++ rt305x_mii_write(esw, 0, 14, 0x65); ++ /* increased squelch pulse count threshold. */ ++ rt305x_mii_write(esw, 0, 16, 0x0684); ++ /* set TX10 signal amplitude threshold to minimum */ ++ rt305x_mii_write(esw, 0, 17, 0x0fe0); ++ /* set squelch amplitude to higher threshold */ ++ rt305x_mii_write(esw, 0, 18, 0x40ba); ++ /* tune TP_IDL tail and head waveform, enable power ++ * down slew rate control ++ */ ++ rt305x_mii_write(esw, 0, 22, 0x253f); ++ /* set PLL/Receive bias current are calibrated */ ++ rt305x_mii_write(esw, 0, 27, 0x2fda); ++ /* change PLL/Receive bias current to internal(RT3350) */ ++ rt305x_mii_write(esw, 0, 28, 0xc410); ++ /* change PLL bias current to internal(RT3052_MP3) */ ++ rt305x_mii_write(esw, 0, 29, 0x598b); ++ /* select local register */ ++ rt305x_mii_write(esw, 0, 31, 0x8000); ++ } else if (ralink_soc == MT762X_SOC_MT7628AN || ralink_soc == MT762X_SOC_MT7688) { ++ int i; ++ ++ /* reset EPHY */ ++ fe_reset(RT5350_RESET_EPHY); ++ ++ rt305x_mii_write(esw, 0, 31, 0x2000); /* change G2 page */ ++ rt305x_mii_write(esw, 0, 26, 0x0020); ++ ++ for (i = 0; i < 5; i++) { ++ rt305x_mii_write(esw, i, 31, 0x8000); ++ rt305x_mii_write(esw, i, 0, 0x3100); ++ rt305x_mii_write(esw, i, 30, 0xa000); ++ rt305x_mii_write(esw, i, 31, 0xa000); ++ rt305x_mii_write(esw, i, 16, 0x0606); ++ rt305x_mii_write(esw, i, 23, 0x0f0e); ++ rt305x_mii_write(esw, i, 24, 0x1610); ++ rt305x_mii_write(esw, i, 30, 0x1f15); ++ rt305x_mii_write(esw, i, 28, 0x6111); ++ rt305x_mii_write(esw, i, 31, 0x2000); ++ rt305x_mii_write(esw, i, 26, 0x0000); ++ } ++ ++ /* 100Base AOI setting */ ++ rt305x_mii_write(esw, 0, 31, 0x5000); ++ rt305x_mii_write(esw, 0, 19, 0x004a); ++ rt305x_mii_write(esw, 0, 20, 0x015a); ++ rt305x_mii_write(esw, 0, 21, 0x00ee); ++ rt305x_mii_write(esw, 0, 22, 0x0033); ++ rt305x_mii_write(esw, 0, 23, 0x020a); ++ rt305x_mii_write(esw, 0, 24, 0x0000); ++ rt305x_mii_write(esw, 0, 25, 0x024a); ++ rt305x_mii_write(esw, 0, 26, 0x035a); ++ rt305x_mii_write(esw, 0, 27, 0x02ee); ++ rt305x_mii_write(esw, 0, 28, 0x0233); ++ rt305x_mii_write(esw, 0, 29, 0x000a); ++ rt305x_mii_write(esw, 0, 30, 0x0000); ++ } else { ++ rt305x_mii_write(esw, 0, 31, 0x8000); ++ for (i = 0; i < 5; i++) { ++ if (esw->ports[i].disable) { ++ rt305x_mii_write(esw, i, MII_BMCR, BMCR_PDOWN); ++ } else { ++ rt305x_mii_write(esw, i, MII_BMCR, ++ BMCR_FULLDPLX | ++ BMCR_ANENABLE | ++ BMCR_SPEED100); ++ } ++ /* TX10 waveform coefficient */ ++ rt305x_mii_write(esw, i, 26, 0x1601); ++ /* TX100/TX10 AD/DA current bias */ ++ rt305x_mii_write(esw, i, 29, 0x7058); ++ /* TX100 slew rate control */ ++ rt305x_mii_write(esw, i, 30, 0x0018); ++ } ++ ++ /* PHY IOT */ ++ /* select global register */ ++ rt305x_mii_write(esw, 0, 31, 0x0); ++ /* tune TP_IDL tail and head waveform */ ++ rt305x_mii_write(esw, 0, 22, 0x052f); ++ /* set TX10 signal amplitude threshold to minimum */ ++ rt305x_mii_write(esw, 0, 17, 0x0fe0); ++ /* set squelch amplitude to higher threshold */ ++ rt305x_mii_write(esw, 0, 18, 0x40ba); ++ /* longer TP_IDL tail length */ ++ rt305x_mii_write(esw, 0, 14, 0x65); ++ /* select local register */ ++ rt305x_mii_write(esw, 0, 31, 0x8000); ++ } ++ ++ if (esw->port_map) ++ port_map = esw->port_map; ++ else ++ port_map = RT305X_ESW_PMAP_LLLLLL; ++ ++ /* Unused HW feature, but still nice to be consistent here... ++ * This is also exported to userspace ('lan' attribute) so it's ++ * conveniently usable to decide which ports go into the wan vlan by ++ * default. ++ */ ++ esw_rmw(esw, RT305X_ESW_REG_SGC2, ++ RT305X_ESW_SGC2_LAN_PMAP_M << RT305X_ESW_SGC2_LAN_PMAP_S, ++ port_map << RT305X_ESW_SGC2_LAN_PMAP_S); ++ ++ /* make the switch leds blink */ ++ for (i = 0; i < RT305X_ESW_NUM_LEDS; i++) ++ esw->ports[i].led = 0x05; ++ ++ /* Only unmask the port change interrupt */ ++ esw_w32(esw, ~RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_IMR); ++} ++ ++static irqreturn_t esw_interrupt(int irq, void *_esw) ++{ ++ struct rt305x_esw *esw = (struct rt305x_esw *)_esw; ++ u32 status; ++ ++ status = esw_r32(esw, RT305X_ESW_REG_ISR); ++ if (status & RT305X_ESW_PORT_ST_CHG) { ++ u32 link = esw_r32(esw, RT305X_ESW_REG_POA); ++ ++ link >>= RT305X_ESW_POA_LINK_SHIFT; ++ link &= RT305X_ESW_POA_LINK_MASK; ++ dev_info(esw->dev, "link changed 0x%02X\n", link); ++ } ++ esw_w32(esw, status, RT305X_ESW_REG_ISR); ++ ++ return IRQ_HANDLED; ++} ++ ++static int esw_probe(struct platform_device *pdev) ++{ ++ struct resource *res = platform_get_resource(p, IORESOURCE_MEM, 0); ++ struct device_node *np = pdev->dev.of_node; ++ const __be32 *port_map, *reg_init; ++ struct rt305x_esw *esw; ++ struct resource *irq; ++ int ret; ++ ++ esw = devm_kzalloc(&pdev->dev, sizeof(*esw), GFP_KERNEL); ++ if (!esw) ++ return -ENOMEM; ++ ++ esw->dev = &pdev->dev; ++ esw->irq = irq->start; ++ esw->base = devm_ioremap_resource(&pdev->dev, res); ++ if (!esw->base) ++ return -EADDRNOTAVAIL; ++ ++ port_map = of_get_property(np, "mediatek,portmap", NULL); ++ if (port_map) ++ esw->port_map = be32_to_cpu(*port_map); ++ ++ reg_init = of_get_property(np, "mediatek,led_polarity", NULL); ++ if (reg_init) ++ esw->reg_led_polarity = be32_to_cpu(*reg_init); ++ ++ platform_set_drvdata(pdev, esw); ++ ++ spin_lock_init(&esw->reg_rw_lock); ++ ++ esw_hw_init(esw); ++ ++ ret = devm_request_irq(&pdev->dev, esw->irq, esw_interrupt, 0, "esw", ++ esw); ++ ++ if (!ret) { ++ esw_w32(esw, RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_ISR); ++ esw_w32(esw, ~RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_IMR); ++ } ++ ++ return ret; ++} ++ ++static int esw_remove(struct platform_device *pdev) ++{ ++ struct rt305x_esw *esw = platform_get_drvdata(pdev); ++ ++ if (esw) { ++ esw_w32(esw, ~0, RT305X_ESW_REG_IMR); ++ platform_set_drvdata(pdev, NULL); ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id ralink_esw_match[] = { ++ { .compatible = "ralink,rt3050-esw" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ralink_esw_match); ++ ++static struct platform_driver esw_driver = { ++ .probe = esw_probe, ++ .remove = esw_remove, ++ .driver = { ++ .name = "rt3050-esw", ++ .owner = THIS_MODULE, ++ .of_match_table = ralink_esw_match, ++ }, ++}; ++ ++int __init mtk_switch_init(void) ++{ ++ return platform_driver_register(&esw_driver); ++} ++ ++void mtk_switch_exit(void) ++{ ++ platform_driver_unregister(&esw_driver); ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.h +@@ -0,0 +1,29 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#ifndef _RALINK_ESW_RT3052_H__ ++#define _RALINK_ESW_RT3052_H__ ++ ++#ifdef CONFIG_NET_MEDIATEK_ESW_RT3052 ++ ++int __init mtk_switch_init(void); ++void mtk_switch_exit(void); ++ ++#else ++ ++static inline int __init mtk_switch_init(void) { return 0; } ++static inline void mtk_switch_exit(void) { } ++ ++#endif ++#endif diff --git a/target/linux/ramips/patches-4.4/0503-net-next-mediatek-add-switch-driver-for-mt7620.patch b/target/linux/ramips/patches-4.4/0503-net-next-mediatek-add-switch-driver-for-mt7620.patch new file mode 100644 index 0000000000..59972bd42e --- /dev/null +++ b/target/linux/ramips/patches-4.4/0503-net-next-mediatek-add-switch-driver-for-mt7620.patch @@ -0,0 +1,394 @@ +From 322a9598692943961791ac6e5a3f385b379dcdc3 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 21:23:18 +0100 +Subject: [PATCH 503/513] net-next: mediatek: add switch driver for mt7620 + +This driver is very basic and only provides basic init and irq support. +Switchdev support for this device will follow. + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/gsw_mt7620.c | 255 ++++++++++++++++++++++++++++ + drivers/net/ethernet/mediatek/gsw_mt7620.h | 117 +++++++++++++ + 2 files changed, 372 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/gsw_mt7620.c + create mode 100644 drivers/net/ethernet/mediatek/gsw_mt7620.h + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/gsw_mt7620.c +@@ -0,0 +1,255 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "gsw_mt7620.h" ++ ++void mtk_switch_w32(struct mt7620_gsw *gsw, u32 val, unsigned reg) ++{ ++ iowrite32(val, gsw->base + reg); ++} ++ ++u32 mtk_switch_r32(struct mt7620_gsw *gsw, unsigned reg) ++{ ++ return ioread32(gsw->base + reg); ++} ++ ++static irqreturn_t gsw_interrupt_mt7620(int irq, void *_priv) ++{ ++ struct fe_priv *priv = (struct fe_priv *)_priv; ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ u32 status; ++ int i, max = (gsw->port4 == PORT4_EPHY) ? (4) : (3); ++ ++ status = mtk_switch_r32(gsw, GSW_REG_ISR); ++ if (status & PORT_IRQ_ST_CHG) ++ for (i = 0; i <= max; i++) { ++ u32 status = mtk_switch_r32(gsw, GSW_REG_PORT_STATUS(i)); ++ int link = status & 0x1; ++ ++ if (link != priv->link[i]) ++ mt7620_print_link_state(priv, i, link, ++ (status >> 2) & 3, ++ (status & 0x2)); ++ ++ priv->link[i] = link; ++ } ++ mtk_switch_w32(gsw, status, GSW_REG_ISR); ++ ++ return IRQ_HANDLED; ++} ++ ++static void mt7620_hw_init(struct mt7620_gsw *gsw, struct device_node *np) ++{ ++ u32 is_BGA = (rt_sysc_r32(0x0c) >> 16) & 1; ++ ++ rt_sysc_w32(rt_sysc_r32(SYSC_REG_CFG1) | BIT(8), SYSC_REG_CFG1); ++ mtk_switch_w32(gsw, mtk_switch_r32(gsw, GSW_REG_CKGCR) & ~(0x3 << 4), GSW_REG_CKGCR); ++ ++ if (of_property_read_bool(np, "mediatek,mt7530")) { ++ u32 val; ++ ++ /* turn off ephy and set phy base addr to 12 */ ++ mtk_switch_w32(gsw, mtk_switch_r32(gsw, GSW_REG_GPC1) | ++ (0x1f << 24) | (0xc << 16), ++ GSW_REG_GPC1); ++ ++ /* set MT7530 central align */ ++ val = mt7530_mdio_r32(gsw, 0x7830); ++ val &= ~BIT(0); ++ val |= BIT(1); ++ mt7530_mdio_w32(gsw, 0x7830, val); ++ ++ val = mt7530_mdio_r32(gsw, 0x7a40); ++ val &= ~BIT(30); ++ mt7530_mdio_w32(gsw, 0x7a40, val); ++ ++ mt7530_mdio_w32(gsw, 0x7a78, 0x855); ++ } else { ++ /* global page 4 */ ++ _mt7620_mii_write(gsw, 1, 31, 0x4000); ++ ++ _mt7620_mii_write(gsw, 1, 17, 0x7444); ++ if (is_BGA) ++ _mt7620_mii_write(gsw, 1, 19, 0x0114); ++ else ++ _mt7620_mii_write(gsw, 1, 19, 0x0117); ++ ++ _mt7620_mii_write(gsw, 1, 22, 0x10cf); ++ _mt7620_mii_write(gsw, 1, 25, 0x6212); ++ _mt7620_mii_write(gsw, 1, 26, 0x0777); ++ _mt7620_mii_write(gsw, 1, 29, 0x4000); ++ _mt7620_mii_write(gsw, 1, 28, 0xc077); ++ _mt7620_mii_write(gsw, 1, 24, 0x0000); ++ ++ /* global page 3 */ ++ _mt7620_mii_write(gsw, 1, 31, 0x3000); ++ _mt7620_mii_write(gsw, 1, 17, 0x4838); ++ ++ /* global page 2 */ ++ _mt7620_mii_write(gsw, 1, 31, 0x2000); ++ if (is_BGA) { ++ _mt7620_mii_write(gsw, 1, 21, 0x0515); ++ _mt7620_mii_write(gsw, 1, 22, 0x0053); ++ _mt7620_mii_write(gsw, 1, 23, 0x00bf); ++ _mt7620_mii_write(gsw, 1, 24, 0x0aaf); ++ _mt7620_mii_write(gsw, 1, 25, 0x0fad); ++ _mt7620_mii_write(gsw, 1, 26, 0x0fc1); ++ } else { ++ _mt7620_mii_write(gsw, 1, 21, 0x0517); ++ _mt7620_mii_write(gsw, 1, 22, 0x0fd2); ++ _mt7620_mii_write(gsw, 1, 23, 0x00bf); ++ _mt7620_mii_write(gsw, 1, 24, 0x0aab); ++ _mt7620_mii_write(gsw, 1, 25, 0x00ae); ++ _mt7620_mii_write(gsw, 1, 26, 0x0fff); ++ } ++ /* global page 1 */ ++ _mt7620_mii_write(gsw, 1, 31, 0x1000); ++ _mt7620_mii_write(gsw, 1, 17, 0xe7f8); ++ } ++ ++ /* global page 0 */ ++ _mt7620_mii_write(gsw, 1, 31, 0x8000); ++ _mt7620_mii_write(gsw, 0, 30, 0xa000); ++ _mt7620_mii_write(gsw, 1, 30, 0xa000); ++ _mt7620_mii_write(gsw, 2, 30, 0xa000); ++ _mt7620_mii_write(gsw, 3, 30, 0xa000); ++ ++ _mt7620_mii_write(gsw, 0, 4, 0x05e1); ++ _mt7620_mii_write(gsw, 1, 4, 0x05e1); ++ _mt7620_mii_write(gsw, 2, 4, 0x05e1); ++ _mt7620_mii_write(gsw, 3, 4, 0x05e1); ++ ++ /* global page 2 */ ++ _mt7620_mii_write(gsw, 1, 31, 0xa000); ++ _mt7620_mii_write(gsw, 0, 16, 0x1111); ++ _mt7620_mii_write(gsw, 1, 16, 0x1010); ++ _mt7620_mii_write(gsw, 2, 16, 0x1515); ++ _mt7620_mii_write(gsw, 3, 16, 0x0f0f); ++ ++ /* CPU Port6 Force Link 1G, FC ON */ ++ mtk_switch_w32(gsw, 0x5e33b, GSW_REG_PORT_PMCR(6)); ++ ++ /* Set Port 6 as CPU Port */ ++ mtk_switch_w32(gsw, 0x7f7f7fe0, 0x0010); ++ ++ /* setup port 4 */ ++ if (gsw->port4 == PORT4_EPHY) { ++ u32 val = rt_sysc_r32(SYSC_REG_CFG1); ++ ++ val |= 3 << 14; ++ rt_sysc_w32(val, SYSC_REG_CFG1); ++ _mt7620_mii_write(gsw, 4, 30, 0xa000); ++ _mt7620_mii_write(gsw, 4, 4, 0x05e1); ++ _mt7620_mii_write(gsw, 4, 16, 0x1313); ++ pr_info("gsw: setting port4 to ephy mode\n"); ++ } ++} ++ ++static const struct of_device_id mediatek_gsw_match[] = { ++ { .compatible = "mediatek,mt7620-gsw" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mediatek_gsw_match); ++ ++int mtk_gsw_init(struct fe_priv *priv) ++{ ++ struct device_node *np = priv->switch_np; ++ struct platform_device *pdev = of_find_device_by_node(np); ++ struct mt7620_gsw *gsw; ++ ++ if (!pdev) ++ return -ENODEV; ++ ++ if (!of_device_is_compatible(np, mediatek_gsw_match->compatible)) ++ return -EINVAL; ++ ++ gsw = platform_get_drvdata(pdev); ++ priv->soc->swpriv = gsw; ++ ++ mt7620_hw_init(gsw, np); ++ ++ if (gsw->irq) { ++ request_irq(gsw->irq, gsw_interrupt_mt7620, 0, ++ "gsw", priv); ++ mtk_switch_w32(gsw, ~PORT_IRQ_ST_CHG, GSW_REG_IMR); ++ } ++ ++ return 0; ++} ++ ++static int mt7620_gsw_probe(struct platform_device *pdev) ++{ ++ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ const char *port4 = NULL; ++ struct mt7620_gsw *gsw; ++ struct device_node *np = pdev->dev.of_node; ++ ++ gsw = devm_kzalloc(&pdev->dev, sizeof(struct mt7620_gsw), GFP_KERNEL); ++ if (!gsw) ++ return -ENOMEM; ++ ++ gsw->base = devm_ioremap_resource(&pdev->dev, res); ++ if (!gsw->base) ++ return -EADDRNOTAVAIL; ++ ++ gsw->dev = &pdev->dev; ++ ++ of_property_read_string(np, "mediatek,port4", &port4); ++ if (port4 && !strcmp(port4, "ephy")) ++ gsw->port4 = PORT4_EPHY; ++ else if (port4 && !strcmp(port4, "gmac")) ++ gsw->port4 = PORT4_EXT; ++ else ++ gsw->port4 = PORT4_EPHY; ++ ++ gsw->irq = platform_get_irq(pdev, 0); ++ ++ platform_set_drvdata(pdev, gsw); ++ ++ return 0; ++} ++ ++static int mt7620_gsw_remove(struct platform_device *pdev) ++{ ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++static struct platform_driver gsw_driver = { ++ .probe = mt7620_gsw_probe, ++ .remove = mt7620_gsw_remove, ++ .driver = { ++ .name = "mt7620-gsw", ++ .owner = THIS_MODULE, ++ .of_match_table = mediatek_gsw_match, ++ }, ++}; ++ ++module_platform_driver(gsw_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("John Crispin "); ++MODULE_DESCRIPTION("GBit switch driver for Mediatek MT7620 SoC"); ++MODULE_VERSION(MTK_FE_DRV_VERSION); +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/gsw_mt7620.h +@@ -0,0 +1,117 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#ifndef _RALINK_GSW_MT7620_H__ ++#define _RALINK_GSW_MT7620_H__ ++ ++#define GSW_REG_PHY_TIMEOUT (5 * HZ) ++ ++#ifdef CONFIG_SOC_MT7621 ++#define MT7620A_GSW_REG_PIAC 0x0004 ++#else ++#define MT7620A_GSW_REG_PIAC 0x7004 ++#endif ++ ++#define GSW_NUM_VLANS 16 ++#define GSW_NUM_VIDS 4096 ++#define GSW_NUM_PORTS 7 ++#define GSW_PORT6 6 ++ ++#define GSW_MDIO_ACCESS BIT(31) ++#define GSW_MDIO_READ BIT(19) ++#define GSW_MDIO_WRITE BIT(18) ++#define GSW_MDIO_START BIT(16) ++#define GSW_MDIO_ADDR_SHIFT 20 ++#define GSW_MDIO_REG_SHIFT 25 ++ ++#define GSW_REG_PORT_PMCR(x) (0x3000 + (x * 0x100)) ++#define GSW_REG_PORT_STATUS(x) (0x3008 + (x * 0x100)) ++#define GSW_REG_SMACCR0 0x3fE4 ++#define GSW_REG_SMACCR1 0x3fE8 ++#define GSW_REG_CKGCR 0x3ff0 ++ ++#define GSW_REG_IMR 0x7008 ++#define GSW_REG_ISR 0x700c ++#define GSW_REG_GPC1 0x7014 ++ ++#define SYSC_REG_CHIP_REV_ID 0x0c ++#define SYSC_REG_CFG1 0x14 ++#define RST_CTRL_MCM BIT(2) ++#define SYSC_PAD_RGMII2_MDIO 0x58 ++#define SYSC_GPIO_MODE 0x60 ++ ++#define PORT_IRQ_ST_CHG 0x7f ++ ++#ifdef CONFIG_SOC_MT7621 ++#define ESW_PHY_POLLING 0x0000 ++#else ++#define ESW_PHY_POLLING 0x7000 ++#endif ++ ++#define PMCR_IPG BIT(18) ++#define PMCR_MAC_MODE BIT(16) ++#define PMCR_FORCE BIT(15) ++#define PMCR_TX_EN BIT(14) ++#define PMCR_RX_EN BIT(13) ++#define PMCR_BACKOFF BIT(9) ++#define PMCR_BACKPRES BIT(8) ++#define PMCR_RX_FC BIT(5) ++#define PMCR_TX_FC BIT(4) ++#define PMCR_SPEED(_x) (_x << 2) ++#define PMCR_DUPLEX BIT(1) ++#define PMCR_LINK BIT(0) ++ ++#define PHY_AN_EN BIT(31) ++#define PHY_PRE_EN BIT(30) ++#define PMY_MDC_CONF(_x) ((_x & 0x3f) << 24) ++ ++enum { ++ /* Global attributes. */ ++ GSW_ATTR_ENABLE_VLAN, ++ /* Port attributes. */ ++ GSW_ATTR_PORT_UNTAG, ++}; ++ ++enum { ++ PORT4_EPHY = 0, ++ PORT4_EXT, ++}; ++ ++struct mt7620_gsw { ++ struct device *dev; ++ void __iomem *base; ++ int irq; ++ int port4; ++ unsigned long int autopoll; ++}; ++ ++void mtk_switch_w32(struct mt7620_gsw *gsw, u32 val, unsigned reg); ++u32 mtk_switch_r32(struct mt7620_gsw *gsw, unsigned reg); ++int mtk_gsw_init(struct fe_priv *priv); ++ ++int mt7620_mdio_write(struct mii_bus *bus, int phy_addr, int phy_reg, u16 val); ++int mt7620_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg); ++void mt7620_mdio_link_adjust(struct fe_priv *priv, int port); ++int mt7620_has_carrier(struct fe_priv *priv); ++void mt7620_print_link_state(struct fe_priv *priv, int port, int link, ++ int speed, int duplex); ++ ++void mt7530_mdio_w32(struct mt7620_gsw *gsw, u32 reg, u32 val); ++u32 mt7530_mdio_r32(struct mt7620_gsw *gsw, u32 reg); ++ ++u32 _mt7620_mii_write(struct mt7620_gsw *gsw, u32 phy_addr, ++ u32 phy_register, u32 write_data); ++u32 _mt7620_mii_read(struct mt7620_gsw *gsw, int phy_addr, int phy_reg); ++ ++#endif diff --git a/target/linux/ramips/patches-4.4/0504-net-next-mediatek-add-switch-driver-for-mt7621.patch b/target/linux/ramips/patches-4.4/0504-net-next-mediatek-add-switch-driver-for-mt7621.patch new file mode 100644 index 0000000000..71192c9a25 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0504-net-next-mediatek-add-switch-driver-for-mt7621.patch @@ -0,0 +1,301 @@ +From 9fc19d5f7354709298dcb15b3a4c7cd9a18acebf Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 21:24:46 +0100 +Subject: [PATCH 504/513] net-next: mediatek: add switch driver for mt7621 + +This driver is very basic and only provides basic init and irq support. +Switchdev support for this device will follow. + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/gsw_mt7621.c | 284 ++++++++++++++++++++++++++++ + 1 file changed, 284 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/gsw_mt7621.c + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/gsw_mt7621.c +@@ -0,0 +1,284 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "gsw_mt7620.h" ++ ++void mtk_switch_w32(struct mt7620_gsw *gsw, u32 val, unsigned reg) ++{ ++ iowrite32(val, gsw->base + reg); ++} ++ ++u32 mtk_switch_r32(struct mt7620_gsw *gsw, unsigned reg) ++{ ++ return ioread32(gsw->base + reg); ++} ++ ++static irqreturn_t gsw_interrupt_mt7621(int irq, void *_priv) ++{ ++ struct fe_priv *priv = (struct fe_priv *)_priv; ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ u32 reg, i; ++ ++ reg = mt7530_mdio_r32(gsw, 0x700c); ++ ++ for (i = 0; i < 5; i++) ++ if (reg & BIT(i)) { ++ unsigned int link; ++ ++ link = mt7530_mdio_r32(gsw, ++ 0x3008 + (i * 0x100)) & 0x1; ++ ++ if (link != priv->link[i]) { ++ priv->link[i] = link; ++ if (link) ++ netdev_info(priv->netdev, ++ "port %d link up\n", i); ++ else ++ netdev_info(priv->netdev, ++ "port %d link down\n", i); ++ } ++ } ++ ++ mt7530_mdio_w32(gsw, 0x700c, 0x1f); ++ ++ return IRQ_HANDLED; ++} ++ ++static void mt7621_hw_init(struct mt7620_gsw *gsw, struct device_node *np) ++{ ++ u32 i; ++ u32 val; ++ ++ /* wardware reset the switch */ ++ fe_reset(RST_CTRL_MCM); ++ mdelay(10); ++ ++ /* reduce RGMII2 PAD driving strength */ ++ rt_sysc_m32(3 << 4, 0, SYSC_PAD_RGMII2_MDIO); ++ ++ /* gpio mux - RGMII1=Normal mode */ ++ rt_sysc_m32(BIT(14), 0, SYSC_GPIO_MODE); ++ ++ /* set GMAC1 RGMII mode */ ++ rt_sysc_m32(3 << 12, 0, SYSC_REG_CFG1); ++ ++ /* enable MDIO to control MT7530 */ ++ rt_sysc_m32(3 << 12, 0, SYSC_GPIO_MODE); ++ ++ /* turn off all PHYs */ ++ for (i = 0; i <= 4; i++) { ++ val = _mt7620_mii_read(gsw, i, 0x0); ++ val |= BIT(11); ++ _mt7620_mii_write(gsw, i, 0x0, val); ++ } ++ ++ /* reset the switch */ ++ mt7530_mdio_w32(gsw, 0x7000, 0x3); ++ usleep_range(10, 20); ++ ++ if ((rt_sysc_r32(SYSC_REG_CHIP_REV_ID) & 0xFFFF) == 0x0101) { ++ /* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */ ++ mtk_switch_w32(gsw, 0x2105e30b, 0x100); ++ mt7530_mdio_w32(gsw, 0x3600, 0x5e30b); ++ } else { ++ /* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */ ++ mtk_switch_w32(gsw, 0x2105e33b, 0x100); ++ mt7530_mdio_w32(gsw, 0x3600, 0x5e33b); ++ } ++ ++ /* (GE2, Link down) */ ++ mtk_switch_w32(gsw, 0x8000, 0x200); ++ ++ /* Enable Port 6, P5 as GMAC5, P5 disable */ ++ val = mt7530_mdio_r32(gsw, 0x7804); ++ val &= ~BIT(8); ++ val |= BIT(6) | BIT(13) | BIT(16); ++ mt7530_mdio_w32(gsw, 0x7804, val); ++ ++ val = rt_sysc_r32(0x10); ++ val = (val >> 6) & 0x7; ++ if (val >= 6) { ++ /* 25Mhz Xtal - do nothing */ ++ } else if (val >= 3) { ++ /* 40Mhz */ ++ ++ /* disable MT7530 core clock */ ++ _mt7620_mii_write(gsw, 0, 13, 0x1f); ++ _mt7620_mii_write(gsw, 0, 14, 0x410); ++ _mt7620_mii_write(gsw, 0, 13, 0x401f); ++ _mt7620_mii_write(gsw, 0, 14, 0x0); ++ ++ /* disable MT7530 PLL */ ++ _mt7620_mii_write(gsw, 0, 13, 0x1f); ++ _mt7620_mii_write(gsw, 0, 14, 0x40d); ++ _mt7620_mii_write(gsw, 0, 13, 0x401f); ++ _mt7620_mii_write(gsw, 0, 14, 0x2020); ++ ++ /* for MT7530 core clock = 500Mhz */ ++ _mt7620_mii_write(gsw, 0, 13, 0x1f); ++ _mt7620_mii_write(gsw, 0, 14, 0x40e); ++ _mt7620_mii_write(gsw, 0, 13, 0x401f); ++ _mt7620_mii_write(gsw, 0, 14, 0x119); ++ ++ /* enable MT7530 PLL */ ++ _mt7620_mii_write(gsw, 0, 13, 0x1f); ++ _mt7620_mii_write(gsw, 0, 14, 0x40d); ++ _mt7620_mii_write(gsw, 0, 13, 0x401f); ++ _mt7620_mii_write(gsw, 0, 14, 0x2820); ++ ++ usleep_range(20, 40); ++ ++ /* enable MT7530 core clock */ ++ _mt7620_mii_write(gsw, 0, 13, 0x1f); ++ _mt7620_mii_write(gsw, 0, 14, 0x410); ++ _mt7620_mii_write(gsw, 0, 13, 0x401f); ++ } else { ++ /* 20Mhz Xtal - TODO */ ++ } ++ ++ /* RGMII */ ++ _mt7620_mii_write(gsw, 0, 14, 0x1); ++ ++ /* set MT7530 central align */ ++ val = mt7530_mdio_r32(gsw, 0x7830); ++ val &= ~BIT(0); ++ val |= BIT(1); ++ mt7530_mdio_w32(gsw, 0x7830, val); ++ val = mt7530_mdio_r32(gsw, 0x7a40); ++ val &= ~BIT(30); ++ mt7530_mdio_w32(gsw, 0x7a40, val); ++ mt7530_mdio_w32(gsw, 0x7a78, 0x855); ++ ++ /* delay setting for 10/1000M */ ++ mt7530_mdio_w32(gsw, 0x7b00, 0x102); ++ mt7530_mdio_w32(gsw, 0x7b04, 0x14); ++ ++ /* lower Tx Driving*/ ++ mt7530_mdio_w32(gsw, 0x7a54, 0x44); ++ mt7530_mdio_w32(gsw, 0x7a5c, 0x44); ++ mt7530_mdio_w32(gsw, 0x7a64, 0x44); ++ mt7530_mdio_w32(gsw, 0x7a6c, 0x44); ++ mt7530_mdio_w32(gsw, 0x7a74, 0x44); ++ mt7530_mdio_w32(gsw, 0x7a7c, 0x44); ++ ++ /* 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); ++ } ++ ++ /* enable irq */ ++ val = mt7530_mdio_r32(gsw, 0x7808); ++ val |= 3 << 16; ++ mt7530_mdio_w32(gsw, 0x7808, val); ++} ++ ++static const struct of_device_id mediatek_gsw_match[] = { ++ { .compatible = "mediatek,mt7621-gsw" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mediatek_gsw_match); ++ ++int mtk_gsw_init(struct fe_priv *priv) ++{ ++ struct device_node *np = priv->switch_np; ++ struct platform_device *pdev = of_find_device_by_node(np); ++ struct mt7620_gsw *gsw; ++ ++ if (!pdev) ++ return -ENODEV; ++ ++ if (!of_device_is_compatible(np, mediatek_gsw_match->compatible)) ++ return -EINVAL; ++ ++ gsw = platform_get_drvdata(pdev); ++ priv->soc->swpriv = gsw; ++ ++ mt7621_hw_init(gsw, np); ++ ++ if (gsw->irq) { ++ request_irq(gsw->irq, gsw_interrupt_mt7621, 0, ++ "gsw", priv); ++ mt7530_mdio_w32(gsw, 0x7008, 0x1f); ++ } ++ ++ return 0; ++} ++ ++static int mt7621_gsw_probe(struct platform_device *pdev) ++{ ++ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ const char *port4 = NULL; ++ struct mt7620_gsw *gsw; ++ struct device_node *np; ++ ++ gsw = devm_kzalloc(&pdev->dev, sizeof(struct mt7620_gsw), GFP_KERNEL); ++ if (!gsw) ++ return -ENOMEM; ++ ++ gsw->base = devm_ioremap_resource(&pdev->dev, res); ++ if (!gsw->base) ++ return -EADDRNOTAVAIL; ++ ++ gsw->dev = &pdev->dev; ++ ++ of_property_read_string(np, "mediatek,port4", &port4); ++ if (port4 && !strcmp(port4, "ephy")) ++ gsw->port4 = PORT4_EPHY; ++ else if (port4 && !strcmp(port4, "gmac")) ++ gsw->port4 = PORT4_EXT; ++ else ++ gsw->port4 = PORT4_EPHY; ++ ++ gsw->irq = platform_get_irq(pdev, 0); ++ ++ platform_set_drvdata(pdev, gsw); ++ ++ return 0; ++} ++ ++static int mt7621_gsw_remove(struct platform_device *pdev) ++{ ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++static struct platform_driver gsw_driver = { ++ .probe = mt7621_gsw_probe, ++ .remove = mt7621_gsw_remove, ++ .driver = { ++ .name = "mt7621-gsw", ++ .owner = THIS_MODULE, ++ .of_match_table = mediatek_gsw_match, ++ }, ++}; ++ ++module_platform_driver(gsw_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("John Crispin "); ++MODULE_DESCRIPTION("GBit switch driver for Mediatek MT7621 SoC"); ++MODULE_VERSION(MTK_FE_DRV_VERSION); diff --git a/target/linux/ramips/patches-4.4/0505-net-next-mediatek-add-support-for-rt2880.patch b/target/linux/ramips/patches-4.4/0505-net-next-mediatek-add-support-for-rt2880.patch new file mode 100644 index 0000000000..6221a164d8 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0505-net-next-mediatek-add-support-for-rt2880.patch @@ -0,0 +1,351 @@ +From f8c8f4bd2a13e0cc060c93812377373d436f7f02 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 18 Nov 2015 03:13:05 +0100 +Subject: [PATCH 505/513] net-next: mediatek: add support for rt2880 + +rt2880 is the oldest SoC with this core. It has a single gBit port that will +normally be attached to an external phy of switch. The patch also adds the +code required to drive the mdio bus. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/mediatek/mdio_rt2880.c | 222 +++++++++++++++++++++++++++ + drivers/net/ethernet/mediatek/mdio_rt2880.h | 23 +++ + drivers/net/ethernet/mediatek/soc_rt2880.c | 76 +++++++++ + 3 files changed, 321 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/mdio_rt2880.c + create mode 100644 drivers/net/ethernet/mediatek/mdio_rt2880.h + create mode 100644 drivers/net/ethernet/mediatek/soc_rt2880.c + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mdio_rt2880.c +@@ -0,0 +1,222 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "mtk_eth_soc.h" ++#include "mdio_rt2880.h" ++#include "mdio.h" ++ ++#define FE_MDIO_RETRY 1000 ++ ++static unsigned char *rt2880_speed_str(struct fe_priv *priv) ++{ ++ switch (priv->phy->speed[0]) { ++ case SPEED_1000: ++ return "1000"; ++ case SPEED_100: ++ return "100"; ++ case SPEED_10: ++ return "10"; ++ } ++ ++ return "?"; ++} ++ ++void rt2880_mdio_link_adjust(struct fe_priv *priv, int port) ++{ ++ u32 mdio_cfg; ++ ++ if (!priv->link[0]) { ++ netif_carrier_off(priv->netdev); ++ netdev_info(priv->netdev, "link down\n"); ++ return; ++ } ++ ++ mdio_cfg = FE_MDIO_CFG_TX_CLK_SKEW_200 | ++ FE_MDIO_CFG_RX_CLK_SKEW_200 | ++ FE_MDIO_CFG_GP1_FRC_EN; ++ ++ if (priv->phy->duplex[0] == DUPLEX_FULL) ++ mdio_cfg |= FE_MDIO_CFG_GP1_DUPLEX; ++ ++ if (priv->phy->tx_fc[0]) ++ mdio_cfg |= FE_MDIO_CFG_GP1_FC_TX; ++ ++ if (priv->phy->rx_fc[0]) ++ mdio_cfg |= FE_MDIO_CFG_GP1_FC_RX; ++ ++ switch (priv->phy->speed[0]) { ++ case SPEED_10: ++ mdio_cfg |= FE_MDIO_CFG_GP1_SPEED_10; ++ break; ++ case SPEED_100: ++ mdio_cfg |= FE_MDIO_CFG_GP1_SPEED_100; ++ break; ++ case SPEED_1000: ++ mdio_cfg |= FE_MDIO_CFG_GP1_SPEED_1000; ++ break; ++ default: ++ BUG(); ++ } ++ ++ fe_w32(mdio_cfg, FE_MDIO_CFG); ++ ++ netif_carrier_on(priv->netdev); ++ netdev_info(priv->netdev, "link up (%sMbps/%s duplex)\n", ++ rt2880_speed_str(priv), ++ (priv->phy->duplex[0] == DUPLEX_FULL) ? "Full" : "Half"); ++} ++ ++static int rt2880_mdio_wait_ready(struct fe_priv *priv) ++{ ++ int retries; ++ ++ retries = FE_MDIO_RETRY; ++ while (1) { ++ u32 t; ++ ++ t = fe_r32(FE_MDIO_ACCESS); ++ if ((t & BIT(31)) == 0) ++ return 0; ++ ++ if (retries-- == 0) ++ break; ++ ++ udelay(1); ++ } ++ ++ dev_err(priv->device, "MDIO operation timed out\n"); ++ return -ETIMEDOUT; ++} ++ ++int rt2880_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg) ++{ ++ struct fe_priv *priv = bus->priv; ++ int err; ++ u32 t; ++ ++ err = rt2880_mdio_wait_ready(priv); ++ if (err) ++ return 0xffff; ++ ++ t = (phy_addr << 24) | (phy_reg << 16); ++ fe_w32(t, FE_MDIO_ACCESS); ++ t |= BIT(31); ++ fe_w32(t, FE_MDIO_ACCESS); ++ ++ err = rt2880_mdio_wait_ready(priv); ++ if (err) ++ return 0xffff; ++ ++ pr_debug("%s: addr=%04x, reg=%04x, value=%04x\n", __func__, ++ phy_addr, phy_reg, fe_r32(FE_MDIO_ACCESS) & 0xffff); ++ ++ return fe_r32(FE_MDIO_ACCESS) & 0xffff; ++} ++ ++int rt2880_mdio_write(struct mii_bus *bus, int phy_addr, int phy_reg, u16 val) ++{ ++ struct fe_priv *priv = bus->priv; ++ int err; ++ u32 t; ++ ++ pr_debug("%s: addr=%04x, reg=%04x, value=%04x\n", __func__, ++ phy_addr, phy_reg, fe_r32(FE_MDIO_ACCESS) & 0xffff); ++ ++ err = rt2880_mdio_wait_ready(priv); ++ if (err) ++ return err; ++ ++ t = (1 << 30) | (phy_addr << 24) | (phy_reg << 16) | val; ++ fe_w32(t, FE_MDIO_ACCESS); ++ t |= BIT(31); ++ fe_w32(t, FE_MDIO_ACCESS); ++ ++ return rt2880_mdio_wait_ready(priv); ++} ++ ++void rt2880_port_init(struct fe_priv *priv, struct device_node *np) ++{ ++ const __be32 *id = of_get_property(np, "reg", NULL); ++ const __be32 *link; ++ int size; ++ int phy_mode; ++ ++ if (!id || (be32_to_cpu(*id) != 0)) { ++ pr_err("%s: invalid port id\n", np->name); ++ return; ++ } ++ ++ priv->phy->phy_fixed[0] = of_get_property(np, ++ "mediatek,fixed-link", &size); ++ if (priv->phy->phy_fixed[0] && ++ (size != (4 * sizeof(*priv->phy->phy_fixed[0])))) { ++ pr_err("%s: invalid fixed link property\n", np->name); ++ priv->phy->phy_fixed[0] = NULL; ++ return; ++ } ++ ++ phy_mode = of_get_phy_mode(np); ++ switch (phy_mode) { ++ case PHY_INTERFACE_MODE_RGMII: ++ break; ++ case PHY_INTERFACE_MODE_MII: ++ break; ++ case PHY_INTERFACE_MODE_RMII: ++ break; ++ default: ++ if (!priv->phy->phy_fixed[0]) ++ dev_err(priv->device, "port %d - invalid phy mode\n", ++ priv->phy->speed[0]); ++ break; ++ } ++ ++ priv->phy->phy_node[0] = of_parse_phandle(np, "phy-handle", 0); ++ if (!priv->phy->phy_node[0] && !priv->phy->phy_fixed[0]) ++ return; ++ ++ if (priv->phy->phy_fixed[0]) { ++ link = priv->phy->phy_fixed[0]; ++ priv->phy->speed[0] = be32_to_cpup(link++); ++ priv->phy->duplex[0] = be32_to_cpup(link++); ++ priv->phy->tx_fc[0] = be32_to_cpup(link++); ++ priv->phy->rx_fc[0] = be32_to_cpup(link++); ++ ++ priv->link[0] = 1; ++ switch (priv->phy->speed[0]) { ++ case SPEED_10: ++ break; ++ case SPEED_100: ++ break; ++ case SPEED_1000: ++ break; ++ default: ++ dev_err(priv->device, "invalid link speed: %d\n", ++ priv->phy->speed[0]); ++ priv->phy->phy_fixed[0] = 0; ++ return; ++ } ++ dev_info(priv->device, "using fixed link parameters\n"); ++ rt2880_mdio_link_adjust(priv, 0); ++ return; ++ } ++ ++ if (priv->phy->phy_node[0] && priv->mii_bus->phy_map[0]) ++ fe_connect_phy_node(priv, priv->phy->phy_node[0]); ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mdio_rt2880.h +@@ -0,0 +1,23 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#ifndef _RALINK_MDIO_RT2880_H__ ++#define _RALINK_MDIO_RT2880_H__ ++ ++void rt2880_mdio_link_adjust(struct fe_priv *priv, int port); ++int rt2880_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg); ++int rt2880_mdio_write(struct mii_bus *bus, int phy_addr, int phy_reg, u16 val); ++void rt2880_port_init(struct fe_priv *priv, struct device_node *np); ++ ++#endif +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/soc_rt2880.c +@@ -0,0 +1,76 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "mdio_rt2880.h" ++ ++#define RT2880_RESET_FE BIT(18) ++ ++static void rt2880_init_data(struct fe_soc_data *data, ++ struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ ++ priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_PADDING_BUG | ++ FE_FLAG_JUMBO_FRAME | FE_FLAG_CALIBRATE_CLK; ++ netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_TX; ++ /* this should work according to the datasheet but actually does not*/ ++ /* netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM; */ ++} ++ ++void rt2880_fe_reset(void) ++{ ++ fe_reset(RT2880_RESET_FE); ++} ++ ++static int rt2880_fwd_config(struct fe_priv *priv) ++{ ++ int ret; ++ ++ ret = fe_set_clock_cycle(priv); ++ if (ret) ++ return ret; ++ ++ fe_fwd_config(priv); ++ fe_w32(FE_PSE_FQFC_CFG_INIT, FE_PSE_FQ_CFG); ++ fe_csum_config(priv); ++ ++ return ret; ++} ++ ++struct fe_soc_data rt2880_data = { ++ .init_data = rt2880_init_data, ++ .reset_fe = rt2880_fe_reset, ++ .fwd_config = rt2880_fwd_config, ++ .pdma_glo_cfg = FE_PDMA_SIZE_8DWORDS, ++ .checksum_bit = RX_DMA_L4VALID, ++ .rx_int = FE_RX_DONE_INT, ++ .tx_int = FE_TX_DONE_INT, ++ .status_int = FE_CNT_GDM_AF, ++ .mdio_read = rt2880_mdio_read, ++ .mdio_write = rt2880_mdio_write, ++ .mdio_adjust_link = rt2880_mdio_link_adjust, ++ .port_init = rt2880_port_init, ++}; ++ ++const struct of_device_id of_fe_match[] = { ++ { .compatible = "ralink,rt2880-eth", .data = &rt2880_data }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_fe_match); diff --git a/target/linux/ramips/patches-4.4/0506-net-next-mediatek-add-support-for-rt3050.patch b/target/linux/ramips/patches-4.4/0506-net-next-mediatek-add-support-for-rt3050.patch new file mode 100644 index 0000000000..e30ac0d476 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0506-net-next-mediatek-add-support-for-rt3050.patch @@ -0,0 +1,239 @@ +From a3555658ce5dd97df3dc225289b92800da9d38ba Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 21:28:51 +0100 +Subject: [PATCH 506/513] net-next: mediatek: add support for rt3050 + +Add support for SoCs from the rt3050 family. This include rt3050, rt3052, +rt3352 and rt5350. These all have a builtin 5 port 100mbit switch. This patch +includes rudimentary code to power up the switch. There are a lot of magic +values that get written to the switch and the internal phys. These values +come straight from the SDK driver and we do not know the meaning of most of +them. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/mediatek/esw_rt3050.c | 18 +--- + drivers/net/ethernet/mediatek/soc_rt3050.c | 158 ++++++++++++++++++++++++++++ + 2 files changed, 159 insertions(+), 17 deletions(-) + create mode 100644 drivers/net/ethernet/mediatek/soc_rt3050.c + +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -14,27 +14,11 @@ + + #include + #include +-#include +-#include +-#include +-#include +-#include +-#include + #include +-#include +-#include +-#include +-#include +- + #include + + #include "mtk_eth_soc.h" + +-#include +-#include +- +-#include +- + /* HW limitations for this switch: + * - No large frame support (PKT_MAX_LEN at most 1536) + * - Can't have untagged vlan and tagged vlan on one port at the same time, +@@ -559,7 +543,7 @@ static irqreturn_t esw_interrupt(int irq + + static int esw_probe(struct platform_device *pdev) + { +- struct resource *res = platform_get_resource(p, IORESOURCE_MEM, 0); ++ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct device_node *np = pdev->dev.of_node; + const __be32 *port_map, *reg_init; + struct rt305x_esw *esw; +@@ -629,12 +613,9 @@ static struct platform_driver esw_driver + }, + }; + +-int __init mtk_switch_init(void) +-{ +- return platform_driver_register(&esw_driver); +-} ++module_platform_driver(esw_driver); + +-void mtk_switch_exit(void) +-{ +- platform_driver_unregister(&esw_driver); +-} ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("John Crispin "); ++MODULE_DESCRIPTION("Switch driver for RT305X SoC"); ++MODULE_VERSION(MTK_FE_DRV_VERSION); +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/soc_rt3050.c +@@ -0,0 +1,158 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "mdio_rt2880.h" ++ ++#define RT305X_RESET_FE BIT(21) ++#define RT305X_RESET_ESW BIT(23) ++ ++static const u16 rt5350_reg_table[FE_REG_COUNT] = { ++ [FE_REG_PDMA_GLO_CFG] = RT5350_PDMA_GLO_CFG, ++ [FE_REG_PDMA_RST_CFG] = RT5350_PDMA_RST_CFG, ++ [FE_REG_DLY_INT_CFG] = RT5350_DLY_INT_CFG, ++ [FE_REG_TX_BASE_PTR0] = RT5350_TX_BASE_PTR0, ++ [FE_REG_TX_MAX_CNT0] = RT5350_TX_MAX_CNT0, ++ [FE_REG_TX_CTX_IDX0] = RT5350_TX_CTX_IDX0, ++ [FE_REG_TX_DTX_IDX0] = RT5350_TX_DTX_IDX0, ++ [FE_REG_RX_BASE_PTR0] = RT5350_RX_BASE_PTR0, ++ [FE_REG_RX_MAX_CNT0] = RT5350_RX_MAX_CNT0, ++ [FE_REG_RX_CALC_IDX0] = RT5350_RX_CALC_IDX0, ++ [FE_REG_RX_DRX_IDX0] = RT5350_RX_DRX_IDX0, ++ [FE_REG_FE_INT_ENABLE] = RT5350_FE_INT_ENABLE, ++ [FE_REG_FE_INT_STATUS] = RT5350_FE_INT_STATUS, ++ [FE_REG_FE_RST_GL] = 0, ++ [FE_REG_FE_DMA_VID_BASE] = 0, ++}; ++ ++static void rt305x_init_data(struct fe_soc_data *data, ++ struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ ++ priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_PADDING_BUG | ++ FE_FLAG_CALIBRATE_CLK | FE_FLAG_HAS_SWITCH; ++ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | ++ NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX; ++} ++ ++static int rt3050_fwd_config(struct fe_priv *priv) ++{ ++ int ret; ++ ++ if (ralink_soc != RT305X_SOC_RT3052) { ++ ret = fe_set_clock_cycle(priv); ++ if (ret) ++ return ret; ++ } ++ ++ fe_fwd_config(priv); ++ if (ralink_soc != RT305X_SOC_RT3352) ++ fe_w32(FE_PSE_FQFC_CFG_INIT, FE_PSE_FQ_CFG); ++ fe_csum_config(priv); ++ ++ return 0; ++} ++ ++static void rt305x_fe_reset(void) ++{ ++ fe_reset(RT305X_RESET_FE); ++} ++ ++static void rt5350_init_data(struct fe_soc_data *data, ++ struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ ++ priv->flags = FE_FLAG_HAS_SWITCH; ++ netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM; ++} ++ ++static void rt5350_set_mac(struct fe_priv *priv, unsigned char *mac) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&priv->page_lock, flags); ++ fe_w32((mac[0] << 8) | mac[1], RT5350_SDM_MAC_ADRH); ++ fe_w32((mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | mac[5], ++ RT5350_SDM_MAC_ADRL); ++ spin_unlock_irqrestore(&priv->page_lock, flags); ++} ++ ++static void rt5350_rxcsum_config(bool enable) ++{ ++ if (enable) ++ fe_w32(fe_r32(RT5350_SDM_CFG) | (RT5350_SDM_ICS_EN | ++ RT5350_SDM_TCS_EN | RT5350_SDM_UCS_EN), ++ RT5350_SDM_CFG); ++ else ++ fe_w32(fe_r32(RT5350_SDM_CFG) & ~(RT5350_SDM_ICS_EN | ++ RT5350_SDM_TCS_EN | RT5350_SDM_UCS_EN), ++ RT5350_SDM_CFG); ++} ++ ++static int rt5350_fwd_config(struct fe_priv *priv) ++{ ++ struct net_device *dev = priv_netdev(priv); ++ ++ rt5350_rxcsum_config((dev->features & NETIF_F_RXCSUM)); ++ ++ return 0; ++} ++ ++static void rt5350_tx_dma(struct fe_tx_dma *txd) ++{ ++ txd->txd4 = 0; ++} ++ ++static void rt5350_fe_reset(void) ++{ ++ fe_reset(RT305X_RESET_FE | RT305X_RESET_ESW); ++} ++ ++static struct fe_soc_data rt3050_data = { ++ .init_data = rt305x_init_data, ++ .reset_fe = rt305x_fe_reset, ++ .fwd_config = rt3050_fwd_config, ++ .pdma_glo_cfg = FE_PDMA_SIZE_8DWORDS, ++ .checksum_bit = RX_DMA_L4VALID, ++ .rx_int = FE_RX_DONE_INT, ++ .tx_int = FE_TX_DONE_INT, ++ .status_int = FE_CNT_GDM_AF, ++}; ++ ++static struct fe_soc_data rt5350_data = { ++ .init_data = rt5350_init_data, ++ .reg_table = rt5350_reg_table, ++ .reset_fe = rt5350_fe_reset, ++ .set_mac = rt5350_set_mac, ++ .fwd_config = rt5350_fwd_config, ++ .tx_dma = rt5350_tx_dma, ++ .pdma_glo_cfg = FE_PDMA_SIZE_8DWORDS, ++ .checksum_bit = RX_DMA_L4VALID, ++ .rx_int = RT5350_RX_DONE_INT, ++ .tx_int = RT5350_TX_DONE_INT, ++}; ++ ++const struct of_device_id of_fe_match[] = { ++ { .compatible = "ralink,rt3050-eth", .data = &rt3050_data }, ++ { .compatible = "ralink,rt5350-eth", .data = &rt5350_data }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_fe_match); diff --git a/target/linux/ramips/patches-4.4/0507-net-next-mediatek-add-support-for-rt3883.patch b/target/linux/ramips/patches-4.4/0507-net-next-mediatek-add-support-for-rt3883.patch new file mode 100644 index 0000000000..17d7b2fa09 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0507-net-next-mediatek-add-support-for-rt3883.patch @@ -0,0 +1,94 @@ +From 5ad283c69029a519681ed453e7f7ddf250c10559 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 18 Nov 2015 03:51:24 +0100 +Subject: [PATCH 507/513] net-next: mediatek: add support for rt3883 + +Add support for rt3883 and its smaller version rt3662. They both have a single +gBit port that will normally be attached to an external phy of switch. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/mediatek/soc_rt3883.c | 75 ++++++++++++++++++++++++++++ + 1 file changed, 75 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/soc_rt3883.c + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/soc_rt3883.c +@@ -0,0 +1,75 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "mdio_rt2880.h" ++ ++#define RT3883_RSTCTRL_FE BIT(21) ++ ++static void rt3883_fe_reset(void) ++{ ++ fe_reset(RT3883_RSTCTRL_FE); ++} ++ ++static int rt3883_fwd_config(struct fe_priv *priv) ++{ ++ int ret; ++ ++ ret = fe_set_clock_cycle(priv); ++ if (ret) ++ return ret; ++ ++ fe_fwd_config(priv); ++ fe_w32(FE_PSE_FQFC_CFG_256Q, FE_PSE_FQ_CFG); ++ fe_csum_config(priv); ++ ++ return ret; ++} ++ ++static void rt3883_init_data(struct fe_soc_data *data, ++ struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ ++ priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_PADDING_BUG | ++ FE_FLAG_JUMBO_FRAME | FE_FLAG_CALIBRATE_CLK; ++ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | ++ NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX; ++} ++ ++static struct fe_soc_data rt3883_data = { ++ .init_data = rt3883_init_data, ++ .reset_fe = rt3883_fe_reset, ++ .fwd_config = rt3883_fwd_config, ++ .pdma_glo_cfg = FE_PDMA_SIZE_8DWORDS, ++ .rx_int = FE_RX_DONE_INT, ++ .tx_int = FE_TX_DONE_INT, ++ .status_int = FE_CNT_GDM_AF, ++ .checksum_bit = RX_DMA_L4VALID, ++ .mdio_read = rt2880_mdio_read, ++ .mdio_write = rt2880_mdio_write, ++ .mdio_adjust_link = rt2880_mdio_link_adjust, ++ .port_init = rt2880_port_init, ++}; ++ ++const struct of_device_id of_fe_match[] = { ++ { .compatible = "ralink,rt3883-eth", .data = &rt3883_data }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_fe_match); diff --git a/target/linux/ramips/patches-4.4/0508-net-next-mediatek-add-support-for-mt7620.patch b/target/linux/ramips/patches-4.4/0508-net-next-mediatek-add-support-for-mt7620.patch new file mode 100644 index 0000000000..04f986cd24 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0508-net-next-mediatek-add-support-for-mt7620.patch @@ -0,0 +1,519 @@ +From 1efca7b539a91c49ab1d6484ec3a69c48fa6062b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 21:25:35 +0100 +Subject: [PATCH 508/513] net-next: mediatek: add support for mt7620 + +Add support for SoCs from the mt7620 family. This include mt7620 and mt7621. +These all have one dedicated external gbit port and a builtin 5 port 100mbit +switch. Additionally one of the 5 switch ports can be changed to become an +additional gbit port that we can attach a phy to. This patch includes +rudimentary code to power up the switch. There are a lot of magic values +that get written to the switch and the internal phys. These values come +straight from the SDK driver. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/mediatek/mdio_mt7620.c | 156 +++++++++++++ + drivers/net/ethernet/mediatek/soc_mt7620.c | 334 +++++++++++++++++++++++++++ + 2 files changed, 490 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/mdio_mt7620.c + create mode 100644 drivers/net/ethernet/mediatek/soc_mt7620.c + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mdio_mt7620.c +@@ -0,0 +1,156 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++ ++#include "mtk_eth_soc.h" ++#include "gsw_mt7620.h" ++#include "mdio.h" ++ ++static int mt7620_mii_busy_wait(struct mt7620_gsw *gsw) ++{ ++ unsigned long t_start = jiffies; ++ ++ while (1) { ++ if (!(mtk_switch_r32(gsw, MT7620A_GSW_REG_PIAC) & GSW_MDIO_ACCESS)) ++ return 0; ++ if (time_after(jiffies, t_start + GSW_REG_PHY_TIMEOUT)) ++ break; ++ } ++ ++ dev_err(gsw->dev, "mdio: MDIO timeout\n"); ++ return -1; ++} ++ ++u32 _mt7620_mii_write(struct mt7620_gsw *gsw, u32 phy_addr, ++ u32 phy_register, u32 write_data) ++{ ++ if (mt7620_mii_busy_wait(gsw)) ++ return -1; ++ ++ write_data &= 0xffff; ++ ++ mtk_switch_w32(gsw, GSW_MDIO_ACCESS | GSW_MDIO_START | GSW_MDIO_WRITE | ++ (phy_register << GSW_MDIO_REG_SHIFT) | ++ (phy_addr << GSW_MDIO_ADDR_SHIFT) | write_data, ++ MT7620A_GSW_REG_PIAC); ++ ++ if (mt7620_mii_busy_wait(gsw)) ++ return -1; ++ ++ return 0; ++} ++ ++u32 _mt7620_mii_read(struct mt7620_gsw *gsw, int phy_addr, int phy_reg) ++{ ++ u32 d; ++ ++ if (mt7620_mii_busy_wait(gsw)) ++ return 0xffff; ++ ++ mtk_switch_w32(gsw, GSW_MDIO_ACCESS | GSW_MDIO_START | GSW_MDIO_READ | ++ (phy_reg << GSW_MDIO_REG_SHIFT) | ++ (phy_addr << GSW_MDIO_ADDR_SHIFT), ++ MT7620A_GSW_REG_PIAC); ++ ++ if (mt7620_mii_busy_wait(gsw)) ++ return 0xffff; ++ ++ d = mtk_switch_r32(gsw, MT7620A_GSW_REG_PIAC) & 0xffff; ++ ++ return d; ++} ++ ++int mt7620_mdio_write(struct mii_bus *bus, int phy_addr, int phy_reg, u16 val) ++{ ++ struct fe_priv *priv = bus->priv; ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ ++ return _mt7620_mii_write(gsw, phy_addr, phy_reg, val); ++} ++ ++int mt7620_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg) ++{ ++ struct fe_priv *priv = bus->priv; ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ ++ return _mt7620_mii_read(gsw, phy_addr, phy_reg); ++} ++ ++void mt7530_mdio_w32(struct mt7620_gsw *gsw, u32 reg, u32 val) ++{ ++ _mt7620_mii_write(gsw, 0x1f, 0x1f, (reg >> 6) & 0x3ff); ++ _mt7620_mii_write(gsw, 0x1f, (reg >> 2) & 0xf, val & 0xffff); ++ _mt7620_mii_write(gsw, 0x1f, 0x10, val >> 16); ++} ++ ++u32 mt7530_mdio_r32(struct mt7620_gsw *gsw, u32 reg) ++{ ++ u16 high, low; ++ ++ _mt7620_mii_write(gsw, 0x1f, 0x1f, (reg >> 6) & 0x3ff); ++ low = _mt7620_mii_read(gsw, 0x1f, (reg >> 2) & 0xf); ++ high = _mt7620_mii_read(gsw, 0x1f, 0x10); ++ ++ return (high << 16) | (low & 0xffff); ++} ++ ++static unsigned char *fe_speed_str(int speed) ++{ ++ switch (speed) { ++ case 2: ++ case SPEED_1000: ++ return "1000"; ++ case 1: ++ case SPEED_100: ++ return "100"; ++ case 0: ++ case SPEED_10: ++ return "10"; ++ } ++ ++ return "? "; ++} ++ ++int mt7620_has_carrier(struct fe_priv *priv) ++{ ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ int i; ++ ++ for (i = 0; i < GSW_PORT6; i++) ++ if (mtk_switch_r32(gsw, GSW_REG_PORT_STATUS(i)) & 0x1) ++ return 1; ++ return 0; ++} ++ ++ ++void mt7620_print_link_state(struct fe_priv *priv, int port, int link, ++ int speed, int duplex) ++{ ++ if (link) ++ netdev_info(priv->netdev, "port %d link up (%sMbps/%s duplex)\n", ++ port, fe_speed_str(speed), ++ (duplex) ? "Full" : "Half"); ++ else ++ netdev_info(priv->netdev, "port %d link down\n", port); ++} ++ ++void mt7620_mdio_link_adjust(struct fe_priv *priv, int port) ++{ ++ mt7620_print_link_state(priv, port, priv->link[port], ++ priv->phy->speed[port], ++ (priv->phy->duplex[port] == DUPLEX_FULL)); ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/soc_mt7620.c +@@ -0,0 +1,334 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include "mtk_eth_soc.h" ++#include "gsw_mt7620.h" ++#include "mt7530.h" ++#include "mdio.h" ++ ++#define MT7620A_CDMA_CSG_CFG 0x400 ++#define MT7620_DMA_VID (MT7620A_CDMA_CSG_CFG | 0x30) ++#define MT7621_CDMP_IG_CTRL (MT7620A_CDMA_CSG_CFG + 0x00) ++#define MT7621_CDMP_EG_CTRL (MT7620A_CDMA_CSG_CFG + 0x04) ++#define MT7620A_RESET_FE BIT(21) ++#define MT7621_RESET_FE BIT(6) ++#define MT7620A_RESET_ESW BIT(23) ++#define MT7620_L4_VALID BIT(23) ++#define MT7621_L4_VALID BIT(24) ++ ++#define MT7620_TX_DMA_UDF BIT(15) ++#define MT7621_TX_DMA_UDF BIT(19) ++#define TX_DMA_FP_BMAP ((0xff) << 19) ++ ++#define CDMA_ICS_EN BIT(2) ++#define CDMA_UCS_EN BIT(1) ++#define CDMA_TCS_EN BIT(0) ++ ++#define GDMA_ICS_EN BIT(22) ++#define GDMA_TCS_EN BIT(21) ++#define GDMA_UCS_EN BIT(20) ++ ++/* frame engine counters */ ++#define MT7620_REG_MIB_OFFSET 0x1000 ++#define MT7620_PPE_AC_BCNT0 (MT7620_REG_MIB_OFFSET + 0x00) ++#define MT7620_GDM1_TX_GBCNT (MT7620_REG_MIB_OFFSET + 0x300) ++#define MT7620_GDM2_TX_GBCNT (MT7620_GDM1_TX_GBCNT + 0x40) ++ ++#define MT7621_REG_MIB_OFFSET 0x2000 ++#define MT7621_PPE_AC_BCNT0 (MT7621_REG_MIB_OFFSET + 0x00) ++#define MT7621_GDM1_TX_GBCNT (MT7621_REG_MIB_OFFSET + 0x400) ++#define MT7621_GDM2_TX_GBCNT (MT7621_GDM1_TX_GBCNT + 0x40) ++ ++#define GSW_REG_GDMA1_MAC_ADRL 0x508 ++#define GSW_REG_GDMA1_MAC_ADRH 0x50C ++ ++#define MT7621_FE_RST_GL (FE_FE_OFFSET + 0x04) ++#define MT7620_FE_INT_STATUS2 (FE_FE_OFFSET + 0x08) ++ ++/* FE_INT_STATUS reg on mt7620 define CNT_GDM1_AF at BIT(29) ++ * but after test it should be BIT(13). ++ */ ++#define MT7620_FE_GDM1_AF BIT(13) ++#define MT7621_FE_GDM1_AF BIT(28) ++#define MT7621_FE_GDM2_AF BIT(29) ++ ++static const u16 mt7620_reg_table[FE_REG_COUNT] = { ++ [FE_REG_PDMA_GLO_CFG] = RT5350_PDMA_GLO_CFG, ++ [FE_REG_PDMA_RST_CFG] = RT5350_PDMA_RST_CFG, ++ [FE_REG_DLY_INT_CFG] = RT5350_DLY_INT_CFG, ++ [FE_REG_TX_BASE_PTR0] = RT5350_TX_BASE_PTR0, ++ [FE_REG_TX_MAX_CNT0] = RT5350_TX_MAX_CNT0, ++ [FE_REG_TX_CTX_IDX0] = RT5350_TX_CTX_IDX0, ++ [FE_REG_TX_DTX_IDX0] = RT5350_TX_DTX_IDX0, ++ [FE_REG_RX_BASE_PTR0] = RT5350_RX_BASE_PTR0, ++ [FE_REG_RX_MAX_CNT0] = RT5350_RX_MAX_CNT0, ++ [FE_REG_RX_CALC_IDX0] = RT5350_RX_CALC_IDX0, ++ [FE_REG_RX_DRX_IDX0] = RT5350_RX_DRX_IDX0, ++ [FE_REG_FE_INT_ENABLE] = RT5350_FE_INT_ENABLE, ++ [FE_REG_FE_INT_STATUS] = RT5350_FE_INT_STATUS, ++ [FE_REG_FE_DMA_VID_BASE] = MT7620_DMA_VID, ++ [FE_REG_FE_COUNTER_BASE] = MT7620_GDM1_TX_GBCNT, ++ [FE_REG_FE_RST_GL] = MT7621_FE_RST_GL, ++ [FE_REG_FE_INT_STATUS2] = MT7620_FE_INT_STATUS2, ++}; ++ ++static int mt7620_gsw_config(struct fe_priv *priv) ++{ ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *) priv->soc->swpriv; ++ ++ /* is the mt7530 internal or external */ ++ if (priv->mii_bus && priv->mii_bus->phy_map[0x1f]) { ++ mt7530_probe(priv->device, gsw->base, NULL, 0); ++ mt7530_probe(priv->device, NULL, priv->mii_bus, 1); ++ } else { ++ mt7530_probe(priv->device, gsw->base, NULL, 1); ++ } ++ ++ return 0; ++} ++ ++static void mt7620_set_mac(struct fe_priv *priv, unsigned char *mac) ++{ ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&priv->page_lock, flags); ++ mtk_switch_w32(gsw, (mac[0] << 8) | mac[1], GSW_REG_SMACCR1); ++ mtk_switch_w32(gsw, (mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | mac[5], ++ GSW_REG_SMACCR0); ++ spin_unlock_irqrestore(&priv->page_lock, flags); ++} ++ ++static void mt7620_auto_poll(struct mt7620_gsw *gsw) ++{ ++ int phy; ++ int lsb = -1, msb = 0; ++ ++ for_each_set_bit(phy, &gsw->autopoll, 32) { ++ if (lsb < 0) ++ lsb = phy; ++ msb = phy; ++ } ++ ++ if (lsb == msb) ++ lsb--; ++ ++ mtk_switch_w32(gsw, PHY_AN_EN | PHY_PRE_EN | PMY_MDC_CONF(5) | ++ (msb << 8) | lsb, ESW_PHY_POLLING); ++} ++ ++static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) ++{ ++ struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; ++ const __be32 *_id = of_get_property(np, "reg", NULL); ++ int phy_mode, size, id; ++ int shift = 12; ++ u32 val, mask = 0; ++ int min = (gsw->port4 == PORT4_EPHY) ? (5) : (4); ++ ++ if (!_id || (be32_to_cpu(*_id) < min) || (be32_to_cpu(*_id) > 5)) { ++ if (_id) ++ pr_err("%s: invalid port id %d\n", np->name, ++ be32_to_cpu(*_id)); ++ else ++ pr_err("%s: invalid port id\n", np->name); ++ return; ++ } ++ ++ id = be32_to_cpu(*_id); ++ ++ if (id == 4) ++ shift = 14; ++ ++ priv->phy->phy_fixed[id] = of_get_property(np, "mediatek,fixed-link", ++ &size); ++ if (priv->phy->phy_fixed[id] && ++ (size != (4 * sizeof(*priv->phy->phy_fixed[id])))) { ++ pr_err("%s: invalid fixed link property\n", np->name); ++ priv->phy->phy_fixed[id] = NULL; ++ return; ++ } ++ ++ phy_mode = of_get_phy_mode(np); ++ switch (phy_mode) { ++ case PHY_INTERFACE_MODE_RGMII: ++ mask = 0; ++ break; ++ case PHY_INTERFACE_MODE_MII: ++ mask = 1; ++ break; ++ case PHY_INTERFACE_MODE_RMII: ++ mask = 2; ++ break; ++ default: ++ dev_err(priv->device, "port %d - invalid phy mode\n", id); ++ return; ++ } ++ ++ priv->phy->phy_node[id] = of_parse_phandle(np, "phy-handle", 0); ++ if (!priv->phy->phy_node[id] && !priv->phy->phy_fixed[id]) ++ return; ++ ++ val = rt_sysc_r32(SYSC_REG_CFG1); ++ val &= ~(3 << shift); ++ val |= mask << shift; ++ rt_sysc_w32(val, SYSC_REG_CFG1); ++ ++ if (priv->phy->phy_fixed[id]) { ++ const __be32 *link = priv->phy->phy_fixed[id]; ++ int tx_fc, rx_fc; ++ u32 val = 0; ++ ++ priv->phy->speed[id] = be32_to_cpup(link++); ++ tx_fc = be32_to_cpup(link++); ++ rx_fc = be32_to_cpup(link++); ++ priv->phy->duplex[id] = be32_to_cpup(link++); ++ priv->link[id] = 1; ++ ++ switch (priv->phy->speed[id]) { ++ case SPEED_10: ++ val = 0; ++ break; ++ case SPEED_100: ++ val = 1; ++ break; ++ case SPEED_1000: ++ val = 2; ++ break; ++ default: ++ dev_err(priv->device, "invalid link speed: %d\n", ++ priv->phy->speed[id]); ++ priv->phy->phy_fixed[id] = 0; ++ return; ++ } ++ val = PMCR_SPEED(val); ++ val |= PMCR_LINK | PMCR_BACKPRES | PMCR_BACKOFF | PMCR_RX_EN | ++ PMCR_TX_EN | PMCR_FORCE | PMCR_MAC_MODE | PMCR_IPG; ++ if (tx_fc) ++ val |= PMCR_TX_FC; ++ if (rx_fc) ++ val |= PMCR_RX_FC; ++ if (priv->phy->duplex[id]) ++ val |= PMCR_DUPLEX; ++ mtk_switch_w32(gsw, val, GSW_REG_PORT_PMCR(id)); ++ dev_info(priv->device, "using fixed link parameters\n"); ++ return; ++ } ++ ++ if (priv->phy->phy_node[id] && priv->mii_bus->phy_map[id]) { ++ u32 val = PMCR_BACKPRES | PMCR_BACKOFF | PMCR_RX_EN | ++ PMCR_TX_EN | PMCR_MAC_MODE | PMCR_IPG; ++ ++ mtk_switch_w32(gsw, val, GSW_REG_PORT_PMCR(id)); ++ fe_connect_phy_node(priv, priv->phy->phy_node[id]); ++ gsw->autopoll |= BIT(id); ++ mt7620_auto_poll(gsw); ++ return; ++ } ++} ++ ++static void mt7620_fe_reset(void) ++{ ++ fe_reset(MT7620A_RESET_FE | MT7620A_RESET_ESW); ++} ++ ++static void mt7620_rxcsum_config(bool enable) ++{ ++ if (enable) ++ fe_w32(fe_r32(MT7620A_GDMA1_FWD_CFG) | (GDMA_ICS_EN | ++ GDMA_TCS_EN | GDMA_UCS_EN), ++ MT7620A_GDMA1_FWD_CFG); ++ else ++ fe_w32(fe_r32(MT7620A_GDMA1_FWD_CFG) & ~(GDMA_ICS_EN | ++ GDMA_TCS_EN | GDMA_UCS_EN), ++ MT7620A_GDMA1_FWD_CFG); ++} ++ ++static void mt7620_txcsum_config(bool enable) ++{ ++ if (enable) ++ fe_w32(fe_r32(MT7620A_CDMA_CSG_CFG) | (CDMA_ICS_EN | ++ CDMA_UCS_EN | CDMA_TCS_EN), ++ MT7620A_CDMA_CSG_CFG); ++ else ++ fe_w32(fe_r32(MT7620A_CDMA_CSG_CFG) & ~(CDMA_ICS_EN | ++ CDMA_UCS_EN | CDMA_TCS_EN), ++ MT7620A_CDMA_CSG_CFG); ++} ++ ++static int mt7620_fwd_config(struct fe_priv *priv) ++{ ++ struct net_device *dev = priv_netdev(priv); ++ ++ fe_w32(fe_r32(MT7620A_GDMA1_FWD_CFG) & ~7, MT7620A_GDMA1_FWD_CFG); ++ ++ mt7620_txcsum_config((dev->features & NETIF_F_IP_CSUM)); ++ mt7620_rxcsum_config((dev->features & NETIF_F_RXCSUM)); ++ ++ return 0; ++} ++ ++static void mt7620_tx_dma(struct fe_tx_dma *txd) ++{ ++} ++ ++static void mt7620_init_data(struct fe_soc_data *data, ++ struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ ++ priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET | ++ FE_FLAG_RX_SG_DMA | FE_FLAG_HAS_SWITCH; ++ ++ netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | ++ NETIF_F_HW_VLAN_CTAG_TX; ++ if (mt7620_get_eco() >= 5) ++ netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | ++ NETIF_F_IPV6_CSUM; ++} ++ ++static struct fe_soc_data mt7620_data = { ++ .init_data = mt7620_init_data, ++ .reset_fe = mt7620_fe_reset, ++ .set_mac = mt7620_set_mac, ++ .fwd_config = mt7620_fwd_config, ++ .tx_dma = mt7620_tx_dma, ++ .switch_init = mtk_gsw_init, ++ .port_init = mt7620_port_init, ++ .reg_table = mt7620_reg_table, ++ .pdma_glo_cfg = FE_PDMA_SIZE_16DWORDS, ++ .rx_int = RT5350_RX_DONE_INT, ++ .tx_int = RT5350_TX_DONE_INT, ++ .status_int = MT7620_FE_GDM1_AF, ++ .checksum_bit = MT7620_L4_VALID, ++ .has_carrier = mt7620_has_carrier, ++ .mdio_read = mt7620_mdio_read, ++ .mdio_write = mt7620_mdio_write, ++ .mdio_adjust_link = mt7620_mdio_link_adjust, ++}; ++ ++const struct of_device_id of_fe_match[] = { ++ { .compatible = "mediatek,mt7620-eth", .data = &mt7620_data }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_fe_match); diff --git a/target/linux/ramips/patches-4.4/0509-net-next-mediatek-add-support-for-mt7621.patch b/target/linux/ramips/patches-4.4/0509-net-next-mediatek-add-support-for-mt7621.patch new file mode 100644 index 0000000000..6920545f0c --- /dev/null +++ b/target/linux/ramips/patches-4.4/0509-net-next-mediatek-add-support-for-mt7621.patch @@ -0,0 +1,209 @@ +From 107ff718dad1c8f6abbf6247d6796a4535b71276 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 23:50:53 +0100 +Subject: [PATCH 509/513] net-next: mediatek: add support for mt7621 + +Add support for SoCs from the mt7620 family. This include mt7620 and mt7621. +These all have one dedicated external gbit port and a builtin 5 port 100mbit +switch. Additionally one of the 5 switch ports can be changed to become an +additional gbit port that we can attach a phy to. This patch includes +rudimentary code to power up the switch. There are a lot of magic values +that get written to the switch and the internal phys. These values come +straight from the SDK driver. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/mediatek/soc_mt7621.c | 186 ++++++++++++++++++++++++++++ + 1 file changed, 186 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/soc_mt7621.c + +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/soc_mt7621.c +@@ -0,0 +1,185 @@ ++/* 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. ++ * ++ * Copyright (C) 2009-2015 John Crispin ++ * Copyright (C) 2009-2015 Felix Fietkau ++ * Copyright (C) 2013-2015 Michael Lee ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "mtk_eth_soc.h" ++#include "gsw_mt7620.h" ++#include "mt7530.h" ++#include "mdio.h" ++ ++#define MT7620A_CDMA_CSG_CFG 0x400 ++#define MT7621_CDMP_IG_CTRL (MT7620A_CDMA_CSG_CFG + 0x00) ++#define MT7621_CDMP_EG_CTRL (MT7620A_CDMA_CSG_CFG + 0x04) ++#define MT7621_RESET_FE BIT(6) ++#define MT7621_L4_VALID BIT(24) ++ ++#define MT7621_TX_DMA_UDF BIT(19) ++#define MT7621_TX_DMA_FPORT BIT(25) ++ ++#define CDMA_ICS_EN BIT(2) ++#define CDMA_UCS_EN BIT(1) ++#define CDMA_TCS_EN BIT(0) ++ ++#define GDMA_ICS_EN BIT(22) ++#define GDMA_TCS_EN BIT(21) ++#define GDMA_UCS_EN BIT(20) ++ ++/* frame engine counters */ ++#define MT7621_REG_MIB_OFFSET 0x2000 ++#define MT7621_PPE_AC_BCNT0 (MT7621_REG_MIB_OFFSET + 0x00) ++#define MT7621_GDM1_TX_GBCNT (MT7621_REG_MIB_OFFSET + 0x400) ++#define MT7621_GDM2_TX_GBCNT (MT7621_GDM1_TX_GBCNT + 0x40) ++ ++#define GSW_REG_GDMA1_MAC_ADRL 0x508 ++#define GSW_REG_GDMA1_MAC_ADRH 0x50C ++ ++#define MT7621_FE_RST_GL (FE_FE_OFFSET + 0x04) ++#define MT7620_FE_INT_STATUS2 (FE_FE_OFFSET + 0x08) ++ ++/* FE_INT_STATUS reg on mt7620 define CNT_GDM1_AF at BIT(29) ++ * but after test it should be BIT(13). ++ */ ++#define MT7620_FE_GDM1_AF BIT(13) ++#define MT7621_FE_GDM1_AF BIT(28) ++#define MT7621_FE_GDM2_AF BIT(29) ++ ++static const u16 mt7621_reg_table[FE_REG_COUNT] = { ++ [FE_REG_PDMA_GLO_CFG] = RT5350_PDMA_GLO_CFG, ++ [FE_REG_PDMA_RST_CFG] = RT5350_PDMA_RST_CFG, ++ [FE_REG_DLY_INT_CFG] = RT5350_DLY_INT_CFG, ++ [FE_REG_TX_BASE_PTR0] = RT5350_TX_BASE_PTR0, ++ [FE_REG_TX_MAX_CNT0] = RT5350_TX_MAX_CNT0, ++ [FE_REG_TX_CTX_IDX0] = RT5350_TX_CTX_IDX0, ++ [FE_REG_TX_DTX_IDX0] = RT5350_TX_DTX_IDX0, ++ [FE_REG_RX_BASE_PTR0] = RT5350_RX_BASE_PTR0, ++ [FE_REG_RX_MAX_CNT0] = RT5350_RX_MAX_CNT0, ++ [FE_REG_RX_CALC_IDX0] = RT5350_RX_CALC_IDX0, ++ [FE_REG_RX_DRX_IDX0] = RT5350_RX_DRX_IDX0, ++ [FE_REG_FE_INT_ENABLE] = RT5350_FE_INT_ENABLE, ++ [FE_REG_FE_INT_STATUS] = RT5350_FE_INT_STATUS, ++ [FE_REG_FE_DMA_VID_BASE] = 0, ++ [FE_REG_FE_COUNTER_BASE] = MT7621_GDM1_TX_GBCNT, ++ [FE_REG_FE_RST_GL] = MT7621_FE_RST_GL, ++ [FE_REG_FE_INT_STATUS2] = MT7620_FE_INT_STATUS2, ++}; ++ ++static int mt7621_gsw_config(struct fe_priv *priv) ++{ ++ if (priv->mii_bus && priv->mii_bus->phy_map[0x1f]) ++ mt7530_probe(priv->device, NULL, priv->mii_bus, 1); ++ ++ return 0; ++} ++ ++static void mt7621_fe_reset(void) ++{ ++ fe_reset(MT7621_RESET_FE); ++} ++ ++static void mt7621_rxcsum_config(bool enable) ++{ ++ if (enable) ++ fe_w32(fe_r32(MT7620A_GDMA1_FWD_CFG) | (GDMA_ICS_EN | ++ GDMA_TCS_EN | GDMA_UCS_EN), ++ MT7620A_GDMA1_FWD_CFG); ++ else ++ fe_w32(fe_r32(MT7620A_GDMA1_FWD_CFG) & ~(GDMA_ICS_EN | ++ GDMA_TCS_EN | GDMA_UCS_EN), ++ MT7620A_GDMA1_FWD_CFG); ++} ++ ++static void mt7621_rxvlan_config(bool enable) ++{ ++ if (enable) ++ fe_w32(1, MT7621_CDMP_EG_CTRL); ++ else ++ fe_w32(0, MT7621_CDMP_EG_CTRL); ++} ++ ++static int mt7621_fwd_config(struct fe_priv *priv) ++{ ++ struct net_device *dev = priv_netdev(priv); ++ ++ fe_w32(fe_r32(MT7620A_GDMA1_FWD_CFG) & ~0xffff, ++ MT7620A_GDMA1_FWD_CFG); ++ ++ /* mt7621 doesn't have txcsum config */ ++ mt7621_rxcsum_config((dev->features & NETIF_F_RXCSUM)); ++ mt7621_rxvlan_config(priv->flags & FE_FLAG_RX_VLAN_CTAG); ++ ++ return 0; ++} ++ ++static void mt7621_tx_dma(struct fe_tx_dma *txd) ++{ ++ txd->txd4 = MT7621_TX_DMA_FPORT; ++} ++ ++static void mt7621_init_data(struct fe_soc_data *data, ++ struct net_device *netdev) ++{ ++ struct fe_priv *priv = netdev_priv(netdev); ++ ++ priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET | ++ FE_FLAG_RX_SG_DMA | FE_FLAG_NAPI_WEIGHT | ++ FE_FLAG_HAS_SWITCH; ++ ++ 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; ++} ++ ++static void mt7621_set_mac(struct fe_priv *priv, unsigned char *mac) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&priv->page_lock, flags); ++ fe_w32((mac[0] << 8) | mac[1], GSW_REG_GDMA1_MAC_ADRH); ++ fe_w32((mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | mac[5], ++ GSW_REG_GDMA1_MAC_ADRL); ++ spin_unlock_irqrestore(&priv->page_lock, flags); ++} ++ ++static struct fe_soc_data mt7621_data = { ++ .init_data = mt7621_init_data, ++ .reset_fe = mt7621_fe_reset, ++ .set_mac = mt7621_set_mac, ++ .fwd_config = mt7621_fwd_config, ++ .tx_dma = mt7621_tx_dma, ++ .switch_init = mtk_gsw_init, ++ .switch_config = mt7621_gsw_config, ++ .reg_table = mt7621_reg_table, ++ .pdma_glo_cfg = FE_PDMA_SIZE_16DWORDS, ++ .rx_int = RT5350_RX_DONE_INT, ++ .tx_int = RT5350_TX_DONE_INT, ++ .status_int = (MT7621_FE_GDM1_AF | MT7621_FE_GDM2_AF), ++ .checksum_bit = MT7621_L4_VALID, ++ .has_carrier = mt7620_has_carrier, ++ .mdio_read = mt7620_mdio_read, ++ .mdio_write = mt7620_mdio_write, ++ .mdio_adjust_link = mt7620_mdio_link_adjust, ++}; ++ ++const struct of_device_id of_fe_match[] = { ++ { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_fe_match); diff --git a/target/linux/ramips/patches-4.4/0510-net-next-mediatek-add-Kconfig-and-Makefile.patch b/target/linux/ramips/patches-4.4/0510-net-next-mediatek-add-Kconfig-and-Makefile.patch new file mode 100644 index 0000000000..4519eb67d5 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0510-net-next-mediatek-add-Kconfig-and-Makefile.patch @@ -0,0 +1,127 @@ +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/mediatek/Kconfig | 62 ++++++++++++++++++++++++++++++++ + drivers/net/ethernet/mediatek/Makefile | 20 +++++++++++ + 4 files changed, 84 insertions(+) + create mode 100644 drivers/net/ethernet/mediatek/Kconfig + create mode 100644 drivers/net/ethernet/mediatek/Makefile + +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -106,6 +106,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/mellanox/Kconfig" + source "drivers/net/ethernet/micrel/Kconfig" + source "drivers/net/ethernet/microchip/Kconfig" +--- a/drivers/net/ethernet/Makefile ++++ b/drivers/net/ethernet/Makefile +@@ -46,6 +46,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_MELLANOX) += mellanox/ + obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/ + obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/ +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/Kconfig +@@ -0,0 +1,62 @@ ++config NET_VENDOR_MEDIATEK ++ tristate "Mediatek/Ralink ethernet driver" ++ depends on RALINK ++ help ++ This driver supports the ethernet mac inside the Mediatek and Ralink WiSoCs ++ ++config NET_MEDIATEK_SOC ++ def_tristate NET_VENDOR_MEDIATEK ++ ++if NET_MEDIATEK_SOC ++choice ++ prompt "MAC type" ++ ++config NET_MEDIATEK_RT2880 ++ bool "RT2882" ++ depends on MIPS && SOC_RT288X ++ ++config NET_MEDIATEK_RT3050 ++ bool "RT3050/MT7628" ++ depends on MIPS && (SOC_RT305X || SOC_MT7620) ++ ++config NET_MEDIATEK_RT3883 ++ bool "RT3883" ++ depends on MIPS && SOC_RT3883 ++ ++config NET_MEDIATEK_MT7620 ++ bool "MT7620" ++ depends on MIPS && SOC_MT7620 ++ ++config NET_MEDIATEK_MT7621 ++ bool "MT7621" ++ depends on MIPS && SOC_MT7621 ++ ++endchoice ++ ++config NET_MEDIATEK_MDIO ++ def_bool NET_MEDIATEK_SOC ++ depends on (NET_MEDIATEK_RT2880 || NET_MEDIATEK_RT3883 || NET_MEDIATEK_MT7620 || NET_MEDIATEK_MT7621) ++ select PHYLIB ++ ++config NET_MEDIATEK_MDIO_RT2880 ++ def_bool NET_MEDIATEK_SOC ++ depends on (NET_MEDIATEK_RT2880 || NET_MEDIATEK_RT3883) ++ select NET_MEDIATEK_MDIO ++ ++config NET_MEDIATEK_MDIO_MT7620 ++ def_bool NET_MEDIATEK_SOC ++ depends on (NET_MEDIATEK_MT7620 || NET_MEDIATEK_MT7621) ++ select NET_MEDIATEK_MDIO ++ ++config NET_MEDIATEK_ESW_RT3050 ++ def_tristate NET_MEDIATEK_SOC ++ depends on NET_MEDIATEK_RT3050 ++ ++config NET_MEDIATEK_GSW_MT7620 ++ def_tristate NET_MEDIATEK_SOC ++ depends on NET_MEDIATEK_MT7620 ++ ++config NET_MEDIATEK_GSW_MT7621 ++ def_tristate NET_MEDIATEK_SOC ++ depends on NET_MEDIATEK_MT7621 ++endif +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -0,0 +1,20 @@ ++# ++# Makefile for the Ralink SoCs built-in ethernet macs ++# ++ ++mtk-eth-soc-y += mtk_eth_soc.o ethtool.o ++ ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MDIO) += mdio.o ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MDIO_RT2880) += mdio_rt2880.o ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MDIO_MT7620) += mdio_mt7620.o ++ ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_RT2880) += soc_rt2880.o ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_RT3050) += soc_rt3050.o ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_RT3883) += soc_rt3883.o ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MT7620) += soc_mt7620.o ++mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MT7621) += soc_mt7621.o ++ ++obj-$(CONFIG_NET_MEDIATEK_ESW_RT3050) += esw_rt3050.o ++obj-$(CONFIG_NET_MEDIATEK_GSW_MT7620) += gsw_mt7620.o ++obj-$(CONFIG_NET_MEDIATEK_GSW_MT7621) += gsw_mt7621.o ++obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk-eth-soc.o diff --git a/target/linux/ramips/patches-4.4/0511-net-mediatek-add-support-for-the-multiphy-carrier-pa.patch b/target/linux/ramips/patches-4.4/0511-net-mediatek-add-support-for-the-multiphy-carrier-pa.patch new file mode 100644 index 0000000000..4d5c2d8744 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0511-net-mediatek-add-support-for-the-multiphy-carrier-pa.patch @@ -0,0 +1,80 @@ +From 6543b4cef96c12903f5ec5c015cd223a6b3c9a33 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 21:16:59 +0100 +Subject: [PATCH 511/513] net: mediatek: add support for the multiphy carrier + patch + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/gsw_mt7620.c | 1 + + drivers/net/ethernet/mediatek/gsw_mt7620.h | 1 + + drivers/net/ethernet/mediatek/gsw_mt7621.c | 1 + + drivers/net/ethernet/mediatek/mdio.c | 1 + + drivers/net/ethernet/mediatek/mdio_mt7620.c | 12 ++++++++++++ + 5 files changed, 16 insertions(+) + +--- a/drivers/net/ethernet/mediatek/gsw_mt7620.c ++++ b/drivers/net/ethernet/mediatek/gsw_mt7620.c +@@ -54,6 +54,7 @@ static irqreturn_t gsw_interrupt_mt7620( + + priv->link[i] = link; + } ++ mt7620_handle_carrier(priv); + mtk_switch_w32(gsw, status, GSW_REG_ISR); + + return IRQ_HANDLED; +--- a/drivers/net/ethernet/mediatek/gsw_mt7620.h ++++ b/drivers/net/ethernet/mediatek/gsw_mt7620.h +@@ -113,5 +113,6 @@ u32 mt7530_mdio_r32(struct mt7620_gsw *g + u32 _mt7620_mii_write(struct mt7620_gsw *gsw, u32 phy_addr, + u32 phy_register, u32 write_data); + u32 _mt7620_mii_read(struct mt7620_gsw *gsw, int phy_addr, int phy_reg); ++void mt7620_handle_carrier(struct fe_priv *priv); + + #endif +--- a/drivers/net/ethernet/mediatek/gsw_mt7621.c ++++ b/drivers/net/ethernet/mediatek/gsw_mt7621.c +@@ -60,6 +60,7 @@ static irqreturn_t gsw_interrupt_mt7621( + } + } + ++ mt7620_handle_carrier(priv); + mt7530_mdio_w32(gsw, 0x700c, 0x1f); + + return IRQ_HANDLED; +--- a/drivers/net/ethernet/mediatek/mdio.c ++++ b/drivers/net/ethernet/mediatek/mdio.c +@@ -89,6 +89,7 @@ int fe_connect_phy_node(struct fe_priv * + + phydev->supported &= PHY_GBIT_FEATURES; + phydev->advertising = phydev->supported; ++ phydev->no_auto_carrier_off = 1; + + dev_info(priv->device, + "connected port %d to PHY at %s [uid=%08x, driver=%s]\n", +--- a/drivers/net/ethernet/mediatek/mdio_mt7620.c ++++ b/drivers/net/ethernet/mediatek/mdio_mt7620.c +@@ -137,6 +137,17 @@ int mt7620_has_carrier(struct fe_priv *p + } + + ++void mt7620_handle_carrier(struct fe_priv *priv) ++{ ++ if (!priv->phy) ++ return; ++ ++ if (mt7620_has_carrier(priv)) ++ netif_carrier_on(priv->netdev); ++ else ++ netif_carrier_off(priv->netdev); ++} ++ + void mt7620_print_link_state(struct fe_priv *priv, int port, int link, + int speed, int duplex) + { +@@ -153,4 +164,5 @@ void mt7620_mdio_link_adjust(struct fe_p + mt7620_print_link_state(priv, port, priv->link[port], + priv->phy->speed[port], + (priv->phy->duplex[port] == DUPLEX_FULL)); ++ mt7620_handle_carrier(priv); + } diff --git a/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch b/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch new file mode 100644 index 0000000000..5d0072fe1e --- /dev/null +++ b/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch @@ -0,0 +1,901 @@ +From 4473f30809eed09037e1932a0c1805172cd997f7 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 22:07:31 +0100 +Subject: [PATCH 512/513] net: mediatek: add swconfig driver for esw_rt3050 + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/esw_rt3050.c | 805 ++++++++++++++++++++++++++++ + 1 file changed, 805 insertions(+) + +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -17,6 +17,8 @@ + #include + #include + ++#include ++ + #include "mtk_eth_soc.h" + + /* HW limitations for this switch: +@@ -141,6 +143,8 @@ + #define RT305X_ESW_PORT5 5 + #define RT305X_ESW_PORT6 6 + ++#define RT305X_ESW_PORTS_NONE 0 ++ + #define RT305X_ESW_PMAP_LLLLLL 0x3f + #define RT305X_ESW_PMAP_LLLLWL 0x2f + #define RT305X_ESW_PMAP_WLLLLL 0x3e +@@ -158,15 +162,51 @@ + #define RT305X_ESW_PORTS_ALL \ + (RT305X_ESW_PORTS_NOCPU | RT305X_ESW_PORTS_CPU) + ++#define RT305X_ESW_NUM_VLANS 16 ++#define RT305X_ESW_NUM_VIDS 4096 + #define RT305X_ESW_NUM_PORTS 7 ++#define RT305X_ESW_NUM_LANWAN 6 + #define RT305X_ESW_NUM_LEDS 5 + ++#define RT5350_ESW_REG_PXTPC(_x) (0x150 + (4 * _x)) + #define RT5350_EWS_REG_LED_POLARITY 0x168 + #define RT5350_RESET_EPHY BIT(24) + ++enum { ++ /* Global attributes. */ ++ RT305X_ESW_ATTR_ENABLE_VLAN, ++ RT305X_ESW_ATTR_ALT_VLAN_DISABLE, ++ RT305X_ESW_ATTR_BC_STATUS, ++ RT305X_ESW_ATTR_LED_FREQ, ++ /* Port attributes. */ ++ RT305X_ESW_ATTR_PORT_DISABLE, ++ RT305X_ESW_ATTR_PORT_DOUBLETAG, ++ RT305X_ESW_ATTR_PORT_UNTAG, ++ RT305X_ESW_ATTR_PORT_LED, ++ RT305X_ESW_ATTR_PORT_LAN, ++ RT305X_ESW_ATTR_PORT_RECV_BAD, ++ RT305X_ESW_ATTR_PORT_RECV_GOOD, ++ RT5350_ESW_ATTR_PORT_TR_BAD, ++ RT5350_ESW_ATTR_PORT_TR_GOOD, ++}; ++ + struct esw_port { + bool disable; ++ bool doubletag; ++ bool untag; + u8 led; ++ u16 pvid; ++}; ++ ++struct esw_vlan { ++ u8 ports; ++ u16 vid; ++}; ++ ++enum { ++ RT305X_ESW_VLAN_CONFIG_NONE = 0, ++ RT305X_ESW_VLAN_CONFIG_LLLLW, ++ RT305X_ESW_VLAN_CONFIG_WLLLL, + }; + + struct rt305x_esw { +@@ -180,6 +220,12 @@ struct rt305x_esw { + unsigned char port_map; + unsigned int reg_led_polarity; + ++ struct switch_dev swdev; ++ bool global_vlan_enable; ++ bool alt_vlan_disable; ++ int bc_storm_protect; ++ int led_frequency; ++ struct esw_vlan vlans[RT305X_ESW_NUM_VLANS]; + struct esw_port ports[RT305X_ESW_NUM_PORTS]; + + }; +@@ -252,6 +298,71 @@ out: + return ret; + } + ++static unsigned esw_get_vlan_id(struct rt305x_esw *esw, unsigned vlan) ++{ ++ unsigned s; ++ unsigned val; ++ ++ s = RT305X_ESW_VLANI_VID_S * (vlan % 2); ++ val = esw_r32(esw, RT305X_ESW_REG_VLANI(vlan / 2)); ++ val = (val >> s) & RT305X_ESW_VLANI_VID_M; ++ ++ return val; ++} ++ ++static void esw_set_vlan_id(struct rt305x_esw *esw, unsigned vlan, unsigned vid) ++{ ++ unsigned s; ++ ++ s = RT305X_ESW_VLANI_VID_S * (vlan % 2); ++ esw_rmw(esw, ++ RT305X_ESW_REG_VLANI(vlan / 2), ++ RT305X_ESW_VLANI_VID_M << s, ++ (vid & RT305X_ESW_VLANI_VID_M) << s); ++} ++ ++static unsigned esw_get_pvid(struct rt305x_esw *esw, unsigned port) ++{ ++ unsigned s, val; ++ ++ s = RT305X_ESW_PVIDC_PVID_S * (port % 2); ++ val = esw_r32(esw, RT305X_ESW_REG_PVIDC(port / 2)); ++ return (val >> s) & RT305X_ESW_PVIDC_PVID_M; ++} ++ ++static void esw_set_pvid(struct rt305x_esw *esw, unsigned port, unsigned pvid) ++{ ++ unsigned s; ++ ++ s = RT305X_ESW_PVIDC_PVID_S * (port % 2); ++ esw_rmw(esw, ++ RT305X_ESW_REG_PVIDC(port / 2), ++ RT305X_ESW_PVIDC_PVID_M << s, ++ (pvid & RT305X_ESW_PVIDC_PVID_M) << s); ++} ++ ++static unsigned esw_get_vmsc(struct rt305x_esw *esw, unsigned vlan) ++{ ++ unsigned s, val; ++ ++ s = RT305X_ESW_VMSC_MSC_S * (vlan % 4); ++ val = esw_r32(esw, RT305X_ESW_REG_VMSC(vlan / 4)); ++ val = (val >> s) & RT305X_ESW_VMSC_MSC_M; ++ ++ return val; ++} ++ ++static void esw_set_vmsc(struct rt305x_esw *esw, unsigned vlan, unsigned msc) ++{ ++ unsigned s; ++ ++ s = RT305X_ESW_VMSC_MSC_S * (vlan % 4); ++ esw_rmw(esw, ++ RT305X_ESW_REG_VMSC(vlan / 4), ++ RT305X_ESW_VMSC_MSC_M << s, ++ (msc & RT305X_ESW_VMSC_MSC_M) << s); ++} ++ + static unsigned esw_get_port_disable(struct rt305x_esw *esw) + { + unsigned reg; +@@ -261,6 +372,59 @@ static unsigned esw_get_port_disable(str + RT305X_ESW_POC0_DIS_PORT_M; + } + ++static void esw_set_port_disable(struct rt305x_esw *esw, unsigned disable_mask) ++{ ++ unsigned old_mask; ++ unsigned enable_mask; ++ unsigned changed; ++ int i; ++ ++ old_mask = esw_get_port_disable(esw); ++ changed = old_mask ^ disable_mask; ++ enable_mask = old_mask & disable_mask; ++ ++ /* enable before writing to MII */ ++ esw_rmw(esw, RT305X_ESW_REG_POC0, ++ (RT305X_ESW_POC0_DIS_PORT_M << ++ RT305X_ESW_POC0_DIS_PORT_S), ++ enable_mask << RT305X_ESW_POC0_DIS_PORT_S); ++ ++ for (i = 0; i < RT305X_ESW_NUM_LEDS; i++) { ++ if (!(changed & (1 << i))) ++ continue; ++ if (disable_mask & (1 << i)) { ++ /* disable */ ++ rt305x_mii_write(esw, i, MII_BMCR, ++ BMCR_PDOWN); ++ } else { ++ /* enable */ ++ rt305x_mii_write(esw, i, MII_BMCR, ++ BMCR_FULLDPLX | ++ BMCR_ANENABLE | ++ BMCR_ANRESTART | ++ BMCR_SPEED100); ++ } ++ } ++ ++ /* disable after writing to MII */ ++ esw_rmw(esw, RT305X_ESW_REG_POC0, ++ (RT305X_ESW_POC0_DIS_PORT_M << ++ RT305X_ESW_POC0_DIS_PORT_S), ++ disable_mask << RT305X_ESW_POC0_DIS_PORT_S); ++} ++ ++static void esw_set_gsc(struct rt305x_esw *esw) ++{ ++ esw_rmw(esw, RT305X_ESW_REG_SGC, ++ RT305X_ESW_GSC_BC_STROM_MASK << RT305X_ESW_GSC_BC_STROM_SHIFT, ++ esw->bc_storm_protect << RT305X_ESW_GSC_BC_STROM_SHIFT); ++ esw_rmw(esw, RT305X_ESW_REG_SGC, ++ RT305X_ESW_GSC_LED_FREQ_MASK << RT305X_ESW_GSC_LED_FREQ_SHIFT, ++ esw->led_frequency << RT305X_ESW_GSC_LED_FREQ_SHIFT); ++} ++ ++static int esw_apply_config(struct switch_dev *dev); ++ + static void esw_hw_init(struct rt305x_esw *esw) + { + int i; +@@ -519,6 +683,9 @@ static void esw_hw_init(struct rt305x_es + for (i = 0; i < RT305X_ESW_NUM_LEDS; i++) + esw->ports[i].led = 0x05; + ++ /* Apply the empty config. */ ++ esw_apply_config(&esw->swdev); ++ + /* Only unmask the port change interrupt */ + esw_w32(esw, ~RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_IMR); + } +@@ -541,11 +708,629 @@ static irqreturn_t esw_interrupt(int irq + return IRQ_HANDLED; + } + ++static int esw_apply_config(struct switch_dev *dev) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int i; ++ u8 disable = 0; ++ u8 doubletag = 0; ++ u8 en_vlan = 0; ++ u8 untag = 0; ++ ++ for (i = 0; i < RT305X_ESW_NUM_VLANS; i++) { ++ u32 vid, vmsc; ++ if (esw->global_vlan_enable) { ++ vid = esw->vlans[i].vid; ++ vmsc = esw->vlans[i].ports; ++ } else { ++ vid = RT305X_ESW_VLAN_NONE; ++ vmsc = RT305X_ESW_PORTS_NONE; ++ } ++ esw_set_vlan_id(esw, i, vid); ++ esw_set_vmsc(esw, i, vmsc); ++ } ++ ++ for (i = 0; i < RT305X_ESW_NUM_PORTS; i++) { ++ u32 pvid; ++ disable |= esw->ports[i].disable << i; ++ if (esw->global_vlan_enable) { ++ doubletag |= esw->ports[i].doubletag << i; ++ en_vlan |= 1 << i; ++ untag |= esw->ports[i].untag << i; ++ pvid = esw->ports[i].pvid; ++ } else { ++ int x = esw->alt_vlan_disable ? 0 : 1; ++ doubletag |= x << i; ++ en_vlan |= x << i; ++ untag |= x << i; ++ pvid = 0; ++ } ++ esw_set_pvid(esw, i, pvid); ++ if (i < RT305X_ESW_NUM_LEDS) ++ esw_w32(esw, esw->ports[i].led, ++ RT305X_ESW_REG_P0LED + 4*i); ++ } ++ ++ esw_set_gsc(esw); ++ esw_set_port_disable(esw, disable); ++ esw_rmw(esw, RT305X_ESW_REG_SGC2, ++ (RT305X_ESW_SGC2_DOUBLE_TAG_M << ++ RT305X_ESW_SGC2_DOUBLE_TAG_S), ++ doubletag << RT305X_ESW_SGC2_DOUBLE_TAG_S); ++ esw_rmw(esw, RT305X_ESW_REG_PFC1, ++ RT305X_ESW_PFC1_EN_VLAN_M << RT305X_ESW_PFC1_EN_VLAN_S, ++ en_vlan << RT305X_ESW_PFC1_EN_VLAN_S); ++ esw_rmw(esw, RT305X_ESW_REG_POC2, ++ RT305X_ESW_POC2_UNTAG_EN_M << RT305X_ESW_POC2_UNTAG_EN_S, ++ untag << RT305X_ESW_POC2_UNTAG_EN_S); ++ ++ if (!esw->global_vlan_enable) { ++ /* ++ * Still need to put all ports into vlan 0 or they'll be ++ * isolated. ++ * NOTE: vlan 0 is special, no vlan tag is prepended ++ */ ++ esw_set_vlan_id(esw, 0, 0); ++ esw_set_vmsc(esw, 0, RT305X_ESW_PORTS_ALL); ++ } ++ ++ return 0; ++} ++ ++static int esw_reset_switch(struct switch_dev *dev) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ esw->global_vlan_enable = 0; ++ memset(esw->ports, 0, sizeof(esw->ports)); ++ memset(esw->vlans, 0, sizeof(esw->vlans)); ++ esw_hw_init(esw); ++ ++ return 0; ++} ++ ++static int esw_get_vlan_enable(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ val->value.i = esw->global_vlan_enable; ++ ++ return 0; ++} ++ ++static int esw_set_vlan_enable(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ esw->global_vlan_enable = val->value.i != 0; ++ ++ return 0; ++} ++ ++static int esw_get_alt_vlan_disable(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ val->value.i = esw->alt_vlan_disable; ++ ++ return 0; ++} ++ ++static int esw_set_alt_vlan_disable(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ esw->alt_vlan_disable = val->value.i != 0; ++ ++ return 0; ++} ++ ++static int ++rt305x_esw_set_bc_status(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ esw->bc_storm_protect = val->value.i & RT305X_ESW_GSC_BC_STROM_MASK; ++ ++ return 0; ++} ++ ++static int ++rt305x_esw_get_bc_status(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ val->value.i = esw->bc_storm_protect; ++ ++ return 0; ++} ++ ++static int ++rt305x_esw_set_led_freq(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ esw->led_frequency = val->value.i & RT305X_ESW_GSC_LED_FREQ_MASK; ++ ++ return 0; ++} ++ ++static int ++rt305x_esw_get_led_freq(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ val->value.i = esw->led_frequency; ++ ++ return 0; ++} ++ ++static int esw_get_port_link(struct switch_dev *dev, ++ int port, ++ struct switch_port_link *link) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ u32 speed, poa; ++ ++ if (port < 0 || port >= RT305X_ESW_NUM_PORTS) ++ return -EINVAL; ++ ++ poa = esw_r32(esw, RT305X_ESW_REG_POA) >> port; ++ ++ link->link = (poa >> RT305X_ESW_LINK_S) & 1; ++ link->duplex = (poa >> RT305X_ESW_DUPLEX_S) & 1; ++ if (port < RT305X_ESW_NUM_LEDS) { ++ speed = (poa >> RT305X_ESW_SPD_S) & 1; ++ } else { ++ if (port == RT305X_ESW_NUM_PORTS - 1) ++ poa >>= 1; ++ speed = (poa >> RT305X_ESW_SPD_S) & 3; ++ } ++ switch (speed) { ++ case 0: ++ link->speed = SWITCH_PORT_SPEED_10; ++ break; ++ case 1: ++ link->speed = SWITCH_PORT_SPEED_100; ++ break; ++ case 2: ++ case 3: /* forced gige speed can be 2 or 3 */ ++ link->speed = SWITCH_PORT_SPEED_1000; ++ break; ++ default: ++ link->speed = SWITCH_PORT_SPEED_UNKNOWN; ++ break; ++ } ++ ++ return 0; ++} ++ ++static int esw_get_port_bool(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int idx = val->port_vlan; ++ u32 x, reg, shift; ++ ++ if (idx < 0 || idx >= RT305X_ESW_NUM_PORTS) ++ return -EINVAL; ++ ++ switch (attr->id) { ++ case RT305X_ESW_ATTR_PORT_DISABLE: ++ reg = RT305X_ESW_REG_POC0; ++ shift = RT305X_ESW_POC0_DIS_PORT_S; ++ break; ++ case RT305X_ESW_ATTR_PORT_DOUBLETAG: ++ reg = RT305X_ESW_REG_SGC2; ++ shift = RT305X_ESW_SGC2_DOUBLE_TAG_S; ++ break; ++ case RT305X_ESW_ATTR_PORT_UNTAG: ++ reg = RT305X_ESW_REG_POC2; ++ shift = RT305X_ESW_POC2_UNTAG_EN_S; ++ break; ++ case RT305X_ESW_ATTR_PORT_LAN: ++ reg = RT305X_ESW_REG_SGC2; ++ shift = RT305X_ESW_SGC2_LAN_PMAP_S; ++ if (idx >= RT305X_ESW_NUM_LANWAN) ++ return -EINVAL; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ x = esw_r32(esw, reg); ++ val->value.i = (x >> (idx + shift)) & 1; ++ ++ return 0; ++} ++ ++static int esw_set_port_bool(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int idx = val->port_vlan; ++ ++ if (idx < 0 || idx >= RT305X_ESW_NUM_PORTS || ++ val->value.i < 0 || val->value.i > 1) ++ return -EINVAL; ++ ++ switch (attr->id) { ++ case RT305X_ESW_ATTR_PORT_DISABLE: ++ esw->ports[idx].disable = val->value.i; ++ break; ++ case RT305X_ESW_ATTR_PORT_DOUBLETAG: ++ esw->ports[idx].doubletag = val->value.i; ++ break; ++ case RT305X_ESW_ATTR_PORT_UNTAG: ++ esw->ports[idx].untag = val->value.i; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int esw_get_port_recv_badgood(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int idx = val->port_vlan; ++ int shift = attr->id == RT305X_ESW_ATTR_PORT_RECV_GOOD ? 0 : 16; ++ u32 reg; ++ ++ if (idx < 0 || idx >= RT305X_ESW_NUM_LANWAN) ++ return -EINVAL; ++ reg = esw_r32(esw, RT305X_ESW_REG_PXPC(idx)); ++ val->value.i = (reg >> shift) & 0xffff; ++ ++ return 0; ++} ++ ++static int ++esw_get_port_tr_badgood(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ int idx = val->port_vlan; ++ int shift = attr->id == RT5350_ESW_ATTR_PORT_TR_GOOD ? 0 : 16; ++ u32 reg; ++ ++ if ((ralink_soc != RT305X_SOC_RT5350) && (ralink_soc != MT762X_SOC_MT7628AN) && (ralink_soc != MT762X_SOC_MT7688)) ++ return -EINVAL; ++ ++ if (idx < 0 || idx >= RT305X_ESW_NUM_LANWAN) ++ return -EINVAL; ++ ++ reg = esw_r32(esw, RT5350_ESW_REG_PXTPC(idx)); ++ val->value.i = (reg >> shift) & 0xffff; ++ ++ return 0; ++} ++ ++static int esw_get_port_led(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int idx = val->port_vlan; ++ ++ if (idx < 0 || idx >= RT305X_ESW_NUM_PORTS || ++ idx >= RT305X_ESW_NUM_LEDS) ++ return -EINVAL; ++ ++ val->value.i = esw_r32(esw, RT305X_ESW_REG_P0LED + 4*idx); ++ ++ return 0; ++} ++ ++static int esw_set_port_led(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int idx = val->port_vlan; ++ ++ if (idx < 0 || idx >= RT305X_ESW_NUM_LEDS) ++ return -EINVAL; ++ ++ esw->ports[idx].led = val->value.i; ++ ++ return 0; ++} ++ ++static int esw_get_port_pvid(struct switch_dev *dev, int port, int *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ if (port >= RT305X_ESW_NUM_PORTS) ++ return -EINVAL; ++ ++ *val = esw_get_pvid(esw, port); ++ ++ return 0; ++} ++ ++static int esw_set_port_pvid(struct switch_dev *dev, int port, int val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ ++ if (port >= RT305X_ESW_NUM_PORTS) ++ return -EINVAL; ++ ++ esw->ports[port].pvid = val; ++ ++ return 0; ++} ++ ++static int esw_get_vlan_ports(struct switch_dev *dev, struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ u32 vmsc, poc2; ++ int vlan_idx = -1; ++ int i; ++ ++ val->len = 0; ++ ++ if (val->port_vlan < 0 || val->port_vlan >= RT305X_ESW_NUM_VIDS) ++ return -EINVAL; ++ ++ /* valid vlan? */ ++ for (i = 0; i < RT305X_ESW_NUM_VLANS; i++) { ++ if (esw_get_vlan_id(esw, i) == val->port_vlan && ++ esw_get_vmsc(esw, i) != RT305X_ESW_PORTS_NONE) { ++ vlan_idx = i; ++ break; ++ } ++ } ++ ++ if (vlan_idx == -1) ++ return -EINVAL; ++ ++ vmsc = esw_get_vmsc(esw, vlan_idx); ++ poc2 = esw_r32(esw, RT305X_ESW_REG_POC2); ++ ++ for (i = 0; i < RT305X_ESW_NUM_PORTS; i++) { ++ struct switch_port *p; ++ int port_mask = 1 << i; ++ ++ if (!(vmsc & port_mask)) ++ continue; ++ ++ p = &val->value.ports[val->len++]; ++ p->id = i; ++ if (poc2 & (port_mask << RT305X_ESW_POC2_UNTAG_EN_S)) ++ p->flags = 0; ++ else ++ p->flags = 1 << SWITCH_PORT_FLAG_TAGGED; ++ } ++ ++ return 0; ++} ++ ++static int esw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val) ++{ ++ struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); ++ int ports; ++ int vlan_idx = -1; ++ int i; ++ ++ if (val->port_vlan < 0 || val->port_vlan >= RT305X_ESW_NUM_VIDS || ++ val->len > RT305X_ESW_NUM_PORTS) ++ return -EINVAL; ++ ++ /* one of the already defined vlans? */ ++ for (i = 0; i < RT305X_ESW_NUM_VLANS; i++) { ++ if (esw->vlans[i].vid == val->port_vlan && ++ esw->vlans[i].ports != RT305X_ESW_PORTS_NONE) { ++ vlan_idx = i; ++ break; ++ } ++ } ++ ++ /* select a free slot */ ++ for (i = 0; vlan_idx == -1 && i < RT305X_ESW_NUM_VLANS; i++) { ++ if (esw->vlans[i].ports == RT305X_ESW_PORTS_NONE) ++ vlan_idx = i; ++ } ++ ++ /* bail if all slots are in use */ ++ if (vlan_idx == -1) ++ return -EINVAL; ++ ++ ports = RT305X_ESW_PORTS_NONE; ++ for (i = 0; i < val->len; i++) { ++ struct switch_port *p = &val->value.ports[i]; ++ int port_mask = 1 << p->id; ++ bool untagged = !(p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)); ++ ++ if (p->id >= RT305X_ESW_NUM_PORTS) ++ return -EINVAL; ++ ++ ports |= port_mask; ++ esw->ports[p->id].untag = untagged; ++ } ++ esw->vlans[vlan_idx].ports = ports; ++ if (ports == RT305X_ESW_PORTS_NONE) ++ esw->vlans[vlan_idx].vid = RT305X_ESW_VLAN_NONE; ++ else ++ esw->vlans[vlan_idx].vid = val->port_vlan; ++ ++ return 0; ++} ++ ++static const struct switch_attr esw_global[] = { ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "enable_vlan", ++ .description = "VLAN mode (1:enabled)", ++ .max = 1, ++ .id = RT305X_ESW_ATTR_ENABLE_VLAN, ++ .get = esw_get_vlan_enable, ++ .set = esw_set_vlan_enable, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "alternate_vlan_disable", ++ .description = "Use en_vlan instead of doubletag to disable" ++ " VLAN mode", ++ .max = 1, ++ .id = RT305X_ESW_ATTR_ALT_VLAN_DISABLE, ++ .get = esw_get_alt_vlan_disable, ++ .set = esw_set_alt_vlan_disable, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "bc_storm_protect", ++ .description = "Global broadcast storm protection (0:Disable, 1:64 blocks, 2:96 blocks, 3:128 blocks)", ++ .max = 3, ++ .id = RT305X_ESW_ATTR_BC_STATUS, ++ .get = rt305x_esw_get_bc_status, ++ .set = rt305x_esw_set_bc_status, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "led_frequency", ++ .description = "LED Flash frequency (0:30mS, 1:60mS, 2:240mS, 3:480mS)", ++ .max = 3, ++ .id = RT305X_ESW_ATTR_LED_FREQ, ++ .get = rt305x_esw_get_led_freq, ++ .set = rt305x_esw_set_led_freq, ++ } ++}; ++ ++static const struct switch_attr esw_port[] = { ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "disable", ++ .description = "Port state (1:disabled)", ++ .max = 1, ++ .id = RT305X_ESW_ATTR_PORT_DISABLE, ++ .get = esw_get_port_bool, ++ .set = esw_set_port_bool, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "doubletag", ++ .description = "Double tagging for incoming vlan packets " ++ "(1:enabled)", ++ .max = 1, ++ .id = RT305X_ESW_ATTR_PORT_DOUBLETAG, ++ .get = esw_get_port_bool, ++ .set = esw_set_port_bool, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "untag", ++ .description = "Untag (1:strip outgoing vlan tag)", ++ .max = 1, ++ .id = RT305X_ESW_ATTR_PORT_UNTAG, ++ .get = esw_get_port_bool, ++ .set = esw_set_port_bool, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "led", ++ .description = "LED mode (0:link, 1:100m, 2:duplex, 3:activity," ++ " 4:collision, 5:linkact, 6:duplcoll, 7:10mact," ++ " 8:100mact, 10:blink, 11:off, 12:on)", ++ .max = 15, ++ .id = RT305X_ESW_ATTR_PORT_LED, ++ .get = esw_get_port_led, ++ .set = esw_set_port_led, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "lan", ++ .description = "HW port group (0:wan, 1:lan)", ++ .max = 1, ++ .id = RT305X_ESW_ATTR_PORT_LAN, ++ .get = esw_get_port_bool, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "recv_bad", ++ .description = "Receive bad packet counter", ++ .id = RT305X_ESW_ATTR_PORT_RECV_BAD, ++ .get = esw_get_port_recv_badgood, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "recv_good", ++ .description = "Receive good packet counter", ++ .id = RT305X_ESW_ATTR_PORT_RECV_GOOD, ++ .get = esw_get_port_recv_badgood, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "tr_bad", ++ ++ .description = "Transmit bad packet counter. rt5350 only", ++ .id = RT5350_ESW_ATTR_PORT_TR_BAD, ++ .get = esw_get_port_tr_badgood, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "tr_good", ++ ++ .description = "Transmit good packet counter. rt5350 only", ++ .id = RT5350_ESW_ATTR_PORT_TR_GOOD, ++ .get = esw_get_port_tr_badgood, ++ }, ++}; ++ ++static const struct switch_attr esw_vlan[] = { ++}; ++ ++static const struct switch_dev_ops esw_ops = { ++ .attr_global = { ++ .attr = esw_global, ++ .n_attr = ARRAY_SIZE(esw_global), ++ }, ++ .attr_port = { ++ .attr = esw_port, ++ .n_attr = ARRAY_SIZE(esw_port), ++ }, ++ .attr_vlan = { ++ .attr = esw_vlan, ++ .n_attr = ARRAY_SIZE(esw_vlan), ++ }, ++ .get_vlan_ports = esw_get_vlan_ports, ++ .set_vlan_ports = esw_set_vlan_ports, ++ .get_port_pvid = esw_get_port_pvid, ++ .set_port_pvid = esw_set_port_pvid, ++ .get_port_link = esw_get_port_link, ++ .apply_config = esw_apply_config, ++ .reset_switch = esw_reset_switch, ++}; ++ + static int esw_probe(struct platform_device *pdev) + { + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct device_node *np = pdev->dev.of_node; + const __be32 *port_map, *reg_init; ++ struct switch_dev *swdev; + struct rt305x_esw *esw; + struct resource *irq; + int ret; +@@ -568,6 +1353,21 @@ static int esw_probe(struct platform_dev + if (reg_init) + esw->reg_led_polarity = be32_to_cpu(*reg_init); + ++ swdev = &esw->swdev; ++ swdev->of_node = pdev->dev.of_node; ++ swdev->name = "rt305x-esw"; ++ swdev->alias = "rt305x"; ++ swdev->cpu_port = RT305X_ESW_PORT6; ++ swdev->ports = RT305X_ESW_NUM_PORTS; ++ swdev->vlans = RT305X_ESW_NUM_VIDS; ++ swdev->ops = &esw_ops; ++ ++ ret = register_switch(swdev, NULL); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "register_switch failed\n"); ++ goto unmap_base; ++ } ++ + platform_set_drvdata(pdev, esw); + + spin_lock_init(&esw->reg_rw_lock); +@@ -583,6 +1383,11 @@ static int esw_probe(struct platform_dev + } + + return ret; ++ ++unmap_base: ++ iounmap(esw->base); ++ kfree(esw); ++ return ret; + } + + static int esw_remove(struct platform_device *pdev) diff --git a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch new file mode 100644 index 0000000000..10db0765c2 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch @@ -0,0 +1,1181 @@ +From cf5a08f1f16913da8bb24a96afaa2969b29d0827 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 14 Dec 2015 22:25:57 +0100 +Subject: [PATCH 513/513] net: mediatek: add swconfig driver for gsw_mt762x + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/Makefile | 4 +- + drivers/net/ethernet/mediatek/gsw_mt7620.c | 3 + + drivers/net/ethernet/mediatek/gsw_mt7620.h | 3 + + drivers/net/ethernet/mediatek/mt7530.c | 884 ++++++++++++++++++++++++++++ + drivers/net/ethernet/mediatek/mt7530.h | 186 ++++++ + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 +- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 + + drivers/net/ethernet/mediatek/soc_mt7620.c | 1 + + 8 files changed, 1087 insertions(+), 4 deletions(-) + create mode 100644 drivers/net/ethernet/mediatek/mt7530.c + create mode 100644 drivers/net/ethernet/mediatek/mt7530.h + +--- a/drivers/net/ethernet/mediatek/Makefile ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -15,6 +15,6 @@ mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MT7620 + mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MT7621) += soc_mt7621.o + + obj-$(CONFIG_NET_MEDIATEK_ESW_RT3050) += esw_rt3050.o +-obj-$(CONFIG_NET_MEDIATEK_GSW_MT7620) += gsw_mt7620.o +-obj-$(CONFIG_NET_MEDIATEK_GSW_MT7621) += gsw_mt7621.o ++obj-$(CONFIG_NET_MEDIATEK_GSW_MT7620) += gsw_mt7620.o mt7530.o ++obj-$(CONFIG_NET_MEDIATEK_GSW_MT7621) += gsw_mt7621.o mt7530.o + obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk-eth-soc.o +--- a/drivers/net/ethernet/mediatek/gsw_mt7620.c ++++ b/drivers/net/ethernet/mediatek/gsw_mt7620.c +@@ -67,6 +67,9 @@ static void mt7620_hw_init(struct mt7620 + rt_sysc_w32(rt_sysc_r32(SYSC_REG_CFG1) | BIT(8), SYSC_REG_CFG1); + mtk_switch_w32(gsw, mtk_switch_r32(gsw, GSW_REG_CKGCR) & ~(0x3 << 4), GSW_REG_CKGCR); + ++ /* 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")) { + u32 val; + +--- a/drivers/net/ethernet/mediatek/gsw_mt7620.h ++++ b/drivers/net/ethernet/mediatek/gsw_mt7620.h +@@ -35,6 +35,8 @@ + #define GSW_MDIO_ADDR_SHIFT 20 + #define GSW_MDIO_REG_SHIFT 25 + ++#define GSW_REG_MIB_CNT_EN 0x4000 ++ + #define GSW_REG_PORT_PMCR(x) (0x3000 + (x * 0x100)) + #define GSW_REG_PORT_STATUS(x) (0x3008 + (x * 0x100)) + #define GSW_REG_SMACCR0 0x3fE4 +@@ -76,6 +78,7 @@ + #define PHY_PRE_EN BIT(30) + #define PMY_MDC_CONF(_x) ((_x & 0x3f) << 24) + ++ + enum { + /* Global attributes. */ + GSW_ATTR_ENABLE_VLAN, +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mt7530.c +@@ -0,0 +1,890 @@ ++/* ++ * 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. ++ * ++ * Copyright (C) 2013 John Crispin ++ * Copyright (C) 2016 Vitaly Chekryzhev <13hakta@gmail.com> ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "mt7530.h" ++ ++#define MT7530_CPU_PORT 6 ++#define MT7530_NUM_PORTS 8 ++#ifdef CONFIG_SOC_MT7621 ++#define MT7530_NUM_VLANS 4095 ++#else ++#define MT7530_NUM_VLANS 16 ++#endif ++#define MT7530_MAX_VID 4095 ++#define MT7530_MIN_VID 0 ++ ++/* registers */ ++#define REG_ESW_VLAN_VTCR 0x90 ++#define REG_ESW_VLAN_VAWD1 0x94 ++#define REG_ESW_VLAN_VAWD2 0x98 ++#define REG_ESW_VLAN_VTIM(x) (0x100 + 4 * ((x) / 2)) ++ ++#define REG_ESW_VLAN_VAWD1_IVL_MAC BIT(30) ++#define REG_ESW_VLAN_VAWD1_VTAG_EN BIT(28) ++#define REG_ESW_VLAN_VAWD1_VALID BIT(0) ++ ++/* vlan egress mode */ ++enum { ++ ETAG_CTRL_UNTAG = 0, ++ ETAG_CTRL_TAG = 2, ++ ETAG_CTRL_SWAP = 1, ++ ETAG_CTRL_STACK = 3, ++}; ++ ++#define REG_ESW_PORT_PCR(x) (0x2004 | ((x) << 8)) ++#define REG_ESW_PORT_PVC(x) (0x2010 | ((x) << 8)) ++#define REG_ESW_PORT_PPBV1(x) (0x2014 | ((x) << 8)) ++ ++#define REG_HWTRAP 0x7804 ++ ++#define MIB_DESC(_s , _o, _n) \ ++ { \ ++ .size = (_s), \ ++ .offset = (_o), \ ++ .name = (_n), \ ++ } ++ ++struct mt7xxx_mib_desc { ++ unsigned int size; ++ unsigned int offset; ++ const char *name; ++}; ++ ++static const struct mt7xxx_mib_desc mt7620_mibs[] = { ++ MIB_DESC(1, MT7620_MIB_STATS_PPE_AC_BCNT0, "PPE_AC_BCNT0"), ++ MIB_DESC(1, MT7620_MIB_STATS_PPE_AC_PCNT0, "PPE_AC_PCNT0"), ++ MIB_DESC(1, MT7620_MIB_STATS_PPE_AC_BCNT63, "PPE_AC_BCNT63"), ++ MIB_DESC(1, MT7620_MIB_STATS_PPE_AC_PCNT63, "PPE_AC_PCNT63"), ++ MIB_DESC(1, MT7620_MIB_STATS_PPE_MTR_CNT0, "PPE_MTR_CNT0"), ++ MIB_DESC(1, MT7620_MIB_STATS_PPE_MTR_CNT63, "PPE_MTR_CNT63"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_TX_GBCNT, "GDM1_TX_GBCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_TX_GPCNT, "GDM1_TX_GPCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_TX_SKIPCNT, "GDM1_TX_SKIPCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_TX_COLCNT, "GDM1_TX_COLCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_GBCNT1, "GDM1_RX_GBCNT1"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_GPCNT1, "GDM1_RX_GPCNT1"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_OERCNT, "GDM1_RX_OERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_FERCNT, "GDM1_RX_FERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_SERCNT, "GDM1_RX_SERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_LERCNT, "GDM1_RX_LERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_CERCNT, "GDM1_RX_CERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM1_RX_FCCNT, "GDM1_RX_FCCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_TX_GBCNT, "GDM2_TX_GBCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_TX_GPCNT, "GDM2_TX_GPCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_TX_SKIPCNT, "GDM2_TX_SKIPCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_TX_COLCNT, "GDM2_TX_COLCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_GBCNT, "GDM2_RX_GBCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_GPCNT, "GDM2_RX_GPCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_OERCNT, "GDM2_RX_OERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_FERCNT, "GDM2_RX_FERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_SERCNT, "GDM2_RX_SERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_LERCNT, "GDM2_RX_LERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_CERCNT, "GDM2_RX_CERCNT"), ++ MIB_DESC(1, MT7620_MIB_STATS_GDM2_RX_FCCNT, "GDM2_RX_FCCNT") ++}; ++ ++static const struct mt7xxx_mib_desc mt7620_port_mibs[] = { ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_TGPCN, "TxGPC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_TBOCN, "TxBOC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_TGOCN, "TxGOC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_TEPCN, "TxEPC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_RGPCN, "RxGPC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_RBOCN, "RxBOC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_RGOCN, "RxGOC"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_REPC1N, "RxEPC1"), ++ MIB_DESC(1, MT7620_MIB_STATS_PORT_REPC2N, "RxEPC2") ++}; ++ ++static const struct mt7xxx_mib_desc mt7621_mibs[] = { ++ MIB_DESC(1, MT7621_STATS_TDPC, "TxDrop"), ++ MIB_DESC(1, MT7621_STATS_TCRC, "TxCRC"), ++ MIB_DESC(1, MT7621_STATS_TUPC, "TxUni"), ++ MIB_DESC(1, MT7621_STATS_TMPC, "TxMulti"), ++ MIB_DESC(1, MT7621_STATS_TBPC, "TxBroad"), ++ MIB_DESC(1, MT7621_STATS_TCEC, "TxCollision"), ++ MIB_DESC(1, MT7621_STATS_TSCEC, "TxSingleCol"), ++ MIB_DESC(1, MT7621_STATS_TMCEC, "TxMultiCol"), ++ MIB_DESC(1, MT7621_STATS_TDEC, "TxDefer"), ++ MIB_DESC(1, MT7621_STATS_TLCEC, "TxLateCol"), ++ MIB_DESC(1, MT7621_STATS_TXCEC, "TxExcCol"), ++ MIB_DESC(1, MT7621_STATS_TPPC, "TxPause"), ++ MIB_DESC(1, MT7621_STATS_TL64PC, "Tx64Byte"), ++ MIB_DESC(1, MT7621_STATS_TL65PC, "Tx65Byte"), ++ MIB_DESC(1, MT7621_STATS_TL128PC, "Tx128Byte"), ++ MIB_DESC(1, MT7621_STATS_TL256PC, "Tx256Byte"), ++ MIB_DESC(1, MT7621_STATS_TL512PC, "Tx512Byte"), ++ MIB_DESC(1, MT7621_STATS_TL1024PC, "Tx1024Byte"), ++ MIB_DESC(2, MT7621_STATS_TOC, "TxByte"), ++ MIB_DESC(1, MT7621_STATS_RDPC, "RxDrop"), ++ MIB_DESC(1, MT7621_STATS_RFPC, "RxFiltered"), ++ MIB_DESC(1, MT7621_STATS_RUPC, "RxUni"), ++ MIB_DESC(1, MT7621_STATS_RMPC, "RxMulti"), ++ MIB_DESC(1, MT7621_STATS_RBPC, "RxBroad"), ++ MIB_DESC(1, MT7621_STATS_RAEPC, "RxAlignErr"), ++ MIB_DESC(1, MT7621_STATS_RCEPC, "RxCRC"), ++ MIB_DESC(1, MT7621_STATS_RUSPC, "RxUnderSize"), ++ MIB_DESC(1, MT7621_STATS_RFEPC, "RxFragment"), ++ MIB_DESC(1, MT7621_STATS_ROSPC, "RxOverSize"), ++ MIB_DESC(1, MT7621_STATS_RJEPC, "RxJabber"), ++ MIB_DESC(1, MT7621_STATS_RPPC, "RxPause"), ++ MIB_DESC(1, MT7621_STATS_RL64PC, "Rx64Byte"), ++ MIB_DESC(1, MT7621_STATS_RL65PC, "Rx65Byte"), ++ MIB_DESC(1, MT7621_STATS_RL128PC, "Rx128Byte"), ++ MIB_DESC(1, MT7621_STATS_RL256PC, "Rx256Byte"), ++ MIB_DESC(1, MT7621_STATS_RL512PC, "Rx512Byte"), ++ MIB_DESC(1, MT7621_STATS_RL1024PC, "Rx1024Byte"), ++ MIB_DESC(2, MT7621_STATS_ROC, "RxByte"), ++ MIB_DESC(1, MT7621_STATS_RDPC_CTRL, "RxCtrlDrop"), ++ MIB_DESC(1, MT7621_STATS_RDPC_ING, "RxIngDrop"), ++ MIB_DESC(1, MT7621_STATS_RDPC_ARL, "RxARLDrop") ++}; ++ ++enum { ++ /* Global attributes. */ ++ MT7530_ATTR_ENABLE_VLAN, ++}; ++ ++struct mt7530_port_entry { ++ u16 pvid; ++}; ++ ++struct mt7530_vlan_entry { ++ u16 vid; ++ u8 member; ++ u8 etags; ++}; ++ ++struct mt7530_priv { ++ void __iomem *base; ++ struct mii_bus *bus; ++ struct switch_dev swdev; ++ ++ bool global_vlan_enable; ++ struct mt7530_vlan_entry vlan_entries[MT7530_NUM_VLANS]; ++ struct mt7530_port_entry port_entries[MT7530_NUM_PORTS]; ++}; ++ ++struct mt7530_mapping { ++ char *name; ++ u16 pvids[MT7530_NUM_PORTS]; ++ u8 members[MT7530_NUM_VLANS]; ++ u8 etags[MT7530_NUM_VLANS]; ++ u16 vids[MT7530_NUM_VLANS]; ++} mt7530_defaults[] = { ++ { ++ .name = "llllw", ++ .pvids = { 1, 1, 1, 1, 2, 1, 1 }, ++ .members = { 0, 0x6f, 0x50 }, ++ .etags = { 0, 0x40, 0x40 }, ++ .vids = { 0, 1, 2 }, ++ }, { ++ .name = "wllll", ++ .pvids = { 2, 1, 1, 1, 1, 1, 1 }, ++ .members = { 0, 0x7e, 0x41 }, ++ .etags = { 0, 0x40, 0x40 }, ++ .vids = { 0, 1, 2 }, ++ }, ++}; ++ ++struct mt7530_mapping* ++mt7530_find_mapping(struct device_node *np) ++{ ++ const char *map; ++ int i; ++ ++ if (of_property_read_string(np, "mediatek,portmap", &map)) ++ return NULL; ++ ++ for (i = 0; i < ARRAY_SIZE(mt7530_defaults); i++) ++ if (!strcmp(map, mt7530_defaults[i].name)) ++ return &mt7530_defaults[i]; ++ ++ return NULL; ++} ++ ++static void ++mt7530_apply_mapping(struct mt7530_priv *mt7530, struct mt7530_mapping *map) ++{ ++ int i = 0; ++ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) ++ mt7530->port_entries[i].pvid = map->pvids[i]; ++ ++ for (i = 0; i < MT7530_NUM_VLANS; i++) { ++ mt7530->vlan_entries[i].member = map->members[i]; ++ mt7530->vlan_entries[i].etags = map->etags[i]; ++ mt7530->vlan_entries[i].vid = map->vids[i]; ++ } ++} ++ ++static int ++mt7530_reset_switch(struct switch_dev *dev) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ int i; ++ ++ memset(priv->port_entries, 0, sizeof(priv->port_entries)); ++ memset(priv->vlan_entries, 0, sizeof(priv->vlan_entries)); ++ ++ /* set default vid of each vlan to the same number of vlan, so the vid ++ * won't need be set explicitly. ++ */ ++ for (i = 0; i < MT7530_NUM_VLANS; i++) { ++ priv->vlan_entries[i].vid = i; ++ } ++ ++ return 0; ++} ++ ++static int ++mt7530_get_vlan_enable(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ ++ val->value.i = priv->global_vlan_enable; ++ ++ return 0; ++} ++ ++static int ++mt7530_set_vlan_enable(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ ++ priv->global_vlan_enable = val->value.i != 0; ++ ++ return 0; ++} ++ ++static u32 ++mt7530_r32(struct mt7530_priv *priv, u32 reg) ++{ ++ u32 val; ++ if (priv->bus) { ++ u16 high, low; ++ ++ mdiobus_write(priv->bus, 0x1f, 0x1f, (reg >> 6) & 0x3ff); ++ low = mdiobus_read(priv->bus, 0x1f, (reg >> 2) & 0xf); ++ high = mdiobus_read(priv->bus, 0x1f, 0x10); ++ ++ return (high << 16) | (low & 0xffff); ++ } ++ ++ val = ioread32(priv->base + reg); ++ pr_debug("MT7530 MDIO Read [%04x]=%08x\n", reg, val); ++ ++ return val; ++} ++ ++static void ++mt7530_w32(struct mt7530_priv *priv, u32 reg, u32 val) ++{ ++ if (priv->bus) { ++ mdiobus_write(priv->bus, 0x1f, 0x1f, (reg >> 6) & 0x3ff); ++ mdiobus_write(priv->bus, 0x1f, (reg >> 2) & 0xf, val & 0xffff); ++ mdiobus_write(priv->bus, 0x1f, 0x10, val >> 16); ++ return; ++ } ++ ++ pr_debug("MT7530 MDIO Write[%04x]=%08x\n", reg, val); ++ iowrite32(val, priv->base + reg); ++} ++ ++static void ++mt7530_vtcr(struct mt7530_priv *priv, u32 cmd, u32 val) ++{ ++ int i; ++ ++ mt7530_w32(priv, REG_ESW_VLAN_VTCR, BIT(31) | (cmd << 12) | val); ++ ++ for (i = 0; i < 20; i++) { ++ u32 val = mt7530_r32(priv, REG_ESW_VLAN_VTCR); ++ ++ if ((val & BIT(31)) == 0) ++ break; ++ ++ udelay(1000); ++ } ++ if (i == 20) ++ printk("mt7530: vtcr timeout\n"); ++} ++ ++static int ++mt7530_get_port_pvid(struct switch_dev *dev, int port, int *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ ++ if (port >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ *val = mt7530_r32(priv, REG_ESW_PORT_PPBV1(port)); ++ *val &= 0xfff; ++ ++ return 0; ++} ++ ++static int ++mt7530_set_port_pvid(struct switch_dev *dev, int port, int pvid) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ ++ if (port >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ if (pvid < MT7530_MIN_VID || pvid > MT7530_MAX_VID) ++ return -EINVAL; ++ ++ priv->port_entries[port].pvid = pvid; ++ ++ return 0; ++} ++ ++static int ++mt7530_get_vlan_ports(struct switch_dev *dev, struct switch_val *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ u32 member; ++ u32 etags; ++ int i; ++ ++ val->len = 0; ++ ++ if (val->port_vlan < 0 || val->port_vlan >= MT7530_NUM_VLANS) ++ return -EINVAL; ++ ++ mt7530_vtcr(priv, 0, val->port_vlan); ++ ++ member = mt7530_r32(priv, REG_ESW_VLAN_VAWD1); ++ member >>= 16; ++ member &= 0xff; ++ ++ etags = mt7530_r32(priv, REG_ESW_VLAN_VAWD2); ++ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) { ++ struct switch_port *p; ++ int etag; ++ ++ if (!(member & BIT(i))) ++ continue; ++ ++ p = &val->value.ports[val->len++]; ++ p->id = i; ++ ++ etag = (etags >> (i * 2)) & 0x3; ++ ++ if (etag == ETAG_CTRL_TAG) ++ p->flags |= BIT(SWITCH_PORT_FLAG_TAGGED); ++ else if (etag != ETAG_CTRL_UNTAG) ++ printk("vlan egress tag control neither untag nor tag.\n"); ++ } ++ ++ return 0; ++} ++ ++static int ++mt7530_set_vlan_ports(struct switch_dev *dev, struct switch_val *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ u8 member = 0; ++ u8 etags = 0; ++ int i; ++ ++ if (val->port_vlan < 0 || val->port_vlan >= MT7530_NUM_VLANS || ++ val->len > MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ for (i = 0; i < val->len; i++) { ++ struct switch_port *p = &val->value.ports[i]; ++ ++ if (p->id >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ member |= BIT(p->id); ++ ++ if (p->flags & BIT(SWITCH_PORT_FLAG_TAGGED)) ++ etags |= BIT(p->id); ++ } ++ priv->vlan_entries[val->port_vlan].member = member; ++ priv->vlan_entries[val->port_vlan].etags = etags; ++ ++ return 0; ++} ++ ++static int ++mt7530_set_vid(struct switch_dev *dev, const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ int vlan; ++ u16 vid; ++ ++ vlan = val->port_vlan; ++ vid = (u16)val->value.i; ++ ++ if (vlan < 0 || vlan >= MT7530_NUM_VLANS) ++ return -EINVAL; ++ ++ if (vid < MT7530_MIN_VID || vid > MT7530_MAX_VID) ++ return -EINVAL; ++ ++ priv->vlan_entries[vlan].vid = vid; ++ return 0; ++} ++ ++static int ++mt7530_get_vid(struct switch_dev *dev, const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ u32 vid; ++ int vlan; ++ ++ vlan = val->port_vlan; ++ ++ vid = mt7530_r32(priv, REG_ESW_VLAN_VTIM(vlan)); ++ if (vlan & 1) ++ vid = vid >> 12; ++ vid &= 0xfff; ++ ++ val->value.i = vid; ++ return 0; ++} ++ ++static int ++mt7530_apply_config(struct switch_dev *dev) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ int i, j; ++ u8 tag_ports; ++ u8 untag_ports; ++ ++ if (!priv->global_vlan_enable) { ++ for (i = 0; i < MT7530_NUM_PORTS; i++) ++ mt7530_w32(priv, REG_ESW_PORT_PCR(i), 0x00400000); ++ ++ mt7530_w32(priv, REG_ESW_PORT_PCR(MT7530_CPU_PORT), 0x00ff0000); ++ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) ++ mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x810000c0); ++ ++ return 0; ++ } ++ ++ /* set all ports as security mode */ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) ++ mt7530_w32(priv, REG_ESW_PORT_PCR(i), 0x00ff0003); ++ ++ /* check if a port is used in tag/untag vlan egress mode */ ++ tag_ports = 0; ++ untag_ports = 0; ++ ++ for (i = 0; i < MT7530_NUM_VLANS; i++) { ++ u8 member = priv->vlan_entries[i].member; ++ u8 etags = priv->vlan_entries[i].etags; ++ ++ if (!member) ++ continue; ++ ++ for (j = 0; j < MT7530_NUM_PORTS; j++) { ++ if (!(member & BIT(j))) ++ continue; ++ ++ if (etags & BIT(j)) ++ tag_ports |= 1u << j; ++ else ++ untag_ports |= 1u << j; ++ } ++ } ++ ++ /* set all untag-only ports as transparent and the rest as user port */ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) { ++ u32 pvc_mode = 0x81000000; ++ ++ if (untag_ports & BIT(i) && !(tag_ports & BIT(i))) ++ pvc_mode = 0x810000c0; ++ ++ mt7530_w32(priv, REG_ESW_PORT_PVC(i), pvc_mode); ++ } ++ ++ for (i = 0; i < MT7530_NUM_VLANS; i++) { ++ u16 vid = priv->vlan_entries[i].vid; ++ u8 member = priv->vlan_entries[i].member; ++ u8 etags = priv->vlan_entries[i].etags; ++ u32 val; ++ ++ /* vid of vlan */ ++ val = mt7530_r32(priv, REG_ESW_VLAN_VTIM(i)); ++ if (i % 2 == 0) { ++ val &= 0xfff000; ++ val |= vid; ++ } else { ++ val &= 0xfff; ++ val |= (vid << 12); ++ } ++ mt7530_w32(priv, REG_ESW_VLAN_VTIM(i), val); ++ ++ /* vlan port membership */ ++ if (member) ++ mt7530_w32(priv, REG_ESW_VLAN_VAWD1, REG_ESW_VLAN_VAWD1_IVL_MAC | ++ REG_ESW_VLAN_VAWD1_VTAG_EN | (member << 16) | ++ REG_ESW_VLAN_VAWD1_VALID); ++ else ++ mt7530_w32(priv, REG_ESW_VLAN_VAWD1, 0); ++ ++ /* egress mode */ ++ val = 0; ++ for (j = 0; j < MT7530_NUM_PORTS; j++) { ++ if (etags & BIT(j)) ++ val |= ETAG_CTRL_TAG << (j * 2); ++ else ++ val |= ETAG_CTRL_UNTAG << (j * 2); ++ } ++ mt7530_w32(priv, REG_ESW_VLAN_VAWD2, val); ++ ++ /* write to vlan table */ ++ mt7530_vtcr(priv, 1, i); ++ } ++ ++ /* Port Default PVID */ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) { ++ u32 val; ++ val = mt7530_r32(priv, REG_ESW_PORT_PPBV1(i)); ++ val &= ~0xfff; ++ val |= priv->port_entries[i].pvid; ++ mt7530_w32(priv, REG_ESW_PORT_PPBV1(i), val); ++ } ++ ++ return 0; ++} ++ ++static int ++mt7530_get_port_link(struct switch_dev *dev, int port, ++ struct switch_port_link *link) ++{ ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ u32 speed, pmsr; ++ ++ if (port < 0 || port >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ pmsr = mt7530_r32(priv, 0x3008 + (0x100 * port)); ++ ++ link->link = pmsr & 1; ++ link->duplex = (pmsr >> 1) & 1; ++ speed = (pmsr >> 2) & 3; ++ ++ switch (speed) { ++ case 0: ++ link->speed = SWITCH_PORT_SPEED_10; ++ break; ++ case 1: ++ link->speed = SWITCH_PORT_SPEED_100; ++ break; ++ case 2: ++ case 3: /* forced gige speed can be 2 or 3 */ ++ link->speed = SWITCH_PORT_SPEED_1000; ++ break; ++ default: ++ link->speed = SWITCH_PORT_SPEED_UNKNOWN; ++ break; ++ } ++ ++ return 0; ++} ++ ++static u64 get_mib_counter(struct mt7530_priv *priv, int i, int port) ++{ ++ unsigned int port_base; ++ u64 lo; ++ ++ port_base = MT7621_MIB_COUNTER_BASE + ++ MT7621_MIB_COUNTER_PORT_OFFSET * port; ++ ++ lo = mt7530_r32(priv, port_base + mt7621_mibs[i].offset); ++ if (mt7621_mibs[i].size == 2) { ++ u64 hi; ++ ++ hi = mt7530_r32(priv, port_base + mt7621_mibs[i].offset + 4); ++ lo |= hi << 32; ++ } ++ ++ return lo; ++} ++ ++static int mt7621_sw_get_port_mib(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ static char buf[4096]; ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ int i, len = 0; ++ ++ if (val->port_vlan >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ len += snprintf(buf + len, sizeof(buf) - len, ++ "Port %d MIB counters\n", val->port_vlan); ++ ++ for (i = 0; i < ARRAY_SIZE(mt7621_mibs); ++i) { ++ u64 counter; ++ len += snprintf(buf + len, sizeof(buf) - len, ++ "%-11s: ", mt7621_mibs[i].name); ++ counter = get_mib_counter(priv, i, val->port_vlan); ++ len += snprintf(buf + len, sizeof(buf) - len, "%llu\n", ++ counter); ++ } ++ ++ val->value.s = buf; ++ val->len = len; ++ return 0; ++} ++ ++static u64 get_mib_counter_7620(struct mt7530_priv *priv, int i) ++{ ++ return mt7530_r32(priv, MT7620_MIB_COUNTER_BASE + mt7620_mibs[i].offset); ++} ++ ++static u64 get_mib_counter_port_7620(struct mt7530_priv *priv, int i, int port) ++{ ++ return mt7530_r32(priv, ++ MT7620_MIB_COUNTER_BASE_PORT + ++ (MT7620_MIB_COUNTER_PORT_OFFSET * port) + ++ mt7620_port_mibs[i].offset); ++} ++ ++static int mt7530_sw_get_mib(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ static char buf[4096]; ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ int i, len = 0; ++ ++ len += snprintf(buf + len, sizeof(buf) - len, "Switch MIB counters\n"); ++ ++ for (i = 0; i < ARRAY_SIZE(mt7620_mibs); ++i) { ++ u64 counter; ++ len += snprintf(buf + len, sizeof(buf) - len, ++ "%-11s: ", mt7620_mibs[i].name); ++ counter = get_mib_counter_7620(priv, i); ++ len += snprintf(buf + len, sizeof(buf) - len, "%llu\n", ++ counter); ++ } ++ ++ val->value.s = buf; ++ val->len = len; ++ return 0; ++} ++ ++static int mt7530_sw_get_port_mib(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ static char buf[4096]; ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ int i, len = 0; ++ ++ if (val->port_vlan >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ len += snprintf(buf + len, sizeof(buf) - len, ++ "Port %d MIB counters\n", val->port_vlan); ++ ++ for (i = 0; i < ARRAY_SIZE(mt7620_port_mibs); ++i) { ++ u64 counter; ++ len += snprintf(buf + len, sizeof(buf) - len, ++ "%-11s: ", mt7620_port_mibs[i].name); ++ counter = get_mib_counter_port_7620(priv, i, val->port_vlan); ++ len += snprintf(buf + len, sizeof(buf) - len, "%llu\n", ++ counter); ++ } ++ ++ val->value.s = buf; ++ val->len = len; ++ return 0; ++} ++ ++static const struct switch_attr mt7530_global[] = { ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "enable_vlan", ++ .description = "VLAN mode (1:enabled)", ++ .max = 1, ++ .id = MT7530_ATTR_ENABLE_VLAN, ++ .get = mt7530_get_vlan_enable, ++ .set = mt7530_set_vlan_enable, ++ }, { ++ .type = SWITCH_TYPE_STRING, ++ .name = "mib", ++ .description = "Get MIB counters for switch", ++ .get = mt7530_sw_get_mib, ++ .set = NULL, ++ }, ++}; ++ ++static const struct switch_attr mt7621_port[] = { ++ { ++ .type = SWITCH_TYPE_STRING, ++ .name = "mib", ++ .description = "Get MIB counters for port", ++ .get = mt7621_sw_get_port_mib, ++ .set = NULL, ++ }, ++}; ++ ++static const struct switch_attr mt7530_port[] = { ++ { ++ .type = SWITCH_TYPE_STRING, ++ .name = "mib", ++ .description = "Get MIB counters for port", ++ .get = mt7530_sw_get_port_mib, ++ .set = NULL, ++ }, ++}; ++ ++static const struct switch_attr mt7530_vlan[] = { ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "vid", ++ .description = "VLAN ID (0-4094)", ++ .set = mt7530_set_vid, ++ .get = mt7530_get_vid, ++ .max = 4094, ++ }, ++}; ++ ++static const struct switch_dev_ops mt7621_ops = { ++ .attr_global = { ++ .attr = mt7530_global, ++ .n_attr = ARRAY_SIZE(mt7530_global), ++ }, ++ .attr_port = { ++ .attr = mt7621_port, ++ .n_attr = ARRAY_SIZE(mt7621_port), ++ }, ++ .attr_vlan = { ++ .attr = mt7530_vlan, ++ .n_attr = ARRAY_SIZE(mt7530_vlan), ++ }, ++ .get_vlan_ports = mt7530_get_vlan_ports, ++ .set_vlan_ports = mt7530_set_vlan_ports, ++ .get_port_pvid = mt7530_get_port_pvid, ++ .set_port_pvid = mt7530_set_port_pvid, ++ .get_port_link = mt7530_get_port_link, ++ .apply_config = mt7530_apply_config, ++ .reset_switch = mt7530_reset_switch, ++}; ++ ++static const struct switch_dev_ops mt7530_ops = { ++ .attr_global = { ++ .attr = mt7530_global, ++ .n_attr = ARRAY_SIZE(mt7530_global), ++ }, ++ .attr_port = { ++ .attr = mt7530_port, ++ .n_attr = ARRAY_SIZE(mt7530_port), ++ }, ++ .attr_vlan = { ++ .attr = mt7530_vlan, ++ .n_attr = ARRAY_SIZE(mt7530_vlan), ++ }, ++ .get_vlan_ports = mt7530_get_vlan_ports, ++ .set_vlan_ports = mt7530_set_vlan_ports, ++ .get_port_pvid = mt7530_get_port_pvid, ++ .set_port_pvid = mt7530_set_port_pvid, ++ .get_port_link = mt7530_get_port_link, ++ .apply_config = mt7530_apply_config, ++ .reset_switch = mt7530_reset_switch, ++}; ++ ++int ++mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus, int vlan) ++{ ++ struct switch_dev *swdev; ++ struct mt7530_priv *mt7530; ++ struct mt7530_mapping *map; ++ int ret; ++ ++ mt7530 = devm_kzalloc(dev, sizeof(struct mt7530_priv), GFP_KERNEL); ++ if (!mt7530) ++ return -ENOMEM; ++ ++ mt7530->base = base; ++ mt7530->bus = bus; ++ mt7530->global_vlan_enable = vlan; ++ ++ swdev = &mt7530->swdev; ++ if (bus) { ++ swdev->alias = "mt7530"; ++ swdev->name = "mt7530"; ++ } else if (IS_ENABLED(CONFIG_SOC_MT7621)) { ++ swdev->alias = "mt7621"; ++ swdev->name = "mt7621"; ++ } else { ++ swdev->alias = "mt7620"; ++ swdev->name = "mt7620"; ++ } ++ swdev->cpu_port = MT7530_CPU_PORT; ++ swdev->ports = MT7530_NUM_PORTS; ++ swdev->vlans = MT7530_NUM_VLANS; ++ if (IS_ENABLED(CONFIG_SOC_MT7621)) ++ swdev->ops = &mt7621_ops; ++ else ++ swdev->ops = &mt7530_ops; ++ ++ ret = register_switch(swdev, NULL); ++ if (ret) { ++ dev_err(dev, "failed to register mt7530\n"); ++ return ret; ++ } ++ ++ ++ map = mt7530_find_mapping(dev->of_node); ++ if (map) ++ mt7530_apply_mapping(mt7530, map); ++ mt7530_apply_config(swdev); ++ ++ /* magic vodoo */ ++ if (!IS_ENABLED(CONFIG_SOC_MT7621) && bus && mt7530_r32(mt7530, REG_HWTRAP) != 0x1117edf) { ++ dev_info(dev, "fixing up MHWTRAP register - bootloader probably played with it\n"); ++ mt7530_w32(mt7530, REG_HWTRAP, 0x1117edf); ++ } ++ dev_info(dev, "loaded %s driver\n", swdev->name); ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mt7530.h +@@ -0,0 +1,186 @@ ++/* ++ * 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. ++ * ++ * Copyright (C) 2013 John Crispin ++ * Copyright (C) 2016 Vitaly Chekryzhev <13hakta@gmail.com> ++ */ ++ ++#ifndef _MT7530_H__ ++#define _MT7530_H__ ++ ++#define MT7620_MIB_COUNTER_BASE_PORT 0x4000 ++#define MT7620_MIB_COUNTER_PORT_OFFSET 0x100 ++#define MT7620_MIB_COUNTER_BASE 0x1010 ++ ++/* PPE Accounting Group #0 Byte Counter */ ++#define MT7620_MIB_STATS_PPE_AC_BCNT0 0x000 ++ ++/* PPE Accounting Group #0 Packet Counter */ ++#define MT7620_MIB_STATS_PPE_AC_PCNT0 0x004 ++ ++/* PPE Accounting Group #63 Byte Counter */ ++#define MT7620_MIB_STATS_PPE_AC_BCNT63 0x1F8 ++ ++/* PPE Accounting Group #63 Packet Counter */ ++#define MT7620_MIB_STATS_PPE_AC_PCNT63 0x1FC ++ ++/* PPE Meter Group #0 */ ++#define MT7620_MIB_STATS_PPE_MTR_CNT0 0x200 ++ ++/* PPE Meter Group #63 */ ++#define MT7620_MIB_STATS_PPE_MTR_CNT63 0x2FC ++ ++/* Transmit good byte count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_TX_GBCNT 0x300 ++ ++/* Transmit good packet count for CPU GDM (exclude flow control frames) */ ++#define MT7620_MIB_STATS_GDM1_TX_GPCNT 0x304 ++ ++/* Transmit abort count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_TX_SKIPCNT 0x308 ++ ++/* Transmit collision count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_TX_COLCNT 0x30C ++ ++/* Received good byte count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_GBCNT1 0x320 ++ ++/* Received good packet count for CPU GDM (exclude flow control frame) */ ++#define MT7620_MIB_STATS_GDM1_RX_GPCNT1 0x324 ++ ++/* Received overflow error packet count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_OERCNT 0x328 ++ ++/* Received FCS error packet count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_FERCNT 0x32C ++ ++/* Received too short error packet count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_SERCNT 0x330 ++ ++/* Received too long error packet count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_LERCNT 0x334 ++ ++/* Received IP/TCP/UDP checksum error packet count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_CERCNT 0x338 ++ ++/* Received flow control pkt count for CPU GDM */ ++#define MT7620_MIB_STATS_GDM1_RX_FCCNT 0x33C ++ ++/* Transmit good byte count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_TX_GBCNT 0x340 ++ ++/* Transmit good packet count for PPE GDM (exclude flow control frames) */ ++#define MT7620_MIB_STATS_GDM2_TX_GPCNT 0x344 ++ ++/* Transmit abort count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_TX_SKIPCNT 0x348 ++ ++/* Transmit collision count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_TX_COLCNT 0x34C ++ ++/* Received good byte count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_GBCNT 0x360 ++ ++/* Received good packet count for PPE GDM (exclude flow control frame) */ ++#define MT7620_MIB_STATS_GDM2_RX_GPCNT 0x364 ++ ++/* Received overflow error packet count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_OERCNT 0x368 ++ ++/* Received FCS error packet count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_FERCNT 0x36C ++ ++/* Received too short error packet count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_SERCNT 0x370 ++ ++/* Received too long error packet count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_LERCNT 0x374 ++ ++/* Received IP/TCP/UDP checksum error packet count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_CERCNT 0x378 ++ ++/* Received flow control pkt count for PPE GDM */ ++#define MT7620_MIB_STATS_GDM2_RX_FCCNT 0x37C ++ ++/* Tx Packet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_TGPCN 0x10 ++ ++/* Tx Bad Octet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_TBOCN 0x14 ++ ++/* Tx Good Octet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_TGOCN 0x18 ++ ++/* Tx Event Packet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_TEPCN 0x1C ++ ++/* Rx Packet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_RGPCN 0x20 ++ ++/* Rx Bad Octet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_RBOCN 0x24 ++ ++/* Rx Good Octet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_RGOCN 0x28 ++ ++/* Rx Event Packet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_REPC1N 0x2C ++ ++/* Rx Event Packet Counter of Port n */ ++#define MT7620_MIB_STATS_PORT_REPC2N 0x30 ++ ++#define MT7621_MIB_COUNTER_BASE 0x4000 ++#define MT7621_MIB_COUNTER_PORT_OFFSET 0x100 ++#define MT7621_STATS_TDPC 0x00 ++#define MT7621_STATS_TCRC 0x04 ++#define MT7621_STATS_TUPC 0x08 ++#define MT7621_STATS_TMPC 0x0C ++#define MT7621_STATS_TBPC 0x10 ++#define MT7621_STATS_TCEC 0x14 ++#define MT7621_STATS_TSCEC 0x18 ++#define MT7621_STATS_TMCEC 0x1C ++#define MT7621_STATS_TDEC 0x20 ++#define MT7621_STATS_TLCEC 0x24 ++#define MT7621_STATS_TXCEC 0x28 ++#define MT7621_STATS_TPPC 0x2C ++#define MT7621_STATS_TL64PC 0x30 ++#define MT7621_STATS_TL65PC 0x34 ++#define MT7621_STATS_TL128PC 0x38 ++#define MT7621_STATS_TL256PC 0x3C ++#define MT7621_STATS_TL512PC 0x40 ++#define MT7621_STATS_TL1024PC 0x44 ++#define MT7621_STATS_TOC 0x48 ++#define MT7621_STATS_RDPC 0x60 ++#define MT7621_STATS_RFPC 0x64 ++#define MT7621_STATS_RUPC 0x68 ++#define MT7621_STATS_RMPC 0x6C ++#define MT7621_STATS_RBPC 0x70 ++#define MT7621_STATS_RAEPC 0x74 ++#define MT7621_STATS_RCEPC 0x78 ++#define MT7621_STATS_RUSPC 0x7C ++#define MT7621_STATS_RFEPC 0x80 ++#define MT7621_STATS_ROSPC 0x84 ++#define MT7621_STATS_RJEPC 0x88 ++#define MT7621_STATS_RPPC 0x8C ++#define MT7621_STATS_RL64PC 0x90 ++#define MT7621_STATS_RL65PC 0x94 ++#define MT7621_STATS_RL128PC 0x98 ++#define MT7621_STATS_RL256PC 0x9C ++#define MT7621_STATS_RL512PC 0xA0 ++#define MT7621_STATS_RL1024PC 0xA4 ++#define MT7621_STATS_ROC 0xA8 ++#define MT7621_STATS_RDPC_CTRL 0xB0 ++#define MT7621_STATS_RDPC_ING 0xB4 ++#define MT7621_STATS_RDPC_ARL 0xB8 ++ ++int mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus, int vlan); ++ ++#endif +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1291,8 +1291,13 @@ static int __init fe_init(struct net_dev + } + + err = fe_hw_init(dev); +- if (!err) +- return 0; ++ if (err) ++ goto err_phy_disconnect; ++ ++ if ((priv->flags & FE_FLAG_HAS_SWITCH) && priv->soc->switch_config) ++ priv->soc->switch_config(priv); ++ ++ return 0; + + err_phy_disconnect: + if (priv->phy) +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -383,6 +383,7 @@ struct fe_soc_data { + int (*fwd_config)(struct fe_priv *priv); + void (*tx_dma)(struct fe_tx_dma *txd); + int (*switch_init)(struct fe_priv *priv); ++ int (*switch_config)(struct fe_priv *priv); + void (*port_init)(struct fe_priv *priv, struct device_node *port); + int (*has_carrier)(struct fe_priv *priv); + int (*mdio_init)(struct fe_priv *priv); +--- a/drivers/net/ethernet/mediatek/soc_mt7620.c ++++ b/drivers/net/ethernet/mediatek/soc_mt7620.c +@@ -313,6 +313,7 @@ static struct fe_soc_data mt7620_data = + .fwd_config = mt7620_fwd_config, + .tx_dma = mt7620_tx_dma, + .switch_init = mtk_gsw_init, ++ .switch_config = mt7620_gsw_config, + .port_init = mt7620_port_init, + .reg_table = mt7620_reg_table, + .pdma_glo_cfg = FE_PDMA_SIZE_16DWORDS, diff --git a/target/linux/ramips/patches-4.4/0514-net-mediatek-fix_esw.patch b/target/linux/ramips/patches-4.4/0514-net-mediatek-fix_esw.patch new file mode 100644 index 0000000000..de44a9f286 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0514-net-mediatek-fix_esw.patch @@ -0,0 +1,48 @@ +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + #include + +@@ -1332,7 +1333,6 @@ static int esw_probe(struct platform_dev + const __be32 *port_map, *reg_init; + struct switch_dev *swdev; + struct rt305x_esw *esw; +- struct resource *irq; + int ret; + + esw = devm_kzalloc(&pdev->dev, sizeof(*esw), GFP_KERNEL); +@@ -1340,7 +1340,7 @@ static int esw_probe(struct platform_dev + return -ENOMEM; + + esw->dev = &pdev->dev; +- esw->irq = irq->start; ++ esw->irq = irq_of_parse_and_map(np, 0); + esw->base = devm_ioremap_resource(&pdev->dev, res); + if (!esw->base) + return -EADDRNOTAVAIL; +@@ -1365,7 +1365,7 @@ static int esw_probe(struct platform_dev + ret = register_switch(swdev, NULL); + if (ret < 0) { + dev_err(&pdev->dev, "register_switch failed\n"); +- goto unmap_base; ++ return ret; + } + + platform_set_drvdata(pdev, esw); +@@ -1383,11 +1383,6 @@ static int esw_probe(struct platform_dev + } + + return ret; +- +-unmap_base: +- iounmap(esw->base); +- kfree(esw); +- return ret; + } + + static int esw_remove(struct platform_device *pdev) diff --git a/target/linux/ramips/patches-4.4/0515-net-mediatek-fix-multicast-icmpv6-for-the-rt3050-eth.patch b/target/linux/ramips/patches-4.4/0515-net-mediatek-fix-multicast-icmpv6-for-the-rt3050-eth.patch new file mode 100644 index 0000000000..66b65d8e19 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0515-net-mediatek-fix-multicast-icmpv6-for-the-rt3050-eth.patch @@ -0,0 +1,26 @@ +From: Vittorio Gambaletta +Date: Mon, 02 May 2016 04:55:48 +0200 +Subject: [PATCH] net: mediatek: Fix multicast ICMPv6 for the rt3050 ethernet switch. + +The FCT2 esw register should be set to 0x2500C to have "unknown IPv6 +multicast" packets broadcasted to every port, instead of dropped. +The previous value only let those packets go through ports 1 and 3. + +"Unknown IPv6 multicast" packets include packets needed by ICMPv6 echo +requests addressed to well-known addresses, such as ff02::1 (MAC address +is 33:33:00:00:00:01 in this case). + +Signed-off-by: Vittorio Gambaletta +--- + +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -450,7 +450,7 @@ static void esw_hw_init(struct rt305x_es + (RT305X_ESW_PORTS_NOCPU << RT305X_ESW_POC2_UNTAG_EN_S)), + RT305X_ESW_REG_POC2); + +- esw_w32(esw, 0x00d6500c, RT305X_ESW_REG_FCT2); ++ esw_w32(esw, 0x0002500c, RT305X_ESW_REG_FCT2); + + /* 300s aging timer, max packet len 1536, broadcast storm prevention + * disabled, disable collision abort, mac xor48 hash, 10 packet back diff --git a/target/linux/ramips/patches-4.4/0516-Documentation-DT-net-mediatek-fix-documentation-for-.patch b/target/linux/ramips/patches-4.4/0516-Documentation-DT-net-mediatek-fix-documentation-for-.patch new file mode 100644 index 0000000000..7aa4943e8e --- /dev/null +++ b/target/linux/ramips/patches-4.4/0516-Documentation-DT-net-mediatek-fix-documentation-for-.patch @@ -0,0 +1,23 @@ +From: Vittorio Gambaletta +Date: Fri, 01 Jan 2016 00:00:00 +0100 +Subject: [PATCH 1/3] Documentation: DT: net: mediatek: Fix documentation for the rt3050 switch driver. + +The prefix used in the driver is now "mediatek" instead of "ralink". + +Signed-off-by: Vittorio Gambaletta +--- + +--- a/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt ++++ b/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt +@@ -14,9 +14,9 @@ Required properties: + - reset-names: Should contain the reset names "esw" + + Optional properties: +-- ralink,portmap: can be used to choose if the default switch setup is ++- mediatek,portmap: can be used to choose if the default switch setup is + llllw or wllll +-- ralink,led_polarity: override the active high/low settings of the leds ++- mediatek,led_polarity: override the active high/low settings of the leds + + Example: + diff --git a/target/linux/ramips/patches-4.4/0517-net-mediatek-fix-comment-in-rt3050-ethernet-switch-d.patch b/target/linux/ramips/patches-4.4/0517-net-mediatek-fix-comment-in-rt3050-ethernet-switch-d.patch new file mode 100644 index 0000000000..aefb6a5cc2 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0517-net-mediatek-fix-comment-in-rt3050-ethernet-switch-d.patch @@ -0,0 +1,24 @@ +From: Vittorio Gambaletta +Date: Fri, 01 Jan 2016 00:00:01 +0100 +Subject: [PATCH 2/3] net: mediatek: Fix comment in rt3050 ethernet switch driver. + +Line 444 is actually enabling all switch ports by setting the disable bits +to 0. This needs to be done because the bootloader sets all ports to disabled +by default (which is the case for at least one router based on RT5350). + +So, this patch fixes the comment in line 443. + +Signed-off-by: Vittorio Gambaletta +--- + +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -440,7 +440,7 @@ static void esw_hw_init(struct rt305x_es + (RT305X_ESW_PORTS_ALL << RT305X_ESW_PFC1_EN_VLAN_S), + RT305X_ESW_REG_PFC1); + +- /* Enable Back Pressure, and Flow Control */ ++ /* Enable all ports, Back Pressure and Flow Control */ + esw_w32(esw, ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_BP_S) | + (RT305X_ESW_PORTS_ALL << RT305X_ESW_POC0_EN_FC_S)), + RT305X_ESW_REG_POC0); diff --git a/target/linux/ramips/patches-4.4/0518-net-mediatek-get-rt3050-ethernet-ports-to-be-disable.patch b/target/linux/ramips/patches-4.4/0518-net-mediatek-get-rt3050-ethernet-ports-to-be-disable.patch new file mode 100644 index 0000000000..54448bd505 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0518-net-mediatek-get-rt3050-ethernet-ports-to-be-disable.patch @@ -0,0 +1,81 @@ +From: Vittorio Gambaletta +Date: Fri, 01 Jan 2016 00:00:02 +0100 +Subject: [PATCH 3/3] net: mediatek: Get rt3050 ethernet ports to be disabled from the device tree. + +This patch allows configuring ports to be disabled in the device tree; this +saves power, since disabling ports here actually disables power to ethernet +PHYs. + +Line 444 enables all ethernet ports, so line 487 is getting zero ports to be +disabled, except for port 5 in SoCs where this is not implemented as it will +be sticky disabled in register POC0. Because of this, the code will still read +the switch configuration and OR it to the device tree setting. + +Signed-off-by: Vittorio Gambaletta +--- + +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -10,6 +10,7 @@ + * Copyright (C) 2009-2015 John Crispin + * Copyright (C) 2009-2015 Felix Fietkau + * Copyright (C) 2013-2015 Michael Lee ++ * Copyright (C) 2016 Vittorio Gambaletta + */ + + #include +@@ -219,6 +220,7 @@ struct rt305x_esw { + spinlock_t reg_rw_lock; + + unsigned char port_map; ++ unsigned char port_disable; + unsigned int reg_led_polarity; + + struct switch_dev swdev; +@@ -483,8 +485,14 @@ static void esw_hw_init(struct rt305x_es + esw_w32(esw, 0x00000005, RT305X_ESW_REG_P3LED); + esw_w32(esw, 0x00000005, RT305X_ESW_REG_P4LED); + +- /* Copy disabled port configuration from bootloader setup */ +- port_disable = esw_get_port_disable(esw); ++ /* Copy disabled port configuration from device tree setup */ ++ port_disable = esw->port_disable; ++ ++ /* Disable nonexistent ports by reading the switch config ++ * after having enabled all possible ports above ++ */ ++ port_disable |= esw_get_port_disable(esw); ++ + for (i = 0; i < 6; i++) + esw->ports[i].disable = (port_disable & (1 << i)) != 0; + +@@ -1330,7 +1338,7 @@ static int esw_probe(struct platform_dev + { + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct device_node *np = pdev->dev.of_node; +- const __be32 *port_map, *reg_init; ++ const __be32 *port_map, *port_disable, *reg_init; + struct switch_dev *swdev; + struct rt305x_esw *esw; + int ret; +@@ -1349,6 +1357,10 @@ static int esw_probe(struct platform_dev + if (port_map) + esw->port_map = be32_to_cpu(*port_map); + ++ port_disable = of_get_property(np, "mediatek,portdisable", NULL); ++ if (port_disable) ++ esw->port_disable = be32_to_cpu(*port_disable); ++ + reg_init = of_get_property(np, "mediatek,led_polarity", NULL); + if (reg_init) + esw->reg_led_polarity = be32_to_cpu(*reg_init); +--- a/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt ++++ b/Documentation/devicetree/bindings/net/ralink,rt3050-esw.txt +@@ -16,6 +16,7 @@ Required properties: + Optional properties: + - mediatek,portmap: can be used to choose if the default switch setup is + llllw or wllll ++- mediatek,portdisable: disable unused ethernet PHYs to save power + - mediatek,led_polarity: override the active high/low settings of the leds + + Example: diff --git a/target/linux/ramips/patches-4.4/0519-gsw_mt7621.patch b/target/linux/ramips/patches-4.4/0519-gsw_mt7621.patch new file mode 100644 index 0000000000..c8fbc6404c --- /dev/null +++ b/target/linux/ramips/patches-4.4/0519-gsw_mt7621.patch @@ -0,0 +1,31 @@ +--- a/drivers/net/ethernet/mediatek/mt7530.c ++++ b/drivers/net/ethernet/mediatek/mt7530.c +@@ -543,6 +543,7 @@ mt7530_apply_config(struct switch_dev *d + u8 etags = priv->vlan_entries[i].etags; + u32 val; + ++#ifndef CONFIG_SOC_MT7621 + /* vid of vlan */ + val = mt7530_r32(priv, REG_ESW_VLAN_VTIM(i)); + if (i % 2 == 0) { +@@ -553,7 +554,7 @@ mt7530_apply_config(struct switch_dev *d + val |= (vid << 12); + } + mt7530_w32(priv, REG_ESW_VLAN_VTIM(i), val); +- ++#endif + /* vlan port membership */ + if (member) + mt7530_w32(priv, REG_ESW_VLAN_VAWD1, REG_ESW_VLAN_VAWD1_IVL_MAC | +@@ -573,7 +574,11 @@ mt7530_apply_config(struct switch_dev *d + mt7530_w32(priv, REG_ESW_VLAN_VAWD2, val); + + /* write to vlan table */ ++#ifdef CONFIG_SOC_MT7621 ++ mt7530_vtcr(priv, 1, vid); ++#else + mt7530_vtcr(priv, 1, i); ++#endif + } + + /* Port Default PVID */ diff --git a/target/linux/ramips/patches-4.4/0520-esw-gmac.patch b/target/linux/ramips/patches-4.4/0520-esw-gmac.patch new file mode 100644 index 0000000000..ae5fa16d66 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0520-esw-gmac.patch @@ -0,0 +1,69 @@ +--- a/drivers/net/ethernet/mediatek/esw_rt3050.c ++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c +@@ -221,6 +221,8 @@ struct rt305x_esw { + + unsigned char port_map; + unsigned char port_disable; ++ unsigned int reg_initval_fct2; ++ unsigned int reg_initval_fpa2; + unsigned int reg_led_polarity; + + struct switch_dev swdev; +@@ -452,7 +454,10 @@ static void esw_hw_init(struct rt305x_es + (RT305X_ESW_PORTS_NOCPU << RT305X_ESW_POC2_UNTAG_EN_S)), + RT305X_ESW_REG_POC2); + +- esw_w32(esw, 0x0002500c, RT305X_ESW_REG_FCT2); ++ if (esw->reg_initval_fct2) ++ esw_w32(esw, esw->reg_initval_fct2, RT305X_ESW_REG_FCT2); ++ else ++ esw_w32(esw, 0x0002500c, RT305X_ESW_REG_FCT2); + + /* 300s aging timer, max packet len 1536, broadcast storm prevention + * disabled, disable collision abort, mac xor48 hash, 10 packet back +@@ -475,7 +480,10 @@ static void esw_hw_init(struct rt305x_es + * port5: disabled + * port6: enabled, gige, full-duplex, rx/tx-flow-control + */ +- esw_w32(esw, 0x3f502b28, RT305X_ESW_REG_FPA2); ++ if (esw->reg_initval_fpa2) ++ esw_w32(esw, esw->reg_initval_fpa2, RT305X_ESW_REG_FPA2); ++ else ++ esw_w32(esw, 0x3f502b28, RT305X_ESW_REG_FPA2); + esw_w32(esw, 0x00000000, RT305X_ESW_REG_FPA); + + /* Force Link/Activity on ports */ +@@ -1361,6 +1369,14 @@ static int esw_probe(struct platform_dev + if (port_disable) + esw->port_disable = be32_to_cpu(*port_disable); + ++ reg_init = of_get_property(np, "ralink,fct2", NULL); ++ if (reg_init) ++ esw->reg_initval_fct2 = be32_to_cpu(*reg_init); ++ ++ reg_init = of_get_property(np, "ralink,fpa2", NULL); ++ if (reg_init) ++ esw->reg_initval_fpa2 = be32_to_cpu(*reg_init); ++ + reg_init = of_get_property(np, "mediatek,led_polarity", NULL); + if (reg_init) + esw->reg_led_polarity = be32_to_cpu(*reg_init); +@@ -1386,6 +1402,18 @@ static int esw_probe(struct platform_dev + + esw_hw_init(esw); + ++ reg_init = of_get_property(np, "ralink,rgmii", NULL); ++ if (reg_init && be32_to_cpu(*reg_init) == 1) { ++ /* ++ * External switch connected to RGMII interface. ++ * Unregister the switch device after initialization. ++ */ ++ dev_err(&pdev->dev, "RGMII mode, not exporting switch device.\n"); ++ unregister_switch(&esw->swdev); ++ platform_set_drvdata(pdev, NULL); ++ return -ENODEV; ++ } ++ + ret = devm_request_irq(&pdev->dev, esw->irq, esw_interrupt, 0, "esw", + esw); + diff --git a/target/linux/ramips/patches-4.4/0601-net-mediatke-add-phy_ethtool_ioctl-support.patch b/target/linux/ramips/patches-4.4/0601-net-mediatke-add-phy_ethtool_ioctl-support.patch new file mode 100644 index 0000000000..11cf7ee588 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0601-net-mediatke-add-phy_ethtool_ioctl-support.patch @@ -0,0 +1,22 @@ +From 3c550ae0359be5bc4d5daa86a62f711a91ac8dde Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 13 Dec 2015 17:46:09 +0100 +Subject: [PATCH 2/2] net:mediatke: add phy_ethtool_ioctl() support + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1327,6 +1327,9 @@ static int fe_do_ioctl(struct net_device + return -ENODEV; + + switch (cmd) { ++ case SIOCETHTOOL: ++ return phy_ethtool_ioctl(priv->phy_dev, ++ (void *) ifr->ifr_data); + case SIOCGMIIPHY: + case SIOCGMIIREG: + case SIOCSMIIREG: diff --git a/target/linux/ramips/patches-4.4/0700-pinctrl-mt7620-mdio-as-refclk.patch b/target/linux/ramips/patches-4.4/0700-pinctrl-mt7620-mdio-as-refclk.patch new file mode 100644 index 0000000000..b99363f798 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0700-pinctrl-mt7620-mdio-as-refclk.patch @@ -0,0 +1,42 @@ +--- a/arch/mips/include/asm/mach-ralink/mt7620.h ++++ b/arch/mips/include/asm/mach-ralink/mt7620.h +@@ -114,9 +114,14 @@ + #define MT7620_GPIO_MODE_WDT_MASK 0x3 + #define MT7620_GPIO_MODE_WDT_SHIFT 21 + ++#define MT7620_GPIO_MODE_MDIO 0 ++#define MT7620_GPIO_MODE_MDIO_REFCLK 1 ++#define MT7620_GPIO_MODE_MDIO_GPIO 2 ++#define MT7620_GPIO_MODE_MDIO_MASK 0x3 ++#define MT7620_GPIO_MODE_MDIO_SHIFT 7 ++ + #define MT7620_GPIO_MODE_I2C 0 + #define MT7620_GPIO_MODE_UART1 5 +-#define MT7620_GPIO_MODE_MDIO 8 + #define MT7620_GPIO_MODE_RGMII1 9 + #define MT7620_GPIO_MODE_RGMII2 10 + #define MT7620_GPIO_MODE_SPI 11 +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -55,7 +55,10 @@ static int dram_type; + static struct rt2880_pmx_func i2c_grp[] = { FUNC("i2c", 0, 1, 2) }; + static struct rt2880_pmx_func spi_grp[] = { FUNC("spi", 0, 3, 4) }; + static struct rt2880_pmx_func uartlite_grp[] = { FUNC("uartlite", 0, 15, 2) }; +-static struct rt2880_pmx_func mdio_grp[] = { FUNC("mdio", 0, 22, 2) }; ++static struct rt2880_pmx_func mdio_grp[] = { ++ FUNC("mdio", MT7620_GPIO_MODE_MDIO, 22, 2), ++ FUNC("refclk", MT7620_GPIO_MODE_MDIO_REFCLK, 22, 2), ++}; + static struct rt2880_pmx_func rgmii1_grp[] = { FUNC("rgmii1", 0, 24, 12) }; + static struct rt2880_pmx_func refclk_grp[] = { FUNC("spi refclk", 0, 37, 3) }; + static struct rt2880_pmx_func ephy_grp[] = { FUNC("ephy", 0, 40, 5) }; +@@ -92,7 +95,8 @@ static struct rt2880_pmx_group mt7620a_p + GRP("uartlite", uartlite_grp, 1, MT7620_GPIO_MODE_UART1), + GRP_G("wdt", wdt_grp, MT7620_GPIO_MODE_WDT_MASK, + MT7620_GPIO_MODE_WDT_GPIO, MT7620_GPIO_MODE_WDT_SHIFT), +- GRP("mdio", mdio_grp, 1, MT7620_GPIO_MODE_MDIO), ++ GRP_G("mdio", mdio_grp, MT7620_GPIO_MODE_MDIO_MASK, ++ MT7620_GPIO_MODE_MDIO_GPIO, MT7620_GPIO_MODE_MDIO_SHIFT), + GRP("rgmii1", rgmii1_grp, 1, MT7620_GPIO_MODE_RGMII1), + GRP("spi refclk", refclk_grp, 1, MT7620_GPIO_MODE_SPI_REF_CLK), + GRP_G("pcie", pcie_rst_grp, MT7620_GPIO_MODE_PCIE_MASK, diff --git a/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch b/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch new file mode 100644 index 0000000000..e9e72ad11a --- /dev/null +++ b/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch @@ -0,0 +1,67 @@ +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -513,6 +513,7 @@ void __init ralink_clk_init(void) + unsigned long sys_rate; + unsigned long dram_rate; + unsigned long periph_rate; ++ unsigned long pcmi2s_rate; + + xtal_rate = mt7620_get_xtal_rate(); + +@@ -527,6 +528,7 @@ void __init ralink_clk_init(void) + cpu_rate = MHZ(575); + dram_rate = sys_rate = cpu_rate / 3; + periph_rate = MHZ(40); ++ pcmi2s_rate = MHZ(480); + + ralink_clk_add("10000d00.uartlite", periph_rate); + ralink_clk_add("10000e00.uartlite", periph_rate); +@@ -538,6 +540,7 @@ void __init ralink_clk_init(void) + dram_rate = mt7620_get_dram_rate(pll_rate); + sys_rate = mt7620_get_sys_rate(cpu_rate); + periph_rate = mt7620_get_periph_rate(xtal_rate); ++ pcmi2s_rate = periph_rate; + + pr_debug(RFMT("XTAL") RFMT("CPU_PLL") RFMT("PLL"), + RINT(xtal_rate), RFRAC(xtal_rate), +@@ -559,6 +562,8 @@ void __init ralink_clk_init(void) + ralink_clk_add("cpu", cpu_rate); + ralink_clk_add("10000100.timer", periph_rate); + ralink_clk_add("10000120.watchdog", periph_rate); ++ ralink_clk_add("10000900.i2c", periph_rate); ++ ralink_clk_add("10000a00.i2s", pcmi2s_rate); + ralink_clk_add("10000b00.spi", sys_rate); + ralink_clk_add("10000b40.spi", sys_rate); + ralink_clk_add("10000c00.uartlite", periph_rate); +--- a/arch/mips/ralink/rt288x.c ++++ b/arch/mips/ralink/rt288x.c +@@ -75,6 +75,7 @@ void __init ralink_clk_init(void) + ralink_clk_add("300100.timer", cpu_rate / 2); + ralink_clk_add("300120.watchdog", cpu_rate / 2); + ralink_clk_add("300500.uart", cpu_rate / 2); ++ ralink_clk_add("300900.i2c", cpu_rate / 2); + ralink_clk_add("300c00.uartlite", cpu_rate / 2); + ralink_clk_add("400000.ethernet", cpu_rate / 2); + ralink_clk_add("480000.wmac", wmac_rate); +--- a/arch/mips/ralink/rt305x.c ++++ b/arch/mips/ralink/rt305x.c +@@ -200,6 +200,8 @@ void __init ralink_clk_init(void) + + ralink_clk_add("cpu", cpu_rate); + ralink_clk_add("sys", sys_rate); ++ ralink_clk_add("10000900.i2c", uart_rate); ++ ralink_clk_add("10000a00.i2s", uart_rate); + ralink_clk_add("10000b00.spi", sys_rate); + ralink_clk_add("10000b40.spi", sys_rate); + ralink_clk_add("10000100.timer", wdt_rate); +--- a/arch/mips/ralink/rt3883.c ++++ b/arch/mips/ralink/rt3883.c +@@ -108,6 +108,8 @@ void __init ralink_clk_init(void) + ralink_clk_add("10000100.timer", sys_rate); + ralink_clk_add("10000120.watchdog", sys_rate); + ralink_clk_add("10000500.uart", 40000000); ++ ralink_clk_add("10000900.i2c", 40000000); ++ ralink_clk_add("10000a00.i2s", 40000000); + ralink_clk_add("10000b00.spi", sys_rate); + ralink_clk_add("10000b40.spi", sys_rate); + ralink_clk_add("10000c00.uartlite", 40000000); diff --git a/target/linux/ramips/patches-4.4/0721-asoc-enable-wm8960-kconfig.patch b/target/linux/ramips/patches-4.4/0721-asoc-enable-wm8960-kconfig.patch new file mode 100644 index 0000000000..6272b71607 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0721-asoc-enable-wm8960-kconfig.patch @@ -0,0 +1,11 @@ +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -825,7 +825,7 @@ config SND_SOC_WM8955 + tristate + + config SND_SOC_WM8960 +- tristate ++ tristate "Wolfson Microelectronics WM8960 CODEC" + + config SND_SOC_WM8961 + tristate diff --git a/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch b/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch new file mode 100644 index 0000000000..e4853a8c51 --- /dev/null +++ b/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch @@ -0,0 +1,43 @@ +From 8b61a1a33e41456ebeafa0ebe7ec0fccf859861e Mon Sep 17 00:00:00 2001 +From: Nikolay Martynov +Date: Wed, 25 Nov 2015 20:43:46 -0500 +Subject: [PATCH] mtd: nand: Fix Spansion sparearea size detection + +According to datasheet S34ML02G2 and S34ML04G2 have +larger sparea area size than was detected. + +Signed-off-by: Nikolay Martynov +--- + drivers/mtd/nand/nand_base.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -3568,6 +3568,7 @@ static void nand_decode_ext_id(struct mt + /* + * Field definitions are in the following datasheets: + * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32) ++ * Spansion S34ML02G2 (p.33) + * New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44) + * Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22) + * +@@ -3665,6 +3666,19 @@ static void nand_decode_ext_id(struct mt + *busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0; + + /* ++ * Spansion S34ML0[24]G2 have oobsize twice as large ++ * as S34ML01G2 encoded in the same bit. We ++ * differinciate them by their ID length ++ */ ++ if (id_data[0] == NAND_MFR_AMD ++ && (id_data[1] == 0xda ++ || id_data[1] == 0xdc ++ || id_data[1] == 0xca ++ || id_data[1] == 0xcc)) { ++ mtd->oobsize *= 2; ++ } ++ ++ /* + * Toshiba 24nm raw SLC (i.e., not BENAND) have 32B OOB per + * 512B page. For Toshiba SLC, we decode the 5th/6th byte as + * follows: diff --git a/target/linux/ramips/patches-4.4/100-mt7621-core-detect-hack.patch b/target/linux/ramips/patches-4.4/100-mt7621-core-detect-hack.patch new file mode 100644 index 0000000000..4049d131bb --- /dev/null +++ b/target/linux/ramips/patches-4.4/100-mt7621-core-detect-hack.patch @@ -0,0 +1,61 @@ +There is a variant of MT7621 which contains only one CPU core instead of 2. +This is not reflected in the config register, so the kernel detects more +physical cores, which leads to a hang on SMP bringup. +Add a hack to detect missing cores. + +Signed-off-by: Felix Fietkau + +--- a/arch/mips/kernel/smp-cps.c ++++ b/arch/mips/kernel/smp-cps.c +@@ -44,6 +44,11 @@ static unsigned core_vpe_count(unsigned + return (cfg >> CM_GCR_Cx_CONFIG_PVPE_SHF) + 1; + } + ++bool __weak plat_cpu_core_present(int core) ++{ ++ return true; ++} ++ + static void __init cps_smp_setup(void) + { + unsigned int ncores, nvpes, core_vpes; +@@ -53,6 +58,8 @@ static void __init cps_smp_setup(void) + ncores = mips_cm_numcores(); + pr_info("VPE topology "); + for (c = nvpes = 0; c < ncores; c++) { ++ if (!plat_cpu_core_present(c)) ++ continue; + core_vpes = core_vpe_count(c); + pr_cont("%c%u", c ? ',' : '{', core_vpes); + +--- a/arch/mips/ralink/mt7621.c ++++ b/arch/mips/ralink/mt7621.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include + +@@ -163,6 +164,20 @@ void __init ralink_of_remap(void) + panic("Failed to remap core resources"); + } + ++bool plat_cpu_core_present(int core) ++{ ++ struct cpulaunch *launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH); ++ ++ if (!core) ++ return true; ++ launch += core * 2; /* 2 VPEs per core */ ++ if (!(launch->flags & LAUNCH_FREADY)) ++ return false; ++ if (launch->flags & (LAUNCH_FGO | LAUNCH_FGONE)) ++ return false; ++ return true; ++} ++ + void prom_soc_init(struct ralink_soc_info *soc_info) + { + void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE); diff --git a/target/linux/ramips/rt288x/config-4.4 b/target/linux/ramips/rt288x/config-4.4 new file mode 100644 index 0000000000..5f29322874 --- /dev/null +++ b/target/linux/ramips/rt288x/config-4.4 @@ -0,0 +1,204 @@ +CONFIG_ARCH_BINFMT_ELF_STATE=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=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_REQUIRE_GPIOLIB=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_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CEVT_R4K=y +# CONFIG_CEVT_SYSTICK_QUIRK is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE 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 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_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CSRC_R4K=y +CONFIG_DMA_NONCOHERENT=y +# CONFIG_DTB_RT2880_EVAL is not set +CONFIG_DTB_RT_NONE=y +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=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_DEVRES=y +CONFIG_GPIO_RALINK=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_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_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_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MACH_CLKDEV=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_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HW_HAS_PCI=y +CONFIG_HZ_PERIODIC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IP17XX_PHY=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_INTC=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_LIBFDT=y +CONFIG_MDIO_BOARDINFO=y +CONFIG_MIPS=y +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=4 +CONFIG_MIPS_L1_CACHE_SHIFT_4=y +# CONFIG_MIPS_MACHINE is not set +CONFIG_MIPS_NO_APPENDED_DTB=y +# CONFIG_MIPS_RAW_APPENDED_DTB is not set +CONFIG_MIPS_SPRAM=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_M25P80=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_LZMA_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_MEDIATEK_MDIO=y +CONFIG_NET_MEDIATEK_MDIO_RT2880=y +CONFIG_NET_MEDIATEK_RT2880=y +CONFIG_NET_MEDIATEK_SOC=y +CONFIG_NET_VENDOR_MEDIATEK=y +# CONFIG_NO_IOPORT_MAP is not set +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_MTD=y +CONFIG_OF_NET=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +# CONFIG_PHY_RALINK_USB is not set +CONFIG_PINCTRL=y +CONFIG_PINCTRL_RT2880=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_RALINK=y +CONFIG_RALINK_WDT=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_SCHED_HRTICK=y +# CONFIG_SCHED_INFO is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250_FSL is not set +CONFIG_SERIAL_8250_RT288X=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SOC_MT7620 is not set +# CONFIG_SOC_MT7621 is not set +CONFIG_SOC_RT288X=y +# CONFIG_SOC_RT305X is not set +# CONFIG_SOC_RT3883 is not set +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +# CONFIG_SPI_MT7621 is not set +CONFIG_SPI_RT2880=y +CONFIG_SRCU=y +CONFIG_SWCONFIG=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_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_MIPS16=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB=m +CONFIG_USB_COMMON=m +CONFIG_USB_EHCI_HCD=m +CONFIG_USB_EHCI_HCD_PLATFORM=m +CONFIG_USB_EHCI_PCI=m +CONFIG_USB_OHCI_HCD=m +CONFIG_USB_OHCI_HCD_PCI=m +CONFIG_USB_OHCI_HCD_PLATFORM=m +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y +CONFIG_WATCHDOG_CORE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/ramips/rt288x/target.mk b/target/linux/ramips/rt288x/target.mk new file mode 100644 index 0000000000..1e20e51ed2 --- /dev/null +++ b/target/linux/ramips/rt288x/target.mk @@ -0,0 +1,14 @@ +# +# Copyright (C) 2009 OpenWrt.org +# + +SUBTARGET:=rt288x +BOARDNAME:=RT288x based boards +CPU_TYPE:=mips32r2 + +DEFAULT_PACKAGES += kmod-rt2800-soc + +define Target/Description + Build firmware images for Ralink RT288x based boards. +endef + diff --git a/target/linux/ramips/rt305x/config-4.4 b/target/linux/ramips/rt305x/config-4.4 new file mode 100644 index 0000000000..b8f6cda469 --- /dev/null +++ b/target/linux/ramips/rt305x/config-4.4 @@ -0,0 +1,195 @@ +CONFIG_ARCH_BINFMT_ELF_STATE=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=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_REQUIRE_GPIOLIB=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_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CEVT_R4K=y +CONFIG_CEVT_SYSTICK_QUIRK=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKEVT_RT3352=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE 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 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_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CSRC_R4K=y +CONFIG_DEBUG_PINCTRL=y +CONFIG_DMA_NONCOHERENT=y +# CONFIG_DTB_RT305X_EVAL is not set +CONFIG_DTB_RT_NONE=y +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=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_PHY=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_RALINK=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_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_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_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MACH_CLKDEV=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_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HZ_PERIODIC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_INTC=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_LIBFDT=y +CONFIG_MDIO_BOARDINFO=y +CONFIG_MIPS=y +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_NO_APPENDED_DTB=y +# CONFIG_MIPS_RAW_APPENDED_DTB is not set +CONFIG_MIPS_SPRAM=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_M25P80=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_SEAMA_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_MEDIATEK_ESW_RT3050=y +CONFIG_NET_MEDIATEK_RT3050=y +CONFIG_NET_MEDIATEK_SOC=y +CONFIG_NET_VENDOR_MEDIATEK=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_MTD=y +CONFIG_OF_NET=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHY_RALINK_USB=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_RT2880=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_RALINK=y +# CONFIG_RALINK_ILL_ACC is not set +CONFIG_RALINK_WDT=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_SCHED_HRTICK=y +# CONFIG_SCHED_INFO is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250_FSL is not set +CONFIG_SERIAL_8250_RT288X=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SOC_MT7620 is not set +# CONFIG_SOC_MT7621 is not set +# CONFIG_SOC_RT288X is not set +CONFIG_SOC_RT305X=y +# CONFIG_SOC_RT3883 is not set +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +# CONFIG_SPI_MT7621 is not set +CONFIG_SPI_RT2880=y +CONFIG_SRCU=y +CONFIG_SWCONFIG=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_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_MIPS16=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y +CONFIG_WATCHDOG_CORE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/ramips/rt305x/profiles/00-default.mk b/target/linux/ramips/rt305x/profiles/00-default.mk new file mode 100644 index 0000000000..a8ca71610c --- /dev/null +++ b/target/linux/ramips/rt305x/profiles/00-default.mk @@ -0,0 +1,19 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Default + NAME:=Default Profile + PRIORITY:=1 + PACKAGES:=\ + kmod-usb-core kmod-usb-dwc2 \ + kmod-usb-ledtrig-usbport +endef + +define Profile/Default/Description + Default package set compatible with most boards. +endef +$(eval $(call Profile,Default)) diff --git a/target/linux/ramips/rt305x/target.mk b/target/linux/ramips/rt305x/target.mk new file mode 100644 index 0000000000..6cdb4906a7 --- /dev/null +++ b/target/linux/ramips/rt305x/target.mk @@ -0,0 +1,15 @@ +# +# Copyright (C) 2009 OpenWrt.org +# + +SUBTARGET:=rt305x +BOARDNAME:=RT3x5x/RT5350 based boards +FEATURES+=usb ramdisk +CPU_TYPE:=24kc + +DEFAULT_PACKAGES += kmod-rt2800-soc + +define Target/Description + Build firmware images for Ralink RT3x5x/RT5350 based boards. +endef + diff --git a/target/linux/ramips/rt3883/config-4.4 b/target/linux/ramips/rt3883/config-4.4 new file mode 100644 index 0000000000..93df68771c --- /dev/null +++ b/target/linux/ramips/rt3883/config-4.4 @@ -0,0 +1,203 @@ +CONFIG_AR8216_PHY=y +CONFIG_ARCH_BINFMT_ELF_STATE=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=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_REQUIRE_GPIOLIB=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_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CEVT_R4K=y +# CONFIG_CEVT_SYSTICK_QUIRK is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE 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 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_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CSRC_R4K=y +CONFIG_DEBUG_PINCTRL=y +CONFIG_DMA_NONCOHERENT=y +# CONFIG_DTB_RT3883_EVAL is not set +CONFIG_DTB_RT_NONE=y +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=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_PHY=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_RALINK=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_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_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_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MACH_CLKDEV=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_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HW_HAS_PCI=y +CONFIG_HZ_PERIODIC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_INTC=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_LIBFDT=y +CONFIG_MDIO_BOARDINFO=y +CONFIG_MIPS=y +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_NO_APPENDED_DTB=y +# CONFIG_MIPS_RAW_APPENDED_DTB is not set +CONFIG_MIPS_SPRAM=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_M25P80=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_SEAMA_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_MEDIATEK_MDIO=y +CONFIG_NET_MEDIATEK_MDIO_RT2880=y +CONFIG_NET_MEDIATEK_RT3883=y +CONFIG_NET_MEDIATEK_SOC=y +CONFIG_NET_VENDOR_MEDIATEK=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +# CONFIG_NO_IOPORT_MAP is not set +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_MTD=y +CONFIG_OF_NET=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHY_RALINK_USB=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_RT2880=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_RALINK=y +CONFIG_RALINK_WDT=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_RTL8366_SMI=y +CONFIG_RTL8367B_PHY=y +CONFIG_RTL8367_PHY=y +CONFIG_SCHED_HRTICK=y +# CONFIG_SCHED_INFO is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250_FSL is not set +CONFIG_SERIAL_8250_RT288X=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SOC_MT7620 is not set +# CONFIG_SOC_MT7621 is not set +# CONFIG_SOC_RT288X is not set +# CONFIG_SOC_RT305X is not set +CONFIG_SOC_RT3883=y +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +# CONFIG_SPI_MT7621 is not set +CONFIG_SPI_RT2880=y +CONFIG_SRCU=y +CONFIG_SWCONFIG=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_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_MIPS16=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y +CONFIG_WATCHDOG_CORE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/sunxi/profiles/01-default.mk b/target/linux/ramips/rt3883/profiles/00-default.mk similarity index 68% rename from target/linux/sunxi/profiles/01-default.mk rename to target/linux/ramips/rt3883/profiles/00-default.mk index 7d83440220..c99029d7b1 100644 --- a/target/linux/sunxi/profiles/01-default.mk +++ b/target/linux/ramips/rt3883/profiles/00-default.mk @@ -1,17 +1,17 @@ # -# Copyright (C) 2013 OpenWrt.org +# Copyright (C) 2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # define Profile/Default - NAME:=Default package set - PACKAGES += uboot-sunxi-A13-OLinuXino + NAME:=Default Profile + PRIORITY:=1 + PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig endef define Profile/Default/Description Default package set compatible with most boards. endef $(eval $(call Profile,Default)) - diff --git a/target/linux/ramips/rt3883/target.mk b/target/linux/ramips/rt3883/target.mk new file mode 100644 index 0000000000..6ae4e7820d --- /dev/null +++ b/target/linux/ramips/rt3883/target.mk @@ -0,0 +1,15 @@ +# +# Copyright (C) 2011 OpenWrt.org +# + +SUBTARGET:=rt3883 +BOARDNAME:=RT3662/RT3883 based boards +FEATURES+=usb pci +CPU_TYPE:=74kc + +DEFAULT_PACKAGES += kmod-rt2800-pci kmod-rt2800-soc + +define Target/Description + Build firmware images for Ralink RT3662/RT3883 based boards. +endef + diff --git a/target/linux/sunxi/Makefile b/target/linux/sunxi/Makefile index cca3a14896..b0bc1bab39 100644 --- a/target/linux/sunxi/Makefile +++ b/target/linux/sunxi/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=sunxi BOARDNAME:=Allwinner A1x/A20/A3x -FEATURES:=fpu usb ext4 display rtc +FEATURES:=fpu usb ext4 display rtc squashfs CPU_TYPE:=cortex-a8 CPU_SUBTYPE:=vfpv3 MAINTAINER:=Zoltan HERPAI @@ -28,5 +28,6 @@ KERNELNAME:=zImage dtbs include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += uboot-envtools kmod-eeprom-sunxi kmod-wdt-sunxi +DEFAULT_PACKAGES += mkf2fs e2fsprogs $(eval $(call BuildTarget)) diff --git a/target/linux/sunxi/base-files/etc/board.d/02_network b/target/linux/sunxi/base-files/etc/board.d/02_network index 74fa2a0e6d..2b18748c6f 100755 --- a/target/linux/sunxi/base-files/etc/board.d/02_network +++ b/target/linux/sunxi/base-files/etc/board.d/02_network @@ -9,10 +9,10 @@ board_config_update case "$( sunxi_board_name )" in -"olinuxino-micro"*) +"olimex,a20-olinuxino-micro") ucidef_set_interface_lan 'wlan0' ;; -"lamobo-r1") +"lamobo,lamobo-r1") ucidef_add_switch "switch0" \ "4:lan:1" "0:lan:2" "1:lan:3" "2:lan:4" "3:wan" "8@eth0" ;; diff --git a/target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh b/target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh deleted file mode 100644 index f221dbc582..0000000000 --- a/target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -do_sunxi() { - . /lib/sunxi.sh - - sunxi_board_detect -} - -boot_hook_add preinit_main do_sunxi diff --git a/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh b/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh index 84070de3eb..7f508ff918 100644 --- a/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh +++ b/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh @@ -4,7 +4,7 @@ do_b53_hack() { # hack: enable switch on Lamobo R1 and reset counters case "$( sunxi_board_name )" in - "lamobo-r1") + "lamobo,lamobo-r1") ifconfig eth0 up sleep 1 swconfig dev switch0 set reset 1 diff --git a/target/linux/sunxi/base-files/lib/preinit/79_move_config b/target/linux/sunxi/base-files/lib/preinit/79_move_config new file mode 100644 index 0000000000..c112588689 --- /dev/null +++ b/target/linux/sunxi/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/sunxi/base-files/lib/sunxi.sh b/target/linux/sunxi/base-files/lib/sunxi.sh index ce1292b5fd..dbb27feea0 100644 --- a/target/linux/sunxi/base-files/lib/sunxi.sh +++ b/target/linux/sunxi/base-files/lib/sunxi.sh @@ -1,145 +1,5 @@ #!/bin/sh -# defaults -SUNXI_BOARD_NAME="generic" -SUNXI_BOARD_MODEL="Generic sunxi board" - -sunxi_board_detect() { - local board - local model - - [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" - - model="$( cat /proc/device-tree/model )" - - case "$model" in - "Mele A1000") - board="a1000" - ;; - - "BA10 tvbox") - board="ba10-tvbox" - ;; - - "Cubietech Cubieboard") - board="cubieboard" - ;; - - "Miniand Hackberry") - board="hackberry" - ;; - - "INet-97F Rev 02") - board="inet97fv2" - ;; - - "PineRiver Mini X-Plus") - board="mini-xplus" - ;; - - "Olimex A10-OLinuXino-LIME") - board="olinuxino-lime" - ;; - - "LinkSprite pcDuino") - board="pcduino" - ;; - - "Olimex A10s-Olinuxino Micro") - board="olinuxino-micro" - ;; - - "R7 A10s hdmi tv-stick") - board="r7-tv-dongle" - ;; - - "HSG H702") - board="hsg-h702" - ;; - - "Olimex A13-Olinuxino") - board="olinuxino" - ;; - - "Olimex A13-Olinuxino Micro") - board="olinuxino-micro" - ;; - - "Allwinner A31 APP4 EVB1 Evaluation Board") - board="app4-evb1" - ;; - - "WITS A31 Colombus Evaluation Board") - board="colombus" - ;; - - "Merrii A31 Hummingbird") - board="hummingbird" - ;; - - "Mele M9 / A1000G Quad top set box") - board="m9" - ;; - - "LeMaker Banana Pi") - board="bananapi" - ;; - - "LeMaker Banana Pro") - board="bananapro" - ;; - - "Cubietech Cubieboard2") - board="cubieboard2" - ;; - - "Cubietech Cubietruck") - board="cubietruck" - ;; - - "Merrii A20 Hummingbird") - board="hummingbird" - ;; - - "I12 / Q5 / QT840A A20 tvbox") - board="i12-tvbox" - ;; - - "Lamobo R1") - board="lamobo-r1" - ;; - - "Olimex A20-OLinuXino-LIME") - board="olinuxino-lime" - ;; - - "Olimex A20-Olinuxino Micro") - board="olinuxino-a20-micro" - ;; - - "LinkSprite pcDuino3") - board="pcduino3" - ;; - - "Ippo Q8H Dual Core Tablet (v5)") - board="ippo-q8h-v5" - ;; - esac - - if [ "$board" != "" ]; then - SUNXI_BOARD_NAME="$board" - fi - - if [ "$model" != "" ]; then - SUNXI_BOARD_MODEL="$model" - fi - - - echo "$SUNXI_BOARD_NAME" > /tmp/sysinfo/board_name - echo "$SUNXI_BOARD_MODEL" > /tmp/sysinfo/model - echo "Detected $SUNXI_BOARD_NAME // $SUNXI_BOARD_MODEL" -} - sunxi_board_name() { local name diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..f2cd970d42 --- /dev/null +++ b/target/linux/sunxi/base-files/lib/upgrade/platform.sh @@ -0,0 +1,67 @@ +platform_check_image() { + true +} + +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 ibs diff + + if export_bootdevice && export_partdevice diskdev -2; then + sync + if [ "$SAVE_PARTITIONS" = "1" ]; then + get_partitions "/dev/$diskdev" bootdisk + + #get block size + if [ -f "/sys/block/$diskdev/queue/physical_block_size" ]; then + ibs="$(cat "/sys/block/$diskdev/queue/physical_block_size")" + else + ibs=512 + fi + + #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)" + if [ -n "$diff" ]; then + echo "Partition layout is changed. Full image will be written." + ask_bool 0 "Abort" && exit + + get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync + return 0 + fi + + #write uboot image + get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 conv=notrunc + #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="$ibs" 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 + else + get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync + fi + + sleep 1 + fi +} diff --git a/target/linux/sunxi/config-4.4 b/target/linux/sunxi/config-4.4 index 1962f77984..2253afa124 100644 --- a/target/linux/sunxi/config-4.4 +++ b/target/linux/sunxi/config-4.4 @@ -65,6 +65,7 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BACKLIGHT_PWM=y CONFIG_BINFMT_MISC=y +CONFIG_BLK_DEV_LOOP=y CONFIG_BOUNCE=y # CONFIG_BPF_SYSCALL is not set CONFIG_CACHE_L2X0=y @@ -110,6 +111,8 @@ CONFIG_CPU_TLB_V7=y CONFIG_CPU_V7=y CONFIG_CRC16=y CONFIG_CRC_T10DIF=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_CRCT10DIF=y CONFIG_CRYPTO_DES=y @@ -117,7 +120,10 @@ CONFIG_CRYPTO_DEV_SUN4I_SS=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_SHA1=y CONFIG_CRYPTO_WORKQUEUE=y @@ -151,6 +157,12 @@ CONFIG_ENABLE_MUST_CHECK=y # CONFIG_ENABLE_WARN_DEPRECATED is not set CONFIG_EXT4_FS=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_FAT_FS=y CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y @@ -336,6 +348,8 @@ CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_PTP_CLASSIFY=y CONFIG_NET_VENDOR_ALLWINNER=y CONFIG_NLS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y CONFIG_NO_BOOTMEM=y CONFIG_NO_HZ=y CONFIG_NO_HZ_COMMON=y @@ -356,6 +370,7 @@ CONFIG_OLD_SIGACTION=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OUTER_CACHE=y CONFIG_OUTER_CACHE_SYNC=y +CONFIG_PADATA=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PCI is not set @@ -514,9 +529,12 @@ CONFIG_USERIO=y CONFIG_USE_OF=y CONFIG_VDSO=y CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_VFAT_FS=y CONFIG_VFP=y CONFIG_VFPv3=y +CONFIG_VHOST=y CONFIG_VHOST_NET=y +CONFIG_VHOST_RING=y CONFIG_VIRTUALIZATION=y CONFIG_VM_EVENT_COUNTERS=y CONFIG_VT=y diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile index ce805f616f..bc696cf8bd 100644 --- a/target/linux/sunxi/image/Makefile +++ b/target/linux/sunxi/image/Makefile @@ -1,5 +1,6 @@ # # Copyright (C) 2013-2016 OpenWrt.org +# Copyright (C) 2016 Yousong Zhou # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -11,111 +12,197 @@ include $(INCLUDE_DIR)/host.mk FAT32_BLOCK_SIZE=1024 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) -define Image/BuildKernel - -mkdir -p $(KDIR_TMP) - - mkimage -A arm -O linux -T kernel -C none \ - -a 0x40008000 -e 0x40008000 \ - -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-uImage - - ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs - echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs - $(call Image/BuildKernel/MkuImage, \ - none, 0x40008000, 0x40008000, \ - $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \ - $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \ - ) - endif -endef - -define Image/Build/SDCard - rm -f $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img - mkfs.fat $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img -C $(FAT32_BLOCKS) - - mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(KDIR)/uboot-sunxi-$(PROFILE)-boot.scr ::boot.scr - mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTS_DIR)/$(2).dtb ::dtb - mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage - - ./gen_sunxi_sdcard_img.sh \ - $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \ - $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img \ - $(KDIR)/root.$(1) \ +KERNEL_LOADADDR:=0x40008000 + +define Build/sunxi-sdcard + rm -f $@.boot + mkfs.fat $@.boot -C $(FAT32_BLOCKS) + + mcopy -i $@.boot $(KDIR)/uboot-sunxi-$(SUNXI_UBOOT)-boot.scr ::boot.scr + mcopy -i $@.boot $(DTS_DIR)/$(SUNXI_DTS).dtb ::dtb + mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage + ./gen_sunxi_sdcard_img.sh $@ \ + $@.boot \ + $(IMAGE_ROOTFS) \ $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \ $(CONFIG_TARGET_ROOTFS_PARTSIZE) \ - $(KDIR)/uboot-sunxi-$(PROFILE)-u-boot-with-spl.bin - - ifneq ($(CONFIG_TARGET_IMAGES_GZIP),) - gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img - endif + $(KDIR)/uboot-sunxi-$(SUNXI_UBOOT)-u-boot-with-spl.bin + rm -f $@.boot endef -define Image/Build/Profile/A10-OLinuXino-Lime - $(call Image/Build/SDCard,$(1),sun4i-a10-olinuxino-lime) +# why \x00\x00\x00\x00 for zImage-initramfs +define Device/Default + PROFILES := Default + DEVICE_VARS := SUNXI_DTS SUNXI_UBOOT + KERNEL_NAME := zImage + KERNEL := kernel-bin | uImage none + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := sunxi-sdcard | append-metadata | gzip endef -define Image/Build/Profile/A13-OLinuXino - $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino) +define Device/sun4i-a10-olinuxino-lime + DEVICE_TITLE:=Olimex A10-OLinuXino-LIME + DEVICE_PACKAGES:=uboot-sunxi-A10-OLinuXino-Lime kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi + SUPPORTED_DEVICES:=olimex,a10-olinuxino-lime + SUNXI_DTS:=sun4i-a10-olinuxino-lime + SUNXI_UBOOT:=A10-OLinuXino-Lime endef -define Image/Build/Profile/A20-OLinuXino-Lime - $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-lime) +TARGET_DEVICES += sun4i-a10-olinuxino-lime + + +define Device/sun5i-a13-olimex-som + DEVICE_TITLE:=Olimex A13 SOM + DEVICE_PACKAGES:=uboot-sunxi-OLIMEX_A13_SOM kmod-rtl8192cu + SUPPORTED_DEVICES:=olimex,a13-olinuxino + SUNXI_DTS:=sun5i-a13-olinuxino + SUNXI_UBOOT:=OLIMEX_A13_SOM endef -define Image/Build/Profile/A20-OLinuXino_MICRO - $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-micro) +TARGET_DEVICES += sun5i-a13-olimex-som + + +define Device/sun5i-a13-olinuxino + DEVICE_TITLE:=Olimex A13-Olinuxino + DEVICE_PACKAGES:=uboot-sunxi-A13-OLinuXino kmod-rtl8192cu + SUPPORTED_DEVICES:=olimex,a13-olinuxino + SUNXI_DTS:=sun5i-a13-olinuxino + SUNXI_UBOOT:=A13-OLinuXino endef -define Image/Build/Profile/Bananapi - $(call Image/Build/SDCard,$(1),sun7i-a20-bananapi) +TARGET_DEVICES += sun5i-a13-olinuxino + + +define Device/sun7i-a20-olinuxino-lime + DEVICE_TITLE:=Olimex A20-OLinuXino-LIME + DEVICE_PACKAGES:=uboot-sunxi-A20-OLinuXino-Lime kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi + SUPPORTED_DEVICES:=olimex,a20-olinuxino-lime + SUNXI_DTS:=sun7i-a20-olinuxino-lime + SUNXI_UBOOT:=A20-OLinuXino-Lime endef -define Image/Build/Profile/Bananapro - $(call Image/Build/SDCard,$(1),sun7i-a20-bananapro) +TARGET_DEVICES += sun7i-a20-olinuxino-lime + + +define Device/sun7i-a20-olinuxino-micro + DEVICE_TITLE:=Olimex A20-Olinuxino Micro + DEVICE_PACKAGES:=uboot-sunxi-A20-OLinuXino_MICRO kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi + SUPPORTED_DEVICES:=olimex,a20-olinuxino-micro + SUNXI_DTS:=sun7i-a20-olinuxino-micro + SUNXI_UBOOT:=A20-OLinuXino_MICRO endef -define Image/Build/Profile/Lamobo_R1 - $(call Image/Build/SDCard,$(1),sun7i-a20-lamobo-r1) +TARGET_DEVICES += sun7i-a20-olinuxino-micro + + +define Device/sun7i-a20-bananapi + DEVICE_TITLE:=LeMaker Banana Pi + DEVICE_PACKAGES:=uboot-sunxi-Bananapi kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi + SUPPORTED_DEVICES:=lemaker,bananapi + SUNXI_DTS:=sun7i-a20-bananapi + SUNXI_UBOOT:=Bananapi endef -define Image/Build/Profile/Cubieboard - $(call Image/Build/SDCard,$(1),sun4i-a10-cubieboard) +TARGET_DEVICES += sun7i-a20-bananapi + + +define Device/sun7i-a20-bananapro + DEVICE_TITLE:=LeMaker Banana Pro + DEVICE_PACKAGES:=uboot-sunxi-Bananapro kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi kmod-brcmfmac + SUPPORTED_DEVICES:=lemaker,bananapro + SUNXI_DTS:=sun7i-a20-bananapro + SUNXI_UBOOT:=Bananapro endef -define Image/Build/Profile/Cubieboard2 - $(call Image/Build/SDCard,$(1),sun7i-a20-cubieboard2) +TARGET_DEVICES += sun7i-a20-bananapro + + +define Device/sun7i-a20-cubieboard2 + DEVICE_TITLE:=Cubietech Cubieboard2 + DEVICE_PACKAGES:=uboot-sunxi-Cubieboard2 kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi + SUPPORTED_DEVICES:=cubietech,cubieboard2 + SUNXI_DTS:=sun7i-a20-cubieboard2 + SUNXI_UBOOT:=Cubieboard2 endef -define Image/Build/Profile/Cubietruck - $(call Image/Build/SDCard,$(1),sun7i-a20-cubietruck) +TARGET_DEVICES += sun7i-a20-cubieboard2 + + +define Device/sun4i-a10-cubieboard + DEVICE_TITLE:=Cubietech Cubieboard + DEVICE_PACKAGES:=uboot-sunxi-Cubieboard kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi + SUPPORTED_DEVICES:=cubietech,a10-cubieboard + SUNXI_DTS:=sun4i-a10-cubieboard + SUNXI_UBOOT:=Cubieboard endef -define Image/Build/Profile/OLIMEX_A13_SOM - $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino) +TARGET_DEVICES += sun4i-a10-cubieboard + + +define Device/sun7i-a20-cubietruck + DEVICE_TITLE:=Cubietech Cubietruck + DEVICE_PACKAGES:=uboot-sunxi-Cubietruck kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi kmod-brcmfmac + SUPPORTED_DEVICES:=cubietech,cubietruck + SUNXI_DTS:=sun7i-a20-cubietruck + SUNXI_UBOOT:=Cubietruck endef -define Image/Build/Profile/Mele_M9 - $(call Image/Build/SDCard,$(1),sun6i-a31-hummingbird) +TARGET_DEVICES += sun7i-a20-cubietruck + + +define Device/sun7i-a20-lamobo-r1 + DEVICE_TITLE:=Lamobo R1 + DEVICE_PACKAGES:=uboot-sunxi-Lamobo_R1 kmod-ata-sunxi kmod-rtl8192cu swconfig wpad-mini + SUPPORTED_DEVICES:=lamobo,lamobo-r1 + SUNXI_DTS:=sun7i-a20-lamobo-r1 + SUNXI_UBOOT:=Lamobo_R1 endef -define Image/Build/Profile/Linksprite_pcDuino - $(call Image/Build/SDCard,$(1),sun4i-a10-pcduino) +TARGET_DEVICES += sun7i-a20-lamobo-r1 + + +define Device/sun6i-a31-m9 + DEVICE_TITLE:=Mele M9 top set box + DEVICE_PACKAGES:=uboot-sunxi-Mele_M9 kmod-sun4i-emac kmod-rtc-sunxi kmod-rtl8192cu + SUPPORTED_DEVICES:=mele,m9 + SUNXI_DTS:=sun6i-a31-m9 + SUNXI_UBOOT:=Mele_M9 endef -define Image/Build/Profile/Linksprite_pcDuino3 - $(call Image/Build/SDCard,$(1),sun7i-a20-pcduino3) +TARGET_DEVICES += sun6i-a31-m9 + + +define Device/sun8i-h3-orangepi-plus + DEVICE_TITLE:=Xunlong Orange Pi Plus + DEVICE_PACKAGES:=kmod-rtc-sunxi uboot-sunxi-orangepi_plus + SUPPORTED_DEVICES:=xunlong,orangepi-plus + SUNXI_DTS:=sun8i-h3-orangepi-plus + SUNXI_UBOOT:=orangepi_plus endef -define Image/Build/Profile/orangepi_plus - $(call Image/Build/SDCard,$(1),sun8i-h3-orangepi-plus) +TARGET_DEVICES += sun8i-h3-orangepi-plus + + +define Device/sun7i-a20-pcduino3 + DEVICE_TITLE:=LinkSprite pcDuino3 + DEVICE_PACKAGES:=uboot-sunxi-Linksprite_pcDuino3 kmod-sun4i-emac kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi kmod-rtl8xxxu rtl8188eu-firmware + SUPPORTED_DEVICES:=linksprite,pcduino3 + SUNXI_DTS:=sun7i-a20-pcduino3 + SUNXI_UBOOT:=Linksprite_pcDuino3 endef -define Image/Build - $(call Image/Build/$(1),$(1)) - $(call Image/Build/Profile/$(PROFILE),$(1)) +TARGET_DEVICES += sun7i-a20-pcduino3 + - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync +define Device/sun4i-a10-pcduino + DEVICE_TITLE:=LinkSprite pcDuino + DEVICE_PACKAGES:=uboot-sunxi-Linksprite_pcDuino kmod-sun4i-emac kmod-rtc-sunxi kmod-rtl8192cu + SUPPORTED_DEVICES:=linksprite,a10-pcduino + SUNXI_DTS:=sun4i-a10-pcduino + SUNXI_UBOOT:=Linksprite_pcDuino endef +TARGET_DEVICES += sun4i-a10-pcduino + + $(eval $(call BuildImage)) diff --git a/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh b/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh index 2a09306af6..bb89e3a0fc 100755 --- a/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh +++ b/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - # # Copyright (C) 2013 OpenWrt.org # @@ -7,7 +6,7 @@ # See /LICENSE for more information. # -set -x +set -ex [ $# -eq 6 ] || { echo "SYNTAX: $0 " exit 1 diff --git a/target/linux/sunxi/profiles/00-default.mk b/target/linux/sunxi/profiles/00-default.mk new file mode 100644 index 0000000000..b7ecfb0831 --- /dev/null +++ b/target/linux/sunxi/profiles/00-default.mk @@ -0,0 +1,28 @@ +# +# Copyright (C) 2017 Yousong Zhou +# +# 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) + PACKAGES:= \ + kmod-ata-core \ + kmod-ata-sunxi \ + kmod-brcmfmac \ + kmod-rtc-sunxi \ + kmod-rtl8192cu \ + kmod-rtl8xxxu \ + kmod-sun4i-emac \ + rtl8188eu-firmware \ + swconfig \ + uboot-sunxi-all \ + wpad-mini + 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/sunxi/profiles/a10-olinuxino.mk b/target/linux/sunxi/profiles/a10-olinuxino.mk deleted file mode 100644 index b307373250..0000000000 --- a/target/linux/sunxi/profiles/a10-olinuxino.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/A10-OLinuXino-Lime - NAME:=A10 OLinuXino LIME - PACKAGES:=\ - uboot-sunxi-A10-OLinuXino-Lime kmod-ata-core kmod-ata-sunxi \ - kmod-sun4i-emac kmod-rtc-sunxi -endef - -define Profile/A10-OLinuXino-Lime/Description - Package set optimized for the Olimex A10 OLinuXino LIME -endef - -$(eval $(call Profile,A10-OLinuXino-Lime)) diff --git a/target/linux/sunxi/profiles/a13-olimex-som.mk b/target/linux/sunxi/profiles/a13-olimex-som.mk deleted file mode 100644 index 8dc7339de4..0000000000 --- a/target/linux/sunxi/profiles/a13-olimex-som.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/OLIMEX_A13_SOM - NAME:=Olimex A13 SOM - PACKAGES:=\ - uboot-sunxi-OLIMEX_A13_SOM kmod-rtl8192cu -endef - -define Profile/OLIMEX_A13_SOM/Description - Package set optimized for the Olimex A13 SOM -endef - -$(eval $(call Profile,OLIMEX_A13_SOM)) diff --git a/target/linux/sunxi/profiles/a13-olinuxino.mk b/target/linux/sunxi/profiles/a13-olinuxino.mk deleted file mode 100644 index 0757098ce1..0000000000 --- a/target/linux/sunxi/profiles/a13-olinuxino.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/A13-OLinuXino - NAME:=A13 OLinuXino - PACKAGES:=\ - uboot-sunxi-A13-OLinuXino kmod-rtl8192cu -endef - -define Profile/A13-OLinuXino/Description - Package set optimized for the Olimex A13 OLinuXino -endef - -$(eval $(call Profile,A13-OLinuXino)) diff --git a/target/linux/sunxi/profiles/a20-olinuxino.mk b/target/linux/sunxi/profiles/a20-olinuxino.mk deleted file mode 100644 index 92c9ae56e0..0000000000 --- a/target/linux/sunxi/profiles/a20-olinuxino.mk +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/A20-OLinuXino-Lime - NAME:=A20 OLinuXino Lime - PACKAGES:=\ - uboot-sunxi-A20-OLinuXino-Lime kmod-ata-core kmod-ata-sunxi \ - kmod-rtc-sunxi -endef - -define Profile/A20-OLinuXino-Lime/Description - Package set optimized for the Olimex A20 OLinuXino Lime -endef - -$(eval $(call Profile,A20-OLinuXino-Lime)) - - -define Profile/A20-OLinuXino_MICRO - NAME:=A20 OLinuXino Micro - PACKAGES:=\ - uboot-sunxi-A20-OLinuXino_MICRO kmod-ata-core kmod-ata-sunxi \ - kmod-sun4i-emac kmod-rtc-sunxi -endef - -define Profile/A20-OLinuXino_MICRO/Description - Package set optimized for the Olimex A20 OLinuXino micro -endef - -$(eval $(call Profile,A20-OLinuXino_MICRO)) diff --git a/target/linux/sunxi/profiles/bananapi.mk b/target/linux/sunxi/profiles/bananapi.mk deleted file mode 100644 index 96b8aeb920..0000000000 --- a/target/linux/sunxi/profiles/bananapi.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Bananapi - NAME:=Bananapi - PACKAGES:=\ - uboot-sunxi-Bananapi kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi -endef - -define Profile/Bananapi/Description - Package set optimized for the Bananapi -endef - -$(eval $(call Profile,Bananapi)) diff --git a/target/linux/sunxi/profiles/bananapro.mk b/target/linux/sunxi/profiles/bananapro.mk deleted file mode 100644 index 853b0d4d56..0000000000 --- a/target/linux/sunxi/profiles/bananapro.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Bananapro - NAME:=Bananapro - PACKAGES:=\ - uboot-sunxi-Bananapro kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi \ - kmod-brcmfmac -endef - -define Profile/Bananapro/Description - Package set optimized for the Bananapro -endef - -$(eval $(call Profile,Bananapro)) diff --git a/target/linux/sunxi/profiles/cubieboard.mk b/target/linux/sunxi/profiles/cubieboard.mk deleted file mode 100644 index c95efe6ece..0000000000 --- a/target/linux/sunxi/profiles/cubieboard.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Cubieboard - NAME:=Cubieboard - PACKAGES:=\ - uboot-sunxi-Cubieboard kmod-ata-core kmod-ata-sunxi \ - kmod-sun4i-emac kmod-rtc-sunxi -endef - -define Profile/Cubieboard/Description - Package set optimized for the Cubieboard -endef - -$(eval $(call Profile,Cubieboard)) diff --git a/target/linux/sunxi/profiles/cubieboard2.mk b/target/linux/sunxi/profiles/cubieboard2.mk deleted file mode 100644 index cfeb968796..0000000000 --- a/target/linux/sunxi/profiles/cubieboard2.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Cubieboard2 - NAME:=Cubieboard2 - PACKAGES:=\ - uboot-sunxi-Cubieboard2 kmod-ata-core kmod-ata-sunxi \ - kmod-sun4i-emac kmod-rtc-sunxi -endef - -define Profile/Cubieboard2/Description - Package set optimized for the Cubieboard2 -endef - -$(eval $(call Profile,Cubieboard2)) diff --git a/target/linux/sunxi/profiles/cubietruck.mk b/target/linux/sunxi/profiles/cubietruck.mk deleted file mode 100644 index 3e28334570..0000000000 --- a/target/linux/sunxi/profiles/cubietruck.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Cubietruck - NAME:=Cubietruck - PACKAGES:=\ - uboot-sunxi-Cubietruck kmod-ata-core kmod-ata-sunxi \ - kmod-rtc-sunxi kmod-brcmfmac -endef - -define Profile/Cubietruck/Description - Package set optimized for the Cubietruck -endef - -$(eval $(call Profile,Cubietruck)) diff --git a/target/linux/sunxi/profiles/lamobo-r1.mk b/target/linux/sunxi/profiles/lamobo-r1.mk deleted file mode 100644 index 4bc1185209..0000000000 --- a/target/linux/sunxi/profiles/lamobo-r1.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Lamobo_R1 - NAME:=Lamobo R1 - PACKAGES:=\ - uboot-sunxi-Lamobo_R1 kmod-ata-sunxi kmod-rtl8192cu \ - swconfig wpad-mini -endef - -define Profile/Lamobo_R1/Description - Package set optimized for the Lamobo R1 -endef - -$(eval $(call Profile,Lamobo_R1)) diff --git a/target/linux/sunxi/profiles/mele_m9.mk b/target/linux/sunxi/profiles/mele_m9.mk deleted file mode 100644 index 1313da4ce7..0000000000 --- a/target/linux/sunxi/profiles/mele_m9.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Mele_M9 - NAME:=Mele_M9 - PACKAGES:=\ - uboot-sunxi-Mele_M9 kmod-sun4i-emac kmod-rtc-sunxi kmod-rtl8192cu -endef - -define Profile/Mele_M9/Description - Package set optimized for the Mele M9 -endef - -$(eval $(call Profile,Mele_M9)) diff --git a/target/linux/sunxi/profiles/orangepi_plus.mk b/target/linux/sunxi/profiles/orangepi_plus.mk deleted file mode 100644 index 3da9da7fb1..0000000000 --- a/target/linux/sunxi/profiles/orangepi_plus.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/orangepi_plus - NAME:=orangepi_plus - PACKAGES:=\ - kmod-rtc-sunxi uboot-sunxi-orangepi_plus -endef - -define Profile/orangepi_plus/Description - Package set optimized for the OrangePi Plus (H3) -endef - -$(eval $(call Profile,orangepi_plus)) diff --git a/target/linux/sunxi/profiles/pcduino.mk b/target/linux/sunxi/profiles/pcduino.mk deleted file mode 100644 index 3a4202d303..0000000000 --- a/target/linux/sunxi/profiles/pcduino.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Linksprite_pcDuino - NAME:=Linksprite_pcDuino - PACKAGES:=\ - uboot-sunxi-Linksprite_pcDuino kmod-sun4i-emac kmod-rtc-sunxi kmod-rtl8192cu -endef - -define Profile/Linksprite_pcDuino/Description - Package set optimized for the Linksprite pcDuino -endef - -$(eval $(call Profile,Linksprite_pcDuino)) diff --git a/target/linux/sunxi/profiles/pcduino3.mk b/target/linux/sunxi/profiles/pcduino3.mk deleted file mode 100644 index 257d40fbf5..0000000000 --- a/target/linux/sunxi/profiles/pcduino3.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Linksprite_pcDuino3 - NAME:=pcDuino3 - PACKAGES:=\ - uboot-sunxi-Linksprite_pcDuino3 kmod-sun4i-emac kmod-rtc-sunxi \ - kmod-ata-core kmod-ata-sunxi kmod-rtl8xxxu rtl8188eu-firmware -endef - -define Profile/Linksprite_pcDuino3/Description - Package set optimized for the pcDuino3 -endef - -$(eval $(call Profile,Linksprite_pcDuino3)) diff --git a/target/linux/x86/64/config-default b/target/linux/x86/64/config-default index c9f1a11c02..791c1f2191 100644 --- a/target/linux/x86/64/config-default +++ b/target/linux/x86/64/config-default @@ -2,6 +2,7 @@ CONFIG_64BIT=y CONFIG_ACPI=y CONFIG_ACPI_AC=y CONFIG_ACPI_BATTERY=y +# CONFIG_ACPI_BGRT is not set CONFIG_ACPI_BUTTON=y # CONFIG_ACPI_CMPC is not set # CONFIG_ACPI_CONTAINER is not set @@ -48,9 +49,11 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BLK_DEV_INTEGRITY=y CONFIG_CALGARY_IOMMU=y CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y +CONFIG_CONNECTOR=y CONFIG_CPU_RMAP=y CONFIG_CRC_T10DIF=y -# CONFIG_CRYPTO_AES_X86_64 is not set +CONFIG_CRYPTO_AES_X86_64=y +CONFIG_CRYPTO_AES_NI_INTEL=y # CONFIG_CRYPTO_BLOWFISH_X86_64 is not set # CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 is not set # CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 is not set @@ -74,9 +77,24 @@ CONFIG_CRYPTO_CRCT10DIF=y # CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set # CONFIG_CRYPTO_TWOFISH_X86_64 is not set # CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set -# CONFIG_EFI is not set +# CONFIG_EARLY_PRINTK_EFI is not set +CONFIG_EFI=y +CONFIG_EFIVAR_FS=m +CONFIG_EFI_ESRT=y +# CONFIG_EFI_FAKE_MEMMAP is not set +# CONFIG_EFI_MIXED is not set +# CONFIG_EFI_PGT_DUMP is not set +CONFIG_EFI_RUNTIME_MAP=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_STUB=y +CONFIG_EFI_VARS=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_EFI is not set +CONFIG_FB_HYPERV=y CONFIG_FB_MODE_HELPERS=y CONFIG_FB_TILEBLITTING=y # CONFIG_FB_VESA is not set @@ -106,6 +124,8 @@ CONFIG_HAVE_MEMORY_PRESENT=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HID=y CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HID_GENERIC=y +CONFIG_HID_HYPERV_MOUSE=y CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=y # CONFIG_HOTPLUG_PCI_ACPI_IBM is not set @@ -119,7 +139,13 @@ CONFIG_HVC_DRIVER=y CONFIG_HW_RANDOM_AMD=y CONFIG_HW_RANDOM_INTEL=y CONFIG_HW_RANDOM_VIRTIO=y +CONFIG_HYPERV=y CONFIG_HYPERVISOR_GUEST=y +CONFIG_HYPERV_BALLOON=y +CONFIG_HYPERV_KEYBOARD=y +CONFIG_HYPERV_NET=y +CONFIG_HYPERV_STORAGE=y +CONFIG_HYPERV_UTILS=y # CONFIG_I7300_IDLE is not set # CONFIG_IA32_EMULATION is not set CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 @@ -185,16 +211,21 @@ CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PNP=y CONFIG_PNPACPI=y CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_PROC_EVENTS=y # CONFIG_PVPANIC is not set CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y +# CONFIG_RANDOMIZE_BASE is not set CONFIG_RAS=y CONFIG_RCU_STALL_COMMON=y +CONFIG_RELOCATABLE=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y CONFIG_RWSEM_SPIN_ON_OWNER=y # CONFIG_SAMSUNG_Q10 is not set CONFIG_SATA_AHCI=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y # CONFIG_SCIF_BUS is not set CONFIG_SCSI_VIRTIO=y CONFIG_SERIAL_8250_PNP=y @@ -212,6 +243,7 @@ CONFIG_SWIOTLB=y # CONFIG_THUNDER_NIC_VF is not set # CONFIG_TOSHIBA_BT_RFKILL is not set CONFIG_TREE_RCU=y +CONFIG_UCS2_STRING=y # CONFIG_UNISYSSPAR is not set CONFIG_USB=y CONFIG_USB_COMMON=y diff --git a/target/linux/x86/base-files/lib/preinit/79_move_config b/target/linux/x86/base-files/lib/preinit/79_move_config index 5ac81cb90d..143ca5147b 100644 --- a/target/linux/x86/base-files/lib/preinit/79_move_config +++ b/target/linux/x86/base-files/lib/preinit/79_move_config @@ -4,12 +4,15 @@ move_config() { local partdev - . /lib/upgrade/platform.sh + . /lib/upgrade/common.sh - if platform_export_bootdevice && platform_export_partdevice partdev 1; then - mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt - mv -f /mnt/sysupgrade.tgz / - umount /mnt + if export_bootdevice && export_partdevice partdev 1; then + if mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt; then + if [ -f /mnt/sysupgrade.tgz ]; then + mv -f /mnt/sysupgrade.tgz / + fi + umount /mnt + fi fi } diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index c8bc3f7f60..8850917062 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -1,64 +1,3 @@ -platform_export_partdevice() { - local var="$1" offset="$2" - local uevent MAJOR MINOR DEVNAME DEVTYPE - - for uevent in /sys/class/block/*/uevent; do - . "$uevent" - if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then - export "$var=$DEVNAME" - return 0 - fi - done - - return 1 -} - -platform_export_bootdevice() { - local cmdline uuid disk uevent - local MAJOR MINOR DEVNAME DEVTYPE - - if read cmdline < /proc/cmdline; then - case "$cmdline" in - *block2mtd=*) - disk="${cmdline##*block2mtd=}" - disk="${disk%%,*}" - ;; - *root=*) - disk="${cmdline##*root=}" - disk="${disk%% *}" - ;; - esac - - case "$disk" in - PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02) - uuid="${disk#PARTUUID=}" - uuid="${uuid%-02}" - for disk in $(find /dev -type b); do - set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') - if [ "$4$3$2$1" = "$uuid" ]; then - uevent="/sys/class/block/${disk##*/}/uevent" - break - fi - done - ;; - /dev/*) - uevent="/sys/class/block/${disk##*/}/uevent" - ;; - esac - - if [ -e "$uevent" ]; then - . "$uevent" - - export BOOTDEV_MAJOR=$MAJOR - export BOOTDEV_MINOR=$MINOR - - return 0 - fi - fi - - return 1 -} - platform_check_image() { [ "$#" -gt 1 ] && return 1 @@ -74,47 +13,17 @@ platform_check_image() { platform_copy_config() { local partdev - if platform_export_partdevice partdev 1; then + if export_partdevice partdev 1; then mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt cp -af "$CONF_TAR" /mnt/ umount /mnt fi } -get_partitions() { # - local disk="$1" - local filename="$2" - - if [ -b "$disk" -o -f "$disk" ]; then - echo "Reading partition table from $filename..." - - local magic="$(hexdump -v -n 2 -s 0x1FE -e '1/2 "0x%04X"' "$disk")" - if [ "$magic" != 0xAA55 ]; then - echo "Invalid partition table on $disk" - exit - fi - - rm -f "/tmp/partmap.$filename" - - local part - for part in 1 2 3 4; do - set -- $(hexdump -v -n 12 -s "$((0x1B2 + $part * 16))" -e '3/4 "0x%08X "' "$disk") - - local type="$(($1 % 256))" - local lba="$(($2))" - local num="$(($3))" - - [ $type -gt 0 ] || continue - - printf "%2d %5d %7d\n" $part $lba $num >> "/tmp/partmap.$filename" - done - fi -} - platform_do_upgrade() { local diskdev partdev ibs diff - if platform_export_bootdevice && platform_export_partdevice diskdev 0; then + if export_bootdevice && export_partdevice diskdev 0; then sync if [ "$SAVE_PARTITIONS" = "1" ]; then get_partitions "/dev/$diskdev" bootdisk @@ -143,7 +52,7 @@ platform_do_upgrade() { #iterate over each partition from the image and write it to the boot disk while read part start size; do - if platform_export_partdevice partdev $part; then + if export_partdevice partdev $part; then echo "Writing image to /dev/$partdev..." get_image "$@" | dd of="/dev/$partdev" ibs="$ibs" obs=1M skip="$start" count="$size" conv=fsync else diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index 99887cb32b..965737ac63 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -68,6 +68,7 @@ ifneq ($(CONFIG_GRUB_IMAGES),) $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz grub-mkimage \ + -p /boot/grub \ -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ -o $(KDIR)/grub2/core.img \ -O i386-pc \ @@ -106,6 +107,7 @@ define Image/Build/iso $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz grub-mkimage \ + -p /boot/grub \ -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ -o $(KDIR)/grub2/eltorito.img \ -O i386-pc \ diff --git a/target/linux/x86/image/grub-iso.cfg b/target/linux/x86/image/grub-iso.cfg index 6a494377f4..32ee687c68 100644 --- a/target/linux/x86/image/grub-iso.cfg +++ b/target/linux/x86/image/grub-iso.cfg @@ -5,6 +5,6 @@ set default="0" set timeout="@TIMEOUT@" set root='(cd)' -menuentry "libreCMC" { +menuentry "LEDE" { linux /boot/vmlinuz @CMDLINE@ noinitrd } diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg index bbf8d452ed..acca036a2e 100644 --- a/target/linux/x86/image/grub.cfg +++ b/target/linux/x86/image/grub.cfg @@ -5,9 +5,9 @@ set default="0" set timeout="@TIMEOUT@" set root='(@ROOT@)' -menuentry "libreCMC" { +menuentry "LEDE" { linux /boot/vmlinuz @CMDLINE@ noinitrd } -menuentry "libreCMC (failsafe)" { +menuentry "LEDE (failsafe)" { linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd } diff --git a/target/linux/x86/modules.mk b/target/linux/x86/modules.mk new file mode 100644 index 0000000000..656500b290 --- /dev/null +++ b/target/linux/x86/modules.mk @@ -0,0 +1,21 @@ +# +# Copyright (C) 2017 Cezary Jackiewicz +# +# This is free software, licensed under the GNU General Public License v2. +# + +define KernelPackage/sound-cs5535audio + TITLE:=CS5535/CS5536 Audio Controller + DEPENDS:=@TARGET_x86_geode +kmod-ac97 + KCONFIG:=CONFIG_SND_CS5535AUDIO + FILES:=$(LINUX_DIR)/sound/pci/cs5535audio/snd-cs5535audio.ko + AUTOLOAD:=$(call AutoLoad,36,snd-cs5535audio) + $(call AddDepends/sound) +endef + +define KernelPackage/sound-cs5535audio/description + Support for the integrated AC97 sound device on motherboards + with AMD CS5535/CS5536 chipsets. +endef + +$(eval $(call KernelPackage,sound-cs5535audio)) diff --git a/target/linux/x86/xen_domu/target.mk b/target/linux/x86/xen_domu/target.mk index 31d110c5c3..991fe59e8b 100644 --- a/target/linux/x86/xen_domu/target.mk +++ b/target/linux/x86/xen_domu/target.mk @@ -1,4 +1,3 @@ BOARDNAME:=Xen Paravirt Guest -DEFAULT_PACKAGES += kmod-xen-fs kmod-xen-evtchn kmod-xen-netdev kmod-xen-kbddev FEATURES:=display ext4 targz CPU_TYPE := pentium4 diff --git a/target/linux/xburst/config-3.18 b/target/linux/xburst/config-3.18 index fbc2891673..71411bf067 100644 --- a/target/linux/xburst/config-3.18 +++ b/target/linux/xburst/config-3.18 @@ -40,7 +40,6 @@ CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_XZ=y CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DMA_JZ4740=y @@ -316,7 +315,6 @@ CONFIG_TREE_PREEMPT_RCU=y CONFIG_UBIFS_FS=y CONFIG_UBIFS_FS_ADVANCED_COMPR=y CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_XZ=y CONFIG_UBIFS_FS_ZLIB=y CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_USB=y diff --git a/target/sdk/Makefile b/target/sdk/Makefile index de77d1a31a..c1eca736b0 100644 --- a/target/sdk/Makefile +++ b/target/sdk/Makefile @@ -76,6 +76,10 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean $(SDK_DIRS) $(KERNEL_FILES) | \ $(TAR) -xf - -C $(SDK_BUILD_DIR) + (cd $(SDK_BUILD_DIR); find $(STAGING_SUBDIR_HOST)/bin $(STAGING_SUBDIR_HOST)/usr/bin \ + $(STAGING_SUBDIR_TOOLCHAIN)/bin $(STAGING_SUBDIR_TOOLCHAIN)/*/bin $(STAGING_SUBDIR_TOOLCHAIN)/libexec \ + -type f | $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)) + @-( \ find \ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/bin \ diff --git a/target/sdk/files/README.SDK b/target/sdk/files/README.SDK index 6f04f94d2c..13e222fc5c 100644 --- a/target/sdk/files/README.SDK +++ b/target/sdk/files/README.SDK @@ -1,7 +1,7 @@ -This is the LEDE SDK. It contains a stripped-down version of +This is the libreCMC SDK. It contains a stripped-down version of the buildroot. You can use it to test/develop packages without having to compile your own toolchain or any of the libraries -included with LEDE. +included with libreCMC. To use it, just put your buildroot-compatible package directory (including its dependencies) in the subdir 'package/' and run diff --git a/toolchain/Makefile b/toolchain/Makefile index a656a86b0d..9f565d0e59 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -87,5 +87,6 @@ $(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed: endif $(eval $(call stampfile,$(curdir),toolchain,install,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR))) +$(eval $(call stampfile,$(curdir),toolchain,check,$(TMP_DIR)/.build)) $(eval $(call subdir,$(curdir))) diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 8816dda518..c806950400 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -14,22 +14,22 @@ PKG_SOURCE_URL:=@GNU/binutils/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 ifeq ($(PKG_VERSION),2.25.1) - PKG_MD5SUM:=ac493a78de4fee895961d025b7905be4 + PKG_HASH:=b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22 endif ifeq ($(PKG_VERSION),2.26.1) - PKG_MD5SUM:=d2b24e5b5301b7ff0207414c34c3e0fb + PKG_HASH:=39c346c87aa4fb14b2f786560aec1d29411b6ec34dce3fe7309fe3dd56949fd8 endif ifeq ($(PKG_VERSION),2.27) - PKG_MD5SUM:=2869c9bf3e60ee97c74ac2a6bf4e9d68 + PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88 endif ifeq ($(findstring linaro, $(CONFIG_BINUTILS_VERSION)),linaro) PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/ PKG_REV:=2.24.0-2014.09 PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz - PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353 + PKG_HASH:=e8bdf80bd6a5f3fc7df53245dfc0a678803d4f19c1c7ba2af3f98c8249e612b0 BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV) HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR) endif @@ -38,7 +38,7 @@ ifneq ($(CONFIG_BINUTILS_VERSION_2_26_ARC),) PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2016.03/ PKG_REV:=2016.03 PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz - PKG_MD5SUM:=d4387bab089df77a8049c81980b9fa12 + PKG_HASH:=6583a0cd5c7251dc895a47c797a9b011e466c23377d2ca7548a707fdb918fba1 BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV) HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR) endif diff --git a/toolchain/fortify-headers/Makefile b/toolchain/fortify-headers/Makefile index 6f273a4c59..8caf8c84ce 100644 --- a/toolchain/fortify-headers/Makefile +++ b/toolchain/fortify-headers/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE=1 PKG_SOURCE_URL:=http://dl.2f30.org/releases PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MD5SUM:=678ebdac0c3278b934c6524cd1e3dc4c +PKG_HASH:=afcd073d6d8d175eede2a28a7dd71b7150cb03290f99102261892c793f6b4cb1 include $(INCLUDE_DIR)/toolchain-build.mk diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index 41ea61cb8a..34c597c9e0 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -23,15 +23,10 @@ choice endchoice config GCC_USE_GRAPHITE + depends on !GCC_VERSION_4_8_ARC bool prompt "Compile in support for the new Graphite framework in GCC 4.4+" if TOOLCHAINOPTS -config GCC_USE_SYSTEM_PPL_CLOOG - bool - prompt "Use the system versions of PPL and CLooG" - depends on GCC_USE_GRAPHITE && GCC_VERSION_4_8 - default n - config EXTRA_GCC_CONFIG_OPTIONS string prompt "Additional gcc configure options" if TOOLCHAINOPTS diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index 27aa20cb39..2eefd37d5a 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -5,7 +5,7 @@ config GCC_VERSION_4_8_ARC config GCC_VERSION string default "arc-2016.03" if GCC_VERSION_4_8_ARC - default "6.2.0" if GCC_USE_VERSION_6 + default "6.3.0" if GCC_USE_VERSION_6 default "5.4.0" config GCC_VERSION_4_8 diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index c6949dc7b4..fce8a5165c 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -29,18 +29,18 @@ PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 ifeq ($(PKG_VERSION),5.4.0) - PKG_MD5SUM:=4c626ac2a83ef30dfb9260e6f59c2b30 + PKG_HASH:=608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a endif -ifeq ($(PKG_VERSION),6.2.0) - PKG_MD5SUM:=9768625159663b300ae4de2f4745fcc4 +ifeq ($(PKG_VERSION),6.3.0) + PKG_HASH:=f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f endif ifneq ($(CONFIG_GCC_VERSION_4_8_ARC),) PKG_VERSION:=4.8.5 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/archive/arc-2016.03 PKG_SOURCE:=$(PKG_NAME)-$(GCC_VERSION).tar.gz - PKG_MD5SUM:=ca59c8140d6efd07b97a18869bddbb53 + PKG_HASH:=6a5eb0c83dca16f228ac836677a1fbb42a53c30334487ac37c2c18db80a38f35 PKG_REV:=2016.03 GCC_DIR:=gcc-arc-$(PKG_REV) HOST_BUILD_DIR = $(BUILD_DIR_HOST)/$(PKG_NAME)-$(GCC_VERSION) @@ -80,11 +80,7 @@ ifdef CONFIG_INSTALL_GCCGO endif ifdef CONFIG_GCC_USE_GRAPHITE - ifdef CONFIG_GCC_VERSION_4_8 - GRAPHITE_CONFIGURE=--with-cloog=$(REAL_STAGING_DIR_HOST) - else - GRAPHITE_CONFIGURE=--with-isl=$(REAL_STAGING_DIR_HOST) - endif + GRAPHITE_CONFIGURE=--with-isl=$(REAL_STAGING_DIR_HOST) else GRAPHITE_CONFIGURE=--without-isl --without-cloog endif diff --git a/toolchain/gcc/patches/5.4.0/881-no_tm_section.patch b/toolchain/gcc/patches/5.4.0/881-no_tm_section.patch new file mode 100644 index 0000000000..fab5db3be5 --- /dev/null +++ b/toolchain/gcc/patches/5.4.0/881-no_tm_section.patch @@ -0,0 +1,11 @@ +--- a/libgcc/crtstuff.c ++++ b/libgcc/crtstuff.c +@@ -152,7 +152,7 @@ call_ ## FUNC (void) \ + #endif + + #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF) +-# define USE_TM_CLONE_REGISTRY 1 ++# define USE_TM_CLONE_REGISTRY 0 + #endif + + /* We do not want to add the weak attribute to the declarations of these diff --git a/toolchain/gcc/patches/6.2.0/001-revert_register_mode_search.patch b/toolchain/gcc/patches/6.3.0/001-revert_register_mode_search.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/001-revert_register_mode_search.patch rename to toolchain/gcc/patches/6.3.0/001-revert_register_mode_search.patch diff --git a/toolchain/gcc/patches/6.2.0/002-case_insensitive.patch b/toolchain/gcc/patches/6.3.0/002-case_insensitive.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/002-case_insensitive.patch rename to toolchain/gcc/patches/6.3.0/002-case_insensitive.patch diff --git a/toolchain/gcc/patches/6.2.0/010-documentation.patch b/toolchain/gcc/patches/6.3.0/010-documentation.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/010-documentation.patch rename to toolchain/gcc/patches/6.3.0/010-documentation.patch diff --git a/toolchain/gcc/patches/6.2.0/100-uclibc-conf.patch b/toolchain/gcc/patches/6.3.0/100-uclibc-conf.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/100-uclibc-conf.patch rename to toolchain/gcc/patches/6.3.0/100-uclibc-conf.patch diff --git a/toolchain/gcc/patches/6.2.0/230-musl_libssp.patch b/toolchain/gcc/patches/6.3.0/230-musl_libssp.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/230-musl_libssp.patch rename to toolchain/gcc/patches/6.3.0/230-musl_libssp.patch diff --git a/toolchain/gcc/patches/6.2.0/280-musl-disable-ifunc-by-default.patch b/toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch similarity index 81% rename from toolchain/gcc/patches/6.2.0/280-musl-disable-ifunc-by-default.patch rename to toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch index af5acf8cc9..df09e4f636 100644 --- a/toolchain/gcc/patches/6.2.0/280-musl-disable-ifunc-by-default.patch +++ b/toolchain/gcc/patches/6.3.0/280-musl-disable-ifunc-by-default.patch @@ -14,11 +14,9 @@ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239859 138bc75d-0d04-0410-961f-8 gcc/config.gcc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) -diff --git a/gcc/config.gcc b/gcc/config.gcc -index 8827dc8..e544d76 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -1465,7 +1465,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-gnu* | i[34567]8 +@@ -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 @@ -27,7 +25,7 @@ index 8827dc8..e544d76 100644 ;; *) default_gnu_indirect_function=yes -@@ -1531,7 +1531,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu) +@@ -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 diff --git a/toolchain/gcc/patches/6.2.0/300-mips_Os_cpu_rtx_cost_model.patch b/toolchain/gcc/patches/6.3.0/300-mips_Os_cpu_rtx_cost_model.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/300-mips_Os_cpu_rtx_cost_model.patch rename to toolchain/gcc/patches/6.3.0/300-mips_Os_cpu_rtx_cost_model.patch diff --git a/toolchain/gcc/patches/6.2.0/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches/6.3.0/800-arm_v5te_no_ldrd_strd.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/800-arm_v5te_no_ldrd_strd.patch rename to toolchain/gcc/patches/6.3.0/800-arm_v5te_no_ldrd_strd.patch diff --git a/toolchain/gcc/patches/6.2.0/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/6.3.0/810-arm-softfloat-libgcc.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/810-arm-softfloat-libgcc.patch rename to toolchain/gcc/patches/6.3.0/810-arm-softfloat-libgcc.patch diff --git a/toolchain/gcc/patches/6.2.0/820-libgcc_pic.patch b/toolchain/gcc/patches/6.3.0/820-libgcc_pic.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/820-libgcc_pic.patch rename to toolchain/gcc/patches/6.3.0/820-libgcc_pic.patch diff --git a/toolchain/gcc/patches/6.2.0/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/6.3.0/830-arm_unbreak_armv4t.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/830-arm_unbreak_armv4t.patch rename to toolchain/gcc/patches/6.3.0/830-arm_unbreak_armv4t.patch diff --git a/toolchain/gcc/patches/6.2.0/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/6.3.0/840-armv4_pass_fix-v4bx_to_ld.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/840-armv4_pass_fix-v4bx_to_ld.patch rename to toolchain/gcc/patches/6.3.0/840-armv4_pass_fix-v4bx_to_ld.patch diff --git a/toolchain/gcc/patches/6.2.0/850-use_shared_libgcc.patch b/toolchain/gcc/patches/6.3.0/850-use_shared_libgcc.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/850-use_shared_libgcc.patch rename to toolchain/gcc/patches/6.3.0/850-use_shared_libgcc.patch diff --git a/toolchain/gcc/patches/6.2.0/851-libgcc_no_compat.patch b/toolchain/gcc/patches/6.3.0/851-libgcc_no_compat.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/851-libgcc_no_compat.patch rename to toolchain/gcc/patches/6.3.0/851-libgcc_no_compat.patch diff --git a/toolchain/gcc/patches/6.2.0/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/6.3.0/870-ppc_no_crtsavres.patch similarity index 84% rename from toolchain/gcc/patches/6.2.0/870-ppc_no_crtsavres.patch rename to toolchain/gcc/patches/6.3.0/870-ppc_no_crtsavres.patch index c1eaf975c3..9e543a0fc2 100644 --- a/toolchain/gcc/patches/6.2.0/870-ppc_no_crtsavres.patch +++ b/toolchain/gcc/patches/6.3.0/870-ppc_no_crtsavres.patch @@ -1,6 +1,6 @@ --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c -@@ -24141,7 +24141,7 @@ rs6000_savres_strategy (rs6000_stack_t * +@@ -24171,7 +24171,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.2.0/880-no_java_section.patch b/toolchain/gcc/patches/6.3.0/880-no_java_section.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/880-no_java_section.patch rename to toolchain/gcc/patches/6.3.0/880-no_java_section.patch diff --git a/toolchain/gcc/patches/6.3.0/881-no_tm_section.patch b/toolchain/gcc/patches/6.3.0/881-no_tm_section.patch new file mode 100644 index 0000000000..fab5db3be5 --- /dev/null +++ b/toolchain/gcc/patches/6.3.0/881-no_tm_section.patch @@ -0,0 +1,11 @@ +--- a/libgcc/crtstuff.c ++++ b/libgcc/crtstuff.c +@@ -152,7 +152,7 @@ call_ ## FUNC (void) \ + #endif + + #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF) +-# define USE_TM_CLONE_REGISTRY 1 ++# define USE_TM_CLONE_REGISTRY 0 + #endif + + /* We do not want to add the weak attribute to the declarations of these diff --git a/toolchain/gcc/patches/6.2.0/900-bad-mips16-crt.patch b/toolchain/gcc/patches/6.3.0/900-bad-mips16-crt.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/900-bad-mips16-crt.patch rename to toolchain/gcc/patches/6.3.0/900-bad-mips16-crt.patch diff --git a/toolchain/gcc/patches/6.2.0/910-mbsd_multi.patch b/toolchain/gcc/patches/6.3.0/910-mbsd_multi.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/910-mbsd_multi.patch rename to toolchain/gcc/patches/6.3.0/910-mbsd_multi.patch diff --git a/toolchain/gcc/patches/6.2.0/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/6.3.0/920-specs_nonfatal_getenv.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/920-specs_nonfatal_getenv.patch rename to toolchain/gcc/patches/6.3.0/920-specs_nonfatal_getenv.patch diff --git a/toolchain/gcc/patches/6.2.0/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/6.3.0/930-fix-mips-noexecstack.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/930-fix-mips-noexecstack.patch rename to toolchain/gcc/patches/6.3.0/930-fix-mips-noexecstack.patch diff --git a/toolchain/gcc/patches/6.2.0/940-no-clobber-stamp-bits.patch b/toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch similarity index 87% rename from toolchain/gcc/patches/6.2.0/940-no-clobber-stamp-bits.patch rename to toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch index 65f59fcfa7..68e62865b1 100644 --- a/toolchain/gcc/patches/6.2.0/940-no-clobber-stamp-bits.patch +++ b/toolchain/gcc/patches/6.3.0/940-no-clobber-stamp-bits.patch @@ -1,6 +1,6 @@ --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in -@@ -1458,7 +1458,7 @@ stamp-bits: ${bits_headers} +@@ -1459,7 +1459,7 @@ stamp-bits: ${bits_headers} @$(STAMP) stamp-bits stamp-bits-sup: stamp-bits ${bits_sup_headers} diff --git a/toolchain/gcc/patches/6.2.0/950-cpp_file_path_translation.patch b/toolchain/gcc/patches/6.3.0/950-cpp_file_path_translation.patch similarity index 100% rename from toolchain/gcc/patches/6.2.0/950-cpp_file_path_translation.patch rename to toolchain/gcc/patches/6.3.0/950-cpp_file_path_translation.patch diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 78f4fca420..250ee2b395 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -13,7 +13,7 @@ PKG_VERSION:=arc-2016.03-gdb PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2016.03-gdb -PKG_MD5SUM:=775caaf6385c16f20b6f53c0a2b95f79 +PKG_HASH:=6a91f86cc487c1548d3f5d4f29f7226d2019c0db8a63633aeabd5914a340f3f9 GDB_DIR:=binutils-$(PKG_NAME)-$(PKG_VERSION) PATCH_DIR:=./patches-arc else @@ -21,7 +21,7 @@ PKG_VERSION:=7.12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_MD5SUM:=834ff3c5948b30718343ea57b11cbc3235d7995c6a4f3a5cecec8c8114164f94 +PKG_HASH:=834ff3c5948b30718343ea57b11cbc3235d7995c6a4f3a5cecec8c8114164f94 GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION) endif diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 0ffa44f320..3078c267cc 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk -MD5SUM_2.24 = 5c5a6f1ac6fce866e37643c41ac116f3 +HASH_2.24 = 714d26c0daf6a8acf73fc8b6053349880c79f240f96ca57b00ab0ecbbead2b73 REVISION_2.24 = 8c716c2 @@ -15,7 +15,7 @@ PKG_NAME:=glibc PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION)) PKG_REVISION:=$(REVISION_$(PKG_VERSION)) -PKG_MIRROR_MD5SUM:=$(MD5SUM_$(PKG_VERSION)) +PKG_MIRROR_HASH:=$(HASH_$(PKG_VERSION)) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git diff --git a/toolchain/insight/Makefile b/toolchain/insight/Makefile index 3744f56451..60309ba094 100644 --- a/toolchain/insight/Makefile +++ b/toolchain/insight/Makefile @@ -10,7 +10,7 @@ PKG_NAME:=insight PKG_VERSION:=6.8-1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)a.tar.bz2 -PKG_MD5SUM:=f7dd764a102beb75c2bb6b8d83455f8e +PKG_HASH:=51216df73adc4f68c67b60356270d5073f0ff094c1b477ecd96560f49707ea2a PKG_SOURCE_URL:=ftp://sourceware.org/pub/insight/releases PKG_CAT:=bzcat diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile index fa7d349baa..bce6e93e1a 100644 --- a/toolchain/kernel-headers/Makefile +++ b/toolchain/kernel-headers/Makefile @@ -19,7 +19,7 @@ PKG_VERSION:=$(LINUX_VERSION) PKG_SOURCE:=$(LINUX_SOURCE) PKG_SOURCE_URL:=$(LINUX_SITE) HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) -PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM) +PKG_HASH:=$(LINUX_KERNEL_HASH) LINUX_DIR := $(HOST_BUILD_DIR) FILES_DIR := PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION)) diff --git a/toolchain/musl/common.mk b/toolchain/musl/common.mk index aa1789930e..9f3f7add4d 100644 --- a/toolchain/musl/common.mk +++ b/toolchain/musl/common.mk @@ -11,7 +11,7 @@ PKG_NAME:=musl PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION)) PKG_RELEASE=1 -PKG_MD5SUM:=9590a9d47ee64f220b3c12f7afb864ca +PKG_HASH:=97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa PKG_SOURCE_URL:=http://www.musl-libc.org/releases PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/toolchain/musl/patches/005-fix-asctime-day-month-names-not-to-vary-by-locale.patch b/toolchain/musl/patches/005-fix-asctime-day-month-names-not-to-vary-by-locale.patch new file mode 100644 index 0000000000..c0e0238171 --- /dev/null +++ b/toolchain/musl/patches/005-fix-asctime-day-month-names-not-to-vary-by-locale.patch @@ -0,0 +1,41 @@ +From 6399fa9d29ea83de4735680b77d457bd59606532 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 7 Jul 2016 16:51:37 -0400 +Subject: fix asctime day/month names not to vary by locale + +the FIXME comment here was overlooked at the time locale support was +added. +--- + src/time/__asctime.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/src/time/__asctime.c b/src/time/__asctime.c +index e7e7f07..f114dfe 100644 +--- a/src/time/__asctime.c ++++ b/src/time/__asctime.c +@@ -1,17 +1,16 @@ + #include + #include + #include ++#include "locale_impl.h" + #include "atomic.h" + +-const char *__nl_langinfo(nl_item); ++const char *__nl_langinfo_l(nl_item, locale_t); + + char *__asctime(const struct tm *restrict tm, char *restrict buf) + { +- /* FIXME: change __nl_langinfo to __nl_langinfo_l with explicit C +- * locale once we have locales */ + if (snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", +- __nl_langinfo(ABDAY_1+tm->tm_wday), +- __nl_langinfo(ABMON_1+tm->tm_mon), ++ __nl_langinfo_l(ABDAY_1+tm->tm_wday, C_LOCALE), ++ __nl_langinfo_l(ABMON_1+tm->tm_mon, C_LOCALE), + tm->tm_mday, tm->tm_hour, + tm->tm_min, tm->tm_sec, + 1900 + tm->tm_year) >= 26) +-- +cgit v0.11.2 + + diff --git a/toolchain/musl/patches/015-fix-pread-pwrite-syscall-calling-convention-on-sh.patch b/toolchain/musl/patches/015-fix-pread-pwrite-syscall-calling-convention-on-sh.patch new file mode 100644 index 0000000000..b4b20d8ae2 --- /dev/null +++ b/toolchain/musl/patches/015-fix-pread-pwrite-syscall-calling-convention-on-sh.patch @@ -0,0 +1,71 @@ +From 7cc3a28eed7e3b72a1ce4568fb55154bb0540726 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 11 Aug 2016 18:36:46 -0400 +Subject: fix pread/pwrite syscall calling convention on sh + +despite sh not generally using register-pair alignment for 64-bit +syscall arguments, there are arch-specific versions of the syscall +entry points for pread and pwrite which include a dummy argument for +alignment before the 64-bit offset argument. +--- + arch/sh/syscall_arch.h | 1 + + src/internal/syscall.h | 4 ++++ + src/unistd/pread.c | 2 +- + src/unistd/pwrite.c | 2 +- + 4 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/arch/sh/syscall_arch.h b/arch/sh/syscall_arch.h +index f63675a..84758fe 100644 +--- a/arch/sh/syscall_arch.h ++++ b/arch/sh/syscall_arch.h +@@ -2,6 +2,7 @@ + ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ + ((union { long long ll; long l[2]; }){ .ll = x }).l[1] + #define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) ++#define __SYSCALL_LL_PRW(x) 0, __SYSCALL_LL_E((x)) + + /* The extra OR instructions are to work around a hardware bug: + * http://documentation.renesas.com/doc/products/mpumcu/tu/tnsh7456ae.pdf +diff --git a/src/internal/syscall.h b/src/internal/syscall.h +index ff3cf53..6d378a8 100644 +--- a/src/internal/syscall.h ++++ b/src/internal/syscall.h +@@ -12,6 +12,10 @@ + #define SYSCALL_MMAP2_UNIT 4096ULL + #endif + ++#ifndef __SYSCALL_LL_PRW ++#define __SYSCALL_LL_PRW(x) __SYSCALL_LL_O(x) ++#endif ++ + #ifndef __scc + #define __scc(X) ((long) (X)) + typedef long syscall_arg_t; +diff --git a/src/unistd/pread.c b/src/unistd/pread.c +index 3d2799f..5483eb9 100644 +--- a/src/unistd/pread.c ++++ b/src/unistd/pread.c +@@ -4,7 +4,7 @@ + + ssize_t pread(int fd, void *buf, size_t size, off_t ofs) + { +- return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_O(ofs)); ++ return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_PRW(ofs)); + } + + LFS64(pread); +diff --git a/src/unistd/pwrite.c b/src/unistd/pwrite.c +index bbe4c34..4bf3d7d 100644 +--- a/src/unistd/pwrite.c ++++ b/src/unistd/pwrite.c +@@ -4,7 +4,7 @@ + + ssize_t pwrite(int fd, const void *buf, size_t size, off_t ofs) + { +- return syscall_cp(SYS_pwrite, fd, buf, size, __SYSCALL_LL_O(ofs)); ++ return syscall_cp(SYS_pwrite, fd, buf, size, __SYSCALL_LL_PRW(ofs)); + } + + LFS64(pwrite); +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/020-verify-that-ttyname-refers-to-the-same-file-as-the-fd.patch b/toolchain/musl/patches/020-verify-that-ttyname-refers-to-the-same-file-as-the-fd.patch new file mode 100644 index 0000000000..d9cd0b397b --- /dev/null +++ b/toolchain/musl/patches/020-verify-that-ttyname-refers-to-the-same-file-as-the-fd.patch @@ -0,0 +1,49 @@ +From 0a950dcf15bb9f7274c804dca490e9e20e475f3e Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sat, 20 Aug 2016 21:04:31 +0200 +Subject: verify that ttyname refers to the same file as the fd + +linux containers use separate mount namespace so the /proc +symlink might not point to the right device if the fd was +opened in the parent namespace, in this case return ENOENT. +--- + src/unistd/ttyname_r.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c +index 8bac7b2..a38ba4f 100644 +--- a/src/unistd/ttyname_r.c ++++ b/src/unistd/ttyname_r.c +@@ -1,10 +1,12 @@ + #include + #include ++#include + + void __procfdname(char *, unsigned); + + int ttyname_r(int fd, char *name, size_t size) + { ++ struct stat st1, st2; + char procname[sizeof "/proc/self/fd/" + 3*sizeof(int) + 2]; + ssize_t l; + +@@ -15,8 +17,13 @@ int ttyname_r(int fd, char *name, size_t size) + + if (l < 0) return errno; + else if (l == size) return ERANGE; +- else { +- name[l] = 0; +- return 0; +- } ++ ++ name[l] = 0; ++ ++ if (stat(name, &st1) || fstat(fd, &st2)) ++ return errno; ++ if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) ++ return ENOENT; ++ ++ return 0; + } +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/025-fix-ffsync-by-changing-it-to-osync.patch b/toolchain/musl/patches/025-fix-ffsync-by-changing-it-to-osync.patch new file mode 100644 index 0000000000..fc7334d512 --- /dev/null +++ b/toolchain/musl/patches/025-fix-ffsync-by-changing-it-to-osync.patch @@ -0,0 +1,25 @@ +From c1f4ed150137d793c9d07356305a89e8785e7e02 Mon Sep 17 00:00:00 2001 +From: Duncan Overbruck +Date: Thu, 18 Aug 2016 17:06:16 +0200 +Subject: fix FFSYNC by changing it to O_SYNC + +O_FSYNC was never defined and is legacy/wrong, nothing seems to use it. +--- + include/fcntl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/fcntl.h b/include/fcntl.h +index e683e4d..0e165ca 100644 +--- a/include/fcntl.h ++++ b/include/fcntl.h +@@ -99,7 +99,7 @@ int posix_fallocate(int, off_t, off_t); + #define AT_EMPTY_PATH 0x1000 + + #define FAPPEND O_APPEND +-#define FFSYNC O_FSYNC ++#define FFSYNC O_SYNC + #define FASYNC O_ASYNC + #define FNONBLOCK O_NONBLOCK + #define FNDELAY O_NDELAY +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/028-fix-printf-regression-with-alt-form-octal-zero-flag-and-field-width.patch b/toolchain/musl/patches/028-fix-printf-regression-with-alt-form-octal-zero-flag-and-field-width.patch new file mode 100644 index 0000000000..aa0c2cfdd6 --- /dev/null +++ b/toolchain/musl/patches/028-fix-printf-regression-with-alt-form-octal-zero-flag-and-field-width.patch @@ -0,0 +1,31 @@ +From 78897b0dc00b7cd5c29af5e0b7eebf2396d8dce0 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Fri, 16 Sep 2016 17:40:08 -0400 +Subject: fix printf regression with alt-form octal, zero flag, and field width + +commit b91cdbe2bc8b626aa04dc6e3e84345accf34e4b1, in fixing another +issue, changed the logic for how alt-form octal adds the leading zero +to adjust the precision rather than using a prefix character. this +wrongly suppressed the zero flag by mimicing an explicit precision +given by the format string. switch back to using a prefix character. + +based on bug report and patch by Dmitry V. Levin, but simplified. +--- + src/stdio/vfprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index 2ecf769..e439a07 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -570,7 +570,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + if (0) { + case 'o': + a = fmt_o(arg.i, z); +- if ((fl&ALT_FORM) && p +Date: Fri, 16 Sep 2016 13:34:24 -0400 +Subject: fix ifru_data and ifcu_buf types in net/if.h + +glibc, freebsd, and openbsd use character pointers (caddr_t) for +these fields. only linux uses void pointer for the ifru_data type. +--- + include/net/if.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/net/if.h b/include/net/if.h +index 1a4059d..2f2fcc1 100644 +--- a/include/net/if.h ++++ b/include/net/if.h +@@ -89,7 +89,7 @@ struct ifreq { + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; + char ifru_newname[IFNAMSIZ]; +- void *ifru_data; ++ char *ifru_data; + } ifr_ifru; + }; + +@@ -116,7 +116,7 @@ struct ifreq { + struct ifconf { + int ifc_len; + union { +- void *ifcu_buf; ++ char *ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + }; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/030-fix-if_indextoname-error-case.patch b/toolchain/musl/patches/030-fix-if_indextoname-error-case.patch new file mode 100644 index 0000000000..d680d4eb3f --- /dev/null +++ b/toolchain/musl/patches/030-fix-if_indextoname-error-case.patch @@ -0,0 +1,36 @@ +From 32055d52ca43d867d6dbb763dc5213a8d3536a23 Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Thu, 15 Sep 2016 11:27:30 -0400 +Subject: fix if_indextoname error case + +posix requires errno to be set to ENXIO if the interface does not exist. +linux returns ENODEV instead so we handle this. +--- + src/network/if_indextoname.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/network/if_indextoname.c b/src/network/if_indextoname.c +index 6ee7f13..3b368bf 100644 +--- a/src/network/if_indextoname.c ++++ b/src/network/if_indextoname.c +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include "syscall.h" + + char *if_indextoname(unsigned index, char *name) +@@ -14,5 +15,9 @@ char *if_indextoname(unsigned index, char *name) + ifr.ifr_ifindex = index; + r = ioctl(fd, SIOCGIFNAME, &ifr); + __syscall(SYS_close, fd); +- return r < 0 ? 0 : strncpy(name, ifr.ifr_name, IF_NAMESIZE); ++ if (r < 0) { ++ if (errno == ENODEV) errno = ENXIO; ++ return 0; ++ } ++ return strncpy(name, ifr.ifr_name, IF_NAMESIZE); + } +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/031-add-missing-unlocked-and-wcsftime_l-prototypes-to-wchar-header.patch b/toolchain/musl/patches/031-add-missing-unlocked-and-wcsftime_l-prototypes-to-wchar-header.patch new file mode 100644 index 0000000000..077afe8a68 --- /dev/null +++ b/toolchain/musl/patches/031-add-missing-unlocked-and-wcsftime_l-prototypes-to-wchar-header.patch @@ -0,0 +1,38 @@ +From 5505f6afae9acf37ef565c68a07ca3df7b1ae2cb Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Fri, 9 Sep 2016 21:23:17 -0400 +Subject: add missing *_unlocked and wcsftime_l prototypes to wchar.h + +these functions had been implemented, but prototypes were not made available +--- + include/wchar.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/include/wchar.h b/include/wchar.h +index 0167dce..3e6db5f 100644 +--- a/include/wchar.h ++++ b/include/wchar.h +@@ -136,6 +136,21 @@ size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const s + + #undef iswdigit + ++#if defined(_GNU_SOURCE) ++wint_t fgetwc_unlocked (FILE *); ++wint_t getwc_unlocked (FILE *); ++wint_t getwchar_unlocked (void); ++wint_t fputwc_unlocked (wchar_t, FILE *); ++wint_t putwc_unlocked (wchar_t, FILE *); ++wint_t putwchar_unlocked (wchar_t); ++wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict); ++int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict); ++#endif ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); ++#endif ++ + #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + FILE *open_wmemstream(wchar_t **, size_t *); +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/033-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch b/toolchain/musl/patches/033-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch new file mode 100644 index 0000000000..c634d59e4b --- /dev/null +++ b/toolchain/musl/patches/033-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch @@ -0,0 +1,43 @@ +From 66570ec9c465e3c6c5d6dbd7dd42e45041a39288 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Mon, 19 Sep 2016 11:15:51 -0400 +Subject: fix undefined behavior in sched.h cpu_set_t usage + +since cpu sets can be dynamically allocated and have variable size, +accessing their contents via ->__bits is not valid; performing pointer +arithmetic outside the range of the size of the declared __bits array +results in undefined beahavior. instead, only use cpu_set_t for +fixed-size cpu set objects (instantiated by the caller) and as an +abstract pointer type for dynamically allocated ones. perform all +accesses simply by casting the abstract pointer type cpuset_t * back +to unsigned long *. +--- + include/sched.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/sched.h b/include/sched.h +index af82d6c..d1cccb7 100644 +--- a/include/sched.h ++++ b/include/sched.h +@@ -82,7 +82,7 @@ int sched_getaffinity(pid_t, size_t, cpu_set_t *); + int sched_setaffinity(pid_t, size_t, const cpu_set_t *); + + #define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \ +- ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) ) ++ (((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) ) + + #define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=) + #define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~) +@@ -94,8 +94,8 @@ static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \ + { \ + size_t __i; \ + for (__i=0; __i<__size/sizeof(long); __i++) \ +- __dest->__bits[__i] = __src1->__bits[__i] \ +- op __src2->__bits[__i] ; \ ++ ((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \ ++ op ((unsigned long *)__src2)[__i] ; \ + } + + __CPU_op_func_S(AND, &) +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/035-fix-getservby_r-result-pointer-value-on-error.patch b/toolchain/musl/patches/035-fix-getservby_r-result-pointer-value-on-error.patch new file mode 100644 index 0000000000..67d9c7a4d4 --- /dev/null +++ b/toolchain/musl/patches/035-fix-getservby_r-result-pointer-value-on-error.patch @@ -0,0 +1,41 @@ +From 8d7a3f40c8de414122eb8eb2131291782ee8ed15 Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Fri, 23 Sep 2016 21:10:07 -0400 +Subject: fix getservby*_r result pointer value on error + +this is a clone of the fix to the gethostby*_r functions in +commit fe82bb9b921be34370e6b71a1c6f062c20999ae0. the man pages +document that the getservby*_r functions set this pointer to +NULL if there was an error or if no record was found. +--- + src/network/getservbyname_r.c | 2 ++ + src/network/getservbyport_r.c | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/src/network/getservbyname_r.c b/src/network/getservbyname_r.c +index 056c2f3..ad3d616 100644 +--- a/src/network/getservbyname_r.c ++++ b/src/network/getservbyname_r.c +@@ -15,6 +15,8 @@ int getservbyname_r(const char *name, const char *prots, + struct service servs[MAXSERVS]; + int cnt, proto, align; + ++ *res = 0; ++ + /* Align buffer */ + align = -(uintptr_t)buf & ALIGN-1; + if (buflen < 2*sizeof(char *)+align) +diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c +index a0a7cae..0ae0e41 100644 +--- a/src/network/getservbyport_r.c ++++ b/src/network/getservbyport_r.c +@@ -20,6 +20,7 @@ int getservbyport_r(int port, const char *prots, + if (r) r = getservbyport_r(port, "udp", se, buf, buflen, res); + return r; + } ++ *res = 0; + + /* Align buffer */ + i = (uintptr_t)buf & sizeof(char *)-1; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/036-fix-strftime-y-for-negative-tm_year.patch b/toolchain/musl/patches/036-fix-strftime-y-for-negative-tm_year.patch new file mode 100644 index 0000000000..1f7ad5b8e1 --- /dev/null +++ b/toolchain/musl/patches/036-fix-strftime-y-for-negative-tm_year.patch @@ -0,0 +1,23 @@ +From 583ea83541dcc6481c7a1bd1a9b485526bad84a1 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Tue, 4 Oct 2016 17:14:57 +0000 +Subject: fix strftime %y for negative tm_year + +--- + src/time/strftime.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/time/strftime.c b/src/time/strftime.c +index f1ccc4d..e103e02 100644 +--- a/src/time/strftime.c ++++ b/src/time/strftime.c +@@ -167,6 +167,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm * + goto nl_strftime; + case 'y': + val = tm->tm_year % 100; ++ if (val<0) val += 100; + goto number; + case 'Y': + val = tm->tm_year + 1900LL; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/037-fix-missing-integer-overflow-checks-in-regexec-buffer-size-computations.patch b/toolchain/musl/patches/037-fix-missing-integer-overflow-checks-in-regexec-buffer-size-computations.patch new file mode 100644 index 0000000000..9d6e47572a --- /dev/null +++ b/toolchain/musl/patches/037-fix-missing-integer-overflow-checks-in-regexec-buffer-size-computations.patch @@ -0,0 +1,72 @@ +From c3edc06d1e1360f3570db9155d6b318ae0d0f0f7 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 6 Oct 2016 18:34:58 -0400 +Subject: fix missing integer overflow checks in regexec buffer size + computations + +most of the possible overflows were already ruled out in practice by +regcomp having already succeeded performing larger allocations. +however at least the num_states*num_tags multiplication can clearly +overflow in practice. for safety, check them all, and use the proper +type, size_t, rather than int. + +also improve comments, use calloc in place of malloc+memset, and +remove bogus casts. +--- + src/regex/regexec.c | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/src/regex/regexec.c b/src/regex/regexec.c +index 16c5d0a..dd52319 100644 +--- a/src/regex/regexec.c ++++ b/src/regex/regexec.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #include + +@@ -206,11 +207,24 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + + /* Allocate memory for temporary data required for matching. This needs to + be done for every matching operation to be thread safe. This allocates +- everything in a single large block from the stack frame using alloca() +- or with malloc() if alloca is unavailable. */ ++ everything in a single large block with calloc(). */ + { +- int tbytes, rbytes, pbytes, xbytes, total_bytes; ++ size_t tbytes, rbytes, pbytes, xbytes, total_bytes; + char *tmp_buf; ++ ++ /* Ensure that tbytes and xbytes*num_states cannot overflow, and that ++ * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ ++ if (num_tags > SIZE_MAX/(8 * sizeof(int) * tnfa->num_states)) ++ goto error_exit; ++ ++ /* Likewise check rbytes. */ ++ if (tnfa->num_states+1 > SIZE_MAX/(8 * sizeof(*reach_next))) ++ goto error_exit; ++ ++ /* Likewise check pbytes. */ ++ if (tnfa->num_states > SIZE_MAX/(8 * sizeof(*reach_pos))) ++ goto error_exit; ++ + /* Compute the length of the block we need. */ + tbytes = sizeof(*tmp_tags) * num_tags; + rbytes = sizeof(*reach_next) * (tnfa->num_states + 1); +@@ -221,10 +235,9 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes; + + /* Allocate the memory. */ +- buf = xmalloc((unsigned)total_bytes); ++ buf = calloc(total_bytes, 1); + if (buf == NULL) + return REG_ESPACE; +- memset(buf, 0, (size_t)total_bytes); + + /* Get the various pointers within tmp_buf (properly aligned). */ + tmp_tags = (void *)buf; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/038-fix-regexec-with-haystack-strings-longer-than-int_max.patch b/toolchain/musl/patches/038-fix-regexec-with-haystack-strings-longer-than-int_max.patch new file mode 100644 index 0000000000..a936892174 --- /dev/null +++ b/toolchain/musl/patches/038-fix-regexec-with-haystack-strings-longer-than-int_max.patch @@ -0,0 +1,189 @@ +From aee6abb2400b9a955c2b41166db1c22f63ad42ef Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 6 Oct 2016 12:15:47 -0400 +Subject: fix regexec with haystack strings longer than INT_MAX + +we inherited from TRE regexec code that's utterly wrong with respect +to the integer types it's using. while it doesn't appear that +compilers are producing unsafe output, signed integer overflows seem +to happen, and regexec fails to find matches past offset INT_MAX. + +this patch fixes the type of all variables/fields used to store +offsets in the string from int to regoff_t. after the changes, basic +testing showed that regexec can now find matches past 2GB (INT_MAX) +and past 4GB on x86_64, and code generation is unchanged on i386. +--- + src/regex/regexec.c | 54 +++++++++++++++++++++++++++-------------------------- + 1 file changed, 28 insertions(+), 26 deletions(-) + +diff --git a/src/regex/regexec.c b/src/regex/regexec.c +index dd52319..5c4cb92 100644 +--- a/src/regex/regexec.c ++++ b/src/regex/regexec.c +@@ -44,7 +44,7 @@ + + static void + tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, +- const tre_tnfa_t *tnfa, int *tags, int match_eo); ++ const tre_tnfa_t *tnfa, regoff_t *tags, regoff_t match_eo); + + /*********************************************************************** + from tre-match-utils.h +@@ -97,7 +97,7 @@ tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, + /* Returns 1 if `t1' wins `t2', 0 otherwise. */ + static int + tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions, +- int *t1, int *t2) ++ regoff_t *t1, regoff_t *t2) + { + int i; + for (i = 0; i < num_tags; i++) +@@ -157,25 +157,25 @@ tre_neg_char_classes_match(tre_ctype_t *classes, tre_cint_t wc, int icase) + + typedef struct { + tre_tnfa_transition_t *state; +- int *tags; ++ regoff_t *tags; + } tre_tnfa_reach_t; + + typedef struct { +- int pos; +- int **tags; ++ regoff_t pos; ++ regoff_t **tags; + } tre_reach_pos_t; + + + static reg_errcode_t + tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, +- int *match_tags, int eflags, +- int *match_end_ofs) ++ regoff_t *match_tags, int eflags, ++ regoff_t *match_end_ofs) + { + /* State variables required by GET_NEXT_WCHAR. */ + tre_char_t prev_c = 0, next_c = 0; + const char *str_byte = string; +- int pos = -1; +- int pos_add_next = 1; ++ regoff_t pos = -1; ++ regoff_t pos_add_next = 1; + #ifdef TRE_MBSTATE + mbstate_t mbstate; + #endif /* TRE_MBSTATE */ +@@ -191,10 +191,10 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + int *tag_i; + int num_tags, i; + +- int match_eo = -1; /* end offset of match (-1 if no match found yet) */ ++ regoff_t match_eo = -1; /* end offset of match (-1 if no match found yet) */ + int new_match = 0; +- int *tmp_tags = NULL; +- int *tmp_iptr; ++ regoff_t *tmp_tags = NULL; ++ regoff_t *tmp_iptr; + + #ifdef TRE_MBSTATE + memset(&mbstate, '\0', sizeof(mbstate)); +@@ -214,7 +214,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + + /* Ensure that tbytes and xbytes*num_states cannot overflow, and that + * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ +- if (num_tags > SIZE_MAX/(8 * sizeof(int) * tnfa->num_states)) ++ if (num_tags > SIZE_MAX/(8 * sizeof(regoff_t) * tnfa->num_states)) + goto error_exit; + + /* Likewise check rbytes. */ +@@ -229,7 +229,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + tbytes = sizeof(*tmp_tags) * num_tags; + rbytes = sizeof(*reach_next) * (tnfa->num_states + 1); + pbytes = sizeof(*reach_pos) * tnfa->num_states; +- xbytes = sizeof(int) * num_tags; ++ xbytes = sizeof(regoff_t) * num_tags; + total_bytes = + (sizeof(long) - 1) * 4 /* for alignment paddings */ + + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes; +@@ -490,12 +490,12 @@ error_exit: + */ + + typedef struct { +- int pos; ++ regoff_t pos; + const char *str_byte; + tre_tnfa_transition_t *state; + int state_id; + int next_c; +- int *tags; ++ regoff_t *tags; + #ifdef TRE_MBSTATE + mbstate_t mbstate; + #endif /* TRE_MBSTATE */ +@@ -591,13 +591,13 @@ typedef struct tre_backtrack_struct { + + static reg_errcode_t + tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, +- int *match_tags, int eflags, int *match_end_ofs) ++ regoff_t *match_tags, int eflags, regoff_t *match_end_ofs) + { + /* State variables required by GET_NEXT_WCHAR. */ + tre_char_t prev_c = 0, next_c = 0; + const char *str_byte = string; +- int pos = 0; +- int pos_add_next = 1; ++ regoff_t pos = 0; ++ regoff_t pos_add_next = 1; + #ifdef TRE_MBSTATE + mbstate_t mbstate; + #endif /* TRE_MBSTATE */ +@@ -610,15 +610,16 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + started from. */ + int next_c_start; + const char *str_byte_start; +- int pos_start = -1; ++ regoff_t pos_start = -1; + #ifdef TRE_MBSTATE + mbstate_t mbstate_start; + #endif /* TRE_MBSTATE */ + + /* End offset of best match so far, or -1 if no match found yet. */ +- int match_eo = -1; ++ regoff_t match_eo = -1; + /* Tag arrays. */ +- int *next_tags, *tags = NULL; ++ int *next_tags; ++ regoff_t *tags = NULL; + /* Current TNFA state. */ + tre_tnfa_transition_t *state; + int *states_seen = NULL; +@@ -768,8 +769,9 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + /* This is a back reference state. All transitions leaving from + this state have the same back reference "assertion". Instead + of reading the next character, we match the back reference. */ +- int so, eo, bt = trans_i->u.backref; +- int bt_len; ++ regoff_t so, eo; ++ int bt = trans_i->u.backref; ++ regoff_t bt_len; + int result; + + /* Get the substring we need to match against. Remember to +@@ -926,7 +928,7 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + endpoint values. */ + static void + tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, +- const tre_tnfa_t *tnfa, int *tags, int match_eo) ++ const tre_tnfa_t *tnfa, regoff_t *tags, regoff_t match_eo) + { + tre_submatch_data_t *submatch_data; + unsigned int i, j; +@@ -996,7 +998,7 @@ regexec(const regex_t *restrict preg, const char *restrict string, + { + tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD; + reg_errcode_t status; +- int *tags = NULL, eo; ++ regoff_t *tags = NULL, eo; + if (tnfa->cflags & REG_NOSUB) nmatch = 0; + if (tnfa->num_tags > 0 && nmatch > 0) + { +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/039-fix-integer-overflow-in-float-printf-needed-precision-computation.patch b/toolchain/musl/patches/039-fix-integer-overflow-in-float-printf-needed-precision-computation.patch new file mode 100644 index 0000000000..cfbd94f9a4 --- /dev/null +++ b/toolchain/musl/patches/039-fix-integer-overflow-in-float-printf-needed-precision-computation.patch @@ -0,0 +1,35 @@ +From 70d2687d85c314963cf280759b23fd4573ff0d82 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Wed, 19 Oct 2016 20:17:16 -0400 +Subject: fix integer overflow in float printf needed-precision computation + +if the requested precision is close to INT_MAX, adding +LDBL_MANT_DIG/3+8 overflows. in practice the resulting undefined +behavior manifests as a large negative result, which is then used to +compute the new end pointer (z) with a wildly out-of-bounds value +(more overflow, more undefined behavior). the end result is at least +incorrect output and character count (return value); worse things do +not seem to happen, but detailed analysis has not been done. + +this patch fixes the overflow by performing the intermediate +computation as unsigned; after division by 9, the final result +necessarily fits in int. +--- + src/stdio/vfprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index e439a07..cd17ad7 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -312,7 +312,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + } + while (e2<0) { + uint32_t carry=0, *b; +- int sh=MIN(9,-e2), need=1+(p+LDBL_MANT_DIG/3+8)/9; ++ int sh=MIN(9,-e2), need=1+(p+LDBL_MANT_DIG/3U+8)/9; + for (d=a; d>sh) + carry; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/040-fix-integer-overflows-and-uncaught-eoverflow-in-printf-core.patch b/toolchain/musl/patches/040-fix-integer-overflows-and-uncaught-eoverflow-in-printf-core.patch new file mode 100644 index 0000000000..837fee9181 --- /dev/null +++ b/toolchain/musl/patches/040-fix-integer-overflows-and-uncaught-eoverflow-in-printf-core.patch @@ -0,0 +1,390 @@ +From 167dfe9672c116b315e72e57a55c7769f180dffa Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 20 Oct 2016 00:22:09 -0400 +Subject: fix integer overflows and uncaught EOVERFLOW in printf core + +this patch fixes a large number of missed internal signed-overflow +checks and errors in determining when the return value (output length) +would exceed INT_MAX, which should result in EOVERFLOW. some of the +issues fixed were reported by Alexander Cherepanov; others were found +in subsequent review of the code. + +aside from the signed overflows being undefined behavior, the +following specific bugs were found to exist in practice: + +- overflows computing length of floating point formats with huge + explicit precisions, integer formats with prefix characters and huge + explicit precisions, or string arguments or format strings longer + than INT_MAX, resulted in wrong return value and wrong %n results. + +- literal width and precision values outside the range of int were + misinterpreted, yielding wrong behavior in at least one well-defined + case: string formats with precision greater than INT_MAX were + sometimes truncated. + +- in cases where EOVERFLOW is produced, incorrect values could be + written for %n specifiers past the point of exceeding INT_MAX. + +in addition to fixing these bugs, we now stop producing output +immediately when output length would exceed INT_MAX, rather than +continuing and returning an error only at the end. +--- + src/stdio/vfprintf.c | 72 +++++++++++++++++++++++++++++++++++---------------- + src/stdio/vfwprintf.c | 63 +++++++++++++++++++++++++++----------------- + 2 files changed, 89 insertions(+), 46 deletions(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index cd17ad7..e2ab2dc 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -272,6 +272,8 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + if (s-buf==1 && (y||p>0||(fl&ALT_FORM))) *s++='.'; + } while (y); + ++ if (p > INT_MAX-2-(ebuf-estr)-pl) ++ return -1; + if (p && s-buf-2 < p) + l = (p+2) + (ebuf-estr); + else +@@ -383,17 +385,22 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + p = MIN(p,MAX(0,9*(z-r-1)+e-j)); + } + } ++ if (p > INT_MAX-1-(p || (fl&ALT_FORM))) ++ return -1; + l = 1 + p + (p || (fl&ALT_FORM)); + if ((t|32)=='f') { ++ if (e > INT_MAX-l) return -1; + if (e>0) l+=e; + } else { + estr=fmt_u(e<0 ? -e : e, ebuf); + while(ebuf-estr<2) *--estr='0'; + *--estr = (e<0 ? '-' : '+'); + *--estr = t; ++ if (ebuf-estr > INT_MAX-l) return -1; + l += ebuf-estr; + } + ++ if (l > INT_MAX-pl) return -1; + pad(f, ' ', w, pl+l, fl); + out(f, prefix, pl); + pad(f, '0', w, pl+l, fl^ZERO_PAD); +@@ -437,8 +444,10 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + + static int getint(char **s) { + int i; +- for (i=0; isdigit(**s); (*s)++) +- i = 10*i + (**s-'0'); ++ for (i=0; isdigit(**s); (*s)++) { ++ if (i > INT_MAX/10U || **s-'0' > INT_MAX-10*i) i = -1; ++ else i = 10*i + (**s-'0'); ++ } + return i; + } + +@@ -446,12 +455,12 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + { + char *a, *z, *s=(char *)fmt; + unsigned l10n=0, fl; +- int w, p; ++ int w, p, xp; + union arg arg; + int argpos; + unsigned st, ps; + int cnt=0, l=0; +- int i; ++ size_t i; + char buf[sizeof(uintmax_t)*3+3+LDBL_MANT_DIG/4]; + const char *prefix; + int t, pl; +@@ -459,18 +468,19 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + char mb[4]; + + for (;;) { ++ /* This error is only specified for snprintf, but since it's ++ * unspecified for other forms, do the same. Stop immediately ++ * on overflow; otherwise %n could produce wrong results. */ ++ if (l > INT_MAX - cnt) goto overflow; ++ + /* Update output count, end loop when fmt is exhausted */ +- if (cnt >= 0) { +- if (l > INT_MAX - cnt) { +- errno = EOVERFLOW; +- cnt = -1; +- } else cnt += l; +- } ++ cnt += l; + if (!*s) break; + + /* Handle literal text and %% format specifiers */ + for (a=s; *s && *s!='%'; s++); + for (z=s; s[0]=='%' && s[1]=='%'; z++, s+=2); ++ if (z-a > INT_MAX-cnt) goto overflow; + l = z-a; + if (f) out(f, a, l); + if (l) continue; +@@ -498,9 +508,9 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + } else if (!l10n) { + w = f ? va_arg(*ap, int) : 0; + s++; +- } else return -1; ++ } else goto inval; + if (w<0) fl|=LEFT_ADJ, w=-w; +- } else if ((w=getint(&s))<0) return -1; ++ } else if ((w=getint(&s))<0) goto overflow; + + /* Read precision */ + if (*s=='.' && s[1]=='*') { +@@ -511,24 +521,29 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + } else if (!l10n) { + p = f ? va_arg(*ap, int) : 0; + s+=2; +- } else return -1; ++ } else goto inval; ++ xp = (p>=0); + } else if (*s=='.') { + s++; + p = getint(&s); +- } else p = -1; ++ xp = 1; ++ } else { ++ p = -1; ++ xp = 0; ++ } + + /* Format specifier state machine */ + st=0; + do { +- if (OOB(*s)) return -1; ++ if (OOB(*s)) goto inval; + ps=st; + st=states[st]S(*s++); + } while (st-1=0) return -1; ++ if (argpos>=0) goto inval; + } else { + if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos]; + else if (f) pop_arg(&arg, st, ap); +@@ -584,6 +599,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + case 'u': + a = fmt_u(arg.i, z); + } ++ if (xp && p<0) goto overflow; + if (p>=0) fl &= ~ZERO_PAD; + if (!arg.i && !p) { + a=z; +@@ -599,9 +615,9 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + if (1) a = strerror(errno); else + case 's': + a = arg.p ? arg.p : "(null)"; +- z = memchr(a, 0, p); +- if (!z) z=a+p; +- else p=z-a; ++ z = a + strnlen(a, p<0 ? INT_MAX : p); ++ if (p<0 && *z) goto overflow; ++ p = z-a; + fl &= ~ZERO_PAD; + break; + case 'C': +@@ -611,8 +627,9 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + p = -1; + case 'S': + ws = arg.p; +- for (i=l=0; i<0U+p && *ws && (l=wctomb(mb, *ws++))>=0 && l<=0U+p-i; i+=l); ++ for (i=l=0; i

=0 && l<=p-i; i+=l); + if (l<0) return -1; ++ if (i > INT_MAX) goto overflow; + p = i; + pad(f, ' ', w, p, fl); + ws = arg.p; +@@ -623,12 +640,16 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + continue; + case 'e': case 'f': case 'g': case 'a': + case 'E': case 'F': case 'G': case 'A': ++ if (xp && p<0) goto overflow; + l = fmt_fp(f, arg.f, w, p, fl, t); ++ if (l<0) goto overflow; + continue; + } + + if (p < z-a) p = z-a; ++ if (p > INT_MAX-pl) goto overflow; + if (w < pl+p) w = pl+p; ++ if (w > INT_MAX-cnt) goto overflow; + + pad(f, ' ', w, pl+p, fl); + out(f, prefix, pl); +@@ -646,8 +667,15 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + for (i=1; i<=NL_ARGMAX && nl_type[i]; i++) + pop_arg(nl_arg+i, nl_type[i], ap); + for (; i<=NL_ARGMAX && !nl_type[i]; i++); +- if (i<=NL_ARGMAX) return -1; ++ if (i<=NL_ARGMAX) goto inval; + return 1; ++ ++inval: ++ errno = EINVAL; ++ return -1; ++overflow: ++ errno = EOVERFLOW; ++ return -1; + } + + int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap) +diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c +index f9f1ecf..b8fff20 100644 +--- a/src/stdio/vfwprintf.c ++++ b/src/stdio/vfwprintf.c +@@ -154,8 +154,10 @@ static void out(FILE *f, const wchar_t *s, size_t l) + + static int getint(wchar_t **s) { + int i; +- for (i=0; iswdigit(**s); (*s)++) +- i = 10*i + (**s-'0'); ++ for (i=0; iswdigit(**s); (*s)++) { ++ if (i > INT_MAX/10U || **s-'0' > INT_MAX-10*i) i = -1; ++ else i = 10*i + (**s-'0'); ++ } + return i; + } + +@@ -168,8 +170,8 @@ static const char sizeprefix['y'-'a'] = { + static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_arg, int *nl_type) + { + wchar_t *a, *z, *s=(wchar_t *)fmt; +- unsigned l10n=0, litpct, fl; +- int w, p; ++ unsigned l10n=0, fl; ++ int w, p, xp; + union arg arg; + int argpos; + unsigned st, ps; +@@ -181,20 +183,19 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + wchar_t wc; + + for (;;) { ++ /* This error is only specified for snprintf, but since it's ++ * unspecified for other forms, do the same. Stop immediately ++ * on overflow; otherwise %n could produce wrong results. */ ++ if (l > INT_MAX - cnt) goto overflow; ++ + /* Update output count, end loop when fmt is exhausted */ +- if (cnt >= 0) { +- if (l > INT_MAX - cnt) { +- if (!ferror(f)) errno = EOVERFLOW; +- cnt = -1; +- } else cnt += l; +- } ++ cnt += l; + if (!*s) break; + + /* Handle literal text and %% format specifiers */ + for (a=s; *s && *s!='%'; s++); +- litpct = wcsspn(s, L"%")/2; /* Optimize %%%% runs */ +- z = s+litpct; +- s += 2*litpct; ++ for (z=s; s[0]=='%' && s[1]=='%'; z++, s+=2); ++ if (z-a > INT_MAX-cnt) goto overflow; + l = z-a; + if (f) out(f, a, l); + if (l) continue; +@@ -222,9 +223,9 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + } else if (!l10n) { + w = f ? va_arg(*ap, int) : 0; + s++; +- } else return -1; ++ } else goto inval; + if (w<0) fl|=LEFT_ADJ, w=-w; +- } else if ((w=getint(&s))<0) return -1; ++ } else if ((w=getint(&s))<0) goto overflow; + + /* Read precision */ + if (*s=='.' && s[1]=='*') { +@@ -235,24 +236,29 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + } else if (!l10n) { + p = f ? va_arg(*ap, int) : 0; + s+=2; +- } else return -1; ++ } else goto inval; ++ xp = (p>=0); + } else if (*s=='.') { + s++; + p = getint(&s); +- } else p = -1; ++ xp = 1; ++ } else { ++ p = -1; ++ xp = 0; ++ } + + /* Format specifier state machine */ + st=0; + do { +- if (OOB(*s)) return -1; ++ if (OOB(*s)) goto inval; + ps=st; + st=states[st]S(*s++); + } while (st-1=0) return -1; ++ if (argpos>=0) goto inval; + } else { + if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos]; + else if (f) pop_arg(&arg, st, ap); +@@ -285,8 +291,9 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + continue; + case 'S': + a = arg.p; +- z = wmemchr(a, 0, p); +- if (z) p=z-a; ++ z = a + wcsnlen(a, p<0 ? INT_MAX : p); ++ if (p<0 && *z) goto overflow; ++ p = z-a; + if (w0; bs+=i, l++); ++ for (i=l=0; l<(p<0?INT_MAX:p) && (i=mbtowc(&wc, bs, MB_LEN_MAX))>0; bs+=i, l++); + if (i<0) return -1; ++ if (p<0 && *bs) goto overflow; + p=l; + if (w +Date: Tue, 4 Oct 2016 03:58:56 +0200 +Subject: math: fix pow signed shift ub + +j is int32_t and thus j<<31 is undefined if j==1, so j is changed to +uint32_t locally as a quick fix, the generated code is not affected. + +(this is a strict conformance fix, future c standard may allow 1<<31, +see DR 463. the bug was inherited from freebsd fdlibm, the proper fix +is to use uint32_t for all bit hacks, but that requires more intrusive +changes.) + +reported by Daniel Sabogal +--- + src/math/pow.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/math/pow.c b/src/math/pow.c +index b66f632..3ddc1b6 100644 +--- a/src/math/pow.c ++++ b/src/math/pow.c +@@ -125,11 +125,11 @@ double pow(double x, double y) + else if (iy >= 0x3ff00000) { + k = (iy>>20) - 0x3ff; /* exponent */ + if (k > 20) { +- j = ly>>(52-k); ++ uint32_t j = ly>>(52-k); + if ((j<<(52-k)) == ly) + yisint = 2 - (j&1); + } else if (ly == 0) { +- j = iy>>(20-k); ++ uint32_t j = iy>>(20-k); + if ((j<<(20-k)) == iy) + yisint = 2 - (j&1); + } +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/049-fix-clock_nanosleep-error-case.patch b/toolchain/musl/patches/049-fix-clock_nanosleep-error-case.patch new file mode 100644 index 0000000000..f57f7a65fb --- /dev/null +++ b/toolchain/musl/patches/049-fix-clock_nanosleep-error-case.patch @@ -0,0 +1,30 @@ +From 3ca2d2d4aef910663785fe232d7d2127a22d8a84 Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Sat, 17 Sep 2016 12:05:45 -0400 +Subject: fix clock_nanosleep error case + +posix requires that EINVAL be returned if the first parameter specifies +the cpu-time clock of the calling thread (CLOCK_THREAD_CPUTIME_ID). +linux returns ENOTSUP instead so we handle this. +--- + src/time/clock_nanosleep.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c +index ec87b9e..9e4d9f1 100644 +--- a/src/time/clock_nanosleep.c ++++ b/src/time/clock_nanosleep.c +@@ -1,8 +1,10 @@ + #include ++#include + #include "syscall.h" + #include "libc.h" + + int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem) + { +- return -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); ++ int r = -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); ++ return clk == CLOCK_THREAD_CPUTIME_ID ? EINVAL : r; + } +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/050-add-pthread_setname_np.patch b/toolchain/musl/patches/050-add-pthread_setname_np.patch new file mode 100644 index 0000000000..9d641a296b --- /dev/null +++ b/toolchain/musl/patches/050-add-pthread_setname_np.patch @@ -0,0 +1,58 @@ +From 8fb28b0b3e7a5e958fb844722a4b2ef9bc244af1 Mon Sep 17 00:00:00 2001 +From: Felix Janda +Date: Fri, 16 Sep 2016 20:54:00 -0400 +Subject: add pthread_setname_np + +the thread name is displayed by gdb's "info threads". +--- + include/pthread.h | 1 + + src/thread/pthread_setname_np.c | 26 ++++++++++++++++++++++++++ + 2 files changed, 27 insertions(+) + create mode 100644 src/thread/pthread_setname_np.c + +diff --git a/include/pthread.h b/include/pthread.h +index 3d2e0c4..94ef919 100644 +--- a/include/pthread.h ++++ b/include/pthread.h +@@ -214,6 +214,7 @@ struct cpu_set_t; + int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *); + int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *); + int pthread_getattr_np(pthread_t, pthread_attr_t *); ++int pthread_setname_np(pthread_t, const char *); + int pthread_tryjoin_np(pthread_t, void **); + int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); + #endif +diff --git a/src/thread/pthread_setname_np.c b/src/thread/pthread_setname_np.c +new file mode 100644 +index 0000000..82d35e1 +--- /dev/null ++++ b/src/thread/pthread_setname_np.c +@@ -0,0 +1,26 @@ ++#define _GNU_SOURCE ++#include ++#include ++#include ++#include ++ ++#include "pthread_impl.h" ++ ++int pthread_setname_np(pthread_t thread, const char *name) ++{ ++ int fd, cs, status = 0; ++ char f[sizeof "/proc/self/task//comm" + 3*sizeof(int)]; ++ size_t len; ++ ++ if ((len = strnlen(name, 16)) > 15) return ERANGE; ++ ++ if (thread == pthread_self()) ++ return prctl(PR_SET_NAME, (unsigned long)name, 0UL, 0UL, 0UL) ? errno : 0; ++ ++ snprintf(f, sizeof f, "/proc/self/task/%d/comm", thread->tid); ++ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); ++ if ((fd = open(f, O_WRONLY)) < 0 || write(fd, name, len) < 0) status = errno; ++ if (fd >= 0) close(fd); ++ pthread_setcancelstate(cs, 0); ++ return status; ++} +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/051-fix-float-formatting-of-some-exact-halfway-cases.patch b/toolchain/musl/patches/051-fix-float-formatting-of-some-exact-halfway-cases.patch new file mode 100644 index 0000000000..d01a163ce2 --- /dev/null +++ b/toolchain/musl/patches/051-fix-float-formatting-of-some-exact-halfway-cases.patch @@ -0,0 +1,30 @@ +From 51ab6db4ed115d079d7131975e4adb074ba9ef9d Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Wed, 12 Oct 2016 00:49:59 +0200 +Subject: fix float formatting of some exact halfway cases + +in nearest rounding mode exact halfway cases were not following the +round to even rule if the rounding happened at a base 1000000000 digit +boundary of the internal representation and the previous digit was odd. + +e.g. printf("%.0f", 1.5) printed 1 instead of 2. +--- + src/stdio/vfprintf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index e2ab2dc..60da14d 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -345,7 +345,8 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + if (x || d+1!=z) { + long double round = 2/LDBL_EPSILON; + long double small; +- if (*d/i & 1) round += 2; ++ if ((*d/i & 1) || (i==1000000000 && d>a && (d[-1]&1))) ++ round += 2; + if (x +Date: Thu, 20 Oct 2016 12:13:33 -0400 +Subject: fix getopt_long_only misinterpreting "--" as an option + +--- + src/misc/getopt_long.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c +index 480c001..c6e1462 100644 +--- a/src/misc/getopt_long.c ++++ b/src/misc/getopt_long.c +@@ -53,7 +53,7 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring + { + optarg = 0; + if (longopts && argv[optind][0] == '-' && +- ((longonly && argv[optind][1]) || ++ ((longonly && argv[optind][1] && argv[optind][1] != '-') || + (argv[optind][1] == '-' && argv[optind][2]))) + { + int colon = optstring[optstring[0]=='+'||optstring[0]=='-']==':'; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/053-fix-gratuitous-undefined-behavior-in-strptime.patch b/toolchain/musl/patches/053-fix-gratuitous-undefined-behavior-in-strptime.patch new file mode 100644 index 0000000000..46920bccfb --- /dev/null +++ b/toolchain/musl/patches/053-fix-gratuitous-undefined-behavior-in-strptime.patch @@ -0,0 +1,33 @@ +From f33b17585058381491e6fda08f491b8e48c7980c Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 20 Oct 2016 13:22:20 -0400 +Subject: fix gratuitous undefined behavior in strptime + +accessing an object of type const char *restrict as if it had type +char * is not defined. +--- + src/time/strptime.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/time/strptime.c b/src/time/strptime.c +index f41f55f..55c7ed1 100644 +--- a/src/time/strptime.c ++++ b/src/time/strptime.c +@@ -22,8 +22,13 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri + } + f++; + if (*f == '+') f++; +- if (isdigit(*f)) w=strtoul(f, (void *)&f, 10); +- else w=-1; ++ if (isdigit(*f)) { ++ char *new_f; ++ w=strtoul(f, &new_f, 10); ++ f = new_f; ++ } else { ++ w=-1; ++ } + adj=0; + switch (*f++) { + case 'a': case 'A': +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/054-fix-strtod-and-strtof-rounding-with-many-trailing-zeros.patch b/toolchain/musl/patches/054-fix-strtod-and-strtof-rounding-with-many-trailing-zeros.patch new file mode 100644 index 0000000000..3d9211c022 --- /dev/null +++ b/toolchain/musl/patches/054-fix-strtod-and-strtof-rounding-with-many-trailing-zeros.patch @@ -0,0 +1,36 @@ +From d184a09e0529f33d8ddddb8825039133483a2c41 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sun, 4 Sep 2016 04:46:00 +0200 +Subject: fix strtod and strtof rounding with many trailing zeros + +in certain cases excessive trailing zeros could cause incorrect +rounding from long double to double or float in decfloat. + +e.g. in strtof("9444733528689243848704.000000", 0) the argument +is 0x1.000001p+73, exactly halfway between two representible floats, +this incorrectly got rounded to 0x1.000002p+73 instead of 0x1p+73, +but with less trailing 0 the rounding was fine. + +the fix makes sure that the z index always points one past the last +non-zero digit in the base 10^9 representation, this way trailing +zeros don't affect the rounding logic. +--- + src/internal/floatscan.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c +index eef70df..80305ee 100644 +--- a/src/internal/floatscan.c ++++ b/src/internal/floatscan.c +@@ -172,6 +172,9 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po + return sign * (long double)x[0] * p10s[rp-10]; + } + ++ /* Drop trailing zeros */ ++ for (; !x[z-1]; z--); ++ + /* Align radix point to B1B digit boundary */ + if (rp % 9) { + int rpm9 = rp>=0 ? rp%9 : rp%9+9; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/055-fix-strtod-int-optimization-in-non-nearest-rounding-mode.patch b/toolchain/musl/patches/055-fix-strtod-int-optimization-in-non-nearest-rounding-mode.patch new file mode 100644 index 0000000000..1588b14658 --- /dev/null +++ b/toolchain/musl/patches/055-fix-strtod-int-optimization-in-non-nearest-rounding-mode.patch @@ -0,0 +1,38 @@ +From 6ffdc4579ffb34f4aab69ab4c081badabc7c0a9a Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sun, 4 Sep 2016 04:51:03 +0200 +Subject: fix strtod int optimization in non-nearest rounding mode + +the mid-sized integer optimization relies on lnz set up properly +to mark the last non-zero decimal digit, but this was not done +if the non-zero digit lied outside the KMAX digits of the base +10^9 number representation. + +so if the fractional part was a very long list of zeros (>2048*9 on +x86) followed by non-zero digits then the integer optimization could +kick in discarding the tiny non-zero fraction which can mean wrong +result on non-nearest rounding mode. + +strtof, strtod and strtold were all affected. +--- + src/internal/floatscan.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c +index 80305ee..ae09852 100644 +--- a/src/internal/floatscan.c ++++ b/src/internal/floatscan.c +@@ -110,7 +110,10 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po + gotdig=1; + } else { + dc++; +- if (c!='0') x[KMAX-4] |= 1; ++ if (c!='0') { ++ lnz = (KMAX-4)*9; ++ x[KMAX-4] |= 1; ++ } + } + } + if (!gotrad) lrp=dc; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/065-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch b/toolchain/musl/patches/065-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch new file mode 100644 index 0000000000..6db6fd8365 --- /dev/null +++ b/toolchain/musl/patches/065-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch @@ -0,0 +1,39 @@ +From bc1e7731cee963e422575f81048792f4d5db9641 Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Wed, 2 Nov 2016 22:29:36 -0400 +Subject: fix integer overflow of tm_year in __secs_to_tm + +the overflow check for years+100 did not account for the extra +year computed from the remaining months. instead, perform this +check after obtaining the final number of years. +--- + src/time/__secs_to_tm.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/time/__secs_to_tm.c b/src/time/__secs_to_tm.c +index 3a3123a..093d902 100644 +--- a/src/time/__secs_to_tm.c ++++ b/src/time/__secs_to_tm.c +@@ -60,15 +60,16 @@ int __secs_to_tm(long long t, struct tm *tm) + for (months=0; days_in_month[months] <= remdays; months++) + remdays -= days_in_month[months]; + ++ if (months >= 10) { ++ months -= 12; ++ years++; ++ } ++ + if (years+100 > INT_MAX || years+100 < INT_MIN) + return -1; + + tm->tm_year = years + 100; + tm->tm_mon = months + 2; +- if (tm->tm_mon >= 12) { +- tm->tm_mon -=12; +- tm->tm_year++; +- } + tm->tm_mday = remdays + 1; + tm->tm_wday = wday; + tm->tm_yday = yday; +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/066-fix-swprintf-internal-buffer-state-and-error-handling.patch b/toolchain/musl/patches/066-fix-swprintf-internal-buffer-state-and-error-handling.patch new file mode 100644 index 0000000000..a6e7c7f5b0 --- /dev/null +++ b/toolchain/musl/patches/066-fix-swprintf-internal-buffer-state-and-error-handling.patch @@ -0,0 +1,36 @@ +From 7442442ccc665641a8827177e8e7ed45bbbd6584 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Mon, 7 Nov 2016 20:39:59 -0500 +Subject: fix swprintf internal buffer state and error handling + +the swprintf write callback never reset its buffer pointers, so after +its 256-byte buffer filled up, it would keep repeating those bytes +over and over in the output until the destination buffer filled up. it +also failed to set the error indicator for the stream on EILSEQ, +potentially allowing output to continue after the error. +--- + src/stdio/vswprintf.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/stdio/vswprintf.c b/src/stdio/vswprintf.c +index 7d237ba..6eb2f6a 100644 +--- a/src/stdio/vswprintf.c ++++ b/src/stdio/vswprintf.c +@@ -24,7 +24,14 @@ static size_t sw_write(FILE *f, const unsigned char *s, size_t l) + c->ws++; + } + *c->ws = 0; +- return i<0 ? i : l0; ++ if (i < 0) { ++ f->wpos = f->wbase = f->wend = 0; ++ f->flags |= F_ERR; ++ return i; ++ } ++ f->wend = f->buf + f->buf_size; ++ f->wpos = f->wbase = f->buf; ++ return l0; + } + + int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_list ap) +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/071-fix-build-regression-on-archs-with-variable-page-size.patch b/toolchain/musl/patches/071-fix-build-regression-on-archs-with-variable-page-size.patch new file mode 100644 index 0000000000..50d23e5056 --- /dev/null +++ b/toolchain/musl/patches/071-fix-build-regression-on-archs-with-variable-page-size.patch @@ -0,0 +1,32 @@ +From 4078a5c31fa67987051c2180db7a07702534032f Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Tue, 8 Nov 2016 18:03:42 -0500 +Subject: fix build regression on archs with variable page size + +commit 31fb174dd295e50f7c5cf18d31fcfd5fe5a063b7 used +DEFAULT_GUARD_SIZE from pthread_impl.h in a static initializer, +breaking build on archs where its definition, PAGE_SIZE, is not a +constant. instead, just define DEFAULT_GUARD_SIZE as 4096, the minimal +page size on any arch we support. pthread_create rounds up to whole +pages anyway, so defining it to 1 would also work, but a moderately +meaningful value is nicer to programs that use +pthread_attr_getguardsize on default-initialized attribute objects. +--- + src/internal/pthread_impl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h +index 3890bb5..7a679db 100644 +--- a/src/internal/pthread_impl.h ++++ b/src/internal/pthread_impl.h +@@ -143,7 +143,7 @@ void __block_app_sigs(void *); + void __restore_sigs(void *); + + #define DEFAULT_STACK_SIZE 81920 +-#define DEFAULT_GUARD_SIZE PAGE_SIZE ++#define DEFAULT_GUARD_SIZE 4096 + + #define __ATTRP_C11_THREAD ((void*)(uintptr_t)-1) + +-- +cgit v0.11.2 diff --git a/toolchain/musl/patches/040-Add-format-attribute-to-some-function-declarations.patch b/toolchain/musl/patches/099-Add-format-attribute-to-some-function-declarations.patch similarity index 100% rename from toolchain/musl/patches/040-Add-format-attribute-to-some-function-declarations.patch rename to toolchain/musl/patches/099-Add-format-attribute-to-some-function-declarations.patch diff --git a/toolchain/musl/patches/300-relative.patch b/toolchain/musl/patches/300-relative.patch index e34e60a09d..6e30e0a88f 100644 --- a/toolchain/musl/patches/300-relative.patch +++ b/toolchain/musl/patches/300-relative.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -215,7 +215,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc +@@ -221,7 +221,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc $(INSTALL) -D -m 644 $< $@ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so diff --git a/toolchain/uClibc/common.mk b/toolchain/uClibc/common.mk index 952f67d386..35f4f80854 100644 --- a/toolchain/uClibc/common.mk +++ b/toolchain/uClibc/common.mk @@ -16,7 +16,7 @@ CONFIG_DIR:=$(PATH_PREFIX)/config PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz LIBC_SO_VERSION:=$(PKG_VERSION) -PKG_MD5SUM=8eed7f3635216142c1c5e122874b89c6 +PKG_HASH:=3c63d9f8c8b98b65fa5c4040d1c8ab1b36e99a16e1093810cedad51ac15c9a9e HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/toolchain/yasm/Makefile b/toolchain/yasm/Makefile index bf0b8c5c48..e5cdac6fe9 100644 --- a/toolchain/yasm/Makefile +++ b/toolchain/yasm/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=1.3.0 PKG_SOURCE_URL:=http://www.tortall.net/projects/yasm/releases/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MD5SUM:=fc9e586751ff789b34b1f21d572d96af +PKG_HASH:=3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f HOST_BUILD_PARALLEL:=1 diff --git a/tools/Makefile b/tools/Makefile index a784d3d99d..996c7b342c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -14,22 +14,16 @@ tools-y := ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) BUILD_TOOLCHAIN := y ifdef CONFIG_GCC_USE_GRAPHITE - ifneq ($(CONFIG_GCC_VERSION_4_8),) - ifeq ($(CONFIG_GCC_USE_SYSTEM_PPL_CLOOG),) - BUILD_PPL_CLOOG = y - endif - else - BUILD_ISL = y - endif + BUILD_ISL = y endif endif tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat -tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs +tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage -tools-y += firmware-utils patch-image patch quilt yaffs2 padjffs2 -tools-y += mm-macros missing-macros xz cmake scons bc findutils gengetopt patchelf -tools-y += mtools dosfstools +tools-y += firmware-utils patch-image quilt padjffs2 +tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf +tools-y += mtools dosfstools libressl tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-$(CONFIG_powerpc) += upx tools-$(CONFIG_TARGET_x86) += qemu @@ -37,7 +31,6 @@ tools-$(CONFIG_TARGET_mxs) += elftosb sdimage tools-$(CONFIG_TARGET_ar71xx) += lzma-old squashfs tools-$(CONFIG_USES_MINOR) += kernel2minor tools-y += lzma squashfs4 -tools-$(BUILD_PPL_CLOOG) += ppl cloog tools-$(BUILD_ISL) += isl tools-$(CONFIG_USE_SPARSE) += sparse tools-$(CONFIG_TARGET_apm821xx) += genext2fs @@ -45,20 +38,16 @@ tools-$(CONFIG_TARGET_apm821xx) += genext2fs # builddir dependencies $(curdir)/bison/compile := $(curdir)/flex/install $(curdir)/flex/compile := $(curdir)/libtool/install -$(curdir)/pkg-config/compile := $(curdir)/sed/install -$(curdir)/libtool/compile := $(curdir)/sed/install $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/automake/install $(curdir)/missing-macros/install +$(curdir)/libtool/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/automake/install $(curdir)/missing-macros/install $(curdir)/squashfs/compile := $(curdir)/lzma-old/install $(curdir)/squashfs4/compile := $(curdir)/xz/install -$(curdir)/quilt/compile := $(curdir)/sed/install $(curdir)/autoconf/install $(curdir)/findutils/install +$(curdir)/quilt/compile := $(curdir)/autoconf/install $(curdir)/findutils/install $(curdir)/autoconf/compile := $(curdir)/m4/install $(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install $(curdir)/xz/install $(curdir)/gmp/compile := $(curdir)/libtool/install $(curdir)/mpc/compile := $(curdir)/mpfr/install $(curdir)/gmp/install $(curdir)/mpfr/compile := $(curdir)/gmp/install -$(curdir)/ppl/compile := $(curdir)/gmp/install -$(curdir)/cloog/compile := $(curdir)/ppl/install -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(curdir)/xz/install -$(curdir)/mkimage/compile := $(curdir)/sed/install +$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(curdir)/mklibs/compile := $(curdir)/libtool/install $(curdir)/qemu/compile := $(curdir)/e2fsprogs/install $(curdir)/upslug2/compile := $(curdir)/libtool/install @@ -68,18 +57,17 @@ $(curdir)/e2fsprogs/compile := $(curdir)/libtool/install $(curdir)/libelf/compile := $(curdir)/libtool/install $(curdir)/sdcc/compile := $(curdir)/bison/install $(curdir)/padjffs2/compile := $(curdir)/findutils/install -$(curdir)/cloog/compile := $(curdir)/ppl/install $(curdir)/isl/compile := $(curdir)/gmp/install $(curdir)/bc/compile := $(curdir)/bison/install $(curdir)/findutils/compile := $(curdir)/bison/install $(curdir)/gengetopt/compile := $(curdir)/libtool/install $(curdir)/patchelf/compile := $(curdir)/libtool/install $(curdir)/dosfstools/compile := $(curdir)/autoconf/install $(curdir)/automake/install -ifeq ($(HOST_OS),Darwin) -tools-y += libressl +$(curdir)/libressl/compile := $(curdir)/pkg-config/install $(curdir)/mkimage/compile += $(curdir)/libressl/install $(curdir)/firmware-utils/compile += $(curdir)/libressl/install -endif +$(curdir)/cmake/compile += $(curdir)/libressl/install + ifneq ($(HOST_OS),Linux) tools-y += coreutils endif @@ -93,18 +81,28 @@ endif # dependency for tools which have patches directory $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(curdir)/$(tool)/compile += $(curdir)/patch/install))) -# make any tool (except xz itself) depend on XZ to ensure that *.tar.xz source archives can be unpacked $(foreach tool, $(filter-out xz,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/xz/install)) -$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/tar/install)) -tools-y += tar +# make any tool depend on tar, xz and patch to ensure that archives can be unpacked and patched properly +tools-core := tar xz patch + +$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(patsubst %,$(curdir)/%/install,$(tools-core)))) +tools-y += $(tools-core) -$(curdir)/tar/compile := $(curdir)/flock/install -tools-y += flock +# make core tools depend on sed and flock +$(foreach tool, $(tools-core), $(eval $(curdir)/$(tool)/compile += $(curdir)/sed/install)) + +$(curdir)/sed/compile := $(curdir)/flock/install +tools-y += flock sed $(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-) $(curdir)/builddirs-default := $(tools-y) +ifdef CHECK_ALL +$(curdir)/builddirs-check:=$($(curdir)/builddirs) +$(curdir)/builddirs-download:=$($(curdir)/builddirs) +endif + ifndef DUMP_TARGET_DB define PrepareStaging @for dir in $(1); do ( \ @@ -140,4 +138,5 @@ $(curdir)//install = $(1)/compile tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n)) $(eval $(call stampfile,$(curdir),tools,install,,_$(subst $(space),,$(tools_enabled)))) +$(eval $(call stampfile,$(curdir),tools,check,$(TMP_DIR)/.build)) $(eval $(call subdir,$(curdir))) diff --git a/tools/autoconf/Makefile b/tools/autoconf/Makefile index c45855c03d..6eb64d77d5 100644 --- a/tools/autoconf/Makefile +++ b/tools/autoconf/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=2.69 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/autoconf -PKG_MD5SUM:=50f97f4159805e374639a73e2636f22e +PKG_HASH:=64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/automake/Makefile b/tools/automake/Makefile index 0eea101983..14585f8888 100644 --- a/tools/automake/Makefile +++ b/tools/automake/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=1.15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/automake -PKG_MD5SUM:=9a1ddb0e053474d9d1105cfe39b0c48d +PKG_HASH:=9908c75aabd49d13661d6dcb1bc382252d22cc77bf733a2d55e87f2aa2db8636 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/bc/Makefile b/tools/bc/Makefile index 2e99b43643..3d505d6032 100644 --- a/tools/bc/Makefile +++ b/tools/bc/Makefile @@ -14,7 +14,7 @@ PKG_SOURCE_URL:=http://alpha.gnu.org/gnu/bc \ http://gnualpha.uib.no/bc/ \ http://mirrors.fe.up.pt/pub/gnu-alpha/bc/ \ http://www.nic.funet.fi/pub/gnu/alpha/gnu/bc/ -PKG_MD5SUM:=5126a721b73f97d715bb72c13c889035 +PKG_HASH:=7ee4abbcfac03d8a6e1a8a3440558a3d239d6b858585063e745c760957725ecc include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/bison/Makefile b/tools/bison/Makefile index b8ad32c561..af5737c552 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=3.0.4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=c342201de104cc9ce0a21e0ad10d4021 +PKG_HASH:=a72428c7917bdf9fa93cb8181c971b6e22834125848cf1d03ce10b1bb0716fe1 HOST_BUILD_PARALLEL:=1 diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 2dbf03ce82..c5136a47ae 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=3.3.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://samba.org/ftp/ccache/ -PKG_MD5SUM:=2767d8f88f5ec218983a2f05c9e20df2 +PKG_HASH:=907685cb23d8f82074b8d1a9b4ebabb36914d151ac7b96a840c68c08d1a14530 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/cloog/Makefile b/tools/cloog/Makefile deleted file mode 100644 index b1e6aa4398..0000000000 --- a/tools/cloog/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (C) 2009-2013 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:=cloog -PKG_VERSION:=0.18.1 - -PKG_SOURCE_URL:=http://www.bastoul.net/cloog/pages/download/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MD5SUM:=e34fca0540d840e5d0f6427e98c92252 - -HOST_FIXUP:=autoreconf - -HOST_BUILD_PARALLEL:=1 -HOST_CONFIGURE_PARALLEL:=1 - -include $(INCLUDE_DIR)/host-build.mk - -unexport CFLAGS - -HOST_CONFIGURE_VARS += \ - LIBS=-lstdc++ - -HOST_CONFIGURE_ARGS += \ - --enable-static \ - --disable-shared \ - --with-ppl=$(BUILD_DIR_HOST) - -define Host/Configure - (cd $(HOST_BUILD_DIR)/$(3); \ - $(HOST_CONFIGURE_CMD) \ - $(HOST_CONFIGURE_VARS) \ - $(HOST_CONFIGURE_ARGS); \ - ) -endef - -$(eval $(call HostBuild)) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 489c27f1d8..a1137c5b50 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,19 +7,20 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.7.0 +PKG_VERSION:=3.7.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://cmake.org/files/v3.7/ \ https://fossies.org/linux/misc/ -PKG_MD5SUM:=3801dc4e54c1c957a7378d8b0d4254ba +PKG_HASH:=449a5bce64dbd4d5b9517ebd1a1248ed197add6ad27934478976fd5f1f9330e1 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk -HOST_CONFIGURE_CMD := MAKEFLAGS="$(HOST_JOBS)" $(BASH) ./configure +HOST_CONFIGURE_CMD := \ + MAKEFLAGS="$(HOST_JOBS)" $(BASH) ./configure HOST_CONFIGURE_VARS := diff --git a/tools/cmake/patches/150-libarchive-fix-libressl-compat.patch b/tools/cmake/patches/130-libarchive-fix-libressl-compat.patch similarity index 100% rename from tools/cmake/patches/150-libarchive-fix-libressl-compat.patch rename to tools/cmake/patches/130-libarchive-fix-libressl-compat.patch diff --git a/tools/cmake/patches/130-upstream-libarchive-openssl-compat-headers.patch b/tools/cmake/patches/130-upstream-libarchive-openssl-compat-headers.patch deleted file mode 100644 index fba8745843..0000000000 --- a/tools/cmake/patches/130-upstream-libarchive-openssl-compat-headers.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 7d433206cf7de8f28aa2d169ed25cd401fcfc413 Mon Sep 17 00:00:00 2001 -From: Brad King -Date: Thu, 17 Nov 2016 15:26:41 -0500 -Subject: [PATCH] libarchive: Add headers to adapt between OpenSSL 1.1 and older versions - -Add private forwarding headers for `openssl/{evp,hmac}.h` to give us a -central place to add adaptation code to work across multiple -incompatible OpenSSL versions. Provide compatibility implementations of -some OpenSSL 1.1 APIs when using older OpenSSL versions. ---- - Utilities/cmlibarchive/libarchive/CMakeLists.txt | 2 ++ - Utilities/cmlibarchive/libarchive/archive_cryptor_private.h | 2 +- - Utilities/cmlibarchive/libarchive/archive_digest_private.h | 2 +- - Utilities/cmlibarchive/libarchive/archive_hmac_private.h | 2 +- - Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ - Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 108 insertions(+), 3 deletions(-) - create mode 100644 Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h - create mode 100644 Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h - -diff --git a/Utilities/cmlibarchive/libarchive/CMakeLists.txt b/Utilities/cmlibarchive/libarchive/CMakeLists.txt -index 4eeb5e3..eaa7b20 100644 ---- a/Utilities/cmlibarchive/libarchive/CMakeLists.txt -+++ b/Utilities/cmlibarchive/libarchive/CMakeLists.txt -@@ -38,6 +38,8 @@ SET(libarchive_SOURCES - archive_hmac.c - archive_hmac_private.h - archive_match.c -+ archive_openssl_evp_private.h -+ archive_openssl_hmac_private.h - archive_options.c - archive_options_private.h - archive_pack_dev.h -diff --git a/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h b/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h -index 37eaad3..1c1a8c0 100644 ---- a/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h -+++ b/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h -@@ -99,7 +99,7 @@ typedef struct { - } archive_crypto_ctx; - - #elif defined(HAVE_LIBCRYPTO) --#include -+#include "archive_openssl_evp_private.h" - #define AES_BLOCK_SIZE 16 - #define AES_MAX_KEY_SIZE 32 - -diff --git a/Utilities/cmlibarchive/libarchive/archive_digest_private.h b/Utilities/cmlibarchive/libarchive/archive_digest_private.h -index 77fad58..00697ae 100644 ---- a/Utilities/cmlibarchive/libarchive/archive_digest_private.h -+++ b/Utilities/cmlibarchive/libarchive/archive_digest_private.h -@@ -134,7 +134,7 @@ - defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\ - defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) - #define ARCHIVE_CRYPTO_OPENSSL 1 --#include -+#include "archive_openssl_evp_private.h" - #endif - - /* Windows crypto headers */ -diff --git a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h -index 64de743..f36d694 100644 ---- a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h -+++ b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h -@@ -70,7 +70,7 @@ typedef struct { - typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx; - - #elif defined(HAVE_LIBCRYPTO) --#include -+#include "archive_openssl_hmac_private.h" - - typedef HMAC_CTX archive_hmac_sha1_ctx; - -diff --git a/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h -new file mode 100644 -index 0000000..0e97e27 ---- /dev/null -+++ b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h -@@ -0,0 +1,51 @@ -+/*- -+ * Copyright (c) 2003-2007 Tim Kientzle -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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. -+ */ -+#ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED -+#define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED -+ -+#include -+#include -+ -+#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#include /* malloc, free */ -+#include /* memset */ -+static inline EVP_MD_CTX *EVP_MD_CTX_new(void) -+{ -+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)malloc(sizeof(EVP_MD_CTX)); -+ if (ctx != NULL) { -+ memset(ctx, 0, sizeof(*ctx)); -+ } -+ return ctx; -+} -+ -+static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx) -+{ -+ EVP_MD_CTX_cleanup(ctx); -+ memset(ctx, 0, sizeof(*ctx)); -+ free(ctx); -+} -+#endif -+ -+#endif -diff --git a/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h -new file mode 100644 -index 0000000..d4ae0d1 ---- /dev/null -+++ b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h -@@ -0,0 +1,52 @@ -+/*- -+ * Copyright (c) 2003-2007 Tim Kientzle -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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. -+ */ -+#ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED -+#define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED -+ -+#include -+#include -+ -+#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#include /* malloc, free */ -+#include /* memset */ -+static inline HMAC_CTX *HMAC_CTX_new(void) -+{ -+ HMAC_CTX *ctx = (HMAC_CTX *)malloc(sizeof(HMAC_CTX)); -+ if (ctx != NULL) { -+ memset(ctx, 0, sizeof(*ctx)); -+ HMAC_CTX_init(ctx); -+ } -+ return ctx; -+} -+ -+static inline void HMAC_CTX_free(HMAC_CTX *ctx) -+{ -+ HMAC_CTX_cleanup(ctx); -+ memset(ctx, 0, sizeof(*ctx)); -+ free(ctx); -+} -+#endif -+ -+#endif --- -libgit2 0.24.0 - diff --git a/tools/cmake/patches/140-curl-fix-libressl-linking.patch b/tools/cmake/patches/140-curl-fix-libressl-linking.patch new file mode 100644 index 0000000000..5b57172eb4 --- /dev/null +++ b/tools/cmake/patches/140-curl-fix-libressl-linking.patch @@ -0,0 +1,32 @@ +From: Jo-Philipp Wich +Date: Wed, 11 Jan 2017 03:36:04 +0100 +Subject: [PATCH] cmcurl: link librt + +When cmake is linked against LibreSSL, there might be an indirect +dependency on librt on certain systems if LibreSSL's libcrypto uses +clock_gettime() from librt: + + [ 28%] Linking C executable LIBCURL + .../lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback': + getentropy_linux.c:(.text+0x16d): undefined reference to `clock_gettime' + getentropy_linux.c:(.text+0x412): undefined reference to `clock_gettime' + collect2: error: ld returned 1 exit status + make[5]: *** [Utilities/cmcurl/LIBCURL] Error 1 + +Modify the cmcurl CMakeLists.txt to check for clock_gettime() in librt +and unconditionally link the rt library when the symbol is found. + +Signed-off-by: Jo-Philipp Wich +--- a/Utilities/cmcurl/CMakeLists.txt ++++ b/Utilities/cmcurl/CMakeLists.txt +@@ -362,6 +362,10 @@ set(HAVE_LIBSSL OFF) + if(CMAKE_USE_OPENSSL) + find_package(OpenSSL) + if(OPENSSL_FOUND) ++ check_library_exists("rt" clock_gettime "" HAVE_LIBRT) ++ if(HAVE_LIBRT) ++ list(APPEND OPENSSL_LIBRARIES rt) ++ endif() + list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES}) + set(USE_OPENSSL ON) + set(HAVE_LIBCRYPTO ON) diff --git a/tools/cmake/patches/140-upstream-libarchive-openssl-1.1.x-support.patch b/tools/cmake/patches/140-upstream-libarchive-openssl-1.1.x-support.patch deleted file mode 100644 index de0490248b..0000000000 --- a/tools/cmake/patches/140-upstream-libarchive-openssl-1.1.x-support.patch +++ /dev/null @@ -1,379 +0,0 @@ -From 6f23daea4391c2db8bc27d2e4cb42eac02368822 Mon Sep 17 00:00:00 2001 -From: Brad King -Date: Thu, 17 Nov 2016 15:44:44 -0500 -Subject: [PATCH] libarchive: Add support for building with OpenSSL 1.1 - -OpenSSL 1.1 made some CTX structures opaque. Port our code to use the -structures only through pointers via OpenSSL 1.1 APIs. Use our adaption -layer to make this work with OpenSSL 1.0 and below. - -Patch-by: Tomas Mraz -Patch-from: https://bugzilla.redhat.com/1383744 ---- - Utilities/cmlibarchive/libarchive/archive_cryptor.c | 9 +++++---- - Utilities/cmlibarchive/libarchive/archive_cryptor_private.h | 2 +- - Utilities/cmlibarchive/libarchive/archive_digest.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- - Utilities/cmlibarchive/libarchive/archive_digest_private.h | 12 ++++++------ - Utilities/cmlibarchive/libarchive/archive_hmac.c | 14 ++++++++------ - Utilities/cmlibarchive/libarchive/archive_hmac_private.h | 2 +- - 6 files changed, 75 insertions(+), 38 deletions(-) - ---- a/Utilities/cmlibarchive/libarchive/archive_cryptor.c -+++ b/Utilities/cmlibarchive/libarchive/archive_cryptor.c -@@ -302,6 +302,7 @@ aes_ctr_release(archive_crypto_ctx *ctx) - static int - aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) - { -+ ctx->ctx = EVP_CIPHER_CTX_new(); - - switch (key_len) { - case 16: ctx->type = EVP_aes_128_ecb(); break; -@@ -314,7 +315,7 @@ aes_ctr_init(archive_crypto_ctx *ctx, co - memcpy(ctx->key, key, key_len); - memset(ctx->nonce, 0, sizeof(ctx->nonce)); - ctx->encr_pos = AES_BLOCK_SIZE; -- EVP_CIPHER_CTX_init(&ctx->ctx); -+ EVP_CIPHER_CTX_init(ctx->ctx); - return 0; - } - -@@ -324,10 +325,10 @@ aes_ctr_encrypt_counter(archive_crypto_c - int outl = 0; - int r; - -- r = EVP_EncryptInit_ex(&ctx->ctx, ctx->type, NULL, ctx->key, NULL); -+ r = EVP_EncryptInit_ex(ctx->ctx, ctx->type, NULL, ctx->key, NULL); - if (r == 0) - return -1; -- r = EVP_EncryptUpdate(&ctx->ctx, ctx->encr_buf, &outl, ctx->nonce, -+ r = EVP_EncryptUpdate(ctx->ctx, ctx->encr_buf, &outl, ctx->nonce, - AES_BLOCK_SIZE); - if (r == 0 || outl != AES_BLOCK_SIZE) - return -1; -@@ -337,7 +338,7 @@ aes_ctr_encrypt_counter(archive_crypto_c - static int - aes_ctr_release(archive_crypto_ctx *ctx) - { -- EVP_CIPHER_CTX_cleanup(&ctx->ctx); -+ EVP_CIPHER_CTX_free(ctx->ctx); - memset(ctx->key, 0, ctx->key_len); - memset(ctx->nonce, 0, sizeof(ctx->nonce)); - return 0; ---- a/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h -+++ b/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h -@@ -104,7 +104,7 @@ typedef struct { - #define AES_MAX_KEY_SIZE 32 - - typedef struct { -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - const EVP_CIPHER *type; - uint8_t key[AES_MAX_KEY_SIZE]; - unsigned key_len; ---- a/Utilities/cmlibarchive/libarchive/archive_digest.c -+++ b/Utilities/cmlibarchive/libarchive/archive_digest.c -@@ -207,7 +207,9 @@ __archive_nettle_md5final(archive_md5_ct - static int - __archive_openssl_md5init(archive_md5_ctx *ctx) - { -- EVP_DigestInit(ctx, EVP_md5()); -+ if ((*ctx = EVP_MD_CTX_new()) == NULL) -+ return (ARCHIVE_FAILED); -+ EVP_DigestInit(*ctx, EVP_md5()); - return (ARCHIVE_OK); - } - -@@ -215,7 +217,7 @@ static int - __archive_openssl_md5update(archive_md5_ctx *ctx, const void *indata, - size_t insize) - { -- EVP_DigestUpdate(ctx, indata, insize); -+ EVP_DigestUpdate(*ctx, indata, insize); - return (ARCHIVE_OK); - } - -@@ -226,8 +228,11 @@ __archive_openssl_md5final(archive_md5_c - * this is meant to cope with that. Real fix is probably to fix - * archive_write_set_format_xar.c - */ -- if (ctx->digest) -- EVP_DigestFinal(ctx, md, NULL); -+ if (*ctx) { -+ EVP_DigestFinal(*ctx, md, NULL); -+ EVP_MD_CTX_free(*ctx); -+ *ctx = NULL; -+ } - return (ARCHIVE_OK); - } - -@@ -359,7 +364,9 @@ __archive_nettle_ripemd160final(archive_ - static int - __archive_openssl_ripemd160init(archive_rmd160_ctx *ctx) - { -- EVP_DigestInit(ctx, EVP_ripemd160()); -+ if ((*ctx = EVP_MD_CTX_new()) == NULL) -+ return (ARCHIVE_FAILED); -+ EVP_DigestInit(*ctx, EVP_ripemd160()); - return (ARCHIVE_OK); - } - -@@ -367,14 +374,18 @@ static int - __archive_openssl_ripemd160update(archive_rmd160_ctx *ctx, const void *indata, - size_t insize) - { -- EVP_DigestUpdate(ctx, indata, insize); -+ EVP_DigestUpdate(*ctx, indata, insize); - return (ARCHIVE_OK); - } - - static int - __archive_openssl_ripemd160final(archive_rmd160_ctx *ctx, void *md) - { -- EVP_DigestFinal(ctx, md, NULL); -+ if (*ctx) { -+ EVP_DigestFinal(*ctx, md, NULL); -+ EVP_MD_CTX_free(*ctx); -+ *ctx = NULL; -+ } - return (ARCHIVE_OK); - } - -@@ -509,7 +520,9 @@ __archive_nettle_sha1final(archive_sha1_ - static int - __archive_openssl_sha1init(archive_sha1_ctx *ctx) - { -- EVP_DigestInit(ctx, EVP_sha1()); -+ if ((*ctx = EVP_MD_CTX_new()) == NULL) -+ return (ARCHIVE_FAILED); -+ EVP_DigestInit(*ctx, EVP_sha1()); - return (ARCHIVE_OK); - } - -@@ -517,7 +530,7 @@ static int - __archive_openssl_sha1update(archive_sha1_ctx *ctx, const void *indata, - size_t insize) - { -- EVP_DigestUpdate(ctx, indata, insize); -+ EVP_DigestUpdate(*ctx, indata, insize); - return (ARCHIVE_OK); - } - -@@ -528,8 +541,11 @@ __archive_openssl_sha1final(archive_sha1 - * this is meant to cope with that. Real fix is probably to fix - * archive_write_set_format_xar.c - */ -- if (ctx->digest) -- EVP_DigestFinal(ctx, md, NULL); -+ if (*ctx) { -+ EVP_DigestFinal(*ctx, md, NULL); -+ EVP_MD_CTX_free(*ctx); -+ *ctx = NULL; -+ } - return (ARCHIVE_OK); - } - -@@ -733,7 +749,9 @@ __archive_nettle_sha256final(archive_sha - static int - __archive_openssl_sha256init(archive_sha256_ctx *ctx) - { -- EVP_DigestInit(ctx, EVP_sha256()); -+ if ((*ctx = EVP_MD_CTX_new()) == NULL) -+ return (ARCHIVE_FAILED); -+ EVP_DigestInit(*ctx, EVP_sha256()); - return (ARCHIVE_OK); - } - -@@ -741,14 +759,18 @@ static int - __archive_openssl_sha256update(archive_sha256_ctx *ctx, const void *indata, - size_t insize) - { -- EVP_DigestUpdate(ctx, indata, insize); -+ EVP_DigestUpdate(*ctx, indata, insize); - return (ARCHIVE_OK); - } - - static int - __archive_openssl_sha256final(archive_sha256_ctx *ctx, void *md) - { -- EVP_DigestFinal(ctx, md, NULL); -+ if (*ctx) { -+ EVP_DigestFinal(*ctx, md, NULL); -+ EVP_MD_CTX_free(*ctx); -+ *ctx = NULL; -+ } - return (ARCHIVE_OK); - } - -@@ -928,7 +950,9 @@ __archive_nettle_sha384final(archive_sha - static int - __archive_openssl_sha384init(archive_sha384_ctx *ctx) - { -- EVP_DigestInit(ctx, EVP_sha384()); -+ if ((*ctx = EVP_MD_CTX_new()) == NULL) -+ return (ARCHIVE_FAILED); -+ EVP_DigestInit(*ctx, EVP_sha384()); - return (ARCHIVE_OK); - } - -@@ -936,14 +960,18 @@ static int - __archive_openssl_sha384update(archive_sha384_ctx *ctx, const void *indata, - size_t insize) - { -- EVP_DigestUpdate(ctx, indata, insize); -+ EVP_DigestUpdate(*ctx, indata, insize); - return (ARCHIVE_OK); - } - - static int - __archive_openssl_sha384final(archive_sha384_ctx *ctx, void *md) - { -- EVP_DigestFinal(ctx, md, NULL); -+ if (*ctx) { -+ EVP_DigestFinal(*ctx, md, NULL); -+ EVP_MD_CTX_free(*ctx); -+ *ctx = NULL; -+ } - return (ARCHIVE_OK); - } - -@@ -1147,7 +1175,9 @@ __archive_nettle_sha512final(archive_sha - static int - __archive_openssl_sha512init(archive_sha512_ctx *ctx) - { -- EVP_DigestInit(ctx, EVP_sha512()); -+ if ((*ctx = EVP_MD_CTX_new()) == NULL) -+ return (ARCHIVE_FAILED); -+ EVP_DigestInit(*ctx, EVP_sha512()); - return (ARCHIVE_OK); - } - -@@ -1155,14 +1185,18 @@ static int - __archive_openssl_sha512update(archive_sha512_ctx *ctx, const void *indata, - size_t insize) - { -- EVP_DigestUpdate(ctx, indata, insize); -+ EVP_DigestUpdate(*ctx, indata, insize); - return (ARCHIVE_OK); - } - - static int - __archive_openssl_sha512final(archive_sha512_ctx *ctx, void *md) - { -- EVP_DigestFinal(ctx, md, NULL); -+ if (*ctx) { -+ EVP_DigestFinal(*ctx, md, NULL); -+ EVP_MD_CTX_free(*ctx); -+ *ctx = NULL; -+ } - return (ARCHIVE_OK); - } - ---- a/Utilities/cmlibarchive/libarchive/archive_digest_private.h -+++ b/Utilities/cmlibarchive/libarchive/archive_digest_private.h -@@ -161,7 +161,7 @@ typedef CC_MD5_CTX archive_md5_ctx; - #elif defined(ARCHIVE_CRYPTO_MD5_NETTLE) - typedef struct md5_ctx archive_md5_ctx; - #elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL) --typedef EVP_MD_CTX archive_md5_ctx; -+typedef EVP_MD_CTX *archive_md5_ctx; - #elif defined(ARCHIVE_CRYPTO_MD5_WIN) - typedef Digest_CTX archive_md5_ctx; - #else -@@ -175,7 +175,7 @@ typedef RIPEMD160_CTX archive_rmd160_ctx - #elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE) - typedef struct ripemd160_ctx archive_rmd160_ctx; - #elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL) --typedef EVP_MD_CTX archive_rmd160_ctx; -+typedef EVP_MD_CTX *archive_rmd160_ctx; - #else - typedef unsigned char archive_rmd160_ctx; - #endif -@@ -189,7 +189,7 @@ typedef CC_SHA1_CTX archive_sha1_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE) - typedef struct sha1_ctx archive_sha1_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) --typedef EVP_MD_CTX archive_sha1_ctx; -+typedef EVP_MD_CTX *archive_sha1_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA1_WIN) - typedef Digest_CTX archive_sha1_ctx; - #else -@@ -209,7 +209,7 @@ typedef CC_SHA256_CTX archive_sha256_ctx - #elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE) - typedef struct sha256_ctx archive_sha256_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) --typedef EVP_MD_CTX archive_sha256_ctx; -+typedef EVP_MD_CTX *archive_sha256_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA256_WIN) - typedef Digest_CTX archive_sha256_ctx; - #else -@@ -227,7 +227,7 @@ typedef CC_SHA512_CTX archive_sha384_ctx - #elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE) - typedef struct sha384_ctx archive_sha384_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) --typedef EVP_MD_CTX archive_sha384_ctx; -+typedef EVP_MD_CTX *archive_sha384_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA384_WIN) - typedef Digest_CTX archive_sha384_ctx; - #else -@@ -247,7 +247,7 @@ typedef CC_SHA512_CTX archive_sha512_ctx - #elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE) - typedef struct sha512_ctx archive_sha512_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) --typedef EVP_MD_CTX archive_sha512_ctx; -+typedef EVP_MD_CTX *archive_sha512_ctx; - #elif defined(ARCHIVE_CRYPTO_SHA512_WIN) - typedef Digest_CTX archive_sha512_ctx; - #else ---- a/Utilities/cmlibarchive/libarchive/archive_hmac.c -+++ b/Utilities/cmlibarchive/libarchive/archive_hmac.c -@@ -176,8 +176,10 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ct - static int - __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) - { -- HMAC_CTX_init(ctx); -- HMAC_Init(ctx, key, key_len, EVP_sha1()); -+ *ctx = HMAC_CTX_new(); -+ if (*ctx == NULL) -+ return -1; -+ HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL); - return 0; - } - -@@ -185,22 +187,22 @@ static void - __hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, - size_t data_len) - { -- HMAC_Update(ctx, data, data_len); -+ HMAC_Update(*ctx, data, data_len); - } - - static void - __hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) - { - unsigned int len = (unsigned int)*out_len; -- HMAC_Final(ctx, out, &len); -+ HMAC_Final(*ctx, out, &len); - *out_len = len; - } - - static void - __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) - { -- HMAC_CTX_cleanup(ctx); -- memset(ctx, 0, sizeof(*ctx)); -+ HMAC_CTX_free(*ctx); -+ *ctx = NULL; - } - - #else ---- a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h -+++ b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h -@@ -72,7 +72,7 @@ typedef struct hmac_sha1_ctx archive_hma - #elif defined(HAVE_LIBCRYPTO) - #include "archive_openssl_hmac_private.h" - --typedef HMAC_CTX archive_hmac_sha1_ctx; -+typedef HMAC_CTX* archive_hmac_sha1_ctx; - - #else - diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index 8e0585044c..6582b3a27b 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=8.25 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/coreutils -PKG_MD5SUM:=070e43ba7f618d747414ef56ab248a48 +PKG_HASH:=31e67c057a5b32a582f26408c789e11c2e8d676593324849dcf5779296cdce87 HOST_BUILD_PARALLEL := 1 diff --git a/tools/dosfstools/Makefile b/tools/dosfstools/Makefile index d637a3b4c2..d0620f1ffa 100644 --- a/tools/dosfstools/Makefile +++ b/tools/dosfstools/Makefile @@ -13,7 +13,7 @@ PKG_VERSION:=4.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/dosfstools/dosfstools/releases/download/v$(PKG_VERSION)/ \ http://fossies.org/linux/misc -PKG_MD5SUM:=9037738953559d1efe04fc5408b6846216cc0138f7f9d32de80b6ec3c35e7daf +PKG_HASH:=9037738953559d1efe04fc5408b6846216cc0138f7f9d32de80b6ec3c35e7daf HOST_FIXUP:=autoreconf diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index ffe1782eb1..fca90f2091 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_VERSION:=1.43.3 -PKG_MD5SUM:=ec0cd4faac71b2fcf9f73733e4d50ead +PKG_HASH:=ce8ef1bbb0d4730f170167284fda156ac9d6bf18db2750eb94af619a81b19927 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/tools/elftosb/Makefile b/tools/elftosb/Makefile index 5adafef736..9079ac5803 100644 --- a/tools/elftosb/Makefile +++ b/tools/elftosb/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=10.12.01 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/ -PKG_MD5SUM:=e8005d606c1e0bb3507c82f6eceb3056 +PKG_HASH:=77bb6981620f7575b87d136d94c7daa88dd09195959cc75fc18b138369ecd42b include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/expat/Makefile b/tools/expat/Makefile index 93e0f74cd5..bdc93fe86b 100644 --- a/tools/expat/Makefile +++ b/tools/expat/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=expat PKG_VERSION:=2.2.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_MD5SUM:=2f47841c829facb346eb6e3fab5212e2 +PKG_HASH:=d9e50ff2d19b3538bd2127902a89987474e1a4db8e43a66a4d1a712ab9a504ff PKG_SOURCE_URL:=@SF/expat HOST_BUILD_PARALLEL:=1 diff --git a/tools/findutils/Makefile b/tools/findutils/Makefile index 188257925e..b07c53d9f6 100644 --- a/tools/findutils/Makefile +++ b/tools/findutils/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=4.6.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=9936aa8009438ce185bea2694a997fc1 +PKG_HASH:=ded4c9f73731cd48fec3b6bdaccce896473b6d8e337e9612e16cf1431bb1169d HOST_BUILD_PARALLEL:=1 diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 456b7a39f5..69cba69a58 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -41,6 +41,7 @@ define Host/Compile $(call cc,mkplanexfw sha1) $(call cc,mktplinkfw md5, -Wall) $(call cc,mktplinkfw2 md5) + $(call cc,mktplinkfw-kernel) $(call cc,tplink-safeloader md5, -Wall) $(call cc,pc1crypt) $(call cc,osbridge-crc) diff --git a/tools/firmware-utils/src/addpattern.c b/tools/firmware-utils/src/addpattern.c index 1d72285610..2ecc7ffd75 100644 --- a/tools/firmware-utils/src/addpattern.c +++ b/tools/firmware-utils/src/addpattern.c @@ -105,6 +105,13 @@ struct board_info { }; struct board_info boards[] = { + { + .id = "E2100L", + .pattern = "NL1X", + .hw_ver = 0x00, + .sn = 0x0f, + .flags = {0x3f, 0x00}, + }, { .id = "WRT160NL", .pattern = "NL16", diff --git a/tools/firmware-utils/src/mktplinkfw-kernel.c b/tools/firmware-utils/src/mktplinkfw-kernel.c new file mode 100644 index 0000000000..1565e73545 --- /dev/null +++ b/tools/firmware-utils/src/mktplinkfw-kernel.c @@ -0,0 +1,352 @@ +/* + * Copyright (C) 2009 Gabor Juhos + * Copyright (C) 2016 Tal Keren + * + * Stripped down version of the regular tplink firmware that is only used + * for compressing and booting the kernel. + * + * This tool was based on: + * TP-Link WR941 V2 firmware checksum fixing tool. + * Copyright (C) 2008,2009 Wang Jian + * + * 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 /* for unlink() */ +#include +#include /* for getopt() */ +#include +#include +#include + +#include +#include + +#define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); }) + +#define HEADER_VERSION_V1 0x01000000 + +#define MD5SUM_LEN 16 + +struct file_info { + char *file_name; /* name of the file */ + uint32_t file_size; /* length of the file */ +}; + +struct fw_header { + uint32_t version; /* header version */ + char vendor_name[24]; + char fw_version[36]; + uint32_t hw_id; /* hardware id */ + uint32_t hw_rev; /* hardware revision */ + uint32_t unk1; + uint8_t md5sum1[MD5SUM_LEN]; + uint32_t unk2; + uint8_t md5sum2[MD5SUM_LEN]; + uint32_t unk3; + uint32_t kernel_la; /* kernel load address */ + uint32_t kernel_ep; /* kernel entry point */ + uint32_t fw_length; /* total length of the firmware */ + uint32_t kernel_ofs; /* kernel data offset */ + uint32_t kernel_len; /* kernel data length */ + uint32_t rootfs_ofs; /* rootfs data offset */ + uint32_t rootfs_len; /* rootfs data length */ + uint32_t boot_ofs; /* bootloader data offset */ + uint32_t boot_len; /* bootloader data length */ + uint16_t ver_hi; + uint16_t ver_mid; + uint16_t ver_lo; + uint8_t pad[354]; +} __attribute__ ((packed)); + + +/* + * Globals + */ +static char *ofname; +static char *progname; +static char *vendor = "TP-LINK Technologies"; +static char *version = "ver. 1.0"; +static char *fw_ver = "0.0.0"; +static uint32_t hdr_ver = HEADER_VERSION_V1; + +static char *opt_hw_id; +static uint32_t hw_id = 0; +static struct file_info kernel_info; +static uint32_t kernel_la = 0; +static uint32_t kernel_ep = 0; +static uint32_t kernel_len = 0; + +/* + * Message macros + */ +#define ERR(fmt, ...) do { \ + fflush(0); \ + fprintf(stderr, "[%s] *** error: " fmt "\n", \ + progname, ## __VA_ARGS__ ); \ +} while (0) + +#define ERRS(fmt, ...) do { \ + int save = errno; \ + fflush(0); \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ + progname, ## __VA_ARGS__, strerror(save)); \ +} while (0) + +#define DBG(fmt, ...) do { \ + fprintf(stderr, "[%s] " fmt "\n", progname, ## __VA_ARGS__ ); \ +} while (0) + +static void usage(int status) +{ + FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; + struct board_info *board; + + fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); + fprintf(stream, +"\n" +"Options:\n" +" -E kernel entry point with (hexval prefixed with 0x)\n" +" -L kernel load address with (hexval prefixed with 0x)\n" +" -H use hardware id specified with \n" +" -k read kernel image from the file \n" +" -o write output to the file \n" +" -N set image vendor to \n" +" -V set image version to \n" +" -h show this screen\n" + ); + + exit(status); +} + +static int get_file_stat(struct file_info *fdata) +{ + struct stat st; + int res; + + if (fdata->file_name == NULL) + return 0; + + res = stat(fdata->file_name, &st); + if (res){ + ERRS("stat failed on %s", fdata->file_name); + return res; + } + + fdata->file_size = st.st_size; + return 0; +} + +static int read_to_buf(struct file_info *fdata, char *buf) +{ + FILE *f; + int ret = EXIT_FAILURE; + + f = fopen(fdata->file_name, "r"); + if (f == NULL) { + ERRS("could not open \"%s\" for reading", fdata->file_name); + goto out; + } + + errno = 0; + fread(buf, fdata->file_size, 1, f); + if (errno != 0) { + ERRS("unable to read from file \"%s\"", fdata->file_name); + goto out_close; + } + + ret = EXIT_SUCCESS; + + out_close: + fclose(f); + out: + return ret; +} + +static int check_options(void) +{ + int ret; + + if (opt_hw_id) { + hw_id = strtoul(opt_hw_id, NULL, 0); + } + + if (!kernel_la || !kernel_ep) { + ERR("kernel loading address and entry point must be specified"); + return -1; + } + + if (kernel_info.file_name == NULL) { + ERR("no kernel image specified"); + return -1; + } + + ret = get_file_stat(&kernel_info); + if (ret) + return ret; + + kernel_len = kernel_info.file_size; + + if (ofname == NULL) { + ERR("no output file specified"); + return -1; + } + + return 0; +} + +static void fill_header(char *buf) +{ + struct fw_header *hdr = (struct fw_header *)buf; + + memset(hdr, 0, sizeof(struct fw_header)); + + hdr->version = htonl(hdr_ver); + strncpy(hdr->vendor_name, vendor, sizeof(hdr->vendor_name)); + strncpy(hdr->fw_version, version, sizeof(hdr->fw_version)); + + /** + * This field is ignored and not specified in stock firmware + * It is specified here to ensure sysupgrade hardware compatibility + * The hardware id of a device is in the product-info partition + */ + hdr->hw_id = htonl(hw_id); + + hdr->kernel_la = htonl(kernel_la); + hdr->kernel_ep = htonl(kernel_ep); + + hdr->kernel_ofs = htonl(sizeof(struct fw_header)); + hdr->kernel_len = htonl(kernel_len); +} + +static int write_fw(char *data, int len) +{ + FILE *f; + int ret = EXIT_FAILURE; + + f = fopen(ofname, "w"); + if (f == NULL) { + ERRS("could not open \"%s\" for writing", ofname); + goto out; + } + + errno = 0; + fwrite(data, len, 1, f); + if (errno) { + ERRS("unable to write output file"); + goto out_flush; + } + + DBG("firmware file \"%s\" completed", ofname); + + ret = EXIT_SUCCESS; + + out_flush: + fflush(f); + fclose(f); + if (ret != EXIT_SUCCESS) { + unlink(ofname); + } + out: + return ret; +} + +static int build_fw(void) +{ + int buflen; + char *buf; + char *p; + int ret = EXIT_FAILURE; + + buflen = sizeof(struct fw_header) + kernel_len; + buflen = ALIGN(buflen, 0x4); + + buf = malloc(buflen); + if (!buf) { + ERR("no memory for buffer\n"); + goto out; + } + + memset(buf, 0, buflen); + p = buf + sizeof(struct fw_header); + ret = read_to_buf(&kernel_info, p); + if (ret) + goto out_free_buf; + + fill_header(buf); + ret = write_fw(buf, buflen); + if (ret) + goto out_free_buf; + + ret = EXIT_SUCCESS; + + out_free_buf: + free(buf); + out: + return ret; +} + +int main(int argc, char *argv[]) +{ + int ret = EXIT_FAILURE; + int err; + + FILE *outfile; + + progname = basename(argv[0]); + + while ( 1 ) { + int c; + + c = getopt(argc, argv, "H:E:L:V:N:k:o:h"); + if (c == -1) + break; + + switch (c) { + case 'H': + opt_hw_id = optarg; + break; + case 'E': + sscanf(optarg, "0x%x", &kernel_ep); + break; + case 'L': + sscanf(optarg, "0x%x", &kernel_la); + break; + case 'V': + version = optarg; + break; + case 'N': + vendor = optarg; + break; + case 'k': + kernel_info.file_name = optarg; + break; + case 'o': + ofname = optarg; + break; + case 'h': + usage(EXIT_SUCCESS); + break; + default: + usage(EXIT_FAILURE); + break; + } + } + + ret = check_options(); + if (ret) + goto out; + + ret = build_fw(); + + out: + return ret; +} + diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c index 34e6546a2d..fbf89609c2 100644 --- a/tools/firmware-utils/src/mktplinkfw.c +++ b/tools/firmware-utils/src/mktplinkfw.c @@ -177,6 +177,20 @@ static struct flash_layout layouts[] = { .kernel_la = 0x00000000 , .kernel_ep = 0xc0000000, .rootfs_ofs = 0x2a0000, + }, { + /* + Some devices (e.g. TL-WR1043 v4) use a mktplinkfw kernel image + embedded in a tplink-safeloader image as os-image partition. + + We use a 1.5MB partition for the compressed kernel, which should + be sufficient, but not too wasteful (the flash of the TL-WR1043 v4 + has 16MB in total). + */ + .id = "16Msafeloader", + .fw_max_len = 0x180000, + .kernel_la = 0x80060000, + .kernel_ep = 0x80060000, + .rootfs_ofs = 0, }, { /* terminating entry */ } diff --git a/tools/firmware-utils/src/mktplinkfw2.c b/tools/firmware-utils/src/mktplinkfw2.c index 213e6729a4..3ab5c52ec2 100644 --- a/tools/firmware-utils/src/mktplinkfw2.c +++ b/tools/firmware-utils/src/mktplinkfw2.c @@ -155,6 +155,12 @@ static struct flash_layout layouts[] = { .kernel_la = 0x80000000, .kernel_ep = 0x80000000, .rootfs_ofs = 0x140000, + }, { + .id = "8MLmtk", + .fw_max_len = 0x7b0000, + .kernel_la = 0x80000000, + .kernel_ep = 0x80000000, + .rootfs_ofs = 0x140000, }, { /* terminating entry */ } @@ -191,6 +197,13 @@ static struct board_info boards[] = { .layout_id = "8Mmtk", .hdr_ver = 3, .endian_swap = true, + }, { + .id = "ArcherMR200", + .hw_id = 0xd7500001, + .hw_rev = 0x4a, + .layout_id = "8MLmtk", + .hdr_ver = 3, + .endian_swap = true, }, { /* terminating entry */ } diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index 2e8da8fc64..89a6787b22 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -53,6 +53,8 @@ #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); }) +#define MAX_PARTITIONS 32 + /** An image partition table entry */ struct image_partition_entry { const char *name; @@ -67,12 +69,15 @@ struct flash_partition_entry { uint32_t size; }; +/** Firmware layout description */ struct device_info { + const char *id; const char *vendor; const char *support_list; char support_trail; - const struct flash_partition_entry *partitions; - void *(*generate_sysupgrade_image)(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len); + const struct flash_partition_entry partitions[MAX_PARTITIONS+1]; + const char *first_sysupgrade_partition; + const char *last_sysupgrade_partition; }; /** The content of the soft-version structure */ @@ -109,146 +114,329 @@ static const uint8_t md5_salt[16] = { }; -/** Vendor information for CPE210/220/510/520 */ -static const char cpe510_vendor[] = "CPE510(TP-LINK|UN|N300-5):1.0\r\n"; - -/** Vendor information for C2600 */ -static const char c2600_vendor[] = ""; - -/** Vendor information for EAP120 */ -static const char eap120_vendor[] = "EAP120(TP-LINK|UN|N300-2):1.0\r\n"; - -/** - The flash partition table for CPE210/220/510/520; - it is the same as the one used by the stock images. -*/ -static const struct flash_partition_entry cpe510_partitions[] = { - {"fs-uboot", 0x00000, 0x20000}, - {"partition-table", 0x20000, 0x02000}, - {"default-mac", 0x30000, 0x00020}, - {"product-info", 0x31100, 0x00100}, - {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x170000}, - {"soft-version", 0x1b0000, 0x00100}, - {"support-list", 0x1b1000, 0x00400}, - {"file-system", 0x1c0000, 0x600000}, - {"user-config", 0x7c0000, 0x10000}, - {"default-config", 0x7d0000, 0x10000}, - {"log", 0x7e0000, 0x10000}, - {"radio", 0x7f0000, 0x10000}, - {NULL, 0, 0} -}; - -/** - The flash partition table for C2600; - it is the same as the one used by the stock images. -*/ -static const struct flash_partition_entry c2600_partitions[] = { - {"SBL1", 0x00000, 0x20000}, - {"MIBIB", 0x20000, 0x20000}, - {"SBL2", 0x40000, 0x20000}, - {"SBL3", 0x60000, 0x30000}, - {"DDRCONFIG", 0x90000, 0x10000}, - {"SSD", 0xa0000, 0x10000}, - {"TZ", 0xb0000, 0x30000}, - {"RPM", 0xe0000, 0x20000}, - {"fs-uboot", 0x100000, 0x70000}, - {"uboot-env", 0x170000, 0x40000}, - {"radio", 0x1b0000, 0x40000}, - {"os-image", 0x1f0000, 0x200000}, - {"file-system", 0x3f0000, 0x1b00000}, - {"default-mac", 0x1ef0000, 0x00200}, - {"pin", 0x1ef0200, 0x00200}, - {"product-info", 0x1ef0400, 0x0fc00}, - {"partition-table", 0x1f00000, 0x10000}, - {"soft-version", 0x1f10000, 0x10000}, - {"support-list", 0x1f20000, 0x10000}, - {"profile", 0x1f30000, 0x10000}, - {"default-config", 0x1f40000, 0x10000}, - {"user-config", 0x1f50000, 0x40000}, - {"qos-db", 0x1f90000, 0x40000}, - {"usb-config", 0x1fd0000, 0x10000}, - {"log", 0x1fe0000, 0x20000}, - {NULL, 0, 0} -}; - -static const struct flash_partition_entry c5_partitions[] = { - {"fs-uboot", 0x00000, 0x40000}, - {"os-image", 0x40000, 0x200000}, - {"file-system", 0x240000, 0xc00000}, - {"default-mac", 0xe40000, 0x00200}, - {"pin", 0xe40200, 0x00200}, - {"product-info", 0xe40400, 0x00200}, - {"partition-table", 0xe50000, 0x10000}, - {"soft-version", 0xe60000, 0x00200}, - {"support-list", 0xe61000, 0x0f000}, - {"profile", 0xe70000, 0x10000}, - {"default-config", 0xe80000, 0x10000}, - {"user-config", 0xe90000, 0x50000}, - {"log", 0xee0000, 0x100000}, - {"radio_bk", 0xfe0000, 0x10000}, - {"radio", 0xff0000, 0x10000}, - {NULL, 0, 0} -}; - -/** The flash partition table for EAP120; - it is the same as the one used by the stock images. -*/ -static const struct flash_partition_entry eap120_partitions[] = { - {"fs-uboot", 0x00000, 0x20000}, - {"partition-table", 0x20000, 0x02000}, - {"default-mac", 0x30000, 0x00020}, - {"support-list", 0x31000, 0x00100}, - {"product-info", 0x31100, 0x00100}, - {"soft-version", 0x32000, 0x00100}, - {"os-image", 0x40000, 0x180000}, - {"file-system", 0x1c0000, 0x600000}, - {"user-config", 0x7c0000, 0x10000}, - {"backup-config", 0x7d0000, 0x10000}, - {"log", 0x7e0000, 0x10000}, - {"radio", 0x7f0000, 0x10000}, - {NULL, 0, 0} +/** Firmware layout table */ +static struct device_info boards[] = { + /** Firmware layout for the CPE210/220 */ + { + .id = "CPE210", + .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n", + .support_list = + "SupportList:\r\n" + "CPE210(TP-LINK|UN|N300-2):1.0\r\n" + "CPE210(TP-LINK|UN|N300-2):1.1\r\n" + "CPE210(TP-LINK|US|N300-2):1.1\r\n" + "CPE210(TP-LINK|EU|N300-2):1.1\r\n" + "CPE220(TP-LINK|UN|N300-2):1.1\r\n" + "CPE220(TP-LINK|US|N300-2):1.1\r\n" + "CPE220(TP-LINK|EU|N300-2):1.1\r\n", + .support_trail = '\xff', + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"signature", 0x32000, 0x00400}, + {"os-image", 0x40000, 0x170000}, + {"soft-version", 0x1b0000, 0x00100}, + {"support-list", 0x1b1000, 0x00400}, + {"file-system", 0x1c0000, 0x600000}, + {"user-config", 0x7c0000, 0x10000}, + {"default-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system", + }, + + /** Firmware layout for the CPE510/520 */ + { + .id = "CPE510", + .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n", + .support_list = + "SupportList:\r\n" + "CPE510(TP-LINK|UN|N300-5):1.0\r\n" + "CPE510(TP-LINK|UN|N300-5):1.1\r\n" + "CPE510(TP-LINK|UN|N300-5):1.1\r\n" + "CPE510(TP-LINK|US|N300-5):1.1\r\n" + "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", + .support_trail = '\xff', + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"signature", 0x32000, 0x00400}, + {"os-image", 0x40000, 0x170000}, + {"soft-version", 0x1b0000, 0x00100}, + {"support-list", 0x1b1000, 0x00400}, + {"file-system", 0x1c0000, 0x600000}, + {"user-config", 0x7c0000, 0x10000}, + {"default-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system", + }, + + { + .id = "WBS210", + .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n", + .support_list = + "SupportList:\r\n" + "WBS210(TP-LINK|UN|N300-2):1.20\r\n" + "WBS210(TP-LINK|US|N300-2):1.20\r\n" + "WBS210(TP-LINK|EU|N300-2):1.20\r\n", + .support_trail = '\xff', + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"signature", 0x32000, 0x00400}, + {"os-image", 0x40000, 0x170000}, + {"soft-version", 0x1b0000, 0x00100}, + {"support-list", 0x1b1000, 0x00400}, + {"file-system", 0x1c0000, 0x600000}, + {"user-config", 0x7c0000, 0x10000}, + {"default-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system", + }, + + { + .id = "WBS510", + .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n", + .support_list = + "SupportList:\r\n" + "WBS510(TP-LINK|UN|N300-5):1.20\r\n" + "WBS510(TP-LINK|US|N300-5):1.20\r\n" + "WBS510(TP-LINK|EU|N300-5):1.20\r\n", + .support_trail = '\xff', + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"signature", 0x32000, 0x00400}, + {"os-image", 0x40000, 0x170000}, + {"soft-version", 0x1b0000, 0x00100}, + {"support-list", 0x1b1000, 0x00400}, + {"file-system", 0x1c0000, 0x600000}, + {"user-config", 0x7c0000, 0x10000}, + {"default-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system", + }, + + /** Firmware layout for the C2600 */ + { + .id = "C2600", + .vendor = "", + .support_list = + "SupportList:\r\n" + "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n", + .support_trail = '\x00', + + .partitions = { + {"SBL1", 0x00000, 0x20000}, + {"MIBIB", 0x20000, 0x20000}, + {"SBL2", 0x40000, 0x20000}, + {"SBL3", 0x60000, 0x30000}, + {"DDRCONFIG", 0x90000, 0x10000}, + {"SSD", 0xa0000, 0x10000}, + {"TZ", 0xb0000, 0x30000}, + {"RPM", 0xe0000, 0x20000}, + {"fs-uboot", 0x100000, 0x70000}, + {"uboot-env", 0x170000, 0x40000}, + {"radio", 0x1b0000, 0x40000}, + {"os-image", 0x1f0000, 0x200000}, + {"file-system", 0x3f0000, 0x1b00000}, + {"default-mac", 0x1ef0000, 0x00200}, + {"pin", 0x1ef0200, 0x00200}, + {"product-info", 0x1ef0400, 0x0fc00}, + {"partition-table", 0x1f00000, 0x10000}, + {"soft-version", 0x1f10000, 0x10000}, + {"support-list", 0x1f20000, 0x10000}, + {"profile", 0x1f30000, 0x10000}, + {"default-config", 0x1f40000, 0x10000}, + {"user-config", 0x1f50000, 0x40000}, + {"qos-db", 0x1f90000, 0x40000}, + {"usb-config", 0x1fd0000, 0x10000}, + {"log", 0x1fe0000, 0x20000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + + /** Firmware layout for the C9 */ + { + .id = "ARCHERC9", + .vendor = "", + .support_list = + "SupportList:\n" + "{product_name:ArcherC9," + "product_ver:1.0.0," + "special_id:00000000}\n", + .support_trail = '\x00', + + .partitions = { + {"fs-uboot", 0x00000, 0x40000}, + {"os-image", 0x40000, 0x200000}, + {"file-system", 0x240000, 0xc00000}, + {"default-mac", 0xe40000, 0x00200}, + {"pin", 0xe40200, 0x00200}, + {"product-info", 0xe40400, 0x00200}, + {"partition-table", 0xe50000, 0x10000}, + {"soft-version", 0xe60000, 0x00200}, + {"support-list", 0xe61000, 0x0f000}, + {"profile", 0xe70000, 0x10000}, + {"default-config", 0xe80000, 0x10000}, + {"user-config", 0xe90000, 0x50000}, + {"log", 0xee0000, 0x100000}, + {"radio_bk", 0xfe0000, 0x10000}, + {"radio", 0xff0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + + /** Firmware layout for the EAP120 */ + { + .id = "EAP120", + .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n", + .support_list = + "SupportList:\r\n" + "EAP120(TP-LINK|UN|N300-2):1.0\r\n", + .support_trail = '\xff', + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"support-list", 0x31000, 0x00100}, + {"product-info", 0x31100, 0x00100}, + {"soft-version", 0x32000, 0x00100}, + {"os-image", 0x40000, 0x180000}, + {"file-system", 0x1c0000, 0x600000}, + {"user-config", 0x7c0000, 0x10000}, + {"backup-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + + /** Firmware layout for the TL-WR1043 v4 */ + { + .id = "TLWR1043NDV4", + .vendor = "", + .support_list = + "SupportList:\n" + "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n", + .support_trail = '\x00', + + /** + 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. + */ + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"os-image", 0x20000, 0x180000}, + {"file-system", 0x1a0000, 0xdb0000}, + {"default-mac", 0xf50000, 0x00200}, + {"pin", 0xf50200, 0x00200}, + {"product-info", 0xf50400, 0x0fc00}, + {"soft-version", 0xf60000, 0x0b000}, + {"support-list", 0xf6b000, 0x04000}, + {"profile", 0xf70000, 0x04000}, + {"default-config", 0xf74000, 0x0b000}, + {"user-config", 0xf80000, 0x40000}, + {"partition-table", 0xfc0000, 0x10000}, + {"log", 0xfd0000, 0x20000}, + {"radio", 0xff0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + + /** Firmware layout for the RE450 */ + { + .id = "RE450", + .vendor = "", + .support_list = + "SupportList:\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n" + "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n", + .support_trail = '\x00', + + /** + The flash partition table for RE450; + it is almost the same as the one used by the stock images, + 576KB were moved from file-system to os-image. + */ + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"os-image", 0x20000, 0x150000}, + {"file-system", 0x170000, 0x4a0000}, + {"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" + }, + + {} }; -/** - The support list for CPE210/220 -*/ -static const char cpe210_support_list[] = - "SupportList:\r\n" - "CPE210(TP-LINK|UN|N300-2):1.0\r\n" - "CPE210(TP-LINK|UN|N300-2):1.1\r\n" - "CPE220(TP-LINK|UN|N300-2):1.0\r\n" - "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; -/** - The support list for CPE210/220/510/520 -*/ -static const char cpe510_support_list[] = - "SupportList:\r\n" - "CPE510(TP-LINK|UN|N300-5):1.0\r\n" - "CPE510(TP-LINK|UN|N300-5):1.1\r\n" - "CPE520(TP-LINK|UN|N300-5):1.0\r\n" - "CPE520(TP-LINK|UN|N300-5):1.1\r\n"; - -/** - The support list for C2600 -*/ -static const char c2600_support_list[] = - "SupportList:\r\n" - "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n"; - -static const char c9_support_list[] = - "SupportList:\n" - "{product_name:ArcherC9," - "product_ver:1.0.0," - "special_id:00000000}\n"; - -/** - The support list for EAP120 -*/ -static const char eap120_support_list[] = - "SupportList:\r\n" - "EAP120(TP-LINK|UN|N300-2):1.0\r\n"; - #define error(_ret, _errno, _str, ...) \ do { \ fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \ @@ -348,7 +536,7 @@ static struct image_partition_entry make_soft_version(uint32_t rev) { } /** Generates the support-list partition */ -static struct image_partition_entry make_support_list(struct device_info *info) { +static struct image_partition_entry make_support_list(const struct device_info *info) { size_t len = strlen(info->support_list); struct image_partition_entry entry = alloc_image_partition("support-list", len + 9); @@ -421,12 +609,22 @@ static struct image_partition_entry read_file(const char *part_name, const char I think partition-table must be the first partition in the firmware image. */ -static void put_partitions(uint8_t *buffer, const struct image_partition_entry *parts) { - size_t i; +static void put_partitions(uint8_t *buffer, const struct flash_partition_entry *flash_parts, const struct image_partition_entry *parts) { + size_t i, j; char *image_pt = (char *)buffer, *end = image_pt + 0x800; size_t base = 0x800; for (i = 0; parts[i].name; i++) { + for (j = 0; flash_parts[j].name; j++) { + if (!strcmp(flash_parts[j].name, parts[i].name)) { + if (parts[i].size > flash_parts[j].size) + error(1, 0, "%s partition too big (more than %u bytes)", flash_parts[j].name, (unsigned)flash_parts[j].size); + break; + } + } + + assert(flash_parts[j].name); + memcpy(buffer + base, parts[i].data, parts[i].size); size_t len = end-image_pt; @@ -439,10 +637,6 @@ static void put_partitions(uint8_t *buffer, const struct image_partition_entry * base += parts[i].size; } - - image_pt++; - - memset(image_pt, 0xff, end-image_pt); } /** Generates and writes the image MD5 checksum */ @@ -471,7 +665,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 char *vendor, const struct image_partition_entry *parts, size_t *len) { +static void * generate_factory_image(const struct device_info *info, const struct image_partition_entry *parts, size_t *len) { *len = 0x1814; size_t i; @@ -482,14 +676,16 @@ static void * generate_factory_image(const char *vendor, const struct image_part if (!image) error(1, errno, "malloc"); + memset(image, 0xff, *len); put32(image, *len); - size_t vendor_len = strlen(vendor); - put32(image+0x14, vendor_len); - memcpy(image+0x18, vendor, vendor_len); - memset(image+0x18+vendor_len, 0xff, 4092-vendor_len); + if (info->vendor) { + size_t vendor_len = strlen(info->vendor); + put32(image+0x14, vendor_len); + memcpy(image+0x18, info->vendor, vendor_len); + } - put_partitions(image + 0x1014, parts); + put_partitions(image + 0x1014, info->partitions, parts); put_md5(image+0x04, image+0x14, *len-0x14); return image; @@ -502,67 +698,39 @@ static void * generate_factory_image(const char *vendor, const struct image_part should be generalized when TP-LINK starts building its safeloader into hardware with different flash layouts. */ -static void * generate_sysupgrade_image(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) { - const struct flash_partition_entry *flash_os_image = &flash_parts[5]; - const struct flash_partition_entry *flash_soft_version = &flash_parts[6]; - const struct flash_partition_entry *flash_support_list = &flash_parts[7]; - const struct flash_partition_entry *flash_file_system = &flash_parts[8]; - - const struct image_partition_entry *image_os_image = &image_parts[3]; - const struct image_partition_entry *image_soft_version = &image_parts[1]; - const struct image_partition_entry *image_support_list = &image_parts[2]; - const struct image_partition_entry *image_file_system = &image_parts[4]; - - assert(strcmp(flash_os_image->name, "os-image") == 0); - assert(strcmp(flash_soft_version->name, "soft-version") == 0); - assert(strcmp(flash_support_list->name, "support-list") == 0); - assert(strcmp(flash_file_system->name, "file-system") == 0); - - assert(strcmp(image_os_image->name, "os-image") == 0); - assert(strcmp(image_soft_version->name, "soft-version") == 0); - assert(strcmp(image_support_list->name, "support-list") == 0); - assert(strcmp(image_file_system->name, "file-system") == 0); - - if (image_os_image->size > flash_os_image->size) - error(1, 0, "kernel image too big (more than %u bytes)", (unsigned)flash_os_image->size); - if (image_file_system->size > flash_file_system->size) - error(1, 0, "rootfs image too big (more than %u bytes)", (unsigned)flash_file_system->size); - - *len = flash_file_system->base - flash_os_image->base + image_file_system->size; - - uint8_t *image = malloc(*len); - if (!image) - error(1, errno, "malloc"); - - memset(image, 0xff, *len); - - memcpy(image, image_os_image->data, image_os_image->size); - memcpy(image + flash_soft_version->base - flash_os_image->base, image_soft_version->data, image_soft_version->size); - memcpy(image + flash_support_list->base - flash_os_image->base, image_support_list->data, image_support_list->size); - memcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size); - - return image; -} - -static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) { - const struct flash_partition_entry *flash_os_image = &flash_parts[11]; - const struct flash_partition_entry *flash_file_system = &flash_parts[12]; - - const struct image_partition_entry *image_os_image = &image_parts[3]; - const struct image_partition_entry *image_file_system = &image_parts[4]; +static void * generate_sysupgrade_image(const 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; + const struct flash_partition_entry *flash_first_partition = NULL; + const struct flash_partition_entry *flash_last_partition = NULL; + const struct image_partition_entry *image_last_partition = NULL; + + /** Find first and last partitions */ + for (i = 0; info->partitions[i].name; i++) { + if (!strcmp(info->partitions[i].name, info->first_sysupgrade_partition)) { + flash_first_partition = &info->partitions[i]; + flash_first_partition_index = i; + } else if (!strcmp(info->partitions[i].name, info->last_sysupgrade_partition)) { + flash_last_partition = &info->partitions[i]; + flash_last_partition_index = i; + } + } - assert(strcmp(flash_os_image->name, "os-image") == 0); - assert(strcmp(flash_file_system->name, "file-system") == 0); + assert(flash_first_partition && flash_last_partition); + assert(flash_first_partition_index < flash_last_partition_index); - assert(strcmp(image_os_image->name, "os-image") == 0); - assert(strcmp(image_file_system->name, "file-system") == 0); + /** Find last partition from image to calculate needed size */ + for (i = 0; image_parts[i].name; i++) { + if (!strcmp(image_parts[i].name, info->last_sysupgrade_partition)) { + image_last_partition = &image_parts[i]; + break; + } + } - if (image_os_image->size > flash_os_image->size) - error(1, 0, "kernel image too big (more than %u bytes)", (unsigned)flash_os_image->size); - if (image_file_system->size > flash_file_system->size) - error(1, 0, "rootfs image too big (more than %u bytes)", (unsigned)flash_file_system->size); + assert(image_last_partition); - *len = flash_file_system->base - flash_os_image->base + image_file_system->size; + *len = flash_last_partition->base - flash_first_partition->base + image_last_partition->size; uint8_t *image = malloc(*len); if (!image) @@ -570,89 +738,30 @@ static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry memset(image, 0xff, *len); - memcpy(image, image_os_image->data, image_os_image->size); - memcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size); - - return image; -} -static void *generate_sysupgrade_image_eap120(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) -{ - const struct flash_partition_entry *flash_os_image = &flash_parts[6]; - const struct flash_partition_entry *flash_file_system = &flash_parts[7]; - - const struct image_partition_entry *image_os_image = &image_parts[3]; - const struct image_partition_entry *image_file_system = &image_parts[4]; - - assert(strcmp(flash_os_image->name, "os-image") == 0); - assert(strcmp(flash_file_system->name, "file-system") == 0); - - assert(strcmp(image_os_image->name, "os-image") == 0); - assert(strcmp(image_file_system->name, "file-system") == 0); - - if (image_os_image->size > flash_os_image->size) - error(1, 0, "kernel image too big (more than %u bytes)", (unsigned)flash_os_image->size); - if (image_file_system->size > flash_file_system->size) - error(1, 0, "rootfs image too big (more than %u bytes)", (unsigned)flash_file_system->size); - - *len = flash_file_system->base - flash_os_image->base + image_file_system->size; - - uint8_t *image = malloc(*len); - if (!image) - error(1, errno, "malloc"); + for (i = flash_first_partition_index; i <= flash_last_partition_index; i++) { + for (j = 0; image_parts[j].name; j++) { + if (!strcmp(info->partitions[i].name, image_parts[j].name)) { + if (image_parts[j].size > info->partitions[i].size) + error(1, 0, "%s partition too big (more than %u bytes)", info->partitions[i].name, (unsigned)info->partitions[i].size); + memcpy(image + info->partitions[i].base - flash_first_partition->base, image_parts[j].data, image_parts[j].size); + break; + } - memset(image, 0xff, *len); - memcpy(image, image_os_image->data, image_os_image->size); - memcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size); + assert(image_parts[j].name); + } + } return image; } -struct device_info cpe210_info = { - .vendor = cpe510_vendor, - .support_list = cpe210_support_list, - .support_trail = '\xff', - .partitions = cpe510_partitions, - .generate_sysupgrade_image = &generate_sysupgrade_image, -}; - -struct device_info cpe510_info = { - .vendor = cpe510_vendor, - .support_list = cpe510_support_list, - .support_trail = '\xff', - .partitions = cpe510_partitions, - .generate_sysupgrade_image = &generate_sysupgrade_image, -}; - -struct device_info c2600_info = { - .vendor = c2600_vendor, - .support_list = c2600_support_list, - .support_trail = '\x00', - .partitions = c2600_partitions, - .generate_sysupgrade_image = &generate_sysupgrade_image_c2600, -}; - -struct device_info e9_info = { - .vendor = c2600_vendor, - .support_list = c9_support_list, - .support_trail = '\x00', - .partitions = c5_partitions, -}; - -struct device_info eap120_info = { - .vendor = eap120_vendor, - .support_list = eap120_support_list, - .support_trail = '\xff', - .partitions = eap120_partitions, - .generate_sysupgrade_image = &generate_sysupgrade_image_eap120, -}; - +/** Generates an image according to a given layout and writes it to a file */ static void build_image(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade, - struct device_info *info) { + const struct device_info *info) { struct image_partition_entry parts[6] = {}; parts[0] = make_partition_table(info->partitions); @@ -664,9 +773,9 @@ static void build_image(const char *output, size_t len; void *image; if (sysupgrade) - image = info->generate_sysupgrade_image(info->partitions, parts, &len); + image = generate_sysupgrade_image(info, parts, &len); else - image = generate_factory_image(info->vendor, parts, &len); + image = generate_factory_image(info, parts, &len); FILE *file = fopen(output, "wb"); if (!file) @@ -703,11 +812,22 @@ static void usage(const char *argv0) { }; +static const struct device_info *find_board(const char *id) +{ + struct device_info *board = NULL; + + for (board = boards; board->id != NULL; board++) + if (strcasecmp(id, board->id) == 0) + return board; + + return NULL; +} + int main(int argc, char *argv[]) { const char *board = NULL, *kernel_image = NULL, *rootfs_image = NULL, *output = NULL; bool add_jffs2_eof = false, sysupgrade = false; unsigned rev = 0; - struct device_info *info; + const struct device_info *info; while (true) { int c; @@ -764,17 +884,9 @@ int main(int argc, char *argv[]) { if (!output) error(1, 0, "no output filename has been specified"); - if (strcmp(board, "CPE210") == 0) - info = &cpe210_info; - else if (strcmp(board, "CPE510") == 0) - info = &cpe510_info; - else if (strcmp(board, "C2600") == 0) - info = &c2600_info; - else if (strcmp(board, "EAP120") == 0) - info = &eap120_info; - else if (strcmp(board, "ARCHERC9") == 0) - info = &e9_info; - else + info = find_board(board); + + if (info == NULL) error(1, 0, "unsupported board %s", board); build_image(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, info); diff --git a/tools/flex/Makefile b/tools/flex/Makefile index 78eb1e0b46..60ca240af6 100644 --- a/tools/flex/Makefile +++ b/tools/flex/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=2.6.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/westes/flex/releases/download/v$(PKG_VERSION)/ -PKG_MD5SUM:=cd3c86290fc2676a641aefafeb10848a +PKG_HASH:=2c7a412c1640e094cb058d9b2fe39d450186e09574bebb7aa28f783e3799103f HOST_BUILD_PARALLEL:=1 diff --git a/tools/genext2fs/Makefile b/tools/genext2fs/Makefile index ad941c71ac..3a911df91a 100644 --- a/tools/genext2fs/Makefile +++ b/tools/genext2fs/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=1.4.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/genext2fs -PKG_MD5SUM:=b7b6361bcce2cedff1ae437fadafe53b +PKG_HASH:=404dbbfa7a86a6c3de8225c8da254d026b17fd288e05cec4df2cc7e1f4feecfc include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/gengetopt/Makefile b/tools/gengetopt/Makefile index 74e528e6fd..6d2b85e658 100644 --- a/tools/gengetopt/Makefile +++ b/tools/gengetopt/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=2.22.6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=29749a48dda69277ab969c510597a14e +PKG_HASH:=30b05a88604d71ef2a42a2ef26cd26df242b41f5b011ad03083143a31d9b01f7 HOST_FIXUP := autoreconf diff --git a/tools/gmp/Makefile b/tools/gmp/Makefile index 38cede1e91..19dc8215f3 100644 --- a/tools/gmp/Makefile +++ b/tools/gmp/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gmp -PKG_VERSION:=6.1.1 +PKG_VERSION:=6.1.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gmp/ -PKG_MD5SUM:=e70e183609244a332d80529e7e155a35 +PKG_HASH:=87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912 HOST_FIXUP:=autoreconf diff --git a/tools/isl/Makefile b/tools/isl/Makefile index 24c06268c7..1d375a1390 100644 --- a/tools/isl/Makefile +++ b/tools/isl/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=0.17.1 PKG_SOURCE_URL:=http://isl.gforge.inria.fr PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MD5SUM:=20b83900e234f982a566a3a6b3503bf1 +PKG_HASH:=be152e5c816b477594f4c6194b5666d8129f3a27702756ae9ff60346a8731647 HOST_BUILD_PARALLEL:=1 diff --git a/tools/kernel2minor/Makefile b/tools/kernel2minor/Makefile index 0db99599a6..90f21add45 100644 --- a/tools/kernel2minor/Makefile +++ b/tools/kernel2minor/Makefile @@ -10,14 +10,11 @@ PKG_NAME:=kernel2minor PKG_VERSION:=0.22 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MIRROR_HASH:=8e509deb78e4eddc5f4d0798d3c5fbc99bf6dd151faaf0332a640607042d7f82 PKG_SOURCE_URL:=https://github.com/adron-s/kernel2minor.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_VERSION:=0587740de3e398dbe89d965334c492609cb9739d -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) - include $(INCLUDE_DIR)/host-build.mk define Host/Install diff --git a/tools/kernel2minor/patches/100-portability.patch b/tools/kernel2minor/patches/100-portability.patch new file mode 100644 index 0000000000..43340ae4f2 --- /dev/null +++ b/tools/kernel2minor/patches/100-portability.patch @@ -0,0 +1,13 @@ +--- a/yaffs2/yaffs_guts.h ++++ b/yaffs2/yaffs_guts.h +@@ -17,8 +17,9 @@ + #define __YAFFS_GUTS_H__ + + #include "yportenv.h" ++#include + +-typedef __loff_t loff_t; ++typedef int64_t loff_t; + + #define YAFFS_OK 1 + #define YAFFS_FAIL 0 diff --git a/tools/kernel2minor/patches/110-fix_endian_conv.patch b/tools/kernel2minor/patches/110-fix_endian_conv.patch new file mode 100644 index 0000000000..0d30d05b74 --- /dev/null +++ b/tools/kernel2minor/patches/110-fix_endian_conv.patch @@ -0,0 +1,33 @@ +--- a/k2m_biops.h ++++ b/k2m_biops.h +@@ -10,7 +10,9 @@ + */ + + //нужна ли конвертация. устанавливавется автоматически в 1 для НЕ big_endian систем +-static int endian_need_conv = __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__; ++static int big_endian; ++ ++#define endian_need_conv (!!big_endian ^ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) + + /* конвертор из одного байтового порядка в обратный + x обязательно должна быть переменной но не выражением ! +--- a/kernel2minor.c ++++ b/kernel2minor.c +@@ -76,7 +76,7 @@ void print_help(void){ + char *usage[] = + { "-k", "Path to kernel file", kernel_file, + "-r", "Path to result file", res_file, +- "-e", "Enable endian convert", endian_need_conv ? "Yes" : "No", ++ "-e", "Enable endian convert to big-endian", big_endian ? "Yes" : "No", + "-c", "Use ECC", use_ecc ? "Yes" : "No", + "-s", "FLASH Unit(Chunk) size", chunk_size_str, + "-i", "Add image info block", add_image_info_block ? info_block_size_str : "No", +@@ -595,7 +595,7 @@ int main(int argc, char *argv[]){ + case 'k': snprintf(kernel_file, sizeof(kernel_file) - 1, "%s", optarg); break; + case 'r': snprintf(res_file, sizeof(res_file) - 1, "%s", optarg); break; + case 'c': use_ecc = 1; break; +- case 'e': endian_need_conv = 1; break; ++ case 'e': big_endian = 1; break; + case 's': chunk_size = atoi(optarg); break; + case 'i': add_image_info_block = 1; align_size = atoi(optarg); break; + case 'p': strncpy(platform_name, optarg, sizeof(platform_name)); break; diff --git a/tools/kernel2minor/patches/120-fix_create_mode.patch b/tools/kernel2minor/patches/120-fix_create_mode.patch new file mode 100644 index 0000000000..8fa87078e1 --- /dev/null +++ b/tools/kernel2minor/patches/120-fix_create_mode.patch @@ -0,0 +1,11 @@ +--- a/kernel2minor.c ++++ b/kernel2minor.c +@@ -622,7 +622,7 @@ int main(int argc, char *argv[]){ + perror("Can't open kernel file"); + exit(-1); + } +- r = creat(res_file, 0); ++ r = open(res_file, O_CREAT | O_TRUNC | O_WRONLY, 0644); + if(r <= 0){ + perror("Can't create result file"); + close(k); diff --git a/tools/libelf/Makefile b/tools/libelf/Makefile index 8036b6f189..ab7360ffee 100644 --- a/tools/libelf/Makefile +++ b/tools/libelf/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libelf PKG_VERSION:=0.8.13 -PKG_MD5SUM:=4136d7b4c04df68b686570afa26988ac +PKG_HASH:=591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index e1c3caed83..be6a48be28 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl PKG_VERSION:=2.5.0 -PKG_MD5SUM:=8652bf6b55ab51fb37b686a3f604a2643e0e8fde2c56e6a936027d12afda6eae +PKG_HASH:=8652bf6b55ab51fb37b686a3f604a2643e0e8fde2c56e6a936027d12afda6eae PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -21,4 +21,7 @@ HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +HOST_CONFIGURE_ARGS += --disable-shared +HOST_CFLAGS += $(FPIC) + $(eval $(call HostBuild)) diff --git a/tools/libtool/Makefile b/tools/libtool/Makefile index 3df1d16f11..6526b28b1d 100644 --- a/tools/libtool/Makefile +++ b/tools/libtool/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=2.4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=afcce660d3dc54c63a0a5ba3cf05272239dc3c54bbeba20f6bad250f9dc007ae +PKG_HASH:=afcce660d3dc54c63a0a5ba3cf05272239dc3c54bbeba20f6bad250f9dc007ae HOST_BUILD_PARALLEL:=1 diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile index 08511b0ec9..5982eab5db 100644 --- a/tools/lzma-old/Makefile +++ b/tools/lzma-old/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=4.32 PKG_SOURCE:=lzma-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/ -PKG_MD5SUM:=5587d6ac230ad1903d504fc3253f0e42 +PKG_HASH:=49053e4bb5e0646a841d250d9cb81f7714f5fff04a133216c4748163567acc3d HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/lzma-$(PKG_VERSION) diff --git a/tools/lzma/Makefile b/tools/lzma/Makefile index 4922f8087f..7d2669e95f 100644 --- a/tools/lzma/Makefile +++ b/tools/lzma/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=4.65 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/ -PKG_MD5SUM:=434e51a018b4c8ef377bf81520a53af0 +PKG_HASH:=dcbdb5f4843eff638e4a5e8be0e2486a3c5483df73c70823618db8e66f609ec2 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/tools/m4/Makefile b/tools/m4/Makefile index 47c332123b..6fe9e0b6e6 100644 --- a/tools/m4/Makefile +++ b/tools/m4/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=1.4.17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=12a3c829301a4fd6586a57d3fcf196dc +PKG_HASH:=f0543c3beb51fa6b3337d8025331591e0e18d8ec2886ed391f1aade43477d508 PKG_CAT:=xzcat HOST_BUILD_PARALLEL:=1 diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile index 20cf6cfb60..a886dc0a71 100644 --- a/tools/make-ext4fs/Makefile +++ b/tools/make-ext4fs/Makefile @@ -8,16 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=make-ext4fs -PKG_VERSION:=2016-08-14 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL=$(LEDE_GIT)/project/make_ext4fs.git PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2016-08-14 PKG_SOURCE_VERSION:=484903e4332be6c317f531b008cb2a841a18c506 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_MIRROR_MD5SUM:=5a4473e58dcaed1f41c2391d2326a67af356ca9a3a075fc3486d95276fb9a400 - -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) +PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a25075 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index fc564f47af..bfe60993e2 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2014.10-librecmc +PKG_VERSION:=2014.10 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=\ - https://librecmc.org/librecmc/downloads/sources/archive/ \ + http://mirror2.openwrt.org/sources \ ftp://ftp.denx.de/pub/u-boot -PKG_MD5SUM:=a4d242902687a4ee46fe8dabb5c0f12e +PKG_HASH:=d3b132a7a9b3f3182b7aad71c2dfbd4fc15bea83e12c76134eb3ffefc07d1c71 PKG_CAT:=bzcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) @@ -31,8 +31,8 @@ define Host/Prepare endef define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) defconfig HOSTCFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" HOSTLDFLAGS="$(HOST_LDFLAGS)" - $(MAKE) -C $(HOST_BUILD_DIR) tools-only HOSTCFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" HOSTLDFLAGS="$(HOST_LDFLAGS)" + $(MAKE) -C $(HOST_BUILD_DIR) defconfig HOSTCFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" HOSTLDFLAGS="$(HOST_LDFLAGS)" HOST_LOADLIBES="$$$$(pkg-config --static --libs libcrypto)" + $(MAKE) -C $(HOST_BUILD_DIR) tools-only HOSTCFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" HOSTLDFLAGS="$(HOST_LDFLAGS)" HOST_LOADLIBES="$$$$(pkg-config --static --libs libcrypto)" endef define Host/Install diff --git a/tools/mklibs/Makefile b/tools/mklibs/Makefile index 6bf1431b8c..507c2fd394 100644 --- a/tools/mklibs/Makefile +++ b/tools/mklibs/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=0.1.35 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/m/mklibs/ -PKG_MD5SUM:=3d2a4bd0bbf5ba964b0a1ecdafd1ea9a +PKG_HASH:=ccb1023dc1729c5a37ca6c3eca8e4bac3491116763c8820dfce8eea4845c8567 HOST_FIXUP:=autoreconf diff --git a/tools/mm-macros/Makefile b/tools/mm-macros/Makefile index 3c457ef28e..a8a7bc137f 100644 --- a/tools/mm-macros/Makefile +++ b/tools/mm-macros/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=0.9.10 PKG_SOURCE_URL:=@GNOME/mm-common/0.9 PKG_SOURCE:=mm-common-$(PKG_VERSION).tar.xz -PKG_MD5SUM:=49dc47af8c89ce5b3c768306b9a0f922 +PKG_HASH:=16c0e2bc196b67fbc145edaecb5dbe5818386504fe5703de27002d77140fa217 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/mm-common-$(PKG_VERSION) diff --git a/tools/mpc/Makefile b/tools/mpc/Makefile index f0bf8f4589..ef9bfc4db2 100644 --- a/tools/mpc/Makefile +++ b/tools/mpc/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=1.0.3 PKG_SOURCE_URL:=@GNU/mpc/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MD5SUM:=d6a1d5f8ddea3abd2cc3e98f58352d26 +PKG_HASH:=617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3 HOST_BUILD_PARALLEL:=1 diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index 47ff1c5539..91b5986f6c 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=3.1.5 PKG_SOURCE_URL:=http://www.mpfr.org/mpfr-$(PKG_VERSION) \ @GNU/mpfr PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MD5SUM:=c4ac246cf9795a4491e7766002cd528f +PKG_HASH:=015fde82b3979fbe5f83501986d328331ba8ddf008c1ff3da3c238f49ca062bc HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index e56896ae2c..9e920bcb43 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -10,13 +10,9 @@ PKG_NAME:=mtd-utils PKG_VERSION:=1.5.2 PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_MIRROR_MD5SUM:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 - -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) +PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch b/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch deleted file mode 100644 index e8b491b3ce..0000000000 --- a/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch +++ /dev/null @@ -1,378 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -4,7 +4,7 @@ - VERSION = 1.5.2 - - CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) --CPPFLAGS += -I./include/linux/lzma -+CPPFLAGS += $(XZCPPFLAGS) -I./include/linux/lzma - - ifeq ($(WITHOUT_XATTR), 1) - CPPFLAGS += -DWITHOUT_XATTR -@@ -113,8 +113,13 @@ ifeq ($(WITHOUT_LZO), 1) - else - LZOLDLIBS = -llzo2 - endif -+ifeq ($(WITHOUT_XZ), 1) -+ CPPFLAGS += -DWITHOUT_XZ -+else -+ XZLDLIBS = -llzma -+endif - --LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid -+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid - $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) - - # ---- a/mkfs.ubifs/compr.c -+++ b/mkfs.ubifs/compr.c -@@ -126,6 +126,114 @@ static inline int lzo_init(void) { retur - static inline void lzo_fini(void) { } - #endif - -+#ifndef WITHOUT_XZ -+ -+#include -+ -+struct xz_ctx { -+ lzma_filter filters[3]; -+ lzma_options_lzma opts; -+}; -+ -+static struct xz_ctx *xz_ctx; -+ -+#define LZMA_COMPRESSION_LEVEL 9 -+ -+static struct xz_ctx *xz_ctx_init(void) -+{ -+ struct xz_ctx *ctx; -+ lzma_options_lzma *opts_lzma; -+ uint32_t preset; -+ int ret; -+ -+ ctx = malloc(sizeof(struct xz_ctx)); -+ if (ctx == NULL) -+ goto err; -+ -+ memset(ctx, 0, sizeof(struct xz_ctx)); -+ -+ opts_lzma = &ctx->opts; -+ -+ preset = LZMA_COMPRESSION_LEVEL | LZMA_PRESET_EXTREME; -+ ret = lzma_lzma_preset(opts_lzma, preset); -+ if (ret) -+ goto err_free_ctx; -+ -+ /* TODO: allow to specify LZMA options via command line */ -+#if 0 -+ opts_lzma->lc = 3; -+ opts_lzma->lp = 0; -+ opts_lzma->pb = 2; -+ opts_lzma->nice_len = 64; -+#else -+ opts_lzma->lc = 0; -+ opts_lzma->lp = 2; -+ opts_lzma->pb = 2; -+ opts_lzma->nice_len = 64; -+#endif -+ -+ ctx->filters[0].id = LZMA_FILTER_LZMA2; -+ ctx->filters[0].options = opts_lzma; -+ ctx->filters[1].id = LZMA_VLI_UNKNOWN; -+ -+ return ctx; -+ -+err_free_ctx: -+ free(ctx); -+err: -+ return NULL; -+} -+ -+static void xz_ctx_free(struct xz_ctx *ctx) -+{ -+ free(ctx); -+} -+ -+static int xz_init(void) -+{ -+ xz_ctx = xz_ctx_init(); -+ if (xz_ctx == NULL) -+ return -1; -+ -+ return 0; -+} -+ -+static void xz_fini(void) -+{ -+ xz_ctx_free(xz_ctx); -+} -+ -+static int xz_compress(void *in_buf, size_t in_len, void *out_buf, -+ size_t *out_len) -+{ -+ size_t ret_len; -+ lzma_ret ret_xz; -+ int ret; -+ -+ ret = -1; -+ -+ ret_len = 0; -+ ret_xz = lzma_stream_buffer_encode(xz_ctx->filters, LZMA_CHECK_CRC32, -+ NULL, in_buf, in_len, out_buf, -+ &ret_len, *out_len); -+ if (ret_xz != LZMA_OK) { -+ fprintf(stderr, "XZ error: %d\n", (int) ret_xz); -+ goto out; -+ } -+ -+ *out_len = ret_len; -+ -+ ret = 0; -+out: -+ return ret; -+} -+#else -+static inline int xz_init(void) { return 0; } -+static inline void xz_fini(void) { } -+static inline int xz_compress(void *in_buf, size_t in_len, void *out_buf, -+ size_t *out_len) { return -1; } -+#endif -+ - static int no_compress(void *in_buf, size_t in_len, void *out_buf, - size_t *out_len) - { -@@ -198,6 +306,9 @@ int compress_data(void *in_buf, size_t i - case MKFS_UBIFS_COMPR_LZO: - ret = lzo_compress(in_buf, in_len, out_buf, out_len); - break; -+ case MKFS_UBIFS_COMPR_XZ: -+ ret = xz_compress(in_buf, in_len, out_buf, out_len); -+ break; - case MKFS_UBIFS_COMPR_ZLIB: - ret = zlib_deflate(in_buf, in_len, out_buf, out_len); - break; -@@ -225,12 +336,18 @@ int init_compression(void) - if (ret) - goto err; - -+ ret = xz_init(); -+ if (ret) -+ goto err_lzo; -+ - zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR); - if (!zlib_buf) -- goto err_lzo; -+ goto err_xz; - - return 0; - -+err_xz: -+ xz_fini(); - err_lzo: - lzo_fini(); - err: -@@ -240,6 +357,7 @@ err: - void destroy_compression(void) - { - free(zlib_buf); -+ xz_fini(); - lzo_fini(); - if (errcnt) - fprintf(stderr, "%llu compression errors occurred\n", errcnt); ---- a/mkfs.ubifs/compr.h -+++ b/mkfs.ubifs/compr.h -@@ -36,6 +36,7 @@ enum compression_type - MKFS_UBIFS_COMPR_NONE, - MKFS_UBIFS_COMPR_LZO, - MKFS_UBIFS_COMPR_ZLIB, -+ MKFS_UBIFS_COMPR_XZ, - }; - - int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len, ---- a/mkfs.ubifs/mkfs.ubifs.c -+++ b/mkfs.ubifs/mkfs.ubifs.c -@@ -99,6 +99,9 @@ struct ubifs_info info_; - static struct ubifs_info *c = &info_; - static libubi_t ubi; - -+static int force_compr_set; -+static int force_compr; -+ - /* Debug levels are: 0 (none), 1 (statistics), 2 (files) ,3 (more details) */ - int debug_level; - int verbose; -@@ -133,7 +136,7 @@ static struct inum_mapping **hash_table; - /* Inode creation sequence number */ - static unsigned long long creat_sqnum; - --static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQq"; -+static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:z:j:R:l:j:UQq"; - - static const struct option longopts[] = { - {"root", 1, NULL, 'r'}, -@@ -151,6 +154,7 @@ static const struct option longopts[] = - {"reserved", 1, NULL, 'R'}, - {"compr", 1, NULL, 'x'}, - {"favor-percent", 1, NULL, 'X'}, -+ {"force-compr", 1, NULL, 'z'}, - {"fanout", 1, NULL, 'f'}, - {"space-fixup", 0, NULL, 'F'}, - {"keyhash", 1, NULL, 'k'}, -@@ -178,11 +182,13 @@ static const char *helptext = - "-o, --output=FILE output to FILE\n" - "-j, --jrn-size=SIZE journal size\n" - "-R, --reserved=SIZE how much space should be reserved for the super-user\n" --"-x, --compr=TYPE compression type - \"lzo\", \"favor_lzo\", \"zlib\" or\n" --" \"none\" (default: \"lzo\")\n" -+"-x, --compr=TYPE default compression type - \"lzo\", \"favor_lzo\",\n" -+" \"zlib\" or \"none\" (default: \"lzo\")\n" - "-X, --favor-percent may only be used with favor LZO compression and defines\n" - " how many percent better zlib should compress to make\n" - " mkfs.ubifs use zlib instead of LZO (default 20%)\n" -+"-z, --force-compr=TYPE force to build the fs with different compression -\n" -+" \"lzo\", \"zlib\" or \"none\"\n" - "-f, --fanout=NUM fanout NUM (default: 8)\n" - "-F, --space-fixup file-system free space has to be fixed up on first mount\n" - " (requires kernel version 3.0 or greater)\n" -@@ -472,6 +478,43 @@ static int open_ubi(const char *node) - return 0; - } - -+static const char *get_compr_str(int compr) -+{ -+ switch (compr) { -+ case UBIFS_COMPR_LZO: -+ return "lzo"; -+ case UBIFS_COMPR_ZLIB: -+ return "zlib"; -+ case UBIFS_COMPR_XZ: -+ return "xz"; -+ case UBIFS_COMPR_NONE: -+ return "none"; -+ } -+ -+ return "unknown"; -+} -+ -+static int get_compr_option(char *opt, int *compr_type, int *favor_lzo) -+{ -+ *compr_type = UBIFS_COMPR_LZO; -+ -+ if (favor_lzo) -+ *favor_lzo = 0; -+ -+ if (favor_lzo && strcmp(optarg, "favor_lzo") == 0) -+ *favor_lzo = 1; -+ else if (strcmp(optarg, "zlib") == 0) -+ *compr_type = UBIFS_COMPR_ZLIB; -+ else if (strcmp(optarg, "xz") == 0) -+ *compr_type = UBIFS_COMPR_XZ; -+ else if (strcmp(optarg, "none") == 0) -+ *compr_type = UBIFS_COMPR_NONE; -+ else if (strcmp(optarg, "lzo") != 0) -+ return -1; -+ -+ return 0; -+} -+ - static int get_options(int argc, char**argv) - { - int opt, i; -@@ -594,14 +637,13 @@ static int get_options(int argc, char**a - return err_msg("bad key hash"); - break; - case 'x': -- if (strcmp(optarg, "favor_lzo") == 0) -- c->favor_lzo = 1; -- else if (strcmp(optarg, "zlib") == 0) -- c->default_compr = UBIFS_COMPR_ZLIB; -- else if (strcmp(optarg, "none") == 0) -- c->default_compr = UBIFS_COMPR_NONE; -- else if (strcmp(optarg, "lzo") != 0) -- return err_msg("bad compressor name"); -+ if (get_compr_option(optarg, &c->default_compr, -+ &c->favor_lzo)) -+ return err_msg("bad compressor name '%s'", -+ optarg); -+ if (c->default_compr == UBIFS_COMPR_XZ) -+ return err_msg("'%s' can't be used as default compressor", -+ optarg); - break; - case 'X': - c->favor_percent = strtol(optarg, &endp, 0); -@@ -610,6 +652,12 @@ static int get_options(int argc, char**a - return err_msg("bad favor LZO percent '%s'", - optarg); - break; -+ case 'z': -+ if (get_compr_option(optarg, &force_compr, NULL)) -+ return err_msg("bad forced compressor name '%s'", -+ optarg); -+ force_compr_set = 1; -+ break; - case 'j': - c->max_bud_bytes = get_bytes(optarg); - if (c->max_bud_bytes <= 0) -@@ -684,6 +732,9 @@ static int get_options(int argc, char**a - c->min_io_size = 8; - c->rp_size = add_space_overhead(c->rp_size); - -+ if (force_compr_set == 0) -+ force_compr = c->default_compr; -+ - if (verbose) { - printf("mkfs.ubifs\n"); - printf("\troot: %s\n", root); -@@ -693,17 +744,10 @@ static int get_options(int argc, char**a - printf("\toutput: %s\n", output); - printf("\tjrn_size: %llu\n", c->max_bud_bytes); - printf("\treserved: %llu\n", c->rp_size); -- switch (c->default_compr) { -- case UBIFS_COMPR_LZO: -- printf("\tcompr: lzo\n"); -- break; -- case UBIFS_COMPR_ZLIB: -- printf("\tcompr: zlib\n"); -- break; -- case UBIFS_COMPR_NONE: -- printf("\tcompr: none\n"); -- break; -- } -+ printf("\tcompr: %s\n", get_compr_str(c->default_compr)); -+ if (force_compr_set) -+ printf("\tforced compr: %s\n", -+ get_compr_str(force_compr)); - printf("\tkeyhash: %s\n", (c->key_hash == key_r5_hash) ? - "r5" : "test"); - printf("\tfanout: %d\n", c->fanout); -@@ -1284,7 +1328,7 @@ static int add_file(const char *path_nam - use_compr = UBIFS_COMPR_LZO; - else - #endif -- use_compr = c->default_compr; -+ use_compr = force_compr; - compr_type = compress_data(buf, bytes_read, &dn->data, - &out_len, use_compr); - dn->compr_type = cpu_to_le16(compr_type); ---- a/mkfs.ubifs/mkfs.ubifs.h -+++ b/mkfs.ubifs/mkfs.ubifs.h -@@ -83,6 +83,9 @@ - #if MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB - #error MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB - #endif -+#if MKFS_UBIFS_COMPR_XZ != UBIFS_COMPR_XZ -+#error MKFS_UBIFS_COMPR_XZ != UBIFS_COMPR_XZ -+#endif - - extern int verbose; - extern int debug_level; ---- a/include/mtd/ubifs-media.h -+++ b/include/mtd/ubifs-media.h -@@ -313,6 +313,7 @@ enum { - UBIFS_COMPR_NONE, - UBIFS_COMPR_LZO, - UBIFS_COMPR_ZLIB, -+ UBIFS_COMPR_XZ, - UBIFS_COMPR_TYPES_CNT, - }; - diff --git a/tools/mtd-utils/patches/310-add-static-linking-option.patch b/tools/mtd-utils/patches/310-add-static-linking-option.patch index 810aea9a54..828d7751e5 100644 --- a/tools/mtd-utils/patches/310-add-static-linking-option.patch +++ b/tools/mtd-utils/patches/310-add-static-linking-option.patch @@ -32,12 +32,12 @@ $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) -@@ -119,7 +119,7 @@ else - XZLDLIBS = -llzma +@@ -114,7 +114,7 @@ else + LZOLDLIBS = -llzo2 endif --LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid -+LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS) $(XZLDLIBS)) -lm $(call static_link,-luuid) +-LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid ++LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS)) -lm $(call static_link,-luuid) $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) # diff --git a/tools/mtools/Makefile b/tools/mtools/Makefile index 13de447780..64be6ae01b 100644 --- a/tools/mtools/Makefile +++ b/tools/mtools/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=4.0.18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=17b9f525c1ae3583a478338deb7fbc19 +PKG_HASH:=30d408d039b4cedcd04fbf824c89b0ff85dcbb6f71f13d2d8d65abb3f58cacc3 PKG_CAT:=zcat HOST_BUILD_PARALLEL:=1 diff --git a/tools/patch/Makefile b/tools/patch/Makefile index 1ea96bf33b..9866e2055d 100644 --- a/tools/patch/Makefile +++ b/tools/patch/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=2.7.5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/patch -PKG_MD5SUM:=e3da7940431633fb65a01b91d3b7a27a +PKG_HASH:=fd95153655d6b95567e623843a0e77b81612d502ecf78a489a4aed7867caa299 HOST_BUILD_PARALLEL := 1 diff --git a/tools/patchelf/Makefile b/tools/patchelf/Makefile index 76bcbaf54c..1728fba277 100644 --- a/tools/patchelf/Makefile +++ b/tools/patchelf/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=0.9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://nixos.org/releases/patchelf/patchelf-$(PKG_VERSION) -PKG_MD5SUM:=d02687629c7e1698a486a93a0d607947 +PKG_HASH:=a0f65c1ba148890e9f2f7823f4bedf7ecad5417772f64f994004f59a39014f83 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/pkg-config/Makefile b/tools/pkg-config/Makefile index 57f02b5394..4575c4d44e 100644 --- a/tools/pkg-config/Makefile +++ b/tools/pkg-config/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=0.29.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://pkgconfig.freedesktop.org/releases/ -PKG_MD5SUM:=f739a28cae4e0ca291f82d1d41ef107d +PKG_HASH:=beb43c9e064555469bd4390dcfd8030b1536e0aa103f08d7abf7ae8cac0cb001 HOST_BUILD_PARALLEL:=1 diff --git a/tools/ppl/Makefile b/tools/ppl/Makefile deleted file mode 100644 index 26caced909..0000000000 --- a/tools/ppl/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (C) 2009-2013 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:=ppl -PKG_VERSION:=1.2 - -PKG_SOURCE_URL:=http://bugseng.com/products/ppl/download/ftp/releases/$(PKG_VERSION)/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MD5SUM:=e7bd12043d1064214f7a0107b6da3f17 - -HOST_FIXUP:=autoreconf - -HOST_BUILD_PARALLEL:=1 -HOST_CONFIGURE_PARALLEL:=1 - -include $(INCLUDE_DIR)/host-build.mk - -unexport CFLAGS - -HOST_CONFIGURE_ARGS += \ - --enable-static \ - --disable-shared - -define Host/Configure - (cd $(HOST_BUILD_DIR)/$(3); \ - $(HOST_CONFIGURE_CMD) \ - $(HOST_CONFIGURE_VARS) \ - $(HOST_CONFIGURE_ARGS); \ - ) -endef - -$(eval $(call HostBuild)) diff --git a/tools/ppl/patches/001-disable-serial-tests.patch b/tools/ppl/patches/001-disable-serial-tests.patch deleted file mode 100644 index 91b0753feb..0000000000 --- a/tools/ppl/patches/001-disable-serial-tests.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/tests/BD_Shape/Makefile.am -+++ b/tests/BD_Shape/Makefile.am -@@ -21,8 +21,6 @@ - # For the most up-to-date information see the Parma Polyhedra Library - # site: http://bugseng.com/products/ppl/ . - --AUTOMAKE_OPTIONS = serial-tests -- - if VALGRIND_TESTS_ENABLED - - CHECKER = \ ---- a/tests/Box/Makefile.am -+++ b/tests/Box/Makefile.am -@@ -21,8 +21,6 @@ - # For the most up-to-date information see the Parma Polyhedra Library - # site: http://bugseng.com/products/ppl/ . - --AUTOMAKE_OPTIONS = serial-tests -- - if VALGRIND_TESTS_ENABLED - - CHECKER = \ ---- a/tests/Concrete_Expression/Makefile.am -+++ b/tests/Concrete_Expression/Makefile.am -@@ -21,8 +21,6 @@ - # For the most up-to-date information see the Parma Polyhedra Library - # site: http://bugseng.com/products/ppl/ . - --AUTOMAKE_OPTIONS = serial-tests -- - if VALGRIND_TESTS_ENABLED - - CHECKER = \ ---- a/tests/Octagonal_Shape/Makefile.am -+++ b/tests/Octagonal_Shape/Makefile.am -@@ -21,8 +21,6 @@ - # For the most up-to-date information see the Parma Polyhedra Library - # site: http://bugseng.com/products/ppl/ . - --AUTOMAKE_OPTIONS = serial-tests -- - if VALGRIND_TESTS_ENABLED - - CHECKER = \ diff --git a/tools/qemu/Makefile b/tools/qemu/Makefile index bffbaa45e7..2d954e47aa 100644 --- a/tools/qemu/Makefile +++ b/tools/qemu/Makefile @@ -12,7 +12,7 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=@SAVANNAH/qemu PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MD5SUM:=b6c713a8db638e173af53a62d5178640 +PKG_HASH:=33ceae3fbe516f2cbb151dc98d16c8ccfec74b1056674ad715e75a2f7fed45c3 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/quilt/Makefile b/tools/quilt/Makefile index 1cfa57791b..d0532b5984 100644 --- a/tools/quilt/Makefile +++ b/tools/quilt/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=0.65 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SAVANNAH/quilt -PKG_MD5SUM:=c67ba0228f5b7b8bbe469474661f92d6 +PKG_HASH:=f6cbc788e5cbbb381a3c6eab5b9efce67c776a8662a7795c7432fd27aa096819 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/scons/Makefile b/tools/scons/Makefile index ae947133ef..a148a5c9c8 100644 --- a/tools/scons/Makefile +++ b/tools/scons/Makefile @@ -13,7 +13,7 @@ PKG_VERSION:=2.5.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/scons \ http://fossies.org/linux/misc/ -PKG_MD5SUM:=aaaf09e1351a598f98d17b0cf1103e7a +PKG_HASH:=0b25218ae7b46a967db42f2a53721645b3d42874a65f9552ad16ce26d30f51f2 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/sdimage/Makefile b/tools/sdimage/Makefile index 52c2b41cf2..f2b82ca00a 100644 --- a/tools/sdimage/Makefile +++ b/tools/sdimage/Makefile @@ -7,20 +7,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=imx-uuc -PKG_VERSION=2015-09-13-$(PKG_SOURCE_VERSION) 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_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.xz +PKG_MIRROR_HASH:=b0edd55674cd60268c9b293b47df17db319fd58bd78fdbf26e77039f1a6cf681 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=LICENSE -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_SOURCE_SUBDIR) - include $(INCLUDE_DIR)/host-build.mk define Host/Configure diff --git a/tools/sed/Makefile b/tools/sed/Makefile index 0e130e249a..9ff2e66905 100644 --- a/tools/sed/Makefile +++ b/tools/sed/Makefile @@ -11,12 +11,15 @@ PKG_VERSION:=4.2.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_MD5SUM:=7ffe1c7cdc3233e1e0c4b502df253974 +PKG_HASH:=f048d1838da284c8bc9753e4506b85a1e0cc1ea8999d36f6995bcb9460cddbd7 PKG_CAT:=bzcat export SED:= HOST_BUILD_PARALLEL:=1 +HOSTCC := $(HOSTCC_NOCACHE) +HOSTCXX := $(HOSTCXX_NOCACHE) + include $(INCLUDE_DIR)/host-build.mk HOST_CONFIGURE_ARGS += \ diff --git a/tools/sparse/Makefile b/tools/sparse/Makefile index d5cc8460b7..cc75fdb7c7 100644 --- a/tools/sparse/Makefile +++ b/tools/sparse/Makefile @@ -5,14 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sparse -PKG_VERSION:=0.5-git40791b94 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/devel/sparse/sparse.git +PKG_SOURCE_DATE:=2015-01-24 PKG_SOURCE_VERSION:=40791b94c56b1a6da2a0ddeb1f9d5c9d64de8f93 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MIRROR_HASH:=ec232e48073488e5f7fc2168792932006cfc65240c266c9d395698d6ff15ba81 PKG_BUILD_PARALLEL:=1 diff --git a/tools/squashfs/Makefile b/tools/squashfs/Makefile index 88416bd95d..27adca1d7f 100644 --- a/tools/squashfs/Makefile +++ b/tools/squashfs/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=3.0 PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/squashfs -PKG_MD5SUM:=9fd05d0bfbb712f5fb95edafea5bc733 +PKG_HASH:=39dbda43cf118536deb746c7730b468702d514a19f4cfab73b710e32908ddf20 PKG_CAT:=zcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)$(PKG_VERSION) diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile index 50b70fbe1c..e2c9fc91cc 100644 --- a/tools/squashfs4/Makefile +++ b/tools/squashfs4/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=4.2 PKG_SOURCE:=squashfs$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/squashfs -PKG_MD5SUM:=1b7a781fb4cf8938842279bd3e8ee852 +PKG_HASH:=d9e0195aa922dbb665ed322b9aaa96e04a476ee650f39bbeadb0d00b24022e96 PKG_CAT:=zcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION) diff --git a/tools/tar/Makefile b/tools/tar/Makefile index a619e846ce..5cb695f8bd 100644 --- a/tools/tar/Makefile +++ b/tools/tar/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=1.29 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/tar -PKG_MD5SUM:=236b11190c0a3a6885bdb8d61424f2b36a5872869aa3f7f695dea4b4843ae2f2 +PKG_HASH:=236b11190c0a3a6885bdb8d61424f2b36a5872869aa3f7f695dea4b4843ae2f2 HOST_BUILD_PARALLEL := 1 diff --git a/tools/tar/patches/100-symlink-force-root-name.patch b/tools/tar/patches/100-symlink-force-root-name.patch new file mode 100644 index 0000000000..896b4723fc --- /dev/null +++ b/tools/tar/patches/100-symlink-force-root-name.patch @@ -0,0 +1,22 @@ +Force root/root as names for uid0/gid0 instead of using the system +names. This helps make packed download tarballs more reproducible + +Signed-off-by: Felix Fietkau +--- +--- a/src/create.c ++++ b/src/create.c +@@ -545,12 +545,8 @@ write_gnu_long_link (struct tar_stat_inf + char *tmpname; + + header = start_private_header ("././@LongLink", size, 0); +- uid_to_uname (0, &tmpname); +- UNAME_TO_CHARS (tmpname, header->header.uname); +- free (tmpname); +- gid_to_gname (0, &tmpname); +- GNAME_TO_CHARS (tmpname, header->header.gname); +- free (tmpname); ++ UNAME_TO_CHARS ("root", header->header.uname); ++ GNAME_TO_CHARS ("root", header->header.gname); + + strcpy (header->buffer + offsetof (struct posix_header, magic), + OLDGNU_MAGIC); diff --git a/tools/upslug2/Makefile b/tools/upslug2/Makefile index face1d2183..42448b0185 100644 --- a/tools/upslug2/Makefile +++ b/tools/upslug2/Makefile @@ -14,7 +14,7 @@ PKG_SOURCE_PROTO:=svn PKG_SOURCE_SUBDIR:=upslug2-$(PKG_VERSION) PKG_SOURCE_VERSION:=41 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_MIRROR_MD5SUM:=5c69eae3a2affef8f4f7194cfedfdb9175b04ca433f9ae046c85309b42bdb21e +PKG_MIRROR_HASH:=5c69eae3a2affef8f4f7194cfedfdb9175b04ca433f9ae046c85309b42bdb21e include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/upx/Makefile b/tools/upx/Makefile index 52d2f784f8..800b595abe 100644 --- a/tools/upx/Makefile +++ b/tools/upx/Makefile @@ -11,7 +11,7 @@ PKG_VERSION:=3.91 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.bz2 PKG_SOURCE_URL:=https://github.com/upx/upx/releases/download/v$(PKG_VERSION) -PKG_MD5SUM:=c6d0b3ea2ecb28cb8031d59a4b087a43 +PKG_HASH:=527ce757429841f51675352b1f9f6fc8ad97b18002080d7bf8672c466d8c6a3c PKG_CAT:=bzcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)-src diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 45735e807f..b803d5c351 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.2.2 +PKG_VERSION:=5.2.3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_MD5SUM:=6ff5f57a4b9167155e35e6da8b529de69270efb2b4cf3fbabf41a4ee793840b5 +PKG_HASH:=fd9ca16de1052aac899ad3495ad20dfa906c27b4a5070102a2ec35ca3a4740c1 HOST_BUILD_PARALLEL:=1 diff --git a/tools/yaffs2/Makefile b/tools/yaffs2/Makefile deleted file mode 100644 index 48da131c0b..0000000000 --- a/tools/yaffs2/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2008-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:=yaffs2_android -PKG_VERSION:=2008-12-18 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://android.googlesource.com/platform/external/yaffs2 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_SUBDIR:=$(PKG_NAME) -PKG_SOURCE_VERSION:=d333fc232d7e5ae3370080d5d6f7d88ea9c6b3a1 -PKG_MIRROR_MD5SUM:=8ba9beeda93681a5fc3ea79bdc8186d7ed8c73779e7e64302ce38ab1c1a0faf5 -HOST_BUILD_DIR=$(BUILD_DIR_HOST)/$(PKG_NAME) - -include $(INCLUDE_DIR)/host-build.mk - -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR)/yaffs2/utils \ - CC="$(HOSTCC)" \ - CFLAGS="$(HOST_CFLAGS) -include endian.h" \ - mkyaffs2image -endef - -define Host/Install - $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin - $(INSTALL_BIN) $(HOST_BUILD_DIR)/yaffs2/utils/mkyaffs2image $(STAGING_DIR_HOST)/bin/ -endef - -define Host/Clean - rm -f $(STAGING_DIR_HOST)/bin/mkyaffs2image -endef - -$(eval $(call HostBuild)) diff --git a/tools/yaffs2/patches/100-compile.patch b/tools/yaffs2/patches/100-compile.patch deleted file mode 100644 index 2f83e1fff2..0000000000 --- a/tools/yaffs2/patches/100-compile.patch +++ /dev/null @@ -1,125 +0,0 @@ ---- a/yaffs2/utils/Makefile -+++ b/yaffs2/utils/Makefile -@@ -16,12 +16,11 @@ - - #KERNELDIR = /usr/src/kernel-headers-2.4.18 - --CFLAGS = -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL --CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations --CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline -+CPPFLAGS = -I.. -DCONFIG_YAFFS_UTIL -+CFLAGS = -O2 - - ## Change if you are using a cross-compiler --MAKETOOLS = -+MAKETOOLS = - - CC=$(MAKETOOLS)gcc - -@@ -41,7 +40,7 @@ $(COMMONLINKS) $(MKYAFFSLINKS) $(MKYAFFS - ln -s ../$@ $@ - - $(COMMONOBJS) $(MKYAFFSIMAGEOBJS) $(MKYAFFS2IMAGEOBJS) : %.o: %.c -- $(CC) -c $(CFLAGS) $< -o $@ -+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - - mkyaffsimage: $(COMMONOBJS) $(MKYAFFSIMAGEOBJS) - $(CC) -o $@ $(COMMONOBJS) $(MKYAFFSIMAGEOBJS) ---- a/yaffs2/utils/mkyaffs2image.c -+++ b/yaffs2/utils/mkyaffs2image.c -@@ -32,8 +32,6 @@ - #include - #include - --#include -- - #include "yaffs_ecc.h" - #include "yaffs_guts.h" - -@@ -69,10 +67,12 @@ static int outFile; - - static int error; - --#ifdef HAVE_BIG_ENDIAN -+#if BYTE_ORDER == BIG_ENDIAN - static int convert_endian = 1; --#elif defined(HAVE_LITTLE_ENDIAN) -+#elif BYTE_ORDER == LITTLE_ENDIAN - static int convert_endian = 0; -+#else -+#error Unknown endian type - #endif - - static int obj_compare(const void *a, const void * b) -@@ -298,8 +298,8 @@ static int write_object_header(int objId - - static void fix_stat(const char *path, struct stat *s) - { -- path += source_path_len; -- fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &s->st_mode); -+ s->st_uid = 0; -+ s->st_gid = 0; - } - - static int process_directory(int parent, const char *path, int fixstats) -@@ -342,9 +342,8 @@ static int process_directory(int parent, - newObj = obj_id++; - nObjects++; - -- if (fixstats) { -+ if (fixstats) - fix_stat(full_name, &stats); -- } - - //printf("Object %d, %s is a ",newObj,full_name); - -@@ -473,13 +472,13 @@ int main(int argc, char *argv[]) - fprintf(stderr," -f fix file stat (mods, user, group) for device\n"); - fprintf(stderr," dir the directory tree to be converted\n"); - fprintf(stderr," image_file the output file to hold the image\n"); -- fprintf(stderr," 'convert' produce a big-endian image from a little-endian machine\n"); -+ fprintf(stderr," 'convert' produce a big-endian image\n"); - exit(1); - } - - if ((argc == 4) && (!strncmp(argv[3], "convert", strlen("convert")))) - { -- convert_endian = 1; -+ convert_endian = !convert_endian; - } - - if(stat(argv[1],&stats) < 0) -@@ -503,20 +502,9 @@ int main(int argc, char *argv[]) - exit(1); - } - -- if (fixstats) { -- int len = strlen(argv[1]); -- -- if((len >= 4) && (!strcmp(argv[1] + len - 4, "data"))) { -- source_path_len = len - 4; -- } else if((len >= 7) && (!strcmp(argv[1] + len - 6, "system"))) { -- source_path_len = len - 6; -- } else { -- fprintf(stderr,"Fixstats (-f) option requested but filesystem is not data or android!\n"); -- exit(1); -- } -+ if (fixstats) - fix_stat(argv[1], &stats); -- } -- -+ - //printf("Processing directory %s into image file %s\n",argv[1],argv[2]); - error = write_object_header(1, YAFFS_OBJECT_TYPE_DIRECTORY, &stats, 1,"", -1, NULL); - if(error) ---- a/yaffs2/devextras.h -+++ b/yaffs2/devextras.h -@@ -37,7 +37,7 @@ typedef unsigned char __u8; - typedef unsigned short __u16; - typedef unsigned __u32; - --#if defined(__APPLE__) -+#if defined(__APPLE__) || defined(__FreeBSD__) - typedef long long loff_t; - #endif - diff --git a/tools/yaffs2/patches/110-openbsd-compat.patch b/tools/yaffs2/patches/110-openbsd-compat.patch deleted file mode 100644 index cfafc1ca7e..0000000000 --- a/tools/yaffs2/patches/110-openbsd-compat.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Nur yaffs2_android.orig/yaffs2/yaffs_guts.h yaffs2_android/yaffs2/yaffs_guts.h ---- yaffs2_android.orig/yaffs2/yaffs_guts.h Sun Feb 15 16:23:50 2009 -+++ yaffs2_android/yaffs2/yaffs_guts.h Tue Mar 5 15:45:21 2013 -@@ -823,6 +823,10 @@ - int yaffs_SetAttributes(yaffs_Object * obj, struct iattr *attr); - int yaffs_GetAttributes(yaffs_Object * obj, struct iattr *attr); - -+#if defined(__OpenBSD__) -+#define loff_t off_t -+#endif -+ - /* File operations */ - int yaffs_ReadDataFromFile(yaffs_Object * obj, __u8 * buffer, loff_t offset, - int nBytes); -- 2.25.1